idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
229,089 | public static void main(String[] args) throws Exception {<NEW_LINE>File crawlStorageBase = new File("src/test/resources/crawler4j");<NEW_LINE>CrawlConfig htmlConfig = new CrawlConfig();<NEW_LINE>CrawlConfig imageConfig = new CrawlConfig();<NEW_LINE>htmlConfig.setCrawlStorageFolder(new File(crawlStorageBase, "html").getAbsolutePath());<NEW_LINE>imageConfig.setCrawlStorageFolder(new File(crawlStorageBase, "image").getAbsolutePath());<NEW_LINE>imageConfig.setIncludeBinaryContentInCrawling(true);<NEW_LINE>htmlConfig.setMaxPagesToFetch(500);<NEW_LINE>imageConfig.setMaxPagesToFetch(1000);<NEW_LINE>PageFetcher pageFetcherHtml = new PageFetcher(htmlConfig);<NEW_LINE>PageFetcher pageFetcherImage = new PageFetcher(imageConfig);<NEW_LINE>RobotstxtConfig robotstxtConfig = new RobotstxtConfig();<NEW_LINE>RobotstxtServer robotstxtServer = new RobotstxtServer(robotstxtConfig, pageFetcherHtml);<NEW_LINE>CrawlController htmlController = new <MASK><NEW_LINE>CrawlController imageController = new CrawlController(imageConfig, pageFetcherImage, robotstxtServer);<NEW_LINE>htmlController.addSeed("https://www.baeldung.com/");<NEW_LINE>imageController.addSeed("https://www.baeldung.com/");<NEW_LINE>CrawlerStatistics stats = new CrawlerStatistics();<NEW_LINE>CrawlController.WebCrawlerFactory<HtmlCrawler> htmlFactory = () -> new HtmlCrawler(stats);<NEW_LINE>File saveDir = new File("src/test/resources/crawler4j");<NEW_LINE>CrawlController.WebCrawlerFactory<ImageCrawler> imageFactory = () -> new ImageCrawler(saveDir);<NEW_LINE>imageController.startNonBlocking(imageFactory, 7);<NEW_LINE>htmlController.startNonBlocking(htmlFactory, 10);<NEW_LINE>htmlController.waitUntilFinish();<NEW_LINE>System.out.printf("Crawled %d pages %n", stats.getProcessedPageCount());<NEW_LINE>System.out.printf("Total Number of outbound links = %d %n", stats.getTotalLinksCount());<NEW_LINE>imageController.waitUntilFinish();<NEW_LINE>System.out.printf("Image Crawler is finished.");<NEW_LINE>} | CrawlController(htmlConfig, pageFetcherHtml, robotstxtServer); |
1,774,108 | protected CommandHandler createCommandHandler() {<NEW_LINE>CommandHandler commandHandler = new CommandHandler();<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_EXIT), new ExitCommand(this));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_HELP), new HelpCommand(this));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_RESET), new ResetStateCommand(this));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_DEBUG), new ToggleDebugCommand(this));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_FILE), new FileCommand(this));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_DELETE), new DeleteCommand(this));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_VARS), new StringListCommand(this, evaluator::availableVariables));<NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_IMPORTS), new StringListCommand<MASK><NEW_LINE>commandHandler.attach(PropertiesLoader.getProperty(COMMAND_DCLNS), new StringListCommand(this, evaluator::availableModuleDeclarations));<NEW_LINE>return commandHandler;<NEW_LINE>} | (this, evaluator::availableImports)); |
1,809,716 | public GameButton recoverData(Context context, CallCustomizeKeyboard call, Controller controller, CkbManager manager) {<NEW_LINE>GameButton gb = new GameButton(context, call, controller, manager);<NEW_LINE>gb.setKeyMaps(this.keyMaps);<NEW_LINE>gb.setKeyTypes(this.keyTypes);<NEW_LINE>gb.setDesignIndex(this.designIndex);<NEW_LINE>gb.setCornerRadius(this.cornerRadius);<NEW_LINE>gb.setTextColor(this.textColor);<NEW_LINE>for (int a = 0; a < CkbThemeRecorder.COLOR_INDEX_LENGTH; a++) {<NEW_LINE>gb.getThemeRecorder().setColors(a, ColorUtils.hex2Int(<MASK><NEW_LINE>}<NEW_LINE>gb.setKeep(this.isKeep);<NEW_LINE>gb.setHide(this.isHide);<NEW_LINE>gb.setKeySize(this.keySize[0], this.keySize[1]);<NEW_LINE>gb.setKeyPos(this.keyPos[0], this.keyPos[1]);<NEW_LINE>gb.setAlphaSize(this.alphaSize);<NEW_LINE>gb.setKeyName(this.keyName);<NEW_LINE>gb.setTextSize(this.textSize);<NEW_LINE>gb.setViewerFollow(this.isViewerFollow);<NEW_LINE>gb.setShow(this.show);<NEW_LINE>gb.setChars(this.keyChars);<NEW_LINE>gb.setInputChars(this.isChars);<NEW_LINE>return gb;<NEW_LINE>} | this.themeColors[a])); |
475,956 | private static PresoObjAllocCCTNode[] computeChildren(PresoObjAllocCCTNode[] children1, PresoObjAllocCCTNode[] children2, PresoObjLivenessCCTNode parent) {<NEW_LINE>Map<Handle, PresoObjAllocCCTNode> nodes1 = new HashMap();<NEW_LINE>for (PresoObjAllocCCTNode node : children1) {<NEW_LINE>Handle name = new Handle(node);<NEW_LINE>PresoObjAllocCCTNode sameNode = nodes1.get(name);<NEW_LINE>if (sameNode == null)<NEW_LINE>nodes1.put(name, node);<NEW_LINE>else<NEW_LINE>sameNode.merge(node);<NEW_LINE>}<NEW_LINE>Map<Handle, PresoObjAllocCCTNode> nodes2 = new HashMap();<NEW_LINE>for (PresoObjAllocCCTNode node : children2) {<NEW_LINE><MASK><NEW_LINE>PresoObjAllocCCTNode sameNode = nodes2.get(name);<NEW_LINE>if (sameNode == null)<NEW_LINE>nodes2.put(name, node);<NEW_LINE>else<NEW_LINE>// Merge same-named items<NEW_LINE>sameNode.merge(node);<NEW_LINE>}<NEW_LINE>List<PresoObjAllocCCTNode> children = new ArrayList();<NEW_LINE>for (PresoObjAllocCCTNode node1 : nodes1.values()) {<NEW_LINE>PresoObjAllocCCTNode node2 = nodes2.get(new Handle(node1));<NEW_LINE>if (node2 != null)<NEW_LINE>children.add(new DiffObjLivenessCCTNode((PresoObjLivenessCCTNode) node1, (PresoObjLivenessCCTNode) node2));<NEW_LINE>else<NEW_LINE>children.add(new DiffObjLivenessCCTNode((PresoObjLivenessCCTNode) node1, null));<NEW_LINE>}<NEW_LINE>for (PresoObjAllocCCTNode node2 : nodes2.values()) {<NEW_LINE>if (!nodes1.containsKey(new Handle(node2)))<NEW_LINE>children.add(new DiffObjLivenessCCTNode(null, (PresoObjLivenessCCTNode) node2));<NEW_LINE>}<NEW_LINE>return children.toArray(new PresoObjAllocCCTNode[0]);<NEW_LINE>} | Handle name = new Handle(node); |
1,761,729 | private void threadMain(RubyThread thread, Node currentNode, Supplier<Object> task) {<NEW_LINE>try {<NEW_LINE>final <MASK><NEW_LINE>setThreadValue(thread, result);<NEW_LINE>// Handlers in the same order as in FiberManager<NEW_LINE>// Each catch must either setThreadValue() (before rethrowing) or setException()<NEW_LINE>} catch (KillException e) {<NEW_LINE>setThreadValue(thread, Nil.INSTANCE);<NEW_LINE>} catch (ThreadDeath e) {<NEW_LINE>// Context#close(true)<NEW_LINE>setThreadValue(thread, Nil.INSTANCE);<NEW_LINE>throw e;<NEW_LINE>} catch (RaiseException e) {<NEW_LINE>setException(thread, e.getException(), currentNode);<NEW_LINE>} catch (DynamicReturnException e) {<NEW_LINE>setException(thread, context.getCoreExceptions().unexpectedReturn(currentNode), currentNode);<NEW_LINE>} catch (ExitException e) {<NEW_LINE>setThreadValue(thread, Nil.INSTANCE);<NEW_LINE>rethrowOnMainThread(currentNode, e);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>final RuntimeException runtimeException = printInternalError(e);<NEW_LINE>setThreadValue(thread, Nil.INSTANCE);<NEW_LINE>rethrowOnMainThread(currentNode, runtimeException);<NEW_LINE>} finally {<NEW_LINE>assert thread.value != null || thread.exception != null;<NEW_LINE>cleanupKillOtherFibers(thread);<NEW_LINE>}<NEW_LINE>} | Object result = task.get(); |
740,524 | public static String formatTimeStamp(long time) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE><MASK><NEW_LINE>calendar.setTimeInMillis(time);<NEW_LINE>sb.append('[');<NEW_LINE>sb.append(formatIntToTwoDigits(calendar.get(Calendar.DAY_OF_MONTH)));<NEW_LINE>sb.append('.');<NEW_LINE>// 0 based<NEW_LINE>sb.append(formatIntToTwoDigits(calendar.get(Calendar.MONTH) + 1));<NEW_LINE>sb.append('.');<NEW_LINE>sb.append(calendar.get(Calendar.YEAR));<NEW_LINE>sb.append(' ');<NEW_LINE>sb.append(formatIntToTwoDigits(calendar.get(Calendar.HOUR_OF_DAY)));<NEW_LINE>sb.append(':');<NEW_LINE>sb.append(formatIntToTwoDigits(calendar.get(Calendar.MINUTE)));<NEW_LINE>sb.append(':');<NEW_LINE>sb.append(formatIntToTwoDigits(calendar.get(Calendar.SECOND)));<NEW_LINE>sb.append(']');<NEW_LINE>return sb.toString();<NEW_LINE>} | Calendar calendar = Calendar.getInstance(); |
1,790,790 | public void updateViewsData() {<NEW_LINE>binding.titleTextView.setText(currentCard.getTitle());<NEW_LINE>if (currentCard.getPublishTimestamp() != null) {<NEW_LINE>binding.publishDateTextView.setText(currentCard.getPublishDatePretty());<NEW_LINE>} else {<NEW_LINE>binding.publishDateTextView.setVisibility(View.GONE);<NEW_LINE>binding.<MASK><NEW_LINE>}<NEW_LINE>Glide.with(context).load(currentCard.getThumbnailUrl()).apply(new RequestOptions().placeholder(R.drawable.thumbnail_default)).into(binding.thumbnailImageView);<NEW_LINE>if (currentCard instanceof YouTubeVideo) {<NEW_LINE>updateViewsData((YouTubeVideo) currentCard);<NEW_LINE>} else if (currentCard instanceof YouTubePlaylist) {<NEW_LINE>updateViewsData((YouTubePlaylist) currentCard);<NEW_LINE>} else if (currentCard instanceof YouTubeChannel) {<NEW_LINE>updateViewsData((YouTubeChannel) currentCard);<NEW_LINE>}<NEW_LINE>} | separatorTextView.setVisibility(View.GONE); |
355,576 | private static void detectCycles(Map<ModuleIdentifier, Replacement> replacements, ModuleIdentifier source, ModuleIdentifier target) {<NEW_LINE>if (source.equals(target)) {<NEW_LINE>throw new InvalidUserDataException(String.format<MASK><NEW_LINE>}<NEW_LINE>ModuleIdentifier m = unwrap(replacements.get(target));<NEW_LINE>if (m == null) {<NEW_LINE>// target does not exist in the map, there's no cycle for sure<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Set<ModuleIdentifier> visited = new LinkedHashSet<>();<NEW_LINE>visited.add(source);<NEW_LINE>visited.add(target);<NEW_LINE>while (m != null) {<NEW_LINE>if (!visited.add(m)) {<NEW_LINE>// module was already visited, there is a cycle<NEW_LINE>throw new InvalidUserDataException(format("Cannot declare module replacement %s->%s because it introduces a cycle: %s", source, target, Joiner.on("->").join(visited) + "->" + source));<NEW_LINE>}<NEW_LINE>m = unwrap(replacements.get(m));<NEW_LINE>}<NEW_LINE>} | ("Cannot declare module replacement that replaces self: %s->%s", source, target)); |
766,523 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.AppTheme);<NEW_LINE>LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);<NEW_LINE>binding = DataBindingUtil.inflate(localInflater, R.layout.copyright_create_layout, container, false);<NEW_LINE>createCopyrightViewModel = ViewModelProviders.of(this, viewModelFactory).get(CreateCopyrightViewModel.class);<NEW_LINE>validator <MASK><NEW_LINE>AppCompatActivity activity = ((AppCompatActivity) getActivity());<NEW_LINE>activity.setSupportActionBar(binding.toolbar);<NEW_LINE>ActionBar actionBar = activity.getSupportActionBar();<NEW_LINE>if (actionBar != null) {<NEW_LINE>actionBar.setHomeButtonEnabled(true);<NEW_LINE>actionBar.setDisplayHomeAsUpEnabled(true);<NEW_LINE>}<NEW_LINE>setHasOptionsMenu(true);<NEW_LINE>binding.submit.setOnClickListener(view -> {<NEW_LINE>if (validator.validate())<NEW_LINE>createCopyrightViewModel.createCopyright();<NEW_LINE>});<NEW_LINE>return binding.getRoot();<NEW_LINE>} | = new Validator(binding.form); |
1,364,060 | public static void main(String[] args) {<NEW_LINE>Set<String> words = new HashSet<>();<NEW_LINE>words.add("sb");<NEW_LINE>words.add("xx");<NEW_LINE>SensitiveFilter sensitiveFilter = new SensitiveFilter(words);<NEW_LINE>String text1 = "u sb a";<NEW_LINE>Set<String> ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "u xx";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "a url is https://sdsbhe.com here";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>text1 = "a url is https://sdsbhe.com";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.<MASK><NEW_LINE>text1 = "a url is https://sdsbhe.com\nsb";<NEW_LINE>ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);<NEW_LINE>System.out.println(ss.size());<NEW_LINE>} | println(ss.size()); |
1,007,185 | public static void createFederatedRoleMappings(UserFederatedStorageProvider federatedStorage, UserRepresentation userRep, RealmModel realm) {<NEW_LINE>if (userRep.getRealmRoles() != null) {<NEW_LINE>for (String roleString : userRep.getRealmRoles()) {<NEW_LINE>RoleModel role = realm.getRole(roleString.trim());<NEW_LINE>if (role == null) {<NEW_LINE>role = realm.addRole(roleString.trim());<NEW_LINE>}<NEW_LINE>federatedStorage.grantRole(realm, userRep.getId(), role);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (userRep.getClientRoles() != null) {<NEW_LINE>for (Map.Entry<String, List<String>> entry : userRep.getClientRoles().entrySet()) {<NEW_LINE>ClientModel client = realm.getClientByClientId(entry.getKey());<NEW_LINE>if (client == null) {<NEW_LINE>throw new RuntimeException("Unable to find client role mappings for client: " + entry.getKey());<NEW_LINE>}<NEW_LINE>createFederatedClientRoleMappings(federatedStorage, realm, client, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | userRep, entry.getValue()); |
1,412,674 | public void readFromNBT(NBTTagCompound nbt) {<NEW_LINE>// TODO: remove in next version<NEW_LINE>NBTTagCompound <MASK><NEW_LINE>if (tanksTag.hasKey("out_gas")) {<NEW_LINE>tanksTag.setTag("gasOut", tanksTag.getTag("out_gas"));<NEW_LINE>}<NEW_LINE>if (tanksTag.hasKey("out_liquid")) {<NEW_LINE>tanksTag.setTag("liquidOut", tanksTag.getTag("out_liquid"));<NEW_LINE>}<NEW_LINE>super.readFromNBT(nbt);<NEW_LINE>tankManager.deserializeNBT(nbt.getCompoundTag("tanks"));<NEW_LINE>// TODO: remove in next version<NEW_LINE>if (nbt.hasKey("mjBattery")) {<NEW_LINE>nbt.setTag("battery", nbt.getTag("mjBattery"));<NEW_LINE>}<NEW_LINE>mjBattery.deserializeNBT(nbt.getCompoundTag("battery"));<NEW_LINE>distillPower = nbt.getLong("distillPower");<NEW_LINE>powerAvg.readFromNbt(nbt, "powerAvg");<NEW_LINE>} | tanksTag = nbt.getCompoundTag("tanks"); |
1,333,637 | private void generateIsSupertypeFunctions(TagRegistry tagRegistry, WasmModule module, WasmClassGenerator classGenerator) {<NEW_LINE>for (ValueType type : classGenerator.getRegisteredClasses()) {<NEW_LINE>WasmFunction function = new WasmFunction(classGenerator.names.forSupertypeFunction(type));<NEW_LINE>function.getParameters().add(WasmType.INT32);<NEW_LINE>function.setResult(WasmType.INT32);<NEW_LINE>module.add(function);<NEW_LINE>WasmLocal subtypeVar = new WasmLocal(WasmType.INT32, "subtype");<NEW_LINE>function.add(subtypeVar);<NEW_LINE>if (type instanceof ValueType.Object) {<NEW_LINE>String className = ((ValueType.Object) type).getClassName();<NEW_LINE>generateIsClass(subtypeVar, classGenerator, tagRegistry, className, function.getBody());<NEW_LINE>} else if (type instanceof ValueType.Array) {<NEW_LINE>ValueType itemType = ((ValueType.Array) type).getItemType();<NEW_LINE>generateIsArray(subtypeVar, classGenerator, <MASK><NEW_LINE>} else {<NEW_LINE>int expected = classGenerator.getClassPointer(type);<NEW_LINE>WasmExpression condition = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.EQ, new WasmGetLocal(subtypeVar), new WasmInt32Constant(expected));<NEW_LINE>function.getBody().add(new WasmReturn(condition));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | itemType, function.getBody()); |
1,389,291 | public Builder mergeFrom(TransactionEnd other) {<NEW_LINE>if (other == TransactionEnd.getDefaultInstance())<NEW_LINE>return this;<NEW_LINE>if (other.hasExecuteTime()) {<NEW_LINE>setExecuteTime(other.getExecuteTime());<NEW_LINE>}<NEW_LINE>if (other.hasTransactionId()) {<NEW_LINE>bitField0_ |= 0x00000002;<NEW_LINE>transactionId_ = other.transactionId_;<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>if (propsBuilder_ == null) {<NEW_LINE>if (!other.props_.isEmpty()) {<NEW_LINE>if (props_.isEmpty()) {<NEW_LINE>props_ = other.props_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000004);<NEW_LINE>} else {<NEW_LINE>ensurePropsIsMutable();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!other.props_.isEmpty()) {<NEW_LINE>if (propsBuilder_.isEmpty()) {<NEW_LINE>propsBuilder_.dispose();<NEW_LINE>propsBuilder_ = null;<NEW_LINE>props_ = other.props_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000004);<NEW_LINE>propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null;<NEW_LINE>} else {<NEW_LINE>propsBuilder_.addAllMessages(other.props_);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.mergeUnknownFields(other.getUnknownFields());<NEW_LINE>return this;<NEW_LINE>} | props_.addAll(other.props_); |
1,773,204 | private void approveComment() {<NEW_LINE>if (mNote == null) {<NEW_LINE>requestFailed(ARG_ACTION_APPROVE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SiteModel site = mSiteStore.getSiteBySiteId(mNote.getSiteId());<NEW_LINE>// Bump analytics<NEW_LINE>// TODO klymyam remove legacy comment tracking after new comments are shipped and new funnels are made<NEW_LINE>AnalyticsUtils.trackWithBlogPostDetails(AnalyticsTracker.Stat.NOTIFICATION_QUICK_ACTIONS_APPROVED, mNote.getSiteId(), mNote.getPostId());<NEW_LINE>AnalyticsUtils.trackCommentActionWithSiteDetails(Stat.COMMENT_QUICK_ACTION_APPROVED, AnalyticsCommentActionSource.NOTIFICATIONS, site);<NEW_LINE>AnalyticsUtils.trackQuickActionTouched(QuickActionTrackPropertyValue.APPROVE, site, mNote.buildComment());<NEW_LINE>// Update pseudo comment (built from the note)<NEW_LINE>CommentModel comment = mNote.buildComment();<NEW_LINE>comment.setStatus(CommentStatus.APPROVED.toString());<NEW_LINE>if (site == null) {<NEW_LINE>AppLog.e(T.NOTIFS, "Impossible to approve a comment on a site that is not in the App. SiteId: " + mNote.getSiteId());<NEW_LINE>requestFailed(ARG_ACTION_APPROVE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// keep the CommentId, we'll use it later to know whether to trigger the end processing notification<NEW_LINE>// or not<NEW_LINE><MASK><NEW_LINE>// Push the comment<NEW_LINE>mCommentsStoreAdapter.dispatch(CommentActionBuilder.newPushCommentAction(new RemoteCommentPayload(site, comment)));<NEW_LINE>} | keepRemoteCommentIdForPostProcessing(comment.getRemoteCommentId()); |
371,117 | private static Bundle convertArrayArguments(Map<String, ?> arrayArguments) {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>if (arrayArguments == null) {<NEW_LINE>return bundle;<NEW_LINE>}<NEW_LINE>for (String key : arrayArguments.keySet()) {<NEW_LINE>Object value = arrayArguments.get(key);<NEW_LINE>if (isTypedArrayList(value, Boolean.class)) {<NEW_LINE>ArrayList<Boolean> list <MASK><NEW_LINE>boolean[] array = new boolean[list.size()];<NEW_LINE>for (int i = 0; i < list.size(); i++) {<NEW_LINE>array[i] = list.get(i);<NEW_LINE>}<NEW_LINE>bundle.putBooleanArray(key, array);<NEW_LINE>} else if (isTypedArrayList(value, Integer.class)) {<NEW_LINE>ArrayList<Integer> list = (ArrayList<Integer>) value;<NEW_LINE>int[] array = new int[list.size()];<NEW_LINE>for (int i = 0; i < list.size(); i++) {<NEW_LINE>array[i] = list.get(i);<NEW_LINE>}<NEW_LINE>bundle.putIntArray(key, array);<NEW_LINE>} else if (isTypedArrayList(value, Long.class)) {<NEW_LINE>ArrayList<Long> list = (ArrayList<Long>) value;<NEW_LINE>long[] array = new long[list.size()];<NEW_LINE>for (int i = 0; i < list.size(); i++) {<NEW_LINE>array[i] = list.get(i);<NEW_LINE>}<NEW_LINE>bundle.putLongArray(key, array);<NEW_LINE>} else if (isTypedArrayList(value, Double.class)) {<NEW_LINE>ArrayList<Double> list = (ArrayList<Double>) value;<NEW_LINE>double[] array = new double[list.size()];<NEW_LINE>for (int i = 0; i < list.size(); i++) {<NEW_LINE>array[i] = list.get(i);<NEW_LINE>}<NEW_LINE>bundle.putDoubleArray(key, array);<NEW_LINE>} else if (isTypedArrayList(value, String.class)) {<NEW_LINE>ArrayList<String> list = (ArrayList<String>) value;<NEW_LINE>bundle.putStringArray(key, list.toArray(new String[list.size()]));<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Unsupported type " + value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return bundle;<NEW_LINE>} | = (ArrayList<Boolean>) value; |
1,840,345 | protected IStatus run(IProgressMonitor monitor) {<NEW_LINE>TcpProxy tcp = TcpProxy.getTcpProxy(serverId);<NEW_LINE>Pack p = null;<NEW_LINE>try {<NEW_LINE>p = tcp.<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>return Status.CANCEL_STATUS;<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>if (p != null) {<NEW_LINE>final List<SummaryData> list = new ArrayList<SummaryData>();<NEW_LINE>MapPack m = (MapPack) p;<NEW_LINE>ListValue idLv = m.getList("id");<NEW_LINE>ListValue countLv = m.getList("count");<NEW_LINE>for (int i = 0; i < idLv.size(); i++) {<NEW_LINE>SummaryData data = new SummaryData();<NEW_LINE>data.hash = idLv.getInt(i);<NEW_LINE>data.count = countLv.getInt(i);<NEW_LINE>list.add(data);<NEW_LINE>}<NEW_LINE>TextProxy.userAgent.load(date, idLv, serverId);<NEW_LINE>ExUtil.exec(viewer.getTable(), new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>viewer.setInput(list);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return Status.OK_STATUS;<NEW_LINE>} | getSingle(RequestCmd.LOAD_UA_SUMMARY, param); |
1,705,111 | public void handleCommit(ApplyCommitRequest applyCommit) {<NEW_LINE>if (applyCommit.getTerm() != getCurrentTerm()) {<NEW_LINE>logger.debug("handleCommit: ignored commit request due to term mismatch " + "(expected: [term {} version {}], actual: [term {} version {}])", getLastAcceptedTerm(), getLastAcceptedVersion(), applyCommit.getTerm(), applyCommit.getVersion());<NEW_LINE>throw new CoordinationStateRejectedException("incoming term " + applyCommit.getTerm() + " does not match current term " + getCurrentTerm());<NEW_LINE>}<NEW_LINE>if (applyCommit.getTerm() != getLastAcceptedTerm()) {<NEW_LINE>logger.debug("handleCommit: ignored commit request due to term mismatch " + "(expected: [term {} version {}], actual: [term {} version {}])", getLastAcceptedTerm(), getLastAcceptedVersion(), applyCommit.getTerm(), applyCommit.getVersion());<NEW_LINE>throw new CoordinationStateRejectedException("incoming term " + applyCommit.getTerm() + " does not match last accepted term " + getLastAcceptedTerm());<NEW_LINE>}<NEW_LINE>if (applyCommit.getVersion() != getLastAcceptedVersion()) {<NEW_LINE>logger.debug("handleCommit: ignored commit request due to version mismatch (term {}, expected: [{}], actual: [{}])", getLastAcceptedTerm(), getLastAcceptedVersion(), applyCommit.getVersion());<NEW_LINE>throw new CoordinationStateRejectedException("incoming version " + applyCommit.getVersion() + " does not match current version " + getLastAcceptedVersion());<NEW_LINE>}<NEW_LINE>logger.trace("handleCommit: applying commit request for term [{}] and version [{}]", applyCommit.getTerm(), applyCommit.getVersion());<NEW_LINE>persistedState.markLastAcceptedStateAsCommitted();<NEW_LINE>assert getLastCommittedConfiguration(<MASK><NEW_LINE>} | ).equals(getLastAcceptedConfiguration()); |
1,426,681 | public ItemAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {<NEW_LINE>String signatureString = type_to_signature.get(new Integer(viewType));<NEW_LINE>ItemAdapter.ViewHolder viewHolder;<NEW_LINE>if (signatureString.startsWith("[")) {<NEW_LINE>// Horizontal Section => Build a ViewHolder with a horizontally scrolling RecyclerView<NEW_LINE>// 1. Create RecyclerView<NEW_LINE>RecyclerView horizontalListView = new RecyclerView(parent.getContext());<NEW_LINE>horizontalListView.setLayoutManager(new LinearLayoutManager(horizontalListView.getContext(), LinearLayoutManager.HORIZONTAL, false));<NEW_LINE>horizontalListView.setNestedScrollingEnabled(false);<NEW_LINE>// 2. Create Adapter<NEW_LINE>ItemAdapter horizontal_adapter = new ItemAdapter(context, horizontalListView.getContext(), new ArrayList<JSONObject>());<NEW_LINE>horizontal_adapter.isHorizontalScroll = true;<NEW_LINE>// 3. Connect RecyclerView with Adapter<NEW_LINE>horizontalListView.setAdapter(horizontal_adapter);<NEW_LINE>// 4. Instantiate a new ViewHolder with the RecyclerView<NEW_LINE>viewHolder = new ViewHolder(horizontalListView);<NEW_LINE>} else {<NEW_LINE>// Vertcial Section => Regular ViewHolder<NEW_LINE>JSONObject json;<NEW_LINE>try {<NEW_LINE>json = new JSONObject(signatureString);<NEW_LINE>} catch (JSONException e) {<NEW_LINE>json = new JSONObject();<NEW_LINE>}<NEW_LINE>viewHolder = <MASK><NEW_LINE>}<NEW_LINE>return viewHolder;<NEW_LINE>} | factory.build(null, json); |
209,245 | public void visitConstant(ConstantNode irConstantNode, ScriptScope scope) {<NEW_LINE>super.visitConstant(irConstantNode, scope);<NEW_LINE>Object constant = irConstantNode.getDecorationValue(IRDConstant.class);<NEW_LINE>if (constant instanceof String || constant instanceof Double || constant instanceof Float || constant instanceof Long || constant instanceof Integer || constant instanceof Character || constant instanceof Short || constant instanceof Byte || constant instanceof Boolean) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String fieldName = scope.getNextSyntheticName("constant");<NEW_LINE>scope.addStaticConstant(fieldName, constant);<NEW_LINE>FieldNode constantField = new FieldNode(irConstantNode.getLocation());<NEW_LINE>constantField.attachDecoration(new IRDModifiers(Modifier.PUBLIC | Modifier.STATIC));<NEW_LINE>constantField.attachDecoration(irConstantNode<MASK><NEW_LINE>Class<?> type = irConstantNode.getDecorationValue(IRDExpressionType.class);<NEW_LINE>constantField.attachDecoration(new IRDFieldType(type));<NEW_LINE>constantField.attachDecoration(new IRDName(fieldName));<NEW_LINE>classNode.addFieldNode(constantField);<NEW_LINE>irConstantNode.attachDecoration(new IRDConstantFieldName(fieldName));<NEW_LINE>} | .getDecoration(IRDConstant.class)); |
1,622,557 | public void visitField(final FieldNode fieldNode) {<NEW_LINE>onLineNumber(fieldNode, "visitField: " + fieldNode.getName());<NEW_LINE>ClassNode t = fieldNode.getType();<NEW_LINE>String <MASK><NEW_LINE>Expression initialValueExpression = fieldNode.getInitialValueExpression();<NEW_LINE>ConstantExpression cexp = initialValueExpression instanceof ConstantExpression ? (ConstantExpression) initialValueExpression : null;<NEW_LINE>if (cexp != null) {<NEW_LINE>cexp = Verifier.transformToPrimitiveConstantIfPossible(cexp);<NEW_LINE>}<NEW_LINE>Object value = // GROOVY-5150<NEW_LINE>cexp != null && ClassHelper.isStaticConstantInitializerType(cexp.getType()) && cexp.getType().equals(t) && fieldNode.isStatic() && fieldNode.isFinal() ? // GROOVY-5150<NEW_LINE>cexp.getValue() : null;<NEW_LINE>if (value != null) {<NEW_LINE>// byte, char and short require an extra cast<NEW_LINE>if (ClassHelper.byte_TYPE.equals(t) || ClassHelper.short_TYPE.equals(t)) {<NEW_LINE>value = ((Number) value).intValue();<NEW_LINE>} else if (ClassHelper.char_TYPE.equals(t)) {<NEW_LINE>value = Integer.valueOf((Character) value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FieldVisitor fv = classVisitor.visitField(fieldNode.getModifiers(), fieldNode.getName(), BytecodeHelper.getTypeDescription(t), signature, value);<NEW_LINE>visitAnnotations(fieldNode, fv);<NEW_LINE>fv.visitEnd();<NEW_LINE>} | signature = BytecodeHelper.getGenericsBounds(t); |
1,276,892 | private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, final String proxyVmName, final String proxyManagementIp, final int cmdPort) {<NEW_LINE>String result = null;<NEW_LINE>final StringBuffer sb = new StringBuffer();<NEW_LINE>sb.append("http://").append(proxyManagementIp).append(":" + cmdPort).append("/cmd/getstatus");<NEW_LINE>boolean success = true;<NEW_LINE>try {<NEW_LINE>final URL url = new URL(sb.toString());<NEW_LINE>final URLConnection conn = url.openConnection();<NEW_LINE>final <MASK><NEW_LINE>final BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));<NEW_LINE>final StringBuilder sb2 = new StringBuilder();<NEW_LINE>String line = null;<NEW_LINE>try {<NEW_LINE>while ((line = reader.readLine()) != null) sb2.append(line + "\n");<NEW_LINE>result = sb2.toString();<NEW_LINE>} catch (final IOException e) {<NEW_LINE>success = false;<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>is.close();<NEW_LINE>} catch (final IOException e) {<NEW_LINE>s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);<NEW_LINE>success = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);<NEW_LINE>success = false;<NEW_LINE>}<NEW_LINE>return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);<NEW_LINE>} | InputStream is = conn.getInputStream(); |
995,419 | public BLangNode transform(FunctionTypeDescriptorNode functionTypeDescriptorNode) {<NEW_LINE>BLangFunctionTypeNode functionTypeNode = (BLangFunctionTypeNode) TreeBuilder.createFunctionTypeNode();<NEW_LINE>functionTypeNode.pos = getPosition(functionTypeDescriptorNode);<NEW_LINE>functionTypeNode.returnsKeywordExists = true;<NEW_LINE>if (functionTypeDescriptorNode.functionSignature().isPresent()) {<NEW_LINE>FunctionSignatureNode funcSignature = functionTypeDescriptorNode<MASK><NEW_LINE>// Set Parameters<NEW_LINE>for (ParameterNode child : funcSignature.parameters()) {<NEW_LINE>SimpleVariableNode param = (SimpleVariableNode) child.apply(this);<NEW_LINE>if (child.kind() == SyntaxKind.REST_PARAM) {<NEW_LINE>functionTypeNode.restParam = (BLangSimpleVariable) param;<NEW_LINE>} else {<NEW_LINE>functionTypeNode.params.add((BLangVariable) param);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Set Return Type<NEW_LINE>Optional<ReturnTypeDescriptorNode> retNode = funcSignature.returnTypeDesc();<NEW_LINE>if (retNode.isPresent()) {<NEW_LINE>ReturnTypeDescriptorNode returnType = retNode.get();<NEW_LINE>functionTypeNode.returnTypeNode = createTypeNode(returnType.type());<NEW_LINE>} else {<NEW_LINE>BLangValueType bLValueType = (BLangValueType) TreeBuilder.createValueTypeNode();<NEW_LINE>bLValueType.pos = symTable.builtinPos;<NEW_LINE>bLValueType.typeKind = TypeKind.NIL;<NEW_LINE>functionTypeNode.returnTypeNode = bLValueType;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>functionTypeNode.flagSet.add(Flag.ANY_FUNCTION);<NEW_LINE>}<NEW_LINE>functionTypeNode.flagSet.add(Flag.PUBLIC);<NEW_LINE>for (Token token : functionTypeDescriptorNode.qualifierList()) {<NEW_LINE>if (token.kind() == SyntaxKind.ISOLATED_KEYWORD) {<NEW_LINE>functionTypeNode.flagSet.add(Flag.ISOLATED);<NEW_LINE>} else if (token.kind() == SyntaxKind.TRANSACTIONAL_KEYWORD) {<NEW_LINE>functionTypeNode.flagSet.add(Flag.TRANSACTIONAL);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return functionTypeNode;<NEW_LINE>} | .functionSignature().get(); |
1,369,392 | public AdminCreateUserConfigType unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AdminCreateUserConfigType adminCreateUserConfigType = new AdminCreateUserConfigType();<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("AllowAdminCreateUserOnly", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>adminCreateUserConfigType.setAllowAdminCreateUserOnly(context.getUnmarshaller(Boolean.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("UnusedAccountValidityDays", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>adminCreateUserConfigType.setUnusedAccountValidityDays(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("InviteMessageTemplate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>adminCreateUserConfigType.setInviteMessageTemplate(MessageTemplateTypeJsonUnmarshaller.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 adminCreateUserConfigType;<NEW_LINE>} | class).unmarshall(context)); |
1,711,070 | public CompletableFuture<CreateStreamResponse> create(final StreamConfiguration configuration, long createTimestamp, int startingSegmentNumber, OperationContext context) {<NEW_LINE>Preconditions.checkNotNull(context, "operation context cannot be null");<NEW_LINE>return checkStreamExists(configuration, createTimestamp, startingSegmentNumber, context).thenCompose(createStreamResponse -> createStreamMetadata(context).thenCompose((Void v) -> storeCreationTimeIfAbsent(createStreamResponse.getTimestamp(), context)).thenCompose((Void v) -> createConfigurationIfAbsent(StreamConfigurationRecord.complete(scope, name, createStreamResponse.getConfiguration()), context)).thenCompose((Void v) -> createEpochTransitionIfAbsent(EpochTransitionRecord.EMPTY, context)).thenCompose((Void v) -> createTruncationDataIfAbsent(StreamTruncationRecord.EMPTY, context)).thenCompose((Void v) -> createCommitTxnRecordIfAbsent(CommittingTransactionsRecord.EMPTY, context)).thenCompose((Void v) -> createStateIfAbsent(StateRecord.builder().state(State.CREATING).build(), context)).thenCompose((Void v) -> createHistoryRecords(startingSegmentNumber, createStreamResponse, context)).thenCompose((Void v) -> createSubscribersRecordIfAbsent(context)).thenApply(<MASK><NEW_LINE>} | (Void v) -> createStreamResponse)); |
45,662 | protected void replace() throws TextureException {<NEW_LINE>checkBitmapConfiguration();<NEW_LINE>if (mTextureId > 0) {<NEW_LINE>GLES20.glBindTexture(GLES20.GL_TEXTURE_CUBE_MAP, mTextureId);<NEW_LINE>if (mHasCompressedTextures) {<NEW_LINE>for (int i = 0; i < 6; i++) {<NEW_LINE>ACompressedTexture tex = mCompressedTextures[i];<NEW_LINE>tex.add();<NEW_LINE>int w = tex.getWidth()<MASK><NEW_LINE>for (int j = 0; j < tex.getByteBuffers().length; j++) {<NEW_LINE>GLES20.glCompressedTexSubImage2D(CUBE_FACES[i], j, 0, 0, w, h, tex.getCompressionFormat(), tex.getByteBuffers()[j].capacity(), tex.getByteBuffers()[j]);<NEW_LINE>w = w > 1 ? w / 2 : 1;<NEW_LINE>h = h > 1 ? h / 2 : 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>GLES20.glBindTexture(GLES20.GL_TEXTURE_CUBE_MAP, 0);<NEW_LINE>} else {<NEW_LINE>setTextureData();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new TextureException("Couldn't generate a texture name.");<NEW_LINE>}<NEW_LINE>} | , h = tex.getHeight(); |
331,879 | public void writeCsv(CsvOutput.CsvRowOutputWithHeaders csv, CdsIndexTrade trade) {<NEW_LINE>CdsIndex product = trade.getProduct();<NEW_LINE>csv.writeCell(TRADE_TYPE_FIELD, "CdsIndex");<NEW_LINE>csv.writeCell(CDS_INDEX_ID_SCHEME_FIELD, product.getCdsIndexId().getScheme());<NEW_LINE>csv.writeCell(CDS_INDEX_ID_FIELD, product.getCdsIndexId().getValue());<NEW_LINE>String scheme;<NEW_LINE>if (product.getLegalEntityIds().stream().map(StandardId::getScheme).distinct().count() == 1) {<NEW_LINE>scheme = product.getLegalEntityIds().get(0).getScheme();<NEW_LINE>} else {<NEW_LINE>scheme = product.getLegalEntityIds().stream().map(StandardId::getScheme).collect(joining(";"));<NEW_LINE>}<NEW_LINE>csv.writeCell(LEGAL_ENTITY_ID_SCHEME_FIELD, scheme);<NEW_LINE>csv.writeCell(LEGAL_ENTITY_ID_FIELD, product.getLegalEntityIds().stream().map(StandardId::getValue).collect(joining(";")));<NEW_LINE>trade.getUpfrontFee().ifPresent(premium -> CsvWriterUtils.writePremiumFields(csv, premium));<NEW_LINE>CdsTradeCsvPlugin.writeCdsDetails(csv, product.getBuySell(), product.getCurrency(), product.getNotional(), product.getFixedRate(), product.getDayCount(), product.getPaymentOnDefault(), product.getProtectionStart(), product.getStepinDateOffset(), product.getSettlementDateOffset(<MASK><NEW_LINE>} | ), product.getPaymentSchedule()); |
1,842,700 | protected void addPropertyMethod(final MethodNode method) {<NEW_LINE>classNode.addMethod(method);<NEW_LINE>markAsGenerated(classNode, method);<NEW_LINE>// GROOVY-4415 / GROOVY-4645: check that there's no abstract method which corresponds to this one<NEW_LINE><MASK><NEW_LINE>Parameter[] parameters = method.getParameters();<NEW_LINE>ClassNode methodReturnType = method.getReturnType();<NEW_LINE>for (MethodNode node : classNode.getAbstractMethods()) {<NEW_LINE>if (!node.getDeclaringClass().equals(classNode))<NEW_LINE>continue;<NEW_LINE>if (node.getName().equals(methodName) && node.getParameters().length == parameters.length) {<NEW_LINE>if (parameters.length == 1) {<NEW_LINE>// setter<NEW_LINE>ClassNode abstractMethodParameterType = node.getParameters()[0].getType();<NEW_LINE>ClassNode methodParameterType = parameters[0].getType();<NEW_LINE>if (!methodParameterType.isDerivedFrom(abstractMethodParameterType) && !methodParameterType.implementsInterface(abstractMethodParameterType)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ClassNode nodeReturnType = node.getReturnType();<NEW_LINE>if (!methodReturnType.isDerivedFrom(nodeReturnType) && !methodReturnType.implementsInterface(nodeReturnType)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// matching method, remove abstract status and use the same body<NEW_LINE>node.setModifiers(node.getModifiers() ^ ACC_ABSTRACT);<NEW_LINE>node.setCode(method.getCode());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String methodName = method.getName(); |
147,891 | private List<CustomTypeMapping> validateCustomTypeMappings(Map<String, String> customTypeMappings, boolean matchSubclasses) {<NEW_LINE>final List<CustomTypeMapping> mappings = new ArrayList<>();<NEW_LINE>for (Map.Entry<String, String> entry : customTypeMappings.entrySet()) {<NEW_LINE>final String javaName = entry.getKey();<NEW_LINE>final String tsName = entry.getValue();<NEW_LINE>try {<NEW_LINE>final GenericName genericJavaName = parseGenericName(javaName);<NEW_LINE>final GenericName genericTsName = parseGenericName(tsName);<NEW_LINE>validateTypeParameters(genericJavaName.typeParameters);<NEW_LINE>validateTypeParameters(genericTsName.typeParameters);<NEW_LINE>final Class<?> cls = loadClass(classLoader, genericJavaName.rawName, null);<NEW_LINE>final int required = cls.getTypeParameters().length;<NEW_LINE>final int specified = genericJavaName.typeParameters != null ? genericJavaName.typeParameters.size() : 0;<NEW_LINE>if (specified != required) {<NEW_LINE>final String parameters = Stream.of(cls.getTypeParameters()).map(TypeVariable::getName).collect<MASK><NEW_LINE>final String signature = cls.getName() + (parameters.isEmpty() ? "" : "<" + parameters + ">");<NEW_LINE>throw new RuntimeException(String.format("Wrong number of specified generic parameters, required: %s, found: %s. Correct format is: '%s'", required, specified, signature));<NEW_LINE>}<NEW_LINE>mappings.add(new CustomTypeMapping(cls, matchSubclasses, genericJavaName, genericTsName));<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(String.format("Failed to parse configured custom type mapping '%s:%s': %s", javaName, tsName, e.getMessage()), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mappings;<NEW_LINE>} | (Collectors.joining(", ")); |
693,635 | private MessageExtBrokerInner toMessageExtBrokerInner(MessageExt msgExt) {<NEW_LINE>TopicConfig topicConfig = this.getBrokerController().getTopicConfigManager().createTopicOfTranCheckMaxTime(TCMT_QUEUE_NUMS, <MASK><NEW_LINE>int queueId = ThreadLocalRandom.current().nextInt(99999999) % TCMT_QUEUE_NUMS;<NEW_LINE>MessageExtBrokerInner inner = new MessageExtBrokerInner();<NEW_LINE>inner.setTopic(topicConfig.getTopicName());<NEW_LINE>inner.setBody(msgExt.getBody());<NEW_LINE>inner.setFlag(msgExt.getFlag());<NEW_LINE>MessageAccessor.setProperties(inner, msgExt.getProperties());<NEW_LINE>inner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));<NEW_LINE>inner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgExt.getTags()));<NEW_LINE>inner.setQueueId(queueId);<NEW_LINE>inner.setSysFlag(msgExt.getSysFlag());<NEW_LINE>inner.setBornHost(msgExt.getBornHost());<NEW_LINE>inner.setBornTimestamp(msgExt.getBornTimestamp());<NEW_LINE>inner.setStoreHost(msgExt.getStoreHost());<NEW_LINE>inner.setReconsumeTimes(msgExt.getReconsumeTimes());<NEW_LINE>inner.setMsgId(msgExt.getMsgId());<NEW_LINE>inner.setWaitStoreMsgOK(false);<NEW_LINE>return inner;<NEW_LINE>} | PermName.PERM_READ | PermName.PERM_WRITE); |
563,852 | protected void renderBg(PoseStack matrices, float partialTicks, int mouseX, int mouseY) {<NEW_LINE>RenderUtils.setup(BACKGROUND_IMAGE);<NEW_LINE>this.border.draw(matrices);<NEW_LINE>BACKGROUND.drawScaled(matrices, this.leftPos + 4, this.topPos + 4, this.imageWidth - 8, this.imageHeight - 8);<NEW_LINE><MASK><NEW_LINE>float x = 5 + this.leftPos;<NEW_LINE>int color = 0xfff0f0f0;<NEW_LINE>// info ? in the top right corner<NEW_LINE>if (this.hasTooltips()) {<NEW_LINE>this.font.draw(matrices, "?", guiRight() - this.border.w - this.font.width("?") / 2f, this.topPos + 5, 0xff5f5f5f);<NEW_LINE>}<NEW_LINE>// draw caption<NEW_LINE>int scaledFontHeight = this.getScaledFontHeight();<NEW_LINE>if (this.hasCaption()) {<NEW_LINE>int x2 = this.imageWidth / 2;<NEW_LINE>x2 -= this.font.width(this.caption) / 2;<NEW_LINE>this.font.drawShadow(matrices, this.caption.getVisualOrderText(), (float) this.leftPos + x2, y, color);<NEW_LINE>y += scaledFontHeight + 3;<NEW_LINE>}<NEW_LINE>if (this.text == null || this.text.size() == 0) {<NEW_LINE>// no text to draw<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>float textHeight = font.lineHeight + 0.5f;<NEW_LINE>float lowerBound = (this.topPos + this.imageHeight - 5) / this.textScale;<NEW_LINE>matrices.pushPose();<NEW_LINE>matrices.scale(this.textScale, this.textScale, 1.0f);<NEW_LINE>// RenderSystem.scalef(this.textScale, this.textScale, 1.0f);<NEW_LINE>x /= this.textScale;<NEW_LINE>y /= this.textScale;<NEW_LINE>// render shown lines<NEW_LINE>ListIterator<FormattedCharSequence> iter = this.getTotalLines().listIterator(this.slider.getValue());<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>if (y + textHeight - 0.5f > lowerBound) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>FormattedCharSequence line = iter.next();<NEW_LINE>this.font.drawShadow(matrices, line, x, y, color);<NEW_LINE>y += textHeight;<NEW_LINE>}<NEW_LINE>matrices.popPose();<NEW_LINE>// RenderSystem.scalef(1f / textScale, 1f / textScale, 1.0f);<NEW_LINE>// RenderSystem.setShaderTexture(0, BACKGROUND_IMAGE);<NEW_LINE>RenderUtils.setup(BACKGROUND_IMAGE);<NEW_LINE>this.slider.update(mouseX, mouseY);<NEW_LINE>this.slider.draw(matrices);<NEW_LINE>} | float y = 5 + this.topPos; |
597,972 | protected <RESULT extends FileConfig> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {<NEW_LINE>try {<NEW_LINE>final RESULT result = entityType.newInstance();<NEW_LINE>result.setAvailable(DfTypeUtil.toBoolean(source.get("available")));<NEW_LINE>result.setBoost(DfTypeUtil.toFloat(source.get("boost")));<NEW_LINE>result.setConfigParameter(DfTypeUtil.toString(source.get("configParameter")));<NEW_LINE>result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));<NEW_LINE>result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));<NEW_LINE>result.setDepth(DfTypeUtil.toInteger(source.get("depth")));<NEW_LINE>result.setDescription(DfTypeUtil.toString(source.get("description")));<NEW_LINE>result.setExcludedDocPaths(DfTypeUtil.toString(source.get("excludedDocPaths")));<NEW_LINE>result.setExcludedPaths(DfTypeUtil.toString(source.get("excludedPaths")));<NEW_LINE>result.setIncludedDocPaths(DfTypeUtil.toString(source.get("includedDocPaths")));<NEW_LINE>result.setIncludedPaths(DfTypeUtil.toString(source.get("includedPaths")));<NEW_LINE>result.setIntervalTime(DfTypeUtil.toInteger(source.get("intervalTime")));<NEW_LINE>result.setMaxAccessCount(DfTypeUtil.toLong(source.get("maxAccessCount")));<NEW_LINE>result.setName(DfTypeUtil.toString(<MASK><NEW_LINE>result.setNumOfThread(DfTypeUtil.toInteger(source.get("numOfThread")));<NEW_LINE>result.setPaths(DfTypeUtil.toString(source.get("paths")));<NEW_LINE>result.setPermissions(toStringArray(source.get("permissions")));<NEW_LINE>result.setSortOrder(DfTypeUtil.toInteger(source.get("sortOrder")));<NEW_LINE>result.setTimeToLive(DfTypeUtil.toInteger(source.get("timeToLive")));<NEW_LINE>result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));<NEW_LINE>result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));<NEW_LINE>result.setVirtualHosts(toStringArray(source.get("virtualHosts")));<NEW_LINE>return updateEntity(source, result);<NEW_LINE>} catch (InstantiationException | IllegalAccessException e) {<NEW_LINE>final String msg = "Cannot create a new instance: " + entityType.getName();<NEW_LINE>throw new IllegalBehaviorStateException(msg, e);<NEW_LINE>}<NEW_LINE>} | source.get("name"))); |
73,466 | public FieldStatsResult fieldStats(String query, String filter, TimeRange range, Set<String> indices, String field, boolean includeCardinality, boolean includeStats, boolean includeCount) {<NEW_LINE>final SearchesConfig config = SearchesConfig.builder().query(query).filter(filter).range(range).offset(0).limit(-1).build();<NEW_LINE>final SearchSourceBuilder searchSourceBuilder = searchRequestFactory.create(config);<NEW_LINE>if (includeCount) {<NEW_LINE>searchSourceBuilder.aggregation(AggregationBuilders.count(AGG_VALUE_COUNT).field(field));<NEW_LINE>}<NEW_LINE>if (includeStats) {<NEW_LINE>searchSourceBuilder.aggregation(AggregationBuilders.extendedStats(<MASK><NEW_LINE>}<NEW_LINE>if (includeCardinality) {<NEW_LINE>searchSourceBuilder.aggregation(AggregationBuilders.cardinality(AGG_CARDINALITY).field(field));<NEW_LINE>}<NEW_LINE>if (indices.isEmpty()) {<NEW_LINE>return FieldStatsResult.empty(query, searchSourceBuilder.toString());<NEW_LINE>}<NEW_LINE>final SearchRequest searchRequest = new SearchRequest(indices.toArray(new String[0])).source(searchSourceBuilder);<NEW_LINE>final SearchResponse searchResult = client.search(searchRequest, "Unable to retrieve fields stats");<NEW_LINE>final List<ResultMessage> resultMessages = extractResultMessages(searchResult);<NEW_LINE>final long tookMs = searchResult.getTook().getMillis();<NEW_LINE>final ExtendedStats extendedStatsAggregation = searchResult.getAggregations().get(AGG_EXTENDED_STATS);<NEW_LINE>final ValueCount valueCountAggregation = searchResult.getAggregations().get(AGG_VALUE_COUNT);<NEW_LINE>final Cardinality cardinalityAggregation = searchResult.getAggregations().get(AGG_CARDINALITY);<NEW_LINE>return createFieldStatsResult(extendedStatsAggregation, valueCountAggregation, cardinalityAggregation, resultMessages, query, searchSourceBuilder.toString(), tookMs);<NEW_LINE>} | AGG_EXTENDED_STATS).field(field)); |
643,717 | public static DescribeSlowLogRecordsResponse unmarshall(DescribeSlowLogRecordsResponse describeSlowLogRecordsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeSlowLogRecordsResponse.setRequestId(_ctx.stringValue("DescribeSlowLogRecordsResponse.RequestId"));<NEW_LINE>SlowLogRecords slowLogRecords = new SlowLogRecords();<NEW_LINE>slowLogRecords.setRows(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Rows"));<NEW_LINE>slowLogRecords.setRowsBeforeLimitAtLeast<MASK><NEW_LINE>Statistics statistics = new Statistics();<NEW_LINE>statistics.setRowsRead(_ctx.integerValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Statistics.RowsRead"));<NEW_LINE>statistics.setElapsedTime(_ctx.floatValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Statistics.ElapsedTime"));<NEW_LINE>statistics.setBytesRead(_ctx.integerValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Statistics.BytesRead"));<NEW_LINE>slowLogRecords.setStatistics(statistics);<NEW_LINE>List<ResultSet> tableSchema = new ArrayList<ResultSet>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeSlowLogRecordsResponse.SlowLogRecords.TableSchema.Length"); i++) {<NEW_LINE>ResultSet resultSet = new ResultSet();<NEW_LINE>resultSet.setType(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.TableSchema[" + i + "].Type"));<NEW_LINE>resultSet.setName(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.TableSchema[" + i + "].Name"));<NEW_LINE>tableSchema.add(resultSet);<NEW_LINE>}<NEW_LINE>slowLogRecords.setTableSchema(tableSchema);<NEW_LINE>List<ResultSet1> data = new ArrayList<ResultSet1>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data.Length"); i++) {<NEW_LINE>ResultSet1 resultSet1 = new ResultSet1();<NEW_LINE>resultSet1.setType(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].Type"));<NEW_LINE>resultSet1.setQueryStartTime(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].QueryStartTime"));<NEW_LINE>resultSet1.setQuery(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].Query"));<NEW_LINE>resultSet1.setReadRows(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].ReadRows"));<NEW_LINE>resultSet1.setInitialAddress(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].InitialAddress"));<NEW_LINE>resultSet1.setMemoryUsage(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].MemoryUsage"));<NEW_LINE>resultSet1.setInitialUser(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].InitialUser"));<NEW_LINE>resultSet1.setInitialQueryId(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].InitialQueryId"));<NEW_LINE>resultSet1.setReadBytes(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].ReadBytes"));<NEW_LINE>resultSet1.setQueryDurationMs(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].QueryDurationMs"));<NEW_LINE>resultSet1.setResultBytes(_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.Data[" + i + "].ResultBytes"));<NEW_LINE>data.add(resultSet1);<NEW_LINE>}<NEW_LINE>slowLogRecords.setData(data);<NEW_LINE>describeSlowLogRecordsResponse.setSlowLogRecords(slowLogRecords);<NEW_LINE>return describeSlowLogRecordsResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeSlowLogRecordsResponse.SlowLogRecords.RowsBeforeLimitAtLeast")); |
118,220 | private FetchedData doHandle(ContentHandlerArgs args, MessageQueue mq) {<NEW_LINE>String inputUrlString = CajaArguments.URL.get(args);<NEW_LINE>URI inputUri;<NEW_LINE>if (inputUrlString == null) {<NEW_LINE>mq.addMessage(ServiceMessageType.MISSING_ARGUMENT, MessagePart.Factory.valueOf(CajaArguments.URL.toString()));<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>inputUri = new URI(inputUrlString);<NEW_LINE>} catch (URISyntaxException ex) {<NEW_LINE>mq.addMessage(ServiceMessageType.INVALID_INPUT_URL, MessagePart.Factory.valueOf(inputUrlString));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String expectedInputContentType = CajaArguments.INPUT_MIME_TYPE.get(args);<NEW_LINE>if (expectedInputContentType == null) {<NEW_LINE>mq.addMessage(ServiceMessageType.MISSING_ARGUMENT, MessagePart.Factory.valueOf(CajaArguments.INPUT_MIME_TYPE.toString()));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>FetchedData inputFetchedData;<NEW_LINE>try {<NEW_LINE>inputFetchedData = uriFetcher.fetch(new ExternalReference(inputUri, FilePosition.UNKNOWN), expectedInputContentType);<NEW_LINE>} catch (UriFetcher.UriFetchException ex) {<NEW_LINE>ex.toMessageQueue(mq);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!typeCheck.check(expectedInputContentType, inputFetchedData.getContentType())) {<NEW_LINE>mq.addMessage(ServiceMessageType.UNEXPECTED_INPUT_MIME_TYPE, MessagePart.Factory.valueOf(expectedInputContentType), MessagePart.Factory.valueOf(inputFetchedData.getContentType()));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ByteArrayOutputStream intermediateResponse = new ByteArrayOutputStream();<NEW_LINE>Pair<String, String> contentInfo;<NEW_LINE>try {<NEW_LINE>contentInfo = applyHandler(inputUri, args, inputFetchedData, intermediateResponse, mq);<NEW_LINE>} catch (UnsupportedContentTypeException e) {<NEW_LINE>mq.addMessage(ServiceMessageType.UNSUPPORTED_CONTENT_TYPES);<NEW_LINE>return null;<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>mq.addMessage(ServiceMessageType.EXCEPTION_IN_SERVICE, MessagePart.Factory.valueOf(e.toString()));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return FetchedData.fromBytes(intermediateResponse.toByteArray(), contentInfo.a, contentInfo.<MASK><NEW_LINE>} | b, new InputSource(inputUri)); |
298,993 | private void putLang(ChannelHandlerContext ctx, FullHttpRequest req) {<NEW_LINE>JSONStringer jso = new JSONStringer();<NEW_LINE>LangFileUpdater.updateCustomLang(req.content().toString(Charset.forName("UTF-8")), req.headers().get("lang-path"), jso);<NEW_LINE>JSONObject j;<NEW_LINE>try {<NEW_LINE>j = new JSONObject(jso.toString());<NEW_LINE>} catch (JSONException ex) {<NEW_LINE>com.gmt2001.Console.debug.println("500" + req.method().asciiName() + ": lang " + req.headers().get("lang-path"));<NEW_LINE>HttpServerPageHandler.sendHttpResponse(ctx, req, HttpServerPageHandler.prepareHttpResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR, "Unable to Check Success.".getBytes(Charset.forName<MASK><NEW_LINE>com.gmt2001.Console.err.logStackTrace(ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (j.getBoolean("success")) {<NEW_LINE>com.gmt2001.Console.debug.println("200" + req.method().asciiName() + ": lang " + req.headers().get("lang-path"));<NEW_LINE>HttpServerPageHandler.sendHttpResponse(ctx, req, HttpServerPageHandler.prepareHttpResponse(HttpResponseStatus.OK, "File Updated.".getBytes(Charset.forName("UTF-8")), "plain"));<NEW_LINE>} else {<NEW_LINE>com.gmt2001.Console.debug.println("500" + req.method().asciiName() + ": lang " + req.headers().get("lang-path"));<NEW_LINE>HttpServerPageHandler.sendHttpResponse(ctx, req, HttpServerPageHandler.prepareHttpResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR, j.getJSONArray("errors").getJSONObject(0).getString("detail").getBytes(Charset.forName("UTF-8")), "plain"));<NEW_LINE>}<NEW_LINE>} | ("UTF-8")), "plain")); |
1,166,054 | public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {<NEW_LINE>if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {<NEW_LINE>child.setFitsSystemWindows(true);<NEW_LINE>}<NEW_LINE>int savedTop = child.getTop();<NEW_LINE>// First let the parent lay it out<NEW_LINE>parent.onLayoutChild(child, layoutDirection);<NEW_LINE>// Offset the bottom sheet<NEW_LINE>mParentHeight = parent.getHeight();<NEW_LINE>int peekHeight;<NEW_LINE>if (mPeekHeightAuto) {<NEW_LINE>if (mPeekHeightMin == 0) {<NEW_LINE>mPeekHeightMin = parent.getResources().getDimensionPixelSize(R.dimen.design_bottom_sheet_peek_height_min);<NEW_LINE>}<NEW_LINE>peekHeight = Math.max(mPeekHeightMin, mParentHeight - parent.getWidth() * 9 / 16);<NEW_LINE>} else {<NEW_LINE>peekHeight = mPeekHeight;<NEW_LINE>}<NEW_LINE>mMinOffset = Math.max(0, mParentHeight - child.getHeight());<NEW_LINE>mMaxOffset = Math.max(mParentHeight - peekHeight, mMinOffset);<NEW_LINE>if (mState == STATE_EXPANDED) {<NEW_LINE>ViewCompat.offsetTopAndBottom(child, mMinOffset);<NEW_LINE>} else if (mHideable && mState == STATE_HIDDEN) {<NEW_LINE>ViewCompat.offsetTopAndBottom(child, mParentHeight);<NEW_LINE>} else if (mState == STATE_COLLAPSED) {<NEW_LINE><MASK><NEW_LINE>} else if (mState == STATE_DRAGGING || mState == STATE_SETTLING) {<NEW_LINE>ViewCompat.offsetTopAndBottom(child, savedTop - child.getTop());<NEW_LINE>}<NEW_LINE>if (mViewDragHelper == null) {<NEW_LINE>mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);<NEW_LINE>}<NEW_LINE>mViewRef = new WeakReference<>(child);<NEW_LINE>mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child));<NEW_LINE>return true;<NEW_LINE>} | ViewCompat.offsetTopAndBottom(child, mMaxOffset); |
1,669,185 | private static boolean isServiceInterestingToUser() {<NEW_LINE>try {<NEW_LINE>Class activityThreadClass = Class.forName("android.app.ActivityThread");<NEW_LINE>Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null);<NEW_LINE>Field servicesField = activityThreadClass.getDeclaredField("mServices");<NEW_LINE>servicesField.setAccessible(true);<NEW_LINE>Map<Object, Object> services;<NEW_LINE>if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {<NEW_LINE>services = (HashMap<Object, Object>) servicesField.get(activityThread);<NEW_LINE>} else {<NEW_LINE>services = (ArrayMap<Object, Object<MASK><NEW_LINE>}<NEW_LINE>if (services.size() < 1) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (Object serviceObj : services.values()) {<NEW_LINE>Class serviceClass = serviceObj.getClass();<NEW_LINE>Service service = (Service) serviceObj;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | >) servicesField.get(activityThread); |
1,172,597 | public RefactoringStatus[] checkAndResolveMethodTypes() throws CoreException {<NEW_LINE>RefactoringStatus[] results = new MethodTypesSyntaxChecker(fMethod, fParameterInfos, fReturnTypeInfo).checkSyntax();<NEW_LINE>for (RefactoringStatus result : results) {<NEW_LINE>if (result != null && result.hasFatalError()) {<NEW_LINE>return results;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int parameterCount = fParameterInfos.size();<NEW_LINE>String[] types = new String[parameterCount + 1];<NEW_LINE>for (int i = 0; i < parameterCount; i++) {<NEW_LINE>types[i] = ParameterInfo.stripEllipsis((fParameterInfos.get(i)).getNewTypeName());<NEW_LINE>}<NEW_LINE>types[parameterCount] = fReturnTypeInfo.getNewTypeName();<NEW_LINE>RefactoringStatus[] semanticsResults = new RefactoringStatus[parameterCount + 1];<NEW_LINE>ITypeBinding[] typeBindings = resolveBindings(types, semanticsResults, true);<NEW_LINE>boolean needsSecondPass = false;<NEW_LINE>for (int i = 0; i < types.length; i++) {<NEW_LINE>if (typeBindings[i] == null || !semanticsResults[i].isOK()) {<NEW_LINE>needsSecondPass = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RefactoringStatus[] semanticsResults2 = new RefactoringStatus[parameterCount + 1];<NEW_LINE>if (needsSecondPass) {<NEW_LINE>typeBindings = <MASK><NEW_LINE>}<NEW_LINE>for (int i = 0; i < fParameterInfos.size(); i++) {<NEW_LINE>ParameterInfo parameterInfo = fParameterInfos.get(i);<NEW_LINE>if (!parameterInfo.isResolve()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (parameterInfo.getOldTypeBinding() != null && !parameterInfo.isTypeNameChanged()) {<NEW_LINE>parameterInfo.setNewTypeBinding(parameterInfo.getOldTypeBinding());<NEW_LINE>} else {<NEW_LINE>parameterInfo.setNewTypeBinding(typeBindings[i]);<NEW_LINE>if (typeBindings[i] == null || (needsSecondPass && !semanticsResults2[i].isOK())) {<NEW_LINE>if (results[i] == null) {<NEW_LINE>results[i] = semanticsResults2[i];<NEW_LINE>} else {<NEW_LINE>results[i].merge(semanticsResults2[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>fReturnTypeInfo.setNewTypeBinding(typeBindings[fParameterInfos.size()]);<NEW_LINE>if (typeBindings[parameterCount] == null || (needsSecondPass && !semanticsResults2[parameterCount].isOK())) {<NEW_LINE>if (results[parameterCount] == null) {<NEW_LINE>results[parameterCount] = semanticsResults2[parameterCount];<NEW_LINE>} else {<NEW_LINE>results[parameterCount].merge(semanticsResults2[parameterCount]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | resolveBindings(types, semanticsResults2, false); |
880,927 | protected ActionCallback _execute(PlaybackContext context) {<NEW_LINE>String[] args = getText().substring(PREFIX.length()).trim().split(" ");<NEW_LINE>String syntaxText = "Syntax error, expected: " + PREFIX + " " + ON + "|" + OFF + " actionName";<NEW_LINE>if (args.length != 2) {<NEW_LINE>context.error(syntaxText, getLine());<NEW_LINE>return new ActionCallback.Rejected();<NEW_LINE>}<NEW_LINE>final boolean on;<NEW_LINE>if (ON.equalsIgnoreCase(args[0])) {<NEW_LINE>on = true;<NEW_LINE>} else if (OFF.equalsIgnoreCase(args[0])) {<NEW_LINE>on = false;<NEW_LINE>} else {<NEW_LINE>context.error(syntaxText, getLine());<NEW_LINE>return new ActionCallback.Rejected();<NEW_LINE>}<NEW_LINE>String actionId = args[1];<NEW_LINE>final AnAction action = ActionManager.getInstance().getAction(actionId);<NEW_LINE>if (action == null) {<NEW_LINE>context.error("Unknown action id=" + actionId, getLine());<NEW_LINE>return new ActionCallback.Rejected();<NEW_LINE>}<NEW_LINE>if (!(action instanceof ToggleAction)) {<NEW_LINE>context.error("Action is not a toggle action id=" + actionId, getLine());<NEW_LINE>return new ActionCallback.Rejected();<NEW_LINE>}<NEW_LINE>final InputEvent <MASK><NEW_LINE>final ActionCallback result = new ActionCallback();<NEW_LINE>context.getRobot().delay(Registry.intValue("actionSystem.playback.delay"));<NEW_LINE>IdeFocusManager fm = IdeFocusManager.getGlobalInstance();<NEW_LINE>fm.doWhenFocusSettlesDown(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>final Presentation presentation = (Presentation) action.getTemplatePresentation().clone();<NEW_LINE>AnActionEvent event = new AnActionEvent(inputEvent, DataManager.getInstance().getDataContext(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()), ActionPlaces.UNKNOWN, presentation, ActionManager.getInstance(), 0);<NEW_LINE>ActionUtil.performDumbAwareUpdate(LaterInvocator.isInModalContext(), action, event, false);<NEW_LINE>Boolean state = (Boolean) event.getPresentation().getClientProperty(ToggleAction.SELECTED_PROPERTY);<NEW_LINE>if (state.booleanValue() != on) {<NEW_LINE>ActionManager.getInstance().tryToExecute(action, inputEvent, null, ActionPlaces.UNKNOWN, true).doWhenProcessed(result.createSetDoneRunnable());<NEW_LINE>} else {<NEW_LINE>result.setDone();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>} | inputEvent = ActionCommand.getInputEvent(actionId); |
1,048,587 | public void run() {<NEW_LINE>Context context = mCore.getContext();<NEW_LINE>String mainProc = context.getPackageName();<NEW_LINE>if (mainProc.contains(":")) {<NEW_LINE>mainProc = mainProc.substring(0, mainProc.indexOf(":"));<NEW_LINE>}<NEW_LINE>ActivityManager am = (ActivityManager) <MASK><NEW_LINE>if (am == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<ActivityManager.RunningAppProcessInfo> processes = am.getRunningAppProcesses();<NEW_LINE>if (processes == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (ActivityManager.RunningAppProcessInfo item : processes) {<NEW_LINE>if (item.processName.startsWith(mainProc)) {<NEW_LINE>if (mGlobalAppImportance > item.importance) {<NEW_LINE>MatrixLog.i(TAG, "update global importance: " + mGlobalAppImportance + " > " + item.importance + ", reason = " + item.importanceReasonComponent);<NEW_LINE>mGlobalAppImportance = item.importance;<NEW_LINE>}<NEW_LINE>if (item.processName.equals(context.getPackageName())) {<NEW_LINE>if (mAppImportance > item.importance) {<NEW_LINE>MatrixLog.i(TAG, "update app importance: " + mAppImportance + " > " + item.importance + ", reason = " + item.importanceReasonComponent);<NEW_LINE>mAppImportance = item.importance;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | context.getSystemService(Context.ACTIVITY_SERVICE); |
1,535,291 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String epl = "@public create table MyTable(sortcol sorted(intPrimitive) @type('SupportBean'));\n" + "into table MyTable select sorted(*) as sortcol from SupportBean;\n";<NEW_LINE>env.compileDeploy(epl, path);<NEW_LINE>env.eplToModelCompileDeploy("@name('s0') select sortcol.floorEvent(id) as c0 from SupportBean_S0, MyTable", path).addListener("s0");<NEW_LINE>TreeMap<Integer, List<SupportBean>> treemap = new TreeMap<>();<NEW_LINE>makeSendBean(env, treemap, "E1", 10);<NEW_LINE>makeSendBean(env, treemap, "E2", 20);<NEW_LINE>makeSendBean(env, treemap, "E3", 30);<NEW_LINE>env.milestone(0);<NEW_LINE>for (int i = 0; i < 40; i++) {<NEW_LINE>env.<MASK><NEW_LINE>final int index = i;<NEW_LINE>env.assertEventNew("s0", event -> assertEquals(floorEntryFirstEvent(treemap, index), event.get("c0")));<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | sendEventBean(new SupportBean_S0(i)); |
938,115 | public static void main(String[] args) throws UnsupportedAudioFileException, IOException, MaryConfigurationException {<NEW_LINE>if (args.length < 3) {<NEW_LINE>System.out.println("Missing parameters:");<NEW_LINE>System.out.println("<input wav file or directory> <output wav file or directory> <full path of phone set file>");<NEW_LINE>System.out.println("Example phone set file: .../lib/modules/en/us/lexicon/allophones.en_US.xml");<NEW_LINE>} else {<NEW_LINE>String phoneSetFile = args[2];<NEW_LINE>AllophoneSet allophoneSet = AllophoneSet.getAllophoneSet(phoneSetFile);<NEW_LINE>Set<String> tmpPhonemes = allophoneSet.getAllophoneNames();<NEW_LINE>int count = 0;<NEW_LINE>Allophone[] allophones = new Allophone[tmpPhonemes.size()];<NEW_LINE>for (Iterator<String> it = tmpPhonemes.iterator(); it.hasNext(); ) {<NEW_LINE>allophones[count] = allophoneSet.getAllophone(it.next());<NEW_LINE>count++;<NEW_LINE>if (count >= tmpPhonemes.size())<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (// Process folder<NEW_LINE>FileUtils.isDirectory(args[0])) {<NEW_LINE>if (!FileUtils.exists(args[1]))<NEW_LINE>FileUtils.createDirectory(args[1]);<NEW_LINE>String[] fileList = FileUtils.getFileList(args[0], "wav");<NEW_LINE>String outputFolder = StringUtils.checkLastSlash(args[1]);<NEW_LINE>if (fileList != null) {<NEW_LINE>for (int i = 0; i < fileList.length; i++) {<NEW_LINE>String baseFileName = StringUtils.getFileName(fileList[i], true);<NEW_LINE><MASK><NEW_LINE>mainSingleFile(fileList[i], outputFile, allophones);<NEW_LINE>System.out.println("Processing completed for file " + String.valueOf(i + 1) + " of " + String.valueOf(fileList.length));<NEW_LINE>}<NEW_LINE>} else<NEW_LINE>System.out.println("No wav files found!");<NEW_LINE>} else<NEW_LINE>// Process file<NEW_LINE>mainSingleFile(args[0], args[1], allophones);<NEW_LINE>System.out.println("Processing completed...");<NEW_LINE>}<NEW_LINE>} | String outputFile = outputFolder + baseFileName + ".wav"; |
764,798 | public void beginCopy2() {<NEW_LINE>ShareFileAsyncClient shareFileAsyncClient = createAsyncClientWithSASToken();<NEW_LINE>// BEGIN: com.azure.storage.file.share.ShareFileAsyncClient.beginCopy#string-filesmbproperties-string-permissioncopymodetype-boolean-boolean-map-duration-ShareRequestConditions<NEW_LINE>FileSmbProperties smbProperties = new FileSmbProperties().setNtfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)).setFileCreationTime(OffsetDateTime.now()).setFileLastWriteTime(OffsetDateTime.now()).setFilePermissionKey("filePermissionKey");<NEW_LINE>String filePermission = "filePermission";<NEW_LINE>// NOTE: filePermission and filePermissionKey should never be both set<NEW_LINE>// Default value<NEW_LINE>boolean ignoreReadOnly = false;<NEW_LINE>// Default value<NEW_LINE>boolean setArchiveAttribute = true;<NEW_LINE>ShareRequestConditions requestConditions = new ShareRequestConditions().setLeaseId(leaseId);<NEW_LINE>PollerFlux<ShareFileCopyInfo, Void> poller = shareFileAsyncClient.beginCopy("https://{accountName}.file.core.windows.net?{SASToken}", smbProperties, filePermission, PermissionCopyModeType.SOURCE, ignoreReadOnly, setArchiveAttribute, Collections.singletonMap("file", "metadata"), Duration.ofSeconds(2), requestConditions);<NEW_LINE>poller.subscribe(response -> {<NEW_LINE>final ShareFileCopyInfo value = response.getValue();<NEW_LINE>System.out.printf("Copy source: %s. Status: %s.%n", value.getCopySourceUrl(), value.getCopyStatus());<NEW_LINE>}, error -> System.err.println("Error: " + error), () -> System<MASK><NEW_LINE>// END: com.azure.storage.file.share.ShareFileAsyncClient.beginCopy#string-filesmbproperties-string-permissioncopymodetype-boolean-boolean-map-duration-ShareRequestConditions<NEW_LINE>} | .out.println("Complete copying the file.")); |
1,519,501 | public Stream<CentralityScore> stream(@Name(value = "label", defaultValue = "") String label, @Name(value = "relationship", defaultValue = "") String relationship, @Name(value = "config", defaultValue = "{}") Map<String, Object> config) {<NEW_LINE>ProcedureConfiguration configuration = ProcedureConfiguration.create(config);<NEW_LINE>PageRankScore.Stats.Builder statsBuilder = new PageRankScore.Stats.Builder();<NEW_LINE>AllocationTracker tracker = AllocationTracker.create();<NEW_LINE>final Graph graph = load(label, relationship, tracker, configuration.<MASK><NEW_LINE>if (graph.nodeCount() == 0) {<NEW_LINE>graph.release();<NEW_LINE>return Stream.empty();<NEW_LINE>}<NEW_LINE>TerminationFlag terminationFlag = TerminationFlag.wrap(transaction);<NEW_LINE>CentralityResult scores = runAlgorithm(graph, tracker, terminationFlag, configuration, statsBuilder);<NEW_LINE>log.info("Eigenvector Centrality: overall memory usage: %s", tracker.getUsageString());<NEW_LINE>return CentralityUtils.streamResults(graph, scores);<NEW_LINE>} | getGraphImpl(), statsBuilder, configuration); |
742,714 | private void computeProjection() {<NEW_LINE>projection = new Projection.Short(0, <MASK><NEW_LINE>final ArrayList<Integer> derivatives = new ArrayList<>();<NEW_LINE>final LineInfo firstLine = staff.getFirstLine();<NEW_LINE>final LineInfo lastLine = staff.getLastLine();<NEW_LINE>final int dx = params.staffAbscissaMargin;<NEW_LINE>final int xMin = xClamp(staff.getAbscissa(LEFT) - dx);<NEW_LINE>final int xMax = xClamp(staff.getAbscissa(RIGHT) + dx);<NEW_LINE>// Correction for ordinates of a 1-line staff<NEW_LINE>final int dy = staff.isOneLineStaff() ? (2 * scale.getInterline()) : 0;<NEW_LINE>// Populating projection data<NEW_LINE>for (int x = xMin; x <= xMax; x++) {<NEW_LINE>int yMin = firstLine.yAt(x) - dy;<NEW_LINE>int yMax = lastLine.yAt(x) - 1 + dy;<NEW_LINE>short count = 0;<NEW_LINE>for (int y = yMin; y <= yMax; y++) {<NEW_LINE>if (pixelFilter.get(x, y) == 0) {<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>projection.increment(x, count);<NEW_LINE>if (x > xMin) {<NEW_LINE>derivatives.add(Math.abs(projection.getDerivative(x)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Computing minDerivative from observed top values<NEW_LINE>Collections.sort(derivatives);<NEW_LINE>final int size = derivatives.size();<NEW_LINE>final int top = constants.topDerivativeNumber.getValue();<NEW_LINE>int derCumul = 0;<NEW_LINE>for (int i = 1; i <= top; i++) {<NEW_LINE>derCumul += derivatives.get(size - i);<NEW_LINE>}<NEW_LINE>final double eliteDer = (double) derCumul / top;<NEW_LINE>derivativeThreshold = (int) Math.rint(eliteDer * constants.minDerivativeRatio.getValue());<NEW_LINE>logger.debug("eliteDerivative:{} derivativeThreshold:{} ", eliteDer, derivativeThreshold);<NEW_LINE>} | sheet.getWidth() - 1); |
31,821 | public String formatWhiteCard(final JSONArray textParts) {<NEW_LINE>// The white cards should only ever have one element in text, but let's be safe.<NEW_LINE>final List<String> strs = new ArrayList<String>(textParts.size());<NEW_LINE>for (final Object o : textParts) {<NEW_LINE>final String cardCastString = (String) o;<NEW_LINE>if (cardCastString.isEmpty()) {<NEW_LINE>// skip blank segments<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final StringBuilder pyxString = new StringBuilder();<NEW_LINE>// Cardcast's recommended format is to not capitalize the first letter<NEW_LINE>pyxString.append(cardCastString.substring(0, 1).toUpperCase());<NEW_LINE>pyxString.append(cardCastString.substring(1));<NEW_LINE>// Cardcast's recommended format is to not include a period<NEW_LINE>if (Character.isLetterOrDigit(cardCastString.charAt(cardCastString.length() - 1))) {<NEW_LINE>pyxString.append('.');<NEW_LINE>}<NEW_LINE>// Cardcast's white cards are now formatted consistently with pyx cards<NEW_LINE>strs.add(pyxString.toString());<NEW_LINE>}<NEW_LINE>// escape before we do tag processing<NEW_LINE>String text = StringEscapeUtils.escapeXml11(StringUtils<MASK><NEW_LINE>final String textLower = text.toLowerCase(Locale.ENGLISH);<NEW_LINE>// allow [img] tags<NEW_LINE>if (textLower.startsWith("[img]") && textLower.endsWith("[/img]")) {<NEW_LINE>text = String.format("<img src='%s' alt='A card with just a picture on it.' class='imagecard' />", text.substring("[img]".length(), text.length() - "[/img]".length()));<NEW_LINE>}<NEW_LINE>return text;<NEW_LINE>} | .join(strs, "")); |
961,580 | private void createRowKeyForMappedProperties(ResultMap resultMap, ResultSetWrapper rsw, CacheKey cacheKey, List<ResultMapping> resultMappings, String columnPrefix) throws SQLException {<NEW_LINE>for (ResultMapping resultMapping : resultMappings) {<NEW_LINE>if (resultMapping.isSimple()) {<NEW_LINE>final String column = prependPrefix(resultMapping.getColumn(), columnPrefix);<NEW_LINE>final TypeHandler<?<MASK><NEW_LINE>List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);<NEW_LINE>// Issue #114<NEW_LINE>if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) {<NEW_LINE>final Object value = th.getResult(rsw.getResultSet(), column);<NEW_LINE>if (value != null || configuration.isReturnInstanceForEmptyRow()) {<NEW_LINE>cacheKey.update(column);<NEW_LINE>cacheKey.update(value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > th = resultMapping.getTypeHandler(); |
325,549 | private AssociationHandler<Neo4jPersistentProperty> populateFrom(MapAccessor queryResult, NodeDescription<?> baseDescription, PersistentPropertyAccessor<?> propertyAccessor, Predicate<Neo4jPersistentProperty> isConstructorParameter, boolean objectAlreadyMapped, Collection<Relationship> relationshipsFromResult, Collection<Node> nodesFromResult) {<NEW_LINE>return association -> {<NEW_LINE>Neo4jPersistentProperty persistentProperty = association.getInverse();<NEW_LINE>if (isConstructorParameter.test(persistentProperty)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (objectAlreadyMapped) {<NEW_LINE>// avoid multiple instances of the "same" object<NEW_LINE>boolean willCreateNewInstance = persistentProperty.getWither() != null;<NEW_LINE>if (willCreateNewInstance) {<NEW_LINE>throw new MappingException("Cannot create a new instance of an already existing object.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object propertyValue = propertyAccessor.getProperty(persistentProperty);<NEW_LINE>boolean propertyValueNotNull = propertyValue != null;<NEW_LINE>boolean populatedCollection = persistentProperty.isCollectionLike() && propertyValueNotNull && !((Collection<?>) propertyValue).isEmpty();<NEW_LINE>boolean populatedMap = persistentProperty.isMap() && propertyValueNotNull && !((Map<?, ?<MASK><NEW_LINE>boolean populatedScalarValue = !persistentProperty.isCollectionLike() && !persistentProperty.isMap() && propertyValueNotNull;<NEW_LINE>boolean propertyAlreadyPopulated = populatedCollection || populatedMap || populatedScalarValue;<NEW_LINE>// avoid unnecessary re-assignment of values<NEW_LINE>if (propertyAlreadyPopulated) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>createInstanceOfRelationships(persistentProperty, queryResult, (RelationshipDescription) association, baseDescription, relationshipsFromResult, nodesFromResult).ifPresent(value -> propertyAccessor.setProperty(persistentProperty, value));<NEW_LINE>};<NEW_LINE>} | >) propertyValue).isEmpty(); |
1,408,810 | private void imageCell(Image image) throws SAXException {<NEW_LINE>this.emitter.startElementWithClass("td", "img");<NEW_LINE>String src = image.getSrc();<NEW_LINE>if (src == null) {<NEW_LINE>this.emitter.startElement("i");<NEW_LINE>this.emitter.characters(NOT_RESOLVABLE);<NEW_LINE>this.emitter.endElement("i");<NEW_LINE>} else {<NEW_LINE>int width = image.getWidth();<NEW_LINE>int height = image.getHeight();<NEW_LINE>if (width < 1 || height < 1) {<NEW_LINE>width = height = -1;<NEW_LINE>} else if (width > height) {<NEW_LINE>if (width > IMAGE_CLAMP) {<NEW_LINE>height = (int) Math.ceil(height * (((double) IMAGE_CLAMP) / <MASK><NEW_LINE>width = IMAGE_CLAMP;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (height > IMAGE_CLAMP) {<NEW_LINE>width = (int) Math.ceil(width * (((double) IMAGE_CLAMP) / ((double) height)));<NEW_LINE>height = IMAGE_CLAMP;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>attrs.clear();<NEW_LINE>attrs.addAttribute("src", src);<NEW_LINE>if (width != -1) {<NEW_LINE>attrs.addAttribute("width", Integer.toString(width));<NEW_LINE>attrs.addAttribute("height", Integer.toString(height));<NEW_LINE>}<NEW_LINE>this.emitter.startElement("img", attrs);<NEW_LINE>this.emitter.endElement("img");<NEW_LINE>}<NEW_LINE>this.emitter.endElement("td");<NEW_LINE>} | ((double) width))); |
1,514,860 | public String dot() {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append("digraph CART {\n node [shape=box, style=\"filled, rounded\", color=\"black\", fontname=helvetica];\n edge [fontname=helvetica];\n");<NEW_LINE>String trueLabel = " [labeldistance=2.5, labelangle=45, headlabel=\"True\"];\n";<NEW_LINE>String falseLabel = " [labeldistance=2.5, labelangle=-45, headlabel=\"False\"];\n";<NEW_LINE>Queue<SimpleEntry<Integer, Node>> queue = new LinkedList<>();<NEW_LINE>queue.add(new SimpleEntry<>(1, root));<NEW_LINE>while (!queue.isEmpty()) {<NEW_LINE>// Dequeue a vertex from queue and print it<NEW_LINE>SimpleEntry<Integer, Node> entry = queue.poll();<NEW_LINE>int id = entry.getKey();<NEW_LINE>Node node = entry.getValue();<NEW_LINE>// leaf node<NEW_LINE>builder.append(node.dot(schema, response, id));<NEW_LINE>if (node instanceof InternalNode) {<NEW_LINE>int tid = 2 * id;<NEW_LINE>int fid = 2 * id + 1;<NEW_LINE>InternalNode inode = (InternalNode) node;<NEW_LINE>queue.add(new SimpleEntry<>(tid, inode.trueChild));<NEW_LINE>queue.add(new SimpleEntry<>(fid, inode.falseChild));<NEW_LINE>// add edge<NEW_LINE>builder.append(' ').append(id).append(" -> ").append<MASK><NEW_LINE>builder.append(' ').append(id).append(" -> ").append(fid).append(falseLabel);<NEW_LINE>// only draw edge label at top<NEW_LINE>if (id == 1) {<NEW_LINE>trueLabel = "\n";<NEW_LINE>falseLabel = "\n";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.append("}");<NEW_LINE>return builder.toString();<NEW_LINE>} | (tid).append(trueLabel); |
806,113 | public void addPath(String path) {<NEW_LINE>// Null path references the root directory.<NEW_LINE>if (path == null) {<NEW_LINE>path = "";<NEW_LINE>}<NEW_LINE>// Remove path separator(s) from the front of the path. It must be relative down below.<NEW_LINE>int startIndex = 0;<NEW_LINE>while ((startIndex < path.length()) && (path.charAt(startIndex) == '/')) {<NEW_LINE>startIndex++;<NEW_LINE>}<NEW_LINE>if (startIndex > 0) {<NEW_LINE>if (startIndex < path.length()) {<NEW_LINE>path = path.substring(startIndex);<NEW_LINE>} else {<NEW_LINE>path = "";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// An empty path represents the root directory.<NEW_LINE>// If given one, then add it to the collection and stop here.<NEW_LINE>if (path.isEmpty()) {<NEW_LINE>TreeSet<String> fileListing = this.get(path);<NEW_LINE>if (fileListing == null) {<NEW_LINE>this.put(path, new TreeSet<>());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Parse the given path's subdirectories and trailing file name and add them to the collection.<NEW_LINE>for (int nameIndex = 0; nameIndex < path.length(); ) {<NEW_LINE>// Fetch the next component from the path.<NEW_LINE>int separatorIndex = path.indexOf('/', nameIndex);<NEW_LINE>// There are 2 path separators next to each other. Skip it.<NEW_LINE>if (separatorIndex == nameIndex) {<NEW_LINE>nameIndex++;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Fetch the parent directory path for the next component.<NEW_LINE>String parentDirectoryPath = "";<NEW_LINE>if (nameIndex > 0) {<NEW_LINE>parentDirectoryPath = path.substring(0, nameIndex);<NEW_LINE>}<NEW_LINE>// Fetch the next component name.<NEW_LINE>String name;<NEW_LINE>if (separatorIndex > nameIndex) {<NEW_LINE>// This is a subdirectory name.<NEW_LINE>name = <MASK><NEW_LINE>nameIndex = separatorIndex + 1;<NEW_LINE>} else {<NEW_LINE>// This is a file name since a path separator was not found.<NEW_LINE>name = path.substring(nameIndex);<NEW_LINE>nameIndex = path.length();<NEW_LINE>}<NEW_LINE>// Fetch the parent directory's file listing. Create one if it doesn't exist.<NEW_LINE>TreeSet<String> fileListing = this.get(parentDirectoryPath);<NEW_LINE>if (fileListing == null) {<NEW_LINE>fileListing = new TreeSet<>();<NEW_LINE>this.put(parentDirectoryPath, fileListing);<NEW_LINE>}<NEW_LINE>// Add the file/subfolder name to the listing.<NEW_LINE>fileListing.add(name);<NEW_LINE>}<NEW_LINE>} | path.substring(nameIndex, separatorIndex); |
317,892 | public static DescribeDataCountsResponse unmarshall(DescribeDataCountsResponse describeDataCountsResponse, UnmarshallerContext context) {<NEW_LINE>describeDataCountsResponse.setRequestId(context.stringValue("DescribeDataCountsResponse.RequestId"));<NEW_LINE>List<DataCount> dataCountList = new ArrayList<DataCount>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeDataCountsResponse.DataCountList.Length"); i++) {<NEW_LINE>DataCount dataCount = new DataCount();<NEW_LINE>dataCount.setProductId(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].ProductId"));<NEW_LINE>dataCount.setProductCode(context.stringValue("DescribeDataCountsResponse.DataCountList[" + i + "].ProductCode"));<NEW_LINE>Instance instance = new Instance();<NEW_LINE>instance.setTotalCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Instance.TotalCount"));<NEW_LINE>instance.setCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Instance.Count"));<NEW_LINE>instance.setSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Instance.SensitiveCount"));<NEW_LINE>instance.setLastCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Instance.LastCount"));<NEW_LINE>instance.setLastSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Instance.LastSensitiveCount"));<NEW_LINE>dataCount.setInstance(instance);<NEW_LINE>Table table = new Table();<NEW_LINE>table.setTotalCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Table.TotalCount"));<NEW_LINE>table.setCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Table.Count"));<NEW_LINE>table.setSensitiveCount(context.longValue<MASK><NEW_LINE>table.setLastCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Table.LastCount"));<NEW_LINE>table.setLastSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Table.LastSensitiveCount"));<NEW_LINE>dataCount.setTable(table);<NEW_LINE>_Package _package = new _Package();<NEW_LINE>_package.setTotalCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Package.TotalCount"));<NEW_LINE>_package.setCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Package.Count"));<NEW_LINE>_package.setSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Package.SensitiveCount"));<NEW_LINE>_package.setLastCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Package.LastCount"));<NEW_LINE>_package.setLastSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Package.LastSensitiveCount"));<NEW_LINE>dataCount.set_Package(_package);<NEW_LINE>Column column = new Column();<NEW_LINE>column.setTotalCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Column.TotalCount"));<NEW_LINE>column.setCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Column.Count"));<NEW_LINE>column.setSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Column.SensitiveCount"));<NEW_LINE>column.setLastCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Column.LastCount"));<NEW_LINE>column.setLastSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Column.LastSensitiveCount"));<NEW_LINE>dataCount.setColumn(column);<NEW_LINE>Oss oss = new Oss();<NEW_LINE>oss.setTotalCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Oss.TotalCount"));<NEW_LINE>oss.setCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Oss.Count"));<NEW_LINE>oss.setSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Oss.SensitiveCount"));<NEW_LINE>oss.setLastCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Oss.LastCount"));<NEW_LINE>oss.setLastSensitiveCount(context.longValue("DescribeDataCountsResponse.DataCountList[" + i + "].Oss.LastSensitiveCount"));<NEW_LINE>dataCount.setOss(oss);<NEW_LINE>dataCountList.add(dataCount);<NEW_LINE>}<NEW_LINE>describeDataCountsResponse.setDataCountList(dataCountList);<NEW_LINE>return describeDataCountsResponse;<NEW_LINE>} | ("DescribeDataCountsResponse.DataCountList[" + i + "].Table.SensitiveCount")); |
1,596,407 | protected Query createQuery(EntityManager em, LoadContext<?> context, boolean singleResult, boolean countQuery) {<NEW_LINE>LoadContext.Query contextQuery = context.getQuery();<NEW_LINE>JpqlQueryBuilder queryBuilder = AppBeans.get(JpqlQueryBuilder.NAME);<NEW_LINE>queryBuilder.setId(context.getId()).setIds(context.getIds()).setEntityName(context.getMetaClass()).setSingleResult(singleResult);<NEW_LINE>if (contextQuery != null) {<NEW_LINE>queryBuilder.setQueryString(contextQuery.getQueryString()).setCondition(contextQuery.getCondition()).setQueryParameters(contextQuery.getParameters()).setNoConversionParams(contextQuery.getNoConversionParams());<NEW_LINE>if (!countQuery) {<NEW_LINE>queryBuilder.setSort(contextQuery.getSort());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!context.getPrevQueries().isEmpty()) {<NEW_LINE>log.debug("Restrict query by previous results");<NEW_LINE>queryBuilder.setPreviousResults(userSessionSource.getUserSession().getId(), context.getQueryKey());<NEW_LINE>}<NEW_LINE>Query <MASK><NEW_LINE>if (contextQuery != null) {<NEW_LINE>if (contextQuery.getFirstResult() != 0)<NEW_LINE>query.setFirstResult(contextQuery.getFirstResult());<NEW_LINE>if (contextQuery.getMaxResults() != 0)<NEW_LINE>query.setMaxResults(contextQuery.getMaxResults());<NEW_LINE>if (contextQuery.isCacheable()) {<NEW_LINE>query.setCacheable(contextQuery.isCacheable());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (context.getHints() != null) {<NEW_LINE>for (Map.Entry<String, Object> hint : context.getHints().entrySet()) {<NEW_LINE>query.setHint(hint.getKey(), hint.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return query;<NEW_LINE>} | query = queryBuilder.getQuery(em); |
773,065 | public void onActivityCreated(Bundle savedInstanceState) {<NEW_LINE>super.onActivityCreated(savedInstanceState);<NEW_LINE>loadButton = getView().findViewById(R.id.adsizes_btn_loadad);<NEW_LINE>cb120x20 = getView().findViewById(R.id.adsizes_cb_120x20);<NEW_LINE>cb320x50 = getView().findViewById(R.id.adsizes_cb_320x50);<NEW_LINE>cb300x250 = getView().findViewById(R.id.adsizes_cb_300x250);<NEW_LINE>adView = getView().findViewById(R.id.adsizes_pav_main);<NEW_LINE>adView.setAdListener(new AdListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAdLoaded() {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>loadButton.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View view) {<NEW_LINE>if (!cb120x20.isChecked() && !cb320x50.isChecked() && !cb300x250.isChecked()) {<NEW_LINE>Toast.makeText(AdManagerMultipleAdSizesFragment.this.getActivity(), "At least one size is required.", Toast.LENGTH_SHORT).show();<NEW_LINE>} else {<NEW_LINE>List<AdSize> sizeList = new ArrayList<>();<NEW_LINE>if (cb120x20.isChecked()) {<NEW_LINE>sizeList.add(new AdSize(120, 20));<NEW_LINE>}<NEW_LINE>if (cb320x50.isChecked()) {<NEW_LINE>sizeList.add(AdSize.BANNER);<NEW_LINE>}<NEW_LINE>if (cb300x250.isChecked()) {<NEW_LINE>sizeList.add(AdSize.MEDIUM_RECTANGLE);<NEW_LINE>}<NEW_LINE>adView.setVisibility(View.INVISIBLE);<NEW_LINE>adView.setAdSizes(sizeList.toArray(new AdSize[sizeList.size()]));<NEW_LINE>adView.loadAd(new AdManagerAdRequest.Builder().build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | adView.setVisibility(View.VISIBLE); |
973,210 | private void loadCustomizedActions(GradleExecConfiguration c) {<NEW_LINE>String id;<NEW_LINE>if (c != null) {<NEW_LINE>id = c.getId();<NEW_LINE>} else {<NEW_LINE>id = GradleExecConfiguration.DEFAULT;<NEW_LINE>}<NEW_LINE>ActionsHolder h = configHolders.get(id);<NEW_LINE>if (h != null) {<NEW_LINE>customActions = h.customActions;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>ConfigurableActionProvider configP = project.getLookup().lookup(ConfigurableActionProvider.class);<NEW_LINE>ProjectActionMappingProvider actionP = null;<NEW_LINE>if (configP != null) {<NEW_LINE>actionP = configP.findActionProvider(id);<NEW_LINE>}<NEW_LINE>if (actionP == null) {<NEW_LINE>actionP = project.getLookup().lookup(ProjectActionMappingProvider.class);<NEW_LINE>}<NEW_LINE>if (actionP != null) {<NEW_LINE>ProjectActionMappingProvider fa = actionP;<NEW_LINE>Set<String> customizedActions = actionP.customizedActions();<NEW_LINE>customizedActions.forEach((action) -> {<NEW_LINE>ActionMapping ca = fa.findMapping(action);<NEW_LINE>if (ca == null) {<NEW_LINE>ca = DefaultActionMapping.DISABLED;<NEW_LINE>}<NEW_LINE>CustomActionMapping mapping = new CustomActionMapping(ca, action);<NEW_LINE>nh.customActions.put(action, mapping);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>configHolders.put(id, nh);<NEW_LINE>customActions = nh.customActions;<NEW_LINE>} | ActionsHolder nh = new ActionsHolder(c); |
972,218 | final ListDevicesResult executeListDevices(ListDevicesRequest listDevicesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listDevicesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListDevicesRequest> request = null;<NEW_LINE>Response<ListDevicesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListDevicesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDevicesRequest));<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, "Snow Device Management");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDevices");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListDevicesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDevicesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,535,417 | public static void main(String[] argv) {<NEW_LINE>LOG.info("Starting Parameter Server");<NEW_LINE>int serverIndex = Integer.valueOf(System.getenv(AngelEnvironment.PARAMETERSERVER_ID.name()));<NEW_LINE>String appMasterHost = System.getenv(AngelEnvironment.LISTEN_ADDR.name());<NEW_LINE>int appMasterPort = Integer.valueOf(System.getenv(AngelEnvironment.LISTEN_PORT.name()));<NEW_LINE>int attemptIndex = Integer.valueOf(System.getenv(AngelEnvironment.PS_ATTEMPT_ID.name()));<NEW_LINE>Configuration conf = new Configuration();<NEW_LINE>conf.addResource(AngelConf.ANGEL_JOB_CONF_FILE);<NEW_LINE>conf.setInt("io.file.buffer.size", conf.getInt(AngelConf.ANGEL_PS_IO_FILE_BUFFER_SIZE, AngelConf.DEFAULT_ANGEL_PS_IO_FILE_BUFFER_SIZE));<NEW_LINE>String user = System.getenv(ApplicationConstants.Environment.USER.name());<NEW_LINE>UserGroupInformation.setConfiguration(conf);<NEW_LINE>String runningMode = conf.get(AngelConf.ANGEL_RUNNING_MODE, AngelConf.DEFAULT_ANGEL_RUNNING_MODE);<NEW_LINE>if (runningMode.equals(RunningMode.ANGEL_PS_WORKER.toString())) {<NEW_LINE>LOG.debug("AngelEnvironment.TASK_NUMBER.name()=" + AngelEnvironment.TASK_NUMBER.name());<NEW_LINE>conf.set(AngelConf.ANGEL_TASK_ACTUAL_NUM, System.getenv(AngelEnvironment.TASK_NUMBER.name()));<NEW_LINE>}<NEW_LINE>final ParameterServer psServer = new ParameterServer(serverIndex, attemptIndex, appMasterHost, appMasterPort, conf);<NEW_LINE>try {<NEW_LINE>Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials();<NEW_LINE>UserGroupInformation psUGI = UserGroupInformation.createRemoteUser(System.getenv(ApplicationConstants.Environment.USER.toString()));<NEW_LINE>// Add tokens to new user so that it may execute its task correctly.<NEW_LINE>psUGI.addCredentials(credentials);<NEW_LINE>psUGI.doAs(new PrivilegedExceptionAction<Object>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Object run() throws Exception {<NEW_LINE>psServer.initialize();<NEW_LINE>psServer.start();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Throwable x) {<NEW_LINE><MASK><NEW_LINE>psServer.failed(x.getMessage());<NEW_LINE>}<NEW_LINE>LOG.info("Starting Parameter Server successfully.");<NEW_LINE>} | LOG.fatal("Start PS failed ", x); |
484,427 | private static void apply(CompIntLongVector v1, CompIntLongVector v2, Binary op, CompIntLongVector result, int start, int end) {<NEW_LINE>if (v1.isCompatable(v2)) {<NEW_LINE>IntLongVector[] v1Parts = v1.getPartitions();<NEW_LINE>IntLongVector[] v2Parts = v2.getPartitions();<NEW_LINE>if (op.isInplace()) {<NEW_LINE>for (int i = start; i <= end; i++) {<NEW_LINE>BinaryExecutor.apply(v1Parts[i]<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>IntLongVector[] resParts = result.getPartitions();<NEW_LINE>for (int i = start; i <= end; i++) {<NEW_LINE>resParts[i] = (IntLongVector) BinaryExecutor.apply(v1Parts[i], v2Parts[i], op);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new AngelException("Operation is not support!");<NEW_LINE>}<NEW_LINE>} | , v2Parts[i], op); |
101,564 | public void marshall(Vp9Settings vp9Settings, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (vp9Settings == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getBitrate(), BITRATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getFramerateControl(), FRAMERATECONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(vp9Settings.getFramerateDenominator(), FRAMERATEDENOMINATOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getFramerateNumerator(), FRAMERATENUMERATOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getGopSize(), GOPSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getHrdBufferSize(), HRDBUFFERSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getMaxBitrate(), MAXBITRATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getParControl(), PARCONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getParDenominator(), PARDENOMINATOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getParNumerator(), PARNUMERATOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getQualityTuningLevel(), QUALITYTUNINGLEVEL_BINDING);<NEW_LINE>protocolMarshaller.marshall(vp9Settings.getRateControlMode(), RATECONTROLMODE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | vp9Settings.getFramerateConversionAlgorithm(), FRAMERATECONVERSIONALGORITHM_BINDING); |
1,742,270 | public void artifactsUpdated(Iterable<File> artifacts) {<NEW_LINE><MASK><NEW_LINE>if (realProvider == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>J2eeModuleProvider.DeployOnSaveClassInterceptor interceptor = realProvider.getDeployOnSaveClassInterceptor();<NEW_LINE>Set<Artifact> realArtifacts = new HashSet<Artifact>();<NEW_LINE>for (File file : artifacts) {<NEW_LINE>if (file != null) {<NEW_LINE>Artifact a = Artifact.forFile(file);<NEW_LINE>if (interceptor != null) {<NEW_LINE>a = interceptor.convert(a);<NEW_LINE>}<NEW_LINE>realArtifacts.add(a);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (LOGGER.isLoggable(Level.FINE)) {<NEW_LINE>for (Artifact artifact : realArtifacts) {<NEW_LINE>LOGGER.log(Level.FINE, "Delivered compile artifact: {0}", artifact);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DeployOnSaveManager.getDefault().submitChangedArtifacts(realProvider, realArtifacts);<NEW_LINE>} | J2eeModuleProvider realProvider = provider.get(); |
291,007 | protected Object[] createItemArray(XYDataset dataset, int series, int item) {<NEW_LINE>Object[] result = new Object[8];<NEW_LINE>result[0] = dataset.getSeriesKey(series).toString();<NEW_LINE>Number x = dataset.getX(series, item);<NEW_LINE>if (getXDateFormat() != null) {<NEW_LINE>result[1] = getXDateFormat().format(new Date<MASK><NEW_LINE>} else {<NEW_LINE>result[1] = getXFormat().format(x);<NEW_LINE>}<NEW_LINE>NumberFormat formatter = getYFormat();<NEW_LINE>if (dataset instanceof BoxAndWhiskerXYDataset) {<NEW_LINE>BoxAndWhiskerXYDataset d = (BoxAndWhiskerXYDataset) dataset;<NEW_LINE>result[2] = formatter.format(d.getMeanValue(series, item));<NEW_LINE>result[3] = formatter.format(d.getMedianValue(series, item));<NEW_LINE>result[4] = formatter.format(d.getMinRegularValue(series, item));<NEW_LINE>result[5] = formatter.format(d.getMaxRegularValue(series, item));<NEW_LINE>result[6] = formatter.format(d.getQ1Value(series, item));<NEW_LINE>result[7] = formatter.format(d.getQ3Value(series, item));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (x.longValue())); |
1,538,522 | private void onMouseUp(Event e) {<NEW_LINE>double y = e.y - size.tree.y + commonVBar.getSelection();<NEW_LINE>if (y >= size.headerHeight) {<NEW_LINE>int rowIdx = size.<MASK><NEW_LINE>if (rowIdx < tree.getNumRows()) {<NEW_LINE>if (e.count == 2) {<NEW_LINE>if (tree.toggle(rowIdx, this::initRows)) {<NEW_LINE>updateSize(false, rowIdx + 1);<NEW_LINE>updateHover(e.x, e.y);<NEW_LINE>redraw(Area.FULL);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>selectRow(rowIdx);<NEW_LINE>if (size.tree.contains(e.x, e.y)) {<NEW_LINE>TreeState.Row row = tree.getRow(rowIdx);<NEW_LINE>double x = e.x - size.tree.x + treeHBar.getSelection();<NEW_LINE>double cx = x - row.getCarretX();<NEW_LINE>if (cx >= -IMAGE_PADDING / 2 && cx < CARRET_X_SIZE + IMAGE_PADDING / 2 && row.node.getChildCount() > 0) {<NEW_LINE>if (tree.toggle(rowIdx, this::initRows)) {<NEW_LINE>updateHover(e.x, e.y);<NEW_LINE>updateSize(false, rowIdx + 1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Path.Any follow = getFollow(x);<NEW_LINE>if (follow != null) {<NEW_LINE>models.follower.onFollow(follow);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>redraw(Area.FULL);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getRow(y - size.headerHeight); |
502,316 | private void doPrintEntries(PrintStream out) throws Exception {<NEW_LINE>// Adjust displayed keystore type if needed.<NEW_LINE>String keystoreTypeToPrint = keyStore.getType();<NEW_LINE>if ("JKS".equalsIgnoreCase(keystoreTypeToPrint)) {<NEW_LINE>if (ksfile != null && ksfile.exists()) {<NEW_LINE>String realType = keyStoreType(ksfile);<NEW_LINE>// If the magic number does not conform to JKS<NEW_LINE>// then it must be PKCS12<NEW_LINE>if (!"JKS".equalsIgnoreCase(realType)) {<NEW_LINE>keystoreTypeToPrint = P12KEYSTORE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.println(rb<MASK><NEW_LINE>out.println(rb.getString("Keystore.provider.") + keyStore.getProvider().getName());<NEW_LINE>out.println();<NEW_LINE>MessageFormat form;<NEW_LINE>form = (keyStore.size() == 1) ? new MessageFormat(rb.getString("Your.keystore.contains.keyStore.size.entry")) : new MessageFormat(rb.getString("Your.keystore.contains.keyStore.size.entries"));<NEW_LINE>Object[] source = { new Integer(keyStore.size()) };<NEW_LINE>out.println(form.format(source));<NEW_LINE>out.println();<NEW_LINE>List<String> aliases = Collections.list(keyStore.aliases());<NEW_LINE>aliases.sort(String::compareTo);<NEW_LINE>for (String alias : aliases) {<NEW_LINE>doPrintEntry("<" + alias + ">", alias, out);<NEW_LINE>if (verbose || rfc) {<NEW_LINE>out.println(rb.getString("NEWLINE"));<NEW_LINE>out.println(rb.getString("STAR"));<NEW_LINE>out.println(rb.getString("STARNN"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getString("Keystore.type.") + keystoreTypeToPrint); |
415,086 | public void paint(Graphics g, int x, int y) {<NEW_LINE>if (selected) {<NEW_LINE>g.setColor(highlightColor);<NEW_LINE>} else {<NEW_LINE>g.setColor(bgColor);<NEW_LINE>}<NEW_LINE>g.fillRect(x, y, width - 1, height);<NEW_LINE>if (valueString != null) {<NEW_LINE>switch(type) {<NEW_LINE>case Cell.VALUE:<NEW_LINE>case Cell.LABEL:<NEW_LINE>g.setColor(fgColor);<NEW_LINE>break;<NEW_LINE>case Cell.FORMULA:<NEW_LINE>g.setColor(Color.red);<NEW_LINE>break;<NEW_LINE>case Cell.URL:<NEW_LINE>g.setColor(Color.blue);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (transientValue) {<NEW_LINE>g.drawString("" + value, x, y + <MASK><NEW_LINE>} else {<NEW_LINE>if (valueString.length() > 14) {<NEW_LINE>g.drawString(valueString.substring(0, 14), x, y + (height / 2) + 5);<NEW_LINE>} else {<NEW_LINE>g.drawString(valueString, x, y + (height / 2) + 5);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>needRedisplay = false;<NEW_LINE>} | (height / 2) + 5); |
386,013 | protected void drawFilter() {<NEW_LINE>GLES20.glUseProgram(program);<NEW_LINE>squareVertex.position(SQUARE_VERTEX_DATA_POS_OFFSET);<NEW_LINE>GLES20.glVertexAttribPointer(aPositionHandle, 3, GLES20.GL_FLOAT, false, SQUARE_VERTEX_DATA_STRIDE_BYTES, squareVertex);<NEW_LINE>GLES20.glEnableVertexAttribArray(aPositionHandle);<NEW_LINE>squareVertex.position(SQUARE_VERTEX_DATA_UV_OFFSET);<NEW_LINE>GLES20.glVertexAttribPointer(aTextureHandle, 2, GLES20.GL_FLOAT, false, SQUARE_VERTEX_DATA_STRIDE_BYTES, squareVertex);<NEW_LINE>GLES20.glEnableVertexAttribArray(aTextureHandle);<NEW_LINE>GLES20.glUniformMatrix4fv(uMVPMatrixHandle, 1, false, MVPMatrix, 0);<NEW_LINE>GLES20.glUniformMatrix4fv(uSTMatrixHandle, 1, false, STMatrix, 0);<NEW_LINE>float time = ((float) (System.currentTimeMillis() - START_TIME)) / 1000.0f;<NEW_LINE>GLES20.glUniform1f(uTimeHandle, time);<NEW_LINE>GLES20.glUniform1i(uSamplerHandle, 4);<NEW_LINE><MASK><NEW_LINE>GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, previousTexId);<NEW_LINE>} | GLES20.glActiveTexture(GLES20.GL_TEXTURE4); |
313,512 | public SecretsManagerSecretResourceData unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SecretsManagerSecretResourceData secretsManagerSecretResourceData = new SecretsManagerSecretResourceData();<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("ARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>secretsManagerSecretResourceData.setARN(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("AdditionalStagingLabelsToDownload", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>secretsManagerSecretResourceData.setAdditionalStagingLabelsToDownload(new ListUnmarshaller<String>(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 secretsManagerSecretResourceData;<NEW_LINE>} | class).unmarshall(context)); |
1,652,357 | private NameEnvironmentAnswer findClassInternal(char[] typeName, String qualifiedPackageName, String qualifiedBinaryFileName, boolean asBinaryOnly) {<NEW_LINE>// most common case TODO(SHMOD): use module name from this.module?<NEW_LINE>if (!isPackage(qualifiedPackageName, null))<NEW_LINE>return null;<NEW_LINE>String fileName = new String(typeName);<NEW_LINE>boolean binaryExists = ((this.mode & BINARY) != 0) && <MASK><NEW_LINE>boolean sourceExists = ((this.mode & SOURCE) != 0) && doesFileExist(fileName + SUFFIX_STRING_java, qualifiedPackageName);<NEW_LINE>if (sourceExists && !asBinaryOnly) {<NEW_LINE>String fullSourcePath = this.path + qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - 6) + SUFFIX_STRING_java;<NEW_LINE>CompilationUnit unit = new CompilationUnit(null, fullSourcePath, this.encoding, this.destinationPath);<NEW_LINE>unit.module = this.module == null ? null : this.module.name();<NEW_LINE>if (!binaryExists)<NEW_LINE>return new NameEnvironmentAnswer(unit, fetchAccessRestriction(qualifiedBinaryFileName));<NEW_LINE>String fullBinaryPath = this.path + qualifiedBinaryFileName;<NEW_LINE>long binaryModified = new File(fullBinaryPath).lastModified();<NEW_LINE>long sourceModified = new File(fullSourcePath).lastModified();<NEW_LINE>if (sourceModified > binaryModified)<NEW_LINE>return new NameEnvironmentAnswer(unit, fetchAccessRestriction(qualifiedBinaryFileName));<NEW_LINE>}<NEW_LINE>if (binaryExists) {<NEW_LINE>try {<NEW_LINE>ClassFileReader reader = ClassFileReader.read(this.path + qualifiedBinaryFileName);<NEW_LINE>// https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115, package names are to be treated case sensitive.<NEW_LINE>String typeSearched = // $NON-NLS-1$<NEW_LINE>qualifiedPackageName.length() > 0 ? qualifiedPackageName.replace(File.separatorChar, '/') + "/" + fileName : fileName;<NEW_LINE>if (!CharOperation.equals(reader.getName(), typeSearched.toCharArray())) {<NEW_LINE>reader = null;<NEW_LINE>}<NEW_LINE>if (reader != null) {<NEW_LINE>char[] modName = reader.moduleName != null ? reader.moduleName : this.module != null ? this.module.name() : null;<NEW_LINE>return new NameEnvironmentAnswer(reader, fetchAccessRestriction(qualifiedBinaryFileName), modName);<NEW_LINE>}<NEW_LINE>} catch (IOException | ClassFormatException e) {<NEW_LINE>// treat as if file is missing<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | doesFileExist(fileName + SUFFIX_STRING_class, qualifiedPackageName); |
376,408 | public static BuildOptions createBuildOptions(PackageConfig packageConfig, BuildOptions theirOptions, Path projectDirPath) {<NEW_LINE>// Todo figure out how to pass the build options without a performance hit<NEW_LINE>TomlDocument ballerinaToml = TomlDocument.from(ProjectConstants.BALLERINA_TOML, packageConfig.ballerinaToml().map(t -> t.content()).orElse(""));<NEW_LINE>TomlDocument pluginToml = TomlDocument.from(ProjectConstants.COMPILER_PLUGIN_TOML, packageConfig.dependenciesToml().map(t -> t.content(<MASK><NEW_LINE>ManifestBuilder manifestBuilder = ManifestBuilder.from(ballerinaToml, pluginToml, projectDirPath);<NEW_LINE>BuildOptions defaultBuildOptions = manifestBuilder.buildOptions();<NEW_LINE>if (defaultBuildOptions == null) {<NEW_LINE>defaultBuildOptions = BuildOptions.builder().build();<NEW_LINE>}<NEW_LINE>return defaultBuildOptions.acceptTheirs(theirOptions);<NEW_LINE>} | )).orElse("")); |
567,634 | private static NodeState computeEffectiveNodeState(final NodeInfo nodeInfo, final Params params, Map<Node, NodeStateReason> nodeStateReasons) {<NEW_LINE>final NodeState reported = nodeInfo.getReportedState();<NEW_LINE>final NodeState wanted = nodeInfo.getWantedState();<NEW_LINE>final NodeState baseline = reported.clone();<NEW_LINE>if (nodeIsConsideredTooUnstable(nodeInfo, params)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (startupTimestampAlreadyObservedByAllNodes(nodeInfo, baseline)) {<NEW_LINE>baseline.setStartTimestamp(0);<NEW_LINE>}<NEW_LINE>if (nodeInfo.isStorage()) {<NEW_LINE>applyStorageSpecificStateTransforms(nodeInfo, params, reported, wanted, baseline, nodeStateReasons);<NEW_LINE>}<NEW_LINE>if (baseline.above(wanted)) {<NEW_LINE>applyWantedStateToBaselineState(baseline, wanted);<NEW_LINE>}<NEW_LINE>return baseline;<NEW_LINE>} | baseline.setState(State.DOWN); |
1,331,070 | private List<AvailableContribution> parseContribList(File file) {<NEW_LINE>List<AvailableContribution> outgoing = new ArrayList<>();<NEW_LINE>if (file != null && file.exists()) {<NEW_LINE>String[] lines = PApplet.loadStrings(file);<NEW_LINE>int start = 0;<NEW_LINE>while (start < lines.length) {<NEW_LINE>String type = lines[start];<NEW_LINE>ContributionType <MASK><NEW_LINE>if (contribType == null) {<NEW_LINE>System.err.println("Error in contribution listing file on line " + (start + 1));<NEW_LINE>// Scan forward for the next blank line<NEW_LINE>int end = ++start;<NEW_LINE>while (end < lines.length && !lines[end].trim().isEmpty()) {<NEW_LINE>end++;<NEW_LINE>}<NEW_LINE>start = end + 1;<NEW_LINE>} else {<NEW_LINE>// Scan forward for the next blank line<NEW_LINE>int end = ++start;<NEW_LINE>while (end < lines.length && !lines[end].trim().isEmpty()) {<NEW_LINE>end++;<NEW_LINE>}<NEW_LINE>String[] contribLines = PApplet.subset(lines, start, end - start);<NEW_LINE>StringDict contribParams = Util.readSettings(file.getName(), contribLines);<NEW_LINE>outgoing.add(new AvailableContribution(contribType, contribParams));<NEW_LINE>start = end + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return outgoing;<NEW_LINE>} | contribType = ContributionType.fromName(type); |
1,774,789 | private long installDownloadedSnapshot() {<NEW_LINE>if (!transitionState(DownloadState.DOWNLOADED, DownloadState.INSTALLING)) {<NEW_LINE>return RaftLog.INVALID_LOG_INDEX;<NEW_LINE>}<NEW_LINE>File tempFile = null;<NEW_LINE>try (Timer.Context ctx = MetricsSystem.timer(MetricKey.MASTER_EMBEDDED_JOURNAL_SNAPSHOT_INSTALL_TIMER.getName()).time()) {<NEW_LINE>SnapshotInfo snapshot = mDownloadedSnapshot;<NEW_LINE>if (snapshot == null) {<NEW_LINE>throw new IllegalStateException("Snapshot is not completed");<NEW_LINE>}<NEW_LINE>FileInfo fileInfo = snapshot.getFiles().get(0);<NEW_LINE>tempFile = fileInfo.getPath().toFile();<NEW_LINE>if (!tempFile.exists()) {<NEW_LINE>throw new FileNotFoundException(String.format("Snapshot file %s is not found", tempFile));<NEW_LINE>}<NEW_LINE>SnapshotInfo latestSnapshot = mStorage.getLatestSnapshot();<NEW_LINE>TermIndex lastInstalled = latestSnapshot == null ? null : latestSnapshot.getTermIndex();<NEW_LINE>TermIndex downloaded = snapshot.getTermIndex();<NEW_LINE>if (lastInstalled != null && downloaded.compareTo(lastInstalled) < 0) {<NEW_LINE>throw new AbortedException(String.format("Snapshot to be installed %s is older than current snapshot %s", downloaded, lastInstalled));<NEW_LINE>}<NEW_LINE>final File snapshotFile = mStorage.getSnapshotFile(downloaded.getTerm(), downloaded.getIndex());<NEW_LINE>LOG.debug("Moving temp snapshot {} to file {}", tempFile, snapshotFile);<NEW_LINE>MD5FileUtil.saveMD5File(snapshotFile, fileInfo.getFileDigest());<NEW_LINE>if (!tempFile.renameTo(snapshotFile)) {<NEW_LINE>throw new IOException(String.format("Failed to rename %s to %s", tempFile, snapshotFile));<NEW_LINE>}<NEW_LINE>mStorage.loadLatestSnapshot();<NEW_LINE>LOG.info("Completed storing snapshot at {} to file {}", downloaded, snapshotFile);<NEW_LINE>return downloaded.getIndex();<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>if (tempFile != null) {<NEW_LINE>tempFile.delete();<NEW_LINE>}<NEW_LINE>return RaftLog.INVALID_LOG_INDEX;<NEW_LINE>} finally {<NEW_LINE>transitionState(DownloadState.INSTALLING, DownloadState.IDLE);<NEW_LINE>}<NEW_LINE>} | LOG.error("Failed to install snapshot", e); |
1,562,291 | private void ajaxFetchScheduledFlowGraph(final String projectName, final String flowName, final HashMap<String, Object> ret, final User user) throws ServletException {<NEW_LINE>final Project project = getProjectAjaxByPermission(ret, projectName, user, Type.EXECUTE);<NEW_LINE>if (project == null) {<NEW_LINE>ret.put(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final Schedule schedule = this.scheduleManager.getSchedule(project.getId(), flowName);<NEW_LINE>final ExecutionOptions executionOptions = schedule != null ? schedule.getExecutionOptions() : new ExecutionOptions();<NEW_LINE>final Flow flow = project.getFlow(flowName);<NEW_LINE>if (flow == null) {<NEW_LINE>ret.put("error", "Flow '" + flowName + "' cannot be found in project " + project);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ExecutableFlow exFlow = new ExecutableFlow(project, flow);<NEW_LINE>exFlow.setExecutionOptions(executionOptions);<NEW_LINE>ret.put("submitTime", exFlow.getSubmitTime());<NEW_LINE>ret.put("submitUser", exFlow.getSubmitUser());<NEW_LINE>ret.put("execid", exFlow.getExecutionId());<NEW_LINE>ret.put("projectId", exFlow.getProjectId());<NEW_LINE>ret.put("project", project.getName());<NEW_LINE>FlowUtils.applyDisabledJobs(executionOptions.getDisabledJobs(), exFlow);<NEW_LINE>final Map<String, Object> flowObj = getExecutableNodeInfo(exFlow);<NEW_LINE>ret.putAll(flowObj);<NEW_LINE>} catch (final ScheduleManagerException ex) {<NEW_LINE>throw new ServletException(ex);<NEW_LINE>}<NEW_LINE>} | "error", "Project '" + projectName + "' doesn't exist."); |
336,133 | String read(ByteSource byteSource, Charset cs) throws IOException {<NEW_LINE>Optional<Long> size = byteSource.sizeIfKnown();<NEW_LINE>// if we know the size and it fits in an int<NEW_LINE>if (size.isPresent() && size.get().longValue() == size.get().intValue()) {<NEW_LINE>// otherwise try to presize a StringBuilder<NEW_LINE>// it is kind of lame that we need to construct a decoder to access this value.<NEW_LINE>// if this is a concern we could add special cases for some known charsets (like utf8)<NEW_LINE>// or we could avoid inputstreamreader and use the decoder api directly<NEW_LINE>// TODO(lukes): in a real implementation we would need to handle overflow conditions<NEW_LINE>int maxChars = (int) (size.get().intValue() * cs.newDecoder().maxCharsPerByte());<NEW_LINE>char[] buffer = new char[maxChars];<NEW_LINE>int bufIndex = 0;<NEW_LINE>int remaining = buffer.length;<NEW_LINE>try (InputStreamReader reader = new InputStreamReader(byteSource.openStream(), cs)) {<NEW_LINE>int nRead = 0;<NEW_LINE>while (remaining > 0 && (nRead = reader.read(buffer, bufIndex, remaining)) != -1) {<NEW_LINE>bufIndex += nRead;<NEW_LINE>remaining -= nRead;<NEW_LINE>}<NEW_LINE>if (nRead == -1) {<NEW_LINE>// we reached EOF<NEW_LINE>return new String(buffer, 0, bufIndex);<NEW_LINE>}<NEW_LINE>// otherwise we got the size wrong. This can happen if the size changes between when<NEW_LINE>// we called sizeIfKnown and when we started reading the file (or i guess if<NEW_LINE>// maxCharsPerByte is wrong)<NEW_LINE>// Fallback to an incremental approach<NEW_LINE>StringBuilder builder = new StringBuilder(bufIndex + 32);<NEW_LINE>builder.append(buffer, 0, bufIndex);<NEW_LINE>// release for gc<NEW_LINE>buffer = null;<NEW_LINE><MASK><NEW_LINE>return builder.toString();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return TO_BYTE_ARRAY_NEW_STRING.read(byteSource, cs);<NEW_LINE>}<NEW_LINE>} | CharStreams.copy(reader, builder); |
739,567 | public void decrypt(byte[] buffer) throws GeneralSecurityException {<NEW_LINE>byte[] CV = new byte[16];<NEW_LINE>byte[] C = new byte[16];<NEW_LINE>byte[] TEMP = new byte[16];<NEW_LINE>int count = buffer.length;<NEW_LINE>CV = <MASK><NEW_LINE>for (int index = 0; count > 0; ) {<NEW_LINE>if (count > 15) {<NEW_LINE>count -= 16;<NEW_LINE>System.arraycopy(buffer, index, TEMP, 0, 16);<NEW_LINE>System.arraycopy(buffer, index, C, 0, 16);<NEW_LINE>C = this.decipher.doFinal(C);<NEW_LINE>for (int i = 0; i < 16; ++i) {<NEW_LINE>C[i] ^= CV[i];<NEW_LINE>CV[i] = TEMP[i];<NEW_LINE>}<NEW_LINE>System.arraycopy(C, 0, buffer, index, 16);<NEW_LINE>index += 16;<NEW_LINE>} else {<NEW_LINE>System.arraycopy(buffer, index, C, 0, count);<NEW_LINE>CV = this.encipher.doFinal(CV);<NEW_LINE>for (int i = 0; i < 16; ++i) {<NEW_LINE>C[i] ^= CV[i];<NEW_LINE>}<NEW_LINE>System.arraycopy(C, 0, buffer, index, count);<NEW_LINE>count = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | this.encipher.doFinal(CV); |
1,563,760 | public void run(SourceContext<Row> ctx) throws Exception {<NEW_LINE>final StringBuilder buffer = new StringBuilder();<NEW_LINE>long attempt = 0;<NEW_LINE>while (isRunning) {<NEW_LINE>try (Socket socket = new Socket()) {<NEW_LINE>currentSocket = socket;<NEW_LINE>LOG.info("Connecting to server socket " + tableInfo.getHostname() + ':' + tableInfo.getPort());<NEW_LINE>socket.connect(new InetSocketAddress(tableInfo.getHostname(), tableInfo.getPort()), CONNECTION_TIMEOUT_TIME);<NEW_LINE>try (BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {<NEW_LINE>char[] cbuf = new char[8192];<NEW_LINE>int bytesRead;<NEW_LINE>while (isRunning && (bytesRead = reader.read(cbuf)) != -1) {<NEW_LINE>buffer.append(cbuf, 0, bytesRead);<NEW_LINE>int delimPos;<NEW_LINE>String delimiter = tableInfo.getDelimiter();<NEW_LINE>while (buffer.length() >= delimiter.length() && (delimPos = buffer.indexOf(delimiter)) != -1) {<NEW_LINE>String record = buffer.substring(0, delimPos);<NEW_LINE>// truncate trailing carriage return<NEW_LINE>if ("\n".equals(delimiter) && "\r".endsWith(record)) {<NEW_LINE>record = record.substring(0, record.length() - 1);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Row row = deserializationMetricWrapper.<MASK><NEW_LINE>ctx.collect(row);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("parseData error ", e);<NEW_LINE>} finally {<NEW_LINE>buffer.delete(0, delimPos + delimiter.length());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if we dropped out of this loop due to an EOF, sleep and retry<NEW_LINE>if (isRunning) {<NEW_LINE>attempt++;<NEW_LINE>if (tableInfo.getMaxNumRetries() == -1 || attempt < tableInfo.getMaxNumRetries()) {<NEW_LINE>Thread.sleep(DEFAULT_CONNECTION_RETRY_SLEEP);<NEW_LINE>} else {<NEW_LINE>// this should probably be here, but some examples expect simple exists of the stream source<NEW_LINE>// throw new EOFException("Reached end of stream and reconnects are not enabled.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// collect trailing data<NEW_LINE>if (buffer.length() > 0) {<NEW_LINE>try {<NEW_LINE>Row row = deserializationMetricWrapper.deserialize(buffer.toString().getBytes());<NEW_LINE>ctx.collect(row);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("parseData error ", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | deserialize(record.getBytes()); |
1,671,639 | final GetVocabularyFilterResult executeGetVocabularyFilter(GetVocabularyFilterRequest getVocabularyFilterRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getVocabularyFilterRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetVocabularyFilterRequest> request = null;<NEW_LINE>Response<GetVocabularyFilterResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetVocabularyFilterRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Transcribe");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetVocabularyFilter");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetVocabularyFilterResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetVocabularyFilterResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(getVocabularyFilterRequest)); |
1,566,289 | private void parseDialogueLine(String dialogueLine, SsaDialogueFormat format, List<List<Cue>> cues, List<Long> cueTimesUs) {<NEW_LINE>Assertions.checkArgument(dialogueLine.startsWith(DIALOGUE_LINE_PREFIX));<NEW_LINE>String[] lineValues = dialogueLine.substring(DIALOGUE_LINE_PREFIX.length()).split(",", format.length);<NEW_LINE>if (lineValues.length != format.length) {<NEW_LINE>Log.w(TAG, "Skipping dialogue line with fewer columns than format: " + dialogueLine);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long startTimeUs = parseTimecodeUs(lineValues[format.startTimeIndex]);<NEW_LINE>if (startTimeUs == C.TIME_UNSET) {<NEW_LINE>Log.w(TAG, "Skipping invalid timing: " + dialogueLine);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long endTimeUs = parseTimecodeUs(lineValues[format.endTimeIndex]);<NEW_LINE>if (endTimeUs == C.TIME_UNSET) {<NEW_LINE>Log.w(TAG, "Skipping invalid timing: " + dialogueLine);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>@Nullable<NEW_LINE>SsaStyle style = styles != null && format.styleIndex != C.INDEX_UNSET ? styles.get(lineValues[format.styleIndex].trim()) : null;<NEW_LINE>String rawText = lineValues[format.textIndex];<NEW_LINE>SsaStyle.Overrides styleOverrides = SsaStyle.Overrides.parseFromDialogue(rawText);<NEW_LINE>String text = SsaStyle.Overrides.stripStyleOverrides(rawText).replace("\\N", "\n").replace("\\n", "\n").replace("\\h", "\u00A0");<NEW_LINE>Cue cue = createCue(text, style, styleOverrides, screenWidth, screenHeight);<NEW_LINE>int startTimeIndex = addCuePlacerholderByTime(startTimeUs, cueTimesUs, cues);<NEW_LINE>int endTimeIndex = addCuePlacerholderByTime(endTimeUs, cueTimesUs, cues);<NEW_LINE>// Iterate on cues from startTimeIndex until endTimeIndex, adding the current cue.<NEW_LINE>for (int i = startTimeIndex; i < endTimeIndex; i++) {<NEW_LINE>cues.get<MASK><NEW_LINE>}<NEW_LINE>} | (i).add(cue); |
1,426,371 | public void marshall(Member member, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (member == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(member.getAccountId(), ACCOUNTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(member.getAdministratorAccountId(), ADMINISTRATORACCOUNTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(member.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(member.getEmail(), EMAIL_BINDING);<NEW_LINE>protocolMarshaller.marshall(member.getInvitedAt(), INVITEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(member.getRelationshipStatus(), RELATIONSHIPSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(member.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(member.getUpdatedAt(), UPDATEDAT_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | member.getMasterAccountId(), MASTERACCOUNTID_BINDING); |
1,667,655 | private String toFilter(DeviceInfo keys) {<NEW_LINE>if (keys == null)<NEW_LINE>return "(objectclass=dicomDevice)";<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("(&(objectclass=dicomDevice)");<NEW_LINE>appendFilter("dicomDeviceName", keys.getDeviceName(), sb);<NEW_LINE>appendFilter("dicomDescription", keys.getDescription(), sb);<NEW_LINE>appendFilter("dicomManufacturer", keys.getManufacturer(), sb);<NEW_LINE>appendFilter("dicomManufacturerModelName", keys.getManufacturerModelName(), sb);<NEW_LINE>appendFilter("dicomSoftwareVersion", <MASK><NEW_LINE>appendFilter("dicomStationName", keys.getStationName(), sb);<NEW_LINE>appendFilter("dicomInstitutionName", keys.getInstitutionNames(), sb);<NEW_LINE>appendFilter("dicomInstitutionDepartmentName", keys.getInstitutionalDepartmentNames(), sb);<NEW_LINE>appendFilter("dicomPrimaryDeviceType", keys.getPrimaryDeviceTypes(), sb);<NEW_LINE>appendFilter("dicomInstalled", keys.getInstalled(), sb);<NEW_LINE>sb.append(")");<NEW_LINE>return sb.toString();<NEW_LINE>} | keys.getSoftwareVersions(), sb); |
1,157,565 | public ListCreatedArtifactsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListCreatedArtifactsResult listCreatedArtifactsResult = new ListCreatedArtifactsResult();<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 listCreatedArtifactsResult;<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("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listCreatedArtifactsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("CreatedArtifactList", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listCreatedArtifactsResult.setCreatedArtifactList(new ListUnmarshaller<CreatedArtifact>(CreatedArtifactJsonUnmarshaller.getInstance(<MASK><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 listCreatedArtifactsResult;<NEW_LINE>} | )).unmarshall(context)); |
1,193,958 | public EppResponse run() throws EppException {<NEW_LINE>extensionManager.register(MetadataExtension.class);<NEW_LINE>validateRegistrarIsLoggedIn(registrarId);<NEW_LINE>extensionManager.validate();<NEW_LINE>DateTime now = tm().getTransactionTime();<NEW_LINE>ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);<NEW_LINE>verifyOptionalAuthInfo(authInfo, existingContact);<NEW_LINE>verifyHasPendingTransfer(existingContact);<NEW_LINE>verifyResourceOwnership(registrarId, existingContact);<NEW_LINE>ContactResource newContact = approvePendingTransfer(existingContact, TransferStatus.CLIENT_APPROVED, now);<NEW_LINE>ContactHistory contactHistory = historyBuilder.setType(CONTACT_TRANSFER_APPROVE).setContact(newContact).build();<NEW_LINE>// Create a poll message for the gaining client.<NEW_LINE>PollMessage gainingPollMessage = createGainingTransferPollMessage(targetId, newContact.getTransferData(), now<MASK><NEW_LINE>tm().insertAll(ImmutableSet.of(contactHistory, gainingPollMessage));<NEW_LINE>tm().update(newContact);<NEW_LINE>// Delete the billing event and poll messages that were written in case the transfer would have<NEW_LINE>// been implicitly server approved.<NEW_LINE>tm().delete(existingContact.getTransferData().getServerApproveEntities());<NEW_LINE>return responseBuilder.setResData(createTransferResponse(targetId, newContact.getTransferData())).build();<NEW_LINE>} | , Key.create(contactHistory)); |
8,989 | private void loadExternalData(File mediaFolder) {<NEW_LINE>// SCTO-594<NEW_LINE>File[] zipFiles = mediaFolder.listFiles(new FileFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean accept(File file) {<NEW_LINE>return file.getName().toLowerCase(Locale.US).endsWith(".zip");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (zipFiles != null) {<NEW_LINE>ZipUtils.unzip(zipFiles);<NEW_LINE>for (File zipFile : zipFiles) {<NEW_LINE>boolean deleted = zipFile.delete();<NEW_LINE>if (!deleted) {<NEW_LINE>Timber.w("Cannot delete %s. It will be re-unzipped next time. :(", zipFile.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>File[] csvFiles = mediaFolder.listFiles(new FileFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean accept(File file) {<NEW_LINE>String lowerCaseName = file.getName().toLowerCase(Locale.US);<NEW_LINE>return lowerCaseName.endsWith(".csv") <MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>Map<String, File> externalDataMap = new HashMap<>();<NEW_LINE>if (csvFiles != null) {<NEW_LINE>for (File csvFile : csvFiles) {<NEW_LINE>String dataSetName = csvFile.getName().substring(0, csvFile.getName().lastIndexOf("."));<NEW_LINE>externalDataMap.put(dataSetName, csvFile);<NEW_LINE>}<NEW_LINE>if (!externalDataMap.isEmpty()) {<NEW_LINE>publishProgress(Collect.getInstance().getString(R.string.survey_loading_reading_csv_message));<NEW_LINE>ExternalDataReader externalDataReader = new ExternalDataReaderImpl(this);<NEW_LINE>externalDataReader.doImport(externalDataMap);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | && !lowerCaseName.equalsIgnoreCase(ITEMSETS_CSV); |
169,392 | private void addCrusherRedRockRecipes(Consumer<FinishedRecipe> consumer, String basePath) {<NEW_LINE>// Chiseled Red Rock -> Red Rock Bricks<NEW_LINE>crushing(consumer, BYGBlocks.CHISELED_RED_ROCK_BRICKS, BYGBlocks.RED_ROCK_BRICKS, basePath + "chiseled_to_brick");<NEW_LINE>crushing(consumer, BYGBlocks.CHISELED_RED_ROCK_BRICK_SLAB, BYGBlocks.RED_ROCK_BRICK_SLAB, basePath + "chiseled_slabs_to_brick_slabs");<NEW_LINE>crushing(consumer, BYGBlocks.CHISELED_RED_ROCK_BRICK_STAIRS, BYGBlocks.RED_ROCK_BRICK_STAIRS, basePath + "chiseled_stairs_to_brick_stairs");<NEW_LINE>crushing(consumer, BYGBlocks.CHISELED_RED_ROCK_BRICK_WALL, BYGBlocks.RED_ROCK_BRICK_WALL, basePath + "chiseled_walls_to_brick_walls");<NEW_LINE>// Red Rock Bricks -> Cracked Red Rock Bricks<NEW_LINE>crushing(consumer, BYGBlocks.RED_ROCK_BRICKS, BYGBlocks.CRACKED_RED_ROCK_BRICKS, basePath + "bricks_to_cracked_bricks");<NEW_LINE>crushing(consumer, BYGBlocks.RED_ROCK_BRICK_SLAB, BYGBlocks.CRACKED_RED_ROCK_BRICK_SLAB, basePath + "brick_slabs_to_cracked_brick_slabs");<NEW_LINE>crushing(consumer, BYGBlocks.RED_ROCK_BRICK_STAIRS, BYGBlocks.CRACKED_RED_ROCK_BRICK_STAIRS, basePath + "brick_stairs_to_cracked_brick_stairs");<NEW_LINE>crushing(consumer, BYGBlocks.RED_ROCK_BRICK_WALL, BYGBlocks.CRACKED_RED_ROCK_BRICK_WALL, basePath + "brick_walls_to_cracked_brick_walls");<NEW_LINE>// Cracked Red Rock Bricks -> Red Rock<NEW_LINE>crushing(consumer, BYGBlocks.CRACKED_RED_ROCK_BRICKS, BYGBlocks.RED_ROCK, basePath + "from_cracked_bricks");<NEW_LINE>crushing(consumer, BYGBlocks.CRACKED_RED_ROCK_BRICK_SLAB, BYGBlocks.RED_ROCK_SLAB, basePath + "brick_slabs_to_slabs");<NEW_LINE>crushing(consumer, BYGBlocks.CRACKED_RED_ROCK_BRICK_STAIRS, <MASK><NEW_LINE>crushing(consumer, BYGBlocks.CRACKED_RED_ROCK_BRICK_WALL, BYGBlocks.RED_ROCK_WALL, basePath + "brick_walls_to_walls");<NEW_LINE>} | BYGBlocks.RED_ROCK_STAIRS, basePath + "brick_stairs_to_stairs"); |
720,452 | protected void addTransportLayers(Event event, TransportInternal transport) {<NEW_LINE>// default connection idle timeout is 0.<NEW_LINE>// Giving it an idle timeout will enable the client side to know broken connection faster.<NEW_LINE>// Refer to http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#doc-doc-idle-time-out<NEW_LINE>transport.setIdleTimeout(CONNECTION_IDLE_TIMEOUT);<NEW_LINE>final <MASK><NEW_LINE>sslDomain.init(SslDomain.Mode.CLIENT);<NEW_LINE>final SslDomain.VerifyMode verifyMode = connectionOptions.getSslVerifyMode();<NEW_LINE>final SSLContext defaultSslContext;<NEW_LINE>if (verifyMode == SslDomain.VerifyMode.ANONYMOUS_PEER) {<NEW_LINE>defaultSslContext = null;<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>defaultSslContext = SSLContext.getDefault();<NEW_LINE>} catch (NoSuchAlgorithmException e) {<NEW_LINE>throw logger.logExceptionAsError(new RuntimeException("Default SSL algorithm not found in JRE. Please check your JRE setup.", e));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (verifyMode == SslDomain.VerifyMode.VERIFY_PEER_NAME) {<NEW_LINE>final StrictTlsContextSpi serviceProvider = new StrictTlsContextSpi(defaultSslContext);<NEW_LINE>final SSLContext context = new StrictTlsContext(serviceProvider, defaultSslContext.getProvider(), defaultSslContext.getProtocol());<NEW_LINE>sslDomain.setSslContext(context);<NEW_LINE>transport.ssl(sslDomain, peerDetails);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (verifyMode == SslDomain.VerifyMode.VERIFY_PEER) {<NEW_LINE>sslDomain.setSslContext(defaultSslContext);<NEW_LINE>sslDomain.setPeerAuthentication(SslDomain.VerifyMode.VERIFY_PEER);<NEW_LINE>} else if (verifyMode == SslDomain.VerifyMode.ANONYMOUS_PEER) {<NEW_LINE>logger.warning("'{}' is not secure.", verifyMode);<NEW_LINE>sslDomain.setPeerAuthentication(SslDomain.VerifyMode.ANONYMOUS_PEER);<NEW_LINE>} else {<NEW_LINE>throw logger.logExceptionAsError(new UnsupportedOperationException("verifyMode is not supported: " + verifyMode));<NEW_LINE>}<NEW_LINE>transport.ssl(sslDomain);<NEW_LINE>} | SslDomain sslDomain = Proton.sslDomain(); |
1,774,277 | // findSystemActionsByScheme.<NEW_LINE>@GET<NEW_LINE>@Path("/schemes/{schemeId}/system/actions")<NEW_LINE>@JSONP<NEW_LINE>@NoCache<NEW_LINE>@Produces({ MediaType.APPLICATION_JSON, "application/javascript" })<NEW_LINE>public final Response findSystemActionsByScheme(@Context final HttpServletRequest request, @Context final HttpServletResponse response, @PathParam("schemeId") final String schemeId) {<NEW_LINE>final InitDataObject initDataObject = this.webResource.init(null, request, response, true, null);<NEW_LINE>try {<NEW_LINE>Logger.debug(this, "Getting the system actions for the scheme: " + schemeId);<NEW_LINE>final List<SystemActionWorkflowActionMapping> systemActions = this.workflowAPI.findSystemActionsByScheme(this.workflowAPI.findScheme(schemeId<MASK><NEW_LINE>// 200<NEW_LINE>return Response.ok(new ResponseEntityView(systemActions)).build();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(this.getClass(), "Exception on findSystemActionsByScheme, schemeId: " + schemeId + ", exception message: " + e.getMessage(), e);<NEW_LINE>return ResponseUtil.mapExceptionResponse(e);<NEW_LINE>}<NEW_LINE>} | ), initDataObject.getUser()); |
1,851,465 | private void processBlockRegistrations(NetData.NetMessage message) {<NEW_LINE>for (NetData.BlockFamilyRegisteredMessage blockFamily : message.getBlockFamilyRegisteredList()) {<NEW_LINE>if (blockFamily.getBlockIdCount() != blockFamily.getBlockUriCount()) {<NEW_LINE>logger.error("Received block registration with mismatched id<->uri mapping");<NEW_LINE>} else if (blockFamily.getBlockUriCount() == 0) {<NEW_LINE>logger.error("Received empty block registration");<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>BlockUri family = new BlockUri(blockFamily.getBlockUri<MASK><NEW_LINE>Map<String, Integer> registrationMap = Maps.newHashMap();<NEW_LINE>for (int i = 0; i < blockFamily.getBlockIdCount(); ++i) {<NEW_LINE>registrationMap.put(blockFamily.getBlockUri(i), blockFamily.getBlockId(i));<NEW_LINE>}<NEW_LINE>blockManager.receiveFamilyRegistration(family, registrationMap);<NEW_LINE>} catch (BlockUriParseException e) {<NEW_LINE>logger.error("Received invalid block uri {}", blockFamily.getBlockUri(0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (0)).getFamilyUri(); |
337,164 | // Composition - publication on valuation date: Check if a fixing is available on current date<NEW_LINE>private double valuationCompositionFactor() {<NEW_LINE>LocalDate currentFixing = nextFixing;<NEW_LINE>LocalDate currentPublication = computation.calculatePublicationFromFixing(currentFixing);<NEW_LINE>if (rates.getValuationDate().equals(currentPublication) && !(currentFixing.isAfter(lastFixingNonCutoff))) {<NEW_LINE>// If currentFixing > lastFixingNonCutoff, everything fixed<NEW_LINE>OptionalDouble fixedRate = indexFixingDateSeries.get(currentFixing);<NEW_LINE>if (fixedRate.isPresent()) {<NEW_LINE>nextFixing = computation.getFixingCalendar().next(nextFixing);<NEW_LINE>LocalDate effectiveDate = computation.calculateEffectiveFromFixing(currentFixing);<NEW_LINE>LocalDate <MASK><NEW_LINE>double accrualFactor = dayCount.yearFraction(effectiveDate, maturityDate);<NEW_LINE>if (currentFixing.isBefore(lastFixingNonCutoff)) {<NEW_LINE>return 1.0d + accrualFactor * fixedRate.getAsDouble();<NEW_LINE>}<NEW_LINE>double compositionFactor = 1.0d + accrualFactor * fixedRate.getAsDouble();<NEW_LINE>for (int i = 0; i < cutoffOffset - 1; i++) {<NEW_LINE>compositionFactor *= 1.0d + accrualFactorCutoff[i] * fixedRate.getAsDouble();<NEW_LINE>}<NEW_LINE>return compositionFactor;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 1.0d;<NEW_LINE>} | maturityDate = computation.calculateMaturityFromEffective(effectiveDate); |
748,766 | private void addCommitDetails(RepositoryCommit commit) {<NEW_LINE>adapter.addHeader(commitHeader);<NEW_LINE>commitMessage.setText(commit.getCommit().getMessage());<NEW_LINE>String commitAuthor = CommitUtils.getAuthor(commit);<NEW_LINE>String commitCommitter = CommitUtils.getCommitter(commit);<NEW_LINE>if (commitAuthor != null) {<NEW_LINE>CommitUtils.bindAuthor(commit, avatars, authorAvatar);<NEW_LINE>authorName.setText(commitAuthor);<NEW_LINE>StyledText styledAuthor = new StyledText();<NEW_LINE>styledAuthor.append(getString(R.string.authored));<NEW_LINE>Date commitAuthorDate = CommitUtils.getAuthorDate(commit);<NEW_LINE>if (commitAuthorDate != null)<NEW_LINE>styledAuthor.append(' ').append(commitAuthorDate);<NEW_LINE>authorDate.setText(styledAuthor);<NEW_LINE>ViewUtils.setGone(authorArea, false);<NEW_LINE>} else<NEW_LINE>ViewUtils.setGone(authorArea, true);<NEW_LINE>if (isDifferentCommitter(commitAuthor, commitCommitter)) {<NEW_LINE>CommitUtils.<MASK><NEW_LINE>committerName.setText(commitCommitter);<NEW_LINE>StyledText styledCommitter = new StyledText();<NEW_LINE>styledCommitter.append(getString(R.string.committed));<NEW_LINE>Date commitCommitterDate = CommitUtils.getCommitterDate(commit);<NEW_LINE>if (commitCommitterDate != null)<NEW_LINE>styledCommitter.append(' ').append(commitCommitterDate);<NEW_LINE>committerDate.setText(styledCommitter);<NEW_LINE>ViewUtils.setGone(committerArea, false);<NEW_LINE>} else<NEW_LINE>ViewUtils.setGone(committerArea, true);<NEW_LINE>} | bindCommitter(commit, avatars, committerAvatar); |
72,986 | protected void visitCustomTagEnd(Element jspElement) throws JspCoreException {<NEW_LINE>ValidateResult.CollectedTagData collectedTagData = result.getCollectedTagData(jspElement);<NEW_LINE>String uri = jspElement.getNamespaceURI();<NEW_LINE>String prefix = jspElement.getPrefix();<NEW_LINE>String tagName = jspElement.getLocalName();<NEW_LINE>if (uri.startsWith("urn:jsptld:")) {<NEW_LINE>uri = uri.substring(uri.indexOf("urn:jsptld:") + 11);<NEW_LINE>} else if (uri.startsWith("urn:jsptagdir:")) {<NEW_LINE>uri = uri.substring(uri.indexOf("urn:jsptagdir:") + 14);<NEW_LINE>}<NEW_LINE>TagLibraryInfoImpl tli = (TagLibraryInfoImpl) result.<MASK><NEW_LINE>if (tli != null) {<NEW_LINE>tagCountStack.pop();<NEW_LINE>TagInfo ti = tli.getTag(tagName);<NEW_LINE>if (ti == null) {<NEW_LINE>TagFileInfo tfi = tli.getTagFile(tagName);<NEW_LINE>ti = tfi.getTagInfo();<NEW_LINE>}<NEW_LINE>TagVariableInfo[] tagVarInfos = ti.getTagVariableInfos();<NEW_LINE>VariableInfo[] varInfos = ti.getVariableInfo(collectedTagData.getTagData());<NEW_LINE>if (varInfos == null)<NEW_LINE>varInfos = new VariableInfo[0];<NEW_LINE>// PK41783<NEW_LINE>Integer tagCount = (Integer) tagCountResult.getCountMap().get(jspElement);<NEW_LINE>// PM43415<NEW_LINE>Vector atEndVars = setScriptingVars(tagVarInfos, varInfos, collectedTagData.getTagData(), VariableInfo.AT_END, (tagCount == null ? 0 : tagCount.intValue()));<NEW_LINE>// PK29373<NEW_LINE>if (dupFlag) {<NEW_LINE>Vector dupVector = getDuplicateVars();<NEW_LINE>collectedTagData.setAtEndDuplicateVars(dupVector);<NEW_LINE>dupFlag = false;<NEW_LINE>}<NEW_LINE>// PK29373<NEW_LINE>collectedTagData.setAtEndScriptingVars(atEndVars);<NEW_LINE>}<NEW_LINE>} | getTagLibMap().get(uri); |
1,660,789 | final DescribeMovingAddressesResult executeDescribeMovingAddresses(DescribeMovingAddressesRequest describeMovingAddressesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeMovingAddressesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeMovingAddressesRequest> request = null;<NEW_LINE>Response<DescribeMovingAddressesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeMovingAddressesRequestMarshaller().marshall(super.beforeMarshalling(describeMovingAddressesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeMovingAddresses");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeMovingAddressesResult> responseHandler = new StaxResponseHandler<<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | DescribeMovingAddressesResult>(new DescribeMovingAddressesResultStaxUnmarshaller()); |
131,583 | protected ProcessPreconditionsResolution checkPreconditionsApplicable() {<NEW_LINE>if (!getSelectedRowIds().isSingleDocumentId()) {<NEW_LINE>return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();<NEW_LINE>}<NEW_LINE>final PickingSlotRow pickingSlotRow = getSingleSelectedRow();<NEW_LINE>if (!pickingSlotRow.isPickedHURow()) {<NEW_LINE>return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_SELECT_PICKED_HU));<NEW_LINE>}<NEW_LINE>final PickingSlotRowType rowType = pickingSlotRow.getType();<NEW_LINE>if ((rowType.isCU() && !pickingSlotRow.isTopLevelHU()) || rowType.isHUStorage()) {<NEW_LINE>return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_SELECT_PICKED_CU));<NEW_LINE>}<NEW_LINE>if (!checkSourceHuPreconditionIncludingEmptyHUs()) {<NEW_LINE>return ProcessPreconditionsResolution.reject<MASK><NEW_LINE>}<NEW_LINE>return ProcessPreconditionsResolution.accept();<NEW_LINE>} | (msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_MISSING_SOURCE_HU)); |
1,158,393 | private Position decodeLink(String sentence, Channel channel, SocketAddress remoteAddress) {<NEW_LINE>Parser parser = new Parser(PATTERN_LINK, sentence);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>DateBuilder dateBuilder = new DateBuilder().setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));<NEW_LINE>position.set(Position.KEY_RSSI, parser.nextInt());<NEW_LINE>position.set(Position.KEY_SATELLITES, parser.nextInt());<NEW_LINE>position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());<NEW_LINE>position.set(Position.KEY_STEPS, parser.nextInt());<NEW_LINE>position.set("turnovers", parser.nextInt());<NEW_LINE>dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));<NEW_LINE>getLastLocation(<MASK><NEW_LINE>processStatus(position, parser.nextLong(16, 0));<NEW_LINE>return position;<NEW_LINE>} | position, dateBuilder.getDate()); |
1,412,399 | Object doTimeout(VirtualFrame frame, PSimpleQueue self, boolean block, Object timeout, @Cached PyLongAsLongAndOverflowNode asLongNode, @Cached CastToJavaDoubleNode castToDouble) {<NEW_LINE>assert block;<NEW_LINE>// convert timeout object (given in seconds) to a Java long in microseconds<NEW_LINE>long ltimeout;<NEW_LINE>try {<NEW_LINE>ltimeout = (long) (castToDouble.execute(timeout) * 1000000.0);<NEW_LINE>} catch (CannotCastException e) {<NEW_LINE>try {<NEW_LINE>ltimeout = PythonUtils.multiplyExact(asLongNode.execute<MASK><NEW_LINE>} catch (OverflowException oe) {<NEW_LINE>throw raise(OverflowError, "timeout value is too large");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ltimeout < 0) {<NEW_LINE>throw raise(ValueError, "'timeout' must be a non-negative number");<NEW_LINE>}<NEW_LINE>// CPython first tries a non-blocking get without releasing the GIL<NEW_LINE>Object result = self.poll();<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ensureGil().release(true);<NEW_LINE>result = self.get(ltimeout);<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>CompilerDirectives.transferToInterpreter();<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>} finally {<NEW_LINE>ensureGil().acquire();<NEW_LINE>}<NEW_LINE>throw raise(Empty);<NEW_LINE>} | (frame, timeout), 1000000); |
176,162 | public Map<QueryType, List<ValueIndexCondition>> translateMatch(RexNode condition) {<NEW_LINE>condition = <MASK><NEW_LINE>Map<QueryType, List<ValueIndexCondition>> tryAndInRes = tryAndIn(condition);<NEW_LINE>if (tryAndInRes != null && !tryAndInRes.isEmpty())<NEW_LINE>return tryAndInRes;<NEW_LINE>// does not support disjunctions<NEW_LINE>List<RexNode> disjunctions = RelOptUtil.disjunctions(condition);<NEW_LINE>if (disjunctions.size() == 1) {<NEW_LINE>return translateAnd(disjunctions.get(0));<NEW_LINE>} else if (disjunctions.isEmpty()) {<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>RexNode listToInList = refactorOrListToInList(disjunctions);<NEW_LINE>disjunctions = RelOptUtil.disjunctions(listToInList);<NEW_LINE>if (disjunctions.size() == 1) {<NEW_LINE>return translateAnd(disjunctions.get(0));<NEW_LINE>}<NEW_LINE>return Collections.emptyMap();<NEW_LINE>} | conditionClippingByKeyMeta(condition, fieldNames, keyMetas); |
1,833,460 | public void commonProcessing(VirtualConnection vc, TCPWriteRequestContext twc, IOException ioe, boolean complete) {<NEW_LINE>// if calling the callbacks is moved to after this code, then the H2WriteQEntry needs to be copied to a variable that is local to avoid a race<NEW_LINE>// condition.<NEW_LINE>// need a local copy, since the next async write could be dequeued and executed once we hit either latch<NEW_LINE>// H2WriteQEntry qEntry = qEntry;<NEW_LINE>// should not be null, but if so, debug and leave, rather than NPE<NEW_LINE>if (qEntry == null) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "no queue entries for this callback");<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>qEntry.setIOException(ioe);<NEW_LINE>// Release waiting threads, Sync writes are waiting, and/or the queue service thread is waiting so it can start another write<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, <MASK><NEW_LINE>}<NEW_LINE>qEntry.hitWriteCompleteLatch();<NEW_LINE>// allow the next thread to come through, or allow the queue service thread to start, if it is waiting.<NEW_LINE>if (h2WorkQ != null) {<NEW_LINE>h2WorkQ.notifyStandBy();<NEW_LINE>}<NEW_LINE>} | "hit write complete latch for qentry: " + qEntry.hashCode()); |
366,068 | public Mono<Boolean> isHigher(RestMember otherMember) {<NEW_LINE>if (guildId != otherMember.guildId) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>// A member is not considered to be higher in the role hierarchy than themself<NEW_LINE>if (this.equals(otherMember)) {<NEW_LINE>return Mono.just(false);<NEW_LINE>}<NEW_LINE>return guild().getData().map(GuildUpdateData::ownerId).flatMap(ownerId -> {<NEW_LINE>// The owner of the guild is higher in the role hierarchy than everyone<NEW_LINE>if (ownerId.asLong() == id) {<NEW_LINE>return Mono.just(true);<NEW_LINE>}<NEW_LINE>if (ownerId.asLong() == otherMember.id) {<NEW_LINE>return Mono.just(false);<NEW_LINE>}<NEW_LINE>return otherMember.getData().flatMapMany(data -> Flux.fromIterable(data.roles())).map(Snowflake::of).collectList().flatMap(this::hasHigherRoles);<NEW_LINE>});<NEW_LINE>} | error(new IllegalArgumentException("The provided member is in a different guild.")); |
47,105 | protected void run() throws IOException {<NEW_LINE>if (!file.exists()) {<NEW_LINE>this.posix_errno = Posix.ENOENT;<NEW_LINE>this.result_ok = false;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Path path = file.toPath();<NEW_LINE>Files.setLastModifiedTime(path, file_mtime);<NEW_LINE>Map<String, Object> atts = Files.readAttributes(<MASK><NEW_LINE>if (att(atts, "mode", file_mode) != file_mode) {<NEW_LINE>Files.setAttribute(path, "unix:mode", new Integer(file_mode), LinkOption.NOFOLLOW_LINKS);<NEW_LINE>}<NEW_LINE>if (att(atts, "gid", file_gid) != file_gid) {<NEW_LINE>Files.setAttribute(path, "unix:gid", new Integer(file_gid), LinkOption.NOFOLLOW_LINKS);<NEW_LINE>}<NEW_LINE>if (att(atts, "uid", file_uid) != file_uid) {<NEW_LINE>Files.setAttribute(path, "unix:uid", new Integer(file_uid), LinkOption.NOFOLLOW_LINKS);<NEW_LINE>}<NEW_LINE>this.result_ok = true;<NEW_LINE>} | path, "unix:mode,gid,uid", LinkOption.NOFOLLOW_LINKS); |
188,877 | public Request<DescribeConversionTasksRequest> marshall(DescribeConversionTasksRequest describeConversionTasksRequest) {<NEW_LINE>if (describeConversionTasksRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribeConversionTasksRequest> request = new DefaultRequest<DescribeConversionTasksRequest>(describeConversionTasksRequest, "AmazonEC2");<NEW_LINE>request.addParameter("Action", "DescribeConversionTasks");<NEW_LINE>request.addParameter("Version", "2016-11-15");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>com.amazonaws.internal.SdkInternalList<String> describeConversionTasksRequestConversionTaskIdsList = (com.amazonaws.internal.SdkInternalList<String>) describeConversionTasksRequest.getConversionTaskIds();<NEW_LINE>if (!describeConversionTasksRequestConversionTaskIdsList.isEmpty() || !describeConversionTasksRequestConversionTaskIdsList.isAutoConstruct()) {<NEW_LINE>int conversionTaskIdsListIndex = 1;<NEW_LINE>for (String describeConversionTasksRequestConversionTaskIdsListValue : describeConversionTasksRequestConversionTaskIdsList) {<NEW_LINE>if (describeConversionTasksRequestConversionTaskIdsListValue != null) {<NEW_LINE>request.addParameter("ConversionTaskId." + conversionTaskIdsListIndex<MASK><NEW_LINE>}<NEW_LINE>conversionTaskIdsListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | , StringUtils.fromString(describeConversionTasksRequestConversionTaskIdsListValue)); |
1,020,850 | public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException {<NEW_LINE>if (inOff + len > in.length) {<NEW_LINE>throw new DataLengthException("input buffer too small");<NEW_LINE>}<NEW_LINE>if (outOff + len > out.length) {<NEW_LINE>throw new OutputLengthException("output buffer too short");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < len; ++i) {<NEW_LINE>byte next;<NEW_LINE>if (byteCount == 0) {<NEW_LINE>cipher.processBlock(counter, 0, counterOut, 0);<NEW_LINE>next = (byte) (in[inOff + i<MASK><NEW_LINE>} else {<NEW_LINE>next = (byte) (in[inOff + i] ^ counterOut[byteCount++]);<NEW_LINE>if (byteCount == counter.length) {<NEW_LINE>byteCount = 0;<NEW_LINE>incrementCounterChecked();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out[outOff + i] = next;<NEW_LINE>}<NEW_LINE>return len;<NEW_LINE>} | ] ^ counterOut[byteCount++]); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.