idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
826,063 | public List<List<Integer>> verticalOrder(TreeNode root) {<NEW_LINE>if (root == null) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>Map<Integer, List<Integer>> offsetVals = new TreeMap<>();<NEW_LINE>Map<TreeNode, Integer> nodeOffsets = new HashMap<>();<NEW_LINE>Deque<TreeNode> q = new ArrayDeque<>();<NEW_LINE>q.offer(root);<NEW_LINE>nodeOffsets.put(root, 0);<NEW_LINE>while (!q.isEmpty()) {<NEW_LINE>TreeNode node = q.poll();<NEW_LINE>int offset = nodeOffsets.get(node);<NEW_LINE>offsetVals.computeIfAbsent(offset, k -> new ArrayList<>()).add(node.val);<NEW_LINE>if (node.left != null) {<NEW_LINE>q.offer(node.left);<NEW_LINE>nodeOffsets.put(node.left, offset - 1);<NEW_LINE>}<NEW_LINE>if (node.right != null) {<NEW_LINE>q.offer(node.right);<NEW_LINE>nodeOffsets.put(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ArrayList<>(offsetVals.values());<NEW_LINE>} | node.right, offset + 1); |
1,635,100 | private OutputsInfo outputsInfo(RootInfo rootInfo, IResource res) {<NEW_LINE>try {<NEW_LINE>JavaProject proj = rootInfo == null ? (JavaProject) createElement(res.getProject(), IJavaElement.JAVA_PROJECT, null) : rootInfo.project;<NEW_LINE>if (proj != null) {<NEW_LINE>IPath projectOutput = proj.getOutputLocation();<NEW_LINE>int traverseMode = IGNORE;<NEW_LINE>if (proj.getProject().getFullPath().equals(projectOutput)) {<NEW_LINE>// case of proj==bin==src<NEW_LINE>return new OutputsInfo(new IPath[] { projectOutput }, new int[] { SOURCE }, 1);<NEW_LINE>}<NEW_LINE>IClasspathEntry[] classpath = proj.getResolvedClasspath();<NEW_LINE>IPath[] outputs = new IPath[classpath.length + 1];<NEW_LINE>int[] traverseModes = new int[classpath.length + 1];<NEW_LINE>int outputCount = 1;<NEW_LINE>outputs[0] = projectOutput;<NEW_LINE>traverseModes[0] = traverseMode;<NEW_LINE>for (int i = 0, length = classpath.length; i < length; i++) {<NEW_LINE>IClasspathEntry entry = classpath[i];<NEW_LINE><MASK><NEW_LINE>IPath output = entry.getOutputLocation();<NEW_LINE>if (output != null) {<NEW_LINE>outputs[outputCount] = output;<NEW_LINE>// check case of src==bin<NEW_LINE>if (entryPath.equals(output)) {<NEW_LINE>traverseModes[outputCount++] = (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) ? SOURCE : BINARY;<NEW_LINE>} else {<NEW_LINE>traverseModes[outputCount++] = IGNORE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// check case of src==bin<NEW_LINE>if (entryPath.equals(projectOutput)) {<NEW_LINE>traverseModes[0] = (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) ? SOURCE : BINARY;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new OutputsInfo(outputs, traverseModes, outputCount);<NEW_LINE>}<NEW_LINE>} catch (JavaModelException e) {<NEW_LINE>// java project doesn't exist: ignore<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | IPath entryPath = entry.getPath(); |
316,587 | public Observable<Iterable<Person>> call() {<NEW_LINE>String[] firstNames = new String[] { "Alice", "Bob", "Carol", "Chloe", "Dan", "Emily", "Emma", "Eric", "Eva", "Frank", "Gary", "Helen", "Jack", "James", "Jane", "Kevin", "Laura", "Leon", "Lilly", "Mary", "Maria", "Mia", "Nick", "Oliver", "Olivia", "Patrick", "Robert", "Stan", "Vivian", "Wesley", "Zoe" };<NEW_LINE>String[] lastNames = new String[] { "Hall", "Hill", "Smith", "Lee", "Jones", "Taylor", "Williams", "Jackson", "Stone", "Brown", "Thomas", "Clark", "Lewis", "Miller", "Walker", "Fox", "Robinson", "Wilson", "Cook", "Carter", "Cooper", "Martin" };<NEW_LINE>Random random = new Random();<NEW_LINE>final Set<Person> people = new TreeSet<>(new Comparator<Person>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(Person lhs, Person rhs) {<NEW_LINE>return lhs.getName().compareTo(rhs.getName());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// creating many people (but only with unique names)<NEW_LINE>for (int i = 0; i < 3000; i++) {<NEW_LINE>PersonEntity person = new PersonEntity();<NEW_LINE>String first = firstNames[random.nextInt(firstNames.length)];<NEW_LINE>String last = lastNames[random.nextInt(lastNames.length)];<NEW_LINE>person.setName(first + " " + last);<NEW_LINE>person.setUUID(UUID.randomUUID());<NEW_LINE>person.setEmail(Character.toLowerCase(first.charAt(0)) + last.toLowerCase() + "@gmail.com");<NEW_LINE>AddressEntity address = new AddressEntity();<NEW_LINE>address.setLine1("123 Market St");<NEW_LINE>address.setZip("94105");<NEW_LINE>address.setCity("San Francisco");<NEW_LINE>address.setState("CA");<NEW_LINE>address.setCountry("US");<NEW_LINE>person.setAddress(address);<NEW_LINE>people.add(person);<NEW_LINE>}<NEW_LINE>return data.<MASK><NEW_LINE>} | insert(people).toObservable(); |
1,429,897 | public void marshall(HlsGroupSettings hlsGroupSettings, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (hlsGroupSettings == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getAdMarkers(), ADMARKERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getAdditionalManifests(), ADDITIONALMANIFESTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getAudioOnlyHeader(), AUDIOONLYHEADER_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getBaseUrl(), BASEURL_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getCaptionLanguageMappings(), CAPTIONLANGUAGEMAPPINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getCaptionLanguageSetting(), CAPTIONLANGUAGESETTING_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getCaptionSegmentLengthControl(), CAPTIONSEGMENTLENGTHCONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getClientCache(), CLIENTCACHE_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getCodecSpecification(), CODECSPECIFICATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getDestination(), DESTINATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getDestinationSettings(), DESTINATIONSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getDirectoryStructure(), DIRECTORYSTRUCTURE_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getEncryption(), ENCRYPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getImageBasedTrickPlay(), IMAGEBASEDTRICKPLAY_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getImageBasedTrickPlaySettings(), IMAGEBASEDTRICKPLAYSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getManifestCompression(), MANIFESTCOMPRESSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getManifestDurationFormat(), MANIFESTDURATIONFORMAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getMinFinalSegmentLength(), MINFINALSEGMENTLENGTH_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getMinSegmentLength(), MINSEGMENTLENGTH_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getOutputSelection(), OUTPUTSELECTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getProgramDateTime(), PROGRAMDATETIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getProgramDateTimePeriod(), PROGRAMDATETIMEPERIOD_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getSegmentLength(), SEGMENTLENGTH_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getSegmentLengthControl(), SEGMENTLENGTHCONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getSegmentsPerSubdirectory(), SEGMENTSPERSUBDIRECTORY_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getStreamInfResolution(), STREAMINFRESOLUTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getTargetDurationCompatibilityMode(), TARGETDURATIONCOMPATIBILITYMODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getTimedMetadataId3Frame(), TIMEDMETADATAID3FRAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getTimedMetadataId3Period(), TIMEDMETADATAID3PERIOD_BINDING);<NEW_LINE>protocolMarshaller.marshall(hlsGroupSettings.getTimestampDeltaMilliseconds(), TIMESTAMPDELTAMILLISECONDS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | hlsGroupSettings.getSegmentControl(), SEGMENTCONTROL_BINDING); |
1,581,681 | protected BiPartitionProjection partitionProjections(Map<Projection, IntArrayList> originalProjections, BiPartition biPartition) {<NEW_LINE>IntHashSet part0 = biPartition.getPartition(0);<NEW_LINE>EnumMap<Projection, IntArrayList> projections0 = new EnumMap<>(Projection.class);<NEW_LINE>EnumMap<Projection, IntArrayList> projections1 = new EnumMap<>(Projection.class);<NEW_LINE>int origNodeCount = originalProjections.get(Projection.values()[0]).size();<NEW_LINE>// Add initial lists<NEW_LINE>for (Projection proj : Projection.values()) {<NEW_LINE>projections0.put(proj, new IntArrayList(origNodeCount / 3));<NEW_LINE>projections1.put(proj, new IntArrayList(origNodeCount / 3));<NEW_LINE>}<NEW_LINE>// Go through the original projections and separate each into two projections for the subsets, maintaining order<NEW_LINE>for (int i = 0; i < origNodeCount; i++) {<NEW_LINE>for (Map.Entry<Projection, IntArrayList> proj : originalProjections.entrySet()) {<NEW_LINE>int node = proj.getValue().get(i);<NEW_LINE>if (part0.contains(node))<NEW_LINE>projections0.get(proj.getKey<MASK><NEW_LINE>else<NEW_LINE>projections1.get(proj.getKey()).add(node);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new BiPartitionProjection(projections0, projections1);<NEW_LINE>} | ()).add(node); |
872,049 | public int add(byte[] value) {<NEW_LINE>int offsetBufferIndex = _numValues >>> OFFSET_BUFFER_SHIFT_OFFSET;<NEW_LINE>int offsetIndex = _numValues & OFFSET_BUFFER_MASK;<NEW_LINE>PinotDataBuffer offsetBuffer;<NEW_LINE>// If this is the first entry in the offset buffer, allocate a new buffer and store the end offset of the previous<NEW_LINE>// value<NEW_LINE>if (offsetIndex == 0) {<NEW_LINE>offsetBuffer = _memoryManager.allocate(OFFSET_BUFFER_SIZE, _allocationContext);<NEW_LINE>offsetBuffer.putInt(0, _previousValueEndOffset);<NEW_LINE>_offsetBuffers.set(offsetBufferIndex, offsetBuffer);<NEW_LINE>_totalBufferSize += OFFSET_BUFFER_SIZE;<NEW_LINE>} else {<NEW_LINE>offsetBuffer = _offsetBuffers.get(offsetBufferIndex);<NEW_LINE>}<NEW_LINE>int valueLength = value.length;<NEW_LINE>if (valueLength == 0) {<NEW_LINE>offsetBuffer.putInt((offsetIndex + 1) << 2, _previousValueEndOffset);<NEW_LINE>return _numValues++;<NEW_LINE>}<NEW_LINE>int valueBufferIndex = (_previousValueEndOffset + <MASK><NEW_LINE>PinotDataBuffer valueBuffer;<NEW_LINE>int valueStartOffset;<NEW_LINE>// If the current value buffer does not have enough space, allocate a new buffer to store the value<NEW_LINE>if ((_previousValueEndOffset - 1) >>> VALUE_BUFFER_SHIFT_OFFSET != valueBufferIndex) {<NEW_LINE>valueBuffer = _memoryManager.allocate(VALUE_BUFFER_SIZE, _allocationContext);<NEW_LINE>_valueBuffers.set(valueBufferIndex, valueBuffer);<NEW_LINE>_totalBufferSize += VALUE_BUFFER_SIZE;<NEW_LINE>valueStartOffset = valueBufferIndex << VALUE_BUFFER_SHIFT_OFFSET;<NEW_LINE>} else {<NEW_LINE>valueBuffer = _valueBuffers.get(valueBufferIndex);<NEW_LINE>valueStartOffset = _previousValueEndOffset;<NEW_LINE>}<NEW_LINE>int valueEndOffset = valueStartOffset + valueLength;<NEW_LINE>offsetBuffer.putInt((offsetIndex + 1) << 2, valueEndOffset);<NEW_LINE>valueBuffer.readFrom(valueStartOffset & VALUE_BUFFER_MASK, value);<NEW_LINE>_previousValueEndOffset = valueEndOffset;<NEW_LINE>return _numValues++;<NEW_LINE>} | valueLength - 1) >>> VALUE_BUFFER_SHIFT_OFFSET; |
1,790,392 | private void drawLabels(int originValue, double maxX, double maxY, String title, String xAxisLabel, String yAxisLabel) {<NEW_LINE>Font font = new Font(HELVETICA_FONT, Font.BOLD, 12);<NEW_LINE>StdDraw.setFont(font);<NEW_LINE>StdDraw.setPenColor(StdDraw.RED);<NEW_LINE>// X axis label<NEW_LINE>double xAxisLabelHeight = -(maxY * 0.025);<NEW_LINE>StdDraw.text(maxX / 2, xAxisLabelHeight, xAxisLabel);<NEW_LINE>// Y axis label<NEW_LINE>StdDraw.text(-(maxY * 15), maxY / 2, yAxisLabel, 90);<NEW_LINE>StdDraw.setPenColor(StdDraw.BLACK);<NEW_LINE>// Title<NEW_LINE>StdDraw.text(maxX / 2, maxY - (maxY * 0.02), title);<NEW_LINE>Font font2 = new Font(HELVETICA_FONT, Font.PLAIN, 12);<NEW_LINE>StdDraw.setFont(font2);<NEW_LINE>StdDraw.text(-(maxX * 0.01), xAxisLabelHeight, String.valueOf(originValue));<NEW_LINE>// X axis label<NEW_LINE>StdDraw.text(-(maxX * 0.005), maxY - (maxY * 0.07), String.valueOf((int) maxY));<NEW_LINE>// Y axis label<NEW_LINE>StdDraw.text(maxX - (maxX * 0.06), xAxisLabelHeight, String.<MASK><NEW_LINE>} | valueOf((int) maxX)); |
1,575,625 | public boolean removeVmFromLoadBalancers(long instanceId) {<NEW_LINE>boolean success = true;<NEW_LINE>List<LoadBalancerVMMapVO> <MASK><NEW_LINE>if (maps == null || maps.isEmpty()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Map<Long, List<Long>> lbsToReconfigure = new HashMap<Long, List<Long>>();<NEW_LINE>// first set all existing lb mappings with Revoke state<NEW_LINE>for (LoadBalancerVMMapVO map : maps) {<NEW_LINE>long lbId = map.getLoadBalancerId();<NEW_LINE>List<Long> instances = lbsToReconfigure.get(lbId);<NEW_LINE>if (instances == null) {<NEW_LINE>instances = new ArrayList<Long>();<NEW_LINE>}<NEW_LINE>instances.add(map.getInstanceId());<NEW_LINE>lbsToReconfigure.put(lbId, instances);<NEW_LINE>map.setRevoke(true);<NEW_LINE>_lb2VmMapDao.persist(map);<NEW_LINE>s_logger.debug("Set load balancer rule for revoke: rule id " + map.getLoadBalancerId() + ", vmId " + instanceId);<NEW_LINE>}<NEW_LINE>// Reapply all lbs that had the vm assigned<NEW_LINE>if (lbsToReconfigure != null) {<NEW_LINE>for (Map.Entry<Long, List<Long>> lb : lbsToReconfigure.entrySet()) {<NEW_LINE>if (!removeFromLoadBalancerInternal(lb.getKey(), lb.getValue(), false, new HashMap<Long, List<String>>())) {<NEW_LINE>success = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return success;<NEW_LINE>} | maps = _lb2VmMapDao.listByInstanceId(instanceId); |
1,271,378 | public ListCallAnalyticsCategoriesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListCallAnalyticsCategoriesResult listCallAnalyticsCategoriesResult = new ListCallAnalyticsCategoriesResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listCallAnalyticsCategoriesResult;<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("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listCallAnalyticsCategoriesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Categories", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listCallAnalyticsCategoriesResult.setCategories(new ListUnmarshaller<CategoryProperties>(CategoryPropertiesJsonUnmarshaller.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 listCallAnalyticsCategoriesResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,370,073 | public static double reLnBn(int n) {<NEW_LINE>if (n < 0)<NEW_LINE>return Double.NaN;<NEW_LINE>if (n == 1)<NEW_LINE>return -log(2);<NEW_LINE>if (n % 2 != 0)<NEW_LINE>return Double.NEGATIVE_INFINITY;<NEW_LINE>if (// rel err < 1e-14<NEW_LINE>n >= 50) {<NEW_LINE>// Log[-2^(3/2 - n) ((3 i)/e)^n n^(1/2 + n) ((3 + 40 n^2)/(-1 + 120 n^2))^n Pi^(1/2 - n)]<NEW_LINE>double x = 0;<NEW_LINE>// ignoring + imaginary pi here<NEW_LINE>x += (3.0 / 2.0 - n) * log(2);<NEW_LINE>// ignoring + imaginary pi/2 in the parenthesis<NEW_LINE>x += n * (log(3) - 1);<NEW_LINE>x += (n + 0.5) * log(n);<NEW_LINE>x += n * (log(40 * n * n + 3) - log(120 <MASK><NEW_LINE>x += (0.5 - n) * log(PI);<NEW_LINE>return x;<NEW_LINE>}<NEW_LINE>return reLnBn_sub_50[n / 2];<NEW_LINE>} | * n * n - 1)); |
575,136 | public void initialize(String imageType) {<NEW_LINE>if ("png".equalsIgnoreCase(imageType)) {<NEW_LINE>this.decisionRequirementsDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB);<NEW_LINE>} else {<NEW_LINE>this.decisionRequirementsDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);<NEW_LINE>}<NEW_LINE>this.g = decisionRequirementsDiagram.createGraphics();<NEW_LINE>if (!"png".equalsIgnoreCase(imageType)) {<NEW_LINE>this.g.setBackground(new Color(255<MASK><NEW_LINE>this.g.clearRect(0, 0, canvasWidth, canvasHeight);<NEW_LINE>}<NEW_LINE>g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<NEW_LINE>g.setPaint(Color.black);<NEW_LINE>Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE);<NEW_LINE>g.setFont(font);<NEW_LINE>this.fontMetrics = g.getFontMetrics();<NEW_LINE>LABEL_FONT = new Font(labelFontName, Font.ITALIC, 10);<NEW_LINE>ANNOTATION_FONT = new Font(annotationFontName, Font.PLAIN, FONT_SIZE);<NEW_LINE>try {<NEW_LINE>DECISION_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/decision.png", customClassLoader));<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.warn("Could not load image for decision requirements diagram creation: {}", e.getMessage());<NEW_LINE>}<NEW_LINE>} | , 255, 255, 0)); |
902,606 | private void drawCross(Graphics2D g2d) {<NEW_LINE>int drawX, drawY;<NEW_LINE>final String cross = "+";<NEW_LINE>g2d.setFont(new Font("arial"<MASK><NEW_LINE>Rectangle2D crossBounds = g2d.getFontMetrics().getStringBounds("+", g2d);<NEW_LINE>final int crossW = (int) crossBounds.getWidth();<NEW_LINE>final int crossH = (int) crossBounds.getHeight();<NEW_LINE>if (_offset.x > _imgW / 2) {<NEW_LINE>drawX = getWidth() - crossW;<NEW_LINE>} else if (_offset.x < -_imgW / 2) {<NEW_LINE>drawX = 0;<NEW_LINE>} else {<NEW_LINE>drawX = (int) (getWidth() / 2 + _offset.x * _scale - crossW / 2);<NEW_LINE>}<NEW_LINE>if (_offset.y > _imgH / 2) {<NEW_LINE>drawY = getHeight() + crossH / 2 - 3;<NEW_LINE>} else if (_offset.y < -_imgH / 2) {<NEW_LINE>drawY = crossH / 2 + 2;<NEW_LINE>} else {<NEW_LINE>drawY = (int) (getHeight() / 2 + _offset.y * _scale + crossH / 2);<NEW_LINE>drawY -= 4;<NEW_LINE>}<NEW_LINE>g2d.setColor(new Color(0, 0, 0, 180));<NEW_LINE>g2d.drawString(cross, drawX + 1, drawY + 1);<NEW_LINE>g2d.setColor(new Color(255, 0, 0, 180));<NEW_LINE>g2d.drawString(cross, drawX, drawY);<NEW_LINE>} | , Font.PLAIN, 24)); |
1,530,102 | public static DescribeBackupPlansResponse unmarshall(DescribeBackupPlansResponse describeBackupPlansResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeBackupPlansResponse.setRequestId(_ctx.stringValue("DescribeBackupPlansResponse.RequestId"));<NEW_LINE>describeBackupPlansResponse.setSuccess(_ctx.booleanValue("DescribeBackupPlansResponse.Success"));<NEW_LINE>describeBackupPlansResponse.setCode(_ctx.stringValue("DescribeBackupPlansResponse.Code"));<NEW_LINE>describeBackupPlansResponse.setMessage(_ctx.stringValue("DescribeBackupPlansResponse.Message"));<NEW_LINE>describeBackupPlansResponse.setTotalCount(_ctx.longValue("DescribeBackupPlansResponse.TotalCount"));<NEW_LINE>describeBackupPlansResponse.setPageSize(_ctx.integerValue("DescribeBackupPlansResponse.PageSize"));<NEW_LINE>describeBackupPlansResponse.setPageNumber(_ctx.integerValue("DescribeBackupPlansResponse.PageNumber"));<NEW_LINE>List<BackupPlan> backupPlans = new ArrayList<BackupPlan>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeBackupPlansResponse.BackupPlans.Length"); i++) {<NEW_LINE>BackupPlan backupPlan = new BackupPlan();<NEW_LINE>backupPlan.setVaultId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].VaultId"));<NEW_LINE>backupPlan.setBackupSourceGroupId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].BackupSourceGroupId"));<NEW_LINE>backupPlan.setPlanId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].PlanId"));<NEW_LINE>backupPlan.setPlanName(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].PlanName"));<NEW_LINE>backupPlan.setSourceType(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].SourceType"));<NEW_LINE>backupPlan.setBackupType(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].BackupType"));<NEW_LINE>backupPlan.setSchedule(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Schedule"));<NEW_LINE>backupPlan.setRetention(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Retention"));<NEW_LINE>backupPlan.setClusterId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].ClusterId"));<NEW_LINE>backupPlan.setDisabled(_ctx.booleanValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Disabled"));<NEW_LINE>backupPlan.setCreatedTime(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].CreatedTime"));<NEW_LINE>backupPlan.setUpdatedTime(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].UpdatedTime"));<NEW_LINE>backupPlan.setFileSystemId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].FileSystemId"));<NEW_LINE>backupPlan.setCreateTime(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].CreateTime"));<NEW_LINE>backupPlan.setBucket(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Bucket"));<NEW_LINE>backupPlan.setPrefix(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Prefix"));<NEW_LINE>backupPlan.setInstanceId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].InstanceId"));<NEW_LINE>backupPlan.setDetail(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Detail"));<NEW_LINE>backupPlan.setClientId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].ClientId"));<NEW_LINE>backupPlan.setSpeedLimit(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].SpeedLimit"));<NEW_LINE>backupPlan.setOptions(_ctx.stringValue<MASK><NEW_LINE>backupPlan.setInclude(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Include"));<NEW_LINE>backupPlan.setExclude(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Exclude"));<NEW_LINE>backupPlan.setDataSourceId(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].DataSourceId"));<NEW_LINE>List<String> paths = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Paths.Length"); j++) {<NEW_LINE>paths.add(_ctx.stringValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].Paths[" + j + "]"));<NEW_LINE>}<NEW_LINE>backupPlan.setPaths(paths);<NEW_LINE>TrialInfo trialInfo = new TrialInfo();<NEW_LINE>trialInfo.setTrialStartTime(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].TrialInfo.TrialStartTime"));<NEW_LINE>trialInfo.setTrialExpireTime(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].TrialInfo.TrialExpireTime"));<NEW_LINE>trialInfo.setKeepAfterTrialExpiration(_ctx.booleanValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].TrialInfo.KeepAfterTrialExpiration"));<NEW_LINE>trialInfo.setTrialVaultReleaseTime(_ctx.longValue("DescribeBackupPlansResponse.BackupPlans[" + i + "].TrialInfo.TrialVaultReleaseTime"));<NEW_LINE>backupPlan.setTrialInfo(trialInfo);<NEW_LINE>backupPlans.add(backupPlan);<NEW_LINE>}<NEW_LINE>describeBackupPlansResponse.setBackupPlans(backupPlans);<NEW_LINE>return describeBackupPlansResponse;<NEW_LINE>} | ("DescribeBackupPlansResponse.BackupPlans[" + i + "].Options")); |
873,589 | public void testDeliveryDelayForDifferentDelaysTopic_Tcp(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>boolean testFailed = false;<NEW_LINE>JMSContext jmsContext = jmsTCFTCP.createContext();<NEW_LINE>Topic topic = (Topic) new <MASK><NEW_LINE>JMSProducer jmsProducer = jmsContext.createProducer();<NEW_LINE>int delay = 15500;<NEW_LINE>jmsProducer.setDeliveryDelay(delay);<NEW_LINE>StreamMessage sm = jmsContext.createStreamMessage();<NEW_LINE>String msgText = "TopicTCPMessage1";<NEW_LINE>sm.writeString(msgText);<NEW_LINE>sm.writeLong(Calendar.getInstance().getTimeInMillis() + delay);<NEW_LINE>jmsProducer.send(topic, sm);<NEW_LINE>delay = 11100;<NEW_LINE>jmsProducer.setDeliveryDelay(delay);<NEW_LINE>sm = jmsContext.createStreamMessage();<NEW_LINE>msgText = "TopicTCPMessage2";<NEW_LINE>sm.writeString(msgText);<NEW_LINE>sm.writeLong(Calendar.getInstance().getTimeInMillis() + delay);<NEW_LINE>jmsProducer.send(topic, sm);<NEW_LINE>Thread.sleep(20000);<NEW_LINE>jmsContext.close();<NEW_LINE>} | InitialContext().lookup("java:comp/env/eis/topic"); |
766,685 | public static boolean run(Automaton a, String s) {<NEW_LINE>if (a.isSingleton()) {<NEW_LINE>return s.equals(a._singleton);<NEW_LINE>}<NEW_LINE>if (a._deterministic) {<NEW_LINE>State p = a._initial;<NEW_LINE>for (int i = 0; i < s.length(); i++) {<NEW_LINE>State q = p.step(s.charAt(i));<NEW_LINE>if (q == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>p = q;<NEW_LINE>}<NEW_LINE>return p._accept;<NEW_LINE>} else {<NEW_LINE>Set<State> states = a.getStates();<NEW_LINE>Automaton.setStateNumbers(states);<NEW_LINE>LinkedList<State> pp = new LinkedList<State>();<NEW_LINE>LinkedList<State> ppOther = new LinkedList<State>();<NEW_LINE>BitSet bb = new BitSet(states.size());<NEW_LINE>BitSet bbOther = new BitSet(states.size());<NEW_LINE>pp.add(a._initial);<NEW_LINE>ArrayList<State> dest = new ArrayList<State>();<NEW_LINE>boolean accept = a._initial._accept;<NEW_LINE>for (int i = 0; i < s.length(); i++) {<NEW_LINE>char c = s.charAt(i);<NEW_LINE>accept = false;<NEW_LINE>ppOther.clear();<NEW_LINE>bbOther.clear();<NEW_LINE>for (State p : pp) {<NEW_LINE>dest.clear();<NEW_LINE><MASK><NEW_LINE>for (State q : dest) {<NEW_LINE>if (q._accept) {<NEW_LINE>accept = true;<NEW_LINE>}<NEW_LINE>if (!bbOther.get(q._number)) {<NEW_LINE>bbOther.set(q._number);<NEW_LINE>ppOther.add(q);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LinkedList<State> tp = pp;<NEW_LINE>pp = ppOther;<NEW_LINE>ppOther = tp;<NEW_LINE>BitSet tb = bb;<NEW_LINE>bb = bbOther;<NEW_LINE>bbOther = tb;<NEW_LINE>}<NEW_LINE>return accept;<NEW_LINE>}<NEW_LINE>} | p.step(c, dest); |
1,117,923 | public void test(Test test, boolean persistent) {<NEW_LINE>ivTest = test;<NEW_LINE>ivExchanger = new Exchanger();<NEW_LINE>TimerData data = getBusinessObject().createTimer(persistent);<NEW_LINE>ivTest.check("initial", new TimerData(data.ivTimer));<NEW_LINE>try {<NEW_LINE>// Wait for the timeout method to be called. Send a dummy string<NEW_LINE>// and receive TimerData from the timeout method.<NEW_LINE>TimerData timeoutData1 = (TimerData) ivExchanger.exchange("test1", 30, TimeUnit.SECONDS);<NEW_LINE><MASK><NEW_LINE>// Notify the timeout method to continue.<NEW_LINE>ivExchanger.exchange(true, 30, TimeUnit.SECONDS);<NEW_LINE>// Wait for the timeout method to be called again. Send a dummy<NEW_LINE>// string and receive a TimerData from the timeout method.<NEW_LINE>TimerData timeoutData2 = (TimerData) ivExchanger.exchange("test2", 30, TimeUnit.SECONDS);<NEW_LINE>ivTest.check("timeout #2", timeoutData2);<NEW_LINE>// Notify the timeout method to cancel.<NEW_LINE>ivExchanger.exchange(false, 30, TimeUnit.SECONDS);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new Error(ex);<NEW_LINE>}<NEW_LINE>} | ivTest.check("timeout #1", timeoutData1); |
56,466 | boolean assertionMatch(com.yahoo.athenz.zms.Assertion assertion, String identity, String op, String resource, List<Role> roles, String trustDomain) {<NEW_LINE>// Lowercase action and resource as it is possible to store them case-sensitive<NEW_LINE>String opPattern = StringUtils.patternFromGlob(assertion.getAction().toLowerCase());<NEW_LINE>if (!op.matches(opPattern)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String rezPattern = StringUtils.patternFromGlob(assertion.getResource().toLowerCase());<NEW_LINE>if (!resource.matches(rezPattern)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String rolePattern = StringUtils.<MASK><NEW_LINE>boolean matchResult = matchPrincipal(roles, rolePattern, identity, trustDomain);<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("assertionMatch: -> {} (effect: {})", matchResult, assertion.getEffect());<NEW_LINE>}<NEW_LINE>return matchResult;<NEW_LINE>} | patternFromGlob(assertion.getRole()); |
1,049,675 | public Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft, Object iRight, OCommandContext iContext, final ODocumentSerializer serializer) {<NEW_LINE>OLuceneFullTextIndex index = involvedIndex(iRecord, iCurrentResult, iCondition, iLeft, iRight);<NEW_LINE>if (index == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>MemoryIndex memoryIndex = (<MASK><NEW_LINE>if (memoryIndex == null) {<NEW_LINE>memoryIndex = new MemoryIndex();<NEW_LINE>iContext.setVariable(MEMORY_INDEX, memoryIndex);<NEW_LINE>}<NEW_LINE>memoryIndex.reset();<NEW_LINE>try {<NEW_LINE>// In case of collection field evaluate the query with every item until matched<NEW_LINE>if (iLeft instanceof List && index.isCollectionIndex()) {<NEW_LINE>return matchCollectionIndex((List) iLeft, iRight, index, memoryIndex);<NEW_LINE>} else {<NEW_LINE>return matchField(iLeft, iRight, index, memoryIndex);<NEW_LINE>}<NEW_LINE>} catch (ParseException e) {<NEW_LINE>OLogManager.instance().error(this, "error occurred while building query", e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>OLogManager.instance().error(this, "error occurred while building memory index", e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | MemoryIndex) iContext.getVariable(MEMORY_INDEX); |
1,316,225 | private void makeNativeWrite(CodegenMethod method, CodegenClassScope classScope) {<NEW_LINE>boolean first = true;<NEW_LINE>if (desc.getOptionalSupertype() != null && !desc.getOptionalSupertype().getTypes().isEmpty()) {<NEW_LINE>method.getBlock().exprDotMethod(ref("super"), "nativeWrite", ref("writer"));<NEW_LINE>first = false;<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, Object> property : desc.getPropertiesThisType().entrySet()) {<NEW_LINE>JsonUnderlyingField field = desc.getFieldDescriptorsInclSupertype().get(property.getKey());<NEW_LINE>JsonForgeDesc forge = desc.getForges().get(property.getKey());<NEW_LINE>String fieldName = field.getFieldName();<NEW_LINE>if (!first) {<NEW_LINE>method.getBlock().exprDotMethod<MASK><NEW_LINE>}<NEW_LINE>first = false;<NEW_LINE>CodegenExpression write = forge.getWriteForge().codegenWrite(new JsonWriteForgeRefs(ref("writer"), ref(fieldName), constant(property.getKey())), method, classScope);<NEW_LINE>method.getBlock().exprDotMethod(ref("writer"), "writeMemberName", constant(property.getKey())).exprDotMethod(ref("writer"), "writeMemberSeparator").expression(write);<NEW_LINE>}<NEW_LINE>} | (ref("writer"), "writeObjectSeparator"); |
1,797,722 | protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {<NEW_LINE>if (getArguments().getString(BundleConstant.EXTRA) == null) {<NEW_LINE>throw new NullPointerException("Username is null");<NEW_LINE>}<NEW_LINE>stateLayout.setEmptyText(R.string.no_gists);<NEW_LINE>refresh.setOnRefreshListener(this);<NEW_LINE>stateLayout.setOnReloadListener(this);<NEW_LINE>recycler.setEmptyView(stateLayout, refresh);<NEW_LINE>adapter = new GistsAdapter(getPresenter().getGists(), true);<NEW_LINE>adapter.setListener(getPresenter());<NEW_LINE>getLoadMore().initialize(getPresenter().getCurrentPage(), <MASK><NEW_LINE>recycler.setAdapter(adapter);<NEW_LINE>recycler.addOnScrollListener(getLoadMore());<NEW_LINE>recycler.addDivider();<NEW_LINE>if (getPresenter().getGists().isEmpty() && !getPresenter().isApiCalled()) {<NEW_LINE>onRefresh();<NEW_LINE>}<NEW_LINE>fastScroller.attachRecyclerView(recycler);<NEW_LINE>} | getPresenter().getPreviousTotal()); |
1,688,440 | public String parseLineText(String line) {<NEW_LINE>if (line.startsWith("#")) {<NEW_LINE>Pattern aName = Pattern.compile("^#[A-Za-z0-9_]+ =$");<NEW_LINE>Matcher mN = aName.matcher(line);<NEW_LINE>if (mN.find()) {<NEW_LINE>return line.substring(1).split(" ")[0];<NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>Matcher mR = patRegionStr.matcher(line);<NEW_LINE>String asOffset = ".asOffset()";<NEW_LINE>if (mR.find()) {<NEW_LINE>if (line.length() >= mR.end() + asOffset.length()) {<NEW_LINE>if (line.substring(mR.end()).contains(asOffset)) {<NEW_LINE>return line.substring(mR.start(), mR.end()) + asOffset;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return line.substring(mR.start(), mR.end());<NEW_LINE>}<NEW_LINE>Matcher mL = patLocationStr.matcher(line);<NEW_LINE>if (mL.find()) {<NEW_LINE>return line.substring(mL.start(), mL.end());<NEW_LINE>}<NEW_LINE>Matcher mP = patPatternStr.matcher(line);<NEW_LINE>if (mP.find()) {<NEW_LINE>return line.substring(mP.start(), mP.end());<NEW_LINE>}<NEW_LINE>Matcher mI = patPngStr.matcher(line);<NEW_LINE>if (mI.find()) {<NEW_LINE>return line.substring(mI.start(<MASK><NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>} | ), mI.end()); |
1,470,222 | public MqttMessage toExternal(RowData rowData, MqttMessage output) throws Exception {<NEW_LINE>Map<String, Object> map;<NEW_LINE>int arity = rowData.getArity();<NEW_LINE>ColumnRowData row = (ColumnRowData) rowData;<NEW_LINE>if (emqxConf.getTableFields() != null && emqxConf.getTableFields().size() >= arity && !(row.getField(0) instanceof MapColumn)) {<NEW_LINE>map = new LinkedHashMap<>((arity << 2) / 3);<NEW_LINE>for (int i = 0; i < arity; i++) {<NEW_LINE>Object obj = row.getField(i);<NEW_LINE>Object value;<NEW_LINE>if (obj instanceof TimestampColumn) {<NEW_LINE>value = ((TimestampColumn) obj).asTimestampStr();<NEW_LINE>} else {<NEW_LINE>value = org.apache.flink.util.StringUtils.arrayAwareToString(obj);<NEW_LINE>}<NEW_LINE>map.put(emqxConf.getTableFields()<MASK><NEW_LINE>}<NEW_LINE>} else if (arity == 1) {<NEW_LINE>Object obj = row.getField(0);<NEW_LINE>if (obj instanceof MapColumn) {<NEW_LINE>map = (Map<String, Object>) ((MapColumn) obj).getData();<NEW_LINE>} else if (obj instanceof StringColumn) {<NEW_LINE>map = jsonDecoder.decode(obj.toString());<NEW_LINE>} else {<NEW_LINE>map = Collections.singletonMap("message", row.getString());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>map = Collections.singletonMap("message", row.getString());<NEW_LINE>}<NEW_LINE>output.setPayload(MapUtil.writeValueAsString(map).getBytes());<NEW_LINE>return output;<NEW_LINE>} | .get(i), value); |
486,640 | public void extract(byte[] segmentBytes, Metadata metadata, JpegSegmentType segmentType) {<NEW_LINE>JpegDirectory directory = new JpegDirectory();<NEW_LINE>metadata.addDirectory(directory);<NEW_LINE>// The value of TAG_COMPRESSION_TYPE is determined by the segment type found<NEW_LINE>directory.setInt(JpegDirectory.TAG_COMPRESSION_TYPE, segmentType.byteValue - JpegSegmentType.SOF0.byteValue);<NEW_LINE>SequentialReader reader = new SequentialByteArrayReader(segmentBytes);<NEW_LINE>try {<NEW_LINE>directory.setInt(JpegDirectory.TAG_DATA_PRECISION, reader.getUInt8());<NEW_LINE>directory.setInt(JpegDirectory.TAG_IMAGE_HEIGHT, reader.getUInt16());<NEW_LINE>directory.setInt(JpegDirectory.TAG_IMAGE_WIDTH, reader.getUInt16());<NEW_LINE>short componentCount = reader.getUInt8();<NEW_LINE>directory.setInt(JpegDirectory.TAG_NUMBER_OF_COMPONENTS, componentCount);<NEW_LINE>// for each component, there are three bytes of data:<NEW_LINE>// 1 - Component ID: 1 = Y, 2 = Cb, 3 = Cr, 4 = I, 5 = Q<NEW_LINE>// 2 - Sampling factors: bit 0-3 vertical, 4-7 horizontal<NEW_LINE>// 3 - Quantization table number<NEW_LINE>for (int i = 0; i < (int) componentCount; i++) {<NEW_LINE>final int componentId = reader.getUInt8();<NEW_LINE>final <MASK><NEW_LINE>final int quantizationTableNumber = reader.getUInt8();<NEW_LINE>final JpegComponent component = new JpegComponent(componentId, samplingFactorByte, quantizationTableNumber);<NEW_LINE>directory.setObject(JpegDirectory.TAG_COMPONENT_DATA_1 + i, component);<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>directory.addError(ex.getMessage());<NEW_LINE>}<NEW_LINE>} | int samplingFactorByte = reader.getUInt8(); |
220,991 | public String build(OutputType outputType, String className, String serviceName) {<NEW_LINE>HashMap<String, List<MethodParameter.MethodModelParameter>> methods = new HashMap<>();<NEW_LINE>for (MethodParameter.MethodModelParameter methodModelParameter : this.methodModelParameter) {<NEW_LINE>String methodName = methodModelParameter.getName();<NEW_LINE>if (methodModelParameter.getMethod().getMethodType(false) == Method.MethodType.CONSTRUCTOR) {<NEW_LINE>methodName = "__construct";<NEW_LINE>}<NEW_LINE>if (methods.containsKey(methodModelParameter.getName())) {<NEW_LINE>methods.get<MASK><NEW_LINE>} else {<NEW_LINE>methods.put(methodName, new ArrayList<>(Collections.singletonList(methodModelParameter)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (outputType == OutputType.Yaml) {<NEW_LINE>return buildYaml(methods, className, serviceName);<NEW_LINE>}<NEW_LINE>if (outputType == OutputType.XML) {<NEW_LINE>return buildXml(methods, className, serviceName);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | (methodName).add(methodModelParameter); |
1,631,114 | public String initNetwork(@Nullable String networkName, @Nullable String networkPrefix) {<NEW_LINE>try {<NEW_LINE>WebTarget webTarget = getTarget(CoordConsts.SVC_RSC_INIT_NETWORK);<NEW_LINE>// postData will close it<NEW_LINE>@SuppressWarnings("PMD.CloseResource")<NEW_LINE>MultiPart multiPart = new MultiPart();<NEW_LINE>multiPart.setMediaType(MediaType.MULTIPART_FORM_DATA_TYPE);<NEW_LINE>addTextMultiPart(multiPart, CoordConsts.<MASK><NEW_LINE>if (networkName != null) {<NEW_LINE>addTextMultiPart(multiPart, CoordConsts.SVC_KEY_NETWORK_NAME, networkName);<NEW_LINE>} else {<NEW_LINE>addTextMultiPart(multiPart, CoordConsts.SVC_KEY_NETWORK_PREFIX, networkPrefix);<NEW_LINE>}<NEW_LINE>JSONObject jObj = postData(webTarget, multiPart);<NEW_LINE>if (jObj == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!jObj.has(CoordConsts.SVC_KEY_NETWORK_NAME)) {<NEW_LINE>_logger.errorf("network name key not found in: %s\n", jObj);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return jObj.getString(CoordConsts.SVC_KEY_NETWORK_NAME);<NEW_LINE>} catch (Exception e) {<NEW_LINE>_logger.errorf("exception: ");<NEW_LINE>_logger.error(Throwables.getStackTraceAsString(e) + "\n");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | SVC_KEY_API_KEY, _settings.getApiKey()); |
1,019,786 | private void registerScoreFunctions(List<SearchPlugin> plugins) {<NEW_LINE>registerScoreFunction(new ScoreFunctionSpec<>(ScriptScoreFunctionBuilder.NAME, ScriptScoreFunctionBuilder<MASK><NEW_LINE>registerScoreFunction(new ScoreFunctionSpec<>(GaussDecayFunctionBuilder.NAME, GaussDecayFunctionBuilder::new, GaussDecayFunctionBuilder.PARSER));<NEW_LINE>registerScoreFunction(new ScoreFunctionSpec<>(LinearDecayFunctionBuilder.NAME, LinearDecayFunctionBuilder::new, LinearDecayFunctionBuilder.PARSER));<NEW_LINE>registerScoreFunction(new ScoreFunctionSpec<>(ExponentialDecayFunctionBuilder.NAME, ExponentialDecayFunctionBuilder::new, ExponentialDecayFunctionBuilder.PARSER));<NEW_LINE>registerScoreFunction(new ScoreFunctionSpec<>(RandomScoreFunctionBuilder.NAME, RandomScoreFunctionBuilder::new, RandomScoreFunctionBuilder::fromXContent));<NEW_LINE>registerScoreFunction(new ScoreFunctionSpec<>(FieldValueFactorFunctionBuilder.NAME, FieldValueFactorFunctionBuilder::new, FieldValueFactorFunctionBuilder::fromXContent));<NEW_LINE>// weight doesn't have its own parser, so every function supports it out of the box.<NEW_LINE>// Can be a single function too when not associated to any other function, which is why it needs to be registered manually here.<NEW_LINE>namedWriteables.add(new NamedWriteableRegistry.Entry(ScoreFunctionBuilder.class, WeightBuilder.NAME, WeightBuilder::new));<NEW_LINE>registerFromPlugin(plugins, SearchPlugin::getScoreFunctions, this::registerScoreFunction);<NEW_LINE>} | ::new, ScriptScoreFunctionBuilder::fromXContent)); |
1,415,705 | private static void printBoard(Board board) {<NEW_LINE>StringBuilder topLines = new StringBuilder();<NEW_LINE>StringBuilder midLines = new StringBuilder();<NEW_LINE>for (int x = 0; x < board.getSize(); ++x) {<NEW_LINE>topLines.append("+--------");<NEW_LINE>midLines.append("| ");<NEW_LINE>}<NEW_LINE>topLines.append("+");<NEW_LINE>midLines.append("|");<NEW_LINE>for (int y = 0; y < board.getSize(); ++y) {<NEW_LINE>System.out.println(topLines);<NEW_LINE>System.out.println(midLines);<NEW_LINE>for (int x = 0; x < board.getSize(); ++x) {<NEW_LINE>Cell cell = new Cell(x, y);<NEW_LINE><MASK><NEW_LINE>if (board.isEmpty(cell)) {<NEW_LINE>System.out.print(" ");<NEW_LINE>} else {<NEW_LINE>StringBuilder output = new StringBuilder(Integer.toString(board.getCell(cell)));<NEW_LINE>while (output.length() < 8) {<NEW_LINE>output.append(" ");<NEW_LINE>if (output.length() < 8) {<NEW_LINE>output.insert(0, " ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.print(output);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("|");<NEW_LINE>System.out.println(midLines);<NEW_LINE>}<NEW_LINE>System.out.println(topLines);<NEW_LINE>System.out.println("Score: " + board.getScore());<NEW_LINE>} | System.out.print("|"); |
1,764,501 | private BeanDefinitionBuilder parseUdp(Element element, ParserContext parserContext) {<NEW_LINE>BeanDefinitionBuilder builder;<NEW_LINE>String multicast = IpAdapterParserUtils.getMulticast(element);<NEW_LINE>if (multicast.equals("true")) {<NEW_LINE>builder = BeanDefinitionBuilder.genericBeanDefinition(MulticastSendingMessageHandler.class);<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IpAdapterParserUtils.MIN_ACKS_SUCCESS, "minAcksForSuccess");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IpAdapterParserUtils.TIME_TO_LIVE, "timeToLive");<NEW_LINE>} else {<NEW_LINE>builder = BeanDefinitionBuilder.genericBeanDefinition(UnicastSendingMessageHandler.class);<NEW_LINE>}<NEW_LINE>IpAdapterParserUtils.addDestinationConfigToConstructor(element, builder, parserContext);<NEW_LINE>IpAdapterParserUtils.addConstructorValueIfAttributeDefined(builder, element, IpAdapterParserUtils.CHECK_LENGTH);<NEW_LINE>IpAdapterParserUtils.addConstructorValueIfAttributeDefined(builder, element, IpAdapterParserUtils.ACK);<NEW_LINE>IpAdapterParserUtils.addConstructorValueIfAttributeDefined(builder, element, IpAdapterParserUtils.ACK_HOST);<NEW_LINE>IpAdapterParserUtils.addConstructorValueIfAttributeDefined(builder, element, IpAdapterParserUtils.ACK_PORT);<NEW_LINE>IpAdapterParserUtils.addConstructorValueIfAttributeDefined(builder, element, IpAdapterParserUtils.ACK_TIMEOUT);<NEW_LINE>String ack = element.getAttribute(IpAdapterParserUtils.ACK);<NEW_LINE>if (ack.equals("true") && (!StringUtils.hasText(element.getAttribute(IpAdapterParserUtils.ACK_HOST)) || !StringUtils.hasText(element.getAttribute(IpAdapterParserUtils.ACK_PORT)) || !StringUtils.hasText(element.getAttribute(IpAdapterParserUtils.ACK_TIMEOUT)))) {<NEW_LINE>parserContext.getReaderContext().error("When " + IpAdapterParserUtils.ACK + " is true, " + IpAdapterParserUtils.ACK_HOST + ", " + IpAdapterParserUtils.ACK_PORT + ", and " + IpAdapterParserUtils.ACK_TIMEOUT + " must be supplied", element);<NEW_LINE>}<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IpAdapterParserUtils.RECEIVE_BUFFER_SIZE);<NEW_LINE>IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, IpAdapterParserUtils.TASK_EXECUTOR);<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "socket-expression", "socketExpressionString");<NEW_LINE>IntegrationNamespaceUtils.setReferenceIfAttributeDefined(<MASK><NEW_LINE>return builder;<NEW_LINE>} | builder, element, IpAdapterParserUtils.UDP_SOCKET_CUSTOMIZER); |
368,668 | public okhttp3.Call readNamespacedCronJobStatusCall(String name, String namespace, String pretty, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString())).replaceAll("\\{" + "namespace" + "\\}", localVarApiClient.escapeString(namespace.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (pretty != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("pretty", pretty));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new <MASK><NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "BearerToken" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | HashMap<String, String>(); |
688,003 | private void updateFont(final String font, final boolean force) {<NEW_LINE>final BrowserVersion browserVersion = getBrowserVersion();<NEW_LINE>final String[] details = ComputedFont.getDetails(font, browserVersion);<NEW_LINE>if (details != null || force) {<NEW_LINE>final StringBuilder newFont = new StringBuilder();<NEW_LINE>newFont.append(getFontSize());<NEW_LINE>String lineHeight = getLineHeight();<NEW_LINE>final String defaultLineHeight = LINE_HEIGHT.getDefaultComputedValue(browserVersion);<NEW_LINE>if (lineHeight.isEmpty()) {<NEW_LINE>lineHeight = defaultLineHeight;<NEW_LINE>}<NEW_LINE>if (browserVersion.hasFeature(CSS_ZINDEX_TYPE_INTEGER) || !lineHeight.equals(defaultLineHeight)) {<NEW_LINE>newFont.append('/');<NEW_LINE>if (lineHeight.equals(defaultLineHeight)) {<NEW_LINE>newFont.append(LINE_HEIGHT.getDefaultComputedValue(browserVersion));<NEW_LINE>} else {<NEW_LINE>newFont.append(lineHeight);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>newFont.append(' ').append(getFontFamily());<NEW_LINE>setStyleAttribute(FONT.getAttributeName(<MASK><NEW_LINE>}<NEW_LINE>} | ), newFont.toString()); |
561,403 | public void next() {<NEW_LINE>if (iter.hasNext()) {<NEW_LINE>try {<NEW_LINE>Handler<DeliveryContext> handler = iter.next();<NEW_LINE>if (handler != null) {<NEW_LINE>handler.handle(this);<NEW_LINE>} else {<NEW_LINE>next();<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>log.error("Failure in interceptor", t);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Object m = metric;<NEW_LINE>VertxTracer tracer = context.tracer();<NEW_LINE>if (bus.metrics != null) {<NEW_LINE>bus.metrics.messageDelivered(<MASK><NEW_LINE>}<NEW_LINE>if (tracer != null && !src) {<NEW_LINE>message.trace = tracer.receiveRequest(context, SpanKind.RPC, TracingPolicy.PROPAGATE, message, message.isSend() ? "send" : "publish", message.headers(), MessageTagExtractor.INSTANCE);<NEW_LINE>HandlerRegistration.this.dispatch(message, context, handler);<NEW_LINE>Object trace = message.trace;<NEW_LINE>if (message.replyAddress == null && trace != null) {<NEW_LINE>tracer.sendResponse(context, null, trace, null, TagExtractor.empty());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>HandlerRegistration.this.dispatch(message, context, handler);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | m, message.isLocal()); |
617,640 | protected ArrayList<FileSystem.Classpath> handleModuleSourcepath(String arg) {<NEW_LINE>ArrayList<String> modulePaths = processModulePathEntries(arg);<NEW_LINE>ArrayList<FileSystem.Classpath> result = new ArrayList<>();<NEW_LINE>if ((modulePaths != null) && (modulePaths.size() != 0)) {<NEW_LINE>if (this.destinationPath == null) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>addPendingErrors(this.bind("configure.missingDestinationPath"));<NEW_LINE>}<NEW_LINE>String[] paths = new String[modulePaths.size()];<NEW_LINE>modulePaths.toArray(paths);<NEW_LINE>for (int i = 0; i < paths.length; i++) {<NEW_LINE>File dir = new File(paths[i]);<NEW_LINE>if (dir.isDirectory()) {<NEW_LINE>// 1. Create FileSystem.Classpath for each module<NEW_LINE>// 2. Iterator each module in case of directory for source files and add to this.fileNames<NEW_LINE>List<Classpath> modules = ModuleFinder.findModules(dir, this.destinationPath, getNewParser(), this.options, false, this.releaseVersion);<NEW_LINE>for (Classpath classpath : modules) {<NEW_LINE>result.add(classpath);<NEW_LINE>Path modLocation = Paths.get(classpath.getPath()).toAbsolutePath();<NEW_LINE>String destPath = classpath.getDestinationPath();<NEW_LINE>IModule mod = classpath.getModule();<NEW_LINE>String moduleName = mod == null ? null : new String(mod.name());<NEW_LINE>for (int j = 0; j < this.filenames.length; j++) {<NEW_LINE>Path filePath;<NEW_LINE>try {<NEW_LINE>// Get canonical path just as the classpath location is stored with the same.<NEW_LINE>// To avoid mismatch of /USER_JAY and /USE~1 in windows systems.<NEW_LINE>filePath = new File(this.filenames[j]).getCanonicalFile().toPath();<NEW_LINE>if (filePath.startsWith(modLocation)) {<NEW_LINE>this.modNames[j] = moduleName;<NEW_LINE>this.destinationPaths[j] = destPath;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Files doesn't exist and perhaps doesn't belong in a module, move on to other files<NEW_LINE>// Use empty module name to distinguish from missing module case<NEW_LINE>// $NON-NLS-1$<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int j = 0; j < this.filenames.length; j++) {<NEW_LINE>if (this.modNames[j] == null) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new IllegalArgumentException(this.bind("configure.notOnModuleSourcePath", new String[] { this.filenames[j] }));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | this.modNames[j] = ""; |
1,681,203 | public void toggleLock(final NodeModel node, PasswordStrategy passwordStrategy) {<NEW_LINE>final EncryptionModel encryptionModel = EncryptionModel.getModel(node);<NEW_LINE>if (encryptionModel != null) {<NEW_LINE>final <MASK><NEW_LINE>final boolean wasAccessible = encryptionModel.isAccessible();<NEW_LINE>if (!wasAccessible && !doPasswordCheckAndDecryptNode(node, encryptionModel, passwordStrategy))<NEW_LINE>return;<NEW_LINE>final boolean becomesFolded = true;<NEW_LINE>final boolean becomesAccessible = !wasAccessible;<NEW_LINE>Controller.getCurrentController().getSelection().selectAsTheOnlyOneSelected(node);<NEW_LINE>final MapWriter mapWriter = Controller.getCurrentModeController().getMapController().getMapWriter();<NEW_LINE>final IActor actor = new IActor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isReadonly() {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void act() {<NEW_LINE>apply(becomesAccessible, becomesFolded, wasFolded);<NEW_LINE>}<NEW_LINE><NEW_LINE>private void apply(boolean becomesAccessible, boolean becomesFolded, boolean wasFolded) {<NEW_LINE>if (encryptionModel.isAccessible() == becomesAccessible)<NEW_LINE>return;<NEW_LINE>if (becomesAccessible) {<NEW_LINE>encryptionModel.unlock();<NEW_LINE>} else {<NEW_LINE>encryptionModel.lock(mapWriter);<NEW_LINE>}<NEW_LINE>final boolean encryptionSucceeded = encryptionModel.isAccessible() == becomesAccessible;<NEW_LINE>if (encryptionSucceeded) {<NEW_LINE>if (becomesFolded != wasFolded) {<NEW_LINE>node.setFolded(becomesFolded);<NEW_LINE>}<NEW_LINE>fireEncryptionChangedEvent(node);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getDescription() {<NEW_LINE>return "toggleCryptState";<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void undo() {<NEW_LINE>apply(wasAccessible, wasFolded, becomesFolded);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Controller.getCurrentModeController().execute(actor, node.getMap());<NEW_LINE>} else {<NEW_LINE>encrypt(node, passwordStrategy);<NEW_LINE>}<NEW_LINE>} | boolean wasFolded = node.isFolded(); |
1,746,668 | public static Container copyContainer(Container currentContainer) throws DotDataException, DotStateException, DotSecurityException {<NEW_LINE>HostAPI hostAPI = APILocator.getHostAPI();<NEW_LINE>// gets the new information for the template from the request object<NEW_LINE>Container newContainer = new Container();<NEW_LINE>newContainer.copy(currentContainer);<NEW_LINE>newContainer.setFriendlyName(currentContainer.getFriendlyName() + " (COPY) ");<NEW_LINE>newContainer.setTitle(currentContainer.getTitle() + " (COPY) ");<NEW_LINE>// Copy the structure<NEW_LINE>// Structure st = CacheLocator.getContentTypeCache().getStructureByInode(currentContainer.getStructureInode());<NEW_LINE>// newContainer.setStructureInode(st.getInode());<NEW_LINE>// persists the webasset<NEW_LINE>HibernateUtil.saveOrUpdate(newContainer);<NEW_LINE>// Copy the host<NEW_LINE>Host h;<NEW_LINE>try {<NEW_LINE>h = hostAPI.findParentHost(currentContainer, APILocator.getUserAPI().getSystemUser(), false);<NEW_LINE>} catch (DotSecurityException e) {<NEW_LINE>Logger.error(ContainerFactory.class, e.getMessage(), e);<NEW_LINE>throw new DotRuntimeException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>// TreeFactory.saveTree(new Tree(h.getIdentifier(), newContainer.getInode()));<NEW_LINE>// creates new identifier for this webasset and persists it<NEW_LINE>Identifier newIdentifier = APILocator.getIdentifierAPI().createNew(newContainer, h);<NEW_LINE>// save identifier id<NEW_LINE>HibernateUtil.saveOrUpdate(newContainer);<NEW_LINE>APILocator.getVersionableAPI().setWorking(newContainer);<NEW_LINE>if (currentContainer.isLive())<NEW_LINE>APILocator.getVersionableAPI().setLive(newContainer);<NEW_LINE>PermissionAPI perAPI = APILocator.getPermissionAPI();<NEW_LINE>// Copy permissions<NEW_LINE>perAPI.copyPermissions(currentContainer, newContainer);<NEW_LINE>// saves to working folder under velocity<NEW_LINE>new <MASK><NEW_LINE>// issue-2093 Copying multiple structures per container<NEW_LINE>if (currentContainer.getMaxContentlets() > 0) {<NEW_LINE>List<ContainerStructure> sourceCS = APILocator.getContainerAPI().getContainerStructures(currentContainer);<NEW_LINE>List<ContainerStructure> newContainerCS = new LinkedList<ContainerStructure>();<NEW_LINE>for (ContainerStructure oldCS : sourceCS) {<NEW_LINE>ContainerStructure newCS = new ContainerStructure();<NEW_LINE>newCS.setContainerId(newContainer.getIdentifier());<NEW_LINE>newCS.setContainerInode(newContainer.getInode());<NEW_LINE>newCS.setStructureId(oldCS.getStructureId());<NEW_LINE>newCS.setCode(oldCS.getCode());<NEW_LINE>newContainerCS.add(newCS);<NEW_LINE>}<NEW_LINE>APILocator.getContainerAPI().saveContainerStructures(newContainerCS);<NEW_LINE>}<NEW_LINE>return newContainer;<NEW_LINE>} | ContainerLoader().invalidate(newContainer); |
1,672,285 | public DeploymentCanarySettings unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeploymentCanarySettings deploymentCanarySettings = new DeploymentCanarySettings();<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("percentTraffic", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentCanarySettings.setPercentTraffic(context.getUnmarshaller(Double.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("stageVariableOverrides", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentCanarySettings.setStageVariableOverrides(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("useStageCache", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentCanarySettings.setUseStageCache(context.getUnmarshaller(Boolean.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return deploymentCanarySettings;<NEW_LINE>} | )).unmarshall(context)); |
831,896 | public Object deriveTrueTypeFont(Object font, float size, int weight) {<NEW_LINE>java.awt.Font fnt;<NEW_LINE>if (font instanceof int[]) {<NEW_LINE>fnt = createAWTFont((int[]) font);<NEW_LINE>} else {<NEW_LINE>fnt = (java.awt.Font) font;<NEW_LINE>}<NEW_LINE>int style = java.awt.Font.PLAIN;<NEW_LINE>if ((weight & com.codename1.ui.Font.STYLE_BOLD) == com.codename1.ui.Font.STYLE_BOLD) {<NEW_LINE>style = java.awt.Font.BOLD;<NEW_LINE>}<NEW_LINE>if ((weight & com.codename1.ui.Font.STYLE_ITALIC) == com.codename1.ui.Font.STYLE_ITALIC) {<NEW_LINE>style = style <MASK><NEW_LINE>}<NEW_LINE>java.awt.Font fff = fnt.deriveFont(style, (float) (size * getFontScale()));<NEW_LINE>if (Math.abs(size / 2 - fff.getSize()) < 3) {<NEW_LINE>// retina display bug!<NEW_LINE>return fnt.deriveFont(style, (float) (size * 2 * getFontScale()));<NEW_LINE>}<NEW_LINE>return fff;<NEW_LINE>} | | java.awt.Font.ITALIC; |
98,623 | private void initClasspath() {<NEW_LINE>ClasspathInfo.Builder bld = new ClasspathInfo.Builder(projectInfo.getClassPath(ClasspathInfo.PathKind.BOOT));<NEW_LINE>ClassPath snippetSource = ClassPathSupport.createProxyClassPath(projectInfo.getClassPath(PathKind.SOURCE), ClassPathSupport.createClassPath(editorWorkRoot), ClassPathSupport.createClassPath(workRoot));<NEW_LINE>ClassPath compileClasspath = projectInfo.getClassPath(PathKind.COMPILE);<NEW_LINE>ClassPath modBoot = projectInfo.getClassPath(ClasspathInfo.PathKind.MODULE_BOOT);<NEW_LINE>ClassPath modClass = projectInfo.getClassPath(ClasspathInfo.PathKind.MODULE_CLASS);<NEW_LINE>ClassPath modCompile = projectInfo.getClassPath(ClasspathInfo.PathKind.MODULE_COMPILE);<NEW_LINE>bld.setClassPath(compileClasspath).setSourcePath(snippetSource).setModuleBootPath(modBoot).setModuleClassPath(modClass).setModuleCompilePath(modCompile);<NEW_LINE>this.cpInfo = bld.build();<NEW_LINE>this.consoleDocument.<MASK><NEW_LINE>} | putProperty("java.classpathInfo", this.cpInfo); |
843,644 | private Collection<Callback> callbacksForDataSource(String dataSourceName) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException {<NEW_LINE>final Optional<List<String>> callbackConfig = flywayBuildConfig.getConfigForDataSourceName(dataSourceName).callbacks;<NEW_LINE>if (!callbackConfig.isPresent()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>final Collection<String> callbacks = callbackConfig.get();<NEW_LINE>final Collection<Callback> instances = new ArrayList<>(callbacks.size());<NEW_LINE>for (String callback : callbacks) {<NEW_LINE>final ClassInfo clazz = combinedIndexBuildItem.getIndex().getClassByName(DotName.createSimple(callback));<NEW_LINE>Objects.requireNonNull(clazz, "Flyway callback not found, please verify the fully qualified name for the class: " + callback);<NEW_LINE>if (Modifier.isAbstract(clazz.flags()) || !clazz.hasNoArgsConstructor()) {<NEW_LINE>throw new IllegalArgumentException("Invalid Flyway callback. It shouldn't be abstract and must have a default constructor");<NEW_LINE>}<NEW_LINE>final Class<?> clazzType = Class.forName(callback, false, Thread.currentThread().getContextClassLoader());<NEW_LINE>final Callback instance = (Callback) clazzType.getConstructors()[0].newInstance();<NEW_LINE>instances.add(instance);<NEW_LINE>reflectiveClassProducer.produce(new ReflectiveClassBuildItem(false, false, clazz.name<MASK><NEW_LINE>}<NEW_LINE>return instances;<NEW_LINE>} | ().toString())); |
487,288 | private static List<TypeRecord> recursiveDepthFirstSearch(final ArrayDeque<TypeRecord> pathFromRoot, final TypeElement target, final Types types) {<NEW_LINE>if (pathFromRoot.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final TypeElement currentElement = currentRecord.element;<NEW_LINE>if (currentElement.equals(target)) {<NEW_LINE>return new ArrayList<>(pathFromRoot);<NEW_LINE>}<NEW_LINE>final Iterator<? extends TypeMirror> interfaces = currentElement.getInterfaces().iterator();<NEW_LINE>final TypeMirror superclassType = currentElement.getSuperclass();<NEW_LINE>List<TypeRecord> path = null;<NEW_LINE>while (path == null && interfaces.hasNext()) {<NEW_LINE>final TypeMirror intface = interfaces.next();<NEW_LINE>if (intface.getKind() != TypeKind.NONE) {<NEW_LINE>DeclaredType interfaceDeclared = (DeclaredType) intface;<NEW_LINE>pathFromRoot.addLast(new TypeRecord((TypeElement) types.asElement(interfaceDeclared), interfaceDeclared));<NEW_LINE>path = recursiveDepthFirstSearch(pathFromRoot, target, types);<NEW_LINE>pathFromRoot.removeLast();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (path == null && superclassType.getKind() != TypeKind.NONE) {<NEW_LINE>final DeclaredType superclass = (DeclaredType) superclassType;<NEW_LINE>pathFromRoot.addLast(new TypeRecord((TypeElement) types.asElement(superclass), superclass));<NEW_LINE>path = recursiveDepthFirstSearch(pathFromRoot, target, types);<NEW_LINE>pathFromRoot.removeLast();<NEW_LINE>}<NEW_LINE>return path;<NEW_LINE>} | TypeRecord currentRecord = pathFromRoot.peekLast(); |
1,294,919 | private void initPoiAdditionals(Collection<PoiType> poiAdditionals, Set<String> excludedPoiAdditionalCategories) {<NEW_LINE>Set<String> selectedCategories = new LinkedHashSet<>();<NEW_LINE>Set<String> topTrueOnlyCategories = new LinkedHashSet<>();<NEW_LINE>Set<String> <MASK><NEW_LINE>for (PoiType poiType : poiAdditionals) {<NEW_LINE>String category = poiType.getPoiAdditionalCategory();<NEW_LINE>if (category != null) {<NEW_LINE>topTrueOnlyCategories.add(category);<NEW_LINE>topFalseOnlyCategories.add(category);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (PoiType poiType : poiAdditionals) {<NEW_LINE>String category = poiType.getPoiAdditionalCategory();<NEW_LINE>if (category == null) {<NEW_LINE>category = "";<NEW_LINE>}<NEW_LINE>if (excludedPoiAdditionalCategories != null && excludedPoiAdditionalCategories.contains(category)) {<NEW_LINE>topTrueOnlyCategories.remove(category);<NEW_LINE>topFalseOnlyCategories.remove(category);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!poiType.isTopVisible()) {<NEW_LINE>topTrueOnlyCategories.remove(category);<NEW_LINE>} else {<NEW_LINE>topFalseOnlyCategories.remove(category);<NEW_LINE>}<NEW_LINE>String keyName = poiType.getKeyName().replace('_', ':').replace(' ', ':').toLowerCase();<NEW_LINE>if (selectedPoiAdditionals.contains(keyName)) {<NEW_LINE>selectedCategories.add(category);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String category : topTrueOnlyCategories) {<NEW_LINE>if (!showAllCategories.contains(category)) {<NEW_LINE>showAllCategories.add(category);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String category : topFalseOnlyCategories) {<NEW_LINE>if (!collapsedCategories.contains(category) && !showAllCategories.contains(category)) {<NEW_LINE>if (!selectedCategories.contains(category)) {<NEW_LINE>collapsedCategories.add(category);<NEW_LINE>}<NEW_LINE>showAllCategories.add(category);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | topFalseOnlyCategories = new LinkedHashSet<>(); |
501,568 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String eplSchema = "@public create schema Lvl2(id string);\n" + "@public create schema Lvl1(lvl2 Lvl2[]);\n" + "@public @buseventtype create schema Lvl0(lvl1 Lvl1, indexNumber int, lvl0id string);\n";<NEW_LINE>env.compileDeploy(eplSchema, path);<NEW_LINE>String epl = "@name('s0') select lvl1.lvl2[indexNumber].id as c0, me.lvl1.lvl2[indexNumber].id as c1 from Lvl0 as me";<NEW_LINE>env.compileDeploy(epl, path).addListener("s0");<NEW_LINE>String[] fields = "c0,c1".split(",");<NEW_LINE>env.assertStmtTypesAllSame("s0", fields, EPTypePremade.STRING.getEPType());<NEW_LINE>Map<String, Object> lvl2One = CollectionUtil.buildMap("id", "a");<NEW_LINE>Map<String, Object> lvl2Two = CollectionUtil.buildMap("id", "b");<NEW_LINE>Map<String, Object> lvl1 = CollectionUtil.buildMap("lvl2", new Map[] { lvl2One, lvl2Two });<NEW_LINE>Map<String, Object> lvl0 = CollectionUtil.buildMap("lvl1", lvl1, "indexNumber", 1);<NEW_LINE>env.sendEventMap(lvl0, "Lvl0");<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "b", "b" });<NEW_LINE>// Invalid tests<NEW_LINE>// array value but no array provided<NEW_LINE>env.tryInvalidCompile(path, "select lvl1.lvl2.id from Lvl0", "Failed to validate select-clause expression 'lvl1.lvl2.id': Failed to find a stream named 'lvl1' (did you mean 'Lvl0'?)");<NEW_LINE>env.tryInvalidCompile(path, "select me.lvl1.lvl2.id from Lvl0 as me", "Failed to validate select-clause expression 'me.lvl1.lvl2.id': Failed to resolve property 'me.lvl1.lvl2.id' to a stream or nested property in a stream");<NEW_LINE>// two index expressions<NEW_LINE>env.tryInvalidCompile(path, "select lvl1.lvl2[indexNumber, indexNumber].id from Lvl0", "Failed to validate select-clause expression 'lvl1.lvl2[indexNumber,indexNumber].id': Incorrect number of index expressions for array operation, expected a single expression returning an integer value but received 2 expressions for operation on type collection of events of type 'Lvl2'");<NEW_LINE>env.tryInvalidCompile(path, "select me.lvl1.lvl2[indexNumber, indexNumber].id from Lvl0 as me", "Failed to validate select-clause expression 'me.lvl1.lvl2[indexNumber,indexNumber].id': Incorrect number of index expressions for array operation, expected a single expression returning an integer value but received 2 expressions for operation on type collection of events of type 'Lvl2'");<NEW_LINE>// double-array<NEW_LINE>env.tryInvalidCompile(path, "select lvl1.lvl2[indexNumber][indexNumber].id from Lvl0", "Failed to validate select-clause expression 'lvl1.lvl2[indexNumber][indexNumber].id': Could not perform array operation on type event type 'Lvl2'");<NEW_LINE>env.<MASK><NEW_LINE>// wrong index expression type<NEW_LINE>env.tryInvalidCompile(path, "select lvl1.lvl2[lvl0id].id from Lvl0", "Failed to validate select-clause expression 'lvl1.lvl2[lvl0id].id': Incorrect index expression for array operation, expected an expression returning an integer value but the expression 'lvl0id' returns 'String' for operation on type collection of events of type 'Lvl2'");<NEW_LINE>env.tryInvalidCompile(path, "select me.lvl1.lvl2[lvl0id].id from Lvl0 as me", "Failed to validate select-clause expression 'me.lvl1.lvl2[lvl0id].id': Incorrect index expression for array operation, expected an expression returning an integer value but the expression 'lvl0id' returns 'String' for operation on type collection of events of type 'Lvl2'");<NEW_LINE>env.undeployAll();<NEW_LINE>} | tryInvalidCompile(path, "select me.lvl1.lvl2[indexNumber][indexNumber].id from Lvl0 as me", "Failed to validate select-clause expression 'me.lvl1.lvl2[indexNumber][indexNumb...(41 chars)': Could not perform array operation on type event type 'Lvl2'"); |
1,217,525 | public static void copyFile(File sourceFile, File destFile) throws IOException {<NEW_LINE>final String methodName = "copyFile(File,File)";<NEW_LINE>if (enableLogging) {<NEW_LINE>Log.info(c, methodName, "Copying " + sourceFile + " to " + destFile);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (parentFile != null && !parentFile.exists()) {<NEW_LINE>if (enableLogging) {<NEW_LINE>Log.info(c, methodName, "Creating parent directory " + parentFile);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Files.createDirectories(parentFile.toPath());<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>Log.error(c, methodName, ioe, "Failed to create directory " + parentFile);<NEW_LINE>throw ioe;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Files.copy(sourceFile.toPath(), destFile.toPath(), StandardCopyOption.REPLACE_EXISTING);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>Log.error(c, methodName, ioe, "Failed to copy file " + sourceFile + " to " + destFile);<NEW_LINE>throw ioe;<NEW_LINE>}<NEW_LINE>} | File parentFile = destFile.getParentFile(); |
1,786,878 | private static void tryMT(RegressionEnvironment env, int numSeconds, int numWriteThreads) throws InterruptedException {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String eplCreateVariable = "@public create table varagg (c0 int, c1 int, c2 int, c3 int, c4 int, c5 int)";<NEW_LINE>env.compileDeploy(eplCreateVariable, path);<NEW_LINE>String eplMerge = "on SupportBean_S0 merge varagg " + "when not matched then insert select -1 as c0, -1 as c1, -1 as c2, -1 as c3, -1 as c4, -1 as c5 " + "when matched then update set c0=id, c1=id, c2=id, c3=id, c4=id, c5=id";<NEW_LINE>env.compileDeploy(eplMerge, path);<NEW_LINE>String eplQuery = "@name('s0') select varagg.c0 as c0, varagg.c1 as c1, varagg.c2 as c2," + "varagg.c3 as c3, varagg.c4 as c4, varagg.c5 as c5 from SupportBean_S1";<NEW_LINE>env.compileDeploy(eplQuery, path).addListener("s0");<NEW_LINE>Thread[<MASK><NEW_LINE>WriteRunnable[] writeRunnables = new WriteRunnable[numWriteThreads];<NEW_LINE>for (int i = 0; i < writeThreads.length; i++) {<NEW_LINE>writeRunnables[i] = new WriteRunnable(env, i);<NEW_LINE>writeThreads[i] = new Thread(writeRunnables[i], InfraTableMTUngroupedAccessReadMergeWrite.class.getSimpleName() + "-write");<NEW_LINE>writeThreads[i].start();<NEW_LINE>}<NEW_LINE>ReadRunnable readRunnable = new ReadRunnable(env, env.listener("s0"));<NEW_LINE>Thread readThread = new Thread(readRunnable, InfraTableMTUngroupedAccessReadMergeWrite.class.getSimpleName() + "-read");<NEW_LINE>readThread.start();<NEW_LINE>Thread.sleep(numSeconds * 1000);<NEW_LINE>// join<NEW_LINE>log.info("Waiting for completion");<NEW_LINE>for (int i = 0; i < writeThreads.length; i++) {<NEW_LINE>writeRunnables[i].setShutdown(true);<NEW_LINE>writeThreads[i].join();<NEW_LINE>assertNull(writeRunnables[i].getException());<NEW_LINE>}<NEW_LINE>readRunnable.setShutdown(true);<NEW_LINE>readThread.join();<NEW_LINE>env.undeployAll();<NEW_LINE>assertNull(readRunnable.getException());<NEW_LINE>} | ] writeThreads = new Thread[numWriteThreads]; |
443,680 | protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers) {<NEW_LINE>CharSequence key = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY);<NEW_LINE>if (key == null) {<NEW_LINE>throw new WebSocketServerHandshakeException("not a WebSocket request: missing key", req);<NEW_LINE>}<NEW_LINE>FullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS, req.content().alloc().buffer(0));<NEW_LINE>if (headers != null) {<NEW_LINE>res.<MASK><NEW_LINE>}<NEW_LINE>String acceptSeed = key + WEBSOCKET_08_ACCEPT_GUID;<NEW_LINE>byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII));<NEW_LINE>String accept = WebSocketUtil.base64(sha1);<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("WebSocket version 08 server handshake key: {}, response: {}", key, accept);<NEW_LINE>}<NEW_LINE>res.headers().set(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET).set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE).set(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT, accept);<NEW_LINE>String subprotocols = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL);<NEW_LINE>if (subprotocols != null) {<NEW_LINE>String selectedSubprotocol = selectSubprotocol(subprotocols);<NEW_LINE>if (selectedSubprotocol == null) {<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("Requested subprotocol(s) not supported: {}", subprotocols);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>res.headers().set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | headers().add(headers); |
641,433 | public static List<DrMemoryError> parse(File file, String encoding) {<NEW_LINE>var result = new ArrayList<DrMemoryError>();<NEW_LINE>List<String> elements = getElements(file, encoding);<NEW_LINE>for (var element : elements) {<NEW_LINE>var m = RX_MESSAGE_FINDER.matcher(element);<NEW_LINE>if (m.find()) {<NEW_LINE>var error = new DrMemoryError();<NEW_LINE>error.type = extractErrorType(m.group(1));<NEW_LINE>String[] elementSplitted = CxxUtils.EOL_PATTERN.split(element);<NEW_LINE>error.message = elementSplitted[0];<NEW_LINE>for (var elementPart : elementSplitted) {<NEW_LINE>var locationMatcher = RX_FILE_FINDER.matcher(elementPart);<NEW_LINE>if (locationMatcher.find()) {<NEW_LINE>var location = new Location();<NEW_LINE>location.file = locationMatcher.group(1);<NEW_LINE>location.line = Integer.valueOf<MASK><NEW_LINE>error.stackTrace.add(location);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>result.add(error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (locationMatcher.group(2)); |
1,039,379 | private void writeClear() {<NEW_LINE>Excerpt excerpt = getExcerpt(16, clear);<NEW_LINE>long eventId = excerpt.index();<NEW_LINE>excerpt.writeEnum(clear);<NEW_LINE>excerpt.finish();<NEW_LINE>if (!notifyOff && !listeners.isEmpty()) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Entry<K, V>[] entrySet = underlying.entrySet().toArray(new Entry[underlying.size()]);<NEW_LINE>for (int i = 0; i < listeners.size(); i++) {<NEW_LINE>MapListener<K, V> listener = listeners.get(i);<NEW_LINE>listener.eventStart(eventId, name);<NEW_LINE>for (int j = 0; j < entrySet.length; j++) {<NEW_LINE>listener.remove(entrySet[j].getKey(), entrySet<MASK><NEW_LINE>}<NEW_LINE>listener.eventEnd(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | [j].getValue()); |
351,371 | public DescribeAlarmHistoryResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeAlarmHistoryResult describeAlarmHistoryResult = new DescribeAlarmHistoryResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 2;<NEW_LINE>while (true) {<NEW_LINE>int xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent == XmlPullParser.END_DOCUMENT)<NEW_LINE>break;<NEW_LINE>if (xmlEvent == XmlPullParser.START_TAG) {<NEW_LINE>if (context.testExpression("AlarmHistoryItems/member", targetDepth)) {<NEW_LINE>describeAlarmHistoryResult.withAlarmHistoryItems(AlarmHistoryItemStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>describeAlarmHistoryResult.setNextToken(StringStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent == XmlPullParser.END_TAG) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return describeAlarmHistoryResult;<NEW_LINE>} | ().unmarshall(context)); |
482,516 | private static int scriptScan(CommandContext<CommandSourceStack> context, BlockPos origin, BlockPos a, BlockPos b, String expr) throws CommandSyntaxException {<NEW_LINE>CommandSourceStack source = context.getSource();<NEW_LINE>CarpetScriptHost host = getHost(context);<NEW_LINE>BoundingBox area = BoundingBox.fromCorners(a, b);<NEW_LINE>CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);<NEW_LINE>// X Y Z<NEW_LINE>int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan();<NEW_LINE>if (int_1 > CarpetSettings.fillLimit) {<NEW_LINE>Messenger.m(source, "r too many blocks to evaluate: " + int_1);<NEW_LINE>return 1;<NEW_LINE>}<NEW_LINE>int successCount = 0;<NEW_LINE>CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);<NEW_LINE>try {<NEW_LINE>for (int x = area.minX(); x <= area.maxX(); x++) {<NEW_LINE>for (int y = area.minY(); y <= area.maxY(); y++) {<NEW_LINE>for (int z = area.minZ(); z <= area.maxZ(); z++) {<NEW_LINE>try {<NEW_LINE>if (cexpr.fillAndScanCommand(host, x, y, z))<NEW_LINE>successCount++;<NEW_LINE>} catch (ArithmeticException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (CarpetExpressionException exc) {<NEW_LINE><MASK><NEW_LINE>return 0;<NEW_LINE>} finally {<NEW_LINE>CarpetSettings.impendingFillSkipUpdates.set(false);<NEW_LINE>}<NEW_LINE>Messenger.m(source, "w Expression successful in " + successCount + " out of " + int_1 + " blocks");<NEW_LINE>return successCount;<NEW_LINE>} | host.handleErrorWithStack("Error while processing command", exc); |
1,144,557 | static <T> DelayedTask<Single<T>> createSingle(Supplier<? extends CompletionStage<T>> supplier) {<NEW_LINE>return new DelayedTask<>() {<NEW_LINE><NEW_LINE>// future we returned as a result of invoke command<NEW_LINE>private final LazyValue<CompletableFuture<T>> resultFuture = LazyValue.create(CompletableFuture::new);<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public CompletionStage<Void> execute() {<NEW_LINE>CompletionStage<T> result;<NEW_LINE>try {<NEW_LINE>result = supplier.get();<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>CompletableFuture<T> future = resultFuture.get();<NEW_LINE>createDependency(result, future);<NEW_LINE>return result.thenRun(() -> {<NEW_LINE>});<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Single<T> result() {<NEW_LINE>return Single.create(resultFuture.get(), true);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Single<T> error(Throwable throwable) {<NEW_LINE>return Single.error(throwable);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String toString() {<NEW_LINE>return "single:" + System.identityHashCode(this);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | result = CompletableFuture.failedStage(e); |
1,825,858 | protected synchronized void processNodeData(NodeDataMessage msg) {<NEW_LINE>if (requestedNodes == null) {<NEW_LINE>logger.debug("Received NodeDataMessage when requestedNodes == null. Dropping peer " + channel);<NEW_LINE>dropConnection();<NEW_LINE>}<NEW_LINE>List<Pair<byte[], byte[]>> ret = new ArrayList<>();<NEW_LINE>if (msg.getDataList().isEmpty()) {<NEW_LINE>String err = String.format("Received NodeDataMessage contains empty node data. Dropping peer %s", channel);<NEW_LINE>logger.debug(err);<NEW_LINE>requestNodesFuture.setException(new RuntimeException(err));<NEW_LINE>// Not fatal but let us touch it later<NEW_LINE>channel.getChannelManager().<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Value nodeVal : msg.getDataList()) {<NEW_LINE>byte[] hash = sha3(nodeVal.asBytes());<NEW_LINE>if (!requestedNodes.contains(hash)) {<NEW_LINE>String err = "Received NodeDataMessage contains non-requested node with hash :" + toHexString(hash) + " . Dropping peer " + channel;<NEW_LINE>dropUselessPeer(err);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ret.add(Pair.of(hash, nodeVal.asBytes()));<NEW_LINE>}<NEW_LINE>requestNodesFuture.set(ret);<NEW_LINE>requestedNodes = null;<NEW_LINE>requestNodesFuture = null;<NEW_LINE>processingTime += (System.currentTimeMillis() - lastReqSentTime);<NEW_LINE>lastReqSentTime = 0;<NEW_LINE>peerState = PeerState.IDLE;<NEW_LINE>} | disconnect(channel, ReasonCode.TOO_MANY_PEERS); |
332,830 | static synchronized void loadInitialPlugins() {<NEW_LINE>lazyInitialization = true;<NEW_LINE>loadCorePlugin();<NEW_LINE>if (JavaWebStart.isRunningViaJavaWebstart()) {<NEW_LINE>installWebStartPlugins();<NEW_LINE>} else {<NEW_LINE>installStandardPlugins();<NEW_LINE>installUserInstalledPlugins();<NEW_LINE>}<NEW_LINE>Set<Entry<Object, Object>> entrySet = SystemProperties.getAllProperties().entrySet();<NEW_LINE>for (Map.Entry<?, ?> e : entrySet) {<NEW_LINE>if (e.getKey() instanceof String && e.getValue() instanceof String && ((String) e.getKey()).startsWith("findbugs.plugin.")) {<NEW_LINE>try {<NEW_LINE>String value = (String) e.getValue();<NEW_LINE>if (value.startsWith("file:") && !value.endsWith(".jar") && !value.endsWith("/")) {<NEW_LINE>value += "/";<NEW_LINE>}<NEW_LINE>URL <MASK><NEW_LINE>System.out.println("Loading " + e.getKey() + " from " + url);<NEW_LINE>loadInitialPlugin(url, true, false);<NEW_LINE>} catch (MalformedURLException e1) {<NEW_LINE>AnalysisContext.logError(String.format("Bad URL for plugin: %s=%s", e.getKey(), e.getValue()), e1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (Plugin.getAllPlugins().size() > 1 && JavaWebStart.isRunningViaJavaWebstart()) {<NEW_LINE>// disable security manager; plugins cause problems<NEW_LINE>// http://lopica.sourceforge.net/faq.html<NEW_LINE>// URL policyUrl =<NEW_LINE>// Thread.currentThread().getContextClassLoader().getResource("my.java.policy");<NEW_LINE>// Policy.getPolicy().refresh();<NEW_LINE>try {<NEW_LINE>System.setSecurityManager(null);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>// keep going<NEW_LINE>assert true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>finishLazyInitialization();<NEW_LINE>} | url = JavaWebStart.resolveRelativeToJnlpCodebase(value); |
845,489 | protected String convertToPresentation(V modelValue) throws ConversionException {<NEW_LINE>// Vaadin TextField does not permit `null` value<NEW_LINE>if (formatter != null) {<NEW_LINE>return nullToEmpty(formatter.apply(modelValue));<NEW_LINE>}<NEW_LINE>if (datatype != null) {<NEW_LINE>return nullToEmpty(datatype.format(modelValue, locale));<NEW_LINE>}<NEW_LINE>if (valueBinding != null && valueBinding.getSource() instanceof EntityValueSource) {<NEW_LINE>EntityValueSource entityValueSource = (EntityValueSource) valueBinding.getSource();<NEW_LINE>Range range = entityValueSource.getMetaPropertyPath().getRange();<NEW_LINE>if (range.isDatatype()) {<NEW_LINE>Datatype<V<MASK><NEW_LINE>return nullToEmpty(propertyDataType.format(modelValue, locale));<NEW_LINE>} else {<NEW_LINE>setEditable(false);<NEW_LINE>if (modelValue == null)<NEW_LINE>return "";<NEW_LINE>if (range.isClass()) {<NEW_LINE>MetadataTools metadataTools = beanLocator.get(MetadataTools.class);<NEW_LINE>if (range.getCardinality().isMany()) {<NEW_LINE>return ((Collection<Entity>) modelValue).stream().map(metadataTools::getInstanceName).collect(Collectors.joining(", "));<NEW_LINE>} else {<NEW_LINE>return metadataTools.getInstanceName((Entity) modelValue);<NEW_LINE>}<NEW_LINE>} else if (range.isEnum()) {<NEW_LINE>Messages messages = beanLocator.get(Messages.class);<NEW_LINE>return messages.getMessage((Enum) modelValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return nullToEmpty(super.convertToPresentation(modelValue));<NEW_LINE>} | > propertyDataType = range.asDatatype(); |
1,235,540 | protected void match(List<?> expected, List<?> computed, int col) {<NEW_LINE>if (col >= columnBindings.length) {<NEW_LINE>check(expected, computed);<NEW_LINE>} else if (columnBindings[col] == null) {<NEW_LINE>match(expected, computed, col + 1);<NEW_LINE>} else {<NEW_LINE>Map<Object, Object> eMap = eSort(expected, col);<NEW_LINE>Map<Object, Object> cMap = cSort(computed, col);<NEW_LINE>Set<Object> keys = union(eMap.keySet(<MASK><NEW_LINE>for (Object key : keys) {<NEW_LINE>List<?> eList = (List<?>) eMap.get(key);<NEW_LINE>List<?> cList = (List<?>) cMap.get(key);<NEW_LINE>if (eList == null) {<NEW_LINE>surplus.addAll(cList);<NEW_LINE>} else if (cList == null) {<NEW_LINE>missing.addAll(eList);<NEW_LINE>} else if (eList.size() == 1 && cList.size() == 1) {<NEW_LINE>check(eList, cList);<NEW_LINE>} else {<NEW_LINE>match(eList, cList, col + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), cMap.keySet()); |
97,646 | protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException {<NEW_LINE>if (!snapshot.getSnapshotControl().shouldInclude(View.class)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (foundObject instanceof Schema) {<NEW_LINE>Schema schema = (Schema) foundObject;<NEW_LINE><MASK><NEW_LINE>List<CachedRow> viewsMetadataRs = null;<NEW_LINE>try {<NEW_LINE>viewsMetadataRs = ((JdbcDatabaseSnapshot) snapshot).getMetaDataFromCache().getViews(((AbstractJdbcDatabase) database).getJdbcCatalogName(schema), ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema), null);<NEW_LINE>for (CachedRow row : viewsMetadataRs) {<NEW_LINE>CatalogAndSchema catalogAndSchema = ((AbstractJdbcDatabase) database).getSchemaFromJdbcInfo(row.getString("TABLE_CAT"), row.getString("TABLE_SCHEM"));<NEW_LINE>View view = new View();<NEW_LINE>view.setName(row.getString("TABLE_NAME"));<NEW_LINE>view.setSchema(new Schema(catalogAndSchema.getCatalogName(), catalogAndSchema.getSchemaName()));<NEW_LINE>view.setRemarks(row.getString("REMARKS"));<NEW_LINE>String definition = StringUtil.standardizeLineEndings(row.getString("OBJECT_BODY"));<NEW_LINE>view.setDefinition(definition);<NEW_LINE>if (database instanceof OracleDatabase) {<NEW_LINE>view.setAttribute("editioning", "Y".equals(row.getString("EDITIONING_VIEW")));<NEW_LINE>}<NEW_LINE>schema.addDatabaseObject(view);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new DatabaseException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Database database = snapshot.getDatabase(); |
931,604 | public final void notifyProcess(OriginClusterEvent<?> changeEvent, boolean ignoreTheGrandChild) throws Exception {<NEW_LINE>logger.info("event happen in {}, path: {},type: {},data: {}", this.getClass().getSimpleName(), changeEvent.getPath(), changeEvent.getChangeType(), changeEvent.getValue());<NEW_LINE>// ucore may receive the grandchildren event.But zk only receive the children event. remove grandchildren event if needed<NEW_LINE>if (ignoreTheGrandChild && ClusterLogic.forGeneral().getPathHeight(changeEvent.getPath()) != pathHeight + 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ClusterEvent<T> newEvent;<NEW_LINE>ClusterEvent<T> oldEvent = null;<NEW_LINE>final ClusterValue<T> newValue = (changeEvent.getValue().convertTo(pathMeta.getChildClass()));<NEW_LINE>final String path = changeEvent.getPath();<NEW_LINE>switch(changeEvent.getChangeType()) {<NEW_LINE>case ADDED:<NEW_LINE>newEvent = new ClusterEvent<>(path, newValue, ChangeType.ADDED);<NEW_LINE>break;<NEW_LINE>case REMOVED:<NEW_LINE>newEvent = new ClusterEvent<>(path, newValue, ChangeType.REMOVED);<NEW_LINE>break;<NEW_LINE>case UPDATE:<NEW_LINE>final ClusterValue<T> oldValue = changeEvent.getOldValue().<MASK><NEW_LINE>oldEvent = new ClusterEvent<>(path, oldValue, ChangeType.REMOVED);<NEW_LINE>oldEvent.markUpdate();<NEW_LINE>newEvent = new ClusterEvent<>(path, newValue, ChangeType.ADDED);<NEW_LINE>newEvent.markUpdate();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (oldEvent != null) {<NEW_LINE>try {<NEW_LINE>onEvent0(oldEvent);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.info("", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>onEvent0(newEvent);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.info("", e);<NEW_LINE>}<NEW_LINE>} | convertTo(pathMeta.getChildClass()); |
354,268 | private Structure buildRegInfoStructure(boolean elf64) {<NEW_LINE>String prefix = elf64 ? "Elf64" : "Elf32";<NEW_LINE>EnumDataType gprMask = new EnumDataType(prefix + "_GPRMask_MIPS", 4);<NEW_LINE>gprMask.add("gpr_zero", 1);<NEW_LINE>gprMask.add("gpr_at", 2);<NEW_LINE>gprMask.add("gpr_v0", 4);<NEW_LINE>gprMask.add("gpr_v1", 8);<NEW_LINE>gprMask.add("gpr_a0", 0x10);<NEW_LINE>gprMask.add("gpr_a1", 0x20);<NEW_LINE>gprMask.add("gpr_a2", 0x40);<NEW_LINE>gprMask.add("gpr_a3", 0x80);<NEW_LINE>gprMask.add("gpr_t0", 0x100);<NEW_LINE>gprMask.add("gpr_t1", 0x200);<NEW_LINE>gprMask.add("gpr_t2", 0x400);<NEW_LINE>gprMask.add("gpr_t3", 0x800);<NEW_LINE><MASK><NEW_LINE>gprMask.add("gpr_t5", 0x2000);<NEW_LINE>gprMask.add("gpr_t6", 0x4000);<NEW_LINE>gprMask.add("gpr_t7", 0x8000);<NEW_LINE>gprMask.add("gpr_s0", 0x10000);<NEW_LINE>gprMask.add("gpr_s1", 0x20000);<NEW_LINE>gprMask.add("gpr_s2", 0x40000);<NEW_LINE>gprMask.add("gpr_s3", 0x80000);<NEW_LINE>gprMask.add("gpr_s4", 0x100000);<NEW_LINE>gprMask.add("gpr_s5", 0x200000);<NEW_LINE>gprMask.add("gpr_s6", 0x400000);<NEW_LINE>gprMask.add("gpr_s7", 0x800000);<NEW_LINE>gprMask.add("gpr_t8", 0x1000000);<NEW_LINE>gprMask.add("gpr_t9", 0x2000000);<NEW_LINE>gprMask.add("gpr_k0", 0x4000000);<NEW_LINE>gprMask.add("gpr_k1", 0x8000000);<NEW_LINE>gprMask.add("gpr_gp", 0x10000000);<NEW_LINE>gprMask.add("gpr_sp", 0x20000000);<NEW_LINE>gprMask.add("gpr_fp", 0x40000000);<NEW_LINE>gprMask.add("gpr_ra", 0x80000000L);<NEW_LINE>Structure regInfoStruct = new StructureDataType(new CategoryPath("/ELF"), prefix + "_RegInfo_MIPS", 0);<NEW_LINE>regInfoStruct.add(gprMask, "ri_gprmask", null);<NEW_LINE>if (elf64) {<NEW_LINE>regInfoStruct.add(DWordDataType.dataType, "ri_pad", null);<NEW_LINE>}<NEW_LINE>regInfoStruct.add(new ArrayDataType(DWordDataType.dataType, 4, 4));<NEW_LINE>if (elf64) {<NEW_LINE>regInfoStruct.add(QWordDataType.dataType, "ri_gp_value", null);<NEW_LINE>} else {<NEW_LINE>regInfoStruct.add(DWordDataType.dataType, "ri_gp_value", null);<NEW_LINE>}<NEW_LINE>return regInfoStruct;<NEW_LINE>} | gprMask.add("gpr_t4", 0x1000); |
1,513,364 | private JComponent createSearchField() {<NEW_LINE>_searchField = new JXSearchField("Find");<NEW_LINE>_searchField.setUseNativeSearchFieldIfPossible(true);<NEW_LINE>// _searchField.setLayoutStyle(JXSearchField.LayoutStyle.MAC);<NEW_LINE>_searchField.setMinimumSize(new Dimension(220, 30));<NEW_LINE>_searchField.setPreferredSize(new Dimension(220, 30));<NEW_LINE>_searchField.setMaximumSize(new Dimension(380, 30));<NEW_LINE>_searchField.setMargin(new Insets(0, 3, 0, 3));<NEW_LINE>_searchField.setToolTipText("Search is case sensitive - " + "start with ! to make search not case sensitive");<NEW_LINE>_searchField.setCancelAction(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent evt) {<NEW_LINE>getCurrentCodePane().requestFocus();<NEW_LINE>_findHelper.setFailed(false);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>_searchField.setFindAction(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent evt) {<NEW_LINE>// FIXME: On Linux the found selection disappears somehow<NEW_LINE>if (// HACK<NEW_LINE>!Settings.isLinux()) {<NEW_LINE>_searchField.selectAll();<NEW_LINE>}<NEW_LINE>boolean ret = _findHelper.findNext(_searchField.getText());<NEW_LINE>_findHelper.setFailed(!ret);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>_searchField.addKeyListener(new KeyAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void keyReleased(java.awt.event.KeyEvent ke) {<NEW_LINE>boolean ret;<NEW_LINE>if (ke.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {<NEW_LINE>// FIXME: On Linux the found selection disappears somehow<NEW_LINE>if (// HACK<NEW_LINE>!Settings.isLinux()) {<NEW_LINE>_searchField.selectAll();<NEW_LINE>}<NEW_LINE>ret = _findHelper.<MASK><NEW_LINE>} else {<NEW_LINE>ret = _findHelper.findStr(_searchField.getText());<NEW_LINE>}<NEW_LINE>_findHelper.setFailed(!ret);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return _searchField;<NEW_LINE>} | findNext(_searchField.getText()); |
393,311 | public void updateConfiguration(Configuration config) {<NEW_LINE>// re-map filesystem schemes to match Amazon Elastic MapReduce<NEW_LINE>config.set("fs.s3.impl", PrestoS3FileSystem.class.getName());<NEW_LINE>config.set("fs.s3a.impl", PrestoS3FileSystem.class.getName());<NEW_LINE>config.set("fs.s3n.impl", PrestoS3FileSystem.class.getName());<NEW_LINE>if (awsAccessKey != null) {<NEW_LINE>config.set(S3_ACCESS_KEY, awsAccessKey);<NEW_LINE>}<NEW_LINE>if (awsSecretKey != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (endpoint != null) {<NEW_LINE>config.set(S3_ENDPOINT, endpoint);<NEW_LINE>}<NEW_LINE>config.set(S3_STORAGE_CLASS, s3StorageClass.name());<NEW_LINE>if (signerType != null) {<NEW_LINE>config.set(S3_SIGNER_TYPE, signerType.name());<NEW_LINE>}<NEW_LINE>config.setBoolean(S3_PATH_STYLE_ACCESS, pathStyleAccess);<NEW_LINE>config.setBoolean(S3_USE_INSTANCE_CREDENTIALS, useInstanceCredentials);<NEW_LINE>if (s3IamRole != null) {<NEW_LINE>config.set(S3_IAM_ROLE, s3IamRole);<NEW_LINE>}<NEW_LINE>config.setBoolean(S3_SSL_ENABLED, sslEnabled);<NEW_LINE>config.setBoolean(S3_SSE_ENABLED, sseEnabled);<NEW_LINE>config.set(S3_SSE_TYPE, sseType.name());<NEW_LINE>if (encryptionMaterialsProvider != null) {<NEW_LINE>config.set(S3_ENCRYPTION_MATERIALS_PROVIDER, encryptionMaterialsProvider);<NEW_LINE>}<NEW_LINE>if (kmsKeyId != null) {<NEW_LINE>config.set(S3_KMS_KEY_ID, kmsKeyId);<NEW_LINE>}<NEW_LINE>if (sseKmsKeyId != null) {<NEW_LINE>config.set(S3_SSE_KMS_KEY_ID, sseKmsKeyId);<NEW_LINE>}<NEW_LINE>config.setInt(S3_MAX_CLIENT_RETRIES, maxClientRetries);<NEW_LINE>config.setInt(S3_MAX_ERROR_RETRIES, maxErrorRetries);<NEW_LINE>config.set(S3_MAX_BACKOFF_TIME, maxBackoffTime.toString());<NEW_LINE>config.set(S3_MAX_RETRY_TIME, maxRetryTime.toString());<NEW_LINE>config.set(S3_CONNECT_TIMEOUT, connectTimeout.toString());<NEW_LINE>config.set(S3_SOCKET_TIMEOUT, socketTimeout.toString());<NEW_LINE>config.set(S3_STAGING_DIRECTORY, stagingDirectory.toString());<NEW_LINE>config.setInt(S3_MAX_CONNECTIONS, maxConnections);<NEW_LINE>config.setLong(S3_MULTIPART_MIN_FILE_SIZE, multipartMinFileSize.toBytes());<NEW_LINE>config.setLong(S3_MULTIPART_MIN_PART_SIZE, multipartMinPartSize.toBytes());<NEW_LINE>config.setBoolean(S3_PIN_CLIENT_TO_CURRENT_REGION, pinClientToCurrentRegion);<NEW_LINE>config.set(S3_USER_AGENT_PREFIX, userAgentPrefix);<NEW_LINE>config.set(S3_ACL_TYPE, aclType.name());<NEW_LINE>config.setBoolean(S3_SKIP_GLACIER_OBJECTS, skipGlacierObjects);<NEW_LINE>} | config.set(S3_SECRET_KEY, awsSecretKey); |
997,884 | public void serialize(final SiteView siteView, final JsonGenerator jsonGenerator, final SerializerProvider serializers) throws IOException {<NEW_LINE>final Map<String, Object> map = new HashMap<>();<NEW_LINE>map.put("id", siteView.id);<NEW_LINE>map.put("name", siteView.name);<NEW_LINE>map.<MASK><NEW_LINE>if (null != siteView.secrets) {<NEW_LINE>map.put("secrets", siteView.secrets);<NEW_LINE>}<NEW_LINE>if (null != siteView.secretsWithWarnings) {<NEW_LINE>map.put("secretsWithWarnings", siteView.secretsWithWarnings);<NEW_LINE>}<NEW_LINE>ViewUtil.currentSite(siteView.id);<NEW_LINE>final String json = mapper.writeValueAsString(map);<NEW_LINE>final String interpolatedJson = ViewUtil.interpolateValues(json);<NEW_LINE>ViewUtil.currentSite(null);<NEW_LINE>jsonGenerator.writeRawValue(interpolatedJson);<NEW_LINE>} | put("configured", siteView.configured); |
1,291,304 | public List<List<String>> accountsMerge(List<List<String>> accounts) {<NEW_LINE>DSU dsu = new DSU();<NEW_LINE>Map<String, String> <MASK><NEW_LINE>Map<String, Integer> emailToId = new HashMap<>();<NEW_LINE>int id = 0;<NEW_LINE>for (List<String> account : accounts) {<NEW_LINE>String name = "";<NEW_LINE>for (String email : account) {<NEW_LINE>if (name.equals("")) {<NEW_LINE>name = email;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>emailToName.put(email, name);<NEW_LINE>if (!emailToId.containsKey(email)) {<NEW_LINE>emailToId.put(email, id++);<NEW_LINE>}<NEW_LINE>dsu.union(emailToId.get(account.get(1)), emailToId.get(email));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<Integer, List<String>> ans = new HashMap<>();<NEW_LINE>for (String email : emailToName.keySet()) {<NEW_LINE>int index = dsu.find(emailToId.get(email));<NEW_LINE>ans.computeIfAbsent(index, x -> new ArrayList()).add(email);<NEW_LINE>}<NEW_LINE>for (List<String> component : ans.values()) {<NEW_LINE>Collections.sort(component);<NEW_LINE>component.add(0, emailToName.get(component.get(0)));<NEW_LINE>}<NEW_LINE>return new ArrayList<>(ans.values());<NEW_LINE>} | emailToName = new HashMap<>(); |
1,265,835 | private void writeSingleVersionAccessor(String versionAlias, @Nullable String context, String version, boolean asProvider) throws IOException {<NEW_LINE>writeLn("/**");<NEW_LINE>writeLn(" * Returns the version associated to this alias: " + versionAlias + " (" + version + ")");<NEW_LINE>writeLn(" * If the version is a rich version and that its not expressible as a");<NEW_LINE>writeLn(" * single version string, then an empty string is returned.");<NEW_LINE>if (context != null) {<NEW_LINE>writeLn(" * This version was declared in " + context);<NEW_LINE>}<NEW_LINE>writeLn(" */");<NEW_LINE>String methodName = asProvider ? "asProvider" : "get" <MASK><NEW_LINE>writeLn("public Provider<String> " + methodName + "() { return getVersion(\"" + versionAlias + "\"); }");<NEW_LINE>writeLn();<NEW_LINE>} | + toJavaName(leafNodeForAlias(versionAlias)); |
358,225 | private static LinkedHashMap<String, String[]> buildServiceErrorParameters(final ParamError[] paramErrorAnnotations, final Class<?> resourceClass, final Method method) {<NEW_LINE>// Create a mapping of service error codes to their parameters (if any)<NEW_LINE>final LinkedHashMap<String, String[]> paramsMapping = new LinkedHashMap<>();<NEW_LINE>if (paramErrorAnnotations != null) {<NEW_LINE>for (ParamError paramErrorAnnotation : paramErrorAnnotations) {<NEW_LINE>final <MASK><NEW_LINE>// Check for redundant parameter error annotations<NEW_LINE>if (paramsMapping.containsKey(serviceErrorCode)) {<NEW_LINE>throw new ResourceConfigException(String.format("Redundant @%s annotations for service error code '%s' used in %s", ParamError.class.getSimpleName(), serviceErrorCode, buildExceptionLocationString(resourceClass, method)));<NEW_LINE>}<NEW_LINE>final String[] parameterNames = paramErrorAnnotation.parameterNames();<NEW_LINE>// Ensure the parameter names array is non-empty<NEW_LINE>if (parameterNames.length == 0) {<NEW_LINE>throw new ResourceConfigException(String.format("@%s annotation on %s specifies no parameter names for service error code '%s'", ParamError.class.getSimpleName(), buildExceptionLocationString(resourceClass, method), serviceErrorCode));<NEW_LINE>}<NEW_LINE>// Ensure that there are no duplicate parameter names<NEW_LINE>if (parameterNames.length != new HashSet<>(Arrays.asList(parameterNames)).size()) {<NEW_LINE>throw new ResourceConfigException(String.format("Duplicate parameter specified for service error code '%s' in %s", serviceErrorCode, buildExceptionLocationString(resourceClass, method)));<NEW_LINE>}<NEW_LINE>paramsMapping.put(serviceErrorCode, paramErrorAnnotation.parameterNames());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return paramsMapping;<NEW_LINE>} | String serviceErrorCode = paramErrorAnnotation.code(); |
234,251 | public void defineInterceptors() {<NEW_LINE>InputStream inputStream = getClass().getResourceAsStream("/prometheus/interceptors.yaml");<NEW_LINE>Interceptors interceptors = new Yaml().loadAs(inputStream, Interceptors.class);<NEW_LINE>for (Interceptor each : interceptors.getInterceptors()) {<NEW_LINE>if (null == each.getTarget()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Builder builder = defineInterceptor(each.getTarget());<NEW_LINE>if (null != each.getConstructAdvice() && !("".equals(each.getConstructAdvice()))) {<NEW_LINE>builder.onConstructor(ElementMatchers.isConstructor()).implement(each.getConstructAdvice()).build();<NEW_LINE>log.debug("Init construct: {}", each.getConstructAdvice());<NEW_LINE>}<NEW_LINE>if (null == each.getPoints()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String[] instancePoints = each.getPoints().stream().filter(i -> "instance".equals(i.getType())).map(TargetPoint::getName).toArray(String[]::new);<NEW_LINE>String[] staticPoints = each.getPoints().stream().filter(i -> "static".equals(i.getType())).map(TargetPoint::getName).toArray(String[]::new);<NEW_LINE>if (instancePoints.length > 0) {<NEW_LINE>builder.aroundInstanceMethod(ElementMatchers.namedOneOf(instancePoints)).implement(each.<MASK><NEW_LINE>log.debug("Init instance: {}", each.getInstanceAdvice());<NEW_LINE>}<NEW_LINE>if (staticPoints.length > 0) {<NEW_LINE>builder.aroundClassStaticMethod(ElementMatchers.namedOneOf(staticPoints)).implement(each.getStaticAdvice()).build();<NEW_LINE>log.debug("Init static: {}", each.getStaticAdvice());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getInstanceAdvice()).build(); |
91,165 | private void buildFlattenedMap(final Map<String, Object> result, final Map<String, Object> source, final String path) {<NEW_LINE>source.forEach((key, value) -> {<NEW_LINE>if (StringUtils.isNotBlank(path)) {<NEW_LINE>if (key.startsWith("[")) {<NEW_LINE>key = path + key;<NEW_LINE>} else {<NEW_LINE>key = path + '.' + key;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (value instanceof String) {<NEW_LINE>result.put(key, value);<NEW_LINE>} else if (value instanceof Map) {<NEW_LINE>// Need a compound key<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<String, Object> map = (<MASK><NEW_LINE>buildFlattenedMap(result, map, key);<NEW_LINE>} else if (value instanceof Collection) {<NEW_LINE>// Need a compound key<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Collection<Object> collection = (Collection<Object>) value;<NEW_LINE>if (collection.isEmpty()) {<NEW_LINE>result.put(key, "");<NEW_LINE>} else {<NEW_LINE>int count = 0;<NEW_LINE>for (Object object : collection) {<NEW_LINE>buildFlattenedMap(result, Collections.singletonMap("[" + (count++) + "]", object), key);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>result.put(key, value != null ? value : "");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | Map<String, Object>) value; |
444,463 | public GovernanceResult<List<FileChunksMetaEntity>> downLoadStatus(String groupId, Integer brokerId, String topic, String nodeAddress) throws GovernanceException {<NEW_LINE>List<FileChunksMetaStatus> fileChunksMetaStatusList = null;<NEW_LINE>List<FileChunksMetaEntity> chunksMetaEntities = new ArrayList<FileChunksMetaEntity>();<NEW_LINE>IWeEventFileClient fileClient = this.getIWeEventFileClient(brokerId, groupId, nodeAddress);<NEW_LINE>FileTransportStats status = fileClient.status(topic);<NEW_LINE>if (status.getReceiver().containsKey(groupId)) {<NEW_LINE>fileChunksMetaStatusList = status.getReceiver().get(groupId).get(topic);<NEW_LINE>fileChunksMetaStatusList = null == fileChunksMetaStatusList ? new ArrayList<FileChunksMetaStatus>() : fileChunksMetaStatusList;<NEW_LINE>for (FileChunksMetaStatus fileChunksMetaStatus : fileChunksMetaStatusList) {<NEW_LINE><MASK><NEW_LINE>FileChunksMetaEntity fileChunksMetaEntity = new FileChunksMetaEntity();<NEW_LINE>BeanUtils.copyProperties(chunksMeta, fileChunksMetaEntity);<NEW_LINE>BeanUtils.copyProperties(fileChunksMetaStatus, fileChunksMetaEntity);<NEW_LINE>if (Objects.equals(fileChunksMetaStatus.getProcess(), "100.00%")) {<NEW_LINE>FileTransportStatusEntity fileTransportStatusEntity = this.transportStatusRepository.queryByBrokerIdAndGroupIdAndTopicNameAndFileName(brokerId, groupId, topic, fileChunksMetaStatus.getFile().getFileName());<NEW_LINE>fileChunksMetaEntity.setStatus("1");<NEW_LINE>fileChunksMetaEntity.setSpeed(fileTransportStatusEntity.getSpeed());<NEW_LINE>} else {<NEW_LINE>fileChunksMetaEntity.setStatus("3");<NEW_LINE>}<NEW_LINE>chunksMetaEntities.add(fileChunksMetaEntity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return GovernanceResult.ok(chunksMetaEntities);<NEW_LINE>} | FileChunksMeta chunksMeta = fileChunksMetaStatus.getFile(); |
1,191,733 | final GetPushTemplateResult executeGetPushTemplate(GetPushTemplateRequest getPushTemplateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getPushTemplateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetPushTemplateRequest> request = null;<NEW_LINE>Response<GetPushTemplateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetPushTemplateRequestProtocolMarshaller(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, "Pinpoint");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPushTemplate");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetPushTemplateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPushTemplateResultJsonUnmarshaller());<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(getPushTemplateRequest)); |
204,842 | private void attachJoinGoto(StringLiteralExpression psiElement, List<PsiElement> targets) {<NEW_LINE>MethodMatcher.MethodMatchParameter methodMatchParameter = MatcherUtil.matchJoin(psiElement);<NEW_LINE>if (methodMatchParameter == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>QueryBuilderMethodReferenceParser qb = QueryBuilderCompletionContributor.getQueryBuilderParser(methodMatchParameter.getMethodReference());<NEW_LINE>if (qb == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String[] joinSplit = StringUtils.split(<MASK><NEW_LINE>if (joinSplit.length != 2) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>QueryBuilderScopeContext collect = qb.collect();<NEW_LINE>if (!collect.getRelationMap().containsKey(joinSplit[0])) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<QueryBuilderRelation> relations = collect.getRelationMap().get(joinSplit[0]);<NEW_LINE>for (QueryBuilderRelation relation : relations) {<NEW_LINE>if (joinSplit[1].equals(relation.getFieldName()) && relation.getTargetEntity() != null) {<NEW_LINE>PhpClass phpClass = PhpElementsUtil.getClassInterface(psiElement.getProject(), relation.getTargetEntity());<NEW_LINE>if (phpClass != null) {<NEW_LINE>targets.add(phpClass);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | psiElement.getContents(), "."); |
509,763 | public static void execute(ManagerService service, boolean isClear) {<NEW_LINE>ByteBuffer buffer = service.allocate();<NEW_LINE>// write header<NEW_LINE>buffer = HEADER.write(buffer, service, true);<NEW_LINE>// write fields<NEW_LINE>for (FieldPacket field : FIELDS) {<NEW_LINE>buffer = field.write(buffer, service, true);<NEW_LINE>}<NEW_LINE>// write eof<NEW_LINE>buffer = EOF.write(buffer, service, true);<NEW_LINE>// write rows<NEW_LINE>byte packetId = EOF.getPacketId();<NEW_LINE>Map<UserName, UserStat> statMap = UserStatAnalyzer.getInstance().getUserStatMap();<NEW_LINE>for (UserStat userStat : statMap.values()) {<NEW_LINE>UserName user = userStat.getUser();<NEW_LINE>List<UserSqlLargeStat.SqlLarge> queries = userStat.getSqlLargeRowStat().getQueries();<NEW_LINE>for (UserSqlLargeStat.SqlLarge sql : queries) {<NEW_LINE>if (sql != null) {<NEW_LINE>RowDataPacket row = getRow(user, sql, service.getCharset().getResults());<NEW_LINE>row.setPacketId(++packetId);<NEW_LINE>buffer = row.write(buffer, service, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isClear) {<NEW_LINE>userStat.getSqlLargeRowStat().clear();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// write last eof<NEW_LINE>EOFRowPacket lastEof = new EOFRowPacket();<NEW_LINE>lastEof.setPacketId(++packetId);<NEW_LINE><MASK><NEW_LINE>} | lastEof.write(buffer, service); |
1,853,538 | final AssociateEntityToThingResult executeAssociateEntityToThing(AssociateEntityToThingRequest associateEntityToThingRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(associateEntityToThingRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AssociateEntityToThingRequest> request = null;<NEW_LINE>Response<AssociateEntityToThingResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AssociateEntityToThingRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(associateEntityToThingRequest));<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, "IoTThingsGraph");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateEntityToThing");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AssociateEntityToThingResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new AssociateEntityToThingResultJsonUnmarshaller()); |
1,797,457 | public com.amazonaws.services.recyclebin.model.ValidationException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.recyclebin.model.ValidationException validationException = new com.amazonaws.services.<MASK><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("Reason", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>validationException.setReason(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return validationException;<NEW_LINE>} | recyclebin.model.ValidationException(null); |
1,578,287 | public WorkflowExecutionTerminatedEventAttributes unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes = new WorkflowExecutionTerminatedEventAttributes();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("reason", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>workflowExecutionTerminatedEventAttributes.setReason(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("details", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>workflowExecutionTerminatedEventAttributes.setDetails(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("childPolicy", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>workflowExecutionTerminatedEventAttributes.setChildPolicy(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("cause", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>workflowExecutionTerminatedEventAttributes.setCause(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return workflowExecutionTerminatedEventAttributes;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
952,710 | public static ConnectionCostsWriter<ConnectionCosts> build(Path path) throws IOException {<NEW_LINE>try (Reader reader = Files.newBufferedReader(path, StandardCharsets.US_ASCII);<NEW_LINE>LineNumberReader lineReader = new LineNumberReader(reader)) {<NEW_LINE>String line = lineReader.readLine();<NEW_LINE>String[] dimensions = line.split("\\s+");<NEW_LINE>assert dimensions.length == 2;<NEW_LINE>int forwardSize = Integer.parseInt(dimensions[0]);<NEW_LINE>int backwardSize = Integer.parseInt(dimensions[1]);<NEW_LINE>assert forwardSize > 0 && backwardSize > 0;<NEW_LINE>ConnectionCostsWriter<ConnectionCosts> costs = new ConnectionCostsWriter<>(ConnectionCosts.class, forwardSize, backwardSize);<NEW_LINE>while ((line = lineReader.readLine()) != null) {<NEW_LINE>String[] fields = line.split("\\s+");<NEW_LINE>assert fields.length == 3;<NEW_LINE>int forwardId = Integer<MASK><NEW_LINE>int backwardId = Integer.parseInt(fields[1]);<NEW_LINE>int cost = Integer.parseInt(fields[2]);<NEW_LINE>costs.add(forwardId, backwardId, cost);<NEW_LINE>}<NEW_LINE>return costs;<NEW_LINE>}<NEW_LINE>} | .parseInt(fields[0]); |
454,580 | public static boolean fastApply(Context ctx, RootCommand callback) {<NEW_LINE>try {<NEW_LINE>if (!rulesUpToDate) {<NEW_LINE>Log.i(TAG, "Using full Apply");<NEW_LINE>applySavedIptablesRules(ctx, true, callback);<NEW_LINE>} else {<NEW_LINE>Log.i(TAG, "Using fastApply");<NEW_LINE>List<String> out <MASK><NEW_LINE>List<String> cmds;<NEW_LINE>cmds = new ArrayList<String>();<NEW_LINE>applyShortRules(ctx, cmds, false);<NEW_LINE>iptablesCommands(cmds, out, false);<NEW_LINE>if (G.enableIPv6()) {<NEW_LINE>cmds = new ArrayList<String>();<NEW_LINE>applyShortRules(ctx, cmds, true);<NEW_LINE>iptablesCommands(cmds, out, true);<NEW_LINE>}<NEW_LINE>callback.setRetryExitCode(IPTABLES_TRY_AGAIN).run(ctx, out);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.d(TAG, "Exception while applying rules: " + e.getMessage());<NEW_LINE>applyDefaultChains(ctx, callback);<NEW_LINE>}<NEW_LINE>rulesUpToDate = true;<NEW_LINE>return true;<NEW_LINE>} | = new ArrayList<String>(); |
430,504 | static Matrix load(DataInputStream dis) throws IOException {<NEW_LINE>int m_ = dis.readInt();<NEW_LINE>int n_ = dis.readInt();<NEW_LINE>float[][] data = new float[m_][n_];<NEW_LINE>int blockSize = n_ * 4;<NEW_LINE>int block = 100_000 * blockSize;<NEW_LINE>long totalByte = (long) m_ * blockSize;<NEW_LINE>if (block > totalByte) {<NEW_LINE>block = (int) totalByte;<NEW_LINE>}<NEW_LINE>int start = 0;<NEW_LINE>int end = block / blockSize;<NEW_LINE>int blockCounter = 1;<NEW_LINE>while (start < m_) {<NEW_LINE>byte[] b = new byte[block];<NEW_LINE>dis.readFully(b);<NEW_LINE>ByteBuffer buffer = ByteBuffer.wrap(b);<NEW_LINE>FloatBuffer fb = buffer.asFloatBuffer();<NEW_LINE>float[] tmp = new float[block / 4];<NEW_LINE>fb.get(tmp);<NEW_LINE>for (int k = 0; k < tmp.length / n_; k++) {<NEW_LINE>System.arraycopy(tmp, k * n_, data[k <MASK><NEW_LINE>}<NEW_LINE>blockCounter++;<NEW_LINE>start = end;<NEW_LINE>end = (block / blockSize) * blockCounter;<NEW_LINE>if (end > m_) {<NEW_LINE>end = m_;<NEW_LINE>block = (end - start) * blockSize;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Matrix(m_, n_, data);<NEW_LINE>} | + start], 0, n_); |
28,699 | protected void readClasses(TargetsTableClassesImpl classTable) throws IOException {<NEW_LINE>int numClasses = bufInput.readLargeInt();<NEW_LINE>List<String> i_interfaceNames = new ArrayList<>();<NEW_LINE>for (int classNo = 0; classNo < numClasses; classNo++) {<NEW_LINE>String className = requireCompact(CLASS_BYTE);<NEW_LINE>String i_className = classTable.internClassName(className);<NEW_LINE>String superClassName = requireCompact(SUPERCLASS_BYTE);<NEW_LINE>// ++ intern<NEW_LINE>String // ++ intern<NEW_LINE>i_superClassName = (superClassName.isEmpty() ? null : classTable.internClassName(superClassName));<NEW_LINE>int numInterfaces = bufInput.readSmallInt();<NEW_LINE>if (numInterfaces > 0) {<NEW_LINE>for (int interfaceNo = 0; interfaceNo < numInterfaces; interfaceNo++) {<NEW_LINE>String interfaceName = requireCompact(INTERFACE_BYTE);<NEW_LINE>i_interfaceNames.add(classTable.internClassName(interfaceName));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bufInput.requireByte(MODIFIERS_BYTE);<NEW_LINE>int modifiers = bufInput.readLargeInt();<NEW_LINE>classTable.record(<MASK><NEW_LINE>i_interfaceNames.clear();<NEW_LINE>}<NEW_LINE>} | i_className, i_superClassName, i_interfaceNames, modifiers); |
890,119 | private void showTrackingListDialog() {<NEW_LINE>List<String> trackingTypes = new ArrayList<>();<NEW_LINE>trackingTypes.add(getString(R.string.none));<NEW_LINE>trackingTypes.add(getString(R.string.none_compass));<NEW_LINE>trackingTypes.add(getString(R.string.none_gps));<NEW_LINE>trackingTypes.add(getString(R.string.tracking));<NEW_LINE>trackingTypes.add(getString(R.string.tracking_compass));<NEW_LINE>trackingTypes.add(getString(R.string.tracking_gps));<NEW_LINE>trackingTypes.add(getString(R.string.tracking_gps_north));<NEW_LINE>ArrayAdapter<String> profileAdapter = new ArrayAdapter<>(this, android.<MASK><NEW_LINE>ListPopupWindow listPopup = new ListPopupWindow(this);<NEW_LINE>listPopup.setAdapter(profileAdapter);<NEW_LINE>listPopup.setAnchorView(locationTrackingBtn);<NEW_LINE>listPopup.setOnItemClickListener((parent, itemView, position, id) -> {<NEW_LINE>String selectedTrackingType = trackingTypes.get(position);<NEW_LINE>locationTrackingBtn.setText(selectedTrackingType);<NEW_LINE>if (selectedTrackingType.contentEquals(getString(R.string.none))) {<NEW_LINE>setCameraTrackingMode(CameraMode.NONE);<NEW_LINE>} else if (selectedTrackingType.contentEquals(getString(R.string.none_compass))) {<NEW_LINE>setCameraTrackingMode(CameraMode.NONE_COMPASS);<NEW_LINE>} else if (selectedTrackingType.contentEquals(getString(R.string.none_gps))) {<NEW_LINE>setCameraTrackingMode(CameraMode.NONE_GPS);<NEW_LINE>} else if (selectedTrackingType.contentEquals(getString(R.string.tracking))) {<NEW_LINE>setCameraTrackingMode(CameraMode.TRACKING);<NEW_LINE>} else if (selectedTrackingType.contentEquals(getString(R.string.tracking_compass))) {<NEW_LINE>setCameraTrackingMode(CameraMode.TRACKING_COMPASS);<NEW_LINE>} else if (selectedTrackingType.contentEquals(getString(R.string.tracking_gps))) {<NEW_LINE>setCameraTrackingMode(CameraMode.TRACKING_GPS);<NEW_LINE>} else if (selectedTrackingType.contentEquals(getString(R.string.tracking_gps_north))) {<NEW_LINE>setCameraTrackingMode(CameraMode.TRACKING_GPS_NORTH);<NEW_LINE>}<NEW_LINE>listPopup.dismiss();<NEW_LINE>});<NEW_LINE>listPopup.show();<NEW_LINE>} | R.layout.simple_list_item_1, trackingTypes); |
291,164 | public ListVirtualRoutersResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListVirtualRoutersResult listVirtualRoutersResult = new ListVirtualRoutersResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listVirtualRoutersResult;<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("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listVirtualRoutersResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("virtualRouters", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listVirtualRoutersResult.setVirtualRouters(new ListUnmarshaller<VirtualRouterRef>(VirtualRouterRefJsonUnmarshaller.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 listVirtualRoutersResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
823,747 | private static AceRelationMention parseRelationMention(Node node, AceDocument doc) {<NEW_LINE>String id = getAttributeValue(node, "ID");<NEW_LINE>AceCharSeq extent = parseCharSeq<MASK><NEW_LINE>String lc = getAttributeValue(node, "LEXICALCONDITION");<NEW_LINE>// create the mention<NEW_LINE>AceRelationMention mention = new AceRelationMention(id, extent, lc);<NEW_LINE>// find the mention args<NEW_LINE>List<Node> args = getChildrenByName(node, "relation_mention_argument");<NEW_LINE>for (Node arg : args) {<NEW_LINE>String role = getAttributeValue(arg, "ROLE");<NEW_LINE>String refid = getAttributeValue(arg, "REFID");<NEW_LINE>AceEntityMention am = doc.getEntityMention(refid);<NEW_LINE>if (am != null) {<NEW_LINE>am.addRelationMention(mention);<NEW_LINE>if (role.equalsIgnoreCase("arg-1")) {<NEW_LINE>mention.getArgs()[0] = new AceRelationMentionArgument(role, am);<NEW_LINE>} else if (role.equalsIgnoreCase("arg-2")) {<NEW_LINE>mention.getArgs()[1] = new AceRelationMentionArgument(role, am);<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Invalid relation mention argument role: " + role);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mention;<NEW_LINE>} | (getChildByName(node, "extent")); |
13,097 | final GetPatchBaselineResult executeGetPatchBaseline(GetPatchBaselineRequest getPatchBaselineRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getPatchBaselineRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetPatchBaselineRequest> request = null;<NEW_LINE>Response<GetPatchBaselineResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetPatchBaselineRequestProtocolMarshaller(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, "SSM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPatchBaseline");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetPatchBaselineResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPatchBaselineResultJsonUnmarshaller());<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(getPatchBaselineRequest)); |
378,073 | private void loadPaymentRuleInfo() {<NEW_LINE>if (fPaymentRule.getSelectedItem() == null)<NEW_LINE>return;<NEW_LINE>ValueNamePair pp = fPaymentRule.getSelectedItem().toValueNamePair();<NEW_LINE>if (pp == null)<NEW_LINE>return;<NEW_LINE>String PaymentRule = pp.getValue();<NEW_LINE>log.info("PaymentRule=" + PaymentRule);<NEW_LINE>fNoPayments.setText(" ");<NEW_LINE>int HR_PaySelection_ID = fPaySelect.getSelectedItem().toKeyNamePair().getKey();<NEW_LINE>String msg = loadPaymentRuleInfo(HR_PaySelection_ID, PaymentRule);<NEW_LINE>if (noPayments != null)<NEW_LINE>fNoPayments.setText(noPayments);<NEW_LINE>bProcess.setEnabled(PaymentRule.equals("T"));<NEW_LINE>if (documentNo != null)<NEW_LINE>fDocumentNo.setValue(documentNo);<NEW_LINE>if (documentNo != null) {<NEW_LINE>MHRPaySelection hrps = new MHRPaySelection(Env.getCtx(), HR_PaySelection_ID, null);<NEW_LINE>if (hrps.get_ValueAsInt("CheckNo") > 0)<NEW_LINE>fDocumentNo.setValue<MASK><NEW_LINE>else<NEW_LINE>fDocumentNo.setValue(documentNo);<NEW_LINE>}<NEW_LINE>if (msg != null && msg.length() > 0)<NEW_LINE>FDialog.error(m_WindowNo, form, msg);<NEW_LINE>} | (hrps.get_ValueAsInt("CheckNo")); |
284,038 | public INDArray output(MultiDataSet testSet, boolean print) {<NEW_LINE>INDArray correctOutput = testSet.getLabels()[0];<NEW_LINE>INDArray ret;<NEW_LINE>decoderInputTemplate = testSet.getFeatures()[1].dup();<NEW_LINE>int currentStepThrough = 0;<NEW_LINE>int stepThroughs = (int) correctOutput.size(2) - 1;<NEW_LINE>while (currentStepThrough < stepThroughs) {<NEW_LINE>if (print) {<NEW_LINE>System.out.println("In time step " + currentStepThrough);<NEW_LINE>System.out.println("\tEncoder input and Decoder input:");<NEW_LINE>System.out.println(CustomSequenceIterator.mapToString(testSet.getFeatures()[0], decoderInputTemplate));<NEW_LINE>}<NEW_LINE>ret = stepOnce(testSet, currentStepThrough);<NEW_LINE>if (print) {<NEW_LINE>System.out.println("\tDecoder output:");<NEW_LINE>System.out.println("\t" + String.join("\n\t", CustomSequenceIterator.oneHotDecode(ret)));<NEW_LINE>}<NEW_LINE>currentStepThrough++;<NEW_LINE>}<NEW_LINE>ret = net.output(false, testSet.getFeatures()[0], decoderInputTemplate)[0];<NEW_LINE>if (print) {<NEW_LINE>System.out.println("Final time step " + currentStepThrough);<NEW_LINE>System.out.println("\tEncoder input and Decoder input:");<NEW_LINE>System.out.println(CustomSequenceIterator.mapToString(testSet.getFeatures(<MASK><NEW_LINE>System.out.println("\tDecoder output:");<NEW_LINE>System.out.println("\t" + String.join("\n\t", CustomSequenceIterator.oneHotDecode(ret)));<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | )[0], decoderInputTemplate)); |
1,804,121 | protected void readCore() throws IOException {<NEW_LINE>// Note that this structure is core_dumpx defined in<NEW_LINE>// "/usr/include/sys/core.h"<NEW_LINE>seek(0);<NEW_LINE>// Ignore signalNumber<NEW_LINE>readByte();<NEW_LINE>// CORE_TRUNC == 0x80<NEW_LINE>byte flags = readByte();<NEW_LINE>if ((flags & 0x80) != 0) {<NEW_LINE>_isTruncated = true;<NEW_LINE>}<NEW_LINE>// Ignore entryCount<NEW_LINE>readShort();<NEW_LINE>// Ignore version (core file format number)<NEW_LINE>readInt();<NEW_LINE>// Ignore fdsinfox<NEW_LINE>readLong();<NEW_LINE>_loaderOffset = readLong();<NEW_LINE>_loaderSize = readLong();<NEW_LINE>_threadCount = readInt();<NEW_LINE>// Ignore padding<NEW_LINE>readInt();<NEW_LINE>_threadOffset = readLong();<NEW_LINE>long segmentCount = readLong();<NEW_LINE>long segmentOffset = readLong();<NEW_LINE>// Stack - this appears to be special handling for the main thread first<NEW_LINE>// attached to the address space<NEW_LINE>// (this is helpful for us since that is how we can find command line<NEW_LINE>// and env vars)<NEW_LINE>long stackOffset = readLong();<NEW_LINE>long stackVirtualAddress = readLong();<NEW_LINE>long stackSize = readLong();<NEW_LINE>_structTopOfStackVirtualAddress <MASK><NEW_LINE>IMemorySource memoryRange1 = new DumpMemorySource(stackVirtualAddress, stackSize, stackOffset, 0, this, "stack", false, false, false);<NEW_LINE>addMemorySource(memoryRange1);<NEW_LINE>// User data<NEW_LINE>long dataOffset = readLong();<NEW_LINE>long dataVirtualAddress = readLong();<NEW_LINE>long dataSize = readLong();<NEW_LINE>IMemorySource memoryRange = new DumpMemorySource(dataVirtualAddress, dataSize, dataOffset, this);<NEW_LINE>addMemorySource(memoryRange);<NEW_LINE>// Ignore sdataVirtualAddress<NEW_LINE>readLong();<NEW_LINE>// Ignore sdataSize<NEW_LINE>readLong();<NEW_LINE>long vmRegionCount = readLong();<NEW_LINE>long vmRegionOffset = readLong();<NEW_LINE>_implementation = readInt();<NEW_LINE>// Ignore padding<NEW_LINE>readInt();<NEW_LINE>// Ignore checkpointRestartOffset<NEW_LINE>readLong();<NEW_LINE>// Ignore unsigned long long c_extctx; (Extended Context<NEW_LINE>readLong();<NEW_LINE>// Table offset)<NEW_LINE>// Ignore padding (6 longs)<NEW_LINE>readBytes(6 * 8);<NEW_LINE>// ignore struct thrdctx c_flt; (faulting thread's context) //this is<NEW_LINE>// resolved later via that constant "FAULTING_THREAD_OFFSET"<NEW_LINE>// ignore struct userx c_u; (copy of the user structure)<NEW_LINE>// >> end of core_dumpx structure<NEW_LINE>readVMRegions(vmRegionOffset, vmRegionCount);<NEW_LINE>readSegments(segmentOffset, segmentCount);<NEW_LINE>readLoaderInfoAsMemoryRanges();<NEW_LINE>readModules();<NEW_LINE>_isTruncated |= checkHighestOffset();<NEW_LINE>createProperties();<NEW_LINE>} | = stackVirtualAddress + stackSize - sizeofTopOfStack(); |
91,513 | public static <K extends Kernel2D> SteerableKernel<K> gaussian(Class<K> kernelType, int orderX, int orderY, double sigma, int radius) {<NEW_LINE>if (orderX < 0 || orderX > 4)<NEW_LINE>throw new IllegalArgumentException("derivX must be from 0 to 4 inclusive.");<NEW_LINE>if (orderY < 0 || orderY > 4)<NEW_LINE>throw new IllegalArgumentException("derivT must be from 0 to 4 inclusive.");<NEW_LINE>int order = orderX + orderY;<NEW_LINE>if (order > 4) {<NEW_LINE>throw new IllegalArgumentException("The total order of x and y can't be greater than 4");<NEW_LINE>}<NEW_LINE>int maxOrder = Math.max(orderX, orderY);<NEW_LINE>if (sigma <= 0)<NEW_LINE>sigma = (float) FactoryKernelGaussian.sigmaForRadius(radius, maxOrder);<NEW_LINE>else if (radius <= 0)<NEW_LINE>radius = FactoryKernelGaussian.radiusForSigma(sigma, maxOrder);<NEW_LINE>Class kernel1DType = FactoryKernel.get1DType(kernelType);<NEW_LINE>Kernel1D kerX = FactoryKernelGaussian.derivativeK(kernel1DType, orderX, sigma, radius);<NEW_LINE>Kernel1D kerY = FactoryKernelGaussian.derivativeK(<MASK><NEW_LINE>Kernel2D kernel = GKernelMath.convolve(kerY, kerX);<NEW_LINE>Kernel2D[] basis = new Kernel2D[order + 1];<NEW_LINE>// convert it into an image which can be rotated<NEW_LINE>ImageGray image = GKernelMath.convertToImage(kernel);<NEW_LINE>ImageGray imageRotated = (ImageGray) image.createNew(image.width, image.height);<NEW_LINE>basis[0] = kernel;<NEW_LINE>// form the basis by created rotated versions of the kernel<NEW_LINE>double angleStep = Math.PI / basis.length;<NEW_LINE>for (int index = 1; index <= order; index++) {<NEW_LINE>float angle = (float) (angleStep * index);<NEW_LINE>GImageMiscOps.fill(imageRotated, 0);<NEW_LINE>new FDistort(image, imageRotated).rotate(angle).apply();<NEW_LINE>basis[index] = GKernelMath.convertToKernel(imageRotated);<NEW_LINE>}<NEW_LINE>SteerableKernel<K> ret;<NEW_LINE>if (kernelType == Kernel2D_F32.class)<NEW_LINE>ret = (SteerableKernel<K>) new SteerableKernel_F32();<NEW_LINE>else<NEW_LINE>ret = (SteerableKernel<K>) new SteerableKernel_I32();<NEW_LINE>ret.setBasis(FactorySteerCoefficients.polynomial(order), basis);<NEW_LINE>return ret;<NEW_LINE>} | kernel1DType, orderY, sigma, radius); |
1,674,254 | private void logCounters(Map<MetricName, Counter> counters, StringBuilder sb) {<NEW_LINE>if (!counters.isEmpty()) {<NEW_LINE>printWithBanner("-- Counters", '-', sb);<NEW_LINE>int maxLength = getMaxLengthOfKeys(counters);<NEW_LINE>sb.append(String.format("%-" <MASK><NEW_LINE>Map<MetricName, Counter> sortedCounters = sortByValue(counters, new Comparator<Counter>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(Counter o1, Counter o2) {<NEW_LINE>return ((Long) o2.getCount()).compareTo(o1.getCount());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>for (Map.Entry<MetricName, Counter> entry : sortedCounters.entrySet()) {<NEW_LINE>printCounter(InfluxDbReporter.getInfluxDbLineProtocolString(entry.getKey()), entry.getValue(), maxLength, sb);<NEW_LINE>}<NEW_LINE>sb.append('\n');<NEW_LINE>}<NEW_LINE>} | + maxLength + "s | count\n", "name")); |
706,975 | public LibraryFile resolveLibrary(Emulator<?> emulator, String soName) {<NEW_LINE>if (!soName.contains("@")) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String path = soName.replace("@executable_path", file.<MASK><NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Try resolve library soName=" + soName + ", path=" + path);<NEW_LINE>}<NEW_LINE>if (path.contains("@")) {<NEW_LINE>log.warn("Try resolve library soName=" + soName + ", path=" + path);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!loadList.isEmpty() && !loadList.contains(FilenameUtils.getName(path))) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>File file = new File(path);<NEW_LINE>if (!file.exists() || !file.isFile()) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>return new DmgLibraryFile(soName, bundleAppDir, file, loadList);<NEW_LINE>}<NEW_LINE>} | getParentFile().getPath()); |
349,450 | protected void appendXsbCommonSlot(XStringBuilder xsb, SofaTracerSpan span) {<NEW_LINE>SofaTracerSpanContext context = span.getSofaTracerSpanContext();<NEW_LINE>Map<String, String> tagWithStr = span.getTagsWithStr();<NEW_LINE>// span end time<NEW_LINE>xsb.append(Timestamp.format<MASK><NEW_LINE>// appName<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.LOCAL_APP));<NEW_LINE>// TraceId<NEW_LINE>xsb.append(context.getTraceId());<NEW_LINE>// RpcId<NEW_LINE>xsb.append(context.getSpanId());<NEW_LINE>// span kind<NEW_LINE>xsb.append(tagWithStr.get(Tags.SPAN_KIND.getKey()));<NEW_LINE>// result code<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.RESULT_CODE));<NEW_LINE>// thread name<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.CURRENT_THREAD_NAME));<NEW_LINE>// time.cost.milliseconds<NEW_LINE>xsb.append((span.getEndTime() - span.getStartTime()) + SofaTracerConstant.MS);<NEW_LINE>} | (span.getEndTime())); |
737,796 | public List<MetricsValues> readLabeledMetricsValues(final MetricsCondition condition, final String valueColumnName, final List<String> labels, final Duration duration) {<NEW_LINE>final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();<NEW_LINE>String tableName = IndexController.LogicIndicesRegister.getPhysicalTableName(condition.getName());<NEW_LINE>boolean aggregationMode = !tableName.equals(condition.getName());<NEW_LINE>List<String> ids = new ArrayList<>(pointOfTimes.size());<NEW_LINE>pointOfTimes.forEach(pointOfTime -> {<NEW_LINE>String id = pointOfTime.id(condition.getEntity().buildId());<NEW_LINE>if (aggregationMode) {<NEW_LINE>id = IndexController.INSTANCE.generateDocId(condition.getName(), id);<NEW_LINE>}<NEW_LINE>ids.add(id);<NEW_LINE>});<NEW_LINE>SearchResponse response = getClient().ids(tableName, ids);<NEW_LINE>Map<String, DataTable> idMap = new HashMap<>();<NEW_LINE>if (!response.getHits().getHits().isEmpty()) {<NEW_LINE>for (final SearchHit hit : response.getHits()) {<NEW_LINE>idMap.put(hit.getId(), new DataTable((String) hit.getSource().<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Util.composeLabelValue(condition, labels, ids, idMap);<NEW_LINE>} | getOrDefault(valueColumnName, ""))); |
1,217,255 | public static QueryTradeProduceListResponse unmarshall(QueryTradeProduceListResponse queryTradeProduceListResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryTradeProduceListResponse.setRequestId(_ctx.stringValue("QueryTradeProduceListResponse.RequestId"));<NEW_LINE>queryTradeProduceListResponse.setTotalItemNum(_ctx.integerValue("QueryTradeProduceListResponse.TotalItemNum"));<NEW_LINE>queryTradeProduceListResponse.setCurrentPageNum(_ctx.integerValue("QueryTradeProduceListResponse.CurrentPageNum"));<NEW_LINE>queryTradeProduceListResponse.setPageSize(_ctx.integerValue("QueryTradeProduceListResponse.PageSize"));<NEW_LINE>queryTradeProduceListResponse.setTotalPageNum(_ctx.integerValue("QueryTradeProduceListResponse.TotalPageNum"));<NEW_LINE>List<TradeProduces> data = new ArrayList<TradeProduces>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryTradeProduceListResponse.Data.Length"); i++) {<NEW_LINE>TradeProduces tradeProduces = new TradeProduces();<NEW_LINE>tradeProduces.setBizId(_ctx.stringValue("QueryTradeProduceListResponse.Data[" + i + "].BizId"));<NEW_LINE>tradeProduces.setPreOrderId(_ctx.stringValue<MASK><NEW_LINE>tradeProduces.setPreAmount(_ctx.integerValue("QueryTradeProduceListResponse.Data[" + i + "].PreAmount"));<NEW_LINE>tradeProduces.setFinalAmount(_ctx.integerValue("QueryTradeProduceListResponse.Data[" + i + "].FinalAmount"));<NEW_LINE>tradeProduces.setRegisterNumber(_ctx.stringValue("QueryTradeProduceListResponse.Data[" + i + "].RegisterNumber"));<NEW_LINE>tradeProduces.setClassification(_ctx.stringValue("QueryTradeProduceListResponse.Data[" + i + "].Classification"));<NEW_LINE>tradeProduces.setIcon(_ctx.stringValue("QueryTradeProduceListResponse.Data[" + i + "].Icon"));<NEW_LINE>tradeProduces.setOperateNote(_ctx.stringValue("QueryTradeProduceListResponse.Data[" + i + "].OperateNote"));<NEW_LINE>tradeProduces.setBuyerStatus(_ctx.integerValue("QueryTradeProduceListResponse.Data[" + i + "].BuyerStatus"));<NEW_LINE>tradeProduces.setUserId(_ctx.stringValue("QueryTradeProduceListResponse.Data[" + i + "].UserId"));<NEW_LINE>tradeProduces.setCreateTime(_ctx.longValue("QueryTradeProduceListResponse.Data[" + i + "].CreateTime"));<NEW_LINE>tradeProduces.setUpdateTime(_ctx.longValue("QueryTradeProduceListResponse.Data[" + i + "].UpdateTime"));<NEW_LINE>tradeProduces.setAllowCancel(_ctx.booleanValue("QueryTradeProduceListResponse.Data[" + i + "].AllowCancel"));<NEW_LINE>tradeProduces.setFailReason(_ctx.integerValue("QueryTradeProduceListResponse.Data[" + i + "].FailReason"));<NEW_LINE>data.add(tradeProduces);<NEW_LINE>}<NEW_LINE>queryTradeProduceListResponse.setData(data);<NEW_LINE>return queryTradeProduceListResponse;<NEW_LINE>} | ("QueryTradeProduceListResponse.Data[" + i + "].PreOrderId")); |
909,105 | private // SQLDCXGRP; PROTOCOL TYPE N-GDA; ENVLID 0xD3; Length Override 1<NEW_LINE>NetSqlca parseSQLDCGRP() {<NEW_LINE>// SQLCODE<NEW_LINE>int sqldcCode = readFdocaInt();<NEW_LINE>String sqldcState = // SQLSTATE<NEW_LINE>readFdocaString(// SQLSTATE<NEW_LINE>5, Typdef.targetTypdef.getCcsidSbcEncoding());<NEW_LINE>// REASON_CODE<NEW_LINE>int sqldcReason = readFdocaInt();<NEW_LINE>// LINE_NUMBER + ROW_NUMBER<NEW_LINE>skipFdocaBytes(12);<NEW_LINE>NetSqlca sqlca = new // netAgent_.netConnection_,<NEW_LINE>NetSqlca(sqldcCode, sqldcState, (byte[]) null);<NEW_LINE>// SQLDCER01-04 + SQLDCPART + SQLDCPPOP + SQLDCMSGID<NEW_LINE>skipFdocaBytes(49);<NEW_LINE>// SQLDCMDE + SQLDCPMOD + RDBNAME<NEW_LINE>// MESSAGE_TOKENS<NEW_LINE>parseSQLDCTOKS();<NEW_LINE>// MESSAGE_TEXT<NEW_LINE>String sqldcMsg = parseVCS(qrydscTypdef_);<NEW_LINE>if (sqldcMsg != null) {<NEW_LINE>sqlca.<MASK><NEW_LINE>}<NEW_LINE>// COLUMN_NAME + PARAMETER_NAME + EXTENDED_NAMES<NEW_LINE>skipFdocaBytes(12);<NEW_LINE>// SQLDCXGRP<NEW_LINE>parseSQLDCXGRP();<NEW_LINE>return sqlca;<NEW_LINE>} | setSqlerrmcBytes(sqldcMsg.getBytes()); |
1,366,832 | protected List<String> gatherCompletedFlows(List<String> completedActivityInstances, List<String> currentActivityinstances, BpmnModel pojoModel) {<NEW_LINE>List<String> completedFlows = new ArrayList<>();<NEW_LINE>List<String> activities <MASK><NEW_LINE>if (currentActivityinstances != null) {<NEW_LINE>activities.addAll(currentActivityinstances);<NEW_LINE>}<NEW_LINE>// TODO: not a robust way of checking when parallel paths are active, should be revisited<NEW_LINE>// Go over all activities and check if it's possible to match any outgoing paths against the activities<NEW_LINE>for (FlowElement activity : pojoModel.getMainProcess().getFlowElements()) {<NEW_LINE>if (activity instanceof FlowNode) {<NEW_LINE>int index = activities.indexOf(activity.getId());<NEW_LINE>if (index >= 0 && index + 1 < activities.size()) {<NEW_LINE>List<SequenceFlow> outgoingFlows = ((FlowNode) activity).getOutgoingFlows();<NEW_LINE>for (SequenceFlow flow : outgoingFlows) {<NEW_LINE>String destinationFlowId = flow.getTargetRef();<NEW_LINE>if (destinationFlowId.equals(activities.get(index + 1))) {<NEW_LINE>completedFlows.add(flow.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return completedFlows;<NEW_LINE>} | = new ArrayList<>(completedActivityInstances); |
1,311,428 | public String readArrayString(VmArrayInstance instance, int index, int length) {<NEW_LINE>if (!instance.elementType().isPrimitive() || !"C".equals(instance.elementType().signature())) {<NEW_LINE>throw new DebuggerException("Wrong array element type while trying to get string from array: " + instance.elementType().signature());<NEW_LINE>}<NEW_LINE>if (index < 0 || length <= 0 || index + length > instance.length())<NEW_LINE>throw new DebuggerException(JdwpConsts.Error.INVALID_LENGTH);<NEW_LINE>ClassInfoPrimitiveImpl primType = (ClassInfoPrimitiveImpl) instance.elementType();<NEW_LINE>delegates.runtime().deviceMemoryReader().setPosition(instance.dataPtr() + <MASK><NEW_LINE>byte[] bytes = delegates.runtime().deviceMemoryReader().readBytes(primType.size() * length);<NEW_LINE>// using UTF-16LE here as target is little endian and each char is short which means that low byte will go first<NEW_LINE>return new String(bytes, StandardCharsets.UTF_16LE);<NEW_LINE>} | primType.size() * index); |
664,015 | public static boolean dispatch(Object target, String subject, String senderAddress, Object args) {<NEW_LINE>assert (subject != null);<NEW_LINE>assert (target != null);<NEW_LINE>Method handler = resolveHandler(target.getClass(), subject);<NEW_LINE>if (handler == null)<NEW_LINE>return false;<NEW_LINE>try {<NEW_LINE>handler.invoke(target, subject, senderAddress, args);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>s_logger.error("Unexpected exception when calling " + target.getClass().getName() + "." + <MASK><NEW_LINE>throw new RuntimeException("IllegalArgumentException when invoking event handler for subject: " + subject);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>s_logger.error("Unexpected exception when calling " + target.getClass().getName() + "." + handler.getName(), e);<NEW_LINE>throw new RuntimeException("IllegalAccessException when invoking event handler for subject: " + subject);<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>s_logger.error("Unexpected exception when calling " + target.getClass().getName() + "." + handler.getName(), e);<NEW_LINE>throw new RuntimeException("InvocationTargetException when invoking event handler for subject: " + subject);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | handler.getName(), e); |
809,238 | public void executeUpgrade() throws DotDataException {<NEW_LINE>try {<NEW_LINE>Connection conn = DbConnectionFactory.getDataSource().getConnection();<NEW_LINE>conn.setAutoCommit(true);<NEW_LINE>// Drop PK<NEW_LINE>getPrimaryKey(conn, ImmutableList.of(tableName), true);<NEW_LINE>// Drop Indexes<NEW_LINE>this.getIndexes(conn, ImmutableList<MASK><NEW_LINE>// Update relation_type null or empty values to LEGACY_RELATION_TYPE<NEW_LINE>DotConnect db = new DotConnect();<NEW_LINE>db.setSQL(updateRelationTypesSQL);<NEW_LINE>db.loadResult(conn);<NEW_LINE>// Change relation_type to Not null<NEW_LINE>if (DbConnectionFactory.isMySql()) {<NEW_LINE>db.setSQL(MYSQL_SET_NOT_NULL_RELATION_TYPE);<NEW_LINE>}<NEW_LINE>if (DbConnectionFactory.isMsSql()) {<NEW_LINE>db.setSQL(MSSQL_SET_NOT_NULL_RELATION_TYPE);<NEW_LINE>}<NEW_LINE>if (DbConnectionFactory.isOracle()) {<NEW_LINE>db.setSQL(ORACLE_SET_NOT_NULL_RELATION_TYPE);<NEW_LINE>}<NEW_LINE>if (DbConnectionFactory.isPostgres()) {<NEW_LINE>db.setSQL(POSTGRES_SET_NOT_NULL_RELATION_TYPE);<NEW_LINE>}<NEW_LINE>db.loadResult(conn);<NEW_LINE>// Add PKs<NEW_LINE>db.setSQL(alterRelationTypePK);<NEW_LINE>db.loadResult(conn);<NEW_LINE>// Add Indexes<NEW_LINE>db.setSQL(addIndexToMultiTree);<NEW_LINE>db.loadResult(conn);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new DotDataException(e);<NEW_LINE>}<NEW_LINE>} | .of(tableName), true); |
244,811 | static void run(final Class<? extends BaseMain> cls, final String... args) throws Throwable {<NEW_LINE>String jvmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments().stream().filter(s -> s.startsWith("-X")).collect(Collectors.joining(" "));<NEW_LINE>Log log = FormattedLog.withLogLevel(Level.DEBUG).withZoneId(ZoneId.systemDefault()).withDateTimeFormatter(DateTimeFormatter.ISO_LOCAL_DATE_TIME).toOutputStream(System.out);<NEW_LINE>log.info("Started with JVM args %s", jvmArgs);<NEW_LINE>Collection<String> argv = new HashSet<>(Arrays.asList(args));<NEW_LINE>boolean skipBarrier = argv.remove("-skipBarrier");<NEW_LINE>AtomicReference<String> graphConfig = new AtomicReference<>("L10");<NEW_LINE>argv.removeIf(arg -> {<NEW_LINE>if (arg.startsWith("-db=")) {<NEW_LINE>String dbToLoad = arg.split("=")[1].trim();<NEW_LINE>graphConfig.set(dbToLoad);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>String graphToLoad = graphConfig.get();<NEW_LINE>BaseMain main = cls.getDeclaredConstructor().newInstance();<NEW_LINE>main.init(argv);<NEW_LINE>if (!skipBarrier) {<NEW_LINE><MASK><NEW_LINE>@SuppressWarnings("unused")<NEW_LINE>int read = System.in.read();<NEW_LINE>System.out.println("Starting...");<NEW_LINE>}<NEW_LINE>System.gc();<NEW_LINE>Iterable<String> messages = Collections.emptyList();<NEW_LINE>try {<NEW_LINE>messages = main.run(graphToLoad, log);<NEW_LINE>} finally {<NEW_LINE>log.info("before shutdown");<NEW_LINE>System.gc();<NEW_LINE>jprofBookmark("shutdown");<NEW_LINE>Pools.DEFAULT.shutdownNow();<NEW_LINE>System.gc();<NEW_LINE>for (String message : messages) {<NEW_LINE>log.info(message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.out.println("Press [Enter] to start"); |
1,670,344 | // CHECKSTYLE:OFF<NEW_LINE>private List<MavenArtifact> parseDependenciesNode(Node dependenciesNode) {<NEW_LINE>// CHECKSTYLE:ON<NEW_LINE>final List<MavenArtifact> deps = new ArrayList<>();<NEW_LINE>final NodeList dependencyNodes = dependenciesNode.getChildNodes();<NEW_LINE>for (int j = 0; j < dependencyNodes.getLength(); j++) {<NEW_LINE>final Node dependencyNode = dependencyNodes.item(j);<NEW_LINE>if ("dependency".equals(dependencyNode.getNodeName())) {<NEW_LINE>final NodeList childDependencyNodes = dependencyNode.getChildNodes();<NEW_LINE>final MavenArtifact dependency = new MavenArtifact();<NEW_LINE>String scope = null;<NEW_LINE>String optional = null;<NEW_LINE>for (int k = 0; k < childDependencyNodes.getLength(); k++) {<NEW_LINE>final Node <MASK><NEW_LINE>final String nodeName = childDependencyNode.getNodeName();<NEW_LINE>if ("groupId".equals(nodeName)) {<NEW_LINE>dependency.groupId = childDependencyNode.getTextContent();<NEW_LINE>} else if ("artifactId".equals(nodeName)) {<NEW_LINE>dependency.artifactId = childDependencyNode.getTextContent();<NEW_LINE>} else if ("version".equals(nodeName)) {<NEW_LINE>dependency.version = childDependencyNode.getTextContent();<NEW_LINE>} else if ("scope".equals(nodeName)) {<NEW_LINE>scope = childDependencyNode.getTextContent();<NEW_LINE>} else if ("optional".equals(nodeName)) {<NEW_LINE>optional = childDependencyNode.getTextContent();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if ((scope == null || "compile".equals(scope)) && !"true".equals(optional)) {<NEW_LINE>deps.add(dependency);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return deps;<NEW_LINE>} | childDependencyNode = childDependencyNodes.item(k); |
1,096,271 | public List<JoinTransactionBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {<NEW_LINE>final String id = decodingContext.getApplicationId();<NEW_LINE>final long baseTimestamp = decodingContext.getBaseTimestamp();<NEW_LINE>final long timestampDelta = decodingContext.getTimestampDelta();<NEW_LINE>final long initialTimestamp = baseTimestamp + timestampDelta;<NEW_LINE>int numValues = valueBuffer.readVInt();<NEW_LINE>List<Long> timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);<NEW_LINE>// decode headers<NEW_LINE>final byte[] header = valueBuffer.readPrefixedBytes();<NEW_LINE>AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);<NEW_LINE>EncodingStrategy<Long> collectIntervalEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());<NEW_LINE>JoinLongFieldEncodingStrategy totalCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());<NEW_LINE>List<Long> collectIntervalList = this.codec.<MASK><NEW_LINE>final List<JoinLongFieldBo> totalCountList = this.codec.decodeValues(valueBuffer, totalCountEncodingStrategy, numValues);<NEW_LINE>List<JoinTransactionBo> joinTransactionBoList = new ArrayList<>();<NEW_LINE>for (int i = 0; i < numValues; i++) {<NEW_LINE>JoinTransactionBo joinTransactionBo = new JoinTransactionBo();<NEW_LINE>joinTransactionBo.setId(id);<NEW_LINE>joinTransactionBo.setTimestamp(timestampList.get(i));<NEW_LINE>joinTransactionBo.setCollectInterval(collectIntervalList.get(i));<NEW_LINE>joinTransactionBo.setTotalCountJoinValue(totalCountList.get(i));<NEW_LINE>joinTransactionBoList.add(joinTransactionBo);<NEW_LINE>}<NEW_LINE>return joinTransactionBoList;<NEW_LINE>} | decodeValues(valueBuffer, collectIntervalEncodingStrategy, numValues); |
384,786 | private void confirmCreateWidget() {<NEW_LINE>int backgroundColor = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress());<NEW_LINE>SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE);<NEW_LINE>SharedPreferences.Editor editor = prefs.edit();<NEW_LINE>editor.putInt(PlayerWidget.KEY_WIDGET_COLOR + appWidgetId, backgroundColor);<NEW_LINE>editor.putBoolean(PlayerWidget.KEY_WIDGET_SKIP + <MASK><NEW_LINE>editor.putBoolean(PlayerWidget.KEY_WIDGET_REWIND + appWidgetId, ckRewind.isChecked());<NEW_LINE>editor.putBoolean(PlayerWidget.KEY_WIDGET_FAST_FORWARD + appWidgetId, ckFastForward.isChecked());<NEW_LINE>editor.apply();<NEW_LINE>Intent resultValue = new Intent();<NEW_LINE>resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);<NEW_LINE>setResult(RESULT_OK, resultValue);<NEW_LINE>finish();<NEW_LINE>WidgetUpdaterWorker.enqueueWork(this);<NEW_LINE>} | appWidgetId, ckSkip.isChecked()); |
1,740,377 | private void createDifferences() throws Exception {<NEW_LINE><MASK><NEW_LINE>ProjectData projectData = project.getProjectData();<NEW_LINE>DomainFile file = projectData.getRootFolder().getFile("WinHelloCpp.exe");<NEW_LINE>Program p = (Program) file.getDomainObject(this, false, false, dummyMonitor);<NEW_LINE>int id = p.startTransaction("Test");<NEW_LINE>Listing listing = p.getListing();<NEW_LINE>listing.clearCodeUnits(addr(0x408dcd), addr(0x408dcd), false);<NEW_LINE>SymbolTable symbolTable = p.getSymbolTable();<NEW_LINE>symbolTable.createLabel(addr(0x408dd9), "BOB", SourceType.USER_DEFINED);<NEW_LINE>symbolTable.createLabel(addr(0x408deb), "EXTRA", SourceType.USER_DEFINED);<NEW_LINE>p.endTransaction(id, true);<NEW_LINE>p.save("some changes", dummyMonitor);<NEW_LINE>p.release(this);<NEW_LINE>} | Project project = env.getProject(); |
143,540 | protected void scheduleInternal(final Iterator<T> it, final String cron, final ScheduledExecutorService ex) {<NEW_LINE>final Date now = new Date();<NEW_LINE>final Date d = ExceptionSoftener.softenSupplier(() -> new CronExpression(cron)).get().getNextValidTimeAfter(now);<NEW_LINE>final long delay = d.getTime() - now.getTime();<NEW_LINE>ex.schedule(() -> {<NEW_LINE>synchronized (it) {<NEW_LINE>if (it.hasNext()) {<NEW_LINE>try {<NEW_LINE>final T next = it.next();<NEW_LINE>final int local = connected;<NEW_LINE>for (int i = 0; i < local; i++) {<NEW_LINE>Eithers.blocking(connections.get(i)).fold(FluentFunctions.ofChecked(in -> {<NEW_LINE>in.put(next);<NEW_LINE>return true;<NEW_LINE>}), q -> q.offer(next));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>open.set(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, delay, TimeUnit.MILLISECONDS);<NEW_LINE>} | scheduleInternal(it, cron, ex); |
630,077 | public void broadcast() {<NEW_LINE>if (pending.compareAndSet(false, true)) {<NEW_LINE>try {<NEW_LINE>Set<String> oldMetricsNames = metricNames.getAndSet(<MASK><NEW_LINE>if (oldMetricsNames.size() > 0) {<NEW_LINE>LOG.debug("register metrics to nimbus from TM, size:{}", oldMetricsNames.size());<NEW_LINE>Map<String, Long> nameIdMap = metricsRegister.registerMetrics(oldMetricsNames);<NEW_LINE>LOG.debug("register metrics to nimbus from TM, ret size:{}", nameIdMap.size());<NEW_LINE>if (nameIdMap.size() > 0) {<NEW_LINE>// we broadcast metrics meta to all workers, for large<NEW_LINE>// topologies, might be quite large<NEW_LINE>for (ResourceWorkerSlot worker : tmContext.getWorkerSet().get()) {<NEW_LINE>Set<Integer> tasks = worker.getTasks();<NEW_LINE>int task = tasks.iterator().next();<NEW_LINE>tmContext.getCollector().getDelegate().emitDirect(task, Common.TOPOLOGY_MASTER_REGISTER_METRICS_RESP_STREAM_ID, null, new Values(nameIdMap));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOG.error("Error:", e);<NEW_LINE>} finally {<NEW_LINE>pending.set(false);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOG.warn("pending register metrics, skip...");<NEW_LINE>}<NEW_LINE>} | new HashSet<String>()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.