idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,778,863 | public FormatWalkResult postFormat(String name, String type, String declaredType, int typeCode, long address, PrintStream out, Context context, IStructureFormatter structureFormatter) {<NEW_LINE>if (typeCode == StructureTypeManager.TYPE_POINTER) {<NEW_LINE>CTypeParser parser = new CTypeParser(declaredType);<NEW_LINE>String coreType = parser.getCoreType();<NEW_LINE>switch(coreType) {<NEW_LINE>case "char":<NEW_LINE>case "I8":<NEW_LINE>case "U8":<NEW_LINE>if (parser.getSuffix().equals("*")) {<NEW_LINE>try {<NEW_LINE>U8Pointer ptr = U8Pointer.cast(PointerPointer.cast(<MASK><NEW_LINE>if (ptr.notNull()) {<NEW_LINE>String str = ptr.getCStringAtOffset(0, MAXIMUM_LENGTH);<NEW_LINE>out.print(" // \"");<NEW_LINE>out.print(str);<NEW_LINE>if (str.length() >= MAXIMUM_LENGTH) {<NEW_LINE>out.print("...");<NEW_LINE>}<NEW_LINE>out.print("\"");<NEW_LINE>}<NEW_LINE>} catch (CorruptDataException e) { | address).at(0)); |
1,647,000 | public static final void YUV444toRGB888(final byte y, final byte u, final byte v, byte[] data, int off) {<NEW_LINE>final int c = y + 112;<NEW_LINE>final int d = u;<NEW_LINE>final int e = v;<NEW_LINE>final int r = (298 * c + 409 <MASK><NEW_LINE>final int g = (298 * c - 100 * d - 208 * e + 128) >> 8;<NEW_LINE>final int b = (298 * c + 516 * d + 128) >> 8;<NEW_LINE>data[off] = (byte) (clip(r, 0, 255) - 128);<NEW_LINE>data[off + 1] = (byte) (clip(g, 0, 255) - 128);<NEW_LINE>data[off + 2] = (byte) (clip(b, 0, 255) - 128);<NEW_LINE>} | * e + 128) >> 8; |
513,210 | protected void redirectToApp(HttpServletRequest request, HttpServletResponse response, String contextName, String[] uriParts, String action) throws IOException {<NEW_LINE>StringBuilder redirectAddress = new StringBuilder();<NEW_LINE>for (int i = 0; i < uriParts.length; i++) {<NEW_LINE>redirectAddress.append(uriParts[i]);<NEW_LINE>if (uriParts[i].equals(contextName)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (i < uriParts.length - 1) {<NEW_LINE>redirectAddress.append("/");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// redirect to ROOT context<NEW_LINE>if (redirectAddress.length() == 0) {<NEW_LINE>redirectAddress.append("/");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (action != null) {<NEW_LINE>httpSession.setAttribute(AppUI.LAST_REQUEST_ACTION_ATTR, action);<NEW_LINE>}<NEW_LINE>if (request.getParameterNames().hasMoreElements()) {<NEW_LINE>Map<String, String> params = new HashMap<>();<NEW_LINE>Enumeration parameterNames = request.getParameterNames();<NEW_LINE>while (parameterNames.hasMoreElements()) {<NEW_LINE>String name = (String) parameterNames.nextElement();<NEW_LINE>if (!FROM_HTML_REDIRECT_PARAM.equals(name)) {<NEW_LINE>params.put(name, request.getParameter(name));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>httpSession.setAttribute(AppUI.LAST_REQUEST_PARAMS_ATTR, params);<NEW_LINE>}<NEW_LINE>statisticsCounter.incWebRequestsCount();<NEW_LINE>String httpSessionId = httpSession.getId();<NEW_LINE>log.debug("Redirect to application {}", httpSessionId);<NEW_LINE>Cookie[] cookies = request.getCookies();<NEW_LINE>if (cookies != null) {<NEW_LINE>for (Cookie cookie : cookies) {<NEW_LINE>if ("JSESSIONID".equals(cookie.getName()) && !httpSessionId.equals(cookie.getValue())) {<NEW_LINE>cookie.setValue(httpSessionId);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>response.sendRedirect(redirectAddress.toString());<NEW_LINE>} | HttpSession httpSession = request.getSession(); |
272,974 | private static int add(CommandContext<CommandSourceStack> context, int level) throws CommandSyntaxException {<NEW_LINE>Modifier modifier = ModifierArgument.getModifier(context, "modifier");<NEW_LINE>List<LivingEntity> successes = HeldModifiableItemIterator.apply(context, (living, stack) -> {<NEW_LINE>// add modifier<NEW_LINE>ToolStack <MASK><NEW_LINE>// first, see if we can add the modifier<NEW_LINE>int currentLevel = tool.getModifierLevel(modifier);<NEW_LINE>List<ModifierEntry> modifiers = tool.getModifierList();<NEW_LINE>for (ModifierRequirements requirements : ModifierRecipeLookup.getRequirements(modifier)) {<NEW_LINE>ValidatedResult result = requirements.check(stack, level + currentLevel, modifiers);<NEW_LINE>if (result.hasError()) {<NEW_LINE>throw MODIFIER_ERROR.create(result.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tool = tool.copy();<NEW_LINE>tool.addModifier(modifier, level);<NEW_LINE>// ensure no modifier problems after adding<NEW_LINE>ValidatedResult toolValidation = tool.validate();<NEW_LINE>if (toolValidation.hasError()) {<NEW_LINE>throw MODIFIER_ERROR.create(toolValidation.getMessage());<NEW_LINE>}<NEW_LINE>// if successful, update held item<NEW_LINE>living.setItemInHand(InteractionHand.MAIN_HAND, tool.createStack(stack.getCount()));<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>// success message<NEW_LINE>CommandSourceStack source = context.getSource();<NEW_LINE>int size = successes.size();<NEW_LINE>if (size == 1) {<NEW_LINE>source.sendSuccess(new TranslatableComponent(ADD_SUCCESS, modifier.getDisplayName(level), successes.get(0).getDisplayName()), true);<NEW_LINE>} else {<NEW_LINE>source.sendSuccess(new TranslatableComponent(ADD_SUCCESS_MULTIPLE, modifier.getDisplayName(level), size), true);<NEW_LINE>}<NEW_LINE>return size;<NEW_LINE>} | tool = ToolStack.from(stack); |
1,551,706 | private void fetchLocationsFromRegistry(final List<File> locations) {<NEW_LINE>for (Product jdk : Registry.getInstance().getProducts(JDK_PRODUCT_UID)) {<NEW_LINE>if (jdk.getStatus() == Status.INSTALLED) {<NEW_LINE>if (!locations.contains(jdk.getInstallationLocation())) {<NEW_LINE>locations.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Product product : Registry.getInstance().getProducts(Status.TO_BE_INSTALLED)) {<NEW_LINE>final String jdkSysPropName = product.getUid() + StringUtils.DOT + JdkLocationPanel.JDK_LOCATION_PROPERTY;<NEW_LINE>final String jdkSysProp = System.getProperty(jdkSysPropName);<NEW_LINE>if (jdkSysProp != null) {<NEW_LINE>File sprop = new File(jdkSysProp);<NEW_LINE>if (!locations.contains(sprop)) {<NEW_LINE>locations.add(sprop);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | add(jdk.getInstallationLocation()); |
1,107,467 | private boolean uninstallNode(AdminCommandContext ctx, ParameterMap map, Node node) {<NEW_LINE>boolean res = false;<NEW_LINE>remotepassword = map.getOne(PARAM_SSHPASSWORD);<NEW_LINE>sshkeypassphrase = map.getOne(PARAM_SSHKEYPASSPHRASE);<NEW_LINE>ArrayList<String> command = new ArrayList<>();<NEW_LINE>command.add(getUninstallCommandName());<NEW_LINE>command.add("--installdir");<NEW_LINE>command.add(map.getOne(PARAM_INSTALLDIR));<NEW_LINE>if (force) {<NEW_LINE>command.add("--force");<NEW_LINE>}<NEW_LINE>setTypeSpecificOperands(command, map);<NEW_LINE>String host = map.getOne(PARAM_NODEHOST);<NEW_LINE>command.add(host);<NEW_LINE>String firstErrorMessage = Strings.get("delete.node.ssh.uninstall.failed", <MASK><NEW_LINE>StringBuilder out = new StringBuilder();<NEW_LINE>int exitCode = execCommand(command, out);<NEW_LINE>// capture the output in server.log<NEW_LINE>logger.info(out.toString().trim());<NEW_LINE>ActionReport report = ctx.getActionReport();<NEW_LINE>if (exitCode == 0) {<NEW_LINE>// If it was successful say so and display the command output<NEW_LINE>report.setMessage(Strings.get("delete.node.ssh.uninstall.success", host));<NEW_LINE>res = true;<NEW_LINE>} else {<NEW_LINE>report.setMessage(firstErrorMessage);<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | node.getName(), host); |
1,512,991 | void enableLionFS() {<NEW_LINE>try {<NEW_LINE>String version = System.getProperty("os.version");<NEW_LINE>int firstDot = version.indexOf('.');<NEW_LINE>int lastDot = version.lastIndexOf('.');<NEW_LINE>if (lastDot > firstDot && lastDot >= 0) {<NEW_LINE>version = version.substring(0, version.indexOf('.', firstDot + 1));<NEW_LINE>}<NEW_LINE>double v = Double.parseDouble(version);<NEW_LINE>if (v < 10.7)<NEW_LINE>throw new Exception("Operating system version is " + v);<NEW_LINE>Class fsuClass = Class.forName("com.apple.eawt.FullScreenUtilities");<NEW_LINE>Class[] argClasses = new Class[] { Window.class, Boolean.TYPE };<NEW_LINE>Method setWindowCanFullScreen = fsuClass.getMethod("setWindowCanFullScreen", argClasses);<NEW_LINE>setWindowCanFullScreen.invoke(fsuClass, this, true);<NEW_LINE>canDoLionFS = true;<NEW_LINE>} catch (Exception e) {<NEW_LINE>vlog.debug(<MASK><NEW_LINE>}<NEW_LINE>} | "Could not enable OS X 10.7+ full-screen mode: " + e.getMessage()); |
838,407 | final ListPolicyVersionsResult executeListPolicyVersions(ListPolicyVersionsRequest listPolicyVersionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listPolicyVersionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListPolicyVersionsRequest> request = null;<NEW_LINE>Response<ListPolicyVersionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListPolicyVersionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPolicyVersionsRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPolicyVersions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListPolicyVersionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPolicyVersionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,318,416 | private OsmEditOptionsFragmentListener createOsmEditOptionsFragmentListener() {<NEW_LINE>return new OsmEditOptionsFragmentListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onUploadClick(OsmPoint osmPoint) {<NEW_LINE>uploadItems(new OsmPoint[] { getPointAfterModify(osmPoint) });<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onShowOnMapClick(OsmPoint osmPoint) {<NEW_LINE>OsmandSettings settings = getMyApplication().getSettings();<NEW_LINE>settings.setMapLocationToShow(osmPoint.getLatitude(), osmPoint.getLongitude(), settings.getLastKnownMapZoom());<NEW_LINE>MapActivity.launchMapActivityMoveToTop(getActivity());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onModifyOsmChangeClick(OsmPoint osmPoint) {<NEW_LINE>OpenstreetmapPoint i = (OpenstreetmapPoint) getPointAfterModify(osmPoint);<NEW_LINE>final <MASK><NEW_LINE>refreshId = entity.getId();<NEW_LINE>EditPoiDialogFragment.createInstance(entity, false).show(getActivity().getSupportFragmentManager(), "edit_poi");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onModifyOsmNoteClick(OsmPoint osmPoint) {<NEW_LINE>showBugDialog((OsmNotesPoint) osmPoint);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onDeleteClick(OsmPoint osmPoint) {<NEW_LINE>ArrayList<OsmPoint> points = new ArrayList<>();<NEW_LINE>points.add(osmPoint);<NEW_LINE>deleteItems(new ArrayList<>(points));<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | Entity entity = i.getEntity(); |
721,670 | private T parseNextRawExpression() throws ParseException {<NEW_LINE>final String typeId = ignoreSpecialCharsInTypeIds ? TextUtils.toComparableStringIgnoreCaseAndSpecialChars(parseToNextDelim().trim()) : parseToNextDelim().trim().toLowerCase(Locale.getDefault());<NEW_LINE>final ExpressionConfig typeConfig = new ExpressionConfig();<NEW_LINE>if (currentCharIs(CONFIG_SEPARATOR, false)) {<NEW_LINE>idx++;<NEW_LINE>idx = parseConfiguration(config, idx, typeConfig);<NEW_LINE>}<NEW_LINE>if (typeId.isEmpty() && isEmpty(typeConfig)) {<NEW_LINE>throwParseException("Expression expected, but none was found");<NEW_LINE>}<NEW_LINE>final T expression;<NEW_LINE>if (registeredExpressions.containsKey(typeId)) {<NEW_LINE>expression = registeredExpressions.get(typeId).get();<NEW_LINE>if (!isEmpty(typeConfig)) {<NEW_LINE>expression.setConfig(typeConfig);<NEW_LINE>}<NEW_LINE>} else if (registeredExpressions.containsKey("") && isEmpty(typeConfig)) {<NEW_LINE>expression = registeredExpressions.get("").get();<NEW_LINE>typeConfig.put(null<MASK><NEW_LINE>expression.setConfig(typeConfig);<NEW_LINE>} else {<NEW_LINE>// make compiler happy, value will never be used<NEW_LINE>expression = null;<NEW_LINE>throwParseException("No expression type found for id '" + typeId + "' and no default expression could be applied");<NEW_LINE>}<NEW_LINE>return Objects.requireNonNull(expression);<NEW_LINE>} | , Collections.singletonList(typeId)); |
66,946 | public void handleFocus(final Context context, final float x, final float y, final FocusCallback callback) {<NEW_LINE>if (mCamera == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Camera.Parameters params = mCamera.getParameters();<NEW_LINE>Rect focusRect = calculateTapArea(<MASK><NEW_LINE>mCamera.cancelAutoFocus();<NEW_LINE>if (params.getMaxNumFocusAreas() > 0) {<NEW_LINE>List<Camera.Area> focusAreas = new ArrayList<>();<NEW_LINE>focusAreas.add(new Camera.Area(focusRect, 800));<NEW_LINE>params.setFocusAreas(focusAreas);<NEW_LINE>} else {<NEW_LINE>TUIChatLog.i(TAG, "focus areas not supported");<NEW_LINE>callback.focusSuccess();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String currentFocusMode = params.getFocusMode();<NEW_LINE>try {<NEW_LINE>params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);<NEW_LINE>mCamera.setParameters(params);<NEW_LINE>mCamera.autoFocus(new Camera.AutoFocusCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAutoFocus(boolean success, Camera camera) {<NEW_LINE>if (success || handlerTime > 10) {<NEW_LINE>Camera.Parameters params = camera.getParameters();<NEW_LINE>params.setFocusMode(currentFocusMode);<NEW_LINE>camera.setParameters(params);<NEW_LINE>handlerTime = 0;<NEW_LINE>callback.focusSuccess();<NEW_LINE>} else {<NEW_LINE>handlerTime++;<NEW_LINE>handleFocus(context, x, y, callback);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>TUIChatLog.e(TAG, "autoFocus failer");<NEW_LINE>}<NEW_LINE>} | x, y, 1f, context); |
145,663 | public void actionPerformed(ActionEvent e) {<NEW_LINE>String cmd = e.getActionCommand();<NEW_LINE>String plaf_name = null;<NEW_LINE>if (cmd.equals("Metal")) {<NEW_LINE>plaf_name = "javax.swing.plaf.metal.MetalLookAndFeel";<NEW_LINE>} else if (cmd.equals("Windows")) {<NEW_LINE>plaf_name = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";<NEW_LINE>} else if (cmd.equals("Motif")) {<NEW_LINE>plaf_name = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";<NEW_LINE>} else {<NEW_LINE>Object source = e.getSource();<NEW_LINE>if (source == breakOnExceptions) {<NEW_LINE>debugGui.dim.setBreakOnExceptions(breakOnExceptions.isSelected());<NEW_LINE>} else if (source == breakOnEnter) {<NEW_LINE>debugGui.dim.setBreakOnEnter(breakOnEnter.isSelected());<NEW_LINE>} else if (source == breakOnReturn) {<NEW_LINE>debugGui.dim.<MASK><NEW_LINE>} else {<NEW_LINE>debugGui.actionPerformed(e);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>UIManager.setLookAndFeel(plaf_name);<NEW_LINE>SwingUtilities.updateComponentTreeUI(debugGui);<NEW_LINE>SwingUtilities.updateComponentTreeUI(debugGui.dlg);<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>// ignored.printStackTrace();<NEW_LINE>}<NEW_LINE>} | setBreakOnReturn(breakOnReturn.isSelected()); |
1,259,804 | final ListLogPatternSetsResult executeListLogPatternSets(ListLogPatternSetsRequest listLogPatternSetsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listLogPatternSetsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListLogPatternSetsRequest> request = null;<NEW_LINE>Response<ListLogPatternSetsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListLogPatternSetsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLogPatternSetsRequest));<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, "Application Insights");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListLogPatternSets");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListLogPatternSetsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListLogPatternSetsResultJsonUnmarshaller());<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.ClientExecuteTime); |
632,657 | public synchronized List<Amenity> searchAmenitiesByName(int x, int y, int l, int t, int r, int b, String query, ResultMatcher<Amenity> resulMatcher) {<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE>List<Amenity<MASK><NEW_LINE>SearchRequest<Amenity> req = BinaryMapIndexReader.buildSearchPoiRequest(x, y, query, l, r, t, b, resulMatcher);<NEW_LINE>try {<NEW_LINE>BinaryMapIndexReader index = getOpenFile();<NEW_LINE>if (index != null) {<NEW_LINE>amenities = index.searchPoiByName(req);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>String nm = "";<NEW_LINE>List<MapIndex> mi = index.getMapIndexes();<NEW_LINE>if (mi.size() > 0) {<NEW_LINE>nm = mi.get(0).getName();<NEW_LINE>}<NEW_LINE>// $NON-NLS-1$<NEW_LINE>log.// $NON-NLS-1$<NEW_LINE>debug(// $NON-NLS-1$<NEW_LINE>String.// $NON-NLS-1$<NEW_LINE>format(// $NON-NLS-1$<NEW_LINE>"Search for %s done in %s ms found %s (%s) %s.", // $NON-NLS-1$<NEW_LINE>query, // $NON-NLS-1$<NEW_LINE>System.currentTimeMillis() - now, // $NON-NLS-1$<NEW_LINE>amenities.size(), // $NON-NLS-1$<NEW_LINE>nm, index.getFile().getName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>log.error("Error searching amenities", e);<NEW_LINE>}<NEW_LINE>return amenities;<NEW_LINE>} | > amenities = Collections.emptyList(); |
407,842 | public ListPortalsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListPortalsResult listPortalsResult = new ListPortalsResult();<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 listPortalsResult;<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("portalSummaries", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listPortalsResult.setPortalSummaries(new ListUnmarshaller<PortalSummary>(PortalSummaryJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listPortalsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listPortalsResult;<NEW_LINE>} | )).unmarshall(context)); |
607,191 | public Path discover(final String cgroup) {<NEW_LINE>Preconditions.checkNotNull(cgroup, "cgroup required");<NEW_LINE>final File procMounts = new File(procDir, "mounts");<NEW_LINE>final File pidCgroups <MASK><NEW_LINE>final PidCgroupEntry pidCgroupsEntry = getCgroupEntry(pidCgroups, cgroup);<NEW_LINE>final ProcMountsEntry procMountsEntry = getMountEntry(procMounts, cgroup);<NEW_LINE>final File cgroupDir = new File(procMountsEntry.path.toString(), pidCgroupsEntry.path.toString());<NEW_LINE>if (cgroupDir.exists() && cgroupDir.isDirectory()) {<NEW_LINE>return cgroupDir.toPath();<NEW_LINE>}<NEW_LINE>// Check the root /sys/fs directory if there isn't a cgroup path specific one<NEW_LINE>// This happens with certain OSes<NEW_LINE>final File fallbackCgroupDir = procMountsEntry.path.toFile();<NEW_LINE>if (fallbackCgroupDir.exists() && fallbackCgroupDir.isDirectory()) {<NEW_LINE>return fallbackCgroupDir.toPath();<NEW_LINE>}<NEW_LINE>throw new RE("No cgroup directory located at [%s] or [%s]", cgroupDir, fallbackCgroupDir);<NEW_LINE>} | = new File(procDir, "cgroup"); |
517,126 | public void compact(CompactionServiceId service, CompactionJob job, RateLimiter readLimiter, RateLimiter writeLimiter, long queuedTime) {<NEW_LINE>Optional<CompactionInfo> ocInfo = reserveFilesForCompaction(service, job);<NEW_LINE>if (ocInfo.isEmpty())<NEW_LINE>return;<NEW_LINE>var cInfo = ocInfo.get();<NEW_LINE>StoredTabletFile newFile = null;<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>CompactionKind kind = job.getKind();<NEW_LINE>CompactionStats stats = new CompactionStats();<NEW_LINE>try {<NEW_LINE>TabletLogger.compacting(getExtent(), job, cInfo.localCompactionCfg);<NEW_LINE>tablet.incrementStatusMajor();<NEW_LINE>var check = new CompactionCheck(service, kind, cInfo.checkCompactionId);<NEW_LINE>TabletFile tmpFileName = tablet.getNextMapFilenameForMajc(cInfo.propagateDeletes);<NEW_LINE>var compactEnv = new MajCEnv(kind, check, readLimiter, writeLimiter, cInfo.propagateDeletes);<NEW_LINE>SortedMap<StoredTabletFile, DataFileValue> allFiles = tablet.getDatafiles();<NEW_LINE>HashMap<StoredTabletFile, DataFileValue> compactFiles = new HashMap<>();<NEW_LINE>cInfo.jobFiles.forEach(file -> compactFiles.put(file, allFiles.get(file)));<NEW_LINE>stats = CompactableUtils.compact(tablet, job, cInfo, compactEnv, compactFiles, tmpFileName);<NEW_LINE>newFile = CompactableUtils.bringOnline(tablet.getDatafileManager(), cInfo, stats, compactFiles, allFiles, kind, tmpFileName);<NEW_LINE>TabletLogger.compacted(getExtent(), job, newFile);<NEW_LINE>} catch (CompactionCanceledException cce) {<NEW_LINE>log.<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>newFile = null;<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} finally {<NEW_LINE>completeCompaction(job, cInfo.jobFiles, newFile);<NEW_LINE>tablet.updateTimer(MAJOR, queuedTime, startTime, stats.getEntriesRead(), newFile == null);<NEW_LINE>}<NEW_LINE>} | debug("Compaction canceled {} ", getExtent()); |
1,263,886 | private static WatchingInsertionContext insertItemHonorBlockSelection(CompletionProcessEx indicator, LookupElement item, char completionChar, StatisticsUpdate update) {<NEW_LINE>final Editor editor = indicator.getEditor();<NEW_LINE>final int caretOffset = indicator.getCaret().getOffset();<NEW_LINE>final int idEndOffset = calcIdEndOffset(indicator);<NEW_LINE>final int idEndOffsetDelta = idEndOffset - caretOffset;<NEW_LINE>WatchingInsertionContext context;<NEW_LINE>if (editor.getCaretModel().supportsMultipleCarets()) {<NEW_LINE>Ref<WatchingInsertionContext> lastContext = Ref.create();<NEW_LINE>Editor hostEditor = InjectedLanguageUtil.getTopLevelEditor(editor);<NEW_LINE>boolean wasInjected = hostEditor != editor;<NEW_LINE>OffsetsInFile topLevelOffsets = indicator.getHostOffsets();<NEW_LINE>hostEditor.getCaretModel().runForEachCaret(caret -> {<NEW_LINE>OffsetsInFile targetOffsets = findInjectedOffsetsIfAny(caret, wasInjected, topLevelOffsets, hostEditor);<NEW_LINE>PsiFile targetFile = targetOffsets.getFile();<NEW_LINE>Editor targetEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(hostEditor, targetFile);<NEW_LINE>int targetCaretOffset = targetEditor.getCaretModel().getOffset();<NEW_LINE>int idEnd = targetCaretOffset + idEndOffsetDelta;<NEW_LINE>if (idEnd > targetEditor.getDocument().getTextLength()) {<NEW_LINE>// no replacement by Tab when offsets gone wrong for some reason<NEW_LINE>idEnd = targetCaretOffset;<NEW_LINE>}<NEW_LINE>WatchingInsertionContext currentContext = insertItem(indicator.getLookup(), item, completionChar, update, targetEditor, targetFile, targetCaretOffset, <MASK><NEW_LINE>lastContext.set(currentContext);<NEW_LINE>});<NEW_LINE>context = lastContext.get();<NEW_LINE>} else {<NEW_LINE>PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, indicator.getProject());<NEW_LINE>context = insertItem(indicator.getLookup(), item, completionChar, update, editor, psiFile, caretOffset, idEndOffset, indicator.getOffsetMap());<NEW_LINE>}<NEW_LINE>if (context.shouldAddCompletionChar()) {<NEW_LINE>WriteAction.run(() -> addCompletionChar(context, item));<NEW_LINE>}<NEW_LINE>checkPsiTextConsistency(indicator);<NEW_LINE>return context;<NEW_LINE>} | idEnd, targetOffsets.getOffsets()); |
996,146 | private static EngineInfo initEventRegistryEngineFromResource(URL resourceUrl) {<NEW_LINE>EngineInfo eventRegistryEngineInfo = eventRegistryEngineInfosByResourceUrl.get(resourceUrl.toString());<NEW_LINE>// if there is an existing event registry engine info<NEW_LINE>if (eventRegistryEngineInfo != null) {<NEW_LINE>// remove that event registry engine from the member fields<NEW_LINE>eventRegistryEngineInfos.remove(eventRegistryEngineInfo);<NEW_LINE>if (eventRegistryEngineInfo.getException() == null) {<NEW_LINE>String eventRegistryEngineName = eventRegistryEngineInfo.getName();<NEW_LINE>eventRegistryEngines.remove(eventRegistryEngineName);<NEW_LINE>eventRegistryEngineInfosByName.remove(eventRegistryEngineName);<NEW_LINE>}<NEW_LINE>eventRegistryEngineInfosByResourceUrl.remove(eventRegistryEngineInfo.getResourceUrl());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>LOGGER.info("initializing event registry engine for resource {}", resourceUrl);<NEW_LINE>EventRegistryEngine eventRegistryEngine = buildEventRegistryEngine(resourceUrl);<NEW_LINE>String eventRegistryEngineName = eventRegistryEngine.getName();<NEW_LINE>LOGGER.info("initialised event registry engine {}", eventRegistryEngineName);<NEW_LINE>eventRegistryEngineInfo = new EngineInfo(eventRegistryEngineName, resourceUrlString, null);<NEW_LINE>eventRegistryEngines.put(eventRegistryEngineName, eventRegistryEngine);<NEW_LINE>eventRegistryEngineInfosByName.put(eventRegistryEngineName, eventRegistryEngineInfo);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOGGER.error("Exception while initializing event registry engine: {}", e.getMessage(), e);<NEW_LINE>eventRegistryEngineInfo = new EngineInfo(null, resourceUrlString, ExceptionUtils.getStackTrace(e));<NEW_LINE>}<NEW_LINE>eventRegistryEngineInfosByResourceUrl.put(resourceUrlString, eventRegistryEngineInfo);<NEW_LINE>eventRegistryEngineInfos.add(eventRegistryEngineInfo);<NEW_LINE>return eventRegistryEngineInfo;<NEW_LINE>} | String resourceUrlString = resourceUrl.toString(); |
1,411,636 | private void uiInit() throws Exception {<NEW_LINE>setSize(250, 250);<NEW_LINE>setLayout(new BoxLayout<MASK><NEW_LINE>setBackground(AppColors.BACKGROUND);<NEW_LINE>// setOpaque(true);<NEW_LINE>setAlignmentX(Component.LEFT_ALIGNMENT);<NEW_LINE>setBorder(BORDER_CONTROL);<NEW_LINE>checkbox = new JCheckBox();<NEW_LINE>add(checkbox);<NEW_LINE>checkbox.setAlignmentX(Component.LEFT_ALIGNMENT);<NEW_LINE>checkbox.addActionListener(new java.awt.event.ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>layerVisAction();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>checkbox.setSelected(layer.isEnabled());<NEW_LINE>checkbox.setOpaque(false);<NEW_LINE>lblName = new LayerName(layer);<NEW_LINE>lblName.setAlignmentX(Component.LEFT_ALIGNMENT);<NEW_LINE>lblName.setMinimumSize(new Dimension(100, 12));<NEW_LINE>lblName.setPreferredSize(new Dimension(100, 12));<NEW_LINE>lblName.setMaximumSize(new Dimension(100, 12));<NEW_LINE>lblName.setFont(FONT_NORMAL);<NEW_LINE>lblName.addMouseListener(new HighlightMouseListener(this));<NEW_LINE>lblName.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>public void mouseClicked(MouseEvent e) {<NEW_LINE>lyrListPanel.setLayerFocus(self);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>swatch = LayerStyleSwatchControl.create(layer);<NEW_LINE>add(swatch);<NEW_LINE>add(Box.createRigidArea(new Dimension(4, 0)));<NEW_LINE>namePanel = new JPanel();<NEW_LINE>add(namePanel);<NEW_LINE>namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.X_AXIS));<NEW_LINE>// namePanel.setBackground(CLR_CONTROL);<NEW_LINE>namePanel.setOpaque(false);<NEW_LINE>namePanel.setAlignmentX(Component.LEFT_ALIGNMENT);<NEW_LINE>namePanel.setMinimumSize(new Dimension(100, 14));<NEW_LINE>namePanel.setPreferredSize(new Dimension(100, 14));<NEW_LINE>namePanel.setMaximumSize(new Dimension(100, 14));<NEW_LINE>// namePanel.setBorder(BORDER_HIGHLIGHT);;<NEW_LINE>namePanel.addMouseListener(new HighlightMouseListener(this));<NEW_LINE>namePanel.add(lblName);<NEW_LINE>} | (this, BoxLayout.X_AXIS)); |
1,046,434 | <E> E find(final Class<E> entityClass, final Object primaryKey) {<NEW_LINE>if (primaryKey == null) {<NEW_LINE>throw new IllegalArgumentException("PrimaryKey value must not be null for object you want to find.");<NEW_LINE>}<NEW_LINE>// Locking as it might read from persistence context.<NEW_LINE>EntityMetadata entityMetadata = getMetadata(entityClass);<NEW_LINE>String nodeId = ObjectGraphUtils.getNodeId(primaryKey, entityClass);<NEW_LINE>// TODO all the scrap should go from here.<NEW_LINE>MainCache mainCache = (MainCache) getPersistenceCache().getMainCache();<NEW_LINE>Node node = mainCache.getNodeFromCache(nodeId, this);<NEW_LINE>// if node is not in persistence cache or is dirty, fetch from database<NEW_LINE>if (node == null || node.isDirty()) {<NEW_LINE>node = new Node(nodeId, entityClass, new ManagedState(), getPersistenceCache(), primaryKey, this);<NEW_LINE>node.setClient(getClient(entityMetadata));<NEW_LINE>// TODO ManagedState.java require serious attention.<NEW_LINE>node.setPersistenceDelegator(this);<NEW_LINE>try {<NEW_LINE>lock<MASK><NEW_LINE>node.find();<NEW_LINE>} finally {<NEW_LINE>lock.readLock().unlock();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>node.setPersistenceDelegator(this);<NEW_LINE>}<NEW_LINE>Object nodeData = node.getData();<NEW_LINE>if (nodeData == null) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>E e = (E) ObjectUtils.deepCopy(nodeData, getKunderaMetadata());<NEW_LINE>onSetProxyOwners(entityMetadata, e);<NEW_LINE>return e;<NEW_LINE>}<NEW_LINE>} | .readLock().lock(); |
1,226,717 | public void restoreWebView() {<NEW_LINE>if (mRhoCustomView != null) {<NEW_LINE>view.removeView(mRhoCustomView.getContainerView());<NEW_LINE>mRhoCustomView.destroyView();<NEW_LINE>mRhoCustomView = null;<NEW_LINE>if (navBar != null) {<NEW_LINE>view.removeView(navBar);<NEW_LINE>}<NEW_LINE>if (toolBar != null) {<NEW_LINE>view.removeView(toolBar);<NEW_LINE>}<NEW_LINE>int index = 0;<NEW_LINE>if (navBar != null) {<NEW_LINE>view.addView(navBar, index);<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>addWebViewToMainView(webView, index, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));<NEW_LINE>index++;<NEW_LINE>if (toolBar != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mRhoCustomView != null) {<NEW_LINE>mRhoCustomView.destroyView();<NEW_LINE>mRhoCustomView = null;<NEW_LINE>}<NEW_LINE>} | view.addView(toolBar, index); |
809,067 | private Map<String, String> accessAndParseConf(String configName, String path) {<NEW_LINE>if (path == null || path.isEmpty()) {<NEW_LINE>mMsg.append(String.format("%s is not configured in Alluxio property %s%n", configName, PropertyKey.UNDERFS_HDFS_CONFIGURATION));<NEW_LINE>mState = ValidationUtils.State.SKIPPED;<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>PathUtils.getPathComponents(path);<NEW_LINE>} catch (InvalidPathException e) {<NEW_LINE>mState = ValidationUtils.State.WARNING;<NEW_LINE>mMsg.append(String.format("Invalid path %s in Alluxio property %s.%n", path, PropertyKey.UNDERFS_HDFS_CONFIGURATION));<NEW_LINE>mMsg.append(ValidationUtils.getErrorInfo(e));<NEW_LINE>mAdvice.append(String.format("Please correct the path for %s in %s%n", configName, PropertyKey.UNDERFS_HDFS_CONFIGURATION));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Path confPath = Paths.get(path);<NEW_LINE>if (!Files.exists(confPath)) {<NEW_LINE>mState = ValidationUtils.State.WARNING;<NEW_LINE>mMsg.append(String.format("File does not exist at %s in Alluxio property %s.%n", path, PropertyKey.UNDERFS_HDFS_CONFIGURATION));<NEW_LINE>mAdvice.append(String.format("Could not file file at \"%s\". Correct the path in %s%n"<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!Files.isReadable(Paths.get(path))) {<NEW_LINE>mState = ValidationUtils.State.WARNING;<NEW_LINE>mMsg.append(String.format("\"%s\" is not readable from Alluxio property %s.%n", path, PropertyKey.UNDERFS_HDFS_CONFIGURATION));<NEW_LINE>mAdvice.append(String.format("Grant more accessible permissions on the file" + " %s from %s%n", configName, PropertyKey.UNDERFS_HDFS_CONFIGURATION));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>HadoopConfigurationFileParser parser = new HadoopConfigurationFileParser();<NEW_LINE>Map<String, String> properties = null;<NEW_LINE>try {<NEW_LINE>properties = parser.parseXmlConfiguration(path);<NEW_LINE>mMsg.append(String.format("Successfully loaded %s. %n", path));<NEW_LINE>} catch (IOException e) {<NEW_LINE>mState = ValidationUtils.State.FAILED;<NEW_LINE>mMsg.append(String.format("Failed to read %s. %s.%n", path, e.getMessage()));<NEW_LINE>mMsg.append(ValidationUtils.getErrorInfo(e));<NEW_LINE>mAdvice.append(String.format("Please check your %s.%n", path));<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>mState = ValidationUtils.State.FAILED;<NEW_LINE>mMsg.append(String.format("Failed to parse %s. %s.%n", path, e.getMessage()));<NEW_LINE>mMsg.append(ValidationUtils.getErrorInfo(e));<NEW_LINE>mAdvice.append(String.format("Failed to parse %s as valid XML. Please check that the file " + "path is correct and the content is valid XML.%n", path));<NEW_LINE>}<NEW_LINE>return properties;<NEW_LINE>} | , configName, PropertyKey.UNDERFS_HDFS_CONFIGURATION)); |
673,407 | public <K, T, EF extends Enum<? extends EntityField<V>> & EntityField<V>> void mapPut(EF field, K key, T value) {<NEW_LINE>Objects.requireNonNull(key, "Key must not be null");<NEW_LINE>boolean needsSetEntity = false;<NEW_LINE>boolean needsSetLowerEntity = false;<NEW_LINE>switch(node.isCacheFor(field, key)) {<NEW_LINE>case FULLY:<NEW_LINE>needsSetEntity = true;<NEW_LINE>break;<NEW_LINE>case NOT_CONTAINED:<NEW_LINE>needsSetLowerEntity = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(node.isPrimarySourceFor(field, key)) {<NEW_LINE>case FULLY:<NEW_LINE>needsSetEntity = true;<NEW_LINE>needsSetLowerEntity = false;<NEW_LINE>break;<NEW_LINE>case NOT_CONTAINED:<NEW_LINE>needsSetLowerEntity = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (needsSetEntity) {<NEW_LINE>field.mapPut(entity, key, value);<NEW_LINE>}<NEW_LINE>if (needsSetLowerEntity) {<NEW_LINE>field.mapPut(<MASK><NEW_LINE>}<NEW_LINE>} | getEntityFromDescendantNode(), key, value); |
785,235 | public CreateOptOutListResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateOptOutListResult createOptOutListResult = new CreateOptOutListResult();<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 createOptOutListResult;<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("OptOutListArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createOptOutListResult.setOptOutListArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("OptOutListName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createOptOutListResult.setOptOutListName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Tags", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createOptOutListResult.setTags(new ListUnmarshaller<Tag>(TagJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("CreatedTimestamp", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createOptOutListResult.setCreatedTimestamp(DateJsonUnmarshallerFactory.getInstance(<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createOptOutListResult;<NEW_LINE>} | "unixTimestamp").unmarshall(context)); |
1,730,849 | private void checkModelFiles(String prefix) throws IOException {<NEW_LINE>String libExt;<NEW_LINE>String os = System.getProperty("os.name").toLowerCase();<NEW_LINE>if (os.startsWith("mac")) {<NEW_LINE>libExt = ".dylib";<NEW_LINE>} else if (os.startsWith("linux")) {<NEW_LINE>libExt = ".so";<NEW_LINE>} else if (os.startsWith("win")) {<NEW_LINE>libExt = ".dll";<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("found unsupported os");<NEW_LINE>}<NEW_LINE>// TODO make the check platform independent<NEW_LINE>Path module = modelDir.resolve(prefix + libExt);<NEW_LINE>if (Files.notExists(module) || !Files.isRegularFile(module)) {<NEW_LINE>throw new FileNotFoundException("module file(.so/.dylib/.dll) is missing");<NEW_LINE>}<NEW_LINE>Path params = modelDir.resolve(prefix + ".params");<NEW_LINE>if (Files.notExists(params) || !Files.isRegularFile(module)) {<NEW_LINE>throw new FileNotFoundException("params file(.params) is missing");<NEW_LINE>}<NEW_LINE>Path graph = <MASK><NEW_LINE>if (Files.notExists(graph) || !Files.isRegularFile(graph)) {<NEW_LINE>throw new FileNotFoundException("graph file(.json) is missing");<NEW_LINE>}<NEW_LINE>} | modelDir.resolve(prefix + ".json"); |
1,489,800 | public AntennaDownlinkDemodDecodeConfig unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AntennaDownlinkDemodDecodeConfig antennaDownlinkDemodDecodeConfig = new AntennaDownlinkDemodDecodeConfig();<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("decodeConfig", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>antennaDownlinkDemodDecodeConfig.setDecodeConfig(DecodeConfigJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("demodulationConfig", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>antennaDownlinkDemodDecodeConfig.setDemodulationConfig(DemodulationConfigJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("spectrumConfig", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>antennaDownlinkDemodDecodeConfig.setSpectrumConfig(SpectrumConfigJsonUnmarshaller.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 antennaDownlinkDemodDecodeConfig;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,070,408 | public EventModel convertToEventModel(String modelJson) {<NEW_LINE>try {<NEW_LINE>JsonNode modelNode = objectMapper.readTree(modelJson);<NEW_LINE>EventModel eventModel = new EventModel();<NEW_LINE>eventModel.setKey(modelNode.path("key").asText(null));<NEW_LINE>eventModel.setName(modelNode.path("name").asText(null));<NEW_LINE>JsonNode payloadNode = modelNode.path("payload");<NEW_LINE>if (payloadNode.isArray()) {<NEW_LINE>for (JsonNode node : payloadNode) {<NEW_LINE>String name = node.path("name").asText(null);<NEW_LINE>String type = node.path("type").asText(null);<NEW_LINE>boolean header = node.path("header").asBoolean(false);<NEW_LINE>if (header) {<NEW_LINE>eventModel.addHeader(name, type);<NEW_LINE>}<NEW_LINE>boolean correlationParameter = node.path("correlationParameter").asBoolean(false);<NEW_LINE>if (correlationParameter) {<NEW_LINE>eventModel.addCorrelation(name, type);<NEW_LINE>} else {<NEW_LINE>eventModel.addPayload(name, type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JsonNode <MASK><NEW_LINE>if (correlationParameters.isArray()) {<NEW_LINE>for (JsonNode correlationPayloadNode : correlationParameters) {<NEW_LINE>String name = correlationPayloadNode.path("name").asText(null);<NEW_LINE>String type = correlationPayloadNode.path("type").asText(null);<NEW_LINE>eventModel.addCorrelation(name, type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return eventModel;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new FlowableEventJsonException("Error reading event json", e);<NEW_LINE>}<NEW_LINE>} | correlationParameters = modelNode.path("correlationParameters"); |
27,100 | void populateJwtAccessTokenData(OAuth20Client client, AttributeList attributeList) {<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "populateJwtAccessTokenData client:" + client);<NEW_LINE>}<NEW_LINE>String clientSecret = client.getClientSecret();<NEW_LINE>attributeList.setAttribute(OAuth20Constants.CLIENT_SECRET, OAuth20Constants.ATTRTYPE_PARAM_OAUTH, new String[] { clientSecret });<NEW_LINE>String[] resource = attributeList.getAttributeValuesByNameAndType(OAuth20Constants.RESOURCE, OAuth20Constants.ATTRTYPE_PARAM_OAUTH);<NEW_LINE>if (resource == null && client instanceof OidcOAuth20Client) {<NEW_LINE>JsonArray jsonAudiences = ((OidcOAuth20Client) client).getResourceIds();<NEW_LINE>if (jsonAudiences != null) {<NEW_LINE>String[] audiences = new String[jsonAudiences.size()];<NEW_LINE>int iCnt = 0;<NEW_LINE>for (JsonElement jsonAudience : jsonAudiences) {<NEW_LINE>audiences[iCnt] = jsonAudience.getAsString();<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc<MASK><NEW_LINE>}<NEW_LINE>iCnt++;<NEW_LINE>}<NEW_LINE>attributeList.setAttribute(OAuth20Constants.RESOURCE, OAuth20Constants.ATTRTYPE_PARAM_OAUTH, audiences);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , "audience:" + audiences[iCnt]); |
1,321,530 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.main_act);<NEW_LINE>MyMapView myMapView = (MyMapView) findViewById(R.id.myMapView);<NEW_LINE>mMapView = myMapView.getMapView();<NEW_LINE>mMainPresenter = new MainPresenter(this, (SearchView) findViewById(R.id.searchView), (DirectionView) findViewById(R.id.directionView), (CodeView) findViewById(R.id.codeView), myMapView);<NEW_LINE>mMapView.onCreate(savedInstanceState);<NEW_LINE>// Adjust the map controls and search box top margins to account for the translucent status<NEW_LINE>// bar.<NEW_LINE>int statusBarHeight = getStatusBarHeight(this);<NEW_LINE>LinearLayout mapControl = (LinearLayout) findViewById(R.id.mapControls);<NEW_LINE>FrameLayout.LayoutParams mapParams = (FrameLayout.LayoutParams) mapControl.getLayoutParams();<NEW_LINE>mapParams.topMargin = mapParams.topMargin + statusBarHeight;<NEW_LINE>mapControl.setLayoutParams(mapParams);<NEW_LINE>RelativeLayout searchBox = (RelativeLayout) findViewById(R.id.searchBox);<NEW_LINE>FrameLayout.LayoutParams searchParams = (FrameLayout.LayoutParams) searchBox.getLayoutParams();<NEW_LINE>searchParams<MASK><NEW_LINE>searchBox.setLayoutParams(searchParams);<NEW_LINE>if (getIntent() != null && Intent.ACTION_VIEW.equals(getIntent().getAction())) {<NEW_LINE>handleGeoIntent(getIntent());<NEW_LINE>}<NEW_LINE>} | .topMargin = searchParams.topMargin + statusBarHeight; |
83,661 | public DoubleArray presentValueSensitivityModelParamsHullWhite(ResolvedSwaption swaption, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) {<NEW_LINE>validate(swaption, ratesProvider, hwProvider);<NEW_LINE>ResolvedSwap swap = swaption.getUnderlying();<NEW_LINE>LocalDate expiryDate = swaption.getExpiryDate();<NEW_LINE>if (expiryDate.isBefore(ratesProvider.getValuationDate())) {<NEW_LINE>// Option has expired already<NEW_LINE>return DoubleArray.EMPTY;<NEW_LINE>}<NEW_LINE>ResolvedSwapLeg cashFlowEquiv = CashFlowEquivalentCalculator.cashFlowEquivalentSwap(swap, ratesProvider);<NEW_LINE>int nPayments = cashFlowEquiv.getPaymentEvents().size();<NEW_LINE>double[] alpha = new double[nPayments];<NEW_LINE>double[][] alphaAdjoint = new double[nPayments][];<NEW_LINE>double[] discountedCashFlow = new double[nPayments];<NEW_LINE>for (int loopcf = 0; loopcf < nPayments; loopcf++) {<NEW_LINE>NotionalExchange payment = (NotionalExchange) cashFlowEquiv.getPaymentEvents().get(loopcf);<NEW_LINE>ValueDerivatives valueDeriv = hwProvider.alphaAdjoint(ratesProvider.getValuationDate(), expiryDate, expiryDate, payment.getPaymentDate());<NEW_LINE>alpha[loopcf] = valueDeriv.getValue();<NEW_LINE>alphaAdjoint[loopcf] = valueDeriv.getDerivatives().toArray();<NEW_LINE>discountedCashFlow[loopcf] = paymentPricer.presentValueAmount(payment.getPayment(), ratesProvider);<NEW_LINE>}<NEW_LINE>double omega = (swap.getLegs(SwapLegType.FIXED).get(0).getPayReceive().isPay() ? -1d : 1d);<NEW_LINE>double kappa = computeKappa(hwProvider, discountedCashFlow, alpha, omega);<NEW_LINE>int nParams = alphaAdjoint[0].length;<NEW_LINE>if (Math.abs(kappa) > 1d / SMALL) {<NEW_LINE>// decays exponentially<NEW_LINE>return DoubleArray.filled(nParams);<NEW_LINE>}<NEW_LINE>double[<MASK><NEW_LINE>double sign = (swaption.getLongShort().isLong() ? 1d : -1d);<NEW_LINE>for (int i = 0; i < nParams; ++i) {<NEW_LINE>for (int loopcf = 0; loopcf < nPayments; loopcf++) {<NEW_LINE>pvSensi[i] += sign * discountedCashFlow[loopcf] * NORMAL.getPDF(omega * (kappa + alpha[loopcf])) * omega * alphaAdjoint[loopcf][i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return DoubleArray.ofUnsafe(pvSensi);<NEW_LINE>} | ] pvSensi = new double[nParams]; |
152,208 | public Object executeFunction() {<NEW_LINE>// receiver<NEW_LINE>ReferenceConstant symb_receiver = this.getSymbReceiver();<NEW_LINE>String conc_receiver = (String) this.getConcReceiver();<NEW_LINE>// prefix argument<NEW_LINE>ReferenceExpression symb_prefix = this.getSymbArgument(0);<NEW_LINE>String conc_prefix = (String) this.getConcArgument(0);<NEW_LINE>// toffset argument<NEW_LINE>IntegerValue offsetExpr = this.getSymbIntegerArgument(1);<NEW_LINE>// return value<NEW_LINE>boolean res = this.getConcBooleanRetVal();<NEW_LINE>StringValue stringReceiverExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_receiver, symb_receiver, conc_receiver);<NEW_LINE>if (symb_prefix instanceof ReferenceConstant) {<NEW_LINE>ReferenceConstant non_null_symb_prefix = (ReferenceConstant) symb_prefix;<NEW_LINE>StringValue prefixExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_prefix, non_null_symb_prefix, conc_prefix);<NEW_LINE>if (stringReceiverExpr.containsSymbolicVariable() || prefixExpr.containsSymbolicVariable() || offsetExpr.containsSymbolicVariable()) {<NEW_LINE><MASK><NEW_LINE>StringMultipleComparison strTExpr = new StringMultipleComparison(stringReceiverExpr, Operator.STARTSWITH, prefixExpr, new ArrayList<>(Collections.singletonList(offsetExpr)), (long) conV);<NEW_LINE>return strTExpr;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this.getSymbIntegerRetVal();<NEW_LINE>} | int conV = res ? 1 : 0; |
377,956 | public static boolean constantTimeAreEqual(int len, byte[] a, int aOff, byte[] b, int bOff) {<NEW_LINE>if (null == a) {<NEW_LINE>throw new NullPointerException("'a' cannot be null");<NEW_LINE>}<NEW_LINE>if (null == b) {<NEW_LINE>throw new NullPointerException("'b' cannot be null");<NEW_LINE>}<NEW_LINE>if (len < 0) {<NEW_LINE>throw new IllegalArgumentException("'len' cannot be negative");<NEW_LINE>}<NEW_LINE>if (aOff > (a.length - len)) {<NEW_LINE>throw new IndexOutOfBoundsException("'aOff' value invalid for specified length");<NEW_LINE>}<NEW_LINE>if (bOff > (b.length - len)) {<NEW_LINE>throw new IndexOutOfBoundsException("'bOff' value invalid for specified length");<NEW_LINE>}<NEW_LINE>int d = 0;<NEW_LINE>for (int i = 0; i < len; ++i) {<NEW_LINE>d |= (a[aOff + i] <MASK><NEW_LINE>}<NEW_LINE>return 0 == d;<NEW_LINE>} | ^ b[bOff + i]); |
273,988 | private final void navigationCaseEdgeEventHandler(NavigationCaseEdge newCaseEdge, NavigationCaseEdge oldCaseEdge) {<NEW_LINE>PageFlowView view = pfc.getView();<NEW_LINE>if (newCaseEdge != null && newCaseEdge.getToViewId() != null && newCaseEdge.getFromViewId() != null) {<NEW_LINE>// NavigationCaseEdge newCaseEdge = new NavigationCaseEdge(view.getPageFlowController(), newCase);<NEW_LINE>// pfc.putCase2Node(newCase, newCaseEdge);// case2Node.put(myNewCase, node);<NEW_LINE>Page fromPage = pfc.getPageName2Page(newCaseEdge.getFromViewId());<NEW_LINE>Page toPage = pfc.getPageName2Page(newCaseEdge.getToViewId());<NEW_LINE>if (fromPage == null) {<NEW_LINE>fromPage = pfc.<MASK><NEW_LINE>view.createNode(fromPage, null, null);<NEW_LINE>}<NEW_LINE>if (toPage == null) {<NEW_LINE>toPage = pfc.createPage(newCaseEdge.getToViewId());<NEW_LINE>view.createNode(toPage, null, null);<NEW_LINE>}<NEW_LINE>pfc.createEdge(newCaseEdge);<NEW_LINE>}<NEW_LINE>if (oldCaseEdge != null) {<NEW_LINE>view.removeEdge(oldCaseEdge);<NEW_LINE>removePageIfNoReference(oldCaseEdge.getToViewId());<NEW_LINE>}<NEW_LINE>view.validateGraph();<NEW_LINE>} | createPage(newCaseEdge.getFromViewId()); |
1,486,941 | static long toLong(String v) {<NEW_LINE>String buildPart = "1";<NEW_LINE>long buildType = 700;<NEW_LINE>if (v.endsWith("-SNAPSHOT")) {<NEW_LINE>buildPart = "";<NEW_LINE>v = v.substring(0<MASK><NEW_LINE>buildType = 0;<NEW_LINE>} else if (v.contains("-alpha-")) {<NEW_LINE>buildPart = v.substring(v.lastIndexOf('-') + 1);<NEW_LINE>v = v.substring(0, v.indexOf("-alpha-"));<NEW_LINE>buildType = 100;<NEW_LINE>} else if (v.contains("-beta-")) {<NEW_LINE>buildPart = v.substring(v.lastIndexOf('-') + 1);<NEW_LINE>v = v.substring(0, v.indexOf("-beta-"));<NEW_LINE>buildType = 300;<NEW_LINE>} else if (v.contains("-rc-")) {<NEW_LINE>buildPart = v.substring(v.lastIndexOf('-') + 1);<NEW_LINE>v = v.substring(0, v.indexOf("-rc-"));<NEW_LINE>buildType = 500;<NEW_LINE>}<NEW_LINE>String[] parts = v.split("\\.");<NEW_LINE>if (parts.length > 3) {<NEW_LINE>throw new IllegalArgumentException("Illegal version number: " + v);<NEW_LINE>}<NEW_LINE>long major = parts.length > 0 ? Long.parseLong(parts[0]) : 0;<NEW_LINE>long minor = parts.length > 1 ? Long.parseLong(parts[1]) : 0;<NEW_LINE>long rev = parts.length > 2 ? Long.parseLong(parts[2]) : 0;<NEW_LINE>long build = buildPart.isEmpty() ? 0 : Long.parseLong(buildPart);<NEW_LINE>long result = (((major * 1000 + minor) * 1000 + rev) * 1000) + build + buildType;<NEW_LINE>return result;<NEW_LINE>} | , v.indexOf("-SNAPSHOT")); |
54,690 | protected ApproximationLine progressiveKnnDistanceApproximation(int k_max) {<NEW_LINE>if (!isLeaf()) {<NEW_LINE>throw new UnsupportedOperationException("Progressive KNN-distance approximation " + "is only vailable in leaf nodes!");<NEW_LINE>}<NEW_LINE>// determine k_0, y_1, y_kmax<NEW_LINE>int k_0 = 0;<NEW_LINE>double y_1 = Double.POSITIVE_INFINITY;<NEW_LINE>double y_kmax = Double.POSITIVE_INFINITY;<NEW_LINE>for (int i = 0; i < getNumEntries(); i++) {<NEW_LINE>MkCoPLeafEntry entry = (MkCoPLeafEntry) getEntry(i);<NEW_LINE>ApproximationLine approx = entry.getProgressiveKnnDistanceApproximation();<NEW_LINE>k_0 = Math.max(approx.getK_0(), k_0);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < getNumEntries(); i++) {<NEW_LINE>MkCoPLeafEntry entry = (MkCoPLeafEntry) getEntry(i);<NEW_LINE><MASK><NEW_LINE>y_1 = Math.min(approx.getValueAt(k_0), y_1);<NEW_LINE>y_kmax = Math.min(approx.getValueAt(k_max), y_kmax);<NEW_LINE>}<NEW_LINE>// determine m and t<NEW_LINE>double m = (y_kmax - y_1) / (FastMath.log(k_max) - FastMath.log(k_0));<NEW_LINE>double t = y_1 - m * FastMath.log(k_0);<NEW_LINE>return new ApproximationLine(k_0, m, t);<NEW_LINE>} | ApproximationLine approx = entry.getProgressiveKnnDistanceApproximation(); |
365,509 | public static int indexOfIgnoreCase(@Nonnull CharSequence where, @Nonnull CharSequence what, int fromIndex) {<NEW_LINE>int targetCount = what.length();<NEW_LINE><MASK><NEW_LINE>if (fromIndex >= sourceCount) {<NEW_LINE>return targetCount == 0 ? sourceCount : -1;<NEW_LINE>}<NEW_LINE>if (fromIndex < 0) {<NEW_LINE>fromIndex = 0;<NEW_LINE>}<NEW_LINE>if (targetCount == 0) {<NEW_LINE>return fromIndex;<NEW_LINE>}<NEW_LINE>char first = what.charAt(0);<NEW_LINE>int max = sourceCount - targetCount;<NEW_LINE>for (int i = fromIndex; i <= max; i++) {<NEW_LINE>if (i <= max) {<NEW_LINE>int j = i + 1;<NEW_LINE>int end = j + targetCount - 1;<NEW_LINE>// noinspection StatementWithEmptyBody<NEW_LINE>for (int k = 1; j < end && charsEqualIgnoreCase(where.charAt(j), what.charAt(k)); j++, k++) ;<NEW_LINE>if (j == end) { | int sourceCount = where.length(); |
417,201 | public final MatchQueryOptionsContext matchQueryOptions() throws RecognitionException {<NEW_LINE>MatchQueryOptionsContext _localctx = new MatchQueryOptionsContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 56, RULE_matchQueryOptions);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(558);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (_la == T__2) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(554);<NEW_LINE>match(T__2);<NEW_LINE>setState(555);<NEW_LINE>string();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(560);<NEW_LINE>_errHandler.sync(this);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _la = _input.LA(1); |
521,645 | public void onCreate(final Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setThemeAndContentView(R.layout.logtrackable_activity);<NEW_LINE>binding = LogtrackableActivityBinding.bind(findViewById(R.id.logtrackable_activity_viewroot));<NEW_LINE>date.init(findViewById(R.id.date), findViewById(R.id.time), null, getSupportFragmentManager());<NEW_LINE>// get parameters<NEW_LINE>final Bundle extras = getIntent().getExtras();<NEW_LINE>final Uri uri = AndroidBeam.getUri(getIntent());<NEW_LINE>if (extras != null) {<NEW_LINE>geocode = extras.getString(Intents.EXTRA_GEOCODE);<NEW_LINE>// Load geocache if we can<NEW_LINE>if (StringUtils.isNotBlank(extras.getString(Intents.EXTRA_GEOCACHE))) {<NEW_LINE>final Geocache tmpGeocache = DataStore.loadCache(extras.getString(Intents.EXTRA_GEOCACHE), LoadFlags.LOAD_CACHE_OR_DB);<NEW_LINE>if (tmpGeocache != null) {<NEW_LINE>geocache = tmpGeocache;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Load Tracking Code<NEW_LINE>if (StringUtils.isNotBlank(extras.getString(Intents.EXTRA_TRACKING_CODE))) {<NEW_LINE>trackingCode = extras.getString(Intents.EXTRA_TRACKING_CODE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// try to get data from URI<NEW_LINE>if (geocode == null && uri != null) {<NEW_LINE>geocode = ConnectorFactory.<MASK><NEW_LINE>}<NEW_LINE>// try to get data from URI from a potential tracking Code<NEW_LINE>if (geocode == null && uri != null) {<NEW_LINE>final TrackableTrackingCode tbTrackingCode = ConnectorFactory.getTrackableTrackingCodeFromURL(uri.toString());<NEW_LINE>if (!tbTrackingCode.isEmpty()) {<NEW_LINE>brand = tbTrackingCode.brand;<NEW_LINE>geocode = tbTrackingCode.trackingCode;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// no given data<NEW_LINE>if (geocode == null) {<NEW_LINE>showToast(res.getString(R.string.err_tb_display));<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>refreshTrackable();<NEW_LINE>} | getTrackableFromURL(uri.toString()); |
605,525 | public String generateSessionTokenForUser(@Nonnull final String userId) {<NEW_LINE>Objects.requireNonNull(userId, "userId must not be null");<NEW_LINE>CloseableHttpClient httpClient = HttpClients.createDefault();<NEW_LINE>try {<NEW_LINE>final String protocol = this.metadataServiceUseSsl ? "https" : "http";<NEW_LINE>final HttpPost request = new HttpPost(String.format("%s://%s:%s/%s", protocol, this.metadataServiceHost<MASK><NEW_LINE>// Build JSON request to generate a token on behalf of a user.<NEW_LINE>String json = String.format("{ \"%s\":\"%s\" }", USER_ID_FIELD, userId);<NEW_LINE>request.setEntity(new StringEntity(json));<NEW_LINE>// Add authorization header with DataHub frontend system id and secret.<NEW_LINE>request.addHeader(Http.HeaderNames.AUTHORIZATION, this.systemAuthentication.getCredentials());<NEW_LINE>CloseableHttpResponse response = httpClient.execute(request);<NEW_LINE>final HttpEntity entity = response.getEntity();<NEW_LINE>if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK && entity != null) {<NEW_LINE>// Successfully generated a token for the User<NEW_LINE>final String jsonStr = EntityUtils.toString(entity);<NEW_LINE>return getAccessTokenFromJson(jsonStr);<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException(String.format("Bad response from the Metadata Service: %s %s", response.getStatusLine().toString(), response.getEntity().toString()));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Failed to generate session token for user", e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>httpClient.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.warn("Failed to close http client", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , this.metadataServicePort, GENERATE_SESSION_TOKEN_ENDPOINT)); |
489,574 | public void fillBeats(double start) {<NEW_LINE>double prevBeat = 0, nextBeat, currentInterval, beats;<NEW_LINE>ListIterator<Event> list = events.listIterator();<NEW_LINE>if (list.hasNext()) {<NEW_LINE>prevBeat = list.next().keyDown;<NEW_LINE>// alt. to fill from 0:<NEW_LINE>// prevBeat = Math.mod(list.next().keyDown, beatInterval);<NEW_LINE>list.previous();<NEW_LINE>}<NEW_LINE>for (; list.hasNext(); list.next()) {<NEW_LINE>nextBeat = list.next().keyDown;<NEW_LINE>list.previous();<NEW_LINE>// prefer slow<NEW_LINE>beats = Math.round((nextBeat - prevBeat) / beatInterval - 0.01);<NEW_LINE>currentInterval <MASK><NEW_LINE>for (; (nextBeat > start) && (beats > 1.5); beats--) {<NEW_LINE>prevBeat += currentInterval;<NEW_LINE>if (debug)<NEW_LINE>System.out.printf("Insert beat at: %8.3f (n=%1.0f)\n", prevBeat, beats - 1.0);<NEW_LINE>// more than once OK??<NEW_LINE>list.add(newBeat(prevBeat, 0));<NEW_LINE>}<NEW_LINE>prevBeat = nextBeat;<NEW_LINE>}<NEW_LINE>} | = (nextBeat - prevBeat) / beats; |
407,304 | protected <T extends JpaObject> String idleQueryAlias(Business business, String alias, String excludeId) throws Exception {<NEW_LINE>if (StringUtils.isEmpty(alias)) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>List<String> list = new ArrayList<>();<NEW_LINE>list.add(alias);<NEW_LINE>for (int i = 1; i < 99; i++) {<NEW_LINE>list.add(alias + String.format("%02d", i));<NEW_LINE>}<NEW_LINE>list.add(StringTools.uniqueToken());<NEW_LINE>EntityManager em = business.entityManagerContainer().get(Query.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<Query> root = cq.from(Query.class);<NEW_LINE>Predicate p = root.get(Query_.alias).in(list);<NEW_LINE>if (StringUtils.isNotEmpty(excludeId)) {<NEW_LINE>p = cb.and(p, cb.notEqual(root.get(JpaObject.id_FIELDNAME), excludeId));<NEW_LINE>}<NEW_LINE>cq.select(root.get(Query_.alias)).where(p);<NEW_LINE>List<String> os = em.createQuery(cq).getResultList();<NEW_LINE>list = <MASK><NEW_LINE>return list.get(0);<NEW_LINE>} | ListUtils.subtract(list, os); |
310,461 | private Response captureAuthorizationInternal(final PaymentTransactionJson json, @Nullable final UUID paymentId, final List<String> paymentControlPluginNames, final List<String> pluginPropertiesString, final String createdBy, final String reason, final String comment, final UriInfo uriInfo, final HttpServletRequest request) throws PaymentApiException, AccountApiException {<NEW_LINE>verifyNonNullOrEmpty(json, "PaymentTransactionJson body should be specified");<NEW_LINE>verifyNonNullOrEmpty(json.getAmount(), "PaymentTransactionJson amount needs to be set");<NEW_LINE>final Iterable<PluginProperty> pluginPropertiesFromBody = extractPluginProperties(json.getProperties());<NEW_LINE>final Iterable<PluginProperty> pluginPropertiesFromQuery = extractPluginProperties(pluginPropertiesString);<NEW_LINE>final Iterable<PluginProperty> pluginProperties = Iterables.concat(pluginPropertiesFromQuery, pluginPropertiesFromBody);<NEW_LINE>final CallContext callContext = context.createCallContextNoAccountId(createdBy, reason, comment, request);<NEW_LINE>final Payment initialPayment = getPaymentByIdOrKey(paymentId, json.getPaymentExternalKey(), pluginProperties, callContext);<NEW_LINE>final Account account = accountUserApi.getAccountById(initialPayment.getAccountId(), callContext);<NEW_LINE>final Currency currency = json.getCurrency() == null ? account.getCurrency() : json.getCurrency();<NEW_LINE><MASK><NEW_LINE>final Payment payment = paymentApi.createCaptureWithPaymentControl(account, initialPayment.getId(), json.getAmount(), currency, json.getEffectiveDate(), json.getTransactionExternalKey(), pluginProperties, paymentOptions, callContext);<NEW_LINE>return createPaymentResponse(uriInfo, payment, TransactionType.CAPTURE, json.getTransactionExternalKey(), request);<NEW_LINE>} | final PaymentOptions paymentOptions = createControlPluginApiPaymentOptions(paymentControlPluginNames); |
1,492,749 | public static User createFromStruct(Struct dataStruct) {<NEW_LINE>if (dataStruct == null) {<NEW_LINE>throw new IllegalArgumentException("struct cannot be null");<NEW_LINE>}<NEW_LINE>Member<? extends Value<?>, ?> userId = dataStruct.get("IDUser");<NEW_LINE>Member<? extends Value<?>, ?> nick = dataStruct.get("UserNickName");<NEW_LINE>Member<? extends Value<?>, ?> rank = dataStruct.get("UserRank");<NEW_LINE>Member<? extends Value<?>, ?> preferences = dataStruct.get("UserPreferedLanguages");<NEW_LINE>Member<? extends Value<?>, ?> vip = dataStruct.get("isVIP");<NEW_LINE>boolean isVIP = vip != null && vip.getValue() != null && !"0".equals(vip.getValue().toString()) && !"false".equals(vip.getValue().toString().toLowerCase(Locale.ROOT));<NEW_LINE>Member<? extends Value<?>, ?> contentLocation = dataStruct.get("Content-Location");<NEW_LINE>String urlString = contentLocation == null || contentLocation.getValue() == null ? null : contentLocation.getValue().toString();<NEW_LINE>URI url = null;<NEW_LINE>if (urlString != null && isNotBlank(urlString)) {<NEW_LINE>try {<NEW_LINE>urlString = <MASK><NEW_LINE>url = new URI(urlString);<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>LOGGER.debug("OpenSubtitles: Ignoring invalid URL \"{}\": {}", urlString, e.getMessage());<NEW_LINE>LOGGER.trace("", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new User(userId == null || userId.getValue() == null ? null : userId.getValue().toString(), nick == null || nick.getValue() == null ? null : nick.getValue().toString(), rank == null || rank.getValue() == null ? null : rank.getValue().toString(), preferences == null || preferences.getValue() == null ? null : preferences.getValue().toString(), isVIP, url);<NEW_LINE>} | urlString.replaceFirst("https://", "http://"); |
1,347,311 | private void displayNoOppositeLocationFound() {<NEW_LINE>String sourceClsName;<NEW_LINE><MASK><NEW_LINE>sourceClsName = srcClassPath.getResourceName(fileObj, '.', false);<NEW_LINE>// String msgKey = !fileObj.isFolder()<NEW_LINE>// ? "MSG_test_class_not_found" //NOI18N<NEW_LINE>// : (sourceClsName.length() != 0)<NEW_LINE>// ? "MSG_testsuite_class_not_found" //NOI18N<NEW_LINE>// : "MSG_testsuite_class_not_found_def_pkg";//NOI18N<NEW_LINE>// callback.foundLocation(currLocation.getFileObject(),<NEW_LINE>// new LocationResult(NbBundle.getMessage(getClass(), msgKey, sourceClsName)));<NEW_LINE>String error = !fileObj.isFolder() ? Bundle.MSG_test_class_not_found(sourceClsName) : (sourceClsName.length() != 0) ? Bundle.MSG_testsuite_class_not_found(sourceClsName) : Bundle.MSG_testsuite_class_not_found_def_pkg();<NEW_LINE>callback.foundLocation(currLocation.getFileObject(), new LocationResult(error));<NEW_LINE>} | FileObject fileObj = currLocation.getFileObject(); |
1,440,867 | /* (non-Javadoc)<NEW_LINE>* @see org.netbeans.modules.web.beans.analysis.analyzer.AbstractTypedAnalyzer#checkSpecializes(javax.lang.model.element.Element, javax.lang.model.type.TypeMirror, java.util.List, java.util.concurrent.atomic.AtomicBoolean, org.netbeans.modules.web.beans.analysis.analyzer.ElementAnalyzer.Result)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>protected void checkSpecializes(Element element, TypeMirror elementType, List<TypeMirror> restrictedTypes, AtomicBoolean cancel, CdiAnalysisResult result) {<NEW_LINE>TypeElement typeElement = (TypeElement) element;<NEW_LINE>TypeMirror superclass = typeElement.getSuperclass();<NEW_LINE>Element superElement = result.getInfo().getTypes().asElement(superclass);<NEW_LINE>if (!(superElement instanceof TypeElement)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<TypeMirror> restrictedSuper = getRestrictedTypes(superElement, result.getInfo(), cancel);<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Set<TypeElement> specializedBeanTypes;<NEW_LINE>if (restrictedSuper == null) {<NEW_LINE>specializedBeanTypes = getUnrestrictedBeanTypes((TypeElement) <MASK><NEW_LINE>} else {<NEW_LINE>specializedBeanTypes = getElements(restrictedSuper, result.getInfo());<NEW_LINE>}<NEW_LINE>Set<TypeElement> restrictedElements = getElements(restrictedTypes, result.getInfo());<NEW_LINE>restrictedElements.add(result.getInfo().getElements().getTypeElement(Object.class.getCanonicalName()));<NEW_LINE>if (!restrictedElements.containsAll(specializedBeanTypes)) {<NEW_LINE>result.addError(element, // NOI18N<NEW_LINE>NbBundle.// NOI18N<NEW_LINE>getMessage(// NOI18N<NEW_LINE>TypedClassAnalizer.class, "ERR_BadSpecializesBeanType"));<NEW_LINE>}<NEW_LINE>} | superElement, result.getInfo()); |
758,795 | protected <T> void invokeMethod(RemoteServiceRequest request, RemoteServiceMethod method, CompletableFuture<RemoteServiceCancelRequest> cancelRequestFuture, CompletableFuture<RRemoteServiceResponse> responsePromise) {<NEW_LINE>startedListeners.forEach(l -> l.onStarted(request.getId()));<NEW_LINE>if (taskTimeout > 0) {<NEW_LINE>commandExecutor.getConnectionManager().getGroup().schedule(() -> {<NEW_LINE>cancelRequestFuture.complete(new RemoteServiceCancelRequest(true, false));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Object result = method.getMethod().invoke(method.getBean(), request.getArgs());<NEW_LINE>RemoteServiceResponse response = new RemoteServiceResponse(request.getId(), result);<NEW_LINE>responsePromise.complete(response);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (e instanceof InvocationTargetException && e.getCause() instanceof RedissonShutdownException) {<NEW_LINE>if (cancelRequestFuture != null) {<NEW_LINE>cancelRequestFuture.cancel(false);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RemoteServiceResponse response = new RemoteServiceResponse(request.getId(), e.getCause());<NEW_LINE>responsePromise.complete(response);<NEW_LINE>log.error("Can't execute: " + request, e);<NEW_LINE>}<NEW_LINE>if (cancelRequestFuture != null) {<NEW_LINE>cancelRequestFuture.cancel(false);<NEW_LINE>}<NEW_LINE>if (commandExecutor.getNow(responsePromise) instanceof RemoteServiceResponse) {<NEW_LINE>RemoteServiceResponse response = (RemoteServiceResponse) commandExecutor.getNow(responsePromise);<NEW_LINE>if (response.getError() == null) {<NEW_LINE>successListeners.forEach(l -> l.onSucceeded(request.getId(), response.getResult()));<NEW_LINE>} else {<NEW_LINE>failureListeners.forEach(l -> l.onFailed(request.getId(), response.getError()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>failureListeners.forEach(l -> l.onFailed(request.getId(), null));<NEW_LINE>}<NEW_LINE>finishedListeners.forEach(l -> l.onFinished(request.getId()));<NEW_LINE>} | }, taskTimeout, TimeUnit.MILLISECONDS); |
127,595 | public List<PrepareLandmarks> prepare(List<LMConfig> lmConfigs, GraphHopperStorage ghStorage, LocationIndex locationIndex, final boolean closeEarly) {<NEW_LINE>List<PrepareLandmarks> preparations = createPreparations(lmConfigs, ghStorage.getBaseGraph(), ghStorage.getEncodingManager(), locationIndex);<NEW_LINE>List<Callable<String>> <MASK><NEW_LINE>for (int i = 0; i < preparations.size(); i++) {<NEW_LINE>PrepareLandmarks prepare = preparations.get(i);<NEW_LINE>final int count = i + 1;<NEW_LINE>final String name = prepare.getLMConfig().getName();<NEW_LINE>prepareCallables.add(() -> {<NEW_LINE>LOGGER.info(count + "/" + lmConfigs.size() + " calling LM prepare.doWork for " + prepare.getLMConfig().getWeighting() + " ... (" + getMemInfo() + ")");<NEW_LINE>Thread.currentThread().setName(name);<NEW_LINE>prepare.doWork();<NEW_LINE>if (closeEarly)<NEW_LINE>prepare.close();<NEW_LINE>LOGGER.info("LM {} finished {}", name, getMemInfo());<NEW_LINE>ghStorage.getProperties().put(Landmark.PREPARE + "date." + name, createFormatter().format(new Date()));<NEW_LINE>return name;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>GHUtility.runConcurrently(prepareCallables, preparationThreads);<NEW_LINE>LOGGER.info("Finished LM preparation, {}", getMemInfo());<NEW_LINE>return preparations;<NEW_LINE>} | prepareCallables = new ArrayList<>(); |
1,710,039 | public List<Hypothesis> specialisations(List<LogicalExample> examplesSoFar) {<NEW_LINE>List<Hypothesis> result = new ArrayList<>();<NEW_LINE>LogicalExample lastExample = examplesSoFar.get(examplesSoFar.size() - 1);<NEW_LINE>for (String key : lastExample.getAttributes().keySet()) {<NEW_LINE>List<HashMap<String, String>> satisfiedDisjuncts = new ArrayList<>();<NEW_LINE>for (HashMap<String, String> disjunct : this.getHypothesis()) {<NEW_LINE>if (this.satisfiesConjunction(lastExample, disjunct))<NEW_LINE>satisfiedDisjuncts.add(<MASK><NEW_LINE>}<NEW_LINE>List<HashMap<String, String>> tempDisjuncts = new ArrayList<>(this.getHypothesis());<NEW_LINE>tempDisjuncts.removeAll(satisfiedDisjuncts);<NEW_LINE>for (HashMap<String, String> falseDisjunct : satisfiedDisjuncts) {<NEW_LINE>if (falseDisjunct.containsKey(key))<NEW_LINE>continue;<NEW_LINE>else<NEW_LINE>falseDisjunct.put(key, "!" + lastExample.getAttributes().get(key));<NEW_LINE>}<NEW_LINE>tempDisjuncts.addAll(new ArrayList<>(satisfiedDisjuncts));<NEW_LINE>Hypothesis newHypo = new Hypothesis(this.getGoal(), new ArrayList<>(tempDisjuncts));<NEW_LINE>result.add(newHypo);<NEW_LINE>}<NEW_LINE>Collections.shuffle(result);<NEW_LINE>return result;<NEW_LINE>} | new HashMap<>(disjunct)); |
1,042,091 | public void stopping(Container moduleContainer) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(null, "stopping", moduleContainer.getName());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>WebAppConfiguration webConfig = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class);<NEW_LINE>String moduleName = webConfig.getModuleName();<NEW_LINE>WebApp webApp = webConfig.getWebApp();<NEW_LINE>SipAppDesc appDesc = SipAppDescManager.getInstance().getSipAppDesc(webApp);<NEW_LINE>if (null != appDesc && appDesc.wasInitialized()) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "stopping", "SIP Application: module=" + moduleName + ", app=" + appDesc.getAppName());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>boolean invalidate = store.getProperties().getBoolean(CoreProperties.INVALIDATE_SESSION_ON_SHUTDOWN);<NEW_LINE>if (invalidate) {<NEW_LINE>// fix for 385019<NEW_LINE>invalidateAppSessions(appDesc.getApplicationName());<NEW_LINE>}<NEW_LINE>List<SipServletDesc> serlvets = appDesc.getSipServlets();<NEW_LINE>// Remove listeners and remove from ServetsInstanceHolder<NEW_LINE>// TODO Liberty test code might not work<NEW_LINE>String appName = appDesc.getApplicationName();<NEW_LINE>if (serlvets != null) {<NEW_LINE>removeSipServlets(appName, serlvets);<NEW_LINE>}<NEW_LINE>SipContainer.getInstance().unloadAppConfiguration(appDesc.getAppName());<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "stopping", "applications left running = " + SipContainer.getInstance().getNumOfRunningApplications());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (UnableToAdaptException e) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(null, "stopping", "not SipAppDesc found not a sip application: " + moduleContainer.getName(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | PropertiesStore store = PropertiesStore.getInstance(); |
378,835 | public static void rgbToHsv_F32(Planar<GrayF32> rgb, Planar<GrayF32> hsv) {<NEW_LINE>GrayF32 R = rgb.getBand(0);<NEW_LINE>GrayF32 G = rgb.getBand(1);<NEW_LINE>GrayF32 B = rgb.getBand(2);<NEW_LINE>GrayF32 H = hsv.getBand(0);<NEW_LINE>GrayF32 S = hsv.getBand(1);<NEW_LINE>GrayF32 V = hsv.getBand(2);<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0,hsv.height,row->{<NEW_LINE>for (int row = 0; row < hsv.height; row++) {<NEW_LINE>int indexRgb = rgb<MASK><NEW_LINE>int indexHsv = hsv.startIndex + row * hsv.stride;<NEW_LINE>int endRgb = indexRgb + hsv.width;<NEW_LINE>for (; indexRgb < endRgb; indexHsv++, indexRgb++) {<NEW_LINE>float r = R.data[indexRgb];<NEW_LINE>float g = G.data[indexRgb];<NEW_LINE>float b = B.data[indexRgb];<NEW_LINE>float max = r > g ? (r > b ? r : b) : (g > b ? g : b);<NEW_LINE>float min = r < g ? (r < b ? r : b) : (g < b ? g : b);<NEW_LINE>float delta = max - min;<NEW_LINE>V.data[indexHsv] = max;<NEW_LINE>if (max != 0)<NEW_LINE>S.data[indexHsv] = delta / max;<NEW_LINE>else {<NEW_LINE>H.data[indexHsv] = Float.NaN;<NEW_LINE>S.data[indexHsv] = 0;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>float h;<NEW_LINE>if (r == max)<NEW_LINE>h = (g - b) / delta;<NEW_LINE>else if (g == max)<NEW_LINE>h = 2 + (b - r) / delta;<NEW_LINE>else<NEW_LINE>h = 4 + (r - g) / delta;<NEW_LINE>h *= d60_F32;<NEW_LINE>if (h < 0)<NEW_LINE>h += PI2_F32;<NEW_LINE>H.data[indexHsv] = h;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | .startIndex + row * rgb.stride; |
1,159,792 | public void combineOne(SumByFloatProcedure<T, V> thingToCombine) {<NEW_LINE>if (this.result.isEmpty()) {<NEW_LINE>thingToCombine.getResult().forEachKeyValue(new Procedure2<V, DoubleDoublePair>() {<NEW_LINE><NEW_LINE>public void value(V each, DoubleDoublePair sumCompensation) {<NEW_LINE>SumByFloatCombiner.this.result.put(each, sumCompensation.getOne());<NEW_LINE>SumByFloatCombiner.this.compensation.put(each, sumCompensation.getTwo());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>thingToCombine.getResult().forEachKeyValue(new Procedure2<V, DoubleDoublePair>() {<NEW_LINE><NEW_LINE>public void value(V each, DoubleDoublePair sumCompensation) {<NEW_LINE>double sum = SumByFloatCombiner.this.result.get(each);<NEW_LINE>double currentCompensation = SumByFloatCombiner.this.compensation.getIfAbsentPut(each, new DoubleFunction0() {<NEW_LINE><NEW_LINE>public double value() {<NEW_LINE>return 0.0d;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>double adjustedValue = sumCompensation.getOne() - currentCompensation;<NEW_LINE>double nextSum = sum + adjustedValue;<NEW_LINE>SumByFloatCombiner.this.compensation.put(each, nextSum - sum - adjustedValue);<NEW_LINE>SumByFloatCombiner.this.result.put(each, nextSum);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | }) + sumCompensation.getTwo(); |
529,638 | public void run() {<NEW_LINE>try {<NEW_LINE>File file = new File(query.getDescription());<NEW_LINE>if (file.isFile() && !file.canWrite()) {<NEW_LINE>ProfilerDialogs.displayError(Bundle.RQueries_InvalidScript());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Files.write(file.toPath(), query.<MASK><NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (handler != null)<NEW_LINE>handler.querySelected(query);<NEW_LINE>if (externalQueries == null)<NEW_LINE>externalQueries = new ArrayList(EXTERNAL_QUERIES_CACHE);<NEW_LINE>if (containsQuery(externalQueries, query))<NEW_LINE>return;<NEW_LINE>if (externalQueries.size() == EXTERNAL_QUERIES_CACHE)<NEW_LINE>externalQueries.remove(externalQueries.size() - 1);<NEW_LINE>externalQueries.add(0, query);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ProfilerDialogs.displayError(Bundle.RQueries_SaveFailed());<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>} | getScript().getBytes()); |
204,223 | private static void showUsage() {<NEW_LINE>String usage = "Usage: java -jar ConnectionHelperClient.jar connectionInfo [svrPort]\n" + "connectionInfo = -conName=user[/[pw]]@host:port(:sid|/svc)[#role]" + "Where:\n" + "- connName is the name you would like for the connection\n" + "- user is the user name for the schema you want to use\n" + "- /password is the password for that user *(optional - if missing e.g., user@ or user/@, SQLDeveloper will prompt for it)*\n" + "- host is the host that the database is on\n" + "- port is the port the database is listening on\n" + "- :sid is the sid for the database *(One of :sid or /svc MUST be supplied)*\n" <MASK><NEW_LINE>System.out.println(usage);<NEW_LINE>} | + "- /svc is the service name for the database *(One of :sid or /svc MUST be supplied)*\n" + "- #role is the role *(optional - one of SYSDBA, SYSOPER, SYSBACKUP, SYSDG, SYSKM, SYSASM if used)*\n" + "and\n" + "svrPort = the port the ConnectionHelperServer is listening on (optional default: 51521)\n"; |
843,618 | public boolean updateDatabase() {<NEW_LINE>try {<NEW_LINE>if (!Files.exists(databasesDirectory)) {<NEW_LINE>Files.createDirectories(databasesDirectory);<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>LOGGER.error(databasesDirectory.toString() + " does not exist and cannot be created!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final File existingDB = databasesDirectory.<MASK><NEW_LINE>if (!isLoaded()) {<NEW_LINE>try {<NEW_LINE>setLoaded(loadDatabase());<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.warn("[" + getClass().getSimpleName() + "] Failed to load existing database! " + e.getMessage());<NEW_LINE>}<NEW_LINE>} else if (!needsUpdating(existingDB)) {<NEW_LINE>LOGGER.info("[" + getClass().getSimpleName() + "] Location database does not require updating.");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>File newDB = null;<NEW_LINE>boolean isModified = true;<NEW_LINE>final String databaseURL = getDataBaseURL();<NEW_LINE>if (databaseURL == null) {<NEW_LINE>LOGGER.warn("[" + getClass().getSimpleName() + "] Skipping download/update: database URL is null");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>newDB = downloadDatabase(databaseURL, existingDB);<NEW_LINE>trafficRouterManager.trackEvent("last" + getClass().getSimpleName() + "Check");<NEW_LINE>// if the remote db's timestamp is less than or equal to ours, the above returns existingDB<NEW_LINE>if (newDB == existingDB) {<NEW_LINE>isModified = false;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.fatal("[" + getClass().getSimpleName() + "] Caught exception while attempting to download: " + getDataBaseURL(), e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!isModified || newDB == null || !newDB.exists()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!verifyDatabase(newDB)) {<NEW_LINE>LOGGER.warn("[" + getClass().getSimpleName() + "] " + newDB.getAbsolutePath() + " from " + getDataBaseURL() + " is invalid!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("[" + getClass().getSimpleName() + "] Failed verifying database " + newDB.getAbsolutePath() + " : " + e.getMessage());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (copyDatabaseIfDifferent(existingDB, newDB)) {<NEW_LINE>setLoaded(loadDatabase());<NEW_LINE>trafficRouterManager.trackEvent("last" + getClass().getSimpleName() + "Update");<NEW_LINE>} else {<NEW_LINE>newDB.delete();<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("[" + getClass().getSimpleName() + "] Failed copying and loading new database " + newDB.getAbsolutePath() + " : " + e.getMessage());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (newDB != null && newDB != existingDB && newDB.exists()) {<NEW_LINE>LOGGER.info("[" + getClass().getSimpleName() + "] Try to delete downloaded temp file");<NEW_LINE>deleteDatabase(newDB);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | resolve(databaseName).toFile(); |
634,231 | protected org.apache.skywalking.oap.server.core.query.type.event.Event parseSeriesValues(final QueryResult.Series series, final List<Object> values) {<NEW_LINE>final org.apache.skywalking.oap.server.core.query.type.event.Event event = new org.apache.skywalking.oap.server.core.query.type.event.Event();<NEW_LINE>final List<String> columns = series.getColumns();<NEW_LINE>final Map<String, Object> data = new HashMap<>();<NEW_LINE>for (int i = 1; i < columns.size(); i++) {<NEW_LINE>Object value = values.get(i);<NEW_LINE>if (value instanceof StorageDataComplexObject) {<NEW_LINE>value = ((StorageDataComplexObject) value).toStorageData();<NEW_LINE>}<NEW_LINE>data.put(columns.get(i), value);<NEW_LINE>}<NEW_LINE>event.setUuid((String) data.get(Event.UUID));<NEW_LINE>final String service = (String) data.get(Event.SERVICE);<NEW_LINE>final String serviceInstance = (String) data.get(Event.SERVICE_INSTANCE);<NEW_LINE>final String endpoint = (String) data.get(Event.ENDPOINT);<NEW_LINE>event.setSource(new Source(service, serviceInstance, endpoint));<NEW_LINE>event.setName((String) data.get(Event.NAME));<NEW_LINE>event.setType(EventType.parse((String) data.get(Event.TYPE)));<NEW_LINE>event.setMessage((String) data.get(Event.MESSAGE));<NEW_LINE>event.setParameters((String) data<MASK><NEW_LINE>event.setStartTime(((Number) data.get(Event.START_TIME)).longValue());<NEW_LINE>event.setEndTime(((Number) data.get(Event.END_TIME)).longValue());<NEW_LINE>return event;<NEW_LINE>} | .get(Event.PARAMETERS)); |
1,092,121 | public void exportData(int exportedFileType, ExportDataDumper eDD, String viewName) {<NEW_LINE>percentFormat.setMaximumFractionDigits(2);<NEW_LINE>percentFormat.setMinimumFractionDigits(2);<NEW_LINE>PrestimeCPUCCTNodeBacked.setPercentFormat(percentFormat);<NEW_LINE>switch(exportedFileType) {<NEW_LINE>case // NOI18N<NEW_LINE>1:<NEW_LINE>// NOI18N<NEW_LINE>eDD.dumpData(getCSVHeader(","));<NEW_LINE>((PrestimeCPUCCTNodeBacked) abstractTreeTableModel.getRoot()).exportCSVData(",", exportedFileType, eDD);<NEW_LINE>eDD.close();<NEW_LINE>break;<NEW_LINE>case // NOI18N<NEW_LINE>2:<NEW_LINE>// NOI18N<NEW_LINE>eDD.dumpData(getCSVHeader(";"));<NEW_LINE>((PrestimeCPUCCTNodeBacked) abstractTreeTableModel.getRoot()).exportCSVData(";", exportedFileType, eDD);<NEW_LINE>eDD.close();<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>eDD.dumpData(getXMLHeader(viewName));<NEW_LINE>((PrestimeCPUCCTNodeBacked) abstractTreeTableModel.getRoot()).exportXMLData(eDD, " ");<NEW_LINE>eDD.dumpDataAndClose(getXMLFooter());<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>eDD.dumpData(getHTMLHeader(viewName));<NEW_LINE>((PrestimeCPUCCTNodeBacked) abstractTreeTableModel.getRoot()).exportHTMLData(eDD, 0);<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>percentFormat.setMaximumFractionDigits(1);<NEW_LINE>percentFormat.setMinimumFractionDigits(0);<NEW_LINE>} | eDD.dumpDataAndClose(getHTMLFooter()); |
1,497,292 | protected void search(final int page) {<NEW_LINE>this.page = page;<NEW_LINE>final String repository = repositorySelector.getSelectedItem().toString();<NEW_LINE>final String branch = branchSelector.getSelectedIndex() > -1 ? branchSelector.getSelectedItem().toString() : null;<NEW_LINE>final Constants.SearchType searchType = (Constants.SearchType) searchTypeSelector.getSelectedItem();<NEW_LINE>final String fragment = isSearch ? searchFragment.getText() : null;<NEW_LINE>final int maxEntryCount = maxHitsSelector.getSelectedIndex() > -1 ? ((Integer) maxHitsSelector.getSelectedItem()) : -1;<NEW_LINE>if (isSearch && StringUtils.isEmpty(fragment)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));<NEW_LINE>SwingWorker<List<FeedEntryModel>, Void> worker = new SwingWorker<List<FeedEntryModel>, Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected List<FeedEntryModel> doInBackground() throws IOException {<NEW_LINE>if (isSearch) {<NEW_LINE>return gitblit.search(repository, branch, fragment, searchType, maxEntryCount, page);<NEW_LINE>} else {<NEW_LINE>return gitblit.log(repository, branch, maxEntryCount, page);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void done() {<NEW_LINE>setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));<NEW_LINE>try {<NEW_LINE>List<FeedEntryModel> results = get();<NEW_LINE>if (isSearch) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>updateTable(true, branch == null ? "" : branch, results);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>Utils.showException(SearchDialog.this, t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>worker.execute();<NEW_LINE>} | updateTable(true, fragment, results); |
288,006 | public void onSuccess(List<V2TIMGroupInfoResult> v2TIMGroupInfoResults) {<NEW_LINE>if (v2TIMGroupInfoResults != null && v2TIMGroupInfoResults.size() > 0) {<NEW_LINE>for (V2TIMGroupInfoResult v2TIMGroupInfoResult : v2TIMGroupInfoResults) {<NEW_LINE>TUISearchGroupResult searchGroupResult = searchGroupMemberResults.get(v2TIMGroupInfoResult.<MASK><NEW_LINE>if (searchGroupResult != null) {<NEW_LINE>searchGroupResult.setGroupInfo(GroupInfoUtils.convertTimGroupInfo2GroupInfo(v2TIMGroupInfoResult.getGroupInfo()));<NEW_LINE>searchGroupResults.add(searchGroupResult);<NEW_LINE>} else {<NEW_LINE>TUISearchLog.e(TAG, "getGroupsInfo not searchGroupMemberResults.get(v2TIMGroupInfoResult.getGroupInfo().getGroupID(): " + v2TIMGroupInfoResult.getGroupInfo().getGroupID());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TUISearchLog.d(TAG, "mergeGroupAndGroupMemberResult callback.onSuccess searchGroupResults.size() = " + searchGroupResults.size());<NEW_LINE>if (callback != null) {<NEW_LINE>callback.onSuccess(searchGroupResults);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getGroupInfo().getGroupID()); |
166,080 | public static void copyFile(InputStream is, OutputStream os, boolean closeInputStream, ProgressListener pl) throws IOException {<NEW_LINE>try {<NEW_LINE>if (!(is instanceof BufferedInputStream)) {<NEW_LINE>is = new BufferedInputStream(is, 128 * 1024);<NEW_LINE>}<NEW_LINE>byte[] buffer = new byte[128 * 1024];<NEW_LINE>while (true) {<NEW_LINE>if (pl != null) {<NEW_LINE>while (true) {<NEW_LINE><MASK><NEW_LINE>if (state == ProgressListener.ST_PAUSED) {<NEW_LINE>try {<NEW_LINE>Thread.sleep(250);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>}<NEW_LINE>} else if (state == ProgressListener.ST_CANCELLED) {<NEW_LINE>throw (new IOException("Cancelled"));<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int len = is.read(buffer);<NEW_LINE>if (len == -1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>os.write(buffer, 0, len);<NEW_LINE>if (pl != null) {<NEW_LINE>pl.bytesDone(len);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (closeInputStream) {<NEW_LINE>is.close();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>}<NEW_LINE>os.close();<NEW_LINE>}<NEW_LINE>} | int state = pl.getState(); |
753,322 | public String sqlADAction_insertTranslation(String vendorName, String catalogName, String schemaName, String tableName, ArrayList<String> columnNames) {<NEW_LINE>// ID-Column<NEW_LINE>String idColumn = new StringBuffer(tableName).append("_ID").toString();<NEW_LINE>// column list<NEW_LINE>ArrayList<String> completeColumnNames = new ArrayList<String>();<NEW_LINE>completeColumnNames.add("AD_Language");<NEW_LINE>completeColumnNames.add("AD_Client_ID");<NEW_LINE>completeColumnNames.add("AD_Org_ID");<NEW_LINE>completeColumnNames.add("Created");<NEW_LINE>completeColumnNames.add("CreatedBy");<NEW_LINE>completeColumnNames.add("Updated");<NEW_LINE>completeColumnNames.add("UpdatedBy");<NEW_LINE>completeColumnNames.add("IsActive");<NEW_LINE>completeColumnNames.add("IsTranslated");<NEW_LINE>completeColumnNames.add(idColumn);<NEW_LINE>if (columnNames != null && columnNames.size() > 0) {<NEW_LINE>for (String columnName : columnNames) {<NEW_LINE>completeColumnNames.add(columnName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// value list<NEW_LINE>ArrayList<String> columnValues = new ArrayList<String>();<NEW_LINE>columnValues.add("t0.AD_Language");<NEW_LINE>columnValues.add("t.AD_Client_ID");<NEW_LINE>columnValues.add("t.AD_Org_ID");<NEW_LINE>columnValues.add(translateExpression("PostgreSQL", vendorName, "now()"));<NEW_LINE>columnValues.add("0");<NEW_LINE>columnValues.add(translateExpression("PostgreSQL", vendorName, "now()"));<NEW_LINE>columnValues.add("0");<NEW_LINE>columnValues.add("'Y'");<NEW_LINE>columnValues.add("'N'");<NEW_LINE>columnValues.add(new StringBuffer("t.").append(idColumn).toString());<NEW_LINE>if (columnNames != null && columnNames.size() > 0) {<NEW_LINE>for (String columnName : columnNames) {<NEW_LINE>columnValues.add(new StringBuffer("t.").append(columnName).toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// target table name<NEW_LINE>String targetTableName = new StringBuffer(tableName).append("_Trl").toString();<NEW_LINE>// source table name<NEW_LINE>String sourceTableName = tableName;<NEW_LINE>// join tables<NEW_LINE>ArrayList<String> joinTypes = new ArrayList<String>();<NEW_LINE>ArrayList<String> joinTables = new ArrayList<String>();<NEW_LINE>ArrayList<String> joinConditions = new ArrayList<String>();<NEW_LINE>joinTypes.add("INNER JOIN");<NEW_LINE>joinTables.add("AD_Language");<NEW_LINE>joinConditions.add("t0.IsSystemLanguage='Y'");<NEW_LINE>// where clause<NEW_LINE>String subQuery = sql_select(vendorName, catalogName, schemaName, targetTableName, "r", new ArrayList<String>(Arrays.asList("1")), null, new ArrayList<String>(Arrays.asList(new StringBuffer("r.").append(idColumn).append(" = t.").append(idColumn).toString(), "r.AD_Language = t0.AD_Language")), null, false);<NEW_LINE>String whereClause = new StringBuffer("NOT EXISTS (").append(subQuery).append(")").toString();<NEW_LINE>return sql_insertFromTable(vendorName, catalogName, schemaName, targetTableName, completeColumnNames, columnValues, sourceTableName, <MASK><NEW_LINE>} | joinTypes, joinTables, joinConditions, whereClause); |
816,883 | public void run(RegressionEnvironment env) {<NEW_LINE>env.compileDeploy("@name('s0') select p0.n0 as a, p1[0].n0 as b, p1[1].n0 as c, p0 as d, p1 as e from MyMapWithAMap");<NEW_LINE>env.addListener("s0");<NEW_LINE>Map<String, Object> n0Bean1 = EventMapCore.makeMap(new Object[][] { { "n0", 1 } });<NEW_LINE>Map<String, Object> n0Bean21 = EventMapCore.makeMap(new Object[][] { { "n0", 2 } });<NEW_LINE>Map<String, Object> n0Bean22 = EventMapCore.makeMap(new Object[][] { { "n0", 3 } });<NEW_LINE>Map[] n0Bean2 = new Map[] { n0Bean21, n0Bean22 };<NEW_LINE>Map<String, Object> theEvent = EventMapCore.makeMap(new Object[][] { { "p0", n0Bean1 }, { "p1", n0Bean2 } });<NEW_LINE>env.sendEventMap(theEvent, "MyMapWithAMap");<NEW_LINE>env.assertEventNew("s0", eventResult -> {<NEW_LINE>EPAssertionUtil.assertProps(eventResult, "a,b,c,d".split(","), new Object[] { 1, 2, 3, n0Bean1 });<NEW_LINE>Map[] valueE = (Map[]) eventResult.get("e");<NEW_LINE>assertEquals(valueE[0], n0Bean2[0]);<NEW_LINE>assertEquals(valueE[1], n0Bean2[1]);<NEW_LINE>});<NEW_LINE>env.assertStatement("s0", statement -> {<NEW_LINE>EventType eventType = statement.getEventType();<NEW_LINE>assertEquals(Integer.class<MASK><NEW_LINE>assertEquals(Integer.class, eventType.getPropertyType("b"));<NEW_LINE>assertEquals(Integer.class, eventType.getPropertyType("c"));<NEW_LINE>assertEquals(Map.class, eventType.getPropertyType("d"));<NEW_LINE>assertEquals(Map[].class, eventType.getPropertyType("e"));<NEW_LINE>});<NEW_LINE>env.undeployAll();<NEW_LINE>} | , eventType.getPropertyType("a")); |
756,115 | private void checkSchemaFile(File file) {<NEW_LINE>try {<NEW_LINE>// this connection parses the catalog file which if invalid will<NEW_LINE>// throw exception<NEW_LINE>PropertyList list = new PropertyList();<NEW_LINE>list.put("Provider", "mondrian");<NEW_LINE><MASK><NEW_LINE>list.put("Catalog", file.toURI().toURL().toString());<NEW_LINE>list.put("JdbcDrivers", jdbcDriverClassName);<NEW_LINE>if (jdbcUsername != null && jdbcUsername.length() > 0) {<NEW_LINE>list.put("JdbcUser", jdbcUsername);<NEW_LINE>}<NEW_LINE>if (jdbcPassword != null && jdbcPassword.length() > 0) {<NEW_LINE>list.put("JdbcPassword", jdbcPassword);<NEW_LINE>}<NEW_LINE>DriverManager.getConnection(list, null);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.error("Exception : Schema file " + file.getAbsolutePath() + " is invalid." + ex.getMessage(), ex);<NEW_LINE>} catch (Error err) {<NEW_LINE>LOGGER.error("Error : Schema file " + file.getAbsolutePath() + " is invalid." + err.getMessage(), err);<NEW_LINE>}<NEW_LINE>} | list.put("Jdbc", jdbcConnectionUrl); |
563,800 | public void save(Snapshot snapshot) {<NEW_LINE>initialize();<NEW_LINE>Storage storage = snapshot.getStorage();<NEW_LINE>setProperty(storage, SNAPSHOT_VERSION, CURRENT_SNAPSHOT_VERSION);<NEW_LINE>setProperty(storage, PROP_BASIC_INFO_SUPPORTED, Boolean.toString(basicInfoSupported));<NEW_LINE>setProperty(storage, PROP_SYSTEM_PROPERTIES_SUPPORTED, Boolean.toString(systemPropertiesSupported));<NEW_LINE><MASK><NEW_LINE>setProperty(storage, PROP_HOST_NAME, hostName);<NEW_LINE>setProperty(storage, PROP_MAIN_CLASS, mainClass);<NEW_LINE>setProperty(storage, PROP_MAIN_ARGS, mainArgs);<NEW_LINE>setProperty(storage, PROP_VM_ID, vmId);<NEW_LINE>setProperty(storage, PROP_JAVA_HOME, javaHome);<NEW_LINE>setProperty(storage, PROP_JAVA_VERSION, javaVersion);<NEW_LINE>setProperty(storage, PROP_JAVA_VENDOR, javaVendor);<NEW_LINE>setProperty(storage, PROP_JVM_FLAGS, jvmFlags);<NEW_LINE>setProperty(storage, PROP_OOME_ENABLED, oomeEnabled);<NEW_LINE>setProperty(storage, PROP_JVM_ARGS, jvmArgs);<NEW_LINE>setProperty(storage, PROP_SYSTEM_PROPERTIES, systemProperties);<NEW_LINE>} | setProperty(storage, PROP_PID, pid); |
710,869 | private void showDateTimeSelectors(Calendar reminder, String recurrenceRule) {<NEW_LINE>SublimePickerFragment pickerFrag = new SublimePickerFragment();<NEW_LINE>pickerFrag.setCallback(new SublimePickerFragment.Callback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancelled() {<NEW_LINE>// Nothing to do<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onDateTimeRecurrenceSet(SelectedDate selectedDate, int hourOfDay, int minute, SublimeRecurrencePicker.RecurrenceOption recurrenceOption, String recurrenceRule) {<NEW_LINE>Calendar reminder = selectedDate.getFirstDate();<NEW_LINE>reminder.set(Calendar.HOUR_OF_DAY, hourOfDay);<NEW_LINE>reminder.set(Calendar.MINUTE, minute);<NEW_LINE>mOnReminderPickedListener.onReminderPicked(reminder.getTimeInMillis());<NEW_LINE>mOnReminderPickedListener.onRecurrenceReminderPicked(RecurrenceHelper<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>int displayOptions = 0;<NEW_LINE>displayOptions |= SublimeOptions.ACTIVATE_DATE_PICKER;<NEW_LINE>displayOptions |= SublimeOptions.ACTIVATE_TIME_PICKER;<NEW_LINE>displayOptions |= SublimeOptions.ACTIVATE_RECURRENCE_PICKER;<NEW_LINE>SublimeOptions sublimeOptions = new SublimeOptions();<NEW_LINE>sublimeOptions.setPickerToShow(SublimeOptions.Picker.TIME_PICKER);<NEW_LINE>sublimeOptions.setDisplayOptions(displayOptions);<NEW_LINE>sublimeOptions.setDateParams(reminder);<NEW_LINE>sublimeOptions.setRecurrenceParams(SublimeRecurrencePicker.RecurrenceOption.CUSTOM, recurrenceRule);<NEW_LINE>sublimeOptions.setTimeParams(reminder.get(Calendar.HOUR_OF_DAY), reminder.get(Calendar.MINUTE), DateUtils.is24HourMode(mActivity));<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putParcelable("SUBLIME_OPTIONS", sublimeOptions);<NEW_LINE>pickerFrag.setArguments(bundle);<NEW_LINE>pickerFrag.setStyle(DialogFragment.STYLE_NO_TITLE, 0);<NEW_LINE>pickerFrag.show(mActivity.getSupportFragmentManager(), "SUBLIME_PICKER");<NEW_LINE>} | .buildRecurrenceRuleByRecurrenceOptionAndRule(recurrenceOption, recurrenceRule)); |
1,746,923 | private void genLockTerm(BIRTerminator.Lock lockIns, String funcName, int localVarOffset) {<NEW_LINE>Label gotoLabel = this.labelGen.getLabel(funcName + lockIns.lockedBB.id.value);<NEW_LINE>String lockStore = "L" + LOCK_STORE + ";";<NEW_LINE>String initClassName = jvmPackageGen.lookupGlobalVarClassName(this.currentPackageName, LOCK_STORE_VAR_NAME);<NEW_LINE>String lockName = GLOBAL_LOCK_NAME + lockIns.lockId;<NEW_LINE>this.mv.visitFieldInsn(GETSTATIC, initClassName, LOCK_STORE_VAR_NAME, lockStore);<NEW_LINE>this.mv.visitLdcInsn(lockName);<NEW_LINE>this.mv.visitMethodInsn(INVOKEVIRTUAL, LOCK_STORE, "getLockFromMap", GET_LOCK_FROM_MAP, false);<NEW_LINE>this.<MASK><NEW_LINE>this.mv.visitMethodInsn(INVOKEVIRTUAL, LOCK_VALUE, "lock", LOCK, false);<NEW_LINE>this.mv.visitInsn(POP);<NEW_LINE>genYieldCheckForLock(this.mv, this.labelGen, funcName, localVarOffset);<NEW_LINE>this.mv.visitJumpInsn(GOTO, gotoLabel);<NEW_LINE>} | mv.visitVarInsn(ALOAD, localVarOffset); |
1,447,675 | private void handleSuspiciousRefComparison(JavaClass jclass, Method method, MethodGen methodGen, List<WarningWithProperties> refComparisonList, Location location, String lhs, ReferenceType lhsType, ReferenceType rhsType) {<NEW_LINE>XField xf = null;<NEW_LINE>if (lhsType instanceof FinalConstant) {<NEW_LINE>xf = ((FinalConstant) lhsType).getXField();<NEW_LINE>} else if (rhsType instanceof FinalConstant) {<NEW_LINE>xf = ((<MASK><NEW_LINE>}<NEW_LINE>String sourceFile = jclass.getSourceFileName();<NEW_LINE>String bugPattern = "RC_REF_COMPARISON";<NEW_LINE>int priority = Priorities.HIGH_PRIORITY;<NEW_LINE>if ("java.lang.Boolean".equals(lhs)) {<NEW_LINE>bugPattern = "RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN";<NEW_LINE>priority = Priorities.NORMAL_PRIORITY;<NEW_LINE>} else if (xf != null && xf.isStatic() && xf.isFinal()) {<NEW_LINE>bugPattern = "RC_REF_COMPARISON_BAD_PRACTICE";<NEW_LINE>if (xf.isPublic() || !methodGen.isPublic()) {<NEW_LINE>priority = Priorities.NORMAL_PRIORITY;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BugInstance instance = new BugInstance(this, bugPattern, priority).addClassAndMethod(methodGen, sourceFile).addType("L" + lhs.replace('.', '/') + ";").describe(TypeAnnotation.FOUND_ROLE);<NEW_LINE>if (xf != null) {<NEW_LINE>instance.addField(xf).describe(FieldAnnotation.LOADED_FROM_ROLE);<NEW_LINE>} else {<NEW_LINE>instance.addSomeSourceForTopTwoStackValues(classContext, method, location);<NEW_LINE>}<NEW_LINE>SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, location.getHandle());<NEW_LINE>refComparisonList.add(new WarningWithProperties(instance, new WarningPropertySet<WarningProperty>(), sourceLineAnnotation, location));<NEW_LINE>} | FinalConstant) rhsType).getXField(); |
71,736 | public void finish() {<NEW_LINE>if (mIsCancelled) {<NEW_LINE>setResult(RESULT_CANCELED);<NEW_LINE>} else {<NEW_LINE>RadioGroup group = findViewById(R.id.radioProfiles);<NEW_LINE>int selectedId = group.getCheckedRadioButtonId();<NEW_LINE>RadioButton radioButton = findViewById(selectedId);<NEW_LINE>// int id = Integer.parseInt(radioButton.getHint().toString());<NEW_LINE>String action = radioButton.getText().toString();<NEW_LINE>final Intent resultIntent = new Intent();<NEW_LINE>if (!G.isProfileMigrated()) {<NEW_LINE>int idx = group.indexOfChild(radioButton);<NEW_LINE>resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, PluginBundleManager.generateBundle(getApplicationContext()<MASK><NEW_LINE>} else {<NEW_LINE>int idx = group.indexOfChild(radioButton);<NEW_LINE>resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, PluginBundleManager.generateBundle(getApplicationContext(), idx + "::" + action));<NEW_LINE>}<NEW_LINE>resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB, action);<NEW_LINE>setResult(RESULT_OK, resultIntent);<NEW_LINE>}<NEW_LINE>super.finish();<NEW_LINE>} | , idx + "::" + action)); |
1,559,394 | final CreateLoadBalancerListenersResult executeCreateLoadBalancerListeners(CreateLoadBalancerListenersRequest createLoadBalancerListenersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createLoadBalancerListenersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateLoadBalancerListenersRequest> request = null;<NEW_LINE>Response<CreateLoadBalancerListenersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateLoadBalancerListenersRequestMarshaller().marshall(super.beforeMarshalling(createLoadBalancerListenersRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Elastic Load Balancing");<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>StaxResponseHandler<CreateLoadBalancerListenersResult> responseHandler = new StaxResponseHandler<CreateLoadBalancerListenersResult>(new CreateLoadBalancerListenersResultStaxUnmarshaller());<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, "CreateLoadBalancerListeners"); |
983,079 | private BLangInvocation rewriteXMLAttributeOrElemNameAccess(BLangFieldBasedAccess fieldAccessExpr) {<NEW_LINE>ArrayList<BLangExpression> args = new ArrayList<>();<NEW_LINE>String fieldName = fieldAccessExpr.field.value;<NEW_LINE>if (fieldAccessExpr.fieldKind == FieldKind.WITH_NS) {<NEW_LINE>BLangFieldBasedAccess.BLangNSPrefixedFieldBasedAccess nsPrefixAccess = (BLangFieldBasedAccess.BLangNSPrefixedFieldBasedAccess) fieldAccessExpr;<NEW_LINE>fieldName = createExpandedQName(nsPrefixAccess.nsSymbol.namespaceURI, fieldName);<NEW_LINE>}<NEW_LINE>// Handle element name access.<NEW_LINE>if (fieldName.equals("_")) {<NEW_LINE>return createLanglibXMLInvocation(fieldAccessExpr.pos, XML_INTERNAL_GET_ELEMENT_NAME_NIL_LIFTING, fieldAccessExpr.expr, new ArrayList<>(), new ArrayList<>());<NEW_LINE>}<NEW_LINE>BLangLiteral attributeNameLiteral = createStringLiteral(fieldAccessExpr.field.pos, fieldName);<NEW_LINE>args.add(attributeNameLiteral);<NEW_LINE>args<MASK><NEW_LINE>return createLanglibXMLInvocation(fieldAccessExpr.pos, XML_INTERNAL_GET_ATTRIBUTE, fieldAccessExpr.expr, args, new ArrayList<>());<NEW_LINE>} | .add(isOptionalAccessToLiteral(fieldAccessExpr)); |
830,699 | public static PersistenceManagerBean createBean(PersistenceManagerFactoryResource pmfresource) {<NEW_LINE>PersistenceManagerBean bean = new PersistenceManagerBean();<NEW_LINE>// name attribute in bean is for studio display purpose.<NEW_LINE>// It is not part of the persistence-manager-factory-resource dtd.<NEW_LINE>bean.setName(pmfresource.getJndiName());<NEW_LINE>bean.setDescription(pmfresource.getDescription());<NEW_LINE>bean.setJndiName(pmfresource.getJndiName());<NEW_LINE>bean.<MASK><NEW_LINE>bean.setDatasourceJndiName(pmfresource.getJdbcResourceJndiName());<NEW_LINE>bean.setIsEnabled(pmfresource.getEnabled());<NEW_LINE>PropertyElement[] extraProperties = pmfresource.getPropertyElement();<NEW_LINE>Vector vec = new Vector();<NEW_LINE>for (int i = 0; i < extraProperties.length; i++) {<NEW_LINE>NameValuePair pair = new NameValuePair();<NEW_LINE>pair.setParamName(extraProperties[i].getName());<NEW_LINE>pair.setParamValue(extraProperties[i].getValue());<NEW_LINE>vec.add(pair);<NEW_LINE>}<NEW_LINE>if (vec != null && vec.size() > 0) {<NEW_LINE>NameValuePair[] props = new NameValuePair[vec.size()];<NEW_LINE>bean.setExtraParams((NameValuePair[]) vec.toArray(props));<NEW_LINE>}<NEW_LINE>return bean;<NEW_LINE>} | setFactoryClass(pmfresource.getFactoryClass()); |
908,136 | protected void introspectAll(FFDCLogger info) {<NEW_LINE>info.append(this.toString());<NEW_LINE>// Allow any wrapper specific info to be inserted first.<NEW_LINE>introspectWrapperSpecificInfo(info);<NEW_LINE>// Display generic information.<NEW_LINE>info.append("Wrapper State: ", state.name());<NEW_LINE>info.append("Parent wrapper:", parentWrapper);<NEW_LINE>info.append("Child wrapper:");<NEW_LINE>info.indent(childWrapper);<NEW_LINE>if (childWrappers != null) {<NEW_LINE>try {<NEW_LINE>info.append(<MASK><NEW_LINE>info.append("Child wrappers:");<NEW_LINE>for (int i = 0; i < childWrappers.size(); i++) {<NEW_LINE>info.indent(childWrappers.get(i));<NEW_LINE>}<NEW_LINE>} catch (Throwable th) {<NEW_LINE>// No FFDC code needed; closed on another thread; ignore.<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// end if<NEW_LINE>info.eoln();<NEW_LINE>} | "# of Child Wrappers " + childWrappers.size()); |
1,843,037 | private CompositeRelatedRecords retrieveRelatedRecords(@NonNull final Collection<BPartnerId> bPartnerIds) {<NEW_LINE>final List<TableRecordReference> <MASK><NEW_LINE>bPartnerIds.forEach(bPartnerId -> allTableRecordRefs.add(TableRecordReference.of(I_C_BPartner.Table_Name, bPartnerId.getRepoId())));<NEW_LINE>final ImmutableListMultimap<BPartnerId, I_AD_User> bpartnerId2Users = retrieveBPartnerContactRecords(bPartnerIds);<NEW_LINE>bpartnerId2Users.forEach((bpartnerId, contactRecord) -> allTableRecordRefs.add(TableRecordReference.of(contactRecord)));<NEW_LINE>final ImmutableListMultimap<BPartnerId, I_C_BPartner_Location> bpartnerLocationRecords = retrieveBPartnerLocationRecords(bPartnerIds);<NEW_LINE>bpartnerLocationRecords.forEach((bpartnerId, bPartnerLocationRecord) -> allTableRecordRefs.add(TableRecordReference.of(bPartnerLocationRecord)));<NEW_LINE>final ImmutableMap<LocationId, I_C_Location> locationRecords = retrieveLocationRecords(bpartnerLocationRecords.values());<NEW_LINE>locationRecords.forEach((locationId, locationRecord) -> allTableRecordRefs.add(TableRecordReference.of(locationRecord)));<NEW_LINE>final ImmutableMap<PostalId, I_C_Postal> postalRecords = retrievePostals(locationRecords.values());<NEW_LINE>postalRecords.forEach((postalId, postalRecord) -> allTableRecordRefs.add(TableRecordReference.of(postalRecord)));<NEW_LINE>final ImmutableSet<CountryId> countryIds = extractCountryIds(locationRecords.values());<NEW_LINE>countryIds.forEach(countryId -> allTableRecordRefs.add(TableRecordReference.of(I_C_Country.Table_Name, countryId)));<NEW_LINE>final ImmutableListMultimap<BPartnerId, I_C_BP_BankAccount> bpBankAccounts = bpBankAccountDAO.getAllByBPartnerIds(bPartnerIds);<NEW_LINE>final LogEntriesQuery logEntriesQuery = LogEntriesQuery.builder().tableRecordReferences(allTableRecordRefs).followLocationIdChanges(true).build();<NEW_LINE>final ImmutableListMultimap<TableRecordReference, RecordChangeLogEntry> //<NEW_LINE>recordRef2LogEntries = recordChangeLogRepository.getLogEntriesForRecordReferences(logEntriesQuery);<NEW_LINE>return CompositeRelatedRecords.builder().bpartnerId2Users(bpartnerId2Users).bpartnerId2BPartnerLocations(bpartnerLocationRecords).locationId2Location(locationRecords).postalId2Postal(postalRecords).bpartnerId2BankAccounts(bpBankAccounts).recordRef2LogEntries(recordRef2LogEntries).build();<NEW_LINE>} | allTableRecordRefs = new ArrayList<>(); |
823,280 | public void run(CommandLine theCommandLine) throws ParseException {<NEW_LINE>parseFhirContext(theCommandLine);<NEW_LINE>FhirContext ctx = getFhirContext();<NEW_LINE>String targetServer = theCommandLine.getOptionValue("t");<NEW_LINE>if (isBlank(targetServer)) {<NEW_LINE>throw new ParseException(Msg.code(1609) + "No target server (-t) specified");<NEW_LINE>} else if (!targetServer.startsWith("http") && !targetServer.startsWith("file")) {<NEW_LINE>throw new ParseException(Msg.code(1610) + "Invalid target server specified, must begin with 'http' or 'file'");<NEW_LINE>}<NEW_LINE>Integer limit = null;<NEW_LINE>String <MASK><NEW_LINE>if (isNotBlank(limitString)) {<NEW_LINE>try {<NEW_LINE>limit = Integer.parseInt(limitString);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new ParseException(Msg.code(1611) + "Invalid number for limit (-l) option, must be a number: " + limitString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String specUrl;<NEW_LINE>switch(ctx.getVersion().getVersion()) {<NEW_LINE>case DSTU2:<NEW_LINE>specUrl = "http://hl7.org/fhir/dstu2/examples-json.zip";<NEW_LINE>break;<NEW_LINE>case DSTU3:<NEW_LINE>specUrl = "http://hl7.org/fhir/STU3/examples-json.zip";<NEW_LINE>break;<NEW_LINE>case R4:<NEW_LINE>specUrl = "http://build.fhir.org/examples-json.zip";<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new ParseException(Msg.code(1612) + "Invalid spec version for this command: " + ctx.getVersion().getVersion());<NEW_LINE>}<NEW_LINE>String filepath = theCommandLine.getOptionValue('d');<NEW_LINE>boolean cacheFile = theCommandLine.hasOption('c');<NEW_LINE>Collection<File> inputFiles;<NEW_LINE>try {<NEW_LINE>inputFiles = loadFile(specUrl, filepath, cacheFile);<NEW_LINE>for (File inputFile : inputFiles) {<NEW_LINE>IBaseBundle bundle = getBundleFromFile(limit, inputFile, ctx);<NEW_LINE>processBundle(ctx, bundle);<NEW_LINE>sendBundleToTarget(targetServer, ctx, bundle, theCommandLine);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new CommandFailureException(Msg.code(1613) + e);<NEW_LINE>}<NEW_LINE>} | limitString = theCommandLine.getOptionValue('l'); |
369,883 | public com.amazonaws.services.codecommit.model.InvalidBlobIdException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.codecommit.model.InvalidBlobIdException invalidBlobIdException = new com.amazonaws.services.codecommit.model.InvalidBlobIdException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 invalidBlobIdException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,406,397 | public PagePosition handleMouseClick(int x, int y, int width, int height, PagePosition current, int index, int mouseX, int mouseY) {<NEW_LINE>if (current.pixel + PIXEL_HEIGHT > height) {<NEW_LINE>current = current.newPage();<NEW_LINE>}<NEW_LINE>x += OFFSET.x;<NEW_LINE>y += OFFSET.y + current.pixel;<NEW_LINE>if (current.page == index) {<NEW_LINE>testClickItemStack(input.get(), x + (int) IN_POS.x, y + (int) IN_POS.y);<NEW_LINE>testClickItemStack(output.get(), x + (int) OUT_POS.x, y + (int) OUT_POS.y);<NEW_LINE>testClickItemStack(furnace, x + (int) FURNACE_POS.x, y + (int) FURNACE_POS.y);<NEW_LINE>}<NEW_LINE>current = <MASK><NEW_LINE>return current;<NEW_LINE>} | current.nextLine(PIXEL_HEIGHT, height); |
1,377,486 | public static void main(String[] args) {<NEW_LINE>String calibDir = UtilIO.pathExample("calibration/stereo/Bumblebee2_Chess/");<NEW_LINE>String imageDir = UtilIO.pathExample("stereo/");<NEW_LINE>StereoParameters param = CalibrationIO.load(<MASK><NEW_LINE>// load and convert images into a BoofCV format<NEW_LINE>BufferedImage origLeft = UtilImageIO.loadImage(imageDir, "chair01_left.jpg");<NEW_LINE>BufferedImage origRight = UtilImageIO.loadImage(imageDir, "chair01_right.jpg");<NEW_LINE>GrayU8 distLeft = ConvertBufferedImage.convertFrom(origLeft, (GrayU8) null);<NEW_LINE>GrayU8 distRight = ConvertBufferedImage.convertFrom(origRight, (GrayU8) null);<NEW_LINE>// rectify images<NEW_LINE>GrayU8 rectLeft = distLeft.createSameShape();<NEW_LINE>GrayU8 rectRight = distRight.createSameShape();<NEW_LINE>rectify(distLeft, distRight, param, rectLeft, rectRight);<NEW_LINE>// compute disparity<NEW_LINE>int disparityRange = 60;<NEW_LINE>GrayU8 disparity = denseDisparity(rectLeft, rectRight, 5, 10, disparityRange);<NEW_LINE>// GrayF32 disparity = denseDisparitySubpixel(rectLeft, rectRight, 5, 10, disparityRange);<NEW_LINE>// show results<NEW_LINE>BufferedImage visualized = VisualizeImageData.disparity(disparity, null, disparityRange, 0);<NEW_LINE>var gui = new ListDisplayPanel();<NEW_LINE>gui.addImage(rectLeft, "Rectified");<NEW_LINE>gui.addImage(visualized, "Disparity");<NEW_LINE>ShowImages.showWindow(gui, "Stereo Disparity", true);<NEW_LINE>} | new File(calibDir, "stereo.yaml")); |
1,153,966 | private int findHeaderEndTag(int index) {<NEW_LINE>int currentIdx = index;<NEW_LINE>int depth = 0;<NEW_LINE>while (currentIdx < buffer.length()) {<NEW_LINE>byte currentByte = buffer.get(currentIdx);<NEW_LINE>if (currentByte == (byte) '<') {<NEW_LINE>boolean isEndTag = (currentIdx + 1) < buffer.length() && buffer.get(currentIdx + 1) == '/';<NEW_LINE>if (isEndTag && depth > 0) {<NEW_LINE>// Found an end tag corresponding to some header element within soap:Header<NEW_LINE>depth--;<NEW_LINE>currentIdx = <MASK><NEW_LINE>if (currentIdx == -1) {<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>} else if (isEndTag && depth == 0) {<NEW_LINE>// Found it! Probably.<NEW_LINE>int end = findFrom('>', currentIdx + 1);<NEW_LINE>return end;<NEW_LINE>} else {<NEW_LINE>// Found a start tag corresponding to a child element of soap:Header<NEW_LINE>depth++;<NEW_LINE>currentIdx = findFrom('>', currentIdx + 1);<NEW_LINE>if (currentIdx == -1) {<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>currentIdx++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return -1;<NEW_LINE>} | findFrom('>', currentIdx + 1); |
1,410,501 | private JSONObject makeUtorrentRequest(Log log, String addToUrl, int retried) throws DaemonException {<NEW_LINE>try {<NEW_LINE>// Initialise the HTTP client<NEW_LINE>initialise();<NEW_LINE>ensureToken(retried > 0);<NEW_LINE>// Make request<NEW_LINE>HttpGet httpget = new HttpGet(buildWebUIUrl() + "?token=" + authtoken + addToUrl);<NEW_LINE>HttpResponse response = httpclient.execute(httpget);<NEW_LINE>// Read JSON response<NEW_LINE>InputStream instream = response.getEntity().getContent();<NEW_LINE>String result = HttpHelper.convertStreamToString(instream);<NEW_LINE>if ((result.equals("") || result.trim().equals("invalid request"))) {<NEW_LINE>// Auth token was invalidated; retry at max 3 times<NEW_LINE>if (retried < 2) {<NEW_LINE>return makeUtorrentRequest(log, addToUrl, ++retried);<NEW_LINE>}<NEW_LINE>throw new DaemonException(ExceptionType.AuthenticationFailure, "Response was '" + result.replace("\n", "") + "' instead of a proper JSON object (and we used auth token '" + authtoken + "')");<NEW_LINE>}<NEW_LINE>JSONObject json = new JSONObject(result);<NEW_LINE>instream.close();<NEW_LINE>return json;<NEW_LINE>} catch (DaemonException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (JSONException e) {<NEW_LINE>log.d(LOG_NAME, "Error: " + e.toString());<NEW_LINE>throw new DaemonException(ExceptionType.ParsingFailed, e.toString());<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.d(LOG_NAME, <MASK><NEW_LINE>throw new DaemonException(ExceptionType.ConnectionError, e.toString());<NEW_LINE>}<NEW_LINE>} | "Error: " + e.toString()); |
1,634,063 | public DescribeClientAuthenticationSettingsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeClientAuthenticationSettingsResult describeClientAuthenticationSettingsResult = new DescribeClientAuthenticationSettingsResult();<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 describeClientAuthenticationSettingsResult;<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("ClientAuthenticationSettingsInfo", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeClientAuthenticationSettingsResult.setClientAuthenticationSettingsInfo(new ListUnmarshaller<ClientAuthenticationSettingInfo>(ClientAuthenticationSettingInfoJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeClientAuthenticationSettingsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return describeClientAuthenticationSettingsResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,667,079 | private void acceptCommand(final TypedRecord<JobRecord> command, final CommandControl<JobRecord> commandControl, final Consumer<SideEffectProducer> sideEffect) {<NEW_LINE>final long key = command.getKey();<NEW_LINE>final JobRecord <MASK><NEW_LINE>final var retries = command.getValue().getRetries();<NEW_LINE>final var retryBackOff = command.getValue().getRetryBackoff();<NEW_LINE>failedJob.setRetries(retries);<NEW_LINE>failedJob.setErrorMessage(command.getValue().getErrorMessageBuffer());<NEW_LINE>failedJob.setRetryBackoff(retryBackOff);<NEW_LINE>if (retries > 0 && retryBackOff > 0) {<NEW_LINE>final long receivedTime = command.getTimestamp();<NEW_LINE>failedJob.setRecurringTime(receivedTime + retryBackOff);<NEW_LINE>sideEffect.accept(() -> {<NEW_LINE>jobBackoffChecker.scheduleBackOff(retryBackOff + receivedTime);<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>commandControl.accept(JobIntent.FAILED, failedJob);<NEW_LINE>jobMetrics.jobFailed(failedJob.getType());<NEW_LINE>} | failedJob = jobState.getJob(key); |
1,069,380 | private static ImageData parseBufferedImage(BufferedImage image, boolean cape) {<NEW_LINE>// Capes need to be 64x32 on bedrock, unlike java where they can be HD<NEW_LINE>if (cape) {<NEW_LINE>BufferedImage imgNew = new BufferedImage(64, 32, BufferedImage.TYPE_INT_RGB);<NEW_LINE>Graphics2D g = imgNew.createGraphics();<NEW_LINE>g.setRenderingHint(<MASK><NEW_LINE>int scale = 1;<NEW_LINE>while (image.getWidth() / scale > 64 && image.getHeight() / scale > 32) {<NEW_LINE>scale++;<NEW_LINE>}<NEW_LINE>g.drawImage(image, 0, 0, image.getWidth() / scale, image.getHeight() / scale, null);<NEW_LINE>g.dispose();<NEW_LINE>image = imgNew;<NEW_LINE>}<NEW_LINE>FastByteArrayOutputStream out = new FastByteArrayOutputStream((image.getWidth() * image.getHeight()) * 4);<NEW_LINE>for (int y = 0; y < image.getHeight(); ++y) {<NEW_LINE>for (int x = 0; x < image.getWidth(); ++x) {<NEW_LINE>Color color = new Color(image.getRGB(x, y), true);<NEW_LINE>out.write(color.getRed());<NEW_LINE>out.write(color.getGreen());<NEW_LINE>out.write(color.getBlue());<NEW_LINE>out.write(color.getAlpha());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>image.flush();<NEW_LINE>return ImageData.of(image.getWidth(), image.getHeight(), out.array);<NEW_LINE>} | RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); |
482,687 | private int processLambdaQuery(GenericLexer lexer, ExpressionParserListener listener, int argStackDepth) throws SqlException {<NEW_LINE>// It is highly likely this expression parser will be re-entered when<NEW_LINE>// parsing sub-query. To prevent sub-query consuming operation stack we must add a<NEW_LINE>// control node, which would prevent such consumption<NEW_LINE>// precedence must be max value to make sure control node isn't<NEW_LINE>// consumed as parameter to a greedy function<NEW_LINE>opStack.push(expressionNodePool.next().of(ExpressionNode.CONTROL, "|", Integer.MAX_VALUE, lexer.lastTokenPosition()));<NEW_LINE>final int paramCountStackSize = copyToBackup(paramCountStack, backupParamCountStack);<NEW_LINE>final int argStackDepthStackSize = copyToBackup(argStackDepthStack, backupArgStackDepthStack);<NEW_LINE>final int castBraceCountStackSize = copyToBackup(castBraceCountStack, backupCastBraceCountStack);<NEW_LINE>final int caseBraceCountStackSize = copyToBackup(caseBraceCountStack, backupCaseBraceCountStack);<NEW_LINE>int pos = lexer.lastTokenPosition();<NEW_LINE>// allow sub-query to parse "select" keyword<NEW_LINE>lexer.unparse();<NEW_LINE>ExpressionNode node = expressionNodePool.next().of(ExpressionNode.QUERY, null, 0, pos);<NEW_LINE>// validate is Query is allowed<NEW_LINE>onNode(listener, node, argStackDepth);<NEW_LINE>// we can compile query if all is well<NEW_LINE>node.queryModel = sqlParser.parseAsSubQuery(lexer, null);<NEW_LINE>argStackDepth = onNode(listener, node, argStackDepth);<NEW_LINE>// pop our control node if sub-query hasn't done it<NEW_LINE>ExpressionNode control = opStack.peek();<NEW_LINE>if (control != null && control.type == ExpressionNode.CONTROL && Chars.equals(control.token, '|')) {<NEW_LINE>opStack.pop();<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>backupArgStackDepthStack.copyTo(argStackDepthStack, argStackDepthStackSize);<NEW_LINE>backupCastBraceCountStack.copyTo(castBraceCountStack, castBraceCountStackSize);<NEW_LINE>backupCaseBraceCountStack.copyTo(caseBraceCountStack, caseBraceCountStackSize);<NEW_LINE>// re-introduce closing brace to this loop<NEW_LINE>lexer.unparse();<NEW_LINE>return argStackDepth;<NEW_LINE>} | backupParamCountStack.copyTo(paramCountStack, paramCountStackSize); |
221,163 | public static DescribeDcdnTopDomainsByFlowResponse unmarshall(DescribeDcdnTopDomainsByFlowResponse describeDcdnTopDomainsByFlowResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDcdnTopDomainsByFlowResponse.setRequestId(_ctx.stringValue("DescribeDcdnTopDomainsByFlowResponse.RequestId"));<NEW_LINE>describeDcdnTopDomainsByFlowResponse.setStartTime(_ctx.stringValue("DescribeDcdnTopDomainsByFlowResponse.StartTime"));<NEW_LINE>describeDcdnTopDomainsByFlowResponse.setEndTime(_ctx.stringValue("DescribeDcdnTopDomainsByFlowResponse.EndTime"));<NEW_LINE>describeDcdnTopDomainsByFlowResponse.setDomainCount(_ctx.longValue("DescribeDcdnTopDomainsByFlowResponse.DomainCount"));<NEW_LINE>describeDcdnTopDomainsByFlowResponse.setDomainOnlineCount(_ctx.longValue("DescribeDcdnTopDomainsByFlowResponse.DomainOnlineCount"));<NEW_LINE>List<TopDomain> topDomains = new ArrayList<TopDomain>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains.Length"); i++) {<NEW_LINE>TopDomain topDomain = new TopDomain();<NEW_LINE>topDomain.setDomainName(_ctx.stringValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].DomainName"));<NEW_LINE>topDomain.setRank(_ctx.longValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].Rank"));<NEW_LINE>topDomain.setTotalTraffic(_ctx.stringValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].TotalTraffic"));<NEW_LINE>topDomain.setTrafficPercent(_ctx.stringValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].TrafficPercent"));<NEW_LINE>topDomain.setMaxBps(_ctx.longValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].MaxBps"));<NEW_LINE>topDomain.setMaxBpsTime(_ctx.stringValue<MASK><NEW_LINE>topDomain.setTotalAccess(_ctx.longValue("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].TotalAccess"));<NEW_LINE>topDomains.add(topDomain);<NEW_LINE>}<NEW_LINE>describeDcdnTopDomainsByFlowResponse.setTopDomains(topDomains);<NEW_LINE>return describeDcdnTopDomainsByFlowResponse;<NEW_LINE>} | ("DescribeDcdnTopDomainsByFlowResponse.TopDomains[" + i + "].MaxBpsTime")); |
632,361 | private static void addQuad(Matrix4f matrixPos, Matrix3f matrixNormal, IVertexBuilder renderBuffer, Vector3f blpos, Vector3f brpos, Vector3f trpos, Vector3f tlpos, Vector2f blUVpos, Vector2f brUVpos, Vector2f trUVpos, Vector2f tlUVpos, Vector3f normalVector, Color color, int lightmapValue) {<NEW_LINE>addQuadVertex(matrixPos, matrixNormal, renderBuffer, blpos, blUVpos, normalVector, color, lightmapValue);<NEW_LINE>addQuadVertex(matrixPos, matrixNormal, renderBuffer, brpos, brUVpos, normalVector, color, lightmapValue);<NEW_LINE>addQuadVertex(matrixPos, matrixNormal, renderBuffer, trpos, <MASK><NEW_LINE>addQuadVertex(matrixPos, matrixNormal, renderBuffer, tlpos, tlUVpos, normalVector, color, lightmapValue);<NEW_LINE>} | trUVpos, normalVector, color, lightmapValue); |
1,834,045 | public <T> List<Pair<String, T>> fetchTop(int size, Type type) throws FailStoreException {<NEW_LINE>Snapshot snapshot = db.getSnapshot();<NEW_LINE>DBIterator iterator = null;<NEW_LINE>try {<NEW_LINE>List<Pair<String, T>> list = new ArrayList<Pair<<MASK><NEW_LINE>ReadOptions options = new ReadOptions();<NEW_LINE>options.snapshot(snapshot);<NEW_LINE>iterator = db.iterator(options);<NEW_LINE>for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) {<NEW_LINE>Map.Entry<byte[], byte[]> entry = iterator.peekNext();<NEW_LINE>String key = new String(entry.getKey(), "UTF-8");<NEW_LINE>T value = JSON.parse(new String(entry.getValue(), "UTF-8"), type);<NEW_LINE>Pair<String, T> pair = new Pair<String, T>(key, value);<NEW_LINE>list.add(pair);<NEW_LINE>if (list.size() >= size) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new FailStoreException(e);<NEW_LINE>} finally {<NEW_LINE>if (iterator != null) {<NEW_LINE>try {<NEW_LINE>iterator.close();<NEW_LINE>} catch (IOException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>snapshot.close();<NEW_LINE>} catch (IOException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String, T>>(size); |
1,183,602 | protected JTable initializeTable() {<NEW_LINE>// // Motor selection table.<NEW_LINE>configurationTableModel = new FlightConfigurableTableModel<MotorMount>(MotorMount.class, rocket) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected boolean includeComponent(MotorMount component) {<NEW_LINE>return component.isMotorMount();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void componentChanged(ComponentChangeEvent cce) {<NEW_LINE>super.componentChanged(cce);<NEW_LINE>// This will catch a name change to cause a change in the header of the table<NEW_LINE>if ((cce.getSource() instanceof BodyTube || cce.getSource() instanceof InnerTube) && cce.isNonFunctionalChange()) {<NEW_LINE>fireTableStructureChanged();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// Listen to changes to the table so we can disable the help text when a<NEW_LINE>// motor mount is added through the edit body tube dialog.<NEW_LINE>configurationTableModel.addTableModelListener(new TableModelListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void tableChanged(TableModelEvent tme) {<NEW_LINE>MotorConfigurationPanel.this.updateButtonState();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JTable configurationTable = new JTable(configurationTableModel);<NEW_LINE>configurationTable.getTableHeader().setReorderingAllowed(false);<NEW_LINE>configurationTable.setCellSelectionEnabled(true);<NEW_LINE>configurationTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);<NEW_LINE>configurationTable.setDefaultRenderer(Object.class, new MotorTableCellRenderer());<NEW_LINE>configurationTable.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseClicked(MouseEvent e) {<NEW_LINE>updateButtonState();<NEW_LINE><MASK><NEW_LINE>if (e.getClickCount() == 2) {<NEW_LINE>if (selectedColumn > 0) {<NEW_LINE>selectMotor();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return configurationTable;<NEW_LINE>} | int selectedColumn = table.getSelectedColumn(); |
1,204,577 | protected ObjectNode.Builder createNodeBuilder() {<NEW_LINE>ObjectNode.<MASK><NEW_LINE>if (!schemas.isEmpty()) {<NEW_LINE>builder.withMember("schemas", schemas.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!responses.isEmpty()) {<NEW_LINE>builder.withMember("responses", responses.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!parameters.isEmpty()) {<NEW_LINE>builder.withMember("parameters", parameters.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!requestBodies.isEmpty()) {<NEW_LINE>builder.withMember("requestBodies", requestBodies.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!headers.isEmpty()) {<NEW_LINE>builder.withMember("headers", headers.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!securitySchemes.isEmpty()) {<NEW_LINE>builder.withMember("securitySchemes", securitySchemes.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!links.isEmpty()) {<NEW_LINE>builder.withMember("links", links.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>if (!callbacks.isEmpty()) {<NEW_LINE>builder.withMember("callbacks", callbacks.entrySet().stream().collect(ObjectNode.collectStringKeys(Map.Entry::getKey, Map.Entry::getValue)));<NEW_LINE>}<NEW_LINE>return builder;<NEW_LINE>} | Builder builder = Node.objectNodeBuilder(); |
614,435 | private String formatNode(DependencyNode node) {<NEW_LINE>StringBuilder buffer = new StringBuilder(128);<NEW_LINE><MASK><NEW_LINE>Dependency d = node.getDependency();<NEW_LINE>buffer.append(a);<NEW_LINE>if (d != null && d.getScope().length() > 0) {<NEW_LINE>buffer.append(" [").append(d.getScope());<NEW_LINE>if (d.isOptional()) {<NEW_LINE>buffer.append(", optional");<NEW_LINE>}<NEW_LINE>buffer.append("]");<NEW_LINE>}<NEW_LINE>{<NEW_LINE>String premanaged = DependencyManagerUtils.getPremanagedVersion(node);<NEW_LINE>if (premanaged != null && !premanaged.equals(a.getBaseVersion())) {<NEW_LINE>buffer.append(" (version managed from ").append(premanaged).append(")");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>{<NEW_LINE>String premanaged = DependencyManagerUtils.getPremanagedScope(node);<NEW_LINE>if (premanaged != null && !premanaged.equals(d.getScope())) {<NEW_LINE>buffer.append(" (scope managed from ").append(premanaged).append(")");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DependencyNode winner = (DependencyNode) node.getData().get(ConflictResolver.NODE_DATA_WINNER);<NEW_LINE>if (winner != null && !ArtifactIdUtils.equalsId(a, winner.getArtifact())) {<NEW_LINE>Artifact w = winner.getArtifact();<NEW_LINE>buffer.append(" (conflicts with ");<NEW_LINE>if (ArtifactIdUtils.toVersionlessId(a).equals(ArtifactIdUtils.toVersionlessId(w))) {<NEW_LINE>buffer.append(w.getVersion());<NEW_LINE>} else {<NEW_LINE>buffer.append(w);<NEW_LINE>}<NEW_LINE>buffer.append(")");<NEW_LINE>}<NEW_LINE>return buffer.toString();<NEW_LINE>} | Artifact a = node.getArtifact(); |
624,289 | protected void fixValue(DataElement element, Object fixed) {<NEW_LINE>assert (_options.getCoercionMode() != CoercionMode.OFF);<NEW_LINE>_hasFix = true;<NEW_LINE>DataElement parentElement = element.getParent();<NEW_LINE>if (parentElement == null) {<NEW_LINE>_fixed = fixed;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>if (parent.getClass() == DataMap.class) {<NEW_LINE>DataMap map = (DataMap) parent;<NEW_LINE>if (map.isReadOnly()) {<NEW_LINE>_hasFixupReadOnlyError = true;<NEW_LINE>addMessage(element, "cannot be fixed because DataMap backing %1$s type is read-only", parentElement.getSchema().getUnionMemberKey());<NEW_LINE>} else {<NEW_LINE>map.put((String) element.getName(), fixed);<NEW_LINE>}<NEW_LINE>} else if (parent.getClass() == DataList.class) {<NEW_LINE>DataList list = (DataList) parent;<NEW_LINE>if (list.isReadOnly()) {<NEW_LINE>_hasFixupReadOnlyError = true;<NEW_LINE>addMessage(element, "cannot be fixed because DataList backing an array type is read-only");<NEW_LINE>} else {<NEW_LINE>list.set((Integer) element.getName(), fixed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Object parent = parentElement.getValue(); |
987,534 | protected synchronized void processEvent(GdbEvent<?> evt) {<NEW_LINE>if (evt instanceof AbstractGdbCompletedCommandEvent && interruptCount > 0) {<NEW_LINE>interruptCount--;<NEW_LINE>Msg.debug(this, "Ignoring " + evt + " from -exec-interrupt. new count = " + interruptCount);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean cmdFinished = false;<NEW_LINE>if (curCmd != null) {<NEW_LINE>cmdFinished = curCmd.handle(evt);<NEW_LINE>if (cmdFinished) {<NEW_LINE>checkImpliedFocusChange();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>GdbState newState = evt.newState();<NEW_LINE>// Msg.debug(this, evt + " transitions state to " + newState);<NEW_LINE>state.set(<MASK><NEW_LINE>// NOTE: Do not check if claimed here.<NEW_LINE>// Downstream processing should check for cause<NEW_LINE>handlerMap.handle(evt, null);<NEW_LINE>if (cmdFinished) {<NEW_LINE>event(curCmd::finish, "curCmd::finish");<NEW_LINE>curCmd = null;<NEW_LINE>cmdLockHold.getAndSet(null).release();<NEW_LINE>}<NEW_LINE>} | newState, evt.getCause()); |
735,532 | public static void partialReduceIntAddCarrierValue(int[] inputArray, int[] outputArray, int gidx, int value) {<NEW_LINE>int[] localArray = (int[]) NewArrayNode.newUninitializedArray(int.class, LOCAL_WORK_GROUP_SIZE);<NEW_LINE>int localIdx = OpenCLIntrinsics.get_local_id(0);<NEW_LINE>int localGroupSize = OpenCLIntrinsics.get_local_size(0);<NEW_LINE>int <MASK><NEW_LINE>localArray[localIdx] = value;<NEW_LINE>for (int stride = (localGroupSize / 2); stride > 0; stride /= 2) {<NEW_LINE>OpenCLIntrinsics.localBarrier();<NEW_LINE>if (localIdx < stride) {<NEW_LINE>localArray[localIdx] += localArray[localIdx + stride];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OpenCLIntrinsics.globalBarrier();<NEW_LINE>if (localIdx == 0) {<NEW_LINE>outputArray[groupID + 1] = localArray[0];<NEW_LINE>}<NEW_LINE>} | groupID = OpenCLIntrinsics.get_group_id(0); |
287,545 | public void testSubList_lastIndexOf() {<NEW_LINE>List<E> list = getList();<NEW_LINE><MASK><NEW_LINE>List<E> copy = list.subList(0, size);<NEW_LINE>List<E> head = list.subList(0, size - 1);<NEW_LINE>List<E> tail = list.subList(1, size);<NEW_LINE>assertEquals(size - 1, copy.lastIndexOf(list.get(size - 1)));<NEW_LINE>assertEquals(size - 2, head.lastIndexOf(list.get(size - 2)));<NEW_LINE>assertEquals(size - 2, tail.lastIndexOf(list.get(size - 1)));<NEW_LINE>// The following assumes all elements are distinct.<NEW_LINE>assertEquals(0, copy.lastIndexOf(list.get(0)));<NEW_LINE>assertEquals(0, head.lastIndexOf(list.get(0)));<NEW_LINE>assertEquals(0, tail.lastIndexOf(list.get(1)));<NEW_LINE>assertEquals(-1, head.lastIndexOf(list.get(size - 1)));<NEW_LINE>assertEquals(-1, tail.lastIndexOf(list.get(0)));<NEW_LINE>} | int size = list.size(); |
1,777,558 | public RFuture<Boolean> addAllAsync(int index, Collection<? extends V> coll) {<NEW_LINE>if (index < 0) {<NEW_LINE>throw new IndexOutOfBoundsException("index: " + index);<NEW_LINE>}<NEW_LINE>if (coll.isEmpty()) {<NEW_LINE>return RedissonPromise.newSucceededFuture(false);<NEW_LINE>}<NEW_LINE>if (index == 0) {<NEW_LINE>// prepend elements to list<NEW_LINE>List<Object> elements = new ArrayList<Object>();<NEW_LINE>encode(elements, coll);<NEW_LINE>Collections.reverse(elements);<NEW_LINE>elements.<MASK><NEW_LINE>return commandExecutor.writeAsync(getRawName(), codec, LPUSH_BOOLEAN, elements.toArray());<NEW_LINE>}<NEW_LINE>List<Object> args = new ArrayList<Object>(coll.size() + 1);<NEW_LINE>args.add(index);<NEW_LINE>encode(args, coll);<NEW_LINE>return // index is the first parameter<NEW_LINE>commandExecutor.// index is the first parameter<NEW_LINE>evalWriteNoRetryAsync(// index is the first parameter<NEW_LINE>getRawName(), // index is the first parameter<NEW_LINE>codec, // index is the first parameter<NEW_LINE>RedisCommands.EVAL_BOOLEAN, "local ind = table.remove(ARGV, 1); " + "local size = redis.call('llen', KEYS[1]); " + "assert(tonumber(ind) <= size, 'index: ' .. ind .. ' but current size: ' .. size); " + "local tail = redis.call('lrange', KEYS[1], ind, -1); " + "redis.call('ltrim', KEYS[1], 0, ind - 1); " + "for i=1, #ARGV, 5000 do " + "redis.call('rpush', KEYS[1], unpack(ARGV, i, math.min(i+4999, #ARGV))); " + "end " + "if #tail > 0 then " + "for i=1, #tail, 5000 do " + "redis.call('rpush', KEYS[1], unpack(tail, i, math.min(i+4999, #tail))); " + "end " + "end;" + "return 1;", Collections.<Object>singletonList(getRawName()), args.toArray());<NEW_LINE>} | add(0, getRawName()); |
1,701,844 | private Mono<Response<CheckNameAvailabilityResponseInner>> checkNameAvailabilityLocalWithResponseAsync(String location, CheckNameAvailabilityRequest checkNameAvailability) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (location == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (checkNameAvailability == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter checkNameAvailability is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>checkNameAvailability.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.checkNameAvailabilityLocal(this.client.getEndpoint(), this.client.getSubscriptionId(), location, this.client.getApiVersion(), checkNameAvailability, accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); |
1,492,472 | public void execute() throws ZinggClientException {<NEW_LINE>try {<NEW_LINE>// read input, filter, remove self joins<NEW_LINE>Dataset<MASK><NEW_LINE>testData = testData.repartition(args.getNumPartitions(), testData.col(ColName.ID_COL));<NEW_LINE>// testData = dropDuplicates(testData);<NEW_LINE>long count = testData.count();<NEW_LINE>LOG.info("Read " + count);<NEW_LINE>Analytics.track(Metric.DATA_COUNT, count, args.getCollectMetrics());<NEW_LINE>Dataset<Row> blocked = getBlocked(testData);<NEW_LINE>LOG.info("Blocked ");<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("Num distinct hashes " + blocked.select(ColName.HASH_COL).distinct().count());<NEW_LINE>}<NEW_LINE>// LOG.warn("Num distinct hashes " + blocked.agg(functions.approx_count_distinct(ColName.HASH_COL)).count());<NEW_LINE>Dataset<Row> blocks = getBlocks(selectColsFromBlocked(blocked), testData);<NEW_LINE>// blocks.explain();<NEW_LINE>// LOG.info("Blocks " + blocks.count());<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("block size" + blocks.count());<NEW_LINE>}<NEW_LINE>// blocks.toJavaRDD().saveAsTextFile("/tmp/zblocks");<NEW_LINE>// check if all fields equal<NEW_LINE>// Dataset<Row> allEqual = DSUtil.allFieldsEqual(blocks, args);<NEW_LINE>// allEqual = allEqual.cache();<NEW_LINE>// send remaining to model<NEW_LINE>Model model = getModel();<NEW_LINE>// blocks.cache().withColumn("partition_id", functions.spark_partition_id())<NEW_LINE>// .groupBy("partition_id").agg(functions.count("z_id")).ias("zid").orderBy("partition_id").;<NEW_LINE>// .exceptAll(allEqual));<NEW_LINE>Dataset<Row> dupes = model.predict(blocks);<NEW_LINE>// allEqual = massageAllEquals(allEqual);<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("Found dupes " + dupes.count());<NEW_LINE>}<NEW_LINE>// dupes = dupes.cache();<NEW_LINE>// allEqual = allEqual.cache();<NEW_LINE>// writeOutput(blocked, dupes.union(allEqual).cache());<NEW_LINE>Dataset<Row> dupesActual = getDupesActualForGraph(dupes);<NEW_LINE>// dupesActual.explain();<NEW_LINE>// dupesActual.toJavaRDD().saveAsTextFile("/tmp/zdupes");<NEW_LINE>writeOutput(testData, dupesActual);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>e.printStackTrace();<NEW_LINE>throw new ZinggClientException(e.getMessage());<NEW_LINE>}<NEW_LINE>} | <Row> testData = getTestData(); |
1,510,239 | public void init(FilterConfig filterConfig) throws ServletException {<NEW_LINE>String authenticationProviderClassName = filterConfig.getInitParameter(AUTHENTICATION_PROVIDER_PARAM);<NEW_LINE>if (authenticationProviderClassName == null) {<NEW_LINE>throw new ServletException("Cannot instantiate authentication filter: no authentication provider set. init-param " + AUTHENTICATION_PROVIDER_PARAM + " missing");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Class<?> authenticationProviderClass = Class.forName(authenticationProviderClassName);<NEW_LINE>authenticationProvider = (AuthenticationProvider) authenticationProviderClass.newInstance();<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>throw new ServletException("Cannot instantiate authentication filter: authentication provider not found", e);<NEW_LINE>} catch (InstantiationException e) {<NEW_LINE>throw new ServletException("Cannot instantiate authentication filter: cannot instantiate authentication provider", e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new ServletException("Cannot instantiate authentication filter: constructor not accessible", e);<NEW_LINE>} catch (ClassCastException e) {<NEW_LINE>throw new ServletException("Cannot instantiate authentication filter: authentication provider does not implement interface " + AuthenticationProvider.<MASK><NEW_LINE>}<NEW_LINE>servletPathPrefix = filterConfig.getInitParameter(SERVLET_PATH_PREFIX);<NEW_LINE>} | class.getName(), e); |
977,773 | // Returns the sql for the specified query id.<NEW_LINE>@RequestMapping(path = "/sql/{query_id}", method = RequestMethod.GET)<NEW_LINE>public Object queryInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("query_id") String queryId, @RequestParam(value = IS_ALL_NODE_PARA, required = false, defaultValue = "true") boolean isAllNode) {<NEW_LINE>executeCheckPassword(request, response);<NEW_LINE>checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(), PrivPredicate.ADMIN);<NEW_LINE>Map<String, String> querySql = Maps.newHashMap();<NEW_LINE>if (isAllNode) {<NEW_LINE>String httpPath = "/rest/v2/manager/query/sql/" + queryId;<NEW_LINE>ImmutableMap<String, String> arguments = ImmutableMap.<String, String>builder().put(IS_ALL_NODE_PARA, "false").build();<NEW_LINE>List<String> dataList = requestAllFe(httpPath, arguments, request.getHeader(NodeAction.AUTHORIZATION));<NEW_LINE>if (!dataList.isEmpty()) {<NEW_LINE>try {<NEW_LINE>String sql = JsonParser.parseString(dataList.get(0)).getAsJsonObject().get("sql").getAsString();<NEW_LINE>querySql.put("sql", sql);<NEW_LINE>return ResponseEntityBuilder.ok(querySql);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("parse sql error: {}", dataList.get(0), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>List<List<String>> queries = ProfileManager.getInstance().getAllQueries().stream().filter(query -> query.get(0).equals(queryId)).<MASK><NEW_LINE>if (!queries.isEmpty()) {<NEW_LINE>querySql.put("sql", queries.get(0).get(3));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ResponseEntityBuilder.ok(querySql);<NEW_LINE>} | collect(Collectors.toList()); |
709,515 | private void fixActivityScreenOrientation(Object activityClientRecord, int screenOrientation) {<NEW_LINE>if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {<NEW_LINE>screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final Field tokenField = ShareReflectUtil.findField(activityClientRecord, "token");<NEW_LINE>final Object token = tokenField.get(activityClientRecord);<NEW_LINE>final Class<?> activityManagerNativeClazz = Class.forName("android.app.ActivityManagerNative");<NEW_LINE>final Method getDefaultMethod = ShareReflectUtil.findMethod(activityManagerNativeClazz, "getDefault");<NEW_LINE>final Object amn = getDefaultMethod.invoke(null);<NEW_LINE>final Method setRequestedOrientationMethod = ShareReflectUtil.findMethod(amn, "setRequestedOrientation", IBinder.class, int.class);<NEW_LINE>setRequestedOrientationMethod.<MASK><NEW_LINE>} catch (Throwable thr) {<NEW_LINE>ShareTinkerLog.e(TAG, "Failed to fix screen orientation.", thr);<NEW_LINE>}<NEW_LINE>} | invoke(amn, token, screenOrientation); |
609,769 | public void marshall(SecurityGroupRuleDescription securityGroupRuleDescription, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (securityGroupRuleDescription == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(securityGroupRuleDescription.getIPV4Range(), IPV4RANGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(securityGroupRuleDescription.getIPV6Range(), IPV6RANGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(securityGroupRuleDescription.getPrefixListId(), PREFIXLISTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(securityGroupRuleDescription.getProtocol(), PROTOCOL_BINDING);<NEW_LINE>protocolMarshaller.marshall(securityGroupRuleDescription.getFromPort(), FROMPORT_BINDING);<NEW_LINE>protocolMarshaller.marshall(securityGroupRuleDescription.getToPort(), TOPORT_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.