idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
57,972 | protected void populateBuffer() {<NEW_LINE>if (hasFinished) {<NEW_LINE>Utils.sleep(10);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// initial request<NEW_LINE>if (scrollId == null) {<NEW_LINE>SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();<NEW_LINE>searchSourceBuilder.query(QueryBuilders.matchAllQuery());<NEW_LINE>searchSourceBuilder.size(maxURLsPerBucket * maxBucketNum);<NEW_LINE>SearchRequest searchRequest = new SearchRequest(indexName);<NEW_LINE>searchRequest.source(searchSourceBuilder);<NEW_LINE>searchRequest.scroll(TimeValue.timeValueMinutes(5L));<NEW_LINE>// specific shard but ideally a local copy of it<NEW_LINE>if (shardID != -1) {<NEW_LINE>searchRequest.preference("_shards:" + shardID + "|_local");<NEW_LINE>}<NEW_LINE>isInQuery.set(true);<NEW_LINE>LOG.trace("{} isInquery set to true", logIdprefix);<NEW_LINE>client.searchAsync(searchRequest, RequestOptions.DEFAULT, this);<NEW_LINE>// dump query to log<NEW_LINE>LOG.debug("{} ES query {}", logIdprefix, searchRequest.toString());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);<NEW_LINE>scrollRequest.scroll<MASK><NEW_LINE>isInQuery.set(true);<NEW_LINE>client.scrollAsync(scrollRequest, RequestOptions.DEFAULT, this);<NEW_LINE>// dump query to log<NEW_LINE>LOG.debug("{} ES query {}", logIdprefix, scrollRequest.toString());<NEW_LINE>} | (TimeValue.timeValueMinutes(5L)); |
1,560,490 | private void updatePorts(Instance instance) {<NEW_LINE>final var nrBits = instance.getAttributeValue(StdAttr.WIDTH).getWidth();<NEW_LINE>var nrOfPorts = nrBits;<NEW_LINE>final var dir = instance.getAttributeValue(PioAttributes.PIO_DIRECTION);<NEW_LINE>final var hasIrq = hasIrqPin(instance.getAttributeSet());<NEW_LINE>if (dir == PioAttributes.PORT_INOUT)<NEW_LINE>nrOfPorts *= 2;<NEW_LINE>var index = hasIrq ? 2 : 1;<NEW_LINE>nrOfPorts += index;<NEW_LINE>final var ps = new Port[nrOfPorts];<NEW_LINE>if (hasIrq) {<NEW_LINE>ps[IRQ_INDEX] = new Port(20, 0, Port.OUTPUT, 1);<NEW_LINE>ps[IRQ_INDEX].setToolTip(S.getter("SocPioIrqOutput"));<NEW_LINE>}<NEW_LINE>ps[RESET_INDEX] = new Port(0, 110, Port.INPUT, 1);<NEW_LINE>ps[RESET_INDEX].setToolTip<MASK><NEW_LINE>if (dir == PioAttributes.PORT_INPUT || dir == PioAttributes.PORT_INOUT) {<NEW_LINE>for (var b = 0; b < nrBits; b++) {<NEW_LINE>ps[index + b] = new Port(370 - b * 10, 120, Port.INPUT, 1);<NEW_LINE>ps[index + b].setToolTip(S.getter("SocPioInputPinx", Integer.toString(b)));<NEW_LINE>}<NEW_LINE>index += nrBits;<NEW_LINE>}<NEW_LINE>if (dir == PioAttributes.PORT_INOUT || dir == PioAttributes.PORT_OUTPUT || dir == PioAttributes.PORT_BIDIR) {<NEW_LINE>final var portType = (dir == PioAttributes.PORT_BIDIR) ? Port.INOUT : Port.OUTPUT;<NEW_LINE>for (var b = 0; b < nrBits; b++) {<NEW_LINE>ps[index + b] = new Port(370 - b * 10, 0, portType, 1);<NEW_LINE>ps[index + b].setToolTip((dir == PioAttributes.PORT_BIDIR) ? S.getter("SocPioBidirPinx", Integer.toString(b)) : S.getter("SocPioOutputPinx", Integer.toString(b)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>instance.setPorts(ps);<NEW_LINE>} | (S.getter("SocPioResetInput")); |
309,747 | public Map<String, Object> measureUser(Recommender recommender, TestUser testUser) {<NEW_LINE>ItemRecommender irec = recommender.getItemRecommender();<NEW_LINE>if (irec == null) {<NEW_LINE>logger.debug("recommender cannot produce recommendations");<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>LongSet candidates = getCandidateSelector().selectItems(allItems, recommender, testUser);<NEW_LINE>LongSet excludes = getExcludeSelector().selectItems(allItems, recommender, testUser);<NEW_LINE>int n = getListSize();<NEW_LINE>ResultList results = null;<NEW_LINE>LongList items = null;<NEW_LINE>if (useDetails) {<NEW_LINE>logger.debug("generating {} detailed recommendations for user {}", n, testUser.getUser());<NEW_LINE>results = irec.recommendWithDetails(testUser.getUserId(), n, candidates, excludes);<NEW_LINE>} else {<NEW_LINE>// no one needs details, save time collecting them<NEW_LINE>logger.debug("generating {} recommendations for user {}", n, testUser.getUser());<NEW_LINE>items = LongUtils.asLongList(irec.recommend(testUser.getUserId(), n, candidates, excludes));<NEW_LINE>}<NEW_LINE>// Measure the user results<NEW_LINE>Map<String, Object> row = new HashMap<>();<NEW_LINE>for (MetricContext<?> mc : predictMetricContexts) {<NEW_LINE>MetricResult res;<NEW_LINE>if (useDetails) {<NEW_LINE>res = mc.measureUser(recommender, testUser, n, results);<NEW_LINE>} else {<NEW_LINE>res = mc.measureUser(recommender, testUser, n, items);<NEW_LINE>}<NEW_LINE>row.putAll(res.withPrefix(getLabelPrefix<MASK><NEW_LINE>}<NEW_LINE>writeRecommendations(testUser, results);<NEW_LINE>return row;<NEW_LINE>} | ()).getValues()); |
728,745 | private <T> void bindFinder(Class<T> iface) {<NEW_LINE>if (!isDynamicFinderValid(iface)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>InvocationHandler finderInvoker = new InvocationHandler() {<NEW_LINE><NEW_LINE>@Inject<NEW_LINE>JpaFinderProxy finderProxy;<NEW_LINE><NEW_LINE>public Object invoke(final Object thisObject, final Method method, final Object[] args) throws Throwable {<NEW_LINE>// Don't intercept non-finder methods like equals and hashcode.<NEW_LINE>if (!method.isAnnotationPresent(Finder.class)) {<NEW_LINE>// NOTE(dhanji): This is not ideal, we are using the invocation handler's equals<NEW_LINE>// and hashcode as a proxy (!) for the proxy's equals and hashcode.<NEW_LINE>return method.invoke(this, args);<NEW_LINE>}<NEW_LINE>return finderProxy.invoke(new MethodInvocation() {<NEW_LINE><NEW_LINE>public Method getMethod() {<NEW_LINE>return method;<NEW_LINE>}<NEW_LINE><NEW_LINE>public Object[] getArguments() {<NEW_LINE>return null == args <MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>public Object proceed() throws Throwable {<NEW_LINE>return method.invoke(thisObject, args);<NEW_LINE>}<NEW_LINE><NEW_LINE>public Object getThis() {<NEW_LINE>throw new UnsupportedOperationException("Bottomless proxies don't expose a this.");<NEW_LINE>}<NEW_LINE><NEW_LINE>public AccessibleObject getStaticPart() {<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>};<NEW_LINE>requestInjection(finderInvoker);<NEW_LINE>// Proxy must produce instance of type given.<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>T proxy = (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] { iface }, finderInvoker);<NEW_LINE>bind(iface).toInstance(proxy);<NEW_LINE>} | ? new Object[0] : args; |
1,775,208 | public void writeSynchronized(final SynchronizedStatement statement) {<NEW_LINE>controller.getAcg().onLineNumber(statement, "visitSynchronizedStatement");<NEW_LINE>writeStatementLabel(statement);<NEW_LINE>MethodVisitor mv = controller.getMethodVisitor();<NEW_LINE>CompileStack compileStack = controller.getCompileStack();<NEW_LINE>statement.getExpression().visit(controller.getAcg());<NEW_LINE>controller.getOperandStack().box();<NEW_LINE>int index = compileStack.defineTemporaryVariable("synchronized", ClassHelper.OBJECT_TYPE, true);<NEW_LINE>Label synchronizedStart = new Label();<NEW_LINE>Label synchronizedEnd = new Label();<NEW_LINE>Label catchAll = new Label();<NEW_LINE>mv.visitVarInsn(ALOAD, index);<NEW_LINE>mv.visitInsn(MONITORENTER);<NEW_LINE>mv.visitLabel(synchronizedStart);<NEW_LINE>// place holder for "empty" synchronized blocks, for example<NEW_LINE>// if there is only a break/continue.<NEW_LINE>mv.visitInsn(NOP);<NEW_LINE>Runnable finallyPart = () -> {<NEW_LINE>mv.visitVarInsn(ALOAD, index);<NEW_LINE>mv.visitInsn(MONITOREXIT);<NEW_LINE>};<NEW_LINE>BlockRecorder fb = new BlockRecorder(finallyPart);<NEW_LINE>fb.startRange(synchronizedStart);<NEW_LINE>compileStack.pushBlockRecorder(fb);<NEW_LINE>statement.getCode().visit(controller.getAcg());<NEW_LINE>fb.closeRange(catchAll);<NEW_LINE>compileStack.<MASK><NEW_LINE>// pop fb<NEW_LINE>compileStack.pop();<NEW_LINE>finallyPart.run();<NEW_LINE>mv.visitJumpInsn(GOTO, synchronizedEnd);<NEW_LINE>mv.visitLabel(catchAll);<NEW_LINE>finallyPart.run();<NEW_LINE>mv.visitInsn(ATHROW);<NEW_LINE>mv.visitLabel(synchronizedEnd);<NEW_LINE>compileStack.removeVar(index);<NEW_LINE>} | writeExceptionTable(fb, catchAll, null); |
338,168 | protected void logLocations(TraceComponent logger) {<NEW_LINE>String useWARClassesPath = getWARClassesPath();<NEW_LINE>if (useWARClassesPath == null) {<NEW_LINE>useWARClassesPath = getImmediatePath() + "/" + "WEB-INF/classes";<NEW_LINE>}<NEW_LINE>Tr.debug(logger, "Classes path [ " + useWARClassesPath + " ]");<NEW_LINE>List<String> warLibJarPaths;<NEW_LINE>if (getUseWARLibraryJarPaths()) {<NEW_LINE>warLibJarPaths = getWARLibraryJarPaths();<NEW_LINE>if (warLibJarPaths != null) {<NEW_LINE>for (String nextJarPath : warLibJarPaths) {<NEW_LINE>Tr.debug(logger, "WAR library jar [ " + nextJarPath + " ]");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String useWARLibPath = getWARLibraryPath();<NEW_LINE>if (useWARLibPath == null) {<NEW_LINE>useWARLibPath <MASK><NEW_LINE>}<NEW_LINE>Tr.debug(logger, "WAR library path [ " + useWARLibPath + " ]");<NEW_LINE>}<NEW_LINE>} | = getImmediatePath() + "/" + "WEB-INF/lib"; |
490,504 | public static void deviceAlarmUpdateLogic(IDeviceAssignment assignment, IDeviceAlarmCreateRequest request, DeviceAlarm target) throws SiteWhereException {<NEW_LINE>if (assignment != null) {<NEW_LINE>target.setDeviceId(assignment.getDeviceId());<NEW_LINE>target.setDeviceAssignmentId(assignment.getId());<NEW_LINE>target.setCustomerId(assignment.getCustomerId());<NEW_LINE>target.setAreaId(assignment.getAreaId());<NEW_LINE>target.setAssetId(assignment.getAssetId());<NEW_LINE>}<NEW_LINE>if (request.getAlarmMessage() != null) {<NEW_LINE>target.setAlarmMessage(request.getAlarmMessage());<NEW_LINE>}<NEW_LINE>if (request.getState() != null) {<NEW_LINE>target.setState(request.getState());<NEW_LINE>}<NEW_LINE>if (request.getTriggeredDate() != null) {<NEW_LINE>target.setTriggeredDate(request.getTriggeredDate());<NEW_LINE>}<NEW_LINE>if (request.getAcknowledgedDate() != null) {<NEW_LINE>target.setAcknowledgedDate(request.getAcknowledgedDate());<NEW_LINE>}<NEW_LINE>if (request.getResolvedDate() != null) {<NEW_LINE>target.setResolvedDate(request.getResolvedDate());<NEW_LINE>}<NEW_LINE>if (request.getMetadata() != null) {<NEW_LINE>target<MASK><NEW_LINE>MetadataProvider.copy(request.getMetadata(), target);<NEW_LINE>}<NEW_LINE>} | .getMetadata().clear(); |
1,446,852 | public GetDiskSnapshotsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetDiskSnapshotsResult getDiskSnapshotsResult = new GetDiskSnapshotsResult();<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 getDiskSnapshotsResult;<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("diskSnapshots", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDiskSnapshotsResult.setDiskSnapshots(new ListUnmarshaller<DiskSnapshot>(DiskSnapshotJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextPageToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDiskSnapshotsResult.setNextPageToken(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 getDiskSnapshotsResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,491,188 | public BindingResult<T> bind(ArgumentConversionContext<T> context, HttpRequest<?> source) {<NEW_LINE>Optional<String> bodyComponent = context.getAnnotationMetadata().stringValue(Body.class);<NEW_LINE>if (bodyComponent.isPresent()) {<NEW_LINE>Optional<ConvertibleValues> body = source.getBody(ConvertibleValues.class);<NEW_LINE>if (body.isPresent()) {<NEW_LINE>ConvertibleValues values = body.get();<NEW_LINE>String component = bodyComponent.get();<NEW_LINE>if (!values.contains(component)) {<NEW_LINE>component = NameUtils.hyphenate(component);<NEW_LINE>}<NEW_LINE>Optional<T> value = <MASK><NEW_LINE>return newResult(value.orElse(null), context);<NEW_LINE>} else {<NEW_LINE>// noinspection unchecked<NEW_LINE>return BindingResult.EMPTY;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Optional<?> body = source.getBody();<NEW_LINE>if (!body.isPresent()) {<NEW_LINE>return BindingResult.EMPTY;<NEW_LINE>} else {<NEW_LINE>Object o = body.get();<NEW_LINE>Optional<T> converted = conversionService.convert(o, context);<NEW_LINE>return newResult(converted.orElse(null), context);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | values.get(component, context); |
1,017,811 | public ImmutableMarketData marketData(RatesCurveGroupDefinition group, RatesProvider inputProvider, ReferenceData refData) {<NEW_LINE>// Retrieve the set of required indices and the list of required currencies<NEW_LINE>Set<Index> indicesRequired = new HashSet<>();<NEW_LINE>List<Currency> ccyRequired = new ArrayList<>();<NEW_LINE>for (RatesCurveGroupEntry entry : group.getEntries()) {<NEW_LINE>indicesRequired.addAll(entry.getIndices());<NEW_LINE>ccyRequired.addAll(entry.getDiscountCurrencies());<NEW_LINE>}<NEW_LINE>// Retrieve the required time series if present in the original provider<NEW_LINE>Map<IndexQuoteId, LocalDateDoubleTimeSeries> ts = new HashMap<>();<NEW_LINE>for (Index idx : Sets.intersection(inputProvider.getTimeSeriesIndices(), indicesRequired)) {<NEW_LINE>ts.put(IndexQuoteId.of(idx), inputProvider.timeSeries(idx));<NEW_LINE>}<NEW_LINE>LocalDate valuationDate = inputProvider.getValuationDate();<NEW_LINE>ImmutableList<CurveDefinition> curveGroups = group.getCurveDefinitions();<NEW_LINE>// Generate market quotes from the trades<NEW_LINE>Map<MarketDataId<?>, Object> mapIdSy = new HashMap<>();<NEW_LINE>// Generate quotes for FX pairs. The first currency is arbitrarily selected as starting point.<NEW_LINE>// The crosses are automatically generated by the MarketDataFxRateProvider used in calibration.<NEW_LINE>for (int loopccy = 1; loopccy < ccyRequired.size(); loopccy++) {<NEW_LINE>CurrencyPair ccyPair = CurrencyPair.of(ccyRequired.get(0), ccyRequired.get(loopccy));<NEW_LINE>FxRateId <MASK><NEW_LINE>mapIdSy.put(fxId, FxRate.of(ccyPair, inputProvider.fxRate(ccyPair)));<NEW_LINE>}<NEW_LINE>// create a synthetic value for each node<NEW_LINE>for (CurveDefinition entry : curveGroups) {<NEW_LINE>ImmutableList<CurveNode> nodes = entry.getNodes();<NEW_LINE>for (CurveNode node : nodes) {<NEW_LINE>ResolvedTrade trade = node.sampleResolvedTrade(valuationDate, inputProvider, refData);<NEW_LINE>double mq = measures.value(trade, inputProvider);<NEW_LINE>for (MarketDataId<?> key : node.requirements()) {<NEW_LINE>if (key instanceof QuoteId) {<NEW_LINE>mapIdSy.put(key, mq);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ImmutableMarketData.builder(valuationDate).addValueMap(mapIdSy).addTimeSeriesMap(ts).build();<NEW_LINE>} | fxId = FxRateId.of(ccyPair); |
961,044 | public void marshall(MetricSetSummary metricSetSummary, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (metricSetSummary == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(metricSetSummary.getMetricSetArn(), METRICSETARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(metricSetSummary.getAnomalyDetectorArn(), ANOMALYDETECTORARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(metricSetSummary.getMetricSetDescription(), METRICSETDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(metricSetSummary.getMetricSetName(), METRICSETNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(metricSetSummary.getLastModificationTime(), LASTMODIFICATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(metricSetSummary.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | metricSetSummary.getCreationTime(), CREATIONTIME_BINDING); |
220,039 | protected RTrees createClassifier() {<NEW_LINE>RTrees trees = RTrees.create();<NEW_LINE>ParameterList params = getParameterList();<NEW_LINE>if (params != null) {<NEW_LINE>int maxDepth = params.getIntParameterValue("maxDepth");<NEW_LINE>int <MASK><NEW_LINE>boolean use1SE = params.getBooleanParameterValue("use1SE");<NEW_LINE>trees.setMaxDepth(maxDepth == 0 ? Integer.MAX_VALUE : maxDepth);<NEW_LINE>trees.setMinSampleCount(minSamples);<NEW_LINE>trees.setUse1SERule(use1SE);<NEW_LINE>// setUseSurrogates should help with missing data... but it appears not actually to be implemented<NEW_LINE>// System.out.println("DEFAULT SURROGATES: " + trees.getUseSurrogates());<NEW_LINE>// trees.setUseSurrogates(true);<NEW_LINE>// Set termination criteria<NEW_LINE>int termCritMaxTrees = params.getIntParameterValue("termCritMaxTrees");<NEW_LINE>double termCritEPS = params.getDoubleParameterValue("termCritEPS");<NEW_LINE>termCriteria = createTerminationCriteria(termCritMaxTrees, termCritEPS);<NEW_LINE>if (termCriteria != null)<NEW_LINE>trees.setTermCriteria(termCriteria);<NEW_LINE>else<NEW_LINE>termCriteria = trees.getTermCriteria();<NEW_LINE>logger.info("RTrees classifier termination criteria: {}", termCriteria);<NEW_LINE>}<NEW_LINE>// lastDescription = getName() + "\n\nMain parameters:\n " + DefaultPluginWorkflowStep.getParameterListJSON(params, "\n ") + "\n\nTermination criteria:\n " + termCriteria.toString();<NEW_LINE>//<NEW_LINE>// } else<NEW_LINE>// lastDescription = null;<NEW_LINE>// trees.setCVFolds(5); // Seems to cause segfault...<NEW_LINE>// trees.setCalculateVarImportance(true); // Seems to require surrogates, but...<NEW_LINE>// trees.setUseSurrogates(true); // // Seems not yet to be supported...<NEW_LINE>return trees;<NEW_LINE>} | minSamples = params.getIntParameterValue("minSamples"); |
1,233,938 | protected void generateKeyStore(File keyStore, String keyStoreAlias, String keyStorePassword, String keyPassword, String distinguishedName) throws MojoExecutionException, MojoFailureException {<NEW_LINE>getLog().info("Generating keystore in: " + keyStore);<NEW_LINE>try {<NEW_LINE>// generated folder if it does not exist<NEW_LINE>Files.createDirectories(keyStore.getParentFile().toPath());<NEW_LINE>List<String> command = new ArrayList<>();<NEW_LINE>command.add(getEnvironmentRelativeExecutablePath() + "keytool");<NEW_LINE>command.add("-genkeypair");<NEW_LINE>command.add("-keystore");<NEW_LINE>command.add(keyStore.getPath());<NEW_LINE>command.add("-alias");<NEW_LINE>command.add(keyStoreAlias);<NEW_LINE>command.add("-storepass");<NEW_LINE>command.add(keyStorePassword);<NEW_LINE>command.add("-keypass");<NEW_LINE>command.add(keyPassword);<NEW_LINE>command.add("-dname");<NEW_LINE>command.add(distinguishedName);<NEW_LINE>command.add("-sigalg");<NEW_LINE>command.add("SHA256withRSA");<NEW_LINE>command.add("-validity");<NEW_LINE>command.add("100");<NEW_LINE>command.add("-keyalg");<NEW_LINE>command.add("RSA");<NEW_LINE>command.add("-keysize");<NEW_LINE>command.add("2048");<NEW_LINE>Optional.ofNullable(additionalKeytoolParameters).ifPresent(additionalParameters -> {<NEW_LINE>command.addAll(additionalParameters);<NEW_LINE>});<NEW_LINE>if (verbose) {<NEW_LINE>command.add("-v");<NEW_LINE>}<NEW_LINE>ProcessBuilder pb = new ProcessBuilder().inheritIO().command(command);<NEW_LINE>Process p = pb.start();<NEW_LINE>p.waitFor();<NEW_LINE>} catch (IOException | InterruptedException ex) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new MojoExecutionException("There was an exception while generating keystore.", ex); |
1,084,689 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>java.awt.GridBagConstraints gridBagConstraints;<NEW_LINE>buttonGroup1 = new javax.swing.ButtonGroup();<NEW_LINE>panelLaF = new javax.swing.JPanel();<NEW_LINE>checkMaximizeNativeLaF = new javax.swing.JCheckBox();<NEW_LINE>panelLaFCombo = new javax.swing.JPanel();<NEW_LINE>comboLaf = new javax.swing.JComboBox();<NEW_LINE>lblLaf = new javax.swing.JLabel();<NEW_LINE>lblRestart = new javax.swing.JLabel();<NEW_LINE>setBorder(javax.swing.BorderFactory.createEmptyBorder(10<MASK><NEW_LINE>setLayout(new java.awt.GridBagLayout());<NEW_LINE>panelLaF.setLayout(new java.awt.BorderLayout());<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(checkMaximizeNativeLaF, org.openide.util.NbBundle.getMessage(LafPanel.class, "LafPanel.checkMaximizeNativeLaF.text"));<NEW_LINE>// NOI18N<NEW_LINE>checkMaximizeNativeLaF.setToolTipText(org.openide.util.NbBundle.getMessage(LafPanel.class, "LafPanel.checkMaximizeNativeLaF.toolTipText"));<NEW_LINE>panelLaF.add(checkMaximizeNativeLaF, java.awt.BorderLayout.WEST);<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 0;<NEW_LINE>gridBagConstraints.gridy = 1;<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;<NEW_LINE>gridBagConstraints.weightx = 1.0;<NEW_LINE>gridBagConstraints.weighty = 1.0;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);<NEW_LINE>add(panelLaF, gridBagConstraints);<NEW_LINE>panelLaFCombo.setLayout(new java.awt.BorderLayout(3, 0));<NEW_LINE>panelLaFCombo.add(comboLaf, java.awt.BorderLayout.CENTER);<NEW_LINE>lblLaf.setLabelFor(comboLaf);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(lblLaf, NbBundle.getMessage(LafPanel.class, "LafPanel.lblLaf.text"));<NEW_LINE>panelLaFCombo.add(lblLaf, java.awt.BorderLayout.WEST);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(lblRestart, NbBundle.getMessage(LafPanel.class, "LafPanel.lblRestart.text"));<NEW_LINE>panelLaFCombo.add(lblRestart, java.awt.BorderLayout.LINE_END);<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 0;<NEW_LINE>gridBagConstraints.gridy = 0;<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;<NEW_LINE>add(panelLaFCombo, gridBagConstraints);<NEW_LINE>} | , 10, 10, 10)); |
89,883 | // end main()<NEW_LINE>public boolean trainClassifier(String path) throws IOException {<NEW_LINE>// build dataset of training data featurized<NEW_LINE>Pair<GeneralDataset<String, String>, List<String[]>> dataInfo = readAndReturnTrainingExamples(path);<NEW_LINE>GeneralDataset<String, String<MASK><NEW_LINE>List<String[]> lineInfos = dataInfo.second();<NEW_LINE>// For things like cross validation, we may well need to sort data! Data sets are often ordered by class.<NEW_LINE>if (globalFlags.shuffleTrainingData) {<NEW_LINE>long seed;<NEW_LINE>if (globalFlags.shuffleSeed != 0) {<NEW_LINE>seed = globalFlags.shuffleSeed;<NEW_LINE>} else {<NEW_LINE>seed = System.nanoTime();<NEW_LINE>}<NEW_LINE>train.shuffleWithSideInformation(seed, lineInfos);<NEW_LINE>}<NEW_LINE>// print any binned value histograms<NEW_LINE>for (int i = 0; i < flags.length; i++) {<NEW_LINE>if (flags[i] != null && flags[i].binnedValuesCounter != null) {<NEW_LINE>logger.info("BinnedValuesStatistics for column " + i);<NEW_LINE>logger.info(flags[i].binnedValuesCounter.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// print any binned length histograms<NEW_LINE>for (int i = 0; i < flags.length; i++) {<NEW_LINE>if (flags[i] != null && flags[i].binnedLengthsCounter != null) {<NEW_LINE>logger.info("BinnedLengthsStatistics for column " + i);<NEW_LINE>logger.info(flags[i].binnedLengthsCounter.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// print the training data in SVMlight format if desired<NEW_LINE>if (globalFlags.printSVMLightFormatTo != null) {<NEW_LINE>PrintWriter pw = IOUtils.getPrintWriter(globalFlags.printSVMLightFormatTo, globalFlags.encoding);<NEW_LINE>train.printSVMLightFormat(pw);<NEW_LINE>IOUtils.closeIgnoringExceptions(pw);<NEW_LINE>train.featureIndex().saveToFilename(globalFlags.printSVMLightFormatTo + ".featureIndex");<NEW_LINE>train.labelIndex().saveToFilename(globalFlags.printSVMLightFormatTo + ".labelIndex");<NEW_LINE>}<NEW_LINE>if (globalFlags.crossValidationFolds > 1) {<NEW_LINE>crossValidate(train, lineInfos);<NEW_LINE>}<NEW_LINE>if (globalFlags.exitAfterTrainingFeaturization) {<NEW_LINE>// ENDS PROCESSING<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// build the classifier<NEW_LINE>classifier = makeClassifier(train);<NEW_LINE>printClassifier(classifier);<NEW_LINE>// serialize the classifier<NEW_LINE>String serializeTo = globalFlags.serializeTo;<NEW_LINE>if (serializeTo != null) {<NEW_LINE>serializeClassifier(serializeTo);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | > train = dataInfo.first(); |
1,552,011 | private void readTargetInfo(int localTargetType, byte[] classFileBytes, IConstantPool constantPool, int localOffset) throws ClassFormatException {<NEW_LINE>switch(localTargetType) {<NEW_LINE>case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER:<NEW_LINE>this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset++;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.CLASS_EXTENDS:<NEW_LINE>this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset += 2;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND:<NEW_LINE>this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset++;<NEW_LINE>this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset++;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.FIELD:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_RETURN:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_RECEIVER:<NEW_LINE>// nothing to do, target_info is empty_target<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.METHOD_FORMAL_PARAMETER:<NEW_LINE>this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset++;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.THROWS:<NEW_LINE>this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset += 2;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.LOCAL_VARIABLE:<NEW_LINE>case IExtendedAnnotationConstants.RESOURCE_VARIABLE:<NEW_LINE>int tableLength = u2At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset += 2;<NEW_LINE>this.localVariableTable = new LocalVariableReferenceInfo[tableLength];<NEW_LINE>for (int i = 0; i < tableLength; i++) {<NEW_LINE>this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset);<NEW_LINE>this.readOffset += 6;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.EXCEPTION_PARAMETER:<NEW_LINE>this.exceptionTableIndex = u2At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset += 2;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.NEW:<NEW_LINE>case IExtendedAnnotationConstants.INSTANCEOF:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_REFERENCE:<NEW_LINE>case IExtendedAnnotationConstants.CONSTRUCTOR_REFERENCE:<NEW_LINE>this.offset = u2At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset += 2;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.CAST:<NEW_LINE>this.offset = u2At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset += 2;<NEW_LINE>// read type_argument_index<NEW_LINE>this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset++;<NEW_LINE>break;<NEW_LINE>case IExtendedAnnotationConstants.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_INVOCATION_TYPE_ARGUMENT:<NEW_LINE>case IExtendedAnnotationConstants.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:<NEW_LINE>case IExtendedAnnotationConstants.METHOD_REFERENCE_TYPE_ARGUMENT:<NEW_LINE>this.offset = u2At(<MASK><NEW_LINE>this.readOffset += 2;<NEW_LINE>// read type_argument_index<NEW_LINE>this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);<NEW_LINE>this.readOffset++;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | classFileBytes, this.readOffset, localOffset); |
143,577 | final GetRepositoryTriggersResult executeGetRepositoryTriggers(GetRepositoryTriggersRequest getRepositoryTriggersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getRepositoryTriggersRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetRepositoryTriggersRequest> request = null;<NEW_LINE>Response<GetRepositoryTriggersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetRepositoryTriggersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getRepositoryTriggersRequest));<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, "CodeCommit");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRepositoryTriggers");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetRepositoryTriggersResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetRepositoryTriggersResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
150,158 | public Column unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Column column = new Column();<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("name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>column.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("type", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>column.setType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return column;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
622,015 | void build(SerializableCallGraph scg, DefaultCallGraph cg) {<NEW_LINE>for (SerializableCallGraph.Node serializableNode : scg.nodes) {<NEW_LINE>nodes.add(new DefaultCallGraphNode(cg, serializableNode.method));<NEW_LINE>}<NEW_LINE>for (SerializableCallGraph.CallSite scs : scg.callSites) {<NEW_LINE>DefaultCallSite callSite;<NEW_LINE>if (scs.virtual) {<NEW_LINE>callSite = new DefaultCallSite(scs.method, mapNodes(scs.callers));<NEW_LINE>callSite.calledMethods.addAll(mapNodes(scs.calledMethods));<NEW_LINE>} else {<NEW_LINE>callSite = new DefaultCallSite(nodes.get(scs.calledMethods[0]), nodes.get(scs.callers[0]));<NEW_LINE>}<NEW_LINE>for (SerializableCallGraph.Location location : scs.locations) {<NEW_LINE>callSite.addLocation(nodes.get(location.caller), location.value);<NEW_LINE>}<NEW_LINE>callSites.add(callSite);<NEW_LINE>}<NEW_LINE>for (SerializableCallGraph.FieldAccess sfa : scg.fieldAccessList) {<NEW_LINE>fieldAccessList.add(new DefaultFieldAccessSite(sfa.location, nodes.get(sfa.callee), sfa.field));<NEW_LINE>}<NEW_LINE>for (int index : scg.nodeIndexes) {<NEW_LINE>DefaultCallGraphNode <MASK><NEW_LINE>cg.nodes.put(node.getMethod(), node);<NEW_LINE>}<NEW_LINE>for (int index : scg.fieldAccessIndexes) {<NEW_LINE>cg.addFieldAccess(fieldAccessList.get(index));<NEW_LINE>}<NEW_LINE>} | node = nodes.get(index); |
811,902 | private T deserialize(final SecurityContext securityContext, Class<T> type, final PropertyMap attributes) throws FrameworkException {<NEW_LINE>final App app = StructrApp.getInstance(securityContext);<NEW_LINE>if (attributes != null) {<NEW_LINE>final List<T> result = new LinkedList<>();<NEW_LINE>// Check if properties contain the UUID attribute<NEW_LINE>if (attributes.containsKey(GraphObject.id)) {<NEW_LINE>result.add((T) app.getNodeById(attributes.get(GraphObject.id)));<NEW_LINE>} else {<NEW_LINE>boolean attributesComplete = true;<NEW_LINE>// Check if all property keys of the PropertySetNotion are present<NEW_LINE>for (PropertyKey key : propertyKeys) {<NEW_LINE>attributesComplete &= attributes.containsKey(key);<NEW_LINE>}<NEW_LINE>if (attributesComplete) {<NEW_LINE>final PropertyMap searchAttributes = new PropertyMap();<NEW_LINE>for (final PropertyKey key : attributes.keySet()) {<NEW_LINE>// only use attribute for searching if it is NOT<NEW_LINE>// a related node property<NEW_LINE>if (key.relatedType() == null) {<NEW_LINE>searchAttributes.put(key, attributes.get(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>result.addAll(app.nodeQuery(type).and(searchAttributes).getAsList());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// just check for existance<NEW_LINE>String errorMessage = null;<NEW_LINE>final int size = result.size();<NEW_LINE>switch(size) {<NEW_LINE>case 0:<NEW_LINE>if (createIfNotExisting) {<NEW_LINE>// create node and return it<NEW_LINE>T newNode = app.create(type, attributes);<NEW_LINE>if (newNode != null) {<NEW_LINE>return newNode;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>errorMessage = "No node found for the given properties and auto-creation not enabled";<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>final T relatedNode = getTypedResult(result.get(0), type);<NEW_LINE>if (!attributes.isEmpty()) {<NEW_LINE>// set properties on related node?<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return relatedNode;<NEW_LINE>default:<NEW_LINE>errorMessage = "Found " + size + " nodes for given type and properties, property set is ambiguous";<NEW_LINE>logger.error(errorMessage + ". This is often due to wrong modeling, or you should consider creating a uniquness constraint for " + type.getName(), size);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>throw new FrameworkException(404, errorMessage, new PropertiesNotFoundToken(type.getSimpleName(), null, attributes));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | setProperties(securityContext, relatedNode, attributes); |
34,139 | protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {<NEW_LINE>final SyndEntry syndEntry = <MASK><NEW_LINE>// adding native feed author to DC creators list<NEW_LINE>final String author = item.getAuthor();<NEW_LINE>if (author != null) {<NEW_LINE>final List<String> creators = ((DCModule) syndEntry.getModule(DCModule.URI)).getCreators();<NEW_LINE>if (!creators.contains(author)) {<NEW_LINE>// using a set to remove duplicates<NEW_LINE>final Set<String> s = new LinkedHashSet<String>();<NEW_LINE>// DC creators<NEW_LINE>s.addAll(creators);<NEW_LINE>// feed native author<NEW_LINE>s.add(author);<NEW_LINE>creators.clear();<NEW_LINE>creators.addAll(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Guid guid = item.getGuid();<NEW_LINE>final String itemLink = item.getLink();<NEW_LINE>if (guid != null) {<NEW_LINE>final String guidValue = guid.getValue();<NEW_LINE>syndEntry.setUri(guidValue);<NEW_LINE>if (itemLink == null && guid.isPermaLink()) {<NEW_LINE>syndEntry.setLink(guidValue);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>syndEntry.setUri(itemLink);<NEW_LINE>}<NEW_LINE>if (item.getComments() != null) {<NEW_LINE>final SyndLinkImpl comments = new SyndLinkImpl();<NEW_LINE>comments.setRel("comments");<NEW_LINE>comments.setHref(item.getComments());<NEW_LINE>comments.setType("text/html");<NEW_LINE>}<NEW_LINE>return syndEntry;<NEW_LINE>} | super.createSyndEntry(item, preserveWireItem); |
1,650,598 | final DeleteGroupResult executeDeleteGroup(DeleteGroupRequest deleteGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteGroupRequest> request = null;<NEW_LINE>Response<DeleteGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteGroupRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Greengrass");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteGroupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteGroup"); |
1,054,547 | private void rebuildMenu() {<NEW_LINE>List<TrayMenuItem> menu = new ArrayList<>();<NEW_LINE>menu.add(new ActionItem(resourceBundle.getString("traymenu.showMainWindow"), this::showMainWindow));<NEW_LINE>menu.add(new ActionItem(resourceBundle.getString("traymenu.showPreferencesWindow"), this::showPreferencesWindow));<NEW_LINE>menu.add(new SeparatorItem());<NEW_LINE>for (Vault vault : vaults) {<NEW_LINE>List<TrayMenuItem> submenu = buildSubmenu(vault);<NEW_LINE>var label = vault.isUnlocked() ? "* ".concat(vault.getDisplayName()) : vault.getDisplayName();<NEW_LINE>menu.add(new SubMenuItem(label, submenu));<NEW_LINE>}<NEW_LINE>menu.add(new SeparatorItem());<NEW_LINE>menu.add(new ActionItem(resourceBundle.getString("traymenu.lockAllVaults"), this::lockAllVaults, vaults.stream().anyMatch(Vault::isUnlocked)));<NEW_LINE>menu.add(new ActionItem(resourceBundle.getString(<MASK><NEW_LINE>try {<NEW_LINE>trayMenu.updateTrayMenu(menu);<NEW_LINE>} catch (TrayMenuException e) {<NEW_LINE>LOG.error("Updating tray menu failed", e);<NEW_LINE>}<NEW_LINE>} | "traymenu.quitApplication"), this::quitApplication)); |
962,752 | private String prepare() {<NEW_LINE>String sqlForExecute = sourceSql;<NEW_LINE>if (SqlUtil.isGlobal(indexResiding)) {<NEW_LINE>// generate CREATE INDEX for executing on MySQL<NEW_LINE>SqlPrettyWriter writer = new SqlPrettyWriter(MysqlSqlDialect.DEFAULT);<NEW_LINE>writer.setAlwaysUseParentheses(true);<NEW_LINE>writer.setSelectListItemsOnSeparateLines(false);<NEW_LINE>writer.setIndentation(0);<NEW_LINE>final int leftPrec = getOperator().getLeftPrec();<NEW_LINE>final int rightPrec = getOperator().getRightPrec();<NEW_LINE>unparse(writer, leftPrec, rightPrec, indexResiding, true);<NEW_LINE>sqlForExecute = writer.toSqlString().getSql();<NEW_LINE>}<NEW_LINE>List<SQLStatement> statementList = SQLUtils.parseStatements(sqlForExecute, JdbcConstants.MYSQL);<NEW_LINE>SQLCreateIndexStatement stmt = (<MASK><NEW_LINE>Set<String> shardKeys = new HashSet<>();<NEW_LINE>if (this.name instanceof SqlDynamicParam) {<NEW_LINE>StringBuilder sql = new StringBuilder();<NEW_LINE>MySqlOutputVisitor questionarkTableSource = new MySqlOutputVisitor(sql) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void printTableSourceExpr(SQLExpr expr) {<NEW_LINE>print("?");<NEW_LINE>}<NEW_LINE>};<NEW_LINE>questionarkTableSource.visit(stmt);<NEW_LINE>return sql.toString();<NEW_LINE>}<NEW_LINE>return stmt.toString();<NEW_LINE>} | SQLCreateIndexStatement) statementList.get(0); |
108,658 | public UpdateNetworkProfileResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateNetworkProfileResult updateNetworkProfileResult = new UpdateNetworkProfileResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return updateNetworkProfileResult;<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("networkProfile", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateNetworkProfileResult.setNetworkProfile(NetworkProfileJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return updateNetworkProfileResult;<NEW_LINE>} | ().unmarshall(context)); |
375,659 | private void restoreSession(int tabIndex) {<NEW_LINE>String session_str = prefs.getIdeSession();<NEW_LINE>if (session_str == null && loadScripts == null && macOpenFiles == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<File> filesToLoad = new ArrayList<File>();<NEW_LINE>if (macOpenFiles != null) {<NEW_LINE>for (File f : macOpenFiles) {<NEW_LINE>filesToLoad.add(f);<NEW_LINE>restoreScriptFromSession(f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (session_str != null) {<NEW_LINE>String[] <MASK><NEW_LINE>for (int i = 0; i < filenames.length; i++) {<NEW_LINE>if (filenames[i].isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>File f = new File(filenames[i]);<NEW_LINE>if (f.exists() && !filesToLoad.contains(f)) {<NEW_LINE>Debug.log(3, "restore session: %s", f);<NEW_LINE>filesToLoad.add(f);<NEW_LINE>restoreScriptFromSession(f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (loadScripts != null) {<NEW_LINE>for (int i = 0; i < loadScripts.length; i++) {<NEW_LINE>if (loadScripts[i].isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>File f = new File(loadScripts[i]);<NEW_LINE>if (f.exists() && !filesToLoad.contains(f)) {<NEW_LINE>Debug.log(3, "preload script: %s", f);<NEW_LINE>filesToLoad.add(f);<NEW_LINE>restoreScriptFromSession(f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | filenames = session_str.split(";"); |
608,595 | public Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {<NEW_LINE>com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.<MASK><NEW_LINE>while (true) {<NEW_LINE>int tag = input.readTag();<NEW_LINE>switch(tag) {<NEW_LINE>case 0:<NEW_LINE>this.setUnknownFields(unknownFields.build());<NEW_LINE>return this;<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {<NEW_LINE>this.setUnknownFields(unknownFields.build());<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case 10:<NEW_LINE>{<NEW_LINE>setKey(input.readBytes());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case 18:<NEW_LINE>{<NEW_LINE>voldemort.client.protocol.pb.VProto.VectorClock.Builder subBuilder = voldemort.client.protocol.pb.VProto.VectorClock.newBuilder();<NEW_LINE>if (hasVersion()) {<NEW_LINE>subBuilder.mergeFrom(getVersion());<NEW_LINE>}<NEW_LINE>input.readMessage(subBuilder, extensionRegistry);<NEW_LINE>setVersion(subBuilder.buildPartial());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | newBuilder(this.getUnknownFields()); |
1,203,103 | LoadBalancerTransformation computeListenerTransformation(LoadBalancerListener.Listener listener, Ip loadBalancerIp, Set<String> enabledTargetZones, Region region, Warnings warnings) {<NEW_LINE>try {<NEW_LINE>HeaderSpace matchHeaderSpace = listener.getMatchingHeaderSpace();<NEW_LINE>Optional<DefaultAction> forwardingAction = listener.getDefaultActions().stream().filter(defaultAction -> defaultAction.getType() == ActionType.FORWARD).findFirst();<NEW_LINE>if (!forwardingAction.isPresent()) {<NEW_LINE>warnings.redFlag(String.format("No forwarding action found for listener %s of load balancer %s (%s)", listener, _arn, _name));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TransformationStep transformationStep = computeTargetGroupTransformationStep(forwardingAction.get().getTargetGroupArn(), loadBalancerIp, enabledTargetZones, region, warnings);<NEW_LINE>if (transformationStep == null) {<NEW_LINE>// no need to warn here. computerTargetGroupTransformationStep does it<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return new LoadBalancerTransformation(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>warnings.redFlag(String.format("Failed to compute listener transformation for listener %s of load balancer %s (%s):" + " %s", listener, _arn, _name, Throwables.getStackTraceAsString(e)));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | new MatchHeaderSpace(matchHeaderSpace), transformationStep); |
618,216 | protected void addPropertyFormatter(ActionEvent evt) {<NEW_LINE>TreePath tpath = null;<NEW_LINE>Object path = null;<NEW_LINE>tpath = getTreePath(evt);<NEW_LINE>int parentIndex = -1;<NEW_LINE>if (tpath != null) {<NEW_LINE>for (parentIndex = tpath.getPathCount() - 1; parentIndex >= 0; parentIndex--) {<NEW_LINE>Object p = tpath.getPathComponent(parentIndex);<NEW_LINE>if (p instanceof MondrianGuiDef.Property) {<NEW_LINE>path = p;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (path == null) {<NEW_LINE>JOptionPane.showMessageDialog(this, getResourceConverter().getString("schemaExplorer.propertyNotSelected.alert", "Property not selected."), alert, JOptionPane.WARNING_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final MondrianGuiDef.PropertyFormatter formatter = new MondrianGuiDef.PropertyFormatter();<NEW_LINE>final MondrianGuiDef.Property parent = (MondrianGuiDef.Property) path;<NEW_LINE>parent.propertyFormatter = formatter;<NEW_LINE>Object[] parentPathObjs <MASK><NEW_LINE>for (int i = 0; i <= parentIndex; i++) {<NEW_LINE>parentPathObjs[i] = tpath.getPathComponent(i);<NEW_LINE>}<NEW_LINE>TreePath parentPath = new TreePath(parentPathObjs);<NEW_LINE>tree.setSelectionPath(parentPath.pathByAddingChild(formatter));<NEW_LINE>refreshTree(tree.getSelectionPath());<NEW_LINE>setTableCellFocus(0);<NEW_LINE>} | = new Object[parentIndex + 1]; |
1,765,556 | private HttpRequest.Builder testJsonFormDataRequestBuilder(String param, String param2) throws ApiException {<NEW_LINE>// verify the required parameter 'param' is set<NEW_LINE>if (param == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'param2' is set<NEW_LINE>if (param2 == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");<NEW_LINE>}<NEW_LINE>HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();<NEW_LINE>String localVarPath = "/fake/jsonFormData";<NEW_LINE>localVarRequestBuilder.uri(URI<MASK><NEW_LINE>localVarRequestBuilder.header("Accept", "application/json");<NEW_LINE>localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());<NEW_LINE>if (memberVarReadTimeout != null) {<NEW_LINE>localVarRequestBuilder.timeout(memberVarReadTimeout);<NEW_LINE>}<NEW_LINE>if (memberVarInterceptor != null) {<NEW_LINE>memberVarInterceptor.accept(localVarRequestBuilder);<NEW_LINE>}<NEW_LINE>return localVarRequestBuilder;<NEW_LINE>} | .create(memberVarBaseUri + localVarPath)); |
860,725 | private void atForStmnt(Stmnt st) throws CompileError {<NEW_LINE>List<Integer> prevBreakList = breakList;<NEW_LINE>List<Integer> prevContList = continueList;<NEW_LINE>breakList = new ArrayList<Integer>();<NEW_LINE>continueList = new ArrayList<Integer>();<NEW_LINE>Stmnt init = (Stmnt) st.head();<NEW_LINE>ASTList p = st.tail();<NEW_LINE>ASTree expr = p.head();<NEW_LINE>p = p.tail();<NEW_LINE>Stmnt update = (Stmnt) p.head();<NEW_LINE>Stmnt body = <MASK><NEW_LINE>if (init != null)<NEW_LINE>init.accept(this);<NEW_LINE>int pc = bytecode.currentPc();<NEW_LINE>int pc2 = 0;<NEW_LINE>if (expr != null) {<NEW_LINE>if (compileBooleanExpr(false, expr)) {<NEW_LINE>// in case of "for (...; false; ...)"<NEW_LINE>continueList = prevContList;<NEW_LINE>breakList = prevBreakList;<NEW_LINE>hasReturned = false;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>pc2 = bytecode.currentPc();<NEW_LINE>bytecode.addIndex(0);<NEW_LINE>}<NEW_LINE>if (body != null)<NEW_LINE>body.accept(this);<NEW_LINE>int pc3 = bytecode.currentPc();<NEW_LINE>if (update != null)<NEW_LINE>update.accept(this);<NEW_LINE>bytecode.addOpcode(Opcode.GOTO);<NEW_LINE>bytecode.addIndex(pc - bytecode.currentPc() + 1);<NEW_LINE>int pc4 = bytecode.currentPc();<NEW_LINE>if (expr != null)<NEW_LINE>bytecode.write16bit(pc2, pc4 - pc2 + 1);<NEW_LINE>patchGoto(breakList, pc4);<NEW_LINE>patchGoto(continueList, pc3);<NEW_LINE>continueList = prevContList;<NEW_LINE>breakList = prevBreakList;<NEW_LINE>hasReturned = false;<NEW_LINE>} | (Stmnt) p.tail(); |
1,101,956 | public boolean levelCheckSubnodes(int iter, LevelNode[] sub) {<NEW_LINE>if (this.levelChecked >= iter)<NEW_LINE>return this.levelCorrect;<NEW_LINE>this.levelChecked = iter;<NEW_LINE>for (int i = 0; i < sub.length; i++) {<NEW_LINE>if (// && (sub[i].getKind() != InstanceKind)<NEW_LINE>(sub[i].getKind() != ModuleKind) && (sub[i].getKind() != ModuleInstanceKind)) {<NEW_LINE>this.levelCorrect = sub[i].levelCheck(iter) && this.levelCorrect;<NEW_LINE>if (this.level < sub[i].getLevel()) {<NEW_LINE>this.level = sub[i].getLevel();<NEW_LINE>}<NEW_LINE>;<NEW_LINE>this.levelParams.addAll(sub<MASK><NEW_LINE>this.levelConstraints.putAll(sub[i].getLevelConstraints());<NEW_LINE>this.argLevelConstraints.putAll(sub[i].getArgLevelConstraints());<NEW_LINE>this.argLevelParams.addAll(sub[i].getArgLevelParams());<NEW_LINE>this.allParams.addAll(sub[i].getAllParams());<NEW_LINE>this.nonLeibnizParams.addAll(sub[i].getNonLeibnizParams());<NEW_LINE>}<NEW_LINE>;<NEW_LINE>}<NEW_LINE>;<NEW_LINE>return this.levelCorrect;<NEW_LINE>} | [i].getLevelParams()); |
499,300 | public boolean onCreateOptionsMenu(Menu menu) {<NEW_LINE>super.onCreateOptionsMenu(menu);<NEW_LINE>menu.add(0, MENU_DELETE, <MASK><NEW_LINE>SubMenu enqueueMenu = menu.addSubMenu(0, MENU_ENQUEUE, 30, R.string.enqueue_current);<NEW_LINE>SubMenu moreMenu = menu.addSubMenu(0, MENU_MORE, 30, R.string.more_from_current);<NEW_LINE>menu.addSubMenu(0, MENU_ADD_TO_PLAYLIST, 30, R.string.add_to_playlist);<NEW_LINE>menu.add(0, MENU_SHARE, 30, R.string.share);<NEW_LINE>if (PluginUtils.checkPlugins(this)) {<NEW_LINE>menu.add(0, MENU_PLUGINS, 30, R.string.plugins).setIcon(R.drawable.plugin).setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);<NEW_LINE>}<NEW_LINE>mFavorites = menu.add(0, MENU_SONG_FAVORITE, 0, R.string.add_to_favorites).setIcon(R.drawable.btn_rating_star_off_mtrl_alpha).setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);<NEW_LINE>// Subitems of 'enqueue...'<NEW_LINE>enqueueMenu.add(0, MENU_ENQUEUE_ALBUM, 30, R.string.album);<NEW_LINE>enqueueMenu.add(0, MENU_ENQUEUE_ARTIST, 30, R.string.artist);<NEW_LINE>enqueueMenu.add(0, MENU_ENQUEUE_GENRE, 30, R.string.genre);<NEW_LINE>// Subitems of 'more from...'<NEW_LINE>moreMenu.add(0, MENU_MORE_ALBUM, 30, R.string.album);<NEW_LINE>moreMenu.add(0, MENU_MORE_ARTIST, 30, R.string.artist);<NEW_LINE>moreMenu.add(0, MENU_MORE_GENRE, 30, R.string.genre);<NEW_LINE>moreMenu.add(0, MENU_MORE_FOLDER, 30, R.string.folder);<NEW_LINE>// ensure that mFavorites is updated<NEW_LINE>mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO);<NEW_LINE>return true;<NEW_LINE>} | 30, R.string.delete); |
16,796 | private void initializeButtons() {<NEW_LINE>SVGGlyph full = new SVGGlyph(0, "FULLSCREEN", "M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z", Color.WHITE);<NEW_LINE>full.setSize(16, 16);<NEW_LINE>SVGGlyph minus = new SVGGlyph(0, <MASK><NEW_LINE>minus.setSize(12, 2);<NEW_LINE>minus.setTranslateY(4);<NEW_LINE>SVGGlyph resizeMax = new SVGGlyph(0, "RESIZE_MAX", "M726 810v-596h-428v596h428zM726 44q34 0 59 25t25 59v768q0 34-25 60t-59 26h-428q-34 0-59-26t-25-60v-768q0-34 25-60t59-26z", Color.WHITE);<NEW_LINE>resizeMax.setSize(12, 12);<NEW_LINE>SVGGlyph resizeMin = new SVGGlyph(0, "RESIZE_MIN", "M80.842 943.158v-377.264h565.894v377.264h-565.894zM0 404.21v619.79h727.578v-619.79h-727.578zM377.264 161.684h565.894v377.264h-134.736v80.842h215.578v-619.79h-727.578v323.37h80.842v-161.686z", Color.WHITE);<NEW_LINE>resizeMin.setSize(12, 12);<NEW_LINE>SVGGlyph close = new SVGGlyph(0, "CLOSE", "M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z", Color.WHITE);<NEW_LINE>close.setSize(12, 12);<NEW_LINE>btnFull = new JFXButton();<NEW_LINE>btnFull.getStyleClass().add("jfx-decorator-button");<NEW_LINE>btnFull.setCursor(Cursor.HAND);<NEW_LINE>btnFull.setOnAction((action) -> primaryStage.setFullScreen(!primaryStage.isFullScreen()));<NEW_LINE>btnFull.setGraphic(full);<NEW_LINE>btnFull.setTranslateX(-30);<NEW_LINE>btnFull.setRipplerFill(Color.WHITE);<NEW_LINE>btnClose = new JFXButton();<NEW_LINE>btnClose.getStyleClass().add("jfx-decorator-button");<NEW_LINE>btnClose.setCursor(Cursor.HAND);<NEW_LINE>btnClose.setOnAction((action) -> onCloseButtonAction.get().run());<NEW_LINE>btnClose.setGraphic(close);<NEW_LINE>btnClose.setRipplerFill(Color.WHITE);<NEW_LINE>btnMin = new JFXButton();<NEW_LINE>btnMin.getStyleClass().add("jfx-decorator-button");<NEW_LINE>btnMin.setCursor(Cursor.HAND);<NEW_LINE>btnMin.setOnAction((action) -> primaryStage.setIconified(true));<NEW_LINE>btnMin.setGraphic(minus);<NEW_LINE>btnMin.setRipplerFill(Color.WHITE);<NEW_LINE>btnMax = new JFXButton();<NEW_LINE>btnMax.getStyleClass().add("jfx-decorator-button");<NEW_LINE>btnMax.setCursor(Cursor.HAND);<NEW_LINE>btnMax.setRipplerFill(Color.WHITE);<NEW_LINE>btnMax.setOnAction((action) -> maximize(resizeMin, resizeMax));<NEW_LINE>btnMax.setGraphic(resizeMax);<NEW_LINE>} | "MINUS", "M804.571 420.571v109.714q0 22.857-16 38.857t-38.857 16h-694.857q-22.857 0-38.857-16t-16-38.857v-109.714q0-22.857 16-38.857t38.857-16h694.857q22.857 0 38.857 16t16 38.857z", Color.WHITE); |
1,488,557 | private void checkSourceDownloads() {<NEW_LINE>MavenSettings.DownloadStrategy ds = MavenSettings.getDefault().getSourceDownloadStrategy();<NEW_LINE>if (ds.equals(MavenSettings.DownloadStrategy.NEVER)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>NbMavenProject watcher = proj.getLookup().lookup(NbMavenProject.class);<NEW_LINE>Preferences prefs = ProjectUtils.getPreferences(<MASK><NEW_LINE>if (ds.equals(MavenSettings.DownloadStrategy.EVERY_OPEN)) {<NEW_LINE>watcher.triggerSourceJavadocDownload(false);<NEW_LINE>prefs.putBoolean(PROP_SOURCE_CHECKED, true);<NEW_LINE>try {<NEW_LINE>prefs.sync();<NEW_LINE>} catch (BackingStoreException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>} else if (ds.equals(MavenSettings.DownloadStrategy.FIRST_OPEN)) {<NEW_LINE>boolean alreadyChecked = prefs.getBoolean(PROP_SOURCE_CHECKED, false);<NEW_LINE>if (!alreadyChecked) {<NEW_LINE>watcher.triggerSourceJavadocDownload(false);<NEW_LINE>prefs.putBoolean(PROP_SOURCE_CHECKED, true);<NEW_LINE>try {<NEW_LINE>prefs.sync();<NEW_LINE>} catch (BackingStoreException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | proj, NbMavenProject.class, false); |
1,566,247 | boolean moveRight(int chars, boolean fromBeginning) {<NEW_LINE>if (fromBeginning) {<NEW_LINE>firstColumnToDisplay = 0;<NEW_LINE>offsetInLine = 0;<NEW_LINE>column = 0;<NEW_LINE>chars = Math.min(chars, length(getLine(line)));<NEW_LINE>}<NEW_LINE>boolean ret = true;<NEW_LINE>while (--chars >= 0) {<NEW_LINE>int len <MASK><NEW_LINE>if (offsetInLine + column + 1 <= len) {<NEW_LINE>moveToChar(offsetInLine + column + 1, CursorMovement.RIGHT);<NEW_LINE>} else if (getLine(line + 1) != null) {<NEW_LINE>line++;<NEW_LINE>firstColumnToDisplay = 0;<NEW_LINE>offsetInLine = 0;<NEW_LINE>column = 0;<NEW_LINE>} else {<NEW_LINE>eof();<NEW_LINE>ret = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>wantedColumn = column;<NEW_LINE>ensureCursorVisible();<NEW_LINE>return ret;<NEW_LINE>} | = length(getLine(line)); |
786,201 | final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(untagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UntagResourceRequest> request = null;<NEW_LINE>Response<UntagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));<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, "Elastic Inference");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,451,748 | public void layout() {<NEW_LINE>Drawable bg = style.background;<NEW_LINE>BitmapFont font = style.font;<NEW_LINE>if (bg != null) {<NEW_LINE>prefHeight = Math.max(bg.getTopHeight() + bg.getBottomHeight() + font.getCapHeight() - font.getDescent() * 2, bg.getMinHeight());<NEW_LINE>} else<NEW_LINE>prefHeight = font.getCapHeight() - font.getDescent() * 2;<NEW_LINE>Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class);<NEW_LINE>GlyphLayout layout = layoutPool.obtain();<NEW_LINE>if (selectedPrefWidth) {<NEW_LINE>prefWidth = 0;<NEW_LINE>if (bg != null)<NEW_LINE>prefWidth = bg.getLeftWidth() + bg.getRightWidth();<NEW_LINE>T selected = getSelected();<NEW_LINE>if (selected != null) {<NEW_LINE>layout.setText(font, toString(selected));<NEW_LINE>prefWidth += layout.width;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>float maxItemWidth = 0;<NEW_LINE>for (int i = 0; i < items.size; i++) {<NEW_LINE>layout.setText(font, toString(items.get(i)));<NEW_LINE>maxItemWidth = Math.max(layout.width, maxItemWidth);<NEW_LINE>}<NEW_LINE>prefWidth = maxItemWidth;<NEW_LINE>if (bg != null)<NEW_LINE>prefWidth = Math.max(prefWidth + bg.getLeftWidth() + bg.getRightWidth(<MASK><NEW_LINE>ListStyle listStyle = style.listStyle;<NEW_LINE>ScrollPaneStyle scrollStyle = style.scrollStyle;<NEW_LINE>float scrollWidth = maxItemWidth + listStyle.selection.getLeftWidth() + listStyle.selection.getRightWidth();<NEW_LINE>bg = scrollStyle.background;<NEW_LINE>if (bg != null)<NEW_LINE>scrollWidth = Math.max(scrollWidth + bg.getLeftWidth() + bg.getRightWidth(), bg.getMinWidth());<NEW_LINE>if (scrollPane == null || !scrollPane.disableY) {<NEW_LINE>scrollWidth += Math.max(style.scrollStyle.vScroll != null ? style.scrollStyle.vScroll.getMinWidth() : 0, style.scrollStyle.vScrollKnob != null ? style.scrollStyle.vScrollKnob.getMinWidth() : 0);<NEW_LINE>}<NEW_LINE>prefWidth = Math.max(prefWidth, scrollWidth);<NEW_LINE>}<NEW_LINE>layoutPool.free(layout);<NEW_LINE>} | ), bg.getMinWidth()); |
1,110,364 | public com.amazonaws.services.databasemigrationservice.model.S3AccessDeniedException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.databasemigrationservice.model.S3AccessDeniedException s3AccessDeniedException = new com.amazonaws.services.<MASK><NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 s3AccessDeniedException;<NEW_LINE>} | databasemigrationservice.model.S3AccessDeniedException(null); |
1,783,280 | public void open(JMXServiceURL url) throws JmxException {<NEW_LINE>// in case a connection is already open<NEW_LINE>this.close();<NEW_LINE>try {<NEW_LINE>if (LOG.isLoggable(Level.INFO)) {<NEW_LINE>LOG.info("Establishing a JMX conection to URL: " + url);<NEW_LINE>}<NEW_LINE>this.jmxConnector = JMXConnectorFactory.connect(url);<NEW_LINE>this.connectionId = this.jmxConnector.getConnectionId();<NEW_LINE>this.mbsc = this.jmxConnector.getMBeanServerConnection();<NEW_LINE>if (LOG.isLoggable(Level.INFO)) {<NEW_LINE>LOG.<MASK><NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>// something's wrong with the connection, disconnect immediately and throw an exception<NEW_LINE>try {<NEW_LINE>this.close();<NEW_LINE>} catch (Exception e1) {<NEW_LINE>// don't throw this exception, throw the original exception<NEW_LINE>if (LOG.isLoggable(Level.FINE)) {<NEW_LINE>LOG.log(Level.FINE, "Failed to close a JMX connection after a connection attempt failed", e1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new JmxException("Failed to establish a JMX connection to URL: " + url.toString(), e);<NEW_LINE>}<NEW_LINE>} | info("Connection established! ID: " + this.connectionId); |
301,227 | void exportAuthFile(ServicePrincipalImpl servicePrincipal) {<NEW_LINE>if (authFile == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AzureEnvironment environment = AzureEnvironment.AZURE;<NEW_LINE>StringBuilder builder = new StringBuilder("{\n");<NEW_LINE>builder.append(" ").append(String.format("\"clientId\": \"%s\",", servicePrincipal.applicationId())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"clientCertificate\": \"%s\",", privateKeyPath.replace("\\", "\\\\"))).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"clientCertificatePassword\": \"%s\",", privateKeyPassword)).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"tenantId\": \"%s\",", servicePrincipal.manager().tenantId())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"subscriptionId\": \"%s\",", servicePrincipal.<MASK><NEW_LINE>builder.append(" ").append(String.format("\"activeDirectoryEndpointUrl\": \"%s\",", environment.getActiveDirectoryEndpoint())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"resourceManagerEndpointUrl\": \"%s\",", environment.getResourceManagerEndpoint())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"activeDirectoryGraphResourceId\": \"%s\",", environment.getGraphEndpoint())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"managementEndpointUrl\": \"%s\"", environment.getManagementEndpoint())).append("\n");<NEW_LINE>builder.append("}");<NEW_LINE>try {<NEW_LINE>authFile.write(builder.toString().getBytes(StandardCharsets.UTF_8));<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw logger.logExceptionAsError(new RuntimeException(e));<NEW_LINE>}<NEW_LINE>} | assignedSubscription)).append("\n"); |
1,576,347 | public Job updateWorkspaceFolders(Collection<IPath> addedRootPaths, Collection<IPath> removedRootPaths) {<NEW_LINE>JavaLanguageServerPlugin.sendStatus(ServiceStatus.Message, "Updating workspace folders: Adding " + addedRootPaths.size() + " folder(s), removing " + removedRootPaths.size() + " folders.");<NEW_LINE>Job[] removedJobs = Job.getJobManager().find(removedRootPaths);<NEW_LINE>for (Job removedJob : removedJobs) {<NEW_LINE>if (removedJob.belongsTo(IConstants.UPDATE_WORKSPACE_FOLDERS_FAMILY) || removedJob.belongsTo(BaseInitHandler.JAVA_LS_INITIALIZATION_JOBS)) {<NEW_LINE>removedJob.cancel();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>WorkspaceJob job = new WorkspaceJob("Updating workspace folders") {<NEW_LINE><NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>@Override<NEW_LINE>public boolean belongsTo(Object family) {<NEW_LINE>Collection<IPath> addedRootPathsSet = addedRootPaths.stream().collect(Collectors.toSet());<NEW_LINE>boolean equalToRootPaths = false;<NEW_LINE>if (family instanceof Collection<?>) {<NEW_LINE>equalToRootPaths = addedRootPathsSet.equals(((Collection<IPath>) family).stream().collect(Collectors.toSet()));<NEW_LINE>}<NEW_LINE>return IConstants.UPDATE_WORKSPACE_FOLDERS_FAMILY.equals(family) || IConstants.JOBS_FAMILY.equals(family) || equalToRootPaths;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public IStatus runInWorkspace(IProgressMonitor monitor) {<NEW_LINE>IStatus status = Status.OK_STATUS;<NEW_LINE>SubMonitor subMonitor = SubMonitor.convert(monitor, addedRootPaths.size() + removedRootPaths.size());<NEW_LINE>try {<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>IProject[] projects = getWorkspaceRoot().getProjects();<NEW_LINE>for (IProject project : projects) {<NEW_LINE>if (ResourceUtils.isContainedIn(project.getLocation(), removedRootPaths)) {<NEW_LINE>try {<NEW_LINE>project.delete(false, true, subMonitor.split(1));<NEW_LINE>} catch (CoreException e) {<NEW_LINE>JavaLanguageServerPlugin.logException("Problems removing '" + project.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>importProjects(addedRootPaths, subMonitor.split(addedRootPaths.size()));<NEW_LINE>registerWatchers(true);<NEW_LINE>long elapsed = System.currentTimeMillis() - start;<NEW_LINE>JavaLanguageServerPlugin.logInfo("Updated workspace folders in " + elapsed + " ms: Added " + addedRootPaths.size() + " folder(s), removed" + removedRootPaths.size() + " folders.");<NEW_LINE>JavaLanguageServerPlugin.logInfo(getWorkspaceInfo());<NEW_LINE>return Status.OK_STATUS;<NEW_LINE>} catch (CoreException e) {<NEW_LINE>String msg = "Error updating workspace folders";<NEW_LINE>JavaLanguageServerPlugin.logError(msg);<NEW_LINE>status = StatusFactory.newErrorStatus(msg, e);<NEW_LINE>}<NEW_LINE>cleanInvalidProjects(preferenceManager.getPreferences().getRootPaths(), monitor);<NEW_LINE>return status;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>job.setRule(getWorkspaceRoot());<NEW_LINE>job.schedule();<NEW_LINE>return job;<NEW_LINE>} | getName() + "' from workspace.", e); |
1,654,002 | public int compareTo(remove_aggregate_args other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetMid()).<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetMid()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mid, other.mid);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetAggregateName()).compareTo(other.isSetAggregateName());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetAggregateName()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aggregate_name, other.aggregate_name);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | compareTo(other.isSetMid()); |
283,617 | public UTTimerEvent addPeriodicEvent(long periodic_millis, final UTTimerEventPerformer ext_performer) {<NEW_LINE>if (destroyed) {<NEW_LINE>throw (new RuntimeException("Timer has been destroyed"));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>TimerEventPerformer performer = new TimerEventPerformer() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void perform(TimerEvent ev) {<NEW_LINE>UtilitiesImpl.callWithPluginThreadContext(plugin_interface, new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>res.perform(ext_performer);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.out("Plugin '" + plugin_interface.getPluginName() + " (" + plugin_interface.getPluginID() + " " + plugin_interface.getPluginVersion() + ") caused an error while processing a timer event", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>};<NEW_LINE>if (timer == null) {<NEW_LINE>res.setEvent(SimpleTimer.addPeriodicEvent("Plugin:" + ext_performer.getClass(), periodic_millis, performer));<NEW_LINE>} else {<NEW_LINE>res.setEvent(timer.addPeriodicEvent("Plugin:" + ext_performer.getClass(), periodic_millis, performer));<NEW_LINE>}<NEW_LINE>return (res);<NEW_LINE>} | final timerEvent res = new timerEvent(); |
1,066,998 | private void safeCopyExternalAssetsToPluginAssetRoot(final String pluginAssetsRoot) {<NEW_LINE>Path externalAssetsPath = Paths.get(systemEnvironment.get(SystemEnvironment.GO_ANALYTICS_PLUGIN_EXTERNAL_ASSETS));<NEW_LINE>if (!Files.exists(externalAssetsPath) || !Files.isDirectory(externalAssetsPath)) {<NEW_LINE>LOGGER.debug("Analytics plugin external assets path ({}) does not exist or is not a directory. Not loading any assets.", externalAssetsPath);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Files.list(externalAssetsPath).forEach(path -> {<NEW_LINE>try {<NEW_LINE>Files.copy(path, Paths.get(pluginAssetsRoot, path.getFileName().toString()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.<MASK><NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Unable to list files in analytics plugin external assets location ({}).", externalAssetsPath, e);<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | error("Unable to copy analytics plugin external asset ({}) to plugin assets root.", path, e); |
1,444,188 | public static void gameRenderTick() {<NEW_LINE>Minecraft mc = Minecraft.getInstance();<NEW_LINE>BlockPos pos = mc.player.blockPosition();<NEW_LINE>if (!AllBlocks.TURNTABLE.has(mc.level.getBlockState(pos)))<NEW_LINE>return;<NEW_LINE>if (!mc.player.isOnGround())<NEW_LINE>return;<NEW_LINE>if (mc.isPaused())<NEW_LINE>return;<NEW_LINE>BlockEntity tileEntity = mc.level.getBlockEntity(pos);<NEW_LINE>if (!(tileEntity instanceof TurntableTileEntity))<NEW_LINE>return;<NEW_LINE>TurntableTileEntity turnTable = (TurntableTileEntity) tileEntity;<NEW_LINE>float speed = turnTable.getSpeed() * 3 / 10;<NEW_LINE>if (speed == 0)<NEW_LINE>return;<NEW_LINE>Vec3 <MASK><NEW_LINE>Vec3 offset = mc.player.position().subtract(origin);<NEW_LINE>if (offset.length() > 1 / 4f)<NEW_LINE>speed *= Mth.clamp((1 / 2f - offset.length()) * 2, 0, 1);<NEW_LINE>mc.player.setYRot(mc.player.yRotO - speed * AnimationTickHolder.getPartialTicks());<NEW_LINE>mc.player.yBodyRot = mc.player.getYRot();<NEW_LINE>} | origin = VecHelper.getCenterOf(pos); |
1,494,259 | public static void main(String[] args) {<NEW_LINE>EdgeWeightedDigraph edgeWeightedDigraph = new EdgeWeightedDigraph(9);<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge<MASK><NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(0, 2, 2));<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(1, 3, 3));<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(3, 4, -3));<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(3, 5, 4));<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(4, 6, 1));<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(5, 6, 2));<NEW_LINE>edgeWeightedDigraph.addEdge(new DirectedEdge(6, 7, 2));<NEW_LINE>AcyclicLP acyclicLP = new Exercise28_LongestPathsInDAGs().new AcyclicLP(edgeWeightedDigraph, 0);<NEW_LINE>int furthestVertex = -1;<NEW_LINE>double longestDistance = Double.NEGATIVE_INFINITY;<NEW_LINE>for (int vertex = 0; vertex < edgeWeightedDigraph.vertices(); vertex++) {<NEW_LINE>if (acyclicLP.distTo(vertex) > longestDistance) {<NEW_LINE>longestDistance = acyclicLP.distTo(vertex);<NEW_LINE>furthestVertex = vertex;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StdOut.println("Dist to 1: " + acyclicLP.distTo(1) + " Expected: 1.0");<NEW_LINE>StdOut.println("Dist to 8: " + acyclicLP.distTo(8) + " Expected: -Infinity");<NEW_LINE>StdOut.print("\nLongest path: ");<NEW_LINE>for (DirectedEdge edge : acyclicLP.pathTo(furthestVertex)) {<NEW_LINE>StdOut.print(edge.from() + "->" + edge.to() + " ");<NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 0->1 1->3 3->5 5->6 6->7");<NEW_LINE>} | (0, 1, 1)); |
413,985 | public Component createComponent() {<NEW_LINE>JScrollPane customizerScrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);<NEW_LINE>customizerScrollPane.setBorder(BorderFactory.createEmptyBorder());<NEW_LINE>customizerScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());<NEW_LINE>customizerScrollPane.setOpaque(false);<NEW_LINE>customizerScrollPane.getViewport().setOpaque(false);<NEW_LINE>String hint = <MASK><NEW_LINE>if (hint != null && !hint.isEmpty()) {<NEW_LINE>JPanel panel = new JPanel(new BorderLayout(0, 0));<NEW_LINE>panel.setOpaque(false);<NEW_LINE>panel.add(customizerScrollPane, BorderLayout.CENTER);<NEW_LINE>JTextArea area = new JTextArea(hint);<NEW_LINE>area.setOpaque(false);<NEW_LINE>area.setWrapStyleWord(true);<NEW_LINE>area.setLineWrap(true);<NEW_LINE>area.setEnabled(false);<NEW_LINE>// NOI18N<NEW_LINE>area.setFont(UIManager.getFont("Label.font"));<NEW_LINE>area.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));<NEW_LINE>panel.add(area, BorderLayout.SOUTH);<NEW_LINE>return panel;<NEW_LINE>} else {<NEW_LINE>return customizerScrollPane;<NEW_LINE>}<NEW_LINE>} | ppFactories[selectedPPFactoryIndex].getHint(); |
204,091 | private String substituteVars(String expr) {<NEW_LINE>if (expr == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Matcher match = varPat.matcher("");<NEW_LINE>String eval = expr;<NEW_LINE>int MAX_SUBST = 20;<NEW_LINE>for (int s = 0; s < MAX_SUBST; s++) {<NEW_LINE>match.reset(eval);<NEW_LINE>if (!match.find()) {<NEW_LINE>return eval;<NEW_LINE>}<NEW_LINE>String var = match.group();<NEW_LINE>// remove ${ .. }<NEW_LINE>var = var.substring(2, <MASK><NEW_LINE>String val = null;<NEW_LINE>try {<NEW_LINE>val = System.getProperty(var);<NEW_LINE>} catch (SecurityException se) {<NEW_LINE>LOG.warn("Unexpected SecurityException in Configuration", se);<NEW_LINE>}<NEW_LINE>if (val == null) {<NEW_LINE>val = getRaw(var);<NEW_LINE>}<NEW_LINE>if (val == null) {<NEW_LINE>// return literal ${var}: var is unbound<NEW_LINE>return eval;<NEW_LINE>}<NEW_LINE>// substitute<NEW_LINE>eval = eval.substring(0, match.start()) + val + eval.substring(match.end());<NEW_LINE>}<NEW_LINE>throw new IllegalStateException("Variable substitution depth too large: " + MAX_SUBST + " " + expr);<NEW_LINE>} | var.length() - 1); |
1,066,183 | final GetCloudFormationStackRecordsResult executeGetCloudFormationStackRecords(GetCloudFormationStackRecordsRequest getCloudFormationStackRecordsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCloudFormationStackRecordsRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCloudFormationStackRecordsRequest> request = null;<NEW_LINE>Response<GetCloudFormationStackRecordsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCloudFormationStackRecordsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getCloudFormationStackRecordsRequest));<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, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetCloudFormationStackRecords");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetCloudFormationStackRecordsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetCloudFormationStackRecordsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
88,456 | public void execute() throws Exception {<NEW_LINE>File quickstartTmpDir = new File(_dataDir.getAbsolutePath());<NEW_LINE>File dataDir = new File(quickstartTmpDir, "rawdata");<NEW_LINE>if (!dataDir.mkdirs()) {<NEW_LINE>printStatus(Quickstart.Color.YELLOW, "***** Bootstrapping data from existing directory *****");<NEW_LINE>} else {<NEW_LINE>printStatus(Quickstart.Color.YELLOW, "***** Creating new data directory for fresh installation *****");<NEW_LINE>}<NEW_LINE>QuickstartRunner runner = new QuickstartRunner(new ArrayList<>(), 1, 1, 1, 0, dataDir, true, getAuthToken(), getConfigOverrides(), _zkExternalAddress, false);<NEW_LINE>if (_zkExternalAddress != null) {<NEW_LINE>printStatus(Quickstart.Color.CYAN, "***** Starting controller, broker and server *****");<NEW_LINE>} else {<NEW_LINE>printStatus(<MASK><NEW_LINE>}<NEW_LINE>runner.startAll();<NEW_LINE>Runtime.getRuntime().addShutdownHook(new Thread(() -> {<NEW_LINE>try {<NEW_LINE>printStatus(Quickstart.Color.GREEN, "***** Shutting down empty quick start *****");<NEW_LINE>runner.stop();<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>waitForBootstrapToComplete(runner);<NEW_LINE>printStatus(Quickstart.Color.YELLOW, "***** Empty quickstart setup complete *****");<NEW_LINE>printStatus(Quickstart.Color.GREEN, "You can always go to http://localhost:9000 to play around in the query console");<NEW_LINE>} | Quickstart.Color.CYAN, "***** Starting Zookeeper, controller, broker and server *****"); |
1,518,822 | public void started(Container moduleContainer) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug("started");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>WebAppConfiguration webConfig = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class);<NEW_LINE>String name = webConfig.getModuleName();<NEW_LINE>SipAppDescManager appDescMangar = SipAppDescManager.getInstance();<NEW_LINE>SipAppDesc appDesc = appDescMangar.getSipAppDesc(name);<NEW_LINE>if (appDesc == null) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug("SipModuleStateListener Failed finding SipAppDesc for " + name);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String vhost = webConfig.getVirtualHostName();<NEW_LINE>appDesc.setVirtualHost(vhost, webConfig.getVirtualHostList());<NEW_LINE>List<SipServletDesc> siplets = appDesc.getSipServlets();<NEW_LINE>for (SipServletDesc sipDesc : siplets) {<NEW_LINE>// if the application contains load on startup servlets we<NEW_LINE>// need to initialize the application now.<NEW_LINE>// we can't simply use the Web Container initialization<NEW_LINE>// because of additional SIP Container properties that can<NEW_LINE>// only be set after the initialization<NEW_LINE>if (sipDesc.isServletLoadOnStartup()) {<NEW_LINE>try {<NEW_LINE>appDescMangar.initSipAppIfNeeded(name);<NEW_LINE>} catch (ServletException e) {<NEW_LINE>if (c_logger.isErrorEnabled()) {<NEW_LINE>c_logger.error("error.init.loadonstartup.app", null, e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>if (c_logger.isErrorEnabled()) {<NEW_LINE>c_logger.error("error.init.loadonstartup.app", null, e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<SipServlet> sipServletsList = appDesc.getLoadOnStartupServlets();<NEW_LINE>synchronized (sipServletsList) {<NEW_LINE>Iterator<SipServlet> iterator = sipServletsList.iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>SipServlet sipServlet = (SipServlet) iterator.next();<NEW_LINE>EventsDispatcher.sipServletInitiated(appDesc, sipServlet, webConfig.getWebApp(), -1);<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(null, "module started", "Triggering event servlet initialized, servlet name " + sipServlet.getServletName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (UnableToAdaptException e) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(null, "started", "not SipAppDesc found not a sip application: " + moduleContainer.getName(), e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (c_logger.isTraceEntryExitEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | c_logger.traceExit(null, "moduleStarted"); |
272,942 | public static Vector<Byte> listCodeTypes(boolean showCursor) {<NEW_LINE>Vector<Byte> v = new Vector<Byte>();<NEW_LINE>v.add(new Byte(DT_INT));<NEW_LINE>v.add(new Byte(DT_LONG));<NEW_LINE>v.add(new Byte(DT_SHORT));<NEW_LINE>v.add(new Byte(DT_BIGINT));<NEW_LINE>v.add(new Byte(DT_FLOAT));<NEW_LINE>v.add(new Byte(DT_DOUBLE));<NEW_LINE>v.add(new Byte(DT_DECIMAL));<NEW_LINE>v.add(new Byte(DT_DATE));<NEW_LINE>v.add(new Byte(DT_TIME));<NEW_LINE>v.add(new Byte(DT_DATETIME));<NEW_LINE>v.add(new Byte(DT_BOOLEAN));<NEW_LINE>v.add(new Byte(DT_STRING));<NEW_LINE>v.add(new Byte(DT_INT_SERIES));<NEW_LINE>v.add(new Byte(DT_LONG_SERIES));<NEW_LINE>v.add(new Byte(DT_SHORT_SERIES));<NEW_LINE>v.add(new Byte(DT_BIGINT_SERIES));<NEW_LINE>v.add(new Byte(DT_FLOAT_SERIES));<NEW_LINE>v.add(new Byte(DT_DOUBLE_SERIES));<NEW_LINE>v.add(new Byte(DT_DECIMAL_SERIES));<NEW_LINE>v.add(new Byte(DT_DATE_SERIES));<NEW_LINE>v.add(new Byte(DT_TIME_SERIES));<NEW_LINE>v.add(new Byte(DT_DATETIME_SERIES));<NEW_LINE>v.add(new Byte(DT_STRING_SERIES));<NEW_LINE>v.add(new Byte(DT_DEFAULT));<NEW_LINE>v.<MASK><NEW_LINE>if (showCursor)<NEW_LINE>v.add(new Byte(DT_CURSOR));<NEW_LINE>return v;<NEW_LINE>} | add(new Byte(DT_AUTOINCREMENT)); |
438,767 | public static void horizontal(Kernel1D_S32 kernel, InterleavedU8 src, InterleavedI8 dst) {<NEW_LINE>final byte[] dataSrc = src.data;<NEW_LINE>final byte[] dataDst = dst.data;<NEW_LINE>final int kernelWidth = kernel.getWidth();<NEW_LINE>final int offsetL = kernel.getOffset();<NEW_LINE>final int offsetR = kernelWidth - offsetL - 1;<NEW_LINE>final int width = src.getWidth();<NEW_LINE>final int height = src.getHeight();<NEW_LINE>final int numBands = src.getNumBands();<NEW_LINE>final int[] total = new int[numBands];<NEW_LINE>for (int i = 0; i < height; i++) {<NEW_LINE>int indexDst = dst.startIndex + i * dst.stride;<NEW_LINE>for (int j = 0; j < offsetL; j++) {<NEW_LINE>int indexSrc = src.startIndex + i * src.stride;<NEW_LINE>Arrays.fill(total, 0);<NEW_LINE>int weight = 0;<NEW_LINE>for (int k = offsetL - j; k < kernelWidth; k++) {<NEW_LINE>int w = kernel.data[k];<NEW_LINE>weight += w;<NEW_LINE>for (int band = 0; band < numBands; band++) {<NEW_LINE>total[band] += (dataSrc[indexSrc++] & 0xFF) * w;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int band = 0; band < numBands; band++) {<NEW_LINE>dataDst[indexDst++] = (byte) ((total[band] + weight / 2) / weight);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>indexDst = dst.startIndex + i * dst.stride <MASK><NEW_LINE>for (int j = offsetR - 1; j >= 0; j--) {<NEW_LINE>int indexSrc = src.startIndex + i * src.stride + (width - offsetL - j - 1) * numBands;<NEW_LINE>Arrays.fill(total, 0);<NEW_LINE>int weight = 0;<NEW_LINE>for (int k = 0; k <= offsetL + j; k++) {<NEW_LINE>int w = kernel.data[k];<NEW_LINE>weight += w;<NEW_LINE>for (int band = 0; band < numBands; band++) {<NEW_LINE>total[band] += (dataSrc[indexSrc++] & 0xFF) * w;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int band = 0; band < numBands; band++) {<NEW_LINE>dataDst[indexDst++] = (byte) ((total[band] + weight / 2) / weight);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | + (width - offsetR) * numBands; |
1,052,069 | private void convertChunkSourcesToModules() {<NEW_LINE>for (JSChunk chunk : compiler.getModuleGraph().getAllChunks()) {<NEW_LINE>if (chunk.getInputs().isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>CompilerInput firstInput = null;<NEW_LINE>for (CompilerInput input : chunk.getInputs()) {<NEW_LINE>Node astRoot = input.getAstRoot(compiler);<NEW_LINE>FeatureSet scriptFeatures = NodeUtil.getFeatureSetOfScript(astRoot);<NEW_LINE>checkState(!scriptFeatures.contains(FeatureSet.ES2015_MODULES));<NEW_LINE>if (firstInput == null) {<NEW_LINE>firstInput = input;<NEW_LINE>scriptFeatures = scriptFeatures.union(FeatureSet.ES2015_MODULES);<NEW_LINE>astRoot.putProp(Node.FEATURE_SET, scriptFeatures);<NEW_LINE>Node moduleBody = new Node(Token.MODULE_BODY);<NEW_LINE>moduleBody.srcref(astRoot);<NEW_LINE>moduleBody.addChildrenToFront(astRoot.removeChildren());<NEW_LINE>astRoot.addChildToFront(moduleBody);<NEW_LINE>compiler.reportChangeToEnclosingScope(moduleBody);<NEW_LINE>} else {<NEW_LINE>Node <MASK><NEW_LINE>FeatureSet firstInputScriptFeatures = NodeUtil.getFeatureSetOfScript(firstInputAstRoot);<NEW_LINE>FeatureSet combinedFeatureSet = firstInputScriptFeatures.union(NodeUtil.getFeatureSetOfScript(astRoot));<NEW_LINE>astRoot.putProp(Node.FEATURE_SET, combinedFeatureSet);<NEW_LINE>Node moduleBody = firstInputAstRoot.getFirstChild();<NEW_LINE>checkState(moduleBody != null && moduleBody.isModuleBody());<NEW_LINE>moduleBody.addChildrenToBack(astRoot.removeChildren());<NEW_LINE>compiler.reportChangeToEnclosingScope(firstInputAstRoot);<NEW_LINE>compiler.reportChangeToChangeScope(astRoot);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | firstInputAstRoot = firstInput.getAstRoot(compiler); |
1,747,432 | public void marshall(InstanceSummary instanceSummary, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (instanceSummary == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getIdentityManagementType(), IDENTITYMANAGEMENTTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(instanceSummary.getCreatedTime(), CREATEDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getServiceRole(), SERVICEROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getInstanceStatus(), INSTANCESTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getInboundCallsEnabled(), INBOUNDCALLSENABLED_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceSummary.getOutboundCallsEnabled(), OUTBOUNDCALLSENABLED_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | instanceSummary.getInstanceAlias(), INSTANCEALIAS_BINDING); |
97,837 | final PutResolverQueryLogConfigPolicyResult executePutResolverQueryLogConfigPolicy(PutResolverQueryLogConfigPolicyRequest putResolverQueryLogConfigPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putResolverQueryLogConfigPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutResolverQueryLogConfigPolicyRequest> request = null;<NEW_LINE>Response<PutResolverQueryLogConfigPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutResolverQueryLogConfigPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putResolverQueryLogConfigPolicyRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Route53Resolver");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutResolverQueryLogConfigPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutResolverQueryLogConfigPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutResolverQueryLogConfigPolicyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
380,558 | synchronized void keepAlive() {<NEW_LINE>if (!ftpClient.isConnected()) {<NEW_LINE>LOGGER.log(Level.FINE, "Ending keep-alive (NOOP) for {0}, not connected", configuration.getHost());<NEW_LINE>keepAliveTask.cancel();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>LOGGER.log(Level.FINE, <MASK><NEW_LINE>ftpClient.noop();<NEW_LINE>ftpClient.getReplyString();<NEW_LINE>preventNoOperationTimeout();<NEW_LINE>scheduleKeepAlive();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>LOGGER.log(Level.FINE, "Keep-alive (NOOP/PWD) error for " + configuration.getHost(), ex);<NEW_LINE>keepAliveTask.cancel();<NEW_LINE>silentDisconnect(true);<NEW_LINE>WindowsJdk7WarningPanel.warn();<NEW_LINE>// #209043 - just inform user in the log, do not show any dialog<NEW_LINE>if (io != null) {<NEW_LINE>String message;<NEW_LINE>String reason = getReplyString();<NEW_LINE>if (StringUtils.hasText(reason)) {<NEW_LINE>message = NbBundle.getMessage(FtpClient.class, "MSG_FtpCannotKeepAlive", configuration.getHost(), reason);<NEW_LINE>} else {<NEW_LINE>message = NbBundle.getMessage(FtpClient.class, "MSG_FtpCannotKeepAliveNoReason", configuration.getHost());<NEW_LINE>}<NEW_LINE>io.getErr().println(message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Keep-alive (NOOP) for {0}", configuration.getHost()); |
1,281,233 | public static MessageDestination createMessageDestination(String name, MessageDestination.Type type, File resourceDir, String baseName) throws ConfigurationException {<NEW_LINE>SunMessageDestination msgDest;<NEW_LINE>if (!name.startsWith(JMS_PREFIX)) {<NEW_LINE>name = JMS_PREFIX + name;<NEW_LINE>}<NEW_LINE>DuplicateAOFinder aoFinder = new DuplicateAOFinder(name);<NEW_LINE>DuplicateConnectorFinder connFinder = new DuplicateConnectorFinder(name);<NEW_LINE>ConnectorPoolFinder cpFinder = new ConnectorPoolFinder();<NEW_LINE>File xmlFile = new <MASK><NEW_LINE>if (xmlFile.exists()) {<NEW_LINE>List<TreeParser.Path> pathList = new ArrayList<TreeParser.Path>();<NEW_LINE>pathList.add(new TreeParser.Path("/resources/admin-object-resource", aoFinder));<NEW_LINE>pathList.add(new TreeParser.Path("/resources/connector-resource", connFinder));<NEW_LINE>pathList.add(new TreeParser.Path("/resources/connector-connection-pool", cpFinder));<NEW_LINE>TreeParser.readXml(xmlFile, pathList);<NEW_LINE>if (connFinder.isDuplicate()) {<NEW_LINE>throw new ConfigurationException("Resource already exists");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>String connectionFactoryJndiName = name + "Factory";<NEW_LINE>// NOI18N<NEW_LINE>String connectionFactoryPoolName = name + "FactoryPool";<NEW_LINE>try {<NEW_LINE>createAdminObject(xmlFile, name, type);<NEW_LINE>createConnectorConnectionPool(xmlFile, connectionFactoryPoolName, type);<NEW_LINE>createConnector(xmlFile, connectionFactoryJndiName, connectionFactoryPoolName);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.WARNING, ex.getLocalizedMessage(), ex);<NEW_LINE>throw new ConfigurationException(ex.getLocalizedMessage(), ex);<NEW_LINE>}<NEW_LINE>msgDest = new SunMessageDestination(name, type, resourceDir);<NEW_LINE>return msgDest;<NEW_LINE>} | File(resourceDir, baseName + ".xml"); |
880,838 | final ListGraphqlApisResult executeListGraphqlApis(ListGraphqlApisRequest listGraphqlApisRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listGraphqlApisRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListGraphqlApisRequest> request = null;<NEW_LINE>Response<ListGraphqlApisResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListGraphqlApisRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listGraphqlApisRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "AppSync");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListGraphqlApis");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListGraphqlApisResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListGraphqlApisResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
629,607 | private static List<WindowHandler> createWindowHandlers() {<NEW_LINE>List<WindowHandler> windowHandlers = new ArrayList<WindowHandler>();<NEW_LINE>windowHandlers.add(new AcceptIncomingConnectionDialogHandler());<NEW_LINE>windowHandlers.add(new BlindTradingWarningDialogHandler());<NEW_LINE>windowHandlers.add(new ExitSessionFrameHandler());<NEW_LINE>windowHandlers.add(new LoginFrameHandler());<NEW_LINE>windowHandlers.add(new GatewayLoginFrameHandler());<NEW_LINE>windowHandlers.add(new MainWindowFrameHandler());<NEW_LINE>windowHandlers.add(new GatewayMainWindowFrameHandler());<NEW_LINE>windowHandlers<MASK><NEW_LINE>windowHandlers.add(new NewerVersionFrameHandler());<NEW_LINE>windowHandlers.add(new NotCurrentlyAvailableDialogHandler());<NEW_LINE>windowHandlers.add(new TipOfTheDayDialogHandler());<NEW_LINE>windowHandlers.add(new NSEComplianceFrameHandler());<NEW_LINE>windowHandlers.add(new PasswordExpiryWarningFrameHandler());<NEW_LINE>windowHandlers.add(new GlobalConfigurationDialogHandler());<NEW_LINE>windowHandlers.add(new TradesFrameHandler());<NEW_LINE>windowHandlers.add(new ExistingSessionDetectedDialogHandler());<NEW_LINE>windowHandlers.add(new ApiChangeConfirmationDialogHandler());<NEW_LINE>windowHandlers.add(new SplashFrameHandler());<NEW_LINE>windowHandlers.add(new SecurityCodeDialogHandler());<NEW_LINE>windowHandlers.add(new ReloginDialogHandler());<NEW_LINE>windowHandlers.add(new NonBrokerageAccountDialogHandler());<NEW_LINE>windowHandlers.add(new ExitConfirmationDialogHandler());<NEW_LINE>windowHandlers.add(new TradingLoginHandoffDialogHandler());<NEW_LINE>windowHandlers.add(new LoginFailedDialogHandler());<NEW_LINE>windowHandlers.add(new TooManyFailedLoginAttemptsDialogHandler());<NEW_LINE>windowHandlers.add(new ShutdownProgressDialogHandler());<NEW_LINE>windowHandlers.add(new BidAskLastSizeDisplayUpdateDialogHandler());<NEW_LINE>windowHandlers.add(new LoginErrorDialogHandler());<NEW_LINE>return windowHandlers;<NEW_LINE>} | .add(new NewerVersionDialogHandler()); |
438,838 | public BitmapRef renderSimple(final Rect viewbox, final float[] ctm) {<NEW_LINE>TempHolder.lock.lock();<NEW_LINE>try {<NEW_LINE>if (isRecycled()) {<NEW_LINE>throw new RuntimeException("The page has been recycled before: " + this);<NEW_LINE>}<NEW_LINE>final int[] mRect = new int[4];<NEW_LINE>mRect[0] = viewbox.left;<NEW_LINE><MASK><NEW_LINE>mRect[2] = viewbox.right;<NEW_LINE>mRect[3] = viewbox.bottom;<NEW_LINE>final int width = viewbox.width();<NEW_LINE>final int height = viewbox.height();<NEW_LINE>final int[] bufferarray = new int[width * height];<NEW_LINE>renderPageSafe(muPdfDocument, pageHandle, mRect, ctm, bufferarray, -1, -1, -1);<NEW_LINE>final BitmapRef b = BitmapManager.getBitmap("PDF page", width, height, Config.RGB_565);<NEW_LINE>b.getBitmap().setPixels(bufferarray, 0, width, 0, 0, width, height);<NEW_LINE>return b;<NEW_LINE>} finally {<NEW_LINE>TempHolder.lock.unlock();<NEW_LINE>}<NEW_LINE>} | mRect[1] = viewbox.top; |
1,323,611 | private static void buildChangelogLatest(String version, String fullVersion, String argIn, String argOut) throws Exception {<NEW_LINE>File in, out;<NEW_LINE>if (argIn == null) {<NEW_LINE>in = new File(".");<NEW_LINE>if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory())<NEW_LINE>in = new File(in, "website");<NEW_LINE>} else {<NEW_LINE>in = new File(argIn);<NEW_LINE>}<NEW_LINE>if (argOut == null) {<NEW_LINE>if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) {<NEW_LINE>out = new File("./build/latestchanges.html");<NEW_LINE>} else {<NEW_LINE>out <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>out = new File(argOut);<NEW_LINE>}<NEW_LINE>WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile());<NEW_LINE>maker.buildChangelogLatest(out);<NEW_LINE>} | = new File(in, "output/latestchanges.html"); |
445,601 | public INDArray putSlice(int slice, INDArray put) {<NEW_LINE>Nd4j.<MASK><NEW_LINE>if (isScalar()) {<NEW_LINE>Preconditions.checkState(put.isScalar(), "Invalid dimension. Can only insert a scalar in to another scalar");<NEW_LINE>put(0, put.getScalar(0));<NEW_LINE>return this;<NEW_LINE>} else if (isVector()) {<NEW_LINE>Preconditions.checkState(put.isVectorOrScalar() && put.length() == length(), "Invalid dimension on insertion. Can only insert scalars/vectors into other scalar/vectors");<NEW_LINE>if (put.isScalar())<NEW_LINE>putScalar(slice, put.getDouble(0));<NEW_LINE>else<NEW_LINE>for (int i = 0; i < length(); i++) putScalar(i, put.getDouble(i));<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>assertSlice(put, slice);<NEW_LINE>INDArray view = slice(slice);<NEW_LINE>if (put.length() == 1) {<NEW_LINE>putScalar(slice, put.getDouble(0));<NEW_LINE>} else {<NEW_LINE>if (!(view.isVector() && put.isVector() && view.length() == put.length()) && !view.equalShapes(put)) {<NEW_LINE>throw new IllegalStateException("Cannot put slice: array to be put (" + Arrays.toString(put.shape()) + ") and slice array (" + Arrays.toString(view.shape()) + ") have different shapes");<NEW_LINE>}<NEW_LINE>view.assign(put);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | getCompressor().autoDecompress(this); |
1,113,601 | final GetResourceDefinitionResult executeGetResourceDefinition(GetResourceDefinitionRequest getResourceDefinitionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getResourceDefinitionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetResourceDefinitionRequest> request = null;<NEW_LINE>Response<GetResourceDefinitionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetResourceDefinitionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getResourceDefinitionRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Greengrass");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetResourceDefinition");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetResourceDefinitionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetResourceDefinitionResultJsonUnmarshaller());<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); |
399,693 | public Request<DescribeRegionsRequest> marshall(DescribeRegionsRequest describeRegionsRequest) {<NEW_LINE>if (describeRegionsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribeRegionsRequest> request = new DefaultRequest<DescribeRegionsRequest>(describeRegionsRequest, "AmazonEC2");<NEW_LINE>request.addParameter("Action", "DescribeRegions");<NEW_LINE>request.addParameter("Version", "2015-10-01");<NEW_LINE>java.util.List<String> regionNamesList = describeRegionsRequest.getRegionNames();<NEW_LINE>int regionNamesListIndex = 1;<NEW_LINE>for (String regionNamesListValue : regionNamesList) {<NEW_LINE>if (regionNamesListValue != null) {<NEW_LINE>request.addParameter("RegionName." + regionNamesListIndex<MASK><NEW_LINE>}<NEW_LINE>regionNamesListIndex++;<NEW_LINE>}<NEW_LINE>java.util.List<Filter> filtersList = describeRegionsRequest.getFilters();<NEW_LINE>int filtersListIndex = 1;<NEW_LINE>for (Filter filtersListValue : filtersList) {<NEW_LINE>Filter filterMember = filtersListValue;<NEW_LINE>if (filterMember != null) {<NEW_LINE>if (filterMember.getName() != null) {<NEW_LINE>request.addParameter("Filter." + filtersListIndex + ".Name", StringUtils.fromString(filterMember.getName()));<NEW_LINE>}<NEW_LINE>java.util.List<String> valuesList = filterMember.getValues();<NEW_LINE>int valuesListIndex = 1;<NEW_LINE>for (String valuesListValue : valuesList) {<NEW_LINE>if (valuesListValue != null) {<NEW_LINE>request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(valuesListValue));<NEW_LINE>}<NEW_LINE>valuesListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>filtersListIndex++;<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | , StringUtils.fromString(regionNamesListValue)); |
1,418,210 | public void lower(NewArrayNode node, LoweringTool tool) {<NEW_LINE>StructuredGraph graph = node.graph();<NEW_LINE>ResolvedJavaType elementType = node.elementType();<NEW_LINE>HotSpotResolvedObjectType arrayType = (HotSpotResolvedObjectType) elementType.getArrayClass();<NEW_LINE>JavaKind elementKind = elementType.getJavaKind();<NEW_LINE>ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), arrayType.klass(), <MASK><NEW_LINE>final int arrayBaseOffset = tool.getMetaAccess().getArrayBaseOffset(elementKind);<NEW_LINE>int log2ElementSize = CodeUtil.log2(tool.getMetaAccess().getArrayIndexScale(elementKind));<NEW_LINE>OptionValues localOptions = graph.getOptions();<NEW_LINE>Arguments args = new Arguments(allocateArray, graph.getGuardsStage(), tool.getLoweringStage());<NEW_LINE>args.add("hub", hub);<NEW_LINE>ValueNode length = node.length();<NEW_LINE>args.add("length", length.isAlive() ? length : graph.addOrUniqueWithInputs(length));<NEW_LINE>args.addConst("arrayBaseOffset", arrayBaseOffset);<NEW_LINE>args.addConst("log2ElementSize", log2ElementSize);<NEW_LINE>args.addConst("fillContents", FillContent.fromBoolean(node.fillContents()));<NEW_LINE>args.addConst("fillStartOffset", arrayBaseOffset);<NEW_LINE>args.addConst("emitMemoryBarrier", node.emitMemoryBarrier());<NEW_LINE>args.addConst("maybeUnroll", length.isConstant());<NEW_LINE>args.addConst("supportsBulkZeroing", tool.getLowerer().supportsBulkZeroing());<NEW_LINE>args.addConst("supportsOptimizedFilling", tool.getLowerer().supportsOptimizedFilling(localOptions));<NEW_LINE>args.addConst("profilingData", getProfilingData(localOptions, "array", arrayType));<NEW_LINE>SnippetTemplate template = template(node, args);<NEW_LINE>graph.getDebug().log("Lowering allocateArray in %s: node=%s, template=%s, arguments=%s", graph, node, template, args);<NEW_LINE>template.instantiate(providers.getMetaAccess(), node, DEFAULT_REPLACER, args);<NEW_LINE>} | providers.getMetaAccess(), graph); |
1,533,557 | synchronized protected void downloadAssetBundle(final AssetBundle assetBundle, HttpUrl baseUrl) {<NEW_LINE>Set<AssetBundle.Asset> missingAssets = new HashSet<AssetBundle.Asset>();<NEW_LINE>for (AssetBundle.Asset asset : assetBundle.getOwnAssets()) {<NEW_LINE>// Create containing directories for the asset if necessary<NEW_LINE>File containingDirectory = asset.getFile().getParentFile();<NEW_LINE>if (!containingDirectory.exists()) {<NEW_LINE>if (!containingDirectory.mkdirs()) {<NEW_LINE>didFail(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If we find a cached asset, we copy it<NEW_LINE>AssetBundle.Asset cachedAsset = cachedAssetForAsset(asset);<NEW_LINE>if (cachedAsset != null) {<NEW_LINE>try {<NEW_LINE>resourceApi.copyResource(cachedAsset.getFileUri(), asset.getFileUri());<NEW_LINE>} catch (IOException e) {<NEW_LINE>didFail(e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>missingAssets.add(asset);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If all assets were cached, there is no need to start a download<NEW_LINE>if (missingAssets.isEmpty()) {<NEW_LINE>didFinishDownloadingAssetBundle(assetBundle);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>assetBundleDownloader = new AssetBundleDownloader(webAppConfiguration, assetBundle, baseUrl, missingAssets);<NEW_LINE>assetBundleDownloader.setCallback(new AssetBundleDownloader.Callback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFinished() {<NEW_LINE>assetBundleDownloader = null;<NEW_LINE>moveDownloadedAssetBundleIntoPlace(assetBundle);<NEW_LINE>didFinishDownloadingAssetBundle(assetBundle);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Throwable cause) {<NEW_LINE>didFail(cause);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>assetBundleDownloader.resume();<NEW_LINE>} | new IOException("Could not create containing directory: " + containingDirectory)); |
1,369,637 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Spell spell = game.getSpellOrLKIStack(this.getTargetPointer()<MASK><NEW_LINE>if (spell == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int xValue = spell.getManaValue();<NEW_LINE>Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue));<NEW_LINE>if (cards.isEmpty()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>controller.revealCards(source, cards, game);<NEW_LINE>FilterCard filter = new FilterCard();<NEW_LINE>filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1));<NEW_LINE>CardUtil.castSpellWithAttributesForFree(controller, source, game, cards, filter);<NEW_LINE>cards.retainZone(Zone.LIBRARY, game);<NEW_LINE>controller.putCardsOnBottomOfLibrary(cards, game, source, false);<NEW_LINE>return true;<NEW_LINE>} | .getFirst(game, source)); |
1,204,414 | public Map<String, LineChart> buildGraphByDomain(Date start, Date end, String domain) {<NEW_LINE>BusinessReportConfig <MASK><NEW_LINE>HashMap<String, LineChart> result = new LinkedHashMap<String, LineChart>();<NEW_LINE>if (config != null) {<NEW_LINE>Map<String, double[]> datas = prepareBusinessItemDatas(start, end, domain, config);<NEW_LINE>Map<String, double[]> baseLines = prepareBusinessItemBaseLines(start, end, datas.keySet());<NEW_LINE>Map<String, CustomConfig> customConfigs = config.getCustomConfigs();<NEW_LINE>Map<String, double[]> customBaseLines = prepareCustomBaseLines(start, end, domain, customConfigs);<NEW_LINE>Map<String, double[]> customDatas = prepareCustomDatas(start, end, domain, customConfigs, datas);<NEW_LINE>Map<String, BusinessReportConfig> configs = new HashMap<String, BusinessReportConfig>();<NEW_LINE>configs.put(domain, config);<NEW_LINE>result.putAll(buildCharts(datas, baseLines, start, end, configs));<NEW_LINE>result.putAll(buildCharts(customDatas, customBaseLines, start, end, configs));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | config = m_configManager.queryConfigByDomain(domain); |
1,280,555 | private HttpPipeline createHttpPipeline() {<NEW_LINE>Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;<NEW_LINE>if (httpLogOptions == null) {<NEW_LINE>httpLogOptions = new HttpLogOptions();<NEW_LINE>}<NEW_LINE>if (clientOptions == null) {<NEW_LINE>clientOptions = new ClientOptions();<NEW_LINE>}<NEW_LINE>List<HttpPipelinePolicy> policies = new ArrayList<>();<NEW_LINE>String clientName = properties.getOrDefault(SDK_NAME, "UnknownName");<NEW_LINE>String clientVersion = <MASK><NEW_LINE>String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions);<NEW_LINE>policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));<NEW_LINE>HttpHeaders headers = new HttpHeaders();<NEW_LINE>clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue()));<NEW_LINE>if (headers.getSize() > 0) {<NEW_LINE>policies.add(new AddHeadersPolicy(headers));<NEW_LINE>}<NEW_LINE>policies.addAll(this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL).collect(Collectors.toList()));<NEW_LINE>HttpPolicyProviders.addBeforeRetryPolicies(policies);<NEW_LINE>policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy);<NEW_LINE>policies.add(new CookiePolicy());<NEW_LINE>if (tokenCredential != null) {<NEW_LINE>policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));<NEW_LINE>}<NEW_LINE>policies.addAll(this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList()));<NEW_LINE>HttpPolicyProviders.addAfterRetryPolicies(policies);<NEW_LINE>policies.add(new HttpLoggingPolicy(httpLogOptions));<NEW_LINE>HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])).httpClient(httpClient).clientOptions(clientOptions).build();<NEW_LINE>return httpPipeline;<NEW_LINE>} | properties.getOrDefault(SDK_VERSION, "UnknownVersion"); |
447,793 | // ----- private methods -----<NEW_LINE>private String sendInitialSystemInfoData() {<NEW_LINE>String id = null;<NEW_LINE>try {<NEW_LINE>final URL url = new URL("https://sysinfo.structr.com/structr/rest/SystemInfoData");<NEW_LINE>final Map<String, Object> data = new LinkedHashMap<>();<NEW_LINE>final URLConnection con = url.openConnection();<NEW_LINE>final HttpURLConnection http = (HttpURLConnection) con;<NEW_LINE>final Gson gson = new GsonBuilder().create();<NEW_LINE>final Runtime runtime = Runtime.getRuntime();<NEW_LINE>data.put("version", VersionHelper.getFullVersionInfo());<NEW_LINE>data.put("edition", licenseManager.getEdition());<NEW_LINE>data.put("hostId", licenseManager.getHardwareFingerprint());<NEW_LINE>data.put("jvm", Runtime.version().toString());<NEW_LINE>data.put("memory", runtime.maxMemory() / 1024 / 1024);<NEW_LINE>data.put("cpus", runtime.availableProcessors());<NEW_LINE>data.put("os", System.getProperty("os.name"));<NEW_LINE>http.setRequestProperty("ContentType", "application/json");<NEW_LINE>http.setReadTimeout(1000);<NEW_LINE>http.setConnectTimeout(1000);<NEW_LINE>http.setRequestMethod("POST");<NEW_LINE>http.setDoOutput(true);<NEW_LINE>http.setDoInput(true);<NEW_LINE>http.connect();<NEW_LINE>// write request body<NEW_LINE>try (final Writer writer = new OutputStreamWriter(http.getOutputStream())) {<NEW_LINE>gson.toJson(data, writer);<NEW_LINE>writer.flush();<NEW_LINE>}<NEW_LINE>final InputStream input = http.getInputStream();<NEW_LINE>if (input != null) {<NEW_LINE>// consume response<NEW_LINE>final String responseText = IOUtils.toString(input, "utf-8");<NEW_LINE>final Map<String, Object> response = gson.fromJson(responseText, Map.class);<NEW_LINE>if (response != null) {<NEW_LINE>final Object <MASK><NEW_LINE>if (result instanceof List) {<NEW_LINE>final List list = (List) result;<NEW_LINE>if (!list.isEmpty()) {<NEW_LINE>final Object entry = list.get(0);<NEW_LINE>if (entry instanceof String) {<NEW_LINE>id = (String) entry;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final InputStream error = http.getErrorStream();<NEW_LINE>if (error != null) {<NEW_LINE>// consume error stream<NEW_LINE>IOUtils.toString(error, "utf-8");<NEW_LINE>}<NEW_LINE>http.disconnect();<NEW_LINE>} catch (Throwable ignore) {<NEW_LINE>}<NEW_LINE>return id;<NEW_LINE>} | result = response.get("result"); |
346,253 | final DeleteConfigurationSetResult executeDeleteConfigurationSet(DeleteConfigurationSetRequest deleteConfigurationSetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteConfigurationSetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteConfigurationSetRequest> request = null;<NEW_LINE>Response<DeleteConfigurationSetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteConfigurationSetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteConfigurationSetRequest));<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, "Pinpoint SMS Voice");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteConfigurationSet");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteConfigurationSetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteConfigurationSetResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,335,600 | public boolean startAll() {<NEW_LINE>log.info("Starting all servers");<NEW_LINE>AdempiereServer[] servers = getInActive();<NEW_LINE>for (int i = 0; i < servers.length; i++) {<NEW_LINE>AdempiereServer server = servers[i];<NEW_LINE>try {<NEW_LINE>if (server.isAlive()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Wait until dead<NEW_LINE>if (server.isInterrupted()) {<NEW_LINE>// 10 iterations = 1 sec<NEW_LINE>int maxWait = 10;<NEW_LINE>while (server.isAlive()) {<NEW_LINE>if (maxWait-- == 0) {<NEW_LINE>log.error("Wait timeout for interrupted {}", server);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// 1/10 sec<NEW_LINE>Thread.sleep(100);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>log.error("Error while sleeping", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Do start<NEW_LINE>if (!server.isAlive()) {<NEW_LINE>// replace<NEW_LINE>server = AdempiereServer.create(server.getModel());<NEW_LINE>if (server == null)<NEW_LINE>m_servers.remove(i);<NEW_LINE>else<NEW_LINE>m_servers.set(i, server);<NEW_LINE>server.start();<NEW_LINE>server.<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error while starting server: {}", server, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// for all servers<NEW_LINE>// Final Check<NEW_LINE>int noRunning = 0;<NEW_LINE>int noStopped = 0;<NEW_LINE>for (int i = 0; i < servers.length; i++) {<NEW_LINE>AdempiereServer server = servers[i];<NEW_LINE>try {<NEW_LINE>if (server.isAlive()) {<NEW_LINE>log.info("Alive: {}", server);<NEW_LINE>noRunning++;<NEW_LINE>} else {<NEW_LINE>log.warn("Dead: {}", server);<NEW_LINE>noStopped++;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error while checking server status: {}", server, e);<NEW_LINE>noStopped++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.debug("All servers started: Running={}, Stopped={}", noRunning, noStopped);<NEW_LINE>AdempiereServerGroup.get().dump();<NEW_LINE>return noStopped == 0;<NEW_LINE>} | setPriority(Thread.NORM_PRIORITY - 2); |
1,072,146 | public OffsetMap fetchOffset(KafkaConsumer<?, ?> consumer, java.lang.String topic) {<NEW_LINE>OffsetMap offsetMap = new OffsetMap();<NEW_LINE>List<TopicPartition> topicPartitions = new ArrayList<>();<NEW_LINE>List<PartitionInfo> partitionInfos = consumer.partitionsFor(topic);<NEW_LINE>partitionInfos.forEach(item -> topicPartitions.add(new TopicPartition(topic, <MASK><NEW_LINE>consumer.assign(topicPartitions);<NEW_LINE>consumer.poll(10 * 1000L);<NEW_LINE>consumer.seekToEnd(topicPartitions);<NEW_LINE>topicPartitions.forEach(item -> offsetMap.setLatest(new KafkaTopicPartition(topic, item.partition()), consumer.position(item)));<NEW_LINE>consumer.seekToBeginning(topicPartitions);<NEW_LINE>topicPartitions.forEach(item -> offsetMap.setEarliest(new KafkaTopicPartition(topic, item.partition()), consumer.position(item)));<NEW_LINE>return offsetMap;<NEW_LINE>} | item.partition()))); |
1,679,607 | public void executeFix(final String key) throws DotDataException, DotSecurityException {<NEW_LINE>DotConnect dc = new DotConnect();<NEW_LINE>// Get information from IR.<NEW_LINE>final String getResultsQuery = new StringBuilder("SELECT ").append(getIntegrityType().getFirstDisplayColumnLabel()).append(", local_identifier, remote_identifier, local_working_inode, remote_working_inode, local_live_inode, remote_live_inode, language_id FROM ").append(getIntegrityType().getResultsTableName()).append(" WHERE endpoint_id = ?").toString();<NEW_LINE>dc.setSQL(getResultsQuery);<NEW_LINE>dc.addParam(key);<NEW_LINE>List<Map<String, Object>> results = dc.loadObjectResults();<NEW_LINE>// Generate counter to know how many version are for each identifier<NEW_LINE>// with conflicts<NEW_LINE>Map<String, Integer> versionCount = new HashMap<String, Integer>();<NEW_LINE>for (Map<String, Object> result : results) {<NEW_LINE>final String oldIdentifier = (String) result.get("local_identifier");<NEW_LINE>final Integer counter = versionCount.get(oldIdentifier);<NEW_LINE>if (counter == null) {<NEW_LINE>versionCount.put(oldIdentifier, 1);<NEW_LINE>} else {<NEW_LINE>versionCount.put(oldIdentifier, counter + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map<String, Object> result : results) {<NEW_LINE>final String oldIdentifier = (String) result.get("local_identifier");<NEW_LINE>int counter = versionCount.get(oldIdentifier);<NEW_LINE>boolean isTheLastConflict = counter == 1 ? true : false;<NEW_LINE>fixContentletConflicts(result, Structure.STRUCTURE_TYPE_FILEASSET, isTheLastConflict);<NEW_LINE>if (!isTheLastConflict) {<NEW_LINE>// Decrease version counter if greater than 1<NEW_LINE>versionCount.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | put(oldIdentifier, counter - 1); |
806,848 | public void execute(ObjectAccessor<T> referenceAccessor, ObjectAccessor<T> copyAccessor, FieldAccessor fieldAccessor) {<NEW_LINE>if (isCachedHashCodeField.test(fieldAccessor)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Field field = fieldAccessor.getField();<NEW_LINE>T reference = referenceAccessor.get();<NEW_LINE>T copy = copyAccessor.get();<NEW_LINE>String fieldName = field.getName();<NEW_LINE>boolean equalToItself = reference.equals(copy);<NEW_LINE>T changed = copyAccessor.withChangedField(field, prefabValues, typeTag).get();<NEW_LINE>boolean equalsChanged = !reference.equals(changed);<NEW_LINE>boolean hashCodeChanged = cachedHashCodeInitializer.getInitializedHashCode(reference) != cachedHashCodeInitializer.getInitializedHashCode(changed);<NEW_LINE>assertEqualsAndHashCodeRelyOnSameFields(equalsChanged, <MASK><NEW_LINE>assertFieldShouldBeIgnored(equalToItself, equalsChanged, fieldAccessor, fieldName);<NEW_LINE>referenceAccessor.withChangedField(field, prefabValues, typeTag);<NEW_LINE>} | hashCodeChanged, reference, changed, fieldName); |
180,017 | private static boolean tryConvertEndOfLineComment(PsiElement commentElement) {<NEW_LINE>Commenter commenter = LanguageCommenters.INSTANCE.<MASK><NEW_LINE>if (commenter instanceof CodeDocumentationAwareCommenter) {<NEW_LINE>CodeDocumentationAwareCommenter docCommenter = (CodeDocumentationAwareCommenter) commenter;<NEW_LINE>String lineCommentPrefix = commenter.getLineCommentPrefix();<NEW_LINE>String blockCommentPrefix = commenter.getBlockCommentPrefix();<NEW_LINE>String blockCommentSuffix = commenter.getBlockCommentSuffix();<NEW_LINE>if (commentElement.getNode().getElementType() == docCommenter.getLineCommentTokenType() && blockCommentPrefix != null && blockCommentSuffix != null && lineCommentPrefix != null) {<NEW_LINE>String commentText = StringUtil.trimStart(commentElement.getText(), lineCommentPrefix);<NEW_LINE>String suffix = docCommenter.getBlockCommentSuffix();<NEW_LINE>if (suffix != null && suffix.length() > 1) {<NEW_LINE>String fixedSuffix = suffix.charAt(0) + " " + suffix.substring(1);<NEW_LINE>commentText = commentText.replace(suffix, fixedSuffix);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Project project = commentElement.getProject();<NEW_LINE>PsiParserFacade parserFacade = PsiParserFacade.SERVICE.getInstance(project);<NEW_LINE>PsiComment newComment = parserFacade.createBlockCommentFromText(commentElement.getLanguage(), commentText);<NEW_LINE>commentElement.replace(newComment);<NEW_LINE>return true;<NEW_LINE>} catch (IncorrectOperationException e) {<NEW_LINE>LOG.info("Failed to replace line comment with block comment", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | forLanguage(commentElement.getLanguage()); |
1,054,312 | public static DescribeDBProxyEndpointResponse unmarshall(DescribeDBProxyEndpointResponse describeDBProxyEndpointResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDBProxyEndpointResponse.setRequestId(_ctx.stringValue("DescribeDBProxyEndpointResponse.RequestId"));<NEW_LINE>describeDBProxyEndpointResponse.setDBProxyEndpointId(_ctx.stringValue("DescribeDBProxyEndpointResponse.DBProxyEndpointId"));<NEW_LINE>describeDBProxyEndpointResponse.setDBProxyConnectString(_ctx.stringValue("DescribeDBProxyEndpointResponse.DBProxyConnectString"));<NEW_LINE>describeDBProxyEndpointResponse.setDBProxyConnectStringPort(_ctx.stringValue("DescribeDBProxyEndpointResponse.DBProxyConnectStringPort"));<NEW_LINE>describeDBProxyEndpointResponse.setDBProxyConnectStringNetType(_ctx.stringValue("DescribeDBProxyEndpointResponse.DBProxyConnectStringNetType"));<NEW_LINE>describeDBProxyEndpointResponse.setDBProxyFeatures(_ctx.stringValue("DescribeDBProxyEndpointResponse.DBProxyFeatures"));<NEW_LINE>describeDBProxyEndpointResponse.setReadOnlyInstanceMaxDelayTime(_ctx.stringValue("DescribeDBProxyEndpointResponse.ReadOnlyInstanceMaxDelayTime"));<NEW_LINE>describeDBProxyEndpointResponse.setReadOnlyInstanceDistributionType(_ctx.stringValue("DescribeDBProxyEndpointResponse.ReadOnlyInstanceDistributionType"));<NEW_LINE>describeDBProxyEndpointResponse.setReadOnlyInstanceWeight(_ctx.stringValue("DescribeDBProxyEndpointResponse.ReadOnlyInstanceWeight"));<NEW_LINE>describeDBProxyEndpointResponse.setDbProxyEndpointAliases<MASK><NEW_LINE>describeDBProxyEndpointResponse.setDbProxyEndpointReadWriteMode(_ctx.stringValue("DescribeDBProxyEndpointResponse.DbProxyEndpointReadWriteMode"));<NEW_LINE>List<EndpointConnectItemsItem> endpointConnectItems = new ArrayList<EndpointConnectItemsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDBProxyEndpointResponse.EndpointConnectItems.Length"); i++) {<NEW_LINE>EndpointConnectItemsItem endpointConnectItemsItem = new EndpointConnectItemsItem();<NEW_LINE>endpointConnectItemsItem.setDbProxyEndpointConnectString(_ctx.stringValue("DescribeDBProxyEndpointResponse.EndpointConnectItems[" + i + "].DbProxyEndpointConnectString"));<NEW_LINE>endpointConnectItemsItem.setDbProxyEndpointPort(_ctx.stringValue("DescribeDBProxyEndpointResponse.EndpointConnectItems[" + i + "].DbProxyEndpointPort"));<NEW_LINE>endpointConnectItemsItem.setDbProxyEndpointNetType(_ctx.stringValue("DescribeDBProxyEndpointResponse.EndpointConnectItems[" + i + "].DbProxyEndpointNetType"));<NEW_LINE>endpointConnectItems.add(endpointConnectItemsItem);<NEW_LINE>}<NEW_LINE>describeDBProxyEndpointResponse.setEndpointConnectItems(endpointConnectItems);<NEW_LINE>return describeDBProxyEndpointResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeDBProxyEndpointResponse.DbProxyEndpointAliases")); |
1,276,065 | protected void encodeMarkup(FacesContext context, SelectCheckboxMenu menu) throws IOException {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>String clientId = menu.getClientId(context);<NEW_LINE>List<SelectItem> selectItems = getSelectItems(context, menu);<NEW_LINE>boolean valid = menu.isValid();<NEW_LINE>String title = menu.getTitle();<NEW_LINE>String style = menu.getStyle();<NEW_LINE>String styleclass = createStyleClass(menu, SelectCheckboxMenu.STYLE_CLASS);<NEW_LINE>styleclass = menu.isMultiple() ? SelectCheckboxMenu.MULTIPLE_CLASS + " " + styleclass : styleclass;<NEW_LINE>writer.startElement("div", menu);<NEW_LINE>writer.writeAttribute("id", clientId, "id");<NEW_LINE>writer.writeAttribute("class", styleclass, "styleclass");<NEW_LINE>if (style != null) {<NEW_LINE>writer.writeAttribute("style", style, "style");<NEW_LINE>}<NEW_LINE>if (title != null) {<NEW_LINE>writer.<MASK><NEW_LINE>}<NEW_LINE>renderARIACombobox(context, menu);<NEW_LINE>encodeKeyboardTarget(context, menu);<NEW_LINE>encodeInputs(context, menu, selectItems);<NEW_LINE>if (menu.isMultiple()) {<NEW_LINE>encodeMultipleLabel(context, menu, selectItems);<NEW_LINE>} else {<NEW_LINE>encodeLabel(context, menu, selectItems, valid);<NEW_LINE>}<NEW_LINE>encodeMenuIcon(context, menu, valid);<NEW_LINE>writer.endElement("div");<NEW_LINE>} | writeAttribute("title", title, "title"); |
627,360 | final GetCloudFrontOriginAccessIdentityConfigResult executeGetCloudFrontOriginAccessIdentityConfig(GetCloudFrontOriginAccessIdentityConfigRequest getCloudFrontOriginAccessIdentityConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCloudFrontOriginAccessIdentityConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCloudFrontOriginAccessIdentityConfigRequest> request = null;<NEW_LINE>Response<GetCloudFrontOriginAccessIdentityConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCloudFrontOriginAccessIdentityConfigRequestMarshaller().marshall(super.beforeMarshalling(getCloudFrontOriginAccessIdentityConfigRequest));<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, "CloudFront");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetCloudFrontOriginAccessIdentityConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetCloudFrontOriginAccessIdentityConfigResult> responseHandler = new StaxResponseHandler<GetCloudFrontOriginAccessIdentityConfigResult>(new GetCloudFrontOriginAccessIdentityConfigResultStaxUnmarshaller());<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,668,082 | public void printExtremeFeatures(PrintWriter out, int num) {<NEW_LINE>Alphabet dict = getAlphabet();<NEW_LINE>LabelAlphabet labelDict = getLabelAlphabet();<NEW_LINE>int numFeatures = dict.size() + 1;<NEW_LINE>int numLabels = labelDict.size();<NEW_LINE>// Include the feature weights according to each label<NEW_LINE>@Var<NEW_LINE>RankedFeatureVector rfv;<NEW_LINE>// do not deal with the default feature<NEW_LINE>double[] weights = new double[numFeatures - 1];<NEW_LINE>for (int li = 0; li < numLabels; li++) {<NEW_LINE>out.print("FEATURES FOR CLASS " + labelDict.lookupObject(li) + " ");<NEW_LINE>for (int i = 0; i < defaultFeatureIndex; i++) {<NEW_LINE>Object name = dict.lookupObject(i);<NEW_LINE>double weight = parameters[li * numFeatures + i];<NEW_LINE>weights[i] = weight;<NEW_LINE>}<NEW_LINE>rfv = new RankedFeatureVector(dict, weights);<NEW_LINE>rfv.printTopK(out, num);<NEW_LINE>out.print(" <default> " + parameters[li <MASK><NEW_LINE>rfv.printLowerK(out, num);<NEW_LINE>out.println();<NEW_LINE>}<NEW_LINE>} | * numFeatures + defaultFeatureIndex] + " "); |
458,508 | public final SubQueryExprContext subQueryExpr() throws RecognitionException {<NEW_LINE>SubQueryExprContext _localctx = new SubQueryExprContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 340, RULE_subQueryExpr);<NEW_LINE>paraphrases.push("subquery");<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(2342);<NEW_LINE>match(LPAREN);<NEW_LINE>setState(2343);<NEW_LINE>match(SELECT);<NEW_LINE>setState(2345);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (_la == DISTINCT) {<NEW_LINE>{<NEW_LINE>setState(2344);<NEW_LINE>match(DISTINCT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2347);<NEW_LINE>selectionList();<NEW_LINE>setState(2348);<NEW_LINE>match(FROM);<NEW_LINE>setState(2349);<NEW_LINE>subSelectFilterExpr();<NEW_LINE>setState(2352);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (_la == WHERE) {<NEW_LINE>{<NEW_LINE>setState(2350);<NEW_LINE>match(WHERE);<NEW_LINE>setState(2351);<NEW_LINE>whereClause();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2357);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (_la == GROUP) {<NEW_LINE>{<NEW_LINE>setState(2354);<NEW_LINE>match(GROUP);<NEW_LINE>setState(2355);<NEW_LINE>match(BY);<NEW_LINE>setState(2356);<NEW_LINE>groupByListExpr();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2361);<NEW_LINE>_errHandler.sync(this);<NEW_LINE><MASK><NEW_LINE>if (_la == HAVING) {<NEW_LINE>{<NEW_LINE>setState(2359);<NEW_LINE>match(HAVING);<NEW_LINE>setState(2360);<NEW_LINE>havingClause();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2363);<NEW_LINE>match(RPAREN);<NEW_LINE>}<NEW_LINE>_ctx.stop = _input.LT(-1);<NEW_LINE>paraphrases.pop();<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _la = _input.LA(1); |
1,826,724 | final BatchCreateTableRowsResult executeBatchCreateTableRows(BatchCreateTableRowsRequest batchCreateTableRowsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchCreateTableRowsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchCreateTableRowsRequest> request = null;<NEW_LINE>Response<BatchCreateTableRowsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new BatchCreateTableRowsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchCreateTableRowsRequest));<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, "Honeycode");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchCreateTableRows");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchCreateTableRowsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchCreateTableRowsResultJsonUnmarshaller());<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); |
1,006,738 | public BoundingBox extendMargin(float margin) {<NEW_LINE>if (margin == 1) {<NEW_LINE>return this;<NEW_LINE>} else if (margin <= 0) {<NEW_LINE>throw new IllegalArgumentException("BoundingBox extend operation does not accept negative or zero values");<NEW_LINE>}<NEW_LINE>double verticalExpansion = (this.getLatitudeSpan() * margin - this.getLatitudeSpan()) * 0.5;<NEW_LINE>double horizontalExpansion = (this.getLongitudeSpan() * margin - this.getLongitudeSpan()) * 0.5;<NEW_LINE>double minLat = Math.max(MercatorProjection.LATITUDE_MIN, this.minLatitude - verticalExpansion);<NEW_LINE>double minLon = Math.max(-180, this.minLongitude - horizontalExpansion);<NEW_LINE>double maxLat = Math.min(MercatorProjection.LATITUDE_MAX, this.maxLatitude + verticalExpansion);<NEW_LINE>double maxLon = Math.min(<MASK><NEW_LINE>return new BoundingBox(minLat, minLon, maxLat, maxLon);<NEW_LINE>} | 180, this.maxLongitude + horizontalExpansion); |
95,775 | public final MethodModel createAndAdd(MethodModel clientView, boolean isLocal, boolean isComponent) {<NEW_LINE>String home = null;<NEW_LINE>String component = null;<NEW_LINE>if (isLocal) {<NEW_LINE>home = localHome;<NEW_LINE>component = findBusinessInterface(local);<NEW_LINE>} else {<NEW_LINE>home = remoteHome;<NEW_LINE>component = findBusinessInterface(remote);<NEW_LINE>}<NEW_LINE>if (isComponent) {<NEW_LINE>try {<NEW_LINE>addMethodToClass(component, clientView);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Exceptions.printStackTrace(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>addMethodToClass(home, clientView);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Exceptions.printStackTrace(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hasJavaImplementation(clientView)) {<NEW_LINE>for (MethodModel me : getImplementationMethods(clientView)) {<NEW_LINE>try {<NEW_LINE>if (!findInClass(ejbClass, me)) {<NEW_LINE>addMethodToClass(ejbClass, me);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Exceptions.printStackTrace(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>MethodModel result = clientView;<NEW_LINE>if (!isLocal && !simplified) {<NEW_LINE>result = addExceptionIfNecessary(clientView, <MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>// TODO: RETOUCHE opening generated method in editor<NEW_LINE>// if (methodToOpen != null) {<NEW_LINE>// StatementBlock stBlock = null;<NEW_LINE>// if (methodToOpen.isValid())<NEW_LINE>// stBlock = methodToOpen.getBody();<NEW_LINE>// if (stBlock != null)<NEW_LINE>// JMIUtils.openInEditor(stBlock);<NEW_LINE>// }<NEW_LINE>} | RemoteException.class.getName()); |
1,846,258 | public boolean delete(String groupId, String operator) {<NEW_LINE>LOGGER.info("begin to delete inlong group for groupId={} by user={}", groupId, operator);<NEW_LINE>Preconditions.checkNotNull(groupId, ErrorCodeEnum.GROUP_ID_IS_EMPTY.getMessage());<NEW_LINE>InlongGroupEntity entity = groupMapper.selectByGroupId(groupId);<NEW_LINE>if (entity == null) {<NEW_LINE>LOGGER.error("inlong group not found by groupId={}", groupId);<NEW_LINE>throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);<NEW_LINE>}<NEW_LINE>// Determine whether the current status can be deleted<NEW_LINE>GroupStatus curState = GroupStatus.forCode(entity.getStatus());<NEW_LINE>if (GroupStatus.notAllowedTransition(curState, GroupStatus.DELETED)) {<NEW_LINE>String errMsg = String.format("Current status=%s was not allowed to delete", curState);<NEW_LINE>LOGGER.error(errMsg);<NEW_LINE>throw new BusinessException(ErrorCodeEnum.GROUP_DELETE_NOT_ALLOWED, errMsg);<NEW_LINE>}<NEW_LINE>if (GroupStatus.allowedLogicDelete(curState)) {<NEW_LINE>streamService.logicDeleteAll(entity.getInlongGroupId(), operator);<NEW_LINE>} else {<NEW_LINE>int count = streamService.selectCountByGroupId(groupId);<NEW_LINE>if (count >= 1) {<NEW_LINE>LOGGER.error("groupId={} have [{}] inlong streams, deleted failed", groupId, count);<NEW_LINE>throw new BusinessException(ErrorCodeEnum.GROUP_HAS_STREAM);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// update the group after deleting related info<NEW_LINE>entity.<MASK><NEW_LINE>entity.setStatus(GroupStatus.DELETED.getCode());<NEW_LINE>entity.setModifier(operator);<NEW_LINE>int rowCount = groupMapper.updateByIdentifierSelective(entity);<NEW_LINE>if (rowCount != InlongConstants.AFFECTED_ONE_ROW) {<NEW_LINE>LOGGER.error("inlong group has already updated with group id={}, curVersion={}", entity.getInlongGroupId(), entity.getVersion());<NEW_LINE>throw new BusinessException(ErrorCodeEnum.CONFIG_EXPIRED);<NEW_LINE>}<NEW_LINE>// logically delete the associated extension info<NEW_LINE>groupExtMapper.logicDeleteAllByGroupId(groupId);<NEW_LINE>LOGGER.info("success to delete group and group ext property for groupId={} by user={}", groupId, operator);<NEW_LINE>return true;<NEW_LINE>} | setIsDeleted(entity.getId()); |
1,486,801 | protected Object resultByBlockNumber(final JsonRpcRequestContext requestContext, final long blockNumber) {<NEW_LINE>final JsonCallParameter callParams = JsonCallParameterUtil.validateAndGetCallParams(requestContext);<NEW_LINE>final TraceTypeParameter traceTypeParameter = requestContext.getRequiredParameter(1, TraceTypeParameter.class);<NEW_LINE>final String blockNumberString = String.valueOf(blockNumber);<NEW_LINE>traceLambda(LOG, "Received RPC rpcName={} callParams={} block={} traceTypes={}", this::getName, callParams::toString, blockNumberString::toString, traceTypeParameter::toString);<NEW_LINE>final Optional<BlockHeader> maybeBlockHeader = blockchainQueriesSupplier.get().getBlockHeaderByNumber(blockNumber);<NEW_LINE>if (maybeBlockHeader.isEmpty()) {<NEW_LINE>return new JsonRpcErrorResponse(requestContext.getRequest().getId(), BLOCK_NOT_FOUND);<NEW_LINE>}<NEW_LINE>final Set<TraceTypeParameter.TraceType> traceTypes = traceTypeParameter.getTraceTypes();<NEW_LINE>final DebugOperationTracer tracer = new DebugOperationTracer(buildTraceOptions(traceTypes));<NEW_LINE>final Optional<TransactionSimulatorResult> maybeSimulatorResult = transactionSimulator.process(callParams, buildTransactionValidationParams(), tracer, maybeBlockHeader.get());<NEW_LINE>if (maybeSimulatorResult.isEmpty()) {<NEW_LINE>LOG.error("Empty simulator result. call params: {}, blockHeader: {} ", callParams, maybeBlockHeader.get());<NEW_LINE>return new JsonRpcErrorResponse(requestContext.getRequest().getId(), INTERNAL_ERROR);<NEW_LINE>}<NEW_LINE>final TransactionSimulatorResult simulatorResult = maybeSimulatorResult.get();<NEW_LINE>if (simulatorResult.isInvalid()) {<NEW_LINE>LOG.error(String.format("Invalid simulator result %s", maybeSimulatorResult));<NEW_LINE>return new JsonRpcErrorResponse(requestContext.getRequest().getId(), INTERNAL_ERROR);<NEW_LINE>}<NEW_LINE>final TransactionTrace transactionTrace = new TransactionTrace(simulatorResult.getTransaction(), simulatorResult.getResult(<MASK><NEW_LINE>final Block block = blockchainQueriesSupplier.get().getBlockchain().getChainHeadBlock();<NEW_LINE>return getTraceCallResult(protocolSchedule, traceTypes, maybeSimulatorResult, transactionTrace, block);<NEW_LINE>} | ), tracer.getTraceFrames()); |
558,797 | public FlowInfo addPotentialInitializationsFrom(FlowInfo inits) {<NEW_LINE>if (this == DEAD_END) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>if (inits == DEAD_END) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>UnconditionalFlowInfo otherInits = inits.unconditionalInits();<NEW_LINE>// union of potentially set ones<NEW_LINE>this.potentialInits |= otherInits.potentialInits;<NEW_LINE>// treating extra storage<NEW_LINE>if (this.extra != null) {<NEW_LINE>if (otherInits.extra != null) {<NEW_LINE>// both sides have extra storage<NEW_LINE>int i = 0, length, otherLength;<NEW_LINE>if ((length = this.extra[0].length) < (otherLength = otherInits.extra[0].length)) {<NEW_LINE>// current storage is shorter -> grow current<NEW_LINE><MASK><NEW_LINE>for (; i < length; i++) {<NEW_LINE>this.extra[1][i] |= otherInits.extra[1][i];<NEW_LINE>}<NEW_LINE>for (; i < otherLength; i++) {<NEW_LINE>this.extra[1][i] = otherInits.extra[1][i];<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// current storage is longer<NEW_LINE>for (; i < otherLength; i++) {<NEW_LINE>this.extra[1][i] |= otherInits.extra[1][i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (otherInits.extra != null) {<NEW_LINE>// no storage here, but other has extra storage.<NEW_LINE>int otherLength = otherInits.extra[0].length;<NEW_LINE>createExtraSpace(otherLength);<NEW_LINE>System.arraycopy(otherInits.extra[1], 0, this.extra[1], 0, otherLength);<NEW_LINE>}<NEW_LINE>addPotentialNullInfoFrom(otherInits);<NEW_LINE>return this;<NEW_LINE>} | growSpace(otherLength, 0, length); |
1,333,183 | public static List<EventSender> build(final Environment environment, final CommonConfiguration<?> config, final MetricRegistry metricRegistry, final String pubsubHealthcheckTopic) {<NEW_LINE>final List<EventSender> senders = new ArrayList<>();<NEW_LINE>final KafkaClientProvider kafkaClientProvider = new KafkaClientProvider(config.getKafkaBrokers());<NEW_LINE>final Optional<KafkaProducer<String, byte[]>> kafkaProducer = kafkaClientProvider.getDefaultProducer();<NEW_LINE>kafkaProducer.ifPresent(producer -> senders.add(new KafkaSender(producer)));<NEW_LINE>final LifecycleEnvironment lifecycle = environment.lifecycle();<NEW_LINE>if (!config.getPubsubPrefixes().isEmpty()) {<NEW_LINE>final PubSub pubsub = PubSubOptions.getDefaultInstance().getService();<NEW_LINE>final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setDaemon(true).setNameFormat<MASK><NEW_LINE>// choose an arbitrary prefix to use in the healthcheck. we assume if we can connect to<NEW_LINE>// one we can connect to all<NEW_LINE>final String topicToHealthcheck = config.getPubsubPrefixes().iterator().next() + pubsubHealthcheckTopic;<NEW_LINE>final GooglePubSubSender.DefaultHealthChecker healthchecker = new GooglePubSubSender.DefaultHealthChecker(pubsub, topicToHealthcheck, executor, Duration.ofMinutes(5));<NEW_LINE>metricRegistry.register("pubsub-health", (Gauge<Boolean>) healthchecker::isHealthy);<NEW_LINE>for (final String prefix : config.getPubsubPrefixes()) {<NEW_LINE>final GooglePubSubSender sender = GooglePubSubSender.create(pubsub, prefix, healthchecker);<NEW_LINE>senders.add(sender);<NEW_LINE>}<NEW_LINE>lifecycle.manage(new ManagedPubSub(pubsub));<NEW_LINE>}<NEW_LINE>senders.forEach(lifecycle::manage);<NEW_LINE>return senders;<NEW_LINE>} | ("pubsub-healthchecker-%d").build()); |
495,546 | public void onClick(View v) {<NEW_LINE>if (position < getCount() - 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (getCount() > alCustomizationSettings.getMaxAttachmentAllowed()) {<NEW_LINE>Toast.makeText(context, R.string.mobicom_max_attachment_warning, <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ImageView galleryImageView = (ImageView) v;<NEW_LINE>galleryImageView.setEnabled(false);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>Intent getContentIntent = FileUtils.createGetContentIntent(filterOptions, context.getPackageManager());<NEW_LINE>getContentIntent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);<NEW_LINE>Intent intentPick = Intent.createChooser(getContentIntent, context.getString(R.string.select_file));<NEW_LINE>((Activity) context).startActivityForResult(intentPick, REQUEST_CODE);<NEW_LINE>} | Toast.LENGTH_LONG).show(); |
198,395 | public void deleteById(String id) {<NEW_LINE>String workspaceName = Utils.getValueFromIdByName(id, "workspaces");<NEW_LINE>if (workspaceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));<NEW_LINE>}<NEW_LINE>String kustoPoolName = <MASK><NEW_LINE>if (kustoPoolName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'kustoPools'.", id)));<NEW_LINE>}<NEW_LINE>String principalAssignmentName = Utils.getValueFromIdByName(id, "principalAssignments");<NEW_LINE>if (principalAssignmentName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'principalAssignments'.", id)));<NEW_LINE>}<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>this.delete(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, Context.NONE);<NEW_LINE>} | Utils.getValueFromIdByName(id, "kustoPools"); |
1,834,425 | private static void printClassBinding(PrintStream stream, Map<String, String> javaNamesToDisplayNames, PainlessContextClassBindingInfo classBindingInfo) {<NEW_LINE>stream.print("* " + getType(javaNamesToDisplayNames, classBindingInfo.getRtn()) + " " + <MASK><NEW_LINE>for (int parameterIndex = 0; parameterIndex < classBindingInfo.getParameters().size(); ++parameterIndex) {<NEW_LINE>// temporary fix to not print org.opensearch.script.ScoreScript parameter until<NEW_LINE>// class instance bindings are created and the information is appropriately added to the context info classes<NEW_LINE>if ("org.opensearch.script.ScoreScript".equals(getType(javaNamesToDisplayNames, classBindingInfo.getParameters().get(parameterIndex)))) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>stream.print(getType(javaNamesToDisplayNames, classBindingInfo.getParameters().get(parameterIndex)));<NEW_LINE>if (parameterIndex < classBindingInfo.getReadOnly()) {<NEW_LINE>stream.print(" *");<NEW_LINE>}<NEW_LINE>if (parameterIndex + 1 < classBindingInfo.getParameters().size()) {<NEW_LINE>stream.print(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>stream.println(")");<NEW_LINE>} | classBindingInfo.getName() + "("); |
823,765 | private void unlinkFreeBlock(int freeBlockChunkNum) {<NEW_LINE>long freeBlockAddress = (long) freeBlockChunkNum * CHUNK_SIZE;<NEW_LINE>int anotherBlockOfSameSize = 0;<NEW_LINE>int nextBlockChunkNum = getInt(freeBlockAddress + LargeBlock.NEXT_BLOCK_OFFSET);<NEW_LINE>int prevBlockChunkNum = <MASK><NEW_LINE>// Relink the linked list<NEW_LINE>if (nextBlockChunkNum != 0) {<NEW_LINE>anotherBlockOfSameSize = nextBlockChunkNum;<NEW_LINE>putInt((long) nextBlockChunkNum * CHUNK_SIZE + LargeBlock.PREV_BLOCK_OFFSET, prevBlockChunkNum);<NEW_LINE>}<NEW_LINE>if (prevBlockChunkNum != 0) {<NEW_LINE>anotherBlockOfSameSize = prevBlockChunkNum;<NEW_LINE>putInt((long) prevBlockChunkNum * CHUNK_SIZE + LargeBlock.NEXT_BLOCK_OFFSET, nextBlockChunkNum);<NEW_LINE>}<NEW_LINE>boolean wasInTrie = false;<NEW_LINE>long root = getInt(FREE_BLOCK_OFFSET);<NEW_LINE>if (root == freeBlockChunkNum) {<NEW_LINE>putInt(FREE_BLOCK_OFFSET, 0);<NEW_LINE>wasInTrie = true;<NEW_LINE>}<NEW_LINE>int freeBlockSize = getBlockHeaderForChunkNum(freeBlockChunkNum);<NEW_LINE>int parentChunkNum = getInt(freeBlockAddress + LargeBlock.PARENT_OFFSET);<NEW_LINE>if (parentChunkNum != 0) {<NEW_LINE>int currentSize = getBlockHeaderForChunkNum(parentChunkNum);<NEW_LINE>int difference = currentSize ^ freeBlockSize;<NEW_LINE>if (difference != 0) {<NEW_LINE>int firstDifference = LargeBlock.SIZE_OF_SIZE_FIELD * 8 - Integer.numberOfLeadingZeros(difference) - 1;<NEW_LINE>long locationOfChildPointer = (long) parentChunkNum * CHUNK_SIZE + LargeBlock.CHILD_TABLE_OFFSET + (firstDifference * INT_SIZE);<NEW_LINE>int childChunkNum = getInt(locationOfChildPointer);<NEW_LINE>if (childChunkNum == freeBlockChunkNum) {<NEW_LINE>wasInTrie = true;<NEW_LINE>putInt(locationOfChildPointer, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If the removed block was the head of the linked list, we need to reinsert the following entry as the<NEW_LINE>// new head.<NEW_LINE>if (wasInTrie && anotherBlockOfSameSize != 0) {<NEW_LINE>insertChild(parentChunkNum, anotherBlockOfSameSize);<NEW_LINE>}<NEW_LINE>int currentParent = parentChunkNum;<NEW_LINE>for (int childIdx = 0; childIdx < LargeBlock.ENTRIES_IN_CHILD_TABLE; childIdx++) {<NEW_LINE>long childAddress = freeBlockAddress + LargeBlock.CHILD_TABLE_OFFSET + (childIdx * INT_SIZE);<NEW_LINE>int nextChildChunkNum = getInt(childAddress);<NEW_LINE>if (nextChildChunkNum != 0) {<NEW_LINE>if (!wasInTrie) {<NEW_LINE>throw // $NON-NLS-1$<NEW_LINE>describeProblem().// $NON-NLS-1$<NEW_LINE>addProblemAddress(// $NON-NLS-1$<NEW_LINE>"non-null child pointer", // $NON-NLS-1$<NEW_LINE>childAddress, // $NON-NLS-1$<NEW_LINE>INT_SIZE).// $NON-NLS-1$<NEW_LINE>build(// $NON-NLS-1$<NEW_LINE>"All child pointers should be null for a free chunk that is in the sibling list but" + " not part of the trie. Problematic chunk number: " + freeBlockChunkNum);<NEW_LINE>}<NEW_LINE>insertChild(currentParent, nextChildChunkNum);<NEW_LINE>// Parent all subsequent children under the child that was most similar to the old parent<NEW_LINE>if (currentParent == parentChunkNum) {<NEW_LINE>currentParent = nextChildChunkNum;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getInt(freeBlockAddress + LargeBlock.PREV_BLOCK_OFFSET); |
586,210 | public void paintIcon(Component c, Graphics g, int x, int y) {<NEW_LINE>g.setColor(Color.WHITE);<NEW_LINE>g.fillRect(x, y, <MASK><NEW_LINE>g.setColor(new Color(0xb5d5ff));<NEW_LINE>g.drawRect(x, y, getIconWidth(), getIconHeight());<NEW_LINE>float fontSize = getMaxFontSize(g, getIconWidth() - 1, getIconHeight());<NEW_LINE>Font originalFont = g.getFont();<NEW_LINE>Font textFont = originalFont.deriveFont(fontSize).deriveFont(Font.BOLD);<NEW_LINE>g.setFont(textFont);<NEW_LINE>FontMetrics fontMetrics = g.getFontMetrics(textFont);<NEW_LINE>Rectangle2D stringBounds = fontMetrics.getStringBounds(number, g);<NEW_LINE>int textHeight = (int) stringBounds.getHeight();<NEW_LINE>int iconHeight = getIconHeight();<NEW_LINE>int space = y + iconHeight - textHeight;<NEW_LINE>int halfSpace = space >> 1;<NEW_LINE>// - halfTextHeight;// + halfTextHeight;<NEW_LINE>int baselineY = y + iconHeight - halfSpace;<NEW_LINE>int textWidth = (int) stringBounds.getWidth();<NEW_LINE>int iconWidth = getIconWidth();<NEW_LINE>int halfWidth = iconWidth >> 1;<NEW_LINE>int halfTextWidth = textWidth >> 1;<NEW_LINE>int baselineX = x + (halfWidth - halfTextWidth);<NEW_LINE>g.setColor(Color.BLACK);<NEW_LINE>JComponent jc = null;<NEW_LINE>if (c instanceof JComponent) {<NEW_LINE>jc = (JComponent) c;<NEW_LINE>}<NEW_LINE>GraphicsUtils.drawString(jc, g, number, baselineX, baselineY);<NEW_LINE>} | getIconWidth(), getIconHeight()); |
1,072,069 | private long[] _decode(String hash, String alphabet) {<NEW_LINE>final ArrayList<Long> ret = new ArrayList<Long>();<NEW_LINE>int i = 0;<NEW_LINE>final String regexp = "[" + this.guards + "]";<NEW_LINE>String hashBreakdown = hash.replaceAll(regexp, " ");<NEW_LINE>String[] hashArray = hashBreakdown.split(" ");<NEW_LINE>if (hashArray.length == 3 || hashArray.length == 2) {<NEW_LINE>i = 1;<NEW_LINE>}<NEW_LINE>if (hashArray.length > 0) {<NEW_LINE>hashBreakdown = hashArray[i];<NEW_LINE>if (!hashBreakdown.isEmpty()) {<NEW_LINE>final char lottery = hashBreakdown.charAt(0);<NEW_LINE>hashBreakdown = hashBreakdown.substring(1);<NEW_LINE>hashBreakdown = hashBreakdown.replaceAll("[" + this.seps + "]", " ");<NEW_LINE>hashArray = hashBreakdown.split(" ");<NEW_LINE>String subHash, buffer;<NEW_LINE>for (final String aHashArray : hashArray) {<NEW_LINE>subHash = aHashArray;<NEW_LINE>buffer = lottery + this.salt + alphabet;<NEW_LINE>alphabet = Hashids.consistentShuffle(alphabet, buffer.substring(0, alphabet.length()));<NEW_LINE>ret.add(Hashids<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// transform from List<Long> to long[]<NEW_LINE>long[] arr = new long[ret.size()];<NEW_LINE>for (int k = 0; k < arr.length; k++) {<NEW_LINE>arr[k] = ret.get(k);<NEW_LINE>}<NEW_LINE>if (!this.encode(arr).equals(hash)) {<NEW_LINE>arr = new long[0];<NEW_LINE>}<NEW_LINE>return arr;<NEW_LINE>} | .unhash(subHash, alphabet)); |
1,678,017 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String epl = "@name('variables') @public create variable int varhour;\n" + "@public create variable int varmin;\n" + "@public create variable int varsec;\n" + "@public create variable int varmsec;\n";<NEW_LINE>env.compileDeploy(epl, path);<NEW_LINE>String startTime = "2002-05-30T09:00:00.000";<NEW_LINE>env.advanceTime(DateTime.parseDefaultMSec(startTime));<NEW_LINE>String[] fields = "val0,val1,val2,val3,val4,val5".split(",");<NEW_LINE>epl = "@name('s0') select " + "current_timestamp.withTime(varhour, varmin, varsec, varmsec) as val0," + "utildate.withTime(varhour, varmin, varsec, varmsec) as val1," + "longdate.withTime(varhour, varmin, varsec, varmsec) as val2," + "caldate.withTime(varhour, varmin, varsec, varmsec) as val3," + "localdate.withTime(varhour, varmin, varsec, varmsec) as val4," + "zoneddate.withTime(varhour, varmin, varsec, varmsec) as val5" + " from SupportDateTime";<NEW_LINE>env.compileDeploy(epl, path).addListener("s0");<NEW_LINE>env.assertStmtTypes("s0", fields, new EPTypeClass[] { LONGBOXED.getEPType(), DATE.getEPType(), LONGBOXED.getEPType(), CALENDAR.getEPType(), LOCALDATETIME.getEPType(), ZONEDDATETIME.getEPType() });<NEW_LINE>env.sendEventBean(SupportDateTime.make(null));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { SupportDateTime.getValueCoerced(startTime, "long"), null, null, null, null, null });<NEW_LINE>String expectedTime = "2002-05-30T09:00:00.000";<NEW_LINE>// variable is null<NEW_LINE>env.runtimeSetVariable("variables", "varhour", null);<NEW_LINE>env.sendEventBean<MASK><NEW_LINE>env.assertPropsNew("s0", fields, SupportDateTime.getArrayCoerced(expectedTime, "long", "util", "long", "cal", "ldt", "zdt"));<NEW_LINE>expectedTime = "2002-05-30T01:02:03.004";<NEW_LINE>env.runtimeSetVariable("variables", "varhour", 1);<NEW_LINE>env.runtimeSetVariable("variables", "varmin", 2);<NEW_LINE>env.runtimeSetVariable("variables", "varsec", 3);<NEW_LINE>env.runtimeSetVariable("variables", "varmsec", 4);<NEW_LINE>env.sendEventBean(SupportDateTime.make(startTime));<NEW_LINE>env.assertPropsNew("s0", fields, SupportDateTime.getArrayCoerced(expectedTime, "long", "util", "long", "cal", "ldt", "zdt"));<NEW_LINE>expectedTime = "2002-05-30T00:00:00.006";<NEW_LINE>env.runtimeSetVariable("variables", "varhour", 0);<NEW_LINE>env.runtimeSetVariable("variables", "varmin", null);<NEW_LINE>env.runtimeSetVariable("variables", "varsec", null);<NEW_LINE>env.runtimeSetVariable("variables", "varmsec", 6);<NEW_LINE>env.sendEventBean(SupportDateTime.make(startTime));<NEW_LINE>env.assertPropsNew("s0", fields, SupportDateTime.getArrayCoerced(expectedTime, "long", "util", "long", "cal", "ldt", "zdt"));<NEW_LINE>env.undeployAll();<NEW_LINE>} | (SupportDateTime.make(startTime)); |
1,521,631 | public void write(Object source, BaseEntity.Builder sink) {<NEW_LINE>DatastorePersistentEntity<?> persistentEntity = this.mappingContext.<MASK><NEW_LINE>String discriminationFieldName = persistentEntity.getDiscriminationFieldName();<NEW_LINE>List<String> discriminationValues = persistentEntity.getCompatibleDiscriminationValues();<NEW_LINE>if (!discriminationValues.isEmpty() || discriminationFieldName != null) {<NEW_LINE>sink.set(discriminationFieldName, discriminationValues.stream().map(StringValue::of).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(source);<NEW_LINE>persistentEntity.doWithColumnBackedProperties((DatastorePersistentProperty persistentProperty) -> {<NEW_LINE>// Datastore doesn't store its Key as a regular field.<NEW_LINE>if (persistentProperty.isIdProperty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Object val = accessor.getProperty(persistentProperty);<NEW_LINE>Value convertedVal = this.conversions.convertOnWrite(val, persistentProperty);<NEW_LINE>if (persistentProperty.isUnindexed()) {<NEW_LINE>convertedVal = setExcludeFromIndexes(convertedVal);<NEW_LINE>}<NEW_LINE>sink.set(persistentProperty.getFieldName(), convertedVal);<NEW_LINE>} catch (DatastoreDataException ex) {<NEW_LINE>throw new DatastoreDataException("Unable to write " + persistentEntity.kindName() + "." + persistentProperty.getFieldName(), ex);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getPersistentEntity(source.getClass()); |
1,361,527 | public String orderLine(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {<NEW_LINE>Integer C_OrderLine_ID = (Integer) value;<NEW_LINE>if (C_OrderLine_ID == null || C_OrderLine_ID.intValue() == 0)<NEW_LINE>return "";<NEW_LINE>// Get Details<NEW_LINE>MOrderLine ol = new MOrderLine(ctx, C_OrderLine_ID.intValue(), null);<NEW_LINE>if (ol.get_ID() != 0) {<NEW_LINE>if (ol.getC_Charge_ID() > 0 && ol.getM_Product_ID() <= 0) {<NEW_LINE>mTab.setValue("C_Charge_ID", new Integer(ol.getC_Charge_ID()));<NEW_LINE>} else {<NEW_LINE>mTab.setValue("M_Product_ID", new Integer(ol.getM_Product_ID()));<NEW_LINE>mTab.setValue("M_AttributeSetInstance_ID", new Integer(ol.getM_AttributeSetInstance_ID()));<NEW_LINE>}<NEW_LINE>//<NEW_LINE>mTab.setValue("C_UOM_ID", new Integer(ol.getC_UOM_ID()));<NEW_LINE>BigDecimal MovementQty = ol.getQtyOrdered().subtract(ol.getQtyDelivered());<NEW_LINE>mTab.setValue("MovementQty", MovementQty);<NEW_LINE>BigDecimal QtyEntered = MovementQty;<NEW_LINE>if (ol.getQtyEntered().compareTo(ol.getQtyOrdered()) != 0)<NEW_LINE>QtyEntered = QtyEntered.multiply(ol.getQtyEntered()).divide(ol.getQtyOrdered(), 12, BigDecimal.ROUND_HALF_UP);<NEW_LINE>mTab.setValue("QtyEntered", QtyEntered);<NEW_LINE>//<NEW_LINE>mTab.setValue("C_Activity_ID", new Integer(ol.getC_Activity_ID()));<NEW_LINE>mTab.setValue("C_Campaign_ID", new Integer<MASK><NEW_LINE>mTab.setValue("C_Project_ID", new Integer(ol.getC_Project_ID()));<NEW_LINE>mTab.setValue("C_ProjectPhase_ID", new Integer(ol.getC_ProjectPhase_ID()));<NEW_LINE>mTab.setValue("C_ProjectTask_ID", new Integer(ol.getC_ProjectTask_ID()));<NEW_LINE>mTab.setValue("AD_OrgTrx_ID", new Integer(ol.getAD_OrgTrx_ID()));<NEW_LINE>mTab.setValue("User1_ID", new Integer(ol.getUser1_ID()));<NEW_LINE>mTab.setValue("User2_ID", new Integer(ol.getUser2_ID()));<NEW_LINE>mTab.setValue("User3_ID", new Integer(ol.getUser3_ID()));<NEW_LINE>mTab.setValue("User4_ID", new Integer(ol.getUser4_ID()));<NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>} | (ol.getC_Campaign_ID())); |
1,281,094 | public static Range valueOf(String range) {<NEW_LINE>if (range.contains("${")) {<NEW_LINE>// unresolved<NEW_LINE>return new Range(0, 0, false, false, range);<NEW_LINE>}<NEW_LINE>range = range.trim();<NEW_LINE>// || range.endsWith("..");<NEW_LINE>boolean unspecified = range.length() == 0 || range.startsWith("..");<NEW_LINE>int min, max;<NEW_LINE>boolean variable;<NEW_LINE>int dots;<NEW_LINE>if ((dots = range.indexOf("..")) >= 0) {<NEW_LINE>min = parseInt(range.substring<MASK><NEW_LINE>max = parseInt(range.substring(dots + 2), Integer.MAX_VALUE);<NEW_LINE>variable = max == Integer.MAX_VALUE;<NEW_LINE>} else {<NEW_LINE>max = parseInt(range, Integer.MAX_VALUE);<NEW_LINE>variable = !range.contains("+") && max == Integer.MAX_VALUE;<NEW_LINE>min = variable ? 0 : max;<NEW_LINE>}<NEW_LINE>return new Range(min, max, variable, unspecified, unspecified ? null : range);<NEW_LINE>} | (0, dots), 0); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.