idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
857,370 | public void deleteCol(final int col) {<NEW_LINE>try {<NEW_LINE>// process the file<NEW_LINE>// allocate buffers<NEW_LINE>final ByteBuffer readBuffer = ByteBuffer.allocate(EncogEGBFile.DOUBLE_SIZE * 1024);<NEW_LINE>final ByteBuffer writeBuffer = ByteBuffer.<MASK><NEW_LINE>readBuffer.clear();<NEW_LINE>writeBuffer.clear();<NEW_LINE>readBuffer.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>writeBuffer.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>long readLocation = EncogEGBFile.HEADER_SIZE;<NEW_LINE>long writeLocation = EncogEGBFile.HEADER_SIZE;<NEW_LINE>int recordOffset = 0;<NEW_LINE>this.fc.position(readLocation);<NEW_LINE>this.fc.read(readBuffer);<NEW_LINE>readLocation = this.fc.position();<NEW_LINE>readBuffer.rewind();<NEW_LINE>boolean done = false;<NEW_LINE>int count = 0;<NEW_LINE>do {<NEW_LINE>// if there is more to read, then process it<NEW_LINE>if (readBuffer.hasRemaining()) {<NEW_LINE>final double d = readBuffer.getDouble();<NEW_LINE>// skip the specified column, as we write<NEW_LINE>if (recordOffset != col) {<NEW_LINE>writeLocation = checkWrite(writeBuffer, writeLocation);<NEW_LINE>writeBuffer.putDouble(d);<NEW_LINE>}<NEW_LINE>// keep track of where we are in a record.<NEW_LINE>recordOffset++;<NEW_LINE>if (recordOffset >= this.recordCount) {<NEW_LINE>recordOffset = 0;<NEW_LINE>count++;<NEW_LINE>// are we done?<NEW_LINE>if (count >= this.numberOfRecords) {<NEW_LINE>done = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// read more<NEW_LINE>readBuffer.clear();<NEW_LINE>readBuffer.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>this.fc.position(readLocation);<NEW_LINE>this.fc.read(readBuffer);<NEW_LINE>readLocation = this.fc.position();<NEW_LINE>readBuffer.rewind();<NEW_LINE>}<NEW_LINE>} while (!done);<NEW_LINE>// write any remaining data in the write buffer<NEW_LINE>if (writeBuffer.position() > 0) {<NEW_LINE>writeBuffer.flip();<NEW_LINE>this.fc.write(writeBuffer, writeLocation);<NEW_LINE>}<NEW_LINE>// does it fall inside of input or ideal?<NEW_LINE>if (col < this.inputCount) {<NEW_LINE>this.inputCount--;<NEW_LINE>this.recordCount--;<NEW_LINE>} else {<NEW_LINE>this.idealCount--;<NEW_LINE>this.recordCount--;<NEW_LINE>}<NEW_LINE>this.recordCount = this.inputCount + this.idealCount + 1;<NEW_LINE>this.recordSize = this.recordCount * EncogEGBFile.DOUBLE_SIZE;<NEW_LINE>// adjust file size<NEW_LINE>this.raf.setLength((this.numberOfRecords * this.recordSize) + EncogEGBFile.HEADER_SIZE);<NEW_LINE>} catch (final IOException ex) {<NEW_LINE>throw new BufferedDataError(ex);<NEW_LINE>}<NEW_LINE>} | allocate(EncogEGBFile.DOUBLE_SIZE * 1024); |
74,196 | public void run() {<NEW_LINE>MC.<MASK><NEW_LINE>Vec3d velocity = MC.player.getVelocity();<NEW_LINE>MC.player.setVelocity(0, velocity.y, 0);<NEW_LINE>Vec3d eyes = RotationUtils.getEyesPos().add(-0.5, -0.5, -0.5);<NEW_LINE>Comparator<BlockPos> comparator = Comparator.<BlockPos>comparingDouble(p -> eyes.squaredDistanceTo(Vec3d.of(p)));<NEW_LINE>BlockPos pos = blocks.stream().max(comparator).get();<NEW_LINE>if (!equipSolidBlock(pos)) {<NEW_LINE>ChatUtils.error("Found a hole in the tunnel's floor but don't have any blocks to fill it with.");<NEW_LINE>setEnabled(false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (BlockUtils.getState(pos).getMaterial().isReplaceable())<NEW_LINE>placeBlockSimple(pos);<NEW_LINE>else {<NEW_LINE>WURST.getHax().autoToolHack.equipBestTool(pos, false, true, false);<NEW_LINE>breakBlock(pos);<NEW_LINE>}<NEW_LINE>} | options.sneakKey.setPressed(true); |
1,326,106 | default Map<String, Object> prepare(final Precorrelation precorrelation, final HttpRequest request) throws IOException {<NEW_LINE>final String correlationId = precorrelation.getId();<NEW_LINE>final Map<String, Object> content = new LinkedHashMap<>();<NEW_LINE>content.put("origin", request.getOrigin().name().toLowerCase(Locale.ROOT));<NEW_LINE>content.put("type", "request");<NEW_LINE><MASK><NEW_LINE>content.put("protocol", request.getProtocolVersion());<NEW_LINE>content.put("remote", request.getRemote());<NEW_LINE>content.put("method", request.getMethod());<NEW_LINE>content.put("uri", request.getRequestUri());<NEW_LINE>content.put("host", request.getHost());<NEW_LINE>content.put("path", request.getPath());<NEW_LINE>content.put("scheme", request.getScheme());<NEW_LINE>content.put("port", preparePort(request));<NEW_LINE>prepareHeaders(request).ifPresent(headers -> content.put("headers", headers));<NEW_LINE>prepareBody(request).ifPresent(body -> content.put("body", body));<NEW_LINE>return content;<NEW_LINE>} | content.put("correlation", correlationId); |
1,169,625 | public AssemblyResolution solve(T exp, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) throws NeedsBackfillException {<NEW_LINE>MaskedLong lval = solver.getValue(exp.getLeft(), vals, cur);<NEW_LINE>MaskedLong rval = solver.getValue(exp.getRight(), vals, cur);<NEW_LINE>if (lval != null && !lval.isFullyDefined()) {<NEW_LINE>if (!lval.isFullyUndefined()) {<NEW_LINE>dbg.println("Partially-defined left value for binary solver: " + lval);<NEW_LINE>}<NEW_LINE>lval = null;<NEW_LINE>}<NEW_LINE>if (rval != null && !rval.isFullyDefined()) {<NEW_LINE>if (!rval.isFullyUndefined()) {<NEW_LINE>dbg.println("Partially-defined right value for binary solver: " + rval);<NEW_LINE>}<NEW_LINE>rval = null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (lval != null && rval != null) {<NEW_LINE>MaskedLong <MASK><NEW_LINE>return ConstantValueSolver.checkConstAgrees(cval, goal, description);<NEW_LINE>} else if (lval != null) {<NEW_LINE>return solveRightSide(exp.getRight(), lval, goal, vals, cur, hints, description);<NEW_LINE>} else if (rval != null) {<NEW_LINE>return solveLeftSide(exp.getLeft(), rval, goal, vals, cur, hints, description);<NEW_LINE>} else {<NEW_LINE>// Each solver may provide a strategy for solving expression where both sides are<NEW_LINE>// variable, e.g., two fields being concatenated via OR.<NEW_LINE>return solveTwoSided(exp, goal, vals, cur, hints, description);<NEW_LINE>}<NEW_LINE>} catch (NeedsBackfillException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (SolverException e) {<NEW_LINE>return AssemblyResolution.error(e.getMessage(), description);<NEW_LINE>} catch (AssertionError e) {<NEW_LINE>dbg.println("While solving: " + exp + " (" + description + ")");<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} | cval = compute(lval, rval); |
1,293,799 | public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) {<NEW_LINE>if ((inOff + len) > in.length) {<NEW_LINE>throw new DataLengthException("input buffer too short");<NEW_LINE>}<NEW_LINE>if ((outOff + len) > out.length) {<NEW_LINE>throw new OutputLengthException("output buffer too short");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>x = (x + 1) & 0xff;<NEW_LINE>y = (engineState[x] + y) & 0xff;<NEW_LINE>// swap<NEW_LINE>byte tmp = engineState[x];<NEW_LINE>engineState[x] = engineState[y];<NEW_LINE>engineState[y] = tmp;<NEW_LINE>// xor<NEW_LINE>out[i + outOff] = (byte) (in[i + inOff] ^ engineState[(engineState[x] + engineState<MASK><NEW_LINE>}<NEW_LINE>return len;<NEW_LINE>} | [y]) & 0xff]); |
131,506 | public void serialize(StringBodyDTO stringBodyDTO, JsonGenerator jgen, SerializerProvider provider) throws IOException {<NEW_LINE>boolean notFieldSetAndNotDefault = stringBodyDTO.getNot() != null && stringBodyDTO.getNot();<NEW_LINE>boolean optionalFieldSetAndNotDefault = stringBodyDTO.getOptional() != null && stringBodyDTO.getOptional();<NEW_LINE>boolean subStringFieldNotDefault = stringBodyDTO.isSubString();<NEW_LINE>boolean contentTypeFieldSet = stringBodyDTO.getContentType() != null;<NEW_LINE>if (serialiseDefaultValues || notFieldSetAndNotDefault || optionalFieldSetAndNotDefault || contentTypeFieldSet || subStringFieldNotDefault) {<NEW_LINE>jgen.writeStartObject();<NEW_LINE>if (notFieldSetAndNotDefault) {<NEW_LINE>jgen.writeBooleanField("not", true);<NEW_LINE>}<NEW_LINE>if (optionalFieldSetAndNotDefault) {<NEW_LINE>jgen.writeBooleanField("optional", true);<NEW_LINE>}<NEW_LINE>jgen.writeStringField("type", stringBodyDTO.getType().name());<NEW_LINE>jgen.writeStringField("string", stringBodyDTO.getString());<NEW_LINE>if (stringBodyDTO.getRawBytes() != null) {<NEW_LINE>jgen.writeObjectField(<MASK><NEW_LINE>}<NEW_LINE>if (subStringFieldNotDefault) {<NEW_LINE>jgen.writeBooleanField("subString", true);<NEW_LINE>}<NEW_LINE>if (contentTypeFieldSet) {<NEW_LINE>jgen.writeStringField("contentType", stringBodyDTO.getContentType());<NEW_LINE>}<NEW_LINE>jgen.writeEndObject();<NEW_LINE>} else {<NEW_LINE>jgen.writeString(stringBodyDTO.getString());<NEW_LINE>}<NEW_LINE>} | "rawBytes", stringBodyDTO.getRawBytes()); |
805,283 | public static String saveImage(BufferedImage img, String sImage, String bundlePath) {<NEW_LINE>final int MAX_ALT_NUM = 3;<NEW_LINE>String fullpath = bundlePath;<NEW_LINE>File fBundle = new File(fullpath);<NEW_LINE>if (!fBundle.exists()) {<NEW_LINE>fBundle.mkdir();<NEW_LINE>}<NEW_LINE>if (!sImage.endsWith(".png")) {<NEW_LINE>sImage += ".png";<NEW_LINE>}<NEW_LINE>File fImage <MASK><NEW_LINE>boolean shouldReload = false;<NEW_LINE>int count = 0;<NEW_LINE>String msg = fImage.getName() + " exists - using ";<NEW_LINE>while (count < MAX_ALT_NUM) {<NEW_LINE>if (fImage.exists()) {<NEW_LINE>if (Settings.OverwriteImages) {<NEW_LINE>shouldReload = true;<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>fImage = new File(fBundle, FileManager.getAltFilename(fImage.getName()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (count > 0) {<NEW_LINE>Debug.log(msg + fImage.getName() + " (Utils.saveImage)");<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>if (count >= MAX_ALT_NUM) {<NEW_LINE>fImage = new File(fBundle, Settings.getTimestamp() + ".png");<NEW_LINE>Debug.log(msg + fImage.getName() + " (Utils.saveImage)");<NEW_LINE>}<NEW_LINE>String fpImage = fImage.getAbsolutePath();<NEW_LINE>fpImage = fpImage.replaceAll("\\\\", "/");<NEW_LINE>try {<NEW_LINE>ImageIO.write(img, "png", new File(fpImage));<NEW_LINE>} catch (IOException e) {<NEW_LINE>Debug.error("Util.saveImage: Problem trying to save image file: %s\n%s", fpImage, e.getMessage());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (shouldReload) {<NEW_LINE>Image.reload(sImage);<NEW_LINE>}<NEW_LINE>return fpImage;<NEW_LINE>} | = new File(fBundle, sImage); |
711,923 | public void read(org.apache.thrift.protocol.TProtocol iprot, adhoc_filter_result struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // SUCCESS<NEW_LINE>0:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>if (struct.success == null) {<NEW_LINE>struct.success = new rpc_iterator_handle();<NEW_LINE>}<NEW_LINE>struct.success.read(iprot);<NEW_LINE>struct.setSuccessIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // EX<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>if (struct.ex == null) {<NEW_LINE>struct.ex = new rpc_invalid_operation();<NEW_LINE>}<NEW_LINE>struct.ex.read(iprot);<NEW_LINE>struct.setExIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>} | skip(iprot, schemeField.type); |
256,586 | private void optimizeJsLoop(Collection<JsNode> toInline) throws InterruptedException {<NEW_LINE>int optimizationLevel = options.getOptimizationLevel();<NEW_LINE>List<OptimizerStats<MASK><NEW_LINE>int counter = 0;<NEW_LINE>while (true) {<NEW_LINE>counter++;<NEW_LINE>if (Thread.interrupted()) {<NEW_LINE>throw new InterruptedException();<NEW_LINE>}<NEW_LINE>Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS);<NEW_LINE>OptimizerStats stats = new OptimizerStats("Pass " + counter);<NEW_LINE>// Remove unused functions if possible.<NEW_LINE>stats.add(JsStaticEval.exec(jsProgram));<NEW_LINE>// Inline Js function invocations<NEW_LINE>stats.add(JsInliner.exec(jsProgram, toInline));<NEW_LINE>// Remove unused functions if possible.<NEW_LINE>stats.add(JsUnusedFunctionRemover.exec(jsProgram));<NEW_LINE>// Save the stats to print out after optimizers finish.<NEW_LINE>allOptimizerStats.add(stats);<NEW_LINE>optimizeJsEvent.end();<NEW_LINE>if ((optimizationLevel < OptionOptimize.OPTIMIZE_LEVEL_MAX && counter > optimizationLevel) || !stats.didChange()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (optimizationLevel > OptionOptimize.OPTIMIZE_LEVEL_DRAFT) {<NEW_LINE>DuplicateClinitRemover.exec(jsProgram);<NEW_LINE>}<NEW_LINE>} | > allOptimizerStats = Lists.newArrayList(); |
1,011,848 | private synchronized int loadData(final Uri uri) {<NEW_LINE>int numBytesLoaded = 0;<NEW_LINE>String msg;<NEW_LINE>InputStream inStr;<NEW_LINE>try {<NEW_LINE>inStr = context.getContentResolver().openInputStream(uri);<NEW_LINE>numBytesLoaded = inStr != null ? inStr.available() : 0;<NEW_LINE>msg = context.getString(R.string.loaded).concat(String.format(" %d Bytes", numBytesLoaded));<NEW_LINE>ObjectInputStream oIn = new ObjectInputStream(inStr);<NEW_LINE><MASK><NEW_LINE>ObdProt.PidPvs = (PvList) oIn.readObject();<NEW_LINE>ObdProt.VidPvs = (PvList) oIn.readObject();<NEW_LINE>ObdProt.tCodes = (PvList) oIn.readObject();<NEW_LINE>MainActivity.mPluginPvs = (PvList) oIn.readObject();<NEW_LINE>oIn.close();<NEW_LINE>log.log(Level.INFO, msg);<NEW_LINE>Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Toast.makeText(context, ex.toString(), Toast.LENGTH_SHORT).show();<NEW_LINE>log.log(Level.SEVERE, uri.toString(), ex);<NEW_LINE>}<NEW_LINE>return numBytesLoaded;<NEW_LINE>} | int currService = oIn.readInt(); |
713,786 | public PythonObject toPython(List javaObject) {<NEW_LINE>PythonGIL.assertThreadSafe();<NEW_LINE>PyObject pyList = PyList_New(javaObject.size());<NEW_LINE>for (int i = 0; i < javaObject.size(); i++) {<NEW_LINE>Object item = javaObject.get(i);<NEW_LINE>PythonObject pyItem;<NEW_LINE>boolean owned;<NEW_LINE>if (item instanceof PythonObject) {<NEW_LINE>pyItem = (PythonObject) item;<NEW_LINE>owned = false;<NEW_LINE>} else if (item instanceof PyObject) {<NEW_LINE>pyItem = new PythonObject((PyObject) item, false);<NEW_LINE>owned = false;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>owned = true;<NEW_LINE>}<NEW_LINE>// reference will be stolen by PyList_SetItem()<NEW_LINE>Py_IncRef(pyItem.getNativePythonObject());<NEW_LINE>PyList_SetItem(pyList, i, pyItem.getNativePythonObject());<NEW_LINE>if (owned)<NEW_LINE>pyItem.del();<NEW_LINE>}<NEW_LINE>return new PythonObject(pyList);<NEW_LINE>} | pyItem = PythonTypes.convert(item); |
107,244 | public static void checkMock(Class<?> interfaceClass, AbstractInterfaceConfig config) {<NEW_LINE>String mock = config.getMock();<NEW_LINE>if (ConfigUtils.isEmpty(mock)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String normalizedMock = MockInvoker.normalizeMock(mock);<NEW_LINE>if (normalizedMock.startsWith(RETURN_PREFIX)) {<NEW_LINE>normalizedMock = normalizedMock.substring(RETURN_PREFIX.length()).trim();<NEW_LINE>try {<NEW_LINE>// Check whether the mock value is legal, if it is illegal, throw exception<NEW_LINE>MockInvoker.parseMockValue(normalizedMock);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IllegalStateException("Illegal mock return in <dubbo:service/reference ... " + "mock=\"" + mock + "\" />");<NEW_LINE>}<NEW_LINE>} else if (normalizedMock.startsWith(THROW_PREFIX)) {<NEW_LINE>normalizedMock = normalizedMock.substring(THROW_PREFIX.length()).trim();<NEW_LINE>if (ConfigUtils.isNotEmpty(normalizedMock)) {<NEW_LINE>try {<NEW_LINE>// Check whether the mock value is legal<NEW_LINE>MockInvoker.getThrowable(normalizedMock);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IllegalStateException(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Check whether the mock class is a implementation of the interfaceClass, and if it has a default constructor<NEW_LINE>MockInvoker.getMockObject(config.getScopeModel().getExtensionDirector(), normalizedMock, interfaceClass);<NEW_LINE>}<NEW_LINE>} | "Illegal mock throw in <dubbo:service/reference ... " + "mock=\"" + mock + "\" />"); |
839,540 | public boolean requestChildRectangleOnScreen(RecyclerViewBase parent, View child, Rect rect, boolean immediate) {<NEW_LINE>try {<NEW_LINE>final int parentLeft = getPaddingLeft();<NEW_LINE>final int parentTop = getPaddingTop();<NEW_LINE>final int parentRight <MASK><NEW_LINE>final int parentBottom = getHeight() - getPaddingBottom();<NEW_LINE>final int childLeft = child.getLeft() + rect.left;<NEW_LINE>final int childTop = child.getTop() + rect.top;<NEW_LINE>final int childRight = childLeft + rect.right;<NEW_LINE>final int childBottom = childTop + rect.bottom;<NEW_LINE>final int offScreenLeft = Math.min(0, childLeft - parentLeft);<NEW_LINE>final int offScreenTop = Math.min(0, childTop - parentTop);<NEW_LINE>final int offScreenRight = Math.max(0, childRight - parentRight);<NEW_LINE>final int offScreenBottom = Math.max(0, childBottom - parentBottom);<NEW_LINE>// Favor the "start" layout direction over the end when bringing<NEW_LINE>// one<NEW_LINE>// side or the other<NEW_LINE>// of a large rect into view.<NEW_LINE>final int dx;<NEW_LINE>{<NEW_LINE>dx = offScreenLeft != 0 ? offScreenLeft : offScreenRight;<NEW_LINE>}<NEW_LINE>// Favor bringing the top into view over the bottom<NEW_LINE>final int dy = offScreenTop != 0 ? offScreenTop : offScreenBottom;<NEW_LINE>if (dx != 0 || dy != 0) {<NEW_LINE>if (immediate) {<NEW_LINE>parent.scrollBy(dx, dy);<NEW_LINE>} else {<NEW_LINE>parent.smoothScrollBy(dx, dy, false);<NEW_LINE>}<NEW_LINE>if (parent.needNotifyFooter && !parent.checkNotifyFooterOnRelease) {<NEW_LINE>// Log.d("leo", "ontouchevent needNotify" + ",offsetY="<NEW_LINE>// + mOffsetY + "mTotalLength-height="<NEW_LINE>// + (mAdapter.getListTotalHeight() - getHeight()));<NEW_LINE>parent.needNotifyFooter = false;<NEW_LINE>parent.mRecycler.notifyLastFooterAppeared();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} catch (StackOverflowError e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | = getWidth() - getPaddingRight(); |
1,315,486 | private static Vector apply(CompLongDoubleVector v1, LongIntVector v2, Binary op) {<NEW_LINE>LongDoubleVector[] parts = v1.getPartitions();<NEW_LINE>Storage[] resParts = StorageSwitch.applyComp(v1, v2, op);<NEW_LINE>if (!op.isKeepStorage()) {<NEW_LINE>for (int i = 0; i < parts.length; i++) {<NEW_LINE>if (parts[i].getStorage() instanceof LongDoubleSortedVectorStorage) {<NEW_LINE>resParts[i] = new LongDoubleSparseVectorStorage(parts[i].getDim(), parts[i].getStorage().getIndices(), parts[i].getStorage().getValues());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long subDim = (v1.getDim() + v1.getNumPartitions() - 1) / v1.getNumPartitions();<NEW_LINE>for (int i = 0; i < v1.getDim(); i++) {<NEW_LINE>int pidx = (int) (i / subDim);<NEW_LINE>long subidx = i % subDim;<NEW_LINE>if (v2.getStorage().hasKey(i)) {<NEW_LINE>((LongDoubleVectorStorage) resParts[pidx]).set(subidx, op.apply(parts[pidx].get(subidx), v2.get(i)));<NEW_LINE>} else {<NEW_LINE>((LongDoubleVectorStorage) resParts[pidx]).set(subidx, op.apply(parts[pidx].get(subidx), 0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LongDoubleVector[] res = new LongDoubleVector[parts.length];<NEW_LINE>int i = 0;<NEW_LINE>for (LongDoubleVector part : parts) {<NEW_LINE>res[i] = new LongDoubleVector(part.getMatrixId(), part.getRowId(), part.getClock(), part.getDim(), <MASK><NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>v1.setPartitions(res);<NEW_LINE>return v1;<NEW_LINE>} | (LongDoubleVectorStorage) resParts[i]); |
531,201 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>// Inflate the layout for this fragment<NEW_LINE>((MemoryGraphParent) getActivity()).setActionBarTitle(getResources().getString(R.string.statistics));<NEW_LINE>View rootView = inflater.inflate(R.<MASK><NEW_LINE>deltaValView = rootView.findViewById(R.id.delta_value);<NEW_LINE>thetaValView = rootView.findViewById(R.id.theta_value);<NEW_LINE>lowAlphaValView = rootView.findViewById(R.id.low_alpha_value);<NEW_LINE>highAlphaValView = rootView.findViewById(R.id.high_alpha_value);<NEW_LINE>concEmojiView = rootView.findViewById(R.id.concentrate_emoji);<NEW_LINE>sleepEmojiView = rootView.findViewById(R.id.sleep_emoji);<NEW_LINE>calmEmojiView = rootView.findViewById(R.id.calm_emoji);<NEW_LINE>angerEmojiView = rootView.findViewById(R.id.anger_emoji);<NEW_LINE>if (StatisticsFragment.parsedData == null)<NEW_LINE>Toast.makeText(getContext(), "No Data", Toast.LENGTH_SHORT).show();<NEW_LINE>else<NEW_LINE>initStatistics();<NEW_LINE>return rootView;<NEW_LINE>} | layout.fragment_statistics, container, false); |
803,163 | public Object sGet(SField sField) {<NEW_LINE>if (sField.getName().equals("bounds")) {<NEW_LINE>return getBounds();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("boundsUntransformed")) {<NEW_LINE>return getBoundsUntransformed();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("startVertex")) {<NEW_LINE>return getStartVertex();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("startIndex")) {<NEW_LINE>return getStartIndex();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("primitiveCount")) {<NEW_LINE>return getPrimitiveCount();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("transformation")) {<NEW_LINE>return getTransformation();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("dataId")) {<NEW_LINE>return getDataId();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("area")) {<NEW_LINE>return getArea();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("volume")) {<NEW_LINE>return getVolume();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("hasTransparency")) {<NEW_LINE>return isHasTransparency();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("ifcProductOid")) {<NEW_LINE>return getIfcProductOid();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("ifcProductUuid")) {<NEW_LINE>return getIfcProductUuid();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("ifcProductRid")) {<NEW_LINE>return getIfcProductRid();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("density")) {<NEW_LINE>return getDensity();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("boundsMm")) {<NEW_LINE>return getBoundsMm();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("boundsUntransformedMm")) {<NEW_LINE>return getBoundsUntransformedMm();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("additionalData")) {<NEW_LINE>return getAdditionalData();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("nrColors")) {<NEW_LINE>return getNrColors();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("nrVertices")) {<NEW_LINE>return getNrVertices();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("ifcProductPid")) {<NEW_LINE>return getIfcProductPid();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("oid")) {<NEW_LINE>return getOid();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("rid")) {<NEW_LINE>return getRid();<NEW_LINE>}<NEW_LINE>if (sField.getName().equals("uuid")) {<NEW_LINE>return getUuid();<NEW_LINE>}<NEW_LINE>throw new RuntimeException("Field " + <MASK><NEW_LINE>} | sField.getName() + " not found"); |
670,139 | public Map<String, String> createReplacements(String action, Lookup lookup) {<NEW_LINE>FileObject fo = lookup.lookup(FileObject.class);<NEW_LINE>if (fo == null) {<NEW_LINE>SingleMethod m = <MASK><NEW_LINE>if (m != null) {<NEW_LINE>fo = m.getFile();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isGroovyFile(fo)) {<NEW_LINE>for (SourceGroup group : ProjectUtils.getSources(project).getSourceGroups(GroovySourcesImpl.TYPE_GROOVY)) {<NEW_LINE>String relPath = FileUtil.getRelativePath(group.getRootFolder(), fo);<NEW_LINE>if (relPath != null) {<NEW_LINE>Map<String, String> replaceMap = new HashMap<String, String>();<NEW_LINE>replaceMap.put(CLASSNAME_EXT, fo.getNameExt());<NEW_LINE>replaceMap.put(CLASSNAME, fo.getName());<NEW_LINE>String pack = FileUtil.getRelativePath(group.getRootFolder(), fo.getParent());<NEW_LINE>if (pack != null) {<NEW_LINE>// #141175<NEW_LINE>// NOI18N<NEW_LINE>replaceMap.put(PACK_CLASSNAME, (pack + (pack.length() > 0 ? "." : "") + fo.getName()).replace('/', '.'));<NEW_LINE>} else {<NEW_LINE>replaceMap.put(PACK_CLASSNAME, fo.getName());<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>replaceMap.put(CLASSPATHSCOPE, group.getName().equals(GroovySourcesImpl.NAME_GROOVYTESTSOURCE) ? "test" : "runtime");<NEW_LINE>return replaceMap;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Collections.emptyMap();<NEW_LINE>} | lookup.lookup(SingleMethod.class); |
1,748,659 | public void decode(MBlock mBlock, Picture mb) {<NEW_LINE>int mbX = mapper.getMbX(mBlock.mbIdx);<NEW_LINE>int mbY = mapper.getMbY(mBlock.mbIdx);<NEW_LINE>int address = mapper.getAddress(mBlock.mbIdx);<NEW_LINE>boolean leftAvailable = mapper.leftAvailable(mBlock.mbIdx);<NEW_LINE>boolean topAvailable = mapper.topAvailable(mBlock.mbIdx);<NEW_LINE>s.qp = (s.qp + mBlock.mbQPDelta + 52) % 52;<NEW_LINE>di.mbQps[0][address] = s.qp;<NEW_LINE>residualLumaI16x16(mBlock, leftAvailable, topAvailable, mbX, mbY);<NEW_LINE>Intra16x16PredictionBuilder.predictWithMode(mBlock.luma16x16Mode, mBlock.ac[0], leftAvailable, topAvailable, s.leftRow[0], s.topLine[0], s.topLeft[0], mbX << 4, mb.getPlaneData(0));<NEW_LINE>decodeChroma(mBlock, mbX, mbY, leftAvailable, topAvailable, mb, s.qp);<NEW_LINE>di.<MASK><NEW_LINE>collectPredictors(s, mb, mbX);<NEW_LINE>saveMvsIntra(di, mbX, mbY);<NEW_LINE>saveVectIntra(s, mapper.getMbX(mBlock.mbIdx));<NEW_LINE>} | mbTypes[address] = mBlock.curMbType; |
1,112,003 | private void uiAttachedAndCoreRunning(Core core) {<NEW_LINE>Utils.execSWTThread(new AERunnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void runSupport() {<NEW_LINE>MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();<NEW_LINE>if (mdi != null) {<NEW_LINE>setupUI(mdi);<NEW_LINE>} else {<NEW_LINE>SkinViewManager.addListener(new SkinViewManagerListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void skinViewAdded(SkinView skinview) {<NEW_LINE>if (skinview instanceof SideBar) {<NEW_LINE>setupUI((SideBar) skinview);<NEW_LINE>SkinViewManager.RemoveListener(this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>canCloseListener = new canCloseListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean canClose() {<NEW_LINE>try {<NEW_LINE>if (device_manager == null) {<NEW_LINE>// not yet init, safe to close<NEW_LINE>return (true);<NEW_LINE>}<NEW_LINE>if (!device_manager.isTranscodeManagerInitialized()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final TranscodeJob job = device_manager.getTranscodeManager().getQueue().getCurrentJob();<NEW_LINE>if (job == null || job.getState() != TranscodeJob.ST_RUNNING) {<NEW_LINE>return (true);<NEW_LINE>}<NEW_LINE>if (job.getTranscodeFile().getDevice().isHidden()) {<NEW_LINE>// The assumption here is that if the device is hidden either the user shouldn't be concerned<NEW_LINE>// about the loss of active transcode as either it is something that they don't know about or<NEW_LINE>// alternative canClose listeners have been registered to handle the situation (e.g. burn-in-progress)<NEW_LINE>return (true);<NEW_LINE>}<NEW_LINE>String title = MessageText.getString("device.quit.transcoding.title");<NEW_LINE>String text = MessageText.getString("device.quit.transcoding.text", new String[] { job.getName(), job.getTarget().getDevice().getName(), String.valueOf(job.getPercentComplete()) });<NEW_LINE>MessageBoxShell mb = new MessageBoxShell(title, text, new String[] { MessageText.getString("UpdateWindow.quit"), MessageText.getString("Content.alert.notuploaded.button.abort") }, 1);<NEW_LINE>mb.open(null);<NEW_LINE>mb.waitUntilClosed();<NEW_LINE><MASK><NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.out(e);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>UIExitUtilsSWT.addListener(canCloseListener);<NEW_LINE>} | return mb.getResult() == 0; |
1,036,583 | protected void initColumnAndType() {<NEW_LINE>columns.put(COLUMN_INDEX, new ColumnMeta(COLUMN_INDEX, "int(11)", false, true));<NEW_LINE>columnsType.put(COLUMN_INDEX, Fields.FIELD_TYPE_LONG);<NEW_LINE>columns.put(COLUMN_CLUSTER, new ColumnMeta(COLUMN_CLUSTER, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_CLUSTER, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_RELOAD_TYPE, new ColumnMeta(COLUMN_RELOAD_TYPE, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_RELOAD_TYPE, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_RELOAD_STATUS, new ColumnMeta(COLUMN_RELOAD_STATUS, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_RELOAD_STATUS, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_LAST_RELOAD_START, new ColumnMeta<MASK><NEW_LINE>columnsType.put(COLUMN_LAST_RELOAD_START, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_LAST_RELOAD_END, new ColumnMeta(COLUMN_LAST_RELOAD_END, "varchar(19)", false));<NEW_LINE>columnsType.put(COLUMN_LAST_RELOAD_END, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_TRIGGER_TYPE, new ColumnMeta(COLUMN_TRIGGER_TYPE, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_TRIGGER_TYPE, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_END_TYPE, new ColumnMeta(COLUMN_END_TYPE, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_END_TYPE, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>} | (COLUMN_LAST_RELOAD_START, "varchar(19)", false)); |
1,544,434 | protected boolean exist(Business business, EffectivePerson effectivePerson, String name, String excludeId) throws Exception {<NEW_LINE>EntityManager em = business.entityManagerContainer().get(Share.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<Long> cq = <MASK><NEW_LINE>Root<Share> root = cq.from(Share.class);<NEW_LINE>Predicate p = cb.equal(root.get(Share_.person), effectivePerson.getDistinguishedName());<NEW_LINE>p = cb.and(p, cb.equal(root.get(Share_.fileId), name));<NEW_LINE>if (StringUtils.isNotEmpty(excludeId)) {<NEW_LINE>p = cb.and(p, cb.notEqual(root.get(Share_.id), excludeId));<NEW_LINE>}<NEW_LINE>cq.select(cb.count(root)).where(p);<NEW_LINE>long count = em.createQuery(cq).getSingleResult();<NEW_LINE>return count > 0;<NEW_LINE>} | cb.createQuery(Long.class); |
668,181 | private void mergeTuplets() {<NEW_LINE>for (Voice voice : getVoicesWithImplicit()) {<NEW_LINE>final List<TupletInter> tuplets = voice.getTuplets();<NEW_LINE>TupletInter prevTuplet = null;<NEW_LINE>List<AbstractChordInter> prevGroup = null;<NEW_LINE>BeamGroupInter bgLast = null;<NEW_LINE>for (TupletInter tuplet : tuplets) {<NEW_LINE>List<AbstractChordInter> group = tuplet.getChords();<NEW_LINE>if (bgLast != null) {<NEW_LINE>BeamGroupInter bgFirst = group.get(0).getBeamGroup();<NEW_LINE>if (bgFirst == bgLast) {<NEW_LINE>logger.<MASK><NEW_LINE>removeTuplet(prevTuplet);<NEW_LINE>removeTuplet(tuplet);<NEW_LINE>List<AbstractChordInter> doubleGroup = new ArrayList<>();<NEW_LINE>doubleGroup.addAll(prevGroup);<NEW_LINE>doubleGroup.addAll(group);<NEW_LINE>List<AbstractChordInter> extGroup = new ArrayList<>();<NEW_LINE>tupletGenerator.generateTuplets(doubleGroup, extGroup);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>prevTuplet = tuplet;<NEW_LINE>prevGroup = group;<NEW_LINE>bgLast = group.get(group.size() - 1).getBeamGroup();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | debug("Merge {} with {}", prevTuplet, tuplet); |
1,613,057 | public Graph<EntityDescriptor> resolveNativeEntity(EntityDescriptor entityDescriptor) {<NEW_LINE>final MutableGraph<EntityDescriptor> mutableGraph = GraphBuilder.directed().build();<NEW_LINE>mutableGraph.addNode(entityDescriptor);<NEW_LINE>final ModelId modelId = entityDescriptor.id();<NEW_LINE>try {<NEW_LINE>final PipelineDao pipelineDao = pipelineService.load(modelId.id());<NEW_LINE>final String pipelineSource = pipelineDao.source();<NEW_LINE>final Collection<<MASK><NEW_LINE>referencedRules.stream().map(ModelId::of).map(id -> EntityDescriptor.create(id, ModelTypes.PIPELINE_RULE_V1)).forEach(rule -> mutableGraph.putEdge(entityDescriptor, rule));<NEW_LINE>final Set<PipelineConnections> pipelineConnections = connectionsService.loadByPipelineId(pipelineDao.id());<NEW_LINE>pipelineConnections.stream().map(PipelineConnections::streamId).map(ModelId::of).map(id -> EntityDescriptor.create(id, ModelTypes.STREAM_V1)).forEach(stream -> mutableGraph.putEdge(entityDescriptor, stream));<NEW_LINE>} catch (NotFoundException e) {<NEW_LINE>LOG.debug("Couldn't find pipeline {}", entityDescriptor, e);<NEW_LINE>}<NEW_LINE>return ImmutableGraph.copyOf(mutableGraph);<NEW_LINE>} | String> referencedRules = referencedRules(pipelineSource); |
607,484 | public GradientPaint transform(GradientPaint paint, Shape target) {<NEW_LINE>GradientPaint result = paint;<NEW_LINE><MASK><NEW_LINE>if (this.type.equals(GradientPaintTransformType.VERTICAL)) {<NEW_LINE>result = new GradientPaint((float) bounds.getCenterX(), (float) bounds.getMinY(), paint.getColor1(), (float) bounds.getCenterX(), (float) bounds.getMaxY(), paint.getColor2());<NEW_LINE>} else if (this.type.equals(GradientPaintTransformType.HORIZONTAL)) {<NEW_LINE>result = new GradientPaint((float) bounds.getMinX(), (float) bounds.getCenterY(), paint.getColor1(), (float) bounds.getMaxX(), (float) bounds.getCenterY(), paint.getColor2());<NEW_LINE>} else if (this.type.equals(GradientPaintTransformType.CENTER_HORIZONTAL)) {<NEW_LINE>result = new GradientPaint((float) bounds.getCenterX(), (float) bounds.getCenterY(), paint.getColor2(), (float) bounds.getMaxX(), (float) bounds.getCenterY(), paint.getColor1(), true);<NEW_LINE>} else if (this.type.equals(GradientPaintTransformType.CENTER_VERTICAL)) {<NEW_LINE>result = new GradientPaint((float) bounds.getCenterX(), (float) bounds.getMinY(), paint.getColor1(), (float) bounds.getCenterX(), (float) bounds.getCenterY(), paint.getColor2(), true);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | Rectangle2D bounds = target.getBounds2D(); |
1,206,503 | private void docEntity(Node g, Node s, List<Quad> batch) {<NEW_LINE>// One document per entity<NEW_LINE>String <MASK><NEW_LINE>String gx = TextQueryFuncs.graphNodeToString(g);<NEW_LINE>Entity entity = new Entity(x, gx);<NEW_LINE>String graphField = defn.getGraphField();<NEW_LINE>if (defn.getGraphField() != null)<NEW_LINE>entity.put(graphField, gx);<NEW_LINE>for (Quad quad : batch) {<NEW_LINE>Node p = quad.getPredicate();<NEW_LINE>String field = defn.getField(p);<NEW_LINE>if (field == null)<NEW_LINE>continue;<NEW_LINE>Node o = quad.getObject();<NEW_LINE>String val = null;<NEW_LINE>if (o.isURI())<NEW_LINE>val = o.getURI();<NEW_LINE>else if (o.isLiteral())<NEW_LINE>val = o.getLiteralLexicalForm();<NEW_LINE>else {<NEW_LINE>log.warn("Not a literal value for mapped field-predicate: " + field + " :: " + FmtUtils.stringForString(field));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>entity.put(field, val);<NEW_LINE>}<NEW_LINE>indexer.addEntity(entity);<NEW_LINE>} | x = TextQueryFuncs.subjectToString(s); |
581,529 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>* @see org.eclipse.jface.text.rules.PatternRule#endSequenceDetected(org.eclipse.jface.text.rules.ICharacterScanner)<NEW_LINE>*/<NEW_LINE>protected boolean endSequenceDetected(ICharacterScanner scanner) {<NEW_LINE>CollectingCharacterScanner collectingCharacterScanner = new CollectingCharacterScanner(scanner, String.valueOf(fStartSequence));<NEW_LINE>int c, length = 0;<NEW_LINE>while ((c = collectingCharacterScanner.read()) != ICharacterScanner.EOF) {<NEW_LINE>length++;<NEW_LINE>if (c == '\'') {<NEW_LINE>collectingCharacterScanner.unread();<NEW_LINE>IToken token = singleQuoteStringRule.evaluate(collectingCharacterScanner);<NEW_LINE>if (token.isUndefined()) {<NEW_LINE>token = singleQuoteStringEOLRule.evaluate(collectingCharacterScanner);<NEW_LINE>}<NEW_LINE>} else if (c == '"') {<NEW_LINE>collectingCharacterScanner.unread();<NEW_LINE>IToken token = doubleQuoteStringRule.evaluate(collectingCharacterScanner);<NEW_LINE>if (token.isUndefined()) {<NEW_LINE>token = doubleQuoteStringEOLRule.evaluate(collectingCharacterScanner);<NEW_LINE>}<NEW_LINE>} else if (c == fStartSequence[0]) {<NEW_LINE>fEmbeddedStart++;<NEW_LINE>} else if (c == fEndSequence[0]) {<NEW_LINE>if (fEmbeddedStart == 0) {<NEW_LINE>if (fToken instanceof ExtendedToken) {<NEW_LINE>((ExtendedToken) fToken).<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>fEmbeddedStart--;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (scanner instanceof SequenceCharacterScanner && ((SequenceCharacterScanner) scanner).foundSequence()) {<NEW_LINE>// this means the EOF came from seeing a switching sequence, so assumes the end is detected and no need to<NEW_LINE>// rewind one character<NEW_LINE>if (fToken instanceof ExtendedToken) {<NEW_LINE>((ExtendedToken) fToken).setContents(collectingCharacterScanner.getContents());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < length; ++i) {<NEW_LINE>collectingCharacterScanner.unread();<NEW_LINE>}<NEW_LINE>// unread the original character<NEW_LINE>collectingCharacterScanner.unread();<NEW_LINE>return false;<NEW_LINE>} | setContents(collectingCharacterScanner.getContents()); |
1,119,174 | private void backgroundPullFromRemote() {<NEW_LINE>if (getRemoteClientManager().getRemoteClient().isAuthenticated()) {<NEW_LINE>m_pulling = true;<NEW_LINE>updateSyncUI(false);<NEW_LINE>new AsyncTask<Void, Void, Boolean>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected Boolean doInBackground(Void... params) {<NEW_LINE>try {<NEW_LINE>Log.d(TAG, "start taskBag.pullFromRemote");<NEW_LINE>taskBag.pullFromRemote(true);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.e(TAG, e.getMessage());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onPostExecute(Boolean result) {<NEW_LINE>Log.d(TAG, "post taskBag.pullFromRemote");<NEW_LINE>m_pulling = false;<NEW_LINE>if (result) {<NEW_LINE>Log.d(TAG, "taskBag.pullFromRemote done");<NEW_LINE>updateSyncUI(true);<NEW_LINE>} else {<NEW_LINE>sendBroadcast(<MASK><NEW_LINE>}<NEW_LINE>super.onPostExecute(result);<NEW_LINE>}<NEW_LINE>}.execute();<NEW_LINE>} else {<NEW_LINE>Log.e(TAG, "NOT AUTHENTICATED!");<NEW_LINE>showToast("NOT AUTHENTICATED!");<NEW_LINE>}<NEW_LINE>} | new Intent(Constants.INTENT_ASYNC_FAILED)); |
1,836,913 | TreeSet<DexProgramClass> sortClassesByPackage(Set<DexProgramClass> classes, Map<DexProgramClass, String> originalNames) {<NEW_LINE>TreeSet<DexProgramClass> sortedClasses = new TreeSet((a, b) -> {<NEW_LINE>String originalA = (String) originalNames.get(a);<NEW_LINE>String originalB = (String) originalNames.get(b);<NEW_LINE>int indexA = originalA.lastIndexOf(46);<NEW_LINE>int indexB = originalB.lastIndexOf(46);<NEW_LINE>if (indexA == -1 && indexB == -1) {<NEW_LINE>return originalA.compareTo(originalB);<NEW_LINE>} else if (indexA == -1) {<NEW_LINE>return -1;<NEW_LINE>} else if (indexB == -1) {<NEW_LINE>return 1;<NEW_LINE>} else {<NEW_LINE>String prefixA = originalA.substring(0, indexA);<NEW_LINE>String prefixB = <MASK><NEW_LINE>int result = prefixA.compareTo(prefixB);<NEW_LINE>return result != 0 ? result : originalA.compareTo(originalB);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>sortedClasses.addAll(classes);<NEW_LINE>return sortedClasses;<NEW_LINE>} | originalB.substring(0, indexB); |
638,991 | private void processSubcommand(CommandLine subcommand, ParseResult.Builder builder, List<CommandLine> parsedCommands, Stack<String> args, Collection<ArgSpec> required, Set<ArgSpec> initialized, String[] originalArgs, List<Object> nowProcessing, String separator, String arg) {<NEW_LINE>Tracer tracer = CommandLine.tracer();<NEW_LINE>if (tracer.isDebug()) {<NEW_LINE>tracer.debug("Found subcommand '%s' (%s)", arg, subcommand.commandSpec.toString());<NEW_LINE>}<NEW_LINE>nowProcessing.add(subcommand.commandSpec);<NEW_LINE>updateHelpRequested(subcommand.commandSpec);<NEW_LINE>List<ArgSpec> inheritedRequired = new ArrayList<ArgSpec>();<NEW_LINE>if (tracer.isDebug()) {<NEW_LINE>tracer.debug("Checking required args for parent %s...", subcommand.commandSpec.parent());<NEW_LINE>}<NEW_LINE>Iterator<ArgSpec> requiredIter = required.iterator();<NEW_LINE>while (requiredIter.hasNext()) {<NEW_LINE><MASK><NEW_LINE>if (requiredArg.scopeType() == ScopeType.INHERIT || requiredArg.inherited()) {<NEW_LINE>if (tracer.isDebug()) {<NEW_LINE>tracer.debug("Postponing validation for required %s: scopeType=%s, inherited=%s", optionDescription("", requiredArg, -1), requiredArg.scopeType(), requiredArg.inherited());<NEW_LINE>}<NEW_LINE>if (!inheritedRequired.contains(requiredArg)) {<NEW_LINE>inheritedRequired.add(requiredArg);<NEW_LINE>}<NEW_LINE>requiredIter.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!isAnyHelpRequested() && !required.isEmpty()) {<NEW_LINE>// ensure current command portion is valid<NEW_LINE>throw MissingParameterException.create(CommandLine.this, required, separator);<NEW_LINE>}<NEW_LINE>Set<ArgSpec> inheritedInitialized = new LinkedHashSet<ArgSpec>();<NEW_LINE>subcommand.interpreter.parse(parsedCommands, args, originalArgs, nowProcessing, inheritedRequired, inheritedInitialized);<NEW_LINE>initialized.addAll(inheritedInitialized);<NEW_LINE>builder.subcommand(subcommand.interpreter.parseResultBuilder.build());<NEW_LINE>} | ArgSpec requiredArg = requiredIter.next(); |
532,647 | public SRemoteServiceCalled convertToSObject(RemoteServiceCalled input) {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>SRemoteServiceCalled result = new SRemoteServiceCalled();<NEW_LINE>result.setOid(input.getOid());<NEW_LINE>result.setUuid(input.getUuid());<NEW_LINE>result.<MASK><NEW_LINE>result.setDate(input.getDate());<NEW_LINE>result.setAccessMethod(SAccessMethod.values()[input.getAccessMethod().ordinal()]);<NEW_LINE>result.setState(SNotifictionResultEnum.values()[input.getState().ordinal()]);<NEW_LINE>result.setPercentage(input.getPercentage());<NEW_LINE>result.getInfos().addAll(input.getInfos());<NEW_LINE>result.getWarnings().addAll(input.getWarnings());<NEW_LINE>result.getErrors().addAll(input.getErrors());<NEW_LINE>User executorVal = input.getExecutor();<NEW_LINE>result.setExecutorId(executorVal == null ? -1 : executorVal.getOid());<NEW_LINE>Service serviceVal = input.getService();<NEW_LINE>result.setServiceId(serviceVal == null ? -1 : serviceVal.getOid());<NEW_LINE>return result;<NEW_LINE>} | setRid(input.getRid()); |
182,230 | private static void addToCurrentGroup(ScanState state, CitationGroup group, XTextRange currentRange) {<NEW_LINE>final boolean isNewGroup = state.currentGroup.isEmpty();<NEW_LINE>if (!isNewGroup) {<NEW_LINE>Objects.requireNonNull(state.currentGroupCursor);<NEW_LINE>Objects.requireNonNull(state.cursorBetween);<NEW_LINE>Objects.requireNonNull(state.prev);<NEW_LINE>Objects.requireNonNull(state.prevRange);<NEW_LINE>}<NEW_LINE>// Add the current entry to a group.<NEW_LINE>state.currentGroup.add(group);<NEW_LINE>// Set up cursorBetween to start at currentRange.getEnd()<NEW_LINE>XTextRange rangeEnd = currentRange.getEnd();<NEW_LINE>state.cursorBetween = currentRange.getText().createTextCursorByRange(rangeEnd);<NEW_LINE>// If new group, create currentGroupCursor<NEW_LINE>if (isNewGroup) {<NEW_LINE>state.currentGroupCursor = (currentRange.getText().createTextCursorByRange<MASK><NEW_LINE>}<NEW_LINE>// include currentRange in currentGroupCursor<NEW_LINE>state.currentGroupCursor.goRight((short) (currentRange.getString().length()), true);<NEW_LINE>if (UnoTextRange.compareEnds(state.cursorBetween, state.currentGroupCursor) != 0) {<NEW_LINE>LOGGER.warn("MergeCitationGroups: cursorBetween.end != currentGroupCursor.end");<NEW_LINE>throw new IllegalStateException("MergeCitationGroups failed");<NEW_LINE>} | (currentRange.getStart())); |
596,302 | static void doExecuteConverterGeneric(ConversionNodeSupplier supplier, int index, Object converter, Object inputArgument, Object outputArgument, @CachedLibrary("converter") InteropLibrary converterLib, @CachedLibrary(limit = "1") InteropLibrary resultLib, @Cached(value = "createTN(supplier)", uncached = "getUncachedTN(supplier)") CExtToNativeNode toNativeNode, @Exclusive @Cached PRaiseNativeNode raiseNode, @Exclusive @Cached ConverterCheckResultNode checkResultNode) throws ParseArgumentsException {<NEW_LINE>try {<NEW_LINE>Object result = converterLib.execute(converter, toNativeNode.execute(inputArgument), outputArgument);<NEW_LINE>if (resultLib.fitsInInt(result)) {<NEW_LINE>checkResultNode.execute(resultLib.asInt(result));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CompilerDirectives.transferToInterpreter();<NEW_LINE>raiseNode.raiseIntWithoutFrame(0, PythonBuiltinClassType.<MASK><NEW_LINE>} catch (UnsupportedTypeException e) {<NEW_LINE>CompilerDirectives.transferToInterpreter();<NEW_LINE>raiseNode.raiseIntWithoutFrame(0, PythonBuiltinClassType.SystemError, ErrorMessages.CALLING_ARG_CONVERTER_FAIL_INCOMPATIBLE_PARAMS, e.getSuppliedValues());<NEW_LINE>} catch (ArityException e) {<NEW_LINE>CompilerDirectives.transferToInterpreter();<NEW_LINE>raiseNode.raiseIntWithoutFrame(0, PythonBuiltinClassType.SystemError, ErrorMessages.CALLING_ARG_CONVERTER_FAIL_EXPECTED_D_GOT_P, e.getExpectedMinArity(), e.getActualArity());<NEW_LINE>} catch (UnsupportedMessageException e) {<NEW_LINE>CompilerDirectives.transferToInterpreter();<NEW_LINE>raiseNode.raiseIntWithoutFrame(0, PythonBuiltinClassType.SystemError, ErrorMessages.ARG_CONVERTED_NOT_EXECUTABLE);<NEW_LINE>}<NEW_LINE>throw ParseArgumentsException.raise();<NEW_LINE>} | SystemError, ErrorMessages.CALLING_ARG_CONVERTER_FAIL_UNEXPECTED_RETURN, result); |
336,006 | private void initOsPathModule() {<NEW_LINE>ModuleType m = newModule("path");<NEW_LINE>State ospath = m.table;<NEW_LINE>// make sure global qnames are correct<NEW_LINE>ospath.setPath("os.path");<NEW_LINE>update("path", newLibUrl("os.path.html#module-os.path"), m, MODULE);<NEW_LINE>String[] str_funcs = { "_resolve_link", "abspath", "basename", "commonprefix", "dirname", "expanduser", "expandvars", "join", "normcase", "normpath", "realpath", "relpath" };<NEW_LINE>for (String s : str_funcs) {<NEW_LINE>addFunction(m, s, Types.StrInstance);<NEW_LINE>}<NEW_LINE>String[] num_funcs = { "exists", "lexists", "getatime", "getctime", "getmtime", "getsize", "isabs", "isdir", "isfile", "islink", "ismount", "samefile", "sameopenfile", "samestat", "supports_unicode_filenames" };<NEW_LINE>for (String s : num_funcs) {<NEW_LINE>addFunction(m, s, Types.IntInstance);<NEW_LINE>}<NEW_LINE>for (String s : list("split", "splitdrive", "splitext", "splitunc")) {<NEW_LINE>addFunction(m, s, newTuple(Types.StrInstance, Types.StrInstance));<NEW_LINE>}<NEW_LINE>addFunction(m, "walk", newFunc(Types.NoneInstance));<NEW_LINE>addAttr(ospath, "os", this.module);<NEW_LINE>// moduleTable.lookupLocal("stat").getType(),<NEW_LINE>ospath.// moduleTable.lookupLocal("stat").getType(),<NEW_LINE>insert(// moduleTable.lookupLocal("stat").getType(),<NEW_LINE>"stat", // moduleTable.lookupLocal("stat").getType(),<NEW_LINE>newLibUrl("stat"), newModule("<stat-fixme>"), ATTRIBUTE);<NEW_LINE>// XXX: this is an re object, I think<NEW_LINE>addAttr(<MASK><NEW_LINE>} | ospath, "_varprog", Types.UNKNOWN); |
965,915 | protected void initView() {<NEW_LINE>LayoutInflater.from(mContext).inflate(R.layout.trtccalling_group_videocall_activity_call_main, this);<NEW_LINE>mMuteImg = (ImageView) findViewById(R.id.iv_mute);<NEW_LINE>mMuteLl = (LinearLayout) findViewById(R.id.ll_mute);<NEW_LINE>mHangupImg = (ImageView) findViewById(R.id.iv_hangup);<NEW_LINE>mHangupLl = (LinearLayout) findViewById(R.id.ll_hangup);<NEW_LINE>mHandsfreeImg = (ImageView) findViewById(R.id.iv_handsfree);<NEW_LINE>mHandsfreeLl = (LinearLayout) findViewById(R.id.ll_handsfree);<NEW_LINE>mDialingImg = (ImageView) findViewById(R.id.iv_dialing);<NEW_LINE>mDialingLl = (LinearLayout) findViewById(R.id.ll_dialing);<NEW_LINE>mLayoutManagerTRTC = (TRTCGroupVideoLayoutManager) findViewById(R.id.trtc_layout_manager);<NEW_LINE>mInvitingGroup = (Group) findViewById(R.id.group_inviting);<NEW_LINE>mInvitedTag = findViewById(R.id.tv_inviting_tag);<NEW_LINE>mImgContainerLl = (LinearLayout) <MASK><NEW_LINE>mTimeTv = (TextView) findViewById(R.id.tv_time);<NEW_LINE>mSponsorAvatarImg = (RoundCornerImageView) findViewById(R.id.iv_sponsor_avatar);<NEW_LINE>mSponsorUserNameTv = (TextView) findViewById(R.id.tv_sponsor_user_name);<NEW_LINE>mSwitchCameraImg = (ImageView) findViewById(R.id.switch_camera);<NEW_LINE>mOpenCameraLl = (LinearLayout) findViewById(R.id.ll_open_camera);<NEW_LINE>mOpenCameraImg = (ImageView) findViewById(R.id.img_camera);<NEW_LINE>mSponsorUserVideoTag = (TextView) findViewById(R.id.tv_sponsor_video_tag);<NEW_LINE>mViewSwitchAudioCall = findViewById(R.id.ll_switch_audio_call);<NEW_LINE>mTvHangup = (TextView) findViewById(R.id.tv_hangup);<NEW_LINE>mShadeSponsor = findViewById(R.id.shade_sponsor);<NEW_LINE>setImageBackView(findViewById(R.id.img_video_back));<NEW_LINE>} | findViewById(R.id.ll_img_container); |
1,540,745 | protected String doIt() throws Exception {<NEW_LINE>log.info("PA_SLA_Measure_ID=" + p_PA_SLA_Measure_ID);<NEW_LINE>MSLAMeasure measure = new MSLAMeasure(getCtx(), p_PA_SLA_Measure_ID, get_TrxName());<NEW_LINE>if (measure.get_ID() == 0)<NEW_LINE>throw new AdempiereUserError("@PA_SLA_Measure_ID@ " + p_PA_SLA_Measure_ID);<NEW_LINE>MSLAGoal goal = new MSLAGoal(getCtx(), measure.getPA_SLA_Goal_ID(), get_TrxName());<NEW_LINE>if (goal.get_ID() == 0)<NEW_LINE>throw new AdempiereUserError("@PA_SLA_Goal_ID@ " + measure.getPA_SLA_Goal_ID());<NEW_LINE>MSLACriteria criteria = MSLACriteria.get(getCtx(), goal.<MASK><NEW_LINE>if (criteria.get_ID() == 0)<NEW_LINE>throw new AdempiereUserError("@PA_SLA_Criteria_ID@ " + goal.getPA_SLA_Criteria_ID());<NEW_LINE>SLACriteria pgm = criteria.newInstance();<NEW_LINE>//<NEW_LINE>goal.setMeasureActual(pgm.calculateMeasure(goal));<NEW_LINE>goal.setDateLastRun(new Timestamp(System.currentTimeMillis()));<NEW_LINE>goal.saveEx();<NEW_LINE>//<NEW_LINE>return "@MeasureActual@=" + goal.getMeasureActual();<NEW_LINE>} | getPA_SLA_Criteria_ID(), get_TrxName()); |
1,394,893 | protected OAuthData doInBackground(String... params) {<NEW_LINE>try {<NEW_LINE>OAuthData oAuthData = mOAuthHelper.onUserChallenge(params[0], mCredentials);<NEW_LINE>if (oAuthData != null) {<NEW_LINE>Authentication.reddit.authenticate(oAuthData);<NEW_LINE>Authentication.isLoggedIn = true;<NEW_LINE>String refreshToken = Authentication.reddit.getOAuthData().getRefreshToken();<NEW_LINE>SharedPreferences.Editor editor <MASK><NEW_LINE>Set<String> accounts = Authentication.authentication.getStringSet("accounts", new HashSet<String>());<NEW_LINE>LoggedInAccount me = Authentication.reddit.me();<NEW_LINE>accounts.add(me.getFullName() + ":" + refreshToken);<NEW_LINE>Authentication.name = me.getFullName();<NEW_LINE>editor.putStringSet("accounts", accounts);<NEW_LINE>Set<String> tokens = Authentication.authentication.getStringSet("tokens", new HashSet<String>());<NEW_LINE>tokens.add(refreshToken);<NEW_LINE>editor.putStringSet("tokens", tokens);<NEW_LINE>editor.putString("lasttoken", refreshToken);<NEW_LINE>editor.remove("backedCreds");<NEW_LINE>Reddit.appRestart.edit().remove("back").commit();<NEW_LINE>editor.commit();<NEW_LINE>} else {<NEW_LINE>Log.e(LogUtil.getTag(), "Passed in OAuthData was null");<NEW_LINE>}<NEW_LINE>return oAuthData;<NEW_LINE>} catch (IllegalStateException | NetworkException | OAuthException e) {<NEW_LINE>// Handle me gracefully<NEW_LINE>Log.e(LogUtil.getTag(), "OAuth failed");<NEW_LINE>Log.e(LogUtil.getTag(), e.getMessage());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | = Authentication.authentication.edit(); |
1,595,052 | public void sessionPutTimeout(HttpServletRequest request, HttpServletResponse response) throws Throwable {<NEW_LINE>HttpSession session = request.getSession(true);<NEW_LINE>String key = request.getParameter("key");<NEW_LINE>String value = request.getParameter("value");<NEW_LINE>String sessionId = session.getId();<NEW_LINE>// poll for entry to be invalidated from cache<NEW_LINE>// need to use same config file as server.xml<NEW_LINE>System.setProperty("hazelcast.config"<MASK><NEW_LINE>@SuppressWarnings("rawtypes")<NEW_LINE>Cache<String, ArrayList> cache = Caching.getCache("com.ibm.ws.session.meta.default_host%2FsessionCacheApp", String.class, ArrayList.class);<NEW_LINE>for (long start = System.nanoTime(); cache.containsKey(sessionId) && System.nanoTime() - start < TIMEOUT_NS; TimeUnit.MILLISECONDS.sleep(500)) ;<NEW_LINE>session.setAttribute(key, value);<NEW_LINE>String actualValue = (String) session.getAttribute(key);<NEW_LINE>assertEquals(value, actualValue);<NEW_LINE>} | , InitialContext.doLookup("jcache/hazelcast.config")); |
796,365 | public static void main(String[] args) {<NEW_LINE>int[] array1 = { 1, 2, 3, 4, -1, -2, -3 };<NEW_LINE>int[] array2 = { 1, 5, 4, 3, 2, 0 };<NEW_LINE>int[] array3 = { 2, 4, 8, 16, 32, 1 };<NEW_LINE>int[] array4 = { 2, 4, 8, 16, 32 };<NEW_LINE>int[] array5 = { 2, 1 };<NEW_LINE>int[] array6 = { 9 };<NEW_LINE>int indexOfElement1 = bitonicSearch(array1, -1);<NEW_LINE>int indexOfElement2 = bitonicSearch(array2, 5);<NEW_LINE>int <MASK><NEW_LINE>int indexOfElement4 = bitonicSearch(array3, 99);<NEW_LINE>int indexOfElement5 = bitonicSearch(array4, 32);<NEW_LINE>int indexOfElement6 = bitonicSearch(array5, 1);<NEW_LINE>int indexOfElement7 = bitonicSearch(array6, 9);<NEW_LINE>StdOut.println("Index of element: " + indexOfElement1 + " Expected: 4");<NEW_LINE>StdOut.println("Index of element: " + indexOfElement2 + " Expected: 1");<NEW_LINE>StdOut.println("Index of element: " + indexOfElement3 + " Expected: 0");<NEW_LINE>StdOut.println("Index of element: " + indexOfElement4 + " Expected: -1");<NEW_LINE>StdOut.println("Index of element: " + indexOfElement5 + " Expected: 4");<NEW_LINE>StdOut.println("Index of element: " + indexOfElement6 + " Expected: 1");<NEW_LINE>StdOut.println("Index of element: " + indexOfElement7 + " Expected: 0");<NEW_LINE>} | indexOfElement3 = bitonicSearch(array3, 2); |
1,824,547 | protected void copy(List<HadoopResourceId> srcResourceIds, List<HadoopResourceId> destResourceIds) throws IOException {<NEW_LINE>for (int i = 0; i < srcResourceIds.size(); ++i) {<NEW_LINE>// this enforces src and dest file systems to match<NEW_LINE>final org.apache.hadoop.fs.FileSystem fs = srcResourceIds.get(i).toPath().getFileSystem(configuration);<NEW_LINE>// Unfortunately HDFS FileSystems don't support a native copy operation so we are forced<NEW_LINE>// to use the inefficient implementation found in FileUtil which copies all the bytes through<NEW_LINE>// the local machine.<NEW_LINE>//<NEW_LINE>// HDFS FileSystem does define a concat method but could only find the DFSFileSystem<NEW_LINE>// implementing it. The DFSFileSystem implemented concat by deleting the srcs after which<NEW_LINE>// is not what we want. Also, all the other FileSystem implementations I saw threw<NEW_LINE>// UnsupportedOperationException within concat.<NEW_LINE>final boolean success = FileUtil.copy(fs, srcResourceIds.get(i).toPath(), fs, destResourceIds.get(i).toPath(), false, <MASK><NEW_LINE>if (!success) {<NEW_LINE>// Defensive coding as this should not happen in practice<NEW_LINE>throw new IOException(String.format("Unable to copy resource %s to %s. No further information provided by underlying filesystem.", srcResourceIds.get(i).toPath(), destResourceIds.get(i).toPath()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | true, fs.getConf()); |
439,340 | void terminate(Object terminal) {<NEW_LINE>if (state == STATE_SENT_ON_SUBSCRIBE_AND_DONE) {<NEW_LINE>return;<NEW_LINE>} else if (state == STATE_WAITING_FOR_SUBSCRIBE) {<NEW_LINE>state = STATE_SENT_ON_SUBSCRIBE_AND_DONE;<NEW_LINE>try {<NEW_LINE>subscriber.onSubscribe(IGNORE_CANCEL);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (terminal instanceof Throwable) {<NEW_LINE>((Throwable) terminal).addSuppressed(t);<NEW_LINE>} else {<NEW_LINE>LOGGER.warn(<MASK><NEW_LINE>terminal = t;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>state = STATE_SENT_ON_SUBSCRIBE_AND_DONE;<NEW_LINE>}<NEW_LINE>if (terminal instanceof Throwable) {<NEW_LINE>subscriber.onError((Throwable) terminal);<NEW_LINE>} else {<NEW_LINE>subscriber.onSuccess(unwrapNullUnchecked(terminal));<NEW_LINE>}<NEW_LINE>} | "Unexpected exception from onSubscribe from subscriber {}. Discarding result {}.", subscriber, terminal, t); |
25,627 | protected void addAuthorizationsFromIterator(List<String> expressions, CaseDefinitionEntity caseDefinition, String expressionType) {<NEW_LINE>if (expressions != null) {<NEW_LINE>IdentityLinkService identityLinkService = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService();<NEW_LINE>ExpressionManager expressionManager = cmmnEngineConfiguration.getExpressionManager();<NEW_LINE>for (String expressionStr : expressions) {<NEW_LINE>Expression expression = expressionManager.createExpression(expressionStr);<NEW_LINE>Object value = expression.getValue(NoExecutionVariableScope.getSharedInstance());<NEW_LINE>if (value != null) {<NEW_LINE>Collection<String> candidates = CandidateUtil.extractCandidates(value);<NEW_LINE>for (String candidate : candidates) {<NEW_LINE>IdentityLinkEntity identityLink = identityLinkService.createIdentityLink();<NEW_LINE>identityLink.setScopeDefinitionId(caseDefinition.getId());<NEW_LINE>identityLink.setScopeType(ScopeTypes.CMMN);<NEW_LINE>if ("user".equals(expressionType)) {<NEW_LINE>identityLink.setUserId(candidate);<NEW_LINE>} else if ("group".equals(expressionType)) {<NEW_LINE>identityLink.setGroupId(candidate);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>identityLinkService.insertIdentityLink(identityLink);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | identityLink.setType(IdentityLinkType.CANDIDATE); |
1,776,878 | public void serve404(HttpServletRequest servletRequest, HttpServletResponse servletResponse, NotFound e) {<NEW_LINE>Logger.warn("404 -> %s %s (%s)", servletRequest.getMethod(), servletRequest.getRequestURI(), e.getMessage());<NEW_LINE>servletResponse.setStatus(404);<NEW_LINE>servletResponse.setContentType("text/html");<NEW_LINE>Map<String, Object> binding = new HashMap<>();<NEW_LINE>binding.put("result", e);<NEW_LINE>binding.put("session", Scope.Session.current());<NEW_LINE>binding.put("request", Http.Request.current());<NEW_LINE>binding.put("flash", Scope.Flash.current());<NEW_LINE>binding.put("params", Scope.Params.current());<NEW_LINE>binding.put("play", new Play());<NEW_LINE>try {<NEW_LINE>binding.put("errors", Validation.errors());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Logger.error(ex, "Failed to bind errors");<NEW_LINE>}<NEW_LINE>String format = Request.current().format;<NEW_LINE>servletResponse.setStatus(404);<NEW_LINE>// Do we have an ajax request? If we have then we want to display some text even if it is html that is requested<NEW_LINE>if ("XMLHttpRequest".equals(servletRequest.getHeader("X-Requested-With")) && (format == null || format.equals("html"))) {<NEW_LINE>format = "txt";<NEW_LINE>}<NEW_LINE>if (format == null) {<NEW_LINE>format = "txt";<NEW_LINE>}<NEW_LINE>servletResponse.setContentType(MimeTypes.getContentType("404." + format, "text/plain"));<NEW_LINE>String errorHtml = TemplateLoader.load("errors/404." + format).render(binding);<NEW_LINE>try {<NEW_LINE>servletResponse.getOutputStream().write(errorHtml.getBytes(Response<MASK><NEW_LINE>} catch (Exception fex) {<NEW_LINE>Logger.error(fex, "(encoding ?)");<NEW_LINE>}<NEW_LINE>} | .current().encoding)); |
1,425,247 | public JsonResult execute() {<NEW_LINE>String entityType = getNonNullRequestParamValue(Const.ParamsNames.ENTITY_TYPE);<NEW_LINE>if (entityType.equals(Const.EntityType.INSTRUCTOR)) {<NEW_LINE>return handleInstructorReq();<NEW_LINE>}<NEW_LINE>// Default path for student and admin<NEW_LINE>String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID);<NEW_LINE>String feedbackSessionName = <MASK><NEW_LINE>if (feedbackSessionName == null) {<NEW_LINE>// check all sessions in the course<NEW_LINE>List<FeedbackSessionAttributes> feedbackSessions = logic.getFeedbackSessionsForCourse(courseId);<NEW_LINE>StudentAttributes student = logic.getStudentForGoogleId(courseId, userInfo.getId());<NEW_LINE>Map<String, Boolean> sessionsHasResponses = new HashMap<>();<NEW_LINE>for (FeedbackSessionAttributes feedbackSession : feedbackSessions) {<NEW_LINE>if (!feedbackSession.isVisible()) {<NEW_LINE>// Skip invisible sessions.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>boolean hasResponses = logic.isFeedbackSessionAttemptedByStudent(feedbackSession, student.getEmail(), student.getTeam());<NEW_LINE>sessionsHasResponses.put(feedbackSession.getFeedbackSessionName(), hasResponses);<NEW_LINE>}<NEW_LINE>return new JsonResult(new HasResponsesData(sessionsHasResponses));<NEW_LINE>}<NEW_LINE>FeedbackSessionAttributes feedbackSession = getNonNullFeedbackSession(feedbackSessionName, courseId);<NEW_LINE>StudentAttributes student = logic.getStudentForGoogleId(courseId, userInfo.getId());<NEW_LINE>return new JsonResult(new HasResponsesData(logic.isFeedbackSessionAttemptedByStudent(feedbackSession, student.getEmail(), student.getTeam())));<NEW_LINE>} | getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); |
426,173 | public SqlLiteral createLiteral(Object o, SqlParserPos pos) {<NEW_LINE>switch(this) {<NEW_LINE>case BOOLEAN:<NEW_LINE>if (o instanceof Number) {<NEW_LINE>return SqlLiteral.createBoolean(((Number) o).intValue() == 1, pos);<NEW_LINE>}<NEW_LINE>return SqlLiteral.createBoolean((Boolean) o, pos);<NEW_LINE>case FLOAT:<NEW_LINE>case TINYINT:<NEW_LINE>case TINYINT_UNSIGNED:<NEW_LINE>case SMALLINT:<NEW_LINE>case SMALLINT_UNSIGNED:<NEW_LINE>case MEDIUMINT:<NEW_LINE>case MEDIUMINT_UNSIGNED:<NEW_LINE>case INTEGER:<NEW_LINE>case INTEGER_UNSIGNED:<NEW_LINE>case BIGINT:<NEW_LINE>case BIGINT_UNSIGNED:<NEW_LINE>case DECIMAL:<NEW_LINE>return SqlLiteral.createExactNumeric(<MASK><NEW_LINE>case DOUBLE:<NEW_LINE>return SqlLiteral.createApproxNumeric(o.toString(), pos);<NEW_LINE>case VARCHAR:<NEW_LINE>case CHAR:<NEW_LINE>if (o instanceof String) {<NEW_LINE>return SqlLiteral.createCharString((String) o, pos);<NEW_LINE>} else if (o instanceof Slice) {<NEW_LINE>return SqlLiteral.createCharString(((Slice) o).toString(CharsetName.DEFAULT_STORAGE_CHARSET_IN_CHUNK), pos);<NEW_LINE>}<NEW_LINE>case VARBINARY:<NEW_LINE>case BINARY:<NEW_LINE>return SqlLiteral.createBinaryString((byte[]) o, pos);<NEW_LINE>case DATE:<NEW_LINE>return SqlLiteral.createDate(DateString.fromObject(o), pos);<NEW_LINE>case TIME:<NEW_LINE>return SqlLiteral.createTime(TimeString.fromObject(o), 0, pos);<NEW_LINE>case TIMESTAMP:<NEW_LINE>case DATETIME:<NEW_LINE>return SqlLiteral.createTimestamp(TimestampString.fromObject(o), 0, pos);<NEW_LINE>default:<NEW_LINE>throw Util.unexpected(this);<NEW_LINE>}<NEW_LINE>} | o.toString(), pos); |
1,333,686 | private AstNode name(int ttFlagged, int tt) throws IOException {<NEW_LINE>String nameString = ts.getString();<NEW_LINE>int namePos = ts.tokenBeg, nameLineno = ts.lineno;<NEW_LINE>if (0 != (ttFlagged & TI_CHECK_LABEL) && peekToken() == Token.COLON) {<NEW_LINE>// Do not consume colon. It is used as an unwind indicator<NEW_LINE>// to return to statementHelper.<NEW_LINE>Label label = new Label(namePos, ts.tokenEnd - namePos);<NEW_LINE>label.setName(nameString);<NEW_LINE>label.setLineno(ts.lineno);<NEW_LINE>return label;<NEW_LINE>}<NEW_LINE>// Not a label. Unfortunately peeking the next token to check for<NEW_LINE>// a colon has biffed ts.tokenBeg, ts.tokenEnd. We store the name's<NEW_LINE>// bounds in instance vars and createNameNode uses them.<NEW_LINE>saveNameTokenData(namePos, nameString, nameLineno);<NEW_LINE>if (compilerEnv.isXmlAvailable()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return createNameNode(true, Token.NAME);<NEW_LINE>} | return propertyName(-1, 0); |
644,558 | public void renderString(String templateContent, Map<String, Object> model, Writer writer) {<NEW_LINE>// prepare the locale-aware i18n method<NEW_LINE>String language = (String) model.get(PippoConstants.REQUEST_PARAMETER_LANG);<NEW_LINE>if (StringUtils.isNullOrEmpty(language)) {<NEW_LINE>language = getLanguageOrDefault(language);<NEW_LINE>}<NEW_LINE>// prepare the locale-aware prettyTime method<NEW_LINE>Locale locale = (Locale) model.get(PippoConstants.REQUEST_PARAMETER_LOCALE);<NEW_LINE>if (locale == null) {<NEW_LINE>locale = getLocaleOrDefault(language);<NEW_LINE>}<NEW_LINE>model.put("pippo", new PippoHelper(getMessages(), language, locale, getRouter()));<NEW_LINE>try (StringReader reader = new StringReader(templateContent)) {<NEW_LINE>ReaderTemplateLoader stringTemplateLoader = new ReaderTemplateLoader(reader, "StringTemplate");<NEW_LINE>JadeConfiguration stringTemplateConfiguration = new JadeConfiguration();<NEW_LINE>stringTemplateConfiguration.setCaching(false);<NEW_LINE>stringTemplateConfiguration.setTemplateLoader(stringTemplateLoader);<NEW_LINE>stringTemplateConfiguration.setMode(getConfiguration().getMode());<NEW_LINE>stringTemplateConfiguration.setPrettyPrint(getConfiguration().isPrettyPrint());<NEW_LINE>JadeTemplate stringTemplate = getConfiguration().getTemplate("StringTemplate");<NEW_LINE>getConfiguration().<MASK><NEW_LINE>writer.flush();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new PippoRuntimeException(e);<NEW_LINE>}<NEW_LINE>} | renderTemplate(stringTemplate, model, writer); |
345,408 | void diff(final StructrTypeDefinitions other) throws FrameworkException {<NEW_LINE>final Map<String, StructrTypeDefinition> databaseTypes = getMappedTypes();<NEW_LINE>final Map<String, StructrTypeDefinition> structrTypes = other.getMappedTypes();<NEW_LINE>final Set<String> typesOnlyInDatabase = new TreeSet<<MASK><NEW_LINE>final Set<String> typesOnlyInStructrSchema = new TreeSet<>(structrTypes.keySet());<NEW_LINE>final Set<String> bothTypes = new TreeSet<>(databaseTypes.keySet());<NEW_LINE>typesOnlyInDatabase.removeAll(structrTypes.keySet());<NEW_LINE>typesOnlyInStructrSchema.removeAll(databaseTypes.keySet());<NEW_LINE>bothTypes.retainAll(structrTypes.keySet());<NEW_LINE>// types that exist in the only database<NEW_LINE>for (final String key : typesOnlyInDatabase) {<NEW_LINE>final StructrTypeDefinition type = databaseTypes.get(key);<NEW_LINE>if (type.isBuiltinType()) {<NEW_LINE>handleRemovedBuiltInType(type);<NEW_LINE>} else {<NEW_LINE>// type should be ok, probably created by user<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// nothing to do for this set, these types can simply be created without problems<NEW_LINE>// System.out.println(typesOnlyInStructrSchema);<NEW_LINE>// find detailed differences in the intersection of both schemas<NEW_LINE>for (final String name : bothTypes) {<NEW_LINE>final StructrTypeDefinition localType = databaseTypes.get(name);<NEW_LINE>final StructrTypeDefinition otherType = structrTypes.get(name);<NEW_LINE>// compare types<NEW_LINE>localType.diff(otherType);<NEW_LINE>}<NEW_LINE>// the same must be done for global methods and relationships!<NEW_LINE>} | >(databaseTypes.keySet()); |
946,990 | private void actOnQuitEvent(PlayerQuitEvent event) {<NEW_LINE>long time = System.currentTimeMillis();<NEW_LINE><MASK><NEW_LINE>String playerName = player.getName();<NEW_LINE>UUID playerUUID = player.getUniqueId();<NEW_LINE>ServerUUID serverUUID = serverInfo.getServerUUID();<NEW_LINE>BukkitAFKListener.afkTracker.loggedOut(playerUUID, time);<NEW_LINE>joinAddresses.remove(playerUUID);<NEW_LINE>nicknameCache.removeDisplayName(playerUUID);<NEW_LINE>dbSystem.getDatabase().executeTransaction(new BanStatusTransaction(playerUUID, serverUUID, player::isBanned));<NEW_LINE>sessionCache.endSession(playerUUID, time).ifPresent(endedSession -> dbSystem.getDatabase().executeTransaction(new SessionEndTransaction(endedSession)));<NEW_LINE>if (config.isTrue(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) {<NEW_LINE>processing.submitNonCritical(() -> exporter.exportPlayerPage(playerUUID, playerName));<NEW_LINE>}<NEW_LINE>} | Player player = event.getPlayer(); |
1,535,899 | public boolean unremove(ID id) {<NEW_LINE>if (_removed == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final TransactionLegacy txn = TransactionLegacy.currentTxn();<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>try {<NEW_LINE>txn.start();<NEW_LINE>pstmt = txn.prepareAutoCloseStatement(_removeSql.first());<NEW_LINE>final Attribute[] attrs = _removeSql.second();<NEW_LINE>pstmt.setObject(1, null);<NEW_LINE>for (int i = 0; i < attrs.length - 1; i++) {<NEW_LINE>prepareAttribute(i + 2, pstmt, attrs[i], id);<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>txn.commit();<NEW_LINE>if (_cache != null) {<NEW_LINE>_cache.remove(id);<NEW_LINE>}<NEW_LINE>return result > 0;<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>throw new CloudRuntimeException("DB Exception on: " + pstmt, e);<NEW_LINE>}<NEW_LINE>} | int result = pstmt.executeUpdate(); |
991,814 | public final void bounds(int range) {<NEW_LINE>double x0 = cx0;<NEW_LINE>double y0 = cy0;<NEW_LINE>double x1 = cx0 + cx1 + cx2 + cx3;<NEW_LINE>double y1 = cy0 + cy1 + cy2 + cy3;<NEW_LINE>double minx = Math.min(x0, x1);<NEW_LINE>double miny = Math.min(y0, y1);<NEW_LINE>double maxx = Math.max(x0, x1);<NEW_LINE>double maxy = Math.max(y0, y1);<NEW_LINE>if (cx3 != 0) {<NEW_LINE>double t1 = -(Math.sqrt(cx2 * cx2 - 3 * cx1 * cx3) + cx2) / (3 * cx3);<NEW_LINE>double t2 = (Math.sqrt(cx2 * cx2 - 3 * cx1 * cx3) - cx2) / (3 * cx3);<NEW_LINE>if (t1 > 0 && t1 < 1) {<NEW_LINE>double x = evalX(t1);<NEW_LINE>minx = Math.min(x, minx);<NEW_LINE>maxx = Math.max(x, maxx);<NEW_LINE>}<NEW_LINE>if (t2 > 0 && t2 < 1) {<NEW_LINE>double x = evalX(t2);<NEW_LINE>minx = Math.min(x, minx);<NEW_LINE>maxx = Math.max(x, maxx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cy3 != 0) {<NEW_LINE>double t1 = -(Math.sqrt(cy2 * cy2 - 3 * cy1 * cy3) + cy2) / (3 * cy3);<NEW_LINE>double t2 = (Math.sqrt(cy2 * cy2 - 3 * cy1 * cy3) - cy2) / (3 * cy3);<NEW_LINE>if (t1 > 0 && t1 < 1) {<NEW_LINE>double y = evalY(t1);<NEW_LINE>miny = Math.min(y, miny);<NEW_LINE>maxy = Math.max(y, maxy);<NEW_LINE>}<NEW_LINE>if (t2 > 0 && t2 < 1) {<NEW_LINE>double y = evalY(t2);<NEW_LINE>miny = <MASK><NEW_LINE>maxy = Math.max(y, maxy);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addRect((int) minx - range, (int) miny - range, (int) (maxx + range), (int) (maxy + range));<NEW_LINE>} | Math.min(y, miny); |
168,423 | final DeleteTagOptionResult executeDeleteTagOption(DeleteTagOptionRequest deleteTagOptionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteTagOptionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteTagOptionRequest> request = null;<NEW_LINE>Response<DeleteTagOptionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteTagOptionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTagOptionRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTagOption");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteTagOptionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTagOptionResultJsonUnmarshaller());<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()); |
943,452 | public void mapPartition(Iterable<T> values, Collector<Tuple3<Integer, Integer, double[]>> out) throws Exception {<NEW_LINE>if (getRuntimeContext().getNumberOfParallelSubtasks() == 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ComContext context = new ComContext(sessionId, getIterationRuntimeContext());<NEW_LINE>int taskId <MASK><NEW_LINE>int iterNum = getIterationRuntimeContext().getSuperstepNumber();<NEW_LINE>LOG.info("taskId: {}, ReduceSend start", taskId);<NEW_LINE>double[] sendBuf = context.getObj(bufferName);<NEW_LINE>int[] recvcnts = context.getObj(recvcntsName);<NEW_LINE>int totalPieces = 0;<NEW_LINE>for (int recvcnt : recvcnts) {<NEW_LINE>totalPieces += pieces(recvcnt);<NEW_LINE>}<NEW_LINE>double[] transBuf;<NEW_LINE>if (iterNum == 1) {<NEW_LINE>transBuf = new double[TRANSFER_BUFFER_SIZE];<NEW_LINE>context.putObj(transferBufferName, transBuf);<NEW_LINE>} else {<NEW_LINE>transBuf = context.getObj(transferBufferName);<NEW_LINE>}<NEW_LINE>int piecesAgg = 0;<NEW_LINE>int sendOffset = 0;<NEW_LINE>for (int i = 0; i < recvcnts.length; ++i) {<NEW_LINE>int curPieces = pieces(recvcnts[i]);<NEW_LINE>for (int j = 0; j < curPieces; ++j) {<NEW_LINE>if (j == curPieces - 1) {<NEW_LINE>int len = lastLen(recvcnts[i]);<NEW_LINE>System.arraycopy(sendBuf, sendOffset, transBuf, 0, len);<NEW_LINE>sendOffset += len;<NEW_LINE>} else {<NEW_LINE>System.arraycopy(sendBuf, sendOffset, transBuf, 0, TRANSFER_BUFFER_SIZE);<NEW_LINE>sendOffset += TRANSFER_BUFFER_SIZE;<NEW_LINE>}<NEW_LINE>outputBuf.setFields((int) distributedInfo.where(piecesAgg, context.getNumTask(), totalPieces), piecesAgg, transBuf);<NEW_LINE>out.collect(outputBuf);<NEW_LINE>piecesAgg++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.info("taskId: {}, ReduceSend end", taskId);<NEW_LINE>} | = getRuntimeContext().getIndexOfThisSubtask(); |
57,913 | public static DescribeGtmAccessStrategyResponse unmarshall(DescribeGtmAccessStrategyResponse describeGtmAccessStrategyResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeGtmAccessStrategyResponse.setRequestId(_ctx.stringValue("DescribeGtmAccessStrategyResponse.RequestId"));<NEW_LINE>describeGtmAccessStrategyResponse.setStrategyId(_ctx.stringValue("DescribeGtmAccessStrategyResponse.StrategyId"));<NEW_LINE>describeGtmAccessStrategyResponse.setStrategyName(_ctx.stringValue("DescribeGtmAccessStrategyResponse.StrategyName"));<NEW_LINE>describeGtmAccessStrategyResponse.setDefultAddrPoolId(_ctx.stringValue("DescribeGtmAccessStrategyResponse.DefultAddrPoolId"));<NEW_LINE>describeGtmAccessStrategyResponse.setDefaultAddrPoolName(_ctx.stringValue("DescribeGtmAccessStrategyResponse.DefaultAddrPoolName"));<NEW_LINE>describeGtmAccessStrategyResponse.setFailoverAddrPoolId(_ctx.stringValue("DescribeGtmAccessStrategyResponse.FailoverAddrPoolId"));<NEW_LINE>describeGtmAccessStrategyResponse.setFailoverAddrPoolName(_ctx.stringValue("DescribeGtmAccessStrategyResponse.FailoverAddrPoolName"));<NEW_LINE>describeGtmAccessStrategyResponse.setStrategyMode(_ctx.stringValue("DescribeGtmAccessStrategyResponse.StrategyMode"));<NEW_LINE>describeGtmAccessStrategyResponse.setAccessMode(_ctx.stringValue("DescribeGtmAccessStrategyResponse.AccessMode"));<NEW_LINE>describeGtmAccessStrategyResponse.setAccessStatus(_ctx.stringValue("DescribeGtmAccessStrategyResponse.AccessStatus"));<NEW_LINE>describeGtmAccessStrategyResponse.setInstanceId(_ctx.stringValue("DescribeGtmAccessStrategyResponse.InstanceId"));<NEW_LINE>describeGtmAccessStrategyResponse.setDefaultAddrPoolStatus(_ctx.stringValue("DescribeGtmAccessStrategyResponse.DefaultAddrPoolStatus"));<NEW_LINE>describeGtmAccessStrategyResponse.setFailoverAddrPoolStatus(_ctx.stringValue("DescribeGtmAccessStrategyResponse.FailoverAddrPoolStatus"));<NEW_LINE>describeGtmAccessStrategyResponse.setDefaultAddrPoolMonitorStatus(_ctx.stringValue("DescribeGtmAccessStrategyResponse.DefaultAddrPoolMonitorStatus"));<NEW_LINE>describeGtmAccessStrategyResponse.setFailoverAddrPoolMonitorStatus(_ctx.stringValue("DescribeGtmAccessStrategyResponse.FailoverAddrPoolMonitorStatus"));<NEW_LINE>List<Line> lines = new ArrayList<Line>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeGtmAccessStrategyResponse.Lines.Length"); i++) {<NEW_LINE>Line line = new Line();<NEW_LINE>line.setLineCode(_ctx.stringValue("DescribeGtmAccessStrategyResponse.Lines[" + i + "].LineCode"));<NEW_LINE>line.setLineName(_ctx.stringValue("DescribeGtmAccessStrategyResponse.Lines[" + i + "].LineName"));<NEW_LINE>line.setGroupCode(_ctx.stringValue<MASK><NEW_LINE>line.setGroupName(_ctx.stringValue("DescribeGtmAccessStrategyResponse.Lines[" + i + "].GroupName"));<NEW_LINE>lines.add(line);<NEW_LINE>}<NEW_LINE>describeGtmAccessStrategyResponse.setLines(lines);<NEW_LINE>return describeGtmAccessStrategyResponse;<NEW_LINE>} | ("DescribeGtmAccessStrategyResponse.Lines[" + i + "].GroupCode")); |
31,494 | protected void backpropagate(boolean update) {<NEW_LINE>output.computeOutputGradient(target.get(), 1.0);<NEW_LINE><MASK><NEW_LINE>Layer upper = output;<NEW_LINE>for (int i = net.length; --i > 0; ) {<NEW_LINE>upper.backpropagate(net[i].gradient());<NEW_LINE>upper = net[i];<NEW_LINE>upper.backpopagateDropout();<NEW_LINE>clipGradient(upper.gradient());<NEW_LINE>}<NEW_LINE>// first hidden layer<NEW_LINE>upper.backpropagate(null);<NEW_LINE>if (update) {<NEW_LINE>double eta = getLearningRate();<NEW_LINE>if (eta <= 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid learning rate: " + eta);<NEW_LINE>}<NEW_LINE>double alpha = getMomentum();<NEW_LINE>if (alpha < 0.0 || alpha >= 1.0) {<NEW_LINE>throw new IllegalArgumentException("Invalid momentum factor: " + alpha);<NEW_LINE>}<NEW_LINE>double decay = 1.0 - 2 * eta * lambda;<NEW_LINE>if (decay < 0.9) {<NEW_LINE>throw new IllegalStateException(String.format("Invalid learning rate (eta = %.2f) and/or L2 regularization (lambda = %.2f) such that weight decay = %.2f", eta, lambda, decay));<NEW_LINE>}<NEW_LINE>double[] x = net[0].output();<NEW_LINE>for (int i = 1; i < net.length; i++) {<NEW_LINE>Layer layer = net[i];<NEW_LINE>layer.computeGradientUpdate(x, eta, alpha, decay);<NEW_LINE>x = layer.output();<NEW_LINE>}<NEW_LINE>output.computeGradientUpdate(x, eta, alpha, decay);<NEW_LINE>} else {<NEW_LINE>double[] x = net[0].output();<NEW_LINE>for (int i = 1; i < net.length; i++) {<NEW_LINE>Layer layer = net[i];<NEW_LINE>layer.computeGradient(x);<NEW_LINE>x = layer.output();<NEW_LINE>}<NEW_LINE>output.computeGradient(x);<NEW_LINE>}<NEW_LINE>} | clipGradient(output.gradient()); |
1,222,613 | public static void positionCenterWindow(final Window parent, final Window window) {<NEW_LINE>if (parent == null) {<NEW_LINE>positionCenterScreen(window);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>window.pack();<NEW_LINE>//<NEW_LINE>final Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize();<NEW_LINE>// take into account task bar and other adornments<NEW_LINE>final <MASK><NEW_LINE>final Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);<NEW_LINE>sSize.width -= insets.left + insets.right;<NEW_LINE>sSize.height -= insets.top + insets.bottom;<NEW_LINE>final Dimension wSize = window.getSize();<NEW_LINE>// fit on window<NEW_LINE>if (wSize.height > sSize.height) {<NEW_LINE>wSize.height = sSize.height;<NEW_LINE>}<NEW_LINE>if (wSize.width > sSize.width) {<NEW_LINE>wSize.width = sSize.width;<NEW_LINE>}<NEW_LINE>window.setSize(wSize);<NEW_LINE>// center in parent<NEW_LINE>final Rectangle pBounds = parent.getBounds();<NEW_LINE>// Parent is in upper left corner<NEW_LINE>if (pBounds.x == pBounds.y && pBounds.x == 0) {<NEW_LINE>positionCenterScreen(window);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Find middle<NEW_LINE>int x = pBounds.x + (pBounds.width - wSize.width) / 2;<NEW_LINE>if (x < 0) {<NEW_LINE>x = 0;<NEW_LINE>}<NEW_LINE>int y = pBounds.y + (pBounds.height - wSize.height) / 2;<NEW_LINE>if (y < 0) {<NEW_LINE>y = 0;<NEW_LINE>}<NEW_LINE>// Is it on Screen?<NEW_LINE>if (x + wSize.width > sSize.width) {<NEW_LINE>x = sSize.width - wSize.width;<NEW_LINE>}<NEW_LINE>if (y + wSize.height > sSize.height) {<NEW_LINE>y = sSize.height - wSize.height;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// System.out.println("Position: x=" + x + " y=" + y + " w=" + wSize.getWidth() + " h=" + wSize.getHeight()<NEW_LINE>// + " - Parent loc x=" + pLoc.x + " y=" + y + " w=" + pSize.getWidth() + " h=" + pSize.getHeight());<NEW_LINE>window.setLocation(x + insets.left, y + insets.top);<NEW_LINE>} | GraphicsConfiguration config = window.getGraphicsConfiguration(); |
686,983 | private static SSLContext createSSLContext() throws RuntimeException {<NEW_LINE>try {<NEW_LINE>String keyPass <MASK><NEW_LINE>if (keyPass == null) {<NEW_LINE>Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfig(SECRET_CONFIG_NAME);<NEW_LINE>keyPass = (String) secretConfig.get(SecretConstants.SERVER_KEY_PASS);<NEW_LINE>}<NEW_LINE>KeyManager[] keyManagers = buildKeyManagers(loadKeyStore(), keyPass.toCharArray());<NEW_LINE>TrustManager[] trustManagers;<NEW_LINE>if (getServerConfig().isEnableTwoWayTls()) {<NEW_LINE>trustManagers = buildTrustManagers(loadTrustStore());<NEW_LINE>} else {<NEW_LINE>trustManagers = buildTrustManagers(null);<NEW_LINE>}<NEW_LINE>SSLContext sslContext;<NEW_LINE>sslContext = SSLContext.getInstance("TLSv1");<NEW_LINE>sslContext.init(keyManagers, trustManagers, null);<NEW_LINE>return sslContext;<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Unable to create SSLContext", e);<NEW_LINE>throw new RuntimeException("Unable to create SSLContext", e);<NEW_LINE>}<NEW_LINE>} | = getServerConfig().getKeyPass(); |
1,006,069 | // ---- Helper methods ------------------------------------------------------------------------<NEW_LINE>private void initializeParameterInfos() {<NEW_LINE>IVariableBinding[] arguments = fAnalyzer.getArguments();<NEW_LINE>fParameterInfos = new ArrayList<>(arguments.length);<NEW_LINE>ASTNode root = fAnalyzer.getEnclosingBodyDeclaration();<NEW_LINE>ParameterInfo vararg = null;<NEW_LINE>for (int i = 0; i < arguments.length; i++) {<NEW_LINE>IVariableBinding argument = arguments[i];<NEW_LINE>if (argument == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>VariableDeclaration declaration = ASTNodes.findVariableDeclaration(argument, root);<NEW_LINE>boolean isVarargs = declaration instanceof SingleVariableDeclaration ? ((SingleVariableDeclaration) declaration).isVarargs() : false;<NEW_LINE>ParameterInfo info = new ParameterInfo(argument, getType(declaration, isVarargs, false), <MASK><NEW_LINE>if (isVarargs) {<NEW_LINE>vararg = info;<NEW_LINE>} else {<NEW_LINE>fParameterInfos.add(info);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (vararg != null) {<NEW_LINE>fParameterInfos.add(vararg);<NEW_LINE>}<NEW_LINE>} | argument.getName(), i); |
1,798,397 | protected static List<Method> collectValidatorMethods(Class annotationClass, Class... argTypes) {<NEW_LINE>if (argTypes == null) {<NEW_LINE>argTypes = new Class[] {};<NEW_LINE>}<NEW_LINE>List<Method> methods = new ArrayList<>();<NEW_LINE>Set<Method> ms = Platform.getReflections().getMethodsAnnotatedWith(annotationClass);<NEW_LINE>for (Method m : ms) {<NEW_LINE>if (!Modifier.isStatic(m.getModifiers())) {<NEW_LINE>throw new CloudRuntimeException(String.format("@%s %s.%s must be defined as static method", annotationClass, m.getDeclaringClass(), m.getName()));<NEW_LINE>}<NEW_LINE>if (m.getParameterCount() != argTypes.length) {<NEW_LINE>throw new CloudRuntimeException(String.format("wrong argument list of the @%s %s.%s, %s arguments required" + " but the method has %s arguments", annotationClass, m.getDeclaringClass(), m.getName(), argTypes.length, m.getParameterCount()));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < argTypes.length; i++) {<NEW_LINE>Class expectedType = argTypes[i];<NEW_LINE>Class actualType = m.getParameterTypes()[i];<NEW_LINE>if (expectedType != actualType) {<NEW_LINE>throw new CloudRuntimeException(String.format("wrong argument list of the @%s %s.%s. The argument[%s] is expected of type %s" + " but got type %s", annotationClass, m.getDeclaringClass(), m.getName()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>m.setAccessible(true);<NEW_LINE>methods.add(m);<NEW_LINE>}<NEW_LINE>return methods;<NEW_LINE>} | , i, expectedType, actualType)); |
1,434,078 | public MethodAndImports generateMethodAndImports() {<NEW_LINE>Set<FullyQualifiedJavaType> <MASK><NEW_LINE>FullyQualifiedJavaType parameterType = new // $NON-NLS-1$<NEW_LINE>FullyQualifiedJavaType("org.mybatis.dynamic.sql.select.SelectDSLCompleter");<NEW_LINE>imports.add(parameterType);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>imports.add(new FullyQualifiedJavaType("org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils"));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>FullyQualifiedJavaType returnType = new FullyQualifiedJavaType("java.util.Optional");<NEW_LINE>returnType.addTypeArgument(recordType);<NEW_LINE>imports.add(returnType);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Method method = new Method("selectOne");<NEW_LINE>method.setDefault(true);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>method.addParameter(new Parameter(parameterType, "completer"));<NEW_LINE>context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, imports);<NEW_LINE>method.setReturnType(returnType);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>method.// $NON-NLS-1$<NEW_LINE>addBodyLine(// $NON-NLS-1$<NEW_LINE>"return MyBatis3Utils.selectOne(this::selectOne, selectList, " + tableFieldName + ", completer);");<NEW_LINE>return MethodAndImports.withMethod(method).withImports(imports).build();<NEW_LINE>} | imports = new HashSet<>(); |
534,471 | public void doAlarm(List<AlarmMessage> alarmMessage) {<NEW_LINE>alarmMessage.forEach(message -> {<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("Alarm message: {}", message.getAlarmMessage());<NEW_LINE>}<NEW_LINE>AlarmRecord record = new AlarmRecord();<NEW_LINE>record.setScope(message.getScopeId());<NEW_LINE>record.setId0(message.getId0());<NEW_LINE>record.setId1(message.getId1());<NEW_LINE>record.setName(message.getName());<NEW_LINE>record.setAlarmMessage(message.getAlarmMessage());<NEW_LINE>record.setStartTime(message.getStartTime());<NEW_LINE>record.setTimeBucket(TimeBucket.getRecordTimeBucket(message.getStartTime()));<NEW_LINE>record.setRuleName(message.getRuleName());<NEW_LINE>Collection<Tag> tags = <MASK><NEW_LINE>record.setTags(new ArrayList<>(tags));<NEW_LINE>record.setTagsRawData(gson.toJson(message.getTags()).getBytes(Charsets.UTF_8));<NEW_LINE>record.setTagsInString(Tag.Util.toStringList(new ArrayList<>(tags)));<NEW_LINE>RecordStreamProcessor.getInstance().in(record);<NEW_LINE>});<NEW_LINE>} | appendSearchableTags(message.getTags()); |
64,526 | public void propertyChange(PropertyChangeEvent evt) {<NEW_LINE>if (!evt.getOldValue().equals(evt.getNewValue()) && evt.getSource() instanceof InstantOption) {<NEW_LINE>Set<MutablePositionRegion> newChangePoints = ui.optionChanged((<MASK><NEW_LINE>if (newChangePoints != null) {<NEW_LINE>MutablePositionRegion mainRegion = region.getRegion(0);<NEW_LINE>if (!newChangePoints.contains(mainRegion)) {<NEW_LINE>throw new IllegalArgumentException("MainRegion not part of the new change points.");<NEW_LINE>}<NEW_LINE>List<MutablePositionRegion> regions = new ArrayList<>(newChangePoints.size());<NEW_LINE>for (MutablePositionRegion current : newChangePoints) {<NEW_LINE>if (current != mainRegion) {<NEW_LINE>regions.add(current);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>regions.add(0, mainRegion);<NEW_LINE>inSync = true;<NEW_LINE>region.updateRegions(regions);<NEW_LINE>inSync = false;<NEW_LINE>requestRepaint();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | InstantOption) evt.getSource()); |
1,019,938 | public void changeButtonEnablement() {<NEW_LINE>if (tableViewer == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();<NEW_LINE>if (!tableViewer.getTable().isEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (buttonRemove != null) {<NEW_LINE>buttonRemove.setEnabled(!selection.isEmpty());<NEW_LINE>}<NEW_LINE>if (buttonEdit != null) {<NEW_LINE>buttonEdit.setEnabled((selection.size() == 1) || (tableViewer.getTable()<MASK><NEW_LINE>}<NEW_LINE>if (buttonExplore != null) {<NEW_LINE>if (Boolean.getBoolean(TLCErrorView.class.getName() + ".noRestore")) {<NEW_LINE>buttonExplore.setEnabled(tableViewer.getCheckedElements().length > 0);<NEW_LINE>} else {<NEW_LINE>buttonExplore.setEnabled((view.getTrace() != null) && !view.getTrace().isTraceEmpty() && (tableViewer.getCheckedElements().length > 0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getItemCount() == 1)); |
431,091 | final ListBudgetsForResourceResult executeListBudgetsForResource(ListBudgetsForResourceRequest listBudgetsForResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listBudgetsForResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListBudgetsForResourceRequest> request = null;<NEW_LINE>Response<ListBudgetsForResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListBudgetsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listBudgetsForResourceRequest));<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, "Service Catalog");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListBudgetsForResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListBudgetsForResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListBudgetsForResourceResultJsonUnmarshaller());<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); |
604,644 | private PsiElementVisitor createVisitor(final String schemaFileName, final ProblemsHolder holder, final LocalInspectionToolSession session, final PsiFile file) {<NEW_LINE>JsonValue root = file instanceof JsonFile ? ObjectUtils.tryCast(file.getFirstChild(<MASK><NEW_LINE>if (root == null)<NEW_LINE>return PsiElementVisitor.EMPTY_VISITOR;<NEW_LINE>JsonSchemaService service = JsonSchemaService.Impl.get(file.getProject());<NEW_LINE>final URL url = ResourceUtil.getResource(getClass().getClassLoader(), "schemas", schemaFileName);<NEW_LINE>final VirtualFile virtualFile = VfsUtil.findFileByURL(url);<NEW_LINE>final JsonSchemaObject schema = service.getSchemaObjectForSchemaFile(virtualFile);<NEW_LINE>return new JsonElementVisitor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void visitElement(PsiElement element) {<NEW_LINE>if (element == root) {<NEW_LINE>final JsonLikePsiWalker walker = JsonLikePsiWalker.getWalker(element, schema);<NEW_LINE>if (walker == null)<NEW_LINE>return;<NEW_LINE>JsonComplianceCheckerOptions options = new JsonComplianceCheckerOptions(false);<NEW_LINE>new JsonSchemaComplianceChecker(schema, holder, walker, session, options).annotate(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ), JsonValue.class) : null; |
1,114,246 | private void loadNode133() {<NEW_LINE>BaseDataVariableTypeNode node = new BaseDataVariableTypeNode(this.context, Identifiers.SubscriptionDiagnosticsArrayType_SubscriptionDiagnostics_RepublishRequestCount, new QualifiedName(0, "RepublishRequestCount"), new LocalizedText("en", "RepublishRequestCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.UInt32, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.SubscriptionDiagnosticsArrayType_SubscriptionDiagnostics_RepublishRequestCount, Identifiers.HasTypeDefinition, Identifiers.BaseDataVariableType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.SubscriptionDiagnosticsArrayType_SubscriptionDiagnostics_RepublishRequestCount, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.SubscriptionDiagnosticsArrayType_SubscriptionDiagnostics_RepublishRequestCount, Identifiers.HasComponent, Identifiers.SubscriptionDiagnosticsArrayType_SubscriptionDiagnostics.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
645,453 | private ThriftRuleKeyHasher putMap(int length) {<NEW_LINE>Map<String, Value> thriftContainer = new HashMap<>(length);<NEW_LINE>// Length for maps is the number of keys + number of values, unlike<NEW_LINE>// tuple or list<NEW_LINE>for (int i = 0; i < length; i += 2) {<NEW_LINE>// Normally key value pairs are pushed on the stack in the order<NEW_LINE>// VALUE, KEY. Maps seem to push in the order KEY, VALUE, so pop<NEW_LINE>// the value first, then determine the key type and get the key.s<NEW_LINE>Value value = pop();<NEW_LINE>Value key = pop();<NEW_LINE>if (key.getSetField() == STRING_VALUE) {<NEW_LINE>thriftContainer.put(key.getStringValue(), value);<NEW_LINE>} else if (key.getSetField() == Value._Fields.KEY) {<NEW_LINE>thriftContainer.put(key.getKey().key, value);<NEW_LINE>} else if (key.getSetField() == Value._Fields.TARGET_PATH) {<NEW_LINE>thriftContainer.put(key.getTargetPath().path, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return push<MASK><NEW_LINE>} | (Value.containerMap(thriftContainer)); |
511,197 | public Font derive(float sizePixels, int weight) {<NEW_LINE>if (fontUniqueId != null) {<NEW_LINE>// derive should recycle instances of Font to allow smarter caching and logic on the native side of the fence<NEW_LINE>String key = fontUniqueId + "_" + sizePixels + "_" + weight;<NEW_LINE>Font <MASK><NEW_LINE>if (f != null) {<NEW_LINE>return f;<NEW_LINE>}<NEW_LINE>f = new Font(Display.impl.deriveTrueTypeFont(font, sizePixels, weight));<NEW_LINE>f.pixelSize = sizePixels;<NEW_LINE>f.fontUniqueId = fontUniqueId;<NEW_LINE>f.ttf = true;<NEW_LINE>derivedFontCache.put(key, f);<NEW_LINE>return f;<NEW_LINE>} else {<NEW_LINE>// not sure if this ever happens but don't want to break that code<NEW_LINE>if (font != null) {<NEW_LINE>Font f = new Font(Display.impl.deriveTrueTypeFont(font, sizePixels, weight));<NEW_LINE>f.pixelSize = sizePixels;<NEW_LINE>f.ttf = true;<NEW_LINE>return f;<NEW_LINE>} else {<NEW_LINE>if (!ttf) {<NEW_LINE>throw new IllegalArgumentException("Cannot derive font " + this + " because it is not a truetype font");<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Cannot derive font " + this + " because its native font representation is null.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | f = derivedFontCache.get(key); |
281,912 | StoreScan createStoreScan(PageCacheTracer cacheTracer) {<NEW_LINE>int[] entityTokenIds = entityTokenIds();<NEW_LINE>int[] propertyKeyIds = propertyKeyIds();<NEW_LINE>IntPredicate propertyKeyIdFilter = propertyKeyId -> contains(propertyKeyIds, propertyKeyId);<NEW_LINE>if (type == EntityType.RELATIONSHIP) {<NEW_LINE>StoreScan innerStoreScan = storeView.visitRelationships(entityTokenIds, propertyKeyIdFilter, createPropertyScanConsumer(), createTokenScanConsumer(), false, true, cacheTracer, memoryTracker);<NEW_LINE>storeScan = new LoggingStoreScan(innerStoreScan, false);<NEW_LINE>} else {<NEW_LINE>StoreScan innerStoreScan = storeView.visitNodes(entityTokenIds, propertyKeyIdFilter, createPropertyScanConsumer(), createTokenScanConsumer(), false, true, cacheTracer, memoryTracker);<NEW_LINE>storeScan <MASK><NEW_LINE>}<NEW_LINE>storeScan.setPhaseTracker(phaseTracker);<NEW_LINE>return storeScan;<NEW_LINE>} | = new LoggingStoreScan(innerStoreScan, true); |
1,790,913 | synchronized void onRetry(@NonNull Job job, long backoffInterval) {<NEW_LINE>if (backoffInterval <= 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid backoff interval! " + backoffInterval);<NEW_LINE>}<NEW_LINE>int nextRunAttempt = job.getRunAttempt() + 1;<NEW_LINE>long nextRunAttemptTime = System.currentTimeMillis() + backoffInterval;<NEW_LINE>String serializedData = dataSerializer.serialize(job.serialize());<NEW_LINE>jobStorage.updateJobAfterRetry(job.getId(), false, nextRunAttempt, nextRunAttemptTime, serializedData);<NEW_LINE>jobTracker.onStateChange(job, JobTracker.JobState.PENDING);<NEW_LINE>List<Constraint> constraints = Stream.of(jobStorage.getConstraintSpecs(job.getId())).map(ConstraintSpec::getFactoryKey).map(<MASK><NEW_LINE>long delay = Math.max(0, nextRunAttemptTime - System.currentTimeMillis());<NEW_LINE>Log.i(TAG, JobLogger.format(job, "Scheduling a retry in " + delay + " ms."));<NEW_LINE>scheduler.schedule(delay, constraints);<NEW_LINE>notifyAll();<NEW_LINE>} | constraintInstantiator::instantiate).toList(); |
736,692 | public void checkQueuedCalls(long incomingCallChatId) {<NEW_LINE>logDebug("Check several calls");<NEW_LINE>MegaHandleList handleList = megaChatApi.getChatCalls();<NEW_LINE>if (handleList == null || handleList.size() <= 1)<NEW_LINE>return;<NEW_LINE>ArrayList<Long> callsInProgress = getCallsParticipating();<NEW_LINE>if (callsInProgress == null || callsInProgress.isEmpty()) {<NEW_LINE>logWarning("No calls in progress");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>logDebug("Number of calls in progress: " + callsInProgress.size());<NEW_LINE>MegaChatCall callInProgress = null;<NEW_LINE>for (int i = 0; i < callsInProgress.size(); i++) {<NEW_LINE>MegaChatCall call = megaChatApi.getChatCall(callsInProgress.get(i));<NEW_LINE>if (call != null && !call.isOnHold()) {<NEW_LINE>callInProgress = call;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (callInProgress == null) {<NEW_LINE>MegaChatCall call = megaChatApi.getChatCall(callsInProgress.get(0));<NEW_LINE>if (call != null && !call.isOnHold()) {<NEW_LINE>callInProgress = call;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>MegaChatCall <MASK><NEW_LINE>if (callInProgress != null && incomingCall != null && incomingCall.isRinging() && !incomingCall.isIgnored()) {<NEW_LINE>MegaApplication.getChatManagement().addNotificationShown(incomingCall.getChatid());<NEW_LINE>showIncomingCallNotification(incomingCall, callInProgress);<NEW_LINE>}<NEW_LINE>} | incomingCall = megaChatApi.getChatCall(incomingCallChatId); |
1,543,529 | private void addHostNameAndIpMapping(HostAddress dnsNameAddress, HostAddress ipAddress, Long time, Content source, final CaseDbConnection connection) throws SQLException, TskCoreException {<NEW_LINE>if (dnsNameAddress.getAddressType() != HostAddress.HostAddressType.HOSTNAME) {<NEW_LINE>throw new TskCoreException("IllegalArguments passed to addHostNameAndIpMapping: A host name address is expected.");<NEW_LINE>}<NEW_LINE>if ((ipAddress.getAddressType() != HostAddress.HostAddressType.IPV4) && (ipAddress.getAddressType() != HostAddress.HostAddressType.IPV6)) {<NEW_LINE>throw new TskCoreException("IllegalArguments passed to addHostNameAndIpMapping:An IPv4/IPv6 address is expected.");<NEW_LINE>}<NEW_LINE>if (Objects.isNull(connection)) {<NEW_LINE>throw new TskCoreException("IllegalArguments passed to addHostNameAndIpMapping: null connection passed to addHostNameAndIpMapping");<NEW_LINE>}<NEW_LINE>String insertSQL = db.getInsertOrIgnoreSQL(" INTO tsk_host_address_dns_ip_map(dns_address_id, ip_address_id, source_obj_id, time) " + " VALUES(?, ?, ?, ?) ");<NEW_LINE>PreparedStatement preparedStatement = connection.getPreparedStatement(insertSQL, Statement.NO_GENERATED_KEYS);<NEW_LINE>preparedStatement.clearParameters();<NEW_LINE>preparedStatement.setLong(<MASK><NEW_LINE>preparedStatement.setLong(2, ipAddress.getId());<NEW_LINE>preparedStatement.setLong(3, source.getId());<NEW_LINE>if (time != null) {<NEW_LINE>preparedStatement.setLong(4, time);<NEW_LINE>} else {<NEW_LINE>preparedStatement.setNull(4, java.sql.Types.BIGINT);<NEW_LINE>}<NEW_LINE>connection.executeUpdate(preparedStatement);<NEW_LINE>recentHostNameAndIpMappingCache.put(ipAddress.getId(), new Byte((byte) 1));<NEW_LINE>recentHostNameAndIpMappingCache.put(dnsNameAddress.getId(), new Byte((byte) 1));<NEW_LINE>} | 1, dnsNameAddress.getId()); |
1,141,438 | public static CodegenMethod codegen(ExprEqualsNodeForgeCoercion forge, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope, ExprNode lhs, ExprNode rhs) {<NEW_LINE><MASK><NEW_LINE>EPTypeClass rhsType = forge.getRhsTypeClass();<NEW_LINE>CodegenMethod methodNode = codegenMethodScope.makeChild(EPTypePremade.BOOLEANBOXED.getEPType(), ExprEqualsNodeForgeCoercionEval.class, codegenClassScope);<NEW_LINE>CodegenBlock block = methodNode.getBlock().declareVar(lhsType, "l", lhs.getForge().evaluateCodegen(lhsType, methodNode, exprSymbol, codegenClassScope)).declareVar(rhsType, "r", rhs.getForge().evaluateCodegen(rhsType, methodNode, exprSymbol, codegenClassScope));<NEW_LINE>if (!forge.getForgeRenderable().isIs()) {<NEW_LINE>if (!lhsType.getType().isPrimitive()) {<NEW_LINE>block.ifRefNullReturnNull("l");<NEW_LINE>}<NEW_LINE>if (!rhsType.getType().isPrimitive()) {<NEW_LINE>block.ifRefNullReturnNull("r");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!lhsType.getType().isPrimitive() && !rhsType.getType().isPrimitive()) {<NEW_LINE>block.ifRefNull("l").blockReturn(equalsNull(ref("r")));<NEW_LINE>}<NEW_LINE>if (!rhsType.getType().isPrimitive()) {<NEW_LINE>block.ifRefNull("r").blockReturn(constantFalse());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>block.declareVar(EPTypePremade.NUMBER.getEPType(), "left", forge.getNumberCoercerLHS().coerceCodegen(ref("l"), lhsType));<NEW_LINE>block.declareVar(EPTypePremade.NUMBER.getEPType(), "right", forge.getNumberCoercerRHS().coerceCodegen(ref("r"), rhsType));<NEW_LINE>CodegenExpression compare = exprDotMethod(ref("left"), "equals", ref("right"));<NEW_LINE>if (!forge.getForgeRenderable().isNotEquals()) {<NEW_LINE>block.methodReturn(compare);<NEW_LINE>} else {<NEW_LINE>block.methodReturn(not(compare));<NEW_LINE>}<NEW_LINE>return methodNode;<NEW_LINE>} | EPTypeClass lhsType = forge.getLhsTypeClass(); |
897,174 | @ApiOperation(position = 4, value = "Updates an existing catalog", notes = "Returns success if there were no errors updating the catalog")<NEW_LINE>@ApiResponses({ @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Catalog successfully updated"), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "No catalogs are registered with the server") })<NEW_LINE>public void updateCatalog(@ApiParam(value = "The name of the catalog", required = true) @PathVariable("catalog-name") final String catalogName, @ApiParam(value = "The metadata to update in the catalog", required = true) @RequestBody final CreateCatalogDto createCatalogDto) {<NEW_LINE>final QualifiedName name = this.requestWrapper.qualifyName(() -> QualifiedName.ofCatalog(catalogName));<NEW_LINE>this.requestWrapper.processRequest(name, "updateCatalog", () -> {<NEW_LINE>createCatalogDto.setName(name);<NEW_LINE>this.<MASK><NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} | catalogService.update(name, createCatalogDto); |
1,560,863 | @ExceptionMetered<NEW_LINE>@ApiOperation(value = "Create a deploy", notes = "Creates a deploy given an environment name, stage name, build id and description", response = Response.class)<NEW_LINE>public Response create(@Context SecurityContext sc, @ApiParam(value = "Environment name", required = true) @PathParam("envName") String envName, @ApiParam(value = "Stage name", required = true) @PathParam("stageName") String stageName, @ApiParam(value = "Build id", required = true) @NotEmpty @QueryParam("buildId") String buildId, @ApiParam(value = "Description", required = true) @QueryParam("description") String description) throws Exception {<NEW_LINE>EnvironBean envBean = Utils.<MASK><NEW_LINE>authorizer.authorize(sc, new Resource(envBean.getEnv_name(), Resource.Type.ENV), Role.OPERATOR);<NEW_LINE>String operator = sc.getUserPrincipal().getName();<NEW_LINE>String deployId = deployHandler.deploy(envBean, buildId, description, operator);<NEW_LINE>LOG.info("Successfully create deploy {} for env {}/{} by {}.", deployId, envName, stageName, operator);<NEW_LINE>UriBuilder ub = uriInfo.getAbsolutePathBuilder();<NEW_LINE>URI deployUri = ub.path("current").build();<NEW_LINE>DeployBean deployBean = deployDAO.getById(deployId);<NEW_LINE>return Response.created(deployUri).entity(deployBean).build();<NEW_LINE>} | getEnvStage(environDAO, envName, stageName); |
1,466,002 | private void createCreateReflectorMethod2(String newClassPrefix, CtClass reflectorFactoryImpl) throws NotFoundException, CannotCompileException {<NEW_LINE>CtClass[<MASK><NEW_LINE>parameters[0] = pool.get(Class.class.getName());<NEW_LINE>parameters[1] = pool.get(PublicInterface.class.getName());<NEW_LINE>CtMethod method = new CtMethod(pool.get(Reflector.class.getName()), "createReflector", parameters, reflectorFactoryImpl);<NEW_LINE>StringBuilder methodBuilder = new StringBuilder();<NEW_LINE>methodBuilder.append("{");<NEW_LINE>methodBuilder.append("if (1==0) {");<NEW_LINE>for (String name : servicesMap.keySetName()) {<NEW_LINE>SService sService = servicesMap.getByName(name);<NEW_LINE>methodBuilder.append("} else if ($1.getSimpleName().equals(\"" + sService.getSimpleName() + "\")) {");<NEW_LINE>methodBuilder.append("return new " + GENERATED_CLASSES_PACKAGE + "." + sService.getSimpleName() + "Reflector" + newClassPrefix + "((" + sService.getInterfaceClass().getName() + ")$2);");<NEW_LINE>}<NEW_LINE>methodBuilder.append("}");<NEW_LINE>methodBuilder.append("return null;");<NEW_LINE>methodBuilder.append("}");<NEW_LINE>method.setBody(methodBuilder.toString());<NEW_LINE>reflectorFactoryImpl.addMethod(method);<NEW_LINE>} | ] parameters = new CtClass[2]; |
1,427,481 | public static GetVehicleRepairPlanResponse unmarshall(GetVehicleRepairPlanResponse getVehicleRepairPlanResponse, UnmarshallerContext _ctx) {<NEW_LINE>getVehicleRepairPlanResponse.setRequestId(_ctx.stringValue("GetVehicleRepairPlanResponse.RequestId"));<NEW_LINE>getVehicleRepairPlanResponse.setHttpCode(_ctx.integerValue("GetVehicleRepairPlanResponse.HttpCode"));<NEW_LINE>getVehicleRepairPlanResponse.setErrorMessage(_ctx.stringValue("GetVehicleRepairPlanResponse.ErrorMessage"));<NEW_LINE>getVehicleRepairPlanResponse.setCode(_ctx.stringValue("GetVehicleRepairPlanResponse.Code"));<NEW_LINE>getVehicleRepairPlanResponse.setSuccess(_ctx.booleanValue("GetVehicleRepairPlanResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setFrameNo(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.FrameNo"));<NEW_LINE>List<RepairItems> repairParts = new ArrayList<RepairItems>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetVehicleRepairPlanResponse.Data.RepairParts.Length"); i++) {<NEW_LINE>RepairItems repairItems = new RepairItems();<NEW_LINE>repairItems.setRelationType(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].RelationType"));<NEW_LINE>repairItems.setPartsStdCode(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].PartsStdCode"));<NEW_LINE>repairItems.setPartNameMatch(_ctx.booleanValue<MASK><NEW_LINE>repairItems.setRepairFee(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].RepairFee"));<NEW_LINE>repairItems.setOutStandardPartsName(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].OutStandardPartsName"));<NEW_LINE>repairItems.setPartsStdName(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].PartsStdName"));<NEW_LINE>repairItems.setRepairTypeName(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].RepairTypeName"));<NEW_LINE>repairItems.setRepairType(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].RepairType"));<NEW_LINE>repairItems.setOeMatch(_ctx.booleanValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].OeMatch"));<NEW_LINE>repairItems.setOutStandardPartsId(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].OutStandardPartsId"));<NEW_LINE>repairItems.setGarageType(_ctx.stringValue("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].GarageType"));<NEW_LINE>repairParts.add(repairItems);<NEW_LINE>}<NEW_LINE>data.setRepairParts(repairParts);<NEW_LINE>getVehicleRepairPlanResponse.setData(data);<NEW_LINE>return getVehicleRepairPlanResponse;<NEW_LINE>} | ("GetVehicleRepairPlanResponse.Data.RepairParts[" + i + "].PartNameMatch")); |
320,186 | private List<QuestionConcept> retrieveArtificialConcepts(Request request) {<NEW_LINE>List<QuestionConcept> <MASK><NEW_LINE>String numberOfArtificialConceptsS = request.queryParams("numberOfConcepts");<NEW_LINE>if (numberOfArtificialConceptsS == null)<NEW_LINE>return artificialConcepts;<NEW_LINE>int numberOfArtificialConcepts = Integer.parseInt(numberOfArtificialConceptsS);<NEW_LINE>for (int i = 1; i <= numberOfArtificialConcepts; i++) {<NEW_LINE>String fullLabel = request.queryParams("fullLabel" + i);<NEW_LINE>if (fullLabel == null || fullLabel.equals(""))<NEW_LINE>continue;<NEW_LINE>String pageIDS = request.queryParams("pageID" + i);<NEW_LINE>if (pageIDS == null || pageIDS.equals(""))<NEW_LINE>continue;<NEW_LINE>int pageID = Integer.parseInt(pageIDS);<NEW_LINE>artificialConcepts.add(new QuestionConcept(fullLabel, pageID));<NEW_LINE>}<NEW_LINE>return artificialConcepts;<NEW_LINE>} | artificialConcepts = new ArrayList<>(); |
798,696 | private void applyJavaConvention(Project project) {<NEW_LINE>JavaPluginExtension java = project.getExtensions(<MASK><NEW_LINE>java.setSourceCompatibility(JavaVersion.VERSION_1_8);<NEW_LINE>java.setTargetCompatibility(JavaVersion.VERSION_1_8);<NEW_LINE>project.getTasks().withType(JavaCompile.class).forEach(compileTask -> {<NEW_LINE>compileTask.getOptions().setEncoding("UTF-8");<NEW_LINE>compileTask.getOptions().setCompilerArgs(// intentionally disabled<NEW_LINE>Arrays.// intentionally disabled<NEW_LINE>asList(// intentionally disabled<NEW_LINE>"-Xlint:-varargs", // intentionally disabled<NEW_LINE>"-Xlint:cast", // intentionally disabled<NEW_LINE>"-Xlint:classfile", // intentionally disabled<NEW_LINE>"-Xlint:dep-ann", // intentionally disabled<NEW_LINE>"-Xlint:divzero", // intentionally disabled<NEW_LINE>"-Xlint:empty", // intentionally disabled<NEW_LINE>"-Xlint:finally", // intentionally disabled<NEW_LINE>"-Xlint:overrides", // intentionally disabled<NEW_LINE>"-Xlint:path", // intentionally disabled<NEW_LINE>"-Xlint:-processing", // intentionally disabled<NEW_LINE>"-Xlint:static", // intentionally disabled<NEW_LINE>"-Xlint:try", // intentionally disabled<NEW_LINE>"-Xlint:deprecation", // intentionally disabled<NEW_LINE>"-Xlint:unchecked", // intentionally disabled<NEW_LINE>"-Xlint:-serial", // intentionally disabled<NEW_LINE>"-Xlint:-options", "-Xlint:-fallthrough", "-Xmaxerrs", "500", "-Xmaxwarns", "1000"));<NEW_LINE>});<NEW_LINE>if (JavaVersion.current().isJava8Compatible()) {<NEW_LINE>project.getTasks().withType(JavaCompile.class, t -> {<NEW_LINE>if (t.getName().endsWith("TestJava")) {<NEW_LINE>List<String> args = new ArrayList<>(t.getOptions().getCompilerArgs());<NEW_LINE>args.add("-parameters");<NEW_LINE>t.getOptions().setCompilerArgs(args);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | ).getByType(JavaPluginExtension.class); |
884,445 | public static DescribeModelServiceResponse unmarshall(DescribeModelServiceResponse describeModelServiceResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeModelServiceResponse.setRequestId(_ctx.stringValue("DescribeModelServiceResponse.RequestId"));<NEW_LINE>describeModelServiceResponse.setCode(_ctx.stringValue("DescribeModelServiceResponse.Code"));<NEW_LINE>describeModelServiceResponse.setMessage(_ctx.stringValue("DescribeModelServiceResponse.Message"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setModelServiceInstanceId(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelServiceInstanceId"));<NEW_LINE>data.setModelServiceStatus(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelServiceStatus"));<NEW_LINE>data.setModelServiceInstanceName(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelServiceInstanceName"));<NEW_LINE>data.setAlgorithmCode(_ctx.stringValue("DescribeModelServiceResponse.Data.AlgorithmCode"));<NEW_LINE>data.setQps(_ctx.longValue("DescribeModelServiceResponse.Data.Qps"));<NEW_LINE>data.setCreateTime(_ctx.stringValue("DescribeModelServiceResponse.Data.CreateTime"));<NEW_LINE>data.setAppCode(_ctx.stringValue("DescribeModelServiceResponse.Data.AppCode"));<NEW_LINE>List<ModelApi> modelApiList <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeModelServiceResponse.Data.ModelApiList.Length"); i++) {<NEW_LINE>ModelApi modelApi = new ModelApi();<NEW_LINE>modelApi.setAlgorithmApiCode(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelApiList[" + i + "].AlgorithmApiCode"));<NEW_LINE>modelApi.setApiId(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelApiList[" + i + "].ApiId"));<NEW_LINE>modelApi.setApiName(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelApiList[" + i + "].ApiName"));<NEW_LINE>modelApi.setApiPath(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelApiList[" + i + "].ApiPath"));<NEW_LINE>modelApi.setCreateTime(_ctx.stringValue("DescribeModelServiceResponse.Data.ModelApiList[" + i + "].CreateTime"));<NEW_LINE>modelApiList.add(modelApi);<NEW_LINE>}<NEW_LINE>data.setModelApiList(modelApiList);<NEW_LINE>describeModelServiceResponse.setData(data);<NEW_LINE>return describeModelServiceResponse;<NEW_LINE>} | = new ArrayList<ModelApi>(); |
1,541,792 | public short[] convert(ByteBuffer buffer) {<NEW_LINE>long dcAccumulator = 0;<NEW_LINE>short sample;<NEW_LINE>short[] samples;<NEW_LINE>byte b1, b2;<NEW_LINE>samples = new short[buffer.capacity() / 2];<NEW_LINE>int bytesOffset;<NEW_LINE>int rawPointer = 0;<NEW_LINE>ShortVector vector;<NEW_LINE>int samplesOffset = 0;<NEW_LINE>short[] bytes1 = new short[VECTOR_SPECIES.length()];<NEW_LINE>short[] bytes2 = new short[VECTOR_SPECIES.length()];<NEW_LINE>for (; samplesOffset < VECTOR_SPECIES.loopBound(samples.length); samplesOffset += VECTOR_SPECIES.length()) {<NEW_LINE>bytesOffset = 0;<NEW_LINE>while (bytesOffset < VECTOR_SPECIES.length()) {<NEW_LINE>bytes1[bytesOffset] = (short) (buffer.get(rawPointer++) & 0xFF);<NEW_LINE>bytes2[bytesOffset++] = (short) (buffer.get(rawPointer++) & 0x0F);<NEW_LINE>}<NEW_LINE>vector = ShortVector.fromArray(VECTOR_SPECIES, bytes1, 0).or(ShortVector.fromArray(VECTOR_SPECIES, bytes2, 0).lanewise(VectorOperators.LSHL, 8));<NEW_LINE>dcAccumulator += <MASK><NEW_LINE>vector.intoArray(samples, samplesOffset);<NEW_LINE>}<NEW_LINE>for (; samplesOffset < samples.length; samplesOffset++) {<NEW_LINE>b1 = buffer.get(rawPointer++);<NEW_LINE>b2 = buffer.get(rawPointer++);<NEW_LINE>sample = (short) (((b2 & 0x0F) << 8) | (b1 & 0xFF));<NEW_LINE>samples[samplesOffset] = sample;<NEW_LINE>dcAccumulator += sample;<NEW_LINE>}<NEW_LINE>// Calculate the average scaled DC offset so that it can be applied in the native buffer's converted samples<NEW_LINE>float averageDcNow = ((float) dcAccumulator / (float) samples.length) - 2048.0f;<NEW_LINE>averageDcNow *= AirspyBufferIterator.SCALE_SIGNED_12_BIT_TO_FLOAT;<NEW_LINE>averageDcNow -= mAverageDc;<NEW_LINE>mAverageDc += (averageDcNow * DC_FILTER_GAIN);<NEW_LINE>return samples;<NEW_LINE>} | vector.reduceLanes(VectorOperators.ADD); |
845,616 | final GetGroupResult executeGetGroup(GetGroupRequest getGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetGroupRequest> request = null;<NEW_LINE>Response<GetGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetGroupRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Greengrass");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetGroupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(getGroupRequest)); |
615,757 | public static List<PluginDescription> sortCandidates(List<PluginDescription> candidates) {<NEW_LINE>List<PluginDescription> sortedCandidates = new ArrayList<>(candidates);<NEW_LINE>sortedCandidates.sort(Comparator.comparing(PluginDescription::getId));<NEW_LINE>// Create a graph and populate it with plugin dependencies. Specifically, each graph has plugin<NEW_LINE>// nodes, and edges that represent the dependencies that plugin relies on. Non-existent plugins<NEW_LINE>// are ignored.<NEW_LINE>MutableGraph<PluginDescription> graph = GraphBuilder.directed().allowsSelfLoops(false).expectedNodeCount(sortedCandidates.size()).build();<NEW_LINE>Map<String, PluginDescription> candidateMap = Maps.uniqueIndex(sortedCandidates, PluginDescription::getId);<NEW_LINE>for (PluginDescription description : sortedCandidates) {<NEW_LINE>graph.addNode(description);<NEW_LINE>for (PluginDependency dependency : description.getDependencies()) {<NEW_LINE>PluginDescription in = candidateMap.get(dependency.getId());<NEW_LINE>if (in != null) {<NEW_LINE>graph.putEdge(description, in);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Now we do the depth-first search. The most accessible description of the algorithm is on<NEW_LINE>// Wikipedia: https://en.wikipedia.org/w/index.php?title=Topological_sorting&oldid=1036420482,<NEW_LINE>// section "Depth-first search." Apparently this algorithm originates from "Introduction to<NEW_LINE>// Algorithms" (2nd ed.)<NEW_LINE>List<PluginDescription> sorted = new ArrayList<>();<NEW_LINE>Map<PluginDescription, Mark> marks = new HashMap<>();<NEW_LINE>for (PluginDescription node : graph.nodes()) {<NEW_LINE>visitNode(graph, node, marks, sorted<MASK><NEW_LINE>}<NEW_LINE>return sorted;<NEW_LINE>} | , new ArrayDeque<>()); |
109,518 | private void updateMetrics() throws AutoIngestMetricsDialogException {<NEW_LINE>if (datePicker.getDate() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (autoIngestMetricsCollector == null) {<NEW_LINE>try {<NEW_LINE>autoIngestMetricsCollector = new AutoIngestMetricsCollector();<NEW_LINE>} catch (AutoIngestMetricsCollector.AutoIngestMetricsCollectorException ex) {<NEW_LINE>throw new AutoIngestMetricsDialogException("Error initializing the auto ingest metrics collector.", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AutoIngestMetricsCollector.<MASK><NEW_LINE>List<JobMetric> completedJobMetrics = metricsSnapshot.getCompletedJobMetrics();<NEW_LINE>int jobsCompleted = 0;<NEW_LINE>long dataSourceSizeTotal = 0;<NEW_LINE>long pickedDate = datePicker.getDate().atStartOfDay().toEpochSecond(ZoneOffset.UTC) * 1000;<NEW_LINE>for (JobMetric jobMetric : completedJobMetrics) {<NEW_LINE>if (jobMetric.getCompletedDate() >= pickedDate) {<NEW_LINE>jobsCompleted++;<NEW_LINE>dataSourceSizeTotal += jobMetric.getDataSourceSize();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SimpleDateFormat dateFormatter = new SimpleDateFormat("MMM d, yyyy");<NEW_LINE>reportTextArea.setText(String.format("Since %s:\n" + "Number of Jobs Completed: %d\n" + "Total Size of Data Sources: %.1f GB\n", dateFormatter.format(Date.valueOf(datePicker.getDate())), jobsCompleted, (double) dataSourceSizeTotal / GIGABYTE_SIZE));<NEW_LINE>} | MetricsSnapshot metricsSnapshot = autoIngestMetricsCollector.queryCoordinationServiceForMetrics(); |
1,812,034 | public Object call(ExecutionContext context, Object self, Object... args) {<NEW_LINE>// 15.4.4.8<NEW_LINE>JSObject o = Types.toObject(context, self);<NEW_LINE>long len = Types.toUint32(context, o.get(context, "length"));<NEW_LINE>long middle = (long) Math.floor(len / 2);<NEW_LINE>long lower = 0;<NEW_LINE>while (lower != middle) {<NEW_LINE>long upper = len - lower - 1;<NEW_LINE>Object lowerValue = o.get(context, "" + lower);<NEW_LINE>Object upperValue = o.get(context, "" + upper);<NEW_LINE>boolean lowerExists = o.hasProperty(context, "" + lower);<NEW_LINE>boolean upperExists = o.hasProperty(context, "" + upper);<NEW_LINE>if (lowerExists && upperExists) {<NEW_LINE>o.put(context, "" + lower, upperValue, true);<NEW_LINE>o.put(context, "" + upper, lowerValue, true);<NEW_LINE>} else if (upperExists) {<NEW_LINE>o.put(context, "" + lower, upperValue, true);<NEW_LINE>o.delete(context, "" + upper, true);<NEW_LINE>} else if (lowerExists) {<NEW_LINE>o.put(context, <MASK><NEW_LINE>o.delete(context, "" + lower, true);<NEW_LINE>} else {<NEW_LINE>// no action required<NEW_LINE>}<NEW_LINE>++lower;<NEW_LINE>}<NEW_LINE>return o;<NEW_LINE>} | "" + upper, lowerValue, true); |
654,740 | public static void main(String[] args) throws InterruptedException {<NEW_LINE>try (KubernetesClient client = new KubernetesClientBuilder().build()) {<NEW_LINE>final String namespace = Optional.ofNullable(client.getNamespace()).orElse("default");<NEW_LINE>final Pod pod = client.pods().inNamespace(namespace).create(new PodBuilder().withNewMetadata().withName("myapp-pod").withLabels(Collections.singletonMap("app", "myapp-pod")).endMetadata().withNewSpec().addNewContainer().withName("myapp-container").withImage("busybox:1.28").withCommand("sh", "-c", "echo 'The app is running!'; sleep 10").endContainer().addNewInitContainer().withName("init-myservice").withImage("busybox:1.28").withCommand("sh", "-c", "echo 'inititalizing...'; sleep 5").endInitContainer().endSpec().build());<NEW_LINE>logger.info("Pod created, waiting for it to get ready...");<NEW_LINE>client.resource(pod).inNamespace(namespace).<MASK><NEW_LINE>logger.info("Pod is ready now");<NEW_LINE>final LogWatch lw = client.pods().inNamespace(namespace).withName(pod.getMetadata().getName()).watchLog(System.out);<NEW_LINE>logger.info("Watching Pod logs for 10 seconds...");<NEW_LINE>TimeUnit.SECONDS.sleep(10L);<NEW_LINE>logger.info("Deleting Pod...");<NEW_LINE>client.resource(pod).inNamespace(namespace).delete();<NEW_LINE>logger.info("Closing Pod log watch");<NEW_LINE>lw.close();<NEW_LINE>}<NEW_LINE>} | waitUntilReady(10, TimeUnit.SECONDS); |
902,126 | public void paint(@Nonnull Graphics2D g2, int x, int y, int height) {<NEW_LINE>if (myLabels.isEmpty())<NEW_LINE>return;<NEW_LINE>GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);<NEW_LINE>g2.setFont(getReferenceFont());<NEW_LINE>g2.setStroke(new BasicStroke(1.5f));<NEW_LINE>FontMetrics fontMetrics = g2.getFontMetrics();<NEW_LINE>x += PaintParameters.LABEL_PADDING;<NEW_LINE>for (Pair<String, Color> label : myLabels) {<NEW_LINE>Dimension size = myLabelPainter.calculateSize(label.first, fontMetrics);<NEW_LINE>int paddingY = y + (height - size.height) / 2;<NEW_LINE>myLabelPainter.paint(g2, label.first, x, paddingY, getLabelColor(label.second));<NEW_LINE>x <MASK><NEW_LINE>}<NEW_LINE>config.restore();<NEW_LINE>} | += size.width + PaintParameters.LABEL_PADDING; |
902,340 | public void load(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program prog, TaskMonitor monitor, MessageLog log) throws IOException {<NEW_LINE>if (!prog.getExecutableFormat().equals(PeLoader.PE_NAME)) {<NEW_LINE>throw new IOException("Program must be a " + PeLoader.PE_NAME);<NEW_LINE>}<NEW_LINE>SymbolTable symtab = prog.getSymbolTable();<NEW_LINE>AddressSpace space = prog.getAddressFactory().getDefaultAddressSpace();<NEW_LINE>List<MapExport> exports = parseExports(provider, log);<NEW_LINE>int successCount = 0;<NEW_LINE>for (MapExport exp : exports) {<NEW_LINE>try {<NEW_LINE>symtab.createLabel(space.getAddress(exp.addr), exp.name, SourceType.IMPORTED).setPrimary();<NEW_LINE>successCount++;<NEW_LINE>} catch (InvalidInputException e) {<NEW_LINE>log.appendMsg(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.<MASK><NEW_LINE>} | appendMsg("Added " + successCount + " symbols."); |
52,217 | void onFold() {<NEW_LINE>if (visualMode_.isActivated()) {<NEW_LINE>visualMode_.fold();<NEW_LINE>} else if (useScopeTreeFolding()) {<NEW_LINE>Range range = Range.fromPoints(docDisplay_.getSelectionStart(), docDisplay_.getSelectionEnd());<NEW_LINE>if (range.isEmpty()) {<NEW_LINE>// If no selection, fold the innermost non-anonymous scope<NEW_LINE>Scope scope = docDisplay_.getCurrentScope();<NEW_LINE>while (scope != null && scope.isAnon()<MASK><NEW_LINE>if (scope == null || scope.isTopLevel())<NEW_LINE>return;<NEW_LINE>docDisplay_.addFoldFromRow(scope.getFoldStart().getRow());<NEW_LINE>} else {<NEW_LINE>// If selection, fold the selection<NEW_LINE>docDisplay_.addFold(range);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>int row = docDisplay_.getSelectionStart().getRow();<NEW_LINE>docDisplay_.addFoldFromRow(row);<NEW_LINE>}<NEW_LINE>} | ) scope = scope.getParentScope(); |
936,992 | public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {<NEW_LINE>final InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);<NEW_LINE>// Async Object<NEW_LINE>target.addField(AsyncContextAccessor.class);<NEW_LINE>target.addField(ReactorContextAccessor.class);<NEW_LINE>for (InstrumentMethod constructorMethod : target.getDeclaredConstructors()) {<NEW_LINE>final String[] parameterTypes = constructorMethod.getParameterTypes();<NEW_LINE>if (parameterTypes != null || parameterTypes.length > 0) {<NEW_LINE>constructorMethod.addInterceptor(ConnectableFluxConstructorInterceptor.class);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final InstrumentMethod subscribeMethod = target.getDeclaredMethod("subscribe", "reactor.core.CoreSubscriber");<NEW_LINE>if (subscribeMethod != null) {<NEW_LINE>subscribeMethod.addInterceptor(ConnectableFluxSubscribeInterceptor.class, va(ReactorConstants.REACTOR_NETTY));<NEW_LINE>}<NEW_LINE>// since 3.3.0<NEW_LINE>final InstrumentMethod subscribeOrReturnMethod = target.getDeclaredMethod("subscribeOrReturn", "reactor.core.CoreSubscriber");<NEW_LINE>if (subscribeOrReturnMethod != null) {<NEW_LINE>subscribeOrReturnMethod.addInterceptor(ConnectableFluxSubscribeInterceptor.class<MASK><NEW_LINE>}<NEW_LINE>final InstrumentMethod connectMethod = target.getDeclaredMethod("connect", "java.util.function.Consumer");<NEW_LINE>if (connectMethod != null) {<NEW_LINE>connectMethod.addInterceptor(ConnectableFluxSubscribeInterceptor.class, va(ReactorConstants.REACTOR_NETTY));<NEW_LINE>}<NEW_LINE>return target.toBytecode();<NEW_LINE>} | , va(ReactorConstants.REACTOR_NETTY)); |
316,559 | public void save(ServerRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta meta, DataOutputStream out) throws IOException {<NEW_LINE>if (saveContext.cloneFirst()) {<NEW_LINE>row = (ServerRow) row.deepClone();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>row.startWrite();<NEW_LINE>if (row instanceof ServerIntFloatRow) {<NEW_LINE>save((ServerIntFloatRow) row, saveContext, meta, out);<NEW_LINE>} else if (row instanceof ServerIntDoubleRow) {<NEW_LINE>save((ServerIntDoubleRow) <MASK><NEW_LINE>} else if (row instanceof ServerIntIntRow) {<NEW_LINE>save((ServerIntIntRow) row, saveContext, meta, out);<NEW_LINE>} else if (row instanceof ServerIntLongRow) {<NEW_LINE>save((ServerIntLongRow) row, saveContext, meta, out);<NEW_LINE>} else if (row instanceof ServerLongFloatRow) {<NEW_LINE>save((ServerLongFloatRow) row, saveContext, meta, out);<NEW_LINE>} else if (row instanceof ServerLongDoubleRow) {<NEW_LINE>save((ServerLongDoubleRow) row, saveContext, meta, out);<NEW_LINE>} else if (row instanceof ServerLongIntRow) {<NEW_LINE>save((ServerLongIntRow) row, saveContext, meta, out);<NEW_LINE>} else if (row instanceof ServerLongLongRow) {<NEW_LINE>save((ServerLongLongRow) row, saveContext, meta, out);<NEW_LINE>} else {<NEW_LINE>throw new IOException("Unknown vector type " + row.getRowType());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>row.endWrite();<NEW_LINE>}<NEW_LINE>} | row, saveContext, meta, out); |
1,595,192 | private DocLine[] loadLines(MOrder order) {<NEW_LINE>ArrayList<DocLine> list = new ArrayList<DocLine>();<NEW_LINE>MOrderLine[] lines = order.getLines();<NEW_LINE>for (int i = 0; i < lines.length; i++) {<NEW_LINE>MOrderLine line = lines[i];<NEW_LINE>DocLine docLine = new DocLine(line, this);<NEW_LINE>BigDecimal Qty = line.getQtyOrdered();<NEW_LINE>docLine.setQty(Qty, order.isSOTrx());<NEW_LINE>//<NEW_LINE>BigDecimal priceCost = null;<NEW_LINE>if (// PO<NEW_LINE>getDocumentType().equals(DOCTYPE_POrder))<NEW_LINE>priceCost = line.getPriceCost();<NEW_LINE>BigDecimal LineNetAmt = null;<NEW_LINE>if (priceCost != null && priceCost.signum() != 0)<NEW_LINE>LineNetAmt = Qty.multiply(priceCost);<NEW_LINE>else<NEW_LINE>LineNetAmt = line.getLineNetAmt();<NEW_LINE>// DR<NEW_LINE>docLine.setAmount(LineNetAmt);<NEW_LINE><MASK><NEW_LINE>int C_Tax_ID = docLine.getC_Tax_ID();<NEW_LINE>// Correct included Tax<NEW_LINE>if (isTaxIncluded() && C_Tax_ID != 0) {<NEW_LINE>MTax tax = MTax.get(getCtx(), C_Tax_ID);<NEW_LINE>if (!tax.isZeroTax()) {<NEW_LINE>BigDecimal LineNetAmtTax = tax.calculateTax(LineNetAmt, true, getStdPrecision());<NEW_LINE>log.fine("LineNetAmt=" + LineNetAmt + " - Tax=" + LineNetAmtTax);<NEW_LINE>LineNetAmt = LineNetAmt.subtract(LineNetAmtTax);<NEW_LINE>for (int t = 0; t < m_taxes.length; t++) {<NEW_LINE>if (m_taxes[t].getC_Tax_ID() == C_Tax_ID) {<NEW_LINE>m_taxes[t].addIncludedTax(LineNetAmtTax);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BigDecimal PriceListTax = tax.calculateTax(PriceList, true, getStdPrecision());<NEW_LINE>PriceList = PriceList.subtract(PriceListTax);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// correct included Tax<NEW_LINE>docLine.setAmount(LineNetAmt, PriceList, Qty);<NEW_LINE>list.add(docLine);<NEW_LINE>}<NEW_LINE>// Return Array<NEW_LINE>DocLine[] dl = new DocLine[list.size()];<NEW_LINE>list.toArray(dl);<NEW_LINE>return dl;<NEW_LINE>} | BigDecimal PriceList = line.getPriceList(); |
575,063 | private static final Object convertValueToType(final Object value, final GridField field, final Class<?> returnType) {<NEW_LINE>if (boolean.class.equals(returnType)) {<NEW_LINE>if (value == null)<NEW_LINE>return false;<NEW_LINE>else<NEW_LINE>return value instanceof Boolean ? value : "Y".equals(value);<NEW_LINE>} else if (Integer.class.equals(returnType)) {<NEW_LINE>if (value == null) {<NEW_LINE>return null;<NEW_LINE>} else if (value instanceof Number) {<NEW_LINE>return ((Number) value).intValue();<NEW_LINE>} else if (value instanceof String) {<NEW_LINE>return Integer.<MASK><NEW_LINE>} else {<NEW_LINE>throw new AdempiereException("Invalid field value type returned." + "\n Field: " + field + "\n Expected type: " + returnType + "\n Value: " + value + " (class: " + value.getClass() + ")" + "\n");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return value;<NEW_LINE>}<NEW_LINE>} | parseInt(value.toString()); |
442,271 | private static void generics(LexerfulGrammarBuilder b) {<NEW_LINE>b.rule(cliGenericDeclaration).is("generic", "<", cliGenericParameterList, ">", b.optional(cliConstraintClauseList), declaration);<NEW_LINE>b.rule(cliGenericParameterList).is(cliGenericParameter, b.zeroOrMore(",", cliGenericParameter));<NEW_LINE>b.rule(cliGenericParameter).is(b.optional(attribute), b.firstOf(CxxKeyword.CLASS, CxxKeyword.TYPENAME), IDENTIFIER);<NEW_LINE>b.rule(cliGenericId).is(cliGenericName, "<", cliGenericArgumentList, ">");<NEW_LINE>b.rule(cliGenericName).is(b.firstOf(IDENTIFIER, operatorFunctionId));<NEW_LINE>b.rule(cliGenericArgumentList).is(cliGenericArgument, b.zeroOrMore(",", cliGenericArgument));<NEW_LINE>b.rule<MASK><NEW_LINE>b.rule(cliConstraintClauseList).is(cliConstraintClause, b.zeroOrMore(cliConstraintClause));<NEW_LINE>b.rule(cliConstraintClause).is("where", IDENTIFIER, ":", cliConstraintItemList);<NEW_LINE>b.rule(cliConstraintItemList).is(cliConstraintItem, b.zeroOrMore(",", cliConstraintItem));<NEW_LINE>b.rule(cliConstraintItem).is(b.firstOf(typeId, b.sequence(b.firstOf("ref", "value"), b.firstOf(CxxKeyword.CLASS, CxxKeyword.STRUCT)), "gcnew"));<NEW_LINE>} | (cliGenericArgument).is(typeId); |
405,548 | public static MDDerivedType create38(long[] args, MetadataValueList md) {<NEW_LINE><MASK><NEW_LINE>final long line = args[ARGINDEX_38_LINE];<NEW_LINE>final long size = args[ARGINDEX_38_SIZE];<NEW_LINE>final long align = args[ARGINDEX_38_ALIGN];<NEW_LINE>final long offset = args[ARGINDEX_38_OFFSET];<NEW_LINE>final long flags = args[ARGINDEX_38_FLAGS];<NEW_LINE>final MDDerivedType derivedType = new MDDerivedType(tag, line, size, align, offset, flags);<NEW_LINE>derivedType.scope = md.getNullable(args[ARGINDEX_38_SCOPE], derivedType);<NEW_LINE>derivedType.baseType = md.getNullable(args[ARGINDEX_38_BASETYPE], derivedType);<NEW_LINE>derivedType.extraData = md.getNullable(args[ARGINDEX_38_EXTRADATA], derivedType);<NEW_LINE>derivedType.setFile(md.getNullable(args[ARGINDEX_38_FILE], derivedType));<NEW_LINE>derivedType.setName(md.getNullable(args[ARGINDEX_38_NAME], derivedType));<NEW_LINE>return derivedType;<NEW_LINE>} | final long tag = args[ARGINDEX_38_TAG]; |
672,803 | // ///////////////////////////////// Registration Methods ///////////////////////////////////<NEW_LINE>public void register(BundleContext bndCtx) {<NEW_LINE>final boolean trace = TraceComponent.isAnyTracingEnabled();<NEW_LINE>final String methodName = "register()";<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.entry(tc, methodName, this);<NEW_LINE>Hashtable<String, String> props = new Hashtable<String, String>();<NEW_LINE>props.put("jmx.objectname", this.obn.toString());<NEW_LINE>if (IS_DEBUGGING)<NEW_LINE>// Extra Check: Does this MBean exist already?<NEW_LINE>MBeanHelper.isMbeanExist(objectName.toString() + "*", className, methodName);<NEW_LINE>// Register the MBean<NEW_LINE>if (trace && tc.isDebugEnabled())<NEW_LINE>Tr.debug(tc, "activateMBean started for " + this.obn.toString());<NEW_LINE>this.reg = bndCtx.registerService(JDBCResourceMBean.class.<MASK><NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.exit(tc, methodName, this);<NEW_LINE>} | getName(), this, props); |
1,452,567 | private void buildCardView(int styleResId) {<NEW_LINE>// Make sure the ImageCardView is focusable.<NEW_LINE>setFocusable(true);<NEW_LINE>setFocusableInTouchMode(true);<NEW_LINE>// setCardType(CARD_TYPE_INFO_UNDER);<NEW_LINE>setCardType(CARD_TYPE_MAIN_ONLY);<NEW_LINE>setBackgroundResource(R.color.primary_dark);<NEW_LINE>LayoutInflater inflater = LayoutInflater.from(getContext());<NEW_LINE>View view = inflater.inflate(R.layout.view_options_item, this);<NEW_LINE>mLayout = view.findViewById(R.id.layout_option_card);<NEW_LINE>mIcon = view.<MASK><NEW_LINE>mTitle = view.findViewById(R.id.text_option_title);<NEW_LINE>mValue = view.findViewById(R.id.text_option_value);<NEW_LINE>TypedArray cardAttrs = getContext().obtainStyledAttributes(styleResId, R.styleable.lbImageCardView);<NEW_LINE>cardAttrs.recycle();<NEW_LINE>} | findViewById(R.id.image_option); |
1,219,061 | public static Mono<String> readFileFromClasspath(String url) {<NEW_LINE>Assert.notNull(url, "url must not be null");<NEW_LINE>return DataBufferUtils.join(DataBufferUtils.read(new ClassPathResource(url), new DefaultDataBufferFactory(), BUFFER_SIZE)).<String>handle((it, sink) -> {<NEW_LINE>try (InputStream is = it.asInputStream();<NEW_LINE>InputStreamReader in = new InputStreamReader(<MASK><NEW_LINE>BufferedReader br = new BufferedReader(in)) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>String line;<NEW_LINE>while ((line = br.readLine()) != null) {<NEW_LINE>sb.append(line).append('\n');<NEW_LINE>}<NEW_LINE>sink.next(sb.toString());<NEW_LINE>sink.complete();<NEW_LINE>} catch (Exception e) {<NEW_LINE>sink.complete();<NEW_LINE>} finally {<NEW_LINE>DataBufferUtils.release(it);<NEW_LINE>}<NEW_LINE>}).onErrorResume(throwable -> Mono.error(new ResourceFailureException("Could not load resource from " + url, throwable)));<NEW_LINE>} | is, Charset.defaultCharset()); |
1,602,659 | private void parse(String connectionInformation) throws MalformedURLException {<NEW_LINE>String cloudId = "";<NEW_LINE>if (isValidUrlFormat(connectionInformation)) {<NEW_LINE>elasticsearchURL = new URL(connectionInformation);<NEW_LINE>type = Type.URL;<NEW_LINE>} else {<NEW_LINE>type = Type.CLOUD_ID;<NEW_LINE>if (connectionInformation.contains(":")) {<NEW_LINE>if (connectionInformation.indexOf(":") == connectionInformation.length() - 1) {<NEW_LINE>throw new IllegalStateException("cloudId " + connectionInformation + " must begin with a human readable identifier followed by a colon");<NEW_LINE>}<NEW_LINE>cloudId = connectionInformation.substring(connectionInformation.indexOf(":") + 1);<NEW_LINE>}<NEW_LINE>String decoded = new String(Base64.getDecoder().decode(cloudId), StandardCharsets.UTF_8);<NEW_LINE>String[] decodedParts = decoded.split("\\$");<NEW_LINE>if (decodedParts.length != 3) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>String elasticsearchHost = decodedParts[1];<NEW_LINE>String kibanaHost = decodedParts[2];<NEW_LINE>// domain name and optional port<NEW_LINE>String[] domainAndMaybePort = decodedParts[0].split(":", 2);<NEW_LINE>String domain = domainAndMaybePort[0];<NEW_LINE>int port;<NEW_LINE>if (domainAndMaybePort.length == 2) {<NEW_LINE>try {<NEW_LINE>port = Integer.parseInt(domainAndMaybePort[1]);<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>throw new IllegalStateException("cloudId " + connectionInformation + " does not contain a valid port number");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>port = 443;<NEW_LINE>}<NEW_LINE>this.elasticsearchURL = new URL(String.format("https://%s.%s:%d", elasticsearchHost, domain, port));<NEW_LINE>this.kibanaURL = new URL(String.format("https://%s.%s:%d", kibanaHost, domain, port));<NEW_LINE>}<NEW_LINE>} | IllegalStateException("cloudId " + connectionInformation + " did not decode to a cluster identifier correctly"); |
437,553 | public void loadFromFileToHolder() {<NEW_LINE>super.loadFromFileToHolder();<NEW_LINE>try {<NEW_LINE>Map<String, String> tmpGroupIdMappingProperties = new HashMap<>();<NEW_LINE>Map<String, Map<String, String>> tmpStreamIdMappingProperties = new HashMap<>();<NEW_LINE>Map<String, String> tmpGroupIdEnableMappingProperties = new HashMap<>();<NEW_LINE>for (Map.Entry<String, String> entry : super.getHolder().entrySet()) {<NEW_LINE>String[] sArray = StringUtils.split(<MASK><NEW_LINE>if (sArray.length != 3) {<NEW_LINE>LOG.warn("invalid groupId key {}", entry.getKey());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>tmpGroupIdMappingProperties.put(sArray[0].trim(), sArray[1].trim());<NEW_LINE>tmpGroupIdEnableMappingProperties.put(sArray[0].trim(), sArray[2].trim());<NEW_LINE>if (StringUtils.isNotBlank(entry.getValue())) {<NEW_LINE>tmpStreamIdMappingProperties.put(sArray[0].trim(), MAP_SPLITTER.split(entry.getValue()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>groupIdMappingProperties = tmpGroupIdMappingProperties;<NEW_LINE>streamIdMappingProperties = tmpStreamIdMappingProperties;<NEW_LINE>groupIdEnableMappingProperties = tmpGroupIdEnableMappingProperties;<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("loadConfig error :", e);<NEW_LINE>}<NEW_LINE>} | entry.getKey(), GROUPID_VALUE_SPLITTER); |
648,260 | public MitigationAction unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>MitigationAction mitigationAction = new MitigationAction();<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("name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>mitigationAction.setName(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>mitigationAction.setId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("roleArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>mitigationAction.setRoleArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("actionParams", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>mitigationAction.setActionParams(MitigationActionParamsJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return mitigationAction;<NEW_LINE>} | class).unmarshall(context)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.