idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,549,367 | private PathWrapper constructFreeHandRoutePathWrapper(LineString lineString) {<NEW_LINE>PathWrapper pathWrapper = new PathWrapper();<NEW_LINE>PointList pointList = new PointList();<NEW_LINE>PointList startPointList = new PointList();<NEW_LINE>PointList endPointList = new PointList();<NEW_LINE>PointList wayPointList = new PointList();<NEW_LINE>Coordinate startCoordinate = lineString.getCoordinateN(0);<NEW_LINE>Coordinate endCoordinate = lineString.getCoordinateN(1);<NEW_LINE>double distance = CoordTools.calcDistHaversine(startCoordinate.x, startCoordinate.y, endCoordinate.x, endCoordinate.y);<NEW_LINE>pointList.add(lineString.getCoordinateN(0).x, lineString.getCoordinateN(0).y);<NEW_LINE>pointList.add(lineString.getCoordinateN(1).x, lineString.getCoordinateN(1).y);<NEW_LINE>wayPointList.add(lineString.getCoordinateN(0).x, lineString.getCoordinateN(0).y);<NEW_LINE>wayPointList.add(lineString.getCoordinateN(1).x, lineString.getCoordinateN(1).y);<NEW_LINE>startPointList.add(lineString.getCoordinateN(0).x, lineString.getCoordinateN(0).y);<NEW_LINE>endPointList.add(lineString.getCoordinateN(1).x, lineString.getCoordinateN(1).y);<NEW_LINE>Translation translation = new TranslationMap.TranslationHashMap(new Locale(""));<NEW_LINE>InstructionList instructions = new InstructionList(translation);<NEW_LINE>Instruction startInstruction = new Instruction(Instruction.REACHED_VIA, "free hand route", new InstructionAnnotation(0, ""), startPointList);<NEW_LINE>Instruction endInstruction = new Instruction(Instruction.FINISH, "end of free hand route", new InstructionAnnotation<MASK><NEW_LINE>instructions.add(0, startInstruction);<NEW_LINE>instructions.add(1, endInstruction);<NEW_LINE>pathWrapper.setDistance(distance);<NEW_LINE>pathWrapper.setAscend(0.0);<NEW_LINE>pathWrapper.setDescend(0.0);<NEW_LINE>pathWrapper.setTime(0);<NEW_LINE>pathWrapper.setInstructions(instructions);<NEW_LINE>pathWrapper.setWaypoints(wayPointList);<NEW_LINE>pathWrapper.setPoints(pointList);<NEW_LINE>pathWrapper.setRouteWeight(0.0);<NEW_LINE>pathWrapper.setDescription(new ArrayList<>());<NEW_LINE>pathWrapper.setImpossible(false);<NEW_LINE>startInstruction.setDistance(distance);<NEW_LINE>startInstruction.setTime(0);<NEW_LINE>return pathWrapper;<NEW_LINE>} | (0, ""), endPointList); |
525,047 | public AppMeta extract(ApkSourceFile apkSourceFile, ApkSourceFile.Entry baseApkEntry) {<NEW_LINE>try {<NEW_LINE>boolean seenMetaFile = false;<NEW_LINE>AppMeta appMeta = new AppMeta();<NEW_LINE>for (ApkSourceFile.Entry entry : apkSourceFile.listEntries()) {<NEW_LINE>if (entry.getLocalPath().equals(META_FILE)) {<NEW_LINE>JSONObject metaJson = new JSONObject(IOUtils.readStream(apkSourceFile.openEntryInputStream(entry), StandardCharsets.UTF_8));<NEW_LINE>appMeta.packageName = metaJson.optString("package_name");<NEW_LINE>appMeta.appName = metaJson.optString("name");<NEW_LINE>appMeta.versionName = metaJson.optString("version_name");<NEW_LINE>appMeta.versionCode = metaJson.optLong("version_code");<NEW_LINE>seenMetaFile = true;<NEW_LINE>} else if (entry.getLocalPath().equals(ICON_FILE)) {<NEW_LINE>File iconFile = Utils.createTempFileInCache(mContext, "XapkZipAppMetaExtractor", "png");<NEW_LINE>if (iconFile == null)<NEW_LINE>continue;<NEW_LINE>try (InputStream in = apkSourceFile.openEntryInputStream(entry);<NEW_LINE>OutputStream out = new FileOutputStream(iconFile)) {<NEW_LINE>IOUtils.copyStream(in, out);<NEW_LINE>appMeta.iconUri = Uri.fromFile(iconFile);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.w(TAG, "Unable to extract icon", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (seenMetaFile)<NEW_LINE>return appMeta;<NEW_LINE>return null;<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | w(TAG, "Error while extracting meta", e); |
399,733 | public void writeMetadata(String objectName, ObjectMetadata objMetaData) throws Exception {<NEW_LINE>MutationBatch m = keyspace.prepareMutationBatch().withRetryPolicy(retryPolicy);<NEW_LINE>ColumnListMutation<String> row = m.withRow(cf, objectName);<NEW_LINE>if (objMetaData.getChunkSize() != null)<NEW_LINE>row.putColumn(getColumnName(Columns.CHUNKSIZE), objMetaData.getChunkSize(<MASK><NEW_LINE>if (objMetaData.getChunkCount() != null)<NEW_LINE>row.putColumn(getColumnName(Columns.CHUNKCOUNT), objMetaData.getChunkCount(), objMetaData.getTtl());<NEW_LINE>if (objMetaData.getObjectSize() != null)<NEW_LINE>row.putColumn(getColumnName(Columns.OBJECTSIZE), objMetaData.getObjectSize(), objMetaData.getTtl());<NEW_LINE>if (objMetaData.getAttributes() != null)<NEW_LINE>row.putColumn(getColumnName(Columns.ATTRIBUTES), objMetaData.getAttributes(), objMetaData.getTtl());<NEW_LINE>m.execute();<NEW_LINE>} | ), objMetaData.getTtl()); |
1,421,191 | public int trainModel(String modelPath, int epochs) {<NEW_LINE>if (modelPath == null) {<NEW_LINE>logger.severe(Common.addTag("model path cannot be empty"));<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>if (epochs <= 0) {<NEW_LINE>logger.severe<MASK><NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>int status = padSamples();<NEW_LINE>if (status != 0) {<NEW_LINE>logger.severe(Common.addTag("train model failed"));<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>status = trainLoop(epochs);<NEW_LINE>if (status == -1) {<NEW_LINE>logger.severe(Common.addTag("train loop failed"));<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>boolean isSuccess = trainSession.export(modelPath, 0, 1);<NEW_LINE>if (!isSuccess) {<NEW_LINE>logger.severe(Common.addTag("save model failed"));<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | (Common.addTag("epochs cannot smaller than 0")); |
926,083 | public static SavedModelBundle loadSavedModelBundle(String exportDir, String[] tags, ConfigProto config, RunOptions runOptions) {<NEW_LINE>try (PointerScope ignored = new PointerScope()) {<NEW_LINE>TF_Status status = TF_Status.newStatus();<NEW_LINE>// allocate parameters for TF_LoadSessionFromSavedModel<NEW_LINE>TF_SessionOptions opts = TF_SessionOptions.newSessionOptions();<NEW_LINE>if (config != null) {<NEW_LINE>BytePointer configBytes = new BytePointer(config.toByteArray());<NEW_LINE>tensorflow.TF_SetConfig(opts, configBytes, configBytes.capacity(), status);<NEW_LINE>status.throwExceptionIfNotOK();<NEW_LINE>}<NEW_LINE>TF_Buffer runOpts = TF_Buffer.newBufferFromString(runOptions);<NEW_LINE>// load the session<NEW_LINE>TF_Graph graphHandle = AbstractTF_Graph<MASK><NEW_LINE>TF_Buffer metaGraphDef = TF_Buffer.newBuffer();<NEW_LINE>TF_Session sessionHandle = tensorflow.TF_LoadSessionFromSavedModel(opts, runOpts, new BytePointer(exportDir), new PointerPointer<>(tags), tags.length, graphHandle, metaGraphDef, status);<NEW_LINE>status.throwExceptionIfNotOK();<NEW_LINE>// handle the result<NEW_LINE>try {<NEW_LINE>return new SavedModelBundle(graphHandle, sessionHandle, MetaGraphDef.parseFrom(metaGraphDef.dataAsByteBuffer()));<NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>throw new TensorFlowException("Cannot parse MetaGraphDef protocol buffer", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .newGraph().retainReference(); |
1,015,437 | public void processElement(ProcessContext c) {<NEW_LINE>if (Objects.equals(c.element().getKey(), EMPTY_EXPORT_FILE)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Iterable<String> files = c.element().getValue();<NEW_LINE>Iterator<String> it = files.iterator();<NEW_LINE>boolean gcs = it.hasNext() && GcsPath.GCS_URI.matcher(it.next()).matches();<NEW_LINE>TableManifest proto;<NEW_LINE>if (gcs) {<NEW_LINE>Iterable<GcsPath> gcsPaths = Iterables.transform(files, s -> GcsPath.fromUri(s));<NEW_LINE>proto = buildGcsManifest(c, gcsPaths);<NEW_LINE>} else {<NEW_LINE>Iterable<Path> paths = Iterables.transform(files, s -> Paths.get(s));<NEW_LINE>proto = buildLocalManifest(paths);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>c.output(KV.of(c.element().getKey(), JsonFormat.printer(<MASK><NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | ).print(proto))); |
1,518,531 | private void processRefLink(Link subRef, String externalFile) {<NEW_LINE>RefFormat format = computeRefFormat(subRef.get$ref());<NEW_LINE>if (!isAnExternalRefFormat(format)) {<NEW_LINE>subRef.set$ref(RefType.SCHEMAS.getInternalPrefix() + processRefToExternalSchema(externalFile + subRef.get$ref(), RefFormat.RELATIVE));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>String subRefExternalPath = getExternalPath(subRef.get$ref()).orElse(null);<NEW_LINE>if (format.equals(RefFormat.RELATIVE) && !Objects.equals(subRefExternalPath, externalFile)) {<NEW_LINE>$ref = join(externalFile, subRef.get$ref());<NEW_LINE>subRef.set$ref($ref);<NEW_LINE>} else {<NEW_LINE>processRefToExternalLink($ref, format);<NEW_LINE>}<NEW_LINE>} | String $ref = subRef.get$ref(); |
1,604,770 | public ClientInstanceTracked[] track(byte[] hash, ClientInstanceTracked.TrackTarget target) {<NEW_LINE>if (mc_group == null || getOtherInstances().length == 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>Map body = new HashMap();<NEW_LINE>body.put("hash", hash);<NEW_LINE>body.put("seed", new Long(target.isSeed() ? 1 : 0));<NEW_LINE>Map replies = sendRequest(MT_REQUEST_TRACK, body);<NEW_LINE>ClientInstanceTracked[] res = new ClientInstanceTracked[replies.size()];<NEW_LINE>Iterator it = replies.entrySet().iterator();<NEW_LINE>int pos = 0;<NEW_LINE>while (it.hasNext()) {<NEW_LINE>Map.Entry entry = (Map.Entry) it.next();<NEW_LINE>ClientInstance inst = (ClientInstance) entry.getKey();<NEW_LINE>Map reply = (Map) entry.getValue();<NEW_LINE>boolean seed = ((Long) reply.get("seed")).intValue() == 1;<NEW_LINE>res[pos++] = new trackedInstance(inst, target, seed);<NEW_LINE>}<NEW_LINE>return (res);<NEW_LINE>} | return (new ClientInstanceTracked[0]); |
1,561,684 | private Mono<Response<Void>> disableAllForHostingEnvironmentWithResponseAsync(String resourceGroupName, String environmentName, String hostingEnvironmentName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (environmentName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (hostingEnvironmentName == null) {<NEW_LINE>return Mono.<MASK><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>context = this.client.mergeContext(context);<NEW_LINE>return service.disableAllForHostingEnvironment(this.client.getEndpoint(), resourceGroupName, environmentName, hostingEnvironmentName, this.client.getSubscriptionId(), this.client.getApiVersion(), context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter hostingEnvironmentName is required and cannot be null.")); |
60,129 | public static String removeQueryComments(String query) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>final int length = query.length();<NEW_LINE>int commentCharacterCount = 0;<NEW_LINE>boolean inComment = false;<NEW_LINE>boolean inSingleQuotes = false;<NEW_LINE>boolean inDoubleQuotes = false;<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>char current = query.charAt(i);<NEW_LINE>if ('\'' == current) {<NEW_LINE>inSingleQuotes = !inSingleQuotes;<NEW_LINE>}<NEW_LINE>if ('\n' == current) {<NEW_LINE>inComment = false;<NEW_LINE>}<NEW_LINE>if ('"' == current) {<NEW_LINE>inDoubleQuotes = !inDoubleQuotes;<NEW_LINE>}<NEW_LINE>if ('-' == current) {<NEW_LINE>if (!inDoubleQuotes && !inSingleQuotes) {<NEW_LINE>commentCharacterCount++;<NEW_LINE>}<NEW_LINE>} else if (!inComment) {<NEW_LINE>commentCharacterCount = 0;<NEW_LINE>}<NEW_LINE>if (commentCharacterCount == 2) {<NEW_LINE>inComment = true;<NEW_LINE>sb.deleteCharAt(<MASK><NEW_LINE>commentCharacterCount = 0;<NEW_LINE>}<NEW_LINE>if (!inComment) {<NEW_LINE>sb.append(current);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sb.toString().trim();<NEW_LINE>} | sb.length() - 1); |
512,255 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {<NEW_LINE>startedEvent(endpoint.getEndpointAddressPath());<NEW_LINE>if ("Tester".equalsIgnoreCase(request.getQueryString()) && !(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding()))) {<NEW_LINE>Endpoint endpt = wsEngine_.getEndpoint(request.getServletPath());<NEW_LINE>if (endpt != null && Boolean.parseBoolean(endpt.getDescriptor().getDebugging())) {<NEW_LINE>WebServiceTesterServlet.invoke(request, response, endpt.getDescriptor());<NEW_LINE>endedEvent(endpoint.getEndpointAddressPath());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Lookup registered URLs and get the appropriate adapter;<NEW_LINE>// pass control to the adapter<NEW_LINE>RequestTraceSpan span = null;<NEW_LINE>try {<NEW_LINE>ServletAdapter targetEndpoint <MASK><NEW_LINE>if (targetEndpoint != null) {<NEW_LINE>if (requestTracing.isRequestTracingEnabled()) {<NEW_LINE>span = constructWsRequestSpan(request, targetEndpoint.getAddress());<NEW_LINE>}<NEW_LINE>targetEndpoint.handle(getServletContext(), request, response);<NEW_LINE>} else {<NEW_LINE>throw new ServletException("Service not found");<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new ServletException(t);<NEW_LINE>} finally {<NEW_LINE>if (requestTracing.isRequestTracingEnabled() && span != null) {<NEW_LINE>requestTracing.traceSpan(span);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>endedEvent(endpoint.getEndpointAddressPath());<NEW_LINE>} | = (ServletAdapter) getEndpointFor(request); |
483,420 | public void onEntityDamage(EntityDamageEvent event) {<NEW_LINE><MASK><NEW_LINE>if (victim instanceof Player) {<NEW_LINE>Player player = (Player) victim;<NEW_LINE>LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);<NEW_LINE>if (isInvincible(localPlayer)) {<NEW_LINE>player.setFireTicks(0);<NEW_LINE>event.setCancelled(true);<NEW_LINE>if (event instanceof EntityDamageByEntityEvent) {<NEW_LINE>EntityDamageByEntityEvent byEntityEvent = (EntityDamageByEntityEvent) event;<NEW_LINE>Entity attacker = byEntityEvent.getDamager();<NEW_LINE>if (attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof Entity) {<NEW_LINE>attacker = (Entity) ((Projectile) attacker).getShooter();<NEW_LINE>}<NEW_LINE>if (getWorldConfig(player.getWorld()).regionInvinciblityRemovesMobs && attacker instanceof LivingEntity && !(attacker instanceof Player) && !(attacker instanceof Tameable && ((Tameable) attacker).isTamed())) {<NEW_LINE>attacker.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Entity victim = event.getEntity(); |
600,505 | public synchronized void submitRunTaskCommand(long jobId, long taskId, JobConfig jobConfig, Object taskArgs, long workerId) {<NEW_LINE>RunTaskCommand.Builder runTaskCommand = RunTaskCommand.newBuilder();<NEW_LINE>runTaskCommand.setJobId(jobId);<NEW_LINE>runTaskCommand.setTaskId(taskId);<NEW_LINE>try {<NEW_LINE>runTaskCommand.setJobConfig(ByteString.copyFrom(SerializationUtils.serialize(jobConfig)));<NEW_LINE>if (taskArgs != null) {<NEW_LINE>runTaskCommand.setTaskArgs(ByteString.copyFrom(SerializationUtils.serialize(taskArgs)));<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>// TODO(yupeng) better exception handling<NEW_LINE>LOG.info("Failed to serialize the run task command:" + e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JobCommand.<MASK><NEW_LINE>command.setRunTaskCommand(runTaskCommand);<NEW_LINE>submit(workerId, command);<NEW_LINE>} | Builder command = JobCommand.newBuilder(); |
681,122 | public ILUTUProducerAllocationDestination createLUTUProducerAllocationDestination(@NonNull final I_M_HU_LUTU_Configuration lutuConfiguration) {<NEW_LINE>final IHandlingUnitsBL handlingUnitsBL = Services.get(IHandlingUnitsBL.class);<NEW_LINE>final LUTUProducerDestination luProducerDestination = new LUTUProducerDestination();<NEW_LINE>luProducerDestination.setM_HU_LUTU_Configuration(lutuConfiguration);<NEW_LINE>// LU Configuration<NEW_LINE>final I_M_HU_PI_Item luPIItem = lutuConfiguration.getM_LU_HU_PI_Item();<NEW_LINE>final int qtyLU = lutuConfiguration.getQtyLU().intValueExact();<NEW_LINE>final boolean qtyLUInfinite = lutuConfiguration.isInfiniteQtyLU();<NEW_LINE>final int qtyTU = lutuConfiguration.getQtyTU().intValueExact();<NEW_LINE>final boolean qtyTUInfinite = lutuConfiguration.isInfiniteQtyTU();<NEW_LINE>if (!handlingUnitsBL.isNoPI(luPIItem)) {<NEW_LINE>final I_M_HU_PI luPI = luPIItem.getM_HU_PI_Version().getM_HU_PI();<NEW_LINE>luProducerDestination.setLUItemPI(luPIItem);<NEW_LINE>luProducerDestination.setLUPI(luPI);<NEW_LINE>if (qtyLUInfinite) {<NEW_LINE>luProducerDestination.setMaxLUsInfinite();<NEW_LINE>//<NEW_LINE>// 07378: Fix behavior when max LUs are infinite, created max TUs are the ones we specify (otherwise we end up creating infinite HUs for 3 x Tomatoes)<NEW_LINE>luProducerDestination.setMaxTUsForRemainingQty(qtyTU);<NEW_LINE>} else {<NEW_LINE>luProducerDestination.setMaxLUs(qtyLU);<NEW_LINE>}<NEW_LINE>// TU configuration<NEW_LINE>Check.assume(!qtyTUInfinite, "qtyTUInfinite shall be false when dealing with concrete LUs");<NEW_LINE>luProducerDestination.setMaxTUsPerLU(qtyTU);<NEW_LINE>luProducerDestination.setCreateTUsForRemainingQty(false);<NEW_LINE>} else {<NEW_LINE>luProducerDestination.setLUItemPI(null);<NEW_LINE>luProducerDestination.setLUPI(null);<NEW_LINE>luProducerDestination.setMaxLUs(0);<NEW_LINE>// TU configuration<NEW_LINE>// luProducerDestination.setMaxTUsPerLU(0); // no need to set<NEW_LINE>// we will create only TUs<NEW_LINE>luProducerDestination.setCreateTUsForRemainingQty(true);<NEW_LINE>if (qtyTUInfinite) {<NEW_LINE>luProducerDestination.setMaxTUsForRemainingQtyInfinite();<NEW_LINE>} else {<NEW_LINE>luProducerDestination.setMaxTUsForRemainingQty(qtyTU);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// TU Configuration<NEW_LINE>final I_M_HU_PI tuPI = lutuConfiguration.getM_TU_HU_PI();<NEW_LINE>luProducerDestination.setTUPI(tuPI);<NEW_LINE>// TU Capacity<NEW_LINE>final ProductId cuProductId = ProductId.<MASK><NEW_LINE>final I_C_UOM cuUOM = ILUTUConfigurationFactory.extractUOMOrNull(lutuConfiguration);<NEW_LINE>final boolean qtyCUInfinite = lutuConfiguration.isInfiniteQtyCU();<NEW_LINE>final BigDecimal qtyCUPerTU = qtyCUInfinite ? Quantity.QTY_INFINITE : lutuConfiguration.getQtyCU();<NEW_LINE>luProducerDestination.addCUPerTU(cuProductId, qtyCUPerTU, cuUOM);<NEW_LINE>//<NEW_LINE>// Misc configuration<NEW_LINE>luProducerDestination.setBPartnerId(ILUTUConfigurationFactory.extractBPartnerIdOrNull(lutuConfiguration));<NEW_LINE>luProducerDestination.setC_BPartner_Location_ID(lutuConfiguration.getC_BPartner_Location_ID());<NEW_LINE>luProducerDestination.setHUStatus(lutuConfiguration.getHUStatus());<NEW_LINE>final IWarehouseDAO warehousesRepo = Services.get(IWarehouseDAO.class);<NEW_LINE>luProducerDestination.setLocatorId(warehousesRepo.getLocatorIdByRepoIdOrNull(lutuConfiguration.getM_Locator_ID()));<NEW_LINE>//<NEW_LINE>// Return it<NEW_LINE>return luProducerDestination;<NEW_LINE>} | ofRepoId(lutuConfiguration.getM_Product_ID()); |
480,250 | public void plantOneOff(JobRequest request) {<NEW_LINE>long <MASK><NEW_LINE>long endMs = Common.getEndMs(request, true);<NEW_LINE>JobInfo jobInfo = createBuilderOneOff(createBaseBuilder(request, true), startMs, endMs).build();<NEW_LINE>int scheduleResult = schedule(jobInfo);<NEW_LINE>if (scheduleResult == ERROR_BOOT_PERMISSION) {<NEW_LINE>jobInfo = createBuilderOneOff(createBaseBuilder(request, false), startMs, endMs).build();<NEW_LINE>scheduleResult = schedule(jobInfo);<NEW_LINE>}<NEW_LINE>mCat.d("Schedule one-off jobInfo %s, %s, start %s, end %s (from now), reschedule count %d", scheduleResultToString(scheduleResult), request, JobUtil.timeToString(startMs), JobUtil.timeToString(Common.getEndMs(request, false)), Common.getRescheduleCount(request));<NEW_LINE>} | startMs = Common.getStartMs(request); |
118,968 | public void run() {<NEW_LINE>Element data = helper.getPrimaryConfigurationData(true);<NEW_LINE>// XXX replace by XMLUtil when that has findElement, findText, etc.<NEW_LINE>// NOI18N<NEW_LINE>NodeList nl = data.<MASK><NEW_LINE>Element nameEl;<NEW_LINE>if (nl.getLength() == 1) {<NEW_LINE>nameEl = (Element) nl.item(0);<NEW_LINE>NodeList deadKids = nameEl.getChildNodes();<NEW_LINE>while (deadKids.getLength() > 0) {<NEW_LINE>nameEl.removeChild(deadKids.item(0));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>nameEl = data.getOwnerDocument().createElementNS(EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");<NEW_LINE>data.insertBefore(nameEl, /* OK if null */<NEW_LINE>data.getChildNodes().item(0));<NEW_LINE>}<NEW_LINE>nameEl.appendChild(data.getOwnerDocument().createTextNode(name));<NEW_LINE>helper.putPrimaryConfigurationData(data, true);<NEW_LINE>} | getElementsByTagNameNS(EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); |
122,540 | private int copySetRecord(HollowSetSchema engineSchema, int currentRecordPointer, int currentRecordOrdinal) {<NEW_LINE>HollowSetWriteRecord rec = engineSchema != null ? (HollowSetWriteRecord) getWriteRecord(engineSchema) : null;<NEW_LINE>int numElements = VarInt.readVInt(record.data, currentRecordPointer);<NEW_LINE>currentRecordPointer += VarInt.sizeOfVInt(numElements);<NEW_LINE>int unmappedOrdinal = 0;<NEW_LINE>for (int i = 0; i < numElements; i++) {<NEW_LINE>int unmappedOrdinalDelta = VarInt.readVInt(record.data, currentRecordPointer);<NEW_LINE>currentRecordPointer += VarInt.sizeOfVInt(unmappedOrdinalDelta);<NEW_LINE>unmappedOrdinal += unmappedOrdinalDelta;<NEW_LINE>if (rec != null) {<NEW_LINE>int mappedOrdinal = ordinalMapping.get(unmappedOrdinal);<NEW_LINE>rec.addElement(mappedOrdinal);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (engineSchema != null) {<NEW_LINE>int stateEngineOrdinal = stateEngine.add(engineSchema.getName(), rec);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return currentRecordPointer;<NEW_LINE>} | ordinalMapping.put(currentRecordOrdinal, stateEngineOrdinal); |
169,710 | default <// This context is not duplicated, so we need to do it.<NEW_LINE>R> // This context is not duplicated, so we need to do it.<NEW_LINE>SpanOperation // This context is not duplicated, so we need to do it.<NEW_LINE>sendRequest(final Context context, final SpanKind kind, final TracingPolicy policy, final R request, final String operation, final BiConsumer<String, String> headers, final TagExtractor<R> tagExtractor) {<NEW_LINE>Instrumenter<REQ, RESP> instrumenter = getSendRequestInstrumenter();<NEW_LINE>io.opentelemetry.context.Context parentContext = QuarkusContextStorage.getContext(context);<NEW_LINE>if (parentContext == null) {<NEW_LINE>parentContext = io.opentelemetry.context.Context.current();<NEW_LINE>}<NEW_LINE>if (instrumenter.shouldStart(parentContext, (REQ) request)) {<NEW_LINE>io.opentelemetry.context.Context spanContext = instrumenter.start(parentContext, writableHeaders((REQ) request, headers));<NEW_LINE>Context duplicatedContext = VertxContext.getOrCreateDuplicatedContext(context);<NEW_LINE>setContextSafe(duplicatedContext, true);<NEW_LINE>Scope scope = QuarkusContextStorage.<MASK><NEW_LINE>return spanOperation(duplicatedContext, (REQ) request, toMultiMap(headers), spanContext, scope);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | INSTANCE.attach(duplicatedContext, spanContext); |
79,602 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>Context ctx = getContext();<NEW_LINE>Bundle args = getArguments();<NEW_LINE>if (ctx == null || args == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String contentsJson = args.getString(CONTENTS_JSON_KEY);<NEW_LINE>if (contentsJson == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final WikivoyageContentItem contentItem = WikivoyageJsonParser.parseJsonContents(contentsJson);<NEW_LINE>if (contentItem == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>items.add(new TitleItem(getString(R.string.shared_string_contents)));<NEW_LINE>Drawable transparent = AppCompatResources.getDrawable(ctx, R.color.color_transparent);<NEW_LINE>expListView = new ExpandableListView(ctx);<NEW_LINE>expListView.setAdapter(new ExpandableListAdapter(ctx, contentItem));<NEW_LINE>expListView.setDivider(transparent);<NEW_LINE>expListView.setGroupIndicator(transparent);<NEW_LINE>expListView.setSelector(transparent);<NEW_LINE>expListView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));<NEW_LINE>expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {<NEW_LINE>WikivoyageContentItem wikivoyageContentItem = contentItem.getSubItems().get(groupPosition);<NEW_LINE>String link = wikivoyageContentItem.getSubItems().get(childPosition).getLink();<NEW_LINE>String name = wikivoyageContentItem.getLink().substring(1);<NEW_LINE>sendResults(link, name);<NEW_LINE>dismiss();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {<NEW_LINE>WikivoyageContentItem wikivoyageContentItem = contentItem.getSubItems().get(groupPosition);<NEW_LINE>String link = wikivoyageContentItem.getLink();<NEW_LINE>String name = wikivoyageContentItem.getLink().substring(1);<NEW_LINE>sendResults(link, name);<NEW_LINE>dismiss();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE><MASK><NEW_LINE>container.addView(expListView);<NEW_LINE>items.add(new SimpleBottomSheetItem.Builder().setCustomView(container).create());<NEW_LINE>} | LinearLayout container = new LinearLayout(ctx); |
534,273 | public void drawU(UGraphic ug) {<NEW_LINE>final double thickness = ug.getParam().getStroke().getThickness();<NEW_LINE>final double radius = 4 + thickness - 1;<NEW_LINE>final double lineHeight = 4 + thickness - 1;<NEW_LINE>final int xWing = 4;<NEW_LINE>final AffineTransform rotate = AffineTransform.getRotateInstance(this.angle);<NEW_LINE>Point2D middle = new Point2D.Double(0, 0);<NEW_LINE>Point2D base = new Point2D.Double(-xWing - radius - 3, 0);<NEW_LINE>Point2D circleBase = new Point2D.Double(-xWing - radius - 3, 0);<NEW_LINE>Point2D lineTop = new Point2D.<MASK><NEW_LINE>Point2D lineBottom = new Point2D.Double(-xWing, lineHeight);<NEW_LINE>rotate.transform(lineTop, lineTop);<NEW_LINE>rotate.transform(lineBottom, lineBottom);<NEW_LINE>rotate.transform(base, base);<NEW_LINE>rotate.transform(circleBase, circleBase);<NEW_LINE>drawLine(ug, contact.getX(), contact.getY(), base, middle);<NEW_LINE>final UStroke stroke = new UStroke(thickness);<NEW_LINE>ug.apply(new UTranslate(contact.getX() + circleBase.getX() - radius, contact.getY() + circleBase.getY() - radius)).apply(stroke).draw(new UEllipse(2 * radius, 2 * radius));<NEW_LINE>drawLine(ug.apply(stroke), contact.getX(), contact.getY(), lineTop, lineBottom);<NEW_LINE>} | Double(-xWing, -lineHeight); |
1,005,214 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl;<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@public create window ZoneWindow#keepall as Zone", path);<NEW_LINE>env.compileDeploy("insert into ZoneWindow select * from Zone", path);<NEW_LINE>epl = "@name('s0') select ZoneWindow.where(z => inrect(z.rectangle, location)) as zones from Item";<NEW_LINE>env.compileDeploy(epl, path).addListener("s0");<NEW_LINE>env.sendEventBean(new Zone("Z1", new Rectangle(0, <MASK><NEW_LINE>env.sendEventBean(new Zone("Z2", new Rectangle(21, 21, 40, 40)));<NEW_LINE>env.sendEventBean(new Item("A1", new Location(10, 10)));<NEW_LINE>env.assertEventNew("s0", event -> {<NEW_LINE>Zone[] zones = toArrayZones((Collection<Zone>) event.get("zones"));<NEW_LINE>assertEquals(1, zones.length);<NEW_LINE>assertEquals("Z1", zones[0].getName());<NEW_LINE>});<NEW_LINE>env.undeployModuleContaining("s0");<NEW_LINE>epl = "@name('s0') select ZoneWindow(name in ('Z4', 'Z5', 'Z3')).where(z => inrect(z.rectangle, location)) as zones from Item";<NEW_LINE>env.compileDeploy(epl, path).addListener("s0");<NEW_LINE>env.sendEventBean(new Zone("Z3", new Rectangle(0, 0, 20, 20)));<NEW_LINE>env.sendEventBean(new Item("A1", new Location(10, 10)));<NEW_LINE>env.assertEventNew("s0", event -> {<NEW_LINE>Zone[] zones = toArrayZones((Collection<Zone>) event.get("zones"));<NEW_LINE>assertEquals(1, zones.length);<NEW_LINE>assertEquals("Z3", zones[0].getName());<NEW_LINE>});<NEW_LINE>env.undeployAll();<NEW_LINE>} | 0, 20, 20))); |
159,120 | private void decodeMask1(ByteBuf buf, int mask, Position position) {<NEW_LINE>if (BitUtil.check(mask, 0)) {<NEW_LINE>position.setValid(true);<NEW_LINE>position.setLongitude(buf.readFloatLE());<NEW_LINE>position.setLatitude(buf.readFloatLE());<NEW_LINE>position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));<NEW_LINE>int status = buf.readUnsignedByte();<NEW_LINE>position.set(Position.KEY_SATELLITES, BitUtil.to(status, 4));<NEW_LINE>position.set(Position.KEY_HDOP, BitUtil.from(status, 4));<NEW_LINE>position.setCourse(buf.readUnsignedByte() * 2);<NEW_LINE>position.setAltitude(buf.readUnsignedShortLE());<NEW_LINE>position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());<NEW_LINE>}<NEW_LINE>if (BitUtil.check(mask, 1)) {<NEW_LINE>position.set(Position.KEY_INPUT, buf.readUnsignedShortLE());<NEW_LINE>}<NEW_LINE>for (int i = 1; i <= 8; i++) {<NEW_LINE>if (BitUtil.check(mask, i + 1)) {<NEW_LINE>position.set(Position.PREFIX_ADC + i, buf.readUnsignedShortLE());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (BitUtil.check(mask, 10)) {<NEW_LINE>buf.skipBytes(4);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(mask, 11)) {<NEW_LINE>buf.skipBytes(4);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(mask, 12)) {<NEW_LINE>position.set("fuel1", buf.readUnsignedShort());<NEW_LINE>}<NEW_LINE>if (BitUtil.check(mask, 13)) {<NEW_LINE>position.set("fuel2", buf.readUnsignedShort());<NEW_LINE>}<NEW_LINE>if (BitUtil.check(mask, 14)) {<NEW_LINE>int mcc = buf.readUnsignedShortLE();<NEW_LINE><MASK><NEW_LINE>int lac = buf.readUnsignedShortLE();<NEW_LINE>int cid = buf.readUnsignedShortLE();<NEW_LINE>// time advance<NEW_LINE>buf.readUnsignedByte();<NEW_LINE>int rssi = -buf.readUnsignedByte();<NEW_LINE>position.setNetwork(new Network(CellTower.from(mcc, mnc, lac, cid, rssi)));<NEW_LINE>}<NEW_LINE>} | int mnc = buf.readUnsignedByte(); |
1,195,343 | public static void main(String[] args) {<NEW_LINE>if (args.length != 6) {<NEW_LINE>System.out.println(args.length);<NEW_LINE>printUsage();<NEW_LINE>exit(1);<NEW_LINE>}<NEW_LINE>String BUCKET_NAME = args[0];<NEW_LINE>String API_KEY = args[1];<NEW_LINE>String SERVICE_INSTANCE_ID = args[2];<NEW_LINE>String bucketFile = args[3];<NEW_LINE>String oldPmapFile = args[4];<NEW_LINE>String newPmapFile = args[5];<NEW_LINE>_cosClient = createClient(API_KEY, SERVICE_INSTANCE_ID, ENDPOINT_URL, LOCATION);<NEW_LINE>System.out.println("Downloading file from storage: " + bucketFile + " to local: " + oldPmapFile);<NEW_LINE>try {<NEW_LINE>downloadFile(_cosClient, BUCKET_NAME, bucketFile, oldPmapFile);<NEW_LINE>} catch (AmazonS3Exception s3Execpetion) {<NEW_LINE>System.out.println("Download failed with: " + s3Execpetion.getMessage());<NEW_LINE>_cosClient.shutdown();<NEW_LINE>exit(1);<NEW_LINE>}<NEW_LINE>int oldRss = getRssFromFile(oldPmapFile);<NEW_LINE>int newRss = getRssFromFile(newPmapFile);<NEW_LINE>boolean rssRegression = false;<NEW_LINE>if (oldRss != -1 && newRss != -1) {<NEW_LINE>System.out.println("Old RSS: " + oldRss);<NEW_LINE>System.out.println("New RSS: " + newRss);<NEW_LINE>rssRegression = newRss > (oldRss * 1.1);<NEW_LINE>System.out.println("Regression: " + rssRegression);<NEW_LINE>System.out.println(<MASK><NEW_LINE>uploadObject(_cosClient, BUCKET_NAME, bucketFile, newPmapFile);<NEW_LINE>}<NEW_LINE>_cosClient.shutdown();<NEW_LINE>if (rssRegression) {<NEW_LINE>exit(1);<NEW_LINE>} else {<NEW_LINE>exit(0);<NEW_LINE>}<NEW_LINE>} | "Uploading new pmap file to storage: " + bucketFile + " from local: " + oldPmapFile); |
907,693 | public static void horizontal5(Kernel1D_S32 kernel, GrayS16 input, GrayI16 output, int skip) {<NEW_LINE>final short[] dataSrc = input.data;<NEW_LINE>final short[] dataDst = output.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int <MASK><NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int widthEnd = UtilDownConvolve.computeMaxSide(input.width, skip, radius);<NEW_LINE>final int height = input.getHeight();<NEW_LINE>final int offsetX = UtilDownConvolve.computeOffset(skip, radius);<NEW_LINE>for (int i = 0; i < height; i++) {<NEW_LINE>int indexDst = output.startIndex + i * output.stride + offsetX / skip;<NEW_LINE>int j = input.startIndex + i * input.stride - radius;<NEW_LINE>final int jEnd = j + widthEnd;<NEW_LINE>for (j += offsetX; j <= jEnd; j += skip) {<NEW_LINE>int indexSrc = j;<NEW_LINE>int total = (dataSrc[indexSrc++]) * k1;<NEW_LINE>total += (dataSrc[indexSrc++]) * k2;<NEW_LINE>total += (dataSrc[indexSrc++]) * k3;<NEW_LINE>total += (dataSrc[indexSrc++]) * k4;<NEW_LINE>total += (dataSrc[indexSrc]) * k5;<NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | k2 = kernel.data[1]; |
254,138 | private BType createMatchingRecordType(BLangErrorFieldMatchPatterns errorFieldMatchPatterns) {<NEW_LINE>BRecordType detailRecordType = createAnonRecordType(errorFieldMatchPatterns.pos);<NEW_LINE>List<BLangSimpleVariable> typeDefFields = new ArrayList<>();<NEW_LINE>for (BLangNamedArgMatchPattern bindingPattern : errorFieldMatchPatterns.namedArgMatchPatterns) {<NEW_LINE>Name fieldName = <MASK><NEW_LINE>BVarSymbol declaredVarSym = bindingPattern.declaredVars.get(fieldName.value);<NEW_LINE>if (declaredVarSym == null) {<NEW_LINE>// constant match pattern expr, not needed for detail record type<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>BType fieldType = declaredVarSym.type;<NEW_LINE>BVarSymbol fieldSym = new BVarSymbol(Flags.PUBLIC, fieldName, detailRecordType.tsymbol.pkgID, fieldType, detailRecordType.tsymbol, bindingPattern.pos, VIRTUAL);<NEW_LINE>detailRecordType.fields.put(fieldName.value, new BField(fieldName, bindingPattern.pos, fieldSym));<NEW_LINE>detailRecordType.tsymbol.scope.define(fieldName, fieldSym);<NEW_LINE>typeDefFields.add(ASTBuilderUtil.createVariable(null, fieldName.value, fieldType, null, fieldSym));<NEW_LINE>}<NEW_LINE>BLangRecordTypeNode recordTypeNode = TypeDefBuilderHelper.createRecordTypeNode(typeDefFields, detailRecordType, errorFieldMatchPatterns.pos);<NEW_LINE>recordTypeNode.initFunction = TypeDefBuilderHelper.createInitFunctionForRecordType(recordTypeNode, env, names, symTable);<NEW_LINE>TypeDefBuilderHelper.createTypeDefinitionForTSymbol(detailRecordType, detailRecordType.tsymbol, recordTypeNode, env);<NEW_LINE>return detailRecordType;<NEW_LINE>} | names.fromIdNode(bindingPattern.argName); |
1,704,776 | public final BlockContext block() throws RecognitionException {<NEW_LINE>BlockContext _localctx = new BlockContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 158, RULE_block);<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(992);<NEW_LINE>match(LBRACE);<NEW_LINE>setState(994);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(getInterpreter().adaptivePredict(_input, 99, _ctx)) {<NEW_LINE>case 1:<NEW_LINE>{<NEW_LINE>setState(993);<NEW_LINE>sep();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>setState(996);<NEW_LINE>blockStatementsOpt();<NEW_LINE>setState(997);<NEW_LINE>match(RBRACE);<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE><MASK><NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _errHandler.reportError(this, re); |
634,511 | public void renameFile(Event actionEvent) {<NEW_LINE>RenameDialog dialog = RenameDialog.create();<NEW_LINE>Path path = fileSystemView.getSelectionModel().getSelectedItem().getValue().getPath();<NEW_LINE>TextField editor = dialog.getEditor();<NEW_LINE>editor.setText(path.getFileName().toString());<NEW_LINE>Consumer<String> consumer = result -> {<NEW_LINE>if (dialog.isShowing()) {<NEW_LINE>dialog.hide();<NEW_LINE>}<NEW_LINE>threadService.runTaskLater(() -> {<NEW_LINE>if (result.trim().matches("^[^\\\\/:?*\"<>|]+$")) {<NEW_LINE>IOHelper.move(path, path.getParent().resolve(result.trim()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>};<NEW_LINE>editor.setOnAction(event -> {<NEW_LINE>consumer.accept(editor.getText());<NEW_LINE>});<NEW_LINE>if (!Files.isDirectory(path)) {<NEW_LINE>int extensionIndex = editor.<MASK><NEW_LINE>if (extensionIndex > 0) {<NEW_LINE>threadService.runActionLater(() -> {<NEW_LINE>editor.selectRange(0, extensionIndex);<NEW_LINE>}, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dialog.showAndWait().ifPresent(consumer);<NEW_LINE>} | getText().lastIndexOf("."); |
663,558 | public static int mainInt(String... args) throws Exception {<NEW_LINE>Args processed = new Args();<NEW_LINE>JCommander jCommander = new JCommander(processed);<NEW_LINE>jCommander.setCaseSensitiveOptions(false);<NEW_LINE>try {<NEW_LINE>jCommander.parse(args);<NEW_LINE>} catch (ParameterException ex) {<NEW_LINE>System.err.print(ex.getMessage() + "\n" + printUsage(jCommander));<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>if (processed.help) {<NEW_LINE>System.err.print(printUsage(jCommander));<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>warnAboutLegacyOptions(processed);<NEW_LINE>Path resultsPath = Paths.get(processed<MASK><NEW_LINE>Files.createDirectories(resultsPath);<NEW_LINE>String suite = processed.htmlSuite.get(2);<NEW_LINE>String startURL = processed.htmlSuite.get(1);<NEW_LINE>String[] browsers = new String[] { processed.htmlSuite.get(0) };<NEW_LINE>HTMLLauncher launcher = new HTMLLauncher();<NEW_LINE>boolean passed = true;<NEW_LINE>for (String browser : browsers) {<NEW_LINE>// Turns out that Windows doesn't like "*" in a path name<NEW_LINE>String reportFileName = browser.contains(" ") ? browser.substring(0, browser.indexOf(' ')) : browser;<NEW_LINE>File results = resultsPath.resolve(reportFileName.substring(1) + ".results.html").toFile();<NEW_LINE>String result = "FAILED";<NEW_LINE>try {<NEW_LINE>long timeout;<NEW_LINE>try {<NEW_LINE>timeout = Long.parseLong(processed.timeout);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>System.err.println("Timeout does not appear to be a number: " + processed.timeout);<NEW_LINE>return -2;<NEW_LINE>}<NEW_LINE>result = launcher.runHTMLSuite(browser, startURL, suite, results, timeout, processed.userExtensions);<NEW_LINE>passed &= "PASSED".equals(result);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>log.log(Level.WARNING, "Test of browser failed: " + browser, e);<NEW_LINE>passed = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return passed ? 1 : 0;<NEW_LINE>} | .htmlSuite.get(3)); |
759,910 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(getContentView());<NEW_LINE>// if a parameter was passed to open an account within a specific book, then switch<NEW_LINE>String bookUID = getIntent().getStringExtra(UxArgument.BOOK_UID);<NEW_LINE>if (bookUID != null && !bookUID.equals(BooksDbAdapter.getInstance().getActiveBookUID())) {<NEW_LINE>BookUtils.activateBook(bookUID);<NEW_LINE>}<NEW_LINE>ButterKnife.bind(this);<NEW_LINE>setSupportActionBar(mToolbar);<NEW_LINE>final ActionBar actionBar = getSupportActionBar();<NEW_LINE>if (actionBar != null) {<NEW_LINE>actionBar.setHomeButtonEnabled(true);<NEW_LINE>actionBar.setDisplayHomeAsUpEnabled(true);<NEW_LINE>actionBar.setTitle(getTitleRes());<NEW_LINE>}<NEW_LINE>mToolbarProgress.getIndeterminateDrawable().setColorFilter(Color.<MASK><NEW_LINE>View headerView = mNavigationView.getHeaderView(0);<NEW_LINE>headerView.findViewById(R.id.drawer_title).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>onClickAppTitle(v);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mBookNameTextView = (TextView) headerView.findViewById(R.id.book_name);<NEW_LINE>mBookNameTextView.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>onClickBook(v);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>updateActiveBookName();<NEW_LINE>setUpNavigationDrawer();<NEW_LINE>} | WHITE, PorterDuff.Mode.SRC_IN); |
1,755,550 | private ObjectNode updateIntegrationResponse(OperationShape shape, Map<CorsHeader, String> corsHeaders, Set<String> deduced, ObjectNode response) {<NEW_LINE>Map<CorsHeader, String> responseHeaders = new HashMap<>(corsHeaders);<NEW_LINE>ObjectNode responseParams = response.getObjectMember(RESPONSE_PARAMETERS_KEY).orElseGet(Node::objectNode);<NEW_LINE>// Created a sorted set of all headers exposed in the integration.<NEW_LINE>Set<String> headersToExpose = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);<NEW_LINE>headersToExpose.addAll(deduced);<NEW_LINE>responseParams.getStringMap().keySet().stream().filter(parameterName -> parameterName.startsWith(HEADER_PREFIX)).map(parameterName -> parameterName.substring(HEADER_PREFIX.length())).forEach(headersToExpose::add);<NEW_LINE>String headersToExposeString = String.join(",", headersToExpose);<NEW_LINE>// If there are exposed headers, then add a new header to the integration<NEW_LINE>// that lists all of them. See https://fetch.spec.whatwg.org/#http-access-control-expose-headers.<NEW_LINE>if (!headersToExposeString.isEmpty()) {<NEW_LINE>responseHeaders.<MASK><NEW_LINE>LOGGER.fine(() -> String.format("Adding `%s` header to `%s` with value of `%s`", CorsHeader.EXPOSE_HEADERS, shape.getId(), headersToExposeString));<NEW_LINE>}<NEW_LINE>if (responseHeaders.isEmpty()) {<NEW_LINE>LOGGER.fine(() -> "No headers are exposed by " + shape.getId());<NEW_LINE>return response;<NEW_LINE>}<NEW_LINE>// Create an updated response that injects Access-Control-Expose-Headers.<NEW_LINE>ObjectNode.Builder builder = responseParams.toBuilder();<NEW_LINE>for (Map.Entry<CorsHeader, String> entry : responseHeaders.entrySet()) {<NEW_LINE>builder.withMember(HEADER_PREFIX + entry.getKey(), "'" + entry.getValue() + "'");<NEW_LINE>}<NEW_LINE>return response.withMember(RESPONSE_PARAMETERS_KEY, builder.build());<NEW_LINE>} | put(CorsHeader.EXPOSE_HEADERS, headersToExposeString); |
655,221 | public void run() {<NEW_LINE>final <MASK><NEW_LINE>String text = "";<NEW_LINE>try {<NEW_LINE>text = doc.getText(0, doc.getLength());<NEW_LINE>} catch (BadLocationException ex) {<NEW_LINE>Support.LOG.log(Level.SEVERE, null, ex);<NEW_LINE>}<NEW_LINE>final String comment = text;<NEW_LINE>Runnable r = new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>final List<StackTracePosition> stacktraces = find(comment);<NEW_LINE>if (!stacktraces.isEmpty()) {<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>underlineStacktraces(doc, textPane, stacktraces, comment);<NEW_LINE>textPane.removeMouseListener(getHyperlinkListener());<NEW_LINE>textPane.addMouseListener(getHyperlinkListener());<NEW_LINE>textPane.removeMouseMotionListener(getHyperlinkListener());<NEW_LINE>textPane.addMouseMotionListener(getHyperlinkListener());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Support.getInstance().getParallelRP().post(r);<NEW_LINE>} | StyledDocument doc = textPane.getStyledDocument(); |
73,567 | private void writeCompound(WrittenType type, NBTTagCompound compound, DataOutput to) throws IOException {<NEW_LINE>profiler.startSection("compound");<NEW_LINE>WrittenType stringType = WrittenType.getForSize(map.strings.size());<NEW_LINE>if (debug)<NEW_LINE>log("\n Compound tag count = " + compound.getSize());<NEW_LINE>to.writeByte(NbtSquishConstants.COMPLEX_COMPOUND);<NEW_LINE>writeVarInt(to, compound.getSize());<NEW_LINE>for (String key : compound.getKeySet()) {<NEW_LINE>profiler.startSection("entry");<NEW_LINE>NBTBase nbt = compound.getTag(key);<NEW_LINE>profiler.startSection("index_value");<NEW_LINE>int index = map.indexOfTag(nbt);<NEW_LINE>profiler.endSection();<NEW_LINE>if (debug)<NEW_LINE>log("\n \"" + key + "\" -> " + index + " (" <MASK><NEW_LINE>profiler.startSection("index_key");<NEW_LINE>stringType.writeIndex(to, map.strings.indexOf(key));<NEW_LINE>profiler.endSection();<NEW_LINE>type.writeIndex(to, index);<NEW_LINE>profiler.endSection();<NEW_LINE>}<NEW_LINE>profiler.endSection();<NEW_LINE>} | + safeToString(nbt) + ")"); |
1,287,741 | protected Broadcaster removeAtmosphereResource(AtmosphereResource r, boolean executeDone) {<NEW_LINE>if (destroyed.get()) {<NEW_LINE>logger.debug(DESTROYED, getID(), "removeAtmosphereResource(AtmosphereResource r)");<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>boolean <MASK><NEW_LINE>if (removed) {<NEW_LINE>if (r.isSuspended()) {<NEW_LINE>logger.trace("Excluded from {} : {}", getID(), r.uuid());<NEW_LINE>bc.getBroadcasterCache().excludeFromCache(getID(), r);<NEW_LINE>}<NEW_LINE>notifyOnRemoveAtmosphereResourceListener(r);<NEW_LINE>} else {<NEW_LINE>logger.trace("Unable to remove {} from {}", r.uuid(), getID());<NEW_LINE>}<NEW_LINE>r.removeBroadcaster(this);<NEW_LINE>if (!removed)<NEW_LINE>return this;<NEW_LINE>logger.trace("Removing AtmosphereResource {} for Broadcaster {}", r.uuid(), name);<NEW_LINE>writeQueues.remove(r.uuid());<NEW_LINE>// Here we need to make sure we aren't in the process of broadcasting and unlock the Future.<NEW_LINE>if (executeDone) {<NEW_LINE>AtmosphereResourceImpl aImpl = AtmosphereResourceImpl.class.cast(r);<NEW_LINE>BroadcasterFuture f = (BroadcasterFuture) aImpl.getRequest(false).getAttribute(getID());<NEW_LINE>if (f != null && !f.isDone() && !f.isCancelled()) {<NEW_LINE>aImpl.getRequest(false).removeAttribute(getID());<NEW_LINE>entryDone(f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | removed = resources.remove(r); |
897,635 | public void run() {<NEW_LINE>double CAMERA_PADDING = DEFAULT_CAMERA_PADDING;<NEW_LINE>try {<NEW_LINE>if (mParams.has("camera")) {<NEW_LINE>JSONObject camera = mParams.getJSONObject("camera");<NEW_LINE>if (camera.has("padding")) {<NEW_LINE>CAMERA_PADDING = camera.getDouble("padding");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>map.moveCamera(CameraUpdateFactory.newLatLngBounds(initCameraBounds, (int) (CAMERA_PADDING * density)));<NEW_LINE>CameraPosition.Builder builder = CameraPosition.builder(map.getCameraPosition());<NEW_LINE>try {<NEW_LINE>if (mParams.has("camera")) {<NEW_LINE>Boolean additionalParams = false;<NEW_LINE>JSONObject camera = mParams.getJSONObject("camera");<NEW_LINE>if (camera.has("bearing")) {<NEW_LINE>builder.bearing((float) camera.getDouble("bearing"));<NEW_LINE>additionalParams = true;<NEW_LINE>}<NEW_LINE>if (camera.has("tilt")) {<NEW_LINE>builder.tilt((float) camera.getDouble("tilt"));<NEW_LINE>additionalParams = true;<NEW_LINE>}<NEW_LINE>if (additionalParams) {<NEW_LINE>map.moveCamera(CameraUpdateFactory.newCameraPosition<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>mapView.setVisibility(View.VISIBLE);<NEW_LINE>mCallback.success();<NEW_LINE>// if (map.getMapType() == GoogleMap.MAP_TYPE_NONE) {<NEW_LINE>PluginMap.this.onMapLoaded();<NEW_LINE>// }<NEW_LINE>// fitBounds(initCameraBounds, CAMERA_PADDING);<NEW_LINE>} | (builder.build())); |
1,506,648 | private Dimension layoutSize(@Nonnull Function<Component, Dimension> size) {<NEW_LINE>Dimension titleSize = myTitleComponent == null ? new Dimension() : size.fun(myTitleComponent);<NEW_LINE>Dimension centeredSize = myCenteredComponent == null ? new Dimension() : size.fun(myCenteredComponent);<NEW_LINE>Dimension actionSize = myActionPanel == null ? new Dimension() : size.fun(myActionPanel);<NEW_LINE>Dimension expandSize = myExpandAction == null || myLayoutData.showMinSize ? new Dimension() : size.fun(myExpandAction);<NEW_LINE>int height = myLayoutData.configuration.topSpaceHeight + titleSize.height + centeredSize.height + Math.max(actionSize.height, expandSize.height) + myLayoutData.configuration.bottomSpaceHeight;<NEW_LINE>if (titleSize.height > 0 && centeredSize.height > 0) {<NEW_LINE>height += myLayoutData.configuration.titleContentSpaceHeight;<NEW_LINE>}<NEW_LINE>if (centeredSize.height > 0 && actionSize.height > 0) {<NEW_LINE>height += myLayoutData.configuration.contentActionsSpaceHeight;<NEW_LINE>}<NEW_LINE>if (titleSize.height > 0 && actionSize.height > 0) {<NEW_LINE>height += myLayoutData.configuration.titleActionsSpaceHeight;<NEW_LINE>}<NEW_LINE>int titleWidth = titleSize<MASK><NEW_LINE>int centerWidth = centeredSize.width + myLayoutData.configuration.closeOffset;<NEW_LINE>int actionWidth = actionSize.width + expandSize.width;<NEW_LINE>int width = Math.max(centerWidth, Math.max(titleWidth, actionWidth));<NEW_LINE>if (!myLayoutData.showFullContent) {<NEW_LINE>width = Math.min(width, BalloonLayoutConfiguration.MaxWidth());<NEW_LINE>}<NEW_LINE>width = Math.max(width, BalloonLayoutConfiguration.MinWidth());<NEW_LINE>return new Dimension(width, height);<NEW_LINE>} | .width + myLayoutData.configuration.closeOffset; |
245,731 | public EbsBlockDevice unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>EbsBlockDevice ebsBlockDevice = new EbsBlockDevice();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("VolumeSpecification", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>ebsBlockDevice.setVolumeSpecification(VolumeSpecificationJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("Device", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>ebsBlockDevice.setDevice(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return ebsBlockDevice;<NEW_LINE>} | ().unmarshall(context)); |
1,354,370 | protected Object readElement(org.w3c.dom.Element element) throws java.io.IOException, ClassNotFoundException {<NEW_LINE>NodeList targetModuleElements = element.getElementsByTagName(E_TARGET_MODULE);<NEW_LINE>TargetModule[] targetModules = new TargetModule[targetModuleElements.getLength()];<NEW_LINE>for (int i = 0; i < targetModules.length; i++) {<NEW_LINE>Element te = (Element) targetModuleElements.item(i);<NEW_LINE>String id = te.getAttribute(A_ID);<NEW_LINE>String url = te.getAttribute(A_INSTANCE_URL);<NEW_LINE>String targetName = te.getAttribute(A_TARGET_NAME);<NEW_LINE>String timestamp = te.getAttribute(A_TIMESTAMP);<NEW_LINE>String contentDir = te.getAttribute(A_CONTENT_DIR);<NEW_LINE>String contextRoot = te.getAttribute(A_CONTEXT_ROOT);<NEW_LINE>if (id == null || url == null || targetName == null) {<NEW_LINE>throw new IOException(NbBundle.getMessage(TargetModuleConverter.class, "MSG_TargetModuleParseError"));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>targetModules[i] = new TargetModule(id, url, targetName, Long.parseLong(timestamp), contentDir, contextRoot);<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>throw new IOException(nfe);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | return new TargetModule.List(targetModules); |
415,626 | static QuadTreeImpl buildQuadTree(MultiPathImpl multipathImpl) {<NEW_LINE>Envelope2D extent = new Envelope2D();<NEW_LINE>multipathImpl.queryLooseEnvelope2D(extent);<NEW_LINE>QuadTreeImpl quad_tree_impl = new QuadTreeImpl(extent, 8);<NEW_LINE>int hint_index = -1;<NEW_LINE>SegmentIteratorImpl seg_iter = multipathImpl.querySegmentIterator();<NEW_LINE>Envelope2D boundingbox = new Envelope2D();<NEW_LINE>boolean resized_extent = false;<NEW_LINE>while (seg_iter.nextPath()) {<NEW_LINE>while (seg_iter.hasNextSegment()) {<NEW_LINE>Segment segment = seg_iter.nextSegment();<NEW_LINE>int index = seg_iter.getStartPointIndex();<NEW_LINE>segment.queryEnvelope2D(boundingbox);<NEW_LINE>hint_index = quad_tree_impl.<MASK><NEW_LINE>if (hint_index == -1) {<NEW_LINE>if (resized_extent)<NEW_LINE>throw GeometryException.GeometryInternalError();<NEW_LINE>// resize extent<NEW_LINE>multipathImpl.calculateEnvelope2D(extent, false);<NEW_LINE>resized_extent = true;<NEW_LINE>quad_tree_impl.reset(extent, 8);<NEW_LINE>seg_iter.resetToFirstPath();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return quad_tree_impl;<NEW_LINE>} | insert(index, boundingbox, hint_index); |
1,778,408 | public void handleBinding() {<NEW_LINE>WSSecTimestamp timestamp = createTimestamp();<NEW_LINE>handleLayout(timestamp);<NEW_LINE>assertPolicy(sbinding.getName());<NEW_LINE>if (sbinding.getProtectionOrder() == AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning) {<NEW_LINE>doEncryptBeforeSign();<NEW_LINE>assertPolicy(new QName(sbinding.getName().getNamespaceURI<MASK><NEW_LINE>} else {<NEW_LINE>doSignBeforeEncrypt();<NEW_LINE>assertPolicy(new QName(sbinding.getName().getNamespaceURI(), SPConstants.SIGN_BEFORE_ENCRYPTING));<NEW_LINE>}<NEW_LINE>reshuffleTimestamp();<NEW_LINE>assertAlgorithmSuite(sbinding.getAlgorithmSuite());<NEW_LINE>assertWSSProperties(sbinding.getName().getNamespaceURI());<NEW_LINE>assertTrustProperties(sbinding.getName().getNamespaceURI());<NEW_LINE>assertPolicy(new QName(sbinding.getName().getNamespaceURI(), SPConstants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY));<NEW_LINE>} | (), SPConstants.ENCRYPT_BEFORE_SIGNING)); |
908,713 | final ListOrganizationPortfolioAccessResult executeListOrganizationPortfolioAccess(ListOrganizationPortfolioAccessRequest listOrganizationPortfolioAccessRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listOrganizationPortfolioAccessRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListOrganizationPortfolioAccessRequest> request = null;<NEW_LINE>Response<ListOrganizationPortfolioAccessResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListOrganizationPortfolioAccessRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listOrganizationPortfolioAccessRequest));<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, "Service Catalog");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListOrganizationPortfolioAccess");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListOrganizationPortfolioAccessResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListOrganizationPortfolioAccessResultJsonUnmarshaller());<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,293,665 | private synchronized boolean updateCandidates() {<NEW_LINE>boolean affected = false;<NEW_LINE>final JavaPlatform[] newPlatforms = jpm.getInstalledPlatforms();<NEW_LINE>final Map<JavaPlatform, PropertyChangeListener> oldPlatforms = new HashMap<>(platforms);<NEW_LINE>final Map<JavaPlatform, PropertyChangeListener> newState = new <MASK><NEW_LINE>for (JavaPlatform jp : newPlatforms) {<NEW_LINE>PropertyChangeListener l;<NEW_LINE>if ((l = oldPlatforms.remove(jp)) != null) {<NEW_LINE>newState.put(jp, l);<NEW_LINE>} else if (contains(jp, artifact)) {<NEW_LINE>affected = true;<NEW_LINE>l = WeakListeners.propertyChange(this, this.jpm);<NEW_LINE>jp.addPropertyChangeListener(l);<NEW_LINE>newState.put(jp, l);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<JavaPlatform, PropertyChangeListener> e : oldPlatforms.entrySet()) {<NEW_LINE>affected = true;<NEW_LINE>e.getKey().removePropertyChangeListener(e.getValue());<NEW_LINE>}<NEW_LINE>platforms = newState;<NEW_LINE>return affected;<NEW_LINE>} | LinkedHashMap<>(newPlatforms.length); |
1,457,579 | public static byte[] rocketMQProtocolEncode(RemotingCommand cmd) {<NEW_LINE>// String remark<NEW_LINE>byte[] remarkBytes = null;<NEW_LINE>int remarkLen = 0;<NEW_LINE>if (cmd.getRemark() != null && cmd.getRemark().length() > 0) {<NEW_LINE>remarkBytes = cmd.getRemark().getBytes(CHARSET_UTF8);<NEW_LINE>remarkLen = remarkBytes.length;<NEW_LINE>}<NEW_LINE>// HashMap<String, String> extFields<NEW_LINE>byte[] extFieldsBytes = null;<NEW_LINE>int extLen = 0;<NEW_LINE>if (cmd.getExtFields() != null && !cmd.getExtFields().isEmpty()) {<NEW_LINE>extFieldsBytes = mapSerialize(cmd.getExtFields());<NEW_LINE>extLen = extFieldsBytes.length;<NEW_LINE>}<NEW_LINE>int totalLen = calTotalLen(remarkLen, extLen);<NEW_LINE>ByteBuffer headerBuffer = ByteBuffer.allocate(totalLen);<NEW_LINE>// int code(~32767)<NEW_LINE>headerBuffer.putShort((short) cmd.getCode());<NEW_LINE>// LanguageCode language<NEW_LINE>headerBuffer.put(cmd.getLanguage().getCode());<NEW_LINE>// int version(~32767)<NEW_LINE>headerBuffer.putShort((short) cmd.getVersion());<NEW_LINE>// int opaque<NEW_LINE>headerBuffer.putInt(cmd.getOpaque());<NEW_LINE>// int flag<NEW_LINE>headerBuffer.putInt(cmd.getFlag());<NEW_LINE>// String remark<NEW_LINE>if (remarkBytes != null) {<NEW_LINE><MASK><NEW_LINE>headerBuffer.put(remarkBytes);<NEW_LINE>} else {<NEW_LINE>headerBuffer.putInt(0);<NEW_LINE>}<NEW_LINE>// HashMap<String, String> extFields;<NEW_LINE>if (extFieldsBytes != null) {<NEW_LINE>headerBuffer.putInt(extFieldsBytes.length);<NEW_LINE>headerBuffer.put(extFieldsBytes);<NEW_LINE>} else {<NEW_LINE>headerBuffer.putInt(0);<NEW_LINE>}<NEW_LINE>return headerBuffer.array();<NEW_LINE>} | headerBuffer.putInt(remarkBytes.length); |
842,034 | public Movie toMovie() throws IOException {<NEW_LINE>ArrayList<Actor> actors = new ArrayList<>();<NEW_LINE>if (actor != null) {<NEW_LINE>actors = new ArrayList<>(actor.size());<NEW_LINE>for (KodiXmlActorBean currentActor : actor) {<NEW_LINE>actors.add(currentActor.toActor());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Thumb[] posterThumbs;<NEW_LINE>if (thumb != null) {<NEW_LINE>posterThumbs = new Thumb[thumb.length];<NEW_LINE>for (int i = 0; i < posterThumbs.length; i++) {<NEW_LINE>try {<NEW_LINE>posterThumbs[i] = new Thumb(thumb[i]);<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>System.out.println("Ignoring Thumb url: " + thumb[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>posterThumbs = new Thumb[0];<NEW_LINE>}<NEW_LINE>Thumb[] fanartThumbs;<NEW_LINE>if (fanart != null && fanart.getThumb() != null) {<NEW_LINE>fanartThumbs = new Thumb[fanart.getThumb().length];<NEW_LINE>for (int i = 0; i < fanartThumbs.length; i++) {<NEW_LINE>try {<NEW_LINE>fanartThumbs[i] = new Thumb(fanart.getThumb()[i]);<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>System.out.println("Ignoring Fanart url: " + fanart.getThumb()[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>fanartThumbs = new Thumb[0];<NEW_LINE>}<NEW_LINE>ArrayList<Genre> genres = new ArrayList<>();<NEW_LINE>if (genre != null) {<NEW_LINE>for (int i = 0; i < genre.length; i++) {<NEW_LINE>genres.add(new Genre(genre[i]));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ArrayList<Tag> tags = new ArrayList<>();<NEW_LINE>if (tag != null) {<NEW_LINE>for (int i = 0; i < tag.length; i++) {<NEW_LINE>tags.add(new Tag(tag[i]));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ArrayList<Director> directors = new ArrayList<>();<NEW_LINE>if (director != null) {<NEW_LINE>directors = new ArrayList<>(director.length);<NEW_LINE>for (int i = 0; i < director.length; i++) {<NEW_LINE>directors.add(new Director(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>Thumb[] emptyExtraFanrt = new Thumb[0];<NEW_LINE>Movie movie = new Movie(actors, directors, fanartThumbs, emptyExtraFanrt, genres, tags, new ID(id), new MPAARating(mpaa), new OriginalTitle(originaltitle), new Outline(outline), new Plot(plot), posterThumbs, new Rating(10, rating), new ReleaseDate(releasedate), new Runtime(runtime), new Set(set), new SortTitle(sorttitle), new Studio(studio), new Tagline(tagline), new Title(title), new Top250(top250), new Trailer(trailer), new Votes(votes), new Year(year));<NEW_LINE>return movie;<NEW_LINE>} | director[i], null)); |
1,590,268 | protected final AbortException abortInvalidArgument(String argument, String message, int exitCode) {<NEW_LINE>Set<String> allArguments = collectAllArguments();<NEW_LINE>int equalIndex;<NEW_LINE>String testString = argument;<NEW_LINE>if ((equalIndex = argument.indexOf('=')) != -1) {<NEW_LINE>testString = argument.substring(0, equalIndex);<NEW_LINE>}<NEW_LINE>List<String> matches = fuzzyMatch(allArguments, testString, 0.7f);<NEW_LINE>if (matches.isEmpty()) {<NEW_LINE>// try even harder<NEW_LINE>matches = fuzzyMatch(allArguments, testString, 0.5f);<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>if (message != null) {<NEW_LINE>sb.append(message);<NEW_LINE>}<NEW_LINE>if (!matches.isEmpty()) {<NEW_LINE>if (sb.length() > 0) {<NEW_LINE>sb.append(System.lineSeparator());<NEW_LINE>}<NEW_LINE>sb.append("Did you mean one of the following arguments?").append(System.lineSeparator());<NEW_LINE>Iterator<String> iterator = matches.iterator();<NEW_LINE>while (true) {<NEW_LINE>String match = iterator.next();<NEW_LINE>sb.append<MASK><NEW_LINE>if (iterator.hasNext()) {<NEW_LINE>sb.append(System.lineSeparator());<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sb.length() > 0) {<NEW_LINE>throw abort(sb.toString(), exitCode);<NEW_LINE>} else {<NEW_LINE>throw exit(exitCode);<NEW_LINE>}<NEW_LINE>} | (" ").append(match); |
1,403,945 | protected void wrapPage(StringBuilder select, Query query, boolean scan) {<NEW_LINE>String page = query.page();<NEW_LINE>// It's the first time if page is empty<NEW_LINE>if (!page.isEmpty()) {<NEW_LINE>byte[] position = PageState.fromString(page).position();<NEW_LINE>Map<HugeKeys, Object> columns = PagePosition.fromBytes(position).columns();<NEW_LINE>List<HugeKeys> idColumnNames = this.idColumnName();<NEW_LINE>List<Object> values = new ArrayList<>(idColumnNames.size());<NEW_LINE>for (HugeKeys key : idColumnNames) {<NEW_LINE>values.add<MASK><NEW_LINE>}<NEW_LINE>// Need add `where` to `select` when query is IdQuery<NEW_LINE>boolean expectWhere = scan || query.conditionsSize() == 0;<NEW_LINE>WhereBuilder where = this.newWhereBuilder(expectWhere);<NEW_LINE>if (!expectWhere) {<NEW_LINE>where.and();<NEW_LINE>}<NEW_LINE>where.gte(formatKeys(idColumnNames), values);<NEW_LINE>select.append(where.build());<NEW_LINE>}<NEW_LINE>} | (columns.get(key)); |
334,302 | public static DescribeClustersResponse unmarshall(DescribeClustersResponse describeClustersResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeClustersResponse.setRequestId(_ctx.stringValue("DescribeClustersResponse.RequestId"));<NEW_LINE>describeClustersResponse.setTotalCount(_ctx.longValue("DescribeClustersResponse.TotalCount"));<NEW_LINE>describeClustersResponse.setPageNumber(_ctx.integerValue("DescribeClustersResponse.PageNumber"));<NEW_LINE>describeClustersResponse.setPageSize<MASK><NEW_LINE>List<Cluster> clusters = new ArrayList<Cluster>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeClustersResponse.Clusters.Length"); i++) {<NEW_LINE>Cluster cluster = new Cluster();<NEW_LINE>cluster.setClusterId(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].ClusterId"));<NEW_LINE>cluster.setClusterName(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].ClusterName"));<NEW_LINE>cluster.setStatus(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].Status"));<NEW_LINE>cluster.setPayType(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].PayType"));<NEW_LINE>cluster.setCreatedTime(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].CreatedTime"));<NEW_LINE>cluster.setExpireTime(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].ExpireTime"));<NEW_LINE>cluster.setMajorVersion(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].MajorVersion"));<NEW_LINE>cluster.setMinorVersion(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].MinorVersion"));<NEW_LINE>cluster.setDataCenterCount(_ctx.integerValue("DescribeClustersResponse.Clusters[" + i + "].DataCenterCount"));<NEW_LINE>cluster.setLockMode(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].LockMode"));<NEW_LINE>cluster.setAutoRenewal(_ctx.booleanValue("DescribeClustersResponse.Clusters[" + i + "].AutoRenewal"));<NEW_LINE>cluster.setAutoRenewPeriod(_ctx.integerValue("DescribeClustersResponse.Clusters[" + i + "].AutoRenewPeriod"));<NEW_LINE>cluster.setResourceGroupId(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].ResourceGroupId"));<NEW_LINE>List<Tag> tags = new ArrayList<Tag>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeClustersResponse.Clusters[" + i + "].Tags.Length"); j++) {<NEW_LINE>Tag tag = new Tag();<NEW_LINE>tag.setKey(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].Tags[" + j + "].Key"));<NEW_LINE>tag.setValue(_ctx.stringValue("DescribeClustersResponse.Clusters[" + i + "].Tags[" + j + "].Value"));<NEW_LINE>tags.add(tag);<NEW_LINE>}<NEW_LINE>cluster.setTags(tags);<NEW_LINE>clusters.add(cluster);<NEW_LINE>}<NEW_LINE>describeClustersResponse.setClusters(clusters);<NEW_LINE>return describeClustersResponse;<NEW_LINE>} | (_ctx.integerValue("DescribeClustersResponse.PageSize")); |
815,296 | public DiscordantPairEvidence decode(final Reader<DiscordantPairEvidence> reader) throws IOException {<NEW_LINE>if (!versionChecked) {<NEW_LINE>if (!DiscordantPairEvidence.BCI_VERSION.equals(reader.getVersion())) {<NEW_LINE>throw new UserException("baf.bci file has wrong version: expected " + DiscordantPairEvidence.BCI_VERSION + " but found " + reader.getVersion());<NEW_LINE>}<NEW_LINE>versionChecked = true;<NEW_LINE>}<NEW_LINE>final DataInputStream dis = reader.getStream();<NEW_LINE>final String sample = reader.getSampleNames().get(dis.readInt());<NEW_LINE>final SAMSequenceDictionary dict = reader.getDictionary();<NEW_LINE>final String startContig = dict.getSequence(dis.readInt()).getSequenceName();<NEW_LINE>final int start = dis.readInt();<NEW_LINE>final boolean startStrand = dis.readBoolean();<NEW_LINE>final String endContig = dict.getSequence(dis.readInt()).getSequenceName();<NEW_LINE>final int end = dis.readInt();<NEW_LINE>final <MASK><NEW_LINE>return new DiscordantPairEvidence(sample, startContig, start, startStrand, endContig, end, endStrand);<NEW_LINE>} | boolean endStrand = dis.readBoolean(); |
391,411 | public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {<NEW_LINE>Authentication authentication = SecurityContextHolder.getContext().getAuthentication();<NEW_LINE>if (authentication == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Object principal = authentication.getPrincipal();<NEW_LINE>AuthenticationPrincipal annotation = findMethodAnnotation(AuthenticationPrincipal.class, parameter);<NEW_LINE>String expressionToParse = annotation.expression();<NEW_LINE>if (StringUtils.hasLength(expressionToParse)) {<NEW_LINE>StandardEvaluationContext context = new StandardEvaluationContext();<NEW_LINE>context.setRootObject(principal);<NEW_LINE>context.setVariable("this", principal);<NEW_LINE>context.setBeanResolver(this.beanResolver);<NEW_LINE>Expression expression = this.parser.parseExpression(expressionToParse);<NEW_LINE>principal = expression.getValue(context);<NEW_LINE>}<NEW_LINE>if (principal != null && !ClassUtils.isAssignable(parameter.getParameterType(), principal.getClass())) {<NEW_LINE>if (annotation.errorOnInvalidType()) {<NEW_LINE>throw new ClassCastException(principal + <MASK><NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return principal;<NEW_LINE>} | " is not assignable to " + parameter.getParameterType()); |
501,021 | public FlipperObject toFlipperObject(@Nullable ImagePerfData imagePerfData) {<NEW_LINE>if (imagePerfData == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>FlipperObject.Builder <MASK><NEW_LINE>objectJson.put("requestId", imagePerfData.getRequestId());<NEW_LINE>objectJson.put("controllerSubmitTimeMs", imagePerfData.getControllerSubmitTimeMs());<NEW_LINE>objectJson.put("controllerFinalTimeMs", imagePerfData.getControllerFinalImageSetTimeMs());<NEW_LINE>objectJson.put("imageRequestStartTimeMs", imagePerfData.getImageRequestStartTimeMs());<NEW_LINE>objectJson.put("imageRequestEndTimeMs", imagePerfData.getImageRequestEndTimeMs());<NEW_LINE>objectJson.put("imageOrigin", ImageOriginUtils.toString(imagePerfData.getImageOrigin()));<NEW_LINE>objectJson.put("isPrefetch", imagePerfData.isPrefetch());<NEW_LINE>objectJson.put("callerContext", imagePerfData.getCallerContext());<NEW_LINE>objectJson.put("imageRequest", toFlipperObject(imagePerfData.getImageRequest()));<NEW_LINE>objectJson.put("imageInfo", toFlipperObject(imagePerfData.getImageInfo()));<NEW_LINE>return objectJson.build();<NEW_LINE>} | objectJson = new FlipperObject.Builder(); |
731,420 | public static <J2 extends J> J2 indent(J j, Cursor cursor, int shift) {<NEW_LINE>JavaSourceFile cu = cursor.firstEnclosingOrThrow(JavaSourceFile.class);<NEW_LINE>TabsAndIndentsStyle tabsAndIndents = Optional.ofNullable(((SourceFile) cu).getStyle(TabsAndIndentsStyle.class)).orElse(IntelliJ.tabsAndIndents());<NEW_LINE>// noinspection unchecked<NEW_LINE>return (J2) Objects.requireNonNull(new JavaIsoVisitor<Integer>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Space visitSpace(Space space, Space.Location loc, Integer integer) {<NEW_LINE>return space.withWhitespace(shift(space.getWhitespace(), shift)).withComments(ListUtils.map(space.getComments(), comment -> comment.withSuffix(shift(comment.getSuffix(), shift))));<NEW_LINE>}<NEW_LINE><NEW_LINE>private String shift(String whitespace, int shift) {<NEW_LINE>if (!whitespace.contains("\n")) {<NEW_LINE>return whitespace;<NEW_LINE>}<NEW_LINE>return shift < 0 ? shiftLeft(tabsAndIndents, whitespace, -1 * shift) : shiftRight(tabsAndIndents, whitespace, shift);<NEW_LINE>}<NEW_LINE>}<MASK><NEW_LINE>} | .visit(j, 0)); |
880,862 | public static void main(String[] args) {<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>System.out.print("Enter size of Stack: ");<NEW_LINE>int n = sc.nextInt();<NEW_LINE>stack st = new stack(n);<NEW_LINE>boolean flag = true;<NEW_LINE>int val;<NEW_LINE>int pos = 0;<NEW_LINE>while (flag) {<NEW_LINE>System.out.println("1. Push item in Stack");<NEW_LINE><MASK><NEW_LINE>System.out.println("3. Current size of stack");<NEW_LINE>System.out.println("4. Update value at position");<NEW_LINE>System.out.println("5. View value at position");<NEW_LINE>System.out.println("6. View Stack");<NEW_LINE>System.out.println("7. Exit");<NEW_LINE>System.out.print("Enter Choice: ");<NEW_LINE>int choice = sc.nextInt();<NEW_LINE>switch(choice) {<NEW_LINE>case 1:<NEW_LINE>System.out.print("Enter value: ");<NEW_LINE>val = sc.nextInt();<NEW_LINE>st.push(val);<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>System.out.println(st.pop());<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>System.out.println(st.count());<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>System.out.print("Enter value: ");<NEW_LINE>val = sc.nextInt();<NEW_LINE>System.out.print("Enter position: ");<NEW_LINE>pos = sc.nextInt();<NEW_LINE>st.updateValue(pos, val);<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>System.out.print("Enter position: ");<NEW_LINE>pos = sc.nextInt();<NEW_LINE>st.peek(pos);<NEW_LINE>break;<NEW_LINE>case 6:<NEW_LINE>st.display();<NEW_LINE>break;<NEW_LINE>case 7:<NEW_LINE>flag = false;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>System.out.println("Invalid Choice");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>} | System.out.println("2. Pop item out from Stack"); |
735,942 | public long handle(Emulator<?> emulator) {<NEW_LINE>RegisterContext context = emulator.getContext();<NEW_LINE>UnidbgPointer object = context.getPointerArg(1);<NEW_LINE>UnidbgPointer clazz = context.getPointerArg(2);<NEW_LINE>UnidbgPointer jmethodID = context.getPointerArg(3);<NEW_LINE>UnidbgPointer va_list = context.getPointerArg(4);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("CallNonvirtualVoidMethodV object=" + object + ", clazz=" + clazz + ", jmethodID=" + jmethodID + ", va_list=" + va_list);<NEW_LINE>}<NEW_LINE>DvmObject<?> dvmObject = getObject(object.toIntPeer());<NEW_LINE>DvmClass dvmClass = classMap.get(clazz.toIntPeer());<NEW_LINE>DvmMethod dvmMethod = dvmClass == null ? null : dvmClass.<MASK><NEW_LINE>if (dvmMethod == null) {<NEW_LINE>throw new BackendException();<NEW_LINE>} else {<NEW_LINE>VaList vaList = new VaList32(emulator, DalvikVM.this, va_list, dvmMethod);<NEW_LINE>if (dvmMethod.isConstructor()) {<NEW_LINE>DvmObject<?> obj = dvmMethod.newObjectV(vaList);<NEW_LINE>Objects.requireNonNull(dvmObject).setValue(obj.value);<NEW_LINE>} else {<NEW_LINE>dvmMethod.callVoidMethodV(dvmObject, vaList);<NEW_LINE>}<NEW_LINE>if (verbose) {<NEW_LINE>System.out.printf("JNIEnv->CallNonvirtualVoidMethodV(%s, %s, %s(%s)) was called from %s%n", dvmObject, dvmClass.getClassName(), dvmMethod.methodName, vaList.formatArgs(), context.getLRPointer());<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | getMethod(jmethodID.toIntPeer()); |
1,852,523 | final ListDetectorsResult executeListDetectors(ListDetectorsRequest listDetectorsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listDetectorsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListDetectorsRequest> request = null;<NEW_LINE>Response<ListDetectorsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListDetectorsRequestProtocolMarshaller(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, "IoT Events Data");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDetectors");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListDetectorsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDetectorsResultJsonUnmarshaller());<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(listDetectorsRequest)); |
582,996 | public UpdateRecipeResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateRecipeResult updateRecipeResult = new UpdateRecipeResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return updateRecipeResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateRecipeResult.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return updateRecipeResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,587,378 | final DeletePolicyResult executeDeletePolicy(DeletePolicyRequest deletePolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deletePolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeletePolicyRequest> request = null;<NEW_LINE>Response<DeletePolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeletePolicyRequestMarshaller().marshall(super.beforeMarshalling(deletePolicyRequest));<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, "Auto Scaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeletePolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeletePolicyResult> responseHandler = new StaxResponseHandler<DeletePolicyResult>(new DeletePolicyResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,368,532 | public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'petId' is set<NEW_LINE>if (petId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/pet/{petId}".replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams <MASK><NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (apiKey != null)<NEW_LINE>localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey));<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "petstore_auth" };<NEW_LINE>return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null, false);<NEW_LINE>} | = new ArrayList<Pair>(); |
987,829 | private Future<Void> begin(OracleConnection conn, ContextInternal context) {<NEW_LINE>return executeBlocking(context, () -> {<NEW_LINE><MASK><NEW_LINE>String isolationLevel;<NEW_LINE>switch(isolation) {<NEW_LINE>case TRANSACTION_READ_COMMITTED:<NEW_LINE>isolationLevel = "READ COMMITTED";<NEW_LINE>break;<NEW_LINE>case TRANSACTION_SERIALIZABLE:<NEW_LINE>isolationLevel = "SERIALIZABLE";<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Invalid isolation level: " + isolation);<NEW_LINE>}<NEW_LINE>conn.setAutoCommit(false);<NEW_LINE>return isolationLevel;<NEW_LINE>}).compose((SQLFutureMapper<String, Boolean>) isolationLevel -> {<NEW_LINE>Flow.Publisher<Boolean> publisher = conn.prepareStatement("SET TRANSACTION ISOLATION LEVEL " + isolationLevel).unwrap(OraclePreparedStatement.class).executeAsyncOracle();<NEW_LINE>return Helper.first(publisher, context);<NEW_LINE>}).mapEmpty();<NEW_LINE>} | int isolation = conn.getTransactionIsolation(); |
490,595 | private void mergeKeycloakClients(ConfigurationChanges diffs, Device prevDev, Device dev, String deviceDN) throws NamingException {<NEW_LINE>Collection<String<MASK><NEW_LINE>for (String clientID : prevDev.getKeycloakClientIDs()) {<NEW_LINE>if (!clientIDs.contains(clientID)) {<NEW_LINE>String keycloakClientDN = keycloakClientDN(clientID, deviceDN);<NEW_LINE>destroySubcontextWithChilds(keycloakClientDN);<NEW_LINE>ConfigurationChanges.addModifiedObject(diffs, keycloakClientDN, ConfigurationChanges.ChangeType.D);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collection<String> prevClientIDs = prevDev.getKeycloakClientIDs();<NEW_LINE>for (KeycloakClient client : dev.getKeycloakClients()) {<NEW_LINE>String clientID = client.getKeycloakClientID();<NEW_LINE>if (!prevClientIDs.contains(clientID)) {<NEW_LINE>store(diffs, client, deviceDN);<NEW_LINE>} else<NEW_LINE>merge(diffs, prevDev.getKeycloakClient(clientID), client, deviceDN);<NEW_LINE>}<NEW_LINE>} | > clientIDs = dev.getKeycloakClientIDs(); |
768,578 | public void asyncReadEntry(ReadHandle lh, long firstEntry, long lastEntry, boolean isSlowestReader, final ReadEntriesCallback callback, Object ctx) {<NEW_LINE>lh.readAsync(firstEntry, lastEntry).thenAcceptAsync(ledgerEntries -> {<NEW_LINE>List<Entry> entries = Lists.newArrayList();<NEW_LINE>long totalSize = 0;<NEW_LINE>try {<NEW_LINE>for (LedgerEntry e : ledgerEntries) {<NEW_LINE>// Insert the entries at the end of the list (they will be unsorted for now)<NEW_LINE>EntryImpl entry = create(e, interceptor);<NEW_LINE>entries.add(entry);<NEW_LINE>totalSize += entry.getLength();<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>ledgerEntries.close();<NEW_LINE>}<NEW_LINE>mlFactoryMBean.recordCacheMiss(<MASK><NEW_LINE>ml.mbean.addReadEntriesSample(entries.size(), totalSize);<NEW_LINE>callback.readEntriesComplete(entries, ctx);<NEW_LINE>}, ml.getExecutor().chooseThread(ml.getName())).exceptionally(exception -> {<NEW_LINE>callback.readEntriesFailed(createManagedLedgerException(exception), ctx);<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} | entries.size(), totalSize); |
999,018 | private TranslationResults buildResults() {<NEW_LINE>TranslationResults results = new TranslationResults();<NEW_LINE>if (hasTotalClassLevelOrdering) {<NEW_LINE>for (String next : totalClassLevelOrdering) {<NEW_LINE>EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(next);<NEW_LINE>results.allInterceptorClasses.add(interceptor);<NEW_LINE>results.classInterceptorChain.add(interceptor);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (String next : defaultInterceptorChain) {<NEW_LINE>EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(next);<NEW_LINE>results.allInterceptorClasses.add(interceptor);<NEW_LINE>results.classInterceptorChain.add(interceptor);<NEW_LINE>}<NEW_LINE>for (String next : classInterceptorChain) {<NEW_LINE>EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(next);<NEW_LINE>results.allInterceptorClasses.add(interceptor);<NEW_LINE>results.classInterceptorChain.add(interceptor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Entry<MethodDescriptor, LinkedList<String>> entry : methodInterceptorsMap.entrySet()) {<NEW_LINE><MASK><NEW_LINE>List<String> interceptorClassChain = (List<String>) entry.getValue();<NEW_LINE>List<EjbInterceptor> interceptorChain = new LinkedList<EjbInterceptor>();<NEW_LINE>for (String nextClass : interceptorClassChain) {<NEW_LINE>EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(nextClass);<NEW_LINE>results.allInterceptorClasses.add(interceptor);<NEW_LINE>interceptorChain.add(interceptor);<NEW_LINE>}<NEW_LINE>results.methodInterceptorsMap.put(nextMethod, interceptorChain);<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | MethodDescriptor nextMethod = entry.getKey(); |
714,431 | final RecognizeUtteranceResult executeRecognizeUtterance(RecognizeUtteranceRequest recognizeUtteranceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(recognizeUtteranceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RecognizeUtteranceRequest> request = null;<NEW_LINE>Response<RecognizeUtteranceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RecognizeUtteranceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(recognizeUtteranceRequest));<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, "Lex Runtime V2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RecognizeUtterance");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>request.addHandlerContext(HandlerContextKey.HAS_STREAMING_INPUT, Boolean.TRUE);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RecognizeUtteranceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(false).withHasStreamingSuccessResponse(true), new RecognizeUtteranceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>request.addHandlerContext(HandlerContextKey.HAS_STREAMING_OUTPUT, Boolean.TRUE);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
877,355 | public Predicate generate(AndPredicate originalAndPredicate) {<NEW_LINE>assert rangesByPredicateIndex != null;<NEW_LINE>if (reduction == 0) {<NEW_LINE>return originalAndPredicate;<NEW_LINE>}<NEW_LINE>Predicate[] originalPredicates = originalAndPredicate.predicates;<NEW_LINE>int predicateCount = originalPredicates.length - reduction;<NEW_LINE>assert predicateCount > 0;<NEW_LINE>Predicate[] predicates = new Predicate[predicateCount];<NEW_LINE>int generated = 0;<NEW_LINE>for (int i = 0; i < originalPredicates.length; ++i) {<NEW_LINE>Range range = rangesByPredicateIndex[i];<NEW_LINE>if (range == null) {<NEW_LINE>predicates[<MASK><NEW_LINE>} else {<NEW_LINE>Predicate predicate = range.generate(originalPredicates[i]);<NEW_LINE>if (predicate != null) {<NEW_LINE>predicates[generated++] = predicate;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert generated == predicateCount;<NEW_LINE>return predicateCount == 1 ? predicates[0] : new AndPredicate(predicates);<NEW_LINE>} | generated++] = originalPredicates[i]; |
956,021 | private PointSensitivityBuilder rateForwardSensitivity(OvernightAveragedRateComputation computation, OvernightIndexRates rates) {<NEW_LINE>OvernightIndex index = computation.getIndex();<NEW_LINE>HolidayCalendar calendar = computation.getFixingCalendar();<NEW_LINE>LocalDate startFixingDate = computation.getStartDate();<NEW_LINE>LocalDate endFixingDateP1 = computation.getEndDate();<NEW_LINE>LocalDate endFixingDate = calendar.previous(endFixingDateP1);<NEW_LINE>LocalDate onRateEndDate = computation.calculateMaturityFromFixing(endFixingDate);<NEW_LINE>LocalDate onRateStartDate = computation.calculateEffectiveFromFixing(startFixingDate);<NEW_LINE>LocalDate lastNonCutOffMatDate = onRateEndDate;<NEW_LINE>int cutoffOffset = computation.getRateCutOffDays() > 1 ? computation.getRateCutOffDays() : 1;<NEW_LINE>PointSensitivityBuilder combinedPointSensitivityBuilder = PointSensitivityBuilder.none();<NEW_LINE>double accrualFactorTotal = index.getDayCount().yearFraction(onRateStartDate, onRateEndDate);<NEW_LINE>if (cutoffOffset > 1) {<NEW_LINE>// Cut-off period<NEW_LINE>List<Double> noCutOffAccrualFactorList = new ArrayList<>();<NEW_LINE>LocalDate currentFixingDate = endFixingDateP1;<NEW_LINE>LocalDate cutOffEffectiveDate;<NEW_LINE>for (int i = 0; i < cutoffOffset; i++) {<NEW_LINE><MASK><NEW_LINE>cutOffEffectiveDate = computation.calculateEffectiveFromFixing(currentFixingDate);<NEW_LINE>lastNonCutOffMatDate = computation.calculateMaturityFromEffective(cutOffEffectiveDate);<NEW_LINE>double accrualFactor = index.getDayCount().yearFraction(cutOffEffectiveDate, lastNonCutOffMatDate);<NEW_LINE>noCutOffAccrualFactorList.add(accrualFactor);<NEW_LINE>}<NEW_LINE>OvernightIndexObservation lastIndexObs = computation.observeOn(currentFixingDate);<NEW_LINE>PointSensitivityBuilder forwardRateCutOffSensitivity = rates.ratePointSensitivity(lastIndexObs);<NEW_LINE>double totalAccrualFactor = 0.0;<NEW_LINE>for (int i = 0; i < cutoffOffset - 1; i++) {<NEW_LINE>totalAccrualFactor += noCutOffAccrualFactorList.get(i);<NEW_LINE>}<NEW_LINE>forwardRateCutOffSensitivity = forwardRateCutOffSensitivity.multipliedBy(totalAccrualFactor);<NEW_LINE>combinedPointSensitivityBuilder = combinedPointSensitivityBuilder.combinedWith(forwardRateCutOffSensitivity);<NEW_LINE>}<NEW_LINE>// Approximated part<NEW_LINE>OvernightIndexObservation indexObs = computation.observeOn(onRateStartDate);<NEW_LINE>PointSensitivityBuilder approximatedInterestAndSensitivity = approximatedInterestSensitivity(indexObs, lastNonCutOffMatDate, rates);<NEW_LINE>combinedPointSensitivityBuilder = combinedPointSensitivityBuilder.combinedWith(approximatedInterestAndSensitivity);<NEW_LINE>combinedPointSensitivityBuilder = combinedPointSensitivityBuilder.multipliedBy(1.0 / accrualFactorTotal);<NEW_LINE>// final rate<NEW_LINE>return combinedPointSensitivityBuilder;<NEW_LINE>} | currentFixingDate = calendar.previous(currentFixingDate); |
1,814,919 | public void rollback() {<NEW_LINE>checkDistressed();<NEW_LINE>if (o3InError || inTransaction()) {<NEW_LINE>try {<NEW_LINE>LOG.info().$("tx rollback [name=").$(tableName).$(']').$();<NEW_LINE>if ((masterRef & 1) != 0) {<NEW_LINE>masterRef++;<NEW_LINE>}<NEW_LINE>freeColumns(false);<NEW_LINE>this.txWriter.unsafeLoadAll();<NEW_LINE>rollbackIndexes();<NEW_LINE>rollbackSymbolTables();<NEW_LINE>purgeUnusedPartitions();<NEW_LINE>configureAppendPosition();<NEW_LINE>o3InError = false;<NEW_LINE>// when we rolled transaction back, hasO3() has to be false<NEW_LINE>o3MasterRef = -1;<NEW_LINE>LOG.info().$("tx rollback complete [name=").$(tableName).$(']').$();<NEW_LINE>processCommandQueue(false);<NEW_LINE>metrics<MASK><NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOG.critical().$("could not perform rollback [name=").$(tableName).$(", msg=").$(e.getMessage()).$(']').$();<NEW_LINE>distressed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .tableWriter().incrementRollbacks(); |
1,466,024 | public static boolean isPointInsidePolygon(LatLon point, List<LatLon> polygon) {<NEW_LINE>double px = point.getLongitude();<NEW_LINE>double py = point.getLatitude();<NEW_LINE>boolean oddNodes = false;<NEW_LINE>for (int i = 0, j = polygon.size() - 1; i < polygon.size(); j = i++) {<NEW_LINE>double x1 = polygon.get(i).getLongitude();<NEW_LINE>double y1 = polygon.<MASK><NEW_LINE>double x2 = polygon.get(j).getLongitude();<NEW_LINE>double y2 = polygon.get(j).getLatitude();<NEW_LINE>if ((y1 < py && y2 >= py || y2 < py && y1 >= py) && (x1 <= px || x2 <= px)) {<NEW_LINE>if (x1 + (py - y1) / (y2 - y1) * (x2 - x1) < px) {<NEW_LINE>oddNodes = !oddNodes;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return oddNodes;<NEW_LINE>} | get(i).getLatitude(); |
1,607,258 | public void onIsManual(final I_C_Invoice_Candidate ic) {<NEW_LINE>final IInvoiceCandidateHandlerDAO handlerDAO = Services.get(IInvoiceCandidateHandlerDAO.class);<NEW_LINE>final Properties ctx = InterfaceWrapperHelper.getCtx(ic);<NEW_LINE>if (ic.isManual()) {<NEW_LINE>final IInvoiceCandBL invoiceCandBL = Services.get(IInvoiceCandBL.class);<NEW_LINE>final IOrgDAO orgDAO = Services.get(IOrgDAO.class);<NEW_LINE>final I_C_ILCandHandler handler = handlerDAO.retrieveForTable(ctx, ManualCandidateHandler.MANUAL).get(0);<NEW_LINE>final <MASK><NEW_LINE>final Timestamp todayAsTimestamp = TimeUtil.asTimestamp(today, orgDAO.getTimeZone(OrgId.ofRepoId(ic.getAD_Org_ID())));<NEW_LINE>ic.setC_ILCandHandler(handler);<NEW_LINE>ic.setInvoiceRule(X_C_Invoice_Candidate.INVOICERULE_EFFECTIVE_Immediate);<NEW_LINE>// ic.setQtyToInvoice(BigDecimal.ONE); setting this qty is don my the update process<NEW_LINE>ic.setQtyDelivered(BigDecimal.ONE);<NEW_LINE>ic.setQtyOrdered(BigDecimal.ONE);<NEW_LINE>ic.setDateToInvoice(todayAsTimestamp);<NEW_LINE>// we have no source<NEW_LINE>ic.setAD_Table_ID(0);<NEW_LINE>ic.setRecord_ID(0);<NEW_LINE>ic.setC_Invoice_Candidate_Agg(null);<NEW_LINE>Services.get(IAggregationBL.class).resetHeaderAggregationKey(ic);<NEW_LINE>ic.setLineAggregationKey(null);<NEW_LINE>//<NEW_LINE>invoiceCandBL.set_QtyInvoiced_NetAmtInvoiced_Aggregation(ctx, ic);<NEW_LINE>//<NEW_LINE>if (ic.getBill_BPartner_ID() > 0) {<NEW_LINE>setPricingSystem(ctx, ic);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ic.setC_ILCandHandler(null);<NEW_LINE>ic.setInvoiceRule(null);<NEW_LINE>ic.setQtyToInvoice_Override(BigDecimal.ZERO);<NEW_LINE>// we have no source<NEW_LINE>ic.setAD_Table_ID(0);<NEW_LINE>ic.setRecord_ID(0);<NEW_LINE>ic.setC_Invoice_Candidate_Agg(null);<NEW_LINE>ic.setLineAggregationKey(null);<NEW_LINE>}<NEW_LINE>} | LocalDate today = invoiceCandBL.getToday(); |
1,395,126 | public void createSchema(PhysicalPlan plan) throws MetadataException, CheckConsistencyException {<NEW_LINE>List<PartialPath> storageGroups = new ArrayList<>();<NEW_LINE>// for InsertPlan, try to just use deviceIds to get related storage groups because there's no<NEW_LINE>// need to call getPaths to concat deviceId and sensor as they will gain same result,<NEW_LINE>// for CreateTimeSeriesPlan, use getPath() to get timeseries to get related storage group,<NEW_LINE>// for CreateMultiTimeSeriesPlan, use getPaths() to get all timeseries to get related storage<NEW_LINE>// groups.<NEW_LINE>if (plan instanceof BatchPlan) {<NEW_LINE>storageGroups.addAll(getStorageGroups(getValidStorageGroups((BatchPlan) plan)));<NEW_LINE>} else if (plan instanceof InsertRowPlan || plan instanceof InsertTabletPlan) {<NEW_LINE>storageGroups.addAll(getStorageGroups(Collections.singletonList(((InsertPlan) plan).getDevicePath())));<NEW_LINE>} else if (plan instanceof CreateTimeSeriesPlan) {<NEW_LINE>storageGroups.addAll(getStorageGroups(Collections.singletonList(((CreateTimeSeriesPlan) plan).getPath())));<NEW_LINE>} else if (plan instanceof CreateAlignedTimeSeriesPlan) {<NEW_LINE>storageGroups.addAll(getStorageGroups(Collections.singletonList(((CreateAlignedTimeSeriesPlan) plan<MASK><NEW_LINE>} else if (plan instanceof SetTemplatePlan) {<NEW_LINE>storageGroups.addAll(getStorageGroups(Collections.singletonList(new PartialPath(((SetTemplatePlan) plan).getPrefixPath()))));<NEW_LINE>} else {<NEW_LINE>storageGroups.addAll(getStorageGroups(plan.getPaths()));<NEW_LINE>}<NEW_LINE>// create storage groups<NEW_LINE>createStorageGroups(storageGroups);<NEW_LINE>// need to verify the storage group is created<NEW_LINE>verifyCreatedSgSuccess(storageGroups, plan);<NEW_LINE>// try to create timeseries for insertPlan<NEW_LINE>if (plan instanceof InsertPlan && !createTimeseries((InsertPlan) plan)) {<NEW_LINE>throw new MetadataException("Failed to create timeseries from InsertPlan automatically.");<NEW_LINE>}<NEW_LINE>} | ).getPrefixPath()))); |
268,016 | private void checkAmbiguousOptionalArguments(CoreMethod coreMethod, ExecutableElement specializationMethod, Specialization specializationAnnotation) {<NEW_LINE>List<? extends VariableElement> parameters = specializationMethod.getParameters();<NEW_LINE>int n = getLastParameterIndex(parameters);<NEW_LINE>if (coreMethod.alwaysInlined()) {<NEW_LINE>if (!processor.isSameType(parameters.get(n).asType(), processor.rootCallTargetType)) {<NEW_LINE>processor.error("last argument must be a RootCallTarget for alwaysInlined ", specializationMethod);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>n--;<NEW_LINE>}<NEW_LINE>if (coreMethod.needsBlock() && !coreMethod.alwaysInlined()) {<NEW_LINE>if (n < 0) {<NEW_LINE>processor.error("invalid block method parameter position for", specializationMethod);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkParameterBlock(parameters.get(n));<NEW_LINE>// Ignore block argument.<NEW_LINE>n--;<NEW_LINE>}<NEW_LINE>if (coreMethod.alwaysInlined()) {<NEW_LINE>// All other arguments are packed as Object[]<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (coreMethod.rest()) {<NEW_LINE>if (n < 0) {<NEW_LINE>processor.error("missing rest method parameter", specializationMethod);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (parameters.get(n).asType().getKind() != TypeKind.ARRAY) {<NEW_LINE>processor.error("rest method parameter is not array", parameters.get(n));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// ignore final Object[] argument<NEW_LINE>n--;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < coreMethod.optional(); i++, n--) {<NEW_LINE>if (n < 0) {<NEW_LINE>processor.error("invalid optional parameter count for", specializationMethod);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>checkParameterUnguarded(specializationAnnotation<MASK><NEW_LINE>}<NEW_LINE>} | , parameters.get(n)); |
529,192 | public void initialize() throws InitializationException {<NEW_LINE>try {<NEW_LINE>Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);<NEW_LINE>String content = config.getContent();<NEW_LINE>m_configId = config.getId();<NEW_LINE>m_modifyTime = config.getModifyDate().getTime();<NEW_LINE><MASK><NEW_LINE>} catch (DalNotFoundException e) {<NEW_LINE>try {<NEW_LINE>String content = m_fetcher.getConfigContent(CONFIG_NAME);<NEW_LINE>Config config = m_configDao.createLocal();<NEW_LINE>config.setName(CONFIG_NAME);<NEW_LINE>config.setContent(content);<NEW_LINE>m_configDao.insert(config);<NEW_LINE>m_configId = config.getId();<NEW_LINE>m_config = DefaultSaxParser.parse(content);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Cat.logError(ex);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>}<NEW_LINE>if (m_config == null) {<NEW_LINE>m_config = new ReportReloadConfig();<NEW_LINE>}<NEW_LINE>TimerSyncTask.getInstance().register(new SyncHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getName() {<NEW_LINE>return CONFIG_NAME;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handle() throws Exception {<NEW_LINE>refreshConfig();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | m_config = DefaultSaxParser.parse(content); |
182,353 | private void storeResult(final String key, final int ttl, final QueryResult queryResult) {<NEW_LINE>if (ttl <= 0) {<NEW_LINE>log.warn("{}: not storing due to low ttl ({}s)", key, ttl);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final CachedResult cachedResult = new CachedResult(queryResult.getRange(), queryResult.getGroups(), queryResult.getPreAggregationSampleSize(), queryResult.getLimits());<NEW_LINE>final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();<NEW_LINE>try (final GZIPOutputStream out = new GZIPOutputStream(bytesOut)) {<NEW_LINE>mapper.writeValue(out, cachedResult);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>log.error("failed to serialize cached results", e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final byte[] bytes = bytesOut.toByteArray();<NEW_LINE>final Borrowed<MemcacheClient<byte[]>> borrowed = client.borrow();<NEW_LINE>if (!borrowed.isValid()) {<NEW_LINE>log.warn("{}: client not available", key);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>log.debug("{}: storing ({} bytes) with ttl ({}s)", key, bytes.length, ttl);<NEW_LINE>borrowed.get().set(key, bytes, ttl).thenAccept(result -> {<NEW_LINE>log.info("{}: stored ({} bytes) with ttl ({}s)", <MASK><NEW_LINE>borrowed.release();<NEW_LINE>}).exceptionally(t -> {<NEW_LINE>log.error("{}: failed to store ({} bytes) with ttl ({}s)", key, bytes.length, ttl, t);<NEW_LINE>borrowed.release();<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} | key, bytes.length, ttl); |
874,374 | protected void handle(final DownloadImageMsg msg) {<NEW_LINE>final DownloadImageReply reply = new DownloadImageReply();<NEW_LINE>final ImageInventory iinv = msg.getImageInventory();<NEW_LINE>final String installPath = PathUtil.join(getSelf().getUrl(), BackupStoragePathMaker.makeImageInstallPath(iinv));<NEW_LINE>String sql = "update ImageBackupStorageRefVO set installPath = :installPath " + "where backupStorageUuid = :bsUuid and imageUuid = :imageUuid";<NEW_LINE>Query q = dbf.getEntityManager().createQuery(sql);<NEW_LINE>q.setParameter("installPath", installPath);<NEW_LINE>q.setParameter("bsUuid", msg.getBackupStorageUuid());<NEW_LINE>q.setParameter("imageUuid", msg.getImageInventory().getUuid());<NEW_LINE>q.executeUpdate();<NEW_LINE>download(iinv.getUrl(), installPath, iinv.getUuid(), new ReturnValueCompletion<DownloadResult>(msg) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(DownloadResult res) {<NEW_LINE>reply.setInstallPath(installPath);<NEW_LINE>reply.setSize(res.size);<NEW_LINE>reply.setActualSize(res.actualSize);<NEW_LINE>reply.setMd5sum(res.md5sum);<NEW_LINE>reply.setFormat(res.format);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>reply.setError(errorCode);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | bus.reply(msg, reply); |
1,539,679 | public AnalystField defineClass(String fieldName, FieldDirection d, NormalizationAction action, List<ClassItem> classes) {<NEW_LINE>AnalystField field = new AnalystField();<NEW_LINE>if (action != NormalizationAction.Equilateral && action != NormalizationAction.OneOf) {<NEW_LINE>throw new AnalystError("defineClass can only be used with action type of Equilateral or OneOf");<NEW_LINE>}<NEW_LINE>field.setAction(action);<NEW_LINE>field.setNormalizedHigh(this.defaultNormalizedRangeHigh);<NEW_LINE>field.setNormalizedLow(this.defaultNormalizedRangeLow);<NEW_LINE>field.setActualHigh(0);<NEW_LINE>field.setActualLow(0);<NEW_LINE>field.setName(fieldName);<NEW_LINE>field.setOutput(d == FieldDirection.Output || d == FieldDirection.InputOutput);<NEW_LINE>field.getClasses().addAll(classes);<NEW_LINE>getNormalize().<MASK><NEW_LINE>return field;<NEW_LINE>} | getNormalizedFields().add(field); |
1,259,694 | protected void computePsiDataPsiGradient(GrayF32 image1, GrayF32 image2, GrayF32 deriv1x, GrayF32 deriv1y, GrayF32 deriv2x, GrayF32 deriv2y, GrayF32 deriv2xx, GrayF32 deriv2yy, GrayF32 deriv2xy, GrayF32 du, GrayF32 dv, GrayF32 psiData, GrayF32 psiGradient) {<NEW_LINE>int N = image1.width * image1.height;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>float du_ = du.data[i];<NEW_LINE>float dv_ = dv.data[i];<NEW_LINE>// compute Psi-data<NEW_LINE>float taylor2 = image2.data[i] + deriv2x.data[i] * du_ + deriv2y.data[i] * dv_;<NEW_LINE>float v = <MASK><NEW_LINE>psiData.data[i] = (float) (1.0 / (2.0 * Math.sqrt(v * v + EPSILON * EPSILON)));<NEW_LINE>// compute Psi-gradient<NEW_LINE>float dIx = deriv2x.data[i] + deriv2xx.data[i] * du_ + deriv2xy.data[i] * dv_ - deriv1x.data[i];<NEW_LINE>float dIy = deriv2y.data[i] + deriv2xy.data[i] * du_ + deriv2yy.data[i] * dv_ - deriv1y.data[i];<NEW_LINE>float dI2 = dIx * dIx + dIy * dIy;<NEW_LINE>psiGradient.data[i] = (float) (1.0 / (2.0 * Math.sqrt(dI2 + EPSILON * EPSILON)));<NEW_LINE>}<NEW_LINE>} | taylor2 - image1.data[i]; |
1,187,609 | public Object retryAroundAdvice(ProceedingJoinPoint proceedingJoinPoint, @Nullable Retry retryAnnotation) throws Throwable {<NEW_LINE>Method method = ((MethodSignature) proceedingJoinPoint.getSignature()).getMethod();<NEW_LINE>String methodName = method.getDeclaringClass().getName() + "#" + method.getName();<NEW_LINE>if (retryAnnotation == null) {<NEW_LINE>retryAnnotation = getRetryAnnotation(proceedingJoinPoint);<NEW_LINE>}<NEW_LINE>if (retryAnnotation == null) {<NEW_LINE>// because annotations wasn't found<NEW_LINE>return proceedingJoinPoint.proceed();<NEW_LINE>}<NEW_LINE>String backend = spelResolver.resolve(method, proceedingJoinPoint.getArgs(<MASK><NEW_LINE>io.github.resilience4j.retry.Retry retry = getOrCreateRetry(methodName, backend);<NEW_LINE>Class<?> returnType = method.getReturnType();<NEW_LINE>final CheckedSupplier<Object> retryExecution = () -> proceed(proceedingJoinPoint, methodName, retry, returnType);<NEW_LINE>return fallbackExecutor.execute(proceedingJoinPoint, method, retryAnnotation.fallbackMethod(), retryExecution);<NEW_LINE>} | ), retryAnnotation.name()); |
612,350 | private static Vector apply(CompLongDoubleVector v1, LongDummyVector v2, Binary op) {<NEW_LINE>LongDoubleVector[] parts = v1.getPartitions();<NEW_LINE>Storage[] resParts = StorageSwitch.<MASK><NEW_LINE>if (!op.isKeepStorage()) {<NEW_LINE>for (int i = 0; i < parts.length; i++) {<NEW_LINE>if (parts[i].getStorage() instanceof LongDoubleSortedVectorStorage) {<NEW_LINE>resParts[i] = new LongDoubleSparseVectorStorage(parts[i].getDim(), parts[i].getStorage().getIndices(), parts[i].getStorage().getValues());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long subDim = (v1.getDim() + v1.getNumPartitions() - 1) / v1.getNumPartitions();<NEW_LINE>long[] v2Indices = v2.getIndices();<NEW_LINE>for (int i = 0; i < v2Indices.length; i++) {<NEW_LINE>long gidx = v2Indices[i];<NEW_LINE>int pidx = (int) (gidx / subDim);<NEW_LINE>long subidx = gidx % subDim;<NEW_LINE>((LongDoubleVectorStorage) resParts[pidx]).set(subidx, op.apply(parts[pidx].get(subidx), 1));<NEW_LINE>}<NEW_LINE>LongDoubleVector[] res = new LongDoubleVector[parts.length];<NEW_LINE>int i = 0;<NEW_LINE>for (LongDoubleVector part : parts) {<NEW_LINE>res[i] = new LongDoubleVector(part.getMatrixId(), part.getRowId(), part.getClock(), part.getDim(), (LongDoubleVectorStorage) resParts[i]);<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return new CompLongDoubleVector(v1.getMatrixId(), v1.getRowId(), v1.getClock(), v1.getDim(), res, v1.getSubDim());<NEW_LINE>} | applyComp(v1, v2, op); |
909,042 | public // 03917<NEW_LINE>MQuery createReportingQuery() {<NEW_LINE>final Properties ctx = getCtx();<NEW_LINE>final MQuery query;<NEW_LINE>//<NEW_LINE>// If we are reporting on a header tab (not detail) we shall use exactly the same items as the user is seeing in Tab (03917)<NEW_LINE>if (Check.isEmpty(getLinkColumnName(), true)) {<NEW_LINE>query = getQuery().deepCopy();<NEW_LINE>} else //<NEW_LINE>// Reporting on an included tab<NEW_LINE>// In this case we are keeping the old ADempiere functionality, which was moved and refactored from:<NEW_LINE>// * org.compiere.apps.APanel.cmd_report()<NEW_LINE>// * org.adempiere.webui.panel.AbstractADWindowPanel.onReport()<NEW_LINE>{<NEW_LINE>query = new MQuery(getTableName());<NEW_LINE>// Link for detail records<NEW_LINE>String queryColumn = getLinkColumnName();<NEW_LINE>// Current row otherwise<NEW_LINE>if (queryColumn.length() == 0) {<NEW_LINE>queryColumn = getKeyColumnName();<NEW_LINE>}<NEW_LINE>// Find display<NEW_LINE>String infoName = null;<NEW_LINE>String infoDisplay = null;<NEW_LINE>for (int i = 0; i < getFieldCount(); i++) {<NEW_LINE>final GridField field = getField(i);<NEW_LINE>if (field.isKey()) {<NEW_LINE>infoName = field.getHeader();<NEW_LINE>}<NEW_LINE>if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo")) && field.getValue() != null) {<NEW_LINE>infoDisplay = field.getValue().toString();<NEW_LINE>}<NEW_LINE>if (infoName != null && infoDisplay != null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (queryColumn.length() != 0) {<NEW_LINE>if (queryColumn.endsWith("_ID")) {<NEW_LINE>query.addRestriction(queryColumn, Operator.EQUAL, new Integer(Env.getContextAsInt(ctx, getWindowNo(), queryColumn)), infoName, infoDisplay);<NEW_LINE>} else {<NEW_LINE>query.addRestriction(queryColumn, Operator.EQUAL, Env.getContext(ctx, getWindowNo(), queryColumn), infoName, infoDisplay);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Make sure we are adding the extended where clause in our reporting query:<NEW_LINE>// (e.g. of extended where clause - in Invoice window, header tab, the extended where is IsSOTrx=Y)<NEW_LINE>final String whereExtended = getWhereExtended();<NEW_LINE>if (!Check.isEmpty(whereExtended, true)) {<NEW_LINE>final String whereExtendedParsed = Env.parseContext(ctx, getWindowNo(), whereExtended, false);<NEW_LINE>if (Check.isEmpty(whereExtendedParsed, true)) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>query.addRestriction(whereExtendedParsed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return query;<NEW_LINE>} | log.warn("Cannot parse whereExtended: ", whereExtended); |
1,416,066 | public List<Map<String, Object>> invoke() {<NEW_LINE>NodeList nodes = null;<NEW_LINE>File d = new File(webGoatHomeDirectory, "ClientSideFiltering/employees.xml");<NEW_LINE>XPathFactory factory = XPathFactory.newInstance();<NEW_LINE>XPath path = factory.newXPath();<NEW_LINE>try (InputStream is = new FileInputStream(d)) {<NEW_LINE><MASK><NEW_LINE>StringBuffer sb = new StringBuffer();<NEW_LINE>sb.append("/Employees/Employee/UserID | ");<NEW_LINE>sb.append("/Employees/Employee/FirstName | ");<NEW_LINE>sb.append("/Employees/Employee/LastName | ");<NEW_LINE>sb.append("/Employees/Employee/SSN | ");<NEW_LINE>sb.append("/Employees/Employee/Salary ");<NEW_LINE>String expression = sb.toString();<NEW_LINE>nodes = (NodeList) path.evaluate(expression, inputSource, XPathConstants.NODESET);<NEW_LINE>} catch (XPathExpressionException e) {<NEW_LINE>log.error("Unable to parse xml", e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>log.error("Unable to read employees.xml at location: '{}'", d);<NEW_LINE>}<NEW_LINE>int columns = 5;<NEW_LINE>List json = new ArrayList();<NEW_LINE>java.util.Map<String, Object> employeeJson = new HashMap<>();<NEW_LINE>for (int i = 0; i < nodes.getLength(); i++) {<NEW_LINE>if (i % columns == 0) {<NEW_LINE>employeeJson = new HashMap<>();<NEW_LINE>json.add(employeeJson);<NEW_LINE>}<NEW_LINE>Node node = nodes.item(i);<NEW_LINE>employeeJson.put(node.getNodeName(), node.getTextContent());<NEW_LINE>}<NEW_LINE>return json;<NEW_LINE>} | InputSource inputSource = new InputSource(is); |
318,412 | public <G extends Category> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException {<NEW_LINE>CreateResponse<G> createResponse = context.createOrRetrieveCopyInstance(this);<NEW_LINE>if (createResponse.isAlreadyPopulated()) {<NEW_LINE>return createResponse;<NEW_LINE>}<NEW_LINE>Category cloned = createResponse.getClone();<NEW_LINE>cloned.setActiveEndDate(activeEndDate);<NEW_LINE>cloned.setActiveStartDate(activeStartDate);<NEW_LINE>cloned.setFulfillmentType(getFulfillmentType());<NEW_LINE>cloned.setTaxCode(taxCode);<NEW_LINE>cloned.setUrl(url);<NEW_LINE>cloned.setUrlKey(urlKey);<NEW_LINE>cloned.setOverrideGeneratedUrl(getOverrideGeneratedUrl());<NEW_LINE>cloned.setName(name);<NEW_LINE>cloned.setLongDescription(longDescription);<NEW_LINE>cloned.setInventoryType(getInventoryType());<NEW_LINE>cloned.setExternalId(externalId);<NEW_LINE>cloned.setDisplayTemplate(displayTemplate);<NEW_LINE>cloned.setDescription(description);<NEW_LINE>for (CategoryXref entry : allParentCategoryXrefs) {<NEW_LINE>CategoryXref clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();<NEW_LINE>cloned.<MASK><NEW_LINE>}<NEW_LINE>if (getDefaultParentCategory() != null) {<NEW_LINE>cloned.setParentCategory(getDefaultParentCategory().createOrRetrieveCopyInstance(context).getClone());<NEW_LINE>}<NEW_LINE>for (CategoryXref entry : allChildCategoryXrefs) {<NEW_LINE>CategoryXref clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();<NEW_LINE>cloned.getAllChildCategoryXrefs().add(clonedEntry);<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, CategoryAttribute> entry : getCategoryAttributesMap().entrySet()) {<NEW_LINE>CategoryAttribute clonedEntry = entry.getValue().createOrRetrieveCopyInstance(context).getClone();<NEW_LINE>cloned.getCategoryAttributesMap().put(entry.getKey(), clonedEntry);<NEW_LINE>}<NEW_LINE>for (CategorySearchFacet entry : searchFacets) {<NEW_LINE>CategorySearchFacet clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();<NEW_LINE>cloned.getSearchFacets().add(clonedEntry);<NEW_LINE>}<NEW_LINE>for (CategoryExcludedSearchFacet entry : excludedSearchFacets) {<NEW_LINE>CategoryExcludedSearchFacet clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();<NEW_LINE>cloned.getExcludedSearchFacets().add(clonedEntry);<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, CategoryMediaXref> entry : categoryMedia.entrySet()) {<NEW_LINE>CategoryMediaXrefImpl clonedEntry = ((CategoryMediaXrefImpl) entry.getValue()).createOrRetrieveCopyInstance(context).getClone();<NEW_LINE>cloned.getCategoryMediaXref().put(entry.getKey(), clonedEntry);<NEW_LINE>}<NEW_LINE>// Don't clone the references to products - those will be handled by another MultiTenantCopier call<NEW_LINE>return createResponse;<NEW_LINE>} | getAllParentCategoryXrefs().add(clonedEntry); |
703,643 | public DashConfigurationForPut unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DashConfigurationForPut dashConfigurationForPut = new DashConfigurationForPut();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("MpdLocation", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>dashConfigurationForPut.setMpdLocation(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("OriginManifestType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>dashConfigurationForPut.setOriginManifestType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return dashConfigurationForPut;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
558,137 | private void parseRootElement(final Path resultsDirectory, final Path parsedFile, final RandomUidContext context, final ResultsVisitor visitor) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();<NEW_LINE>final DocumentBuilder builder = factory.newDocumentBuilder();<NEW_LINE>final XmlElement rootElement = new XmlElement(builder.parse(parsedFile.toFile()).getDocumentElement());<NEW_LINE>final String elementName = rootElement.getName();<NEW_LINE>if (TEST_SUITE_ELEMENT_NAME.equals(elementName)) {<NEW_LINE>parseTestSuite(rootElement, parsedFile, context, visitor, resultsDirectory);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (TEST_SUITES_ELEMENT_NAME.equals(elementName)) {<NEW_LINE>rootElement.get(TEST_SUITE_ELEMENT_NAME).forEach(element -> parseTestSuite(element, parsedFile, context, visitor, resultsDirectory));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LOGGER.debug("File {} is not a valid JUnit xml. Unknown root element {}", parsedFile, elementName);<NEW_LINE>} catch (SAXException | ParserConfigurationException | IOException e) {<NEW_LINE>LOGGER.error("Could not parse file {}: {}", parsedFile, e);<NEW_LINE>}<NEW_LINE>} | LOGGER.debug("Parsing file {}", parsedFile); |
647,088 | final UpdateLinkResult executeUpdateLink(UpdateLinkRequest updateLinkRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateLinkRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateLinkRequest> request = null;<NEW_LINE>Response<UpdateLinkResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new UpdateLinkRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateLinkRequest));<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, "NetworkManager");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateLink");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateLinkResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateLinkResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,364,060 | public static void main(String[] args) {<NEW_LINE>Set<String> words = new HashSet<>();<NEW_LINE>words.add("sb");<NEW_LINE>words.add("xx");<NEW_LINE>SensitiveFilter sensitiveFilter = new SensitiveFilter(words);<NEW_LINE>String text1 = "u sb a";<NEW_LINE>Set<String> ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "u xx";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "a url is https://sdsbhe.com here";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "a url is https://sdsbhe.com";<NEW_LINE>ss = sensitiveFilter.<MASK><NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "a url is https://sdsbhe.com\nsb";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>} | getSensitiveWords(text1, MatchType.MIN_MATCH); |
331,741 | public void queueEvent(FacesEvent event) {<NEW_LINE>FacesContext context = getFacesContext();<NEW_LINE>if (ComponentUtils.isRequestSource(this, context) && event instanceof AjaxBehaviorEvent) {<NEW_LINE>setRowIndex(-1);<NEW_LINE>Map<String, String> params = context.getExternalContext().getRequestParameterMap();<NEW_LINE>String eventName = params.<MASK><NEW_LINE>if ("page".equals(eventName)) {<NEW_LINE>AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event;<NEW_LINE>String clientId = getClientId(context);<NEW_LINE>int rows = getRowsToRender();<NEW_LINE>int first = Integer.parseInt(params.get(clientId + "_first"));<NEW_LINE>int page = rows > 0 ? (int) (first / rows) : 0;<NEW_LINE>PageEvent pageEvent = new PageEvent(this, behaviorEvent.getBehavior(), page);<NEW_LINE>pageEvent.setPhaseId(behaviorEvent.getPhaseId());<NEW_LINE>super.queueEvent(pageEvent);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>super.queueEvent(event);<NEW_LINE>}<NEW_LINE>} | get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM); |
505,090 | public void marshall(DocumentClassifierProperties documentClassifierProperties, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (documentClassifierProperties == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getDocumentClassifierArn(), DOCUMENTCLASSIFIERARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getLanguageCode(), LANGUAGECODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getMessage(), MESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getSubmitTime(), SUBMITTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getTrainingStartTime(), TRAININGSTARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getTrainingEndTime(), TRAININGENDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getInputDataConfig(), INPUTDATACONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getClassifierMetadata(), CLASSIFIERMETADATA_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getVolumeKmsKeyId(), VOLUMEKMSKEYID_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getVpcConfig(), VPCCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getMode(), MODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getModelKmsKeyId(), MODELKMSKEYID_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getVersionName(), VERSIONNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentClassifierProperties.getSourceModelArn(), SOURCEMODELARN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | documentClassifierProperties.getEndTime(), ENDTIME_BINDING); |
1,119,594 | protected Page newPage(final HttpServletRequest req, final HttpServletResponse resp, final Session session, final String template) {<NEW_LINE>final Page page = new Page(req, resp, getApplication().getVelocityEngine(), template);<NEW_LINE>page.add("version", jarVersion);<NEW_LINE>page.add("azkaban_name", this.name);<NEW_LINE>page.add("azkaban_label", this.label);<NEW_LINE>page.add("azkaban_color", this.color);<NEW_LINE>page.add("azkaban_depth", this.depth);<NEW_LINE>page.<MASK><NEW_LINE>page.add("note_message", NoteServlet.message);<NEW_LINE>page.add("note_url", NoteServlet.url);<NEW_LINE>page.add("timezone", TimeZone.getDefault().getID());<NEW_LINE>page.add("currentTime", (new DateTime()).getMillis());<NEW_LINE>page.add("size", getDisplayExecutionPageSize());<NEW_LINE>page.add("System", System.class);<NEW_LINE>page.add("TimeUtils", TimeUtils.class);<NEW_LINE>page.add("WebUtils", WebUtils.class);<NEW_LINE>if (session != null && session.getUser() != null) {<NEW_LINE>page.add("user_id", session.getUser().getUserId());<NEW_LINE>}<NEW_LINE>final String errorMsg = getErrorMessageFromCookie(req);<NEW_LINE>page.add("error_message", errorMsg == null || errorMsg.isEmpty() ? "null" : errorMsg);<NEW_LINE>setErrorMessageInCookie(resp, null);<NEW_LINE>final String warnMsg = getWarnMessageFromCookie(req);<NEW_LINE>page.add("warn_message", warnMsg == null || warnMsg.isEmpty() ? "null" : warnMsg);<NEW_LINE>setWarnMessageInCookie(resp, null);<NEW_LINE>final String successMsg = getSuccessMessageFromCookie(req);<NEW_LINE>page.add("success_message", successMsg == null || successMsg.isEmpty() ? "null" : successMsg);<NEW_LINE>setSuccessMessageInCookie(resp, null);<NEW_LINE>// @TODO, allow more than one type of viewer. For time sake, I only install<NEW_LINE>// the first one<NEW_LINE>if (this.viewerPlugins != null && !this.viewerPlugins.isEmpty()) {<NEW_LINE>page.add("viewers", this.viewerPlugins);<NEW_LINE>}<NEW_LINE>if (this.triggerPlugins != null && !this.triggerPlugins.isEmpty()) {<NEW_LINE>page.add("triggerPlugins", this.triggerPlugins);<NEW_LINE>}<NEW_LINE>return page;<NEW_LINE>} | add("note_type", NoteServlet.type); |
630,124 | public void execute(final EditorAdaptor editorAdaptor, final int count) throws CommandExecutionException {<NEW_LINE>final IWorkbenchPartSite site = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite();<NEW_LINE>final EPartService psvc = (EPartService) site.getService(EPartService.class);<NEW_LINE>final MPart p = (MPart) site.getService(MPart.class);<NEW_LINE>final MElementContainer<MUIElement> editorStack = p.getParent();<NEW_LINE>final List<MUIElement> tabs = editorStack.getChildren();<NEW_LINE>int newIdx;<NEW_LINE>if (count == NO_COUNT_GIVEN) {<NEW_LINE>//<NEW_LINE>// Just switch to the next/previous tab<NEW_LINE>//<NEW_LINE>final MUIElement selectedTab = editorStack.getSelectedElement();<NEW_LINE>final int selectedIdx = tabs.indexOf(selectedTab);<NEW_LINE>if (direction == SwitchTabDirection.NEXT) {<NEW_LINE>newIdx = (selectedIdx + 1) % tabs.size();<NEW_LINE>} else {<NEW_LINE>assert direction == SwitchTabDirection.PREVIOUS;<NEW_LINE>if (selectedIdx == 0) {<NEW_LINE>newIdx = tabs.size() - 1;<NEW_LINE>} else {<NEW_LINE>newIdx = selectedIdx - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>//<NEW_LINE>// Switch to a particular tab specified by the count<NEW_LINE>//<NEW_LINE>if (count < 1 || count > tabs.size()) {<NEW_LINE>// Invalid count, ignore<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>newIdx = count - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final MUIElement newTab = tabs.get(newIdx);<NEW_LINE>if (newTab instanceof MPart) {<NEW_LINE>psvc.activate<MASK><NEW_LINE>}<NEW_LINE>} | ((MPart) newTab, true); |
759,339 | void buildEventPayload(AnalyticsEvent internalEvent, Event event) {<NEW_LINE>final Session session = new Session();<NEW_LINE>session.withId(internalEvent.getSession().getSessionId());<NEW_LINE>session.withStartTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getSession().getSessionStart())));<NEW_LINE>if (internalEvent.getSession().getSessionStop() != null && internalEvent.getSession().getSessionStop() != 0L) {<NEW_LINE>session.withStopTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getSession(<MASK><NEW_LINE>}<NEW_LINE>if (internalEvent.getSession().getSessionDuration() != null && internalEvent.getSession().getSessionDuration() != 0L) {<NEW_LINE>session.withDuration(internalEvent.getSession().getSessionDuration().intValue());<NEW_LINE>}<NEW_LINE>final AndroidAppDetails appDetails = internalEvent.getAppDetails();<NEW_LINE>event.withAppPackageName(appDetails.packageName()).withAppTitle(appDetails.getAppTitle()).withAppVersionCode(appDetails.versionCode()).withAttributes(internalEvent.getAllAttributes()).withClientSdkVersion(internalEvent.getSdkVersion()).withEventType(internalEvent.getEventType()).withMetrics(internalEvent.getAllMetrics()).withSdkName(internalEvent.getSdkName()).withSession(session).withTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getEventTimestamp())));<NEW_LINE>} | ).getSessionStop()))); |
266,637 | public static List<String> dumpListens(final Repo repo, Path path) throws InterruptedException {<NEW_LINE>final List<PersistentConnection> conns = <MASK><NEW_LINE>final Semaphore semaphore = new Semaphore(0);<NEW_LINE>// we need to run this through our work queue to make the ordering work out.<NEW_LINE>repo.scheduleNow(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>conns.add(CoreTestHelpers.getRepoConnection(repo));<NEW_LINE>semaphore.release(1);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>IntegrationTestHelpers.waitFor(semaphore);<NEW_LINE>conns.get(0);<NEW_LINE>List<List<String>> pathList = new ArrayList<>();<NEW_LINE>List<Map<String, Object>> queryParamList = new ArrayList<>();<NEW_LINE>// TODO: Find a way to actually get listens, or not test against internal state?<NEW_LINE>// conn.getListens(pathList, queryParamList);<NEW_LINE>Map<String, List<String>> pathToQueryParamStrings = new HashMap<String, List<String>>();<NEW_LINE>for (int i = 0; i < pathList.size(); i++) {<NEW_LINE>Path queryPath = new Path(pathList.get(i));<NEW_LINE>QueryParams queryParams = QueryParams.fromQueryObject(queryParamList.get(i));<NEW_LINE>if (path.contains(queryPath)) {<NEW_LINE>List<String> allParamsStrings = pathToQueryParamStrings.get(queryPath.toString());<NEW_LINE>if (allParamsStrings == null) {<NEW_LINE>allParamsStrings = new ArrayList<String>();<NEW_LINE>}<NEW_LINE>String paramsString = queryParams.isDefault() ? "default" : queryParams.getWireProtocolParams().toString();<NEW_LINE>allParamsStrings.add(paramsString);<NEW_LINE>pathToQueryParamStrings.put(queryPath.toString(), allParamsStrings);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<String> paths = new ArrayList<String>(pathToQueryParamStrings.keySet());<NEW_LINE>Collections.sort(paths);<NEW_LINE>// +1 for '/'<NEW_LINE>int prefixLength = path.getFront().asString().length() + 1;<NEW_LINE>List<String> results = new ArrayList<String>(paths.size());<NEW_LINE>for (String listenPath : paths) {<NEW_LINE>List<String> allParamsStrings = pathToQueryParamStrings.get(listenPath);<NEW_LINE>Collections.sort(allParamsStrings);<NEW_LINE>String listen = listenPath.substring(prefixLength) + ":" + allParamsStrings.toString();<NEW_LINE>results.add(listen);<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | new ArrayList<PersistentConnection>(1); |
1,024,912 | public void syrk(char Order, char Uplo, char Trans, double alpha, INDArray A, double beta, INDArray C) {<NEW_LINE>if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)<NEW_LINE>OpProfiler.getInstance().<MASK><NEW_LINE>if (C.rows() > Integer.MAX_VALUE || A.size(0) > Integer.MAX_VALUE || C.size(0) > Integer.MAX_VALUE) {<NEW_LINE>throw new ND4JArraySizeException();<NEW_LINE>}<NEW_LINE>if (A.data().dataType() == DataType.DOUBLE) {<NEW_LINE>DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, C);<NEW_LINE>dsyrk(Order, Uplo, Trans, (int) C.rows(), 1, alpha, A, (int) A.size(0), beta, C, (int) C.size(0));<NEW_LINE>} else {<NEW_LINE>DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, C);<NEW_LINE>ssyrk(Order, Uplo, Trans, (int) C.rows(), 1, (float) alpha, A, (int) A.size(0), (float) beta, C, (int) C.size(0));<NEW_LINE>}<NEW_LINE>OpExecutionerUtil.checkForAny(C);<NEW_LINE>} | processBlasCall(false, A, C); |
954,964 | // subscribe one more given topic<NEW_LINE>public CompletableFuture<Void> subscribeAsync(String topicName, boolean createTopicIfDoesNotExist) {<NEW_LINE>TopicName topicNameInstance = getTopicName(topicName);<NEW_LINE>if (topicNameInstance == null) {<NEW_LINE>return FutureUtil.failedFuture(new PulsarClientException.AlreadyClosedException("Topic name not valid"));<NEW_LINE>}<NEW_LINE>String fullTopicName = topicNameInstance.toString();<NEW_LINE>if (consumers.containsKey(fullTopicName) || partitionedTopics.containsKey(topicNameInstance.getPartitionedTopicName())) {<NEW_LINE>return FutureUtil.failedFuture(new PulsarClientException.AlreadyClosedException("Already subscribed to " + topicName));<NEW_LINE>}<NEW_LINE>if (getState() == State.Closing || getState() == State.Closed) {<NEW_LINE>return FutureUtil.failedFuture(new PulsarClientException.AlreadyClosedException("Topics Consumer was already closed"));<NEW_LINE>}<NEW_LINE>CompletableFuture<Void> subscribeResult = new CompletableFuture<>();<NEW_LINE>client.getPartitionedTopicMetadata(topicName).thenAccept(metadata -> subscribeTopicPartitions(subscribeResult, fullTopicName, metadata.partitions, createTopicIfDoesNotExist)).exceptionally(ex1 -> {<NEW_LINE>log.warn("[{}] Failed to get partitioned topic metadata: {}", <MASK><NEW_LINE>subscribeResult.completeExceptionally(ex1);<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>return subscribeResult;<NEW_LINE>} | fullTopicName, ex1.getMessage()); |
419,356 | public static Type findActualType(Type unresolved, DequeMap<TypeVariable<?>, Type> resolvedTypes) {<NEW_LINE>// Handle simple cases quickly.<NEW_LINE>if (!(unresolved instanceof TypeVariable<?>)) {<NEW_LINE>return unresolved;<NEW_LINE>}<NEW_LINE>TypeVariable<?> var = (TypeVariable<?>) unresolved;<NEW_LINE>Type target = resolvedTypes.get(var);<NEW_LINE>if (target == null || target == var) {<NEW_LINE>return var;<NEW_LINE>}<NEW_LINE>if (!(target instanceof TypeVariable<?>)) {<NEW_LINE>return target;<NEW_LINE>}<NEW_LINE>// Type variables that point to other type variables might form a cycle, which<NEW_LINE>// means they're all equivalent. Keep track of visited type variables to detect this.<NEW_LINE>Set<TypeVariable<?>> seen = new HashSet<TypeVariable<?>>();<NEW_LINE>seen.add(var);<NEW_LINE>var = (TypeVariable<?>) target;<NEW_LINE>seen.add(var);<NEW_LINE>while (true) {<NEW_LINE>target = resolvedTypes.get(var);<NEW_LINE>if (target == null || target == var) {<NEW_LINE>return var;<NEW_LINE>}<NEW_LINE>if (!(target instanceof TypeVariable<?>)) {<NEW_LINE>return target;<NEW_LINE>}<NEW_LINE>var <MASK><NEW_LINE>if (!seen.add(var)) {<NEW_LINE>// Cycle detected; returning an arbitrary var in the cycle.<NEW_LINE>return var;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = (TypeVariable<?>) target; |
1,335,995 | void process(Content dataSource, DataSourceIngestModuleProgress progressBar) {<NEW_LINE>String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + "sru";<NEW_LINE>File dir = new File(modOutPath);<NEW_LINE>if (dir.exists() == false) {<NEW_LINE>dir.mkdirs();<NEW_LINE>}<NEW_LINE>// NON-NLS<NEW_LINE>String tempDirPath = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "sru", context.getJobId());<NEW_LINE>String softwareHiveFileName = getSoftwareHiveFile(dataSource, tempDirPath);<NEW_LINE>if (softwareHiveFileName == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AbstractFile sruAbstractFile = getSruFile(dataSource, tempDirPath);<NEW_LINE>if (sruAbstractFile == null) {<NEW_LINE>// If we cannot find the srudb.dat file we cannot proceed which is ok<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String sruDumper = getPathForSruDumper();<NEW_LINE>if (sruDumper == null) {<NEW_LINE>this.addErrorMessage(Bundle.ExtractSru_error_finding_export_srudb_program());<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.SEVERE, "Error finding export_srudb program");<NEW_LINE>// If we cannot find the export_srudb program we cannot proceed<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (context.dataSourceIngestIsCancelled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String modOutFile = modOutPath + File.separator <MASK><NEW_LINE>String sruFileName = tempDirPath + File.separator + sruAbstractFile.getId() + "_" + sruAbstractFile.getName();<NEW_LINE>extractSruFiles(sruDumper, sruFileName, modOutFile, tempDirPath, softwareHiveFileName);<NEW_LINE>findSruExecutedFiles(modOutFile, dataSource);<NEW_LINE>createNetUsageArtifacts(modOutFile, sruAbstractFile);<NEW_LINE>createAppUsageArtifacts(modOutFile, sruAbstractFile);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NON-NLS=<NEW_LINE>logger.log(Level.SEVERE, "Error processing SRUDB.dat file", ex);<NEW_LINE>this.addErrorMessage(Bundle.ExtractSru_process_error_executing_export_srudb_program());<NEW_LINE>}<NEW_LINE>} | + sruAbstractFile.getId() + "_srudb.db3"; |
427,816 | static void copyWithEncoding(InputStream inputStream, OutputStream os, Map<String, String> replacements) throws IOException {<NEW_LINE>byte[] arr = new byte[4096];<NEW_LINE>final String encUTF8 = "utf-8";<NEW_LINE>PushbackInputStream pin = new PushbackInputStream(inputStream, 4096);<NEW_LINE>int <MASK><NEW_LINE>if (len < 0) {<NEW_LINE>// Nothing to read => nothing to copy<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>pin.unread(arr, 0, len);<NEW_LINE>String enc = findEncoding(arr, len);<NEW_LINE>boolean replaceEnc = !enc.equalsIgnoreCase(encUTF8);<NEW_LINE>BufferedReader br = new BufferedReader(new InputStreamReader(pin, enc));<NEW_LINE>BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, encUTF8));<NEW_LINE>String text;<NEW_LINE>while ((text = br.readLine()) != null) {<NEW_LINE>if (replaceEnc) {<NEW_LINE>Matcher replace = ENCODING.matcher(text);<NEW_LINE>while (replace.find()) {<NEW_LINE>if (!encUTF8.equalsIgnoreCase(replace.group(1))) {<NEW_LINE>text = text.substring(0, replace.start(1)) + encUTF8 + text.substring(replace.end(1));<NEW_LINE>replace = ENCODING.matcher(text);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Entry<String, String> re : replacements.entrySet()) {<NEW_LINE>text = text.replace(re.getKey(), re.getValue());<NEW_LINE>}<NEW_LINE>bw.write(text);<NEW_LINE>bw.newLine();<NEW_LINE>}<NEW_LINE>bw.flush();<NEW_LINE>} | len = pin.read(arr); |
680,614 | static AttributeBinding createBinding(String name, Type type) {<NEW_LINE>// Simple scalar parameter types<NEW_LINE>if (type == String.class) {<NEW_LINE>AttributeKey<String> key = AttributeKey.stringKey(name);<NEW_LINE>return (setter, arg) -> setter.put(key, (String) arg);<NEW_LINE>}<NEW_LINE>if (type == long.class || type == Long.class) {<NEW_LINE>AttributeKey<Long> key = AttributeKey.longKey(name);<NEW_LINE>return (setter, arg) -> setter.put(key, (Long) arg);<NEW_LINE>}<NEW_LINE>if (type == double.class || type == Double.class) {<NEW_LINE>AttributeKey<Double> key = AttributeKey.doubleKey(name);<NEW_LINE>return (setter, arg) -> setter.put(key, (Double) arg);<NEW_LINE>}<NEW_LINE>if (type == boolean.class || type == Boolean.class) {<NEW_LINE>AttributeKey<Boolean> key = AttributeKey.booleanKey(name);<NEW_LINE>return (setter, arg) -> setter.put(key, (Boolean) arg);<NEW_LINE>}<NEW_LINE>if (type == int.class || type == Integer.class) {<NEW_LINE>AttributeKey<Long> key = AttributeKey.longKey(name);<NEW_LINE>return (setter, arg) -> setter.put(key, ((Integer) arg).longValue());<NEW_LINE>}<NEW_LINE>if (type == float.class || type == Float.class) {<NEW_LINE>AttributeKey<Double> key = AttributeKey.doubleKey(name);<NEW_LINE>return (setter, arg) -> setter.put(key, ((Float<MASK><NEW_LINE>}<NEW_LINE>if (isArrayType(type)) {<NEW_LINE>return arrayBinding(name, type);<NEW_LINE>}<NEW_LINE>return resolveListComponentType(type).map(componentType -> listBinding(name, componentType)).orElseGet(() -> defaultBinding(name));<NEW_LINE>} | ) arg).doubleValue()); |
1,792,710 | private void createOutputFragment(PlanFragment inputFragment, ExecPlan execPlan, List<ColumnRefOperator> outputColumns) {<NEW_LINE>if (inputFragment.getPlanRoot() instanceof ExchangeNode || !inputFragment.isPartitioned()) {<NEW_LINE>List<Expr> outputExprs = outputColumns.stream().map(variable -> ScalarOperatorToExpr.buildExecExpression(variable, new ScalarOperatorToExpr.FormatterContext(execPlan.getColRefToExpr()))).collect(Collectors.toList());<NEW_LINE>inputFragment.setOutputExprs(outputExprs);<NEW_LINE>execPlan.getOutputExprs().addAll(outputExprs);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Expr> outputExprs = outputColumns.stream().map(variable -> ScalarOperatorToExpr.buildExecExpression(variable, new ScalarOperatorToExpr.FormatterContext(execPlan.getColRefToExpr()))).collect(Collectors.toList());<NEW_LINE>execPlan.getOutputExprs().addAll(outputExprs);<NEW_LINE>// Single tablet direct output<NEW_LINE>// Note: If the fragment has right or full join and the join is local bucket shuffle join,<NEW_LINE>// We shouldn't set result sink directly to top fragment, because we will hash multi reslt sink.<NEW_LINE>if (!inputFragment.hashLocalBucketShuffleRightOrFullJoin(inputFragment.getPlanRoot()) && execPlan.getScanNodes().stream().allMatch(d -> d instanceof OlapScanNode) && execPlan.getScanNodes().stream().map(d -> ((OlapScanNode) d).getScanTabletIds().size()).reduce(Integer::sum).orElse(2) <= 1) {<NEW_LINE>inputFragment.setOutputExprs(outputExprs);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ExchangeNode exchangeNode = new ExchangeNode(execPlan.getNextNodeId(), <MASK><NEW_LINE>exchangeNode.setNumInstances(1);<NEW_LINE>PlanFragment exchangeFragment = new PlanFragment(execPlan.getNextFragmentId(), exchangeNode, DataPartition.UNPARTITIONED);<NEW_LINE>inputFragment.setDestination(exchangeNode);<NEW_LINE>inputFragment.setOutputPartition(DataPartition.UNPARTITIONED);<NEW_LINE>exchangeFragment.setOutputExprs(outputExprs);<NEW_LINE>execPlan.getFragments().add(exchangeFragment);<NEW_LINE>} | inputFragment.getPlanRoot(), false); |
164,664 | public void onCreate() {<NEW_LINE>SharedPreferences themePrefs = getSharedPreferences("THEME", 0);<NEW_LINE>Boolean isDark = themePrefs.getBoolean("isDark", false);<NEW_LINE>if (isDark)<NEW_LINE>setTheme(R.style.DarkTheme);<NEW_LINE>else<NEW_LINE>setTheme(R.style.AppTheme);<NEW_LINE>super.onCreate();<NEW_LINE>ACRA.init(this);<NEW_LINE>Services.init(this);<NEW_LINE>// initialize the system<NEW_LINE>try {<NEW_LINE>System.init(this);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// ignore exception when the user has wifi off<NEW_LINE>if (!(e instanceof NoRouteToHostException))<NEW_LINE>System.errorLogging(e);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>builder.setBuildConfigClass(BuildConfig.class).setReportFormat(StringFormat.JSON);<NEW_LINE>builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class);<NEW_LINE>builder.getPluginConfigurationBuilder(NotificationConfigurationBuilder.class);<NEW_LINE>ACRA.init(this, builder);<NEW_LINE>// load system modules even if the initialization failed<NEW_LINE>System.registerPlugin(new RouterPwn());<NEW_LINE>System.registerPlugin(new Traceroute());<NEW_LINE>System.registerPlugin(new PortScanner());<NEW_LINE>System.registerPlugin(new Inspector());<NEW_LINE>System.registerPlugin(new ExploitFinder());<NEW_LINE>System.registerPlugin(new LoginCracker());<NEW_LINE>System.registerPlugin(new Sessions());<NEW_LINE>System.registerPlugin(new MITM());<NEW_LINE>System.registerPlugin(new PacketForger());<NEW_LINE>} | CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this); |
887,424 | public List<IWorker<ITestNGMethod>> createWorkers(Arguments arguments) {<NEW_LINE>List<IWorker<ITestNGMethod>> result = Lists.newArrayList();<NEW_LINE>// Methods that belong to classes with a sequential=true or parallel=classes<NEW_LINE>// attribute must all be run in the same worker<NEW_LINE>Set<Class<?>> sequentialClasses = gatherClassesThatShouldRunSequentially(arguments);<NEW_LINE>List<IMethodInstance> methodInstances = Lists.newArrayList();<NEW_LINE>for (ITestNGMethod tm : arguments.getMethods()) {<NEW_LINE>methodInstances<MASK><NEW_LINE>}<NEW_LINE>Set<Class<?>> processedClasses = Sets.newHashSet();<NEW_LINE>Map<String, String> params = null;<NEW_LINE>Class<?> prevClass = null;<NEW_LINE>for (IMethodInstance im : methodInstances) {<NEW_LINE>Class<?> c = im.getMethod().getTestClass().getRealClass();<NEW_LINE>if (!c.equals(prevClass)) {<NEW_LINE>// Calculate the parameters to be injected only once per Class and NOT for every iteration.<NEW_LINE>params = getParameters(im);<NEW_LINE>prevClass = c;<NEW_LINE>}<NEW_LINE>if (shouldRunSequentially(c, sequentialClasses)) {<NEW_LINE>if (!processedClasses.contains(c)) {<NEW_LINE>processedClasses.add(c);<NEW_LINE>// Sequential class: all methods in one worker<NEW_LINE>TestMethodWorker worker = createTestMethodWorker(arguments, methodInstances, params, c);<NEW_LINE>result.add(worker);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Parallel class: each method in its own worker<NEW_LINE>TestMethodWorker worker = createTestMethodWorker(arguments, Collections.singletonList(im), params, c);<NEW_LINE>result.add(worker);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | .addAll(methodsToMultipleMethodInstances(tm)); |
1,137,971 | public static Ticker adaptTickerMessage(Instrument instrument, ArrayNode arrayNode) {<NEW_LINE>return Streams.stream(arrayNode.elements()).filter(JsonNode::isObject).map(tickerNode -> {<NEW_LINE>Iterator<JsonNode> askIterator = tickerNode.get("a").iterator();<NEW_LINE>Iterator<JsonNode> bidIterator = tickerNode.get("b").iterator();<NEW_LINE>Iterator<JsonNode> closeIterator = tickerNode.<MASK><NEW_LINE>Iterator<JsonNode> volumeIterator = tickerNode.get("v").iterator();<NEW_LINE>Iterator<JsonNode> vwapIterator = tickerNode.get("p").iterator();<NEW_LINE>Iterator<JsonNode> lowPriceIterator = tickerNode.get("l").iterator();<NEW_LINE>Iterator<JsonNode> highPriceIterator = tickerNode.get("h").iterator();<NEW_LINE>Iterator<JsonNode> openPriceIterator = tickerNode.get("o").iterator();<NEW_LINE>// Move iterators forward here required, this ignores the first field if the desired<NEW_LINE>// value is in the second element.<NEW_LINE>vwapIterator.next();<NEW_LINE>volumeIterator.next();<NEW_LINE>return new Ticker.Builder().open(nextNodeAsDecimal(openPriceIterator)).ask(nextNodeAsDecimal(askIterator)).bid(nextNodeAsDecimal(bidIterator)).last(nextNodeAsDecimal(closeIterator)).high(nextNodeAsDecimal(highPriceIterator)).low(nextNodeAsDecimal(lowPriceIterator)).vwap(nextNodeAsDecimal(vwapIterator)).volume(nextNodeAsDecimal(volumeIterator)).instrument(instrument).build();<NEW_LINE>}).findFirst().orElse(null);<NEW_LINE>} | get("c").iterator(); |
1,120,566 | public static AltBn128Fq12Point twist(final AltBn128Fq2Point p) {<NEW_LINE>final Fq2 x = p.getX();<NEW_LINE>final Fq2 y = p.getY();<NEW_LINE>final Fq[] xCoeffs = x.getCoefficients();<NEW_LINE>final Fq[] yCoeffs = y.getCoefficients();<NEW_LINE>final Fq[] nX = new Fq[Fq12.DEGREE];<NEW_LINE>Arrays.fill(nX, Fq.zero());<NEW_LINE>nX[0] = xCoeffs[0].subtract(xCoeffs[1].multiply(9));<NEW_LINE>nX[6] = xCoeffs[1];<NEW_LINE>final Fq[] nY = new Fq[Fq12.DEGREE];<NEW_LINE>Arrays.fill(nY, Fq.zero());<NEW_LINE>nY[0] = yCoeffs[0].subtract(yCoeffs[1].multiply(9));<NEW_LINE>nY[6] = yCoeffs[1];<NEW_LINE>final Fq12 newX = new Fq12(nX);<NEW_LINE>final Fq12 newY = new Fq12(nY);<NEW_LINE>final Fq12 w = w();<NEW_LINE>return new AltBn128Fq12Point(newX.multiply(w.power(2)), newY.multiply(<MASK><NEW_LINE>} | w.power(3))); |
492,144 | public static void serverTick(Level level, BlockPos worldPosition, BlockState state, TileTerraPlate self) {<NEW_LINE>boolean removeMana = true;<NEW_LINE>if (self.hasValidPlatform()) {<NEW_LINE>List<ItemStack> items = self.getItems();<NEW_LINE>SimpleContainer inv = self.getInventory();<NEW_LINE>ITerraPlateRecipe recipe = self.getCurrentRecipe(inv);<NEW_LINE>if (recipe != null) {<NEW_LINE>removeMana = false;<NEW_LINE>IManaSpark spark = self.getAttachedSpark();<NEW_LINE>if (spark != null) {<NEW_LINE>SparkHelper.getSparksAround(level, worldPosition.getX() + 0.5, worldPosition.getY() + 0.5, worldPosition.getZ() + 0.5, spark.getNetwork()).filter(otherSpark -> spark != otherSpark && IXplatAbstractions.INSTANCE.findManaReceiver(level, otherSpark.getAttachPos(), null) instanceof IManaPool).forEach(os -> os.registerTransfer(spark));<NEW_LINE>}<NEW_LINE>if (self.mana > 0) {<NEW_LINE>VanillaPacketDispatcher.dispatchTEToNearbyPlayers(self);<NEW_LINE>int proportion = Float.<MASK><NEW_LINE>IXplatAbstractions.INSTANCE.sendToNear(level, worldPosition, new PacketBotaniaEffect(EffectType.TERRA_PLATE, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), proportion));<NEW_LINE>}<NEW_LINE>if (self.mana >= recipe.getMana()) {<NEW_LINE>ItemStack result = recipe.assemble(inv);<NEW_LINE>for (ItemStack item : items) {<NEW_LINE>item.setCount(0);<NEW_LINE>}<NEW_LINE>ItemEntity item = new ItemEntity(level, worldPosition.getX() + 0.5, worldPosition.getY() + 0.2, worldPosition.getZ() + 0.5, result);<NEW_LINE>item.setDeltaMovement(Vec3.ZERO);<NEW_LINE>level.addFreshEntity(item);<NEW_LINE>level.playSound(null, item.getX(), item.getY(), item.getZ(), ModSounds.terrasteelCraft, SoundSource.BLOCKS, 1F, 1F);<NEW_LINE>self.mana = 0;<NEW_LINE>level.updateNeighbourForOutputSignal(worldPosition, state.getBlock());<NEW_LINE>VanillaPacketDispatcher.dispatchTEToNearbyPlayers(self);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (removeMana) {<NEW_LINE>self.receiveMana(-1000);<NEW_LINE>}<NEW_LINE>} | floatToIntBits(self.getCompletion()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.