idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,585,069 | final DescribeThingRegistrationTaskResult executeDescribeThingRegistrationTask(DescribeThingRegistrationTaskRequest describeThingRegistrationTaskRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeThingRegistrationTaskRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeThingRegistrationTaskRequest> request = null;<NEW_LINE>Response<DescribeThingRegistrationTaskResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeThingRegistrationTaskRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeThingRegistrationTaskRequest));<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");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeThingRegistrationTask");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeThingRegistrationTaskResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeThingRegistrationTaskResultJsonUnmarshaller());<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); |
620,271 | public void doRenderLayer(@Nonnull AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {<NEW_LINE>NNList.of(EntityEquipmentSlot.class).apply(new Callback<EntityEquipmentSlot>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void apply(@Nonnull EntityEquipmentSlot slot) {<NEW_LINE>ItemStack item = player.getItemStackFromSlot(slot);<NEW_LINE>if (item.getItem() instanceof IDarkSteelItem) {<NEW_LINE>for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {<NEW_LINE>if (upgrade instanceof IHasPlayerRenderer && upgrade.hasUpgrade(item)) {<NEW_LINE>((IHasPlayerRenderer) upgrade).getRender(player).doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (item.getItem() instanceof IHasPlayerRenderer) {<NEW_LINE>((IHasPlayerRenderer) item.getItem()).getRender(player).doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>IInventory baubles = BaublesUtil.<MASK><NEW_LINE>if (baubles != null) {<NEW_LINE>for (int i = 0; i < baubles.getSizeInventory(); i++) {<NEW_LINE>ItemStack piece = baubles.getStackInSlot(i);<NEW_LINE>if (piece.getItem() instanceof IHasPlayerRenderer) {<NEW_LINE>((IHasPlayerRenderer) piece.getItem()).getRender(player).doRenderLayer(renderPlayer, null, piece, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | instance().getBaubles(player); |
685,239 | private Consumer prepareListener(EmbeddedKafkaBroker broker, String destination, KafkaProperties kafkaProperties) {<NEW_LINE>Map<String, Object> consumerProperties = KafkaTestUtils.consumerProps(kafkaProperties.getConsumer().getGroupId(), "false", broker);<NEW_LINE>// Respect custom key/value deserializers and any additional props under<NEW_LINE>// 'spring.kafka.consumer.properties'<NEW_LINE>consumerProperties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, kafkaProperties.getConsumer().getKeyDeserializer());<NEW_LINE>consumerProperties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, kafkaProperties.getConsumer().getValueDeserializer());<NEW_LINE>consumerProperties.putAll(kafkaProperties.getConsumer().getProperties());<NEW_LINE>DefaultKafkaConsumerFactory<String, String> consumerFactory = new DefaultKafkaConsumerFactory<>(consumerProperties);<NEW_LINE>Consumer<String, String> consumer = consumerFactory.createConsumer();<NEW_LINE>broker.consumeFromAnEmbeddedTopic(consumer, destination);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.<MASK><NEW_LINE>}<NEW_LINE>return consumer;<NEW_LINE>} | debug("Prepared consumer for destination [" + destination + "]"); |
1,776,642 | private static String dumpTaskResult(final RunTaskResult result) {<NEW_LINE>final StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("[");<NEW_LINE>for (Task task : result.getTasks()) {<NEW_LINE>sb.append("{");<NEW_LINE>if (task.getTaskArn() != null) {<NEW_LINE>sb.append("TaskArn: ").append(task.getTaskArn()).append(",");<NEW_LINE>}<NEW_LINE>if (task.getClusterArn() != null) {<NEW_LINE>sb.append("ClusterArn: ").append(task.getClusterArn()).append(",");<NEW_LINE>}<NEW_LINE>if (task.getContainerInstanceArn() != null) {<NEW_LINE>sb.append("ContainerInstanceArn: ").append(task.getContainerInstanceArn()).append(",");<NEW_LINE>}<NEW_LINE>if (task.getTaskDefinitionArn() != null) {<NEW_LINE>sb.append("TaskDefinitionArn: ").append(task.getTaskDefinitionArn()).append(",");<NEW_LINE>}<NEW_LINE>if (task.getHealthStatus() != null) {<NEW_LINE>sb.append("HealthStatus: ").append(task.getHealthStatus()).append(",");<NEW_LINE>}<NEW_LINE>if (task.getPlatformVersion() != null) {<NEW_LINE>sb.append("PlatformVersion: ").append(task.getPlatformVersion()).append(",");<NEW_LINE>}<NEW_LINE>if (task.getCreatedAt() != null) {<NEW_LINE>sb.append("CreatedAt: ").append(task.getCreatedAt<MASK><NEW_LINE>}<NEW_LINE>if (task.getStartedAt() != null) {<NEW_LINE>sb.append("StartedAt: ").append(task.getStartedAt());<NEW_LINE>}<NEW_LINE>sb.append("}");<NEW_LINE>sb.append(",");<NEW_LINE>}<NEW_LINE>sb.append("]");<NEW_LINE>return sb.toString();<NEW_LINE>} | ()).append(","); |
783,027 | public void flatMap(LocalAggregator aggregator, Collector<Tuple3<Integer, GmmClusterSummary, IterationStatus>> out) throws Exception {<NEW_LINE>for (int i = 0; i < numClusters; i++) {<NEW_LINE>double w = aggregator.updatedWeightsSum.get(i);<NEW_LINE>aggregator.updatedMeansSum[i].scaleEqual(1.0 / w);<NEW_LINE>aggregator.updatedCovsSum[i].scaleEqual(1.0 / w);<NEW_LINE>GmmClusterSummary model = new GmmClusterSummary(i, w / aggregator.totalCount, aggregator.updatedMeansSum[i], aggregator.updatedCovsSum[i]);<NEW_LINE>// note that we use Cov(X,Y) = E[XY] - E[X]E[Y] to compute Cov(X,Y)<NEW_LINE>int featureSize = model.mean.size();<NEW_LINE>for (int m = 0; m < featureSize; m++) {<NEW_LINE>// loop over columns<NEW_LINE>for (int n = m; n < featureSize; n++) {<NEW_LINE>int pos = GmmModelData.<MASK><NEW_LINE>model.cov.add(pos, -1.0 * model.mean.get(m) * model.mean.get(n));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>IterationStatus stat = new IterationStatus();<NEW_LINE>stat.prevLogLikelihood = aggregator.prevLogLikelihood;<NEW_LINE>stat.currLogLikelihood = aggregator.newLogLikelihood;<NEW_LINE>out.collect(Tuple3.of(i, model, stat));<NEW_LINE>}<NEW_LINE>} | getElementPositionInCompactMatrix(m, n, featureSize); |
1,258,264 | public void loadStaticField(FieldExpression fldExp) {<NEW_LINE>MethodVisitor mv = controller.getMethodVisitor();<NEW_LINE><MASK><NEW_LINE>boolean holder = field.isHolder() && !controller.isInClosureConstructor();<NEW_LINE>ClassNode type = field.getType();<NEW_LINE>String ownerName = (field.getOwner().equals(controller.getClassNode())) ? controller.getInternalClassName() : BytecodeHelper.getClassInternalName(field.getOwner());<NEW_LINE>if (holder) {<NEW_LINE>mv.visitFieldInsn(GETSTATIC, ownerName, fldExp.getFieldName(), BytecodeHelper.getTypeDescription(type));<NEW_LINE>mv.visitMethodInsn(INVOKEVIRTUAL, "groovy/lang/Reference", "get", "()Ljava/lang/Object;", false);<NEW_LINE>controller.getOperandStack().push(ClassHelper.OBJECT_TYPE);<NEW_LINE>} else {<NEW_LINE>mv.visitFieldInsn(GETSTATIC, ownerName, fldExp.getFieldName(), BytecodeHelper.getTypeDescription(type));<NEW_LINE>controller.getOperandStack().push(field.getType());<NEW_LINE>}<NEW_LINE>} | FieldNode field = fldExp.getField(); |
1,326,665 | private String formE(double number) {<NEW_LINE>// format absolute mantisse<NEW_LINE>int exponent = 0;<NEW_LINE>String zeros = "00000000000000000000000".substring(0, _precision + 1);<NEW_LINE>if (number != 0) {<NEW_LINE>exponent = (int) Math.floor(Math.log(Math.abs(number)) <MASK><NEW_LINE>double mantisse = Math.floor(Math.abs(number * power(10.0, _precision - exponent)) + 0.5);<NEW_LINE>if (mantisse >= 10 * _tenToPrecision) {<NEW_LINE>exponent++;<NEW_LINE>mantisse = Math.floor(Math.abs(number * power(10.0, _precision - exponent)) + 0.5);<NEW_LINE>}<NEW_LINE>zeros = Long.toString((long) mantisse);<NEW_LINE>}<NEW_LINE>// make fractional part<NEW_LINE>StringBuffer fracPart = new StringBuffer();<NEW_LINE>if (_decimalPoint) {<NEW_LINE>fracPart.append('.').append(zeros.substring(1));<NEW_LINE>}<NEW_LINE>// make exponent<NEW_LINE>fracPart.append(Character.isLowerCase(_descriptor) ? 'e' : 'E').append(exponent < 0 ? '-' : '+');<NEW_LINE>exponent = Math.abs(exponent);<NEW_LINE>for (int i = 0, n = fracPart.length(); i < 3; i++) {<NEW_LINE>fracPart.insert(n, Character.forDigit(exponent % 10, 10));<NEW_LINE>exponent /= 10;<NEW_LINE>}<NEW_LINE>return form(number < 0, zeros.substring(0, 1), new String(fracPart));<NEW_LINE>} | / Math.log(10)); |
386,254 | public String putRecordingTextTrack(String recordId, String kind, String lang, File file, String label, String origFilename, String trackId, String contentType, String tempFilename) {<NEW_LINE>Map<String, Object> logData = new HashMap<>();<NEW_LINE>logData.put("recordId", recordId);<NEW_LINE>logData.put("kind", kind);<NEW_LINE><MASK><NEW_LINE>logData.put("label", label);<NEW_LINE>logData.put("origFilename", origFilename);<NEW_LINE>logData.put("contentType", contentType);<NEW_LINE>logData.put("tempFilename", tempFilename);<NEW_LINE>logData.put("logCode", "recording_captions_uploaded");<NEW_LINE>logData.put("description", "Captions for recording uploaded.");<NEW_LINE>Gson gson = new Gson();<NEW_LINE>String logStr = gson.toJson(logData);<NEW_LINE>log.info(" --analytics-- data={}", logStr);<NEW_LINE>UploadedTrack track = new UploadedTrack(recordId, kind, lang, label, origFilename, file, trackId, getCaptionTrackInboxDir(), contentType, tempFilename);<NEW_LINE>return recordingService.putRecordingTextTrack(track);<NEW_LINE>} | logData.put("lang", lang); |
1,344,740 | public static GetSecCheckResultDetailResponse unmarshall(GetSecCheckResultDetailResponse getSecCheckResultDetailResponse, UnmarshallerContext _ctx) {<NEW_LINE>getSecCheckResultDetailResponse.setRequestId(_ctx.stringValue("GetSecCheckResultDetailResponse.RequestId"));<NEW_LINE>getSecCheckResultDetailResponse.setSuccess<MASK><NEW_LINE>getSecCheckResultDetailResponse.setCode(_ctx.stringValue("GetSecCheckResultDetailResponse.Code"));<NEW_LINE>getSecCheckResultDetailResponse.setMessage(_ctx.stringValue("GetSecCheckResultDetailResponse.Message"));<NEW_LINE>Data data = new Data();<NEW_LINE>PageInfo pageInfo = new PageInfo();<NEW_LINE>pageInfo.setCurrentPage(_ctx.integerValue("GetSecCheckResultDetailResponse.Data.PageInfo.CurrentPage"));<NEW_LINE>pageInfo.setPageSize(_ctx.integerValue("GetSecCheckResultDetailResponse.Data.PageInfo.PageSize"));<NEW_LINE>pageInfo.setTotal(_ctx.integerValue("GetSecCheckResultDetailResponse.Data.PageInfo.Total"));<NEW_LINE>data.setPageInfo(pageInfo);<NEW_LINE>List<OmniSecCheckResultDetailDTO> list = new ArrayList<OmniSecCheckResultDetailDTO>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetSecCheckResultDetailResponse.Data.List.Length"); i++) {<NEW_LINE>OmniSecCheckResultDetailDTO omniSecCheckResultDetailDTO = new OmniSecCheckResultDetailDTO();<NEW_LINE>omniSecCheckResultDetailDTO.setId(_ctx.longValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].Id"));<NEW_LINE>omniSecCheckResultDetailDTO.setResultId(_ctx.longValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].ResultId"));<NEW_LINE>omniSecCheckResultDetailDTO.setKeywords(_ctx.stringValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].Keywords"));<NEW_LINE>omniSecCheckResultDetailDTO.setContent(_ctx.stringValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].Content"));<NEW_LINE>omniSecCheckResultDetailDTO.setPicUrl(_ctx.stringValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].PicUrl"));<NEW_LINE>omniSecCheckResultDetailDTO.setSnapshotKey(_ctx.stringValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].SnapshotKey"));<NEW_LINE>omniSecCheckResultDetailDTO.setExtra(_ctx.stringValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].Extra"));<NEW_LINE>omniSecCheckResultDetailDTO.setRiskType(_ctx.stringValue("GetSecCheckResultDetailResponse.Data.List[" + i + "].RiskType"));<NEW_LINE>list.add(omniSecCheckResultDetailDTO);<NEW_LINE>}<NEW_LINE>data.setList(list);<NEW_LINE>getSecCheckResultDetailResponse.setData(data);<NEW_LINE>return getSecCheckResultDetailResponse;<NEW_LINE>} | (_ctx.booleanValue("GetSecCheckResultDetailResponse.Success")); |
534,555 | protected String encodeClasspath(IClasspathEntry[] classpath, IClasspathEntry[] referencedEntries, IPath outputLocation, boolean indent, Map unknownElements) throws JavaModelException {<NEW_LINE>try {<NEW_LINE>StringWriter writer = new StringWriter();<NEW_LINE>XMLWriter xmlWriter = new XMLWriter(writer, this, true);<NEW_LINE>xmlWriter.startTag(ClasspathEntry.TAG_CLASSPATH, indent);<NEW_LINE>for (int i = 0; i < classpath.length; ++i) {<NEW_LINE>((ClasspathEntry) classpath[i]).elementEncode(xmlWriter, this.project.getFullPath(), indent, true, unknownElements, false);<NEW_LINE>}<NEW_LINE>if (outputLocation != null) {<NEW_LINE>outputLocation = outputLocation.removeFirstSegments(1);<NEW_LINE>outputLocation = outputLocation.makeRelative();<NEW_LINE>HashMap parameters = new HashMap();<NEW_LINE>parameters.put(ClasspathEntry.TAG_KIND, ClasspathEntry.kindToString(ClasspathEntry.K_OUTPUT));<NEW_LINE>parameters.put(ClasspathEntry.TAG_PATH, String.valueOf(outputLocation));<NEW_LINE>xmlWriter.printTag(ClasspathEntry.TAG_CLASSPATHENTRY, parameters, indent, true, true);<NEW_LINE>}<NEW_LINE>if (referencedEntries != null) {<NEW_LINE>for (int i = 0; i < referencedEntries.length; ++i) {<NEW_LINE>((ClasspathEntry) referencedEntries[i]).elementEncode(xmlWriter, this.project.getFullPath(), <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>xmlWriter.endTag(ClasspathEntry.TAG_CLASSPATH, indent, true);<NEW_LINE>writer.flush();<NEW_LINE>writer.close();<NEW_LINE>return writer.toString();<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);<NEW_LINE>}<NEW_LINE>} | indent, true, unknownElements, true); |
389,737 | protected void updatePeerInfoIcon() {<NEW_LINE>String tag;<NEW_LINE>Map<String, String> peerTagMap = preferences.getPeerTagMap();<NEW_LINE>if (peerTagMap.containsKey(fullAddress)) {<NEW_LINE>tag = peerTagMap.get(fullAddress);<NEW_LINE>final String text = !tag.isEmpty() ? Res.get(<MASK><NEW_LINE>Tooltip.install(this, new Tooltip(text));<NEW_LINE>} else {<NEW_LINE>tag = "";<NEW_LINE>Tooltip.install(this, new Tooltip(tooltipText));<NEW_LINE>}<NEW_LINE>if (!tag.isEmpty())<NEW_LINE>tagLabel.setText(tag.substring(0, 1));<NEW_LINE>if (numTrades > 0) {<NEW_LINE>numTradesLabel.setText(numTrades > 99 ? "*" : String.valueOf(numTrades));<NEW_LINE>double scaleFactor = getScaleFactor();<NEW_LINE>if (numTrades > 9 && numTrades < 100) {<NEW_LINE>numTradesLabel.relocate(scaleFactor * 2, scaleFactor * 1);<NEW_LINE>} else {<NEW_LINE>numTradesLabel.relocate(scaleFactor * 5, scaleFactor * 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>numTradesPane.setVisible(numTrades > 0);<NEW_LINE>tagPane.setVisible(!tag.isEmpty());<NEW_LINE>} | "peerInfoIcon.tooltip", tooltipText, tag) : tooltipText; |
1,129,511 | public void reInitActions() {<NEW_LINE>String menuPath = LocalizingService.MENU_MACROS;<NEW_LINE>String actionCategory = "Macro";<NEW_LINE>String localized = String.format("Menu/%s/%s", Localization.getString("platform.menu.machine"), Localization.getString("platform.menu.macros"));<NEW_LINE>try {<NEW_LINE>FileObject root = FileUtil.getConfigRoot();<NEW_LINE>// Clear out the menu items.<NEW_LINE>FileUtil.createFolder(<MASK><NEW_LINE>FileUtil.createFolder(root, menuPath);<NEW_LINE>String actionPath = "/Actions/" + actionCategory;<NEW_LINE>FileUtil.createFolder(root, actionPath).delete();<NEW_LINE>ActionRegistrationService ars = Lookup.getDefault().lookup(ActionRegistrationService.class);<NEW_LINE>BackendAPI backend = CentralLookup.getDefault().lookup(BackendAPI.class);<NEW_LINE>Settings settings = backend.getSettings();<NEW_LINE>List<Macro> macros = settings.getMacros();<NEW_LINE>macros.forEach(macro -> {<NEW_LINE>int index = macros.indexOf(macro);<NEW_LINE>try {<NEW_LINE>String text;<NEW_LINE>if (Strings.isNullOrEmpty(macro.getNameAndDescription())) {<NEW_LINE>text = Integer.toString(index + 1);<NEW_LINE>} else {<NEW_LINE>text = macro.getNameAndDescription();<NEW_LINE>}<NEW_LINE>ars.registerAction(MacroAction.class.getCanonicalName() + "." + macro.getName(), text, actionCategory, null, menuPath, index, localized, new MacroAction(macro));<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.log(Level.WARNING, "Couldn't register macro action: \"" + macro.getName() + "\"", e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.log(Level.WARNING, "Couldn't register macro actions", e);<NEW_LINE>}<NEW_LINE>} | root, menuPath).delete(); |
1,524,723 | public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {<NEW_LINE>InstrumentClass target = instrumentor.<MASK><NEW_LINE>InstrumentMethod execute = target.getDeclaredMethod("execute", "org.apache.http.HttpRequest", "org.apache.http.HttpClientConnection", "org.apache.http.protocol.HttpContext");<NEW_LINE>if (execute != null) {<NEW_LINE>execute.addScopedInterceptor(HttpRequestExecutorExecuteMethodInterceptor.class, HttpClient4Constants.HTTP_CLIENT4_SCOPE, ExecutionPolicy.ALWAYS);<NEW_LINE>}<NEW_LINE>InstrumentMethod doSendRequest = target.getDeclaredMethod("doSendRequest", "org.apache.http.HttpRequest", "org.apache.http.HttpClientConnection", "org.apache.http.protocol.HttpContext");<NEW_LINE>if (doSendRequest != null) {<NEW_LINE>doSendRequest.addScopedInterceptor(HttpRequestExecutorDoSendRequestAndDoReceiveResponseMethodInterceptor.class, HttpClient4Constants.HTTP_CLIENT4_SCOPE, ExecutionPolicy.ALWAYS);<NEW_LINE>}<NEW_LINE>InstrumentMethod doReceiveResponse = target.getDeclaredMethod("doReceiveResponse", "org.apache.http.HttpRequest", "org.apache.http.HttpClientConnection", "org.apache.http.protocol.HttpContext");<NEW_LINE>if (doReceiveResponse != null) {<NEW_LINE>doReceiveResponse.addScopedInterceptor(HttpRequestExecutorDoSendRequestAndDoReceiveResponseMethodInterceptor.class, HttpClient4Constants.HTTP_CLIENT4_SCOPE, ExecutionPolicy.ALWAYS);<NEW_LINE>}<NEW_LINE>return target.toBytecode();<NEW_LINE>} | getInstrumentClass(loader, className, classfileBuffer); |
229,270 | public int match() {<NEW_LINE>int counter = 0;<NEW_LINE>// (a) Direct Matches<NEW_LINE>// 1..2<NEW_LINE>String // 1..2<NEW_LINE>sql = // 3..5<NEW_LINE>"SELECT m1.AD_Client_ID,m2.AD_Org_ID, " + // 6..9<NEW_LINE>"m1.C_InvoiceLine_ID,m2.M_InOutLine_ID,m1.M_Product_ID, " + "m1.DateTrx,m2.DateTrx, m1.Qty, m2.Qty " + "FROM M_MatchPO m1, M_MatchPO m2 " + "WHERE m1.C_OrderLine_ID=m2.C_OrderLine_ID" + " AND m1.M_InOutLine_ID IS NULL" + " AND m2.C_InvoiceLine_ID IS NULL" + // #1<NEW_LINE>" AND m1.M_Product_ID=m2.M_Product_ID" + // Not existing Inv Matches<NEW_LINE>" AND m1.AD_Client_ID=?" + " AND NOT EXISTS (SELECT * FROM M_MatchInv mi " + "WHERE mi.C_InvoiceLine_ID=m1.C_InvoiceLine_ID AND mi.M_InOutLine_ID=m2.M_InOutLine_ID)";<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = <MASK><NEW_LINE>pstmt.setInt(1, m_AD_Client_ID);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>while (rs.next()) {<NEW_LINE>BigDecimal qty1 = rs.getBigDecimal(8);<NEW_LINE>BigDecimal qty2 = rs.getBigDecimal(9);<NEW_LINE>BigDecimal Qty = qty1.min(qty2);<NEW_LINE>if (Qty.compareTo(Env.ZERO) == 0)<NEW_LINE>continue;<NEW_LINE>Timestamp dateTrx1 = rs.getTimestamp(6);<NEW_LINE>Timestamp dateTrx2 = rs.getTimestamp(7);<NEW_LINE>Timestamp DateTrx = dateTrx1;<NEW_LINE>if (dateTrx1.before(dateTrx2))<NEW_LINE>DateTrx = dateTrx2;<NEW_LINE>//<NEW_LINE>int AD_Client_ID = rs.getInt(1);<NEW_LINE>int AD_Org_ID = rs.getInt(2);<NEW_LINE>int C_InvoiceLine_ID = rs.getInt(3);<NEW_LINE>int M_InOutLine_ID = rs.getInt(4);<NEW_LINE>int M_Product_ID = rs.getInt(5);<NEW_LINE>//<NEW_LINE>if (createMatchInv(AD_Client_ID, AD_Org_ID, M_InOutLine_ID, C_InvoiceLine_ID, M_Product_ID, DateTrx, Qty))<NEW_LINE>counter++;<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.log(Level.SEVERE, "match", e);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>log.fine("Matcher.match - Client_ID=" + m_AD_Client_ID + ", Records created=" + counter);<NEW_LINE>return counter;<NEW_LINE>} | DB.prepareStatement(sql, null); |
1,079,232 | private void process(final JobConfiguration jobConfig, final ShardingContexts shardingContexts, final ExecutionSource executionSource) {<NEW_LINE>Collection<Integer> items = shardingContexts.getShardingItemParameters().keySet();<NEW_LINE>if (1 == items.size()) {<NEW_LINE>int item = shardingContexts.getShardingItemParameters().keySet().iterator().next();<NEW_LINE>JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(IpUtils.getHostName(), IpUtils.getIp(), shardingContexts.getTaskId(), jobConfig.getJobName(), executionSource, item);<NEW_LINE>process(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CountDownLatch latch = new CountDownLatch(items.size());<NEW_LINE>for (int each : items) {<NEW_LINE>JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(IpUtils.getHostName(), IpUtils.getIp(), shardingContexts.getTaskId(), jobConfig.getJobName(), executionSource, each);<NEW_LINE>ExecutorService executorService = executorContext.get(ExecutorService.class);<NEW_LINE>if (executorService.isShutdown()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>executorService.submit(() -> {<NEW_LINE>try {<NEW_LINE>process(jobConfig, shardingContexts, each, jobExecutionEvent);<NEW_LINE>} finally {<NEW_LINE>latch.countDown();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>latch.await();<NEW_LINE>} catch (final InterruptedException ex) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>} | jobConfig, shardingContexts, item, jobExecutionEvent); |
957,125 | public Object call(final ArrayList<DataPoints[]> query_results) throws Exception {<NEW_LINE>if (allow_expressions) {<NEW_LINE>// process each of the expressions into a new list, then merge it<NEW_LINE>// with the original. This avoids possible recursion loops.<NEW_LINE>final List<DataPoints[]> expression_results = new ArrayList<DataPoints[]<MASK><NEW_LINE>// let exceptions bubble up<NEW_LINE>for (final ExpressionTree expression : expressions) {<NEW_LINE>expression_results.add(expression.evaluate(query_results));<NEW_LINE>}<NEW_LINE>results.addAll(expression_results);<NEW_LINE>} else {<NEW_LINE>results.addAll(query_results);<NEW_LINE>}<NEW_LINE>class SendIt implements Callback<Object, ChannelBuffer> {<NEW_LINE><NEW_LINE>public Object call(final ChannelBuffer buffer) throws Exception {<NEW_LINE>query.sendReply(buffer);<NEW_LINE>query_success.incrementAndGet();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>switch(query.apiVersion()) {<NEW_LINE>case 0:<NEW_LINE>case 1:<NEW_LINE>query.serializer().formatQueryAsyncV1(data_query, results, globals).addCallback(new SendIt()).addErrback(new ErrorCB());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>query_invalid.incrementAndGet();<NEW_LINE>throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "Requested API version not implemented", "Version " + query.apiVersion() + " is not implemented");<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | >(expressions.size()); |
1,759,641 | public void render(T entity, float entityYaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) {<NEW_LINE>ShaderCase sCase = null;<NEW_LINE>ItemStack shader;<NEW_LINE>if (shadedCarts.containsKey(entity.getId())) {<NEW_LINE>shader = shadedCarts.get(entity.getId());<NEW_LINE>if (shader != null && !shader.isEmpty() && shader.getItem() instanceof IShaderItem)<NEW_LINE>sCase = ((IShaderItem) shader.getItem()).getShaderCase(shader, null, new ResourceLocation<MASK><NEW_LINE>}<NEW_LINE>baseRenderer.render(entity, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);<NEW_LINE>if (sCase != null) {<NEW_LINE>matrixStackIn.pushPose();<NEW_LINE>applyTransforms(matrixStackIn, entity, partialTicks, entityYaw);<NEW_LINE>MinecartModel<?> model = getModel();<NEW_LINE>List<ModelPart> boxList = Lists.newArrayList(model.parts());<NEW_LINE>boxList.get(5).y = 4.1F;<NEW_LINE>for (int part = 0; part < boxList.size() - 1; part++) if (boxList.get(part) != null) {<NEW_LINE>float scale = 1;<NEW_LINE>ShaderLayer[] layers = sCase.getLayers();<NEW_LINE>// identify part 1+2, they shouldn'T render with additional?!<NEW_LINE>for (int pass = 0; pass < layers.length; pass++) if (sCase.shouldRenderGroupForPass("" + part, pass)) {<NEW_LINE>Vector4f col = sCase.getRenderColor("" + part, pass, new Vector4f(1, 1, 1, 1));<NEW_LINE>matrixStackIn.pushPose();<NEW_LINE>matrixStackIn.scale(scale, scale, scale);<NEW_LINE>RenderType type = sCase.getLayers()[pass].getRenderType(RenderType.entityTranslucent(sCase.getTextureReplacement(Integer.toString(part), pass)));<NEW_LINE>ModelPart subModel = boxList.get(part);<NEW_LINE>boolean oldMirrored = subModel.mirror;<NEW_LINE>subModel.mirror = ((ShaderCaseMinecart) sCase).mirrorSideForPass[pass];<NEW_LINE>subModel.render(matrixStackIn, bufferIn.getBuffer(type), packedLightIn, OverlayTexture.NO_OVERLAY, col.x(), col.y(), col.z(), col.w());<NEW_LINE>subModel.mirror = oldMirrored;<NEW_LINE>matrixStackIn.popPose();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>matrixStackIn.popPose();<NEW_LINE>}<NEW_LINE>} | (ImmersiveEngineering.MODID, "minecart")); |
1,504,889 | protected String doIt() throws Exception {<NEW_LINE>final I_M_Product product = productDAO.getById(getRecord_ID());<NEW_LINE>final IQueryBL queryBL = Services.get(IQueryBL.class);<NEW_LINE>final IQueryFilter<I_M_Product> productFilter = queryBL.createCompositeQueryFilter(I_M_Product.class).addOnlyActiveRecordsFilter().addCompareFilter(I_M_Product.COLUMNNAME_M_Product_ID, CompareQueryFilter.Operator.EQUAL, product.getM_Product_ID());<NEW_LINE>if (product.isDiscontinued()) {<NEW_LINE>final ZoneId zoneId = orgDAO.getTimeZone(OrgId.ofRepoId(product.getAD_Org_ID()));<NEW_LINE>final Optional<LocalDate> discontinuedFrom = Optional.ofNullable(product.getDiscontinuedFrom()).map(discontinuedFromTimestamp -> TimeUtil.asLocalDate(discontinuedFromTimestamp, zoneId));<NEW_LINE>if (!discontinuedFrom.isPresent() || discontinuedFrom.get().compareTo(p_dateFrom) <= 0) {<NEW_LINE>priceListDAO.updateProductPricesIsActive(productFilter, p_dateFrom, false);<NEW_LINE>} else {<NEW_LINE>priceListDAO.<MASK><NEW_LINE>priceListDAO.updateProductPricesIsActive(productFilter, discontinuedFrom.get(), false);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>priceListDAO.updateProductPricesIsActive(productFilter, p_dateFrom, true);<NEW_LINE>}<NEW_LINE>return MSG_OK;<NEW_LINE>} | updateProductPricesIsActive(productFilter, p_dateFrom, true); |
844,027 | public List<String> build(VarsContext context) {<NEW_LINE>String rowText <MASK><NEW_LINE>if (!rowText.startsWith("|")) {<NEW_LINE>throw new SyntaxException(getPlace(), "Incorrect format. Should start with '|'");<NEW_LINE>}<NEW_LINE>if (!rowText.endsWith("|")) {<NEW_LINE>throw new SyntaxException(getPlace(), "Incorrect format. Should end with '|'");<NEW_LINE>}<NEW_LINE>String[] rawCells = rowText.split("\\|");<NEW_LINE>List<String> cells = new LinkedList<>();<NEW_LINE>if (rawCells.length > 1) {<NEW_LINE>for (int i = 1; i < rawCells.length; i++) {<NEW_LINE>cells.add(context.process(rawCells[i].trim()));<NEW_LINE>}<NEW_LINE>} else<NEW_LINE>throw new SyntaxException(getPlace(), "Incorrect row. Use '|' symbol to split values");<NEW_LINE>return cells;<NEW_LINE>} | = getArguments().trim(); |
38,355 | private static boolean parseScreenRound(String name, ResTable_config out) {<NEW_LINE>if (Objects.equals(name, kWildcardName)) {<NEW_LINE>if (out != null) {<NEW_LINE>out.screenLayout2 = (byte) ((out.screenLayout2 & ~ResTable_config.MASK_SCREENROUND) | ResTable_config.SCREENROUND_ANY);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else if (Objects.equals(name, "round")) {<NEW_LINE>if (out != null) {<NEW_LINE>out.screenLayout2 = (byte) ((out.screenLayout2 & ~ResTable_config.MASK_SCREENROUND) | ResTable_config.SCREENROUND_YES);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else if (Objects.equals(name, "notround")) {<NEW_LINE>if (out != null) {<NEW_LINE>out.screenLayout2 = (byte) ((out.screenLayout2 & ~ResTable_config<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .MASK_SCREENROUND) | ResTable_config.SCREENROUND_NO); |
795,859 | public void processRecordsCli(Dataset<Row> lines) throws ZinggClientException {<NEW_LINE>LOG.info("Processing Records for CLI Labelling");<NEW_LINE>printMarkedRecordsStat();<NEW_LINE>if (lines == null || lines.count() == 0) {<NEW_LINE>LOG.info("It seems there are no unmarked records at this moment. Please run findTrainingData job to build some pairs to be labelled and then run this labeler.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>lines = lines.cache();<NEW_LINE>List<Column> displayCols = DSUtil.getFieldDefColumns(lines, args, false, args.getShowConcise());<NEW_LINE>List<Row> clusterIDs = lines.select(ColName.CLUSTER_COLUMN).distinct().collectAsList();<NEW_LINE>try {<NEW_LINE>double score;<NEW_LINE>double prediction;<NEW_LINE>Dataset<Row> updatedRecords = null;<NEW_LINE>int selected_option = -1;<NEW_LINE>String msg1, msg2;<NEW_LINE>int totalPairs = clusterIDs.size();<NEW_LINE>for (int index = 0; index < totalPairs; index++) {<NEW_LINE>Dataset<Row> currentPair = lines.filter(lines.col(ColName.CLUSTER_COLUMN).equalTo(clusterIDs.get(index).getAs(ColName.CLUSTER_COLUMN))).cache();<NEW_LINE>score = currentPair.head().getAs(ColName.SCORE_COL);<NEW_LINE>prediction = currentPair.head(<MASK><NEW_LINE>msg1 = String.format("\tCurrent labelling round : %d/%d pairs labelled\n", index, totalPairs);<NEW_LINE>String matchType = LabelMatchType.get(prediction).msg;<NEW_LINE>if (prediction == ColValues.IS_NOT_KNOWN_PREDICTION) {<NEW_LINE>msg2 = String.format("\tZingg does not do any prediction for the above pairs as Zingg is still collecting training data to build the preliminary models.");<NEW_LINE>} else {<NEW_LINE>msg2 = String.format("\tZingg predicts the above records %s with a similarity score of %.2f", matchType, Math.floor(score * 100) * 0.01);<NEW_LINE>}<NEW_LINE>// String msgHeader = msg1 + msg2;<NEW_LINE>selected_option = displayRecordsAndGetUserInput(DSUtil.select(currentPair, displayCols), msg1, msg2);<NEW_LINE>updateLabellerStat(selected_option, 1);<NEW_LINE>printMarkedRecordsStat();<NEW_LINE>if (selected_option == 9) {<NEW_LINE>LOG.info("User has quit in the middle. Updating the records.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>updatedRecords = updateRecords(selected_option, currentPair, updatedRecords);<NEW_LINE>}<NEW_LINE>writeLabelledOutput(updatedRecords);<NEW_LINE>LOG.warn("Processing finished.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>LOG.warn("Labelling error has occured " + e.getMessage());<NEW_LINE>throw new ZinggClientException(e.getMessage());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} | ).getAs(ColName.PREDICTION_COL); |
463,607 | final SendChannelMessageResult executeSendChannelMessage(SendChannelMessageRequest sendChannelMessageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(sendChannelMessageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SendChannelMessageRequest> request = null;<NEW_LINE>Response<SendChannelMessageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SendChannelMessageRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Chime SDK Messaging");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendChannelMessage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SendChannelMessageResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendChannelMessageResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(sendChannelMessageRequest)); |
376,525 | public void bind(@NonNull final TRow row, @NonNull final View view) {<NEW_LINE>final RecyclerView recyclerView = (RecyclerView) view;<NEW_LINE>final long id = stableId.apply(row);<NEW_LINE>if (!(recyclerView.getAdapter() instanceof RepositoryAdapter)) {<NEW_LINE>final MutableRepository<TRow> newRepository = mutableRepository(row);<NEW_LINE>final RepositoryPresenter<TRow> newPresenter = presenter.apply(row);<NEW_LINE>final RepositoryAdapter newAdapter = repositoryAdapter().add(<MASK><NEW_LINE>recyclerView.setRecycledViewPool(pool);<NEW_LINE>recyclerView.setLayoutManager(layoutManager.apply(row));<NEW_LINE>adapterRepositories.put(newAdapter, newRepository);<NEW_LINE>startedAdapters.add(newAdapter);<NEW_LINE>newAdapter.setHasStableIds(true);<NEW_LINE>recyclerView.setAdapter(newAdapter);<NEW_LINE>recyclerView.addOnScrollListener(this);<NEW_LINE>previousStableIds.put(newAdapter, id);<NEW_LINE>newAdapter.startObserving();<NEW_LINE>} else {<NEW_LINE>final RepositoryAdapter adapter = (RepositoryAdapter) recyclerView.getAdapter();<NEW_LINE>adapterRepositories.get(adapter).accept(row);<NEW_LINE>previousStableIds.put(adapter, id);<NEW_LINE>if (!startedAdapters.contains(adapter)) {<NEW_LINE>adapter.startObserving();<NEW_LINE>startedAdapters.add(adapter);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>recyclerView.getLayoutManager().onRestoreInstanceState(itemRowStates.get(id));<NEW_LINE>} | newRepository, newPresenter).build(); |
356,012 | final ModifyReservedInstancesResult executeModifyReservedInstances(ModifyReservedInstancesRequest modifyReservedInstancesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyReservedInstancesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyReservedInstancesRequest> request = null;<NEW_LINE>Response<ModifyReservedInstancesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyReservedInstancesRequestMarshaller().marshall(super.beforeMarshalling(modifyReservedInstancesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ModifyReservedInstancesResult> responseHandler = new StaxResponseHandler<ModifyReservedInstancesResult>(new ModifyReservedInstancesResultStaxUnmarshaller());<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, "ModifyReservedInstances"); |
230,897 | private Stream<SimilarityResult> similarityParallelStreamTopK(T[] inputs, int[] sourceIndexIds, int[] targetIndexIds, int length, TerminationFlag terminationFlag, int concurrency, double cutoff, int topK, SimilarityComputer<T> computer, Supplier<RleDecoder> decoderFactory) {<NEW_LINE>Supplier<IntStream> sourceRange = () -> idRange(sourceIndexIds, length);<NEW_LINE>Function<Integer, IntStream> targetRange = targetRange(targetIndexIds, length);<NEW_LINE>int sourceIdsLength = sourceIndexIds.length > 0 ? sourceIndexIds.length : length;<NEW_LINE>int batchSize = ParallelUtil.adjustBatchSize(sourceIdsLength, concurrency, 1);<NEW_LINE>int taskCount = (sourceIdsLength / batchSize) + (sourceIdsLength % batchSize > 0 ? 1 : 0);<NEW_LINE>Collection<SourceTargetTopKTask> tasks = new ArrayList<>(taskCount);<NEW_LINE>int multiplier = batchSize < sourceIdsLength ? batchSize : 1;<NEW_LINE>for (int taskId = 0; taskId < taskCount; taskId++) {<NEW_LINE>tasks.add(new SourceTargetTopKTask<>(batchSize, taskId, multiplier, length, inputs, cutoff, topK, computer, decoderFactory.get(), sourceRange, targetRange));<NEW_LINE>}<NEW_LINE>ParallelUtil.runWithConcurrency(concurrency, tasks, terminationFlag, Pools.DEFAULT);<NEW_LINE>TopKConsumer<SimilarityResult>[] topKConsumers = TopKConsumer.initializeTopKConsumers(length, topK);<NEW_LINE>for (Runnable task : tasks) ((SourceTargetTopKTask<MASK><NEW_LINE>return Arrays.stream(topKConsumers).flatMap(TopKConsumer::stream);<NEW_LINE>} | ) task).mergeInto(topKConsumers); |
1,228,627 | // </editor-fold>//GEN-END:initComponents<NEW_LINE>private void jButtonBrowsePortActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_jButtonBrowsePortActionPerformed<NEW_LINE>Node root = new WsdlNode(wsdlModel);<NEW_LINE>PortChooser chooser = new PortChooser(root);<NEW_LINE>// NOI18N<NEW_LINE>final DialogDescriptor dd = new DialogDescriptor(chooser, org.openide.util.NbBundle.getMessage(WebServiceFromWSDLPanel.class, "TTL_SelectPort"));<NEW_LINE>chooser.addPropertyChangeListener(new PropertyChangeListener() {<NEW_LINE><NEW_LINE>public void propertyChange(PropertyChangeEvent evt) {<NEW_LINE>if (evt.getPropertyName().equals(PortChooser.IS_VALID)) {<NEW_LINE>Object newvalue = evt.getNewValue();<NEW_LINE>if ((newvalue != null) && (newvalue instanceof Boolean)) {<NEW_LINE>dd.setValid(((Boolean) newvalue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Object result = DialogDisplayer.getDefault().notify(dd);<NEW_LINE>if (result == DialogDescriptor.OK_OPTION) {<NEW_LINE>if (ProjectUtil.isJavaEE5orHigher(project) || jaxWsInJ2ee14Supported || (!jsr109Supported && !jsr109oldSupported || (!jsr109Supported && jsr109oldSupported))) {<NEW_LINE>String portOwnerName = chooser.getSelectedPortOwnerName();<NEW_LINE>if (portOwnerName != null) {<NEW_LINE>// NOI18N<NEW_LINE>jTextFieldPort.setText(portOwnerName + "#" + chooser.getSelectedNodes()[0].getDisplayName());<NEW_LINE>service = wsdlModel.getServiceByName(portOwnerName);<NEW_LINE>port = service.getPortByName(chooser.getSelectedNodes()<MASK><NEW_LINE>if (wsdlHandler != null) {<NEW_LINE>String bindingType = wsdlHandler.getBindingTypeForPort(port.getName());<NEW_LINE>if (bindingType != null) {<NEW_LINE>port.setSOAPVersion(bindingType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>fireChange();<NEW_LINE>}<NEW_LINE>} | [0].getDisplayName()); |
491,351 | public void onError(Exception e) {<NEW_LINE>byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;<NEW_LINE>org.apache.thrift.TBase msg;<NEW_LINE>fetchRequest_result result = new fetchRequest_result();<NEW_LINE>if (e instanceof AuthorizationException) {<NEW_LINE>result.aze = (AuthorizationException) e;<NEW_LINE>result.set_aze_isSet(true);<NEW_LINE>msg = result;<NEW_LINE>} else {<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>fcall.sendResponse(fb, msg, msgType, seqid);<NEW_LINE>return;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.error("Exception writing to internal frame buffer", ex);<NEW_LINE>}<NEW_LINE>fb.close();<NEW_LINE>} | INTERNAL_ERROR, e.getMessage()); |
1,759,666 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player targetPlayer = game.getPlayer(targetPointer<MASK><NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>MageObject sourceObject = game.getObject(source);<NEW_LINE>String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);<NEW_LINE>if (targetPlayer != null && controller != null && sourceObject != null && cardName != null) {<NEW_LINE>boolean hasDiscarded = false;<NEW_LINE>for (Card card : targetPlayer.getHand().getCards(game)) {<NEW_LINE>if (CardUtil.haveSameNames(card, cardName, game)) {<NEW_LINE>targetPlayer.discard(card, false, source, game);<NEW_LINE>hasDiscarded = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!hasDiscarded) {<NEW_LINE>controller.drawCards(1, source, game);<NEW_LINE>}<NEW_LINE>controller.lookAtCards(sourceObject.getName() + " Hand", targetPlayer.getHand(), game);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .getFirst(game, source)); |
1,488,153 | protected void addStaticTiles(FileHandle tmxFile, ImageResolver imageResolver, TiledMapTileSet tileSet, Element element, Array<Element> tileElements, String name, int firstgid, int tilewidth, int tileheight, int spacing, int margin, String source, int offsetX, int offsetY, String imageSource, int imageWidth, int imageHeight, FileHandle image) {<NEW_LINE>TextureAtlas atlas = atlasResolver.getAtlas();<NEW_LINE>String regionsName = name;<NEW_LINE>for (Texture texture : atlas.getTextures()) {<NEW_LINE>trackedTextures.add(texture);<NEW_LINE>}<NEW_LINE>MapProperties props = tileSet.getProperties();<NEW_LINE>props.put("imagesource", imageSource);<NEW_LINE>props.put("imagewidth", imageWidth);<NEW_LINE>props.put("imageheight", imageHeight);<NEW_LINE>props.put("tilewidth", tilewidth);<NEW_LINE>props.put("tileheight", tileheight);<NEW_LINE>props.put("margin", margin);<NEW_LINE>props.put("spacing", spacing);<NEW_LINE>if (imageSource != null && imageSource.length() > 0) {<NEW_LINE>int lastgid = firstgid + ((imageWidth / tilewidth) * (imageHeight / tileheight)) - 1;<NEW_LINE>for (AtlasRegion region : atlas.findRegions(regionsName)) {<NEW_LINE>// Handle unused tileIds<NEW_LINE>if (region != null) {<NEW_LINE>int tileId = firstgid + region.index;<NEW_LINE>if (tileId >= firstgid && tileId <= lastgid) {<NEW_LINE>addStaticTiledMapTile(tileSet, region, tileId, offsetX, offsetY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Add tiles with individual image sources<NEW_LINE>for (Element tileElement : tileElements) {<NEW_LINE>int tileId = firstgid + <MASK><NEW_LINE>TiledMapTile tile = tileSet.getTile(tileId);<NEW_LINE>if (tile == null) {<NEW_LINE>Element imageElement = tileElement.getChildByName("image");<NEW_LINE>if (imageElement != null) {<NEW_LINE>String regionName = imageElement.getAttribute("source");<NEW_LINE>regionName = regionName.substring(0, regionName.lastIndexOf('.'));<NEW_LINE>AtlasRegion region = atlas.findRegion(regionName);<NEW_LINE>if (region == null)<NEW_LINE>throw new GdxRuntimeException("Tileset atlasRegion not found: " + regionName);<NEW_LINE>addStaticTiledMapTile(tileSet, region, tileId, offsetX, offsetY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | tileElement.getIntAttribute("id", 0); |
434,349 | protected void addCovariantMethods(ClassNode classNode) {<NEW_LINE>Map methodsToAdd = new HashMap();<NEW_LINE>Map genericsSpec = new HashMap();<NEW_LINE>// unimplemented abstract methods from interfaces<NEW_LINE>Map<String, MethodNode> abstractMethods = ClassNodeUtils.getDeclaredMethodsFromInterfaces(classNode);<NEW_LINE>Map<String, MethodNode> allInterfaceMethods = new HashMap<String, MethodNode>(abstractMethods);<NEW_LINE>ClassNodeUtils.addDeclaredMethodsFromAllInterfaces(classNode, allInterfaceMethods);<NEW_LINE>List<MethodNode> declaredMethods = new ArrayList<MethodNode>(classNode.getMethods());<NEW_LINE>// remove all static, private and package private methods<NEW_LINE>for (Iterator methodsIterator = declaredMethods.iterator(); methodsIterator.hasNext(); ) {<NEW_LINE>MethodNode m = (MethodNode) methodsIterator.next();<NEW_LINE>abstractMethods.remove(m.getTypeDescriptor());<NEW_LINE>if (m.isStatic() || !(m.isPublic() || m.isProtected())) {<NEW_LINE>methodsIterator.remove();<NEW_LINE>}<NEW_LINE>MethodNode intfMethod = allInterfaceMethods.get(m.getTypeDescriptor());<NEW_LINE>if (intfMethod != null && ((m.getModifiers() & ACC_SYNTHETIC) == 0) && !m.isPublic() && !m.isStaticConstructor()) {<NEW_LINE>throw new RuntimeParserException("The method " + m.getName() + " should be public as it implements the corresponding method from interface " + intfMethod.getDeclaringClass(), sourceOf(m));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addCovariantMethods(classNode, declaredMethods, abstractMethods, methodsToAdd, genericsSpec);<NEW_LINE>Map<String, MethodNode> declaredMethodsMap = new HashMap<String, MethodNode>();<NEW_LINE>if (!methodsToAdd.isEmpty()) {<NEW_LINE>for (MethodNode mn : declaredMethods) {<NEW_LINE>declaredMethodsMap.put(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Object o : methodsToAdd.entrySet()) {<NEW_LINE>Map.Entry entry = (Map.Entry) o;<NEW_LINE>MethodNode method = (MethodNode) entry.getValue();<NEW_LINE>// we skip bridge methods implemented in current class already<NEW_LINE>MethodNode mn = declaredMethodsMap.get(entry.getKey());<NEW_LINE>if (mn != null && mn.getDeclaringClass().equals(classNode))<NEW_LINE>continue;<NEW_LINE>addPropertyMethod(method);<NEW_LINE>}<NEW_LINE>} | mn.getTypeDescriptor(), mn); |
1,319,705 | public String upsertSchemaType(String userId, SchemaType schemaType, String externalSourceName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException {<NEW_LINE>final String methodName = "upsertSchemaType";<NEW_LINE>invalidParameterHandler.validateUserId(userId, methodName);<NEW_LINE>invalidParameterHandler.validateName(schemaType.getQualifiedName(), QUALIFIED_NAME_PROPERTY_NAME, methodName);<NEW_LINE>invalidParameterHandler.validateName(schemaType.<MASK><NEW_LINE>Optional<EntityDetail> originalSchemaTypeEntity = findSchemaTypeEntity(userId, schemaType.getQualifiedName());<NEW_LINE>SchemaTypeBuilder schemaTypeBuilder = getSchemaTypeBuilder(schemaType);<NEW_LINE>String externalSourceGUID = dataEngineRegistrationHandler.getExternalDataEngine(userId, externalSourceName);<NEW_LINE>String schemaTypeGUID;<NEW_LINE>if (originalSchemaTypeEntity.isEmpty()) {<NEW_LINE>schemaTypeGUID = schemaTypeHandler.addSchemaType(userId, externalSourceGUID, externalSourceName, schemaTypeBuilder, methodName);<NEW_LINE>} else {<NEW_LINE>schemaTypeGUID = originalSchemaTypeEntity.get().getGUID();<NEW_LINE>EntityDetail updatedSchemaTypeEntity = buildSchemaTypeEntityDetail(schemaTypeGUID, schemaType);<NEW_LINE>EntityDetailDifferences entityDetailDifferences = repositoryHelper.getEntityDetailDifferences(originalSchemaTypeEntity.get(), updatedSchemaTypeEntity, true);<NEW_LINE>if (entityDetailDifferences.hasInstancePropertiesDifferences()) {<NEW_LINE>schemaTypeHandler.updateSchemaType(userId, externalSourceGUID, externalSourceName, schemaTypeGUID, SCHEMA_TYPE_GUID_PARAMETER_NAME, schemaTypeBuilder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dataEngineSchemaAttributeHandler.upsertSchemaAttributes(userId, schemaType.getAttributeList(), externalSourceName, externalSourceGUID, schemaTypeGUID);<NEW_LINE>return schemaTypeGUID;<NEW_LINE>} | getDisplayName(), DISPLAY_NAME_PROPERTY_NAME, methodName); |
247,064 | public void testProducerRecordTopic() {<NEW_LINE>String topicIn = ProducerRecordBean.CHANNEL_IN;<NEW_LINE>String expectedTopicOut = ProducerRecordBean.PRODUCER_RECORD_TOPIC;<NEW_LINE>String unexpectedTopicOut = ProducerRecordBean.CONFIGURED_TOPIC;<NEW_LINE>String keyOut = ProducerRecordBean.PRODUCER_RECORD_KEY;<NEW_LINE>String valueOut = ProducerRecordBean.PRODUCER_RECORD_VALUE;<NEW_LINE>KafkaWriter<String, String> writer = kafkaTestClient.writerFor(topicIn);<NEW_LINE>// this value doesn't matter<NEW_LINE>String value = "hello";<NEW_LINE>writer.sendMessage(value);<NEW_LINE>KafkaReader<String, String> reader = kafkaTestClient.readerFor(expectedTopicOut);<NEW_LINE>List<ConsumerRecord<String, String>> expectedRecords = reader.readRecords(1, KafkaTestConstants.DEFAULT_KAFKA_TIMEOUT);<NEW_LINE><MASK><NEW_LINE>List<ConsumerRecord<String, String>> unexpectedRecords = reader.readRecords(1, KafkaTestConstants.EXPECTED_FAILURE_KAFKA_TIMEOUT);<NEW_LINE>if (expectedRecords.size() == 1) {<NEW_LINE>if (unexpectedRecords.size() != 0) {<NEW_LINE>fail("Message may have been sent to more than one topic???");<NEW_LINE>} else {<NEW_LINE>ConsumerRecord<String, String> record = expectedRecords.get(0);<NEW_LINE>assertEquals(keyOut, record.key());<NEW_LINE>assertEquals(valueOut, record.value());<NEW_LINE>assertEquals(expectedTopicOut, record.topic());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (unexpectedRecords.size() == 0) {<NEW_LINE>fail("Message not found on any topic");<NEW_LINE>} else {<NEW_LINE>fail("Message was sent to wrong topic: " + unexpectedTopicOut);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | reader = kafkaTestClient.readerFor(unexpectedTopicOut); |
1,425,450 | protected void initializeRootMessage() throws IOException {<NEW_LINE>contentType = (String) message.get(Message.CONTENT_TYPE);<NEW_LINE>if (contentType == null) {<NEW_LINE>throw new IllegalStateException("Content-Type can not be empty!");<NEW_LINE>}<NEW_LINE>if (message.getContent(InputStream.class) == null) {<NEW_LINE>throw new IllegalStateException("An InputStream must be provided!");<NEW_LINE>}<NEW_LINE>if (AttachmentUtil.isTypeSupported(contentType.toLowerCase(), supportedTypes)) {<NEW_LINE>String boundaryString = findBoundaryFromContentType(contentType);<NEW_LINE>if (null == boundaryString) {<NEW_LINE>boundaryString = findBoundaryFromInputStream();<NEW_LINE>}<NEW_LINE>// If a boundary still wasn't found, throw an exception<NEW_LINE>if (null == boundaryString) {<NEW_LINE>throw new IOException("Couldn't determine the boundary from the message!");<NEW_LINE>}<NEW_LINE>boundary = boundaryString.getBytes("utf-8");<NEW_LINE>stream = new PushbackInputStream(message.getContent(InputStream.class), pbAmount);<NEW_LINE>if (!readTillFirstBoundary(stream, boundary)) {<NEW_LINE>throw new IOException("Couldn't find MIME boundary: " + boundaryString);<NEW_LINE>}<NEW_LINE>Map<String, List<String>> ih = loadPartHeaders(stream);<NEW_LINE>message.put(ATTACHMENT_PART_HEADERS, ih);<NEW_LINE>String val = AttachmentUtil.getHeader(ih, "Content-Type", "; ");<NEW_LINE>if (!StringUtils.isEmpty(val)) {<NEW_LINE>String cs = HttpHeaderHelper.findCharset(val);<NEW_LINE>if (!StringUtils.isEmpty(cs)) {<NEW_LINE>message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>val = AttachmentUtil.getHeader(ih, "Content-Transfer-Encoding");<NEW_LINE>MimeBodyPartInputStream mmps = new MimeBodyPartInputStream(stream, boundary, pbAmount);<NEW_LINE>InputStream ins = AttachmentUtil.decode(mmps, val);<NEW_LINE>if (ins != mmps) {<NEW_LINE>ih.remove("Content-Transfer-Encoding");<NEW_LINE>}<NEW_LINE>body = new DelegatingInputStream(ins, this);<NEW_LINE>createCount++;<NEW_LINE>message.<MASK><NEW_LINE>}<NEW_LINE>} | setContent(InputStream.class, body); |
885,319 | // This method is a modified version of the LinearLayoutManager.findOneVisibleChild().<NEW_LINE>private static View findOneVisibleChildIncludesPadding(LinearLayoutManager lm, int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) {<NEW_LINE>boolean isVertical = (lm.getOrientation() == RecyclerView.VERTICAL);<NEW_LINE>final int start = 0;<NEW_LINE>final int end = (isVertical) ? lm.getHeight() : lm.getWidth();<NEW_LINE>final int next = toIndex > fromIndex ? 1 : -1;<NEW_LINE>View partiallyVisible = null;<NEW_LINE>for (int i = fromIndex; i != toIndex; i += next) {<NEW_LINE>final View child = lm.getChildAt(i);<NEW_LINE>final int childStart = (isVertical) ? child.getTop() : child.getLeft();<NEW_LINE>final int childEnd = (isVertical) ? child.getBottom<MASK><NEW_LINE>if (childStart < end && childEnd > start) {<NEW_LINE>if (completelyVisible) {<NEW_LINE>if (childStart >= start && childEnd <= end) {<NEW_LINE>return child;<NEW_LINE>} else if (acceptPartiallyVisible && partiallyVisible == null) {<NEW_LINE>partiallyVisible = child;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return child;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return partiallyVisible;<NEW_LINE>} | () : child.getRight(); |
164,739 | private void addLocals(StyledDocument doc1, StyledDocument doc2, Function function1, Function function2) {<NEW_LINE>Variable[] vars1 = function1.getLocalVariables();<NEW_LINE>Variable[] vars2 = function2.getLocalVariables();<NEW_LINE>if (ProgramDiff.equivalentVariableArrays(vars1, vars2, false)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>addFrameInfo(doc1, "Local Variables: ", "");<NEW_LINE>addFrameInfo(doc2, "Local Variables: ", "");<NEW_LINE>MultiComparableArrayIterator<Variable> iter = new MultiComparableArrayIterator<>(new Variable[][] { vars1, vars2 });<NEW_LINE>// variables to print to the details for program 1.<NEW_LINE>ArrayList<Variable> varList1 = new ArrayList<>();<NEW_LINE>// variables to print to the details for program 2.<NEW_LINE>ArrayList<Variable> varList2 = new ArrayList<>();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>Variable[] vars = iter.next();<NEW_LINE>Variable var1 = vars[0];<NEW_LINE>Variable var2 = vars[1];<NEW_LINE>if (var1 != null && var2 != null && ProgramDiff.equivalentVariables(var1, var2, true)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (var1 != null) {<NEW_LINE>varList1.add(var1);<NEW_LINE>}<NEW_LINE>if (var2 != null) {<NEW_LINE>varList2.add(var2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ArrayList<Variable> allVarsList = new ArrayList<>(varList1);<NEW_LINE>allVarsList.addAll(varList2);<NEW_LINE>Variable[] printVars1 = varList1.toArray(new Variable<MASK><NEW_LINE>Variable[] printVars2 = varList2.toArray(new Variable[varList2.size()]);<NEW_LINE>Variable[] combinedVars = allVarsList.toArray(new Variable[allVarsList.size()]);<NEW_LINE>VariableLayout varLayout = getVariableLayout(combinedVars);<NEW_LINE>printLocals(doc1, printVars1, varLayout, vars1.length);<NEW_LINE>printLocals(doc2, printVars2, varLayout, vars2.length);<NEW_LINE>} | [varList1.size()]); |
459,826 | private void configureProperties() {<NEW_LINE>PropertyLayout propLayout = find("properties", PropertyLayout.class);<NEW_LINE>propLayout.setOrdering(PropertyOrdering.byLabel());<NEW_LINE>propLayout.clear();<NEW_LINE>WorldConfigurator worldConfig;<NEW_LINE>if (world.getWorldConfigurator() != null) {<NEW_LINE>worldConfig = world.getWorldConfigurator();<NEW_LINE>} else {<NEW_LINE>worldConfig = worldGenerator.getConfigurator();<NEW_LINE>world.setWorldConfigurator(worldConfig);<NEW_LINE>}<NEW_LINE>oldWorldConfig = worldConfig;<NEW_LINE>Map<String, Component> params = worldConfig.getProperties();<NEW_LINE>for (String key : params.keySet()) {<NEW_LINE>Class<? extends Component> clazz = params.get(key).getClass();<NEW_LINE>Component comp = config.getModuleConfig(worldGenerator.getUri(), key, clazz);<NEW_LINE>if (comp != null) {<NEW_LINE>// use the data from the config instead of defaults<NEW_LINE>worldConfig.setProperty(key, comp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ComponentLibrary compLib = <MASK><NEW_LINE>for (String label : params.keySet()) {<NEW_LINE>PropertyProvider provider = new PropertyProvider(context.get(ReflectFactory.class), context.get(OneOfProviderFactory.class)) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected <T> Binding<T> createTextBinding(Object target, FieldMetadata<Object, T> fieldMetadata) {<NEW_LINE>return new WorldSetupScreen.WorldConfigBinding<>(worldConfig, label, compLib, fieldMetadata);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected Binding<Float> createFloatBinding(Object target, FieldMetadata<Object, ?> fieldMetadata) {<NEW_LINE>return new WorldSetupScreen.WorldConfigNumberBinding(worldConfig, label, compLib, fieldMetadata);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Component target = params.get(label);<NEW_LINE>List<Property<?, ?>> properties = provider.createProperties(target);<NEW_LINE>propLayout.addProperties(label, properties);<NEW_LINE>}<NEW_LINE>} | context.get(ComponentLibrary.class); |
420,881 | public static DescribeDedicatedHostsResponse unmarshall(DescribeDedicatedHostsResponse describeDedicatedHostsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDedicatedHostsResponse.setRequestId(_ctx.stringValue("DescribeDedicatedHostsResponse.RequestId"));<NEW_LINE>describeDedicatedHostsResponse.setDedicatedHostGroupId<MASK><NEW_LINE>List<DedicatedHostsItem> dedicatedHosts = new ArrayList<DedicatedHostsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDedicatedHostsResponse.DedicatedHosts.Length"); i++) {<NEW_LINE>DedicatedHostsItem dedicatedHostsItem = new DedicatedHostsItem();<NEW_LINE>dedicatedHostsItem.setHostName(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostName"));<NEW_LINE>dedicatedHostsItem.setHostStatus(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostStatus"));<NEW_LINE>dedicatedHostsItem.setInstanceNumber(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].InstanceNumber"));<NEW_LINE>dedicatedHostsItem.setCPUAllocationRatio(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].CPUAllocationRatio"));<NEW_LINE>dedicatedHostsItem.setMemAllocationRatio(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].MemAllocationRatio"));<NEW_LINE>dedicatedHostsItem.setDiskAllocationRatio(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].DiskAllocationRatio"));<NEW_LINE>dedicatedHostsItem.setVPCId(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].VPCId"));<NEW_LINE>dedicatedHostsItem.setVSwitchId(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].VSwitchId"));<NEW_LINE>dedicatedHostsItem.setZoneId(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].ZoneId"));<NEW_LINE>dedicatedHostsItem.setIPAddress(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].IPAddress"));<NEW_LINE>dedicatedHostsItem.setHostClass(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostClass"));<NEW_LINE>dedicatedHostsItem.setCreatedTime(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].CreatedTime"));<NEW_LINE>dedicatedHostsItem.setDedicatedHostId(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].DedicatedHostId"));<NEW_LINE>dedicatedHostsItem.setAllocationStatus(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].AllocationStatus"));<NEW_LINE>dedicatedHostsItem.setEndTime(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].EndTime"));<NEW_LINE>dedicatedHostsItem.setHostType(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostType"));<NEW_LINE>dedicatedHostsItem.setBastionInstanceId(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].BastionInstanceId"));<NEW_LINE>dedicatedHostsItem.setOpenPermission(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].OpenPermission"));<NEW_LINE>dedicatedHostsItem.setAccountName(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].AccountName"));<NEW_LINE>dedicatedHostsItem.setHostCPU(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostCPU"));<NEW_LINE>dedicatedHostsItem.setHostMem(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostMem"));<NEW_LINE>dedicatedHostsItem.setHostStorage(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].HostStorage"));<NEW_LINE>dedicatedHostsItem.setCpuUsed(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].CpuUsed"));<NEW_LINE>dedicatedHostsItem.setMemoryUsed(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].MemoryUsed"));<NEW_LINE>dedicatedHostsItem.setStorageUsed(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].StorageUsed"));<NEW_LINE>dedicatedHostsItem.setImageCategory(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].ImageCategory"));<NEW_LINE>dedicatedHostsItem.setDedicatedHostGroupId(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].DedicatedHostGroupId"));<NEW_LINE>dedicatedHostsItem.setEngine(_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHosts[" + i + "].Engine"));<NEW_LINE>dedicatedHosts.add(dedicatedHostsItem);<NEW_LINE>}<NEW_LINE>describeDedicatedHostsResponse.setDedicatedHosts(dedicatedHosts);<NEW_LINE>return describeDedicatedHostsResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeDedicatedHostsResponse.DedicatedHostGroupId")); |
97,773 | private static void tryAssertionFour(RegressionEnvironment env, String expression) {<NEW_LINE>env.compileDeploy(expression).addListener("s0");<NEW_LINE>String[] fields = "id,valh0,valh1,valh2".split(",");<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, null);<NEW_LINE>sendBeanInt(env, "E1", 0, 0, 0, 1);<NEW_LINE>Object[][] result = new Object[][] { { "E1", null, null, null } };<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, result);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, result);<NEW_LINE>sendBeanInt(env, "E2", 0, 1, 1, 1);<NEW_LINE>result = new Object[][] { { "E2", null, null, null } };<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, result);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, result);<NEW_LINE>sendBeanInt(env, "E3", 1, 1, 1, 1);<NEW_LINE>result = new Object[][] { { "E3", "H01", "H11", "H21" } };<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, result);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, result);<NEW_LINE>sendBeanInt(env, "E4", 1, 0, 1, 1);<NEW_LINE>result = new Object[][] { { "E4", "H01", null, null } };<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, result);<NEW_LINE>env.<MASK><NEW_LINE>sendBeanInt(env, "E5", 4, 4, 4, 2);<NEW_LINE>result = new Object[][] { { "E5", "H02", "H12", "H22" } };<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, result);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, result);<NEW_LINE>env.undeployAll();<NEW_LINE>} | assertPropsPerRowIteratorAnyOrder("s0", fields, result); |
810,221 | private AttributedGraph createGraph(List<RecoveredClass> recoveredClasses) throws CancelledException {<NEW_LINE>GraphType graphType = new GraphTypeBuilder("Class Hierarchy Graph").vertexType(NO_INHERITANCE).vertexType(SINGLE_INHERITANCE).vertexType(MULTIPLE_INHERITANCE).edgeType(NON_VIRTUAL_INHERITANCE).edgeType(VIRTUAL_INHERITANCE).build();<NEW_LINE>AttributedGraph g = new AttributedGraph("Recovered Classes Graph", graphType);<NEW_LINE>Iterator<RecoveredClass> recoveredClassIterator = recoveredClasses.iterator();<NEW_LINE>while (recoveredClassIterator.hasNext()) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>RecoveredClass recoveredClass = recoveredClassIterator.next();<NEW_LINE>AttributedVertex classVertex = g.addVertex(recoveredClass.getClassPath().getPath(<MASK><NEW_LINE>Map<RecoveredClass, List<RecoveredClass>> classHierarchyMap = recoveredClass.getClassHierarchyMap();<NEW_LINE>// no parent = blue vertex<NEW_LINE>if (classHierarchyMap.isEmpty()) {<NEW_LINE>classVertex.setVertexType(NO_INHERITANCE);<NEW_LINE>classVertex.setDescription(recoveredClass.getClassPath().getPath());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Set<RecoveredClass> parents = classHierarchyMap.keySet();<NEW_LINE>// single parent = green vertex<NEW_LINE>if (parents.size() == 1) {<NEW_LINE>classVertex.setVertexType(SINGLE_INHERITANCE);<NEW_LINE>} else // multiple parents = red vertex<NEW_LINE>{<NEW_LINE>classVertex.setVertexType(MULTIPLE_INHERITANCE);<NEW_LINE>}<NEW_LINE>classVertex.setDescription(recoveredClass.getClassPath().getPath());<NEW_LINE>Map<RecoveredClass, Boolean> parentToBaseTypeMap = recoveredClass.getParentToBaseTypeMap();<NEW_LINE>Iterator<RecoveredClass> parentIterator = parents.iterator();<NEW_LINE>while (parentIterator.hasNext()) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>RecoveredClass parent = parentIterator.next();<NEW_LINE>AttributedVertex parentVertex = g.addVertex(parent.getClassPath().getPath(), parent.getName());<NEW_LINE>parentVertex.setDescription(parent.getClassPath().getPath());<NEW_LINE>AttributedEdge edge = g.addEdge(parentVertex, classVertex);<NEW_LINE>Boolean isVirtualParent = parentToBaseTypeMap.get(parent);<NEW_LINE>if (isVirtualParent == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// edge between child and parent is orange if child inherits the parent virtually<NEW_LINE>if (isVirtualParent) {<NEW_LINE>edge.setEdgeType(VIRTUAL_INHERITANCE);<NEW_LINE>} else {<NEW_LINE>edge.setEdgeType(NON_VIRTUAL_INHERITANCE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return g;<NEW_LINE>} | ), recoveredClass.getName()); |
450,628 | public IMessage onMessage(PacketXpTransferEffects message, MessageContext ctx) {<NEW_LINE>EntityPlayer player = EnderIO.proxy.getClientPlayer();<NEW_LINE>if (player != null) {<NEW_LINE>int particleCount = 5;<NEW_LINE>if (message.swing) {<NEW_LINE>player.swingArm(EnumHand.MAIN_HAND);<NEW_LINE>particleCount += 5;<NEW_LINE>}<NEW_LINE>BlockPos pos = <MASK><NEW_LINE>for (int i = 0; i < particleCount; i++) {<NEW_LINE>float xOffset = 0.1F - player.world.rand.nextFloat() * 1.2F;<NEW_LINE>float yOffset = 0.1F - player.world.rand.nextFloat() * 1.2F;<NEW_LINE>float zOffset = 0.1F - player.world.rand.nextFloat() * 1.2F;<NEW_LINE>Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), pos.getX() + xOffset, pos.getY() + yOffset, pos.getZ() + zOffset, 0.0D, 0.0D, 0.0D);<NEW_LINE>if (fx != null) {<NEW_LINE>fx.setRBGColorF(0.2f, 0.8f, 0.2f);<NEW_LINE>ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | BlockPos.fromLong(message.pos); |
883,935 | private String createDateTimeString(byte[] byteArray) {<NEW_LINE>if (byteArray == null || byteArray.length < 7) {<NEW_LINE>return "INVALID (truncated or missing)";<NEW_LINE>}<NEW_LINE>// Time zone offset from GMT in 15 minute intervals,<NEW_LINE>// starting at interval -48 (west) and running up to<NEW_LINE>// interval 52 (east)<NEW_LINE>int timeOffset = byteArray[byteArray.length - 1];<NEW_LINE>int i1, i2<MASK><NEW_LINE>// Years since 1900<NEW_LINE>i1 = 1900 + byteArray[0];<NEW_LINE>// Month of year<NEW_LINE>i2 = byteArray[1];<NEW_LINE>// Day of month<NEW_LINE>i3 = byteArray[2];<NEW_LINE>// Hour of day<NEW_LINE>i4 = byteArray[3];<NEW_LINE>// Minute of hour<NEW_LINE>i5 = byteArray[4];<NEW_LINE>// Second of minute<NEW_LINE>i6 = byteArray[5];<NEW_LINE>// The buffer contains an invalid timezone offset.<NEW_LINE>boolean validBuffer = true;<NEW_LINE>if (timeOffset < -48 || timeOffset > 52) {<NEW_LINE>validBuffer = false;<NEW_LINE>}<NEW_LINE>// The buffer contains an invalid date/time.<NEW_LINE>try {<NEW_LINE>LocalDateTime.of(i1, i2, i3, i4, i5, i6);<NEW_LINE>} catch (DateTimeException exception) {<NEW_LINE>validBuffer = false;<NEW_LINE>}<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>if (!validBuffer) {<NEW_LINE>builder.append("INVALID (");<NEW_LINE>}<NEW_LINE>int timezoneIntegral = timeOffset / 4;<NEW_LINE>int timezoneFractional = (Math.abs(timeOffset) % 4) * 15;<NEW_LINE>builder.append(String.format("%04d-%02d-%02d %02d:%02d:%02d GMT%c%02d%02d", i1, i2, i3, i4, i5, i6, timezoneIntegral < 0 ? '-' : '+', timezoneIntegral, timezoneFractional));<NEW_LINE>if (!validBuffer) {<NEW_LINE>builder.append(")");<NEW_LINE>}<NEW_LINE>return builder.toString();<NEW_LINE>} | , i3, i4, i5, i6; |
346,529 | public static int purge(AlbumEntryDatabase db, Long albumId, Long photoId) {<NEW_LINE>// purge 1 entry<NEW_LINE>if (albumId != null && photoId != null) {<NEW_LINE>CompoundKey key = new CompoundKey().append("photoId", photoId).append("albumId", albumId);<NEW_LINE>final boolean isRemoved = (db.getData().remove(key) != null);<NEW_LINE>return isRemoved ? 1 : 0;<NEW_LINE>}<NEW_LINE>// purge all<NEW_LINE>if (albumId == null && photoId == null) {<NEW_LINE>final int numPurged = db.getData().size();<NEW_LINE>db.getData().clear();<NEW_LINE>return numPurged;<NEW_LINE>}<NEW_LINE>// purge all matching one of key id, photo id<NEW_LINE>Iterator<CompoundKey> it = db.getData().keySet().iterator();<NEW_LINE>String partName;<NEW_LINE>long compareId;<NEW_LINE>if (albumId != null) {<NEW_LINE>partName = "albumId";<NEW_LINE>compareId = albumId;<NEW_LINE>} else if (photoId != null) {<NEW_LINE>partName = "photoId";<NEW_LINE>compareId = photoId;<NEW_LINE>} else<NEW_LINE>throw new AssertionError();<NEW_LINE>int numPurged = 0;<NEW_LINE>while (it.hasNext()) {<NEW_LINE><MASK><NEW_LINE>if (key.getPart(partName).equals(compareId)) {<NEW_LINE>it.remove();<NEW_LINE>numPurged++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return numPurged;<NEW_LINE>} | CompoundKey key = it.next(); |
1,677,177 | public boolean onTouchEvent(final MotionEvent event) {<NEW_LINE>final CharSequence text = getText();<NEW_LINE>if (!(text instanceof Spannable)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!PrefsUtility.pref_appearance_link_text_clickable()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final Spannable buffer = (Spannable) text;<NEW_LINE>final int action = event.getAction();<NEW_LINE>if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_DOWN) {<NEW_LINE>int x = (int) event.getX();<NEW_LINE>int y = (int) event.getY();<NEW_LINE>x -= getTotalPaddingLeft();<NEW_LINE>y -= getTotalPaddingTop();<NEW_LINE>x += getScrollX();<NEW_LINE>y += getScrollY();<NEW_LINE>final Layout layout = getLayout();<NEW_LINE>final int line = layout.getLineForVertical(y);<NEW_LINE>final int off = layout.getOffsetForHorizontal(line, x);<NEW_LINE>final ClickableSpan[] links = buffer.getSpans(<MASK><NEW_LINE>if (links.length != 0) {<NEW_LINE>if (action == MotionEvent.ACTION_UP) {<NEW_LINE>links[0].onClick(this);<NEW_LINE>} else if (action == MotionEvent.ACTION_DOWN) {<NEW_LINE>Selection.setSelection(buffer, buffer.getSpanStart(links[0]), buffer.getSpanEnd(links[0]));<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>Selection.removeSelection(buffer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | off, off, ClickableSpan.class); |
70,103 | final CancelServiceSoftwareUpdateResult executeCancelServiceSoftwareUpdate(CancelServiceSoftwareUpdateRequest cancelServiceSoftwareUpdateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(cancelServiceSoftwareUpdateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<CancelServiceSoftwareUpdateRequest> request = null;<NEW_LINE>Response<CancelServiceSoftwareUpdateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CancelServiceSoftwareUpdateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(cancelServiceSoftwareUpdateRequest));<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, "OpenSearch");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CancelServiceSoftwareUpdate");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CancelServiceSoftwareUpdateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CancelServiceSoftwareUpdateResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
306,834 | public void encode(SerializationContext context, UaEncoder encoder, ServerDiagnosticsSummaryDataType value) {<NEW_LINE>encoder.writeUInt32("ServerViewCount", value.getServerViewCount());<NEW_LINE>encoder.writeUInt32("CurrentSessionCount", value.getCurrentSessionCount());<NEW_LINE>encoder.writeUInt32("CumulatedSessionCount", value.getCumulatedSessionCount());<NEW_LINE>encoder.writeUInt32("SecurityRejectedSessionCount", value.getSecurityRejectedSessionCount());<NEW_LINE>encoder.writeUInt32(<MASK><NEW_LINE>encoder.writeUInt32("SessionTimeoutCount", value.getSessionTimeoutCount());<NEW_LINE>encoder.writeUInt32("SessionAbortCount", value.getSessionAbortCount());<NEW_LINE>encoder.writeUInt32("CurrentSubscriptionCount", value.getCurrentSubscriptionCount());<NEW_LINE>encoder.writeUInt32("CumulatedSubscriptionCount", value.getCumulatedSubscriptionCount());<NEW_LINE>encoder.writeUInt32("PublishingIntervalCount", value.getPublishingIntervalCount());<NEW_LINE>encoder.writeUInt32("SecurityRejectedRequestsCount", value.getSecurityRejectedRequestsCount());<NEW_LINE>encoder.writeUInt32("RejectedRequestsCount", value.getRejectedRequestsCount());<NEW_LINE>} | "RejectedSessionCount", value.getRejectedSessionCount()); |
169,381 | private String resolveMediaTray(final PrintPackageRequest request) throws PrinterException {<NEW_LINE>final int requiredTrayNo = request.getPrintPackageInfo().getTrayNumber();<NEW_LINE>// 04124 : Tray number 0 is used too. Use -1 for "No tray required".<NEW_LINE>if (requiredTrayNo < 0) {<NEW_LINE>// no tray required<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final PrintService printService = request.getPrintService();<NEW_LINE>final Media[] medias = (Media[]) printService.getSupportedAttributeValues(Media.class, null, null);<NEW_LINE>if (medias == null) {<NEW_LINE>throw new RuntimeException("No media tray '" + requiredTrayNo + "' found for " + printService + ". There are no available trays.");<NEW_LINE>}<NEW_LINE>for (final Media media : medias) {<NEW_LINE>if (media instanceof MediaTray) {<NEW_LINE>final MediaTray mediaTray = (MediaTray) media;<NEW_LINE>if (mediaTray.getValue() == requiredTrayNo) {<NEW_LINE>request.getAttributes().add(mediaTray);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String warningMessage = "No media tray '" + requiredTrayNo + "' found for " + printService + <MASK><NEW_LINE>return warningMessage;<NEW_LINE>} | ". Therefore we won't specify a tray for this print job. Available medias (incl. trays) are: " + Arrays.toString(medias); |
1,270,170 | // Main Method<NEW_LINE>public static void main(String[] args) throws IOException {<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>System.out.println("Enter the number of times you want to calculate Factorial:");<NEW_LINE>int t = sc.nextInt();<NEW_LINE>HashMap<Integer, BigInteger> hashmap = new HashMap<>();<NEW_LINE>int maxKey = -1;<NEW_LINE>for (int i = 0; i < t; i++) {<NEW_LINE><MASK><NEW_LINE>int N = sc.nextInt();<NEW_LINE>if (N >= 0) {<NEW_LINE>// Or BigInteger assigned to ONE<NEW_LINE>BigInteger f = new BigInteger("1");<NEW_LINE>// Multiply f with number till N<NEW_LINE>int initial = 2;<NEW_LINE>// Checking if inputted number exists in map or not<NEW_LINE>if (hashmap.containsKey(N)) {<NEW_LINE>f = hashmap.get(N);<NEW_LINE>} else {<NEW_LINE>// For a given number, Checking whether any sub factorial has some element present in hashmap<NEW_LINE>if (maxKey != -1) {<NEW_LINE>initial = maxKey;<NEW_LINE>}<NEW_LINE>for (int j = initial; j <= N; j++) {<NEW_LINE>if (hashmap.containsKey(j)) {<NEW_LINE>f = f.multiply(hashmap.get(j));<NEW_LINE>} else {<NEW_LINE>f = f.multiply(BigInteger.valueOf(j));<NEW_LINE>maxKey = j;<NEW_LINE>hashmap.put(j, f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Factorial of given number is :" + f);<NEW_LINE>} else {<NEW_LINE>System.out.println("Number Should be greater than 0");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.out.println("Enter the value of N:"); |
199,208 | private void doSplit(final KVStateOutputList kvStates) {<NEW_LINE>final byte[] parentKey = this.region.getStartKey();<NEW_LINE>for (final KVState kvState : kvStates) {<NEW_LINE>final KVOperation op = kvState.getOp();<NEW_LINE>final long currentRegionId = op.getCurrentRegionId();<NEW_LINE>final long newRegionId = op.getNewRegionId();<NEW_LINE>final byte[] splitKey = op.getKey();<NEW_LINE>final KVStoreClosure closure = kvState.getDone();<NEW_LINE>try {<NEW_LINE>this.rawKVStore.initFencingToken(parentKey, splitKey);<NEW_LINE>this.storeEngine.doSplit(currentRegionId, newRegionId, splitKey);<NEW_LINE>if (closure != null) {<NEW_LINE>// null on follower<NEW_LINE>closure.setData(Boolean.TRUE);<NEW_LINE>closure.<MASK><NEW_LINE>}<NEW_LINE>} catch (final Throwable t) {<NEW_LINE>LOG.error("Fail to split, regionId={}, newRegionId={}, splitKey={}.", currentRegionId, newRegionId, BytesUtil.toHex(splitKey));<NEW_LINE>setCriticalError(closure, t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | run(Status.OK()); |
109,187 | public void handle(StatisticEntry entry) {<NEW_LINE>synchronized (records) {<NEW_LINE>if (entry instanceof StatisticFrontendSqlEntry) {<NEW_LINE>StatisticFrontendSqlEntry fEntry = ((StatisticFrontendSqlEntry) entry);<NEW_LINE>if (fEntry.getSqlType() == 7) {<NEW_LINE>List<String> tableList = ManagerTableUtil.getTables(fEntry.getSchema(), fEntry.getSql());<NEW_LINE>if (!tableList.isEmpty() && tableList.size() > 1) {<NEW_LINE>Collections.sort(tableList);<NEW_LINE>String tables = String.join(",", tableList);<NEW_LINE>String key = fEntry.getFrontend().getUserId() + "-" + fEntry.getFrontend().getUser() + "-" + tables;<NEW_LINE>Record <MASK><NEW_LINE>boolean isNew = currRecord == null;<NEW_LINE>if (isNew) {<NEW_LINE>checkEliminate();<NEW_LINE>currRecord = new Record(fEntry.getFrontend().getUserId(), fEntry.getFrontend(), tables);<NEW_LINE>}<NEW_LINE>currRecord.addSelect(fEntry.getExaminedRows().longValue(), fEntry.getRows(), fEntry.getDuration());<NEW_LINE>if (isNew) {<NEW_LINE>records.put(key, currRecord);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | currRecord = records.get(key); |
929,845 | private InventoryLineHU toInventoryLineHU(@NonNull final I_M_InventoryLine_HU inventoryLineHURecord, @NonNull final UOMConversionContext uomConversionCtx, @NonNull final UomId targetUomId) {<NEW_LINE>final I_C_UOM uom = uomsRepo.getById(inventoryLineHURecord.getC_UOM_ID());<NEW_LINE>final Quantity qtyInternalUseConv;<NEW_LINE>final Quantity qtyBookConv;<NEW_LINE>final Quantity qtyCountConv;<NEW_LINE>final BigDecimal qtyInternalUseBD = inventoryLineHURecord.getQtyInternalUse();<NEW_LINE>if (qtyInternalUseBD != null && qtyInternalUseBD.signum() != 0) {<NEW_LINE>final Quantity qtyInternalUse = Quantity.of(qtyInternalUseBD, uom);<NEW_LINE>qtyInternalUseConv = convBL.convertQuantityTo(qtyInternalUse, uomConversionCtx, targetUomId);<NEW_LINE>qtyBookConv = null;<NEW_LINE>qtyCountConv = null;<NEW_LINE>} else {<NEW_LINE>final Quantity qtyBook;<NEW_LINE>if (inventoryLineHURecord.getM_HU_ID() > 0) {<NEW_LINE>// refresh bookedQty from HU<NEW_LINE>final ProductId productId = uomConversionCtx.getProductId();<NEW_LINE>final HuId huId = HuId.ofRepoId(inventoryLineHURecord.getM_HU_ID());<NEW_LINE>qtyBook = getFreshBookedQtyFromStorage(productId, targetUomId, huId).orElse(Quantity.zero(uom));<NEW_LINE>} else {<NEW_LINE>qtyBook = Quantity.of(inventoryLineHURecord.getQtyBook(), uom);<NEW_LINE>}<NEW_LINE>final Quantity qtyCount = Quantity.of(inventoryLineHURecord.getQtyCount(), uom);<NEW_LINE>qtyInternalUseConv = null;<NEW_LINE>qtyBookConv = convBL.<MASK><NEW_LINE>qtyCountConv = convBL.convertQuantityTo(qtyCount, uomConversionCtx, targetUomId);<NEW_LINE>}<NEW_LINE>return InventoryLineHU.builder().id(extractInventoryLineHUId(inventoryLineHURecord)).qtyInternalUse(qtyInternalUseConv).qtyBook(qtyBookConv).qtyCount(qtyCountConv).huId(HuId.ofRepoIdOrNull(inventoryLineHURecord.getM_HU_ID())).build();<NEW_LINE>} | convertQuantityTo(qtyBook, uomConversionCtx, targetUomId); |
5,487 | public void execute(EditorAdaptor editorAdaptor, int count) throws CommandExecutionException {<NEW_LINE>editorAdaptor.getHistory().beginCompoundChange();<NEW_LINE>TextContent modelContent = editorAdaptor.getModelContent();<NEW_LINE>String editorNewline = editorAdaptor.getConfiguration().getNewLine();<NEW_LINE>String text = editorAdaptor.getRegisterManager().getLastEditRegister().getContent().getText();<NEW_LINE>int pos = editorAdaptor.getPosition().getModelOffset();<NEW_LINE>if (count == NO_COUNT_GIVEN) {<NEW_LINE>count = 1;<NEW_LINE>}<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>int start = 0;<NEW_LINE>for (int i = 0; i < text.length(); i++) {<NEW_LINE>char c = text.charAt(i);<NEW_LINE>if (VimUtils.isNewLine(String.valueOf(c))) {<NEW_LINE>String replace = text.substring(start, i);<NEW_LINE>String nl = text.substring(i);<NEW_LINE>NewLine newline = NewLine.parse(nl);<NEW_LINE>replace(modelContent, pos, replace);<NEW_LINE>modelContent.replace(pos + replace.length(), 0, editorNewline);<NEW_LINE>i += newline.nl.length() - 1;<NEW_LINE>pos += replace.length() + editorNewline.length();<NEW_LINE>start += replace.length() + newline.nl.length();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String replace = text.substring(start);<NEW_LINE>replace(modelContent, pos, replace);<NEW_LINE>// prepare for next iteration if count defined<NEW_LINE>pos += text.length();<NEW_LINE>}<NEW_LINE>editorAdaptor<MASK><NEW_LINE>} | .getHistory().endCompoundChange(); |
174,589 | final DescribeIdentityUsageResult executeDescribeIdentityUsage(DescribeIdentityUsageRequest describeIdentityUsageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeIdentityUsageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeIdentityUsageRequest> request = null;<NEW_LINE>Response<DescribeIdentityUsageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeIdentityUsageRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeIdentityUsageRequest));<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, "Cognito Sync");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeIdentityUsage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeIdentityUsageResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new DescribeIdentityUsageResultJsonUnmarshaller()); |
861,113 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see com.impetus.client.cassandra.CassandraClientBase#delete(java.lang.Object, java.lang.Object)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void delete(Object entity, Object pKey) {<NEW_LINE>EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());<NEW_LINE>MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());<NEW_LINE>AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz());<NEW_LINE>// For secondary tables.<NEW_LINE>List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation()).getSecondaryTablesName();<NEW_LINE>secondaryTables.<MASK><NEW_LINE>for (String tableName : secondaryTables) {<NEW_LINE>this.execute(onDeleteQuery(m, tableName, metaModel, pKey), null);<NEW_LINE>}<NEW_LINE>} | add(m.getTableName()); |
599,770 | private static void processMPT1327(ChannelMapModel channelMapModel, Channel channel, List<Module> modules, AliasList aliasList, ChannelType channelType, DecodeConfigMPT1327 decodeConfig) {<NEW_LINE>DecodeConfigMPT1327 mptConfig = decodeConfig;<NEW_LINE>ChannelMap channelMap = channelMapModel.getChannelMap(mptConfig.getChannelMapName());<NEW_LINE>Sync sync = mptConfig.getSync();<NEW_LINE>modules.add(new MPT1327Decoder(sync));<NEW_LINE>final int callTimeoutMilliseconds = mptConfig.getCallTimeoutSeconds() * 1000;<NEW_LINE>// Set max segment audio sample length slightly above call timeout to<NEW_LINE>// not create a new segment if the processing chain finishes a bit after<NEW_LINE>// actual call timeout.<NEW_LINE>long maxAudioSegmentLengthMillis = (callTimeoutMilliseconds + 5000);<NEW_LINE>modules.add(new AudioModule(aliasList, AbstractAudioModule.DEFAULT_TIMESLOT, maxAudioSegmentLengthMillis));<NEW_LINE>SourceType sourceType = channel.getSourceConfiguration().getSourceType();<NEW_LINE>if (sourceType == SourceType.TUNER || sourceType == SourceType.TUNER_MULTIPLE_FREQUENCIES) {<NEW_LINE>modules.add(new FMDemodulatorModule(FM_CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));<NEW_LINE>}<NEW_LINE>if (channelType == ChannelType.STANDARD) {<NEW_LINE>MPT1327TrafficChannelManager trafficChannelManager = new MPT1327TrafficChannelManager(channel, channelMap);<NEW_LINE>modules.add(trafficChannelManager);<NEW_LINE>modules.add(new MPT1327DecoderState(trafficChannelManager, channelType, callTimeoutMilliseconds));<NEW_LINE>} else {<NEW_LINE>modules.add(new MPT1327DecoderState(channelType, callTimeoutMilliseconds));<NEW_LINE>}<NEW_LINE>// Add a channel rotation monitor when we have multiple control channel frequencies specified<NEW_LINE>if (channel.getSourceConfiguration() instanceof SourceConfigTunerMultipleFrequency && ((SourceConfigTunerMultipleFrequency) channel.getSourceConfiguration()).hasMultipleFrequencies()) {<NEW_LINE>List<State> activeStates = new ArrayList<>();<NEW_LINE>activeStates.add(State.CONTROL);<NEW_LINE>modules.add(new ChannelRotationMonitor(activeStates, ((SourceConfigTunerMultipleFrequency) channel.getSourceConfiguration(<MASK><NEW_LINE>}<NEW_LINE>} | )).getFrequencyRotationDelay())); |
871,971 | public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) throws Exception {<NEW_LINE>final String[] urlParts = checkSyntax(iRequest.getUrl(), 3, "Syntax error: index/<database>/<index-name>/<key>[/<value>]");<NEW_LINE>iRequest.getData().commandInfo = "Index put";<NEW_LINE>ODatabaseDocumentInternal db = null;<NEW_LINE>try {<NEW_LINE>db = getProfiledDatabaseInstance(iRequest);<NEW_LINE>final OIndex index = db.getMetadata().getIndexManagerInternal().getIndex(db, urlParts[2]);<NEW_LINE>if (index == null)<NEW_LINE>throw new IllegalArgumentException("Index name '" + urlParts[2] + "' not found");<NEW_LINE>final OIdentifiable record;<NEW_LINE>if (urlParts.length > 4)<NEW_LINE>// GET THE RECORD ID AS VALUE<NEW_LINE>record = new ORecordId(urlParts[4]);<NEW_LINE>else {<NEW_LINE>// GET THE REQUEST CONTENT AS DOCUMENT<NEW_LINE>if (iRequest.getContent() == null || iRequest.getContent().length() == 0)<NEW_LINE>throw new IllegalArgumentException("Index's entry value is null");<NEW_LINE>record = new ODocument().fromJSON(iRequest.getContent());<NEW_LINE>}<NEW_LINE>final OIndexDefinition indexDefinition = index.getDefinition();<NEW_LINE>final Object key;<NEW_LINE>if (indexDefinition != null)<NEW_LINE>key = indexDefinition.createValue(urlParts[3]);<NEW_LINE>else<NEW_LINE>key = urlParts[3];<NEW_LINE>if (key == null)<NEW_LINE>throw new IllegalArgumentException("Invalid key value : " + urlParts[3]);<NEW_LINE>final boolean existent = record<MASK><NEW_LINE>if (existent && record instanceof ORecord)<NEW_LINE>((ORecord) record).save();<NEW_LINE>index.put(key, record);<NEW_LINE>if (existent)<NEW_LINE>iResponse.send(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN, null, null);<NEW_LINE>else<NEW_LINE>iResponse.send(OHttpUtils.STATUS_CREATED_CODE, OHttpUtils.STATUS_CREATED_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN, null, null);<NEW_LINE>} finally {<NEW_LINE>if (db != null)<NEW_LINE>db.close();<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .getIdentity().isPersistent(); |
1,395,461 | public IRubyObject to_s() {<NEW_LINE>final Ruby runtime = metaClass.runtime;<NEW_LINE>if (Double.isInfinite(value)) {<NEW_LINE>return RubyString.newString(runtime, <MASK><NEW_LINE>}<NEW_LINE>if (Double.isNaN(value)) {<NEW_LINE>return RubyString.newString(runtime, "NaN");<NEW_LINE>}<NEW_LINE>ByteList buf = new ByteList();<NEW_LINE>// Under 1.9, use full-precision float formatting (JRUBY-4846).<NEW_LINE>// Double-precision can represent around 16 decimal digits;<NEW_LINE>// we use 20 to ensure full representation.<NEW_LINE>Sprintf.sprintf(buf, Locale.US, "%#.20g", this);<NEW_LINE>int e = buf.indexOf('e');<NEW_LINE>if (e == -1)<NEW_LINE>e = buf.getRealSize();<NEW_LINE>ASCIIEncoding ascii = ASCIIEncoding.INSTANCE;<NEW_LINE>if (!ascii.isDigit(buf.get(e - 1))) {<NEW_LINE>buf.setRealSize(0);<NEW_LINE>Sprintf.sprintf(buf, Locale.US, "%#.14e", this);<NEW_LINE>e = buf.indexOf('e');<NEW_LINE>if (e == -1)<NEW_LINE>e = buf.getRealSize();<NEW_LINE>}<NEW_LINE>int p = e;<NEW_LINE>while (buf.get(p - 1) == '0' && ascii.isDigit(buf.get(p - 2))) p--;<NEW_LINE>System.arraycopy(buf.getUnsafeBytes(), e, buf.getUnsafeBytes(), p, buf.getRealSize() - e);<NEW_LINE>buf.setRealSize(p + buf.getRealSize() - e);<NEW_LINE>buf.setEncoding(USASCIIEncoding.INSTANCE);<NEW_LINE>return runtime.newString(buf);<NEW_LINE>} | value < 0 ? "-Infinity" : "Infinity"); |
1,493,661 | final PutAccountSendingAttributesResult executePutAccountSendingAttributes(PutAccountSendingAttributesRequest putAccountSendingAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putAccountSendingAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutAccountSendingAttributesRequest> request = null;<NEW_LINE>Response<PutAccountSendingAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutAccountSendingAttributesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putAccountSendingAttributesRequest));<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, "SESv2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutAccountSendingAttributes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutAccountSendingAttributesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutAccountSendingAttributesResultJsonUnmarshaller());<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,730,960 | public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {<NEW_LINE>TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "mult");<NEW_LINE>final String sourceRegister1 = instruction.getOperands().get(0).getRootNode().getChildren().get(0).getValue();<NEW_LINE>final String sourceRegister2 = instruction.getOperands().get(1).getRootNode().getChildren().get(0).getValue();<NEW_LINE>final OperandSize dw = OperandSize.DWORD;<NEW_LINE>final OperandSize qw = OperandSize.QWORD;<NEW_LINE>final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();<NEW_LINE>long offset = baseOffset;<NEW_LINE>final String tempResult = environment.getNextVariableString();<NEW_LINE>final String temporaryHiResult = environment.getNextVariableString();<NEW_LINE>Helpers.signedMul(offset, environment, instructions, dw, sourceRegister1, dw, sourceRegister2, qw, tempResult);<NEW_LINE>offset = baseOffset + instructions.size();<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset++, qw, tempResult, dw, String.valueOf(0xFFFFFFFFL), dw, "LO"));<NEW_LINE>instructions.add(ReilHelpers.createBsh(offset++, qw, tempResult, dw, String.valueOf(-<MASK><NEW_LINE>instructions.add(ReilHelpers.createAnd(offset, dw, temporaryHiResult, dw, String.valueOf(0xFFFFFFFFL), dw, "HI"));<NEW_LINE>} | 32L), dw, temporaryHiResult)); |
1,540,855 | private static void addMediaDetails(Context context, MediaStream stream, LinearLayout layout) {<NEW_LINE>if (stream != null) {<NEW_LINE>if (stream.getCodec() != null && stream.getCodec().trim().length() > 0) {<NEW_LINE>String codec = stream.getCodec().equals("dca") || stream.getCodec().equals("DCA") ? "DTS" : stream.getCodec().equals("ac3") || stream.getCodec().equals("AC3") ? "Dolby" : stream.getCodec().toUpperCase();<NEW_LINE>addBlockText(context, layout, codec);<NEW_LINE>addSpacer(context, layout, " ");<NEW_LINE>}<NEW_LINE>if (stream.getChannelLayout() != null && stream.getChannelLayout().trim().length() > 0) {<NEW_LINE>addBlockText(context, layout, stream.<MASK><NEW_LINE>addSpacer(context, layout, " ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getChannelLayout().toUpperCase()); |
558,448 | void canDeleteTagsForResource(final String api, final String id, final String name, final RestDocumentationFilter deleteFilter) throws Exception {<NEW_LINE>final String tag1 = UUID.randomUUID().toString();<NEW_LINE>final String tag2 = UUID.randomUUID().toString();<NEW_LINE>final Set<String> tags = Sets.newHashSet(tag1, tag2);<NEW_LINE>RestAssured.given(this.requestSpecification).contentType(MediaType.APPLICATION_JSON_VALUE).body(GenieObjectMapper.getMapper().writeValueAsBytes(tags)).when().port(this.port).post(api, id).then().statusCode(Matchers.is(HttpStatus<MASK><NEW_LINE>RestAssured.given(this.requestSpecification).filter(deleteFilter).when().port(this.port).delete(api, id).then().statusCode(Matchers.is(HttpStatus.NO_CONTENT.value()));<NEW_LINE>RestAssured.given(this.requestSpecification).when().port(this.port).get(api, id).then().statusCode(Matchers.is(HttpStatus.OK.value())).contentType(Matchers.containsString(MediaType.APPLICATION_JSON_VALUE)).body("$", Matchers.hasSize(2)).body("$", Matchers.hasItem("genie.id:" + id)).body("$", Matchers.hasItem("genie.name:" + name));<NEW_LINE>} | .NO_CONTENT.value())); |
1,248,301 | private void notifyParticipants(final CompilationUnit workingCopy) {<NEW_LINE>IJavaProject javaProject <MASK><NEW_LINE>CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject);<NEW_LINE>if (participants == null)<NEW_LINE>return;<NEW_LINE>final ReconcileContext context = new ReconcileContext(this, workingCopy);<NEW_LINE>for (int i = 0, length = participants.length; i < length; i++) {<NEW_LINE>final CompilationParticipant participant = participants[i];<NEW_LINE>SafeRunner.run(new ISafeRunnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleException(Throwable exception) {<NEW_LINE>if (exception instanceof Error) {<NEW_LINE>// errors are not supposed to be caught<NEW_LINE>throw (Error) exception;<NEW_LINE>} else if (exception instanceof OperationCanceledException)<NEW_LINE>throw (OperationCanceledException) exception;<NEW_LINE>else if (exception instanceof UnsupportedOperationException) {<NEW_LINE>// might want to disable participant as it tried to modify the buffer of the working copy being reconciled<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled");<NEW_LINE>} else<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Util.log(exception, "Exception occurred in reconcile participant");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() throws Exception {<NEW_LINE>participant.reconcile(context);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | = getWorkingCopy().getJavaProject(); |
1,514,526 | private void updateImpl(Context context) {<NEW_LINE>File latestImplApk = mUpdater.getLatest();<NEW_LINE>String md5 = md5File(latestImplApk);<NEW_LINE>if (mLogger.isInfoEnabled()) {<NEW_LINE>mLogger.info("TextUtils.equals(mCurrentImplMd5, md5) : " + (TextUtils.equals(mCurrentImplMd5, md5)));<NEW_LINE>}<NEW_LINE>if (!TextUtils.equals(mCurrentImplMd5, md5)) {<NEW_LINE>HelloImplLoader implLoader <MASK><NEW_LINE>IHelloWorldImpl newImpl = implLoader.load();<NEW_LINE>Bundle state;<NEW_LINE>if (mHelloWorldImpl != null) {<NEW_LINE>state = new Bundle();<NEW_LINE>mHelloWorldImpl.onSaveInstanceState(state);<NEW_LINE>mHelloWorldImpl.onDestroy();<NEW_LINE>} else {<NEW_LINE>state = null;<NEW_LINE>}<NEW_LINE>newImpl.onCreate(state);<NEW_LINE>mHelloWorldImpl = newImpl;<NEW_LINE>mCurrentImplMd5 = md5;<NEW_LINE>}<NEW_LINE>} | = new HelloImplLoader(context, latestImplApk); |
417,258 | public void reportTabletStatus(TInfo info, TCredentials credentials, String serverName, TabletLoadState status, TKeyExtent ttablet) {<NEW_LINE>KeyExtent tablet = KeyExtent.fromThrift(ttablet);<NEW_LINE>switch(status) {<NEW_LINE>case LOAD_FAILURE:<NEW_LINE>Manager.log.<MASK><NEW_LINE>break;<NEW_LINE>case LOADED:<NEW_LINE>manager.nextEvent.event("tablet %s was loaded on %s", tablet, serverName);<NEW_LINE>break;<NEW_LINE>case UNLOADED:<NEW_LINE>manager.nextEvent.event("tablet %s was unloaded from %s", tablet, serverName);<NEW_LINE>break;<NEW_LINE>case UNLOAD_ERROR:<NEW_LINE>Manager.log.error("{} reports unload failed for tablet {}", serverName, tablet);<NEW_LINE>break;<NEW_LINE>case UNLOAD_FAILURE_NOT_SERVING:<NEW_LINE>if (Manager.log.isTraceEnabled()) {<NEW_LINE>Manager.log.trace("{} reports unload failed: not serving tablet, could be a split: {}", serverName, tablet);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case CHOPPED:<NEW_LINE>manager.nextEvent.event("tablet %s chopped", tablet);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | error("{} reports assignment failed for tablet {}", serverName, tablet); |
522,190 | public boolean restoreBackupVolumeAndAttachToVM(final String backedUpVolumeUuid, final Long backupId, final Long vmId) throws Exception {<NEW_LINE>if (StringUtils.isEmpty(backedUpVolumeUuid)) {<NEW_LINE>throw new CloudRuntimeException("Invalid volume ID passed");<NEW_LINE>}<NEW_LINE>final BackupVO backup = backupDao.findById(backupId);<NEW_LINE>if (backup == null) {<NEW_LINE>throw new CloudRuntimeException("Provided backup not found");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>final VMInstanceVO vm = findVmById(vmId);<NEW_LINE>accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);<NEW_LINE>if (vm.getBackupOfferingId() != null) {<NEW_LINE>throw new CloudRuntimeException("The selected VM has backups, cannot restore and attach volume to the VM.");<NEW_LINE>}<NEW_LINE>if (backup.getZoneId() != vm.getDataCenterId()) {<NEW_LINE>throw new CloudRuntimeException("Cross zone backup restoration of volume is not allowed");<NEW_LINE>}<NEW_LINE>final VMInstanceVO vmFromBackup = vmInstanceDao.findByIdIncludingRemoved(backup.getVmId());<NEW_LINE>if (vmFromBackup == null) {<NEW_LINE>throw new CloudRuntimeException("VM reference for the provided VM backup not found");<NEW_LINE>}<NEW_LINE>accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vmFromBackup);<NEW_LINE>Pair<String, String> restoreInfo = getRestoreVolumeHostAndDatastore(vm);<NEW_LINE>String hostIp = restoreInfo.first();<NEW_LINE>String datastoreUuid = restoreInfo.second();<NEW_LINE>LOG.debug("Asking provider to restore volume " + backedUpVolumeUuid + " from backup " + backupId + " (with external ID " + backup.getExternalId() + ") and attach it to VM: " + vm.getUuid());<NEW_LINE>final BackupOffering offering = backupOfferingDao.findByIdIncludingRemoved(backup.getBackupOfferingId());<NEW_LINE>if (offering == null) {<NEW_LINE>throw new CloudRuntimeException("Failed to find VM backup offering");<NEW_LINE>}<NEW_LINE>BackupProvider backupProvider = getBackupProvider(offering.getProvider());<NEW_LINE>Pair<Boolean, String> result = backupProvider.restoreBackedUpVolume(backup, backedUpVolumeUuid, hostIp, datastoreUuid);<NEW_LINE>if (!result.first()) {<NEW_LINE>throw new CloudRuntimeException("Error restoring volume " + backedUpVolumeUuid);<NEW_LINE>}<NEW_LINE>if (!attachVolumeToVM(vm.getDataCenterId(), result.second(), vmFromBackup.getBackupVolumeList(), backedUpVolumeUuid, vm, datastoreUuid, backup)) {<NEW_LINE>throw new CloudRuntimeException("Error attaching volume " + backedUpVolumeUuid + " to VM " + vm.getUuid());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | validateForZone(backup.getZoneId()); |
1,047,889 | public void marshall(AwsCertificateManagerCertificateDetails awsCertificateManagerCertificateDetails, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (awsCertificateManagerCertificateDetails == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getCreatedAt(), CREATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getDomainValidationOptions(), DOMAINVALIDATIONOPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getExtendedKeyUsages(), EXTENDEDKEYUSAGES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getFailureReason(), FAILUREREASON_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getImportedAt(), IMPORTEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getInUseBy(), INUSEBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getIssuedAt(), ISSUEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getIssuer(), ISSUER_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getKeyAlgorithm(), KEYALGORITHM_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getKeyUsages(), KEYUSAGES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getNotAfter(), NOTAFTER_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getNotBefore(), NOTBEFORE_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getOptions(), OPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getRenewalEligibility(), RENEWALELIGIBILITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getRenewalSummary(), RENEWALSUMMARY_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getSerial(), SERIAL_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getSignatureAlgorithm(), SIGNATUREALGORITHM_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getSubject(), SUBJECT_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getSubjectAlternativeNames(), SUBJECTALTERNATIVENAMES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsCertificateManagerCertificateDetails.getType(), TYPE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | awsCertificateManagerCertificateDetails.getDomainName(), DOMAINNAME_BINDING); |
3,114 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>try {<NEW_LINE>final String[] registries = request.getParameterValues("registry");<NEW_LINE>final String[] <MASK><NEW_LINE>final Platform platform = StringUtils.parsePlatform(request.getParameter("platform"));<NEW_LINE>final File file = manager.createBundle(platform, registries, components);<NEW_LINE>String filename = "";<NEW_LINE>for (String name : components) {<NEW_LINE>filename += name.substring(0, name.indexOf(",")) + "_";<NEW_LINE>}<NEW_LINE>filename += platform.toString();<NEW_LINE>if (platform == WINDOWS) {<NEW_LINE>filename += ".exe";<NEW_LINE>} else if (platform.isCompatibleWith(MACOSX)) {<NEW_LINE>filename += ".zip";<NEW_LINE>} else {<NEW_LINE>filename += ".sh";<NEW_LINE>}<NEW_LINE>final OutputStream output = response.getOutputStream();<NEW_LINE>response.setContentType("application/octet-stream");<NEW_LINE>response.setHeader("Content-Disposition", "attachment; filename=" + filename);<NEW_LINE>response.setHeader("Last-Modified", StringUtils.httpFormat(new Date(file.lastModified())));<NEW_LINE>response.setHeader("Accept-Ranges", "bytes");<NEW_LINE>Utils.transfer(request, response, output, file);<NEW_LINE>} catch (ParseException e) {<NEW_LINE>e.printStackTrace(response.getWriter());<NEW_LINE>} catch (ManagerException e) {<NEW_LINE>e.printStackTrace(response.getWriter());<NEW_LINE>}<NEW_LINE>} | components = request.getParameterValues("component"); |
1,195,723 | public Jdbi build(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name) {<NEW_LINE>// Create the instance<NEW_LINE>final Jdbi jdbi = newInstance(dataSource);<NEW_LINE>// Manage the data source that created this instance.<NEW_LINE>environment.lifecycle().manage(dataSource);<NEW_LINE>// Setup the required health checks.<NEW_LINE>final Optional<String> validationQuery = configuration.getValidationQuery();<NEW_LINE>environment.healthChecks().register(name, new JdbiHealthCheck(environment.getHealthCheckExecutorService(), configuration.getValidationQueryTimeout().orElseGet(() -> Duration.seconds(5)), jdbi, validationQuery));<NEW_LINE>// Setup the SQL logger<NEW_LINE>jdbi.setSqlLogger(buildSQLLogger(environment.metrics(), nameStrategy));<NEW_LINE>if (configuration.isAutoCommentsEnabled()) {<NEW_LINE>final TemplateEngine original = jdbi.getConfig(SqlStatements.class).getTemplateEngine();<NEW_LINE>jdbi.<MASK><NEW_LINE>}<NEW_LINE>configure(jdbi);<NEW_LINE>return jdbi;<NEW_LINE>} | setTemplateEngine(new NamePrependingTemplateEngine(original)); |
555,659 | Map<String, Object> prepareParameters(DataFolder df) throws IOException {<NEW_LINE>Map<String, Object> params = new <MASK><NEW_LINE>// side effect: rootLocalName is initialized<NEW_LINE>params.put(PARAM_ROOT_TAG_NS, getRootTag());<NEW_LINE>params.put(PARAM_DOCTYPE, createDoctype());<NEW_LINE>// side effect: nsToPrefix is created<NEW_LINE>params.put(PARAM_NS_DECLS, createNSDeclarations());<NEW_LINE>params.put(PARAM_ENCODING, createEncoding(df));<NEW_LINE>StringBuffer sb = new StringBuffer();<NEW_LINE>if (model.getType() == DocumentModel.SCHEMA) {<NEW_LINE>model.getXMLContentAttributes().setNamespaceToPrefixMap(nsToPrefix);<NEW_LINE>generateXMLBody(model, rootLocalName, sb);<NEW_LINE>modifyRootElementAttrs(sb);<NEW_LINE>}<NEW_LINE>params.put(PARAM_CONTENT, sb.toString());<NEW_LINE>return params;<NEW_LINE>} | HashMap<String, Object>(); |
47,280 | public Parent createContent() {<NEW_LINE>final String[] years = { "2007", "2008", "2009" };<NEW_LINE>final ObservableList<String> categories = FXCollections.<String>observableArrayList(Arrays.asList(years));<NEW_LINE>xAxis = new NumberAxis();<NEW_LINE>yAxis = new CategoryAxis();<NEW_LINE>chart = new BarChart<>(xAxis, yAxis);<NEW_LINE>chart.setTitle("Horizontal Bar Chart Example");<NEW_LINE>yAxis.setLabel("Year");<NEW_LINE>yAxis.setCategories(categories);<NEW_LINE>xAxis.setLabel("Price");<NEW_LINE>// add starting data<NEW_LINE>XYChart.Series<Number, String> series1 = new XYChart.Series<>();<NEW_LINE>series1.setName("Data Series 1");<NEW_LINE>series1.getData().addAll(new XYChart.Data<Number, String>(567, years[0]), new XYChart.Data<Number, String>(1292, years[1]), new XYChart.Data<Number, String>(2180, years[2]));<NEW_LINE>XYChart.Series<Number, String> series2 = new XYChart.Series<>();<NEW_LINE>series2.setName("Data Series 2");<NEW_LINE>series2.getData().addAll(new XYChart.Data<Number, String>(956, years[0]), new XYChart.Data<Number, String>(1665, years[1]), new XYChart.Data<Number, String>(2450, years[2]));<NEW_LINE>XYChart.Series<Number, String> series3 = new XYChart.Series<>();<NEW_LINE>series3.setName("Data Series 3");<NEW_LINE>series3.getData().addAll(new XYChart.Data<Number, String>(800, years[0]), new XYChart.Data<Number, String>(1000, years[1]), new XYChart.Data<Number, String>(<MASK><NEW_LINE>chart.getData().add(series1);<NEW_LINE>chart.getData().add(series2);<NEW_LINE>chart.getData().add(series3);<NEW_LINE>return chart;<NEW_LINE>} | 2800, years[2])); |
1,484,982 | private void initialize(RoleModel role) {<NEW_LINE>ResourceServer server = resourceServer(role);<NEW_LINE>if (server == null) {<NEW_LINE>ClientModel client = getRoleClient(role);<NEW_LINE>server = root.findOrCreateResourceServer(client);<NEW_LINE>}<NEW_LINE>Scope mapRoleScope = mapRoleScope(server);<NEW_LINE>if (mapRoleScope == null) {<NEW_LINE>mapRoleScope = authz.getStoreFactory().getScopeStore().create(server, MAP_ROLE_SCOPE);<NEW_LINE>}<NEW_LINE>Scope mapClientScope = mapClientScope(server);<NEW_LINE>if (mapClientScope == null) {<NEW_LINE>mapClientScope = authz.getStoreFactory().getScopeStore().create(server, MAP_ROLE_CLIENT_SCOPE_SCOPE);<NEW_LINE>}<NEW_LINE>Scope mapCompositeScope = mapCompositeScope(server);<NEW_LINE>if (mapCompositeScope == null) {<NEW_LINE>mapCompositeScope = authz.getStoreFactory().getScopeStore().create(server, MAP_ROLE_COMPOSITE_SCOPE);<NEW_LINE>}<NEW_LINE>String roleResourceName = getRoleResourceName(role);<NEW_LINE>Resource resource = authz.getStoreFactory().getResourceStore().findByName(server, roleResourceName);<NEW_LINE>if (resource == null) {<NEW_LINE>resource = authz.getStoreFactory().getResourceStore().create(server, roleResourceName, server.getClientId());<NEW_LINE>Set<Scope> scopeset = new HashSet<>();<NEW_LINE>scopeset.add(mapClientScope);<NEW_LINE>scopeset.add(mapCompositeScope);<NEW_LINE>scopeset.add(mapRoleScope);<NEW_LINE>resource.updateScopes(scopeset);<NEW_LINE>resource.setType("Role");<NEW_LINE>}<NEW_LINE>Policy mapRolePermission = mapRolePermission(role);<NEW_LINE>if (mapRolePermission == null) {<NEW_LINE>mapRolePermission = Helper.addEmptyScopePermission(authz, server, getMapRolePermissionName(role), resource, mapRoleScope);<NEW_LINE>mapRolePermission.setDecisionStrategy(DecisionStrategy.AFFIRMATIVE);<NEW_LINE>}<NEW_LINE>Policy mapClientScopePermission = mapClientScopePermission(role);<NEW_LINE>if (mapClientScopePermission == null) {<NEW_LINE>mapClientScopePermission = Helper.addEmptyScopePermission(authz, server, getMapClientScopePermissionName<MASK><NEW_LINE>mapClientScopePermission.setDecisionStrategy(DecisionStrategy.AFFIRMATIVE);<NEW_LINE>}<NEW_LINE>Policy mapCompositePermission = mapCompositePermission(role);<NEW_LINE>if (mapCompositePermission == null) {<NEW_LINE>mapCompositePermission = Helper.addEmptyScopePermission(authz, server, getMapCompositePermissionName(role), resource, mapCompositeScope);<NEW_LINE>mapCompositePermission.setDecisionStrategy(DecisionStrategy.AFFIRMATIVE);<NEW_LINE>}<NEW_LINE>} | (role), resource, mapClientScope); |
108,156 | public void main() {<NEW_LINE>RFloat gShadowValue = (RFloat) getGlobal(DefaultShaderVar.G_SHADOW_VALUE);<NEW_LINE>RVec4 color = (RVec4) getGlobal(DefaultShaderVar.G_COLOR);<NEW_LINE>RVec3 ambientColor = (RVec3) getGlobal(LightsShaderVar.G_AMBIENT_COLOR);<NEW_LINE>RVec3 eyeDir = (<MASK><NEW_LINE>RVec3 normal = (RVec3) getGlobal(DefaultShaderVar.G_NORMAL);<NEW_LINE>RVec3 viewDir = new RVec3("viewDir");<NEW_LINE>viewDir.assign(normalize(eyeDir.multiply(-1)));<NEW_LINE>RFloat NdotV = new RFloat("NdotV");<NEW_LINE>NdotV.assign(clamp(dot(normal, viewDir), 0, 1));<NEW_LINE>RFloat sinNV = new RFloat("sinNV");<NEW_LINE>sinNV.assign("sqrt(1.0 - NdotV * NdotV)");<NEW_LINE>RVec3 diffuse = new RVec3("diffuse");<NEW_LINE>diffuse.assign(0);<NEW_LINE>RFloat power = new RFloat("power");<NEW_LINE>power.assign(0.0f);<NEW_LINE>RFloat roughness2 = new RFloat("roughness2");<NEW_LINE>roughness2.assign(mRoughness * mRoughness);<NEW_LINE>RFloat A = new RFloat("A");<NEW_LINE>A.assign("1.0 - 0.5 * roughness2 / (roughness2 + 0.33)");<NEW_LINE>RFloat B = new RFloat("B");<NEW_LINE>B.assign("0.45 * roughness2 / (roughness2 + 0.09)");<NEW_LINE>for (int i = 0; i < mLights.size(); i++) {<NEW_LINE>RFloat attenuation = (RFloat) getGlobal(LightsShaderVar.V_LIGHT_ATTENUATION, i);<NEW_LINE>RFloat lightPower = (RFloat) getGlobal(LightsShaderVar.U_LIGHT_POWER, i);<NEW_LINE>RVec3 lightColor = (RVec3) getGlobal(LightsShaderVar.U_LIGHT_COLOR, i);<NEW_LINE>RVec3 lightDir = new RVec3("lightDir" + i);<NEW_LINE>RFloat NdotL = mgNdotL[i];<NEW_LINE>NdotL.assign(clamp(dot(normal, lightDir), 0, 1));<NEW_LINE>// cos(phi_v, phi_l)<NEW_LINE>RFloat cosPhi = new RFloat("cosPhi" + i);<NEW_LINE>cosPhi.assign(dot(new ShaderVar(normalize(viewDir.subtract(NdotV).multiply(normal)), DataType.VEC3), new ShaderVar(normalize(lightDir.subtract(NdotL).multiply(normal)), DataType.VEC3)));<NEW_LINE>RFloat sinNL = new RFloat("sinNL" + i);<NEW_LINE>sinNL.assign("sqrt(1.0 - NdotL" + i + " * NdotL" + i + ")");<NEW_LINE>// sin(max(theta_v, theta_l))<NEW_LINE>RFloat s = new RFloat("s" + i);<NEW_LINE>s.assign("NdotV < NdotL" + i + " ? sinNV : sinNL" + i);<NEW_LINE>// tan(min(theta_v, theta_l))<NEW_LINE>RFloat t = new RFloat("t" + i);<NEW_LINE>t.assign("NdotV > NdotL" + i + " ? sinNV / NdotV : sinNL" + i + " / NdotL" + i);<NEW_LINE>//<NEW_LINE>// -- power = uLightPower * NdotL * (A + B * cosPhi * s * t) * vAttenuation;<NEW_LINE>//<NEW_LINE>power.assign(lightPower.multiply(NdotL).multiply(enclose(A.add(B.multiply(cosPhi).multiply(s).multiply(t)))).multiply(attenuation));<NEW_LINE>//<NEW_LINE>// -- diffuse.rgb += uLightColor * power;<NEW_LINE>//<NEW_LINE>diffuse.assignAdd(lightColor.multiply(power));<NEW_LINE>}<NEW_LINE>color.rgb().assign(diffuse.multiply(color.rgb()).add(ambientColor));<NEW_LINE>color.rgb().assignMultiply(new RFloat("1.0").subtract(gShadowValue));<NEW_LINE>} | RVec3) getGlobal(DefaultShaderVar.V_EYE_DIR); |
893,746 | private JsonToken toJsonToken(BsonType type) {<NEW_LINE>switch(type) {<NEW_LINE>case END_OF_DOCUMENT:<NEW_LINE>reader.readEndDocument();<NEW_LINE>return JsonToken.END_OBJECT;<NEW_LINE>case DOCUMENT:<NEW_LINE>reader.readStartDocument();<NEW_LINE>return JsonToken.START_OBJECT;<NEW_LINE>case ARRAY:<NEW_LINE>reader.readStartArray();<NEW_LINE>return JsonToken.START_ARRAY;<NEW_LINE>case OBJECT_ID:<NEW_LINE>return JsonToken.VALUE_EMBEDDED_OBJECT;<NEW_LINE>case BOOLEAN:<NEW_LINE>final <MASK><NEW_LINE>return value ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE;<NEW_LINE>case DATE_TIME:<NEW_LINE>return JsonToken.VALUE_EMBEDDED_OBJECT;<NEW_LINE>case NULL:<NEW_LINE>reader.readNull();<NEW_LINE>return JsonToken.VALUE_NULL;<NEW_LINE>case REGULAR_EXPRESSION:<NEW_LINE>return JsonToken.VALUE_EMBEDDED_OBJECT;<NEW_LINE>case SYMBOL:<NEW_LINE>case STRING:<NEW_LINE>return JsonToken.VALUE_STRING;<NEW_LINE>case INT32:<NEW_LINE>case INT64:<NEW_LINE>return JsonToken.VALUE_NUMBER_INT;<NEW_LINE>case DECIMAL128:<NEW_LINE>return JsonToken.VALUE_NUMBER_FLOAT;<NEW_LINE>case DOUBLE:<NEW_LINE>return JsonToken.VALUE_NUMBER_FLOAT;<NEW_LINE>case BINARY:<NEW_LINE>return JsonToken.VALUE_EMBEDDED_OBJECT;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException(String.format("Unknown type %s", type));<NEW_LINE>}<NEW_LINE>} | boolean value = reader.readBoolean(); |
1,190,710 | private void postprocessModifyMemberProperty(ShapeModel shapeModel, String memberName, ModifyModelShapeModifier modifyModel) {<NEW_LINE>if (modifyModel.getEmitEnumName() != null) {<NEW_LINE>EnumModel enumModel = shapeModel.findEnumModelByValue(memberName);<NEW_LINE>if (enumModel == null) {<NEW_LINE>throw new IllegalStateException(String.format("Cannot find enum [%s] in the intermediate model when processing " + "customization config shapeModifiers.%s", memberName, memberName));<NEW_LINE>}<NEW_LINE>enumModel.setName(modifyModel.getEmitEnumName());<NEW_LINE>}<NEW_LINE>if (modifyModel.getEmitEnumValue() != null) {<NEW_LINE>EnumModel enumModel = shapeModel.findEnumModelByValue(memberName);<NEW_LINE>if (enumModel == null) {<NEW_LINE>throw new IllegalStateException(String.format("Cannot find enum [%s] in the intermediate model when processing " + "customization config shapeModifiers.%s", memberName, memberName));<NEW_LINE>}<NEW_LINE>enumModel.setValue(modifyModel.getEmitEnumValue());<NEW_LINE>}<NEW_LINE>if (modifyModel.getMarshallLocationName() != null) {<NEW_LINE>MemberModel <MASK><NEW_LINE>memberModel.getHttp().setMarshallLocationName(modifyModel.getMarshallLocationName());<NEW_LINE>}<NEW_LINE>if (modifyModel.getUnmarshallLocationName() != null) {<NEW_LINE>MemberModel memberModel = shapeModel.findMemberModelByC2jName(memberName);<NEW_LINE>memberModel.getHttp().setUnmarshallLocationName(modifyModel.getUnmarshallLocationName());<NEW_LINE>}<NEW_LINE>} | memberModel = shapeModel.findMemberModelByC2jName(memberName); |
1,162,766 | private static void checkMetadataAndRootTableEntries(String tableNameToCheck, ServerUtilOpts opts) throws Exception {<NEW_LINE>TableId tableCheckId = opts.getServerContext().getTableId(tableNameToCheck);<NEW_LINE>System.out.println("Checking tables whose metadata is found in: " + tableNameToCheck + " (" + tableCheckId + ")");<NEW_LINE>Map<TableId, TreeSet<KeyExtent>> <MASK><NEW_LINE>try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build();<NEW_LINE>Scanner scanner = client.createScanner(tableNameToCheck, Authorizations.EMPTY)) {<NEW_LINE>scanner.setRange(TabletsSection.getRange());<NEW_LINE>TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);<NEW_LINE>scanner.fetchColumnFamily(CurrentLocationColumnFamily.NAME);<NEW_LINE>Text colf = new Text();<NEW_LINE>Text colq = new Text();<NEW_LINE>boolean justLoc = false;<NEW_LINE>int count = 0;<NEW_LINE>for (Entry<Key, Value> entry : scanner) {<NEW_LINE>colf = entry.getKey().getColumnFamily(colf);<NEW_LINE>colq = entry.getKey().getColumnQualifier(colq);<NEW_LINE>count++;<NEW_LINE>TableId tableId = KeyExtent.fromMetaRow(entry.getKey().getRow()).tableId();<NEW_LINE>TreeSet<KeyExtent> tablets = tables.get(tableId);<NEW_LINE>if (tablets == null) {<NEW_LINE>tables.forEach(CheckForMetadataProblems::checkTable);<NEW_LINE>tables.clear();<NEW_LINE>tablets = new TreeSet<>();<NEW_LINE>tables.put(tableId, tablets);<NEW_LINE>}<NEW_LINE>if (TabletColumnFamily.PREV_ROW_COLUMN.equals(colf, colq)) {<NEW_LINE>KeyExtent tabletKe = KeyExtent.fromMetaPrevRow(entry);<NEW_LINE>tablets.add(tabletKe);<NEW_LINE>justLoc = false;<NEW_LINE>} else if (colf.equals(CurrentLocationColumnFamily.NAME)) {<NEW_LINE>if (justLoc) {<NEW_LINE>System.out.println("Problem at key " + entry.getKey());<NEW_LINE>sawProblems = true;<NEW_LINE>}<NEW_LINE>justLoc = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (count == 0) {<NEW_LINE>System.err.println("ERROR : table " + tableNameToCheck + " (" + tableCheckId + ") is empty");<NEW_LINE>sawProblems = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tables.forEach(CheckForMetadataProblems::checkTable);<NEW_LINE>if (!sawProblems) {<NEW_LINE>System.out.println("No problems found in " + tableNameToCheck + " (" + tableCheckId + ")");<NEW_LINE>}<NEW_LINE>// end METADATA table sanity check<NEW_LINE>} | tables = new HashMap<>(); |
445,885 | private AllocationLineCandidate processInvoiceProcessingFeeCandidate(@NonNull final AllocationLineCandidate candidate) {<NEW_LINE>if (!AllocationLineCandidateType.InvoiceProcessingFee.equals(candidate.getType())) {<NEW_LINE>return candidate;<NEW_LINE>}<NEW_LINE>if (invoiceProcessingServiceCompanyService == null) {<NEW_LINE>throw new AdempiereException("Cannot process invoice fee candidates because no service was configured");<NEW_LINE>}<NEW_LINE>final AllocationAmounts amounts = AllocationAmounts.builder().discountAmt(candidate.getAmounts().getDiscountAmt()).writeOffAmt(candidate.getAmounts().getWriteOffAmt()).invoiceProcessingFee(candidate.getAmounts().getInvoiceProcessingFee()).build();<NEW_LINE>Check.assumeEquals(amounts, candidate.getAmounts());<NEW_LINE>final InvoiceId serviceInvoiceId = invoiceProcessingServiceCompanyService.generateServiceInvoice(candidate.getInvoiceProcessingFeeCalculation(), candidate.<MASK><NEW_LINE>return candidate.toBuilder().type(AllocationLineCandidateType.SalesInvoiceToPurchaseInvoice).amounts(amounts.toBuilder().payAmt(amounts.getInvoiceProcessingFee()).invoiceProcessingFee(null).build()).paymentDocumentRef(TableRecordReference.of(I_C_Invoice.Table_Name, serviceInvoiceId)).build();<NEW_LINE>} | getAmounts().getInvoiceProcessingFee()); |
438,312 | public Redis jedisClusterCreate(Params params) {<NEW_LINE>String[] redisClusterIpPorts = <MASK><NEW_LINE>Set<HostAndPort> nodes = new HashSet<>();<NEW_LINE>for (String redisIpPort : redisClusterIpPorts) {<NEW_LINE>if (redisIpPort.contains(":")) {<NEW_LINE>String[] ipPort = redisIpPort.split(":");<NEW_LINE>nodes.add(new HostAndPort(ipPort[0], Integer.parseInt(ipPort[1])));<NEW_LINE>} else {<NEW_LINE>nodes.add(new HostAndPort(redisIpPort, DEFAULT_CLUSTER_PORT));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JedisPoolConfig config = new JedisPoolConfig();<NEW_LINE>config.setMaxTotal(MAX_TOTAL);<NEW_LINE>config.setMaxIdle(MAX_IDLE);<NEW_LINE>config.setMaxWaitMillis(MAX_WAIT_MILLIS);<NEW_LINE>config.setTestOnBorrow(true);<NEW_LINE>config.setTestOnReturn(true);<NEW_LINE>final JedisCluster jedisCluster = new JedisCluster(nodes, TIME_OUT, TIME_OUT, MAX_ATTEMPTS, params.get(RedisParams.REDIS_PASSWORD), config);<NEW_LINE>return new Redis() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void close() {<NEW_LINE>try {<NEW_LINE>jedisCluster.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String ping() {<NEW_LINE>LOG.error("No way to dispatch ping command to Redis Cluster.");<NEW_LINE>return "No way to dispatch ping command to Redis Cluster.";<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String set(byte[] key, byte[] value) {<NEW_LINE>return jedisCluster.set(key, value);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public byte[] get(byte[] key) {<NEW_LINE>return jedisCluster.get(key);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | params.get(RedisParams.REDIS_IPS); |
278,750 | public Xml.Document visitDocument(Xml.Document document, ExecutionContext ctx) {<NEW_LINE>Xml.Document doc = super.visitDocument(document, ctx);<NEW_LINE>Validated versionValidation = <MASK><NEW_LINE>if (versionValidation.isValid()) {<NEW_LINE>versionComparator = versionValidation.getValue();<NEW_LINE>}<NEW_LINE>if (documentHasManagedDependency(doc, ctx)) {<NEW_LINE>return document;<NEW_LINE>}<NEW_LINE>String versionToUse = findVersionToUse(ctx);<NEW_LINE>if (versionToUse.equals(existingManagedDependencyVersion())) {<NEW_LINE>return document;<NEW_LINE>}<NEW_LINE>Xml.Tag root = document.getRoot();<NEW_LINE>List<? extends Content> rootContent = root.getContent() != null ? root.getContent() : emptyList();<NEW_LINE>Xml.Tag dependencyManagementTag = root.getChild("dependencyManagement").orElse(null);<NEW_LINE>if (dependencyManagementTag == null) {<NEW_LINE>doc = (Xml.Document) new AddToTagVisitor<>(root, Xml.Tag.build("<dependencyManagement>\n<dependencies/>\n</dependencyManagement>"), new MavenTagInsertionComparator(rootContent)).visitNonNull(doc, ctx);<NEW_LINE>} else if (!dependencyManagementTag.getChild("dependencies").isPresent()) {<NEW_LINE>doc = (Xml.Document) new AddToTagVisitor<>(dependencyManagementTag, Xml.Tag.build("\n<dependencies/>\n"), new MavenTagInsertionComparator(rootContent)).visitNonNull(doc, ctx);<NEW_LINE>}<NEW_LINE>doc = (Xml.Document) new InsertDependencyInOrder(groupId, artifactId, versionToUse, type, scope, classifier).visitNonNull(doc, ctx);<NEW_LINE>return doc;<NEW_LINE>} | Semver.validate(version, versionPattern); |
1,564,519 | public void marshall(DataReplicationInfo dataReplicationInfo, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (dataReplicationInfo == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(dataReplicationInfo.getDataReplicationError(), DATAREPLICATIONERROR_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataReplicationInfo.getDataReplicationInitiation(), DATAREPLICATIONINITIATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataReplicationInfo.getDataReplicationState(), DATAREPLICATIONSTATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(dataReplicationInfo.getLagDuration(), LAGDURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataReplicationInfo.getLastSnapshotDateTime(), LASTSNAPSHOTDATETIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataReplicationInfo.getReplicatedDisks(), REPLICATEDDISKS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | dataReplicationInfo.getEtaDateTime(), ETADATETIME_BINDING); |
1,387,724 | public void refreshStatisticsForEntity(String name) {<NEW_LINE>log.debug("Refreshing statistics for entity " + name);<NEW_LINE>MetaClass metaClass = metadata.getExtendedEntities().getOriginalOrThisMetaClass(metadata.getClassNN(name));<NEW_LINE>String storeName = metadata.getTools().getStoreName(metaClass);<NEW_LINE>if (storeName == null) {<NEW_LINE>log.debug("Entity " + name + " is not persistent, ignoring it");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Transaction <MASK><NEW_LINE>try {<NEW_LINE>EntityManager em = persistence.getEntityManager(storeName);<NEW_LINE>Query q = em.createQuery("select count(e) from " + name + " e");<NEW_LINE>Long count = (Long) q.getSingleResult();<NEW_LINE>EntityStatistics entityStatistics;<NEW_LINE>if (Stores.isMain(storeName)) {<NEW_LINE>entityStatistics = getEntityStatisticsInstance(name, em);<NEW_LINE>entityStatistics.setInstanceCount(count);<NEW_LINE>} else {<NEW_LINE>entityStatistics = persistence.callInTransaction(mainDsEm -> {<NEW_LINE>EntityStatistics es = getEntityStatisticsInstance(name, mainDsEm);<NEW_LINE>es.setInstanceCount(count);<NEW_LINE>return es;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>getStatisticsCache().put(name, entityStatistics);<NEW_LINE>tx.commit();<NEW_LINE>} finally {<NEW_LINE>tx.end();<NEW_LINE>}<NEW_LINE>} | tx = persistence.createTransaction(storeName); |
1,023,331 | public static byte[] encodeGSSExportName(String oid, String name) {<NEW_LINE>try {<NEW_LINE>byte[] oid_arr = encodeOID(oid);<NEW_LINE>int oid_len = oid_arr.length;<NEW_LINE>byte[] name_arr = name.getBytes("UTF-8");<NEW_LINE>int name_len = name_arr.length;<NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>// token id at 0<NEW_LINE>baos.write(ASN_TAG_NT_EXPORTED_NAME1);<NEW_LINE>baos.write(ASN_TAG_NT_EXPORTED_NAME2);<NEW_LINE>// write the two length bytes<NEW_LINE>baos.write((byte) (oid_len & 0xFF00) >> 8);<NEW_LINE>baos.write((byte) (oid_len & 0x00FF));<NEW_LINE>// oid at 2<NEW_LINE>baos.write(oid_arr);<NEW_LINE>// name length at n<NEW_LINE>baos.write((byte) (<MASK><NEW_LINE>baos.write((byte) (name_len & 0x00FF0000) >> 16);<NEW_LINE>baos.write((byte) (name_len & 0x0000FF00) >> 8);<NEW_LINE>baos.write((byte) (name_len & 0x000000FF));<NEW_LINE>// name at n+4<NEW_LINE>baos.write(name_arr);<NEW_LINE>return baos.toByteArray();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// Tr.debug(tc, "Could not encode : " + id);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | name_len & 0xFF000000) >> 24); |
712,804 | final RecordHandlerProgressResult executeRecordHandlerProgress(RecordHandlerProgressRequest recordHandlerProgressRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(recordHandlerProgressRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RecordHandlerProgressRequest> request = null;<NEW_LINE>Response<RecordHandlerProgressResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RecordHandlerProgressRequestMarshaller().marshall(super.beforeMarshalling(recordHandlerProgressRequest));<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, "CloudFormation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RecordHandlerProgress");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<RecordHandlerProgressResult> responseHandler = new StaxResponseHandler<RecordHandlerProgressResult>(new RecordHandlerProgressResultStaxUnmarshaller());<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,583,000 | public void process(DMatrixRMaj L_full, DMatrixRMaj y, double[] betas) {<NEW_LINE>svd.decompose(L_full);<NEW_LINE>// extract null space<NEW_LINE>V = svd.getV(null, true);<NEW_LINE>// compute one possible solution<NEW_LINE>pseudo.setA(L_full);<NEW_LINE>pseudo.solve(y, x0);<NEW_LINE>// add additional constraints to reduce the number of possible solutions<NEW_LINE>DMatrixRMaj alphas = solveConstraintMatrix();<NEW_LINE>// compute the final solution<NEW_LINE>for (int i = 0; i < x0.numRows; i++) {<NEW_LINE>for (int j = 0; j < numNull; j++) {<NEW_LINE>x0.data[i] += alphas.data[j<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (numControl == 4) {<NEW_LINE>betas[0] = Math.sqrt(Math.abs(x0.data[0]));<NEW_LINE>betas[1] = Math.sqrt(Math.abs(x0.data[4])) * Math.signum(x0.data[1]);<NEW_LINE>betas[2] = Math.sqrt(Math.abs(x0.data[7])) * Math.signum(x0.data[2]);<NEW_LINE>betas[3] = Math.sqrt(Math.abs(x0.data[9])) * Math.signum(x0.data[3]);<NEW_LINE>} else {<NEW_LINE>betas[0] = Math.sqrt(Math.abs(x0.data[0]));<NEW_LINE>betas[1] = Math.sqrt(Math.abs(x0.data[3])) * Math.signum(x0.data[1]);<NEW_LINE>betas[2] = Math.sqrt(Math.abs(x0.data[5])) * Math.signum(x0.data[2]);<NEW_LINE>}<NEW_LINE>} | ] * valueNull(j, i); |
41,201 | final DeleteTagsResult executeDeleteTags(DeleteTagsRequest deleteTagsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteTagsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteTagsRequest> request = null;<NEW_LINE>Response<DeleteTagsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteTagsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTagsRequest));<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, "Application Discovery Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTags");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteTagsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTagsResultJsonUnmarshaller());<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,772,459 | public HtmlResponse delete(final EditForm form) {<NEW_LINE>verifyCrudMode(form.crudMode, CrudMode.DETAILS);<NEW_LINE>validate(form, messages -> {<NEW_LINE>}, this::asDetailsHtml);<NEW_LINE>verifyToken(this::asDetailsHtml);<NEW_LINE>final String id = form.id;<NEW_LINE>webConfigService.getWebConfig(id).ifPresent(entity -> {<NEW_LINE>try {<NEW_LINE>webConfigService.delete(entity);<NEW_LINE>saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throwValidationError(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)), this::asEditHtml);<NEW_LINE>}<NEW_LINE>}).orElse(() -> {<NEW_LINE>throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL<MASK><NEW_LINE>});<NEW_LINE>return redirect(getClass());<NEW_LINE>} | , id), this::asDetailsHtml); |
1,120,467 | final GetDomainsResult executeGetDomains(GetDomainsRequest getDomainsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDomainsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetDomainsRequest> request = null;<NEW_LINE>Response<GetDomainsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDomainsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDomainsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDomains");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDomainsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new GetDomainsResultJsonUnmarshaller()); |
209,375 | public List<ImageUrl> parseImages(String html, Chapter chapter) throws Manga.NetworkErrorException {<NEW_LINE>List<ImageUrl> list = new LinkedList<>();<NEW_LINE>try {<NEW_LINE>String did = Objects.requireNonNull(StringUtils.match("var did =(.*?);", html, 1)).trim();<NEW_LINE>String sid = Objects.requireNonNull(StringUtils.match("var sid =(.*?);", html, 1)).trim();<NEW_LINE>float random = new Random().nextFloat();<NEW_LINE>String url = StringUtils.format(baseUrl + "/Action/Play/AjaxLoadImgUrl?did=%s&sid=%s&tmp=%f", did, sid, random);<NEW_LINE>Request request = new Request.Builder().url(url).build();<NEW_LINE>String body = getResponseBody(App.getHttpClient(), request);<NEW_LINE>JSONArray jsonArray = new JSONObject<MASK><NEW_LINE>for (int i = 0; i < jsonArray.length(); ++i) {<NEW_LINE>Long comicChapter = chapter.getId();<NEW_LINE>Long id = Long.parseLong(comicChapter + "000" + i);<NEW_LINE>list.add(new ImageUrl(id, comicChapter, i + 1, jsonArray.getString(i), false));<NEW_LINE>}<NEW_LINE>} catch (JSONException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} | (body).getJSONArray("listImg"); |
1,379,172 | public void doReportStat(SofaTracerSpan sofaTracerSpan) {<NEW_LINE>Map<String, String> tagsWithStr = sofaTracerSpan.getTagsWithStr();<NEW_LINE>Map<String, Number> tagsWithNumber = sofaTracerSpan.getTagsWithNumber();<NEW_LINE>StatKey statKey = new StatKey();<NEW_LINE>String localApp = tagsWithStr.get(CommonSpanTags.LOCAL_APP);<NEW_LINE>String topic = tagsWithStr.get(CommonSpanTags.KAFKA_TOPIC);<NEW_LINE>String partition = String.valueOf(tagsWithNumber.get(CommonSpanTags.KAFKA_PARTITION));<NEW_LINE>String offset = String.valueOf(tagsWithNumber.get(CommonSpanTags.KAFKA_OFFSET));<NEW_LINE>// build some tags.<NEW_LINE>statKey.setKey(buildString(new String[] { localApp, topic, partition, offset }));<NEW_LINE>// result code.<NEW_LINE>String resultCode = <MASK><NEW_LINE>boolean success = isMQSimpleSuccess(resultCode);<NEW_LINE>statKey.setResult(success ? SofaTracerConstant.STAT_FLAG_SUCCESS : SofaTracerConstant.STAT_FLAG_FAILS);<NEW_LINE>statKey.setEnd(buildString(new String[] { TracerUtils.getLoadTestMark(sofaTracerSpan) }));<NEW_LINE>// pressure mark<NEW_LINE>statKey.setLoadTest(TracerUtils.isLoadTest(sofaTracerSpan));<NEW_LINE>// value the count and duration<NEW_LINE>long duration = sofaTracerSpan.getEndTime() - sofaTracerSpan.getStartTime();<NEW_LINE>long[] values = new long[] { 1, duration };<NEW_LINE>// reserve<NEW_LINE>this.addStat(statKey, values);<NEW_LINE>} | tagsWithStr.get(CommonSpanTags.RESULT_CODE); |
1,137,482 | protected final synchronized // tzezula: should set CHANGE_EXPECTED flag on the sources.<NEW_LINE>void schedule(final Source source, final SchedulerEvent event) {<NEW_LINE>if (task != null) {<NEW_LINE>task.cancel();<NEW_LINE>}<NEW_LINE>task = null;<NEW_LINE>if (requestProcessor == null) {<NEW_LINE>requestProcessor = new RequestProcessor(Scheduler.class.getName(), 1, false, false);<NEW_LINE>}<NEW_LINE>boolean different = this.source != source;<NEW_LINE>if (different) {<NEW_LINE>if (this.source != null) {<NEW_LINE>final SourceCache cache = SourceAccessor.getINSTANCE().getCache(this.source);<NEW_LINE>cache.unscheduleTasks(Scheduler.this.getClass());<NEW_LINE>SourceAccessor.getINSTANCE().attachScheduler(this.source, ctrl, false);<NEW_LINE>}<NEW_LINE>this.source = source;<NEW_LINE>}<NEW_LINE>if (source == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (different) {<NEW_LINE>SourceAccessor.getINSTANCE().attachScheduler(source, ctrl, true);<NEW_LINE>}<NEW_LINE>task = requestProcessor.create(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>SourceCache cache = SourceAccessor.<MASK><NEW_LINE>SourceAccessor.getINSTANCE().setSchedulerEvent(source, Scheduler.this, event);<NEW_LINE>// S ystem.out.println ("\nSchedule tasks (" + Scheduler.this + "):");<NEW_LINE>LOG.fine("Scheduling tasks for :" + source + " and scheduler " + this);<NEW_LINE>cache.scheduleTasks(Scheduler.this.getClass());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>task.schedule(reparseDelay);<NEW_LINE>} | getINSTANCE().getCache(source); |
790,276 | public void execute() throws CoreException, IOException, MalformedURLException {<NEW_LINE>Logger log = Logger.getLogger(this.getClass().getName());<NEW_LINE>if (log.isLoggable(Level.FINE)) {<NEW_LINE>// NOI18N<NEW_LINE>log.// NOI18N<NEW_LINE>log(// NOI18N<NEW_LINE>Level.FINE, "executing GetRepositoryTasksCommand for task ids {0}:{1}", new Object[] { taskRepository<MASK><NEW_LINE>}<NEW_LINE>if (taskIds.size() == 1 || !connector.getTaskDataHandler().canGetMultiTaskData(taskRepository)) {<NEW_LINE>for (String taskId : taskIds) {<NEW_LINE>TaskData taskData = connector.getTaskData(taskRepository, taskId, monitor);<NEW_LINE>if (monitor.isCanceled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (taskData != null) {<NEW_LINE>Accessor acc = Accessor.getInstance();<NEW_LINE>NbTask task = acc.getOrCreateTask(taskRepository, taskData.getTaskId(), true);<NEW_LINE>taskDataManager.putUpdatedTaskData(acc.getDelegate(task), taskData, true);<NEW_LINE>tasks.add(task);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>connector.getTaskDataHandler().getMultiTaskData(taskRepository, taskIds, new Collector(), monitor);<NEW_LINE>}<NEW_LINE>} | .getUrl(), taskIds }); |
1,123,418 | public void handleEditingFinished(Set<E> editedObjects) {<NEW_LINE>if (editedObjects.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>OWLAxiom newAxiom = createAxiom(editedObjects.iterator().next());<NEW_LINE>// the editor should protect from this, but just in case<NEW_LINE>if (newAxiom == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>A oldAxiom = getAxiom();<NEW_LINE>Set<OWLAnnotation> axiomAnnotations = oldAxiom.getAnnotations();<NEW_LINE>if (!axiomAnnotations.isEmpty()) {<NEW_LINE>newAxiom = newAxiom.getAnnotatedAxiom(axiomAnnotations);<NEW_LINE>}<NEW_LINE>List<OWLOntologyChange> changes = new ArrayList<>();<NEW_LINE>OWLOntology ontology = getOntology();<NEW_LINE>if (ontology != null) {<NEW_LINE>changes.add(<MASK><NEW_LINE>changes.add(new AddAxiom(ontology, newAxiom));<NEW_LINE>} else {<NEW_LINE>OWLOntology activeOntology = getOWLModelManager().getActiveOntology();<NEW_LINE>changes.add(new AddAxiom(activeOntology, newAxiom));<NEW_LINE>}<NEW_LINE>getOWLModelManager().applyChanges(changes);<NEW_LINE>} | new RemoveAxiom(ontology, oldAxiom)); |
119,691 | private void initIconCoordinates() {<NEW_LINE>symbolLayerIconFeatureList = new ArrayList<>();<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(10.338784, 49.481615)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(15.081775, 49.957444)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(11.810747, 50.53269)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(16.308411, 51.35705)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(19.661215, 49.161803)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(16.799065, 46.864746)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(13.364485, 52.764672)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(8.457943, 51.203595)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(12.873831, 51.459068)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(14.836448, 52.814126)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(9.193924, 52.516561)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(12.219625, 47.143578)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(14.182242, 48.893705)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(16.717289, 50.324313)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(22.686916, 45.905823)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(7.967289, 49.904804)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(6.98598, 47.916571)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(18.925233, 44.231107)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(18.843458, 49.957444)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(-17.999544, 62.216028)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.<MASK><NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(9.193924, 51.864868)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(16.144859, 48.732152)));<NEW_LINE>symbolLayerIconFeatureList.add(Feature.fromGeometry(Point.fromLngLat(5.105139, 50.324313)));<NEW_LINE>} | fromLngLat(20.151869, 46.415586))); |
1,514,365 | private String regularColumn(final IndexShard indexShard, final String type) throws IOException {<NEW_LINE>if (indexShard != null) {<NEW_LINE>DocumentMapper docMapper = indexShard.mapperService().documentMapper(type);<NEW_LINE>if (docMapper != null) {<NEW_LINE>for (Mapper fieldMapper : docMapper.mappers()) {<NEW_LINE>if (fieldMapper instanceof MetadataFieldMapper)<NEW_LINE>continue;<NEW_LINE>if (fieldMapper instanceof CqlMapper) {<NEW_LINE>CqlMapper mapper = (CqlMapper) fieldMapper;<NEW_LINE>if (mapper.cqlPrimaryKeyOrder() == -1 && !mapper.cqlStaticColumn() && mapper.cqlCollection() == CqlMapper.CqlCollection.SINGLETON) {<NEW_LINE>return fieldMapper.name();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (logger.isDebugEnabled())<NEW_LINE>logger.debug("no regular columns for index=[{}] type=[{}]", indexShard.shardId().getIndex(<MASK><NEW_LINE>return null;<NEW_LINE>} | ).getName(), type); |
506,164 | public static void main(String[] args) {<NEW_LINE>if (args.length != 4) {<NEW_LINE>System.out.println("Usage: java com.dotcms.cli.security.TrustStoreImportKey truststore truststore_password alias certfile ");<NEW_LINE>System.exit(0);<NEW_LINE>}<NEW_LINE>String keypass = args[1];<NEW_LINE>String alias = args[2];<NEW_LINE>String truststorename = args[0];<NEW_LINE>if (truststorename == null) {<NEW_LINE>System.out.println("Error: you must pass the truststorename file");<NEW_LINE>System.exit(0);<NEW_LINE>}<NEW_LINE>String certfile = args[3];<NEW_LINE>try {<NEW_LINE>KeyStore ks = KeyStore.getInstance("JKS", "SUN");<NEW_LINE>System.out.println("Using truststore-file : " + truststorename);<NEW_LINE>ks.load(Files.newInputStream(Paths.get(truststorename)), keypass.toCharArray());<NEW_LINE>// loading CertificateChain<NEW_LINE>CertificateFactory <MASK><NEW_LINE>InputStream certstream = fullStream(certfile);<NEW_LINE>Collection c = cf.generateCertificates(certstream);<NEW_LINE>Certificate[] certs = new Certificate[c.toArray().length];<NEW_LINE>if (c.size() == 1) {<NEW_LINE>certstream = fullStream(certfile);<NEW_LINE>System.out.println("One certificate, no chain.");<NEW_LINE>Certificate cert = cf.generateCertificate(certstream);<NEW_LINE>certs[0] = cert;<NEW_LINE>}<NEW_LINE>ks.setCertificateEntry(alias, certs[0]);<NEW_LINE>System.out.println("Certificate stored.");<NEW_LINE>System.out.println("Alias:" + alias + " Password:" + keypass);<NEW_LINE>ks.store(Files.newOutputStream(Paths.get(truststorename)), keypass.toCharArray());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>} | cf = CertificateFactory.getInstance("X.509"); |
779,700 | @DeleteMapping(value = "/runtime/executions/{executionId}/variables/{variableName}")<NEW_LINE>public void deleteVariable(@ApiParam(name = "executionId") @PathVariable("executionId") String executionId, @ApiParam(name = "variableName") @PathVariable("variableName") String variableName, @RequestParam(value = "scope", required = false) String scope, HttpServletResponse response) {<NEW_LINE>Execution execution = getExecutionFromRequest(executionId);<NEW_LINE>// Determine scope<NEW_LINE>RestVariableScope variableScope = RestVariableScope.LOCAL;<NEW_LINE>if (scope != null) {<NEW_LINE>variableScope = RestVariable.getScopeFromString(scope);<NEW_LINE>}<NEW_LINE>if (!hasVariableOnScope(execution, variableName, variableScope)) {<NEW_LINE>throw new FlowableObjectNotFoundException("Execution '" + execution.getId() + "' does not have a variable '" + variableName + "' in scope " + variableScope.name().toLowerCase(), VariableInstanceEntity.class);<NEW_LINE>}<NEW_LINE>if (variableScope == RestVariableScope.LOCAL) {<NEW_LINE>runtimeService.removeVariableLocal(execution.getId(), variableName);<NEW_LINE>} else {<NEW_LINE>// Safe to use parentId, as the hasVariableOnScope would have<NEW_LINE>// stopped a global-var update on a root-execution<NEW_LINE>runtimeService.removeVariable(execution.getParentId(), variableName);<NEW_LINE>}<NEW_LINE>response.setStatus(<MASK><NEW_LINE>} | HttpStatus.NO_CONTENT.value()); |
1,755,390 | private void createCameraSource(String model) {<NEW_LINE>// If there's no existing cameraSource, create one.<NEW_LINE>if (cameraSource == null) {<NEW_LINE>cameraSource = new CameraSource(this, graphicOverlay);<NEW_LINE>}<NEW_LINE>String autoMLRemoteModelName = PreferenceUtils.getAutoMLRemoteModelName(this);<NEW_LINE>try {<NEW_LINE>switch(model) {<NEW_LINE>case CUSTOM_AUTOML_LABELING:<NEW_LINE>Log.i(TAG, "Create Custom AutoML Image Label Processor");<NEW_LINE>CustomRemoteModel customRemoteModel = new CustomRemoteModel.Builder(new FirebaseModelSource.Builder(autoMLRemoteModelName).build()).build();<NEW_LINE>CustomImageLabelerOptions customImageLabelerOptions = new CustomImageLabelerOptions.Builder(customRemoteModel).setConfidenceThreshold(0).build();<NEW_LINE>cameraSource.setMachineLearningFrameProcessor(new AutoMLImageLabelerProcessor(this, customRemoteModel, customImageLabelerOptions, Mode.LIVE_PREVIEW));<NEW_LINE>break;<NEW_LINE>case CUSTOM_AUTOML_OBJECT_DETECTION:<NEW_LINE>Log.i(TAG, "Using Custom AutoML Object Detector Processor");<NEW_LINE>CustomRemoteModel customODTRemoteModel = new CustomRemoteModel.Builder(new FirebaseModelSource.Builder(autoMLRemoteModelName).build()).build();<NEW_LINE>CustomObjectDetectorOptions customAutoMLODTOptions = new CustomObjectDetectorOptions.Builder(customODTRemoteModel).setDetectorMode(CustomObjectDetectorOptions.STREAM_MODE).enableClassification().setClassificationConfidenceThreshold(0).setMaxPerObjectLabelCount(1).build();<NEW_LINE>cameraSource.setMachineLearningFrameProcessor(new ObjectDetectorProcessor(this, customODTRemoteModel, customAutoMLODTOptions));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>Log.e(TAG, "Unknown model: " + model);<NEW_LINE>}<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>Log.e(TAG, "Can not create image processor: " + model, e);<NEW_LINE>Toast.makeText(getApplicationContext(), "Can not create image processor: " + e.getMessage(), <MASK><NEW_LINE>}<NEW_LINE>} | Toast.LENGTH_LONG).show(); |
127,389 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String containerAppName, String name, 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 (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (containerAppName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, containerAppName, name, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter name is required and cannot be null.")); |
1,700,665 | public void executeQueryPhase(InternalScrollSearchRequest request, SearchShardTask task, ActionListener<ScrollQuerySearchResult> listener) {<NEW_LINE>final LegacyReaderContext readerContext = (LegacyReaderContext) findReaderContext(<MASK><NEW_LINE>final Releasable markAsUsed;<NEW_LINE>try {<NEW_LINE>markAsUsed = readerContext.markAsUsed(getScrollKeepAlive(request.scroll()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>// We need to release the reader context of the scroll when we hit any exception (here the keep_alive can be too large)<NEW_LINE>freeReaderContext(readerContext.id());<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>runAsync(getExecutor(readerContext.indexShard()), () -> {<NEW_LINE>final ShardSearchRequest shardSearchRequest = readerContext.getShardSearchRequest(null);<NEW_LINE>try (SearchContext searchContext = createContext(readerContext, shardSearchRequest, task, false);<NEW_LINE>SearchOperationListenerExecutor executor = new SearchOperationListenerExecutor(searchContext)) {<NEW_LINE>searchContext.searcher().setAggregatedDfs(readerContext.getAggregatedDfs(null));<NEW_LINE>processScroll(request, readerContext, searchContext);<NEW_LINE>QueryPhase.execute(searchContext);<NEW_LINE>executor.success();<NEW_LINE>readerContext.setRescoreDocIds(searchContext.rescoreDocIds());<NEW_LINE>return new ScrollQuerySearchResult(searchContext.queryResult(), searchContext.shardTarget());<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.trace("Query phase failed", e);<NEW_LINE>// we handle the failure in the failure listener below<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}, wrapFailureListener(listener, readerContext, markAsUsed));<NEW_LINE>} | request.contextId(), request); |
440,377 | private void handleFailedVolumeMigration(VolumeInfo srcVolumeInfo, VolumeInfo destVolumeInfo, HostVO hostVO) {<NEW_LINE>try {<NEW_LINE>_volumeService.revokeAccess(destVolumeInfo, hostVO, destVolumeInfo.getDataStore());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.warn(<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>VolumeDetailVO volumeDetailVO = new VolumeDetailVO(destVolumeInfo.getId(), PrimaryDataStoreDriver.BASIC_DELETE_BY_FOLDER, Boolean.TRUE.toString(), false);<NEW_LINE>volumeDetailsDao.persist(volumeDetailVO);<NEW_LINE>destVolumeInfo.getDataStore().getDriver().deleteAsync(destVolumeInfo.getDataStore(), destVolumeInfo, null);<NEW_LINE>volumeDetailsDao.removeDetails(srcVolumeInfo.getId());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.warn(ex.getMessage());<NEW_LINE>}<NEW_LINE>VolumeVO volumeVO = _volumeDao.findById(srcVolumeInfo.getId());<NEW_LINE>volumeVO.setPoolId(srcVolumeInfo.getPoolId());<NEW_LINE>volumeVO.setLastPoolId(srcVolumeInfo.getLastPoolId());<NEW_LINE>volumeVO.setFolder(srcVolumeInfo.getFolder());<NEW_LINE>volumeVO.set_iScsiName(srcVolumeInfo.get_iScsiName());<NEW_LINE>_volumeDao.update(srcVolumeInfo.getId(), volumeVO);<NEW_LINE>} | "Failed to revoke access to the volume with the following ID: " + destVolumeInfo.getId()); |
563,326 | public void addAssertions(TestSuiteChromosome suite) {<NEW_LINE>setupClassLoader(suite);<NEW_LINE>if (!Properties.hasTargetClassBeenLoaded()) {<NEW_LINE>// Need to load class explicitly since it was re-instrumented<NEW_LINE>Properties.getTargetClassAndDontInitialise();<NEW_LINE>if (!Properties.hasTargetClassBeenLoaded()) {<NEW_LINE>logger.warn("Could not initialize SUT before Assertion generation");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Set<Integer> tkilled = new HashSet<>();<NEW_LINE>int numTest = 0;<NEW_LINE>boolean timeIsShort = false;<NEW_LINE>for (TestCase test : suite.getTests()) {<NEW_LINE>if (!TimeController.getInstance().isThereStillTimeInThisPhase()) {<NEW_LINE>logger.warn("Reached maximum time to generate assertions, aborting assertion generation");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// If at 50% of the time we have only done X% of the tests, then don't minimise<NEW_LINE>if (!timeIsShort && TimeController.getInstance().getPhasePercentage() > Properties.ASSERTION_MINIMIZATION_FALLBACK_TIME) {<NEW_LINE>if (numTest < Properties.ASSERTION_MINIMIZATION_FALLBACK * suite.size()) {<NEW_LINE>logger.warn("Assertion minimization is taking too long ({}% of time used, but only {}/{} tests minimized), falling back to using all assertions", TimeController.getInstance().getPhasePercentage(), numTest, suite.size());<NEW_LINE>timeIsShort = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (timeIsShort) {<NEW_LINE>CompleteAssertionGenerator generator = new CompleteAssertionGenerator();<NEW_LINE>generator.addAssertions(test);<NEW_LINE>numTest++;<NEW_LINE>} else {<NEW_LINE>// Set<Integer> killed = new HashSet<Integer>();<NEW_LINE>addAssertions(test, tkilled);<NEW_LINE>// progressMonitor.updateStatus((100 * numTest++) / tests.size());<NEW_LINE>ClientState state = ClientState.ASSERTION_GENERATION;<NEW_LINE>ClientStateInformation information = new ClientStateInformation(state);<NEW_LINE>information.setProgress((100 * numTest++) / suite.size());<NEW_LINE>ClientServices.getInstance().getClientNode(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>calculateMutationScore(tkilled);<NEW_LINE>restoreCriterion(suite);<NEW_LINE>} | ).changeState(state, information); |
1,415,291 | public void isSharedPreference(Element element, ElementValidation valid) {<NEW_LINE>TypeMirror type = element.asType();<NEW_LINE>if (element instanceof ExecutableElement) {<NEW_LINE>element = ((ExecutableElement) element).getParameters().get(0);<NEW_LINE>type = element.asType();<NEW_LINE>}<NEW_LINE>if (type instanceof ErrorType || type.getKind() == TypeKind.ERROR) {<NEW_LINE>String elementTypeName = type.toString();<NEW_LINE>boolean sharedPrefValidatedInRound = false;<NEW_LINE>if (elementTypeName.endsWith(classSuffix())) {<NEW_LINE>String prefTypeName = elementTypeName.substring(0, elementTypeName.length() - classSuffix().length());<NEW_LINE>prefTypeName = prefTypeName.replace(classSuffix() + ".", ".");<NEW_LINE>Set<? extends Element> sharedPrefElements = validatedModel().getRootAnnotatedElements(<MASK><NEW_LINE>for (Element sharedPrefElement : sharedPrefElements) {<NEW_LINE>TypeElement sharedPrefTypeElement = (TypeElement) sharedPrefElement;<NEW_LINE>String sharedPrefQualifiedName = sharedPrefTypeElement.getQualifiedName().toString();<NEW_LINE>if (sharedPrefQualifiedName.endsWith(prefTypeName)) {<NEW_LINE>sharedPrefValidatedInRound = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!sharedPrefValidatedInRound) {<NEW_LINE>valid.invalidate();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>extendsType(element, SharedPreferencesHelper.class.getName(), valid);<NEW_LINE>}<NEW_LINE>} | SharedPref.class.getName()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.