idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,048,360 | public byte[] toBytes() {<NEW_LINE>ByteBuffer buf = ByteBuffer.allocate(13);<NEW_LINE>buf.putShort(MAGIC);<NEW_LINE>byte msgType = (byte) 0x00;<NEW_LINE>if (heartbeat) {<NEW_LINE>msgType = (byte) (msgType | 0x10);<NEW_LINE>}<NEW_LINE>if (gzip) {<NEW_LINE>msgType = (byte) (msgType | 0x08);<NEW_LINE>}<NEW_LINE>if (oneway) {<NEW_LINE>msgType = (byte) (msgType | 0x04);<NEW_LINE>}<NEW_LINE>if (proxy) {<NEW_LINE>msgType = (byte) (msgType | 0x02);<NEW_LINE>}<NEW_LINE>if (!request) {<NEW_LINE>msgType = (byte) (msgType | 0x01);<NEW_LINE>}<NEW_LINE>buf.put(msgType);<NEW_LINE>byte vs = 0x08;<NEW_LINE>if (version != 1) {<NEW_LINE>vs = (byte) ((version << 3) & 0xf8);<NEW_LINE>}<NEW_LINE>if (status != 0) {<NEW_LINE>vs = (byte) (vs | (status & 0x07));<NEW_LINE>}<NEW_LINE>buf.put(vs);<NEW_LINE>byte se = 0x08;<NEW_LINE>if (serialize != 1) {<NEW_LINE>se = (byte) (<MASK><NEW_LINE>}<NEW_LINE>buf.put(se);<NEW_LINE>buf.putLong(requestId);<NEW_LINE>buf.flip();<NEW_LINE>return buf.array();<NEW_LINE>} | (serialize << 3) & 0xf8); |
297,913 | private static void fillVariantsByReference(@Nullable PsiReference reference, @NotNull PsiFile file, @NotNull CompletionResultSet result) {<NEW_LINE>if (reference == null)<NEW_LINE>return;<NEW_LINE>if (reference instanceof PsiMultiReference) {<NEW_LINE>PsiReference[] references = ((<MASK><NEW_LINE>ContainerUtil.sort(references, PsiMultiReference.COMPARATOR);<NEW_LINE>fillVariantsByReference(ArrayUtil.getFirstElement(references), file, result);<NEW_LINE>} else if (reference instanceof GoReference) {<NEW_LINE>GoReferenceExpression refExpression = ObjectUtils.tryCast(reference.getElement(), GoReferenceExpression.class);<NEW_LINE>GoStructLiteralCompletion.Variants variants = GoStructLiteralCompletion.allowedVariants(refExpression);<NEW_LINE>fillStructFieldNameVariants(file, result, variants, refExpression);<NEW_LINE>if (variants != GoStructLiteralCompletion.Variants.FIELD_NAME_ONLY) {<NEW_LINE>((GoReference) reference).processResolveVariants(new MyGoScopeProcessor(result, file, false));<NEW_LINE>}<NEW_LINE>} else if (reference instanceof GoTypeReference) {<NEW_LINE>PsiElement element = reference.getElement();<NEW_LINE>PsiElement spec = PsiTreeUtil.getParentOfType(element, GoFieldDeclaration.class, GoTypeSpec.class);<NEW_LINE>boolean insideParameter = PsiTreeUtil.getParentOfType(element, GoParameterDeclaration.class) != null;<NEW_LINE>((GoTypeReference) reference).processResolveVariants(new MyGoScopeProcessor(result, file, true) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected boolean accept(@NotNull PsiElement e) {<NEW_LINE>return e != spec && !(insideParameter && (e instanceof GoNamedSignatureOwner || e instanceof GoVarDefinition || e instanceof GoConstDefinition));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else if (reference instanceof GoCachedReference) {<NEW_LINE>((GoCachedReference) reference).processResolveVariants(new MyGoScopeProcessor(result, file, false));<NEW_LINE>}<NEW_LINE>} | PsiMultiReference) reference).getReferences(); |
1,498,162 | protected synchronized void xmlWriteAttributesOn(FormattedWriter writer) throws IOException {<NEW_LINE>writer.write(' ');<NEW_LINE>writer.write(XML_ID);<NEW_LINE>writer.write("=\"");<NEW_LINE>writer.write(Long.toString(getTuple().getUniqueId()));<NEW_LINE>writer.write("\" ");<NEW_LINE>writer.write(XML_STATE);<NEW_LINE>writer.write("=\"");<NEW_LINE>writer.<MASK><NEW_LINE>writer.write("\" ");<NEW_LINE>writer.write(XML_SIZE);<NEW_LINE>writer.write("=\"");<NEW_LINE>writer.write(Integer.toString(_inMemoryItemSize));<NEW_LINE>writer.write("\" ");<NEW_LINE>writer.write(XML_BACKOUT_COUNT);<NEW_LINE>writer.write("=\"");<NEW_LINE>writer.write(Integer.toString(_backoutCount));<NEW_LINE>writer.write("\" ");<NEW_LINE>writer.write(XML_UNLOCK_COUNT);<NEW_LINE>writer.write("=\"");<NEW_LINE>writer.write(Integer.toString(_unlockCount));<NEW_LINE>writer.write('"');<NEW_LINE>super.xmlWriteAttributesOn(writer);<NEW_LINE>} | write(_itemLinkState.toString()); |
907,865 | private void parseHeadersToRemove(Map<Object, Object> props) {<NEW_LINE>Object value = props.get(HttpConfigConstants.PROPNAME_RESPONSE_HEADERS_REMOVE);<NEW_LINE>if (null != value && this.isHeadersConfigEnabled) {<NEW_LINE>if (value instanceof String[]) {<NEW_LINE>String[] headers = (String[]) value;<NEW_LINE>// Parse all headers<NEW_LINE>for (String headerName : headers) {<NEW_LINE>if (headerName.isEmpty()) {<NEW_LINE>Tr.warning(tc, "headers.emptyName", "remove");<NEW_LINE>} else {<NEW_LINE>int hashcode = headerName.trim().toLowerCase().hashCode();<NEW_LINE>if (!this.configuredHeadersToRemove.containsKey(hashcode)) {<NEW_LINE>this.<MASK><NEW_LINE>if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) {<NEW_LINE>Tr.event(tc, "Headers remove configuration: parsed name [" + headerName + "]");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) {<NEW_LINE>Tr.event(tc, "Http Headers Config: <headers> remove configuration finished parsing.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | configuredHeadersToRemove.put(hashcode, headerName); |
1,351,979 | public void handleCheckIn() {<NEW_LINE>if (healthServiceAsync == null) {<NEW_LINE>if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) {<NEW_LINE>lastCheckIn.set(Timer.clockTime());<NEW_LINE>serviceDiscovery.checkInOk(endpointDefinition.getId());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) {<NEW_LINE>lastCheckIn.<MASK><NEW_LINE>healthServiceAsync.ok(ok::set);<NEW_LINE>ServiceProxyUtils.flushServiceProxy(healthServiceAsync);<NEW_LINE>if (ok.get()) {<NEW_LINE>serviceDiscovery.checkInOk(endpointDefinition.getId());<NEW_LINE>} else {<NEW_LINE>serviceDiscovery.checkIn(endpointDefinition.getId(), HealthStatus.FAIL);<NEW_LINE>}<NEW_LINE>ServiceProxyUtils.flushServiceProxy(serviceDiscovery);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | set(Timer.clockTime()); |
1,310,874 | public int trapRainWater(int[][] heightMap) {<NEW_LINE>int m = heightMap.length, n = heightMap[0].length;<NEW_LINE>boolean[][] vis = <MASK><NEW_LINE>PriorityQueue<int[]> pq = new PriorityQueue<>((o1, o2) -> o1[0] - o2[0]);<NEW_LINE>for (int i = 0; i < m; ++i) {<NEW_LINE>for (int j = 0; j < n; ++j) {<NEW_LINE>if (i == 0 || i == m - 1 || j == 0 || j == n - 1) {<NEW_LINE>pq.offer(new int[] { heightMap[i][j], i, j });<NEW_LINE>vis[i][j] = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int ans = 0;<NEW_LINE>int[][] dirs = new int[][] { { 0, -1 }, { 0, 1 }, { 1, 0 }, { -1, 0 } };<NEW_LINE>while (!pq.isEmpty()) {<NEW_LINE>int[] e = pq.poll();<NEW_LINE>for (int[] d : dirs) {<NEW_LINE>int i = e[1] + d[0], j = e[2] + d[1];<NEW_LINE>if (i >= 0 && i < m && j >= 0 && j < n && !vis[i][j]) {<NEW_LINE>if (heightMap[i][j] < e[0]) {<NEW_LINE>ans += e[0] - heightMap[i][j];<NEW_LINE>}<NEW_LINE>vis[i][j] = true;<NEW_LINE>pq.offer(new int[] { Math.max(heightMap[i][j], e[0]), i, j });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ans;<NEW_LINE>} | new boolean[m][n]; |
769,434 | public boolean restoreToLocation(LevelAccessor world, BlockPos pos, boolean force, boolean notifyNeighbors) {<NEW_LINE>BlockState current = getCurrentBlock();<NEW_LINE>BlockState replaced = getReplacedBlock();<NEW_LINE>int flags = notifyNeighbors ? Block.UPDATE_ALL : Block.UPDATE_CLIENTS;<NEW_LINE>if (current != replaced) {<NEW_LINE>if (force)<NEW_LINE>world.<MASK><NEW_LINE>else<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>world.setBlock(pos, replaced, flags);<NEW_LINE>if (world instanceof Level)<NEW_LINE>((Level) world).sendBlockUpdated(pos, current, replaced, flags);<NEW_LINE>BlockEntity te = null;<NEW_LINE>if (getTag() != null) {<NEW_LINE>te = world.getBlockEntity(pos);<NEW_LINE>if (te != null) {<NEW_LINE>te.load(getTag());<NEW_LINE>te.setChanged();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (DEBUG)<NEW_LINE>System.out.println("Restored " + this.toString());<NEW_LINE>return true;<NEW_LINE>} | setBlock(pos, replaced, flags); |
1,012,357 | public final AndExprContext andExpr() throws RecognitionException {<NEW_LINE>AndExprContext _localctx = new AndExprContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 24, RULE_andExpr);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(234);<NEW_LINE>_localctx.eqExpr = eqExpr();<NEW_LINE>_localctx.p = _localctx.eqExpr.p;<NEW_LINE>}<NEW_LINE>setState(243);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (_la == AND) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(237);<NEW_LINE>match(AND);<NEW_LINE>setState(238);<NEW_LINE>_localctx.eqExpr = eqExpr();<NEW_LINE>_localctx.p = NF.createArithmeticOp(ArithmeticOperation.AND, _localctx.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(245);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<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>} | p, _localctx.eqExpr.p); |
1,662,704 | public void build() {<NEW_LINE>int complexity = targetMethodComplexity(classScope);<NEW_LINE>if (values.size() < complexity) {<NEW_LINE>int index = 0;<NEW_LINE>for (V value : values) {<NEW_LINE>consumer.accept(value, index++, methodNode);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int count = 0;<NEW_LINE>Iterator<V> it = values.iterator();<NEW_LINE>while (count < values.size()) {<NEW_LINE>int remaining = values.size() - count;<NEW_LINE>int target = Math.min(remaining, complexity);<NEW_LINE>CodegenMethod child = methodNode.makeChild(EPTypePremade.VOID.getEPType(), provider, classScope).addParam(params);<NEW_LINE>methodNode.getBlock().localMethod(child, paramNames());<NEW_LINE>for (int i = 0; i < target; i++) {<NEW_LINE>V value = it.next();<NEW_LINE>consumer.<MASK><NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | accept(value, count, child); |
63,771 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>messageLabel = new javax.swing.JLabel();<NEW_LINE>toolBarButtonGroup = new javax.swing.ButtonGroup();<NEW_LINE>mainPanel = new javax.swing.JPanel();<NEW_LINE>toolBar = new javax.swing.JToolBar();<NEW_LINE>bindingContextButton = new javax.swing.JToggleButton();<NEW_LINE>unusedBindingsButton = new javax.swing.JToggleButton();<NEW_LINE>contentPanel = new javax.swing.JPanel();<NEW_LINE>messageLabel.setBackground(contextView.getViewport().getView().getBackground());<NEW_LINE>messageLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);<NEW_LINE>messageLabel.setEnabled(false);<NEW_LINE>messageLabel.setOpaque(true);<NEW_LINE>mainPanel.setLayout(new java.awt.BorderLayout());<NEW_LINE>toolBar.setFloatable(false);<NEW_LINE>toolBar.setRollover(true);<NEW_LINE>toolBarButtonGroup.add(bindingContextButton);<NEW_LINE>bindingContextButton.setSelected(true);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(bindingContextButton, org.openide.util.NbBundle.getMessage(KnockoutPanel.class, "KnockoutPanel.bindingContextButton.text"));<NEW_LINE>bindingContextButton.setFocusable(false);<NEW_LINE>bindingContextButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);<NEW_LINE>bindingContextButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);<NEW_LINE>bindingContextButton.addActionListener(new java.awt.event.ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>bindingContextButtonActionPerformed(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>toolBar.add(bindingContextButton);<NEW_LINE>toolBarButtonGroup.add(unusedBindingsButton);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(unusedBindingsButton, org.openide.util.NbBundle.getMessage(KnockoutPanel.class, "KnockoutPanel.unusedBindingsButton.text"));<NEW_LINE>unusedBindingsButton.setFocusable(false);<NEW_LINE>unusedBindingsButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);<NEW_LINE>unusedBindingsButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);<NEW_LINE>unusedBindingsButton.addActionListener(new java.awt.event.ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>unusedBindingsButtonActionPerformed(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>toolBar.add(unusedBindingsButton);<NEW_LINE>mainPanel.add(toolBar, java.awt.BorderLayout.PAGE_START);<NEW_LINE>contentPanel.setLayout(new java.awt.BorderLayout());<NEW_LINE>mainPanel.add(contentPanel, java.awt.BorderLayout.CENTER);<NEW_LINE>setLayout(new <MASK><NEW_LINE>} | java.awt.BorderLayout()); |
312,573 | public void containerAllocated(EventContext context, Container container) {<NEW_LINE>Task task = context.task;<NEW_LINE>LOG.info(task.getLabel() + " - Received container: " + DoYUtil.describeContainer(container));<NEW_LINE>context.group.dequeueAllocatingTask(task);<NEW_LINE>// No matter what happens below, we don't want to ask for this<NEW_LINE>// container again. The RM async API is a bit bizarre in this<NEW_LINE>// regard: it will keep asking for container over and over until<NEW_LINE>// we tell it to stop.<NEW_LINE>context.yarn.removeContainerRequest(task.containerRequest);<NEW_LINE>// The container is need both in the normal and in the cancellation<NEW_LINE>// path, so set it here.<NEW_LINE>task.container = container;<NEW_LINE>if (task.cancelled) {<NEW_LINE>context.yarn.releaseContainer(container);<NEW_LINE>taskStartFailed(context, Disposition.CANCELLED);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>task.error = null;<NEW_LINE>task.completionStatus = null;<NEW_LINE>transition(context, LAUNCHING);<NEW_LINE>// The pool that manages this task wants to know that we have<NEW_LINE>// a container. The task manager may want to do some task-<NEW_LINE>// specific setup.<NEW_LINE>context.group.containerAllocated(context.task);<NEW_LINE>context.<MASK><NEW_LINE>// Go ahead and launch a task in the container using the launch<NEW_LINE>// specification provided by the task group (pool).<NEW_LINE>try {<NEW_LINE>context.yarn.launchContainer(container, task.getLaunchSpec());<NEW_LINE>task.launchTime = System.currentTimeMillis();<NEW_LINE>} catch (YarnFacadeException e) {<NEW_LINE>LOG.error("Container launch failed: " + task.getContainerId(), e);<NEW_LINE>// This may not be the right response. RM may still think<NEW_LINE>// we have the container if the above is a local failure.<NEW_LINE>task.error = e;<NEW_LINE>context.group.containerReleased(task);<NEW_LINE>task.container = null;<NEW_LINE>taskStartFailed(context, Disposition.LAUNCH_FAILED);<NEW_LINE>}<NEW_LINE>} | getTaskManager().allocated(context); |
1,195,483 | public void memberAccess() {<NEW_LINE>NativeTopLevel<String> topLevel = new NativeTopLevel<>("foo");<NEW_LINE>String fooInstanceMethod = topLevel.instanceMethod("foo");<NEW_LINE>String fooStaticMethod = topLevel.staticMethod("foo");<NEW_LINE>String fooInstanceField = topLevel.instanceField;<NEW_LINE>topLevel.instanceField = "foo";<NEW_LINE>Object fooStaticField = topLevel.staticField;<NEW_LINE>topLevel.staticField = "foo";<NEW_LINE>int i1 = topLevel.fieldToRename;<NEW_LINE>int i2 = topLevel.methodToRename();<NEW_LINE>int i3 = topLevel.getMethodAsProperty();<NEW_LINE>int i4 = topLevel.nonGetMethodAsProperty();<NEW_LINE>int i5 = topLevel.methodToRenameAsProperty();<NEW_LINE>boolean i6 = topLevel.isFieldToRename;<NEW_LINE>boolean i7 = topLevel.isMethodAsProperty();<NEW_LINE>int i8 = topLevel.getstartingmethodAsProperty();<NEW_LINE>NativeTopLevel.Nested<String> nested = new NativeTopLevel.Nested<>("foo");<NEW_LINE>String nestedInstanceMethod = nested.instanceMethod("foo");<NEW_LINE>String <MASK><NEW_LINE>String nestedInstanceField = nested.instanceField;<NEW_LINE>nested.instanceField = "foo";<NEW_LINE>Object nestedStaticField = nested.staticField;<NEW_LINE>nested.staticField = "foo";<NEW_LINE>NativeTopLevel<String>.Inner<String> inner = topLevel.new Inner<String>("foo");<NEW_LINE>Subclass<String> subclass = new Subclass<>("foo");<NEW_LINE>int i9 = subclass.methodToRename();<NEW_LINE>int i10 = subclass.interfaceMethod();<NEW_LINE>int i11 = subclass.interfaceMethodToRename();<NEW_LINE>} | nestedStaticMethod = nested.staticMethod("foo"); |
1,687,654 | public static GetEditingProjectMaterialsResponse unmarshall(GetEditingProjectMaterialsResponse getEditingProjectMaterialsResponse, UnmarshallerContext _ctx) {<NEW_LINE>getEditingProjectMaterialsResponse.setRequestId(_ctx.stringValue("GetEditingProjectMaterialsResponse.RequestId"));<NEW_LINE>List<Material> materialList = new ArrayList<Material>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetEditingProjectMaterialsResponse.MaterialList.Length"); i++) {<NEW_LINE>Material material = new Material();<NEW_LINE>material.setMaterialId(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].MaterialId"));<NEW_LINE>material.setTitle(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Title"));<NEW_LINE>material.setTags(_ctx.stringValue<MASK><NEW_LINE>material.setStatus(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Status"));<NEW_LINE>material.setSize(_ctx.longValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Size"));<NEW_LINE>material.setDuration(_ctx.floatValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Duration"));<NEW_LINE>material.setDescription(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Description"));<NEW_LINE>material.setCreationTime(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CreationTime"));<NEW_LINE>material.setModifiedTime(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].ModifiedTime"));<NEW_LINE>material.setCoverURL(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CoverURL"));<NEW_LINE>material.setCateId(_ctx.integerValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CateId"));<NEW_LINE>material.setCateName(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].CateName"));<NEW_LINE>material.setSource(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Source"));<NEW_LINE>material.setSpriteConfig(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].SpriteConfig"));<NEW_LINE>material.setMaterialType(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].MaterialType"));<NEW_LINE>List<String> snapshots = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Snapshots.Length"); j++) {<NEW_LINE>snapshots.add(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Snapshots[" + j + "]"));<NEW_LINE>}<NEW_LINE>material.setSnapshots(snapshots);<NEW_LINE>List<String> sprites = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Sprites.Length"); j++) {<NEW_LINE>sprites.add(_ctx.stringValue("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Sprites[" + j + "]"));<NEW_LINE>}<NEW_LINE>material.setSprites(sprites);<NEW_LINE>materialList.add(material);<NEW_LINE>}<NEW_LINE>getEditingProjectMaterialsResponse.setMaterialList(materialList);<NEW_LINE>return getEditingProjectMaterialsResponse;<NEW_LINE>} | ("GetEditingProjectMaterialsResponse.MaterialList[" + i + "].Tags")); |
248,584 | private IRubyObject arrayRange(final ThreadContext context, final RubyRange range) {<NEW_LINE>final Object array = getObject();<NEW_LINE>final int arrayLength = Array.getLength(array);<NEW_LINE>final IRubyObject rFirst = range.first(context);<NEW_LINE>final IRubyObject rLast = range.last(context);<NEW_LINE>if (rFirst instanceof RubyFixnum && rLast instanceof RubyFixnum) {<NEW_LINE>int first = RubyFixnum.fix2int((RubyFixnum) rFirst);<NEW_LINE>int last = RubyFixnum.fix2int((RubyFixnum) rLast);<NEW_LINE>first = first >= 0 ? first : arrayLength + first;<NEW_LINE>if (first < 0 || first >= arrayLength)<NEW_LINE>return context.nil;<NEW_LINE>last = last >= 0 ? last : arrayLength + last;<NEW_LINE>int newLength = last - first;<NEW_LINE>if (!range.isExcludeEnd())<NEW_LINE>newLength++;<NEW_LINE>if (newLength <= 0) {<NEW_LINE>return ArrayUtils.emptyJavaArrayDirect(context, array.<MASK><NEW_LINE>}<NEW_LINE>return subarrayProxy(context, array, arrayLength, first, newLength);<NEW_LINE>}<NEW_LINE>throw context.runtime.newTypeError("only Integer ranges supported");<NEW_LINE>} | getClass().getComponentType()); |
1,256,159 | static JavaExpression atPath(String expression, TreePath localVarPath, SourceChecker checker) throws JavaExpressionParseException {<NEW_LINE>TypeMirror enclosingType = TreeUtils.typeOf(TreePathUtil.enclosingClass(localVarPath));<NEW_LINE>ThisReference thisReference = TreePathUtil.isTreeInStaticScope(localVarPath) ? null : new ThisReference(enclosingType);<NEW_LINE>MethodTree methodTree = TreePathUtil.enclosingMethod(localVarPath);<NEW_LINE>if (methodTree == null) {<NEW_LINE>return JavaExpressionParseUtil.parse(expression, enclosingType, thisReference, null, localVarPath, checker.getPathToCompilationUnit(), checker.getProcessingEnvironment());<NEW_LINE>}<NEW_LINE>ExecutableElement methodEle = TreeUtils.elementFromDeclaration(methodTree);<NEW_LINE>List<FormalParameter> parameters = JavaExpression.getFormalParameters(methodEle);<NEW_LINE>JavaExpression javaExpr = JavaExpressionParseUtil.parse(expression, enclosingType, thisReference, parameters, localVarPath, checker.getPathToCompilationUnit(), checker.getProcessingEnvironment());<NEW_LINE>List<JavaExpression> <MASK><NEW_LINE>return ViewpointAdaptJavaExpression.viewpointAdapt(javaExpr, paramsAsLocals);<NEW_LINE>} | paramsAsLocals = JavaExpression.getParametersAsLocalVariables(methodEle); |
653,016 | public void run() {<NEW_LINE>// set current threads classloader to the webapp classloader<NEW_LINE>Thread.currentThread().setContextClassLoader(webClassLoader);<NEW_LINE>// create a spring web application context<NEW_LINE>XmlWebApplicationContext appctx = new XmlWebApplicationContext();<NEW_LINE>appctx.setClassLoader(webClassLoader);<NEW_LINE>appctx.setConfigLocations(new String[] { contextConfigLocation });<NEW_LINE>// check for red5 context bean<NEW_LINE>ApplicationContext parentAppCtx = null;<NEW_LINE>if (applicationContext.containsBean(defaultParentContextKey)) {<NEW_LINE>parentAppCtx = (ApplicationContext) applicationContext.getBean(defaultParentContextKey);<NEW_LINE>appctx.setParent(parentAppCtx);<NEW_LINE>} else {<NEW_LINE>log.warn("{} bean was not found in context: {}", defaultParentContextKey, applicationContext.getDisplayName());<NEW_LINE>// lookup context loader and attempt to get what we need from it<NEW_LINE>if (applicationContext.containsBean("context.loader")) {<NEW_LINE>ContextLoader contextLoader = (ContextLoader) applicationContext.getBean("context.loader");<NEW_LINE>parentAppCtx = contextLoader.getContext(defaultParentContextKey);<NEW_LINE>appctx.setParent(parentAppCtx);<NEW_LINE>} else {<NEW_LINE>log.debug("Context loader was not found, trying JMX");<NEW_LINE>MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();<NEW_LINE>// get the ContextLoader from jmx<NEW_LINE>ContextLoaderMXBean proxy = null;<NEW_LINE>ObjectName oName = null;<NEW_LINE>try {<NEW_LINE>oName = new ObjectName("org.red5.server:name=contextLoader,type=ContextLoader");<NEW_LINE>if (mbs.isRegistered(oName)) {<NEW_LINE>proxy = JMX.newMXBeanProxy(mbs, oName, ContextLoaderMXBean.class, true);<NEW_LINE>log.debug("Context loader was found");<NEW_LINE>proxy.setParentContext(defaultParentContextKey, appctx.getId());<NEW_LINE>} else {<NEW_LINE>log.warn("Context loader was not found");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.warn("Exception looking up ContextLoader", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// add the servlet context<NEW_LINE>appctx.setServletContext(servletContext);<NEW_LINE>// set the root webapp ctx attr on the each servlet context so spring can find it later<NEW_LINE>servletContext.<MASK><NEW_LINE>appctx.refresh();<NEW_LINE>} | setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); |
1,364,012 | public com.amazonaws.services.lookoutforvision.model.AccessDeniedException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.lookoutforvision.model.AccessDeniedException accessDeniedException = new com.amazonaws.services.lookoutforvision.model.AccessDeniedException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 accessDeniedException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
736,382 | void updateRoutingProfile(String profileKey) {<NEW_LINE>ProfileDataObject selectedRoutingProfileDataObject = routingProfileDataObjects.get(profileKey);<NEW_LINE>if (profileKey == null || selectedRoutingProfileDataObject == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, ProfileDataObject> rp : routingProfileDataObjects.entrySet()) {<NEW_LINE>boolean selected = profileKey.<MASK><NEW_LINE>rp.getValue().setSelected(selected);<NEW_LINE>}<NEW_LINE>navigationType.setSummary(selectedRoutingProfileDataObject.getName());<NEW_LINE>navigationType.setIcon(getActiveIcon(selectedRoutingProfileDataObject.getIconRes()));<NEW_LINE>ApplicationMode appMode = getSelectedAppMode();<NEW_LINE>RouteService routeService;<NEW_LINE>if (profileKey.equals(RoutingProfilesResources.STRAIGHT_LINE_MODE.name())) {<NEW_LINE>routeService = RouteService.STRAIGHT;<NEW_LINE>} else if (profileKey.equals(RoutingProfilesResources.DIRECT_TO_MODE.name())) {<NEW_LINE>routeService = RouteService.DIRECT_TO;<NEW_LINE>} else if (profileKey.equals(RoutingProfilesResources.BROUTER_MODE.name())) {<NEW_LINE>routeService = RouteService.BROUTER;<NEW_LINE>} else if (profileKey.startsWith(ONLINE_ROUTING_ENGINE_PREFIX)) {<NEW_LINE>routeService = RouteService.ONLINE;<NEW_LINE>} else {<NEW_LINE>routeService = RouteService.OSMAND;<NEW_LINE>}<NEW_LINE>appMode.setRouteService(routeService);<NEW_LINE>appMode.setRoutingProfile(profileKey);<NEW_LINE>} | equals(rp.getKey()); |
1,247,341 | static Single<WebServer> startServer() {<NEW_LINE>// load logging configuration<NEW_LINE>LogConfig.configureRuntime();<NEW_LINE>// By default this will pick up application.yaml from the classpath<NEW_LINE>Config config = Config.create();<NEW_LINE>WebServer server = WebServer.builder().routing(createRouting(config)).config(config.get("server")).addMediaSupport(JsonpSupport.create()).build();<NEW_LINE>Single<WebServer> webserver = server.start();<NEW_LINE>// Try to start the server. If successful, print some info and arrange to<NEW_LINE>// print a message at shutdown. If unsuccessful, print the exception.<NEW_LINE>webserver.thenAccept(ws -> {<NEW_LINE>System.out.println("WEB server is up! http://localhost:" + ws.port() + "/greet");<NEW_LINE>ws.whenShutdown().thenRun(() -> System.out.println("WEB server is DOWN. Good bye!"));<NEW_LINE>}).exceptionallyAccept(t -> {<NEW_LINE>System.err.println(<MASK><NEW_LINE>t.printStackTrace(System.err);<NEW_LINE>});<NEW_LINE>return webserver;<NEW_LINE>} | "Startup failed: " + t.getMessage()); |
65,588 | public static void dumpLocks(Connection conn) {<NEW_LINE>Statement stmt = null;<NEW_LINE>try {<NEW_LINE>String sql = "select pg_class.relname,pg_locks.* from pg_class,pg_locks where pg_class.relfilenode=pg_locks.relation order by 1";<NEW_LINE>stmt = conn.createStatement();<NEW_LINE>ResultSet rs = stmt.executeQuery(sql);<NEW_LINE>int cnt = rs.getMetaData().getColumnCount();<NEW_LINE>System.out.println();<NEW_LINE>while (rs.next()) {<NEW_LINE>for (int i = 0; i < cnt; i++) {<NEW_LINE>Object value = <MASK><NEW_LINE>if (i > 0)<NEW_LINE>System.out.print(", ");<NEW_LINE>System.out.print(value != null ? value.toString() : "");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>} catch (Exception e) {<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (stmt != null)<NEW_LINE>stmt.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | rs.getObject(i + 1); |
159,812 | private void configureXcodeForXCTest(final Project project) {<NEW_LINE>project.afterEvaluate(new Action<Project>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void execute(Project project) {<NEW_LINE>SwiftXCTestSuite component = project.getExtensions().getByType(SwiftXCTestSuite.class);<NEW_LINE>FileCollection sources = component.getSwiftSource();<NEW_LINE>xcodeProject.getGroups().getTests().from(sources);<NEW_LINE>String targetName = component.getModule().get();<NEW_LINE>final XcodeTarget target = newTarget(targetName, component.getModule().get(), toGradleCommand(project), getBridgeTaskPath(project), sources);<NEW_LINE>target.getSwiftSourceCompatibility().convention(component.getSourceCompatibility());<NEW_LINE>if (component.getTestBinary().isPresent()) {<NEW_LINE>target.addBinary(DefaultXcodeProject.BUILD_DEBUG, component.getTestBinary().get().getInstallDirectory(), component.getTestBinary().get().getTargetMachine().getArchitecture().getName());<NEW_LINE>target.addBinary(DefaultXcodeProject.BUILD_RELEASE, component.getTestBinary().get().getInstallDirectory(), component.getTestBinary().get().getTargetMachine().<MASK><NEW_LINE>target.setProductType(PBXTarget.ProductType.UNIT_TEST);<NEW_LINE>target.getCompileModules().from(component.getTestBinary().get().getCompileModules());<NEW_LINE>target.addTaskDependency(filterArtifactsFromImplicitBuilds(((DefaultSwiftBinary) component.getTestBinary().get()).getImportPathConfiguration()).getBuildDependencies());<NEW_LINE>}<NEW_LINE>component.getBinaries().whenElementFinalized(new Action<SwiftBinary>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void execute(SwiftBinary swiftBinary) {<NEW_LINE>target.getSwiftSourceCompatibility().set(swiftBinary.getTargetPlatform().getSourceCompatibility());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>xcodeProject.addTarget(target);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getArchitecture().getName()); |
1,350,463 | // We explicitly want commit() so that the dumper blocks while the write occurs.<NEW_LINE>@SuppressLint("CommitPrefEdits")<NEW_LINE>private void doWrite(List<String> args) throws DumpUsageException {<NEW_LINE>String usagePrefix = "Usage: prefs write <path> <key> <type> <value>, where type is one of: ";<NEW_LINE>Iterator<String> argsIter = args.iterator();<NEW_LINE>String path = nextArg(argsIter, "Expected <path>");<NEW_LINE>String key = nextArg(argsIter, "Expected <key>");<NEW_LINE>String typeName = nextArg(argsIter, "Expected <type>");<NEW_LINE>Type type = Type.of(typeName);<NEW_LINE>if (type == null) {<NEW_LINE>throw new DumpUsageException(Type.appendNamesList(new StringBuilder(usagePrefix), ", ").toString());<NEW_LINE>}<NEW_LINE>SharedPreferences sharedPreferences = getSharedPreferences(path);<NEW_LINE>SharedPreferences.Editor editor = sharedPreferences.edit();<NEW_LINE>switch(type) {<NEW_LINE>case BOOLEAN:<NEW_LINE>editor.putBoolean(key, Boolean.valueOf(nextArgValue(argsIter)));<NEW_LINE>break;<NEW_LINE>case INT:<NEW_LINE>editor.putInt(key, Integer.valueOf(nextArgValue(argsIter)));<NEW_LINE>break;<NEW_LINE>case LONG:<NEW_LINE>editor.putLong(key, Long.valueOf(nextArgValue(argsIter)));<NEW_LINE>break;<NEW_LINE>case FLOAT:<NEW_LINE>editor.putFloat(key, Float.valueOf(nextArgValue(argsIter)));<NEW_LINE>break;<NEW_LINE>case STRING:<NEW_LINE>editor.putString(key, nextArgValue(argsIter));<NEW_LINE>break;<NEW_LINE>case SET:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>editor.commit();<NEW_LINE>} | putStringSet(editor, key, argsIter); |
620,193 | private void recreateNetwork(Model model, Device device, int numThreads) {<NEW_LINE>if (model == null)<NEW_LINE>return;<NEW_LINE>tracker.clearTrackedObjects();<NEW_LINE>if (detector != null) {<NEW_LINE>LOGGER.d("Closing detector.");<NEW_LINE>detector.close();<NEW_LINE>detector = null;<NEW_LINE>}<NEW_LINE>if (autopilot != null) {<NEW_LINE>LOGGER.d("Closing autoPilot.");<NEW_LINE>autopilot.close();<NEW_LINE>autopilot = null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (model.type == Model.TYPE.DETECTOR) {<NEW_LINE>LOGGER.d("Creating detector (model=%s, device=%s, numThreads=%d)", model, device, numThreads);<NEW_LINE>detector = Detector.create(this, model, device, numThreads);<NEW_LINE>croppedBitmap = Bitmap.createBitmap(detector.getImageSizeX(), detector.getImageSizeY(), Config.ARGB_8888);<NEW_LINE>frameToCropTransform = ImageUtils.getTransformationMatrix(previewWidth, previewHeight, croppedBitmap.getWidth(), croppedBitmap.getHeight(), sensorOrientation, detector.getCropRect(), detector.getMaintainAspect());<NEW_LINE>} else {<NEW_LINE>LOGGER.d("Creating autopilot (model=%s, device=%s, numThreads=%d)", model, device, numThreads);<NEW_LINE>autopilot = Autopilot.create(<MASK><NEW_LINE>croppedBitmap = Bitmap.createBitmap(autopilot.getImageSizeX(), autopilot.getImageSizeY(), Config.ARGB_8888);<NEW_LINE>frameToCropTransform = ImageUtils.getTransformationMatrix(previewWidth, previewHeight, croppedBitmap.getWidth(), croppedBitmap.getHeight(), sensorOrientation, autopilot.getCropRect(), autopilot.getMaintainAspect());<NEW_LINE>}<NEW_LINE>cropToFrameTransform = new Matrix();<NEW_LINE>frameToCropTransform.invert(cropToFrameTransform);<NEW_LINE>} catch (IllegalArgumentException | IOException e) {<NEW_LINE>String msg = "Failed to create network: ";<NEW_LINE>LOGGER.e(e, msg);<NEW_LINE>Toast.makeText(this, msg + e.toString(), Toast.LENGTH_LONG).show();<NEW_LINE>}<NEW_LINE>} | this, model, device, numThreads); |
220,527 | private static // and uploads it to the blurred bucket.<NEW_LINE>void blur(BlobInfo blobInfo) throws IOException {<NEW_LINE>String bucketName = blobInfo.getBucket();<NEW_LINE>String fileName = blobInfo.getName();<NEW_LINE>// Download image<NEW_LINE>Blob blob = storage.get(BlobId.of(bucketName, fileName));<NEW_LINE>Path download = <MASK><NEW_LINE>blob.downloadTo(download);<NEW_LINE>// Construct the command.<NEW_LINE>Path upload = Paths.get("/tmp/", "blurred-" + fileName);<NEW_LINE>List<String> args = List.of("convert", download.toString(), "-blur", "0x8", upload.toString());<NEW_LINE>try {<NEW_LINE>ProcessBuilder pb = new ProcessBuilder(args);<NEW_LINE>Process process = pb.start();<NEW_LINE>process.waitFor();<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.info(String.format("Error: %s", e.getMessage()));<NEW_LINE>}<NEW_LINE>// Upload image to blurred bucket.<NEW_LINE>BlobId blurredBlobId = BlobId.of(BLURRED_BUCKET_NAME, fileName);<NEW_LINE>BlobInfo blurredBlobInfo = BlobInfo.newBuilder(blurredBlobId).setContentType(blob.getContentType()).build();<NEW_LINE>byte[] blurredFile = Files.readAllBytes(upload);<NEW_LINE>storage.create(blurredBlobInfo, blurredFile);<NEW_LINE>logger.info(String.format("Blurred image uploaded to: gs://%s/%s", BLURRED_BUCKET_NAME, fileName));<NEW_LINE>// Remove images from fileSystem<NEW_LINE>Files.delete(download);<NEW_LINE>Files.delete(upload);<NEW_LINE>} | Paths.get("/tmp/", fileName); |
1,156,312 | public ASTNode visitSimpleSelect(final SimpleSelectContext ctx) {<NEW_LINE>PostgreSQLSelectStatement result = new PostgreSQLSelectStatement();<NEW_LINE>if (null != ctx.targetList()) {<NEW_LINE>ProjectionsSegment projects = (ProjectionsSegment) visit(ctx.targetList());<NEW_LINE>if (null != ctx.distinctClause()) {<NEW_LINE>projects.setDistinctRow(true);<NEW_LINE>}<NEW_LINE>result.setProjections(projects);<NEW_LINE>} else {<NEW_LINE>result.setProjections(new ProjectionsSegment(-1, -1));<NEW_LINE>}<NEW_LINE>if (null != ctx.fromClause()) {<NEW_LINE>TableSegment tableSegment = (TableSegment) visit(ctx.fromClause());<NEW_LINE>result.setFrom(tableSegment);<NEW_LINE>}<NEW_LINE>if (null != ctx.whereClause()) {<NEW_LINE>result.setWhere((WhereSegment) visit(ctx.whereClause()));<NEW_LINE>}<NEW_LINE>if (null != ctx.groupClause()) {<NEW_LINE>result.setGroupBy((GroupBySegment) visit(ctx.groupClause()));<NEW_LINE>}<NEW_LINE>if (null != ctx.havingClause()) {<NEW_LINE>result.setHaving((HavingSegment) visit(ctx.havingClause()));<NEW_LINE>}<NEW_LINE>if (null != ctx.windowClause()) {<NEW_LINE>result.setWindow((WindowSegment) visit<MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (ctx.windowClause())); |
383,218 | public void validate(ValidationHelper helper, Context context, String key, OpenAPI t) {<NEW_LINE>if (t != null) {<NEW_LINE>String openapiVersion = t.getOpenapi();<NEW_LINE>ValidatorUtils.validateRequiredField(openapiVersion, context, DefinitionConstant.PROP_OPENAPI).ifPresent(helper::addValidationEvent);<NEW_LINE>ValidatorUtils.validateRequiredField(t.getInfo(), context, DefinitionConstant.PROP_INFO).ifPresent(helper::addValidationEvent);<NEW_LINE>ValidatorUtils.validateRequiredField(t.getPaths(), context, DefinitionConstant.PROP_PATHS).ifPresent(helper::addValidationEvent);<NEW_LINE>if (openapiVersion != null && !openapiVersion.startsWith("3.")) {<NEW_LINE>final String message = Tr.formatMessage(tc, ValidationMessageConstants.OPENAPI_VERSION_INVALID, openapiVersion);<NEW_LINE>helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));<NEW_LINE>}<NEW_LINE>List<Tag> tags = t.getTags();<NEW_LINE>if (tags != null) {<NEW_LINE>Set<String> tagNames = new HashSet<>();<NEW_LINE>for (Tag tag : tags) {<NEW_LINE>if (!tagNames.add(tag.getName())) {<NEW_LINE>final String message = Tr.formatMessage(tc, ValidationMessageConstants.<MASK><NEW_LINE>helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | OPENAPI_TAG_IS_NOT_UNIQUE, tag.getName()); |
1,265,232 | public EnvironmentRevision unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>EnvironmentRevision environmentRevision = new EnvironmentRevision();<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("counts", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentRevision.setCounts(TaskCountsJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("environmentRevisionId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentRevision.setEnvironmentRevisionId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("instanceGroup", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentRevision.setInstanceGroup(InstanceGroupJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("taskDefinition", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentRevision.setTaskDefinition(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return environmentRevision;<NEW_LINE>} | ().unmarshall(context)); |
220,631 | private static void closeConnection(@NotNull final ClientConnection clientConnection, final boolean withReasonCode, final boolean withReasonString, @Nullable Mqtt5DisconnectReasonCode reasonCode, @Nullable String reasonString, @NotNull final Mqtt5UserProperties userProperties, final boolean forceClose) {<NEW_LINE>if (reasonCode == Mqtt5DisconnectReasonCode.SESSION_TAKEN_OVER) {<NEW_LINE>clientConnection.proposeClientState(ClientState.DISCONNECTED_TAKEN_OVER);<NEW_LINE>} else {<NEW_LINE>clientConnection.proposeClientState(ClientState.DISCONNECTED_BY_SERVER);<NEW_LINE>}<NEW_LINE>if (forceClose) {<NEW_LINE>clientConnection.getChannel().close();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ProtocolVersion version = clientConnection.getProtocolVersion();<NEW_LINE>if (withReasonCode) {<NEW_LINE>if (version == ProtocolVersion.MQTTv5) {<NEW_LINE>Preconditions.checkNotNull(reasonCode, "Reason code must never be null for Mqtt 5");<NEW_LINE>}<NEW_LINE>if (!withReasonString) {<NEW_LINE>reasonString = null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>reasonCode = null;<NEW_LINE>reasonString = null;<NEW_LINE>}<NEW_LINE>if (reasonCode != null && version == ProtocolVersion.MQTTv5) {<NEW_LINE>final DISCONNECT disconnect = new DISCONNECT(reasonCode, reasonString, userProperties, null, SESSION_EXPIRY_NOT_SET);<NEW_LINE>clientConnection.getChannel().writeAndFlush(disconnect<MASK><NEW_LINE>} else {<NEW_LINE>// close channel without sending DISCONNECT (Mqtt 3)<NEW_LINE>clientConnection.getChannel().close();<NEW_LINE>}<NEW_LINE>} | ).addListener(ChannelFutureListener.CLOSE); |
421,089 | static ZTFilePermissions fromPosixFileMode(int mode) {<NEW_LINE>ZTFilePermissions permissions = new ZTFilePermissions();<NEW_LINE>permissions.setOwnerCanExecute((mode & OWNER_EXECUTE_FLAG) > 0);<NEW_LINE>permissions.setGroupCanExecute((mode & GROUP_EXECUTE_FLAG) > 0);<NEW_LINE>permissions.setOthersCanExecute((mode & OTHERS_EXECUTE_FLAG) > 0);<NEW_LINE>permissions.setOwnerCanWrite((mode & OWNER_WRITE_FLAG) > 0);<NEW_LINE>permissions.setGroupCanWrite((mode & GROUP_WRITE_FLAG) > 0);<NEW_LINE>permissions.setOthersCanWrite((mode & OTHERS_WRITE_FLAG) > 0);<NEW_LINE>permissions.setOwnerCanRead(<MASK><NEW_LINE>permissions.setGroupCanRead((mode & GROUP_READ_FLAG) > 0);<NEW_LINE>permissions.setOthersCanRead((mode & OTHERS_READ_FLAG) > 0);<NEW_LINE>return permissions;<NEW_LINE>} | (mode & OWNER_READ_FLAG) > 0); |
1,244,936 | final PutMetricFilterResult executePutMetricFilter(PutMetricFilterRequest putMetricFilterRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putMetricFilterRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutMetricFilterRequest> request = null;<NEW_LINE>Response<PutMetricFilterResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutMetricFilterRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putMetricFilterRequest));<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, "CloudWatch Logs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutMetricFilter");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutMetricFilterResult>> 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 PutMetricFilterResultJsonUnmarshaller()); |
1,713,189 | public CreateAnomalyDetectorResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateAnomalyDetectorResult createAnomalyDetectorResult = new CreateAnomalyDetectorResult();<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 createAnomalyDetectorResult;<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("AnomalyDetectorArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createAnomalyDetectorResult.setAnomalyDetectorArn(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createAnomalyDetectorResult;<NEW_LINE>} | class).unmarshall(context)); |
1,096,881 | public void run() {<NEW_LINE>boolean isDebugEnabled = _log.isDebugEnabled();<NEW_LINE>Object nextState = null;<NEW_LINE>boolean running = true;<NEW_LINE>try {<NEW_LINE>while (running && !checkForShutdownRequest()) {<NEW_LINE>nextState = pollNextState();<NEW_LINE>if (null == nextState) {<NEW_LINE>running = false;<NEW_LINE>} else {<NEW_LINE>if (isDebugEnabled)<NEW_LINE>_log.debug(getName() + ": new state: " + nextState.toString());<NEW_LINE>running = doExecuteAndChangeState(nextState);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>_log.error(getName() + ": stopping because of unhandled exception: ", e);<NEW_LINE>running = false;<NEW_LINE>}<NEW_LINE>if (isDebugEnabled) {<NEW_LINE>StringBuilder sb = new StringBuilder(10240);<NEW_LINE>sb.append(getName());<NEW_LINE>sb.append(": message queue at exit:");<NEW_LINE>while (null != (nextState = _messageQueue.poll())) {<NEW_LINE>sb.append(nextState.toString());<NEW_LINE>sb.append(' ');<NEW_LINE>}<NEW_LINE>_log.debug(sb.toString());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>performShutdown();<NEW_LINE>} finally {<NEW_LINE>_controlLock.lock();<NEW_LINE>try {<NEW_LINE>_componentStatus.shutdown();<NEW_LINE>_shutdownCondition.signalAll();<NEW_LINE>} finally {<NEW_LINE>_controlLock.unlock();<NEW_LINE>}<NEW_LINE>_log.<MASK><NEW_LINE>if (isDebugEnabled)<NEW_LINE>_log.debug(getName() + ": exited message loop.");<NEW_LINE>}<NEW_LINE>} | info("Message Queue History (earliest first) at shutdown:" + getMessageHistoryLog()); |
1,209,805 | public // concatenated with the label field. Case Insensitive<NEW_LINE>int compareTo(@NotNull MacroButtonProperties b2) throws ClassCastException {<NEW_LINE>if (b2 != this) {<NEW_LINE>String b1group = getGroup();<NEW_LINE>if (b1group == null)<NEW_LINE>b1group = "";<NEW_LINE>String b1sortby = getSortby();<NEW_LINE>if (b1sortby == null)<NEW_LINE>b1sortby = "";<NEW_LINE>String b1label = getLabel();<NEW_LINE>if (b1label == null)<NEW_LINE>b1label = "";<NEW_LINE>String b2group = b2.getGroup();<NEW_LINE>if (b2group == null)<NEW_LINE>b2group = "";<NEW_LINE>String b2sortby = b2.getSortby();<NEW_LINE>if (b2sortby == null)<NEW_LINE>b2sortby = "";<NEW_LINE>String b2label = b2.getLabel();<NEW_LINE>if (b2label == null)<NEW_LINE>b2label = "";<NEW_LINE>// now parse the sort strings to help dice codes sort properly, use space as a separator<NEW_LINE>String b1string = modifySortString(" " + b1group + <MASK><NEW_LINE>String b2string = modifySortString(" " + b2group + " " + b2sortby + " " + b2label);<NEW_LINE>return b1string.compareToIgnoreCase(b2string);<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | " " + b1sortby + " " + b1label); |
1,564,550 | private void genBitSet(BitSet p, int id) {<NEW_LINE>int _tabs_ = tabs;<NEW_LINE>// wanna have bitsets on module scope, so they are available<NEW_LINE>// when module gets loaded.<NEW_LINE>tabs = 0;<NEW_LINE>println("");<NEW_LINE>println("### generate bit set");<NEW_LINE>println("def mk" + getBitsetName(id) + "(): ");<NEW_LINE>tabs++;<NEW_LINE>int n = p.lengthInLongWords();<NEW_LINE>if (n < BITSET_OPTIMIZE_INIT_THRESHOLD) {<NEW_LINE>println("### var1");<NEW_LINE>println("data = [ " + p.toStringOfWords() + "]");<NEW_LINE>} else {<NEW_LINE>// will init manually, allocate space then set values<NEW_LINE>println("data = [0L] * " + n + " ### init list");<NEW_LINE>long[] elems = p.toPackedArray();<NEW_LINE>for (int i = 0; i < elems.length; ) {<NEW_LINE>if (elems[i] == 0) {<NEW_LINE>// done automatically by Java, don't waste time/code<NEW_LINE>i++;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if ((i + 1) == elems.length || elems[i] != elems[i + 1]) {<NEW_LINE>// last number or no run of numbers, just dump assignment<NEW_LINE>println("data[" + i + "] =" + elems[i] + "L");<NEW_LINE>i++;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// scan to find end of run<NEW_LINE>int j;<NEW_LINE>for (j = i + 1; j < elems.length && elems[j] == elems[i]; j++) {<NEW_LINE>}<NEW_LINE>long e = elems[i];<NEW_LINE>// E0007: fixed<NEW_LINE>println("for x in xrange(" + i + ", " + j + "):");<NEW_LINE>tabs++;<NEW_LINE>println("data[x] = " + e + "L");<NEW_LINE>tabs--;<NEW_LINE>i = j;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>println("return data");<NEW_LINE>tabs--;<NEW_LINE>// BitSet object<NEW_LINE>println(getBitsetName(id) + " = antlr.BitSet(mk" <MASK><NEW_LINE>// restore tabs<NEW_LINE>tabs = _tabs_;<NEW_LINE>} | + getBitsetName(id) + "())"); |
363,552 | private void perform(final BaseNode node) {<NEW_LINE>DatabaseConnection connection = node.getLookup().lookup(DatabaseConnection.class);<NEW_LINE>String schemaName = findSchemaWorkingName(node.getLookup());<NEW_LINE>try {<NEW_LINE>boolean viewsSupported = connection.getConnector().getDriverSpecification(schemaName).areViewsSupported();<NEW_LINE>if (!viewsSupported) {<NEW_LINE>// NOI18N<NEW_LINE>String // NOI18N<NEW_LINE>message = // NOI18N<NEW_LINE>NbBundle.// NOI18N<NEW_LINE>getMessage(// NOI18N<NEW_LINE>CreateViewAction.class, "MSG_ViewsAreNotSupported", connection.getJDBCConnection().getMetaData().getDatabaseProductName().trim());<NEW_LINE>DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.INFORMATION_MESSAGE));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Specification spec = connection.getConnector().getDatabaseSpecification();<NEW_LINE>boolean viewAdded = AddViewDialog.showDialogAndCreate(spec, schemaName);<NEW_LINE>if (viewAdded) {<NEW_LINE>SystemAction.get(RefreshAction.class).performAction(<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception exc) {<NEW_LINE>Logger.getLogger(CreateViewAction.class.getName()).log(Level.INFO, exc.getLocalizedMessage(), exc);<NEW_LINE>// NOI18N<NEW_LINE>DbUtilities.reportError(NbBundle.getMessage(CreateViewAction.class, "ERR_UnableToCreateView"), exc.getMessage());<NEW_LINE>}<NEW_LINE>} | new Node[] { node }); |
45,355 | public Xml visitTag(Xml.Tag tag, ExecutionContext ctx) {<NEW_LINE>if (isDependencyTag(oldGroupId, oldArtifactId)) {<NEW_LINE>Optional<Xml.Tag> groupIdTag = tag.getChild("groupId");<NEW_LINE>boolean changed = false;<NEW_LINE>if (groupIdTag.isPresent() && !newGroupId.equals(groupIdTag.get().getValue().orElse(null))) {<NEW_LINE>doAfterVisit(new ChangeTagValueVisitor<>(groupIdTag.get(), newGroupId));<NEW_LINE>changed = true;<NEW_LINE>}<NEW_LINE>Optional<Xml.Tag> artifactIdTag = tag.getChild("artifactId");<NEW_LINE>if (artifactIdTag.isPresent() && !newArtifactId.equals(artifactIdTag.get().getValue().orElse(null))) {<NEW_LINE>doAfterVisit(new ChangeTagValueVisitor<>(artifactIdTag.get(), newArtifactId));<NEW_LINE>changed = true;<NEW_LINE>}<NEW_LINE>if (newVersion != null) {<NEW_LINE>Optional<Xml.Tag> versionTag = tag.getChild("version");<NEW_LINE>if (versionTag.isPresent() && !newVersion.equals(versionTag.get().getValue().orElse(null))) {<NEW_LINE>doAfterVisit(new ChangeTagValueVisitor<>(versionTag<MASK><NEW_LINE>changed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (changed) {<NEW_LINE>maybeUpdateModel();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return super.visitTag(tag, ctx);<NEW_LINE>} | .get(), newVersion)); |
721,319 | public static Instrumenter<ConsumerRecord<?, ?>, Void> createConsumerOperationInstrumenter(String instrumentationName, OpenTelemetry openTelemetry, MessageOperation operation, Iterable<AttributesExtractor<ConsumerRecord<?, ?>, Void>> extractors) {<NEW_LINE>KafkaConsumerAttributesGetter getter = KafkaConsumerAttributesGetter.INSTANCE;<NEW_LINE>InstrumenterBuilder<ConsumerRecord<?, ?>, Void> builder = Instrumenter.<ConsumerRecord<?, ?>, Void>builder(openTelemetry, instrumentationName, MessagingSpanNameExtractor.create(getter, operation)).addAttributesExtractor(MessagingAttributesExtractor.create(getter, operation)).addAttributesExtractor(new KafkaConsumerAdditionalAttributesExtractor()).addAttributesExtractors(extractors);<NEW_LINE>if (KafkaConsumerExperimentalAttributesExtractor.isEnabled()) {<NEW_LINE>builder.addAttributesExtractor(new KafkaConsumerExperimentalAttributesExtractor());<NEW_LINE>}<NEW_LINE>if (!KafkaPropagation.isPropagationEnabled()) {<NEW_LINE>return builder.newInstrumenter(SpanKindExtractor.alwaysConsumer());<NEW_LINE>} else if (ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) {<NEW_LINE>builder.addSpanLinksExtractor(SpanLinksExtractor.fromUpstreamRequest(GlobalOpenTelemetry.getPropagators(), KafkaConsumerRecordGetter.INSTANCE));<NEW_LINE>return builder.<MASK><NEW_LINE>} else {<NEW_LINE>return builder.newConsumerInstrumenter(KafkaConsumerRecordGetter.INSTANCE);<NEW_LINE>}<NEW_LINE>} | newInstrumenter(SpanKindExtractor.alwaysConsumer()); |
938,725 | public boolean deleteUserAccount(long accountId) {<NEW_LINE>CallContext ctx = CallContext.current();<NEW_LINE>long callerUserId = ctx.getCallingUserId();<NEW_LINE>Account caller = ctx.getCallingAccount();<NEW_LINE>// If the user is a System user, return an error. We do not allow this<NEW_LINE>AccountVO account = _accountDao.findById(accountId);<NEW_LINE>if (account == null || account.getRemoved() != null) {<NEW_LINE>if (account != null) {<NEW_LINE>s_logger.info("The account:" + <MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// don't allow removing Project account<NEW_LINE>if (account == null || account.getType() == Account.Type.PROJECT) {<NEW_LINE>throw new InvalidParameterValueException("The specified account does not exist in the system");<NEW_LINE>}<NEW_LINE>checkAccess(caller, null, true, account);<NEW_LINE>// don't allow to delete default account (system and admin)<NEW_LINE>if (account.isDefault()) {<NEW_LINE>throw new InvalidParameterValueException("The account is default and can't be removed");<NEW_LINE>}<NEW_LINE>// Account that manages project(s) can't be removed<NEW_LINE>List<Long> managedProjectIds = _projectAccountDao.listAdministratedProjectIds(accountId);<NEW_LINE>if (!managedProjectIds.isEmpty()) {<NEW_LINE>StringBuilder projectIds = new StringBuilder();<NEW_LINE>for (Long projectId : managedProjectIds) {<NEW_LINE>projectIds.append(projectId + ", ");<NEW_LINE>}<NEW_LINE>throw new InvalidParameterValueException("The account id=" + accountId + " manages project(s) with ids " + projectIds + "and can't be removed");<NEW_LINE>}<NEW_LINE>CallContext.current().putContextParameter(Account.class, account.getUuid());<NEW_LINE>return deleteAccount(account, callerUserId, caller);<NEW_LINE>} | account.getAccountName() + " is already removed"); |
1,664,199 | private void createSetMenuEntries(JMenu edit) {<NEW_LINE>edit.add(new ToolTipAction(Lang.get("menu_table_setXTo0")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>modifyTable(v -> v > 1 ? 0 : v);<NEW_LINE>}<NEW_LINE>}.setToolTip(Lang.get("menu_table_setXTo0_tt")).createJMenuItem());<NEW_LINE>edit.add(new ToolTipAction(Lang.get("menu_table_setXTo1")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>modifyTable(v -> v > 1 ? 1 : v);<NEW_LINE>}<NEW_LINE>}.setToolTip(Lang.get("menu_table_setXTo1_tt")).createJMenuItem());<NEW_LINE>edit.add(new ToolTipAction(Lang.get("menu_table_setAllToX")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>modifyTable(v -> (byte) 2);<NEW_LINE>}<NEW_LINE>}.setToolTip(Lang.get("menu_table_setAllToX_tt")).createJMenuItem());<NEW_LINE>edit.add(new ToolTipAction(Lang.get("menu_table_setAllTo0")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>modifyTable<MASK><NEW_LINE>}<NEW_LINE>}.setToolTip(Lang.get("menu_table_setAllTo0_tt")).createJMenuItem());<NEW_LINE>edit.add(new ToolTipAction(Lang.get("menu_table_setAllTo1")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>modifyTable(v -> (byte) 1);<NEW_LINE>}<NEW_LINE>}.setToolTip(Lang.get("menu_table_setAllTo1_tt")).createJMenuItem());<NEW_LINE>edit.add(new ToolTipAction(Lang.get("menu_table_invert")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>modifyTable(v -> v > 1 ? v : (byte) (1 - v));<NEW_LINE>}<NEW_LINE>}.setToolTip(Lang.get("menu_table_invert_tt")).createJMenuItem());<NEW_LINE>} | (v -> (byte) 0); |
1,158,374 | public void updateConfigs(Map<String, Object> updates) {<NEW_LINE>updates.entrySet().forEach(entry -> {<NEW_LINE>if (entry.getKey().equals(ProducerConfig.TRANSACTIONAL_ID_CONFIG)) {<NEW_LINE>Assert.isTrue(entry.getValue() instanceof String, () -> "'" + ProducerConfig.TRANSACTIONAL_ID_CONFIG + "' must be a String, not a " + entry.<MASK><NEW_LINE>Assert.isTrue(this.transactionIdPrefix != null ? entry.getValue() != null : entry.getValue() == null, "Cannot change transactional capability");<NEW_LINE>this.transactionIdPrefix = (String) entry.getValue();<NEW_LINE>} else if (entry.getKey().equals(ProducerConfig.CLIENT_ID_CONFIG)) {<NEW_LINE>Assert.isTrue(entry.getValue() instanceof String, () -> "'" + ProducerConfig.CLIENT_ID_CONFIG + "' must be a String, not a " + entry.getClass().getName());<NEW_LINE>this.clientIdPrefix = (String) entry.getValue();<NEW_LINE>} else {<NEW_LINE>this.configs.put(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getClass().getName()); |
1,747,730 | private boolean isPermitted(Project project, ProjectAccount projectUser, String apiCommandName) {<NEW_LINE>ProjectRole projectRole = null;<NEW_LINE>if (projectUser.getProjectRoleId() != null) {<NEW_LINE>projectRole = projectRoleService.findProjectRole(projectUser.getProjectRoleId(<MASK><NEW_LINE>}<NEW_LINE>if (projectRole == null) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>for (ProjectRolePermission permission : projectRoleService.findAllProjectRolePermissions(project.getId(), projectRole.getId())) {<NEW_LINE>if (permission.getRule().matches(apiCommandName)) {<NEW_LINE>if (RolePermissionEntity.Permission.ALLOW.equals(permission.getPermission())) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>throw new PermissionDeniedException("The given command '" + apiCommandName + "' either does not exist or is not available for the user");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ), project.getId()); |
778,946 | public void fromBytes(PacketBufferBC buf) throws IOException {<NEW_LINE>id = buf.readUniqueId();<NEW_LINE>box = new Box();<NEW_LINE>box.readData(buf);<NEW_LINE>player = buf.readBoolean() <MASK><NEW_LINE>Map<EnumAddonSlot, Addon> newAddons = new EnumMap<>(EnumAddonSlot.class);<NEW_LINE>int count = buf.readInt();<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>EnumAddonSlot slot = buf.readEnumValue(EnumAddonSlot.class);<NEW_LINE>ResourceLocation rl = new ResourceLocation(buf.readString(1024));<NEW_LINE>Class<? extends Addon> addonClass = AddonsRegistry.INSTANCE.getClassByName(rl);<NEW_LINE>try {<NEW_LINE>if (addonClass == null) {<NEW_LINE>throw new IOException("Unknown addon class " + rl);<NEW_LINE>}<NEW_LINE>Addon addon = addonClass.newInstance();<NEW_LINE>addon.volumeBox = this;<NEW_LINE>addon.onAdded();<NEW_LINE>addon.fromBytes(buf);<NEW_LINE>newAddons.put(slot, addon);<NEW_LINE>} catch (InstantiationException | IllegalAccessException e) {<NEW_LINE>throw new IOException("Failed to deserialize addon!", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addons.keySet().removeIf(slot -> !newAddons.containsKey(slot));<NEW_LINE>newAddons.entrySet().stream().filter(slotAddon -> !addons.containsKey(slotAddon.getKey())).forEach(slotAddon -> addons.put(slotAddon.getKey(), slotAddon.getValue()));<NEW_LINE>for (Map.Entry<EnumAddonSlot, Addon> slotAddon : newAddons.entrySet()) {<NEW_LINE>PacketBufferBC buffer = new PacketBufferBC(Unpooled.buffer());<NEW_LINE>slotAddon.getValue().toBytes(buffer);<NEW_LINE>addons.get(slotAddon.getKey()).fromBytes(buffer);<NEW_LINE>}<NEW_LINE>locks.clear();<NEW_LINE>IntStream.range(0, buf.readInt()).mapToObj(i -> {<NEW_LINE>Lock lock = new Lock();<NEW_LINE>lock.fromBytes(buf);<NEW_LINE>return lock;<NEW_LINE>}).forEach(locks::add);<NEW_LINE>} | ? buf.readUniqueId() : null; |
1,653,461 | public void updateRendering() {<NEW_LINE>// If PDF always use a 600x600 image, otherwise show the actual rendered image which will be saved<NEW_LINE>int width = owner.fileType.equals("pdf") ? 600 : (int) owner.markerWidth;<NEW_LINE>// dot diameter rendered in the image<NEW_LINE>double dd = owner.dotDiameter * (width / owner.markerWidth);<NEW_LINE>int height = (int) (width * controls.markerRatio);<NEW_LINE>// Generate the preview image<NEW_LINE>var generator = new RandomDotMarkerGeneratorImage();<NEW_LINE>generator.setRadius(dd / 2.0);<NEW_LINE>generator.<MASK><NEW_LINE>generator.render(owner.markers.get(controls.viewMarkerIndex), def.markerWidth, def.markerHeight);<NEW_LINE>GrayU8 gray = generator.getImage();<NEW_LINE>BufferedImage out = new BufferedImage(gray.width, gray.height, BufferedImage.TYPE_INT_RGB);<NEW_LINE>ConvertBufferedImage.convertTo(gray, out);<NEW_LINE>imagePanel.setImageRepaint(out);<NEW_LINE>} | configure(width, height, 20); |
663,914 | private Mono<Response<String>> generateUriWithResponseAsync(String resourceGroupName, String automationAccountName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (automationAccountName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2015-10-31";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.generateUri(this.client.getEndpoint(), resourceGroupName, automationAccountName, this.client.getSubscriptionId(<MASK><NEW_LINE>} | ), apiVersion, accept, context); |
139,500 | private Set<String> processResourceAndReturnUrls(IBaseResource theResource, String theResourceName) {<NEW_LINE>Validate.notNull(theResource, "the" + theResourceName + " must not be null");<NEW_LINE>RuntimeResourceDefinition resourceDef = getFhirContext().getResourceDefinition(theResource);<NEW_LINE>String actualResourceName = resourceDef.getName();<NEW_LINE>Validate.isTrue(actualResourceName.equals(theResourceName), "the" + theResourceName + " must be a " + theResourceName + " - Got: " + actualResourceName);<NEW_LINE>Optional<IBase> urlValue = resourceDef.getChildByName("url").getAccessor().getFirstValueOrNull(theResource);<NEW_LINE>String url = urlValue.map(t -> (((IPrimitiveType<?>) t).getValueAsString())).orElse(null);<NEW_LINE>Validate.notNull(url, "the" + theResourceName + ".getUrl() must not return null");<NEW_LINE>Validate.notBlank(url, "the" + theResourceName + ".getUrl() must return a value");<NEW_LINE>String urlWithoutVersion;<NEW_LINE>int <MASK><NEW_LINE>if (pipeIdx != -1) {<NEW_LINE>urlWithoutVersion = url.substring(0, pipeIdx);<NEW_LINE>} else {<NEW_LINE>urlWithoutVersion = url;<NEW_LINE>}<NEW_LINE>HashSet<String> retVal = Sets.newHashSet(url, urlWithoutVersion);<NEW_LINE>Optional<IBase> versionValue = resourceDef.getChildByName("version").getAccessor().getFirstValueOrNull(theResource);<NEW_LINE>String version = versionValue.map(t -> (((IPrimitiveType<?>) t).getValueAsString())).orElse(null);<NEW_LINE>if (isNotBlank(version)) {<NEW_LINE>retVal.add(urlWithoutVersion + "|" + version);<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | pipeIdx = url.indexOf('|'); |
1,747,342 | private Map<String, Object> checkAndFetchVulnInfo(String type, String resouceId, Map<String, Object> processinfo, Map<String, Object> hostAsset) {<NEW_LINE>Map<String, Object> host = hostAsset;<NEW_LINE>if (host != null && host.get("vuln") == null) {<NEW_LINE>processinfo.put(VULN_MISSING, "true");<NEW_LINE>// Retry with the current matched ID<NEW_LINE>host = fetchhostAssetWithID(Double.valueOf(host.get("id").toString()).longValue());<NEW_LINE>if (host != null && host.get("vuln") != null) {<NEW_LINE>processinfo.put(VULN_MISSING, "FetchedInRetry");<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>Map<String, Object> _hostAsset = null;<NEW_LINE>if (currentQualysInfo.get(resouceId) != null) {<NEW_LINE>_hostAsset = <MASK><NEW_LINE>if (!Util.isScanInfoAvailable(_hostAsset, scanThreshold)) {<NEW_LINE>_hostAsset = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>host = _hostAsset;<NEW_LINE>if (host != null) {<NEW_LINE>processinfo.put(VULN_MISSING, "OldInfoUsed");<NEW_LINE>}<NEW_LINE>} catch (ParseException | IOException e) {<NEW_LINE>LOGGER.error("Error in checkAndFetchVulnInfo", e);<NEW_LINE>Map<String, String> errorMap = new HashMap<>();<NEW_LINE>errorMap.put(ERROR, "Error in checkAndFetchVulnInfo");<NEW_LINE>errorMap.put(ERROR_TYPE, WARN);<NEW_LINE>errorMap.put(EXCEPTION, e.getMessage());<NEW_LINE>errorList.add(errorMap);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return host;<NEW_LINE>} | Util.fetchCurretQualysInfo(type, resouceId); |
399,165 | public static APIGetVmMigrationCandidateHostsReply __example__() {<NEW_LINE>APIGetVmMigrationCandidateHostsReply reply = new APIGetVmMigrationCandidateHostsReply();<NEW_LINE>HostInventory hi = new HostInventory();<NEW_LINE>hi.setAvailableCpuCapacity(2L);<NEW_LINE>hi.setAvailableMemoryCapacity(4L);<NEW_LINE>hi.setClusterUuid(uuid());<NEW_LINE>hi.setManagementIp("192.168.0.1");<NEW_LINE>hi.setName("example");<NEW_LINE>hi.setState(HostState.Enabled.toString());<NEW_LINE>hi.setStatus(HostStatus.Connected.toString());<NEW_LINE><MASK><NEW_LINE>hi.setZoneUuid(uuid());<NEW_LINE>hi.setUuid(uuid());<NEW_LINE>hi.setTotalCpuCapacity(4L);<NEW_LINE>hi.setTotalMemoryCapacity(4L);<NEW_LINE>hi.setHypervisorType("KVM");<NEW_LINE>hi.setDescription("example");<NEW_LINE>hi.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>hi.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>reply.setInventories(asList(hi));<NEW_LINE>return reply;<NEW_LINE>} | hi.setClusterUuid(uuid()); |
1,628,594 | private void writeEventsToBuffer(final MutableDirectBuffer writeBuffer, final long firstPosition) {<NEW_LINE>eventBufferOffset = 0;<NEW_LINE>for (int i = 0; i < eventCount; i++) {<NEW_LINE>final long key = eventBuffer.<MASK><NEW_LINE>eventBufferOffset += SIZE_OF_LONG;<NEW_LINE>final int sourceIndex = eventBuffer.getInt(eventBufferOffset, Protocol.ENDIANNESS);<NEW_LINE>eventBufferOffset += SIZE_OF_INT;<NEW_LINE>final int metadataLength = eventBuffer.getInt(eventBufferOffset, Protocol.ENDIANNESS);<NEW_LINE>eventBufferOffset += SIZE_OF_INT;<NEW_LINE>final int valueLength = eventBuffer.getInt(eventBufferOffset, Protocol.ENDIANNESS);<NEW_LINE>eventBufferOffset += SIZE_OF_INT;<NEW_LINE>final int fragmentLength = headerLength(metadataLength) + valueLength;<NEW_LINE>// allocate fragment for log entry<NEW_LINE>claimedBatch.nextFragment(fragmentLength, logId);<NEW_LINE>final int bufferOffset = claimedBatch.getFragmentOffset();<NEW_LINE>// write log entry header<NEW_LINE>setPosition(writeBuffer, bufferOffset, firstPosition + i);<NEW_LINE>if (sourceIndex >= 0 && sourceIndex < i) {<NEW_LINE>setSourceEventPosition(writeBuffer, bufferOffset, firstPosition + sourceIndex);<NEW_LINE>} else {<NEW_LINE>setSourceEventPosition(writeBuffer, bufferOffset, sourceEventPosition);<NEW_LINE>}<NEW_LINE>setKey(writeBuffer, bufferOffset, key);<NEW_LINE>setTimestamp(writeBuffer, bufferOffset, ActorClock.currentTimeMillis());<NEW_LINE>setMetadataLength(writeBuffer, bufferOffset, (short) metadataLength);<NEW_LINE>if (metadataLength > 0) {<NEW_LINE>writeBuffer.putBytes(metadataOffset(bufferOffset), eventBuffer, eventBufferOffset, metadataLength);<NEW_LINE>eventBufferOffset += metadataLength;<NEW_LINE>}<NEW_LINE>// write log entry value<NEW_LINE>writeBuffer.putBytes(valueOffset(bufferOffset, metadataLength), eventBuffer, eventBufferOffset, valueLength);<NEW_LINE>eventBufferOffset += valueLength;<NEW_LINE>}<NEW_LINE>} | getLong(eventBufferOffset, Protocol.ENDIANNESS); |
1,801,554 | public void marshall(ReplicationTaskStats replicationTaskStats, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (replicationTaskStats == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getFullLoadProgressPercent(), FULLLOADPROGRESSPERCENT_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getElapsedTimeMillis(), ELAPSEDTIMEMILLIS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getTablesLoading(), TABLESLOADING_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getTablesQueued(), TABLESQUEUED_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getTablesErrored(), TABLESERRORED_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getFreshStartDate(), FRESHSTARTDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getStartDate(), STARTDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getStopDate(), STOPDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getFullLoadStartDate(), FULLLOADSTARTDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(replicationTaskStats.getFullLoadFinishDate(), FULLLOADFINISHDATE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | replicationTaskStats.getTablesLoaded(), TABLESLOADED_BINDING); |
730,885 | public void internalProcess(double[] input, DMatrix leftPoint, DMatrix rightView) {<NEW_LINE>int numRows = getNumOfOutputsM();<NEW_LINE>// number of parameters on left. All points<NEW_LINE>int numPointParam = structure.points.size * lengthPoint + numRigidUnknown * lengthSE3;<NEW_LINE>// Number of parameters on right. views + camera<NEW_LINE>// view + camera<NEW_LINE>int numViewParam = numParameters - numPointParam;<NEW_LINE>((ReshapeMatrix) leftPoint).reshape(numRows, numPointParam);<NEW_LINE>((ReshapeMatrix) rightView).reshape(numRows, numViewParam);<NEW_LINE>leftPoint.zero();<NEW_LINE>rightView.zero();<NEW_LINE>// parse parameters for rigid bodies. the translation + rotation is the same for all views<NEW_LINE>for (int rigidIndex = 0; rigidIndex < structure.rigids.size; rigidIndex++) {<NEW_LINE>if (!structure.rigids.get(rigidIndex).known) {<NEW_LINE>jacRigidS03[rigidIndex].setParameters(input, indexFirstRigid + rigidParameterIndexes[rigidIndex]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int observationIndex = 0;<NEW_LINE>// first decode the transformation<NEW_LINE>for (int viewIndex = 0; viewIndex < structure.views.size; viewIndex++) {<NEW_LINE>SceneStructureMetric.View view = structure.views.data[viewIndex];<NEW_LINE>SceneStructureCommon.Camera camera = structure.cameras.data[view.camera];<NEW_LINE>SceneStructureMetric.Motion motion = structure.<MASK><NEW_LINE>if (!motion.known) {<NEW_LINE>int paramIndex = motionParameterIndexes[view.parent_to_view] + indexFirstMotion;<NEW_LINE>jacSO3.setParameters(input, paramIndex);<NEW_LINE>paramIndex += jacSO3.getParameterLength();<NEW_LINE>motion.motion.T.x = input[paramIndex];<NEW_LINE>motion.motion.T.y = input[paramIndex + 1];<NEW_LINE>motion.motion.T.z = input[paramIndex + 2];<NEW_LINE>motion.motion.getR().setTo(jacSO3.getRotationMatrix());<NEW_LINE>// save the Jacobian if we need to<NEW_LINE>DMatrixRMaj[] savedJac = mapSO3Jac.get(view.parent_to_view);<NEW_LINE>if (savedJac != null) {<NEW_LINE>for (int i = 0; i < savedJac.length; i++) {<NEW_LINE>savedJac[i].setTo(jacSO3.getPartial(i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lookupWorldToView(view, world_to_view);<NEW_LINE>int cameraParamStartIndex = cameraParameterIndexes[view.camera];<NEW_LINE>if (!camera.known) {<NEW_LINE>camera.model.setIntrinsic(input, indexLastMotion + cameraParamStartIndex);<NEW_LINE>}<NEW_LINE>observationIndex = computeGeneralPoints(leftPoint, rightView, input, observationIndex, viewIndex, camera, cameraParamStartIndex);<NEW_LINE>if (observations.hasRigid())<NEW_LINE>observationIndex = computeRigidPoints(leftPoint, rightView, observationIndex, viewIndex, camera, cameraParamStartIndex);<NEW_LINE>}<NEW_LINE>} | motions.data[view.parent_to_view]; |
462,389 | final DeleteFeatureResult executeDeleteFeature(DeleteFeatureRequest deleteFeatureRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteFeatureRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteFeatureRequest> request = null;<NEW_LINE>Response<DeleteFeatureResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteFeatureRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFeatureRequest));<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, "Evidently");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFeature");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteFeatureResult>> 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 DeleteFeatureResultJsonUnmarshaller()); |
624,703 | public static ListVpcGatewayEndpointsResponse unmarshall(ListVpcGatewayEndpointsResponse listVpcGatewayEndpointsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listVpcGatewayEndpointsResponse.setRequestId<MASK><NEW_LINE>listVpcGatewayEndpointsResponse.setNextToken(_ctx.stringValue("ListVpcGatewayEndpointsResponse.NextToken"));<NEW_LINE>listVpcGatewayEndpointsResponse.setTotalCount(_ctx.longValue("ListVpcGatewayEndpointsResponse.TotalCount"));<NEW_LINE>listVpcGatewayEndpointsResponse.setMaxResults(_ctx.longValue("ListVpcGatewayEndpointsResponse.MaxResults"));<NEW_LINE>List<Endpoint> endpoints = new ArrayList<Endpoint>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListVpcGatewayEndpointsResponse.Endpoints.Length"); i++) {<NEW_LINE>Endpoint endpoint = new Endpoint();<NEW_LINE>endpoint.setEndpointId(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].EndpointId"));<NEW_LINE>endpoint.setEndpointName(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].EndpointName"));<NEW_LINE>endpoint.setEndpointDescription(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].EndpointDescription"));<NEW_LINE>endpoint.setServiceName(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].ServiceName"));<NEW_LINE>endpoint.setVpcId(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].VpcId"));<NEW_LINE>endpoint.setPolicyDocument(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].PolicyDocument"));<NEW_LINE>endpoint.setCreationTime(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].CreationTime"));<NEW_LINE>endpoint.setEndpointStatus(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].EndpointStatus"));<NEW_LINE>List<String> associatedRouteTables = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].AssociatedRouteTables.Length"); j++) {<NEW_LINE>associatedRouteTables.add(_ctx.stringValue("ListVpcGatewayEndpointsResponse.Endpoints[" + i + "].AssociatedRouteTables[" + j + "]"));<NEW_LINE>}<NEW_LINE>endpoint.setAssociatedRouteTables(associatedRouteTables);<NEW_LINE>endpoints.add(endpoint);<NEW_LINE>}<NEW_LINE>listVpcGatewayEndpointsResponse.setEndpoints(endpoints);<NEW_LINE>return listVpcGatewayEndpointsResponse;<NEW_LINE>} | (_ctx.stringValue("ListVpcGatewayEndpointsResponse.RequestId")); |
470,854 | final SearchTablesResult executeSearchTables(SearchTablesRequest searchTablesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(searchTablesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SearchTablesRequest> request = null;<NEW_LINE>Response<SearchTablesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SearchTablesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(searchTablesRequest));<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, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SearchTables");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SearchTablesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SearchTablesResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,044,551 | public Mono<Void> disposeLater(Duration quietPeriod, Duration timeout) {<NEW_LINE>return Mono.defer(() -> {<NEW_LINE>long quietPeriodMillis = quietPeriod.toMillis();<NEW_LINE>long timeoutMillis = timeout.toMillis();<NEW_LINE><MASK><NEW_LINE>EventLoopGroup clientLoopsGroup = clientLoops.get();<NEW_LINE>EventLoopGroup serverSelectLoopsGroup = serverSelectLoops.get();<NEW_LINE>EventLoopGroup cacheNativeClientGroup = cacheNativeClientLoops.get();<NEW_LINE>EventLoopGroup cacheNativeSelectGroup = cacheNativeSelectLoops.get();<NEW_LINE>EventLoopGroup cacheNativeServerGroup = cacheNativeServerLoops.get();<NEW_LINE>Mono<?> clMono = Mono.empty();<NEW_LINE>Mono<?> sslMono = Mono.empty();<NEW_LINE>Mono<?> slMono = Mono.empty();<NEW_LINE>Mono<?> cnclMono = Mono.empty();<NEW_LINE>Mono<?> cnslMono = Mono.empty();<NEW_LINE>Mono<?> cnsrvlMono = Mono.empty();<NEW_LINE>if (running.compareAndSet(true, false)) {<NEW_LINE>if (clientLoopsGroup != null) {<NEW_LINE>clMono = FutureMono.from((Future) clientLoopsGroup.shutdownGracefully(quietPeriodMillis, timeoutMillis, TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>if (serverSelectLoopsGroup != null) {<NEW_LINE>sslMono = FutureMono.from((Future) serverSelectLoopsGroup.shutdownGracefully(quietPeriodMillis, timeoutMillis, TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>if (serverLoopsGroup != null) {<NEW_LINE>slMono = FutureMono.from((Future) serverLoopsGroup.shutdownGracefully(quietPeriodMillis, timeoutMillis, TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>if (cacheNativeClientGroup != null) {<NEW_LINE>cnclMono = FutureMono.from((Future) cacheNativeClientGroup.shutdownGracefully(quietPeriodMillis, timeoutMillis, TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>if (cacheNativeSelectGroup != null) {<NEW_LINE>cnslMono = FutureMono.from((Future) cacheNativeSelectGroup.shutdownGracefully(quietPeriodMillis, timeoutMillis, TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>if (cacheNativeServerGroup != null) {<NEW_LINE>cnsrvlMono = FutureMono.from((Future) cacheNativeServerGroup.shutdownGracefully(quietPeriodMillis, timeoutMillis, TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Mono.when(clMono, sslMono, slMono, cnclMono, cnslMono, cnsrvlMono);<NEW_LINE>});<NEW_LINE>} | EventLoopGroup serverLoopsGroup = serverLoops.get(); |
1,099,029 | private void initialize() {<NEW_LINE>if (freshnessUpdatorRef.get() != null)<NEW_LINE>return;<NEW_LINE>synchronized (FreshnessReader.class) {<NEW_LINE>if (freshnessUpdatorRef.get() != null)<NEW_LINE>return;<NEW_LINE>freshnessCache.clear();<NEW_LINE>DalConfigure configure = DalClientFactory.getDalConfigure();<NEW_LINE>for (String logicDbName : configure.getDatabaseSetNames()) {<NEW_LINE>DatabaseSet dbSet = configure.getDatabaseSet(logicDbName);<NEW_LINE>// ignore dal cluster<NEW_LINE>if (dbSet instanceof ClusterDatabaseSet) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Map<String, Integer> logicDbFreshnessMap = new ConcurrentHashMap<>();<NEW_LINE><MASK><NEW_LINE>for (Map.Entry<String, DataBase> dbEntry : dbSet.getDatabases().entrySet()) {<NEW_LINE>if (!dbEntry.getValue().isMaster())<NEW_LINE>logicDbFreshnessMap.put(dbEntry.getValue().getConnectionString(), INVALID);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (reader == null)<NEW_LINE>return;<NEW_LINE>// Init task<NEW_LINE>ScheduledExecutorService executer = Executors.newScheduledThreadPool(1, new ThreadFactory() {<NEW_LINE><NEW_LINE>AtomicInteger atomic = new AtomicInteger();<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Thread newThread(Runnable r) {<NEW_LINE>return new Thread(r, "Dal-FreshnessScanner" + this.atomic.getAndIncrement());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>executer.scheduleWithFixedDelay(new FreshnessScanner(reader), 0, interval, TimeUnit.SECONDS);<NEW_LINE>freshnessUpdatorRef.set(executer);<NEW_LINE>}<NEW_LINE>} | freshnessCache.put(logicDbName, logicDbFreshnessMap); |
137,730 | private void updateSupportedRefreshRates(Display display) {<NEW_LINE>Display.Mode[<MASK><NEW_LINE>int totalModes = 0;<NEW_LINE>for (int i = 0; i < supportedModes.length; i++) {<NEW_LINE>if (!modeMatchesCurrentResolution(supportedModes[i])) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>totalModes++;<NEW_LINE>}<NEW_LINE>long[] supportedRefreshPeriods = new long[totalModes];<NEW_LINE>int[] supportedDisplayModeIds = new int[totalModes];<NEW_LINE>totalModes = 0;<NEW_LINE>for (int i = 0; i < supportedModes.length; i++) {<NEW_LINE>if (!modeMatchesCurrentResolution(supportedModes[i])) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>supportedRefreshPeriods[totalModes] = (long) (ONE_S_IN_NS / supportedModes[i].getRefreshRate());<NEW_LINE>supportedDisplayModeIds[totalModes] = supportedModes[i].getModeId();<NEW_LINE>totalModes++;<NEW_LINE>}<NEW_LINE>// Call down to native to set the supported refresh rates<NEW_LINE>nSetSupportedRefreshPeriods(mCookie, supportedRefreshPeriods, supportedDisplayModeIds);<NEW_LINE>} | ] supportedModes = display.getSupportedModes(); |
564,215 | protected Node[] createNodes(Object key) {<NEW_LINE>if (key instanceof WebOperationInfo) {<NEW_LINE>final WebOperationInfo method = (WebOperationInfo) key;<NEW_LINE>Node n = new AbstractNode(Children.LEAF) {<NEW_LINE><NEW_LINE>@java.lang.Override<NEW_LINE>public java.awt.Image getIcon(int type) {<NEW_LINE>if (cachedIcon == null) {<NEW_LINE>cachedIcon = ImageUtilities.loadImage(OPERATION_ICON);<NEW_LINE>}<NEW_LINE>return cachedIcon;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Action[] getActions(boolean context) {<NEW_LINE>return new Action[] { SystemAction.get(PropertiesAction.class) };<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Action getPreferredAction() {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getDisplayName() {<NEW_LINE>// NOI18N<NEW_LINE>return method.getOperationName() + ": " + getClassName(method.getReturnType());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>StringBuffer buf = new StringBuffer();<NEW_LINE>for (String paramType : method.getParamTypes()) {<NEW_LINE>buf.append(buf.length() == 0 ? paramType : ", " + paramType);<NEW_LINE>}<NEW_LINE>n.setShortDescription(NbBundle.getMessage(JaxWsChildren.class, "TXT_operationDesc", method.getReturnType(), method.getOperationName(), buf.toString()));<NEW_LINE>return new Node[] { n };<NEW_LINE>}<NEW_LINE>return new Node[0];<NEW_LINE>} | SystemAction.get(PropertiesAction.class); |
745,339 | public void createVerticalChain(int topId, int topSide, int bottomId, int bottomSide, int[] chainIds, float[] weights, int style) {<NEW_LINE>if (chainIds.length < 2) {<NEW_LINE>throw new IllegalArgumentException("must have 2 or more widgets in a chain");<NEW_LINE>}<NEW_LINE>if (weights != null && weights.length != chainIds.length) {<NEW_LINE>throw new IllegalArgumentException("must have 2 or more widgets in a chain");<NEW_LINE>}<NEW_LINE>if (weights != null) {<NEW_LINE>get(chainIds[0]).layout.verticalWeight = weights[0];<NEW_LINE>}<NEW_LINE>get(chainIds[0]).layout.verticalChainStyle = style;<NEW_LINE>connect(chainIds[0], TOP, topId, topSide, 0);<NEW_LINE>for (int i = 1; i < chainIds.length; i++) {<NEW_LINE>int chainId = chainIds[i];<NEW_LINE>connect(chainIds[i], TOP, chainIds[i - 1], BOTTOM, 0);<NEW_LINE>connect(chainIds[i - 1], BOTTOM, chainIds[i], TOP, 0);<NEW_LINE>if (weights != null) {<NEW_LINE>get(chainIds[i]).layout.verticalWeight = weights[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>connect(chainIds[chainIds.length - 1], <MASK><NEW_LINE>} | BOTTOM, bottomId, bottomSide, 0); |
1,451,959 | public DescribeEndpointsResult describeEndpoints(DescribeEndpointsRequest describeEndpointsRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeEndpointsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeEndpointsRequest> request = null;<NEW_LINE>Response<DescribeEndpointsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new <MASK><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<DescribeEndpointsResult, JsonUnmarshallerContext> unmarshaller = new DescribeEndpointsResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<DescribeEndpointsResult> responseHandler = new JsonResponseHandler<DescribeEndpointsResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | DescribeEndpointsRequestMarshaller().marshall(describeEndpointsRequest); |
81,906 | public void scrutinize(TermedStatementEntityEdit update) {<NEW_LINE>if (update.isNew()) {<NEW_LINE>info(newItemType);<NEW_LINE>if (update.getLabels().isEmpty() && update.getLabelsIfNew().isEmpty() && update.getAliases().isEmpty()) {<NEW_LINE>QAWarning issue = new QAWarning(noLabelType, null, QAWarning.Severity.CRITICAL, 1);<NEW_LINE>issue.setProperty("example_entity", update.getEntityId());<NEW_LINE>addIssue(issue);<NEW_LINE>}<NEW_LINE>if (update.getDescriptions().isEmpty() && update.getDescriptionsIfNew().isEmpty()) {<NEW_LINE>QAWarning issue = new QAWarning(noDescType, null, QAWarning.Severity.WARNING, 1);<NEW_LINE>issue.setProperty("example_entity", update.getEntityId());<NEW_LINE>addIssue(issue);<NEW_LINE>}<NEW_LINE>if (!update.getDeletedStatements().isEmpty()) {<NEW_LINE>QAWarning issue = new QAWarning(deletedStatementsType, null, QAWarning.Severity.WARNING, 1);<NEW_LINE>issue.setProperty("example_entity", update.getEntityId());<NEW_LINE>addIssue(issue);<NEW_LINE>}<NEW_LINE>// Try to find a "instance of" or "subclass of" claim<NEW_LINE>boolean typeFound = false;<NEW_LINE>for (Statement statement : update.getAddedStatements()) {<NEW_LINE>String pid = statement.getMainSnak().getPropertyId().getId();<NEW_LINE>if (manifest.getInstanceOfPid().equals(pid) || manifest.getSubclassOfPid().equals(pid)) {<NEW_LINE>typeFound = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!typeFound) {<NEW_LINE>QAWarning issue = new QAWarning(noTypeType, null, <MASK><NEW_LINE>issue.setProperty("example_entity", update.getEntityId());<NEW_LINE>addIssue(issue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | QAWarning.Severity.WARNING, 1); |
609,853 | private void handleConnectionRetry(Node node, ClientConnectionStrategyConfig strategyConfig) {<NEW_LINE>ConnectionRetryConfig connectionRetryConfig = new ConnectionRetryConfig();<NEW_LINE>String initialBackoffMillis = "initial-backoff-millis";<NEW_LINE>String maxBackoffMillis = "max-backoff-millis";<NEW_LINE>String multiplier = "multiplier";<NEW_LINE>String jitter = "jitter";<NEW_LINE>String timeoutMillis = "cluster-connect-timeout-millis";<NEW_LINE>for (Node child : childElements(node)) {<NEW_LINE>String nodeName = cleanNodeName(child);<NEW_LINE>if (matches(initialBackoffMillis, nodeName)) {<NEW_LINE>connectionRetryConfig.setInitialBackoffMillis(getIntegerValue(initialBackoffMillis, getTextContent(child)));<NEW_LINE>} else if (matches(maxBackoffMillis, nodeName)) {<NEW_LINE>connectionRetryConfig.setMaxBackoffMillis(getIntegerValue(maxBackoffMillis, getTextContent(child)));<NEW_LINE>} else if (matches(multiplier, nodeName)) {<NEW_LINE>connectionRetryConfig.setMultiplier(getDoubleValue(multiplier, getTextContent(child)));<NEW_LINE>} else if (matches(timeoutMillis, nodeName)) {<NEW_LINE>connectionRetryConfig.setClusterConnectTimeoutMillis(getLongValue(timeoutMillis, getTextContent(child)));<NEW_LINE>} else if (matches(jitter, nodeName)) {<NEW_LINE>connectionRetryConfig.setJitter(getDoubleValue(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>strategyConfig.setConnectionRetryConfig(connectionRetryConfig);<NEW_LINE>} | jitter, getTextContent(child))); |
1,682,348 | public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listNextSinglePageAsync(final String nextPageLink) {<NEW_LINE>if (nextPageLink == null) {<NEW_LINE>throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");<NEW_LINE>}<NEW_LINE>final TaskListNextOptions taskListNextOptions = null;<NEW_LINE>UUID clientRequestId = null;<NEW_LINE>Boolean returnClientRequestId = null;<NEW_LINE>DateTime ocpDate = null;<NEW_LINE>DateTimeRfc1123 ocpDateConverted = null;<NEW_LINE>if (ocpDate != null) {<NEW_LINE>ocpDateConverted = new DateTimeRfc1123(ocpDate);<NEW_LINE>}<NEW_LINE>String nextUrl = String.format("%s", nextPageLink);<NEW_LINE>return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(Response<ResponseBody> response) {<NEW_LINE>try {<NEW_LINE>ServiceResponseWithHeaders<PageImpl<CloudTask>, TaskListHeaders> result = listNextDelegate(response);<NEW_LINE>return Observable.just(new ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>(result.body(), result.headers()<MASK><NEW_LINE>} catch (Throwable t) {<NEW_LINE>return Observable.error(t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , result.response())); |
750,429 | // https://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/ScrollEvent.html<NEW_LINE>protected void fxScrollEvent(ScrollEvent fxEvent) {<NEW_LINE>// the number of steps/clicks on the wheel for a mouse wheel event.<NEW_LINE>int count = (int) -(fxEvent.getDeltaY() / fxEvent.getMultiplierY());<NEW_LINE>int action = processing.event.MouseEvent.WHEEL;<NEW_LINE>int modifiers = 0;<NEW_LINE>if (fxEvent.isShiftDown()) {<NEW_LINE>modifiers |= processing.event.Event.SHIFT;<NEW_LINE>}<NEW_LINE>if (fxEvent.isControlDown()) {<NEW_LINE>modifiers |= processing.event.Event.CTRL;<NEW_LINE>}<NEW_LINE>if (fxEvent.isMetaDown()) {<NEW_LINE>modifiers |= processing.event.Event.META;<NEW_LINE>}<NEW_LINE>if (fxEvent.isAltDown()) {<NEW_LINE>modifiers |= processing.event.Event.ALT;<NEW_LINE>}<NEW_LINE>// FX does not supply button info<NEW_LINE>int button = 0;<NEW_LINE>long when = System.currentTimeMillis();<NEW_LINE>// getSceneX()?<NEW_LINE>int x = <MASK><NEW_LINE>int y = (int) fxEvent.getY();<NEW_LINE>sketch.postEvent(new processing.event.MouseEvent(fxEvent, when, action, modifiers, x, y, button, count));<NEW_LINE>} | (int) fxEvent.getX(); |
1,548,998 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {<NEW_LINE>JsonObject input = InputParser.parseJsonObjectOrThrowError(req);<NEW_LINE>String email = InputParser.parseStringOrThrowError(input, "email", false);<NEW_LINE>String password = InputParser.parseStringOrThrowError(input, "password", false);<NEW_LINE>assert password != null;<NEW_LINE>assert email != null;<NEW_LINE>// logic according to https://github.com/supertokens/supertokens-core/issues/101<NEW_LINE>String normalisedEmail = Utils.normaliseEmail(email);<NEW_LINE>if (password.equals("")) {<NEW_LINE>throw new ServletException(new WebserverAPI.BadRequestException("Password cannot be an empty string"));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>UserInfo user = EmailPassword.signUp(super.main, normalisedEmail, password);<NEW_LINE>JsonObject result = new JsonObject();<NEW_LINE>result.addProperty("status", "OK");<NEW_LINE>JsonObject userJson = new JsonParser().parse(new Gson().toJson(user)).getAsJsonObject();<NEW_LINE>if (super.getVersionFromRequest(req).equals("2.4")) {<NEW_LINE>userJson.remove("timeJoined");<NEW_LINE>}<NEW_LINE>result.add("user", userJson);<NEW_LINE>super.sendJsonResponse(200, result, resp);<NEW_LINE>} catch (DuplicateEmailException e) {<NEW_LINE>Logging.debug(main, Utils.exceptionStacktraceToString(e));<NEW_LINE>JsonObject result = new JsonObject();<NEW_LINE><MASK><NEW_LINE>super.sendJsonResponse(200, result, resp);<NEW_LINE>} catch (StorageQueryException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>}<NEW_LINE>} | result.addProperty("status", "EMAIL_ALREADY_EXISTS_ERROR"); |
838,577 | private static StopReport calculateStop(ArrayList<Position> positions, int startIndex, int endIndex, boolean ignoreOdometer) {<NEW_LINE>Position startStop = positions.get(startIndex);<NEW_LINE>Position endStop = positions.get(endIndex);<NEW_LINE>StopReport stop = new StopReport();<NEW_LINE>long deviceId = startStop.getDeviceId();<NEW_LINE>stop.setDeviceId(deviceId);<NEW_LINE>stop.setDeviceName(Context.getIdentityManager().getById(deviceId).getName());<NEW_LINE>stop.setPositionId(startStop.getId());<NEW_LINE>stop.setLatitude(startStop.getLatitude());<NEW_LINE>stop.setLongitude(startStop.getLongitude());<NEW_LINE>stop.<MASK><NEW_LINE>String address = startStop.getAddress();<NEW_LINE>if (address == null && Context.getGeocoder() != null && Context.getConfig().getBoolean(Keys.GEOCODER_ON_REQUEST)) {<NEW_LINE>address = Context.getGeocoder().getAddress(stop.getLatitude(), stop.getLongitude(), null);<NEW_LINE>}<NEW_LINE>stop.setAddress(address);<NEW_LINE>stop.setEndTime(endStop.getFixTime());<NEW_LINE>long stopDuration = endStop.getFixTime().getTime() - startStop.getFixTime().getTime();<NEW_LINE>stop.setDuration(stopDuration);<NEW_LINE>stop.setSpentFuel(calculateFuel(startStop, endStop));<NEW_LINE>if (startStop.getAttributes().containsKey(Position.KEY_HOURS) && endStop.getAttributes().containsKey(Position.KEY_HOURS)) {<NEW_LINE>stop.setEngineHours(endStop.getLong(Position.KEY_HOURS) - startStop.getLong(Position.KEY_HOURS));<NEW_LINE>}<NEW_LINE>if (!ignoreOdometer && startStop.getDouble(Position.KEY_ODOMETER) != 0 && endStop.getDouble(Position.KEY_ODOMETER) != 0) {<NEW_LINE>stop.setStartOdometer(startStop.getDouble(Position.KEY_ODOMETER));<NEW_LINE>stop.setEndOdometer(endStop.getDouble(Position.KEY_ODOMETER));<NEW_LINE>} else {<NEW_LINE>stop.setStartOdometer(startStop.getDouble(Position.KEY_TOTAL_DISTANCE));<NEW_LINE>stop.setEndOdometer(endStop.getDouble(Position.KEY_TOTAL_DISTANCE));<NEW_LINE>}<NEW_LINE>return stop;<NEW_LINE>} | setStartTime(startStop.getFixTime()); |
173,603 | public static Pair<IDebugger, Integer> findBreakpoint(final BackEndDebuggerProvider debuggerProvider, final int row) {<NEW_LINE>Preconditions.checkNotNull(debuggerProvider, "IE01336: Debugger provider argument can't be null");<NEW_LINE>Preconditions.checkArgument(row >= 0, "IE01337: Row arguments can not be negative");<NEW_LINE>int breakpoints = 0;<NEW_LINE>for (final IDebugger debugger : debuggerProvider.getDebuggers()) {<NEW_LINE>if ((row >= breakpoints) && (row < breakpoints + debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR))) {<NEW_LINE>return new Pair<IDebugger, Integer<MASK><NEW_LINE>} else {<NEW_LINE>breakpoints += debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("IE01338: Invalid row number");<NEW_LINE>} | >(debugger, row - breakpoints); |
380,939 | private void downloadJobAlert() {<NEW_LINE>// prompt for input params<NEW_LINE>AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());<NEW_LINE>View view = View.inflate(getActivity(), R.layout.sample_cachemgr_input, null);<NEW_LINE>BoundingBox boundingBox = mMapView.getBoundingBox();<NEW_LINE>zoom_max = view.findViewById(R.id.slider_zoom_max);<NEW_LINE>zoom_max.setMax((int) mMapView.getMaxZoomLevel());<NEW_LINE>zoom_max.setOnSeekBarChangeListener(SampleCacheDownloaderCustomUI.this);<NEW_LINE>zoom_min = view.findViewById(R.id.slider_zoom_min);<NEW_LINE>zoom_min.setMax((int) mMapView.getMaxZoomLevel());<NEW_LINE>zoom_min.setProgress((int) mMapView.getMinZoomLevel());<NEW_LINE>zoom_min.setOnSeekBarChangeListener(SampleCacheDownloaderCustomUI.this);<NEW_LINE>cache_east = view.findViewById(R.id.cache_east);<NEW_LINE>cache_east.setText(boundingBox.getLonEast() + "");<NEW_LINE>cache_north = view.<MASK><NEW_LINE>cache_north.setText(boundingBox.getLatNorth() + "");<NEW_LINE>cache_south = view.findViewById(R.id.cache_south);<NEW_LINE>cache_south.setText(boundingBox.getLatSouth() + "");<NEW_LINE>cache_west = view.findViewById(R.id.cache_west);<NEW_LINE>cache_west.setText(boundingBox.getLonWest() + "");<NEW_LINE>cache_estimate = view.findViewById(R.id.cache_estimate);<NEW_LINE>// change listeners for both validation and to trigger the download estimation<NEW_LINE>cache_east.addTextChangedListener(this);<NEW_LINE>cache_north.addTextChangedListener(this);<NEW_LINE>cache_south.addTextChangedListener(this);<NEW_LINE>cache_west.addTextChangedListener(this);<NEW_LINE>executeJob = view.findViewById(R.id.executeJob);<NEW_LINE>executeJob.setOnClickListener(this);<NEW_LINE>builder.setView(view);<NEW_LINE>builder.setCancelable(true);<NEW_LINE>builder.setOnCancelListener(new DialogInterface.OnCancelListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancel(DialogInterface dialog) {<NEW_LINE>cache_east = null;<NEW_LINE>cache_south = null;<NEW_LINE>cache_estimate = null;<NEW_LINE>cache_north = null;<NEW_LINE>cache_west = null;<NEW_LINE>executeJob = null;<NEW_LINE>zoom_min = null;<NEW_LINE>zoom_max = null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>downloadPrompt = builder.create();<NEW_LINE>downloadPrompt.show();<NEW_LINE>} | findViewById(R.id.cache_north); |
1,608,427 | private void internalDeleteNodeByNameFromStepModel(JsonNode stepsNode, String propertyName) {<NEW_LINE>if (stepsNode == null || !stepsNode.isArray()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (JsonNode jsonNode : stepsNode) {<NEW_LINE>ObjectNode stepNode = (ObjectNode) jsonNode;<NEW_LINE>if (stepNode.has(propertyName)) {<NEW_LINE>JsonNode propertyNode = stepNode.get(propertyName);<NEW_LINE>if (propertyNode != null) {<NEW_LINE>stepNode.remove(propertyName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Nested steps<NEW_LINE>if (stepNode.has("steps")) {<NEW_LINE>internalDeleteNodeByNameFromStepModel(stepNode.get("steps"), propertyName);<NEW_LINE>}<NEW_LINE>// Overdue steps<NEW_LINE>if (stepNode.has("overdueSteps")) {<NEW_LINE>internalDeleteNodeByNameFromStepModel(stepNode.get("overdueSteps"), propertyName);<NEW_LINE>}<NEW_LINE>// Choices is special, can have nested steps inside<NEW_LINE>if (stepNode.has("choices")) {<NEW_LINE>ArrayNode choicesArrayNode = (<MASK><NEW_LINE>for (JsonNode choiceNode : choicesArrayNode) {<NEW_LINE>if (choiceNode.has("steps")) {<NEW_LINE>internalDeleteNodeByNameFromStepModel(choiceNode.get("steps"), propertyName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ArrayNode) stepNode.get("choices"); |
755,181 | private // ;<NEW_LINE>PropertyValue function() throws IOException {<NEW_LINE>// System.out.println("function()");<NEW_LINE>PropertyValue result = null;<NEW_LINE>Token t = next();<NEW_LINE>if (t == Token.TK_FUNCTION) {<NEW_LINE>String f = getTokenValue(t);<NEW_LINE>skip_whitespace();<NEW_LINE>List<PropertyValue> params = expr(false);<NEW_LINE>t = next();<NEW_LINE>if (t != Token.TK_RPAREN) {<NEW_LINE>push(t);<NEW_LINE>throw new CSSParseException(t, Token.TK_RPAREN, getCurrentLine());<NEW_LINE>}<NEW_LINE>if (f.equals("rgb(")) {<NEW_LINE>result = new PropertyValue(createRGBColorFromFunction(params));<NEW_LINE>} else if (f.equals("cmyk(")) {<NEW_LINE>if (!isSupportCMYKColors()) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>// in accordance to http://www.w3.org/TR/css3-gcpm/#cmyk-colors<NEW_LINE>result = new PropertyValue(createCMYKColorFromFunction(params));<NEW_LINE>} else {<NEW_LINE>result = new PropertyValue(new FSFunction(f.substring(0, f.length() - 1), params));<NEW_LINE>}<NEW_LINE>skip_whitespace();<NEW_LINE>} else {<NEW_LINE>push(t);<NEW_LINE>throw new CSSParseException(t, Token.TK_FUNCTION, getCurrentLine());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | CSSParseException("The current output device does not support CMYK colors", getCurrentLine()); |
438,772 | public static void createShowTrackItem(LinearLayout showTrackContainer, AppCompatImageView trackAppearanceIcon, Integer showTrackId, final Fragment target, final boolean nightMode, final Runnable hideOnClickButtonAppearance) {<NEW_LINE>FragmentActivity activity = target.getActivity();<NEW_LINE>if (activity == null) {<NEW_LINE>AndroidUiHelper.updateVisibility(showTrackContainer, false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final OsmandApplication app = (OsmandApplication) activity.getApplication();<NEW_LINE>final GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();<NEW_LINE>final CardView buttonShowTrack = showTrackContainer.findViewById(R.id.compound_container);<NEW_LINE>final CardView buttonAppearance = showTrackContainer.findViewById(R.id.additional_button_container);<NEW_LINE>TextView showTrackTextView = buttonShowTrack.findViewById(R.id.title);<NEW_LINE>if (showTrackId != null) {<NEW_LINE>showTrackTextView.setText(showTrackId);<NEW_LINE>}<NEW_LINE>SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();<NEW_LINE>boolean showCurrentTrack = gpxSelectionHelper.getSelectedCurrentRecordingTrack() != null;<NEW_LINE>final CompoundButton showTrackCompound = buttonShowTrack.findViewById(R.id.compound_button);<NEW_LINE>showTrackCompound.setChecked(showCurrentTrack);<NEW_LINE>UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL);<NEW_LINE>setShowTrackItemBackground(buttonShowTrack, showTrackCompound.isChecked(), nightMode);<NEW_LINE>buttonShowTrack.setOnClickListener(v -> {<NEW_LINE>boolean checked = !showTrackCompound.isChecked();<NEW_LINE>showTrackCompound.setChecked(checked);<NEW_LINE>gpxSelectionHelper.selectGpxFile(selectedGpxFile.<MASK><NEW_LINE>setShowTrackItemBackground(buttonShowTrack, checked, nightMode);<NEW_LINE>createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, checked, null);<NEW_LINE>});<NEW_LINE>updateTrackIcon(app, trackAppearanceIcon);<NEW_LINE>createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, showTrackCompound.isChecked(), null);<NEW_LINE>if (activity instanceof MapActivity) {<NEW_LINE>buttonAppearance.setOnClickListener(v -> {<NEW_LINE>if (showTrackCompound.isChecked()) {<NEW_LINE>hideOnClickButtonAppearance.run();<NEW_LINE>TrackAppearanceFragment.showInstance((MapActivity) activity, selectedGpxFile, target);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | getGpxFile(), checked, false); |
1,849,760 | private static void initMsTimezones() {<NEW_LINE>try (Scanner scanner = new Scanner(TzHelper.class.getResourceAsStream(MS_TIMEZONES_FILE))) {<NEW_LINE>while (scanner.hasNext()) {<NEW_LINE>String[] arr = scanner.nextLine().split("=");<NEW_LINE>String standardTzId = arr[1];<NEW_LINE>String[] displayNameAndMsTzId = arr<MASK><NEW_LINE>MS_TIMEZONE_NAMES.put(displayNameAndMsTzId[0], standardTzId);<NEW_LINE>MS_TIMEZONE_IDS.put(displayNameAndMsTzId[1], standardTzId);<NEW_LINE>}<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>// avoid NoClassDefFoundError<NEW_LINE>LOG.error("Could not load MS timezones", e);<NEW_LINE>throw new RuntimeException("Unable to load resource file " + MS_TIMEZONES_FILE, e);<NEW_LINE>}<NEW_LINE>} | [0].split(";"); |
1,658,083 | protected void installApkFiles(ApkSource aApkSource) {<NEW_LINE>cleanOldSessions();<NEW_LINE>PackageInstaller.Session session = null;<NEW_LINE>try (ApkSource apkSource = aApkSource) {<NEW_LINE>PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);<NEW_LINE>sessionParams.setInstallLocation(PreferencesHelper.getInstance(getContext()).getInstallLocation());<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)<NEW_LINE>sessionParams.setInstallReason(PackageManager.INSTALL_REASON_USER);<NEW_LINE>int sessionID = mPackageInstaller.createSession(sessionParams);<NEW_LINE>mSessionsMap.put(sessionID, <MASK><NEW_LINE>session = mPackageInstaller.openSession(sessionID);<NEW_LINE>int currentApkFile = 0;<NEW_LINE>while (apkSource.nextApk()) {<NEW_LINE>try (InputStream inputStream = apkSource.openApkInputStream();<NEW_LINE>OutputStream outputStream = session.openWrite(String.format("%d.apk", currentApkFile++), 0, apkSource.getApkLength())) {<NEW_LINE>IOUtils.copyStream(inputStream, outputStream);<NEW_LINE>session.fsync(outputStream);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Intent callbackIntent = new Intent(getContext(), RootlessSAIPIService.class);<NEW_LINE>PendingIntent pendingIntent = PendingIntent.getService(getContext(), 0, callbackIntent, 0);<NEW_LINE>session.commit(pendingIntent.getIntentSender());<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>dispatchCurrentSessionUpdate(InstallationStatus.INSTALLATION_FAILED, getContext().getString(R.string.installer_error_rootless, Utils.throwableToString(e)));<NEW_LINE>installationCompleted();<NEW_LINE>} finally {<NEW_LINE>if (session != null)<NEW_LINE>session.close();<NEW_LINE>}<NEW_LINE>} | getOngoingInstallation().getId()); |
790,652 | protected void onPostExecute(AccessToken accessToken) {<NEW_LINE>try {<NEW_LINE>// Shared Preferences<NEW_LINE>SharedPreferences.Editor e = sharedPrefs.edit();<NEW_LINE>Log.v("logging_in", "this is what the token should be: " + accessToken.getToken());<NEW_LINE>if (sharedPrefs.getInt("current_account", 1) == 1) {<NEW_LINE>e.putString("authentication_token_1", accessToken.getToken());<NEW_LINE>e.putString("authentication_token_secret_1", accessToken.getTokenSecret());<NEW_LINE>e.putBoolean("is_logged_in_1", true);<NEW_LINE>} else {<NEW_LINE>e.putString("authentication_token_2", accessToken.getToken());<NEW_LINE>e.putString("authentication_token_secret_2", accessToken.getTokenSecret());<NEW_LINE>e.putBoolean("is_logged_in_2", true);<NEW_LINE>}<NEW_LINE>// save changes<NEW_LINE>e.commit();<NEW_LINE>// Hide login_activity button<NEW_LINE>btnLoginTwitter.setText(getResources().getString<MASK><NEW_LINE>btnLoginTwitter.setEnabled(true);<NEW_LINE>title.setText(getResources().getString(R.string.second_welcome));<NEW_LINE>summary.setText(getResources().getString(R.string.second_info));<NEW_LINE>hideHideWebView();<NEW_LINE>} catch (Exception e) {<NEW_LINE>restartLogin();<NEW_LINE>}<NEW_LINE>} | (R.string.initial_sync)); |
1,606,769 | public SingularityCreateResult saveDeploy(SingularityRequest request, SingularityDeployMarker deployMarker, SingularityDeploy deploy) {<NEW_LINE>createDeployIfNotExists(request, deployMarker, deploy);<NEW_LINE>LOG.info("Creating deploy {}", deployMarker);<NEW_LINE>singularityEventListener.deployHistoryEvent(new SingularityDeployUpdate(deployMarker, Optional.of(deploy), DeployEventType.STARTING, Optional.<SingularityDeployResult>empty()));<NEW_LINE>create(getDeployMarkerPath(deploy.getRequestId(), deploy.getId()), deployMarker, deployMarkerTranscoder);<NEW_LINE>final Optional<SingularityRequestDeployState> currentState = getRequestDeployState(deploy.getRequestId());<NEW_LINE>Optional<SingularityDeployMarker> activeDeploy = Optional.empty();<NEW_LINE>Optional<SingularityDeployMarker> pendingDeploy = Optional.empty();<NEW_LINE>if (request.isDeployable()) {<NEW_LINE>if (currentState.isPresent()) {<NEW_LINE>activeDeploy = currentState<MASK><NEW_LINE>}<NEW_LINE>pendingDeploy = Optional.of(deployMarker);<NEW_LINE>} else {<NEW_LINE>activeDeploy = Optional.of(deployMarker);<NEW_LINE>}<NEW_LINE>final SingularityRequestDeployState newState = new SingularityRequestDeployState(deploy.getRequestId(), activeDeploy, pendingDeploy);<NEW_LINE>return saveNewRequestDeployState(newState);<NEW_LINE>} | .get().getActiveDeploy(); |
106,262 | final DescribeMetricCollectionTypesResult executeDescribeMetricCollectionTypes(DescribeMetricCollectionTypesRequest describeMetricCollectionTypesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeMetricCollectionTypesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeMetricCollectionTypesRequest> request = null;<NEW_LINE>Response<DescribeMetricCollectionTypesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeMetricCollectionTypesRequestMarshaller().marshall(super.beforeMarshalling(describeMetricCollectionTypesRequest));<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, "Auto Scaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeMetricCollectionTypes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeMetricCollectionTypesResult> responseHandler = new StaxResponseHandler<DescribeMetricCollectionTypesResult>(new DescribeMetricCollectionTypesResultStaxUnmarshaller());<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,481,463 | public TagValues unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>TagValues tagValues = new TagValues();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Key", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>tagValues.setKey(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Values", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>tagValues.setValues(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("MatchOptions", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>tagValues.setMatchOptions(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return tagValues;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
706,483 | /*<NEW_LINE>* @see com.sitewhere.microservice.api.event.IDeviceEventManagement#<NEW_LINE>* listDeviceMeasurementsForIndex(com.sitewhere.spi.device.event.<NEW_LINE>* DeviceEventIndex, java.util.List,<NEW_LINE>* com.sitewhere.spi.search.IDateRangeSearchCriteria)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public ISearchResults<IDeviceMeasurement> listDeviceMeasurementsForIndex(DeviceEventIndex index, List<UUID> entityIds, IDateRangeSearchCriteria criteria) throws SiteWhereException {<NEW_LINE>QueryParams queryParams = QueryParams.builder();<NEW_LINE>queryParams.addParameter(Warp10DeviceEvent.PROP_EVENT_TYPE, DeviceEventType.Measurement.name());<NEW_LINE>queryParams.addParameter(getFieldForIndex(index), entityIds.stream().map(Object::toString).collect(<MASK><NEW_LINE>Warp10Persistence.addDateSearchCriteria(queryParams, criteria);<NEW_LINE>List<IDeviceMeasurement> results = new ArrayList<>();<NEW_LINE>List<GTSOutput> fetch = getClient().findGTS(queryParams);<NEW_LINE>for (GTSOutput gtsOutput : fetch) {<NEW_LINE>DeviceMeasurement deviceMeasurement = Warp10DeviceMeasurement.fromGTS(gtsOutput, false);<NEW_LINE>results.add(deviceMeasurement);<NEW_LINE>}<NEW_LINE>return new DeviceMeasurementsSearchResults(results);<NEW_LINE>} | Collectors.joining("|"))); |
1,172,653 | private boolean insertJobExecutionEventWhenSuccess(final JobExecutionEvent jobExecutionEvent) {<NEW_LINE>boolean result = false;<NEW_LINE>try (Connection connection = dataSource.getConnection();<NEW_LINE>PreparedStatement preparedStatement = connection.prepareStatement(sqlMapper.getInsertForJobExecutionLogForComplete())) {<NEW_LINE>preparedStatement.setString(1, jobExecutionEvent.getId());<NEW_LINE>preparedStatement.setString(2, jobExecutionEvent.getJobName());<NEW_LINE>preparedStatement.setString(3, jobExecutionEvent.getTaskId());<NEW_LINE>preparedStatement.setString(4, jobExecutionEvent.getHostname());<NEW_LINE>preparedStatement.setString(5, jobExecutionEvent.getIp());<NEW_LINE>preparedStatement.setInt(6, jobExecutionEvent.getShardingItem());<NEW_LINE>preparedStatement.setString(7, jobExecutionEvent.getSource().toString());<NEW_LINE>preparedStatement.setBoolean(8, jobExecutionEvent.isSuccess());<NEW_LINE>preparedStatement.setTimestamp(9, new Timestamp(jobExecutionEvent.getStartTime().getTime()));<NEW_LINE>preparedStatement.setTimestamp(10, new Timestamp(jobExecutionEvent.getCompleteTime<MASK><NEW_LINE>preparedStatement.execute();<NEW_LINE>result = true;<NEW_LINE>} catch (final SQLException ex) {<NEW_LINE>if (isDuplicateRecord(ex)) {<NEW_LINE>return updateJobExecutionEventWhenSuccess(jobExecutionEvent);<NEW_LINE>}<NEW_LINE>// TODO log failure directly to output log, consider to be configurable in the future<NEW_LINE>log.error(ex.getMessage());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ().getTime())); |
957,896 | public Region loadRegionFromArchive(int i) throws IOException {<NEW_LINE>int x = i >> 8;<NEW_LINE>int y = i & 0xFF;<NEW_LINE>Storage storage = store.getStorage();<NEW_LINE>Archive map = index.findArchiveByName("m" + x + "_" + y);<NEW_LINE>Archive land = index.findArchiveByName("l" + x + "_" + y);<NEW_LINE>assert (map == null) == (land == null);<NEW_LINE>if (map == null || land == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>byte[] data = map.decompress(storage.loadArchive(map));<NEW_LINE>MapDefinition mapDef = new MapLoader().load(x, y, data);<NEW_LINE>Region region = new Region(i);<NEW_LINE>region.loadTerrain(mapDef);<NEW_LINE>int[] keys = keyManager.getKeys(i);<NEW_LINE>if (keys != null) {<NEW_LINE>try {<NEW_LINE>data = land.decompress(storage.loadArchive(land), keys);<NEW_LINE>LocationsDefinition locDef = new LocationsLoader().load(x, y, data);<NEW_LINE>region.loadLocations(locDef);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>logger.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return region;<NEW_LINE>} | debug("Can't decrypt region " + i, ex); |
609,241 | protected int chooseNext(List<PatternTriple> pTriples) {<NEW_LINE>if (DEBUG) {<NEW_LINE>int i = -1;<NEW_LINE>StringBuilder buff = new StringBuilder();<NEW_LINE>for (PatternTriple pt : pTriples) {<NEW_LINE>i++;<NEW_LINE>if (pt == null) {<NEW_LINE>buff.append(String.format(" %d : null\n", i));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>double w2 = weight(pt);<NEW_LINE>buff.append(String.format(" %d %8.0f : %s\n", i, w2, printAbbrev(pt)));<NEW_LINE>}<NEW_LINE>String x = StrUtils.noNewlineEnding(buff.toString());<NEW_LINE>log.debug(">> Input\n" + x);<NEW_LINE>}<NEW_LINE>int idx = processPTriples(pTriples, null);<NEW_LINE>if (DEBUG) {<NEW_LINE>String x = printAbbrev<MASK><NEW_LINE>x = StrUtils.noNewlineEnding(x);<NEW_LINE>log.debug("<< Output\n " + x);<NEW_LINE>}<NEW_LINE>return idx;<NEW_LINE>} | (pTriples.get(idx)); |
777,827 | private // under the /lib directory.<NEW_LINE>boolean scanLibDir(ReadableArchive archive, String libLocation, DeploymentContext context) {<NEW_LINE>boolean entryPresent = false;<NEW_LINE>if (libLocation != null && !libLocation.isEmpty()) {<NEW_LINE>Enumeration<String> <MASK><NEW_LINE>while (entries.hasMoreElements() && !entryPresent) {<NEW_LINE>String entryName = entries.nextElement();<NEW_LINE>// if a jar in lib dir and not WEB-INF/lib/foo/bar.jar<NEW_LINE>if (entryName.endsWith(WeldUtils.JAR_SUFFIX) && entryName.indexOf(WeldUtils.SEPARATOR_CHAR, libLocation.length() + 1) == -1) {<NEW_LINE>try {<NEW_LINE>ReadableArchive jarInLib = archive.getSubArchive(entryName);<NEW_LINE>entryPresent = isArchiveCDIEnabled(context, jarInLib, WeldUtils.META_INF_BEANS_XML);<NEW_LINE>if (!entryPresent) {<NEW_LINE>entryPresent = WeldUtils.isImplicitBeanArchive(context, jarInLib);<NEW_LINE>}<NEW_LINE>jarInLib.close();<NEW_LINE>if (entryPresent)<NEW_LINE>break;<NEW_LINE>} catch (IOException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return entryPresent;<NEW_LINE>} | entries = archive.entries(libLocation); |
1,090,854 | public FacesRecognitionResponseDto processImage(ProcessImageParams processImageParams) {<NEW_LINE>Object predictionCountObj = processImageParams.<MASK><NEW_LINE>Integer predictionCount = (Integer) predictionCountObj;<NEW_LINE>if (predictionCount == 0 || predictionCount < -1) {<NEW_LINE>throw new IncorrectPredictionCountException();<NEW_LINE>}<NEW_LINE>FindFacesResponse findFacesResponse;<NEW_LINE>if (processImageParams.getFile() != null) {<NEW_LINE>MultipartFile file = (MultipartFile) processImageParams.getFile();<NEW_LINE>imageExtensionValidator.validate(file);<NEW_LINE>findFacesResponse = facesApiClient.findFacesWithCalculator(file, processImageParams.getLimit(), processImageParams.getDetProbThreshold(), processImageParams.getFacePlugins());<NEW_LINE>} else {<NEW_LINE>imageExtensionValidator.validateBase64(processImageParams.getImageBase64());<NEW_LINE>findFacesResponse = facesApiClient.findFacesBase64WithCalculator(processImageParams.getImageBase64(), processImageParams.getLimit(), processImageParams.getDetProbThreshold(), processImageParams.getFacePlugins());<NEW_LINE>}<NEW_LINE>val facesRecognitionDto = facesMapper.toFacesRecognitionResponseDto(findFacesResponse);<NEW_LINE>if (facesRecognitionDto == null) {<NEW_LINE>return FacesRecognitionResponseDto.builder().build();<NEW_LINE>}<NEW_LINE>String apiKey = processImageParams.getApiKey();<NEW_LINE>for (val findResult : facesRecognitionDto.getResult()) {<NEW_LINE>final ArrayList<FaceSimilarityDto> faces = processFaceResult(predictionCount, apiKey, findResult);<NEW_LINE>findResult.setSubjects(faces);<NEW_LINE>}<NEW_LINE>return facesRecognitionDto.prepareResponse(processImageParams);<NEW_LINE>} | getAdditionalParams().get(PREDICTION_COUNT); |
271,316 | protected void writeFiles(Encoder encoder, ImmutableList<? extends ComponentArtifactMetadata> artifacts) throws IOException {<NEW_LINE>int fileArtifactsCount = (int) artifacts.stream().filter(a -> a instanceof UrlBackedArtifactMetadata).count();<NEW_LINE>int ivyArtifactsCount = artifacts.size() - fileArtifactsCount;<NEW_LINE>encoder.writeSmallInt(ivyArtifactsCount);<NEW_LINE>for (ComponentArtifactMetadata artifact : artifacts) {<NEW_LINE>if (!(artifact instanceof UrlBackedArtifactMetadata)) {<NEW_LINE>IvyArtifactName artifactName = artifact.getName();<NEW_LINE>writeIvyArtifactName(encoder, artifactName);<NEW_LINE>ComponentIdentifier componentId = artifact.getComponentId();<NEW_LINE>if (componentId instanceof MavenUniqueSnapshotComponentIdentifier) {<NEW_LINE>MavenUniqueSnapshotComponentIdentifier uid = (MavenUniqueSnapshotComponentIdentifier) componentId;<NEW_LINE>encoder.writeNullableString(uid.getTimestamp());<NEW_LINE>encoder.<MASK><NEW_LINE>} else {<NEW_LINE>encoder.writeNullableString(null);<NEW_LINE>}<NEW_LINE>encoder.writeBoolean(artifact.getAlternativeArtifact().isPresent());<NEW_LINE>if (artifact.getAlternativeArtifact().isPresent()) {<NEW_LINE>writeIvyArtifactName(encoder, artifact.getAlternativeArtifact().get().getName());<NEW_LINE>}<NEW_LINE>encoder.writeBoolean(artifact.isOptionalArtifact());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>encoder.writeSmallInt(fileArtifactsCount);<NEW_LINE>for (ComponentArtifactMetadata file : artifacts) {<NEW_LINE>if (file instanceof UrlBackedArtifactMetadata) {<NEW_LINE>encoder.writeString(((UrlBackedArtifactMetadata) file).getFileName());<NEW_LINE>encoder.writeString(((UrlBackedArtifactMetadata) file).getRelativeUrl());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | writeString(uid.getVersion()); |
959,346 | public void render(TileMarkerVolume marker, double tileX, double tileY, double tileZ, float partialTicks, int destroyStage, float alpha) {<NEW_LINE>if (marker == null || !marker.isShowingSignals())<NEW_LINE>return;<NEW_LINE>Minecraft.getMinecraft(<MASK><NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("marker");<NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("volume");<NEW_LINE>DetachedRenderer.fromWorldOriginPre(Minecraft.getMinecraft().player, partialTicks);<NEW_LINE>RenderHelper.disableStandardItemLighting();<NEW_LINE>Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);<NEW_LINE>VolumeConnection volume = marker.getCurrentConnection();<NEW_LINE>Set<Axis> taken = volume == null ? ImmutableSet.of() : volume.getConnectedAxis();<NEW_LINE>Vec3d start = VecUtil.add(VEC_HALF, marker.getPos());<NEW_LINE>for (EnumFacing face : EnumFacing.VALUES) {<NEW_LINE>if (taken.contains(face.getAxis())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Vec3d end = VecUtil.offset(start, face, BCCoreConfig.markerMaxDistance);<NEW_LINE>renderLaser(start, end, face.getAxis());<NEW_LINE>}<NEW_LINE>RenderHelper.enableStandardItemLighting();<NEW_LINE>DetachedRenderer.fromWorldOriginPost();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>} | ).mcProfiler.startSection("bc"); |
359,138 | public void configure(Parameterization config) {<NEW_LINE>//<NEW_LINE>//<NEW_LINE>new IntParameter(KMeans.K_ID).//<NEW_LINE>addConstraint(CommonConstraints.GREATER_THAN_ONE_INT).grab(config, x -> k = x);<NEW_LINE>ObjectParameter<KMeans<V, M>> kMeansVariantP = new ObjectParameter<>(KMEANS_ID, <MASK><NEW_LINE>if (config.grab(kMeansVariantP)) {<NEW_LINE>ListParameterization kMeansVariantParameters = new ListParameterization();<NEW_LINE>// We will always invoke this with k=2!<NEW_LINE>kMeansVariantParameters.addParameter(KMeans.K_ID, 2);<NEW_LINE>ChainedParameterization combinedConfig = new ChainedParameterization(kMeansVariantParameters, config);<NEW_LINE>combinedConfig.errorsTo(config);<NEW_LINE>kMeansVariant = kMeansVariantP.instantiateClass(combinedConfig);<NEW_LINE>}<NEW_LINE>} | KMeans.class, BestOfMultipleKMeans.class); |
513,765 | private boolean init(ViewHolder viewHolder, Message message) {<NEW_LINE>if (viewHolder.darkBackground) {<NEW_LINE>viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);<NEW_LINE>} else {<NEW_LINE>viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption);<NEW_LINE>}<NEW_LINE>viewHolder.progress.setOnSeekBarChangeListener(this);<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {<NEW_LINE>ColorStateList color = ContextCompat.getColorStateList(messageAdapter.getContext(), viewHolder.darkBackground ? R.color.white70 : R.color.green700_desaturated);<NEW_LINE>viewHolder.progress.setThumbTintList(color);<NEW_LINE>viewHolder.progress.setProgressTintList(color);<NEW_LINE>}<NEW_LINE>viewHolder.playPause.setAlpha(viewHolder.darkBackground ? 0.7f : 0.57f);<NEW_LINE>viewHolder.playPause.setOnClickListener(this);<NEW_LINE>final Context context <MASK><NEW_LINE>if (message == currentlyPlayingMessage) {<NEW_LINE>if (AudioPlayer.player != null && AudioPlayer.player.isPlaying()) {<NEW_LINE>viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_pause_white_36dp : R.drawable.ic_pause_black_36dp);<NEW_LINE>viewHolder.playPause.setContentDescription(context.getString(R.string.pause_audio));<NEW_LINE>viewHolder.progress.setEnabled(true);<NEW_LINE>} else {<NEW_LINE>viewHolder.playPause.setContentDescription(context.getString(R.string.play_audio));<NEW_LINE>viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp);<NEW_LINE>viewHolder.progress.setEnabled(false);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp);<NEW_LINE>viewHolder.playPause.setContentDescription(context.getString(R.string.play_audio));<NEW_LINE>viewHolder.runtime.setText(formatTime(message.getFileParams().runtime));<NEW_LINE>viewHolder.progress.setProgress(0);<NEW_LINE>viewHolder.progress.setEnabled(false);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | = viewHolder.playPause.getContext(); |
1,420,284 | public static DescribeIndexTemplateResponse unmarshall(DescribeIndexTemplateResponse describeIndexTemplateResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeIndexTemplateResponse.setRequestId(_ctx.stringValue("DescribeIndexTemplateResponse.RequestId"));<NEW_LINE>Result result = new Result();<NEW_LINE>result.setIndexTemplate(_ctx.stringValue("DescribeIndexTemplateResponse.Result.indexTemplate"));<NEW_LINE>result.setDataStream(_ctx.booleanValue("DescribeIndexTemplateResponse.Result.dataStream"));<NEW_LINE>result.setPriority(_ctx.integerValue("DescribeIndexTemplateResponse.Result.priority"));<NEW_LINE>result.setIlmPolicy(_ctx.stringValue("DescribeIndexTemplateResponse.Result.ilmPolicy"));<NEW_LINE>List<String> indexPatterns <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeIndexTemplateResponse.Result.indexPatterns.Length"); i++) {<NEW_LINE>indexPatterns.add(_ctx.stringValue("DescribeIndexTemplateResponse.Result.indexPatterns[" + i + "]"));<NEW_LINE>}<NEW_LINE>result.setIndexPatterns(indexPatterns);<NEW_LINE>Template template = new Template();<NEW_LINE>template.setSettings(_ctx.stringValue("DescribeIndexTemplateResponse.Result.template.settings"));<NEW_LINE>template.setMappings(_ctx.stringValue("DescribeIndexTemplateResponse.Result.template.mappings"));<NEW_LINE>template.setAliases(_ctx.stringValue("DescribeIndexTemplateResponse.Result.template.aliases"));<NEW_LINE>result.setTemplate(template);<NEW_LINE>describeIndexTemplateResponse.setResult(result);<NEW_LINE>return describeIndexTemplateResponse;<NEW_LINE>} | = new ArrayList<String>(); |
683,429 | public static DMRBurst create(DMRSyncPattern syncPattern, CorrectedBinaryMessage binaryMessage, CACH cach, long timestamp, int timeslot) {<NEW_LINE>switch(syncPattern) {<NEW_LINE>case BASE_STATION_VOICE:<NEW_LINE>case MOBILE_STATION_VOICE:<NEW_LINE>case BS_VOICE_FRAME_B:<NEW_LINE>case BS_VOICE_FRAME_C:<NEW_LINE>case BS_VOICE_FRAME_D:<NEW_LINE>case BS_VOICE_FRAME_E:<NEW_LINE>case BS_VOICE_FRAME_F:<NEW_LINE>case MS_VOICE_FRAME_B:<NEW_LINE>case MS_VOICE_FRAME_C:<NEW_LINE>case MS_VOICE_FRAME_D:<NEW_LINE>case MS_VOICE_FRAME_E:<NEW_LINE>case MS_VOICE_FRAME_F:<NEW_LINE>return createVoiceMessage(syncPattern, binaryMessage, cach, timestamp, timeslot);<NEW_LINE>case DIRECT_MODE_VOICE_TIMESLOT_1:<NEW_LINE>return createVoiceMessage(syncPattern, binaryMessage, cach, timestamp, 1);<NEW_LINE>case DIRECT_MODE_VOICE_TIMESLOT_2:<NEW_LINE>return createVoiceMessage(syncPattern, binaryMessage, cach, timestamp, 2);<NEW_LINE>case BASE_STATION_DATA:<NEW_LINE>case MOBILE_STATION_DATA:<NEW_LINE>return DMRDataMessageFactory.create(syncPattern, <MASK><NEW_LINE>case DIRECT_MODE_DATA_TIMESLOT_1:<NEW_LINE>return DMRDataMessageFactory.create(syncPattern, binaryMessage, cach, timestamp, 1);<NEW_LINE>case DIRECT_MODE_DATA_TIMESLOT_2:<NEW_LINE>return DMRDataMessageFactory.create(syncPattern, binaryMessage, cach, timestamp, 2);<NEW_LINE>case UNKNOWN:<NEW_LINE>return null;<NEW_LINE>case MOBILE_STATION_REVERSE_CHANNEL:<NEW_LINE>case RESERVED:<NEW_LINE>default:<NEW_LINE>return new UnknownDMRMessage(syncPattern, binaryMessage, cach, timestamp, timeslot);<NEW_LINE>}<NEW_LINE>} | binaryMessage, cach, timestamp, timeslot); |
1,500,508 | public void updateStoragePool(StoragePool storagePool, Map<String, String> details) {<NEW_LINE>String strCapacityBytes = details.get(PrimaryDataStoreLifeCycle.CAPACITY_BYTES);<NEW_LINE>String strCapacityIops = details.get(PrimaryDataStoreLifeCycle.CAPACITY_IOPS);<NEW_LINE>Long capacityBytes = strCapacityBytes != null ? Long.parseLong(strCapacityBytes) : null;<NEW_LINE>Long capacityIops = strCapacityIops != null ? Long.parseLong(strCapacityIops) : null;<NEW_LINE>SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePool.getId(), storagePoolDetailsDao);<NEW_LINE>long size = capacityBytes != null ? capacityBytes : storagePool.getCapacityBytes();<NEW_LINE>long currentMinIops = getIopsValue(storagePool.getId(), SolidFireUtil.MIN_IOPS);<NEW_LINE>long currentMaxIops = getIopsValue(storagePool.getId(), SolidFireUtil.MAX_IOPS);<NEW_LINE>long currentBurstIops = getIopsValue(storagePool.<MASK><NEW_LINE>long minIops = currentMinIops;<NEW_LINE>long maxIops = currentMaxIops;<NEW_LINE>long burstIops = currentBurstIops;<NEW_LINE>if (capacityIops != null) {<NEW_LINE>if (capacityIops > SolidFireUtil.MAX_MIN_IOPS_PER_VOLUME) {<NEW_LINE>throw new CloudRuntimeException("This volume cannot exceed " + NumberFormat.getInstance().format(SolidFireUtil.MAX_MIN_IOPS_PER_VOLUME) + " IOPS.");<NEW_LINE>}<NEW_LINE>float maxPercentOfMin = currentMaxIops / (float) currentMinIops;<NEW_LINE>float burstPercentOfMax = currentBurstIops / (float) currentMaxIops;<NEW_LINE>minIops = capacityIops;<NEW_LINE>maxIops = (long) (minIops * maxPercentOfMin);<NEW_LINE>burstIops = (long) (maxIops * burstPercentOfMax);<NEW_LINE>if (maxIops > SolidFireUtil.MAX_IOPS_PER_VOLUME) {<NEW_LINE>maxIops = SolidFireUtil.MAX_IOPS_PER_VOLUME;<NEW_LINE>}<NEW_LINE>if (burstIops > SolidFireUtil.MAX_IOPS_PER_VOLUME) {<NEW_LINE>burstIops = SolidFireUtil.MAX_IOPS_PER_VOLUME;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SolidFireUtil.modifyVolume(sfConnection, getVolumeId(storagePool.getId()), size, null, minIops, maxIops, burstIops);<NEW_LINE>SolidFireUtil.updateCsDbWithSolidFireIopsInfo(storagePool.getId(), primaryDataStoreDao, storagePoolDetailsDao, minIops, maxIops, burstIops);<NEW_LINE>} | getId(), SolidFireUtil.BURST_IOPS); |
1,768,501 | public void editorCreated(@Nonnull EditorFactoryEvent event) {<NEW_LINE>if (!Application.get().isSwingApplication()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Editor editor = event.getEditor();<NEW_LINE><MASK><NEW_LINE>Project editorProject = editor.getProject();<NEW_LINE>// worthBothering() checks for getCachedPsiFile, so call getPsiFile here<NEW_LINE>PsiFile file = editorProject == null ? null : PsiDocumentManager.getInstance(editorProject).getPsiFile(document);<NEW_LINE>boolean showing = editor.isShowing();<NEW_LINE>boolean worthBothering = worthBothering(document, editorProject);<NEW_LINE>if (!showing || !worthBothering) {<NEW_LINE>LOG.debug("Not worth bothering about editor created for : " + file + " because editor isShowing(): " + showing + "; project is open and file is mine: " + worthBothering);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ErrorStripeUpdateManager.getInstance(myProject).repaintErrorStripePanel(editor);<NEW_LINE>} | Document document = editor.getDocument(); |
961,935 | void finishConnect(ConnectionRequest request) {<NEW_LINE>try {<NEW_LINE>if (request.channel.finishConnect()) {<NEW_LINE>if (SHOW_CONNECT_STATS) {<NEW_LINE>long queue_wait_time = request.connect_start_time - request.request_start_time;<NEW_LINE>long connect_time = SystemTime.getMonotonousTime() - request.connect_start_time;<NEW_LINE><MASK><NEW_LINE>int num_connecting = pending_attempts.size();<NEW_LINE>System.out.println("S: queue_wait_time=" + queue_wait_time + ", connect_time=" + connect_time + ", num_queued=" + num_queued + ", num_connecting=" + num_connecting);<NEW_LINE>}<NEW_LINE>// ensure the request hasn't been canceled during the select op<NEW_LINE>boolean canceled = false;<NEW_LINE>try {<NEW_LINE>new_canceled_mon.enter();<NEW_LINE>canceled = canceled_requests.contains(request.listener);<NEW_LINE>} finally {<NEW_LINE>new_canceled_mon.exit();<NEW_LINE>}<NEW_LINE>if (canceled) {<NEW_LINE>closeConnection(request.channel);<NEW_LINE>} else {<NEW_LINE>connect_selector.cancel(request.channel);<NEW_LINE>request.listener.connectSuccess(request.channel);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// should never happen<NEW_LINE>Debug.out("finishConnect() failed");<NEW_LINE>request.listener.connectFailure(new Throwable("finishConnect() failed"));<NEW_LINE>closeConnection(request.channel);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (SHOW_CONNECT_STATS) {<NEW_LINE>long queue_wait_time = request.connect_start_time - request.request_start_time;<NEW_LINE>long connect_time = SystemTime.getMonotonousTime() - request.connect_start_time;<NEW_LINE>int num_queued = new_requests.size();<NEW_LINE>int num_connecting = pending_attempts.size();<NEW_LINE>System.out.println("F: queue_wait_time=" + queue_wait_time + ", connect_time=" + connect_time + ", num_queued=" + num_queued + ", num_connecting=" + num_connecting);<NEW_LINE>}<NEW_LINE>request.listener.connectFailure(t);<NEW_LINE>closeConnection(request.channel);<NEW_LINE>}<NEW_LINE>} | int num_queued = new_requests.size(); |
702,049 | protected void encodeSortableHeaderOnReflow(FacesContext context, DataTable table) throws IOException {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>Map<SortMeta, String> headers = getSortableColumnHeaders(context, table);<NEW_LINE>if (!headers.isEmpty()) {<NEW_LINE>String reflowId = table.getContainerClientId(context) + "_reflowDD";<NEW_LINE>writer.startElement("label", null);<NEW_LINE>writer.writeAttribute("id", reflowId + "_label", null);<NEW_LINE>writer.writeAttribute("for", reflowId, null);<NEW_LINE>writer.writeAttribute("class", "ui-reflow-label", null);<NEW_LINE>writer.writeText(MessageFactory.getMessage(DataTable.SORT_LABEL), null);<NEW_LINE>writer.endElement("label");<NEW_LINE>writer.startElement("select", null);<NEW_LINE>writer.writeAttribute("id", reflowId, null);<NEW_LINE>writer.writeAttribute("name", reflowId, null);<NEW_LINE>writer.writeAttribute("class", "ui-reflow-dropdown ui-state-default", null);<NEW_LINE>writer.writeAttribute("autocomplete", "off", null);<NEW_LINE>for (Map.Entry<SortMeta, String> header : headers.entrySet()) {<NEW_LINE>for (int sortOrder = 0; sortOrder < 2; sortOrder++) {<NEW_LINE>String sortOrderLabel = (sortOrder == 0) ? MessageFactory.getMessage(DataTable.SORT_ASC) : MessageFactory.getMessage(DataTable.SORT_DESC);<NEW_LINE>writer.startElement("option", null);<NEW_LINE>writer.writeAttribute("value", header.getKey().getColumnKey() + "_" + sortOrder, null);<NEW_LINE>writer.writeAttribute("data-columnkey", header.getKey().getColumnKey(), null);<NEW_LINE>writer.writeAttribute("data-sortorder", sortOrder, null);<NEW_LINE>writer.writeText(header.getValue(<MASK><NEW_LINE>writer.endElement("option");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.endElement("select");<NEW_LINE>}<NEW_LINE>} | ) + " " + sortOrderLabel, null); |
814,643 | private static InetSocketAddress analyzeProxy(URI uri) {<NEW_LINE>// NOI18N<NEW_LINE><MASK><NEW_LINE>List<Proxy> proxies = ProxySelector.getDefault().select(uri);<NEW_LINE>// NOI18N<NEW_LINE>assert proxies != null : "ProxySelector cannot return null for " + uri;<NEW_LINE>// NOI18N<NEW_LINE>assert !proxies.isEmpty() : "ProxySelector cannot return empty list for " + uri;<NEW_LINE>String protocol = uri.getScheme();<NEW_LINE>Proxy p = proxies.get(0);<NEW_LINE>if (Proxy.Type.DIRECT == p.type()) {<NEW_LINE>// return null for DIRECT proxy<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>protocol == null || ((protocol.startsWith("http") || protocol.equals("ftp")) && Proxy.Type.HTTP == p.type()) || !(protocol.startsWith("http") || protocol.equals("ftp"))) {<NEW_LINE>// NOI18N<NEW_LINE>if (p.address() instanceof InetSocketAddress) {<NEW_LINE>// check is<NEW_LINE>// assert ! ((InetSocketAddress) p.address()).isUnresolved() : p.address() + " must be resolved address.";<NEW_LINE>return (InetSocketAddress) p.address();<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>LOGGER.log(Level.INFO, p.address() + " is not instanceof InetSocketAddress but " + p.address().getClass());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | Parameters.notNull("uri", uri); |
620,203 | public S3ReferenceDataSourceDescription unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>S3ReferenceDataSourceDescription s3ReferenceDataSourceDescription = new S3ReferenceDataSourceDescription();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("BucketARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>s3ReferenceDataSourceDescription.setBucketARN(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("FileKey", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>s3ReferenceDataSourceDescription.setFileKey(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ReferenceRoleARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>s3ReferenceDataSourceDescription.setReferenceRoleARN(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return s3ReferenceDataSourceDescription;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
269,340 | public static void main(String[] args) {<NEW_LINE>// store 5 roll nos<NEW_LINE>int[] numbers = new int[5];<NEW_LINE>// store 5 names<NEW_LINE>String[] names = new String[5];<NEW_LINE>// data of 5 students: {roll no, name, marks}<NEW_LINE>int[] rno = new int[5];<NEW_LINE>String[] name = new String[5];<NEW_LINE>float[] marks = new float[5];<NEW_LINE>Student[] students = new Student[5];<NEW_LINE>// just declaring<NEW_LINE>// Student kunal;<NEW_LINE>// kunal = new Student();<NEW_LINE>Student kunal = new Student(15, "Kunal Kushwaha", 85.4f);<NEW_LINE>Student rahul = new Student(18, "Rahul Rana", 90.3f);<NEW_LINE>// kunal.rno = 13;<NEW_LINE>// kunal.name = "Kunal Kushwaha";<NEW_LINE>// kunal.marks = 88.5f;<NEW_LINE>// kunal.changeName("Shoe lover");<NEW_LINE>// kunal.greeting();<NEW_LINE>//<NEW_LINE>System.out.println(kunal.rno);<NEW_LINE>System.out.println(kunal.name);<NEW_LINE>System.out.println(kunal.marks);<NEW_LINE>Student random = new Student(kunal);<NEW_LINE>System.out.println(random.name);<NEW_LINE>Student random2 = new Student();<NEW_LINE>System.<MASK><NEW_LINE>Student one = new Student();<NEW_LINE>Student two = one;<NEW_LINE>one.name = "Something something";<NEW_LINE>System.out.println(two.name);<NEW_LINE>} | out.println(random2.name); |
521,645 | public void onCreate(final Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE><MASK><NEW_LINE>binding = LogtrackableActivityBinding.bind(findViewById(R.id.logtrackable_activity_viewroot));<NEW_LINE>date.init(findViewById(R.id.date), findViewById(R.id.time), null, getSupportFragmentManager());<NEW_LINE>// get parameters<NEW_LINE>final Bundle extras = getIntent().getExtras();<NEW_LINE>final Uri uri = AndroidBeam.getUri(getIntent());<NEW_LINE>if (extras != null) {<NEW_LINE>geocode = extras.getString(Intents.EXTRA_GEOCODE);<NEW_LINE>// Load geocache if we can<NEW_LINE>if (StringUtils.isNotBlank(extras.getString(Intents.EXTRA_GEOCACHE))) {<NEW_LINE>final Geocache tmpGeocache = DataStore.loadCache(extras.getString(Intents.EXTRA_GEOCACHE), LoadFlags.LOAD_CACHE_OR_DB);<NEW_LINE>if (tmpGeocache != null) {<NEW_LINE>geocache = tmpGeocache;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Load Tracking Code<NEW_LINE>if (StringUtils.isNotBlank(extras.getString(Intents.EXTRA_TRACKING_CODE))) {<NEW_LINE>trackingCode = extras.getString(Intents.EXTRA_TRACKING_CODE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// try to get data from URI<NEW_LINE>if (geocode == null && uri != null) {<NEW_LINE>geocode = ConnectorFactory.getTrackableFromURL(uri.toString());<NEW_LINE>}<NEW_LINE>// try to get data from URI from a potential tracking Code<NEW_LINE>if (geocode == null && uri != null) {<NEW_LINE>final TrackableTrackingCode tbTrackingCode = ConnectorFactory.getTrackableTrackingCodeFromURL(uri.toString());<NEW_LINE>if (!tbTrackingCode.isEmpty()) {<NEW_LINE>brand = tbTrackingCode.brand;<NEW_LINE>geocode = tbTrackingCode.trackingCode;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// no given data<NEW_LINE>if (geocode == null) {<NEW_LINE>showToast(res.getString(R.string.err_tb_display));<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>refreshTrackable();<NEW_LINE>} | setThemeAndContentView(R.layout.logtrackable_activity); |
71,370 | final InviteMembersResult executeInviteMembers(InviteMembersRequest inviteMembersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(inviteMembersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<InviteMembersRequest> request = null;<NEW_LINE>Response<InviteMembersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new InviteMembersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(inviteMembersRequest));<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, "SecurityHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "InviteMembers");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<InviteMembersResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new InviteMembersResultJsonUnmarshaller());<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,534,581 | // @Override<NEW_LINE>public ValueAnimator transitionToFrame(final Rect of, final FreeFlowItem nf, final View v) {<NEW_LINE>ValueAnimator anim = <MASK><NEW_LINE>anim.setDuration(cellPositionTransitionAnimationDuration);<NEW_LINE>anim.addUpdateListener(new AnimatorUpdateListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAnimationUpdate(ValueAnimator animation) {<NEW_LINE>try {<NEW_LINE>int itemWidth = of.width() + (int) ((nf.frame.width() - of.width()) * animation.getAnimatedFraction());<NEW_LINE>int itemHeight = of.height() + (int) ((nf.frame.height() - of.height()) * animation.getAnimatedFraction());<NEW_LINE>int widthSpec = MeasureSpec.makeMeasureSpec(itemWidth, MeasureSpec.EXACTLY);<NEW_LINE>int heightSpec = MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY);<NEW_LINE>v.measure(widthSpec, heightSpec);<NEW_LINE>Rect frame = new Rect();<NEW_LINE>Rect nff = nf.frame;<NEW_LINE>frame.left = (int) (of.left + (nff.left - of.left) * animation.getAnimatedFraction());<NEW_LINE>frame.top = (int) (of.top + (nff.top - of.top) * animation.getAnimatedFraction());<NEW_LINE>frame.right = frame.left + (int) (of.width() + (nff.width() - of.width()) * animation.getAnimatedFraction());<NEW_LINE>frame.bottom = frame.top + (int) (of.height() + (nff.height() - of.height()) * animation.getAnimatedFraction());<NEW_LINE>v.layout(frame.left, frame.top, frame.right, frame.bottom);<NEW_LINE>// v.layout(nf.frame.left, nf.frame.top, nf.frame.right,<NEW_LINE>// nf.frame.bottom);<NEW_LINE>// v.setAlpha((1 - alpha) * animation.getAnimatedFraction()<NEW_LINE>// + alpha);<NEW_LINE>} catch (NullPointerException e) {<NEW_LINE>// if(BuildConfig.DEBUG){<NEW_LINE>// Log.e(TAG, "Nullpointer exception");<NEW_LINE>// }<NEW_LINE>e.printStackTrace();<NEW_LINE>animation.cancel();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>anim.setInterpolator(new DecelerateInterpolator(2.0f));<NEW_LINE>return anim;<NEW_LINE>} | ValueAnimator.ofFloat(0f, 1f); |
402,426 | private void encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) {<NEW_LINE>int x0 = Pack.littleEndianToInt(src, srcIndex) ^ gSubKeys[INPUT_WHITEN];<NEW_LINE>int x1 = Pack.littleEndianToInt(src, srcIndex + 4) ^ gSubKeys[INPUT_WHITEN + 1];<NEW_LINE>int x2 = Pack.littleEndianToInt(src, srcIndex + 8) ^ gSubKeys[INPUT_WHITEN + 2];<NEW_LINE>int x3 = Pack.littleEndianToInt(src, srcIndex + 12) ^ gSubKeys[INPUT_WHITEN + 3];<NEW_LINE>int k = ROUND_SUBKEYS;<NEW_LINE>int t0, t1;<NEW_LINE>for (int r = 0; r < ROUNDS; r += 2) {<NEW_LINE>t0 = Fe32_0(x0);<NEW_LINE>t1 = Fe32_3(x1);<NEW_LINE>x2 ^= t0 + t1 + gSubKeys[k++];<NEW_LINE>x2 = Integers.rotateRight(x2, 1);<NEW_LINE>x3 = Integers.rotateLeft(x3, 1) ^ (t0 + 2 * t1 + gSubKeys[k++]);<NEW_LINE>t0 = Fe32_0(x2);<NEW_LINE>t1 = Fe32_3(x3);<NEW_LINE>x0 ^= t0 + t1 + gSubKeys[k++];<NEW_LINE>x0 = Integers.rotateRight(x0, 1);<NEW_LINE>x1 = Integers.rotateLeft(x1, 1) ^ (t0 + 2 * t1 + gSubKeys[k++]);<NEW_LINE>}<NEW_LINE>Pack.intToLittleEndian(x2 ^ gSubKeys[OUTPUT_WHITEN], dst, dstIndex);<NEW_LINE>Pack.intToLittleEndian(x3 ^ gSubKeys[OUTPUT_WHITEN + 1], dst, dstIndex + 4);<NEW_LINE>Pack.intToLittleEndian(x0 ^ gSubKeys[OUTPUT_WHITEN + 2], dst, dstIndex + 8);<NEW_LINE>Pack.intToLittleEndian(x1 ^ gSubKeys[OUTPUT_WHITEN + 3<MASK><NEW_LINE>} | ], dst, dstIndex + 12); |
1,167,555 | protected void initializePrivilege(String restAdminId, String privilegeName) {<NEW_LINE>boolean restApiPrivilegeMappingExists = false;<NEW_LINE>Privilege privilege = idmIdentityService.createPrivilegeQuery().privilegeName(privilegeName).singleResult();<NEW_LINE>if (privilege != null) {<NEW_LINE>restApiPrivilegeMappingExists = restApiPrivilegeMappingExists(restAdminId, privilege);<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>// Could be created by another server, retrying fetch<NEW_LINE>privilege = idmIdentityService.createPrivilegeQuery().privilegeName(privilegeName).singleResult();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (privilege == null) {<NEW_LINE>throw new FlowableException("Could not find or create " + privilegeName + " privilege");<NEW_LINE>}<NEW_LINE>if (!restApiPrivilegeMappingExists) {<NEW_LINE>idmIdentityService.addUserPrivilegeMapping(privilege.getId(), restAdminId);<NEW_LINE>}<NEW_LINE>} | privilege = idmIdentityService.createPrivilege(privilegeName); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.