idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
387,776 | @SchedulerSupport(SchedulerSupport.NONE)<NEW_LINE>public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Maybe<R> zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull MaybeSource<? extends T5> source5, @NonNull Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> zipper) {<NEW_LINE>Objects.requireNonNull(source1, "source1 is null");<NEW_LINE><MASK><NEW_LINE>Objects.requireNonNull(source3, "source3 is null");<NEW_LINE>Objects.requireNonNull(source4, "source4 is null");<NEW_LINE>Objects.requireNonNull(source5, "source5 is null");<NEW_LINE>Objects.requireNonNull(zipper, "zipper is null");<NEW_LINE>return zipArray(Functions.toFunction(zipper), source1, source2, source3, source4, source5);<NEW_LINE>} | Objects.requireNonNull(source2, "source2 is null"); |
1,325,427 | private void generateMethodBody(MethodVisitor mv, String initClass, String stopFuncName, AsyncDataCollector asyncDataCollector) {<NEW_LINE>// create FP value<NEW_LINE>JvmCodeGenUtil.createFunctionPointer(mv, initClass, stopFuncName);<NEW_LINE>// no parent strand<NEW_LINE>mv.visitInsn(ACONST_NULL);<NEW_LINE>jvmTypeGen.loadType(mv, new BNilType());<NEW_LINE>MethodGenUtils.submitToScheduler(mv, initClass, "stop", asyncDataCollector);<NEW_LINE>int <MASK><NEW_LINE>mv.visitVarInsn(ASTORE, futureIndex);<NEW_LINE>mv.visitVarInsn(ALOAD, futureIndex);<NEW_LINE>mv.visitFieldInsn(GETFIELD, FUTURE_VALUE, STRAND, GET_STRAND);<NEW_LINE>mv.visitTypeInsn(NEW, STACK);<NEW_LINE>mv.visitInsn(DUP);<NEW_LINE>mv.visitMethodInsn(INVOKESPECIAL, STACK, JVM_INIT_METHOD, "()V", false);<NEW_LINE>mv.visitFieldInsn(PUTFIELD, STRAND_CLASS, MethodGenUtils.FRAMES, STACK_FRAMES);<NEW_LINE>int schedulerIndex = indexMap.get(SCHEDULER_VAR);<NEW_LINE>mv.visitVarInsn(ALOAD, schedulerIndex);<NEW_LINE>mv.visitMethodInsn(INVOKEVIRTUAL, SCHEDULER, SCHEDULER_START_METHOD, "()V", false);<NEW_LINE>} | futureIndex = indexMap.get(FUTURE_VAR); |
1,662,704 | public void build() {<NEW_LINE>int complexity = targetMethodComplexity(classScope);<NEW_LINE>if (values.size() < complexity) {<NEW_LINE>int index = 0;<NEW_LINE>for (V value : values) {<NEW_LINE>consumer.accept(value, index++, methodNode);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int count = 0;<NEW_LINE>Iterator<V> it = values.iterator();<NEW_LINE>while (count < values.size()) {<NEW_LINE>int remaining = values.size() - count;<NEW_LINE>int target = Math.min(remaining, complexity);<NEW_LINE>CodegenMethod child = methodNode.makeChild(EPTypePremade.VOID.getEPType(), provider, classScope).addParam(params);<NEW_LINE>methodNode.getBlock().localMethod(child, paramNames());<NEW_LINE>for (int i = 0; i < target; i++) {<NEW_LINE><MASK><NEW_LINE>consumer.accept(value, count, child);<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | V value = it.next(); |
666,968 | final ListShardsResult executeListShards(ListShardsRequest listShardsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listShardsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListShardsRequest> request = null;<NEW_LINE>Response<ListShardsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListShardsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listShardsRequest));<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, "Kinesis");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListShards");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListShardsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListShardsResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,716,134 | static WritableArray cloneArray(ReadableArray source) {<NEW_LINE>WritableNativeArray result = new WritableNativeArray();<NEW_LINE>for (int i = 0; i < source.size(); i++) {<NEW_LINE>ReadableType <MASK><NEW_LINE>switch(indexType) {<NEW_LINE>case Null:<NEW_LINE>result.pushNull();<NEW_LINE>break;<NEW_LINE>case Boolean:<NEW_LINE>result.pushBoolean(source.getBoolean(i));<NEW_LINE>break;<NEW_LINE>case Number:<NEW_LINE>try {<NEW_LINE>result.pushInt(source.getInt(i));<NEW_LINE>} catch (Exception e) {<NEW_LINE>result.pushDouble(source.getDouble(i));<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case String:<NEW_LINE>result.pushString(source.getString(i));<NEW_LINE>break;<NEW_LINE>case Map:<NEW_LINE>result.pushMap(cloneMap(source.getMap(i)));<NEW_LINE>break;<NEW_LINE>case Array:<NEW_LINE>result.pushArray(cloneArray(source.getArray(i)));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>Log.e(TAG, "Could not convert object at index " + i + ".");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | indexType = source.getType(i); |
1,560,458 | private static PsiElement performReplace(@NotNull final String newName, @NotNull final PsiElement declaration, @NotNull ErlangExpression initializer, @NotNull final List<PsiElement> occurrences) {<NEW_LINE>Project project = declaration.getProject();<NEW_LINE>return WriteCommandAction.writeCommandAction(project, initializer.getContainingFile()).withName("Extract variable").compute(() -> {<NEW_LINE>boolean alone = occurrences.size() == 1 && occurrences.get(0).getParent() instanceof ErlangClauseBody;<NEW_LINE>PsiElement createdDeclaration = replaceLeftmostArgumentDefinition(declaration, occurrences);<NEW_LINE>if (createdDeclaration == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (alone) {<NEW_LINE>PsiElement firstItem = ContainerUtil.getFirstItem(occurrences);<NEW_LINE>if (firstItem != null)<NEW_LINE>firstItem.delete();<NEW_LINE>} else {<NEW_LINE>if (createdDeclaration != null) {<NEW_LINE>modifyDeclaration(createdDeclaration);<NEW_LINE>}<NEW_LINE>PsiElement newExpression = ErlangElementFactory.createQVarFromText(project, newName);<NEW_LINE>for (PsiElement occurrence : occurrences) {<NEW_LINE>ErlangPsiImplUtil.getOutermostParenthesizedExpression((ErlangExpression) occurrence).replace(newExpression);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return createdDeclaration;<NEW_LINE>});<NEW_LINE>} | createdDeclaration = addDeclaration(declaration, occurrences); |
1,686,421 | public static DescribePerDateDataResponse unmarshall(DescribePerDateDataResponse describePerDateDataResponse, UnmarshallerContext context) {<NEW_LINE>describePerDateDataResponse.setRequestId(context.stringValue("DescribePerDateDataResponse.RequestId"));<NEW_LINE>List<DataViewItem> dataView = new ArrayList<DataViewItem>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribePerDateDataResponse.DataView.Length"); i++) {<NEW_LINE>DataViewItem dataViewItem = new DataViewItem();<NEW_LINE>dataViewItem.setDataTime(context.stringValue("DescribePerDateDataResponse.DataView[" + i + "].DataTime"));<NEW_LINE>dataViewItem.setCallTimes(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].CallTimes"));<NEW_LINE>dataViewItem.setTotalHit(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].TotalHit"));<NEW_LINE>dataViewItem.setHitRate(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].HitRate"));<NEW_LINE>dataViewItem.setIsGreyPhone(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsGreyPhone"));<NEW_LINE>dataViewItem.setIsBlackPhone(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBlackPhone"));<NEW_LINE>dataViewItem.setIsVirtualOperator(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsVirtualOperator"));<NEW_LINE>dataViewItem.setIsOpenCommonPort1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsOpenCommonPort1d"));<NEW_LINE>dataViewItem.setIsOpenCommonPort7d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsOpenCommonPort7d"));<NEW_LINE>dataViewItem.setIsOpenCommonPort30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsOpenCommonPort30d"));<NEW_LINE>dataViewItem.setIsCheatFlow1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsCheatFlow1d"));<NEW_LINE>dataViewItem.setIsCheatFlow7d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsCheatFlow7d"));<NEW_LINE>dataViewItem.setIsCheatFlow30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsCheatFlow30d"));<NEW_LINE>dataViewItem.setIsProxy1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsProxy1d"));<NEW_LINE>dataViewItem.setIsProxy7d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsProxy7d"));<NEW_LINE>dataViewItem.setIsProxy30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsProxy30d"));<NEW_LINE>dataViewItem.setIsHiJack1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsHiJack1d"));<NEW_LINE>dataViewItem.setIsHiJack7d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsHiJack7d"));<NEW_LINE>dataViewItem.setIsHiJack30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsHiJack30d"));<NEW_LINE>dataViewItem.setIsC21d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsC21d"));<NEW_LINE>dataViewItem.setIsC27d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsC27d"));<NEW_LINE>dataViewItem.setIsC230d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsC230d"));<NEW_LINE>dataViewItem.setIsBotnet1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBotnet1d"));<NEW_LINE>dataViewItem.setIsBotnet7d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBotnet7d"));<NEW_LINE>dataViewItem.setIsBotnet30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBotnet30d"));<NEW_LINE>dataViewItem.setIsNetAttack1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsNetAttack1d"));<NEW_LINE>dataViewItem.setIsNetAttack7d(context.longValue<MASK><NEW_LINE>dataViewItem.setIsNetAttack30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsNetAttack30d"));<NEW_LINE>dataViewItem.setIsBlackCampaign1d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBlackCampaign1d"));<NEW_LINE>dataViewItem.setIsBlackCampaign7d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBlackCampaign7d"));<NEW_LINE>dataViewItem.setIsBlackCampaign30d(context.longValue("DescribePerDateDataResponse.DataView[" + i + "].IsBlackCampaign30d"));<NEW_LINE>dataView.add(dataViewItem);<NEW_LINE>}<NEW_LINE>describePerDateDataResponse.setDataView(dataView);<NEW_LINE>return describePerDateDataResponse;<NEW_LINE>} | ("DescribePerDateDataResponse.DataView[" + i + "].IsNetAttack7d")); |
221,457 | public static Program heuristicJoinOrder(final Iterable<? extends RelOptRule> rules, final boolean bushy, final int minJoinCount) {<NEW_LINE>return (planner, rel, requiredOutputTraits, materializations, lattices) -> {<NEW_LINE>final int joinCount = RelOptUtil.countJoins(rel);<NEW_LINE>final Program program;<NEW_LINE>if (joinCount < minJoinCount) {<NEW_LINE>program = ofRules(rules);<NEW_LINE>} else {<NEW_LINE>// Create a program that gathers together joins as a MultiJoin.<NEW_LINE>final HepProgram hep = new HepProgramBuilder().addRuleInstance(FilterJoinRule.FILTER_ON_JOIN).addMatchOrder(HepMatchOrder.BOTTOM_UP).addRuleInstance(JoinToMultiJoinRule.INSTANCE).build();<NEW_LINE>final Program program1 = of(hep, false, DefaultRelMetadataProvider.INSTANCE);<NEW_LINE>// Create a program that contains a rule to expand a MultiJoin<NEW_LINE>// into heuristically ordered joins.<NEW_LINE>// We use the rule set passed in, but remove JoinCommuteRule and<NEW_LINE>// JoinPushThroughJoinRule, because they cause exhaustive search.<NEW_LINE>final List<RelOptRule> list = Lists.newArrayList(rules);<NEW_LINE>list.removeAll(ImmutableList.of(JoinCommuteRule.INSTANCE, JoinAssociateRule.INSTANCE, JoinPushThroughJoinRule.LEFT, JoinPushThroughJoinRule.RIGHT));<NEW_LINE>list.add(bushy ? MultiJoinOptimizeBushyRule.INSTANCE : LoptOptimizeJoinRule.INSTANCE);<NEW_LINE><MASK><NEW_LINE>program = sequence(program1, program2);<NEW_LINE>}<NEW_LINE>return program.run(planner, rel, requiredOutputTraits, materializations, lattices);<NEW_LINE>};<NEW_LINE>} | final Program program2 = ofRules(list); |
1,790,082 | static void c_1_4() throws Exception {<NEW_LINE>StreamOperator<?> ratings = Chap24.getStreamSourceRatings();<NEW_LINE>ratings = ratings.filter("user_id=1 AND item_id<5");<NEW_LINE>ratings.print();<NEW_LINE>StreamOperator.execute();<NEW_LINE>ratings.link(new UDFStreamOp().setFunc(new FromUnixTimestamp()).setSelectedCols("ts").setOutputCol<MASK><NEW_LINE>StreamOperator.execute();<NEW_LINE>StreamOperator.registerFunction("from_unix_timestamp", new FromUnixTimestamp());<NEW_LINE>ratings.select("user_id, item_id, rating, from_unix_timestamp(ts) AS ts").print();<NEW_LINE>StreamOperator.execute();<NEW_LINE>ratings.registerTableName("ratings");<NEW_LINE>StreamOperator.sqlQuery("SELECT user_id, item_id, rating, from_unix_timestamp(ts) AS ts FROM ratings").print();<NEW_LINE>StreamOperator.execute();<NEW_LINE>} | ("ts")).print(); |
366,099 | void updateUserPassword(final String userId, final String password) {<NEW_LINE>mScheduler.execute(() -> {<NEW_LINE>Connection connection = null;<NEW_LINE>PreparedStatement statement = null;<NEW_LINE>try {<NEW_LINE>connection = DBUtil.getConnection();<NEW_LINE>String sql = "update t_user set `_passwd_md5` = ? where `_uid` = ?";<NEW_LINE>statement = connection.prepareStatement(sql);<NEW_LINE>int index = 1;<NEW_LINE>try {<NEW_LINE>MessageDigest <MASK><NEW_LINE>String passwdMd5 = Base64.getEncoder().encodeToString(md5.digest(password.getBytes("utf-8")));<NEW_LINE>statement.setString(index, passwdMd5);<NEW_LINE>} catch (Exception e) {<NEW_LINE>statement.setString(index, "");<NEW_LINE>}<NEW_LINE>index++;<NEW_LINE>statement.setString(index++, userId);<NEW_LINE>int count = statement.executeUpdate();<NEW_LINE>LOG.info("Update rows {}", count);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>e.printStackTrace();<NEW_LINE>Utility.printExecption(LOG, e, RDBS_Exception);<NEW_LINE>} finally {<NEW_LINE>DBUtil.closeDB(connection, statement);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | md5 = MessageDigest.getInstance("MD5"); |
836,610 | public PinotResourceManagerResponse createBrokerTenant(Tenant brokerTenant) {<NEW_LINE>List<MASK><NEW_LINE>int numberOfInstances = brokerTenant.getNumberOfInstances();<NEW_LINE>if (unTaggedInstanceList.size() < numberOfInstances) {<NEW_LINE>String message = "Failed to allocate broker instances to Tag : " + brokerTenant.getTenantName() + ", Current number of untagged server instances : " + unTaggedInstanceList.size() + ", Request asked number is : " + brokerTenant.getNumberOfInstances();<NEW_LINE>LOGGER.error(message);<NEW_LINE>return PinotResourceManagerResponse.failure(message);<NEW_LINE>}<NEW_LINE>String brokerTag = TagNameUtils.getBrokerTagForTenant(brokerTenant.getTenantName());<NEW_LINE>for (int i = 0; i < brokerTenant.getNumberOfInstances(); i++) {<NEW_LINE>retagInstance(unTaggedInstanceList.get(i), Helix.UNTAGGED_BROKER_INSTANCE, brokerTag);<NEW_LINE>}<NEW_LINE>return PinotResourceManagerResponse.SUCCESS;<NEW_LINE>} | <String> unTaggedInstanceList = getOnlineUnTaggedBrokerInstanceList(); |
1,555,908 | private UpdateHostResponse resume(RestApi.RequestContext context) {<NEW_LINE>String hostNameString = context.pathParameters().getStringOrThrow("hostname");<NEW_LINE>HostName hostName = new HostName(hostNameString);<NEW_LINE>try {<NEW_LINE>orchestrator.resume(hostName);<NEW_LINE>} catch (HostNameNotFoundException e) {<NEW_LINE>log.log(Level.FINE, () -> "Host not found: " + hostName);<NEW_LINE>throw new RestApiException.NotFound(e);<NEW_LINE>} catch (UncheckedTimeoutException e) {<NEW_LINE>log.log(Level.FINE, () -> "Failed to resume " + hostName + ": " + e.getMessage());<NEW_LINE>throw <MASK><NEW_LINE>} catch (HostStateChangeDeniedException e) {<NEW_LINE>log.log(Level.FINE, () -> "Failed to resume " + hostName + ": " + e.getMessage());<NEW_LINE>throw restApiExceptionWithDenialReason("resume", hostName, e);<NEW_LINE>}<NEW_LINE>return new UpdateHostResponse(hostName.s(), null);<NEW_LINE>} | restApiExceptionFromTimeout("resume", hostName, e); |
129,929 | protected void paint(XYItem item, List<ItemSelection> highlighted, List<ItemSelection> selected, Graphics2D g, Rectangle dirtyArea, SynchronousXYChartContext context) {<NEW_LINE>if (!isPainting())<NEW_LINE>return;<NEW_LINE>if (item.getValuesCount() < 2)<NEW_LINE>return;<NEW_LINE>if (context.getViewWidth() == 0 || context.getViewHeight() == 0)<NEW_LINE>return;<NEW_LINE>int[][] points = getPoints(item, <MASK><NEW_LINE>if (points == null)<NEW_LINE>return;<NEW_LINE>int[] xPoints = points[0];<NEW_LINE>int[] yPoints = points[1];<NEW_LINE>int npoints = points[2][0];<NEW_LINE>if (fillColor != null) {<NEW_LINE>int zeroY = Utils.checkedInt(context.getViewY(context.getDataOffsetY()));<NEW_LINE>zeroY = Math.max(Utils.checkedInt(context.getViewportOffsetY()), zeroY);<NEW_LINE>zeroY = Math.min(Utils.checkedInt(context.getViewportOffsetY() + context.getViewportHeight()), zeroY);<NEW_LINE>Polygon polygon = new Polygon();<NEW_LINE>polygon.xpoints = xPoints;<NEW_LINE>polygon.ypoints = yPoints;<NEW_LINE>polygon.npoints = npoints + 2;<NEW_LINE>polygon.xpoints[npoints] = xPoints[npoints - 1];<NEW_LINE>polygon.ypoints[npoints] = zeroY;<NEW_LINE>polygon.xpoints[npoints + 1] = xPoints[0];<NEW_LINE>polygon.ypoints[npoints + 1] = zeroY;<NEW_LINE>if (fillColor2 == null || Utils.forceSpeed())<NEW_LINE>g.setPaint(fillColor);<NEW_LINE>else<NEW_LINE>g.setPaint(new GradientPaint(0, context.getViewportOffsetY(), fillColor, 0, context.getViewportOffsetY() + context.getViewportHeight(), fillColor2));<NEW_LINE>g.fill(polygon);<NEW_LINE>}<NEW_LINE>if (lineColor != null) {<NEW_LINE>g.setPaint(lineColor);<NEW_LINE>g.setStroke(lineStroke);<NEW_LINE>g.drawPolyline(xPoints, yPoints, npoints);<NEW_LINE>}<NEW_LINE>} | dirtyArea, context, type, maxValueOffset); |
815,234 | private boolean selectVictim(int bucketStart) {<NEW_LINE>byte victimOffset = (byte) rnd.nextInt(itemsPerSet);<NEW_LINE>int victimChain = indexing.getChainAtOffset(hashFunc.fpaux, chainIndex, lastIndex, victimOffset);<NEW_LINE>long victim = cache[bucketStart + victimOffset];<NEW_LINE>// this if is still for debugging and common sense. Should be eliminated for performance once<NEW_LINE>// I am sure of the correctness.<NEW_LINE>if (indexing.chainExist(chainIndex[hashFunc.fpaux.set], victimChain)) {<NEW_LINE>int victimScore = ghostCache.countItem(victim);<NEW_LINE>int currItemScore = ghostCache.<MASK><NEW_LINE>if (currItemScore > victimScore) {<NEW_LINE>replace(hashFunc.fpaux, (byte) victimChain, bucketStart, victimOffset);<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Failed to replace");<NEW_LINE>}<NEW_LINE>} | countItem(hashFunc.fpaux.value); |
1,702,991 | public static FitData<Circle2D_F64> averageCircle_I32(List<Point2D_I32> points, DogArray_F64 optional, @Nullable FitData<Circle2D_F64> outputStorage) {<NEW_LINE>if (outputStorage == null) {<NEW_LINE>outputStorage = new FitData<>(new Circle2D_F64());<NEW_LINE>}<NEW_LINE>if (optional == null) {<NEW_LINE>optional = new DogArray_F64();<NEW_LINE>}<NEW_LINE>Circle2D_F64 circle = outputStorage.shape;<NEW_LINE><MASK><NEW_LINE>// find center of the circle by computing the mean x and y<NEW_LINE>int sumX = 0, sumY = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>Point2D_I32 p = points.get(i);<NEW_LINE>sumX += p.x;<NEW_LINE>sumY += p.y;<NEW_LINE>}<NEW_LINE>optional.reset();<NEW_LINE>double centerX = circle.center.x = sumX / (double) N;<NEW_LINE>double centerY = circle.center.y = sumY / (double) N;<NEW_LINE>double meanR = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>Point2D_I32 p = points.get(i);<NEW_LINE>double dx = p.x - centerX;<NEW_LINE>double dy = p.y - centerY;<NEW_LINE>double r = Math.sqrt(dx * dx + dy * dy);<NEW_LINE>optional.push(r);<NEW_LINE>meanR += r;<NEW_LINE>}<NEW_LINE>meanR /= N;<NEW_LINE>circle.radius = meanR;<NEW_LINE>// compute radius variance<NEW_LINE>double variance = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>double diff = optional.get(i) - meanR;<NEW_LINE>variance += diff * diff;<NEW_LINE>}<NEW_LINE>outputStorage.error = variance / N;<NEW_LINE>return outputStorage;<NEW_LINE>} | int N = points.size(); |
258,878 | public void buildModel() {<NEW_LINE>model = new Model("CarSequencing");<NEW_LINE>parse(data.source());<NEW_LINE>prepare();<NEW_LINE>int max = nClasses - 1;<NEW_LINE>cars = model.intVarArray("cars", nCars, 0, max, false);<NEW_LINE>IntVar[] expArray = new IntVar[nClasses];<NEW_LINE>for (int optNum = 0; optNum < options.length; optNum++) {<NEW_LINE>int nbConf = options[optNum].length;<NEW_LINE>for (int seqStart = 0; seqStart < (cars.length - optfreq[optNum][1]); seqStart++) {<NEW_LINE>IntVar[] carSequence = extractor(cars, seqStart, optfreq[optNum][1]);<NEW_LINE>// configurations that include given option may be chosen<NEW_LINE>IntVar[] atMost = new IntVar[nbConf];<NEW_LINE>for (int i = 0; i < nbConf; i++) {<NEW_LINE>// optfreq[optNum][0] times AT MOST<NEW_LINE>atMost[i] = model.intVar("atmost_" + optNum + "_" + seqStart + "_" + nbConf, 0, optfreq[<MASK><NEW_LINE>}<NEW_LINE>model.globalCardinality(carSequence, options[optNum], atMost, false).post();<NEW_LINE>IntVar[] atLeast = model.intVarArray("atleast_" + optNum + "_" + seqStart, idleConfs[optNum].length, 0, max, true);<NEW_LINE>model.globalCardinality(carSequence, idleConfs[optNum], atLeast, false).post();<NEW_LINE>// all others configurations may be chosen<NEW_LINE>IntVar sum = model.intVar("sum", optfreq[optNum][1] - optfreq[optNum][0], 99999999, true);<NEW_LINE>model.sum(atLeast, "=", sum).post();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[] values = new int[expArray.length];<NEW_LINE>for (int i = 0; i < expArray.length; i++) {<NEW_LINE>expArray[i] = model.intVar("var_" + i, 0, demands[i], false);<NEW_LINE>values[i] = i;<NEW_LINE>}<NEW_LINE>model.globalCardinality(cars, values, expArray, false).post();<NEW_LINE>} | optNum][0], true); |
886,404 | public RecordError unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RecordError recordError = new RecordError();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Code", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>recordError.setCode(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Description", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>recordError.setDescription(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return recordError;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
232,446 | public static String generateTestTokenSWT(TokenRestrictionTemplate tokenTemplate, TokenVerificationKey signingKeyToUse, UUID keyIdForContentKeyIdentifierClaim, Date tokenExpiration) {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>for (TokenClaim claim : tokenTemplate.getRequiredClaims()) {<NEW_LINE>String claimValue = claim.getClaimValue();<NEW_LINE>if (claim.getClaimType().equals(TokenClaim.getContentKeyIdentifierClaimType())) {<NEW_LINE>if (keyIdForContentKeyIdentifierClaim == null) {<NEW_LINE>throw new IllegalArgumentException(String.format("The 'keyIdForContentKeyIdentifierClaim' parameter cannot be null when the token template contains a required '%s' claim type.", TokenClaim.getContentKeyIdentifierClaimType()));<NEW_LINE>}<NEW_LINE>claimValue = keyIdForContentKeyIdentifierClaim.toString();<NEW_LINE>}<NEW_LINE>builder.append(String.format("%s=%s&", urlEncode(claim.getClaimType()), urlEncode(claimValue)));<NEW_LINE>}<NEW_LINE>builder.append(String.format("Audience=%s&", urlEncode(tokenTemplate.getAudience().toString())));<NEW_LINE>builder.append(String.format("ExpiresOn=%s&", generateTokenExpiry(tokenExpiration)));<NEW_LINE>builder.append(String.format("Issuer=%s", urlEncode(tokenTemplate.getIssuer().toString())));<NEW_LINE>SymmetricVerificationKey signingKey = (SymmetricVerificationKey) signingKeyToUse;<NEW_LINE>SecretKeySpec secretKey = new SecretKeySpec(signingKey.getKeyValue(), "HmacSHA256");<NEW_LINE>Mac mac;<NEW_LINE>try {<NEW_LINE>mac = Mac.getInstance("HmacSHA256");<NEW_LINE>mac.init(secretKey);<NEW_LINE>} catch (NoSuchAlgorithmException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (InvalidKeyException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>byte[] unsignedTokenAsBytes = builder.toString().getBytes();<NEW_LINE>byte[] signatureBytes = mac.doFinal(unsignedTokenAsBytes);<NEW_LINE>String encoded = new String<MASK><NEW_LINE>builder.append(String.format("&HMACSHA256=%s", urlEncode(encoded)));<NEW_LINE>return builder.toString();<NEW_LINE>} | (Base64.encode(signatureBytes)); |
851,644 | protected void parseTimerStartEventDefinitionForEventSubprocess(Element timerEventDefinition, ActivityImpl timerActivity, boolean interrupting) {<NEW_LINE>timerActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_TIMER);<NEW_LINE>TimerDeclarationImpl timerDeclaration = parseTimer(<MASK><NEW_LINE>timerDeclaration.setActivity(timerActivity);<NEW_LINE>timerDeclaration.setEventScopeActivityId(timerActivity.getEventScope().getId());<NEW_LINE>timerDeclaration.setRawJobHandlerConfiguration(timerActivity.getFlowScope().getId());<NEW_LINE>timerDeclaration.setInterruptingTimer(interrupting);<NEW_LINE>if (interrupting) {<NEW_LINE>Element timeCycleElement = timerEventDefinition.element("timeCycle");<NEW_LINE>if (timeCycleElement != null) {<NEW_LINE>addTimeCycleWarning(timeCycleElement, "interrupting start", timerActivity.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addTimerDeclaration(timerActivity.getEventScope(), timerDeclaration);<NEW_LINE>} | timerEventDefinition, timerActivity, TimerStartEventSubprocessJobHandler.TYPE); |
538,160 | public void enterRouter_eigrp(Router_eigrpContext ctx) {<NEW_LINE>Optional<String> processTagOrErr = toString(ctx, ctx.tag);<NEW_LINE>if (processTagOrErr.isPresent()) {<NEW_LINE>String processTag = processTagOrErr.get();<NEW_LINE>_currentEigrpProcess = _c.getOrCreateEigrpProcess(processTag);<NEW_LINE>_c.<MASK><NEW_LINE>_c.referenceStructure(ROUTER_EIGRP, processTag, ROUTER_EIGRP_SELF_REFERENCE, ctx.tag.getStart().getLine());<NEW_LINE>toMaybeAsn(processTag).ifPresent(_currentEigrpProcess::setAsn);<NEW_LINE>} else {<NEW_LINE>// Dummy process, with all inner config also dummy.<NEW_LINE>_currentEigrpProcess = new EigrpProcessConfiguration();<NEW_LINE>}<NEW_LINE>_currentEigrpVrf = _currentEigrpProcess.getOrCreateVrf(DEFAULT_VRF_NAME);<NEW_LINE>_currentEigrpVrfIpAf = _currentEigrpVrf.getVrfIpv4AddressFamily();<NEW_LINE>} | defineStructure(ROUTER_EIGRP, processTag, ctx); |
174,390 | public void contribute(BuildContext context, AotOptions aotOptions) {<NEW_LINE>ResourceLoader resourceLoader = new DefaultResourceLoader(context.getClassLoader());<NEW_LINE>ClassLoader classLoader = context.getClassLoader();<NEW_LINE>Class<?> applicationClass;<NEW_LINE>String applicationClassName = context.getApplicationClass();<NEW_LINE>if (applicationClassName == null) {<NEW_LINE>logger.warn("No application class detected, skipping context bootstrap generation");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>logger.info("Detected application class: " + applicationClassName);<NEW_LINE>applicationClass = ClassUtils.forName(applicationClassName, classLoader);<NEW_LINE>} catch (ClassNotFoundException exc) {<NEW_LINE>throw new IllegalStateException("Could not load application class " + applicationClassName, exc);<NEW_LINE>}<NEW_LINE>StopWatch watch = new StopWatch();<NEW_LINE>logger.info("Processing application context");<NEW_LINE>watch.start();<NEW_LINE>GenericApplicationContext applicationContext = new AotApplicationContextFactory(resourceLoader).createApplicationContext(applicationClass);<NEW_LINE>configureEnvironment(applicationContext.getEnvironment());<NEW_LINE>ApplicationContextAotProcessor aotProcessor = new ApplicationContextAotProcessor(classLoader);<NEW_LINE>DefaultBootstrapWriterContext writerContext <MASK><NEW_LINE>aotProcessor.process(applicationContext, writerContext);<NEW_LINE>watch.stop();<NEW_LINE>logger.info("Processed " + applicationContext.getBeanFactory().getBeanDefinitionNames().length + " bean definitions in " + watch.getTotalTimeMillis() + "ms");<NEW_LINE>writerContext.toJavaFiles().forEach(javaFile -> context.addSourceFiles(SourceFiles.fromJavaFile(javaFile)));<NEW_LINE>NativeConfigurationRegistry nativeConfigurationRegistry = writerContext.getNativeConfigurationRegistry();<NEW_LINE>context.getOptions().addAll(nativeConfigurationRegistry.options());<NEW_LINE>context.describeReflection(reflectionDescriptor -> nativeConfigurationRegistry.reflection().toClassDescriptors().forEach(reflectionDescriptor::merge));<NEW_LINE>context.describeResources(resourcesDescriptor -> resourcesDescriptor.merge(nativeConfigurationRegistry.resources().toResourcesDescriptor()));<NEW_LINE>context.describeProxies(proxiesDescriptor -> proxiesDescriptor.merge(nativeConfigurationRegistry.proxy().toProxiesDescriptor()));<NEW_LINE>context.describeInitialization(initializationDescriptor -> initializationDescriptor.merge(nativeConfigurationRegistry.initialization().toInitializationDescriptor()));<NEW_LINE>context.describeSerialization(serializationDescriptor -> serializationDescriptor.merge(nativeConfigurationRegistry.serialization().toSerializationDescriptor()));<NEW_LINE>context.describeJNIReflection(reflectionDescriptor -> nativeConfigurationRegistry.jni().toClassDescriptors().forEach(reflectionDescriptor::merge));<NEW_LINE>} | = new DefaultBootstrapWriterContext("org.springframework.aot", BOOTSTRAP_CLASS_NAME); |
15,250 | public <T> T run(Function<? super BuildTreeLifecycleController, T> buildAction) {<NEW_LINE>StartParameterInternal startParameter = buildDefinition.getStartParameter();<NEW_LINE>BuildRequestMetaData buildRequestMetaData = new DefaultBuildRequestMetaData(Time.currentTimeMillis());<NEW_LINE>BuildSessionState session = new BuildSessionState(userHomeDirServiceRegistry, crossBuildSessionState, startParameter, buildRequestMetaData, ClassPath.EMPTY, buildCancellationToken, buildRequestMetaData.getClient(), new NoOpBuildEventConsumer());<NEW_LINE>try {<NEW_LINE>session.getServices().get(BuildLayoutValidator.class).validate(startParameter);<NEW_LINE>BuildTreeModelControllerServices.Supplier modelServices = session.getServices().get(BuildTreeModelControllerServices<MASK><NEW_LINE>BuildTreeState buildTree = new BuildTreeState(session.getServices(), modelServices);<NEW_LINE>try {<NEW_LINE>RootOfNestedBuildTree rootBuild = new RootOfNestedBuildTree(buildDefinition, buildIdentifier, identityPath, owner, buildTree);<NEW_LINE>rootBuild.attach();<NEW_LINE>return rootBuild.run(buildAction);<NEW_LINE>} finally {<NEW_LINE>buildTree.close();<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>session.close();<NEW_LINE>}<NEW_LINE>} | .class).servicesForNestedBuildTree(startParameter); |
161,186 | public static List<ReassignTopicStatusVO> convert2ReassignTopicStatusVOList(List<ReassignStatus> dtoList) {<NEW_LINE>if (ValidateUtils.isNull(dtoList)) {<NEW_LINE>return new ArrayList<>();<NEW_LINE>}<NEW_LINE>List<ReassignTopicStatusVO> voList = new ArrayList<>();<NEW_LINE>for (ReassignStatus elem : dtoList) {<NEW_LINE>ReassignTopicStatusVO vo = new ReassignTopicStatusVO();<NEW_LINE>vo.setSubTaskId(elem.getSubTaskId());<NEW_LINE>vo.setClusterId(elem.getClusterId());<NEW_LINE>vo.setClusterName(elem.getClusterName());<NEW_LINE>vo.setTopicName(elem.getTopicName());<NEW_LINE>vo.setStatus(elem.getStatus());<NEW_LINE>vo.setCompletedPartitionNum(0);<NEW_LINE>vo.setRealThrottle(elem.getRealThrottle());<NEW_LINE>vo.setMaxThrottle(elem.getMaxThrottle());<NEW_LINE>vo.setMinThrottle(elem.getMinThrottle());<NEW_LINE>vo.setTotalPartitionNum(elem.getReassignList().size());<NEW_LINE>vo.setReassignList(new ArrayList<>());<NEW_LINE>if (ValidateUtils.isNull(elem.getReassignStatusMap())) {<NEW_LINE>elem.setReassignStatusMap(new HashMap<>());<NEW_LINE>}<NEW_LINE>for (ReassignmentElemData elemData : elem.getReassignList()) {<NEW_LINE>ReassignPartitionStatusVO partitionStatusVO = new ReassignPartitionStatusVO();<NEW_LINE>partitionStatusVO.setPartitionId(elemData.getPartition());<NEW_LINE>partitionStatusVO.<MASK><NEW_LINE>TaskStatusReassignEnum reassignEnum = elem.getReassignStatusMap().get(new TopicAndPartition(elem.getTopicName(), elemData.getPartition()));<NEW_LINE>if (!ValidateUtils.isNull(reassignEnum)) {<NEW_LINE>partitionStatusVO.setStatus(reassignEnum.getCode());<NEW_LINE>}<NEW_LINE>if (!ValidateUtils.isNull(reassignEnum) && TaskStatusReassignEnum.isFinished(reassignEnum.getCode())) {<NEW_LINE>vo.setCompletedPartitionNum(vo.getCompletedPartitionNum() + 1);<NEW_LINE>}<NEW_LINE>vo.getReassignList().add(partitionStatusVO);<NEW_LINE>}<NEW_LINE>voList.add(vo);<NEW_LINE>}<NEW_LINE>return voList;<NEW_LINE>} | setDestReplicaIdList(elemData.getReplicas()); |
363,477 | public Entry proxyAuth(final RequestHeader header) {<NEW_LINE>Entry entry = null;<NEW_LINE>if (header == null) {<NEW_LINE>return entry;<NEW_LINE>}<NEW_LINE>final String authHeader = header.get(RequestHeader.AUTHORIZATION, "").trim();<NEW_LINE>if (authHeader.toUpperCase(Locale.ROOT).startsWith(HttpServletRequest.BASIC_AUTH)) {<NEW_LINE>// take out prefix "BASIC"<NEW_LINE>String auth = authHeader.substring(6);<NEW_LINE>final String[] tmp = Base64Order.standardCoder.decodeString(auth.trim<MASK><NEW_LINE>if (tmp.length == 2) {<NEW_LINE>entry = this.passwordAuth(tmp[0], tmp[1]);<NEW_LINE>if (entry == null) {<NEW_LINE>entry = this.md5Auth(tmp[0], tmp[1]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (authHeader.toUpperCase(Locale.ROOT).startsWith(HttpServletRequest.DIGEST_AUTH)) {<NEW_LINE>// handle DIGEST auth by servlet container<NEW_LINE>final Principal authenticatedUser = header.getUserPrincipal();<NEW_LINE>if (authenticatedUser != null && authenticatedUser.getName() != null) {<NEW_LINE>// user is authenticated by Servlet container<NEW_LINE>entry = getEntry(authenticatedUser.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return entry;<NEW_LINE>} | ()).split(":"); |
1,040,732 | public static UserTrades adaptTradeHistory(List<DsxOwnTrade> tradeHistoryRaw) {<NEW_LINE>List<UserTrade> trades = new ArrayList<>(tradeHistoryRaw.size());<NEW_LINE>for (DsxOwnTrade dsxOwnTrade : tradeHistoryRaw) {<NEW_LINE>OrderType type = adaptOrderType(dsxOwnTrade.getSide().getValue());<NEW_LINE>CurrencyPair pair = adaptSymbol(dsxOwnTrade.symbol);<NEW_LINE>BigDecimal originalAmount = dsxOwnTrade.getQuantity();<NEW_LINE>Date timestamp = dsxOwnTrade.getTimestamp();<NEW_LINE>String id = Long.toString(dsxOwnTrade.getId());<NEW_LINE>String orderId = String.valueOf(dsxOwnTrade.getOrderId());<NEW_LINE><MASK><NEW_LINE>UserTrade trade = new DsxUserTrade(type, originalAmount, pair, dsxOwnTrade.getPrice(), timestamp, id, orderId, dsxOwnTrade.getFee(), pair.counter, clientOrderId);<NEW_LINE>trades.add(trade);<NEW_LINE>}<NEW_LINE>return new UserTrades(trades, Trades.TradeSortType.SortByTimestamp);<NEW_LINE>} | String clientOrderId = dsxOwnTrade.getClientOrderId(); |
596,085 | final UpdateFirewallPolicyResult executeUpdateFirewallPolicy(UpdateFirewallPolicyRequest updateFirewallPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateFirewallPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateFirewallPolicyRequest> request = null;<NEW_LINE>Response<UpdateFirewallPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateFirewallPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateFirewallPolicyRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Network Firewall");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateFirewallPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateFirewallPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateFirewallPolicyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,648,452 | protected void init(@Nonnull Context context) {<NEW_LINE>InternalSerializationService serializationService = ((ProcCtx) context).serializationService();<NEW_LINE>// we clone the projection of key/value if configured so because some of the<NEW_LINE>// record-readers return the same object for `reader.getCurrentKey()`<NEW_LINE>// and `reader.getCurrentValue()` which is mutated for each `reader.nextKeyValue()`.<NEW_LINE>BiFunctionEx<K, V, R> projectionFn = this.projectionFn;<NEW_LINE>if (configuration.getBoolean(COPY_ON_READ, true)) {<NEW_LINE>BiFunctionEx<K, V, R> actualProjectionFn = projectionFn;<NEW_LINE>projectionFn = (key, value) -> {<NEW_LINE>R result = actualProjectionFn.apply(key, value);<NEW_LINE>return result == null ? null : serializationService.toObject(serializationService.toData(result));<NEW_LINE>};<NEW_LINE>}<NEW_LINE>traverser = new HadoopFileTraverser<<MASK><NEW_LINE>} | >(configuration, splits, projectionFn); |
1,672,863 | public void start(BundleContext context) throws Exception {<NEW_LINE>super.start(context);<NEW_LINE>if (PATCH_ECLIPSE_CLASSES) {<NEW_LINE>activateHooks(context);<NEW_LINE>}<NEW_LINE>// Set notifications handler<NEW_LINE>DBeaverNotifications.setHandler(new DBeaverNotifications.NotificationHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void sendNotification(DBPDataSource dataSource, String id, String text, DBPMessageType messageType, Runnable feedback) {<NEW_LINE>NotificationUtils.sendNotification(dataSource, id, text, messageType, feedback);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void sendNotification(String id, String title, String text, DBPMessageType messageType, Runnable feedback) {<NEW_LINE>NotificationUtils.sendNotification(id, title, text, messageType, feedback);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Add bundle load logger<NEW_LINE>if (!Log.isQuietMode()) {<NEW_LINE>context.registerService(EventHook.class, (event, contexts) -> {<NEW_LINE>String message = null;<NEW_LINE>Bundle bundle = event.getBundle();<NEW_LINE>if (event.getType() == BundleEvent.STARTED) {<NEW_LINE>if (bundle.getState() == Bundle.ACTIVE) {<NEW_LINE>message = "> Start " + getBundleName(bundle) + " [" + bundle.getSymbolicName() + " " + bundle.getVersion() + "]";<NEW_LINE>}<NEW_LINE>} else if (event.getType() == BundleEvent.STOPPING) {<NEW_LINE>if (bundle.getState() != BundleEvent.STOPPING && bundle.getState() != BundleEvent.UNINSTALLED) {<NEW_LINE>message = "< Stop " + getBundleName(bundle) + " [" + bundle.getSymbolicName() + " " <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (message != null) {<NEW_LINE>System.err.println(message);<NEW_LINE>}<NEW_LINE>}, null);<NEW_LINE>// context.addBundleListener(new BundleLoadListener());<NEW_LINE>}<NEW_LINE>plugin = this;<NEW_LINE>} | + bundle.getVersion() + "]"; |
119,508 | protected MapRulType registerRuleType(MapRulType rt) {<NEW_LINE>String tag = rt.tagValuePattern.tag;<NEW_LINE>String val = rt.tagValuePattern.value;<NEW_LINE>String keyVal = constructRuleKey(tag, val);<NEW_LINE>if (types.containsKey(keyVal)) {<NEW_LINE>MapRulType mapRulType = types.get(keyVal);<NEW_LINE>if (mapRulType.isAdditional() || mapRulType.isText()) {<NEW_LINE>rt.id = mapRulType.id;<NEW_LINE>if (rt.isMain()) {<NEW_LINE>mapRulType.main = true;<NEW_LINE>mapRulType.order = rt.order;<NEW_LINE>if (rt.minzoom != 0) {<NEW_LINE>mapRulType.minzoom = Math.max(rt.minzoom, mapRulType.minzoom);<NEW_LINE>}<NEW_LINE>if (rt.maxzoom != 0) {<NEW_LINE>mapRulType.maxzoom = Math.min(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// types.put(keyVal, rt);<NEW_LINE>// typeList.set(rt.id, rt);<NEW_LINE>return mapRulType;<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Duplicate " + keyVal);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>rt.id = types.size();<NEW_LINE>types.put(keyVal, rt);<NEW_LINE>typeList.add(rt);<NEW_LINE>return rt;<NEW_LINE>}<NEW_LINE>} | rt.maxzoom, mapRulType.maxzoom); |
918,433 | private IEditorPart createUntitledFile(String editorType, String fileExtension, InputStream initialContent) {<NEW_LINE>FileOutputStream output = null;<NEW_LINE>try {<NEW_LINE>File file = // $NON-NLS-1$<NEW_LINE>File.// $NON-NLS-1$<NEW_LINE>createTempFile(// $NON-NLS-1$<NEW_LINE>Messages.NewUntitledFileTemplateMenuContributor_TempSuffix, "." + fileExtension);<NEW_LINE>output = new FileOutputStream(file);<NEW_LINE><MASK><NEW_LINE>file.deleteOnExit();<NEW_LINE>IEditorDescriptor editorDescriptor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());<NEW_LINE>String editorId = (editorDescriptor == null) ? ITextConstants.EDITOR_ID : editorDescriptor.getId();<NEW_LINE>IWorkbenchPage page = UIUtils.getActivePage();<NEW_LINE>if (page != null) {<NEW_LINE>String editorName;<NEW_LINE>Integer value = countByFileType.get(editorType);<NEW_LINE>if (value == null) {<NEW_LINE>editorName = MessageFormat.format(Messages.NewUntitledFileTemplateMenuContributor_DefaultName, editorType);<NEW_LINE>countByFileType.put(editorType, 1);<NEW_LINE>} else {<NEW_LINE>editorName = MessageFormat.format(Messages.NewUntitledFileTemplateMenuContributor_DefaultName_2, editorType, value);<NEW_LINE>countByFileType.put(editorType, ++value);<NEW_LINE>}<NEW_LINE>return page.openEditor(new UntitledFileStorageEditorInput(file.toURI(), editorName, initialContent), editorId);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>IdeLog.logError(IOUIPlugin.getDefault(), "Failed to create new file from selected template", e);<NEW_LINE>} finally {<NEW_LINE>if (output != null) {<NEW_LINE>try {<NEW_LINE>output.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>// ignores the exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | IOUtil.pipe(initialContent, output); |
73,525 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (((bitField0_ & 0x00000001) != 0)) {<NEW_LINE>output.writeMessage(1, getHandle());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) != 0)) {<NEW_LINE>output.writeFloat(4, networkCost_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) != 0)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) != 0)) {<NEW_LINE>output.writeFloat(6, diskCost_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) != 0)) {<NEW_LINE>output.writeFloat(7, memoryCost_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 8, fragmentJson_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000040) != 0)) {<NEW_LINE>output.writeBool(9, leafFragment_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000080) != 0)) {<NEW_LINE>output.writeMessage(10, getAssignment());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000100) != 0)) {<NEW_LINE>output.writeMessage(11, getForeman());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000200) != 0)) {<NEW_LINE>output.writeInt64(12, memInitial_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000400) != 0)) {<NEW_LINE>output.writeInt64(13, memMax_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000800) != 0)) {<NEW_LINE>output.writeMessage(14, getCredentials());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00001000) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 15, optionsJson_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00002000) != 0)) {<NEW_LINE>output.writeMessage(16, getContext());<NEW_LINE>}<NEW_LINE>for (int i = 0; i < collector_.size(); i++) {<NEW_LINE>output.writeMessage(17, collector_.get(i));<NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | output.writeFloat(5, cpuCost_); |
487,224 | final CreateBackupResult executeCreateBackup(CreateBackupRequest createBackupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createBackupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateBackupRequest> request = null;<NEW_LINE>Response<CreateBackupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateBackupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createBackupRequest));<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, "DynamoDB");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateBackup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI cachedEndpoint = null;<NEW_LINE>if (endpointDiscoveryEnabled) {<NEW_LINE>cachedEndpoint = cache.get(awsCredentialsProvider.getCredentials().getAWSAccessKeyId(), false, endpoint);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateBackupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateBackupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | responseHandler, executionContext, cachedEndpoint, null); |
115,011 | private static void maybeCleanUpQuery(final byte[] command, final KsqlConfig ksqlConfig) {<NEW_LINE>boolean queryIdFound = false;<NEW_LINE>final Map<String, Object> streamsProperties = new HashMap<>(ksqlConfig.getKsqlStreamConfigProps());<NEW_LINE>boolean sharedRuntimeQuery = false;<NEW_LINE>String queryId = "";<NEW_LINE>final JSONObject jsonObject = new JSONObject(new String(command, StandardCharsets.UTF_8));<NEW_LINE>if (hasKey(jsonObject, "plan") && !jsonObject.isNull("plan")) {<NEW_LINE>final JSONObject <MASK><NEW_LINE>if (hasKey(plan, "queryPlan")) {<NEW_LINE>final JSONObject queryPlan = plan.getJSONObject("queryPlan");<NEW_LINE>queryId = queryPlan.getString("queryId");<NEW_LINE>if (hasKey(queryPlan, "runtimeId") && ((Optional<String>) queryPlan.get("runtimeId")).isPresent()) {<NEW_LINE>streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, ((Optional<String>) queryPlan.get("runtimeId")).get());<NEW_LINE>sharedRuntimeQuery = true;<NEW_LINE>} else {<NEW_LINE>streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, QueryApplicationId.build(ksqlConfig, true, new QueryId(queryId)));<NEW_LINE>}<NEW_LINE>queryIdFound = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// the command contains a query, clean up it's internal state store and also the internal topics<NEW_LINE>if (queryIdFound) {<NEW_LINE>final StreamsConfig streamsConfig = new StreamsConfig(streamsProperties);<NEW_LINE>final String topicPrefix = sharedRuntimeQuery ? streamsConfig.getString(StreamsConfig.APPLICATION_ID_CONFIG) : QueryApplicationId.buildInternalTopicPrefix(ksqlConfig, sharedRuntimeQuery) + queryId;<NEW_LINE>try {<NEW_LINE>final Admin admin = new DefaultKafkaClientSupplier().getAdmin(ksqlConfig.getKsqlAdminClientConfigProps());<NEW_LINE>final KafkaTopicClient topicClient = new KafkaTopicClientImpl(() -> admin);<NEW_LINE>topicClient.deleteInternalTopics(topicPrefix);<NEW_LINE>new StateDirectory(streamsConfig, Time.SYSTEM, true, ksqlConfig.getBoolean(KsqlConfig.KSQL_SHARED_RUNTIME_ENABLED)).clean();<NEW_LINE>System.out.println(String.format("Cleaned up internal state store and internal topics for query %s", topicPrefix));<NEW_LINE>} catch (final Exception e) {<NEW_LINE>System.out.println(String.format("Failed to clean up query %s ", topicPrefix));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | plan = jsonObject.getJSONObject("plan"); |
185,881 | private List<RDPLocalVariable> parseProperties(String scopeId, PropertyDescriptorDTO[] properties, PropertyDescriptorDTO[] getters) {<NEW_LINE>List<RDPLocalVariable> variables = new ArrayList<>();<NEW_LINE>if (properties != null) {<NEW_LINE>for (PropertyDescriptorDTO property : properties) {<NEW_LINE>RemoteObjectDTO remoteValue = property.getValue();<NEW_LINE>RemoteObjectDTO getter = property.getGetter();<NEW_LINE>RDPValue value;<NEW_LINE>if (remoteValue != null && remoteValue.getType() != null) {<NEW_LINE>value = mapValue(remoteValue);<NEW_LINE>} else if (getter != null && getter.getObjectId() != null) {<NEW_LINE>value = mapValue(getter);<NEW_LINE>} else {<NEW_LINE>value = new RDPValue(this, <MASK><NEW_LINE>}<NEW_LINE>RDPLocalVariable var = new RDPLocalVariable(property.getName(), value);<NEW_LINE>variables.add(var);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (getters != null) {<NEW_LINE>for (PropertyDescriptorDTO property : getters) {<NEW_LINE>RDPValue value = new RDPValue(this, "<get>", "@Function", scopeId, true);<NEW_LINE>value.getter = property.getGetter();<NEW_LINE>RDPLocalVariable var = new RDPLocalVariable(property.getName(), value);<NEW_LINE>variables.add(var);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return variables;<NEW_LINE>} | "null", "null", null, false); |
1,113,616 | public void restoreXml(XmlPullParser parser, SleighLanguage language) throws XmlParseException {<NEW_LINE>ArrayList<InjectParameter> inlist = new ArrayList<>();<NEW_LINE>ArrayList<InjectParameter> outlist = new ArrayList<>();<NEW_LINE>// The <pcode> tag<NEW_LINE>XmlElement el = parser.start();<NEW_LINE>String injectstr = el.getAttribute("inject");<NEW_LINE>if (injectstr != null) {<NEW_LINE>if (injectstr.equals("uponentry")) {<NEW_LINE>subType = 0;<NEW_LINE>} else if (injectstr.equals("uponreturn")) {<NEW_LINE>subType = 1;<NEW_LINE>} else {<NEW_LINE>throw new XmlParseException("Unknown \"inject\" attribute value: " + injectstr);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>paramShift = SpecXmlUtils.decodeInt(pshiftstr);<NEW_LINE>boolean isDynamic = SpecXmlUtils.decodeBoolean(el.getAttribute("dynamic"));<NEW_LINE>incidentalCopy = SpecXmlUtils.decodeBoolean(el.getAttribute("incidentalcopy"));<NEW_LINE>XmlElement subel = parser.peek();<NEW_LINE>while (subel.isStart()) {<NEW_LINE>subel = parser.start();<NEW_LINE>if (subel.getName().equals("body")) {<NEW_LINE>parseString = parser.end(subel).getText();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>String paramName = subel.getAttribute("name");<NEW_LINE>int size = SpecXmlUtils.decodeInt(subel.getAttribute("size"));<NEW_LINE>InjectParameter param = new InjectParameter(paramName, size);<NEW_LINE>if (subel.getName().equals("input")) {<NEW_LINE>inlist.add(param);<NEW_LINE>} else {<NEW_LINE>outlist.add(param);<NEW_LINE>}<NEW_LINE>parser.end(subel);<NEW_LINE>subel = parser.peek();<NEW_LINE>}<NEW_LINE>parser.end(el);<NEW_LINE>if (parseString != null) {<NEW_LINE>parseString = parseString.trim();<NEW_LINE>if (parseString.length() == 0) {<NEW_LINE>parseString = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (parseString == null && (!isDynamic)) {<NEW_LINE>throw new XmlParseException("Missing pcode <body> in injection: " + source);<NEW_LINE>}<NEW_LINE>setInputParameters(inlist);<NEW_LINE>setOutputParameters(outlist);<NEW_LINE>orderParameters();<NEW_LINE>} | pshiftstr = el.getAttribute("paramshift"); |
1,187,814 | private IStatus performMove(final CommonDropAdapter dropAdapter, final IAdaptable[] sources) {<NEW_LINE>MultiStatus problems = new MultiStatus(IOUIPlugin.PLUGIN_ID, 1, Messages.FileDropAdapterAssistant_ERR_Moving, null);<NEW_LINE>IStatus validate = validateDrop(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentOperation(), dropAdapter.getCurrentTransfer());<NEW_LINE>if (!validate.isOK()) {<NEW_LINE>problems.merge(validate);<NEW_LINE>}<NEW_LINE>final IFileStore destination = getFolderStore((IAdaptable) dropAdapter.getCurrentTarget());<NEW_LINE>MoveFilesOperation operation = new MoveFilesOperation(getShell());<NEW_LINE>operation.copyFiles(sources, destination, new JobChangeAdapter() {<NEW_LINE><NEW_LINE>public void done(IJobChangeEvent event) {<NEW_LINE>// refreshes the target<NEW_LINE><MASK><NEW_LINE>// refreshes the source's parent folder<NEW_LINE>IFileStore fileStore;<NEW_LINE>for (IAdaptable source : sources) {<NEW_LINE>fileStore = (IFileStore) source.getAdapter(IFileStore.class);<NEW_LINE>if (fileStore != null) {<NEW_LINE>refresh(fileStore.getParent());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return problems;<NEW_LINE>} | refresh(dropAdapter.getCurrentTarget()); |
1,803,374 | public void render(CoresampleTileEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {<NEW_LINE>if (!tile.getWorldNonnull().hasChunkAt(tile.getBlockPos()) || tile.coresample == null)<NEW_LINE>return;<NEW_LINE>matrixStack.pushPose();<NEW_LINE>matrixStack.translate(.5, .5, .5);<NEW_LINE>matrixStack.mulPose(new Quaternion(new Vector3f(0, 1, 0), tile.getFacing() == Direction.NORTH ? 180 : tile.getFacing() == Direction.WEST ? -90 : tile.getFacing() == Direction.EAST <MASK><NEW_LINE>matrixStack.mulPose(new Quaternion(new Vector3f(1, 0, 0), -45, true));<NEW_LINE>matrixStack.translate(0, .04864, .02903);<NEW_LINE>ClientUtils.mc().getItemRenderer().renderStatic(tile.coresample, TransformType.FIXED, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn);<NEW_LINE>matrixStack.popPose();<NEW_LINE>} | ? 90 : 0, true)); |
521,301 | private Mono<Response<Void>> deleteWithResponseAsync(String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (accountName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter accountName 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 (managementPolicyName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), resourceGroupName, accountName, this.client.getApiVersion(), this.client.getSubscriptionId(), managementPolicyName, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); |
1,297,947 | public Optional<VirtualFile> findBuckFileForVirtualFile(VirtualFile file) {<NEW_LINE>return mBuckCellManager.findCellByVirtualFile(file).flatMap(cell -> cell.getRootDirectory().map(VirtualFile::getCanonicalPath).map(cellRoot -> {<NEW_LINE>VirtualFile packageDir = file.isDirectory() ? file : file.getParent();<NEW_LINE>while (true) {<NEW_LINE>if (packageDir == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String canonicalPackageDir = packageDir.getCanonicalPath();<NEW_LINE>if (canonicalPackageDir == null || canonicalPackageDir.length() < cellRoot.length()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>VirtualFile buckFile = packageDir.<MASK><NEW_LINE>if (buckFile != null && buckFile.exists() && !buckFile.isDirectory()) {<NEW_LINE>return buckFile;<NEW_LINE>}<NEW_LINE>packageDir = packageDir.getParent();<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>} | findChild(cell.getBuildfileName()); |
936,309 | public void decodeJMTTImage(Bitmap sourceBitmap, CloseableReference<Bitmap> reference) {<NEW_LINE>String url = mImage.getUrl();<NEW_LINE>int scramble_id = 220980;<NEW_LINE>int chapterId = 0;<NEW_LINE>// if (url.contains("/Cimoc/download/72/")){<NEW_LINE>// chapterId = Integer.parseInt(Objects.requireNonNull(StringUtils.match("/-photo-(\\d*)/", url, 1)));<NEW_LINE>// }<NEW_LINE>if (// || chapterId > scramble_id<NEW_LINE>(url.contains("media/photos") && Integer.parseInt(url.substring(url.indexOf("photos/") + 7, url.lastIndexOf("/"))) > scramble_id)) {<NEW_LINE>Bitmap resultBitmap = reference.get();<NEW_LINE>int rows = 10;<NEW_LINE>int remainder = mHeight % rows;<NEW_LINE>// Canvas canvas = new Canvas(resultBitmap);<NEW_LINE>for (int x = 0; x < 10; x++) {<NEW_LINE>int chunkHeight = (int) Math.floor(mHeight / rows);<NEW_LINE>int py = chunkHeight * (x);<NEW_LINE>int y = mHeight - chunkHeight <MASK><NEW_LINE>if (x == 0) {<NEW_LINE>chunkHeight = chunkHeight + remainder;<NEW_LINE>} else {<NEW_LINE>py = py + remainder;<NEW_LINE>}<NEW_LINE>int[] pixels = new int[(chunkHeight) * mWidth];<NEW_LINE>sourceBitmap.getPixels(pixels, 0, mWidth, 0, y, mWidth, chunkHeight);<NEW_LINE>resultBitmap.setPixels(pixels, 0, mWidth, 0, py, mWidth, chunkHeight);<NEW_LINE>}<NEW_LINE>jmttIsDone = true;<NEW_LINE>}<NEW_LINE>} | * (x + 1) - remainder; |
1,096,980 | public static boolean isLUHN(String number) {<NEW_LINE>if (number == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>number = StringUtil.reverse(number);<NEW_LINE>int total = 0;<NEW_LINE>for (int i = 0; i < number.length(); i++) {<NEW_LINE>int x = 0;<NEW_LINE>if (((i + 1) % 2) == 0) {<NEW_LINE>x = Integer.parseInt(number.substring(i, i + 1)) * 2;<NEW_LINE>if (x >= 10) {<NEW_LINE>String s = Integer.toString(x);<NEW_LINE>x = Integer.parseInt(s.substring(0, 1)) + Integer.parseInt(s.substring(1, 2));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>x = Integer.parseInt(number.substring<MASK><NEW_LINE>}<NEW_LINE>total = total + x;<NEW_LINE>}<NEW_LINE>if ((total % 10) == 0) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | (i, i + 1)); |
148,399 | public final MatchRecogMatchesAfterSkipContext matchRecogMatchesAfterSkip() throws RecognitionException {<NEW_LINE>MatchRecogMatchesAfterSkipContext _localctx = new MatchRecogMatchesAfterSkipContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 280, RULE_matchRecogMatchesAfterSkip);<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(1975);<NEW_LINE>match(AFTER);<NEW_LINE>setState(1976);<NEW_LINE>((MatchRecogMatchesAfterSkipContext) <MASK><NEW_LINE>setState(1977);<NEW_LINE>((MatchRecogMatchesAfterSkipContext) _localctx).i2 = keywordAllowedIdent();<NEW_LINE>setState(1978);<NEW_LINE>((MatchRecogMatchesAfterSkipContext) _localctx).i3 = keywordAllowedIdent();<NEW_LINE>setState(1979);<NEW_LINE>((MatchRecogMatchesAfterSkipContext) _localctx).i4 = keywordAllowedIdent();<NEW_LINE>setState(1980);<NEW_LINE>((MatchRecogMatchesAfterSkipContext) _localctx).i5 = keywordAllowedIdent();<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _localctx).i1 = keywordAllowedIdent(); |
374,976 | final DeleteSlotTypeResult executeDeleteSlotType(DeleteSlotTypeRequest deleteSlotTypeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteSlotTypeRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteSlotTypeRequest> request = null;<NEW_LINE>Response<DeleteSlotTypeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteSlotTypeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteSlotTypeRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lex Models V2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteSlotType");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteSlotTypeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteSlotTypeResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
471,975 | private void createPoiFiltersItems(MapActivity mapActivity, Set<PoiUIFilter> poiFilters, LinearLayout optionsContainer) {<NEW_LINE>LinearLayout item = createToolbarOptionView(false, null, -1, -1, null);<NEW_LINE>if (item != null) {<NEW_LINE>item.findViewById(R.id.route_option_container).setVisibility(View.GONE);<NEW_LINE>Iterator<PoiUIFilter> it = poiFilters.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>final <MASK><NEW_LINE>final View container = createToolbarSubOptionView(true, poiUIFilter.getName(), R.drawable.ic_action_remove_dark, !it.hasNext(), v -> {<NEW_LINE>MapActivity mapActivity1 = getMapActivity();<NEW_LINE>if (mapActivity1 != null) {<NEW_LINE>mapActivity1.getMyApplication().getPoiFilters().removeSelectedPoiFilter(poiUIFilter);<NEW_LINE>mapActivity1.refreshMap();<NEW_LINE>updateOptionsButtons();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (container != null) {<NEW_LINE>item.addView(container, getContainerButtonLayoutParams(mapActivity, false));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>optionsContainer.addView(item, getContainerButtonLayoutParams(mapActivity, true));<NEW_LINE>}<NEW_LINE>} | PoiUIFilter poiUIFilter = it.next(); |
1,075,475 | public void removeOrderItemFromFullfillmentGroups(Order order, OrderItem orderItem) {<NEW_LINE>List<FulfillmentGroup> fulfillmentGroups = order.getFulfillmentGroups();<NEW_LINE>for (FulfillmentGroup fulfillmentGroup : fulfillmentGroups) {<NEW_LINE>Iterator<FulfillmentGroupItem> itr = fulfillmentGroup.getFulfillmentGroupItems().iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE><MASK><NEW_LINE>if (fulfillmentGroupItem.getOrderItem().equals(orderItem)) {<NEW_LINE>itr.remove();<NEW_LINE>fulfillmentGroupItemDao.delete(fulfillmentGroupItem);<NEW_LINE>} else if (orderItem instanceof BundleOrderItem) {<NEW_LINE>BundleOrderItem bundleOrderItem = (BundleOrderItem) orderItem;<NEW_LINE>for (DiscreteOrderItem discreteOrderItem : bundleOrderItem.getDiscreteOrderItems()) {<NEW_LINE>if (fulfillmentGroupItem.getOrderItem().equals(discreteOrderItem)) {<NEW_LINE>itr.remove();<NEW_LINE>fulfillmentGroupItemDao.delete(fulfillmentGroupItem);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | FulfillmentGroupItem fulfillmentGroupItem = itr.next(); |
725,221 | private final Object removeLRU() {<NEW_LINE>int bucketIndex = next[BEFORE_LRU];<NEW_LINE>Object[] bucketValues = values[bucketIndex];<NEW_LINE>Object[] bucketKeys = keys[bucketIndex];<NEW_LINE><MASK><NEW_LINE>numEntries--;<NEW_LINE>// Choose an entry in the LRU bucket to remove. The numDiscards counter is used to<NEW_LINE>// reduce the chance of always choosing the same index.<NEW_LINE>int indexToRemove = (numDiscards++ & Integer.MAX_VALUE) % (bucketSize + 1);<NEW_LINE>Object value = bucketValues[indexToRemove];<NEW_LINE>// If we emptied the bucket then remove its MRU/LRU entry.<NEW_LINE>if (bucketSize == 0) {<NEW_LINE>int n = next[bucketIndex];<NEW_LINE>int p = previous[n] = previous[bucketIndex];<NEW_LINE>next[p] = n;<NEW_LINE>next[bucketIndex] = BEFORE_LRU;<NEW_LINE>// previous[bucketIndex] = BEFORE_LRU; // already true<NEW_LINE>// As long as we've already determined the new bucket size is 0, do some optimized<NEW_LINE>// bucket clearing.<NEW_LINE>bucketValues[0] = null;<NEW_LINE>bucketKeys[0] = null;<NEW_LINE>} else {<NEW_LINE>// We didn't empty the bucket. Remove the first entry and replace with the last.<NEW_LINE>bucketValues[indexToRemove] = bucketValues[bucketSize];<NEW_LINE>bucketValues[bucketSize] = null;<NEW_LINE>bucketKeys[indexToRemove] = bucketKeys[bucketSize];<NEW_LINE>bucketKeys[bucketSize] = null;<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | int bucketSize = --bucketSizes[bucketIndex]; |
982,828 | public static SearchTraceAppByNameResponse unmarshall(SearchTraceAppByNameResponse searchTraceAppByNameResponse, UnmarshallerContext _ctx) {<NEW_LINE>searchTraceAppByNameResponse.setRequestId(_ctx.stringValue("SearchTraceAppByNameResponse.RequestId"));<NEW_LINE>List<TraceApp> traceApps = new ArrayList<TraceApp>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("SearchTraceAppByNameResponse.TraceApps.Length"); i++) {<NEW_LINE>TraceApp traceApp = new TraceApp();<NEW_LINE>traceApp.setType(_ctx.stringValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].Type"));<NEW_LINE>traceApp.setAppName(_ctx.stringValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].AppName"));<NEW_LINE>traceApp.setUpdateTime(_ctx.longValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].UpdateTime"));<NEW_LINE>traceApp.setShow(_ctx.booleanValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].Show"));<NEW_LINE>traceApp.setCreateTime(_ctx.longValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].CreateTime"));<NEW_LINE>traceApp.setPid(_ctx.stringValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].Pid"));<NEW_LINE>traceApp.setAppId(_ctx.longValue<MASK><NEW_LINE>traceApp.setUserId(_ctx.stringValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].UserId"));<NEW_LINE>traceApp.setRegionId(_ctx.stringValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].RegionId"));<NEW_LINE>List<String> labels = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].Labels.Length"); j++) {<NEW_LINE>labels.add(_ctx.stringValue("SearchTraceAppByNameResponse.TraceApps[" + i + "].Labels[" + j + "]"));<NEW_LINE>}<NEW_LINE>traceApp.setLabels(labels);<NEW_LINE>traceApps.add(traceApp);<NEW_LINE>}<NEW_LINE>searchTraceAppByNameResponse.setTraceApps(traceApps);<NEW_LINE>return searchTraceAppByNameResponse;<NEW_LINE>} | ("SearchTraceAppByNameResponse.TraceApps[" + i + "].AppId")); |
59,542 | public void releaseClient(HClient client) throws HectorException {<NEW_LINE>if (cassandraHost.getMaxActive() == 0) {<NEW_LINE>client.close();<NEW_LINE>}<NEW_LINE>boolean open = client.isOpen();<NEW_LINE>if (open) {<NEW_LINE>if (active.get()) {<NEW_LINE>addClientToPoolGently(client);<NEW_LINE>} else {<NEW_LINE>log.info("Open client {} released to in-active pool for host {}. Closing.", client, cassandraHost);<NEW_LINE>client.close();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>addClientToPoolGently(createClient());<NEW_LINE>} catch (HectorTransportException e) {<NEW_LINE>// if unable to open client then don't add one back to the pool<NEW_LINE>log.error("Transport exception in re-opening client in release on {}", getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>realActiveClientsCount.decrementAndGet();<NEW_LINE>exhaustedStartTime.set(-1);<NEW_LINE>activeClientsCount.decrementAndGet();<NEW_LINE>if (log.isTraceEnabled()) {<NEW_LINE>log.trace("Status of releaseClient {} to queue: {}", <MASK><NEW_LINE>}<NEW_LINE>} | client.toString(), open); |
1,410,564 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see<NEW_LINE>* org.apache.jmeter.report.processor.AbstractSummaryConsumer#updateData<NEW_LINE>* (org.apache.jmeter.report.processor.AbstractSummaryConsumer.SummaryInfo,<NEW_LINE>* org.apache.jmeter.report.core.Sample)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>protected void updateData(SummaryInfo info, Sample sample) {<NEW_LINE>if (sample.isEmptyController()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Initialize overall data if they don't exist<NEW_LINE>SummaryInfo overallInfo = getOverallInfo();<NEW_LINE>ApdexSummaryData overallData = overallInfo.getData();<NEW_LINE>if (overallData == null) {<NEW_LINE>overallData = new ApdexSummaryData(getThresholdSelector().select(null));<NEW_LINE>overallInfo.setData(overallData);<NEW_LINE>}<NEW_LINE>// Initialize info data if they don't exist<NEW_LINE>ApdexSummaryData data = info.getData();<NEW_LINE>if (data == null) {<NEW_LINE>data = new ApdexSummaryData(getThresholdSelector().select(sample.getName()));<NEW_LINE>info.setData(data);<NEW_LINE>}<NEW_LINE>// Increment the total count of samples with the current name<NEW_LINE>data.incTotalCount();<NEW_LINE>// Increment the total count of samples<NEW_LINE>overallData.incTotalCount();<NEW_LINE>// Process only succeeded samples<NEW_LINE>if (sample.getSuccess()) {<NEW_LINE><MASK><NEW_LINE>// Increment the counters depending on the elapsed time.<NEW_LINE>ApdexThresholdsInfo thresholdsInfo = data.getApdexThresholdInfo();<NEW_LINE>if (elapsedTime <= thresholdsInfo.getSatisfiedThreshold()) {<NEW_LINE>data.incSatisfiedCount();<NEW_LINE>} else if (elapsedTime <= thresholdsInfo.getToleratedThreshold()) {<NEW_LINE>data.incToleratedCount();<NEW_LINE>}<NEW_LINE>// Increment the overall counters depending on the elapsed time.<NEW_LINE>ApdexThresholdsInfo overallThresholdsInfo = overallData.getApdexThresholdInfo();<NEW_LINE>if (elapsedTime <= overallThresholdsInfo.getSatisfiedThreshold()) {<NEW_LINE>overallData.incSatisfiedCount();<NEW_LINE>} else if (elapsedTime <= overallThresholdsInfo.getToleratedThreshold()) {<NEW_LINE>overallData.incToleratedCount();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | long elapsedTime = sample.getElapsedTime(); |
1,721,117 | public String[] children(String f) {<NEW_LINE>// NOI18N<NEW_LINE>String fSlash = f.length() > 0 ? f + "/" : "";<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>URL url = new URL(baseURL, Utilities<MASK><NEW_LINE>URLConnection conn = new ConnectionBuilder().job(job).url(url).timeout(TIMEOUT).connection();<NEW_LINE>String contentType = conn.getContentType();<NEW_LINE>if (contentType == null || !contentType.startsWith("text/plain")) {<NEW_LINE>// NOI18N<NEW_LINE>// Missing workspace.<NEW_LINE>LOG.log(Level.FINE, "non-plain dir listing: {0}", url);<NEW_LINE>return new String[0];<NEW_LINE>}<NEW_LINE>java.util.List<String> kids = new ArrayList<String>();<NEW_LINE>InputStream is = conn.getInputStream();<NEW_LINE>try {<NEW_LINE>BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));<NEW_LINE>String line;<NEW_LINE>while ((line = r.readLine()) != null) {<NEW_LINE>if (line.endsWith("/")) {<NEW_LINE>// NOI18N<NEW_LINE>String n = line.substring(0, line.length() - 1);<NEW_LINE>kids.add(n);<NEW_LINE>} else {<NEW_LINE>kids.add(line);<NEW_LINE>synchronized (nonDirs) {<NEW_LINE>nonDirs.add(fSlash + line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>is.close();<NEW_LINE>}<NEW_LINE>LOG.log(Level.FINE, "children: {0} -> {1}", new Object[] { url, kids });<NEW_LINE>return kids.toArray(new String[kids.size()]);<NEW_LINE>} catch (IOException x) {<NEW_LINE>LOG.log(Level.FINE, "cannot list children of {0} in {1}: {2}", new Object[] { f, baseURL, x });<NEW_LINE>return new String[0];<NEW_LINE>}<NEW_LINE>} | .uriEncode(fSlash) + "*plain*"); |
1,312,999 | public void fireSelectionChanged(EditorComposite newSelectedComposite) {<NEW_LINE>final Trinity<VirtualFile, FileEditor, FileEditorProvider> oldData = extract(SoftReference.dereference(myLastSelectedComposite));<NEW_LINE>final Trinity<VirtualFile, FileEditor, FileEditorProvider> newData = extract(newSelectedComposite);<NEW_LINE>myLastSelectedComposite = newSelectedComposite == null ? null : new WeakReference<>(newSelectedComposite);<NEW_LINE>final boolean filesEqual = oldData.first == null ? newData.first == null : oldData.first.equals(newData.first);<NEW_LINE>final boolean editorsEqual = oldData.second == null ? newData.second == null : oldData.second.equals(newData.second);<NEW_LINE>if (!filesEqual || !editorsEqual) {<NEW_LINE>if (oldData.first != null && newData.first != null) {<NEW_LINE>for (FileEditorAssociateFinder finder : FileEditorAssociateFinder.EP_NAME.getExtensionList()) {<NEW_LINE>VirtualFile associatedFile = finder.getAssociatedFileToOpen(myProject, oldData.first);<NEW_LINE>if (Comparing.equal(associatedFile, newData.first)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final FileEditorManagerEvent event = new FileEditorManagerEvent(this, oldData.first, oldData.second, oldData.third, newData.first, newData.second, newData.third);<NEW_LINE>final FileEditorManagerListener publisher = getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER);<NEW_LINE>if (newData.first != null) {<NEW_LINE>DataContext context = DataManager.getInstance().getDataContext(<MASK><NEW_LINE>EditorWindow editorWindow = context.getData(EditorWindow.DATA_KEY);<NEW_LINE>if (editorWindow != null) {<NEW_LINE>addSelectionRecord(newData.first, editorWindow);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>notifyPublisher(() -> publisher.selectionChanged(event));<NEW_LINE>}<NEW_LINE>} | newData.second.getUIComponent()); |
366,829 | public double distance(SparseNumberVector v1, SparseNumberVector v2) {<NEW_LINE>// Get the bit masks<NEW_LINE>double accu = 0.;<NEW_LINE>int i1 = v1.iter(), i2 = v2.iter();<NEW_LINE>while (v1.iterValid(i1) && v2.iterValid(i2)) {<NEW_LINE>final int d1 = v1.iterDim(i1), d2 = v2.iterDim(i2);<NEW_LINE>if (d1 < d2) {<NEW_LINE>// In first only<NEW_LINE>final double val = Math.abs(v1.iterDoubleValue(i1));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i1 = v1.iterAdvance(i1);<NEW_LINE>} else if (d2 < d1) {<NEW_LINE>// In second only<NEW_LINE>final double val = Math.abs(v2.iterDoubleValue(i2));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i2 = v2.iterAdvance(i2);<NEW_LINE>} else {<NEW_LINE>// Both vectors have a value.<NEW_LINE>final double val = Math.abs(v1.iterDoubleValue(i1) - v2.iterDoubleValue(i2));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i1 = v1.iterAdvance(i1);<NEW_LINE>i2 = v2.iterAdvance(i2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (v1.iterValid(i1)) {<NEW_LINE>// In first only<NEW_LINE>final double val = Math.abs(v1.iterDoubleValue(i1));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i1 = v1.iterAdvance(i1);<NEW_LINE>}<NEW_LINE>while (v2.iterValid(i2)) {<NEW_LINE>// In second only<NEW_LINE>final double val = Math.abs(v2.iterDoubleValue(i2));<NEW_LINE>accu += <MASK><NEW_LINE>i2 = v2.iterAdvance(i2);<NEW_LINE>}<NEW_LINE>return FastMath.pow(accu, invp);<NEW_LINE>} | FastMath.pow(val, p); |
932,921 | public void testPurchaseValueOfSecurityPositionWithTransfers() throws IOException {<NEW_LINE>Client client = ClientFactory.load(// $NON-NLS-1$<NEW_LINE>IssueCurrencyGainsRoundingError.class.// $NON-NLS-1$<NEW_LINE>getResourceAsStream("IssueCurrencyGainsRoundingError.xml"));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Interval // $NON-NLS-1$<NEW_LINE>period = // $NON-NLS-1$<NEW_LINE>Interval.// $NON-NLS-1$<NEW_LINE>of(// $NON-NLS-1$<NEW_LINE>LocalDate.parse("2015-01-09"), LocalDate.parse("2016-01-09"));<NEW_LINE>CurrencyConverter converter = new TestCurrencyConverter();<NEW_LINE>ClientPerformanceSnapshot snapshot = new ClientPerformanceSnapshot(client, converter, period);<NEW_LINE>MutableMoney currencyGains = MutableMoney.of(converter.getTermCurrency());<NEW_LINE>currencyGains.subtract(snapshot.getValue(CategoryType.INITIAL_VALUE));<NEW_LINE>currencyGains.subtract(snapshot.getValue(CategoryType.CAPITAL_GAINS));<NEW_LINE>currencyGains.subtract(snapshot.getValue(CategoryType.REALIZED_CAPITAL_GAINS));<NEW_LINE>currencyGains.subtract(snapshot<MASK><NEW_LINE>currencyGains.add(snapshot.getValue(CategoryType.FEES));<NEW_LINE>currencyGains.add(snapshot.getValue(CategoryType.TAXES));<NEW_LINE>currencyGains.add(snapshot.getValue(CategoryType.TRANSFERS));<NEW_LINE>currencyGains.add(snapshot.getValue(CategoryType.FINAL_VALUE));<NEW_LINE>assertThat(snapshot.getCategoryByType(CategoryType.CURRENCY_GAINS).getValuation(), is(currencyGains.toMoney()));<NEW_LINE>snapshot.getCategories().stream().flatMap(c -> c.getPositions().stream()).forEach(p -> {<NEW_LINE>Money value = p.getValue();<NEW_LINE>Optional<Trail> valueTrail = p.explain(ClientPerformanceSnapshot.Position.TRAIL_VALUE);<NEW_LINE>valueTrail.ifPresent(t -> assertThat(t.getRecord().getValue(), is(value)));<NEW_LINE>Money gain = p.getForexGain();<NEW_LINE>Optional<Trail> gainTrail = p.explain(ClientPerformanceSnapshot.Position.TRAIL_FOREX_GAIN);<NEW_LINE>gainTrail.ifPresent(t -> assertThat(t.getRecord().getValue(), is(gain)));<NEW_LINE>});<NEW_LINE>} | .getValue(CategoryType.EARNINGS)); |
1,339,528 | protected void addHighlights(@Nonnull Map<TextRange, TextAttributes> ranges, @Nonnull Editor editor, @Nonnull Collection<RangeHighlighter> highlighters, @Nonnull HighlightManager highlightManager) {<NEW_LINE>final TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);<NEW_LINE>final V variable = getVariable();<NEW_LINE>if (variable != null) {<NEW_LINE>final String name = variable.getName();<NEW_LINE>LOG.assertTrue(name != null, variable);<NEW_LINE>final int variableNameLength = name.length();<NEW_LINE>if (isReplaceAllOccurrences()) {<NEW_LINE>for (RangeMarker marker : getOccurrenceMarkers()) {<NEW_LINE>final <MASK><NEW_LINE>highlightManager.addOccurrenceHighlight(editor, startOffset, startOffset + variableNameLength, attributes, 0, highlighters, null);<NEW_LINE>}<NEW_LINE>} else if (getExpr() != null) {<NEW_LINE>final int startOffset = getExprMarker().getStartOffset();<NEW_LINE>highlightManager.addOccurrenceHighlight(editor, startOffset, startOffset + variableNameLength, attributes, 0, highlighters, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (RangeHighlighter highlighter : highlighters) {<NEW_LINE>highlighter.setGreedyToLeft(true);<NEW_LINE>highlighter.setGreedyToRight(true);<NEW_LINE>}<NEW_LINE>} | int startOffset = marker.getStartOffset(); |
1,284,967 | public static RowBaseIterator showInstances() {<NEW_LINE>MycatRouterConfig routerConfig = MetaClusterCurrent.wrapper(MycatRouterConfig.class);<NEW_LINE>ReplicaSelectorManager replicaSelectorRuntime = MetaClusterCurrent.wrapper(ReplicaSelectorManager.class);<NEW_LINE>ResultSetBuilder resultSetBuilder = ResultSetBuilder.create();<NEW_LINE>resultSetBuilder.addColumnInfo("NAME", JDBCType.VARCHAR);<NEW_LINE>resultSetBuilder.<MASK><NEW_LINE>resultSetBuilder.addColumnInfo("READABLE", JDBCType.VARCHAR);<NEW_LINE>resultSetBuilder.addColumnInfo("TYPE", JDBCType.VARCHAR);<NEW_LINE>resultSetBuilder.addColumnInfo("SESSION_COUNT", JDBCType.BIGINT);<NEW_LINE>resultSetBuilder.addColumnInfo("WEIGHT", JDBCType.BIGINT);<NEW_LINE>resultSetBuilder.addColumnInfo("MASTER", JDBCType.VARCHAR);<NEW_LINE>resultSetBuilder.addColumnInfo("LIMIT_SESSION_COUNT", JDBCType.BIGINT);<NEW_LINE>resultSetBuilder.addColumnInfo("REPLICA", JDBCType.VARCHAR);<NEW_LINE>Collection<PhysicsInstance> values = replicaSelectorRuntime.getPhysicsInstances();<NEW_LINE>Map<String, DatasourceConfig> dataSourceConfig = routerConfig.getDatasources().stream().collect(Collectors.toMap(k -> k.getName(), v -> v));<NEW_LINE>for (PhysicsInstance instance : values) {<NEW_LINE>String NAME = instance.getName();<NEW_LINE>String TYPE = instance.getType().name();<NEW_LINE>boolean READABLE = instance.asSelectRead();<NEW_LINE>int SESSION_COUNT = instance.getSessionCounter();<NEW_LINE>int WEIGHT = instance.getWeight();<NEW_LINE>boolean ALIVE = instance.isAlive();<NEW_LINE>boolean MASTER = instance.isMaster();<NEW_LINE>Optional<DatasourceConfig> e = Optional.ofNullable(dataSourceConfig.get(NAME));<NEW_LINE>String replicaDataSourceSelectorList = String.join(",", replicaSelectorRuntime.getReplicaNameListByInstanceName(NAME));<NEW_LINE>resultSetBuilder.addObjectRowPayload(Arrays.asList(NAME, ALIVE, READABLE, TYPE, SESSION_COUNT, WEIGHT, MASTER, e.map(i -> i.getMaxCon()).orElse(-1), replicaDataSourceSelectorList));<NEW_LINE>}<NEW_LINE>RowBaseIterator rowBaseIterator = resultSetBuilder.build();<NEW_LINE>return rowBaseIterator;<NEW_LINE>} | addColumnInfo("ALIVE", JDBCType.VARCHAR); |
150,128 | public void applyToIndex(Index index) {<NEW_LINE>if (prefix.isPresent()) {<NEW_LINE>index.<MASK><NEW_LINE>}<NEW_LINE>for (String alias : aliases) {<NEW_LINE>index.addAlias(alias);<NEW_LINE>}<NEW_LINE>if (stemming.isPresent()) {<NEW_LINE>index.setStemming(Stemming.get(stemming.get()));<NEW_LINE>}<NEW_LINE>if (type.isPresent()) {<NEW_LINE>index.setType(type.get());<NEW_LINE>}<NEW_LINE>if (arity.isPresent() || lowerBound.isPresent() || upperBound.isPresent() || densePostingListThreshold.isPresent()) {<NEW_LINE>index.setBooleanIndexDefiniton(new BooleanIndexDefinition(arity, lowerBound, upperBound, densePostingListThreshold));<NEW_LINE>}<NEW_LINE>if (enableBm25.isPresent()) {<NEW_LINE>index.setInterleavedFeatures(enableBm25.get());<NEW_LINE>}<NEW_LINE>if (hnswIndexParams.isPresent()) {<NEW_LINE>index.setHnswIndexParams(hnswIndexParams.get().build());<NEW_LINE>}<NEW_LINE>} | setPrefix(prefix.get()); |
548,394 | private static void adjustScrollPaneSize(JScrollPane sp, JEditorPane editorPane) {<NEW_LINE>int height;<NEW_LINE>// logger.fine("createSingleLineEditor(): editorPane's margin = "+editorPane.getMargin());<NEW_LINE>// logger.fine("createSingleLineEditor(): editorPane's insets = "+editorPane.getInsets());<NEW_LINE>Dimension prefSize = sp.getPreferredSize();<NEW_LINE>// sp.getInsets();<NEW_LINE>Insets borderInsets = sp.getBorder().getBorderInsets(sp);<NEW_LINE>EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(editorPane);<NEW_LINE>if (logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.fine("createSingleLineEditor(): editor UI = " + eui);<NEW_LINE>if (eui != null) {<NEW_LINE>logger.fine(<MASK><NEW_LINE>logger.fine("createSingleLineEditor(): editor UI's line ascent = " + eui.getLineAscent());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (eui != null) {<NEW_LINE>height = eui.getLineHeight();<NEW_LINE>if (height < eui.getLineAscent()) {<NEW_LINE>// Hack for the case when line height = 1<NEW_LINE>height = (eui.getLineAscent() * 4) / 3;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>java.awt.Font font = editorPane.getFont();<NEW_LINE>java.awt.FontMetrics fontMetrics = editorPane.getFontMetrics(font);<NEW_LINE>height = fontMetrics.getHeight();<NEW_LINE>// logger.fine("createSingleLineEditor(): editor's font = "+font+" with metrics = "+fontMetrics+", leading = "+fontMetrics.getLeading());<NEW_LINE>// logger.fine("createSingleLineEditor(): font's height = "+height);<NEW_LINE>}<NEW_LINE>height += getLFHeightAdjustment();<NEW_LINE>// height += 2; // 2 for border<NEW_LINE>if (logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.fine("createSingleLineEditor(): border vertical insets = " + borderInsets.bottom + " + " + borderInsets.top);<NEW_LINE>logger.fine("createSingleLineEditor(): computed height = " + height + ", prefSize = " + prefSize);<NEW_LINE>}<NEW_LINE>if (prefSize.height < height) {<NEW_LINE>prefSize.height = height;<NEW_LINE>sp.setPreferredSize(prefSize);<NEW_LINE>sp.setMinimumSize(prefSize);<NEW_LINE>sp.setMaximumSize(prefSize);<NEW_LINE>java.awt.Container c = sp.getParent();<NEW_LINE>logger.fine("createSingleLineEditor(): setting a new height of ScrollPane = " + height);<NEW_LINE>if (c instanceof JComponent) {<NEW_LINE>((JComponent) c).revalidate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "createSingleLineEditor(): editor UI's line height = " + eui.getLineHeight()); |
1,723,112 | private void renderCategoryMeasurements(final TimedOperationCategory category, final Map<String, TimedResult> labeledMeasurements, final Writer writer) throws IOException {<NEW_LINE>renderHeader(category.displayName(), writer);<NEW_LINE>final TimedResult grandTotal = new TimedResult();<NEW_LINE>final TreeSet<Map.Entry<String, TimedResult>> sortedKeySet = new TreeSet<>(new Comparator<Map.Entry<String, TimedResult>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(final Entry<String, TimedResult> o1, final Entry<String, TimedResult> o2) {<NEW_LINE>return Long.compare(o1.getValue().selfTimeNanos.get(), o2.getValue().selfTimeNanos.get());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>sortedKeySet.addAll(labeledMeasurements.entrySet());<NEW_LINE>for (final Map.Entry<String, TimedResult> entry : sortedKeySet) {<NEW_LINE>renderMeasurement(entry.getKey(), entry.getValue(), writer);<NEW_LINE>grandTotal.mergeTimes(entry.getValue());<NEW_LINE>}<NEW_LINE>writer.write(PMD.EOL);<NEW_LINE>renderMeasurement("Total " + category.<MASK><NEW_LINE>writer.write(PMD.EOL);<NEW_LINE>} | displayName(), grandTotal, writer); |
639,061 | protected <T extends JpaObject> String idleQueryName(Business business, String name, String excludeId) throws Exception {<NEW_LINE>if (StringUtils.isEmpty(name)) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>List<String> <MASK><NEW_LINE>list.add(name);<NEW_LINE>for (int i = 1; i < 99; i++) {<NEW_LINE>list.add(name + String.format("%02d", i));<NEW_LINE>}<NEW_LINE>list.add(StringTools.uniqueToken());<NEW_LINE>EntityManager em = business.entityManagerContainer().get(Query.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<Query> root = cq.from(Query.class);<NEW_LINE>Predicate p = root.get(Query_.name).in(list);<NEW_LINE>if (StringUtils.isNotEmpty(excludeId)) {<NEW_LINE>p = cb.and(p, cb.notEqual(root.get(JpaObject.id_FIELDNAME), excludeId));<NEW_LINE>}<NEW_LINE>cq.select(root.get(Query_.name)).where(p);<NEW_LINE>List<String> os = em.createQuery(cq).getResultList();<NEW_LINE>list = ListUtils.subtract(list, os);<NEW_LINE>return list.get(0);<NEW_LINE>} | list = new ArrayList<>(); |
1,117,228 | static ShapeFill parse(JsonReader reader, LottieComposition composition) throws IOException {<NEW_LINE>AnimatableColorValue color = null;<NEW_LINE>boolean fillEnabled = false;<NEW_LINE>AnimatableIntegerValue opacity = null;<NEW_LINE>String name = null;<NEW_LINE>int fillTypeInt = 1;<NEW_LINE>boolean hidden = false;<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>switch(reader.selectName(NAMES)) {<NEW_LINE>case 0:<NEW_LINE>name = reader.nextString();<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>color = AnimatableValueParser.parseColor(reader, composition);<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>opacity = AnimatableValueParser.parseInteger(reader, composition);<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>fillEnabled = reader.nextBoolean();<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>fillTypeInt = reader.nextInt();<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>hidden = reader.nextBoolean();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>reader.skipName();<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Telegram sometimes omits opacity.<NEW_LINE>// https://github.com/airbnb/lottie-android/issues/1600<NEW_LINE>opacity = opacity == null ? new AnimatableIntegerValue(Collections.singletonList(new Keyframe<>(100))) : opacity;<NEW_LINE>Path.FillType fillType = fillTypeInt == 1 ? Path.FillType<MASK><NEW_LINE>return new ShapeFill(name, fillEnabled, fillType, color, opacity, hidden);<NEW_LINE>} | .WINDING : Path.FillType.EVEN_ODD; |
283,962 | private void saveOrUpdateTop10UnstableDomain(List<DomainStatistics> domainList, String zkAddr) {<NEW_LINE>try {<NEW_LINE>domainList = DashboardServiceHelper.sortDomainByShardingCount(domainList);<NEW_LINE>List<DomainStatistics> top10UnstableDomain = domainList.subList(0, domainList.size() > 9 ? 10 : domainList.size());<NEW_LINE>String top10UnstableDomainJsonString = JSON.toJSONString(top10UnstableDomain);<NEW_LINE>SaturnStatistics top10UnstableDomainFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_UNSTABLE_DOMAIN, zkAddr);<NEW_LINE>if (top10UnstableDomainFromDB == null) {<NEW_LINE>SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_UNSTABLE_DOMAIN, zkAddr, top10UnstableDomainJsonString);<NEW_LINE>saturnStatisticsService.create(ss);<NEW_LINE>} else {<NEW_LINE>top10UnstableDomainFromDB.setResult(top10UnstableDomainJsonString);<NEW_LINE>saturnStatisticsService.updateByPrimaryKey(top10UnstableDomainFromDB);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(<MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
834,964 | public void generateProjectBuildScript(String projectName, InitSettings settings, BuildScriptBuilder buildScriptBuilder) {<NEW_LINE>super.generateProjectBuildScript(projectName, settings, buildScriptBuilder);<NEW_LINE>if ("app".equals(projectName)) {<NEW_LINE>buildScriptBuilder.block(null, "application", b -> {<NEW_LINE>String mainClass = getLanguage() == Language.KOTLIN ? "AppKt" : "App";<NEW_LINE>if (!isSingleProject(settings)) {<NEW_LINE>mainClass = "app." + mainClass;<NEW_LINE>}<NEW_LINE>b.propertyAssignment("Define the main class for the application.", "mainClass", withPackage<MASK><NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (isSingleProject(settings)) {<NEW_LINE>applyApplicationPlugin(buildScriptBuilder);<NEW_LINE>buildScriptBuilder.implementationDependency("This dependency is used by the application.", "com.google.guava:guava:" + libraryVersionProvider.getVersion("guava"));<NEW_LINE>} else {<NEW_LINE>if ("app".equals(projectName)) {<NEW_LINE>buildScriptBuilder.plugin(null, applicationConventionPlugin(settings));<NEW_LINE>buildScriptBuilder.dependencies().dependency("implementation", null, "org.apache.commons:commons-text");<NEW_LINE>buildScriptBuilder.dependencies().projectDependency("implementation", null, ":utilities");<NEW_LINE>} else {<NEW_LINE>buildScriptBuilder.plugin(null, libraryConventionPlugin(settings));<NEW_LINE>if ("utilities".equals(projectName)) {<NEW_LINE>buildScriptBuilder.dependencies().projectDependency("api", null, ":list");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (settings, mainClass), false); |
1,132,369 | final GetApplicationComponentStrategiesResult executeGetApplicationComponentStrategies(GetApplicationComponentStrategiesRequest getApplicationComponentStrategiesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getApplicationComponentStrategiesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetApplicationComponentStrategiesRequest> request = null;<NEW_LINE>Response<GetApplicationComponentStrategiesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetApplicationComponentStrategiesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getApplicationComponentStrategiesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubStrategy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetApplicationComponentStrategies");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetApplicationComponentStrategiesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetApplicationComponentStrategiesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,172,479 | final UpdateResolverRuleResult executeUpdateResolverRule(UpdateResolverRuleRequest updateResolverRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateResolverRuleRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateResolverRuleRequest> request = null;<NEW_LINE>Response<UpdateResolverRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateResolverRuleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateResolverRuleRequest));<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, "Route53Resolver");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateResolverRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateResolverRuleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateResolverRuleResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
274,539 | public static boolean openDocument(Lookup.Provider provider, int line, int column, Line.ShowOpenType openType, Line.ShowVisibilityType visibilityType) {<NEW_LINE>assert provider != null;<NEW_LINE>LineCookie lc = provider.getLookup().lookup(LineCookie.class);<NEW_LINE>if ((lc != null) && (line >= 0) && (column >= -1)) {<NEW_LINE>StyledDocument doc = getDocument(provider);<NEW_LINE>if (doc != null) {<NEW_LINE>Line l = null;<NEW_LINE>try {<NEW_LINE>l = lc.getLineSet().getCurrent(line);<NEW_LINE>} catch (IndexOutOfBoundsException e) {<NEW_LINE>// try to open at least the file (line no. is too high?)<NEW_LINE>l = lc.<MASK><NEW_LINE>}<NEW_LINE>if (l != null) {<NEW_LINE>doShow(l, column, openType, visibilityType);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Openable oc = provider.getLookup().lookup(Openable.class);<NEW_LINE>if (oc != null) {<NEW_LINE>doOpen(oc);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getLineSet().getCurrent(0); |
271,513 | private static RecursiveFilesystemTraversalValue resultForDirectory(TraversalRequest traversal, FileInfo rootInfo, ImmutableList<RecursiveFilesystemTraversalValue> subdirTraversals) {<NEW_LINE>// Collect transitive closure of files in subdirectories.<NEW_LINE>NestedSetBuilder<ResolvedFile<MASK><NEW_LINE>for (RecursiveFilesystemTraversalValue child : subdirTraversals) {<NEW_LINE>paths.addTransitive(child.getTransitiveFiles());<NEW_LINE>}<NEW_LINE>ResolvedFile root;<NEW_LINE>if (rootInfo.type.isSymlink()) {<NEW_LINE>NestedSet<ResolvedFile> children = paths.build();<NEW_LINE>root = ResolvedFileFactory.symlinkToDirectory(rootInfo.realPath, traversal.root.asRootedPath(), rootInfo.unresolvedSymlinkTarget, hashDirectorySymlink(children, rootInfo.metadata));<NEW_LINE>paths = NestedSetBuilder.<ResolvedFile>stableOrder().addTransitive(children).add(root);<NEW_LINE>} else {<NEW_LINE>root = ResolvedFileFactory.directory(rootInfo.realPath);<NEW_LINE>}<NEW_LINE>return RecursiveFilesystemTraversalValue.of(root, paths.build());<NEW_LINE>} | > paths = NestedSetBuilder.stableOrder(); |
1,543,467 | public static final void crop(final Response responseToCrop, final BlockOption requestedBlock, int maxTcpBertBulkBlocks) {<NEW_LINE>if (responseToCrop == null) {<NEW_LINE>throw new NullPointerException("response message must not be null");<NEW_LINE>} else if (requestedBlock == null) {<NEW_LINE>throw new NullPointerException("block option must not be null");<NEW_LINE>} else if (!responseToCrop.hasBlock(requestedBlock)) {<NEW_LINE>throw new IllegalArgumentException("given response does not contain block");<NEW_LINE>} else {<NEW_LINE>int bodySize = responseToCrop.getPayloadSize();<NEW_LINE>int from = requestedBlock.getOffset();<NEW_LINE>int size = requestedBlock.getSize();<NEW_LINE>if (requestedBlock.isBERT()) {<NEW_LINE>size *= maxTcpBertBulkBlocks;<NEW_LINE>}<NEW_LINE>boolean m = false;<NEW_LINE>if (responseToCrop.getOptions().hasBlock2()) {<NEW_LINE>from -= responseToCrop.getOptions().getBlock2().getOffset();<NEW_LINE>m = responseToCrop.getOptions().getBlock2().isM();<NEW_LINE>}<NEW_LINE>int to = Math.min(from + size, bodySize);<NEW_LINE>int length = to - from;<NEW_LINE>m = m || to < bodySize;<NEW_LINE>responseToCrop.getOptions().setBlock2(requestedBlock.getSzx(), m, requestedBlock.getNum());<NEW_LINE>LOGGER.<MASK><NEW_LINE>if (length > 0) {<NEW_LINE>byte[] blockPayload = new byte[length];<NEW_LINE>// crop payload -- do after calculation of m in case<NEW_LINE>// block==response<NEW_LINE>System.arraycopy(responseToCrop.getPayload(), from, blockPayload, 0, length);<NEW_LINE>responseToCrop.setPayload(blockPayload);<NEW_LINE>} else {<NEW_LINE>responseToCrop.setPayload(Bytes.EMPTY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | debug("cropping response body [size={}] to block {}", bodySize, requestedBlock); |
684,715 | public GeneratorResult generateJava() {<NEW_LINE>CompilationUnit cu = new CompilationUnit();<NEW_LINE>if (!pkg.isEmpty()) {<NEW_LINE>cu.setPackageDeclaration(pkg);<NEW_LINE>}<NEW_LINE>ClassOrInterfaceDeclaration clz = cu.addClass(className);<NEW_LINE>clz.addAnnotation(new SingleMemberAnnotationExpr(new Name("io.fabric8.kubernetes.model.annotation.Version"), new NameExpr("value = \"" + version + "\" , storage = " + storage + " , served = " + served)));<NEW_LINE>clz.addAnnotation(new SingleMemberAnnotationExpr(new Name("io.fabric8.kubernetes.model.annotation.Group"), new StringLiteralExpr(group)));<NEW_LINE>ClassOrInterfaceType jlVoid = new <MASK><NEW_LINE>ClassOrInterfaceType spec = (withSpec) ? new ClassOrInterfaceType().setName(this.pkg + "." + this.specClassName) : jlVoid;<NEW_LINE>ClassOrInterfaceType status = (withStatus) ? new ClassOrInterfaceType().setName(this.pkg + "." + this.statusClassName) : jlVoid;<NEW_LINE>if (config.isObjectExtraAnnotations()) {<NEW_LINE>addExtraAnnotations(clz);<NEW_LINE>}<NEW_LINE>ClassOrInterfaceType crType = new ClassOrInterfaceType().setName("io.fabric8.kubernetes.client.CustomResource").setTypeArguments(spec, status);<NEW_LINE>clz.addExtendedType(crType);<NEW_LINE>clz.addImplementedType("io.fabric8.kubernetes.api.model.Namespaced");<NEW_LINE>return new GeneratorResult(Collections.singletonList(new GeneratorResult.ClassResult(className, cu)));<NEW_LINE>} | ClassOrInterfaceType().setName("java.lang.Void"); |
1,577,527 | public BackendAuthAppleProviderConfig unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>BackendAuthAppleProviderConfig backendAuthAppleProviderConfig = new BackendAuthAppleProviderConfig();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("client_id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>backendAuthAppleProviderConfig.setClientId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("key_id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>backendAuthAppleProviderConfig.setKeyId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("private_key", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>backendAuthAppleProviderConfig.setPrivateKey(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("team_id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>backendAuthAppleProviderConfig.setTeamId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return backendAuthAppleProviderConfig;<NEW_LINE>} | class).unmarshall(context)); |
612,519 | public MLModelGroup apply(@Nonnull final EntityResponse entityResponse) {<NEW_LINE>final MLModelGroup result = new MLModelGroup();<NEW_LINE>result.setUrn(entityResponse.getUrn().toString());<NEW_LINE>result.setType(EntityType.MLMODEL_GROUP);<NEW_LINE><MASK><NEW_LINE>MappingHelper<MLModelGroup> mappingHelper = new MappingHelper<>(aspectMap, result);<NEW_LINE>mappingHelper.mapToResult(OWNERSHIP_ASPECT_NAME, (mlModelGroup, dataMap) -> mlModelGroup.setOwnership(OwnershipMapper.map(new Ownership(dataMap))));<NEW_LINE>mappingHelper.mapToResult(ML_MODEL_GROUP_KEY_ASPECT_NAME, this::mapToMLModelGroupKey);<NEW_LINE>mappingHelper.mapToResult(ML_MODEL_GROUP_PROPERTIES_ASPECT_NAME, this::mapToMLModelGroupProperties);<NEW_LINE>mappingHelper.mapToResult(STATUS_ASPECT_NAME, (mlModelGroup, dataMap) -> mlModelGroup.setStatus(StatusMapper.map(new Status(dataMap))));<NEW_LINE>mappingHelper.mapToResult(DEPRECATION_ASPECT_NAME, (mlModelGroup, dataMap) -> mlModelGroup.setDeprecation(DeprecationMapper.map(new Deprecation(dataMap))));<NEW_LINE>return mappingHelper.getResult();<NEW_LINE>} | EnvelopedAspectMap aspectMap = entityResponse.getAspects(); |
430,533 | public static Point2D_F64 renderPixel(Se3_F64 worldToCamera, double fx, double skew, double cx, double fy, double cy, Point3D_F64 X, @Nullable Point2D_F64 pixel) {<NEW_LINE>Point3D_F64 X_cam = new Point3D_F64();<NEW_LINE>SePointOps_F64.transform(worldToCamera, X, X_cam);<NEW_LINE>// see if it's behind the camera<NEW_LINE>if (X_cam.z <= 0)<NEW_LINE>return null;<NEW_LINE>if (pixel == null)<NEW_LINE>pixel = new Point2D_F64();<NEW_LINE>double xx = X_cam.x / X_cam.z;<NEW_LINE>double yy <MASK><NEW_LINE>pixel.x = fx * xx + skew * yy + cx;<NEW_LINE>pixel.y = fy * yy + cy;<NEW_LINE>return pixel;<NEW_LINE>} | = X_cam.y / X_cam.z; |
577,900 | public void readConfiguration(Configuration conf) {<NEW_LINE>Property excludedMods = conf.get("blueprints", "excludedMods", new String[0], "mods that should be excluded from the builder.").setLanguageKey("config.blueprints.excludedMods").setRequiresMcRestart(true);<NEW_LINE>Property excludedBlocks = conf.get("blueprints", "excludedBlocks", new String[0], "blocks that should be excluded from the builder.").setLanguageKey<MASK><NEW_LINE>for (String id : excludedMods.getStringList()) {<NEW_LINE>String strippedId = JavaTools.stripSurroundingQuotes(id.trim());<NEW_LINE>if (strippedId.length() > 0) {<NEW_LINE>modsForbidden.add(strippedId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String id : excludedBlocks.getStringList()) {<NEW_LINE>String strippedId = JavaTools.stripSurroundingQuotes(id.trim());<NEW_LINE>if (strippedId.length() > 0) {<NEW_LINE>blocksForbidden.add(strippedId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ("config.blueprints.excludedBlocks").setRequiresMcRestart(true); |
817,445 | private static // range of bits and a value for those bits<NEW_LINE>PatternBlock buildBigBlock(int size, int bitstart, int bitend, long value) {<NEW_LINE>int startbit = 8 * size - 1 - bitend;<NEW_LINE>int endbit = 8 * size - 1 - bitstart;<NEW_LINE>PatternBlock block = null;<NEW_LINE>while (endbit >= startbit) {<NEW_LINE>int tmpstart = endbit - (endbit & 7);<NEW_LINE>if (tmpstart < startbit) {<NEW_LINE>tmpstart = startbit;<NEW_LINE>}<NEW_LINE>PatternBlock tmpblock = buildSingle(tmpstart, endbit, (int) value);<NEW_LINE>if (block == null) {<NEW_LINE>block = tmpblock;<NEW_LINE>} else {<NEW_LINE>PatternBlock newblock = block.intersect(tmpblock);<NEW_LINE>block.dispose();<NEW_LINE>tmpblock.dispose();<NEW_LINE>block = newblock;<NEW_LINE>}<NEW_LINE>value <MASK><NEW_LINE>endbit = tmpstart - 1;<NEW_LINE>}<NEW_LINE>return block;<NEW_LINE>} | >>>= (endbit - tmpstart + 1); |
334,949 | protected void writeFields(JavaWriter writer) throws IOException {<NEW_LINE>for (Map.Entry<String, FieldData> entry : getIterator()) {<NEW_LINE>writer.emitStatement("instance.%s__IsList = %s", entry.getKey(), <MASK><NEW_LINE>String parseTypeString;<NEW_LINE>if (entry.getValue().mParseType == TypeUtils.ParseType.PARSABLE_OBJECT) {<NEW_LINE>parseTypeString = entry.getValue().mParsableType;<NEW_LINE>} else {<NEW_LINE>parseTypeString = entry.getValue().mParseType.toString();<NEW_LINE>}<NEW_LINE>writer.emitStatement("instance.%s__ParseType = \"%s\"", entry.getKey(), parseTypeString);<NEW_LINE>String parseTypeGeneratedClass = entry.getValue().mParsableTypeGeneratedClass;<NEW_LINE>writer.emitStatement("instance.%s__ParseTypeGeneratedClass = %s", entry.getKey(), parseTypeGeneratedClass == null ? null : '\"' + parseTypeGeneratedClass + '\"');<NEW_LINE>}<NEW_LINE>} | entry.getValue().mIsList); |
1,086,439 | final DeleteVocabularyResult executeDeleteVocabulary(DeleteVocabularyRequest deleteVocabularyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteVocabularyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteVocabularyRequest> request = null;<NEW_LINE>Response<DeleteVocabularyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteVocabularyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteVocabularyRequest));<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, "Transcribe");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteVocabularyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteVocabularyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteVocabulary"); |
795,935 | public void marshall(GetLoadBalancerMetricDataRequest getLoadBalancerMetricDataRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (getLoadBalancerMetricDataRequest == 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(getLoadBalancerMetricDataRequest.getMetricName(), METRICNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getPeriod(), PERIOD_BINDING);<NEW_LINE>protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getStartTime(), STARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getEndTime(), ENDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getUnit(), UNIT_BINDING);<NEW_LINE>protocolMarshaller.marshall(getLoadBalancerMetricDataRequest.getStatistics(), STATISTICS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | getLoadBalancerMetricDataRequest.getLoadBalancerName(), LOADBALANCERNAME_BINDING); |
999,493 | final DeletePackagingConfigurationResult executeDeletePackagingConfiguration(DeletePackagingConfigurationRequest deletePackagingConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deletePackagingConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeletePackagingConfigurationRequest> request = null;<NEW_LINE>Response<DeletePackagingConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeletePackagingConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deletePackagingConfigurationRequest));<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, "MediaPackage Vod");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeletePackagingConfiguration");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeletePackagingConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeletePackagingConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
1,045,350 | static public void writeFile(String path, String encoding, String data, final boolean append, final Promise promise) {<NEW_LINE>try {<NEW_LINE>int written = 0;<NEW_LINE>File f = new File(path);<NEW_LINE>File dir = f.getParentFile();<NEW_LINE>if (!dir.exists())<NEW_LINE>dir.mkdirs();<NEW_LINE>FileOutputStream fout = new FileOutputStream(f, append);<NEW_LINE>// write data from a file<NEW_LINE>if (encoding.equalsIgnoreCase(RNFetchBlobConst.DATA_ENCODE_URI)) {<NEW_LINE>data = normalizePath(data);<NEW_LINE>File src = new File(data);<NEW_LINE>if (!src.exists()) {<NEW_LINE>promise.reject("RNfetchBlob writeFileError", "source file : " + data + "not exists");<NEW_LINE>fout.close();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FileInputStream fin = new FileInputStream(src);<NEW_LINE>byte[] buffer = new byte[10240];<NEW_LINE>int read;<NEW_LINE>written = 0;<NEW_LINE>while ((read = fin.read(buffer)) > 0) {<NEW_LINE>fout.<MASK><NEW_LINE>written += read;<NEW_LINE>}<NEW_LINE>fin.close();<NEW_LINE>} else {<NEW_LINE>byte[] bytes = stringToBytes(data, encoding);<NEW_LINE>fout.write(bytes);<NEW_LINE>written = bytes.length;<NEW_LINE>}<NEW_LINE>fout.close();<NEW_LINE>promise.resolve(written);<NEW_LINE>} catch (Exception e) {<NEW_LINE>promise.reject("RNFetchBlob writeFileError", e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>} | write(buffer, 0, read); |
1,680,563 | // assumes that the path already has EPSILON as the last element.<NEW_LINE>public static void addOnePathToGraph(List path, double count, int markovOrder, TransducerGraph graph) {<NEW_LINE>Object source = graph.getStartNode();<NEW_LINE>for (int j = 0; j < path.size(); j++) {<NEW_LINE>Object input = path.get(j);<NEW_LINE>Arc a = graph.getArcBySourceAndInput(source, input);<NEW_LINE>if (a != null) {<NEW_LINE>// increment the arc weight<NEW_LINE>a.output = Double.valueOf(((Double) a.output).doubleValue() + count);<NEW_LINE>} else {<NEW_LINE>Object target;<NEW_LINE>if (input.equals(TransducerGraph.EPSILON_INPUT)) {<NEW_LINE>// to ensure they all share the same end node<NEW_LINE>target = "END";<NEW_LINE>} else if (markovOrder == 0) {<NEW_LINE>// we all transition back to the same state<NEW_LINE>target = source;<NEW_LINE>} else if (markovOrder > 0) {<NEW_LINE>// the state is described by the partial history<NEW_LINE>target = path.subList((j < markovOrder ? 0 : j - markovOrder + 1), j + 1);<NEW_LINE>} else {<NEW_LINE>// the state is described by the full history<NEW_LINE>target = path.subList(0, j + 1);<NEW_LINE>}<NEW_LINE>Double <MASK><NEW_LINE>a = new Arc(source, target, input, output);<NEW_LINE>graph.addArc(a);<NEW_LINE>}<NEW_LINE>source = a.getTargetNode();<NEW_LINE>}<NEW_LINE>graph.setEndNode(source);<NEW_LINE>} | output = Double.valueOf(count); |
425,919 | public void onEvents(Player player, Events events) {<NEW_LINE>if (events.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>maybeAddSessions(events);<NEW_LINE>for (String session : playbackStatsTrackers.keySet()) {<NEW_LINE>Pair<EventTime, Boolean> eventTimeAndBelongsToPlayback = findBestEventTime(events, session);<NEW_LINE>PlaybackStatsTracker tracker = playbackStatsTrackers.get(session);<NEW_LINE>boolean hasDiscontinuityToPlayback = hasEvent(events, session, EVENT_POSITION_DISCONTINUITY);<NEW_LINE>boolean hasDroppedFrames = hasEvent(events, session, EVENT_DROPPED_VIDEO_FRAMES);<NEW_LINE>boolean hasAudioUnderrun = hasEvent(events, session, EVENT_AUDIO_UNDERRUN);<NEW_LINE>boolean startedLoading = hasEvent(events, session, EVENT_LOAD_STARTED);<NEW_LINE>boolean hasFatalError = hasEvent(events, session, EVENT_PLAYER_ERROR);<NEW_LINE>boolean hasNonFatalException = hasEvent(events, session, EVENT_LOAD_ERROR) || hasEvent(events, session, EVENT_DRM_SESSION_MANAGER_ERROR);<NEW_LINE>boolean hasBandwidthData = hasEvent(events, session, EVENT_BANDWIDTH_ESTIMATE);<NEW_LINE>boolean hasFormatData = <MASK><NEW_LINE>boolean hasVideoSize = hasEvent(events, session, EVENT_VIDEO_SIZE_CHANGED);<NEW_LINE>tracker.onEvents(player, /* eventTime= */<NEW_LINE>eventTimeAndBelongsToPlayback.first, /* belongsToPlayback= */<NEW_LINE>eventTimeAndBelongsToPlayback.second, session.equals(discontinuityFromSession) ? discontinuityFromPositionMs : C.TIME_UNSET, hasDiscontinuityToPlayback, hasDroppedFrames ? droppedFrames : 0, hasAudioUnderrun, startedLoading, hasFatalError ? player.getPlayerError() : null, hasNonFatalException ? nonFatalException : null, hasBandwidthData ? bandwidthTimeMs : 0, hasBandwidthData ? bandwidthBytes : 0, hasFormatData ? videoFormat : null, hasFormatData ? audioFormat : null, hasVideoSize ? videoSize : null);<NEW_LINE>}<NEW_LINE>videoFormat = null;<NEW_LINE>audioFormat = null;<NEW_LINE>discontinuityFromSession = null;<NEW_LINE>if (events.contains(AnalyticsListener.EVENT_PLAYER_RELEASED)) {<NEW_LINE>sessionManager.finishAllSessions(events.getEventTime(EVENT_PLAYER_RELEASED));<NEW_LINE>}<NEW_LINE>} | hasEvent(events, session, EVENT_DOWNSTREAM_FORMAT_CHANGED); |
131,034 | public SQLStatement parseWith() {<NEW_LINE>SQLWithSubqueryClause with = this.parseWithQuery();<NEW_LINE>// PGWithClause with = this.parseWithClause();<NEW_LINE>if (lexer.token() == Token.INSERT) {<NEW_LINE>PGInsertStatement stmt = this.parseInsert();<NEW_LINE>stmt.setWith(with);<NEW_LINE>return stmt;<NEW_LINE>}<NEW_LINE>if (lexer.token() == Token.SELECT) {<NEW_LINE><MASK><NEW_LINE>stmt.getSelect().setWithSubQuery(with);<NEW_LINE>return stmt;<NEW_LINE>}<NEW_LINE>if (lexer.token() == Token.DELETE) {<NEW_LINE>PGDeleteStatement stmt = this.parseDeleteStatement();<NEW_LINE>stmt.setWith(with);<NEW_LINE>return stmt;<NEW_LINE>}<NEW_LINE>if (lexer.token() == Token.UPDATE) {<NEW_LINE>PGUpdateStatement stmt = (PGUpdateStatement) this.parseUpdateStatement();<NEW_LINE>stmt.setWith(with);<NEW_LINE>return stmt;<NEW_LINE>}<NEW_LINE>throw new ParserException("TODO. " + lexer.info());<NEW_LINE>} | PGSelectStatement stmt = this.parseSelect(); |
729,918 | public void onBlockDispense(BlockDispenseEvent event) {<NEW_LINE><MASK><NEW_LINE>// Simulate right click event as players have it<NEW_LINE>if (dispenserBlock.getType() == Material.DISPENSER) {<NEW_LINE>Cause cause = create(event.getBlock());<NEW_LINE>ItemStack item = event.getItem();<NEW_LINE>if (Events.fireToCancel(event, new UseItemEvent(event, cause, dispenserBlock.getWorld(), item))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BlockData blockData = dispenserBlock.getBlockData();<NEW_LINE>// if this ClassCastExceptions it's a bukkit bug<NEW_LINE>Dispenser dispenser = (Dispenser) blockData;<NEW_LINE>Block placed = dispenserBlock.getRelative(dispenser.getFacing());<NEW_LINE>Block clicked = placed.getRelative(dispenser.getFacing());<NEW_LINE>handleBlockRightClick(event, cause, item, clicked, placed);<NEW_LINE>// handle special dispenser behavior<NEW_LINE>if (Materials.isShulkerBox(item.getType())) {<NEW_LINE>if (Events.fireToCancel(event, new PlaceBlockEvent(event, cause, placed.getLocation(), item.getType()))) {<NEW_LINE>playDenyEffect(placed.getLocation());<NEW_LINE>}<NEW_LINE>} else if (isItemAppliedToBlock(item, placed)) {<NEW_LINE>if (Events.fireToCancel(event, new PlaceBlockEvent(event, cause, placed.getLocation(), placed.getType()))) {<NEW_LINE>playDenyEffect(placed.getLocation());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Block dispenserBlock = event.getBlock(); |
1,260,114 | final DeleteWirelessGatewayTaskResult executeDeleteWirelessGatewayTask(DeleteWirelessGatewayTaskRequest deleteWirelessGatewayTaskRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteWirelessGatewayTaskRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteWirelessGatewayTaskRequest> request = null;<NEW_LINE>Response<DeleteWirelessGatewayTaskResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteWirelessGatewayTaskRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWirelessGatewayTaskRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT Wireless");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWirelessGatewayTask");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteWirelessGatewayTaskResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWirelessGatewayTaskResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
87,037 | public List<OrderEntry> createOrderEntries(@Nonnull ModifiableModuleRootLayer layer, @Nonnull VirtualFile[] value) {<NEW_LINE>List<VirtualFile> chosenFiles = FileChooserUtil.getChosenFiles(myFileChooserDescriptor, Arrays.asList(value));<NEW_LINE>if (chosenFiles.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>final List<Pair<LibraryRootsComponentDescriptor, FileChooserDescriptor>> descriptors = new ArrayList<Pair<LibraryRootsComponentDescriptor, FileChooserDescriptor>>();<NEW_LINE>for (LibraryRootsComponentDescriptor componentDescriptor : myLibraryTypes.keySet()) {<NEW_LINE>descriptors.add(Pair.create(componentDescriptor, componentDescriptor.createAttachFilesChooserDescriptor(null)));<NEW_LINE>}<NEW_LINE>List<LibraryRootsComponentDescriptor> suitableDescriptors <MASK><NEW_LINE>for (Pair<LibraryRootsComponentDescriptor, FileChooserDescriptor> pair : descriptors) {<NEW_LINE>if (acceptAll(pair.getSecond(), chosenFiles)) {<NEW_LINE>suitableDescriptors.add(pair.getFirst());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final LibraryRootsComponentDescriptor rootsComponentDescriptor;<NEW_LINE>LibraryType libraryType = null;<NEW_LINE>if (suitableDescriptors.size() == 1) {<NEW_LINE>rootsComponentDescriptor = suitableDescriptors.get(0);<NEW_LINE>libraryType = myLibraryTypes.get(rootsComponentDescriptor);<NEW_LINE>} else {<NEW_LINE>rootsComponentDescriptor = myDefaultDescriptor;<NEW_LINE>}<NEW_LINE>List<OrderRoot> chosenRoots = RootDetectionUtil.detectRoots(chosenFiles, null, layer.getProject(), rootsComponentDescriptor);<NEW_LINE>final List<OrderRoot> roots = filterAlreadyAdded(layer, chosenRoots);<NEW_LINE>if (roots.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>final List<Library> addedLibraries = new ArrayList<Library>();<NEW_LINE>boolean onlyClasses = true;<NEW_LINE>for (OrderRoot root : roots) {<NEW_LINE>onlyClasses &= root.getType() == BinariesOrderRootType.getInstance();<NEW_LINE>}<NEW_LINE>if (onlyClasses) {<NEW_LINE>for (OrderRoot root : roots) {<NEW_LINE>addedLibraries.add(createLibraryFromRoots(layer, Collections.singletonList(root), libraryType));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addedLibraries.add(createLibraryFromRoots(layer, roots, libraryType));<NEW_LINE>}<NEW_LINE>List<OrderEntry> orderEntries = new ArrayList<OrderEntry>(addedLibraries.size());<NEW_LINE>for (Library addedLibrary : addedLibraries) {<NEW_LINE>LibraryOrderEntry libraryOrderEntry = layer.findLibraryOrderEntry(addedLibrary);<NEW_LINE>if (libraryOrderEntry != null) {<NEW_LINE>orderEntries.add(libraryOrderEntry);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return orderEntries;<NEW_LINE>} | = new ArrayList<LibraryRootsComponentDescriptor>(); |
568,860 | private void grantDocActionAccess(@NonNull final I_AD_Role_PermRequest request) {<NEW_LINE>final DocTypeId docTypeId = DocTypeId.ofRepoId(request.getC_DocType_ID());<NEW_LINE>final String docAction = request.getDocAction();<NEW_LINE>final ADRefListItem docActionItem = Services.get(IADReferenceDAO.class).retrieveListItemOrNull(X_C_Invoice.DOCACTION_AD_Reference_ID, docAction);<NEW_LINE>Check.<MASK><NEW_LINE>final int docActionRefListId = docActionItem.getRefListId().getRepoId();<NEW_LINE>final RoleId roleId = RoleId.ofRepoId(request.getAD_Role_ID());<NEW_LINE>final Role role = Services.get(IRoleDAO.class).getById(roleId);<NEW_LINE>Services.get(IUserRolePermissionsDAO.class).createDocumentActionAccess(CreateDocActionAccessRequest.builder().roleId(role.getId()).clientId(role.getClientId()).orgId(role.getOrgId()).docTypeId(docTypeId).docActionRefListId(docActionRefListId).readWrite(request.isReadWrite()).build());<NEW_LINE>final I_C_DocType docType = Services.get(IDocTypeDAO.class).getById(docTypeId);<NEW_LINE>logGranted(I_C_DocType.COLUMNNAME_C_DocType_ID, docType.getName() + "/" + docAction);<NEW_LINE>} | assumeNotNull(docActionItem, "docActionItem is missing for {}", docAction); |
1,784,276 | private static void loadMetadata(FeedItem item, DocumentFile file, Context context) {<NEW_LINE>MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();<NEW_LINE>mediaMetadataRetriever.setDataSource(context, file.getUri());<NEW_LINE>String dateStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE);<NEW_LINE>if (!TextUtils.isEmpty(dateStr)) {<NEW_LINE>try {<NEW_LINE>SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.getDefault());<NEW_LINE>item.setPubDate(simpleDateFormat.parse(dateStr));<NEW_LINE>} catch (ParseException parseException) {<NEW_LINE>Date date = DateUtils.parse(dateStr);<NEW_LINE>if (date != null) {<NEW_LINE>item.setPubDate(date);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String title = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);<NEW_LINE>if (!TextUtils.isEmpty(title)) {<NEW_LINE>item.setTitle(title);<NEW_LINE>}<NEW_LINE>String durationStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);<NEW_LINE>item.getMedia().setDuration((int) Long.parseLong(durationStr));<NEW_LINE>item.getMedia().setHasEmbeddedPicture(mediaMetadataRetriever.getEmbeddedPicture() != null);<NEW_LINE>try (InputStream inputStream = context.getContentResolver().openInputStream(file.getUri())) {<NEW_LINE>Id3MetadataReader reader = new Id3MetadataReader(new CountingInputStream(inputStream));<NEW_LINE>reader.readInputStream();<NEW_LINE>item.setDescriptionIfLonger(reader.getComment());<NEW_LINE>} catch (IOException | ID3ReaderException e) {<NEW_LINE>Log.d(TAG, "Unable to parse ID3 of " + file.getUri() + ": " + e.getMessage());<NEW_LINE>try (InputStream inputStream = context.getContentResolver().openInputStream(file.getUri())) {<NEW_LINE><MASK><NEW_LINE>reader.readInputStream();<NEW_LINE>item.setDescriptionIfLonger(reader.getDescription());<NEW_LINE>} catch (IOException | VorbisCommentReaderException e2) {<NEW_LINE>Log.d(TAG, "Unable to parse vorbis comments of " + file.getUri() + ": " + e2.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | VorbisCommentMetadataReader reader = new VorbisCommentMetadataReader(inputStream); |
522,552 | private static Substitutions.EspressoRootNodeFactory createJniRootNodeFactory(Supplier<EspressoMethodNode> methodNodeSupplier, Method targetMethod) {<NEW_LINE>return new Substitutions.EspressoRootNodeFactory() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public EspressoRootNode createNodeIfValid(Method methodToSubstitute, boolean forceValid) {<NEW_LINE>if (forceValid || methodToSubstitute == targetMethod) {<NEW_LINE>// Runtime substitutions apply only to the given method.<NEW_LINE>return EspressoRootNode.create(null, methodNodeSupplier.get());<NEW_LINE>}<NEW_LINE>Substitutions.getLogger().warning(new Supplier<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String get() {<NEW_LINE>StaticObject expectedLoader = targetMethod.getDeclaringKlass().getDefiningClassLoader();<NEW_LINE>StaticObject givenLoader = methodToSubstitute.getDeclaringKlass().getDefiningClassLoader();<NEW_LINE>return "Runtime substitution for " + targetMethod + " does not apply.\n" + "\tExpected class loader: " + EspressoInterop.toDisplayString(expectedLoader, false) + "\n" + "\tGiven class loader: " + EspressoInterop.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | toDisplayString(givenLoader, false) + "\n"; |
749,067 | private FileIO io(String location) {<NEW_LINE>String impl = implFromLocation(location);<NEW_LINE>FileIO io = ioInstances.get(impl);<NEW_LINE>if (io != null) {<NEW_LINE>return io;<NEW_LINE>}<NEW_LINE>synchronized (ioInstances) {<NEW_LINE>// double check while holding the lock<NEW_LINE>io = ioInstances.get(impl);<NEW_LINE>if (io != null) {<NEW_LINE>return io;<NEW_LINE>}<NEW_LINE>Configuration conf = hadoopConf.get();<NEW_LINE>try {<NEW_LINE>io = CatalogUtil.loadFileIO(impl, properties, conf);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>if (impl.equals(FALLBACK_IMPL)) {<NEW_LINE>// no implementation to fall back to, throw the exception<NEW_LINE>throw e;<NEW_LINE>} else {<NEW_LINE>// couldn't load the normal class, fall back to HadoopFileIO<NEW_LINE>LOG.warn("Failed to load FileIO implementation: {}, falling back to {}", impl, FALLBACK_IMPL, e);<NEW_LINE>try {<NEW_LINE>io = CatalogUtil.<MASK><NEW_LINE>} catch (IllegalArgumentException suppressed) {<NEW_LINE>LOG.warn("Failed to load FileIO implementation: {} (fallback)", FALLBACK_IMPL, suppressed);<NEW_LINE>// both attempts failed, throw the original exception with the later exception suppressed<NEW_LINE>e.addSuppressed(suppressed);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ioInstances.put(impl, io);<NEW_LINE>}<NEW_LINE>return io;<NEW_LINE>} | loadFileIO(FALLBACK_IMPL, properties, conf); |
749,561 | public void testDeliveryMultipleMsgsClassicApi_Tcp(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>boolean testFailed = false;<NEW_LINE>QueueConnection con = jmsQCFTCP.createQueueConnection();<NEW_LINE>con.start();<NEW_LINE>QueueSession sessionSender = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);<NEW_LINE>emptyQueue(jmsQCFTCP, jmsQueue1);<NEW_LINE>QueueReceiver rec = sessionSender.createReceiver(jmsQueue1);<NEW_LINE>// QueueReceiver rec1 = sessionSender.createReceiver(queue1);<NEW_LINE>//<NEW_LINE>// This sets the delivery delay of all messages sent using that jmsProducer.<NEW_LINE>// In classic API we can create sender for a single queue.<NEW_LINE>QueueSender send = sessionSender.createSender(jmsQueue1);<NEW_LINE>send.setDeliveryDelay(deliveryDelay);<NEW_LINE>TextMessage sendMsg1 = sessionSender.createTextMessage("testDeliveryMultipleMsgsClassicApi_Tcp1");<NEW_LINE>sendAndCheckDeliveryTime(send, jmsQueue1, sendMsg1);<NEW_LINE>TextMessage recMsg1 = (TextMessage) rec.receiveNoWait();<NEW_LINE>TextMessage sendMsg2 = sessionSender.createTextMessage("testDeliveryMultipleMsgsClassicApi_Tcp2");<NEW_LINE>sendAndCheckDeliveryTime(send, jmsQueue1, sendMsg2);<NEW_LINE>TextMessage recMsg2 = (TextMessage) rec.receiveNoWait();<NEW_LINE>if ((recMsg1 != null) || (recMsg2 != null)) {<NEW_LINE>testFailed = true;<NEW_LINE>}<NEW_LINE>recMsg1 = (<MASK><NEW_LINE>recMsg2 = (TextMessage) rec.receive(30000);<NEW_LINE>if (((recMsg1 == null) || (recMsg1.getText() == null) || !recMsg1.getText().equals("testDeliveryMultipleMsgsClassicApi_Tcp1")) || ((recMsg2 == null) || (recMsg2.getText() == null) || !recMsg2.getText().equals("testDeliveryMultipleMsgsClassicApi_Tcp2"))) {<NEW_LINE>testFailed = true;<NEW_LINE>}<NEW_LINE>send.close();<NEW_LINE>con.close();<NEW_LINE>if (testFailed) {<NEW_LINE>throw new Exception("testDeliveryMultipleMsgsClassicApi_Tcp failed");<NEW_LINE>}<NEW_LINE>} | TextMessage) rec.receive(30000); |
1,478,248 | public static CheckUpgradeVersionResponse unmarshall(CheckUpgradeVersionResponse checkUpgradeVersionResponse, UnmarshallerContext _ctx) {<NEW_LINE>checkUpgradeVersionResponse.setRequestId(_ctx.stringValue("CheckUpgradeVersionResponse.RequestId"));<NEW_LINE>checkUpgradeVersionResponse.setMessage(_ctx.stringValue("CheckUpgradeVersionResponse.Message"));<NEW_LINE>checkUpgradeVersionResponse.setLatestVersion(_ctx.stringValue("CheckUpgradeVersionResponse.LatestVersion"));<NEW_LINE>checkUpgradeVersionResponse.setOption(_ctx.stringValue("CheckUpgradeVersionResponse.Option"));<NEW_LINE>checkUpgradeVersionResponse.setCode(_ctx.stringValue("CheckUpgradeVersionResponse.Code"));<NEW_LINE>checkUpgradeVersionResponse.setSuccess(_ctx.booleanValue("CheckUpgradeVersionResponse.Success"));<NEW_LINE>List<Patch> patches = new ArrayList<Patch>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("CheckUpgradeVersionResponse.Patches.Length"); i++) {<NEW_LINE>Patch patch = new Patch();<NEW_LINE>patch.setInternalUrl(_ctx.stringValue("CheckUpgradeVersionResponse.Patches[" + i + "].InternalUrl"));<NEW_LINE>patch.setUrl(_ctx.stringValue<MASK><NEW_LINE>patch.setName(_ctx.stringValue("CheckUpgradeVersionResponse.Patches[" + i + "].Name"));<NEW_LINE>patch.setMD5(_ctx.stringValue("CheckUpgradeVersionResponse.Patches[" + i + "].MD5"));<NEW_LINE>patches.add(patch);<NEW_LINE>}<NEW_LINE>checkUpgradeVersionResponse.setPatches(patches);<NEW_LINE>return checkUpgradeVersionResponse;<NEW_LINE>} | ("CheckUpgradeVersionResponse.Patches[" + i + "].Url")); |
595,227 | protected void consumeDurability(ItemStack stack, Level world, @Nullable BlockState state, @Nullable BlockPos pos, LivingEntity living) {<NEW_LINE>Preconditions.checkArgument((pos == null) == (state == null));<NEW_LINE>if (state == null || state.getDestroySpeed(world, pos) != 0.0f) {<NEW_LINE>int dmg = state == null || ForgeHooks.isToolEffective(world, pos, stack) || isEffective(stack, state.getMaterial()) ? 1 : 3;<NEW_LINE>ItemStack head = getHead(stack);<NEW_LINE>if (!head.isEmpty()) {<NEW_LINE>if (!getUpgrades(stack).getBoolean("oiled") || Utils.RAND.nextInt(4) == 0)<NEW_LINE>damageHead(head, dmg, living);<NEW_LINE>this.setHead(stack, head);<NEW_LINE>IFluidHandler handler = FluidUtil.getFluidHandler(stack).orElseThrow(RuntimeException::new);<NEW_LINE>handler.drain(1, FluidAction.EXECUTE);<NEW_LINE>Triple<ItemStack, ShaderRegistryEntry, ShaderCase> <MASK><NEW_LINE>if (shader != null) {<NEW_LINE>Vec3 particlePos;<NEW_LINE>if (pos != null)<NEW_LINE>particlePos = Vec3.atCenterOf(pos);<NEW_LINE>else<NEW_LINE>particlePos = living.position();<NEW_LINE>shader.getMiddle().getEffectFunction().execute(world, shader.getLeft(), stack, shader.getRight().getShaderType().toString(), particlePos, null, .375f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | shader = ShaderRegistry.getStoredShaderAndCase(stack); |
1,566,618 | final ListThingPrincipalsResult executeListThingPrincipals(ListThingPrincipalsRequest listThingPrincipalsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listThingPrincipalsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListThingPrincipalsRequest> request = null;<NEW_LINE>Response<ListThingPrincipalsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListThingPrincipalsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listThingPrincipalsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListThingPrincipals");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListThingPrincipalsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListThingPrincipalsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
543,036 | public void liftEmbargo(Context context, Item item) throws SQLException, AuthorizeException, IOException {<NEW_LINE>// Since 3.0 the lift process for all embargoes is performed through the dates<NEW_LINE>// on the authorization process (see DS-2588)<NEW_LINE>// lifter.liftEmbargo(context, item);<NEW_LINE>itemService.clearMetadata(context, item, lift_schema, lift_element, lift_qualifier, Item.ANY);<NEW_LINE>// set the dc.date.available value to right now<NEW_LINE>itemService.clearMetadata(context, item, MetadataSchemaEnum.DC.getName(), <MASK><NEW_LINE>itemService.addMetadata(context, item, MetadataSchemaEnum.DC.getName(), "date", "available", null, DCDate.getCurrent().toString());<NEW_LINE>log.info("Lifting embargo on Item " + item.getHandle());<NEW_LINE>itemService.update(context, item);<NEW_LINE>} | "date", "available", Item.ANY); |
82,631 | public static GetMetaTableListByCategoryResponse unmarshall(GetMetaTableListByCategoryResponse getMetaTableListByCategoryResponse, UnmarshallerContext _ctx) {<NEW_LINE>getMetaTableListByCategoryResponse.setRequestId(_ctx.stringValue("GetMetaTableListByCategoryResponse.RequestId"));<NEW_LINE>getMetaTableListByCategoryResponse.setErrorCode(_ctx.stringValue("GetMetaTableListByCategoryResponse.ErrorCode"));<NEW_LINE>getMetaTableListByCategoryResponse.setErrorMessage(_ctx.stringValue("GetMetaTableListByCategoryResponse.ErrorMessage"));<NEW_LINE>getMetaTableListByCategoryResponse.setHttpStatusCode(_ctx.integerValue("GetMetaTableListByCategoryResponse.HttpStatusCode"));<NEW_LINE>getMetaTableListByCategoryResponse.setSuccess(_ctx.booleanValue("GetMetaTableListByCategoryResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNumber(_ctx.integerValue("GetMetaTableListByCategoryResponse.Data.PageNumber"));<NEW_LINE>data.setPageSize(_ctx.integerValue("GetMetaTableListByCategoryResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount(_ctx.longValue("GetMetaTableListByCategoryResponse.Data.TotalCount"));<NEW_LINE>List<String> tableGuidList = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetMetaTableListByCategoryResponse.Data.TableGuidList.Length"); i++) {<NEW_LINE>tableGuidList.add(_ctx.stringValue<MASK><NEW_LINE>}<NEW_LINE>data.setTableGuidList(tableGuidList);<NEW_LINE>getMetaTableListByCategoryResponse.setData(data);<NEW_LINE>return getMetaTableListByCategoryResponse;<NEW_LINE>} | ("GetMetaTableListByCategoryResponse.Data.TableGuidList[" + i + "]")); |
1,758,934 | protected void updateClientSystemMessages(Locale locale) {<NEW_LINE>SystemMessages msgs = new SystemMessages();<NEW_LINE>Locale actualLocale = locale;<NEW_LINE>if (getApp() != null) {<NEW_LINE>Locale appLocale = getApp().getLocale();<NEW_LINE>if (appLocale != null && !Objects.equals(locale, appLocale)) {<NEW_LINE>log.debug("Application and UI locales are mismatched. App locale will be used.");<NEW_LINE>actualLocale = appLocale;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>msgs.communicationErrorCaption = messages.getMainMessage("communicationErrorCaption", actualLocale);<NEW_LINE>msgs.communicationErrorMessage = messages.getMainMessage("communicationErrorMessage", actualLocale);<NEW_LINE>msgs.sessionExpiredErrorCaption = <MASK><NEW_LINE>msgs.sessionExpiredErrorMessage = messages.getMainMessage("sessionExpiredErrorMessage", actualLocale);<NEW_LINE>msgs.authorizationErrorCaption = messages.getMainMessage("authorizationErrorCaption", actualLocale);<NEW_LINE>msgs.authorizationErrorMessage = messages.getMainMessage("authorizationErrorMessage", actualLocale);<NEW_LINE>updateSystemMessagesLocale(msgs);<NEW_LINE>ReconnectDialogConfiguration reconnectDialogConfiguration = getReconnectDialogConfiguration();<NEW_LINE>reconnectDialogConfiguration.setDialogText(messages.getMainMessage("reconnectDialogText", actualLocale));<NEW_LINE>reconnectDialogConfiguration.setDialogTextGaveUp(messages.getMainMessage("reconnectDialogTextGaveUp", actualLocale));<NEW_LINE>} | messages.getMainMessage("sessionExpiredErrorCaption", actualLocale); |
323,581 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (((bitField0_ & 0x00000001) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.<MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) != 0)) {<NEW_LINE>output.writeInt32(2, quantifierSpanBegin_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) != 0)) {<NEW_LINE>output.writeInt32(3, quantifierSpanEnd_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) != 0)) {<NEW_LINE>output.writeInt32(4, subjectSpanBegin_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) != 0)) {<NEW_LINE>output.writeInt32(5, subjectSpanEnd_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) != 0)) {<NEW_LINE>output.writeInt32(6, objectSpanBegin_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000040) != 0)) {<NEW_LINE>output.writeInt32(7, objectSpanEnd_);<NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | writeString(output, 1, name_); |
1,633,738 | public void marshall(PublicEndpoint publicEndpoint, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (publicEndpoint == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getAddress(), ADDRESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getChannelType(), CHANNELTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getDemographic(), DEMOGRAPHIC_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getEffectiveDate(), EFFECTIVEDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getEndpointStatus(), ENDPOINTSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getLocation(), LOCATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getMetrics(), METRICS_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getOptOut(), OPTOUT_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getRequestId(), REQUESTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(publicEndpoint.getUser(), USER_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | publicEndpoint.getAttributes(), ATTRIBUTES_BINDING); |
1,396,824 | private static void printNestedObjectField(PrintStream out, int tabLevel, J9ClassPointer localClazz, U8Pointer dataStart, J9ClassPointer fromClass, J9ObjectFieldOffset objectFieldOffset, long address, String[] nestingHierarchy, J9ClassPointer containerClazz) throws CorruptDataException {<NEW_LINE>J9ROMFieldShapePointer fieldShape = objectFieldOffset.getField();<NEW_LINE>UDATA fieldOffset = objectFieldOffset.getOffsetOrAddress();<NEW_LINE>boolean containerIsFlatObject = (nestingHierarchy != null) && (nestingHierarchy.length > 0);<NEW_LINE>boolean isHiddenField = objectFieldOffset.isHidden();<NEW_LINE>String fieldName = J9UTF8Helper.stringValue(fieldShape.nameAndSignature().name());<NEW_LINE>String fieldSignature = J9UTF8Helper.stringValue(fieldShape.nameAndSignature().signature());<NEW_LINE>boolean fieldIsFlattened = valueTypeHelper.isFieldInClassFlattened(localClazz, fieldShape);<NEW_LINE>padding(out, tabLevel);<NEW_LINE>if (containerIsFlatObject && valueTypeHelper.classRequires4BytePrePadding(localClazz)) {<NEW_LINE>fieldOffset = fieldOffset.sub(4);<NEW_LINE>}<NEW_LINE>U8Pointer valuePtr = dataStart.add(fieldOffset);<NEW_LINE>if (fieldIsFlattened) {<NEW_LINE>out.format("%s %s { // EA = %s (offset = %d)%n", fieldSignature.substring(1, fieldSignature.length() - 1), fieldName, valuePtr.getHexAddress(<MASK><NEW_LINE>} else {<NEW_LINE>out.format("%s %s = ", fieldSignature, fieldName);<NEW_LINE>}<NEW_LINE>if (fieldShape.modifiers().anyBitsIn(J9FieldSizeDouble)) {<NEW_LINE>out.print(U64Pointer.cast(valuePtr).at(0).getHexValue());<NEW_LINE>} else if (fieldShape.modifiers().anyBitsIn(J9FieldFlagObject)) {<NEW_LINE>if (fieldIsFlattened) {<NEW_LINE>String[] newNestingHierarchy = null;<NEW_LINE>if (nestingHierarchy == null) { | ), fieldOffset.longValue()); |
1,784,182 | public Sequence execute(final StaticContext sctx, final QueryContext ctx, final Sequence[] args) {<NEW_LINE>final JsonDBItem item = (JsonDBItem) args[0];<NEW_LINE>final var resourceManager = item.getTrx().getResourceManager();<NEW_LINE>final Optional<RevisionReferencesNode> indexNode;<NEW_LINE>try (final var pageReadOnlyTrx = resourceManager.beginPageReadOnlyTrx()) {<NEW_LINE>indexNode = pageReadOnlyTrx.getRecord(item.getNodeKey(), IndexType.RECORD_TO_REVISIONS, 0);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throw new QueryException(new QNm(e.getMessage()), e);<NEW_LINE>}<NEW_LINE>return indexNode.map(node -> node.getRevisions()[node.getRevisions().length - 1]).map(revision -> {<NEW_LINE>final var rtx = resourceManager.beginNodeReadOnlyTrx(revision);<NEW_LINE>final var hasMoved = rtx.moveTo(item.getNodeKey()).hasMoved();<NEW_LINE>if (hasMoved) {<NEW_LINE>if (revision < resourceManager.getMostRecentRevisionNumber()) {<NEW_LINE>// Has been inserted, but never been removed, thus open most recent revision.<NEW_LINE>rtx.close();<NEW_LINE>return getJsonItem(item, resourceManager.getMostRecentRevisionNumber(), resourceManager);<NEW_LINE>} else {<NEW_LINE>rtx.moveTo(item.getNodeKey());<NEW_LINE>return new JsonItemFactory().getSequence(<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return getJsonItem(item, revision - 1, resourceManager);<NEW_LINE>}<NEW_LINE>}).orElseGet(() -> {<NEW_LINE>for (int revisionNumber = resourceManager.getMostRecentRevisionNumber(); revisionNumber > 0; revisionNumber--) {<NEW_LINE>final var rtx = resourceManager.beginNodeReadOnlyTrx(revisionNumber);<NEW_LINE>if (rtx.moveTo(item.getNodeKey()).hasMoved()) {<NEW_LINE>return new JsonItemFactory().getSequence(rtx, item.getCollection());<NEW_LINE>} else {<NEW_LINE>rtx.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} | rtx, item.getCollection()); |
676,516 | final ListAttachedGroupPoliciesResult executeListAttachedGroupPolicies(ListAttachedGroupPoliciesRequest listAttachedGroupPoliciesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listAttachedGroupPoliciesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListAttachedGroupPoliciesRequest> request = null;<NEW_LINE>Response<ListAttachedGroupPoliciesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListAttachedGroupPoliciesRequestMarshaller().marshall(super.beforeMarshalling(listAttachedGroupPoliciesRequest));<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, "IAM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAttachedGroupPolicies");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ListAttachedGroupPoliciesResult> responseHandler = new StaxResponseHandler<ListAttachedGroupPoliciesResult>(new ListAttachedGroupPoliciesResultStaxUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.