idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
336,391 | public static void cleanBucket(OSS oss, String bucket) throws Exception {<NEW_LINE>ListObjectsRequest listRequest = new ListObjectsRequest(bucket);<NEW_LINE>listRequest.setMaxKeys(1000);<NEW_LINE>ListObjectsResult <MASK><NEW_LINE>List<OSSObjectSummary> objectSummaries = listObjectsResult.getObjectSummaries();<NEW_LINE>// delete objects<NEW_LINE>if (objectSummaries != null && objectSummaries.size() > 0) {<NEW_LINE>for (OSSObjectSummary object : objectSummaries) {<NEW_LINE>DeleteObjectRequest delete = new DeleteObjectRequest(bucket, object.getKey());<NEW_LINE>oss.deleteObject(delete);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// delete multipart uploads<NEW_LINE>ListMultipartUploadsRequest multipartUploadsRequest = new ListMultipartUploadsRequest(bucket);<NEW_LINE>multipartUploadsRequest.setMaxUploads(1000);<NEW_LINE>ListMultipartUploadsResult listMultipartUploadsResult = oss.listMultipartUploads(multipartUploadsRequest);<NEW_LINE>if (listMultipartUploadsResult.getMultipartUploads().size() > 0) {<NEW_LINE>for (MultipartUpload upload : listMultipartUploadsResult.getMultipartUploads()) {<NEW_LINE>AbortMultipartUploadRequest abort = new AbortMultipartUploadRequest(bucket, upload.getKey(), upload.getUploadId());<NEW_LINE>oss.abortMultipartUpload(abort);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// delete bucket<NEW_LINE>DeleteBucketRequest deleteBucketRequest = new DeleteBucketRequest(bucket);<NEW_LINE>oss.deleteBucket(deleteBucketRequest);<NEW_LINE>} | listObjectsResult = oss.listObjects(listRequest); |
396,909 | public void readSettings(Object settings) {<NEW_LINE>wizardDescriptor = (WizardDescriptor) settings;<NEW_LINE>// NOI18N<NEW_LINE>wizardDescriptor.putProperty("NewProjectWizard_Title", component.getClientProperty("NewProjectWizard_Title"));<NEW_LINE>// guess webapps well-known locations and preset them<NEW_LINE>File baseFolder = (File) wizardDescriptor.getProperty(NewFreeformProjectSupport.PROP_PROJECT_LOCATION);<NEW_LINE>File nbProjectFolder = (File) wizardDescriptor.getProperty(NewFreeformProjectSupport.PROP_PROJECT_FOLDER);<NEW_LINE>final String webPages;<NEW_LINE>final String webInf;<NEW_LINE>final String srcPackages;<NEW_LINE>if (baseFolder.equals(this.baseFolder)) {<NEW_LINE>webPages = component.getWebPagesLocation().getAbsolutePath();<NEW_LINE>webInf = component.getWebInfLocation().getAbsolutePath();<NEW_LINE>srcPackages = component.getSrcPackagesLocation().getAbsolutePath();<NEW_LINE>} else {<NEW_LINE>this.baseFolder = baseFolder;<NEW_LINE>FileObject fo = FileUtil.toFileObject(baseFolder);<NEW_LINE>if (fo != null) {<NEW_LINE>FileObject <MASK><NEW_LINE>if (webPagesFO == null)<NEW_LINE>// NOI18N<NEW_LINE>webPages = "";<NEW_LINE>else<NEW_LINE>webPages = FileUtil.toFile(webPagesFO).getAbsolutePath();<NEW_LINE>FileObject webInfFO = FileSearchUtility.guessWebInf(fo);<NEW_LINE>if (webInfFO == null)<NEW_LINE>// NOI18N<NEW_LINE>webInf = "";<NEW_LINE>else<NEW_LINE>webInf = FileUtil.toFile(webInfFO).getAbsolutePath();<NEW_LINE>srcPackages = guessJavaRoot(fo);<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>webPages = "";<NEW_LINE>// NOI18N<NEW_LINE>webInf = "";<NEW_LINE>// NOI18N<NEW_LINE>srcPackages = "";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>component.setFolders(baseFolder, nbProjectFolder);<NEW_LINE>component.setWebPages(webPages);<NEW_LINE>component.setWebInf(webInf);<NEW_LINE>component.setSrcPackages(srcPackages);<NEW_LINE>} | webPagesFO = FileSearchUtility.guessDocBase(fo); |
813,452 | // -------------------------------------------------------------------------<NEW_LINE>@Override<NEW_LINE>public PortfolioItemSummary summarize() {<NEW_LINE>// 5Y USD 2mm Rec USD-LIBOR-6M Cap 1% / Pay Premium : 21Jan17-21Jan22<NEW_LINE>StringBuilder buf = new StringBuilder(96);<NEW_LINE><MASK><NEW_LINE>buf.append(SummarizerUtils.datePeriod(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted()));<NEW_LINE>buf.append(' ');<NEW_LINE>buf.append(SummarizerUtils.amount(mainLeg.getCurrency(), mainLeg.getNotional().getInitialValue()));<NEW_LINE>buf.append(' ');<NEW_LINE>if (mainLeg.getPayReceive().isReceive()) {<NEW_LINE>buf.append("Rec ");<NEW_LINE>summarizeMainLeg(mainLeg, buf);<NEW_LINE>buf.append(getPremium().isPresent() ? " / Pay Premium" : (product.getPayLeg().isPresent() ? " / Pay Periodic" : ""));<NEW_LINE>} else {<NEW_LINE>buf.append(getPremium().isPresent() ? "Rec Premium / Pay " : (product.getPayLeg().isPresent() ? "Rec Periodic / Pay " : ""));<NEW_LINE>summarizeMainLeg(mainLeg, buf);<NEW_LINE>}<NEW_LINE>buf.append(" : ");<NEW_LINE>buf.append(SummarizerUtils.dateRange(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted()));<NEW_LINE>return SummarizerUtils.summary(this, ProductType.IBOR_CAP_FLOOR, buf.toString(), mainLeg.getCurrency());<NEW_LINE>} | IborCapFloorLeg mainLeg = product.getCapFloorLeg(); |
172,159 | public static void main(String[] args) {<NEW_LINE>CommandSpec spec = CommandSpec.create();<NEW_LINE>spec.addOption(OptionSpec.builder("-V", "--verbose").build());<NEW_LINE>spec.addOption(// so, this option is of type List<File><NEW_LINE>OptionSpec.builder("-f", "--file").paramLabel("FILES").type(List.class).// so, this option is of type List<File><NEW_LINE>auxiliaryTypes(File.class).description("The files to process").build());<NEW_LINE>spec.addOption(OptionSpec.builder("-n", "--num").paramLabel("COUNT").type(int[].class).splitRegex(",").description("Comma-separated list of integers").build());<NEW_LINE>CommandLine commandLine = new CommandLine(spec);<NEW_LINE>args = new String[] { "--verbose", "-f", "file1", "--file=file2", "-n1,2,3" };<NEW_LINE>ParseResult pr = commandLine.parseArgs(args);<NEW_LINE>// Querying for options<NEW_LINE>// lists all command line args<NEW_LINE>List<String> originalArgs = pr.originalArgs();<NEW_LINE>assert Arrays.asList<MASK><NEW_LINE>// as specified on command line<NEW_LINE>assert pr.hasMatchedOption("--verbose");<NEW_LINE>// other aliases work also<NEW_LINE>assert pr.hasMatchedOption("-V");<NEW_LINE>// single-character alias works too<NEW_LINE>assert pr.hasMatchedOption('V');<NEW_LINE>// and, command name without hyphens<NEW_LINE>assert pr.hasMatchedOption("verbose");<NEW_LINE>// Matched Option Values<NEW_LINE>List<File> defaultValue = Collections.emptyList();<NEW_LINE>List<File> expected = Arrays.asList(new File("file1"), new File("file2"));<NEW_LINE>assert expected.equals(pr.matchedOptionValue('f', defaultValue));<NEW_LINE>assert expected.equals(pr.matchedOptionValue("--file", defaultValue));<NEW_LINE>assert Arrays.equals(new int[] { 1, 2, 3 }, pr.matchedOptionValue('n', new int[0]));<NEW_LINE>// Command line arguments after splitting but before type conversion<NEW_LINE>assert "1".equals(pr.matchedOption('n').stringValues().get(0));<NEW_LINE>assert "2".equals(pr.matchedOption('n').stringValues().get(1));<NEW_LINE>assert "3".equals(pr.matchedOption('n').stringValues().get(2));<NEW_LINE>// Command line arguments as found on the command line<NEW_LINE>assert "1,2,3".equals(pr.matchedOption("--num").originalStringValues().get(0));<NEW_LINE>} | (args).equals(originalArgs); |
934,075 | private void fillMinusHitsFromOneField(String fieldName, Set<Object> fieldValues, SearchHit someHit) {<NEW_LINE>List<SearchHit> minusHitsList = new ArrayList<>();<NEW_LINE>int currentId = 1;<NEW_LINE>for (Object result : fieldValues) {<NEW_LINE>Map<String, DocumentField> fields = new HashMap<>();<NEW_LINE>ArrayList<Object> values = new ArrayList<Object>();<NEW_LINE>values.add(result);<NEW_LINE>fields.put(fieldName, new DocumentField(fieldName, values));<NEW_LINE>SearchHit searchHit = new SearchHit(currentId, currentId + "", new Text(someHit.getType()), fields, null);<NEW_LINE>searchHit.sourceRef(someHit.getSourceRef());<NEW_LINE>searchHit.getSourceAsMap().clear();<NEW_LINE>Map<String, Object> sourceAsMap = new HashMap<>();<NEW_LINE>sourceAsMap.put(fieldName, result);<NEW_LINE>searchHit.<MASK><NEW_LINE>currentId++;<NEW_LINE>minusHitsList.add(searchHit);<NEW_LINE>}<NEW_LINE>int totalSize = currentId - 1;<NEW_LINE>SearchHit[] unionHitsArr = minusHitsList.toArray(new SearchHit[totalSize]);<NEW_LINE>this.minusHits = new SearchHits(unionHitsArr, new TotalHits(totalSize, TotalHits.Relation.EQUAL_TO), 1.0f);<NEW_LINE>} | getSourceAsMap().putAll(sourceAsMap); |
1,454,155 | private void visitSetConstVar(Node node, Node child, boolean needValue) {<NEW_LINE>if (!hasVarsInRegs)<NEW_LINE>Kit.codeBug();<NEW_LINE>int varIndex = fnCurrent.getVarIndex(node);<NEW_LINE>generateExpression(child.getNext(), node);<NEW_LINE>boolean isNumber = (node.getIntProp(Node.ISNUMBER_PROP, -1) != -1);<NEW_LINE>short reg = varRegisters[varIndex];<NEW_LINE><MASK><NEW_LINE>int noAssign = cfw.acquireLabel();<NEW_LINE>if (isNumber) {<NEW_LINE>cfw.addILoad(reg + 2);<NEW_LINE>cfw.add(ByteCode.IFNE, noAssign);<NEW_LINE>short stack = cfw.getStackTop();<NEW_LINE>cfw.addPush(1);<NEW_LINE>cfw.addIStore(reg + 2);<NEW_LINE>cfw.addDStore(reg);<NEW_LINE>if (needValue) {<NEW_LINE>cfw.addDLoad(reg);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>} else {<NEW_LINE>cfw.add(ByteCode.GOTO, beyond);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>cfw.add(ByteCode.POP2);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>cfw.addILoad(reg + 1);<NEW_LINE>cfw.add(ByteCode.IFNE, noAssign);<NEW_LINE>short stack = cfw.getStackTop();<NEW_LINE>cfw.addPush(1);<NEW_LINE>cfw.addIStore(reg + 1);<NEW_LINE>cfw.addAStore(reg);<NEW_LINE>if (needValue) {<NEW_LINE>cfw.addALoad(reg);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>} else {<NEW_LINE>cfw.add(ByteCode.GOTO, beyond);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>cfw.add(ByteCode.POP);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cfw.markLabel(beyond);<NEW_LINE>} | int beyond = cfw.acquireLabel(); |
1,146,408 | Object repr(PDeque self) {<NEW_LINE>PythonContext ctxt = PythonContext.get(this);<NEW_LINE>if (!ctxt.reprEnter(self)) {<NEW_LINE>return "[...]";<NEW_LINE>}<NEW_LINE>EncapsulatingNodeReference ref = EncapsulatingNodeReference.getCurrent();<NEW_LINE>Node outerNode = ref.set(this);<NEW_LINE>try {<NEW_LINE>Object[] items = self.data.toArray();<NEW_LINE>PList asList = PythonObjectFactory.getUncached().createList(items);<NEW_LINE><MASK><NEW_LINE>StringBuilder sb = new StringBuilder(GetNameNode.getUncached().execute(GetClassNode.getUncached().execute(self)));<NEW_LINE>sb.append('(').append(PyObjectStrAsJavaStringNode.getUncached().execute(null, asList));<NEW_LINE>if (maxLength != -1) {<NEW_LINE>sb.append(", maxlen=").append(maxLength);<NEW_LINE>}<NEW_LINE>sb.append(')');<NEW_LINE>return sb.toString();<NEW_LINE>} finally {<NEW_LINE>ref.set(outerNode);<NEW_LINE>ctxt.reprLeave(self);<NEW_LINE>}<NEW_LINE>} | int maxLength = self.getMaxLength(); |
1,575,926 | public static JFreeChart buildHistogram(final Number[] numbers, final String dataName, final int divisions) {<NEW_LINE>if (numbers == null || numbers.length == 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>HistogramDataset dataset = new HistogramDataset();<NEW_LINE><MASK><NEW_LINE>double[] doubleNumbers = new double[numbers.length];<NEW_LINE>for (int i = 0; i < doubleNumbers.length; i++) {<NEW_LINE>doubleNumbers[i] = numbers[i].doubleValue();<NEW_LINE>}<NEW_LINE>// Use 10 divisions if divisions number is invalid.<NEW_LINE>dataset.// Use 10 divisions if divisions number is invalid.<NEW_LINE>addSeries(// Use 10 divisions if divisions number is invalid.<NEW_LINE>dataName, // Use 10 divisions if divisions number is invalid.<NEW_LINE>doubleNumbers, divisions > 0 ? divisions : 10);<NEW_LINE>JFreeChart histogram = ChartFactory.createHistogram(getMessage("ChartsUtils.report.histogram.title"), dataName, getMessage("ChartsUtils.report.histogram.yLabel"), dataset, PlotOrientation.VERTICAL, true, true, false);<NEW_LINE>return histogram;<NEW_LINE>} | dataset.setType(HistogramType.FREQUENCY); |
1,773,054 | public static ListDigitalTemplatesResponse unmarshall(ListDigitalTemplatesResponse listDigitalTemplatesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listDigitalTemplatesResponse.setRequestId(_ctx.stringValue("ListDigitalTemplatesResponse.RequestId"));<NEW_LINE>listDigitalTemplatesResponse.setErrorCode(_ctx.stringValue("ListDigitalTemplatesResponse.ErrorCode"));<NEW_LINE>listDigitalTemplatesResponse.setErrorDesc<MASK><NEW_LINE>listDigitalTemplatesResponse.setSuccess(_ctx.booleanValue("ListDigitalTemplatesResponse.Success"));<NEW_LINE>listDigitalTemplatesResponse.setTraceId(_ctx.stringValue("ListDigitalTemplatesResponse.TraceId"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setTotalNum(_ctx.longValue("ListDigitalTemplatesResponse.Data.TotalNum"));<NEW_LINE>data.setPageSize(_ctx.longValue("ListDigitalTemplatesResponse.Data.PageSize"));<NEW_LINE>data.setPageNum(_ctx.longValue("ListDigitalTemplatesResponse.Data.PageNum"));<NEW_LINE>List<ContentItem> content = new ArrayList<ContentItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListDigitalTemplatesResponse.Data.Content.Length"); i++) {<NEW_LINE>ContentItem contentItem = new ContentItem();<NEW_LINE>contentItem.setId(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].Id"));<NEW_LINE>contentItem.setTemplateName(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].TemplateName"));<NEW_LINE>contentItem.setTemplateTheme(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].TemplateTheme"));<NEW_LINE>contentItem.setSmsTemplateCode(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].SmsTemplateCode"));<NEW_LINE>contentItem.setTemplateStatus(_ctx.longValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].TemplateStatus"));<NEW_LINE>contentItem.setPlatformName(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].PlatformName"));<NEW_LINE>contentItem.setPlatformId(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].PlatformId"));<NEW_LINE>contentItem.setReason(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].Reason"));<NEW_LINE>contentItem.setSign(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].Sign"));<NEW_LINE>contentItem.setSupportProvider(_ctx.stringValue("ListDigitalTemplatesResponse.Data.Content[" + i + "].SupportProvider"));<NEW_LINE>content.add(contentItem);<NEW_LINE>}<NEW_LINE>data.setContent(content);<NEW_LINE>listDigitalTemplatesResponse.setData(data);<NEW_LINE>return listDigitalTemplatesResponse;<NEW_LINE>} | (_ctx.stringValue("ListDigitalTemplatesResponse.ErrorDesc")); |
1,745,022 | private Task<Void> verifyBeforeUpdateEmail(Map<String, Object> arguments) {<NEW_LINE>return Tasks.call(cachedThreadPool, () -> {<NEW_LINE>FirebaseUser firebaseUser = getCurrentUser(arguments);<NEW_LINE>if (firebaseUser == null) {<NEW_LINE>throw FlutterFirebaseAuthPluginException.noUser();<NEW_LINE>}<NEW_LINE>String newEmail = (String) Objects.requireNonNull(arguments.get(Constants.NEW_EMAIL));<NEW_LINE>Object rawActionCodeSettings = arguments.get(Constants.ACTION_CODE_SETTINGS);<NEW_LINE>if (rawActionCodeSettings == null) {<NEW_LINE>return Tasks.await(firebaseUser.verifyBeforeUpdateEmail(newEmail));<NEW_LINE>}<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<String, Object> actionCodeSettings = (Map<String, Object>) rawActionCodeSettings;<NEW_LINE>return Tasks.await(firebaseUser.verifyBeforeUpdateEmail(<MASK><NEW_LINE>});<NEW_LINE>} | newEmail, getActionCodeSettings(actionCodeSettings))); |
1,265,549 | public static <T extends Model> int apply(Class<? extends Model> modelClass, Collection<? extends Number> ids, ThrowConsumer<T> consumer) {<NEW_LINE>Preconditions.checkNotNull(ids, I18n.get("The collection of IDs cannot be null."));<NEW_LINE>Preconditions.checkNotNull(consumer, I18n.get("The consumer cannot be null."));<NEW_LINE>int errorCount = 0;<NEW_LINE>for (Number id : ids) {<NEW_LINE>try {<NEW_LINE>if (id != null) {<NEW_LINE>Model model = JPA.find(modelClass, id.longValue());<NEW_LINE>if (model != null) {<NEW_LINE>consumer.accept((T) model);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new AxelorException(modelClass, TraceBackRepository.CATEGORY_NO_VALUE, I18n.get("Cannot find record #%s")<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>++errorCount;<NEW_LINE>TraceBackService.trace(e);<NEW_LINE>} finally {<NEW_LINE>JPA.clear();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return errorCount;<NEW_LINE>} | , String.valueOf(id)); |
1,714,055 | public static boolean canUseAsync(boolean async, boolean expunge, OS os, Reporter reporter) {<NEW_LINE>// TODO(dmarting): Deactivate expunge_async on non-Linux platform until we completely fix it<NEW_LINE>// for non-Linux platforms (https://github.com/bazelbuild/bazel/issues/1906).<NEW_LINE>// MacOS and FreeBSD support setsid(2) but don't have /usr/bin/setsid, so if we wanted to<NEW_LINE>// support --expunge_async on these platforms, we'd have to write a wrapper that calls setsid(2)<NEW_LINE>// and exec(2).<NEW_LINE><MASK><NEW_LINE>if (async && !asyncSupport) {<NEW_LINE>String fallbackName = expunge ? "--expunge" : "synchronous clean";<NEW_LINE>reporter.handle(Event.info(null, /*location*/<NEW_LINE>"--async cannot be used on non-Linux platforms, falling back to " + fallbackName));<NEW_LINE>async = false;<NEW_LINE>}<NEW_LINE>String cleanBanner = (async || !asyncSupport) ? "Starting clean." : "Starting clean (this may take a while). " + "Consider using --async if the clean takes more than several minutes.";<NEW_LINE>reporter.handle(Event.info(/* location= */<NEW_LINE>null, cleanBanner));<NEW_LINE>return async;<NEW_LINE>} | boolean asyncSupport = os == OS.LINUX; |
62,865 | final DeleteProfileObjectTypeResult executeDeleteProfileObjectType(DeleteProfileObjectTypeRequest deleteProfileObjectTypeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteProfileObjectTypeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DeleteProfileObjectTypeRequest> request = null;<NEW_LINE>Response<DeleteProfileObjectTypeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteProfileObjectTypeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteProfileObjectTypeRequest));<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, "Customer Profiles");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteProfileObjectType");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteProfileObjectTypeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteProfileObjectTypeResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,145,956 | public ValidationResult validate(Properties properties) {<NEW_LINE>final ValidationResult result = new ValidationResult();<NEW_LINE>final String readAccessString = properties.getProperty(ScriptingPermissions.RESOURCES_EXECUTE_SCRIPTS_WITHOUT_READ_RESTRICTION);<NEW_LINE>final String writeAccessString = properties.getProperty(ScriptingPermissions.RESOURCES_EXECUTE_SCRIPTS_WITHOUT_WRITE_RESTRICTION);<NEW_LINE>final String classpath = properties.getProperty(ScriptResources.RESOURCES_SCRIPT_CLASSPATH);<NEW_LINE>final boolean readAccess = readAccessString != null && Boolean.parseBoolean(readAccessString);<NEW_LINE>final boolean writeAccess = writeAccessString != null && Boolean.parseBoolean(writeAccessString);<NEW_LINE>final boolean classpathIsSet = classpath != null <MASK><NEW_LINE>if (classpathIsSet && !readAccess) {<NEW_LINE>result.addError(TextUtils.getText("OptionPanel.validate_classpath_needs_readaccess"));<NEW_LINE>}<NEW_LINE>if (writeAccess && !readAccess) {<NEW_LINE>result.addWarning(TextUtils.getText("OptionPanel.validate_write_without_read"));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | && classpath.length() > 0; |
1,700,507 | protected byte[] serializeWebPayload(final OJwtPayload payload) throws Exception {<NEW_LINE>if (payload == null)<NEW_LINE>throw new IllegalArgumentException("Token payload is null");<NEW_LINE><MASK><NEW_LINE>doc.field("username", payload.getUserName());<NEW_LINE>doc.field("iss", payload.getIssuer());<NEW_LINE>doc.field("exp", payload.getExpiry());<NEW_LINE>doc.field("iat", payload.getIssuedAt());<NEW_LINE>doc.field("nbf", payload.getNotBefore());<NEW_LINE>doc.field("sub", payload.getDatabase());<NEW_LINE>doc.field("aud", payload.getAudience());<NEW_LINE>doc.field("jti", payload.getTokenId());<NEW_LINE>doc.field("uidc", ((OrientJwtPayload) payload).getUserRid().getClusterId());<NEW_LINE>doc.field("uidp", ((OrientJwtPayload) payload).getUserRid().getClusterPosition());<NEW_LINE>doc.field("bdtyp", ((OrientJwtPayload) payload).getDatabaseType());<NEW_LINE>return doc.toJSON().getBytes("UTF-8");<NEW_LINE>} | final ODocument doc = new ODocument(); |
208,971 | private void importSms(final Message message) throws IOException, MessagingException {<NEW_LINE>if (LOCAL_LOGV)<NEW_LINE>Log.v(TAG, "importSms(" + message + ")");<NEW_LINE>final ContentValues values = converter.messageToContentValues(message);<NEW_LINE>final Integer type = values.getAsInteger(Telephony.TextBasedSmsColumns.TYPE);<NEW_LINE>// only restore inbox messages and sent messages - otherwise sms might get sent on restore<NEW_LINE>if (type != null && (type == Telephony.TextBasedSmsColumns.MESSAGE_TYPE_INBOX || type == Telephony.TextBasedSmsColumns.MESSAGE_TYPE_SENT) && !smsExists(values)) {<NEW_LINE>final Uri uri = resolver.insert(Consts.SMS_PROVIDER, values);<NEW_LINE>if (uri != null) {<NEW_LINE>smsIds.add(uri.getLastPathSegment());<NEW_LINE>Long timestamp = values.<MASK><NEW_LINE>if (timestamp != null && preferences.getDataTypePreferences().getMaxSyncedDate(SMS) < timestamp) {<NEW_LINE>preferences.getDataTypePreferences().setMaxSyncedDate(SMS, timestamp);<NEW_LINE>}<NEW_LINE>if (LOCAL_LOGV)<NEW_LINE>Log.v(TAG, "inserted " + uri);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (LOCAL_LOGV)<NEW_LINE>Log.d(TAG, "ignoring sms");<NEW_LINE>}<NEW_LINE>} | getAsLong(Telephony.TextBasedSmsColumns.DATE); |
1,343,326 | public com.amazonaws.services.ecr.model.ValidationException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.ecr.model.ValidationException validationException = new com.amazonaws.services.ecr.model.ValidationException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 validationException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
557,087 | public ArrayList<PEPeer> rankPeers(int max_to_unchoke, ArrayList<PEPeer> all_peers) {<NEW_LINE>ArrayList<PEPeer> <MASK><NEW_LINE>// ensure we never rank more peers than needed<NEW_LINE>long[] bests = new long[max_to_unchoke];<NEW_LINE>// fill slots with peers who we are currently downloading the fastest from<NEW_LINE>for (int i = 0; i < all_peers.size(); i++) {<NEW_LINE>PEPeer peer = all_peers.get(i);<NEW_LINE>if (peer.isInteresting() && UnchokerUtil.isUnchokable(peer, false)) {<NEW_LINE>// viable peer found<NEW_LINE>long rate = peer.getStats().getSmoothDataReceiveRate();<NEW_LINE>if (rate > 256) {<NEW_LINE>// filter out really slow peers<NEW_LINE>UnchokerUtil.updateLargestValueFirstSort(rate, bests, peer, best_peers, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if we havent yet picked enough slots<NEW_LINE>if (best_peers.size() < max_to_unchoke) {<NEW_LINE>int start_pos = best_peers.size();<NEW_LINE>// fill the remaining slots with peers that we have downloaded from in the past<NEW_LINE>for (int i = 0; i < all_peers.size(); i++) {<NEW_LINE>PEPeer peer = all_peers.get(i);<NEW_LINE>if (peer.isInteresting() && UnchokerUtil.isUnchokable(peer, false) && !best_peers.contains(peer)) {<NEW_LINE>// viable peer found<NEW_LINE>long uploaded_ratio = peer.getStats().getTotalDataBytesSent() / (peer.getStats().getTotalDataBytesReceived() + (DiskManager.BLOCK_SIZE - 1));<NEW_LINE>// make sure we haven't already uploaded several times as much data as they've sent us<NEW_LINE>if (uploaded_ratio < 3) {<NEW_LINE>UnchokerUtil.updateLargestValueFirstSort(peer.getStats().getTotalDataBytesReceived(), bests, peer, best_peers, start_pos);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return best_peers;<NEW_LINE>} | best_peers = new ArrayList<>(); |
812,772 | final DeleteTestGridProjectResult executeDeleteTestGridProject(DeleteTestGridProjectRequest deleteTestGridProjectRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteTestGridProjectRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteTestGridProjectRequest> request = null;<NEW_LINE>Response<DeleteTestGridProjectResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteTestGridProjectRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTestGridProjectRequest));<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, "Device Farm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTestGridProject");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteTestGridProjectResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTestGridProjectResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
51,631 | private void addItem(DefaultConfigurableFileCollection owner, PathToFileResolver resolver, Factory<PatternSet> patternSetFactory, TaskDependencyFactory taskDependencyFactory, PropertyHost propertyHost, Object path, ImmutableList<Object> oldItems) {<NEW_LINE>// Unpack to deal with DSL syntax: collection += someFiles<NEW_LINE>if (path instanceof FileCollectionInternal) {<NEW_LINE>path = ((FileCollectionInternal) path).replace(owner, () -> {<NEW_LINE>// Should use FileCollectionFactory here, and it can take care of simplifying the tree. For example, ths returned collection does not need to be mutable<NEW_LINE>if (oldItems.size() == 1 && oldItems.get(0) instanceof FileCollectionInternal) {<NEW_LINE>return (<MASK><NEW_LINE>}<NEW_LINE>DefaultConfigurableFileCollection oldFiles = new DefaultConfigurableFileCollection(null, resolver, taskDependencyFactory, patternSetFactory, propertyHost);<NEW_LINE>oldFiles.from(oldItems);<NEW_LINE>return oldFiles;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>items.add(path);<NEW_LINE>} | FileCollectionInternal) oldItems.get(0); |
252,046 | public AutoMLS3DataSource unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AutoMLS3DataSource autoMLS3DataSource = new AutoMLS3DataSource();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><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("S3DataType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>autoMLS3DataSource.setS3DataType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("S3Uri", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>autoMLS3DataSource.setS3Uri(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 autoMLS3DataSource;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
946,034 | static Object index(StarlarkThread starlarkThread, Object object, Object key) throws EvalException {<NEW_LINE>Mutability mu = starlarkThread.mutability();<NEW_LINE>StarlarkSemantics semantics = starlarkThread.getSemantics();<NEW_LINE>if (object instanceof StarlarkIndexable.Threaded) {<NEW_LINE>return ((StarlarkIndexable.Threaded) object).getIndex(starlarkThread, semantics, key);<NEW_LINE>} else if (object instanceof StarlarkIndexable) {<NEW_LINE>Object result = ((StarlarkIndexable) object).getIndex(semantics, key);<NEW_LINE>// TODO(bazel-team): We shouldn't have this fromJava call here. If it's needed at all,<NEW_LINE>// it should go in the implementations of StarlarkIndexable#getIndex that produce non-Starlark<NEW_LINE>// values.<NEW_LINE>return result == null ? null : <MASK><NEW_LINE>} else if (object instanceof String) {<NEW_LINE>String string = (String) object;<NEW_LINE>int index = Starlark.toInt(key, "string index");<NEW_LINE>index = getSequenceIndex(index, string.length());<NEW_LINE>return StringModule.memoizedCharToString(string.charAt(index));<NEW_LINE>} else {<NEW_LINE>throw Starlark.errorf("type '%s' has no operator [](%s)", Starlark.type(object), Starlark.type(key));<NEW_LINE>}<NEW_LINE>} | Starlark.fromJava(result, mu); |
1,117,501 | public MLMethod createML(int inputs, int outputs) {<NEW_LINE>BasicNetwork network = new BasicNetwork();<NEW_LINE>if (this.dropoutRates != null) {<NEW_LINE>// (inputs));<NEW_LINE>network.addLayer(new BasicLayer(activation, false, inputs, <MASK><NEW_LINE>} else {<NEW_LINE>// (inputs));<NEW_LINE>network.addLayer(new BasicLayer(activation, false, inputs));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < layers.size(); i++) {<NEW_LINE>if (this.dropoutRates != null) {<NEW_LINE>network.addLayer(new BasicLayer(activation, true, layers.get(i) * sizeMultiplier, dropoutRates.get(i + 1)));<NEW_LINE>} else {<NEW_LINE>network.addLayer(new BasicLayer(activation, true, layers.get(i) * sizeMultiplier));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dropoutRates != null) {<NEW_LINE>network.addLayer(new BasicLayer(lastLayerActivation, true, outputs, dropoutRates.get(dropoutRates.size() - 1)));<NEW_LINE>} else {<NEW_LINE>network.addLayer(new BasicLayer(lastLayerActivation, true, outputs));<NEW_LINE>}<NEW_LINE>network.getStructure().finalizeStructure(dropoutRates != null);<NEW_LINE>network.reset();<NEW_LINE>return network;<NEW_LINE>} | dropoutRates.get(0))); |
1,324,671 | public void run() {<NEW_LINE>try {<NEW_LINE>boolean success = false;<NEW_LINE><MASK><NEW_LINE>Throwable ex = null;<NEW_LINE>try {<NEW_LINE>haContext.getHaLock().writeLock().lock();<NEW_LINE>success = submitGroupHaSwitchTasks(haContext, newStorageNodeHaInfoMap, storageHaManager);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>if (haContext.storageKind == StorageInfoRecord.INST_KIND_META_DB) {<NEW_LINE>MetaDbLogUtil.META_DB_LOG.error("Failed to do MetaDB DataSource HASwitch due to ", e);<NEW_LINE>} else {<NEW_LINE>MetaDbLogUtil.META_DB_LOG.error("Failed to do Group DataSource HASwitch due to ", e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>changeHaStatus(success);<NEW_LINE>haContext.getHaLock().writeLock().unlock();<NEW_LINE>long switchEndTs = System.currentTimeMillis();<NEW_LINE>doStorageInstHaLog(success, this.allGrpListToBeSwitched.size(), this.switchTaskCount, startTs, switchEndTs, this.oldAddress, this.newAvailableAddr, this.newXport);<NEW_LINE>}<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>MetaDbLogUtil.META_DB_LOG.error(ex);<NEW_LINE>}<NEW_LINE>} | long startTs = System.currentTimeMillis(); |
1,074,921 | public void estimateElimCount() {<NEW_LINE>// long ts = System.currentTimeMillis();<NEW_LINE>// the function is applied to both columns<NEW_LINE>// if hash is equal, they are not going to be eliminated<NEW_LINE>// filter on hash equal and count<NEW_LINE>LOG.debug("Applying " + function.getName());<NEW_LINE>dupeRemaining <MASK><NEW_LINE>for (Row r : dupeN) {<NEW_LINE>Object hash1 = function.apply(r, context.fieldName);<NEW_LINE>Object hash2 = function.apply(r, ColName.COL_PREFIX + context.fieldName);<NEW_LINE>LOG.debug("hash1 " + hash1);<NEW_LINE>LOG.debug("hash2 " + hash2);<NEW_LINE>if (hash1 == null && hash2 == null) {<NEW_LINE>dupeRemaining.add(r);<NEW_LINE>} else if (hash1 != null && hash2 != null && hash1.equals(hash2)) {<NEW_LINE>dupeRemaining.add(r);<NEW_LINE>LOG.debug("NOT eliminatin ");<NEW_LINE>} else {<NEW_LINE>LOG.debug("eliminatin " + r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>elimCount = dupeN.size() - dupeRemaining.size();<NEW_LINE>// LOG.debug("estimateElimCount" + (System.currentTimeMillis() - ts));<NEW_LINE>} | = new ArrayList<Row>(); |
946,976 | private void boxIfNecessary(SourceWriter writer, ValueType type, Fragment fragment) throws IOException {<NEW_LINE>boolean boxed = false;<NEW_LINE>if (type instanceof ValueType.Primitive) {<NEW_LINE>switch(((ValueType.Primitive) type).getKind()) {<NEW_LINE>case BOOLEAN:<NEW_LINE>writer.appendMethodBody(new MethodReference(Boolean.class, "valueOf", boolean.class, Boolean.class));<NEW_LINE>break;<NEW_LINE>case BYTE:<NEW_LINE>writer.appendMethodBody(new MethodReference(Byte.class, "valueOf", byte.class, Byte.class));<NEW_LINE>break;<NEW_LINE>case SHORT:<NEW_LINE>writer.appendMethodBody(new MethodReference(Short.class, "valueOf", short.class, Short.class));<NEW_LINE>break;<NEW_LINE>case CHARACTER:<NEW_LINE>writer.appendMethodBody(new MethodReference(Character.class, "valueOf", char.class, Character.class));<NEW_LINE>break;<NEW_LINE>case INTEGER:<NEW_LINE>writer.appendMethodBody(new MethodReference(Integer.class, "valueOf", int.class, Integer.class));<NEW_LINE>break;<NEW_LINE>case LONG:<NEW_LINE>writer.appendMethodBody(new MethodReference(Long.class, "valueOf", long.class, Long.class));<NEW_LINE>break;<NEW_LINE>case FLOAT:<NEW_LINE>writer.appendMethodBody(new MethodReference(Float.class, "valueOf", float<MASK><NEW_LINE>break;<NEW_LINE>case DOUBLE:<NEW_LINE>writer.appendMethodBody(new MethodReference(Double.class, "valueOf", double.class, Double.class));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>writer.append('(');<NEW_LINE>boxed = true;<NEW_LINE>}<NEW_LINE>fragment.render();<NEW_LINE>if (boxed) {<NEW_LINE>writer.append(')');<NEW_LINE>}<NEW_LINE>} | .class, Float.class)); |
521,803 | public void drawTextFieldCursor(Graphics g, TextArea ta) {<NEW_LINE>Style style = ta.getStyle();<NEW_LINE>Font f = style.getFont();<NEW_LINE>int cursorY;<NEW_LINE>if (ta.isSingleLineTextArea()) {<NEW_LINE>switch(ta.getVerticalAlignment()) {<NEW_LINE>case Component.BOTTOM:<NEW_LINE>cursorY = ta.getY() + ta.getHeight() - f.getHeight();<NEW_LINE>break;<NEW_LINE>case Component.CENTER:<NEW_LINE>cursorY = ta.getY() + ta.getHeight() / 2 - f.getHeight() / 2;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>cursorY = ta.getY() + style.getPaddingTop();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>cursorY = ta.getY() + style.getPaddingTop() + ta.getCursorY() * (ta.getRowsGap(<MASK><NEW_LINE>}<NEW_LINE>int cursorX = getTextFieldCursorX(ta);<NEW_LINE>int align = reverseAlignForBidi(ta);<NEW_LINE>int x = 0;<NEW_LINE>if (align == Component.RIGHT) {<NEW_LINE>String inputMode = ta.getInputMode();<NEW_LINE>int inputModeWidth = f.stringWidth(inputMode);<NEW_LINE>int baseX = ta.getX() + style.getPaddingLeftNoRTL() + inputModeWidth;<NEW_LINE>if (cursorX < baseX) {<NEW_LINE>x = baseX - cursorX;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int oldColor = g.getColor();<NEW_LINE>int alpha = g.concatenateAlpha(style.getFgAlpha());<NEW_LINE>if (getTextFieldCursorColor() == 0) {<NEW_LINE>g.setColor(style.getFgColor());<NEW_LINE>} else {<NEW_LINE>g.setColor(getTextFieldCursorColor());<NEW_LINE>}<NEW_LINE>g.drawLine(cursorX + x, cursorY, cursorX + x, cursorY + f.getHeight());<NEW_LINE>g.setColor(oldColor);<NEW_LINE>g.setAlpha(alpha);<NEW_LINE>} | ) + f.getHeight()); |
1,738,960 | public ECPoint twicePlus(ECPoint b) {<NEW_LINE>if (this.isInfinity()) {<NEW_LINE>return b;<NEW_LINE>}<NEW_LINE>if (b.isInfinity()) {<NEW_LINE>return twice();<NEW_LINE>}<NEW_LINE>ECCurve curve = this.getCurve();<NEW_LINE>ECFieldElement X1 = this.x;<NEW_LINE>if (X1.isZero()) {<NEW_LINE>// A point with X == 0 is its own additive inverse<NEW_LINE>return b;<NEW_LINE>}<NEW_LINE>// NOTE: twicePlus() only optimized for lambda-affine argument<NEW_LINE>ECFieldElement X2 = b.getRawXCoord(), Z2 = b.getZCoord(0);<NEW_LINE>if (X2.isZero() || !Z2.isOne()) {<NEW_LINE>return twice().add(b);<NEW_LINE>}<NEW_LINE>ECFieldElement L1 = this.y, Z1 = this.zs[0];<NEW_LINE>ECFieldElement L2 = b.getRawYCoord();<NEW_LINE>ECFieldElement X1Sq = X1.square();<NEW_LINE>ECFieldElement L1Sq = L1.square();<NEW_LINE>ECFieldElement Z1Sq = Z1.square();<NEW_LINE>ECFieldElement L1Z1 = L1.multiply(Z1);<NEW_LINE>ECFieldElement T = L1Sq.add(L1Z1);<NEW_LINE>ECFieldElement L2plus1 = L2.addOne();<NEW_LINE>ECFieldElement A = L2plus1.multiply(Z1Sq).add(L1Sq).multiplyPlusProduct(T, X1Sq, Z1Sq);<NEW_LINE>ECFieldElement X2Z1Sq = X2.multiply(Z1Sq);<NEW_LINE>ECFieldElement B = X2Z1Sq.add(T).square();<NEW_LINE>if (B.isZero()) {<NEW_LINE>if (A.isZero()) {<NEW_LINE>return b.twice();<NEW_LINE>}<NEW_LINE>return curve.getInfinity();<NEW_LINE>}<NEW_LINE>if (A.isZero()) {<NEW_LINE>return new SecT283K1Point(curve, A, curve.getB());<NEW_LINE>}<NEW_LINE>ECFieldElement X3 = A.square().multiply(X2Z1Sq);<NEW_LINE>ECFieldElement Z3 = A.multiply(B).multiply(Z1Sq);<NEW_LINE>ECFieldElement L3 = A.add(B).square().multiplyPlusProduct(T, L2plus1, Z3);<NEW_LINE>return new SecT283K1Point(curve, X3, L3, <MASK><NEW_LINE>} | new ECFieldElement[] { Z3 }); |
1,518,338 | public int generateTypeAnnotationsOnCodeAttribute() {<NEW_LINE>int attributesNumber = 0;<NEW_LINE>List allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts;<NEW_LINE>int invisibleTypeAnnotationsCounter = 0;<NEW_LINE>int visibleTypeAnnotationsCounter = 0;<NEW_LINE>for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) {<NEW_LINE>LocalVariableBinding localVariable = this.codeStream.locals[i];<NEW_LINE>if (localVariable.isCatchParameter())<NEW_LINE>continue;<NEW_LINE>LocalDeclaration declaration = localVariable.declaration;<NEW_LINE>if (declaration == null || (declaration.isArgument() && ((declaration.bits & ASTNode.IsUnionType) == 0)) || (localVariable.initializationCount == 0) || ((declaration.bits & ASTNode.HasTypeAnnotations) == 0)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>int targetType = ((localVariable.tagBits & TagBits.IsResource) == 0) ? AnnotationTargetTypeConstants.LOCAL_VARIABLE : AnnotationTargetTypeConstants.RESOURCE_VARIABLE;<NEW_LINE>declaration.getAllAnnotationContexts(targetType, localVariable, allTypeAnnotationContexts);<NEW_LINE>}<NEW_LINE>ExceptionLabel[] exceptionLabels = this.codeStream.exceptionLabels;<NEW_LINE>for (int i = 0, max = this.codeStream.exceptionLabelsCounter; i < max; i++) {<NEW_LINE>ExceptionLabel exceptionLabel = exceptionLabels[i];<NEW_LINE>if (exceptionLabel.exceptionTypeReference != null && (exceptionLabel.exceptionTypeReference.bits & ASTNode.HasTypeAnnotations) != 0) {<NEW_LINE>exceptionLabel.exceptionTypeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.EXCEPTION_PARAMETER, i, allTypeAnnotationContexts, exceptionLabel.se7Annotations);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (size != 0) {<NEW_LINE>AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];<NEW_LINE>allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);<NEW_LINE>for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) {<NEW_LINE>AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];<NEW_LINE>if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {<NEW_LINE>invisibleTypeAnnotationsCounter++;<NEW_LINE>} else {<NEW_LINE>visibleTypeAnnotationsCounter++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>attributesNumber += generateRuntimeTypeAnnotations(allTypeAnnotationContextsArray, visibleTypeAnnotationsCounter, invisibleTypeAnnotationsCounter);<NEW_LINE>}<NEW_LINE>return attributesNumber;<NEW_LINE>} | int size = allTypeAnnotationContexts.size(); |
105,603 | public void solve() {<NEW_LINE>solution = new int[mazeSize][mazeSize];<NEW_LINE>if (this.isNoValidPoint(this.startX, this.startZ)) {<NEW_LINE>System.out.println("No valid start found.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (this.isNoValidPoint(this.endX, this.endZ)) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (this.findNext(this.startX, this.startZ)) {<NEW_LINE>for (int i = 0; i < this.mazeSize; i++) {<NEW_LINE>for (int j = 0; j < this.mazeSize; j++) {<NEW_LINE>char c = 'A';<NEW_LINE>if (this.solution[i][j] == 1) {<NEW_LINE>c = '#';<NEW_LINE>}<NEW_LINE>System.out.print(" " + c + " ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>System.out.println("No solution found.");<NEW_LINE>}<NEW_LINE>} | System.out.println("No valid end found."); |
1,648,385 | final GetRecoveryGroupResult executeGetRecoveryGroup(GetRecoveryGroupRequest getRecoveryGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getRecoveryGroupRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetRecoveryGroupRequest> request = null;<NEW_LINE>Response<GetRecoveryGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetRecoveryGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getRecoveryGroupRequest));<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, "Route53 Recovery Readiness");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRecoveryGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetRecoveryGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetRecoveryGroupResultJsonUnmarshaller());<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(); |
509,247 | public void computeColorLog(double dx, double dy) {<NEW_LINE>red = blue = green = 0;<NEW_LINE>if (dx > 0) {<NEW_LINE>red = Math.max(0, (int) (255 * Math.log(logBase + logScale * <MASK><NEW_LINE>} else {<NEW_LINE>green = Math.max(0, (int) (255 * Math.log(logBase - logScale * dx / maxVelocity) / maxLog));<NEW_LINE>}<NEW_LINE>if (dy > 0) {<NEW_LINE>blue = Math.max(0, (int) (255 * Math.log(logBase + logScale * dy / maxVelocity) / maxLog));<NEW_LINE>} else {<NEW_LINE>int v = Math.max(0, (int) (255 * Math.log(logBase - logScale * dy / maxVelocity) / maxLog));<NEW_LINE>red += v;<NEW_LINE>green += v;<NEW_LINE>if (red > 255)<NEW_LINE>red = 255;<NEW_LINE>if (green > 255)<NEW_LINE>green = 255;<NEW_LINE>}<NEW_LINE>} | dx / maxVelocity) / maxLog)); |
1,061,530 | public static String doGet(String url, Map<String, String> params, Map<String, String> headers) {<NEW_LINE>try {<NEW_LINE>String paramStr = encodingParams(params, DEFAULT_ENCODING);<NEW_LINE>String fullUrl = (paramStr == null) <MASK><NEW_LINE>URL u = new URL(fullUrl);<NEW_LINE>HttpURLConnection conn = (HttpURLConnection) u.openConnection();<NEW_LINE>addHeaders(conn, headers);<NEW_LINE>conn.setRequestMethod("GET");<NEW_LINE>conn.setReadTimeout(READ_TIMEOUT);<NEW_LINE>conn.setConnectTimeout(CONNECT_TIMEOUT);<NEW_LINE>conn.connect();<NEW_LINE>int i = conn.getResponseCode();<NEW_LINE>if (i == HttpURLConnection.HTTP_OK) {<NEW_LINE>return IOUtils.toString(conn.getInputStream(), DEFAULT_ENCODING);<NEW_LINE>} else {<NEW_LINE>InputStream is = conn.getErrorStream();<NEW_LINE>String errorMsg = "response not ok,http status:" + i + ",url:" + url + ",params:" + params;<NEW_LINE>if (is != null) {<NEW_LINE>errorMsg += ",responsed error msg is:" + IOUtils.toString(is, DEFAULT_ENCODING);<NEW_LINE>}<NEW_LINE>throw new RuntimeException(errorMsg);<NEW_LINE>}<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>throw new IllegalArgumentException("url format error.the url is:" + url, e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("connect to " + url + "error.", e);<NEW_LINE>}<NEW_LINE>} | ? url : url + "?" + paramStr; |
951,247 | public static boolean exactlyEqual(final Sketch sketchA, final Sketch sketchB) {<NEW_LINE>// Corner case checks<NEW_LINE>if (sketchA == null || sketchB == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (sketchA == sketchB) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (sketchA.isEmpty() && sketchB.isEmpty()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (sketchA.isEmpty() || sketchB.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final int countA = sketchA.getRetainedEntries(true);<NEW_LINE>final int countB = sketchB.getRetainedEntries(true);<NEW_LINE>// Create the Union<NEW_LINE>final Union union = SetOperation.builder().setNominalEntries(ceilingPowerOf2(countA + countB)).buildUnion();<NEW_LINE>union.union(sketchA);<NEW_LINE>union.union(sketchB);<NEW_LINE>final Sketch unionAB = union.getResult();<NEW_LINE>final long thetaLongUAB = unionAB.getThetaLong();<NEW_LINE>final <MASK><NEW_LINE>final long thetaLongB = sketchB.getThetaLong();<NEW_LINE>final int countUAB = unionAB.getRetainedEntries(true);<NEW_LINE>// Check for identical counts and thetas<NEW_LINE>if (countUAB == countA && countUAB == countB && thetaLongUAB == thetaLongA && thetaLongUAB == thetaLongB) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | long thetaLongA = sketchA.getThetaLong(); |
1,657,804 | private void handleNeedAuthorization(String projectName, String userName, int statusCode, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws IOException {<NEW_LINE>Log.info("[{}] Unauthorized, User '{}' status={} ip={}", projectName, userName, <MASK><NEW_LINE>HttpServletResponse response = servletResponse;<NEW_LINE>response.setContentType("text/plain");<NEW_LINE>response.setHeader("WWW-Authenticate", "Basic realm=\"Git Bridge\"");<NEW_LINE>PrintWriter w = response.getWriter();<NEW_LINE>if (statusCode == 429) {<NEW_LINE>// Rate limit<NEW_LINE>response.setStatus(429);<NEW_LINE>w.println("Rate limit exceeded. Please wait and try again later.");<NEW_LINE>} else {<NEW_LINE>response.setStatus(401);<NEW_LINE>w.println("Please sign in using your email address and Overleaf password.");<NEW_LINE>w.println();<NEW_LINE>w.println("*Note*: if you sign in to Overleaf using another provider, " + "such ");<NEW_LINE>w.println("as Google or Twitter, you need to set a password " + "on your Overleaf ");<NEW_LINE>w.println("account first. " + "Please see https://www.overleaf.com/blog/195 for ");<NEW_LINE>w.println("more information.");<NEW_LINE>}<NEW_LINE>w.close();<NEW_LINE>} | statusCode, servletRequest.getRemoteAddr()); |
943,651 | public void rollbackNicForMigration(final VirtualMachineProfile src, final VirtualMachineProfile dst) {<NEW_LINE>for (final NicProfile nicDst : dst.getNics()) {<NEW_LINE>final NetworkVO network = _networksDao.findById(nicDst.getNetworkId());<NEW_LINE>final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());<NEW_LINE>final NicProfile nicSrc = findNicProfileById(src, nicDst.getId());<NEW_LINE>final ReservationContext src_context = new ReservationContextImpl(nicSrc.<MASK><NEW_LINE>final ReservationContext dst_context = new ReservationContextImpl(nicDst.getReservationId(), null, null);<NEW_LINE>if (guru instanceof NetworkMigrationResponder) {<NEW_LINE>((NetworkMigrationResponder) guru).rollbackMigration(nicDst, network, dst, src_context, dst_context);<NEW_LINE>}<NEW_LINE>if (network.getGuestType() == Network.GuestType.L2 && src.getType() == VirtualMachine.Type.User) {<NEW_LINE>_userVmMgr.setupVmForPvlan(true, dst.getVirtualMachine().getHostId(), nicDst);<NEW_LINE>}<NEW_LINE>final List<Provider> providersToImplement = getNetworkProviders(network.getId());<NEW_LINE>for (final NetworkElement element : networkElements) {<NEW_LINE>if (providersToImplement.contains(element.getProvider())) {<NEW_LINE>if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {<NEW_LINE>throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId());<NEW_LINE>}<NEW_LINE>if (element instanceof NetworkMigrationResponder) {<NEW_LINE>((NetworkMigrationResponder) element).rollbackMigration(nicDst, network, dst, src_context, dst_context);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getReservationId(), null, null); |
116,324 | private TileSet unmarshalTilesetFile(InputStream in, URL file) throws Exception {<NEW_LINE>TileSet set = null;<NEW_LINE>Node tsNode;<NEW_LINE>DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();<NEW_LINE>try {<NEW_LINE>DocumentBuilder builder = factory.newDocumentBuilder();<NEW_LINE>// builder.setErrorHandler(new XMLErrorHandler());<NEW_LINE>Document tsDoc = builder.parse(StreamHelper.buffered(in), ".");<NEW_LINE>URL xmlPathSave = xmlPath;<NEW_LINE>if (file.getPath().contains("/")) {<NEW_LINE>xmlPath = URLHelper.getParent(file);<NEW_LINE>}<NEW_LINE>NodeList tsNodeList = tsDoc.getElementsByTagName("tileset");<NEW_LINE>// There can be only one tileset in a .tsx file.<NEW_LINE>tsNode = tsNodeList.item(0);<NEW_LINE>if (tsNode != null) {<NEW_LINE>set = unmarshalTileset(tsNode, true);<NEW_LINE>set.setSource(file.toString());<NEW_LINE>}<NEW_LINE>xmlPath = xmlPathSave;<NEW_LINE>} catch (SAXException e) {<NEW_LINE>error = "Failed while loading " + file <MASK><NEW_LINE>}<NEW_LINE>return set;<NEW_LINE>} | + ": " + e.getLocalizedMessage(); |
1,071,994 | static ByteBuf encode(ByteBufAllocator allocator, boolean isEmpty, long traceIdHigh, long traceId, boolean extendedTraceId, long spanId, long parentId, boolean includesParent, Flags flag) {<NEW_LINE>int size = 1 + (isEmpty ? 0 : (Long.BYTES + Long.BYTES + (extendedTraceId ? Long.BYTES : 0) + (includesParent ? Long.BYTES : 0)));<NEW_LINE>final ByteBuf <MASK><NEW_LINE>int byteFlags = 0;<NEW_LINE>switch(flag) {<NEW_LINE>case NOT_SAMPLE:<NEW_LINE>byteFlags |= FLAG_NOT_SAMPLED;<NEW_LINE>break;<NEW_LINE>case SAMPLE:<NEW_LINE>byteFlags |= FLAG_SAMPLED;<NEW_LINE>break;<NEW_LINE>case DEBUG:<NEW_LINE>byteFlags |= FLAG_DEBUG;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (isEmpty) {<NEW_LINE>return buffer.writeByte(byteFlags);<NEW_LINE>}<NEW_LINE>byteFlags |= FLAG_IDS_SET;<NEW_LINE>if (extendedTraceId) {<NEW_LINE>byteFlags |= FLAG_EXTENDED_TRACE_ID_SIZE;<NEW_LINE>}<NEW_LINE>if (includesParent) {<NEW_LINE>byteFlags |= FLAG_INCLUDE_PARENT_ID;<NEW_LINE>}<NEW_LINE>buffer.writeByte(byteFlags);<NEW_LINE>if (extendedTraceId) {<NEW_LINE>buffer.writeLong(traceIdHigh);<NEW_LINE>}<NEW_LINE>buffer.writeLong(traceId).writeLong(spanId);<NEW_LINE>if (includesParent) {<NEW_LINE>buffer.writeLong(parentId);<NEW_LINE>}<NEW_LINE>return buffer;<NEW_LINE>} | buffer = allocator.buffer(size); |
793,509 | protected RouteResultset tryMergeBuild() {<NEW_LINE>try {<NEW_LINE>this.needWhereHandler = false;<NEW_LINE>this.canPushDown = !node.existUnPushDownGroup();<NEW_LINE>PushDownVisitor pdVisitor = new PushDownVisitor(node, true);<NEW_LINE>RouteResultset rrs = pdVisitor.buildRouteResultset();<NEW_LINE>SchemaConfig schemaConfig;<NEW_LINE>String schemaName = this.session.getShardingService().getSchema();<NEW_LINE>if (schemaName != null) {<NEW_LINE>schemaConfig = schemaConfigMap.get(schemaName);<NEW_LINE>} else {<NEW_LINE>// random schemaConfig<NEW_LINE>schemaConfig = schemaConfigMap.entrySet().iterator().next().getValue();<NEW_LINE>}<NEW_LINE>MergeBuilder mergeBuilder <MASK><NEW_LINE>// maybe some node is view<NEW_LINE>if (node.getAst() != null && node.getParent() == null) {<NEW_LINE>// it's root<NEW_LINE>rrs = mergeBuilder.constructByStatement(rrs, node.getAst(), schemaConfig);<NEW_LINE>} else {<NEW_LINE>SQLStatementParser parser = new MySqlStatementParser(rrs.getSrcStatement());<NEW_LINE>SQLSelectStatement select = (SQLSelectStatement) parser.parseStatement();<NEW_LINE>return mergeBuilder.constructByStatement(rrs, select, schemaConfig);<NEW_LINE>}<NEW_LINE>return rrs;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new MySQLOutPutException(ErrorCode.ER_QUERYHANDLER, "", "join node mergebuild exception! Error:" + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | = new MergeBuilder(session, node); |
1,225,853 | public static QueryOrganizationWorkspaceListResponse unmarshall(QueryOrganizationWorkspaceListResponse queryOrganizationWorkspaceListResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryOrganizationWorkspaceListResponse.setRequestId(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.RequestId"));<NEW_LINE>queryOrganizationWorkspaceListResponse.setSuccess(_ctx.booleanValue("QueryOrganizationWorkspaceListResponse.Success"));<NEW_LINE>Result result = new Result();<NEW_LINE>result.setTotalPages(_ctx.integerValue("QueryOrganizationWorkspaceListResponse.Result.TotalPages"));<NEW_LINE>result.setPageNum(_ctx.integerValue("QueryOrganizationWorkspaceListResponse.Result.PageNum"));<NEW_LINE>result.setPageSize(_ctx.integerValue("QueryOrganizationWorkspaceListResponse.Result.PageSize"));<NEW_LINE>result.setTotalNum<MASK><NEW_LINE>List<DataItem> data = new ArrayList<DataItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryOrganizationWorkspaceListResponse.Result.Data.Length"); i++) {<NEW_LINE>DataItem dataItem = new DataItem();<NEW_LINE>dataItem.setCreateUserAccountName(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].CreateUserAccountName"));<NEW_LINE>dataItem.setOwner(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].Owner"));<NEW_LINE>dataItem.setCreateTime(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].CreateTime"));<NEW_LINE>dataItem.setWorkspaceName(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].WorkspaceName"));<NEW_LINE>dataItem.setOrganizationId(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].OrganizationId"));<NEW_LINE>dataItem.setWorkspaceId(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].WorkspaceId"));<NEW_LINE>dataItem.setAllowShareOperation(_ctx.booleanValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].AllowShareOperation"));<NEW_LINE>dataItem.setCreateUser(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].CreateUser"));<NEW_LINE>dataItem.setModifiedTime(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].ModifiedTime"));<NEW_LINE>dataItem.setWorkspaceDescription(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].WorkspaceDescription"));<NEW_LINE>dataItem.setModifyUser(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].ModifyUser"));<NEW_LINE>dataItem.setAllowPublishOperation(_ctx.booleanValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].AllowPublishOperation"));<NEW_LINE>dataItem.setOwnerAccountName(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].OwnerAccountName"));<NEW_LINE>dataItem.setModifyUserAccountName(_ctx.stringValue("QueryOrganizationWorkspaceListResponse.Result.Data[" + i + "].ModifyUserAccountName"));<NEW_LINE>data.add(dataItem);<NEW_LINE>}<NEW_LINE>result.setData(data);<NEW_LINE>queryOrganizationWorkspaceListResponse.setResult(result);<NEW_LINE>return queryOrganizationWorkspaceListResponse;<NEW_LINE>} | (_ctx.integerValue("QueryOrganizationWorkspaceListResponse.Result.TotalNum")); |
678,322 | private void loadNode426() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, new QualifiedName(0, "OutputArguments"), new LocalizedText("en", "OutputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Argument, 1, new UInteger[] { org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger.valueOf(0) }, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, Identifiers.HasProperty, Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks<MASK><NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<ListOfExtensionObject xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\"><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>FileHandle</Name><DataType><Identifier>i=7</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject>");<NEW_LINE>String xml = sb.toString();<NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));<NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new DataValue(new Variant(o));<NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), false)); |
407,420 | public void add(int index, Dependency dependency) {<NEW_LINE>if (index > size() || index < 0) {<NEW_LINE>throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size());<NEW_LINE>}<NEW_LINE>int elementIndex = index;<NEW_LINE>if (index > 0) {<NEW_LINE>Element previousElement = ((JDomDependency) get(index - 1)).getJDomElement();<NEW_LINE>elementIndex = 1 + getElementIndex(previousElement, jdomElement);<NEW_LINE>}<NEW_LINE>if (jdomElement.getParent() == null) {<NEW_LINE>addElement(jdomElement, parent.getJDomElement());<NEW_LINE>}<NEW_LINE>if (parent instanceof JDomDependencyManagement) {<NEW_LINE>if (parent.getJDomElement().getParent() == null) {<NEW_LINE>addElement(this.parent.getJDomElement(), ((JDomDependencyManagement) parent).<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>JDomDependency jdomDependency;<NEW_LINE>if (dependency instanceof JDomDependency) {<NEW_LINE>jdomDependency = (JDomDependency) dependency;<NEW_LINE>addElement(jdomDependency.getJDomElement().clone(), jdomElement, elementIndex);<NEW_LINE>} else {<NEW_LINE>Element newElement = insertNewElement(POM_ELEMENT_DEPENDENCY, jdomElement, elementIndex);<NEW_LINE>jdomDependency = new JDomDependency(newElement, dependency);<NEW_LINE>}<NEW_LINE>super.add(index, jdomDependency);<NEW_LINE>} | getParent().getJDomElement()); |
1,382,838 | final ContinueDeploymentResult executeContinueDeployment(ContinueDeploymentRequest continueDeploymentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(continueDeploymentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ContinueDeploymentRequest> request = null;<NEW_LINE>Response<ContinueDeploymentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ContinueDeploymentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(continueDeploymentRequest));<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, "CodeDeploy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ContinueDeployment");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ContinueDeploymentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ContinueDeploymentResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,798,131 | public static Map<String, Object> checkResourceIdBypolicyName(String esUrl, Map<String, Object> mustFilter) throws Exception {<NEW_LINE>JsonParser jsonParser = new JsonParser();<NEW_LINE>Map<String, Object> mustNotFilter = new HashMap<>();<NEW_LINE>HashMultimap<String, Object> shouldFilter = HashMultimap.create();<NEW_LINE>Map<String, Object> mustTermsFilter = new HashMap<>();<NEW_LINE>Map<String, Object> secMap = new HashMap<>();<NEW_LINE>JsonObject resultJson = RulesElasticSearchRepositoryUtil.getQueryDetailsFromES(esUrl, mustFilter, mustNotFilter, shouldFilter, null, 0, mustTermsFilter, null, null);<NEW_LINE>if (resultJson != null && resultJson.has(PacmanRuleConstants.HITS)) {<NEW_LINE>String hitsJsonString = resultJson.get(PacmanRuleConstants.HITS).toString();<NEW_LINE>JsonObject hitsJson = (JsonObject) jsonParser.parse(hitsJsonString);<NEW_LINE>JsonArray jsonArray = hitsJson.getAsJsonObject().get(PacmanRuleConstants.HITS).getAsJsonArray();<NEW_LINE>if (jsonArray.size() > 0) {<NEW_LINE>for (int i = 0; i < jsonArray.size(); i++) {<NEW_LINE>JsonObject firstObject = (JsonObject) jsonArray.get(i);<NEW_LINE>JsonObject sourceJson = (JsonObject) firstObject.get(PacmanRuleConstants.SOURCE);<NEW_LINE>if (null != sourceJson) {<NEW_LINE>JsonObject recomendationJson = (JsonObject) sourceJson.get(PacmanRuleConstants.RECOMMENDATION);<NEW_LINE>if ((null != recomendationJson.get(PacmanRuleConstants.RESOURCEID)) && (!recomendationJson.get(PacmanRuleConstants.RESOURCEID).isJsonNull())) {<NEW_LINE>secMap.put(PacmanRuleConstants.RESOURCEID, recomendationJson.get(PacmanRuleConstants<MASK><NEW_LINE>if (null != recomendationJson.get(PacmanRuleConstants.DETAILS)) {<NEW_LINE>JsonObject detailJson = (JsonObject) sourceJson.get(PacmanRuleConstants.RECOMMENDATION);<NEW_LINE>secMap.put(PacmanRuleConstants.DETAILS, detailJson.get(PacmanRuleConstants.DETAILS));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return secMap;<NEW_LINE>} | .RESOURCEID).getAsString()); |
378,100 | private void resetSymbols() {<NEW_LINE>synchronized (values) {<NEW_LINE>values.clear();<NEW_LINE>Map<String, SymbolDef> stringSymbolDefMap = SymbolDefTable.getInstance().GetAllSymbolDefs(RendererSettings.getInstance().getSymbologyStandard());<NEW_LINE>for (SymbolDef def : stringSymbolDefMap.values()) {<NEW_LINE>SimpleSymbol from = SimpleSymbol.createFrom(def);<NEW_LINE>if (from.canDraw())<NEW_LINE>values.add<MASK><NEW_LINE>}<NEW_LINE>Map<String, UnitDef> allUnitDefs = UnitDefTable.getInstance().getAllUnitDefs(RendererSettings.getInstance().getSymbologyStandard());<NEW_LINE>for (UnitDef def : allUnitDefs.values()) {<NEW_LINE>SimpleSymbol from = SimpleSymbol.createFrom(def);<NEW_LINE>if (from.canDraw())<NEW_LINE>values.add(from);<NEW_LINE>}<NEW_LINE>Collections.sort(values, this);<NEW_LINE>}<NEW_LINE>} | (SimpleSymbol.createFrom(def)); |
284,487 | final GetCoipPoolUsageResult executeGetCoipPoolUsage(GetCoipPoolUsageRequest getCoipPoolUsageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCoipPoolUsageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCoipPoolUsageRequest> request = null;<NEW_LINE>Response<GetCoipPoolUsageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCoipPoolUsageRequestMarshaller().marshall(super.beforeMarshalling(getCoipPoolUsageRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetCoipPoolUsage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetCoipPoolUsageResult> responseHandler = new StaxResponseHandler<GetCoipPoolUsageResult>(new GetCoipPoolUsageResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,736,381 | public void simulateFull(boolean isFull) throws ObjectManagerException {<NEW_LINE>final String methodName = "simulateFull";<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.entry(this, cclass, methodName, new Object[] { new Boolean(isFull) });<NEW_LINE>if (isFull) {<NEW_LINE>// Clear as much space as we can.<NEW_LINE>objectManagerState.waitForCheckpoint(true);<NEW_LINE>// Reserve all of the available space.<NEW_LINE>synchronized (this) {<NEW_LINE>long available = storeFileSizeAllocated - storeFileSizeUsed - directoryReservedSize - reservedSize.get();<NEW_LINE>long newReservedSize = reservedSize<MASK><NEW_LINE>simulateFullReservedSize = simulateFullReservedSize + available;<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())<NEW_LINE>trace.debug(this, cclass, methodName, new Object[] { "isFull:834", new Long(available), new Long(newReservedSize), new Long(simulateFullReservedSize) });<NEW_LINE>}<NEW_LINE>// synchronized (this).<NEW_LINE>} else {<NEW_LINE>synchronized (this) {<NEW_LINE>reservedSize.addAndGet((int) -simulateFullReservedSize);<NEW_LINE>simulateFullReservedSize = 0;<NEW_LINE>}<NEW_LINE>// synchronized (this).<NEW_LINE>objectManagerState.waitForCheckpoint(true);<NEW_LINE>}<NEW_LINE>// if (isFull).<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, methodName, new Object[] { new Long(simulateFullReservedSize) });<NEW_LINE>} | .addAndGet((int) available); |
1,687,654 | public static GetEditingProjectMaterialsResponse unmarshall(GetEditingProjectMaterialsResponse getEditingProjectMaterialsResponse, UnmarshallerContext _ctx) {<NEW_LINE>getEditingProjectMaterialsResponse.setRequestId(_ctx.stringValue("GetEditingProjectMaterialsResponse.RequestId"));<NEW_LINE>List<Material> materialList = new ArrayList<Material>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetEditingProjectMaterialsResponse.MaterialList.Length"); i++) {<NEW_LINE>Material material = new Material();<NEW_LINE>material.setMaterialId(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].MaterialId"));<NEW_LINE>material.setTitle(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Title"));<NEW_LINE>material.setTags(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Tags"));<NEW_LINE>material.setStatus(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Status"));<NEW_LINE>material.setSize(_ctx.longValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Size"));<NEW_LINE>material.setDuration(_ctx.floatValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Duration"));<NEW_LINE>material.setDescription(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Description"));<NEW_LINE>material.setCreationTime(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CreationTime"));<NEW_LINE>material.setModifiedTime(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].ModifiedTime"));<NEW_LINE>material.setCoverURL(_ctx.stringValue<MASK><NEW_LINE>material.setCateId(_ctx.integerValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CateId"));<NEW_LINE>material.setCateName(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CateName"));<NEW_LINE>material.setSource(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Source"));<NEW_LINE>material.setSpriteConfig(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].SpriteConfig"));<NEW_LINE>material.setMaterialType(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].MaterialType"));<NEW_LINE>List<String> snapshots = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Snapshots.Length"); j++) {<NEW_LINE>snapshots.add(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Snapshots[" + j + "]"));<NEW_LINE>}<NEW_LINE>material.setSnapshots(snapshots);<NEW_LINE>List<String> sprites = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Sprites.Length"); j++) {<NEW_LINE>sprites.add(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Sprites[" + j + "]"));<NEW_LINE>}<NEW_LINE>material.setSprites(sprites);<NEW_LINE>materialList.add(material);<NEW_LINE>}<NEW_LINE>getEditingProjectMaterialsResponse.setMaterialList(materialList);<NEW_LINE>return getEditingProjectMaterialsResponse;<NEW_LINE>} | ("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CoverURL")); |
1,356,863 | static void testGrams(Path root, Path test, String labelTarget, String name) throws IOException {<NEW_LINE>Path modelPath = root.resolve(name + ".model");<NEW_LINE>Path predictions = root.resolve(name + ".predictions");<NEW_LINE>FastTextClassifier classifier = FastTextClassifier.load(modelPath);<NEW_LINE>try (PrintWriter pw = new PrintWriter(predictions.toFile(), "utf-8")) {<NEW_LINE>List<String> all = Files.readAllLines(test);<NEW_LINE>for (String s : all) {<NEW_LINE>List<String> tokens = Splitter.on<MASK><NEW_LINE>List<String> rest = tokens.subList(1, tokens.size());<NEW_LINE>List<String> grams = getGrams(rest, 7);<NEW_LINE>List<Hit> hits = new ArrayList<>();<NEW_LINE>for (String gram : grams) {<NEW_LINE>List<ScoredItem<String>> res = classifier.predict(gram, 2);<NEW_LINE>for (ScoredItem<String> re : res) {<NEW_LINE>float p = (float) Math.exp(re.score);<NEW_LINE>if (re.item.equals(labelTarget) && p > 0.45) {<NEW_LINE>hits.add(new Hit(gram, re));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>pw.println(s);<NEW_LINE>for (Hit hit : hits) {<NEW_LINE>pw.println(hit);<NEW_LINE>}<NEW_LINE>pw.println("-----------------------");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (" ").splitToList(s); |
1,583,026 | void onOk() {<NEW_LINE>searchCriteria.onOk();<NEW_LINE>final FindDialogMemory memory = FindDialogMemory.getDefault();<NEW_LINE>if (searchCriteria.isTextPatternUsable()) {<NEW_LINE>SearchHistory.getDefault().add(getCurrentSearchPattern());<NEW_LINE>memory.setTextPatternSpecified(true);<NEW_LINE>} else {<NEW_LINE>memory.setTextPatternSpecified(false);<NEW_LINE>}<NEW_LINE>if (searchCriteria.isFileNamePatternUsable()) {<NEW_LINE>memory.storeFileNamePattern(searchCriteria.getFileNamePatternExpr());<NEW_LINE>memory.setFileNamePatternSpecified(true);<NEW_LINE>} else {<NEW_LINE>memory.setFileNamePatternSpecified(false);<NEW_LINE>}<NEW_LINE>if (replacementPatternEditor != null) {<NEW_LINE>String replaceText = replacementPatternEditor.getText();<NEW_LINE>SearchHistory.getDefault().addReplace(ReplacePattern.create(replaceText, chkPreserveCase.isSelected()));<NEW_LINE>FindDialogMemory.getDefault().setReplacePatternSpecified(replaceText != null && !replaceText.isEmpty());<NEW_LINE>}<NEW_LINE>memory.setWholeWords(chkWholeWords.isSelected());<NEW_LINE>memory.setCaseSensitive(chkCaseSensitive.isSelected());<NEW_LINE>memory.setMatchType(textToFindType.getSelectedMatchType());<NEW_LINE>if (searchCriteria.isSearchAndReplace()) {<NEW_LINE>memory.<MASK><NEW_LINE>} else {<NEW_LINE>memory.setSearchInArchives(scopeSettingsPanel.isSearchInArchives());<NEW_LINE>if (!searchInGeneratedSetAutomatically) {<NEW_LINE>memory.setSearchInGenerated(scopeSettingsPanel.isSearchInGenerated());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>memory.setFilePathRegex(scopeSettingsPanel.isFileNameRegExp());<NEW_LINE>memory.setUseIgnoreList(scopeSettingsPanel.isUseIgnoreList());<NEW_LINE>if (cboxScope.getSelectedScopeId() != null && !SearchPanel.isOpenedForSelection()) {<NEW_LINE>memory.setScopeTypeId(cboxScope.getSelectedScopeId());<NEW_LINE>}<NEW_LINE>} | setPreserveCase(chkPreserveCase.isSelected()); |
1,046,553 | private static boolean isValidExecutor(KeycloakSession session, ClientPolicyExecutorRepresentation executorRep) {<NEW_LINE>String executorProviderId = executorRep.getExecutorProviderId();<NEW_LINE>Set<String> providerSet = session.listProviderIds(ClientPolicyExecutorProvider.class);<NEW_LINE>if (providerSet != null && providerSet.contains(executorProviderId)) {<NEW_LINE>if (Objects.nonNull(session.getContext().getRealm())) {<NEW_LINE>ClientPolicyExecutorProvider provider = getExecutorProvider(session, session.getContext().getRealm(), <MASK><NEW_LINE>ClientPolicyExecutorConfigurationRepresentation configuration = (ClientPolicyExecutorConfigurationRepresentation) JsonSerialization.mapper.convertValue(executorRep.getConfiguration(), provider.getExecutorConfigurationClass());<NEW_LINE>return configuration.validateConfig();<NEW_LINE>} else {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.warnv("no executor provider found. providerId = {0}", executorProviderId);<NEW_LINE>return false;<NEW_LINE>} | executorProviderId, executorRep.getConfiguration()); |
193,317 | public void fullRedraw() {<NEW_LINE>makeLayerElement();<NEW_LINE>// addCSSClasses();<NEW_LINE>SilhouettePlot silhouettesplot = silhouette.getSilhouettePlot(context);<NEW_LINE>String ploturi = silhouettesplot.getSVGPlotURI();<NEW_LINE>Element itag = svgp.svgElement(SVGConstants.SVG_IMAGE_TAG);<NEW_LINE>SVGUtil.setAtt(itag, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, SVGConstants.SVG_NONE_VALUE);<NEW_LINE>SVGUtil.setAtt(itag, SVGConstants.SVG_IMAGE_RENDERING_ATTRIBUTE, SVGConstants.SVG_OPTIMIZE_SPEED_VALUE);<NEW_LINE>SVGUtil.setAtt(<MASK><NEW_LINE>SVGUtil.setAtt(itag, SVGConstants.SVG_Y_ATTRIBUTE, 0);<NEW_LINE>SVGUtil.setAtt(itag, SVGConstants.SVG_WIDTH_ATTRIBUTE, plotwidth);<NEW_LINE>SVGUtil.setAtt(itag, SVGConstants.SVG_HEIGHT_ATTRIBUTE, plotheight);<NEW_LINE>itag.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_QNAME, ploturi);<NEW_LINE>layer.appendChild(itag);<NEW_LINE>LinearScale scale = silhouettesplot.getScale();<NEW_LINE>double y1 = plotheight * silhouettesplot.scaleToPixel(scale.getMin()) / silhouettesplot.getHeight();<NEW_LINE>double y2 = plotheight * silhouettesplot.scaleToPixel(scale.getMax()) / silhouettesplot.getHeight();<NEW_LINE>double y3 = plotheight * silhouettesplot.scaleToPixel(0) / (silhouettesplot.getHeight() - 1);<NEW_LINE>// -1 because in testing the line was a bit off in the thumbnail.<NEW_LINE>try {<NEW_LINE>final StyleLibrary style = context.getStyleLibrary();<NEW_LINE>SVGSimpleLinearAxis.drawAxis(svgp, layer, scale, 0, y1, 0, y2, SVGSimpleLinearAxis.LabelStyle.LEFTHAND, style);<NEW_LINE>SVGSimpleLinearAxis.drawAxis(svgp, layer, scale, plotwidth, y1, plotwidth, y2, SVGSimpleLinearAxis.LabelStyle.RIGHTHAND, style);<NEW_LINE>SVGSimpleLinearAxis.drawAxis(svgp, layer, scale, 0, y3, plotwidth, y3, SVGSimpleLinearAxis.LabelStyle.NOTHING, style);<NEW_LINE>} catch (CSSNamingConflict e) {<NEW_LINE>LoggingUtil.exception("CSS naming conflict for axes on Silhouette plot", e);<NEW_LINE>}<NEW_LINE>} | itag, SVGConstants.SVG_X_ATTRIBUTE, 0); |
1,658,083 | protected void installApkFiles(ApkSource aApkSource) {<NEW_LINE>cleanOldSessions();<NEW_LINE>PackageInstaller.Session session = null;<NEW_LINE>try (ApkSource apkSource = aApkSource) {<NEW_LINE>PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);<NEW_LINE>sessionParams.setInstallLocation(PreferencesHelper.getInstance(getContext()).getInstallLocation());<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)<NEW_LINE><MASK><NEW_LINE>int sessionID = mPackageInstaller.createSession(sessionParams);<NEW_LINE>mSessionsMap.put(sessionID, getOngoingInstallation().getId());<NEW_LINE>session = mPackageInstaller.openSession(sessionID);<NEW_LINE>int currentApkFile = 0;<NEW_LINE>while (apkSource.nextApk()) {<NEW_LINE>try (InputStream inputStream = apkSource.openApkInputStream();<NEW_LINE>OutputStream outputStream = session.openWrite(String.format("%d.apk", currentApkFile++), 0, apkSource.getApkLength())) {<NEW_LINE>IOUtils.copyStream(inputStream, outputStream);<NEW_LINE>session.fsync(outputStream);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Intent callbackIntent = new Intent(getContext(), RootlessSAIPIService.class);<NEW_LINE>PendingIntent pendingIntent = PendingIntent.getService(getContext(), 0, callbackIntent, 0);<NEW_LINE>session.commit(pendingIntent.getIntentSender());<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>dispatchCurrentSessionUpdate(InstallationStatus.INSTALLATION_FAILED, getContext().getString(R.string.installer_error_rootless, Utils.throwableToString(e)));<NEW_LINE>installationCompleted();<NEW_LINE>} finally {<NEW_LINE>if (session != null)<NEW_LINE>session.close();<NEW_LINE>}<NEW_LINE>} | sessionParams.setInstallReason(PackageManager.INSTALL_REASON_USER); |
371,485 | public synchronized boolean isAllSegmentsLoaded() {<NEW_LINE>if (_allSegmentsLoaded) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>PropertyKey.Builder keyBuilder = dataAccessor.keyBuilder();<NEW_LINE>IdealState idealState = dataAccessor.getProperty(keyBuilder.idealStates(_tableNameWithType));<NEW_LINE>if (idealState == null) {<NEW_LINE>LOGGER.warn("Failed to find ideal state for table: {}", _tableNameWithType);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String instanceName = _helixManager.getInstanceName();<NEW_LINE>LiveInstance liveInstance = dataAccessor.getProperty(keyBuilder.liveInstance(instanceName));<NEW_LINE>if (liveInstance == null) {<NEW_LINE>LOGGER.warn("Failed to find live instance for instance: {}", instanceName);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String sessionId = liveInstance.getEphemeralOwner();<NEW_LINE>CurrentState currentState = dataAccessor.getProperty(keyBuilder.currentState(instanceName, sessionId, _tableNameWithType));<NEW_LINE>if (currentState == null) {<NEW_LINE>LOGGER.warn("Failed to find current state for instance: {}, sessionId: {}, table: {}", instanceName, sessionId, _tableNameWithType);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Check if ideal state and current state matches for all segments assigned to the current instance<NEW_LINE>Map<String, Map<String, String>> idealStatesMap = idealState.getRecord().getMapFields();<NEW_LINE>Map<String, String> currentStateMap = currentState.getPartitionStateMap();<NEW_LINE>for (Map.Entry<String, Map<String, String>> entry : idealStatesMap.entrySet()) {<NEW_LINE>String segmentName = entry.getKey();<NEW_LINE>Map<String, String> instanceStateMap = entry.getValue();<NEW_LINE>String expectedState = instanceStateMap.get(instanceName);<NEW_LINE>// Only track ONLINE segments assigned to the current instance<NEW_LINE>if (!SegmentStateModel.ONLINE.equals(expectedState)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String actualState = currentStateMap.get(segmentName);<NEW_LINE>if (!SegmentStateModel.ONLINE.equals(actualState)) {<NEW_LINE>if (SegmentStateModel.ERROR.equals(actualState)) {<NEW_LINE>LOGGER.error("Find ERROR segment: {}, table: {}, expected: {}", segmentName, _tableNameWithType, expectedState);<NEW_LINE>} else {<NEW_LINE>LOGGER.info("Find unloaded segment: {}, table: {}, expected: {}, actual: {}", segmentName, _tableNameWithType, expectedState, actualState);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOGGER.info("All segments loaded for table: {}", _tableNameWithType);<NEW_LINE>_allSegmentsLoaded = true;<NEW_LINE>return true;<NEW_LINE>} | HelixDataAccessor dataAccessor = _helixManager.getHelixDataAccessor(); |
1,357,291 | public void addTags(Map<String, String> tagsMap, PartialPath fullPath, IMeasurementMNode leafMNode) throws MetadataException, IOException {<NEW_LINE>Pair<Map<String, String>, Map<String, String>> pair = tagLogFile.read(config.getTagAttributeTotalSize(), leafMNode.getOffset());<NEW_LINE>for (Map.Entry<String, String> entry : tagsMap.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE>String value = entry.getValue();<NEW_LINE>if (pair.left.containsKey(key)) {<NEW_LINE>throw new MetadataException(String.format("TimeSeries [%s] already has the tag [%s].", fullPath, key));<NEW_LINE>}<NEW_LINE>pair.<MASK><NEW_LINE>}<NEW_LINE>// persist the change to disk<NEW_LINE>tagLogFile.write(pair.left, pair.right, leafMNode.getOffset());<NEW_LINE>// update tag inverted map<NEW_LINE>addIndex(tagsMap, leafMNode);<NEW_LINE>} | left.put(key, value); |
1,157,673 | // entry of processing replace table<NEW_LINE>private void processReplaceTable(Database db, OlapTable origTable, List<AlterClause> alterClauses) throws UserException {<NEW_LINE>ReplaceTableClause clause = (<MASK><NEW_LINE>String newTblName = clause.getTblName();<NEW_LINE>boolean swapTable = clause.isSwapTable();<NEW_LINE>db.writeLockOrDdlException();<NEW_LINE>try {<NEW_LINE>Table newTbl = db.getTableOrMetaException(newTblName, TableType.OLAP);<NEW_LINE>OlapTable olapNewTbl = (OlapTable) newTbl;<NEW_LINE>List<Table> tableList = Lists.newArrayList(origTable, newTbl);<NEW_LINE>tableList.sort((Comparator.comparing(Table::getId)));<NEW_LINE>MetaLockUtils.writeLockTablesOrMetaException(tableList);<NEW_LINE>try {<NEW_LINE>String oldTblName = origTable.getName();<NEW_LINE>// First, we need to check whether the table to be operated on can be renamed<NEW_LINE>olapNewTbl.checkAndSetName(oldTblName, true);<NEW_LINE>if (swapTable) {<NEW_LINE>origTable.checkAndSetName(newTblName, true);<NEW_LINE>}<NEW_LINE>replaceTableInternal(db, origTable, olapNewTbl, swapTable, false);<NEW_LINE>// write edit log<NEW_LINE>ReplaceTableOperationLog log = new ReplaceTableOperationLog(db.getId(), origTable.getId(), olapNewTbl.getId(), swapTable);<NEW_LINE>Catalog.getCurrentCatalog().getEditLog().logReplaceTable(log);<NEW_LINE>LOG.info("finish replacing table {} with table {}, is swap: {}", oldTblName, newTblName, swapTable);<NEW_LINE>} finally {<NEW_LINE>MetaLockUtils.writeUnlockTables(tableList);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>db.writeUnlock();<NEW_LINE>}<NEW_LINE>} | ReplaceTableClause) alterClauses.get(0); |
1,303,839 | public static String normalize(String str) {<NEW_LINE>if (str == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>StringBuilder sb = null;<NEW_LINE>boolean inWhitespace = false;<NEW_LINE>char c = '\0';<NEW_LINE>boolean special = false;<NEW_LINE>for (int i = 0; i < str.length(); ++i) {<NEW_LINE>c = str.charAt(i);<NEW_LINE>if (UCharacter.isWhitespace(c)) {<NEW_LINE>if (sb == null && (inWhitespace || c != ' ')) {<NEW_LINE>sb = new StringBuilder(str<MASK><NEW_LINE>}<NEW_LINE>if (inWhitespace) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>inWhitespace = true;<NEW_LINE>special = false;<NEW_LINE>c = ' ';<NEW_LINE>} else {<NEW_LINE>inWhitespace = false;<NEW_LINE>special = c == '<' || c == '&';<NEW_LINE>if (special && sb == null) {<NEW_LINE>sb = new StringBuilder(str.substring(0, i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sb != null) {<NEW_LINE>if (special) {<NEW_LINE>sb.append(c == '<' ? "<" : "&");<NEW_LINE>} else {<NEW_LINE>sb.append(c);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sb != null) {<NEW_LINE>return sb.toString();<NEW_LINE>}<NEW_LINE>return str;<NEW_LINE>} | .substring(0, i)); |
866,046 | public ChannelFlowCallbackResult channelFlowCallback(ChannelFlowCallbackRequest channelFlowCallbackRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(channelFlowCallbackRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ChannelFlowCallbackRequest> request = null;<NEW_LINE>Response<ChannelFlowCallbackResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ChannelFlowCallbackRequestMarshaller().marshall(channelFlowCallbackRequest);<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<ChannelFlowCallbackResult, JsonUnmarshallerContext> unmarshaller = new ChannelFlowCallbackResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<ChannelFlowCallbackResult> responseHandler = new JsonResponseHandler<ChannelFlowCallbackResult>(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(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
658,455 | public static FeedbackResponseCommentAttributes valueOf(FeedbackResponseComment comment) {<NEW_LINE>FeedbackResponseCommentAttributes frca = new FeedbackResponseCommentAttributes();<NEW_LINE>frca.courseId = comment.getCourseId();<NEW_LINE>frca.feedbackSessionName = comment.getFeedbackSessionName();<NEW_LINE>frca.commentGiver = comment.getGiverEmail();<NEW_LINE>frca.commentText = comment.getCommentText();<NEW_LINE>frca.feedbackResponseId = comment.getFeedbackResponseId();<NEW_LINE>frca<MASK><NEW_LINE>if (comment.getShowCommentTo() != null) {<NEW_LINE>frca.showCommentTo = new ArrayList<>(comment.getShowCommentTo());<NEW_LINE>}<NEW_LINE>if (comment.getShowGiverNameTo() != null) {<NEW_LINE>frca.showGiverNameTo = new ArrayList<>(comment.getShowGiverNameTo());<NEW_LINE>}<NEW_LINE>frca.isVisibilityFollowingFeedbackQuestion = comment.getIsVisibilityFollowingFeedbackQuestion();<NEW_LINE>if (comment.getCreatedAt() != null) {<NEW_LINE>frca.createdAt = comment.getCreatedAt();<NEW_LINE>}<NEW_LINE>if (comment.getLastEditorEmail() == null) {<NEW_LINE>frca.lastEditorEmail = frca.getCommentGiver();<NEW_LINE>} else {<NEW_LINE>frca.lastEditorEmail = comment.getLastEditorEmail();<NEW_LINE>}<NEW_LINE>if (comment.getLastEditedAt() == null) {<NEW_LINE>frca.lastEditedAt = frca.getCreatedAt();<NEW_LINE>} else {<NEW_LINE>frca.lastEditedAt = comment.getLastEditedAt();<NEW_LINE>}<NEW_LINE>frca.feedbackResponseCommentId = comment.getFeedbackResponseCommentId();<NEW_LINE>if (comment.getGiverSection() != null) {<NEW_LINE>frca.giverSection = comment.getGiverSection();<NEW_LINE>}<NEW_LINE>if (comment.getReceiverSection() != null) {<NEW_LINE>frca.receiverSection = comment.getReceiverSection();<NEW_LINE>}<NEW_LINE>frca.commentGiverType = comment.getCommentGiverType();<NEW_LINE>frca.isCommentFromFeedbackParticipant = comment.getIsCommentFromFeedbackParticipant();<NEW_LINE>return frca;<NEW_LINE>} | .feedbackQuestionId = comment.getFeedbackQuestionId(); |
632,763 | private List<VirtualRouterOfferingInventory> findOfferingByGuestL3Network(L3NetworkInventory guestL3) {<NEW_LINE>String sql = "select offering from VirtualRouterOfferingVO offering, SystemTagVO stag where " + "offering.uuid = stag.resourceUuid and stag.resourceType = :type and offering.zoneUuid = :zoneUuid and stag.tag = :tag and offering.state = :state";<NEW_LINE>TypedQuery<VirtualRouterOfferingVO> q = dbf.getEntityManager().createQuery(sql, VirtualRouterOfferingVO.class);<NEW_LINE>q.setParameter("type", InstanceOfferingVO.class.getSimpleName());<NEW_LINE>q.setParameter("zoneUuid", guestL3.getZoneUuid());<NEW_LINE>q.setParameter("tag", VirtualRouterSystemTags.VR_OFFERING_GUEST_NETWORK.instantiateTag(map(e(VirtualRouterSystemTags.VR_OFFERING_GUEST_NETWORK_TOKEN, guestL3.getUuid()))));<NEW_LINE>q.setParameter("state", InstanceOfferingState.Enabled);<NEW_LINE>List<VirtualRouterOfferingVO> vos = q.getResultList();<NEW_LINE>if (!vos.isEmpty()) {<NEW_LINE>return VirtualRouterOfferingInventory.valueOf1(vos);<NEW_LINE>}<NEW_LINE>List<String> offeringUuids = VirtualRouterSystemTags.VIRTUAL_ROUTER_OFFERING.getTokensOfTagsByResourceUuid(guestL3.getUuid()).stream().map(tokens -> tokens.get(VirtualRouterSystemTags.VIRTUAL_ROUTER_OFFERING_TOKEN)).collect(Collectors.toList());<NEW_LINE>if (!offeringUuids.isEmpty()) {<NEW_LINE>return VirtualRouterOfferingInventory.valueOf1(Q.New(VirtualRouterOfferingVO.class).in(VirtualRouterOfferingVO_.uuid, offeringUuids).eq(VirtualRouterOfferingVO_.state, InstanceOfferingState.Enabled).list());<NEW_LINE>}<NEW_LINE>sql = "select offering from VirtualRouterOfferingVO offering where offering.zoneUuid = :zoneUuid and offering.state = :state";<NEW_LINE>q = dbf.getEntityManager().createQuery(sql, VirtualRouterOfferingVO.class);<NEW_LINE>q.setParameter("zoneUuid", guestL3.getZoneUuid());<NEW_LINE>q.setParameter("state", InstanceOfferingState.Enabled);<NEW_LINE>vos = q.getResultList();<NEW_LINE>return vos.isEmpty() ? <MASK><NEW_LINE>} | null : VirtualRouterOfferingInventory.valueOf1(vos); |
1,021,174 | final GetComponentResult executeGetComponent(GetComponentRequest getComponentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getComponentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetComponentRequest> request = null;<NEW_LINE>Response<GetComponentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetComponentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getComponentRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetComponent");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetComponentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetComponentResultJsonUnmarshaller());<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.SERVICE_ID, "AmplifyUIBuilder"); |
696,889 | private CompletableFuture<Void> startJobIfNotStartedOrCompleted(@Nonnull JobRecord jobRecord, @Nonnull JobExecutionRecord jobExecutionRecord, String reason) {<NEW_LINE>// the order of operations is important.<NEW_LINE>long jobId = jobRecord.getJobId();<NEW_LINE>MasterContext masterContext;<NEW_LINE>MasterContext oldMasterContext;<NEW_LINE>synchronized (lock) {<NEW_LINE>// We check the JobResult while holding the lock to avoid this scenario:<NEW_LINE>// 1. We find no job result<NEW_LINE>// 2. Another thread creates the result and removes the master context in completeJob<NEW_LINE>// 3. We re-create the master context below<NEW_LINE>JobResult <MASK><NEW_LINE>if (jobResult != null) {<NEW_LINE>logger.fine("Not starting job " + idToString(jobId) + ", already has result: " + jobResult);<NEW_LINE>return jobResult.asCompletableFuture();<NEW_LINE>}<NEW_LINE>checkOperationalState();<NEW_LINE>masterContext = createMasterContext(jobRecord, jobExecutionRecord);<NEW_LINE>oldMasterContext = masterContexts.putIfAbsent(jobId, masterContext);<NEW_LINE>}<NEW_LINE>if (oldMasterContext != null) {<NEW_LINE>return oldMasterContext.jobContext().jobCompletionFuture();<NEW_LINE>}<NEW_LINE>assert jobRepository.getJobResult(jobId) == null : "jobResult should not exist at this point";<NEW_LINE>if (finalizeJobIfAutoScalingOff(masterContext)) {<NEW_LINE>return masterContext.jobContext().jobCompletionFuture();<NEW_LINE>}<NEW_LINE>if (jobExecutionRecord.isSuspended()) {<NEW_LINE>logFinest(logger, "MasterContext for suspended %s is created", masterContext.jobIdString());<NEW_LINE>} else {<NEW_LINE>logger.info("Starting job " + idToString(jobId) + ": " + reason);<NEW_LINE>tryStartJob(masterContext);<NEW_LINE>}<NEW_LINE>return masterContext.jobContext().jobCompletionFuture();<NEW_LINE>} | jobResult = jobRepository.getJobResult(jobId); |
1,024,758 | private boolean checkEdgeCount(SquareGrid grid) {<NEW_LINE>int left = 0, right = grid.columns - 1;<NEW_LINE>int top = 0, bottom = grid.rows - 1;<NEW_LINE>for (int row = 0; row < grid.rows; row++) {<NEW_LINE>boolean skip = grid.get(row, 0) == null;<NEW_LINE>for (int col = 0; col < grid.columns; col++) {<NEW_LINE>SquareNode n = <MASK><NEW_LINE>if (skip) {<NEW_LINE>if (n != null)<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>boolean horizontalEdge = col == left || col == right;<NEW_LINE>boolean verticalEdge = row == top || row == bottom;<NEW_LINE>boolean outer = horizontalEdge || verticalEdge;<NEW_LINE>int connections = n.getNumberOfConnections();<NEW_LINE>if (outer) {<NEW_LINE>if (horizontalEdge && verticalEdge) {<NEW_LINE>if (connections != 1)<NEW_LINE>return false;<NEW_LINE>} else if (connections != 2)<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>if (connections != 4)<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>skip = !skip;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | grid.get(row, col); |
68,001 | // Infer the time period covered by the transit feed<NEW_LINE>public void updateTransitFeedValidity(CalendarServiceData data, DataImportIssueStore issueStore) {<NEW_LINE>long now = new Date().getTime() / 1000;<NEW_LINE>final <MASK><NEW_LINE>HashSet<String> agenciesWithFutureDates = new HashSet<>();<NEW_LINE>HashSet<String> agencies = new HashSet<>();<NEW_LINE>for (FeedScopedId sid : data.getServiceIds()) {<NEW_LINE>agencies.add(sid.getFeedId());<NEW_LINE>for (ServiceDate sd : data.getServiceDatesForServiceId(sid)) {<NEW_LINE>// Adjust for timezone, assuming there is only one per graph.<NEW_LINE>long t = sd.getAsDate(getTimeZone()).getTime() / 1000;<NEW_LINE>if (t > now) {<NEW_LINE>agenciesWithFutureDates.add(sid.getFeedId());<NEW_LINE>}<NEW_LINE>// assume feed is unreliable after midnight on last service day<NEW_LINE>long u = t + SEC_IN_DAY;<NEW_LINE>if (t < this.transitServiceStarts) {<NEW_LINE>this.transitServiceStarts = t;<NEW_LINE>}<NEW_LINE>if (u > this.transitServiceEnds) {<NEW_LINE>this.transitServiceEnds = u;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String agency : agencies) {<NEW_LINE>if (!agenciesWithFutureDates.contains(agency)) {<NEW_LINE>issueStore.add(new NoFutureDates(agency));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | long SEC_IN_DAY = 24 * 60 * 60; |
1,124,218 | // XXX should be moved into the GeneratorUtils:<NEW_LINE>private static BlockTree createDefaultMethodBody(WorkingCopy wc, TreePath targetTree, TypeMirror returnType, String name) {<NEW_LINE>TreeUtilities tu = wc.getTreeUtilities();<NEW_LINE>TypeElement targetClazz = (TypeElement) wc.getTrees().getElement(targetTree);<NEW_LINE>// NOI18N<NEW_LINE>StatementTree st = tu.parseStatement("{class ${abstract " + (returnType != null ? returnType.toString() : "void") + " " + ("<init>".equals(name) ? targetClazz.getSimpleName() : name) + <MASK><NEW_LINE>Trees trees = wc.getTrees();<NEW_LINE>List<? extends Tree> members = ((ClassTree) targetTree.getLeaf()).getMembers();<NEW_LINE>Scope scope = members.isEmpty() ? trees.getScope(targetTree) : trees.getScope(new TreePath(targetTree, members.get(0)));<NEW_LINE>tu.attributeTree(st, scope);<NEW_LINE>Tree first = null;<NEW_LINE>for (Tree t : ((ClassTree) ((BlockTree) st).getStatements().get(0)).getMembers()) {<NEW_LINE>if (t.getKind() == Tree.Kind.METHOD && !"<init>".contentEquals(((MethodTree) t).getName())) {<NEW_LINE>// NOI19N<NEW_LINE>first = t;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ExecutableElement ee = (ExecutableElement) wc.getTrees().getElement(new TreePath(targetTree, first));<NEW_LINE>return GeneratorUtilities.get(wc).createAbstractMethodImplementation(targetClazz, ee).getBody();<NEW_LINE>} | "();}}", new SourcePositions[1]); |
1,265,068 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@name('s0') select longPrimitive as c0, sum(intPrimitive) as c1 " + "from SupportBean group by rollup(case when longPrimitive > 0 then 1 else 0 end)";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>env.assertStatement("s0", statement -> assertEquals(Long.class, statement.getEventType(<MASK><NEW_LINE>String[] fields = "c0,c1".split(",");<NEW_LINE>env.sendEventBean(makeEvent("E1", 1, 10));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { 10L, 1 }, { null, 1 } });<NEW_LINE>env.sendEventBean(makeEvent("E2", 2, 11));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { 11L, 3 }, { null, 3 } });<NEW_LINE>env.sendEventBean(makeEvent("E3", 5, -10));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { -10L, 5 }, { null, 8 } });<NEW_LINE>env.sendEventBean(makeEvent("E4", 6, -11));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { -11L, 11 }, { null, 14 } });<NEW_LINE>env.sendEventBean(makeEvent("E5", 3, 12));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { 12L, 6 }, { null, 17 } });<NEW_LINE>env.undeployAll();<NEW_LINE>} | ).getPropertyType("c0"))); |
551,014 | protected <T> boolean match(int bid, SequenceMatcher.MatchedStates<T> matchedStates, boolean consume, State prevState) {<NEW_LINE>// Try to match previous node/nodes exactly<NEW_LINE>if (consume) {<NEW_LINE>// First element is group that is matched, second is number of nodes matched so far<NEW_LINE>Pair<SequenceMatcher.MatchedGroup, Integer> backRefState = (Pair<SequenceMatcher.MatchedGroup, Integer>) matchedStates.getBranchStates().getMatchStateInfo(bid, this);<NEW_LINE>if (backRefState == null) {<NEW_LINE>// Haven't tried to match this node before, try now<NEW_LINE>// Get element and return if it matched or not<NEW_LINE>SequenceMatcher.MatchedGroup matchedGroup = matchedStates.getBranchStates().getMatchedGroup(bid, captureGroupId);<NEW_LINE>if (matchedGroup != null) {<NEW_LINE>// See if the first node matches<NEW_LINE>if (matchedGroup.matchEnd > matchedGroup.matchBegin) {<NEW_LINE>boolean matched = match(<MASK><NEW_LINE>return matched;<NEW_LINE>} else {<NEW_LINE>// TODO: Check handling of previous nodes that are zero elements?<NEW_LINE>return super.match(bid, matchedStates, consume, prevState);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>SequenceMatcher.MatchedGroup matchedGroup = backRefState.first();<NEW_LINE>int matchedNodes = backRefState.second();<NEW_LINE>boolean matched = match(bid, matchedStates, matchedGroup, matchedNodes);<NEW_LINE>return matched;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Not consuming, just add this state back to list of states to be processed<NEW_LINE>matchedStates.addState(bid, this);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | bid, matchedStates, matchedGroup, 0); |
1,476,985 | private static BuildInfo readBuildPropertiesClass(Class<?> clazz, BuildInfo upstreamBuildInfo, Overrides overrides) {<NEW_LINE>String version = readStaticStringField(clazz, "VERSION");<NEW_LINE>String build = readStaticStringField(clazz, "BUILD");<NEW_LINE>String revision = readStaticStringField(clazz, "REVISION");<NEW_LINE>String <MASK><NEW_LINE>String commitId = readStaticStringField(clazz, "COMMIT_ID");<NEW_LINE>revision = checkMissingExpressionValue(revision, "${git.commit.id.abbrev}");<NEW_LINE>commitId = checkMissingExpressionValue(commitId, "${git.commit.id}");<NEW_LINE>int buildNumber = Integer.parseInt(build);<NEW_LINE>boolean enterprise = !"Hazelcast".equals(distribution);<NEW_LINE>String serialVersionString = readStaticStringField(clazz, "SERIALIZATION_VERSION");<NEW_LINE>byte serialVersion = Byte.parseByte(serialVersionString);<NEW_LINE>return overrides.apply(version, build, revision, buildNumber, enterprise, serialVersion, commitId, upstreamBuildInfo);<NEW_LINE>} | distribution = readStaticStringField(clazz, "DISTRIBUTION"); |
1,505,721 | public List<ThreadObjectData> retrieveThreadList(int objHash, Server server) {<NEW_LINE>List<ThreadObjectData> dataList = new ArrayList<>();<NEW_LINE>try (TcpProxy tcp = TcpProxy.getTcpProxy(server)) {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put(ParamConstant.OBJ_HASH, objHash);<NEW_LINE>MapPack mapPack = (MapPack) tcp.getSingle(RequestCmd.OBJECT_THREAD_LIST, param);<NEW_LINE>List<String> threadKeys = Arrays.asList("id", "name", "stat", "cpu", "txid", "elapsed", "service");<NEW_LINE>Map<String, ListValue> <MASK><NEW_LINE>threadKeys.forEach(key -> {<NEW_LINE>threadObjectMap.put(key, mapPack.getList(key));<NEW_LINE>});<NEW_LINE>int count = 0;<NEW_LINE>if (threadObjectMap.containsKey("id")) {<NEW_LINE>count = threadObjectMap.get("id").size();<NEW_LINE>}<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>dataList.add(new ThreadObjectData(threadObjectMap, i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return dataList;<NEW_LINE>} | threadObjectMap = new HashMap<>(); |
1,045,271 | public static RelNode optimizeByMysqlImpl(RelNode rel) {<NEW_LINE>HepProgramBuilder builder = new HepProgramBuilder();<NEW_LINE>builder.addMatchOrder(HepMatchOrder.BOTTOM_UP);<NEW_LINE>builder.addGroupBegin();<NEW_LINE>builder.addRuleInstance(MysqlTableScanRule.FILTER_TABLESCAN);<NEW_LINE>builder.addGroupEnd();<NEW_LINE>builder.addMatchOrder(HepMatchOrder.BOTTOM_UP);<NEW_LINE>builder.addGroupBegin();<NEW_LINE>builder.addRuleInstance(MysqlTableScanRule.TABLESCAN);<NEW_LINE>builder.addGroupEnd();<NEW_LINE>builder.addMatchOrder(HepMatchOrder.BOTTOM_UP);<NEW_LINE>builder.addGroupBegin();<NEW_LINE>builder.addRuleInstance(JoinToMultiJoinRule.INSTANCE);<NEW_LINE>builder.addGroupEnd();<NEW_LINE>builder.addMatchOrder(HepMatchOrder.BOTTOM_UP);<NEW_LINE>builder.addGroupBegin();<NEW_LINE>builder.addRuleInstance(MysqlMultiJoinToLogicalJoinRule.INSTANCE);<NEW_LINE>builder.addGroupEnd();<NEW_LINE>builder.addMatchOrder(HepMatchOrder.BOTTOM_UP);<NEW_LINE>builder.addGroupBegin();<NEW_LINE>builder.addRuleInstance(MysqlJoinRule.INSTANCE);<NEW_LINE>builder.addRuleInstance(MysqlSemiJoinRule.INSTANCE);<NEW_LINE>builder.addRuleInstance(MysqlSortRule.INSTANCE);<NEW_LINE>builder.addRuleInstance(MysqlAggRule.INSTANCE);<NEW_LINE><MASK><NEW_LINE>builder.addGroupEnd();<NEW_LINE>HepPlanner planner = new HepPlanner(builder.build());<NEW_LINE>planner.stopOptimizerTrace();<NEW_LINE>planner.setRoot(rel);<NEW_LINE>PlannerContext plannerContext = PlannerContext.getPlannerContext(rel);<NEW_LINE>plannerContext.setMysqlJoinReorderFirstTable(recommendTableForMysqlJoinReorder(rel));<NEW_LINE>RelNode output = planner.findBestExp();<NEW_LINE>// clear<NEW_LINE>plannerContext.setMysqlJoinReorderFirstTable(null);<NEW_LINE>return output;<NEW_LINE>} | builder.addRuleInstance(MysqlCorrelateRule.INSTANCE); |
1,613,307 | public void disableSGR(SGR sgr) throws IOException {<NEW_LINE>switch(sgr) {<NEW_LINE>case BLINK:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '5', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case BOLD:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '2', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case BORDERED:<NEW_LINE>writeCSISequenceToTerminal((byte) '5', (byte<MASK><NEW_LINE>break;<NEW_LINE>case CIRCLED:<NEW_LINE>writeCSISequenceToTerminal((byte) '5', (byte) '4', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case CROSSED_OUT:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '9', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case FRAKTUR:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '3', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case REVERSE:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '7', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case UNDERLINE:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '4', (byte) 'm');<NEW_LINE>break;<NEW_LINE>case ITALIC:<NEW_LINE>writeCSISequenceToTerminal((byte) '2', (byte) '3', (byte) 'm');<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | ) '4', (byte) 'm'); |
232,258 | public void updateCarNavigation() {<NEW_LINE>OsmandApplication app = getApp();<NEW_LINE>RoutingHelper routingHelper = app.getRoutingHelper();<NEW_LINE>TripHelper tripHelper = this.tripHelper;<NEW_LINE>if (carNavigationActive && tripHelper != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) {<NEW_LINE>NavigationSession carNavigationSession = app.getCarNavigationSession();<NEW_LINE>if (carNavigationSession != null) {<NEW_LINE>NavigationScreen navigationScreen = carNavigationSession.getNavigationScreen();<NEW_LINE>if (navigationScreen != null) {<NEW_LINE>float density = navigationScreen<MASK><NEW_LINE>if (density == 0) {<NEW_LINE>density = 1;<NEW_LINE>}<NEW_LINE>Trip trip = tripHelper.buildTrip(density);<NEW_LINE>navigationManager.updateTrip(trip);<NEW_LINE>List<Destination> destinations = null;<NEW_LINE>Destination destination = tripHelper.getLastDestination();<NEW_LINE>TravelEstimate destinationTravelEstimate = tripHelper.getLastDestinationTravelEstimate();<NEW_LINE>if (destination != null) {<NEW_LINE>destinations = Collections.singletonList(destination);<NEW_LINE>}<NEW_LINE>TravelEstimate lastStepTravelEstimate = tripHelper.getLastStepTravelEstimate();<NEW_LINE>navigationScreen.updateTrip(true, routingHelper.isRouteBeingCalculated(), false, /*routingHelper.isRouteWasFinished()*/<NEW_LINE>destinations, trip.getSteps(), destinationTravelEstimate, lastStepTravelEstimate != null ? lastStepTravelEstimate.getRemainingDistance() : null, false, true, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getSurfaceRenderer().getDensity(); |
1,239,272 | public static double[][] inverse(double[][] matrix) {<NEW_LINE>double[][] inverse = new double[matrix.length][matrix.length];<NEW_LINE>// minors and cofactors<NEW_LINE>for (int i = 0; i < matrix.length; i++) {<NEW_LINE>for (int j = 0; j < matrix[i].length; j++) {<NEW_LINE>inverse[i][j] = Math.pow(-1, i + j) * determinant(minor(matrix, i, j));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// adjugate and determinant<NEW_LINE>double det = 1.0 / determinant(matrix);<NEW_LINE>for (int i = 0; i < inverse.length; i++) {<NEW_LINE>for (int j = 0; j <= i; j++) {<NEW_LINE>double temp = inverse[i][j];<NEW_LINE>inverse[i][j] = inverse<MASK><NEW_LINE>inverse[j][i] = temp * det;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return inverse;<NEW_LINE>} | [j][i] * det; |
871,852 | public static void main(String[] args) throws Exception {<NEW_LINE>File clientConfig = File.createTempFile("client", ".xml");<NEW_LINE>System.out.println("Created temporary file: " + clientConfig);<NEW_LINE>if (!clientConfig.exists()) {<NEW_LINE>throw new Exception("Failed to create tmp file");<NEW_LINE>}<NEW_LINE>ClientConfiguration client = new ClientConfiguration();<NEW_LINE>client.getLogging().setTraceSpecification("*=info=enabled:com.ibm.ws.session*=all=enabled");<NEW_LINE>BasicRegistry registry = client.getBasicRegistries().getOrCreateById("BasicRealm", BasicRegistry.class);<NEW_LINE>registry.setRealm(registry.getId());<NEW_LINE>BasicRegistry.User user1 = registry.getUsers().getOrCreateById("user1", BasicRegistry.User.class);<NEW_LINE>user1.setName(user1.getId());<NEW_LINE>user1.setPassword("security");<NEW_LINE>Application application = new Application();<NEW_LINE>application.setId("appName");<NEW_LINE>application.setName(application.getId());<NEW_LINE>application.setType("ear");<NEW_LINE>application.setLocation("C:/some/path/on/my/machine/app.ear");<NEW_LINE>SecurityRole role = application.getApplicationBnd().getSecurityRoles().getOrCreateById("securityRole", SecurityRole.class);<NEW_LINE>role.setName(role.getId());<NEW_LINE>SpecialSubject specialSubject = role.getSpecialSubjects().getOrCreateById("specialSubject", SpecialSubject.class);<NEW_LINE>specialSubject.set(SpecialSubject.Type.ALL_AUTHENTICATED_USERS);<NEW_LINE>client.getApplications().add(application);<NEW_LINE>ClientConfigurationFactory scf = ClientConfigurationFactory.getInstance();<NEW_LINE>scf.marshal(client, clientConfig);<NEW_LINE>// call private variable to avoid calling System.out!<NEW_LINE>scf.marshaller.<MASK><NEW_LINE>ClientConfiguration unmarshalled = scf.unmarshal(new FileInputStream(clientConfig));<NEW_LINE>// call private variable to avoid calling System.out!<NEW_LINE>scf.marshaller.marshal(unmarshalled, System.out);<NEW_LINE>if (!clientConfig.delete()) {<NEW_LINE>throw new Exception("Failed to delete tmp file");<NEW_LINE>}<NEW_LINE>System.out.println("Deleted " + clientConfig);<NEW_LINE>System.out.println("All tests passed");<NEW_LINE>} | marshal(client, System.out); |
1,443,922 | private void load() {<NEW_LINE>Log.d(TAG, "load()");<NEW_LINE>if (webViewLoader != null) {<NEW_LINE>webViewLoader.dispose();<NEW_LINE>}<NEW_LINE>webViewLoader = Maybe.<String>create(emitter -> {<NEW_LINE>Playable media = controller.getMedia();<NEW_LINE>if (media == null) {<NEW_LINE>emitter.onComplete();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (media instanceof FeedMedia) {<NEW_LINE>FeedMedia feedMedia = ((FeedMedia) media);<NEW_LINE>if (feedMedia.getItem() == null) {<NEW_LINE>feedMedia.setItem(DBReader.getFeedItem(feedMedia.getItemId()));<NEW_LINE>}<NEW_LINE>DBReader.loadDescriptionOfFeedItem(feedMedia.getItem());<NEW_LINE>}<NEW_LINE>Timeline timeline = new Timeline(getActivity(), media.getDescription(), media.getDuration());<NEW_LINE>emitter.onSuccess(timeline.processShownotes());<NEW_LINE>}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(data -> {<NEW_LINE>webvDescription.loadDataWithBaseURL("https://127.0.0.1", data, "text/html", "utf-8", "about:blank");<NEW_LINE>Log.d(TAG, "Webview loaded");<NEW_LINE>}, error -> Log.e(TAG, <MASK><NEW_LINE>} | Log.getStackTraceString(error))); |
199,808 | private void runOrBufferActionItem(ActionItem actionItem) throws IOException {<NEW_LINE>WriteState curState = writeState.get();<NEW_LINE>// TODO: Liberty currently needs to check isReady() BEFORE doing the write, as it puts context on the<NEW_LINE>// thread during that call. We should get rid of that requirement.<NEW_LINE>if (curState.readyAndEmpty && outputStream.isReady()) {<NEW_LINE>// write to the outputStream directly<NEW_LINE>actionItem.run();<NEW_LINE>if (!outputStream.isReady()) {<NEW_LINE>logger.log(FINEST, "[{0}] the servlet output stream becomes not ready", logId);<NEW_LINE>boolean successful = writeState.compareAndSet(curState<MASK><NEW_LINE>assert successful;<NEW_LINE>LockSupport.unpark(parkingThread);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// buffer to the writeChain<NEW_LINE>writeChain.offer(actionItem);<NEW_LINE>if (!writeState.compareAndSet(curState, curState.newItemBuffered())) {<NEW_LINE>// state changed by another thread (onWritePossible)<NEW_LINE>assert writeState.get().readyAndEmpty;<NEW_LINE>ActionItem lastItem = writeChain.poll();<NEW_LINE>if (lastItem != null) {<NEW_LINE>assert lastItem == actionItem;<NEW_LINE>runOrBufferActionItem(lastItem);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// state has not changed since<NEW_LINE>}<NEW_LINE>} | , curState.withReadyAndEmpty(false)); |
817,158 | public void removeEdgeInternal(final OrientEdge edge) {<NEW_LINE>// OUT VERTEX<NEW_LINE>final OIdentifiable inVertexEdge = edge.vIn != null ? edge.vIn : edge.rawElement;<NEW_LINE>final String edgeClassName = OrientBaseGraph.encodeClassName(edge.getLabel());<NEW_LINE>final boolean useVertexFieldsForEdgeLabels = settings.isUseVertexFieldsForEdgeLabels();<NEW_LINE>final OIdentifiable outVertex = edge.getOutVertex();<NEW_LINE>ODocument outVertexRecord = null;<NEW_LINE>boolean outVertexChanged = false;<NEW_LINE>if (outVertex != null) {<NEW_LINE>outVertexRecord = outVertex.getRecord();<NEW_LINE>if (outVertexRecord != null) {<NEW_LINE>final String outFieldName = OrientVertex.getConnectionFieldName(Direction.OUT, edgeClassName, useVertexFieldsForEdgeLabels);<NEW_LINE>outVertexChanged = edge.dropEdgeFromVertex(inVertexEdge, outVertexRecord, outFieldName, outVertexRecord.field(outFieldName));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// IN VERTEX<NEW_LINE>final OIdentifiable outVertexEdge = edge.vOut != null ? edge.vOut : edge.rawElement;<NEW_LINE>final OIdentifiable inVertex = edge.getInVertex();<NEW_LINE>ODocument inVertexRecord = null;<NEW_LINE>boolean inVertexChanged = false;<NEW_LINE>if (inVertex != null) {<NEW_LINE>inVertexRecord = inVertex.getRecord();<NEW_LINE>if (inVertexRecord != null) {<NEW_LINE>final String inFieldName = OrientVertex.getConnectionFieldName(Direction.IN, edgeClassName, useVertexFieldsForEdgeLabels);<NEW_LINE>inVertexChanged = edge.dropEdgeFromVertex(outVertexEdge, inVertexRecord, inFieldName<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (outVertexChanged)<NEW_LINE>outVertexRecord.save();<NEW_LINE>if (inVertexChanged)<NEW_LINE>inVertexRecord.save();<NEW_LINE>if (edge.rawElement != null)<NEW_LINE>// NON-LIGHTWEIGHT EDGE<NEW_LINE>edge.removeRecord();<NEW_LINE>} | , inVertexRecord.field(inFieldName)); |
623,687 | public static MethodOutcome process2xxResponse(FhirContext theContext, int theResponseStatusCode, String theResponseMimeType, InputStream theResponseReader, Map<String, List<String>> theHeaders) {<NEW_LINE>List<String> locationHeaders = new ArrayList<>();<NEW_LINE>List<String> lh = <MASK><NEW_LINE>if (lh != null) {<NEW_LINE>locationHeaders.addAll(lh);<NEW_LINE>}<NEW_LINE>List<String> clh = theHeaders.get(Constants.HEADER_CONTENT_LOCATION_LC);<NEW_LINE>if (clh != null) {<NEW_LINE>locationHeaders.addAll(clh);<NEW_LINE>}<NEW_LINE>MethodOutcome retVal = new MethodOutcome();<NEW_LINE>if (locationHeaders.size() > 0) {<NEW_LINE>String locationHeader = locationHeaders.get(0);<NEW_LINE>BaseOutcomeReturningMethodBinding.parseContentLocation(theContext, retVal, locationHeader);<NEW_LINE>}<NEW_LINE>if (theResponseStatusCode != Constants.STATUS_HTTP_204_NO_CONTENT) {<NEW_LINE>EncodingEnum ct = EncodingEnum.forContentType(theResponseMimeType);<NEW_LINE>if (ct != null) {<NEW_LINE>PushbackInputStream reader = new PushbackInputStream(theResponseReader);<NEW_LINE>try {<NEW_LINE>int firstByte = reader.read();<NEW_LINE>if (firstByte == -1) {<NEW_LINE>BaseOutcomeReturningMethodBinding.ourLog.debug("No content in response, not going to read");<NEW_LINE>reader = null;<NEW_LINE>} else {<NEW_LINE>reader.unread(firstByte);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>BaseOutcomeReturningMethodBinding.ourLog.debug("No content in response, not going to read", e);<NEW_LINE>reader = null;<NEW_LINE>}<NEW_LINE>if (reader != null) {<NEW_LINE>IParser parser = ct.newParser(theContext);<NEW_LINE>IBaseResource outcome = parser.parseResource(reader);<NEW_LINE>if (outcome instanceof IBaseOperationOutcome) {<NEW_LINE>retVal.setOperationOutcome((IBaseOperationOutcome) outcome);<NEW_LINE>} else {<NEW_LINE>retVal.setResource(outcome);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>BaseOutcomeReturningMethodBinding.ourLog.debug("Ignoring response content of type: {}", theResponseMimeType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | theHeaders.get(Constants.HEADER_LOCATION_LC); |
976,710 | public void build() {<NEW_LINE>List<Parameter> listEncrypt = new ArrayList<>();<NEW_LINE>add(new LabelParameterImpl("ConfigView.section.connection.encryption.encrypt.info"), listEncrypt);<NEW_LINE>add(new HyperlinkParameterImpl("ConfigView.section.connection.encryption.encrypt.info.link", Wiki.AVOID_TRAFFIC_SHAPING), listEncrypt);<NEW_LINE>BooleanParameterImpl paramEncryptRequire = new BooleanParameterImpl(BCFG_NETWORK_TRANSPORT_ENCRYPTED_REQUIRE, "ConfigView.section.connection.encryption.require_encrypted_transport");<NEW_LINE>add(paramEncryptRequire, listEncrypt);<NEW_LINE>String[] encryption_types = { "Plain", "RC4" };<NEW_LINE>String[] dropLabels = new String[encryption_types.length];<NEW_LINE>String[] dropValues = new String[encryption_types.length];<NEW_LINE>for (int i = 0; i < encryption_types.length; i++) {<NEW_LINE>dropLabels[i] = encryption_types[i];<NEW_LINE>dropValues[i] = encryption_types[i];<NEW_LINE>}<NEW_LINE>StringListParameterImpl paramMinLevel = new StringListParameterImpl(SCFG_NETWORK_TRANSPORT_ENCRYPTED_MIN_LEVEL, "ConfigView.section.connection.encryption.min_encryption_level", dropLabels, dropValues);<NEW_LINE>add(paramMinLevel, listEncrypt);<NEW_LINE>LabelParameterImpl paramFallBackInfo = new LabelParameterImpl("ConfigView.section.connection.encryption.encrypt.fallback_info");<NEW_LINE>add(paramFallBackInfo, listEncrypt);<NEW_LINE>BooleanParameterImpl paramFallbackOutgoing = new BooleanParameterImpl(BCFG_NETWORK_TRANSPORT_ENCRYPTED_FALLBACK_OUTGOING, "ConfigView.section.connection.encryption.encrypt.fallback_outgoing");<NEW_LINE>add(paramFallbackOutgoing, listEncrypt);<NEW_LINE>BooleanParameterImpl paramFallbackIncoming = new BooleanParameterImpl(BCFG_NETWORK_TRANSPORT_ENCRYPTED_FALLBACK_INCOMING, "ConfigView.section.connection.encryption.encrypt.fallback_incoming");<NEW_LINE>add(paramFallbackIncoming, listEncrypt);<NEW_LINE>BooleanParameterImpl paramUseCryptoPort = new BooleanParameterImpl(BCFG_NETWORK_TRANSPORT_ENCRYPTED_USE_CRYPTO_PORT, "ConfigView.section.connection.encryption.use_crypto_port");<NEW_LINE>add(paramUseCryptoPort, listEncrypt);<NEW_LINE>final Parameter[] ap_controls = { paramMinLevel, paramFallBackInfo, paramFallbackOutgoing, paramFallbackIncoming };<NEW_LINE>ParameterListener iap = param -> {<NEW_LINE>boolean required = paramEncryptRequire.getValue();<NEW_LINE>boolean ucp_enabled = <MASK><NEW_LINE>paramUseCryptoPort.setEnabled(ucp_enabled);<NEW_LINE>for (Parameter requireParams : ap_controls) {<NEW_LINE>requireParams.setEnabled(required);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>paramFallbackIncoming.addListener(iap);<NEW_LINE>paramEncryptRequire.addListener(iap);<NEW_LINE>iap.parameterChanged(null);<NEW_LINE>add(new ParameterGroupImpl("ConfigView.section.connection.encryption.encrypt.group", listEncrypt));<NEW_LINE>} | !paramFallbackIncoming.getValue() && required; |
1,351,674 | public void validateReferences(Version indexVersionCreated, Function<String, MappedFieldType> fieldResolver) {<NEW_LINE>if (fieldName != null) {<NEW_LINE>MappedFieldType mappedFieldType = fieldResolver.apply(fieldName);<NEW_LINE>if (mappedFieldType == null) {<NEW_LINE>if (indexVersionCreated.before(Version.V_7_0_0)) {<NEW_LINE>deprecationLogger.warn(DeprecationCategory.MAPPINGS, "geo_context_mapping", "field [{}] referenced in context [{}] is not defined in the mapping", fieldName, name);<NEW_LINE>} else {<NEW_LINE>throw new ElasticsearchParseException("field [{}] referenced in context [{}] is not defined in the mapping", fieldName, name);<NEW_LINE>}<NEW_LINE>} else if (GeoPointFieldMapper.CONTENT_TYPE.equals(mappedFieldType.typeName()) == false) {<NEW_LINE>if (indexVersionCreated.before(Version.V_7_0_0)) {<NEW_LINE>deprecationLogger.warn(DeprecationCategory.MAPPINGS, "geo_context_mapping", "field [{}] referenced in context [{}] must be mapped to geo_point, found [{}]", fieldName, name, mappedFieldType.typeName());<NEW_LINE>} else {<NEW_LINE>throw new ElasticsearchParseException("field [{}] referenced in context [{}] must be mapped to geo_point, found [{}]", fieldName, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | name, mappedFieldType.typeName()); |
1,075,045 | protected void assemble(Level world, BlockPos pos, AbstractMinecart cart) {<NEW_LINE>if (!cart.getPassengers().isEmpty())<NEW_LINE>return;<NEW_LINE>LazyOptional<MinecartController> optional = cart.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY);<NEW_LINE>if (optional.isPresent() && optional.orElse(null).isCoupledThroughContraption())<NEW_LINE>return;<NEW_LINE>CartMovementMode mode = CartMovementMode.values()[movementMode.value];<NEW_LINE>MountedContraption contraption = new MountedContraption(mode);<NEW_LINE>try {<NEW_LINE>if (!contraption.assemble(world, pos))<NEW_LINE>return;<NEW_LINE>lastException = null;<NEW_LINE>sendData();<NEW_LINE>} catch (AssemblyException e) {<NEW_LINE>lastException = e;<NEW_LINE>sendData();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean couplingFound = contraption.connectedCart != null;<NEW_LINE>Direction initialOrientation = CartAssemblerBlock.getHorizontalDirection(getBlockState());<NEW_LINE>if (couplingFound) {<NEW_LINE>cart.setPos(pos.getX() + .5f, pos.getY(), pos.getZ() + .5f);<NEW_LINE>if (!CouplingHandler.tryToCoupleCarts(null, world, cart.getId(), contraption.connectedCart.getId()))<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>contraption.removeBlocksFromWorld(world, BlockPos.ZERO);<NEW_LINE>contraption.startMoving(world);<NEW_LINE>contraption.expandBoundsAroundAxis(Axis.Y);<NEW_LINE>if (couplingFound) {<NEW_LINE>Vec3 diff = contraption.connectedCart.position().subtract(cart.position());<NEW_LINE>initialOrientation = Direction.fromYRot(Mth.atan2(diff.z, diff.x) * 180 / Math.PI);<NEW_LINE>}<NEW_LINE>OrientedContraptionEntity entity = OrientedContraptionEntity.create(world, contraption, initialOrientation);<NEW_LINE>if (couplingFound)<NEW_LINE>entity.setCouplingId(cart.getUUID());<NEW_LINE>entity.setPos(pos.getX(), pos.getY(), pos.getZ());<NEW_LINE>world.addFreshEntity(entity);<NEW_LINE>entity.startRiding(cart);<NEW_LINE>if (cart instanceof MinecartFurnace) {<NEW_LINE>CompoundTag nbt = cart.serializeNBT();<NEW_LINE>nbt.putDouble("PushZ", 0);<NEW_LINE><MASK><NEW_LINE>cart.deserializeNBT(nbt);<NEW_LINE>}<NEW_LINE>} | nbt.putDouble("PushX", 0); |
1,317,076 | public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {<NEW_LINE>Animator backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.playbackControlsFragment.getView(<MASK><NEW_LINE>Animator statusBarAnimator = ViewUtil.createBackgroundColorTransition(fragment.playerStatusBar, fragment.lastColor, newColor);<NEW_LINE>AnimatorSet animatorSet = new AnimatorSet();<NEW_LINE>animatorSet.playTogether(backgroundAnimator, statusBarAnimator);<NEW_LINE>if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {<NEW_LINE>int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;<NEW_LINE>int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;<NEW_LINE>Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);<NEW_LINE>animatorSet.play(subHeaderAnimator);<NEW_LINE>}<NEW_LINE>animatorSet.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);<NEW_LINE>return animatorSet;<NEW_LINE>} | ), fragment.lastColor, newColor); |
1,621,010 | public Pair<Collection, List<NewEnvironemtKey>> importCollection(String content, List<Environment> environments) throws IOException {<NEW_LINE>SwaggerParseResult res = new OpenAPIV3Parser().readContents(content);<NEW_LINE><MASK><NEW_LINE>LinkedList<RequestContainer> requests = new LinkedList<>();<NEW_LINE>LinkedList<Folder> folders = new LinkedList<>();<NEW_LINE>LinkedList<NewEnvironemtKey> newEnvironemtKeys = new LinkedList<>();<NEW_LINE>int idx = 0;<NEW_LINE>for (Server server : spec.getServers()) {<NEW_LINE>String serverId = toServerId(server, spec, idx);<NEW_LINE>newEnvironemtKeys.add(new NewEnvironemtKey("", serverId, server.getUrl()));<NEW_LINE>idx++;<NEW_LINE>}<NEW_LINE>String host = newEnvironemtKeys.stream().findAny().map(k -> "{{" + k.getKeyName() + "}}").orElse("http://localhost:8080");<NEW_LINE>spec.getPaths().entrySet().stream().map(p -> toRequests(host, p.getKey(), p.getValue())).forEach(requests::addAll);<NEW_LINE>Collection collection = new Collection(UUID.randomUUID().toString(), spec.getInfo().getTitle(), false, requests, folders);<NEW_LINE>return Pair.of(collection, newEnvironemtKeys);<NEW_LINE>} | OpenAPI spec = res.getOpenAPI(); |
56,398 | private void marshal(APIGetPortForwardingAttachableVmNicsReply msg) {<NEW_LINE>if (msg.getInventories().isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<String> nicUuids = msg.getInventories().stream().map(VmNicInventory::getUuid).collect(Collectors.toList());<NEW_LINE>String sql = "select nic.uuid from VmNicVO nic where nic.uuid in (:nicUuids)" + " and nic.vmInstanceUuid not in (select vm.uuid from VmNicVO n, VmInstanceVO vm, EipVO eip where n.vmInstanceUuid = vm.uuid" + " and n.uuid = eip.vmNicUuid)";<NEW_LINE>TypedQuery<String> q = dbf.getEntityManager().createQuery(sql, String.class);<NEW_LINE>q.setParameter("nicUuids", nicUuids);<NEW_LINE>List<String<MASK><NEW_LINE>msg.setInventories(msg.getInventories().stream().filter(n -> uuids.contains(n.getUuid())).collect(Collectors.toList()));<NEW_LINE>} | > uuids = q.getResultList(); |
910,476 | public UpgradeElasticsearchDomainResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpgradeElasticsearchDomainResult upgradeElasticsearchDomainResult = new UpgradeElasticsearchDomainResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return upgradeElasticsearchDomainResult;<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("DomainName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>upgradeElasticsearchDomainResult.setDomainName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("TargetVersion", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>upgradeElasticsearchDomainResult.setTargetVersion(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("PerformCheckOnly", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>upgradeElasticsearchDomainResult.setPerformCheckOnly(context.getUnmarshaller(Boolean.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ChangeProgressDetails", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>upgradeElasticsearchDomainResult.setChangeProgressDetails(ChangeProgressDetailsJsonUnmarshaller.getInstance().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 upgradeElasticsearchDomainResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
249,302 | protected void dgemm(char Order, char TransA, char TransB, int M, int N, int K, double alpha, INDArray A, int lda, INDArray B, int ldb, double beta, INDArray C, int ldc) {<NEW_LINE>if (!Nd4j.isFallbackModeEnabled()) {<NEW_LINE>nativeOps.call("cblas_dgemm", convertOrder('f'), convertTranspose(TransA), convertTranspose(TransB), M, N, K, alpha, (DoublePointer) A.data().addressPointer(), lda, (DoublePointer) B.data().addressPointer(), ldb, beta, (DoublePointer) C.data().addressPointer(), ldc);<NEW_LINE>} else {<NEW_LINE>Nd4j.getExecutioner().exec(new AggregateGEMM('f', TransA, TransB, M, N, K, alpha, A, lda, B, ldb<MASK><NEW_LINE>}<NEW_LINE>} | , beta, C, ldc)); |
1,744,276 | public void finalizeQuotation(SaleOrder saleOrder) throws AxelorException {<NEW_LINE>if (saleOrder.getStatusSelect() == null || saleOrder.getStatusSelect() != SaleOrderRepository.STATUS_DRAFT_QUOTATION) {<NEW_LINE>throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.SALE_ORDER_FINALIZE_QUOTATION_WRONG_STATUS));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>checkSaleOrderBeforeFinalization(saleOrder);<NEW_LINE>Blocking blocking = Beans.get(BlockingService.class).getBlocking(partner, saleOrder.getCompany(), BlockingRepository.SALE_BLOCKING);<NEW_LINE>if (blocking != null) {<NEW_LINE>saleOrder.setBlockedOnCustCreditExceed(true);<NEW_LINE>if (!saleOrder.getManualUnblock()) {<NEW_LINE>saleOrderRepo.save(saleOrder);<NEW_LINE>String reason = blocking.getBlockingReason() != null ? blocking.getBlockingReason().getName() : "";<NEW_LINE>throw new BlockedSaleOrderException(partner, I18n.get("Client is sale blocked:") + " " + reason);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (saleOrder.getVersionNumber() == 1 && sequenceService.isEmptyOrDraftSequenceNumber(saleOrder.getSaleOrderSeq())) {<NEW_LINE>saleOrder.setSaleOrderSeq(this.getSequence(saleOrder.getCompany()));<NEW_LINE>}<NEW_LINE>saleOrder.setStatusSelect(SaleOrderRepository.STATUS_FINALIZED_QUOTATION);<NEW_LINE>if (appSaleService.getAppSale().getPrintingOnSOFinalization()) {<NEW_LINE>this.saveSaleOrderPDFAsAttachment(saleOrder);<NEW_LINE>}<NEW_LINE>saleOrderRepo.save(saleOrder);<NEW_LINE>} | Partner partner = saleOrder.getClientPartner(); |
228,161 | public int pauseAllWithType(TransferType type) {<NEW_LINE>final ContentValues values = new ContentValues();<NEW_LINE>values.put(TransferTable.COLUMN_STATE, TransferState.PENDING_PAUSE.toString());<NEW_LINE>String selection = null;<NEW_LINE>String[] selectionArgs = null;<NEW_LINE>if (type == TransferType.ANY) {<NEW_LINE>selection = TransferTable.COLUMN_STATE + " in (?,?,?)";<NEW_LINE>selectionArgs = new String[] { TransferState.IN_PROGRESS.toString(), TransferState.RESUMED_WAITING.toString(), TransferState.WAITING.toString() };<NEW_LINE>} else {<NEW_LINE>selection = TransferTable.COLUMN_STATE + " in (?,?,?) and " + TransferTable.COLUMN_TYPE + "=?";<NEW_LINE>selectionArgs = new String[] { TransferState.IN_PROGRESS.toString(), TransferState.RESUMED_WAITING.toString(), TransferState.WAITING.toString(), type.toString() };<NEW_LINE>}<NEW_LINE>return transferDBBase.update(transferDBBase.getContentUri(<MASK><NEW_LINE>} | ), values, selection, selectionArgs); |
191,923 | public void beanRemoveInTransaction() throws RemoteException, RemoveException {<NEW_LINE>// Current the method is already in a global tx - TX_Required.<NEW_LINE>SFRa ejb2 = null;<NEW_LINE>SFRaHome fhome2 = (SFRaHome) getSessionContext().getEJBHome();<NEW_LINE>try {<NEW_LINE>ejb2 = fhome2.create();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new EJBException(" Caught unexpected " + t.<MASK><NEW_LINE>}<NEW_LINE>printMsg(BeanName, " in beanRemoveInTransaction: created SFRa bean = " + ejb2);<NEW_LINE>try {<NEW_LINE>if (ejb2 != null) {<NEW_LINE>// force ejb2 to enlist in the same tx as in this method call.<NEW_LINE>ejb2.getBooleanValue();<NEW_LINE>ejb2.remove();<NEW_LINE>printMsg(BeanName, " in beanRemoveInTransaction: ejb2.remove complete successfully; NOT GOOD.");<NEW_LINE>}<NEW_LINE>} catch (RemoveException re) {<NEW_LINE>// See ejb 2.0 spec 7.6 pg 79<NEW_LINE>throw re;<NEW_LINE>} catch (Throwable t) {<NEW_LINE>t.printStackTrace();<NEW_LINE>throw new EJBException(" Caught unexpected " + t.getClass().getName());<NEW_LINE>}<NEW_LINE>} | getClass().getName()); |
1,501,965 | public GaussianQuadratureData generate(int n) {<NEW_LINE>ArgChecker.isTrue(n > 0);<NEW_LINE>double[] x = new double[n];<NEW_LINE>double[] w = new double[n];<NEW_LINE>boolean odd = n % 2 != 0;<NEW_LINE>int m = (n + 1) / 2 - (odd ? 1 : 0);<NEW_LINE>Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = HERMITE.getPolynomialsAndFirstDerivative(n);<NEW_LINE>Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n];<NEW_LINE>DoubleFunction1D function = pair.getFirst();<NEW_LINE>DoubleFunction1D derivative = pair.getSecond();<NEW_LINE>double root = 0;<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>root = getInitialRootGuess(<MASK><NEW_LINE>root = ROOT_FINDER.getRoot(function, derivative, root);<NEW_LINE>double dp = derivative.applyAsDouble(root);<NEW_LINE>x[i] = -root;<NEW_LINE>x[n - 1 - i] = root;<NEW_LINE>w[i] = 2. / (dp * dp);<NEW_LINE>w[n - 1 - i] = w[i];<NEW_LINE>}<NEW_LINE>if (odd) {<NEW_LINE>double dp = derivative.applyAsDouble(0.0);<NEW_LINE>w[m] = 2. / dp / dp;<NEW_LINE>}<NEW_LINE>return new GaussianQuadratureData(x, w);<NEW_LINE>} | root, i, n, x); |
1,437,802 | public static String textLocalPlan(ExecutionContext context, RelNode relNode, ExecutorMode type) {<NEW_LINE>if (context.getMemoryPool() == null) {<NEW_LINE>context.setMemoryPool(MemoryManager.getInstance().createQueryMemoryPool(WorkloadUtil.isApWorkload(context.getWorkloadType()), context.getTraceId(), context.getExtraCmds()));<NEW_LINE>}<NEW_LINE>int parallelism = ExecUtils.getParallelismForLocal(context);<NEW_LINE>boolean isSpill = MemorySetting.ENABLE_SPILL && context.getParamManager().getBoolean(ConnectionParams.ENABLE_SPILL);<NEW_LINE>LocalExecutionPlanner planner = new LocalExecutionPlanner(context, null, parallelism, parallelism, 1, context.getParamManager().getInt(ConnectionParams.PREFETCH_SHARDS), MoreExecutors.directExecutor(), isSpill ? new MemorySpillerFactory() : null, null, null, type == ExecutorMode.MPP);<NEW_LINE>List<DataType> columns = CalciteUtils.<MASK><NEW_LINE>OutputBufferMemoryManager localBufferManager = planner.createLocalMemoryManager();<NEW_LINE>LocalBufferExecutorFactory factory = new LocalBufferExecutorFactory(localBufferManager, columns, 1);<NEW_LINE>List<PipelineFactory> pipelineFactories = planner.plan(relNode, factory, localBufferManager, context.getTraceId());<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append("ExecutorMode: ").append(type).append(" ").append("\n");<NEW_LINE>for (PipelineFactory pipelineFactory : pipelineFactories) {<NEW_LINE>builder.append(formatPipelineFragment(pipelineFactory, context.getParams().getCurrentParameter()));<NEW_LINE>}<NEW_LINE>return builder.toString();<NEW_LINE>} | getTypes(relNode.getRowType()); |
1,769,863 | void deprecated(final Set<ThreadContext> threadContexts, final String message, final boolean log, final Object... params) {<NEW_LINE>final Iterator<ThreadContext> iterator = threadContexts.iterator();<NEW_LINE>if (iterator.hasNext()) {<NEW_LINE>final String formattedMessage = LoggerMessageFormat.format(message, params);<NEW_LINE>final String warningHeaderValue = formatWarning(formattedMessage);<NEW_LINE>assert WARNING_HEADER_PATTERN.<MASK><NEW_LINE>assert extractWarningValueFromWarningHeader(warningHeaderValue).equals(escapeAndEncode(formattedMessage));<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>try {<NEW_LINE>final ThreadContext next = iterator.next();<NEW_LINE>next.addResponseHeader("Warning", warningHeaderValue);<NEW_LINE>} catch (final IllegalStateException e) {<NEW_LINE>// ignored; it should be removed shortly<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (log) {<NEW_LINE>logger.warn(message, params);<NEW_LINE>}<NEW_LINE>} | matcher(warningHeaderValue).matches(); |
376,429 | public static JSONObject stringifyByObject(long byteNumber) {<NEW_LINE>JSONObject object = new JSONObject();<NEW_LINE>if (byteNumber / TB_IN_BYTES > 0) {<NEW_LINE>object.put("size", df.format((double) byteNumber / (double) TB_IN_BYTES));<NEW_LINE>object.put("type", "TB");<NEW_LINE>return object;<NEW_LINE>} else if (byteNumber / GB_IN_BYTES > 0) {<NEW_LINE>object.put("size", df.format((double) byteNumber / (double) GB_IN_BYTES));<NEW_LINE>object.put("type", "GB");<NEW_LINE>return object;<NEW_LINE>} else if (byteNumber / MB_IN_BYTES > 0) {<NEW_LINE>object.put("size", df.format((double) <MASK><NEW_LINE>object.put("type", "MB");<NEW_LINE>return object;<NEW_LINE>} else if (byteNumber / KB_IN_BYTES > 0) {<NEW_LINE>object.put("size", df.format((double) byteNumber / (double) KB_IN_BYTES));<NEW_LINE>object.put("type", "KB");<NEW_LINE>return object;<NEW_LINE>} else {<NEW_LINE>object.put("size", String.valueOf(byteNumber));<NEW_LINE>object.put("type", "B");<NEW_LINE>return object;<NEW_LINE>}<NEW_LINE>} | byteNumber / (double) MB_IN_BYTES)); |
560,651 | public PlanNode visitTableScan(TableScanNode tableScan, Void context) {<NEW_LINE>if (!isPushdownFilterSupported(session, tableScan.getTable())) {<NEW_LINE>return tableScan;<NEW_LINE>}<NEW_LINE>TableHandle handle = tableScan.getTable();<NEW_LINE>HiveMetadata hiveMetadata = getMetadata(handle);<NEW_LINE>ConnectorPushdownFilterResult pushdownFilterResult = pushdownFilter(session, hiveMetadata, handle.getConnectorHandle(), TRUE_CONSTANT, handle.getLayout());<NEW_LINE>if (pushdownFilterResult.getLayout().getPredicate().isNone()) {<NEW_LINE>return new ValuesNode(tableScan.getSourceLocation(), idAllocator.getNextId(), tableScan.getOutputVariables(<MASK><NEW_LINE>}<NEW_LINE>return new TableScanNode(tableScan.getSourceLocation(), tableScan.getId(), new TableHandle(handle.getConnectorId(), handle.getConnectorHandle(), handle.getTransaction(), Optional.of(pushdownFilterResult.getLayout().getHandle())), tableScan.getOutputVariables(), tableScan.getAssignments(), pushdownFilterResult.getLayout().getPredicate(), TupleDomain.all());<NEW_LINE>} | ), ImmutableList.of()); |
1,097,575 | private boolean tryArraySet(ArrayOptimization optimization, Statement statement) {<NEW_LINE>int expectedIndex = optimization.index + 2 + optimization.arrayElementIndex;<NEW_LINE>if (resultSequence.size() - 1 != expectedIndex) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!(statement instanceof AssignmentStatement)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>AssignmentStatement assign = (AssignmentStatement) statement;<NEW_LINE>if (!(assign.getLeftValue() instanceof SubscriptExpr)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>SubscriptExpr subscript = (SubscriptExpr) assign.getLeftValue();<NEW_LINE>if (subscript.getType() != optimization.unwrappedArray.getElementType()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!(subscript.getArray() instanceof VariableExpr)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (((VariableExpr) subscript.getArray()).getIndex() != optimization.unwrappedArrayVariable) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!(subscript.getIndex() instanceof ConstantExpr)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Object constantValue = ((ConstantExpr) subscript.getIndex()).getValue();<NEW_LINE>if (!Integer.valueOf(optimization.arrayElementIndex).equals(constantValue)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>VariableAccessFinder isVariableAccessed = new VariableAccessFinder(v -> v == optimization.<MASK><NEW_LINE>assign.getRightValue().acceptVisitor(isVariableAccessed);<NEW_LINE>if (isVariableAccessed.isFound()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>optimization.elements.add(assign.getRightValue());<NEW_LINE>if (++optimization.arrayElementIndex == optimization.arraySize) {<NEW_LINE>applyArrayOptimization(optimization);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | arrayVariable || v == optimization.unwrappedArrayVariable); |
261,283 | private boolean isCertificateTrusted(final X509Certificate signerCertificate, final CMSSignedData cmsSignedData) {<NEW_LINE>LOGGER.trace("Starting CMS certificate validation");<NEW_LINE>try {<NEW_LINE>final CertPathBuilder cpb = CertPathBuilder.getInstance("PKIX");<NEW_LINE>// Define CMS signer certificate as the starting point of the path (leaf certificate)<NEW_LINE>final X509CertSelector targetConstraints = new X509CertSelector();<NEW_LINE>targetConstraints.setCertificate(signerCertificate);<NEW_LINE>// Set parameters for the certificate path building algorithm<NEW_LINE>final PKIXBuilderParameters params = new PKIXBuilderParameters(truststore.getKeyStore(), targetConstraints);<NEW_LINE>// Adding CertStore with CRLs (if present, otherwise disabling revocation check)<NEW_LINE>createCRLCertStore(truststore).ifPresentOrElse(CRLs -> {<NEW_LINE>params.addCertStore(CRLs);<NEW_LINE>PKIXRevocationChecker rc = <MASK><NEW_LINE>rc.setOptions(EnumSet.of(Option.PREFER_CRLS));<NEW_LINE>params.addCertPathChecker(rc);<NEW_LINE>}, () -> {<NEW_LINE>LOGGER.warn("No CRL CertStore provided. CRL validation will be disabled.");<NEW_LINE>params.setRevocationEnabled(false);<NEW_LINE>});<NEW_LINE>// Read certificates sent on the CMS message and adding it to the path building algorithm<NEW_LINE>final CertStore cmsCertificates = new JcaCertStoreBuilder().addCertificates(cmsSignedData.getCertificates()).build();<NEW_LINE>params.addCertStore(cmsCertificates);<NEW_LINE>// Validate certificate path<NEW_LINE>try {<NEW_LINE>cpb.build(params);<NEW_LINE>return true;<NEW_LINE>} catch (final CertPathBuilderException cpbe) {<NEW_LINE>LOGGER.warn("Untrusted certificate chain", cpbe);<NEW_LINE>LOGGER.trace("Reason for failed validation", cpbe.getCause());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOGGER.error("Error validating certificate chain");<NEW_LINE>throw new RuntimeException("Error validating certificate chain", e);<NEW_LINE>}<NEW_LINE>} | (PKIXRevocationChecker) cpb.getRevocationChecker(); |
958,435 | public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {<NEW_LINE>for (int i = 0; i < iterations; ++i) {<NEW_LINE>final long byte0 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte1 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte2 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = (byte0 << 9) | (byte1 << 1) | (byte2 >>> 7);<NEW_LINE>final long byte3 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte4 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = ((byte2 & 127) << 10) | (byte3 << 2) | (byte4 >>> 6);<NEW_LINE>final long byte5 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte6 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = ((byte4 & 63) << 11) | (byte5 << 3) | (byte6 >>> 5);<NEW_LINE>final long byte7 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte8 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = ((byte6 & 31) << 12) | (byte7 << 4) | (byte8 >>> 4);<NEW_LINE>final long byte9 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte10 <MASK><NEW_LINE>values[valuesOffset++] = ((byte8 & 15) << 13) | (byte9 << 5) | (byte10 >>> 3);<NEW_LINE>final long byte11 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte12 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = ((byte10 & 7) << 14) | (byte11 << 6) | (byte12 >>> 2);<NEW_LINE>final long byte13 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte14 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = ((byte12 & 3) << 15) | (byte13 << 7) | (byte14 >>> 1);<NEW_LINE>final long byte15 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>final long byte16 = blocks[blocksOffset++] & 0xFF;<NEW_LINE>values[valuesOffset++] = ((byte14 & 1) << 16) | (byte15 << 8) | byte16;<NEW_LINE>}<NEW_LINE>} | = blocks[blocksOffset++] & 0xFF; |
113,668 | private ScrollablePicture buildScrollablePicture() {<NEW_LINE>final GeneratedImage generatedImage = simpleLine.getGeneratedImage();<NEW_LINE>if (generatedImage == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final File png = generatedImage.getPngFile();<NEW_LINE>BufferedImage image = null;<NEW_LINE>try {<NEW_LINE>image = SImageIO.read(new SFile(png.getAbsolutePath()));<NEW_LINE>if (sizeMode == SizeMode.ZOOM_FIT) {<NEW_LINE>final Dimension imageDim = new Dimension(image.getWidth(), image.getHeight());<NEW_LINE>final Dimension newImgDim = ImageHelper.getScaledDimension(imageDim, scrollPane.getViewport().getSize());<NEW_LINE>image = ImageHelper.getScaledInstance(image, newImgDim, getHints(), true);<NEW_LINE>} else if (sizeMode == SizeMode.WIDTH_FIT) {<NEW_LINE>final Dimension imageDim = new Dimension(image.getWidth(), image.getHeight());<NEW_LINE>final Dimension newImgDim = ImageHelper.getScaledDimensionWidthFit(imageDim, scrollPane.getViewport().getSize());<NEW_LINE>image = ImageHelper.getScaledInstance(image, newImgDim, getHints(), false);<NEW_LINE>} else if (zoomFactor != 0) {<NEW_LINE>final Dimension imageDim = new Dimension(image.getWidth(), image.getHeight());<NEW_LINE>final Dimension newImgDim = ImageHelper.getScaledDimension(imageDim, getZoom());<NEW_LINE>image = ImageHelper.getScaledInstance(image, newImgDim, getHints(), false);<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>final String msg = "Error reading file: " + ex.toString();<NEW_LINE>final TextBlockBackcolored error = GraphicStrings.createForError(Arrays<MASK><NEW_LINE>try {<NEW_LINE>final byte[] bytes = plainPngBuilder(error).writeByteArray();<NEW_LINE>image = SImageIO.read(bytes);<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ImageIcon imageIcon = new ImageIcon(image, simpleLine.toString());<NEW_LINE>final ScrollablePicture scrollablePicture = new ScrollablePicture(imageIcon, 1);<NEW_LINE>scrollablePicture.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>public void mousePressed(MouseEvent me) {<NEW_LINE>super.mousePressed(me);<NEW_LINE>startX = me.getX();<NEW_LINE>startY = me.getY();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>scrollablePicture.addMouseMotionListener(new MouseMotionAdapter() {<NEW_LINE><NEW_LINE>public void mouseDragged(MouseEvent me) {<NEW_LINE>super.mouseDragged(me);<NEW_LINE>final int diffX = me.getX() - startX;<NEW_LINE>final int diffY = me.getY() - startY;<NEW_LINE>final JScrollBar hbar = scrollPane.getHorizontalScrollBar();<NEW_LINE>hbar.setValue(hbar.getValue() - diffX);<NEW_LINE>final JScrollBar vbar = scrollPane.getVerticalScrollBar();<NEW_LINE>vbar.setValue(vbar.getValue() - diffY);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return scrollablePicture;<NEW_LINE>} | .asList(msg), false); |
348,000 | public static CreateContactFlowResponse unmarshall(CreateContactFlowResponse createContactFlowResponse, UnmarshallerContext context) {<NEW_LINE>createContactFlowResponse.setRequestId(context.stringValue("CreateContactFlowResponse.RequestId"));<NEW_LINE>createContactFlowResponse.setSuccess(context.booleanValue("CreateContactFlowResponse.Success"));<NEW_LINE>createContactFlowResponse.setCode(context.stringValue("CreateContactFlowResponse.Code"));<NEW_LINE>createContactFlowResponse.setMessage(context.stringValue("CreateContactFlowResponse.Message"));<NEW_LINE>createContactFlowResponse.setHttpStatusCode(context.integerValue("CreateContactFlowResponse.HttpStatusCode"));<NEW_LINE>ContactFlow contactFlow = new ContactFlow();<NEW_LINE>contactFlow.setContactFlowId(context.stringValue("CreateContactFlowResponse.ContactFlow.ContactFlowId"));<NEW_LINE>contactFlow.setInstanceId(context.stringValue("CreateContactFlowResponse.ContactFlow.InstanceId"));<NEW_LINE>contactFlow.setContactFlowName(context.stringValue("CreateContactFlowResponse.ContactFlow.ContactFlowName"));<NEW_LINE>contactFlow.setContactFlowDescription(context.stringValue("CreateContactFlowResponse.ContactFlow.ContactFlowDescription"));<NEW_LINE>contactFlow.setType(context.stringValue("CreateContactFlowResponse.ContactFlow.Type"));<NEW_LINE>contactFlow.setAppliedVersion(context.stringValue("CreateContactFlowResponse.ContactFlow.AppliedVersion"));<NEW_LINE>List<ContactFlowVersion> versions = new ArrayList<ContactFlowVersion>();<NEW_LINE>for (int i = 0; i < context.lengthValue("CreateContactFlowResponse.ContactFlow.Versions.Length"); i++) {<NEW_LINE>ContactFlowVersion contactFlowVersion = new ContactFlowVersion();<NEW_LINE>contactFlowVersion.setContactFlowVersionId(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].ContactFlowVersionId"));<NEW_LINE>contactFlowVersion.setVersion(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].Version"));<NEW_LINE>contactFlowVersion.setContactFlowVersionDescription(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].ContactFlowVersionDescription"));<NEW_LINE>contactFlowVersion.setCanvas(context.stringValue<MASK><NEW_LINE>contactFlowVersion.setContent(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].Content"));<NEW_LINE>contactFlowVersion.setLastModified(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].LastModified"));<NEW_LINE>contactFlowVersion.setLastModifiedBy(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].LastModifiedBy"));<NEW_LINE>contactFlowVersion.setLockedBy(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].LockedBy"));<NEW_LINE>contactFlowVersion.setStatus(context.stringValue("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].Status"));<NEW_LINE>versions.add(contactFlowVersion);<NEW_LINE>}<NEW_LINE>contactFlow.setVersions(versions);<NEW_LINE>List<PhoneNumber> phoneNumbers = new ArrayList<PhoneNumber>();<NEW_LINE>for (int i = 0; i < context.lengthValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers.Length"); i++) {<NEW_LINE>PhoneNumber phoneNumber = new PhoneNumber();<NEW_LINE>phoneNumber.setPhoneNumberId(context.stringValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].PhoneNumberId"));<NEW_LINE>phoneNumber.setInstanceId(context.stringValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].InstanceId"));<NEW_LINE>phoneNumber.setNumber(context.stringValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].Number"));<NEW_LINE>phoneNumber.setPhoneNumberDescription(context.stringValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].PhoneNumberDescription"));<NEW_LINE>phoneNumber.setTestOnly(context.booleanValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].TestOnly"));<NEW_LINE>phoneNumber.setRemainingTime(context.integerValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].RemainingTime"));<NEW_LINE>phoneNumber.setAllowOutbound(context.booleanValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].AllowOutbound"));<NEW_LINE>phoneNumber.setUsage(context.stringValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].Usage"));<NEW_LINE>phoneNumber.setTrunks(context.integerValue("CreateContactFlowResponse.ContactFlow.PhoneNumbers[" + i + "].Trunks"));<NEW_LINE>phoneNumbers.add(phoneNumber);<NEW_LINE>}<NEW_LINE>contactFlow.setPhoneNumbers(phoneNumbers);<NEW_LINE>createContactFlowResponse.setContactFlow(contactFlow);<NEW_LINE>return createContactFlowResponse;<NEW_LINE>} | ("CreateContactFlowResponse.ContactFlow.Versions[" + i + "].Canvas")); |
885,929 | private Optional<SqlType> resolveCommonStructType(final TypedExpression exp, final SqlType targetType) {<NEW_LINE>final SqlType sourceType = exp.type().orElse(null);<NEW_LINE>if (targetType.baseType() != SqlBaseType.STRUCT) {<NEW_LINE>throw coercionFailureException(exp.expression(), sourceType, <MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final SqlStruct targetStruct = (SqlStruct) targetType;<NEW_LINE>final CreateStructExpression sourceStruct = (CreateStructExpression) exp.expression();<NEW_LINE>final List<String> fieldNames = Streams.concat(sourceStruct.getFields().stream().map(Field::getName), targetStruct.fields().stream().map(SqlStruct.Field::name)).distinct().collect(Collectors.toList());<NEW_LINE>final Builder builder = SqlTypes.struct();<NEW_LINE>for (final String fieldName : fieldNames) {<NEW_LINE>final Optional<Expression> sourceFieldValue = sourceStruct.getFields().stream().filter(f -> f.getName().equals(fieldName)).findFirst().map(Field::getValue);<NEW_LINE>final Optional<SqlType> sourceFieldType = sourceFieldValue.map(sourceExpression -> typeManager.getExpressionSqlType(sourceExpression, lambdaTypeMapping));<NEW_LINE>final Optional<SqlType> targetFieldType = targetStruct.field(fieldName).map(SqlStruct.Field::type);<NEW_LINE>final SqlType fieldType;<NEW_LINE>if (!targetFieldType.isPresent()) {<NEW_LINE>fieldType = sourceFieldType.orElseThrow(IllegalStateException::new);<NEW_LINE>} else if (!sourceFieldType.isPresent()) {<NEW_LINE>fieldType = targetFieldType.orElseThrow(IllegalStateException::new);<NEW_LINE>} else {<NEW_LINE>fieldType = resolveCommonType(new TypedExpression(sourceFieldType.get(), sourceFieldValue.get()), targetFieldType).orElseThrow(IllegalStateException::new);<NEW_LINE>}<NEW_LINE>builder.field(fieldName, fieldType);<NEW_LINE>}<NEW_LINE>return Optional.of(builder.build());<NEW_LINE>} catch (final InvalidCoercionException e) {<NEW_LINE>throw coercionFailureException(exp.expression(), sourceType, targetType, Optional.of(e));<NEW_LINE>}<NEW_LINE>} | targetType, Optional.empty()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.