idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
709,842 | public void propertyChange(PropertyChangeEvent event) {<NEW_LINE>CompoundCommand result = new CompoundCommand();<NEW_LINE>if (event.getProperty() == FontChooser.PROP_FONTCHANGE) {<NEW_LINE>FontData selectedFontData = fFontChooser.getFontData();<NEW_LINE>RGB rgb = fFontChooser.getFontRGB();<NEW_LINE>for (EObject fa : getEObjects()) {<NEW_LINE>if (isAlive(fa)) {<NEW_LINE>Command cmd = new FontCompoundCommand((IFontAttribute) fa, selectedFontData.toString(), rgb);<NEW_LINE>if (cmd.canExecute()) {<NEW_LINE>result.add(cmd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (event.getProperty() == FontChooser.PROP_FONTDEFAULT) {<NEW_LINE>for (EObject fa : getEObjects()) {<NEW_LINE>if (isAlive(fa)) {<NEW_LINE>Command cmd = new FontStyleCommand<MASK><NEW_LINE>if (cmd.canExecute()) {<NEW_LINE>result.add(cmd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>executeCommand(result.unwrap());<NEW_LINE>} | ((IFontAttribute) fa, null); |
300,170 | public void read(org.apache.thrift.protocol.TProtocol prot, FrontendRequest struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet incoming = iprot.readBitSet(4);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.type = com.facebook.buck.frontend.thrift.FrontendRequestType.findByValue(iprot.readI32());<NEW_LINE>struct.setTypeIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.logRequest = new LogRequest();<NEW_LINE>struct.logRequest.read(iprot);<NEW_LINE>struct.setLogRequestIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>struct.announcementRequest = new AnnouncementRequest();<NEW_LINE><MASK><NEW_LINE>struct.setAnnouncementRequestIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(3)) {<NEW_LINE>struct.fetchRuleKeyLogsRequest = new FetchRuleKeyLogsRequest();<NEW_LINE>struct.fetchRuleKeyLogsRequest.read(iprot);<NEW_LINE>struct.setFetchRuleKeyLogsRequestIsSet(true);<NEW_LINE>}<NEW_LINE>} | struct.announcementRequest.read(iprot); |
643,339 | public static ListWebhooksResponse unmarshall(ListWebhooksResponse listWebhooksResponse, UnmarshallerContext _ctx) {<NEW_LINE>listWebhooksResponse.setRequestId(_ctx.stringValue("ListWebhooksResponse.RequestId"));<NEW_LINE>listWebhooksResponse.setTotalCount(_ctx.integerValue("ListWebhooksResponse.TotalCount"));<NEW_LINE>listWebhooksResponse.setMessage(_ctx.stringValue("ListWebhooksResponse.Message"));<NEW_LINE>listWebhooksResponse.setNextToken(_ctx.integerValue("ListWebhooksResponse.NextToken"));<NEW_LINE>listWebhooksResponse.setCode(_ctx.stringValue("ListWebhooksResponse.Code"));<NEW_LINE>listWebhooksResponse.setSuccess(_ctx.booleanValue("ListWebhooksResponse.Success"));<NEW_LINE>List<Webhook> webhooks <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListWebhooksResponse.Webhooks.Length"); i++) {<NEW_LINE>Webhook webhook = new Webhook();<NEW_LINE>webhook.setServerUrl(_ctx.stringValue("ListWebhooksResponse.Webhooks[" + i + "].ServerUrl"));<NEW_LINE>webhook.setWebhookId(_ctx.longValue("ListWebhooksResponse.Webhooks[" + i + "].WebhookId"));<NEW_LINE>webhook.setName(_ctx.stringValue("ListWebhooksResponse.Webhooks[" + i + "].Name"));<NEW_LINE>webhooks.add(webhook);<NEW_LINE>}<NEW_LINE>listWebhooksResponse.setWebhooks(webhooks);<NEW_LINE>return listWebhooksResponse;<NEW_LINE>} | = new ArrayList<Webhook>(); |
182,046 | public UpdateRouteCalculatorResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateRouteCalculatorResult updateRouteCalculatorResult = new UpdateRouteCalculatorResult();<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 updateRouteCalculatorResult;<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("CalculatorArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateRouteCalculatorResult.setCalculatorArn(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("CalculatorName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateRouteCalculatorResult.setCalculatorName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("UpdateTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateRouteCalculatorResult.setUpdateTime(DateJsonUnmarshallerFactory.getInstance("iso8601").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 updateRouteCalculatorResult;<NEW_LINE>} | class).unmarshall(context)); |
598,988 | public OEdge createGraphElement(final Object iObject) {<NEW_LINE>if (iObject instanceof OElement && ((OElement) iObject).isEdge())<NEW_LINE>return ((OElement) iObject).asEdge().get();<NEW_LINE>final OIdentifiable rec = (OIdentifiable) iObject;<NEW_LINE>if (rec == null) {<NEW_LINE>// SKIP IT<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final ORecord record = rec.getRecord();<NEW_LINE>if (record == null) {<NEW_LINE>// SKIP IT<NEW_LINE>OLogManager.instance().<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!(record instanceof OElement)) {<NEW_LINE>// SKIP IT<NEW_LINE>OLogManager.instance().warn(this, "Found a record (%s) that is not an edge. Source vertex : %s, Target vertex : %s, Database : %s", rec, sourceVertex != null ? sourceVertex.getIdentity() : null, targetVertex != null ? targetVertex.getIdentity() : null, record.getDatabase().getURL());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final OElement value = (OElement) record;<NEW_LINE>final OEdge edge;<NEW_LINE>if (value.isVertex()) {<NEW_LINE>// DIRECT VERTEX, CREATE DUMMY EDGE<NEW_LINE>ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().getIfDefined();<NEW_LINE>OClass clazz = null;<NEW_LINE>if (db != null && connection.getValue() != null) {<NEW_LINE>clazz = db.getMetadata().getSchema().getClass(connection.getValue());<NEW_LINE>}<NEW_LINE>if (connection.getKey() == ODirection.OUT) {<NEW_LINE>edge = new OEdgeDelegate(this.sourceVertex, value.asVertex().get(), clazz, connection.getValue());<NEW_LINE>} else {<NEW_LINE>edge = new OEdgeDelegate(value.asVertex().get(), this.sourceVertex, clazz, connection.getValue());<NEW_LINE>}<NEW_LINE>} else if (value.isEdge()) {<NEW_LINE>// EDGE<NEW_LINE>edge = value.asEdge().get();<NEW_LINE>} else<NEW_LINE>throw new IllegalStateException("Invalid content found while iterating edges, value '" + value + "' is not an edge");<NEW_LINE>return edge;<NEW_LINE>} | warn(this, "Record (%s) is null", rec); |
899,521 | public static GetQuotaAlarmResponse unmarshall(GetQuotaAlarmResponse getQuotaAlarmResponse, UnmarshallerContext _ctx) {<NEW_LINE>getQuotaAlarmResponse.setRequestId(_ctx.stringValue("GetQuotaAlarmResponse.RequestId"));<NEW_LINE>QuotaAlarm quotaAlarm = new QuotaAlarm();<NEW_LINE>quotaAlarm.setAlarmId(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.AlarmId"));<NEW_LINE>quotaAlarm.setQuotaActionCode(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.QuotaActionCode"));<NEW_LINE>quotaAlarm.setQuotaValue(_ctx.floatValue("GetQuotaAlarmResponse.QuotaAlarm.QuotaValue"));<NEW_LINE>quotaAlarm.setThresholdPercent(_ctx.floatValue("GetQuotaAlarmResponse.QuotaAlarm.ThresholdPercent"));<NEW_LINE>quotaAlarm.setAlarmName(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.AlarmName"));<NEW_LINE>quotaAlarm.setProductCode(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.ProductCode"));<NEW_LINE>quotaAlarm.setNotifyTarget(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.NotifyTarget"));<NEW_LINE>quotaAlarm.setCreateTime<MASK><NEW_LINE>quotaAlarm.setQuotaDimension(_ctx.mapValue("GetQuotaAlarmResponse.QuotaAlarm.QuotaDimension"));<NEW_LINE>quotaAlarm.setQuotaUsage(_ctx.floatValue("GetQuotaAlarmResponse.QuotaAlarm.QuotaUsage"));<NEW_LINE>quotaAlarm.setThreshold(_ctx.floatValue("GetQuotaAlarmResponse.QuotaAlarm.Threshold"));<NEW_LINE>quotaAlarm.setThresholdType(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.ThresholdType"));<NEW_LINE>List<String> notifyChannels = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetQuotaAlarmResponse.QuotaAlarm.NotifyChannels.Length"); i++) {<NEW_LINE>notifyChannels.add(_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.NotifyChannels[" + i + "]"));<NEW_LINE>}<NEW_LINE>quotaAlarm.setNotifyChannels(notifyChannels);<NEW_LINE>getQuotaAlarmResponse.setQuotaAlarm(quotaAlarm);<NEW_LINE>return getQuotaAlarmResponse;<NEW_LINE>} | (_ctx.stringValue("GetQuotaAlarmResponse.QuotaAlarm.CreateTime")); |
98,817 | public static void main(String[] args) {<NEW_LINE>final String USAGE = "\n" + "ImportSegment - Creates a segment by: \n" + "1.) Uploading the endpoint definitions that belong to the segment to an Amazon S3 bucket. \n" + "2.) Importing the endpoint definitions from the bucket to an Amazon Pinpoint application." + " Amazon Pinpoint creates a segment that has the specified name.\n\n" + "Usage: ImportSegment <endpointsFileLocation> <s3BucketName> <iamImportRoleArn> <segmentName> <applicationId>\n\n" + "Where:\n" + " endpointsFileLocation - The relative location of the JSON file that contains the endpoint definitions.\n" + " s3BucketName - The name of the Amazon S3 bucket to upload the JSON file to. If the bucket doesn't " + "exist, a new bucket is created.\n" + " iamImportRoleArn - The ARN of an IAM role that grants Amazon Pinpoint read permissions so the S3 bucket.\n" + " segmentName - The name for the segment that you are creating or updating." + " applicationId - The ID of the Amazon Pinpoint application to add the endpoints to.";<NEW_LINE>if (args.length < 1) {<NEW_LINE><MASK><NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>String endpointsFileLocation = args[0];<NEW_LINE>String s3BucketName = args[1];<NEW_LINE>String iamImportRoleArn = args[2];<NEW_LINE>String segmentName = args[3];<NEW_LINE>String applicationId = args[4];<NEW_LINE>Path endpointsFilePath = Paths.get(endpointsFileLocation);<NEW_LINE>File endpointsFile = new File(endpointsFilePath.toAbsolutePath().toString());<NEW_LINE>uploadToS3(endpointsFile, s3BucketName);<NEW_LINE>importSegment(endpointsFile.getName(), s3BucketName, iamImportRoleArn, segmentName, applicationId);<NEW_LINE>} | System.out.println(USAGE); |
547,203 | private void showPopupMenu(Component callingComponent, String actionCommand) {<NEW_LINE>// keep auto-answer for yes/no<NEW_LINE>// two modes:<NEW_LINE>// - remember text for all (example: commander zone change);<NEW_LINE>// - remember text + ability for source only (example: any optional ability)<NEW_LINE>// yes<NEW_LINE>popupItemYesAsText.setEnabled(true);<NEW_LINE>popupItemYesAsTextAndAbility.setEnabled(originalId != null);<NEW_LINE>popupItemYesAsText.setEnabled(true);<NEW_LINE>popupItemYesAsTextAndAbility.setEnabled(originalId != null);<NEW_LINE>// no<NEW_LINE>popupItemNoAsText.setEnabled(true);<NEW_LINE><MASK><NEW_LINE>popupItemNoAsText.setEnabled(true);<NEW_LINE>popupItemNoAsTextAndAbility.setEnabled(originalId != null);<NEW_LINE>Point p = callingComponent.getLocationOnScreen();<NEW_LINE>// Show the JPopupMenu via program<NEW_LINE>// Parameter desc<NEW_LINE>// ----------------<NEW_LINE>// this - represents current frame<NEW_LINE>// 0,0 is the coordinate where the popup<NEW_LINE>// is shown<NEW_LINE>JPopupMenu menu;<NEW_LINE>if (actionCommand.endsWith("Yes")) {<NEW_LINE>menu = popupMenuAskYes;<NEW_LINE>} else {<NEW_LINE>menu = popupMenuAskNo;<NEW_LINE>}<NEW_LINE>menu.show(this, 0, 0);<NEW_LINE>// Now set the location of the JPopupMenu<NEW_LINE>// This location is relative to the screen<NEW_LINE>menu.setLocation(p.x, p.y + callingComponent.getHeight());<NEW_LINE>} | popupItemNoAsTextAndAbility.setEnabled(originalId != null); |
622,963 | public static DescribePdnsThreatLogsResponse unmarshall(DescribePdnsThreatLogsResponse describePdnsThreatLogsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describePdnsThreatLogsResponse.setRequestId(_ctx.stringValue("DescribePdnsThreatLogsResponse.RequestId"));<NEW_LINE>describePdnsThreatLogsResponse.setTotalCount(_ctx.longValue("DescribePdnsThreatLogsResponse.TotalCount"));<NEW_LINE>describePdnsThreatLogsResponse.setPageSize(_ctx.longValue("DescribePdnsThreatLogsResponse.PageSize"));<NEW_LINE>describePdnsThreatLogsResponse.setPageNumber(_ctx.longValue("DescribePdnsThreatLogsResponse.PageNumber"));<NEW_LINE>List<Log> logs = new ArrayList<Log>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePdnsThreatLogsResponse.Logs.Length"); i++) {<NEW_LINE>Log log = new Log();<NEW_LINE>log.setSubDomain(_ctx.stringValue<MASK><NEW_LINE>log.setSourceIp(_ctx.stringValue("DescribePdnsThreatLogsResponse.Logs[" + i + "].SourceIp"));<NEW_LINE>log.setThreatLevel(_ctx.stringValue("DescribePdnsThreatLogsResponse.Logs[" + i + "].ThreatLevel"));<NEW_LINE>log.setThreatTime(_ctx.stringValue("DescribePdnsThreatLogsResponse.Logs[" + i + "].ThreatTime"));<NEW_LINE>log.setThreatType(_ctx.stringValue("DescribePdnsThreatLogsResponse.Logs[" + i + "].ThreatType"));<NEW_LINE>logs.add(log);<NEW_LINE>}<NEW_LINE>describePdnsThreatLogsResponse.setLogs(logs);<NEW_LINE>return describePdnsThreatLogsResponse;<NEW_LINE>} | ("DescribePdnsThreatLogsResponse.Logs[" + i + "].SubDomain")); |
199,092 | public String encode() throws IOException {<NEW_LINE>try (FastStringWriter fsw = new FastStringWriter()) {<NEW_LINE>boolean hasComma = false;<NEW_LINE>String preString;<NEW_LINE>if (this.point != null) {<NEW_LINE>fsw.write("\"point\":{");<NEW_LINE>fsw.write(<MASK><NEW_LINE>fsw.write("}");<NEW_LINE>hasComma = true;<NEW_LINE>}<NEW_LINE>if (this.line != null) {<NEW_LINE>preString = hasComma ? "," : "";<NEW_LINE>fsw.write(preString + "\"line\":{");<NEW_LINE>fsw.write(this.line.encode());<NEW_LINE>fsw.write("}");<NEW_LINE>hasComma = true;<NEW_LINE>}<NEW_LINE>if (this.rectangle != null) {<NEW_LINE>preString = hasComma ? "," : "";<NEW_LINE>fsw.write(preString + "\"rectangle\":{");<NEW_LINE>fsw.write(this.rectangle.encode());<NEW_LINE>fsw.write("}");<NEW_LINE>hasComma = true;<NEW_LINE>}<NEW_LINE>if (this.arc != null) {<NEW_LINE>preString = hasComma ? "," : "";<NEW_LINE>fsw.write(preString + "\"arc\":{");<NEW_LINE>fsw.write(this.arc.encode());<NEW_LINE>fsw.write("}");<NEW_LINE>}<NEW_LINE>return fsw.toString();<NEW_LINE>}<NEW_LINE>} | this.point.encode()); |
704,982 | public static List<Object> keys(Object obj) {<NEW_LINE>try {<NEW_LINE>Object keysObj = InteropLibrary.getUncached().getMembers(obj);<NEW_LINE>InteropLibrary keysInterop = InteropLibrary.getUncached(keysObj);<NEW_LINE>long size = keysInterop.getArraySize(keysObj);<NEW_LINE>if (size < 0 || size >= Integer.MAX_VALUE) {<NEW_LINE>throw Errors.createRangeErrorInvalidArrayLength();<NEW_LINE>}<NEW_LINE>List<Object> keys = new ArrayList<>((int) size);<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>Object key = keysInterop.readArrayElement(keysObj, i);<NEW_LINE>assert InteropLibrary.getUncached().isString(key);<NEW_LINE>keys.add(InteropLibrary.getUncached().asTruffleString(key));<NEW_LINE>}<NEW_LINE>return keys;<NEW_LINE>} catch (UnsupportedMessageException | InvalidArrayIndexException e) {<NEW_LINE>throw Errors.createTypeErrorInteropException(<MASK><NEW_LINE>}<NEW_LINE>} | obj, e, "readArrayElement", null); |
656,442 | boolean checkSaveChanges(ImageData<BufferedImage> imageData) {<NEW_LINE>if (!imageData.isChanged() || isReadOnly())<NEW_LINE>return true;<NEW_LINE>ProjectImageEntry<BufferedImage> entry = getProjectImageEntry(imageData);<NEW_LINE>String name = entry == null ? ServerTools.getDisplayableImageName(imageData.getServer()) : entry.getImageName();<NEW_LINE>var response = Dialogs.showYesNoCancelDialog("Save changes", "Save changes to " + name + "?");<NEW_LINE>if (response == DialogButton.CANCEL)<NEW_LINE>return false;<NEW_LINE>if (response == DialogButton.NO)<NEW_LINE>return true;<NEW_LINE>try {<NEW_LINE>if (entry == null) {<NEW_LINE>String lastPath = imageData.getLastSavedPath();<NEW_LINE>File lastFile = lastPath == null ? null : new File(lastPath);<NEW_LINE>File dirBase = lastFile == null ? null : lastFile.getParentFile();<NEW_LINE>String defaultName = lastFile == null ? null : lastFile.getName();<NEW_LINE>File file = Dialogs.promptToSaveFile("Save data", dirBase, defaultName, "QuPath data files", PathPrefs.getSerializationExtension());<NEW_LINE>if (file == null)<NEW_LINE>return false;<NEW_LINE>PathIO.writeImageData(file, imageData);<NEW_LINE>} else {<NEW_LINE>entry.saveImageData(imageData);<NEW_LINE>var project = getProject();<NEW_LINE>if (project != null)<NEW_LINE>project.syncChanges();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} catch (IOException e) {<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | Dialogs.showErrorMessage("Save ImageData", e); |
654,171 | public static DmnExtensionElement parseExtensionElement(XMLStreamReader xtr) throws Exception {<NEW_LINE>DmnExtensionElement extensionElement = new DmnExtensionElement();<NEW_LINE>extensionElement.setName(xtr.getLocalName());<NEW_LINE>if (StringUtils.isNotEmpty(xtr.getNamespaceURI())) {<NEW_LINE>extensionElement.setNamespace(xtr.getNamespaceURI());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(xtr.getPrefix())) {<NEW_LINE>extensionElement.setNamespacePrefix(xtr.getPrefix());<NEW_LINE>}<NEW_LINE>for (int i = 0; i < xtr.getAttributeCount(); i++) {<NEW_LINE>DmnExtensionAttribute extensionAttribute = new DmnExtensionAttribute();<NEW_LINE>extensionAttribute.setName(xtr.getAttributeLocalName(i));<NEW_LINE>extensionAttribute.setValue(xtr.getAttributeValue(i));<NEW_LINE>if (StringUtils.isNotEmpty(xtr.getAttributeNamespace(i))) {<NEW_LINE>extensionAttribute.setNamespace(xtr.getAttributeNamespace(i));<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(xtr.getAttributePrefix(i))) {<NEW_LINE>extensionAttribute.setNamespacePrefix(xtr.getAttributePrefix(i));<NEW_LINE>}<NEW_LINE>extensionElement.addAttribute(extensionAttribute);<NEW_LINE>}<NEW_LINE>boolean readyWithExtensionElement = false;<NEW_LINE>while (!readyWithExtensionElement && xtr.hasNext()) {<NEW_LINE>xtr.next();<NEW_LINE>if (xtr.isCharacters() || XMLStreamReader.CDATA == xtr.getEventType()) {<NEW_LINE>if (StringUtils.isNotEmpty(xtr.getText().trim())) {<NEW_LINE>extensionElement.setElementText(xtr.<MASK><NEW_LINE>}<NEW_LINE>} else if (xtr.isStartElement()) {<NEW_LINE>DmnExtensionElement childExtensionElement = parseExtensionElement(xtr);<NEW_LINE>extensionElement.addChildElement(childExtensionElement);<NEW_LINE>} else if (xtr.isEndElement() && extensionElement.getName().equalsIgnoreCase(xtr.getLocalName())) {<NEW_LINE>readyWithExtensionElement = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return extensionElement;<NEW_LINE>} | getText().trim()); |
1,033,460 | public void testTemplate(TestExecutionContext testExecCtx, TestExecutionResources testExecResources, Object managedComponentObject) {<NEW_LINE>// Verify parameters<NEW_LINE>if (testExecCtx == null || testExecResources == null) {<NEW_LINE>Assert.fail("testTemplate: Missing context and/or resources. Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Fetch JPA Resources<NEW_LINE>JPAResource jpaCleanupResource = testExecResources.getJpaResourceMap().get("cleanup");<NEW_LINE>if (jpaCleanupResource == null) {<NEW_LINE>Assert.fail("Missing JPAResource 'cleanup'). Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JPAResource jpaResource = testExecResources.getJpaResourceMap().get("test-jpa-resource");<NEW_LINE>if (jpaResource == null) {<NEW_LINE>Assert.fail("Missing JPAResource 'test-jpa-resource'). Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Execute Test Case<NEW_LINE>try {<NEW_LINE>System.out.println("DerivedIdentityTestLogic.testTemplate(): Begin");<NEW_LINE>// cleanupDatabase(jpaCleanupResource);<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>System.out.println("DerivedIdentityTestLogic.testTemplate(): End");<NEW_LINE>}<NEW_LINE>} | System.out.println("Ending test."); |
1,323,369 | public int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, List<ResponseInfo> responseInfoList) {<NEW_LINE>logger.info("Connection warm up start.");<NEW_LINE>if (dataNodeIds.size() == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>dataNodeIds.forEach(dataNodeId -> connectionTracker.setMinimumActiveConnectionsPercentage(dataNodeId, connectionWarmUpPercentagePerDataNode));<NEW_LINE>int expectedConnections = connectionTracker.replenishConnections(this::connect, Integer.MAX_VALUE);<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>int successfulConnections = 0;<NEW_LINE>int failedConnections = 0;<NEW_LINE>while (successfulConnections + failedConnections < expectedConnections) {<NEW_LINE>try {<NEW_LINE>selector.poll(1000L);<NEW_LINE>successfulConnections += selector.connected().size();<NEW_LINE>failedConnections += selector<MASK><NEW_LINE>handleSelectorEvents(responseInfoList);<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("Warm up received unexpected error while polling: ", e);<NEW_LINE>}<NEW_LINE>if (System.currentTimeMillis() - startTime > timeForWarmUp) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("Connection warm up done. Tried: {}, Succeeded: {}, Failed: {}, Time elapsed: {} ms", expectedConnections, successfulConnections, failedConnections, System.currentTimeMillis() - startTime);<NEW_LINE>return successfulConnections;<NEW_LINE>} | .disconnected().size(); |
254,313 | public void listContextJsps(Context context, Summary summary, boolean compile) {<NEW_LINE>ServletConfig servletConfig = (ServletConfig) context.findChild("jsp");<NEW_LINE>if (servletConfig != null) {<NEW_LINE>synchronized (servletConfig) {<NEW_LINE>ServletContext sctx = context.getServletContext();<NEW_LINE>Options opt = new EmbeddedServletOptions(servletConfig, sctx);<NEW_LINE>JspRuntimeContext jrctx = new JspRuntimeContext(sctx, opt);<NEW_LINE>try {<NEW_LINE>if (summary.getItems() == null) {<NEW_LINE>summary.setItems(new HashMap<>());<NEW_LINE>}<NEW_LINE>for (Item item : summary.getItems().values()) {<NEW_LINE>item.setMissing(true);<NEW_LINE>}<NEW_LINE>try (URLClassLoader urlcl = new URLClassLoader(new URL[0], context.getLoader().getClassLoader())) {<NEW_LINE>compileItem("/", opt, context, jrctx, summary, urlcl, 0, compile);<NEW_LINE>} catch (IOException e) {<NEW_LINE>this.logger.error("", e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>jrctx.destroy();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// delete "missing" items by keeping "not missing" ones<NEW_LINE>//<NEW_LINE>Map<String, Item> hashMap = new HashMap<>();<NEW_LINE>for (String key : summary.getItems().keySet()) {<NEW_LINE>Item item = summary.getItems().get(key);<NEW_LINE>if (!item.isMissing()) {<NEW_LINE>hashMap.put(key, item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>summary.setItems(hashMap);<NEW_LINE>} else {<NEW_LINE>logger.error(<MASK><NEW_LINE>}<NEW_LINE>} | NO_JSP_SERVLET, context.getName()); |
820,901 | public BatchLookupPolicy unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>BatchLookupPolicy batchLookupPolicy = new BatchLookupPolicy();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ObjectReference", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>batchLookupPolicy.setObjectReference(ObjectReferenceJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>batchLookupPolicy.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("MaxResults", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>batchLookupPolicy.setMaxResults(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return batchLookupPolicy;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
214,607 | public ListSigningProfilesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListSigningProfilesResult listSigningProfilesResult = new ListSigningProfilesResult();<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 listSigningProfilesResult;<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("profiles", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listSigningProfilesResult.setProfiles(new ListUnmarshaller<SigningProfile>(SigningProfileJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listSigningProfilesResult.setNextToken(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 listSigningProfilesResult;<NEW_LINE>} | )).unmarshall(context)); |
1,637,045 | MethodTree generateSubresourceMethod(TreeMaker maker, WorkingCopy copy, ClassTree classTree, PathFormat pf) {<NEW_LINE>// NOI18N<NEW_LINE>String // NOI18N<NEW_LINE>body = // NOI18N<NEW_LINE>"{" + " String resourcePath = " + getPathExpression(pf) + // NOI18N<NEW_LINE>";" + // NOI18N<NEW_LINE>" webResource = client.resource(BASE_URI).path(resourcePath);" + "}";<NEW_LINE>ModifiersTree methodModifier = maker.Modifiers(Collections.<Modifier<MASK><NEW_LINE>List<VariableTree> paramList = new ArrayList<VariableTree>();<NEW_LINE>for (String arg : pf.getArguments()) {<NEW_LINE>// NOI18N<NEW_LINE>Tree argTypeTree = maker.Identifier("String");<NEW_LINE>ModifiersTree fieldModifier = maker.Modifiers(Collections.<Modifier>emptySet());<NEW_LINE>VariableTree argFieldTree = // NOI18N<NEW_LINE>maker.// NOI18N<NEW_LINE>Variable(// NOI18N<NEW_LINE>fieldModifier, // NOI18N<NEW_LINE>arg, // NOI18N<NEW_LINE>argTypeTree, null);<NEW_LINE>paramList.add(argFieldTree);<NEW_LINE>}<NEW_LINE>return // NOI18N<NEW_LINE>maker.// NOI18N<NEW_LINE>Method(// NOI18N<NEW_LINE>methodModifier, // NOI18N<NEW_LINE>"setResourcePath", // NOI18N<NEW_LINE>JavaSourceHelper.createTypeTree(copy, "void"), // NOI18N<NEW_LINE>Collections.<TypeParameterTree>emptyList(), // NOI18N<NEW_LINE>paramList, // NOI18N<NEW_LINE>Collections.<ExpressionTree>emptyList(), // NOI18N<NEW_LINE>body, null);<NEW_LINE>} | >singleton(Modifier.PUBLIC)); |
454,451 | public void parse() {<NEW_LINE>for (String nextResourceName : myResourceNames) {<NEW_LINE>RuntimeResourceDefinition def = getCtx().getResourceDefinition(nextResourceName);<NEW_LINE>Resource resource = new Resource();<NEW_LINE>resource.setName(def.getName());<NEW_LINE>resource.setElementName(def.getName());<NEW_LINE>addResource(resource);<NEW_LINE>for (RuntimeSearchParam nextSearchParam : def.getSearchParams()) {<NEW_LINE>SearchParameter param = new SearchParameter(getVersion(), def.getName());<NEW_LINE>List<RuntimeSearchParam> compositeOfParams = nextSearchParam.getComponents().stream().map(t -> def.getSearchParams().stream().filter(y -> y.getUri().equals(t.getReference())).findFirst().orElseThrow(() -> new IllegalStateException())).<MASK><NEW_LINE>if (nextSearchParam.getParamType() == RestSearchParameterTypeEnum.COMPOSITE && compositeOfParams.size() != 2) {<NEW_LINE>throw new IllegalStateException(Msg.code(163) + "Search param " + nextSearchParam.getName() + " on base " + nextSearchParam.getBase() + " has components: " + nextSearchParam.getComponents());<NEW_LINE>}<NEW_LINE>param.setName(nextSearchParam.getName());<NEW_LINE>param.setDescription(nextSearchParam.getDescription());<NEW_LINE>param.setCompositeOf(toCompositeOfStrings(compositeOfParams));<NEW_LINE>param.setCompositeTypes(toCompositeOfTypes(compositeOfParams));<NEW_LINE>param.setPath(nextSearchParam.getPath());<NEW_LINE>param.setType(nextSearchParam.getParamType().getCode());<NEW_LINE>resource.addSearchParameter(param);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | collect(Collectors.toList()); |
807,993 | LocalWireNetwork merge(LocalWireNetwork other, Supplier<LocalWireNetwork> createNewNet) {<NEW_LINE>LocalWireNetwork result = createNewNet.get();<NEW_LINE>for (LocalWireNetwork net : new LocalWireNetwork[] { this, other }) {<NEW_LINE>result.connectors.putAll(net.connectors);<NEW_LINE>result.connections.putAll(net.connections);<NEW_LINE>}<NEW_LINE>result.handlers.putAll(other.handlers);<NEW_LINE>other.handlerUsers.forEach((rl, h) -> result.handlerUsers.put(rl, HashMultiset.create(h)));<NEW_LINE>for (Entry<ResourceLocation, LocalNetworkHandler> loc : handlers.entrySet()) {<NEW_LINE>result.handlers.merge(loc.getKey(), loc.<MASK><NEW_LINE>result.handlerUsers.merge(loc.getKey(), HashMultiset.create(handlerUsers.get(loc.getKey())), (a, b) -> {<NEW_LINE>a.addAll(b);<NEW_LINE>return a;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>for (Entry<ResourceLocation, LocalNetworkHandler> loc : result.handlers.entrySet()) loc.getValue().setLocalNet(result);<NEW_LINE>return result;<NEW_LINE>} | getValue(), LocalNetworkHandler::merge); |
419,940 | public void write(RTree<T, S> tree, OutputStream os) throws IOException {<NEW_LINE>FlatBufferBuilder builder = new FlatBufferBuilder();<NEW_LINE>final Rectangle mbb;<NEW_LINE>if (tree.root().isPresent()) {<NEW_LINE>mbb = tree.root().get().geometry().mbr();<NEW_LINE>} else {<NEW_LINE>mbb = Geometries.rectangle(0, 0, 0, 0);<NEW_LINE>}<NEW_LINE>int b = toBounds(builder, mbb);<NEW_LINE>Context_.startContext_(builder);<NEW_LINE>Context_.addBounds(builder, b);<NEW_LINE>Context_.addMinChildren(builder, tree.context().minChildren());<NEW_LINE>Context_.addMaxChildren(builder, tree.context().maxChildren());<NEW_LINE>int c = Context_.endContext_(builder);<NEW_LINE>final int n;<NEW_LINE>if (tree.root().isPresent()) {<NEW_LINE>n = addNode(tree.root().get(), builder, factory.serializer());<NEW_LINE>} else {<NEW_LINE>// won't be used<NEW_LINE>n = 0;<NEW_LINE>}<NEW_LINE>// int t = Tree_.createTree_(builder, c, n, tree.size());<NEW_LINE>Tree_.startTree_(builder);<NEW_LINE><MASK><NEW_LINE>Tree_.addSize(builder, tree.size());<NEW_LINE>if (tree.size() > 0) {<NEW_LINE>Tree_.addRoot(builder, n);<NEW_LINE>}<NEW_LINE>int t = Tree_.endTree_(builder);<NEW_LINE>Tree_.finishTree_Buffer(builder, t);<NEW_LINE>ByteBuffer bb = builder.dataBuffer();<NEW_LINE>os.write(bb.array(), bb.position(), bb.remaining());<NEW_LINE>} | Tree_.addContext(builder, c); |
1,747,236 | public static StoredValueFactory factory() {<NEW_LINE>return new StoredValueFactory() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public StringArrayValue fromJson(final String input) {<NEW_LINE>if (StringUtil.isEmpty(input)) {<NEW_LINE>return new StringArrayValue(Collections.emptyList());<NEW_LINE>} else {<NEW_LINE>return new StringArrayValue(JsonFactory.get<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public StringArrayValue fromXmlElement(final PwmSetting pwmSetting, final XmlElement settingElement, final PwmSecurityKey key) {<NEW_LINE>final List<String> values = settingElement.getChildren(StoredConfigXmlConstants.XML_ELEMENT_VALUE).stream().map(XmlElement::getText).flatMap(Optional::stream).collect(Collectors.toList());<NEW_LINE>if (pwmSetting != null && pwmSetting.getFlags().contains(PwmSettingFlag.Sorted)) {<NEW_LINE>Collections.sort(values);<NEW_LINE>}<NEW_LINE>return new StringArrayValue(values);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ().deserializeStringList(input)); |
618,038 | public void marshall(CreateExplainabilityRequest createExplainabilityRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createExplainabilityRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getExplainabilityName(), EXPLAINABILITYNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getExplainabilityConfig(), EXPLAINABILITYCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getDataSource(), DATASOURCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getSchema(), SCHEMA_BINDING);<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getEnableVisualization(), ENABLEVISUALIZATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getStartDateTime(), STARTDATETIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getEndDateTime(), ENDDATETIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createExplainabilityRequest.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createExplainabilityRequest.getResourceArn(), RESOURCEARN_BINDING); |
458,709 | private Mono<PagedResponse<String>> listAnomalyDimensionValuesNextPageAsync(String nextPageLink, String dimensionName, OffsetDateTime startTime, OffsetDateTime endTime, ListAnomalyDimensionValuesOptions options, Context context) {<NEW_LINE>if (CoreUtils.isNullOrEmpty(nextPageLink)) {<NEW_LINE>return Mono.empty();<NEW_LINE>}<NEW_LINE>AnomalyDimensionQuery query = new AnomalyDimensionQuery();<NEW_LINE>query.setDimensionName(dimensionName);<NEW_LINE>query.setStartTime(startTime);<NEW_LINE>query.setEndTime(endTime);<NEW_LINE>if (options.getDimensionToFilter() != null) {<NEW_LINE>query.setDimensionFilter(new DimensionGroupIdentity().setDimension(options.getDimensionToFilter().asMap()));<NEW_LINE>}<NEW_LINE>final Context withTracing = <MASK><NEW_LINE>return service.getDimensionOfAnomaliesByAnomalyDetectionConfigurationNextSinglePageAsync(nextPageLink, query, withTracing).doOnSubscribe(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink)).doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink)).doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, error));<NEW_LINE>} | context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE); |
1,346,333 | public static void main(String[] args) {<NEW_LINE>OpenIMAJGrabber grabber = new OpenIMAJGrabber();<NEW_LINE>Device device = null;<NEW_LINE>Pointer<DeviceList> devices = grabber.getVideoDevices();<NEW_LINE>for (Device d : devices.get().asArrayList()) {<NEW_LINE>device = d;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>boolean started = grabber.startSession(320, 240, 30, Pointer.pointerTo(device));<NEW_LINE>if (!started) {<NEW_LINE>throw new RuntimeException("Not able to start native grabber!");<NEW_LINE>}<NEW_LINE>long t1 = System.currentTimeMillis();<NEW_LINE>int n = 1000;<NEW_LINE>int i = 0;<NEW_LINE>do {<NEW_LINE>grabber.nextFrame();<NEW_LINE>// byte[]<NEW_LINE>grabber.getImage().getBytes(320 * 240 * 3);<NEW_LINE>} while (++i < n);<NEW_LINE><MASK><NEW_LINE>System.out.println("Capturing time: " + (t2 - t1));<NEW_LINE>grabber.stopSession();<NEW_LINE>} | long t2 = System.currentTimeMillis(); |
148,090 | public RecommendationPreferences unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RecommendationPreferences recommendationPreferences = new RecommendationPreferences();<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("cpuVendorArchitectures", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>recommendationPreferences.setCpuVendorArchitectures(new ListUnmarshaller<String>(context.getUnmarshaller(String.class<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return recommendationPreferences;<NEW_LINE>} | )).unmarshall(context)); |
787,312 | public CreateAuthorizerResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateAuthorizerResult createAuthorizerResult = new CreateAuthorizerResult();<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 createAuthorizerResult;<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("authorizerName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createAuthorizerResult.setAuthorizerName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("authorizerArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createAuthorizerResult.setAuthorizerArn(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createAuthorizerResult;<NEW_LINE>} | class).unmarshall(context)); |
1,039,723 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>List<Permanent> toExile = new ArrayList<>();<NEW_LINE>for (UUID creatureId : this.getTargetPointer().getTargets(game, source)) {<NEW_LINE>Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);<NEW_LINE>if (creature != null) {<NEW_LINE>CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true);<NEW_LINE>effect.setTargetPointer(new FixedTarget(creature, game));<NEW_LINE>effect.apply(game, source);<NEW_LINE>toExile.addAll(effect.getAddedPermanents());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ExileTargetEffect exileEffect = new ExileTargetEffect();<NEW_LINE>exileEffect.setTargetPointer(new FixedTargets(toExile, game));<NEW_LINE><MASK><NEW_LINE>game.addDelayedTriggeredAbility(delayedAbility, source);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); |
696,453 | private RequestBody createRequestBody(BaseRequest<?, ?> request) {<NEW_LINE>if (request.isMultipart()) {<NEW_LINE>MediaType contentType = MediaType.parse(request.getContentType());<NEW_LINE>MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);<NEW_LINE>for (Map.Entry<String, Object> parameter : request.getParameters().entrySet()) {<NEW_LINE>String name = parameter.getKey();<NEW_LINE>Object value = parameter.getValue();<NEW_LINE>if (value instanceof byte[]) {<NEW_LINE>builder.addFormDataPart(name, request.getFileName(), RequestBody.create(contentType, <MASK><NEW_LINE>} else if (value instanceof File) {<NEW_LINE>builder.addFormDataPart(name, request.getFileName(), RequestBody.create(contentType, (File) value));<NEW_LINE>} else {<NEW_LINE>builder.addFormDataPart(name, toParamValue(value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} else {<NEW_LINE>FormBody.Builder builder = new FormBody.Builder();<NEW_LINE>for (Map.Entry<String, Object> parameter : request.getParameters().entrySet()) {<NEW_LINE>builder.add(parameter.getKey(), toParamValue(parameter.getValue()));<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>}<NEW_LINE>} | (byte[]) value)); |
298,633 | private static Collection<MendelianViolationMetrics> mergeMetrics(final Collection<Collection<MendelianViolationMetrics>> resultsToReduce) {<NEW_LINE>final Collection<MendelianViolationMetrics> allMetrics = new ArrayList<>();<NEW_LINE>resultsToReduce.forEach(allMetrics::addAll);<NEW_LINE>final Map<String, List<MendelianViolationMetrics>> sampleToMetricsMap = allMetrics.stream().collect(Collectors.groupingBy(m -> String.format("%s|%s|%s|%s", m.FAMILY_ID, m.FATHER, m.MOTHER, m.OFFSPRING)));<NEW_LINE>return sampleToMetricsMap.values().stream().map(a -> (MendelianViolationMetrics) new MendelianViolationMetrics().merge(a)).collect(Collectors.<MendelianViolationMetrics, List<MendelianViolationMetrics>>toCollection(<MASK><NEW_LINE>} | ArrayList<MendelianViolationMetrics>::new)); |
1,615,284 | private List<Vrf> initVrfsIfAbsent(Set<String> names, ParserRuleContext ctx, @Nonnull CumulusStructureUsage usage) {<NEW_LINE>ImmutableList.Builder<Vrf<MASK><NEW_LINE>ImmutableList.Builder<String> newVrfs = ImmutableList.builder();<NEW_LINE>for (String name : names) {<NEW_LINE>Vrf vrf = _c.getVrfs().get(name);<NEW_LINE>if (vrf == null) {<NEW_LINE>vrf = createVrf(name, ctx);<NEW_LINE>if (vrf == null) {<NEW_LINE>return ImmutableList.of();<NEW_LINE>}<NEW_LINE>newVrfs.add(name);<NEW_LINE>}<NEW_LINE>vrfsBuilder.add(vrf);<NEW_LINE>}<NEW_LINE>List<Vrf> vrfs = vrfsBuilder.build();<NEW_LINE>vrfs.forEach(vrf -> _c.getVrfs().computeIfAbsent(vrf.getName(), n -> vrf));<NEW_LINE>int line = ctx.getStart().getLine();<NEW_LINE>newVrfs.build().forEach(name -> {<NEW_LINE>_c.defineSingleLineStructure(CumulusStructureType.VRF, name, line);<NEW_LINE>});<NEW_LINE>names.forEach(name -> _c.referenceStructure(CumulusStructureType.VRF, name, usage, line));<NEW_LINE>return vrfs;<NEW_LINE>} | > vrfsBuilder = ImmutableList.builder(); |
1,711,065 | protected Component createFeedItemComponent(FeedItem item) {<NEW_LINE>JPanel panel = new JPanel(new GridBagLayout());<NEW_LINE>panel.setOpaque(false);<NEW_LINE>int row = 0;<NEW_LINE>if (item.dateTime != null) {<NEW_LINE>JLabel label = new JLabel();<NEW_LINE>label.setFont(RSS_DESCRIPTION_FONT);<NEW_LINE>label.setForeground(Utils.getRssDateColor());<NEW_LINE>label.setText(formatDateTime(item.dateTime));<NEW_LINE>panel.add(label, new GridBagConstraints(2, row, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, TEXT_INSETS_LEFT + 5, 2, TEXT_INSETS_RIGHT), 0, 0));<NEW_LINE>}<NEW_LINE>WebLink linkButton = new WebLink(stripHtml(item.title), item.link, <MASK><NEW_LINE>// NOI18N<NEW_LINE>linkButton.getAccessibleContext().// NOI18N<NEW_LINE>setAccessibleName(BundleSupport.getAccessibilityName("WebLink", item.title));<NEW_LINE>// NOI18N<NEW_LINE>linkButton.getAccessibleContext().// NOI18N<NEW_LINE>setAccessibleDescription(BundleSupport.getAccessibilityDescription("WebLink", item.link));<NEW_LINE>linkButton.setFont(BUTTON_FONT);<NEW_LINE>panel.add(linkButton, new GridBagConstraints(0, row++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 2, TEXT_INSETS_RIGHT), 0, 0));<NEW_LINE>if (item.description != null) {<NEW_LINE>JLabel label = new JLabel("<html>" + trimHtml(item.description));<NEW_LINE>label.setFont(RSS_DESCRIPTION_FONT);<NEW_LINE>label.setForeground(Utils.getRssDetailsColor());<NEW_LINE>panel.add(label, new GridBagConstraints(0, row++, 4, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, TEXT_INSETS_RIGHT), 0, 0));<NEW_LINE>}<NEW_LINE>return panel;<NEW_LINE>} | Utils.getRssHeaderColor(), false); |
416,928 | public Attribute createAttribute(HttpClientResponse response, String name, String value) {<NEW_LINE>if (useDisk) {<NEW_LINE>Attribute attribute;<NEW_LINE>try {<NEW_LINE>attribute = new DiskAttribute(name, value, charset, baseDir, deleteOnExit);<NEW_LINE>attribute.setMaxSize(maxSize);<NEW_LINE>} catch (IOException e) {<NEW_LINE>// revert to Mixed mode<NEW_LINE>attribute = new MixedAttribute(name, value, <MASK><NEW_LINE>attribute.setMaxSize(maxSize);<NEW_LINE>}<NEW_LINE>checkHttpDataSize(attribute);<NEW_LINE>List<HttpData> list = getList(response);<NEW_LINE>list.add(attribute);<NEW_LINE>return attribute;<NEW_LINE>}<NEW_LINE>if (checkSize) {<NEW_LINE>Attribute attribute = new MixedAttribute(name, value, minSize, charset, baseDir, deleteOnExit);<NEW_LINE>attribute.setMaxSize(maxSize);<NEW_LINE>checkHttpDataSize(attribute);<NEW_LINE>List<HttpData> list = getList(response);<NEW_LINE>list.add(attribute);<NEW_LINE>return attribute;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>MemoryAttribute attribute = new MemoryAttribute(name, value, charset);<NEW_LINE>attribute.setMaxSize(maxSize);<NEW_LINE>checkHttpDataSize(attribute);<NEW_LINE>return attribute;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new IllegalArgumentException(e);<NEW_LINE>}<NEW_LINE>} | minSize, charset, baseDir, deleteOnExit); |
1,053,992 | private void addContent() {<NEW_LINE>int rows = payload.usesIntermediaryBank() ? 22 : 16;<NEW_LINE>addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("payment.swift.headline"));<NEW_LINE>// spacer<NEW_LINE>gridPane.add(new Label(""), 0, ++rowIndex);<NEW_LINE>addLabelsAndCopy(Res.get("portfolio.pending.step2_buyer.amountToTransfer"), VolumeUtil.formatVolumeWithCode(trade.getVolume()));<NEW_LINE>addLabelsAndCopy(Res.get(SWIFT_CODE + BANKPOSTFIX), payload.getBankSwiftCode());<NEW_LINE>addLabelsAndCopy(Res.get(SNAME + BANKPOSTFIX), payload.getBankName());<NEW_LINE>addLabelsAndCopy(Res.get(BRANCH + BANKPOSTFIX), payload.getBankBranch());<NEW_LINE>addLabelsAndCopy(Res.get(ADDRESS + BANKPOSTFIX), cleanString(payload.getBankAddress()));<NEW_LINE>addLabelsAndCopy(Res.get(COUNTRY + BANKPOSTFIX), CountryUtil.getNameAndCode(payload.getBankCountryCode()));<NEW_LINE>if (payload.usesIntermediaryBank()) {<NEW_LINE>// spacer<NEW_LINE>gridPane.add(new Label(""), 0, ++rowIndex);<NEW_LINE>addLabelsAndCopy(Res.get(SWIFT_CODE + INTERMEDIARYPOSTFIX), payload.getIntermediarySwiftCode());<NEW_LINE>addLabelsAndCopy(Res.get(SNAME + INTERMEDIARYPOSTFIX), payload.getIntermediaryName());<NEW_LINE>addLabelsAndCopy(Res.get(BRANCH + INTERMEDIARYPOSTFIX), payload.getIntermediaryBranch());<NEW_LINE>addLabelsAndCopy(Res.get(ADDRESS + INTERMEDIARYPOSTFIX), cleanString(payload.getIntermediaryAddress()));<NEW_LINE>addLabelsAndCopy(Res.get(COUNTRY + INTERMEDIARYPOSTFIX), CountryUtil.getNameAndCode(payload.getIntermediaryCountryCode()));<NEW_LINE>}<NEW_LINE>// spacer<NEW_LINE>gridPane.add(new Label(""), 0, ++rowIndex);<NEW_LINE>addLabelsAndCopy(Res.get("payment.account.owner"<MASK><NEW_LINE>addLabelsAndCopy(Res.get(SWIFT_ACCOUNT), payload.getBeneficiaryAccountNr());<NEW_LINE>addLabelsAndCopy(Res.get(ADDRESS + BENEFICIARYPOSTFIX), cleanString(payload.getBeneficiaryAddress()));<NEW_LINE>addLabelsAndCopy(Res.get(PHONE + BENEFICIARYPOSTFIX), payload.getBeneficiaryPhone());<NEW_LINE>addLabelsAndCopy(Res.get("payment.account.city"), payload.getBeneficiaryCity());<NEW_LINE>addLabelsAndCopy(Res.get("payment.country"), CountryUtil.getNameAndCode(payload.getBankCountryCode()));<NEW_LINE>addLabelsAndCopy(Res.get("payment.shared.extraInfo"), cleanString(payload.getSpecialInstructions()));<NEW_LINE>actionButtonText(Res.get("shared.copyToClipboard"));<NEW_LINE>onAction(() -> {<NEW_LINE>StringBuilder work = new StringBuilder();<NEW_LINE>for (String s : copyToClipboardData) {<NEW_LINE>work.append(s).append(System.lineSeparator());<NEW_LINE>}<NEW_LINE>copyToClipboard(work.toString());<NEW_LINE>});<NEW_LINE>} | ), payload.getBeneficiaryName()); |
1,746,848 | public <T> Flux<MultiGetItem<T>> multiGet(Query query, Class<T> clazz, IndexCoordinates index) {<NEW_LINE>Assert.notNull(index, "Index must not be null");<NEW_LINE>Assert.notNull(clazz, "Class must not be null");<NEW_LINE>Assert.notNull(query, "Query must not be null");<NEW_LINE>DocumentCallback<T> callback = new ReadDocumentCallback<>(converter, clazz, index);<NEW_LINE>MultiGetRequest request = requestFactory.multiGetRequest(query, clazz, index);<NEW_LINE>return //<NEW_LINE>//<NEW_LINE>Flux.from(execute(client -> client.multiGet(request))).//<NEW_LINE>map(DocumentAdapters::from).flatMap(//<NEW_LINE>multiGetItem -> //<NEW_LINE>multiGetItem.isFailed() ? Mono.just(MultiGetItem.of(null, multiGetItem.getFailure())) : //<NEW_LINE>callback.toEntity(multiGetItem.getItem()).//<NEW_LINE>map((T item) -> MultiGetItem.of(item, <MASK><NEW_LINE>} | multiGetItem.getFailure()))); |
1,126,919 | public DatasetVersion addDatasetVersionTags(String datasetVersionId, List<String> tagsList) {<NEW_LINE>try (var session = modelDBHibernateUtil.getSessionFactory().openSession()) {<NEW_LINE>DatasetVersionEntity datasetVersionObj = session.get(DatasetVersionEntity.class, datasetVersionId, LockMode.PESSIMISTIC_WRITE);<NEW_LINE>if (datasetVersionObj == null) {<NEW_LINE>throw new NotFoundException(ModelDBMessages.DATA_VERSION_NOT_FOUND_ERROR_MSG);<NEW_LINE>}<NEW_LINE>List<String> newTags = new ArrayList<>();<NEW_LINE>var existingProtoDatasetVersionObj = datasetVersionObj.getProtoObject();<NEW_LINE>for (String tag : tagsList) {<NEW_LINE>if (!existingProtoDatasetVersionObj.getTagsList().contains(tag)) {<NEW_LINE>newTags.add(tag);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long currentTimestamp = Calendar.getInstance().getTimeInMillis();<NEW_LINE>if (!newTags.isEmpty()) {<NEW_LINE>List<TagsMapping> newTagMappings = <MASK><NEW_LINE>datasetVersionObj.getTags().addAll(newTagMappings);<NEW_LINE>datasetVersionObj.setTime_updated(currentTimestamp);<NEW_LINE>var transaction = session.beginTransaction();<NEW_LINE>session.saveOrUpdate(datasetVersionObj);<NEW_LINE>transaction.commit();<NEW_LINE>}<NEW_LINE>LOGGER.debug("DatasetVersion tags added successfully");<NEW_LINE>return datasetVersionObj.getProtoObject();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>if (ModelDBUtils.needToRetry(ex)) {<NEW_LINE>return addDatasetVersionTags(datasetVersionId, tagsList);<NEW_LINE>} else {<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | RdbmsUtils.convertTagListFromTagMappingList(datasetVersionObj, newTags); |
1,300,467 | private void replaceQuoteSpans(Spannable spannable) {<NEW_LINE>QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);<NEW_LINE>for (QuoteSpan quoteSpan : quoteSpans) {<NEW_LINE>final int start = spannable.getSpanStart(quoteSpan);<NEW_LINE>final int end = spannable.getSpanEnd(quoteSpan);<NEW_LINE>final int flags = spannable.getSpanFlags(quoteSpan);<NEW_LINE>spannable.removeSpan(quoteSpan);<NEW_LINE>// If the theme is Light or Sepia, use a darker blue; otherwise, use a lighter blue<NEW_LINE>final int barColor = ContextCompat.getColor(getContext(), SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5 ? R.color.md_blue_600 : R.color.md_blue_400);<NEW_LINE>final int BAR_WIDTH = 4;<NEW_LINE>final int GAP = 5;<NEW_LINE>spannable.setSpan(new // bar color<NEW_LINE>CustomQuoteSpan(// bar width<NEW_LINE>barColor, // bar + text gap<NEW_LINE>BAR_WIDTH, GAP<MASK><NEW_LINE>}<NEW_LINE>} | ), start, end, flags); |
915,204 | /* (non-Javadoc)<NEW_LINE>* @see com.biglybt.ui.swt.maketorrent.IWizardPanel#show()<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void show() {<NEW_LINE>display = wizard.getDisplay();<NEW_LINE>wizard.setTitle(MessageText.getString("wizard.maketorrent.progresstitle"));<NEW_LINE>wizard.setCurrentInfo("");<NEW_LINE>wizard.setPreviousEnabled(false);<NEW_LINE>Composite rootPanel = wizard.getPanel();<NEW_LINE>GridLayout layout = new GridLayout();<NEW_LINE>layout.numColumns = 1;<NEW_LINE>rootPanel.setLayout(layout);<NEW_LINE>Composite panel = new Composite(rootPanel, SWT.NULL);<NEW_LINE>GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);<NEW_LINE>panel.setLayoutData(gridData);<NEW_LINE>layout = new GridLayout();<NEW_LINE>layout.numColumns = 2;<NEW_LINE>panel.setLayout(layout);<NEW_LINE>tasks = new Text(panel, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY);<NEW_LINE>tasks.setBackground(Colors.getSystemColor<MASK><NEW_LINE>gridData = new GridData(GridData.FILL_BOTH);<NEW_LINE>gridData.heightHint = 120;<NEW_LINE>gridData.horizontalSpan = 2;<NEW_LINE>tasks.setLayoutData(gridData);<NEW_LINE>progress = new ProgressBar(panel, SWT.NULL);<NEW_LINE>progress.setMinimum(0);<NEW_LINE>progress.setMaximum(0);<NEW_LINE>gridData = new GridData(GridData.FILL_HORIZONTAL);<NEW_LINE>gridData.horizontalSpan = 2;<NEW_LINE>progress.setLayoutData(gridData);<NEW_LINE>Label label = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData(GridData.FILL_HORIZONTAL);<NEW_LINE>label.setLayoutData(gridData);<NEW_LINE>Composite Browsepanel = new Composite(panel, SWT.NULL);<NEW_LINE>layout = new GridLayout();<NEW_LINE>layout.numColumns = 2;<NEW_LINE>Browsepanel.setLayout(layout);<NEW_LINE>label = new Label(Browsepanel, SWT.NULL);<NEW_LINE>Messages.setLanguageText(label, "wizard.newtorrent.showtorrent");<NEW_LINE>show_torrent_file = new Button(Browsepanel, SWT.PUSH);<NEW_LINE>Messages.setLanguageText(show_torrent_file, "MyTorrentsView.menu.explore");<NEW_LINE>show_torrent_file.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>ManagerUtils.open(new File(wizard.savePath));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>show_torrent_file.setEnabled(false);<NEW_LINE>} | (display, SWT.COLOR_WHITE)); |
565,417 | public static void main(String[] args) {<NEW_LINE>if (args.length < 3 || args[0].equals("-h")) {<NEW_LINE>printUsageAndExit();<NEW_LINE>}<NEW_LINE>long duration = 0;<NEW_LINE>long rate = 16000;<NEW_LINE>// mono<NEW_LINE>int channels = 1;<NEW_LINE>int i = 0;<NEW_LINE>// Go through all arguments except the last one<NEW_LINE>while (i < args.length - 1) {<NEW_LINE>if (args[i].equals("-dur")) {<NEW_LINE>duration = Long.parseLong(args[i + 1]);<NEW_LINE>i += 2;<NEW_LINE>continue;<NEW_LINE>} else if (args[i].equals("-mono")) {<NEW_LINE>channels = 1;<NEW_LINE>i++;<NEW_LINE>continue;<NEW_LINE>} else if (args[i].equals("-stereo")) {<NEW_LINE>channels = 2;<NEW_LINE>i++;<NEW_LINE>continue;<NEW_LINE>} else if (args[i].equals("-rate")) {<NEW_LINE>rate = Long.parseLong(args[i + 1]);<NEW_LINE>i += 2;<NEW_LINE>continue;<NEW_LINE>} else {<NEW_LINE>// unknown option<NEW_LINE>printUsageAndExit();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String strFilename = args[args.length - 1];<NEW_LINE>File outputFile = new File(strFilename);<NEW_LINE>AudioFormat audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, rate, 16, channels, <MASK><NEW_LINE>DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat);<NEW_LINE>TargetDataLine targetDataLine = null;<NEW_LINE>try {<NEW_LINE>targetDataLine = (TargetDataLine) AudioSystem.getLine(info);<NEW_LINE>targetDataLine.open(audioFormat);<NEW_LINE>} catch (LineUnavailableException e) {<NEW_LINE>out("unable to get a recording line");<NEW_LINE>e.printStackTrace();<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>AudioFileFormat.Type targetType = AudioFileFormat.Type.WAVE;<NEW_LINE>TimedAudioRecorder recorder = new TimedAudioRecorder(targetDataLine, targetType, outputFile, duration);<NEW_LINE>recorder.start();<NEW_LINE>out("Recording...");<NEW_LINE>try {<NEW_LINE>recorder.join();<NEW_LINE>} catch (InterruptedException ie) {<NEW_LINE>}<NEW_LINE>out("Recording stopped.");<NEW_LINE>} | 2 * channels, rate, false); |
492,007 | public static DescribeTagsResponse unmarshall(DescribeTagsResponse describeTagsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeTagsResponse.setRequestId(_ctx.stringValue("DescribeTagsResponse.RequestId"));<NEW_LINE>describeTagsResponse.setPageSize(_ctx.integerValue("DescribeTagsResponse.PageSize"));<NEW_LINE>describeTagsResponse.setPageNumber(_ctx.integerValue("DescribeTagsResponse.PageNumber"));<NEW_LINE>describeTagsResponse.setTotalCount(_ctx.integerValue("DescribeTagsResponse.TotalCount"));<NEW_LINE>List<Tag> tags = new ArrayList<Tag>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeTagsResponse.Tags.Length"); i++) {<NEW_LINE>Tag tag = new Tag();<NEW_LINE>tag.setTagValue(_ctx.stringValue("DescribeTagsResponse.Tags[" + i + "].TagValue"));<NEW_LINE>tag.setTagKey(_ctx.stringValue("DescribeTagsResponse.Tags[" + i + "].TagKey"));<NEW_LINE>ResourceTypeCount resourceTypeCount = new ResourceTypeCount();<NEW_LINE>resourceTypeCount.setInstance(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Instance"));<NEW_LINE>resourceTypeCount.setImage(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Image"));<NEW_LINE>resourceTypeCount.setDdh(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Ddh"));<NEW_LINE>resourceTypeCount.setSnapshotPolicy(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.SnapshotPolicy"));<NEW_LINE>resourceTypeCount.setSecuritygroup(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Securitygroup"));<NEW_LINE>resourceTypeCount.setSnapshot(_ctx.integerValue<MASK><NEW_LINE>resourceTypeCount.setReservedInstance(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.ReservedInstance"));<NEW_LINE>resourceTypeCount.setLaunchTemplate(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.LaunchTemplate"));<NEW_LINE>resourceTypeCount.setEni(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Eni"));<NEW_LINE>resourceTypeCount.setDisk(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Disk"));<NEW_LINE>resourceTypeCount.setKeyPair(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.KeyPair"));<NEW_LINE>resourceTypeCount.setVolume(_ctx.integerValue("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Volume"));<NEW_LINE>tag.setResourceTypeCount(resourceTypeCount);<NEW_LINE>tags.add(tag);<NEW_LINE>}<NEW_LINE>describeTagsResponse.setTags(tags);<NEW_LINE>return describeTagsResponse;<NEW_LINE>} | ("DescribeTagsResponse.Tags[" + i + "].ResourceTypeCount.Snapshot")); |
673,557 | private int writeInternal(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) {<NEW_LINE>if (size > Integer.MAX_VALUE) {<NEW_LINE>LOG.error("Cannot write more than Integer.MAX_VALUE");<NEW_LINE>return ErrorCodes.EIO();<NEW_LINE>}<NEW_LINE>final int sz = (int) size;<NEW_LINE>final long fd = fi.fh.get();<NEW_LINE>OpenFileEntry oe = mOpenFiles.getFirstByField(ID_INDEX, fd);<NEW_LINE>if (oe == null) {<NEW_LINE><MASK><NEW_LINE>return -ErrorCodes.EBADFD();<NEW_LINE>}<NEW_LINE>if (oe.getOut() == null) {<NEW_LINE>LOG.error("{} already exists in Alluxio and cannot be overwritten." + " Please delete this file first.", path);<NEW_LINE>return -ErrorCodes.EEXIST();<NEW_LINE>}<NEW_LINE>if (offset < oe.getWriteOffset()) {<NEW_LINE>// no op<NEW_LINE>return sz;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final byte[] dest = new byte[sz];<NEW_LINE>buf.get(0, dest, 0, sz);<NEW_LINE>oe.getOut().write(dest);<NEW_LINE>oe.setWriteOffset(offset + size);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.error("IOException while writing to {}.", path, e);<NEW_LINE>return -ErrorCodes.EIO();<NEW_LINE>}<NEW_LINE>return sz;<NEW_LINE>} | LOG.error("Cannot find fd for {} in table", path); |
511,758 | public static void deleteComplexField(P p) {<NEW_LINE>List<R> runsToDelete = new ArrayList<R>();<NEW_LINE>boolean inField = false;<NEW_LINE>for (Object o : p.getContent()) {<NEW_LINE>o = XmlUtils.unwrap(o);<NEW_LINE>// keep bookmark, proofErr etc in this sample code<NEW_LINE>if (!(o instanceof R))<NEW_LINE>continue;<NEW_LINE>if (!inField) {<NEW_LINE>inField = doesRcontainField((<MASK><NEW_LINE>}<NEW_LINE>if (inField) {<NEW_LINE>runsToDelete.add((R) o);<NEW_LINE>if (doesRcontainField((R) o, STFldCharType.END)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Now we know what to delete, so do it<NEW_LINE>for (R r : runsToDelete) {<NEW_LINE>System.out.println("deleting " + XmlUtils.marshaltoString(r));<NEW_LINE>p.getContent().remove(r);<NEW_LINE>}<NEW_LINE>} | R) o, STFldCharType.BEGIN); |
1,680,334 | @RequiresPermissions(SidecarRestPermissions.CONFIGURATIONS_UPDATE)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@ApiOperation(value = "Delete a configuration variable")<NEW_LINE>@AuditEvent(type = SidecarAuditEventTypes.CONFIGURATION_VARIABLE_DELETE)<NEW_LINE>public Response deleteConfigurationVariable(@ApiParam(name = "id", required = true) @PathParam("id") String id) {<NEW_LINE><MASK><NEW_LINE>final List<Configuration> configurations = this.configurationService.findByConfigurationVariable(configurationVariable);<NEW_LINE>if (!configurations.isEmpty()) {<NEW_LINE>final ValidationResult validationResult = new ValidationResult();<NEW_LINE>validationResult.addError("name", "Variable is still used in the following configurations: " + configurations.stream().map(c -> c.name()).collect(Collectors.joining(", ")));<NEW_LINE>return Response.status(Response.Status.BAD_REQUEST).entity(validationResult).build();<NEW_LINE>}<NEW_LINE>int deleted = configurationVariableService.delete(id);<NEW_LINE>if (deleted == 0) {<NEW_LINE>return Response.notModified().build();<NEW_LINE>}<NEW_LINE>etagService.invalidateAll();<NEW_LINE>return Response.accepted().build();<NEW_LINE>} | final ConfigurationVariable configurationVariable = findVariableOrFail(id); |
1,484,984 | public static void execute(ManagerConnection c, String stmt) {<NEW_LINE>Map<String, String> paramster = parse(stmt);<NEW_LINE>int retryTime = 1;<NEW_LINE>long intervalTime = 200;<NEW_LINE>// "show @@CKECK_GLOBAL -SCHEMA=TESTDB -TABLE=E_ACCOUNT_SUBJECT -retrytime=2"<NEW_LINE>// + " -intervaltime=20"<NEW_LINE>String tableName = paramster.get("table");<NEW_LINE>String schemaName = paramster.get("schema");<NEW_LINE>String retryTimeStr = paramster.get("retry");<NEW_LINE>String intervalTimeStr = paramster.get("interval");<NEW_LINE>MycatConfig config = MycatServer.getInstance().getConfig();<NEW_LINE>TableConfig table;<NEW_LINE>SchemaConfig schemaConfig = null;<NEW_LINE>if (StringUtil.isEmpty(schemaName)) {<NEW_LINE>c.writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "schemaName is null, please add paramster -schema=schemaname ");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>schemaConfig = config.getSchemas().get(schemaName);<NEW_LINE>if (schemaConfig == null) {<NEW_LINE>c.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (StringUtil.isEmpty(tableName)) {<NEW_LINE>c.writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "tableName is null, please add paramster -table=tablename ");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>table = schemaConfig.getTables().get(tableName.toUpperCase());<NEW_LINE>}<NEW_LINE>if (StringUtil.isEmpty(retryTimeStr)) {<NEW_LINE>c.writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "retryTime is null, please add paramster -retry= ");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>retryTime = Integer.valueOf(retryTimeStr);<NEW_LINE>}<NEW_LINE>if (StringUtil.isEmpty(intervalTimeStr)) {<NEW_LINE>c.writeErrMessage(ErrorCode.ER_BAD_TABLE_ERROR, "intervalTime is null, please add paramster -interval= ");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>intervalTime = Long.valueOf(intervalTimeStr);<NEW_LINE>}<NEW_LINE>// tableName = "e_account_subject";<NEW_LINE>// schemaName = "TESTDB";<NEW_LINE>List<String> dataNodeList = table.getDataNodes();<NEW_LINE>ConsistenCollectHandler cHandler = new ConsistenCollectHandler(c, tableName, schemaName, dataNodeList.size(), retryTime, intervalTime);<NEW_LINE>cHandler.startDetector();<NEW_LINE>// c.writeErrMessage(ErrorCode.ER_BAD_TABLE_ERROR, "XXX");<NEW_LINE>} | writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "schemaName is null, please add paramster -schema=schemaname "); |
1,784,288 | private void addChemicalInjectorConcreteRecipes(Consumer<FinishedRecipe> consumer, String basePath) {<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.BLACK_CONCRETE_POWDER, Blocks.BLACK_CONCRETE, "black");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.BLUE_CONCRETE_POWDER, Blocks.BLUE_CONCRETE, "blue");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.BROWN_CONCRETE_POWDER, Blocks.BROWN_CONCRETE, "brown");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.CYAN_CONCRETE_POWDER, Blocks.CYAN_CONCRETE, "cyan");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.GRAY_CONCRETE_POWDER, Blocks.GRAY_CONCRETE, "gray");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.GREEN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE, "green");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.LIGHT_BLUE_CONCRETE_POWDER, Blocks.LIGHT_BLUE_CONCRETE, "light_blue");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.LIGHT_GRAY_CONCRETE_POWDER, Blocks.LIGHT_GRAY_CONCRETE, "light_gray");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.LIME_CONCRETE_POWDER, Blocks.LIME_CONCRETE, "lime");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.MAGENTA_CONCRETE_POWDER, Blocks.MAGENTA_CONCRETE, "magenta");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.ORANGE_CONCRETE_POWDER, Blocks.ORANGE_CONCRETE, "orange");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.PINK_CONCRETE_POWDER, Blocks.PINK_CONCRETE, "pink");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.PURPLE_CONCRETE_POWDER, Blocks.PURPLE_CONCRETE, "purple");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.RED_CONCRETE_POWDER, Blocks.RED_CONCRETE, "red");<NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.<MASK><NEW_LINE>addChemicalInjectorConcreteRecipe(consumer, basePath, Blocks.YELLOW_CONCRETE_POWDER, Blocks.YELLOW_CONCRETE, "yellow");<NEW_LINE>} | WHITE_CONCRETE_POWDER, Blocks.WHITE_CONCRETE, "white"); |
663,094 | public int[] executeInstructions(int n, int[] startPos, String s) {<NEW_LINE><MASK><NEW_LINE>int[] ans = new int[m];<NEW_LINE>Map<Character, int[]> mp = new HashMap<>(4);<NEW_LINE>mp.put('L', new int[] { 0, -1 });<NEW_LINE>mp.put('R', new int[] { 0, 1 });<NEW_LINE>mp.put('U', new int[] { -1, 0 });<NEW_LINE>mp.put('D', new int[] { 1, 0 });<NEW_LINE>for (int i = 0; i < m; ++i) {<NEW_LINE>int x = startPos[0], y = startPos[1];<NEW_LINE>int t = 0;<NEW_LINE>for (int j = i; j < m; ++j) {<NEW_LINE>char c = s.charAt(j);<NEW_LINE>int a = mp.get(c)[0], b = mp.get(c)[1];<NEW_LINE>if (0 <= x + a && x + a < n && 0 <= y + b && y + b < n) {<NEW_LINE>x += a;<NEW_LINE>y += b;<NEW_LINE>++t;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ans[i] = t;<NEW_LINE>}<NEW_LINE>return ans;<NEW_LINE>} | int m = s.length(); |
1,574,493 | public static FunctionArgumentDefinition fromXContent(XContentParser parser) throws IOException {<NEW_LINE>if (parser.currentToken() != XContentParser.Token.START_OBJECT) {<NEW_LINE>throw new IllegalArgumentException("Expected a START_OBJECT but got " + parser.currentToken());<NEW_LINE>}<NEW_LINE>String name = null;<NEW_LINE>DataType type = DataTypes.UNDEFINED;<NEW_LINE>XContentParser.Token token;<NEW_LINE>while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {<NEW_LINE>if (token == XContentParser.Token.FIELD_NAME) {<NEW_LINE>if ("name".equals(parser.currentName())) {<NEW_LINE>name = parseStringField(parser);<NEW_LINE>} else if ("data_type".equals(parser.currentName())) {<NEW_LINE>if (parser.nextToken() != XContentParser.Token.START_OBJECT) {<NEW_LINE>throw new IllegalArgumentException("Expected a START_OBJECT but got " + parser.currentToken());<NEW_LINE>}<NEW_LINE>type = UserDefinedFunctionMetadata.DataTypeXContent.fromXContent(parser);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException(<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Expected a FIELD_NAME but got " + parser.currentToken());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new FunctionArgumentDefinition(name, type);<NEW_LINE>} | "Expected \"name\" or \"data_type\", but got " + parser.currentName()); |
237,260 | public void run(RegressionEnvironment env) {<NEW_LINE>String joinStatement = "@name('s0') select id, p00, theString from " + "SupportBean#length(100) as s1, " + " method:SupportStaticMethodInvocations.fetchObjectLog(theString, intPrimitive)";<NEW_LINE>env.compileDeploy(joinStatement).addListener("s0");<NEW_LINE>// set sleep off<NEW_LINE>SupportStaticMethodInvocations.getInvocationSizeReset();<NEW_LINE>sendTimer(env, 1000);<NEW_LINE>String[] fields = new String[] { "id", "p00", "theString" };<NEW_LINE>sendBeanEvent(env, "E1", 1);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 1, "|E1|", "E1" });<NEW_LINE>sendTimer(env, 1500);<NEW_LINE>sendBeanEvent(env, "E2", 2);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 2, "|E2|", "E2" });<NEW_LINE>sendTimer(env, 2000);<NEW_LINE>sendBeanEvent(env, "E3", 3);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 3, "|E3|", "E3" });<NEW_LINE>env.assertThat(() -> assertEquals(3, SupportStaticMethodInvocations.getInvocationSizeReset()));<NEW_LINE>// should be cached<NEW_LINE>sendBeanEvent(env, "E3", 3);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 3, "|E3|", "E3" });<NEW_LINE>env.assertThat(() -> assertEquals(0, SupportStaticMethodInvocations.getInvocationSizeReset()));<NEW_LINE>sendTimer(env, 2100);<NEW_LINE>// should not be cached<NEW_LINE>sendBeanEvent(env, "E4", 4);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 4, "|E4|", "E4" });<NEW_LINE>env.assertThat(() -> assertEquals(1, SupportStaticMethodInvocations.getInvocationSizeReset()));<NEW_LINE>// should be cached<NEW_LINE>sendBeanEvent(env, "E2", 2);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 2, "|E2|", "E2" });<NEW_LINE>env.assertThat(() -> assertEquals(0, SupportStaticMethodInvocations.getInvocationSizeReset()));<NEW_LINE>// should not be cached<NEW_LINE>sendBeanEvent(env, "E1", 1);<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 1, "|E1|", "E1" });<NEW_LINE>env.assertThat(() -> assertEquals(1<MASK><NEW_LINE>env.undeployAll();<NEW_LINE>} | , SupportStaticMethodInvocations.getInvocationSizeReset())); |
1,585,121 | protected void encodeFilter(FacesContext context, Tree tree, String name) throws IOException {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>writer.startElement("div", null);<NEW_LINE>writer.writeAttribute("class", Tree.FILTER_CONTAINER, null);<NEW_LINE>writer.startElement("input", null);<NEW_LINE>writer.writeAttribute("id", name, null);<NEW_LINE>writer.writeAttribute("name", name, null);<NEW_LINE>writer.writeAttribute("type", "text", null);<NEW_LINE>writer.<MASK><NEW_LINE>writer.writeAttribute("class", Tree.FILTER_CLASS, null);<NEW_LINE>writer.writeAttribute(HTML.ARIA_LABEL, MessageFactory.getMessage(InputRenderer.ARIA_FILTER), null);<NEW_LINE>writer.endElement("input");<NEW_LINE>writer.startElement("span", null);<NEW_LINE>writer.writeAttribute("class", "ui-icon ui-icon-search", null);<NEW_LINE>writer.endElement("span");<NEW_LINE>writer.endElement("div");<NEW_LINE>} | writeAttribute("autocomplete", "off", null); |
582,894 | public static ListCorpMetricsResponse unmarshall(ListCorpMetricsResponse listCorpMetricsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listCorpMetricsResponse.setRequestId(_ctx.stringValue("ListCorpMetricsResponse.RequestId"));<NEW_LINE>listCorpMetricsResponse.setTotalCount(_ctx.integerValue("ListCorpMetricsResponse.TotalCount"));<NEW_LINE>listCorpMetricsResponse.setMessage(_ctx.stringValue("ListCorpMetricsResponse.Message"));<NEW_LINE>listCorpMetricsResponse.setPageSize<MASK><NEW_LINE>listCorpMetricsResponse.setPageNumber(_ctx.integerValue("ListCorpMetricsResponse.PageNumber"));<NEW_LINE>listCorpMetricsResponse.setCode(_ctx.stringValue("ListCorpMetricsResponse.Code"));<NEW_LINE>listCorpMetricsResponse.setSuccess(_ctx.stringValue("ListCorpMetricsResponse.Success"));<NEW_LINE>List<DataItem> data = new ArrayList<DataItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListCorpMetricsResponse.Data.Length"); i++) {<NEW_LINE>DataItem dataItem = new DataItem();<NEW_LINE>dataItem.setDateId(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].DateId"));<NEW_LINE>dataItem.setDeviceGroupId(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].DeviceGroupId"));<NEW_LINE>dataItem.setDeviceId(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].DeviceId"));<NEW_LINE>dataItem.setUserGroupId(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].UserGroupId"));<NEW_LINE>dataItem.setTagCode(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].TagCode"));<NEW_LINE>dataItem.setCorpId(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].CorpId"));<NEW_LINE>dataItem.setTagMetrics(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].TagMetrics"));<NEW_LINE>dataItem.setTagValue(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].TagValue"));<NEW_LINE>dataItem.setPersonId(_ctx.stringValue("ListCorpMetricsResponse.Data[" + i + "].PersonId"));<NEW_LINE>data.add(dataItem);<NEW_LINE>}<NEW_LINE>listCorpMetricsResponse.setData(data);<NEW_LINE>return listCorpMetricsResponse;<NEW_LINE>} | (_ctx.integerValue("ListCorpMetricsResponse.PageSize")); |
1,075,479 | protected void createGrpcComponents() throws SiteWhereException {<NEW_LINE>this.userManagementGrpcServer = new UserManagementGrpcServer(this, getUserManagement());<NEW_LINE>this.tenantManagementGrpcServer = new <MASK><NEW_LINE>// Device management.<NEW_LINE>IDeviceManagementApiChannel<?> deviceManagement = new DeviceManagementApiChannel(getInstanceSettings());<NEW_LINE>this.deviceManagementApiChannel = new CachedDeviceManagementApiChannel(deviceManagement, new CachedDeviceManagementApiChannel.CacheSettings());<NEW_LINE>// Device event management.<NEW_LINE>this.deviceEventManagementApiChannel = new DeviceEventManagementApiChannel(getInstanceSettings());<NEW_LINE>// Asset management.<NEW_LINE>IAssetManagementApiChannel<?> assetManagement = new AssetManagementApiChannel(getInstanceSettings());<NEW_LINE>this.assetManagementApiChannel = new CachedAssetManagementApiChannel(assetManagement, new CachedAssetManagementApiChannel.CacheSettings());<NEW_LINE>// Batch management.<NEW_LINE>this.batchManagementApiChannel = new BatchManagementApiChannel(getInstanceSettings());<NEW_LINE>// Schedule management.<NEW_LINE>this.scheduleManagementApiChannel = new ScheduleManagementApiChannel(getInstanceSettings());<NEW_LINE>// Label generation.<NEW_LINE>this.labelGenerationApiChannel = new LabelGenerationApiChannel(getInstanceSettings());<NEW_LINE>// Device state.<NEW_LINE>this.deviceStateApiChannel = new DeviceStateApiChannel(getInstanceSettings());<NEW_LINE>} | TenantManagementGrpcServer(this, getTenantManagement()); |
1,270,348 | private boolean handleRoute(boolean checkFirstRoute, SipServletRequestImpl request, String route, SipApplicationRouterInfo appInfo) {<NEW_LINE>if (c_logger.isTraceEntryExitEnabled()) {<NEW_LINE>c_logger.traceEntry(this, "handleRoute", new Object[] { checkFirstRoute, request, route, appInfo });<NEW_LINE>}<NEW_LINE>Address routeAddress = null;<NEW_LINE>SipURIImpl sipRouteUri = null;<NEW_LINE>try {<NEW_LINE>SipFactory sipFactory = SipServletsFactoryImpl.getInstance();<NEW_LINE>routeAddress = sipFactory.createAddress(route);<NEW_LINE>if (!(routeAddress.getURI() instanceof SipURIImpl)) {<NEW_LINE>throw new IllegalArgumentException("Application router info is invalid. Route doesn't contain valid SIP URI " + routeAddress);<NEW_LINE>}<NEW_LINE>sipRouteUri = (SipURIImpl) routeAddress.getURI();<NEW_LINE>if (checkFirstRoute) {<NEW_LINE>return handleFirstRoute(sipRouteUri, request, routeAddress);<NEW_LINE>}<NEW_LINE>// If first route was external, all routes (including other internals), needs to be pushed<NEW_LINE>request.pushRoute(sipRouteUri);<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "handleRoute", "External Route: " + sipRouteUri + " pushed to top route of request callID=" + request.getCallId() + ", method= " + request.getMethod() + ", request object= \n" + this);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} catch (ServletParseException e) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(<MASK><NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Application router info is invalid. Route doesn't contain valid SIP URI " + routeAddress);<NEW_LINE>} finally {<NEW_LINE>if (c_logger.isTraceEntryExitEnabled()) {<NEW_LINE>c_logger.traceExit(this, "handleRoute");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | this, "handleRoute", "Unable to construct URI from the route URI string " + sipRouteUri); |
760,753 | public void eval() {<NEW_LINE>String userAgentString = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.getStringFromVarCharHolder(useragent);<NEW_LINE>String userAgentField = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.getStringFromVarCharHolder(fieldName);<NEW_LINE>nl.basjes.parse.useragent.UserAgent <MASK><NEW_LINE>String field = agent.getValue(userAgentField);<NEW_LINE>if (field == null) {<NEW_LINE>field = nl.basjes.parse.useragent.UserAgent.UNKNOWN_VALUE;<NEW_LINE>}<NEW_LINE>byte[] rowStringBytes = field.getBytes(java.nio.charset.StandardCharsets.UTF_8);<NEW_LINE>outBuffer.reallocIfNeeded(rowStringBytes.length);<NEW_LINE>outBuffer.setBytes(0, rowStringBytes);<NEW_LINE>value.start = 0;<NEW_LINE>value.end = rowStringBytes.length;<NEW_LINE>value.buffer = outBuffer;<NEW_LINE>} | agent = uaa.parse(userAgentString); |
1,428,419 | public void print() {<NEW_LINE>log.info(m_info.toString());<NEW_LINE>if (m_layout == null)<NEW_LINE>layout();<NEW_LINE>// Paper Attributes: media-printable-area, orientation-requested, media<NEW_LINE>PrintRequestAttributeSet prats = m_layout.getPaper().getPrintRequestAttributeSet();<NEW_LINE>// add: copies, job-name, priority<NEW_LINE>if (m_info.isDocumentCopy() || m_info.getCopies() < 1)<NEW_LINE>prats.add(new Copies(1));<NEW_LINE>else<NEW_LINE>prats.add(new Copies(m_info.getCopies()));<NEW_LINE>Locale locale = Language.getLoginLanguage().getLocale();<NEW_LINE>prats.add(new JobName(m_printFormat.getName(), locale));<NEW_LINE>JobPriority priority = PrintUtil.getJobPriority(m_layout.getNumberOfPages(), m_info.getCopies(), true);<NEW_LINE>// check for directly set priority<NEW_LINE>if (m_priority > 0 && m_priority <= 100)<NEW_LINE>priority = new JobPriority(m_priority);<NEW_LINE>prats.add(priority);<NEW_LINE>try {<NEW_LINE>// PrinterJob<NEW_LINE>PrinterJob job = getPrinterJob(m_info.getPrinterName());<NEW_LINE>// job.getPrintService().addPrintServiceAttributeListener(this);<NEW_LINE>// no copy<NEW_LINE>job.setPageable(m_layout.getPageable(false));<NEW_LINE>// Dialog<NEW_LINE>try {<NEW_LINE>if (m_info.isWithDialog() && !job.printDialog(prats))<NEW_LINE>return;<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.log(Level.WARNING, "Operating System Print Issue, check & try again", e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// submit<NEW_LINE>boolean printCopy = m_info.isDocumentCopy() && m_info.getCopies() > 1;<NEW_LINE>ArchiveEngine.get().archive(m_layout, m_info);<NEW_LINE>PrintUtil.print(job, prats, false, !<MASK><NEW_LINE>// Document: Print Copies<NEW_LINE>if (printCopy) {<NEW_LINE>log.info("Copy " + (m_info.getCopies() - 1));<NEW_LINE>prats.add(new Copies(m_info.getCopies() - 1));<NEW_LINE>job = getPrinterJob(m_info.getPrinterName());<NEW_LINE>// job.getPrintService().addPrintServiceAttributeListener(this);<NEW_LINE>// Copy<NEW_LINE>job.setPageable(m_layout.getPageable(true));<NEW_LINE>PrintUtil.print(job, prats, false, false);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.log(Level.SEVERE, "", e);<NEW_LINE>}<NEW_LINE>} | m_info.isAsync() || printCopy); |
221,798 | private void registerMetrics() {<NEW_LINE>if (!isFaultToleranceMetricsEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (introspector.hasCircuitBreaker()) {<NEW_LINE>CircuitBreakerStateTotal.register(() -> methodState.breakerTimerOpen, introspector.getMethodNameTag(), CircuitBreakerState.OPEN.get());<NEW_LINE>CircuitBreakerStateTotal.register(() -> methodState.breakerTimerHalfOpen, introspector.getMethodNameTag(), CircuitBreakerState.HALF_OPEN.get());<NEW_LINE>CircuitBreakerStateTotal.register(() -> methodState.breakerTimerClosed, introspector.getMethodNameTag(), <MASK><NEW_LINE>CircuitBreakerOpenedTotal.register(introspector.getMethodNameTag());<NEW_LINE>}<NEW_LINE>if (introspector.hasBulkhead()) {<NEW_LINE>BulkheadExecutionsRunning.register(() -> methodState.bulkhead.stats().concurrentExecutions(), introspector.getMethodNameTag());<NEW_LINE>if (introspector.isAsynchronous()) {<NEW_LINE>BulkheadExecutionsWaiting.register(() -> methodState.bulkhead.stats().waitingQueueSize(), introspector.getMethodNameTag());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | CircuitBreakerState.CLOSED.get()); |
1,288,457 | public com.amazonaws.services.iotwireless.model.ResourceNotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.iotwireless.model.ResourceNotFoundException resourceNotFoundException = new com.amazonaws.services.iotwireless.model.ResourceNotFoundException(null);<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("ResourceId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resourceNotFoundException.setResourceId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ResourceType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resourceNotFoundException.setResourceType(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 resourceNotFoundException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,724,607 | public Answer scaleVm(final ScaleVmCommand cmd) {<NEW_LINE>TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);<NEW_LINE>try {<NEW_LINE>txn.start();<NEW_LINE>final String vmName = cmd.getVmName();<NEW_LINE>final MockVMVO <MASK><NEW_LINE>if (vm == null) {<NEW_LINE>return new ScaleVmAnswer(cmd, false, "Can't find VM " + vmName);<NEW_LINE>}<NEW_LINE>vm.setCpu(cmd.getCpus() * cmd.getMaxSpeed());<NEW_LINE>vm.setMemory(cmd.getMaxRam());<NEW_LINE>_mockVmDao.update(vm.getId(), vm);<NEW_LINE>s_logger.debug("Scaled up VM " + vmName);<NEW_LINE>txn.commit();<NEW_LINE>return new ScaleVmAnswer(cmd, true, null);<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>txn.rollback();<NEW_LINE>throw new CloudRuntimeException("Unable to scale up VM", ex);<NEW_LINE>} finally {<NEW_LINE>txn.close();<NEW_LINE>txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);<NEW_LINE>txn.close();<NEW_LINE>}<NEW_LINE>} | vm = _mockVmDao.findByVmName(vmName); |
1,168,374 | public double minDist(SpatialComparable mbr1, SpatialComparable mbr2) {<NEW_LINE>final int <MASK><NEW_LINE>double agg = 0., norm1 = 0, norm2 = 0.;<NEW_LINE>for (int i = 0; i < dim; i++) {<NEW_LINE>final double min1 = mbr1.getMin(i), max1 = mbr1.getMax(i);<NEW_LINE>final double min2 = mbr2.getMin(i), max2 = mbr2.getMax(i);<NEW_LINE>agg += Math.min(max1, max2);<NEW_LINE>norm1 += Math.max(0, min1);<NEW_LINE>norm2 += Math.max(0, min2);<NEW_LINE>}<NEW_LINE>final double norm = Math.min(norm1, norm2);<NEW_LINE>return norm > 0 && agg < norm ? (1 - agg / norm) : 0;<NEW_LINE>} | dim = dimensionality(mbr1, mbr2); |
1,415,223 | public JobConfigIdentifier translateToActualCase(JobConfigIdentifier identifier) {<NEW_LINE>PipelineConfig pipelineConfig = getCurrentConfig().pipelineConfigByName(new CaseInsensitiveString(identifier.getPipelineName()));<NEW_LINE>String translatedPipelineName = CaseInsensitiveString.str(pipelineConfig.name());<NEW_LINE>StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString<MASK><NEW_LINE>if (stageConfig == null) {<NEW_LINE>throw new StageNotFoundException(new CaseInsensitiveString(identifier.getPipelineName()), new CaseInsensitiveString(identifier.getStageName()));<NEW_LINE>}<NEW_LINE>String translatedStageName = CaseInsensitiveString.str(stageConfig.name());<NEW_LINE>JobConfig plan = stageConfig.jobConfigByInstanceName(identifier.getJobName(), true);<NEW_LINE>if (plan == null) {<NEW_LINE>throw new RecordNotFoundException(format("Job '%s' not found in pipeline '%s' stage '%s'", identifier.getJobName(), identifier.getPipelineName(), identifier.getStageName()));<NEW_LINE>}<NEW_LINE>String translatedJobName = plan.translatedName(identifier.getJobName());<NEW_LINE>return new JobConfigIdentifier(translatedPipelineName, translatedStageName, translatedJobName);<NEW_LINE>} | (identifier.getStageName())); |
1,024,176 | private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(String resourceGroupName, String routeTableName, RouteTableInner parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (routeTableName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String apiVersion = "2018-11-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, routeTableName, apiVersion, this.client.getSubscriptionId(), parameters, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); |
1,068,337 | public boolean convert(File presentationFile, File output, int page, UploadedPresentation pres) {<NEW_LINE>String COMMAND = SWFTOOLS_DIR + File.separatorChar + "png2swf -o " + output.getAbsolutePath() + " " + presentationFile.getAbsolutePath();<NEW_LINE>boolean done = new ExternalProcessExecutor().exec(COMMAND, 10000);<NEW_LINE>if (done && output.exists()) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>Map<String, Object> logData = new HashMap<String, Object>();<NEW_LINE>logData.put("meetingId", pres.getMeetingId());<NEW_LINE>logData.put(<MASK><NEW_LINE>logData.put("filename", pres.getName());<NEW_LINE>logData.put("logCode", "png_to_swf_failed");<NEW_LINE>logData.put("message", "Failed to convert PNG doc to SWF.");<NEW_LINE>Gson gson = new Gson();<NEW_LINE>String logStr = gson.toJson(logData);<NEW_LINE>log.warn(" --analytics-- data={}", logStr);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | "presId", pres.getId()); |
423,663 | public static String[] annotateTypeParameter(String originalSignature, String annotatedType, int rank, MergeStrategy mergeStrategy) {<NEW_LINE>// prefix, orig, replacement, postfix<NEW_LINE>String[] result = new String[4];<NEW_LINE>StringBuffer buf = new StringBuffer();<NEW_LINE>// may already contain annotations<NEW_LINE>SignatureWrapper wrapper = new SignatureWrapper(originalSignature.toCharArray(), true, true);<NEW_LINE>// skip '<'<NEW_LINE>wrapper.start = 1;<NEW_LINE>// prefix:<NEW_LINE>for (int i = 0; i < rank; i++) {<NEW_LINE>wrapper.skipTypeParameter();<NEW_LINE>}<NEW_LINE>int start = wrapper.start;<NEW_LINE>result[0] = originalSignature.substring(0, start);<NEW_LINE>// orig:<NEW_LINE>int end = wrapper.skipTypeParameter();<NEW_LINE>result[1] = originalSignature.substring(start, end);<NEW_LINE>// replacement:<NEW_LINE>SignatureWrapper oWrap = new SignatureWrapper(result[1].toCharArray());<NEW_LINE>SignatureWrapper nWrap = new SignatureWrapper(annotatedType.toCharArray());<NEW_LINE>mergeAnnotation(buf, oWrap, nWrap, mergeStrategy);<NEW_LINE>updateTypeParameter(buf, oWrap.tail(), nWrap.tail(), mergeStrategy);<NEW_LINE>result[2] = buf.toString();<NEW_LINE>// postfix:<NEW_LINE>result[3] = originalSignature.substring(<MASK><NEW_LINE>return result;<NEW_LINE>} | end, originalSignature.length()); |
1,095,758 | public void describe(StringBuilder msg, boolean verbose) {<NEW_LINE>msg.append(mKind);<NEW_LINE>if (mFinished) {<NEW_LINE>msg.append(" took ").append(mEndTime - mStartTime).append("ms");<NEW_LINE>} else {<NEW_LINE>msg.append(" started ").append(System.currentTimeMillis() - mStartWallTime).append("ms ago");<NEW_LINE>}<NEW_LINE>msg.append(" - ").append(getStatus());<NEW_LINE>if (mSql != null) {<NEW_LINE>msg.append(", sql=\"").append(trimSqlForDisplay(mSql)).append("\"");<NEW_LINE>}<NEW_LINE>if (verbose && mBindArgs != null && mBindArgs.size() != 0) {<NEW_LINE>msg.append(", bindArgs=[");<NEW_LINE>final int count = mBindArgs.size();<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>final Object <MASK><NEW_LINE>if (i != 0) {<NEW_LINE>msg.append(", ");<NEW_LINE>}<NEW_LINE>if (arg == null) {<NEW_LINE>msg.append("null");<NEW_LINE>} else if (arg instanceof byte[]) {<NEW_LINE>msg.append("<byte[]>");<NEW_LINE>} else if (arg instanceof String) {<NEW_LINE>msg.append("\"").append((String) arg).append("\"");<NEW_LINE>} else {<NEW_LINE>msg.append(arg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>msg.append("]");<NEW_LINE>}<NEW_LINE>if (mException != null) {<NEW_LINE>msg.append(", exception=\"").append(mException.getMessage()).append("\"");<NEW_LINE>}<NEW_LINE>} | arg = mBindArgs.get(i); |
1,751,823 | public Result preprocessEnter(@Nonnull final PsiFile file, @Nonnull final Editor editor, @Nonnull final Ref<Integer> caretOffset, @Nonnull final Ref<Integer> caretAdvance, @Nonnull final DataContext dataContext, final EditorActionHandler originalHandler) {<NEW_LINE>Result res = shouldSkipWithResult(file, editor, dataContext);<NEW_LINE>if (res != null) {<NEW_LINE>return res;<NEW_LINE>}<NEW_LINE>final Document document = editor.getDocument();<NEW_LINE>int caret = editor.getCaretModel().getOffset();<NEW_LINE>final int lineNumber = document.getLineNumber(caret);<NEW_LINE>final int lineStartOffset = document.getLineStartOffset(lineNumber);<NEW_LINE>final int previousLineStartOffset = lineNumber > 0 ? document.getLineStartOffset(lineNumber - 1) : lineStartOffset;<NEW_LINE>final EditorHighlighter highlighter = ((EditorEx) editor).getHighlighter();<NEW_LINE>final HighlighterIterator iterator = highlighter.createIterator(caret - 1);<NEW_LINE>final IElementType type = getNonWhitespaceElementType(iterator, lineStartOffset, previousLineStartOffset);<NEW_LINE>final CharSequence editorCharSequence = document.getCharsSequence();<NEW_LINE>final CharSequence lineIndent = editorCharSequence.subSequence(lineStartOffset, EditorActionUtil.findFirstNonSpaceOffsetOnTheLine(document, lineNumber));<NEW_LINE>// Enter in line comment<NEW_LINE>if (type == myLineCommentType) {<NEW_LINE>final String restString = editorCharSequence.subSequence(caret, document.getLineEndOffset(lineNumber)).toString();<NEW_LINE>if (!StringUtil.isEmptyOrSpaces(restString)) {<NEW_LINE>final String linePrefix = lineIndent + myLineCommentPrefix;<NEW_LINE>EditorModificationUtil.insertStringAtCaret(editor, "\n" + linePrefix);<NEW_LINE>editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(lineNumber + 1<MASK><NEW_LINE>return Result.Stop;<NEW_LINE>} else if (iterator.getStart() < lineStartOffset) {<NEW_LINE>EditorModificationUtil.insertStringAtCaret(editor, "\n" + lineIndent);<NEW_LINE>return Result.Stop;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!myWorksWithFormatter && LanguageFormatting.INSTANCE.forLanguage(myLanguage) != null) {<NEW_LINE>return Result.Continue;<NEW_LINE>} else {<NEW_LINE>if (myIndentTokens.contains(type)) {<NEW_LINE>final String newIndent = getNewIndent(file, document, lineIndent);<NEW_LINE>EditorModificationUtil.insertStringAtCaret(editor, "\n" + newIndent);<NEW_LINE>return Result.Stop;<NEW_LINE>}<NEW_LINE>EditorModificationUtil.insertStringAtCaret(editor, "\n" + lineIndent);<NEW_LINE>editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(lineNumber + 1, calcLogicalLength(editor, lineIndent)));<NEW_LINE>return Result.Stop;<NEW_LINE>}<NEW_LINE>} | , linePrefix.length())); |
460,752 | final GetDeviceResult executeGetDevice(GetDeviceRequest getDeviceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDeviceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<GetDeviceRequest> request = null;<NEW_LINE>Response<GetDeviceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDeviceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDeviceRequest));<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, "Device Farm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDevice");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDeviceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDeviceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,374,300 | private void propagatePersistedInternal(Supplier<JournalContext> journalContext, LockedInodePath inodePath) throws FileDoesNotExistException {<NEW_LINE>Inode inode = inodePath.getInode();<NEW_LINE>List<Inode> inodes = inodePath.getInodeList();<NEW_LINE>// Traverse the inodes from target inode to the root.<NEW_LINE>Collections.reverse(inodes);<NEW_LINE>// Skip the first, to not examine the target inode itself.<NEW_LINE>inodes = inodes.subList(1, inodes.size());<NEW_LINE>List<Inode> persistedInodes = new ArrayList<>();<NEW_LINE>for (Inode ancestor : inodes) {<NEW_LINE>// the path is already locked.<NEW_LINE>AlluxioURI <MASK><NEW_LINE>if (mMountTable.isMountPoint(path)) {<NEW_LINE>// Stop propagating the persisted status at mount points.<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (ancestor.isPersisted()) {<NEW_LINE>// Stop if a persisted directory is encountered.<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>mInodeTree.updateInode(journalContext, UpdateInodeEntry.newBuilder().setId(ancestor.getId()).setPersistenceState(PersistenceState.PERSISTED.name()).build());<NEW_LINE>}<NEW_LINE>} | path = mInodeTree.getPath(ancestor); |
1,621,870 | private static void printUsage() {<NEW_LINE>System.out.println();<NEW_LINE>System.out.println("SYNOPSIS");<NEW_LINE>System.out.println(" " + BenchmarkServer.class.getSimpleName() + " [-a ADDRESS] [-p PORT] [-t POOLSIZE] [-s SENDERS] [-r RECEIVERS]");<NEW_LINE>System.out.println("OPTIONS");<NEW_LINE>System.out.println(" -a ADDRESS");<NEW_LINE><MASK><NEW_LINE>System.out.println(" -p PORT");<NEW_LINE>System.out.println(" Listen on UDP port PORT (default is " + DEFAULT_PORT + ").");<NEW_LINE>System.out.println(" -t POOLSIZE");<NEW_LINE>System.out.println(" Use POOLSIZE worker threads in the endpoint (default is the number of cores).");<NEW_LINE>System.out.println(" -s SENDERS");<NEW_LINE>System.out.println(" Use SENDERS threads to copy messages to the UDP socket.");<NEW_LINE>System.out.println(" The default is number of cores on Windows and 1 otherwise.");<NEW_LINE>System.out.println(" -r RECEIVERS");<NEW_LINE>System.out.println(" Use RECEIVERS threads to copy messages from the UDP socket.");<NEW_LINE>System.out.println(" The default is number of cores on Windows and 1 otherwise.");<NEW_LINE>System.out.println(" -use-workers");<NEW_LINE>System.out.println(" Use a specialized queue for incoming requests that reduces synchronization of threads.");<NEW_LINE>System.out.println("OPTIMIZATIONS");<NEW_LINE>System.out.println(" -Xms4096m -Xmx4096m");<NEW_LINE>System.out.println(" Set the Java heap size to 4 GiB.");<NEW_LINE>System.out.println("EXAMPLES");<NEW_LINE>System.out.println(" java -Xms4096m -Xmx4096m " + BenchmarkServer.class.getSimpleName() + " -p 5684 -t 16");<NEW_LINE>System.out.println(" java -Xms4096m -Xmx4096m -jar " + BenchmarkServer.class.getSimpleName() + ".jar -s 2 -r 2");<NEW_LINE>System.exit(0);<NEW_LINE>} | System.out.println(" Bind the server to a specific host IP address given by ADDRESS (default is wildcard address)."); |
841,734 | public com.amazonaws.services.codecommit.model.CannotDeleteApprovalRuleFromTemplateException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.codecommit.model.CannotDeleteApprovalRuleFromTemplateException cannotDeleteApprovalRuleFromTemplateException = new com.amazonaws.services.codecommit.model.CannotDeleteApprovalRuleFromTemplateException(null);<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>} 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 cannotDeleteApprovalRuleFromTemplateException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
845,260 | public void baseTick() {<NEW_LINE>super.baseTick();<NEW_LINE>float radius = 5F;<NEW_LINE>float renderRadius = (float) (radius - Math.random());<NEW_LINE>for (int i = 0; i < Math.min(90, tickCount); i++) {<NEW_LINE>float a = i;<NEW_LINE>if (a % 2 == 0) {<NEW_LINE>a = 45 + a;<NEW_LINE>}<NEW_LINE>if (level.random.nextInt(tickCount < 90 ? 8 : 20) == 0) {<NEW_LINE>float rad = (float) (a * 4 * Math.PI / 180F);<NEW_LINE>double x = Math.cos(rad) * renderRadius;<NEW_LINE>double z = Math.sin(rad) * renderRadius;<NEW_LINE>WispParticleData data1 = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F);<NEW_LINE>level.addParticle(data1, getX() + x, getY() - 0.2, getZ() + z, (float) (Math.random() - 0.5F) * 0.15F, 0.055F + (float) Math.random() * 0.025F, (float) (Math.random() - 0.5F) * 0.15F);<NEW_LINE>float gs = (float) Math.random() * 0.15F;<NEW_LINE>float smokeRadius = (float) (renderRadius - Math.random() * renderRadius * 0.9);<NEW_LINE>x = Math.cos(rad) * smokeRadius;<NEW_LINE>z = Math.sin(rad) * smokeRadius;<NEW_LINE>WispParticleData data = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, gs, gs, gs, 1);<NEW_LINE>level.addParticle(data, getX() + x, getY() - 0.2, getZ() + z, 0, -(-0.155F - (float) Math.random() * 0.025F), 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (level.random.nextInt(20) == 0) {<NEW_LINE>level.playLocalSound(getX(), getY(), getZ(), SoundEvents.FIRE_AMBIENT, SoundSource.BLOCKS, 1F, 1F, false);<NEW_LINE>}<NEW_LINE>if (level.isClientSide) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (tickCount >= 300) {<NEW_LINE>discard();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (tickCount > 45) {<NEW_LINE>AABB boundingBox = new AABB(getX(), getY(), getZ(), getX(), getY(), getZ()).inflate(radius, radius, radius);<NEW_LINE>List<LivingEntity> entities = level.<MASK><NEW_LINE>if (entities.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (LivingEntity entity : entities) {<NEW_LINE>if (entity == null || MathHelper.pointDistancePlane(getX(), getY(), entity.getX(), entity.getY()) > radius) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>entity.setSecondsOnFire(4);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getEntitiesOfClass(LivingEntity.class, boundingBox); |
403,669 | private void addToDataSet(List<List<Map>> listbigPaths, ListDataSet dataSet) {<NEW_LINE>List<TSDataType> listType = new ArrayList<>();<NEW_LINE>int i = 0;<NEW_LINE>for (List<Map> listPaths : listbigPaths) {<NEW_LINE>RowRecord record = new RowRecord(0);<NEW_LINE>for (Map<String, Object> map : listPaths) {<NEW_LINE>TSDataType columnType = (TSDataType) map.get("type");<NEW_LINE>Object val = map.get("val");<NEW_LINE>org.apache.iotdb.tsfile.read.common.Field field = new org.apache.iotdb.tsfile.read.common.Field(columnType);<NEW_LINE>switch(columnType) {<NEW_LINE>case TEXT:<NEW_LINE>field.setBinaryV(new Binary(val.toString()));<NEW_LINE>break;<NEW_LINE>case FLOAT:<NEW_LINE>field.setFloatV<MASK><NEW_LINE>break;<NEW_LINE>case INT32:<NEW_LINE>field.setIntV(((int) val));<NEW_LINE>break;<NEW_LINE>case INT64:<NEW_LINE>field.setLongV(((long) val));<NEW_LINE>break;<NEW_LINE>case DOUBLE:<NEW_LINE>field.setDoubleV(((double) val));<NEW_LINE>break;<NEW_LINE>case BOOLEAN:<NEW_LINE>field.setBoolV(((boolean) val));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>record.addField(field);<NEW_LINE>if (i == 0) {<NEW_LINE>listType.add(columnType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>dataSet.putRecord(record);<NEW_LINE>}<NEW_LINE>dataSet.setDataTypes(listType);<NEW_LINE>} | (((float) val)); |
680,414 | public String export(boolean isWindows, GrpcRequestContainer request, Templater templater) {<NEW_LINE>String lineBreak = isWindows ? " ^\n " : " \\\n ";<NEW_LINE>String quote = isWindows ? "\"" : "'";<NEW_LINE>StringBuilder b = new StringBuilder();<NEW_LINE>b.append("grpcurl ");<NEW_LINE>request.getAspect(GrpcHeaderAspect.class).ifPresent(a -> {<NEW_LINE>if (!a.getEntries().isEmpty()) {<NEW_LINE>b.append(lineBreak);<NEW_LINE>String headers = a.getEntries().stream().filter(HeaderEntry::isEnabled).map(h -> "-H " + quote + h.getName() + ": " + h.getValue() + quote).collect<MASK><NEW_LINE>b.append(headers);<NEW_LINE>b.append(lineBreak);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>request.getAspect(GrpcPayloadAspect.class).ifPresent(a -> {<NEW_LINE>if (StringUtils.isNotBlank(a.getPayload())) {<NEW_LINE>b.append(lineBreak);<NEW_LINE>String normalized = StringUtils.normalizeSpace(a.getPayload());<NEW_LINE>if (isWindows) {<NEW_LINE>// replace all quotes with double quotes<NEW_LINE>normalized = normalized.replaceAll("\"", "\"\"");<NEW_LINE>}<NEW_LINE>b.append("-d " + quote);<NEW_LINE>b.append(normalized);<NEW_LINE>b.append(quote);<NEW_LINE>b.append(lineBreak);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>b.append(request.getEndpoint());<NEW_LINE>b.append(lineBreak);<NEW_LINE>request.getAspect(GrpcOperationAspect.class).ifPresent(operation -> {<NEW_LINE>b.append(operation.getOperation());<NEW_LINE>});<NEW_LINE>return templater.replaceTags(b.toString());<NEW_LINE>} | (Collectors.joining(lineBreak)); |
72,952 | private void generatePackageHtml(Writer out, JCLPackage pkg) throws IOException {<NEW_LINE>String template;<NEW_LINE>try (Reader reader = new InputStreamReader(classLoader.getResourceAsStream("html/jcl-class.html"), StandardCharsets.UTF_8)) {<NEW_LINE>template = IOUtils.toString(reader);<NEW_LINE>}<NEW_LINE>template = template.replace("${CLASSNAME}", pkg.name);<NEW_LINE>int placeholderIndex = template.indexOf(TEMPLATE_PLACEHOLDER);<NEW_LINE>String header = <MASK><NEW_LINE>String footer = template.substring(placeholderIndex + TEMPLATE_PLACEHOLDER.length());<NEW_LINE>out.write(header);<NEW_LINE>int totalClasses = pkg.classes.size();<NEW_LINE>int fullClasses = 0;<NEW_LINE>int partialClasses = 0;<NEW_LINE>for (JCLClass cls : pkg.classes) {<NEW_LINE>switch(cls.status) {<NEW_LINE>case FOUND:<NEW_LINE>fullClasses++;<NEW_LINE>partialClasses++;<NEW_LINE>break;<NEW_LINE>case PARTIAL:<NEW_LINE>partialClasses++;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeRow(out, "package", null, pkg.status, escape(pkg.name), totalClasses > 0 ? fullClasses * 100 / totalClasses : null, totalClasses > 0 ? partialClasses * 100 / totalClasses : null);<NEW_LINE>for (JCLClass cls : pkg.classes) {<NEW_LINE>writeClassRow(out, pkg, cls);<NEW_LINE>}<NEW_LINE>out.write(footer);<NEW_LINE>} | template.substring(0, placeholderIndex); |
253,212 | private RelNode handleProject(LogicalProject project, RelNode child) {<NEW_LINE>List<RexNode> pros = Lists.newLinkedList();<NEW_LINE>Map<Integer, Integer> shift = shiftMap.get(child);<NEW_LINE>List<Integer> childAdd = childAddMap.get(child);<NEW_LINE>Set<Integer> toAdd = addMap.get(project);<NEW_LINE>if (shift != null) {<NEW_LINE>for (RexNode oldPro : project.getProjects()) {<NEW_LINE>RexNode newPro = RexUtil.shift(oldPro, shift);<NEW_LINE>pros.add(newPro);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>pros.addAll(project.getProjects());<NEW_LINE>}<NEW_LINE>Set<Integer> addSet = Sets.newHashSet();<NEW_LINE>Map<Integer, Integer> curAnchorMap = anchor.get(project);<NEW_LINE>Map<Integer, Integer> childAnchorMap = anchor.get(child) == null ? Maps.newHashMap() : anchor.get(child);<NEW_LINE>shiftToAdd(shift, childAdd, toAdd, addSet, curAnchorMap, childAnchorMap);<NEW_LINE>List<String> newFieldNames = Lists.newArrayList();<NEW_LINE>newFieldNames.addAll(project.getRowType().getFieldNames());<NEW_LINE>List<Integer> addListForParent = Lists.newArrayList();<NEW_LINE>Map<Integer, Integer> anchorMapForParent = Maps.newHashMap();<NEW_LINE>for (Integer newIndex : addSet) {<NEW_LINE>RelDataTypeField relDataTypeField = child.getRowType().getFieldList().get(newIndex);<NEW_LINE>pros.add(new RexInputRef(newIndex, relDataTypeField.getType()));<NEW_LINE>addListForParent.add(pros.size() - 1);<NEW_LINE>anchorMapForParent.put(pros.size() - 1, childAnchorMap.get(newIndex));<NEW_LINE>newFieldNames.add(relDataTypeField.getName());<NEW_LINE>}<NEW_LINE>RelNode r = project.copy(child, pros, newFieldNames);<NEW_LINE><MASK><NEW_LINE>anchor.put(r, anchorMapForParent);<NEW_LINE>return r;<NEW_LINE>} | childAddMap.put(r, addListForParent); |
658,959 | private void renderSubtree(int depth, Node node, Appendable out) throws IOException {<NEW_LINE>String eltName = node.getXPathNodeName();<NEW_LINE>checkValidName(eltName);<NEW_LINE>indent(depth, out).append('<').append(eltName);<NEW_LINE>Map<String, String> <MASK><NEW_LINE>for (String attrName : attributes.keySet()) {<NEW_LINE>appendAttribute(out, attrName, attributes.get(attrName));<NEW_LINE>}<NEW_LINE>if (node.getNumChildren() == 0) {<NEW_LINE>out.append(" />");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>out.append(">");<NEW_LINE>for (int i = 0; i < node.getNumChildren(); i++) {<NEW_LINE>out.append(strategy.lineSeparator);<NEW_LINE>renderSubtree(depth + 1, node.getChild(i), out);<NEW_LINE>}<NEW_LINE>out.append(strategy.lineSeparator);<NEW_LINE>indent(depth, out).append("</").append(eltName).append('>');<NEW_LINE>} | attributes = strategy.getXmlAttributes(node); |
1,352,392 | private void queryPreviouslyNotable(List<ResultDomain> domainsBatch, CentralRepository centralRepo, SearchContext context) throws DiscoveryException, SearchCancellationException {<NEW_LINE>if (domainsBatch.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final CorrelationAttributeInstance.Type attributeType = <MASK><NEW_LINE>final Map<String, List<ResultDomain>> resultDomainTable = organizeByValue(domainsBatch, attributeType, context);<NEW_LINE>final String values = createCSV(resultDomainTable.keySet());<NEW_LINE>if (context.searchIsCancelled()) {<NEW_LINE>throw new SearchCancellationException("Search was cancelled while checking for previously notable domains.");<NEW_LINE>}<NEW_LINE>final String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(attributeType);<NEW_LINE>final String domainFrequencyQuery = " value AS domain_name " + "FROM " + tableName + " " + "WHERE value IN (" + values + ") " + "AND known_status = " + TskData.FileKnown.BAD.getFileKnownValue();<NEW_LINE>final DomainPreviouslyNotableCallback previouslyNotableCallback = new DomainPreviouslyNotableCallback(resultDomainTable);<NEW_LINE>centralRepo.processSelectClause(domainFrequencyQuery, previouslyNotableCallback);<NEW_LINE>if (previouslyNotableCallback.getCause() != null) {<NEW_LINE>throw previouslyNotableCallback.getCause();<NEW_LINE>}<NEW_LINE>} catch (CentralRepoException | SQLException ex) {<NEW_LINE>throw new DiscoveryException("Fatal exception encountered querying the CR.", ex);<NEW_LINE>}<NEW_LINE>} | centralRepo.getCorrelationTypeById(CorrelationAttributeInstance.DOMAIN_TYPE_ID); |
887,106 | public MutablePair<CoreV1Event, V1Patch> observe(CoreV1Event event, String key) {<NEW_LINE>OffsetDateTime now = OffsetDateTime.now();<NEW_LINE>EventLog lastObserved = this.eventCache.getIfPresent(key);<NEW_LINE>V1Patch patch = null;<NEW_LINE>if (lastObserved != null && lastObserved.count != null && lastObserved.count > 0) {<NEW_LINE>event.setCount(lastObserved.count + 1);<NEW_LINE>event.setFirstTimestamp(lastObserved.firstTimestamp);<NEW_LINE>event.getMetadata().setName(lastObserved.name);<NEW_LINE>event.getMetadata().setResourceVersion(lastObserved.resourceVersion);<NEW_LINE>patch = buildEventPatch(event.getCount(), event.getMessage(), now);<NEW_LINE>}<NEW_LINE>EventLog log = new EventLog();<NEW_LINE>log.count = event.getCount();<NEW_LINE>log.firstTimestamp = event.getFirstTimestamp();<NEW_LINE>log.name = event.getMetadata().getName();<NEW_LINE>log.resourceVersion = event.getMetadata().getResourceVersion();<NEW_LINE>this.eventCache.put(key, log);<NEW_LINE>return new <MASK><NEW_LINE>} | MutablePair<>(event, patch); |
1,023,313 | private boolean fixBooleanUsage(MethodNode mth, ITypeBound bound) {<NEW_LINE>ArgType boundType = bound.getType();<NEW_LINE>if (boundType == ArgType.BOOLEAN || (boundType.isTypeKnown() && !boundType.isPrimitive())) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>RegisterArg boundArg = bound.getArg();<NEW_LINE>if (boundArg == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>InsnNode insn = boundArg.getParentInsn();<NEW_LINE>if (insn == null || insn.getType() == InsnType.IF) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>BlockNode blockNode = BlockUtils.getBlockByInsn(mth, insn);<NEW_LINE>if (blockNode == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>List<InsnNode> insnList = blockNode.getInstructions();<NEW_LINE>int insnIndex = InsnList.getIndex(insnList, insn);<NEW_LINE>if (insnIndex == -1) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>InsnType insnType = insn.getType();<NEW_LINE>if (insnType == InsnType.CAST) {<NEW_LINE>// replace cast<NEW_LINE>ArgType type = (ArgType) ((IndexInsnNode) insn).getIndex();<NEW_LINE>TernaryInsn convertInsn = prepareBooleanConvertInsn(insn.getResult(), boundArg, type);<NEW_LINE>BlockUtils.replaceInsn(mth, blockNode, insnIndex, convertInsn);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (insnType == InsnType.ARITH) {<NEW_LINE>ArithNode arithInsn = (ArithNode) insn;<NEW_LINE>if (arithInsn.getOp() == ArithOp.XOR && arithInsn.getArgsCount() == 2) {<NEW_LINE>// replace (boolean ^ 1) with (!boolean)<NEW_LINE>InsnArg <MASK><NEW_LINE>if (secondArg.isLiteral() && ((LiteralArg) secondArg).getLiteral() == 1) {<NEW_LINE>InsnNode convertInsn = notBooleanToInt(arithInsn, boundArg);<NEW_LINE>BlockUtils.replaceInsn(mth, blockNode, insnIndex, convertInsn);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// insert before insn<NEW_LINE>RegisterArg resultArg = boundArg.duplicateWithNewSSAVar(mth);<NEW_LINE>TernaryInsn convertInsn = prepareBooleanConvertInsn(resultArg, boundArg, boundType);<NEW_LINE>insnList.add(insnIndex, convertInsn);<NEW_LINE>insn.replaceArg(boundArg, convertInsn.getResult().duplicate());<NEW_LINE>return true;<NEW_LINE>} | secondArg = arithInsn.getArg(1); |
1,273,324 | public void layout(LayoutContext c, int contentStart) {<NEW_LINE>BlockFormattingContext bfc = new BlockFormattingContext(this, c);<NEW_LINE>c.pushBFC(bfc);<NEW_LINE>addBoxID(c);<NEW_LINE>this.calcDimensions(c);<NEW_LINE>int colCount = getStyle().columnCount();<NEW_LINE>int colGapCount = colCount - 1;<NEW_LINE>float colGap = getStyle().isIdent(CSSName.COLUMN_GAP, IdentValue.NORMAL) ? getStyle().getLineHeight(c) : /* Use the line height as a normal column gap. */<NEW_LINE>getStyle().getFloatPropertyProportionalWidth(CSSName.COLUMN_GAP, getContentWidth(), c);<NEW_LINE>float totalGap = colGap * colGapCount;<NEW_LINE>int colWidth = (int) ((this.getContentWidth() - totalGap) / colCount);<NEW_LINE>_child.setContainingLayer(this.getContainingLayer());<NEW_LINE>_child.setContentWidth(colWidth);<NEW_LINE>_child.setColumnWidth(colWidth);<NEW_LINE>_child.setAbsX(this.getAbsX());<NEW_LINE>_child.<MASK><NEW_LINE>c.setIsPrintOverride(false);<NEW_LINE>_child.layout(c, contentStart);<NEW_LINE>c.setIsPrintOverride(null);<NEW_LINE>int height = adjustUnbalanced(c, _child, (int) colGap, colWidth, colCount, this.getLeftMBP() + this.getX());<NEW_LINE>_child.setHeight(0);<NEW_LINE>this.setHeight(height);<NEW_LINE>c.popBFC();<NEW_LINE>} | setAbsY(this.getAbsY()); |
24,469 | public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) {<NEW_LINE>assert left.getPlatformKind() == right.getPlatformKind() && ((AArch64Kind) left.getPlatformKind()).isInteger();<NEW_LINE>assert trueValue.getPlatformKind() == falseValue.getPlatformKind();<NEW_LINE>((AArch64ArithmeticLIRGenerator) getArithmetic()).emitBinary(AArch64.zr.asValue(LIRKind.combine(left, right)), AArch64ArithmeticOp.TST, true, left, right);<NEW_LINE>Variable result = newVariable(LIRKind.mergeReferenceInformation(trueValue, falseValue));<NEW_LINE>if (isIntConstant(trueValue, 1) && isIntConstant(falseValue, 0)) {<NEW_LINE>append(new CondSetOp(result, ConditionFlag.EQ));<NEW_LINE>} else if (isIntConstant(trueValue, 0) && isIntConstant(falseValue, 1)) {<NEW_LINE>append(new CondSetOp<MASK><NEW_LINE>} else {<NEW_LINE>append(new CondMoveOp(result, ConditionFlag.EQ, asAllocatable(trueValue), asAllocatable(falseValue)));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (result, ConditionFlag.NE)); |
323,326 | public static void main(String[] args) {<NEW_LINE>long sentCount = 10;<NEW_LINE>String groupId = "test_group_id";<NEW_LINE>String streamId = "test_stream_id";<NEW_LINE>String busIp = "127.0.0.1";<NEW_LINE>int busPort = 46802;<NEW_LINE>String attr = "";<NEW_LINE>UdpClientExample demo = new UdpClientExample();<NEW_LINE>Channel channel = demo.initUdpChannel();<NEW_LINE>try {<NEW_LINE>int count = 0;<NEW_LINE>while (count < sentCount) {<NEW_LINE>if (count % 1000 == 0) {<NEW_LINE><MASK><NEW_LINE>long dt = System.currentTimeMillis() / 1000;<NEW_LINE>EncodeObject encodeObject = demo.getEncodeObject(7, false, false, false, dt, seqId, groupId, streamId, attr);<NEW_LINE>ByteBuf buffer = demo.getSendBuf(encodeObject);<NEW_LINE>demo.sendUdpMessage(channel, busIp, busPort, buffer);<NEW_LINE>TimeUnit.SECONDS.sleep(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | long seqId = idGenerator.getNextInt(); |
657,532 | private synchronized void rewriteFile() throws FileNotFoundException, IOException {<NEW_LINE>JsonArrayBuilder jsonToStore = Json.createArrayBuilder();<NEW_LINE>// Iterate through the assets in id order<NEW_LINE>Map<String, JsonObject> assetMap = assets == null ? Collections.<String<MASK><NEW_LINE>for (int i = 1; i < idCounter.get(); i++) {<NEW_LINE>JsonObject json = assetMap.get(Integer.toString(i));<NEW_LINE>if (json == null) {<NEW_LINE>jsonToStore.addNull();<NEW_LINE>} else {<NEW_LINE>jsonToStore.add(json);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Write the assets back to the file<NEW_LINE>Map<String, Object> config = new HashMap<String, Object>();<NEW_LINE>config.put(JsonGenerator.PRETTY_PRINTING, true);<NEW_LINE>JsonWriterFactory writerFactory = Json.createWriterFactory(config);<NEW_LINE>try (FileOutputStream out = new FileOutputStream(file);<NEW_LINE>JsonWriter streamWriter = writerFactory.createWriter(out)) {<NEW_LINE>streamWriter.write(jsonToStore.build());<NEW_LINE>}<NEW_LINE>} | , JsonObject>emptyMap() : assets; |
617,227 | private void initializeMissingQueryFields(Query query) {<NEW_LINE>lazyTrace(query, 7, "Routing to storage cluster ", getStorageClusterRouteSpec());<NEW_LINE>if (route == null) {<NEW_LINE>route = Route.parse(getStorageClusterRouteSpec());<NEW_LINE>}<NEW_LINE>lazyTrace(query, 8, "Route is ", route);<NEW_LINE>lazyTrace(query, 7, "doSearch2(): query docsum class=", query.getPresentation().getSummary(<MASK><NEW_LINE>if (query.getPresentation().getSummary() == null) {<NEW_LINE>lazyTrace(query, 6, "doSearch2(): No summary class specified in query, using default: ", getDefaultDocsumClass());<NEW_LINE>query.getPresentation().setSummary(getDefaultDocsumClass());<NEW_LINE>} else {<NEW_LINE>lazyTrace(query, 6, "doSearch2(): Summary class has been specified in query: ", query.getPresentation().getSummary());<NEW_LINE>}<NEW_LINE>lazyTrace(query, 8, "doSearch2(): rank properties=", query.getRanking());<NEW_LINE>lazyTrace(query, 8, "doSearch2(): sort specification=", query.getRanking().getSorting() == null ? null : query.getRanking().getSorting().fieldOrders());<NEW_LINE>} | ), ", default docsum class=", getDefaultDocsumClass()); |
577,239 | public synchronized boolean replaceDraftPlayer(Player oldPlayer, String name, PlayerType playerType, int skill) {<NEW_LINE>Optional<Player> newPlayerOpt = createPlayer(name, playerType, skill);<NEW_LINE>if (!newPlayerOpt.isPresent() || table.getState() != TableState.DRAFTING) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>TournamentPlayer oldTournamentPlayer = tournament.getPlayer(oldPlayer.getId());<NEW_LINE>tournament.removePlayer(oldPlayer.getId());<NEW_LINE>tournament.addPlayer(newPlayer, playerType);<NEW_LINE>TournamentPlayer newTournamentPlayer = tournament.getPlayer(newPlayer.getId());<NEW_LINE>newTournamentPlayer.setState(oldTournamentPlayer.getState());<NEW_LINE>newTournamentPlayer.setReplacedTournamentPlayer(oldTournamentPlayer);<NEW_LINE>managerFactory.draftManager().getController(table.getId()).ifPresent(controller -> controller.replacePlayer(oldPlayer, newPlayer));<NEW_LINE>return true;<NEW_LINE>} | Player newPlayer = newPlayerOpt.get(); |
1,764,349 | public TypeBinding bind(MethodScope scope, TypeBinding typeBinding, boolean used) {<NEW_LINE>// basically a no-op if createBinding() was called before<NEW_LINE>TypeBinding <MASK><NEW_LINE>// record the resolved type into the type reference<NEW_LINE>Binding existingVariable = scope.getBinding(this.name, Binding.VARIABLE, this, false);<NEW_LINE>if (existingVariable != null && existingVariable.isValidBinding()) {<NEW_LINE>final boolean localExists = existingVariable instanceof LocalVariableBinding;<NEW_LINE>if (localExists && this.hiddenVariableDepth == 0) {<NEW_LINE>if ((this.bits & ASTNode.ShadowsOuterLocal) != 0 && scope.isLambdaSubscope()) {<NEW_LINE>if ((((LocalVariableBinding) existingVariable).modifiers & ExtraCompilerModifiers.AccPatternVariable) != 0) {<NEW_LINE>this.duplicateCheckObligation = (flowInfo) -> {<NEW_LINE>if (flowInfo.isDefinitelyAssigned((LocalVariableBinding) existingVariable)) {<NEW_LINE>scope.problemReporter().lambdaRedeclaresArgument(this);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} else {<NEW_LINE>scope.problemReporter().lambdaRedeclaresArgument(this);<NEW_LINE>}<NEW_LINE>} else if (scope.referenceContext instanceof CompactConstructorDeclaration) {<NEW_LINE>// skip error reporting - hidden params - already reported in record components<NEW_LINE>} else {<NEW_LINE>scope.problemReporter().redefineArgument(this);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>boolean isSpecialArgument = false;<NEW_LINE>if (existingVariable instanceof FieldBinding) {<NEW_LINE>if (scope.isInsideConstructor()) {<NEW_LINE>// constructor argument<NEW_LINE>isSpecialArgument = true;<NEW_LINE>} else {<NEW_LINE>AbstractMethodDeclaration methodDecl = scope.referenceMethod();<NEW_LINE>if (methodDecl != null && CharOperation.prefixEquals(SET, methodDecl.selector)) {<NEW_LINE>// setter argument<NEW_LINE>isSpecialArgument = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>scope.problemReporter().localVariableHiding(this, existingVariable, isSpecialArgument);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>scope.addLocalVariable(this.binding);<NEW_LINE>this.binding.useFlag = used ? LocalVariableBinding.USED : LocalVariableBinding.UNUSED;<NEW_LINE>return newTypeBinding;<NEW_LINE>} | newTypeBinding = createBinding(scope, typeBinding); |
55,184 | private void maybeInitDecoder() throws ExoPlaybackException {<NEW_LINE>if (decoder != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setDecoderDrmSession(sourceDrmSession);<NEW_LINE>CryptoConfig cryptoConfig = null;<NEW_LINE>if (decoderDrmSession != null) {<NEW_LINE>cryptoConfig = decoderDrmSession.getCryptoConfig();<NEW_LINE>if (cryptoConfig == null) {<NEW_LINE>DrmSessionException drmError = decoderDrmSession.getError();<NEW_LINE>if (drmError != null) {<NEW_LINE>// Continue for now. We may be able to avoid failure if a new input format causes the<NEW_LINE>// session to be replaced without it having been used.<NEW_LINE>} else {<NEW_LINE>// The drm session isn't open yet.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>long decoderInitializingTimestamp = SystemClock.elapsedRealtime();<NEW_LINE>decoder = createDecoder(inputFormat, cryptoConfig);<NEW_LINE>setDecoderOutputMode(outputMode);<NEW_LINE>long decoderInitializedTimestamp = SystemClock.elapsedRealtime();<NEW_LINE>eventDispatcher.decoderInitialized(decoder.getName(<MASK><NEW_LINE>decoderCounters.decoderInitCount++;<NEW_LINE>} catch (DecoderException e) {<NEW_LINE>Log.e(TAG, "Video codec error", e);<NEW_LINE>eventDispatcher.videoCodecError(e);<NEW_LINE>throw createRendererException(e, inputFormat, PlaybackException.ERROR_CODE_DECODER_INIT_FAILED);<NEW_LINE>} catch (OutOfMemoryError e) {<NEW_LINE>throw createRendererException(e, inputFormat, PlaybackException.ERROR_CODE_DECODER_INIT_FAILED);<NEW_LINE>}<NEW_LINE>} | ), decoderInitializedTimestamp, decoderInitializedTimestamp - decoderInitializingTimestamp); |
344,209 | public String toSrcPath(String packageName, String basePath) {<NEW_LINE>// FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.<NEW_LINE>packageName = packageName.replace(invokerPackage, "");<NEW_LINE>if (basePath != null && basePath.length() > 0) {<NEW_LINE>// FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.<NEW_LINE>basePath = basePath.replaceAll(<MASK><NEW_LINE>}<NEW_LINE>// Trim prefix file separators from package path<NEW_LINE>String packagePath = // Replace period, backslash, forward slash with file separator in package name<NEW_LINE>StringUtils.// Replace period, backslash, forward slash with file separator in package name<NEW_LINE>removeStart(packageName.replaceAll("[\\.\\\\/]", Matcher.quoteReplacement("/")), File.separator);<NEW_LINE>// Trim trailing file separators from the overall path<NEW_LINE>return StringUtils.removeEnd(basePath + packagePath, File.separator);<NEW_LINE>} | "[\\\\/]?$", "") + File.separator; |
610,634 | protected void initLayout() {<NEW_LINE>ThemeConstants theme = App.getInstance().getThemeConstants();<NEW_LINE>VerticalLayout root = new VerticalLayout();<NEW_LINE>root.setWidthUndefined();<NEW_LINE>root.setSpacing(true);<NEW_LINE>root.setMargin(false);<NEW_LINE>setContent(root);<NEW_LINE>messages = AppBeans.get(Messages.class);<NEW_LINE>nameField = new TextField(messages.getMainMessage("PresentationsEditor.name"));<NEW_LINE>nameField.setWidth(theme.get("cuba.web.PresentationEditor.name.width"));<NEW_LINE>nameField.setValue(getPresentationCaption());<NEW_LINE>root.addComponent(nameField);<NEW_LINE>autoSaveField = new CheckBox();<NEW_LINE>autoSaveField.setCaption(messages.getMainMessage("PresentationsEditor.autoSave"));<NEW_LINE>autoSaveField.setValue(BooleanUtils.isTrue<MASK><NEW_LINE>root.addComponent(autoSaveField);<NEW_LINE>defaultField = new CheckBox();<NEW_LINE>defaultField.setCaption(messages.getMainMessage("PresentationsEditor.default"));<NEW_LINE>defaultField.setValue(presentation.getId().equals(component.getDefaultPresentationId()));<NEW_LINE>root.addComponent(defaultField);<NEW_LINE>if (allowGlobalPresentations) {<NEW_LINE>globalField = new CheckBox();<NEW_LINE>globalField.setCaption(messages.getMainMessage("PresentationsEditor.global"));<NEW_LINE>globalField.setValue(!isNew && presentation.getUser() == null);<NEW_LINE>root.addComponent(globalField);<NEW_LINE>}<NEW_LINE>HorizontalLayout buttons = new HorizontalLayout();<NEW_LINE>buttons.setMargin(false);<NEW_LINE>buttons.setSpacing(true);<NEW_LINE>buttons.setWidthUndefined();<NEW_LINE>root.addComponent(buttons);<NEW_LINE>root.setComponentAlignment(buttons, Alignment.MIDDLE_LEFT);<NEW_LINE>Button commitButton = new CubaButton(messages.getMainMessage("PresentationsEditor.save"));<NEW_LINE>commitButton.addClickListener(event -> {<NEW_LINE>if (validate()) {<NEW_LINE>commit();<NEW_LINE>forceClose();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>buttons.addComponent(commitButton);<NEW_LINE>Button closeButton = new CubaButton(messages.getMainMessage("PresentationsEditor.close"));<NEW_LINE>closeButton.addClickListener(event -> forceClose());<NEW_LINE>buttons.addComponent(closeButton);<NEW_LINE>nameField.focus();<NEW_LINE>} | (presentation.getAutoSave())); |
414,951 | public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode mode, boolean ignorePassableBlocks) {<NEW_LINE>Validate.notNull(start, "Start location equals null");<NEW_LINE>Validate.isTrue(this.equals(start.getWorld()), "Start location a different world");<NEW_LINE>start.checkFinite();<NEW_LINE><MASK><NEW_LINE>direction.checkFinite();<NEW_LINE>Validate.isTrue(direction.lengthSquared() > 0, "Direction's magnitude is 0");<NEW_LINE>Validate.notNull(mode, "mode equals null");<NEW_LINE>if (maxDistance < 0.0D)<NEW_LINE>return null;<NEW_LINE>Vector dir = direction.clone().normalize().multiply(maxDistance);<NEW_LINE>Vec3d startPos = new Vec3d(start.getX(), start.getY(), start.getZ());<NEW_LINE>Vec3d endPos = new Vec3d(start.getX() + dir.getX(), start.getY() + dir.getY(), start.getZ() + dir.getZ());<NEW_LINE>HitResult nmsHitResult = this.getHandle().raycast(new RaycastContext(startPos, endPos, ignorePassableBlocks ? RaycastContext.ShapeType.COLLIDER : RaycastContext.ShapeType.OUTLINE, CardboardFluidRaytraceMode.toMc(mode), null));<NEW_LINE>return CardboardRayTraceResult.fromNMS(this, nmsHitResult);<NEW_LINE>} | Validate.notNull(direction, "Direction equals null"); |
1,664,375 | private static Certificate loadCertificate(File f) {<NEW_LINE>X509Certificate cert = null;<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO, "Loading SSL certificate from PEM file: " + f.getAbsolutePath()));<NEW_LINE>try {<NEW_LINE>byte<MASK><NEW_LINE>byte[] certBytes = parseDERFromPEM(fileBuf, "-----BEGIN CERTIFICATE-----", "-----END CERTIFICATE-----");<NEW_LINE>cert = generateCertificateFromDER(certBytes);<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO, "SSL certificate loaded successfully"));<NEW_LINE>} catch (IOException e) {<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_ERROR, "Reading certificate file failed: " + e.getClass().getSimpleName() + ": " + e.getMessage()));<NEW_LINE>} catch (CertificateException e) {<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_ERROR, "Certificate generation failed: " + e.getClass().getSimpleName() + ": " + e.getMessage()));<NEW_LINE>}<NEW_LINE>return cert;<NEW_LINE>} | [] fileBuf = fileToBytes(f); |
1,752,938 | public List<byte[]> convert(List<float[]> audioPackets) {<NEW_LINE>List<byte[]> converted = new ArrayList<>();<NEW_LINE>if (mResampler != null) {<NEW_LINE>audioPackets = mResampler.resample(audioPackets);<NEW_LINE>}<NEW_LINE>for (int x = 0; x < audioPackets.size(); x++) {<NEW_LINE>byte[] bytesToEncode = null;<NEW_LINE>if (mInputAudioFormat.getAudioFormat().getSampleSizeInBits() == 16) {<NEW_LINE>bytesToEncode = ConversionUtils.convertToSigned16BitSamples(audioPackets.get(x)).array();<NEW_LINE>} else {<NEW_LINE>bytesToEncode = ConversionUtils.convertToSigned32BitSamples(audioPackets.get(x)).array();<NEW_LINE>}<NEW_LINE>int bytesToEncodePointer = 0;<NEW_LINE>int inputChunkSize = FastMath.min(mOutputFramesBuffer.length, bytesToEncode.length);<NEW_LINE>int outputChunkSize = 0;<NEW_LINE>try {<NEW_LINE>while (bytesToEncodePointer < bytesToEncode.length) {<NEW_LINE>outputChunkSize = mEncoder.encodeBuffer(bytesToEncode, bytesToEncodePointer, inputChunkSize, mOutputFramesBuffer);<NEW_LINE>bytesToEncodePointer += inputChunkSize;<NEW_LINE>inputChunkSize = FastMath.min(mOutputFramesBuffer.length, bytesToEncode.length - bytesToEncodePointer);<NEW_LINE>if (outputChunkSize > 0) {<NEW_LINE>converted.add(Arrays.copyOf(mOutputFramesBuffer, outputChunkSize));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>mLog.error("There was an error converting audio to MP3: " + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int <MASK><NEW_LINE>if (finalChunkSize > 0) {<NEW_LINE>converted.add(Arrays.copyOf(mOutputFramesBuffer, finalChunkSize));<NEW_LINE>}<NEW_LINE>return converted;<NEW_LINE>} | finalChunkSize = mEncoder.encodeFinish(mOutputFramesBuffer); |
1,806,465 | public static void openEditorForReblog(Activity activity, @Nullable SiteModel site, @Nullable ReaderPost post, PagePostCreationSourcesDetail reblogSource) {<NEW_LINE>if (post == null) {<NEW_LINE>ToastUtils.showToast(activity, R.string.post_not_found, ToastUtils.Duration.SHORT);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (site == null) {<NEW_LINE>ToastUtils.showToast(activity, R.string.blog_not_found, ToastUtils.Duration.SHORT);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AnalyticsUtils.trackWithReblogDetails(reblogSource == PagePostCreationSourcesDetail.POST_FROM_REBLOG ? READER_ARTICLE_REBLOGGED : READER_ARTICLE_DETAIL_REBLOGGED, post.blogId, post.postId, site.getSiteId());<NEW_LINE>Intent editorIntent = new Intent(activity, EditPostActivity.class);<NEW_LINE>editorIntent.putExtra(EditPostActivity.<MASK><NEW_LINE>editorIntent.putExtra(EditPostActivity.EXTRA_REBLOG_POST_QUOTE, post.getExcerpt());<NEW_LINE>editorIntent.putExtra(EditPostActivity.EXTRA_REBLOG_POST_IMAGE, post.getFeaturedImage());<NEW_LINE>editorIntent.putExtra(EditPostActivity.EXTRA_REBLOG_POST_CITATION, post.getUrl());<NEW_LINE>editorIntent.setAction(EditPostActivity.ACTION_REBLOG);<NEW_LINE>addNewPostForResult(editorIntent, activity, site, false, reblogSource);<NEW_LINE>} | EXTRA_REBLOG_POST_TITLE, post.getTitle()); |
747,162 | final PutEmailIdentityDkimSigningAttributesResult executePutEmailIdentityDkimSigningAttributes(PutEmailIdentityDkimSigningAttributesRequest putEmailIdentityDkimSigningAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putEmailIdentityDkimSigningAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutEmailIdentityDkimSigningAttributesRequest> request = null;<NEW_LINE>Response<PutEmailIdentityDkimSigningAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutEmailIdentityDkimSigningAttributesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putEmailIdentityDkimSigningAttributesRequest));<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, "SESv2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutEmailIdentityDkimSigningAttributesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutEmailIdentityDkimSigningAttributesResultJsonUnmarshaller());<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>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutEmailIdentityDkimSigningAttributes"); |
1,223,854 | public Observable<ServiceResponse<TrendingImages>> trendingWithServiceResponseAsync(TrendingOptionalParameter trendingOptionalParameter) {<NEW_LINE>final String acceptLanguage = trendingOptionalParameter != null ? trendingOptionalParameter.acceptLanguage() : null;<NEW_LINE>final String userAgent = trendingOptionalParameter != null ? trendingOptionalParameter.userAgent() : this.client.userAgent();<NEW_LINE>final String clientId = trendingOptionalParameter != null ? trendingOptionalParameter.clientId() : null;<NEW_LINE>final String clientIp = trendingOptionalParameter != null ? trendingOptionalParameter.clientIp() : null;<NEW_LINE>final String location = trendingOptionalParameter != null ? trendingOptionalParameter.location() : null;<NEW_LINE>final String countryCode = trendingOptionalParameter != null ? trendingOptionalParameter.countryCode() : null;<NEW_LINE>final String market = trendingOptionalParameter != null ? trendingOptionalParameter.market() : null;<NEW_LINE>final SafeSearch safeSearch = trendingOptionalParameter != null <MASK><NEW_LINE>final String setLang = trendingOptionalParameter != null ? trendingOptionalParameter.setLang() : null;<NEW_LINE>return trendingWithServiceResponseAsync(acceptLanguage, userAgent, clientId, clientIp, location, countryCode, market, safeSearch, setLang);<NEW_LINE>} | ? trendingOptionalParameter.safeSearch() : null; |
32,935 | // @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })<NEW_LINE>@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })<NEW_LINE>public Response update(@HeaderParam(Constants.SESSION_TOKEN_HEADER_NAME) String sessionToken, @PathParam("entityClass") String entityClassName, String input, @Context HttpHeaders headers) {<NEW_LINE>sessionToken = <MASK><NEW_LINE>input = input.replaceAll("^\"|\"$", "");<NEW_LINE>log.debug("PUT: sessionToken:" + sessionToken);<NEW_LINE>log.debug("PUT: entityClassName:" + entityClassName);<NEW_LINE>String mediaType = headers != null && headers.getRequestHeaders().containsKey("Content-type") ? headers.getRequestHeader("Content-type").get(0) : MediaType.APPLICATION_JSON;<NEW_LINE>mediaType = mediaType.equalsIgnoreCase(MediaType.APPLICATION_XML) ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON;<NEW_LINE>log.debug("POST: Media Type:" + mediaType);<NEW_LINE>Object output;<NEW_LINE>Class<?> entityClass;<NEW_LINE>Object entity;<NEW_LINE>EntityMetadata entityMetadata = null;<NEW_LINE>try {<NEW_LINE>EntityManager em = EMRepository.INSTANCE.getEM(sessionToken);<NEW_LINE>entityClass = EntityUtils.getEntityClass(entityClassName, em);<NEW_LINE>log.debug("PUT: entityClass: " + entityClass);<NEW_LINE>entityMetadata = EntityUtils.getEntityMetaData(entityClass.getSimpleName(), em);<NEW_LINE>entity = JAXBUtils.toObject(input, entityClass, mediaType);<NEW_LINE>output = em.merge(entity);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(e.getMessage());<NEW_LINE>return Response.serverError().build();<NEW_LINE>}<NEW_LINE>if (output == null) {<NEW_LINE>return Response.notModified().build();<NEW_LINE>}<NEW_LINE>output = JAXBUtils.toString(output, mediaType);<NEW_LINE>if (mediaType.equalsIgnoreCase(MediaType.APPLICATION_JSON)) {<NEW_LINE>return Response.ok(ResponseBuilder.buildOutput(entityClass, entityMetadata, output), mediaType).build();<NEW_LINE>} else {<NEW_LINE>return Response.ok(output.toString(), mediaType).build();<NEW_LINE>}<NEW_LINE>} | sessionToken.replaceAll("^\"|\"$", ""); |
1,499,136 | public void valueChanged(ListSelectionEvent e) {<NEW_LINE>if (e.getValueIsAdjusting()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean singleSelection = table.getSelectedRowCount() == 1;<NEW_LINE>boolean selected = table.getSelectedRow() > -1;<NEW_LINE>if (singleSelection) {<NEW_LINE>RepositoryModel repository = getSelectedRepositories().get(0);<NEW_LINE>browseRepository.setEnabled(repository.hasCommits);<NEW_LINE>logRepository.setEnabled(repository.hasCommits);<NEW_LINE>searchRepository.setEnabled(repository.hasCommits);<NEW_LINE>subscribeRepository.setEnabled(repository.hasCommits);<NEW_LINE>} else {<NEW_LINE>browseRepository.setEnabled(false);<NEW_LINE>logRepository.setEnabled(false);<NEW_LINE>searchRepository.setEnabled(false);<NEW_LINE>subscribeRepository.setEnabled(false);<NEW_LINE>}<NEW_LINE>delRepository.setEnabled(selected);<NEW_LINE>if (selected) {<NEW_LINE>int viewRow = table.getSelectedRow();<NEW_LINE>int <MASK><NEW_LINE>RepositoryModel model = ((RepositoriesTableModel) table.getModel()).list.get(modelRow);<NEW_LINE>editRepository.setEnabled(singleSelection && (gitblit.allowManagement() || gitblit.isOwner(model)));<NEW_LINE>} else {<NEW_LINE>editRepository.setEnabled(false);<NEW_LINE>}<NEW_LINE>} | modelRow = table.convertRowIndexToModel(viewRow); |
511,129 | private Comparator<DataSource> byPidComparator() {<NEW_LINE>return new Comparator<DataSource>() {<NEW_LINE><NEW_LINE>public int compare(DataSource d1, DataSource d2) {<NEW_LINE>if (isFinishedAtBottom()) {<NEW_LINE>int ret = checkUnavailable(d1, d2);<NEW_LINE>if (ret != 0)<NEW_LINE>return ret;<NEW_LINE>}<NEW_LINE>boolean d1app = d1 instanceof Application;<NEW_LINE>boolean d2app = d2 instanceof Application;<NEW_LINE>if (!d1app && !d2app)<NEW_LINE>return BY_NAME_COMPARATOR.compare(d1, d2);<NEW_LINE>else if (!d1app)<NEW_LINE>return 1;<NEW_LINE>else if (!d2app)<NEW_LINE>return -1;<NEW_LINE>int d1pid = ((Application) d1).getPid();<NEW_LINE>if (d1pid == Application.UNKNOWN_PID)<NEW_LINE>d1pid = Integer.MAX_VALUE;<NEW_LINE>int d2pid = ((Application) d2).getPid();<NEW_LINE>if (d2pid == Application.UNKNOWN_PID)<NEW_LINE>d2pid = Integer.MAX_VALUE;<NEW_LINE>if (d1pid == d2pid)<NEW_LINE>return <MASK><NEW_LINE>else if (d1pid > d2pid)<NEW_LINE>return 1;<NEW_LINE>else<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | BY_NAME_COMPARATOR.compare(d1, d2); |
1,223,228 | private File createLayoutMap() throws TOTorrentException {<NEW_LINE>// create a directory/file hierarchy that mirrors that prescribed by the descriptor<NEW_LINE>// along with a linkage map to be applied during construction<NEW_LINE>if (descriptor_dir != null) {<NEW_LINE>return (descriptor_dir);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>descriptor_dir = AETemporaryFileHandler.createTempDir();<NEW_LINE>File top_level_file = null;<NEW_LINE>List<DescEntry> desc_entries = readDescriptor();<NEW_LINE>for (DescEntry entry : desc_entries) {<NEW_LINE>List<String> logical_path = entry.getLogicalPath();<NEW_LINE>File target = entry.getTarget();<NEW_LINE>File temp = descriptor_dir;<NEW_LINE>int prefix_length = descriptor_dir.getAbsolutePath().length() + 1;<NEW_LINE>for (int i = 0; i < logical_path.size(); i++) {<NEW_LINE>temp = FileUtil.newFile(temp, logical_path.get(i));<NEW_LINE>if (top_level_file == null) {<NEW_LINE>top_level_file = temp;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (target.isDirectory()) {<NEW_LINE>if (!temp.isDirectory()) {<NEW_LINE>if (!temp.mkdirs()) {<NEW_LINE>throw (new TOTorrentException("Failed to create logical directory: " + temp, TOTorrentException.RT_WRITE_FAILS));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mapDirectory(prefix_length, target, temp);<NEW_LINE>} else {<NEW_LINE>File p = temp.getParentFile();<NEW_LINE>if (!p.isDirectory()) {<NEW_LINE>if (!p.mkdirs()) {<NEW_LINE>throw (new TOTorrentException("Failed to create logical directory: " + p, TOTorrentException.RT_WRITE_FAILS));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (temp.exists()) {<NEW_LINE>throw (new TOTorrentException("Duplicate file: " <MASK><NEW_LINE>} else {<NEW_LINE>temp.createNewFile();<NEW_LINE>linkage_map.put(temp.getAbsolutePath().substring(prefix_length), target);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (top_level_file);<NEW_LINE>} catch (TOTorrentException e) {<NEW_LINE>throw (e);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw (new TOTorrentException(Debug.getNestedExceptionMessage(e), TOTorrentException.RT_WRITE_FAILS));<NEW_LINE>}<NEW_LINE>} | + temp, TOTorrentException.RT_WRITE_FAILS)); |
339,802 | public INDArray doForward(boolean training, LayerWorkspaceMgr workspaceMgr) {<NEW_LINE>if (!canDoForward())<NEW_LINE>throw new IllegalStateException("Cannot do forward pass: inputs not set (L2NormalizeVertex " + vertexName + " idx " + vertexIndex + ")");<NEW_LINE>// L2 norm along all dimensions except 0, unless user-specified<NEW_LINE>// x / |x|2<NEW_LINE>INDArray x = inputs[0];<NEW_LINE>int[] dimensions = getDimensions(x);<NEW_LINE>INDArray xNorm2 = x.norm2(true, dimensions);<NEW_LINE>Transforms.<MASK><NEW_LINE>try (MemoryWorkspace ws = workspaceMgr.notifyScopeBorrowed(ArrayType.ACTIVATIONS)) {<NEW_LINE>if (x.rank() == 2) {<NEW_LINE>return x.divColumnVector(xNorm2);<NEW_LINE>} else {<NEW_LINE>INDArray out = Nd4j.createUninitialized(x.shape(), x.ordering());<NEW_LINE>return Nd4j.getExecutioner().exec(new BroadcastDivOp(x, xNorm2, out, 0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | max(xNorm2, eps, false); |
1,238,052 | protected void markStreamsAsUsedInternal(Transaction t, final Map<Long, byte[]> streamIdsToReference) {<NEW_LINE>if (streamIdsToReference.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>UserPhotosStreamIdxTable index = tables.getUserPhotosStreamIdxTable(t);<NEW_LINE>Multimap<UserPhotosStreamIdxTable.UserPhotosStreamIdxRow, UserPhotosStreamIdxTable.UserPhotosStreamIdxColumnValue> rowsToValues = HashMultimap.create();<NEW_LINE>for (Map.Entry<Long, byte[]> entry : streamIdsToReference.entrySet()) {<NEW_LINE>Long streamId = entry.getKey();<NEW_LINE>byte[<MASK><NEW_LINE>UserPhotosStreamIdxTable.UserPhotosStreamIdxColumn col = UserPhotosStreamIdxTable.UserPhotosStreamIdxColumn.of(reference);<NEW_LINE>UserPhotosStreamIdxTable.UserPhotosStreamIdxColumnValue value = UserPhotosStreamIdxTable.UserPhotosStreamIdxColumnValue.of(col, 0L);<NEW_LINE>rowsToValues.put(UserPhotosStreamIdxTable.UserPhotosStreamIdxRow.of(streamId), value);<NEW_LINE>}<NEW_LINE>index.put(rowsToValues);<NEW_LINE>} | ] reference = entry.getValue(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.