idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
835,964 | public UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException {<NEW_LINE>// Input validation<NEW_LINE>Account caller = CallContext.current().getCallingAccount();<NEW_LINE>long vmId = cmd.getVmId();<NEW_LINE>Long newTemplateId = cmd.getTemplateId();<NEW_LINE>UserVmVO vm = _vmDao.findById(vmId);<NEW_LINE>if (vm == null) {<NEW_LINE>InvalidParameterValueException ex <MASK><NEW_LINE>ex.addProxyObject(String.valueOf(vmId), "vmId");<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>_accountMgr.checkAccess(caller, null, true, vm);<NEW_LINE>// check if there are any active snapshots on volumes associated with the VM<NEW_LINE>s_logger.debug("Checking if there are any ongoing snapshots on the ROOT volumes associated with VM with ID " + vmId);<NEW_LINE>if (checkStatusOfVolumeSnapshots(vmId, Volume.Type.ROOT)) {<NEW_LINE>throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, Re-install VM is not permitted, please try again later.");<NEW_LINE>}<NEW_LINE>s_logger.debug("Found no ongoing snapshots on volume of type ROOT, for the vm with id " + vmId);<NEW_LINE>return restoreVMInternal(caller, vm, newTemplateId);<NEW_LINE>} | = new InvalidParameterValueException("Cannot find VM with ID " + vmId); |
423,896 | private static void solve() {<NEW_LINE><MASK><NEW_LINE>//<NEW_LINE>// data<NEW_LINE>//<NEW_LINE>int Belgium = 0;<NEW_LINE>int Denmark = 1;<NEW_LINE>int France = 2;<NEW_LINE>int Germany = 3;<NEW_LINE>int Netherlands = 4;<NEW_LINE>int Luxembourg = 5;<NEW_LINE>int n = 6;<NEW_LINE>int max_num_colors = 4;<NEW_LINE>int[][] neighbours = { { France, Belgium }, { France, Luxembourg }, { France, Germany }, { Luxembourg, Germany }, { Luxembourg, Belgium }, { Belgium, Netherlands }, { Belgium, Germany }, { Germany, Netherlands }, { Germany, Denmark } };<NEW_LINE>//<NEW_LINE>// Variables<NEW_LINE>//<NEW_LINE>IntVar[] color = solver.makeIntVarArray(n, 1, max_num_colors, "x");<NEW_LINE>//<NEW_LINE>// Constraints<NEW_LINE>//<NEW_LINE>for (int i = 0; i < neighbours.length; i++) {<NEW_LINE>solver.addConstraint(solver.makeNonEquality(color[neighbours[i][0]], color[neighbours[i][1]]));<NEW_LINE>}<NEW_LINE>// Symmetry breaking<NEW_LINE>solver.addConstraint(solver.makeEquality(color[Belgium], 1));<NEW_LINE>//<NEW_LINE>// Search<NEW_LINE>//<NEW_LINE>DecisionBuilder db = solver.makePhase(color, solver.CHOOSE_FIRST_UNBOUND, solver.ASSIGN_MIN_VALUE);<NEW_LINE>solver.newSearch(db);<NEW_LINE>while (solver.nextSolution()) {<NEW_LINE>System.out.print("Colors: ");<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>System.out.print(color[i].value() + " ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>solver.endSearch();<NEW_LINE>// Statistics<NEW_LINE>System.out.println();<NEW_LINE>System.out.println("Solutions: " + solver.solutions());<NEW_LINE>System.out.println("Failures: " + solver.failures());<NEW_LINE>System.out.println("Branches: " + solver.branches());<NEW_LINE>System.out.println("Wall time: " + solver.wallTime() + "ms");<NEW_LINE>} | Solver solver = new Solver("Map2"); |
1,208,713 | protected void run(StructuredGraph graph, TornadoHighTierContext context) {<NEW_LINE>if (context.getMeta() == null || context.getMeta().enableThreadCoarsener()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PTXTornadoDevice device = (PTXTornadoDevice) context.getDeviceMapping();<NEW_LINE>final TornadoSchedulingStrategy strategy = device.getPreferredSchedule();<NEW_LINE>long[] maxWorkItemSizes = device.getPhysicalDevice().getDeviceMaxWorkItemSizes();<NEW_LINE>graph.getNodes().filter(ParallelRangeNode.class).forEach(node -> {<NEW_LINE>if (context.getMeta().enableParallelization() && maxWorkItemSizes[node.index()] > 1) {<NEW_LINE>ParallelOffsetNode offset = node.offset();<NEW_LINE>ParallelStrideNode stride = node.stride();<NEW_LINE>replaceRangeNode(node);<NEW_LINE>replaceOffsetNode(graph, offset, node);<NEW_LINE>replaceStrideNode(graph, stride);<NEW_LINE>} else {<NEW_LINE>serialiseLoop(node);<NEW_LINE>}<NEW_LINE>getDebugContext().dump(DebugContext.BASIC_LEVEL, graph, <MASK><NEW_LINE>});<NEW_LINE>graph.clearLastSchedule();<NEW_LINE>} | "after scheduling loop index=" + node.index()); |
1,826,269 | public Memory update(Environment env, Memory... args) {<NEW_LINE>SourceManager manager = args[0].toObject(SourceManager.class);<NEW_LINE>try {<NEW_LINE>moduleRecord.clear();<NEW_LINE>Tokenizer tokenizer = new Tokenizer(context);<NEW_LINE>SyntaxAnalyzer analyzer = new SyntaxAnalyzer(manager.env, tokenizer);<NEW_LINE>fetchFullNameHandler = new FetchFullNameHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String fetch(String name, NamespaceStmtToken baseNamespace, UseType useType) {<NEW_LINE>return analyzer.getRealName(NameToken.valueOf(name), baseNamespace, useType).toName();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>for (ClassStmtToken token : analyzer.getClasses()) {<NEW_LINE>moduleRecord.synchronize(env, token, tokenizer);<NEW_LINE>}<NEW_LINE>for (FunctionStmtToken token : analyzer.getFunctions()) {<NEW_LINE>moduleRecord.<MASK><NEW_LINE>}<NEW_LINE>for (ConstStmtToken token : analyzer.getConstants()) {<NEW_LINE>moduleRecord.synchronize(env, token, tokenizer);<NEW_LINE>}<NEW_LINE>} catch (BaseParseError | IOException e) {<NEW_LINE>}<NEW_LINE>return Memory.NULL;<NEW_LINE>} | synchronize(env, token, tokenizer); |
556,912 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0".split(",");<NEW_LINE>SupportEvalBuilder builder = new SupportEvalBuilder("SupportCollection");<NEW_LINE>builder.expression(fields[0], "strvals.selectfrom(v => Integer.parseInt(v)).arrayOf()");<NEW_LINE>builder.statementConsumer(stmt -> assertTypesAllSame(stmt.getEventType(), fields, EPTypePremade.INTEGERBOXEDARRAY.getEPType()));<NEW_LINE>builder.assertion(makeString("1,2,3")).verify(fields[0], val -> assertArrayEquals(new Integer[] { 1, 2, 3 }, val));<NEW_LINE>builder.assertion(makeString("1")).verify(fields[0], val -> assertArrayEquals(new Integer[<MASK><NEW_LINE>builder.assertion(makeString("")).verify(fields[0], val -> assertArrayEquals(new Integer[] {}, val));<NEW_LINE>builder.assertion(makeString(null)).verify(fields[0], Assert::assertNull);<NEW_LINE>builder.run(env);<NEW_LINE>} | ] { 1 }, val)); |
1,331,557 | public static double[][] scaling(double[][] A, double rMean, double rStd) {<NEW_LINE>int count = 0;<NEW_LINE>double mean = 0.0;<NEW_LINE>double std = 0.0;<NEW_LINE>for (double[] aA : A) for (double v : aA) {<NEW_LINE>count += 1;<NEW_LINE>mean += v;<NEW_LINE>std += v * v;<NEW_LINE>}<NEW_LINE>mean = mean / count;<NEW_LINE>std = Math.sqrt(<MASK><NEW_LINE>log.info("Scaling word embeddings:");<NEW_LINE>log.info(String.format("(mean = %.2f, std = %.2f) -> (mean = %.2f, std = %.2f)", mean, std, rMean, rStd));<NEW_LINE>double[][] rA = new double[A.length][A[0].length];<NEW_LINE>for (int i = 0; i < rA.length; ++i) for (int j = 0; j < rA[i].length; ++j) rA[i][j] = (A[i][j] - mean) * rStd / std + rMean;<NEW_LINE>return rA;<NEW_LINE>} | std / count - mean * mean); |
785,808 | private boolean addToHeldExtensions(int valueIdx, List<? extends IBaseExtension<?, ?>> ext, ArrayList<ArrayList<HeldExtension>> list, boolean theIsModifier, CompositeChildElement theChildElem, CompositeChildElement theParent, EncodeContext theEncodeContext, boolean theContainedResource, IBase theContainingElement) {<NEW_LINE>boolean retVal = false;<NEW_LINE>if (ext.size() > 0) {<NEW_LINE>Boolean encodeExtension = null;<NEW_LINE>for (IBaseExtension<?, ?> next : ext) {<NEW_LINE>if (next.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Make sure we respect _summary and _elements<NEW_LINE>if (encodeExtension == null) {<NEW_LINE>encodeExtension = isEncodeExtension(<MASK><NEW_LINE>}<NEW_LINE>if (encodeExtension) {<NEW_LINE>HeldExtension extension = new HeldExtension(next, theIsModifier, theChildElem, theParent);<NEW_LINE>list.ensureCapacity(valueIdx);<NEW_LINE>while (list.size() <= valueIdx) {<NEW_LINE>list.add(null);<NEW_LINE>}<NEW_LINE>ArrayList<HeldExtension> extensionList = list.get(valueIdx);<NEW_LINE>if (extensionList == null) {<NEW_LINE>extensionList = new ArrayList<>();<NEW_LINE>list.set(valueIdx, extensionList);<NEW_LINE>}<NEW_LINE>extensionList.add(extension);<NEW_LINE>retVal = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | theParent, theEncodeContext, theContainedResource, theContainingElement); |
45,351 | static Intent fromProtocolValue(final ValueType valueType, final short intent) {<NEW_LINE>switch(valueType) {<NEW_LINE>case DEPLOYMENT:<NEW_LINE>return DeploymentIntent.from(intent);<NEW_LINE>case INCIDENT:<NEW_LINE>return IncidentIntent.from(intent);<NEW_LINE>case JOB:<NEW_LINE>return JobIntent.from(intent);<NEW_LINE>case PROCESS_INSTANCE:<NEW_LINE>return ProcessInstanceIntent.from(intent);<NEW_LINE>case MESSAGE:<NEW_LINE>return MessageIntent.from(intent);<NEW_LINE>case MESSAGE_SUBSCRIPTION:<NEW_LINE>return MessageSubscriptionIntent.from(intent);<NEW_LINE>case MESSAGE_START_EVENT_SUBSCRIPTION:<NEW_LINE>return MessageStartEventSubscriptionIntent.from(intent);<NEW_LINE>case PROCESS_MESSAGE_SUBSCRIPTION:<NEW_LINE>return ProcessMessageSubscriptionIntent.from(intent);<NEW_LINE>case JOB_BATCH:<NEW_LINE>return JobBatchIntent.from(intent);<NEW_LINE>case TIMER:<NEW_LINE>return TimerIntent.from(intent);<NEW_LINE>case VARIABLE:<NEW_LINE>return VariableIntent.from(intent);<NEW_LINE>case VARIABLE_DOCUMENT:<NEW_LINE>return VariableDocumentIntent.from(intent);<NEW_LINE>case PROCESS_INSTANCE_CREATION:<NEW_LINE>return ProcessInstanceCreationIntent.from(intent);<NEW_LINE>case ERROR:<NEW_LINE>return ErrorIntent.from(intent);<NEW_LINE>case PROCESS_INSTANCE_RESULT:<NEW_LINE>return ProcessInstanceResultIntent.from(intent);<NEW_LINE>case PROCESS:<NEW_LINE>return ProcessIntent.from(intent);<NEW_LINE>case DEPLOYMENT_DISTRIBUTION:<NEW_LINE>return DeploymentDistributionIntent.from(intent);<NEW_LINE>case PROCESS_EVENT:<NEW_LINE>return ProcessEventIntent.from(intent);<NEW_LINE>case DECISION:<NEW_LINE>return DecisionIntent.from(intent);<NEW_LINE>case DECISION_REQUIREMENTS:<NEW_LINE>return DecisionRequirementsIntent.from(intent);<NEW_LINE>case DECISION_EVALUATION:<NEW_LINE>return DecisionEvaluationIntent.from(intent);<NEW_LINE>case NULL_VAL:<NEW_LINE>case SBE_UNKNOWN:<NEW_LINE>return Intent.UNKNOWN;<NEW_LINE>default:<NEW_LINE>throw new RuntimeException(String.format("Expected to map value type %s to intent type, but did not recognize the value type"<MASK><NEW_LINE>}<NEW_LINE>} | , valueType.name())); |
1,776,701 | public void preProcess(ProcessContext context) throws EngineExecutionException {<NEW_LINE>if (context.hasVariable(DomainConstants.VAR_NAME_IS_LOOP_STATE)) {<NEW_LINE>StateInstruction instruction = context.getInstruction(StateInstruction.class);<NEW_LINE>AbstractTaskState currentState = (AbstractTaskState) instruction.getState(context);<NEW_LINE>int loopCounter;<NEW_LINE>Loop loop;<NEW_LINE>// get loop config<NEW_LINE>if (context.hasVariable(DomainConstants.VAR_NAME_CURRENT_COMPEN_TRIGGER_STATE)) {<NEW_LINE>// compensate condition should get stateToBeCompensated 's config<NEW_LINE>CompensationHolder compensationHolder = CompensationHolder.getCurrent(context, true);<NEW_LINE>StateInstance stateToBeCompensated = compensationHolder.getStatesNeedCompensation().get(currentState.getName());<NEW_LINE>AbstractTaskState compensateState = (AbstractTaskState) stateToBeCompensated.getStateMachineInstance().getStateMachine().getState<MASK><NEW_LINE>loop = compensateState.getLoop();<NEW_LINE>loopCounter = LoopTaskUtils.reloadLoopCounter(stateToBeCompensated.getName());<NEW_LINE>} else {<NEW_LINE>loop = currentState.getLoop();<NEW_LINE>loopCounter = (int) context.getVariable(DomainConstants.LOOP_COUNTER);<NEW_LINE>}<NEW_LINE>Collection collection = LoopContextHolder.getCurrent(context, true).getCollection();<NEW_LINE>Map<String, Object> contextVariables = (Map<String, Object>) context.getVariable(DomainConstants.VAR_NAME_STATEMACHINE_CONTEXT);<NEW_LINE>Map<String, Object> copyContextVariables = new ConcurrentHashMap<>(contextVariables);<NEW_LINE>copyContextVariables.put(loop.getElementIndexName(), loopCounter);<NEW_LINE>copyContextVariables.put(loop.getElementVariableName(), iterator(collection, loopCounter));<NEW_LINE>((HierarchicalProcessContext) context).setVariableLocally(DomainConstants.VAR_NAME_STATEMACHINE_CONTEXT, copyContextVariables);<NEW_LINE>}<NEW_LINE>} | (EngineUtils.getOriginStateName(stateToBeCompensated)); |
943,138 | private static String generateQuery(@NotNull QueryParams params) {<NEW_LINE>StringBuilder sql = new StringBuilder("SELECT ").append(params.getSelect()).append(" FROM ").append(params.getFrom<MASK><NEW_LINE>boolean addParentheses = params.getCommentColumnName() != null || params.getDefinitionColumnName() != null;<NEW_LINE>if (addParentheses) {<NEW_LINE>sql.append("(");<NEW_LINE>}<NEW_LINE>sql.append(params.getObjectNameColumn()).append(" LIKE ? ");<NEW_LINE>if (params.getCommentColumnName() != null) {<NEW_LINE>sql.append("OR ").append(params.getCommentColumnName()).append(" LIKE ?");<NEW_LINE>}<NEW_LINE>if (params.getDefinitionColumnName() != null) {<NEW_LINE>sql.append(" OR ").append(params.getDefinitionColumnName()).append(" LIKE ?");<NEW_LINE>}<NEW_LINE>if (addParentheses) {<NEW_LINE>sql.append(") ");<NEW_LINE>}<NEW_LINE>if (params.getSchemaColumnName() != null) {<NEW_LINE>sql.append("AND ").append(params.getSchemaColumnName()).append(" = ? ");<NEW_LINE>}<NEW_LINE>sql.append("ORDER BY ").append(params.getObjectNameColumn()).append(" LIMIT ").append(params.getMaxResults());<NEW_LINE>return sql.toString();<NEW_LINE>} | ()).append(" WHERE "); |
567,475 | public static <T1, T2, R> Stream<R> zip(Stream<? extends T1> a, Stream<? extends T2> b, BiFunction<? super T1, ? super T2, ? extends R> zipper) {<NEW_LINE>Objects.requireNonNull(zipper);<NEW_LINE>Spliterator<? extends T1> aSpliterator = Objects.<MASK><NEW_LINE>Spliterator<? extends T2> bSpliterator = Objects.requireNonNull(b).spliterator();<NEW_LINE>// Zipping looses DISTINCT and SORTED characteristics<NEW_LINE>int characteristics = aSpliterator.characteristics() & bSpliterator.characteristics() & ~(Spliterator.DISTINCT | Spliterator.SORTED);<NEW_LINE>long zipSize = ((characteristics & Spliterator.SIZED) != 0) ? Math.min(aSpliterator.getExactSizeIfKnown(), bSpliterator.getExactSizeIfKnown()) : -1;<NEW_LINE>Iterator<T1> aIterator = Spliterators.iterator(aSpliterator);<NEW_LINE>Iterator<T2> bIterator = Spliterators.iterator(bSpliterator);<NEW_LINE>Iterator<R> cIterator = new Iterator<R>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean hasNext() {<NEW_LINE>return aIterator.hasNext() && bIterator.hasNext();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public R next() {<NEW_LINE>return zipper.apply(aIterator.next(), bIterator.next());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Spliterator<R> split = Spliterators.spliterator(cIterator, zipSize, characteristics);<NEW_LINE>return (a.isParallel() || b.isParallel()) ? StreamSupport.stream(split, true) : StreamSupport.stream(split, false);<NEW_LINE>} | requireNonNull(a).spliterator(); |
1,514,971 | CustomElement parse(GroupableDslContext context, Tokens tokens) {<NEW_LINE>// element <name> [metadata] [description] [tags]<NEW_LINE>if (tokens.hasMoreThan(TAGS_INDEX)) {<NEW_LINE>throw new RuntimeException("Too many tokens, expected: " + GRAMMAR);<NEW_LINE>}<NEW_LINE>if (!tokens.includes(NAME_INDEX)) {<NEW_LINE>throw new RuntimeException("Expected: " + GRAMMAR);<NEW_LINE>}<NEW_LINE>String name = tokens.get(NAME_INDEX);<NEW_LINE>String metadata = "";<NEW_LINE>if (tokens.includes(METADATA_INDEX)) {<NEW_LINE>metadata = tokens.get(METADATA_INDEX);<NEW_LINE>}<NEW_LINE>String description = "";<NEW_LINE>if (tokens.includes(DESCRIPTION_INDEX)) {<NEW_LINE>description = tokens.get(DESCRIPTION_INDEX);<NEW_LINE>}<NEW_LINE>CustomElement customElement = context.getWorkspace().getModel().addCustomElement(name, metadata, description);<NEW_LINE>if (tokens.includes(TAGS_INDEX)) {<NEW_LINE>String <MASK><NEW_LINE>customElement.addTags(tags.split(","));<NEW_LINE>}<NEW_LINE>if (context.hasGroup()) {<NEW_LINE>customElement.setGroup(context.getGroup().getName());<NEW_LINE>}<NEW_LINE>return customElement;<NEW_LINE>} | tags = tokens.get(TAGS_INDEX); |
901,482 | public static AmazonS3 createS3Client(JsonNode data) {<NEW_LINE>String key = data.get(AWS_ACCESS_KEY_ID_FIELDNAME).asText();<NEW_LINE>String secret = data.get(AWS_SECRET_ACCESS_KEY_FIELDNAME).asText();<NEW_LINE>Boolean isPathStyleAccess = data.has(AWS_PATH_STYLE_ACCESS) ? data.get(AWS_PATH_STYLE_ACCESS).asBoolean(false) : false;<NEW_LINE>String endpoint = (data.get(AWS_HOST_BASE_FIELDNAME) != null && !StringUtils.isBlank(data.get(AWS_HOST_BASE_FIELDNAME).textValue())) ? data.get(AWS_HOST_BASE_FIELDNAME).textValue() : null;<NEW_LINE>AWSCredentials credentials = new BasicAWSCredentials(key, secret);<NEW_LINE>if (!isPathStyleAccess || endpoint == null) {<NEW_LINE>AmazonS3Client client = new AmazonS3Client(credentials);<NEW_LINE>if (endpoint != null) {<NEW_LINE>client.setEndpoint(endpoint);<NEW_LINE>}<NEW_LINE>return client;<NEW_LINE>}<NEW_LINE>AWSCredentialsProvider creds = new AWSStaticCredentialsProvider(credentials);<NEW_LINE>EndpointConfiguration endpointConfiguration = new EndpointConfiguration(endpoint, null);<NEW_LINE>AmazonS3 client = AmazonS3Client.builder().withCredentials(creds).withForceGlobalBucketAccessEnabled(true).withPathStyleAccessEnabled(true).<MASK><NEW_LINE>return client;<NEW_LINE>} | withEndpointConfiguration(endpointConfiguration).build(); |
865,371 | public void scrollRectToVisible(final Rectangle newRect) {<NEW_LINE>final Container scroll = getParent();<NEW_LINE>if (scroll instanceof JScrollPane) {<NEW_LINE>final JScrollPane scrollPane = (JScrollPane) scroll;<NEW_LINE>if (this == scrollPane.getViewport()) {<NEW_LINE>final LayoutManager layout = scrollPane.getLayout();<NEW_LINE>if (layout instanceof ScrollPaneLayout) {<NEW_LINE>final Rectangle curRect = getVisibleRect();<NEW_LINE>final ScrollBarSettings vpos = ((ScrollPaneLayout) layout).getVerticalScrollBarPosition();<NEW_LINE>if (vpos.isHovering() && vpos.isExtending()) {<NEW_LINE>final <MASK><NEW_LINE>if (vsb != null && vsb.isShowing()) {<NEW_LINE>newRect.x += calculateAdjustment(curRect.x, curRect.width, newRect.x, newRect.width, vsb.getWidth());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ScrollBarSettings hpos = ((ScrollPaneLayout) layout).getHorizontalScrollBarPosition();<NEW_LINE>if (hpos.isHovering() && hpos.isExtending()) {<NEW_LINE>final JScrollBar hsb = scrollPane.getHorizontalScrollBar();<NEW_LINE>if (hsb != null && hsb.isShowing()) {<NEW_LINE>newRect.y += calculateAdjustment(curRect.y, curRect.height, newRect.y, newRect.height, hsb.getHeight());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>super.scrollRectToVisible(newRect);<NEW_LINE>} | JScrollBar vsb = scrollPane.getVerticalScrollBar(); |
1,183,751 | public JPanel buildOverviewPanel(WsdlProject project) {<NEW_LINE>JPropertiesTable<WsdlProject> table = new JPropertiesTable<WsdlProject>("Project Properties", project);<NEW_LINE>if (project.isOpen()) {<NEW_LINE>table.addProperty("Name", "name", true);<NEW_LINE>table.addProperty("Description", "description", true);<NEW_LINE>table.addProperty("File", "path");<NEW_LINE>if (!project.isDisabled()) {<NEW_LINE>table.addProperty("Resource Root", "resourceRoot", new String[] { null, "${projectDir}", "${workspaceDir}" });<NEW_LINE>table.addProperty("Cache Definitions", "cacheDefinitions", JPropertiesTable.BOOLEAN_OPTIONS);<NEW_LINE>table.addPropertyShadow("Project Password", "shadowPassword", true);<NEW_LINE>table.addProperty("Script Language", "defaultScriptLanguage", SoapUIScriptEngineRegistry.getAvailableEngineIds());<NEW_LINE>table.addProperty("Hermes Config", "hermesConfig", true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return table;<NEW_LINE>} | table.addProperty("File", "path"); |
1,166,231 | public static Rule compose(AndroidLibTarget target, @Nullable String manifestRule, List<String> deps, List<String> aidlRuleNames, @Nullable String appClass) {<NEW_LINE>List<String> testDeps = new ArrayList<>(deps);<NEW_LINE>testDeps.add(":" + src(target));<NEW_LINE>testDeps.addAll(external(target.getExternalDeps(SourceSetType.TEST)));<NEW_LINE>testDeps.addAll(targets(target.getTargetDeps(SourceSetType.TEST)));<NEW_LINE>List<String> testAptDeps = new ArrayList<>();<NEW_LINE>testAptDeps.addAll(external(target.getExternalAptDeps(SourceSetType.TEST)));<NEW_LINE>testAptDeps.addAll(targets(target.getTargetAptDeps(SourceSetType.TEST)));<NEW_LINE>Set<String> providedDeps = new LinkedHashSet<>();<NEW_LINE>providedDeps.addAll(external(target.<MASK><NEW_LINE>providedDeps.addAll(targets(target.getTargetProvidedDeps(SourceSetType.TEST)));<NEW_LINE>providedDeps.add(D8Manager.RT_STUB_JAR_RULE);<NEW_LINE>AndroidTestRule androidTest = new AndroidTestRule().srcs(target.getTest().getSources()).exts(target.getTestRuleType().getProperties()).apPlugins(getApPlugins(target.getTestApPlugins())).aptDeps(testAptDeps).providedDeps(providedDeps).resources(target.getTest().getJavaResources()).sourceCompatibility(target.getSourceCompatibility()).targetCompatibility(target.getTargetCompatibility()).exportedDeps(aidlRuleNames).excludes(appClass != null ? ImmutableSet.of(appClass) : ImmutableSet.of()).options(target.getTest().getCustomOptions()).jvmArgs(target.getTestOptions().getJvmArgs()).env(target.getTestOptions().getEnv()).robolectricManifest(manifestRule).runtimeDependency(RobolectricManager.ROBOLECTRIC_CACHE_TARGET);<NEW_LINE>if (target.getTestRuleType().equals(RuleType.KOTLIN_ROBOLECTRIC_TEST)) {<NEW_LINE>androidTest.language("kotlin");<NEW_LINE>}<NEW_LINE>return androidTest.ruleType(target.getTestRuleType().getBuckName()).defaultVisibility().deps(testDeps).name(test(target)).labels(ANDROID_TEST_LABELS).extraBuckOpts(target.getExtraOpts(RuleType.ROBOLECTRIC_TEST));<NEW_LINE>} | getExternalProvidedDeps(SourceSetType.TEST))); |
137,429 | public static DescribeDcdnDomainCnameResponse unmarshall(DescribeDcdnDomainCnameResponse describeDcdnDomainCnameResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDcdnDomainCnameResponse.setRequestId(_ctx.stringValue("DescribeDcdnDomainCnameResponse.RequestId"));<NEW_LINE>List<Data> cnameDatas = new ArrayList<Data>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDcdnDomainCnameResponse.CnameDatas.Length"); i++) {<NEW_LINE>Data data = new Data();<NEW_LINE>data.setDomain(_ctx.stringValue("DescribeDcdnDomainCnameResponse.CnameDatas[" + i + "].Domain"));<NEW_LINE>data.setCname(_ctx.stringValue("DescribeDcdnDomainCnameResponse.CnameDatas[" + i + "].Cname"));<NEW_LINE>data.setStatus(_ctx.integerValue<MASK><NEW_LINE>cnameDatas.add(data);<NEW_LINE>}<NEW_LINE>describeDcdnDomainCnameResponse.setCnameDatas(cnameDatas);<NEW_LINE>return describeDcdnDomainCnameResponse;<NEW_LINE>} | ("DescribeDcdnDomainCnameResponse.CnameDatas[" + i + "].Status")); |
833,529 | protected void fillStatusLine(IStatusLineManager statusLine) {<NEW_LINE>{<NEW_LINE><MASK><NEW_LINE>TimeZone tzDefault = TimeZone.getDefault();<NEW_LINE>tzItem.setText(tzDefault.getDisplayName(false, TimeZone.SHORT));<NEW_LINE>tzItem.setToolTip(tzDefault.getDisplayName(false, TimeZone.LONG));<NEW_LINE>tzItem.setDoubleClickListener(() -> {<NEW_LINE>UIUtils.showMessageBox(null, "Time zone", "You can change time zone by adding parameter\n" + "-D" + StandardConstants.ENV_USER_TIMEZONE + "=<TimeZone>\n" + "in the end of file '" + DBWorkbench.getPlatform().getApplicationConfiguration().getAbsolutePath() + "'", SWT.ICON_INFORMATION);<NEW_LINE>});<NEW_LINE>statusLine.add(tzItem);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>StatusLineContributionItemEx localeItem = new StatusLineContributionItemEx("Locale");<NEW_LINE>localeItem.setText(Locale.getDefault().toString());<NEW_LINE>localeItem.setToolTip(Locale.getDefault().getDisplayName());<NEW_LINE>localeItem.setDoubleClickListener(() -> {<NEW_LINE>UIUtils.showMessageBox(null, "Locale", "You can change locale by adding parameters\n" + "-nl\n<language_iso_code>\n" + "in file '" + DBWorkbench.getPlatform().getApplicationConfiguration().getAbsolutePath() + "'.\n" + "Or by passing command line parameter -nl <language_iso_code>", SWT.ICON_INFORMATION);<NEW_LINE>});<NEW_LINE>statusLine.add(localeItem);<NEW_LINE>}<NEW_LINE>} | StatusLineContributionItemEx tzItem = new StatusLineContributionItemEx("Time Zone"); |
1,654,459 | public TermsAggregationBuilder parse(List<GroupingElement> elements, QueryState state) {<NEW_LINE>List<Column> groups = new ArrayList<Column>();<NEW_LINE>for (GroupingElement grouping : elements) {<NEW_LINE>for (Set<Expression> expressions : grouping.enumerateGroupingSets()) {<NEW_LINE>for (Expression e : expressions) groups.add((Column) e.accept(this, state));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// to find case sensitive group by definitions which ES needs<NEW_LINE>for (Column groupby : groups) {<NEW_LINE>if (groupby.getOp() != Operation.NONE) {<NEW_LINE>state.addException("Can not use function '" + groupby.getAggName() + "' as GROUP BY, please use an alias to group by a function");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Heading.fixColumnReferences(state.originalSql() + ";", "group by.+", "\\W", groups);<NEW_LINE>for (Column g : groups) {<NEW_LINE>Column s = state.getHeading().<MASK><NEW_LINE>if (s == null) {<NEW_LINE>state.addException("Group by '" + g.getColumn() + "' not defined in SELECT");<NEW_LINE>} else {<NEW_LINE>// add column from select to this group (when referenced through an alias)<NEW_LINE>g.setColumn(s.getColumn());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return buildAggregationQuery(groups, 0, state);<NEW_LINE>} | getColumnByLabel(g.getAggName()); |
964,023 | protected void executeAction(AnActionEvent e) {<NEW_LINE>List<TreeNodeOnVcsRevision> sel = getSelection();<NEW_LINE>int selectionSize = sel.size();<NEW_LINE>if (selectionSize > 1) {<NEW_LINE>List<VcsFileRevision> selectedRevisions = ContainerUtil.sorted(ContainerUtil.map(sel, TreeNodeOnVcsRevision::getRevision), myRevisionsInOrderComparator);<NEW_LINE>VcsFileRevision olderRevision = selectedRevisions.get(0);<NEW_LINE>VcsFileRevision newestRevision = selectedRevisions.get(<MASK><NEW_LINE>myDiffHandler.showDiffForTwo(e.getRequiredData(CommonDataKeys.PROJECT), myFilePath, olderRevision, newestRevision);<NEW_LINE>} else if (selectionSize == 1) {<NEW_LINE>final TableView<TreeNodeOnVcsRevision> flatView = myDualView.getFlatView();<NEW_LINE>final int selectedRow = flatView.getSelectedRow();<NEW_LINE>VcsFileRevision revision = getFirstSelectedRevision();<NEW_LINE>VcsFileRevision previousRevision;<NEW_LINE>if (selectedRow == (flatView.getRowCount() - 1)) {<NEW_LINE>// no previous<NEW_LINE>previousRevision = myBottomRevisionForShowDiff != null ? myBottomRevisionForShowDiff : VcsFileRevision.NULL;<NEW_LINE>} else {<NEW_LINE>previousRevision = flatView.getRow(selectedRow + 1).getRevision();<NEW_LINE>}<NEW_LINE>if (revision != null) {<NEW_LINE>myDiffHandler.showDiffForOne(e, e.getRequiredData(CommonDataKeys.PROJECT), myFilePath, previousRevision, revision);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sel.size() - 1); |
796,992 | public void onMouseDown(MouseDownEvent event) {<NEW_LINE>startX = event.getClientX();<NEW_LINE>startY = event.getClientY();<NEW_LINE>if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>clickTarget = Element.as(event.getNativeEvent().getEventTarget());<NEW_LINE>mouseMoveCanceled = false;<NEW_LINE>if (weekGrid.getCalendar().isEventMoveAllowed() || clickTargetsResize()) {<NEW_LINE>moveRegistration = addMouseMoveHandler(this);<NEW_LINE>setFocus(true);<NEW_LINE>try {<NEW_LINE>startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight);<NEW_LINE>startXrelative = (event.getRelativeX(weekGrid.getElement()) - weekGrid.timebar.getOffsetWidth()) % getDateCellWidth();<NEW_LINE>} catch (Exception e) {<NEW_LINE>GWT.log("Exception calculating relative start position", e);<NEW_LINE>}<NEW_LINE>mouseMoveStarted = false;<NEW_LINE>Style s = getElement().getStyle();<NEW_LINE>s.setZIndex(1000);<NEW_LINE>startDatetimeFrom = (Date) calendarEvent.getStartTime().clone();<NEW_LINE>startDatetimeTo = (Date) calendarEvent<MASK><NEW_LINE>Event.setCapture(getElement());<NEW_LINE>}<NEW_LINE>// make sure the right cursor is always displayed<NEW_LINE>if (clickTargetsResize()) {<NEW_LINE>addGlobalResizeStyle();<NEW_LINE>}<NEW_LINE>event.stopPropagation();<NEW_LINE>event.preventDefault();<NEW_LINE>} | .getEndTime().clone(); |
1,029,971 | protected ConsumerFactory<?, ?> createKafkaConsumerFactory(boolean anonymous, String consumerGroup, ExtendedConsumerProperties<KafkaConsumerProperties> consumerProperties, String beanName, String destination) {<NEW_LINE>Map<String, Object> props = new HashMap<>();<NEW_LINE>props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);<NEW_LINE>props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);<NEW_LINE>props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false);<NEW_LINE>props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 100);<NEW_LINE>props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, anonymous ? "latest" : "earliest");<NEW_LINE>props.put(ConsumerConfig.GROUP_ID_CONFIG, consumerGroup);<NEW_LINE>Map<String, Object> mergedConfig = this.configurationProperties.mergedConsumerConfiguration();<NEW_LINE>if (!ObjectUtils.isEmpty(mergedConfig)) {<NEW_LINE>props.putAll(mergedConfig);<NEW_LINE>}<NEW_LINE>if (ObjectUtils.isEmpty(props.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG))) {<NEW_LINE>props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, <MASK><NEW_LINE>}<NEW_LINE>Map<String, String> config = consumerProperties.getExtension().getConfiguration();<NEW_LINE>if (!ObjectUtils.isEmpty(config)) {<NEW_LINE>Assert.state(!config.containsKey(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG), ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG + " cannot be overridden at the binding level; " + "use multiple binders instead");<NEW_LINE>props.putAll(config);<NEW_LINE>}<NEW_LINE>if (!ObjectUtils.isEmpty(consumerProperties.getExtension().getStartOffset())) {<NEW_LINE>props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, consumerProperties.getExtension().getStartOffset().name());<NEW_LINE>}<NEW_LINE>if (this.consumerConfigCustomizer != null) {<NEW_LINE>this.consumerConfigCustomizer.configure(props, bindingNameHolder.get(), destination);<NEW_LINE>}<NEW_LINE>DefaultKafkaConsumerFactory<Object, Object> factory = new DefaultKafkaConsumerFactory<>(props);<NEW_LINE>factory.setBeanName(beanName);<NEW_LINE>if (this.clientFactoryCustomizer != null) {<NEW_LINE>this.clientFactoryCustomizer.configure(factory);<NEW_LINE>}<NEW_LINE>return factory;<NEW_LINE>} | this.configurationProperties.getKafkaConnectionString()); |
681,441 | private void handleUpdateRowsEvent(final UpdateRowsEvent event) {<NEW_LINE>PipelineTableMetaData tableMetaData = metaDataLoader.getTableMetaData(event.getTableName());<NEW_LINE>for (int i = 0; i < event.getBeforeRows().size(); i++) {<NEW_LINE>Serializable[] beforeValues = event.getBeforeRows().get(i);<NEW_LINE>Serializable[] afterValues = event.<MASK><NEW_LINE>DataRecord record = createDataRecord(event, beforeValues.length);<NEW_LINE>record.setType(IngestDataChangeType.UPDATE);<NEW_LINE>for (int j = 0; j < beforeValues.length; j++) {<NEW_LINE>Serializable oldValue = beforeValues[j];<NEW_LINE>Serializable newValue = afterValues[j];<NEW_LINE>boolean updated = !Objects.equals(newValue, oldValue);<NEW_LINE>PipelineColumnMetaData columnMetaData = tableMetaData.getColumnMetaData(j);<NEW_LINE>record.addColumn(new Column(columnMetaData.getName(), (columnMetaData.isPrimaryKey() && updated) ? handleValue(columnMetaData, oldValue) : null, handleValue(columnMetaData, newValue), updated, columnMetaData.isPrimaryKey()));<NEW_LINE>}<NEW_LINE>pushRecord(record);<NEW_LINE>}<NEW_LINE>} | getAfterRows().get(i); |
1,594,071 | private int buildCompFmOffset(Map<String, List<Float>> featureMaps, int trainDataSize) {<NEW_LINE>List<CompressWeight> compressWeights = EncodeExecutor.getInstance().encode(featureMaps, trainDataSize);<NEW_LINE>if (compressWeights == null || compressWeights.size() == 0) {<NEW_LINE>LOGGER.severe("[Compression] the return compressWeights from <encodeExecutor.encode> is " + "null, please check");<NEW_LINE>retCode = ResponseCode.RequestError;<NEW_LINE>status = FLClientStatus.FAILED;<NEW_LINE>throw new IllegalArgumentException();<NEW_LINE>}<NEW_LINE>int compFeatureSize = compressWeights.size();<NEW_LINE>int[] compFmOffsets = new int[compFeatureSize];<NEW_LINE>int index = 0;<NEW_LINE>for (CompressWeight compressWeight : compressWeights) {<NEW_LINE>String weightFullname = compressWeight.getWeightFullname();<NEW_LINE>List<Byte> compressData = compressWeight.getCompressData();<NEW_LINE>float minVal = compressWeight.getMinValue();<NEW_LINE>float maxVal = compressWeight.getMaxValue();<NEW_LINE>byte[] data = new byte[compressData.size()];<NEW_LINE>LOGGER.info(Common.addTag("[updateModel build compressWeight] feature name: " + weightFullname <MASK><NEW_LINE>for (int j = 0; j < data.length; j++) {<NEW_LINE>data[j] = compressData.get(j);<NEW_LINE>}<NEW_LINE>int featureName = builder.createString(weightFullname);<NEW_LINE>int weight = CompressFeatureMap.createCompressDataVector(builder, data);<NEW_LINE>int featureMap = CompressFeatureMap.createCompressFeatureMap(builder, featureName, weight, minVal, maxVal);<NEW_LINE>LOGGER.info(Common.addTag("[Compression]" + " featureName: " + weightFullname + ", min_val: " + minVal + ", max_val: " + maxVal));<NEW_LINE>compFmOffsets[index] = featureMap;<NEW_LINE>index += 1;<NEW_LINE>}<NEW_LINE>return RequestUpdateModel.createCompressFeatureMapVector(builder, compFmOffsets);<NEW_LINE>} | + ", feature size: " + data.length)); |
254,141 | // Same as above, but with a given ProgressHandle to accumulate and StringWorker to check if cancelled<NEW_LINE>static Map<String, List<AbstractFile>> findFilesBymd5(List<String> md5Hash, ProgressHandle progress, SwingWorker<Object, Void> worker) throws NoCurrentCaseException {<NEW_LINE>Map<String, List<AbstractFile>> map = new LinkedHashMap<String, List<AbstractFile>>();<NEW_LINE>if (!worker.isCancelled()) {<NEW_LINE>progress.switchToDeterminate(md5Hash.size());<NEW_LINE>int size = 0;<NEW_LINE>for (String md5 : md5Hash) {<NEW_LINE>if (worker.isCancelled()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>List<<MASK><NEW_LINE>if (!files.isEmpty()) {<NEW_LINE>map.put(md5, files);<NEW_LINE>}<NEW_LINE>size++;<NEW_LINE>if (!worker.isCancelled()) {<NEW_LINE>progress.progress(size);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | AbstractFile> files = findFilesByMd5(md5); |
647,790 | protected final ObjectMetadata updateMetadataWithContentCryptoMaterial(ObjectMetadata metadata, File file, ContentCryptoMaterial contentCryptoMaterial) {<NEW_LINE>if (metadata == null)<NEW_LINE>metadata = new ObjectMetadata();<NEW_LINE>if (file != null) {<NEW_LINE>Mimetypes mimetypes = Mimetypes.getInstance();<NEW_LINE>metadata.setContentType<MASK><NEW_LINE>}<NEW_LINE>// Put the encrypted content encrypt key into the object meatadata<NEW_LINE>byte[] encryptedCEK = contentCryptoMaterial.getEncryptedCEK();<NEW_LINE>metadata.addUserMetadata(CryptoHeaders.CRYPTO_KEY, BinaryUtil.toBase64String(encryptedCEK));<NEW_LINE>// Put the iv into the object metadata<NEW_LINE>byte[] encryptedIV = contentCryptoMaterial.getEncryptedIV();<NEW_LINE>metadata.addUserMetadata(CryptoHeaders.CRYPTO_IV, BinaryUtil.toBase64String(encryptedIV));<NEW_LINE>// Put the content encrypt key algorithm into the object metadata<NEW_LINE>String contentCryptoAlgo = contentCryptoMaterial.getContentCryptoAlgorithm();<NEW_LINE>metadata.addUserMetadata(CryptoHeaders.CRYPTO_CEK_ALG, contentCryptoAlgo);<NEW_LINE>// Put the key wrap algorithm into the object metadata<NEW_LINE>String keyWrapAlgo = contentCryptoMaterial.getKeyWrapAlgorithm();<NEW_LINE>metadata.addUserMetadata(CryptoHeaders.CRYPTO_WRAP_ALG, keyWrapAlgo);<NEW_LINE>// Put the crypto description into the object metadata<NEW_LINE>Map<String, String> materialDesc = contentCryptoMaterial.getMaterialsDescription();<NEW_LINE>if (materialDesc != null && materialDesc.size() > 0) {<NEW_LINE>JSONObject descJson = new JSONObject(materialDesc);<NEW_LINE>String descStr = descJson.toString();<NEW_LINE>metadata.addUserMetadata(CryptoHeaders.CRYPTO_MATDESC, descStr);<NEW_LINE>}<NEW_LINE>return metadata;<NEW_LINE>} | (mimetypes.getMimetype(file)); |
1,816,579 | static Object readVal(Context ctx, View rootView, int viewOrPrefId, boolean click, Object target, Class<?> valType, String valName) throws Exception {<NEW_LINE>boolean isView = TypeHelper.isView(valType);<NEW_LINE>boolean isPreference = TypeHelper.isPreference(valType);<NEW_LINE>if (!isView && !isPreference) {<NEW_LINE>throw new Exception("Not a View or Preference '" + valType.getName() + "'.");<NEW_LINE>}<NEW_LINE>if (viewOrPrefId == 0) {<NEW_LINE>if (isView) {<NEW_LINE>viewOrPrefId = <MASK><NEW_LINE>} else {<NEW_LINE>viewOrPrefId = ResourceUtils.getStringId(ctx, valName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object viewOrPref = null;<NEW_LINE>if (isView) {<NEW_LINE>if (rootView == null) {<NEW_LINE>throw new IllegalArgumentException("Null View.");<NEW_LINE>}<NEW_LINE>viewOrPref = rootView.findViewById(viewOrPrefId);<NEW_LINE>} else {<NEW_LINE>String prefKey = ctx.getString(viewOrPrefId);<NEW_LINE>if (target instanceof PreferenceActivity) {<NEW_LINE>viewOrPref = ((PreferenceActivity) target).findPreference(prefKey);<NEW_LINE>} else {<NEW_LINE>viewOrPref = findPreferenceInFragment(target, prefKey);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (viewOrPref != null) {<NEW_LINE>if (click) {<NEW_LINE>if (isView) {<NEW_LINE>boolean success = setListener((View) viewOrPref, target);<NEW_LINE>if (!success) {<NEW_LINE>L.w("Failed to set OnClickListener");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>boolean success = setListener((Preference) viewOrPref, target);<NEW_LINE>if (!success) {<NEW_LINE>L.w("Failed to set OnPreferenceClickListener or OnPreferenceChangeListener.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return viewOrPref;<NEW_LINE>} | ResourceUtils.getResourceId(ctx, valName); |
1,414,307 | public static Graph removeLoops(Graph graph) {<NEW_LINE><MASK><NEW_LINE>int[] stack = new int[sz * 2];<NEW_LINE>int stackSize = 0;<NEW_LINE>byte[] state = new byte[sz];<NEW_LINE>for (int i = 0; i < sz; ++i) {<NEW_LINE>if (graph.incomingEdgesCount(i) == 0) {<NEW_LINE>stack[stackSize++] = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>GraphBuilder builder = new GraphBuilder(graph.size());<NEW_LINE>while (stackSize > 0) {<NEW_LINE>int node = stack[--stackSize];<NEW_LINE>switch(state[node]) {<NEW_LINE>case NONE:<NEW_LINE>state[node] = VISITING;<NEW_LINE>stack[stackSize++] = node;<NEW_LINE>for (int next : graph.outgoingEdges(node)) {<NEW_LINE>switch(state[next]) {<NEW_LINE>case NONE:<NEW_LINE>stack[stackSize++] = next;<NEW_LINE>builder.addEdge(node, next);<NEW_LINE>break;<NEW_LINE>case VISITED:<NEW_LINE>builder.addEdge(node, next);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case VISITING:<NEW_LINE>state[node] = VISITED;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | int sz = graph.size(); |
496,323 | public static SearchTmOnsalesResponse unmarshall(SearchTmOnsalesResponse searchTmOnsalesResponse, UnmarshallerContext _ctx) {<NEW_LINE>searchTmOnsalesResponse.setRequestId(_ctx.stringValue("SearchTmOnsalesResponse.RequestId"));<NEW_LINE>searchTmOnsalesResponse.setTotalCount(_ctx.integerValue("SearchTmOnsalesResponse.TotalCount"));<NEW_LINE>searchTmOnsalesResponse.setPageNumber(_ctx.integerValue("SearchTmOnsalesResponse.PageNumber"));<NEW_LINE>searchTmOnsalesResponse.setPageSize(_ctx.integerValue("SearchTmOnsalesResponse.PageSize"));<NEW_LINE>searchTmOnsalesResponse.setTotalPageNumber(_ctx.integerValue("SearchTmOnsalesResponse.TotalPageNumber"));<NEW_LINE>List<Trademark> trademarks = new ArrayList<Trademark>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("SearchTmOnsalesResponse.Trademarks.Length"); i++) {<NEW_LINE>Trademark trademark = new Trademark();<NEW_LINE>trademark.setUid(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].Uid"));<NEW_LINE>trademark.setTrademarkName(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].TrademarkName"));<NEW_LINE>trademark.setRegistrationNumber(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].RegistrationNumber"));<NEW_LINE>trademark.setClassification(_ctx.stringValue<MASK><NEW_LINE>trademark.setIcon(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].Icon"));<NEW_LINE>trademark.setProductCode(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].ProductCode"));<NEW_LINE>trademark.setOrderPrice(_ctx.longValue("SearchTmOnsalesResponse.Trademarks[" + i + "].OrderPrice"));<NEW_LINE>trademark.setProductDesc(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].ProductDesc"));<NEW_LINE>trademark.setPartnerCode(_ctx.stringValue("SearchTmOnsalesResponse.Trademarks[" + i + "].PartnerCode"));<NEW_LINE>trademark.setStatus(_ctx.longValue("SearchTmOnsalesResponse.Trademarks[" + i + "].Status"));<NEW_LINE>trademarks.add(trademark);<NEW_LINE>}<NEW_LINE>searchTmOnsalesResponse.setTrademarks(trademarks);<NEW_LINE>return searchTmOnsalesResponse;<NEW_LINE>} | ("SearchTmOnsalesResponse.Trademarks[" + i + "].Classification")); |
409,160 | public void handleUpdateTag(@Nonnull CompoundTag tag) {<NEW_LINE>super.handleUpdateTag(tag);<NEW_LINE>NBTUtils.setCompoundIfPresent(tag, NBTConstants.FLUID_STORED, nbt -> fluidTank.deserializeNBT(nbt));<NEW_LINE>NBTUtils.setCompoundIfPresent(tag, NBTConstants.ITEM, nbt -> {<NEW_LINE>if (nbt.isEmpty()) {<NEW_LINE>lastPasteItem = null;<NEW_LINE>} else if (nbt.contains(NBTConstants.ID, Tag.TAG_STRING)) {<NEW_LINE>ResourceLocation id = ResourceLocation.tryParse(nbt.getString(NBTConstants.ID));<NEW_LINE>if (id != null) {<NEW_LINE>Item item = ForgeRegistries.ITEMS.getValue(id);<NEW_LINE>if (item != null && item != Items.AIR) {<NEW_LINE>ItemStack stack = new ItemStack(item);<NEW_LINE>if (nbt.contains(NBTConstants.TAG, Tag.TAG_COMPOUND)) {<NEW_LINE>stack.setTag(nbt.getCompound(NBTConstants.TAG));<NEW_LINE>}<NEW_LINE>// Use raw because we have a new stack, so we don't need to bother copying it<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | lastPasteItem = HashedItem.raw(stack); |
89,092 | private void addFeatureListener(InsteonDevice aDev, String aItemName, InsteonPLMBindingConfig aConfig) {<NEW_LINE>if (aDev == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DeviceFeature f = aDev.getFeature(aConfig.getFeature());<NEW_LINE>if (f == null || f.isFeatureGroup()) {<NEW_LINE>StringBuffer buf = new StringBuffer();<NEW_LINE>ArrayList<String> names = new ArrayList<String>(aDev.<MASK><NEW_LINE>Collections.sort(names);<NEW_LINE>for (String name : names) {<NEW_LINE>DeviceFeature feature = aDev.getFeature(name);<NEW_LINE>if (!feature.isFeatureGroup()) {<NEW_LINE>if (buf.length() > 0) {<NEW_LINE>buf.append(", ");<NEW_LINE>}<NEW_LINE>buf.append(name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.error("item {} references unknown feature: {}, item disabled! Known features for {} are: {}.", aItemName, aConfig.getFeature(), aConfig.getProductKey(), buf.toString());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DeviceFeatureListener fl = new DeviceFeatureListener(this, aItemName, eventPublisher);<NEW_LINE>fl.setParameters(aConfig.getParameters());<NEW_LINE>f.addListener(fl);<NEW_LINE>} | getFeatures().keySet()); |
1,384,622 | private static Row kafkaSourceRecordToBeamRow(Struct value, Row.Builder rowBuilder) {<NEW_LINE>org.apache.beam.sdk.schemas.Schema beamSchema = rowBuilder.getSchema();<NEW_LINE>for (org.apache.beam.sdk.schemas.Schema.Field f : beamSchema.getFields()) {<NEW_LINE>switch(f.getType().getTypeName()) {<NEW_LINE>case INT16:<NEW_LINE>rowBuilder.addValue(value.getInt16(f.getName()));<NEW_LINE>break;<NEW_LINE>case INT32:<NEW_LINE>rowBuilder.addValue(value.getInt32<MASK><NEW_LINE>break;<NEW_LINE>case INT64:<NEW_LINE>rowBuilder.addValue(value.getInt64(f.getName()));<NEW_LINE>break;<NEW_LINE>case FLOAT:<NEW_LINE>rowBuilder.addValue(value.getFloat32(f.getName()));<NEW_LINE>break;<NEW_LINE>case DOUBLE:<NEW_LINE>rowBuilder.addValue(value.getFloat64(f.getName()));<NEW_LINE>break;<NEW_LINE>case BOOLEAN:<NEW_LINE>rowBuilder.addValue(value.getBoolean(f.getName()));<NEW_LINE>break;<NEW_LINE>case STRING:<NEW_LINE>rowBuilder.addValue(value.getString(f.getName()));<NEW_LINE>break;<NEW_LINE>case DECIMAL:<NEW_LINE>rowBuilder.addValue(value.get(f.getName()));<NEW_LINE>break;<NEW_LINE>case BYTES:<NEW_LINE>rowBuilder.addValue(value.getBytes(f.getName()));<NEW_LINE>break;<NEW_LINE>case ROW:<NEW_LINE>Row.Builder nestedRowBuilder = Row.withSchema(f.getType().getRowSchema());<NEW_LINE>rowBuilder.addValue(kafkaSourceRecordToBeamRow(value.getStruct(f.getName()), nestedRowBuilder));<NEW_LINE>break;<NEW_LINE>case MAP:<NEW_LINE>throw new DataException("Map types are not supported.");<NEW_LINE>case ARRAY:<NEW_LINE>throw new DataException("Array types are not supported.");<NEW_LINE>default:<NEW_LINE>throw new DataException(String.format("Unsupported data type: {}", f.getType().getTypeName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return rowBuilder.build();<NEW_LINE>} | (f.getName())); |
378,529 | public Map<String, Object> buildDetails(TriggerState triggerState, Map<String, Object> sanitizedDataMap) {<NEW_LINE>Map<String, Object> details = new LinkedHashMap<>();<NEW_LINE>details.put("group", this.trigger.getKey().getGroup());<NEW_LINE>details.put("name", this.trigger.getKey().getName());<NEW_LINE>putIfNoNull(details, "description", this.trigger.getDescription());<NEW_LINE>details.put("state", triggerState);<NEW_LINE>details.put("type", getType().getId());<NEW_LINE>putIfNoNull(details, "calendarName", this.trigger.getCalendarName());<NEW_LINE>putIfNoNull(details, "startTime", this.trigger.getStartTime());<NEW_LINE>putIfNoNull(details, "endTime", this.trigger.getEndTime());<NEW_LINE>putIfNoNull(details, "previousFireTime", <MASK><NEW_LINE>putIfNoNull(details, "nextFireTime", this.trigger.getNextFireTime());<NEW_LINE>putIfNoNull(details, "priority", this.trigger.getPriority());<NEW_LINE>putIfNoNull(details, "finalFireTime", this.trigger.getFinalFireTime());<NEW_LINE>putIfNoNull(details, "data", sanitizedDataMap);<NEW_LINE>Map<String, Object> typeDetails = new LinkedHashMap<>();<NEW_LINE>appendDetails(typeDetails);<NEW_LINE>details.put(getType().getId(), typeDetails);<NEW_LINE>return details;<NEW_LINE>} | this.trigger.getPreviousFireTime()); |
1,808,897 | public FlatFileItemWriter<T> build() {<NEW_LINE>Assert.isTrue(this.lineAggregator != null || this.delimitedBuilder != null || this.formattedBuilder != null, "A LineAggregator or a DelimitedBuilder or a FormattedBuilder is required");<NEW_LINE>if (this.saveState) {<NEW_LINE>Assert.hasText(this.name, "A name is required when saveState is true");<NEW_LINE>}<NEW_LINE>if (this.resource == null) {<NEW_LINE>logger.debug("The resource is null. This is only a valid scenario when " + "injecting it later as in when using the MultiResourceItemWriter");<NEW_LINE>}<NEW_LINE>FlatFileItemWriter<T> writer = new FlatFileItemWriter<>();<NEW_LINE>writer.setName(this.name);<NEW_LINE>writer.setAppendAllowed(this.append);<NEW_LINE>writer.setEncoding(this.encoding);<NEW_LINE>writer.setFooterCallback(this.footerCallback);<NEW_LINE>writer.setForceSync(this.forceSync);<NEW_LINE>writer.setHeaderCallback(this.headerCallback);<NEW_LINE>if (this.lineAggregator == null) {<NEW_LINE>Assert.state(this.delimitedBuilder == null || this.formattedBuilder == null, "Either a DelimitedLineAggregator or a FormatterLineAggregator should be provided, but not both");<NEW_LINE>if (this.delimitedBuilder != null) {<NEW_LINE>this.lineAggregator <MASK><NEW_LINE>} else {<NEW_LINE>this.lineAggregator = this.formattedBuilder.build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.setLineAggregator(this.lineAggregator);<NEW_LINE>writer.setLineSeparator(this.lineSeparator);<NEW_LINE>writer.setResource(this.resource);<NEW_LINE>writer.setSaveState(this.saveState);<NEW_LINE>writer.setShouldDeleteIfEmpty(this.shouldDeleteIfEmpty);<NEW_LINE>writer.setShouldDeleteIfExists(this.shouldDeleteIfExists);<NEW_LINE>writer.setTransactional(this.transactional);<NEW_LINE>return writer;<NEW_LINE>} | = this.delimitedBuilder.build(); |
1,007,727 | public BiFunction<JsonInput, PropertySetting, T> apply(Type type) {<NEW_LINE>Type keyType;<NEW_LINE>Type valueType;<NEW_LINE>if (type instanceof ParameterizedType) {<NEW_LINE>ParameterizedType pt = (ParameterizedType) type;<NEW_LINE>keyType = <MASK><NEW_LINE>valueType = pt.getActualTypeArguments()[1];<NEW_LINE>} else if (type instanceof Class) {<NEW_LINE>keyType = Object.class;<NEW_LINE>valueType = Object.class;<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unhandled type: " + type.getClass());<NEW_LINE>}<NEW_LINE>return (jsonInput, setting) -> {<NEW_LINE>jsonInput.beginObject();<NEW_LINE>T toReturn = new JsonInputIterator(jsonInput).asStream().map(in -> {<NEW_LINE>Object key = coercer.coerce(in, keyType, setting);<NEW_LINE>Object value = coercer.coerce(in, valueType, setting);<NEW_LINE>return new AbstractMap.SimpleImmutableEntry<>(key, value);<NEW_LINE>}).collect(collector);<NEW_LINE>jsonInput.endObject();<NEW_LINE>return toReturn;<NEW_LINE>};<NEW_LINE>} | pt.getActualTypeArguments()[0]; |
1,106,692 | // </editor-fold>//GEN-END:initComponents<NEW_LINE>private void browseButton1ActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_browseButton1ActionPerformed<NEW_LINE>try {<NEW_LINE>org.netbeans.api.project.SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);<NEW_LINE>org.openide.filesystems.FileObject <MASK><NEW_LINE>if (fo != null) {<NEW_LINE>String res = "/" + DDUtils.getResourcePath(groups, fo, '/', true);<NEW_LINE>if (!res.equals(jspFileTF.getText())) {<NEW_LINE>dObj.modelUpdatedFromUI();<NEW_LINE>jspFileTF.setText(res);<NEW_LINE>dObj.setChangedFromUI(true);<NEW_LINE>servlet.setJspFile(res);<NEW_LINE>dObj.setChangedFromUI(false);<NEW_LINE>getSectionView().checkValidity();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (java.io.IOException ex) {<NEW_LINE>}<NEW_LINE>} | fo = BrowseFolders.showDialog(groups); |
1,100,552 | public static void main(String[] args) throws IOException {<NEW_LINE>int keycount = 0;<NEW_LINE>String plaintext = null, keytext = null, encrypted = null, decrypted = null;<NEW_LINE>HashMap<Character, Integer> hashmap1 = new HashMap<Character, Integer>();<NEW_LINE>HashMap<Integer, Character> hashmap2 = new HashMap<Integer, Character>();<NEW_LINE>BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));<NEW_LINE>for (int i = 0; i < 26; ++i) {<NEW_LINE>hashmap1.put((char) (i + 97), i);<NEW_LINE>hashmap2.put(i, (<MASK><NEW_LINE>}<NEW_LINE>System.out.print("Enter the Plain Text : ");<NEW_LINE>plaintext = bufferedreader.readLine();<NEW_LINE>System.out.print("Enter Key: ");<NEW_LINE>keycount = Integer.parseInt(bufferedreader.readLine());<NEW_LINE>System.out.println("Plain Text is: " + plaintext);<NEW_LINE>keytext = createkey(plaintext, keycount, hashmap1, hashmap2);<NEW_LINE>encrypted = encryption(plaintext, keytext, hashmap1, hashmap2);<NEW_LINE>System.out.println("Encrypted Text: " + keytext);<NEW_LINE>decrypted = decryption(encrypted, keytext, hashmap1, hashmap2);<NEW_LINE>System.out.println("Decrypted Text: " + decrypted);<NEW_LINE>bufferedreader.close();<NEW_LINE>} | char) (i + 97)); |
1,171,780 | protected BufferedImage readTile(TileRequest tileRequest) throws IOException {<NEW_LINE>try {<NEW_LINE>BufferedImage img;<NEW_LINE>double fullResDownsample = getDownsampleForResolution(0);<NEW_LINE>if (tileRequest.getDownsample() != fullResDownsample && Math.abs(tileRequest.getDownsample() - fullResDownsample) > 1e-6) {<NEW_LINE>// If we're generating lower-resolution tiles, we need to request the higher-resolution data accordingly<NEW_LINE>var request2 = RegionRequest.createInstance(getPath(), fullResDownsample, tileRequest.getRegionRequest());<NEW_LINE>img = readBufferedImage(request2);<NEW_LINE>img = BufferedImageTools.resize(img, tileRequest.getTileWidth(), tileRequest.<MASK><NEW_LINE>} else {<NEW_LINE>// Classify at this resolution if need be<NEW_LINE>img = classifier.applyClassification(imageData, tileRequest.getRegionRequest());<NEW_LINE>img = BufferedImageTools.resize(img, tileRequest.getTileWidth(), tileRequest.getTileHeight(), allowSmoothInterpolation());<NEW_LINE>}<NEW_LINE>// If we have specified a color model, apply it now<NEW_LINE>if (colorModel != null && colorModel != img.getColorModel() && colorModel.isCompatibleRaster(img.getRaster())) {<NEW_LINE>img = new BufferedImage(colorModel, img.getRaster(), img.isAlphaPremultiplied(), null);<NEW_LINE>}<NEW_LINE>return img;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>} catch (Error e) {<NEW_LINE>// Because sometimes we have library loading problems (e.g. OpenCV) and need to report this somehow,<NEW_LINE>// even if called within a stream<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>} | getTileHeight(), allowSmoothInterpolation()); |
614,074 | private static void joinChat() throws NotInitializedException {<NEW_LINE>if (chatroom == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!initialized) {<NEW_LINE>establishConnection();<NEW_LINE>if (!initialized) {<NEW_LINE>throw new NotInitializedException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>chat = new MultiUserChat(connection, chatroom);<NEW_LINE>try {<NEW_LINE>if (chatpassword != null) {<NEW_LINE>chat.join(chatnickname, chatpassword);<NEW_LINE>} else {<NEW_LINE>chat.join(chatnickname);<NEW_LINE>}<NEW_LINE>logger.info("Successfuly joined chat '{}' with nickname '{}'.", chatroom, chatnickname);<NEW_LINE>} catch (XMPPException e) {<NEW_LINE>logger.error("Could not join chat '{}' with nickname '{}': {}", chatroom, chatnickname, e.getMessage());<NEW_LINE>} catch (SmackException e) {<NEW_LINE>logger.error("Could not join chat '{}' with nickname '{}': {}", chatroom, <MASK><NEW_LINE>}<NEW_LINE>} | chatnickname, e.getMessage()); |
1,527,438 | public okhttp3.Call validateAPICall(String query, String ifNoneMatch, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/apis/validate";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (query != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>if (ifNoneMatch != null) {<NEW_LINE>localVarHeaderParams.put("If-None-Match", localVarApiClient.parameterToString(ifNoneMatch));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String <MASK><NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "OAuth2Security" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); |
812,369 | public void init(final int capacity) {<NEW_LINE><MASK><NEW_LINE>// read the categories<NEW_LINE>for (Category f : this.categories.keySet()) {<NEW_LINE>String keys = DAO.getConfig("classification." + this.name() + "." + f.name(), "");<NEW_LINE>Set<String> keyset = new HashSet<>();<NEW_LINE>for (String key : keys.toLowerCase().split(",")) keyset.add(key);<NEW_LINE>this.categories.put(f, keyset);<NEW_LINE>}<NEW_LINE>// consistency check of categories: identify words appearing not in one category only<NEW_LINE>Set<String> inconsistentWords = new HashSet<>();<NEW_LINE>for (Map.Entry<Category, Set<String>> c0 : this.categories.entrySet()) {<NEW_LINE>for (String key : c0.getValue()) {<NEW_LINE>doublecheck: for (Map.Entry<Category, Set<String>> c1 : this.categories.entrySet()) {<NEW_LINE>if (c1.getKey().equals(c0.getKey()))<NEW_LINE>continue doublecheck;<NEW_LINE>if (c1.getValue().contains(key)) {<NEW_LINE>inconsistentWords.add(key);<NEW_LINE>break doublecheck;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// remove inconsistent words from all categories<NEW_LINE>for (String key : inconsistentWords) {<NEW_LINE>forgetWord(key);<NEW_LINE>}<NEW_LINE>} | this.bayes.setMemoryCapacity(capacity); |
672,984 | final DeleteAppInstanceAdminResult executeDeleteAppInstanceAdmin(DeleteAppInstanceAdminRequest deleteAppInstanceAdminRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAppInstanceAdminRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAppInstanceAdminRequest> request = null;<NEW_LINE>Response<DeleteAppInstanceAdminResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteAppInstanceAdminRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAppInstanceAdminRequest));<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, "Chime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAppInstanceAdmin");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "identity-";<NEW_LINE>String resolvedHostPrefix = String.format("identity-");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAppInstanceAdminResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAppInstanceAdminResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
79,583 | private void createMessageGroupBox() {<NEW_LINE>messageGroupBox = new QGroupBox(tr("Balloon Message"));<NEW_LINE>typeLabel = new QLabel(tr("Type:"));<NEW_LINE>typeComboBox = new QComboBox();<NEW_LINE>typeComboBox.addItem(tr("None"), new QVariant(QSystemTrayIcon.MessageIcon.NoIcon.value));<NEW_LINE>typeComboBox.addItem(style().standardIcon(QStyle.SP_MessageBoxInformation), tr("Information"), new QVariant(QSystemTrayIcon.MessageIcon.Information.value));<NEW_LINE>typeComboBox.addItem(style().standardIcon(QStyle.SP_MessageBoxWarning), tr("Warning"), new QVariant(QSystemTrayIcon.MessageIcon.Warning.value));<NEW_LINE>typeComboBox.addItem(style().standardIcon(QStyle.SP_MessageBoxCritical), tr("Critical"), new QVariant(QSystemTrayIcon.MessageIcon.Critical.value));<NEW_LINE>typeComboBox.addItem(new QIcon(), tr("Custom icon"), new QVariant(QSystemTrayIcon.MessageIcon.NoIcon.value));<NEW_LINE>typeComboBox.setCurrentIndex(1);<NEW_LINE>durationLabel = new QLabel(tr("Duration:"));<NEW_LINE>durationSpinBox = new QSpinBox();<NEW_LINE>durationSpinBox.setRange(5, 60);<NEW_LINE>durationSpinBox.setSuffix(QString.fromStdString(" s"));<NEW_LINE>durationSpinBox.setValue(15);<NEW_LINE>durationWarningLabel = new QLabel(tr("(some systems might ignore this " + "hint)"));<NEW_LINE>durationWarningLabel.setIndent(10);<NEW_LINE>titleLabel = new QLabel(tr("Title:"));<NEW_LINE>titleEdit = new QLineEdit(tr("Cannot connect to network"));<NEW_LINE>bodyLabel = new QLabel(tr("Body:"));<NEW_LINE>bodyEdit = new QTextEdit();<NEW_LINE>bodyEdit.setPlainText(tr("Don't believe me. Honestly, I don't have a " + "clue.\nClick this balloon for details."));<NEW_LINE>showMessageButton = new QPushButton(tr("Show Message"));<NEW_LINE>showMessageButton.setDefault(true);<NEW_LINE>final QGridLayout messageLayout = new QGridLayout();<NEW_LINE>messageLayout.addWidget(typeLabel, 0, 0);<NEW_LINE>messageLayout.addWidget(typeComboBox, 0, 1, 1, 2);<NEW_LINE>messageLayout.addWidget(durationLabel, 1, 0);<NEW_LINE>messageLayout.addWidget(durationSpinBox, 1, 1);<NEW_LINE>messageLayout.addWidget(durationWarningLabel, 1, 2, 1, 3);<NEW_LINE>messageLayout.<MASK><NEW_LINE>messageLayout.addWidget(titleEdit, 2, 1, 1, 4);<NEW_LINE>messageLayout.addWidget(bodyLabel, 3, 0);<NEW_LINE>messageLayout.addWidget(bodyEdit, 3, 1, 2, 4);<NEW_LINE>messageLayout.addWidget(showMessageButton, 5, 4);<NEW_LINE>messageLayout.setColumnStretch(3, 1);<NEW_LINE>messageLayout.setRowStretch(4, 1);<NEW_LINE>messageGroupBox.setLayout(messageLayout);<NEW_LINE>} | addWidget(titleLabel, 2, 0); |
1,735,519 | private List<Object[]> buildStepExecutionParameters(StepExecution stepExecution) {<NEW_LINE>Assert.isNull(<MASK><NEW_LINE>Assert.isNull(stepExecution.getVersion(), "to-be-saved (not updated) StepExecution can't already have a version assigned");<NEW_LINE>validateStepExecution(stepExecution);<NEW_LINE>stepExecution.setId(stepExecutionIncrementer.nextLongValue());<NEW_LINE>// Should be 0<NEW_LINE>stepExecution.incrementVersion();<NEW_LINE>List<Object[]> parameters = new ArrayList<>();<NEW_LINE>String exitDescription = truncateExitDescription(stepExecution.getExitStatus().getExitDescription());<NEW_LINE>Object[] parameterValues = new Object[] { stepExecution.getId(), stepExecution.getVersion(), stepExecution.getStepName(), stepExecution.getJobExecutionId(), stepExecution.getStartTime(), stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(), stepExecution.getFilterCount(), stepExecution.getWriteCount(), stepExecution.getExitStatus().getExitCode(), exitDescription, stepExecution.getReadSkipCount(), stepExecution.getWriteSkipCount(), stepExecution.getProcessSkipCount(), stepExecution.getRollbackCount(), stepExecution.getLastUpdated() };<NEW_LINE>Integer[] parameterTypes = new Integer[] { Types.BIGINT, Types.INTEGER, Types.VARCHAR, Types.BIGINT, Types.TIMESTAMP, Types.TIMESTAMP, Types.VARCHAR, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.TIMESTAMP };<NEW_LINE>parameters.add(0, Arrays.copyOf(parameterValues, parameterValues.length));<NEW_LINE>parameters.add(1, Arrays.copyOf(parameterTypes, parameterTypes.length));<NEW_LINE>return parameters;<NEW_LINE>} | stepExecution.getId(), "to-be-saved (not updated) StepExecution can't already have an id assigned"); |
614,579 | public static void orderBandsIntoRGB(InterleavedU8 image, BufferedImage input) {<NEW_LINE>boolean swap = swapBandOrder(input);<NEW_LINE>// Output formats are: RGB and RGBA<NEW_LINE>if (swap) {<NEW_LINE>if (image.getNumBands() == 3) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, image.height, y -> {<NEW_LINE>for (int y = 0; y < image.height; y++) {<NEW_LINE>int index = image.startIndex + y * image.stride;<NEW_LINE>int indexEnd <MASK><NEW_LINE>while (index < indexEnd) {<NEW_LINE>byte tmp = image.data[index + 2];<NEW_LINE>image.data[index + 2] = image.data[index];<NEW_LINE>image.data[index] = tmp;<NEW_LINE>index += 3;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (image.getNumBands() == 4) {<NEW_LINE>int bufferedImageType = input.getType();<NEW_LINE>if (bufferedImageType == BufferedImage.TYPE_INT_ARGB) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, image.height, y -> {<NEW_LINE>for (int y = 0; y < image.height; y++) {<NEW_LINE>int index = image.startIndex + y * image.stride;<NEW_LINE>int indexEnd = index + image.width * 3;<NEW_LINE>while (index < indexEnd) {<NEW_LINE>byte tmp = image.data[index];<NEW_LINE>image.data[index] = image.data[index + 1];<NEW_LINE>image.data[index + 1] = image.data[index + 2];<NEW_LINE>image.data[index + 2] = image.data[index + 3];<NEW_LINE>image.data[index + 3] = tmp;<NEW_LINE>index += 4;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (bufferedImageType == BufferedImage.TYPE_4BYTE_ABGR) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, image.height, y -> {<NEW_LINE>for (int y = 0; y < image.height; y++) {<NEW_LINE>int index = image.startIndex + y * image.stride;<NEW_LINE>int indexEnd = index + image.width * 3;<NEW_LINE>while (index < indexEnd) {<NEW_LINE>byte tmp1 = image.data[index + 1];<NEW_LINE>byte tmp0 = image.data[index];<NEW_LINE>image.data[index] = image.data[index + 3];<NEW_LINE>image.data[index + 1] = image.data[index + 2];<NEW_LINE>image.data[index + 2] = tmp1;<NEW_LINE>image.data[index + 3] = tmp0;<NEW_LINE>index += 4;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = index + image.width * 3; |
1,181,317 | protected void updateOKStatus() {<NEW_LINE>IStatus status = null;<NEW_LINE>if (selectRemoteButton.getSelection()) {<NEW_LINE>ISelection selection = tv.getSelection();<NEW_LINE>if (selection != null && !selection.isEmpty() && manualEurekaURL.getText() != null && manualEurekaURL.getText().length() > 0) {<NEW_LINE>status = new Status(IStatus.OK, BootDashActivator.PLUGIN_ID, null);<NEW_LINE>} else {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please select a remote Eureka instance");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String manualURL = manualEurekaURL.getText();<NEW_LINE>if (manualURL != null && manualURL.length() > 0) {<NEW_LINE>try {<NEW_LINE>URL url = new URL(manualURL);<NEW_LINE>URI uri = url.toURI();<NEW_LINE>if (uri.getHost() == null || uri.getHost().length() == 0) {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter a valid URL");<NEW_LINE>} else {<NEW_LINE>status = new Status(IStatus.OK, BootDashActivator.PLUGIN_ID, null);<NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter a valid URL");<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>status = new Status(IStatus.<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter URL of remote Eureka instance");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>updateStatus(status);<NEW_LINE>} | ERROR, BootDashActivator.PLUGIN_ID, "please enter a valid URL"); |
452,686 | public <T> CFMappingDef<T> initializeCacheForClass(Class<T> clazz) {<NEW_LINE>CFMappingDef<<MASK><NEW_LINE>try {<NEW_LINE>initializePropertiesMapDef(cfMapDef);<NEW_LINE>} catch (IntrospectionException e) {<NEW_LINE>throw new HectorObjectMapperException(e);<NEW_LINE>} catch (InstantiationException e) {<NEW_LINE>throw new HectorObjectMapperException(e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new HectorObjectMapperException(e);<NEW_LINE>}<NEW_LINE>// by the time we get here, all super classes and their annotations have<NEW_LINE>// been processed and validated, and all annotations for this class have<NEW_LINE>// been processed. what's left to do is validate this class, set super<NEW_LINE>// classes, and and set any defaults<NEW_LINE>checkMappingAndSetDefaults(cfMapDef);<NEW_LINE>// if this class is not a derived class, then map the ColumnFamily name<NEW_LINE>if (!cfMapDef.isDerivedEntity()) {<NEW_LINE>cfMapByColFamName.put(cfMapDef.getEffectiveColFamName(), cfMapDef);<NEW_LINE>}<NEW_LINE>// always map the parsed class to its ColumnFamily map definition<NEW_LINE>cfMapByClazz.put(cfMapDef.getRealClass(), cfMapDef);<NEW_LINE>return cfMapDef;<NEW_LINE>} | T> cfMapDef = initializeColumnFamilyMapDef(clazz); |
834,264 | private void measureRoundTrip(final Histogram histogram, final InetSocketAddress sendAddress, final ByteBuffer buffer, final DatagramChannel sendChannel, final Selector selector, final AtomicBoolean running) throws IOException {<NEW_LINE>for (sequenceNumber = 0; sequenceNumber < Common.NUM_MESSAGES; sequenceNumber++) {<NEW_LINE>final long timestamp = System.nanoTime();<NEW_LINE>buffer.clear();<NEW_LINE>buffer.putLong(sequenceNumber);<NEW_LINE>buffer.putLong(timestamp);<NEW_LINE>buffer.flip();<NEW_LINE><MASK><NEW_LINE>while (selector.selectNow() == 0) {<NEW_LINE>if (!running.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ThreadHints.onSpinWait();<NEW_LINE>}<NEW_LINE>final Set<SelectionKey> selectedKeys = selector.selectedKeys();<NEW_LINE>final Iterator<SelectionKey> iter = selectedKeys.iterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>final SelectionKey key = iter.next();<NEW_LINE>if (key.isReadable()) {<NEW_LINE>((IntSupplier) key.attachment()).getAsInt();<NEW_LINE>}<NEW_LINE>iter.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>histogram.outputPercentileDistribution(System.out, 1000.0);<NEW_LINE>} | sendChannel.send(buffer, sendAddress); |
359,484 | private void loadAllFromPersistence() {<NEW_LINE>allCookies = new HashMap<>();<NEW_LINE>Map<String, ?> allPairs = sharedPreferences.getAll();<NEW_LINE>for (Map.Entry<String, ?> entry : allPairs.entrySet()) {<NEW_LINE>String[] uriAndName = entry.getKey(<MASK><NEW_LINE>try {<NEW_LINE>URI uri = new URI(uriAndName[0]);<NEW_LINE>String encodedCookie = (String) entry.getValue();<NEW_LINE>HttpCookie cookie = new SerializableHttpCookie().decode(encodedCookie);<NEW_LINE>if (cookie != null) {<NEW_LINE>Set<HttpCookie> targetCookies = allCookies.get(uri);<NEW_LINE>if (targetCookies == null) {<NEW_LINE>targetCookies = new HashSet<>();<NEW_LINE>allCookies.put(uri, targetCookies);<NEW_LINE>}<NEW_LINE>// Repeated cookies cannot exist in persistence<NEW_LINE>// targetCookies.remove(cookie)<NEW_LINE>targetCookies.add(cookie);<NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).split(SP_KEY_DELIMITER, 2); |
973,292 | private void generateInjectAdapter(TypeElement type, ExecutableElement constructor, List<Element> fields) throws IOException {<NEW_LINE>String packageName = getPackage(type).getQualifiedName().toString();<NEW_LINE>TypeMirror supertype = getApplicationSupertype(type);<NEW_LINE>if (supertype != null) {<NEW_LINE>supertype = processingEnv.getTypeUtils().erasure(supertype);<NEW_LINE>}<NEW_LINE>ClassName injectedClassName = ClassName.get(type);<NEW_LINE>ClassName adapterClassName = adapterName(injectedClassName, INJECT_ADAPTER_SUFFIX);<NEW_LINE>boolean isAbstract = type.<MASK><NEW_LINE>boolean injectMembers = !fields.isEmpty() || supertype != null;<NEW_LINE>boolean disambiguateFields = !fields.isEmpty() && (constructor != null) && !constructor.getParameters().isEmpty();<NEW_LINE>boolean dependent = injectMembers || ((constructor != null) && !constructor.getParameters().isEmpty());<NEW_LINE>TypeSpec.Builder result = TypeSpec.classBuilder(adapterClassName.simpleName()).addOriginatingElement(type).addModifiers(PUBLIC, FINAL).superclass(ParameterizedTypeName.get(ClassName.get(Binding.class), injectedClassName)).addJavadoc("$L", bindingTypeDocs(injectableType(type.asType()), isAbstract, injectMembers, dependent).toString());<NEW_LINE>for (Element field : fields) {<NEW_LINE>result.addField(memberBindingField(disambiguateFields, field));<NEW_LINE>}<NEW_LINE>if (constructor != null) {<NEW_LINE>for (VariableElement parameter : constructor.getParameters()) {<NEW_LINE>result.addField(parameterBindingField(disambiguateFields, parameter));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (supertype != null) {<NEW_LINE>result.addField(supertypeBindingField(supertype));<NEW_LINE>}<NEW_LINE>result.addMethod(writeInjectAdapterConstructor(constructor, type, injectedClassName));<NEW_LINE>if (dependent) {<NEW_LINE>result.addMethod(attachMethod(constructor, fields, disambiguateFields, injectedClassName, supertype, true));<NEW_LINE>result.addMethod(getDependenciesMethod(constructor, fields, disambiguateFields, supertype, true));<NEW_LINE>}<NEW_LINE>if (constructor != null) {<NEW_LINE>result.addMethod(getMethod(constructor, disambiguateFields, injectMembers, injectedClassName));<NEW_LINE>}<NEW_LINE>if (injectMembers) {<NEW_LINE>result.addMethod(membersInjectMethod(fields, disambiguateFields, injectedClassName, supertype));<NEW_LINE>}<NEW_LINE>JavaFile javaFile = JavaFile.builder(packageName, result.build()).addFileComment(AdapterJavadocs.GENERATED_BY_DAGGER).build();<NEW_LINE>javaFile.writeTo(processingEnv.getFiler());<NEW_LINE>} | getModifiers().contains(ABSTRACT); |
1,609,926 | @ApiOperation(value = "Create of update a Property", response = Response.class)<NEW_LINE>@Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@ApiResponses({ @ApiResponse(code = 201, message = "Property has been created"), @ApiResponse(code = 204, message = "No content, feature is updated") })<NEW_LINE>public Response upsertProperty(@Context HttpHeaders headers, @PathParam("name") String name, PropertyApiBean pApiBean) {<NEW_LINE>// Parameter validations<NEW_LINE>if ("".equals(name) || !name.equals(pApiBean.getName())) {<NEW_LINE>String errMsg = "Invalid identifier expected " + name;<NEW_LINE>return Response.status(Response.Status.BAD_REQUEST).<MASK><NEW_LINE>}<NEW_LINE>Property<?> property = pApiBean.asProperty();<NEW_LINE>// Update or create ?<NEW_LINE>if (!getPropertyStore().existProperty(property.getName())) {<NEW_LINE>getPropertyStore().createProperty(property);<NEW_LINE>String location = String.format("%s", uriInfo.getAbsolutePath().toString());<NEW_LINE>try {<NEW_LINE>return Response.created(new URI(location)).build();<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>return Response.status(Response.Status.CREATED).header(LOCATION, location).entity(name).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Create<NEW_LINE>getPropertyStore().updateProperty(property);<NEW_LINE>return Response.noContent().build();<NEW_LINE>} | entity(errMsg).build(); |
1,216,665 | public NodeOverrides unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>NodeOverrides nodeOverrides = new NodeOverrides();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("numNodes", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>nodeOverrides.setNumNodes(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nodePropertyOverrides", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>nodeOverrides.setNodePropertyOverrides(new ListUnmarshaller<NodePropertyOverride>(NodePropertyOverrideJsonUnmarshaller.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 nodeOverrides;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
307,127 | void parseBinary(int index, String[] args) {<NEW_LINE>boolean robust = true;<NEW_LINE>double size = 1;<NEW_LINE>int gridWidth = 4;<NEW_LINE>double borderWidth = 0.25;<NEW_LINE>for (; index < args.length; index++) {<NEW_LINE>String arg = args[index];<NEW_LINE>if (!arg.startsWith("--")) {<NEW_LINE>throw new RuntimeException("Expected flags for binary fiducial");<NEW_LINE>}<NEW_LINE>splitFlag(arg);<NEW_LINE>if (flagName.compareToIgnoreCase("Robust") == 0) {<NEW_LINE><MASK><NEW_LINE>} else if (flagName.compareToIgnoreCase("Size") == 0) {<NEW_LINE>size = Double.parseDouble(parameters);<NEW_LINE>} else if (flagName.compareToIgnoreCase("GridWidth") == 0) {<NEW_LINE>gridWidth = Integer.parseInt(parameters);<NEW_LINE>} else if (flagName.compareToIgnoreCase("Border") == 0) {<NEW_LINE>borderWidth = Double.parseDouble(parameters);<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Unknown image option " + flagName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("binary: robust = " + robust + " size = " + size + " grid width = " + gridWidth + " border = " + borderWidth);<NEW_LINE>ConfigFiducialBinary configFid = new ConfigFiducialBinary();<NEW_LINE>configFid.targetWidth = size;<NEW_LINE>configFid.gridWidth = gridWidth;<NEW_LINE>configFid.squareDetector.minimumRefineEdgeIntensity = 10;<NEW_LINE>configFid.borderWidthFraction = borderWidth;<NEW_LINE>ConfigThreshold configThreshold;<NEW_LINE>if (robust)<NEW_LINE>configThreshold = ConfigThreshold.local(ThresholdType.LOCAL_MEAN, 21);<NEW_LINE>else<NEW_LINE>configThreshold = ConfigThreshold.fixed(DEFAULT_THRESHOLD);<NEW_LINE>detector = FactoryFiducial.squareBinary(configFid, configThreshold, GrayU8.class);<NEW_LINE>} | robust = Boolean.parseBoolean(parameters); |
896,058 | private void spawnNewTracksForNewKeyFrame(List<Track> visibleTracks) {<NEW_LINE>// System.out.println("addNewTracks() current frame="+frameCurrent.id);<NEW_LINE>long frameID = tracker.getFrameID();<NEW_LINE>int totalRejected = 0;<NEW_LINE>tracker.spawnTracks();<NEW_LINE>List<PointTrack> spawned = tracker.getNewTracks(null);<NEW_LINE>// TODO make this optionally concurrent<NEW_LINE>// estimate 3D coordinate using stereo vision<NEW_LINE>for (PointTrack pt : spawned) {<NEW_LINE>// lint:forbidden ignore_line<NEW_LINE>// for (int i = 0; i < visibleTracks.size(); i++) {<NEW_LINE>// if( visibleTracks.get(i).visualTrack == t ) {<NEW_LINE>// throw new RuntimeException("Bug. Adding duplicate track: " + visibleTracks.get(i).id + " " + t.featureId);<NEW_LINE>// }<NEW_LINE>// }<NEW_LINE>// discard point if it can't localized<NEW_LINE>if (!pixelTo3D.process(pt.pixel.x, pt.pixel.y)) {<NEW_LINE>// System.out.println("Dropped pixelTo3D tt="+pt.featureId);<NEW_LINE>totalRejected++;<NEW_LINE>tracker.dropTrack(pt);<NEW_LINE>} else {<NEW_LINE>if (bundleViso.findByTrackerTrack(pt) != null) {<NEW_LINE>// Track btrack = scene.findByTrackerTrack(pt);<NEW_LINE>// System.out.println("BUG! Tracker recycled... bt="+btrack.id+" tt="+t.featureId);<NEW_LINE>throw new RuntimeException("BUG! Recycled tracker track too early tt=" + pt.featureId);<NEW_LINE>}<NEW_LINE>// Save the track's 3D location and add it to the current frame<NEW_LINE>Track btrack = bundleViso.addTrack(pixelTo3D.getX(), pixelTo3D.getY(), pixelTo3D.getZ(), pixelTo3D.getW());<NEW_LINE>btrack.lastUsed = frameID;<NEW_LINE>btrack.visualTrack = pt;<NEW_LINE>btrack.id = pt.featureId;<NEW_LINE>pt.cookie = btrack;<NEW_LINE>// System.out.println("new track bt="+btrack.id+" tt.id="+t.featureId);<NEW_LINE>// Convert the location from local coordinate system to world coordinates<NEW_LINE>SePointOps_F64.transform(frameCurrent.frame_to_world, <MASK><NEW_LINE>// keep the scale of floats manageable and normalize the vector to have a norm of 1<NEW_LINE>// Homogeneous coordinates so the distance is determined by the ratio of w and other elements<NEW_LINE>btrack.worldLoc.normalize();<NEW_LINE>bundleViso.addObservation(frameCurrent, btrack, pt.pixel.x, pt.pixel.y);<NEW_LINE>// for (int i = 0; i < visibleTracks.size(); i++) {<NEW_LINE>// if( visibleTracks.get(i).visualTrack == t )<NEW_LINE>// throw new RuntimeException("Bug. Adding duplicate track: "+t.featureId);<NEW_LINE>// }<NEW_LINE>visibleTracks.add(btrack);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.printf("spawn: new=%d rejected=%d\n", spawned.size() - totalRejected, totalRejected);<NEW_LINE>} | btrack.worldLoc, btrack.worldLoc); |
916,391 | public synchronized boolean remove(Object object) {<NEW_LINE>PropertyChangeEvent evt = new PropertyChangeEvent(defaultView, id, object, null);<NEW_LINE>boolean removed = false;<NEW_LINE>try {<NEW_LINE>ConfigView handler = ((ConfigView) Proxy.getInvocationHandler(object)).getMasterView();<NEW_LINE>for (int index = 0; index < proxied.size() && !removed; index++) {<NEW_LINE>Object target = proxied.get(index);<NEW_LINE>try {<NEW_LINE>ConfigView targetHandler = ((ConfigView) Proxy.getInvocationHandler(target)).getMasterView();<NEW_LINE>if (targetHandler == handler) {<NEW_LINE>removed = (proxied<MASK><NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>// ignore, this is a leaf<NEW_LINE>removed = proxied.remove(object);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>for (ConfigBeanInterceptor<?> interceptor : bean.getOptionalFeatures()) {<NEW_LINE>interceptor.beforeChange(evt);<NEW_LINE>}<NEW_LINE>} catch (PropertyVetoException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>changeEvents.add(evt);<NEW_LINE>return removed;<NEW_LINE>} | .remove(index) != null); |
1,643,114 | public static void main(String[] args) throws Exception {<NEW_LINE>WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();<NEW_LINE>MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();<NEW_LINE>// Setup FootnotesPart if necessary,<NEW_LINE>// along with DocumentSettings<NEW_LINE><MASK><NEW_LINE>if (footnotesPart == null) {<NEW_LINE>// that'll be the case in this example<NEW_LINE>// initialise it<NEW_LINE>footnotesPart = new FootnotesPart();<NEW_LINE>mdp.addTargetPart(footnotesPart);<NEW_LINE>CTFootnotes footnotes = (CTFootnotes) XmlUtils.unwrap(XmlUtils.unmarshalString(footnotePartXML));<NEW_LINE>footnotesPart.setJaxbElement(footnotes);<NEW_LINE>// Usually the settings part contains footnote properties;<NEW_LINE>// so add these if not present<NEW_LINE>DocumentSettingsPart dsp = mdp.getDocumentSettingsPart();<NEW_LINE>if (dsp == null) {<NEW_LINE>// create it<NEW_LINE>dsp = new DocumentSettingsPart();<NEW_LINE>mdp.addTargetPart(dsp);<NEW_LINE>}<NEW_LINE>CTSettings settings = dsp.getContents();<NEW_LINE>if (settings == null) {<NEW_LINE>settings = wmlObjectFactory.createCTSettings();<NEW_LINE>dsp.setJaxbElement(settings);<NEW_LINE>}<NEW_LINE>CTFtnDocProps ftndocprops = settings.getFootnotePr();<NEW_LINE>if (ftndocprops == null) {<NEW_LINE>String openXML = // these 2 numbers are special, and correspond with string footnotePartXML below<NEW_LINE>"<w:footnotePr xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">" + "<w:footnote w:id=\"-1\"/>" + "<w:footnote w:id=\"0\"/>" + "</w:footnotePr>";<NEW_LINE>settings.setFootnotePr((CTFtnDocProps) XmlUtils.unmarshalString(openXML, Context.jc, CTFtnDocProps.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Example<NEW_LINE>// Create and add p<NEW_LINE>org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory();<NEW_LINE>org.docx4j.wml.P p = factory.createP();<NEW_LINE>mdp.getContent().add(p);<NEW_LINE>// Add a run<NEW_LINE>R r = new R();<NEW_LINE>p.getContent().add(r);<NEW_LINE>org.docx4j.wml.Text t = factory.createText();<NEW_LINE>t.setValue("Hello world");<NEW_LINE>r.getContent().add(t);<NEW_LINE>// OK, add a footnote<NEW_LINE>addFootnote(1, "my footnote", footnotesPart, r);<NEW_LINE>// Note: your footnote ids must be distinct; they don't need to be ordered (though Word will do that when you open the docx)<NEW_LINE>// Save it<NEW_LINE>String filename = System.getProperty("user.dir") + "/OUT_FootnoteAdd.docx";<NEW_LINE>wordMLPackage.save(new java.io.File(filename));<NEW_LINE>System.out.println("Saved " + filename);<NEW_LINE>} | FootnotesPart footnotesPart = mdp.getFootnotesPart(); |
333,747 | Stateful doMultiNewKeyCached(SmallMap state, Object key, Object local_state, Object computation, @Cached("key") Object cachedNewKey, @Cached(value = "state.getKeys()", dimensions = 1) Object[] cachedOldKeys, @Cached("state.indexOf(key)") int index, @Cached(value = "buildNewKeys(cachedNewKey, cachedOldKeys)", dimensions = 1) Object[] newKeys) {<NEW_LINE>Object[] newValues = new Object[newKeys.length];<NEW_LINE>System.arraycopy(state.getValues(), 0, <MASK><NEW_LINE>newValues[0] = local_state;<NEW_LINE>SmallMap localStateMap = new SmallMap(newKeys, newValues);<NEW_LINE>Stateful res = thunkExecutorNode.executeThunk(computation, localStateMap, BaseNode.TailStatus.NOT_TAIL);<NEW_LINE>SmallMap resultStateMap = (SmallMap) res.getState();<NEW_LINE>Object[] resultValues = new Object[cachedOldKeys.length];<NEW_LINE>System.arraycopy(resultStateMap.getValues(), 1, resultValues, 0, cachedOldKeys.length);<NEW_LINE>return new Stateful(new SmallMap(cachedOldKeys, resultValues), res.getValue());<NEW_LINE>} | newValues, 1, cachedOldKeys.length); |
599,311 | private static Object convert(Object value, Type targetType, List<TypeValuePair> unresolvedValues, boolean allowAmbiguity, BTypedesc t) {<NEW_LINE>if (value == null) {<NEW_LINE>if (targetType.isNilable()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return createError(VALUE_LANG_LIB_CONVERSION_ERROR, BLangExceptionHelper.getErrorMessage(RuntimeErrors.CANNOT_CONVERT_NIL, targetType));<NEW_LINE>}<NEW_LINE>List<String> errors = new ArrayList<>();<NEW_LINE>Set<Type> convertibleTypes;<NEW_LINE>convertibleTypes = TypeConverter.getConvertibleTypes(value, targetType, null, false, new ArrayList<>(), errors, allowAmbiguity);<NEW_LINE>Type sourceType = TypeChecker.getType(value);<NEW_LINE>if (convertibleTypes.isEmpty()) {<NEW_LINE>throw CloneUtils.createConversionError(value, targetType, errors);<NEW_LINE>}<NEW_LINE>Type matchingType;<NEW_LINE>if (convertibleTypes.contains(sourceType)) {<NEW_LINE>matchingType = sourceType;<NEW_LINE>} else {<NEW_LINE>matchingType = convertibleTypes.iterator().next();<NEW_LINE>}<NEW_LINE>// handle primitive values<NEW_LINE>if (sourceType.getTag() <= TypeTags.BOOLEAN_TAG) {<NEW_LINE>if (TypeChecker.checkIsType(value, matchingType)) {<NEW_LINE>return value;<NEW_LINE>} else {<NEW_LINE>// Has to be a numeric conversion.<NEW_LINE>return TypeConverter.convertValues(matchingType, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return convert((BRefValue) <MASK><NEW_LINE>} | value, matchingType, unresolvedValues, t); |
1,280,424 | public synchronized void acquireReadLock() throws ConcurrencyException {<NEW_LINE>final Thread currentThread = Thread.currentThread();<NEW_LINE>final long whileStartTimeMillis = System.currentTimeMillis();<NEW_LINE>DeferredLockManager lockManager = getDeferredLockManager(currentThread);<NEW_LINE>ReadLockManager readLockManager = getReadLockManager(currentThread);<NEW_LINE>final boolean currentThreadWillEnterTheWhileWait = (this.activeThread != null) && (this.activeThread != currentThread);<NEW_LINE>if (currentThreadWillEnterTheWhileWait) {<NEW_LINE>putThreadAsWaitingToAcquireLockForReading(currentThread, ACQUIRE_READ_LOCK_METHOD_NAME);<NEW_LINE>}<NEW_LINE>// Cannot check for starving writers as will lead to deadlocks.<NEW_LINE>while ((this.activeThread != null) && (this.activeThread != Thread.currentThread())) {<NEW_LINE>try {<NEW_LINE>wait(ConcurrencyUtil.SINGLETON.getAcquireWaitTime());<NEW_LINE>ConcurrencyUtil.SINGLETON.determineIfReleaseDeferredLockAppearsToBeDeadLocked(this, whileStartTimeMillis, lockManager, readLockManager, <MASK><NEW_LINE>} catch (InterruptedException exception) {<NEW_LINE>releaseAllLocksAcquiredByThread(lockManager);<NEW_LINE>if (currentThreadWillEnterTheWhileWait) {<NEW_LINE>removeThreadNoLongerWaitingToAcquireLockForReading(currentThread);<NEW_LINE>}<NEW_LINE>throw ConcurrencyException.waitWasInterrupted(exception.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (currentThreadWillEnterTheWhileWait) {<NEW_LINE>removeThreadNoLongerWaitingToAcquireLockForReading(currentThread);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>addReadLockToReadLockManager();<NEW_LINE>} finally {<NEW_LINE>this.numberOfReaders.incrementAndGet();<NEW_LINE>this.totalNumberOfKeysAcquiredForReading.incrementAndGet();<NEW_LINE>}<NEW_LINE>} | ConcurrencyUtil.SINGLETON.isAllowInterruptedExceptionFired()); |
878,477 | private void parallelScan(Iterable<? extends Tree> expecteds, Iterable<? extends Tree> actuals) {<NEW_LINE>if (expecteds != null && actuals != null) {<NEW_LINE>Iterator<? extends Tree> expectedsIterator = expecteds.iterator();<NEW_LINE>Iterator<? extends Tree> actualsIterator = actuals.iterator();<NEW_LINE>while (expectedsIterator.hasNext() && actualsIterator.hasNext()) {<NEW_LINE>pushPathAndAccept(expectedsIterator.next(), actualsIterator.next());<NEW_LINE>}<NEW_LINE>if (!expectedsIterator.hasNext() && actualsIterator.hasNext()) {<NEW_LINE>diffBuilder.addExtraActualNode(actualPathPlus(actualsIterator.next()));<NEW_LINE>} else if (expectedsIterator.hasNext() && !actualsIterator.hasNext()) {<NEW_LINE>diffBuilder.addExtraExpectedNode(expectedPathPlus(expectedsIterator.next()));<NEW_LINE>}<NEW_LINE>} else if (expecteds == null && actuals != null && !isEmpty(actuals)) {<NEW_LINE>diffBuilder.addExtraActualNode(actualPathPlus(actuals.iterator().next()));<NEW_LINE>} else if (actuals == null && expecteds != null && !isEmpty(expecteds)) {<NEW_LINE>diffBuilder.addExtraExpectedNode(expectedPathPlus(expecteds.iterator<MASK><NEW_LINE>}<NEW_LINE>} | ().next())); |
1,327,919 | public static Map<String, String> createDetails(Exception exception) {<NEW_LINE>Map<String, String> details = new HashMap<>();<NEW_LINE>if (exception == null) {<NEW_LINE>return details;<NEW_LINE>}<NEW_LINE>FlutterFirebaseFirestoreException firestoreException = null;<NEW_LINE>if (exception instanceof FirebaseFirestoreException) {<NEW_LINE>firestoreException = new FlutterFirebaseFirestoreException((FirebaseFirestoreException) exception, exception.getCause());<NEW_LINE>} else if (exception.getCause() != null && exception.getCause() instanceof FirebaseFirestoreException) {<NEW_LINE>firestoreException = new FlutterFirebaseFirestoreException((FirebaseFirestoreException) exception.getCause(), exception.getCause().getCause() != null ? exception.getCause().getCause() : exception.getCause());<NEW_LINE>}<NEW_LINE>if (firestoreException != null) {<NEW_LINE>details.put("code", firestoreException.getCode());<NEW_LINE>details.put(<MASK><NEW_LINE>}<NEW_LINE>if (details.containsKey("code") && Objects.requireNonNull(details.get("code")).equals("unknown")) {<NEW_LINE>Log.e("FLTFirebaseFirestore", "An unknown error occurred", exception);<NEW_LINE>}<NEW_LINE>return details;<NEW_LINE>} | "message", firestoreException.getMessage()); |
501,641 | static void checkManifestPlatform(BuildContext buildContext, ContainerConfigurationTemplate containerConfig) {<NEW_LINE><MASK><NEW_LINE>Optional<Path> path = buildContext.getBaseImageConfiguration().getTarPath();<NEW_LINE>String baseImageName = path.map(Path::toString).orElse(buildContext.getBaseImageConfiguration().getImage().toString());<NEW_LINE>Set<Platform> platforms = buildContext.getContainerConfiguration().getPlatforms();<NEW_LINE>Verify.verify(!platforms.isEmpty());<NEW_LINE>if (platforms.size() != 1) {<NEW_LINE>eventHandlers.dispatch(LogEvent.warn("platforms configured, but '" + baseImageName + "' is not a manifest list"));<NEW_LINE>} else {<NEW_LINE>Platform platform = platforms.iterator().next();<NEW_LINE>if (!platform.getArchitecture().equals(containerConfig.getArchitecture()) || !platform.getOs().equals(containerConfig.getOs())) {<NEW_LINE>// Unfortunately, "platforms" has amd64/linux by default even if the user didn't explicitly<NEW_LINE>// configure it. Skip reporting to suppress false alarm.<NEW_LINE>if (!(platform.getArchitecture().equals("amd64") && platform.getOs().equals("linux"))) {<NEW_LINE>String warning = "the configured platform (%s/%s) doesn't match the platform (%s/%s) of the base " + "image (%s)";<NEW_LINE>eventHandlers.dispatch(LogEvent.warn(String.format(warning, platform.getArchitecture(), platform.getOs(), containerConfig.getArchitecture(), containerConfig.getOs(), baseImageName)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | EventHandlers eventHandlers = buildContext.getEventHandlers(); |
1,355,669 | public ListBotAliasesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListBotAliasesResult listBotAliasesResult = new ListBotAliasesResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listBotAliasesResult;<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("botAliasSummaries", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listBotAliasesResult.setBotAliasSummaries(new ListUnmarshaller<BotAliasSummary>(BotAliasSummaryJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listBotAliasesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("botId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listBotAliasesResult.setBotId(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 listBotAliasesResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,408,396 | final BatchExecuteStatementResult executeBatchExecuteStatement(BatchExecuteStatementRequest batchExecuteStatementRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchExecuteStatementRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchExecuteStatementRequest> request = null;<NEW_LINE>Response<BatchExecuteStatementResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchExecuteStatementRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchExecuteStatementRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DynamoDB");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchExecuteStatement");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchExecuteStatementResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchExecuteStatementResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,424,860 | final CreateMeetingDialOutResult executeCreateMeetingDialOut(CreateMeetingDialOutRequest createMeetingDialOutRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createMeetingDialOutRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateMeetingDialOutRequest> request = null;<NEW_LINE>Response<CreateMeetingDialOutResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateMeetingDialOutRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createMeetingDialOutRequest));<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, "Chime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateMeetingDialOut");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateMeetingDialOutResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateMeetingDialOutResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
280,023 | public ContinuousBackupsDescription unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ContinuousBackupsDescription continuousBackupsDescription = new ContinuousBackupsDescription();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ContinuousBackupsStatus", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>continuousBackupsDescription.setContinuousBackupsStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("PointInTimeRecoveryDescription", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>continuousBackupsDescription.setPointInTimeRecoveryDescription(PointInTimeRecoveryDescriptionJsonUnmarshaller.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 continuousBackupsDescription;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,561,701 | public void readFromNBT(NBTTagCompound nbt) {<NEW_LINE>super.readFromNBT(nbt);<NEW_LINE>glassColor = nbt.hasKey("stainedColor") ? nbt.getByte("stainedColor") : -1;<NEW_LINE>redstoneInput = 0;<NEW_LINE>for (int i = 0; i < EnumFacing.VALUES.length; i++) {<NEW_LINE>final String key = "redstoneInputSide[" + i + "]";<NEW_LINE>if (nbt.hasKey(key)) {<NEW_LINE>redstoneInputSide[i] = nbt.getByte(key);<NEW_LINE>if (redstoneInputSide[i] > redstoneInput) {<NEW_LINE>redstoneInput = redstoneInputSide[i];<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>redstoneInputSide[i] = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (nbt.hasKey("pipeId", Constants.NBT.TAG_STRING)) {<NEW_LINE>coreState.pipeId = nbt.getString("pipeId");<NEW_LINE>}<NEW_LINE>if (nbt.hasKey("pipeId", Constants.NBT.TAG_ANY_NUMERIC)) {<NEW_LINE>int id = nbt.getInteger("pipeId");<NEW_LINE>Item item = Item.REGISTRY.getObjectById(id);<NEW_LINE>ResourceLocation loc = Item.REGISTRY.getNameForObject(item);<NEW_LINE>if (loc == null)<NEW_LINE>coreState.pipeId = "";<NEW_LINE>else<NEW_LINE>coreState.pipeId = loc.toString();<NEW_LINE>}<NEW_LINE>if (!StringUtils.isNullOrEmpty(coreState.pipeId)) {<NEW_LINE>Item item = Item.REGISTRY.getObject(new ResourceLocation(coreState.pipeId));<NEW_LINE>if (item instanceof ItemPipe) {<NEW_LINE>pipe = BlockGenericPipe.createPipe((ItemPipe) item);<NEW_LINE>} else {<NEW_LINE>BCLog.logger.warn(<MASK><NEW_LINE>pipe = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bindPipe();<NEW_LINE>if (pipe != null) {<NEW_LINE>pipe.readFromNBT(nbt);<NEW_LINE>} else {<NEW_LINE>BCLog.logger.log(Level.WARN, "Pipe failed to load from NBT at " + getPos());<NEW_LINE>deletePipe = true;<NEW_LINE>}<NEW_LINE>sideProperties.readFromNBT(nbt);<NEW_LINE>attachPluggables = true;<NEW_LINE>} | item + " was not an instanceof ItemPipe!" + coreState.pipeId); |
776,427 | public Statement apply(final Statement base, final Description description) {<NEW_LINE>return new Statement() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void evaluate() throws Throwable {<NEW_LINE>PactVerifications pactVerifications = description.getAnnotation(PactVerifications.class);<NEW_LINE>if (pactVerifications != null) {<NEW_LINE>evaluatePactVerifications(pactVerifications, base);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PactVerification pactDef = <MASK><NEW_LINE>// no pactVerification? execute the test normally<NEW_LINE>if (pactDef == null) {<NEW_LINE>base.evaluate();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, BasePact> pacts = getPacts(pactDef.fragment());<NEW_LINE>Optional<BasePact> pact;<NEW_LINE>if (pactDef.value().length == 1 && StringUtils.isEmpty(pactDef.value()[0])) {<NEW_LINE>pact = pacts.values().stream().findFirst();<NEW_LINE>} else {<NEW_LINE>pact = Arrays.stream(pactDef.value()).map(pacts::get).filter(Objects::nonNull).findFirst();<NEW_LINE>}<NEW_LINE>if (pact.isEmpty()) {<NEW_LINE>base.evaluate();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (config.getPactVersion() == PactSpecVersion.V4) {<NEW_LINE>pact.get().asV4Pact().component1().getInteractions().forEach(i -> i.getComments().put("testname", Json.toJson(description.getDisplayName())));<NEW_LINE>}<NEW_LINE>PactFolder pactFolder = target.getClass().getAnnotation(PactFolder.class);<NEW_LINE>PactDirectory pactDirectory = target.getClass().getAnnotation(PactDirectory.class);<NEW_LINE>BasePact basePact = pact.get();<NEW_LINE>Metrics.INSTANCE.sendMetrics(new MetricEvent.ConsumerTestRun(basePact.getInteractions().size(), "junit"));<NEW_LINE>PactVerificationResult result = runPactTest(base, basePact, pactFolder, pactDirectory);<NEW_LINE>validateResult(result, pactDef);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | description.getAnnotation(PactVerification.class); |
289,204 | private synchronized V _put(int key, V value, MODE m) {<NEW_LINE>IntKeyLinkedEntry[] tab = table;<NEW_LINE>int index = hash(key) % tab.length;<NEW_LINE>for (IntKeyLinkedEntry<V> e = tab[index]; e != null; e = e.next) {<NEW_LINE>if (CompareUtil.equals(e.key, key)) {<NEW_LINE>V old = e.value;<NEW_LINE>e.value = value;<NEW_LINE>switch(m) {<NEW_LINE>case FORCE_FIRST:<NEW_LINE>if (header.link_next != e) {<NEW_LINE>unchain(e);<NEW_LINE>chain(header, header.link_next, e);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case FORCE_LAST:<NEW_LINE>if (header.link_prev != e) {<NEW_LINE>unchain(e);<NEW_LINE>chain(header.link_prev, header, e);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return old;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (max > 0) {<NEW_LINE>switch(m) {<NEW_LINE>case FORCE_FIRST:<NEW_LINE>case FIRST:<NEW_LINE>while (count >= max) {<NEW_LINE>// removeLast();<NEW_LINE>int k = header.link_prev.key;<NEW_LINE>V v = remove(k);<NEW_LINE>overflowed(k, v);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case FORCE_LAST:<NEW_LINE>case LAST:<NEW_LINE>while (count >= max) {<NEW_LINE>// removeFirst();<NEW_LINE>int k = header.link_next.key;<NEW_LINE>V v = remove(k);<NEW_LINE>overflowed(k, v);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (count >= threshold) {<NEW_LINE>rehash();<NEW_LINE>tab = table;<NEW_LINE>index = hash(key) % tab.length;<NEW_LINE>}<NEW_LINE>IntKeyLinkedEntry<V> e = new IntKeyLinkedEntry<V>(key, value, tab[index]);<NEW_LINE>tab[index] = e;<NEW_LINE>switch(m) {<NEW_LINE>case FORCE_FIRST:<NEW_LINE>case FIRST:<NEW_LINE>chain(<MASK><NEW_LINE>break;<NEW_LINE>case FORCE_LAST:<NEW_LINE>case LAST:<NEW_LINE>chain(header.link_prev, header, e);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>count++;<NEW_LINE>return null;<NEW_LINE>} | header, header.link_next, e); |
156,147 | public synchronized void open() throws MonopriceAudioException {<NEW_LINE>logger.debug("Opening serial connection on port {}", serialPortName);<NEW_LINE>try {<NEW_LINE>SerialPortIdentifier portIdentifier = serialPortManager.getIdentifier(serialPortName);<NEW_LINE>if (portIdentifier == null) {<NEW_LINE>setConnected(false);<NEW_LINE>throw new MonopriceAudioException("Opening serial connection failed: No Such Port");<NEW_LINE>}<NEW_LINE>SerialPort commPort = portIdentifier.open(this.getClass().getName(), 2000);<NEW_LINE>commPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);<NEW_LINE>commPort.enableReceiveThreshold(1);<NEW_LINE>commPort.enableReceiveTimeout(100);<NEW_LINE>commPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);<NEW_LINE>InputStream dataIn = commPort.getInputStream();<NEW_LINE>OutputStream dataOut = commPort.getOutputStream();<NEW_LINE>if (dataOut != null) {<NEW_LINE>dataOut.flush();<NEW_LINE>}<NEW_LINE>if (dataIn != null && dataIn.markSupported()) {<NEW_LINE>try {<NEW_LINE>dataIn.reset();<NEW_LINE>} catch (IOException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Thread thread = new MonopriceAudioReaderThread(this, this.uid, this.serialPortName);<NEW_LINE>setReaderThread(thread);<NEW_LINE>thread.start();<NEW_LINE>this.serialPort = commPort;<NEW_LINE>this.dataIn = dataIn;<NEW_LINE>this.dataOut = dataOut;<NEW_LINE>setConnected(true);<NEW_LINE>logger.debug("Serial connection opened");<NEW_LINE>} catch (PortInUseException e) {<NEW_LINE>setConnected(false);<NEW_LINE>throw new MonopriceAudioException("Opening serial connection failed: Port in Use Exception", e);<NEW_LINE>} catch (UnsupportedCommOperationException e) {<NEW_LINE>setConnected(false);<NEW_LINE>throw new MonopriceAudioException("Opening serial connection failed: Unsupported Comm Operation Exception", e);<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>setConnected(false);<NEW_LINE>throw new MonopriceAudioException("Opening serial connection failed: Unsupported Encoding Exception", e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>setConnected(false);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new MonopriceAudioException("Opening serial connection failed: IO Exception", e); |
529,603 | private void unpack1(long[] buffer, int offset, int len, InputStream input) throws IOException {<NEW_LINE>if (len != 0 && len < 8) {<NEW_LINE>unpack1Unaligned(buffer, offset, len, input.read());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int blockReadableBytes = (len + 7) / 8;<NEW_LINE>for (int i = 0; i < blockReadableBytes; ) {<NEW_LINE>i += input.read(tmp, i, blockReadableBytes - i);<NEW_LINE>}<NEW_LINE>int outputIndex = offset;<NEW_LINE>int end = offset + len;<NEW_LINE>int tmpIndex = 0;<NEW_LINE>for (; outputIndex + 7 < end; outputIndex += 8) {<NEW_LINE>long value;<NEW_LINE>value = tmp[tmpIndex];<NEW_LINE>tmpIndex++;<NEW_LINE>buffer[outputIndex] = (0b1000_0000 & value) >>> 7;<NEW_LINE>buffer[outputIndex + 1] = (0b0100_0000 & value) >>> 6;<NEW_LINE>buffer[outputIndex + 2] = (0b0010_0000 & value) >>> 5;<NEW_LINE>buffer[outputIndex + 3] = (0b0001_0000 & value) >>> 4;<NEW_LINE>buffer[outputIndex + 4] = (0b0000_1000 & value) >>> 3;<NEW_LINE>buffer[outputIndex + 5] = (<MASK><NEW_LINE>buffer[outputIndex + 6] = (0b0000_0010 & value) >>> 1;<NEW_LINE>buffer[outputIndex + 7] = 0b0000_0001 & value;<NEW_LINE>}<NEW_LINE>// Get the last byte and decode it, if necessary<NEW_LINE>if (outputIndex < end) {<NEW_LINE>unpack1Unaligned(buffer, outputIndex, end - outputIndex, tmp[blockReadableBytes - 1]);<NEW_LINE>}<NEW_LINE>} | 0b0000_0100 & value) >>> 2; |
630,186 | private GtasksTaskContainer parseRemoteTask(com.google.api.services.tasks.model.Task remoteTask, String listId) {<NEW_LINE>Task task = new Task();<NEW_LINE>ArrayList<Metadata> metadata = new ArrayList<Metadata>();<NEW_LINE>task.setValue(Task.TITLE, remoteTask.getTitle());<NEW_LINE>task.setValue(Task.CREATION_DATE, DateUtilities.now());<NEW_LINE>task.setValue(Task.COMPLETION_DATE, GtasksApiUtilities.gtasksCompletedTimeToUnixTime(remoteTask.getCompleted(), 0));<NEW_LINE>if (remoteTask.getDeleted() == null || !remoteTask.getDeleted().booleanValue())<NEW_LINE>task.setValue(Task.DELETION_DATE, 0L);<NEW_LINE>else if (remoteTask.getDeleted().booleanValue())<NEW_LINE>task.setValue(Task.DELETION_DATE, DateUtilities.now());<NEW_LINE>if (remoteTask.getHidden() != null && remoteTask.getHidden().booleanValue())<NEW_LINE>task.setValue(Task.DELETION_DATE, DateUtilities.now());<NEW_LINE>long dueDate = GtasksApiUtilities.gtasksDueTimeToUnixTime(remoteTask.getDue(), 0);<NEW_LINE>long createdDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, dueDate);<NEW_LINE>task.setValue(Task.DUE_DATE, createdDate);<NEW_LINE>task.setValue(Task.NOTES, remoteTask.getNotes());<NEW_LINE>Metadata gtasksMetadata = GtasksMetadata.createEmptyMetadata(AbstractModel.NO_ID);<NEW_LINE>gtasksMetadata.setValue(GtasksMetadata.ID, remoteTask.getId());<NEW_LINE>gtasksMetadata.setValue(GtasksMetadata.LIST_ID, listId);<NEW_LINE>GtasksTaskContainer container = new <MASK><NEW_LINE>return container;<NEW_LINE>} | GtasksTaskContainer(task, metadata, gtasksMetadata); |
39,011 | public SubjectAreaOMASAPIResponse<Category> updateCategory(String serverName, String userId, String guid, Category category, boolean isReplace) {<NEW_LINE>final String methodName = "updateCategory";<NEW_LINE>RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName);<NEW_LINE>SubjectAreaOMASAPIResponse<Category> response = new SubjectAreaOMASAPIResponse<>();<NEW_LINE>AuditLog auditLog = null;<NEW_LINE>// should not be called without a supplied category - the calling layer should not allow this.<NEW_LINE>try {<NEW_LINE>auditLog = instanceHandler.getAuditLog(userId, serverName, methodName);<NEW_LINE>SubjectAreaNodeClients clients = instanceHandler.getSubjectAreaNodeClients(serverName, userId, methodName);<NEW_LINE>Category updatedCategory;<NEW_LINE>if (isReplace) {<NEW_LINE>updatedCategory = clients.categories().replace(userId, guid, category);<NEW_LINE>} else {<NEW_LINE>updatedCategory = clients.categories().update(userId, guid, category);<NEW_LINE>}<NEW_LINE>response.addResult(updatedCategory);<NEW_LINE>} catch (Exception exception) {<NEW_LINE>response = getResponseForException(<MASK><NEW_LINE>}<NEW_LINE>restCallLogger.logRESTCallReturn(token, response.toString());<NEW_LINE>return response;<NEW_LINE>} | exception, auditLog, className, methodName); |
1,356,994 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>log.info("From " + request.getRemoteHost() + " - " + request.getRemoteAddr());<NEW_LINE>Properties ctx = JSPEnv.getCtx(request);<NEW_LINE>HttpSession session = request.getSession(true);<NEW_LINE>// WEnv.dump(session);<NEW_LINE>// WEnv.dump(request);<NEW_LINE>int AD_Issue_ID = WebUtil.getParameterAsInt(request, "RECORDID");<NEW_LINE>String DBAddress = WebUtil.getParameter(request, "DBADDRESS");<NEW_LINE>String Comments = WebUtil.getParameter(request, "COMMENTS");<NEW_LINE>String IssueString = WebUtil.getParameter(request, "ISSUE");<NEW_LINE>//<NEW_LINE>StringBuffer responseText = new StringBuffer("Adempiere Support - ").append(new Date().toString()).append("\n");<NEW_LINE>MIssue issue = null;<NEW_LINE>if (AD_Issue_ID != 0) {<NEW_LINE>issue = new MIssue(ctx, AD_Issue_ID, null);<NEW_LINE>if (issue.get_ID() != AD_Issue_ID)<NEW_LINE>responseText.append("Issue Unknown - Request Ignored");<NEW_LINE>else if (!issue.getDBAddress().equals(DBAddress))<NEW_LINE>responseText.append("Not Issue Owner - Request Ignored");<NEW_LINE>else {<NEW_LINE>issue.addComments(Comments);<NEW_LINE>responseText.append(issue.createAnswer());<NEW_LINE>}<NEW_LINE>} else if (IssueString == null || IssueString.length() == 0) {<NEW_LINE>responseText.append("Unknown Request");<NEW_LINE>} else {<NEW_LINE>issue = MIssue.create(ctx, IssueString);<NEW_LINE>if (issue == null || !issue.save())<NEW_LINE>responseText.append("Could not save Issue");<NEW_LINE>else<NEW_LINE>responseText.append(issue.process());<NEW_LINE>}<NEW_LINE>//<NEW_LINE>StringBuffer answer = new StringBuffer();<NEW_LINE>if (issue != null && issue.get_ID() != 0) {<NEW_LINE>answer.append("RECORDID=").append(issue.get_ID()).append(MIssue.DELIMITER);<NEW_LINE>// answer.append("DOCUMENTNO=").append(".")<NEW_LINE>// .append(MIssue.DELIMITER);<NEW_LINE>}<NEW_LINE>answer.append("RESPONSE=").append(responseText);<NEW_LINE>//<NEW_LINE>response.setHeader("Cache-Control", "no-cache");<NEW_LINE>response.setContentType("text/html; charset=UTF-8");<NEW_LINE>// with character encoding support<NEW_LINE>PrintWriter out = response.getWriter();<NEW_LINE>out.write(URLEncoder.encode(answer<MASK><NEW_LINE>out.flush();<NEW_LINE>if (out.checkError())<NEW_LINE>log.log(Level.SEVERE, "error writing");<NEW_LINE>out.close();<NEW_LINE>} | .toString(), "UTF-8")); |
1,534,730 | private void jumpToOutlineInEditor(FlutterOutline outline, boolean focusEditor) {<NEW_LINE>if (outline == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int offset = outline.getDartElement() != null ? outline.getDartElement().getLocation().getOffset() : outline.getOffset();<NEW_LINE>final int editorOffset = getOutlineOffsetConverter().getConvertedFileOffset(offset);<NEW_LINE>sendAnalyticEvent("jumpToSource");<NEW_LINE>if (currentFile != null) {<NEW_LINE>currentEditor.<MASK><NEW_LINE>try {<NEW_LINE>new OpenFileDescriptor(project, currentFile.getValue(), editorOffset).navigate(focusEditor);<NEW_LINE>} finally {<NEW_LINE>currentEditor.getCaretModel().addCaretListener(caretListener);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO(jacobr): refactor the previewArea to listen on the stream of<NEW_LINE>// selected outlines instead.<NEW_LINE>if (previewArea != null) {<NEW_LINE>previewArea.select(ImmutableList.of(outline), currentEditor);<NEW_LINE>}<NEW_LINE>} | getCaretModel().removeCaretListener(caretListener); |
374,980 | public void draw(Canvas canvas) {<NEW_LINE>boolean done = true;<NEW_LINE>float ratio;<NEW_LINE>switch(mTransitionState) {<NEW_LINE>case TRANSITION_STARTING:<NEW_LINE>// initialize start alphas and start time<NEW_LINE>System.arraycopy(mAlphas, 0, mStartAlphas, 0, mLayers.length);<NEW_LINE>mStartTimeMs = getCurrentTimeMs();<NEW_LINE>// if the duration is 0, update alphas to the target opacities immediately<NEW_LINE>ratio = (<MASK><NEW_LINE>// if all the layers have reached their target opacity, transition is done<NEW_LINE>done = updateAlphas(ratio);<NEW_LINE>maybeOnFadeStarted();<NEW_LINE>mTransitionState = done ? TRANSITION_NONE : TRANSITION_RUNNING;<NEW_LINE>break;<NEW_LINE>case TRANSITION_RUNNING:<NEW_LINE>Preconditions.checkState(mDurationMs > 0);<NEW_LINE>// determine ratio based on the elapsed time<NEW_LINE>ratio = (float) (getCurrentTimeMs() - mStartTimeMs) / mDurationMs;<NEW_LINE>// if all the layers have reached their target opacity, transition is done<NEW_LINE>done = updateAlphas(ratio);<NEW_LINE>mTransitionState = done ? TRANSITION_NONE : TRANSITION_RUNNING;<NEW_LINE>break;<NEW_LINE>case TRANSITION_NONE:<NEW_LINE>// there is no transition in progress and mAlphas should be left as is.<NEW_LINE>done = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < mLayers.length; i++) {<NEW_LINE>drawDrawableWithAlpha(canvas, mLayers[i], (int) Math.ceil(mAlphas[i] * mAlpha / 255.0));<NEW_LINE>}<NEW_LINE>if (done) {<NEW_LINE>maybeOnFadeFinished();<NEW_LINE>maybeOnImageShownImmediately();<NEW_LINE>} else {<NEW_LINE>invalidateSelf();<NEW_LINE>}<NEW_LINE>} | mDurationMs == 0) ? 1.0f : 0.0f; |
42,097 | protected Pair<INDArray, INDArray> preOutput(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) {<NEW_LINE>assertInputSet(false);<NEW_LINE>INDArray input = this.input.castTo(dataType);<NEW_LINE>if (layerConf().getRnnDataFormat() == RNNFormat.NWC) {<NEW_LINE>if (input.rank() == 3)<NEW_LINE>// NHWC to NCHW<NEW_LINE>input = input.permute(0, 2, 1);<NEW_LINE>else if (input.rank() == 4) {<NEW_LINE>// NHWC to NCHW<NEW_LINE>input = input.permute(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>org.deeplearning4j.nn.conf.layers.Convolution1DLayer c = layerConf();<NEW_LINE>Conv1DConfig conf = Conv1DConfig.builder().k(c.getKernelSize()[0]).s(c.getStride()[0]).d(c.getDilation()[0]).p(c.getPadding()[0]).dataFormat(Conv1DConfig.NCW).paddingMode(ConvolutionUtils.paddingModeForConvolutionMode(convolutionMode)).build();<NEW_LINE>INDArray w = Convolution1DUtils.reshapeWeightArrayOrGradientForFormat(getParam(ConvolutionParamInitializer.WEIGHT_KEY), RNNFormat.NCW);<NEW_LINE>INDArray[] inputs;<NEW_LINE>if (layerConf().hasBias()) {<NEW_LINE>INDArray b = getParam(ConvolutionParamInitializer.BIAS_KEY);<NEW_LINE>b = b.reshape(b.length());<NEW_LINE>inputs = new INDArray[] { input, w, b };<NEW_LINE>} else {<NEW_LINE>inputs = new INDArray[] { input, w };<NEW_LINE>}<NEW_LINE>Conv1D op = new Conv1D(inputs, null, conf);<NEW_LINE>List<LongShapeDescriptor> outShape = op.calculateOutputShape();<NEW_LINE>op.setOutputArgument(0, Nd4j.create(outShape.get(0), false));<NEW_LINE>Nd4j.exec(op);<NEW_LINE>INDArray output = op.getOutputArgument(0);<NEW_LINE>if (getRnnDataFormat() == RNNFormat.NWC) {<NEW_LINE>output = output.permute(0, 2, 1);<NEW_LINE>}<NEW_LINE>return new Pair<>(output, null);<NEW_LINE>} | 0, 2, 3, 1); |
212,951 | private Mono<Response<Void>> stopNetworkTraceSlotWithResponseAsync(String resourceGroupName, String name, String slot, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (slot == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter slot is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.stopNetworkTraceSlot(this.client.getEndpoint(), resourceGroupName, name, slot, this.client.getSubscriptionId(), this.client.getApiVersion(), context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter name is required and cannot be null.")); |
171,976 | private void processLevel(final int currentLevel) {<NEW_LINE>final int fromLayerIndex = flat.getLayerIndex()[currentLevel + 1];<NEW_LINE>final int toLayerIndex = flat.getLayerIndex()[currentLevel];<NEW_LINE>final int fromLayerSize = flat.getLayerCounts()[currentLevel + 1];<NEW_LINE>final int toLayerSize = flat.getLayerFeedCounts()[currentLevel];<NEW_LINE>double dropoutRate = 0;<NEW_LINE>final int index = this.flat.getWeightIndex()[currentLevel];<NEW_LINE>final ActivationFunction activation = this.<MASK><NEW_LINE>// handle weights<NEW_LINE>// array references are made method local to avoid one indirection<NEW_LINE>final double[] layerDelta = this.layerDelta;<NEW_LINE>final double[] weights = this.flat.getWeights();<NEW_LINE>final double[] gradients = this.gradients;<NEW_LINE>final double[] layerOutput = this.flat.getLayerOutput();<NEW_LINE>final double[] layerSums = this.flat.getLayerSums();<NEW_LINE>int yi = fromLayerIndex;<NEW_LINE>for (int y = 0; y < fromLayerSize; y++) {<NEW_LINE>final double output = layerOutput[yi];<NEW_LINE>double sum = 0;<NEW_LINE>int wi = index + y;<NEW_LINE>final int loopEnd = toLayerIndex + toLayerSize;<NEW_LINE>for (int xi = toLayerIndex; xi < loopEnd; xi++, wi += fromLayerSize) {<NEW_LINE>gradients[wi] += output * layerDelta[xi];<NEW_LINE>sum += weights[wi] * layerDelta[xi];<NEW_LINE>}<NEW_LINE>layerDelta[yi] = sum * (activation.derivativeFunction(layerSums[yi], layerOutput[yi]));<NEW_LINE>yi++;<NEW_LINE>}<NEW_LINE>} | flat.getActivationFunctions()[currentLevel]; |
1,734,383 | protected boolean isAlreadyDemangled(Program program, Address address) {<NEW_LINE>String symbolName = ensureNameLength(name);<NEW_LINE>if (address.isExternalAddress()) {<NEW_LINE>Symbol extSymbol = program.getSymbolTable().getPrimarySymbol(address);<NEW_LINE>if (extSymbol == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>ExternalLocation extLoc = program.getExternalManager().getExternalLocation(extSymbol);<NEW_LINE>return extLoc.getOriginalImportedName() != null;<NEW_LINE>}<NEW_LINE>Symbol[] symbols = program.<MASK><NEW_LINE>for (Symbol symbol : symbols) {<NEW_LINE>if (symbol.getName().equals(symbolName) && !symbol.getParentNamespace().isGlobal()) {<NEW_LINE>SymbolType symbolType = symbol.getSymbolType();<NEW_LINE>if (symbolType == SymbolType.LABEL || symbolType == SymbolType.FUNCTION) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getSymbolTable().getSymbols(address); |
1,694,654 | public Answer handleConfigDriveIso(HandleConfigDriveIsoCommand cmd) {<NEW_LINE>TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);<NEW_LINE>MockSecStorageVO sec;<NEW_LINE>try {<NEW_LINE>txn.start();<NEW_LINE>sec = _mockSecStorageDao.findByUrl(cmd.getDestStore().getUrl());<NEW_LINE>if (sec == null) {<NEW_LINE>return new Answer(cmd, false, "can't find secondary storage");<NEW_LINE>}<NEW_LINE>txn.commit();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>txn.rollback();<NEW_LINE>throw new CloudRuntimeException("Error when creating config drive.");<NEW_LINE>} finally {<NEW_LINE>txn.close();<NEW_LINE>txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);<NEW_LINE>txn.close();<NEW_LINE>}<NEW_LINE>MockVolumeVO template = new MockVolumeVO();<NEW_LINE>String uuid = UUID.randomUUID().toString();<NEW_LINE>template.setName(uuid);<NEW_LINE>template.setPath(sec.getMountPoint() + cmd.getIsoFile());<NEW_LINE>template.setPoolId(sec.getId());<NEW_LINE>template.setSize((long) (Math.random() * 200L) + 200L);<NEW_LINE>template.setStatus(Status.DOWNLOADED);<NEW_LINE>template.setType(MockVolumeType.ISO);<NEW_LINE>txn = <MASK><NEW_LINE>try {<NEW_LINE>txn.start();<NEW_LINE>template = _mockVolumeDao.persist(template);<NEW_LINE>txn.commit();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>txn.rollback();<NEW_LINE>throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting config drive " + template.getName(), ex);<NEW_LINE>} finally {<NEW_LINE>txn.close();<NEW_LINE>txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);<NEW_LINE>txn.close();<NEW_LINE>}<NEW_LINE>return new Answer(cmd);<NEW_LINE>} | TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB); |
764,467 | final ListReviewableHITsResult executeListReviewableHITs(ListReviewableHITsRequest listReviewableHITsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listReviewableHITsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListReviewableHITsRequest> request = null;<NEW_LINE>Response<ListReviewableHITsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListReviewableHITsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listReviewableHITsRequest));<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, "MTurk");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListReviewableHITs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListReviewableHITsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListReviewableHITsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
964,818 | public static ErrorDescription run(HintContext ctx) {<NEW_LINE>TreePath tp = ctx.getPath();<NEW_LINE>EnhancedForLoopTree efl = (EnhancedForLoopTree) tp.getLeaf();<NEW_LINE>long statementStart = ctx.getInfo().getTrees().getSourcePositions().getStartPosition(ctx.getInfo().getCompilationUnit(), efl.getStatement());<NEW_LINE>int caret = ctx.getCaretLocation();<NEW_LINE>if (caret >= statementStart) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TypeMirror expressionType = ctx.getInfo().getTrees().getTypeMirror(new TreePath(tp, efl.getExpression()));<NEW_LINE>if (expressionType == null || expressionType.getKind() != TypeKind.DECLARED) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ExecutableElement iterator = findIterable(ctx.getInfo());<NEW_LINE>Types t = ctx.getInfo().getTypes();<NEW_LINE>if (iterator == null || !t.isSubtype(((DeclaredType) expressionType), t.erasure(iterator.getEnclosingElement().asType()))) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>FixImpl fix = new FixImpl(TreePathHandle.create(tp, ctx.getInfo()));<NEW_LINE>List<Fix> fixes = Collections.<Fix><MASK><NEW_LINE>return ErrorDescriptionFactory.createErrorDescription(ctx.getSeverity(), NbBundle.getMessage(ExpandEnhancedForLoop.class, "ERR_ExpandEhancedForLoop"), fixes, ctx.getInfo().getFileObject(), caret, caret);<NEW_LINE>} | singletonList(fix.toEditorFix()); |
626,882 | private int modifyDB(final String preparedStatement, final Integer[] params, final String trxName) {<NEW_LINE>ResultSet rs = null;<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(preparedStatement, trxName);<NEW_LINE>if (preparedStatement == SQL_INSERT_NODE) {<NEW_LINE>setIntOrNull(pstmt, 1, params[0]);<NEW_LINE>setIntOrNull(pstmt, 2, params[1]);<NEW_LINE>setIntOrNull(pstmt<MASK><NEW_LINE>} else if (preparedStatement == SQL_UPDATE_PARENTS || preparedStatement == SQL_UPDATE_PARENT || preparedStatement == SQL_UPDATE_SEQNO) {<NEW_LINE>setIntOrNull(pstmt, 1, params[0]);<NEW_LINE>setIntOrNull(pstmt, 2, params[1]);<NEW_LINE>} else if (preparedStatement == SQL_DELETE_NODE) {<NEW_LINE>pstmt.setInt(1, params[0]);<NEW_LINE>}<NEW_LINE>return pstmt.executeUpdate();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>MetasfreshLastError.saveError(logger, "Unable to modify table ad_treenodepc. SQL statement: " + preparedStatement, e);<NEW_LINE>return 0;<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>}<NEW_LINE>} | , 3, params[2]); |
1,622,219 | public String createFolder(final String repositoryId, final Properties properties, final String folderId, final List<String> policies, final Acl addAces, final Acl removeAces, final ExtensionsData extension) {<NEW_LINE>final App app = StructrApp.getInstance(securityContext);<NEW_LINE>String uuid = null;<NEW_LINE>try (final Tx tx = app.tx()) {<NEW_LINE>final String objectTypeId = getStringValue(properties, PropertyIds.OBJECT_TYPE_ID);<NEW_LINE>final Class type = typeFromObjectTypeId(objectTypeId, BaseTypeId.CMIS_FOLDER, Folder.class);<NEW_LINE>// check if type exists<NEW_LINE>if (type != null) {<NEW_LINE>// check that base type is cmis:folder<NEW_LINE>final BaseTypeId baseTypeId = getBaseTypeId(type);<NEW_LINE>if (baseTypeId != null && BaseTypeId.CMIS_FOLDER.equals(baseTypeId)) {<NEW_LINE>// create folder<NEW_LINE>final AbstractFile newFolder = (AbstractFile) app.create(type, PropertyMap.cmisTypeToJavaType(securityContext, type, properties));<NEW_LINE>// find and set parent if it exists<NEW_LINE>if (!CMISInfo.ROOT_FOLDER_ID.equals(folderId)) {<NEW_LINE>final Folder parent = app.<MASK><NEW_LINE>if (parent != null) {<NEW_LINE>newFolder.setParent(parent);<NEW_LINE>} else {<NEW_LINE>throw new CmisObjectNotFoundException("Folder with ID " + folderId + " does not exist");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>uuid = newFolder.getUuid();<NEW_LINE>} else {<NEW_LINE>throw new CmisConstraintException("Cannot create cmis:folder of type " + objectTypeId);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new CmisObjectNotFoundException("Type with ID " + objectTypeId + " does not exist");<NEW_LINE>}<NEW_LINE>tx.success();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new CmisRuntimeException("New folder could not be created: " + t.getMessage());<NEW_LINE>}<NEW_LINE>return uuid;<NEW_LINE>} | get(Folder.class, folderId); |
1,811,565 | public void onCompleted(GraphResponse response) {<NEW_LINE>if (response.getError() != null) {<NEW_LINE>throw new FacebookException(response.getError().getErrorMessage());<NEW_LINE>} else {<NEW_LINE>String mediaID = response.getJSONObject().optString(SDKConstants.PARAM_A2U_RESPONSE_ID);<NEW_LINE>AccessToken accessToken = AccessToken.getCurrentAccessToken();<NEW_LINE>Bundle parameters = new Bundle();<NEW_LINE>parameters.putString(SDKConstants.PARAM_A2U_TITLE, this.title);<NEW_LINE>parameters.putString(SDKConstants.PARAM_A2U_BODY, this.body);<NEW_LINE>parameters.putInt(<MASK><NEW_LINE>if (this.payload != null) {<NEW_LINE>parameters.putString(SDKConstants.PARAM_A2U_PAYLOAD, this.payload);<NEW_LINE>}<NEW_LINE>parameters.putString(SDKConstants.PARAM_A2U_MEDIA_ID, mediaID);<NEW_LINE>GraphRequest request = new GraphRequest(accessToken, SDKConstants.PARAM_A2U_GRAPH_PATH, parameters, HttpMethod.POST, this.callback);<NEW_LINE>request.executeAsync();<NEW_LINE>}<NEW_LINE>} | SDKConstants.PARAM_A2U_TIME_INTERVAL, this.timeInterval); |
152,025 | public int doStartTag() throws JspException {<NEW_LINE>HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();<NEW_LINE>// creates wsc/wu<NEW_LINE>Properties <MASK><NEW_LINE>WebSessionCtx wsc = WebSessionCtx.get(request);<NEW_LINE>//<NEW_LINE>HttpSession session = pageContext.getSession();<NEW_LINE>WebUser wu = (WebUser) session.getAttribute(WebUser.NAME);<NEW_LINE>if (wu != null && wu.isLoggedIn()) {<NEW_LINE>if (ctx != null) {<NEW_LINE>WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);<NEW_LINE>if (info == null || wu.getAD_User_ID() != info.getAD_User_ID()) {<NEW_LINE>info = new WebInfo(ctx, wu);<NEW_LINE>session.setAttribute(WebInfo.NAME, info);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// log.fine("WebUser exists - " + wu);<NEW_LINE>//<NEW_LINE>JspWriter out = pageContext.getOut();<NEW_LINE>HtmlCode html = new HtmlCode();<NEW_LINE>//<NEW_LINE>if (wu.isCustomer() || wu.isVendor())<NEW_LINE>menuBPartner(html, wsc.wstore);<NEW_LINE>if (wu.isSalesRep())<NEW_LINE>menuSalesRep(html, wsc.wstore);<NEW_LINE>if (wu.isEmployee() || wu.isSalesRep())<NEW_LINE>menuUser(html, wu.isEmployee(), wsc.wstore);<NEW_LINE>menuAll(html, wsc.wstore);<NEW_LINE>//<NEW_LINE>html.output(out);<NEW_LINE>} else {<NEW_LINE>if (CLogMgt.isLevelFiner())<NEW_LINE>log.fine("No WebUser");<NEW_LINE>if (session.getAttribute(WebInfo.NAME) == null)<NEW_LINE>session.setAttribute(WebInfo.NAME, WebInfo.getGeneral());<NEW_LINE>}<NEW_LINE>return (SKIP_BODY);<NEW_LINE>} | ctx = JSPEnv.getCtx(request); |
1,668,060 | public final T doCheckValid(RuleComponentModel data) {<NEW_LINE>Map<String, ParameterModel> params = data.getParameters();<NEW_LINE>String key = null;<NEW_LINE>try {<NEW_LINE>for (Map.Entry<String, ParameterDefinition> entry : this.getParameterDefinitions().entrySet()) {<NEW_LINE>key = entry.getKey();<NEW_LINE>entry.getValue().checkValid(params.get(key));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuleConstructionFailedException(e, "Could not create Component Instance of type %s from provided model %s: " + "validation failed for parameter '%s'", this.getId(), data.toString(), key);<NEW_LINE>}<NEW_LINE>T instance;<NEW_LINE>try {<NEW_LINE>instance = instanceFrom(params);<NEW_LINE>} catch (RuleEngineException | InvalidRuleParameterException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.warn(<MASK><NEW_LINE>throw new RuleConstructionFailedException(e, "Could not create Component Instance of type %s from provided model %s.", this.getId(), data.toString());<NEW_LINE>}<NEW_LINE>return instance;<NEW_LINE>} | RuleComponentDefinition.class, "Unexpected error creating component.", e); |
151,267 | public void onStatistics(MonitoringStatistics statistics) {<NEW_LINE>if (domain == null) {<NEW_LINE>final String globalSubType = ",subType=" + PROPERTY_SUBTYPE_GLOBAL;<NEW_LINE>final ApplicationInfo appStats = applicationInfoProvider.get();<NEW_LINE>String appName = appStats.getResourceConfig().getApplicationName();<NEW_LINE>if (appName == null) {<NEW_LINE>appName = "App_" + Integer.toHexString(appStats.getResourceConfig().hashCode());<NEW_LINE>}<NEW_LINE>domain = "org.glassfish.jersey:type=" + appName;<NEW_LINE>unregisterJerseyMBeans(false);<NEW_LINE>uriStatsGroup = new ResourcesMBeanGroup(statistics.getUriStatistics(), true, this, ",subType=Uris");<NEW_LINE>Map<String, ResourceStatistics> newMap = transformToStringKeys(statistics.getResourceClassStatistics());<NEW_LINE>resourceClassStatsGroup = new ResourcesMBeanGroup(newMap, false, this, ",subType=Resources");<NEW_LINE>responseMXBean = new ResponseMXBeanImpl();<NEW_LINE>registerMBean(responseMXBean, globalSubType + ",global=Responses");<NEW_LINE>requestMBean = new ExecutionStatisticsDynamicBean(statistics.getRequestStatistics(), this, globalSubType, "AllRequestTimes");<NEW_LINE>exceptionMapperMXBean = new ExceptionMapperMXBeanImpl(statistics.getExceptionMapperStatistics(), this, globalSubType);<NEW_LINE>new ApplicationMXBeanImpl(appStats, this, globalSubType);<NEW_LINE>}<NEW_LINE>requestMBean.updateExecutionStatistics(statistics.getRequestStatistics());<NEW_LINE>uriStatsGroup.updateResourcesStatistics(statistics.getUriStatistics());<NEW_LINE>responseMXBean.updateResponseStatistics(statistics.getResponseStatistics());<NEW_LINE>exceptionMapperMXBean.updateExceptionMapperStatistics(statistics.getExceptionMapperStatistics());<NEW_LINE>this.resourceClassStatsGroup.updateResourcesStatistics(transformToStringKeys<MASK><NEW_LINE>} | (statistics.getResourceClassStatistics())); |
913,160 | private void loadPlugins() {<NEW_LINE>logger.info("Loading plugins...");<NEW_LINE>try {<NEW_LINE>Path pluginPath = Paths.get("plugins");<NEW_LINE>if (!pluginPath.toFile().exists()) {<NEW_LINE>Files.createDirectory(pluginPath);<NEW_LINE>} else {<NEW_LINE>if (!pluginPath.toFile().isDirectory()) {<NEW_LINE>logger.warn("Plugin location {} is not a directory, continuing without loading plugins", pluginPath);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>pluginManager.loadPlugins(pluginPath);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Couldn't load plugins", e);<NEW_LINE>}<NEW_LINE>// Register the plugin main classes so that we can fire the proxy initialize event<NEW_LINE>for (PluginContainer plugin : pluginManager.getPlugins()) {<NEW_LINE>Optional<?> instance = plugin.getInstance();<NEW_LINE>if (instance.isPresent()) {<NEW_LINE>try {<NEW_LINE>eventManager.registerInternally(plugin, instance.get());<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Unable to register plugin listener for {}", plugin.getDescription().getName().orElse(plugin.getDescription().getId()), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("Loaded {} plugins", pluginManager.<MASK><NEW_LINE>} | getPlugins().size()); |
1,516,227 | final UpdateDomainConfigResult executeUpdateDomainConfig(UpdateDomainConfigRequest updateDomainConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateDomainConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateDomainConfigRequest> request = null;<NEW_LINE>Response<UpdateDomainConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateDomainConfigRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateDomainConfigRequest));<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, "OpenSearch");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateDomainConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateDomainConfigResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateDomainConfigResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,690,715 | protected void paintIcon(Graphics2D g2) {<NEW_LINE>final var discCol = myType == FILE_SAVE_AS ? Color.GRAY : Color.BLUE;<NEW_LINE>var bds = getScaled(2, 2, 12, 12);<NEW_LINE>g2.setColor(discCol);<NEW_LINE>g2.fillRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());<NEW_LINE>g2.setColor(Color.YELLOW);<NEW_LINE>bds = getScaled(4, 2, 8, 7);<NEW_LINE>g2.fillRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());<NEW_LINE>g2.setColor(Color.LIGHT_GRAY);<NEW_LINE>bds = getScaled(6, 10, 4, 4);<NEW_LINE>g2.fillRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());<NEW_LINE>g2.setColor(Color.BLACK);<NEW_LINE>bds = getScaled(8, 11, 1, 2);<NEW_LINE>g2.fillRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());<NEW_LINE>g2.setColor(Color.MAGENTA);<NEW_LINE>final int[] xPoints;<NEW_LINE>final int[] yPoints;<NEW_LINE>switch(myType) {<NEW_LINE>case FILE_OPEN:<NEW_LINE>xPoints = new int[7];<NEW_LINE>yPoints = new int[7];<NEW_LINE>for (var i = 0; i < 7; i++) {<NEW_LINE>xPoints[i] = AppPreferences.getScaled(arrowUp[i * 2]);<NEW_LINE>yPoints[i] = AppPreferences.getScaled(arrowUp[i * 2 + 1]);<NEW_LINE>}<NEW_LINE>g2.fillPolygon(xPoints, yPoints, 7);<NEW_LINE>break;<NEW_LINE>case FILE_SAVE_AS:<NEW_LINE>case FILE_SAVE:<NEW_LINE>xPoints = new int[7];<NEW_LINE>yPoints = new int[7];<NEW_LINE>for (var i = 0; i < 7; i++) {<NEW_LINE>xPoints[i] = AppPreferences.getScaled<MASK><NEW_LINE>yPoints[i] = AppPreferences.getScaled(arrowDown[i * 2 + 1]);<NEW_LINE>}<NEW_LINE>g2.fillPolygon(xPoints, yPoints, 7);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// do nothing. should not really happen.<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | (arrowDown[i * 2]); |
796,270 | public synchronized void putDataPoint(DataPointEvent event) throws DatastoreException {<NEW_LINE>GenOrmDataSource.attachAndBegin();<NEW_LINE>try {<NEW_LINE>ImmutableSortedMap<String, String> tags = event.getTags();<NEW_LINE>String metricName = event.getMetricName();<NEW_LINE>org.kairosdb.core.DataPoint dataPoint = event.getDataPoint();<NEW_LINE>String key = createMetricKey(metricName, tags, dataPoint.getDataStoreDataType());<NEW_LINE>Metric m = Metric.factory.findOrCreate(key);<NEW_LINE>if (m.isNew()) {<NEW_LINE>m.setName(metricName);<NEW_LINE>m.setType(dataPoint.getDataStoreDataType());<NEW_LINE>for (String name : tags.keySet()) {<NEW_LINE>String value = tags.get(name);<NEW_LINE>Tag.factory.findOrCreate(name, value);<NEW_LINE>MetricTag.factory.<MASK><NEW_LINE>}<NEW_LINE>GenOrmDataSource.flush();<NEW_LINE>DataPointsRowKey dataPointsRowKey = new DataPointsRowKey(metricName, "H2", 0, dataPoint.getDataStoreDataType(), tags);<NEW_LINE>m_rowKeyPublisher.post(new RowKeyEvent(metricName, dataPointsRowKey, 0));<NEW_LINE>}<NEW_LINE>KDataOutput dataOutput = new KDataOutput();<NEW_LINE>dataPoint.writeValueToBuffer(dataOutput);<NEW_LINE>new InsertDataPointQuery(m.getId(), new Timestamp(dataPoint.getTimestamp()), dataOutput.getBytes()).runUpdate();<NEW_LINE>GenOrmDataSource.commit();<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new DatastoreException(e);<NEW_LINE>} finally {<NEW_LINE>GenOrmDataSource.close();<NEW_LINE>}<NEW_LINE>} | findOrCreate(key, name, value); |
1,132,976 | boolean cmpItems(VirtualFrame frame, PArray left, PArray right, @Cached PyObjectRichCompareBool.EqNode eqNode, @Cached("createComparison()") BinaryComparisonNode compareNode, @Cached("createIfTrueNode()") CoerceToBooleanNode coerceToBooleanNode, @Cached ArrayNodes.GetValueNode getLeft, @Cached ArrayNodes.GetValueNode getRight) {<NEW_LINE>int commonLength = Math.min(left.getLength(), right.getLength());<NEW_LINE>for (int i = 0; i < commonLength; i++) {<NEW_LINE>Object leftValue = getLeft.execute(left, i);<NEW_LINE>Object rightValue = getRight.execute(right, i);<NEW_LINE>if (!eqNode.execute(frame, leftValue, rightValue)) {<NEW_LINE>return coerceToBooleanNode.executeBoolean(frame, compareNode.executeObject(frame, leftValue, rightValue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return compareLengths(left.getLength(<MASK><NEW_LINE>} | ), right.getLength()); |
852,272 | private void processMyAssignment(ServerAssignmentData myAssignment) {<NEW_LINE>Set<Long> assignedContainerSet = myAssignment.getContainersList().stream().collect(Collectors.toSet());<NEW_LINE>Set<Long> liveContainerSet = Sets.newHashSet(liveContainers.keySet());<NEW_LINE>Set<Long> containersToStart = Sets.newHashSet(Sets.difference(assignedContainerSet, liveContainerSet).immutableCopy());<NEW_LINE>Set<Long> containersToStop = Sets.newHashSet(Sets.difference(liveContainerSet<MASK><NEW_LINE>// if the containers are already in the pending start/stop list, we don't touch it until they are completed.<NEW_LINE>containersToStart = Sets.filter(containersToStart, container -> !pendingStartStopContainers.contains(container));<NEW_LINE>containersToStop = Sets.filter(containersToStop, container -> !pendingStartStopContainers.contains(container));<NEW_LINE>if (!containersToStart.isEmpty() || !containersToStop.isEmpty()) {<NEW_LINE>log.info("Process container changes:\n\tIdeal = {}\n\tLive = {}\n\t" + "Pending = {}\n\tToStart = {}\n\tToStop = {}", assignedContainerSet, liveContainerSet, pendingStartStopContainers, containersToStart, containersToStop);<NEW_LINE>}<NEW_LINE>containersToStart.forEach(this::startStorageContainer);<NEW_LINE>containersToStop.forEach(this::stopStorageContainer);<NEW_LINE>} | , assignedContainerSet).immutableCopy()); |
1,368,069 | public com.amazonaws.services.codedeploy.model.DeploymentGroupDoesNotExistException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.codedeploy.model.DeploymentGroupDoesNotExistException deploymentGroupDoesNotExistException = new com.amazonaws.services.codedeploy.model.DeploymentGroupDoesNotExistException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 deploymentGroupDoesNotExistException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
967,842 | protected void onDraw(Canvas canvas) {<NEW_LINE>final int width = getMeasuredWidth();<NEW_LINE>final int height = getMeasuredHeight();<NEW_LINE>final int lThumbWidth = mLeftThumb.getMeasuredWidth();<NEW_LINE>final float lThumbOffset = mLeftThumb.getX();<NEW_LINE>final float rThumbOffset = mRightThumb.getX();<NEW_LINE>final float lineTop = mLineSize;<NEW_LINE>final float lineBottom = height - mLineSize;<NEW_LINE>// top line<NEW_LINE>canvas.drawRect(lThumbWidth + lThumbOffset, 0, rThumbOffset, lineTop, mLinePaint);<NEW_LINE>// bottom line<NEW_LINE>canvas.drawRect(lThumbWidth + lThumbOffset, <MASK><NEW_LINE>if (lThumbOffset > mThumbWidth) {<NEW_LINE>canvas.drawRect(0, 0, lThumbOffset + mThumbWidth, height, mBgPaint);<NEW_LINE>}<NEW_LINE>if (rThumbOffset < width - mThumbWidth) {<NEW_LINE>canvas.drawRect(rThumbOffset, 0, width, height, mBgPaint);<NEW_LINE>}<NEW_LINE>} | lineBottom, rThumbOffset, height, mLinePaint); |
1,832,910 | public static ListTransitRoutersResponse unmarshall(ListTransitRoutersResponse listTransitRoutersResponse, UnmarshallerContext _ctx) {<NEW_LINE>listTransitRoutersResponse.setRequestId(_ctx.stringValue("ListTransitRoutersResponse.RequestId"));<NEW_LINE>listTransitRoutersResponse.setPageSize(_ctx.integerValue("ListTransitRoutersResponse.PageSize"));<NEW_LINE>listTransitRoutersResponse.setPageNumber(_ctx.integerValue("ListTransitRoutersResponse.PageNumber"));<NEW_LINE>listTransitRoutersResponse.setTotalCount(_ctx.integerValue("ListTransitRoutersResponse.TotalCount"));<NEW_LINE>List<TransitRouter> transitRouters = new ArrayList<TransitRouter>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListTransitRoutersResponse.TransitRouters.Length"); i++) {<NEW_LINE>TransitRouter transitRouter = new TransitRouter();<NEW_LINE>transitRouter.setCreationTime(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].CreationTime"));<NEW_LINE>transitRouter.setType(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].Type"));<NEW_LINE>transitRouter.setStatus(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].Status"));<NEW_LINE>transitRouter.setTransitRouterId(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].TransitRouterId"));<NEW_LINE>transitRouter.setTransitRouterDescription(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].TransitRouterDescription"));<NEW_LINE>transitRouter.setTransitRouterName(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].TransitRouterName"));<NEW_LINE>transitRouter.setCenId(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].CenId"));<NEW_LINE>transitRouter.setAliUid(_ctx.longValue<MASK><NEW_LINE>transitRouter.setRegionId(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].RegionId"));<NEW_LINE>transitRouter.setServiceMode(_ctx.stringValue("ListTransitRoutersResponse.TransitRouters[" + i + "].ServiceMode"));<NEW_LINE>transitRouters.add(transitRouter);<NEW_LINE>}<NEW_LINE>listTransitRoutersResponse.setTransitRouters(transitRouters);<NEW_LINE>return listTransitRoutersResponse;<NEW_LINE>} | ("ListTransitRoutersResponse.TransitRouters[" + i + "].AliUid")); |
1,035,218 | public void updateUI() {<NEW_LINE>Clipboard clipboard = new Clipboard(Display.getDefault());<NEW_LINE>String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());<NEW_LINE>if (sClipText != null) {<NEW_LINE>if (lastCopiedFromClip != null && sClipText.equals(lastCopiedFromClip)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean bTorrentInClipboard = addTorrentsFromTextList(sClipText, true) > 0;<NEW_LINE>if (btnPasteOrClear != null && !btnPasteOrClear.isDisposed()) {<NEW_LINE>btnPasteOrClear.setVisible(bTorrentInClipboard);<NEW_LINE>if (!btnPasteOrClearIsPaste) {<NEW_LINE>Messages.setLanguageText(btnPasteOrClear, "OpenTorrentWindow.addFiles.Clipboard");<NEW_LINE>Utils.makeButtonsEqualWidth(Arrays.asList(btnBrowseTorrent, btnBrowseFolder, btnPasteOrClear));<NEW_LINE>btnPasteOrClear.<MASK><NEW_LINE>btnPasteOrClearIsPaste = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (bTorrentInClipboard) {<NEW_LINE>Utils.setTT(btnPasteOrClear, sClipText);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>clipboard.dispose();<NEW_LINE>} | getParent().layout(true); |
1,256,728 | public void create(Properties ctx, TransformerHandler document) throws SAXException {<NEW_LINE>int viewId = Env.getContextAsInt(ctx, "AD_View_ID");<NEW_LINE>PackOut packOut = (PackOut) ctx.get("PackOutProcess");<NEW_LINE>if (packOut == null) {<NEW_LINE>packOut = new PackOut();<NEW_LINE>packOut.setLocalContext(ctx);<NEW_LINE>}<NEW_LINE>// Task<NEW_LINE>packOut.createGenericPO(document, I_AD_View.Table_ID, viewId, true, null);<NEW_LINE>StringBuilder whereClause = new StringBuilder(I_AD_View.COLUMNNAME_AD_View_ID).append("=?");<NEW_LINE>List<MViewDefinition> viewDefinitions = new Query(ctx, I_AD_View_Definition.Table_Name, whereClause.toString(), getTrxName(ctx)).setParameters(viewId).setOrderBy(X_AD_View_Definition.COLUMNNAME_SeqNo + "," + X_AD_View_Definition.COLUMNNAME_AD_View_Definition_ID).list();<NEW_LINE>for (MViewDefinition viewDefinition : viewDefinitions) {<NEW_LINE>if (viewDefinition.getAD_Table_ID() > 0) {<NEW_LINE>packOut.createTable(viewDefinition.getAD_Table_ID(), document);<NEW_LINE>}<NEW_LINE>packOut.createGenericPO(document, I_AD_View_Definition.Table_ID, viewDefinition.getAD_View_Definition_ID(), true, null);<NEW_LINE>// View Columns tags.<NEW_LINE>whereClause = new StringBuilder(I_AD_View_Definition.COLUMNNAME_AD_View_Definition_ID).append("=?");<NEW_LINE>List<MViewColumn> viewColumns = new Query(ctx, I_AD_View_Column.Table_Name, whereClause.toString(), getTrxName(ctx)).setParameters(viewDefinition.<MASK><NEW_LINE>for (MViewColumn vc : viewColumns) {<NEW_LINE>packOut.createGenericPO(document, I_AD_View_Column.Table_ID, vc.getAD_View_Column_ID(), true, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getAD_View_Definition_ID()).list(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.