idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
274,208 | private void fillInFunctionDefinition(ExpressionDeserialization defDeserializer, DefinitionProtos.Definition.FunctionData functionProto, FunctionDefinition functionDef) throws DeserializationException {<NEW_LINE>functionDef.setOmegaParameters(functionProto.getOmegaParameterList());<NEW_LINE>functionDef.setLevelParameters(readLevelParameters(functionProto.getLevelParamList(), functionProto.getIsStdLevels()));<NEW_LINE>if (functionProto.getHasEnclosingClass()) {<NEW_LINE>functionDef.setHasEnclosingClass(true);<NEW_LINE>}<NEW_LINE>List<Boolean> strictParameters = functionProto.getStrictParametersList();<NEW_LINE>if (!strictParameters.isEmpty()) {<NEW_LINE>functionDef.setStrictParameters(strictParameters);<NEW_LINE>}<NEW_LINE>functionDef.setParameters(defDeserializer.readParameters(functionProto.getParamList()));<NEW_LINE>List<Integer> parametersTypecheckingOrder = functionProto.getParametersTypecheckingOrderList();<NEW_LINE>if (!parametersTypecheckingOrder.isEmpty()) {<NEW_LINE>functionDef.setParametersTypecheckingOrder(parametersTypecheckingOrder);<NEW_LINE>}<NEW_LINE>List<Boolean> goodThisParameters = functionProto.getGoodThisParametersList();<NEW_LINE>if (!goodThisParameters.isEmpty()) {<NEW_LINE>functionDef.setGoodThisParameters(goodThisParameters);<NEW_LINE>}<NEW_LINE>functionDef.setTypeClassParameters(readTypeClassParametersKind(functionProto.getTypeClassParametersList()));<NEW_LINE>for (DefinitionProtos.Definition.ParametersLevel parametersLevelProto : functionProto.getParametersLevelsList()) {<NEW_LINE>functionDef.addParametersLevel(readParametersLevel(defDeserializer, parametersLevelProto));<NEW_LINE>}<NEW_LINE>List<Integer> recursiveDefIndices = functionProto.getRecursiveDefinitionList();<NEW_LINE>if (!recursiveDefIndices.isEmpty()) {<NEW_LINE>Set<Definition> recursiveDefs = new HashSet<>();<NEW_LINE>for (Integer index : recursiveDefIndices) {<NEW_LINE>recursiveDefs.add(myCallTargetProvider.getCallTarget(index));<NEW_LINE>}<NEW_LINE>functionDef.setRecursiveDefinitions(recursiveDefs);<NEW_LINE>}<NEW_LINE>if (functionProto.hasType()) {<NEW_LINE>functionDef.setResultType(defDeserializer.readExpr(functionProto.getType()));<NEW_LINE>}<NEW_LINE>if (functionProto.hasTypeLevel()) {<NEW_LINE>functionDef.setResultTypeLevel(defDeserializer.readExpr(functionProto.getTypeLevel()));<NEW_LINE>}<NEW_LINE>switch(functionProto.getBodyHiddenStatus()) {<NEW_LINE>case HIDDEN:<NEW_LINE>functionDef.hideBody();<NEW_LINE>break;<NEW_LINE>case REALLY_HIDDEN:<NEW_LINE>functionDef.reallyHideBody();<NEW_LINE>}<NEW_LINE>FunctionDefinition.Kind kind;<NEW_LINE>switch(functionProto.getKind()) {<NEW_LINE>case LEMMA:<NEW_LINE>case COCLAUSE_LEMMA:<NEW_LINE>kind = CoreFunctionDefinition.Kind.LEMMA;<NEW_LINE>break;<NEW_LINE>case SFUNC:<NEW_LINE>kind = CoreFunctionDefinition.Kind.SFUNC;<NEW_LINE>break;<NEW_LINE>case TYPE:<NEW_LINE>kind = CoreFunctionDefinition.Kind.TYPE;<NEW_LINE>break;<NEW_LINE>case INSTANCE:<NEW_LINE>kind = CoreFunctionDefinition.Kind.INSTANCE;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>kind = CoreFunctionDefinition.Kind.FUNC;<NEW_LINE>}<NEW_LINE>functionDef.setKind(kind);<NEW_LINE>functionDef.setVisibleParameter(functionProto.getVisibleParameter());<NEW_LINE>if (functionProto.hasBody()) {<NEW_LINE>functionDef.setBody(readBody(defDeserializer, functionProto.getBody(), DependentLink.Helper.size(<MASK><NEW_LINE>}<NEW_LINE>// setTypeClassReference(functionDef.getReferable(), functionDef.getParameters(), functionDef.getResultType());<NEW_LINE>} | functionDef.getParameters()))); |
173,253 | public void postAuthentication(RoutingContext ctx) {<NEW_LINE>final User user = ctx.user();<NEW_LINE>if (user == null) {<NEW_LINE>// bad state<NEW_LINE>ctx.fail(403, new IllegalStateException("no user in the context"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// the user is authenticated, however the user may not have all the required scopes<NEW_LINE>if (scopes.size() > 0) {<NEW_LINE>final JsonObject jwt = user.get("accessToken");<NEW_LINE>if (jwt == null) {<NEW_LINE>ctx.fail(403, new IllegalStateException("Invalid JWT: null"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (jwt.getValue("scope") == null) {<NEW_LINE>ctx.fail(403, new IllegalStateException("Invalid JWT: scope claim is required"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<?> target;<NEW_LINE>if (jwt.getValue("scope") instanceof String) {<NEW_LINE>target = Stream.of(jwt.getString("scope").split(delimiter)).collect(Collectors.toList());<NEW_LINE>} else {<NEW_LINE>target = jwt.getJsonArray("scope").getList();<NEW_LINE>}<NEW_LINE>if (target != null) {<NEW_LINE>for (String scope : scopes) {<NEW_LINE>if (!target.contains(scope)) {<NEW_LINE>ctx.fail(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ctx.next();<NEW_LINE>} | 403, new IllegalStateException("JWT scopes != handler scopes")); |
702,837 | private Node findUp(Node node, int dir, int offset, OutlineView outlineView, boolean canExpand) {<NEW_LINE>if (node == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Node parent = node.getParentNode();<NEW_LINE>Node[] siblings;<NEW_LINE>if (parent == null) {<NEW_LINE>siblings = new Node[] { node };<NEW_LINE>} else {<NEW_LINE>siblings = getChildren(parent, outlineView, canExpand);<NEW_LINE>}<NEW_LINE>int nodeIndex = findChildIndex(node, siblings);<NEW_LINE>if (nodeIndex + offset < 0 || nodeIndex + offset >= siblings.length) {<NEW_LINE>return findUp(parent, dir, dir, outlineView, canExpand);<NEW_LINE>}<NEW_LINE>for (int i = nodeIndex + offset; i >= 0 && i < siblings.length; i += dir) {<NEW_LINE>Node found = findDown(siblings[i], siblings, i, dir, outlineView, canExpand);<NEW_LINE>return found;<NEW_LINE>}<NEW_LINE>return findUp(parent, <MASK><NEW_LINE>} | dir, offset, outlineView, canExpand); |
463,293 | private BucketSearchResult splitBucket(final List<Long> path, final int keyIndex, final K keyToInsert, final OAtomicOperation atomicOperation) throws IOException {<NEW_LINE>final long pageIndex = path.get(path.size() - 1);<NEW_LINE>final OCacheEntry bucketEntry = loadPageForWrite(atomicOperation, <MASK><NEW_LINE>try {<NEW_LINE>final OSBTreeBucketV1<K, V> bucketToSplit = new OSBTreeBucketV1<>(bucketEntry);<NEW_LINE>final boolean splitLeaf = bucketToSplit.isLeaf();<NEW_LINE>final int bucketSize = bucketToSplit.size();<NEW_LINE>final int indexToSplit = bucketSize >>> 1;<NEW_LINE>final K separationKey = bucketToSplit.getKey(indexToSplit, encryption, keySerializer);<NEW_LINE>final List<byte[]> rightEntries = new ArrayList<>(indexToSplit);<NEW_LINE>final int startRightIndex = splitLeaf ? indexToSplit : indexToSplit + 1;<NEW_LINE>for (int i = startRightIndex; i < bucketSize; i++) {<NEW_LINE>rightEntries.add(bucketToSplit.getRawEntry(i, encryption != null, keySerializer, valueSerializer));<NEW_LINE>}<NEW_LINE>if (pageIndex != ROOT_INDEX) {<NEW_LINE>return splitNonRootBucket(path, keyIndex, keyToInsert, pageIndex, bucketToSplit, splitLeaf, indexToSplit, separationKey, rightEntries, atomicOperation);<NEW_LINE>} else {<NEW_LINE>return splitRootBucket(path, keyIndex, keyToInsert, bucketEntry, bucketToSplit, splitLeaf, indexToSplit, separationKey, rightEntries, atomicOperation);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>releasePageFromWrite(atomicOperation, bucketEntry);<NEW_LINE>}<NEW_LINE>} | fileId, pageIndex, false, true); |
44,243 | public static void gen_CharStream(JavaResourceTemplateLocations locations) {<NEW_LINE>try {<NEW_LINE>final File file = new File(<MASK><NEW_LINE>final OutputFile outputFile = new OutputFile(file, charStreamVersion, new String[] { Options.USEROPTION__STATIC, Options.USEROPTION__SUPPORT_CLASS_VISIBILITY_PUBLIC });<NEW_LINE>if (!outputFile.needToWrite) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final PrintWriter ostr = outputFile.getPrintWriter();<NEW_LINE>if (cu_to_insertion_point_1.size() != 0 && ((Token) cu_to_insertion_point_1.get(0)).kind == PACKAGE) {<NEW_LINE>for (int i = 1; i < cu_to_insertion_point_1.size(); i++) {<NEW_LINE>if (((Token) cu_to_insertion_point_1.get(i)).kind == SEMICOLON) {<NEW_LINE>cline = ((Token) (cu_to_insertion_point_1.get(0))).beginLine;<NEW_LINE>ccol = ((Token) (cu_to_insertion_point_1.get(0))).beginColumn;<NEW_LINE>for (int j = 0; j <= i; j++) {<NEW_LINE>printToken((Token) (cu_to_insertion_point_1.get(j)), ostr);<NEW_LINE>}<NEW_LINE>ostr.println("");<NEW_LINE>ostr.println("");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OutputFileGenerator generator = new OutputFileGenerator(locations.getCharStreamTemplateResourceUrl(), Options.getOptions());<NEW_LINE>generator.generate(ostr);<NEW_LINE>ostr.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>System.err.println("Failed to create CharStream " + e);<NEW_LINE>JavaCCErrors.semantic_error("Could not open file CharStream.java for writing.");<NEW_LINE>throw new Error();<NEW_LINE>}<NEW_LINE>} | Options.getOutputDirectory(), "CharStream.java"); |
864,652 | public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException {<NEW_LINE>Logger log = Scope.getCurrentScope(<MASK><NEW_LINE>log.fine("Resolving XML entity name='" + name + "', publicId='" + publicId + "', baseURI='" + baseURI + "', systemId='" + systemId + "'");<NEW_LINE>if (systemId == null) {<NEW_LINE>log.fine("Cannot determine systemId for name=" + name + ", publicId=" + publicId + ". Will load from network.");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String path = systemId.toLowerCase().replace("http://www.liquibase.org/xml/ns/migrator/", "http://www.liquibase.org/xml/ns/dbchangelog/").replaceFirst("https?://", "");<NEW_LINE>ResourceAccessor resourceAccessor = Scope.getCurrentScope().getResourceAccessor();<NEW_LINE>InputStreamList streams = resourceAccessor.openStreams(null, path);<NEW_LINE>if (streams.isEmpty()) {<NEW_LINE>streams = getFallbackResourceAccessor().openStreams(null, path);<NEW_LINE>if (streams.isEmpty() && GlobalConfiguration.SECURE_PARSING.getCurrentValue()) {<NEW_LINE>String errorMessage = "Unable to resolve xml entity " + systemId + " locally: " + GlobalConfiguration.SECURE_PARSING.getKey() + " is set to 'true' which does not allow remote lookups. " + "Set it to 'false' to allow remote lookups of xsd files.";<NEW_LINE>throw new XSDLookUpException(errorMessage);<NEW_LINE>} else {<NEW_LINE>log.fine("Unable to resolve XML entity locally. Will load from network.");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else if (streams.size() == 1) {<NEW_LINE>log.fine("Found XML entity at " + streams.getURIs().get(0));<NEW_LINE>} else if (streams.size() > 1) {<NEW_LINE>log.warning("Found " + streams.size() + " copies of " + systemId + ". Using " + streams.getURIs().get(0));<NEW_LINE>}<NEW_LINE>InputStream stream = streams.iterator().next();<NEW_LINE>org.xml.sax.InputSource source = new org.xml.sax.InputSource(stream);<NEW_LINE>source.setPublicId(publicId);<NEW_LINE>source.setSystemId(systemId);<NEW_LINE>return source;<NEW_LINE>} | ).getLog(getClass()); |
657,081 | private void sendMessage(Message message, CachedTopic cachedTopic) {<NEW_LINE>StartedTimersPair brokerTimers = cachedTopic.startBrokerLatencyTimers();<NEW_LINE>brokerMessageProducer.send(message, cachedTopic, new PublishingCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onUnpublished(Message message, Topic topic, Exception exception) {<NEW_LINE>brokerTimers.close();<NEW_LINE>brokerListeners.onError(message, topic, exception);<NEW_LINE>trackers.get(topic).logError(message.getId(), topic.getName(), <MASK><NEW_LINE>toResend.get().add(ImmutablePair.of(message, cachedTopic));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPublished(Message message, Topic topic) {<NEW_LINE>brokerTimers.close();<NEW_LINE>cachedTopic.incrementPublished();<NEW_LINE>brokerListeners.onAcknowledge(message, topic);<NEW_LINE>trackers.get(topic).logPublished(message.getId(), topic.getName(), "");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | exception.getMessage(), ""); |
477,012 | // Treat Emacs profile specially in order to fix #191895<NEW_LINE>private void emacsProfileFix(final JTextComponent incSearchTextField) {<NEW_LINE>class JumpOutOfSearchAction extends AbstractAction {<NEW_LINE><NEW_LINE>private final String actionName;<NEW_LINE><NEW_LINE>public JumpOutOfSearchAction(String n) {<NEW_LINE>actionName = n;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>looseFocus();<NEW_LINE>if (getActualTextComponent() != null) {<NEW_LINE>ActionEvent ev = new ActionEvent(getActualTextComponent(), e.getID(), e.getActionCommand(), e.getModifiers());<NEW_LINE>Action action = getActualTextComponent().getActionMap().get(actionName);<NEW_LINE>action.actionPerformed(ev);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>String actionName = "caret-begin-line";<NEW_LINE>Action a1 = new JumpOutOfSearchAction(actionName);<NEW_LINE>incSearchTextField.getActionMap().put(actionName, a1);<NEW_LINE>// NOI18N<NEW_LINE>actionName = "caret-end-line";<NEW_LINE>Action a2 = new JumpOutOfSearchAction(actionName);<NEW_LINE>incSearchTextField.getActionMap().put(actionName, a2);<NEW_LINE>// NOI18N<NEW_LINE>incSearchTextField.getInputMap().// NOI18N<NEW_LINE>put(// NOI18N<NEW_LINE>KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK, false), "caret-up-alt");<NEW_LINE>// NOI18N<NEW_LINE>actionName = "caret-up";<NEW_LINE>Action a3 = new JumpOutOfSearchAction(actionName);<NEW_LINE>// NOI18N<NEW_LINE>incSearchTextField.getActionMap(<MASK><NEW_LINE>// NOI18N<NEW_LINE>incSearchTextField.getInputMap().// NOI18N<NEW_LINE>put(// NOI18N<NEW_LINE>KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK, false), "caret-down-alt");<NEW_LINE>// NOI18N<NEW_LINE>actionName = "caret-down";<NEW_LINE>Action a4 = new JumpOutOfSearchAction(actionName);<NEW_LINE>// NOI18N<NEW_LINE>incSearchTextField.getActionMap().put("caret-down-alt", a4);<NEW_LINE>} | ).put("caret-up-alt", a3); |
1,668,868 | public static FileObject findCacheCatalog(FileObject sourceFileObject) {<NEW_LINE>URI privateCatalogURI;<NEW_LINE>Project prj = FileOwnerQuery.getOwner(sourceFileObject);<NEW_LINE>if (prj == null)<NEW_LINE>return null;<NEW_LINE>FileObject prjrtfo = prj.getProjectDirectory();<NEW_LINE>File prjrt = FileUtil.toFile(prjrtfo);<NEW_LINE>if (prjrt == null)<NEW_LINE>return null;<NEW_LINE>String catalogstr = Utilities.DEFAULT_PRIVATE_CATALOG_URI_STR;<NEW_LINE>try {<NEW_LINE>String cachedirstr = findProjectCacheRelative(prj);<NEW_LINE>if (cachedirstr != null) {<NEW_LINE>catalogstr = cachedirstr + "/" + Utilities.PRIVATE_CATALOG_URI_STR;<NEW_LINE>}<NEW_LINE>privateCatalogURI = new URI(catalogstr);<NEW_LINE>} catch (Exception e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>URI cacheURI = prjrt.toURI().resolve(privateCatalogURI);<NEW_LINE><MASK><NEW_LINE>return FileUtil.toFileObject(cacheFile);<NEW_LINE>} | File cacheFile = new File(cacheURI); |
180,560 | public synchronized void showGame(UUID gameId, UUID playerId, GamePane gamePane) {<NEW_LINE>this.gameId = gameId;<NEW_LINE>this.gamePane = gamePane;<NEW_LINE>this.playerId = playerId;<NEW_LINE>MageFrame.addGame(gameId, this);<NEW_LINE>this.feedbackPanel.init(gameId);<NEW_LINE>this.feedbackPanel.clear();<NEW_LINE>this.abilityPicker.init(gameId);<NEW_LINE>this.btnConcede.setVisible(true);<NEW_LINE>this.btnStopWatching.setVisible(false);<NEW_LINE><MASK><NEW_LINE>this.btnCancelSkip.setVisible(true);<NEW_LINE>this.btnToggleMacro.setVisible(true);<NEW_LINE>// cards popup info in chats<NEW_LINE>this.gameChatPanel.setGameData(gameId, bigCard);<NEW_LINE>this.userChatPanel.setGameData(gameId, bigCard);<NEW_LINE>this.btnSkipToNextTurn.setVisible(true);<NEW_LINE>this.btnSkipToEndTurn.setVisible(true);<NEW_LINE>this.btnSkipToNextMain.setVisible(true);<NEW_LINE>this.btnSkipStack.setVisible(true);<NEW_LINE>this.btnSkipToYourTurn.setVisible(true);<NEW_LINE>this.btnSkipToEndStepBeforeYourTurn.setVisible(true);<NEW_LINE>this.pnlReplay.setVisible(false);<NEW_LINE>this.gameChatPanel.clear();<NEW_LINE>SessionHandler.getGameChatId(gameId).ifPresent(uuid -> this.gameChatPanel.connect(uuid));<NEW_LINE>if (!SessionHandler.joinGame(gameId)) {<NEW_LINE>removeGame();<NEW_LINE>} else {<NEW_LINE>// play start sound<NEW_LINE>AudioManager.playYourGameStarted();<NEW_LINE>}<NEW_LINE>} | this.btnSwitchHands.setVisible(false); |
1,309,396 | protected boolean validateIfCanCatchupFromLog(long sinceScn, long startScn, int srcid) throws SQLException, BootstrapProcessingException {<NEW_LINE>int startSCNLogId = <MASK><NEW_LINE>// Its possible that startSCN <= sinceSCN (case of slow bootstrapProducer). Encourage bypass_snapshot for this case<NEW_LINE>if (sinceScn >= startScn)<NEW_LINE>return true;<NEW_LINE>int sinceSCNLogId = -1;<NEW_LINE>try {<NEW_LINE>sinceSCNLogId = _dbDao.getLogIdToCatchup(srcid, sinceScn);<NEW_LINE>} catch (BootstrapProcessingException bpe) {<NEW_LINE>// If sincSCN is too old ( not found in log), we should not bypass bootstrap_snapshot but we can still serve<NEW_LINE>LOG.warn("Got Bootstrap Processing exception. Will disable bypassing snapshot !!", bpe);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// getLogIdToCatchup guarantees that return value is not negative.<NEW_LINE>if (sinceSCNLogId > startSCNLogId) {<NEW_LINE>// because of the earlier check.<NEW_LINE>String msg = "Internal Error. sinceSCNLogId > startSCNLogId but sinceSCN < startSCN, sinceScn:" + sinceScn + ",startScn:" + startScn + ",sinceSCNLogId:" + sinceSCNLogId + ",startSCNLogId:" + startSCNLogId;<NEW_LINE>LOG.error(msg);<NEW_LINE>throw new BootstrapProcessingException(msg);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | _dbDao.getLogIdToCatchup(srcid, startScn); |
1,840,953 | public void processWay(ReaderWay way) {<NEW_LINE>try {<NEW_LINE>if (arrStorageBuilders != null) {<NEW_LINE>int nStorages = arrStorageBuilders.length;<NEW_LINE>if (nStorages > 0) {<NEW_LINE>if (nStorages == 1) {<NEW_LINE>arrStorageBuilders[0].processWay(way);<NEW_LINE>} else if (nStorages == 2) {<NEW_LINE>arrStorageBuilders[0].processWay(way);<NEW_LINE>arrStorageBuilders[1].processWay(way);<NEW_LINE>} else if (nStorages == 3) {<NEW_LINE>arrStorageBuilders[0].processWay(way);<NEW_LINE>arrStorageBuilders[1].processWay(way);<NEW_LINE>arrStorageBuilders[2].processWay(way);<NEW_LINE>} else if (nStorages == 4) {<NEW_LINE>arrStorageBuilders<MASK><NEW_LINE>arrStorageBuilders[1].processWay(way);<NEW_LINE>arrStorageBuilders[2].processWay(way);<NEW_LINE>arrStorageBuilders[3].processWay(way);<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < nStorages; ++i) {<NEW_LINE>arrStorageBuilders[i].processWay(way);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.warning(ex.getMessage() + ". Way id = " + way.getId());<NEW_LINE>}<NEW_LINE>} | [0].processWay(way); |
1,461,889 | public void deleteOldIndices(ActionListener<Boolean> listener) {<NEW_LINE>ClusterState state = clusterService.state();<NEW_LINE>Set<String> indicesToDelete = new HashSet<>();<NEW_LINE>// use the transform context as we access system indexes<NEW_LINE>try (ThreadContext.StoredContext ctx = client.threadPool().getThreadContext().stashWithOrigin(TRANSFORM_ORIGIN)) {<NEW_LINE>indicesToDelete.addAll(Arrays.asList(indexNameExpressionResolver.concreteIndexNames(state, IndicesOptions.lenientExpandHidden(<MASK><NEW_LINE>indicesToDelete.addAll(Arrays.asList(indexNameExpressionResolver.concreteIndexNames(state, IndicesOptions.lenientExpandHidden(), TransformInternalIndexConstants.INDEX_NAME_PATTERN_DEPRECATED)));<NEW_LINE>indicesToDelete.remove(TransformInternalIndexConstants.LATEST_INDEX_VERSIONED_NAME);<NEW_LINE>}<NEW_LINE>if (indicesToDelete.isEmpty()) {<NEW_LINE>listener.onResponse(true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DeleteIndexRequest deleteRequest = new DeleteIndexRequest(indicesToDelete.toArray(new String[0])).indicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN);<NEW_LINE>executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, DeleteIndexAction.INSTANCE, deleteRequest, ActionListener.wrap(response -> {<NEW_LINE>if (response.isAcknowledged() == false) {<NEW_LINE>listener.onFailure(new ElasticsearchStatusException("Failed to delete internal indices", RestStatus.INTERNAL_SERVER_ERROR));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>listener.onResponse(true);<NEW_LINE>}, listener::onFailure));<NEW_LINE>} | ), TransformInternalIndexConstants.INDEX_NAME_PATTERN))); |
1,670,776 | protected void computeTotalDuration() throws MaryConfigurationException {<NEW_LINE>long time = 0;<NEW_LINE>long nRead = 0;<NEW_LINE>boolean haveReadAll = false;<NEW_LINE>try {<NEW_LINE>Pair<ByteBuffer, Long> p = getByteBufferAtTime(0);<NEW_LINE><MASK><NEW_LINE>assert p.getSecond() == 0;<NEW_LINE>while (!haveReadAll) {<NEW_LINE>Datagram dat = getNextDatagram(bb);<NEW_LINE>if (dat == null) {<NEW_LINE>// we may have reached the end of the current byte buffer... try reading another:<NEW_LINE>p = getByteBufferAtTime(time);<NEW_LINE>bb = p.getFirst();<NEW_LINE>assert p.getSecond() == time;<NEW_LINE>dat = getNextDatagram(bb);<NEW_LINE>if (dat == null) {<NEW_LINE>// no, indeed we cannot read any more<NEW_LINE>// abort, we could not read all<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert dat != null;<NEW_LINE>// duration in timeline sample rate<NEW_LINE>time += dat.getDuration();<NEW_LINE>// number of datagrams read<NEW_LINE>nRead++;<NEW_LINE>if (nRead == numDatagrams) {<NEW_LINE>haveReadAll = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new MaryConfigurationException("Could not compute total duration", e);<NEW_LINE>}<NEW_LINE>if (!haveReadAll) {<NEW_LINE>throw new MaryConfigurationException("Could not read all datagrams to compute total duration");<NEW_LINE>}<NEW_LINE>totalDuration = time;<NEW_LINE>} | ByteBuffer bb = p.getFirst(); |
1,040,205 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@public create schema Out (id string);\n" + "@public create window MyWindow#keepall as (value string);\n", path);<NEW_LINE>env.compileExecuteFAF("insert into MyWindow select 'x' as value", path);<NEW_LINE>String eplOne = "on SupportBean insert into Out event-precedence((select intOne from SupportBeanNumeric#lastevent)) select \"a\" as id from MyWindow";<NEW_LINE>env.compileDeploy(true, eplOne, path);<NEW_LINE>String eplTwo = "on SupportBean insert into Out event-precedence((select intTwo from SupportBeanNumeric#lastevent)) select \"b\" as id from MyWindow;\n" + "@name('s0') select * from Out;\n";<NEW_LINE>env.compileDeploy(false, eplTwo, path).addListener("s0");<NEW_LINE><MASK><NEW_LINE>env.sendEventBean(new SupportBeanNumeric(1, 2));<NEW_LINE>sendSBAssert(env, "b", "a");<NEW_LINE>env.sendEventBean(new SupportBeanNumeric(2, 1));<NEW_LINE>sendSBAssert(env, "a", "b");<NEW_LINE>env.undeployAll();<NEW_LINE>} | sendSBAssert(env, "a", "b"); |
446,513 | public MetaClass buildAndGetMetaClass(Class<?> clazz) {<NEW_LINE>MetaClass resultMetaClass = null;<NEW_LINE>String fqClassName = clazz.getName();<NEW_LINE>String packageName;<NEW_LINE>String className;<NEW_LINE>int lastDotIndex = fqClassName.lastIndexOf(C_DOT);<NEW_LINE>if (lastDotIndex != -1) {<NEW_LINE>packageName = fqClassName.substring(0, lastDotIndex);<NEW_LINE>className = fqClassName.substring(lastDotIndex + 1);<NEW_LINE>} else {<NEW_LINE>packageName = S_EMPTY;<NEW_LINE>className = fqClassName;<NEW_LINE>}<NEW_LINE>if (DEBUG_LOGGING) {<NEW_LINE>logger.debug("buildAndGetMetaClass {} {}", packageName, fqClassName);<NEW_LINE>}<NEW_LINE>MetaPackage metaPackage = packageManager.getMetaPackage(packageName);<NEW_LINE>if (metaPackage == null) {<NEW_LINE>metaPackage = packageManager.buildPackage(packageName);<NEW_LINE>}<NEW_LINE>resultMetaClass = new MetaClass(metaPackage, className);<NEW_LINE>packageManager.addMetaClass(resultMetaClass);<NEW_LINE>metaPackage.addClass(resultMetaClass);<NEW_LINE>stats.incCountClass();<NEW_LINE>if (clazz.isInterface()) {<NEW_LINE>resultMetaClass.setInterface(true);<NEW_LINE>}<NEW_LINE>// Class.getDeclaredMethods() or Class.getDeclaredConstructors()<NEW_LINE>// can cause a NoClassDefFoundError / ClassNotFoundException<NEW_LINE>// for a parameter or return type.<NEW_LINE>try {<NEW_LINE>// TODO HERE check for static<NEW_LINE>for (Method m : clazz.getDeclaredMethods()) {<NEW_LINE>MetaMethod metaMethod = new MetaMethod(m, resultMetaClass);<NEW_LINE>resultMetaClass.addMember(metaMethod);<NEW_LINE>stats.incCountMethod();<NEW_LINE>}<NEW_LINE>for (Constructor<?> c : clazz.getDeclaredConstructors()) {<NEW_LINE>MetaConstructor metaConstructor = new MetaConstructor(c, resultMetaClass);<NEW_LINE>resultMetaClass.addMember(metaConstructor);<NEW_LINE>stats.incCountConstructor();<NEW_LINE>}<NEW_LINE>} catch (NoClassDefFoundError ncdfe) {<NEW_LINE>logger.warn("NoClassDefFoundError: '{}' while building class {}", ncdfe.getMessage(), fqClassName);<NEW_LINE>throw ncdfe;<NEW_LINE>} catch (IllegalAccessError iae) {<NEW_LINE>if (!ParseUtil.isVMInternalClass(fqClassName)) {<NEW_LINE>logger.error("Something unexpected happened building meta class {}", fqClassName, iae);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.<MASK><NEW_LINE>}<NEW_LINE>return resultMetaClass;<NEW_LINE>} | error("Something unexpected happened building meta class {}", fqClassName, t); |
1,682,871 | private String waitForUploadPort(String uploadPort, List<String> before, boolean verbose, int timeout) throws InterruptedException, RunnerException {<NEW_LINE>// Wait for a port to appear on the list<NEW_LINE>int elapsed = 0;<NEW_LINE>while (elapsed < timeout) {<NEW_LINE>List<String> now = Serial.list();<NEW_LINE>List<String> diff = new ArrayList<>(now);<NEW_LINE>diff.removeAll(before);<NEW_LINE>if (verbose) {<NEW_LINE>System.out.print("PORTS {");<NEW_LINE>for (String p : before) System.out.print(p + ", ");<NEW_LINE>System.out.print("} / {");<NEW_LINE>for (String p : now) System.out.print(p + ", ");<NEW_LINE>System.out.print("} => {");<NEW_LINE>for (String p : diff) System.out.print(p + ", ");<NEW_LINE>System.out.println("}");<NEW_LINE>}<NEW_LINE>if (diff.size() > 0) {<NEW_LINE>String newPort = diff.get(0);<NEW_LINE>if (verbose)<NEW_LINE>System.out.println("Found upload port: " + newPort);<NEW_LINE>return newPort;<NEW_LINE>}<NEW_LINE>// Keep track of port that disappears<NEW_LINE>before = now;<NEW_LINE>Thread.sleep(250);<NEW_LINE>elapsed += 250;<NEW_LINE>// On Windows and OS X, it can take a few seconds for the port to disappear and<NEW_LINE>// come back, so use a time out before assuming that the selected port is the<NEW_LINE>// bootloader (not the sketch).<NEW_LINE>if (elapsed >= 5000 && now.contains(uploadPort)) {<NEW_LINE>if (verbose)<NEW_LINE>System.out.println("Uploading using selected port: " + uploadPort);<NEW_LINE>return uploadPort;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Something happened while detecting port<NEW_LINE>throw new RunnerException<MASK><NEW_LINE>} | (tr("Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload."), false); |
461,658 | public boolean voidIt() {<NEW_LINE>log.info(toString());<NEW_LINE>if (DOCSTATUS_Closed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Voided.equals(getDocStatus())) {<NEW_LINE>processMsg = "Document Closed: " + getDocStatus();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Not Processed<NEW_LINE>if (DOCSTATUS_Drafted.equals(getDocStatus()) || DOCSTATUS_Invalid.equals(getDocStatus()) || DOCSTATUS_InProgress.equals(getDocStatus()) || DOCSTATUS_Approved.equals(getDocStatus()) || DOCSTATUS_NotApproved.equals(getDocStatus())) {<NEW_LINE>// Before Void<NEW_LINE>processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_VOID);<NEW_LINE>if (processMsg != null)<NEW_LINE>return false;<NEW_LINE>// Set lines to 0<NEW_LINE>MInOutLine[] lines = getLines(false);<NEW_LINE>for (int i = 0; i < lines.length; i++) {<NEW_LINE>MInOutLine line = lines[i];<NEW_LINE>BigDecimal old = line.getMovementQty();<NEW_LINE>if (old.signum() != 0) {<NEW_LINE>line.setQty(Env.ZERO);<NEW_LINE>line.addDescription("Void (" + old + ")");<NEW_LINE>line.save(get_TrxName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Void Confirmations<NEW_LINE>// need to set & save docstatus to be able to check it in MInOutConfirm.voidIt()<NEW_LINE>setDocStatus(DOCSTATUS_Voided);<NEW_LINE>saveEx();<NEW_LINE>voidConfirmations();<NEW_LINE>} else {<NEW_LINE>boolean isAccrual = false;<NEW_LINE>try {<NEW_LINE>MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());<NEW_LINE>} catch (PeriodClosedException periodClosedException) {<NEW_LINE>isAccrual = true;<NEW_LINE>}<NEW_LINE>if (isAccrual)<NEW_LINE>return reverseAccrualIt();<NEW_LINE>else<NEW_LINE>return reverseCorrectIt();<NEW_LINE>}<NEW_LINE>// After Void<NEW_LINE>processMsg = ModelValidationEngine.get().<MASK><NEW_LINE>if (processMsg != null)<NEW_LINE>return false;<NEW_LINE>setProcessed(true);<NEW_LINE>setDocAction(DOCACTION_None);<NEW_LINE>return true;<NEW_LINE>} | fireDocValidate(this, ModelValidator.TIMING_AFTER_VOID); |
1,118,552 | public String execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {<NEW_LINE>BimDatabaseAction<User> action = new GetUserByUserTokenDatabaseAction(getDatabaseSession(), getAccessMethod(), userToken);<NEW_LINE>User user = action.execute();<NEW_LINE>if (user != null) {<NEW_LINE>if (user.getState() == ObjectState.DELETED) {<NEW_LINE>throw new UserException("User account has been deleted");<NEW_LINE>} else if (user.getUserType() == UserType.SYSTEM) {<NEW_LINE>throw new UserException("System user cannot login");<NEW_LINE>}<NEW_LINE>Authorization authorization = null;<NEW_LINE>if (user.getUserType() == UserType.ADMIN) {<NEW_LINE>authorization = new AdminAuthorization(bimServer.getServerSettingsCache().getServerSettings().getSessionTimeOutSeconds(), TimeUnit.SECONDS);<NEW_LINE>} else {<NEW_LINE>authorization = new UserAuthorization(bimServer.getServerSettingsCache().getServerSettings().getSessionTimeOutSeconds(), TimeUnit.SECONDS);<NEW_LINE>}<NEW_LINE>authorization.setUoid(user.getOid());<NEW_LINE>authorization.setUsername(user.getUsername());<NEW_LINE>String asHexToken = authorization.asHexToken(bimServer.getEncryptionKey());<NEW_LINE>serviceMap.setAuthorization(authorization);<NEW_LINE>if (bimServer.getServerSettingsCache().getServerSettings().isStoreLastLogin()) {<NEW_LINE>user.setLastSeen(new Date());<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return asHexToken;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Adding a random sleep to prevent timing attacks<NEW_LINE>Thread.sleep(DEFAULT_LOGIN_ERROR_TIMEOUT + new java.security.SecureRandom().nextInt(1000));<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>}<NEW_LINE>throw new UserException("Invalid token", DefaultErrorCode.INVALID_TOKEN);<NEW_LINE>} | getDatabaseSession().store(user); |
930,382 | public void actionPerformed(ActionEvent exception) {<NEW_LINE>boolean hasXPathQuery = StringUtils.isNotBlank(xpathQueryArea.getText());<NEW_LINE>StringBuilder buffer = new StringBuilder(200);<NEW_LINE>appendLn(buffer, "<rule name=\"" + rulenameField.getText() + '\"');<NEW_LINE>appendLn(buffer, " message=\"" + <MASK><NEW_LINE>appendLn(buffer, " class=\"" + (hasXPathQuery ? "net.sourceforge.pmd.lang.rule.XPathRule" : "") + "\">");<NEW_LINE>appendLn(buffer, " <description>");<NEW_LINE>appendLn(buffer, " " + ruledescField.getText());<NEW_LINE>appendLn(buffer, " </description>");<NEW_LINE>if (hasXPathQuery) {<NEW_LINE>appendLn(buffer, " <properties>");<NEW_LINE>appendLn(buffer, " <property name=\"xpath\">");<NEW_LINE>appendLn(buffer, " <value>");<NEW_LINE>appendLn(buffer, "<![CDATA[");<NEW_LINE>appendLn(buffer, xpathQueryArea.getText());<NEW_LINE>appendLn(buffer, "]]>");<NEW_LINE>appendLn(buffer, " </value>");<NEW_LINE>appendLn(buffer, " </property>");<NEW_LINE>appendLn(buffer, " </properties>");<NEW_LINE>}<NEW_LINE>appendLn(buffer, " <priority>3</priority>");<NEW_LINE>appendLn(buffer, " <example>");<NEW_LINE>appendLn(buffer, "<![CDATA[");<NEW_LINE>appendLn(buffer, codeEditorPane.getText());<NEW_LINE>appendLn(buffer, "]]>");<NEW_LINE>appendLn(buffer, " </example>");<NEW_LINE>appendLn(buffer, "</rule>");<NEW_LINE>ruleXMLArea.setText(buffer.toString());<NEW_LINE>repaint();<NEW_LINE>} | rulemsgField.getText() + '\"'); |
1,732,541 | public SpellCorrectedQuery unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SpellCorrectedQuery spellCorrectedQuery = new SpellCorrectedQuery();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("SuggestedQueryText", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>spellCorrectedQuery.setSuggestedQueryText(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Corrections", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>spellCorrectedQuery.setCorrections(new ListUnmarshaller<Correction>(CorrectionJsonUnmarshaller.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 spellCorrectedQuery;<NEW_LINE>} | )).unmarshall(context)); |
1,834,826 | public void assertBasePricingIsValid(final I_M_PriceList priceList) {<NEW_LINE>final IPriceListDAO priceListsRepo = Services.get(IPriceListDAO.class);<NEW_LINE>// final PriceListVersionId basePriceListVersionId = priceListsRepo.getBasePriceListVersionIdForPricingCalculationOrNull(plv);<NEW_LINE>// if (basePriceListVersionId != null)<NEW_LINE>// {<NEW_LINE>final int basePriceListId = priceList.getBasePriceList_ID();<NEW_LINE>if (basePriceListId <= 0) {<NEW_LINE>// nothing to do<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final I_M_PriceList basePriceList = priceListsRepo.getById(basePriceListId);<NEW_LINE>//<NEW_LINE>final CurrencyId baseCurrencyId = CurrencyId.ofRepoId(basePriceList.getC_Currency_ID());<NEW_LINE>final CurrencyId currencyId = CurrencyId.ofRepoId(priceList.getC_Currency_ID());<NEW_LINE>if (!CurrencyId.equals(baseCurrencyId, currencyId)) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>final CountryId baseCountryId = CountryId.ofRepoIdOrNull(basePriceList.getC_Country_ID());<NEW_LINE>final CountryId countryId = CountryId.ofRepoIdOrNull(priceList.getC_Country_ID());<NEW_LINE>if (!CountryId.equals(baseCountryId, countryId)) {<NEW_LINE>throw new AdempiereException("@PriceListAndBasePriceListCountryMismatchError@").markAsUserValidationError();<NEW_LINE>}<NEW_LINE>} | AdempiereException("@PriceListAndBasePriceListCurrencyMismatchError@").markAsUserValidationError(); |
1,059,544 | private Object compensateSubStateMachine(ProcessContext context, ServiceTaskState state, Object input, StateInstance stateInstance, StateMachineEngine engine) {<NEW_LINE>String subStateMachineParentId = (String) context.getVariable(state.getName() + DomainConstants.VAR_NAME_SUB_MACHINE_PARENT_ID);<NEW_LINE>if (StringUtils.isEmpty(subStateMachineParentId)) {<NEW_LINE>throw new EngineExecutionException("sub statemachine parentId is required", FrameworkErrorCode.ObjectNotExists);<NEW_LINE>}<NEW_LINE>StateMachineConfig stateMachineConfig = (StateMachineConfig) context.getVariable(DomainConstants.VAR_NAME_STATEMACHINE_CONFIG);<NEW_LINE>List<StateMachineInstance> subInst = stateMachineConfig.getStateLogStore().queryStateMachineInstanceByParentId(subStateMachineParentId);<NEW_LINE>if (CollectionUtils.isEmpty(subInst)) {<NEW_LINE>throw new EngineExecutionException("cannot find sub statemachine instance by parentId:" + subStateMachineParentId, FrameworkErrorCode.ObjectNotExists);<NEW_LINE>}<NEW_LINE>String subStateMachineInstId = subInst.get(0).getId();<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug(">>>>>>>>>>>>>>>>>>>>>> Start to compensate sub statemachine [id:{}]", subStateMachineInstId);<NEW_LINE>}<NEW_LINE>Map<String, Object> startParams = new HashMap<>(0);<NEW_LINE>if (input instanceof List) {<NEW_LINE>List<Object> listInputParams = (List<Object>) input;<NEW_LINE>if (listInputParams.size() > 0) {<NEW_LINE>startParams = (Map<String, Object>) listInputParams.get(0);<NEW_LINE>}<NEW_LINE>} else if (input instanceof Map) {<NEW_LINE>startParams = (<MASK><NEW_LINE>}<NEW_LINE>StateMachineInstance compensateInst = engine.compensate(subStateMachineInstId, startParams);<NEW_LINE>stateInstance.setStatus(compensateInst.getCompensationStatus());<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("<<<<<<<<<<<<<<<<<<<<<< Compensate sub statemachine [id:{}] finished with status[{}], " + "compensateState[{}]", subStateMachineInstId, compensateInst.getStatus(), compensateInst.getCompensationStatus());<NEW_LINE>}<NEW_LINE>return compensateInst.getEndParams();<NEW_LINE>} | Map<String, Object>) input; |
638,601 | public void start() {<NEW_LINE>if (current != null) {<NEW_LINE>current.show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Form hi = new Form("Hi World", new GridLayout(1, 2));<NEW_LINE>hi.setScrollable(false);<NEW_LINE>Container draggable = new Container(new FlowLayout()) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void paint(Graphics g) {<NEW_LINE>super.paint(g);<NEW_LINE>g.setColor(0x0);<NEW_LINE>g.setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font<MASK><NEW_LINE>g.drawString("Draggable", 0, 0);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>draggable.getStyle().setBorder(Border.createLineBorder(1, 0xff0000));<NEW_LINE>draggable.setDraggable(true);<NEW_LINE>draggable.addDropListener(evt -> {<NEW_LINE>System.out.println("Dropped");<NEW_LINE>});<NEW_LINE>Container dropTarget = new Container(new FlowLayout()) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void paint(Graphics g) {<NEW_LINE>super.paint(g);<NEW_LINE>g.setColor(0x0);<NEW_LINE>g.setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL));<NEW_LINE>g.drawString("Drop Target", 0, 0);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>dropTarget.getStyle().setBorder(Border.createLineBorder(1, 0x00ff00));<NEW_LINE>dropTarget.setDropTarget(true);<NEW_LINE>dropTarget.add(new Label("DropTarget"));<NEW_LINE>hi.addAll(draggable, dropTarget);<NEW_LINE>hi.show();<NEW_LINE>} | .STYLE_PLAIN, Font.SIZE_SMALL)); |
544,961 | public String prepareIt() {<NEW_LINE>log.info(toString());<NEW_LINE>m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);<NEW_LINE>if (m_processMsg != null)<NEW_LINE>return DocAction.STATUS_Invalid;<NEW_LINE>MRequisitionLine[] lines = getLines();<NEW_LINE>// Invalid<NEW_LINE>if (getAD_User_ID() == 0 || getM_PriceList_ID() == 0 || getM_Warehouse_ID() == 0) {<NEW_LINE>return DocAction.STATUS_Invalid;<NEW_LINE>}<NEW_LINE>if (lines.length == 0) {<NEW_LINE>throw new AdempiereException("@NoLines@");<NEW_LINE>}<NEW_LINE>// Std Period open?<NEW_LINE>MPeriod.testPeriodOpen(getCtx(), getDateDoc(), MDocType.DOCBASETYPE_PurchaseRequisition, getAD_Org_ID());<NEW_LINE>// Add up Amounts<NEW_LINE>int precision = MPriceList.getStandardPrecision(getCtx(), getM_PriceList_ID());<NEW_LINE>BigDecimal totalLines = Env.ZERO;<NEW_LINE>for (int i = 0; i < lines.length; i++) {<NEW_LINE>MRequisitionLine line = lines[i];<NEW_LINE>BigDecimal lineNet = line.getQty().multiply(line.getPriceActual());<NEW_LINE>lineNet = lineNet.<MASK><NEW_LINE>if (lineNet.compareTo(line.getLineNetAmt()) != 0) {<NEW_LINE>line.setLineNetAmt(lineNet);<NEW_LINE>line.saveEx();<NEW_LINE>}<NEW_LINE>totalLines = totalLines.add(line.getLineNetAmt());<NEW_LINE>}<NEW_LINE>if (totalLines.compareTo(getTotalLines()) != 0) {<NEW_LINE>setTotalLines(totalLines);<NEW_LINE>saveEx();<NEW_LINE>}<NEW_LINE>if (!calculateTaxTotal()) {<NEW_LINE>m_processMsg = "Error calculating tax";<NEW_LINE>return DocAction.STATUS_Invalid;<NEW_LINE>}<NEW_LINE>m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);<NEW_LINE>if (m_processMsg != null)<NEW_LINE>return DocAction.STATUS_Invalid;<NEW_LINE>m_justPrepared = true;<NEW_LINE>return DocAction.STATUS_InProgress;<NEW_LINE>} | setScale(precision, BigDecimal.ROUND_HALF_UP); |
1,040,029 | private void copy() {<NEW_LINE>StringBuilder strBuffer = new StringBuilder();<NEW_LINE>int numcols = insertRecordTableUI.getSelectedColumnCount();<NEW_LINE>int numrows = insertRecordTableUI.getSelectedRowCount();<NEW_LINE>int[<MASK><NEW_LINE>int[] colsselected = insertRecordTableUI.getSelectedColumns();<NEW_LINE>if (!((numrows - 1 == rowsselected[rowsselected.length - 1] - rowsselected[0] && numrows == rowsselected.length) && (numcols - 1 == colsselected[colsselected.length - 1] - colsselected[0] && numcols == colsselected.length))) {<NEW_LINE>JOptionPane.showMessageDialog(null, "Invalid Copy Selection", "Invalid Copy Selection", JOptionPane.ERROR_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < numrows; i++) {<NEW_LINE>for (int j = 0; j < numcols; j++) {<NEW_LINE>strBuffer.append(insertRecordTableUI.getValueAt(rowsselected[i], colsselected[j]));<NEW_LINE>if (j < numcols - 1) {<NEW_LINE>strBuffer.append("\t");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>strBuffer.append("\n");<NEW_LINE>}<NEW_LINE>StringSelection stringSelection = new StringSelection(strBuffer.toString());<NEW_LINE>clipBoard = Toolkit.getDefaultToolkit().getSystemClipboard();<NEW_LINE>clipBoard.setContents(stringSelection, stringSelection);<NEW_LINE>} | ] rowsselected = insertRecordTableUI.getSelectedRows(); |
995,740 | private void testLowerBoundCapacitiesReduction(int vertices, int edges, int source, int target, Exercise41.RandomNetworkGenerator randomNetworkGenerator, Exercise41.RandomCapacity randomUniformCapacity) {<NEW_LINE>FlowEdgeWithLowerBoundCapacity[] edgesWithLowerBoundCapacities = new FlowEdgeWithLowerBoundCapacity[edges];<NEW_LINE>for (int i = 0; i < edges; i++) {<NEW_LINE>Exercise41.VertexPair vertexPair = randomNetworkGenerator.getRandomVerticesPair(vertices);<NEW_LINE>double randomCapacity = randomUniformCapacity.getRandomCapacity();<NEW_LINE>double randomLowerBoundCapacity = 0;<NEW_LINE>boolean shouldHaveLowerBoundCapacity = StdRandom.uniform(50) == 0;<NEW_LINE>if (shouldHaveLowerBoundCapacity) {<NEW_LINE>double maxLowerBoundCapacity = randomCapacity * 0.2;<NEW_LINE>randomLowerBoundCapacity = StdRandom.uniform(0, maxLowerBoundCapacity);<NEW_LINE>}<NEW_LINE>edgesWithLowerBoundCapacities[i] = new FlowEdgeWithLowerBoundCapacity(vertexPair.vertex1, vertexPair.vertex2, randomCapacity, randomLowerBoundCapacity);<NEW_LINE>}<NEW_LINE>maxFlowLowerBoundCapacities(vertices, edgesWithLowerBoundCapacities, source, target);<NEW_LINE>FlowEdgeWithLowerBoundCapacity[] edgesWithLowerBoundCapacities1 = new FlowEdgeWithLowerBoundCapacity[4];<NEW_LINE>edgesWithLowerBoundCapacities1[0] = new FlowEdgeWithLowerBoundCapacity(0, 1, 3, 1);<NEW_LINE>edgesWithLowerBoundCapacities1[1] = new FlowEdgeWithLowerBoundCapacity(1, 2, 3, 1);<NEW_LINE>edgesWithLowerBoundCapacities1[2] = new FlowEdgeWithLowerBoundCapacity(2, 3, 4, 2);<NEW_LINE>edgesWithLowerBoundCapacities1[3] = new FlowEdgeWithLowerBoundCapacity(3, 1, 2, 1);<NEW_LINE>maxFlowLowerBoundCapacities(4, edgesWithLowerBoundCapacities1, 0, 3);<NEW_LINE>StdOut.println("Expected max flow: 2");<NEW_LINE>// Based on the example in https://codeforces.com/blog/entry/48611<NEW_LINE>FlowEdgeWithLowerBoundCapacity[] edgesWithLowerBoundCapacities2 = new FlowEdgeWithLowerBoundCapacity[5];<NEW_LINE>edgesWithLowerBoundCapacities2[0] = new FlowEdgeWithLowerBoundCapacity(<MASK><NEW_LINE>edgesWithLowerBoundCapacities2[1] = new FlowEdgeWithLowerBoundCapacity(0, 2, 1, 0);<NEW_LINE>edgesWithLowerBoundCapacities2[2] = new FlowEdgeWithLowerBoundCapacity(1, 3, 1, 0);<NEW_LINE>edgesWithLowerBoundCapacities2[3] = new FlowEdgeWithLowerBoundCapacity(2, 3, 1, 0);<NEW_LINE>edgesWithLowerBoundCapacities2[4] = new FlowEdgeWithLowerBoundCapacity(1, 2, 1, 1);<NEW_LINE>maxFlowLowerBoundCapacities(5, edgesWithLowerBoundCapacities2, 0, 3);<NEW_LINE>StdOut.println("Expected max flow: 1");<NEW_LINE>} | 0, 1, 1, 0); |
1,692,543 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {<NEW_LINE>int availableWidth = MeasureSpec.getSize(widthMeasureSpec);<NEW_LINE>int titleWidth = availableWidth - connectorWidth - moreSize - 4 * rowMargins;<NEW_LINE>int titleWidthSpec = MeasureSpec.makeMeasureSpec(titleWidth, MeasureSpec.AT_MOST);<NEW_LINE>int titleHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);<NEW_LINE><MASK><NEW_LINE>int moreSizeSpec = MeasureSpec.makeMeasureSpec(moreSize, MeasureSpec.EXACTLY);<NEW_LINE>moreButton.measure(moreSizeSpec, moreSizeSpec);<NEW_LINE>int totalHeight = titleMarginTop + title.getMeasuredHeight();<NEW_LINE>int detailsWidth = availableWidth - connectorWidth - 3 * rowMargins;<NEW_LINE>int detailsWidthSpec = MeasureSpec.makeMeasureSpec(detailsWidth, MeasureSpec.AT_MOST);<NEW_LINE>int detailsHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);<NEW_LINE>details.measure(detailsWidthSpec, detailsHeightSpec);<NEW_LINE>if (details.getVisibility() != GONE) {<NEW_LINE>totalHeight += details.getMeasuredHeight();<NEW_LINE>}<NEW_LINE>totalHeight = Math.max(totalHeight, minHeight);<NEW_LINE>int connectorWidthSpec = MeasureSpec.makeMeasureSpec(connectorWidth, MeasureSpec.EXACTLY);<NEW_LINE>int connectorHeightSpec = MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.EXACTLY);<NEW_LINE>connector.measure(connectorWidthSpec, connectorHeightSpec);<NEW_LINE>setMeasuredDimension(availableWidth, totalHeight);<NEW_LINE>} | title.measure(titleWidthSpec, titleHeightSpec); |
170,948 | public void onRegTmMessage(RpcMessage request, ChannelHandlerContext ctx, RegisterCheckAuthHandler checkAuthHandler) {<NEW_LINE>RegisterTMRequest message = (RegisterTMRequest) request.getBody();<NEW_LINE>String ipAndPort = NetUtil.toStringAddress(ctx.channel().remoteAddress());<NEW_LINE>Version.putChannelVersion(ctx.channel(), message.getVersion());<NEW_LINE>boolean isSuccess = false;<NEW_LINE>String errorInfo = StringUtils.EMPTY;<NEW_LINE>try {<NEW_LINE>if (checkAuthHandler == null || checkAuthHandler.regTransactionManagerCheckAuth(message)) {<NEW_LINE>ChannelManager.registerTMChannel(message, ctx.channel());<NEW_LINE>Version.putChannelVersion(ctx.channel(), message.getVersion());<NEW_LINE>isSuccess = true;<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("checkAuth for client:{},vgroup:{},applicationId:{} is OK", ipAndPort, message.getTransactionServiceGroup(), message.getApplicationId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception exx) {<NEW_LINE>isSuccess = false;<NEW_LINE>errorInfo = exx.getMessage();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>RegisterTMResponse response = new RegisterTMResponse(isSuccess);<NEW_LINE>if (StringUtils.isNotEmpty(errorInfo)) {<NEW_LINE>response.setMsg(errorInfo);<NEW_LINE>}<NEW_LINE>getServerMessageSender().sendAsyncResponse(request, ctx.channel(), response);<NEW_LINE>if (LOGGER.isInfoEnabled()) {<NEW_LINE>LOGGER.info("TM register success,message:{},channel:{},client version:{}", message, ctx.channel(), message.getVersion());<NEW_LINE>}<NEW_LINE>} | LOGGER.error("TM register fail, error message:{}", errorInfo); |
1,517,505 | private boolean isValidData() {<NEW_LINE>final String ontTxt = getOntologyIRIString();<NEW_LINE>final String versionTxt = getOntologyVersionIRIString();<NEW_LINE>if (ontTxt.isEmpty()) {<NEW_LINE>// cannot have a version IRI without an ontology IRI<NEW_LINE>return versionTxt.isEmpty();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>URI ontologyURI = new URI(ontTxt);<NEW_LINE>ontologyIRIField.clearErrorMessage();<NEW_LINE>ontologyIRIField.clearErrorLocation();<NEW_LINE>try {<NEW_LINE>if (!versionTxt.isEmpty()) {<NEW_LINE>URI versionURI = new URI(versionTxt);<NEW_LINE>versionIRIField.clearErrorMessage();<NEW_LINE>versionIRIField.clearErrorLocation();<NEW_LINE>return ontologyURI.isAbsolute() && versionURI.isAbsolute();<NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>versionIRIField.setErrorMessage(e.getMessage());<NEW_LINE>versionIRIField.<MASK><NEW_LINE>versionIRIField.setToolTipText(e.getMessage());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return ontologyURI.isAbsolute();<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>ontologyIRIField.setErrorLocation(e.getIndex());<NEW_LINE>ontologyIRIField.setErrorMessage(e.getMessage());<NEW_LINE>ontologyIRIField.setToolTipText(e.getMessage());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | setErrorLocation(e.getIndex()); |
1,641,257 | private Color convertColor(String rgbaString) {<NEW_LINE>String[] splits = rgbaString.split(",");<NEW_LINE>Integer[] rgb = new Integer[3];<NEW_LINE>double a = 1;<NEW_LINE>for (int i = 0; i < splits.length; i++) {<NEW_LINE>if (i == 0) {<NEW_LINE>rgb[0] = Integer.parseInt(splits[i].substring(5).trim());<NEW_LINE>} else if (i == 1) {<NEW_LINE>rgb[1] = Integer.parseInt(splits[i].trim());<NEW_LINE>} else if (i == 2) {<NEW_LINE>rgb[2] = Integer.parseInt(splits[i].trim());<NEW_LINE>} else if (i == 3) {<NEW_LINE>a = Double.parseDouble(splits[i].substring(0, splits[i].length() - 1).trim());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StringBuilder stringBuilder = new StringBuilder("#");<NEW_LINE>for (Integer color : rgb) {<NEW_LINE>if (color < 16) {<NEW_LINE>stringBuilder.append("0");<NEW_LINE>}<NEW_LINE>stringBuilder.append(Integer.toHexString(color));<NEW_LINE>}<NEW_LINE>return Color.create(stringBuilder.toString()<MASK><NEW_LINE>} | , String.valueOf(a)); |
1,030,443 | public // However, we ran into issues in callers of the method if we used that type.<NEW_LINE>TransferFunction createFlowTransferFunction(CFAbstractAnalysis<Value, Store, TransferFunction> analysis) {<NEW_LINE>// Try to reflectively load the visitor.<NEW_LINE>Class<?> checkerClass = checker.getClass();<NEW_LINE>while (checkerClass != BaseTypeChecker.class) {<NEW_LINE>TransferFunction result = BaseTypeChecker.invokeConstructorFor(BaseTypeChecker.getRelatedClassName(checkerClass, "Transfer"), new Class<?>[] { analysis.getClass() }, <MASK><NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>checkerClass = checkerClass.getSuperclass();<NEW_LINE>}<NEW_LINE>// If a transfer function couldn't be loaded reflectively, return the default.<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>TransferFunction ret = (TransferFunction) new CFTransfer((CFAbstractAnalysis<CFValue, CFStore, CFTransfer>) analysis);<NEW_LINE>return ret;<NEW_LINE>} | new Object[] { analysis }); |
1,612,465 | private List<IPair<IAllocationRequest, IAllocationResult>> unloadAll(final IHUContext huContext, final I_M_HU hu) {<NEW_LINE>final List<IPair<IAllocationRequest, IAllocationResult>> result = new ArrayList<>();<NEW_LINE>final HUIteratorListenerAdapter huIteratorListener = new HUIteratorListenerAdapter() {<NEW_LINE><NEW_LINE>private IAllocationRequest createAllocationRequest(final IProductStorage productStorage) {<NEW_LINE>final IAllocationRequest request = // date<NEW_LINE>AllocationUtils.// date<NEW_LINE>createQtyRequest(// date<NEW_LINE>huContext, // date<NEW_LINE>productStorage.getProductId(), // date<NEW_LINE>productStorage.getQty(), getHUIterator().getDate());<NEW_LINE>return request;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Result beforeHUItemStorage(final IMutable<IHUItemStorage> itemStorage) {<NEW_LINE>// don't go downstream because we don't care what's there<NEW_LINE>return Result.SKIP_DOWNSTREAM;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Result afterHUItemStorage(final IHUItemStorage itemStorage) {<NEW_LINE>final ZonedDateTime date = getHUIterator().getDate();<NEW_LINE>final I_M_HU_Item huItem = itemStorage.getM_HU_Item();<NEW_LINE>final I_M_HU_Item referenceModel = huItem;<NEW_LINE>for (final IProductStorage productStorage : itemStorage.getProductStorages(date)) {<NEW_LINE><MASK><NEW_LINE>final IAllocationSource productStorageAsSource = new GenericAllocationSourceDestination(productStorage, huItem, referenceModel);<NEW_LINE>final IAllocationResult productStorageResult = productStorageAsSource.unload(productStorageRequest);<NEW_LINE>result.add(ImmutablePair.of(productStorageRequest, productStorageResult));<NEW_LINE>}<NEW_LINE>return Result.CONTINUE;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>final HUIterator iterator = new HUIterator();<NEW_LINE>iterator.setDate(huContext.getDate());<NEW_LINE>iterator.setStorageFactory(huContext.getHUStorageFactory());<NEW_LINE>iterator.setListener(huIteratorListener);<NEW_LINE>iterator.iterate(hu);<NEW_LINE>return result;<NEW_LINE>} | final IAllocationRequest productStorageRequest = createAllocationRequest(productStorage); |
1,643,210 | protected void prepareTable(ColumnInfo[] layout, String from, String staticWhere, String orderBy) {<NEW_LINE>p_layout = layout;<NEW_LINE>StringBuffer sql = new StringBuffer("SELECT ");<NEW_LINE>// add columns & sql<NEW_LINE>for (int i = 0; i < layout.length; i++) {<NEW_LINE>if (i > 0)<NEW_LINE>sql.append(", ");<NEW_LINE>sql.append(layout[i].getColSQL());<NEW_LINE>// adding ID column<NEW_LINE>if (layout[i].isKeyPairCol())<NEW_LINE>sql.append(",").append(layout<MASK><NEW_LINE>// add to model<NEW_LINE>p_table.addColumn(layout[i].getColHeader());<NEW_LINE>if (layout[i].isColorColumn())<NEW_LINE>p_table.setColorColumn(i);<NEW_LINE>if (layout[i].getColClass() == IDColumn.class)<NEW_LINE>m_keyColumnIndex = i;<NEW_LINE>}<NEW_LINE>// set editors (two steps)<NEW_LINE>for (int i = 0; i < layout.length; i++) p_table.setColumnClass(i, layout[i].getColClass(), layout[i].isReadOnly(), layout[i].getColHeader());<NEW_LINE>sql.append(" FROM ").append(from);<NEW_LINE>sql.append(" WHERE ");<NEW_LINE>m_sqlMain = sql.toString();<NEW_LINE>m_sqlAdd = "";<NEW_LINE>if (orderBy != null && orderBy.length() > 0)<NEW_LINE>m_sqlAdd = " ORDER BY " + orderBy;<NEW_LINE>if (m_keyColumnIndex == -1)<NEW_LINE>log.log(Level.SEVERE, "No KeyColumn - " + sql);<NEW_LINE>// Table Selection<NEW_LINE>p_table.setRowSelectionAllowed(true);<NEW_LINE>// p_table.addMouseListener(this);<NEW_LINE>p_table.setMultiSelection(false);<NEW_LINE>p_table.setEditingColumn(0);<NEW_LINE>p_table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);<NEW_LINE>// Window Sizing<NEW_LINE>parameterPanel.setPreferredSize(new Dimension(INFO_WIDTH, parameterPanel.getPreferredSize().height));<NEW_LINE>scrollPane.setPreferredSize(new Dimension(INFO_WIDTH, 400));<NEW_LINE>} | [i].getKeyPairColSQL()); |
712,938 | public void computeSelection(Selection.CombiningBuilder builder, Area area, TimeSpan ts) {<NEW_LINE>int startDepth = (int) (area.y / SLICE_HEIGHT);<NEW_LINE>int endDepth = (int) ((area.y + area.h) / SLICE_HEIGHT);<NEW_LINE>if (startDepth == endDepth && area.h / SLICE_HEIGHT < SELECTION_THRESHOLD) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (((startDepth + 1) * SLICE_HEIGHT - area.y) / SLICE_HEIGHT < SELECTION_THRESHOLD) {<NEW_LINE>startDepth++;<NEW_LINE>}<NEW_LINE>if ((area.y + area.h - endDepth * SLICE_HEIGHT) / SLICE_HEIGHT < SELECTION_THRESHOLD) {<NEW_LINE>endDepth--;<NEW_LINE>}<NEW_LINE>if (startDepth > endDepth || !expanded && startDepth > 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (startDepth == 0) {<NEW_LINE>builder.add(Selection.Kind.ThreadState, track.getStates(ts));<NEW_LINE>builder.add(Selection.Kind.Cpu, computeSelection(ts));<NEW_LINE>}<NEW_LINE>startDepth = Math.max(0, startDepth - 1);<NEW_LINE>endDepth--;<NEW_LINE>if (endDepth >= 0) {<NEW_LINE>if (endDepth >= track.getThread().maxDepth) {<NEW_LINE>endDepth = Integer.MAX_VALUE;<NEW_LINE>}<NEW_LINE>builder.add(Selection.Kind.Thread, track.getSlices<MASK><NEW_LINE>}<NEW_LINE>} | (ts, startDepth, endDepth)); |
87,507 | // Returns the PEM (as a String) from either a path or a pem field<NEW_LINE>private static String extractPemString(JsonObject json, String fieldName, String msgPrefix) throws NetworkConfigurationException {<NEW_LINE>String path = null;<NEW_LINE>String pemString = null;<NEW_LINE>JsonObject jsonField = getJsonValueAsObject(json.get(fieldName));<NEW_LINE>if (jsonField != null) {<NEW_LINE>path = getJsonValueAsString<MASK><NEW_LINE>pemString = getJsonValueAsString(jsonField.get("pem"));<NEW_LINE>}<NEW_LINE>if (path != null && pemString != null) {<NEW_LINE>throw new NetworkConfigurationException(format("%s should not specify both %s path and pem", msgPrefix, fieldName));<NEW_LINE>}<NEW_LINE>if (path != null) {<NEW_LINE>// Determine full pathname and ensure the file exists<NEW_LINE>File pemFile = new File(path);<NEW_LINE>String fullPathname = pemFile.getAbsolutePath();<NEW_LINE>if (!pemFile.exists()) {<NEW_LINE>throw new NetworkConfigurationException(format("%s: %s file %s does not exist", msgPrefix, fieldName, fullPathname));<NEW_LINE>}<NEW_LINE>try (FileInputStream stream = new FileInputStream(pemFile)) {<NEW_LINE>pemString = IOUtils.toString(stream, StandardCharsets.UTF_8);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw new NetworkConfigurationException(format("Failed to read file: %s", fullPathname), ioe);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pemString;<NEW_LINE>} | (jsonField.get("path")); |
649,976 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String job) throws Exception {<NEW_LINE>ActionResult<List<Wo>> result = new ActionResult<>();<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>if (!business.readableWithJob(effectivePerson, job)) {<NEW_LINE>throw new ExceptionAccessDenied(effectivePerson);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CompletableFuture<List<WoTask>> future_tasks = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.tasks(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<WoTaskCompleted>> future_taskCompleteds = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.taskCompleteds(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<WoRead>> future_reads = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.reads(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<WoReadCompleted>> future_readCompleteds = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.readCompleteds(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<Wo>> future_workLogs = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.workLogs(job);<NEW_LINE>});<NEW_LINE>List<WoTask> tasks = future_tasks.get();<NEW_LINE>List<WoTaskCompleted> taskCompleteds = future_taskCompleteds.get();<NEW_LINE>List<WoRead> reads = future_reads.get();<NEW_LINE>List<WoReadCompleted> readCompleteds = future_readCompleteds.get();<NEW_LINE>List<Wo> wos = future_workLogs.get();<NEW_LINE>ListTools.groupStick(wos, tasks, WorkLog.fromActivityToken_FIELDNAME, Task.activityToken_FIELDNAME, taskList_FIELDNAME);<NEW_LINE>ListTools.groupStick(wos, taskCompleteds, WorkLog.fromActivityToken_FIELDNAME, TaskCompleted.activityToken_FIELDNAME, taskCompletedList_FIELDNAME);<NEW_LINE>ListTools.groupStick(wos, reads, WorkLog.fromActivityToken_FIELDNAME, Read.activityToken_FIELDNAME, readList_FIELDNAME);<NEW_LINE>ListTools.groupStick(wos, readCompleteds, WorkLog.<MASK><NEW_LINE>result.setData(wos);<NEW_LINE>return result;<NEW_LINE>} | fromActivityToken_FIELDNAME, ReadCompleted.activityToken_FIELDNAME, readCompletedList_FIELDNAME); |
309,522 | public void marshall(AssociationDescription associationDescription, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (associationDescription == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(associationDescription.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getInstanceId(), INSTANCEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getAssociationVersion(), ASSOCIATIONVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getDate(), DATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getLastUpdateAssociationDate(), LASTUPDATEASSOCIATIONDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getOverview(), OVERVIEW_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getDocumentVersion(), DOCUMENTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getAutomationTargetParameterName(), AUTOMATIONTARGETPARAMETERNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getParameters(), PARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getAssociationId(), ASSOCIATIONID_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getTargets(), TARGETS_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getScheduleExpression(), SCHEDULEEXPRESSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getOutputLocation(), OUTPUTLOCATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getLastExecutionDate(), LASTEXECUTIONDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getLastSuccessfulExecutionDate(), LASTSUCCESSFULEXECUTIONDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(associationDescription.getMaxErrors(), MAXERRORS_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getMaxConcurrency(), MAXCONCURRENCY_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getComplianceSeverity(), COMPLIANCESEVERITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getSyncCompliance(), SYNCCOMPLIANCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getApplyOnlyAtCronInterval(), APPLYONLYATCRONINTERVAL_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getCalendarNames(), CALENDARNAMES_BINDING);<NEW_LINE>protocolMarshaller.marshall(associationDescription.getTargetLocations(), TARGETLOCATIONS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | associationDescription.getAssociationName(), ASSOCIATIONNAME_BINDING); |
1,456,668 | private void handleSecurityGroupRefDeletion(CascadeAction action, final Completion completion) {<NEW_LINE>List<VmNicSecurityGroupRefInventory> refs = refFromAction(action);<NEW_LINE>if (refs.isEmpty()) {<NEW_LINE>completion.success();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, List<String>> map = new HashMap<String<MASK><NEW_LINE>for (VmNicSecurityGroupRefInventory ref : refs) {<NEW_LINE>List<String> nicUuids = map.get(ref.getSecurityGroupUuid());<NEW_LINE>if (nicUuids == null) {<NEW_LINE>nicUuids = new ArrayList<String>();<NEW_LINE>map.put(ref.getSecurityGroupUuid(), nicUuids);<NEW_LINE>}<NEW_LINE>nicUuids.add(ref.getVmNicUuid());<NEW_LINE>}<NEW_LINE>List<RemoveVmNicFromSecurityGroupMsg> msgs = new ArrayList<RemoveVmNicFromSecurityGroupMsg>();<NEW_LINE>for (Map.Entry<String, List<String>> e : map.entrySet()) {<NEW_LINE>RemoveVmNicFromSecurityGroupMsg msg = new RemoveVmNicFromSecurityGroupMsg();<NEW_LINE>msg.setSecurityGroupUuid(e.getKey());<NEW_LINE>msg.setVmNicUuids(e.getValue());<NEW_LINE>bus.makeTargetServiceIdByResourceUuid(msg, SecurityGroupConstant.SERVICE_ID, e.getKey());<NEW_LINE>msgs.add(msg);<NEW_LINE>}<NEW_LINE>bus.send(msgs, new CloudBusListCallBack(completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(List<MessageReply> replies) {<NEW_LINE>for (MessageReply reply : replies) {<NEW_LINE>if (!reply.isSuccess()) {<NEW_LINE>logger.warn(String.format("failed to remove vm nic from some security group for some destroyed vm," + "no worry, security group will catch it up later. %s", reply.getError()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>completion.success();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , List<String>>(); |
366,490 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {<NEW_LINE>response.setContentType("application/json");<NEW_LINE>final PrintWriter out = response.getWriter();<NEW_LINE>Set<ObjectInstance> objectInstances = mBeanServer.queryMBeans(pluginQuery, null);<NEW_LINE>if (objectInstances.isEmpty()) {<NEW_LINE>ServletHelpers.writeEmpty(out);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, Map<Object, Object>> answer = new HashMap<>();<NEW_LINE>for (ObjectInstance objectInstance : objectInstances) {<NEW_LINE>AttributeList attributeList = null;<NEW_LINE>try {<NEW_LINE>attributeList = mBeanServer.getAttributes(objectInstance.getObjectName(), ATTRIBUTES);<NEW_LINE>} catch (InstanceNotFoundException e) {<NEW_LINE>LOG.warn("Object instance not found: " + objectInstance.getObjectName(), e);<NEW_LINE>} catch (ReflectionException e) {<NEW_LINE>LOG.warn("Failed to get attribute list for mbean: " + objectInstance.getObjectName(), e);<NEW_LINE>} catch (SecurityException e) {<NEW_LINE>LOG.warn("Security issue accessing mbean: " + objectInstance.getObjectName(), e);<NEW_LINE>}<NEW_LINE>if (attributeList != null && ATTRIBUTES.length == attributeList.size()) {<NEW_LINE>Map<Object, Object> pluginDefinition = new HashMap<>();<NEW_LINE>attributeList.asList().forEach(attr -> pluginDefinition.put(attr.getName(), attr.getValue()));<NEW_LINE>answer.put((String) pluginDefinition<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>ServletHelpers.writeObject(converters, options, out, answer);<NEW_LINE>} | .get("Name"), pluginDefinition); |
1,732,886 | private void initMediaTracks(int rendererIndex) {<NEW_LINE>if (mRenderers[rendererIndex] == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Renderer renderer = mRenderers[rendererIndex];<NEW_LINE>renderer.mediaTracks = new MediaTrack[renderer.trackGroups.length][];<NEW_LINE>renderer.sortedTracks = new TreeSet<>(new MediaTrackFormatComparator());<NEW_LINE>if (rendererIndex == RENDERER_INDEX_SUBTITLE) {<NEW_LINE>// AUTO OPTION: add disable subs option<NEW_LINE>MediaTrack noSubsTrack = MediaTrack.forRendererIndex(rendererIndex);<NEW_LINE>// Temporal selection.<NEW_LINE>// Real selection will be override later on setSelection() routine.<NEW_LINE>noSubsTrack.isSelected = true;<NEW_LINE>renderer.sortedTracks.add(noSubsTrack);<NEW_LINE>renderer.selectedTrack = noSubsTrack;<NEW_LINE>}<NEW_LINE>for (int groupIndex = 0; groupIndex < renderer.trackGroups.length; groupIndex++) {<NEW_LINE>TrackGroup group = renderer.trackGroups.get(groupIndex);<NEW_LINE>renderer.mediaTracks[groupIndex] = new MediaTrack[group.length];<NEW_LINE>for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {<NEW_LINE>Format <MASK><NEW_LINE>MediaTrack mediaTrack = MediaTrack.forRendererIndex(rendererIndex);<NEW_LINE>mediaTrack.format = format;<NEW_LINE>mediaTrack.groupIndex = groupIndex;<NEW_LINE>mediaTrack.trackIndex = trackIndex;<NEW_LINE>// Selected track or not will be decided later in setSelection() routine<NEW_LINE>renderer.mediaTracks[groupIndex][trackIndex] = mediaTrack;<NEW_LINE>renderer.sortedTracks.add(mediaTrack);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mTracksInitTimeMs = System.currentTimeMillis();<NEW_LINE>} | format = group.getFormat(trackIndex); |
1,268,308 | void create(Set<String> tableDirs, Manager manager) throws IOException {<NEW_LINE>UniqueNameAllocator namer = manager.getContext().getUniqueNameAllocator();<NEW_LINE>for (ImportedTableInfo.DirectoryMapping dm : tableInfo.directories) {<NEW_LINE>Path exportDir = new Path(dm.exportDir);<NEW_LINE>log.info("Looking for matching filesystem for {} from options {}", exportDir, tableDirs);<NEW_LINE>Path base = manager.getVolumeManager().matchingFileSystem(exportDir, tableDirs);<NEW_LINE>if (base == null) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>log.info("Chose base table directory of {}", base);<NEW_LINE>Path directory = new Path(base, tableInfo.tableId.canonical());<NEW_LINE>Path newBulkDir = new Path(directory, Constants.BULK_PREFIX + namer.getNextName());<NEW_LINE>dm.importDir = newBulkDir.toString();<NEW_LINE>log.info("Using import dir: {}", dm.importDir);<NEW_LINE>}<NEW_LINE>} | IOException(dm.exportDir + " is not in the same file system as any volume configured for Accumulo"); |
709,565 | public SolrQueryResponse query(SolrQueryRequest req) throws SolrException {<NEW_LINE>final long startTime = System.currentTimeMillis();<NEW_LINE>// during the solr query we set the thread name to the query string to get more debugging info in thread dumps<NEW_LINE>final String threadname = Thread.currentThread().getName();<NEW_LINE>String ql = "";<NEW_LINE>try {<NEW_LINE>ql = URLDecoder.decode(req.getParams().toString(), StandardCharsets.UTF_8.name());<NEW_LINE>} catch (final UnsupportedEncodingException e) {<NEW_LINE>}<NEW_LINE>// for debugging in Threaddump<NEW_LINE>Thread.currentThread().setName("Embedded solr query: " + ql);<NEW_LINE>ConcurrentLog.fine("EmbeddedSolrConnector.query", "QUERY: " + ql);<NEW_LINE>final SolrQueryResponse rsp = new SolrQueryResponse();<NEW_LINE>final NamedList<Object> responseHeader = new SimpleOrderedMap<>();<NEW_LINE>responseHeader.add("params", req.getOriginalParams().toNamedList());<NEW_LINE>rsp.add("responseHeader", responseHeader);<NEW_LINE>// SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));<NEW_LINE>// send request to solr and create a result<NEW_LINE>this.<MASK><NEW_LINE>// get statistics and add a header with that<NEW_LINE>final Exception exception = rsp.getException();<NEW_LINE>final int status = exception == null ? 0 : exception instanceof SolrException ? ((SolrException) exception).code() : 500;<NEW_LINE>responseHeader.add("status", status);<NEW_LINE>responseHeader.add("QTime", (int) (System.currentTimeMillis() - startTime));<NEW_LINE>Thread.currentThread().setName(threadname);<NEW_LINE>// return result<NEW_LINE>return rsp;<NEW_LINE>} | requestHandler.handleRequest(req, rsp); |
1,289,638 | public static void main(String[] args) throws Exception {<NEW_LINE>final EventProcessorClientStateManagement program = new EventProcessorClientStateManagement();<NEW_LINE>final EventProcessorClient client = new EventProcessorClientBuilder().consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME).connectionString(EH_CONNECTION_STRING).processPartitionInitialization(context -> program.onInitialize(context.getPartitionContext())).processPartitionClose(context -> program.onClose(context.getPartitionContext(), context.getCloseReason())).processEvent(event -> program.onEvent(event.getPartitionContext(), event.getEventData())).processError(error -> program.onError(error.getPartitionContext(), error.getThrowable())).checkpointStore(new SampleCheckpointStore()).buildEventProcessorClient();<NEW_LINE>System.out.println("Starting event processor");<NEW_LINE>client.start();<NEW_LINE>// Continue to perform other tasks while the processor is running in the background.<NEW_LINE>Thread.sleep(TimeUnit.SECONDS.toMillis(30));<NEW_LINE>System.out.println("Stopping event processor");<NEW_LINE>client.stop();<NEW_LINE><MASK><NEW_LINE>} | System.out.println("Exiting process"); |
1,732,943 | public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {<NEW_LINE>// here requires to generate a sequence of finally blocks invocations depending corresponding<NEW_LINE>// to each of the traversed try statements, so that execution will terminate properly.<NEW_LINE>// lookup the label, this should answer the returnContext<NEW_LINE>FlowContext targetContext = (this.label == null) ? flowContext.getTargetContextForDefaultContinue() : flowContext.getTargetContextForContinueLabel(this.label);<NEW_LINE>if (targetContext == null) {<NEW_LINE>if (this.label == null) {<NEW_LINE>currentScope.problemReporter().invalidContinue(this);<NEW_LINE>} else {<NEW_LINE>currentScope.problemReporter().undefinedLabel(this);<NEW_LINE>}<NEW_LINE>// pretend it did not continue since no actual target<NEW_LINE>return flowInfo;<NEW_LINE>}<NEW_LINE>targetContext.recordAbruptExit();<NEW_LINE>targetContext.expireNullCheckedFieldInfo();<NEW_LINE>if (targetContext == FlowContext.NotContinuableContext) {<NEW_LINE>currentScope.problemReporter().invalidContinue(this);<NEW_LINE>// pretend it did not continue since no actual target<NEW_LINE>return flowInfo;<NEW_LINE>}<NEW_LINE>this.initStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);<NEW_LINE>this.targetLabel = targetContext.continueLabel();<NEW_LINE>FlowContext traversedContext = flowContext;<NEW_LINE>int subCount = 0;<NEW_LINE>this.subroutines = new SubRoutineStatement[5];<NEW_LINE>do {<NEW_LINE>SubRoutineStatement sub;<NEW_LINE>if ((sub = traversedContext.subroutine()) != null) {<NEW_LINE>if (subCount == this.subroutines.length) {<NEW_LINE>// grow<NEW_LINE>System.arraycopy(this.subroutines, 0, this.subroutines = new SubRoutineStatement[subCount * 2], 0, subCount);<NEW_LINE>}<NEW_LINE>this.subroutines[subCount++] = sub;<NEW_LINE>if (sub.isSubRoutineEscaping()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>traversedContext.<MASK><NEW_LINE>if (traversedContext instanceof InsideSubRoutineFlowContext) {<NEW_LINE>ASTNode node = traversedContext.associatedNode;<NEW_LINE>if (node instanceof TryStatement) {<NEW_LINE>TryStatement tryStatement = (TryStatement) node;<NEW_LINE>// collect inits<NEW_LINE>flowInfo.addInitializationsFrom(tryStatement.subRoutineInits);<NEW_LINE>}<NEW_LINE>} else if (traversedContext == targetContext) {<NEW_LINE>// only record continue info once accumulated through subroutines, and only against target context<NEW_LINE>targetContext.recordContinueFrom(flowContext, flowInfo);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} while ((traversedContext = traversedContext.getLocalParent()) != null);<NEW_LINE>// resize subroutines<NEW_LINE>if (subCount != this.subroutines.length) {<NEW_LINE>System.arraycopy(this.subroutines, 0, this.subroutines = new SubRoutineStatement[subCount], 0, subCount);<NEW_LINE>}<NEW_LINE>return FlowInfo.DEAD_END;<NEW_LINE>} | recordReturnFrom(flowInfo.unconditionalInits()); |
1,848,875 | public void waitToExit(final boolean forcefulShutdown) {<NEW_LINE>isEmptyLock.lock();<NEW_LINE>isEmptyCondition = isEmptyLock.newCondition();<NEW_LINE>try {<NEW_LINE>if (forcefulShutdown) {<NEW_LINE>final long startTime = System.currentTimeMillis();<NEW_LINE>final long endTime = startTime + EXIT_TIMEOUT_MS;<NEW_LINE>long currentTime;<NEW_LINE>while (!areQueriesAndFragmentsEmpty() && (currentTime = System.currentTimeMillis()) < endTime) {<NEW_LINE>try {<NEW_LINE>if (!isEmptyCondition.await(endTime - currentTime, TimeUnit.MILLISECONDS)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>logger.error("Interrupted while waiting to exit");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!areQueriesAndFragmentsEmpty()) {<NEW_LINE>logger.<MASK><NEW_LINE>for (QueryId queryId : queries.keySet()) {<NEW_LINE>logger.warn("Query {} is still running.", QueryIdHelper.getQueryId(queryId));<NEW_LINE>}<NEW_LINE>for (FragmentHandle fragmentHandle : runningFragments.keySet()) {<NEW_LINE>logger.warn("Fragment {} is still running.", QueryIdHelper.getQueryIdentifier(fragmentHandle));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>while (!areQueriesAndFragmentsEmpty()) {<NEW_LINE>isEmptyCondition.awaitUninterruptibly();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>isEmptyLock.unlock();<NEW_LINE>}<NEW_LINE>} | warn("Timed out after {} millis. Shutting down before all fragments and foremen " + "have completed.", EXIT_TIMEOUT_MS); |
741,954 | private void mergeHigherLevels(final KllFloatsSketch other, final long finalN) {<NEW_LINE>final int tmpSpaceNeeded = getNumRetained() + other.getNumRetainedAboveLevelZero();<NEW_LINE>final float[] workbuf = new float[tmpSpaceNeeded];<NEW_LINE>final int ub = KllHelper.ubOnNumLevels(finalN);<NEW_LINE>// ub+1 does not work<NEW_LINE>final int[] worklevels = new int[ub + 2];<NEW_LINE>final int[] outlevels = new int[ub + 2];<NEW_LINE>final int provisionalNumLevels = max(numLevels_, other.numLevels_);<NEW_LINE>populateWorkArrays(other, workbuf, worklevels, provisionalNumLevels);<NEW_LINE>// notice that workbuf is being used as both the input and output here<NEW_LINE>final int[] result = KllFloatsHelper.generalFloatsCompress(k_, m_, provisionalNumLevels, workbuf, worklevels, workbuf, outlevels, isLevelZeroSorted_, random);<NEW_LINE><MASK><NEW_LINE>final int finalCapacity = result[1];<NEW_LINE>final int finalPop = result[2];<NEW_LINE>// ub can sometimes be much bigger<NEW_LINE>assert finalNumLevels <= ub;<NEW_LINE>// now we need to transfer the results back into the "self" sketch<NEW_LINE>final float[] newbuf = finalCapacity == items_.length ? items_ : new float[finalCapacity];<NEW_LINE>final int freeSpaceAtBottom = finalCapacity - finalPop;<NEW_LINE>System.arraycopy(workbuf, outlevels[0], newbuf, freeSpaceAtBottom, finalPop);<NEW_LINE>final int theShift = freeSpaceAtBottom - outlevels[0];<NEW_LINE>if (levels_.length < finalNumLevels + 1) {<NEW_LINE>levels_ = new int[finalNumLevels + 1];<NEW_LINE>}<NEW_LINE>for (int lvl = 0; lvl < finalNumLevels + 1; lvl++) {<NEW_LINE>// includes the "extra" index<NEW_LINE>levels_[lvl] = outlevels[lvl] + theShift;<NEW_LINE>}<NEW_LINE>items_ = newbuf;<NEW_LINE>numLevels_ = finalNumLevels;<NEW_LINE>} | final int finalNumLevels = result[0]; |
510,577 | final DeregisterTransitGatewayMulticastGroupSourcesResult executeDeregisterTransitGatewayMulticastGroupSources(DeregisterTransitGatewayMulticastGroupSourcesRequest deregisterTransitGatewayMulticastGroupSourcesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deregisterTransitGatewayMulticastGroupSourcesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeregisterTransitGatewayMulticastGroupSourcesRequest> request = null;<NEW_LINE>Response<DeregisterTransitGatewayMulticastGroupSourcesResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeregisterTransitGatewayMulticastGroupSourcesRequestMarshaller().marshall(super.beforeMarshalling(deregisterTransitGatewayMulticastGroupSourcesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeregisterTransitGatewayMulticastGroupSources");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeregisterTransitGatewayMulticastGroupSourcesResult> responseHandler = new StaxResponseHandler<DeregisterTransitGatewayMulticastGroupSourcesResult>(new DeregisterTransitGatewayMulticastGroupSourcesResultStaxUnmarshaller());<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); |
16,580 | private static void loadEnchantments() {<NEW_LINE>int origin = Enchantment.values().length;<NEW_LINE>int size = ForgeRegistries.ENCHANTMENTS.getEntries().size();<NEW_LINE>putBool(Enchantment.class, "acceptingNew", true);<NEW_LINE>for (net.minecraft.world.item.enchantment.Enchantment enc : ForgeRegistries.ENCHANTMENTS) {<NEW_LINE>try {<NEW_LINE>String name = ResourceLocationUtil.standardize(enc.getRegistryName());<NEW_LINE>ArclightEnchantment enchantment = new ArclightEnchantment(enc, name);<NEW_LINE>Enchantment.registerEnchantment(enchantment);<NEW_LINE>ArclightMod.LOGGER.debug("Registered {} as enchantment {}", <MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>ArclightMod.LOGGER.error("Failed to register enchantment {}: {}", enc.getRegistryName(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Enchantment.stopAcceptingRegistrations();<NEW_LINE>ArclightMod.LOGGER.info("registry.enchantment", size - origin);<NEW_LINE>} | enc.getRegistryName(), enchantment); |
1,790,643 | private static AccessToken generateSharedAccessSignature(String policyName, String sharedAccessKey, String resourceUri, Duration tokenDuration) throws UnsupportedEncodingException {<NEW_LINE>final OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plus(tokenDuration);<NEW_LINE>final String utf8Encoding = UTF_8.name();<NEW_LINE>final String expiresOnEpochSeconds = Long.toString(expiresOn.toEpochSecond());<NEW_LINE>final String stringToSign = URLEncoder.encode(resourceUri, utf8Encoding) + "\n" + expiresOnEpochSeconds;<NEW_LINE>final byte[] decodedKey = Base64.getDecoder().decode(sharedAccessKey);<NEW_LINE>final Mac sha256HMAC;<NEW_LINE>final SecretKeySpec secretKey;<NEW_LINE>final String hmacSHA256 = "HmacSHA256";<NEW_LINE>try {<NEW_LINE>sha256HMAC = Mac.getInstance(hmacSHA256);<NEW_LINE>secretKey = new SecretKeySpec(decodedKey, hmacSHA256);<NEW_LINE>sha256HMAC.init(secretKey);<NEW_LINE>} catch (NoSuchAlgorithmException e) {<NEW_LINE>throw new UnsupportedOperationException(String.format("Unable to create hashing algorithm '%s'", hmacSHA256), e);<NEW_LINE>} catch (InvalidKeyException e) {<NEW_LINE>throw new IllegalArgumentException("'sharedAccessKey' is an invalid value for the hashing algorithm.", e);<NEW_LINE>}<NEW_LINE>final byte[] bytes = sha256HMAC.doFinal(stringToSign.getBytes(UTF_8));<NEW_LINE>final String signature = new String(Base64.getEncoder().encode(bytes), UTF_8);<NEW_LINE>final String token = String.format(Locale.ROOT, "SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s", URLEncoder.encode(resourceUri, utf8Encoding), URLEncoder.encode(signature, utf8Encoding), expiresOnEpochSeconds, policyName);<NEW_LINE><MASK><NEW_LINE>} | return new AccessToken(token, expiresOn); |
1,693,481 | private static Map<FeeCategory, Coin> parseFees(final InputStream is) throws IOException {<NEW_LINE>final Map<FeeCategory, Coin> <MASK><NEW_LINE>String line = null;<NEW_LINE>try (final BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII))) {<NEW_LINE>while (true) {<NEW_LINE>line = reader.readLine();<NEW_LINE>if (line == null)<NEW_LINE>break;<NEW_LINE>line = line.trim();<NEW_LINE>if (line.length() == 0 || line.charAt(0) == '#')<NEW_LINE>continue;<NEW_LINE>final String[] fields = line.split("=");<NEW_LINE>try {<NEW_LINE>final FeeCategory category = FeeCategory.valueOf(fields[0]);<NEW_LINE>final Coin rate = Coin.valueOf(Long.parseLong(fields[1]));<NEW_LINE>dynamicFees.put(category, rate);<NEW_LINE>} catch (IllegalArgumentException x) {<NEW_LINE>log.warn("Cannot parse line, ignoring: '" + line + "'", x);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final Exception x) {<NEW_LINE>throw new RuntimeException("Error while parsing: '" + line + "'", x);<NEW_LINE>} finally {<NEW_LINE>is.close();<NEW_LINE>}<NEW_LINE>return dynamicFees;<NEW_LINE>} | dynamicFees = new HashMap<>(); |
1,165,548 | public WorkflowClient doLogin(AzkabanWorkflowClient workflowClient) {<NEW_LINE>Long _currentTime = System.currentTimeMillis();<NEW_LINE>if (_currentTime - workflowClient.getSessionUpdatedTime() > TOKEN_UPDATE_INTERVAL) {<NEW_LINE>logger.info("Creating a new session with Azkaban");<NEW_LINE>SchedulerConfigurationData schedulerData = InfoExtractor.getSchedulerData(scheduler);<NEW_LINE>if (schedulerData == null) {<NEW_LINE>throw new RuntimeException(String<MASK><NEW_LINE>}<NEW_LINE>if (!schedulerData.getParamMap().containsKey(USERNAME)) {<NEW_LINE>throw new RuntimeException(String.format("Cannot find username for login"));<NEW_LINE>}<NEW_LINE>String username = schedulerData.getParamMap().get(USERNAME);<NEW_LINE>if (schedulerData.getParamMap().containsKey(PRIVATE_KEY)) {<NEW_LINE>workflowClient.login(username, new File(schedulerData.getParamMap().get(PRIVATE_KEY)));<NEW_LINE>} else if (schedulerData.getParamMap().containsKey(PASSWORD)) {<NEW_LINE>workflowClient.login(username, schedulerData.getParamMap().get(PASSWORD));<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Neither private key nor password was specified");<NEW_LINE>}<NEW_LINE>workflowClient.setSessionUpdatedTime(_currentTime);<NEW_LINE>}<NEW_LINE>return workflowClient;<NEW_LINE>} | .format("Cannot find scheduler %s", scheduler)); |
1,068,121 | private static void readPredWeightTable(SeqParameterSet sps, PictureParameterSet pps, SliceHeader sh, BitReader _in) {<NEW_LINE>sh.predWeightTable = new PredictionWeightTable();<NEW_LINE>int[] numRefsMinus1 = sh.numRefIdxActiveOverrideFlag ? sh.numRefIdxActiveMinus1 : pps.numRefIdxActiveMinus1;<NEW_LINE>int[] nr = new int[] { numRefsMinus1[0] + 1, numRefsMinus1[1] + 1 };<NEW_LINE>sh.predWeightTable.<MASK><NEW_LINE>if (sps.chromaFormatIdc != MONO) {<NEW_LINE>sh.predWeightTable.chromaLog2WeightDenom = readUEtrace(_in, "SH: chroma_log2_weight_denom");<NEW_LINE>}<NEW_LINE>int defaultLW = 1 << sh.predWeightTable.lumaLog2WeightDenom;<NEW_LINE>int defaultCW = 1 << sh.predWeightTable.chromaLog2WeightDenom;<NEW_LINE>for (int list = 0; list < 2; list++) {<NEW_LINE>sh.predWeightTable.lumaWeight[list] = new int[nr[list]];<NEW_LINE>sh.predWeightTable.lumaOffset[list] = new int[nr[list]];<NEW_LINE>sh.predWeightTable.chromaWeight[list] = new int[2][nr[list]];<NEW_LINE>sh.predWeightTable.chromaOffset[list] = new int[2][nr[list]];<NEW_LINE>for (int i = 0; i < nr[list]; i++) {<NEW_LINE>sh.predWeightTable.lumaWeight[list][i] = defaultLW;<NEW_LINE>sh.predWeightTable.lumaOffset[list][i] = 0;<NEW_LINE>sh.predWeightTable.chromaWeight[list][0][i] = defaultCW;<NEW_LINE>sh.predWeightTable.chromaOffset[list][0][i] = 0;<NEW_LINE>sh.predWeightTable.chromaWeight[list][1][i] = defaultCW;<NEW_LINE>sh.predWeightTable.chromaOffset[list][1][i] = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>readWeightOffset(sps, pps, sh, _in, nr, 0);<NEW_LINE>if (sh.sliceType == SliceType.B) {<NEW_LINE>readWeightOffset(sps, pps, sh, _in, nr, 1);<NEW_LINE>}<NEW_LINE>} | lumaLog2WeightDenom = readUEtrace(_in, "SH: luma_log2_weight_denom"); |
197,420 | public StreamEvent find(StateEvent matchingEvent, IndexedEventHolder indexedEventHolder, StreamEventCloner storeEventCloner) {<NEW_LINE>Collection<StreamEvent> compareStreamEvents = compareCollectionExecutor.findEvents(matchingEvent, indexedEventHolder);<NEW_LINE>if (compareStreamEvents == null) {<NEW_LINE>return exhaustiveCollectionExecutor.find(matchingEvent, indexedEventHolder, storeEventCloner);<NEW_LINE>} else if (compareStreamEvents.size() > 0) {<NEW_LINE>compareStreamEvents = exhaustiveCollectionExecutor.findEvents(matchingEvent, compareStreamEvents);<NEW_LINE>ComplexEventChunk<StreamEvent> returnEventChunk = new ComplexEventChunk<StreamEvent>();<NEW_LINE>for (StreamEvent resultEvent : compareStreamEvents) {<NEW_LINE>if (storeEventCloner != null) {<NEW_LINE>returnEventChunk.add<MASK><NEW_LINE>} else {<NEW_LINE>returnEventChunk.add(resultEvent);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return returnEventChunk.getFirst();<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | (storeEventCloner.copyStreamEvent(resultEvent)); |
929,227 | protected void initialize(String serverName, String searchName, String ndotsName) {<NEW_LINE>reset();<NEW_LINE>String servers = System.getProperty(serverName);<NEW_LINE>if (servers != null) {<NEW_LINE>StringTokenizer st = new StringTokenizer(servers, ",");<NEW_LINE>while (st.hasMoreTokens()) {<NEW_LINE>String server = st.nextToken();<NEW_LINE>try {<NEW_LINE>URI uri = new URI("dns://" + server);<NEW_LINE>// assume this is an IPv6 address without brackets<NEW_LINE>if (uri.getHost() == null) {<NEW_LINE>addNameserver(new InetSocketAddress(server, SimpleResolver.DEFAULT_PORT));<NEW_LINE>} else {<NEW_LINE>int port = uri.getPort();<NEW_LINE>if (port == -1) {<NEW_LINE>port = SimpleResolver.DEFAULT_PORT;<NEW_LINE>}<NEW_LINE>addNameserver(new InetSocketAddress(uri.getHost(), port));<NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String searchPathProperty = System.getProperty(searchName);<NEW_LINE>parseSearchPathList(searchPathProperty, ",");<NEW_LINE>String ndotsProperty = System.getProperty(ndotsName);<NEW_LINE>ndots = parseNdots(ndotsProperty);<NEW_LINE>} | log.warn("Ignored invalid server {}", server); |
446,409 | private static MediaCodec createMediaCodec(final CameraMediaSourceConfiguration mediaSourceConfiguration) {<NEW_LINE>try {<NEW_LINE>final MediaCodec encoder = MediaCodec.createEncoderByType(mediaSourceConfiguration.getEncoderMimeType());<NEW_LINE>try {<NEW_LINE>encoder.configure(configureMediaFormat(mediaSourceConfiguration, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar), NULL_SURFACE, NULL_CRYPTO, MediaCodec.CONFIGURE_FLAG_ENCODE);<NEW_LINE>logSupportedColorFormats(encoder, mediaSourceConfiguration);<NEW_LINE>} catch (MediaCodec.CodecException e) {<NEW_LINE>Log.d(TAG, "Failed configuring MediaCodec with Semi-planar pixel format, falling back to planar");<NEW_LINE>encoder.configure(configureMediaFormat(mediaSourceConfiguration, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar), <MASK><NEW_LINE>logSupportedColorFormats(encoder, mediaSourceConfiguration);<NEW_LINE>}<NEW_LINE>return encoder;<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new RuntimeException("unable to create encoder", e);<NEW_LINE>}<NEW_LINE>} | NULL_SURFACE, NULL_CRYPTO, MediaCodec.CONFIGURE_FLAG_ENCODE); |
1,424,308 | public com.amazonaws.services.polly.model.InvalidNextTokenException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.polly.model.InvalidNextTokenException invalidNextTokenException = new com.amazonaws.services.polly.model.InvalidNextTokenException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 invalidNextTokenException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,440,002 | // </editor-fold>//GEN-END:initComponents<NEW_LINE>private void browseLocationAction(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_browseLocationAction<NEW_LINE>String command = evt.getActionCommand();<NEW_LINE>if ("BROWSE".equals(command)) {<NEW_LINE>// NOI18N<NEW_LINE>JFileChooser chooser = new JFileChooser();<NEW_LINE>FileUtil.preventFileChooserSymlinkTraversal(chooser, null);<NEW_LINE>chooser.setDialogTitle(NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_SelectProjectLocation"));<NEW_LINE>chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);<NEW_LINE>String path <MASK><NEW_LINE>if (path.length() > 0) {<NEW_LINE>File f = new File(path);<NEW_LINE>if (f.exists()) {<NEW_LINE>chooser.setSelectedFile(f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {<NEW_LINE>// NOI18N<NEW_LINE>File projectDir = chooser.getSelectedFile();<NEW_LINE>projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());<NEW_LINE>}<NEW_LINE>panel.fireChangeEvent();<NEW_LINE>}<NEW_LINE>} | = this.projectLocationTextField.getText(); |
1,122,613 | final DescribeHubResult executeDescribeHub(DescribeHubRequest describeHubRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeHubRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeHubRequest> request = null;<NEW_LINE>Response<DescribeHubResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeHubRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeHubRequest));<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, "SecurityHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeHubResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeHubResultJsonUnmarshaller());<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); |
386,696 | private void calcVanilla(MutableQuadViewImpl quad, float[] aoDest, int[] lightDest) {<NEW_LINE>vanillaAoControlBits.clear();<NEW_LINE>final Direction face = quad.lightFace();<NEW_LINE>quad.toVanilla(<MASK><NEW_LINE>VanillaAoHelper.updateShape(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, vertexData, face, vanillaAoData, vanillaAoControlBits);<NEW_LINE>vanillaCalc.fabric_apply(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, quad.lightFace(), vanillaAoData, vanillaAoControlBits, quad.hasShade());<NEW_LINE>System.arraycopy(vanillaCalc.fabric_colorMultiplier(), 0, aoDest, 0, 4);<NEW_LINE>System.arraycopy(vanillaCalc.fabric_brightness(), 0, lightDest, 0, 4);<NEW_LINE>} | 0, vertexData, 0, false); |
1,838,535 | public com.amazonaws.services.lakeformation.model.InternalServiceException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.lakeformation.model.InternalServiceException internalServiceException = new com.amazonaws.services.lakeformation.model.InternalServiceException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return internalServiceException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,387,113 | private static Container transform(Map<String, Object> map) {<NEW_LINE>final Container container;<NEW_LINE>container = new Container();<NEW_LINE>container.setInode((String) map.get("inode"));<NEW_LINE>container.setOwner((String) map.get("owner"));<NEW_LINE>container.setIDate((Date) map.get("idate"));<NEW_LINE>container.setCode((String) map.get("code"));<NEW_LINE>container.setPreLoop((String<MASK><NEW_LINE>container.setPostLoop((String) map.get("post_loop"));<NEW_LINE>container.setShowOnMenu(ConversionUtils.toBooleanFromDb(map.getOrDefault("show_on_menu", false)));<NEW_LINE>container.setTitle((String) map.get("title"));<NEW_LINE>container.setModDate((Date) map.get("mod_date"));<NEW_LINE>container.setModUser((String) map.get("mod_user"));<NEW_LINE>container.setSortOrder(ConversionUtils.toInt(map.get("sort_order"), 0));<NEW_LINE>container.setFriendlyName((String) map.get("friendly_name"));<NEW_LINE>container.setMaxContentlets(ConversionUtils.toInt(map.get("max_contentlets"), 0));<NEW_LINE>container.setUseDiv(ConversionUtils.toBooleanFromDb(map.getOrDefault("use_div", false)));<NEW_LINE>container.setStaticify(ConversionUtils.toBooleanFromDb(map.getOrDefault("staticify", false)));<NEW_LINE>container.setSortContentletsBy((String) map.get("sort_contentlets_by"));<NEW_LINE>container.setLuceneQuery((String) map.get("lucene_query"));<NEW_LINE>container.setNotes((String) map.get("notes"));<NEW_LINE>container.setIdentifier((String) map.get("identifier"));<NEW_LINE>return container;<NEW_LINE>} | ) map.get("pre_loop")); |
21,616 | private static List<Token> evaluateHashhashOperators(List<Token> tokens) {<NEW_LINE>var newTokens = new ArrayList<Token>();<NEW_LINE>Iterator<Token> it = tokens.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE><MASK><NEW_LINE>if ("##".equals(curr.getValue())) {<NEW_LINE>var pred = predConcatToken(newTokens);<NEW_LINE>var succ = succConcatToken(it);<NEW_LINE>if (pred != null && succ != null) {<NEW_LINE>newTokens.add(Token.builder().setLine(pred.getLine()).setColumn(pred.getColumn()).setURI(pred.getURI()).setValueAndOriginalValue(pred.getValue() + succ.getValue()).setType(pred.getType()).setGeneratedCode(true).build());<NEW_LINE>} else {<NEW_LINE>LOG.error("Missing data : succ ='{}' or pred = '{}'", succ, pred);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>newTokens.add(curr);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return newTokens;<NEW_LINE>} | var curr = it.next(); |
1,094,392 | public Environment build() {<NEW_LINE>DefaultEnvironment environment = new DefaultEnvironment();<NEW_LINE>// Environment creation logic needs to validate following things<NEW_LINE>// BallerinaDistribution<NEW_LINE>// BallerinaUserHome --> create if not exists get the .ballerina<NEW_LINE>// centralRepo = BallerinaUserHome.getCentralRepository()<NEW_LINE>// Creating a Ballerina distribution instance<NEW_LINE>BallerinaDistribution ballerinaDistribution = getBallerinaDistribution(environment);<NEW_LINE>PackageRepository distributionRepository = ballerinaDistribution.packageRepository();<NEW_LINE>environment.addService(PackageRepository.class, distributionRepository);<NEW_LINE>PackageCache packageCache = new EnvironmentPackageCache();<NEW_LINE>environment.addService(PackageCache.class, packageCache);<NEW_LINE>// Creating a Ballerina user home instance<NEW_LINE>BallerinaUserHome ballerinaUserHome = getBallerinaUserHome(environment);<NEW_LINE>PackageRepository ballerinaCentralRepo = ballerinaUserHome.remotePackageRepository();<NEW_LINE>environment.addService(LocalPackageRepository.class, ballerinaUserHome.localPackageRepository());<NEW_LINE>PackageResolver packageResolver = new DefaultPackageResolver(distributionRepository, ballerinaCentralRepo, <MASK><NEW_LINE>environment.addService(PackageResolver.class, packageResolver);<NEW_LINE>CompilerContext compilerContext = populateCompilerContext();<NEW_LINE>environment.addService(CompilerContext.class, compilerContext);<NEW_LINE>ballerinaDistribution.loadLangLibPackages(compilerContext, packageResolver);<NEW_LINE>return environment;<NEW_LINE>} | ballerinaUserHome.localPackageRepository(), packageCache); |
215,809 | private void createUpgradeTask(UserIntent userIntent, Universe universe, PlacementInfo pi) {<NEW_LINE>String ybSoftwareVersion = null;<NEW_LINE>boolean masterChanged = false;<NEW_LINE>boolean tserverChanged = false;<NEW_LINE>if (taskParams().taskType == UpgradeTaskParams.UpgradeTaskType.Software) {<NEW_LINE>ybSoftwareVersion = taskParams().ybSoftwareVersion;<NEW_LINE>masterChanged = true;<NEW_LINE>tserverChanged = true;<NEW_LINE>} else {<NEW_LINE>ybSoftwareVersion = userIntent.ybSoftwareVersion;<NEW_LINE>if (!taskParams().masterGFlags.equals(userIntent.masterGFlags)) {<NEW_LINE>masterChanged = true;<NEW_LINE>}<NEW_LINE>if (!taskParams().tserverGFlags.equals(userIntent.tserverGFlags)) {<NEW_LINE>tserverChanged = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>createSingleKubernetesExecutorTask(CommandType.POD_INFO, pi);<NEW_LINE>KubernetesPlacement placement = new KubernetesPlacement(pi);<NEW_LINE>Provider provider = Provider.get(UUID.fromString(taskParams().getPrimaryCluster().userIntent.provider));<NEW_LINE>UniverseDefinitionTaskParams universeDetails = universe.getUniverseDetails();<NEW_LINE>String masterAddresses = PlacementInfoUtil.computeMasterAddresses(pi, placement.masters, taskParams().nodePrefix, provider, universeDetails.communicationPorts.masterRpcPort);<NEW_LINE>if (masterChanged) {<NEW_LINE>userIntent.masterGFlags = taskParams().masterGFlags;<NEW_LINE>upgradePodsTask(placement, masterAddresses, null, ServerType.MASTER, ybSoftwareVersion, taskParams().sleepAfterMasterRestartMillis, masterChanged, tserverChanged);<NEW_LINE>}<NEW_LINE>if (tserverChanged) {<NEW_LINE>createLoadBalancerStateChangeTask(false<MASK><NEW_LINE>userIntent.tserverGFlags = taskParams().tserverGFlags;<NEW_LINE>upgradePodsTask(placement, masterAddresses, null, ServerType.TSERVER, ybSoftwareVersion, taskParams().sleepAfterTServerRestartMillis, false, /* master change is false since it has already been upgraded.*/<NEW_LINE>tserverChanged);<NEW_LINE>createLoadBalancerStateChangeTask(true).setSubTaskGroupType(getTaskSubGroupType());<NEW_LINE>}<NEW_LINE>} | ).setSubTaskGroupType(getTaskSubGroupType()); |
1,668,895 | public void createSentryParts() {<NEW_LINE>CmmnActivity activity = getActivity();<NEW_LINE>ensureNotNull("Case execution '" + id + "': has no current activity", "activity", activity);<NEW_LINE>List<CmmnSentryDeclaration> sentries = activity.getSentries();<NEW_LINE>if (sentries != null && !sentries.isEmpty()) {<NEW_LINE>for (CmmnSentryDeclaration sentryDeclaration : sentries) {<NEW_LINE>CmmnIfPartDeclaration ifPartDeclaration = sentryDeclaration.getIfPart();<NEW_LINE>if (ifPartDeclaration != null) {<NEW_LINE>CmmnSentryPart ifPart = createIfPart(sentryDeclaration, ifPartDeclaration);<NEW_LINE>addSentryPart(ifPart);<NEW_LINE>}<NEW_LINE>List<CmmnOnPartDeclaration> onPartDeclarations = sentryDeclaration.getOnParts();<NEW_LINE>for (CmmnOnPartDeclaration onPartDeclaration : onPartDeclarations) {<NEW_LINE>CmmnSentryPart onPart = createOnPart(sentryDeclaration, onPartDeclaration);<NEW_LINE>addSentryPart(onPart);<NEW_LINE>}<NEW_LINE>List<CmmnVariableOnPartDeclaration<MASK><NEW_LINE>for (CmmnVariableOnPartDeclaration variableOnPartDeclaration : variableOnPartDeclarations) {<NEW_LINE>CmmnSentryPart variableOnPart = createVariableOnPart(sentryDeclaration, variableOnPartDeclaration);<NEW_LINE>addSentryPart(variableOnPart);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > variableOnPartDeclarations = sentryDeclaration.getVariableOnParts(); |
1,757,758 | public boolean canMark(AnActionEvent e) {<NEW_LINE>Module module = e.getData(LangDataKeys.MODULE);<NEW_LINE>VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);<NEW_LINE>if (module == null || vFiles == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>ModuleRootManager <MASK><NEW_LINE>final ContentEntry[] contentEntries = moduleRootManager.getContentEntries();<NEW_LINE>for (VirtualFile vFile : vFiles) {<NEW_LINE>if (!vFile.isDirectory()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (ContentEntry contentEntry : contentEntries) {<NEW_LINE>for (ContentFolder contentFolder : contentEntry.getFolders(ContentFolderScopes.all())) {<NEW_LINE>if (Comparing.equal(contentFolder.getFile(), vFile)) {<NEW_LINE>if (contentFolder.getType() == myContentFolderType) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | moduleRootManager = ModuleRootManager.getInstance(module); |
756,585 | public static boolean writeToStream(Bitmap realBitmap, CompressFormat format, int quality, OutputStream stream) {<NEW_LINE>if ((quality < 0) || (quality > 100)) {<NEW_LINE>throw new IllegalArgumentException("Quality out of bounds!");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ImageWriter writer = null;<NEW_LINE>Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(getFormatName(format));<NEW_LINE>if (iter.hasNext()) {<NEW_LINE>writer = iter.next();<NEW_LINE>}<NEW_LINE>if (writer == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>try (ImageOutputStream ios = ImageIO.createImageOutputStream(stream)) {<NEW_LINE>writer.setOutput(ios);<NEW_LINE>ImageWriteParam iwparam = writer.getDefaultWriteParam();<NEW_LINE><MASK><NEW_LINE>iwparam.setCompressionQuality((quality / 100f));<NEW_LINE>int width = realBitmap.getWidth();<NEW_LINE>int height = realBitmap.getHeight();<NEW_LINE>boolean needAlphaChannel = needAlphaChannel(format);<NEW_LINE>BufferedImage bufferedImage = Shadows.shadowOf(realBitmap).getBufferedImage();<NEW_LINE>if (bufferedImage == null) {<NEW_LINE>bufferedImage = new BufferedImage(realBitmap.getWidth(), realBitmap.getHeight(), BufferedImage.TYPE_INT_ARGB);<NEW_LINE>}<NEW_LINE>int outputImageType = getBufferedImageType(realBitmap.getConfig(), needAlphaChannel);<NEW_LINE>if (outputImageType != BufferedImage.TYPE_INT_ARGB) {<NEW_LINE>// re-encode image data with a type that is compatible with the output format.<NEW_LINE>BufferedImage outputBufferedImage = new BufferedImage(width, height, outputImageType);<NEW_LINE>Graphics2D g = outputBufferedImage.createGraphics();<NEW_LINE>g.drawImage(bufferedImage, 0, 0, null);<NEW_LINE>g.dispose();<NEW_LINE>bufferedImage = outputBufferedImage;<NEW_LINE>}<NEW_LINE>writer.write(null, new IIOImage(bufferedImage, null, null), iwparam);<NEW_LINE>ios.flush();<NEW_LINE>writer.dispose();<NEW_LINE>}<NEW_LINE>} catch (IOException ignore) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); |
461,854 | void parseFiles(InputStream stdin, PrintStream output) throws Exception {<NEW_LINE>FeedContext context = new FeedContext(args.getPropertyProcessor(), args.getSessionFactory(), manager);<NEW_LINE>final BufferedInputStream input = new BufferedInputStream(stdin);<NEW_LINE>VespaFeedHandler handler = VespaFeedHandler.createFromContext(context);<NEW_LINE>if (args.getFiles().isEmpty()) {<NEW_LINE>InputStreamRequest req = new InputStreamRequest(input);<NEW_LINE>setProperties(req, input);<NEW_LINE>FeedResponse response = handler.handle(req.toRequest(), createProgressCallback(output), args.getNumThreads());<NEW_LINE>if (!response.isSuccess()) {<NEW_LINE>throw renderErrors(response.getErrorList());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (args.isVerbose()) {<NEW_LINE>for (String fileName : args.getFiles()) {<NEW_LINE>long thisSize = new <MASK><NEW_LINE>output.println("Size of file '" + fileName + "' is " + thisSize + " B.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String fileName : args.getFiles()) {<NEW_LINE>File f = new File(fileName);<NEW_LINE>FileRequest req = new FileRequest(f);<NEW_LINE>final BufferedInputStream inputSnooper = new BufferedInputStream(new FileInputStream(fileName));<NEW_LINE>setProperties(req, inputSnooper);<NEW_LINE>inputSnooper.close();<NEW_LINE>FeedResponse response = handler.handle(req.toRequest(), createProgressCallback(output), args.getNumThreads());<NEW_LINE>if (!response.isSuccess()) {<NEW_LINE>throw renderErrors(response.getErrorList());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | File(fileName).length(); |
122,624 | /* (non-Javadoc)<NEW_LINE>* @see org.netbeans.modules.web.beans.analysis.analyzer.ClassModelAnalyzer.ClassAnalyzer#analyze(javax.lang.model.element.TypeElement, javax.lang.model.element.TypeElement, org.netbeans.modules.web.beans.api.model.WebBeansModel, java.util.List, org.netbeans.api.java.source.CompilationInfo, java.util.concurrent.atomic.AtomicBoolean)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void analyze(TypeElement element, TypeElement parent, WebBeansModel model, AtomicBoolean cancel, Result result) {<NEW_LINE>boolean cdiManaged = model.getQualifiers(element, <MASK><NEW_LINE>if (!cdiManaged) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>result.requireCdiEnabled(element, model);<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkCtor(element, model, result);<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkInner(element, parent, model, result);<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkAbstract(element, model, result);<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkImplementsExtension(element, model, result);<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkDecorators(element, model, result);<NEW_LINE>} | true).size() > 0; |
1,538,621 | public static Object fetch(String id) {<NEW_LINE>try {<NEW_LINE>checkCapabilities();<NEW_LINE><MASK><NEW_LINE>ContentResolver r = getContentResolver();<NEW_LINE>Uri uri = ContentUris.withAppendedId(EVENTS_URI, Long.parseLong(id));<NEW_LINE>final Cursor eventCursor = r.query(uri, new String[] { EVENTS_ID, EVENTS_TITLE, EVENTS_START_DATE, EVENTS_END_DATE, EVENTS_LOCATION, EVENTS_NOTES, EVENTS_PRIVACY, EVENTS_RRULE }, null, null, null);<NEW_LINE>if (eventCursor == null)<NEW_LINE>throw new RuntimeException("Calendar provider not found");<NEW_LINE>try {<NEW_LINE>if (!eventCursor.moveToFirst()) {<NEW_LINE>Logger.D(TAG, "fetch(id): result set is empty");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Event event = fetchEvent(eventCursor, false);<NEW_LINE>return event;<NEW_LINE>} finally {<NEW_LINE>eventCursor.close();<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.E(TAG, e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | Logger.D(TAG, "fetch(id)"); |
1,681,078 | public static DescribeAntChainCertificateApplicationsV2Response unmarshall(DescribeAntChainCertificateApplicationsV2Response describeAntChainCertificateApplicationsV2Response, UnmarshallerContext _ctx) {<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setRequestId<MASK><NEW_LINE>describeAntChainCertificateApplicationsV2Response.setHttpStatusCode(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.HttpStatusCode"));<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setSuccess(_ctx.booleanValue("DescribeAntChainCertificateApplicationsV2Response.Success"));<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setResultMessage(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.ResultMessage"));<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setCode(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.Code"));<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setMessage(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.Message"));<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setResultCode(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.ResultCode"));<NEW_LINE>Result result = new Result();<NEW_LINE>Pagination pagination = new Pagination();<NEW_LINE>pagination.setPageSize(_ctx.integerValue("DescribeAntChainCertificateApplicationsV2Response.Result.Pagination.PageSize"));<NEW_LINE>pagination.setPageNumber(_ctx.integerValue("DescribeAntChainCertificateApplicationsV2Response.Result.Pagination.PageNumber"));<NEW_LINE>pagination.setTotalCount(_ctx.integerValue("DescribeAntChainCertificateApplicationsV2Response.Result.Pagination.TotalCount"));<NEW_LINE>result.setPagination(pagination);<NEW_LINE>List<CertificateApplicationsItem> certificateApplications = new ArrayList<CertificateApplicationsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications.Length"); i++) {<NEW_LINE>CertificateApplicationsItem certificateApplicationsItem = new CertificateApplicationsItem();<NEW_LINE>certificateApplicationsItem.setStatus(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications[" + i + "].Status"));<NEW_LINE>certificateApplicationsItem.setUpdatetime(_ctx.longValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications[" + i + "].Updatetime"));<NEW_LINE>certificateApplicationsItem.setCreatetime(_ctx.longValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications[" + i + "].Createtime"));<NEW_LINE>certificateApplicationsItem.setBid(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications[" + i + "].Bid"));<NEW_LINE>certificateApplicationsItem.setAntChainId(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications[" + i + "].AntChainId"));<NEW_LINE>certificateApplicationsItem.setUsername(_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.Result.CertificateApplications[" + i + "].Username"));<NEW_LINE>certificateApplications.add(certificateApplicationsItem);<NEW_LINE>}<NEW_LINE>result.setCertificateApplications(certificateApplications);<NEW_LINE>describeAntChainCertificateApplicationsV2Response.setResult(result);<NEW_LINE>return describeAntChainCertificateApplicationsV2Response;<NEW_LINE>} | (_ctx.stringValue("DescribeAntChainCertificateApplicationsV2Response.RequestId")); |
1,392,744 | protected void loadTileLayer(TiledMap map, MapLayers parentLayers, Element element) {<NEW_LINE>if (element.getName().equals("layer")) {<NEW_LINE>int width = element.getIntAttribute("width", 0);<NEW_LINE>int height = element.getIntAttribute("height", 0);<NEW_LINE>int tileWidth = map.getProperties().get("tilewidth", Integer.class);<NEW_LINE>int tileHeight = map.getProperties().get("tileheight", Integer.class);<NEW_LINE>TiledMapTileLayer layer = new TiledMapTileLayer(width, height, tileWidth, tileHeight);<NEW_LINE>loadBasicLayerInfo(layer, element);<NEW_LINE>int[] ids = getTileIds(element, width, height);<NEW_LINE>TiledMapTileSets tilesets = map.getTileSets();<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int id = <MASK><NEW_LINE>boolean flipHorizontally = ((id & FLAG_FLIP_HORIZONTALLY) != 0);<NEW_LINE>boolean flipVertically = ((id & FLAG_FLIP_VERTICALLY) != 0);<NEW_LINE>boolean flipDiagonally = ((id & FLAG_FLIP_DIAGONALLY) != 0);<NEW_LINE>TiledMapTile tile = tilesets.getTile(id & ~MASK_CLEAR);<NEW_LINE>if (tile != null) {<NEW_LINE>Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally);<NEW_LINE>cell.setTile(tile);<NEW_LINE>layer.setCell(x, flipY ? height - 1 - y : y, cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Element properties = element.getChildByName("properties");<NEW_LINE>if (properties != null) {<NEW_LINE>loadProperties(layer.getProperties(), properties);<NEW_LINE>}<NEW_LINE>parentLayers.add(layer);<NEW_LINE>}<NEW_LINE>} | ids[y * width + x]; |
1,251,192 | private Optional<Checksum> validateChecksum(String sha256, String integrity, List<URL> urls) throws RepositoryFunctionException, EvalException {<NEW_LINE>if (!sha256.isEmpty()) {<NEW_LINE>if (!integrity.isEmpty()) {<NEW_LINE>throw Starlark.errorf("Expected either 'sha256' or 'integrity', but not both");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return Optional.of(Checksum.fromString(KeyType.SHA256, sha256));<NEW_LINE>} catch (Checksum.InvalidChecksumException e) {<NEW_LINE>warnAboutChecksumError(urls, e.getMessage());<NEW_LINE>throw new RepositoryFunctionException(Starlark.errorf("Definition of repository %s: %s at %s", rule.getName(), e.getMessage(), rule.getLocation()), Transience.PERSISTENT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (integrity.isEmpty()) {<NEW_LINE>return Optional.absent();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return Optional.of<MASK><NEW_LINE>} catch (Checksum.InvalidChecksumException e) {<NEW_LINE>warnAboutChecksumError(urls, e.getMessage());<NEW_LINE>throw new RepositoryFunctionException(Starlark.errorf("Definition of repository %s: %s at %s", rule.getName(), e.getMessage(), rule.getLocation()), Transience.PERSISTENT);<NEW_LINE>}<NEW_LINE>} | (Checksum.fromSubresourceIntegrity(integrity)); |
214,538 | private static double regularizedIncompleteGammaSeries(double a, double x) {<NEW_LINE>if (a < 0.0 || x < 0.0 || x >= a + 1) {<NEW_LINE>throw new IllegalArgumentException(String.format<MASK><NEW_LINE>}<NEW_LINE>int i = 0;<NEW_LINE>double igf = 0.0;<NEW_LINE>boolean check = true;<NEW_LINE>double acopy = a;<NEW_LINE>double sum = 1.0 / a;<NEW_LINE>double incr = sum;<NEW_LINE>double loggamma = lgamma(a);<NEW_LINE>while (check) {<NEW_LINE>++i;<NEW_LINE>++a;<NEW_LINE>incr *= x / a;<NEW_LINE>sum += incr;<NEW_LINE>if (abs(incr) < abs(sum) * INCOMPLETE_GAMMA_EPSILON) {<NEW_LINE>igf = sum * exp(-x + acopy * log(x) - loggamma);<NEW_LINE>check = false;<NEW_LINE>}<NEW_LINE>if (i >= INCOMPLETE_GAMMA_MAX_ITERATIONS) {<NEW_LINE>check = false;<NEW_LINE>igf = sum * exp(-x + acopy * log(x) - loggamma);<NEW_LINE>logger.error("Gamma.regularizedIncompleteGammaSeries: Maximum number of iterations wes exceeded");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return igf;<NEW_LINE>} | ("Invalid a = %f, x = %f", a, x)); |
514,634 | /*<NEW_LINE>* Converts a JSON String to a map of SourceIds to DbusKeyFilter<NEW_LINE>*<NEW_LINE>* @param String containing JSON representation of DbusKeyFilter object<NEW_LINE>* @return Map of SourceIds to DbusKeyFilter<NEW_LINE>*<NEW_LINE>* @throws<NEW_LINE>* JSONException if JSON Parser is unable to parse the data<NEW_LINE>* IOException if there is any IO errors while parsing<NEW_LINE>*/<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>public static Map<Long, DbusKeyFilter> parseSrcIdFilterConfigMap(String s) throws JSONException, IOException {<NEW_LINE>HashMap<Long, DbusKeyFilter> filterConfigMap = new HashMap<Long, DbusKeyFilter>();<NEW_LINE>HashMap<Long, JSONObject> genericMap = new HashMap<Long, JSONObject>();<NEW_LINE>ObjectMapper mapper = new ObjectMapper();<NEW_LINE>try {<NEW_LINE>JSONObject obj2 = new JSONObject(s);<NEW_LINE>Iterator<String> itr = obj2.keys();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>String k = itr.next();<NEW_LINE>Long key = Long.valueOf(k);<NEW_LINE>genericMap.put(key, obj2.getJSONObject(key.toString()));<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE><MASK><NEW_LINE>throw new JSONException(ex);<NEW_LINE>}<NEW_LINE>Iterator<Entry<Long, JSONObject>> itr = genericMap.entrySet().iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>Entry<Long, JSONObject> obj = itr.next();<NEW_LINE>filterConfigMap.put(obj.getKey(), getDbusKeyFilter(obj.getValue(), mapper));<NEW_LINE>}<NEW_LINE>return filterConfigMap;<NEW_LINE>} | LOG.error("Got exception while parsing filterConfig", ex); |
1,752,431 | private static int mapActions(SQLite3GlobalState globalState, Action a) {<NEW_LINE>int nrPerformed = 0;<NEW_LINE>Randomly r = globalState.getRandomly();<NEW_LINE>switch(a) {<NEW_LINE>case CREATE_VIEW:<NEW_LINE>nrPerformed = r.getInteger(0, 2);<NEW_LINE>break;<NEW_LINE>case DELETE:<NEW_LINE>case DROP_VIEW:<NEW_LINE>case DROP_INDEX:<NEW_LINE>nrPerformed = r.getInteger(0, 0);<NEW_LINE>break;<NEW_LINE>case ALTER:<NEW_LINE>nrPerformed = r.getInteger(0, 0);<NEW_LINE>break;<NEW_LINE>case EXPLAIN:<NEW_LINE>case CREATE_TRIGGER:<NEW_LINE>case DROP_TABLE:<NEW_LINE>nrPerformed = r.getInteger(0, 0);<NEW_LINE>break;<NEW_LINE>case VACUUM:<NEW_LINE>case CHECK_RTREE_TABLE:<NEW_LINE>nrPerformed = <MASK><NEW_LINE>break;<NEW_LINE>case INSERT:<NEW_LINE>nrPerformed = r.getInteger(0, globalState.getOptions().getMaxNumberInserts());<NEW_LINE>break;<NEW_LINE>case MANIPULATE_STAT_TABLE:<NEW_LINE>nrPerformed = r.getInteger(0, 5);<NEW_LINE>break;<NEW_LINE>case INDEX:<NEW_LINE>nrPerformed = r.getInteger(0, 5);<NEW_LINE>break;<NEW_LINE>case VIRTUAL_TABLE_ACTION:<NEW_LINE>case UPDATE:<NEW_LINE>nrPerformed = r.getInteger(0, 30);<NEW_LINE>break;<NEW_LINE>case PRAGMA:<NEW_LINE>nrPerformed = r.getInteger(0, 20);<NEW_LINE>break;<NEW_LINE>case TRANSACTION_START:<NEW_LINE>case REINDEX:<NEW_LINE>case ANALYZE:<NEW_LINE>case ROLLBACK_TRANSACTION:<NEW_LINE>case COMMIT:<NEW_LINE>default:<NEW_LINE>nrPerformed = r.getInteger(1, 10);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return nrPerformed;<NEW_LINE>} | r.getInteger(0, 3); |
984,537 | final CreateVirtualRouterResult executeCreateVirtualRouter(CreateVirtualRouterRequest createVirtualRouterRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createVirtualRouterRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateVirtualRouterRequest> request = null;<NEW_LINE>Response<CreateVirtualRouterResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateVirtualRouterRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createVirtualRouterRequest));<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, "App Mesh");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateVirtualRouter");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateVirtualRouterResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateVirtualRouterResultJsonUnmarshaller());<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); |
253,740 | final ListDatasetsResult executeListDatasets(ListDatasetsRequest listDatasetsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listDatasetsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListDatasetsRequest> request = null;<NEW_LINE>Response<ListDatasetsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListDatasetsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDatasetsRequest));<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, "forecast");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDatasets");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListDatasetsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDatasetsResultJsonUnmarshaller());<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); |
422,443 | public static String buildAuraHome() {<NEW_LINE>String providedPath = System.getProperty("aura.home");<NEW_LINE>if (providedPath != null) {<NEW_LINE>try {<NEW_LINE>// try to clean up any provided path<NEW_LINE>File canonical = new File(providedPath).getCanonicalFile();<NEW_LINE>if (canonical.exists() && canonical.isDirectory()) {<NEW_LINE>return canonical.getPath();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Class<MASK><NEW_LINE>try {<NEW_LINE>CodeSource source = clazz.getProtectionDomain().getCodeSource();<NEW_LINE>if (source != null) {<NEW_LINE>URL url = source.getLocation();<NEW_LINE>if (FILE_PROTOCOL.equalsIgnoreCase(url.getProtocol())) {<NEW_LINE>String path = stripTarget(url.getPath());<NEW_LINE>if (path != null) {<NEW_LINE>return path;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SecurityException se) {<NEW_LINE>// ignore, we can't read it, try again with the class below.<NEW_LINE>}<NEW_LINE>String clazzPath = "/" + clazz.getName().replace('.', '/') + ".class";<NEW_LINE>URL clazzUrl = clazz.getResource(clazzPath);<NEW_LINE>System.out.println(clazzUrl);<NEW_LINE>if (FILE_PROTOCOL.equalsIgnoreCase(clazzUrl.getProtocol())) {<NEW_LINE>String path = clazzUrl.getPath();<NEW_LINE>if (path.endsWith(clazzPath)) {<NEW_LINE>path = path.substring(0, path.lastIndexOf(clazzPath));<NEW_LINE>path = stripTarget(path);<NEW_LINE>if (path != null) {<NEW_LINE>return path;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | <?> clazz = AuraUtil.class; |
753,110 | private void startupDeviceCall() {<NEW_LINE>String aUserId = bridgeSettingMaster.getBridgeSecurity().createWhitelistUser("test_ha_bridge");<NEW_LINE>List<DeviceDescriptor> deviceList = repository.findAll();<NEW_LINE>String aChangeBody;<NEW_LINE>String[] components;<NEW_LINE>boolean comma = false;<NEW_LINE>for (DeviceDescriptor aDevice : deviceList) {<NEW_LINE>if (aDevice.getStartupActions() != null && !aDevice.getStartupActions().isEmpty()) {<NEW_LINE>log.info("Startup call for {} with startupActions {}", aDevice.getName(), aDevice.getStartupActions());<NEW_LINE>aChangeBody = "{";<NEW_LINE>components = aDevice.getStartupActions().split(":");<NEW_LINE>if (components.length > 0 && components[0] != null && components[0].length() > 0) {<NEW_LINE>if (components[0].equals("On")) {<NEW_LINE>aChangeBody = aChangeBody + "\"on\":true";<NEW_LINE>} else {<NEW_LINE>aChangeBody = aChangeBody + "\"on\":false";<NEW_LINE>}<NEW_LINE>comma = true;<NEW_LINE>}<NEW_LINE>if (components.length > 1 && components[1] != null && components[1].length() > 0 && !(components.length > 2 && components[2] != null && components[2].length() > 0)) {<NEW_LINE>if (comma)<NEW_LINE>aChangeBody = aChangeBody + ",";<NEW_LINE>aChangeBody = <MASK><NEW_LINE>comma = true;<NEW_LINE>}<NEW_LINE>if (components.length > 2 && components[2] != null && components[2].length() > 0) {<NEW_LINE>if (comma)<NEW_LINE>aChangeBody = aChangeBody + ",";<NEW_LINE>String theRGB = components[2].substring(components[2].indexOf('(') + 1, components[2].indexOf(')'));<NEW_LINE>String[] RGB = theRGB.split(",");<NEW_LINE>float[] hsb = new float[3];<NEW_LINE>Color.RGBtoHSB(Integer.parseInt(RGB[0]), Integer.parseInt(RGB[1]), Integer.parseInt(RGB[2]), hsb);<NEW_LINE>float hue = hsb[0] * (float) 360.0;<NEW_LINE>float sat = hsb[1] * (float) 100.0;<NEW_LINE>float bright = hsb[2] * (float) 100.0;<NEW_LINE>aChangeBody = String.format("%s\"hue\":%.2f,\"sat\":%.2f,\"bri\":%d", aChangeBody, hue, sat, Math.round(bright));<NEW_LINE>}<NEW_LINE>aChangeBody = aChangeBody + "}";<NEW_LINE>log.info("Startup call to set state for {} with body {}", aDevice.getName(), aChangeBody);<NEW_LINE>changeState(aUserId, aDevice.getId(), aChangeBody, "localhost", true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | aChangeBody + "\"bri\":" + components[1]; |
490,942 | static Predicate<Object, Object> toPredicate(JetSqlRow left, int[] leftEquiJoinIndices, int[] rightEquiJoinIndices, QueryPath[] rightPaths) {<NEW_LINE>PredicateBuilder builder = Predicates.newPredicateBuilder();<NEW_LINE>EntryObject entryObject = builder.getEntryObject();<NEW_LINE>for (int i = 0; i < leftEquiJoinIndices.length; i++) {<NEW_LINE>Comparable leftValue = asComparable(left.get(leftEquiJoinIndices[i]));<NEW_LINE>// might need a change when/if IS NOT DISTINCT FROM is supported<NEW_LINE>if (leftValue == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>QueryPath rightPath = rightPaths[rightEquiJoinIndices[i]];<NEW_LINE>EntryObject object;<NEW_LINE>if (rightPath.isKey()) {<NEW_LINE>object = rightPath.isTop() ? entryObject.key() : entryObject.key().<MASK><NEW_LINE>} else {<NEW_LINE>object = rightPath.isTop() ? entryObject.get(rightPath.toString()) : entryObject.get(QueryPath.VALUE).get(rightPath.getPath());<NEW_LINE>}<NEW_LINE>if (i == 0) {<NEW_LINE>object.equal(leftValue);<NEW_LINE>} else {<NEW_LINE>builder.and(object.equal(leftValue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder;<NEW_LINE>} | get(rightPath.getPath()); |
1,045,753 | protected void draw(Canvas c, MapView osmv, boolean shadow) {<NEW_LINE>if (DEBUGMODE) {<NEW_LINE>ClientLog.d(LOG_TAG, "onDraw(" + shadow + ")");<NEW_LINE>}<NEW_LINE>if (shadow) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Projection projection = osmv.getProjection();<NEW_LINE>// Get the area we are drawing to<NEW_LINE>Rect screenRect = projection.getScreenRect();<NEW_LINE>projection.toMercatorPixels(screenRect.left, screenRect.top, mTopLeftMercator);<NEW_LINE>projection.toMercatorPixels(screenRect.<MASK><NEW_LINE>mViewPort.set(mTopLeftMercator.x, mTopLeftMercator.y, mBottomRightMercator.x, mBottomRightMercator.y);<NEW_LINE>// Draw the tiles!<NEW_LINE>drawTiles(c, projection, projection.getZoomLevel(), TileSystem.getTileSize(), mViewPort);<NEW_LINE>} | right, screenRect.bottom, mBottomRightMercator); |
565,671 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("to" + mm.getMessage("function.missingParam"));<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>Object o = param.getLeafExpression().calculate(ctx);<NEW_LINE>if (o instanceof Number) {<NEW_LINE>int end = ((Number) o).intValue();<NEW_LINE>return end > 0 ? new Sequence(1, end) : new Sequence(0);<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("to" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (param.getSubSize() != 2) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("to" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>IParam sub1 = param.getSub(0);<NEW_LINE>IParam sub2 = param.getSub(1);<NEW_LINE>if (sub1 == null || sub2 == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("to" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Object o1 = sub1.getLeafExpression().calculate(ctx);<NEW_LINE>Object o2 = sub2.getLeafExpression().calculate(ctx);<NEW_LINE>if (o1 instanceof Long && o2 instanceof Long) {<NEW_LINE>long begin = ((Number) o1).longValue();<NEW_LINE>long end = ((Number) o2).longValue();<NEW_LINE>if (option != null && option.indexOf('s') != -1) {<NEW_LINE>if (end >= 0) {<NEW_LINE>end += begin - 1;<NEW_LINE>} else {<NEW_LINE>end += begin + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Sequence(begin, end);<NEW_LINE>} else if (o1 instanceof Number && o2 instanceof Number) {<NEW_LINE>int begin = ((Number) o1).intValue();<NEW_LINE>int end = ((Number) o2).intValue();<NEW_LINE>if (option != null && option.indexOf('s') != -1) {<NEW_LINE>if (end >= 0) {<NEW_LINE>end += begin - 1;<NEW_LINE>} else {<NEW_LINE>end += begin + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Sequence(begin, end);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>throw new RQException("to" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | MessageManager mm = EngineMessage.get(); |
1,538,224 | public List<TextFileType> statusBarFileTypes() {<NEW_LINE>ArrayList<TextFileType> fileTypes = new ArrayList<TextFileType>(Arrays.asList(FileTypeRegistry.TEXT, FileTypeRegistry.R, FileTypeRegistry.RMARKDOWN, FileTypeRegistry.SWEAVE, FileTypeRegistry.RHTML, FileTypeRegistry.RPRESENTATION, FileTypeRegistry.RD, FileTypeRegistry.TEX, FileTypeRegistry.MARKDOWN, FileTypeRegistry.XML, FileTypeRegistry.YAML, FileTypeRegistry.DCF, FileTypeRegistry.SH, FileTypeRegistry.HTML, FileTypeRegistry.CSS, FileTypeRegistry.SASS, FileTypeRegistry.SCSS, FileTypeRegistry.JS, FileTypeRegistry.JSON, FileTypeRegistry.CPP, FileTypeRegistry.PYTHON, FileTypeRegistry.SQL, FileTypeRegistry.STAN));<NEW_LINE>if (session_.getSessionInfo().getQuartoConfig().enabled) {<NEW_LINE>fileTypes.add(fileTypes.indexOf(FileTypeRegistry<MASK><NEW_LINE>}<NEW_LINE>return fileTypes;<NEW_LINE>} | .TEX), FileTypeRegistry.QUARTO); |
1,472,000 | public // 0 bsi1:1:1.8:2:2.6 8f81878...<NEW_LINE>void map(final LongWritable key, final Text value, final OutputCollector<IntWritable, Text> output, final Reporter reporter) throws IOException {<NEW_LINE>final String[] line = value.toString().split("\t");<NEW_LINE>final String[] tokens = line<MASK><NEW_LINE>int max_radius = 0;<NEW_LINE>// int eff_radius = 0;<NEW_LINE>double eff_radius = 0;<NEW_LINE>double eff_nh = 0;<NEW_LINE>String radius_str = tokens[0].substring(3);<NEW_LINE>if (radius_str.length() > 0) {<NEW_LINE>String[] radius_info = radius_str.split(":");<NEW_LINE>if (radius_info.length > 1) {<NEW_LINE>max_radius = Integer.parseInt(radius_info[radius_info.length - 2]);<NEW_LINE>eff_radius = max_radius;<NEW_LINE>double max_nh = Double.parseDouble(radius_info[radius_info.length - 1]);<NEW_LINE>eff_nh = max_nh;<NEW_LINE>double ninety_th = max_nh * 0.9;<NEW_LINE>for (int i = radius_info.length - 4; i >= 0; i -= 2) {<NEW_LINE>int cur_hop = Integer.parseInt(radius_info[i]);<NEW_LINE>double cur_nh = Double.parseDouble(radius_info[i + 1]);<NEW_LINE>if (cur_nh >= ninety_th) {<NEW_LINE>eff_radius = cur_hop;<NEW_LINE>eff_nh = cur_nh;<NEW_LINE>} else {<NEW_LINE>eff_radius = cur_hop + (double) (ninety_th - cur_nh) / (eff_nh - cur_nh);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DecimalFormat df = new DecimalFormat("#.##");<NEW_LINE>output.collect(new IntWritable(Integer.parseInt(line[0])), new Text("bsf" + max_radius + ":" + df.format(eff_radius)));<NEW_LINE>}<NEW_LINE>} | [1].split(" "); |
407,332 | public static void updateCurrentTrack(View v, final Activity ctx, final OsmandApplication app) {<NEW_LINE>final OsmandMonitoringPlugin plugin = OsmandPlugin.getActivePlugin(OsmandMonitoringPlugin.class);<NEW_LINE>if (v == null || ctx == null || app == null || plugin == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final boolean isRecording = app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get();<NEW_LINE>ImageButton stop = ((ImageButton) v.findViewById(R.id.stop));<NEW_LINE>if (isRecording) {<NEW_LINE>stop.setImageDrawable(app.getUIUtilities().getThemedIcon<MASK><NEW_LINE>stop.setContentDescription(app.getString(R.string.gpx_monitoring_stop));<NEW_LINE>} else {<NEW_LINE>stop.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_rec_start));<NEW_LINE>stop.setContentDescription(app.getString(R.string.gpx_monitoring_start));<NEW_LINE>}<NEW_LINE>stop.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>if (isRecording) {<NEW_LINE>plugin.stopRecording();<NEW_LINE>} else if (app.getLocationProvider().checkGPSEnabled(ctx)) {<NEW_LINE>plugin.startGPXMonitoring(ctx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>SavingTrackHelper sth = app.getSavingTrackHelper();<NEW_LINE>ImageButton save = ((ImageButton) v.findViewById(R.id.show_on_map));<NEW_LINE>save.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>plugin.saveCurrentTrack();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (sth.getPoints() > 0 || sth.getDistance() > 0) {<NEW_LINE>save.setVisibility(View.VISIBLE);<NEW_LINE>} else {<NEW_LINE>save.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>save.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_gsave_dark));<NEW_LINE>save.setContentDescription(app.getString(R.string.save_current_track));<NEW_LINE>((TextView) v.findViewById(R.id.points_count)).setText(String.valueOf(sth.getPoints()));<NEW_LINE>((TextView) v.findViewById(R.id.distance)).setText(OsmAndFormatter.getFormattedDistance(sth.getDistance(), app));<NEW_LINE>v.findViewById(R.id.points_icon).setVisibility(View.VISIBLE);<NEW_LINE>ImageView distance = (ImageView) v.findViewById(R.id.distance_icon);<NEW_LINE>distance.setVisibility(View.VISIBLE);<NEW_LINE>distance.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_distance_16));<NEW_LINE>ImageView pointsCount = (ImageView) v.findViewById(R.id.points_icon);<NEW_LINE>pointsCount.setVisibility(View.VISIBLE);<NEW_LINE>pointsCount.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_waypoint_16));<NEW_LINE>} | (R.drawable.ic_action_rec_stop)); |
254,526 | CellVectorMapMap decompose(Tensor input, SplitHow how) {<NEW_LINE>var iter = input.cellIterator();<NEW_LINE>String[] commonLabels = new String[(int) how.numCommon()];<NEW_LINE>String[] separateLabels = new String[(int) how.numSeparate()];<NEW_LINE>CellVectorMapMap result = new CellVectorMapMap();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>var cell = iter.next();<NEW_LINE>var addr = cell.getKey();<NEW_LINE>long ccDimIndex = 0;<NEW_LINE>int commonIdx = 0;<NEW_LINE>int separateIdx = 0;<NEW_LINE>for (int i = 0; i < how.handleDims.size(); i++) {<NEW_LINE>switch(how.handleDims.get(i)) {<NEW_LINE>case common:<NEW_LINE>commonLabels[commonIdx++] = addr.label(i);<NEW_LINE>break;<NEW_LINE>case separate:<NEW_LINE>separateLabels[separateIdx++] = addr.label(i);<NEW_LINE>break;<NEW_LINE>case concat:<NEW_LINE>ccDimIndex = addr.numericLabel(i);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("cannot handle: " + how.handleDims.get(i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TensorAddress <MASK><NEW_LINE>TensorAddress separateAddr = TensorAddress.of(separateLabels);<NEW_LINE>result.lookupCreate(commonAddr).lookupCreate(separateAddr).setValue((int) ccDimIndex, cell.getValue());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | commonAddr = TensorAddress.of(commonLabels); |
571,288 | public static String asString() {<NEW_LINE>final StringBuilder sb = new StringBuilder("Config{\n");<NEW_LINE>sb.append(" DEFAULT_BASE_DIR=").append(DEFAULT_BASE_DIR);<NEW_LINE>sb.append(",\n DEFAULT_BASE_CACHE_DIR=").append(DEFAULT_BASE_CACHE_DIR);<NEW_LINE>sb.append(",\n DEFAULT_BASE_LOG_FILE=").append(DEFAULT_BASE_LOG_FILE);<NEW_LINE>sb.append(",\n DEFAULT_BASE_CONFIG_FILE=").append(DEFAULT_BASE_CONFIG_FILE);<NEW_LINE>sb.append(",\n DEFAULT_BASE_OVERLAYS_FILE=").append(DEFAULT_BASE_OVERLAYS_FILE);<NEW_LINE>sb.append(",\n DEFAULT_REGION_SELECTION_COLOR=").append(DEFAULT_REGION_SELECTION_COLOR);<NEW_LINE>sb.append(",\n DEFAULT_CHUNK_SELECTION_COLOR=").append(DEFAULT_CHUNK_SELECTION_COLOR);<NEW_LINE>sb.append(",\n DEFAULT_PASTE_CHUNKS_COLOR=").append(DEFAULT_PASTE_CHUNKS_COLOR);<NEW_LINE>sb.append(",\n DEFAULT_LOCALE=").append(DEFAULT_LOCALE);<NEW_LINE>sb.append(",\n DEFAULT_PROCESS_THREADS=").append(DEFAULT_PROCESS_THREADS);<NEW_LINE>sb.append(",\n DEFAULT_WRITE_THREADS=").append(DEFAULT_WRITE_THREADS);<NEW_LINE>sb.append(",\n DEFAULT_MAX_LOADED_FILES=").append(DEFAULT_MAX_LOADED_FILES);<NEW_LINE>sb.append(",\n DEFAULT_SHADE=").append(DEFAULT_SHADE);<NEW_LINE>sb.append(",\n DEFAULT_SHADE_WATER=").append(DEFAULT_SHADE_WATER);<NEW_LINE>sb.append(",\n DEFAULT_SHOW_NONEXISTENT_REGIONS=").append(DEFAULT_SHOW_NONEXISTENT_REGIONS);<NEW_LINE>sb.append(",\n DEFAULT_SMOOTH_RENDERING=").append(DEFAULT_SMOOTH_RENDERING);<NEW_LINE>sb.append(",\n DEFAULT_SMOOTH_OVERLAYS=").append(DEFAULT_SMOOTH_OVERLAYS);<NEW_LINE>sb.append(",\n DEFAULT_TILEMAP_BACKGROUND='").append(DEFAULT_TILEMAP_BACKGROUND).append('\'');<NEW_LINE>sb.append(",\n DEFAULT_DEBUG=").append(DEFAULT_DEBUG);<NEW_LINE>sb.append(",\n DEFAULT_MC_SAVES_DIR='").append(DEFAULT_MC_SAVES_DIR).append('\'');<NEW_LINE>sb.append(",\n DEFAULT_RENDER_HEIGHT=").append(DEFAULT_RENDER_HEIGHT);<NEW_LINE>sb.append(",\n DEFAULT_RENDER_LAYER_ONLY=").append(DEFAULT_RENDER_LAYER_ONLY);<NEW_LINE>sb.append(",\n DEFAULT_RENDER_CAVES=").append(DEFAULT_RENDER_CAVES);<NEW_LINE>sb.append(",\n worldDir=").append(worldDir);<NEW_LINE>sb.append(",\n worldDirs=").append(worldDirs);<NEW_LINE>sb.append<MASK><NEW_LINE>sb.append(",\n baseCacheDir=").append(baseCacheDir);<NEW_LINE>sb.append(",\n logFile=").append(logFile);<NEW_LINE>sb.append(",\n cacheDir=").append(cacheDir);<NEW_LINE>sb.append(",\n locale=").append(locale);<NEW_LINE>sb.append(",\n regionSelectionColor=").append(regionSelectionColor);<NEW_LINE>sb.append(",\n chunkSelectionColor=").append(chunkSelectionColor);<NEW_LINE>sb.append(",\n pasteChunksColor=").append(pasteChunksColor);<NEW_LINE>sb.append(",\n processThreads=").append(processThreads);<NEW_LINE>sb.append(",\n writeThreads=").append(writeThreads);<NEW_LINE>sb.append(",\n maxLoadedFiles=").append(maxLoadedFiles);<NEW_LINE>sb.append(",\n shade=").append(shade);<NEW_LINE>sb.append(",\n shadeWater=").append(shadeWater);<NEW_LINE>sb.append(",\n showNonexistentRegions=").append(showNonexistentRegions);<NEW_LINE>sb.append(",\n smoothRendering=").append(smoothRendering);<NEW_LINE>sb.append(",\n smoothOverlays=").append(smoothOverlays);<NEW_LINE>sb.append(",\n tileMapBackground='").append(tileMapBackground).append('\'');<NEW_LINE>sb.append(",\n mcSavesDir='").append(mcSavesDir).append('\'');<NEW_LINE>sb.append(",\n renderHeight=").append(renderHeight);<NEW_LINE>sb.append(",\n renderLayerOnly=").append(renderLayerOnly);<NEW_LINE>sb.append(",\n renderCaves=").append(renderCaves);<NEW_LINE>sb.append(",\n debug=").append(debug);<NEW_LINE>sb.append(",\n MAX_SCALE=").append(MAX_SCALE);<NEW_LINE>sb.append(",\n MIN_SCALE=").append(MIN_SCALE);<NEW_LINE>sb.append(",\n IMAGE_POOL_SIZE=").append(IMAGE_POOL_SIZE);<NEW_LINE>sb.append("\n}");<NEW_LINE>return sb.toString();<NEW_LINE>} | (",\n worldUUID=").append(worldUUID); |
1,390,256 | public CaseExpression visitCase(CaseExpression expr, Void params) {<NEW_LINE>List<Expression> newArgs = new ArrayList<>(expr.<MASK><NEW_LINE>for (Expression argument : expr.getArguments()) {<NEW_LINE>Expression newArg = acceptSelf(argument, true);<NEW_LINE>if (newArg == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>newArgs.add(newArg);<NEW_LINE>}<NEW_LINE>ExprSubstitution substitution = new ExprSubstitution();<NEW_LINE>DependentLink parameters = DependentLink.Helper.subst(expr.getParameters(), substitution);<NEW_LINE>if (!visitDependentLink(parameters)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Expression newType = acceptSelf(expr.getResultType().subst(substitution), true);<NEW_LINE>if (newType == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Expression newTypeLevel;<NEW_LINE>if (expr.getResultTypeLevel() != null) {<NEW_LINE>newTypeLevel = acceptSelf(expr.getResultTypeLevel().subst(substitution), true);<NEW_LINE>if (newTypeLevel == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>newTypeLevel = null;<NEW_LINE>}<NEW_LINE>if (myKeepVisitor != null) {<NEW_LINE>myKeepVisitor.freeParameters(parameters);<NEW_LINE>}<NEW_LINE>List<ElimClause<Pattern>> clauses = new ArrayList<>();<NEW_LINE>for (ElimClause<Pattern> clause : expr.getElimBody().getClauses()) {<NEW_LINE>ExprSubstitution clauseSubst = new ExprSubstitution();<NEW_LINE>DependentLink clauseParams = DependentLink.Helper.subst(Pattern.getFirstBinding(clause.getPatterns()), clauseSubst);<NEW_LINE>if (!visitDependentLink(clauseParams)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Expression newExpr;<NEW_LINE>if (clause.getExpression() != null) {<NEW_LINE>newExpr = acceptSelf(clause.getExpression(), true);<NEW_LINE>if (newExpr == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>newExpr = null;<NEW_LINE>}<NEW_LINE>clauses.add(new ElimClause<>(Pattern.replaceBindings(clause.getPatterns(), clauseParams), newExpr));<NEW_LINE>}<NEW_LINE>return new CaseExpression(expr.isSCase(), parameters, newType, newTypeLevel, new ElimBody(clauses, expr.getElimBody().getElimTree()), newArgs);<NEW_LINE>} | getArguments().size()); |
1,237,241 | public CodegenExpression codegen(EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {<NEW_LINE>CodegenMethod method = codegenMethodScope.makeChild(EPTypePremade.COLLECTION.getEPType(), EnumDistinctOfScalarNoParams.class, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMSCOLLOBJ);<NEW_LINE>method.getBlock().ifCondition(relational(exprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "size"), LE, constant(1))).blockReturn(EnumForgeCodegenNames.REF_ENUMCOLL);<NEW_LINE>if (fieldType == null || !fieldType.getType().isArray()) {<NEW_LINE>method.getBlock().ifCondition(instanceOf(ref("enumcoll"), EPTypePremade.SET.getEPType())).blockReturn(EnumForgeCodegenNames.REF_ENUMCOLL).methodReturn(newInstance(EPTypePremade.LINKEDHASHSET.getEPType(), EnumForgeCodegenNames.REF_ENUMCOLL));<NEW_LINE>} else {<NEW_LINE>EPTypeClass componentType = JavaClassHelper.getArrayComponentType(fieldType);<NEW_LINE>EPTypeClass arrayMK = MultiKeyPlanner.getMKClassForComponentType(componentType);<NEW_LINE>method.getBlock().declareVar(EPTypePremade.MAP.getEPType(), "distinct", newInstance(EPTypePremade.LINKEDHASHMAP.getEPType()));<NEW_LINE>CodegenBlock loop = method.getBlock().forEach(EPTypePremade.OBJECT.getEPType(), "next", EnumForgeCodegenNames.REF_ENUMCOLL);<NEW_LINE>{<NEW_LINE>loop.declareVar(arrayMK, "comparable", newInstance(arrayMK, cast(fieldType, ref("next")))).expression(exprDotMethod(ref("distinct"), "put", ref("comparable"), ref("next")));<NEW_LINE>}<NEW_LINE>method.getBlock().methodReturn(exprDotMethod(ref("distinct"), "values"));<NEW_LINE>}<NEW_LINE>return localMethod(<MASK><NEW_LINE>} | method, args.getExpressions()); |
732,240 | private final void onButtonPressed() {<NEW_LINE>try {<NEW_LINE>// Show the dialog<NEW_LINE>final VImageDialog vid = new VImageDialog(Env.getWindow(m_WindowNo), m_WindowNo, m_mImage);<NEW_LINE>vid.setVisible(true);<NEW_LINE>// Do nothing if user canceled (i.e. closed the window)<NEW_LINE>if (vid.isCanceled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final Integer newValue = AD_Image_ID > 0 ? AD_Image_ID : null;<NEW_LINE>//<NEW_LINE>// force reload<NEW_LINE>m_mImage = null;<NEW_LINE>// set explicitly<NEW_LINE>setValue(newValue);<NEW_LINE>//<NEW_LINE>try {<NEW_LINE>fireVetoableChange(m_columnName, null, newValue);<NEW_LINE>} catch (PropertyVetoException pve) {<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Services.get(IClientUI.class).error(m_WindowNo, e);<NEW_LINE>}<NEW_LINE>} | int AD_Image_ID = vid.getAD_Image_ID(); |
1,334,490 | public void after(Object target, Object[] args, Object result, Throwable throwable) {<NEW_LINE>if (isDebug) {<NEW_LINE>logger.afterInterceptor(target, args, result, throwable);<NEW_LINE>}<NEW_LINE>AsyncContext asyncContext = AsyncContextAccessorUtils.getAsyncContext(args, 0);<NEW_LINE>if (asyncContext == null) {<NEW_LINE>logger.debug("Not found asynchronous invocation metadata");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isDebug) {<NEW_LINE>logger.debug("Asynchronous invocation. asyncContext={}", asyncContext);<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>if (trace == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isDebug) {<NEW_LINE>logger.debug("Asynchronous invocation. asyncTraceId={}, trace={}", asyncContext, trace);<NEW_LINE>}<NEW_LINE>traceContext.removeTraceObject();<NEW_LINE>try {<NEW_LINE>final SpanEventRecorder recorder = trace.currentSpanEventRecorder();<NEW_LINE>LogMarkerToken logMarkerToken = (LogMarkerToken) args[2];<NEW_LINE>String message = ((Function0) args[3]).apply().toString();<NEW_LINE>recorder.recordApi(new LogMarkerMethodDescriptor(logMarkerToken));<NEW_LINE>if (logMarkerToken.component().equals("database")) {<NEW_LINE>recorder.recordServiceType(OpenwhiskConstants.COUCHDB_EXECUTE_QUERY);<NEW_LINE>recorder.recordDestinationId("COUCHDB");<NEW_LINE>recorder.recordAttribute(OpenwhiskConstants.MARKER_MESSAGE, message);<NEW_LINE>} else {<NEW_LINE>recorder.recordServiceType(OpenwhiskConstants.OPENWHISK_INTERNAL);<NEW_LINE>if (isLoggingMessage && message.length() > 0) {<NEW_LINE>recorder.recordAttribute(OpenwhiskConstants.MARKER_MESSAGE, message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result instanceof AsyncContextAccessor && result instanceof PinpointTraceAccessor) {<NEW_LINE>((AsyncContextAccessor) (result))._$PINPOINT$_setAsyncContext(asyncContext);<NEW_LINE>((PinpointTraceAccessor) (result))._$PINPOINT$_setPinpointTrace(trace);<NEW_LINE>}<NEW_LINE>} catch (Throwable th) {<NEW_LINE>if (logger.isWarnEnabled()) {<NEW_LINE>logger.warn("AFTER error. Caused:{}", th.getMessage(), th);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Trace trace = asyncContext.currentAsyncTraceObject(); |
1,809,761 | protected void migrateToVersion2() throws SQLException {<NEW_LINE>execute("ALTER TABLE %TABLE% ADD STRATEGY_ID VARCHAR(200)");<NEW_LINE>execute("ALTER TABLE %TABLE% ADD STRATEGY_PARAMS VARCHAR(2000)");<NEW_LINE>Statement updateDataStmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);<NEW_LINE>try {<NEW_LINE>ResultSet resultSet = null;<NEW_LINE>try {<NEW_LINE>resultSet = updateDataStmt.executeQuery(substitute("SELECT FEATURE_NAME, FEATURE_USERS, STRATEGY_ID, STRATEGY_PARAMS FROM %TABLE%"));<NEW_LINE>while (resultSet.next()) {<NEW_LINE>// migration is only required if there is data in the users column<NEW_LINE>String users = <MASK><NEW_LINE>if (Strings.isNotBlank(users)) {<NEW_LINE>// convert the user list to the new parameters format<NEW_LINE>Map<String, String> params = new HashMap<String, String>();<NEW_LINE>params.put(UsernameActivationStrategy.PARAM_USERS, users);<NEW_LINE>String paramData = serializer.serialize(params);<NEW_LINE>resultSet.updateString(Columns.STRATEGY_PARAMS, paramData);<NEW_LINE>// only overwrite strategy ID if it is not set yet<NEW_LINE>String strategyId = resultSet.getString(Columns.STRATEGY_ID);<NEW_LINE>if (Strings.isBlank(strategyId)) {<NEW_LINE>resultSet.updateString(Columns.STRATEGY_ID, UsernameActivationStrategy.ID);<NEW_LINE>}<NEW_LINE>// perform the update<NEW_LINE>resultSet.updateRow();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>DbUtils.closeQuietly(resultSet);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>DbUtils.closeQuietly(updateDataStmt);<NEW_LINE>}<NEW_LINE>execute("ALTER TABLE %TABLE% DROP COLUMN FEATURE_USERS");<NEW_LINE>} | resultSet.getString(Columns.FEATURE_USERS); |
1,040,697 | private Optional<JsonResponseUpsert> persistForBPartnerWithinTrx(@Nullable final String orgCode, @NonNull final ExternalIdentifier bpartnerIdentifier, @NonNull final JsonRequestContactUpsert jsonContactUpsert, @NonNull final SyncAdvise parentSyncAdvise) {<NEW_LINE>final OrgId orgId = retrieveOrgIdOrDefault(orgCode);<NEW_LINE>final Optional<BPartnerComposite> optBPartnerComposite = jsonRetrieverService.getBPartnerComposite(orgId, bpartnerIdentifier);<NEW_LINE>if (!optBPartnerComposite.isPresent()) {<NEW_LINE>// 404<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>final BPartnerComposite bpartnerComposite = optBPartnerComposite.get();<NEW_LINE>final ShortTermContactIndex shortTermIndex = new ShortTermContactIndex(bpartnerComposite);<NEW_LINE>final SyncAdvise effectiveSyncAdvise = coalesceNotNull(jsonContactUpsert.getSyncAdvise(), parentSyncAdvise);<NEW_LINE>final Map<String, JsonResponseUpsertItemBuilder> identifierToBuilder = new HashMap<>();<NEW_LINE>for (final JsonRequestContactUpsertItem requestItem : jsonContactUpsert.getRequestItems()) {<NEW_LINE>final JsonResponseUpsertItemBuilder responseItemBuilder = syncJsonContact(bpartnerComposite.getOrgId(), requestItem, effectiveSyncAdvise, shortTermIndex);<NEW_LINE>// we don't know the metasfreshId yet, so for now just store what we know into the map<NEW_LINE>identifierToBuilder.put(requestItem.getContactIdentifier(), responseItemBuilder);<NEW_LINE>}<NEW_LINE>bpartnerCompositeRepository.save(bpartnerComposite, true);<NEW_LINE>final <MASK><NEW_LINE>for (final JsonRequestContactUpsertItem requestItem : jsonContactUpsert.getRequestItems()) {<NEW_LINE>final BPartnerContact bpartnerContact = bpartnerComposite.extractContactByHandle(requestItem.getContactIdentifier()).get();<NEW_LINE>final JsonMetasfreshId metasfreshId = JsonMetasfreshId.of(BPartnerContactId.toRepoId(bpartnerContact.getId()));<NEW_LINE>final ExternalIdentifier externalIdentifier = ExternalIdentifier.of(requestItem.getContactIdentifier());<NEW_LINE>handleExternalReference(externalIdentifier, metasfreshId, ExternalUserReferenceType.USER_ID);<NEW_LINE>final JsonResponseUpsertItem responseItem = identifierToBuilder.get(requestItem.getContactIdentifier()).metasfreshId(JsonMetasfreshId.of(BPartnerContactId.toRepoId(bpartnerContact.getId()))).build();<NEW_LINE>response.responseItem(responseItem);<NEW_LINE>}<NEW_LINE>return Optional.of(response.build());<NEW_LINE>} | JsonResponseUpsertBuilder response = JsonResponseUpsert.builder(); |
338,555 | // synchronized for updating job<NEW_LINE>public void rescheduleJob(final JobInstance toBeRescheduled) {<NEW_LINE>final JobIdentifier jobIdentifier = toBeRescheduled.getIdentifier();<NEW_LINE>synchronized (mutexForStageInstance(jobIdentifier)) {<NEW_LINE>synchronized (mutexForJob(jobIdentifier)) {<NEW_LINE>transactionTemplate.execute(new TransactionCallbackWithoutResult() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void doInTransactionWithoutResult(TransactionStatus status) {<NEW_LINE>LOGGER.warn("[Job Reschedule] Rescheduling and marking old job as ignored: {}", toBeRescheduled);<NEW_LINE>// Reloading it because we want to see the latest committed state after acquiring the mutex.<NEW_LINE>JobInstance oldJob = jobInstanceService.buildById(toBeRescheduled.getId());<NEW_LINE>if (oldJob.isCompleted() || oldJob.isRescheduled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JobInstance newJob = oldJob.clone();<NEW_LINE>oldJob.changeState(JobState.Rescheduled);<NEW_LINE>jobInstanceService.updateStateAndResult(oldJob);<NEW_LINE>// Make a new Job<NEW_LINE>newJob.reschedule();<NEW_LINE>jobInstanceService.save(oldJob.getIdentifier().getStageIdentifier(), oldJob.getStageId(), newJob);<NEW_LINE>// Copy the plan for the old job since we don't load job plan with jobInstance by default<NEW_LINE>JobPlan plan = jobInstanceDao.<MASK><NEW_LINE>jobInstanceDao.ignore(oldJob);<NEW_LINE>jobInstanceDao.save(newJob.getId(), plan);<NEW_LINE>LOGGER.info("[Job Reschedule] Scheduled new job: {}. Replacing old job: {}", newJob.getIdentifier(), oldJob.getIdentifier());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | loadPlan(oldJob.getId()); |
87,897 | protected void visit(BeanPropertyVisitor pv, BeanProperty p) {<NEW_LINE>if (p instanceof BeanPropertyAssocMany<?>) {<NEW_LINE>// oneToMany or manyToMany<NEW_LINE>pv.visitMany((BeanPropertyAssocMany<?>) p);<NEW_LINE>} else if (p instanceof BeanPropertyAssocOne<?>) {<NEW_LINE>BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) p;<NEW_LINE>if (assocOne.isEmbedded()) {<NEW_LINE>// Embedded bean<NEW_LINE>pv.visitEmbedded(assocOne);<NEW_LINE>BeanProperty[<MASK><NEW_LINE>for (BeanProperty embProp : embProps) {<NEW_LINE>pv.visitEmbeddedScalar(embProp, assocOne);<NEW_LINE>}<NEW_LINE>} else if (assocOne.isOneToOneExported()) {<NEW_LINE>// associated one exported<NEW_LINE>pv.visitOneExported(assocOne);<NEW_LINE>} else {<NEW_LINE>// associated one imported<NEW_LINE>pv.visitOneImported(assocOne);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// simple scalar type<NEW_LINE>pv.visitScalar(p, true);<NEW_LINE>}<NEW_LINE>} | ] embProps = assocOne.properties(); |
1,762,947 | public static ListFunctionResponse unmarshall(ListFunctionResponse listFunctionResponse, UnmarshallerContext _ctx) {<NEW_LINE>listFunctionResponse.setRequestId(_ctx.stringValue("ListFunctionResponse.RequestId"));<NEW_LINE>listFunctionResponse.setHttpStatusCode(_ctx.stringValue("ListFunctionResponse.HttpStatusCode"));<NEW_LINE>listFunctionResponse.setSuccess(_ctx.booleanValue("ListFunctionResponse.Success"));<NEW_LINE>listFunctionResponse.setCode(_ctx.stringValue("ListFunctionResponse.Code"));<NEW_LINE>listFunctionResponse.setMessage(_ctx.stringValue("ListFunctionResponse.Message"));<NEW_LINE>Paginator paginator = new Paginator();<NEW_LINE>paginator.setPageSize(_ctx.integerValue("ListFunctionResponse.Paginator.PageSize"));<NEW_LINE>paginator.setPageNum(_ctx.integerValue("ListFunctionResponse.Paginator.PageNum"));<NEW_LINE>paginator.setTotal<MASK><NEW_LINE>paginator.setPageCount(_ctx.integerValue("ListFunctionResponse.Paginator.PageCount"));<NEW_LINE>listFunctionResponse.setPaginator(paginator);<NEW_LINE>List<DataListItem> dataList = new ArrayList<DataListItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListFunctionResponse.DataList.Length"); i++) {<NEW_LINE>DataListItem dataListItem = new DataListItem();<NEW_LINE>dataListItem.setName(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].Name"));<NEW_LINE>dataListItem.setDesc(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].Desc"));<NEW_LINE>dataListItem.setCreatedAt(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].CreatedAt"));<NEW_LINE>dataListItem.setModifiedAt(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].ModifiedAt"));<NEW_LINE>Spec spec = new Spec();<NEW_LINE>spec.setRuntime(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].Spec.Runtime"));<NEW_LINE>spec.setMemory(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].Spec.Memory"));<NEW_LINE>spec.setTimeout(_ctx.stringValue("ListFunctionResponse.DataList[" + i + "].Spec.Timeout"));<NEW_LINE>dataListItem.setSpec(spec);<NEW_LINE>dataList.add(dataListItem);<NEW_LINE>}<NEW_LINE>listFunctionResponse.setDataList(dataList);<NEW_LINE>return listFunctionResponse;<NEW_LINE>} | (_ctx.integerValue("ListFunctionResponse.Paginator.Total")); |
680,295 | private void markupDynamicTable(TaskMonitor monitor) {<NEW_LINE>// Assume default space for pointers<NEW_LINE>Address dynamicTableAddress = null;<NEW_LINE>try {<NEW_LINE>ElfDynamicTable dynamicTable = elf.getDynamicTable();<NEW_LINE>if (dynamicTable == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>dynamicTableAddress = findLoadAddress(dynamicTable.getFileOffset(), 1);<NEW_LINE>if (dynamicTableAddress == null) {<NEW_LINE>log("Failed to locate dynamic table at file offset 0x" + Long.toHexString(dynamicTable.getFileOffset()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>createSymbol(dynamicTableAddress, "_DYNAMIC", false, false, null);<NEW_LINE>ElfDynamic[] dynamics = dynamicTable.getDynamics();<NEW_LINE>DataType structArray = dynamicTable.toDataType();<NEW_LINE>Data dynamicTableData = createData(dynamicTableAddress, structArray);<NEW_LINE>if (dynamicTableData == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < dynamics.length; i++) {<NEW_LINE>Data dynamicData = dynamicTableData.getComponent(i);<NEW_LINE>if (dynamicData == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long value = dynamics[i].getValue();<NEW_LINE>int tagType = dynamics[i].getTag();<NEW_LINE>ElfDynamicType <MASK><NEW_LINE>String comment = dynamicType != null ? (dynamicType.name + " - " + dynamicType.description) : ("DT_0x" + StringUtilities.pad(Integer.toHexString(tagType), '0', 8));<NEW_LINE>dynamicData.setComment(CodeUnit.EOL_COMMENT, comment);<NEW_LINE>Data valueData = dynamicData.getComponent(1);<NEW_LINE>if (dynamicType != null) {<NEW_LINE>if (dynamicType.valueType == ElfDynamicValueType.ADDRESS) {<NEW_LINE>addDynamicMemoryReference(dynamics[i], valueData, false, "_" + dynamicType.name);<NEW_LINE>} else if (dynamicType.valueType == ElfDynamicValueType.STRING) {<NEW_LINE>ElfStringTable dynamicStringTable = elf.getDynamicStringTable();<NEW_LINE>if (dynamicStringTable != null) {<NEW_LINE>String str = dynamicStringTable.readString(elf.getReader(), value);<NEW_LINE>if (str != null && str.length() != 0) {<NEW_LINE>valueData.setComment(CodeUnit.EOL_COMMENT, str);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log("Failed to process dynamic section: " + getMessage(e));<NEW_LINE>}<NEW_LINE>} | dynamicType = elf.getDynamicType(tagType); |
722,389 | private boolean sameCommentHandler(TokenHierarchy<?> th, int offset, boolean backwardBias, CommentHandler cH) {<NEW_LINE>CommentHandler cH2 = null;<NEW_LINE>List<TokenSequence<?>> seqs = th.embeddedTokenSequences(offset, backwardBias);<NEW_LINE>if (!seqs.isEmpty()) {<NEW_LINE>for (int i = seqs.size() - 1; i >= 0; i--) {<NEW_LINE>TokenSequence<?> ts = seqs.get(i);<NEW_LINE>Language lang = LanguageRegistry.getInstance().getLanguageByMimeType(ts.<MASK><NEW_LINE>if (lang != null) {<NEW_LINE>if (lang.getGsfLanguage() instanceof DefaultLanguageConfig) {<NEW_LINE>cH2 = ((DefaultLanguageConfig) lang.getGsfLanguage()).getCommentHandler();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return cH2 != null && cH.getClass() == cH2.getClass();<NEW_LINE>} | language().mimeType()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.