idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,491,538 | public void paintSpotlight(final Graphics g, final JComponent surfaceComponent) {<NEW_LINE>Dimension size = surfaceComponent.getSize();<NEW_LINE>if (myLightComponents.size() > 0) {<NEW_LINE>int width = size.width - 1;<NEW_LINE><MASK><NEW_LINE>Rectangle2D screen = new Rectangle2D.Double(0, 0, width, height);<NEW_LINE>final Rectangle visibleRect = myPanel.getVisibleRect();<NEW_LINE>final Point leftPoint = SwingUtilities.convertPoint(myPanel, new Point(visibleRect.x, visibleRect.y), surfaceComponent);<NEW_LINE>Area innerPanel = new Area(new Rectangle2D.Double(leftPoint.x, leftPoint.y, visibleRect.width, visibleRect.height));<NEW_LINE>Area mask = new Area(screen);<NEW_LINE>for (JComponent lightComponent : myLightComponents) {<NEW_LINE>final Area area = getComponentArea(surfaceComponent, lightComponent);<NEW_LINE>if (area == null)<NEW_LINE>continue;<NEW_LINE>if (lightComponent instanceof JLabel) {<NEW_LINE>final JLabel label = (JLabel) lightComponent;<NEW_LINE>final Component labelFor = label.getLabelFor();<NEW_LINE>if (labelFor instanceof JComponent) {<NEW_LINE>final Area labelForArea = getComponentArea(surfaceComponent, (JComponent) labelFor);<NEW_LINE>if (labelForArea != null) {<NEW_LINE>area.add(labelForArea);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>area.intersect(innerPanel);<NEW_LINE>mask.subtract(area);<NEW_LINE>}<NEW_LINE>Graphics2D g2 = (Graphics2D) g;<NEW_LINE>Color shieldColor = new Color(0.0f, 0.0f, 0.0f, 0.15f);<NEW_LINE>Color boundsColor = Color.gray;<NEW_LINE>g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<NEW_LINE>g2.setColor(shieldColor);<NEW_LINE>g2.fill(mask);<NEW_LINE>g2.setColor(boundsColor);<NEW_LINE>g2.draw(mask);<NEW_LINE>}<NEW_LINE>} | int height = size.height - 1; |
1,064,968 | <T> void executeTransaction(Container container, boolean autoCommit, Transaction<T> transaction, Callback<T> callback) {<NEW_LINE>executor.submit(() -> {<NEW_LINE>try (Connection connection = dataSource.getConnection()) {<NEW_LINE>T result;<NEW_LINE>if (autoCommit) {<NEW_LINE>result = transaction.run(container.getParentAccountId(), container.getId(), connection);<NEW_LINE>} else {<NEW_LINE>// if autocommit is set to false, treat this as a multi-step txn that requires an explicit commit/rollback<NEW_LINE>connection.setAutoCommit(false);<NEW_LINE>try {<NEW_LINE>result = transaction.run(container.getParentAccountId(), <MASK><NEW_LINE>connection.commit();<NEW_LINE>} catch (Exception e) {<NEW_LINE>connection.rollback();<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>connection.setAutoCommit(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>callback.onCompletion(result, null);<NEW_LINE>} catch (Exception e) {<NEW_LINE>callback.onCompletion(null, e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | container.getId(), connection); |
149,079 | public void onNext(T t) {<NEW_LINE>if (done) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long c = unique + 1;<NEW_LINE>unique = c;<NEW_LINE>SwitchMapInnerSubscriber<T, R> inner = active.get();<NEW_LINE>if (inner != null) {<NEW_LINE>inner.cancel();<NEW_LINE>}<NEW_LINE>Publisher<? extends R> p;<NEW_LINE>try {<NEW_LINE>p = Objects.requireNonNull(mapper.apply(t), "The publisher returned is null");<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Exceptions.throwIfFatal(e);<NEW_LINE>upstream.cancel();<NEW_LINE>onError(e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SwitchMapInnerSubscriber<T, R> nextInner = new SwitchMapInnerSubscriber<<MASK><NEW_LINE>for (; ; ) {<NEW_LINE>inner = active.get();<NEW_LINE>if (inner == CANCELLED) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (active.compareAndSet(inner, nextInner)) {<NEW_LINE>p.subscribe(nextInner);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | >(this, c, bufferSize); |
1,261,978 | protected void createControls(Composite parent) {<NEW_LINE>createLabel(parent, Messages.InfluenceRelationshipSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);<NEW_LINE>Text text = createSingleTextControl(parent, SWT.NONE);<NEW_LINE>text.setMessage(Messages.InfluenceRelationshipSection_2);<NEW_LINE>fTextStrength = new PropertySectionTextControl(text, IArchimatePackage.Literals.INFLUENCE_RELATIONSHIP__STRENGTH) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void textChanged(String oldText, String newText) {<NEW_LINE>CompoundCommand result = new CompoundCommand();<NEW_LINE>for (EObject relationship : getEObjects()) {<NEW_LINE>if (isAlive(relationship)) {<NEW_LINE>Command cmd = new EObjectFeatureCommand(Messages.InfluenceRelationshipSection_1, relationship, IArchimatePackage.Literals.INFLUENCE_RELATIONSHIP__STRENGTH, newText);<NEW_LINE>if (cmd.canExecute()) {<NEW_LINE>result.add(cmd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>// Help ID<NEW_LINE>PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);<NEW_LINE>} | executeCommand(result.unwrap()); |
757,726 | private static void drawTextOverlay(Graphics2D g2d, int topLeftX, int topLeftY, String text) {<NEW_LINE>Insets insets = new Insets(10, 10, 10, 10);<NEW_LINE>int interLineSpacing = 4;<NEW_LINE>int cornerRadius = 8;<NEW_LINE>g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<NEW_LINE>g2d.setStroke(new BasicStroke(1.0f));<NEW_LINE>g2d.setFont(g2d.getFont().deriveFont(12.0f));<NEW_LINE>String[] lines = text.split("\n");<NEW_LINE>List<TextLayout> textLayouts = new ArrayList<>();<NEW_LINE>int textWidth = 0, textHeight = 0;<NEW_LINE>for (String line : lines) {<NEW_LINE>TextLayout textLayout = new TextLayout(line, g2d.getFont(), g2d.getFontRenderContext());<NEW_LINE>textWidth = (int) Math.max(textWidth, textLayout.getBounds().getWidth());<NEW_LINE>textHeight += (int) textLayout.getBounds<MASK><NEW_LINE>textLayouts.add(textLayout);<NEW_LINE>}<NEW_LINE>textHeight -= interLineSpacing;<NEW_LINE>g2d.setColor(new Color(0, 0, 0, 0.75f));<NEW_LINE>g2d.fillRoundRect(topLeftX, topLeftY, textWidth + insets.left + insets.right, textHeight + insets.top + insets.bottom, cornerRadius, cornerRadius);<NEW_LINE>g2d.setColor(Color.white);<NEW_LINE>g2d.drawRoundRect(topLeftX, topLeftY, textWidth + insets.left + insets.right, textHeight + insets.top + insets.bottom, cornerRadius, cornerRadius);<NEW_LINE>int yPen = topLeftY + insets.top;<NEW_LINE>for (TextLayout textLayout : textLayouts) {<NEW_LINE>yPen += textLayout.getBounds().getHeight();<NEW_LINE>textLayout.draw(g2d, topLeftX + insets.left, yPen);<NEW_LINE>yPen += interLineSpacing;<NEW_LINE>}<NEW_LINE>} | ().getHeight() + interLineSpacing; |
274,128 | final DisassociateIdentityProviderConfigResult executeDisassociateIdentityProviderConfig(DisassociateIdentityProviderConfigRequest disassociateIdentityProviderConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateIdentityProviderConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateIdentityProviderConfigRequest> request = null;<NEW_LINE>Response<DisassociateIdentityProviderConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateIdentityProviderConfigRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateIdentityProviderConfigRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EKS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateIdentityProviderConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateIdentityProviderConfigResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateIdentityProviderConfigResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,763,247 | public int compare(BaseSpec a, BaseSpec b) {<NEW_LINE>PathElement ape = a.getPathElement();<NEW_LINE><MASK><NEW_LINE>int aa = orderMap.get(ape.getClass());<NEW_LINE>int bb = orderMap.get(bpe.getClass());<NEW_LINE>int elementsEqual = aa < bb ? -1 : aa == bb ? 0 : 1;<NEW_LINE>if (elementsEqual != 0) {<NEW_LINE>return elementsEqual;<NEW_LINE>}<NEW_LINE>// At this point we have two PathElements of the same type.<NEW_LINE>String acf = ape.getCanonicalForm();<NEW_LINE>String bcf = bpe.getCanonicalForm();<NEW_LINE>int alen = acf.length();<NEW_LINE>int blen = bcf.length();<NEW_LINE>// Sort them by length, with the longest (most specific) being first<NEW_LINE>// aka "rating-range-*" needs to be evaluated before "rating-*", or else "rating-*" will catch too much<NEW_LINE>// If the lengths are equal, sort alphabetically as the last ditch deterministic behavior<NEW_LINE>return alen > blen ? -1 : alen == blen ? acf.compareTo(bcf) : 1;<NEW_LINE>} | PathElement bpe = b.getPathElement(); |
426,874 | public void readPayload(int id, PacketBufferBC buffer, Side side, MessageContext ctx) throws IOException {<NEW_LINE>super.readPayload(id, buffer, side, ctx);<NEW_LINE>if (id == NET_GUI_DATA) {<NEW_LINE>recipesStates.clear();<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>AssemblyInstruction instruction = lookupRecipe(buffer.readString(), buffer.readItemStack());<NEW_LINE>recipesStates.put(instruction, EnumAssemblyRecipeState.values()[buffer.readInt()]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (id == NET_RECIPE_STATE) {<NEW_LINE>AssemblyInstruction recipe = lookupRecipe(buffer.readString(), buffer.readItemStack());<NEW_LINE>EnumAssemblyRecipeState state = EnumAssemblyRecipeState.values()[buffer.readInt()];<NEW_LINE>if (recipesStates.containsKey(recipe)) {<NEW_LINE>recipesStates.put(recipe, state);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int count = buffer.readInt(); |
366,829 | public double distance(SparseNumberVector v1, SparseNumberVector v2) {<NEW_LINE>// Get the bit masks<NEW_LINE>double accu = 0.;<NEW_LINE>int i1 = v1.iter(), i2 = v2.iter();<NEW_LINE>while (v1.iterValid(i1) && v2.iterValid(i2)) {<NEW_LINE>final int d1 = v1.iterDim(i1), d2 = v2.iterDim(i2);<NEW_LINE>if (d1 < d2) {<NEW_LINE>// In first only<NEW_LINE>final double val = Math.abs(v1.iterDoubleValue(i1));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i1 = v1.iterAdvance(i1);<NEW_LINE>} else if (d2 < d1) {<NEW_LINE>// In second only<NEW_LINE>final double val = Math.abs(v2.iterDoubleValue(i2));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i2 = v2.iterAdvance(i2);<NEW_LINE>} else {<NEW_LINE>// Both vectors have a value.<NEW_LINE>final double val = Math.abs(v1.iterDoubleValue(i1) - v2.iterDoubleValue(i2));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i1 = v1.iterAdvance(i1);<NEW_LINE>i2 = v2.iterAdvance(i2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (v1.iterValid(i1)) {<NEW_LINE>// In first only<NEW_LINE>final double val = Math.abs(v1.iterDoubleValue(i1));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>while (v2.iterValid(i2)) {<NEW_LINE>// In second only<NEW_LINE>final double val = Math.abs(v2.iterDoubleValue(i2));<NEW_LINE>accu += FastMath.pow(val, p);<NEW_LINE>i2 = v2.iterAdvance(i2);<NEW_LINE>}<NEW_LINE>return FastMath.pow(accu, invp);<NEW_LINE>} | i1 = v1.iterAdvance(i1); |
1,819,809 | protected void updateBendPoints(InternalRelationship[] relationshipsToConsider) {<NEW_LINE>for (int i = 0; i < relationshipsToConsider.length; i++) {<NEW_LINE>InternalRelationship relationship = relationshipsToConsider[i];<NEW_LINE>List bendPoints = relationship.getBendPoints();<NEW_LINE>if (bendPoints.size() > 0) {<NEW_LINE>// We will assume that source/dest coordinates are for center of node<NEW_LINE>BendPoint[] externalBendPoints = new BendPoint[bendPoints.size() + 2];<NEW_LINE>InternalNode sourceNode = relationship.getSource();<NEW_LINE>externalBendPoints[0] = new BendPoint(sourceNode.getInternalX(), sourceNode.getInternalY());<NEW_LINE><MASK><NEW_LINE>externalBendPoints[externalBendPoints.length - 1] = new BendPoint(destNode.getInternalX(), destNode.getInternalY());<NEW_LINE>for (int j = 0; j < bendPoints.size(); j++) {<NEW_LINE>BendPoint bp = (BendPoint) bendPoints.get(j);<NEW_LINE>externalBendPoints[j + 1] = new BendPoint(bp.x, bp.y, bp.getIsControlPoint());<NEW_LINE>}<NEW_LINE>relationship.getLayoutRelationship().setBendPoints(externalBendPoints);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | InternalNode destNode = relationship.getDestination(); |
1,378,924 | public void measureInWindow(int id, Promise promise) {<NEW_LINE>View <MASK><NEW_LINE>if (v == null) {<NEW_LINE>promise.reject("this view is null");<NEW_LINE>} else {<NEW_LINE>int[] outputBuffer = new int[4];<NEW_LINE>int statusBarHeight;<NEW_LINE>try {<NEW_LINE>v.getLocationOnScreen(outputBuffer);<NEW_LINE>// We need to remove the status bar from the height. getLocationOnScreen will include the<NEW_LINE>// status bar.<NEW_LINE>statusBarHeight = DimensionsUtil.getStatusBarHeight();<NEW_LINE>if (statusBarHeight > 0) {<NEW_LINE>outputBuffer[1] -= statusBarHeight;<NEW_LINE>}<NEW_LINE>// outputBuffer[0,1] already contain what we want<NEW_LINE>outputBuffer[2] = v.getWidth();<NEW_LINE>outputBuffer[3] = v.getHeight();<NEW_LINE>} catch (Throwable e) {<NEW_LINE>promise.reject("exception" + e.getMessage());<NEW_LINE>e.printStackTrace();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>float x = PixelUtil.px2dp(outputBuffer[0]);<NEW_LINE>float y = PixelUtil.px2dp(outputBuffer[1]);<NEW_LINE>float width = PixelUtil.px2dp(outputBuffer[2]);<NEW_LINE>float height = PixelUtil.px2dp(outputBuffer[3]);<NEW_LINE>float fStatusbarHeight = PixelUtil.px2dp(statusBarHeight);<NEW_LINE>HippyMap hippyMap = new HippyMap();<NEW_LINE>hippyMap.pushDouble("x", x);<NEW_LINE>hippyMap.pushDouble("y", y);<NEW_LINE>hippyMap.pushDouble("width", width);<NEW_LINE>hippyMap.pushDouble("height", height);<NEW_LINE>hippyMap.pushDouble("statusBarHeight", fStatusbarHeight);<NEW_LINE>promise.resolve(hippyMap);<NEW_LINE>}<NEW_LINE>} | v = mControllerRegistry.getView(id); |
1,757,322 | public void deleteById(String id) {<NEW_LINE>String resourceGroupName = <MASK><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 namespaceName = Utils.getValueFromIdByName(id, "namespaces");<NEW_LINE>if (namespaceName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id)));<NEW_LINE>}<NEW_LINE>String notificationHubName = Utils.getValueFromIdByName(id, "notificationHubs");<NEW_LINE>if (notificationHubName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id)));<NEW_LINE>}<NEW_LINE>this.deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE);<NEW_LINE>} | Utils.getValueFromIdByName(id, "resourceGroups"); |
1,329,037 | protected void paintTabBorder(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected) {<NEW_LINE>int bottom = h - 1;<NEW_LINE>int right = w + 4;<NEW_LINE>g.translate(x - 3, y);<NEW_LINE>// Paint Border<NEW_LINE>g.setColor(selectHighlight);<NEW_LINE>// Paint left<NEW_LINE>g.fillRect(0, 0, 1, 2);<NEW_LINE>g.drawLine(0, 2, 4, bottom - 4);<NEW_LINE>g.fillRect(5, bottom - 3, 1, 2);<NEW_LINE>g.fillRect(6, bottom - 1, 1, 1);<NEW_LINE>// Paint bootom<NEW_LINE>g.fillRect(7, bottom, 1, 1);<NEW_LINE>g.setColor(darkShadow);<NEW_LINE>g.fillRect(8, bottom, right - 13, 1);<NEW_LINE>// Paint right<NEW_LINE>g.drawLine(right + 1, 0, <MASK><NEW_LINE>g.fillRect(right - 4, bottom - 3, 1, 2);<NEW_LINE>g.fillRect(right - 5, bottom - 1, 1, 1);<NEW_LINE>g.translate(-x + 3, -y);<NEW_LINE>} | right - 3, bottom - 4); |
335,392 | private void doRegisterBookie(String regPath, long leaseId) throws MetadataStoreException {<NEW_LINE>if (checkRegNodeAndWaitExpired(regPath, leaseId)) {<NEW_LINE>// the bookie is already registered under `${regPath}` with `${leaseId}`.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ByteSequence regPathBs = ByteSequence.from(regPath, UTF_8);<NEW_LINE>Txn txn = kvClient.txn().If(new Cmp(regPathBs, Op.GREATER, CmpTarget.createRevision(0))).Then(io.etcd.jetcd.op.Op.get(regPathBs, GetOption.DEFAULT)).Else(io.etcd.jetcd.op.Op.put(regPathBs, ByteSequence.from(new byte[0]), PutOption.newBuilder().withLeaseId(bkRegister.get()).build()));<NEW_LINE>TxnResponse txnResp = msResult(txn.commit());<NEW_LINE>if (txnResp.isSucceeded()) {<NEW_LINE>// the key already exists<NEW_LINE>GetResponse getResp = txnResp.<MASK><NEW_LINE>if (getResp.getCount() <= 0) {<NEW_LINE>throw new MetadataStoreException("Failed to register bookie under '" + regPath + "', but no bookie is registered there.");<NEW_LINE>} else {<NEW_LINE>KeyValue kv = getResp.getKvs().get(0);<NEW_LINE>throw new MetadataStoreException("Another bookie already registered under '" + regPath + "': lease = " + kv.getLease());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.info("Successfully registered bookie at {}", regPath);<NEW_LINE>}<NEW_LINE>} | getGetResponses().get(0); |
1,196,268 | private static Event parseEventMap(Map<String, Object> eMap) {<NEW_LINE>Event e = new Event();<NEW_LINE>e.setUuid((String) eMap.get("id"));<NEW_LINE>e.setTimestamp((Long) eMap.get("timestamp"));<NEW_LINE>e.setHostName((String) eMap.get("hostName"));<NEW_LINE>e.setSource((String) eMap.get("source"));<NEW_LINE>e.setUser((String<MASK><NEW_LINE>e.setName((String) eMap.get("name"));<NEW_LINE>e.setType((String) eMap.get("type"));<NEW_LINE>e.setAction((String) eMap.get("action"));<NEW_LINE>e.setValue((String) eMap.get("value"));<NEW_LINE>if (null != eMap.get("duration")) {<NEW_LINE>if (eMap.get("duration") instanceof Integer) {<NEW_LINE>e.setDuration(((Integer) eMap.get("duration")).longValue());<NEW_LINE>} else {<NEW_LINE>e.setDuration((Long) eMap.get("duration"));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>e.setDuration(0L);<NEW_LINE>}<NEW_LINE>// Handle custom keys - Get all keys and remove known keys. The remaining are custom keys<NEW_LINE>Set<String> keys = eMap.keySet();<NEW_LINE>keys.removeAll(Arrays.asList("id", "timestamp", "hostName", "source", "user", "name", "type", "action", "value", "duration"));<NEW_LINE>for (String key : keys) {<NEW_LINE>e.getCustomKeys().put(key, (String) eMap.get(key));<NEW_LINE>}<NEW_LINE>return e;<NEW_LINE>} | ) eMap.get("user")); |
701,432 | void checkSpecificAccessControl() throws UnauthorizedAccessException {<NEW_LINE>if (!userInfo.isInstructor) {<NEW_LINE>throw new UnauthorizedAccessException("Instructor privilege is required to access this resource.");<NEW_LINE>}<NEW_LINE>String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID);<NEW_LINE>CourseAttributes courseAttributes = logic.getCourse(courseId);<NEW_LINE>if (courseAttributes == null) {<NEW_LINE>throw new EntityNotFoundException("Course is not found");<NEW_LINE>}<NEW_LINE>InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.getId());<NEW_LINE>gateKeeper.verifyAccessible(instructor, courseAttributes, Const.InstructorPermissions.CAN_MODIFY_STUDENT);<NEW_LINE>gateKeeper.verifyAccessible(instructor, courseAttributes, Const.InstructorPermissions.CAN_MODIFY_SESSION);<NEW_LINE>gateKeeper.verifyAccessible(instructor, <MASK><NEW_LINE>} | courseAttributes, Const.InstructorPermissions.CAN_MODIFY_INSTRUCTOR); |
444,580 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>builder.startObject(Fields.JVM);<NEW_LINE>builder.field(Fields.PID, pid);<NEW_LINE>builder.field(Fields.VERSION, version);<NEW_LINE>builder.field(Fields.VM_NAME, vmName);<NEW_LINE>builder.field(Fields.VM_VERSION, vmVersion);<NEW_LINE>builder.field(Fields.VM_VENDOR, vmVendor);<NEW_LINE>builder.field(Fields.BUNDLED_JDK, bundledJdk);<NEW_LINE>builder.field(Fields.USING_BUNDLED_JDK, usingBundledJdk);<NEW_LINE>builder.timeField(Fields.START_TIME_IN_MILLIS, Fields.START_TIME, startTime);<NEW_LINE>builder.startObject(Fields.MEM);<NEW_LINE>builder.humanReadableField(Fields.HEAP_INIT_IN_BYTES, Fields.HEAP_INIT, new ByteSizeValue(mem.heapInit));<NEW_LINE>builder.humanReadableField(Fields.HEAP_MAX_IN_BYTES, Fields.HEAP_MAX, <MASK><NEW_LINE>builder.humanReadableField(Fields.NON_HEAP_INIT_IN_BYTES, Fields.NON_HEAP_INIT, new ByteSizeValue(mem.nonHeapInit));<NEW_LINE>builder.humanReadableField(Fields.NON_HEAP_MAX_IN_BYTES, Fields.NON_HEAP_MAX, new ByteSizeValue(mem.nonHeapMax));<NEW_LINE>builder.humanReadableField(Fields.DIRECT_MAX_IN_BYTES, Fields.DIRECT_MAX, new ByteSizeValue(mem.directMemoryMax));<NEW_LINE>builder.endObject();<NEW_LINE>builder.array(Fields.GC_COLLECTORS, gcCollectors);<NEW_LINE>builder.array(Fields.MEMORY_POOLS, memoryPools);<NEW_LINE>builder.field(Fields.USING_COMPRESSED_OOPS, useCompressedOops);<NEW_LINE>builder.field(Fields.INPUT_ARGUMENTS, inputArguments);<NEW_LINE>builder.endObject();<NEW_LINE>return builder;<NEW_LINE>} | new ByteSizeValue(mem.heapMax)); |
623,579 | public static void attestOpenEnclaveAsync1() {<NEW_LINE>BinaryData runtimeData = BinaryData.fromBytes(SampleCollateral.getRunTimeData());<NEW_LINE>BinaryData inittimeData = null;<NEW_LINE>BinaryData openEnclaveReport = BinaryData.fromBytes(SampleCollateral.getOpenEnclaveReport());<NEW_LINE>BinaryData sgxQuote = BinaryData.fromBytes(SampleCollateral.getSgxEnclaveQuote());<NEW_LINE>AttestationAsyncClient client = new AttestationClientBuilder().endpoint("https://sharedcus.cus.attest.azure.net").buildAsyncClient();<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.getOpenIdMetadataWithResponse<NEW_LINE>Mono<Response<AttestationOpenIdMetadata>> response = client.getOpenIdMetadataWithResponse();<NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.getOpenIdMetadataWithResponse<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.getOpenIdMetadata<NEW_LINE>Mono<AttestationOpenIdMetadata> openIdMetadata = client.getOpenIdMetadata();<NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.getOpenIdMetadata<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.getAttestationSigners<NEW_LINE>Mono<AttestationSignerCollection> signersMono = client.listAttestationSigners();<NEW_LINE>signersMono.subscribe(signers -> signers.getAttestationSigners().forEach(cert -> {<NEW_LINE>System.out.println("Found certificate.");<NEW_LINE>if (cert.getKeyId() != null) {<NEW_LINE>System.out.println(" Certificate Key ID: " + cert.getKeyId());<NEW_LINE>} else {<NEW_LINE>System.out.println(" Signer does not have a Key ID");<NEW_LINE>}<NEW_LINE>cert.getCertificates().forEach(chainElement -> {<NEW_LINE>System.out.println(" Cert Subject: " + chainElement.getSubjectDN().getName());<NEW_LINE>System.out.println(" Cert Issuer: " + chainElement.getIssuerDN().getName());<NEW_LINE>});<NEW_LINE>}));<NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.getAttestationSigners<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.getAttestationSignersWithResponse<NEW_LINE>Mono<Response<AttestationSignerCollection>> responseOfSigners = client.listAttestationSignersWithResponse();<NEW_LINE>responseOfSigners.subscribe();<NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.getAttestationSignersWithResponse<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.attestOpenEnclaveWithReport<NEW_LINE>Mono<AttestationResult> resultWithReport = client.attestOpenEnclave(openEnclaveReport);<NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.attestOpenEnclaveWithReport<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.attestOpenEnclave<NEW_LINE>Mono<AttestationResult> result = client.attestOpenEnclave(new AttestationOptions(openEnclaveReport).setRunTimeData(new AttestationData(<MASK><NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.attestOpenEnclave<NEW_LINE>// BEGIN: com.azure.security.attestation.AttestationAsyncClient.attestOpenEnclaveWithResponse<NEW_LINE>Mono<AttestationResponse<AttestationResult>> openEnclaveResponse = client.attestOpenEnclaveWithResponse(new AttestationOptions(openEnclaveReport).setRunTimeData(new AttestationData(runtimeData, AttestationDataInterpretation.JSON)), Context.NONE);<NEW_LINE>// END: com.azure.security.attestation.AttestationAsyncClient.attestOpenEnclaveWithResponse<NEW_LINE>} | runtimeData, AttestationDataInterpretation.BINARY))); |
694,866 | public Set<String> doCheckExpired(Set<String> candidates, long time) {<NEW_LINE>if (candidates == null || candidates.isEmpty())<NEW_LINE>return candidates;<NEW_LINE>Set<String> expired = new HashSet<>();<NEW_LINE>for (String candidate : candidates) {<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("Checking expiry for candidate {}", candidate);<NEW_LINE>try {<NEW_LINE>SessionData sd = load(candidate);<NEW_LINE>// if the session no longer exists<NEW_LINE>if (sd == null) {<NEW_LINE>expired.add(candidate);<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>if (_context.getWorkerName().equals(sd.getLastNode())) {<NEW_LINE>// we are its manager, add it to the expired set if it is expired now<NEW_LINE>if ((sd.getExpiry() > 0) && sd.getExpiry() <= time) {<NEW_LINE>expired.add(candidate);<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("Session {} managed by {} is expired", candidate, _context.getWorkerName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("Error checking if candidate {} is expired", candidate, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return expired;<NEW_LINE>} | LOG.debug("Session {} does not exist in infinispan", candidate); |
1,740,921 | private boolean isMethodAlreadyInjectedAnnotationPresent(MethodNode methodNode) {<NEW_LINE>AnnotationNode injectedTraceAnnotation = getAnnotation(INJECTED_TRACE_TYPE.<MASK><NEW_LINE>AnnotationNode manualTraceAnnotation = getAnnotation(MANUAL_TRACE_TYPE.getDescriptor(), methodNode.visibleAnnotations);<NEW_LINE>if (manualTraceAnnotation != null)<NEW_LINE>return true;<NEW_LINE>if (injectedTraceAnnotation != null) {<NEW_LINE>InjectedTraceAnnotationVisitor itav = new InjectedTraceAnnotationVisitor();<NEW_LINE>injectedTraceAnnotation.accept(itav);<NEW_LINE>List<String> methodAdapters = itav.getMethodAdapters();<NEW_LINE>if (methodAdapters.contains(LibertyTracingMethodAdapter.class.getName())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (methodAdapters.contains(WebSphereTrTracingMethodAdapter.class.getName())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (methodAdapters.contains(JSR47TracingMethodAdapter.class.getName())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getDescriptor(), methodNode.visibleAnnotations); |
838,985 | public static void main(String[] args) {<NEW_LINE>if (args.length < 3) {<NEW_LINE>System.out.println("Usage: dechat ipaddress interface username");<NEW_LINE>System.out.println("Example: dechat 192.168.55.123 localhost joe");<NEW_LINE>System.exit(0);<NEW_LINE>}<NEW_LINE>ZContext ctx = new ZContext();<NEW_LINE>// cut string after dot<NEW_LINE>String addressWithoutLastPart = args[0].substring(0, args[0].lastIndexOf('.'));<NEW_LINE>ZThread.fork(ctx, new ListenerTask(), addressWithoutLastPart);<NEW_LINE>ZMQ.Socket broadcaster = ctx.createSocket(ZMQ.PUB);<NEW_LINE>broadcaster.bind(String.format("tcp://%s:9000", args[1]));<NEW_LINE>Scanner scanner <MASK><NEW_LINE>while (!Thread.currentThread().isInterrupted()) {<NEW_LINE>String line = scanner.nextLine();<NEW_LINE>if (line.isEmpty())<NEW_LINE>break;<NEW_LINE>broadcaster.send(String.format("%s: %s", args[2], line));<NEW_LINE>}<NEW_LINE>ctx.destroy();<NEW_LINE>} | = new Scanner(System.in); |
323,129 | public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {<NEW_LINE>if (args.length == 2) {<NEW_LINE>if (UserManager.getPlayer((Player) sender) == null) {<NEW_LINE>sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Party playerParty = UserManager.getPlayer((Player) sender).getParty();<NEW_LINE>String targetName = CommandUtils.getMatchedPlayerName(args[1]);<NEW_LINE>if (!playerParty.hasMember(targetName)) {<NEW_LINE>sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);<NEW_LINE>if (target.isOnline()) {<NEW_LINE>Player onlineTarget = target.getPlayer();<NEW_LINE>String partyName = playerParty.getName();<NEW_LINE>if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>PartyManager.processPartyLeaving<MASK><NEW_LINE>onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));<NEW_LINE>}<NEW_LINE>PartyManager.removeFromParty(target, playerParty);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));<NEW_LINE>return true;<NEW_LINE>} | (UserManager.getPlayer(onlineTarget)); |
1,177,153 | private void registerAttributeHandlers(final ReadManager reader) {<NEW_LINE>final IAttributeHandler vShiftHandler = new IAttributeHandler() {<NEW_LINE><NEW_LINE>public void setAttribute(final Object userObject, final String value) {<NEW_LINE>final NodeModel node = (NodeModel) userObject;<NEW_LINE>LocationModel.createLocationModel(node).setShiftY(Quantity.fromString(value, LengthUnit.px));<NEW_LINE>}<NEW_LINE>};<NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_NODE, "VSHIFT", vShiftHandler);<NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_NODE, "VSHIFT_QUANTITY", vShiftHandler);<NEW_LINE>final IAttributeHandler vgapHandler = new IAttributeHandler() {<NEW_LINE><NEW_LINE>public void setAttribute(final Object userObject, final String value) {<NEW_LINE>final NodeModel node = (NodeModel) userObject;<NEW_LINE>LocationModel.createLocationModel(node).setVGap(Quantity.fromString(value, LengthUnit.px));<NEW_LINE>}<NEW_LINE>};<NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_NODE, "VGAP", vgapHandler);<NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_NODE, "VGAP_QUANTITY", vgapHandler);<NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "VGAP", vgapHandler);<NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "VGAP_QUANTITY", vgapHandler);<NEW_LINE>final IAttributeHandler hgapHandler = new IAttributeHandler() {<NEW_LINE><NEW_LINE>public void setAttribute(final Object userObject, final String value) {<NEW_LINE>final NodeModel node = (NodeModel) userObject;<NEW_LINE>LocationModel.createLocationModel(node).setHGap(Quantity.fromString(value, LengthUnit.px));<NEW_LINE>}<NEW_LINE>};<NEW_LINE>reader.addAttributeHandler(<MASK><NEW_LINE>reader.addAttributeHandler(NodeBuilder.XML_NODE, "HGAP", hgapHandler);<NEW_LINE>} | NodeBuilder.XML_NODE, "HGAP_QUANTITY", hgapHandler); |
299,350 | public void run(RegressionEnvironment env) {<NEW_LINE>env.advanceTime(0);<NEW_LINE>// Every event generates a new row, this time we sum the price by symbol and output volume<NEW_LINE>String epl = "@name('s0') select symbol, volume, sum(price) as mySum from SupportMarketDataBean#time(30)";<NEW_LINE>env.compileDeployAddListenerMileZero(epl, "s0");<NEW_LINE>env.assertStatement("s0", ViewTimeWin::assertSelectResultType);<NEW_LINE>sendEvent(env, SYMBOL_DELL, 10000, 51);<NEW_LINE>env.assertListener("s0", listener -> assertEvents(listener, SYMBOL_DELL, 10000, 51, false));<NEW_LINE>sendEvent(env, SYMBOL_IBM, 20000, 52);<NEW_LINE>env.assertListener("s0", listener -> assertEvents(listener, SYMBOL_IBM, 20000, 103, false));<NEW_LINE>sendEvent(env, SYMBOL_DELL, 40000, 45);<NEW_LINE>env.assertListener("s0", listener -> assertEvents(listener, SYMBOL_DELL, 40000, 148, false));<NEW_LINE>env.advanceTime(35000);<NEW_LINE>// These events are out of the window and new sums are generated<NEW_LINE>sendEvent(env, SYMBOL_IBM, 30000, 70);<NEW_LINE>env.assertListener("s0", listener -> assertEvents(listener, SYMBOL_IBM<MASK><NEW_LINE>sendEvent(env, SYMBOL_DELL, 10000, 20);<NEW_LINE>env.assertListener("s0", listener -> assertEvents(listener, SYMBOL_DELL, 10000, 90, false));<NEW_LINE>env.undeployAll();<NEW_LINE>} | , 30000, 70, false)); |
357,032 | public void handle(PacketWrapper wrapper) throws Exception {<NEW_LINE>// Selecting trade now moves the items, we need to resync the inventory<NEW_LINE>PacketWrapper resyncPacket = wrapper.create(0x08);<NEW_LINE>EntityTracker1_14 tracker = wrapper.user().getEntityTracker(Protocol1_14To1_13_2.class);<NEW_LINE>// 0 - Window ID<NEW_LINE>resyncPacket.write(Type.UNSIGNED_BYTE, ((short) tracker.getLatestTradeWindowId()));<NEW_LINE>// 1 - Slot<NEW_LINE>resyncPacket.write(Type.SHORT, ((short) -999));<NEW_LINE>// 2 - Button - End left click<NEW_LINE>resyncPacket.write(Type.BYTE, (byte) 2);<NEW_LINE>// 3 - Action number<NEW_LINE>resyncPacket.write(Type.SHORT, ((short) ThreadLocalRandom.current().nextInt()));<NEW_LINE>// 4 - Mode - Drag<NEW_LINE>resyncPacket.write(Type.VAR_INT, 5);<NEW_LINE>CompoundTag tag = new CompoundTag();<NEW_LINE>// Tags with NaN are not equal<NEW_LINE>tag.put("force_resync", new DoubleTag(Double.NaN));<NEW_LINE>// 5 - Clicked Item<NEW_LINE>resyncPacket.write(Type.FLAT_VAR_INT_ITEM, new DataItem(1, (byte) 1, <MASK><NEW_LINE>resyncPacket.scheduleSendToServer(Protocol1_14To1_13_2.class);<NEW_LINE>} | (short) 0, tag)); |
1,189,945 | private JavaScriptNode desugarFor(ForNode forNode, JavaScriptNode init, JavaScriptNode test, JavaScriptNode modify, JavaScriptNode wrappedBody) {<NEW_LINE>if (needsPerIterationScope(forNode)) {<NEW_LINE>VarRef firstTempVar = environment.createTempVar();<NEW_LINE>JSFrameDescriptor iterationBlockFrameDescriptor = environment.getBlockFrameDescriptor();<NEW_LINE>RepeatingNode repeatingNode = factory.createForRepeatingNode(test, wrappedBody, modify, iterationBlockFrameDescriptor.toFrameDescriptor(), firstTempVar.createReadNode(), firstTempVar.createWriteNode(factory.createConstantBoolean(false)), environment.getCurrentBlockScopeSlot());<NEW_LINE>StatementNode newFor = factory.createFor<MASK><NEW_LINE>ensureHasSourceSection(newFor, forNode);<NEW_LINE>return createBlock(init, firstTempVar.createWriteNode(factory.createConstantBoolean(true)), newFor);<NEW_LINE>}<NEW_LINE>RepeatingNode repeatingNode = factory.createWhileDoRepeatingNode(test, createBlock(wrappedBody, modify));<NEW_LINE>JavaScriptNode whileDo = factory.createDesugaredFor(factory.createLoopNode(repeatingNode));<NEW_LINE>if (forNode.getTest() == null) {<NEW_LINE>tagStatement(test, forNode);<NEW_LINE>} else {<NEW_LINE>ensureHasSourceSection(whileDo, forNode);<NEW_LINE>}<NEW_LINE>return createBlock(init, whileDo);<NEW_LINE>} | (factory.createLoopNode(repeatingNode)); |
148,766 | public void glGetIntegerv(int pname, IntBuffer params) {<NEW_LINE>if (pname == GL20.GL_ACTIVE_TEXTURE || pname == GL20.GL_ALPHA_BITS || pname == GL20.GL_BLEND_DST_ALPHA || pname == GL20.GL_BLEND_DST_RGB || pname == GL20.GL_BLEND_EQUATION_ALPHA || pname == GL20.GL_BLEND_EQUATION_RGB || pname == GL20.GL_BLEND_SRC_ALPHA || pname == GL20.GL_BLEND_SRC_RGB || pname == GL20.GL_BLUE_BITS || pname == GL20.GL_CULL_FACE_MODE || pname == GL20.GL_DEPTH_BITS || pname == GL20.GL_DEPTH_FUNC || pname == GL20.GL_FRONT_FACE || pname == GL20.GL_GENERATE_MIPMAP_HINT || pname == GL20.GL_GREEN_BITS || pname == GL20.GL_IMPLEMENTATION_COLOR_READ_FORMAT || pname == GL20.GL_IMPLEMENTATION_COLOR_READ_TYPE || pname == GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS || pname == GL20.GL_MAX_CUBE_MAP_TEXTURE_SIZE || pname == GL20.GL_MAX_FRAGMENT_UNIFORM_VECTORS || pname == GL20.GL_MAX_RENDERBUFFER_SIZE || pname == GL20.GL_MAX_TEXTURE_IMAGE_UNITS || pname == GL20.GL_MAX_TEXTURE_SIZE || pname == GL20.GL_MAX_VARYING_VECTORS || pname == GL20.GL_MAX_VERTEX_ATTRIBS || pname == GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS || pname == GL20.GL_MAX_VERTEX_UNIFORM_VECTORS || pname == GL20.GL_NUM_COMPRESSED_TEXTURE_FORMATS || pname == GL20.GL_PACK_ALIGNMENT || pname == GL20.GL_RED_BITS || pname == GL20.GL_SAMPLE_BUFFERS || pname == GL20.GL_SAMPLES || pname == GL20.GL_STENCIL_BACK_FAIL || pname == GL20.GL_STENCIL_BACK_FUNC || pname == GL20.GL_STENCIL_BACK_PASS_DEPTH_FAIL || pname == GL20.GL_STENCIL_BACK_PASS_DEPTH_PASS || pname == GL20.GL_STENCIL_BACK_REF || pname == GL20.GL_STENCIL_BACK_VALUE_MASK || pname == GL20.GL_STENCIL_BACK_WRITEMASK || pname == GL20.GL_STENCIL_BITS || pname == GL20.GL_STENCIL_CLEAR_VALUE || pname == GL20.GL_STENCIL_FAIL || pname == GL20.GL_STENCIL_FUNC || pname == GL20.GL_STENCIL_PASS_DEPTH_FAIL || pname == GL20.GL_STENCIL_PASS_DEPTH_PASS || pname == GL20.GL_STENCIL_REF || pname == GL20.GL_STENCIL_VALUE_MASK || pname == GL20.GL_STENCIL_WRITEMASK || pname == GL20.GL_SUBPIXEL_BITS || pname == GL20.GL_UNPACK_ALIGNMENT) {<NEW_LINE>params.put(0, gl.getParameteri(pname));<NEW_LINE>params.flip();<NEW_LINE>} else if (pname == GL20.GL_VIEWPORT) {<NEW_LINE>Int32Array array = gl.getParameterv(pname);<NEW_LINE>params.put(0, array.get(0));<NEW_LINE>params.put(1<MASK><NEW_LINE>params.put(2, array.get(2));<NEW_LINE>params.put(3, array.get(3));<NEW_LINE>params.flip();<NEW_LINE>} else if (pname == GL20.GL_FRAMEBUFFER_BINDING) {<NEW_LINE>WebGLFramebuffer fbo = gl.getParametero(pname);<NEW_LINE>if (fbo == null) {<NEW_LINE>params.put(0);<NEW_LINE>} else {<NEW_LINE>params.put(frameBuffers.getKey(fbo));<NEW_LINE>}<NEW_LINE>params.flip();<NEW_LINE>} else<NEW_LINE>throw new GdxRuntimeException("glGetInteger not supported by GWT WebGL backend");<NEW_LINE>} | , array.get(1)); |
340,278 | Guard anonfun_11(Guard pc_41, EventBuffer effects, EventHandlerReturnReason outcome) {<NEW_LINE>PrimitiveVS<Machine> var_$tmp0 = new PrimitiveVS<Machine>().restrict(pc_41);<NEW_LINE>PrimitiveVS<Event> var_$tmp1 = new PrimitiveVS<Event>(_null).restrict(pc_41);<NEW_LINE>PrimitiveVS<Machine> var_$tmp2 = new PrimitiveVS<Machine>().restrict(pc_41);<NEW_LINE>PrimitiveVS<Event> var_$tmp3 = new PrimitiveVS<Event><MASK><NEW_LINE>PrimitiveVS<Machine> temp_var_87;<NEW_LINE>temp_var_87 = var_host.restrict(pc_41);<NEW_LINE>var_$tmp0 = var_$tmp0.updateUnderGuard(pc_41, temp_var_87);<NEW_LINE>PrimitiveVS<Event> temp_var_88;<NEW_LINE>temp_var_88 = new PrimitiveVS<Event>(req_excl).restrict(pc_41);<NEW_LINE>var_$tmp1 = var_$tmp1.updateUnderGuard(pc_41, temp_var_88);<NEW_LINE>PrimitiveVS<Machine> temp_var_89;<NEW_LINE>temp_var_89 = new PrimitiveVS<Machine>(this).restrict(pc_41);<NEW_LINE>var_$tmp2 = var_$tmp2.updateUnderGuard(pc_41, temp_var_89);<NEW_LINE>effects.send(pc_41, var_$tmp0.restrict(pc_41), var_$tmp1.restrict(pc_41), new UnionVS(var_$tmp2.restrict(pc_41)));<NEW_LINE>PrimitiveVS<Boolean> temp_var_90;<NEW_LINE>temp_var_90 = new PrimitiveVS<Boolean>(true).restrict(pc_41);<NEW_LINE>var_pending = var_pending.updateUnderGuard(pc_41, temp_var_90);<NEW_LINE>PrimitiveVS<Event> temp_var_91;<NEW_LINE>temp_var_91 = new PrimitiveVS<Event>(unit).restrict(pc_41);<NEW_LINE>var_$tmp3 = var_$tmp3.updateUnderGuard(pc_41, temp_var_91);<NEW_LINE>// NOTE (TODO): We currently perform no typechecking on the payload!<NEW_LINE>outcome.raiseGuardedEvent(pc_41, var_$tmp3.restrict(pc_41));<NEW_LINE>pc_41 = Guard.constFalse();<NEW_LINE>return pc_41;<NEW_LINE>} | (_null).restrict(pc_41); |
1,115,011 | public Parameters unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Parameters parameters = new Parameters();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ExcludeBootVolume", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>parameters.setExcludeBootVolume(context.getUnmarshaller(Boolean.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("NoReboot", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>parameters.setNoReboot(context.getUnmarshaller(Boolean.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 parameters;<NEW_LINE>} | class).unmarshall(context)); |
574,837 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {<NEW_LINE>if (this.registry == null) {<NEW_LINE>// In spring 3.x, may be not call postProcessBeanDefinitionRegistry()<NEW_LINE>this.registry = (BeanDefinitionRegistry) beanFactory;<NEW_LINE>}<NEW_LINE>// scan bean definitions<NEW_LINE>String[<MASK><NEW_LINE>for (String beanName : beanNames) {<NEW_LINE>BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);<NEW_LINE>Map<String, Object> annotationAttributes = getServiceAnnotationAttributes(beanDefinition);<NEW_LINE>if (annotationAttributes != null) {<NEW_LINE>// process @DubboService at java-config @bean method<NEW_LINE>processAnnotatedBeanDefinition(beanName, (AnnotatedBeanDefinition) beanDefinition, annotationAttributes);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!scaned) {<NEW_LINE>// In spring 3.x, may be not call postProcessBeanDefinitionRegistry(), so scan service class here<NEW_LINE>scanServiceBeans(resolvedPackagesToScan, registry);<NEW_LINE>}<NEW_LINE>} | ] beanNames = beanFactory.getBeanDefinitionNames(); |
826,433 | public NDArrayAnalysisCounter merge(NDArrayAnalysisCounter other) {<NEW_LINE>this.countTotal += other.countTotal;<NEW_LINE>this.countNull += other.countNull;<NEW_LINE>this.minLength = Math.min(<MASK><NEW_LINE>this.maxLength = Math.max(this.maxLength, other.maxLength);<NEW_LINE>this.totalNDArrayValues += other.totalNDArrayValues;<NEW_LINE>Set<Integer> allKeys = new HashSet<>(countsByRank.keySet());<NEW_LINE>allKeys.addAll(other.countsByRank.keySet());<NEW_LINE>for (Integer i : allKeys) {<NEW_LINE>long count = 0;<NEW_LINE>if (countsByRank.containsKey(i)) {<NEW_LINE>count += countsByRank.get(i);<NEW_LINE>}<NEW_LINE>if (other.countsByRank.containsKey(i)) {<NEW_LINE>count += other.countsByRank.get(i);<NEW_LINE>}<NEW_LINE>countsByRank.put(i, count);<NEW_LINE>}<NEW_LINE>this.minValue = Math.min(this.minValue, other.minValue);<NEW_LINE>this.maxValue = Math.max(this.maxValue, other.maxValue);<NEW_LINE>return this;<NEW_LINE>} | this.minLength, other.minLength); |
699,832 | public void authorizeWillPublish(@NotNull final ChannelHandlerContext ctx, @NotNull final CONNECT connect) {<NEW_LINE>final String clientId = ctx.channel().attr(ChannelAttributes.CLIENT_CONNECTION).get().getClientId();<NEW_LINE>if (clientId == null || !ctx.channel().isActive()) {<NEW_LINE>// no more processing needed, client is already disconnected<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!authorizers.areAuthorizersAvailable() || connect.getWillPublish() == null) {<NEW_LINE>ctx.pipeline().fireUserEventTriggered(new AuthorizeWillResultEvent(connect, new PublishAuthorizerResult(null, null, false)));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Map<String, AuthorizerProvider> providerMap = authorizers.getAuthorizerProviderMap();<NEW_LINE>if (providerMap.isEmpty()) {<NEW_LINE>ctx.pipeline().fireUserEventTriggered(new AuthorizeWillResultEvent(connect, new PublishAuthorizerResult(null, null, false)));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ClientAuthorizers clientAuthorizers = getClientAuthorizers(ctx);<NEW_LINE>final AuthorizerProviderInput authorizerProviderInput = new AuthorizerProviderInputImpl(ctx.channel(), serverInformation, clientId);<NEW_LINE>final PublishAuthorizerInputImpl input = new PublishAuthorizerInputImpl(connect.getWillPublish(), ctx.channel(), clientId);<NEW_LINE>final PublishAuthorizerOutputImpl output = new PublishAuthorizerOutputImpl(asyncer);<NEW_LINE>final SettableFuture<PublishAuthorizerOutputImpl> publishProcessedFuture = executePublishAuthorizer(clientId, providerMap, clientAuthorizers, <MASK><NEW_LINE>Futures.addCallback(publishProcessedFuture, new WillPublishAuthorizationProcessedTask(connect, ctx), MoreExecutors.directExecutor());<NEW_LINE>} | authorizerProviderInput, input, output, ctx); |
1,435,495 | public int apply(ExportMixin exportMixin, Code code, RunContext ctx) throws IOException {<NEW_LINE>Path outputPath = exportMixin.getFileOutputPath(ctx);<NEW_LINE>// Copy the JAR or native binary<NEW_LINE>Path source = code.getJarFile().toPath();<NEW_LINE>if (exportMixin.nativeImage) {<NEW_LINE>source = getImageName(source.toFile()).toPath();<NEW_LINE>}<NEW_LINE>if (outputPath.toFile().exists()) {<NEW_LINE>if (exportMixin.force) {<NEW_LINE>outputPath.toFile().delete();<NEW_LINE>} else {<NEW_LINE>Util.warnMsg("Cannot export as " + outputPath + " already exists. Use --force to overwrite.");<NEW_LINE>return EXIT_INVALID_INPUT;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>File tempManifest;<NEW_LINE>Files.copy(source, outputPath);<NEW_LINE>if (!exportMixin.nativeImage) {<NEW_LINE>try (JarFile jf = new JarFile(outputPath.toFile())) {<NEW_LINE>String cp = jf.getManifest().getMainAttributes().getValue(Attributes.Name.CLASS_PATH);<NEW_LINE>String[] deps = cp == null ? new String[0] : cp.split(" ");<NEW_LINE>File libDir = new File(outputPath.toFile().getParentFile(), LIB);<NEW_LINE>if (deps.length > 0) {<NEW_LINE>if (!libDir.exists()) {<NEW_LINE>libDir.mkdirs();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StringBuilder newPath = new StringBuilder();<NEW_LINE>for (String dep : deps) {<NEW_LINE>Path file = downloadFile(new File(dep).toURI().toString(), libDir);<NEW_LINE>newPath.append(" " + LIB + "/" + file.toFile().getName());<NEW_LINE>}<NEW_LINE>Path tempDirectory = Files.createTempDirectory("jbang-export");<NEW_LINE>tempManifest = new File(<MASK><NEW_LINE>Manifest mf = new Manifest();<NEW_LINE>// without MANIFEST_VERSION nothing is saved.<NEW_LINE>mf.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");<NEW_LINE>mf.getMainAttributes().putValue(Attributes.Name.CLASS_PATH.toString(), newPath.toString());<NEW_LINE>mf.write(new FileOutputStream(tempManifest));<NEW_LINE>}<NEW_LINE>List<String> optionList = new ArrayList<>();<NEW_LINE>optionList.add(// TODO<NEW_LINE>resolveInJavaHome(// TODO<NEW_LINE>"jar", exportMixin.javaVersion != null ? exportMixin.javaVersion : code.getJavaVersion().orElse(null)));<NEW_LINE>// locate<NEW_LINE>// it<NEW_LINE>// on path ?<NEW_LINE>optionList.add("ufm");<NEW_LINE>optionList.add(outputPath.toString());<NEW_LINE>optionList.add(tempManifest.toString());<NEW_LINE>// System.out.println("Executing " + optionList);<NEW_LINE>Util.infoMsg("Updating jar manifest");<NEW_LINE>// no inheritIO as jar complains unnecessarily about dupilcate manifest entries.<NEW_LINE>Process process = new ProcessBuilder(optionList).start();<NEW_LINE>try {<NEW_LINE>process.waitFor();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>throw new ExitException(1, e);<NEW_LINE>}<NEW_LINE>if (process.exitValue() != 0) {<NEW_LINE>throw new ExitException(1, "Error during updating jar");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Util.infoMsg("Exported to " + outputPath);<NEW_LINE>return EXIT_OK;<NEW_LINE>} | tempDirectory.toFile(), "MANIFEST.MF"); |
174,737 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>ByteBuf buf = (ByteBuf) msg;<NEW_LINE>// sync<NEW_LINE>buf.skipBytes(4);<NEW_LINE>int type = buf.readUnsignedByte();<NEW_LINE>// length<NEW_LINE>buf.readUnsignedShortLE();<NEW_LINE>switch(type) {<NEW_LINE>case MSG_LOGIN_REQUEST:<NEW_LINE>String imei = ByteBufUtil.hexDump(buf.readSlice(8));<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>int fuelConst = buf.readUnsignedShortLE();<NEW_LINE>int tripConst = buf.readUnsignedShortLE();<NEW_LINE>if (channel != null) {<NEW_LINE><MASK><NEW_LINE>// sync<NEW_LINE>response.writeInt(0xF1F1F1F1);<NEW_LINE>response.writeByte(MSG_LOGIN_CONFIRM);<NEW_LINE>// length<NEW_LINE>response.writeShortLE(12);<NEW_LINE>response.writeBytes(ByteBufUtil.decodeHexDump(imei));<NEW_LINE>response.writeShortLE(fuelConst);<NEW_LINE>response.writeShortLE(tripConst);<NEW_LINE>response.writeShort(Checksum.crc16(Checksum.CRC16_XMODEM, response.nioBuffer()));<NEW_LINE>channel.writeAndFlush(new NetworkMessage(response, remoteAddress));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>case MSG_TELEMETRY_1:<NEW_LINE>case MSG_TELEMETRY_2:<NEW_LINE>case MSG_TELEMETRY_3:<NEW_LINE>deviceSession = getDeviceSession(channel, remoteAddress);<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return decodeTelemetry(channel, remoteAddress, deviceSession, buf);<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | ByteBuf response = Unpooled.buffer(); |
405,793 | // Modified version of {@link String#indexOf(String) that allows a CharSequence.<NEW_LINE>private int indexOfFallback(CharSequence hayStack, String needle, int fromIndex) {<NEW_LINE>if (fromIndex >= hayStack.length()) {<NEW_LINE>return needle.<MASK><NEW_LINE>}<NEW_LINE>if (fromIndex < 0) {<NEW_LINE>fromIndex = 0;<NEW_LINE>}<NEW_LINE>if (needle.isEmpty()) {<NEW_LINE>return fromIndex;<NEW_LINE>}<NEW_LINE>char first = needle.charAt(0);<NEW_LINE>int max = hayStack.length() - needle.length();<NEW_LINE>for (int i = fromIndex; i <= max; i++) {<NEW_LINE>if (i <= max) {<NEW_LINE>int j = i + 1;<NEW_LINE>int end = j + needle.length() - 1;<NEW_LINE>for (int k = 1; j < end && hayStack.charAt(j) == needle.charAt(k); j++, k++) {<NEW_LINE>}<NEW_LINE>if (j == end) { | isEmpty() ? 0 : -1; |
968,858 | private void backtrack(final BFSInfo info, final String principalId, final Permission permission, final boolean value, final int level, final boolean doLog) {<NEW_LINE><MASK><NEW_LINE>if (doLog) {<NEW_LINE>if (level == 0) {<NEW_LINE>if (value) {<NEW_LINE>buf.append(permission.name()).append(": granted: ");<NEW_LINE>} else {<NEW_LINE>buf.append(permission.name()).append(": denied: ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>buf.append(info.node.getType()).append(" (").append(info.node.getUuid()).append(") --> ");<NEW_LINE>}<NEW_LINE>info.node.storePermissionResolutionResult(principalId, permission, value);<NEW_LINE>// go to parent(s)<NEW_LINE>if (info.parent != null) {<NEW_LINE>backtrack(info.parent, principalId, permission, value, level + 1, doLog);<NEW_LINE>}<NEW_LINE>if (doLog && level == 0) {<NEW_LINE>logger.info(buf.toString());<NEW_LINE>}<NEW_LINE>} | final StringBuilder buf = new StringBuilder(); |
756,706 | public float[] transformToFloatValuesSV(ProjectionBlock projectionBlock) {<NEW_LINE>int numDocs = projectionBlock.getNumDocs();<NEW_LINE>if (_floatValuesSV == null || _floatValuesSV.length < numDocs) {<NEW_LINE>_floatValuesSV = new float[numDocs];<NEW_LINE>}<NEW_LINE>float[] values = _arguments.get(0).transformToFloatValuesSV(projectionBlock);<NEW_LINE>System.arraycopy(values, <MASK><NEW_LINE>for (int i = 1; i < _arguments.size(); i++) {<NEW_LINE>values = _arguments.get(i).transformToFloatValuesSV(projectionBlock);<NEW_LINE>for (int j = 0; j < numDocs & j < values.length; j++) {<NEW_LINE>_floatValuesSV[j] = Math.max(_floatValuesSV[j], values[j]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return _floatValuesSV;<NEW_LINE>} | 0, _floatValuesSV, 0, numDocs); |
828,641 | public final MatchRecogMatchesIntervalContext matchRecogMatchesInterval() throws RecognitionException {<NEW_LINE>MatchRecogMatchesIntervalContext _localctx = new MatchRecogMatchesIntervalContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 282, RULE_matchRecogMatchesInterval);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(1982);<NEW_LINE>((MatchRecogMatchesIntervalContext) _localctx).i = match(IDENT);<NEW_LINE>setState(1983);<NEW_LINE>timePeriod();<NEW_LINE>setState(1986);<NEW_LINE>_errHandler.sync(this);<NEW_LINE><MASK><NEW_LINE>if (_la == OR_EXPR) {<NEW_LINE>{<NEW_LINE>setState(1984);<NEW_LINE>match(OR_EXPR);<NEW_LINE>setState(1985);<NEW_LINE>((MatchRecogMatchesIntervalContext) _localctx).t = match(TERMINATED);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _la = _input.LA(1); |
713,814 | public String discoverIdentityProvider(@RequestParam String email, @RequestParam(required = false) String skipDiscovery, @RequestParam(required = false, name = "login_hint") String loginHint, @RequestParam(required = false, name = "username") String username, Model model, HttpSession session, HttpServletRequest request) {<NEW_LINE>ClientDetails clientDetails = null;<NEW_LINE>if (hasSavedOauthAuthorizeRequest(session)) {<NEW_LINE>SavedRequest savedRequest = SessionUtils.getSavedRequestSession(session);<NEW_LINE>String[] client_ids = savedRequest.getParameterValues("client_id");<NEW_LINE>try {<NEW_LINE>clientDetails = clientDetailsService.loadClientByClientId(client_ids[0], IdentityZoneHolder.get().getId());<NEW_LINE>} catch (NoSuchClientException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(loginHint)) {<NEW_LINE>model.addAttribute("login_hint", loginHint);<NEW_LINE>}<NEW_LINE>List<IdentityProvider> identityProviders = DomainFilter.filter(providerProvisioning.retrieveActive(IdentityZoneHolder.get().getId()), clientDetails, email, false);<NEW_LINE>if (!StringUtils.hasText(skipDiscovery) && identityProviders.size() == 1) {<NEW_LINE>IdentityProvider matchedIdp = identityProviders.get(0);<NEW_LINE>if (matchedIdp.getType().equals(UAA)) {<NEW_LINE>model.addAttribute("login_hint", new UaaLoginHint("uaa").toString());<NEW_LINE>return goToPasswordPage(email, model);<NEW_LINE>} else {<NEW_LINE>String redirectUrl;<NEW_LINE>if ((redirectUrl = redirectToExternalProvider(matchedIdp.getConfig(), matchedIdp.getOriginKey(), request)) != null) {<NEW_LINE>return redirectUrl;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(email)) {<NEW_LINE>model.addAttribute("email", email);<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(username)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return "redirect:/login?discoveryPerformed=true";<NEW_LINE>} | model.addAttribute("username", username); |
1,208,621 | public Stream<T> debounce(final long time, final TimeUnit t) {<NEW_LINE>final Iterator<T> it = stream.iterator();<NEW_LINE>final long timeNanos = t.toNanos(time);<NEW_LINE>return Streams.stream(new Iterator<T>() {<NEW_LINE><NEW_LINE>volatile long last = 0;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean hasNext() {<NEW_LINE>return it.hasNext();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public T next() {<NEW_LINE>long elapsedNanos = 1;<NEW_LINE>T nextValue = null;<NEW_LINE>while (elapsedNanos > 0 && it.hasNext()) {<NEW_LINE>nextValue = it.next();<NEW_LINE>if (last == 0) {<NEW_LINE>last = System.nanoTime();<NEW_LINE>return nextValue;<NEW_LINE>}<NEW_LINE>elapsedNanos = timeNanos - (<MASK><NEW_LINE>}<NEW_LINE>last = System.nanoTime();<NEW_LINE>if (it.hasNext())<NEW_LINE>return nextValue;<NEW_LINE>else if (elapsedNanos <= 0)<NEW_LINE>return nextValue;<NEW_LINE>else<NEW_LINE>return (T) DEBOUNCED;<NEW_LINE>}<NEW_LINE>}).filter(i -> i != DEBOUNCED);<NEW_LINE>} | System.nanoTime() - last); |
672,129 | public void paintEntity(Graphics g) {<NEW_LINE>Graphics2D g2 = (Graphics2D) g;<NEW_LINE>g2.setFont(HandlerElementMap.getHandlerForElement(this).getFontHandler().getFont());<NEW_LINE>// enable colors<NEW_LINE>Composite[] composites = colorize(g2);<NEW_LINE>g2.setColor(fgColor);<NEW_LINE>Polygon poly = new Polygon();<NEW_LINE>poly.addPoint(0, 0);<NEW_LINE>poly.addPoint(getRectangle().width - 1, 0);<NEW_LINE>poly.addPoint(getRectangle().width - 1, getRectangle().height - 1);<NEW_LINE>poly.addPoint(0, getRectangle().height - 1);<NEW_LINE>poly.addPoint((int) HandlerElementMap.getHandlerForElement(this).getFontHandler().getFontSize() - 2, getRectangle().height / 2);<NEW_LINE>g2.setComposite(composites[1]);<NEW_LINE>g2.setColor(bgColor);<NEW_LINE>g2.fillPolygon(poly);<NEW_LINE>g2.setComposite(composites[0]);<NEW_LINE>if (HandlerElementMap.getHandlerForElement(this).getDrawPanel().getSelector().isSelected(this)) {<NEW_LINE>g2.setColor(fgColor);<NEW_LINE>} else {<NEW_LINE>g2.setColor(fgColorBase);<NEW_LINE>}<NEW_LINE>g2.drawPolygon(poly);<NEW_LINE>Vector<String> tmp = <MASK><NEW_LINE>int yPos = getRectangle().height / 2 - tmp.size() * (int) (HandlerElementMap.getHandlerForElement(this).getFontHandler().getFontSize() + HandlerElementMap.getHandlerForElement(this).getFontHandler().getDistanceBetweenTexts()) / 2;<NEW_LINE>for (int i = 0; i < tmp.size(); i++) {<NEW_LINE>String s = tmp.elementAt(i);<NEW_LINE>yPos += (int) HandlerElementMap.getHandlerForElement(this).getFontHandler().getFontSize();<NEW_LINE>HandlerElementMap.getHandlerForElement(this).getFontHandler().writeText(g2, s, getRectangle().width / 2.0, yPos, AlignHorizontal.CENTER);<NEW_LINE>yPos += HandlerElementMap.getHandlerForElement(this).getFontHandler().getDistanceBetweenTexts();<NEW_LINE>}<NEW_LINE>} | Utils.decomposeStrings(getPanelAttributes()); |
1,303,711 | private void loadNode714() {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.DataItemType_Definition, new QualifiedName(0, "Definition"), new LocalizedText("en", "Definition"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.String, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.DataItemType_Definition, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.DataItemType_Definition, Identifiers.HasModellingRule, Identifiers.ModellingRule_Optional<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.DataItemType_Definition, Identifiers.HasProperty, Identifiers.DataItemType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
1,010,741 | public Either<SessionNotCreatedException, Result> createSession(HttpHandler client, NewSessionPayload payload) throws IOException {<NEW_LINE>int threshold = (int) Math.min(Runtime.getRuntime().freeMemory() / 10, Integer.MAX_VALUE);<NEW_LINE>FileBackedOutputStream os = new FileBackedOutputStream(threshold);<NEW_LINE>try (<MASK><NEW_LINE>Writer writer = new OutputStreamWriter(counter, UTF_8)) {<NEW_LINE>writeJsonPayload(payload, writer);<NEW_LINE>try (InputStream rawIn = os.asByteSource().openBufferedStream();<NEW_LINE>BufferedInputStream contentStream = new BufferedInputStream(rawIn)) {<NEW_LINE>Method createSessionMethod = ProtocolHandshake.class.getDeclaredMethod("createSession", HttpHandler.class, InputStream.class, long.class);<NEW_LINE>createSessionMethod.setAccessible(true);<NEW_LINE>// noinspection unchecked<NEW_LINE>return (Either<SessionNotCreatedException, Result>) createSessionMethod.invoke(this, client, contentStream, counter.getCount());<NEW_LINE>} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {<NEW_LINE>throw new WebDriverException(e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>os.reset();<NEW_LINE>}<NEW_LINE>} | CountingOutputStream counter = new CountingOutputStream(os); |
415,702 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>View view = inflater.inflate(R.layout.authflood_dialog, container);<NEW_LINE>getDialog().setTitle("AuthFlood Attack");<NEW_LINE>btnAuthFloodStart = (Button) view.findViewById(R.id.button_start_authflood);<NEW_LINE>cbAuthFloodIntelligent = (CheckBox) view.findViewById(R.id.cb_authflood_intelligent);<NEW_LINE>btnAuthFloodStart.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>attack = new AuthFloodAttack(ap, cbAuthFloodIntelligent.isChecked());<NEW_LINE>String ob = new <MASK><NEW_LINE>Intent intent = new Intent("de.tu_darmstadt.seemoo.nexmon.ATTACK_SERVICE");<NEW_LINE>intent.putExtra("ATTACK", ob);<NEW_LINE>intent.putExtra("ATTACK_TYPE", Attack.ATTACK_AUTH_FLOOD);<NEW_LINE>MyApplication.getAppContext().sendBroadcast(intent);<NEW_LINE>dismiss();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return view;<NEW_LINE>} | Gson().toJson(attack); |
1,663,379 | public double alpha(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry, double numeraireTime, double bondMaturity) {<NEW_LINE>double factor1 = Math.exp(-data.getMeanReversion() * numeraireTime) - Math.exp(-data.getMeanReversion() * bondMaturity);<NEW_LINE>double numerator = 2 * data.getMeanReversion() * data.getMeanReversion() * data.getMeanReversion();<NEW_LINE>int indexStart = Math.abs(Arrays.binarySearch(data.getVolatilityTime().toArray(), startExpiry) + 1);<NEW_LINE>// Period in which the time startExpiry is; volatilityTime.get(i-1) <= startExpiry < volatilityTime.get(i);<NEW_LINE>int indexEnd = Math.abs(Arrays.binarySearch(data.getVolatilityTime().toArray(), endExpiry) + 1);<NEW_LINE>// Period in which the time endExpiry is; volatilityTime.get(i-1) <= endExpiry < volatilityTime.get(i);<NEW_LINE>int sLen = indexEnd - indexStart + 1;<NEW_LINE>double[] s = new double[sLen + 1];<NEW_LINE>s[0] = startExpiry;<NEW_LINE>System.arraycopy(data.getVolatilityTime().toArray(), indexStart, s, 1, sLen - 1);<NEW_LINE>s[sLen] = endExpiry;<NEW_LINE>double factor2 = 0d;<NEW_LINE>double[] exp2as = new double[sLen + 1];<NEW_LINE>for (int loopperiod = 0; loopperiod < sLen + 1; loopperiod++) {<NEW_LINE>exp2as[loopperiod] = Math.exp(2 * data.getMeanReversion<MASK><NEW_LINE>}<NEW_LINE>for (int loopperiod = 0; loopperiod < sLen; loopperiod++) {<NEW_LINE>factor2 += data.getVolatility().get(loopperiod + indexStart - 1) * data.getVolatility().get(loopperiod + indexStart - 1) * (exp2as[loopperiod + 1] - exp2as[loopperiod]);<NEW_LINE>}<NEW_LINE>return factor1 * Math.sqrt(factor2 / numerator);<NEW_LINE>} | () * s[loopperiod]); |
856,968 | public void _parseDetails(ByteBuffer content) {<NEW_LINE>parseVersionAndFlags(content);<NEW_LINE>if ((getFlags() & 0x1) > 0) {<NEW_LINE>algorithmId = IsoTypeReader.readUInt24(content);<NEW_LINE><MASK><NEW_LINE>kid = new byte[16];<NEW_LINE>content.get(kid);<NEW_LINE>}<NEW_LINE>long numOfEntries = IsoTypeReader.readUInt32(content);<NEW_LINE>while (numOfEntries-- > 0) {<NEW_LINE>Entry e = new Entry();<NEW_LINE>e.iv = new byte[((getFlags() & 0x1) > 0) ? ivSize : 8];<NEW_LINE>content.get(e.iv);<NEW_LINE>if ((getFlags() & 0x2) > 0) {<NEW_LINE>int numOfPairs = IsoTypeReader.readUInt16(content);<NEW_LINE>e.pairs = new LinkedList<Entry.Pair>();<NEW_LINE>while (numOfPairs-- > 0) {<NEW_LINE>e.pairs.add(e.createPair(IsoTypeReader.readUInt16(content), IsoTypeReader.readUInt32(content)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>entries.add(e);<NEW_LINE>}<NEW_LINE>} | ivSize = IsoTypeReader.readUInt8(content); |
1,250,689 | public boolean handleHbResponse(FrontendHbResponse hbResponse, boolean isReplay) {<NEW_LINE>boolean isChanged = false;<NEW_LINE>if (hbResponse.getStatus() == HbStatus.OK) {<NEW_LINE>if (!isAlive && !isReplay && Config.edit_log_type.equalsIgnoreCase("bdb")) {<NEW_LINE>BDBHA bdbha = (BDBHA) Env.getCurrentEnv().getHaProtocol();<NEW_LINE>bdbha.removeUnReadyElectableNode(nodeName, Env.<MASK><NEW_LINE>}<NEW_LINE>isAlive = true;<NEW_LINE>version = hbResponse.getVersion();<NEW_LINE>queryPort = hbResponse.getQueryPort();<NEW_LINE>rpcPort = hbResponse.getRpcPort();<NEW_LINE>replayedJournalId = hbResponse.getReplayedJournalId();<NEW_LINE>lastUpdateTime = hbResponse.getHbTime();<NEW_LINE>heartbeatErrMsg = "";<NEW_LINE>isChanged = true;<NEW_LINE>} else {<NEW_LINE>if (isAlive) {<NEW_LINE>isAlive = false;<NEW_LINE>isChanged = true;<NEW_LINE>}<NEW_LINE>heartbeatErrMsg = hbResponse.getMsg() == null ? "Unknown error" : hbResponse.getMsg();<NEW_LINE>}<NEW_LINE>return isChanged;<NEW_LINE>} | getCurrentEnv().getFollowerCount()); |
1,270,452 | private static void make_go2_method(ClassWriter cw, String outer_name, String mname, String full_inner, int arity, boolean proc, int freevars, Type returnType, boolean isTailCall, boolean isPausable) {<NEW_LINE>if (isPausable) {<NEW_LINE>if (ModuleAnalyzer.log.isLoggable(Level.FINE)) {<NEW_LINE>ModuleAnalyzer.log.fine("not generating go2 (pausable) for " + full_inner);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MethodVisitor mv;<NEW_LINE>mv = cw.visitMethod(ACC_PUBLIC, "go2", GO_DESC, null, null);<NEW_LINE>mv.visitCode();<NEW_LINE>for (int i = 0; i < arity - freevars; i++) {<NEW_LINE>mv.visitVarInsn(ALOAD, 1);<NEW_LINE>mv.visitFieldInsn(GETFIELD, EPROC_NAME, "arg" + i, EOBJECT_DESC);<NEW_LINE>mv.visitVarInsn(ASTORE, i + 2);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < arity - freevars; i++) {<NEW_LINE>mv.visitVarInsn(ALOAD, 1);<NEW_LINE>mv.visitInsn(ACONST_NULL);<NEW_LINE>mv.visitFieldInsn(PUTFIELD, EPROC_NAME, "arg" + i, EOBJECT_DESC);<NEW_LINE>}<NEW_LINE>if (proc)<NEW_LINE>mv.visitVarInsn(ALOAD, 1);<NEW_LINE>for (int i = 0; i < arity - freevars; i++) {<NEW_LINE>mv.<MASK><NEW_LINE>}<NEW_LINE>for (int i = 0; i < freevars; i++) {<NEW_LINE>mv.visitVarInsn(ALOAD, 0);<NEW_LINE>mv.visitFieldInsn(GETFIELD, full_inner, "fv" + i, EOBJECT_DESC);<NEW_LINE>}<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, outer_name, mname, EUtil.getSignature(arity, proc, returnType));<NEW_LINE>mv.visitInsn(ARETURN);<NEW_LINE>mv.visitMaxs(arity + 2, arity + 2);<NEW_LINE>mv.visitEnd();<NEW_LINE>cw.visitEnd();<NEW_LINE>} | visitVarInsn(ALOAD, i + 2); |
1,631,517 | public void onCreate(Bundle savedInstanceState) {<NEW_LINE>this.requestWindowFeature(Window.FEATURE_NO_TITLE);<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.lt_trade_activity);<NEW_LINE>_mbwManager = MbwManager.getInstance(this.getApplication());<NEW_LINE>_ltManager = _mbwManager.getLocalTraderManager();<NEW_LINE>_btRefresh = findViewById(R.id.btRefresh);<NEW_LINE>_btChangePrice = findViewById(R.id.btChangePrice);<NEW_LINE>_etMessage = findViewById(R.id.etMessage);<NEW_LINE>_btSendMessage = findViewById(R.id.btSendMessage);<NEW_LINE>_btAccept = findViewById(R.id.btAccept);<NEW_LINE>_btCashReceived = findViewById(R.id.btCashReceived);<NEW_LINE>_btAbort = <MASK><NEW_LINE>_tvStatus = findViewById(R.id.tvStatus);<NEW_LINE>_tvOldStatus = findViewById(R.id.tvOldStatus);<NEW_LINE>_flConfidence = findViewById(R.id.flConfidence);<NEW_LINE>_pbConfidence = findViewById(R.id.pbConfidence);<NEW_LINE>_tvConfidence = findViewById(R.id.tvConfidence);<NEW_LINE>_btRefresh.setOnClickListener(refreshClickListener);<NEW_LINE>_btChangePrice.setOnClickListener(changePriceClickListener);<NEW_LINE>_etMessage.setOnEditorActionListener(editActionListener);<NEW_LINE>_btSendMessage.setOnClickListener(sendMessageClickListener);<NEW_LINE>_btAccept.setOnClickListener(acceptClickListener);<NEW_LINE>_btAbort.setOnClickListener(abortOrStopOrDeleteClickListener);<NEW_LINE>_btCashReceived.setOnClickListener(cashReceivedClickListener);<NEW_LINE>_updateSound = RingtoneManager.getRingtone(this, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));<NEW_LINE>_tradeSession = (TradeSession) getIntent().getSerializableExtra("tradeSession");<NEW_LINE>// We may have a more recent copy if the activity is re-created.<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>_tradeSession = (TradeSession) savedInstanceState.getSerializable("tradeSession");<NEW_LINE>}<NEW_LINE>_mbwManager.getLocalTraderManager().markViewed(_tradeSession);<NEW_LINE>_chatAdapter = new ChatAdapter(this, new ArrayList<ChatEntry>());<NEW_LINE>_lvChat = findViewById(R.id.lvChat);<NEW_LINE>_lvChat.setAdapter(_chatAdapter);<NEW_LINE>// to follow urls<NEW_LINE>_lvChat.setOnItemClickListener(chatItemClickListener);<NEW_LINE>// to copy to clipboard<NEW_LINE>_lvChat.setOnItemLongClickListener(chatLongClickListener);<NEW_LINE>Utils.showOptionalMessage(this, R.string.lt_cash_only_warning);<NEW_LINE>} | findViewById(R.id.btAbort); |
776,609 | private HttpRequest createRequest(HttpMethod method, String uri, MultiMap headerMap, String authority, boolean chunked, ByteBuf buf, boolean end) {<NEW_LINE>HttpRequest request = new DefaultHttpRequest(HttpUtils.toNettyHttpVersion(version), method.toNetty(), uri, false);<NEW_LINE>HttpHeaders headers = request.headers();<NEW_LINE>if (headerMap != null) {<NEW_LINE>for (Map.Entry<String, String> header : headerMap) {<NEW_LINE>headers.add(header.getKey(), header.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!headers.contains(HOST)) {<NEW_LINE>request.headers().set(HOST, authority);<NEW_LINE>} else {<NEW_LINE>headers.remove(TRANSFER_ENCODING);<NEW_LINE>}<NEW_LINE>if (chunked) {<NEW_LINE>HttpUtil.setTransferEncodingChunked(request, true);<NEW_LINE>}<NEW_LINE>if (options.isTryUseCompression() && request.headers().get(ACCEPT_ENCODING) == null) {<NEW_LINE>// if compression should be used but nothing is specified by the user support deflate and gzip.<NEW_LINE>request.headers(<MASK><NEW_LINE>}<NEW_LINE>if (!options.isKeepAlive() && options.getProtocolVersion() == io.vertx.core.http.HttpVersion.HTTP_1_1) {<NEW_LINE>request.headers().set(CONNECTION, CLOSE);<NEW_LINE>} else if (options.isKeepAlive() && options.getProtocolVersion() == io.vertx.core.http.HttpVersion.HTTP_1_0) {<NEW_LINE>request.headers().set(CONNECTION, KEEP_ALIVE);<NEW_LINE>}<NEW_LINE>if (end) {<NEW_LINE>if (buf != null) {<NEW_LINE>request = new AssembledFullHttpRequest(request, buf);<NEW_LINE>} else {<NEW_LINE>request = new AssembledFullHttpRequest(request);<NEW_LINE>}<NEW_LINE>} else if (buf != null) {<NEW_LINE>request = new AssembledHttpRequest(request, buf);<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | ).set(ACCEPT_ENCODING, DEFLATE_GZIP); |
967,017 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "create context SegmentedByString partition by theString from SupportBean;\n" + "@name('s0') context SegmentedByString select theString as c0, intPrimitive as c1, sum(longPrimitive) as c2 from SupportBean group by rollup(theString, intPrimitive)";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>String[] fields = "c0,c1,c2".split(",");<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(makeEvent<MASK><NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { "E1", 1, 10L }, { "E1", null, 10L }, { null, null, 10L } });<NEW_LINE>env.sendEventBean(makeEvent("E1", 2, 20));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { "E1", 2, 20L }, { "E1", null, 30L }, { null, null, 30L } });<NEW_LINE>env.milestone(1);<NEW_LINE>env.sendEventBean(makeEvent("E2", 1, 25));<NEW_LINE>env.assertPropsPerRowLastNew("s0", fields, new Object[][] { { "E2", 1, 25L }, { "E2", null, 25L }, { null, null, 25L } });<NEW_LINE>env.undeployAll();<NEW_LINE>} | ("E1", 1, 10)); |
835,066 | final ListPortfolioAccessResult executeListPortfolioAccess(ListPortfolioAccessRequest listPortfolioAccessRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listPortfolioAccessRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListPortfolioAccessRequest> request = null;<NEW_LINE>Response<ListPortfolioAccessResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListPortfolioAccessRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPortfolioAccessRequest));<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, "Service Catalog");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPortfolioAccess");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListPortfolioAccessResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPortfolioAccessResultJsonUnmarshaller());<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,554,070 | public void startServer() throws Exception {<NEW_LINE>IndexListServlet indexList = new IndexListServlet();<NEW_LINE>if (this.bindAddress != null) {<NEW_LINE>this.server = new Server(new InetSocketAddress(InetAddress.getByName(this.bindAddress), port));<NEW_LINE>} else {<NEW_LINE>this.server = new Server(this.port);<NEW_LINE>}<NEW_LINE>ServletContextHandler handler = new ServletContextHandler(this.server, pathPrefix);<NEW_LINE>handler.addServlet(<MASK><NEW_LINE>if (metricsRegistries != null) {<NEW_LINE>// TODO: there is a way to wire these up automagically via the AdminServlet, but it escapes me right now<NEW_LINE>handler.addServlet(new ServletHolder(new MetricsServlet(metricsRegistries.metricRegistry)), "/metrics");<NEW_LINE>handler.addServlet(new ServletHolder(new io.prometheus.client.exporter.MetricsServlet()), "/prometheus");<NEW_LINE>handler.addServlet(new ServletHolder(new HealthCheckServlet(metricsRegistries.healthCheckRegistry)), "/healthcheck");<NEW_LINE>handler.addServlet(new ServletHolder(new PingServlet()), "/ping");<NEW_LINE>indexList.addLink("/metrics", "codahale metrics");<NEW_LINE>indexList.addLink("/prometheus", "prometheus metrics");<NEW_LINE>indexList.addLink("/healthcheck", "healthcheck endpoint");<NEW_LINE>indexList.addLink("/ping", "ping me");<NEW_LINE>}<NEW_LINE>if (this.context.getConfig().enableHttpConfig) {<NEW_LINE>handler.addServlet(new ServletHolder(new MaxwellConfigServlet(this.context)), "/config");<NEW_LINE>indexList.addLink("/config", "POST endpoing to update maxwell config.");<NEW_LINE>}<NEW_LINE>if (diagnosticContext != null) {<NEW_LINE>handler.addServlet(new ServletHolder(new DiagnosticHealthCheck(diagnosticContext)), "/diagnostic");<NEW_LINE>indexList.addLink("/diagnostic", "deeper diagnostic health checks");<NEW_LINE>}<NEW_LINE>this.server.start();<NEW_LINE>this.server.join();<NEW_LINE>} | new ServletHolder(indexList), "/"); |
1,790,204 | private int transitionsBetween(ResultPoint from, ResultPoint to) {<NEW_LINE>// See QR Code Detector, sizeOfBlackWhiteBlackRun()<NEW_LINE>int fromX = (int) from.getX();<NEW_LINE>int fromY = (int) from.getY();<NEW_LINE>int toX = (int) to.getX();<NEW_LINE>int toY = Math.min(image.getHeight() - 1, (int) to.getY());<NEW_LINE>boolean steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);<NEW_LINE>if (steep) {<NEW_LINE>int temp = fromX;<NEW_LINE>fromX = fromY;<NEW_LINE>fromY = temp;<NEW_LINE>temp = toX;<NEW_LINE>toX = toY;<NEW_LINE>toY = temp;<NEW_LINE>}<NEW_LINE>int dx = Math.abs(toX - fromX);<NEW_LINE>int dy = Math.abs(toY - fromY);<NEW_LINE>int error = -dx / 2;<NEW_LINE>int ystep = <MASK><NEW_LINE>int xstep = fromX < toX ? 1 : -1;<NEW_LINE>int transitions = 0;<NEW_LINE>boolean inBlack = image.get(steep ? fromY : fromX, steep ? fromX : fromY);<NEW_LINE>for (int x = fromX, y = fromY; x != toX; x += xstep) {<NEW_LINE>boolean isBlack = image.get(steep ? y : x, steep ? x : y);<NEW_LINE>if (isBlack != inBlack) {<NEW_LINE>transitions++;<NEW_LINE>inBlack = isBlack;<NEW_LINE>}<NEW_LINE>error += dy;<NEW_LINE>if (error > 0) {<NEW_LINE>if (y == toY) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>y += ystep;<NEW_LINE>error -= dx;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return transitions;<NEW_LINE>} | fromY < toY ? 1 : -1; |
493,037 | public void endSection() {<NEW_LINE>if (this.profilingEnabled) {<NEW_LINE>if (stack.isEmpty()) {<NEW_LINE>StringBuilder b = new StringBuilder();<NEW_LINE>b.append("Profiler Underrun!\n");<NEW_LINE>b.append("Special mismatching start/end pairs:\n");<NEW_LINE>for (Element element : candidates) {<NEW_LINE>b.append("Section: " + element.name + "\n");<NEW_LINE>b.append("Starter: " + e2s(element.starter) + "\n");<NEW_LINE>b.append("Ender: " + e2s(element.ender) + "\n\n");<NEW_LINE>}<NEW_LINE>b.append("Last endSection()s:\n");<NEW_LINE>for (Element element : discarded) {<NEW_LINE>b.append("Section: " + element.name + "\n");<NEW_LINE>b.append("Starter: " + e2s(element.starter) + "\n");<NEW_LINE>b.append("Ender: " + e2s(element.ender) + "\n\n");<NEW_LINE>}<NEW_LINE>Log.error(b.toString());<NEW_LINE>throw new RuntimeException(b.toString());<NEW_LINE>}<NEW_LINE>Element element = stack.remove(0);<NEW_LINE>element.ender = new RuntimeException();<NEW_LINE>discarded.add(element);<NEW_LINE>while (discarded.size() > 3000) {<NEW_LINE>discarded.remove(0);<NEW_LINE>}<NEW_LINE>if (!getFirst(element.starter).equals(getFirst(element.ender))) {<NEW_LINE>candidates.add(element);<NEW_LINE>Log.warn("Mismatching startSection() and endSection() source for section " + element.name + "\nStarter: " + e2s(element.starter) + "\nEnder: " <MASK><NEW_LINE>while (candidates.size() > 100) {<NEW_LINE>candidates.remove(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>super.endSection();<NEW_LINE>}<NEW_LINE>} | + e2s(element.ender)); |
1,063,690 | private boolean apply(final MigrationConfig config, final Client ksqlClient, final String migrationsDir, final Clock clock) {<NEW_LINE>String previous = MetadataUtil.getLatestMigratedVersion(config, ksqlClient);<NEW_LINE>LOGGER.info("Loading migration files");<NEW_LINE>final List<MigrationFile> migrations;<NEW_LINE>try {<NEW_LINE>migrations = loadMigrationsToApply(migrationsDir, previous);<NEW_LINE>} catch (MigrationException e) {<NEW_LINE>LOGGER.<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (migrations.size() == 0) {<NEW_LINE>LOGGER.info("No eligible migrations found.");<NEW_LINE>} else {<NEW_LINE>LOGGER.info(migrations.size() + " migration file(s) loaded.");<NEW_LINE>}<NEW_LINE>for (MigrationFile migration : migrations) {<NEW_LINE>if (!applyMigration(config, ksqlClient, migration, clock, previous)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>previous = Integer.toString(migration.getVersion());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | error(e.getMessage()); |
1,606,893 | private static void removeReturn(SootMethod method) {<NEW_LINE>// check if this is a void method<NEW_LINE>if (!(method.getReturnType() instanceof VoidType)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// get the methodnode<NEW_LINE>if (!method.hasActiveBody()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Chain units = ((DavaBody) method.<MASK><NEW_LINE>if (units.size() != 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ASTNode AST = (ASTNode) units.getFirst();<NEW_LINE>if (!(AST instanceof ASTMethodNode)) {<NEW_LINE>throw new RuntimeException("Starting node of DavaBody AST is not an ASTMethodNode");<NEW_LINE>}<NEW_LINE>ASTMethodNode node = (ASTMethodNode) AST;<NEW_LINE>// check there is only 1 subBody<NEW_LINE>List<Object> subBodies = node.get_SubBodies();<NEW_LINE>if (subBodies.size() != 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List subBody = (List) subBodies.get(0);<NEW_LINE>// see if the last of this is a stmtseq node<NEW_LINE>if (subBody.size() == 0) {<NEW_LINE>// nothing inside subBody<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// check last node is a ASTStatementSequenceNode<NEW_LINE>ASTNode last = (ASTNode) subBody.get(subBody.size() - 1);<NEW_LINE>if (!(last instanceof ASTStatementSequenceNode)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// get last statement<NEW_LINE>List<AugmentedStmt> stmts = ((ASTStatementSequenceNode) last).getStatements();<NEW_LINE>if (stmts.size() == 0) {<NEW_LINE>// no stmts inside statement sequence node<NEW_LINE>subBody.remove(subBody.size() - 1);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AugmentedStmt lastas = (AugmentedStmt) stmts.get(stmts.size() - 1);<NEW_LINE>Stmt lastStmt = lastas.get_Stmt();<NEW_LINE>if (!(lastStmt instanceof ReturnVoidStmt)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// we can remove the lastStmt<NEW_LINE>stmts.remove(stmts.size() - 1);<NEW_LINE>if (stmts.size() == 0) {<NEW_LINE>subBody.remove(subBody.size() - 1);<NEW_LINE>}<NEW_LINE>} | getActiveBody()).getUnits(); |
877,843 | static boolean compareLessThanEqual(Object left, Object right) {<NEW_LINE>Class<?> leftClass = left == null ? null : left.getClass();<NEW_LINE>Class<?> rightClass = right == null <MASK><NEW_LINE>if (leftClass == Integer.class && rightClass == Integer.class) {<NEW_LINE>return (Integer) left <= (Integer) right;<NEW_LINE>}<NEW_LINE>if (leftClass == Double.class && rightClass == Double.class) {<NEW_LINE>return (Double) left <= (Double) right;<NEW_LINE>}<NEW_LINE>if (leftClass == Long.class && rightClass == Long.class) {<NEW_LINE>return (Long) left <= (Long) right;<NEW_LINE>}<NEW_LINE>// -- compare memory unit<NEW_LINE>if (left instanceof MemoryUnit) {<NEW_LINE>if (right == null)<NEW_LINE>return false;<NEW_LINE>return MemoryUnit.compareTo((MemoryUnit) left, right) <= 0;<NEW_LINE>}<NEW_LINE>if (right instanceof MemoryUnit) {<NEW_LINE>if (left == null)<NEW_LINE>return false;<NEW_LINE>return MemoryUnit.compareTo((MemoryUnit) right, left) >= 0;<NEW_LINE>}<NEW_LINE>// -- compare duration<NEW_LINE>if (left instanceof Duration) {<NEW_LINE>if (right == null)<NEW_LINE>return false;<NEW_LINE>return Duration.compareTo((Duration) left, right) <= 0;<NEW_LINE>}<NEW_LINE>if (right instanceof Duration) {<NEW_LINE>if (left == null)<NEW_LINE>return false;<NEW_LINE>return Duration.compareTo((Duration) right, left) >= 0;<NEW_LINE>}<NEW_LINE>// -- fallback on default<NEW_LINE>return ScriptBytecodeAdapter.compareTo(left, right) <= 0;<NEW_LINE>} | ? null : right.getClass(); |
1,191,002 | public void start() {<NEW_LINE>SmithLogger.logger.info("probe client start");<NEW_LINE>try {<NEW_LINE>Bootstrap b = new Bootstrap();<NEW_LINE>b.group(group).channel(EpollDomainSocketChannel.class).handler(new ChannelInitializer<DomainSocketChannel>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void initChannel(DomainSocketChannel ch) {<NEW_LINE>ChannelPipeline p = ch.pipeline();<NEW_LINE>p.addLast(new IdleStateHandler(READ_TIME_OUT, 0, 0, TimeUnit.SECONDS));<NEW_LINE>p.addLast(new ProtocolBufferDecoder());<NEW_LINE>p.addLast(new ProtocolBufferEncoder());<NEW_LINE>p.addLast(new ProbeClientHandler(ProbeClient.this));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>channel = b.connect(new DomainSocketAddress("/var/run/smith_agent.sock")).addListener((ChannelFuture f) -> {<NEW_LINE>if (!f.isSuccess()) {<NEW_LINE>f.channel().eventLoop().schedule(this::reconnect, RECONNECT_SCHEDULE, TimeUnit.SECONDS);<NEW_LINE>}<NEW_LINE>}).sync().channel();<NEW_LINE>channel<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>SmithLogger.exception(e);<NEW_LINE>}<NEW_LINE>} | .closeFuture().sync(); |
987,734 | public static DescribeNASFileSystemsResponse unmarshall(DescribeNASFileSystemsResponse describeNASFileSystemsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeNASFileSystemsResponse.setRequestId(_ctx.stringValue("DescribeNASFileSystemsResponse.RequestId"));<NEW_LINE>describeNASFileSystemsResponse.setNextToken(_ctx.stringValue("DescribeNASFileSystemsResponse.NextToken"));<NEW_LINE>List<FileSystem> fileSystems = new ArrayList<FileSystem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeNASFileSystemsResponse.FileSystems.Length"); i++) {<NEW_LINE>FileSystem fileSystem = new FileSystem();<NEW_LINE>fileSystem.setCapacity(_ctx.longValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].Capacity"));<NEW_LINE>fileSystem.setMountTargetStatus(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].MountTargetStatus"));<NEW_LINE>fileSystem.setCreateTime(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].CreateTime"));<NEW_LINE>fileSystem.setOfficeSiteId(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].OfficeSiteId"));<NEW_LINE>fileSystem.setSupportAcl(_ctx.booleanValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].SupportAcl"));<NEW_LINE>fileSystem.setStorageType(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].StorageType"));<NEW_LINE>fileSystem.setOfficeSiteName(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].OfficeSiteName"));<NEW_LINE>fileSystem.setRegionId(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].RegionId"));<NEW_LINE>fileSystem.setFileSystemId(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].FileSystemId"));<NEW_LINE>fileSystem.setFileSystemType(_ctx.stringValue<MASK><NEW_LINE>fileSystem.setFileSystemName(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].FileSystemName"));<NEW_LINE>fileSystem.setMeteredSize(_ctx.longValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].MeteredSize"));<NEW_LINE>fileSystem.setMountTargetDomain(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].MountTargetDomain"));<NEW_LINE>fileSystem.setDescription(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].Description"));<NEW_LINE>fileSystem.setZoneId(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].ZoneId"));<NEW_LINE>fileSystem.setFileSystemStatus(_ctx.stringValue("DescribeNASFileSystemsResponse.FileSystems[" + i + "].FileSystemStatus"));<NEW_LINE>fileSystems.add(fileSystem);<NEW_LINE>}<NEW_LINE>describeNASFileSystemsResponse.setFileSystems(fileSystems);<NEW_LINE>return describeNASFileSystemsResponse;<NEW_LINE>} | ("DescribeNASFileSystemsResponse.FileSystems[" + i + "].FileSystemType")); |
24,691 | public void showIssue(final Issue issue) {<NEW_LINE>setToolbarTitle(getString(R.string.issue).concat(" #").concat(String.valueOf(issue.getNumber())));<NEW_LINE>GlideApp.with(getActivity()).load(issue.getUser().getAvatarUrl()).onlyRetrieveFromCache(!PrefUtils.isLoadImageEnable()).into(userImageView);<NEW_LINE>issueTitle.<MASK><NEW_LINE>commentBn.setVisibility(issue.isLocked() ? View.GONE : View.VISIBLE);<NEW_LINE>String commentStr = String.valueOf(issue.getCommentNum()).concat(" ").concat(getString(R.string.comments).toLowerCase());<NEW_LINE>if (Issue.IssueState.open.equals(issue.getState())) {<NEW_LINE>issueStateImg.setImageResource(R.drawable.ic_issues);<NEW_LINE>issueStateText.setText(getString(R.string.open).concat(" ").concat(commentStr));<NEW_LINE>} else {<NEW_LINE>issueStateImg.setImageResource(R.drawable.ic_issues_closed);<NEW_LINE>issueStateText.setText(getString(R.string.closed).concat(" ").concat(commentStr));<NEW_LINE>}<NEW_LINE>invalidateOptionsMenu();<NEW_LINE>if (issueTimelineFragment == null) {<NEW_LINE>issueTimelineFragment = IssueTimelineFragment.create(issue);<NEW_LINE>new Handler().postDelayed(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (!isAlive)<NEW_LINE>return;<NEW_LINE>getSupportFragmentManager().beginTransaction().add(R.id.container, issueTimelineFragment).commitAllowingStateLoss();<NEW_LINE>}<NEW_LINE>}, 500);<NEW_LINE>issueTimelineFragment.setListScrollListener(this);<NEW_LINE>}<NEW_LINE>String loggedUser = AppData.INSTANCE.getLoggedUser().getLogin();<NEW_LINE>boolean editAble = loggedUser.equals(issue.getUser().getLogin()) || loggedUser.equals(issue.getRepoAuthorName());<NEW_LINE>editBn.setVisibility(editAble ? View.VISIBLE : View.GONE);<NEW_LINE>commentBn.setVisibility(View.VISIBLE);<NEW_LINE>} | setText(issue.getTitle()); |
670,328 | public static void storeWhiteboardPenColor(Context context, long did, boolean isLight, Integer value) {<NEW_LINE>openDBIfClosed(context);<NEW_LINE>String columnName = isLight ? "lightpencolor" : "darkpencolor";<NEW_LINE>try (Cursor cur = mMetaDb.rawQuery("SELECT _id FROM whiteboardState WHERE did = ?", new String[] { Long.toString(did) })) {<NEW_LINE>if (cur.moveToNext()) {<NEW_LINE>mMetaDb.execSQL("UPDATE whiteboardState SET did = ?, " + columnName + "= ? " + " WHERE _id=?;", new Object[] { did, value, cur.getString(0) });<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>mMetaDb.execSQL(sql, new Object[] { did, value });<NEW_LINE>}<NEW_LINE>Timber.d("Store whiteboard %s (%d) for deck %d", columnName, value, did);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Timber.w(e, "Error storing whiteboard color in MetaDB");<NEW_LINE>}<NEW_LINE>} | String sql = "INSERT INTO whiteboardState (did, " + columnName + ") VALUES (?, ?)"; |
918,515 | public UpdateThingGroupResult updateThingGroup(UpdateThingGroupRequest updateThingGroupRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateThingGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateThingGroupRequest> request = null;<NEW_LINE>Response<UpdateThingGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateThingGroupRequestMarshaller().marshall(updateThingGroupRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<UpdateThingGroupResult, JsonUnmarshallerContext> unmarshaller = new UpdateThingGroupResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<UpdateThingGroupResult> responseHandler = new JsonResponseHandler<UpdateThingGroupResult>(unmarshaller);<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
442,511 | public static Object[] extractRowFromDataTable(DataTable dataTable, int rowId) {<NEW_LINE>DataSchema dataSchema = dataTable.getDataSchema();<NEW_LINE>ColumnDataType[] storedColumnDataTypes = dataSchema.getStoredColumnDataTypes();<NEW_LINE>int numColumns = storedColumnDataTypes.length;<NEW_LINE>Object[] row = new Object[numColumns];<NEW_LINE>for (int i = 0; i < numColumns; i++) {<NEW_LINE>switch(storedColumnDataTypes[i]) {<NEW_LINE>// Single-value column<NEW_LINE>case INT:<NEW_LINE>row[i] = dataTable.getInt(rowId, i);<NEW_LINE>break;<NEW_LINE>case LONG:<NEW_LINE>row[i] = dataTable.getLong(rowId, i);<NEW_LINE>break;<NEW_LINE>case FLOAT:<NEW_LINE>row[i] = dataTable.getFloat(rowId, i);<NEW_LINE>break;<NEW_LINE>case DOUBLE:<NEW_LINE>row[i] = dataTable.getDouble(rowId, i);<NEW_LINE>break;<NEW_LINE>case STRING:<NEW_LINE>row[i] = <MASK><NEW_LINE>break;<NEW_LINE>case BYTES:<NEW_LINE>row[i] = dataTable.getBytes(rowId, i);<NEW_LINE>break;<NEW_LINE>// Multi-value column<NEW_LINE>case INT_ARRAY:<NEW_LINE>row[i] = dataTable.getIntArray(rowId, i);<NEW_LINE>break;<NEW_LINE>case LONG_ARRAY:<NEW_LINE>row[i] = dataTable.getLongArray(rowId, i);<NEW_LINE>break;<NEW_LINE>case FLOAT_ARRAY:<NEW_LINE>row[i] = dataTable.getFloatArray(rowId, i);<NEW_LINE>break;<NEW_LINE>case DOUBLE_ARRAY:<NEW_LINE>row[i] = dataTable.getDoubleArray(rowId, i);<NEW_LINE>break;<NEW_LINE>case STRING_ARRAY:<NEW_LINE>row[i] = dataTable.getStringArray(rowId, i);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException(String.format("Unsupported data type: %s for column: %s", storedColumnDataTypes[i], dataSchema.getColumnName(i)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return row;<NEW_LINE>} | dataTable.getString(rowId, i); |
1,108,079 | public static byte[] generateCreate2ContractAddress(byte[] address, byte[] salt, byte[] initCode) {<NEW_LINE>if (address.length != ADDRESS_BYTE_SIZE) {<NEW_LINE>throw new RuntimeException("Invalid address size");<NEW_LINE>}<NEW_LINE>if (salt.length != SALT_SIZE) {<NEW_LINE>throw new RuntimeException("Invalid salt size");<NEW_LINE>}<NEW_LINE>byte[] hashedInitCode = Hash.sha3(initCode);<NEW_LINE>byte[] buffer = new byte[1 + address.length + salt.length + hashedInitCode.length];<NEW_LINE>buffer[0] = (byte) 0xff;<NEW_LINE>int offset = 1;<NEW_LINE>System.arraycopy(address, 0, buffer, offset, address.length);<NEW_LINE>offset += address.length;<NEW_LINE>System.arraycopy(salt, 0, buffer, offset, salt.length);<NEW_LINE>offset += salt.length;<NEW_LINE>System.arraycopy(hashedInitCode, 0, <MASK><NEW_LINE>byte[] hashed = Hash.sha3(buffer);<NEW_LINE>return Arrays.copyOfRange(hashed, 12, hashed.length);<NEW_LINE>} | buffer, offset, hashedInitCode.length); |
540,423 | public synchronized void unlockExclusive() {<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "unlockExclusive", this);<NEW_LINE>// Synchronize on the locking Mutex.<NEW_LINE>synchronized (iMutex) {<NEW_LINE>// Only release the lock if the holder is the current thread.<NEW_LINE>if (Thread.currentThread() == iExclusiveLockHolder) {<NEW_LINE>if (tc.isDebugEnabled())<NEW_LINE>SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1));<NEW_LINE>// Decrement the exclusive lock count,<NEW_LINE>// if the count reaches 0 then we know that<NEW_LINE>// we can safely remove the exclusive lock<NEW_LINE>if (--iExclusiveLockCount == 0) {<NEW_LINE>// Set the flag to indicate that the exclusive lock<NEW_LINE>// has been released.<NEW_LINE>iExclusivelyLocked = false;<NEW_LINE>// Set the exclusive lock holder thread to be null<NEW_LINE>iExclusiveLockHolder = null;<NEW_LINE>// Notify any threads waiting for this lock.<NEW_LINE>notifyAll();<NEW_LINE>}<NEW_LINE>} else if (tc.isDebugEnabled())<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "unlockExclusive");<NEW_LINE>} | SibTr.debug(tc, "Thread not the current thread to unlock exclusively"); |
706,573 | private VpnProfile VpnProfileFromCursor(Cursor cursor) {<NEW_LINE>VpnProfile profile = new VpnProfile();<NEW_LINE>profile.setId(cursor.getLong(cursor.getColumnIndex(KEY_ID)));<NEW_LINE>profile.setUUID(UUID.fromString(cursor.getString(cursor.getColumnIndex(KEY_UUID))));<NEW_LINE>profile.setName(cursor.getString(cursor.getColumnIndex(KEY_NAME)));<NEW_LINE>profile.setGateway(cursor.getString(cursor.getColumnIndex(KEY_GATEWAY)));<NEW_LINE>profile.setVpnType(VpnType.fromIdentifier(cursor.getString(cursor.getColumnIndex(KEY_VPN_TYPE))));<NEW_LINE>profile.setUsername(cursor.getString(cursor.getColumnIndex(KEY_USERNAME)));<NEW_LINE>profile.setPassword(cursor.getString(cursor.getColumnIndex(KEY_PASSWORD)));<NEW_LINE>profile.setCertificateAlias(cursor.getString(cursor.getColumnIndex(KEY_CERTIFICATE)));<NEW_LINE>profile.setUserCertificateAlias(cursor.getString(cursor.getColumnIndex(KEY_USER_CERTIFICATE)));<NEW_LINE>profile.setMTU(getInt(cursor, cursor.getColumnIndex(KEY_MTU)));<NEW_LINE>profile.setPort(getInt(cursor, cursor.getColumnIndex(KEY_PORT)));<NEW_LINE>profile.setSplitTunneling(getInt(cursor, cursor.getColumnIndex(KEY_SPLIT_TUNNELING)));<NEW_LINE>profile.setLocalId(cursor.getString(cursor.getColumnIndex(KEY_LOCAL_ID)));<NEW_LINE>profile.setRemoteId(cursor.getString(cursor.getColumnIndex(KEY_REMOTE_ID)));<NEW_LINE>profile.setExcludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_EXCLUDED_SUBNETS)));<NEW_LINE>profile.setIncludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_INCLUDED_SUBNETS)));<NEW_LINE>profile.setSelectedAppsHandling(getInt(cursor, <MASK><NEW_LINE>profile.setSelectedApps(cursor.getString(cursor.getColumnIndex(KEY_SELECTED_APPS_LIST)));<NEW_LINE>profile.setNATKeepAlive(getInt(cursor, cursor.getColumnIndex(KEY_NAT_KEEPALIVE)));<NEW_LINE>profile.setFlags(getInt(cursor, cursor.getColumnIndex(KEY_FLAGS)));<NEW_LINE>profile.setIkeProposal(cursor.getString(cursor.getColumnIndex(KEY_IKE_PROPOSAL)));<NEW_LINE>profile.setEspProposal(cursor.getString(cursor.getColumnIndex(KEY_ESP_PROPOSAL)));<NEW_LINE>profile.setDnsServers(cursor.getString(cursor.getColumnIndex(KEY_DNS_SERVERS)));<NEW_LINE>return profile;<NEW_LINE>} | cursor.getColumnIndex(KEY_SELECTED_APPS))); |
354,553 | public static Collection<RegressionExecution> executions() {<NEW_LINE>ArrayList<RegressionExecution> execs = new ArrayList<>();<NEW_LINE>execs.add(new ContextNestedWithFilterUDF());<NEW_LINE>execs.add(new ContextNestedIterateTargetedCP());<NEW_LINE>execs.add(new ContextNestedInvalid());<NEW_LINE>execs.add(new ContextNestedIterator());<NEW_LINE>execs.add(new ContextNestedPartitionedWithFilterOverlap());<NEW_LINE>execs.add(new ContextNestedPartitionedWithFilterNonOverlap());<NEW_LINE>execs.add(new ContextNestedNestingFilterCorrectness());<NEW_LINE>execs.add(new ContextNestedCategoryOverPatternInitiated());<NEW_LINE>execs.add(new ContextNestedSingleEventTriggerNested());<NEW_LINE>execs.add(new ContextNestedFourContextsNested());<NEW_LINE>execs.add(new ContextNestedTemporalOverCategoryOverPartition());<NEW_LINE>execs.add(new ContextNestedTemporalFixedOverHash());<NEW_LINE>execs.add(new ContextNestedCategoryOverTemporalOverlapping());<NEW_LINE>execs.add(new ContextNestedFixedTemporalOverPartitioned());<NEW_LINE>execs.add(new ContextNestedPartitionedOverFixedTemporal());<NEW_LINE>execs.add(new ContextNestedContextProps());<NEW_LINE>execs.add(new ContextNestedLateComingStatement());<NEW_LINE>execs.add(new ContextNestedPartitionWithMultiPropsAndTerm());<NEW_LINE>execs.add(new ContextNestedOverlappingAndPattern());<NEW_LINE>execs.add(new ContextNestedNonOverlapping());<NEW_LINE>execs.add(new ContextNestedPartitionedOverPatternInitiated());<NEW_LINE>execs.add(new ContextNestedInitWStartNow());<NEW_LINE>execs.add(new ContextNestedInitWStartNowSceneTwo());<NEW_LINE>execs.add(new ContextNestedKeyedStartStop());<NEW_LINE>execs.add(new ContextNestedKeyedFilter());<NEW_LINE>execs.add(new ContextNestedNonOverlapOverNonOverlapNoEndCondition(false));<NEW_LINE>execs.add(new ContextNestedNonOverlapOverNonOverlapNoEndCondition(true));<NEW_LINE>execs.add(new ContextNestedInitTermWCategoryWHash());<NEW_LINE>execs.add(new ContextNestedInitTermOverHashIterate(true));<NEW_LINE>execs.add(new ContextNestedInitTermOverHashIterate(false));<NEW_LINE>execs<MASK><NEW_LINE>execs.add(new ContextNestedInitTermOverCategoryIterate());<NEW_LINE>execs.add(new ContextNestedInitTermOverInitTermIterate());<NEW_LINE>execs.add(new ContextNestedCategoryOverInitTermDistinct());<NEW_LINE>execs.add(new ContextNestedKeySegmentedWInitTermEndEvent());<NEW_LINE>execs.add(new ContextNestedTemporalOverlapOverPartition());<NEW_LINE>return execs;<NEW_LINE>} | .add(new ContextNestedInitTermOverPartitionedIterate()); |
183,484 | public void marshall(CreateCustomDataIdentifierRequest createCustomDataIdentifierRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createCustomDataIdentifierRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getClientToken(), CLIENTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getIgnoreWords(), IGNOREWORDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getKeywords(), KEYWORDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getMaximumMatchDistance(), MAXIMUMMATCHDISTANCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getSeverityLevels(), SEVERITYLEVELS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createCustomDataIdentifierRequest.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createCustomDataIdentifierRequest.getRegex(), REGEX_BINDING); |
305,350 | public boolean execute(CommandSender sender, String commandLabel, String[] args) {<NEW_LINE>if (!this.testPermission(sender)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (args.length == 0) {<NEW_LINE>sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String name;<NEW_LINE>if (sender instanceof Player) {<NEW_LINE>name = ((<MASK><NEW_LINE>} else {<NEW_LINE>name = sender.getName();<NEW_LINE>}<NEW_LINE>StringBuilder msg = new StringBuilder();<NEW_LINE>for (String arg : args) {<NEW_LINE>msg.append(arg).append(" ");<NEW_LINE>}<NEW_LINE>if (msg.length() > 0) {<NEW_LINE>msg = new StringBuilder(msg.substring(0, msg.length() - 1));<NEW_LINE>}<NEW_LINE>sender.getServer().broadcastMessage(new TranslationContainer("chat.type.emote", name, TextFormat.WHITE + msg.toString()));<NEW_LINE>return true;<NEW_LINE>} | Player) sender).getDisplayName(); |
1,556,384 | public static GetTemplateResponse unmarshall(GetTemplateResponse getTemplateResponse, UnmarshallerContext _ctx) {<NEW_LINE>getTemplateResponse.setRequestId(_ctx.stringValue("GetTemplateResponse.RequestId"));<NEW_LINE>getTemplateResponse.setTemplateARN(_ctx.stringValue("GetTemplateResponse.TemplateARN"));<NEW_LINE>getTemplateResponse.setDescription(_ctx.stringValue("GetTemplateResponse.Description"));<NEW_LINE>getTemplateResponse.setResourceGroupId(_ctx.stringValue("GetTemplateResponse.ResourceGroupId"));<NEW_LINE>getTemplateResponse.setStackGroupName(_ctx.stringValue("GetTemplateResponse.StackGroupName"));<NEW_LINE>getTemplateResponse.setCreateTime(_ctx.stringValue("GetTemplateResponse.CreateTime"));<NEW_LINE>getTemplateResponse.setTemplateVersion(_ctx.stringValue("GetTemplateResponse.TemplateVersion"));<NEW_LINE>getTemplateResponse.setTemplateBody(_ctx.stringValue("GetTemplateResponse.TemplateBody"));<NEW_LINE>getTemplateResponse.setChangeSetId<MASK><NEW_LINE>getTemplateResponse.setOwnerId(_ctx.stringValue("GetTemplateResponse.OwnerId"));<NEW_LINE>getTemplateResponse.setUpdateTime(_ctx.stringValue("GetTemplateResponse.UpdateTime"));<NEW_LINE>getTemplateResponse.setTemplateName(_ctx.stringValue("GetTemplateResponse.TemplateName"));<NEW_LINE>getTemplateResponse.setRegionId(_ctx.stringValue("GetTemplateResponse.RegionId"));<NEW_LINE>getTemplateResponse.setTemplateId(_ctx.stringValue("GetTemplateResponse.TemplateId"));<NEW_LINE>getTemplateResponse.setShareType(_ctx.stringValue("GetTemplateResponse.ShareType"));<NEW_LINE>getTemplateResponse.setStackId(_ctx.stringValue("GetTemplateResponse.StackId"));<NEW_LINE>List<Permission> permissions = new ArrayList<Permission>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetTemplateResponse.Permissions.Length"); i++) {<NEW_LINE>Permission permission = new Permission();<NEW_LINE>permission.setShareOption(_ctx.stringValue("GetTemplateResponse.Permissions[" + i + "].ShareOption"));<NEW_LINE>permission.setAccountId(_ctx.stringValue("GetTemplateResponse.Permissions[" + i + "].AccountId"));<NEW_LINE>permission.setTemplateVersion(_ctx.stringValue("GetTemplateResponse.Permissions[" + i + "].TemplateVersion"));<NEW_LINE>permission.setVersionOption(_ctx.stringValue("GetTemplateResponse.Permissions[" + i + "].VersionOption"));<NEW_LINE>permissions.add(permission);<NEW_LINE>}<NEW_LINE>getTemplateResponse.setPermissions(permissions);<NEW_LINE>return getTemplateResponse;<NEW_LINE>} | (_ctx.stringValue("GetTemplateResponse.ChangeSetId")); |
680,271 | public void finish() {<NEW_LINE>wizard.completed = true;<NEW_LINE><MASK><NEW_LINE>if (upLimit > 0) {<NEW_LINE>COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, false);<NEW_LINE>COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY, false);<NEW_LINE>COConfigurationManager.setParameter("Max Upload Speed KBs", upLimit / DisplayFormatters.getKinB());<NEW_LINE>COConfigurationManager.setParameter("enable.seedingonly.upload.rate", false);<NEW_LINE>COConfigurationManager.setParameter("max active torrents", wizard.maxActiveTorrents);<NEW_LINE>COConfigurationManager.setParameter("max downloads", wizard.maxDownloads);<NEW_LINE>try {<NEW_LINE>SpeedManager sm = CoreFactory.getSingleton().getSpeedManager();<NEW_LINE>boolean is_manual = wizard.isUploadLimitManual();<NEW_LINE>sm.setEstimatedUploadCapacityBytesPerSec(upLimit, is_manual ? SpeedManagerLimitEstimate.TYPE_MANUAL : SpeedManagerLimitEstimate.TYPE_MEASURED);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.out(e);<NEW_LINE>}<NEW_LINE>// toggle to ensure listeners get the message that they should recalc things<NEW_LINE>COConfigurationManager.setParameter("Auto Adjust Transfer Defaults", false);<NEW_LINE>COConfigurationManager.setParameter("Auto Adjust Transfer Defaults", true);<NEW_LINE>}<NEW_LINE>if (wizard.getWizardMode() != ConfigureWizard.WIZARD_MODE_FULL) {<NEW_LINE>wizard.close();<NEW_LINE>} else {<NEW_LINE>COConfigurationManager.setParameter("TCP.Listen.Port", wizard.serverTCPListenPort);<NEW_LINE>COConfigurationManager.setParameter("UDP.Listen.Port", wizard.serverUDPListenPort);<NEW_LINE>COConfigurationManager.setParameter("UDP.NonData.Listen.Port", wizard.serverUDPListenPort);<NEW_LINE>COConfigurationManager.setParameter("General_sDefaultTorrent_Directory", wizard.torrentPath);<NEW_LINE>if (wizard.hasDataPathChanged()) {<NEW_LINE>COConfigurationManager.setParameter("Default save path", wizard.getDataPath());<NEW_LINE>}<NEW_LINE>COConfigurationManager.setParameter("Wizard Completed", true);<NEW_LINE>COConfigurationManager.save();<NEW_LINE>wizard.switchToClose();<NEW_LINE>}<NEW_LINE>} | int upLimit = wizard.getUploadLimit(); |
1,833,433 | protected boolean deleteGatewayAssets(List<String> assetIds) {<NEW_LINE>if (!isConnected() || isInitialSyncInProgress()) {<NEW_LINE>String msg = "Gateway is not connected or initial sync in progress so cannot delete asset(s): Gateway ID=" + gatewayId + ", Asset<?> IDs=" + Arrays.toString(assetIds.toArray());<NEW_LINE>LOG.info(msg);<NEW_LINE>throw new IllegalStateException(msg);<NEW_LINE>}<NEW_LINE>synchronized (pendingAssetDelete) {<NEW_LINE>if (pendingAssetDelete.get() != null) {<NEW_LINE>String msg = "Gateway asset delete already pending: Gateway ID=" + gatewayId + ", Asset<?> IDs Mapped=" + Arrays.toString(pendingAssetDelete.get().getEvent().getAssetIds().toArray());<NEW_LINE>LOG.info(msg);<NEW_LINE>throw new IllegalStateException(msg);<NEW_LINE>}<NEW_LINE>List<String> originalIds = assetIds.stream().map(id -> mapAssetId(gatewayId, id, true)).collect(Collectors.toList());<NEW_LINE>pendingAssetDelete.set(new EventRequestResponseWrapper<>(UniqueIdentifierGenerator.generateId(), new DeleteAssetsRequestEvent(new ArrayList<>(originalIds))));<NEW_LINE>try {<NEW_LINE>sendMessageToGateway(pendingAssetDelete.get());<NEW_LINE>pendingAssetDelete.wait(ASSET_CRUD_TIMEOUT_MILLIS);<NEW_LINE>if (pendingAssetDelete.get() != null) {<NEW_LINE>throw new IllegalStateException("Gateway asset delete failed: Gateway ID=" + gatewayId + ", Asset<?> IDs=" + originalIds + ", Asset<?> IDs Mapped=" + Arrays.toString<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>String msg = "Gateway asset delete interrupted: Gateway ID=" + gatewayId + ", Asset<?> IDs=" + originalIds + ", Asset<?> IDs Mapped=" + Arrays.toString(assetIds.toArray());<NEW_LINE>LOG.info(msg);<NEW_LINE>throw new IllegalStateException(msg);<NEW_LINE>} finally {<NEW_LINE>pendingAssetDelete.set(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (assetIds.toArray())); |
396,095 | public View render(RenderedAdaptiveCard renderedCard, Context context, FragmentManager fragmentManager, ViewGroup viewGroup, BaseCardElement baseCardElement, ICardActionHandler cardActionHandler, HostConfig hostConfig, RenderArgs renderArgs) throws Exception {<NEW_LINE>ImageSet imageSet = Util.castTo(baseCardElement, ImageSet.class);<NEW_LINE>IBaseCardElementRenderer imageRenderer = CardRendererRegistration.getInstance().getRenderer(CardElementType.Image.toString());<NEW_LINE>if (imageRenderer == null) {<NEW_LINE>throw new IllegalArgumentException("No renderer registered for: " + CardElementType.Image.toString());<NEW_LINE>}<NEW_LINE>HorizontalFlowLayout horizFlowLayout = new HorizontalFlowLayout(context);<NEW_LINE>horizFlowLayout.setTag(new TagContent(imageSet));<NEW_LINE>setVisibility(<MASK><NEW_LINE>ImageSize imageSize = imageSet.GetImageSize();<NEW_LINE>ImageVector imageVector = imageSet.GetImages();<NEW_LINE>long imageVectorSize = imageVector.size();<NEW_LINE>for (int i = 0; i < imageVectorSize; i++) {<NEW_LINE>Image image = imageVector.get(i);<NEW_LINE>// TODO: temporary - this will be handled in the object model<NEW_LINE>if (imageSize != ImageSize.Small && imageSize != ImageSize.Medium && imageSize != ImageSize.Large) {<NEW_LINE>imageSize = ImageSize.Medium;<NEW_LINE>}<NEW_LINE>image.SetImageSize(imageSize);<NEW_LINE>try {<NEW_LINE>View imageView = imageRenderer.render(renderedCard, context, fragmentManager, horizFlowLayout, image, cardActionHandler, hostConfig, renderArgs);<NEW_LINE>((ImageView) imageView).setMaxHeight(Util.dpToPixels(context, hostConfig.GetImageSet().getMaxImageHeight()));<NEW_LINE>} catch (AdaptiveFallbackException e) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (imageSet.GetHeight() == HeightType.Stretch) {<NEW_LINE>viewGroup.addView(horizFlowLayout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1));<NEW_LINE>} else {<NEW_LINE>viewGroup.addView(horizFlowLayout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));<NEW_LINE>}<NEW_LINE>return horizFlowLayout;<NEW_LINE>} | baseCardElement.GetIsVisible(), horizFlowLayout); |
237,984 | public Node<V> visit(final BranchNode<V> node, final Bytes searchPath) {<NEW_LINE>byte iterateFrom = 0;<NEW_LINE>Bytes remainingPath = searchPath;<NEW_LINE>if (state == State.SEARCHING) {<NEW_LINE>iterateFrom = searchPath.get(0);<NEW_LINE>if (iterateFrom == CompactEncoding.LEAF_TERMINATOR) {<NEW_LINE>return node;<NEW_LINE>}<NEW_LINE>remainingPath = searchPath.slice(1);<NEW_LINE>}<NEW_LINE>paths.<MASK><NEW_LINE>for (byte i = iterateFrom; i < BranchNode.RADIX && state.continueIterating(); i++) {<NEW_LINE>paths.push(Bytes.of(i));<NEW_LINE>final Node<V> child = node.child(i);<NEW_LINE>child.accept(this, remainingPath);<NEW_LINE>if (unload) {<NEW_LINE>child.unload();<NEW_LINE>}<NEW_LINE>paths.pop();<NEW_LINE>}<NEW_LINE>paths.pop();<NEW_LINE>return node;<NEW_LINE>} | push(node.getPath()); |
296,535 | public final void factor() throws RecognitionException, TokenStreamException {<NEW_LINE>returnAST = null;<NEW_LINE>ASTPair currentAST = new ASTPair();<NEW_LINE>PascalAST factor_AST = null;<NEW_LINE>switch(LA(1)) {<NEW_LINE>case LPAREN:<NEW_LINE>{<NEW_LINE>match(LPAREN);<NEW_LINE>expression();<NEW_LINE>astFactory.addASTChild(currentAST, returnAST);<NEW_LINE>match(RPAREN);<NEW_LINE>factor_AST = (PascalAST) currentAST.root;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case CHR:<NEW_LINE>case NUM_INT:<NEW_LINE>case NUM_REAL:<NEW_LINE>case STRING_LITERAL:<NEW_LINE>case NIL:<NEW_LINE>{<NEW_LINE>unsignedConstant();<NEW_LINE>astFactory.addASTChild(currentAST, returnAST);<NEW_LINE>factor_AST = (PascalAST) currentAST.root;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case LBRACK:<NEW_LINE>case LBRACK2:<NEW_LINE>{<NEW_LINE>set();<NEW_LINE>astFactory.addASTChild(currentAST, returnAST);<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case NOT:<NEW_LINE>{<NEW_LINE>PascalAST tmp127_AST = null;<NEW_LINE>tmp127_AST = (PascalAST) astFactory.create(LT(1));<NEW_LINE>astFactory.makeASTRoot(currentAST, tmp127_AST);<NEW_LINE>match(NOT);<NEW_LINE>factor();<NEW_LINE>astFactory.addASTChild(currentAST, returnAST);<NEW_LINE>factor_AST = (PascalAST) currentAST.root;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>if ((LA(1) == IDENT || LA(1) == AT) && (_tokenSet_9.member(LA(2)))) {<NEW_LINE>variable();<NEW_LINE>astFactory.addASTChild(currentAST, returnAST);<NEW_LINE>factor_AST = (PascalAST) currentAST.root;<NEW_LINE>} else if ((LA(1) == IDENT) && (LA(2) == LPAREN)) {<NEW_LINE>functionDesignator();<NEW_LINE>astFactory.addASTChild(currentAST, returnAST);<NEW_LINE>factor_AST = (PascalAST) currentAST.root;<NEW_LINE>} else {<NEW_LINE>throw new NoViableAltException(LT(1), getFilename());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>returnAST = factor_AST;<NEW_LINE>} | factor_AST = (PascalAST) currentAST.root; |
350,126 | public StartPosition unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>StartPosition startPosition = new StartPosition();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>startPosition.setId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("AbsoluteTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>startPosition.setAbsoluteTime(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("MostRecent", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>startPosition.setMostRecent(context.getUnmarshaller(Integer.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 startPosition;<NEW_LINE>} | class).unmarshall(context)); |
1,538,356 | public Folder createWithFolder(BaseCreateParam createParam) {<NEW_LINE>// check unique<NEW_LINE>DatachartCreateParam param = (DatachartCreateParam) createParam;<NEW_LINE>if (!CollectionUtils.isEmpty(folderMapper.checkVizName(param.getOrgId(), param.getParentId(), param.getName()))) {<NEW_LINE>Exceptions.tr(ParamException.class, "error.param.exists.name");<NEW_LINE>}<NEW_LINE>Datachart datachart = DatachartService.super.create(createParam);<NEW_LINE>// create folder<NEW_LINE>Folder folder = new Folder();<NEW_LINE>folder.<MASK><NEW_LINE>BeanUtils.copyProperties(createParam, folder);<NEW_LINE>folder.setRelType(ResourceType.DATACHART.name());<NEW_LINE>folder.setRelId(datachart.getId());<NEW_LINE>folder.setSubType(param.getSubType());<NEW_LINE>folder.setAvatar(param.getAvatar());<NEW_LINE>folderService.requirePermission(folder, Const.CREATE);<NEW_LINE>folderMapper.insert(folder);<NEW_LINE>return folder;<NEW_LINE>} | setId(UUIDGenerator.generate()); |
1,652,446 | Cookie ensureDomainAndPath(Cookie cookie, URI uri) {<NEW_LINE>final boolean validDomain = !Strings.isNullOrEmpty(cookie.domain());<NEW_LINE>final String cookiePath = cookie.path();<NEW_LINE>final boolean validPath = !Strings.isNullOrEmpty(cookiePath) && cookiePath.charAt(0) == '/';<NEW_LINE>if (validDomain && validPath) {<NEW_LINE>return cookie;<NEW_LINE>}<NEW_LINE>final CookieBuilder cb = cookie.toBuilder();<NEW_LINE>if (!validDomain) {<NEW_LINE>cb.domain(uri.getHost<MASK><NEW_LINE>}<NEW_LINE>if (!validPath) {<NEW_LINE>String path = uri.getPath();<NEW_LINE>if (path.isEmpty()) {<NEW_LINE>path = "/";<NEW_LINE>} else {<NEW_LINE>final int i = path.lastIndexOf('/');<NEW_LINE>if (i > 0) {<NEW_LINE>path = path.substring(0, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cb.path(path);<NEW_LINE>}<NEW_LINE>return cb.build();<NEW_LINE>} | ()).hostOnly(true); |
256,983 | private static Queue<CommentOutput> buildComments(List<FeedbackResponseCommentAttributes> feedbackResponseComments, SessionResultsBundle bundle) {<NEW_LINE>LinkedList<CommentOutput> outputs = new LinkedList<>();<NEW_LINE>CommentOutput participantComment = null;<NEW_LINE>for (FeedbackResponseCommentAttributes comment : feedbackResponseComments) {<NEW_LINE>if (comment.isCommentFromFeedbackParticipant()) {<NEW_LINE>// participant comment will not need these fields<NEW_LINE>participantComment = CommentOutput.builder(comment).withCommentGiver(null).withCommentGiverName(null).withLastEditorEmail(null).<MASK><NEW_LINE>} else {<NEW_LINE>String giverEmail = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT;<NEW_LINE>String giverName = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT;<NEW_LINE>String lastEditorEmail = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT;<NEW_LINE>String lastEditorName = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT;<NEW_LINE>if (bundle.isCommentGiverVisible(comment)) {<NEW_LINE>giverEmail = comment.getCommentGiver();<NEW_LINE>giverName = bundle.getRoster().getInfoForIdentifier(comment.getCommentGiver()).getName();<NEW_LINE>lastEditorEmail = comment.getLastEditorEmail();<NEW_LINE>lastEditorName = bundle.getRoster().getInfoForIdentifier(comment.getLastEditorEmail()).getName();<NEW_LINE>}<NEW_LINE>outputs.add(CommentOutput.builder(comment).withCommentGiver(giverEmail).withCommentGiverName(giverName).withLastEditorEmail(lastEditorEmail).withLastEditorName(lastEditorName).build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>outputs.addFirst(participantComment);<NEW_LINE>return outputs;<NEW_LINE>} | withLastEditorName(null).build(); |
235,816 | public TopDocs search(String field, float[] target, int k, Bits acceptDocs, int visitedLimit) throws IOException {<NEW_LINE>FieldEntry fieldEntry = fields.get(field);<NEW_LINE>if (fieldEntry.size() == 0) {<NEW_LINE>return new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]);<NEW_LINE>}<NEW_LINE>// bound k by total number of vectors to prevent oversizing data structures<NEW_LINE>k = Math.min(<MASK><NEW_LINE>OffHeapVectorValues vectorValues = getOffHeapVectorValues(fieldEntry);<NEW_LINE>// use a seed that is fixed for the index so we get reproducible results for the same query<NEW_LINE>final SplittableRandom random = new SplittableRandom(checksumSeed);<NEW_LINE>NeighborQueue results = Lucene90OnHeapHnswGraph.search(target, k, k, vectorValues, fieldEntry.similarityFunction, getGraphValues(fieldEntry), getAcceptOrds(acceptDocs, fieldEntry), visitedLimit, random);<NEW_LINE>int i = 0;<NEW_LINE>ScoreDoc[] scoreDocs = new ScoreDoc[Math.min(results.size(), k)];<NEW_LINE>while (results.size() > 0) {<NEW_LINE>int node = results.topNode();<NEW_LINE>float score = fieldEntry.similarityFunction.convertToScore(results.topScore());<NEW_LINE>results.pop();<NEW_LINE>scoreDocs[scoreDocs.length - ++i] = new ScoreDoc(fieldEntry.ordToDoc[node], score);<NEW_LINE>}<NEW_LINE>TotalHits.Relation relation = results.incomplete() ? TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO : TotalHits.Relation.EQUAL_TO;<NEW_LINE>return new TopDocs(new TotalHits(results.visitedCount(), relation), scoreDocs);<NEW_LINE>} | k, fieldEntry.size()); |
611,310 | final UpgradeElasticsearchDomainResult executeUpgradeElasticsearchDomain(UpgradeElasticsearchDomainRequest upgradeElasticsearchDomainRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(upgradeElasticsearchDomainRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpgradeElasticsearchDomainRequest> request = null;<NEW_LINE>Response<UpgradeElasticsearchDomainResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpgradeElasticsearchDomainRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(upgradeElasticsearchDomainRequest));<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, "Elasticsearch Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpgradeElasticsearchDomain");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpgradeElasticsearchDomainResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new UpgradeElasticsearchDomainResultJsonUnmarshaller()); |
1,597,970 | private static void progMusterErsetzen(JFrame parent, DatenPset pSet) {<NEW_LINE>pSet.arr[DatenPset.PROGRAMMSET_ZIEL_PFAD] = StringUtils.replace(pSet.arr[DatenPset.PROGRAMMSET_ZIEL_PFAD], MUSTER_PFAD_ZIEL, StandardLocations.getStandardDownloadPath());<NEW_LINE>String vlc = "";<NEW_LINE>String ffmpeg = "";<NEW_LINE>// damit nur die Variablen abgefragt werden, die auch verwendet werden<NEW_LINE>for (int p = 0; p < pSet.getListeProg().size(); ++p) {<NEW_LINE>DatenProg prog = pSet.getProg(p);<NEW_LINE>if (prog.arr[DatenProg.PROGRAMM_PROGRAMMPFAD].contains(MUSTER_PFAD_VLC) || prog.arr[DatenProg.PROGRAMM_SCHALTER].contains(MUSTER_PFAD_VLC)) {<NEW_LINE>vlc = getPfadVlc(parent);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int p = 0; p < pSet.getListeProg().size(); ++p) {<NEW_LINE>DatenProg prog = pSet.getProg(p);<NEW_LINE>if (prog.arr[DatenProg.PROGRAMM_PROGRAMMPFAD].contains(MUSTER_PFAD_FFMPEG) || prog.arr[DatenProg.PROGRAMM_SCHALTER].contains(MUSTER_PFAD_FFMPEG)) {<NEW_LINE>ffmpeg = getPfadFFmpeg(parent);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int p = 0; p < pSet.getListeProg().size(); ++p) {<NEW_LINE>DatenProg prog = pSet.getProg(p);<NEW_LINE>// VLC<NEW_LINE>prog.arr[DatenProg.PROGRAMM_PROGRAMMPFAD] = prog.arr[DatenProg.PROGRAMM_PROGRAMMPFAD].replaceAll(MUSTER_PFAD_VLC<MASK><NEW_LINE>prog.arr[DatenProg.PROGRAMM_SCHALTER] = prog.arr[DatenProg.PROGRAMM_SCHALTER].replaceAll(MUSTER_PFAD_VLC, Matcher.quoteReplacement(vlc));<NEW_LINE>// ffmpeg<NEW_LINE>prog.arr[DatenProg.PROGRAMM_PROGRAMMPFAD] = prog.arr[DatenProg.PROGRAMM_PROGRAMMPFAD].replaceAll(MUSTER_PFAD_FFMPEG, Matcher.quoteReplacement(ffmpeg));<NEW_LINE>prog.arr[DatenProg.PROGRAMM_SCHALTER] = prog.arr[DatenProg.PROGRAMM_SCHALTER].replaceAll(MUSTER_PFAD_FFMPEG, Matcher.quoteReplacement(ffmpeg));<NEW_LINE>}<NEW_LINE>} | , Matcher.quoteReplacement(vlc)); |
121,590 | public void buildMenu(Menu menuBrowse) {<NEW_LINE>final MenuItem itemBrowsePublic = new MenuItem(menuBrowse, SWT.PUSH);<NEW_LINE>itemBrowsePublic.setText(MessageText.getString("label.public") + "...");<NEW_LINE>itemBrowsePublic.addListener(SWT.Selection, new ListenerDMTask(dms, false) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(DownloadManager dm) {<NEW_LINE>ManagerUtils.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>final MenuItem itemBrowseAnon = new MenuItem(menuBrowse, SWT.PUSH);<NEW_LINE>itemBrowseAnon.setText(MessageText.getString("label.anon") + "...");<NEW_LINE>itemBrowseAnon.addListener(SWT.Selection, new ListenerDMTask(dms, false) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(DownloadManager dm) {<NEW_LINE>ManagerUtils.browse(dm, true, true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>new MenuItem(menuBrowse, SWT.SEPARATOR);<NEW_LINE>final MenuItem itemBrowseURL = new MenuItem(menuBrowse, SWT.PUSH);<NEW_LINE>Messages.setLanguageText(itemBrowseURL, "label.copy.url.to.clip");<NEW_LINE>itemBrowseURL.addListener(SWT.Selection, new Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>Utils.getOffOfSWTThread(new AERunnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void runSupport() {<NEW_LINE>String url = ManagerUtils.browse(dms[0], true, false);<NEW_LINE>if (url != null) {<NEW_LINE>ClipboardCopy.copyToClipBoard(url);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>itemBrowseURL.setEnabled(dms.length == 1);<NEW_LINE>new MenuItem(menuBrowse, SWT.SEPARATOR);<NEW_LINE>final MenuItem itemBrowseDir = new MenuItem(menuBrowse, SWT.CHECK);<NEW_LINE>Messages.setLanguageText(itemBrowseDir, "library.launch.web.in.browser.dir.list");<NEW_LINE>itemBrowseDir.setSelection(COConfigurationManager.getBooleanParameter("Library.LaunchWebsiteInBrowserDirList"));<NEW_LINE>itemBrowseDir.addListener(SWT.Selection, new Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>COConfigurationManager.setParameter("Library.LaunchWebsiteInBrowserDirList", itemBrowseDir.getSelection());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | browse(dm, false, true); |
1,782,372 | protected EnumMap<KeyIndex, String> initContentProviderKeys() {<NEW_LINE>EnumMap<KeyIndex, String> keys = new EnumMap<KeyIndex, String>(KeyIndex.class);<NEW_LINE>keys.put(KeyIndex.CALENDARS_ID, Calendars._ID);<NEW_LINE>keys.put(KeyIndex.IS_PRIMARY, Calendars.IS_PRIMARY);<NEW_LINE>keys.put(KeyIndex.CALENDARS_NAME, Calendars.NAME);<NEW_LINE>keys.put(KeyIndex.CALENDARS_DISPLAY_NAME, Calendars.CALENDAR_DISPLAY_NAME);<NEW_LINE>keys.put(KeyIndex.CALENDARS_VISIBLE, Calendars.VISIBLE);<NEW_LINE>keys.put(KeyIndex.EVENTS_ID, Events._ID);<NEW_LINE>keys.put(KeyIndex.EVENTS_CALENDAR_ID, Events.CALENDAR_ID);<NEW_LINE>keys.put(KeyIndex.EVENTS_DESCRIPTION, Events.DESCRIPTION);<NEW_LINE>keys.put(KeyIndex.EVENTS_LOCATION, Events.EVENT_LOCATION);<NEW_LINE>keys.put(KeyIndex.EVENTS_SUMMARY, Events.TITLE);<NEW_LINE>keys.put(KeyIndex.EVENTS_START, Events.DTSTART);<NEW_LINE>keys.put(KeyIndex.EVENTS_END, Events.DTEND);<NEW_LINE>keys.put(KeyIndex.EVENTS_RRULE, Events.RRULE);<NEW_LINE>keys.put(KeyIndex.EVENTS_ALL_DAY, Events.ALL_DAY);<NEW_LINE>keys.put(KeyIndex.INSTANCES_ID, Instances._ID);<NEW_LINE>keys.put(KeyIndex.INSTANCES_EVENT_ID, Instances.EVENT_ID);<NEW_LINE>keys.put(KeyIndex.INSTANCES_BEGIN, Instances.BEGIN);<NEW_LINE>keys.put(<MASK><NEW_LINE>keys.put(KeyIndex.ATTENDEES_ID, Attendees._ID);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_EVENT_ID, Attendees.EVENT_ID);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_NAME, Attendees.ATTENDEE_NAME);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_EMAIL, Attendees.ATTENDEE_EMAIL);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_STATUS, Attendees.ATTENDEE_STATUS);<NEW_LINE>return keys;<NEW_LINE>} | KeyIndex.INSTANCES_END, Instances.END); |
1,028,377 | public // until it is deleted using the unsubscribe method.<NEW_LINE>void testCreateSharedDurableConsumer_unsubscribe(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>JMSContext jmsContext = tcfBindings.createContext();<NEW_LINE>JMSConsumer jmsConsumer = <MASK><NEW_LINE>JMSProducer jmsProducer = jmsContext.createProducer();<NEW_LINE>TextMessage msgOut = jmsContext.createTextMessage("This is a test message");<NEW_LINE>jmsProducer.send(topic1, msgOut);<NEW_LINE>TextMessage msgIn = (TextMessage) jmsConsumer.receive(DEFAULT_TIMEOUT);<NEW_LINE>jmsConsumer.close();<NEW_LINE>jmsContext.unsubscribe("DURATEST1");<NEW_LINE>MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();<NEW_LINE>ObjectName name = new ObjectName("WebSphere:feature=wasJmsServer,type=Subscriber,name=clientID##DURATEST1");<NEW_LINE>boolean testFailed = false;<NEW_LINE>try {<NEW_LINE>String obn = (String) mbs.getAttribute(name, "Id");<NEW_LINE>} catch (InstanceNotFoundException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>testFailed = true;<NEW_LINE>}<NEW_LINE>jmsContext.close();<NEW_LINE>if (testFailed) {<NEW_LINE>throw new Exception("testCreateSharedDurableConsumer_unsubscribe failed");<NEW_LINE>}<NEW_LINE>} | jmsContext.createDurableConsumer(topic1, "DURATEST1"); |
537,526 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {<NEW_LINE>LogHelper.i(TAG, "query values with: " + this);<NEW_LINE>if (isUriNotValid(uri)) {<NEW_LINE>return new MatrixCursor(new String[0], 1);<NEW_LINE>}<NEW_LINE>ensureCacheReady();<NEW_LINE>String[] queryKeys;<NEW_LINE>if (projection == null) {<NEW_LINE>Set<String> keySet = mCachePreferences.keySet();<NEW_LINE>queryKeys = new String[keySet.size()];<NEW_LINE>int i = 0;<NEW_LINE>for (String key : keySet) {<NEW_LINE>queryKeys[i++] = key;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>queryKeys = projection;<NEW_LINE>}<NEW_LINE>MatrixCursor cursor = new MatrixCursor(queryKeys, 1);<NEW_LINE>Object[] values = new Object[queryKeys.length];<NEW_LINE>for (int i = 0; i < queryKeys.length; i++) {<NEW_LINE>values[i] = mCachePreferences<MASK><NEW_LINE>}<NEW_LINE>cursor.addRow(values);<NEW_LINE>return cursor;<NEW_LINE>} | .get(queryKeys[i]); |
1,514,079 | public void onPostLinkableClicked(Post post, PostLinkable linkable) {<NEW_LINE>if (linkable.type == PostLinkable.Type.QUOTE) {<NEW_LINE>Post linked = findPostById((int) linkable.value);<NEW_LINE>if (linked != null) {<NEW_LINE>threadPresenterCallback.showPostsPopup(post, Collections.singletonList(linked));<NEW_LINE>}<NEW_LINE>} else if (linkable.type == PostLinkable.Type.LINK) {<NEW_LINE>threadPresenterCallback.openLink((String) linkable.value);<NEW_LINE>} else if (linkable.type == PostLinkable.Type.THREAD) {<NEW_LINE>PostLinkable.ThreadLink link = <MASK><NEW_LINE>Board board = loadable.site.board(link.board);<NEW_LINE>if (board != null) {<NEW_LINE>Loadable thread = databaseManager.getDatabaseLoadableManager().get(Loadable.forThread(board.site, board, link.threadId));<NEW_LINE>thread.markedNo = link.postId;<NEW_LINE>threadPresenterCallback.showThread(thread);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (PostLinkable.ThreadLink) linkable.value; |
258,878 | public void buildModel() {<NEW_LINE>model = new Model("CarSequencing");<NEW_LINE>parse(data.source());<NEW_LINE>prepare();<NEW_LINE>int max = nClasses - 1;<NEW_LINE>cars = model.intVarArray("cars", nCars, 0, max, false);<NEW_LINE>IntVar[] expArray = new IntVar[nClasses];<NEW_LINE>for (int optNum = 0; optNum < options.length; optNum++) {<NEW_LINE>int <MASK><NEW_LINE>for (int seqStart = 0; seqStart < (cars.length - optfreq[optNum][1]); seqStart++) {<NEW_LINE>IntVar[] carSequence = extractor(cars, seqStart, optfreq[optNum][1]);<NEW_LINE>// configurations that include given option may be chosen<NEW_LINE>IntVar[] atMost = new IntVar[nbConf];<NEW_LINE>for (int i = 0; i < nbConf; i++) {<NEW_LINE>// optfreq[optNum][0] times AT MOST<NEW_LINE>atMost[i] = model.intVar("atmost_" + optNum + "_" + seqStart + "_" + nbConf, 0, optfreq[optNum][0], true);<NEW_LINE>}<NEW_LINE>model.globalCardinality(carSequence, options[optNum], atMost, false).post();<NEW_LINE>IntVar[] atLeast = model.intVarArray("atleast_" + optNum + "_" + seqStart, idleConfs[optNum].length, 0, max, true);<NEW_LINE>model.globalCardinality(carSequence, idleConfs[optNum], atLeast, false).post();<NEW_LINE>// all others configurations may be chosen<NEW_LINE>IntVar sum = model.intVar("sum", optfreq[optNum][1] - optfreq[optNum][0], 99999999, true);<NEW_LINE>model.sum(atLeast, "=", sum).post();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[] values = new int[expArray.length];<NEW_LINE>for (int i = 0; i < expArray.length; i++) {<NEW_LINE>expArray[i] = model.intVar("var_" + i, 0, demands[i], false);<NEW_LINE>values[i] = i;<NEW_LINE>}<NEW_LINE>model.globalCardinality(cars, values, expArray, false).post();<NEW_LINE>} | nbConf = options[optNum].length; |
615,867 | public void formatEditor(CEditor editor1, CEditor editor2) {<NEW_LINE>log.fine("");<NEW_LINE>VEditor editor = (VEditor) editor1;<NEW_LINE>VEditor editorTo = (VEditor) editor2;<NEW_LINE>if (editor == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>configColumns(editor, editorTo);<NEW_LINE>// Create label<NEW_LINE>CLabel label = VEditorFactory.getLabel(editor.getField());<NEW_LINE>if (label == null) {<NEW_LINE>// left gap<NEW_LINE>centerPanel.add(Box.createHorizontalStrut(12), new <MASK><NEW_LINE>} else {<NEW_LINE>int currentWidth = label.getPreferredSize().width;<NEW_LINE>labelMinWidth = currentWidth > labelMinWidth ? currentWidth : labelMinWidth;<NEW_LINE>// label.setSize(label.getPreferredSize());<NEW_LINE>// label.setMinimumSize(label.getPreferredSize());<NEW_LINE>// label.putClientProperty("LabelUI.truncationString", ">");<NEW_LINE>centerPanel.add(label, new ALayoutConstraint(row, cols++));<NEW_LINE>}<NEW_LINE>//<NEW_LINE>Component component = (Component) editor;<NEW_LINE>fieldMinWidth = component.getPreferredSize().width > fieldMinWidth ? component.getPreferredSize().width : fieldMinWidth;<NEW_LINE>centerPanel.add((Component) editor, new ALayoutConstraint(row, cols++));<NEW_LINE>// To<NEW_LINE>if (editorTo == null) {<NEW_LINE>m_separators.add(null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Add<NEW_LINE>CLabel dash = new CLabel(" - ");<NEW_LINE>centerPanel.add(dash, new ALayoutConstraint(row, cols++));<NEW_LINE>m_separators.add(dash);<NEW_LINE>//<NEW_LINE>centerPanel.add((Component) editorTo, new ALayoutConstraint(row, cols++));<NEW_LINE>} | ALayoutConstraint(row, cols++)); |
136,478 | private void parallelizationReplacement(StructuredGraph graph, InductionVariable inductionVar, int loopIndex, ValueNode maxIterations, List<IntegerLessThanNode> conditions) throws TornadoCompilationException {<NEW_LINE>if (inductionVar.isConstantInit() && inductionVar.isConstantStride()) {<NEW_LINE>final ConstantNode newInit = graph.addWithoutUnique(ConstantNode.forInt((int) inductionVar.constantInit()));<NEW_LINE>final ConstantNode newStride = graph.addWithoutUnique(ConstantNode.forInt((int) inductionVar.constantStride()));<NEW_LINE>final ParallelOffsetNode offset = graph.addWithoutUnique(new ParallelOffsetNode(loopIndex, newInit));<NEW_LINE>final ParallelStrideNode stride = graph.addWithoutUnique(new ParallelStrideNode(loopIndex, newStride));<NEW_LINE>final ParallelRangeNode range = graph.addWithoutUnique(new ParallelRangeNode(loopIndex, maxIterations, offset, stride));<NEW_LINE>final ValuePhiNode phi = (ValuePhiNode) inductionVar.valueNode();<NEW_LINE>final ValueNode oldStride = phi.singleBackValueOrThis();<NEW_LINE>if (oldStride.usages().count() > 1) {<NEW_LINE>final ValueNode duplicateStride = (ValueNode) oldStride.copyWithInputs(true);<NEW_LINE>oldStride.replaceAtMatchingUsages(duplicateStride, usage -> <MASK><NEW_LINE>}<NEW_LINE>inductionVar.initNode().replaceAtMatchingUsages(offset, node -> node.equals(phi));<NEW_LINE>inductionVar.strideNode().replaceAtMatchingUsages(stride, node -> node.equals(oldStride));<NEW_LINE>// only replace this node in the loop condition<NEW_LINE>maxIterations.replaceAtMatchingUsages(range, node -> node.equals(conditions.get(0)));<NEW_LINE>} else {<NEW_LINE>throw new TornadoBailoutRuntimeException("Failed to parallelize because of non-constant loop strides. \nSequential code will run on the device!");<NEW_LINE>}<NEW_LINE>} | !usage.equals(phi)); |
860,245 | public static boolean breakOneBlock(BlockPos pos) {<NEW_LINE>Direction side = null;<NEW_LINE>Direction[] sides = Direction.values();<NEW_LINE>BlockState state = BlockUtils.getState(pos);<NEW_LINE>VoxelShape shape = state.getOutlineShape(MC.world, pos);<NEW_LINE>if (shape.isEmpty())<NEW_LINE>return false;<NEW_LINE><MASK><NEW_LINE>Vec3d relCenter = shape.getBoundingBox().getCenter();<NEW_LINE>Vec3d center = Vec3d.of(pos).add(relCenter);<NEW_LINE>Vec3d[] hitVecs = new Vec3d[sides.length];<NEW_LINE>for (int i = 0; i < sides.length; i++) {<NEW_LINE>Vec3i dirVec = sides[i].getVector();<NEW_LINE>Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ());<NEW_LINE>hitVecs[i] = center.add(relHitVec);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < sides.length; i++) {<NEW_LINE>// check line of sight<NEW_LINE>if (MC.world.raycastBlock(eyesPos, hitVecs[i], pos, shape, state) != null)<NEW_LINE>continue;<NEW_LINE>side = sides[i];<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (side == null) {<NEW_LINE>double distanceSqToCenter = eyesPos.squaredDistanceTo(center);<NEW_LINE>for (int i = 0; i < sides.length; i++) {<NEW_LINE>// check if side is facing towards player<NEW_LINE>if (eyesPos.squaredDistanceTo(hitVecs[i]) >= distanceSqToCenter)<NEW_LINE>continue;<NEW_LINE>side = sides[i];<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// player is inside of block, side doesn't matter<NEW_LINE>if (side == null)<NEW_LINE>side = sides[0];<NEW_LINE>// face block<NEW_LINE>WURST.getRotationFaker().faceVectorPacket(hitVecs[side.ordinal()]);<NEW_LINE>// damage block<NEW_LINE>if (!MC.interactionManager.updateBlockBreakingProgress(pos, side))<NEW_LINE>return false;<NEW_LINE>// swing arm<NEW_LINE>MC.player.networkHandler.sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));<NEW_LINE>return true;<NEW_LINE>} | Vec3d eyesPos = RotationUtils.getEyesPos(); |
1,204,625 | protected Dumper createDumper() {<NEW_LINE>return new Dumper() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onWritingSections(CompositeMonitors monitors, Printer printer) {<NEW_LINE><MASK><NEW_LINE>monitors.getAppStats(new Consumer<AppStats>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void accept(AppStats appStats) {<NEW_LINE>BatteryPrinter.this.onWritingSections(appStats);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected boolean onWritingSectionContent(@NonNull Delta<?> sessionDelta, CompositeMonitors monitors, Printer printer) {<NEW_LINE>if (!super.onWritingSectionContent(sessionDelta, monitors, printer)) {<NEW_LINE>AppStats appStats = monitors.getAppStats();<NEW_LINE>if (appStats != null) {<NEW_LINE>return BatteryPrinter.this.onWritingSectionContent(sessionDelta, appStats, printer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | super.onWritingSections(monitors, printer); |
1,301,012 | private String request(String json, String endpoint) throws IOException {<NEW_LINE>var request = HttpRequest.newBuilder().uri(url(endpoint)).timeout(Duration.ofSeconds(timeoutSeconds)).header("Content-Type", "application/json").POST(HttpRequest.BodyPublishers.ofString(json)).build();<NEW_LINE>try {<NEW_LINE>var response = client.send(request, BodyHandlers.ofString());<NEW_LINE>return response.body();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>throw handleInterruptedException(<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>String msg = "eslint-bridge Node.js process is unresponsive. This is most likely caused by process running out of memory." + " Consider setting sonar.javascript.node.maxspace to higher value (e.g. 4096).";<NEW_LINE>LOG.error(msg);<NEW_LINE>throw new IllegalStateException("eslint-bridge is unresponsive", e);<NEW_LINE>}<NEW_LINE>} | e, "Request " + endpoint + " was interrupted."); |
707,705 | public static H2Select generateSelect(H2GlobalState globalState, int nrColumns) {<NEW_LINE>H2Tables targetTables = globalState.getSchema().getRandomTableNonEmptyTables();<NEW_LINE>H2ExpressionGenerator gen = new H2ExpressionGenerator(globalState).setColumns(targetTables.getColumns());<NEW_LINE>H2Select select = new H2Select();<NEW_LINE>List<Node<H2Expression>> columns = new ArrayList<>();<NEW_LINE>for (int i = 0; i < nrColumns; i++) {<NEW_LINE>Node<H2Expression<MASK><NEW_LINE>columns.add(expression);<NEW_LINE>}<NEW_LINE>select.setFetchColumns(columns);<NEW_LINE>List<H2Table> tables = targetTables.getTables();<NEW_LINE>List<TableReferenceNode<H2Expression, H2Table>> tableList = tables.stream().map(t -> new TableReferenceNode<H2Expression, H2Table>(t)).collect(Collectors.toList());<NEW_LINE>List<Node<H2Expression>> joins = H2Join.getJoins(tableList, globalState);<NEW_LINE>select.setJoinList(joins.stream().collect(Collectors.toList()));<NEW_LINE>select.setFromList(tableList.stream().collect(Collectors.toList()));<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>select.setWhereClause(gen.generateExpression());<NEW_LINE>}<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>select.setOrderByExpressions(gen.generateOrderBys());<NEW_LINE>}<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>select.setGroupByExpressions(gen.generateExpressions(Randomly.smallNumber() + 1));<NEW_LINE>}<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>select.setLimitClause(H2Constant.createIntConstant(Randomly.getNotCachedInteger(0, Integer.MAX_VALUE)));<NEW_LINE>}<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>select.setOffsetClause(H2Constant.createIntConstant(Randomly.getNotCachedInteger(0, Integer.MAX_VALUE)));<NEW_LINE>}<NEW_LINE>if (Randomly.getBoolean()) {<NEW_LINE>select.setHavingClause(gen.generateHavingClause());<NEW_LINE>}<NEW_LINE>return select;<NEW_LINE>} | > expression = gen.generateExpression(); |
973,485 | private void createErrorNote(final PostingException ex) {<NEW_LINE>DB.saveConstraints();<NEW_LINE>try {<NEW_LINE>DB.getConstraints().setOnlyAllowedTrxNamePrefixes(false).incMaxTrx(1);<NEW_LINE>final PostingStatus postingStatus = ex.getPostingStatus(PostingStatus.Error);<NEW_LINE>final AdMessageKey AD_MessageValue = postingStatus.getAD_Message();<NEW_LINE>final PO po = getPO();<NEW_LINE>final int AD_User_ID = po.getUpdatedBy();<NEW_LINE>final String adLanguage = Env.getADLanguageOrBaseLanguage();<NEW_LINE>final MNote note = new MNote(Env.getCtx(), AD_MessageValue.toAD_Message(), AD_User_ID, getClientId().getRepoId(), getOrgId().getRepoId(), ITrx.TRXNAME_None);<NEW_LINE>note.setRecord(po.get_Table_ID(<MASK><NEW_LINE>// Document<NEW_LINE>note.setReference(toString());<NEW_LINE>final StringBuilder text = new StringBuilder();<NEW_LINE>text.append(services.translate(AD_MessageValue).translate(adLanguage));<NEW_LINE>final String p_Error = ex.getDetailMessage().translate(adLanguage);<NEW_LINE>if (!Check.isEmpty(p_Error, true)) {<NEW_LINE>text.append(" (").append(p_Error).append(")");<NEW_LINE>}<NEW_LINE>text.append(" - ").append(getClass().getSimpleName());<NEW_LINE>final boolean loaded = getDocLines() != null;<NEW_LINE>if (loaded) {<NEW_LINE>text.append(" (").append(getDocumentType()).append(" - DocumentNo=").append(getDocumentNo()).append(", DateAcct=").append(getDateAcct()).append(", Amount=").append(getAmount()).append(", Sta=").append(postingStatus).append(" - PeriodOpen=").append(isPeriodOpen()).append(", Balanced=").append(isBalanced()).append(")");<NEW_LINE>}<NEW_LINE>note.setTextMsg(text.toString());<NEW_LINE>note.save();<NEW_LINE>// p_Error = Text.toString();<NEW_LINE>} catch (final Exception noteEx) {<NEW_LINE>log.warn("Failed to create the error note. Skipped", noteEx);<NEW_LINE>} finally {<NEW_LINE>DB.restoreConstraints();<NEW_LINE>}<NEW_LINE>} | ), po.get_ID()); |
715,861 | public void read(Reader in, Object desc) throws IOException {<NEW_LINE>RTextAreaEditorKit kit = (RTextAreaEditorKit) getUI().getEditorKit(this);<NEW_LINE>setText(null);<NEW_LINE>// We disassociate the document from the text area while loading a file<NEW_LINE>// for performance reasons. For small files this will be negligibly<NEW_LINE>// slower, but for large files this is a performance boost as there will<NEW_LINE>// be no listeners receiving events every call to Document.insert().<NEW_LINE>// On my PC it was about 1 second per 5 MB.<NEW_LINE>Document doc = getDocument();<NEW_LINE>setDocument(createDefaultModel());<NEW_LINE>if (desc != null) {<NEW_LINE>doc.putProperty(Document.StreamDescriptionProperty, desc);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// NOTE: Resets the "line separator" property.<NEW_LINE>kit.read(in, doc, 0);<NEW_LINE>} catch (BadLocationException e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>setDocument(doc);<NEW_LINE>} | IOException(e.getMessage()); |
1,640,441 | public void visit(BLangErrorVariable varNode) {<NEW_LINE>// Create error destruct block stmt.<NEW_LINE>final BLangBlockStmt blockStmt = ASTBuilderUtil.createBlockStmt(varNode.pos);<NEW_LINE>BType errorType = varNode.getBType() == null ? symTable.errorType : varNode.getBType();<NEW_LINE>// Create a simple var for the error 'error x = ($error$)'.<NEW_LINE>String name = anonModelHelper.<MASK><NEW_LINE>BVarSymbol errorVarSymbol = new BVarSymbol(0, names.fromString(name), this.env.scope.owner.pkgID, errorType, this.env.scope.owner, varNode.pos, VIRTUAL);<NEW_LINE>final BLangSimpleVariable error = ASTBuilderUtil.createVariable(varNode.pos, name, errorType, null, errorVarSymbol);<NEW_LINE>error.expr = varNode.expr;<NEW_LINE>final BLangSimpleVariableDef variableDef = ASTBuilderUtil.createVariableDefStmt(varNode.pos, blockStmt);<NEW_LINE>variableDef.var = error;<NEW_LINE>// Create the variable definition statements using the root block stmt created.<NEW_LINE>createVarDefStmts(varNode, blockStmt, error.symbol, null);<NEW_LINE>// Finally rewrite the populated block statement.<NEW_LINE>result = rewrite(blockStmt, env);<NEW_LINE>} | getNextErrorVarKey(env.enclPkg.packageID); |
1,320,344 | private void readLoopBackMessages() {<NEW_LINE>while (true) {<NEW_LINE>LoopBackMessage msg = null;<NEW_LINE>try {<NEW_LINE>synchronized (m_msgQueue) {<NEW_LINE>if (m_msgQueue.isEmpty()) {<NEW_LINE>m_msgQueue.wait();<NEW_LINE>}<NEW_LINE>if (!m_msgQueue.isEmpty()) {<NEW_LINE>msg = (LoopBackMessage) m_msgQueue.removeFirst();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "readLoopBackMessages", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (msg != null) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "readLoopBackMessages", "\nLoopback Message:\n" + msg.toString());<NEW_LINE>}<NEW_LINE>// remove the ibm destination header<NEW_LINE>msg.getMsg().<MASK><NEW_LINE>// forward to the stack<NEW_LINE>try {<NEW_LINE>SIPTransactionStack.instance().prossesTransportSipMessage(msg.getMsg(), msg.getProvider(), msg.getConnection());<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "readLoopBackMessages", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | removeHeader(SipStackUtil.DESTINATION_URI, true); |
1,662,673 | private static List<NodeFactory> createFactoriesSpecifiedInProperty(String property) {<NEW_LINE>List<NodeFactory> <MASK><NEW_LINE>for (String factoryName : property.toLowerCase().split(",")) {<NEW_LINE>factoryName = factoryName.trim();<NEW_LINE>switch(factoryName) {<NEW_LINE>case "moshi":<NEW_LINE>factories.add(new MoshiNodeFactory());<NEW_LINE>break;<NEW_LINE>case "json.org":<NEW_LINE>factories.add(new JsonOrgNodeFactory());<NEW_LINE>break;<NEW_LINE>case "jackson2":<NEW_LINE>factories.add(new Jackson2NodeFactory());<NEW_LINE>break;<NEW_LINE>case "gson":<NEW_LINE>factories.add(new GsonNodeFactory());<NEW_LINE>break;<NEW_LINE>case "johnzon":<NEW_LINE>factories.add(new JohnzonNodeFactory());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("'" + factoryName + "' library name not recognized.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return factories;<NEW_LINE>} | factories = new ArrayList<>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.