idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,788,894 | public void change(final Event e, @Nullable final Object[] delta, final ChangeMode mode) {<NEW_LINE>if (mode == ChangeMode.SET) {<NEW_LINE>assert delta != null;<NEW_LINE>final Entity[] ps = getExpr().getArray(e);<NEW_LINE>if (ps.length == 0)<NEW_LINE>return;<NEW_LINE>final Object o = delta[0];<NEW_LINE>if (o instanceof Entity) {<NEW_LINE>((Entity) o).eject();<NEW_LINE>final Entity p = CollectionUtils.getRandom(ps);<NEW_LINE>assert p != null;<NEW_LINE>p.leaveVehicle();<NEW_LINE>((Entity) o).setPassenger(p);<NEW_LINE>} else if (o instanceof EntityData) {<NEW_LINE>for (final Entity p : ps) {<NEW_LINE>final Entity v = ((EntityData<?>) o).spawn(p.getLocation());<NEW_LINE>if (v == null)<NEW_LINE>continue;<NEW_LINE>v.setPassenger(p);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>assert false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>super.<MASK><NEW_LINE>}<NEW_LINE>} | change(e, delta, mode); |
407,198 | private static DataFlowActivationResult handleDataflowActivation(ViewFactoryForgeArgs args, StreamSpecCompiled streamSpec) throws ExprValidationException {<NEW_LINE>if (!(streamSpec instanceof FilterStreamSpecCompiled)) {<NEW_LINE>throw new ExprValidationException("Dataflow operator only allows filters for event types and does not allow tables, named windows or patterns");<NEW_LINE>}<NEW_LINE>FilterStreamSpecCompiled filterStreamSpec = (FilterStreamSpecCompiled) streamSpec;<NEW_LINE>FilterSpecCompiled filterSpecCompiled = filterStreamSpec.getFilterSpecCompiled();<NEW_LINE>EventType eventType = filterSpecCompiled.getResultEventType();<NEW_LINE>String typeName = filterStreamSpec.getFilterSpecCompiled().getFilterForEventTypeName();<NEW_LINE>ViewFactoryForgeDesc viewForgeDesc = ViewFactoryForgeUtil.createForges(streamSpec.getViewSpecs(), args, eventType);<NEW_LINE>List<ViewFactoryForge> views = viewForgeDesc.getForges();<NEW_LINE><MASK><NEW_LINE>return new DataFlowActivationResult(eventType, typeName, viewableActivator, views, viewForgeDesc.getMultikeyForges(), viewForgeDesc.getSchedules());<NEW_LINE>} | ViewableActivatorDataFlowForge viewableActivator = new ViewableActivatorDataFlowForge(eventType); |
713,150 | private boolean identifiedPHD(ZipFile zip, ZipEntry entry, ArrayList<ManagedImageSource> candidates) throws IOException {<NEW_LINE>// now check to see if the file that has been located in the zip is a core file or not<NEW_LINE>InputStream stream = zip.getInputStream(entry);<NEW_LINE>if (FileSniffer.isPHDFile(stream, entry.getSize())) {<NEW_LINE>ManagedImageSource candidate = new ManagedImageSource(entry.<MASK><NEW_LINE>candidate.setArchive(managedFile);<NEW_LINE>logger.finer("Identified PHD file : " + candidate.toURI());<NEW_LINE>// now see if there is an associated meta file - this will be a corresponding javacore<NEW_LINE>String[] jcnames = getJavaCoreNameFromPHD(entry.getName());<NEW_LINE>for (String jcname : jcnames) {<NEW_LINE>if (zip.getEntry(jcname) != null) {<NEW_LINE>ManagedImageSource meta = new ManagedImageSource(jcname, ImageSourceType.META);<NEW_LINE>meta.setArchive(managedFile);<NEW_LINE>candidate.setMetadata(meta);<NEW_LINE>logger.finer("Identified associated javacore file : " + meta.toURI());<NEW_LINE>// found it so stop searching<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>candidates.add(candidate);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getName(), ImageSourceType.PHD); |
531,155 | private GeoPoint pickProximate(final GeoPoint[] points) {<NEW_LINE>if (points.length == 0) {<NEW_LINE>throw new IllegalArgumentException("No off-plane intersection points were found; can't compute traversal");<NEW_LINE>} else if (points.length == 1) {<NEW_LINE>return points[0];<NEW_LINE>} else {<NEW_LINE>final double p1dist = computeSquaredDistance<MASK><NEW_LINE>final double p2dist = computeSquaredDistance(points[1], intersectionPoint);<NEW_LINE>if (p1dist < p2dist) {<NEW_LINE>return points[0];<NEW_LINE>} else if (p2dist < p1dist) {<NEW_LINE>return points[1];<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Neither off-plane intersection point matched intersection point; intersection = " + intersectionPoint + "; offplane choice 0: " + points[0] + "; offplane choice 1: " + points[1]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (points[0], intersectionPoint); |
471,333 | public void takeSnap(final ReadableMap jsOptions, final Promise promise) {<NEW_LINE>FileSource.getInstance(mContext).activate();<NEW_LINE>mContext.runOnUiQueueThread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>final String snapshotterID = UUID.randomUUID().toString();<NEW_LINE>final MapSnapshotter snapshotter = new MapSnapshotter(mContext, getOptions(jsOptions));<NEW_LINE>mSnapshotterMap.put(snapshotterID, snapshotter);<NEW_LINE>snapshotter.start(new MapSnapshotter.SnapshotReadyCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSnapshotReady(MapSnapshot snapshot) {<NEW_LINE>Bitmap bitmap = snapshot.getBitmap();<NEW_LINE>String result = null;<NEW_LINE>if (jsOptions.getBoolean("writeToDisk")) {<NEW_LINE>result = BitmapUtils.createTempFile(mContext, bitmap);<NEW_LINE>} else {<NEW_LINE>result = BitmapUtils.createBase64(bitmap);<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>promise.reject(REACT_CLASS, "Could not generate snapshot, please check Android logs for more info.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>promise.resolve(result);<NEW_LINE>mSnapshotterMap.remove(snapshotterID);<NEW_LINE>}<NEW_LINE>}, new MapSnapshotter.ErrorHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(String error) {<NEW_LINE><MASK><NEW_LINE>mSnapshotterMap.remove(snapshotterID);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | Log.w(REACT_CLASS, error); |
828,320 | final DisassociateCustomerGatewayResult executeDisassociateCustomerGateway(DisassociateCustomerGatewayRequest disassociateCustomerGatewayRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateCustomerGatewayRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateCustomerGatewayRequest> request = null;<NEW_LINE>Response<DisassociateCustomerGatewayResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateCustomerGatewayRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateCustomerGatewayRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "NetworkManager");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateCustomerGateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateCustomerGatewayResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateCustomerGatewayResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,392,987 | public List<Expectation> buildExpectations(String specUrlOrPayload, Map<String, String> operationsAndResponses) {<NEW_LINE>OpenAPI openAPI = buildOpenAPI(specUrlOrPayload, mockServerLogger);<NEW_LINE>AtomicInteger expectationCounter = new AtomicInteger(0);<NEW_LINE>return openAPI.getPaths().values().stream().flatMap(pathItem -> pathItem.readOperations().stream()).filter(operation -> operationsAndResponses == null || operationsAndResponses.containsKey(operation.getOperationId())).map(operation -> new Expectation(openAPI(specUrlOrPayload, operation.getOperationId())).thenRespond(buildHttpResponse(openAPI, operation.getResponses(), operationsAndResponses != null ? operationsAndResponses.get(operation.getOperationId()) : null))).map(expectation -> {<NEW_LINE>int index = expectationCounter.incrementAndGet();<NEW_LINE>return expectation.withId(new UUID((long) Objects.hash(specUrlOrPayload, operationsAndResponses) * index, (long) Objects.hash(specUrlOrPayload, operationsAndResponses) * index).toString());<NEW_LINE>}).<MASK><NEW_LINE>} | collect(Collectors.toList()); |
418,959 | private static void addGroupByExpressionsToProjections(QueryPlanningInfo info) {<NEW_LINE>if (info.groupBy == null || info.groupBy.getItems() == null || info.groupBy.getItems().size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>OGroupBy <MASK><NEW_LINE>int i = 0;<NEW_LINE>for (OExpression exp : info.groupBy.getItems()) {<NEW_LINE>if (exp.isAggregate()) {<NEW_LINE>throw new OCommandExecutionException("Cannot group by an aggregate function");<NEW_LINE>}<NEW_LINE>boolean found = false;<NEW_LINE>if (info.preAggregateProjection != null) {<NEW_LINE>for (String alias : info.preAggregateProjection.getAllAliases()) {<NEW_LINE>// if it's a simple identifier and it's the same as one of the projections in the query,<NEW_LINE>// then the projection itself is used for GROUP BY without recalculating; in all the other<NEW_LINE>// cases, it is evaluated separately<NEW_LINE>if (alias.equals(exp.getDefaultAlias().getStringValue()) && exp.isBaseIdentifier()) {<NEW_LINE>found = true;<NEW_LINE>newGroupBy.getItems().add(exp);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>OProjectionItem newItem = new OProjectionItem(-1);<NEW_LINE>newItem.setExpression(exp);<NEW_LINE>OIdentifier groupByAlias = new OIdentifier("_$$$GROUP_BY_ALIAS$$$_" + (i++));<NEW_LINE>newItem.setAlias(groupByAlias);<NEW_LINE>if (info.preAggregateProjection == null) {<NEW_LINE>info.preAggregateProjection = new OProjection(-1);<NEW_LINE>}<NEW_LINE>if (info.preAggregateProjection.getItems() == null) {<NEW_LINE>info.preAggregateProjection.setItems(new ArrayList<>());<NEW_LINE>}<NEW_LINE>info.preAggregateProjection.getItems().add(newItem);<NEW_LINE>newGroupBy.getItems().add(new OExpression(groupByAlias));<NEW_LINE>}<NEW_LINE>info.groupBy = newGroupBy;<NEW_LINE>}<NEW_LINE>} | newGroupBy = new OGroupBy(-1); |
815,448 | public void showActions(com.zeroc.IceGridGUI.LiveDeployment.TreeNode node) {<NEW_LINE>boolean[] availableActions = _liveActionsForMenu.setTarget(node);<NEW_LINE>_appActionsForMenu.setTarget(null);<NEW_LINE>_newServerMenu.setEnabled(false);<NEW_LINE>_newServiceMenu.setEnabled(false);<NEW_LINE>_newTemplateMenu.setEnabled(false);<NEW_LINE>_appMenu.setEnabled(true);<NEW_LINE>_metricsViewMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW] || availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW]);<NEW_LINE>_nodeMenu.setEnabled(availableActions[com.zeroc.IceGridGUI<MASK><NEW_LINE>_registryMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]);<NEW_LINE>_signalMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGHUP]);<NEW_LINE>_serverMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]);<NEW_LINE>_serviceMenu.setEnabled(node instanceof com.zeroc.IceGridGUI.LiveDeployment.Service && (availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG] || availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE] || availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START] || availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP]));<NEW_LINE>} | .LiveDeployment.TreeNode.SHUTDOWN_NODE]); |
1,081,369 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Card aura = game.getCard(source.getFirstTarget());<NEW_LINE>if (controller == null || aura == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>TargetControlledPermanent target = new TargetControlledPermanent(FILTER);<NEW_LINE>target.setNotTarget(true);<NEW_LINE>if (controller.choose(Outcome.PutCardInPlay, target, source, game)) {<NEW_LINE>Permanent permanent = game.getPermanent(target.getFirstTarget());<NEW_LINE>if (permanent != null && !permanent.cantBeAttachedBy(aura, source, game, false)) {<NEW_LINE>game.getState().setValue("attachTo:" + aura.getId(), permanent);<NEW_LINE>controller.moveCards(aura, Zone.BATTLEFIELD, source, game);<NEW_LINE>return permanent.addAttachment(aura.getId(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | FilterControlledCreaturePermanent FILTER = new FilterControlledCreaturePermanent("Choose a creature you control"); |
894,109 | public void createPartControl(Composite parent) {<NEW_LINE>Server server = ServerManager.<MASK><NEW_LINE>this.setPartName("Connections[" + server.getName() + "]");<NEW_LINE>GridLayout layout = new GridLayout(1, true);<NEW_LINE>layout.marginHeight = 5;<NEW_LINE>layout.marginWidth = 5;<NEW_LINE>parent.setLayout(layout);<NEW_LINE>parent.setBackground(ColorUtil.getInstance().getColor(SWT.COLOR_WHITE));<NEW_LINE>parent.setBackgroundMode(SWT.INHERIT_FORCE);<NEW_LINE>canvas = new FigureCanvas(parent);<NEW_LINE>canvas.setLayoutData(new GridData(GridData.FILL_BOTH));<NEW_LINE>canvas.setScrollBarVisibility(FigureCanvas.NEVER);<NEW_LINE>canvas.addControlListener(new ControlListener() {<NEW_LINE><NEW_LINE>public void controlMoved(ControlEvent arg0) {<NEW_LINE>}<NEW_LINE><NEW_LINE>public void controlResized(ControlEvent arg0) {<NEW_LINE>Rectangle r = canvas.getClientArea();<NEW_LINE>xyGraph.setSize(r.width, r.height);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>xyGraph = new XYGraph();<NEW_LINE>xyGraph.setShowLegend(true);<NEW_LINE>xyGraph.setShowTitle(false);<NEW_LINE>canvas.setContents(xyGraph);<NEW_LINE>xyGraph.primaryXAxis.setDateEnabled(true);<NEW_LINE>xyGraph.primaryXAxis.setShowMajorGrid(true);<NEW_LINE>xyGraph.primaryYAxis.setAutoScale(true);<NEW_LINE>xyGraph.primaryYAxis.setShowMajorGrid(true);<NEW_LINE>xyGraph.primaryXAxis.setFormatPattern("HH:mm:ss");<NEW_LINE>xyGraph.primaryYAxis.setFormatPattern("#,##0");<NEW_LINE>xyGraph.primaryXAxis.setTitle("");<NEW_LINE>xyGraph.primaryYAxis.setTitle("");<NEW_LINE>CircularBufferDataProvider totalProvider = new CircularBufferDataProvider(true);<NEW_LINE>totalProvider.setBufferSize(BUFFER_SIZE);<NEW_LINE>totalProvider.setCurrentXDataArray(new double[] {});<NEW_LINE>totalProvider.setCurrentYDataArray(new double[] {});<NEW_LINE>totalTrace = new Trace("Total (SUM)", xyGraph.primaryXAxis, xyGraph.primaryYAxis, totalProvider);<NEW_LINE>totalTrace.setPointStyle(PointStyle.NONE);<NEW_LINE>totalTrace.setLineWidth(PManager.getInstance().getInt(PreferenceConstants.P_CHART_LINE_WIDTH));<NEW_LINE>totalTrace.setTraceType(TraceType.SOLID_LINE);<NEW_LINE>totalTrace.setTraceColor(ColorUtil.getInstance().getColor(SWT.COLOR_DARK_RED));<NEW_LINE>xyGraph.addTrace(totalTrace);<NEW_LINE>CircularBufferDataProvider activeProvider = new CircularBufferDataProvider(true);<NEW_LINE>activeProvider.setBufferSize(BUFFER_SIZE);<NEW_LINE>activeProvider.setCurrentXDataArray(new double[] {});<NEW_LINE>activeProvider.setCurrentYDataArray(new double[] {});<NEW_LINE>activeTrace = new Trace("Running (SUM)", xyGraph.primaryXAxis, xyGraph.primaryYAxis, activeProvider);<NEW_LINE>activeTrace.setPointStyle(PointStyle.NONE);<NEW_LINE>activeTrace.setLineWidth(PManager.getInstance().getInt(PreferenceConstants.P_CHART_LINE_WIDTH));<NEW_LINE>activeTrace.setTraceType(TraceType.SOLID_LINE);<NEW_LINE>activeTrace.setTraceColor(ColorUtil.getInstance().getColor(SWT.COLOR_DARK_GREEN));<NEW_LINE>xyGraph.addTrace(activeTrace);<NEW_LINE>ScouterUtil.addHorizontalRangeListener(xyGraph.getPlotArea(), new OpenDigestTableAction(serverId), true);<NEW_LINE>IToolBarManager man = getViewSite().getActionBars().getToolBarManager();<NEW_LINE>man.add(new OpenDbDailyConnView(serverId));<NEW_LINE>Action fixRangeAct = new Action("Pin Range", IAction.AS_CHECK_BOX) {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>fixRange = isChecked();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>fixRangeAct.setImageDescriptor(ImageUtil.getImageDescriptor(Images.pin));<NEW_LINE>man.add(fixRangeAct);<NEW_LINE>thread = new RefreshThread(this, REFRESH_INTERVAL);<NEW_LINE>thread.start();<NEW_LINE>} | getInstance().getServer(serverId); |
1,129,100 | public Avatar uploadAvatarAsMultipart(File file, String xSdsAuthToken) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'file' is set<NEW_LINE>if (file == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'file' when calling uploadAvatarAsMultipart");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/user/account/avatar";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (xSdsAuthToken != null)<NEW_LINE>localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));<NEW_LINE>if (file != null)<NEW_LINE>localVarFormParams.put("file", file);<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String <MASK><NEW_LINE>final String[] localVarContentTypes = { "multipart/form-data" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>GenericType<Avatar> localVarReturnType = new GenericType<Avatar>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
983,457 | public Response<Void> deleteByIdWithResponse(String id, Context context) {<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String factoryName = <MASK><NEW_LINE>if (factoryName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id)));<NEW_LINE>}<NEW_LINE>String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections");<NEW_LINE>if (privateEndpointConnectionName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id)));<NEW_LINE>}<NEW_LINE>return this.deleteWithResponse(resourceGroupName, factoryName, privateEndpointConnectionName, context);<NEW_LINE>} | Utils.getValueFromIdByName(id, "factories"); |
351,598 | public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {<NEW_LINE>if (evt instanceof ProtocolNegotiationEvent) {<NEW_LINE>pne = (ProtocolNegotiationEvent) evt;<NEW_LINE>} else if (evt instanceof SslHandshakeCompletionEvent) {<NEW_LINE>SslHandshakeCompletionEvent handshakeEvent = (SslHandshakeCompletionEvent) evt;<NEW_LINE>if (!handshakeEvent.isSuccess()) {<NEW_LINE>logSslEngineDetails(Level.FINE, ctx, "TLS negotiation failed for new client.", null);<NEW_LINE>ctx.fireExceptionCaught(handshakeEvent.cause());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SslHandler sslHandler = ctx.pipeline().get(SslHandler.class);<NEW_LINE>if (!sslContext.applicationProtocolNegotiator().protocols().contains(sslHandler.applicationProtocol())) {<NEW_LINE>logSslEngineDetails(Level.<MASK><NEW_LINE>ctx.fireExceptionCaught(unavailableException("Failed protocol negotiation: Unable to find compatible protocol"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ctx.pipeline().replace(ctx.name(), null, next);<NEW_LINE>fireProtocolNegotiationEvent(ctx, sslHandler.engine().getSession());<NEW_LINE>} else {<NEW_LINE>super.userEventTriggered(ctx, evt);<NEW_LINE>}<NEW_LINE>} | FINE, ctx, "TLS negotiation failed for new client.", null); |
1,623,680 | public static void HtoRt(CvMat H, CvMat R, CvMat t) {<NEW_LINE>CvMat M = M3x2.get(), S = S2x2.get(), U = U3x2.get(), V = V2x2.get();<NEW_LINE>M.put(H.get(0), H.get(1), H.get(3), H.get(4), H.get(6), H.get(7));<NEW_LINE>cvSVD(M, <MASK><NEW_LINE>double lambda = S.get(3);<NEW_LINE>t.put(H.get(2) / lambda, H.get(5) / lambda, H.get(8) / lambda);<NEW_LINE>cvMatMul(U, V, M);<NEW_LINE>R.put(M.get(0), M.get(1), M.get(2) * M.get(5) - M.get(3) * M.get(4), M.get(2), M.get(3), M.get(1) * M.get(4) - M.get(0) * M.get(5), M.get(4), M.get(5), M.get(0) * M.get(3) - M.get(1) * M.get(2));<NEW_LINE>} | S, U, V, CV_SVD_V_T); |
1,274,238 | private static JSFunctionData createFormatFunctionData(JSContext context) {<NEW_LINE>return JSFunctionData.createCallOnly(context, new JavaScriptRootNode(context.getLanguage(), null, null) {<NEW_LINE><NEW_LINE>@Child<NEW_LINE>private PropertyGetNode getBoundObjectNode = PropertyGetNode.createGetHidden(BOUND_OBJECT_KEY, context);<NEW_LINE><NEW_LINE>@Child<NEW_LINE>private ToIntlMathematicalValue <MASK><NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Object execute(VirtualFrame frame) {<NEW_LINE>Object[] arguments = frame.getArguments();<NEW_LINE>JSDynamicObject thisObj = (JSDynamicObject) getBoundObjectNode.getValue(JSArguments.getFunctionObject(arguments));<NEW_LINE>assert isJSNumberFormat(thisObj);<NEW_LINE>Object n = JSArguments.getUserArgumentCount(arguments) > 0 ? JSArguments.getUserArgument(arguments, 0) : Undefined.instance;<NEW_LINE>return formatMV(thisObj, toIntlMVValueNode.executeNumber(n));<NEW_LINE>}<NEW_LINE>}.getCallTarget(), 1, Strings.EMPTY_STRING);<NEW_LINE>} | toIntlMVValueNode = ToIntlMathematicalValue.create(false); |
664,114 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@name('create') create window MyWindow#keepall as select theString as a, intPrimitive as b from SupportBean;\n" + "on SupportBean_A delete from MyWindow where id = a;\n" + "insert into MyWindow select theString as a, intPrimitive as b from SupportBean;\n";<NEW_LINE>env.compileDeploy(epl);<NEW_LINE>// load window<NEW_LINE>for (int i = 0; i < 50000; i++) {<NEW_LINE>sendSupportBean(<MASK><NEW_LINE>}<NEW_LINE>// delete rows<NEW_LINE>env.addListener("create");<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>sendSupportBean_A(env, "S" + i);<NEW_LINE>}<NEW_LINE>long endTime = System.currentTimeMillis();<NEW_LINE>long delta = endTime - startTime;<NEW_LINE>assertTrue("Delta=" + delta, delta < 500);<NEW_LINE>// assert they are deleted<NEW_LINE>env.assertIterator("create", iterator -> assertEquals(50000 - 10000, EPAssertionUtil.iteratorCount(iterator)));<NEW_LINE>env.assertListener("create", listener -> assertEquals(10000, listener.getOldDataList().size()));<NEW_LINE>env.undeployAll();<NEW_LINE>} | env, "S" + i, i); |
143,833 | public List<Endpoint> findEndpoint(String keyword, String serviceId, int limit) throws IOException {<NEW_LINE>StringBuilder sql = new StringBuilder();<NEW_LINE>List<Object> condition = new ArrayList<>(5);<NEW_LINE>sql.append("select * from ").append(EndpointTraffic<MASK><NEW_LINE>sql.append(EndpointTraffic.SERVICE_ID).append("=?");<NEW_LINE>condition.add(serviceId);<NEW_LINE>if (!Strings.isNullOrEmpty(keyword)) {<NEW_LINE>sql.append(" and ").append(EndpointTraffic.NAME).append(" like concat('%',?,'%') ");<NEW_LINE>condition.add(keyword);<NEW_LINE>}<NEW_LINE>sql.append(" limit ").append(limit);<NEW_LINE>List<Endpoint> endpoints = new ArrayList<>();<NEW_LINE>try (Connection connection = h2Client.getConnection()) {<NEW_LINE>try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) {<NEW_LINE>while (resultSet.next()) {<NEW_LINE>Endpoint endpoint = new Endpoint();<NEW_LINE>endpoint.setId(resultSet.getString(H2TableInstaller.ID_COLUMN));<NEW_LINE>endpoint.setName(resultSet.getString(EndpointTraffic.NAME));<NEW_LINE>endpoints.add(endpoint);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>return endpoints;<NEW_LINE>} | .INDEX_NAME).append(" where "); |
826,023 | static void unloadShapeData(RandomAccessFile raf, ImageData icon) {<NEW_LINE>int bpl = (icon.width * <MASK><NEW_LINE>int pad = icon.scanlinePad;<NEW_LINE>int srcBpl = (bpl + pad - 1) / pad * pad;<NEW_LINE>int destBpl = (bpl + 3) / 4 * 4;<NEW_LINE>byte[] buf = new byte[destBpl];<NEW_LINE>int offset = (icon.height - 1) * srcBpl;<NEW_LINE>byte[] data = icon.data;<NEW_LINE>try {<NEW_LINE>for (int i = 0; i < icon.height; i++) {<NEW_LINE>System.arraycopy(data, offset, buf, 0, bpl);<NEW_LINE>raf.write(buf, 0, destBpl);<NEW_LINE>offset -= srcBpl;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>SWT.error(SWT.ERROR_IO, e);<NEW_LINE>}<NEW_LINE>} | icon.depth + 7) / 8; |
1,058,178 | private static void computePorts(Map<String, String> ip, Map<String, String> createProps, boolean useDefaultPorts) {<NEW_LINE>int portBase = 8900;<NEW_LINE>int kicker = ((new Date()).toString() + ip.get(PayaraModule.DOMAINS_FOLDER_ATTR) + ip.get(PayaraModule.DOMAIN_NAME_ATTR)).hashCode() % 40000;<NEW_LINE>kicker = kicker < 0 ? -kicker : kicker;<NEW_LINE>int httpPort;<NEW_LINE>int adminPort;<NEW_LINE>if (useDefaultPorts) {<NEW_LINE>httpPort = 8080;<NEW_LINE>adminPort = 4848;<NEW_LINE>} else {<NEW_LINE>if (ip.get(PayaraModule.HTTPPORT_ATTR) != null) {<NEW_LINE>httpPort = Integer.parseInt(ip.get(PayaraModule.HTTPPORT_ATTR));<NEW_LINE>} else {<NEW_LINE>httpPort = portBase + kicker + 80;<NEW_LINE>}<NEW_LINE>if (ip.get(PayaraModule.ADMINPORT_ATTR) != null) {<NEW_LINE>adminPort = Integer.parseInt(ip<MASK><NEW_LINE>} else {<NEW_LINE>adminPort = portBase + kicker + 48;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ip.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(httpPort));<NEW_LINE>ip.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(adminPort));<NEW_LINE>createProps.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(httpPort));<NEW_LINE>createProps.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(adminPort));<NEW_LINE>// if (!useDefaultPorts) {<NEW_LINE>// createProps.put(CreateDomain.PORTBASE, Integer.toString(portBase+kicker));<NEW_LINE>// }<NEW_LINE>} | .get(PayaraModule.ADMINPORT_ATTR)); |
790,864 | public PointSensitivityBuilder presentValueSensitivityRatesStickyModel(ResolvedSwaption swaption, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities) {<NEW_LINE>validate(swaption, ratesProvider, swaptionVolatilities);<NEW_LINE>ZonedDateTime expiryDateTime = swaption.getExpiry();<NEW_LINE>double expiry = swaptionVolatilities.relativeTime(expiryDateTime);<NEW_LINE>ResolvedSwap underlying = swaption.getUnderlying();<NEW_LINE>ResolvedSwapLeg fixedLeg = fixedLeg(underlying);<NEW_LINE>if (expiry < 0d) {<NEW_LINE>// Option has expired already<NEW_LINE>return PointSensitivityBuilder.none();<NEW_LINE>}<NEW_LINE>double forward = forwardRate(swaption, ratesProvider);<NEW_LINE>double pvbp = getSwapPricer().getLegPricer().pvbp(fixedLeg, ratesProvider);<NEW_LINE>double strike = getSwapPricer().getLegPricer().couponEquivalent(fixedLeg, ratesProvider, pvbp);<NEW_LINE>double tenor = swaptionVolatilities.tenor(fixedLeg.getStartDate(), fixedLeg.getEndDate());<NEW_LINE>double shift = swaptionVolatilities.shift(expiry, tenor);<NEW_LINE>ValueDerivatives volatilityAdj = swaptionVolatilities.volatilityAdjoint(<MASK><NEW_LINE>boolean isCall = fixedLeg.getPayReceive().isPay();<NEW_LINE>// Payer at strike is exercise when rate > strike, i.e. call on rate<NEW_LINE>// Backward sweep<NEW_LINE>PointSensitivityBuilder pvbpDr = getSwapPricer().getLegPricer().pvbpSensitivity(fixedLeg, ratesProvider);<NEW_LINE>PointSensitivityBuilder forwardDr = getSwapPricer().parRateSensitivity(underlying, ratesProvider);<NEW_LINE>double shiftedForward = forward + shift;<NEW_LINE>double shiftedStrike = strike + shift;<NEW_LINE>double price = BlackFormulaRepository.price(shiftedForward, shiftedStrike, expiry, volatilityAdj.getValue(), isCall);<NEW_LINE>double delta = BlackFormulaRepository.delta(shiftedForward, shiftedStrike, expiry, volatilityAdj.getValue(), isCall);<NEW_LINE>double vega = BlackFormulaRepository.vega(shiftedForward, shiftedStrike, expiry, volatilityAdj.getValue());<NEW_LINE>double sign = swaption.getLongShort().sign();<NEW_LINE>return pvbpDr.multipliedBy(price * sign * Math.signum(pvbp)).combinedWith(forwardDr.multipliedBy((delta + vega * volatilityAdj.getDerivative(0)) * Math.abs(pvbp) * sign));<NEW_LINE>} | expiry, tenor, strike, forward); |
1,535,393 | private void onlyCreateIndex(final CreateIndexClusterStateUpdateRequest request, final ActionListener<ClusterStateUpdateResponse> listener) {<NEW_LINE>normalizeRequestSetting(request);<NEW_LINE>clusterService.submitStateUpdateTask("create-index [" + request.index() + "], cause [" + request.cause() + "]", new AckedClusterStateUpdateTask<ClusterStateUpdateResponse>(Priority.URGENT, request, listener) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected ClusterStateUpdateResponse newResponse(boolean acknowledged) {<NEW_LINE>return new ClusterStateUpdateResponse(acknowledged);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ClusterState execute(ClusterState currentState) throws Exception {<NEW_LINE>return applyCreateIndexRequest(currentState, request, false);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(String source, Exception e) {<NEW_LINE>if (e instanceof ResourceAlreadyExistsException) {<NEW_LINE>logger.trace(() -> new ParameterizedMessage("[{}] failed to create", request.index()), e);<NEW_LINE>} else {<NEW_LINE>logger.debug(() -> new ParameterizedMessage("[{}] failed to create", request<MASK><NEW_LINE>}<NEW_LINE>super.onFailure(source, e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | .index()), e); |
1,455,385 | public static void registerSmeltings() {<NEW_LINE>for (SmeltQueue smelt : TiCQueues.getSmeltQueue()) {<NEW_LINE>// 1st because it may provide fluids for later<NEW_LINE>if (smelt.getFluidOutput() == null) {<NEW_LINE>FluidStack fluid = getFluidForItems(smelt.getOutput());<NEW_LINE>if (fluid == null) {<NEW_LINE>Log.warn("Item used in Smeltery recipe '" + toString(smelt<MASK><NEW_LINE>} else {<NEW_LINE>smelt.setFluidOutput(fluid.getFluid());<NEW_LINE>smelt.setAmount(smelt.getAmount() * fluid.amount);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (smelt.getFluidOutput() != null) {<NEW_LINE>for (ItemStack in : smelt.getInput().getItemStacks()) {<NEW_LINE>try {<NEW_LINE>TinkerRegistry.registerMelting(in, smelt.getFluidOutput(), (int) Math.max(1, Math.floor(smelt.getAmount())));<NEW_LINE>} catch (TinkerAPIException e) {<NEW_LINE>throw new RuntimeException("Error while registering melting recipe '" + toString(in) + ", " + smelt.getFluidOutput().getName() + ", " + smelt.getAmount() + "' with Tinkers", e);<NEW_LINE>}<NEW_LINE>Log.debug("Tinkers.registerMelting: " + toString(in) + ", " + smelt.getFluidOutput().getName() + ", " + smelt.getAmount());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TiCQueues.getSmeltQueue().clear();<NEW_LINE>} | .getOutput()) + "' doesn't smelt into a fluid"); |
416,730 | protected boolean isUsableAddress(NetworkInterface networkInterface, InetAddress address) {<NEW_LINE>boolean result = super.isUsableAddress(networkInterface, address);<NEW_LINE>if (result) {<NEW_LINE>// TODO: Workaround Android DNS reverse lookup issue, still a problem on ICS+?<NEW_LINE>// http://4thline.org/projects/mailinglists.html#nabble-td3011461<NEW_LINE>String hostName = address.getHostAddress();<NEW_LINE>Field field0 = null;<NEW_LINE>Object target = null;<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>field0 = InetAddress.class.getDeclaredField("holder");<NEW_LINE>field0.setAccessible(true);<NEW_LINE>target = field0.get(address);<NEW_LINE>field0 = target.getClass().getDeclaredField("hostName");<NEW_LINE>} catch (NoSuchFieldException e) {<NEW_LINE>// Let's try the non-OpenJDK variant<NEW_LINE>field0 = InetAddress.class.getDeclaredField("hostName");<NEW_LINE>target = address;<NEW_LINE>}<NEW_LINE>if (field0 != null && target != null && hostName != null) {<NEW_LINE>field0.setAccessible(true);<NEW_LINE>field0.set(target, hostName);<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>log.log(Level.<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | SEVERE, "Failed injecting hostName to work around Android InetAddress DNS bug: " + address, ex); |
905,850 | public static SQLQueryAdapter generate(MariaDBSchema s) {<NEW_LINE>ExpectedErrors errors = new ExpectedErrors();<NEW_LINE>StringBuilder sb = new StringBuilder("CREATE ");<NEW_LINE>errors.add("Key/Index cannot be defined on a virtual generated column");<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>errors.add("Duplicate entry");<NEW_LINE>errors.add("Key/Index cannot be defined on a virtual generated column");<NEW_LINE>sb.append("UNIQUE ");<NEW_LINE>}<NEW_LINE>sb.append("INDEX ");<NEW_LINE>sb.append("i");<NEW_LINE>sb.append(DBMSCommon.createColumnName(Randomly.smallNumber()));<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>sb.append(" USING ");<NEW_LINE>// , "RTREE")<NEW_LINE>sb.append(Randomly.fromOptions("BTREE", "HASH"));<NEW_LINE>}<NEW_LINE>sb.append(" ON ");<NEW_LINE>MariaDBTable randomTable = s.getRandomTable();<NEW_LINE>sb.append(randomTable.getName());<NEW_LINE>sb.append("(");<NEW_LINE>List<MariaDBColumn> columns = Randomly.<MASK><NEW_LINE>for (int i = 0; i < columns.size(); i++) {<NEW_LINE>if (i != 0) {<NEW_LINE>sb.append(", ");<NEW_LINE>}<NEW_LINE>sb.append(columns.get(i).getName());<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>sb.append(" ");<NEW_LINE>sb.append(Randomly.fromOptions("ASC", "DESC"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sb.append(")");<NEW_LINE>// if (Randomly.getBoolean()) {<NEW_LINE>// sb.append(" ALGORITHM=");<NEW_LINE>// sb.append(Randomly.fromOptions("DEFAULT", "INPLACE", "COPY", "NOCOPY", "INSTANT"));<NEW_LINE>// errors.add("is not supported for this operation");<NEW_LINE>// }<NEW_LINE>return new SQLQueryAdapter(sb.toString(), errors, true);<NEW_LINE>} | nonEmptySubset(randomTable.getColumns()); |
1,457,523 | private DegraderLoadBalancerStrategyV3 newLoadBalancer(String serviceName, Map<String, Object> strategyProperties, Map<String, String> degraderProperties, String path, String clusterName) {<NEW_LINE>debug(LOG, "created a degrader load balancer strategyV3");<NEW_LINE>Map<String, Object> strategyPropertiesCopy = new HashMap<>(strategyProperties);<NEW_LINE>// Save the service path as a property -- Quarantine may need this info to construct correct<NEW_LINE>// health checking path<NEW_LINE>strategyPropertiesCopy.put(PropertyKeys.PATH, path);<NEW_LINE>// Also save the clusterName as a property<NEW_LINE>strategyPropertiesCopy.<MASK><NEW_LINE>final DegraderLoadBalancerStrategyConfig config = DegraderLoadBalancerStrategyConfig.createHttpConfigFromMap(strategyPropertiesCopy, _healthCheckOperations, _executorService, degraderProperties, _eventEmitter);<NEW_LINE>// Adds the default degrader state listener factories<NEW_LINE>final List<PartitionDegraderLoadBalancerStateListener.Factory> listeners = new ArrayList<>();<NEW_LINE>listeners.add(new DegraderMonitorEventEmitter.Factory(serviceName));<NEW_LINE>listeners.addAll(_degraderStateListenerFactories);<NEW_LINE>return new DegraderLoadBalancerStrategyV3(config, serviceName, degraderProperties, listeners);<NEW_LINE>} | put(PropertyKeys.CLUSTER_NAME, clusterName); |
1,795,584 | public static void unbox(MethodVisitor mv, Type primitiveType) {<NEW_LINE>String wrapper;<NEW_LINE>String method;<NEW_LINE>String descriptor;<NEW_LINE>switch(primitiveType.getSort()) {<NEW_LINE>case Type.BOOLEAN:<NEW_LINE>wrapper = "java/lang/Boolean";<NEW_LINE>method = "booleanValue";<NEW_LINE>descriptor = "()Z";<NEW_LINE>break;<NEW_LINE>case Type.CHAR:<NEW_LINE>wrapper = "java/lang/Character";<NEW_LINE>method = "charValue";<NEW_LINE>descriptor = "()C";<NEW_LINE>break;<NEW_LINE>case Type.BYTE:<NEW_LINE>wrapper = "java/lang/Byte";<NEW_LINE>method = "byteValue";<NEW_LINE>descriptor = "()B";<NEW_LINE>break;<NEW_LINE>case Type.SHORT:<NEW_LINE>wrapper = "java/lang/Short";<NEW_LINE>method = "shortValue";<NEW_LINE>descriptor = "()S";<NEW_LINE>break;<NEW_LINE>case Type.INT:<NEW_LINE>wrapper = "java/lang/Integer";<NEW_LINE>method = "intValue";<NEW_LINE>descriptor = "()I";<NEW_LINE>break;<NEW_LINE>case Type.FLOAT:<NEW_LINE>wrapper = "java/lang/Float";<NEW_LINE>method = "floatValue";<NEW_LINE>descriptor = "()F";<NEW_LINE>break;<NEW_LINE>case Type.LONG:<NEW_LINE>wrapper = "java/lang/Long";<NEW_LINE>method = "longValue";<NEW_LINE>descriptor = "()J";<NEW_LINE>break;<NEW_LINE>case Type.DOUBLE:<NEW_LINE>wrapper = "java/lang/Double";<NEW_LINE>method = "doubleValue";<NEW_LINE>descriptor = "()D";<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mv.visitTypeInsn(CHECKCAST, wrapper);<NEW_LINE>mv.visitMethodInsn(INVOKEVIRTUAL, <MASK><NEW_LINE>} | wrapper, method, descriptor, false); |
694,123 | private Mono<Response<Void>> regeneratePrimaryKeyWithResponseAsync(String resourceGroupName, String serviceName, AccessIdName accessName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (serviceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (accessName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter accessName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.regeneratePrimaryKey(this.client.getEndpoint(), resourceGroupName, serviceName, this.client.getApiVersion(), this.client.getSubscriptionId(<MASK><NEW_LINE>} | ), accessName, accept, context); |
236,172 | private boolean validateUserPermisionInChildGroup(String userNo, int currentGroupId) throws SQLException {<NEW_LINE>boolean havePermison = false;<NEW_LINE>int userId = BeanGetter.getDaoOfLoginUser().getUserByNo(userNo).getId();<NEW_LINE>List<GroupRelation> relations = BeanGetter.getGroupRelationDao().getAllGroupRelationByCurrentGroupId(currentGroupId);<NEW_LINE>Iterator<GroupRelation<MASK><NEW_LINE>while (ite.hasNext()) {<NEW_LINE>GroupRelation relation = ite.next();<NEW_LINE>if (relation.getAdduser() == 1) {<NEW_LINE>// the child group can manage the<NEW_LINE>// current parent group user<NEW_LINE>// then check the user whether or not exist in this child group<NEW_LINE>List<UserGroup> ugs = BeanGetter.getDalUserGroupDao().getUserGroupByGroupIdAndUserId(relation.getChild_group_id(), userId);<NEW_LINE>if (ugs != null && ugs.size() > 0) {<NEW_LINE>havePermison = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return havePermison;<NEW_LINE>} | > ite = relations.iterator(); |
1,070,616 | private void processSymbolTables() throws Exception {<NEW_LINE>monitor.setMessage("Processing symbol tables...");<NEW_LINE>List<SymbolTableCommand> commands = machoHeader.getLoadCommands(SymbolTableCommand.class);<NEW_LINE>for (SymbolTableCommand symbolTableCommand : commands) {<NEW_LINE>List<NList> symbols = symbolTableCommand.getSymbols();<NEW_LINE>for (NList symbol : symbols) {<NEW_LINE>if (monitor.isCancelled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (symbol.isTypePreboundUndefined()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (symbol.isLazyBind()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Address addr = space.getAddress(symbol.getValue());<NEW_LINE>if (symbol.isSymbolicDebugging()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (symbol.isTypeAbsolute()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (symbol.isTypeUndefined()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// is a re-exported symbol, will be added as an external later<NEW_LINE>if (symbol.isIndirect()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (symbol.isExternal() || symbol.isPrivateExternal()) {<NEW_LINE>program.getSymbolTable().addExternalEntryPoint(addr);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (string.length() == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>string = SymbolUtilities.replaceInvalidChars(string, true);<NEW_LINE>if (symbol.isThumbSymbol()) {<NEW_LINE>markAsThumb(addr);<NEW_LINE>}<NEW_LINE>if (program.getSymbolTable().getGlobalSymbol(string, addr) != null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>program.getSymbolTable().createLabel(addr, string, SourceType.IMPORTED);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.appendMsg("Unable to create symbol: " + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String string = symbol.getString(); |
1,228,572 | private static InetSocketAddress tryParseIpV4(final String str, final String uriParamName, final boolean isReResolution, final NameResolver nameResolver) {<NEW_LINE>IpV4State state = IpV4State.HOST;<NEW_LINE>int separatorIndex = -1;<NEW_LINE>final <MASK><NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>final char c = str.charAt(i);<NEW_LINE>switch(state) {<NEW_LINE>case HOST:<NEW_LINE>if (':' == c) {<NEW_LINE>separatorIndex = i;<NEW_LINE>state = IpV4State.PORT;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case PORT:<NEW_LINE>if (':' == c) {<NEW_LINE>return null;<NEW_LINE>} else if (c < '0' || '9' < c) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (-1 != separatorIndex && 1 < length - separatorIndex) {<NEW_LINE>final String hostname = str.substring(0, separatorIndex);<NEW_LINE>final int portIndex = separatorIndex + 1;<NEW_LINE>final int port = AsciiEncoding.parseIntAscii(str, portIndex, length - portIndex);<NEW_LINE>final InetAddress inetAddress = nameResolver.resolve(hostname, uriParamName, isReResolution);<NEW_LINE>return null == inetAddress ? InetSocketAddress.createUnresolved(hostname, port) : new InetSocketAddress(inetAddress, port);<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("address 'port' is required for ipv4: " + str);<NEW_LINE>} | int length = str.length(); |
992,561 | private boolean matchInputMap(Item[][] input) {<NEW_LINE>Map<Integer, Map<Integer, Item>> map = this.getIngredientMap();<NEW_LINE>// match the given items to the requested items<NEW_LINE>for (int y = 0, y2 = this.getHeight(); y < y2; ++y) {<NEW_LINE>for (int x = 0, x2 = this.getWidth(); x < x2; ++x) {<NEW_LINE>Item given = input[y][x];<NEW_LINE>Item required = map.get(y).get(x);<NEW_LINE>if (given == null || !required.equals(given, required.hasMeta(), required.hasCompoundTag()) || required.getCount() != given.getCount()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>input<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// check if there are any items left in the grid outside of the recipe<NEW_LINE>for (Item[] items : input) {<NEW_LINE>for (Item item : items) {<NEW_LINE>if (item != null && !item.isNull()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | [y][x] = null; |
956,207 | public Optional<BoardHistoryNode> draw(Graphics2D g, int posx, int posy, int width, int height, boolean calc) {<NEW_LINE>if (width <= 0 || height <= 0) {<NEW_LINE>// we don't have enough space<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>// Use dense tree for saving space if large-subboard<NEW_LINE>YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30);<NEW_LINE>XSPACING = YSPACING;<NEW_LINE>int strokeRadius = Lizzie.config.showBorder ? 2 : 0;<NEW_LINE>if (!calc) {<NEW_LINE>// Draw background<NEW_LINE>area.setBounds(posx, posy, width, height);<NEW_LINE>g.setColor(new Color(0, 0, 0, 60));<NEW_LINE>g.fillRect(posx, posy, width, height);<NEW_LINE>if (Lizzie.config.showBorder) {<NEW_LINE>// draw edge of panel<NEW_LINE>g.setStroke(new BasicStroke(2 * strokeRadius));<NEW_LINE>g.drawLine(posx + strokeRadius, posy + strokeRadius, posx + strokeRadius, posy - strokeRadius + height);<NEW_LINE>g.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>int middleY = posy + height / 2;<NEW_LINE>int xoffset = 30;<NEW_LINE>laneUsageList.clear();<NEW_LINE>curMove = Lizzie.board.getHistory().getCurrentHistoryNode();<NEW_LINE>// Is current move a variation? If so, find top of variation<NEW_LINE>BoardHistoryNode top = curMove.findTop();<NEW_LINE>int curposy = middleY - YSPACING * (curMove.getData().moveNumber - top.getData().moveNumber);<NEW_LINE>// Go to very top of tree (visible in assigned area)<NEW_LINE>BoardHistoryNode node = top;<NEW_LINE>while (curposy > posy + YSPACING && node.previous().isPresent()) {<NEW_LINE>node = node.previous().get();<NEW_LINE>curposy -= YSPACING;<NEW_LINE>}<NEW_LINE>int lane = getCurLane(node, curMove, curposy, posy + height, 0, true);<NEW_LINE>int startx = posx + xoffset;<NEW_LINE>if (((lane + 1) * XSPACING + xoffset + DOT_DIAM + strokeRadius - width) > 0) {<NEW_LINE>startx = startx - ((lane + 1) * XSPACING + xoffset + DOT_DIAM + strokeRadius - width);<NEW_LINE>}<NEW_LINE>return drawTree(g, startx, curposy, 0, posy + height, posx + strokeRadius, node, 0, true, calc);<NEW_LINE>} | setStroke(new BasicStroke(1)); |
909,284 | public void receive(Event event) {<NEW_LINE>if (callback != null) {<NEW_LINE>logger.trace("Received Event: Source: {} Topic: {} Type: {} Payload: {}", event.getSource(), event.getTopic(), event.getType(), event.getPayload());<NEW_LINE>Map<String, Object> values = new HashMap<>();<NEW_LINE>if (event instanceof ItemStateEvent && UPDATE_MODULE_TYPE_ID.equals(module.getTypeUID())) {<NEW_LINE>State state = ((ItemStateEvent) event).getItemState();<NEW_LINE>if ((this.state == null || this.state.equals(state.toFullString()))) {<NEW_LINE>values.put("state", state);<NEW_LINE>}<NEW_LINE>} else if (event instanceof ItemStateChangedEvent && CHANGE_MODULE_TYPE_ID.equals(module.getTypeUID())) {<NEW_LINE>State state = ((<MASK><NEW_LINE>State oldState = ((ItemStateChangedEvent) event).getOldItemState();<NEW_LINE>if (stateMatches(this.state, state) && stateMatches(this.previousState, oldState)) {<NEW_LINE>values.put("oldState", oldState);<NEW_LINE>values.put("newState", state);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!values.isEmpty()) {<NEW_LINE>values.put("event", event);<NEW_LINE>((TriggerHandlerCallback) callback).triggered(this.module, values);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ItemStateChangedEvent) event).getItemState(); |
1,764,638 | private void resolveParentDependenciesRecursively(List<Pom> pomAncestry) {<NEW_LINE>Pom pom = pomAncestry.get(0);<NEW_LINE>for (Profile profile : pom.getProfiles()) {<NEW_LINE>if (profile.isActive(activeProfiles)) {<NEW_LINE>mergeDependencyManagement(profile.getDependencyManagement(), pom);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>mergeDependencyManagement(pom.getDependencyManagement(), pom);<NEW_LINE>mergeRequestedDependencies(pom.getDependencies());<NEW_LINE>if (pom.getParent() != null) {<NEW_LINE>Pom parentPom = downloader.download(getValues(pom.getParent().getGav()), pom.getParent().getRelativePath(), ResolvedPom.this, repositories);<NEW_LINE>for (Pom ancestor : pomAncestry) {<NEW_LINE>if (ancestor.getGav().equals(parentPom.getGav())) {<NEW_LINE>// parent cycle<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>MavenExecutionContextView.view(ctx).getResolutionListener().parent(parentPom, pom);<NEW_LINE>pomAncestry.add(0, parentPom);<NEW_LINE>resolveParentDependenciesRecursively(pomAncestry);<NEW_LINE>}<NEW_LINE>} | mergeRequestedDependencies(profile.getDependencies()); |
1,769,291 | public void run() {<NEW_LINE>liveSnippets = shellSession.getSnippets(true, true);<NEW_LINE>prepareDeclarations();<NEW_LINE>createStatementsText();<NEW_LINE>prepareImports();<NEW_LINE>try {<NEW_LINE>FileObject replaced = targetFolder.getFileObject(className, "java");<NEW_LINE>if (replaced != null) {<NEW_LINE>replaced.delete();<NEW_LINE>}<NEW_LINE>javaFile = createJavaFile();<NEW_LINE>JavaSource src = JavaSource.forFileObject(javaFile);<NEW_LINE>if (src == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>src.runModificationTask(wc -> {<NEW_LINE>wc.toPhase(JavaSource.Phase.RESOLVED);<NEW_LINE>this.copy = wc;<NEW_LINE>copyImports();<NEW_LINE>}).commit();<NEW_LINE>// reformat<NEW_LINE>EditorCookie editor = javaFile.getLookup().lookup(EditorCookie.class);<NEW_LINE>Document d = editor.openDocument();<NEW_LINE>Reformat r = Reformat.get(d);<NEW_LINE>r.lock();<NEW_LINE>try {<NEW_LINE>r.reformat(0, d.getLength());<NEW_LINE>} finally {<NEW_LINE>r.unlock();<NEW_LINE>}<NEW_LINE>// not organize those imports; must run a separate task, so the<NEW_LINE>// analyzer sees the text:<NEW_LINE>src.runModificationTask(wc -> {<NEW_LINE>wc.<MASK><NEW_LINE>this.copy = wc;<NEW_LINE>SourceChangeUtils.doOrganizeImports(copy, null, true);<NEW_LINE>}).commit();<NEW_LINE>editor.saveDocument();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>error = ex;<NEW_LINE>} catch (BadLocationException ex) {<NEW_LINE>error = ex;<NEW_LINE>}<NEW_LINE>} | toPhase(JavaSource.Phase.RESOLVED); |
838,062 | private static void findNestedAnnotationsInternal(Object object, String annotationFqn, List<AnnotationMirror> result) {<NEW_LINE>Collection<? extends AnnotationValue> annotationValueCollection = null;<NEW_LINE>if (object instanceof AnnotationMirror) {<NEW_LINE>AnnotationMirror annotationMirror = (AnnotationMirror) object;<NEW_LINE>String annotationQualifiedName = getAnnotationQualifiedName(annotationMirror);<NEW_LINE>if (annotationQualifiedName.equals(annotationFqn)) {<NEW_LINE>result.add(annotationMirror);<NEW_LINE>} else {<NEW_LINE>// prepare to recurse<NEW_LINE>Map<? extends ExecutableElement, ? extends AnnotationValue<MASK><NEW_LINE>annotationValueCollection = annotationMap.values();<NEW_LINE>}<NEW_LINE>} else if (object instanceof List) {<NEW_LINE>// prepare to recurse<NEW_LINE>annotationValueCollection = (Collection<? extends AnnotationValue>) object;<NEW_LINE>}<NEW_LINE>// recurse<NEW_LINE>if (annotationValueCollection != null) {<NEW_LINE>for (AnnotationValue annotationValue : annotationValueCollection) {<NEW_LINE>Object value = annotationValue.getValue();<NEW_LINE>findNestedAnnotationsInternal(value, annotationFqn, result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > annotationMap = annotationMirror.getElementValues(); |
493,162 | private static void insideTag(DocTreePath tag, JavadocContext jdctx, int caretOffset) {<NEW_LINE>TokenSequence<JavadocTokenId> jdts = jdctx.jdts;<NEW_LINE>assert jdts.token() != null;<NEW_LINE>int start = (int) jdctx.positions.getStartPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, tag.getLeaf());<NEW_LINE>boolean isThrowsKind = JavadocCompletionUtils.normalizedKind(tag.getLeaf()) == DocTree.Kind.THROWS;<NEW_LINE>if (isThrowsKind && !(EXECUTABLE.contains(jdctx.commentFor.getKind()))) {<NEW_LINE>// illegal tag in this context<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>jdts.move(start + (JavadocCompletionUtils.isBlockTag(tag) ? 0 : 1));<NEW_LINE>// @see|@link|@throws<NEW_LINE>if (!jdts.moveNext() || caretOffset <= jdts.offset() + jdts.token().length()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// white space<NEW_LINE>if (!jdts.moveNext() || caretOffset <= jdts.offset()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean noPrefix = false;<NEW_LINE>if (caretOffset <= jdts.offset() + jdts.token().length()) {<NEW_LINE>int pos <MASK><NEW_LINE>CharSequence cs = jdts.token().text();<NEW_LINE>cs = pos < cs.length() ? cs.subSequence(0, pos) : cs;<NEW_LINE>if (JavadocCompletionUtils.isWhiteSpace(cs) || JavadocCompletionUtils.isLineBreak(jdts.token(), pos)) {<NEW_LINE>noPrefix = true;<NEW_LINE>} else {<NEW_LINE>// broken syntax<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else if (!(JavadocCompletionUtils.isWhiteSpace(jdts.token()) || JavadocCompletionUtils.isLineBreak(jdts.token()))) {<NEW_LINE>// not java reference<NEW_LINE>return;<NEW_LINE>} else if (jdts.moveNext()) {<NEW_LINE>int end = (int) jdctx.positions.getEndPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, tag.getLeaf());<NEW_LINE>insideReference(JavadocCompletionUtils.normalizedKind(tag.getLeaf()), jdts.offset(), end, jdctx, caretOffset);<NEW_LINE>}<NEW_LINE>} | = caretOffset - jdts.offset(); |
1,211,334 | public void run() {<NEW_LINE>alarm.cancelAllRequests();<NEW_LINE>String prefix = mySpeedSearch.getEnteredPrefix();<NEW_LINE>myTree.getEmptyText().setText(StringUtil.isEmpty(prefix) ? "Structure is empty" : "'" + prefix + "' not found");<NEW_LINE>if (prefix == null)<NEW_LINE>prefix = "";<NEW_LINE>if (!filter.equals(prefix)) {<NEW_LINE>boolean isBackspace = prefix.length<MASK><NEW_LINE>filter = prefix;<NEW_LINE>rebuild(true).onProcessed(ignore -> UIUtil.invokeLaterIfNeeded(() -> {<NEW_LINE>if (isDisposed())<NEW_LINE>return;<NEW_LINE>TreeUtil.promiseExpandAll(myTree);<NEW_LINE>if (isBackspace && handleBackspace(filter)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (myFilteringStructure.getRootElement().getChildren().length == 0) {<NEW_LINE>for (JBCheckBox box : myCheckBoxes.values()) {<NEW_LINE>if (!box.isSelected()) {<NEW_LINE>myAutoClicked.add(box);<NEW_LINE>myTriggeredCheckboxes.add(0, Pair.create(filter, box));<NEW_LINE>box.doClick();<NEW_LINE>filter = "";<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>}<NEW_LINE>if (!alarm.isDisposed()) {<NEW_LINE>alarm.addRequest(this, 300);<NEW_LINE>}<NEW_LINE>} | () < filter.length(); |
1,442,100 | public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) {<NEW_LINE>ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();<NEW_LINE>scenario.setId(request.getId());<NEW_LINE>scenario.setName(request.getName());<NEW_LINE>scenario.setProjectId(request.getProjectId());<NEW_LINE>scenario.setCustomNum(request.getCustomNum());<NEW_LINE>if (StringUtils.equals(request.getTags(), "[]")) {<NEW_LINE>scenario.setTags("");<NEW_LINE>} else {<NEW_LINE>scenario.setTags(request.getTags());<NEW_LINE>}<NEW_LINE>scenario.setApiScenarioModuleId(request.getApiScenarioModuleId());<NEW_LINE>scenario.<MASK><NEW_LINE>scenario.setLevel(request.getLevel());<NEW_LINE>scenario.setPrincipal(request.getPrincipal());<NEW_LINE>scenario.setStepTotal(request.getStepTotal());<NEW_LINE>scenario.setUpdateTime(System.currentTimeMillis());<NEW_LINE>scenario.setDescription(request.getDescription());<NEW_LINE>scenario.setCreateUser(SessionUtils.getUserId());<NEW_LINE>scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));<NEW_LINE>Boolean isValidEnum = EnumUtils.isValidEnum(EnvironmentType.class, request.getEnvironmentType());<NEW_LINE>if (BooleanUtils.isTrue(isValidEnum)) {<NEW_LINE>scenario.setEnvironmentType(request.getEnvironmentType());<NEW_LINE>} else {<NEW_LINE>scenario.setEnvironmentType(EnvironmentType.JSON.toString());<NEW_LINE>}<NEW_LINE>scenario.setEnvironmentJson(request.getEnvironmentJson());<NEW_LINE>scenario.setEnvironmentGroupId(request.getEnvironmentGroupId());<NEW_LINE>if (StringUtils.isNotEmpty(request.getStatus())) {<NEW_LINE>scenario.setStatus(request.getStatus());<NEW_LINE>} else {<NEW_LINE>scenario.setStatus(ScenarioStatus.Underway.name());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(request.getUserId())) {<NEW_LINE>scenario.setUserId(request.getUserId());<NEW_LINE>} else {<NEW_LINE>scenario.setUserId(SessionUtils.getUserId());<NEW_LINE>}<NEW_LINE>if (StringUtils.isEmpty(request.getApiScenarioModuleId()) || "default-module".equals(request.getApiScenarioModuleId())) {<NEW_LINE>replenishScenarioModuleIdPath(request.getProjectId(), apiScenarioModuleMapper, scenario);<NEW_LINE>}<NEW_LINE>saveFollows(scenario.getId(), request.getFollows());<NEW_LINE>if (StringUtils.isEmpty(request.getVersionId())) {<NEW_LINE>scenario.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));<NEW_LINE>} else {<NEW_LINE>scenario.setVersionId(request.getVersionId());<NEW_LINE>}<NEW_LINE>return scenario;<NEW_LINE>} | setModulePath(request.getModulePath()); |
1,661,647 | public NewColorAndFontPanel createPanel(@Nonnull ColorAndFontOptions options) {<NEW_LINE>final SchemesPanel schemesPanel = new SchemesPanel(options);<NEW_LINE>CompositeColorDescriptionPanel descriptionPanel = new CompositeColorDescriptionPanel();<NEW_LINE>descriptionPanel.addDescriptionPanel(new ColorAndFontDescriptionPanel(), it -> it instanceof ColorAndFontDescription);<NEW_LINE>descriptionPanel.addDescriptionPanel(new DiffColorDescriptionPanel(options), it -> it instanceof TextAttributesDescription);<NEW_LINE>final OptionsPanelImpl optionsPanel = new OptionsPanelImpl(options, <MASK><NEW_LINE>final DiffPreviewPanel previewPanel = new DiffPreviewPanel();<NEW_LINE>schemesPanel.addListener(new ColorAndFontSettingsListener.Abstract() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void schemeChanged(@Nonnull final Object source) {<NEW_LINE>previewPanel.setColorScheme(options.getSelectedScheme());<NEW_LINE>optionsPanel.updateOptionsList();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return new NewColorAndFontPanel(schemesPanel, optionsPanel, previewPanel, getDiffGroup(), null, null);<NEW_LINE>} | schemesPanel, getDiffGroup(), descriptionPanel); |
1,058,764 | private void shareItems(Set<Recording> selected) {<NEW_LINE>FragmentActivity activity = getActivity();<NEW_LINE>if (activity != null) {<NEW_LINE>ArrayList<Uri> uris = new ArrayList<>();<NEW_LINE>for (Recording rec : selected) {<NEW_LINE>File file = rec == SHARE_LOCATION_FILE ? generateGPXForRecordings(selected) : rec.getFile();<NEW_LINE>if (file != null) {<NEW_LINE>uris.add(AndroidUtils.getUriForFile(activity, file));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);<NEW_LINE>intent.setType("*/*");<NEW_LINE>intent.putExtra(Intent.EXTRA_STREAM, uris);<NEW_LINE><MASK><NEW_LINE>if (Build.VERSION.SDK_INT > 18) {<NEW_LINE>intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);<NEW_LINE>}<NEW_LINE>Intent chooserIntent = Intent.createChooser(intent, getString(R.string.share_note));<NEW_LINE>AndroidUtils.startActivityIfSafe(activity, intent, chooserIntent);<NEW_LINE>}<NEW_LINE>} | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
1,446,956 | public static void main(String[] args) throws IOException {<NEW_LINE>if (args.length != 4) {<NEW_LINE>logger.info("Usage: MnistConverter dataFile labelFile outFile propsFile");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DataInputStream xStream = IOUtils.getDataInputStream(args[0]);<NEW_LINE>DataInputStream yStream = IOUtils.getDataInputStream(args[1]);<NEW_LINE>PrintWriter oStream = new PrintWriter(new FileWriter(args[2]));<NEW_LINE>PrintWriter pStream = new PrintWriter(new FileWriter(args[3]));<NEW_LINE>int xMagic = xStream.readInt();<NEW_LINE>if (xMagic != 2051)<NEW_LINE>throw new RuntimeException("Bad format of xStream");<NEW_LINE><MASK><NEW_LINE>if (yMagic != 2049)<NEW_LINE>throw new RuntimeException("Bad format of yStream");<NEW_LINE>int xNumImages = xStream.readInt();<NEW_LINE>int yNumLabels = yStream.readInt();<NEW_LINE>if (xNumImages != yNumLabels)<NEW_LINE>throw new RuntimeException("x and y sizes don't match");<NEW_LINE>logger.info("Images and label file both contain " + xNumImages + " entries.");<NEW_LINE>int xRows = xStream.readInt();<NEW_LINE>int xColumns = xStream.readInt();<NEW_LINE>for (int i = 0; i < xNumImages; i++) {<NEW_LINE>int label = yStream.readUnsignedByte();<NEW_LINE>int[] matrix = new int[xRows * xColumns];<NEW_LINE>for (int j = 0; j < xRows * xColumns; j++) {<NEW_LINE>matrix[j] = xStream.readUnsignedByte();<NEW_LINE>}<NEW_LINE>oStream.print(label);<NEW_LINE>for (int k : matrix) {<NEW_LINE>oStream.print('\t');<NEW_LINE>oStream.print(k);<NEW_LINE>}<NEW_LINE>oStream.println();<NEW_LINE>}<NEW_LINE>logger.info("Converted.");<NEW_LINE>xStream.close();<NEW_LINE>yStream.close();<NEW_LINE>oStream.close();<NEW_LINE>// number from 1; column 0 is the class<NEW_LINE>pStream.println("goldAnswerColumn = 0");<NEW_LINE>pStream.println("useClassFeature = true");<NEW_LINE>// not optimized, but weak regularization seems appropriate when much data, few features<NEW_LINE>pStream.println("sigma = 10");<NEW_LINE>for (int j = 0; j < xRows * xColumns; j++) {<NEW_LINE>pStream.println((j + 1) + ".realValued = true");<NEW_LINE>}<NEW_LINE>pStream.close();<NEW_LINE>} | int yMagic = yStream.readInt(); |
428,136 | public AttackResult completed(@RequestParam String password) {<NEW_LINE>Zxcvbn zxcvbn = new Zxcvbn();<NEW_LINE>StringBuffer output = new StringBuffer();<NEW_LINE>DecimalFormat df = new DecimalFormat("0", DecimalFormatSymbols.getInstance(Locale.ENGLISH));<NEW_LINE>df.setMaximumFractionDigits(340);<NEW_LINE>Strength strength = zxcvbn.measure(password);<NEW_LINE>output.append("<b>Your Password: *******</b></br>");<NEW_LINE>output.append("<b>Length: </b>" + password.length() + "</br>");<NEW_LINE>output.append("<b>Estimated guesses needed to crack your password: </b>" + df.format(strength.getGuesses()) + "</br>");<NEW_LINE>output.append("<div style=\"float: left;padding-right: 10px;\"><b>Score: </b>" + <MASK><NEW_LINE>if (strength.getScore() <= 1) {<NEW_LINE>output.append("<div style=\"background-color:red;width: 200px;border-radius: 12px;float: left;\"> </div></br>");<NEW_LINE>} else if (strength.getScore() <= 3) {<NEW_LINE>output.append("<div style=\"background-color:orange;width: 200px;border-radius: 12px;float: left;\"> </div></br>");<NEW_LINE>} else {<NEW_LINE>output.append("<div style=\"background-color:green;width: 200px;border-radius: 12px;float: left;\"> </div></br>");<NEW_LINE>}<NEW_LINE>output.append("<b>Estimated cracking time: </b>" + calculateTime((long) strength.getCrackTimeSeconds().getOnlineNoThrottling10perSecond()) + "</br>");<NEW_LINE>if (strength.getFeedback().getWarning().length() != 0)<NEW_LINE>output.append("<b>Warning: </b>" + strength.getFeedback().getWarning() + "</br>");<NEW_LINE>// possible feedback: https://github.com/dropbox/zxcvbn/blob/master/src/feedback.coffee<NEW_LINE>// maybe ask user to try also weak passwords to see and understand feedback?<NEW_LINE>if (strength.getFeedback().getSuggestions().size() != 0) {<NEW_LINE>output.append("<b>Suggestions:</b></br><ul>");<NEW_LINE>for (String sug : strength.getFeedback().getSuggestions()) output.append("<li>" + sug + "</li>");<NEW_LINE>output.append("</ul></br>");<NEW_LINE>}<NEW_LINE>output.append("<b>Score: </b>" + strength.getScore() + "/4 </br>");<NEW_LINE>if (strength.getScore() >= 4)<NEW_LINE>return success(this).feedback("securepassword-success").output(output.toString()).build();<NEW_LINE>else<NEW_LINE>return failed(this).feedback("securepassword-failed").output(output.toString()).build();<NEW_LINE>} | strength.getScore() + "/4 </div>"); |
1,488,053 | public void run(IAction action) {<NEW_LINE>try {<NEW_LINE>Path p = new Path(XMLUtil.XSD_DIR + "/" + getSchemaFilename());<NEW_LINE>Bundle bundle = Platform.getBundle(VALIDATION_PLUGINNAME);<NEW_LINE>URL xsdURL = FileLocator.find(bundle, p, null);<NEW_LINE>Source xml = new StreamSource(selectedFile.getContents());<NEW_LINE>Source xsd = new StreamSource(xsdURL.openStream());<NEW_LINE>List<SAXParseException> errors = XMLUtil.validate(xsd, xml, new ValidationLSResourceResolver());<NEW_LINE>if (!errors.isEmpty()) {<NEW_LINE>MessageConsole myConsole = findConsole(CONSOLE_NAME);<NEW_LINE>MessageConsoleStream out = myConsole.newMessageStream();<NEW_LINE>MessageDialog.openError(getShell(), DIALOG_WINDOW_NAME, errors.size() + " errors were encountered. See the console view for details");<NEW_LINE>for (SAXParseException se : errors) {<NEW_LINE>String msg = "Line " + se.getLineNumber() + " Column " + se.getColumnNumber() + ": " + se.getMessage();<NEW_LINE>out.println(msg);<NEW_LINE>}<NEW_LINE>OpenDDSDiagramEditorPlugin.getInstance().logError("OpenDDS XML Validation failed for " + selectedFile.getName());<NEW_LINE>IWorkbenchPage page = targetPart.getSite().getPage();<NEW_LINE>String id = IConsoleConstants.ID_CONSOLE_VIEW;<NEW_LINE>try {<NEW_LINE>IConsoleView view = (IConsoleView) page.showView(id);<NEW_LINE>view.display(myConsole);<NEW_LINE>} catch (PartInitException e) {<NEW_LINE>OpenDDSDiagramEditorPlugin.getInstance().logError("Opening " + CONSOLE_NAME + " console for validation results failed", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>MessageDialog.openInformation(<MASK><NEW_LINE>}<NEW_LINE>} catch (CoreException e) {<NEW_LINE>MessageDialog.openError(getShell(), DIALOG_WINDOW_NAME, e.getMessage());<NEW_LINE>OpenDDSDiagramEditorPlugin.getInstance().logError("OpenDDS XML Validation failed", e);<NEW_LINE>} catch (SAXException e) {<NEW_LINE>MessageDialog.openError(getShell(), DIALOG_WINDOW_NAME, e.getMessage());<NEW_LINE>OpenDDSDiagramEditorPlugin.getInstance().logError("OpenDDS XML Validation failed", e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>MessageDialog.openError(getShell(), DIALOG_WINDOW_NAME, e.getMessage());<NEW_LINE>OpenDDSDiagramEditorPlugin.getInstance().logError("OpenDDS XML Validation failed", e);<NEW_LINE>}<NEW_LINE>} | getShell(), "OpenDDS XML Validation", "Validation completed with no XML Schema violations detected"); |
309,627 | public int computeIndentAfterNewline(IDocument d, int offset) throws BadLocationException {<NEW_LINE>Token token = getTokenBefore(d, offset);<NEW_LINE>int line = (token == null ? 0 : getLineNumber(token));<NEW_LINE>int orgIndentLevel = (token == null ? 0 : getLineIndentLevel(d, line));<NEW_LINE>List<Token> tokens = getTokens(d, d.getLineOffset(line), offset);<NEW_LINE>int indentLevel = simpleComputeNextLineIndentLevel(orgIndentLevel, tokens);<NEW_LINE>Token lastToken = lastNonNlsToken(d, tokens);<NEW_LINE>if (lastToken != null) {<NEW_LINE>if (isCloserOfPair(lastToken)) {<NEW_LINE>if (indentLevel < orgIndentLevel) {<NEW_LINE>// Jumping back from indentation is more complex.<NEW_LINE>// A somewhat better strategy for newline after closing<NEW_LINE>// brackets, parens or braces.<NEW_LINE>indentLevel = getIndentLevelForCloserPair(d, lastToken);<NEW_LINE>} else if (indentLevel == orgIndentLevel && lastToken.getType() == RPAREN) {<NEW_LINE>// line ended with ')' -- check for incomplete conditional statement<NEW_LINE>int firstTokenType = tokens.get(0).getType();<NEW_LINE>if (firstTokenType == LITERAL_if || firstTokenType == LITERAL_else || firstTokenType == LITERAL_for || firstTokenType == LITERAL_while || (firstTokenType == RCURLY && tokens.size() > 1 && tokens.get(1).getType() == LITERAL_else)) {<NEW_LINE>indentLevel = getIndentLevelForCloserPair(d, lastToken) + getPrefs().getIndentationSize();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (indentLevel == orgIndentLevel && lastToken.getType() == LITERAL_else) {<NEW_LINE>// bare else<NEW_LINE>indentLevel <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return indentLevel;<NEW_LINE>} | += getPrefs().getIndentationSize(); |
716,300 | public PutEmailIdentityDkimSigningAttributesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PutEmailIdentityDkimSigningAttributesResult putEmailIdentityDkimSigningAttributesResult = new PutEmailIdentityDkimSigningAttributesResult();<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 putEmailIdentityDkimSigningAttributesResult;<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("DkimStatus", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>putEmailIdentityDkimSigningAttributesResult.setDkimStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DkimTokens", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>putEmailIdentityDkimSigningAttributesResult.setDkimTokens(new ListUnmarshaller<String>(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 putEmailIdentityDkimSigningAttributesResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
898,631 | public void callOnSwipe(byte[] data, int dataLen) {<NEW_LINE>Logger.D(TAG, "onSwipe API");<NEW_LINE>Logger.D(TAG, "data: " + data + " datalen: " + dataLen);<NEW_LINE>if ((data == null) || (dataLen < MIN_DATA_LENGTH)) {<NEW_LINE>Log.e(TAG, "MSR has returned no valid data");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Bundle b = null;<NEW_LINE>Method method = null;<NEW_LINE>int methodVersion = 0;<NEW_LINE>try {<NEW_LINE>method = MSR.class.getMethod("processSwipeOutput", byte[].class, int.class, int.class);<NEW_LINE>methodVersion = 3;<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>}<NEW_LINE>Class c = null;<NEW_LINE>try {<NEW_LINE>c = Class.forName("com.symbol.msr.IDTechDefs");<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>Logger.D(TAG, "No IDTechDefs");<NEW_LINE>}<NEW_LINE>if (c != null && methodVersion != 3) {<NEW_LINE>try {<NEW_LINE>method = c.getMethod("processSwipeOutput", byte[].class, int.class, int.class);<NEW_LINE>methodVersion = 2;<NEW_LINE>} catch (NoSuchMethodException f) {<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>method = c.getMethod("processSwipeOutput", byte[].class, int.class);<NEW_LINE>methodVersion = 1;<NEW_LINE>} catch (NoSuchMethodException g) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (methodVersion == 3) {<NEW_LINE>b = (Bundle) method.invoke(null, data, dataLen, Character.getNumericValue('\r'));<NEW_LINE>Log.w(TAG, "MSR.processSwipeOutput OK!");<NEW_LINE>} else if (methodVersion == 2) {<NEW_LINE>b = (Bundle) method.invoke(null, data, dataLen, Character.getNumericValue('\r'));<NEW_LINE>Log.w(TAG, "IDTechDefs.processSwipeOutput(x,y,z) OK!");<NEW_LINE>} else if (methodVersion == 1) {<NEW_LINE>b = (Bundle) method.invoke(null, data, dataLen);<NEW_LINE>Log.w(TAG, "IDTechDefs.processSwipeOutput(x,y) OK!");<NEW_LINE>} else {<NEW_LINE>Log.e(TAG, "Cannot processSwipeOutput: This device needs updating with the latest MSR library");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE><MASK><NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>Log.e(TAG, "Cannot processSwipeOutput: IllegalAccessException");<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>Log.e(TAG, "Cannot processSwipeOutput: InvocationTargetException");<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>if (b == null) {<NEW_LINE>Log.e(TAG, "MSR has returned no valid data");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String cardData = b.getString(MSR_DATA_STRING_TAG);<NEW_LINE>Logger.D(TAG, "MSR decoded data: " + cardData);<NEW_LINE>// Broadcast the bundle<NEW_LINE>Intent intent = new Intent();<NEW_LINE>intent.setAction(MSR_SWYPE_ACTION);<NEW_LINE>intent.putExtras(b);<NEW_LINE>sendBroadcast(intent);<NEW_LINE>} | Log.e(TAG, "Cannot processSwipeOutput: IllegalArgumentException"); |
473,561 | public OutlierResult run(Relation<? extends NumberVector> relation) {<NEW_LINE>DoubleMinMax mm = new DoubleMinMax();<NEW_LINE>// resulting scores<NEW_LINE>WritableDoubleDataStore oscores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_TEMP | DataStoreFactory.HINT_HOT);<NEW_LINE>// Compute mean and covariance Matrix<NEW_LINE>CovarianceMatrix temp = CovarianceMatrix.make(relation);<NEW_LINE>double[] mean = temp.getMeanVector(relation).toArray();<NEW_LINE>// debugFine(mean.toString());<NEW_LINE>double[][] covarianceMatrix = temp.destroyToPopulationMatrix();<NEW_LINE>// debugFine(covarianceMatrix.toString());<NEW_LINE>double[][] covarianceTransposed = inverse(covarianceMatrix);<NEW_LINE>// Normalization factors for Gaussian PDF<NEW_LINE>double det = new LUDecomposition(covarianceMatrix).det();<NEW_LINE>final double fakt = 1.0 / Math.sqrt(MathUtil.powi(MathUtil.TWOPI, RelationUtil.dimensionality(relation)) * det);<NEW_LINE>// for each object compute Mahalanobis distance<NEW_LINE>for (DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {<NEW_LINE>double[] x = minusEquals(relation.get(iditer).toArray(), mean);<NEW_LINE>// Gaussian PDF<NEW_LINE>final double mDist = <MASK><NEW_LINE>final double prob = fakt * FastMath.exp(-mDist * .5);<NEW_LINE>mm.put(prob);<NEW_LINE>oscores.putDouble(iditer, prob);<NEW_LINE>}<NEW_LINE>final OutlierScoreMeta meta;<NEW_LINE>if (invert) {<NEW_LINE>double max = mm.getMax() != 0 ? mm.getMax() : 1.;<NEW_LINE>for (DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {<NEW_LINE>oscores.putDouble(iditer, (max - oscores.doubleValue(iditer)) / max);<NEW_LINE>}<NEW_LINE>meta = new BasicOutlierScoreMeta(0.0, 1.0);<NEW_LINE>} else {<NEW_LINE>meta = new InvertedOutlierScoreMeta(mm.getMin(), mm.getMax(), 0.0, Double.POSITIVE_INFINITY);<NEW_LINE>}<NEW_LINE>DoubleRelation res = new MaterializedDoubleRelation("Gaussian Model Outlier Score", relation.getDBIDs(), oscores);<NEW_LINE>return new OutlierResult(meta, res);<NEW_LINE>} | transposeTimesTimes(x, covarianceTransposed, x); |
1,725,286 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see javax.resource.spi.ResourceAdapter#endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void endpointDeactivation(MessageEndpointFactory msgEndpointFac, ActivationSpec activationSpec) {<NEW_LINE>boolean debug = debugActivationSpec;<NEW_LINE>PrintStream out = DebugTracer.getPrintStream();<NEW_LINE>if (debug) {<NEW_LINE>out.println("endpointDeactivation called with: ");<NEW_LINE>out.println("MEF: " + msgEndpointFac.toString());<NEW_LINE>out.println("ActivationSpec: " + activationSpec.toString());<NEW_LINE>}<NEW_LINE>if (activationSpec instanceof ActivationSpecImpl) {<NEW_LINE>ActivationSpecImpl aSpec = (ActivationSpecImpl) activationSpec;<NEW_LINE>if (debug) {<NEW_LINE>out.println("Received com.ibm.inbound.impl.ActivationSpecImpl");<NEW_LINE>out.println("Contents of ActivationSpec: ");<NEW_LINE>out.println(<MASK><NEW_LINE>out.println("destType: " + aSpec.getDestinationType());<NEW_LINE>if (aSpec.getDestination() != null) {<NEW_LINE>out.println("destination:" + aSpec.getDestination().toString());<NEW_LINE>} else {<NEW_LINE>out.println("destination is null");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (debug) {<NEW_LINE>out.println("Received activationSpec of type: " + activationSpec.getClass().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "prop1:" + aSpec.getProp1()); |
1,109,589 | public List<SingularityTaskId> rebalanceRacks(SingularityRequest request, List<SingularityTaskId> remainingActiveTasks, Optional<String> user) {<NEW_LINE>List<SingularityTaskId> <MASK><NEW_LINE>int activeRacksWithCapacityCount = slaveAndRackManager.getActiveRacksWithCapacityCount();<NEW_LINE>double perRack = request.getInstancesSafe() / (double) activeRacksWithCapacityCount;<NEW_LINE>Multiset<String> countPerRack = HashMultiset.create();<NEW_LINE>for (SingularityTaskId taskId : remainingActiveTasks) {<NEW_LINE>countPerRack.add(taskId.getRackId());<NEW_LINE>LOG.debug("{} - {} - {} - {}", countPerRack, perRack, extraCleanedTasks.size(), taskId);<NEW_LINE>if (countPerRack.count(taskId.getRackId()) > perRack && extraCleanedTasks.size() < activeRacksWithCapacityCount / 2 && taskId.getInstanceNo() > 1) {<NEW_LINE>extraCleanedTasks.add(taskId);<NEW_LINE>LOG.debug("Cleaning up task {} to evenly distribute tasks among racks", taskId);<NEW_LINE>taskManager.createTaskCleanup(new SingularityTaskCleanup(user, TaskCleanupType.REBALANCE_RACKS, System.currentTimeMillis(), taskId, Optional.empty(), Optional.empty(), Optional.empty()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return extraCleanedTasks;<NEW_LINE>} | extraCleanedTasks = new ArrayList<>(); |
802,298 | final GetDevicesResult executeGetDevices(GetDevicesRequest getDevicesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDevicesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<GetDevicesRequest> request = null;<NEW_LINE>Response<GetDevicesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDevicesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDevicesRequest));<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, "NetworkManager");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDevices");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDevicesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDevicesResultJsonUnmarshaller());<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); |
255,740 | public static void dump(DocFlavor docFlavor) {<NEW_LINE>System.out.println();<NEW_LINE>System.out.println("DocFlavor=" + docFlavor);<NEW_LINE>PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();<NEW_LINE>PrintService[] pss = PrintServiceLookup.lookupPrintServices(docFlavor, pras);<NEW_LINE>for (int i = 0; i < pss.length; i++) {<NEW_LINE>PrintService ps = pss[i];<NEW_LINE>System.out.println("- " + ps);<NEW_LINE>System.out.println(" Factory=" + ps.getServiceUIFactory());<NEW_LINE>ServiceUIFactory uiF = pss[i].getServiceUIFactory();<NEW_LINE>if (uiF != null) {<NEW_LINE>System.out.println("about");<NEW_LINE>JDialog about = (JDialog) uiF.getUI(<MASK><NEW_LINE>about.setVisible(true);<NEW_LINE>System.out.println("admin");<NEW_LINE>JDialog admin = (JDialog) uiF.getUI(ServiceUIFactory.ADMIN_UIROLE, ServiceUIFactory.JDIALOG_UI);<NEW_LINE>admin.setVisible(true);<NEW_LINE>System.out.println("main");<NEW_LINE>JDialog main = (JDialog) uiF.getUI(ServiceUIFactory.MAIN_UIROLE, ServiceUIFactory.JDIALOG_UI);<NEW_LINE>main.setVisible(true);<NEW_LINE>System.out.println("reserved");<NEW_LINE>JDialog res = (JDialog) uiF.getUI(ServiceUIFactory.RESERVED_UIROLE, ServiceUIFactory.JDIALOG_UI);<NEW_LINE>res.setVisible(true);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>DocFlavor[] dfs = pss[i].getSupportedDocFlavors();<NEW_LINE>System.out.println(" - Supported Doc Flavors");<NEW_LINE>for (int j = 0; j < dfs.length; j++) System.out.println(" -> " + dfs[j]);<NEW_LINE>// Attribute<NEW_LINE>Class[] attCat = pss[i].getSupportedAttributeCategories();<NEW_LINE>System.out.println(" - Supported Attribute Categories");<NEW_LINE>for (int j = 0; j < attCat.length; j++) System.out.println(" -> " + attCat[j].getName() + " = " + pss[i].getDefaultAttributeValue((Class<? extends Attribute>) attCat[j]));<NEW_LINE>//<NEW_LINE>}<NEW_LINE>} | ServiceUIFactory.ABOUT_UIROLE, ServiceUIFactory.JDIALOG_UI); |
1,746,050 | public static void average(Planar<GrayS16> from, GrayS16 to) {<NEW_LINE>int numBands = from.getNumBands();<NEW_LINE>if (numBands == 1) {<NEW_LINE>to.setTo(from.getBand(0));<NEW_LINE>} else if (numBands == 3) {<NEW_LINE>GrayS16 band0 = from.getBand(0);<NEW_LINE>GrayS16 band1 = from.getBand(1);<NEW_LINE>GrayS16 band2 = from.getBand(2);<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>for (int x = 0; x < from.width; x++, indexFrom++) {<NEW_LINE>int sum = band0.data[indexFrom];<NEW_LINE>sum += band1.data[indexFrom];<NEW_LINE>sum += band2.data[indexFrom];<NEW_LINE>to.data[indexTo++] = (short) (sum / 3);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>for (int x = 0; x < from.width; x++, indexFrom++) {<NEW_LINE>int sum = 0;<NEW_LINE>for (int b = 0; b < numBands; b++) {<NEW_LINE>sum += from.bands<MASK><NEW_LINE>}<NEW_LINE>to.data[indexTo++] = (short) (sum / numBands);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}<NEW_LINE>} | [b].data[indexFrom]; |
548,939 | private void sortedMerge(int[] input, int low, int high) {<NEW_LINE>int middle = (low + high) / 2;<NEW_LINE>int[] temp = new int[high - low + 1];<NEW_LINE>int i = low;<NEW_LINE>int j = middle + 1;<NEW_LINE>int r = 0;<NEW_LINE>while (i <= middle && j <= high) {<NEW_LINE>if (input[i] <= input[j]) {<NEW_LINE>temp[r++] = input[i++];<NEW_LINE>} else {<NEW_LINE>temp[r++] = input[j++];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (i <= middle) {<NEW_LINE>temp[r++] = input[i++];<NEW_LINE>}<NEW_LINE>while (j <= high) {<NEW_LINE>temp[r++] = input[j++];<NEW_LINE>}<NEW_LINE>i = low;<NEW_LINE>for (int k = 0; k < temp.length; ) {<NEW_LINE>input[i<MASK><NEW_LINE>}<NEW_LINE>} | ++] = temp[k++]; |
32,605 | private Box createMdat(final List<StreamingSample> samples) {<NEW_LINE>return new Box() {<NEW_LINE><NEW_LINE>public String getType() {<NEW_LINE>return "mdat";<NEW_LINE>}<NEW_LINE><NEW_LINE>public long getSize() {<NEW_LINE>long l = 8;<NEW_LINE>for (StreamingSample streamingSample : samples) {<NEW_LINE>l += streamingSample.getContent().limit();<NEW_LINE>}<NEW_LINE>return l;<NEW_LINE>}<NEW_LINE><NEW_LINE>public void getBox(WritableByteChannel writableByteChannel) throws IOException {<NEW_LINE>long l = 8;<NEW_LINE>for (StreamingSample streamingSample : samples) {<NEW_LINE>ByteBuffer sampleContent = streamingSample.getContent();<NEW_LINE>l += sampleContent.limit();<NEW_LINE>}<NEW_LINE>ByteBuffer bb = ByteBuffer.allocate(8);<NEW_LINE>IsoTypeWriter.writeUInt32(bb, l);<NEW_LINE>bb.put(IsoFile<MASK><NEW_LINE>writableByteChannel.write((ByteBuffer) ((Buffer) bb).rewind());<NEW_LINE>for (StreamingSample streamingSample : samples) {<NEW_LINE>writableByteChannel.write((ByteBuffer) ((Buffer) streamingSample.getContent()).rewind());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | .fourCCtoBytes(getType())); |
247,307 | public Dialog onCreateDialog(Bundle savedInstanceState) {<NEW_LINE>if (getArguments() != null && getArguments().containsKey(TomahawkFragment.PREFERENCEID)) {<NEW_LINE>String id = getArguments().getString(TomahawkFragment.PREFERENCEID);<NEW_LINE>mScriptResolver = PipeLine.get().getResolver(id);<NEW_LINE>}<NEW_LINE>TextView headerTextView = (TextView) addScrollingViewToFrame(R.layout.config_textview);<NEW_LINE>headerTextView.setText(mScriptResolver.getDescription());<NEW_LINE>mWarningTextView = (TextView) addScrollingViewToFrame(R.layout.config_textview);<NEW_LINE>View buttonLayout = addScrollingViewToFrame(R.layout.config_enable_button);<NEW_LINE>LinearLayout button = (LinearLayout) buttonLayout.findViewById(R.id.config_enable_button);<NEW_LINE>button.setOnClickListener(new RedirectButtonListener());<NEW_LINE>ImageView buttonImage = (ImageView) buttonLayout.findViewById(R.id.config_enable_button_image);<NEW_LINE>mScriptResolver.loadIconWhite(buttonImage, 0);<NEW_LINE>mRedirectButtonTextView = (TextView) button.findViewById(R.id.config_enable_button_text);<NEW_LINE>updateTextViews();<NEW_LINE>setDialogTitle(mScriptResolver.getName());<NEW_LINE>hideNegativeButton();<NEW_LINE>onResolverStateUpdated(mScriptResolver);<NEW_LINE>AlertDialog.Builder builder = new <MASK><NEW_LINE>builder.setView(getDialogView());<NEW_LINE>return builder.create();<NEW_LINE>} | AlertDialog.Builder(getActivity()); |
156,450 | public PaymentMethod apply(final PaymentMethodModelDao paymentMethodModelDao) {<NEW_LINE>PaymentMethodPlugin paymentMethodPlugin = null;<NEW_LINE>if (pluginApi != null) {<NEW_LINE>try {<NEW_LINE>paymentMethodPlugin = pluginApi.getPaymentMethodDetail(paymentMethodModelDao.getAccountId(), paymentMethodModelDao.getId(), properties, tenantContext);<NEW_LINE>} catch (final PaymentPluginApiException e) {<NEW_LINE>if (e.getCause() == null) {<NEW_LINE>log.warn("Error retrieving paymentMethodId='{}', plugin='{}', errorMessage='{}', errorType='{}'", paymentMethodModelDao.getId(), pluginName, e.getErrorMessage(), e.getErrorType());<NEW_LINE>} else {<NEW_LINE>log.warn("Error retrieving paymentMethodId='{}', plugin='{}', errorMessage='{}', errorType='{}'", paymentMethodModelDao.getId(), pluginName, e.getErrorMessage(), e.getErrorType(), e);<NEW_LINE>}<NEW_LINE>// We still want to return a payment method object, even though the plugin details are missing<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | return new DefaultPaymentMethod(paymentMethodModelDao, paymentMethodPlugin); |
1,770,724 | boolean fitLine(int contourIndex0, int contourIndex1, LineGeneral2D_F64 line) {<NEW_LINE>int numPixels = CircularIndex.distanceP(contourIndex0, contourIndex1, contour.size());<NEW_LINE>// if its too small<NEW_LINE>if (numPixels < minimumLineLength)<NEW_LINE>return false;<NEW_LINE>Point2D_I32 c0 = contour.get(contourIndex0);<NEW_LINE>Point2D_I32 c1 = contour.get(contourIndex1);<NEW_LINE>double scale = c0.distance(c1);<NEW_LINE>double centerX = (c1.x + c0.x) / 2.0;<NEW_LINE>double centerY = (c1.y + c0.y) / 2.0;<NEW_LINE>int numSamples = Math.min(maxSamples, numPixels);<NEW_LINE>pointsFit.reset();<NEW_LINE>for (int i = 0; i < numSamples; i++) {<NEW_LINE>int index = i * (numPixels - <MASK><NEW_LINE>Point2D_I32 c = contour.get(CircularIndex.addOffset(contourIndex0, index, contour.size()));<NEW_LINE>Point2D_F64 p = pointsFit.grow();<NEW_LINE>p.x = (c.x - centerX) / scale;<NEW_LINE>p.y = (c.y - centerY) / scale;<NEW_LINE>}<NEW_LINE>if (null == FitLine_F64.polar(pointsFit.toList(), linePolar)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>UtilLine2D_F64.convert(linePolar, line);<NEW_LINE>// go from local coordinates into global<NEW_LINE>line.C = scale * line.C - centerX * line.A - centerY * line.B;<NEW_LINE>return true;<NEW_LINE>} | 1) / (numSamples - 1); |
605,471 | public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protocolVersion) {<NEW_LINE>// Special cases<NEW_LINE><MASK><NEW_LINE>int packetId = DefinedPacket.readVarInt(packet);<NEW_LINE>int packetIdLength = packet.readerIndex() - readerIndex;<NEW_LINE>if (packetId == spawnPlayerId) {<NEW_LINE>// Entity ID<NEW_LINE>DefinedPacket.readVarInt(packet);<NEW_LINE>int idLength = packet.readerIndex() - readerIndex - packetIdLength;<NEW_LINE>UUID uuid = DefinedPacket.readUUID(packet);<NEW_LINE>ProxiedPlayer player;<NEW_LINE>if ((player = BungeeCord.getInstance().getPlayerByOfflineUUID(uuid)) != null) {<NEW_LINE>int previous = packet.writerIndex();<NEW_LINE>packet.readerIndex(readerIndex);<NEW_LINE>packet.writerIndex(readerIndex + packetIdLength + idLength);<NEW_LINE>DefinedPacket.writeUUID(player.getUniqueId(), packet);<NEW_LINE>packet.writerIndex(previous);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>packet.readerIndex(readerIndex);<NEW_LINE>} | int readerIndex = packet.readerIndex(); |
239,426 | public RuntimeValue<DataSourcesHealthSupport> configureDataSourcesHealthSupport(DataSourcesBuildTimeConfig config) {<NEW_LINE>Stream.Builder<String> configured = Stream.builder();<NEW_LINE>Stream.Builder<String> excluded = Stream.builder();<NEW_LINE>if (config.defaultDataSource.dbKind.isPresent()) {<NEW_LINE>configured.add(DataSourceUtil.DEFAULT_DATASOURCE_NAME);<NEW_LINE>}<NEW_LINE>if (config.defaultDataSource.healthExclude) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>for (Map.Entry<String, DataSourceBuildTimeConfig> dataSource : config.namedDataSources.entrySet()) {<NEW_LINE>configured.add(dataSource.getKey());<NEW_LINE>if (dataSource.getValue().healthExclude) {<NEW_LINE>excluded.add(dataSource.getKey());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Set<String> names = configured.build().collect(toUnmodifiableSet());<NEW_LINE>Set<String> excludedNames = excluded.build().collect(toUnmodifiableSet());<NEW_LINE>return new RuntimeValue<>(new DataSourcesHealthSupport(names, excludedNames));<NEW_LINE>} | excluded.add(DataSourceUtil.DEFAULT_DATASOURCE_NAME); |
1,020,930 | private void varInstantiated(int var, int val) throws ContradictionException {<NEW_LINE>if (isPassive()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// last in [0,n-1]<NEW_LINE>int last = end[val].get();<NEW_LINE>// start in [0,n-1]<NEW_LINE>int start = origin[var].get();<NEW_LINE>if (origin[val].get() != val) {<NEW_LINE>// TODO: could be more precise, for explanation purpose<NEW_LINE>fails();<NEW_LINE>}<NEW_LINE>if (end[var].get() != var) {<NEW_LINE>// TODO: could be more precise, for explanation purpose<NEW_LINE>fails();<NEW_LINE>}<NEW_LINE>if (val == start) {<NEW_LINE>if (size[start].get() != n) {<NEW_LINE>// TODO: could be more precise, for explanation purpose<NEW_LINE>fails();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>size[start].add(size[val].get());<NEW_LINE>if (size[start].get() == n) {<NEW_LINE>vars[last].<MASK><NEW_LINE>setPassive();<NEW_LINE>}<NEW_LINE>boolean isInst = false;<NEW_LINE>if (size[start].get() < n) {<NEW_LINE>if (vars[last].removeValue(start + offset, this)) {<NEW_LINE>isInst = vars[last].isInstantiated();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>origin[last].set(start);<NEW_LINE>end[start].set(last);<NEW_LINE>if (isInst) {<NEW_LINE>varInstantiated(last, vars[last].getValue() - offset);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | instantiateTo(start + offset, this); |
36,406 | private RequestId createRequest(final InboundEMailConfig config, final InboundEMail email) {<NEW_LINE>final I_R_Request request = InterfaceWrapperHelper.newInstance(I_R_Request.class);<NEW_LINE>request.setSummary(email.getSubject());<NEW_LINE>request.setConfidentialType(X_R_Request.CONFIDENTIALTYPE_Internal);<NEW_LINE>request.setAD_Org_ID(config.getOrgId().getRepoId());<NEW_LINE>request.setR_RequestType_ID(config.getRequestTypeId().getRepoId());<NEW_LINE>request.setStartDate(TimeUtil.asTimestamp(email.getReceivedDate()));<NEW_LINE>request.setDateTrx(TimeUtil.asTimestamp(email.getReceivedDate()));<NEW_LINE>final ClientId adClientId = ClientId.ofRepoId(request.getAD_Client_ID());<NEW_LINE>final IUserDAO usersRepo = Services.get(IUserDAO.class);<NEW_LINE>final UserId userId = usersRepo.retrieveUserIdByEMail(email.getFrom(), adClientId);<NEW_LINE>if (userId != null) {<NEW_LINE>request.setAD_User_ID(userId.getRepoId());<NEW_LINE>final BPartnerId bpartnerId = usersRepo.getBPartnerIdByUserId(userId);<NEW_LINE>request.setC_BPartner_ID<MASK><NEW_LINE>}<NEW_LINE>InterfaceWrapperHelper.save(request);<NEW_LINE>return RequestId.ofRepoId(request.getR_Request_ID());<NEW_LINE>} | (BPartnerId.toRepoId(bpartnerId)); |
777,384 | private static final <T extends Comparable<T>> void visit(Map<Vertex<T>, Integer> map, List<List<Vertex<T>>> list, Vertex<T> v, int c) {<NEW_LINE>map.put(v, c);<NEW_LINE>List<Vertex<T>> r = null;<NEW_LINE>if (c == list.size()) {<NEW_LINE>r = new ArrayList<Vertex<T>>();<NEW_LINE>list.add(r);<NEW_LINE>} else {<NEW_LINE>r = list.get(c);<NEW_LINE>}<NEW_LINE>r.add(v);<NEW_LINE>if (v.getEdges().size() > 0) {<NEW_LINE>boolean found = false;<NEW_LINE>for (Edge<T> e : v.getEdges()) {<NEW_LINE>final Vertex<T<MASK><NEW_LINE>if (map.get(to) == null) {<NEW_LINE>visit(map, list, to, c);<NEW_LINE>found = true;<NEW_LINE>}<NEW_LINE>if (found)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > to = e.getToVertex(); |
1,202,878 | private ORawBuffer readRecord(final ORecordId rid, final boolean prefetchRecords) {<NEW_LINE>checkOpennessAndMigration();<NEW_LINE>if (!rid.isPersistent()) {<NEW_LINE>throw new ORecordNotFoundException(rid, "Cannot read record " + rid + " since the position is invalid in database '" + name + '\'');<NEW_LINE>}<NEW_LINE>if (transaction.get() != null) {<NEW_LINE>final OCluster cluster;<NEW_LINE>try {<NEW_LINE>cluster = doGetAndCheckCluster(rid.getClusterId());<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Disabled this assert have no meaning anymore<NEW_LINE>// assert iLockingStrategy.equals(LOCKING_STRATEGY.DEFAULT);<NEW_LINE>return doReadRecord(cluster, rid, prefetchRecords);<NEW_LINE>}<NEW_LINE>stateLock.acquireReadLock();<NEW_LINE>try {<NEW_LINE>interruptionManager.enterCriticalPath();<NEW_LINE>if (readLock) {<NEW_LINE>final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().getIfDefined();<NEW_LINE>if (db == null || !((OTransactionAbstract) db.getTransaction()).getLockedRecords().contains(rid)) {<NEW_LINE>acquireReadLock(rid);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>checkOpennessAndMigration();<NEW_LINE>checkIfThreadIsBlocked();<NEW_LINE>final OCluster cluster;<NEW_LINE>try {<NEW_LINE>cluster = doGetAndCheckCluster(rid.getClusterId());<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (readLock) {<NEW_LINE>final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().getIfDefined();<NEW_LINE>if (db == null || !((OTransactionAbstract) db.getTransaction()).getLockedRecords().contains(rid)) {<NEW_LINE>releaseReadLock(rid);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>stateLock.releaseReadLock();<NEW_LINE>interruptionManager.exitCriticalPath();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | doReadRecord(cluster, rid, prefetchRecords); |
1,379,738 | public String loginUser(String username, String password) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'username' is set<NEW_LINE>if (username == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'password' is set<NEW_LINE>if (password == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/user/login".replaceAll("\\{format\\}", "json");<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new <MASK><NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password));<NEW_LINE>final String[] localVarAccepts = { "application/xml", "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>GenericType<String> localVarReturnType = new GenericType<String>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | HashMap<String, String>(); |
156,292 | private static void makeShorter(int[] coords, int tabsWiderThan, int maxTabWidth, int widthToDistribute) {<NEW_LINE>int tabCount = countTabsWiderThan(coords, tabsWiderThan);<NEW_LINE>if (0 == tabCount)<NEW_LINE>return;<NEW_LINE>int total = 0;<NEW_LINE>int delta = Math.max(widthToDistribute / tabCount, 1);<NEW_LINE>for (int i = coords.length - 1; i >= 0; i--) {<NEW_LINE>int tabWidth = coords[i];<NEW_LINE>if (i > 0)<NEW_LINE><MASK><NEW_LINE>if (tabWidth < tabsWiderThan)<NEW_LINE>continue;<NEW_LINE>int currentDelta = Math.min(tabWidth - tabsWiderThan, delta);<NEW_LINE>for (int j = i; j < coords.length; j++) {<NEW_LINE>coords[j] -= currentDelta;<NEW_LINE>}<NEW_LINE>total += currentDelta;<NEW_LINE>if (total >= widthToDistribute)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | tabWidth -= coords[i - 1]; |
1,013,275 | public List<String> checkForBadges(Profile authUser, HttpServletRequest req) {<NEW_LINE>List<String> badgelist = new ArrayList<String>();<NEW_LINE>if (authUser != null && !isAjaxRequest(req)) {<NEW_LINE>long oneYear = authUser.getTimestamp() + (365 * 24 * 60 * 60 * 1000);<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.ENTHUSIAST, authUser.getVotes() >= CONF.enthusiastIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.FRESHMAN, authUser.getVotes() >= CONF.freshmanIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.SCHOLAR, authUser.getVotes() >= CONF.scholarIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.TEACHER, authUser.getVotes() >= CONF.teacherIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.PROFESSOR, authUser.getVotes() >= CONF.professorIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.GEEK, authUser.getVotes() >= CONF.geekIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.SENIOR, (System.currentTimeMillis() - authUser.getTimestamp()) >= oneYear);<NEW_LINE>if (!StringUtils.isBlank(authUser.getNewbadges())) {<NEW_LINE>badgelist.addAll(Arrays.asList(authUser.getNewbadges(<MASK><NEW_LINE>authUser.setNewbadges(null);<NEW_LINE>authUser.update();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return badgelist;<NEW_LINE>} | ).split(","))); |
1,787,355 | public com.squareup.okhttp.Call throttleGetCall(String query, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/throttle";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (query != null)<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPair("query", query));<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null)<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>if (progressListener != null) {<NEW_LINE>apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {<NEW_LINE>com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());<NEW_LINE>return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, <MASK><NEW_LINE>} | localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
1,805,456 | private static String expand(Map<String, String> params, String str, boolean url_decode) {<NEW_LINE>int pos = 0;<NEW_LINE>String result = "";<NEW_LINE>while (true) {<NEW_LINE>int new_pos = str.indexOf('$', pos);<NEW_LINE>if (new_pos == -1) {<NEW_LINE>result += str.substring(pos);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>result += str.substring(pos, new_pos);<NEW_LINE>int end_pos = str.length();<NEW_LINE>for (int i = new_pos + 1; i < end_pos; i++) {<NEW_LINE>char <MASK><NEW_LINE>if (!(Character.isLetterOrDigit(c) || c == '_')) {<NEW_LINE>end_pos = i;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String param = str.substring(new_pos + 1, end_pos);<NEW_LINE>String value = params.get(param);<NEW_LINE>if (value == null) {<NEW_LINE>pos = new_pos + 1;<NEW_LINE>result += "$";<NEW_LINE>} else {<NEW_LINE>if (url_decode) {<NEW_LINE>result += UrlUtils.decode(value);<NEW_LINE>} else {<NEW_LINE>result += value;<NEW_LINE>}<NEW_LINE>pos = end_pos;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (result);<NEW_LINE>} | c = str.charAt(i); |
558,296 | public PathAttributes toAttributes(final StorageObject object) {<NEW_LINE>final PathAttributes attributes = new PathAttributes();<NEW_LINE>if (StringUtils.isNotBlank(object.getMd5sum())) {<NEW_LINE>// For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of<NEW_LINE>// the concatenated string of ETags for each of the segments in the manifest.<NEW_LINE>attributes.setChecksum(Checksum.parse(object.getMd5sum()));<NEW_LINE>}<NEW_LINE>attributes.setSize(object.getSize());<NEW_LINE>final <MASK><NEW_LINE>if (lastModified != null) {<NEW_LINE>try {<NEW_LINE>attributes.setModificationDate(iso8601DateParser.parse(lastModified).getTime());<NEW_LINE>} catch (InvalidDateException e) {<NEW_LINE>log.warn(String.format("%s is not ISO 8601 format %s", lastModified, e.getMessage()));<NEW_LINE>try {<NEW_LINE>attributes.setModificationDate(rfc1123DateFormatter.parse(lastModified).getTime());<NEW_LINE>} catch (InvalidDateException f) {<NEW_LINE>log.warn(String.format("%s is not RFC 1123 format %s", lastModified, f.getMessage()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return attributes;<NEW_LINE>} | String lastModified = object.getLastModified(); |
504,584 | void removeGroupUserSettings(String groupId, List<String> users) {<NEW_LINE>Connection connection = null;<NEW_LINE>PreparedStatement statement = null;<NEW_LINE>try {<NEW_LINE>connection = DBUtil.getConnection();<NEW_LINE>StringBuilder sb = new StringBuilder("delete from t_user_setting where _scope in (1,3,5,7) and _uid in (");<NEW_LINE>for (int i = 0; i < users.size(); i++) {<NEW_LINE>sb.append("?");<NEW_LINE>if (i != users.size() - 1) {<NEW_LINE>sb.append(",");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sb.append(") and _key like '1-_-");<NEW_LINE>sb.append(groupId);<NEW_LINE>sb.append("'");<NEW_LINE>statement = connection.prepareStatement(sb.toString());<NEW_LINE>int index = 1;<NEW_LINE>for (String userId : users) {<NEW_LINE>statement.setString(index++, userId);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>LOG.info("Update rows {}", count);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>e.printStackTrace();<NEW_LINE>Utility.printExecption(LOG, e, RDBS_Exception);<NEW_LINE>} finally {<NEW_LINE>DBUtil.closeDB(connection, statement);<NEW_LINE>}<NEW_LINE>} | int count = statement.executeUpdate(); |
1,279,446 | public static QueryInventoryOfItemsInBizItemGroupResponse unmarshall(QueryInventoryOfItemsInBizItemGroupResponse queryInventoryOfItemsInBizItemGroupResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryInventoryOfItemsInBizItemGroupResponse.setRequestId(_ctx.stringValue("QueryInventoryOfItemsInBizItemGroupResponse.RequestId"));<NEW_LINE>queryInventoryOfItemsInBizItemGroupResponse.setCode(_ctx.stringValue("QueryInventoryOfItemsInBizItemGroupResponse.Code"));<NEW_LINE>queryInventoryOfItemsInBizItemGroupResponse.setMessage(_ctx.stringValue("QueryInventoryOfItemsInBizItemGroupResponse.Message"));<NEW_LINE>List<Item> itemList = new ArrayList<Item>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList.Length"); i++) {<NEW_LINE>Item item = new Item();<NEW_LINE>item.setItemId(_ctx.longValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList[" + i + "].ItemId"));<NEW_LINE>item.setLmItemId(_ctx.stringValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList[" + i + "].LmItemId"));<NEW_LINE>item.setQuantity(_ctx.integerValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList[" + i + "].Quantity"));<NEW_LINE>List<Sku> skuList <MASK><NEW_LINE>for (int j = 0; j < _ctx.lengthValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList[" + i + "].SkuList.Length"); j++) {<NEW_LINE>Sku sku = new Sku();<NEW_LINE>sku.setSkuId(_ctx.longValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList[" + i + "].SkuList[" + j + "].SkuId"));<NEW_LINE>sku.setQuantity(_ctx.integerValue("QueryInventoryOfItemsInBizItemGroupResponse.ItemList[" + i + "].SkuList[" + j + "].Quantity"));<NEW_LINE>skuList.add(sku);<NEW_LINE>}<NEW_LINE>item.setSkuList(skuList);<NEW_LINE>itemList.add(item);<NEW_LINE>}<NEW_LINE>queryInventoryOfItemsInBizItemGroupResponse.setItemList(itemList);<NEW_LINE>return queryInventoryOfItemsInBizItemGroupResponse;<NEW_LINE>} | = new ArrayList<Sku>(); |
498,685 | public boolean openRightClickMenu(int x, int y) {<NEW_LINE>if (Lizzie.leelaz.isKataGo) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Optional<int[]> boardCoordinates = boardRenderer.convertScreenToCoordinates(x, y);<NEW_LINE>if (!boardCoordinates.isPresent()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (isPlayingAgainstLeelaz) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (Lizzie.leelaz.isPondering()) {<NEW_LINE>Lizzie.leelaz.sendCommand("name");<NEW_LINE>}<NEW_LINE>isShowingRightMenu = true;<NEW_LINE>rightClickMenu = new RightClickMenu();<NEW_LINE><MASK><NEW_LINE>Timer timer = new Timer();<NEW_LINE>timer.schedule(new TimerTask() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>showMenu(x, y);<NEW_LINE>this.cancel();<NEW_LINE>}<NEW_LINE>}, 50);<NEW_LINE>return true;<NEW_LINE>} | rightClickMenu.storeXY(x, y); |
474,949 | public boolean refresh(TypeElement typeElement) {<NEW_LINE>Map<String, ? extends AnnotationMirror> types = getHelper().getAnnotationsByType(getHelper().getCompilationController().getElements().getAllAnnotationMirrors(typeElement));<NEW_LINE>// NOI18N<NEW_LINE>AnnotationMirror annotationMirror = types.get("javax.faces.component.FacesComponent");<NEW_LINE>if (annotationMirror == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>AnnotationParser parser = AnnotationParser.create(getHelper());<NEW_LINE>// NOI18N<NEW_LINE>parser.expectString("value", null);<NEW_LINE>// NOI18N<NEW_LINE>parser.expectString("namespace", null);<NEW_LINE>// NOI18N<NEW_LINE>parser.expectString("tagName", null);<NEW_LINE>// NOI18N<NEW_LINE>parser.expectPrimitive(<MASK><NEW_LINE>ParseResult parseResult = parser.parse(annotationMirror);<NEW_LINE>// NOI18N<NEW_LINE>type = parseResult.get("value", String.class);<NEW_LINE>clazz = typeElement.getQualifiedName().toString();<NEW_LINE>// NOI18N<NEW_LINE>createTag = parseResult.get("createTag", Boolean.class);<NEW_LINE>if (createTag == null) {<NEW_LINE>createTag = Boolean.FALSE;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>namespace = parseResult.get("namespace", String.class);<NEW_LINE>if (namespace == null) {<NEW_LINE>namespace = DEFAULT_COMPONENT_NS;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>tagName = parseResult.get("tagName", String.class);<NEW_LINE>if (tagName == null) {<NEW_LINE>tagName = typeElement.getSimpleName().toString();<NEW_LINE>tagName = tagName.substring(0, 1).toLowerCase() + tagName.substring(1);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | "createTag", Boolean.class, null); |
871,408 | private void collectJavaProcRunInfo(JVMAgentInfo appServerInfo) {<NEW_LINE>javaCommand = appServerInfo.getAgentProperties().getProperty("sun.java.command");<NEW_LINE>String[] jCommands = javaCommand.split(" ");<NEW_LINE>javaMain = jCommands[0];<NEW_LINE>String[] javaMainClassInfo = javaMain.split("\\.");<NEW_LINE>javaMainClassName = javaMainClassInfo[javaMainClassInfo.length - 1];<NEW_LINE>javaProcId = appServerInfo.getId();<NEW_LINE>javaArgs = appServerInfo.getAgentProperties().getProperty("sun.jvm.args");<NEW_LINE>javaAppId = appServerInfo.getSystemProperties().getProperty("JAppID");<NEW_LINE>javaAppId = (javaAppId == null) ? javaMain : javaAppId;<NEW_LINE>javaAppName = appServerInfo.getSystemProperties().getProperty("JAppName");<NEW_LINE>if (javaAppName == null) {<NEW_LINE>String[] s = javaMain.split("\\.");<NEW_LINE>javaAppName = s[s.length - 1];<NEW_LINE>}<NEW_LINE>localIP = NetworkHelper.getLocalIP();<NEW_LINE>javaHome = appServerInfo.<MASK><NEW_LINE>javaHome = javaHome.replace("\\", "/");<NEW_LINE>javaProcRoot = appServerInfo.getSystemProperties().getProperty("user.dir");<NEW_LINE>} | getSystemProperties().getProperty("java.home"); |
942,547 | public static void reloadConfig(EnumRestartRequirement restarted) {<NEW_LINE>if (EnumRestartRequirement.WORLD.hasBeenRestarted(restarted)) {<NEW_LINE>mjPerMillibucket = propMjPerMillibucket.getLong();<NEW_LINE>if (mjPerMillibucket < MJ_REQ_MILLIBUCKET_MIN) {<NEW_LINE>mjPerMillibucket = MJ_REQ_MILLIBUCKET_MIN;<NEW_LINE>}<NEW_LINE>mjPerItem = propMjPerItem.getLong();<NEW_LINE>if (mjPerItem < MJ_REQ_ITEM_MIN) {<NEW_LINE>mjPerItem = MJ_REQ_ITEM_MIN;<NEW_LINE>}<NEW_LINE>baseFlowRate = MathUtil.clamp(propBaseFlowRate.getInt(), 1, 40);<NEW_LINE>int basePowerRate = 4;<NEW_LINE>fluidPipeColourBorder = propFluidPipeColourBorder.getBoolean();<NEW_LINE>PipeApi.flowFluids.fallbackColourType = fluidPipeColourBorder ? EnumPipeColourType.BORDER_INNER : EnumPipeColourType.TRANSLUCENT;<NEW_LINE>lossMode = ConfigUtil.parseEnumForConfig(propLossMode, PowerLossMode.DEFAULT);<NEW_LINE>fluidTransfer(BCTransportPipes.cobbleFluid, baseFlowRate, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.woodFluid, baseFlowRate, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.stoneFluid, baseFlowRate * 2, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.sandstoneFluid, baseFlowRate * 2, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.clayFluid, baseFlowRate * 4, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.ironFluid, baseFlowRate * 4, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.quartzFluid, baseFlowRate * 4, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.diamondFluid, baseFlowRate * 8, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.diaWoodFluid, baseFlowRate * 8, 10);<NEW_LINE>fluidTransfer(BCTransportPipes.goldFluid, baseFlowRate * 8, 2);<NEW_LINE>fluidTransfer(BCTransportPipes.voidFluid, baseFlowRate * 8, 10);<NEW_LINE>powerTransfer(BCTransportPipes.cobblePower, basePowerRate, 16, false);<NEW_LINE>powerTransfer(BCTransportPipes.stonePower, basePowerRate * 2, 32, false);<NEW_LINE>powerTransfer(BCTransportPipes.woodPower, basePowerRate * 4, 128, true);<NEW_LINE>powerTransfer(BCTransportPipes.sandstonePower, <MASK><NEW_LINE>powerTransfer(BCTransportPipes.quartzPower, basePowerRate * 8, 32, false);<NEW_LINE>// powerTransfer(BCTransportPipes.ironPower, basePowerRate * 8, false);<NEW_LINE>powerTransfer(BCTransportPipes.goldPower, basePowerRate * 16, 32, false);<NEW_LINE>// powerTransfer(BCTransportPipes.diamondPower, basePowerRate * 32, false);<NEW_LINE>}<NEW_LINE>} | basePowerRate * 4, 32, false); |
965,815 | public Request<StopInstancesRequest> marshall(StopInstancesRequest stopInstancesRequest) {<NEW_LINE>if (stopInstancesRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<StopInstancesRequest> request = new DefaultRequest<MASK><NEW_LINE>request.addParameter("Action", "StopInstances");<NEW_LINE>request.addParameter("Version", "2015-10-01");<NEW_LINE>java.util.List<String> instanceIdsList = stopInstancesRequest.getInstanceIds();<NEW_LINE>int instanceIdsListIndex = 1;<NEW_LINE>for (String instanceIdsListValue : instanceIdsList) {<NEW_LINE>if (instanceIdsListValue != null) {<NEW_LINE>request.addParameter("InstanceId." + instanceIdsListIndex, StringUtils.fromString(instanceIdsListValue));<NEW_LINE>}<NEW_LINE>instanceIdsListIndex++;<NEW_LINE>}<NEW_LINE>if (stopInstancesRequest.isForce() != null) {<NEW_LINE>request.addParameter("Force", StringUtils.fromBoolean(stopInstancesRequest.isForce()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | <StopInstancesRequest>(stopInstancesRequest, "AmazonEC2"); |
392,763 | private static AttributesAndLocation generatorAttributesForMacros(Package.Builder pkgBuilder, BuildLangTypedAttributeValuesMap args, ImmutableList<CallStackEntry> stack) {<NEW_LINE>// For a callstack [BUILD <toplevel>, .bzl <function>, <rule>],<NEW_LINE>// location is that of the caller of 'rule' (the .bzl function).<NEW_LINE>Location location = stack.size() < 2 ? Location.BUILTIN : stack.get(stack.<MASK><NEW_LINE>boolean hasName = args.containsAttributeNamed("generator_name");<NEW_LINE>boolean hasFunc = args.containsAttributeNamed("generator_function");<NEW_LINE>// TODO(bazel-team): resolve cases in our code where hasName && !hasFunc, or hasFunc && !hasName<NEW_LINE>if (hasName || hasFunc) {<NEW_LINE>return new AttributesAndLocation(args, location);<NEW_LINE>}<NEW_LINE>// The "generator" of a rule is the function (sometimes called "macro")<NEW_LINE>// outermost in the call stack.<NEW_LINE>// The stack must contain at least two entries:<NEW_LINE>// 0: the outermost function (e.g. a BUILD file),<NEW_LINE>// 1: the function called by it (e.g. a "macro" in a .bzl file).<NEW_LINE>// optionally followed by other Starlark or built-in functions,<NEW_LINE>// and finally the rule instantiation function.<NEW_LINE>if (stack.size() < 2 || !stack.get(1).location.file().endsWith(".bzl")) {<NEW_LINE>// macro is not a Starlark function<NEW_LINE>return new AttributesAndLocation(args, location);<NEW_LINE>}<NEW_LINE>// location of call to generator<NEW_LINE>Location generatorLocation = stack.get(0).location;<NEW_LINE>ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();<NEW_LINE>for (Map.Entry<String, Object> attributeAccessor : args.getAttributeAccessors()) {<NEW_LINE>String attributeName = args.getName(attributeAccessor);<NEW_LINE>builder.put(attributeName, args.getValue(attributeAccessor));<NEW_LINE>}<NEW_LINE>String generatorName = pkgBuilder.getGeneratorNameByLocation(generatorLocation);<NEW_LINE>if (generatorName == null) {<NEW_LINE>generatorName = (String) args.getAttributeValue("name");<NEW_LINE>}<NEW_LINE>builder.put("generator_name", generatorName);<NEW_LINE>try {<NEW_LINE>args = new BuildLangTypedAttributeValuesMap(builder.buildOrThrow());<NEW_LINE>} catch (IllegalArgumentException unused) {<NEW_LINE>// We just fall back to the default case and swallow any messages.<NEW_LINE>}<NEW_LINE>// TODO(adonovan): is it appropriate to use generatorLocation as the rule's main location?<NEW_LINE>// Or would 'location' (the immediate call) be more informative? When there are errors, the<NEW_LINE>// location of the toplevel call of the generator may be quite unrelated to the error message.<NEW_LINE>return new AttributesAndLocation(args, generatorLocation);<NEW_LINE>} | size() - 2).location; |
1,184,834 | public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes, Component component) {<NEW_LINE>Action[] actions = NodeOp.findActions(selectedNodes);<NEW_LINE>JPopupMenu res = Utilities.actionsToPopup(actions, component);<NEW_LINE>if ((component instanceof ETable) && (column >= 0)) {<NEW_LINE>ETable et = (ETable) component;<NEW_LINE>if (row >= 0) {<NEW_LINE>Object val = et.getValueAt(row, column);<NEW_LINE>val = et.transformValue(val);<NEW_LINE>String s = NbBundle.getMessage(HistoryFileView.class, "LBL_QuickFilter");<NEW_LINE>res.add(getQuickFilterPopup(et, column, val, s));<NEW_LINE>} else if (et.getQuickFilterColumn() == column) {<NEW_LINE>if (et.getQuickFilterColumn() != -1) {<NEW_LINE>String s = NbBundle.getMessage(HistoryFileView.class, "LBL_QuickFilter");<NEW_LINE><MASK><NEW_LINE>JMenuItem noFilterItem = et.getQuickFilterNoFilterItem(et.getQuickFilterFormatStrings()[6]);<NEW_LINE>menu.add(noFilterItem);<NEW_LINE>res.add(menu);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | JMenu menu = new JMenu(s); |
1,718,069 | public List<Node> generateMenuTreeForRole(List<ZTreeNode> list) {<NEW_LINE>List<Node> nodes = new ArrayList<>(20);<NEW_LINE>for (ZTreeNode menu : list) {<NEW_LINE>Node permissionNode = new Node();<NEW_LINE>permissionNode.setId(menu.getId());<NEW_LINE>permissionNode.setName(menu.getName());<NEW_LINE>permissionNode.setPid(menu.getpId());<NEW_LINE>permissionNode.setChecked(menu.getChecked());<NEW_LINE>nodes.add(permissionNode);<NEW_LINE>}<NEW_LINE>for (Node permissionNode : nodes) {<NEW_LINE>for (Node child : nodes) {<NEW_LINE>if (child.getPid().intValue() == permissionNode.getId().intValue()) {<NEW_LINE>permissionNode.getChildren().add(child);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Node> result <MASK><NEW_LINE>for (Node node : nodes) {<NEW_LINE>if (node.getPid().intValue() == 0) {<NEW_LINE>result.add(node);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | = new ArrayList<>(20); |
1,430,653 | public void handleMessage(ReleaseMessage message, String channel) {<NEW_LINE>logger.info("message received - channel: {}, message: {}", channel, message);<NEW_LINE>String releaseMessage = message.getMessage();<NEW_LINE>if (!Topics.APOLLO_RELEASE_TOPIC.equals(channel) || Strings.isNullOrEmpty(releaseMessage)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<String> keys = STRING_SPLITTER.splitToList(releaseMessage);<NEW_LINE>// message should be appId+cluster+namespace<NEW_LINE>if (keys.size() != 3) {<NEW_LINE>logger.error("message format invalid - {}", releaseMessage);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String appId = keys.get(0);<NEW_LINE>String cluster = keys.get(1);<NEW_LINE>String namespace = keys.get(2);<NEW_LINE>List<GrayReleaseRule> rules = grayReleaseRuleRepository.<MASK><NEW_LINE>mergeGrayReleaseRules(rules);<NEW_LINE>} | findByAppIdAndClusterNameAndNamespaceName(appId, cluster, namespace); |
398,619 | public PointSensitivityBuilder presentValueSensitivity(CapitalIndexedBondPaymentPeriod period, RatesProvider ratesProvider, IssuerCurveDiscountFactors issuerDiscountFactors) {<NEW_LINE>if (period.getPaymentDate().isBefore(ratesProvider.getValuationDate())) {<NEW_LINE>return PointSensitivityBuilder.none();<NEW_LINE>}<NEW_LINE>double rate = rateComputationFn.rate(period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);<NEW_LINE>PointSensitivityBuilder rateSensi = rateComputationFn.rateSensitivity(period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);<NEW_LINE>double df = issuerDiscountFactors.<MASK><NEW_LINE>PointSensitivityBuilder dfSensi = issuerDiscountFactors.zeroRatePointSensitivity(period.getPaymentDate());<NEW_LINE>double factor = period.getNotional() * period.getRealCoupon();<NEW_LINE>return rateSensi.multipliedBy(df * factor).combinedWith(dfSensi.multipliedBy((rate + 1d) * factor));<NEW_LINE>} | discountFactor(period.getPaymentDate()); |
33,911 | public UpdateDataSourcePermissionsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateDataSourcePermissionsResult updateDataSourcePermissionsResult = new UpdateDataSourcePermissionsResult();<NEW_LINE>updateDataSourcePermissionsResult.setStatus(context.getHttpResponse().getStatusCode());<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 updateDataSourcePermissionsResult;<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("DataSourceArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateDataSourcePermissionsResult.setDataSourceArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DataSourceId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateDataSourcePermissionsResult.setDataSourceId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("RequestId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateDataSourcePermissionsResult.setRequestId(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 updateDataSourcePermissionsResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
58,081 | public static SAML11AuthorizationDecisionStatementType parseSAML11AuthorizationDecisionStatement(XMLEventReader xmlEventReader) throws ParsingException {<NEW_LINE>SAML11AuthorizationDecisionStatementType authzDecision = null;<NEW_LINE>StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader);<NEW_LINE>StaxParserUtil.validate(startElement, SAML11Constants.AUTHORIZATION_DECISION_STATEMENT);<NEW_LINE>Attribute decision = startElement.getAttributeByName(new QName(SAML11Constants.DECISION));<NEW_LINE>if (decision == null)<NEW_LINE>throw logger.parserRequiredAttribute("Decision");<NEW_LINE>String decisionValue = StaxParserUtil.getAttributeValue(decision);<NEW_LINE>Attribute resource = startElement.getAttributeByName(new QName(SAML11Constants.RESOURCE));<NEW_LINE>if (resource == null)<NEW_LINE>throw logger.parserRequiredAttribute("Namespace");<NEW_LINE>String resValue = StaxParserUtil.getAttributeValue(resource);<NEW_LINE>authzDecision = new SAML11AuthorizationDecisionStatementType(URI.create(resValue), SAML11DecisionType.valueOf(decisionValue));<NEW_LINE>while (xmlEventReader.hasNext()) {<NEW_LINE>XMLEvent <MASK><NEW_LINE>if (xmlEvent instanceof EndElement) {<NEW_LINE>EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader);<NEW_LINE>if (StaxParserUtil.matches(end, SAML11Constants.AUTHORIZATION_DECISION_STATEMENT))<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);<NEW_LINE>if (startElement == null)<NEW_LINE>break;<NEW_LINE>String tag = StaxParserUtil.getElementName(startElement);<NEW_LINE>if (SAML11Constants.ACTION.equals(tag)) {<NEW_LINE>startElement = StaxParserUtil.getNextStartElement(xmlEventReader);<NEW_LINE>SAML11ActionType samlAction = new SAML11ActionType();<NEW_LINE>Attribute namespaceAttr = startElement.getAttributeByName(new QName(SAML11Constants.NAMESPACE));<NEW_LINE>if (namespaceAttr != null) {<NEW_LINE>samlAction.setNamespace(StaxParserUtil.getAttributeValue(namespaceAttr));<NEW_LINE>}<NEW_LINE>samlAction.setValue(StaxParserUtil.getElementText(xmlEventReader));<NEW_LINE>authzDecision.addAction(samlAction);<NEW_LINE>} else if (JBossSAMLConstants.SUBJECT.get().equals(tag)) {<NEW_LINE>SAML11SubjectParser parser = new SAML11SubjectParser();<NEW_LINE>authzDecision.setSubject((SAML11SubjectType) parser.parse(xmlEventReader));<NEW_LINE>} else<NEW_LINE>throw logger.parserUnknownTag(tag, startElement.getLocation());<NEW_LINE>}<NEW_LINE>return authzDecision;<NEW_LINE>} | xmlEvent = StaxParserUtil.peek(xmlEventReader); |
685,163 | public static String convertToUnhexExpression(byte[] bytes) {<NEW_LINE>int len = bytes != null ? bytes.length : 0;<NEW_LINE>if (len == 0) {<NEW_LINE>return EMPTY_STRING_EXPR;<NEW_LINE>}<NEW_LINE>int offset = UNHEX_PREFIX.length;<NEW_LINE>byte[] hexChars = new byte[len * 2 + offset + UNHEX_SUFFIX.length];<NEW_LINE>System.arraycopy(UNHEX_PREFIX, <MASK><NEW_LINE>System.arraycopy(UNHEX_SUFFIX, 0, hexChars, hexChars.length - UNHEX_SUFFIX.length, UNHEX_SUFFIX.length);<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>int v = bytes[i] & 0xFF;<NEW_LINE>hexChars[offset++] = HEX_ARRAY[v >>> 4];<NEW_LINE>hexChars[offset++] = HEX_ARRAY[v & 0x0F];<NEW_LINE>}<NEW_LINE>return new String(hexChars, StandardCharsets.UTF_8);<NEW_LINE>} | 0, hexChars, 0, offset); |
552,410 | public Map<String, Number> result() {<NEW_LINE>long totalCount = values != null ? values.getTotalCount() : doubles.getTotalCount();<NEW_LINE>boolean empty = totalCount == 0;<NEW_LINE>Map<String, Number> result = new LinkedHashMap<>(percentiles.size() + 6);<NEW_LINE>result.put("min", minValue);<NEW_LINE>result.put("minNonZero", values != null ? values.getMinNonZeroValue() : doubles.getMinNonZeroValue());<NEW_LINE>result.put("max", maxValue);<NEW_LINE>result.put("total", totalCount);<NEW_LINE>result.put("mean", values != null ? values.getMean() : doubles.getMean());<NEW_LINE>result.put("stdev", values != null ? values.getStdDeviation() : doubles.getStdDeviation());<NEW_LINE>for (Double percentile : percentiles) {<NEW_LINE>if (percentile != null && !empty) {<NEW_LINE>if (values != null) {<NEW_LINE>result.put(percentile.toString(), values.getValueAtPercentile(percentile * 100D));<NEW_LINE>} else {<NEW_LINE>result.put(percentile.toString(), doubles<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | .getValueAtPercentile(percentile * 100D)); |
687,838 | public boolean isConference(Call call) {<NEW_LINE>// If we're the focus of the conference.<NEW_LINE>if (call.isConferenceFocus())<NEW_LINE>return true;<NEW_LINE>// If one of our peers is a conference focus, we're in a<NEW_LINE>// conference call.<NEW_LINE>Iterator<? extends CallPeer> callPeers = call.getCallPeers();<NEW_LINE>while (callPeers.hasNext()) {<NEW_LINE><MASK><NEW_LINE>if (callPeer.isConferenceFocus())<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// the call can have two peers at the same time and there is no one<NEW_LINE>// is conference focus. This is situation when some one has made an<NEW_LINE>// attended transfer and has transfered us. We have one call with two<NEW_LINE>// peers the one we are talking to and the one we have been transfered<NEW_LINE>// to. And the first one is been hanguped and so the call passes through<NEW_LINE>// conference call fo a moment and than go again to one to one call.<NEW_LINE>return call.getCallPeerCount() > 1;<NEW_LINE>} | CallPeer callPeer = callPeers.next(); |
893,659 | protected SingleVariableDeclaration convertToSingleVariableDeclaration(LocalDeclaration localDeclaration) {<NEW_LINE>final SingleVariableDeclaration variableDecl = new SingleVariableDeclaration(this.ast);<NEW_LINE>setModifiers(variableDecl, localDeclaration);<NEW_LINE>final SimpleName name <MASK><NEW_LINE>name.internalSetIdentifier(new String(localDeclaration.name));<NEW_LINE>int start = localDeclaration.sourceStart;<NEW_LINE>int nameEnd = localDeclaration.sourceEnd;<NEW_LINE>name.setSourceRange(start, nameEnd - start + 1);<NEW_LINE>variableDecl.setName(name);<NEW_LINE>TypeReference typeReference = localDeclaration.type;<NEW_LINE>final int extraDimensions = typeReference.extraDimensions();<NEW_LINE>if (this.ast.apiLevel >= AST.JLS8_INTERNAL) {<NEW_LINE>setExtraAnnotatedDimensions(nameEnd + 1, localDeclaration.declarationSourceEnd, typeReference, variableDecl.extraDimensions(), extraDimensions);<NEW_LINE>} else {<NEW_LINE>internalSetExtraDimensions(variableDecl, extraDimensions);<NEW_LINE>}<NEW_LINE>Type type = convertType(localDeclaration.type);<NEW_LINE>int typeEnd = type.getStartPosition() + type.getLength() - 1;<NEW_LINE>// https://bugs.eclipse.org/393719 - [compiler] inconsistent warnings on iteration variables<NEW_LINE>// compiler considers collectionExpression as within the declarationSourceEnd, DOM AST must use the shorter range to avoid overlap<NEW_LINE>int sourceEnd = ((localDeclaration.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsForeachElementVariable) != 0) ? localDeclaration.sourceEnd : localDeclaration.declarationSourceEnd;<NEW_LINE>int rightEnd = Math.max(typeEnd, sourceEnd);<NEW_LINE>setTypeForSingleVariableDeclaration(variableDecl, type, extraDimensions);<NEW_LINE>variableDecl.setSourceRange(localDeclaration.declarationSourceStart, rightEnd - localDeclaration.declarationSourceStart + 1);<NEW_LINE>if (this.resolveBindings) {<NEW_LINE>recordNodes(name, localDeclaration);<NEW_LINE>recordNodes(variableDecl, localDeclaration);<NEW_LINE>variableDecl.resolveBinding();<NEW_LINE>}<NEW_LINE>return variableDecl;<NEW_LINE>} | = new SimpleName(this.ast); |
1,289,845 | private LdapBrowseResult doBrowseImpl(final DomainID domainID, final String profileID, final String dn) throws PwmUnrecoverableException, ChaiUnavailableException, ChaiOperationException {<NEW_LINE>final LdapBrowseResult.LdapBrowseResultBuilder result = LdapBrowseResult.builder();<NEW_LINE>updateBrowseResultChildren(domainID, profileID, dn, result);<NEW_LINE>result.dn(dn);<NEW_LINE>result.profileID(profileID);<NEW_LINE>final DomainConfig domainConfig = new AppConfig(storedConfiguration).getDomainConfigs().get(domainID);<NEW_LINE>if (domainConfig.getLdapProfiles().size() > 1) {<NEW_LINE>result.profileList(new ArrayList<>(domainConfig.getLdapProfiles().keySet()));<NEW_LINE>}<NEW_LINE>if (adRootDNList(domainID, profileID).contains(dn)) {<NEW_LINE>result.parentDN("");<NEW_LINE>} else if (StringUtil.notEmpty(dn)) {<NEW_LINE>final ChaiEntry dnEntry = getChaiProvider(domainID, profileID).getEntryFactory().newChaiEntry(dn);<NEW_LINE>final ChaiEntry parentEntry = dnEntry.getParentEntry();<NEW_LINE>if (parentEntry == null) {<NEW_LINE>result.parentDN("");<NEW_LINE>} else {<NEW_LINE>result.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result.build();<NEW_LINE>} | parentDN(parentEntry.getEntryDN()); |
521,825 | private void populatePartitionAndLocalReplicaMaps(Collection<? extends PartitionId> allPartitions, Map<String, SortedMap<Integer, List<PartitionId>>> partitionIdsByClassAndLocalReplicaCount, Map<PartitionId, List<ReplicaId>> partitionIdToLocalReplicas, String localDatacenterName) {<NEW_LINE>for (PartitionId partition : allPartitions) {<NEW_LINE>String partitionClass = partition.getPartitionClass();<NEW_LINE>int localReplicaCount = 0;<NEW_LINE>for (ReplicaId replicaId : partition.getReplicaIds()) {<NEW_LINE>if (localDatacenterName != null && !localDatacenterName.isEmpty() && replicaId.getDataNodeId().getDatacenterName().equals(localDatacenterName)) {<NEW_LINE>partitionIdToLocalReplicas.computeIfAbsent(partition, key -> new LinkedList<>()).add(replicaId);<NEW_LINE>localReplicaCount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SortedMap<Integer, List<PartitionId>> replicaCountToPartitionIds = partitionIdsByClassAndLocalReplicaCount.computeIfAbsent(partitionClass, key <MASK><NEW_LINE>replicaCountToPartitionIds.computeIfAbsent(localReplicaCount, key -> new ArrayList<>()).add(partition);<NEW_LINE>}<NEW_LINE>} | -> new TreeMap<>()); |
546,852 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>final View mRootView = inflater.inflate(R.layout.fragment_chat, container, false);<NEW_LINE>Context context = requireContext();<NEW_LINE>LinearLayoutManager llm = new LinearLayoutManager(context);<NEW_LINE>llm.setStackFromEnd(true);<NEW_LINE>settings = new Settings(context);<NEW_LINE>mSendText = mRootView.findViewById(R.id.send_message_textview);<NEW_LINE>mSendButton = mRootView.findViewById(R.id.chat_send_ic);<NEW_LINE>mSlowmodeIcon = mRootView.findViewById(R.id.slowmode_ic);<NEW_LINE>mSubonlyIcon = mRootView.findViewById(R.id.subsonly_ic);<NEW_LINE>mR9KIcon = mRootView.findViewById(R.id.r9k_ic);<NEW_LINE>mRecyclerView = mRootView.findViewById(R.id.ChatRecyclerView);<NEW_LINE>chatInputDivider = mRootView.<MASK><NEW_LINE>mChatInputLayout = mRootView.findViewById(R.id.chat_input);<NEW_LINE>mChatInputLayout.bringToFront();<NEW_LINE>mChatStatus = mRootView.findViewById(R.id.chat_status_text);<NEW_LINE>mChatAdapter = new ChatAdapter(mRecyclerView, getActivity(), this);<NEW_LINE>mChatStatusBar = mRootView.findViewById(R.id.chat_status_bar);<NEW_LINE>mEmoteKeyboardButton = mRootView.findViewById(R.id.chat_emote_keyboard_ic);<NEW_LINE>mEmoteChatBackspace = mRootView.findViewById(R.id.emote_backspace);<NEW_LINE>emoteKeyboardContainer = mRootView.findViewById(R.id.emote_keyboard_container);<NEW_LINE>mEmoteTabs = mRootView.findViewById(R.id.tabs);<NEW_LINE>mEmoteViewPager = mRootView.findViewById(R.id.tabs_viewpager);<NEW_LINE>selectedTabColorRes = Service.getColorAttribute(R.attr.textColor, R.color.black_text, context);<NEW_LINE>unselectedTabColorRes = Service.getColorAttribute(R.attr.disabledTextColor, R.color.black_text_disabled, context);<NEW_LINE>defaultBackgroundColor = mSendButton.getColorFilter();<NEW_LINE>mRecyclerView.setAdapter(mChatAdapter);<NEW_LINE>mRecyclerView.setLayoutManager(llm);<NEW_LINE>mRecyclerView.setItemAnimator(null);<NEW_LINE>// intent.getParcelableExtra(getResources().getString(R.string.intent_key_streamer_info));<NEW_LINE>mUserInfo = requireArguments().getParcelable(getString(R.string.stream_fragment_streamerInfo));<NEW_LINE>vodID = requireArguments().getString(getString(R.string.stream_fragment_vod_id));<NEW_LINE>if (!settings.isLoggedIn() || vodID != null || !settings.getChatAccountConnect()) {<NEW_LINE>userNotLoggedIn();<NEW_LINE>} else {<NEW_LINE>setupChatInput();<NEW_LINE>loadRecentEmotes();<NEW_LINE>setupEmoteViews();<NEW_LINE>}<NEW_LINE>setupKeyboardShowListener();<NEW_LINE>setupTransition();<NEW_LINE>return mRootView;<NEW_LINE>} | findViewById(R.id.chat_input_divider); |
1,691,493 | private void fillNotificationCount(final String userId, final Map<String, Object> dataModel) {<NEW_LINE>final int unreadCommentedNotificationCnt = notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_COMMENTED);<NEW_LINE>dataModel.put(Common.UNREAD_COMMENTED_NOTIFICATION_CNT, unreadCommentedNotificationCnt);<NEW_LINE>final int unreadReplyNotificationCnt = notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_REPLY);<NEW_LINE>dataModel.put(Common.UNREAD_REPLY_NOTIFICATION_CNT, unreadReplyNotificationCnt);<NEW_LINE>final int unreadAtNotificationCnt = notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_AT) + notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_ARTICLE_NEW_FOLLOWER) + notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_ARTICLE_NEW_WATCHER) + notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_COMMENT_VOTE_UP) + notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_COMMENT_VOTE_DOWN) + notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_ARTICLE_VOTE_UP) + notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_ARTICLE_VOTE_DOWN);<NEW_LINE>dataModel.put(Common.UNREAD_AT_NOTIFICATION_CNT, unreadAtNotificationCnt);<NEW_LINE>final int unreadFollowingNotificationCnt = notificationQueryService.getUnreadFollowingNotificationCount(userId);<NEW_LINE>dataModel.put(Common.UNREAD_FOLLOWING_NOTIFICATION_CNT, unreadFollowingNotificationCnt);<NEW_LINE>final int unreadPointNotificationCnt = notificationQueryService.getUnreadPointNotificationCount(userId);<NEW_LINE>dataModel.put(Common.UNREAD_POINT_NOTIFICATION_CNT, unreadPointNotificationCnt);<NEW_LINE>final int unreadBroadcastNotificationCnt = notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_BROADCAST);<NEW_LINE>dataModel.put(Common.UNREAD_BROADCAST_NOTIFICATION_CNT, unreadBroadcastNotificationCnt);<NEW_LINE>final int unreadSysAnnounceNotificationCnt = notificationQueryService.getUnreadSysAnnounceNotificationCount(userId);<NEW_LINE>dataModel.put(Common.UNREAD_SYS_ANNOUNCE_NOTIFICATION_CNT, unreadSysAnnounceNotificationCnt);<NEW_LINE>final int unreadNewFollowerNotificationCnt = notificationQueryService.getUnreadNotificationCountByType(userId, Notification.DATA_TYPE_C_NEW_FOLLOWER);<NEW_LINE>dataModel.<MASK><NEW_LINE>dataModel.put(Common.UNREAD_NOTIFICATION_CNT, unreadAtNotificationCnt + unreadBroadcastNotificationCnt + unreadCommentedNotificationCnt + unreadFollowingNotificationCnt + unreadPointNotificationCnt + unreadReplyNotificationCnt + unreadSysAnnounceNotificationCnt + unreadNewFollowerNotificationCnt);<NEW_LINE>} | put(Common.UNREAD_NEW_FOLLOWER_NOTIFICATION_CNT, unreadNewFollowerNotificationCnt); |
713,880 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_view_pager);<NEW_LINE>Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);<NEW_LINE>setSupportActionBar(toolbar);<NEW_LINE>getSupportActionBar().setDisplayHomeAsUpEnabled(true);<NEW_LINE>HeaderView headerView = (HeaderView) findViewById(R.id.toolbar_header_view);<NEW_LINE>headerView.bindTo(getString(R.string.app_name), getString(R.string.viewpager));<NEW_LINE>// Create the adapter that will return a fragment for each of the three<NEW_LINE>// primary sections of the activity.<NEW_LINE>mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());<NEW_LINE>// Set up the ViewPager with the sections adapter.<NEW_LINE>mViewPager = (ViewPager) findViewById(R.id.view_pager);<NEW_LINE>mViewPager.setAdapter(mSectionsPagerAdapter);<NEW_LINE>TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);<NEW_LINE>tabLayout.setupWithViewPager(mViewPager);<NEW_LINE>// Coordinatorlayout Status Bar Padding Disappears From Viewpager 2nd-page<NEW_LINE>// http://stackoverflow.com/questions/31368781/coordinatorlayout-status-bar-padding-disappears-from-viewpager-2nd-page<NEW_LINE>ViewCompat.setOnApplyWindowInsetsListener(mViewPager, new OnApplyWindowInsetsListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {<NEW_LINE>insets = ViewCompat.onApplyWindowInsets(v, insets);<NEW_LINE>if (insets.isConsumed()) {<NEW_LINE>return insets;<NEW_LINE>}<NEW_LINE>boolean consumed = false;<NEW_LINE>for (int i = 0, count = mViewPager.getChildCount(); i < count; i++) {<NEW_LINE>ViewCompat.dispatchApplyWindowInsets(mViewPager.getChildAt(i), insets);<NEW_LINE>if (insets.isConsumed()) {<NEW_LINE>consumed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return consumed <MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ? insets.consumeSystemWindowInsets() : insets; |
1,460,140 | public void preOpExecution(SameDiff sd, At at, SameDiffOp op, OpContext oc) {<NEW_LINE>if (op.getOp().isInPlace()) {<NEW_LINE>// Don't check inplace op<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (op.getOp() instanceof Op) {<NEW_LINE>Op o = (Op) op.getOp();<NEW_LINE>if (oc.getInputArray(0) == null) {<NEW_LINE>// No input op<NEW_LINE>return;<NEW_LINE>} else if (oc.getInputArray(1) == null) {<NEW_LINE>opInputsOrig = new INDArray[] { oc.getInputArray(0) };<NEW_LINE>opInputs = new INDArray[] { oc.getInputArray(0).dup() };<NEW_LINE>} else {<NEW_LINE>opInputsOrig = new INDArray[] { oc.getInputArray(0)<MASK><NEW_LINE>opInputs = new INDArray[] { oc.getInputArray(0).dup(), oc.getInputArray(1).dup() };<NEW_LINE>}<NEW_LINE>} else if (op.getOp() instanceof DynamicCustomOp) {<NEW_LINE>// ((DynamicCustomOp) op.getOp()).inputArguments();<NEW_LINE>List<INDArray> arr = oc.getInputArrays();<NEW_LINE>opInputs = new INDArray[arr.size()];<NEW_LINE>opInputsOrig = new INDArray[arr.size()];<NEW_LINE>for (int i = 0; i < arr.size(); i++) {<NEW_LINE>opInputsOrig[i] = arr.get(i);<NEW_LINE>opInputs[i] = arr.get(i).dup();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unknown op type: " + op.getOp().getClass());<NEW_LINE>}<NEW_LINE>} | , oc.getInputArray(1) }; |
1,286,709 | // todo to remove sometime later<NEW_LINE>@Deprecated<NEW_LINE>private void writeJarDirectories(@Nonnull Element element) {<NEW_LINE>final List<OrderRootType> rootTypes = sortRootTypes(myRoots.keySet());<NEW_LINE>for (OrderRootType rootType : rootTypes) {<NEW_LINE>VirtualFilePointerContainer container = myRoots.get(rootType);<NEW_LINE>List<Pair<String, Boolean>> jarDirectories = new ArrayList<<MASK><NEW_LINE>Collections.sort(jarDirectories, Comparator.comparing(p -> p.getFirst(), String.CASE_INSENSITIVE_ORDER));<NEW_LINE>for (Pair<String, Boolean> pair : jarDirectories) {<NEW_LINE>String url = pair.getFirst();<NEW_LINE>boolean isRecursive = pair.getSecond();<NEW_LINE>final Element jarDirElement = new Element(VirtualFilePointerContainerImpl.JAR_DIRECTORY_ELEMENT);<NEW_LINE>jarDirElement.setAttribute(VirtualFilePointerContainerImpl.URL_ATTR, url);<NEW_LINE>jarDirElement.setAttribute(VirtualFilePointerContainerImpl.RECURSIVE_ATTR, Boolean.toString(isRecursive));<NEW_LINE>if (!rootType.equals(DEFAULT_JAR_DIRECTORY_TYPE)) {<NEW_LINE>jarDirElement.setAttribute(ROOT_TYPE_ATTR, rootType.name());<NEW_LINE>}<NEW_LINE>element.addContent(jarDirElement);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | >(container.getJarDirectories()); |
7,913 | private void initImpl(String dialogUIID, String dialogTitleUIID, Layout lm) {<NEW_LINE>super.getContentPane().setUIID(dialogUIID);<NEW_LINE>super.getTitleComponent().setText("");<NEW_LINE>super.getTitleComponent().setVisible(false);<NEW_LINE>super.getTitleArea().setVisible(false);<NEW_LINE>super.getTitleArea().setUIID("Container");<NEW_LINE>lockStyleImages(getUnselectedStyle());<NEW_LINE>titleArea.setVisible(false);<NEW_LINE>if (lm != null) {<NEW_LINE>dialogContentPane = new Container(lm);<NEW_LINE>} else {<NEW_LINE>dialogContentPane = new Container();<NEW_LINE>}<NEW_LINE>dialogContentPane.setUIID("DialogContentPane");<NEW_LINE>dialogTitle = new Label("", dialogTitleUIID);<NEW_LINE>super.getContentPane().setLayout(new BorderLayout());<NEW_LINE>super.getContentPane().addComponent(BorderLayout.NORTH, dialogTitle);<NEW_LINE>super.getContentPane().addComponent(BorderLayout.CENTER, dialogContentPane);<NEW_LINE>super.getContentPane().setScrollable(false);<NEW_LINE>super.getContentPane().setAlwaysTensile(false);<NEW_LINE>super.getStyle().setBgTransparency(0);<NEW_LINE>super.<MASK><NEW_LINE>super.getStyle().setBorder(null);<NEW_LINE>setSmoothScrolling(false);<NEW_LINE>deregisterAnimated(this);<NEW_LINE>} | getStyle().setBgImage(null); |
1,111,262 | private void makeRunMenu() {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>runMenu = makeMenuRes("run", 'R');<NEW_LINE>// $NON-NLS-1$<NEW_LINE>runStart = makeMenuItemRes("start", 'S', ActionNames.ACTION_START, KeyStrokes.ACTION_START);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>runStartNoTimers = makeMenuItemRes("start_no_timers", 'N', ActionNames.ACTION_START_NO_TIMERS);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>runStop = makeMenuItemRes("stop", 'T', ActionNames.ACTION_STOP, KeyStrokes.ACTION_STOP);<NEW_LINE>runStop.setEnabled(false);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>runShut = makeMenuItemRes("shutdown", 'Y', ActionNames.ACTION_SHUTDOWN, KeyStrokes.ACTION_SHUTDOWN);<NEW_LINE>runShut.setEnabled(false);<NEW_LINE>JMenuItem runClear = makeMenuItemRes("clear", 'C', <MASK><NEW_LINE>JMenuItem runClearAll = makeMenuItemRes("clear_all", 'a', ActionNames.CLEAR_ALL, KeyStrokes.CLEAR_ALL);<NEW_LINE>runMenu.add(runStart);<NEW_LINE>runMenu.add(runStartNoTimers);<NEW_LINE>runMenu.add(runStop);<NEW_LINE>runMenu.add(runShut);<NEW_LINE>runMenu.addSeparator();<NEW_LINE>if (remoteStart != null) {<NEW_LINE>runMenu.add(remoteStart);<NEW_LINE>}<NEW_LINE>JMenuItem remoteStartAll = makeMenuItemRes("remote_start_all", ActionNames.REMOTE_START_ALL, KeyStrokes.REMOTE_START_ALL);<NEW_LINE>runMenu.add(remoteStartAll);<NEW_LINE>if (remoteStop != null) {<NEW_LINE>runMenu.add(remoteStop);<NEW_LINE>}<NEW_LINE>JMenuItem remoteStopAll = makeMenuItemRes("remote_stop_all", 'X', ActionNames.REMOTE_STOP_ALL, KeyStrokes.REMOTE_STOP_ALL);<NEW_LINE>runMenu.add(remoteStopAll);<NEW_LINE>if (remoteShut != null) {<NEW_LINE>runMenu.add(remoteShut);<NEW_LINE>}<NEW_LINE>JMenuItem remoteShutAll = makeMenuItemRes("remote_shut_all", 'X', ActionNames.REMOTE_SHUT_ALL, KeyStrokes.REMOTE_SHUT_ALL);<NEW_LINE>runMenu.add(remoteShutAll);<NEW_LINE>if (remoteExit != null) {<NEW_LINE>runMenu.add(remoteExit);<NEW_LINE>}<NEW_LINE>JMenuItem remoteExitAll = makeMenuItemRes("remote_exit_all", ActionNames.REMOTE_EXIT_ALL);<NEW_LINE>runMenu.add(remoteExitAll);<NEW_LINE>runMenu.addSeparator();<NEW_LINE>runMenu.add(runClear);<NEW_LINE>runMenu.add(runClearAll);<NEW_LINE>addPluginsMenuItems(runMenu, menuCreators, MENU_LOCATION.RUN);<NEW_LINE>} | ActionNames.CLEAR, KeyStrokes.CLEAR); |
185,505 | public SqlNode visit(SqlIdentifier id) {<NEW_LINE>// raw tables and views and such will have a IdentifierNamespace<NEW_LINE>// since we are scoped to identifiers here, we should only pick up these<NEW_LINE>SqlValidatorNamespace namespace = validator.getNamespace(id);<NEW_LINE>if (namespace != null && namespace.isWrapperFor(IdentifierNamespace.class)) {<NEW_LINE>SqlValidatorTable validatorTable = namespace.getTable();<NEW_LINE>// this should not probably be null if the namespace was not null,<NEW_LINE>if (validatorTable != null) {<NEW_LINE>List<String> qualifiedNameParts = validatorTable.getQualifiedName();<NEW_LINE>// 'schema'.'identifier'<NEW_LINE>if (qualifiedNameParts.size() == 2) {<NEW_LINE>final String schema = qualifiedNameParts.get(0);<NEW_LINE>final String <MASK><NEW_LINE>final String resourceType = plannerContext.getSchemaResourceType(schema, resourceName);<NEW_LINE>if (resourceType != null) {<NEW_LINE>resourceActions.add(new ResourceAction(new Resource(resourceName, resourceType), Action.READ));<NEW_LINE>}<NEW_LINE>} else if (qualifiedNameParts.size() > 2) {<NEW_LINE>// Don't expect to see more than 2 names (catalog?).<NEW_LINE>throw new ISE("Cannot analyze table idetifier %s", qualifiedNameParts);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return super.visit(id);<NEW_LINE>} | resourceName = qualifiedNameParts.get(1); |
611,452 | protected INDArray createWeightMatrix(NeuralNetConfiguration conf, INDArray weightView, boolean initializeParams) {<NEW_LINE>ConvolutionLayer layerConf = (ConvolutionLayer) conf.getLayer();<NEW_LINE>if (initializeParams) {<NEW_LINE>int[] kernel = layerConf.getKernelSize();<NEW_LINE>int[<MASK><NEW_LINE>val inputDepth = layerConf.getNIn();<NEW_LINE>val outputDepth = layerConf.getNOut();<NEW_LINE>double fanIn = inputDepth * kernel[0] * kernel[1];<NEW_LINE>double fanOut = outputDepth * kernel[0] * kernel[1] / ((double) stride[0] * stride[1]);<NEW_LINE>val weightsShape = layerConf instanceof Convolution1DLayer ? new long[] { outputDepth, inputDepth, kernel[0], 1 } : new long[] { outputDepth, inputDepth, kernel[0], kernel[1] };<NEW_LINE>return layerConf.getWeightInitFn().init(fanIn, fanOut, weightsShape, 'c', weightView);<NEW_LINE>} else {<NEW_LINE>int[] kernel = layerConf.getKernelSize();<NEW_LINE>long[] realWeights = layerConf instanceof Convolution1DLayer ? new long[] { layerConf.getNOut(), layerConf.getNIn(), kernel[0], 1 } : new long[] { layerConf.getNOut(), layerConf.getNIn(), kernel[0], kernel[1] };<NEW_LINE>return WeightInitUtil.reshapeWeights(realWeights, weightView, 'c');<NEW_LINE>}<NEW_LINE>} | ] stride = layerConf.getStride(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.