idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,631,349 | public void marshall(EndpointProperties endpointProperties, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (endpointProperties == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getEndpointArn(), ENDPOINTARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getMessage(), MESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getModelArn(), MODELARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDesiredModelArn(), DESIREDMODELARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDesiredInferenceUnits(), DESIREDINFERENCEUNITS_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getCurrentInferenceUnits(), CURRENTINFERENCEUNITS_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | endpointProperties.getDesiredDataAccessRoleArn(), DESIREDDATAACCESSROLEARN_BINDING); |
754,951 | public static <A> CloneableIterator<A> stack(final CloneableIterator<A>[] iterators, final Comparator<A> c, final boolean up) {<NEW_LINE>// this extends the ability to combine two iterators<NEW_LINE>// to the ability of combining a set of iterators<NEW_LINE>if (iterators == null || iterators.length == 0)<NEW_LINE>return new CloneableIterator<A>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean hasNext() {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public A next() {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void remove() {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public CloneableIterator<A> clone(Object modifier) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void close() {<NEW_LINE>}<NEW_LINE>};<NEW_LINE>if (iterators.length == 1) {<NEW_LINE>return iterators[0];<NEW_LINE>}<NEW_LINE>if (iterators.length == 2) {<NEW_LINE>if (iterators[0] == null)<NEW_LINE>return iterators[1];<NEW_LINE>if (iterators[1] == null)<NEW_LINE>return iterators[0];<NEW_LINE>return new StackIterator<A>(iterators[0], iterators<MASK><NEW_LINE>}<NEW_LINE>CloneableIterator<A> a = iterators[0];<NEW_LINE>final CloneableIterator<A>[] iterators0 = (CloneableIterator<A>[]) Array.newInstance(CloneableIterator.class, iterators.length - 1);<NEW_LINE>System.arraycopy(iterators, 1, iterators0, 0, iterators.length - 1);<NEW_LINE>if (a == null)<NEW_LINE>return stack(iterators0, c, up);<NEW_LINE>return new StackIterator<A>(a, stack(iterators0, c, up), c, up);<NEW_LINE>} | [1], c, up); |
1,678,491 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>ActionResult<List<Wo>> result = new ActionResult<>();<NEW_LINE>Portal portal = emc.find(id, Portal.class);<NEW_LINE>if (null == portal) {<NEW_LINE>throw new PortalNotExistedException(id);<NEW_LINE>}<NEW_LINE>if (!business.editable(effectivePerson, portal)) {<NEW_LINE>throw new PortalInvisibleException(effectivePerson.getDistinguishedName(), portal.getName(), portal.getId());<NEW_LINE>}<NEW_LINE>List<String> ids = business.script().listWithPortal(portal.getId());<NEW_LINE>List<Wo> wos = Wo.copier.copy(emc.list(Script.class, ids));<NEW_LINE>wos = wos.stream().sorted(Comparator.comparing(Wo::getName, Comparator.nullsLast(String::compareTo))).<MASK><NEW_LINE>result.setData(wos);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | collect(Collectors.toList()); |
251,472 | private Map<String, Object> makeContextProperies(ContextControllerFactoryForge[] controllers, StatementRawInfo statementRawInfo, StatementCompileTimeServices services) throws ExprValidationException {<NEW_LINE>LinkedHashMap<String, Object> props = new LinkedHashMap<>();<NEW_LINE>props.put(ContextPropertyEventType.PROP_CTX_NAME, EPTypePremade.STRING.getEPType());<NEW_LINE>props.put(ContextPropertyEventType.PROP_CTX_ID, EPTypePremade.INTEGERBOXED.getEPType());<NEW_LINE>if (controllers.length == 1) {<NEW_LINE>controllers[0].validateGetContextProps(props, controllers[0].getFactoryEnv().getOutermostContextName(), 0, statementRawInfo, services);<NEW_LINE>return props;<NEW_LINE>}<NEW_LINE>for (int level = 0; level < controllers.length; level++) {<NEW_LINE>String nestedContextName = controllers[level].getFactoryEnv().getContextName();<NEW_LINE>LinkedHashMap<String, Object> propsPerLevel = new LinkedHashMap<>();<NEW_LINE>propsPerLevel.put(ContextPropertyEventType.PROP_CTX_NAME, EPTypePremade.STRING.getEPType());<NEW_LINE>if (level == controllers.length - 1) {<NEW_LINE>propsPerLevel.put(ContextPropertyEventType.PROP_CTX_ID, EPTypePremade.INTEGERBOXED.getEPType());<NEW_LINE>}<NEW_LINE>controllers[level].validateGetContextProps(propsPerLevel, <MASK><NEW_LINE>props.put(nestedContextName, propsPerLevel);<NEW_LINE>}<NEW_LINE>return props;<NEW_LINE>} | nestedContextName, level, statementRawInfo, services); |
1,254,189 | public Request<ListUserImportJobsRequest> marshall(ListUserImportJobsRequest listUserImportJobsRequest) {<NEW_LINE>if (listUserImportJobsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListUserImportJobsRequest)");<NEW_LINE>}<NEW_LINE>Request<ListUserImportJobsRequest> request = new DefaultRequest<ListUserImportJobsRequest>(listUserImportJobsRequest, "AmazonCognitoIdentityProvider");<NEW_LINE>String target = "AWSCognitoIdentityProviderService.ListUserImportJobs";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (listUserImportJobsRequest.getUserPoolId() != null) {<NEW_LINE>String userPoolId = listUserImportJobsRequest.getUserPoolId();<NEW_LINE>jsonWriter.name("UserPoolId");<NEW_LINE>jsonWriter.value(userPoolId);<NEW_LINE>}<NEW_LINE>if (listUserImportJobsRequest.getMaxResults() != null) {<NEW_LINE>Integer maxResults = listUserImportJobsRequest.getMaxResults();<NEW_LINE>jsonWriter.name("MaxResults");<NEW_LINE>jsonWriter.value(maxResults);<NEW_LINE>}<NEW_LINE>if (listUserImportJobsRequest.getPaginationToken() != null) {<NEW_LINE><MASK><NEW_LINE>jsonWriter.name("PaginationToken");<NEW_LINE>jsonWriter.value(paginationToken);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | String paginationToken = listUserImportJobsRequest.getPaginationToken(); |
10,797 | public ArrayList<Actor> scrapeActors() {<NEW_LINE>ArrayList<Actor> actorList = new ArrayList<>();<NEW_LINE>Elements actorElementTabs = document.select("div.js-tab-contents div[id]");<NEW_LINE>if (actorElementTabs != null) {<NEW_LINE>for (Element currentActor : actorElementTabs) {<NEW_LINE>String actorName = currentActor.select("div.txt01 div")<MASK><NEW_LINE>String actorThumbUrl = currentActor.select("img").first().attr("src");<NEW_LINE>if (actorName != null && actorName.length() > 0) {<NEW_LINE>if (actorThumbUrl != null && actorThumbUrl.length() > 0 && !actorThumbUrl.contains("nowprinting")) {<NEW_LINE>Thumb actorThumb;<NEW_LINE>try {<NEW_LINE>actorThumb = new Thumb(actorThumbUrl);<NEW_LINE>Actor actorWithThumb = new Actor(actorName, "", actorThumb);<NEW_LINE>actorList.add(actorWithThumb);<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>Actor actorWithoutThumb = new Actor(actorName, "", null);<NEW_LINE>actorList.add(actorWithoutThumb);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Actor actorWithoutThumb = new Actor(actorName, "", null);<NEW_LINE>actorList.add(actorWithoutThumb);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return actorList;<NEW_LINE>} | .first().text(); |
1,658,416 | public static String perRequestProxyAuthorizationHeader(Request request, Realm proxyRealm) {<NEW_LINE>String proxyAuthorization = null;<NEW_LINE>if (proxyRealm != null && proxyRealm.isUsePreemptiveAuth()) {<NEW_LINE>switch(proxyRealm.getScheme()) {<NEW_LINE>case BASIC:<NEW_LINE>proxyAuthorization = computeBasicAuthentication(proxyRealm);<NEW_LINE>break;<NEW_LINE>case DIGEST:<NEW_LINE>if (isNonEmpty(proxyRealm.getNonce())) {<NEW_LINE>// update realm with request information<NEW_LINE>proxyRealm = realm(proxyRealm).setUri(request.getUri()).setMethodName(request.<MASK><NEW_LINE>proxyAuthorization = computeDigestAuthentication(proxyRealm);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case NTLM:<NEW_LINE>case KERBEROS:<NEW_LINE>case SPNEGO:<NEW_LINE>// NTLM, KERBEROS and SPNEGO are only set on the first request with a connection,<NEW_LINE>// see perConnectionProxyAuthorizationHeader<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Invalid Authentication scheme " + proxyRealm.getScheme());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return proxyAuthorization;<NEW_LINE>} | getMethod()).build(); |
848,289 | protected ConsoleReporter createInstance() {<NEW_LINE>final ConsoleReporter.Builder reporter = ConsoleReporter.forRegistry(getMetricRegistry());<NEW_LINE>if (hasProperty(DURATION_UNIT)) {<NEW_LINE>reporter.convertDurationsTo(getProperty(DURATION_UNIT, TimeUnit.class));<NEW_LINE>}<NEW_LINE>if (hasProperty(RATE_UNIT)) {<NEW_LINE>reporter.convertRatesTo(getProperty(RATE_UNIT, TimeUnit.class));<NEW_LINE>}<NEW_LINE>reporter.filter(getMetricFilter());<NEW_LINE>if (hasProperty(CLOCK_REF)) {<NEW_LINE>reporter.withClock(getPropertyRef(CLOCK_REF, Clock.class));<NEW_LINE>}<NEW_LINE>if (hasProperty(OUTPUT_REF)) {<NEW_LINE>reporter.outputTo(getPropertyRef<MASK><NEW_LINE>}<NEW_LINE>if (hasProperty(LOCALE)) {<NEW_LINE>reporter.formattedFor(parseLocale(getProperty(LOCALE)));<NEW_LINE>}<NEW_LINE>if (hasProperty(TIMEZONE)) {<NEW_LINE>reporter.formattedFor(TimeZone.getTimeZone(getProperty(TIMEZONE)));<NEW_LINE>}<NEW_LINE>return reporter.build();<NEW_LINE>} | (OUTPUT_REF, PrintStream.class)); |
400,197 | public Object calculate(Context ctx) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>if (param == null) {<NEW_LINE>throw new RQException("round" + mm.getMessage("function.missingParam"));<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>Object o = param.getLeafExpression().calculate(ctx);<NEW_LINE>return Variant.round(o);<NEW_LINE>} else {<NEW_LINE>if (param.getSubSize() != 2) {<NEW_LINE>throw new RQException("round" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>IParam p1 = param.getSub(0);<NEW_LINE>IParam <MASK><NEW_LINE>if (p1 == null || p2 == null) {<NEW_LINE>throw new RQException("round" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Object o1 = p1.getLeafExpression().calculate(ctx);<NEW_LINE>Object o2 = p2.getLeafExpression().calculate(ctx);<NEW_LINE>if (o2 instanceof Number) {<NEW_LINE>return Variant.round(o1, ((Number) o2).intValue());<NEW_LINE>} else if (o2 == null) {<NEW_LINE>return Variant.round(o1);<NEW_LINE>} else {<NEW_LINE>throw new RQException("round" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | p2 = param.getSub(1); |
105,500 | public static void display(ChassisTileEntity chassis) {<NEW_LINE>// Display a group and kill any selections of its contained chassis blocks<NEW_LINE>if (AllKeys.ctrlDown()) {<NEW_LINE>GroupEntry hoveredGroup = new GroupEntry(chassis);<NEW_LINE>for (ChassisTileEntity included : hoveredGroup.includedTEs) CreateClient.OUTLINER.<MASK><NEW_LINE>groupEntries.forEach(entry -> CreateClient.OUTLINER.remove(entry.getOutlineKey()));<NEW_LINE>groupEntries.clear();<NEW_LINE>entries.clear();<NEW_LINE>groupEntries.add(hoveredGroup);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Display an individual chassis and kill any group selections that contained it<NEW_LINE>BlockPos pos = chassis.getBlockPos();<NEW_LINE>GroupEntry entry = getExistingGroupForPos(pos);<NEW_LINE>if (entry != null)<NEW_LINE>CreateClient.OUTLINER.remove(entry.getOutlineKey());<NEW_LINE>groupEntries.clear();<NEW_LINE>entries.clear();<NEW_LINE>entries.put(pos, new Entry(chassis));<NEW_LINE>} | remove(included.getBlockPos()); |
86,040 | public void writeObject(FSTObjectOutput out, Object toWrite, FSTClazzInfo clzInfo, FSTClazzInfo.FSTFieldInfo referencedBy, int streamPosition) throws IOException {<NEW_LINE>EnumSet enset = (EnumSet) toWrite;<NEW_LINE>int count = 0;<NEW_LINE>out.writeInt(enset.size());<NEW_LINE>if (enset.isEmpty()) {<NEW_LINE>// WTF only way to determine enumtype ..<NEW_LINE>EnumSet compl = EnumSet.complementOf(enset);<NEW_LINE>out.writeStringUTF(FSTUtil.getRealEnumClass(compl.iterator().next().getClass<MASK><NEW_LINE>} else {<NEW_LINE>for (Object element : enset) {<NEW_LINE>if (count == 0) {<NEW_LINE>out.writeStringUTF(FSTUtil.getRealEnumClass(element.getClass()).getName());<NEW_LINE>}<NEW_LINE>out.writeStringUTF(element.toString());<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ()).getName()); |
1,078,733 | public IAddress map(final ICodeContainer<?> block) {<NEW_LINE>// getLastInstruction(block);<NEW_LINE>final IInstruction lastInstruction = Iterables.getFirst(block.getInstructions(), null);<NEW_LINE>final ReilTranslator<IInstruction> translator = new ReilTranslator<IInstruction>();<NEW_LINE>try {<NEW_LINE>final ReilGraph reilGraph = translator.translate(new StandardEnvironment(), lastInstruction);<NEW_LINE>final ReilBlock lastNode = reilGraph.getNodes().get(reilGraph.getNodes().size() - 1);<NEW_LINE>final ReilInstruction lastReilInstruction = Iterables.<MASK><NEW_LINE>if (// If branch-delay<NEW_LINE>isDelayedBranch(lastReilInstruction)) {<NEW_LINE>return ReilHelpers.toReilAddress(Iterables.get(block.getInstructions(), 1).getAddress());<NEW_LINE>} else {<NEW_LINE>return ReilHelpers.toReilAddress(block.getAddress());<NEW_LINE>}<NEW_LINE>} catch (final InternalTranslationException e) {<NEW_LINE>return ReilHelpers.toReilAddress(block.getAddress());<NEW_LINE>}<NEW_LINE>} | getLast(lastNode.getInstructions()); |
1,149,825 | private void initLayout(Intent intent) {<NEW_LINE>if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {<NEW_LINE>// Animate if greater than 2.3.3<NEW_LINE>overridePendingTransition(R.anim.nothing, R.anim.nothing);<NEW_LINE>}<NEW_LINE>Bundle extras = intent.getExtras();<NEW_LINE>if (extras != null) {<NEW_LINE>mType = extras.getInt(AppLock.EXTRA_TYPE, AppLock.UNLOCK_PIN);<NEW_LINE>}<NEW_LINE>mLockManager = LockManager.getInstance();<NEW_LINE>mPinCode = "";<NEW_LINE>mOldPinCode = "";<NEW_LINE>enableAppLockerIfDoesNotExist();<NEW_LINE>mLockManager.getAppLock().setPinChallengeCancelled(false);<NEW_LINE>mStepTextView = (TextView) this.findViewById(R.id.pin_code_step_textview);<NEW_LINE>mPinCodeRoundView = (PinCodeRoundView) this.findViewById(R.id.pin_code_round_view);<NEW_LINE>mPinCodeRoundView.setPinLength(this.getPinLength());<NEW_LINE>mForgotTextView = (TextView) this.findViewById(R.id.pin_code_forgot_textview);<NEW_LINE>mForgotTextView.setOnClickListener(this);<NEW_LINE>mKeyboardView = (KeyboardView) this.findViewById(R.id.pin_code_keyboard_view);<NEW_LINE>mKeyboardView.setKeyboardButtonClickedListener(this);<NEW_LINE>int logoId = mLockManager.getAppLock().getLogoId();<NEW_LINE>ImageView logoImage = ((ImageView) findViewById<MASK><NEW_LINE>if (logoId != AppLock.LOGO_ID_NONE) {<NEW_LINE>logoImage.setVisibility(View.VISIBLE);<NEW_LINE>logoImage.setImageResource(logoId);<NEW_LINE>}<NEW_LINE>mForgotTextView.setText(getForgotText());<NEW_LINE>setForgotTextVisibility();<NEW_LINE>setStepText();<NEW_LINE>} | (R.id.pin_code_logo_imageview)); |
45,253 | public static void convolve(Kernel2D_S32 kernel, GrayU16 input, GrayI16 output, ImageBorder_S32<GrayU16> binput) {<NEW_LINE>final int offset = kernel.getOffset();<NEW_LINE>final int weight = kernel.computeSum();<NEW_LINE>final int width = input.getWidth();<NEW_LINE>final int height = input.getHeight();<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int total = 0;<NEW_LINE>for (int i = 0; i < kernel.getWidth(); i++) {<NEW_LINE><MASK><NEW_LINE>for (int j = 0; j < kernel.getWidth(); j++) {<NEW_LINE>int xx = x - offset + j;<NEW_LINE>int v = kernel.get(j, i);<NEW_LINE>total += binput.get(xx, yy) * v;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>output.set(x, y, (total + weight / 2) / weight);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int yy = y - offset + i; |
1,392,214 | public void chargePoint(final RequestContext context) {<NEW_LINE>final String userId = context.pathVar("userId");<NEW_LINE>final Request request = context.getRequest();<NEW_LINE>final String pointStr = <MASK><NEW_LINE>final String memo = context.param("memo");<NEW_LINE>if (StringUtils.isBlank(pointStr) || StringUtils.isBlank(memo) || !Strings.isNumeric(memo.split("-")[0])) {<NEW_LINE>LOGGER.warn("Charge point memo format error");<NEW_LINE>context.sendRedirect(Latkes.getServePath() + "/admin/user/" + userId);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final int point = Integer.valueOf(pointStr);<NEW_LINE>final String transferId = pointtransferMgmtService.transfer(Pointtransfer.ID_C_SYS, userId, Pointtransfer.TRANSFER_TYPE_C_CHARGE, point, memo, System.currentTimeMillis(), "");<NEW_LINE>operationMgmtService.addOperation(Operation.newOperation(request, Operation.OPERATION_CODE_C_CHARGE_POINT, transferId));<NEW_LINE>final JSONObject notification = new JSONObject();<NEW_LINE>notification.put(Notification.NOTIFICATION_USER_ID, userId);<NEW_LINE>notification.put(Notification.NOTIFICATION_DATA_ID, transferId);<NEW_LINE>notificationMgmtService.addPointChargeNotification(notification);<NEW_LINE>} catch (final NumberFormatException | ServiceException e) {<NEW_LINE>final AbstractFreeMarkerRenderer renderer = new SkinRenderer(context, "admin/error.ftl");<NEW_LINE>final Map<String, Object> dataModel = renderer.getDataModel();<NEW_LINE>dataModel.put(Keys.MSG, e.getMessage());<NEW_LINE>dataModelService.fillHeaderAndFooter(context, dataModel);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>context.sendRedirect(Latkes.getServePath() + "/admin/user/" + userId);<NEW_LINE>} | context.param(Common.POINT); |
276,409 | protected AuthenticatedUserDisplayInfo parseActivitiesResponse(String responseBody) {<NEW_LINE>DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();<NEW_LINE>try (StringReader reader = new StringReader(responseBody)) {<NEW_LINE>DocumentBuilder db = dbFact.newDocumentBuilder();<NEW_LINE>Document doc = db.parse(new InputSource(reader));<NEW_LINE>String organization = getNodes(doc, "activities:employments", "employment:employment-summary", "employment:organization", "common:name").stream().findFirst().map(Node::getTextContent).map(String::trim).orElse(null);<NEW_LINE>String department = getNodes(doc, "activities:employments", "employment:employment-summary", "employment:department-name").stream().findFirst().map(Node::getTextContent).map(String::trim).orElse(null);<NEW_LINE>String role = getNodes(doc, "activities:employments", "employment:employment-summary", "employment:role-title").stream().findFirst().map(Node::getTextContent).map(String::trim).orElse(null);<NEW_LINE>String position = Stream.of(role, department).filter(Objects::nonNull).collect(joining(", "));<NEW_LINE>return new AuthenticatedUserDisplayInfo(null, null, null, organization, position);<NEW_LINE>} catch (SAXException ex) {<NEW_LINE>logger.log(Level.SEVERE, "XML error parsing response body from ORCiD: " + <MASK><NEW_LINE>} catch (IOException ex) {<NEW_LINE>logger.log(Level.SEVERE, "I/O error parsing response body from ORCiD: " + ex.getMessage(), ex);<NEW_LINE>} catch (ParserConfigurationException ex) {<NEW_LINE>logger.log(Level.SEVERE, "While parsing the ORCiD response: Bad parse configuration. " + ex.getMessage(), ex);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ex.getMessage(), ex); |
234,204 | private List<SplitPoint> buildSplitPoint(PartitionStat partition, BalanceOptions options, long expectedRowsOfPartition) {<NEW_LINE>List<SplitPoint> splitPoints = new ArrayList<>();<NEW_LINE>SplitNameBuilder snb = new SplitNameBuilder(partition.getPartitionName());<NEW_LINE>for (long offset = expectedRowsOfPartition; offset < partition.getPartitionRows(); offset += expectedRowsOfPartition) {<NEW_LINE>List<SearchDatumInfo> userKeys = queryActualPartitionKey(partition, SCAN_BATCH_SIZE, offset);<NEW_LINE>LOG.debug(String.format("real partition-key for partition %s at offset %d: %s", partition.getPartitionName(), offset, userKeys));<NEW_LINE>if (userKeys == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (SearchDatumInfo userKey : userKeys) {<NEW_LINE>SearchDatumInfo splitKey = SplitPointUtils.generateSplitBound(partition.getPartitionBy(), userKey);<NEW_LINE>SplitPoint sp = snb.build(splitKey);<NEW_LINE>splitPoints.add(sp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (splitPoints.isEmpty()) {<NEW_LINE>return splitPoints;<NEW_LINE>}<NEW_LINE>// sort and duplicate partition-keys<NEW_LINE>List<SplitPoint> sorted = SplitPointUtils.sortAndDuplicate(partition, splitPoints);<NEW_LINE>List<SplitPoint> sample = SplitPointUtils.sample(partition.getPartitionName(<MASK><NEW_LINE>LOG.info(String.format("build split-point for partition %s: %s", partition.getPartitionName(), sample));<NEW_LINE>return sample;<NEW_LINE>} | ), sorted, BalanceOptions.SPLIT_PARTITION_MAX_COUNT); |
435,180 | public static Map<String, List<SSLCertificateVH>> fetchACMCertficateInfo(BasicSessionCredentials temporaryCredentials, String skipRegions, String account, String accountName) {<NEW_LINE>log.info("ACM cert method Entry");<NEW_LINE>Map<String, List<SSLCertificateVH>> sslVH = new LinkedHashMap<>();<NEW_LINE>List<CertificateSummary> <MASK><NEW_LINE>List<SSLCertificateVH> sslCertList = new ArrayList<>();<NEW_LINE>DescribeCertificateResult describeCertificateResult = new DescribeCertificateResult();<NEW_LINE>Date expiryDate = null;<NEW_LINE>String certificateARN = null;<NEW_LINE>String domainName = null;<NEW_LINE>List<String> issuerDetails = null;<NEW_LINE>String expPrefix = InventoryConstants.ERROR_PREFIX_CODE + account + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"ACM Certificate \" , \"region\":\"";<NEW_LINE>for (Region region : RegionUtils.getRegions()) {<NEW_LINE>try {<NEW_LINE>if (!skipRegions.contains(region.getName())) {<NEW_LINE>AWSCertificateManager awsCertifcateManagerClient = AWSCertificateManagerClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();<NEW_LINE>listCertificateSummary = awsCertifcateManagerClient.listCertificates(new ListCertificatesRequest()).getCertificateSummaryList();<NEW_LINE>if (!CollectionUtils.isEmpty(listCertificateSummary)) {<NEW_LINE>for (CertificateSummary certSummary : listCertificateSummary) {<NEW_LINE>String certArn = certSummary.getCertificateArn();<NEW_LINE>DescribeCertificateRequest describeCertificateRequest = new DescribeCertificateRequest().withCertificateArn(certArn);<NEW_LINE>describeCertificateResult = awsCertifcateManagerClient.describeCertificate(describeCertificateRequest);<NEW_LINE>CertificateDetail certificateDetail = describeCertificateResult.getCertificate();<NEW_LINE>domainName = certificateDetail.getDomainName();<NEW_LINE>certificateARN = certificateDetail.getCertificateArn();<NEW_LINE>expiryDate = certificateDetail.getNotAfter();<NEW_LINE>SSLCertificateVH sslCertificate = new SSLCertificateVH();<NEW_LINE>sslCertificate.setDomainName(domainName);<NEW_LINE>sslCertificate.setCertificateARN(certificateARN);<NEW_LINE>sslCertificate.setExpiryDate(expiryDate);<NEW_LINE>sslCertificate.setIssuerDetails(issuerDetails);<NEW_LINE>sslCertList.add(sslCertificate);<NEW_LINE>}<NEW_LINE>sslVH.put(account + delimiter + accountName + delimiter + region.getName(), sslCertList);<NEW_LINE>} else {<NEW_LINE>log.info("List is empty");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.warn(expPrefix + region.getName() + InventoryConstants.ERROR_CAUSE + e.getMessage() + "\"}");<NEW_LINE>ErrorManageUtil.uploadError(account, region.getName(), "acmcertificate", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sslVH;<NEW_LINE>} | listCertificateSummary = new ArrayList<>(); |
355,156 | public void paint(Graphics g) {<NEW_LINE>// left-to-right<NEW_LINE>boolean dotLTR = true;<NEW_LINE>Position.Bias dotBias = Position.Bias.Forward;<NEW_LINE>//<NEW_LINE>if (isVisible()) {<NEW_LINE>try {<NEW_LINE>TextUI mapper = getComponent().getUI();<NEW_LINE>Rectangle r = mapper.modelToView(getComponent(), getDot(), dotBias);<NEW_LINE>Rectangle e = mapper.modelToView(getComponent(), getDot() + 1, dotBias);<NEW_LINE>// g.setColor(getComponent().getCaretColor());<NEW_LINE>g.setColor(Color.blue);<NEW_LINE>//<NEW_LINE>int cWidth = e.x - r.x;<NEW_LINE>int cHeight = 4;<NEW_LINE>int cThick = 2;<NEW_LINE>//<NEW_LINE>// top<NEW_LINE>g.fillRect(r.x - 1, r.y, cWidth, cThick);<NEW_LINE>// |<NEW_LINE>g.fillRect(r.x - 1, <MASK><NEW_LINE>// |<NEW_LINE>g.fillRect(r.x - 1 + cWidth, r.y, cThick, cHeight);<NEW_LINE>//<NEW_LINE>int yStart = r.y + r.height;<NEW_LINE>// button<NEW_LINE>g.fillRect(r.x - 1, yStart - cThick, cWidth, cThick);<NEW_LINE>// |<NEW_LINE>g.fillRect(r.x - 1, yStart - cHeight, cThick, cHeight);<NEW_LINE>// |<NEW_LINE>g.fillRect(r.x - 1 + cWidth, yStart - cHeight, cThick, cHeight);<NEW_LINE>} catch (BadLocationException e) {<NEW_LINE>// can't render<NEW_LINE>// System.err.println("Can't render cursor");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// isVisible<NEW_LINE>} | r.y, cThick, cHeight); |
826,453 | protected ITranslatableString buildMessage() {<NEW_LINE>final TranslatableStringBuilder message = TranslatableStrings.builder();<NEW_LINE>message.appendADMessage(MSG_TaxNotFound);<NEW_LINE>//<NEW_LINE>if (productId != null) {<NEW_LINE>final String productName = Services.get(IProductBL.class).getProductValueAndName(productId);<NEW_LINE>message.append(" - ").appendADElement("M_Product_ID").append(": ").append(productName);<NEW_LINE>}<NEW_LINE>if (chargeId > 0) {<NEW_LINE>final String chargeName = InterfaceWrapperHelper.create(Env.getCtx(), chargeId, I_C_Charge.class, ITrx.TRXNAME_None).getName();<NEW_LINE>message.append(" - ").appendADElement("C_Charge_ID").append(": ").append(chargeName);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>if (taxCategoryId != null) {<NEW_LINE>final ITranslatableString taxCategoryName = Services.get(ITaxDAO.class).getTaxCategoryNameById(taxCategoryId);<NEW_LINE>message.append(" - ").appendADElement("C_TaxCategory_ID").append<MASK><NEW_LINE>}<NEW_LINE>if (isSOTrx != null) {<NEW_LINE>message.append(" - ").appendADElement("IsSOTrx").append(": ").append(isSOTrx);<NEW_LINE>}<NEW_LINE>if (orgId != null) {<NEW_LINE>final String orgName = Services.get(IOrgDAO.class).retrieveOrgName(orgId);<NEW_LINE>message.append(" - ").appendADElement("AD_Org_ID").append(": ").append(orgName);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Ship info<NEW_LINE>if (shipDate != null) {<NEW_LINE>message.append(" - ").appendADElement("ShipDate").append(": ").appendDate(shipDate);<NEW_LINE>}<NEW_LINE>if (shipFromC_Location_ID != null || shipFromCountryId != null) {<NEW_LINE>final ITranslatableString locationString = getLocationString(shipFromC_Location_ID, shipFromCountryId);<NEW_LINE>message.append(" - ").appendADElement("ShipFrom").append(": ").append(locationString);<NEW_LINE>}<NEW_LINE>if (shipToC_Location_ID != null) {<NEW_LINE>final String locationString = getLocationString(shipToC_Location_ID);<NEW_LINE>message.append(" - ").appendADElement("ShipTo").append(": ").append(locationString);<NEW_LINE>} else if (shipToCountryId != null) {<NEW_LINE>message.append(" - ").appendADElement("ShipTo").append(": ").append(getCountryName(shipToCountryId));<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Bill info<NEW_LINE>if (billDate != null) {<NEW_LINE>message.append(" - ").appendADElement("BillDate").append(": ").appendDate(billDate);<NEW_LINE>}<NEW_LINE>if (billFromC_Location_ID != null || billFromCountryId != null) {<NEW_LINE>final ITranslatableString locationString = getLocationString(billFromC_Location_ID, billFromCountryId);<NEW_LINE>message.append(" - ").appendADElement("BillFrom").append(": ").append(locationString);<NEW_LINE>}<NEW_LINE>if (billToC_Location_ID != null) {<NEW_LINE>final String locationString = getLocationString(billToC_Location_ID);<NEW_LINE>message.append(" - ").appendADElement("BillTo").append(": ").append(locationString);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>//<NEW_LINE>return message.build();<NEW_LINE>} | (": ").append(taxCategoryName); |
360,354 | public static LeafSlice[] slices(List<LeafReaderContext> leaves, int maxDocsPerSlice, int maxSegmentsPerSlice) {<NEW_LINE>// Make a copy so we can sort:<NEW_LINE>List<LeafReaderContext> sortedLeaves = new ArrayList<>(leaves);<NEW_LINE>// Sort by maxDoc, descending:<NEW_LINE>Collections.sort(sortedLeaves, Collections.reverseOrder(Comparator.comparingInt(l -> l.reader().maxDoc())));<NEW_LINE>final List<List<LeafReaderContext>> groupedLeaves = new ArrayList<>();<NEW_LINE>long docSum = 0;<NEW_LINE>List<LeafReaderContext> group = null;<NEW_LINE>for (LeafReaderContext ctx : sortedLeaves) {<NEW_LINE>if (ctx.reader().maxDoc() > maxDocsPerSlice) {<NEW_LINE>assert group == null;<NEW_LINE>groupedLeaves.add(Collections.singletonList(ctx));<NEW_LINE>} else {<NEW_LINE>if (group == null) {<NEW_LINE>group = new ArrayList<>();<NEW_LINE>group.add(ctx);<NEW_LINE>groupedLeaves.add(group);<NEW_LINE>} else {<NEW_LINE>group.add(ctx);<NEW_LINE>}<NEW_LINE>docSum += ctx.reader().maxDoc();<NEW_LINE>if (group.size() >= maxSegmentsPerSlice || docSum > maxDocsPerSlice) {<NEW_LINE>group = null;<NEW_LINE>docSum = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LeafSlice[] slices = new <MASK><NEW_LINE>int upto = 0;<NEW_LINE>for (List<LeafReaderContext> currentLeaf : groupedLeaves) {<NEW_LINE>slices[upto] = new LeafSlice(currentLeaf);<NEW_LINE>++upto;<NEW_LINE>}<NEW_LINE>return slices;<NEW_LINE>} | LeafSlice[groupedLeaves.size()]; |
615,228 | public void applyPreferences() {<NEW_LINE>if (!hasChanges) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>hasChanges = false;<NEW_LINE>// must do the store before setting the preference<NEW_LINE>// to ensure that the store is flushed<NEW_LINE>disableButton.store();<NEW_LINE>List<String> elts = patternList.getElements();<NEW_LINE>List<String> result = new ArrayList<>(<MASK><NEW_LINE>for (String elt : elts) {<NEW_LINE>result.add(elt);<NEW_LINE>result.add(patternList.isChecked(elt) ? "y" : "n");<NEW_LINE>}<NEW_LINE>Activator.getDefault().setScriptFilters(preferences, result);<NEW_LINE>boolean yesNo = MessageDialog.openQuestion(parent.getShell(), Messages.getString("GroovyCompilerPreferencesPage.ScriptFolders.Rebuild1"), Messages.getString("GroovyCompilerPreferencesPage.ScriptFolders.Rebuild2"));<NEW_LINE>if (yesNo) {<NEW_LINE>if (project != null) {<NEW_LINE>new BuildJob(project).schedule();<NEW_LINE>} else {<NEW_LINE>new BuildJob(GroovyNature.getAllAccessibleGroovyProjects().toArray(new IProject[0])).schedule();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | elts.size() * 2); |
260,428 | public Collection<LoadSpec> findSupportedLoadSpecs(ByteProvider provider) throws IOException {<NEW_LINE>List<LoadSpec> loadSpecs = new ArrayList<>();<NEW_LINE>BinaryReader reader = new BinaryReader(provider, true);<NEW_LINE>try {<NEW_LINE>byte[] magicBytes = provider.readBytes(0, CDexConstants.MAGIC.length());<NEW_LINE>if (CDexConstants.MAGIC.equals(new String(magicBytes))) {<NEW_LINE>// should be CDEX<NEW_LINE>DexHeader header = DexHeaderFactory.getDexHeader(reader);<NEW_LINE>if (CDexConstants.MAGIC.equals(new String(header.getMagic()))) {<NEW_LINE>List<QueryResult> queries = QueryOpinionService.query(getName(), DexConstants.MACHINE, null);<NEW_LINE>for (QueryResult result : queries) {<NEW_LINE>loadSpecs.add(new LoadSpec(this, 0, result));<NEW_LINE>}<NEW_LINE>if (loadSpecs.isEmpty()) {<NEW_LINE>loadSpecs.add(new LoadSpec<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>return loadSpecs;<NEW_LINE>} | (this, 0, true)); |
887,669 | public static void datasetDeIdentify(String srcDatasetName, String destDatasetName) throws IOException {<NEW_LINE>// String srcDatasetName =<NEW_LINE>// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-src-dataset-id");<NEW_LINE>// String destDatasetName =<NEW_LINE>// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dest-dataset-id");<NEW_LINE>// Initialize the client, which will be used to interact with the service.<NEW_LINE>CloudHealthcare client = createClient();<NEW_LINE>// Configure what information needs to be De-Identified.<NEW_LINE>// For more information on de-identifying using tags, please see the following:<NEW_LINE>// https://cloud.google.com/healthcare/docs/how-tos/dicom-deidentify#de-identification_using_tags<NEW_LINE>TagFilterList tags = new TagFilterList().setTags(Arrays.asList("PatientID"));<NEW_LINE>DicomConfig dicomConfig = new DicomConfig().setKeepList(tags);<NEW_LINE>DeidentifyConfig config = new DeidentifyConfig().setDicom(dicomConfig);<NEW_LINE>// Create the de-identify request and configure any parameters.<NEW_LINE>DeidentifyDatasetRequest deidentifyRequest = new DeidentifyDatasetRequest().setDestinationDataset(destDatasetName).setConfig(config);<NEW_LINE>Datasets.Deidentify request = client.projects().locations().datasets(<MASK><NEW_LINE>// Execute the request, wait for the operation to complete, and process the results.<NEW_LINE>try {<NEW_LINE>Operation operation = request.execute();<NEW_LINE>while (operation.getDone() == null || !operation.getDone()) {<NEW_LINE>// Update the status of the operation with another request.<NEW_LINE>// Pause for 500ms between requests.<NEW_LINE>Thread.sleep(500);<NEW_LINE>operation = client.projects().locations().datasets().operations().get(operation.getName()).execute();<NEW_LINE>}<NEW_LINE>System.out.println("De-identified Dataset created. Response content: " + operation.getResponse());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>System.out.printf("Error during request execution: %s", ex.toString());<NEW_LINE>ex.printStackTrace(System.out);<NEW_LINE>}<NEW_LINE>} | ).deidentify(srcDatasetName, deidentifyRequest); |
637,712 | public AssetPropertyValue unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AssetPropertyValue assetPropertyValue = new AssetPropertyValue();<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("value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>assetPropertyValue.setValue(AssetPropertyVariantJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("timestamp", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>assetPropertyValue.setTimestamp(AssetPropertyTimestampJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("quality", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>assetPropertyValue.setQuality(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 assetPropertyValue;<NEW_LINE>} | ().unmarshall(context)); |
266,398 | public static void createMarkers(final IJavaProject javaProject, final SortedBugCollection theCollection, final ISchedulingRule rule, IProgressMonitor monitor) {<NEW_LINE>if (monitor.isCanceled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final List<MarkerParameter> bugParameters = createBugParameters(javaProject, theCollection, monitor);<NEW_LINE>if (monitor.isCanceled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WorkspaceJob wsJob = new WorkspaceJob("Creating SpotBugs markers") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public IStatus runInWorkspace(IProgressMonitor monitor1) throws CoreException {<NEW_LINE>IProject project = javaProject.getProject();<NEW_LINE>try {<NEW_LINE>new MarkerReporter(bugParameters, theCollection<MASK><NEW_LINE>} catch (CoreException e) {<NEW_LINE>FindbugsPlugin.getDefault().logException(e, "Core exception on add marker");<NEW_LINE>return e.getStatus();<NEW_LINE>}<NEW_LINE>return monitor1.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>wsJob.setRule(rule);<NEW_LINE>wsJob.setSystem(true);<NEW_LINE>wsJob.setUser(false);<NEW_LINE>wsJob.schedule();<NEW_LINE>} | , project).run(monitor1); |
879,032 | private void periodicCheck() {<NEW_LINE>final long deltaMillis = (System.currentTimeMillis() - <MASK><NEW_LINE>// every 2 minutes<NEW_LINE>// Ensure that we are not overreacting...<NEW_LINE>if (deltaMillis < periodicUpdatesInterval) {<NEW_LINE>this.scheduledExecutorService.schedule(this::periodicCheck, periodicUpdatesInterval - deltaMillis, TimeUnit.MILLISECONDS);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final boolean haveChanges;<NEW_LINE>try {<NEW_LINE>final List<Change> currentChanges = changesRegistry.getCurrentChanges(null);<NEW_LINE>haveChanges = !currentChangeSet.getUpdatedEventTypes(currentChanges).isEmpty() || !currentChangeSet.getChangesToRemove(currentChanges, zkChangesTTL).isEmpty();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOG.warn("Failed to run periodic check, will retry soon", e);<NEW_LINE>scheduledExecutorService.schedule(this::periodicCheck, 1, TimeUnit.SECONDS);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (haveChanges) {<NEW_LINE>reprocessUntilExceptionDisappears();<NEW_LINE>}<NEW_LINE>scheduledExecutorService.schedule(this::periodicCheck, periodicUpdatesInterval, TimeUnit.MILLISECONDS);<NEW_LINE>} | this.lastCheck.get()); |
1,126,198 | // Finishes all terms in this field<NEW_LINE>public void finish() throws IOException {<NEW_LINE>if (numTerms > 0) {<NEW_LINE>// if (DEBUG) System.out.println("BTTW: finish prefixStarts=" +<NEW_LINE>// Arrays.toString(prefixStarts));<NEW_LINE>// Add empty term to force closing of all final blocks:<NEW_LINE>pushTerm(new BytesRef());<NEW_LINE>// TODO: if pending.size() is already 1 with a non-zero prefix length<NEW_LINE>// we can save writing a "degenerate" root block, but we have to<NEW_LINE>// fix all the places that assume the root block's prefix is the empty string:<NEW_LINE>pushTerm(new BytesRef());<NEW_LINE>writeBlocks(0, pending.size());<NEW_LINE>// We better have one final "root" block:<NEW_LINE>assert pending.size() == 1 && !pending.get(0).isTerm : "pending.size()=" + pending.size() + " pending=" + pending;<NEW_LINE>final PendingBlock root = (PendingBlock) pending.get(0);<NEW_LINE>assert root.prefix.length == 0;<NEW_LINE>final BytesRef rootCode = root.index.getEmptyOutput();<NEW_LINE>assert rootCode != null;<NEW_LINE>ByteBuffersDataOutput metaOut = new ByteBuffersDataOutput();<NEW_LINE>fields.add(metaOut);<NEW_LINE><MASK><NEW_LINE>metaOut.writeVLong(numTerms);<NEW_LINE>metaOut.writeVInt(rootCode.length);<NEW_LINE>metaOut.writeBytes(rootCode.bytes, rootCode.offset, rootCode.length);<NEW_LINE>assert fieldInfo.getIndexOptions() != IndexOptions.NONE;<NEW_LINE>if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {<NEW_LINE>metaOut.writeVLong(sumTotalTermFreq);<NEW_LINE>}<NEW_LINE>metaOut.writeVLong(sumDocFreq);<NEW_LINE>metaOut.writeVInt(docsSeen.cardinality());<NEW_LINE>writeBytesRef(metaOut, new BytesRef(firstPendingTerm.termBytes));<NEW_LINE>writeBytesRef(metaOut, new BytesRef(lastPendingTerm.termBytes));<NEW_LINE>metaOut.writeVLong(indexOut.getFilePointer());<NEW_LINE>// Write FST to index<NEW_LINE>root.index.save(metaOut, indexOut);<NEW_LINE>// System.out.println(" write FST " + indexStartFP + " field=" + fieldInfo.name);<NEW_LINE>} else {<NEW_LINE>assert sumTotalTermFreq == 0 || fieldInfo.getIndexOptions() == IndexOptions.DOCS && sumTotalTermFreq == -1;<NEW_LINE>assert sumDocFreq == 0;<NEW_LINE>assert docsSeen.cardinality() == 0;<NEW_LINE>}<NEW_LINE>} | metaOut.writeVInt(fieldInfo.number); |
930,654 | private void fixAppDirLinesList(String path, List<String> lines) {<NEW_LINE>if (lines != null) {<NEW_LINE>String line;<NEW_LINE>for (int i = 0; i < lines.size(); i++) {<NEW_LINE>line = lines.get(i);<NEW_LINE>if (line.contains("/data/user/0/pan.alexander.tordnscrypt")) {<NEW_LINE>line = line.replaceAll("/data/user/0/pan.alexander.tordnscrypt.*?/", appDataDir + "/");<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (activity != null && activity.getText(R.string.package_name).toString().contains(".gp") && path.contains("dnscrypt-proxy.toml") && !PathVars.isModulesInstalled(preferenceRepository.get())) {<NEW_LINE>lines = prepareDNSCryptForGP(lines);<NEW_LINE>}<NEW_LINE>FileManager.writeTextFileSynchronous(activity, path, lines);<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("correctAppDir readTextFile return null " + path);<NEW_LINE>}<NEW_LINE>} | lines.set(i, line); |
284,395 | public static DescribeScdnDomainBpsDataResponse unmarshall(DescribeScdnDomainBpsDataResponse describeScdnDomainBpsDataResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeScdnDomainBpsDataResponse.setRequestId(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.RequestId"));<NEW_LINE>describeScdnDomainBpsDataResponse.setDomainName(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.DomainName"));<NEW_LINE>describeScdnDomainBpsDataResponse.setStartTime(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.StartTime"));<NEW_LINE>describeScdnDomainBpsDataResponse.setEndTime(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.EndTime"));<NEW_LINE>describeScdnDomainBpsDataResponse.setDataInterval(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.DataInterval"));<NEW_LINE>List<DataModule> bpsDataPerInterval = new ArrayList<DataModule>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeScdnDomainBpsDataResponse.BpsDataPerInterval.Length"); i++) {<NEW_LINE>DataModule dataModule = new DataModule();<NEW_LINE>dataModule.setTimeStamp(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.BpsDataPerInterval[" + i + "].TimeStamp"));<NEW_LINE>dataModule.setBpsValue(_ctx.stringValue<MASK><NEW_LINE>dataModule.setHttpBpsValue(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.BpsDataPerInterval[" + i + "].HttpBpsValue"));<NEW_LINE>dataModule.setHttpsBpsValue(_ctx.stringValue("DescribeScdnDomainBpsDataResponse.BpsDataPerInterval[" + i + "].HttpsBpsValue"));<NEW_LINE>bpsDataPerInterval.add(dataModule);<NEW_LINE>}<NEW_LINE>describeScdnDomainBpsDataResponse.setBpsDataPerInterval(bpsDataPerInterval);<NEW_LINE>return describeScdnDomainBpsDataResponse;<NEW_LINE>} | ("DescribeScdnDomainBpsDataResponse.BpsDataPerInterval[" + i + "].BpsValue")); |
397,245 | public void Busy() {<NEW_LINE>Busy.setText("BUSY");<NEW_LINE>// RED<NEW_LINE>Busy.setBackground(new java.awt.Color<MASK><NEW_LINE>SnippetsBusy.setText("BUSY");<NEW_LINE>// RED<NEW_LINE>SnippetsBusy.setBackground(new java.awt.Color(153, 0, 0));<NEW_LINE>ProgressBar.setValue(0);<NEW_LINE>ProgressBar.setVisible(true);<NEW_LINE>FileSendESP.setEnabled(false);<NEW_LINE>MenuItemFileSendESP.setEnabled(false);<NEW_LINE>MenuItemFileRemoveESP.setEnabled(false);<NEW_LINE>NodeReset.setEnabled(false);<NEW_LINE>FileDo.setEnabled(false);<NEW_LINE>MenuItemFileDo.setEnabled(false);<NEW_LINE>MenuItemEditSendSelected.setEnabled(false);<NEW_LINE>MenuItemEditorSendSelected.setEnabled(false);<NEW_LINE>ButtonSendSelected.setEnabled(false);<NEW_LINE>MenuItemEditSendLine.setEnabled(false);<NEW_LINE>MenuItemEditorSendLine.setEnabled(false);<NEW_LINE>ButtonSendLine.setEnabled(false);<NEW_LINE>SnippetRun.setEnabled(false);<NEW_LINE>ButtonSnippet0.setEnabled(false);<NEW_LINE>ButtonSnippet1.setEnabled(false);<NEW_LINE>ButtonSnippet2.setEnabled(false);<NEW_LINE>ButtonSnippet3.setEnabled(false);<NEW_LINE>ButtonSnippet4.setEnabled(false);<NEW_LINE>ButtonSnippet5.setEnabled(false);<NEW_LINE>ButtonSnippet6.setEnabled(false);<NEW_LINE>ButtonSnippet7.setEnabled(false);<NEW_LINE>ButtonSnippet8.setEnabled(false);<NEW_LINE>ButtonSnippet9.setEnabled(false);<NEW_LINE>ButtonSnippet10.setEnabled(false);<NEW_LINE>ButtonSnippet11.setEnabled(false);<NEW_LINE>ButtonSnippet12.setEnabled(false);<NEW_LINE>ButtonSnippet13.setEnabled(false);<NEW_LINE>ButtonSnippet14.setEnabled(false);<NEW_LINE>ButtonSnippet15.setEnabled(false);<NEW_LINE>} | (153, 0, 0)); |
1,785,460 | private boolean isFirstNode() {<NEW_LINE>// if no node selected, return...<NEW_LINE>if (!isNodeSelected()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// get the selected node, so we know where to insert the new bullet<NEW_LINE>DefaultMutableTreeNode selection = <MASK><NEW_LINE>// if the selection is a node-entry...<NEW_LINE>// ...return true when selected entry equals the first child-node of the selected entry's parent<NEW_LINE>if (!isBulletSelected()) {<NEW_LINE>return (0 == selection.getParent().getIndex(selection));<NEW_LINE>// return (selection.equals(selection.getParent().getChildAt(0)));<NEW_LINE>} else // else if the selection is a bullet-point...<NEW_LINE>{<NEW_LINE>// get the selected node's index<NEW_LINE>int index = selection.getParent().getIndex(selection);<NEW_LINE>// if index is 0, it is the first node.<NEW_LINE>if (0 == index) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// else check whether the node before the selection is a bullet and return false, if it is...<NEW_LINE>return !selection.getParent().getChildAt(index - 1).getAllowsChildren();<NEW_LINE>}<NEW_LINE>} | (DefaultMutableTreeNode) jTreeDesktop.getLastSelectedPathComponent(); |
420,050 | final DisassociateConnectPeerResult executeDisassociateConnectPeer(DisassociateConnectPeerRequest disassociateConnectPeerRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateConnectPeerRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateConnectPeerRequest> request = null;<NEW_LINE>Response<DisassociateConnectPeerResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateConnectPeerRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateConnectPeerRequest));<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, "DisassociateConnectPeer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateConnectPeerResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new DisassociateConnectPeerResultJsonUnmarshaller()); |
992,595 | public Request<AdminDisableProviderForUserRequest> marshall(AdminDisableProviderForUserRequest adminDisableProviderForUserRequest) {<NEW_LINE>if (adminDisableProviderForUserRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(AdminDisableProviderForUserRequest)");<NEW_LINE>}<NEW_LINE>Request<AdminDisableProviderForUserRequest> request = new DefaultRequest<AdminDisableProviderForUserRequest>(adminDisableProviderForUserRequest, "AmazonCognitoIdentityProvider");<NEW_LINE>String target = "AWSCognitoIdentityProviderService.AdminDisableProviderForUser";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (adminDisableProviderForUserRequest.getUserPoolId() != null) {<NEW_LINE>String userPoolId = adminDisableProviderForUserRequest.getUserPoolId();<NEW_LINE>jsonWriter.name("UserPoolId");<NEW_LINE>jsonWriter.value(userPoolId);<NEW_LINE>}<NEW_LINE>if (adminDisableProviderForUserRequest.getUser() != null) {<NEW_LINE>ProviderUserIdentifierType user = adminDisableProviderForUserRequest.getUser();<NEW_LINE>jsonWriter.name("User");<NEW_LINE>ProviderUserIdentifierTypeJsonMarshaller.getInstance().marshall(user, jsonWriter);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.addHeader("Content-Type", "application/x-amz-json-1.1"); |
368,047 | public void insertFrom(int insertIndex, WasmArray.OfObject values) {<NEW_LINE>Object[] original = elements;<NEW_LINE>int newLength = length + values.length;<NEW_LINE>// Ensure enough capacity.<NEW_LINE>if (newLength > elements.length) {<NEW_LINE>elements = new Object[getNewCapacity(elements.length, newLength)];<NEW_LINE>// Copy only up to index since the other will be moved anyway.<NEW_LINE>copy(this.elements, 0, original, 0, insertIndex);<NEW_LINE>}<NEW_LINE>// Make room for the values that will be inserted by moving the existing elements to the<NEW_LINE>// end so that they are not overwritten.<NEW_LINE><MASK><NEW_LINE>copy(this.elements, insertEndIndex, original, insertIndex, newLength - insertEndIndex);<NEW_LINE>// Copy new values into the insert location.<NEW_LINE>copy(this.elements, insertIndex, values.elements, 0, values.length);<NEW_LINE>// Adjust the final size to cover all copied items<NEW_LINE>length = newLength;<NEW_LINE>} | int insertEndIndex = insertIndex + values.length; |
898,077 | private static boolean tryNamespaceFromPath(Config config) {<NEW_LINE>LOGGER.debug("Trying to configure client namespace from Kubernetes service account namespace path...");<NEW_LINE>if (Utils.getSystemPropertyOrEnvVar(KUBERNETES_TRYNAMESPACE_PATH_SYSTEM_PROPERTY, true)) {<NEW_LINE>String serviceAccountNamespace = <MASK><NEW_LINE>boolean serviceAccountNamespaceExists = Files.isRegularFile(new File(serviceAccountNamespace).toPath());<NEW_LINE>if (serviceAccountNamespaceExists) {<NEW_LINE>LOGGER.debug("Found service account namespace at: [{}].", serviceAccountNamespace);<NEW_LINE>try {<NEW_LINE>String namespace = new String(Files.readAllBytes(new File(serviceAccountNamespace).toPath()));<NEW_LINE>config.setNamespace(namespace.replace(System.lineSeparator(), ""));<NEW_LINE>return true;<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.error("Error reading service account namespace from: [" + serviceAccountNamespace + "].", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.debug("Did not find service account namespace at: [{}]. Ignoring.", serviceAccountNamespace);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | Utils.getSystemPropertyOrEnvVar(KUBERNETES_NAMESPACE_FILE, KUBERNETES_NAMESPACE_PATH); |
689,075 | public static GetPatentPlanListResponse unmarshall(GetPatentPlanListResponse getPatentPlanListResponse, UnmarshallerContext _ctx) {<NEW_LINE>getPatentPlanListResponse.setRequestId<MASK><NEW_LINE>getPatentPlanListResponse.setPageNum(_ctx.integerValue("GetPatentPlanListResponse.PageNum"));<NEW_LINE>getPatentPlanListResponse.setSuccess(_ctx.booleanValue("GetPatentPlanListResponse.Success"));<NEW_LINE>getPatentPlanListResponse.setTotalItemNum(_ctx.integerValue("GetPatentPlanListResponse.TotalItemNum"));<NEW_LINE>getPatentPlanListResponse.setPageSize(_ctx.integerValue("GetPatentPlanListResponse.PageSize"));<NEW_LINE>getPatentPlanListResponse.setTotalPageNum(_ctx.integerValue("GetPatentPlanListResponse.TotalPageNum"));<NEW_LINE>List<Produces> data = new ArrayList<Produces>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetPatentPlanListResponse.Data.Length"); i++) {<NEW_LINE>Produces produces = new Produces();<NEW_LINE>produces.setOwner(_ctx.stringValue("GetPatentPlanListResponse.Data[" + i + "].Owner"));<NEW_LINE>produces.setContact(_ctx.stringValue("GetPatentPlanListResponse.Data[" + i + "].Contact"));<NEW_LINE>produces.setSoldCount(_ctx.integerValue("GetPatentPlanListResponse.Data[" + i + "].SoldCount"));<NEW_LINE>produces.setUnSoldCount(_ctx.stringValue("GetPatentPlanListResponse.Data[" + i + "].UnSoldCount"));<NEW_LINE>produces.setName(_ctx.stringValue("GetPatentPlanListResponse.Data[" + i + "].Name"));<NEW_LINE>produces.setPlanId(_ctx.longValue("GetPatentPlanListResponse.Data[" + i + "].PlanId"));<NEW_LINE>produces.setTotalCount(_ctx.integerValue("GetPatentPlanListResponse.Data[" + i + "].TotalCount"));<NEW_LINE>data.add(produces);<NEW_LINE>}<NEW_LINE>getPatentPlanListResponse.setData(data);<NEW_LINE>return getPatentPlanListResponse;<NEW_LINE>} | (_ctx.stringValue("GetPatentPlanListResponse.RequestId")); |
918,543 | protected static ResponseMessage buildResponse(ServiceClient.Request request, CloseableHttpResponse httpResponse) throws IOException {<NEW_LINE>assert (httpResponse != null);<NEW_LINE>ResponseMessage response = new ResponseMessage(request);<NEW_LINE>response.setUrl(request.getUri());<NEW_LINE>response.setHttpResponse(httpResponse);<NEW_LINE>if (httpResponse.getStatusLine() != null) {<NEW_LINE>response.setStatusCode(httpResponse.getStatusLine().getStatusCode());<NEW_LINE>}<NEW_LINE>if (httpResponse.getEntity() != null) {<NEW_LINE>if (response.isSuccessful()) {<NEW_LINE>response.setContent(httpResponse.getEntity().getContent());<NEW_LINE>} else {<NEW_LINE>readAndSetErrorResponse(httpResponse.getEntity().getContent(), response);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Header header : httpResponse.getAllHeaders()) {<NEW_LINE>if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(header.getName())) {<NEW_LINE>response.setContentLength(Long.parseLong<MASK><NEW_LINE>}<NEW_LINE>response.addHeader(header.getName(), header.getValue());<NEW_LINE>}<NEW_LINE>HttpUtil.convertHeaderCharsetFromIso88591(response.getHeaders());<NEW_LINE>return response;<NEW_LINE>} | (header.getValue())); |
852,320 | public Tensor<?> parseBatchTensors(List<String> values, TensorInfo tensorInfo) {<NEW_LINE>int batchSize = values.size();<NEW_LINE>int dtype = tensorInfo.getDtypeValue();<NEW_LINE>long[] shape = TF2TensorUtils.getTensorShape(tensorInfo);<NEW_LINE>adjustShapeFromValues(shape, values, true);<NEW_LINE>String[] allValueStrings;<NEW_LINE>if (dtype != DataType.DT_STRING_VALUE) {<NEW_LINE>allValueStrings = values.stream().flatMap(d -> Arrays.stream(extractValueStrings(d))).toArray(String[]::new);<NEW_LINE>} else {<NEW_LINE>long numElements = 1;<NEW_LINE>for (int i = 0; i < shape.length; i += 1) {<NEW_LINE>if (shape[i] == -1) {<NEW_LINE>shape[i] = 1;<NEW_LINE>}<NEW_LINE>numElements *= shape[i];<NEW_LINE>}<NEW_LINE>Preconditions.checkArgument(numElements == batchSize, String.format("String tensor can only have 1 element, but current tensor's shape is [%s].", Arrays.toString(shape)));<NEW_LINE>allValueStrings = values.toArray(new String[0]);<NEW_LINE>}<NEW_LINE>// If there is only a dimension with size -1, we set it manually.<NEW_LINE>{<NEW_LINE>Integer undeterminedDim = null;<NEW_LINE>int dimSize = allValueStrings.length;<NEW_LINE>for (int i = 0; i < shape.length; i += 1) {<NEW_LINE>if (shape[i] == -1) {<NEW_LINE>if (null == undeterminedDim) {<NEW_LINE>undeterminedDim = i;<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("There are more than 1 dimensions are of size -1: " + Arrays.toString(shape));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>dimSize /= shape[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (null != undeterminedDim) {<NEW_LINE>shape[undeterminedDim] = dimSize;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>switch(dtype) {<NEW_LINE>case DataType.DT_STRING_VALUE:<NEW_LINE>{<NEW_LINE>return parseStringTensor(allValueStrings, shape);<NEW_LINE>}<NEW_LINE>case DataType.DT_BOOL_VALUE:<NEW_LINE>{<NEW_LINE>return parseBoolTensor(allValueStrings, shape);<NEW_LINE>}<NEW_LINE>case DataType.DT_FLOAT_VALUE:<NEW_LINE>{<NEW_LINE>return parseFloatTensor(allValueStrings, shape);<NEW_LINE>}<NEW_LINE>case DataType.DT_DOUBLE_VALUE:<NEW_LINE>{<NEW_LINE>return parseDoubleTensor(allValueStrings, shape);<NEW_LINE>}<NEW_LINE>case DataType.DT_INT32_VALUE:<NEW_LINE>{<NEW_LINE>return parseIntTensor(allValueStrings, shape);<NEW_LINE>}<NEW_LINE>case DataType.DT_INT64_VALUE:<NEW_LINE>{<NEW_LINE>return parseLongTensor(allValueStrings, shape);<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new UnsupportedOperationException("Not support dtype: " <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | + DataType.forNumber(dtype)); |
517,268 | private void handleDictionaryBasedColumn(SegmentDirectory.Writer segmentWriter, ColumnMetadata columnMetadata, JsonIndexCreatorProvider indexCreatorProvider) throws IOException {<NEW_LINE>File indexDir = _segmentMetadata.getIndexDir();<NEW_LINE>try (ForwardIndexReader forwardIndexReader = LoaderUtils.getForwardIndexReader(segmentWriter, columnMetadata);<NEW_LINE>ForwardIndexReaderContext readerContext = forwardIndexReader.createContext();<NEW_LINE>Dictionary dictionary = LoaderUtils.getDictionary(segmentWriter, columnMetadata);<NEW_LINE>JsonIndexCreator jsonIndexCreator = indexCreatorProvider.newJsonIndexCreator(IndexCreationContext.builder().withIndexDir(indexDir).withColumnMetadata(columnMetadata).build().forJsonIndex())) {<NEW_LINE>int numDocs = columnMetadata.getTotalDocs();<NEW_LINE>for (int i = 0; i < numDocs; i++) {<NEW_LINE>int dictId = <MASK><NEW_LINE>jsonIndexCreator.add(dictionary.getStringValue(dictId));<NEW_LINE>}<NEW_LINE>jsonIndexCreator.seal();<NEW_LINE>}<NEW_LINE>} | forwardIndexReader.getDictId(i, readerContext); |
838,119 | private Token identifier() {<NEW_LINE>int startPosition = getCurrentPositionInInput();<NEW_LINE>StringBuffer sbuf = new StringBuffer();<NEW_LINE>while ((Character.isJavaIdentifierPart(lookAhead(1))) || partOfConnector()) {<NEW_LINE>sbuf.append(lookAhead(1));<NEW_LINE>consume();<NEW_LINE>}<NEW_LINE>String readString = new String(sbuf);<NEW_LINE>// System.out.println(readString);<NEW_LINE>if (connectors.contains(readString)) {<NEW_LINE>return new Token(LogicTokenTypes.CONNECTIVE, readString, startPosition);<NEW_LINE>} else if (quantifiers.contains(readString)) {<NEW_LINE>return new Token(LogicTokenTypes.QUANTIFIER, readString, startPosition);<NEW_LINE>} else if (domain.getPredicates().contains(readString)) {<NEW_LINE>return new Token(LogicTokenTypes.PREDICATE, readString, startPosition);<NEW_LINE>} else if (domain.getFunctions().contains(readString)) {<NEW_LINE>return new Token(LogicTokenTypes.FUNCTION, readString, startPosition);<NEW_LINE>} else if (domain.getConstants().contains(readString)) {<NEW_LINE>return new Token(LogicTokenTypes.CONSTANT, readString, startPosition);<NEW_LINE>} else if (isVariable(readString)) {<NEW_LINE>return new Token(<MASK><NEW_LINE>} else if (readString.equals("=")) {<NEW_LINE>return new Token(LogicTokenTypes.EQUALS, readString, startPosition);<NEW_LINE>} else {<NEW_LINE>throw new LexerException("Lexing error on character " + lookAhead(1) + " at position " + getCurrentPositionInInput(), getCurrentPositionInInput());<NEW_LINE>}<NEW_LINE>} | LogicTokenTypes.VARIABLE, readString, startPosition); |
1,790,002 | void updateDetails(NodeView nodeView, int minNodeWidth, int maxNodeWidth) {<NEW_LINE>NodeModel node = nodeView.getModel();<NEW_LINE>String detailTextText = DetailModel.getDetailText(node);<NEW_LINE>if (detailTextText == null) {<NEW_LINE>nodeView.removeContent(NodeView.DETAIL_VIEWER_POSITION);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final DetailModel detailText = DetailModel.getDetail(node);<NEW_LINE>DetailsView detailContent = (DetailsView) nodeView.getContent(NodeView.DETAIL_VIEWER_POSITION);<NEW_LINE>if (detailContent == null) {<NEW_LINE>detailContent = createDetailView();<NEW_LINE>nodeView.addContent(detailContent, NodeView.DETAIL_VIEWER_POSITION);<NEW_LINE>}<NEW_LINE>final MapView map = nodeView.getMap();<NEW_LINE>if (detailText.isHidden()) {<NEW_LINE>final ArrowIcon icon = new ArrowIcon(nodeView, true);<NEW_LINE>detailContent.setIcon(icon);<NEW_LINE>detailContent.updateText("");<NEW_LINE>detailContent.setTextRenderingIcon(null);<NEW_LINE>} else {<NEW_LINE>detailContent.setFont(map.getDetailFont());<NEW_LINE>detailContent.setHorizontalAlignment(map.getDetailHorizontalAlignment());<NEW_LINE>detailContent.setIcon(new ArrowIcon(nodeView, false));<NEW_LINE>String text;<NEW_LINE>try {<NEW_LINE>TextController textController = map.getModeController().getExtension(TextController.class);<NEW_LINE>final Object transformedContent = textController.getTransformedObject(node, detailText, detailTextText);<NEW_LINE>Icon icon = textController.getIcon(transformedContent);<NEW_LINE>detailContent.setTextRenderingIcon(icon);<NEW_LINE>text = icon == null ? transformedContent.toString() : "";<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LogUtils.warn(e.getMessage());<NEW_LINE>text = TextUtils.format("MainView.errorUpdateText", detailTextText, e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>detailContent.updateText(text);<NEW_LINE>}<NEW_LINE>detailContent.setForeground(map.getDetailForeground());<NEW_LINE>detailContent.<MASK><NEW_LINE>detailContent.setMinimumWidth(minNodeWidth);<NEW_LINE>detailContent.setMaximumWidth(maxNodeWidth);<NEW_LINE>NodeCss detailCss = map.getDetailCss();<NEW_LINE>detailContent.setStyleSheet(detailCss.css, detailCss.getStyleSheet());<NEW_LINE>detailContent.revalidate();<NEW_LINE>map.repaint();<NEW_LINE>} | setBackground(map.getDetailBackground()); |
1,313,613 | // Inspired by {@code GrizzlyHttpContainer.GrizzlyBinder} from Jersey to Grizzly integration.<NEW_LINE>@Override<NEW_LINE>protected void configure() {<NEW_LINE>bindFactory(WebServerRequestReferencingFactory.class).to(ServerRequest.class).proxy(true).proxyForSameScope(false).in(RequestScoped.class);<NEW_LINE>bindFactory(ReferencingFactory.<ServerRequest>referenceFactory()).to(new GenericType<Ref<ServerRequest>>() {<NEW_LINE>}).in(RequestScoped.class);<NEW_LINE>bindFactory(WebServerResponseReferencingFactory.class).to(ServerResponse.class).proxy(true).proxyForSameScope(false<MASK><NEW_LINE>bindFactory(ReferencingFactory.<ServerResponse>referenceFactory()).to(new GenericType<Ref<ServerResponse>>() {<NEW_LINE>}).in(RequestScoped.class);<NEW_LINE>bindFactory(SpanContextReferencingFactory.class).to(SpanContext.class).proxy(false).in(RequestScoped.class).named(JerseySupport.REQUEST_SPAN_CONTEXT);<NEW_LINE>bindFactory(ReferencingFactory.<Span>referenceFactory()).to(new GenericType<Ref<Span>>() {<NEW_LINE>}).in(RequestScoped.class);<NEW_LINE>bindFactory(ReferencingFactory.<SpanContext>referenceFactory()).to(new GenericType<Ref<SpanContext>>() {<NEW_LINE>}).in(RequestScoped.class);<NEW_LINE>} | ).in(RequestScoped.class); |
444,537 | public int update(UpdateBuilder ub, final SearchCriteria<?> sc, Integer rows) {<NEW_LINE>StringBuilder sql = null;<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>final TransactionLegacy txn = TransactionLegacy.currentTxn();<NEW_LINE>try {<NEW_LINE>final String searchClause = sc.getWhereClause();<NEW_LINE>sql = ub.toSql(_tables);<NEW_LINE>if (sql == null) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>sql.append(searchClause);<NEW_LINE>if (rows != null) {<NEW_LINE>sql.append(" LIMIT ").append(rows);<NEW_LINE>}<NEW_LINE>txn.start();<NEW_LINE>pstmt = txn.prepareAutoCloseStatement(sql.toString());<NEW_LINE>Collection<Ternary<Attribute, Boolean, Object><MASK><NEW_LINE>int i = 1;<NEW_LINE>for (final Ternary<Attribute, Boolean, Object> value : changes) {<NEW_LINE>prepareAttribute(i++, pstmt, value.first(), value.third());<NEW_LINE>}<NEW_LINE>for (Pair<Attribute, Object> value : sc.getValues()) {<NEW_LINE>prepareAttribute(i++, pstmt, value.first(), value.second());<NEW_LINE>}<NEW_LINE>int result = pstmt.executeUpdate();<NEW_LINE>txn.commit();<NEW_LINE>ub.clear();<NEW_LINE>return result;<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>handleEntityExistsException(e);<NEW_LINE>throw new CloudRuntimeException("DB Exception on: " + pstmt, e);<NEW_LINE>}<NEW_LINE>} | > changes = ub.getChanges(); |
595,775 | private void generateCheckCastBToJShort(MethodVisitor mv, BType sourceType) {<NEW_LINE>if (TypeTags.isIntegerTypeTag(sourceType.tag)) {<NEW_LINE>mv.visitInsn(L2I);<NEW_LINE>mv.visitInsn(I2S);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(sourceType.tag) {<NEW_LINE>case TypeTags.BYTE:<NEW_LINE>mv.visitInsn(I2S);<NEW_LINE>break;<NEW_LINE>case TypeTags.FLOAT:<NEW_LINE>mv.visitInsn(D2I);<NEW_LINE>mv.visitInsn(I2S);<NEW_LINE>break;<NEW_LINE>case TypeTags.HANDLE:<NEW_LINE>mv.visitMethodInsn(INVOKEVIRTUAL, <MASK><NEW_LINE>break;<NEW_LINE>case TypeTags.FINITE:<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, TYPE_CHECKER, ANY_TO_INT_METHOD, ANY_TO_JLONG, false);<NEW_LINE>mv.visitInsn(L2I);<NEW_LINE>mv.visitInsn(I2S);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new BLangCompilerException("Casting is not supported from '" + sourceType + "' to 'java short'");<NEW_LINE>}<NEW_LINE>} | HANDLE_VALUE, GET_VALUE_METHOD, RETURN_OBJECT, false); |
1,328,158 | private static ProcessStatus processLoginSuccess(final PwmRequest pwmRequest, final boolean persistentLoginEnabled) throws PwmUnrecoverableException, IOException {<NEW_LINE>final ConfigManagerBean configManagerBean = pwmRequest.getPwmDomain().getSessionStateService().getBean(pwmRequest, ConfigManagerBean.class);<NEW_LINE>final PwmDomain pwmDomain = pwmRequest.getPwmDomain();<NEW_LINE>final PwmSession pwmSession = pwmRequest.getPwmSession();<NEW_LINE>configManagerBean.setPasswordVerified(true);<NEW_LINE>IntruderServiceClient.clearAddressAndSession(pwmDomain, pwmSession);<NEW_LINE>pwmDomain.getIntruderService().clear(<MASK><NEW_LINE>pwmRequest.getPwmSession().getSessionStateBean().setSessionIdRecycleNeeded(true);<NEW_LINE>if (persistentLoginEnabled && "on".equals(pwmRequest.readParameterAsString("remember"))) {<NEW_LINE>writePersistentLoginCookie(pwmRequest);<NEW_LINE>}<NEW_LINE>if (configManagerBean.getPrePasswordEntryUrl() != null) {<NEW_LINE>final String originalUrl = configManagerBean.getPrePasswordEntryUrl();<NEW_LINE>configManagerBean.setPrePasswordEntryUrl(null);<NEW_LINE>pwmRequest.getPwmResponse().sendRedirect(originalUrl);<NEW_LINE>return ProcessStatus.Halt;<NEW_LINE>}<NEW_LINE>pwmRequest.getPwmResponse().sendRedirect(pwmRequest.getURLwithQueryString());<NEW_LINE>return ProcessStatus.Continue;<NEW_LINE>} | IntruderRecordType.USERNAME, PwmConstants.CONFIGMANAGER_INTRUDER_USERNAME); |
787,663 | private void initListeners() {<NEW_LINE>ddListener = new PropertyChangeListener() {<NEW_LINE><NEW_LINE>public void propertyChange(PropertyChangeEvent evt) {<NEW_LINE>String propertyName = evt.getPropertyName();<NEW_LINE><MASK><NEW_LINE>Object oldValue = evt.getOldValue();<NEW_LINE>if (DDDataObject.PROP_DOCUMENT_DTD.equals(propertyName)) {<NEW_LINE>firePropertyChange(PROPERTY_DOCUMENT_TYPE, oldValue, newValue);<NEW_LINE>}<NEW_LINE>if (DataObject.PROP_VALID.equals(propertyName) && Boolean.TRUE.equals(newValue)) {<NEW_LINE>removePropertyChangeListener(DDDataNode.this.ddListener);<NEW_LINE>}<NEW_LINE>if (Node.PROP_PROPERTY_SETS.equals(propertyName)) {<NEW_LINE>firePropertySetsChange(null, null);<NEW_LINE>}<NEW_LINE>if (XmlMultiViewDataObject.PROP_SAX_ERROR.equals(propertyName)) {<NEW_LINE>fireShortDescriptionChange((String) oldValue, (String) newValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>getDataObject().addPropertyChangeListener(ddListener);<NEW_LINE>} | Object newValue = evt.getNewValue(); |
151,110 | public static void main(String[] args) {<NEW_LINE>// Object based empty ArrayList<NEW_LINE>ArrayList<Object> jlist = new ArrayList<Object>();<NEW_LINE>System.out.println(jlist);<NEW_LINE>System.out.<MASK><NEW_LINE>// String array<NEW_LINE>String[] str_array = { "a", "b", "c" };<NEW_LINE>System.out.println(str_array.toString());<NEW_LINE>System.out.println(str_array.length);<NEW_LINE>// add the array of strings to the list<NEW_LINE>jlist.add(str_array);<NEW_LINE>System.out.println(jlist.toString());<NEW_LINE>System.out.println(jlist.size());<NEW_LINE>// create a new ArrayList from String array<NEW_LINE>ArrayList<Object> str_list = new ArrayList<Object>(Arrays.asList(str_array.toString()));<NEW_LINE>jlist.add(str_list);<NEW_LINE>System.out.println(jlist.toString());<NEW_LINE>System.out.println(jlist.size());<NEW_LINE>// add an empty Object to ArrayList<NEW_LINE>jlist.add(new Object());<NEW_LINE>System.out.println(jlist.toString());<NEW_LINE>System.out.println(jlist.size());<NEW_LINE>// new ArrayList to wrap everything up<NEW_LINE>ArrayList plain_list = new ArrayList();<NEW_LINE>plain_list.add(str_array);<NEW_LINE>plain_list.add(str_list);<NEW_LINE>plain_list.add(jlist);<NEW_LINE>System.out.println(plain_list.toString());<NEW_LINE>System.out.println(plain_list.size());<NEW_LINE>} | println(jlist.size()); |
1,781,957 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = new String[] { "key", "value" };<NEW_LINE>String epl = "@name('create') create window MyWindowUN#unique(key) as MySimpleKeyValueMap;\n" + "insert into MyWindowUN select theString as key, longBoxed as value from SupportBean;\n" + "@name('s0') select irstream key, value as value from MyWindowUN;\n" + "@name('delete') on SupportMarketDataBean as s0 delete from MyWindowUN as s1 where s0.symbol = s1.key;\n";<NEW_LINE>env.compileDeploy(epl).addListener("delete").addListener("s0").addListener("create");<NEW_LINE>sendSupportBean(env, "G1", 1L);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G1", 1L });<NEW_LINE>env.assertPropsPerRowIterator("create", fields, new Object[][] { { "G1", 1L } });<NEW_LINE>sendSupportBean(env, "G2", 20L);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G2", 20L });<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("create", fields, new Object[][] { { "G1", 1L }, { "G2", 20L } });<NEW_LINE>// delete G2<NEW_LINE>sendMarketBean(env, "G2");<NEW_LINE>env.assertPropsOld("s0", fields, new Object[] { "G2", 20L });<NEW_LINE>sendSupportBean(env, "G1", 2L);<NEW_LINE>env.assertPropsIRPair("s0", fields, new Object[] { "G1", 2L }, new Object[] { "G1", 1L });<NEW_LINE>env.assertPropsPerRowIterator("create", fields, new Object[][] { { "G1", 2L } });<NEW_LINE>sendSupportBean(env, "G2", 21L);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G2", 21L });<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("create", fields, new Object[][] { { "G1", 2L }, { "G2", 21L } });<NEW_LINE>sendSupportBean(env, "G2", 22L);<NEW_LINE>env.assertPropsIRPair("s0", fields, new Object[] { "G2", 22L }, new Object[] { "G2", 21L });<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("create", fields, new Object[][] { { "G1", 2L }, { "G2", 22L } });<NEW_LINE>sendMarketBean(env, "G1");<NEW_LINE>env.assertPropsOld("s0", fields, new Object[] { "G1", 2L });<NEW_LINE>env.assertPropsPerRowIterator("create", fields, new Object[][] <MASK><NEW_LINE>env.undeployAll();<NEW_LINE>} | { { "G2", 22L } }); |
787,300 | public static ContentValues contentValuesFromSerializedString(String string) {<NEW_LINE>if (string == null)<NEW_LINE>return new ContentValues();<NEW_LINE>ContentValues result = new ContentValues();<NEW_LINE>fromSerialized(string, result, new SerializedPut<ContentValues>() {<NEW_LINE><NEW_LINE>public void put(ContentValues object, String key, char type, String value) throws NumberFormatException {<NEW_LINE>switch(type) {<NEW_LINE>case 'i':<NEW_LINE>object.put(key, Integer.parseInt(value));<NEW_LINE>break;<NEW_LINE>case 'd':<NEW_LINE>object.put(key, Double.parseDouble(value));<NEW_LINE>break;<NEW_LINE>case 'l':<NEW_LINE>object.put(key, Long.parseLong(value));<NEW_LINE>break;<NEW_LINE>case 's':<NEW_LINE>object.put(key, value<MASK><NEW_LINE>break;<NEW_LINE>case 'b':<NEW_LINE>object.put(key, Boolean.parseBoolean(value));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>} | .replace(SEPARATOR_ESCAPE, SERIALIZATION_SEPARATOR)); |
1,201,752 | protected double invCdfRootFinding(double p, double tol) {<NEW_LINE>if (p < 0 || p > 1)<NEW_LINE>throw new ArithmeticException("Value of p must be in the range [0,1], not " + p);<NEW_LINE>// two special case checks, as they can cause a failure to get a positive and negative value on the ends, which means we can't do a search for the root<NEW_LINE>// Special case check, p < min value<NEW_LINE>if (min() >= Integer.MIN_VALUE)<NEW_LINE>if (p <= cdf(min()))<NEW_LINE>return min();<NEW_LINE>// special case check, p >= max value<NEW_LINE>if (max() < Integer.MAX_VALUE)<NEW_LINE>if (p > cdf(max() - 1))<NEW_LINE>return max();<NEW_LINE>// stewpwise nature fo discrete can cause problems for search, so we will use a smoothed cdf to pass in<NEW_LINE>// double toRet= invCdf(p, );<NEW_LINE>// Lets use an interpolated version of the CDF so that our numerical methods will behave better<NEW_LINE>Function1D cdfInterpolated = (double x) -> {<NEW_LINE>double query = x;<NEW_LINE>// if it happens to fall on an int we just compute the regular value<NEW_LINE>if (Math.rint(query) == query)<NEW_LINE>return cdf((int) query) - p;<NEW_LINE>// else, interpolate<NEW_LINE>double larger = query + 1;<NEW_LINE>double diff = larger - query;<NEW_LINE>return cdf(query) * diff + cdf(larger) <MASK><NEW_LINE>};<NEW_LINE>double a = Double.isInfinite(min()) ? Integer.MIN_VALUE * .95 : min();<NEW_LINE>double b = Double.isInfinite(max()) ? Integer.MAX_VALUE * .95 : max();<NEW_LINE>double toRet = Zeroin.root(tol, a, b, cdfInterpolated);<NEW_LINE>return Math.round(toRet);<NEW_LINE>} | * (1 - diff) - p; |
1,038,832 | private static void formatSchemaGrants(final SourceFile src, final AbstractSchemaNode schemaNode) {<NEW_LINE>final Iterable<SchemaGrant> schemaGrants = schemaNode.getSchemaGrants();<NEW_LINE>if (schemaGrants != null) {<NEW_LINE>final List<SchemaGrant> list = Iterables.toList(schemaGrants);<NEW_LINE>if (!list.isEmpty()) {<NEW_LINE>final Set<String> read = new HashSet<>();<NEW_LINE>final Set<String> write = new HashSet<>();<NEW_LINE>final Set<String> delete = new HashSet<>();<NEW_LINE>final Set<String> accessControl = new HashSet<>();<NEW_LINE>for (final SchemaGrant grant : list) {<NEW_LINE>final String id = grant.getPrincipalId();<NEW_LINE>if (grant.getProperty(SchemaGrant.allowRead)) {<NEW_LINE>read.add(id);<NEW_LINE>}<NEW_LINE>if (grant.getProperty(SchemaGrant.allowWrite)) {<NEW_LINE>write.add(id);<NEW_LINE>}<NEW_LINE>if (grant.getProperty(SchemaGrant.allowDelete)) {<NEW_LINE>delete.add(id);<NEW_LINE>}<NEW_LINE>if (grant.getProperty(SchemaGrant.allowAccessControl)) {<NEW_LINE>accessControl.add(id);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>src.line(schemaNode, "private static final Set<String> readGrants = new HashSet<>(", formatJoined(read), ");");<NEW_LINE>src.line(schemaNode, "private static final Set<String> writeGrants = new HashSet<>(", formatJoined(write), ");");<NEW_LINE>src.line(schemaNode, "private static final Set<String> deleteGrants = new HashSet<>(", formatJoined(delete), ");");<NEW_LINE>src.line(schemaNode, "private static final Set<String> accessControlGrants = new HashSet<>(", formatJoined(accessControl), ");");<NEW_LINE>src.line(schemaNode, "@Override");<NEW_LINE><MASK><NEW_LINE>src.line(schemaNode, "final String id = principal.getUuid();");<NEW_LINE>src.begin(schemaNode, "switch (permission.name()) {");<NEW_LINE>src.line(schemaNode, "case \"read\": return readGrants.contains(id);");<NEW_LINE>src.line(schemaNode, "case \"write\": return writeGrants.contains(id);");<NEW_LINE>src.line(schemaNode, "case \"delete\": return deleteGrants.contains(id);");<NEW_LINE>src.line(schemaNode, "case \"accessControl\": return accessControlGrants.contains(id);");<NEW_LINE>src.end();<NEW_LINE>src.line(schemaNode, "return super.allowedBySchema(principal, permission);");<NEW_LINE>src.end();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | src.begin(schemaNode, "protected boolean allowedBySchema(final org.structr.core.entity.Principal principal, final org.structr.common.Permission permission) {"); |
226,856 | public void createAnUser(View view) {<NEW_LINE>AndroidNetworking.post(ApiEndPoint.BASE_URL + ApiEndPoint.POST_CREATE_AN_USER).addBodyParameter("firstname", "Suman").addBodyParameter("lastname", "Shekhar").setTag(this).setPriority(Priority.LOW).build().setAnalyticsListener(new AnalyticsListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onReceived(long timeTakenInMillis, long bytesSent, long bytesReceived, boolean isFromCache) {<NEW_LINE>Log.d(TAG, " timeTakenInMillis : " + timeTakenInMillis);<NEW_LINE>Log.d(TAG, " bytesSent : " + bytesSent);<NEW_LINE>Log.<MASK><NEW_LINE>Log.d(TAG, " isFromCache : " + isFromCache);<NEW_LINE>}<NEW_LINE>}).getAsOkHttpResponseAndJSONObject(new OkHttpResponseAndJSONObjectRequestListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponse(Response okHttpResponse, JSONObject response) {<NEW_LINE>Log.d(TAG, "onResponse object : " + response.toString());<NEW_LINE>Log.d(TAG, "onResponse isMainThread : " + String.valueOf(Looper.myLooper() == Looper.getMainLooper()));<NEW_LINE>if (okHttpResponse.isSuccessful()) {<NEW_LINE>Log.d(TAG, "onResponse success headers : " + okHttpResponse.headers().toString());<NEW_LINE>} else {<NEW_LINE>Log.d(TAG, "onResponse not success headers : " + okHttpResponse.headers().toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(ANError anError) {<NEW_LINE>Utils.logError(TAG, anError);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | d(TAG, " bytesReceived : " + bytesReceived); |
93,114 | protected ResourceHandle createSingleResource(ResourceAllocator resourceAllocator) throws PoolingException {<NEW_LINE>ResourceHandle resourceHandle;<NEW_LINE>int count = 0;<NEW_LINE>long startTime;<NEW_LINE>while (true) {<NEW_LINE>try {<NEW_LINE>count++;<NEW_LINE>startTime = System.currentTimeMillis();<NEW_LINE>resourceHandle = resourceAllocator.createResource();<NEW_LINE>if (_logger.isLoggable(Level.FINE)) {<NEW_LINE>_logger.log(Level.FINE, "Time taken to create a single resource : {0} and adding to the pool (ms) : {1}", new Object[] { resourceHandle.getResourceSpec().getResourceId(), System<MASK><NEW_LINE>}<NEW_LINE>if (validation || validateAtmostEveryIdleSecs)<NEW_LINE>resourceHandle.setLastValidated(System.currentTimeMillis());<NEW_LINE>break;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>if (_logger.isLoggable(Level.FINE)) {<NEW_LINE>_logger.log(Level.FINE, "Connection creation failed for " + count + " time. It will be retried, " + "if connection creation retrial is enabled.", ex);<NEW_LINE>}<NEW_LINE>if (!connectionCreationRetry_ || count > connectionCreationRetryAttempts_)<NEW_LINE>throw new PoolingException(ex);<NEW_LINE>long elapsedWaitTime = System.currentTimeMillis() - resourceStartTime.get();<NEW_LINE>if (elapsedWaitTime + conCreationRetryInterval_ >= maxWaitTime) {<NEW_LINE>poolManagerWaitTimeExpired();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Thread.sleep(conCreationRetryInterval_);<NEW_LINE>} catch (InterruptedException ie) {<NEW_LINE>// ignore this exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resourceHandle;<NEW_LINE>} | .currentTimeMillis() - startTime }); |
43,579 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {<NEW_LINE>// Since we use length based framing, any exception reading in TCP<NEW_LINE>// stream has the high likelihood of us getting out of sync on the<NEW_LINE>// stream, and not being able to recover. So close the connection and<NEW_LINE>// hope for the better luck next time.<NEW_LINE>try {<NEW_LINE>Throwable rootCause = cause;<NEW_LINE>while (null != rootCause.getCause()) {<NEW_LINE>rootCause = rootCause.getCause();<NEW_LINE>if (rootCause instanceof SSLException || rootCause instanceof GeneralSecurityException || rootCause instanceof RejectedExecutionException) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String error = rootCause.toString();<NEW_LINE>String remote = StringUtil.toString(ctx.channel().remoteAddress());<NEW_LINE>if (rootCause instanceof SSLException || rootCause instanceof GeneralSecurityException || rootCause instanceof RejectedExecutionException) {<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.warn("{} in channel handler chain for endpoint {}. Closing connection.", error, remote, rootCause);<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("{} in channel handler chain for endpoint {}. Closing connection.", error, remote);<NEW_LINE>}<NEW_LINE>} else if (rootCause instanceof IOException) {<NEW_LINE>LOGGER.warn("{} in channel handler chain for endpoint {}. Closing connection.", error, remote);<NEW_LINE>} else {<NEW_LINE>LOGGER.error("{} in channel handler chain for endpoint {}. Closing connection.", error, cause);<NEW_LINE>}<NEW_LINE>if (LOGGER_BAN.isInfoEnabled()) {<NEW_LINE>boolean ban = rootCause instanceof NotSslRecordException;<NEW_LINE>if (ban) {<NEW_LINE>SocketAddress remoteAddress = ctx.channel().remoteAddress();<NEW_LINE>if (remoteAddress instanceof InetSocketAddress) {<NEW_LINE>remote = ((InetSocketAddress) remoteAddress).getAddress().getHostAddress();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>ctx.close();<NEW_LINE>}<NEW_LINE>} | LOGGER_BAN.info("TLS Ban: {}", remote); |
716,426 | public boolean validate() throws ContractValidateException {<NEW_LINE>if (this.any == null) {<NEW_LINE>throw new ContractValidateException(ActuatorConstant.CONTRACT_NOT_EXIST);<NEW_LINE>}<NEW_LINE>if (chainBaseManager == null) {<NEW_LINE>throw new ContractValidateException("No account store or witness store!");<NEW_LINE>}<NEW_LINE>AccountStore accountStore = chainBaseManager.getAccountStore();<NEW_LINE>WitnessStore witnessStore = chainBaseManager.getWitnessStore();<NEW_LINE>if (!this.any.is(WitnessUpdateContract.class)) {<NEW_LINE>throw new ContractValidateException("contract type error, expected type [WitnessUpdateContract],real type[" + <MASK><NEW_LINE>}<NEW_LINE>final WitnessUpdateContract contract;<NEW_LINE>try {<NEW_LINE>contract = this.any.unpack(WitnessUpdateContract.class);<NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>throw new ContractValidateException(e.getMessage());<NEW_LINE>}<NEW_LINE>byte[] ownerAddress = contract.getOwnerAddress().toByteArray();<NEW_LINE>if (!DecodeUtil.addressValid(ownerAddress)) {<NEW_LINE>throw new ContractValidateException("Invalid address");<NEW_LINE>}<NEW_LINE>if (!accountStore.has(ownerAddress)) {<NEW_LINE>throw new ContractValidateException("account does not exist");<NEW_LINE>}<NEW_LINE>if (!TransactionUtil.validUrl(contract.getUpdateUrl().toByteArray())) {<NEW_LINE>throw new ContractValidateException("Invalid url");<NEW_LINE>}<NEW_LINE>if (!witnessStore.has(ownerAddress)) {<NEW_LINE>throw new ContractValidateException("Witness does not exist");<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | any.getClass() + "]"); |
1,068,350 | final CreateRuleResult executeCreateRule(CreateRuleRequest createRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createRuleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateRuleRequest> request = null;<NEW_LINE>Response<CreateRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateRuleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createRuleRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "FraudDetector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateRuleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new CreateRuleResultJsonUnmarshaller()); |
1,248,244 | private void updateButtons(final boolean playing) {<NEW_LINE>Timber.d("Updating buttons");<NEW_LINE>runOnUiThread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>mPoster.setKeepScreenOn(playing);<NEW_LINE>if (!playing) {<NEW_LINE>mPlayPauseButton.setImageResource(R.drawable.ic_play);<NEW_LINE>mPlayPauseButton.setContentDescription(getString(R.string.lbl_play));<NEW_LINE>} else {<NEW_LINE>mPlayPauseButton.setImageResource(R.drawable.ic_pause);<NEW_LINE>mPlayPauseButton.setContentDescription(getString(R.string.lbl_pause));<NEW_LINE>}<NEW_LINE>mRepeatButton.setActivated(mediaManager.getValue().isRepeatMode());<NEW_LINE>mSaveButton.setEnabled(mediaManager.getValue().getCurrentAudioQueueSize() > 1);<NEW_LINE>mPrevButton.setEnabled(mediaManager.getValue().hasPrevAudioItem());<NEW_LINE>mNextButton.setEnabled(mediaManager.getValue().hasNextAudioItem());<NEW_LINE>mShuffleButton.setEnabled(mediaManager.getValue(<MASK><NEW_LINE>mShuffleButton.setActivated(mediaManager.getValue().isShuffleMode());<NEW_LINE>if (mBaseItem != null) {<NEW_LINE>mAlbumButton.setEnabled(mBaseItem.getAlbumId() != null);<NEW_LINE>mArtistButton.setEnabled(mBaseItem.getAlbumArtists() != null && mBaseItem.getAlbumArtists().size() > 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ).getCurrentAudioQueueSize() > 1); |
161,371 | public void FNTBuilder(InputStream fontStream) throws FontFormatException, IOException {<NEW_LINE>this.inputFormat = InputFontFormat.FORMAT_BMFONT;<NEW_LINE>bmfont = new BMFont();<NEW_LINE>// parse BMFont file<NEW_LINE>try {<NEW_LINE>bmfont.parse(fontStream);<NEW_LINE>} catch (BMFontFormatException e) {<NEW_LINE>throw new FontFormatException(e.getMessage());<NEW_LINE>}<NEW_LINE>int maxAscent = 0;<NEW_LINE>int maxDescent = 0;<NEW_LINE>for (int i = 0; i < bmfont.charArray.size(); ++i) {<NEW_LINE>Char c = bmfont.charArray.get(i);<NEW_LINE>int ascent = bmfont.base - (int) c.yoffset;<NEW_LINE>int descent = c.height - ascent;<NEW_LINE>maxAscent = Math.max(ascent, maxAscent);<NEW_LINE>maxDescent = <MASK><NEW_LINE>Glyph glyph = new Glyph();<NEW_LINE>glyph.ascent = ascent;<NEW_LINE>glyph.descent = descent;<NEW_LINE>glyph.x = c.x;<NEW_LINE>glyph.y = c.y;<NEW_LINE>glyph.c = c.id;<NEW_LINE>glyph.index = i;<NEW_LINE>glyph.advance = (int) c.xadvance;<NEW_LINE>glyph.leftBearing = (int) c.xoffset;<NEW_LINE>glyph.width = c.width;<NEW_LINE>glyphs.add(glyph);<NEW_LINE>}<NEW_LINE>fontMapBuilder.setMaxAscent(maxAscent).setMaxDescent(maxDescent);<NEW_LINE>} | Math.max(descent, maxDescent); |
1,721,534 | public Long generateNewDPAE(Employee employee) throws AxelorException {<NEW_LINE>EmploymentContract mainEmploymentContract = employee.getMainEmploymentContract();<NEW_LINE>if (mainEmploymentContract == null) {<NEW_LINE>throw new AxelorException(TraceBackRepository.CATEGORY_MISSING_FIELD, I18n.get(IExceptionMessage.EMPLOYEE_CONTRACT_OF_EMPLOYMENT), employee.getName());<NEW_LINE>}<NEW_LINE>Company payCompany = mainEmploymentContract.getPayCompany();<NEW_LINE>Partner employer = payCompany.getPartner();<NEW_LINE>DPAE newDPAE = new DPAE();<NEW_LINE>// Employer<NEW_LINE>newDPAE.setRegistrationCode(employer.getRegistrationCode());<NEW_LINE>if (employer.getMainActivity() != null && employer.getMainActivity().getFullName() != null) {<NEW_LINE>newDPAE.setMainActivityCode(employer.getMainActivity().getFullName());<NEW_LINE>}<NEW_LINE>newDPAE.setCompany(payCompany);<NEW_LINE>newDPAE.setCompanyAddress(employer.getMainAddress());<NEW_LINE>newDPAE.setCompanyFixedPhone(employer.getFixedPhone());<NEW_LINE>if (payCompany.getHrConfig() != null) {<NEW_LINE>newDPAE.setHealthService(payCompany.getHrConfig().getHealthService());<NEW_LINE>newDPAE.setHealthServiceAddress(payCompany.<MASK><NEW_LINE>}<NEW_LINE>// Employee<NEW_LINE>newDPAE.setLastName(employee.getContactPartner().getName());<NEW_LINE>newDPAE.setFirstName(employee.getContactPartner().getFirstName());<NEW_LINE>newDPAE.setSocialSecurityNumber(employee.getSocialSecurityNumber());<NEW_LINE>newDPAE.setSexSelect(employee.getSexSelect());<NEW_LINE>newDPAE.setBirthDate(employee.getBirthDate());<NEW_LINE>newDPAE.setDepartmentOfBirth(employee.getDepartmentOfBirth());<NEW_LINE>newDPAE.setCityOfBirth(employee.getCityOfBirth());<NEW_LINE>newDPAE.setCountryOfBirth(employee.getCountryOfBirth());<NEW_LINE>// Contract<NEW_LINE>newDPAE.setHireDate(mainEmploymentContract.getStartDate());<NEW_LINE>newDPAE.setHireTime(mainEmploymentContract.getStartTime());<NEW_LINE>newDPAE.setTrialPeriodDuration(mainEmploymentContract.getTrialPeriodDuration());<NEW_LINE>newDPAE.setContractType(mainEmploymentContract.getContractType());<NEW_LINE>newDPAE.setContractEndDate(mainEmploymentContract.getEndDate());<NEW_LINE>employee.addDpaeListItem(newDPAE);<NEW_LINE>Beans.get(EmployeeRepository.class).save(employee);<NEW_LINE>return newDPAE.getId();<NEW_LINE>} | getHrConfig().getHealthServiceAddress()); |
261,451 | ActionResult<Object> execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag, String client, String token, JsonElement jsonElement) throws Exception {<NEW_LINE>LOGGER.debug("{} invoke :{}.", effectivePerson.getDistinguishedName(), flag);<NEW_LINE>CacheCategory cacheCategory = new CacheCategory(Invoke.class);<NEW_LINE>Invoke invoke = this.get(cacheCategory, flag);<NEW_LINE>if (null == invoke) {<NEW_LINE>throw new ExceptionEntityNotExist(flag, Invoke.class);<NEW_LINE>}<NEW_LINE>checkEnable(invoke);<NEW_LINE>checkRemoteAddrRegex(request, invoke);<NEW_LINE>checkClient(client);<NEW_LINE>checkToken(token);<NEW_LINE>Sso sso = Config.token().findSso(client);<NEW_LINE>if (null == sso) {<NEW_LINE>throw new ExceptionClientNotExist(client);<NEW_LINE>}<NEW_LINE>String content = decrypt(client, token, sso);<NEW_LINE>checkTimeThreshold(StringUtils<MASK><NEW_LINE>String credential = URLDecoder.decode(StringUtils.substringBefore(content, SPLIT), StandardCharsets.UTF_8.name());<NEW_LINE>if (StringUtils.isEmpty(credential)) {<NEW_LINE>throw new ExceptionEmptyCredential();<NEW_LINE>}<NEW_LINE>if ((!StringUtils.equals(EffectivePerson.CIPHER, credential)) && (!Config.token().isInitialManager(credential))) {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>String person = business.organization().person().get(credential);<NEW_LINE>if (StringUtils.isEmpty(person)) {<NEW_LINE>throw new ExceptionPersonNotExist(credential);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return executeInvoke(request, effectivePerson, jsonElement, cacheCategory, invoke);<NEW_LINE>} | .substringAfter(content, SPLIT)); |
1,313,212 | public void waitForCompletion(HeadMountable hm, CompletionType completionType) throws Exception {<NEW_LINE>if (!(completionType.isUnconditionalCoordination() || isMotionPending())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String command = <MASK><NEW_LINE>if (command != null) {<NEW_LINE>sendGcode(command, completionType == CompletionType.WaitForStillstandIndefinitely ? -1 : getTimeoutAtMachineSpeed());<NEW_LINE>}<NEW_LINE>if (completionType.isEnforcingStillstand()) {<NEW_LINE>if (isMotionPending()) {<NEW_LINE>String moveToCompleteRegex = getCommand(hm, CommandType.MOVE_TO_COMPLETE_REGEX);<NEW_LINE>if (moveToCompleteRegex != null) {<NEW_LINE>receiveResponses(moveToCompleteRegex, completionType == CompletionType.WaitForStillstandIndefinitely ? -1 : getTimeoutAtMachineSpeed(), (responses) -> {<NEW_LINE>throw new Exception("Timed out waiting for move to complete.");<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Remember, we're now standing still.<NEW_LINE>motionPending = false;<NEW_LINE>}<NEW_LINE>} | getCommand(hm, CommandType.MOVE_TO_COMPLETE_COMMAND); |
85,691 | protected // Returns an error string on failure, or returns null if successful.<NEW_LINE>String sendListing(String listing) {<NEW_LINE>if (sessionThread.openDataSocket()) {<NEW_LINE>Log.d(TAG, "LIST/NLST done making socket");<NEW_LINE>} else {<NEW_LINE>sessionThread.closeDataSocket();<NEW_LINE>return "425 Error opening data socket\r\n";<NEW_LINE>}<NEW_LINE>String mode = sessionThread.isBinaryMode() ? "BINARY" : "ASCII";<NEW_LINE>sessionThread.writeString("150 Opening " + mode + " mode data connection for file list\r\n");<NEW_LINE>Log.d(TAG, "Sent code 150, sending listing string now");<NEW_LINE>if (!sessionThread.sendViaDataSocket(listing)) {<NEW_LINE><MASK><NEW_LINE>sessionThread.closeDataSocket();<NEW_LINE>return "426 Data socket or network error\r\n";<NEW_LINE>}<NEW_LINE>sessionThread.closeDataSocket();<NEW_LINE>Log.d(TAG, "Listing sendViaDataSocket success");<NEW_LINE>sessionThread.writeString("226 Data transmission OK\r\n");<NEW_LINE>return null;<NEW_LINE>} | Log.d(TAG, "sendViaDataSocket failure"); |
1,742,047 | private void scrollAccordingToScrollTarget(com.google.gwt.dom.client.Element scrollTarget) {<NEW_LINE>if (scrollTarget == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int newFirstIndex = -1;<NEW_LINE>// Scroll left.<NEW_LINE>if (hasScrolledTabs() && scrollTarget == scrollerPrev) {<NEW_LINE>newFirstIndex = tb.scrollLeft(scrollerIndex);<NEW_LINE>// Scroll right.<NEW_LINE>} else if (hasClippedTabs() && scrollTarget == scrollerNext) {<NEW_LINE>newFirstIndex = tb.scrollRight(scrollerIndex);<NEW_LINE>}<NEW_LINE>if (newFirstIndex != -1) {<NEW_LINE>scrollerIndex = newFirstIndex;<NEW_LINE>Tab <MASK><NEW_LINE>currentFirst.setStyleNames(scrollerIndex == activeTabIndex, true, true);<NEW_LINE>scrollerPositionTabId = currentFirst.id;<NEW_LINE>updateTabScroller();<NEW_LINE>}<NEW_LINE>// scrolling updated first visible styles but only removed the previous<NEW_LINE>// focus style if the focused tab was also the first tab<NEW_LINE>if (selectionHandler.focusedTabIndex >= 0 && selectionHandler.focusedTabIndex != scrollerIndex) {<NEW_LINE>tb.getTab(selectionHandler.focusedTabIndex).setStyleNames(selectionHandler.focusedTabIndex == activeTabIndex, false);<NEW_LINE>}<NEW_LINE>// For this to work well, make sure the method gets called only from<NEW_LINE>// user events.<NEW_LINE>selectionHandler.focusTabAtIndex(scrollerIndex);<NEW_LINE>selectionHandler.focusedTabIndex = scrollerIndex;<NEW_LINE>} | currentFirst = tb.getTab(newFirstIndex); |
1,010,051 | public UpdateVoiceChannelResult updateVoiceChannel(UpdateVoiceChannelRequest updateVoiceChannelRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateVoiceChannelRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateVoiceChannelRequest> request = null;<NEW_LINE>Response<UpdateVoiceChannelResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateVoiceChannelRequestMarshaller().marshall(updateVoiceChannelRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<UpdateVoiceChannelResult, JsonUnmarshallerContext> unmarshaller = new UpdateVoiceChannelResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<UpdateVoiceChannelResult> responseHandler = new JsonResponseHandler<UpdateVoiceChannelResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(<MASK><NEW_LINE>}<NEW_LINE>} | awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC); |
1,333,504 | public ViewGroup onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>LinearLayout view = new LinearLayout(getContext());<NEW_LINE><MASK><NEW_LINE>LinearLayout auto_layout = new LinearLayout(getContext());<NEW_LINE>auto_layout.setOrientation(LinearLayout.HORIZONTAL);<NEW_LINE>TextView tv_auto = new TextView(getContext());<NEW_LINE>tv_auto.setText(getResources().getString(R.string.operation_brightness_desc_autobrightness));<NEW_LINE>mIsAuto = new Switch(getContext());<NEW_LINE>mIsAuto.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));<NEW_LINE>mBrightnessLevel = new SeekBar(getContext());<NEW_LINE>mBrightnessLevel.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));<NEW_LINE>mBrightnessLevel.setMax(255);<NEW_LINE>mBrightnessLevel.setEnabled(false);<NEW_LINE>mIsAuto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {<NEW_LINE>if (isChecked)<NEW_LINE>mBrightnessLevel.setEnabled(false);<NEW_LINE>else<NEW_LINE>mBrightnessLevel.setEnabled(true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>auto_layout.addView(mIsAuto);<NEW_LINE>auto_layout.addView(tv_auto);<NEW_LINE>view.addView(auto_layout);<NEW_LINE>view.addView(mBrightnessLevel);<NEW_LINE>return view;<NEW_LINE>} | view.setOrientation(LinearLayout.VERTICAL); |
1,068,869 | public void performCardAction(View view) {<NEW_LINE>if (this.mSmartSpaceCard.getTapAction() == null) {<NEW_LINE>Log.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Intent intent = new Intent(this.getIntent());<NEW_LINE>Launcher launcher = Launcher.getLauncher(view.getContext());<NEW_LINE>switch(this.mSmartSpaceCard.getTapAction().getActionType()) {<NEW_LINE>case ACTION1:<NEW_LINE>{<NEW_LINE>intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);<NEW_LINE>intent.setSourceBounds(launcher.getViewBounds(view));<NEW_LINE>intent.setPackage(FeedBridge.Companion.getInstance(mContext).resolveSmartspace());<NEW_LINE>view.getContext().sendBroadcast(intent);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case ACTION2:<NEW_LINE>{<NEW_LINE>launcher.startActivitySafely(view, intent, null);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>Log.w("SmartspaceCardView", "unrecognized tap action: " + this);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | e("SmartspaceCardView", "no tap action available: " + this); |
1,824,242 | private static boolean needsFontBaseSize(String text) {<NEW_LINE>if (tagsUseFontSizeSet == null) {<NEW_LINE>// tags that use font-size in javax/swing/text/html/default.css<NEW_LINE>tagsUseFontSizeSet = new HashSet<>(Arrays.asList("h1", "h2", "h3", "h4", "h5", "h6", "code", "kbd", "big", "small", "samp"));<NEW_LINE>}<NEW_LINE>// search for tags in HTML text<NEW_LINE>int textLength = text.length();<NEW_LINE>for (int i = 6; i < textLength - 1; i++) {<NEW_LINE>if (text.charAt(i) == '<') {<NEW_LINE>switch(text.charAt(i + 1)) {<NEW_LINE>// first letters of tags in tagsUseFontSizeSet<NEW_LINE>case 'b':<NEW_LINE>case 'B':<NEW_LINE>case 'c':<NEW_LINE>case 'C':<NEW_LINE>case 'h':<NEW_LINE>case 'H':<NEW_LINE>case 'k':<NEW_LINE>case 'K':<NEW_LINE>case 's':<NEW_LINE>case 'S':<NEW_LINE>int tagBegin = i + 1;<NEW_LINE>for (i += 2; i < textLength; i++) {<NEW_LINE>if (!Character.isLetterOrDigit(text.charAt(i))) {<NEW_LINE>String tag = text.substring(<MASK><NEW_LINE>if (tagsUseFontSizeSet.contains(tag))<NEW_LINE>return true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | tagBegin, i).toLowerCase(); |
551,045 | protected ResolvedType convertToUsage(Type type, Context context) {<NEW_LINE>if (context == null) {<NEW_LINE>throw new NullPointerException("Context should not be null");<NEW_LINE>}<NEW_LINE>if (type.isUnknownType()) {<NEW_LINE>throw new IllegalArgumentException("Inferred lambda parameter type");<NEW_LINE>} else if (type.isClassOrInterfaceType()) {<NEW_LINE>return convertClassOrInterfaceTypeToUsage(type.asClassOrInterfaceType(), context);<NEW_LINE>} else if (type.isPrimitiveType()) {<NEW_LINE>return ResolvedPrimitiveType.byName(type.asPrimitiveType().getType().name());<NEW_LINE>} else if (type.isWildcardType()) {<NEW_LINE>return convertWildcardTypeToUsage(type.asWildcardType(), context);<NEW_LINE>} else if (type.isVoidType()) {<NEW_LINE>return ResolvedVoidType.INSTANCE;<NEW_LINE>} else if (type.isArrayType()) {<NEW_LINE>return convertArrayTypeToUsage(type.asArrayType(), context);<NEW_LINE>} else if (type.isUnionType()) {<NEW_LINE>return convertUnionTypeToUsage(type.asUnionType(), context);<NEW_LINE>} else if (type.isVarType()) {<NEW_LINE>return convertVarTypeToUsage(type.asVarType(), context);<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException(type.<MASK><NEW_LINE>}<NEW_LINE>} | getClass().getCanonicalName()); |
240,968 | public void draw(CommandProcess process, StackModel result) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(ThreadUtil.getThreadTitle(result)).append("\n");<NEW_LINE>StackTraceElement[] stackTraceElements = result.getStackTrace();<NEW_LINE>StackTraceElement locationStackTraceElement = stackTraceElements[0];<NEW_LINE>String locationString = String.format(" @%s.%s()", locationStackTraceElement.getClassName(<MASK><NEW_LINE>sb.append(locationString).append("\n");<NEW_LINE>int skip = 1;<NEW_LINE>for (int index = skip; index < stackTraceElements.length; index++) {<NEW_LINE>StackTraceElement ste = stackTraceElements[index];<NEW_LINE>sb.append(" at ").append(ste.getClassName()).append(".").append(ste.getMethodName()).append("(").append(ste.getFileName()).append(":").append(ste.getLineNumber()).append(")\n");<NEW_LINE>}<NEW_LINE>process.write("ts=" + DateUtils.formatDate(result.getTs()) + ";" + sb.toString() + "\n");<NEW_LINE>} | ), locationStackTraceElement.getMethodName()); |
1,552,852 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>int amount = controller.rollDice(outcome, source, game, 6);<NEW_LINE>Effect effect = null;<NEW_LINE>// 2 - A card named Goblin Tutor<NEW_LINE>// 3 - An enchantment card<NEW_LINE>// 4 - An artifact card<NEW_LINE>// 5 - A creature card<NEW_LINE>// 6 - An instant or sorcery card<NEW_LINE>if (amount == 2) {<NEW_LINE>effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, filter), true);<NEW_LINE>} else if (amount == 3) {<NEW_LINE>effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_ENTCHANTMENT), true);<NEW_LINE>} else if (amount == 4) {<NEW_LINE>effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1<MASK><NEW_LINE>} else if (amount == 5) {<NEW_LINE>effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_CREATURE), true);<NEW_LINE>} else if (amount == 6) {<NEW_LINE>effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, new FilterInstantOrSorceryCard()), true);<NEW_LINE>}<NEW_LINE>if (effect != null) {<NEW_LINE>effect.apply(game, source);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | , StaticFilters.FILTER_CARD_ARTIFACT), true); |
1,605,393 | public void destroy() {<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info("Destroying protocol [" + this.getClass(<MASK><NEW_LINE>}<NEW_LINE>super.destroy();<NEW_LINE>if (connectionMonitor != null) {<NEW_LINE>connectionMonitor.shutdown();<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, ProtocolServer> entry : serverMap.entrySet()) {<NEW_LINE>try {<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info("Closing the rest server at " + entry.getKey());<NEW_LINE>}<NEW_LINE>entry.getValue().close();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Error closing rest server", t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>serverMap.clear();<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info("Closing rest clients");<NEW_LINE>}<NEW_LINE>for (ResteasyClient client : clients) {<NEW_LINE>try {<NEW_LINE>client.close();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Error closing rest client", t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>clients.clear();<NEW_LINE>} | ).getSimpleName() + "] ..."); |
1,060,017 | public static DescribeDBClustersWithBackupsResponse unmarshall(DescribeDBClustersWithBackupsResponse describeDBClustersWithBackupsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDBClustersWithBackupsResponse.setRequestId(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.RequestId"));<NEW_LINE>describeDBClustersWithBackupsResponse.setPageNumber(_ctx.integerValue("DescribeDBClustersWithBackupsResponse.PageNumber"));<NEW_LINE>describeDBClustersWithBackupsResponse.setTotalRecordCount(_ctx.integerValue("DescribeDBClustersWithBackupsResponse.TotalRecordCount"));<NEW_LINE>describeDBClustersWithBackupsResponse.setPageRecordCount(_ctx.integerValue("DescribeDBClustersWithBackupsResponse.PageRecordCount"));<NEW_LINE>List<DBCluster> items = new ArrayList<DBCluster>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDBClustersWithBackupsResponse.Items.Length"); i++) {<NEW_LINE>DBCluster dBCluster = new DBCluster();<NEW_LINE>dBCluster.setDBClusterId(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBClusterId"));<NEW_LINE>dBCluster.setDBClusterDescription(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBClusterDescription"));<NEW_LINE>dBCluster.setPayType(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].PayType"));<NEW_LINE>dBCluster.setDBClusterNetworkType(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBClusterNetworkType"));<NEW_LINE>dBCluster.setRegionId(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].RegionId"));<NEW_LINE>dBCluster.setZoneId(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].ZoneId"));<NEW_LINE>dBCluster.setExpireTime(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].ExpireTime"));<NEW_LINE>dBCluster.setExpired(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].Expired"));<NEW_LINE>dBCluster.setDBClusterStatus(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBClusterStatus"));<NEW_LINE>dBCluster.setEngine(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].Engine"));<NEW_LINE>dBCluster.setDBType(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBType"));<NEW_LINE>dBCluster.setDBVersion(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBVersion"));<NEW_LINE>dBCluster.setLockMode(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].LockMode"));<NEW_LINE>dBCluster.setDeletionLock(_ctx.integerValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DeletionLock"));<NEW_LINE>dBCluster.setCreateTime(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].CreateTime"));<NEW_LINE>dBCluster.setVpcId(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].VpcId"));<NEW_LINE>dBCluster.setIsDeleted(_ctx.integerValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].IsDeleted"));<NEW_LINE>dBCluster.setDeletedTime(_ctx.stringValue<MASK><NEW_LINE>dBCluster.setDBNodeClass(_ctx.stringValue("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DBNodeClass"));<NEW_LINE>items.add(dBCluster);<NEW_LINE>}<NEW_LINE>describeDBClustersWithBackupsResponse.setItems(items);<NEW_LINE>return describeDBClustersWithBackupsResponse;<NEW_LINE>} | ("DescribeDBClustersWithBackupsResponse.Items[" + i + "].DeletedTime")); |
1,463,399 | public void activateDeferred() {<NEW_LINE>if (cannotLaunch())<NEW_LINE>return;<NEW_LINE>Direction facing = getFacing();<NEW_LINE>List<Entity> entities = level.getEntitiesOfClass(Entity.class, new AABB(worldPosition).inflate(-1 / 16f, <MASK><NEW_LINE>// Launch Items<NEW_LINE>boolean doLogic = !level.isClientSide || isVirtual();<NEW_LINE>if (doLogic)<NEW_LINE>launchItems();<NEW_LINE>// Launch Entities<NEW_LINE>for (Entity entity : entities) {<NEW_LINE>boolean isPlayerEntity = entity instanceof Player;<NEW_LINE>if (!entity.isAlive())<NEW_LINE>continue;<NEW_LINE>if (entity instanceof ItemEntity)<NEW_LINE>continue;<NEW_LINE>if (entity.getPistonPushReaction() == PushReaction.IGNORE)<NEW_LINE>continue;<NEW_LINE>entity.setOnGround(false);<NEW_LINE>if (isPlayerEntity != level.isClientSide)<NEW_LINE>continue;<NEW_LINE>entity.setPos(worldPosition.getX() + .5f, worldPosition.getY() + 1, worldPosition.getZ() + .5f);<NEW_LINE>launcher.applyMotion(entity, facing);<NEW_LINE>if (!isPlayerEntity)<NEW_LINE>continue;<NEW_LINE>Player playerEntity = (Player) entity;<NEW_LINE>if (!(playerEntity.getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof ElytraItem))<NEW_LINE>continue;<NEW_LINE>playerEntity.setXRot(-35);<NEW_LINE>playerEntity.setYRot(facing.toYRot());<NEW_LINE>playerEntity.setDeltaMovement(playerEntity.getDeltaMovement().scale(.75f));<NEW_LINE>deployElytra(playerEntity);<NEW_LINE>AllPackets.channel.sendToServer(new EjectorElytraPacket(worldPosition));<NEW_LINE>}<NEW_LINE>if (doLogic) {<NEW_LINE>lidProgress.chase(1, .8f, Chaser.EXP);<NEW_LINE>state = State.LAUNCHING;<NEW_LINE>if (!level.isClientSide) {<NEW_LINE>level.playSound(null, worldPosition, SoundEvents.WOODEN_TRAPDOOR_CLOSE, SoundSource.BLOCKS, .35f, 1f);<NEW_LINE>level.playSound(null, worldPosition, SoundEvents.CHEST_OPEN, SoundSource.BLOCKS, .1f, 1.4f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | 0, -1 / 16f)); |
934,446 | public static ModuleList findOrCreateModuleListFromSuite(File root, File customNbDestDir) throws IOException {<NEW_LINE>PropertyEvaluator eval = parseSuiteProperties(root);<NEW_LINE>File nbdestdir = resolveNbDestDir(root, customNbDestDir, eval);<NEW_LINE>Set<ClusterInfo> clup = ClusterUtils.evaluateClusterPath(root, eval, nbdestdir);<NEW_LINE>LOG.log(Level.FINE, "Scanning suite in " + root + ", cluster.path is: " + clup);<NEW_LINE>if (!clup.isEmpty()) {<NEW_LINE>List<ModuleList> lists = new ArrayList<ModuleList>();<NEW_LINE>lists.add(findOrCreateModuleListFromSuiteWithoutBinaries(root, nbdestdir, eval));<NEW_LINE>lists.addAll(findOrCreateModuleListsFromClusterPath(clup, nbdestdir));<NEW_LINE>// XXX should this also omit excluded modules? or should that be done only in e.g. LayerUtils.getPlatformJarsForSuiteComponentProject?<NEW_LINE>return merge(lists.toArray(new ModuleList[lists.<MASK><NEW_LINE>} else {<NEW_LINE>return merge(new ModuleList[] { findOrCreateModuleListFromSuiteWithoutBinaries(root, nbdestdir, eval), findOrCreateModuleListFromBinaries(nbdestdir) }, root);<NEW_LINE>}<NEW_LINE>} | size()]), root); |
260,435 | final UpdateThingRuntimeConfigurationResult executeUpdateThingRuntimeConfiguration(UpdateThingRuntimeConfigurationRequest updateThingRuntimeConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateThingRuntimeConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateThingRuntimeConfigurationRequest> request = null;<NEW_LINE>Response<UpdateThingRuntimeConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateThingRuntimeConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateThingRuntimeConfigurationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Greengrass");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateThingRuntimeConfiguration");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateThingRuntimeConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateThingRuntimeConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
1,153,353 | public Mono<Void> then() {<NEW_LINE>if (!channel().isActive()) {<NEW_LINE>return Mono.error(AbortedException.beforeSend());<NEW_LINE>}<NEW_LINE>if (hasSentHeaders()) {<NEW_LINE>return Mono.empty();<NEW_LINE>}<NEW_LINE>return FutureMono.deferFuture(() -> {<NEW_LINE>if (markSentHeaders(outboundHttpMessage())) {<NEW_LINE>HttpMessage msg;<NEW_LINE>if (HttpUtil.isContentLengthSet(outboundHttpMessage())) {<NEW_LINE>outboundHttpMessage().headers().remove(HttpHeaderNames.TRANSFER_ENCODING);<NEW_LINE>if (HttpUtil.getContentLength(outboundHttpMessage(), 0) == 0) {<NEW_LINE>markSentBody();<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>msg = outboundHttpMessage();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>msg = outboundHttpMessage();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>afterMarkSentHeaders();<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>ReferenceCountUtil.release(msg);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return channel().writeAndFlush(msg).addListener(f -> onHeadersSent());<NEW_LINE>} else {<NEW_LINE>return channel().newSucceededFuture();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | msg = newFullBodyMessage(Unpooled.EMPTY_BUFFER); |
268,430 | private IModelTranslation retrieveTrl(final ResultSet rs, final POTrlInfo trlInfo) throws SQLException {<NEW_LINE>final ImmutableMap.Builder<String, String> trlMapBuilder = ImmutableMap.builder();<NEW_LINE>for (final String columnName : trlInfo.getTranslatedColumnNames()) {<NEW_LINE>final String value = rs.getString(columnName);<NEW_LINE>if (value != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Map<String, String> trlMap = trlMapBuilder.build();<NEW_LINE>final String adLanguage = rs.getString(COLUMNNAME_AD_Language);<NEW_LINE>if (adLanguage == null) {<NEW_LINE>// shall not happen<NEW_LINE>logger.warn("Got null AD_Language for translation row={}\nTrlInfo={}", trlMap, trlInfo);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return ModelTranslation.of(adLanguage, trlMap);<NEW_LINE>} | trlMapBuilder.put(columnName, value); |
639,580 | protected List<Pair<Integer, Integer>> doGenerateEdges() {<NEW_LINE>final int edgesPerNewNode = getConfiguration().getEdgesPerNewNode();<NEW_LINE>final long numberOfNodes = getConfiguration().getNumberOfNodes();<NEW_LINE>// Create a completely connected network<NEW_LINE>final List<Pair<Integer, Integer>> edges = new CompleteGraphRelationshipGenerator(new NumberOfNodesBasedConfig(edgesPerNewNode + 1)).doGenerateEdges();<NEW_LINE>// Preferentially attach other nodes<NEW_LINE>final Set<Integer> omit = new HashSet<>(edgesPerNewNode);<NEW_LINE>for (int source = edgesPerNewNode + 1; source < numberOfNodes; source++) {<NEW_LINE>omit.clear();<NEW_LINE>for (int edge = 0; edge < edgesPerNewNode; edge++) {<NEW_LINE>while (true) {<NEW_LINE>Pair<Integer, Integer> randomEdge = edges.get(random.nextInt(edges.size()));<NEW_LINE>int target = random.nextBoolean() ? randomEdge.first() : randomEdge.other();<NEW_LINE>if (omit.contains(target)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// to avoid multi-edges<NEW_LINE>omit.add(target);<NEW_LINE>edges.add(Pair<MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return edges;<NEW_LINE>} | .of(target, source)); |
1,640,293 | public static void dicomWebRetrieveRendered(String dicomStoreName, String dicomWebPath) throws IOException {<NEW_LINE>// String dicomStoreName =<NEW_LINE>// String.format(<NEW_LINE>// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");<NEW_LINE>// String dicomWebPath = String.format(DICOMWEB_PATH, "your-study-id", "your-series-id",<NEW_LINE>// "your-instance-id");<NEW_LINE>// Initialize the client, which will be used to interact with the service.<NEW_LINE>CloudHealthcare client = createClient();<NEW_LINE>// Create request and configure any parameters.<NEW_LINE>Instances.RetrieveRendered request = client.projects().locations().datasets().dicomStores().studies().series().instances().retrieveRendered(dicomStoreName, dicomWebPath);<NEW_LINE>// Execute the request and process the results.<NEW_LINE>HttpResponse response = request.executeUnparsed();<NEW_LINE>String outputPath = "image.png";<NEW_LINE>OutputStream outputStream = new FileOutputStream(new File(outputPath));<NEW_LINE>try {<NEW_LINE>response.download(outputStream);<NEW_LINE>System.<MASK><NEW_LINE>} finally {<NEW_LINE>outputStream.close();<NEW_LINE>}<NEW_LINE>if (!response.isSuccessStatusCode()) {<NEW_LINE>System.err.print(String.format("Exception retrieving DICOM rendered image: %s\n", response.getStatusMessage()));<NEW_LINE>throw new RuntimeException();<NEW_LINE>}<NEW_LINE>} | out.println("DICOM rendered PNG image written to file " + outputPath); |
1,355,642 | public void run() {<NEW_LINE>JFXPanel panel = new JFXPanel();<NEW_LINE>// Create a WebView and WebEngine to display the captcha from challengeURL.<NEW_LINE>WebView view = new WebView();<NEW_LINE>WebEngine engine = view.getEngine();<NEW_LINE>// Set UserAgent so the captcha shows correctly in the WebView.<NEW_LINE>engine.setUserAgent(CaptchaSolveHelper.USER_AGENT);<NEW_LINE>engine.load(challengeURL);<NEW_LINE>final JFrame frame = new JFrame("Solve Captcha");<NEW_LINE>// Register listener to receive the token when the captcha has been solved from inside the WebView.<NEW_LINE>CaptchaSolveHelper.Listener listener = new CaptchaSolveHelper.Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onTokenReceived(String token) {<NEW_LINE>System.out.println("Token received: " + token + "!");<NEW_LINE>// Remove this listener as we no longer need to listen for tokens, the captcha has been solved.<NEW_LINE>CaptchaSolveHelper.removeListener(this);<NEW_LINE>try {<NEW_LINE>// Close this window, it not valid anymore.<NEW_LINE>frame.setVisible(false);<NEW_LINE>frame.dispose();<NEW_LINE>if (api.verifyChallenge(token)) {<NEW_LINE>System.out.println("Captcha was correctly solved!");<NEW_LINE>} else {<NEW_LINE>// verifyChallenge will receive a new captcha url if this one is invalid<NEW_LINE>System.out.println("Captcha was incorrectly solved! Please try again.");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>CaptchaSolveHelper.registerListener(listener);<NEW_LINE>// Applies the WebView to this panel<NEW_LINE>panel.setScene(new Scene(view));<NEW_LINE>frame.getContentPane().add(panel);<NEW_LINE>frame.setSize(500, 500);<NEW_LINE>frame.setVisible(true);<NEW_LINE>// Don't allow this window to be closed<NEW_LINE>frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);<NEW_LINE>frame.addWindowListener(new WindowAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void windowClosing(WindowEvent e) {<NEW_LINE>System.out.println("Please solve the captcha before closing the window!");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | e("Main", "Error while solving captcha!", e); |
1,189,996 | public Result call() throws Exception {<NEW_LINE>if (className == null || className.isEmpty())<NEW_LINE>throw new IllegalStateException("No class specified");<NEW_LINE>if (!getWorkspace().getPrimary().getClasses().containsKey(className))<NEW_LINE>throw new IllegalStateException("No class by the name '" + className + "' exists in the primary resource");<NEW_LINE>int descStart = methodDef.indexOf("(");<NEW_LINE>if (descStart == -1)<NEW_LINE>throw new IllegalStateException("Invalid method def '" + methodDef + "'");<NEW_LINE>// Get info - need method access<NEW_LINE>ClassReader reader = getWorkspace().getClassReader(className);<NEW_LINE>ClassNode node = ClassUtil.getNode(reader, ClassReader.SKIP_FRAMES);<NEW_LINE>String name = methodDef.substring(0, descStart);<NEW_LINE>String desc = methodDef.substring(descStart);<NEW_LINE>MethodNode method = null;<NEW_LINE>int methodIndex = -1;<NEW_LINE>for (int i = 0; i < node.methods.size(); i++) {<NEW_LINE>MethodNode mn = node.methods.get(i);<NEW_LINE>if (mn.name.equals(name) && mn.desc.equals(desc)) {<NEW_LINE>method = mn;<NEW_LINE>methodIndex = i;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (method == null)<NEW_LINE>throw new IllegalStateException("No method '" + methodDef + "' found in '" + className + "'");<NEW_LINE>// Assemble method<NEW_LINE>String code;<NEW_LINE>try {<NEW_LINE>code = FileUtils.readFileToString(input, UTF_8);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new IllegalStateException("Could not read from '" + input + "'");<NEW_LINE>}<NEW_LINE>ParseResult<RootAST> result = Parse.parse(code);<NEW_LINE>MethodAssembler assembler = new <MASK><NEW_LINE>MethodNode generated = assembler.compile(result);<NEW_LINE>// Replace method<NEW_LINE>MethodNode old = node.methods.get(methodIndex);<NEW_LINE>Comments.removeComments(old);<NEW_LINE>ClassUtil.copyMethodMetadata(old, generated);<NEW_LINE>node.methods.set(methodIndex, generated);<NEW_LINE>// Finalize changes<NEW_LINE>Workspace workspace = Recaf.getCurrentWorkspace();<NEW_LINE>ClassWriter cw = workspace.createWriter(ClassWriter.COMPUTE_FRAMES);<NEW_LINE>ClassVisitor visitor = cw;<NEW_LINE>for (ClassVisitorPlugin visitorPlugin : PluginsManager.getInstance().ofType(ClassVisitorPlugin.class)) {<NEW_LINE>visitor = visitorPlugin.intercept(visitor);<NEW_LINE>}<NEW_LINE>node.accept(visitor);<NEW_LINE>byte[] value = cw.toByteArray();<NEW_LINE>workspace.getPrimary().getClasses().put(node.name, value);<NEW_LINE>// Return wrapper<NEW_LINE>return new Result(node, generated);<NEW_LINE>} | MethodAssembler(className, getController()); |
1,362,815 | final DescribeComponentConfigurationResult executeDescribeComponentConfiguration(DescribeComponentConfigurationRequest describeComponentConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeComponentConfigurationRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeComponentConfigurationRequest> request = null;<NEW_LINE>Response<DescribeComponentConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeComponentConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeComponentConfigurationRequest));<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, "Application Insights");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeComponentConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeComponentConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeComponentConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
243,348 | private Method findViaSetAccessible(CacheKey cacheKey, Class<?> aClass, String methodName, boolean dfeInUse) throws NoSuchMethodException {<NEW_LINE>if (!USE_SET_ACCESSIBLE.get()) {<NEW_LINE>throw new FastNoSuchMethodException(methodName);<NEW_LINE>}<NEW_LINE>Class<?> currentClass = aClass;<NEW_LINE>while (currentClass != null) {<NEW_LINE>Predicate<Method> whichMethods = mth -> {<NEW_LINE>if (dfeInUse) {<NEW_LINE>return hasZeroArgs(mth) || takesSingleArgumentTypeAsOnlyArgument(mth);<NEW_LINE>}<NEW_LINE>return hasZeroArgs(mth);<NEW_LINE>};<NEW_LINE>Method[] declaredMethods = currentClass.getDeclaredMethods();<NEW_LINE>Optional<Method> m = Arrays.stream(declaredMethods).filter(mth -> methodName.equals(mth.getName())).filter(whichMethods<MASK><NEW_LINE>if (m.isPresent()) {<NEW_LINE>try {<NEW_LINE>// few JVMs actually enforce this but it might happen<NEW_LINE>Method method = m.get();<NEW_LINE>method.setAccessible(true);<NEW_LINE>METHOD_CACHE.putIfAbsent(cacheKey, new CachedMethod(method));<NEW_LINE>return method;<NEW_LINE>} catch (SecurityException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>currentClass = currentClass.getSuperclass();<NEW_LINE>}<NEW_LINE>throw new FastNoSuchMethodException(methodName);<NEW_LINE>} | ).min(mostMethodArgsFirst()); |
1,025,090 | private void save(ServerIntIntRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta meta, DataOutputStream out) throws IOException {<NEW_LINE>int startCol = <MASK><NEW_LINE>IntIntVector vector = ServerRowUtils.getVector(row);<NEW_LINE>IntIntElement element = new IntIntElement();<NEW_LINE>if (vector.isDense()) {<NEW_LINE>int[] data = vector.getStorage().getValues();<NEW_LINE>for (int i = 0; i < data.length; i++) {<NEW_LINE>element.rowId = row.getRowId();<NEW_LINE>element.colId = startCol + i;<NEW_LINE>element.value = data[i];<NEW_LINE>save(element, out);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (saveContext.sortFirst()) {<NEW_LINE>int[] indices = vector.getStorage().getIndices();<NEW_LINE>int[] values = vector.getStorage().getValues();<NEW_LINE>Sort.quickSort(indices, values, 0, indices.length - 1);<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>element.rowId = row.getRowId();<NEW_LINE>element.colId = indices[i] + startCol;<NEW_LINE>element.value = values[i];<NEW_LINE>save(element, out);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ObjectIterator<Int2IntMap.Entry> iter = vector.getStorage().entryIterator();<NEW_LINE>Int2IntMap.Entry entry;<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>entry = iter.next();<NEW_LINE>element.rowId = row.getRowId();<NEW_LINE>element.colId = entry.getIntKey() + startCol;<NEW_LINE>element.value = entry.getIntValue();<NEW_LINE>save(element, out);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (int) meta.getStartCol(); |
1,669,276 | public boolean publish(Amenity object) {<NEW_LINE>if (phrase.getSettings().isExportObjects()) {<NEW_LINE>resultMatcher.exportObject(phrase, object);<NEW_LINE>}<NEW_LINE>SearchResult res = new SearchResult(phrase);<NEW_LINE>String poiID = object.getType().getKeyName() + "_" + object.getId();<NEW_LINE>if (!searchedPois.add(poiID)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (object.isClosed()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!poiAdditionals.isEmpty()) {<NEW_LINE>boolean found = false;<NEW_LINE>for (String add : poiAdditionals) {<NEW_LINE>if (object.getAdditionalInfoKeys().contains(add)) {<NEW_LINE>found = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>res.localeName = object.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate());<NEW_LINE>res.otherNames = object.getOtherNames(true);<NEW_LINE>if (Algorithms.isEmpty(res.localeName)) {<NEW_LINE>AbstractPoiType st = types.getAnyPoiTypeByKey(object.getSubType());<NEW_LINE>if (st != null) {<NEW_LINE>res.localeName = st.getTranslation();<NEW_LINE>} else {<NEW_LINE>res.localeName = object.getSubType();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ns != null) {<NEW_LINE>if (ns.matches(res.localeName) || ns.matches(res.otherNames)) {<NEW_LINE>phrase.countUnknownWordsMatchMainResult(res, countExtraWords);<NEW_LINE>} else {<NEW_LINE>String ref = object.getTagContent(Amenity.REF, null);<NEW_LINE>if (ref == null || !ns.matches(ref)) {<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>phrase.countUnknownWordsMatch(res, ref, null, countExtraWords);<NEW_LINE>res.localeName += " " + ref;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>phrase.countUnknownWordsMatch(<MASK><NEW_LINE>}<NEW_LINE>res.object = object;<NEW_LINE>res.preferredZoom = 17;<NEW_LINE>res.file = selected;<NEW_LINE>res.location = object.getLocation();<NEW_LINE>res.priority = SEARCH_AMENITY_BY_TYPE_PRIORITY;<NEW_LINE>res.priorityDistance = 1;<NEW_LINE>res.objectType = ObjectType.POI;<NEW_LINE>resultMatcher.publish(res);<NEW_LINE>return false;<NEW_LINE>} | res, "", null, countExtraWords); |
652,610 | public void shutdown(final String jobName, final String serverIp) {<NEW_LINE>Preconditions.checkArgument(null != jobName || null != serverIp, "At least indicate jobName or serverIp.");<NEW_LINE>if (null != jobName && null != serverIp) {<NEW_LINE>JobNodePath jobNodePath = new JobNodePath(jobName);<NEW_LINE>for (String each : regCenter.getChildrenKeys(jobNodePath.getInstancesNodePath())) {<NEW_LINE>JobInstance jobInstance = YamlEngine.unmarshal(regCenter.get(jobNodePath.getInstanceNodePath(each)), JobInstance.class);<NEW_LINE>if (serverIp.equals(jobInstance.getServerIp())) {<NEW_LINE>regCenter.remove<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (null != jobName) {<NEW_LINE>JobNodePath jobNodePath = new JobNodePath(jobName);<NEW_LINE>for (String each : regCenter.getChildrenKeys(jobNodePath.getInstancesNodePath())) {<NEW_LINE>regCenter.remove(jobNodePath.getInstanceNodePath(each));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>List<String> jobNames = regCenter.getChildrenKeys("/");<NEW_LINE>for (String job : jobNames) {<NEW_LINE>JobNodePath jobNodePath = new JobNodePath(job);<NEW_LINE>List<String> instances = regCenter.getChildrenKeys(jobNodePath.getInstancesNodePath());<NEW_LINE>for (String each : instances) {<NEW_LINE>JobInstance jobInstance = YamlEngine.unmarshal(regCenter.get(jobNodePath.getInstanceNodePath(each)), JobInstance.class);<NEW_LINE>if (serverIp.equals(jobInstance.getServerIp())) {<NEW_LINE>regCenter.remove(jobNodePath.getInstanceNodePath(each));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (jobNodePath.getInstanceNodePath(each)); |
1,781,831 | private void captureTablesPK(Database db, HashMap<String, Table> tables) throws SQLException {<NEW_LINE>pkPreparedStatement.setString(1, db.getName());<NEW_LINE>HashMap<String, ArrayList<String>> tablePKMap = new HashMap<>();<NEW_LINE>try (ResultSet rs = pkPreparedStatement.executeQuery()) {<NEW_LINE>for (String tableName : tables.keySet()) {<NEW_LINE>tablePKMap.put(tableName, new ArrayList<>());<NEW_LINE>}<NEW_LINE>while (rs.next()) {<NEW_LINE>int ordinalPosition = rs.getInt("ORDINAL_POSITION");<NEW_LINE>String tableName = rs.getString("TABLE_NAME");<NEW_LINE>String columnName = rs.getString("COLUMN_NAME");<NEW_LINE>ArrayList<String> <MASK><NEW_LINE>if (pkList != null)<NEW_LINE>pkList.add(ordinalPosition - 1, columnName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, Table> entry : tables.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE>Table table = entry.getValue();<NEW_LINE>table.setPKList(tablePKMap.get(key));<NEW_LINE>}<NEW_LINE>} | pkList = tablePKMap.get(tableName); |
1,513,659 | public static SparseMatrix text(Path path) throws IOException {<NEW_LINE>try (InputStream stream = Files.newInputStream(path);<NEW_LINE>Scanner scanner = new Scanner(stream)) {<NEW_LINE>int nrow = scanner.nextInt();<NEW_LINE>int ncol = scanner.nextInt();<NEW_LINE>int nz = scanner.nextInt();<NEW_LINE>int[] colIndex = new int[ncol + 1];<NEW_LINE>int[<MASK><NEW_LINE>double[] data = new double[nz];<NEW_LINE>for (int i = 0; i <= ncol; i++) {<NEW_LINE>colIndex[i] = scanner.nextInt() - 1;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < nz; i++) {<NEW_LINE>rowIndex[i] = scanner.nextInt() - 1;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < nz; i++) {<NEW_LINE>data[i] = scanner.nextDouble();<NEW_LINE>}<NEW_LINE>return new SparseMatrix(nrow, ncol, data, rowIndex, colIndex);<NEW_LINE>}<NEW_LINE>} | ] rowIndex = new int[nz]; |
695,003 | public static long[] copy(long[] v, int mincap, int shift) {<NEW_LINE>int words = ((mincap - 1) >>> LONG_LOG2_SIZE) + 1;<NEW_LINE>if (v.length == words && shift == 0) {<NEW_LINE>return Arrays.copyOf(v, v.length);<NEW_LINE>}<NEW_LINE>long[<MASK><NEW_LINE>final int shiftWords = shift >>> LONG_LOG2_SIZE;<NEW_LINE>final int shiftBits = shift & LONG_LOG2_MASK;<NEW_LINE>// Simple case - multiple of word size<NEW_LINE>if (shiftBits == 0) {<NEW_LINE>for (int i = shiftWords; i < ret.length; i++) {<NEW_LINE>ret[i] |= v[i - shiftWords];<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>}<NEW_LINE>// Overlapping case<NEW_LINE>final int unshiftBits = Long.SIZE - shiftBits;<NEW_LINE>final int end = Math.min(ret.length, v.length + shiftWords) - 1;<NEW_LINE>for (int i = end; i > shiftWords; i--) {<NEW_LINE>final int src = i - shiftWords;<NEW_LINE>ret[i] |= (v[src] << shiftBits) | (v[src - 1] >>> unshiftBits);<NEW_LINE>}<NEW_LINE>ret[shiftWords] |= v[0] << shiftBits;<NEW_LINE>return ret;<NEW_LINE>} | ] ret = new long[words]; |
1,119,246 | private void indexFile(boolean registerInGPX, File f) {<NEW_LINE>if (f.getName().endsWith(THREEGP_EXTENSION) || f.getName().endsWith(MPEG4_EXTENSION) || f.getName().endsWith(IMG_EXTENSION)) {<NEW_LINE>boolean newFileIndexed = indexSingleFile(f);<NEW_LINE>if (newFileIndexed && registerInGPX) {<NEW_LINE>Recording rec = recordingByFileName.get(f.getName());<NEW_LINE>if (rec != null && (app.getSettings().SAVE_TRACK_TO_GPX.get() || app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) && OsmandPlugin.isActive(OsmandMonitoringPlugin.class)) {<NEW_LINE>String name = f.getName();<NEW_LINE><MASK><NEW_LINE>savingTrackHelper.insertPointData(rec.lat, rec.lon, System.currentTimeMillis(), null, name, null, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper(); |
277,815 | static List<MergeRange> doCompare(@Nonnull List<Line> lines1, @Nonnull List<Line> lines2, @Nonnull List<Line> lines3, @Nonnull ComparisonPolicy policy, @Nonnull ProgressIndicator indicator) {<NEW_LINE>indicator.checkCanceled();<NEW_LINE>List<Line> <MASK><NEW_LINE>List<Line> iwLines2 = convertMode(lines2, IGNORE_WHITESPACES);<NEW_LINE>List<Line> iwLines3 = convertMode(lines3, IGNORE_WHITESPACES);<NEW_LINE>FairDiffIterable iwChanges1 = compareSmart(iwLines2, iwLines1, indicator);<NEW_LINE>iwChanges1 = optimizeLineChunks(lines2, lines1, iwChanges1, indicator);<NEW_LINE>FairDiffIterable iterable1 = correctChangesSecondStep(lines2, lines1, iwChanges1);<NEW_LINE>FairDiffIterable iwChanges2 = compareSmart(iwLines2, iwLines3, indicator);<NEW_LINE>iwChanges2 = optimizeLineChunks(lines2, lines3, iwChanges2, indicator);<NEW_LINE>FairDiffIterable iterable2 = correctChangesSecondStep(lines2, lines3, iwChanges2);<NEW_LINE>return ComparisonMergeUtil.buildFair(iterable1, iterable2, indicator);<NEW_LINE>} | iwLines1 = convertMode(lines1, IGNORE_WHITESPACES); |
1,683,353 | private AndroidCompletedTransfer extractAndroidCompletedTransfer(Cursor cursor) {<NEW_LINE>long id = Integer.parseInt(cursor.getString(0));<NEW_LINE>String filename = decrypt(cursor.getString(1));<NEW_LINE>String type = decrypt(cursor.getString(2));<NEW_LINE>int typeInt = Integer.parseInt(type);<NEW_LINE>String state = decrypt(cursor.getString(3));<NEW_LINE>int stateInt = Integer.parseInt(state);<NEW_LINE>String size = decrypt(cursor.getString(4));<NEW_LINE>String nodeHandle = decrypt(cursor.getString(5));<NEW_LINE>String path = decrypt(cursor.getString(6));<NEW_LINE>boolean offline = Boolean.parseBoolean(decrypt(cursor.getString(7)));<NEW_LINE>long timeStamp = Long.parseLong(decrypt(cursor.getString(8)));<NEW_LINE>String error = decrypt(cursor.getString(9));<NEW_LINE>String originalPath = decrypt(cursor.getString(10));<NEW_LINE>long parentHandle = Long.parseLong(decrypt(cursor.getString(11)));<NEW_LINE>return new AndroidCompletedTransfer(id, filename, typeInt, stateInt, size, nodeHandle, path, offline, <MASK><NEW_LINE>} | timeStamp, error, originalPath, parentHandle); |
1,774,933 | private void updateTabBorder() {<NEW_LINE>if (!myProject.isOpen())<NEW_LINE>return;<NEW_LINE>ToolWindowManagerEx mgr = (ToolWindowManagerEx) ToolWindowManager.getInstance(myProject);<NEW_LINE>String[] ids = mgr.getToolWindowIds();<NEW_LINE>Insets border = JBUI.emptyInsets();<NEW_LINE>UISettings uiSettings = UISettings.getInstance();<NEW_LINE>List<String> topIds = <MASK><NEW_LINE>List<String> bottom = mgr.getIdsOn(ToolWindowAnchor.BOTTOM);<NEW_LINE>List<String> rightIds = mgr.getIdsOn(ToolWindowAnchor.RIGHT);<NEW_LINE>List<String> leftIds = mgr.getIdsOn(ToolWindowAnchor.LEFT);<NEW_LINE>if (!uiSettings.getHideToolStripes() && !uiSettings.getPresentationMode()) {<NEW_LINE>border.top = !topIds.isEmpty() ? 1 : 0;<NEW_LINE>border.bottom = !bottom.isEmpty() ? 1 : 0;<NEW_LINE>border.left = !leftIds.isEmpty() ? 1 : 0;<NEW_LINE>border.right = !rightIds.isEmpty() ? 1 : 0;<NEW_LINE>}<NEW_LINE>for (String each : ids) {<NEW_LINE>ToolWindow eachWnd = mgr.getToolWindow(each);<NEW_LINE>if (eachWnd == null || !eachWnd.isAvailable())<NEW_LINE>continue;<NEW_LINE>if (eachWnd.isVisible() && eachWnd.getType() == ToolWindowType.DOCKED) {<NEW_LINE>ToolWindowAnchor eachAnchor = eachWnd.getAnchor();<NEW_LINE>if (eachAnchor == ToolWindowAnchor.TOP) {<NEW_LINE>border.top = 0;<NEW_LINE>} else if (eachAnchor == ToolWindowAnchor.BOTTOM) {<NEW_LINE>border.bottom = 0;<NEW_LINE>} else if (eachAnchor == ToolWindowAnchor.LEFT) {<NEW_LINE>border.left = 0;<NEW_LINE>} else if (eachAnchor == ToolWindowAnchor.RIGHT) {<NEW_LINE>border.right = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>myTabs.getPresentation().setPaintBorder(border.top, border.left, border.right, border.bottom).setTabSidePaintBorder(5);<NEW_LINE>} | mgr.getIdsOn(ToolWindowAnchor.TOP); |
313,589 | private static GlyphSequence elideControls(GlyphSequence gs) {<NEW_LINE>if (hasElidableControl(gs)) {<NEW_LINE>int[] ca = gs.getCharacterArray(false);<NEW_LINE>IntBuffer ngb = IntBuffer.allocate(gs.getGlyphCount());<NEW_LINE>List nal = new java.util.ArrayList(gs.getGlyphCount());<NEW_LINE>for (int i = 0, n = gs.getGlyphCount(); i < n; ++i) {<NEW_LINE>CharAssociation a = gs.getAssociation(i);<NEW_LINE>int s = a.getStart();<NEW_LINE>int e = a.getEnd();<NEW_LINE>while (s < e) {<NEW_LINE>int ch = ca[s];<NEW_LINE>if (!isElidableControl(ch)) {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>++s;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If there is at least one non-elidable character in the char<NEW_LINE>// sequence then the glyph/association is kept.<NEW_LINE>if (s != e) {<NEW_LINE>ngb.put<MASK><NEW_LINE>nal.add(a);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ngb.flip();<NEW_LINE>return new GlyphSequence(gs.getCharacters(), ngb, nal, gs.getPredications());<NEW_LINE>} else {<NEW_LINE>return gs;<NEW_LINE>}<NEW_LINE>} | (gs.getGlyph(i)); |
680,970 | public List<CityItem> searchCities(final OsmandApplication app, final String text) throws IOException {<NEW_LINE>IndexItem worldBaseMapItem = app.getDownloadThread().getIndexes().getWorldBaseMapItem();<NEW_LINE>if (worldBaseMapItem == null || !worldBaseMapItem.isDownloaded()) {<NEW_LINE>return new ArrayList<>();<NEW_LINE>}<NEW_LINE>File obf = worldBaseMapItem.getTargetFile(app);<NEW_LINE>final BinaryMapIndexReader baseMapReader = new BinaryMapIndexReader(new RandomAccessFile(obf, "r"), obf);<NEW_LINE>final SearchPhrase.NameStringMatcher nm = new SearchPhrase.NameStringMatcher(text, CollatorStringMatcher.StringMatcherMode.CHECK_STARTS_FROM_SPACE);<NEW_LINE>final String lang = app.getSettings().MAP_PREFERRED_LOCALE.get();<NEW_LINE>final boolean translit = app.getSettings().MAP_TRANSLITERATE_NAMES.get();<NEW_LINE>final List<Amenity> amenities = new ArrayList<>();<NEW_LINE>SearchRequest<Amenity> request = BinaryMapIndexReader.buildSearchPoiRequest(0, 0, text, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, new ResultMatcher<Amenity>() {<NEW_LINE><NEW_LINE>int count = 0;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean publish(Amenity amenity) {<NEW_LINE>if (count++ > searchCityLimit) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>List<String> otherNames = amenity.getOtherNames(true);<NEW_LINE>String localeName = amenity.getName(lang, translit);<NEW_LINE><MASK><NEW_LINE>if (!citySubTypes.contains(subType) || (!nm.matches(localeName) && !nm.matches(otherNames))) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>amenities.add(amenity);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isCancelled() {<NEW_LINE>return count > searchCityLimit;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>searchCityRequest = request;<NEW_LINE>baseMapReader.searchPoiByName(request);<NEW_LINE>try {<NEW_LINE>baseMapReader.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>List<CityItem> items = new ArrayList<>();<NEW_LINE>for (Amenity amenity : amenities) {<NEW_LINE>items.add(new CityItem(amenity.getName(), amenity, null));<NEW_LINE>}<NEW_LINE>return items;<NEW_LINE>} | String subType = amenity.getSubType(); |
684,051 | public boolean checkAtInjectValidatorFactory() {<NEW_LINE>Validator validator = injectedValidatorFactory.getValidator();<NEW_LINE>Set<ConstraintViolation<AValidationXMLTestBean1>> cvSet = validator.validate(this);<NEW_LINE>if (cvSet != null && !cvSet.isEmpty()) {<NEW_LINE>svLogger.log(Level.INFO, CLASS_NAME, "found " + cvSet.size() + " contstraints " + "when there shouldn't have been any: " + formatConstraintViolations(cvSet));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>setValidationToFail();<NEW_LINE>try {<NEW_LINE>cvSet = validator.validate(this);<NEW_LINE>if (cvSet != null && cvSet.size() != 2) {<NEW_LINE>svLogger.log(Level.INFO, CLASS_NAME, "found " + cvSet.size() + " contstraints " <MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>resetValidation();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | + "when there should have been 2: " + formatConstraintViolations(cvSet)); |
978,167 | public void underlineText(int color, float width, AnnotationType type) {<NEW_LINE>if (ctr == null || ctr.getDocumentController() == null || ctr.getDocumentModel() == null) {<NEW_LINE>LOG.d("Can't underlineText");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int first = ctr<MASK><NEW_LINE>final int last = ctr.getDocumentController().getLastVisiblePage();<NEW_LINE>for (int i = first; i < last + 1; i++) {<NEW_LINE>final Page page = ctr.getDocumentModel().getPageByDocIndex(i);<NEW_LINE>if (page == null || page.selectedText == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>List<TextWord> texts = page.selectedText;<NEW_LINE>final ArrayList<PointF> quadPoints = new ArrayList<PointF>();<NEW_LINE>for (TextWord text : texts) {<NEW_LINE>RectF rect = text.getOriginal();<NEW_LINE>quadPoints.add(new PointF(rect.left, rect.bottom));<NEW_LINE>quadPoints.add(new PointF(rect.right, rect.bottom));<NEW_LINE>quadPoints.add(new PointF(rect.right, rect.top));<NEW_LINE>quadPoints.add(new PointF(rect.left, rect.top));<NEW_LINE>}<NEW_LINE>PointF[] array = quadPoints.toArray(new PointF[quadPoints.size()]);<NEW_LINE>ctr.getDecodeService().underlineText(i, array, color, type, new ResultResponse<List<Annotation>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onResultRecive(List<Annotation> arg0) {<NEW_LINE>page.annotations = arg0;<NEW_LINE>page.selectedText = new ArrayList<TextWord>();<NEW_LINE>ctr.getDocumentController().toggleRenderingEffects();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | .getDocumentController().getFirstVisiblePage(); |
1,486,141 | Description check(Type targetType, ExpressionTree init) {<NEW_LINE>if (init == null || targetType == null) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (ASTHelpers.constValue(init) != null) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (targetType.getKind() != TypeKind.LONG) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>// Note that we don't care about boxing as int isn't assignable to Long;<NEW_LINE>// primitive widening conversions can't be combined with autoboxing.<NEW_LINE>if (ASTHelpers.getType(init).getKind() != TypeKind.INT) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>BinaryTree innerMost = null;<NEW_LINE>ExpressionTree nested = init;<NEW_LINE>while (true) {<NEW_LINE>nested = ASTHelpers.stripParentheses(nested);<NEW_LINE>if (!(nested instanceof BinaryTree)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(nested.getKind()) {<NEW_LINE>case DIVIDE:<NEW_LINE>case REMAINDER:<NEW_LINE>case AND:<NEW_LINE>case XOR:<NEW_LINE>case OR:<NEW_LINE>case RIGHT_SHIFT:<NEW_LINE>// Skip binops that can't overflow; it doesn't matter whether they're performed on<NEW_LINE>// longs or ints.<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>innerMost = (BinaryTree) nested;<NEW_LINE>}<NEW_LINE>nested = ((BinaryTree) nested).getLeftOperand();<NEW_LINE>}<NEW_LINE>if (innerMost == null) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (innerMost.getLeftOperand().getKind() == Kind.INT_LITERAL) {<NEW_LINE>return describeMatch(init, SuggestedFix.postfixWith(innerMost.getLeftOperand(), "L"));<NEW_LINE>}<NEW_LINE>if (innerMost.getRightOperand().getKind() == Kind.INT_LITERAL) {<NEW_LINE>return describeMatch(init, SuggestedFix.postfixWith(innerMost<MASK><NEW_LINE>}<NEW_LINE>return describeMatch(init, SuggestedFix.prefixWith(innerMost.getLeftOperand(), "(long) "));<NEW_LINE>} | .getRightOperand(), "L")); |
1,309,324 | public Object execute(Object[] parameters) {<NEW_LINE>StructuredQuery.Builder builder = createBuilderWithFilter(parameters);<NEW_LINE>// Handle Pageable parameters.<NEW_LINE>if (!getQueryMethod().getParameters().isEmpty()) {<NEW_LINE>ParameterAccessor paramAccessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), parameters);<NEW_LINE>Pageable pageable = paramAccessor.getPageable();<NEW_LINE>if (pageable != null && pageable.isPaged()) {<NEW_LINE>builder.setOffset((int) Math.min(Integer.MAX_VALUE, pageable.getOffset()));<NEW_LINE>builder.setLimit(Int32Value.newBuilder().setValue(pageable.getPageSize()));<NEW_LINE>}<NEW_LINE>Sort sort = paramAccessor.getSort();<NEW_LINE>if (sort != null) {<NEW_LINE>builder<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.tree.isCountProjection()) {<NEW_LINE>return this.reactiveOperations.count(this.persistentEntity.getType(), builder);<NEW_LINE>} else {<NEW_LINE>return this.reactiveOperations.execute(builder, this.persistentEntity.getType());<NEW_LINE>}<NEW_LINE>} | .addAllOrderBy(createFirestoreSortOrders(sort)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.