idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
574,981 | private static Query handleItems(SearchExecutionContext context, MoreLikeThisQuery mltQuery, Item[] likeItems, Item[] unlikeItems, boolean include, List<String> moreLikeFields, boolean useDefaultField) throws IOException {<NEW_LINE>// set default index, type and fields if not specified<NEW_LINE>for (Item item : likeItems) {<NEW_LINE>setDefaultIndexTypeFields(context, item, moreLikeFields, useDefaultField);<NEW_LINE>}<NEW_LINE>for (Item item : unlikeItems) {<NEW_LINE>setDefaultIndexTypeFields(context, item, moreLikeFields, useDefaultField);<NEW_LINE>}<NEW_LINE>// fetching the items with multi-termvectors API<NEW_LINE>MultiTermVectorsResponse likeItemsResponse = fetchResponse(context.getClient(), likeItems);<NEW_LINE>// getting the Fields for liked items<NEW_LINE>mltQuery<MASK><NEW_LINE>// getting the Fields for unliked items<NEW_LINE>if (unlikeItems.length > 0) {<NEW_LINE>MultiTermVectorsResponse unlikeItemsResponse = fetchResponse(context.getClient(), unlikeItems);<NEW_LINE>org.apache.lucene.index.Fields[] unlikeFields = getFieldsFor(unlikeItemsResponse);<NEW_LINE>if (unlikeFields.length > 0) {<NEW_LINE>mltQuery.setUnlikeFields(unlikeFields);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BooleanQuery.Builder boolQuery = new BooleanQuery.Builder();<NEW_LINE>boolQuery.add(mltQuery, BooleanClause.Occur.SHOULD);<NEW_LINE>// exclude the items from the search<NEW_LINE>if (include == false) {<NEW_LINE>handleExclude(boolQuery, likeItems, context);<NEW_LINE>}<NEW_LINE>return boolQuery.build();<NEW_LINE>} | .setLikeFields(getFieldsFor(likeItemsResponse)); |
884,110 | private void showPrivateKey(byte[] data, CryptoFileType fileType) throws IOException, CryptoException {<NEW_LINE>PrivateKey privKey = null;<NEW_LINE>Password password = null;<NEW_LINE>switch(fileType) {<NEW_LINE>case ENC_PKCS8_PVK:<NEW_LINE>password = getPassword();<NEW_LINE>if (password == null || password.isNulled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>privKey = <MASK><NEW_LINE>break;<NEW_LINE>case UNENC_PKCS8_PVK:<NEW_LINE>privKey = Pkcs8Util.load(data);<NEW_LINE>break;<NEW_LINE>case ENC_OPENSSL_PVK:<NEW_LINE>password = getPassword();<NEW_LINE>if (password == null || password.isNulled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>privKey = OpenSslPvkUtil.loadEncrypted(data, password);<NEW_LINE>break;<NEW_LINE>case UNENC_OPENSSL_PVK:<NEW_LINE>privKey = OpenSslPvkUtil.load(data);<NEW_LINE>break;<NEW_LINE>case ENC_MS_PVK:<NEW_LINE>password = getPassword();<NEW_LINE>if (password == null || password.isNulled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>privKey = MsPvkUtil.loadEncrypted(data, password);<NEW_LINE>break;<NEW_LINE>case UNENC_MS_PVK:<NEW_LINE>privKey = MsPvkUtil.load(data);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>DViewPrivateKey dViewPrivateKey = new DViewPrivateKey(frame, res.getString("ExamineClipboardAction.PrivateKeyDetails.Title"), privKey);<NEW_LINE>dViewPrivateKey.setLocationRelativeTo(frame);<NEW_LINE>dViewPrivateKey.setVisible(true);<NEW_LINE>} | Pkcs8Util.loadEncrypted(data, password); |
1,465,127 | public void handleLineComment(int commentIndex) {<NEW_LINE>Token commentToken = this.tm.get(commentIndex);<NEW_LINE>boolean isOnFirstColumn = handleWhitespaceAround(commentIndex);<NEW_LINE>if (handleFormatOnOffTags(commentToken))<NEW_LINE>return;<NEW_LINE>if (isOnFirstColumn) {<NEW_LINE>if (this.options.comment_format_line_comment && !this.options.comment_format_line_comment_starting_on_first_column) {<NEW_LINE>this.lastLineComment = null;<NEW_LINE>commentToken.setIndent(0);<NEW_LINE>commentToken.setWrapPolicy(WrapPolicy.FORCE_FIRST_COLUMN);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (this.options.never_indent_line_comments_on_first_column) {<NEW_LINE>commentToken.setIndent(0);<NEW_LINE>commentToken.setWrapPolicy(WrapPolicy.FORCE_FIRST_COLUMN);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>handleNLSTags(commentToken, commentIndex);<NEW_LINE>int positionInLine = this.tm.findSourcePositionInLine(commentToken.originalStart);<NEW_LINE>boolean isContinuation = commentIndex > 0 && this.tm.get(commentIndex - 1) == this.lastLineComment && (positionInLine >= this.lastLineCommentPosition - this.options.indentation_size + 1) && this.tm.countLineBreaksBetween(this.lastLineComment, commentToken) == 1;<NEW_LINE>boolean isHeader = this.tm.isInHeader(commentIndex);<NEW_LINE>boolean formattingEnabled = (isHeader ? this.options.comment_format_header : this.options.comment_format_line_comment);<NEW_LINE>if (!formattingEnabled) {<NEW_LINE>preserveWhitespace(commentToken, commentIndex);<NEW_LINE>if (isContinuation) {<NEW_LINE>WrapPolicy policy = this.lastLineComment.getWrapPolicy();<NEW_LINE>if (policy == null) {<NEW_LINE>int lineStart = this.tm.getPositionInLine(this.tm.findFirstTokenInLine(commentIndex - 1));<NEW_LINE>int commentStart = this.tm.getPositionInLine(commentIndex - 1);<NEW_LINE>policy = new WrapPolicy(WrapMode.WHERE_NECESSARY, commentIndex - 1, commentStart - lineStart);<NEW_LINE>}<NEW_LINE>commentToken.setWrapPolicy(policy);<NEW_LINE>this.lastLineComment = commentToken;<NEW_LINE>} else if (commentToken.getLineBreaksBefore() == 0) {<NEW_LINE>this.lastLineComment = commentToken;<NEW_LINE>this.lastLineCommentPosition = positionInLine;<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Token> structure = tokenizeLineComment(commentToken);<NEW_LINE>if (isContinuation) {<NEW_LINE>Token first = structure.get(0);<NEW_LINE>first.breakBefore();<NEW_LINE>first.setWrapPolicy(new WrapPolicy(WrapMode.WHERE_NECESSARY, commentIndex - 1, this.lastLineCommentPosition));<NEW_LINE>// merge previous and current line comment<NEW_LINE>Token previous = this.lastLineComment;<NEW_LINE>Token merged = new Token(previous, previous.originalStart, <MASK><NEW_LINE>merged.putLineBreaksAfter(commentToken.getLineBreaksAfter());<NEW_LINE>merged.setPreserveLineBreaksAfter(commentToken.isPreserveLineBreaksAfter());<NEW_LINE>this.tm.remove(commentIndex - 1);<NEW_LINE>this.tm.insert(commentIndex - 1, merged);<NEW_LINE>this.tm.remove(commentIndex);<NEW_LINE>List<Token> lastStructure = this.lastLineComment.getInternalStructure();<NEW_LINE>lastStructure.addAll(structure);<NEW_LINE>merged.setInternalStructure(lastStructure);<NEW_LINE>this.lastLineComment = merged;<NEW_LINE>} else {<NEW_LINE>commentToken.setInternalStructure(structure);<NEW_LINE>handleCompilerTags(commentToken, commentIndex);<NEW_LINE>preserveWhitespace(commentToken, commentIndex);<NEW_LINE>this.lastLineComment = commentToken;<NEW_LINE>this.lastLineCommentPosition = positionInLine;<NEW_LINE>}<NEW_LINE>} | commentToken.originalEnd, previous.tokenType); |
800,714 | private UnionDataSchema parseUnion(UnionDeclarationContext union, boolean withinTypref) throws ParseException {<NEW_LINE>UnionDataSchema schema = new UnionDataSchema();<NEW_LINE>List<UnionMemberDeclarationContext> members = union.typeParams.members;<NEW_LINE>List<UnionDataSchema.Member> unionMembers = new ArrayList<>(members.size());<NEW_LINE>for (UnionMemberDeclarationContext memberDecl : members) {<NEW_LINE>// Get union member type assignment<NEW_LINE>TypeAssignmentContext memberType = memberDecl.member;<NEW_LINE>DataSchema dataSchema = toDataSchema(memberType);<NEW_LINE>if (dataSchema != null) {<NEW_LINE>UnionDataSchema.Member unionMember = new UnionDataSchema.Member(dataSchema);<NEW_LINE>recordLocation(unionMember, memberDecl);<NEW_LINE>unionMember.setDeclaredInline(isDeclaredInline(memberDecl.member));<NEW_LINE>// Get union member alias, if any<NEW_LINE>UnionMemberAliasContext alias = memberDecl.unionMemberAlias();<NEW_LINE>if (alias != null) {<NEW_LINE>// Set union member alias<NEW_LINE>boolean isAliasValid = unionMember.setAlias(alias.name.value, startCalleeMessageBuilder());<NEW_LINE>if (!isAliasValid) {<NEW_LINE>appendCalleeMessage(unionMember);<NEW_LINE>}<NEW_LINE>// Set union member docs and properties<NEW_LINE>if (alias.doc != null) {<NEW_LINE>unionMember.setDoc(alias.doc.value);<NEW_LINE>}<NEW_LINE>final Map<String, Object> properties = new HashMap<>();<NEW_LINE>for (PropDeclarationContext prop : alias.props) {<NEW_LINE>addPropertiesAtPath(properties, prop);<NEW_LINE>}<NEW_LINE>unionMember.setProperties(properties);<NEW_LINE>}<NEW_LINE>unionMembers.add(unionMember);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>schema.<MASK><NEW_LINE>return schema;<NEW_LINE>} | setMembers(unionMembers, errorMessageBuilder()); |
1,341,135 | public void refreshScope(@Nullable NamedScope scope) {<NEW_LINE>FileTreeModelBuilder.clearCaches(myProject);<NEW_LINE>if (scope == null) {<NEW_LINE>// was deleted<NEW_LINE>scope = DefaultScopesProvider.getAllScope();<NEW_LINE>}<NEW_LINE>LOG.assertTrue(scope != null);<NEW_LINE>final NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, scope.getName(), myDependencyValidationManager);<NEW_LINE>final PackageSet packageSet = scope.getValue() != null ? scope.getValue() : new InvalidPackageSet("");<NEW_LINE>final DependenciesPanel.DependencyPanelSettings settings = new DependenciesPanel.DependencyPanelSettings();<NEW_LINE>settings.UI_FILTER_LEGALS = true;<NEW_LINE>settings.UI_GROUP_BY_SCOPE_TYPE = false;<NEW_LINE>settings.UI_SHOW_FILES = true;<NEW_LINE>final ProjectView projectView = ProjectView.getInstance(myProject);<NEW_LINE>settings.UI_FLATTEN_PACKAGES = projectView.isFlattenPackages(ScopeViewPane.ID);<NEW_LINE>settings.UI_COMPACT_EMPTY_MIDDLE_PACKAGES = projectView.isHideEmptyMiddlePackages(ScopeViewPane.ID);<NEW_LINE>settings.UI_SHOW_MODULES = projectView.isShowModules(ScopeViewPane.ID);<NEW_LINE>settings.UI_SHOW_MODULE_GROUPS = projectView.isShowModules(ScopeViewPane.ID);<NEW_LINE>myBuilder = new FileTreeModelBuilder(myProject, new Marker() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isMarked(VirtualFile file) {<NEW_LINE>return packageSet != null && (packageSet instanceof PackageSetBase ? ((PackageSetBase) packageSet).contains(file, myProject, holder) : packageSet.contains(PackageSetBase.getPsiFile(file, myProject), holder));<NEW_LINE>}<NEW_LINE>}, settings);<NEW_LINE>myTree.setPaintBusy(true);<NEW_LINE>myBuilder.setTree(myTree);<NEW_LINE>myTree.getEmptyText().setText("Loading...");<NEW_LINE>myActionCallback = new AsyncResult<>();<NEW_LINE>myTree.putClientProperty(TreeState.CALLBACK, new WeakReference<ActionCallback>(myActionCallback));<NEW_LINE>myTree.setModel(myBuilder.build(myProject, true, new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>myTree.setPaintBusy(false);<NEW_LINE>myTree.getEmptyText().setText(UIBundle.message("message.nothingToShow"));<NEW_LINE>myActionCallback.setDone();<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>((PackageDependenciesNode) myTree.getModel().<MASK><NEW_LINE>((DefaultTreeModel) myTree.getModel()).reload();<NEW_LINE>FileTreeModelBuilder.clearCaches(myProject);<NEW_LINE>} | getRoot()).sortChildren(); |
1,589,561 | private File extractEntry(ZipEntry thisEntry, String moduleName, ZipFile file) throws FileNotFoundException {<NEW_LINE>try {<NEW_LINE>File libraryFile = File.createTempFile(moduleName, ".j9ddrlib");<NEW_LINE>InputStream in = file.getInputStream(thisEntry);<NEW_LINE>try {<NEW_LINE>OutputStream out = new FileOutputStream(libraryFile);<NEW_LINE>try {<NEW_LINE>// Set ShutdownHook to clean up.<NEW_LINE>libraryFile.deleteOnExit();<NEW_LINE>byte[] buffer = new byte[4096];<NEW_LINE>int read;<NEW_LINE>while ((read = in.read(buffer)) != -1) {<NEW_LINE>out.write(buffer, 0, read);<NEW_LINE>}<NEW_LINE>return libraryFile;<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>out.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Do nothing<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>in.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Do nothing<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.logp(Level.WARNING, "LibraryResolverFactory$LibraryPathResolver", "extractEntry", "IOException trying to extract " + thisEntry.getName() + " from " + <MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | file.getName(), e); |
1,591,757 | public void initFactories() {<NEW_LINE>factories.put(JetSubmitJobCodec.REQUEST_MESSAGE_TYPE<MASK><NEW_LINE>factories.put(JetTerminateJobCodec.REQUEST_MESSAGE_TYPE, toFactory(JetTerminateJobMessageTask::new));<NEW_LINE>factories.put(JetGetJobStatusCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobStatusMessageTask::new));<NEW_LINE>factories.put(JetGetJobSuspensionCauseCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobSuspensionCauseMessageTask::new));<NEW_LINE>factories.put(JetGetJobMetricsCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobMetricsMessageTask::new));<NEW_LINE>factories.put(JetGetJobIdsCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobIdsMessageTask::new));<NEW_LINE>factories.put(JetJoinSubmittedJobCodec.REQUEST_MESSAGE_TYPE, toFactory(JetJoinSubmittedJobMessageTask::new));<NEW_LINE>factories.put(JetGetJobSubmissionTimeCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobSubmissionTimeMessageTask::new));<NEW_LINE>factories.put(JetGetJobConfigCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobConfigMessageTask::new));<NEW_LINE>factories.put(JetResumeJobCodec.REQUEST_MESSAGE_TYPE, toFactory(JetResumeJobMessageTask::new));<NEW_LINE>factories.put(JetExportSnapshotCodec.REQUEST_MESSAGE_TYPE, toFactory(JetExportSnapshotMessageTask::new));<NEW_LINE>factories.put(JetGetJobSummaryListCodec.REQUEST_MESSAGE_TYPE, toFactory(JetGetJobSummaryListMessageTask::new));<NEW_LINE>factories.put(JetExistsDistributedObjectCodec.REQUEST_MESSAGE_TYPE, toFactory(JetExistsDistributedObjectMessageTask::new));<NEW_LINE>} | , toFactory(JetSubmitJobMessageTask::new)); |
967,556 | public static YamlPath fromASTPath(List<NodeRef<?>> path) {<NEW_LINE>List<YamlPathSegment> segments = new ArrayList<YamlPathSegment>(path.size());<NEW_LINE>for (NodeRef<?> nodeRef : path) {<NEW_LINE>switch(nodeRef.getKind()) {<NEW_LINE>case ROOT:<NEW_LINE>RootRef rref = (RootRef) nodeRef;<NEW_LINE>segments.add(YamlPathSegment.valueAt(rref.getIndex()));<NEW_LINE>break;<NEW_LINE>case KEY:<NEW_LINE>{<NEW_LINE>String key = NodeUtil.asScalar(nodeRef.get());<NEW_LINE>if (key == null) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>segments.add(YamlPathSegment.keyAt(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case VAL:<NEW_LINE>{<NEW_LINE>TupleValueRef vref = (TupleValueRef) nodeRef;<NEW_LINE>String key = NodeUtil.asScalar(vref.getTuple().getKeyNode());<NEW_LINE>if (key == null) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>segments.add(YamlPathSegment.valueAt(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case SEQ:<NEW_LINE>SeqRef <MASK><NEW_LINE>segments.add(YamlPathSegment.valueAt(sref.getIndex()));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new YamlPath(segments);<NEW_LINE>} | sref = ((SeqRef) nodeRef); |
250,786 | public static BarSeries loadCsvSeries(String filename) {<NEW_LINE>InputStream stream = CsvBarsLoader.class.getClassLoader().getResourceAsStream(filename);<NEW_LINE>BarSeries series = new BaseBarSeries("apple_bars");<NEW_LINE>try (CSVReader csvReader = new CSVReader(new InputStreamReader(stream, Charset.forName("UTF-8")), ',', '"', 1)) {<NEW_LINE>String[] line;<NEW_LINE>while ((line = csvReader.readNext()) != null) {<NEW_LINE>ZonedDateTime date = LocalDate.parse(line[0], DATE_FORMAT).atStartOfDay(ZoneId.systemDefault());<NEW_LINE>double open = Double.parseDouble(line[1]);<NEW_LINE>double high = Double.parseDouble(line[2]);<NEW_LINE>double low = Double.parseDouble(line[3]);<NEW_LINE>double close = Double.parseDouble(line[4]);<NEW_LINE>double volume = Double<MASK><NEW_LINE>series.addBar(date, open, high, low, close, volume);<NEW_LINE>}<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>Logger.getLogger(CsvBarsLoader.class.getName()).log(Level.SEVERE, "Unable to load bars from CSV", ioe);<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>Logger.getLogger(CsvBarsLoader.class.getName()).log(Level.SEVERE, "Error while parsing value", nfe);<NEW_LINE>}<NEW_LINE>return series;<NEW_LINE>} | .parseDouble(line[5]); |
1,063,268 | final CreateTrustStoreResult executeCreateTrustStore(CreateTrustStoreRequest createTrustStoreRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createTrustStoreRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateTrustStoreRequest> request = null;<NEW_LINE>Response<CreateTrustStoreResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateTrustStoreRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createTrustStoreRequest));<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, "WorkSpaces Web");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTrustStore");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateTrustStoreResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateTrustStoreResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,080,474 | protected void calcAsync() {<NEW_LINE>ExUtil.asyncRun(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>Map<Integer, UserAgentSummary> summaryMap = new HashMap<Integer, UserAgentSummary>();<NEW_LINE>Map<Integer, List<Integer>> loadTextMap = new HashMap<Integer<MASK><NEW_LINE>LongEnumer longEnumer = dataMap.keys();<NEW_LINE>while (longEnumer.hasMoreElements()) {<NEW_LINE>XLogData d = dataMap.get(longEnumer.nextLong());<NEW_LINE>long time = d.p.endTime;<NEW_LINE>if (d.filter_ok && time >= stime && time <= etime && !ObjectSelectManager.getInstance().isUnselectedObject(d.p.objHash)) {<NEW_LINE>UserAgentSummary summary = summaryMap.get(d.p.userAgent);<NEW_LINE>if (summary == null) {<NEW_LINE>summary = new UserAgentSummary(d.p.userAgent);<NEW_LINE>summaryMap.put(d.p.userAgent, summary);<NEW_LINE>List<Integer> loadTextList = loadTextMap.get(d.serverId);<NEW_LINE>if (loadTextList == null) {<NEW_LINE>loadTextList = new ArrayList<Integer>();<NEW_LINE>loadTextMap.put(d.serverId, loadTextList);<NEW_LINE>}<NEW_LINE>loadTextList.add(d.p.userAgent);<NEW_LINE>}<NEW_LINE>summary.count++;<NEW_LINE>summary.sumTime += d.p.elapsed;<NEW_LINE>if (d.p.elapsed > summary.maxTime) {<NEW_LINE>summary.maxTime = d.p.elapsed;<NEW_LINE>}<NEW_LINE>if (d.p.error != 0) {<NEW_LINE>summary.error++;<NEW_LINE>}<NEW_LINE>summary.cpu += d.p.cpu;<NEW_LINE>summary.memory += d.p.kbytes;<NEW_LINE>summary.sqltime += d.p.sqlTime;<NEW_LINE>summary.apicalltime += d.p.apicallTime;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Integer serverId : loadTextMap.keySet()) {<NEW_LINE>TextProxy.userAgent.load(DateUtil.yyyymmdd(etime), loadTextMap.get(serverId), serverId);<NEW_LINE>}<NEW_LINE>final TopN<UserAgentSummary> stn = new TopN<UserAgentSummary>(10000, DIRECTION.DESC);<NEW_LINE>for (UserAgentSummary so : summaryMap.values()) {<NEW_LINE>stn.add(so);<NEW_LINE>}<NEW_LINE>ExUtil.exec(viewer.getTable(), new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>rangeLabel.setText(DateUtil.format(stime, "yyyy-MM-dd HH:mm:ss") + " ~ " + DateUtil.format(etime, "HH:mm:ss") + " (" + stn.size() + ")");<NEW_LINE>viewer.setInput(stn.getList());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , List<Integer>>(); |
1,501,986 | public void show() {<NEW_LINE>String title = MessageText.getString("SpeedTestWizard.finish.panel.title");<NEW_LINE>wizard.setTitle(title);<NEW_LINE>Composite rootPanel = wizard.getPanel();<NEW_LINE>GridLayout layout = new GridLayout();<NEW_LINE>layout.numColumns = 1;<NEW_LINE>rootPanel.setLayout(layout);<NEW_LINE>Composite panel = new Composite(rootPanel, SWT.NULL);<NEW_LINE>GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);<NEW_LINE>panel.setLayoutData(gridData);<NEW_LINE>layout = new GridLayout();<NEW_LINE>layout.numColumns = 3;<NEW_LINE>layout.makeColumnsEqualWidth = true;<NEW_LINE>panel.setLayout(layout);<NEW_LINE>Label label = new Label(panel, SWT.WRAP);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 3;<NEW_LINE>gridData.widthHint = 380;<NEW_LINE>label.setLayoutData(gridData);<NEW_LINE>Messages.setLanguageText(label, "SpeedTestWizard.finish.panel.click.close");<NEW_LINE>int kinb = DisplayFormatters.getKinB();<NEW_LINE>// show the setting for upload speed<NEW_LINE><MASK><NEW_LINE>int maxUploadKbs = upEst.getBytesPerSec() / kinb;<NEW_LINE>SpeedManagerLimitEstimate downEst = speedManager.getEstimatedDownloadCapacityBytesPerSec();<NEW_LINE>int maxDownloadKbs = downEst.getBytesPerSec() / kinb;<NEW_LINE>// boolean setting.<NEW_LINE>boolean autoSpeedEnabled = COConfigurationManager.getBooleanParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY);<NEW_LINE>boolean autoSpeedSeedingEnabled = COConfigurationManager.getBooleanParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY);<NEW_LINE>// spacer 2<NEW_LINE>Label s2 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 3;<NEW_LINE>s2.setLayoutData(gridData);<NEW_LINE>String autoSpeed = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed");<NEW_LINE>createStatusLine(panel, autoSpeed, autoSpeedEnabled);<NEW_LINE>String autoSpeedWhileSeeding = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed.seeding");<NEW_LINE>createStatusLine(panel, autoSpeedWhileSeeding, autoSpeedSeedingEnabled);<NEW_LINE>// spacer 1<NEW_LINE>Label s1 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 3;<NEW_LINE>s1.setLayoutData(gridData);<NEW_LINE>// displays a bytes/sec column and a bits/sec column<NEW_LINE>createHeaderLine(panel);<NEW_LINE>String maxUploadLbl = MessageText.getString("SpeedView.stats.estupcap");<NEW_LINE>createDataLine(panel, maxUploadLbl, maxUploadKbs, upEst);<NEW_LINE>String maxDownloadLbl = MessageText.getString("SpeedView.stats.estdowncap");<NEW_LINE>createDataLine(panel, maxDownloadLbl, maxDownloadKbs, downEst);<NEW_LINE>} | SpeedManagerLimitEstimate upEst = speedManager.getEstimatedUploadCapacityBytesPerSec(); |
634,206 | protected void registerInternalNoteLinkHandler() {<NEW_LINE>binding.singleNoteContent.registerOnLinkClickCallback((link) -> {<NEW_LINE>try {<NEW_LINE>final long noteLocalId = repo.getLocalIdByRemoteId(this.note.getAccountId(), Long.parseLong(link));<NEW_LINE>Log.i(TAG, "Found note for remoteId \"" + link + "\" in account \"" + this.note.getAccountId() + "\" with localId + \"" + noteLocalId + "\". Attempt to open " + EditNoteActivity.class.getSimpleName() + " for this note.");<NEW_LINE>startActivity(new Intent(requireActivity().getApplicationContext(), EditNoteActivity.class).putExtra(EditNoteActivity.PARAM_NOTE_ID, noteLocalId));<NEW_LINE>return true;<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>// Clicked link is not a long and therefore can't be a remote id.<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>Log.i(TAG, "It looks like \"" + link + "\" might be a remote id of a note, but a note with this remote id could not be found in account \"" + note.<MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>} | getAccountId() + "\" .", e); |
1,697,648 | private Prediction<Label> generatePrediction(FloatNdArray predictions, ImmutableOutputInfo<Label> outputIDInfo, int numUsed, Example<Label> example) {<NEW_LINE>long[] shape = predictions.shape().asArray();<NEW_LINE>if (shape.length != 1) {<NEW_LINE>throw new IllegalArgumentException("Failed to get scalar predictions. Found " + Arrays.toString(shape));<NEW_LINE>}<NEW_LINE>if (shape[0] > Integer.MAX_VALUE) {<NEW_LINE>throw new IllegalArgumentException("More than Integer.MAX_VALUE predictions. Found " + shape[0]);<NEW_LINE>}<NEW_LINE>int length = (int) shape[0];<NEW_LINE>Label max = null;<NEW_LINE>Map<String, Label> <MASK><NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>Label current = new Label(outputIDInfo.getOutput(i).getLabel(), predictions.getFloat(i));<NEW_LINE>map.put(current.getLabel(), current);<NEW_LINE>if ((max == null) || (current.getScore() > max.getScore())) {<NEW_LINE>max = current;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Prediction<>(max, map, numUsed, example, true);<NEW_LINE>} | map = new HashMap<>(); |
1,244,690 | public DescribeUserPoolClientResult describeUserPoolClient(DescribeUserPoolClientRequest describeUserPoolClientRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeUserPoolClientRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeUserPoolClientRequest> request = null;<NEW_LINE>Response<DescribeUserPoolClientResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeUserPoolClientRequestMarshaller().marshall(describeUserPoolClientRequest);<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<DescribeUserPoolClientResult, JsonUnmarshallerContext> unmarshaller = new DescribeUserPoolClientResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<DescribeUserPoolClientResult> responseHandler = new JsonResponseHandler<DescribeUserPoolClientResult>(unmarshaller);<NEW_LINE>response = <MASK><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>} | invoke(request, responseHandler, executionContext); |
1,594,419 | public void applyParams() {<NEW_LINE>super.applyParams();<NEW_LINE>int lightCount = mLights.size();<NEW_LINE>int dirCount = 0, spotCount = 0, attCount = 0;<NEW_LINE>for (int i = 0; i < lightCount; i++) {<NEW_LINE>ALight light = mLights.get(i);<NEW_LINE>int t = light.getLightType();<NEW_LINE>GLES20.glUniform3fv(muLightColorHandles[i], 1, light.getColor(), 0);<NEW_LINE>GLES20.glUniform1f(muLightPowerHandles[i], light.getPower());<NEW_LINE>GLES20.glUniform3fv(muLightPositionHandles[i], 1, ArrayUtils.convertDoublesToFloats(light.getPositionArray(), mTemp3Floats), 0);<NEW_LINE>if (t == ALight.SPOT_LIGHT) {<NEW_LINE>SpotLight l = (SpotLight) light;<NEW_LINE>GLES20.glUniform3fv(muLightDirectionHandles[spotCount], 1, ArrayUtils.convertDoublesToFloats(l.getDirection<MASK><NEW_LINE>GLES20.glUniform4fv(muLightAttenuationHandles[attCount], 1, l.getAttenuation(), 0);<NEW_LINE>// GLES20.glUniform1f(muSpotExponentHandles[spotCount], l.get)<NEW_LINE>GLES20.glUniform1f(muSpotCutoffAngleHandles[spotCount], l.getCutoffAngle());<NEW_LINE>GLES20.glUniform1f(muSpotFalloffHandles[spotCount], l.getFalloff());<NEW_LINE>spotCount++;<NEW_LINE>dirCount++;<NEW_LINE>attCount++;<NEW_LINE>} else if (t == ALight.POINT_LIGHT) {<NEW_LINE>PointLight l = (PointLight) light;<NEW_LINE>GLES20.glUniform4fv(muLightAttenuationHandles[attCount], 1, l.getAttenuation(), 0);<NEW_LINE>attCount++;<NEW_LINE>} else if (t == ALight.DIRECTIONAL_LIGHT) {<NEW_LINE>DirectionalLight l = (DirectionalLight) light;<NEW_LINE>GLES20.glUniform3fv(muLightDirectionHandles[dirCount], 1, ArrayUtils.convertDoublesToFloats(l.getDirection(), mTemp3Floats), 0);<NEW_LINE>dirCount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>GLES20.glUniform3fv(muAmbientColorHandle, 1, mAmbientColor, 0);<NEW_LINE>GLES20.glUniform3fv(muAmbientIntensityHandle, 1, mAmbientIntensity, 0);<NEW_LINE>} | (), mTemp3Floats), 0); |
325,847 | private String createHtmlHeader(@NonNull final CompilationInfo info, @NonNull final ModuleElement.Directive directive, final boolean fqn) {<NEW_LINE>final StringBuilder sb = new StringBuilder();<NEW_LINE>switch(directive.getKind()) {<NEW_LINE>case REQUIRES:<NEW_LINE>sb.append(((ModuleElement.RequiresDirective) directive).getDependency().getQualifiedName());<NEW_LINE>break;<NEW_LINE>case EXPORTS:<NEW_LINE>sb.append(((ModuleElement.ExportsDirective) directive).getPackage().getQualifiedName());<NEW_LINE>break;<NEW_LINE>case OPENS:<NEW_LINE>sb.append(((ModuleElement.OpensDirective) directive).getPackage().getQualifiedName());<NEW_LINE>break;<NEW_LINE>case USES:<NEW_LINE>final TypeElement service = ((ModuleElement.UsesDirective) directive).getService();<NEW_LINE>sb.append((fqn ? service.getQualifiedName() : service.getSimpleName()));<NEW_LINE>break;<NEW_LINE>case PROVIDES:<NEW_LINE>final TypeElement intf = ((ModuleElement.ProvidesDirective) directive).getService();<NEW_LINE>sb.append(fqn ? intf.getQualifiedName() : intf.getSimpleName());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | IllegalArgumentException(directive.toString()); |
549,428 | public PyObject __call__(PyObject path) {<NEW_LINE>Path absolutePath = absolutePath(path);<NEW_LINE>try {<NEW_LINE>Map<String, Object> attributes = Files.readAttributes(absolutePath, "unix:*", LinkOption.NOFOLLOW_LINKS);<NEW_LINE>Boolean isSymbolicLink = (Boolean) attributes.get("isSymbolicLink");<NEW_LINE>if (isSymbolicLink != null && isSymbolicLink.booleanValue() && path.toString().endsWith("/")) {<NEW_LINE>// Chase the symbolic link, but do not follow further - this is a special case for lstat<NEW_LINE>Path symlink = Files.readSymbolicLink(absolutePath);<NEW_LINE>symlink = absolutePath.getParent().resolve(symlink);<NEW_LINE>attributes = Files.readAttributes(symlink, "unix:*", LinkOption.NOFOLLOW_LINKS);<NEW_LINE>} else {<NEW_LINE>checkTrailingSlash(path, attributes);<NEW_LINE>}<NEW_LINE>return PyStatResult.fromUnixFileAttributes(attributes);<NEW_LINE>} catch (NoSuchFileException ex) {<NEW_LINE>throw Py.<MASK><NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw Py.OSError(Errno.EBADF, path);<NEW_LINE>} catch (SecurityException ex) {<NEW_LINE>throw Py.OSError(Errno.EACCES, path);<NEW_LINE>}<NEW_LINE>} | OSError(Errno.ENOENT, path); |
1,467,654 | public ApiScenarioReport editReport(String reportType, String reportId, String status, String runMode) {<NEW_LINE>ApiScenarioReport <MASK><NEW_LINE>if (report == null) {<NEW_LINE>report = new ApiScenarioReport();<NEW_LINE>report.setId(reportId);<NEW_LINE>}<NEW_LINE>if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) {<NEW_LINE>return report;<NEW_LINE>}<NEW_LINE>if (runMode.equals("CASE")) {<NEW_LINE>report.setTriggerMode(TriggerMode.MANUAL.name());<NEW_LINE>}<NEW_LINE>report.setStatus(status);<NEW_LINE>report.setName(report.getScenarioName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis()));<NEW_LINE>report.setEndTime(System.currentTimeMillis());<NEW_LINE>report.setUpdateTime(System.currentTimeMillis());<NEW_LINE>if (StringUtils.isNotEmpty(report.getTriggerMode()) && report.getTriggerMode().equals("CASE")) {<NEW_LINE>report.setTriggerMode(TriggerMode.MANUAL.name());<NEW_LINE>}<NEW_LINE>apiScenarioReportMapper.updateByPrimaryKeySelective(report);<NEW_LINE>return report;<NEW_LINE>} | report = apiScenarioReportMapper.selectByPrimaryKey(reportId); |
155,159 | public void visit(BLangReturn astReturnStmt) {<NEW_LINE>astReturnStmt.expr.accept(this);<NEW_LINE>BIROperand retVarRef = new BIROperand(this.env.enclFunc.returnVariable);<NEW_LINE>setScopeAndEmit(new Move(astReturnStmt.pos, this.env.targetOperand, retVarRef));<NEW_LINE>// Check whether this function already has a returnBB.<NEW_LINE>// A given function can have only one BB that has a return instruction.<NEW_LINE>if (this.env.returnBB == null) {<NEW_LINE>// If not create one<NEW_LINE>BIRBasicBlock returnBB = new BIRBasicBlock(this.env.nextBBId(names));<NEW_LINE>addToTrapStack(returnBB);<NEW_LINE>returnBB.terminator = new <MASK><NEW_LINE>this.env.returnBB = returnBB;<NEW_LINE>}<NEW_LINE>if (this.env.enclBB.terminator == null) {<NEW_LINE>this.env.unlockVars.forEach(s -> {<NEW_LINE>int i = s.size();<NEW_LINE>while (i > 0) {<NEW_LINE>BIRBasicBlock unlockBB = new BIRBasicBlock(this.env.nextBBId(names));<NEW_LINE>this.env.enclBasicBlocks.add(unlockBB);<NEW_LINE>BIRTerminator.Unlock unlock = new BIRTerminator.Unlock(null, unlockBB, this.currentScope);<NEW_LINE>this.env.enclBB.terminator = unlock;<NEW_LINE>unlock.relatedLock = s.getLock(i - 1);<NEW_LINE>this.env.enclBB = unlockBB;<NEW_LINE>i--;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>this.env.enclBB.terminator = new BIRTerminator.GOTO(astReturnStmt.pos, this.env.returnBB, this.currentScope);<NEW_LINE>BIRBasicBlock nextBB = new BIRBasicBlock(this.env.nextBBId(names));<NEW_LINE>this.env.enclBasicBlocks.add(nextBB);<NEW_LINE>this.env.enclBB = nextBB;<NEW_LINE>addToTrapStack(nextBB);<NEW_LINE>}<NEW_LINE>} | BIRTerminator.Return(getFunctionLastLinePos()); |
1,187,017 | boolean validateResponse(HttpURLConnection connection) throws IOException {<NEW_LINE>Log.d(TAG, "validateResponse: " + item.title + ": local = " + new Date(connection.getIfModifiedSince()) + " remote = " + new Date(connection.getLastModified()));<NEW_LINE>if (connection.getResponseCode() != 200) {<NEW_LINE>Log.d(TAG, "validateResponse: " + item.title + ": Skipping: Server responded with " + connection.getResponseCode(<MASK><NEW_LINE>if (connection.getResponseCode() == 404) {<NEW_LINE>parentTask.addError(item, context.getString(R.string.file_not_found));<NEW_LINE>} else if (connection.getResponseCode() != 304) {<NEW_LINE>context.getResources().getString(R.string.host_update_error_item);<NEW_LINE>parentTask.addError(item, context.getResources().getString(R.string.host_update_error_item, connection.getResponseCode(), connection.getResponseMessage()));<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ) + " for " + item.location); |
595,757 | private void updatePorts(Instance instance) {<NEW_LINE>Object dir = instance.getAttributeValue(StdAttr.FACING);<NEW_LINE>final var select = instance.getAttributeValue(PlexersLibrary.ATTR_SELECT);<NEW_LINE>var n = 1 << select.getWidth();<NEW_LINE>final var ps = new Port[n + 4];<NEW_LINE>if (dir == Direction.NORTH || dir == Direction.SOUTH) {<NEW_LINE>int x = -5 * n + 10;<NEW_LINE>int y = dir == Direction.NORTH ? 40 : -40;<NEW_LINE>for (var i = 0; i < n; i++) {<NEW_LINE>ps[i] = new Port(x + 10 * i, y, Port.INPUT, 1);<NEW_LINE>}<NEW_LINE>ps[n + OUT] = new Port(0, 0, Port.OUTPUT, select.getWidth());<NEW_LINE>ps[n + EN_IN] = new Port(x + 10 * n, y / 2, Port.INPUT, 1);<NEW_LINE>ps[n + EN_OUT] = new Port(x - 10, y / 2, Port.OUTPUT, 1);<NEW_LINE>ps[n + GS] = new Port(10, <MASK><NEW_LINE>} else {<NEW_LINE>int x = dir == Direction.EAST ? -40 : 40;<NEW_LINE>int y = -5 * n + 10;<NEW_LINE>for (var i = 0; i < n; i++) {<NEW_LINE>ps[i] = new Port(x, y + 10 * i, Port.INPUT, 1);<NEW_LINE>}<NEW_LINE>ps[n + OUT] = new Port(0, 0, Port.OUTPUT, select.getWidth());<NEW_LINE>ps[n + EN_IN] = new Port(x / 2, y + 10 * n, Port.INPUT, 1);<NEW_LINE>ps[n + EN_OUT] = new Port(x / 2, y - 10, Port.OUTPUT, 1);<NEW_LINE>ps[n + GS] = new Port(0, 10, Port.OUTPUT, 1);<NEW_LINE>}<NEW_LINE>for (var i = 0; i < n; i++) {<NEW_LINE>ps[i].setToolTip(S.getter("priorityEncoderInTip", "" + i));<NEW_LINE>}<NEW_LINE>ps[n + OUT].setToolTip(S.getter("priorityEncoderOutTip"));<NEW_LINE>ps[n + EN_IN].setToolTip(S.getter("priorityEncoderEnableInTip"));<NEW_LINE>ps[n + EN_OUT].setToolTip(S.getter("priorityEncoderEnableOutTip"));<NEW_LINE>ps[n + GS].setToolTip(S.getter("priorityEncoderGroupSignalTip"));<NEW_LINE>instance.setPorts(ps);<NEW_LINE>} | 0, Port.OUTPUT, 1); |
1,211,358 | public AssociateFileSystemResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AssociateFileSystemResult associateFileSystemResult = new AssociateFileSystemResult();<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 associateFileSystemResult;<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("FileSystemAssociationARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>associateFileSystemResult.setFileSystemAssociationARN(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 associateFileSystemResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,376,645 | /*<NEW_LINE>* Read in the serialized MethodType. This instance will never escape. It will<NEW_LINE>* be replaced by the MethodType created in readResolve() which does the proper<NEW_LINE>* validation.<NEW_LINE>*/<NEW_LINE>private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {<NEW_LINE>try {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>final Field fReturnType = getClass().getDeclaredField("rtype");<NEW_LINE>// $NON-NLS-1$<NEW_LINE>final Field fArguments = getClass().getDeclaredField("ptypes");<NEW_LINE>AccessController.doPrivileged(new PrivilegedAction<Object>() {<NEW_LINE><NEW_LINE>public Object run() {<NEW_LINE>fReturnType.setAccessible(true);<NEW_LINE>fArguments.setAccessible(true);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fReturnType.set(this, void.class);<NEW_LINE>fArguments.set(this, EMTPY_PARAMS);<NEW_LINE>methodDescriptor = "()V";<NEW_LINE>stackDescriptionBits = stackDescriptionBits(EMTPY_PARAMS, 0);<NEW_LINE>Class<?> serialReturnType = (Class<?>) in.readObject();<NEW_LINE>Class<?>[] serialArguments = (Class<?><MASK><NEW_LINE>deserializedFields = new DeserializedFieldsHolder(serialReturnType, serialArguments);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>} catch (NoSuchFieldException e) {<NEW_LINE>}<NEW_LINE>} | []) in.readObject(); |
1,844,818 | public void exitFftf_dscp(Fftf_dscpContext ctx) {<NEW_LINE>String dscpSpec = toString(ctx.name);<NEW_LINE>FwFromDscp from = new FwFromDscp(dscpSpec);<NEW_LINE>Integer <MASK><NEW_LINE>if (value == null) {<NEW_LINE>// not a number, so must be an alias<NEW_LINE>// if it is not a builtin alias or it has been overridden, we add a reference<NEW_LINE>// TODO: this is not quite right because the builtin override could happen later<NEW_LINE>if (!DscpUtil.defaultValue(dscpSpec).isPresent() || _currentLogicalSystem.getDscpAliases().containsKey(dscpSpec)) {<NEW_LINE>_configuration.referenceStructure(CLASS_OF_SERVICE_CODE_POINT_ALIAS, dscpSpec, FIREWALL_FILTER_DSCP, getLine(ctx.name.getStart()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>_currentFwTerm.getFroms().add(from);<NEW_LINE>} | value = Ints.tryParse(dscpSpec); |
780,675 | public boolean validate() throws ContractValidateException {<NEW_LINE>if (this.any == null) {<NEW_LINE>throw new ContractValidateException(ActuatorConstant.CONTRACT_NOT_EXIST);<NEW_LINE>}<NEW_LINE>if (chainBaseManager == null) {<NEW_LINE>throw new ContractValidateException("No account store or contract store!");<NEW_LINE>}<NEW_LINE>AccountStore accountStore = chainBaseManager.getAccountStore();<NEW_LINE>if (!any.is(AccountCreateContract.class)) {<NEW_LINE>throw new ContractValidateException("contract type error,expected type [AccountCreateContract],real type[" + any.getClass() + "]");<NEW_LINE>}<NEW_LINE>final AccountCreateContract contract;<NEW_LINE>try {<NEW_LINE>contract = this.any.unpack(AccountCreateContract.class);<NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>// if (contract.getAccountName().isEmpty()) {<NEW_LINE>// throw new ContractValidateException("AccountName is null");<NEW_LINE>// }<NEW_LINE>byte[] ownerAddress = contract.getOwnerAddress().toByteArray();<NEW_LINE>if (!DecodeUtil.addressValid(ownerAddress)) {<NEW_LINE>throw new ContractValidateException("Invalid ownerAddress");<NEW_LINE>}<NEW_LINE>AccountCapsule accountCapsule = accountStore.get(ownerAddress);<NEW_LINE>if (accountCapsule == null) {<NEW_LINE>String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);<NEW_LINE>throw new ContractValidateException(ActuatorConstant.ACCOUNT_EXCEPTION_STR + readableOwnerAddress + NOT_EXIST_STR);<NEW_LINE>}<NEW_LINE>final long fee = calcFee();<NEW_LINE>if (accountCapsule.getBalance() < fee) {<NEW_LINE>throw new ContractValidateException("Validate CreateAccountActuator error, insufficient fee.");<NEW_LINE>}<NEW_LINE>byte[] accountAddress = contract.getAccountAddress().toByteArray();<NEW_LINE>if (!DecodeUtil.addressValid(accountAddress)) {<NEW_LINE>throw new ContractValidateException("Invalid account address");<NEW_LINE>}<NEW_LINE>// if (contract.getType() == null) {<NEW_LINE>// throw new ContractValidateException("Type is null");<NEW_LINE>// }<NEW_LINE>if (accountStore.has(accountAddress)) {<NEW_LINE>throw new ContractValidateException("Account has existed");<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ContractValidateException(e.getMessage()); |
1,468,803 | public synchronized void createTable(String... tables) throws RocksDBException {<NEW_LINE>this.checkValid();<NEW_LINE>List<ColumnFamilyDescriptor> cfds = new ArrayList<>();<NEW_LINE>for (String table : tables) {<NEW_LINE>if (this.rocksdb.existCf(table)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ColumnFamilyDescriptor cfd = new ColumnFamilyDescriptor(encode(table));<NEW_LINE>ColumnFamilyOptions options = cfd.getOptions();<NEW_LINE>initOptions(this.config(), null, null, options, options);<NEW_LINE>cfds.add(cfd);<NEW_LINE>}<NEW_LINE>List<ColumnFamilyHandle> cfhs = this.rocksdb().createColumnFamilies(cfds);<NEW_LINE>for (ColumnFamilyHandle cfh : cfhs) {<NEW_LINE>String table = decode(cfh.getName());<NEW_LINE>this.rocksdb.addCf(table, new CFHandle(this<MASK><NEW_LINE>}<NEW_LINE>this.ingestExternalFile();<NEW_LINE>} | .rocksdb(), cfh)); |
212,739 | private boolean canExport(JFileChooser chooser) {<NEW_LINE>File file = chooser.getSelectedFile();<NEW_LINE>if (!file.getPath().endsWith(".gephi")) {<NEW_LINE>file = new File(file.getPath() + ".gephi");<NEW_LINE>chooser.setSelectedFile(file);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!file.exists()) {<NEW_LINE>if (!file.createNewFile()) {<NEW_LINE>String failMsg = NbBundle.getMessage(ProjectControllerUIImpl.class, "SaveAsProject_SaveFailed", new Object[] { file.getPath() });<NEW_LINE>JOptionPane.showMessageDialog(null, failMsg);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String overwriteMsg = NbBundle.getMessage(ProjectControllerUIImpl.class, "SaveAsProject_Overwrite", new Object[] { file.getPath() });<NEW_LINE>if (JOptionPane.showConfirmDialog(null, overwriteMsg) != JOptionPane.OK_OPTION) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>NotifyDescriptor.Message msg = new NotifyDescriptor.Message(ex.getMessage(), NotifyDescriptor.WARNING_MESSAGE);<NEW_LINE>DialogDisplayer.<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | getDefault().notifyLater(msg); |
139,498 | public static RubyClass createBigDecimal(Ruby runtime) {<NEW_LINE>RubyClass bigDecimal = runtime.defineClass("BigDecimal", runtime.getNumeric(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);<NEW_LINE>bigDecimal.setConstant("VERSION", RubyString.newStringShared(runtime, VERSION));<NEW_LINE>runtime.getKernel().defineAnnotatedMethods(BigDecimalKernelMethods.class);<NEW_LINE>bigDecimal.setInternalModuleVariable("vpPrecLimit", RubyFixnum.zero(runtime));<NEW_LINE>bigDecimal.setInternalModuleVariable("vpExceptionMode", RubyFixnum.zero(runtime));<NEW_LINE>bigDecimal.setInternalModuleVariable("vpRoundingMode", runtime.newFixnum(ROUND_HALF_UP));<NEW_LINE>bigDecimal.defineAnnotatedMethods(RubyBigDecimal.class);<NEW_LINE>bigDecimal.defineAnnotatedConstants(RubyBigDecimal.class);<NEW_LINE>bigDecimal.getSingletonClass().undefineMethod("allocate");<NEW_LINE>// RubyModule bigMath = runtime.defineModule("BigMath");<NEW_LINE>// NOTE: BigMath.exp and BigMath.pow should be implemented as native<NEW_LINE>// for now @see jruby/bigdecimal.rb<NEW_LINE>bigDecimal.defineConstant<MASK><NEW_LINE>bigDecimal.defineConstant("INFINITY", newInfinity(runtime, 1));<NEW_LINE>bigDecimal.setReifiedClass(RubyBigDecimal.class);<NEW_LINE>return bigDecimal;<NEW_LINE>} | ("NAN", newNaN(runtime)); |
444,330 | final GetBotChannelAssociationResult executeGetBotChannelAssociation(GetBotChannelAssociationRequest getBotChannelAssociationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getBotChannelAssociationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetBotChannelAssociationRequest> request = null;<NEW_LINE>Response<GetBotChannelAssociationResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new GetBotChannelAssociationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getBotChannelAssociationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lex Model Building Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetBotChannelAssociation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetBotChannelAssociationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetBotChannelAssociationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
977,610 | public String post(@RequestParam(required = false) String location, @RequestParam(required = false) String latlng, @RequestParam(required = false) String address, String space, HttpServletRequest req, HttpServletResponse res, Model model) {<NEW_LINE>if (utils.isAuthenticated(req)) {<NEW_LINE>Profile authUser = utils.getAuthUser(req);<NEW_LINE>String currentSpace = utils.getValidSpaceIdExcludingAll(authUser, space, req);<NEW_LINE>boolean needsApproval = utils.postNeedsApproval(authUser);<NEW_LINE>Question q = utils.populate(req, needsApproval ? new UnapprovedQuestion() : new Question(), "title", "body", "tags|,", "location");<NEW_LINE>q.setCreatorid(authUser.getId());<NEW_LINE>q.setSpace(currentSpace);<NEW_LINE>if (StringUtils.isBlank(q.getTagsString())) {<NEW_LINE>q.setTags(Arrays.asList(CONF.defaultQuestionTag().isBlank() ? "question" : CONF.defaultQuestionTag()));<NEW_LINE>}<NEW_LINE>Map<String, String> error = utils.validate(q);<NEW_LINE>if (error.isEmpty()) {<NEW_LINE>q.setLocation(location);<NEW_LINE>q.setAuthor(authUser);<NEW_LINE>String qid = q.create();<NEW_LINE>utils.sendNewPostNotifications(q, req);<NEW_LINE>if (!StringUtils.isBlank(latlng)) {<NEW_LINE>Address addr = new Address(qid + Para.getConfig().separator() + Utils.type(Address.class));<NEW_LINE>addr.setAddress(address);<NEW_LINE>addr.setCountry(location);<NEW_LINE>addr.setLatlng(latlng);<NEW_LINE>addr.setParentid(qid);<NEW_LINE>addr.setCreatorid(authUser.getId());<NEW_LINE>pc.create(addr);<NEW_LINE>}<NEW_LINE>authUser.setLastseen(System.currentTimeMillis());<NEW_LINE>model.addAttribute("newpost", getNewQuestionPayload(q));<NEW_LINE>} else {<NEW_LINE>model.addAttribute("error", error);<NEW_LINE>model.addAttribute("draftQuestion", q);<NEW_LINE>model.addAttribute("defaultTag", "");<NEW_LINE>model.addAttribute("path", "questions.vm");<NEW_LINE>model.addAttribute("includeGMapsScripts", utils.isNearMeFeatureEnabled());<NEW_LINE>model.addAttribute("askSelected", "navbtn-hover");<NEW_LINE>return "base";<NEW_LINE>}<NEW_LINE>if (utils.isAjaxRequest(req)) {<NEW_LINE>res.setStatus(200);<NEW_LINE>res.setContentType("application/json");<NEW_LINE>try {<NEW_LINE>res.getWriter().println("{\"url\":\"" + q.getPostLink<MASK><NEW_LINE>} catch (IOException ex) {<NEW_LINE>}<NEW_LINE>return "blank";<NEW_LINE>} else {<NEW_LINE>return "redirect:" + q.getPostLink(false, false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (utils.isAjaxRequest(req)) {<NEW_LINE>res.setStatus(400);<NEW_LINE>return "blank";<NEW_LINE>} else {<NEW_LINE>return "redirect:" + SIGNINLINK + "?returnto=" + QUESTIONSLINK + "/ask";<NEW_LINE>}<NEW_LINE>} | (false, false) + "\"}"); |
541,227 | private IDunnableDoc createDunnableDoc(@NonNull final IDunningContext context, @NonNull final I_C_Dunning_Candidate_Invoice_v1 candidate) {<NEW_LINE>final int invoiceId = candidate.getC_Invoice_ID();<NEW_LINE>final int invoicePayScheduleId = candidate.getC_InvoicePaySchedule_ID();<NEW_LINE>final int adClientId = candidate.getAD_Client_ID();<NEW_LINE>final int adOrgId = candidate.getAD_Org_ID();<NEW_LINE>final int bpartnerId = candidate.getC_BPartner_ID();<NEW_LINE>final int bpartnerLocationId = candidate.getC_BPartner_Location_ID();<NEW_LINE>final int contactId = candidate.getAD_User_ID();<NEW_LINE>final int currencyId = candidate.getC_Currency_ID();<NEW_LINE>final BigDecimal grandTotal = candidate.getGrandTotal();<NEW_LINE>final BigDecimal openAmt = candidate.getOpenAmt();<NEW_LINE>final Date dateInvoiced = candidate.getDateInvoiced();<NEW_LINE>final Date dueDate = candidate.getDueDate();<NEW_LINE>final Date dunningGrace = candidate.getDunningGrace();<NEW_LINE>final int paymentTermId = candidate.getC_PaymentTerm_ID();<NEW_LINE>final boolean isInDispute = candidate.isInDispute();<NEW_LINE>// FRESH-504<NEW_LINE>final String documentNo;<NEW_LINE>final String tableName;<NEW_LINE>final int recordId;<NEW_LINE>if (invoicePayScheduleId > 0) {<NEW_LINE>tableName = I_C_InvoicePaySchedule.Table_Name;<NEW_LINE>recordId = invoicePayScheduleId;<NEW_LINE>// The table C_InvoicePaySchedule does not have the column DocumentNo. In this case, the documentNo is null<NEW_LINE>documentNo = null;<NEW_LINE>} else // if (C_Invoice_ID > 0)<NEW_LINE>{<NEW_LINE>tableName = I_C_Invoice.Table_Name;<NEW_LINE>recordId = invoiceId;<NEW_LINE>final I_C_Invoice invoice = InterfaceWrapperHelper.create(context.getCtx(), invoiceId, <MASK><NEW_LINE>if (invoice == null) {<NEW_LINE>// shall not happen<NEW_LINE>// in case of no referenced record the documentNo is null.<NEW_LINE>documentNo = null;<NEW_LINE>} else {<NEW_LINE>documentNo = invoice.getDocumentNo();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final int daysDue;<NEW_LINE>if (invoicePayScheduleId > 0) {<NEW_LINE>daysDue = TimeUtil.getDaysBetween(dueDate, context.getDunningDate());<NEW_LINE>} else {<NEW_LINE>final IInvoiceSourceDAO invoiceSourceDAO = Services.get(IInvoiceSourceDAO.class);<NEW_LINE>daysDue = invoiceSourceDAO.retrieveDueDays(PaymentTermId.ofRepoId(paymentTermId), dateInvoiced, context.getDunningDate());<NEW_LINE>}<NEW_LINE>final IDunnableDoc dunnableDoc = new // FRESH-504 DocumentNo is also needed<NEW_LINE>DunnableDoc(// FRESH-504 DocumentNo is also needed<NEW_LINE>tableName, // FRESH-504 DocumentNo is also needed<NEW_LINE>recordId, documentNo, adClientId, adOrgId, bpartnerId, bpartnerLocationId, contactId, currencyId, grandTotal, openAmt, dueDate, dunningGrace, daysDue, isInDispute);<NEW_LINE>return dunnableDoc;<NEW_LINE>} | I_C_Invoice.class, ITrx.TRXNAME_ThreadInherited); |
1,070,249 | public static ClientMessage encodeRequest(java.lang.String name, java.util.UUID txnId, long threadId, com.hazelcast.internal.serialization.Data key, com.hazelcast.internal.serialization.Data value) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("TransactionalMultiMap.Put");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeUUID(initialFrame.content, REQUEST_TXN_ID_FIELD_OFFSET, txnId);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_THREAD_ID_FIELD_OFFSET, threadId);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE><MASK><NEW_LINE>DataCodec.encode(clientMessage, key);<NEW_LINE>DataCodec.encode(clientMessage, value);<NEW_LINE>return clientMessage;<NEW_LINE>} | StringCodec.encode(clientMessage, name); |
1,783,615 | // DO NOT MODIFY THIS CODE, GENERATED AUTOMATICALLY<NEW_LINE>public static boolean isVolatile(com.sun.jdi.Field a) throws org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper, org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.logCallStart("com.sun.jdi.Field", "isVolatile", "JDI CALL: com.sun.jdi.Field({0}).isVolatile()", new Object[] { a });<NEW_LINE>}<NEW_LINE>Object retValue = null;<NEW_LINE>try {<NEW_LINE>boolean ret;<NEW_LINE>ret = a.isVolatile();<NEW_LINE>retValue = ret;<NEW_LINE>return ret;<NEW_LINE>} catch (com.sun.jdi.InternalException ex) {<NEW_LINE>retValue = ex;<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.report(ex);<NEW_LINE>throw new org.netbeans.modules.debugger.<MASK><NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException ex) {<NEW_LINE>retValue = ex;<NEW_LINE>if (a instanceof com.sun.jdi.Mirror) {<NEW_LINE>com.sun.jdi.VirtualMachine vm = ((com.sun.jdi.Mirror) a).virtualMachine();<NEW_LINE>try {<NEW_LINE>vm.dispose();<NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException vmdex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper(ex);<NEW_LINE>} catch (Error err) {<NEW_LINE>retValue = err;<NEW_LINE>throw err;<NEW_LINE>} catch (RuntimeException rex) {<NEW_LINE>retValue = rex;<NEW_LINE>throw rex;<NEW_LINE>} finally {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.logCallEnd("com.sun.jdi.Field", "isVolatile", retValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | jpda.jdi.InternalExceptionWrapper(ex); |
243,372 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_viewpagertab);<NEW_LINE>setSupportActionBar((Toolbar) findViewById(R.id.toolbar));<NEW_LINE>mHeaderView = findViewById(R.id.header);<NEW_LINE>ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));<NEW_LINE>mToolbarView = findViewById(R.id.toolbar);<NEW_LINE>mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());<NEW_LINE>mPager = (ViewPager) findViewById(R.id.pager);<NEW_LINE>mPager.setAdapter(mPagerAdapter);<NEW_LINE>SlidingTabLayout slidingTabLayout = (SlidingTabLayout) <MASK><NEW_LINE>slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);<NEW_LINE>slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));<NEW_LINE>slidingTabLayout.setDistributeEvenly(true);<NEW_LINE>slidingTabLayout.setViewPager(mPager);<NEW_LINE>// When the page is selected, other fragments' scrollY should be adjusted<NEW_LINE>// according to the toolbar status(shown/hidden)<NEW_LINE>slidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageScrolled(int i, float v, int i2) {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageSelected(int i) {<NEW_LINE>propagateToolbarState(toolbarIsShown());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageScrollStateChanged(int i) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>propagateToolbarState(toolbarIsShown());<NEW_LINE>} | findViewById(R.id.sliding_tabs); |
963,506 | final DescribeBillingGroupResult executeDescribeBillingGroup(DescribeBillingGroupRequest describeBillingGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeBillingGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribeBillingGroupRequest> request = null;<NEW_LINE>Response<DescribeBillingGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeBillingGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeBillingGroupRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeBillingGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeBillingGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeBillingGroupResultJsonUnmarshaller());<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); |
603,010 | public static CodegenExpressionNewAnonymousClass codegenEvaluatorWCoerce(ExprForge forge, EPTypeClass optCoercionType, CodegenMethod method, Class generator, CodegenClassScope classScope) {<NEW_LINE>CodegenExpressionNewAnonymousClass evaluator = newAnonymousClass(method.getBlock(), ExprEvaluator.EPTYPE);<NEW_LINE>CodegenMethod evaluate = CodegenMethod.makeParentNode(EPTypePremade.OBJECT.getEPType(), generator, classScope).addParam(ExprForgeCodegenNames.PARAMS);<NEW_LINE>evaluator.addMethod("evaluate", evaluate);<NEW_LINE>CodegenExpression result = constantNull();<NEW_LINE>if (forge.getEvaluationType() != null) {<NEW_LINE>CodegenMethod evalMethod = CodegenLegoMethodExpression.codegenExpression(forge, method, classScope);<NEW_LINE>result = localMethod(evalMethod, REF_EPS, REF_ISNEWDATA, REF_EXPREVALCONTEXT);<NEW_LINE>if (optCoercionType != null && !EPTypeNull.INSTANCE.equals(forge.getEvaluationType())) {<NEW_LINE>EPTypeClass type = (EPTypeClass) forge.getEvaluationType();<NEW_LINE>EPTypeClass boxed = JavaClassHelper.getBoxedType(type);<NEW_LINE>if (boxed.getType() != JavaClassHelper.getBoxedType(optCoercionType).getType()) {<NEW_LINE>SimpleNumberCoercer coercer = SimpleNumberCoercerFactory.getCoercer(boxed<MASK><NEW_LINE>evaluate.getBlock().declareVar(boxed, "result", result);<NEW_LINE>result = coercer.coerceCodegen(ref("result"), boxed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>evaluate.getBlock().methodReturn(result);<NEW_LINE>return evaluator;<NEW_LINE>} | , JavaClassHelper.getBoxedType(optCoercionType)); |
1,755,049 | private static void addPwmResponseHeaders(final PwmRequest pwmRequest) throws PwmUnrecoverableException {<NEW_LINE>if (pwmRequest == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final PwmApplication pwmApplication = pwmRequest.getPwmApplication();<NEW_LINE>final PwmSession pwmSession = pwmRequest.getPwmSession();<NEW_LINE>final AppConfig config = pwmApplication.getConfig();<NEW_LINE>final PwmResponse resp = pwmRequest.getPwmResponse();<NEW_LINE>if (resp.isCommitted()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final boolean includeXSessionID = Boolean.parseBoolean(config.readAppProperty(AppProperty.HTTP_HEADER_SEND_XSESSIONID));<NEW_LINE>if (includeXSessionID && pwmSession != null) {<NEW_LINE>resp.setHeader(HttpHeader.XSessionID, pwmSession.getSessionStateBean().getSessionID());<NEW_LINE>}<NEW_LINE>final boolean includeContentLanguage = Boolean.parseBoolean(config.readAppProperty(AppProperty.HTTP_HEADER_SEND_CONTENT_LANGUAGE));<NEW_LINE>if (includeContentLanguage) {<NEW_LINE>resp.setHeader(HttpHeader.ContentLanguage, pwmRequest.getLocale().toLanguageTag());<NEW_LINE>}<NEW_LINE>addStaticResponseHeaders(pwmApplication, pwmRequest.getHttpServletRequest(<MASK><NEW_LINE>if (pwmSession != null) {<NEW_LINE>final String contentPolicy;<NEW_LINE>if (pwmRequest.getURL().isConfigGuideURL() || pwmRequest.getURL().isConfigManagerURL()) {<NEW_LINE>contentPolicy = config.readAppProperty(AppProperty.SECURITY_HTTP_CONFIG_CSP_HEADER);<NEW_LINE>} else {<NEW_LINE>contentPolicy = config.readSettingAsString(PwmSetting.SECURITY_CSP_HEADER);<NEW_LINE>}<NEW_LINE>if (contentPolicy != null && !contentPolicy.isEmpty()) {<NEW_LINE>final String nonce = pwmRequest.getCspNonce();<NEW_LINE>final String replacedPolicy = contentPolicy.replace("%NONCE%", nonce);<NEW_LINE>final String expandedPolicy = MacroRequest.forNonUserSpecific(pwmRequest.getPwmApplication(), null).expandMacros(replacedPolicy);<NEW_LINE>resp.setHeader(HttpHeader.ContentSecurityPolicy, expandedPolicy);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), resp.getHttpServletResponse()); |
953,086 | public int compareTo(Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> other) {<NEW_LINE>int result = 0;<NEW_LINE>result = Tuples.compare(v1, other.v1);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v2, other.v2);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v3, other.v3);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.<MASK><NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v5, other.v5);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v6, other.v6);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v7, other.v7);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v8, other.v8);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v9, other.v9);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v10, other.v10);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v11, other.v11);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>result = Tuples.compare(v12, other.v12);<NEW_LINE>if (result != 0)<NEW_LINE>return result;<NEW_LINE>return result;<NEW_LINE>} | compare(v4, other.v4); |
1,773,901 | public JSDynamicObject execute(IteratorRecord iteratorRecord, JSDynamicObject constructor, PromiseCapabilityRecord resultCapability, Object promiseResolve) {<NEW_LINE>assert JSRuntime.isConstructor(constructor);<NEW_LINE>assert JSRuntime.isCallable(promiseResolve);<NEW_LINE>SimpleArrayList<Object> errors = new SimpleArrayList<>(10);<NEW_LINE>BoxedInt remainingElementsCount = new BoxedInt(1);<NEW_LINE>for (int index = 0; ; index++) {<NEW_LINE>Object next = iteratorStepOrSetDone(iteratorRecord);<NEW_LINE>if (next == Boolean.FALSE) {<NEW_LINE>iteratorRecord.setDone(true);<NEW_LINE>remainingElementsCount.value--;<NEW_LINE>if (remainingElementsCount.value == 0) {<NEW_LINE>JSDynamicObject errorsArray = JSArray.createConstantObjectArray(context, getRealm(<MASK><NEW_LINE>throw Errors.createAggregateError(errorsArray, this);<NEW_LINE>}<NEW_LINE>return resultCapability.getPromise();<NEW_LINE>}<NEW_LINE>Object nextValue = iteratorValueOrSetDone(iteratorRecord, next);<NEW_LINE>errors.add(Undefined.instance, growProfile);<NEW_LINE>Object nextPromise = callResolve.executeCall(JSArguments.createOneArg(constructor, promiseResolve, nextValue));<NEW_LINE>Object resolveElement = createResolveElementFunction(index, errors, resultCapability, remainingElementsCount);<NEW_LINE>JSFunctionObject rejectElement = createRejectElementFunction(index, errors, resultCapability, remainingElementsCount);<NEW_LINE>remainingElementsCount.value++;<NEW_LINE>callThen.executeCall(JSArguments.create(nextPromise, getThen.getValue(nextPromise), resolveElement, rejectElement));<NEW_LINE>}<NEW_LINE>} | ), errors.toArray()); |
1,549,953 | public void renameFile(String new_name) throws FMFileManagerException {<NEW_LINE>try {<NEW_LINE>this_mon.enter();<NEW_LINE>length_cache = getLength();<NEW_LINE>String new_canonical_path;<NEW_LINE>File new_linked_file = FileUtil.newFile(linked_file.getParentFile(), new_name);<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>new_canonical_path = new_linked_file.getCanonicalPath();<NEW_LINE>} catch (IOException ioe) {<NEW_LINE><MASK><NEW_LINE>if (msg != null && msg.contains("There are no more files")) {<NEW_LINE>String abs_path = new_linked_file.getAbsolutePath();<NEW_LINE>String error = "Caught 'There are no more files' exception during new_file.getCanonicalPath(). " + "os=[" + Constants.OSName + "], new_file.getPath()=[" + new_linked_file.getPath() + "], new_file.getAbsolutePath()=[" + abs_path + "]. ";<NEW_LINE>// "new_canonical_path temporarily set to [" +abs_path+ "]";<NEW_LINE>Debug.out(error, ioe);<NEW_LINE>}<NEW_LINE>throw ioe;<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw (new FMFileManagerException("getCanonicalPath fails", e));<NEW_LINE>}<NEW_LINE>if (new_linked_file.exists()) {<NEW_LINE>throw (new FMFileManagerException("renameFile fails - file '" + new_canonical_path + "' already exists"));<NEW_LINE>}<NEW_LINE>boolean was_open = isOpen();<NEW_LINE>// full close, this will release any slots in the limited file case<NEW_LINE>close();<NEW_LINE>if (!linked_file.exists() || linked_file.renameTo(new_linked_file)) {<NEW_LINE>linked_file = new_linked_file;<NEW_LINE>canonical_path = new_canonical_path;<NEW_LINE>reserveFile();<NEW_LINE>if (was_open) {<NEW_LINE>// ensure open will regain slots in limited file case<NEW_LINE>ensureOpen("renameFile target");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>reserveFile();<NEW_LINE>} catch (FMFileManagerException e) {<NEW_LINE>Debug.printStackTrace(e);<NEW_LINE>}<NEW_LINE>if (was_open) {<NEW_LINE>try {<NEW_LINE>ensureOpen("renameFile recovery");<NEW_LINE>} catch (FMFileManagerException e) {<NEW_LINE>Debug.printStackTrace(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw (new FMFileManagerException("renameFile fails"));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>length_cache = -1;<NEW_LINE>this_mon.exit();<NEW_LINE>}<NEW_LINE>} | String msg = ioe.getMessage(); |
1,696,157 | public boolean apply(ClassMap classMap, Configuration configuration) {<NEW_LINE>Class<?> srcClass = classMap.getSrcClassToMap();<NEW_LINE>Class<?> destClass = classMap.getDestClassToMap();<NEW_LINE>Set<String> destFieldNames = getAcceptsFieldsDetector(destClass).getWritableFieldNames(destClass);<NEW_LINE>Set<String> srcFieldNames = getAcceptsFieldsDetector<MASK><NEW_LINE>Set<WildcardFieldMapping> wildcardFieldMappings = (classMap.isWildcardCaseInsensitive()) ? getMatchingFieldsCaseInsensitive(srcFieldNames, destFieldNames) : getMatchingFields(srcFieldNames, destFieldNames);<NEW_LINE>for (WildcardFieldMapping wildcardFieldMapping : wildcardFieldMappings) {<NEW_LINE>if (GeneratorUtils.shouldIgnoreField(wildcardFieldMapping.getSrcFieldName(), srcClass, destClass, beanContainer) || GeneratorUtils.shouldIgnoreField(wildcardFieldMapping.getDestFieldName(), srcClass, destClass, beanContainer)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// If field has already been accounted for, then skip<NEW_LINE>if (classMap.getFieldMapUsingDest(wildcardFieldMapping.getDestFieldName()) != null || classMap.getFieldMapUsingSrc(wildcardFieldMapping.getSrcFieldName()) != null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>GeneratorUtils.addGenericMapping(MappingType.GETTER_TO_SETTER, classMap, configuration, wildcardFieldMapping.getSrcFieldName(), wildcardFieldMapping.getDestFieldName(), beanContainer, destBeanCreator, propertyDescriptorFactory);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | (srcClass).getReadableFieldNames(srcClass); |
1,461,297 | private MetadataResult applyMetadata(Indexed<MetadataEntry> entry) {<NEW_LINE>// If the session ID is non-zero, read the metadata for the associated state machine.<NEW_LINE>if (entry.entry().session() > 0) {<NEW_LINE>RaftSession session = raft.getSessions().getSession(entry.entry().session());<NEW_LINE>// If the session is null, return an UnknownSessionException.<NEW_LINE>if (session == null) {<NEW_LINE>logger.warn("Unknown session: " + entry.<MASK><NEW_LINE>throw new RaftException.UnknownSession("Unknown session: " + entry.entry().session());<NEW_LINE>}<NEW_LINE>Set<SessionMetadata> sessions = new HashSet<>();<NEW_LINE>for (RaftSession s : raft.getSessions().getSessions()) {<NEW_LINE>if (s.primitiveName().equals(session.primitiveName())) {<NEW_LINE>sessions.add(new SessionMetadata(s.sessionId().id(), s.primitiveName(), s.primitiveType().name()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new MetadataResult(sessions);<NEW_LINE>} else {<NEW_LINE>Set<SessionMetadata> sessions = new HashSet<>();<NEW_LINE>for (RaftSession session : raft.getSessions().getSessions()) {<NEW_LINE>sessions.add(new SessionMetadata(session.sessionId().id(), session.primitiveName(), session.primitiveType().name()));<NEW_LINE>}<NEW_LINE>return new MetadataResult(sessions);<NEW_LINE>}<NEW_LINE>} | entry().session()); |
1,773,285 | public RepositoryAnalysis unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RepositoryAnalysis repositoryAnalysis = new RepositoryAnalysis();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("RepositoryHead", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>repositoryAnalysis.setRepositoryHead(RepositoryHeadSourceCodeTypeJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("SourceCodeType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>repositoryAnalysis.setSourceCodeType(SourceCodeTypeJsonUnmarshaller.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 repositoryAnalysis;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
65,943 | private SqlStatement generateUpdateStatement(String resourceServerDetailTable) {<NEW_LINE>String resourceServerTableName = database.correctObjectName(getTableName("RESOURCE_SERVER"), Table.class);<NEW_LINE>String resourceServerDetailTableName = database.correctObjectName(getTableName(resourceServerDetailTable), Table.class);<NEW_LINE>if (database instanceof MSSQLDatabase) {<NEW_LINE>// UPDATE RESOURCE_SERVER_POLICY SET RESOURCE_SERVER_CLIENT_ID = s.CLIENT_ID FROM (SELECT ID, CLIENT_ID FROM RESOURCE_SERVER) s WHERE s.ID = RESOURCE_SERVER_POLICY.RESOURCE_SERVER_ID;<NEW_LINE>// UPDATE RESOURCE_SERVER_RESOURCE SET RESOURCE_SERVER_CLIENT_ID = s.CLIENT_ID FROM (SELECT ID, CLIENT_ID FROM RESOURCE_SERVER) s WHERE s.ID = RESOURCE_SERVER_RESOURCE.RESOURCE_SERVER_ID;<NEW_LINE>// UPDATE RESOURCE_SERVER_SCOPE SET RESOURCE_SERVER_CLIENT_ID = s.CLIENT_ID FROM (SELECT ID, CLIENT_ID FROM RESOURCE_SERVER) s WHERE s.ID = RESOURCE_SERVER_SCOPE.RESOURCE_SERVER_ID;<NEW_LINE>return new RawSqlStatement("UPDATE " + resourceServerDetailTableName + " SET RESOURCE_SERVER_CLIENT_ID = s.CLIENT_ID FROM " + " (SELECT ID, CLIENT_ID FROM " + resourceServerTableName + ") s " + " WHERE s.ID = " + resourceServerDetailTableName + ".RESOURCE_SERVER_ID");<NEW_LINE>} else {<NEW_LINE>// UPDATE RESOURCE_SERVER_POLICY p SET RESOURCE_SERVER_CLIENT_ID = (SELECT CLIENT_ID FROM RESOURCE_SERVER s WHERE s.ID = p.RESOURCE_SERVER_ID);<NEW_LINE>// UPDATE RESOURCE_SERVER_RESOURCE p SET RESOURCE_SERVER_CLIENT_ID = (SELECT CLIENT_ID FROM RESOURCE_SERVER s WHERE s.ID = p.RESOURCE_SERVER_ID);<NEW_LINE>// UPDATE RESOURCE_SERVER_SCOPE p SET RESOURCE_SERVER_CLIENT_ID = (SELECT CLIENT_ID FROM RESOURCE_SERVER s WHERE s.ID = p.RESOURCE_SERVER_ID);<NEW_LINE>return new RawSqlStatement("UPDATE " + resourceServerDetailTableName + <MASK><NEW_LINE>}<NEW_LINE>} | " p SET RESOURCE_SERVER_CLIENT_ID = " + "(SELECT CLIENT_ID FROM " + resourceServerTableName + " s WHERE s.ID = p.RESOURCE_SERVER_ID)"); |
1,540,531 | public SetVoiceMessageSpendLimitOverrideResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SetVoiceMessageSpendLimitOverrideResult setVoiceMessageSpendLimitOverrideResult = new SetVoiceMessageSpendLimitOverrideResult();<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 setVoiceMessageSpendLimitOverrideResult;<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("MonthlyLimit", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>setVoiceMessageSpendLimitOverrideResult.setMonthlyLimit(context.getUnmarshaller(Long.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 setVoiceMessageSpendLimitOverrideResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
897,147 | public void findDevice_bootloader() {<NEW_LINE>Log.d(QtApplication.QtTAG, "findDevice_bootloader");<NEW_LINE>// ???<NEW_LINE>PendingIntent mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);<NEW_LINE>// Handle to system USB service?<NEW_LINE>UsbManager manager = (<MASK><NEW_LINE>HashMap<String, UsbDevice> deviceList = manager.getDeviceList();<NEW_LINE>Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();<NEW_LINE>if (!deviceIterator.hasNext()) {<NEW_LINE>Log.d(QtApplication.QtTAG, "NO DEVICE FOUND");<NEW_LINE>}<NEW_LINE>while (deviceIterator.hasNext()) {<NEW_LINE>Log.d(QtApplication.QtTAG, "DEVICE FOUND");<NEW_LINE>UsbDevice device = deviceIterator.next();<NEW_LINE>manager.requestPermission(device, mPermissionIntent);<NEW_LINE>// Wait until it gets the permission<NEW_LINE>while (!manager.hasPermission(device)) {<NEW_LINE>;<NEW_LINE>}<NEW_LINE>String Model = device.getDeviceName();<NEW_LINE>int DeviceID = device.getDeviceId();<NEW_LINE>int VID = device.getVendorId();<NEW_LINE>int PID = device.getProductId();<NEW_LINE>Log.d(QtApplication.QtTAG, String.format("Device ID = %d\nVID=0x%04x\nPID=0x%04x\n", DeviceID, VID, PID));<NEW_LINE>if ((VID == 0x03eb) && (PID == 0x2fe4)) {<NEW_LINE>if (!manager.hasPermission(device)) {<NEW_LINE>Log.d(QtApplication.QtTAG, "permission was not granted to the USB device!!!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.d(QtApplication.QtTAG, "MATCH FOUND!");<NEW_LINE>usbfs_path = device.getDeviceName();<NEW_LINE>Log.d(QtApplication.QtTAG, "usbfs_path = " + usbfs_path);<NEW_LINE>connection = manager.openDevice(device);<NEW_LINE>file_descriptor = connection.getFileDescriptor();<NEW_LINE>Log.d(QtApplication.QtTAG, "fd = " + file_descriptor);<NEW_LINE>Log.d(QtApplication.QtTAG, "Returning...");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | UsbManager) getSystemService(Context.USB_SERVICE); |
1,125,536 | public ModuleProtos.Module writeModule(Group group, ModulePath modulePath, ReferableConverter referableConverter) {<NEW_LINE>ModuleProtos.Module.Builder out = ModuleProtos.Module.newBuilder();<NEW_LINE>// Serialize the group structure first in order to populate the call target tree<NEW_LINE>myComplete = true;<NEW_LINE>out.setVersion(VERSION);<NEW_LINE>out.setGroup(writeGroup(group, referableConverter));<NEW_LINE>out.setComplete(myComplete);<NEW_LINE>// Now write the call target tree<NEW_LINE>Map<ModulePath, Map<String, CallTargetTree>> moduleCallTargets = new HashMap<>();<NEW_LINE>for (Map.Entry<Object, Integer> entry : myCallTargetIndexProvider.getCallTargets()) {<NEW_LINE>if (!(entry.getKey() instanceof TCReferable) || myCurrentDefinitions.contains(entry.getValue())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>TCReferable targetReferable = <MASK><NEW_LINE>List<String> longName = new ArrayList<>();<NEW_LINE>ModuleLocation targetModuleLocation = LocatedReferable.Helper.getLocation(targetReferable, longName);<NEW_LINE>if (targetModuleLocation == null || longName.isEmpty()) {<NEW_LINE>myErrorReporter.report(LocationError.definition(targetReferable, modulePath));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Map<String, CallTargetTree> map = moduleCallTargets.computeIfAbsent(targetModuleLocation.getModulePath(), k -> new HashMap<>());<NEW_LINE>CallTargetTree tree = null;<NEW_LINE>for (String name : longName) {<NEW_LINE>tree = map.computeIfAbsent(name, k -> new CallTargetTree(0));<NEW_LINE>map = tree.subtreeMap;<NEW_LINE>}<NEW_LINE>assert tree != null;<NEW_LINE>tree.index = entry.getValue();<NEW_LINE>}<NEW_LINE>for (Map.Entry<ModulePath, Map<String, CallTargetTree>> entry : moduleCallTargets.entrySet()) {<NEW_LINE>ModuleProtos.ModuleCallTargets.Builder builder = ModuleProtos.ModuleCallTargets.newBuilder();<NEW_LINE>builder.addAllName(entry.getKey().toList());<NEW_LINE>for (Map.Entry<String, CallTargetTree> treeEntry : entry.getValue().entrySet()) {<NEW_LINE>builder.addCallTargetTree(writeCallTargetTree(treeEntry.getKey(), treeEntry.getValue()));<NEW_LINE>}<NEW_LINE>out.addModuleCallTargets(builder.build());<NEW_LINE>}<NEW_LINE>return out.build();<NEW_LINE>} | (TCReferable) entry.getKey(); |
580,712 | public Object doOperation(final AddNamedView operation, final Context context, final Store store) throws OperationException {<NEW_LINE>if (null == operation.getName() || operation.getName().isEmpty()) {<NEW_LINE>throw new IllegalArgumentException("NamedView name must be set and not empty");<NEW_LINE>}<NEW_LINE>final NamedViewDetail namedViewDetail = new NamedViewDetail.Builder().name(operation.getName()).view(operation.getViewAsString()).description(operation.getDescription()).creatorId(context.getUser().getUserId()).writers(operation.getWriteAccessRoles()).parameters(operation.getParameters()).readAccessPredicate(operation.getReadAccessPredicate()).writeAccessPredicate(operation.getWriteAccessPredicate()).build();<NEW_LINE>validate(namedViewDetail.getViewWithDefaultParams(), namedViewDetail);<NEW_LINE>try {<NEW_LINE>cache.addNamedView(namedViewDetail, operation.isOverwriteFlag(), context.getUser(), store.<MASK><NEW_LINE>} catch (final CacheOperationFailedException e) {<NEW_LINE>throw new OperationException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | getProperties().getAdminAuth()); |
1,243,401 | public static DistancePredicate createDistancePredicate(double lat, double lon, double radiusMeters) {<NEW_LINE>final Rectangle boundingBox = Rectangle.fromPointDistance(lat, lon, radiusMeters);<NEW_LINE>final double axisLat = Rectangle.axisLat(lat, radiusMeters);<NEW_LINE>final double distanceSortKey = GeoUtils.distanceQuerySortKey(radiusMeters);<NEW_LINE>final Function<Rectangle, Relation> boxToRelation = box -> GeoUtils.relate(box.minLat, box.maxLat, box.minLon, box.maxLon, lat, lon, distanceSortKey, axisLat);<NEW_LINE>final Grid subBoxes = createSubBoxes(boundingBox.minLat, boundingBox.maxLat, boundingBox.minLon, boundingBox.maxLon, boxToRelation);<NEW_LINE>return new DistancePredicate(subBoxes.latShift, subBoxes.lonShift, subBoxes.latBase, subBoxes.lonBase, subBoxes.maxLatDelta, subBoxes.maxLonDelta, subBoxes.<MASK><NEW_LINE>} | relations, lat, lon, distanceSortKey); |
981,546 | public void run() throws Exception {<NEW_LINE>if (currentProgram == null) {<NEW_LINE>println("There is no open program");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RecoveredClassHelper classHelper = new RecoveredClassHelper(currentProgram, currentLocation, state.getTool(), this, false, false, false, false, monitor);<NEW_LINE>DataTypeManagerService dtms = state.getTool().getService(DataTypeManagerService.class);<NEW_LINE>List<DataType> selectedDatatypes = dtms.getSelectedDatatypes();<NEW_LINE>if (selectedDatatypes.size() == 0) {<NEW_LINE>println("Please select the class function definition(s) you wish to apply.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<FunctionDefinition> classFunctionDefinitions = new ArrayList<FunctionDefinition>();<NEW_LINE>for (DataType selectedDataType : selectedDatatypes) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>if (!(selectedDataType instanceof FunctionDefinition)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>FunctionDefinition functionDefinition = (FunctionDefinition) selectedDataType;<NEW_LINE>String pathName = functionDefinition.getPathName();<NEW_LINE>if (!pathName.contains("ClassDataTypes")) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>classFunctionDefinitions.add(functionDefinition);<NEW_LINE>}<NEW_LINE>if (classFunctionDefinitions.isEmpty()) {<NEW_LINE>println("Selected function definition(s) must be in a subfolder of the ClassDataTypes folder in the DataTypeManager.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Object> changedItems = new ArrayList<Object>();<NEW_LINE>for (FunctionDefinition functionDef : classFunctionDefinitions) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>List<Object> newChangedItems = classHelper.applyNewFunctionDefinition(functionDef);<NEW_LINE>changedItems = classHelper.updateList(changedItems, newChangedItems);<NEW_LINE>}<NEW_LINE>if (changedItems == null || changedItems.isEmpty()) {<NEW_LINE>println("There were no differences between the selected function definitions and the items that could be updated.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Structure> <MASK><NEW_LINE>List<Function> functionsOnList = classHelper.getFunctionsOnList(changedItems);<NEW_LINE>if (!structuresOnList.isEmpty()) {<NEW_LINE>println();<NEW_LINE>println("Updated structures:");<NEW_LINE>for (Structure structure : structuresOnList) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>println(structure.getPathName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!functionsOnList.isEmpty()) {<NEW_LINE>println();<NEW_LINE>println("Updated functions:");<NEW_LINE>for (Function function : functionsOnList) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>println(function.getEntryPoint().toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | structuresOnList = classHelper.getStructuresOnList(changedItems); |
349,982 | protected void applyEvalLeaveFiltered(CodegenMethod method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope) {<NEW_LINE>int numFilters = factory.getParent().getOptionalFilter<MASK><NEW_LINE>EPTypeClass firstType = (EPTypeClass) forges[0].getEvaluationType();<NEW_LINE>CodegenExpression firstExpr = forges[0].evaluateCodegen(EPTypePremade.LONGPRIMITIVE.getEPType(), method, symbols, classScope);<NEW_LINE>method.getBlock().assignRef(oldest, SimpleNumberCoercerFactory.SimpleNumberCoercerLong.codegenLong(firstExpr, firstType)).ifCondition(not(isSet)).assignRef(isSet, constantTrue());<NEW_LINE>if (forges.length == numFilters + 1) {<NEW_LINE>method.getBlock().decrement(accumulator);<NEW_LINE>} else {<NEW_LINE>EPTypeClass secondType = (EPTypeClass) forges[1].getEvaluationType();<NEW_LINE>CodegenExpression secondExpr = forges[1].evaluateCodegen(EPTypePremade.DOUBLEPRIMITIVE.getEPType(), method, symbols, classScope);<NEW_LINE>method.getBlock().assignCompound(accumulator, "-", SimpleNumberCoercerFactory.SimpleNumberCoercerDouble.codegenDouble(secondExpr, secondType));<NEW_LINE>}<NEW_LINE>} | () != null ? 1 : 0; |
1,570,328 | public static GetRepositoryCommitResponse unmarshall(GetRepositoryCommitResponse getRepositoryCommitResponse, UnmarshallerContext _ctx) {<NEW_LINE>getRepositoryCommitResponse.setRequestId(_ctx.stringValue("GetRepositoryCommitResponse.RequestId"));<NEW_LINE>getRepositoryCommitResponse.setErrorCode(_ctx.stringValue("GetRepositoryCommitResponse.ErrorCode"));<NEW_LINE>getRepositoryCommitResponse.setErrorMessage(_ctx.stringValue("GetRepositoryCommitResponse.ErrorMessage"));<NEW_LINE>getRepositoryCommitResponse.setSuccess<MASK><NEW_LINE>Result result = new Result();<NEW_LINE>result.setAuthorDate(_ctx.stringValue("GetRepositoryCommitResponse.Result.AuthorDate"));<NEW_LINE>result.setAuthorEmail(_ctx.stringValue("GetRepositoryCommitResponse.Result.AuthorEmail"));<NEW_LINE>result.setAuthorName(_ctx.stringValue("GetRepositoryCommitResponse.Result.AuthorName"));<NEW_LINE>result.setCommittedDate(_ctx.stringValue("GetRepositoryCommitResponse.Result.CommittedDate"));<NEW_LINE>result.setCommitterEmail(_ctx.stringValue("GetRepositoryCommitResponse.Result.CommitterEmail"));<NEW_LINE>result.setCommitterName(_ctx.stringValue("GetRepositoryCommitResponse.Result.CommitterName"));<NEW_LINE>result.setCreatedAt(_ctx.stringValue("GetRepositoryCommitResponse.Result.CreatedAt"));<NEW_LINE>result.setId(_ctx.stringValue("GetRepositoryCommitResponse.Result.Id"));<NEW_LINE>result.setMessage(_ctx.stringValue("GetRepositoryCommitResponse.Result.Message"));<NEW_LINE>result.setShortId(_ctx.stringValue("GetRepositoryCommitResponse.Result.ShortId"));<NEW_LINE>result.setTitle(_ctx.stringValue("GetRepositoryCommitResponse.Result.Title"));<NEW_LINE>List<String> parentIds = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetRepositoryCommitResponse.Result.ParentIds.Length"); i++) {<NEW_LINE>parentIds.add(_ctx.stringValue("GetRepositoryCommitResponse.Result.ParentIds[" + i + "]"));<NEW_LINE>}<NEW_LINE>result.setParentIds(parentIds);<NEW_LINE>Signature signature = new Signature();<NEW_LINE>signature.setGpgKeyId(_ctx.stringValue("GetRepositoryCommitResponse.Result.Signature.GpgKeyId"));<NEW_LINE>signature.setVerificationStatus(_ctx.stringValue("GetRepositoryCommitResponse.Result.Signature.VerificationStatus"));<NEW_LINE>result.setSignature(signature);<NEW_LINE>getRepositoryCommitResponse.setResult(result);<NEW_LINE>return getRepositoryCommitResponse;<NEW_LINE>} | (_ctx.booleanValue("GetRepositoryCommitResponse.Success")); |
1,231,153 | public Flux<MultiValueResponse<HGetCommand, ByteBuffer>> hMGet(Publisher<HGetCommand> commands) {<NEW_LINE>return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {<NEW_LINE>Assert.notNull(command.getKey(), "Key must not be null!");<NEW_LINE>Assert.notNull(command.getFields(), "Fields must not be null!");<NEW_LINE>Mono<List<KeyValue<ByteBuffer, ByteBuffer>>> result;<NEW_LINE>if (command.getFields().size() == 1) {<NEW_LINE>ByteBuffer key = command.getFields().iterator().next();<NEW_LINE>result = cmd.hget(command.getKey(), key.duplicate()).map(value -> KeyValue.fromNullable(key, value)).defaultIfEmpty(KeyValue.empty(key)).map(Collections::singletonList);<NEW_LINE>} else {<NEW_LINE>result = cmd.hmget(command.getKey(), command.getFields().stream().toArray(ByteBuffer[]<MASK><NEW_LINE>}<NEW_LINE>return result.map(value -> new MultiValueResponse<>(command, value.stream().map(keyValue -> keyValue.getValueOrElse(null)).collect(Collectors.toList())));<NEW_LINE>}));<NEW_LINE>} | ::new)).collectList(); |
1,369,581 | public CompletableFuture<Void> attach(Map<String, Object> args) {<NEW_LINE>try {<NEW_LINE>clearState();<NEW_LINE>context.<MASK><NEW_LINE>clientConfigHolder = new ClientAttachConfigHolder(args);<NEW_LINE>context.setSourceProject(loadProject(clientConfigHolder.getSourcePath()));<NEW_LINE>ClientAttachConfigHolder configHolder = (ClientAttachConfigHolder) clientConfigHolder;<NEW_LINE>String hostName = configHolder.getHostName().orElse("");<NEW_LINE>int portName = configHolder.getDebuggePort();<NEW_LINE>attachToRemoteVM(hostName, portName);<NEW_LINE>} catch (Exception e) {<NEW_LINE>String host = ((ClientAttachConfigHolder) clientConfigHolder).getHostName().orElse(LOCAL_HOST);<NEW_LINE>String portName;<NEW_LINE>try {<NEW_LINE>portName = Integer.toString(clientConfigHolder.getDebuggePort());<NEW_LINE>} catch (ClientConfigurationException clientConfigurationException) {<NEW_LINE>portName = VALUE_UNKNOWN;<NEW_LINE>}<NEW_LINE>LOGGER.error(e.getMessage());<NEW_LINE>outputLogger.sendErrorOutput(String.format("Failed to attach to the target VM, address: '%s:%s'.", host, portName));<NEW_LINE>terminateDebugServer(context.getDebuggeeVM() != null, false);<NEW_LINE>}<NEW_LINE>return CompletableFuture.completedFuture(null);<NEW_LINE>} | setDebugMode(ExecutionContext.DebugMode.ATTACH); |
877,764 | public static void main(final String[] args) {<NEW_LINE>// Instantiate a client that will be used to call the service.<NEW_LINE>DocumentModelAdministrationClient client = new DocumentModelAdministrationClientBuilder().credential(new AzureKeyCredential("{key}")).endpoint("https://{endpoint}.cognitiveservices.azure.com/").buildClient();<NEW_LINE>// Build custom document analysis model<NEW_LINE>String model1TrainingFiles = "{SAS_URL_of_your_container_in_blob_storage_for_model_1}";<NEW_LINE>// The shared access signature (SAS) Url of your Azure Blob Storage container with your forms.<NEW_LINE>SyncPoller<DocumentOperationResult, DocumentModel> model1Poller = client.beginBuildModel(model1TrainingFiles, DocumentBuildMode.TEMPLATE);<NEW_LINE>// Build custom document analysis model<NEW_LINE>String model2TrainingFiles = "{SAS_URL_of_your_container_in_blob_storage_for_model_2}";<NEW_LINE>// The shared access signature (SAS) Url of your Azure Blob Storage container with your forms.<NEW_LINE>SyncPoller<DocumentOperationResult, DocumentModel> model2Poller = client.<MASK><NEW_LINE>String labeledModelId1 = model1Poller.getFinalResult().getModelId();<NEW_LINE>String labeledModelId2 = model2Poller.getFinalResult().getModelId();<NEW_LINE>String composedModelId = "my-composed-model";<NEW_LINE>final DocumentModel documentModel = client.beginCreateComposedModel(Arrays.asList(labeledModelId1, labeledModelId2), new CreateComposedModelOptions().setDescription("my composed model description"), Context.NONE).setPollInterval(Duration.ofSeconds(5)).getFinalResult();<NEW_LINE>System.out.printf("Model ID: %s%n", documentModel.getModelId());<NEW_LINE>System.out.printf("Model description: %s%n", documentModel.getDescription());<NEW_LINE>System.out.printf("Composed model created on: %s%n", documentModel.getCreatedOn());<NEW_LINE>System.out.println("Document Fields:");<NEW_LINE>documentModel.getDocTypes().forEach((key, docTypeInfo) -> {<NEW_LINE>docTypeInfo.getFieldSchema().forEach((field, documentFieldSchema) -> {<NEW_LINE>System.out.printf("Field: %s", field);<NEW_LINE>System.out.printf("Field type: %s", documentFieldSchema.getType());<NEW_LINE>System.out.printf("Field confidence: %.2f", docTypeInfo.getFieldConfidence().get(field));<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | beginBuildModel(model2TrainingFiles, DocumentBuildMode.TEMPLATE); |
1,792,216 | public void onActivityCreated(final Activity activity, Bundle savedInstanceState) {<NEW_LINE>if (useFrameMetrics) {<NEW_LINE>this.refreshRate = (int) activity.getWindowManager().getDefaultDisplay().getRefreshRate();<NEW_LINE>this.frameIntervalNs = Constants.TIME_SECOND_TO_NANO / (long) refreshRate;<NEW_LINE>Window.OnFrameMetricsAvailableListener onFrameMetricsAvailableListener = new Window.OnFrameMetricsAvailableListener() {<NEW_LINE><NEW_LINE>@RequiresApi(api = Build.VERSION_CODES.O)<NEW_LINE>@Override<NEW_LINE>public void onFrameMetricsAvailable(Window window, FrameMetrics frameMetrics, int dropCountSinceLastInvocation) {<NEW_LINE>FrameMetrics frameMetricsCopy = new FrameMetrics(frameMetrics);<NEW_LINE>long vsynTime = frameMetricsCopy.getMetric(FrameMetrics.VSYNC_TIMESTAMP);<NEW_LINE>long intendedVsyncTime = frameMetricsCopy.getMetric(FrameMetrics.INTENDED_VSYNC_TIMESTAMP);<NEW_LINE>frameMetricsCopy.getMetric(FrameMetrics.DRAW_DURATION);<NEW_LINE>notifyListener(AppActiveMatrixDelegate.INSTANCE.getVisibleScene(), intendedVsyncTime, vsynTime, true, intendedVsyncTime, 0, 0, 0);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>this.frameListenerMap.put(activity.hashCode(), onFrameMetricsAvailableListener);<NEW_LINE>activity.getWindow().addOnFrameMetricsAvailableListener<MASK><NEW_LINE>MatrixLog.i(TAG, "onActivityCreated addOnFrameMetricsAvailableListener");<NEW_LINE>}<NEW_LINE>} | (onFrameMetricsAvailableListener, new Handler()); |
436,297 | void update(final T item, final double weight, final boolean mark) {<NEW_LINE>if (item == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (weight <= 0.0) {<NEW_LINE>throw new SketchesArgumentException("Item weights must be strictly positive: " + weight + ", for item " + item.toString());<NEW_LINE>}<NEW_LINE>++n_;<NEW_LINE>if (r_ == 0) {<NEW_LINE>// exact mode<NEW_LINE>updateWarmupPhase(item, weight, mark);<NEW_LINE>} else {<NEW_LINE>// sketch is in estimation mode, so we can make the following check<NEW_LINE>assert (h_ == 0) || (peekMin() >= getTau());<NEW_LINE>// what tau would be if deletion candidates turn out to be R plus the new item<NEW_LINE>// note: (r_ + 1) - 1 is intentional<NEW_LINE>final double hypotheticalTau = (weight + totalWtR_) / (<MASK><NEW_LINE>// is new item's turn to be considered for reservoir?<NEW_LINE>final boolean condition1 = (h_ == 0) || (weight <= peekMin());<NEW_LINE>// is new item light enough for reservoir?<NEW_LINE>final boolean condition2 = weight < hypotheticalTau;<NEW_LINE>if (condition1 && condition2) {<NEW_LINE>updateLight(item, weight, mark);<NEW_LINE>} else if (r_ == 1) {<NEW_LINE>updateHeavyREq1(item, weight, mark);<NEW_LINE>} else {<NEW_LINE>updateHeavyGeneral(item, weight, mark);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (r_ + 1) - 1); |
257,082 | public static void convertMultiMap(Map<String, List<Object>> map, Consumer<StringProperty.Builder> stringInserter, Consumer<TensorProperty.Builder> tensorInserter) {<NEW_LINE>for (var entry : map.entrySet()) {<NEW_LINE>if (entry.getValue() != null) {<NEW_LINE>var key = entry.getKey();<NEW_LINE>var stringValues = new LinkedList<String>();<NEW_LINE>for (var value : entry.getValue()) {<NEW_LINE>if (value != null) {<NEW_LINE>if (value instanceof Tensor) {<NEW_LINE>byte[] tensor = TypedBinaryFormat.encode((Tensor) value);<NEW_LINE>tensorInserter.accept(TensorProperty.newBuilder().setName(key).setValue(ByteString.copyFrom(tensor)));<NEW_LINE>} else {<NEW_LINE>stringValues.add(value.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!stringValues.isEmpty()) {<NEW_LINE>stringInserter.accept(StringProperty.newBuilder().setName(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | key).addAllValues(stringValues)); |
232,269 | private static MetadataIndexNode generateRootNode(Queue<MetadataIndexNode> metadataIndexNodeQueue, TsFileOutput out, MetadataIndexNodeType type) throws IOException {<NEW_LINE>int queueSize = metadataIndexNodeQueue.size();<NEW_LINE>MetadataIndexNode metadataIndexNode;<NEW_LINE><MASK><NEW_LINE>while (queueSize != 1) {<NEW_LINE>for (int i = 0; i < queueSize; i++) {<NEW_LINE>metadataIndexNode = metadataIndexNodeQueue.poll();<NEW_LINE>// when constructing from internal node, each node is related to an entry<NEW_LINE>if (currentIndexNode.isFull()) {<NEW_LINE>addCurrentIndexNodeToQueue(currentIndexNode, metadataIndexNodeQueue, out);<NEW_LINE>currentIndexNode = new MetadataIndexNode(type);<NEW_LINE>}<NEW_LINE>currentIndexNode.addEntry(new MetadataIndexEntry(metadataIndexNode.peek().getName(), out.getPosition()));<NEW_LINE>metadataIndexNode.serializeTo(out.wrapAsStream());<NEW_LINE>}<NEW_LINE>addCurrentIndexNodeToQueue(currentIndexNode, metadataIndexNodeQueue, out);<NEW_LINE>currentIndexNode = new MetadataIndexNode(type);<NEW_LINE>queueSize = metadataIndexNodeQueue.size();<NEW_LINE>}<NEW_LINE>return metadataIndexNodeQueue.poll();<NEW_LINE>} | MetadataIndexNode currentIndexNode = new MetadataIndexNode(type); |
1,416,233 | public void addNodeSet(INodeSet nodeSet) {<NEW_LINE>NodeSetImpl iNodeEntries = new NodeSetImpl();<NEW_LINE>for (INodeEntry iNodeEntry : nodeSet) {<NEW_LINE>INodeEntry node = getNode(iNodeEntry.getNodename());<NEW_LINE>if (null != node) {<NEW_LINE>// merge attributes<NEW_LINE>HashMap<String, String> newAttributes = new HashMap<String, String<MASK><NEW_LINE>// merge tags<NEW_LINE>HashSet tags = new HashSet();<NEW_LINE>if (null != node.getTags()) {<NEW_LINE>tags.addAll(node.getTags());<NEW_LINE>}<NEW_LINE>if (null != iNodeEntry.getTags()) {<NEW_LINE>tags.addAll(iNodeEntry.getTags());<NEW_LINE>}<NEW_LINE>newAttributes.putAll(iNodeEntry.getAttributes());<NEW_LINE>NodeEntryImpl nodeEntry = new NodeEntryImpl(iNodeEntry.getNodename());<NEW_LINE>nodeEntry.setAttributes(newAttributes);<NEW_LINE>nodeEntry.setTags(tags);<NEW_LINE>iNodeEntries.putNode(nodeEntry);<NEW_LINE>} else {<NEW_LINE>iNodeEntries.putNode(iNodeEntry);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>super.addNodeSet(iNodeEntries);<NEW_LINE>} | >(node.getAttributes()); |
528,827 | // Based on the explanation at https://algs4.cs.princeton.edu/61event/<NEW_LINE>public double timeToHit(Particle3D otherParticle) {<NEW_LINE>if (this == otherParticle) {<NEW_LINE>return Double.POSITIVE_INFINITY;<NEW_LINE>}<NEW_LINE>double deltaPositionX = otherParticle.positionX - positionX;<NEW_LINE>double deltaPositionY = otherParticle.positionY - positionY;<NEW_LINE><MASK><NEW_LINE>double deltaVelocityX = otherParticle.velocityX - velocityX;<NEW_LINE>double deltaVelocityY = otherParticle.velocityY - velocityY;<NEW_LINE>double deltaVelocityZ = otherParticle.velocityZ - velocityZ;<NEW_LINE>double deltaPositionByDeltaVelocity = deltaPositionX * deltaVelocityX + deltaPositionY * deltaVelocityY + deltaPositionZ * deltaVelocityZ;<NEW_LINE>if (deltaPositionByDeltaVelocity > 0) {<NEW_LINE>return Double.POSITIVE_INFINITY;<NEW_LINE>}<NEW_LINE>double deltaVelocitySquared = deltaVelocityX * deltaVelocityX + deltaVelocityY * deltaVelocityY + deltaVelocityZ * deltaVelocityZ;<NEW_LINE>double deltaPositionSquared = deltaPositionX * deltaPositionX + deltaPositionY * deltaPositionY + deltaPositionZ * deltaPositionZ;<NEW_LINE>double distanceBetweenCenters = radius + otherParticle.radius;<NEW_LINE>double distanceBetweenCentersSquared = distanceBetweenCenters * distanceBetweenCenters;<NEW_LINE>// Check if particles overlap<NEW_LINE>if (deltaPositionSquared < distanceBetweenCentersSquared) {<NEW_LINE>throw new IllegalStateException("Invalid state: overlapping particles. No two objects can occupy the same space " + "at the same time.");<NEW_LINE>}<NEW_LINE>double distance = (deltaPositionByDeltaVelocity * deltaPositionByDeltaVelocity) - deltaVelocitySquared * (deltaPositionSquared - distanceBetweenCentersSquared);<NEW_LINE>if (distance < 0) {<NEW_LINE>return Double.POSITIVE_INFINITY;<NEW_LINE>}<NEW_LINE>return -(deltaPositionByDeltaVelocity + Math.sqrt(distance)) / deltaVelocitySquared;<NEW_LINE>} | double deltaPositionZ = otherParticle.positionZ - positionZ; |
977,306 | private void initializeView(AttributeSet attrs, int defStyleAttr) {<NEW_LINE>if (attrs != null && !isInEditMode()) {<NEW_LINE>final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.KeyboardButtonView, defStyleAttr, 0);<NEW_LINE>String text = attributes.getString(R.styleable.KeyboardButtonView_lp_keyboard_button_text);<NEW_LINE>Drawable image = attributes.getDrawable(R.styleable.KeyboardButtonView_lp_keyboard_button_image);<NEW_LINE>boolean rippleEnabled = attributes.getBoolean(R.styleable.KeyboardButtonView_lp_keyboard_button_ripple_enabled, true);<NEW_LINE>attributes.recycle();<NEW_LINE>LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);<NEW_LINE>KeyboardButtonView view = (KeyboardButtonView) inflater.inflate(R.layout.view_keyboard_button, this);<NEW_LINE>if (text != null) {<NEW_LINE>TextView textView = (TextView) view.<MASK><NEW_LINE>if (textView != null) {<NEW_LINE>textView.setText(text);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (image != null) {<NEW_LINE>ImageView imageView = (ImageView) view.findViewById(R.id.keyboard_button_imageview);<NEW_LINE>if (imageView != null) {<NEW_LINE>imageView.setImageDrawable(image);<NEW_LINE>imageView.setVisibility(View.VISIBLE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mRippleView = (RippleView) view.findViewById(R.id.pin_code_keyboard_button_ripple);<NEW_LINE>mRippleView.setRippleAnimationListener(this);<NEW_LINE>if (mRippleView != null) {<NEW_LINE>if (!rippleEnabled) {<NEW_LINE>mRippleView.setVisibility(View.INVISIBLE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | findViewById(R.id.keyboard_button_textview); |
284,037 | public static void removeServiceFromDD(Project prj, JaxWsService service) throws IOException {<NEW_LINE>WebApp webApp = getWebApp(prj);<NEW_LINE>if (webApp != null) {<NEW_LINE>boolean changed = removeServiceFromDD(webApp, service.getServiceName());<NEW_LINE>// determine if there are other web services in the project<NEW_LINE>// if none, remove the listener<NEW_LINE>boolean hasMoreWebServices = false;<NEW_LINE>Servlet[] remainingServlets = webApp.getServlet();<NEW_LINE>for (int i = 0; i < remainingServlets.length; i++) {<NEW_LINE>if (SERVLET_CLASS_NAME.equals(remainingServlets[i].getServletClass())) {<NEW_LINE>hasMoreWebServices = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!hasMoreWebServices) {<NEW_LINE>Listener[<MASK><NEW_LINE>for (int i = 0; i < listeners.length; i++) {<NEW_LINE>Listener listener = listeners[i];<NEW_LINE>if (SERVLET_LISTENER.equals(listener.getListenerClass())) {<NEW_LINE>webApp.removeListener(listener);<NEW_LINE>changed = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (changed) {<NEW_LINE>webApp.write(getDeploymentDescriptor(prj));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] listeners = webApp.getListener(); |
203,098 | private void deleteOldLogs() {<NEW_LINE><MASK><NEW_LINE>PriorityQueue<PathByTimestamp> queue = new PriorityQueue<>();<NEW_LINE>long totalSize = 0;<NEW_LINE>try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(baseFilePath.getParent())) {<NEW_LINE>for (Path path : dirStream) {<NEW_LINE>try {<NEW_LINE>Date timestamp = parseLogFileTimestamp(path);<NEW_LINE>long size = Files.size(path);<NEW_LINE>totalSize += size;<NEW_LINE>if (!output.getPath().equals(path)) {<NEW_LINE>queue.add(new PathByTimestamp(path, timestamp, size));<NEW_LINE>}<NEW_LINE>} catch (ParseException e) {<NEW_LINE>// Ignore files which don't look like our logs.<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (totalLimitBytes > 0) {<NEW_LINE>while (totalSize > totalLimitBytes && !queue.isEmpty()) {<NEW_LINE>PathByTimestamp entry = queue.poll();<NEW_LINE>Files.delete(entry.getPath());<NEW_LINE>totalSize -= entry.getSize();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>reportError("Failed to clean up old log files", e, ErrorManager.GENERIC_FAILURE);<NEW_LINE>}<NEW_LINE>} | checkState(baseFilePath.isAbsolute()); |
991,339 | protected Void execute(CommandContext commandContext, TaskEntity task) {<NEW_LINE>if (StringUtils.isNotEmpty(task.getScopeId()) && ScopeTypes.CMMN.equals(task.getScopeType())) {<NEW_LINE>throw new FlowableException("The task instance is created by the cmmn engine and should be completed via the cmmn engine API");<NEW_LINE>}<NEW_LINE>// Backwards compatibility<NEW_LINE>if (task.getProcessDefinitionId() != null) {<NEW_LINE>if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, task.getProcessDefinitionId())) {<NEW_LINE>Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();<NEW_LINE>if (transientVariables == null) {<NEW_LINE>if (variablesLocal != null) {<NEW_LINE>compatibilityHandler.completeTask(task, variablesLocal, true);<NEW_LINE>} else {<NEW_LINE>compatibilityHandler.completeTask(task, variables, false);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>compatibilityHandler.completeTask(task, variables, transientVariables);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TaskHelper.completeTask(task, variables, <MASK><NEW_LINE>return null;<NEW_LINE>} | variablesLocal, transientVariables, transientVariablesLocal, commandContext); |
1,344,012 | public void render(@Nullable TileBellows bellows, float f, PoseStack ms, MultiBufferSource buffers, int light, int overlay) {<NEW_LINE>ms.pushPose();<NEW_LINE>ms.translate(0.5F, 1.5F, 0.5F);<NEW_LINE>ms.scale(1F, -1F, -1F);<NEW_LINE>float angle = 0;<NEW_LINE>if (bellows != null) {<NEW_LINE>switch(bellows.getBlockState().getValue(BlockStateProperties.HORIZONTAL_FACING)) {<NEW_LINE>case SOUTH:<NEW_LINE>break;<NEW_LINE>case NORTH:<NEW_LINE>angle = 180F;<NEW_LINE>break;<NEW_LINE>case EAST:<NEW_LINE>angle = 270F;<NEW_LINE>break;<NEW_LINE>case WEST:<NEW_LINE>angle = 90F;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ms.mulPose(Vector3f.YP.rotationDegrees(angle));<NEW_LINE>float fract = Math.max(0.1F, 1F - (bellows == null ? 0 : bellows.movePos + bellows<MASK><NEW_LINE>VertexConsumer buffer = buffers.getBuffer(model.renderType(texture));<NEW_LINE>model.render(ms, buffer, light, overlay, 1, 1, 1, 1, fract);<NEW_LINE>ms.popPose();<NEW_LINE>} | .moving * f + 0.1F)); |
13,635 | public YearlySchedule parse(XContentParser parser) throws IOException {<NEW_LINE>if (parser.currentToken() == XContentParser.Token.START_OBJECT) {<NEW_LINE>try {<NEW_LINE>return new YearlySchedule(YearTimes.parse(parser, parser.currentToken()));<NEW_LINE>} catch (ElasticsearchParseException pe) {<NEW_LINE>throw new ElasticsearchParseException("could not parse [{}] schedule. invalid year times", pe, TYPE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (parser.currentToken() == XContentParser.Token.START_ARRAY) {<NEW_LINE>List<YearTimes> times = new ArrayList<>();<NEW_LINE>XContentParser.Token token;<NEW_LINE>while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {<NEW_LINE>try {<NEW_LINE>times.add(YearTimes.parse(parser, token));<NEW_LINE>} catch (ElasticsearchParseException pe) {<NEW_LINE>throw new ElasticsearchParseException("could not parse [{}] schedule. invalid year times", pe, TYPE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return times.isEmpty() ? new YearlySchedule() : new YearlySchedule(times.toArray(new YearTimes[<MASK><NEW_LINE>}<NEW_LINE>throw new ElasticsearchParseException("could not parse [{}] schedule. expected either an object or an array " + "of objects representing year times, but found [{}] instead", TYPE, parser.currentToken());<NEW_LINE>} | times.size()])); |
1,177,224 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {<NEW_LINE>String identityZoneIdFromHeader = request.getHeader(HEADER);<NEW_LINE>String <MASK><NEW_LINE>if (StringUtils.isEmpty(identityZoneIdFromHeader) && StringUtils.isEmpty(identityZoneSubDomainFromHeader)) {<NEW_LINE>filterChain.doFilter(request, response);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>IdentityZone identityZone = validateIdentityZone(identityZoneIdFromHeader, identityZoneSubDomainFromHeader);<NEW_LINE>if (identityZone == null) {<NEW_LINE>response.sendError(HttpServletResponse.SC_NOT_FOUND, "Identity zone with id/subdomain " + identityZoneIdFromHeader + "/" + identityZoneSubDomainFromHeader + " does not exist");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String identityZoneId = identityZone.getId();<NEW_LINE>OAuth2Authentication oAuth2Authentication = getAuthenticationForZone(identityZoneId, request);<NEW_LINE>if (IdentityZoneHolder.isUaa() && oAuth2Authentication != null && !oAuth2Authentication.getOAuth2Request().getScope().isEmpty()) {<NEW_LINE>SecurityContextHolder.getContext().setAuthentication(oAuth2Authentication);<NEW_LINE>} else {<NEW_LINE>response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not authorized to switch to IdentityZone with id " + identityZoneId);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>IdentityZone originalIdentityZone = IdentityZoneHolder.get();<NEW_LINE>try {<NEW_LINE>IdentityZoneHolder.set(identityZone);<NEW_LINE>filterChain.doFilter(request, response);<NEW_LINE>} finally {<NEW_LINE>IdentityZoneHolder.set(originalIdentityZone);<NEW_LINE>}<NEW_LINE>} | identityZoneSubDomainFromHeader = request.getHeader(SUBDOMAIN_HEADER); |
1,380,223 | static <K> Comparator<K> create0(DependencyGraph<K> dependencyGraph, Map<String, AtomicLong> historicalServiceTimes, Function<K, String> toKey) {<NEW_LINE>final long defaultServiceTime = average(historicalServiceTimes.values());<NEW_LINE>final Map<K, Long> serviceTimes = new HashMap<>();<NEW_LINE>final Set<K> rootProjects = new HashSet<>();<NEW_LINE>dependencyGraph.getProjects().forEach(project -> {<NEW_LINE>long serviceTime = getServiceTime(historicalServiceTimes, project, defaultServiceTime, toKey);<NEW_LINE>serviceTimes.put(project, serviceTime);<NEW_LINE>if (dependencyGraph.isRoot(project)) {<NEW_LINE>rootProjects.add(project);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>final Map<K, Long> projectWeights = <MASK><NEW_LINE>return Comparator.comparingLong((ToLongFunction<K>) projectWeights::get).thenComparing(toKey, String::compareTo).reversed();<NEW_LINE>} | calculateWeights(dependencyGraph, serviceTimes, rootProjects); |
1,712,095 | protected Object createNode(JSContext context, JSBuiltin builtin, boolean construct, boolean newTarget, TemporalNow builtinEnum) {<NEW_LINE>switch(builtinEnum) {<NEW_LINE>case timeZone:<NEW_LINE>return TemporalNowTimeZoneNodeGen.create(context, builtin, args().fixedArgs(0).createArgumentNodes(context));<NEW_LINE>case instant:<NEW_LINE>return TemporalNowInstantNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>case plainDateTime:<NEW_LINE>return TemporalNowPlainDateTimeNodeGen.create(context, builtin, args().fixedArgs(<MASK><NEW_LINE>case plainDateTimeISO:<NEW_LINE>return TemporalNowPlainDateTimeISONodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case zonedDateTime:<NEW_LINE>return TemporalNowZonedDateTimeNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>case zonedDateTimeISO:<NEW_LINE>return TemporalNowZonedDateTimeISONodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case plainDate:<NEW_LINE>return TemporalNowPlainDateNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>case plainDateISO:<NEW_LINE>return TemporalNowPlainDateISONodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case plainTimeISO:<NEW_LINE>return TemporalNowPlainTimeISONodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | 2).createArgumentNodes(context)); |
1,823,348 | private void updateInsertionData(TreeSet<VersionedInsertionData>[] priorityQueues, Collection<VehicleRoute> routes, List<Job> unassignedJobList, int updateRound, boolean firstRun, VehicleRoute lastModified, Map<VehicleRoute, Integer> updates) {<NEW_LINE>for (Job unassignedJob : unassignedJobList) {<NEW_LINE>if (priorityQueues[unassignedJob.getIndex()] == null) {<NEW_LINE>priorityQueues[unassignedJob.getIndex()] = new TreeSet<>(InsertionDataUpdater.getComparator());<NEW_LINE>}<NEW_LINE>if (firstRun) {<NEW_LINE>InsertionDataUpdater.update(switchAllowed, initialVehicleIds, fleetManager, insertionCostsCalculator, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, routes);<NEW_LINE>for (VehicleRoute r : routes) updates.put(r, updateRound);<NEW_LINE>} else {<NEW_LINE>if (dependencyTypes == null || dependencyTypes[unassignedJob.getIndex()] == null) {<NEW_LINE>InsertionDataUpdater.update(switchAllowed, initialVehicleIds, fleetManager, insertionCostsCalculator, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, Arrays.asList(lastModified));<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>DependencyType dependencyType = dependencyTypes[unassignedJob.getIndex()];<NEW_LINE>if (dependencyType.equals(DependencyType.INTER_ROUTE) || dependencyType.equals(DependencyType.INTRA_ROUTE)) {<NEW_LINE>InsertionDataUpdater.update(switchAllowed, initialVehicleIds, fleetManager, insertionCostsCalculator, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, routes);<NEW_LINE>for (VehicleRoute r : routes) updates.put(r, updateRound);<NEW_LINE>} else {<NEW_LINE>InsertionDataUpdater.update(switchAllowed, initialVehicleIds, fleetManager, insertionCostsCalculator, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, Arrays.asList(lastModified));<NEW_LINE>updates.put(lastModified, updateRound);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | updates.put(lastModified, updateRound); |
82,815 | private void writeLastContent(final Throwable throwable, final ChannelFutureListener closeAction) {<NEW_LINE>boolean chunked = true;<NEW_LINE>if (lengthOptimization) {<NEW_LINE>if (throwable == null) {<NEW_LINE>int length = (firstChunk == null ? 0 : firstChunk.remaining());<NEW_LINE>HttpUtil.setTransferEncodingChunked(response, false);<NEW_LINE>HttpUtil.setContentLength(response, length);<NEW_LINE>chunked = false;<NEW_LINE>} else {<NEW_LINE>// headers not sent yet<NEW_LINE>response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);<NEW_LINE>// We are not using CombinedHttpHeaders<NEW_LINE>response.headers().set(HttpHeaderNames.TRAILER, Response.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (response != null) {<NEW_LINE>initWriteResponse();<NEW_LINE>}<NEW_LINE>LastHttpContent lastHttpContent = new DefaultLastHttpContent(Unpooled.EMPTY_BUFFER);<NEW_LINE>if (chunked) {<NEW_LINE>if (throwable != null) {<NEW_LINE>lastHttpContent.trailingHeaders().set(Response.STREAM_STATUS, 500).set(Response.STREAM_RESULT, throwable);<NEW_LINE>LOGGER.severe(() -> log("Upstream error while sending response: %s", throwable));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>channel.write(true, lastHttpContent, f -> f.addListener(completeOnFailureListener("An exception occurred when writing last http content.")).addListener(completeOnSuccessListener(throwable)).addListener(closeAction));<NEW_LINE>} | STREAM_STATUS + "," + Response.STREAM_RESULT); |
1,571,922 | public void init(IFilterConfig filterConfig) throws ServletException {<NEW_LINE>try {<NEW_LINE>// init the filter instance<NEW_LINE>_filterState = FILTER_STATE_INITIALIZING;<NEW_LINE>// LIDB-3598: begin<NEW_LINE>this._filterConfig = filterConfig;<NEW_LINE>if (_eventSource != null && _eventSource.hasFilterListeners()) {<NEW_LINE><MASK><NEW_LINE>// LIDB-3598: end<NEW_LINE>_filterInstance.init(filterConfig);<NEW_LINE>// LIDB-3598: begin<NEW_LINE>_eventSource.onFilterFinishInit(getFilterEvent());<NEW_LINE>// LIDB-3598: end<NEW_LINE>} else {<NEW_LINE>_filterInstance.init(filterConfig);<NEW_LINE>}<NEW_LINE>_filterState = FILTER_STATE_AVAILABLE;<NEW_LINE>} catch (Throwable th) {<NEW_LINE>if (_eventSource != null && _eventSource.hasFilterErrorListeners()) {<NEW_LINE>FilterErrorEvent errorEvent = getFilterErrorEvent(th);<NEW_LINE>_eventSource.onFilterInitError(errorEvent);<NEW_LINE>}<NEW_LINE>com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init", "111", this);<NEW_LINE>_filterState = FILTER_STATE_UNAVAILABLE;<NEW_LINE>throw new ServletException(MessageFormat.format("Filter [{0}]: could not be initialized", new Object[] { _filterName }), th);<NEW_LINE>}<NEW_LINE>} | _eventSource.onFilterStartInit(getFilterEvent()); |
324,863 | public boolean apply(Game game, Ability source) {<NEW_LINE>Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);<NEW_LINE>if (permanent != null) {<NEW_LINE>Player player = game.getPlayer(permanent.getControllerId());<NEW_LINE>if (player != null) {<NEW_LINE>Library library = player.getLibrary();<NEW_LINE>if (library.hasCards()) {<NEW_LINE>Cards cards = new CardsImpl();<NEW_LINE>Card toBattlefield = null;<NEW_LINE>for (Card card : library.getCards(game)) {<NEW_LINE>cards.add(card);<NEW_LINE>if (card.isCreature(game)) {<NEW_LINE>toBattlefield = card;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (toBattlefield != null) {<NEW_LINE>player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);<NEW_LINE>}<NEW_LINE>player.<MASK><NEW_LINE>cards.remove(toBattlefield);<NEW_LINE>if (!cards.isEmpty()) {<NEW_LINE>player.shuffleLibrary(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | revealCards(source, cards, game); |
352,050 | public PersistentProjectileEntity bukkitize(ArrowItem itemarrow, World world, ItemStack itemstack, LivingEntity entityliving) {<NEW_LINE>PlayerEntity entityhuman = (PlayerEntity) entityliving;<NEW_LINE>ItemStack itemstack1 = entityhuman.getArrowType(itemstack);<NEW_LINE>PersistentProjectileEntity entityarrow = itemarrow.createArrow(world, itemstack1, (LivingEntity) entityhuman);<NEW_LINE>cancel_BF = false;<NEW_LINE>boolean flag = entityhuman.abilities.creativeMode || EnchantmentHelper.getLevel(Enchantments.INFINITY, itemstack) > 0;<NEW_LINE>boolean flag1 = flag && itemstack1.getItem() == Items.ARROW;<NEW_LINE>entityarrow.setVelocity(entityhuman, entityhuman.pitch, entityhuman.<MASK><NEW_LINE>int k = EnchantmentHelper.getLevel(Enchantments.POWER, itemstack);<NEW_LINE>if (k > 0)<NEW_LINE>entityarrow.setDamage(entityarrow.getDamage() + (double) k * 0.5D + 0.5D);<NEW_LINE>int l = EnchantmentHelper.getLevel(Enchantments.PUNCH, itemstack);<NEW_LINE>if (l > 0)<NEW_LINE>entityarrow.setPunch(l);<NEW_LINE>if (EnchantmentHelper.getLevel(Enchantments.FLAME, itemstack) > 0)<NEW_LINE>entityarrow.setOnFireFor(100);<NEW_LINE>org.bukkit.event.entity.EntityShootBowEvent event = BukkitEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, entityhuman.getActiveHand(), 0f, !flag1);<NEW_LINE>if (event.isCancelled())<NEW_LINE>cancel_BF = true;<NEW_LINE>return entityarrow;<NEW_LINE>} | yaw, 0.0F, 3.0F, 1.0F); |
1,463,265 | protected ImmutableSet<Either<SymbolInformation, DocumentSymbol>> compute() {<NEW_LINE>status.setValue(HighlightedText.plain("Fetching symbols..."));<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>if (sp != null) {<NEW_LINE>String currentProviderName = sp.getName();<NEW_LINE>debug("Fetching " + currentProviderName);<NEW_LINE>String query = searchBox.getValue();<NEW_LINE>debug("Fetching symbols... from symbol provider, for '" + query + "'");<NEW_LINE>Collection<Either<SymbolInformation, DocumentSymbol>> fetched = sp.fetchFor(query);<NEW_LINE>if (keyBindings == null) {<NEW_LINE>status.setValue(HighlightedText.plain(currentProviderName));<NEW_LINE>} else {<NEW_LINE>status.setValue(HighlightedText.create().appendHighlight("Showing ").appendHighlight(currentProviderName).appendPlain(". Press [" + keyBindings + "] for ").appendPlain(nextSymbolsProvider().getName()));<NEW_LINE>}<NEW_LINE>return ImmutableSet.copyOf(fetched);<NEW_LINE>} else {<NEW_LINE>status.setValue(HighlightedText.plain("No symbol provider"));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>GotoSymbolPlugin.getInstance().getLog().log(ExceptionUtil.status(e));<NEW_LINE>status.setValue(HighlightedText.plain(ExceptionUtil.getMessage(e)));<NEW_LINE>}<NEW_LINE>return ImmutableSet.of();<NEW_LINE>} | SymbolsProvider sp = currentSymbolsProvider.getValue(); |
1,245,058 | private void applyData(int height) {<NEW_LINE>if (height > 0) {<NEW_LINE>phaseBarsItems.forEach(item -> {<NEW_LINE>int firstBlock = daoFacade.getFirstBlockOfPhaseForDisplay(height, item.getPhase());<NEW_LINE>int lastBlock = daoFacade.getLastBlockOfPhaseForDisplay(<MASK><NEW_LINE>int duration = daoFacade.getDurationForPhaseForDisplay(item.getPhase());<NEW_LINE>item.setPeriodRange(firstBlock, lastBlock, duration);<NEW_LINE>double progress = 0;<NEW_LINE>if (height >= firstBlock && height <= lastBlock) {<NEW_LINE>progress = (double) (height - firstBlock + 1) / (double) duration;<NEW_LINE>} else if (height < firstBlock) {<NEW_LINE>progress = 0;<NEW_LINE>} else if (height > lastBlock) {<NEW_LINE>progress = 1;<NEW_LINE>}<NEW_LINE>item.getProgressProperty().set(progress);<NEW_LINE>});<NEW_LINE>separatedPhaseBars.updateWidth();<NEW_LINE>}<NEW_LINE>} | height, item.getPhase()); |
1,126,561 | ImmutableMultimap<String, Path> groupFilesByLocale(ImmutableList<Path> files) {<NEW_LINE>ImmutableMultimap.Builder<String, Path> localeToFiles = ImmutableMultimap.builder();<NEW_LINE>for (Path filepath : files) {<NEW_LINE>String path = PathFormatter.pathWithUnixSeparators(filepath);<NEW_LINE>Matcher matcher = NON_ENGLISH_STRING_FILE_PATTERN.matcher(path);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>String baseLocale = matcher.group(1);<NEW_LINE>String country = matcher.group(2);<NEW_LINE>String locale = country == null ? baseLocale : baseLocale + "_" + country;<NEW_LINE>if (country != null && !regionSpecificToBaseLocaleMap.containsKey(locale)) {<NEW_LINE>regionSpecificToBaseLocaleMap.put(locale, baseLocale);<NEW_LINE>}<NEW_LINE>localeToFiles.put(locale, filepath);<NEW_LINE>} else {<NEW_LINE>if (!path.endsWith(ENGLISH_STRING_PATH_SUFFIX)) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>localeToFiles.put(ENGLISH_LOCALE, filepath);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return localeToFiles.build();<NEW_LINE>} | HumanReadableException("Invalid path passed to compile strings. Expected path to end with %s, got path %s.", ENGLISH_STRING_PATH_SUFFIX, path); |
1,134,002 | // private void loadFileList() {<NEW_LINE>private void createFileListAdapter() {<NEW_LINE>adapter = new ArrayAdapter<Item>(this, android.R.layout.select_dialog_item, android.R.id.text1, fileList) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public View getView(int position, View convertView, ViewGroup parent) {<NEW_LINE>// creates view<NEW_LINE>View view = super.getView(position, convertView, parent);<NEW_LINE>TextView textView = (TextView) view.findViewById(android.R.id.text1);<NEW_LINE>// put the image on the text view<NEW_LINE>int drawableID = 0;<NEW_LINE>if (fileList.get(position).icon != -1) {<NEW_LINE>// If icon == -1, then directory is empty<NEW_LINE>drawableID = <MASK><NEW_LINE>}<NEW_LINE>textView.setCompoundDrawablesWithIntrinsicBounds(drawableID, 0, 0, 0);<NEW_LINE>textView.setEllipsize(null);<NEW_LINE>// add margin between image and text (support various screen<NEW_LINE>// densities)<NEW_LINE>// int dp5 = (int) (5 *<NEW_LINE>// getResources().getDisplayMetrics().density + 0.5f);<NEW_LINE>int dp3 = (int) (3 * getResources().getDisplayMetrics().density + 0.5f);<NEW_LINE>// TODO: change next line for empty directory, so text will be<NEW_LINE>// centered<NEW_LINE>textView.setCompoundDrawablePadding(dp3);<NEW_LINE>textView.setBackgroundColor(Color.LTGRAY);<NEW_LINE>return view;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// adapter = new ArrayAdapter<Item>(this,<NEW_LINE>} | fileList.get(position).icon; |
565,641 | public boolean enterCaseNode(CaseNode caseNode) {<NEW_LINE>List<Statement> nodes = caseNode.getStatements();<NEW_LINE>if (nodes.size() == 1) {<NEW_LINE>Statement node = nodes.get(0);<NEW_LINE>if (node instanceof BlockStatement) {<NEW_LINE>return super.enterCaseNode(caseNode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (nodes.size() >= 1) {<NEW_LINE>// indentation mark<NEW_LINE>FormatToken formatToken = tokenUtils.getPreviousToken(getStart(nodes.get(0)<MASK><NEW_LINE>if (formatToken != null) {<NEW_LINE>TokenUtils.appendTokenAfterLastVirtual(formatToken, FormatToken.forFormat(FormatToken.Kind.INDENTATION_INC));<NEW_LINE>}<NEW_LINE>// put indentation mark<NEW_LINE>formatToken = getCaseEndToken(getStart(nodes.get(0)), getFinish(nodes.get(nodes.size() - 1)));<NEW_LINE>if (formatToken != null) {<NEW_LINE>TokenUtils.appendTokenAfterLastVirtual(formatToken, FormatToken.forFormat(FormatToken.Kind.INDENTATION_DEC));<NEW_LINE>}<NEW_LINE>handleBlockContent(nodes, true);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ), JsTokenId.OPERATOR_COLON, true); |
475,573 | public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {<NEW_LINE>consumeBucketsAndMaybeBreak(keys.length + (showOtherBucket ? 1 : 0));<NEW_LINE>List<InternalFilters.InternalBucket> buckets = new ArrayList<>(keys.length);<NEW_LINE>for (int i = 0; i < keys.length; i++) {<NEW_LINE>long bucketOrd = bucketOrd(owningBucketOrdinal, i);<NEW_LINE>InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(keys[i], bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed);<NEW_LINE>buckets.add(bucket);<NEW_LINE>}<NEW_LINE>// other bucket<NEW_LINE>if (showOtherBucket) {<NEW_LINE>long bucketOrd = bucketOrd(owningBucketOrdinal, keys.length);<NEW_LINE>InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(otherBucketKey, bucketDocCount(bucketOrd)<MASK><NEW_LINE>buckets.add(bucket);<NEW_LINE>}<NEW_LINE>return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metaData());<NEW_LINE>} | , bucketAggregations(bucketOrd), keyed); |
146,735 | private static void appendEscaped(StringBuffer buf, String text) {<NEW_LINE>int nextToCopy = 0;<NEW_LINE>int length = text.length();<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>char <MASK><NEW_LINE>String rep = null;<NEW_LINE>switch(ch) {<NEW_LINE>case '&':<NEW_LINE>// $NON-NLS-1$<NEW_LINE>rep = "&";<NEW_LINE>break;<NEW_LINE>case '"':<NEW_LINE>// $NON-NLS-1$<NEW_LINE>rep = """;<NEW_LINE>break;<NEW_LINE>case '<':<NEW_LINE>// $NON-NLS-1$<NEW_LINE>rep = "<";<NEW_LINE>break;<NEW_LINE>case '>':<NEW_LINE>// $NON-NLS-1$<NEW_LINE>rep = ">";<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (rep != null) {<NEW_LINE>if (nextToCopy < i) {<NEW_LINE>buf.append(text.substring(nextToCopy, i));<NEW_LINE>}<NEW_LINE>buf.append(rep);<NEW_LINE>nextToCopy = i + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (nextToCopy < length) {<NEW_LINE>buf.append(text.substring(nextToCopy));<NEW_LINE>}<NEW_LINE>} | ch = text.charAt(i); |
87,473 | public void onPreviewNativeEvent(NativePreviewEvent event) {<NEW_LINE>if (getEventHandleStrategy().isDragInterrupted(event, managerMediator)) {<NEW_LINE>// end drag if ESC is hit<NEW_LINE>interruptDrag();<NEW_LINE>event.cancel();<NEW_LINE>event.getNativeEvent().preventDefault();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int typeInt = event.getTypeInt();<NEW_LINE>if (typeInt == Event.ONKEYDOWN) {<NEW_LINE>getEventHandleStrategy().handleKeyDownEvent(event, managerMediator);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>NativeEvent nativeEvent = event.getNativeEvent();<NEW_LINE>currentDrag.setCurrentGwtEvent(nativeEvent);<NEW_LINE>String display = getEventHandleStrategy(<MASK><NEW_LINE>Element targetElement = getEventHandleStrategy().getTargetElement(event, managerMediator);<NEW_LINE>try {<NEW_LINE>if (handleDragImage(targetElement, event)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>// ApplicationConnection.getConsole().log(<NEW_LINE>// "ERROR during elementFromPoint hack.");<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>getEventHandleStrategy().restoreDragImage(display, managerMediator, event);<NEW_LINE>}<NEW_LINE>getEventHandleStrategy().handleEvent(targetElement, event, managerMediator);<NEW_LINE>} | ).updateDragImage(event, managerMediator); |
1,314,285 | public boolean execute(Object object) throws ContractExeException {<NEW_LINE>TransactionResultCapsule ret = (TransactionResultCapsule) object;<NEW_LINE>if (Objects.isNull(ret)) {<NEW_LINE>throw new RuntimeException(ActuatorConstant.TX_RESULT_NULL);<NEW_LINE>}<NEW_LINE>long fee = calcFee();<NEW_LINE>AccountStore accountStore = chainBaseManager.getAccountStore();<NEW_LINE>DynamicPropertiesStore dynamicStore = chainBaseManager.getDynamicPropertiesStore();<NEW_LINE>AssetIssueStore assetIssueStore = chainBaseManager.getAssetIssueStore();<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>final ParticipateAssetIssueContract participateAssetIssueContract = any.unpack(ParticipateAssetIssueContract.class);<NEW_LINE>long cost = participateAssetIssueContract.getAmount();<NEW_LINE>// subtract from owner address<NEW_LINE>byte[] ownerAddress = participateAssetIssueContract.getOwnerAddress().toByteArray();<NEW_LINE>AccountCapsule ownerAccount = accountStore.get(ownerAddress);<NEW_LINE>long balance = Math.subtractExact(ownerAccount.getBalance(), cost);<NEW_LINE>balance = Math.subtractExact(balance, fee);<NEW_LINE>ownerAccount.setBalance(balance);<NEW_LINE>byte[] key = participateAssetIssueContract.getAssetName().toByteArray();<NEW_LINE>// calculate the exchange amount<NEW_LINE>AssetIssueCapsule assetIssueCapsule;<NEW_LINE>assetIssueCapsule = Commons.getAssetIssueStoreFinal(dynamicStore, assetIssueStore, assetIssueV2Store).get(key);<NEW_LINE>long exchangeAmount = Math.multiplyExact(cost, assetIssueCapsule.getNum());<NEW_LINE>exchangeAmount = Math.floorDiv(exchangeAmount, assetIssueCapsule.getTrxNum());<NEW_LINE>ownerAccount.addAssetAmountV2(key, exchangeAmount, dynamicStore, assetIssueStore);<NEW_LINE>// add to to_address<NEW_LINE>byte[] toAddress = participateAssetIssueContract.getToAddress().toByteArray();<NEW_LINE>AccountCapsule toAccount = accountStore.get(toAddress);<NEW_LINE>toAccount.setBalance(Math.addExact(toAccount.getBalance(), cost));<NEW_LINE>if (!toAccount.reduceAssetAmountV2(key, exchangeAmount, dynamicStore, assetIssueStore)) {<NEW_LINE>throw new ContractExeException("reduceAssetAmount failed !");<NEW_LINE>}<NEW_LINE>// write to db<NEW_LINE>accountStore.put(ownerAddress, ownerAccount);<NEW_LINE>accountStore.put(toAddress, toAccount);<NEW_LINE>ret.setStatus(fee, Protocol.Transaction.Result.code.SUCESS);<NEW_LINE>} catch (InvalidProtocolBufferException | ArithmeticException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>ret.setStatus(fee, code.FAILED);<NEW_LINE>throw new ContractExeException(e.getMessage());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | AssetIssueV2Store assetIssueV2Store = chainBaseManager.getAssetIssueV2Store(); |
1,188,793 | final MergeShardsResult executeMergeShards(MergeShardsRequest mergeShardsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(mergeShardsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<MergeShardsRequest> request = null;<NEW_LINE>Response<MergeShardsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new MergeShardsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(mergeShardsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Kinesis");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "MergeShards");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<MergeShardsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new MergeShardsResultJsonUnmarshaller());<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); |
672,411 | public void reverseGeocodeAsync(final Map<String, Object> locationMap, final Promise promise) {<NEW_LINE>if (mGeocoderPaused) {<NEW_LINE>promise.reject("E_CANNOT_GEOCODE", "Geocoder is not running.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isMissingForegroundPermissions()) {<NEW_LINE>promise.reject(new LocationUnauthorizedException());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Location location = new Location("");<NEW_LINE>location.setLatitude((double) locationMap.get("latitude"));<NEW_LINE>location.setLongitude((double) locationMap.get("longitude"));<NEW_LINE>if (Geocoder.isPresent()) {<NEW_LINE>SmartLocation.with(mContext).geocoding().reverse(location, (original, addresses) -> {<NEW_LINE>List<Bundle> results = new ArrayList<>(addresses.size());<NEW_LINE>for (Address address : addresses) {<NEW_LINE>results.add(LocationHelpers.addressToBundle(address));<NEW_LINE>}<NEW_LINE>SmartLocation.with(mContext)<MASK><NEW_LINE>promise.resolve(results);<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>promise.reject("E_NO_GEOCODER", "Geocoder service is not available for this device.");<NEW_LINE>}<NEW_LINE>} | .geocoding().stop(); |
565,649 | public Dependencies resolve(SootClass sc) {<NEW_LINE>InputStream d = null;<NEW_LINE>try {<NEW_LINE>d = foundFile.inputStream();<NEW_LINE>ClassReader clsr = new ClassReader(d);<NEW_LINE>SootClassBuilder scb = new SootClassBuilder(sc);<NEW_LINE>clsr.accept(scb, ClassReader.SKIP_FRAMES);<NEW_LINE>Dependencies deps = new Dependencies();<NEW_LINE>deps.typesToSignature.addAll(scb.deps);<NEW_LINE>// add the outer class information, could not be called in the builder, since sc needs to be<NEW_LINE>// resolved - before calling setOuterClass()<NEW_LINE>if (!sc.hasOuterClass() && className.contains("$")) {<NEW_LINE>String outerClassName;<NEW_LINE>if (className.contains("$-")) {<NEW_LINE>outerClassName = className.substring(0, className.indexOf("$-"));<NEW_LINE>} else {<NEW_LINE>outerClassName = className.substring(0, className.lastIndexOf('$'));<NEW_LINE>}<NEW_LINE>sc.setOuterClass(SootResolver.v<MASK><NEW_LINE>}<NEW_LINE>return deps;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("Error: Failed to create class reader from class source.", e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (d != null) {<NEW_LINE>d.close();<NEW_LINE>d = null;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("Error: Failed to close source input stream.", e);<NEW_LINE>} finally {<NEW_LINE>close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().makeClassRef(outerClassName)); |
1,310,790 | public AwsWafRateBasedRuleMatchPredicate unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsWafRateBasedRuleMatchPredicate awsWafRateBasedRuleMatchPredicate = new AwsWafRateBasedRuleMatchPredicate();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("DataId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsWafRateBasedRuleMatchPredicate.setDataId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Negated", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsWafRateBasedRuleMatchPredicate.setNegated(context.getUnmarshaller(Boolean.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("Type", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsWafRateBasedRuleMatchPredicate.setType(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 awsWafRateBasedRuleMatchPredicate;<NEW_LINE>} | class).unmarshall(context)); |
513,949 | public float[] demodulate(float[] i, float[] q) {<NEW_LINE>VectorUtilities.checkComplexArrayLength(i, q, VECTOR_SPECIES);<NEW_LINE>if (mIBuffer.length != (i.length + BUFFER_OVERLAP)) {<NEW_LINE>mIBuffer = new <MASK><NEW_LINE>mQBuffer = new float[q.length + BUFFER_OVERLAP];<NEW_LINE>}<NEW_LINE>// Copy last sample to beginning of buffer arrays<NEW_LINE>mIBuffer[0] = mIBuffer[mIBuffer.length - 1];<NEW_LINE>mQBuffer[0] = mQBuffer[mQBuffer.length - 1];<NEW_LINE>// Copy new samples to end of buffer arrays<NEW_LINE>System.arraycopy(i, 0, mIBuffer, 1, i.length);<NEW_LINE>System.arraycopy(q, 0, mQBuffer, 1, q.length);<NEW_LINE>float[] demodulated = new float[i.length];<NEW_LINE>FloatVector currentI, currentQ, previousI, previousQ, demod, demodI, demodQ;<NEW_LINE>for (int bufferPointer = 0; bufferPointer < mIBuffer.length - 1; bufferPointer += VECTOR_SPECIES.length()) {<NEW_LINE>previousI = FloatVector.fromArray(VECTOR_SPECIES, mIBuffer, bufferPointer);<NEW_LINE>previousQ = FloatVector.fromArray(VECTOR_SPECIES, mQBuffer, bufferPointer);<NEW_LINE>currentI = FloatVector.fromArray(VECTOR_SPECIES, mIBuffer, bufferPointer + 1);<NEW_LINE>currentQ = FloatVector.fromArray(VECTOR_SPECIES, mQBuffer, bufferPointer + 1);<NEW_LINE>demodI = currentI.mul(previousI).sub(currentQ.mul(previousQ.neg()));<NEW_LINE>demodQ = currentQ.mul(previousI).add(currentI.mul(previousQ.neg()));<NEW_LINE>// Replace any zero-values in the I vector by adding Float.MIN_VALUE to side-step divide by zero errors<NEW_LINE>demodI = demodI.add(Float.MIN_VALUE, demodQ.eq(ZERO));<NEW_LINE>demod = demodQ.div(demodI).lanewise(VectorOperators.ATAN);<NEW_LINE>demod.intoArray(demodulated, bufferPointer);<NEW_LINE>}<NEW_LINE>return demodulated;<NEW_LINE>} | float[i.length + BUFFER_OVERLAP]; |
1,217,133 | private void parseForConfig(ClientConfig parentObj, String parentTag, String qName, Attributes attributes) throws SAXException {<NEW_LINE>if (Constants.ENTITY_SERVERS.equals(qName) || Constants.ENTITY_PROPERTIES.equals(qName)) {<NEW_LINE>objects.push(parentObj);<NEW_LINE>} else if (Constants.ENTITY_SERVER.equals(qName)) {<NEW_LINE>Server <MASK><NEW_LINE>linker.onServer(parentObj, server);<NEW_LINE>objects.push(server);<NEW_LINE>} else if (Constants.ENTITY_DOMAIN.equals(qName)) {<NEW_LINE>Domain domain = maker.buildDomain(attributes);<NEW_LINE>linker.onDomain(parentObj, domain);<NEW_LINE>objects.push(domain);<NEW_LINE>} else if (Constants.ENTITY_BIND.equals(qName)) {<NEW_LINE>Bind bind = maker.buildBind(attributes);<NEW_LINE>linker.onBind(parentObj, bind);<NEW_LINE>objects.push(bind);<NEW_LINE>} else if (Constants.ENTITY_PROPERTY.equals(qName)) {<NEW_LINE>Property property = maker.buildProperty(attributes);<NEW_LINE>linker.onProperty(parentObj, property);<NEW_LINE>objects.push(property);<NEW_LINE>} else {<NEW_LINE>throw new SAXException(String.format("Element(%s) is not expected under config!", qName));<NEW_LINE>}<NEW_LINE>tags.push(qName);<NEW_LINE>} | server = maker.buildServer(attributes); |
228,887 | public RebootBrokerResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RebootBrokerResult rebootBrokerResult = new RebootBrokerResult();<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 rebootBrokerResult;<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("clusterArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>rebootBrokerResult.setClusterArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("clusterOperationArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>rebootBrokerResult.setClusterOperationArn(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 rebootBrokerResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,706,888 | private void printDetectionForLog4j1(File jarFile, List<String> pathChain, String version, boolean mitigated) {<NEW_LINE>String path = getPath(jarFile, pathChain);<NEW_LINE>Version v = null;<NEW_LINE>if (!version.equals("N/A"))<NEW_LINE>v = Version.parse(version);<NEW_LINE>// JMSAppender<NEW_LINE>String cve = "CVE-2021-4104 ";<NEW_LINE>if (v != null) {<NEW_LINE>if (v.getPatch() == 18 && v.getPatch2() == 0)<NEW_LINE>// JMSSink<NEW_LINE>cve = "CVE-2022-23302";<NEW_LINE>else if (v.getPatch() == 18 && v.getPatch2() == 1)<NEW_LINE>// JDBCAppender<NEW_LINE>cve = "CVE-2022-23305";<NEW_LINE>else if (v.getPatch() == 18 && v.getPatch2() == 2)<NEW_LINE>// SMTPAppender<NEW_LINE>cve = "CVE-2020-9488 ";<NEW_LINE>}<NEW_LINE>String msg = "[?] Found " + cve <MASK><NEW_LINE>if (mitigated)<NEW_LINE>msg += " (mitigated)";<NEW_LINE>System.out.println(msg);<NEW_LINE>addReport(jarFile, pathChain, "Log4j 1", version, cve.trim(), mitigated, true);<NEW_LINE>} | + " (log4j 1.2) vulnerability in " + path + ", log4j " + version; |
887,120 | void resolveBoundaryOverlaps_() {<NEW_LINE>m_vertices_on_extent_index = -1;<NEW_LINE>splitSegments_(false, m_extent.xmin);<NEW_LINE>splitSegments_(false, m_extent.xmax);<NEW_LINE>splitSegments_(true, m_extent.ymin);<NEW_LINE>splitSegments_(true, m_extent.ymax);<NEW_LINE>m_vertices_on_extent.resize(0);<NEW_LINE>m_vertices_on_extent.reserve(100);<NEW_LINE>m_vertices_on_extent_index = m_shape.createUserIndex();<NEW_LINE>Point2D pt = new Point2D();<NEW_LINE>for (int path = m_shape.getFirstPath(m_geometry); path != -1; path = m_shape.getNextPath(path)) {<NEW_LINE>int vertex = m_shape.getFirstVertex(path);<NEW_LINE>for (int ivert = 0, nvert = m_shape.getPathSize(path); ivert < nvert; ivert++, vertex = m_shape.getNextVertex(vertex)) {<NEW_LINE>m_shape.getXY(vertex, pt);<NEW_LINE>if (m_extent.xmin == pt.x || m_extent.xmax == pt.x || m_extent.ymin == pt.y || m_extent.ymax == pt.y) {<NEW_LINE>m_shape.setUserIndex(vertex, m_vertices_on_extent_index, m_vertices_on_extent.size());<NEW_LINE>m_vertices_on_extent.add(vertex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// dbg_check_path_first_();<NEW_LINE><MASK><NEW_LINE>// dbg_check_path_first_();<NEW_LINE>resolveOverlaps_(false, m_extent.xmax);<NEW_LINE>// dbg_check_path_first_();<NEW_LINE>resolveOverlaps_(true, m_extent.ymin);<NEW_LINE>// dbg_check_path_first_();<NEW_LINE>resolveOverlaps_(true, m_extent.ymax);<NEW_LINE>fixPaths_();<NEW_LINE>} | resolveOverlaps_(false, m_extent.xmin); |
449,035 | final CreateLicenseConfigurationResult executeCreateLicenseConfiguration(CreateLicenseConfigurationRequest createLicenseConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createLicenseConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateLicenseConfigurationRequest> request = null;<NEW_LINE>Response<CreateLicenseConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateLicenseConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createLicenseConfigurationRequest));<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, "License Manager");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateLicenseConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateLicenseConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateLicenseConfiguration"); |
636,992 | protected DataStreamShardStats shardOperation(Request request, ShardRouting shardRouting) throws IOException {<NEW_LINE>IndexService indexService = indicesService.indexServiceSafe(shardRouting.shardId().getIndex());<NEW_LINE>IndexShard indexShard = indexService.getShard(shardRouting.shardId().id());<NEW_LINE>// if we don't have the routing entry yet, we need it stats wise, we treat it as if the shard is not ready yet<NEW_LINE>if (indexShard.routingEntry() == null) {<NEW_LINE>throw new ShardNotFoundException(indexShard.shardId());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>IndexAbstraction indexAbstraction = clusterService.state().getMetadata().getIndicesLookup().get(shardRouting.getIndexName());<NEW_LINE>assert indexAbstraction != null;<NEW_LINE>IndexAbstraction.DataStream dataStream = indexAbstraction.getParentDataStream();<NEW_LINE>assert dataStream != null;<NEW_LINE>long maxTimestamp = 0L;<NEW_LINE>try (Engine.Searcher searcher = indexShard.acquireSearcher("data_stream_stats")) {<NEW_LINE>IndexReader indexReader = searcher.getIndexReader();<NEW_LINE>String fieldName = dataStream.getDataStream().getTimeStampField().getName();<NEW_LINE>byte[] maxPackedValue = PointValues.getMaxPackedValue(indexReader, fieldName);<NEW_LINE>if (maxPackedValue != null) {<NEW_LINE>maxTimestamp = LongPoint.decodeDimension(maxPackedValue, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new DataStreamShardStats(indexShard.routingEntry(), storeStats, maxTimestamp);<NEW_LINE>} | StoreStats storeStats = indexShard.storeStats(); |
1,302,964 | private void parseStringTable() {<NEW_LINE>int chunk = getLEWord(mParserOffset + (1 * WORD_SIZE));<NEW_LINE>mStringsCount = getLEWord(mParserOffset + (2 * WORD_SIZE));<NEW_LINE>mStylesCount = getLEWord(mParserOffset + (3 * WORD_SIZE));<NEW_LINE>int strOffset = mParserOffset + getLEWord(mParserOffset + (5 * WORD_SIZE));<NEW_LINE>int styleOffset = getLEWord(mParserOffset + (6 * WORD_SIZE));<NEW_LINE>mStringsTable = new String[mStringsCount];<NEW_LINE>int offset;<NEW_LINE>for (int i = 0; i < mStringsCount; ++i) {<NEW_LINE>offset = strOffset + getLEWord(mParserOffset + ((<MASK><NEW_LINE>mStringsTable[i] = getStringFromStringTable(offset);<NEW_LINE>}<NEW_LINE>if (styleOffset > 0) {<NEW_LINE>Log.w(TAG, "Unread styles");<NEW_LINE>for (int i = 0; i < mStylesCount; ++i) {<NEW_LINE>// TODO read the styles ???<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mParserOffset += chunk;<NEW_LINE>} | i + 7) * WORD_SIZE)); |
10,372 | final void executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<Void> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<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, "SWF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<Void>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), null);<NEW_LINE>invoke(request, responseHandler, executionContext);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,758,383 | private FlowScope tightenTypesAfterAssertions(FlowScope scope, Node callNode) {<NEW_LINE><MASK><NEW_LINE>Node firstParam = left.getNext();<NEW_LINE>if (firstParam == null) {<NEW_LINE>// this may be an assertion call but there are no arguments to assert<NEW_LINE>return scope;<NEW_LINE>}<NEW_LINE>AssertionFunctionSpec assertionFunctionSpec = assertionFunctionLookup.lookupByCallee(left);<NEW_LINE>if (assertionFunctionSpec == null) {<NEW_LINE>// this is not a recognized assertion function<NEW_LINE>return scope;<NEW_LINE>}<NEW_LINE>Node assertedNode = assertionFunctionSpec.getAssertedArg(firstParam);<NEW_LINE>if (assertedNode == null) {<NEW_LINE>return scope;<NEW_LINE>}<NEW_LINE>String assertedNodeName = assertedNode.getQualifiedName();<NEW_LINE>// Handle assertions that enforce expressions evaluate to true.<NEW_LINE>switch(assertionFunctionSpec.getAssertionKind()) {<NEW_LINE>case TRUTHY:<NEW_LINE>// Handle arbitrary expressions within the assert.<NEW_LINE>// e.g. given `assert(typeof x === 'string')`, the resulting scope will infer x to be a<NEW_LINE>// string.<NEW_LINE>scope = reverseInterpreter.getPreciserScopeKnowingConditionOutcome(assertedNode, scope, Outcome.TRUE);<NEW_LINE>// Build the result of the assertExpression<NEW_LINE>JSType truthyType = getJSType(assertedNode).restrictByNotNullOrUndefined();<NEW_LINE>callNode.setJSType(truthyType);<NEW_LINE>break;<NEW_LINE>case MATCHES_RETURN_TYPE:<NEW_LINE>// Handle assertions that enforce expressions match the return type of the function<NEW_LINE>FunctionType callType = JSType.toMaybeFunctionType(left.getJSType());<NEW_LINE>JSType assertedType = callType != null ? callType.getReturnType() : unknownType;<NEW_LINE>JSType type = getJSType(assertedNode);<NEW_LINE>JSType narrowed;<NEW_LINE>if (assertedType.isUnknownType() || type.isUnknownType()) {<NEW_LINE>narrowed = assertedType;<NEW_LINE>} else {<NEW_LINE>narrowed = type.getGreatestSubtype(assertedType);<NEW_LINE>}<NEW_LINE>callNode.setJSType(narrowed);<NEW_LINE>if (assertedNodeName != null && type.differsFrom(narrowed)) {<NEW_LINE>scope = narrowScope(scope, assertedNode, narrowed);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return scope;<NEW_LINE>} | Node left = callNode.getFirstChild(); |
628,575 | /*<NEW_LINE>{<NEW_LINE>"timestamp": "2016-06-06T13:00:02+02:00",<NEW_LINE>"attributes": {<NEW_LINE>"name": "value1"<NEW_LINE>}<NEW_LINE>}<NEW_LINE>*/<NEW_LINE>// VisibleForTesting<NEW_LINE>String writeEvent(Meter meter, Attribute... attributes) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>String name = getConventionName(meter.getId());<NEW_LINE>sb.append("{\"timestamp\":\"").append(timestamp).append("\",\"attributes\":{\"name\":\"").append(escapeJson(name)).append('"');<NEW_LINE>for (Attribute attribute : attributes) {<NEW_LINE>sb.append(",\"").append(attribute.name).append("\":").append(DoubleFormat.wholeOrDecimal(attribute.value));<NEW_LINE>}<NEW_LINE>List<Tag> tags = getConventionTags(meter.getId());<NEW_LINE>for (Tag tag : tags) {<NEW_LINE><MASK><NEW_LINE>for (Attribute attribute : attributes) {<NEW_LINE>if (attribute.name.equals(key)) {<NEW_LINE>key = "_" + key;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sb.append(",\"").append(escapeJson(key)).append("\":\"").append(escapeJson(tag.getValue())).append('"');<NEW_LINE>}<NEW_LINE>sb.append("}}");<NEW_LINE>return sb.toString();<NEW_LINE>} | String key = tag.getKey(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.