idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,703,750 | private void visitFunction(Node n) {<NEW_LINE>if (NodeUtil.isEs6Constructor(n)) {<NEW_LINE>// These will be checked via the CLASS node.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FunctionType functionType = JSType.toMaybeFunctionType(n.getJSType());<NEW_LINE>if (functionType.isConstructor()) {<NEW_LINE>checkConstructor(n, functionType);<NEW_LINE>} else if (functionType.isInterface()) {<NEW_LINE>checkInterface(n, functionType);<NEW_LINE>} else if (n.isAsyncGeneratorFunction()) {<NEW_LINE>// An async generator function must return a AsyncGenerator or supertype of AsyncGenerator<NEW_LINE>JSType returnType = functionType.getReturnType();<NEW_LINE>validator.expectAsyncGeneratorSupertype(n, returnType, "An async generator function must return a (supertype of) AsyncGenerator");<NEW_LINE>} else if (n.isGeneratorFunction()) {<NEW_LINE>// A generator function must return a Generator or supertype of Generator<NEW_LINE>JSType returnType = functionType.getReturnType();<NEW_LINE>validator.expectGeneratorSupertype(n, returnType, "A generator function must return a (supertype of) Generator");<NEW_LINE>} else if (n.isAsyncFunction()) {<NEW_LINE>// An async function must return a Promise or supertype of Promise<NEW_LINE><MASK><NEW_LINE>validator.expectValidAsyncReturnType(n, returnType);<NEW_LINE>}<NEW_LINE>} | JSType returnType = functionType.getReturnType(); |
1,451,021 | public void resize() {<NEW_LINE>if (((m_initialMovieHeight == -1 || m_initialMovieWidth == -1) && !m_isAudioOnly) || m_textureView == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Handler handler = new <MASK><NEW_LINE>handler.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>View currentParent = (View) getParent();<NEW_LINE>if (currentParent != null) {<NEW_LINE>int screenWidth = currentParent.getWidth();<NEW_LINE>int newHeight = 200;<NEW_LINE>if (!m_isAudioOnly) {<NEW_LINE>newHeight = (int) ((float) (screenWidth * m_initialMovieHeight) / (float) m_initialMovieWidth);<NEW_LINE>} else {<NEW_LINE>newHeight = 200;<NEW_LINE>}<NEW_LINE>if (m_textureView != null) {<NEW_LINE>FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) m_textureView.getLayoutParams();<NEW_LINE>layoutParams.width = screenWidth;<NEW_LINE>layoutParams.height = newHeight;<NEW_LINE>m_textureView.setLayoutParams(layoutParams);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | Handler(Looper.getMainLooper()); |
239,487 | static VisitsForWeek boundContributedDays(VisitsForWeek visits, int maxContributedDays) {<NEW_LINE>Map<String, Set<DayOfWeek>> boundedVisitorDays = new HashMap<>();<NEW_LINE>List<Visit> allVisits = new ArrayList<>();<NEW_LINE>VisitsForWeek boundedVisits = new VisitsForWeek();<NEW_LINE>// Add all visits to a list in order to shuffle them.<NEW_LINE>for (DayOfWeek d : DayOfWeek.values()) {<NEW_LINE>Collection<Visit> visitsForDay = visits.getVisitsForDay(d);<NEW_LINE>allVisits.addAll(visitsForDay);<NEW_LINE>}<NEW_LINE>Collections.shuffle(allVisits);<NEW_LINE>// For each visitorId, copy their visits for at most maxContributedDays days to the result.<NEW_LINE>for (Visit visit : allVisits) {<NEW_LINE>String visitorId = visit.visitorId();<NEW_LINE>DayOfWeek visitDay = visit.day();<NEW_LINE>if (boundedVisitorDays.containsKey(visitorId)) {<NEW_LINE>Set<DayOfWeek> visitorDays = boundedVisitorDays.get(visitorId);<NEW_LINE>if (visitorDays.contains(visitDay)) {<NEW_LINE>boundedVisits.addVisit(visit);<NEW_LINE>} else if (visitorDays.size() < maxContributedDays) {<NEW_LINE>visitorDays.add(visitDay);<NEW_LINE>boundedVisits.addVisit(visit);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Set<DayOfWeek> <MASK><NEW_LINE>boundedVisitorDays.put(visitorId, visitorDays);<NEW_LINE>visitorDays.add(visitDay);<NEW_LINE>boundedVisits.addVisit(visit);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return boundedVisits;<NEW_LINE>} | visitorDays = new HashSet<>(); |
835,266 | protected void configure() {<NEW_LINE>bind(AddressServiceStockImpl.class);<NEW_LINE>bind(StockRulesService.class).to(StockRulesServiceImpl.class);<NEW_LINE>bind(InventoryRepository.class).to(InventoryManagementRepository.class);<NEW_LINE>bind(StockMoveRepository.class<MASK><NEW_LINE>bind(StockLocationLineService.class).to(StockLocationLineServiceImpl.class);<NEW_LINE>bind(StockMoveLineService.class).to(StockMoveLineServiceImpl.class);<NEW_LINE>bind(StockMoveService.class).to(StockMoveServiceImpl.class);<NEW_LINE>bind(StockLocationService.class).to(StockLocationServiceImpl.class);<NEW_LINE>bind(ProductBaseRepository.class).to(ProductStockRepository.class);<NEW_LINE>bind(PartnerProductQualityRatingService.class).to(PartnerProductQualityRatingServiceImpl.class);<NEW_LINE>bind(LogisticalFormService.class).to(LogisticalFormServiceImpl.class);<NEW_LINE>bind(LogisticalFormLineService.class).to(LogisticalFormLineServiceImpl.class);<NEW_LINE>bind(LogisticalFormRepository.class).to(LogisticalFormStockRepository.class);<NEW_LINE>bind(StockLocationRepository.class).to(StockLocationStockRepository.class);<NEW_LINE>bind(PartnerStockSettingsService.class).to(PartnerStockSettingsServiceImpl.class);<NEW_LINE>bind(AppStockService.class).to(AppStockServiceImpl.class);<NEW_LINE>bind(StockMoveLineRepository.class).to(StockMoveLineStockRepository.class);<NEW_LINE>PartnerAddressRepository.modelPartnerFieldMap.put(StockMove.class.getName(), "partner");<NEW_LINE>bind(TrackingNumberRepository.class).to(TrackingNumberManagementRepository.class);<NEW_LINE>bind(StockMovePrintService.class).to(StockMovePrintServiceImpl.class);<NEW_LINE>bind(StockMoveToolService.class).to(StockMoveToolServiceImpl.class);<NEW_LINE>bind(PickingStockMovePrintService.class).to(PickingStockMovePrintServiceimpl.class);<NEW_LINE>bind(ConformityCertificatePrintService.class).to(ConformityCertificatePrintServiceImpl.class);<NEW_LINE>bind(StockLocationLineRepository.class).to(StockLocationLineStockRepository.class);<NEW_LINE>bind(StockCorrectionService.class).to(StockCorrectionServiceImpl.class);<NEW_LINE>bind(WeightedAveragePriceService.class).to(WeightedAveragePriceServiceImpl.class);<NEW_LINE>bind(StockHistoryService.class).to(StockHistoryServiceImpl.class);<NEW_LINE>bind(StockCorrectionRepository.class).to(StockCorrectionStockRepository.class);<NEW_LINE>} | ).to(StockMoveManagementRepository.class); |
912,503 | private void parseZone3(String text, boolean multipleInfo) {<NEW_LINE>String value = text.trim();<NEW_LINE>String valueLowerCase = value.toLowerCase();<NEW_LINE>if (valueLowerCase.startsWith(KEY1_HEX_VOLUME) || valueLowerCase.startsWith(KEY2_HEX_VOLUME)) {<NEW_LINE>value = extractNumber(value, valueLowerCase.startsWith(KEY1_HEX_VOLUME) ? KEY1_HEX_VOLUME.length() : KEY2_HEX_VOLUME.length());<NEW_LINE>dispatchKeyValue(KEY_VOLUME_ZONE3, value);<NEW_LINE>dispatchKeyValue(KEY_MUTE_ZONE3, MSG_VALUE_OFF);<NEW_LINE>} else if (valueLowerCase.startsWith(KEY_HEX_MUTE)) {<NEW_LINE>value = value.substring(KEY_HEX_MUTE.length()).trim();<NEW_LINE>if (MSG_VALUE_ON.equalsIgnoreCase(value)) {<NEW_LINE>dispatchKeyValue(KEY_MUTE_ZONE3, MSG_VALUE_ON);<NEW_LINE>} else {<NEW_LINE>logger.debug("Invalid value {} for zone mute", value);<NEW_LINE>}<NEW_LINE>} else if (!MSG_VALUE_OFF.equalsIgnoreCase(value)) {<NEW_LINE>RotelSource source = parseSource(value, true);<NEW_LINE>if (source != null) {<NEW_LINE><MASK><NEW_LINE>if (cmd != null) {<NEW_LINE>value = cmd.getAsciiCommandV2();<NEW_LINE>if (value != null) {<NEW_LINE>dispatchKeyValue(KEY_SOURCE_ZONE3, value);<NEW_LINE>if (!multipleInfo) {<NEW_LINE>dispatchKeyValue(KEY_MUTE_ZONE3, MSG_VALUE_OFF);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.debug("Invalid value {} for zone 3 source", value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | RotelCommand cmd = source.getZone3Command(); |
216,660 | private void createSimpleRoutingParameterButton(MapActivity mapActivity, final LocalRoutingParameter parameter, LinearLayout optionsContainer) {<NEW_LINE><MASK><NEW_LINE>RoutingHelper routingHelper = app.getRoutingHelper();<NEW_LINE>final int colorActive = ContextCompat.getColor(app, ColorUtilities.getActiveColorId(nightMode));<NEW_LINE>final int colorDisabled = ContextCompat.getColor(app, R.color.description_font_and_bottom_sheet_icons);<NEW_LINE>int margin = AndroidUtils.dpToPx(app, 3);<NEW_LINE>final OsmandSettings settings = app.getSettings();<NEW_LINE>String text;<NEW_LINE>boolean active;<NEW_LINE>if (parameter.routingParameter != null) {<NEW_LINE>if (parameter.routingParameter.getId().equals(GeneralRouter.USE_SHORTEST_WAY)) {<NEW_LINE>// if short route settings - it should be inverse of fast_route_mode<NEW_LINE>active = !settings.FAST_ROUTE_MODE.getModeValue(routingHelper.getAppMode());<NEW_LINE>} else {<NEW_LINE>active = parameter.isSelected(settings);<NEW_LINE>}<NEW_LINE>text = parameter.getText(mapActivity);<NEW_LINE>View item = createToolbarOptionView(active, text, parameter.getActiveIconId(), parameter.getDisabledIconId(), v -> {<NEW_LINE>OsmandApplication app1 = getApp();<NEW_LINE>if (parameter.routingParameter != null && app1 != null) {<NEW_LINE>boolean selected = !parameter.isSelected(settings);<NEW_LINE>app1.getRoutingOptionsHelper().applyRoutingParameter(parameter, selected);<NEW_LINE>Drawable itemDrawable = app1.getUIUtilities().getIcon(selected ? parameter.getActiveIconId() : parameter.getDisabledIconId(), nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);<NEW_LINE>Drawable activeItemDrawable = app1.getUIUtilities().getIcon(selected ? parameter.getActiveIconId() : parameter.getDisabledIconId(), ColorUtilities.getActiveColorId(nightMode));<NEW_LINE>if (Build.VERSION.SDK_INT >= 21) {<NEW_LINE>itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);<NEW_LINE>}<NEW_LINE>((ImageView) v.findViewById(R.id.route_option_image_view)).setImageDrawable(selected ? activeItemDrawable : itemDrawable);<NEW_LINE>((TextView) v.findViewById(R.id.route_option_title)).setTextColor(selected ? colorActive : colorDisabled);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (item != null) {<NEW_LINE>LinearLayout.LayoutParams layoutParams = getContainerButtonLayoutParams(mapActivity, false);<NEW_LINE>AndroidUtils.setMargins(layoutParams, margin, 0, margin, 0);<NEW_LINE>optionsContainer.addView(item, layoutParams);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | OsmandApplication app = mapActivity.getMyApplication(); |
858,629 | public String replace(String templateStr) {<NEW_LINE>if (templateStr == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>StringBuilder result = new StringBuilder();<NEW_LINE>int position = 0;<NEW_LINE>int prefixPosition;<NEW_LINE>while ((prefixPosition = templateStr.indexOf(parameterPrefix, position)) >= 0) {<NEW_LINE>int suffixPosition = templateStr.indexOf(parameterSuffix, prefixPosition + parameterPrefix.length());<NEW_LINE>if (suffixPosition == -1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>result.append(templateStr, position, prefixPosition);<NEW_LINE>String parameter = templateStr.substring(prefixPosition + parameterPrefix.length(), suffixPosition);<NEW_LINE>parameter = parameter.trim();<NEW_LINE>result.append(valueProvider.apply(parameter));<NEW_LINE>position <MASK><NEW_LINE>}<NEW_LINE>// Copying tail.<NEW_LINE>result.append(templateStr.substring(position));<NEW_LINE>return result.toString();<NEW_LINE>} | = suffixPosition + parameterSuffix.length(); |
855,239 | public PublicDnsNamespaceProperties unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PublicDnsNamespaceProperties publicDnsNamespaceProperties = new PublicDnsNamespaceProperties();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("DnsProperties", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>publicDnsNamespaceProperties.setDnsProperties(PublicDnsPropertiesMutableJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return publicDnsNamespaceProperties;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
968,926 | public void scheduleConnect() {<NEW_LINE>ApplicationManager.getApplication().executeOnPooledThread(() -> {<NEW_LINE>// Poll, waiting for "flutter run" to give us a websocket.<NEW_LINE>// Don't use a timeout - the user can cancel manually the operation.<NEW_LINE><MASK><NEW_LINE>while (url == null) {<NEW_LINE>if (getSession().isStopped())<NEW_LINE>return;<NEW_LINE>TimeoutUtil.sleep(100);<NEW_LINE>url = myConnector.getWebSocketUrl();<NEW_LINE>}<NEW_LINE>if (getSession().isStopped()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// "flutter run" has given us a websocket; we can assume it's ready immediately, because<NEW_LINE>// "flutter run" has already connected to it.<NEW_LINE>final VmService vmService;<NEW_LINE>try {<NEW_LINE>vmService = VmService.connect(url);<NEW_LINE>} catch (IOException | RuntimeException e) {<NEW_LINE>onConnectFailed("Failed to connect to the VM observatory service at: " + url + "\n" + e.toString() + "\n" + formatStackTraces(e));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>onConnectSucceeded(vmService);<NEW_LINE>});<NEW_LINE>} | String url = myConnector.getWebSocketUrl(); |
284,869 | final ReplicationGroup executeDeleteReplicationGroup(DeleteReplicationGroupRequest deleteReplicationGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteReplicationGroupRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteReplicationGroupRequest> request = null;<NEW_LINE>Response<ReplicationGroup> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteReplicationGroupRequestMarshaller().marshall(super.beforeMarshalling(deleteReplicationGroupRequest));<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, "ElastiCache");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteReplicationGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ReplicationGroup> responseHandler = new StaxResponseHandler<ReplicationGroup>(new ReplicationGroupStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,553,864 | private void configureIncrementalCompilation(ScalaCompileSpec spec) {<NEW_LINE>IncrementalCompileOptions incrementalOptions = scalaCompileOptions.getIncrementalOptions();<NEW_LINE>File analysisFile = incrementalOptions.getAnalysisFile().getAsFile().get();<NEW_LINE>File classpathBackupDir = incrementalOptions.getClassfileBackupDir().getAsFile().get();<NEW_LINE>Map<File, File> globalAnalysisMap = resolveAnalysisMappingsForOtherProjects();<NEW_LINE>spec.setAnalysisMap(globalAnalysisMap);<NEW_LINE>spec.setAnalysisFile(analysisFile);<NEW_LINE>spec.setClassfileBackupDir(classpathBackupDir);<NEW_LINE>// If this Scala compile is published into a jar, generate a analysis mapping file<NEW_LINE>if (incrementalOptions.getPublishedCode().isPresent()) {<NEW_LINE>File publishedCode = incrementalOptions.getPublishedCode().getAsFile().get();<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("scala-incremental Analysis file: {}", analysisFile);<NEW_LINE>LOGGER.debug("scala-incremental Classfile backup dir: {}", classpathBackupDir);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>File analysisMapping = getAnalysisMappingFile().getAsFile().get();<NEW_LINE>GFileUtils.writeFile(publishedCode.getAbsolutePath() + "\n" + analysisFile.getAbsolutePath(), analysisMapping);<NEW_LINE>}<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("scala-incremental Analysis map: {}", globalAnalysisMap);<NEW_LINE>}<NEW_LINE>} | LOGGER.debug("scala-incremental Published code: {}", publishedCode); |
1,038,147 | // GEN-LAST:event_browseLicenceButtonActionPerformed<NEW_LINE>private void browseLibraryButtonActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_browseLibraryButtonActionPerformed<NEW_LINE>JFileChooser chooser = new JFileChooser(ModuleUISettings.getDefault().getLastChosenLibraryLocation());<NEW_LINE>File[] olds = convertStringToFiles(txtLibrary.getText().trim());<NEW_LINE>chooser.setSelectedFiles(olds);<NEW_LINE><MASK><NEW_LINE>chooser.setMultiSelectionEnabled(true);<NEW_LINE>chooser.addChoosableFileFilter(new JarZipFilter());<NEW_LINE>int ret = chooser.showDialog(this, getMessage("LBL_Select"));<NEW_LINE>if (ret == JFileChooser.APPROVE_OPTION) {<NEW_LINE>File[] files = chooser.getSelectedFiles();<NEW_LINE>if (files.length == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String path = "";<NEW_LINE>for (int i = 0; i < files.length; i++) {<NEW_LINE>path = path + files[i] + (i == files.length - 1 ? "" : File.pathSeparator);<NEW_LINE>}<NEW_LINE>txtLibrary.setText(path);<NEW_LINE>ModuleUISettings.getDefault().setLastChosenLibraryLocation(files[0].getParentFile().getAbsolutePath());<NEW_LINE>}<NEW_LINE>} | chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); |
1,752,905 | // invokes all methods starting with "test"<NEW_LINE>public void run() {<NEW_LINE>Util.TRACE_ENTRY();<NEW_LINE>String className = this.getClass().getCanonicalName();<NEW_LINE>String methodName = "";<NEW_LINE>String testToRun = System.getProperty("fat.test.method.name", "");<NEW_LINE>Util.TRACE("fat.test.method.name=" + testToRun);<NEW_LINE>try {<NEW_LINE>setup();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Util.LOG(<MASK><NEW_LINE>Util.TRACE_EXIT();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Util.CODEPATH();<NEW_LINE>for (Method m : this.getClass().getDeclaredMethods()) {<NEW_LINE>methodName = m.getName();<NEW_LINE>boolean testMethod = m.isAnnotationPresent(ClientTest.class);<NEW_LINE>Util.TRACE("methodName=" + methodName + ",isAnnotationPresent(ClientTest.class)=" + testMethod);<NEW_LINE>if (true == testMethod && (0 == testToRun.length() || methodName.equals(testToRun))) {<NEW_LINE>try {<NEW_LINE>// trace entry on behalf of the called method<NEW_LINE>Util.getLogger().entering(className, methodName);<NEW_LINE>m.invoke(this, null);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (t instanceof java.lang.reflect.InvocationTargetException)<NEW_LINE>t = t.getCause();<NEW_LINE>StackTraceElement[] elem = t.getStackTrace();<NEW_LINE>String where = (null == elem || 0 == elem.length ? "" : " at " + elem[0].getFileName() + ":" + elem[0].getLineNumber());<NEW_LINE>Util.LOG("Test '" + methodName + "' failed" + where + " with an exception: " + t.toString());<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>t.printStackTrace(new PrintWriter(stringWriter));<NEW_LINE>Util.LOG(stringWriter);<NEW_LINE>} finally {<NEW_LINE>// trace entry on behalf of the called method<NEW_LINE>Util.getLogger().exiting(className, methodName);<NEW_LINE>}<NEW_LINE>// no point continuing unless we're running multiple methods<NEW_LINE>if (0 != testToRun.length())<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Util.TRACE_EXIT();<NEW_LINE>} | "FAT0001E: Client setup failed." + Util.LS, e); |
868,626 | public void doLayout() {<NEW_LINE>if (!topDragComp.isVisible())<NEW_LINE>return;<NEW_LINE>int x = 0;<NEW_LINE>int y = 0;<NEW_LINE>int width = resizeComp.getWidth();<NEW_LINE>int height = resizeComp.getHeight();<NEW_LINE>if (width == 0 || height == 0)<NEW_LINE>return;<NEW_LINE>Insets resizeInsets = getResizeInsets();<NEW_LINE>int thickness = UIScale.scale(borderDragThickness);<NEW_LINE>int topThickness = Math.max(resizeInsets.top, thickness);<NEW_LINE>int bottomThickness = Math.max(resizeInsets.bottom, thickness);<NEW_LINE>int leftThickness = Math.max(resizeInsets.left, thickness);<NEW_LINE>int rightThickness = Math.max(resizeInsets.right, thickness);<NEW_LINE>int y2 = y + topThickness;<NEW_LINE>int height2 = height - topThickness - bottomThickness;<NEW_LINE>// set bounds of drag components<NEW_LINE>topDragComp.setBounds(x, y, width, topThickness);<NEW_LINE>bottomDragComp.setBounds(x, y + height - bottomThickness, width, bottomThickness);<NEW_LINE>leftDragComp.setBounds(x, y2, leftThickness, height2);<NEW_LINE>rightDragComp.setBounds(x + width - rightThickness, y2, rightThickness, height2);<NEW_LINE>// set corner drag widths<NEW_LINE>int cornerDelta = UIScale.scale(cornerDragWidth - borderDragThickness);<NEW_LINE>topDragComp.setCornerDragWidths(leftThickness + cornerDelta, rightThickness + cornerDelta);<NEW_LINE>bottomDragComp.setCornerDragWidths(<MASK><NEW_LINE>leftDragComp.setCornerDragWidths(cornerDelta, cornerDelta);<NEW_LINE>rightDragComp.setCornerDragWidths(cornerDelta, cornerDelta);<NEW_LINE>} | leftThickness + cornerDelta, rightThickness + cornerDelta); |
494,184 | void updateEventList() {<NEW_LINE>String[] producerEvents = producerTool.getToolEventNames();<NEW_LINE>String[] consumedEvents = consumerTool.getConsumedToolEventNames();<NEW_LINE>List<String> <MASK><NEW_LINE>List<String> cList = Arrays.asList(consumedEvents);<NEW_LINE>ArrayList<String> producerList = new ArrayList<>(pList);<NEW_LINE>ArrayList<String> consumerList = new ArrayList<>(cList);<NEW_LINE>// get the intersection of the lists<NEW_LINE>producerList.retainAll(consumerList);<NEW_LINE>consumerList.retainAll(producerList);<NEW_LINE>for (int i = 0; i < producerList.size(); i++) {<NEW_LINE>String event = producerList.get(i);<NEW_LINE>if (!connectHt.contains(event)) {<NEW_LINE>connectHt.put(event, DISCONNECTED);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String[] keys = connectHt.getKeys();<NEW_LINE>for (String key : keys) {<NEW_LINE>if (!producerList.contains(key)) {<NEW_LINE>connectHt.remove(key);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | pList = Arrays.asList(producerEvents); |
636,454 | public void sort(FacesContext context, DataTable table) {<NEW_LINE>Object value = table.getValue();<NEW_LINE>if (value == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<<MASK><NEW_LINE>Locale locale = table.resolveDataLocale();<NEW_LINE>String var = table.getVar();<NEW_LINE>Collator collator = Collator.getInstance(locale);<NEW_LINE>AtomicInteger comparisonResult = new AtomicInteger();<NEW_LINE>Map<String, SortMeta> sortBy = table.getActiveSortMeta();<NEW_LINE>Object varBackup = context.getExternalContext().getRequestMap().get(var);<NEW_LINE>list.sort((o1, o2) -> {<NEW_LINE>for (SortMeta sortMeta : sortBy.values()) {<NEW_LINE>comparisonResult.set(0);<NEW_LINE>if (sortMeta.isHeaderRow()) {<NEW_LINE>int result = compare(context, var, sortMeta, o1, o2, collator, locale);<NEW_LINE>comparisonResult.set(result);<NEW_LINE>} else {<NEW_LINE>// Currently ColumnGrouping supports ui:repeat, therefore we have to use a callback<NEW_LINE>// and can't use sortMeta.getComponent()<NEW_LINE>// Later when we refactored ColumnGrouping, we may remove #invokeOnColumn as we dont support ui:repeat in other cases<NEW_LINE>table.invokeOnColumn(sortMeta.getColumnKey(), column -> {<NEW_LINE>int result = compare(context, var, sortMeta, o1, o2, collator, locale);<NEW_LINE>comparisonResult.set(result);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (comparisonResult.get() != 0) {<NEW_LINE>return comparisonResult.get();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>});<NEW_LINE>if (varBackup == null) {<NEW_LINE>context.getExternalContext().getRequestMap().remove(var);<NEW_LINE>} else {<NEW_LINE>context.getExternalContext().getRequestMap().put(var, varBackup);<NEW_LINE>}<NEW_LINE>} | ?> list = resolveList(value); |
798,126 | public AssessmentReportsDestination unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AssessmentReportsDestination assessmentReportsDestination = new AssessmentReportsDestination();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("destinationType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>assessmentReportsDestination.setDestinationType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("destination", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>assessmentReportsDestination.setDestination(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return assessmentReportsDestination;<NEW_LINE>} | class).unmarshall(context)); |
903,651 | private static CrashlyticsReport.Session.Application parseApp(@NonNull JsonReader jsonReader) throws IOException {<NEW_LINE>final CrashlyticsReport.Session.Application.Builder builder = CrashlyticsReport.Session.Application.builder();<NEW_LINE>jsonReader.beginObject();<NEW_LINE>while (jsonReader.hasNext()) {<NEW_LINE>String name = jsonReader.nextName();<NEW_LINE>switch(name) {<NEW_LINE>case "identifier":<NEW_LINE>builder.setIdentifier(jsonReader.nextString());<NEW_LINE>break;<NEW_LINE>case "version":<NEW_LINE>builder.setVersion(jsonReader.nextString());<NEW_LINE>break;<NEW_LINE>case "displayVersion":<NEW_LINE>builder.setDisplayVersion(jsonReader.nextString());<NEW_LINE>break;<NEW_LINE>case "installationUuid":<NEW_LINE>builder.<MASK><NEW_LINE>break;<NEW_LINE>case "developmentPlatform":<NEW_LINE>builder.setDevelopmentPlatform(jsonReader.nextString());<NEW_LINE>break;<NEW_LINE>case "developmentPlatformVersion":<NEW_LINE>builder.setDevelopmentPlatformVersion(jsonReader.nextString());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>jsonReader.skipValue();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>jsonReader.endObject();<NEW_LINE>return builder.build();<NEW_LINE>} | setInstallationUuid(jsonReader.nextString()); |
1,295,182 | public void menuAboutToShow(IMenuManager manager) {<NEW_LINE>manager.add(new Action(Messages.MenuExportChartData) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>TimelineChartCSVExporter exporter = new TimelineChartCSVExporter(chart);<NEW_LINE>exporter.addDiscontinousSeries(Messages.PerformanceChartLabelCPI);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>exporter.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>exporter.setValueFormat(new DecimalFormat("0.##########"));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>exporter.export(getTitle() + ".csv");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>picker.getSelectedDataSeries().stream().forEach(ds -> addMenu(manager, ds));<NEW_LINE>manager<MASK><NEW_LINE>chart.exportMenuAboutToShow(manager, getTitle());<NEW_LINE>} | .add(new Separator()); |
238,107 | protected String doIt() throws Exception {<NEW_LINE>MClientInfo clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID());<NEW_LINE>int AD_Tree_ID = clientInfo.getAD_Tree_Menu_ID();<NEW_LINE>MTree thisTree = new MTree(getCtx(), AD_Tree_ID, true, true, null, get_TrxName());<NEW_LINE>MTreeNode node;<NEW_LINE>if (menuId > 0) {<NEW_LINE>node = thisTree.<MASK><NEW_LINE>} else {<NEW_LINE>node = thisTree.getRoot();<NEW_LINE>}<NEW_LINE>// Navigate the menu and add every non-summary node<NEW_LINE>if (node != null) {<NEW_LINE>if (node.isSummary()) {<NEW_LINE>Enumeration<?> en = node.preorderEnumeration();<NEW_LINE>while (en.hasMoreElements()) {<NEW_LINE>MTreeNode childNode = (MTreeNode) en.nextElement();<NEW_LINE>if (!childNode.isSummary()) {<NEW_LINE>addNodeToLevel(childNode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addNodeToLevel(node);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (noWindows > 0)<NEW_LINE>addLog("@AD_Window_ID@ (" + noWindows + ")");<NEW_LINE>if (noTabs > 0)<NEW_LINE>addLog("@AD_Tab_ID@ (" + noTabs + ")");<NEW_LINE>if (noFields > 0)<NEW_LINE>addLog("@AD_Field_ID@ (" + noFields + ")");<NEW_LINE>if (noProcesses > 0)<NEW_LINE>addLog("@AD_Process_ID@ (" + noProcesses + ")");<NEW_LINE>if (noParameters > 0)<NEW_LINE>addLog("@AD_Process_Para_ID@ (" + noParameters + ")");<NEW_LINE>if (noBrowses > 0)<NEW_LINE>addLog("@AD_Browse_ID@ (" + noBrowses + ")");<NEW_LINE>if (noBrowseFields > 0)<NEW_LINE>addLog("@AD_Browse_Field_ID@ (" + noBrowseFields + ")");<NEW_LINE>return "@OK@";<NEW_LINE>} | getRoot().findNode(menuId); |
576,728 | private void updateCheckpoint(AtomicLong checkPoint, LongObjectHashMap<CountedBitSet> bitSetMap) {<NEW_LINE>assert Thread.holdsLock(this);<NEW_LINE>assert getBitSetForSeqNo(bitSetMap, checkPoint.get() + 1).get(seqNoToBitSetOffset(checkPoint.get() + 1)) : "updateCheckpoint is called but the bit following the checkpoint is not set";<NEW_LINE>try {<NEW_LINE>// keep it simple for now, get the checkpoint one by one; in the future we can optimize and read words<NEW_LINE>long bitSetKey = getBitSetKey(checkPoint.get());<NEW_LINE>CountedBitSet current = bitSetMap.get(bitSetKey);<NEW_LINE>if (current == null) {<NEW_LINE>// the bit set corresponding to the checkpoint has already been removed, set ourselves up for the next bit set<NEW_LINE>assert checkPoint.get() % BIT_SET_SIZE == BIT_SET_SIZE - 1;<NEW_LINE>current = bitSetMap.get(++bitSetKey);<NEW_LINE>}<NEW_LINE>do {<NEW_LINE>checkPoint.incrementAndGet();<NEW_LINE>if (checkPoint.get() == lastSeqNoInBitSet(bitSetKey)) {<NEW_LINE>assert current != null;<NEW_LINE>final CountedBitSet <MASK><NEW_LINE>assert removed == current;<NEW_LINE>current = bitSetMap.get(++bitSetKey);<NEW_LINE>}<NEW_LINE>} while (current != null && current.get(seqNoToBitSetOffset(checkPoint.get() + 1)));<NEW_LINE>} finally {<NEW_LINE>// notifies waiters in waitForProcessedOpsToComplete<NEW_LINE>this.notifyAll();<NEW_LINE>}<NEW_LINE>} | removed = bitSetMap.remove(bitSetKey); |
87,119 | private int decodePacket() {<NEW_LINE>// check the endianes of the computer.<NEW_LINE>final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;<NEW_LINE>if (block.synthesis(packet) == 0) {<NEW_LINE>dspState.synthesis_blockin(block);<NEW_LINE>}<NEW_LINE>// **pcm is a multichannel float vector. In stereo, for<NEW_LINE>// example, pcm[0] is left, and pcm[1] is right. samples is<NEW_LINE>// the size of each channel. Convert the float values<NEW_LINE>// (-1.<=range<=1.) to whatever PCM format and write it out<NEW_LINE>int convOff = 0;<NEW_LINE>int samples;<NEW_LINE>while ((samples = dspState.synthesis_pcmout(pcm, index)) > 0) {<NEW_LINE>float[][] <MASK><NEW_LINE>int bout = (samples < convsize ? samples : convsize);<NEW_LINE>// convert floats to 16 bit signed ints (host order) and interleave<NEW_LINE>for (int i = 0; i < info.channels; i++) {<NEW_LINE>int ptr = (i << 1) + convOff;<NEW_LINE>int mono = index[i];<NEW_LINE>for (int j = 0; j < bout; j++) {<NEW_LINE>int val = (int) (localPcm[i][mono + j] * 32767);<NEW_LINE>// might as well guard against clipping<NEW_LINE>val = Math.max(-32768, Math.min(32767, val));<NEW_LINE>val |= (val < 0 ? 0x8000 : 0);<NEW_LINE>convbuffer[ptr + 0] = (byte) (bigEndian ? val >>> 8 : val);<NEW_LINE>convbuffer[ptr + 1] = (byte) (bigEndian ? val : val >>> 8);<NEW_LINE>ptr += (info.channels) << 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>convOff += 2 * info.channels * bout;<NEW_LINE>// Tell orbis how many samples were consumed<NEW_LINE>dspState.synthesis_read(bout);<NEW_LINE>}<NEW_LINE>return convOff;<NEW_LINE>} | localPcm = this.pcm[0]; |
797,946 | static void c_2_2() throws Exception {<NEW_LINE>BatchOperator<?> ratings = Chap24.getSourceRatings();<NEW_LINE>BatchOperator<?> items = Chap24.getSourceItems();<NEW_LINE>BatchOperator left_ratings = ratings.filter("user_id<3 AND item_id<4").select("user_id, item_id, rating");<NEW_LINE>BatchOperator right_movies = items.select("item_id AS movie_id, title").filter("movie_id < 6 AND MOD(movie_id, 2) = 1");<NEW_LINE>System.out.println("# left_ratings #");<NEW_LINE>left_ratings.print();<NEW_LINE>System.out.println("\n# right_movies #");<NEW_LINE>right_movies.print();<NEW_LINE>System.out.println("# JOIN #");<NEW_LINE>new JoinBatchOp().setJoinPredicate("item_id = movie_id").setSelectClause("user_id, item_id, title, rating").linkFrom(left_ratings, right_movies).print();<NEW_LINE>System.out.println("\n# LEFT OUTER JOIN #");<NEW_LINE>new LeftOuterJoinBatchOp().setJoinPredicate("item_id = movie_id").setSelectClause("user_id, item_id, title, rating").linkFrom(left_ratings, right_movies).print();<NEW_LINE>System.out.println("\n# RIGHT OUTER JOIN #");<NEW_LINE>new RightOuterJoinBatchOp().setJoinPredicate("item_id = movie_id").setSelectClause("user_id, item_id, title, rating").linkFrom(left_ratings, right_movies).print();<NEW_LINE>System.out.println("\n# FULL OUTER JOIN #");<NEW_LINE>new FullOuterJoinBatchOp().setJoinPredicate("item_id = movie_id").setSelectClause("user_id, item_id, title, rating").linkFrom(<MASK><NEW_LINE>} | left_ratings, right_movies).print(); |
771,876 | public void RestartMaster(String deviceId) {<NEW_LINE>Reader reader = null;<NEW_LINE>logger.debug("Restart master device id '{}'", deviceId);<NEW_LINE>try {<NEW_LINE>String url = API_URL + "device/restart" + "?authToken=" + this.authToken + "&id=" + deviceId;<NEW_LINE>HttpURLConnection httpURLConnection;<NEW_LINE>httpURLConnection = (HttpURLConnection) new URL(url).openConnection();<NEW_LINE>InputStream inputStream = httpURLConnection.getInputStream();<NEW_LINE>reader <MASK><NEW_LINE>JsonObject jsonObject = (JsonObject) jsonParser.parse(reader);<NEW_LINE>String status = jsonObject.get("status").getAsString();<NEW_LINE>if (!status.equals("ok")) {<NEW_LINE>String error = jsonObject.get("error").getAsString();<NEW_LINE>logger.error("Unable to restart master device '{}' error '{}'", deviceId, error);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.error("Error restart master device: '{}'", ex.toString());<NEW_LINE>} finally {<NEW_LINE>if (reader != null) {<NEW_LINE>try {<NEW_LINE>reader.close();<NEW_LINE>} catch (IOException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new InputStreamReader(inputStream, "UTF-8"); |
341,122 | private static byte[] ntlm2SessionResponse(final byte[] ntlmHash, final byte[] challenge, final byte[] clientChallenge) throws NtlmEngineException {<NEW_LINE>try {<NEW_LINE>// Look up MD5 algorithm (was necessary on jdk 1.4.2)<NEW_LINE>// This used to be needed, but java 1.5.0_07 includes the MD5<NEW_LINE>// algorithm (finally)<NEW_LINE>// Class x = Class.forName("gnu.crypto.hash.MD5");<NEW_LINE>// Method updateMethod = x.getMethod("update",new<NEW_LINE>// Class[]{byte[].class});<NEW_LINE>// Method digestMethod = x.getMethod("digest",new Class[0]);<NEW_LINE>// Object mdInstance = x.newInstance();<NEW_LINE>// updateMethod.invoke(mdInstance,new Object[]{challenge});<NEW_LINE>// updateMethod.invoke(mdInstance,new Object[]{clientChallenge});<NEW_LINE>// byte[] digest = (byte[])digestMethod.invoke(mdInstance,new<NEW_LINE>// Object[0]);<NEW_LINE>final MessageDigest md5 = MessageDigest.getInstance("MD5");<NEW_LINE>md5.update(challenge);<NEW_LINE>md5.update(clientChallenge);<NEW_LINE>final byte[] digest = md5.digest();<NEW_LINE>final byte[] sessionHash = new byte[8];<NEW_LINE>System.arraycopy(digest, 0, sessionHash, 0, 8);<NEW_LINE>return lmResponse(ntlmHash, sessionHash);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>if (e instanceof NtlmEngineException) {<NEW_LINE>throw (NtlmEngineException) e;<NEW_LINE>}<NEW_LINE>throw new NtlmEngineException(<MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,764,989 | public static <ENTITY> List<FieldPredicate<?>> andPredicates(FilterAction<ENTITY> action) {<NEW_LINE>requireNonNull(action);<NEW_LINE>final List<FieldPredicate<?>> andPredicateBuilders = new ArrayList<>();<NEW_LINE>final Predicate<? super ENTITY> predicate = action.getPredicate();<NEW_LINE>final Optional<FieldPredicate> oPredicateBuilder = Cast.<MASK><NEW_LINE>if (oPredicateBuilder.isPresent()) {<NEW_LINE>// Just a top level predicate builder<NEW_LINE>andPredicateBuilders.add(oPredicateBuilder.get());<NEW_LINE>} else {<NEW_LINE>final Optional<CombinedPredicate> oCombinedBasePredicate = Cast.cast(predicate, CombinedPredicate.class);<NEW_LINE>if (oCombinedBasePredicate.isPresent()) {<NEW_LINE>final CombinedPredicate<ENTITY> combinedBasePredicate = oCombinedBasePredicate.get();<NEW_LINE>if (combinedBasePredicate.getType() == CombinedPredicate.Type.AND) {<NEW_LINE>combinedBasePredicate.stream().map(p -> Cast.cast(p, FieldPredicate.class)).filter(Optional::isPresent).map(Optional::get).forEachOrdered(andPredicateBuilders::add);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return andPredicateBuilders;<NEW_LINE>} | cast(predicate, FieldPredicate.class); |
457,528 | final RemoveRegionResult executeRemoveRegion(RemoveRegionRequest removeRegionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(removeRegionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RemoveRegionRequest> request = null;<NEW_LINE>Response<RemoveRegionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RemoveRegionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(removeRegionRequest));<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, "Directory Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemoveRegion");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RemoveRegionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RemoveRegionResultJsonUnmarshaller());<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); |
1,129,573 | public static void writePublisherStats(StatsOutputStream statsStream, PublisherStatsImpl stats) {<NEW_LINE>statsStream.startObject();<NEW_LINE>statsStream.writePair("msgRateIn", stats.msgRateIn);<NEW_LINE>statsStream.writePair("msgThroughputIn", stats.msgThroughputIn);<NEW_LINE>statsStream.writePair("averageMsgSize", stats.averageMsgSize);<NEW_LINE>statsStream.writePair("address", stats.getAddress());<NEW_LINE>statsStream.writePair("producerId", stats.producerId);<NEW_LINE>statsStream.writePair(<MASK><NEW_LINE>statsStream.writePair("connectedSince", stats.getConnectedSince());<NEW_LINE>if (stats.getClientVersion() != null) {<NEW_LINE>statsStream.writePair("clientVersion", stats.getClientVersion());<NEW_LINE>}<NEW_LINE>// add metadata<NEW_LINE>statsStream.startObject("metadata");<NEW_LINE>if (stats.metadata != null && !stats.metadata.isEmpty()) {<NEW_LINE>stats.metadata.forEach(statsStream::writePair);<NEW_LINE>}<NEW_LINE>statsStream.endObject();<NEW_LINE>statsStream.endObject();<NEW_LINE>} | "producerName", stats.getProducerName()); |
819,243 | protected void readJson(JsonObject json, DeckCardLists deckList) {<NEW_LINE>JsonObject data = JsonUtil.getAsObject(json, "data");<NEW_LINE>if (data == null) {<NEW_LINE>sbMessage.append("Could not find data in json").append("'\n");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// info<NEW_LINE>String deckSet = JsonUtil.getAsString(data, "code");<NEW_LINE>String name = <MASK><NEW_LINE>if (!name.isEmpty()) {<NEW_LINE>deckList.setName(name);<NEW_LINE>}<NEW_LINE>// mainboard<NEW_LINE>JsonArray mainBoard = JsonUtil.getAsArray(data, "mainBoard");<NEW_LINE>List<mage.cards.decks.DeckCardInfo> mainDeckList = deckList.getCards();<NEW_LINE>addBoardToList(mainBoard, mainDeckList, deckSet);<NEW_LINE>// sideboard<NEW_LINE>JsonArray sideBoard = JsonUtil.getAsArray(data, "sideBoard");<NEW_LINE>List<mage.cards.decks.DeckCardInfo> sideDeckList = deckList.getSideboard();<NEW_LINE>addBoardToList(sideBoard, sideDeckList, deckSet);<NEW_LINE>} | JsonUtil.getAsString(data, "name"); |
1,528,806 | private static WorkspacePathResolver computeWorkspacePathResolver(Project project, BlazeContext context) {<NEW_LINE>BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();<NEW_LINE>if (projectData != null) {<NEW_LINE>return projectData.getWorkspacePathResolver();<NEW_LINE>}<NEW_LINE>// otherwise try to compute the workspace path resolver from scratch<NEW_LINE>WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);<NEW_LINE>BlazeVcsHandler vcsHandler = BlazeVcsHandler.vcsHandlerForProject(project);<NEW_LINE>if (vcsHandler == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>BlazeVcsHandler.BlazeVcsSyncHandler vcsSyncHandler = <MASK><NEW_LINE>if (vcsSyncHandler == null) {<NEW_LINE>return new WorkspacePathResolverImpl(workspaceRoot);<NEW_LINE>}<NEW_LINE>boolean ok = vcsSyncHandler.update(context, BlazeExecutor.getInstance().getExecutor());<NEW_LINE>return ok ? vcsSyncHandler.getWorkspacePathResolver() : null;<NEW_LINE>} | vcsHandler.createSyncHandler(project, workspaceRoot); |
958,007 | private <T> List<T> doFind(RedisOperationChain criteria, long offset, int rows, String keyspace, Class<T> type) {<NEW_LINE>if (criteria == null || (CollectionUtils.isEmpty(criteria.getOrSismember()) && CollectionUtils.isEmpty(criteria.getSismember())) && criteria.getNear() == null) {<NEW_LINE>return getAdapter().getAllOf(keyspace, type, offset, rows);<NEW_LINE>}<NEW_LINE>RedisCallback<Map<byte[], Map<byte[], byte[]>>> callback = connection -> {<NEW_LINE>List<byte[]> allKeys = new ArrayList<>();<NEW_LINE>if (!criteria.getSismember().isEmpty()) {<NEW_LINE>allKeys.addAll(connection.sInter(keys(keyspace + ":", criteria.getSismember())));<NEW_LINE>}<NEW_LINE>if (!criteria.getOrSismember().isEmpty()) {<NEW_LINE>allKeys.addAll(connection.sUnion(keys(keyspace + ":", criteria.getOrSismember())));<NEW_LINE>}<NEW_LINE>if (criteria.getNear() != null) {<NEW_LINE>GeoResults<GeoLocation<byte[]>> x = connection.geoRadius(geoKey(keyspace + ":", criteria.getNear()), new Circle(criteria.getNear().getPoint(), criteria.getNear().getDistance()));<NEW_LINE>for (GeoResult<GeoLocation<byte[]>> y : x) {<NEW_LINE>allKeys.add(y.getContent().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>byte[] keyspaceBin = getAdapter().getConverter().getConversionService().convert(keyspace + ":", byte[].class);<NEW_LINE>Map<byte[], Map<byte[], byte[]>> rawData = new LinkedHashMap<>();<NEW_LINE>if (allKeys.isEmpty() || allKeys.size() < offset) {<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>int offsetToUse = Math.max(0, (int) offset);<NEW_LINE>if (rows > 0) {<NEW_LINE>allKeys = allKeys.subList(Math.max(0, offsetToUse), Math.min(offsetToUse + rows, allKeys.size()));<NEW_LINE>}<NEW_LINE>for (byte[] id : allKeys) {<NEW_LINE>byte[] singleKey = ByteUtils.concat(keyspaceBin, id);<NEW_LINE>rawData.put(id, connection.hGetAll(singleKey));<NEW_LINE>}<NEW_LINE>return rawData;<NEW_LINE>};<NEW_LINE>Map<byte[], Map<byte[], byte[]>> raw = this.getAdapter().execute(callback);<NEW_LINE>List<T> result = new ArrayList<>(raw.size());<NEW_LINE>for (Map.Entry<byte[], Map<byte[], byte[]>> entry : raw.entrySet()) {<NEW_LINE>if (CollectionUtils.isEmpty(entry.getValue())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>RedisData data = new <MASK><NEW_LINE>data.setId(getAdapter().getConverter().getConversionService().convert(entry.getKey(), String.class));<NEW_LINE>data.setKeyspace(keyspace);<NEW_LINE>T converted = this.getAdapter().getConverter().read(type, data);<NEW_LINE>result.add(converted);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | RedisData(entry.getValue()); |
1,454,631 | public static void main(String[] args) {<NEW_LINE>// idx 0 1 2 3 4 5 6 7 8 9 10, no index 0!<NEW_LINE>// ft = {-,0,0,0,0,0,0,0, 0,0,0}<NEW_LINE><MASK><NEW_LINE>// ft = {-,0,1,0,1,0,0,0, 1,0,0}, idx 2,4,8 => +1<NEW_LINE>ft.update(2, 1);<NEW_LINE>// ft = {-,0,1,0,2,0,0,0, 2,0,0}, idx 4,8 => +1<NEW_LINE>ft.update(4, 1);<NEW_LINE>// ft = {-,0,1,0,2,2,2,0, 4,0,0}, idx 5,6,8 => +2<NEW_LINE>ft.update(5, 2);<NEW_LINE>// ft = {-,0,1,0,2,2,5,0, 7,0,0}, idx 6,8 => +3<NEW_LINE>ft.update(6, 3);<NEW_LINE>// ft = {-,0,1,0,2,2,5,2, 9,0,0}, idx 7,8 => +2<NEW_LINE>ft.update(7, 2);<NEW_LINE>// ft = {-,0,1,0,2,2,5,2,10,0,0}, idx 8 => +1<NEW_LINE>ft.update(8, 1);<NEW_LINE>// ft = {-,0,1,0,2,2,5,2,10,1,1}, idx 9,10 => +1<NEW_LINE>ft.update(9, 1);<NEW_LINE>// 0 => ft[1] = 0<NEW_LINE>System.out.printf("%d\n", ft.rsq(1, 1));<NEW_LINE>// 1 => ft[2] = 1<NEW_LINE>System.out.printf("%d\n", ft.rsq(1, 2));<NEW_LINE>// 7 => ft[6] + ft[4] = 5 + 2 = 7<NEW_LINE>System.out.printf("%d\n", ft.rsq(1, 6));<NEW_LINE>// 11 => ft[10] + ft[8] = 1 + 10 = 11<NEW_LINE>System.out.printf("%d\n", ft.rsq(1, 10));<NEW_LINE>// 6 => rsq(1, 6) - rsq(1, 2) = 7 - 1<NEW_LINE>System.out.printf("%d\n", ft.rsq(3, 6));<NEW_LINE>// update demo<NEW_LINE>ft.update(5, 2);<NEW_LINE>// now 13<NEW_LINE>System.out.printf("%d\n", ft.rsq(1, 10));<NEW_LINE>} | FenwickTree ft = new FenwickTree(10); |
576,561 | private static void dumpMethodAnnotations(PrintStream out, J9ROMMethodPointer romMethod) throws CorruptDataException {<NEW_LINE>U32Pointer methodAnnotationData = ROMHelp.getMethodAnnotationsDataFromROMMethod(romMethod);<NEW_LINE>U32Pointer parametersAnnotationData = ROMHelp.getParameterAnnotationsDataFromROMMethod(romMethod);<NEW_LINE>U32Pointer defaultAnnotationData = ROMHelp.getDefaultAnnotationDataFromROMMethod(romMethod);<NEW_LINE>U32Pointer methodTypeAnnotations = ROMHelp.getMethodTypeAnnotationDataFromROMMethod(romMethod);<NEW_LINE>U32Pointer codeTypeAnnotations = ROMHelp.getCodeTypeAnnotationDataFromROMMethod(romMethod);<NEW_LINE>if ((!methodAnnotationData.isNull()) || (!parametersAnnotationData.isNull()) || (!defaultAnnotationData.isNull())) {<NEW_LINE>J9ROMNameAndSignaturePointer nameAndSignature = romMethod.nameAndSignature();<NEW_LINE>J9UTF8Pointer name = nameAndSignature.name();<NEW_LINE>J9UTF8Pointer signature = nameAndSignature.signature();<NEW_LINE>out.append(" Name: " + J9UTF8Helper.stringValue(name) + nl);<NEW_LINE>out.append(" Signature: " + J9UTF8Helper.stringValue(signature) + nl);<NEW_LINE>}<NEW_LINE>if (!methodAnnotationData.isNull()) {<NEW_LINE>U32 length = methodAnnotationData.at(0);<NEW_LINE>U32Pointer data = methodAnnotationData.add(1);<NEW_LINE>out.append(String.format(" Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));<NEW_LINE>}<NEW_LINE>if (!parametersAnnotationData.isNull()) {<NEW_LINE>U32 length = parametersAnnotationData.at(0);<NEW_LINE>U32Pointer data = parametersAnnotationData.add(1);<NEW_LINE>out.append(String.format(" Parameters Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));<NEW_LINE>}<NEW_LINE>if (!defaultAnnotationData.isNull()) {<NEW_LINE>U32 length = defaultAnnotationData.at(0);<NEW_LINE>U32Pointer data = defaultAnnotationData.add(1);<NEW_LINE>out.append(String.format(" Default Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));<NEW_LINE>}<NEW_LINE>if (!methodTypeAnnotations.isNull()) {<NEW_LINE>U32 <MASK><NEW_LINE>U32Pointer data = methodTypeAnnotations.add(1);<NEW_LINE>out.append(String.format(" Method Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));<NEW_LINE>}<NEW_LINE>if (!codeTypeAnnotations.isNull()) {<NEW_LINE>U32 length = codeTypeAnnotations.at(0);<NEW_LINE>U32Pointer data = codeTypeAnnotations.add(1);<NEW_LINE>out.append(String.format(" Code Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));<NEW_LINE>}<NEW_LINE>} | length = methodTypeAnnotations.at(0); |
45,431 | public boolean find(final Path file, final ListProgressListener listener) throws BackgroundException {<NEW_LINE>if (file.isRoot()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (containerService.isContainer(file)) {<NEW_LINE>try {<NEW_LINE>return session.getClient().isBucketAccessible(containerService.getContainer(file).getName());<NEW_LINE>} catch (ServiceException e) {<NEW_LINE>throw new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (file.isFile() || file.isPlaceholder()) {<NEW_LINE><MASK><NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>// Check for common prefix<NEW_LINE>try {<NEW_LINE>new S3ObjectListService(session).list(file, new CancellingListProgressListener(), containerService.getKey(file), 1);<NEW_LINE>return true;<NEW_LINE>} catch (ListCanceledException l) {<NEW_LINE>// Found common prefix<NEW_LINE>return true;<NEW_LINE>} catch (NotfoundException e) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (NotfoundException e) {<NEW_LINE>return false;<NEW_LINE>} catch (AccessDeniedException e) {<NEW_LINE>// Object is inaccessible to current user, but does exist.<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} | attributes.find(file, listener); |
1,793,610 | InitialSearchPhase.ArraySearchPhaseResults<SearchPhaseResult> newSearchPhaseResults(SearchRequest request, int numShards) {<NEW_LINE><MASK><NEW_LINE>boolean isScrollRequest = request.scroll() != null;<NEW_LINE>final boolean hasAggs = source != null && source.aggregations() != null;<NEW_LINE>final boolean hasTopDocs = source == null || source.size() != 0;<NEW_LINE>final boolean trackTotalHits = source == null || source.trackTotalHits();<NEW_LINE>if (isScrollRequest == false && (hasAggs || hasTopDocs)) {<NEW_LINE>// no incremental reduce if scroll is used - we only hit a single shard or sometimes more...<NEW_LINE>if (request.getBatchedReduceSize() < numShards) {<NEW_LINE>// only use this if there are aggs and if there are more shards than we should reduce at once<NEW_LINE>return new QueryPhaseResultConsumer(this, numShards, request.getBatchedReduceSize(), hasTopDocs, hasAggs, request.isFinalReduce());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new InitialSearchPhase.ArraySearchPhaseResults<SearchPhaseResult>(numShards) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>ReducedQueryPhase reduce() {<NEW_LINE>return reducedQueryPhase(results.asList(), isScrollRequest, trackTotalHits, request.isFinalReduce());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | SearchSourceBuilder source = request.source(); |
1,701,223 | private void executeImmediateValueMem(Instruction instruction, int source, int destination) {<NEW_LINE>// Source is [x]<NEW_LINE>ip++;<NEW_LINE>int sourceValue = memory.get(memory.get(ip));<NEW_LINE>if (destination == 0) {<NEW_LINE>// Single operand<NEW_LINE>ip++;<NEW_LINE>instruction.execute(memory, memory.get(ip - 1), status);<NEW_LINE>} else if (destination == Operand.IMMEDIATE_VALUE) {<NEW_LINE>// Destination is an immediate value<NEW_LINE>// this shouldn't happen<NEW_LINE>LogManager.LOGGER.severe(// todo remove debug info<NEW_LINE>"Trying to execute an instruction with an" + "immediate values as dst operand");<NEW_LINE>} else if (destination == Operand.IMMEDIATE_VALUE_MEM) {<NEW_LINE>// Destination is memory immediate too<NEW_LINE>ip += 2;<NEW_LINE>instruction.execute(memory, memory.get(ip - 1), sourceValue, status);<NEW_LINE>} else if (destination <= registerSetSize) {<NEW_LINE>// Destination is a register<NEW_LINE>ip++;<NEW_LINE>instruction.execute(<MASK><NEW_LINE>} else if (destination <= registerSetSize * 2) {<NEW_LINE>// Destination is [reg]<NEW_LINE>ip++;<NEW_LINE>instruction.execute(memory, registerSet.get(destination - registerSetSize), sourceValue, status);<NEW_LINE>} else {<NEW_LINE>// Assuming that destination is [reg + x]<NEW_LINE>ip += 2;<NEW_LINE>instruction.execute(memory, registerSet.get(destination - registerSetSize - registerSetSize) + memory.get(ip - 1), sourceValue, status);<NEW_LINE>}<NEW_LINE>} | registerSet, destination, sourceValue, status); |
504,695 | private Executable storeValue() {<NEW_LINE>return connection -> {<NEW_LINE>int maxColumnSize = table.getMaxColumnSize();<NEW_LINE>if (maxColumnSize == 0) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Integer tableID = query(tableID());<NEW_LINE>List<Object[]> rows = table.getRows();<NEW_LINE>Integer oldRowCount <MASK><NEW_LINE>int newRowCount = rows.size();<NEW_LINE>if (oldRowCount < newRowCount) {<NEW_LINE>updateRows(tableID, oldRowCount, rows);<NEW_LINE>insertNewRows(tableID, oldRowCount, rows);<NEW_LINE>} else if (oldRowCount == newRowCount) {<NEW_LINE>// No need to delete or insert rows<NEW_LINE>updateRows(tableID, oldRowCount, rows);<NEW_LINE>} else {<NEW_LINE>// oldRowCount > newRowCount<NEW_LINE>updateRows(tableID, newRowCount, rows);<NEW_LINE>deleteOldRows(tableID, newRowCount);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>};<NEW_LINE>} | = query(currentRowCount(tableID)); |
792,703 | protected ResolveResult[] resolveInner(boolean incompleteCode, PsiFile containingFile) {<NEW_LINE>File containingDirectory = ((BuildFile) containingFile).getFile().getParentFile();<NEW_LINE>if (containingDirectory == null) {<NEW_LINE>return ResolveResult.EMPTY_ARRAY;<NEW_LINE>}<NEW_LINE>List<String> includes = resolveListContents(element.getIncludes());<NEW_LINE>List<String> excludes = resolveListContents(element.getExcludes());<NEW_LINE>boolean directoriesExcluded = element.areDirectoriesExcluded();<NEW_LINE>if (includes.isEmpty()) {<NEW_LINE>return ResolveResult.EMPTY_ARRAY;<NEW_LINE>}<NEW_LINE>Project project = element.getProject();<NEW_LINE>try {<NEW_LINE>List<File> files = UnixGlob.forPath(containingDirectory).addPatterns(includes).addExcludes(excludes).setExcludeDirectories(directoriesExcluded).setDirectoryFilter(directoryFilter(project, containingDirectory.getPath())).glob();<NEW_LINE>List<ResolveResult> results = Lists.newArrayListWithCapacity(files.size());<NEW_LINE>for (File file : files) {<NEW_LINE>PsiFileSystemItem psiFile = BuildReferenceManager.getInstance(project).resolveFile(file);<NEW_LINE>if (psiFile != null) {<NEW_LINE>results.add(new PsiElementResolveResult(psiFile));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>return ResolveResult.EMPTY_ARRAY;<NEW_LINE>}<NEW_LINE>} | results.toArray(ResolveResult.EMPTY_ARRAY); |
1,502,362 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>getSerializedSize();<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeUInt32(1, version_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>output.writeFixed64(3, uuidClockseq_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>output.writeFixed64(4, timestamp_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>output.writeMessage(5, codec_);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < sourceNodes_.size(); i++) {<NEW_LINE>output.writeMessage(6, sourceNodes_.get(i));<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) == 0x00000020)) {<NEW_LINE>output.writeMessage(7, remote_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000040) == 0x00000040)) {<NEW_LINE>output.writeBytes(8, payload_);<NEW_LINE>}<NEW_LINE>getUnknownFields().writeTo(output);<NEW_LINE>} | output.writeFixed64(2, uuidTime_); |
1,425,407 | public boolean value(E e) {<NEW_LINE>boolean sep = condition.value(e);<NEW_LINE>int st0 = st;<NEW_LINE>st = st0 < 0 && sep ? -2 : st0 > 0 && !sep ? 2 : sep ? -1 : 1;<NEW_LINE>boolean result;<NEW_LINE>switch(mode) {<NEW_LINE>case AFTER:<NEW_LINE>result = st != -2 && (st != 1 || st0 == 0);<NEW_LINE>break;<NEW_LINE>case BEFORE:<NEW_LINE>result = st != -2 && st != -1;<NEW_LINE>break;<NEW_LINE>case AROUND:<NEW_LINE>result = st0 >= 0 && st > 0;<NEW_LINE>break;<NEW_LINE>case GROUP:<NEW_LINE>result = st0 >= 0 && st > 0 <MASK><NEW_LINE>break;<NEW_LINE>case OFF:<NEW_LINE>result = st > 0;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new AssertionError(st);<NEW_LINE>}<NEW_LINE>stored = !result && mode != Split.OFF ? e : null;<NEW_LINE>return result;<NEW_LINE>} | || st0 <= 0 && st < 0; |
875,964 | public ServiceResponse serviceImpl(Query call, HttpServletResponse response, Authorization rights, final JsonObjectWithDefault permissions) throws APIException {<NEW_LINE>SkillQuery skillQuery = SkillQuery.getParser().<MASK><NEW_LINE>String model_name = skillQuery.getModel();<NEW_LINE>String group_name = skillQuery.getGroup();<NEW_LINE>String language_name = skillQuery.getLanguage();<NEW_LINE>String skill_name = skillQuery.getSkill();<NEW_LINE>JSONObject result = new JSONObject();<NEW_LINE>result.put("accepted", false);<NEW_LINE>JsonTray skillUsage = DAO.countryWiseSkillUsage;<NEW_LINE>if (skillUsage.has(model_name)) {<NEW_LINE>JSONObject modelName = skillUsage.getJSONObject(model_name);<NEW_LINE>if (modelName.has(group_name)) {<NEW_LINE>JSONObject groupName = modelName.getJSONObject(group_name);<NEW_LINE>if (groupName.has(language_name)) {<NEW_LINE>JSONObject languageName = groupName.getJSONObject(language_name);<NEW_LINE>if (languageName.has(skill_name)) {<NEW_LINE>JSONArray countryWiseSkillUsage = languageName.getJSONArray(skill_name);<NEW_LINE>result.put("skill_name", skill_name);<NEW_LINE>result.put("skill_usage", countryWiseSkillUsage);<NEW_LINE>result.put("accepted", true);<NEW_LINE>result.put("message", "Country wise skill usage fetched");<NEW_LINE>return new ServiceResponse(result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>result.put("skill_name", skill_name);<NEW_LINE>result.put("accepted", false);<NEW_LINE>result.put("message", "Skill has not been used yet");<NEW_LINE>return new ServiceResponse(result);<NEW_LINE>} | parse(call).requireOrThrow(); |
1,201,240 | /* (non-Javadoc)<NEW_LINE>* @see fr.opensagres.xdocreport.service.rest.XDocReportService#processReport(fr.opensagres.xdocreport.document.domain.ReportAndDataRepresentation)<NEW_LINE>*/<NEW_LINE>@POST<NEW_LINE>@Path("/processReport")<NEW_LINE>@Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.WILDCARD)<NEW_LINE>public byte[] processReport(ReportAndDataRepresentation reportAndDataRepresentation) throws RemoteInvocationException {<NEW_LINE>System.err.println(reportAndDataRepresentation);<NEW_LINE>FieldsMetadata fieldsMetadata = new FieldsMetadata();<NEW_LINE>List<String> fields = reportAndDataRepresentation.getFieldsMetaData();<NEW_LINE>for (String field : fields) {<NEW_LINE>fieldsMetadata.addFieldAsList(field);<NEW_LINE>}<NEW_LINE>WSOptions wsOptions = reportAndDataRepresentation.getOptions();<NEW_LINE>Options options = null;<NEW_LINE>if (wsOptions != null) {<NEW_LINE>options = Options.getFrom(wsOptions.getFrom()).to(wsOptions.getTo()).<MASK><NEW_LINE>}<NEW_LINE>byte[] result;<NEW_LINE>try {<NEW_LINE>result = delegate.process(reportAndDataRepresentation.getDocument(), fieldsMetadata, reportAndDataRepresentation.getTemplateEngine(), reportAndDataRepresentation.getDataContext(), options);<NEW_LINE>} catch (XDocReportException e) {<NEW_LINE>throw new RemoteInvocationException(e.getMessage(), e.getStackTrace());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | via(wsOptions.getVia()); |
922,350 | @Produces("application/json")<NEW_LINE>public Response findAll(@QueryParam("scopeId") String id, @QueryParam("name") String name, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResult) {<NEW_LINE>this.auth.realm().requireViewAuthorization();<NEW_LINE>Map<Scope.FilterOption, String[]> search = new EnumMap<>(Scope.FilterOption.class);<NEW_LINE>if (id != null && !"".equals(id.trim())) {<NEW_LINE>search.put(Scope.FilterOption.ID, new String[] { id });<NEW_LINE>}<NEW_LINE>if (name != null && !"".equals(name.trim())) {<NEW_LINE>search.put(Scope.FilterOption.NAME, new String[] { name });<NEW_LINE>}<NEW_LINE>return Response.ok(this.authorization.getStoreFactory().getScopeStore().findByResourceServer(this.resourceServer, search, firstResult != null ? firstResult : -1, maxResult != null ? maxResult : Constants.DEFAULT_MAX_RESULTS).stream().map(scope -> toRepresentation(scope)).collect(Collectors.toList<MASK><NEW_LINE>} | ())).build(); |
615,098 | public BigInteger decryptBlock(CramerShoupCiphertext input) throws CramerShoupCiphertextException {<NEW_LINE>BigInteger result = null;<NEW_LINE>if (key.isPrivate() && !this.forEncryption && key instanceof CramerShoupPrivateKeyParameters) {<NEW_LINE>CramerShoupPrivateKeyParameters sk = (CramerShoupPrivateKeyParameters) key;<NEW_LINE>BigInteger p = sk.getParameters().getP();<NEW_LINE>Digest digest = sk.getParameters().getH();<NEW_LINE>byte[] u1Bytes = input.getU1().toByteArray();<NEW_LINE>digest.update(u1Bytes, 0, u1Bytes.length);<NEW_LINE>byte[] u2Bytes = input.getU2().toByteArray();<NEW_LINE>digest.update(u2Bytes, 0, u2Bytes.length);<NEW_LINE>byte[] eBytes = input.getE().toByteArray();<NEW_LINE>digest.update(eBytes, 0, eBytes.length);<NEW_LINE>if (this.label != null) {<NEW_LINE>byte[] lBytes = this.label;<NEW_LINE>digest.update(lBytes, 0, lBytes.length);<NEW_LINE>}<NEW_LINE>byte[] out = new byte[digest.getDigestSize()];<NEW_LINE>digest.doFinal(out, 0);<NEW_LINE>BigInteger a = new BigInteger(1, out);<NEW_LINE>BigInteger v = input.u1.modPow(sk.getX1().add(sk.getY1().multiply(a)), p).multiply(input.u2.modPow(sk.getX2().add(sk.getY2().multiply(a)), p)).mod(p);<NEW_LINE>// check correctness of ciphertext<NEW_LINE>if (input.v.equals(v)) {<NEW_LINE>result = input.e.multiply(input.u1.modPow(sk.getZ(), p).modInverse(<MASK><NEW_LINE>} else {<NEW_LINE>throw new CramerShoupCiphertextException("Sorry, that ciphertext is not correct");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | p)).mod(p); |
1,560,981 | public static void signUp(Start start, io.supertokens.pluginInterface.thirdparty.UserInfo userInfo) throws StorageQueryException, StorageTransactionLogicException {<NEW_LINE>start.startTransaction(con -> {<NEW_LINE>Connection sqlCon = (Connection) con.getConnection();<NEW_LINE>try {<NEW_LINE>{<NEW_LINE>String QUERY = "INSERT INTO " + getConfig(start).getUsersTable() + "(user_id, recipe_id, time_joined)" + " VALUES(?, ?, ?)";<NEW_LINE>update(sqlCon, QUERY, pst -> {<NEW_LINE>pst.setString(1, userInfo.id);<NEW_LINE>pst.setString(2, THIRD_PARTY.toString());<NEW_LINE>pst.setLong(3, userInfo.timeJoined);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>{<NEW_LINE>String QUERY = "INSERT INTO " + getConfig(start).getThirdPartyUsersTable() + "(third_party_id, third_party_user_id, user_id, email, time_joined)" + " VALUES(?, ?, ?, ?, ?)";<NEW_LINE>update(sqlCon, QUERY, pst -> {<NEW_LINE>pst.setString(<MASK><NEW_LINE>pst.setString(2, userInfo.thirdParty.userId);<NEW_LINE>pst.setString(3, userInfo.id);<NEW_LINE>pst.setString(4, userInfo.email);<NEW_LINE>pst.setLong(5, userInfo.timeJoined);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>sqlCon.commit();<NEW_LINE>} catch (SQLException throwables) {<NEW_LINE>throw new StorageTransactionLogicException(throwables);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} | 1, userInfo.thirdParty.id); |
566,267 | public ExternalWorkflowExecutionSignaledEventAttributes unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes = new ExternalWorkflowExecutionSignaledEventAttributes();<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>if (context.testExpression("workflowExecution", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>externalWorkflowExecutionSignaledEventAttributes.setWorkflowExecution(WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("initiatedEventId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>externalWorkflowExecutionSignaledEventAttributes.setInitiatedEventId(context.getUnmarshaller(Long.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 externalWorkflowExecutionSignaledEventAttributes;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,748,730 | protected INDArray createWeightMatrix(NeuralNetConfiguration conf, INDArray weightView, boolean initializeParams) {<NEW_LINE>Convolution3D layerConf = <MASK><NEW_LINE>if (initializeParams) {<NEW_LINE>int[] kernel = layerConf.getKernelSize();<NEW_LINE>int[] stride = layerConf.getStride();<NEW_LINE>val inputDepth = layerConf.getNIn();<NEW_LINE>val outputDepth = layerConf.getNOut();<NEW_LINE>double fanIn = inputDepth * kernel[0] * kernel[1] * kernel[2];<NEW_LINE>double fanOut = outputDepth * kernel[0] * kernel[1] * kernel[2] / ((double) stride[0] * stride[1] * stride[2]);<NEW_LINE>val weightsShape = new long[] { outputDepth, inputDepth, kernel[0], kernel[1], kernel[2] };<NEW_LINE>return layerConf.getWeightInitFn().init(fanIn, fanOut, weightsShape, 'c', weightView);<NEW_LINE>} else {<NEW_LINE>int[] kernel = layerConf.getKernelSize();<NEW_LINE>return WeightInitUtil.reshapeWeights(new long[] { layerConf.getNOut(), layerConf.getNIn(), kernel[0], kernel[1], kernel[2] }, weightView, 'c');<NEW_LINE>}<NEW_LINE>} | (Convolution3D) conf.getLayer(); |
1,243,164 | final GetReservationCoverageResult executeGetReservationCoverage(GetReservationCoverageRequest getReservationCoverageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getReservationCoverageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetReservationCoverageRequest> request = null;<NEW_LINE>Response<GetReservationCoverageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetReservationCoverageRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getReservationCoverageRequest));<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, "Cost Explorer");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetReservationCoverageResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetReservationCoverageResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetReservationCoverage"); |
228,690 | private void submitClearVotingConfigExclusionsTask(ClearVotingConfigExclusionsRequest request, long startTimeMillis, ActionListener<ActionResponse.Empty> listener) {<NEW_LINE>clusterService.submitStateUpdateTask("clear-voting-config-exclusions", new ClusterStateUpdateTask(Priority.URGENT, TimeValue.timeValueMillis(Math.max(0, request.getTimeout().millis() + startTimeMillis - threadPool.relativeTimeInMillis()))) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ClusterState execute(ClusterState currentState) {<NEW_LINE>final CoordinationMetadata newCoordinationMetadata = CoordinationMetadata.builder(currentState.coordinationMetadata()).clearVotingConfigExclusions().build();<NEW_LINE>final Metadata newMetadata = Metadata.builder(currentState.metadata()).<MASK><NEW_LINE>return ClusterState.builder(currentState).metadata(newMetadata).build();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Exception e) {<NEW_LINE>listener.onFailure(e);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void clusterStateProcessed(ClusterState oldState, ClusterState newState) {<NEW_LINE>listener.onResponse(ActionResponse.Empty.INSTANCE);<NEW_LINE>}<NEW_LINE>}, newExecutor());<NEW_LINE>} | coordinationMetadata(newCoordinationMetadata).build(); |
1,150,479 | public boolean isInstanceOf(String candidateClassName, String criterionClassName, boolean isInterface) {<NEW_LINE>String methodName = "isInstanceOf";<NEW_LINE>ensureExternalResults();<NEW_LINE>displayClassNames();<NEW_LINE>String i_classOrInterfaceName = internClassName(criterionClassName, Util_InternMap.DO_NOT_FORCE);<NEW_LINE>if (i_classOrInterfaceName == null) {<NEW_LINE>if (logger.isLoggable(Level.FINER)) {<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0 ] ENTER Class [ {1} ] Super or Interface [ {2} ] / RETURN [ false ] (criteria not stored)", new Object[] { getHashName(), candidateClassName, criterionClassName });<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String i_candidateClassName = <MASK><NEW_LINE>if (i_candidateClassName == null) {<NEW_LINE>if (logger.isLoggable(Level.FINER)) {<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0 ] ENTER Class [ {1} ] Super or Interface [ {2} ] / RETURN [ false ] (target not stored)", new Object[] { getHashName(), candidateClassName, criterionClassName });<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean isInstance = getClassTable().i_isInstanceOf(i_candidateClassName, i_classOrInterfaceName, isInterface);<NEW_LINE>if (logger.isLoggable(Level.FINER)) {<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0} ] ENTER Class [ {1} ] Super or Interface [ {2} ] / RETURN [ {3} ]", new Object[] { getHashName(), candidateClassName, criterionClassName, Boolean.valueOf(isInstance) });<NEW_LINE>}<NEW_LINE>return isInstance;<NEW_LINE>} | internClassName(candidateClassName, Util_InternMap.DO_NOT_FORCE); |
778,097 | final DeleteAppInstanceResult executeDeleteAppInstance(DeleteAppInstanceRequest deleteAppInstanceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAppInstanceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DeleteAppInstanceRequest> request = null;<NEW_LINE>Response<DeleteAppInstanceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAppInstanceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAppInstanceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Chime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAppInstance");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "identity-";<NEW_LINE>String resolvedHostPrefix = String.format("identity-");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAppInstanceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAppInstanceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
221,176 | public static void main(String[] args) throws IOException {<NEW_LINE>Cmd cmd = MainUtils.parseArguments(args, FLAGS);<NEW_LINE>if (cmd.argsLength() < 2) {<NEW_LINE>MainUtils.printHelpArgs(FLAGS, new String[] { "input file", "output file" });<NEW_LINE>System.exit(-1);<NEW_LINE>}<NEW_LINE>String input = cmd.getArg(0);<NEW_LINE>File output = new File(cmd.getArg(1));<NEW_LINE>Format format = JCodecUtil.detectFormat(new File(input));<NEW_LINE>Codec videoCodec = getVideoCodec(format, input);<NEW_LINE>Codec <MASK><NEW_LINE>Source source = new SourceImpl(input, format, triple(0, 0, videoCodec), triple(0, 0, audioCodec));<NEW_LINE>Sink sink = new SinkImpl(output.getAbsolutePath(), MOV, videoCodec, audioCodec);<NEW_LINE>TranscoderBuilder builder = Transcoder.newTranscoder();<NEW_LINE>builder.addSource(source);<NEW_LINE>builder.addSink(sink);<NEW_LINE>builder.addFilter(0, new TextFilter(cmd.getStringFlagD(FLAG_TEXT, "JCodec")));<NEW_LINE>builder.setAudioMapping(0, 0, true);<NEW_LINE>builder.setVideoMapping(0, 0, false);<NEW_LINE>Transcoder transcoder = builder.create();<NEW_LINE>transcoder.transcode();<NEW_LINE>} | audioCodec = getAudioCodec(format, input); |
636,740 | public CreateEndpointResult createEndpoint(CreateEndpointRequest createEndpointRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createEndpointRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateEndpointRequest> request = null;<NEW_LINE>Response<CreateEndpointResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateEndpointRequestMarshaller().marshall(createEndpointRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<CreateEndpointResult, <MASK><NEW_LINE>JsonResponseHandler<CreateEndpointResult> responseHandler = new JsonResponseHandler<CreateEndpointResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | JsonUnmarshallerContext> unmarshaller = new CreateEndpointResultJsonUnmarshaller(); |
1,544,391 | boolean isValidDefinition() {<NEW_LINE>if (this.nameTextField.getText().isEmpty()) {<NEW_LINE>NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(mustBeNamedErrorText, NotifyDescriptor.WARNING_MESSAGE);<NEW_LINE>DialogDisplayer.getDefault().notify(notifyDesc);<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>// The FileIngestFilters have reserved names for default filter, and creating a new filter from the jComboBox<NEW_LINE>// These names if used would have undefined results, so prohibiting the user from using them is necessary<NEW_LINE>for (FilesSet filesSet : FilesSetsManager.getStandardFileIngestFilters()) {<NEW_LINE>if (this.nameTextField.getText().equals(filesSet.getName())) {<NEW_LINE>NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), NotifyDescriptor.WARNING_MESSAGE);<NEW_LINE>DialogDisplayer.getDefault().notify(notifyDesc);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.nameTextField.getText().equals(getCreateNewFileIngestFilterString())) {<NEW_LINE>NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), NotifyDescriptor.WARNING_MESSAGE);<NEW_LINE>DialogDisplayer.<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | getDefault().notify(notifyDesc); |
1,333,890 | public <T> void updateIcons(List<T> apps, CachingLogic<T> cachingLogic, OnUpdateCallback onUpdateCallback) {<NEW_LINE>// Filter the list per user<NEW_LINE>HashMap<UserHandle, HashMap<ComponentName, T>> userComponentMap = new HashMap<>();<NEW_LINE>int count = apps.size();<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>T app = apps.get(i);<NEW_LINE>UserHandle userHandle = cachingLogic.getUser(app);<NEW_LINE>HashMap<ComponentName, T> componentMap = userComponentMap.get(userHandle);<NEW_LINE>if (componentMap == null) {<NEW_LINE>componentMap = new HashMap<>();<NEW_LINE>userComponentMap.put(userHandle, componentMap);<NEW_LINE>}<NEW_LINE>componentMap.put(cachingLogic.getComponent(app), app);<NEW_LINE>}<NEW_LINE>for (Entry<UserHandle, HashMap<ComponentName, T>> entry : userComponentMap.entrySet()) {<NEW_LINE>updateIconsPerUser(entry.getKey(), entry.<MASK><NEW_LINE>}<NEW_LINE>// From now on, clear every valid item from the global valid map.<NEW_LINE>mFilterMode = MODE_CLEAR_VALID_ITEMS;<NEW_LINE>} | getValue(), cachingLogic, onUpdateCallback); |
638,414 | public void blockHarvestDrops(ItemStack tool, HarvestDropsEvent event) {<NEW_LINE>if (ToolHelper.isToolEffective2(tool, event.getState())) {<NEW_LINE>ModifierNBT data = new ModifierNBT(TinkerUtil.getModifierTag(tool, name));<NEW_LINE><MASK><NEW_LINE>final World world = event.getWorld();<NEW_LINE>for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {<NEW_LINE>ItemStack next = iterator.next().copy();<NEW_LINE>if (world != null && random.nextFloat() <= event.getDropChance()) {<NEW_LINE>if (random.nextFloat() < (data.level * .21f)) {<NEW_LINE>RandomTeleportUtil.teleportSpawnItem(world, pos, next);<NEW_LINE>iterator.remove();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>iterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// we already implemented the drop chance<NEW_LINE>event.setDropChance(1);<NEW_LINE>}<NEW_LINE>} | BlockPos pos = event.getPos(); |
225,498 | public Filter unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Filter filter = new Filter();<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>if (context.testExpression("name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>filter.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("values", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>filter.setValues(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("condition", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>filter.setCondition(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 filter;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
519,057 | public void testContextInfoExactMatchOverrideDefault() throws Exception {<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "**** >>>>> server configuration thresholds for - <global - slow : 5s , hung : 10s> <timing - Slow : 120s , hung : 120s>");<NEW_LINE>server.setServerConfigurationFile("contextInfoPattern/server_timing_1.xml");<NEW_LINE>server.waitForStringInLog("CWWKG0017I", 30000);<NEW_LINE>server.setMarkToEndOfLog();<NEW_LINE>// Should sleep and not hit hung request threshold since the context info specific settings<NEW_LINE>// are longer than the global defaults.<NEW_LINE>long startTime = System.nanoTime();<NEW_LINE>createRequests(12000, 1);<NEW_LINE>long elapsedSeconds = TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);<NEW_LINE>assertTrue("Test did not run long enough (elapsedSeconds)", elapsedSeconds >= 12);<NEW_LINE>// Make sure we didn't get any hung request messages<NEW_LINE>assertTrue("Test should not have found any slow request messages", fetchSlowRequestWarningsCount() == 0);<NEW_LINE>assertTrue("Test should not have found any hung request messages", fetchHungRequestWarningsCount() == 0);<NEW_LINE>// OK now test the opposite - that we do timeout because we matched the context info specific<NEW_LINE>// settings.<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "**** >>>>> server configuration thresholds for - <global - slow : 120s , hung : 120s> <timing - Slow : 5s , hung : 10s>");<NEW_LINE>server.setServerConfigurationFile("contextInfoPattern/server_timing_2.xml");<NEW_LINE>server.waitForStringInLog("CWWKG0017I", 30000);<NEW_LINE>server.setMarkToEndOfLog();<NEW_LINE>// Should sleep and hit hung request threshold since the context info specific settings<NEW_LINE>// are shorter than the global thresholds.<NEW_LINE>startTime = System.nanoTime();<NEW_LINE>createRequests(12000, 1);<NEW_LINE>elapsedSeconds = TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);<NEW_LINE>assertTrue("Test did not run long enough (elapsedSeconds)", elapsedSeconds >= 12);<NEW_LINE>// Make sure we had some hung request messages<NEW_LINE>assertTrue("Test should have found slow request messages", fetchSlowRequestWarningsCount() > 0);<NEW_LINE>assertTrue("Test should have found hung request messages", fetchHungRequestWarningsCount() > 0);<NEW_LINE>CommonTasks.<MASK><NEW_LINE>} | writeLogMsg(Level.INFO, "***** Testcase testContextInfoExactMatchOverrideDefault pass *****"); |
418,380 | public void updateContact(VCard vcard, Long key) throws RemoteException, OperationApplicationException {<NEW_LINE>List<NonEmptyContentValues> contentValues = new ArrayList<NonEmptyContentValues>();<NEW_LINE>convertName(contentValues, vcard);<NEW_LINE>convertNickname(contentValues, vcard);<NEW_LINE>convertPhones(contentValues, vcard);<NEW_LINE>convertEmails(contentValues, vcard);<NEW_LINE>convertAddresses(contentValues, vcard);<NEW_LINE>convertIms(contentValues, vcard);<NEW_LINE>// handle Android Custom fields..This is only valid for Android generated Vcards. As the Android would<NEW_LINE>// generate NickName, ContactEvents other than Birthday and RelationShip with this "X-ANDROID-CUSTOM" name<NEW_LINE>convertCustomFields(contentValues, vcard);<NEW_LINE>// handle Iphone kinda of group properties. which are grouped together.<NEW_LINE>convertGroupedProperties(contentValues, vcard);<NEW_LINE>convertBirthdays(contentValues, vcard);<NEW_LINE>convertWebsites(contentValues, vcard);<NEW_LINE>convertNotes(contentValues, vcard);<NEW_LINE>convertPhotos(contentValues, vcard);<NEW_LINE>convertOrganization(contentValues, vcard);<NEW_LINE>ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(contentValues.size());<NEW_LINE>ContentValues cv = account.getContentValues();<NEW_LINE>// ContactsContract.RawContact.CONTENT_URI needed to add account, backReference is also not needed<NEW_LINE>long contactID = key;<NEW_LINE>ContentProviderOperation operation;<NEW_LINE>for (NonEmptyContentValues values : contentValues) {<NEW_LINE>cv = values.getContentValues();<NEW_LINE>if (cv.size() == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>cv.remove("mimetype");<NEW_LINE>// @formatter:off<NEW_LINE>operation = ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI).withSelection(ContactsContract.Data.RAW_CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ? ", new String[] { "" + contactID, "" + mimeType }).withValues(cv).build();<NEW_LINE>// @formatter:on<NEW_LINE>operations.add(operation);<NEW_LINE>}<NEW_LINE>// Executing all the insert operations as a single database transaction<NEW_LINE>context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);<NEW_LINE>} | mimeType = cv.getAsString("mimetype"); |
391,880 | final SendUsersMessagesResult executeSendUsersMessages(SendUsersMessagesRequest sendUsersMessagesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(sendUsersMessagesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SendUsersMessagesRequest> request = null;<NEW_LINE>Response<SendUsersMessagesResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new SendUsersMessagesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(sendUsersMessagesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Pinpoint");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendUsersMessages");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SendUsersMessagesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendUsersMessagesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,265,155 | public List<Request> verifyTimes(final HttpMethod method, final String url, final int times) {<NEW_LINE>if (times < 0) {<NEW_LINE>throw new IllegalArgumentException("times must be a non negative number");<NEW_LINE>}<NEW_LINE>if (times == 0) {<NEW_LINE>verifyNever(method, url);<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>RequestKey requestKey = RequestKey.builder(<MASK><NEW_LINE>if (!requests.containsKey(requestKey)) {<NEW_LINE>throw new VerificationAssertionError("Wanted: '%s' but never invoked! Got: %s", requestKey, requests.keySet());<NEW_LINE>}<NEW_LINE>List<Request> result = requests.get(requestKey);<NEW_LINE>if (result.size() != times) {<NEW_LINE>throw new VerificationAssertionError("Wanted: '%s' to be invoked: '%s' times but got: '%s'!", requestKey, times, result.size());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | method, url).build(); |
35,179 | public static void validateTwitter(JReleaserContext context, Twitter twitter, Errors errors) {<NEW_LINE>if (!twitter.resolveEnabled(context.getModel().getProject()))<NEW_LINE>return;<NEW_LINE>context.getLogger().debug("announce.twitter");<NEW_LINE>twitter.setConsumerKey(checkProperty(context, TWITTER_CONSUMER_KEY, "twitter.consumerKey", twitter.getConsumerKey(), errors, context.isDryrun()));<NEW_LINE>twitter.setConsumerSecret(checkProperty(context, TWITTER_CONSUMER_SECRET, "twitter.consumerSecret", twitter.getConsumerSecret(), errors, context.isDryrun()));<NEW_LINE>twitter.setAccessToken(checkProperty(context, TWITTER_ACCESS_TOKEN, "twitter.accessToken", twitter.getAccessToken(), errors, context.isDryrun()));<NEW_LINE>twitter.setAccessTokenSecret(checkProperty(context, TWITTER_ACCESS_TOKEN_SECRET, "twitter.accessTokenSecret", twitter.getAccessTokenSecret(), errors, context.isDryrun()));<NEW_LINE>if (isBlank(twitter.getStatus())) {<NEW_LINE>twitter.setStatus<MASK><NEW_LINE>}<NEW_LINE>validateTimeout(twitter);<NEW_LINE>} | (RB.$("default.release.message")); |
1,509,918 | public void start(BundleContext context) throws Exception {<NEW_LINE>final Hashtable<String, Object> handlerProps = new Hashtable<String, Object>();<NEW_LINE>handlerProps.put(HandlerConstants.ENGINE_TYPE, HandlerConstants.ENGINE_TYPE_JAXWS);<NEW_LINE>handlerProps.put(HandlerConstants.FLOW_TYPE, HandlerConstants.FLOW_TYPE_IN);<NEW_LINE>handlerProps.put(HandlerConstants.IS_CLIENT_SIDE, true);<NEW_LINE>handlerProps.put(HandlerConstants.IS_SERVER_SIDE, true);<NEW_LINE>handlerProps.put(org.osgi.<MASK><NEW_LINE>OutHandler1 myHandler = new OutHandler1();<NEW_LINE>serviceRegistration1 = context.registerService(Handler.class, myHandler, handlerProps);<NEW_LINE>handlerProps.put(org.osgi.framework.Constants.SERVICE_RANKING, 2);<NEW_LINE>OutHandler2 myHandler2 = new OutHandler2();<NEW_LINE>serviceRegistration2 = context.registerService(Handler.class, myHandler2, handlerProps);<NEW_LINE>handlerProps.put(org.osgi.framework.Constants.SERVICE_RANKING, 1);<NEW_LINE>OutHandler3 myHandler3 = new OutHandler3();<NEW_LINE>serviceRegistration3 = context.registerService(Handler.class, myHandler3, handlerProps);<NEW_LINE>handlerProps.put(HandlerConstants.FLOW_TYPE, HandlerConstants.FLOW_TYPE_OUT);<NEW_LINE>handlerProps.put(org.osgi.framework.Constants.SERVICE_RANKING, 1);<NEW_LINE>InHandler1 inHandler1 = new InHandler1();<NEW_LINE>serviceRegistration4 = context.registerService(Handler.class, inHandler1, handlerProps);<NEW_LINE>handlerProps.put(org.osgi.framework.Constants.SERVICE_RANKING, 2);<NEW_LINE>INHandler2 inHandler2 = new INHandler2();<NEW_LINE>serviceRegistration5 = context.registerService(Handler.class, inHandler2, handlerProps);<NEW_LINE>handlerProps.put(org.osgi.framework.Constants.SERVICE_RANKING, 3);<NEW_LINE>InHandler3 inHandler3 = new InHandler3();<NEW_LINE>serviceRegistration6 = context.registerService(Handler.class, inHandler3, handlerProps);<NEW_LINE>System.out.println("in start method in bundle activator");<NEW_LINE>} | framework.Constants.SERVICE_RANKING, 3); |
894,943 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@name('create') @public create window MyWindow#keepall() as select theString, longPrimitive from SupportBean", path);<NEW_LINE>SupportMTUpdateListener listenerWindow = new SupportMTUpdateListener();<NEW_LINE>env.statement("create").addListener(listenerWindow);<NEW_LINE>env.compileDeploy("insert into MyWindow(theString, longPrimitive) select symbol, volume from SupportMarketDataBean", path);<NEW_LINE>String stmtTextDelete = "on SupportBean_A as s0 delete from MyWindow as win where win.theString = s0.id";<NEW_LINE>env.compileDeploy(stmtTextDelete, path);<NEW_LINE>env.compileDeploy("@name('s0') select irstream theString, longPrimitive from MyWindow", path);<NEW_LINE>SupportMTUpdateListener listenerConsumer = new SupportMTUpdateListener();<NEW_LINE>env.statement<MASK><NEW_LINE>try {<NEW_LINE>trySend(4, 25000, listenerConsumer, listenerWindow, env);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new RuntimeException("Failed: " + ex.getMessage(), ex);<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | ("s0").addListener(listenerConsumer); |
1,182,750 | public void marshall(NetworkInterface networkInterface, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (networkInterface == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(networkInterface.getNetworkInterfaceId(), NETWORKINTERFACEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getSubnetId(), SUBNETID_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getVpcId(), VPCID_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getPrivateDnsName(), PRIVATEDNSNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getPrivateIpAddress(), PRIVATEIPADDRESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getPrivateIpAddresses(), PRIVATEIPADDRESSES_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getPublicDnsName(), PUBLICDNSNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(networkInterface.getIpv6Addresses(), IPV6ADDRESSES_BINDING);<NEW_LINE>protocolMarshaller.marshall(networkInterface.getSecurityGroups(), SECURITYGROUPS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | networkInterface.getPublicIp(), PUBLICIP_BINDING); |
150,057 | public static int countDPEff(String exp, boolean result, int start, int end, HashMap<String, Integer> cache) {<NEW_LINE>String key = "" + start + end;<NEW_LINE>int count = 0;<NEW_LINE>if (!cache.containsKey(key)) {<NEW_LINE>if (start == end) {<NEW_LINE>if (exp.charAt(start) == '1') {<NEW_LINE>count = 1;<NEW_LINE>} else {<NEW_LINE>count = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = start + 1; i <= end; i += 2) {<NEW_LINE>char op = exp.charAt(i);<NEW_LINE>if (op == '&') {<NEW_LINE>count += countDPEff(exp, true, start, i - 1, cache) * countDPEff(exp, true, i + 1, end, cache);<NEW_LINE>} else if (op == '|') {<NEW_LINE>// parens on left<NEW_LINE>int left_ops = (i - 1 - start) / 2;<NEW_LINE>// parens on right<NEW_LINE>int right_ops = (end - i - 1) / 2;<NEW_LINE>int total_ways = total(left_ops) * total(right_ops);<NEW_LINE>int total_false = countDPEff(exp, false, start, i - 1, cache) * countDPEff(exp, false, i + 1, end, cache);<NEW_LINE>count += total_ways - total_false;<NEW_LINE>} else if (op == '^') {<NEW_LINE>count += countDPEff(exp, true, start, i - 1, cache) * countDPEff(exp, false, i + 1, end, cache);<NEW_LINE>count += countDPEff(exp, false, start, i - 1, cache) * countDPEff(exp, true, i + 1, end, cache);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cache.put(key, count);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (result) {<NEW_LINE>return count;<NEW_LINE>} else {<NEW_LINE>int num_ops = (end - start) / 2;<NEW_LINE>return total(num_ops) - count;<NEW_LINE>}<NEW_LINE>} | count = cache.get(key); |
1,379,623 | public void execute(MacroContext context, String parameter, MapToolMacroContext executionContext) {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>List<Macro> macros = new ArrayList<Macro<MASK><NEW_LINE>macros.sort(MACRO_NAME_COMPARATOR);<NEW_LINE>builder.append("<table border='1'>");<NEW_LINE>builder.append("<tr><td><b>").append(I18N.getText("help.header.command")).append("</b></td><td><b>").append(I18N.getText("help.header.aliases"));<NEW_LINE>builder.append("</b></td><td><b>").append(I18N.getText("help.header.description")).append("</b></td></tr>");<NEW_LINE>for (Macro macro : macros) {<NEW_LINE>MacroDefinition def = macro.getClass().getAnnotation(MacroDefinition.class);<NEW_LINE>if (!def.hidden()) {<NEW_LINE>builder.append("<TR>");<NEW_LINE>builder.append("<TD>").append(def.name()).append("</TD>");<NEW_LINE>builder.append("<td>");<NEW_LINE>String[] aliases = def.aliases();<NEW_LINE>if (aliases != null && aliases.length > 0) {<NEW_LINE>for (int i = 0; i < aliases.length; i++) {<NEW_LINE>if (i > 0) {<NEW_LINE>builder.append(", ");<NEW_LINE>}<NEW_LINE>builder.append(aliases[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.append("</td>");<NEW_LINE>// Escape HTML from the desciption<NEW_LINE>String description = I18N.getText(def.description()).replace("<", "<").replace(">", ">");<NEW_LINE>builder.append("<TD>").append(description).append("</td>");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.append("</table>");<NEW_LINE>MapTool.addLocalMessage(builder.toString());<NEW_LINE>} | >(MacroManager.getRegisteredMacros()); |
790,881 | public void draw(CrusherRecipe recipe, PoseStack transform, double mouseX, double mouseY) {<NEW_LINE>List<StackWithChance> validSecondaries = getValidSecondaryOutputs(recipe);<NEW_LINE>int yBase = validSecondaries.isEmpty() ? 36 : validSecondaries.size() < 2 ? 27 : 18;<NEW_LINE>for (int i = 0; i < validSecondaries.size(); i++) {<NEW_LINE>int x = 77 + i / 2 * 44;<NEW_LINE>int y = yBase + i % 2 * 18;<NEW_LINE>ClientUtils.font().draw(transform, Utils.formatDouble(validSecondaries.get(i).getChance() * 100, "0.##") + "%", x + 21, y + 6, 0x777777);<NEW_LINE>RenderSystem.color4f(1, 1, 1, 1);<NEW_LINE>}<NEW_LINE>transform.pushPose();<NEW_LINE>transform.scale(3f, 3f, 1);<NEW_LINE>this.getIcon().<MASK><NEW_LINE>transform.popPose();<NEW_LINE>} | draw(transform, 8, 0); |
667,886 | public // must obey all Subscriber rules on its consuming side<NEW_LINE>Subscriber<T> createSubscriber(final SubscriberWhiteboxVerification.WhiteboxSubscriberProbe<T> probe) {<NEW_LINE>final Processor<T, T> processor = createIdentityProcessor(processorBufferSize);<NEW_LINE>processor.subscribe(new Subscriber<T>() {<NEW_LINE><NEW_LINE>private final Promise<Subscription> subs = new Promise<Subscription>(env);<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSubscribe(final Subscription subscription) {<NEW_LINE>if (env.debugEnabled()) {<NEW_LINE>env.debug(String.format("whiteboxSubscriber::onSubscribe(%s)", subscription));<NEW_LINE>}<NEW_LINE>// the Probe must also pass subscriber verification<NEW_LINE>if (subs.isCompleted())<NEW_LINE>subscription.cancel();<NEW_LINE>probe.registerOnSubscribe(new SubscriberWhiteboxVerification.SubscriberPuppet() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void triggerRequest(long elements) {<NEW_LINE>subscription.request(elements);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void signalCancel() {<NEW_LINE>subscription.cancel();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onNext(T element) {<NEW_LINE>if (env.debugEnabled()) {<NEW_LINE>env.debug(String.format("whiteboxSubscriber::onNext(%s)", element));<NEW_LINE>}<NEW_LINE>probe.registerOnNext(element);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onComplete() {<NEW_LINE>if (env.debugEnabled()) {<NEW_LINE>env.debug("whiteboxSubscriber::onComplete()");<NEW_LINE>}<NEW_LINE>probe.registerOnComplete();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(Throwable cause) {<NEW_LINE>if (env.debugEnabled()) {<NEW_LINE>env.debug(String<MASK><NEW_LINE>}<NEW_LINE>probe.registerOnError(cause);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// we run the SubscriberVerification against this<NEW_LINE>return processor;<NEW_LINE>} | .format("whiteboxSubscriber::onError(%s)", cause)); |
1,436,425 | private boolean checkRequest(String request) {<NEW_LINE>shouldKeep = false;<NEW_LINE>rCommand = "NOOP";<NEW_LINE>rMessage = "invalid: " + request;<NEW_LINE>rStatus = rStatusBadRequest;<NEW_LINE>String[] parts = request.split("\\s");<NEW_LINE>if (parts.length != 3 || !"GET".equals(parts[0]) || !parts[1].startsWith("/")) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!rVersion.equals(parts[2])) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String cmd = parts[1].substring(1);<NEW_LINE>if (cmd.startsWith("X")) {<NEW_LINE><MASK><NEW_LINE>shouldKeep = true;<NEW_LINE>}<NEW_LINE>parts = cmd.split("\\?");<NEW_LINE>cmd = parts[0];<NEW_LINE>rQuery = "";<NEW_LINE>if (parts.length > 1) {<NEW_LINE>rQuery = parts[1];<NEW_LINE>}<NEW_LINE>parts = cmd.split("/");<NEW_LINE>if (!"START,STARTP,STOP,EXIT,SCRIPTS,IMAGES,RUN,EVAL,".contains((parts[0] + ",").toUpperCase())) {<NEW_LINE>rMessage = "invalid command: " + request;<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>rCommand = parts[0].toUpperCase();<NEW_LINE>rMessage = "";<NEW_LINE>rStatus = rStatusOK;<NEW_LINE>rRessource = "";<NEW_LINE>if (parts.length > 1) {<NEW_LINE>rRessource = cmd.substring(rCommand.length());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | cmd = cmd.substring(1); |
957,338 | public void addMappingForUrlPatterns(EnumSet<DispatcherType> types, boolean isLast, String... patterns) {<NEW_LINE>if (types == null) {<NEW_LINE>dispatcherTypes.add(DispatcherType.REQUEST);<NEW_LINE>dispatcherTypes.add(DispatcherType.ASYNC);<NEW_LINE>} else {<NEW_LINE>dispatcherTypes.addAll(types);<NEW_LINE>}<NEW_LINE>for (String mapping : patterns) {<NEW_LINE>if (!validateMappingPath(mapping)) {<NEW_LINE>throw new IllegalArgumentException("Invalid path mapping, wildcards should be the last part of a path: " + mapping);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isLast) {<NEW_LINE>urlPatterns.addAll(Arrays.asList(patterns));<NEW_LINE>} else {<NEW_LINE>List<String> <MASK><NEW_LINE>newUrlList.addAll(Arrays.asList(patterns));<NEW_LINE>newUrlList.addAll(urlPatterns);<NEW_LINE>urlPatterns = newUrlList;<NEW_LINE>}<NEW_LINE>} | newUrlList = new ArrayList<>(); |
953,518 | public static <T extends Model> List<T> processCursor(Class<? extends Model> type, Cursor cursor) {<NEW_LINE>TableInfo tableInfo = Cache.getTableInfo(type);<NEW_LINE><MASK><NEW_LINE>final List<T> entities = new ArrayList<T>();<NEW_LINE>try {<NEW_LINE>Constructor<?> entityConstructor = type.getConstructor();<NEW_LINE>if (cursor.moveToFirst()) {<NEW_LINE>List<String> columnsOrdered = new ArrayList<String>(Arrays.asList(cursor.getColumnNames()));<NEW_LINE>do {<NEW_LINE>Model entity = Cache.getEntity(type, cursor.getLong(columnsOrdered.indexOf(idName)));<NEW_LINE>if (entity == null) {<NEW_LINE>entity = (T) entityConstructor.newInstance();<NEW_LINE>}<NEW_LINE>entity.loadFromCursor(cursor);<NEW_LINE>entities.add((T) entity);<NEW_LINE>} while (cursor.moveToNext());<NEW_LINE>}<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>throw new RuntimeException("Your model " + type.getName() + " does not define a default " + "constructor. The default constructor is required for " + "now in ActiveAndroid models, as the process to " + "populate the ORM model is : " + "1. instantiate default model " + "2. populate fields");<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.e("Failed to process cursor.", e);<NEW_LINE>}<NEW_LINE>return entities;<NEW_LINE>} | String idName = tableInfo.getIdName(); |
508,725 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>String test = request.getParameter("test");<NEW_LINE>PrintWriter out = response.getWriter();<NEW_LINE>out.println("Starting --" + test + "<br>");<NEW_LINE>final TraceComponent tc = <MASK><NEW_LINE>Tr.entry(this, tc, test);<NEW_LINE>try {<NEW_LINE>System.out.println(" Start: " + test);<NEW_LINE>getClass().getMethod(test, HttpServletRequest.class, HttpServletResponse.class).invoke(this, request, response);<NEW_LINE>out.println(test + " COMPLETED SUCCESSFULLY");<NEW_LINE>System.out.println(" End: " + test);<NEW_LINE>Tr.exit(this, tc, test);<NEW_LINE>} catch (Throwable x) {<NEW_LINE>if (x instanceof InvocationTargetException)<NEW_LINE>x = x.getCause();<NEW_LINE>Tr.exit(this, tc, test, x);<NEW_LINE>out.println("<pre>ERROR in " + test + ":");<NEW_LINE>System.out.println(" End: " + test);<NEW_LINE>x.printStackTrace(out);<NEW_LINE>out.println("</pre>");<NEW_LINE>}<NEW_LINE>} | Tr.register(JMSContextTestServlet.class); |
848,430 | public void testTimerAccessFromTimeoutAfterCancelFromTimeout() throws Exception {<NEW_LINE>NpTimedObjectTimerLocal timerBean;<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>// Create a BMT Stateless Bean to test it<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>svLogger.info("Creating a BMT Stateless Bean to execute test ..." + NL);<NEW_LINE>timerBean = lookupBean(svJndi_SLBMT);<NEW_LINE>svLogger.info("Calling prepAccessAfterCancelTest() ... ");<NEW_LINE>timerBean.prepAccessAfterCancelTest(NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout);<NEW_LINE>timerBean.waitForTimer(WAIT_FOR_TIMER_RUN);<NEW_LINE>assertEquals("Unexpected timer result", NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout, NpTimedObjectTimerBean.svAccessAfterCreateResult);<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>// Create a CMT RequiresNew Stateless Bean to test it<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>svLogger.info("Creating a CMT RequiresNew Stateless Bean to execute test ..." + NL);<NEW_LINE>timerBean = lookupBean(svJndi_SLRequiresNew);<NEW_LINE>svLogger.info("Calling prepAccessAfterCancelTest() ... ");<NEW_LINE>timerBean.prepAccessAfterCancelTest(NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout);<NEW_LINE>timerBean.waitForTimer(WAIT_FOR_TIMER_RUN);<NEW_LINE>assertEquals("Unexpected timer result", <MASK><NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>// Create a CMT Required Stateless Bean to test it<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>svLogger.info("Creating a CMT Required Stateless Bean to execute test ..." + NL);<NEW_LINE>timerBean = lookupBean(svJndi_SLRequired);<NEW_LINE>svLogger.info("Calling prepAccessAfterCancelTest() ... ");<NEW_LINE>timerBean.prepAccessAfterCancelTest(NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout);<NEW_LINE>timerBean.waitForTimer(WAIT_FOR_TIMER_RUN);<NEW_LINE>assertEquals("Unexpected timer result", NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout, NpTimedObjectTimerBean.svAccessAfterCreateResult);<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>// Create a CMT NotSupported Stateless Bean to test it<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>svLogger.info("Creating a CMT NotSupported Stateless Bean to execute test ..." + NL);<NEW_LINE>timerBean = lookupBean(svJndi_SLNotSupported);<NEW_LINE>svLogger.info("Calling prepAccessAfterCancelTest() ... ");<NEW_LINE>timerBean.prepAccessAfterCancelTest(NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout);<NEW_LINE>timerBean.waitForTimer(WAIT_FOR_TIMER_RUN);<NEW_LINE>assertEquals("Unexpected timer result", NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout, NpTimedObjectTimerBean.svAccessAfterCreateResult);<NEW_LINE>} | NpTimedObjectTimerBean.infoAccessAfterCancelFromTimeout, NpTimedObjectTimerBean.svAccessAfterCreateResult); |
1,648,958 | final DeleteConnectorResult executeDeleteConnector(DeleteConnectorRequest deleteConnectorRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteConnectorRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteConnectorRequest> request = null;<NEW_LINE>Response<DeleteConnectorResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteConnectorRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "KafkaConnect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteConnector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteConnectorResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteConnectorResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(deleteConnectorRequest)); |
110,922 | private void load(SoundEffect3Definition se, InputStream var1, SoundEffect2Definition var2) {<NEW_LINE><MASK><NEW_LINE>se.field1155[0] = var3 >> 4;<NEW_LINE>se.field1155[1] = var3 & 15;<NEW_LINE>if (var3 != 0) {<NEW_LINE>se.field1156[0] = var1.readUnsignedShort();<NEW_LINE>se.field1156[1] = var1.readUnsignedShort();<NEW_LINE>int var4 = var1.readUnsignedByte();<NEW_LINE>int var5;<NEW_LINE>int var6;<NEW_LINE>for (var5 = 0; var5 < 2; ++var5) {<NEW_LINE>for (var6 = 0; var6 < se.field1155[var5]; ++var6) {<NEW_LINE>se.field1154[var5][0][var6] = var1.readUnsignedShort();<NEW_LINE>se.field1159[var5][0][var6] = var1.readUnsignedShort();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (var5 = 0; var5 < 2; ++var5) {<NEW_LINE>for (var6 = 0; var6 < se.field1155[var5]; ++var6) {<NEW_LINE>if ((var4 & 1 << var5 * 4 << var6) != 0) {<NEW_LINE>se.field1154[var5][1][var6] = var1.readUnsignedShort();<NEW_LINE>se.field1159[var5][1][var6] = var1.readUnsignedShort();<NEW_LINE>} else {<NEW_LINE>se.field1154[var5][1][var6] = se.field1154[var5][0][var6];<NEW_LINE>se.field1159[var5][1][var6] = se.field1159[var5][0][var6];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (var4 != 0 || se.field1156[1] != se.field1156[0]) {<NEW_LINE>se2Loader.method1144(var2, var1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>int[] var7 = se.field1156;<NEW_LINE>se.field1156[1] = 0;<NEW_LINE>var7[0] = 0;<NEW_LINE>}<NEW_LINE>} | int var3 = var1.readUnsignedByte(); |
905,609 | public PageSet<? extends StorageMetadata> list() {<NEW_LINE>PageSet<? extends StorageMetadata> upstream = this.delegate().list();<NEW_LINE>ImmutableList.Builder<StorageMetadata> results = new ImmutableList.Builder<>();<NEW_LINE>Set<String> virtualBuckets = new HashSet<>();<NEW_LINE>for (StorageMetadata sm : upstream) {<NEW_LINE>Matcher matcher = SHARD_RE.matcher(sm.getName());<NEW_LINE>if (!matcher.matches()) {<NEW_LINE>results.add(sm);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String prefix = matcher.group("prefix");<NEW_LINE>String virtualBucketName = this.prefixMap.get(prefix);<NEW_LINE>if (virtualBucketName == null) {<NEW_LINE>results.add(sm);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!virtualBuckets.contains(prefix)) {<NEW_LINE>virtualBuckets.add(prefix);<NEW_LINE>MutableStorageMetadata virtualBucket = new MutableStorageMetadataImpl();<NEW_LINE>virtualBucket.setCreationDate(sm.getCreationDate());<NEW_LINE>virtualBucket.setETag(sm.getETag());<NEW_LINE>virtualBucket.setId(sm.getProviderId());<NEW_LINE>virtualBucket.setLastModified(sm.getLastModified());<NEW_LINE>virtualBucket.setLocation(sm.getLocation());<NEW_LINE>virtualBucket.setName(virtualBucketName);<NEW_LINE>virtualBucket.<MASK><NEW_LINE>virtualBucket.setTier(sm.getTier());<NEW_LINE>virtualBucket.setType(sm.getType());<NEW_LINE>virtualBucket.setUri(sm.getUri());<NEW_LINE>// copy the user metadata from the first shard as part<NEW_LINE>// of the response<NEW_LINE>virtualBucket.setUserMetadata(sm.getUserMetadata());<NEW_LINE>results.add(virtualBucket);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new PageSetImpl<>(results.build(), upstream.getNextMarker());<NEW_LINE>} | setSize(sm.getSize()); |
426,264 | public void display(final SheetStub stub, final boolean early) {<NEW_LINE>// Since we are on Swing EDT, use asynchronous processing<NEW_LINE>OmrExecutors.getCachedLowExecutor().submit(() -> {<NEW_LINE>try {<NEW_LINE>LogUtil.start(stub);<NEW_LINE>// Check whether we should run early steps on the sheet<NEW_LINE>checkStubStatus(stub, early);<NEW_LINE>SwingUtilities.invokeAndWait(() -> {<NEW_LINE>// Race condition: let's check we are working on the selected stub<NEW_LINE>SheetStub selected = getSelectedStub();<NEW_LINE>if (stub == selected) {<NEW_LINE>// Tell the selected assembly that it now has the focus<NEW_LINE>// (to display stub related boards and error pane)<NEW_LINE>stub.getAssembly().assemblySelected();<NEW_LINE>// Stub status<NEW_LINE>BookActions.getInstance().updateProperties(stub.getSheet());<NEW_LINE>// GUI: Perform sheets upgrade?<NEW_LINE>final Book book = stub.getBook();<NEW_LINE>if (!book.promptedForUpgrade() && !book.getStubsToUpgrade().isEmpty()) {<NEW_LINE>promptForUpgrades(stub, book.getStubsToUpgrade());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>LogUtil.stopStub();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | logger.debug("Too late for {}", stub); |
1,577,803 | public List<DataFetcherResult<CorpUser>> batchLoad(final List<String> urns, final QueryContext context) {<NEW_LINE>try {<NEW_LINE>final List<Urn> corpUserUrns = urns.stream().map(UrnUtils::getUrn).<MASK><NEW_LINE>final Map<Urn, EntityResponse> corpUserMap = _entityClient.batchGetV2(CORP_USER_ENTITY_NAME, new HashSet<>(corpUserUrns), null, context.getAuthentication());<NEW_LINE>final List<EntityResponse> results = new ArrayList<>();<NEW_LINE>for (Urn urn : corpUserUrns) {<NEW_LINE>results.add(corpUserMap.getOrDefault(urn, null));<NEW_LINE>}<NEW_LINE>return results.stream().map(gmsCorpUser -> gmsCorpUser == null ? null : DataFetcherResult.<CorpUser>newResult().data(CorpUserMapper.map(gmsCorpUser)).build()).collect(Collectors.toList());<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Failed to batch load Datasets", e);<NEW_LINE>}<NEW_LINE>} | collect(Collectors.toList()); |
694,438 | final GetWorkUnitResultsResult executeGetWorkUnitResults(GetWorkUnitResultsRequest getWorkUnitResultsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getWorkUnitResultsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetWorkUnitResultsRequest> request = null;<NEW_LINE>Response<GetWorkUnitResultsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new GetWorkUnitResultsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkUnitResultsRequest));<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, "LakeFormation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkUnitResults");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "data-";<NEW_LINE>String resolvedHostPrefix = String.format("data-");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetWorkUnitResultsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(false).withHasStreamingSuccessResponse(true), new GetWorkUnitResultsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>request.addHandlerContext(HandlerContextKey.HAS_STREAMING_OUTPUT, Boolean.TRUE);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,764,474 | public void init(SegmentGenerationJobSpec spec) {<NEW_LINE>_spec = spec;<NEW_LINE>if (_spec.getInputDirURI() == null) {<NEW_LINE>throw new RuntimeException("Missing property 'inputDirURI' in 'jobSpec' file");<NEW_LINE>}<NEW_LINE>if (_spec.getOutputDirURI() == null) {<NEW_LINE>throw new RuntimeException("Missing property 'outputDirURI' in 'jobSpec' file");<NEW_LINE>}<NEW_LINE>if (_spec.getRecordReaderSpec() == null) {<NEW_LINE>throw new RuntimeException("Missing property 'recordReaderSpec' in 'jobSpec' file");<NEW_LINE>}<NEW_LINE>if (_spec.getTableSpec() == null) {<NEW_LINE>throw new RuntimeException("Missing property 'tableSpec' in 'jobSpec' file");<NEW_LINE>}<NEW_LINE>if (_spec.getTableSpec().getTableName() == null) {<NEW_LINE>throw new RuntimeException("Missing property 'tableName' in 'tableSpec'");<NEW_LINE>}<NEW_LINE>if (_spec.getTableSpec().getSchemaURI() == null) {<NEW_LINE>if (_spec.getPinotClusterSpecs() == null || _spec.getPinotClusterSpecs().length == 0) {<NEW_LINE>throw new RuntimeException("Missing property 'schemaURI' in 'tableSpec'");<NEW_LINE>}<NEW_LINE>PinotClusterSpec pinotClusterSpec = _spec.getPinotClusterSpecs()[0];<NEW_LINE>String schemaURI = SegmentGenerationUtils.generateSchemaURI(pinotClusterSpec.getControllerURI(), _spec.getTableSpec().getTableName());<NEW_LINE>_spec.getTableSpec().setSchemaURI(schemaURI);<NEW_LINE>}<NEW_LINE>if (_spec.getTableSpec().getTableConfigURI() == null) {<NEW_LINE>if (_spec.getPinotClusterSpecs() == null || _spec.getPinotClusterSpecs().length == 0) {<NEW_LINE>throw new RuntimeException("Missing property 'tableConfigURI' in 'tableSpec'");<NEW_LINE>}<NEW_LINE>PinotClusterSpec pinotClusterSpec = _spec.getPinotClusterSpecs()[0];<NEW_LINE>String tableConfigURI = SegmentGenerationUtils.generateTableConfigURI(pinotClusterSpec.getControllerURI(), _spec.getTableSpec().getTableName());<NEW_LINE>_spec.getTableSpec().setTableConfigURI(tableConfigURI);<NEW_LINE>}<NEW_LINE>if (_spec.getExecutionFrameworkSpec().getExtraConfigs() == null) {<NEW_LINE>_spec.getExecutionFrameworkSpec().setExtraConfigs<MASK><NEW_LINE>}<NEW_LINE>} | (new HashMap<>()); |
100,082 | private List<Object> createDefaultHoverInfos(String textAtHoverPosition, Object evalResultObject, LanguageInfo langInfo) {<NEW_LINE>List<Object> contents = new ArrayList<>();<NEW_LINE>contents.add(org.graalvm.tools.lsp.server.types.MarkedString.create(langInfo.getId(), textAtHoverPosition));<NEW_LINE>String result = evalResultObject != null ? toString(evalResultObject, langInfo) : "";<NEW_LINE>if (!textAtHoverPosition.equals(result)) {<NEW_LINE>String resultObjectString = evalResultObject instanceof String ? "\"" + result + "\"" : result;<NEW_LINE>contents.add(resultObjectString);<NEW_LINE>}<NEW_LINE>String detailText = completionHandler.createCompletionDetail(evalResultObject, langInfo);<NEW_LINE>contents.add("meta-object: " + detailText);<NEW_LINE>Object documentation = completionHandler.getDocumentation(evalResultObject, langInfo);<NEW_LINE>if (documentation instanceof String) {<NEW_LINE>contents.add(documentation);<NEW_LINE>} else if (documentation instanceof MarkupContent) {<NEW_LINE>MarkupContent markup = (MarkupContent) documentation;<NEW_LINE>if (markup.getKind().equals(MarkupKind.PlainText)) {<NEW_LINE>contents.add(markup.getValue());<NEW_LINE>} else {<NEW_LINE>contents.add(org.graalvm.tools.lsp.server.types.MarkedString.create(langInfo.getId()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return contents;<NEW_LINE>} | , markup.getValue())); |
523,128 | public void fetch() {<NEW_LINE>collectObj();<NEW_LINE>Iterator<Integer> itr = serverObjMap.keySet().iterator();<NEW_LINE>ActiveSpeedData a = new ActiveSpeedData();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>int serverId = itr.next();<NEW_LINE>TcpProxy tcp = TcpProxy.getTcpProxy(serverId);<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("objHash", serverObjMap.get(serverId));<NEW_LINE>MapPack p = (MapPack) tcp.getSingle(RequestCmd.ACTIVESPEED_GROUP_REAL_TIME_GROUP, param);<NEW_LINE>if (p == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (p != null) {<NEW_LINE>a.act1 += CastUtil.cint<MASK><NEW_LINE>a.act2 += CastUtil.cint(p.get("act2"));<NEW_LINE>a.act3 += CastUtil.cint(p.get("act3"));<NEW_LINE>a.tps += CastUtil.cint(p.get("tps"));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>ConsoleProxy.errorSafe(e.toString());<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>activeSpeedData = a;<NEW_LINE>} | (p.get("act1")); |
499,989 | private void sendRequest(Request request, RequestContext requestContext, Map<String, String> wireAttrs, TransportCallback<StreamResponse> callback) {<NEW_LINE>final TransportCallback<StreamResponse> decoratedCallback = decorateUserCallback(request, callback);<NEW_LINE>final NettyClientState state = _state.get();<NEW_LINE>if (state != NettyClientState.RUNNING) {<NEW_LINE>decoratedCallback.onResponse(TransportResponseImpl.error(new IllegalStateException("Client is not running")));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final long resolvedRequestTimeout = resolveRequestTimeout(requestContext, _requestTimeout);<NEW_LINE>// Timeout ensures the request callback is always invoked and is cancelled before the<NEW_LINE>// responsibility of invoking the callback is handed over to the pipeline.<NEW_LINE>final Timeout<None> timeout = new Timeout<>(_scheduler, resolvedRequestTimeout, TimeUnit.<MASK><NEW_LINE>timeout.addTimeoutTask(() -> decoratedCallback.onResponse(TransportResponseImpl.error(new TimeoutException("Exceeded request timeout of " + resolvedRequestTimeout + "ms"))));<NEW_LINE>// resolve address<NEW_LINE>final SocketAddress address;<NEW_LINE>try {<NEW_LINE>TimingContextUtil.markTiming(requestContext, TIMING_KEY);<NEW_LINE>address = resolveAddress(request, requestContext);<NEW_LINE>TimingContextUtil.markTiming(requestContext, TIMING_KEY);<NEW_LINE>} catch (Exception e) {<NEW_LINE>decoratedCallback.onResponse(TransportResponseImpl.error(e));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Serialize wire attributes<NEW_LINE>final Request requestWithWireAttrHeaders;<NEW_LINE>if (request instanceof StreamRequest) {<NEW_LINE>requestWithWireAttrHeaders = buildRequestWithWireAttributes((StreamRequest) request, wireAttrs);<NEW_LINE>} else {<NEW_LINE>MessageType.setMessageType(MessageType.Type.REST, wireAttrs);<NEW_LINE>requestWithWireAttrHeaders = buildRequestWithWireAttributes((RestRequest) request, wireAttrs);<NEW_LINE>}<NEW_LINE>// Gets channel pool<NEW_LINE>final AsyncPool<Channel> pool;<NEW_LINE>try {<NEW_LINE>pool = getChannelPoolManagerPerRequest(requestWithWireAttrHeaders).getPoolForAddress(address);<NEW_LINE>} catch (IllegalStateException e) {<NEW_LINE>decoratedCallback.onResponse(TransportResponseImpl.error(e));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Saves protocol version in request context<NEW_LINE>requestContext.putLocalAttr(R2Constants.HTTP_PROTOCOL_VERSION, _protocolVersion);<NEW_LINE>final Cancellable pendingGet = pool.get(new ChannelPoolGetCallback(pool, requestWithWireAttrHeaders, requestContext, decoratedCallback, timeout, resolvedRequestTimeout, _streamingTimeout));<NEW_LINE>if (pendingGet != null) {<NEW_LINE>timeout.addTimeoutTask(pendingGet::cancel);<NEW_LINE>}<NEW_LINE>} | MILLISECONDS, None.none()); |
1,039,039 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {<NEW_LINE>super.onSizeChanged(w, h, oldw, oldh);<NEW_LINE>try {<NEW_LINE>rect = new Rect(innerPadding, innerPadding, w - innerPadding, h - innerPadding);<NEW_LINE>bitmap = Bitmap.createBitmap(w - 2 * innerPadding, h - 2 * innerPadding, Config.ARGB_8888);<NEW_LINE>fullCircleRadius = Math.min(rect.width(), rect.height()) / 2;<NEW_LINE>innerCircleRadius = fullCircleRadius * (1 - FADE_OUT_FRACTION);<NEW_LINE>scaledWidth = rect.width() / scale;<NEW_LINE>scaledHeight = rect.height() / scale;<NEW_LINE>scaledFullCircleRadius = Math.min(scaledWidth, scaledHeight) / 2;<NEW_LINE>scaledInnerCircleRadius = scaledFullCircleRadius * (1 - FADE_OUT_FRACTION);<NEW_LINE>scaledFadeOutSize = scaledFullCircleRadius - scaledInnerCircleRadius;<NEW_LINE>scaledPixels <MASK><NEW_LINE>pixels = new int[rect.width() * rect.height()];<NEW_LINE>createBitmap();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.e(e);<NEW_LINE>}<NEW_LINE>} | = new int[scaledWidth * scaledHeight]; |
1,004,750 | private ImmutableMap<String, ?> generateBootstrap(String zone, boolean supportIpv6) {<NEW_LINE>ImmutableMap.Builder<String, Object> nodeBuilder = ImmutableMap.builder();<NEW_LINE>nodeBuilder.put("id", "C2P-" + (rand.nextInt() & Integer.MAX_VALUE));<NEW_LINE>if (!zone.isEmpty()) {<NEW_LINE>nodeBuilder.put("locality", ImmutableMap.of("zone", zone));<NEW_LINE>}<NEW_LINE>if (supportIpv6) {<NEW_LINE>nodeBuilder.put("metadata", ImmutableMap.of("TRAFFICDIRECTOR_DIRECTPATH_C2P_IPV6_CAPABLE", true));<NEW_LINE>}<NEW_LINE>ImmutableMap.Builder<String, Object> serverBuilder = ImmutableMap.builder();<NEW_LINE>String serverUri = "directpath-pa.googleapis.com";<NEW_LINE>if (serverUriOverride != null && serverUriOverride.length() > 0) {<NEW_LINE>serverUri = serverUriOverride;<NEW_LINE>}<NEW_LINE>serverBuilder.put("server_uri", serverUri);<NEW_LINE>serverBuilder.put("channel_creds", ImmutableList.of(ImmutableMap.<MASK><NEW_LINE>serverBuilder.put("server_features", ImmutableList.of("xds_v3"));<NEW_LINE>return ImmutableMap.of("node", nodeBuilder.build(), "xds_servers", ImmutableList.of(serverBuilder.build()));<NEW_LINE>} | of("type", "google_default"))); |
447,553 | public void onDraw(Canvas canvas) {<NEW_LINE>Rect rect = targetElement.getRect();<NEW_LINE>Rect originRect = targetElement.getOriginRect();<NEW_LINE>canvas.drawRect(originRect, dashLinePaint);<NEW_LINE>Element parentElement = targetElement.getParentElement();<NEW_LINE>if (parentElement != null) {<NEW_LINE>Rect parentRect = parentElement.getRect();<NEW_LINE>int x = rect.left + rect.width() / 2;<NEW_LINE>int y = rect.top + rect.height() / 2;<NEW_LINE>drawLineWithText(canvas, rect.left, y, parentRect.left, y, dip2px(2));<NEW_LINE>drawLineWithText(canvas, x, rect.top, x, parentRect.top, dip2px(2));<NEW_LINE>drawLineWithText(canvas, rect.right, y, parentRect.right<MASK><NEW_LINE>drawLineWithText(canvas, x, rect.bottom, x, parentRect.bottom, dip2px(2));<NEW_LINE>}<NEW_LINE>if (onDragListener != null) {<NEW_LINE>onDragListener.showOffset("Offset:\n" + "x -> " + px2dip(rect.left - originRect.left, true) + " y -> " + px2dip(rect.top - originRect.top, true));<NEW_LINE>}<NEW_LINE>} | , y, dip2px(2)); |
1,575,086 | public void beforeStartNewCreatedVm(VmInstanceSpec spec) {<NEW_LINE>String providerUuid = new NetworkServiceProviderLookup().lookupUuidByType(FlatNetworkServiceConstant.FLAT_NETWORK_SERVICE_TYPE_STRING);<NEW_LINE>Map<String, List<String>> vmStaticIps = new StaticIpOperator().getStaticIpbyVmUuid(spec.getVmInventory().getUuid());<NEW_LINE>// make sure the Flat DHCP acquired DHCP server IP before starting VMs,<NEW_LINE>// otherwise it may not be able to get IP when lots of VMs start concurrently<NEW_LINE>// because the logic of VM acquiring IP is ahead flat DHCP acquiring IP<NEW_LINE>for (L3NetworkInventory l3 : VmNicSpec.getL3NetworkInventoryOfSpec(spec.getL3Networks())) {<NEW_LINE>List<String> serviceTypes = l3.getNetworkServiceTypesFromProvider(providerUuid);<NEW_LINE>if (serviceTypes.contains(NetworkServiceType.DHCP.toString())) {<NEW_LINE>Map<Integer, String> staticIpMap = new StaticIpOperator().getNicStaticIpMap(vmStaticIps.get<MASK><NEW_LINE>for (Integer ipversion : l3.getIpVersions()) {<NEW_LINE>allocateDhcpIp(l3.getUuid(), ipversion, staticIpMap.get(ipversion));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (l3.getUuid())); |
362,762 | public void invoke(@NotNull String line, @NotNull Repl api, @NotNull Supplier<@NotNull String> scanner) throws QuitReplException {<NEW_LINE>Concrete.Expression expr = api.preprocessExpr(line);<NEW_LINE>if (api.checkErrors() || expr == null)<NEW_LINE>return;<NEW_LINE>if (expr instanceof Concrete.ReferenceExpression && ((Concrete.ReferenceExpression) expr).getReferent() instanceof TCDefReferable) {<NEW_LINE>Definition def = ((TCDefReferable) ((Concrete.ReferenceExpression) expr).getReferent()).getTypechecked();<NEW_LINE>if (def == null) {<NEW_LINE>api.eprintln("[ERROR] Definition was not typechecked yet");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>ToAbstractVisitor.convert(def, api.getPrettyPrinterConfig()).prettyPrint(builder, api.getPrettyPrinterConfig());<NEW_LINE>api.println(builder);<NEW_LINE>} else {<NEW_LINE>api.checkExpr(expr, null, result -> {<NEW_LINE>if (result != null)<NEW_LINE>api.println(api.prettyExpr(new StringBuilder(), api.<MASK><NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | normalize(result.expression))); |
1,358,870 | public String render(EnumModel model, int index, int size, Map<String, Object> session) {<NEW_LINE>if (isExcludedClass(model.getType().getName())) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>StringWriter sw = new StringWriter();<NEW_LINE>PrintWriter writer = new PrintWriter(sw);<NEW_LINE>if (index == 0) {<NEW_LINE>Util.generateLicense(writer);<NEW_LINE>// include a file if present<NEW_LINE>writer.print(includeFileIfPresent("enum.header.d.ts"));<NEW_LINE>} else {<NEW_LINE>writer.print("\n");<NEW_LINE>}<NEW_LINE>generateDoc(writer, model.getDoc(), "");<NEW_LINE>writer.printf("export enum %s {\n", model.getType().getRaw().getSimpleName());<NEW_LINE>for (int i = 0; i < model.getValues().size(); i++) {<NEW_LINE>EnumValueInfo value = model.getValues().get(i);<NEW_LINE>writer.printf(<MASK><NEW_LINE>if (i != model.getValues().size() - 1) {<NEW_LINE>writer.print(",");<NEW_LINE>}<NEW_LINE>writer.print("\n");<NEW_LINE>}<NEW_LINE>writer.print("}\n");<NEW_LINE>if (index == size - 1) {<NEW_LINE>// include a file if present<NEW_LINE>writer.print(includeFileIfPresent("enum.footer.d.ts"));<NEW_LINE>}<NEW_LINE>return sw.toString();<NEW_LINE>} | " %s", value.getIdentifier()); |
1,211,371 | public boolean handle(KeyEvent event) {<NEW_LINE>event = mTranslator.doTranslateKeys(event);<NEW_LINE>setDispatchEvent(event);<NEW_LINE>boolean isUpAction = event.getAction() == DEFAULT_ACTION;<NEW_LINE>boolean isDownAction = event.getAction() == KeyEvent.ACTION_DOWN;<NEW_LINE>// user opens the video and continue to hold the ok button<NEW_LINE>boolean stillHoldingOk = mDisable && isOkKey(event);<NEW_LINE>if (isVolumeEvent(event) || stillHoldingOk) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean uiVisible = mFragment.isUiVisible();<NEW_LINE>if (isBackKey(event) && !uiVisible) {<NEW_LINE>if (isUpAction) {<NEW_LINE>mFragment.onBackPressed();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (isBackKey(event) || isOutFakeKey(event)) {<NEW_LINE>return hideUI(event);<NEW_LINE>}<NEW_LINE>if (applyMediaKeys(event)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Show the controls on any key event.<NEW_LINE>if (!uiVisible && isDownAction) {<NEW_LINE>mFragment.getExoPlayerView().showController();<NEW_LINE>}<NEW_LINE>if (uiVisible && isMenuKey(event) && isDownAction) {<NEW_LINE>mFragment.getExoPlayerView().hideController();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (applySeekAction(event, uiVisible) || isNonOKAction(event, uiVisible)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (uiVisible) {<NEW_LINE>// reset controller auto-hide timeout<NEW_LINE>mFragment<MASK><NEW_LINE>}<NEW_LINE>// // Fix focus lost after Suggestions<NEW_LINE>// if (mFragment.getExoPlayerView().findFocus() == null) {<NEW_LINE>// mFragment.getExoPlayerView().findViewById(R.id.exo_suggestions).requestFocus();<NEW_LINE>// }<NEW_LINE>// If the event was not handled then see if the player view can handle it as a media key event.<NEW_LINE>return mFragment.getExoPlayerView().dispatchKeyEvent(event);<NEW_LINE>} | .getExoPlayerView().showController(); |
61,899 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>app = requireMyApplication();<NEW_LINE>boolean nightMode = !app.getSettings().isLightActionBar();<NEW_LINE>LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);<NEW_LINE>View view = themedInflater.inflate(R.layout.fragment_edit_poi_normal, container, false);<NEW_LINE>InputFilter[] lengthLimit = new InputFilter[] { new LengthFilter(AMENITY_TEXT_LENGTH) };<NEW_LINE>streetEditText = view.findViewById(R.id.streetEditText);<NEW_LINE>houseNumberEditText = view.findViewById(R.id.houseNumberEditText);<NEW_LINE>phoneEditText = view.findViewById(R.id.phoneEditText);<NEW_LINE>webSiteEditText = view.findViewById(R.id.webSiteEditText);<NEW_LINE>descriptionEditText = view.findViewById(R.id.descriptionEditText);<NEW_LINE>addTextWatcher(OSMTagKey.ADDR_STREET.getValue(), streetEditText);<NEW_LINE>addTextWatcher(OSMTagKey.WEBSITE.getValue(), webSiteEditText);<NEW_LINE>addTextWatcher(OSMTagKey.PHONE.getValue(), phoneEditText);<NEW_LINE>addTextWatcher(OSMTagKey.<MASK><NEW_LINE>addTextWatcher(OSMTagKey.DESCRIPTION.getValue(), descriptionEditText);<NEW_LINE>streetEditText.setFilters(lengthLimit);<NEW_LINE>houseNumberEditText.setFilters(lengthLimit);<NEW_LINE>phoneEditText.setFilters(lengthLimit);<NEW_LINE>webSiteEditText.setFilters(lengthLimit);<NEW_LINE>descriptionEditText.setFilters(lengthLimit);<NEW_LINE>AndroidUtils.setTextHorizontalGravity(streetEditText, Gravity.START);<NEW_LINE>AndroidUtils.setTextHorizontalGravity(houseNumberEditText, Gravity.START);<NEW_LINE>AndroidUtils.setTextHorizontalGravity(phoneEditText, Gravity.START);<NEW_LINE>AndroidUtils.setTextHorizontalGravity(webSiteEditText, Gravity.START);<NEW_LINE>AndroidUtils.setTextHorizontalGravity(descriptionEditText, Gravity.START);<NEW_LINE>Button addOpeningHoursButton = view.findViewById(R.id.addOpeningHoursButton);<NEW_LINE>addOpeningHoursButton.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>BasicOpeningHourRule rule = new BasicOpeningHourRule();<NEW_LINE>rule.setStartTime(9 * 60);<NEW_LINE>rule.setEndTime(18 * 60);<NEW_LINE>if (openingHoursAdapter.openingHours.getRules().isEmpty()) {<NEW_LINE>rule.setDays(new boolean[] { true, true, true, true, true, false, false });<NEW_LINE>}<NEW_LINE>OpeningHoursDaysDialogFragment fragment = OpeningHoursDaysDialogFragment.createInstance(rule, -1);<NEW_LINE>fragment.show(getChildFragmentManager(), "OpenTimeDialogFragment");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>int iconColor = ColorUtilities.getSecondaryTextColor(app, nightMode);<NEW_LINE>Drawable clockDrawable = getPaintedContentIcon(R.drawable.ic_action_time, iconColor);<NEW_LINE>Drawable deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);<NEW_LINE>LinearLayout openHoursContainer = view.findViewById(R.id.openHoursContainer);<NEW_LINE>if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {<NEW_LINE>openingHoursAdapter = new OpeningHoursAdapter(app, (OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS), openHoursContainer, getData(), clockDrawable, deleteDrawable);<NEW_LINE>openingHoursAdapter.updateViews();<NEW_LINE>} else {<NEW_LINE>openingHoursAdapter = new OpeningHoursAdapter(app, new OpeningHours(), openHoursContainer, getData(), clockDrawable, deleteDrawable);<NEW_LINE>}<NEW_LINE>onFragmentActivated();<NEW_LINE>return view;<NEW_LINE>} | ADDR_HOUSE_NUMBER.getValue(), houseNumberEditText); |
66,054 | public static void main(String[] args) throws InterruptedException {<NEW_LINE>observationRegistry.observationConfig().observationHandler(new ObservationTextPublisher()).<MASK><NEW_LINE>observationRegistry.observationConfig().tagsProvider(new CustomTagsProvider()).observationPredicate(new IgnoringObservationPredicate());<NEW_LINE>Observation observation = Observation.createNotStarted("sample.operation", new CustomContext(), observationRegistry).contextualName("CALL sampleOperation").tagsProvider(new CustomLocalTagsProvider()).lowCardinalityTag("a", "1").highCardinalityTag("time", Instant.now().toString()).start();<NEW_LINE>try (Observation.Scope scope = observation.openScope()) {<NEW_LINE>Thread.sleep(1_000);<NEW_LINE>observation.error(new IOException("simulated"));<NEW_LINE>}<NEW_LINE>observation.stop();<NEW_LINE>Observation.start("sample.no-context", observationRegistry).stop();<NEW_LINE>Observation.start("sample.unsupported", new UnsupportedContext(), observationRegistry).stop();<NEW_LINE>Observation.start("sample.ignored", new CustomContext(), observationRegistry).stop();<NEW_LINE>System.out.println("---");<NEW_LINE>System.out.println(registry.getMetersAsString());<NEW_LINE>} | observationHandler(new TimerObservationHandler(registry)); |
834,942 | public List<String> suggestionList(final String query) throws IOException, ExtractionException {<NEW_LINE>final List<String> suggestions = new ArrayList<>();<NEW_LINE>final Downloader dl = NewPipe.getDownloader();<NEW_LINE>final String url = SOUNDCLOUD_API_V2_URL + "search/queries" + "?q=" + URLEncoder.encode(query, UTF_8) + "&client_id=" <MASK><NEW_LINE>final String response = dl.get(url, getExtractorLocalization()).responseBody();<NEW_LINE>try {<NEW_LINE>final JsonArray collection = JsonParser.object().from(response).getArray("collection");<NEW_LINE>for (final Object suggestion : collection) {<NEW_LINE>if (suggestion instanceof JsonObject) {<NEW_LINE>suggestions.add(((JsonObject) suggestion).getString("query"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return suggestions;<NEW_LINE>} catch (final JsonParserException e) {<NEW_LINE>throw new ParsingException("Could not parse json response", e);<NEW_LINE>}<NEW_LINE>} | + SoundcloudParsingHelper.clientId() + "&limit=10"; |
1,699,468 | public static Object calculateValue(Expression e) {<NEW_LINE>if (e instanceof Literal) {<NEW_LINE>((Literal) e).computeConstant();<NEW_LINE>switch(e.constant.typeID()) {<NEW_LINE>case TypeIds.T_int:<NEW_LINE>return e.constant.intValue();<NEW_LINE>case TypeIds.T_byte:<NEW_LINE><MASK><NEW_LINE>case TypeIds.T_short:<NEW_LINE>return e.constant.shortValue();<NEW_LINE>case TypeIds.T_char:<NEW_LINE>return e.constant.charValue();<NEW_LINE>case TypeIds.T_float:<NEW_LINE>return e.constant.floatValue();<NEW_LINE>case TypeIds.T_double:<NEW_LINE>return e.constant.doubleValue();<NEW_LINE>case TypeIds.T_boolean:<NEW_LINE>return e.constant.booleanValue();<NEW_LINE>case TypeIds.T_long:<NEW_LINE>return e.constant.longValue();<NEW_LINE>case TypeIds.T_JavaLangString:<NEW_LINE>return e.constant.stringValue();<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else if (e instanceof ClassLiteralAccess) {<NEW_LINE>return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess) e).type.getTypeName()));<NEW_LINE>} else if (e instanceof SingleNameReference) {<NEW_LINE>return new FieldSelect(new String(((SingleNameReference) e).token));<NEW_LINE>} else if (e instanceof QualifiedNameReference) {<NEW_LINE>String qName = Eclipse.toQualifiedName(((QualifiedNameReference) e).tokens);<NEW_LINE>int idx = qName.lastIndexOf('.');<NEW_LINE>return new FieldSelect(idx == -1 ? qName : qName.substring(idx + 1));<NEW_LINE>} else if (e instanceof UnaryExpression) {<NEW_LINE>if ("-".equals(((UnaryExpression) e).operatorToString())) {<NEW_LINE>Object inner = calculateValue(((UnaryExpression) e).expression);<NEW_LINE>if (inner instanceof Integer)<NEW_LINE>return -((Integer) inner).intValue();<NEW_LINE>if (inner instanceof Byte)<NEW_LINE>return -((Byte) inner).byteValue();<NEW_LINE>if (inner instanceof Short)<NEW_LINE>return -((Short) inner).shortValue();<NEW_LINE>if (inner instanceof Long)<NEW_LINE>return -((Long) inner).longValue();<NEW_LINE>if (inner instanceof Float)<NEW_LINE>return -((Float) inner).floatValue();<NEW_LINE>if (inner instanceof Double)<NEW_LINE>return -((Double) inner).doubleValue();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | return e.constant.byteValue(); |
544,843 | public Clustering<MeanModel> run(Relation<NumberVector> relation) {<NEW_LINE>final int dim = RelationUtil.dimensionality(relation);<NEW_LINE>CFTree<?> tree = cffactory.newTree(relation.getDBIDs(), relation, storeIds);<NEW_LINE>Map<ClusterFeature, DBIDs> idmap = new Reference2ObjectOpenHashMap<>(tree.numLeaves());<NEW_LINE>if (storeIds) {<NEW_LINE>for (LeafIterator<?> it = tree.leafIterator(); it.valid(); it.advance()) {<NEW_LINE>idmap.put(it.get(), tree.getDBIDs(it.get()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// The CFTree did not store point ids.<NEW_LINE>for (DBIDIter iter = relation.iterDBIDs(); iter.valid(); iter.advance()) {<NEW_LINE>ClusterFeature cf = tree.findLeaf(relation.get(iter));<NEW_LINE>ModifiableDBIDs ids = (ModifiableDBIDs) idmap.get(cf);<NEW_LINE>if (ids == null) {<NEW_LINE>idmap.put(cf, ids = DBIDUtil.newArray(cf.getWeight()));<NEW_LINE>}<NEW_LINE>ids.add(iter);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Clustering<MeanModel> result = new Clustering<>();<NEW_LINE>for (Map.Entry<ClusterFeature, DBIDs> ent : idmap.entrySet()) {<NEW_LINE>ClusterFeature leaf = ent.getKey();<NEW_LINE>double[] center = leaf.toArray();<NEW_LINE>double[] variance = new double[dim];<NEW_LINE>for (int i = 0; i < dim; i++) {<NEW_LINE>variance[i] = leaf.variance(i);<NEW_LINE>}<NEW_LINE>result.addToplevelCluster(new Cluster<>(ent.getValue(), new EMModel(center<MASK><NEW_LINE>}<NEW_LINE>DoubleStatistic varstat = new DoubleStatistic(this.getClass().getName() + ".varsum");<NEW_LINE>double varsum = 0.;<NEW_LINE>for (LeafIterator<?> iter = tree.leafIterator(); iter.valid(); iter.advance()) {<NEW_LINE>varsum += iter.get().sumdev();<NEW_LINE>}<NEW_LINE>LOG.statistics(varstat.setDouble(varsum));<NEW_LINE>Metadata.of(result).setLongName("BETULA Leaf Nodes");<NEW_LINE>return result;<NEW_LINE>} | , diagonal(variance)))); |
815,003 | private void readObject(java.io.ObjectInputStream objectInputStream) throws java.io.IOException, java.lang.ClassNotFoundException {<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.entry(this, cclass, "readObject", "objectInputStream=" + objectInputStream + "(java.io.ObjectInputStream)");<NEW_LINE>objectInputStream.defaultReadObject();<NEW_LINE>// We cannot set the available head during recovery because the links may get deleted before<NEW_LINE>// recovery is complete, instead force a scan when we use availableHead for the first time.<NEW_LINE>availableHead = null;<NEW_LINE>// All links are initially available.<NEW_LINE>availableSize = size;<NEW_LINE>availableSizeLock = new Object();<NEW_LINE>managedObjectsToAdd = new java.util.ArrayList(1);<NEW_LINE>managedObjectsToReplace = new java.util.ArrayList(3);<NEW_LINE>tokensToNotify = new java.util.ArrayList(1);<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.<MASK><NEW_LINE>} | exit(this, cclass, "readObject"); |
17,790 | public DataSource doCreateDataSource(DataSourceProperty dataSourceProperty) {<NEW_LINE>BeeDataSourceConfig config = MERGE_CREATOR.create(gConfig, dataSourceProperty.getBeecp());<NEW_LINE>config.setUsername(dataSourceProperty.getUsername());<NEW_LINE>config.setPassword(dataSourceProperty.getPassword());<NEW_LINE>config.<MASK><NEW_LINE>config.setPoolName(dataSourceProperty.getPoolName());<NEW_LINE>String driverClassName = dataSourceProperty.getDriverClassName();<NEW_LINE>if (!StringUtils.isEmpty(driverClassName)) {<NEW_LINE>config.setDriverClassName(driverClassName);<NEW_LINE>}<NEW_LINE>if (Boolean.FALSE.equals(dataSourceProperty.getLazy())) {<NEW_LINE>return new BeeDataSource(config);<NEW_LINE>}<NEW_LINE>BeeDataSource beeDataSource = new BeeDataSource();<NEW_LINE>try {<NEW_LINE>copyToMethod.invoke(config, beeDataSource);<NEW_LINE>} catch (InvocationTargetException | IllegalAccessException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return beeDataSource;<NEW_LINE>} | setJdbcUrl(dataSourceProperty.getUrl()); |
433,657 | public void onBindItemViewHolder(RecentPhotoViewHolder viewHolder, @NonNull Cursor cursor) {<NEW_LINE>viewHolder.imageView.setImageDrawable(null);<NEW_LINE>long rowId = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns._ID));<NEW_LINE>long dateTaken = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATE_TAKEN));<NEW_LINE>long dateModified = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATE_MODIFIED));<NEW_LINE>String mimeType = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.MIME_TYPE));<NEW_LINE>int orientation = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION));<NEW_LINE>final Uri uri = ContentUris.withAppendedId(RecentPhotosLoader.BASE_URL, rowId);<NEW_LINE>Key signature = new <MASK><NEW_LINE>GlideApp.with(getContext().getApplicationContext()).load(uri).signature(signature).diskCacheStrategy(DiskCacheStrategy.NONE).into(viewHolder.imageView);<NEW_LINE>viewHolder.imageView.setOnClickListener(v -> {<NEW_LINE>if (clickedListener != null)<NEW_LINE>clickedListener.onItemClicked(uri);<NEW_LINE>});<NEW_LINE>} | MediaStoreSignature(mimeType, dateModified, orientation); |
61,492 | public void mouseDragged(MouseEvent e) {<NEW_LINE>if (!selectionActive || e.isConsumed()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>e.consume();<NEW_LINE>Point p = e.getPoint();<NEW_LINE>if (p.x == lastX) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Cursor cursor = Cursor.getPredefinedCursor(p.x < lastX ? Cursor.W_RESIZE_CURSOR : Cursor.E_RESIZE_CURSOR);<NEW_LINE>setCursor(cursor);<NEW_LINE>lastX = p.x;<NEW_LINE>int bitOffset = placementComponent.getBitOffset(p);<NEW_LINE>if (bitOffset == lastBit) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// ensure that scroll region keeps mouse point visible<NEW_LINE>if (!placementComponent.getVisibleRect().contains(p)) {<NEW_LINE>BitAttributes bitAttributes = placementComponent.getBitAttributes(e.getPoint());<NEW_LINE>if (bitAttributes != null) {<NEW_LINE>placementComponent.scrollRectToVisible(bitAttributes.getRectangle());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (bitOffset >= 0) {<NEW_LINE>// NOTE: spinner models require use of long values<NEW_LINE>lastBit = bitOffset;<NEW_LINE>if (bitOffset <= startBit) {<NEW_LINE>int start = Math.min(startBit, bitOffset);<NEW_LINE>bitOffsetModel.setValue((long) start);<NEW_LINE>}<NEW_LINE>long bitSize = Math.<MASK><NEW_LINE>bitSizeModel.setValue(bitSize);<NEW_LINE>}<NEW_LINE>} | abs(bitOffset - startBit) + 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.