idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,391,974 | protected void handleKeyReleased(KeyEvent e) {<NEW_LINE>super.handleKeyReleased(e);<NEW_LINE>// Custom bind support<NEW_LINE>PluginKeybinds.getInstance().getClassViewBinds().forEach((bind, action) -> {<NEW_LINE>try {<NEW_LINE>if (bind.match(e))<NEW_LINE>action.accept(this);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>Log.error(t, "Failed executing class keybind action");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>ConfigManager config = controller.config();<NEW_LINE>if (config.keys().swapview.match(e)) {<NEW_LINE>setOverrideMode(ClassMode.values()[(getClassMode().ordinal() + 1) % ClassMode.values().length]);<NEW_LINE>requestFocus();<NEW_LINE>}<NEW_LINE>if (config.keys().incFontSize.match(e)) {<NEW_LINE>config.display().monoFontSize++;<NEW_LINE>FontSlider.update(controller);<NEW_LINE>config.save();<NEW_LINE>}<NEW_LINE>if (config.keys().decFontSize.match(e)) {<NEW_LINE><MASK><NEW_LINE>FontSlider.update(controller);<NEW_LINE>config.save();<NEW_LINE>}<NEW_LINE>} | config.display().monoFontSize--; |
947,730 | static Shape indexToView(TextLayout textLayout, Rectangle2D textLayoutBounds, int index, Position.Bias bias, int maxIndex, Shape alloc) {<NEW_LINE>if (textLayout == null) {<NEW_LINE>// Leave given bounds<NEW_LINE>return alloc;<NEW_LINE>}<NEW_LINE>assert // NOI18N<NEW_LINE>(maxIndex <= textLayout.getCharacterCount()) : // NOI18N<NEW_LINE>"textLayout.getCharacterCount()=" + textLayout.getCharacterCount() + " < maxIndex=" + maxIndex;<NEW_LINE>// If offset is >getEndOffset() use view-end-offset - otherwise it would throw exception from textLayout.getCaretInfo()<NEW_LINE>int charIndex = Math.min(index, maxIndex);<NEW_LINE>// When e.g. creating fold-preview the offset can be < startOffset<NEW_LINE>charIndex = Math.max(charIndex, 0);<NEW_LINE>TextHitInfo startHit;<NEW_LINE>TextHitInfo endHit;<NEW_LINE>if (bias == Position.Bias.Forward) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>// backward bias<NEW_LINE>startHit = TextHitInfo.trailing(charIndex - 1);<NEW_LINE>}<NEW_LINE>endHit = (charIndex < maxIndex) ? TextHitInfo.trailing(charIndex) : startHit;<NEW_LINE>if (textLayoutBounds == null) {<NEW_LINE>textLayoutBounds = ViewUtils.shapeAsRect(alloc);<NEW_LINE>}<NEW_LINE>return TextLayoutUtils.getRealAlloc(textLayout, textLayoutBounds, startHit, endHit);<NEW_LINE>} | startHit = TextHitInfo.leading(charIndex); |
15,533 | private Shape draw3DColumn(int x, int y, int w, int h, int index, boolean isVertical) {<NEW_LINE>Graphics2D g = e.getGraphics();<NEW_LINE>CartesianCoor cc = (CartesianCoor) getCoor();<NEW_LINE>int coorShift = cc.get3DShift();<NEW_LINE>Color c = borderColor.colorValue(index);<NEW_LINE>int style = borderStyle.intValue(index);<NEW_LINE>float weight = borderWeight.floatValue(index);<NEW_LINE>ChartColor chartColor = fillColor.chartColorValue(index);<NEW_LINE>Utils.draw3DRect(g, x, y, w, h, c, style, weight, shadow, convexEdge, transparent, chartColor, isVertical, coorShift);<NEW_LINE>int[] shapeX = new int[] { x, x + coorShift, x + coorShift + w, x + coorShift + w, x + w, x };<NEW_LINE>int[] shapeY = new int[] { y, y - coorShift, y - coorShift, y - coorShift + h, y + h, y + h };<NEW_LINE>return new java.awt.Polygon(<MASK><NEW_LINE>} | shapeX, shapeY, shapeX.length); |
1,194,499 | public void jsConstructor(final String type, final ScriptableObject details) {<NEW_LINE>super.jsConstructor(ScriptRuntime.toString(type), details);<NEW_LINE>if (details != null && !Undefined.isUndefined(details)) {<NEW_LINE>final Object screenX = details.get("screenX", details);<NEW_LINE>if (NOT_FOUND != screenX) {<NEW_LINE>screenX_ = ScriptRuntime.toInt32(screenX);<NEW_LINE>}<NEW_LINE>final Object screenY = details.get("screenY", details);<NEW_LINE>if (NOT_FOUND != screenX) {<NEW_LINE>screenY_ = ScriptRuntime.toInt32(screenY);<NEW_LINE>}<NEW_LINE>final Object clientX = details.get("clientX", details);<NEW_LINE>if (NOT_FOUND != clientX) {<NEW_LINE>clientX_ = ScriptRuntime.toInt32(clientX);<NEW_LINE>}<NEW_LINE>final Object clientY = <MASK><NEW_LINE>if (NOT_FOUND != clientX) {<NEW_LINE>clientY_ = ScriptRuntime.toInt32(clientY);<NEW_LINE>}<NEW_LINE>final Object button = details.get("button", details);<NEW_LINE>if (NOT_FOUND != button) {<NEW_LINE>button_ = ScriptRuntime.toInt32(button);<NEW_LINE>}<NEW_LINE>final Object buttons = details.get("buttons", details);<NEW_LINE>if (NOT_FOUND != buttons) {<NEW_LINE>buttons_ = ScriptRuntime.toInt32(buttons);<NEW_LINE>}<NEW_LINE>setAltKey(ScriptRuntime.toBoolean(details.get("altKey")));<NEW_LINE>setCtrlKey(ScriptRuntime.toBoolean(details.get("ctrlKey")));<NEW_LINE>setMetaKey(ScriptRuntime.toBoolean(details.get("metaKey")));<NEW_LINE>setShiftKey(ScriptRuntime.toBoolean(details.get("shiftKey")));<NEW_LINE>}<NEW_LINE>} | details.get("clientY", details); |
549,628 | public void run() {<NEW_LINE>try {<NEW_LINE>entry.incrementRunCount();<NEW_LINE>RuntimeEventLog.cron(taskClassName);<NEW_LINE>if (taskClass != null) {<NEW_LINE>Task task = (Task) taskClass.newInstance();<NEW_LINE>logger.debug("Starting task {}", taskClassName);<NEW_LINE>StructrApp.<MASK><NEW_LINE>} else {<NEW_LINE>try (final Tx tx = StructrApp.getInstance().tx()) {<NEW_LINE>// check for schema method with the given name<NEW_LINE>Actions.callAsSuperUser(taskClassName, Collections.EMPTY_MAP);<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (FrameworkException fex) {<NEW_LINE>logger.warn("Exception while executing cron task {}: {}", taskClassName, fex.toString());<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Exception while executing cron task {}: {}", taskClassName, t.getMessage());<NEW_LINE>} finally {<NEW_LINE>entry.decrementRunCount();<NEW_LINE>}<NEW_LINE>} | getInstance().processTasks(task); |
726,808 | private void initDeterministicColumnIndex(ExecutionContext ec) {<NEW_LINE>if (!(RelUtils.getRelInput(this) instanceof LogicalDynamicValues)) {<NEW_LINE>literalColumnIndex = Lists.newArrayList();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Set<String> resultColumnNames = new <MASK><NEW_LINE>final String tableName = targetTableNames.get(0);<NEW_LINE>final OptimizerContext oc = OptimizerContext.getContext(schemaName);<NEW_LINE>assert null != oc;<NEW_LINE>final TableMeta tableMeta = ec.getSchemaManager(schemaName).getTable(tableName);<NEW_LINE>final TddlRuleManager rule = oc.getRuleManager();<NEW_LINE>// Columns in broadcast table<NEW_LINE>if (rule.isBroadCast(tableName)) {<NEW_LINE>tableMeta.getAllColumns().forEach(cm -> resultColumnNames.add(cm.getName()));<NEW_LINE>}<NEW_LINE>// Columns in GSI<NEW_LINE>final List<TableMeta> indexTableMetas = GlobalIndexMeta.getIndex(tableName, schemaName, ec);<NEW_LINE>indexTableMetas.forEach(gsiTm -> gsiTm.getAllColumns().forEach(cm -> resultColumnNames.add(cm.getName())));<NEW_LINE>// Columns in ScaleOut writable table<NEW_LINE>if (ComplexTaskPlanUtils.canWrite(tableMeta)) {<NEW_LINE>tableMeta.getAllColumns().forEach(cm -> resultColumnNames.add(cm.getName()));<NEW_LINE>}<NEW_LINE>// Convert column names to column indexes<NEW_LINE>final List<String> fieldNames = RelUtils.getRelInput(this).getRowType().getFieldNames();<NEW_LINE>final Set<Integer> calcColumnIndexes = new HashSet<>(resultColumnNames.size());<NEW_LINE>for (int i = 0; i < fieldNames.size(); i++) {<NEW_LINE>if (resultColumnNames.contains(fieldNames.get(i))) {<NEW_LINE>calcColumnIndexes.add(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.deterministicColumnIndex = Lists.newArrayList(calcColumnIndexes);<NEW_LINE>} | TreeSet<>(String.CASE_INSENSITIVE_ORDER); |
1,270,190 | public long remove(Nd nd, long address, int index) {<NEW_LINE>int currentSize = size(nd, address);<NEW_LINE>int lastElementIndex = currentSize - 1;<NEW_LINE>Database db = nd.getDB();<NEW_LINE>if (index > lastElementIndex || index < 0) {<NEW_LINE>IndexExceptionBuilder descriptor = nd.describeProblem().addProblemAddress(GROWABLE_BLOCK_ADDRESS, address);<NEW_LINE>addSizeTo(nd, address, descriptor);<NEW_LINE>throw // $NON-NLS-1$<NEW_LINE>descriptor.// $NON-NLS-1$<NEW_LINE>build(// $NON-NLS-1$<NEW_LINE>"Attempt to remove nonexistent element " + index + " from an array of size " + (lastElementIndex + 1));<NEW_LINE>}<NEW_LINE>long toRemoveAddress = getAddressOfRecord(nd, address, index);<NEW_LINE>long returnValue;<NEW_LINE>// If we're removing the last element<NEW_LINE>if (index == lastElementIndex) {<NEW_LINE>returnValue = 0;<NEW_LINE>// Clear out the removed element<NEW_LINE>db.putRecPtr(toRemoveAddress, 0);<NEW_LINE>} else {<NEW_LINE>long lastElementAddress = getAddressOfRecord(nd, address, lastElementIndex);<NEW_LINE>long lastElementValue = db.getRecPtr(lastElementAddress);<NEW_LINE>// Move the last element into the position occupied by the element being removed (this is a noop if<NEW_LINE>// removing the last element)<NEW_LINE>db.putRecPtr(toRemoveAddress, lastElementValue);<NEW_LINE>// Clear out the last element<NEW_LINE>db.putRecPtr(lastElementAddress, 0);<NEW_LINE>returnValue = lastElementValue;<NEW_LINE>}<NEW_LINE>// Update the array size<NEW_LINE>setSize(<MASK><NEW_LINE>repackIfNecessary(nd, address, currentSize);<NEW_LINE>return returnValue;<NEW_LINE>} | nd, address, currentSize - 1); |
231,911 | private boolean init() {<NEW_LINE>Properties properties = new Properties();<NEW_LINE>try {<NEW_LINE>// properties.load(new FileInputStream("StringExtract.properties"));<NEW_LINE>InputStream inputStream = StringExtract.class.getResourceAsStream(PROPERTY_FILE);<NEW_LINE>properties.load(inputStream);<NEW_LINE>String table = properties.getProperty("UnicodeTable");<NEW_LINE>StringTokenizer st = new StringTokenizer(table, " ");<NEW_LINE>int toks = st.countTokens();<NEW_LINE>// logger.log(Level.INFO, "TABLE TOKS: " + toks);<NEW_LINE>if (toks != UNICODE_TABLE_SIZE) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.WARNING, "Unicode table corrupt, expecting: " + UNICODE_TABLE_SIZE, ", have: " + toks);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int tableIndex = 0;<NEW_LINE>while (st.hasMoreTokens()) {<NEW_LINE>String tok = st.nextToken();<NEW_LINE>char code = (<MASK><NEW_LINE>UNICODE_TABLE[tableIndex++] = code;<NEW_LINE>}<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.INFO, "initialized, unicode table loaded");<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.WARNING, "Could not load" + PROPERTY_FILE);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | char) Integer.parseInt(tok); |
1,341,027 | public void run() {<NEW_LINE>if (isStopped) {<NEW_LINE>log.info("Janitor was requested to stop");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Iterator<PaymentAttemptModelDao> iterator = getItemsForIteration().iterator();<NEW_LINE>try {<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>final <MASK><NEW_LINE>if (isStopped) {<NEW_LINE>log.info("Janitor was requested to stop");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// isApiPayment=false might not always be correct here: a payment with control plugin<NEW_LINE>// might have been triggered from the API and crashed in an INIT state, which the loop<NEW_LINE>// would attempt to fix here. But this is really an edge case.<NEW_LINE>doIteration(item, false);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>log.warn("Exception during Janitor loop", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>// In case the loop stops early, make sure to close the underlying DB connection<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>iterator.next();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | PaymentAttemptModelDao item = iterator.next(); |
334,212 | private void initAssets() {<NEW_LINE>ModuleEnvironment environment = context.get(ModuleManager.class).getEnvironment();<NEW_LINE>BlockFamilyLibrary library <MASK><NEW_LINE>// cast lambdas explicitly to avoid inconsistent compiler behavior wrt. type inference<NEW_LINE>assetTypeManager.createAssetType(Prefab.class, PojoPrefab::new, "prefabs");<NEW_LINE>assetTypeManager.createAssetType(BlockShape.class, BlockShapeImpl::new, "shapes");<NEW_LINE>assetTypeManager.createAssetType(BlockSounds.class, BlockSounds::new, "blockSounds");<NEW_LINE>assetTypeManager.createAssetType(BlockTile.class, BlockTile::new, "blockTiles");<NEW_LINE>AssetType<BlockFamilyDefinition, BlockFamilyDefinitionData> blockFamilyDefinitionDataAssetType = assetTypeManager.createAssetType(BlockFamilyDefinition.class, BlockFamilyDefinition::new, "blocks");<NEW_LINE>assetTypeManager.getAssetFileDataProducer(blockFamilyDefinitionDataAssetType).addAssetFormat(new BlockFamilyDefinitionFormat(assetTypeManager.getAssetManager()));<NEW_LINE>assetTypeManager.createAssetType(UISkinAsset.class, UISkinAsset::new, "skins");<NEW_LINE>assetTypeManager.createAssetType(BehaviorTree.class, BehaviorTree::new, "behaviors");<NEW_LINE>assetTypeManager.createAssetType(UIElement.class, UIElement::new, "ui");<NEW_LINE>} | = new BlockFamilyLibrary(environment, context); |
1,079,232 | private void process(final JobConfiguration jobConfig, final ShardingContexts shardingContexts, final ExecutionSource executionSource) {<NEW_LINE>Collection<Integer> items = shardingContexts.getShardingItemParameters().keySet();<NEW_LINE>if (1 == items.size()) {<NEW_LINE>int item = shardingContexts.getShardingItemParameters().keySet().iterator().next();<NEW_LINE>JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(IpUtils.getHostName(), IpUtils.getIp(), shardingContexts.getTaskId(), jobConfig.getJobName(), executionSource, item);<NEW_LINE>process(jobConfig, shardingContexts, item, jobExecutionEvent);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CountDownLatch latch = new CountDownLatch(items.size());<NEW_LINE>for (int each : items) {<NEW_LINE>JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(IpUtils.getHostName(), IpUtils.getIp(), shardingContexts.getTaskId(), jobConfig.getJobName(), executionSource, each);<NEW_LINE>ExecutorService executorService = executorContext.get(ExecutorService.class);<NEW_LINE>if (executorService.isShutdown()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>executorService.submit(() -> {<NEW_LINE>try {<NEW_LINE>process(<MASK><NEW_LINE>} finally {<NEW_LINE>latch.countDown();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>latch.await();<NEW_LINE>} catch (final InterruptedException ex) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>} | jobConfig, shardingContexts, each, jobExecutionEvent); |
1,603,874 | private Wo executeCommand(String ctl, String nodeName, Integer nodePort, String fileName) {<NEW_LINE>// TODO Auto-generated method stub<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setNode(nodeName);<NEW_LINE>wo.setStatus("success");<NEW_LINE>try (Socket socket = new Socket(nodeName, nodePort)) {<NEW_LINE>socket.setKeepAlive(true);<NEW_LINE>socket.setSoTimeout(5000);<NEW_LINE>DataOutputStream dos = null;<NEW_LINE>DataInputStream dis = null;<NEW_LINE>try {<NEW_LINE>dos = new DataOutputStream(socket.getOutputStream());<NEW_LINE>dis = new <MASK><NEW_LINE>Map<String, Object> commandObject = new HashMap<>();<NEW_LINE>commandObject.put("command", "uninstall:" + ctl);<NEW_LINE>commandObject.put("credential", Crypto.rsaEncrypt("o2@", Config.publicKey()));<NEW_LINE>dos.writeUTF(XGsonBuilder.toJson(commandObject));<NEW_LINE>dos.flush();<NEW_LINE>dos.writeUTF(fileName);<NEW_LINE>dos.flush();<NEW_LINE>} finally {<NEW_LINE>dos.close();<NEW_LINE>dis.close();<NEW_LINE>socket.close();<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>wo.setStatus("fail");<NEW_LINE>}<NEW_LINE>SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");<NEW_LINE>wo.setTime(df.format(new Date()));<NEW_LINE>return wo;<NEW_LINE>} | DataInputStream(socket.getInputStream()); |
1,844,282 | private Addon fromAddonEntry(AddonEntryDTO addonEntry) {<NEW_LINE>String fullId = ADDON_ID_PREFIX + addonEntry.id;<NEW_LINE>boolean installed = addonHandlers.stream().anyMatch(handler -> handler.supports(addonEntry.type, addonEntry.contentType) && handler.isInstalled(fullId));<NEW_LINE>Map<String, Object> properties = new HashMap<>();<NEW_LINE>if (addonEntry.url.endsWith(".jar")) {<NEW_LINE>properties.put("jar_download_url", addonEntry.url);<NEW_LINE>} else if (addonEntry.url.endsWith(".kar")) {<NEW_LINE>properties.put("kar_download_url", addonEntry.url);<NEW_LINE>} else if (addonEntry.url.endsWith(".json")) {<NEW_LINE>properties.put("json_download_url", addonEntry.url);<NEW_LINE>} else if (addonEntry.url.endsWith(".yaml")) {<NEW_LINE>properties.put("yaml_download_url", addonEntry.url);<NEW_LINE>}<NEW_LINE>boolean compatible = true;<NEW_LINE>try {<NEW_LINE>compatible = <MASK><NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>logger.debug("Failed to determine compatibility for addon {}: {}", addonEntry.id, e.getMessage());<NEW_LINE>}<NEW_LINE>return Addon.create(fullId).withType(addonEntry.type).withInstalled(installed).withDetailedDescription(addonEntry.description).withContentType(addonEntry.contentType).withAuthor(addonEntry.author).withVersion(addonEntry.version).withLabel(addonEntry.title).withCompatible(compatible).withMaturity(addonEntry.maturity).withProperties(properties).withLink(addonEntry.link).withImageLink(addonEntry.imageUrl).withConfigDescriptionURI(addonEntry.configDescriptionURI).withLoggerPackages(addonEntry.loggerPackages).build();<NEW_LINE>} | coreVersion.inRange(addonEntry.compatibleVersions); |
1,323,567 | private void init(Context context, AttributeSet attrs) {<NEW_LINE>if (attrs != null) {<NEW_LINE>TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MockView);<NEW_LINE>final int count = a.getIndexCount();<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>int attr = a.getIndex(i);<NEW_LINE>if (attr == R.styleable.MockView_mock_label) {<NEW_LINE>mText = a.getString(attr);<NEW_LINE>} else if (attr == R.styleable.MockView_mock_showDiagonals) {<NEW_LINE>mDrawDiagonals = a.getBoolean(attr, mDrawDiagonals);<NEW_LINE>} else if (attr == R.styleable.MockView_mock_diagonalsColor) {<NEW_LINE>mDiagonalsColor = <MASK><NEW_LINE>} else if (attr == R.styleable.MockView_mock_labelBackgroundColor) {<NEW_LINE>mTextBackgroundColor = a.getColor(attr, mTextBackgroundColor);<NEW_LINE>} else if (attr == R.styleable.MockView_mock_labelColor) {<NEW_LINE>mTextColor = a.getColor(attr, mTextColor);<NEW_LINE>} else if (attr == R.styleable.MockView_mock_showLabel) {<NEW_LINE>mDrawLabel = a.getBoolean(attr, mDrawLabel);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>a.recycle();<NEW_LINE>}<NEW_LINE>if (mText == null) {<NEW_LINE>try {<NEW_LINE>mText = context.getResources().getResourceEntryName(getId());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mPaintDiagonals.setColor(mDiagonalsColor);<NEW_LINE>mPaintDiagonals.setAntiAlias(true);<NEW_LINE>mPaintText.setColor(mTextColor);<NEW_LINE>mPaintText.setAntiAlias(true);<NEW_LINE>mPaintTextBackground.setColor(mTextBackgroundColor);<NEW_LINE>mMargin = Math.round(mMargin * (getResources().getDisplayMetrics().xdpi / DisplayMetrics.DENSITY_DEFAULT));<NEW_LINE>} | a.getColor(attr, mDiagonalsColor); |
240,288 | private void loadNode742() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.ProgramStateMachineType_Running_StateNumber, new QualifiedName(0, "StateNumber"), new LocalizedText("en", "StateNumber"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.UInt32, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running_StateNumber, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running_StateNumber, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running_StateNumber, Identifiers.HasProperty, Identifiers.ProgramStateMachineType_Running.expanded(), false));<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<UInt32 xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\">2</UInt32>");<NEW_LINE>String xml = sb.toString();<NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));<NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new <MASK><NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | DataValue(new Variant(o)); |
1,693,284 | public <T, R extends ApiResponse<T>> PendingResult<T> handlePost(String hostName, String url, String payload, Map<String, String> headers, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry, RequestMetrics metrics) {<NEW_LINE>FetchOptions fetchOptions = FetchOptions.Builder.withDeadline(10);<NEW_LINE>final HTTPRequest req;<NEW_LINE>try {<NEW_LINE>req = new HTTPRequest(new URL(hostName + url), HTTPMethod.POST, fetchOptions);<NEW_LINE>req.setHeader(new HTTPHeader("Content-Type", "application/json; charset=utf-8"));<NEW_LINE>headers.forEach((k, v) -> {<NEW_LINE>req.addHeader(<MASK><NEW_LINE>});<NEW_LINE>req.setPayload(payload.getBytes(UTF_8));<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>LOG.error("Request: {}{}", hostName, url, e);<NEW_LINE>throw (new RuntimeException(e));<NEW_LINE>}<NEW_LINE>return new GaePendingResult<>(req, client, clazz, fieldNamingPolicy, errorTimeout, maxRetries, exceptionsAllowedToRetry, metrics);<NEW_LINE>} | new HTTPHeader(k, v)); |
1,656,624 | static TBigInteger finalSubtraction(int[] res, TBigInteger modulus) {<NEW_LINE>// skipping leading zeros<NEW_LINE>int modulusLen = modulus.numberLength;<NEW_LINE>boolean doSub = res[modulusLen] != 0;<NEW_LINE>if (!doSub) {<NEW_LINE><MASK><NEW_LINE>doSub = true;<NEW_LINE>for (int i = modulusLen - 1; i >= 0; i--) {<NEW_LINE>if (res[i] != modulusDigits[i]) {<NEW_LINE>doSub = (res[i] != 0) && ((res[i] & 0xFFFFFFFFL) > (modulusDigits[i] & 0xFFFFFFFFL));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TBigInteger result = new TBigInteger(1, modulusLen + 1, res);<NEW_LINE>// if (res >= modulusDigits) compute (res - modulusDigits)<NEW_LINE>if (doSub) {<NEW_LINE>TElementary.inplaceSubtract(result, modulus);<NEW_LINE>}<NEW_LINE>result.cutOffLeadingZeroes();<NEW_LINE>return result;<NEW_LINE>} | int[] modulusDigits = modulus.digits; |
1,140,849 | public static DescribeAlarmEventDetailResponse unmarshall(DescribeAlarmEventDetailResponse describeAlarmEventDetailResponse, UnmarshallerContext context) {<NEW_LINE>describeAlarmEventDetailResponse.setRequestId(context.stringValue("DescribeAlarmEventDetailResponse.RequestId"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setInternetIp(context.stringValue("DescribeAlarmEventDetailResponse.Data.InternetIp"));<NEW_LINE>data.setLevel(context.stringValue("DescribeAlarmEventDetailResponse.Data.Level"));<NEW_LINE>data.setInstanceName(context.stringValue("DescribeAlarmEventDetailResponse.Data.InstanceName"));<NEW_LINE>data.setAlarmEventAliasName(context.stringValue("DescribeAlarmEventDetailResponse.Data.AlarmEventAliasName"));<NEW_LINE>data.setType(context.stringValue("DescribeAlarmEventDetailResponse.Data.Type"));<NEW_LINE>data.setUuid(context.stringValue("DescribeAlarmEventDetailResponse.Data.Uuid"));<NEW_LINE>data.setSolution(context.stringValue("DescribeAlarmEventDetailResponse.Data.Solution"));<NEW_LINE>data.setStartTime(context.longValue("DescribeAlarmEventDetailResponse.Data.StartTime"));<NEW_LINE>data.setEndTime(context.longValue("DescribeAlarmEventDetailResponse.Data.EndTime"));<NEW_LINE>data.setAlarmEventDesc(context.stringValue("DescribeAlarmEventDetailResponse.Data.AlarmEventDesc"));<NEW_LINE>data.setIntranetIp(context.stringValue("DescribeAlarmEventDetailResponse.Data.IntranetIp"));<NEW_LINE>data.setCanBeDealOnLine(context.booleanValue("DescribeAlarmEventDetailResponse.Data.CanBeDealOnLine"));<NEW_LINE>data.setAlarmUniqueInfo(context.stringValue("DescribeAlarmEventDetailResponse.Data.AlarmUniqueInfo"));<NEW_LINE>data.setDataSource(context.stringValue("DescribeAlarmEventDetailResponse.Data.DataSource"));<NEW_LINE>data.setCanCancelFault(context.booleanValue("DescribeAlarmEventDetailResponse.Data.CanCancelFault"));<NEW_LINE>data.setHasTraceInfo(context.booleanValue("DescribeAlarmEventDetailResponse.Data.HasTraceInfo"));<NEW_LINE>List<CauseDetail> causeDetails = new ArrayList<CauseDetail>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeAlarmEventDetailResponse.Data.CauseDetails.Length"); i++) {<NEW_LINE>CauseDetail causeDetail = new CauseDetail();<NEW_LINE>causeDetail.setKey(context.stringValue("DescribeAlarmEventDetailResponse.Data.CauseDetails[" + i + "].Key"));<NEW_LINE>List<ValueItem> value <MASK><NEW_LINE>for (int j = 0; j < context.lengthValue("DescribeAlarmEventDetailResponse.Data.CauseDetails[" + i + "].Value.Length"); j++) {<NEW_LINE>ValueItem valueItem = new ValueItem();<NEW_LINE>valueItem.setName(context.stringValue("DescribeAlarmEventDetailResponse.Data.CauseDetails[" + i + "].Value[" + j + "].Name"));<NEW_LINE>valueItem.setType(context.stringValue("DescribeAlarmEventDetailResponse.Data.CauseDetails[" + i + "].Value[" + j + "].Type"));<NEW_LINE>valueItem.setValue(context.stringValue("DescribeAlarmEventDetailResponse.Data.CauseDetails[" + i + "].Value[" + j + "].Value"));<NEW_LINE>value.add(valueItem);<NEW_LINE>}<NEW_LINE>causeDetail.setValue(value);<NEW_LINE>causeDetails.add(causeDetail);<NEW_LINE>}<NEW_LINE>data.setCauseDetails(causeDetails);<NEW_LINE>describeAlarmEventDetailResponse.setData(data);<NEW_LINE>return describeAlarmEventDetailResponse;<NEW_LINE>} | = new ArrayList<ValueItem>(); |
264,636 | public void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_slidetonavigation);<NEW_LINE>// Set a Toolbar to replace the ActionBar.<NEW_LINE>Toolbar toolbar = <MASK><NEW_LINE>setSupportActionBar(toolbar);<NEW_LINE>getSupportActionBar().setDisplayHomeAsUpEnabled(true);<NEW_LINE>toolbar.setNavigationOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>int mode = getIntent().getExtras().getInt(EXTRA_MODE);<NEW_LINE>NavDirections action = null;<NEW_LINE>switch(mode) {<NEW_LINE>case EXTRA_USER_SETTING_MODE:<NEW_LINE>action = SlideNavigationDirections.actionNavSlideNavigationToNavUsersettings();<NEW_LINE>setTitle(R.string.label_add_user);<NEW_LINE>break;<NEW_LINE>case EXTRA_BLUETOOTH_SETTING_MODE:<NEW_LINE>action = SlideNavigationDirections.actionNavSlideNavigationToNavBluetoothsettings();<NEW_LINE>setTitle(R.string.label_bluetooth_title);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (action != null) {<NEW_LINE>Navigation.findNavController(this, R.id.nav_slide_navigation).navigate(action);<NEW_LINE>}<NEW_LINE>} | findViewById(R.id.toolbar); |
1,277,241 | public void handleRequest(HttpServerExchange exchange) throws Exception {<NEW_LINE>int queries = Helper.getQueries(exchange);<NEW_LINE>World[] worlds = new World[queries];<NEW_LINE>try (Connection connection = ds.getConnection()) {<NEW_LINE>try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM World WHERE id = ?")) {<NEW_LINE>for (int i = 0; i < worlds.length; i++) {<NEW_LINE>statement.setInt(1, randomWorld());<NEW_LINE>try (ResultSet resultSet = statement.executeQuery()) {<NEW_LINE>resultSet.next();<NEW_LINE>int id = resultSet.getInt("id");<NEW_LINE>int randomNumber = resultSet.getInt("randomNumber");<NEW_LINE>worlds[i] = new World(id, randomNumber);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try (PreparedStatement statement = connection.prepareStatement("UPDATE World SET randomNumber = ? WHERE id = ?")) {<NEW_LINE>for (World world : worlds) {<NEW_LINE>world.randomNumber = randomWorld();<NEW_LINE>statement.setInt(1, world.randomNumber);<NEW_LINE>statement.setInt(2, world.id);<NEW_LINE>statement.executeUpdate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.reset();<NEW_LINE>writer.serialize(worlds);<NEW_LINE>exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/json");<NEW_LINE>exchange.getResponseSender().send(ByteBuffer.wrap<MASK><NEW_LINE>} | (writer.toByteArray())); |
1,643,371 | private void replaceFilesSet(FilesSet oldSet, FilesSet newSet, Map<String, FilesSet.Rule> rules) {<NEW_LINE>if (oldSet != null) {<NEW_LINE>// Remove the set to be replaced from the working copy if the files<NEW_LINE>// set definitions.<NEW_LINE>this.filesSets.remove(oldSet.getName());<NEW_LINE>}<NEW_LINE>FilesSet setToAdd = newSet;<NEW_LINE>// Make the new/edited set definition and add it to the working copy of<NEW_LINE>// the files set definitions.<NEW_LINE>if (rules != null) {<NEW_LINE>setToAdd = new FilesSet(newSet.getName(), newSet.getDescription(), newSet.ignoresKnownFiles(), newSet.ingoresUnallocatedSpace(), rules, newSet.isStandardSet(), newSet.getVersionNumber());<NEW_LINE>}<NEW_LINE>this.filesSets.put(setToAdd.getName(), setToAdd);<NEW_LINE>// Redo the list model for the files set list component, which will make<NEW_LINE>// everything stays sorted as in the working copy tree set.<NEW_LINE>FilesSetDefsPanel.this.setsListModel.clear();<NEW_LINE>this.filesSets.values().forEach((set) -> {<NEW_LINE><MASK><NEW_LINE>});<NEW_LINE>// Select the new/edited files set definition in the set definitions<NEW_LINE>// list. This will cause the selection listeners to repopulate the<NEW_LINE>// subordinate components.<NEW_LINE>this.setsList.setSelectedValue(setToAdd, true);<NEW_LINE>} | this.setsListModel.addElement(set); |
1,694,902 | public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException {<NEW_LINE>int index = getViewIndex(pos, b);<NEW_LINE>if (index >= 0) {<NEW_LINE>Shape ca = getChildAllocation(index, a);<NEW_LINE>// forward to the child view<NEW_LINE>ViewLayoutState child = getChild(index);<NEW_LINE><MASK><NEW_LINE>return cv.modelToView(pos, ca, b);<NEW_LINE>} else {<NEW_LINE>Document doc = getDocument();<NEW_LINE>int docLen = (doc != null) ? doc.getLength() : -1;<NEW_LINE>throw new // NOI18N<NEW_LINE>BadLocationException(// NOI18N<NEW_LINE>"Offset " + pos + " with bias " + b + " is outside of the view" + ", children = " + getViewCount() + (// NOI18N<NEW_LINE>getViewCount() > 0 ? // NOI18N<NEW_LINE>" covering offsets <" + getView(0).getStartOffset() + ", " + getView(getViewCount() - 1).getEndOffset() + // NOI18N<NEW_LINE>">" : "") + ", docLen=" + docLen, pos);<NEW_LINE>}<NEW_LINE>} | View cv = child.getView(); |
1,062,293 | final UpdateUserPoolDomainResult executeUpdateUserPoolDomain(UpdateUserPoolDomainRequest updateUserPoolDomainRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateUserPoolDomainRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateUserPoolDomainRequest> request = null;<NEW_LINE>Response<UpdateUserPoolDomainResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateUserPoolDomainRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateUserPoolDomainRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Cognito Identity Provider");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateUserPoolDomain");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateUserPoolDomainResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateUserPoolDomainResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,409,840 | private Mono<Response<CredentialResultsInner>> listClusterAdminCredentialsWithResponseAsync(String resourceGroupName, String resourceName, String serverFqdn, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2022-03-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = <MASK><NEW_LINE>return service.listClusterAdminCredentials(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, resourceName, serverFqdn, accept, context);<NEW_LINE>} | this.client.mergeContext(context); |
1,755,319 | public List<ReportReloadEntity> loadReport(long time) {<NEW_LINE>List<ReportReloadEntity> results = new ArrayList<ReportReloadEntity>();<NEW_LINE>Map<String, List<DependencyReport>> mergedReports = new HashMap<String, List<DependencyReport>>();<NEW_LINE>for (int i = 0; i < getAnalyzerCount(); i++) {<NEW_LINE>Map<String, DependencyReport> reports = m_reportManager.loadLocalReports(time, i);<NEW_LINE>for (Entry<String, DependencyReport> entry : reports.entrySet()) {<NEW_LINE>String domain = entry.getKey();<NEW_LINE>DependencyReport r = entry.getValue();<NEW_LINE>List<DependencyReport> rs = mergedReports.get(domain);<NEW_LINE>if (rs == null) {<NEW_LINE>rs = new ArrayList<DependencyReport>();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>rs.add(r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<DependencyReport> reports = buildMergedReports(mergedReports);<NEW_LINE>for (DependencyReport r : reports) {<NEW_LINE>HourlyReport report = new HourlyReport();<NEW_LINE>report.setCreationDate(new Date());<NEW_LINE>report.setDomain(r.getDomain());<NEW_LINE>report.setIp(NetworkInterfaceManager.INSTANCE.getLocalHostAddress());<NEW_LINE>report.setName(getId());<NEW_LINE>report.setPeriod(new Date(time));<NEW_LINE>report.setType(1);<NEW_LINE>byte[] content = DefaultNativeBuilder.build(r);<NEW_LINE>ReportReloadEntity entity = new ReportReloadEntity(report, content);<NEW_LINE>results.add(entity);<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | mergedReports.put(domain, rs); |
1,064,307 | public static boolean runSample(AzureResourceManager azureResourceManager) {<NEW_LINE>final String docDBName = Utils.<MASK><NEW_LINE>final String rgName = Utils.randomResourceName(azureResourceManager, "rgNEMV", 24);<NEW_LINE>try {<NEW_LINE>// ============================================================<NEW_LINE>// Create a CosmosDB<NEW_LINE>System.out.println("Creating a CosmosDB...");<NEW_LINE>CosmosDBAccount cosmosDBAccount = azureResourceManager.cosmosDBAccounts().define(docDBName).withRegion(Region.US_EAST).withNewResourceGroup(rgName).withKind(DatabaseAccountKind.GLOBAL_DOCUMENT_DB).withSessionConsistency().withWriteReplication(Region.US_WEST).withReadReplication(Region.US_CENTRAL).withIpRules(Arrays.asList(new IpAddressOrRange().withIpAddressOrRange("13.91.6.132"), new IpAddressOrRange().withIpAddressOrRange("13.91.6.1/24"))).create();<NEW_LINE>System.out.println("Created CosmosDB");<NEW_LINE>Utils.print(cosmosDBAccount);<NEW_LINE>// ============================================================<NEW_LINE>// Delete CosmosDB<NEW_LINE>System.out.println("Deleting the CosmosDB");<NEW_LINE>// work around CosmosDB service issue returning 404 ManagementException on delete operation<NEW_LINE>try {<NEW_LINE>azureResourceManager.cosmosDBAccounts().deleteById(cosmosDBAccount.id());<NEW_LINE>} catch (ManagementException e) {<NEW_LINE>}<NEW_LINE>System.out.println("Deleted the CosmosDB");<NEW_LINE>return true;<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>System.out.println("Deleting resource group: " + rgName);<NEW_LINE>azureResourceManager.resourceGroups().beginDeleteByName(rgName);<NEW_LINE>System.out.println("Deleted resource group: " + rgName);<NEW_LINE>} catch (NullPointerException npe) {<NEW_LINE>System.out.println("Did not create any resources in Azure. No clean up is necessary");<NEW_LINE>} catch (Exception g) {<NEW_LINE>g.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | randomResourceName(azureResourceManager, "docDb", 10); |
979,303 | public ListProjectsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListProjectsResult listProjectsResult = new ListProjectsResult();<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 listProjectsResult;<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("projects", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listProjectsResult.setProjects(new ListUnmarshaller<Project>(ProjectJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listProjectsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listProjectsResult;<NEW_LINE>} | )).unmarshall(context)); |
850,625 | public void paint(Graphics g, Component c) {<NEW_LINE><MASK><NEW_LINE>int y = c.getY();<NEW_LINE>int width = c.getWidth();<NEW_LINE>int height = c.getHeight();<NEW_LINE>if (outerBorder != null) {<NEW_LINE>int ac;<NEW_LINE>if (millimeters) {<NEW_LINE>ac = Display.getInstance().convertToPixels(thickness);<NEW_LINE>} else {<NEW_LINE>ac = (int) thickness;<NEW_LINE>}<NEW_LINE>if (paintOuterBorderFirst) {<NEW_LINE>outerBorder.paint(g, x, y, width, height, c);<NEW_LINE>paint(g, x + ac, y + ac, width - ac * 2, height - ac * 2, c);<NEW_LINE>} else {<NEW_LINE>paint(g, x + ac, y + ac, width - ac * 2, height - ac * 2, c);<NEW_LINE>outerBorder.paint(g, x, y, width, height, c);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>paint(g, x, y, width, height, c);<NEW_LINE>}<NEW_LINE>} | int x = c.getX(); |
1,463,185 | private void loadNode533() {<NEW_LINE>ServerDiagnosticsSummaryTypeNode node = new ServerDiagnosticsSummaryTypeNode(this.context, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, new QualifiedName(0, "ServerDiagnosticsSummary"), new LocalizedText("en", "ServerDiagnosticsSummary"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.ServerDiagnosticsSummaryDataType, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_ServerViewCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_CurrentSessionCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_CumulatedSessionCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_SecurityRejectedSessionCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_RejectedSessionCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_SessionTimeoutCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_SessionAbortCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_PublishingIntervalCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_CurrentSubscriptionCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_CumulatedSubscriptionCount<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_SecurityRejectedRequestsCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary_RejectedRequestsCount.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasTypeDefinition, Identifiers.ServerDiagnosticsSummaryType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerDiagnosticsType_ServerDiagnosticsSummary, Identifiers.HasComponent, Identifiers.ServerDiagnosticsType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
1,320,536 | public com.amazonaws.services.codepipeline.model.ValidationException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.codepipeline.model.ValidationException validationException = new com.amazonaws.services.codepipeline.model.ValidationException(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 validationException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
799,515 | private static AnomalyDetector buildAnomalyModel(TimeSeries ts, Properties config) {<NEW_LINE>AnomalyDetector ad = null;<NEW_LINE>try {<NEW_LINE>Long period = (long) -1;<NEW_LINE>if (config.getProperty("PERIOD") != null) {<NEW_LINE>period = new Long(config.getProperty("PERIOD"));<NEW_LINE>}<NEW_LINE>if (period == 0) {<NEW_LINE>if (ts.size() > 1) {<NEW_LINE>period = ts.data.get(1).time - ts.data.get(0).time;<NEW_LINE>} else {<NEW_LINE>period = (long) 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ad = new AnomalyDetector(ts, period);<NEW_LINE>String modelType = config.getProperty("AD_MODEL");<NEW_LINE>Class<?> tsModelClass = Class.forName("com.yahoo.egads.models.adm." + modelType);<NEW_LINE>Constructor<?> constructor = <MASK><NEW_LINE>ad.addModel((AnomalyDetectionAbstractModel) constructor.newInstance(config));<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return ad;<NEW_LINE>} | tsModelClass.getConstructor(Properties.class); |
65,371 | public Source source(String filename) {<NEW_LINE>return sources.computeIfAbsent(filename, f -> {<NEW_LINE>Set<String> skip = Stream.of("target", "bin", "build", "tmp", "temp", "node_modules", "node").<MASK><NEW_LINE>try {<NEW_LINE>List<String> files = Arrays.asList(filename, filename.replace(".", File.separator) + ".java", filename.replace(".", File.separator) + ".kt", filename.replace(".", File.separator) + "Kt.kt");<NEW_LINE>List<Path> source = new ArrayList<>();<NEW_LINE>source.add(Paths.get(filename));<NEW_LINE>log.debug("scanning {}", basedir);<NEW_LINE>Files.walkFileTree(basedir, new SimpleFileVisitor<Path>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException {<NEW_LINE>String dirName = dir.getFileName().toString();<NEW_LINE>if (Files.isHidden(dir) || dirName.startsWith(".")) {<NEW_LINE>log.debug("skipping hidden directory: {}", dir);<NEW_LINE>return FileVisitResult.SKIP_SUBTREE;<NEW_LINE>}<NEW_LINE>if (skip.contains(dirName)) {<NEW_LINE>log.debug("skipping binary directory: {}", dir);<NEW_LINE>return FileVisitResult.SKIP_SUBTREE;<NEW_LINE>}<NEW_LINE>log.debug("found directory: {}", dir);<NEW_LINE>return FileVisitResult.CONTINUE;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) {<NEW_LINE>return files.stream().filter(f -> file.toString().endsWith(f)).findFirst().map(f -> {<NEW_LINE>source.add(0, file.toAbsolutePath());<NEW_LINE>return FileVisitResult.TERMINATE;<NEW_LINE>}).orElse(FileVisitResult.CONTINUE);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return new Source(source.get(0));<NEW_LINE>} catch (IOException x) {<NEW_LINE>return new Source(Paths.get(filename));<NEW_LINE>} finally {<NEW_LINE>log.debug("done scanning {}", basedir);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | collect(Collectors.toSet()); |
1,722,481 | public static void main(String[] args) throws Exception {<NEW_LINE>TopologyBuilder builder = new TopologyBuilder();<NEW_LINE>// Set rate limit to 1000 bytes per second (since parallelism is set to 2,<NEW_LINE>builder.setSpout("word", new TestWordSpout(), 2).// each instance is rate limited as 500 bps).<NEW_LINE>addConfiguration(Config.TOPOLOGY_COMPONENT_OUTPUT_BPS, 1000);<NEW_LINE>builder.setBolt("exclaim1", new ExclamationBolt(), 2).shuffleGrouping("word");<NEW_LINE>Config conf = new Config();<NEW_LINE>conf.setDebug(true);<NEW_LINE>conf.setMaxSpoutPending(10);<NEW_LINE>// component resource configuration<NEW_LINE>conf.setComponentCpu("word", 0.5);<NEW_LINE>conf.setComponentRam("word", ByteAmount.fromMegabytes(512));<NEW_LINE>conf.setComponentDisk("word", ByteAmount.fromMegabytes(512));<NEW_LINE>conf.setComponentCpu("exclaim1", 0.5);<NEW_LINE>conf.setComponentRam("exclaim1", ByteAmount.fromMegabytes(512));<NEW_LINE>conf.setComponentDisk("exclaim1", ByteAmount.fromMegabytes(512));<NEW_LINE>// container resource configuration<NEW_LINE>conf.setContainerDiskRequested(ByteAmount.fromGigabytes(2));<NEW_LINE>conf.setContainerRamRequested(ByteAmount.fromGigabytes(3));<NEW_LINE>conf.setContainerCpuRequested(2);<NEW_LINE>// Specify the size of RAM padding to per container.<NEW_LINE>// Notice, this config will be considered as a hint,<NEW_LINE>// and it's up to the packing algorithm to determine whether to apply this hint<NEW_LINE>conf.setContainerRamPadding(ByteAmount.fromGigabytes(2));<NEW_LINE>if (args != null && args.length > 0) {<NEW_LINE>conf.setNumStmgrs(2);<NEW_LINE>HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());<NEW_LINE>} else {<NEW_LINE>Simulator simulator = new Simulator();<NEW_LINE>simulator.submitTopology("test", <MASK><NEW_LINE>Utils.sleep(10000);<NEW_LINE>simulator.killTopology("test");<NEW_LINE>simulator.shutdown();<NEW_LINE>}<NEW_LINE>} | conf, builder.createTopology()); |
1,834,201 | public CodegenExpression make(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) {<NEW_LINE>CodegenMethod methodNode = parent.makeChild(SubordTableLookupStrategyFactoryQuadTree.EPTYPE, this.getClass(), classScope);<NEW_LINE>Function<ExprForge, CodegenExpression> toExpr = forge -> ExprNodeUtilityCodegen.codegenEvaluator(forge, methodNode, <MASK><NEW_LINE>methodNode.getBlock().declareVarNewInstance(SubordTableLookupStrategyFactoryQuadTree.EPTYPE, "sts").exprDotMethod(ref("sts"), "setX", toExpr.apply(x)).exprDotMethod(ref("sts"), "setY", toExpr.apply(y)).exprDotMethod(ref("sts"), "setWidth", toExpr.apply(width)).exprDotMethod(ref("sts"), "setHeight", toExpr.apply(height)).exprDotMethod(ref("sts"), "setNWOnTrigger", constant(isNWOnTrigger)).exprDotMethod(ref("sts"), "setStreamCountOuter", constant(streamCountOuter)).exprDotMethod(ref("sts"), "setLookupExpressions", constant(lookupStrategyDesc.getExpressionsTexts())).methodReturn(ref("sts"));<NEW_LINE>return localMethod(methodNode);<NEW_LINE>} | this.getClass(), classScope); |
678,322 | private void loadNode426() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, new QualifiedName(0, "OutputArguments"), new LocalizedText("en", "OutputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Argument, 1, new UInteger[] { org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger.valueOf(0) }, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks_OutputArguments, Identifiers.HasProperty, Identifiers.CertificateGroupFolderType_DefaultUserTokenGroup_TrustList_OpenWithMasks.expanded(), false));<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<ListOfExtensionObject xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\"><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>FileHandle</Name><DataType><Identifier>i=7</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject>");<NEW_LINE><MASK><NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));<NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new DataValue(new Variant(o));<NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | String xml = sb.toString(); |
757,205 | public static List<RegressionExecution> executions() {<NEW_LINE>List<RegressionExecution> execs = new ArrayList<>();<NEW_LINE>execs.add(new EPLOtherOutputSimpleColumn());<NEW_LINE>execs.add(new EPLOtherBatchWindow());<NEW_LINE>execs.add(new EPLOtherBatchWindowJoin());<NEW_LINE>execs.add(new EPLOtherBatchWindowInsertInto());<NEW_LINE>execs.add(new EPLOtherOnDemandAndOnSelect());<NEW_LINE>execs.add(new EPLOtherSubquery());<NEW_LINE>execs<MASK><NEW_LINE>execs.add(new EPLOtherBeanEventWildcardSODA());<NEW_LINE>execs.add(new EPLOtherBeanEventWildcardPlusCols());<NEW_LINE>execs.add(new EPLOtherMapEventWildcard());<NEW_LINE>execs.add(new EPLOtherOutputLimitEveryColumn());<NEW_LINE>execs.add(new EPLOtherOutputRateSnapshotColumn());<NEW_LINE>execs.add(new EPLOtherDistinctWildcardJoinPatternOne());<NEW_LINE>execs.add(new EPLOtherDistinctWildcardJoinPatternTwo());<NEW_LINE>execs.add(new EPLOtherDistinctOutputLimitMultikeyWArraySingleArray());<NEW_LINE>execs.add(new EPLOtherDistinctOutputLimitMultikeyWArrayTwoArray());<NEW_LINE>execs.add(new EPLOtherDistinctFireAndForgetMultikeyWArray());<NEW_LINE>execs.add(new EPLOtherDistinctIterateMultikeyWArray());<NEW_LINE>execs.add(new EPLOtherDistinctOnSelectMultikeyWArray());<NEW_LINE>execs.add(new EPLOtherDistinctVariantStream());<NEW_LINE>return execs;<NEW_LINE>} | .add(new EPLOtherBeanEventWildcardThisProperty()); |
300,615 | private void writeNodePosition(XMLStreamWriter xmlWriter, Node node) throws Exception {<NEW_LINE>float x = node.x();<NEW_LINE>if (normalize && x != 0.0) {<NEW_LINE>x = (x - minX) / (maxX - minX);<NEW_LINE>}<NEW_LINE>float y = node.y();<NEW_LINE>if (normalize && y != 0.0) {<NEW_LINE>y = (y - <MASK><NEW_LINE>}<NEW_LINE>float z = node.z();<NEW_LINE>if (normalize && z != 0.0) {<NEW_LINE>z = (z - minZ) / (maxZ - minZ);<NEW_LINE>}<NEW_LINE>if (!(x == 0 && y == 0 && z == 0)) {<NEW_LINE>xmlWriter.writeStartElement(VIZ, NODE_POSITION, VIZ_NAMESPACE);<NEW_LINE>xmlWriter.writeAttribute("x", "" + x);<NEW_LINE>xmlWriter.writeAttribute("y", "" + y);<NEW_LINE>if (minZ != 0 || maxZ != 0) {<NEW_LINE>xmlWriter.writeAttribute("z", "" + z);<NEW_LINE>}<NEW_LINE>xmlWriter.writeEndElement();<NEW_LINE>}<NEW_LINE>} | minY) / (maxY - minY); |
1,477,285 | protected boolean checkTimeouts() {<NEW_LINE>long now = SystemTime.getCurrentTime();<NEW_LINE>List timed_out = new ArrayList();<NEW_LINE>boolean result;<NEW_LINE>try {<NEW_LINE>requests_mon.enter();<NEW_LINE>result = destroyed;<NEW_LINE>Iterator it = requests.values().iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>PRUDPPacketHandlerRequestImpl request = <MASK><NEW_LINE>long sent_time = request.getSendTime();<NEW_LINE>if (// never going to get processed, treat as timeout<NEW_LINE>destroyed || (sent_time != 0 && now - sent_time >= request.getTimeout())) {<NEW_LINE>it.remove();<NEW_LINE>stats.requestTimedOut();<NEW_LINE>timed_out.add(request);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>requests_mon.exit();<NEW_LINE>}<NEW_LINE>for (int i = 0; i < timed_out.size(); i++) {<NEW_LINE>PRUDPPacketHandlerRequestImpl request = (PRUDPPacketHandlerRequestImpl) timed_out.get(i);<NEW_LINE>if (TRACE_REQUESTS) {<NEW_LINE>if (Logger.isEnabled())<NEW_LINE>Logger.log(new LogEvent(LOGID, LogEvent.LT_ERROR, "PRUDPPacketHandler: request timeout"));<NEW_LINE>}<NEW_LINE>// don't change the text of this message, it's used elsewhere<NEW_LINE>try {<NEW_LINE>request.setException(new PRUDPPacketHandlerException("timed out"));<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.printStackTrace(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (result);<NEW_LINE>} | (PRUDPPacketHandlerRequestImpl) it.next(); |
1,760,143 | public PluginConfiguration convertFromSObject(SPluginConfiguration input, PluginConfiguration result, DatabaseSession session) throws BimserverDatabaseException {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (input instanceof SDeserializerPluginConfiguration) {<NEW_LINE>return convertFromSObject((SDeserializerPluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SInternalServicePluginConfiguration) {<NEW_LINE>return convertFromSObject((SInternalServicePluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SModelComparePluginConfiguration) {<NEW_LINE>return convertFromSObject((SModelComparePluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SModelMergerPluginConfiguration) {<NEW_LINE>return convertFromSObject((SModelMergerPluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SObjectIDMPluginConfiguration) {<NEW_LINE>return convertFromSObject((SObjectIDMPluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SQueryEnginePluginConfiguration) {<NEW_LINE>return convertFromSObject((SQueryEnginePluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SRenderEnginePluginConfiguration) {<NEW_LINE>return convertFromSObject((SRenderEnginePluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SSerializerPluginConfiguration) {<NEW_LINE>return convertFromSObject((SSerializerPluginConfiguration) input, session);<NEW_LINE>} else if (input instanceof SWebModulePluginConfiguration) {<NEW_LINE>return convertFromSObject((SWebModulePluginConfiguration) input, session);<NEW_LINE>}<NEW_LINE>result.setName(input.getName());<NEW_LINE>result.setEnabled(input.getEnabled());<NEW_LINE>result.setDescription(input.getDescription());<NEW_LINE>result.setPluginDescriptor((PluginDescriptor) session.get(StorePackage.eINSTANCE.getPluginDescriptor(), input.getPluginDescriptorId()<MASK><NEW_LINE>result.setSettings((ObjectType) session.get(StorePackage.eINSTANCE.getObjectType(), input.getSettingsId(), OldQuery.getDefault()));<NEW_LINE>return result;<NEW_LINE>} | , OldQuery.getDefault())); |
463,345 | public static AsyncServerResponse create(Object o, @Nullable Duration timeout) {<NEW_LINE>Assert.notNull(o, "Argument to async must not be null");<NEW_LINE>if (o instanceof CompletableFuture) {<NEW_LINE>CompletableFuture<ServerResponse> futureResponse = (CompletableFuture<ServerResponse>) o;<NEW_LINE>return new DefaultAsyncServerResponse(futureResponse, timeout);<NEW_LINE>} else if (reactiveStreamsPresent) {<NEW_LINE>ReactiveAdapterRegistry registry = ReactiveAdapterRegistry.getSharedInstance();<NEW_LINE>ReactiveAdapter publisherAdapter = registry.<MASK><NEW_LINE>if (publisherAdapter != null) {<NEW_LINE>Publisher<ServerResponse> publisher = publisherAdapter.toPublisher(o);<NEW_LINE>ReactiveAdapter futureAdapter = registry.getAdapter(CompletableFuture.class);<NEW_LINE>if (futureAdapter != null) {<NEW_LINE>CompletableFuture<ServerResponse> futureResponse = (CompletableFuture<ServerResponse>) futureAdapter.fromPublisher(publisher);<NEW_LINE>return new DefaultAsyncServerResponse(futureResponse, timeout);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Asynchronous type not supported: " + o.getClass());<NEW_LINE>} | getAdapter(o.getClass()); |
681,146 | private static ImmutableList<BinaryPredicateCode> makeBinaryPredicates(ClassTree classTree, MethodTree compareMethod, VisitorState state) {<NEW_LINE>Tree comparison = maybeMakeLambdaBody(compareMethod, state);<NEW_LINE>if (comparison == null) {<NEW_LINE>ClassTree enclosing = findStrictlyEnclosing(state, ClassTree.class);<NEW_LINE>CharSequence newCompareMethodOwner;<NEW_LINE>String newCompareMethodName;<NEW_LINE>if (enclosing == null) {<NEW_LINE>newCompareMethodName = "compare";<NEW_LINE>newCompareMethodOwner = classTree.getSimpleName();<NEW_LINE>} else {<NEW_LINE>newCompareMethodName = "compare" + classTree.getSimpleName().toString().replaceFirst("Correspondence$", "");<NEW_LINE>newCompareMethodOwner = enclosing.getSimpleName();<NEW_LINE>}<NEW_LINE>// TODO(cpovirk): We're unlikely to get away with declaring everything `static`.<NEW_LINE>String supportingMethodDefinition = format("private static boolean %s(%s, %s) %s", newCompareMethodName, state.getSourceForNode(compareMethod.getParameters().get(0)), state.getSourceForNode(compareMethod.getParameters().get(1)), state.getSourceForNode(compareMethod.getBody()));<NEW_LINE>return ImmutableList.of(BinaryPredicateCode.create(newCompareMethodOwner + "::" + newCompareMethodName, supportingMethodDefinition));<NEW_LINE>}<NEW_LINE>// First try without types, then try with.<NEW_LINE>return ImmutableList.of(BinaryPredicateCode.fromParamsAndExpression(compareMethod.getParameters().get(0).getName(), compareMethod.getParameters().get(1).getName(), state.getSourceForNode(comparison)), BinaryPredicateCode.fromParamsAndExpression(state.getSourceForNode(compareMethod.getParameters().get(0)), state.getSourceForNode(compareMethod.getParameters().get(1)), <MASK><NEW_LINE>} | state.getSourceForNode(comparison))); |
1,521,231 | public static // return : result vector<NEW_LINE>ArrayList<VectorElem<Double>> multBlockVector(byte[] block, ArrayList<VectorElem<Double>> vector, int i_block_width) {<NEW_LINE>// buffer to save output<NEW_LINE>double[] out_vals = new double[i_block_width];<NEW_LINE>short i;<NEW_LINE>for (i = 0; i < i_block_width; i++) out_vals[i] = 0;<NEW_LINE>Iterator<VectorElem<Double>> vector_iter = vector.iterator();<NEW_LINE>while (vector_iter.hasNext()) {<NEW_LINE>VectorElem<Double> v_elem = vector_iter.next();<NEW_LINE>int col = v_elem.row;<NEW_LINE>for (int row = 0; row < i_block_width; row++) {<NEW_LINE>int edge_elem = block[(row * i_block_width + col) / 8] & (1 << (col % 8));<NEW_LINE>if (edge_elem > 0) {<NEW_LINE>out_vals[row] += v_elem.val;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ArrayList<<MASK><NEW_LINE>for (i = 0; i < i_block_width; i++) {<NEW_LINE>if (out_vals[i] != 0) {<NEW_LINE>if (result_vector == null)<NEW_LINE>result_vector = new ArrayList<VectorElem<Double>>();<NEW_LINE>result_vector.add(new VectorElem(i, out_vals[i]));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result_vector;<NEW_LINE>} | VectorElem<Double>> result_vector = null; |
1,291,957 | public void processSessionEvent(@Nonnull SessionEvent event, @Nonnull XDebugSession session) {<NEW_LINE>myRefresh = event == SessionEvent.SETTINGS_CHANGED;<NEW_LINE>if (event == SessionEvent.BEFORE_RESUME) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>XExecutionStack currentExecutionStack = ((<MASK><NEW_LINE>XStackFrame currentStackFrame = session.getCurrentStackFrame();<NEW_LINE>XSuspendContext suspendContext = session.getSuspendContext();<NEW_LINE>if (event == SessionEvent.FRAME_CHANGED && Objects.equals(mySelectedStack, currentExecutionStack)) {<NEW_LINE>ApplicationManager.getApplication().assertIsDispatchThread();<NEW_LINE>if (currentStackFrame != null) {<NEW_LINE>myFramesList.setSelectedValue(currentStackFrame, true);<NEW_LINE>mySelectedFrameIndex = myFramesList.getSelectedIndex();<NEW_LINE>myExecutionStacksWithSelection.put(mySelectedStack, mySelectedFrameIndex);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>EdtExecutorService.getInstance().execute(() -> {<NEW_LINE>if (event != SessionEvent.SETTINGS_CHANGED) {<NEW_LINE>mySelectedFrameIndex = 0;<NEW_LINE>mySelectedStack = null;<NEW_LINE>myVisibleRect = null;<NEW_LINE>} else {<NEW_LINE>myVisibleRect = myFramesList.getVisibleRect();<NEW_LINE>}<NEW_LINE>myListenersEnabled = false;<NEW_LINE>myBuilders.values().forEach(StackFramesListBuilder::dispose);<NEW_LINE>myBuilders.clear();<NEW_LINE>if (suspendContext == null) {<NEW_LINE>requestClear();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (event == SessionEvent.PAUSED) {<NEW_LINE>// clear immediately<NEW_LINE>cancelClear();<NEW_LINE>clear();<NEW_LINE>}<NEW_LINE>XExecutionStack activeExecutionStack = mySelectedStack != null ? mySelectedStack : currentExecutionStack;<NEW_LINE>addExecutionStacks(Collections.singletonList(activeExecutionStack));<NEW_LINE>XExecutionStack[] executionStacks = suspendContext.getExecutionStacks();<NEW_LINE>addExecutionStacks(Arrays.asList(executionStacks));<NEW_LINE>myThreadComboBox.setSelectedItem(activeExecutionStack);<NEW_LINE>myThreadsPanel.removeAll();<NEW_LINE>myThreadsPanel.add(myToolbar.getComponent(), BorderLayout.EAST);<NEW_LINE>final boolean invisible = executionStacks.length == 1 && StringUtil.isEmpty(executionStacks[0].getDisplayName());<NEW_LINE>if (!invisible) {<NEW_LINE>myThreadsPanel.add(myThreadComboBox, BorderLayout.CENTER);<NEW_LINE>}<NEW_LINE>updateFrames(activeExecutionStack, session, event == SessionEvent.FRAME_CHANGED ? currentStackFrame : null);<NEW_LINE>});<NEW_LINE>} | XDebugSessionImpl) session).getCurrentExecutionStack(); |
610,268 | private static int hexDecode(String string, int begin, int length, String prefix, String section, String field) {<NEW_LINE>int result = 0;<NEW_LINE>for (int i = begin; i < begin + length; i++) {<NEW_LINE>if (i >= string.length()) {<NEW_LINE>throw new HumanReadableException(".buckconfig: %s:%s: " + "Input ends inside hexadecimal sequence: %s%s", section, field, prefix, string.substring(begin));<NEW_LINE>}<NEW_LINE>char c = string.charAt(i);<NEW_LINE>if (c >= 'a') {<NEW_LINE>// 'a' has value 97. Subtract 87, so 'a' becomes 10, 'b' 11, etc.<NEW_LINE>c -= 87;<NEW_LINE>} else if (c >= 'A') {<NEW_LINE>// 'A' has value 65. Subtract 55, so 'A' becomes 10, 'B' 11, etc.<NEW_LINE>c -= 55;<NEW_LINE>} else if (c >= '0' && c <= '9') {<NEW_LINE>// '0' has value 48, so subtract that, making '0' 0, '1' 1, etc.<NEW_LINE>c -= 48;<NEW_LINE>} else {<NEW_LINE>// not a valid hex char; set c to an invalid value to trigger<NEW_LINE>// the exception below.<NEW_LINE>c = 255;<NEW_LINE>}<NEW_LINE>if (c > 16) {<NEW_LINE>throw new HumanReadableException(".buckconfig: %s:%s: Invalid hexadecimal digit in sequence: %s%s", section, field, prefix, string.substring<MASK><NEW_LINE>}<NEW_LINE>result = (result << 4) | c;<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (begin, i + 1)); |
273,482 | public void saveSettings(Screen screen, Settings settings) {<NEW_LINE>checkNotNullArgument(screen);<NEW_LINE>checkNotNullArgument(settings);<NEW_LINE>walkComponents(screen.getWindow(), (component, name) -> {<NEW_LINE>if (component.getId() != null && component instanceof HasSettings) {<NEW_LINE>log.trace("Saving settings for {} : {}", name, component);<NEW_LINE>Element e = settings.get(name);<NEW_LINE>boolean modified = ((HasSettings<MASK><NEW_LINE>if (component instanceof HasPresentations && ((HasPresentations) component).isUsePresentations()) {<NEW_LINE>Object def = ((HasPresentations) component).getDefaultPresentationId();<NEW_LINE>e.addAttribute("presentation", def != null ? def.toString() : "");<NEW_LINE>Presentations presentations = ((HasPresentations) component).getPresentations();<NEW_LINE>if (presentations != null) {<NEW_LINE>presentations.commit();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (modified) {<NEW_LINE>settings.setModified(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>settings.commit();<NEW_LINE>} | ) component).saveSettings(e); |
224,266 | private void handleLoginModule(Node node, List<BeanDefinition> list) {<NEW_LINE>BeanDefinitionBuilder lmConfigBuilder = createBeanBuilder(LoginModuleConfig.class);<NEW_LINE>AbstractBeanDefinition beanDefinition = lmConfigBuilder.getBeanDefinition();<NEW_LINE>fillAttributeValues(node, lmConfigBuilder, "class-name", "implementation");<NEW_LINE>NamedNodeMap attributes = node.getAttributes();<NEW_LINE>Node classNameNode = attributes.getNamedItem("class-name");<NEW_LINE>String className = classNameNode != null ? getTextContent(classNameNode) : null;<NEW_LINE>Node implNode = attributes.getNamedItem("implementation");<NEW_LINE>String implementation = implNode != null ? getTextContent(implNode) : null;<NEW_LINE><MASK><NEW_LINE>if (implementation != null) {<NEW_LINE>lmConfigBuilder.addPropertyReference("implementation", implementation);<NEW_LINE>}<NEW_LINE>isTrue(className != null || implementation != null, "One of 'class-name' or 'implementation'" + " attributes is required to create LoginModule!");<NEW_LINE>for (Node child : childElements(node)) {<NEW_LINE>String nodeName = cleanNodeName(child);<NEW_LINE>if ("properties".equals(nodeName)) {<NEW_LINE>handleProperties(child, lmConfigBuilder);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>list.add(beanDefinition);<NEW_LINE>} | lmConfigBuilder.addPropertyValue("className", className); |
524,731 | public ListLaunchProfileMembersResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListLaunchProfileMembersResult listLaunchProfileMembersResult = new ListLaunchProfileMembersResult();<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 listLaunchProfileMembersResult;<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("members", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listLaunchProfileMembersResult.setMembers(new ListUnmarshaller<LaunchProfileMembership>(LaunchProfileMembershipJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listLaunchProfileMembersResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listLaunchProfileMembersResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,633,929 | private File downloadExportJson(DownloadBean downloadBean) throws IOException {<NEW_LINE>LOGGER.info("Successfully triggered an export operation on the Manager API.");<NEW_LINE>HttpUrl downloadUrl = // ID from DownloadBean is ID path segment<NEW_LINE>HttpUrl.parse(endpoint).newBuilder().addPathSegment("downloads").addPathSegment(downloadBean.getId()).build();<NEW_LINE>Request downloadRequest = buildRequest(downloadUrl);<NEW_LINE>Call downloadCall = client.newCall(downloadRequest);<NEW_LINE>Response downloadResponse = downloadCall.execute();<NEW_LINE>checkStatusOk(downloadResponse);<NEW_LINE>File downloadedFileTmp = <MASK><NEW_LINE>// Get the underlying okio source, as it has some nice methods for writing directly without loads of copying.<NEW_LINE>BufferedSource source = downloadResponse.body().source();<NEW_LINE>BufferedSink buff = Okio.buffer(Okio.sink(downloadedFileTmp));<NEW_LINE>buff.writeAll(source);<NEW_LINE>buff.close();<NEW_LINE>LOGGER.debug("Successfully downloaded an Apiman export to tmp: {}", downloadedFileTmp);<NEW_LINE>return downloadedFileTmp;<NEW_LINE>} | File.createTempFile("EnrichPre21Export", ".json"); |
1,054,373 | // ===================================================================================<NEW_LINE>// Basic Override<NEW_LINE>// ==============<NEW_LINE>@Override<NEW_LINE>protected String doBuildColumnString(String dm) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(dm).append(businessCategory);<NEW_LINE>sb.append(dm).append(carLicense);<NEW_LINE>sb.append(dm).append(city);<NEW_LINE>sb.append(dm).append(departmentNumber);<NEW_LINE>sb.append(dm).append(description);<NEW_LINE>sb.append<MASK><NEW_LINE>sb.append(dm).append(displayName);<NEW_LINE>sb.append(dm).append(employeeNumber);<NEW_LINE>sb.append(dm).append(employeeType);<NEW_LINE>sb.append(dm).append(facsimileTelephoneNumber);<NEW_LINE>sb.append(dm).append(gidNumber);<NEW_LINE>sb.append(dm).append(givenName);<NEW_LINE>sb.append(dm).append(groups);<NEW_LINE>sb.append(dm).append(homeDirectory);<NEW_LINE>sb.append(dm).append(homePhone);<NEW_LINE>sb.append(dm).append(homePostalAddress);<NEW_LINE>sb.append(dm).append(initials);<NEW_LINE>sb.append(dm).append(internationaliSDNNumber);<NEW_LINE>sb.append(dm).append(labeledURI);<NEW_LINE>sb.append(dm).append(mail);<NEW_LINE>sb.append(dm).append(mobile);<NEW_LINE>sb.append(dm).append(name);<NEW_LINE>sb.append(dm).append(pager);<NEW_LINE>sb.append(dm).append(password);<NEW_LINE>sb.append(dm).append(physicalDeliveryOfficeName);<NEW_LINE>sb.append(dm).append(postOfficeBox);<NEW_LINE>sb.append(dm).append(postalAddress);<NEW_LINE>sb.append(dm).append(postalCode);<NEW_LINE>sb.append(dm).append(preferredLanguage);<NEW_LINE>sb.append(dm).append(registeredAddress);<NEW_LINE>sb.append(dm).append(roles);<NEW_LINE>sb.append(dm).append(roomNumber);<NEW_LINE>sb.append(dm).append(state);<NEW_LINE>sb.append(dm).append(street);<NEW_LINE>sb.append(dm).append(surname);<NEW_LINE>sb.append(dm).append(telephoneNumber);<NEW_LINE>sb.append(dm).append(teletexTerminalIdentifier);<NEW_LINE>sb.append(dm).append(title);<NEW_LINE>sb.append(dm).append(uidNumber);<NEW_LINE>sb.append(dm).append(x121Address);<NEW_LINE>if (sb.length() > dm.length()) {<NEW_LINE>sb.delete(0, dm.length());<NEW_LINE>}<NEW_LINE>sb.insert(0, "{").append("}");<NEW_LINE>return sb.toString();<NEW_LINE>} | (dm).append(destinationIndicator); |
1,498,034 | protected ExceptionCollection scanDependencies(final Engine engine) throws MojoExecutionException {<NEW_LINE>ExceptionCollection exCol = scanArtifacts(getProject(), engine, true);<NEW_LINE>for (MavenProject childProject : getDescendants(this.getProject())) {<NEW_LINE>// TODO consider the following as to whether a child should be skipped per #2152<NEW_LINE>// childProject.getBuildPlugins().get(0).getExecutions().get(0).getConfiguration()<NEW_LINE>final ExceptionCollection ex = scanArtifacts(childProject, engine, true);<NEW_LINE>if (ex != null) {<NEW_LINE>if (exCol == null) {<NEW_LINE>exCol = ex;<NEW_LINE>} else {<NEW_LINE>exCol.getExceptions().addAll(ex.getExceptions());<NEW_LINE>}<NEW_LINE>if (ex.isFatal()) {<NEW_LINE>exCol.setFatal(true);<NEW_LINE>final String msg = String.format("Fatal exception(s) analyzing %s", childProject.getName());<NEW_LINE>if (this.isFailOnError()) {<NEW_LINE>throw new MojoExecutionException(msg, exCol);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (getLog().isDebugEnabled()) {<NEW_LINE>getLog().debug(exCol);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return exCol;<NEW_LINE>} | getLog().error(msg); |
48,795 | private boolean isPhoneSilenced() {<NEW_LINE>final boolean notificationDnd;<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {<NEW_LINE>final NotificationManager notificationManager = getSystemService(NotificationManager.class);<NEW_LINE>final int filter = notificationManager == null ? NotificationManager.INTERRUPTION_FILTER_UNKNOWN : notificationManager.getCurrentInterruptionFilter();<NEW_LINE>notificationDnd = filter >= NotificationManager.INTERRUPTION_FILTER_PRIORITY;<NEW_LINE>} else {<NEW_LINE>notificationDnd = false;<NEW_LINE>}<NEW_LINE>final AudioManager audioManager = (<MASK><NEW_LINE>final int ringerMode = audioManager == null ? AudioManager.RINGER_MODE_NORMAL : audioManager.getRingerMode();<NEW_LINE>try {<NEW_LINE>if (treatVibrateAsSilent()) {<NEW_LINE>return notificationDnd || ringerMode != AudioManager.RINGER_MODE_NORMAL;<NEW_LINE>} else {<NEW_LINE>return notificationDnd || ringerMode == AudioManager.RINGER_MODE_SILENT;<NEW_LINE>}<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>Log.d(Config.LOGTAG, "platform bug in isPhoneSilenced (" + throwable.getMessage() + ")");<NEW_LINE>return notificationDnd;<NEW_LINE>}<NEW_LINE>} | AudioManager) getSystemService(Context.AUDIO_SERVICE); |
744,116 | public static void load(BeanDescriptor<?> desc, EntityBean bean, CachedBeanData cacheBeanData, PersistenceContext context) {<NEW_LINE>EntityBeanIntercept ebi = bean._ebean_getIntercept();<NEW_LINE>// any future lazy loading skips L2 bean cache<NEW_LINE>ebi.setLoadedFromCache(true);<NEW_LINE>BeanProperty idProperty = desc.idProperty();<NEW_LINE>if (desc.inheritInfo() != null) {<NEW_LINE>desc = desc.inheritInfo().readType(bean.getClass()).desc();<NEW_LINE>}<NEW_LINE>if (idProperty != null) {<NEW_LINE>// load the id property<NEW_LINE>loadProperty(bean, cacheBeanData, ebi, idProperty, context);<NEW_LINE>}<NEW_LINE>// load the non-many properties<NEW_LINE>for (BeanProperty prop : desc.propertiesNonMany()) {<NEW_LINE>loadProperty(bean, <MASK><NEW_LINE>}<NEW_LINE>for (BeanPropertyAssocMany<?> prop : desc.propertiesMany()) {<NEW_LINE>if (prop.isElementCollection()) {<NEW_LINE>loadProperty(bean, cacheBeanData, ebi, prop, context);<NEW_LINE>} else {<NEW_LINE>prop.createReferenceIfNull(bean);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ebi.setLoadedLazy();<NEW_LINE>} | cacheBeanData, ebi, prop, context); |
456,555 | private void createMRPPegging(String trxName) {<NEW_LINE>if (demands == null || demands.size() == 0 || supplies == null || supplies.size() == 0)<NEW_LINE>return;<NEW_LINE>Iterator<Entry<Integer, BigDecimal>> iteratorDemands = demands.entrySet().iterator();<NEW_LINE>Iterator<Entry<Integer, BigDecimal>> iteratorSupplies = supplies.entrySet().iterator();<NEW_LINE>while (iteratorSupplies.hasNext()) {<NEW_LINE>Entry<Integer, BigDecimal> supply = iteratorSupplies.next();<NEW_LINE>while (iteratorDemands.hasNext()) {<NEW_LINE>Entry<Integer, BigDecimal<MASK><NEW_LINE>if (demand.getValue().signum() <= 0) {<NEW_LINE>iteratorDemands.remove();<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (supply.getValue().signum() > 0) {<NEW_LINE>MPPMRPDetail detail = new MPPMRPDetail(getCtx(), 0, trxName);<NEW_LINE>detail.setMRP_Demand_ID(demand.getKey());<NEW_LINE>detail.setMRP_Supply_ID(supply.getKey());<NEW_LINE>if (supply.getValue().compareTo(demand.getValue()) >= 0) {<NEW_LINE>detail.setQty(demand.getValue());<NEW_LINE>detail.saveEx();<NEW_LINE>supply.setValue(supply.getValue().subtract(demand.getValue()));<NEW_LINE>iteratorDemands.remove();<NEW_LINE>if (supply.getValue().signum() == 0) {<NEW_LINE>iteratorSupplies.remove();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>detail.setQty(supply.getValue());<NEW_LINE>detail.saveEx();<NEW_LINE>demand.setValue(demand.getValue().subtract(supply.getValue()));<NEW_LINE>iteratorSupplies.remove();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>demands = new LinkedHashMap<Integer, BigDecimal>();<NEW_LINE>supplies = new LinkedHashMap<Integer, BigDecimal>();<NEW_LINE>} | > demand = iteratorDemands.next(); |
129,045 | MethodReference generateBeanDefinitionMethod(GenerationContext generationContext, BeanRegistrationsCode beanRegistrationsCode) {<NEW_LINE>BeanRegistrationCodeFragments codeFragments = getCodeFragments(beanRegistrationsCode);<NEW_LINE>Class<?> target = codeFragments.getTarget(this.registeredBean, this.constructorOrFactoryMethod);<NEW_LINE>if (!target.getName().startsWith("java.")) {<NEW_LINE>GeneratedClass generatedClass = generationContext.getClassGenerator().getOrGenerateClass(new BeanDefinitionsJavaFileGenerator(target), target, "BeanDefinitions");<NEW_LINE>MethodGenerator methodGenerator = generatedClass.getMethodGenerator().withName(getName());<NEW_LINE>GeneratedMethod generatedMethod = generateBeanDefinitionMethod(generationContext, generatedClass.getName(), methodGenerator, codeFragments, Modifier.PUBLIC);<NEW_LINE>return MethodReference.ofStatic(generatedClass.getName(), generatedMethod.getName());<NEW_LINE>}<NEW_LINE>MethodGenerator methodGenerator = beanRegistrationsCode.getMethodGenerator(<MASK><NEW_LINE>GeneratedMethod generatedMethod = generateBeanDefinitionMethod(generationContext, beanRegistrationsCode.getClassName(), methodGenerator, codeFragments, Modifier.PRIVATE);<NEW_LINE>return MethodReference.ofStatic(beanRegistrationsCode.getClassName(), generatedMethod.getName().toString());<NEW_LINE>} | ).withName(getName()); |
1,151,134 | public static WorkerReportRequest buildWorkerReportRequest(Worker worker) {<NEW_LINE>WorkerReportRequest.Builder builder = WorkerReportRequest.newBuilder();<NEW_LINE>builder.setWorkerAttemptId(worker.getWorkerAttemptIdProto());<NEW_LINE>if (!worker.isWorkerInitFinished()) {<NEW_LINE>return builder.build();<NEW_LINE>}<NEW_LINE>Map<TaskId, Task> tasks = worker.getTaskManager().getRunningTask();<NEW_LINE>if (tasks != null && !tasks.isEmpty()) {<NEW_LINE>for (Entry<TaskId, Task> entry : tasks.entrySet()) {<NEW_LINE>builder.addTaskReports(buildTaskReport(entry.getKey(), entry.getValue()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Pair.Builder kvBuilder = Pair.newBuilder();<NEW_LINE>Map<String, String<MASK><NEW_LINE>for (Entry<String, String> kv : props.entrySet()) {<NEW_LINE>kvBuilder.setKey(kv.getKey());<NEW_LINE>kvBuilder.setValue(kv.getValue());<NEW_LINE>builder.addPairs(kvBuilder.build());<NEW_LINE>}<NEW_LINE>// add the PSAgentContext,need fix<NEW_LINE>props = PSAgentContext.get().getMetrics();<NEW_LINE>for (Entry<String, String> kv : props.entrySet()) {<NEW_LINE>kvBuilder.setKey(kv.getKey());<NEW_LINE>kvBuilder.setValue(kv.getValue());<NEW_LINE>builder.addPairs(kvBuilder.build());<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | > props = worker.getMetrics(); |
1,362,468 | private void analyzePartsRecursively(TypeMirror target, Map<String, PartKind> parts, Set<TypeMirror> usedTypes) {<NEW_LINE>String typeName = typeWithoutAnnotations(target.toString());<NEW_LINE>if (typeSupport.isSupported(typeName)) {<NEW_LINE>usedTypes.add(target);<NEW_LINE>if (isRawType(target)) {<NEW_LINE>parts.put(typeName, PartKind.RAW_TYPE);<NEW_LINE>} else {<NEW_LINE>parts.put(typeName, PartKind.OTHER);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(target.getKind()) {<NEW_LINE>case ARRAY:<NEW_LINE>ArrayType at = (ArrayType) target;<NEW_LINE>analyzePartsRecursively(at.getComponentType(), parts, usedTypes);<NEW_LINE>break;<NEW_LINE>case DECLARED:<NEW_LINE>DeclaredType declaredType = (DeclaredType) target;<NEW_LINE>List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();<NEW_LINE>String rawTypeName = declaredType.asElement().toString();<NEW_LINE>usedTypes.add(declaredType.asElement().asType());<NEW_LINE>StructInfo struct = structs.get(rawTypeName);<NEW_LINE>boolean knownAndValidStruct = struct != null && (struct.type != ObjectType.CLASS || struct.hasAnnotation() || !struct.attributes.isEmpty() || !struct.implementations.isEmpty() || struct.hasKnownConversion());<NEW_LINE>if (knownAndValidStruct || typeSupport.isSupported(rawTypeName)) {<NEW_LINE>if (isRawType(target)) {<NEW_LINE>parts.put(rawTypeName, PartKind.RAW_TYPE);<NEW_LINE>} else {<NEW_LINE>parts.<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>parts.put(rawTypeName, PartKind.UNKNOWN);<NEW_LINE>}<NEW_LINE>for (TypeMirror typeArgument : typeArguments) {<NEW_LINE>analyzePartsRecursively(typeArgument, parts, usedTypes);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case TYPEVAR:<NEW_LINE>usedTypes.add(target);<NEW_LINE>parts.put(typeName, PartKind.TYPE_VARIABLE);<NEW_LINE>break;<NEW_LINE>case WILDCARD:<NEW_LINE>WildcardType wt = (WildcardType) target;<NEW_LINE>analyzePartsRecursively(wt.getExtendsBound(), parts, usedTypes);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>usedTypes.add(target);<NEW_LINE>parts.put(typeName, PartKind.UNKNOWN);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | put(rawTypeName, PartKind.OTHER); |
1,675,783 | private void processPrecompiledBinaries() {<NEW_LINE>String[] binaries = OPENCL_BINARIES.toString().split(",");<NEW_LINE>if (binaries.length == 1) {<NEW_LINE>// We try to parse a configuration file<NEW_LINE>binaries = processPrecompiledBinariesFromFile(binaries[0]);<NEW_LINE>} else if ((binaries.length % 2) != 0) {<NEW_LINE>throw new RuntimeException("tornado.precompiled.binary=<path>,taskName.device");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < binaries.length; i += 2) {<NEW_LINE>String binaryFile = binaries[i];<NEW_LINE>String taskAndDeviceInfo = binaries[i + 1];<NEW_LINE>String task = taskAndDeviceInfo.split("\\.")[0] + "." + taskAndDeviceInfo.split("\\.")[1];<NEW_LINE>String[] driverAndDevice = taskAndDeviceInfo.split("=")<MASK><NEW_LINE>int driverIndex = Integer.parseInt(driverAndDevice[0]);<NEW_LINE>int deviceIndex = Integer.parseInt(driverAndDevice[1]);<NEW_LINE>addNewEntryInBitstreamHashMap(task, binaryFile, driverIndex, deviceIndex);<NEW_LINE>// For each entry, we should add also an entry for<NEW_LINE>// lookup-buffer-address<NEW_LINE>addNewEntryInBitstreamHashMap("oclbackend.lookupBufferAddress", binaryFile, driverIndex, deviceIndex);<NEW_LINE>}<NEW_LINE>} | [1].split(":"); |
1,477,027 | // TODO: make the ByteList version public and use it, rather than copying here<NEW_LINE>static int indexOf(byte[] source, int sourceOffset, int sourceCount, byte[] target, int targetOffset, int targetCount, int fromIndex, Encoding enc) {<NEW_LINE>if (fromIndex >= sourceCount)<NEW_LINE>return (targetCount == 0 ? sourceCount : -1);<NEW_LINE>if (fromIndex < 0)<NEW_LINE>fromIndex = 0;<NEW_LINE>if (targetCount == 0)<NEW_LINE>return fromIndex;<NEW_LINE>byte first = target[targetOffset];<NEW_LINE>int max = sourceOffset + (sourceCount - targetCount);<NEW_LINE>int i = sourceOffset + fromIndex;<NEW_LINE>while (i <= max) {<NEW_LINE>while (i <= max && source[i] != first) i += StringSupport.length(enc, source, i, sourceOffset + sourceCount);<NEW_LINE>if (i <= max) {<NEW_LINE>int j = i + 1;<NEW_LINE>int end = j + targetCount - 1;<NEW_LINE>for (int k = targetOffset + 1; j < end && source[j] == target[k<MASK><NEW_LINE>if (j == end)<NEW_LINE>return i - sourceOffset;<NEW_LINE>i += StringSupport.length(enc, source, i, sourceOffset + sourceCount);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return -1;<NEW_LINE>} | ]; j++, k++) ; |
1,237,266 | public static ItineraryGroupInfo createGroupInfo(OsmandApplication app, MapMarkersGroup group) {<NEW_LINE>ItineraryGroupInfo groupInfo = new ItineraryGroupInfo();<NEW_LINE>groupInfo.name = group.getName();<NEW_LINE>groupInfo.type = group.getType().getTypeName();<NEW_LINE>Set<String> wptCategories = group.getWptCategories();<NEW_LINE>if (!Algorithms.isEmpty(wptCategories)) {<NEW_LINE>groupInfo.categories = Algorithms.encodeCollection(wptCategories, CATEGORIES_SPLIT);<NEW_LINE>}<NEW_LINE>if (group.getType() == ItineraryType.TRACK) {<NEW_LINE>String path = group.getId();<NEW_LINE>String gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath();<NEW_LINE>int <MASK><NEW_LINE>if (index != -1) {<NEW_LINE>path = path.substring(gpxDir.length() + 1);<NEW_LINE>}<NEW_LINE>groupInfo.path = path;<NEW_LINE>groupInfo.alias = groupInfo.type + ":" + path.replace(IndexConstants.GPX_FILE_EXT, "");<NEW_LINE>} else {<NEW_LINE>groupInfo.alias = groupInfo.type + (group.getId() == null ? "" : ":" + group.getId().replace(":", "_"));<NEW_LINE>}<NEW_LINE>return groupInfo;<NEW_LINE>} | index = path.indexOf(gpxDir); |
465,240 | public List<Service> listServices(final String layer, final String group) throws IOException {<NEW_LINE>StringBuilder sql = new StringBuilder();<NEW_LINE>List<Object> condition = new ArrayList<>(5);<NEW_LINE>sql.append("select * from "<MASK><NEW_LINE>if (StringUtil.isNotEmpty(layer) || StringUtil.isNotEmpty(group)) {<NEW_LINE>sql.append(" where ");<NEW_LINE>}<NEW_LINE>if (StringUtil.isNotEmpty(layer)) {<NEW_LINE>sql.append(ServiceTraffic.LAYER).append("=?");<NEW_LINE>condition.add(Layer.valueOf(layer).value());<NEW_LINE>}<NEW_LINE>if (StringUtil.isNotEmpty(layer) && StringUtil.isNotEmpty(group)) {<NEW_LINE>sql.append(" and ");<NEW_LINE>}<NEW_LINE>if (StringUtil.isNotEmpty(group)) {<NEW_LINE>sql.append(ServiceTraffic.GROUP).append("=?");<NEW_LINE>condition.add(group);<NEW_LINE>}<NEW_LINE>sql.append(" limit ").append(metadataQueryMaxSize);<NEW_LINE>try (Connection connection = h2Client.getConnection()) {<NEW_LINE>try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) {<NEW_LINE>return buildServices(resultSet);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>} | ).append(ServiceTraffic.INDEX_NAME); |
613,858 | public static LithoView mountComponent(LithoView lithoView, ComponentTree componentTree, int widthSpec, int heightSpec) {<NEW_LINE>final boolean addParent = lithoView.getParent() == null;<NEW_LINE>final ViewGroup parent = new ViewGroup(lithoView.getContext()) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onLayout(boolean changed, int l, int t, int r, int b) {<NEW_LINE>}<NEW_LINE>};<NEW_LINE>if (addParent) {<NEW_LINE>parent.addView(lithoView);<NEW_LINE>}<NEW_LINE>lithoView.setComponentTree(componentTree);<NEW_LINE>try {<NEW_LINE>Whitebox.invokeMethod(lithoView, "onAttach");<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (addParent) {<NEW_LINE>parent.layout(0, 0, lithoView.getMeasuredWidth(), lithoView.getMeasuredHeight());<NEW_LINE>}<NEW_LINE>lithoView.layout(0, 0, lithoView.getMeasuredWidth(), lithoView.getMeasuredHeight());<NEW_LINE>return lithoView;<NEW_LINE>} | lithoView.measure(widthSpec, heightSpec); |
1,775,484 | /*<NEW_LINE>* When unit result is about to be accepted, removed back pointers<NEW_LINE>* to compiler structures.<NEW_LINE>*/<NEW_LINE>public void cleanUp() {<NEW_LINE>if (this.types != null) {<NEW_LINE>for (int i = 0, max = this.types.length; i < max; i++) {<NEW_LINE>cleanUp<MASK><NEW_LINE>}<NEW_LINE>for (int i = 0, max = this.localTypeCount; i < max; i++) {<NEW_LINE>LocalTypeBinding localType = this.localTypes[i];<NEW_LINE>// null out the type's scope backpointers<NEW_LINE>// local members are already in the list<NEW_LINE>localType.scope = null;<NEW_LINE>localType.enclosingCase = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.functionalExpressionsCount > 0) {<NEW_LINE>for (int i = 0, max = this.functionalExpressionsCount; i < max; i++) {<NEW_LINE>this.functionalExpressions[i].cleanUp();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// recovery is already done<NEW_LINE>this.compilationResult.recoveryScannerData = null;<NEW_LINE>ClassFile[] classFiles = this.compilationResult.getClassFiles();<NEW_LINE>for (int i = 0, max = classFiles.length; i < max; i++) {<NEW_LINE>// clear the classFile back pointer to the bindings<NEW_LINE>ClassFile classFile = classFiles[i];<NEW_LINE>// null out the classfile backpointer to a type binding<NEW_LINE>classFile.referenceBinding = null;<NEW_LINE>classFile.innerClassesBindings = null;<NEW_LINE>classFile.bootstrapMethods = null;<NEW_LINE>classFile.missingTypes = null;<NEW_LINE>classFile.visitedTypes = null;<NEW_LINE>}<NEW_LINE>this.suppressWarningAnnotations = null;<NEW_LINE>if (this.scope != null)<NEW_LINE>this.scope.cleanUpInferenceContexts();<NEW_LINE>} | (this.types[i]); |
409,230 | private boolean isCandidate(String name, List<Node> refs) {<NEW_LINE>if (!OptimizeCalls.mayBeOptimizableName(compiler, name)) {<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean seenCandidateDefiniton = false;<NEW_LINE>boolean seenUse = false;<NEW_LINE>for (Node n : refs) {<NEW_LINE>// Assume indirect definitions references use the result<NEW_LINE>if (ReferenceMap.isCallTarget(n) || ReferenceMap.isOptChainCallTarget(n)) {<NEW_LINE>Node callNode = ReferenceMap.getCallOrNewNodeForTarget(n);<NEW_LINE>if (NodeUtil.isExpressionResultUsed(callNode)) {<NEW_LINE>// At least one call site uses the return value, this<NEW_LINE>// is not a candidate.<NEW_LINE>decisionsLog.log("%s\treturn value used: %s", name, callNode.getLocation());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>seenUse = true;<NEW_LINE>} else if (isCandidateDefinition(n)) {<NEW_LINE>// NOTE: While is is possible to optimize calls to functions for which we know<NEW_LINE>// only some of the definition are candidates but to keep things simple, only<NEW_LINE>// optimize if all of the definitions are known.<NEW_LINE>seenCandidateDefiniton = true;<NEW_LINE>} else {<NEW_LINE>// If this isn't an non-aliasing reference (typeof, instanceof, etc)<NEW_LINE>// then there is nothing that can be done.<NEW_LINE>if (!OptimizeCalls.isAllowedReference(n)) {<NEW_LINE>decisionsLog.log("%s\tdisallowed reference: %s", name, n.getLocation());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!seenUse) {<NEW_LINE>decisionsLog.log("%s\tno usage seen", name);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!seenCandidateDefiniton) {<NEW_LINE>decisionsLog.log("%s\tno definition seen", name);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | decisionsLog.log("%s\tnot an optimizable name", name); |
1,696,234 | private void downLines(int nLines, boolean select, boolean extendSelection) {<NEW_LINE>Text textNode = getTextNode();<NEW_LINE>Bounds caretBounds = caretPath.getLayoutBounds();<NEW_LINE>// The middle y coordinate of the the line we want to go to.<NEW_LINE>double targetLineMidY = (caretBounds.getMinY() + caretBounds.getMaxY()) / 2 + nLines * lineHeight;<NEW_LINE>if (targetLineMidY < 0) {<NEW_LINE>targetLineMidY = 0;<NEW_LINE>}<NEW_LINE>// The target x for the caret. This may have been set during a<NEW_LINE>// previous call.<NEW_LINE>double x = (targetCaretX >= 0) ? targetCaretX : (caretBounds.getMaxX());<NEW_LINE>// Find a text position for the target x,y.<NEW_LINE>HitInfo hit = textNode.hitTest(translateCaretPosition(new Point2D(x, targetLineMidY)));<NEW_LINE>int pos = hit.getCharIndex();<NEW_LINE>// Save the old pos temporarily while testing the new one.<NEW_LINE>int oldPos = textNode.getCaretPosition();<NEW_LINE>boolean oldBias = textNode.isCaretBias();<NEW_LINE>textNode.setCaretBias(hit.isLeading());<NEW_LINE>textNode.setCaretPosition(pos);<NEW_LINE>tmpCaretPath.getElements().clear();<NEW_LINE>tmpCaretPath.getElements().<MASK><NEW_LINE>tmpCaretPath.setLayoutX(textNode.getLayoutX());<NEW_LINE>tmpCaretPath.setLayoutY(textNode.getLayoutY());<NEW_LINE>Bounds tmpCaretBounds = tmpCaretPath.getLayoutBounds();<NEW_LINE>// The y for the middle of the row we found.<NEW_LINE>double foundLineMidY = (tmpCaretBounds.getMinY() + tmpCaretBounds.getMaxY()) / 2;<NEW_LINE>textNode.setCaretBias(oldBias);<NEW_LINE>textNode.setCaretPosition(oldPos);<NEW_LINE>// Test if the found line is in the correct direction and move<NEW_LINE>// the caret.<NEW_LINE>if (nLines == 0 || (nLines > 0 && foundLineMidY > caretBounds.getMaxY()) || (nLines < 0 && foundLineMidY < caretBounds.getMinY())) {<NEW_LINE>positionCaret(hit.getInsertionIndex(), hit.isLeading(), select, extendSelection);<NEW_LINE>targetCaretX = x;<NEW_LINE>}<NEW_LINE>} | addAll(textNode.getCaretShape()); |
3,519 | public static OkHttpClient.Builder newBuilder() {<NEW_LINE>Log.d(TAG, "Creating new instance of HTTP client");<NEW_LINE>System.setProperty("http.maxConnections", String.valueOf(MAX_CONNECTIONS));<NEW_LINE>OkHttpClient.Builder builder = new OkHttpClient.Builder();<NEW_LINE>builder.interceptors().add(new BasicAuthorizationInterceptor());<NEW_LINE>builder.networkInterceptors()<MASK><NEW_LINE>// set cookie handler<NEW_LINE>CookieManager cm = new CookieManager();<NEW_LINE>cm.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);<NEW_LINE>builder.cookieJar(new JavaNetCookieJar(cm));<NEW_LINE>// set timeouts<NEW_LINE>builder.connectTimeout(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);<NEW_LINE>builder.readTimeout(READ_TIMEOUT, TimeUnit.MILLISECONDS);<NEW_LINE>builder.writeTimeout(READ_TIMEOUT, TimeUnit.MILLISECONDS);<NEW_LINE>// 20MB<NEW_LINE>builder.cache(new Cache(cacheDirectory, 20L * 1000000));<NEW_LINE>// configure redirects<NEW_LINE>builder.followRedirects(true);<NEW_LINE>builder.followSslRedirects(true);<NEW_LINE>ProxyConfig config = UserPreferences.getProxyConfig();<NEW_LINE>if (config.type != Proxy.Type.DIRECT && !TextUtils.isEmpty(config.host)) {<NEW_LINE>int port = config.port > 0 ? config.port : ProxyConfig.DEFAULT_PORT;<NEW_LINE>SocketAddress address = InetSocketAddress.createUnresolved(config.host, port);<NEW_LINE>builder.proxy(new Proxy(config.type, address));<NEW_LINE>if (!TextUtils.isEmpty(config.username) && config.password != null) {<NEW_LINE>builder.proxyAuthenticator((route, response) -> {<NEW_LINE>String credentials = Credentials.basic(config.username, config.password);<NEW_LINE>return response.request().newBuilder().header("Proxy-Authorization", credentials).build();<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SslClientSetup.installCertificates(builder);<NEW_LINE>return builder;<NEW_LINE>} | .add(new UserAgentInterceptor()); |
770,004 | public void handleItemTooltipEvent(ItemTooltipEvent event) {<NEW_LINE>if (shouldBeDisplayed()) {<NEW_LINE>WrappedStack wrappedItemStack = WrappedStack.build(event.getItemStack());<NEW_LINE>EnergyValue energyValue = EnergyValueRegistryProxy.getEnergyValue(wrappedItemStack);<NEW_LINE>if (energyValue != null && (BlacklistRegistryProxy.isExchangeable(wrappedItemStack) || BlacklistRegistryProxy.isLearnable(wrappedItemStack))) {<NEW_LINE>event.getToolTip().add(String.format("%s%s:%s %s", Colors.TextColor.YELLOW, I18n.format(Messages.Tooltips.ENERGY_VALUE), Colors.TextColor.WHITE, energyValue));<NEW_LINE>} else {<NEW_LINE>event.getToolTip().add(String.format("%s%s", Colors.TextColor.YELLOW, I18n.format(Messages.Tooltips.NO_ENERGY_VALUE)));<NEW_LINE>}<NEW_LINE>if (event.getItemStack().getItem() instanceof IOwnable) {<NEW_LINE>String playerName = ItemStackUtils.getOwner(event.getItemStack());<NEW_LINE>if (playerName != null) {<NEW_LINE>event.getToolTip().add(I18n.format(Messages.Tooltips.ITEM_BELONGS_TO, playerName));<NEW_LINE>} else {<NEW_LINE>event.getToolTip().add(I18n.format<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (Messages.Tooltips.ITEM_BELONGS_TO_NO_ONE)); |
1,283,249 | protected X9ECParameters createParameters() {<NEW_LINE>byte[] S = Hex.decodeStrict("2AA058F73A0E33AB486B0F610410C53A7F132310");<NEW_LINE>ECCurve curve = getCurve();<NEW_LINE>X9ECPoint G = configureBasepoint(curve, "04" + "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19" + "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B");<NEW_LINE>return new X9ECParameters(curve, G, curve.getOrder(), <MASK><NEW_LINE>} | curve.getCofactor(), S); |
1,431,942 | public Object resolve(Injectee injectee, ServiceHandle<?> root) {<NEW_LINE>Type requiredType = injectee.getRequiredType();<NEW_LINE>boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class);<NEW_LINE>Injectee newInjectee;<NEW_LINE>if (isHk2Factory) {<NEW_LINE>newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0));<NEW_LINE>} else {<NEW_LINE>newInjectee = foreignRequestScopedInjecteeCache.apply(new CacheKey(injectee));<NEW_LINE>}<NEW_LINE>ActiveDescriptor<?> ad = descriptorCache.<MASK><NEW_LINE>if (ad != null) {<NEW_LINE>final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee);<NEW_LINE>if (isHk2Factory) {<NEW_LINE>return asFactory(handle);<NEW_LINE>} else {<NEW_LINE>return handle.getService();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | apply(new CacheKey(newInjectee)); |
1,140,537 | public <T> Mono<Void> singleRequestNoResponse(ClientRequestPayload<T> payload, RpcOptions options) {<NEW_LINE>try {<NEW_LINE>final String name = payload.getRequestRpcMetadata().getName();<NEW_LINE>final long start = System.nanoTime();<NEW_LINE>final InstrumentedClientRequestPayload<T> instrumentedClientRequestPayload = new InstrumentedClientRequestPayload<>(payload, name, thriftClientStats);<NEW_LINE>thriftClientStats.call(name);<NEW_LINE>return delegate.singleRequestNoResponse(instrumentedClientRequestPayload, options).doFinally(signalType -> {<NEW_LINE>if (signalType == SignalType.ON_ERROR) {<NEW_LINE>thriftClientStats.error(name);<NEW_LINE>}<NEW_LINE>thriftClientStats.complete(name, toMicros(System<MASK><NEW_LINE>});<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (payload != null && payload.getRequestRpcMetadata() != null && payload.getRequestRpcMetadata().getName() != null) {<NEW_LINE>thriftClientStats.error(payload.getRequestRpcMetadata().getName());<NEW_LINE>}<NEW_LINE>return Mono.error(t);<NEW_LINE>}<NEW_LINE>} | .nanoTime() - start)); |
858,668 | public void start() throws Exception {<NEW_LINE>// Kafka setup for the example<NEW_LINE>File dataDir = Testing.Files.createTestingDirectory("cluster");<NEW_LINE>dataDir.deleteOnExit();<NEW_LINE>kafkaCluster = new KafkaCluster().usingDirectory(dataDir).withPorts(2181, 9092).addBrokers(1).<MASK><NEW_LINE>// Deploy the dashboard<NEW_LINE>JsonObject consumerConfig = new JsonObject((Map) kafkaCluster.useTo().getConsumerProperties("the_group", "the_client", OffsetResetStrategy.LATEST));<NEW_LINE>vertx.deployVerticle(DashboardVerticle.class.getName(), new DeploymentOptions().setConfig(consumerConfig));<NEW_LINE>// Deploy the metrics collector : 3 times<NEW_LINE>for (int i = 0; i < 3; i++) {<NEW_LINE>JsonObject producerConfig = new JsonObject((Map) kafkaCluster.useTo().getProducerProperties("the_producer-" + i));<NEW_LINE>vertx.deployVerticle(MetricsVerticle.class.getName(), new DeploymentOptions().setConfig(producerConfig));<NEW_LINE>}<NEW_LINE>} | deleteDataPriorToStartup(true).startup(); |
372,691 | public static ListInboundOrdersResponse unmarshall(ListInboundOrdersResponse listInboundOrdersResponse, UnmarshallerContext _ctx) {<NEW_LINE>listInboundOrdersResponse.setRequestId(_ctx.stringValue("ListInboundOrdersResponse.RequestId"));<NEW_LINE>listInboundOrdersResponse.setPageSize(_ctx.integerValue("ListInboundOrdersResponse.PageSize"));<NEW_LINE>listInboundOrdersResponse.setTotalCount(_ctx.integerValue("ListInboundOrdersResponse.TotalCount"));<NEW_LINE>listInboundOrdersResponse.setPageNumber(_ctx.integerValue("ListInboundOrdersResponse.PageNumber"));<NEW_LINE>listInboundOrdersResponse.setSuccess(_ctx.booleanValue("ListInboundOrdersResponse.Success"));<NEW_LINE>List<InboundOrder> inboundOrders = new ArrayList<InboundOrder>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListInboundOrdersResponse.InboundOrders.Length"); i++) {<NEW_LINE>InboundOrder inboundOrder = new InboundOrder();<NEW_LINE>inboundOrder.setToWarehouseName(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ToWarehouseName"));<NEW_LINE>inboundOrder.setConfirmTime(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ConfirmTime"));<NEW_LINE>inboundOrder.setOrderSubTypeCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].OrderSubTypeCode"));<NEW_LINE>inboundOrder.setOrderStatus(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].OrderStatus"));<NEW_LINE>inboundOrder.setDescription(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].Description"));<NEW_LINE>inboundOrder.setOperateQuantity(_ctx.integerValue("ListInboundOrdersResponse.InboundOrders[" + i + "].OperateQuantity"));<NEW_LINE>inboundOrder.setFromWarehouseId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].FromWarehouseId"));<NEW_LINE>inboundOrder.setLastSyncTime(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].LastSyncTime"));<NEW_LINE>inboundOrder.setConfirmQuantity(_ctx.integerValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ConfirmQuantity"));<NEW_LINE>inboundOrder.setModifiedTime(_ctx.stringValue<MASK><NEW_LINE>inboundOrder.setFromBusinessUnitId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].FromBusinessUnitId"));<NEW_LINE>inboundOrder.setId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].Id"));<NEW_LINE>inboundOrder.setFromBusinessUnitName(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].FromBusinessUnitName"));<NEW_LINE>inboundOrder.setOrderCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].OrderCode"));<NEW_LINE>inboundOrder.setCreatedTime(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].CreatedTime"));<NEW_LINE>inboundOrder.setToWarehouseId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ToWarehouseId"));<NEW_LINE>inboundOrder.setSyncStatus(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].SyncStatus"));<NEW_LINE>inboundOrder.setFromWarehouseName(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].FromWarehouseName"));<NEW_LINE>inboundOrder.setQuantity(_ctx.integerValue("ListInboundOrdersResponse.InboundOrders[" + i + "].Quantity"));<NEW_LINE>inboundOrder.setSourceOrderCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].SourceOrderCode"));<NEW_LINE>inboundOrder.setOrderId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].OrderId"));<NEW_LINE>inboundOrder.setToBusinessUnitId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ToBusinessUnitId"));<NEW_LINE>inboundOrder.setCaseCount(_ctx.integerValue("ListInboundOrdersResponse.InboundOrders[" + i + "].CaseCount"));<NEW_LINE>inboundOrder.setToWarehouseCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ToWarehouseCode"));<NEW_LINE>inboundOrder.setFromWarehouseCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].FromWarehouseCode"));<NEW_LINE>inboundOrder.setToBusinessUnitCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].ToBusinessUnitCode"));<NEW_LINE>inboundOrder.setFromBusinessUnitCode(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].FromBusinessUnitCode"));<NEW_LINE>inboundOrder.setCreateUserId(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].CreateUserId"));<NEW_LINE>inboundOrder.setCreateUserName(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].CreateUserName"));<NEW_LINE>inboundOrder.setCreateDateTime(_ctx.stringValue("ListInboundOrdersResponse.InboundOrders[" + i + "].CreateDateTime"));<NEW_LINE>inboundOrders.add(inboundOrder);<NEW_LINE>}<NEW_LINE>listInboundOrdersResponse.setInboundOrders(inboundOrders);<NEW_LINE>return listInboundOrdersResponse;<NEW_LINE>} | ("ListInboundOrdersResponse.InboundOrders[" + i + "].ModifiedTime")); |
907,406 | public void binaryAccessRead(@IdParam IIdType theResourceId, @OperationParam(name = "path", min = 1, max = 1) IPrimitiveType<String> thePath, ServletRequestDetails theRequestDetails, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws IOException {<NEW_LINE>String path = validateResourceTypeAndPath(theResourceId, thePath);<NEW_LINE>IFhirResourceDao dao = getDaoForRequest(theResourceId);<NEW_LINE>IBaseResource resource = dao.read(theResourceId, theRequestDetails, false);<NEW_LINE>IBinaryTarget target = findAttachmentForRequest(resource, path, theRequestDetails);<NEW_LINE>Optional<String> attachmentId = target.getAttachmentId();<NEW_LINE>// for unit test only<NEW_LINE>if (addTargetAttachmentIdForTest) {<NEW_LINE>attachmentId = Optional.of("1");<NEW_LINE>}<NEW_LINE>if (attachmentId.isPresent()) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>String blobId = attachmentId.get();<NEW_LINE>StoredDetails blobDetails = myBinaryStorageSvc.fetchBlobDetails(theResourceId, blobId);<NEW_LINE>if (blobDetails == null) {<NEW_LINE>String msg = myCtx.getLocalizer().getMessage(BinaryAccessProvider.class, "unknownBlobId");<NEW_LINE>throw new InvalidRequestException(Msg.code(1331) + msg);<NEW_LINE>}<NEW_LINE>theServletResponse.setStatus(200);<NEW_LINE>theServletResponse.setContentType(blobDetails.getContentType());<NEW_LINE>if (blobDetails.getBytes() <= Integer.MAX_VALUE) {<NEW_LINE>theServletResponse.setContentLength((int) blobDetails.getBytes());<NEW_LINE>}<NEW_LINE>RestfulServer server = theRequestDetails.getServer();<NEW_LINE>server.addHeadersToResponse(theServletResponse);<NEW_LINE>theServletResponse.addHeader(Constants.HEADER_CACHE_CONTROL, Constants.CACHE_CONTROL_PRIVATE);<NEW_LINE>theServletResponse.addHeader(Constants.HEADER_ETAG, '"' + blobDetails.getHash() + '"');<NEW_LINE>theServletResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(blobDetails.getPublished()));<NEW_LINE>myBinaryStorageSvc.writeBlob(theResourceId, blobId, theServletResponse.getOutputStream());<NEW_LINE>theServletResponse.getOutputStream().close();<NEW_LINE>} else {<NEW_LINE>String contentType = target.getContentType();<NEW_LINE>contentType = StringUtils.defaultIfBlank(contentType, Constants.CT_OCTET_STREAM);<NEW_LINE>byte[] data = target.getData();<NEW_LINE>if (data == null) {<NEW_LINE>String msg = myCtx.getLocalizer().getMessage(BinaryAccessProvider.class, "noAttachmentDataPresent", sanitizeUrlPart(theResourceId), sanitizeUrlPart(thePath));<NEW_LINE>throw new InvalidRequestException(Msg.code(1332) + msg);<NEW_LINE>}<NEW_LINE>theServletResponse.setStatus(200);<NEW_LINE>theServletResponse.setContentType(contentType);<NEW_LINE>theServletResponse.setContentLength(data.length);<NEW_LINE>RestfulServer server = theRequestDetails.getServer();<NEW_LINE>server.addHeadersToResponse(theServletResponse);<NEW_LINE>theServletResponse.<MASK><NEW_LINE>theServletResponse.getOutputStream().close();<NEW_LINE>}<NEW_LINE>} | getOutputStream().write(data); |
1,763,985 | public static MWMResponse extractFromIntent(@SuppressWarnings("unused") final Context context, final Intent intent) {<NEW_LINE><MASK><NEW_LINE>// parse point<NEW_LINE>final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, INVALID_LL);<NEW_LINE>final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, INVALID_LL);<NEW_LINE>final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);<NEW_LINE>final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);<NEW_LINE>// parse additional info<NEW_LINE>response.mZoomLevel = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_ZOOM, 9);<NEW_LINE>if (lat != INVALID_LL && lon != INVALID_LL) {<NEW_LINE>response.mPoint = new MWMPoint(lat, lon, name, id);<NEW_LINE>} else {<NEW_LINE>response.mPoint = null;<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | final MWMResponse response = new MWMResponse(); |
1,456,802 | private static double lengthReductionToStayWithinBounds(Point2D centerPoint, double width, double height, Rectangle2D bounds) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Objects.requireNonNull(centerPoint, "The specified center point of the new rectangle must not be null.");<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Objects.requireNonNull(bounds, "The specified bounds for the new rectangle must not be null.");<NEW_LINE>boolean centerPointInBounds = bounds.contains(centerPoint);<NEW_LINE>if (!centerPointInBounds) {<NEW_LINE>throw new // $NON-NLS-1$<NEW_LINE>IllegalArgumentException(// $NON-NLS-1$<NEW_LINE>"The center point " + centerPoint + " of the original rectangle is out of the specified bounds.");<NEW_LINE>}<NEW_LINE>if (width < 0) {<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>throw new IllegalArgumentException("The specified width " + width + " must be larger than zero.");<NEW_LINE>}<NEW_LINE>if (height < 0) {<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>throw new IllegalArgumentException("The specified height " + height + " must be larger than zero.");<NEW_LINE>}<NEW_LINE>double distanceToEast = Math.abs(centerPoint.getX() - bounds.getMinX());<NEW_LINE>double distanceToWest = Math.abs(centerPoint.getX() - bounds.getMaxX());<NEW_LINE>double distanceToNorth = Math.abs(centerPoint.getY() - bounds.getMinY());<NEW_LINE>double distanceToSouth = Math.abs(centerPoint.getY(<MASK><NEW_LINE>// the returned factor must not be greater than one; otherwise the size would increase<NEW_LINE>return MathTools.min(1, distanceToEast / width * 2, distanceToWest / width * 2, distanceToNorth / height * 2, distanceToSouth / height * 2);<NEW_LINE>} | ) - bounds.getMaxY()); |
775,761 | public Object unwrapJavaObject(Object object, boolean tryAssociativeArray) {<NEW_LINE>if (object == null)<NEW_LINE>return null;<NEW_LINE>String className = object.getClass().getName();<NEW_LINE>// NOI18N<NEW_LINE>boolean // NOI18N<NEW_LINE>isNativeJS = // NOI18N<NEW_LINE>className.contains(".javascript.") || // NOI18N<NEW_LINE>className.equals("jdk.nashorn.api.scripting.ScriptObjectMirror") || // NOI18N<NEW_LINE>className.startsWith("com.oracle.truffle.object.") || className.equals("org.graalvm.polyglot.Value");<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>Object ret = ((Invocable) engine).invokeFunction("unwrapJavaObjectRes", object);<NEW_LINE>if (isNativeJS && ret == null && tryAssociativeArray) {<NEW_LINE>// NOI18N<NEW_LINE>ret = ((Invocable) engine).invokeFunction("unwrapMap", object);<NEW_LINE>}<NEW_LINE>if (ret == null) {<NEW_LINE>return object;<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// NOI18N<NEW_LINE>LOGGER.log(<MASK><NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | Level.WARNING, "Error unwrapping JS object", ex); |
790,451 | private void postTouchEvent(TouchState state, int eventType) {<NEW_LINE>Window window = state.getWindow(false, null);<NEW_LINE>View view = window == null ? null : window.getView();<NEW_LINE>if (view != null) {<NEW_LINE>switch(state.getPointCount()) {<NEW_LINE>case 0:<NEW_LINE>postNoPoints(view);<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>postPoint(window, view, eventType<MASK><NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>int count = state.getPointCount();<NEW_LINE>int[] states = new int[count];<NEW_LINE>int[] ids = new int[count];<NEW_LINE>int[] xs = new int[count];<NEW_LINE>int[] ys = new int[count];<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>states[i] = eventType;<NEW_LINE>TouchState.Point p = state.getPoint(i);<NEW_LINE>ids[i] = p.id;<NEW_LINE>xs[i] = p.x;<NEW_LINE>ys[i] = p.y;<NEW_LINE>}<NEW_LINE>postPoints(window, view, states, ids, xs, ys);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , state.getPoint(0)); |
1,518,361 | public Object doQuery(Object[] objs) {<NEW_LINE>try {<NEW_LINE>boolean bCursor = false;<NEW_LINE>if (m_conn.m_bClose)<NEW_LINE>return null;<NEW_LINE>if (option != null) {<NEW_LINE>if (option.indexOf("c") != -1) {<NEW_LINE>bCursor = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Integer> partitions <MASK><NEW_LINE>long timeout = 1000;<NEW_LINE>if (objs != null) {<NEW_LINE>if (objs.length > 1) {<NEW_LINE>if (objs[1] instanceof Integer) {<NEW_LINE>partitions.add((Integer) objs[1]);<NEW_LINE>} else if (objs[1] instanceof Sequence) {<NEW_LINE>Sequence seq = (Sequence) objs[1];<NEW_LINE>for (int i = 0; i < seq.length(); i++) {<NEW_LINE>partitions.add((Integer) seq.get(i + 1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>timeout = Integer.parseInt(objs[0].toString());<NEW_LINE>}<NEW_LINE>int nPartSize = -1;<NEW_LINE>if (m_conn.isCluster()) {<NEW_LINE>nPartSize = partitions.size();<NEW_LINE>m_conn.m_cols = new String[] { "partition", "offset", "key", "value" };<NEW_LINE>m_conn.initConsumerCluster(partitions);<NEW_LINE>} else {<NEW_LINE>m_conn.initConsumer();<NEW_LINE>}<NEW_LINE>if (bCursor) {<NEW_LINE>return new ImCursor(m_ctx, m_conn, timeout, nPartSize);<NEW_LINE>} else {<NEW_LINE>List<Object[]> ls = null;<NEW_LINE>if (m_conn.isCluster()) {<NEW_LINE>ls = ImFunction.getClusterData(m_conn, timeout, partitions.size());<NEW_LINE>} else {<NEW_LINE>ls = ImFunction.getData(m_conn, timeout);<NEW_LINE>}<NEW_LINE>return ImFunction.toTable(m_conn.m_cols, ls);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | = new ArrayList<Integer>(); |
592,186 | public void enterNeighbor_block_rb_stanza(Neighbor_block_rb_stanzaContext ctx) {<NEW_LINE>_currentBlockNeighborAddressFamilies.clear();<NEW_LINE>_inBlockNeighbor = true;<NEW_LINE>// do no further processing for unsupported address families / containers<NEW_LINE>if (_currentPeerGroup == _dummyPeerGroup) {<NEW_LINE>pushPeer(_dummyPeerGroup);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BgpProcess proc = currentVrf().getBgpProcess();<NEW_LINE>if (ctx.ip_address != null) {<NEW_LINE>Ip ip = toIp(ctx.ip_address);<NEW_LINE>_currentIpPeerGroup = proc.getIpPeerGroups().get(ip);<NEW_LINE>if (_currentIpPeerGroup == null) {<NEW_LINE>_currentIpPeerGroup = proc.addIpPeerGroup(ip);<NEW_LINE>} else {<NEW_LINE>warn(ctx, "Duplicate IP peer group in neighbor config.");<NEW_LINE>}<NEW_LINE>pushPeer(_currentIpPeerGroup);<NEW_LINE>} else if (ctx.ip_prefix != null) {<NEW_LINE>Prefix prefix = Prefix.parse(ctx.ip_prefix.getText());<NEW_LINE>_currentDynamicIpPeerGroup = proc.getDynamicIpPeerGroups().get(prefix);<NEW_LINE>if (_currentDynamicIpPeerGroup == null) {<NEW_LINE>_currentDynamicIpPeerGroup = proc.addDynamicIpPeerGroup(prefix);<NEW_LINE>} else {<NEW_LINE>warn(ctx, "Duplicate DynamicIP peer group neighbor config.");<NEW_LINE>}<NEW_LINE>pushPeer(_currentDynamicIpPeerGroup);<NEW_LINE>} else if (ctx.ipv6_address != null) {<NEW_LINE>Ip6 ip6 = toIp6(ctx.ipv6_address);<NEW_LINE>Ipv6BgpPeerGroup pg = proc.<MASK><NEW_LINE>if (pg == null) {<NEW_LINE>pg = proc.addIpv6PeerGroup(ip6);<NEW_LINE>} else {<NEW_LINE>warn(ctx, "Duplicate IPV6 peer group in neighbor config.");<NEW_LINE>}<NEW_LINE>pushPeer(pg);<NEW_LINE>_currentIpv6PeerGroup = pg;<NEW_LINE>} else if (ctx.ipv6_prefix != null) {<NEW_LINE>Prefix6 prefix6 = Prefix6.parse(ctx.ipv6_prefix.getText());<NEW_LINE>DynamicIpv6BgpPeerGroup pg = proc.getDynamicIpv6PeerGroups().get(prefix6);<NEW_LINE>if (pg == null) {<NEW_LINE>pg = proc.addDynamicIpv6PeerGroup(prefix6);<NEW_LINE>} else {<NEW_LINE>warn(ctx, "Duplicate Dynamic Ipv6 peer group neighbor config.");<NEW_LINE>}<NEW_LINE>pushPeer(pg);<NEW_LINE>_currentDynamicIpv6PeerGroup = pg;<NEW_LINE>}<NEW_LINE>if (ctx.bgp_asn() != null) {<NEW_LINE>long remoteAs = toAsNum(ctx.bgp_asn());<NEW_LINE>_currentPeerGroup.setRemoteAs(remoteAs);<NEW_LINE>}<NEW_LINE>_currentPeerGroup.setActive(true);<NEW_LINE>_currentPeerGroup.setShutdown(false);<NEW_LINE>} | getIpv6PeerGroups().get(ip6); |
1,259,000 | private void extractJars(Set<File> jars) {<NEW_LINE>File jarExpandDir = getJarExpandDir();<NEW_LINE>// We need to clean up to make sure old dependencies don't linger<NEW_LINE>getProject().delete(jarExpandDir);<NEW_LINE>jars.forEach(jar -> {<NEW_LINE>FileTree jarFiles = getProject().zipTree(jar);<NEW_LINE>getProject().copy(spec -> {<NEW_LINE>spec.from(jarFiles);<NEW_LINE>spec.into(jarExpandDir);<NEW_LINE>// exclude classes from multi release jars<NEW_LINE>spec.exclude("META-INF/versions/**");<NEW_LINE>});<NEW_LINE>// Deal with multi release jars:<NEW_LINE>// The order is important, we iterate here so we don't depend on the order in which Gradle executes the spec<NEW_LINE>// We extract multi release jar classes ( if these exist ) going from 9 - the first to support them, to the<NEW_LINE>// current `targetCompatibility` version.<NEW_LINE>// Each extract will overwrite the top level classes that existed before it, the result is that we end up<NEW_LINE>// with a single version of the class in `jarExpandDir`.<NEW_LINE>// This will be the closes version to `targetCompatibility`, the same class that would be loaded in a JVM<NEW_LINE>// that has `targetCompatibility` version.<NEW_LINE>// This means we only scan classes that would be loaded into `targetCompatibility`, and don't look at any<NEW_LINE>// pther version specific implementation of said classes.<NEW_LINE>IntStream.rangeClosed(Integer.parseInt(JavaVersion.VERSION_1_9.getMajorVersion()), Integer.parseInt(targetCompatibility.get().getMajorVersion())).forEach(majorVersion -> getProject().copy(spec -> {<NEW_LINE>spec.from(getProject().zipTree(jar));<NEW_LINE>spec.into(jarExpandDir);<NEW_LINE>String metaInfPrefix = "META-INF/versions/" + majorVersion;<NEW_LINE><MASK><NEW_LINE>// Drop the version specific prefix<NEW_LINE>spec.eachFile(details -> details.setPath(details.getPath().replace(metaInfPrefix, "")));<NEW_LINE>spec.setIncludeEmptyDirs(false);<NEW_LINE>}));<NEW_LINE>});<NEW_LINE>} | spec.include(metaInfPrefix + "/**"); |
1,500,965 | public static DescribeReplicationsResponse unmarshall(DescribeReplicationsResponse describeReplicationsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeReplicationsResponse.setRequestId(_ctx.stringValue("DescribeReplicationsResponse.RequestId"));<NEW_LINE>describeReplicationsResponse.setSuccess(_ctx.booleanValue("DescribeReplicationsResponse.Success"));<NEW_LINE>describeReplicationsResponse.setCode(_ctx.stringValue("DescribeReplicationsResponse.Code"));<NEW_LINE>describeReplicationsResponse.setMessage(_ctx.stringValue("DescribeReplicationsResponse.Message"));<NEW_LINE>describeReplicationsResponse.setTotalCount(_ctx.integerValue("DescribeReplicationsResponse.TotalCount"));<NEW_LINE>describeReplicationsResponse.setPageNumber(_ctx.integerValue("DescribeReplicationsResponse.PageNumber"));<NEW_LINE>describeReplicationsResponse.setPageSize(_ctx.integerValue("DescribeReplicationsResponse.PageSize"));<NEW_LINE>List<Replication> replications = new ArrayList<Replication>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeReplicationsResponse.Replications.Length"); i++) {<NEW_LINE>Replication replication = new Replication();<NEW_LINE>replication.setReplicationId(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].ReplicationId"));<NEW_LINE>replication.setGatewayId(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].GatewayId"));<NEW_LINE>replication.setGatewayName(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].GatewayName"));<NEW_LINE>replication.setInstanceIp(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].InstanceIp"));<NEW_LINE>replication.setInstanceName(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].InstanceName"));<NEW_LINE>replication.setOsType(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].OsType"));<NEW_LINE>replication.setBackupType(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].BackupType"));<NEW_LINE>replication.setApplications(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].Applications"));<NEW_LINE>replication.setProtectedTime(_ctx.longValue<MASK><NEW_LINE>replication.setStatus(_ctx.stringValue("DescribeReplicationsResponse.Replications[" + i + "].Status"));<NEW_LINE>replications.add(replication);<NEW_LINE>}<NEW_LINE>describeReplicationsResponse.setReplications(replications);<NEW_LINE>return describeReplicationsResponse;<NEW_LINE>} | ("DescribeReplicationsResponse.Replications[" + i + "].ProtectedTime")); |
172,798 | public boolean eventOccurred(UISWTViewEvent event) {<NEW_LINE>UISWTView currentView = event.getView();<NEW_LINE>switch(event.getType()) {<NEW_LINE>case UISWTViewEvent.TYPE_CREATE:<NEW_LINE>{<NEW_LINE>SWTSkin skin = SWTSkinFactory.getNonPersistentInstance(getClass().getClassLoader(), skin_folder, skin_file);<NEW_LINE>subviews.put(currentView, new ViewHolder(currentView, skin));<NEW_LINE>event.getView().setDestroyOnDeactivate(false);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case UISWTViewEvent.TYPE_INITIALIZE:<NEW_LINE>{<NEW_LINE>ViewHolder subview = subviews.get(currentView);<NEW_LINE>if (subview != null) {<NEW_LINE>subview.initialise((Composite) event.getData(), currentView.getDataSource());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case UISWTViewEvent.TYPE_DATASOURCE_CHANGED:<NEW_LINE>{<NEW_LINE>ViewHolder subview = subviews.get(currentView);<NEW_LINE>if (subview != null) {<NEW_LINE>subview.setDataSource(event.getData());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case UISWTViewEvent.TYPE_FOCUSLOST:<NEW_LINE>{<NEW_LINE>ViewHolder subview = subviews.get(currentView);<NEW_LINE>if (subview != null) {<NEW_LINE>subview.focusLost();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case UISWTViewEvent.TYPE_FOCUSGAINED:<NEW_LINE>{<NEW_LINE>ViewHolder <MASK><NEW_LINE>if (subview != null) {<NEW_LINE>subview.focusGained();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case UISWTViewEvent.TYPE_DESTROY:<NEW_LINE>{<NEW_LINE>ViewHolder subview = subviews.remove(currentView);<NEW_LINE>if (subview != null) {<NEW_LINE>subview.destroy();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (true);<NEW_LINE>} | subview = subviews.get(currentView); |
1,115,995 | public void marshall(Cluster cluster, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (cluster == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(cluster.getBackupPolicy(), BACKUPPOLICY_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getBackupRetentionPolicy(), BACKUPRETENTIONPOLICY_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(cluster.getCreateTimestamp(), CREATETIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getHsms(), HSMS_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getHsmType(), HSMTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getPreCoPassword(), PRECOPASSWORD_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getSecurityGroup(), SECURITYGROUP_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getSourceBackupId(), SOURCEBACKUPID_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getState(), STATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getStateMessage(), STATEMESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getSubnetMapping(), SUBNETMAPPING_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getVpcId(), VPCID_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getCertificates(), CERTIFICATES_BINDING);<NEW_LINE>protocolMarshaller.marshall(cluster.getTagList(), TAGLIST_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | cluster.getClusterId(), CLUSTERID_BINDING); |
773,947 | private static String extractHostFromURL(String url) {<NEW_LINE>// see RFC 1738<NEW_LINE>// remove ':' after protocol, e.g. http:<NEW_LINE>String sub = url.substring(url.indexOf(':') + 1);<NEW_LINE>// extract host from Common Internet Scheme Syntax, e.g. http://<NEW_LINE>if (sub.indexOf("//") != -1) {<NEW_LINE>sub = sub.substring(sub.indexOf("//") + 2);<NEW_LINE>}<NEW_LINE>// first remove port, e.g. http://test.com:21<NEW_LINE>if (sub.lastIndexOf(':') != -1) {<NEW_LINE>sub = sub.substring(0, sub.lastIndexOf(':'));<NEW_LINE>}<NEW_LINE>// remove user and password, e.g. http://john:password@test.com<NEW_LINE>sub = sub.substring(sub.indexOf(':') + 1);<NEW_LINE>sub = sub.substring(sub.indexOf('@') + 1);<NEW_LINE>// remove local parts, e.g. http://test.com/bla<NEW_LINE>if (sub.indexOf('/') != -1) {<NEW_LINE>sub = sub.substring(0<MASK><NEW_LINE>}<NEW_LINE>return sub;<NEW_LINE>} | , sub.indexOf('/')); |
563,896 | private void updateValue(String resourceUuid, String resourceType, String newValue, boolean localUpdate) {<NEW_LINE>String originValue = loadConfigValue(resourceUuid);<NEW_LINE>String oldValue = originValue == null ? globalConfig.value() : originValue;<NEW_LINE>if (localUpdate) {<NEW_LINE>globalConfig.getValidators().forEach(it -> it.validateGlobalConfig(globalConfig.getCategory(), globalConfig.getName<MASK><NEW_LINE>validatorExtensions.forEach(it -> it.validateResourceConfig(resourceUuid, oldValue, newValue));<NEW_LINE>updateValueInDb(resourceUuid, resourceType, newValue);<NEW_LINE>localUpdateExtensions.forEach(it -> it.updateResourceConfig(this, resourceUuid, resourceType, oldValue, newValue));<NEW_LINE>}<NEW_LINE>updateExtensions.forEach(it -> it.updateResourceConfig(this, resourceUuid, resourceType, oldValue, newValue));<NEW_LINE>if (localUpdate) {<NEW_LINE>UpdateEvent evt = new UpdateEvent();<NEW_LINE>evt.setResourceUuid(resourceUuid);<NEW_LINE>evt.setOldValue(oldValue);<NEW_LINE>evtf.fire(makeUpdateEventPath(), evt);<NEW_LINE>}<NEW_LINE>logger.debug(String.format("updated resource config[resourceUuid:%s, resourceType:%s, category:%s, name:%s]: %s to %s", resourceUuid, resourceType, globalConfig.getCategory(), globalConfig.getName(), oldValue, newValue));<NEW_LINE>} | (), oldValue, newValue)); |
1,519,849 | public void paintDynamic(Graphics g, CircuitState state) {<NEW_LINE>int x = bounds.getX() + 1;<NEW_LINE>int y <MASK><NEW_LINE>int w = bounds.getWidth() - 2;<NEW_LINE>int h = bounds.getHeight() - 2;<NEW_LINE>GraphicsUtil.switchToWidth(g, strokeWidth);<NEW_LINE>if (state == null) {<NEW_LINE>g.setColor(Color.lightGray);<NEW_LINE>g.fillOval(x, y, w, h);<NEW_LINE>g.setColor(DynamicElement.COLOR);<NEW_LINE>} else {<NEW_LINE>final var activ = path.leaf().getAttributeSet().getValue(IoLibrary.ATTR_ACTIVE);<NEW_LINE>final var data = (InstanceDataSingleton) getData(state);<NEW_LINE>var summ = (data == null ? 0 : (Integer) data.getValue());<NEW_LINE>final var mask = activ ? 0 : 7;<NEW_LINE>summ ^= mask;<NEW_LINE>final var red = ((summ >> RgbLed.RED) & 1) * 0xFF;<NEW_LINE>final var green = ((summ >> RgbLed.GREEN) & 1) * 0xFF;<NEW_LINE>final var blue = ((summ >> RgbLed.BLUE) & 1) * 0xFF;<NEW_LINE>g.setColor(new Color(red, green, blue));<NEW_LINE>g.fillOval(x, y, w, h);<NEW_LINE>g.setColor(Color.darkGray);<NEW_LINE>}<NEW_LINE>g.drawOval(x, y, w, h);<NEW_LINE>drawLabel(g);<NEW_LINE>} | = bounds.getY() + 1; |
1,482,416 | public okhttp3.Call importServiceFromCatalogCall(String serviceKey, APIDTO APIDTO, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = APIDTO;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/apis/import-service";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (serviceKey != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("serviceKey", serviceKey));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new <MASK><NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = { "application/json" };<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "OAuth2Security" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | HashMap<String, Object>(); |
878,119 | public ResultSet executeQuery(String sql) throws SQLException {<NEW_LINE>synchronized (this) {<NEW_LINE>if (isClosed()) {<NEW_LINE>throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_STATEMENT_CLOSED);<NEW_LINE>}<NEW_LINE>if (this.resultSet != null && !this.resultSet.isClosed())<NEW_LINE>this.resultSet.close();<NEW_LINE>// TODO:<NEW_LINE>// this is an unreasonable implementation, if the paratemer is a insert statement,<NEW_LINE>// the JNI connector will execute the sql at first and return a pointer: pSql,<NEW_LINE>// we use this pSql and invoke the isUpdateQuery(long pSql) method to decide .<NEW_LINE>// but the insert sql is already executed in database.<NEW_LINE>// execute query<NEW_LINE>long pSql = this.connection.getConnector().executeQuery(sql);<NEW_LINE>// if pSql is create/insert/update/delete/alter SQL<NEW_LINE>if (this.connection.getConnector().isUpdateQuery(pSql)) {<NEW_LINE>this.connection.getConnector().freeResultSet(pSql);<NEW_LINE>throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_WITH_EXECUTEQUERY);<NEW_LINE>}<NEW_LINE>int timestampPrecision = this.connection.getConnector().getResultTimePrecision(pSql);<NEW_LINE>resultSet = new TSDBResultSet(this, this.connection.getConnector(), pSql, timestampPrecision);<NEW_LINE>resultSet.setBatchFetch(<MASK><NEW_LINE>return resultSet;<NEW_LINE>}<NEW_LINE>} | this.connection.getBatchFetch()); |
433,911 | protected BlockWriteRequestContext createRequestContext(alluxio.grpc.WriteRequest msg) throws Exception {<NEW_LINE>long bytesToReserve = FILE_BUFFER_SIZE;<NEW_LINE>if (msg.getCommand().hasSpaceToReserve()) {<NEW_LINE>bytesToReserve = msg.getCommand().getSpaceToReserve();<NEW_LINE>}<NEW_LINE>BlockWriteRequestContext context = new BlockWriteRequestContext(msg, bytesToReserve);<NEW_LINE><MASK><NEW_LINE>mWorker.createBlock(request.getSessionId(), request.getId(), request.getTier(), request.getMediumType(), bytesToReserve);<NEW_LINE>if (mDomainSocketEnabled) {<NEW_LINE>context.setCounter(MetricsSystem.counter(MetricKey.WORKER_BYTES_WRITTEN_DOMAIN.getName()));<NEW_LINE>context.setMeter(MetricsSystem.meter(MetricKey.WORKER_BYTES_WRITTEN_DOMAIN_THROUGHPUT.getName()));<NEW_LINE>} else {<NEW_LINE>context.setCounter(MetricsSystem.counter(MetricKey.WORKER_BYTES_WRITTEN_REMOTE.getName()));<NEW_LINE>context.setMeter(MetricsSystem.meter(MetricKey.WORKER_BYTES_WRITTEN_REMOTE_THROUGHPUT.getName()));<NEW_LINE>}<NEW_LINE>RPC_WRITE_COUNT.inc();<NEW_LINE>return context;<NEW_LINE>} | BlockWriteRequest request = context.getRequest(); |
335,562 | private void addSetter(final JCheckBox checkBox, final PropertyCharacteristicSetter setter) {<NEW_LINE>checkBox.addActionListener(e -> {<NEW_LINE>if (getProperty() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (checkBox.isSelected()) {<NEW_LINE>FreshAxiomLocationPreferences preferences = FreshAxiomLocationPreferences.getPreferences();<NEW_LINE>FreshAxiomLocationStrategyFactory strategyFactory = preferences.getFreshAxiomLocation().getStrategyFactory();<NEW_LINE>FreshAxiomLocationStrategy strategy = strategyFactory.getStrategy(getOWLEditorKit());<NEW_LINE>OWLAxiom ax = setter.getAxiom();<NEW_LINE>OWLOntology ont = strategy.getFreshAxiomLocation(ax, getOWLModelManager());<NEW_LINE>getOWLModelManager().applyChange(new AddAxiom(ont, ax));<NEW_LINE>} else {<NEW_LINE>List<OWLOntologyChange> changes = new ArrayList<>();<NEW_LINE>OWLAxiom ax = setter.getAxiom();<NEW_LINE>for (OWLOntology ont : getOWLModelManager().getActiveOntologies()) {<NEW_LINE>changes.add(<MASK><NEW_LINE>}<NEW_LINE>getOWLModelManager().applyChanges(changes);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | new RemoveAxiom(ont, ax)); |
1,288,411 | public Map<String, ?> convertUserAuthentication(Authentication authentication) {<NEW_LINE>LinkedHashMap<String, Object> response = new LinkedHashMap<>();<NEW_LINE>UserDO userDo = (UserDO) authentication.getPrincipal();<NEW_LINE>response.put(AuthJwtConstants.<MASK><NEW_LINE>response.put(AuthJwtConstants.JWT_USER_ID_CLAIM_KEY, userDo.getUserId());<NEW_LINE>response.put(AuthJwtConstants.JWT_BUC_ID_CLAIM_KEY, userDo.getBucId());<NEW_LINE>response.put(AuthJwtConstants.JWT_ALIYUN_PK_CLAIM_KEY, userDo.getAliyunPk());<NEW_LINE>response.put(AuthJwtConstants.JWT_NICKNAME_CLAIM_KEY, userDo.getNickName());<NEW_LINE>response.put(AuthJwtConstants.JWT_EMP_ID_CLAIM_KEY, userDo.getEmpId());<NEW_LINE>response.put(AuthJwtConstants.JWT_EMAIL_CLAIM_KEY, userDo.getEmail());<NEW_LINE>return response;<NEW_LINE>} | JWT_LOGIN_NAME_CLAIM_KEY, userDo.getLoginName()); |
353,316 | protected int diffWildcard(JCWildcard oldT, JCWildcard newT, int[] bounds) {<NEW_LINE>int localPointer = bounds[0];<NEW_LINE>if (oldT.kind != newT.kind) {<NEW_LINE><MASK><NEW_LINE>printer.print(newT.kind.toString());<NEW_LINE>localPointer = oldT.pos + oldT.kind.toString().length();<NEW_LINE>}<NEW_LINE>JCTree oldBound = oldT.kind.kind != BoundKind.UNBOUND ? oldT.inner : null;<NEW_LINE>JCTree newBound = newT.kind.kind != BoundKind.UNBOUND ? newT.inner : null;<NEW_LINE>if (oldBound == newBound && oldBound == null)<NEW_LINE>return localPointer;<NEW_LINE>int[] innerBounds = getBounds(oldBound);<NEW_LINE>copyTo(localPointer, innerBounds[0]);<NEW_LINE>localPointer = diffTree(oldBound, newBound, innerBounds);<NEW_LINE>copyTo(localPointer, bounds[1]);<NEW_LINE>return bounds[1];<NEW_LINE>} | copyTo(localPointer, oldT.pos); |
1,445,160 | public void start(EtcdEndpoint endpoint, Consumer<ChangeEvent<EtcdEndpoint>> listener) {<NEW_LINE>if (!started.compareAndSet(false, true)) {<NEW_LINE>throw new IllegalStateException("EtcdWatcher cannot be reused for multiple sources");<NEW_LINE>}<NEW_LINE>this.endpoint = endpoint;<NEW_LINE>this.etcdClient = endpoint.api().clientFactory().<MASK><NEW_LINE>try {<NEW_LINE>Flow.Publisher<Long> watchPublisher = etcdClient().watch(endpoint.key());<NEW_LINE>watchPublisher.subscribe(new EtcdWatchSubscriber(listener, endpoint));<NEW_LINE>} catch (EtcdClientException ex) {<NEW_LINE>LOGGER.log(Level.WARNING, String.format("Subscription on watching on '%s' key has failed. " + "Watching by '%s' polling strategy will not start.", EtcdWatcher.this.endpoint.key(), EtcdWatcher.this), ex);<NEW_LINE>}<NEW_LINE>} | createClient(endpoint.uri()); |
1,652,643 | public boolean visit(IResourceProxy proxy) throws CoreException {<NEW_LINE>if (proxy.getType() == IResource.FOLDER) {<NEW_LINE><MASK><NEW_LINE>if (prefixesOneOf(path, nestedFolders)) {<NEW_LINE>if (equalsOneOf(path, nestedFolders)) {<NEW_LINE>// nested source folder<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>// folder containing nested source folder<NEW_LINE>IFolder folder = destFolder.getFolder(path.removeFirstSegments(sourceSegmentCount));<NEW_LINE>if ((CopyPackageFragmentRootOperation.this.updateModelFlags & IPackageFragmentRoot.REPLACE) != 0 && folder.exists()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>folder.create(CopyPackageFragmentRootOperation.this.updateResourceFlags, true, CopyPackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// subtree doesn't contain any nested source folders<NEW_LINE>IPath destPath = CopyPackageFragmentRootOperation.this.destination.append(path.removeFirstSegments(sourceSegmentCount));<NEW_LINE>IResource destRes;<NEW_LINE>if ((CopyPackageFragmentRootOperation.this.updateModelFlags & IPackageFragmentRoot.REPLACE) != 0 && (destRes = workspaceRoot.findMember(destPath)) != null) {<NEW_LINE>destRes.delete(CopyPackageFragmentRootOperation.this.updateResourceFlags, CopyPackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>}<NEW_LINE>proxy.requestResource().copy(destPath, CopyPackageFragmentRootOperation.this.updateResourceFlags, CopyPackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>IPath path = proxy.requestFullPath();<NEW_LINE>IPath destPath = CopyPackageFragmentRootOperation.this.destination.append(path.removeFirstSegments(sourceSegmentCount));<NEW_LINE>IResource destRes;<NEW_LINE>if ((CopyPackageFragmentRootOperation.this.updateModelFlags & IPackageFragmentRoot.REPLACE) != 0 && (destRes = workspaceRoot.findMember(destPath)) != null) {<NEW_LINE>destRes.delete(CopyPackageFragmentRootOperation.this.updateResourceFlags, CopyPackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>}<NEW_LINE>proxy.requestResource().copy(destPath, CopyPackageFragmentRootOperation.this.updateResourceFlags, CopyPackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | IPath path = proxy.requestFullPath(); |
616,289 | private DockerClient.BuildParam[] buildParams() throws UnsupportedEncodingException, JsonProcessingException {<NEW_LINE>final List<DockerClient.BuildParam> buildParams = Lists.newArrayList();<NEW_LINE>if (pullOnBuild) {<NEW_LINE>buildParams.add(DockerClient.BuildParam.pullNewerImage());<NEW_LINE>}<NEW_LINE>if (noCache) {<NEW_LINE>buildParams.add(DockerClient.BuildParam.noCache());<NEW_LINE>}<NEW_LINE>if (!rm) {<NEW_LINE>buildParams.add(DockerClient<MASK><NEW_LINE>}<NEW_LINE>if (!buildArgs.isEmpty()) {<NEW_LINE>buildParams.add(DockerClient.BuildParam.create("buildargs", URLEncoder.encode(OBJECT_MAPPER.writeValueAsString(buildArgs), "UTF-8")));<NEW_LINE>}<NEW_LINE>if (!isNullOrEmpty(network)) {<NEW_LINE>buildParams.add(DockerClient.BuildParam.create("networkmode", network));<NEW_LINE>}<NEW_LINE>return buildParams.toArray(new DockerClient.BuildParam[buildParams.size()]);<NEW_LINE>} | .BuildParam.rm(false)); |
1,314,451 | public void train(ClassificationDataSet dataSet, boolean parallel) {<NEW_LINE>if (dataSet.getNumCategoricalVars() != 0)<NEW_LINE>throw new FailedToFitException("Classifier requires all variables be numerical");<NEW_LINE>int C = dataSet.getClassSize();<NEW_LINE>rocVecs = new ArrayList<>(C);<NEW_LINE>TrainableDistanceMetric.<MASK><NEW_LINE>// dimensions<NEW_LINE>int d = dataSet.getNumNumericalVars();<NEW_LINE>// Set up a bunch of threads to add vectors together in the background<NEW_LINE>DoubleAdder totalWeight = new DoubleAdder();<NEW_LINE>rocVecs = new ArrayList<>(Arrays.asList(// partial sum for each class<NEW_LINE>ParallelUtils.// partial sum for each class<NEW_LINE>run(// partial sum for each class<NEW_LINE>parallel, // partial sum for each class<NEW_LINE>dataSet.size(), (int start, int end) -> {<NEW_LINE>// find class vec sums<NEW_LINE>Vec[] local_roc = new Vec[C];<NEW_LINE>for (int i = 0; i < C; i++) local_roc[i] = new DenseVector(d);<NEW_LINE>for (int i = start; i < end; i++) {<NEW_LINE>double w = dataSet.getWeight(i);<NEW_LINE>local_roc[dataSet.getDataPointCategory(i)].mutableAdd(w, dataSet.getDataPoint(i).getNumericalValues());<NEW_LINE>totalWeight.add(w);<NEW_LINE>}<NEW_LINE>return local_roc;<NEW_LINE>}, // reduce down to a final sum per class<NEW_LINE>(Vec[] t, Vec[] u) -> {<NEW_LINE>for (int i = 0; i < t.length; i++) t[i].mutableAdd(u[i]);<NEW_LINE>return t;<NEW_LINE>})));<NEW_LINE>// Normalize each vec so we have the correct values in the end<NEW_LINE>double[] priors = dataSet.getPriors();<NEW_LINE>for (int i = 0; i < C; i++) rocVecs.get(i).mutableDivide(totalWeight.sum() * priors[i]);<NEW_LINE>// prep cache for inference<NEW_LINE>rocCache = dm.getAccelerationCache(rocVecs, parallel);<NEW_LINE>} | trainIfNeeded(dm, dataSet, parallel); |
211,231 | final DescribeConnectionLoaResult executeDescribeConnectionLoa(DescribeConnectionLoaRequest describeConnectionLoaRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeConnectionLoaRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeConnectionLoaRequest> request = null;<NEW_LINE>Response<DescribeConnectionLoaResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeConnectionLoaRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeConnectionLoaRequest));<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, "Direct Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeConnectionLoa");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeConnectionLoaResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeConnectionLoaResultJsonUnmarshaller());<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); |
515,732 | public List<TextRange> select(final PsiElement e, final CharSequence editorText, final int cursorOffset, final Editor editor) {<NEW_LINE>final VirtualFile file = e.getContainingFile().getVirtualFile();<NEW_LINE>final FileType fileType = file == null ? null : file.getFileType();<NEW_LINE>if (fileType == null)<NEW_LINE>return super.select(e, editorText, cursorOffset, editor);<NEW_LINE>final int textLength = editorText.length();<NEW_LINE>final TextRange totalRange = e.getTextRange();<NEW_LINE>final HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(totalRange.getStartOffset());<NEW_LINE>final BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator);<NEW_LINE>final ArrayList<TextRange> result = new ArrayList<TextRange>();<NEW_LINE>final LinkedList<Trinity<Integer, Integer, IElementType>> stack = new LinkedList<Trinity<Integer, Integer, IElementType>>();<NEW_LINE>while (!iterator.atEnd() && iterator.getStart() < totalRange.getEndOffset()) {<NEW_LINE>final Trinity<Integer, Integer, IElementType> last;<NEW_LINE>if (braceMatcher.isLBraceToken(iterator, editorText, fileType)) {<NEW_LINE>stack.addLast(Trinity.create(iterator.getStart(), iterator.getEnd(), iterator.getTokenType()));<NEW_LINE>} else if (braceMatcher.isRBraceToken(iterator, editorText, fileType) && !stack.isEmpty() && braceMatcher.isPairBraces((last = stack.getLast()).third, iterator.getTokenType())) {<NEW_LINE>stack.removeLast();<NEW_LINE>result.addAll(expandToWholeLine(editorText, new TextRange(last.first, iterator.getEnd())));<NEW_LINE>int bodyStart = last.second;<NEW_LINE>int bodyEnd = iterator.getStart();<NEW_LINE>while (bodyStart < textLength && Character.isWhitespace(editorText.<MASK><NEW_LINE>while (bodyEnd > 0 && Character.isWhitespace(editorText.charAt(bodyEnd - 1))) bodyEnd--;<NEW_LINE>result.addAll(expandToWholeLine(editorText, new TextRange(bodyStart, bodyEnd)));<NEW_LINE>}<NEW_LINE>iterator.advance();<NEW_LINE>}<NEW_LINE>result.add(e.getTextRange());<NEW_LINE>return result;<NEW_LINE>} | charAt(bodyStart))) bodyStart++; |
1,050,833 | static public IPath browseForModelFile(Composite parent, IPath current) {<NEW_LINE>ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(parent.getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());<NEW_LINE>dialog.setTitle("Model Selection");<NEW_LINE>dialog.setMessage("Select Model file:");<NEW_LINE>dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());<NEW_LINE>if (current != null) {<NEW_LINE>IPath path = current;<NEW_LINE>if (path.segmentCount() > 1) {<NEW_LINE>path = current.removeLastSegments(1);<NEW_LINE>TreePath treePath = new TreePath(path.segments());<NEW_LINE>ITreeSelection treeSelection = new TreeSelection(treePath);<NEW_LINE>dialog.setInitialSelection(treeSelection);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dialog.open() == ElementTreeSelectionDialog.OK) {<NEW_LINE>Object[] result = dialog.getResult();<NEW_LINE>if (result.length == 1) {<NEW_LINE>Object r0 = result[0];<NEW_LINE>if (r0 instanceof IFile) {<NEW_LINE>return ((<MASK><NEW_LINE>// IPath modelPath = ((IFile)r0).getFullPath();<NEW_LINE>// final IPath basePath = getGenFile().getFullPath();<NEW_LINE>// URI modelURI = URI.createPlatformResourceURI(modelPath.toOSString(), false);<NEW_LINE>// URI baseURI = URI.createPlatformResourceURI(basePath.toString(),false);<NEW_LINE>// URI relativeURI = modelURI.deresolve(baseURI);<NEW_LINE>// return Path.fromOSString(relativeURI.toFileString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | IFile) r0).getFullPath(); |
115,912 | protected int reloadReplicationTokenIfExists(ReplicaId localReplicaId, List<RemoteReplicaInfo> remoteReplicaInfos) throws ReplicationException {<NEW_LINE>int tokenReloadFailureCount = 0;<NEW_LINE>List<RemoteReplicaInfo.ReplicaTokenInfo> tokenInfos = persistor.retrieve(localReplicaId.getMountPath());<NEW_LINE>if (tokenInfos.size() != 0) {<NEW_LINE>for (RemoteReplicaInfo remoteReplicaInfo : remoteReplicaInfos) {<NEW_LINE>boolean tokenReloaded = false;<NEW_LINE>for (RemoteReplicaInfo.ReplicaTokenInfo tokenInfo : tokenInfos) {<NEW_LINE>if (isTokenForRemoteReplicaInfo(remoteReplicaInfo, tokenInfo)) {<NEW_LINE>logger.info("Read token for partition {} remote host {} port {} token {}", localReplicaId.getPartitionId(), tokenInfo.getHostname(), tokenInfo.getPort(), tokenInfo.getReplicaToken());<NEW_LINE>tokenReloaded = true;<NEW_LINE>remoteReplicaInfo.initializeTokens(tokenInfo.getReplicaToken());<NEW_LINE>remoteReplicaInfo.<MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!tokenReloaded) {<NEW_LINE>// This may happen on clusterMap update: replica removed or added.<NEW_LINE>// Or error on token persist/retrieve.<NEW_LINE>logger.warn("Token not found or reload failed. remoteReplicaInfo: {} tokenInfos: {}", remoteReplicaInfo, tokenInfos);<NEW_LINE>tokenReloadFailureCount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return tokenReloadFailureCount;<NEW_LINE>} | setTotalBytesReadFromLocalStore(tokenInfo.getTotalBytesReadFromLocalStore()); |
1,778,628 | private void addQuantity_MoneyNormalized(String theResourceType, Set<ResourceIndexedSearchParamQuantityNormalized> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {<NEW_LINE>Optional<IPrimitiveType<BigDecimal>> valueField = myMoneyValueChild.getAccessor().getFirstValueOrNull(theValue);<NEW_LINE>if (valueField.isPresent() && valueField.get().getValue() != null) {<NEW_LINE>BigDecimal nextValueValue = valueField<MASK><NEW_LINE>String nextValueString = "urn:iso:std:iso:4217";<NEW_LINE>String nextValueCode = extractValueAsString(myMoneyCurrencyChild, theValue);<NEW_LINE>String searchParamName = theSearchParam.getName();<NEW_LINE>ResourceIndexedSearchParamQuantityNormalized nextEntityNormalized = new ResourceIndexedSearchParamQuantityNormalized(myPartitionSettings, theResourceType, searchParamName, nextValueValue.doubleValue(), nextValueString, nextValueCode);<NEW_LINE>theParams.add(nextEntityNormalized);<NEW_LINE>}<NEW_LINE>} | .get().getValue(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.