idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
989,294 | private static double calculateSNegative(double eps, double targetDelta, double initSInf, double initSSup) {<NEW_LINE>double deltaSup = calculateBNegative(eps, initSSup);<NEW_LINE>double sInf = initSInf;<NEW_LINE>double sSup = initSSup;<NEW_LINE>while (deltaSup > targetDelta) {<NEW_LINE>sInf = sSup;<NEW_LINE>sSup = 2 * sInf;<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>double sMid = sInf + (sSup - sInf) / 2.0;<NEW_LINE>int iterMax = 1000;<NEW_LINE>int iters = 0;<NEW_LINE>while (true) {<NEW_LINE>double bNegative = calculateBNegative(eps, sMid);<NEW_LINE>if (bNegative <= targetDelta) {<NEW_LINE>if (targetDelta - bNegative <= deltaError) {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>sSup = sMid;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sInf = sMid;<NEW_LINE>}<NEW_LINE>sMid = sInf + (sSup - sInf) / 2.0;<NEW_LINE>iters += 1;<NEW_LINE>if (iters > iterMax) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sMid;<NEW_LINE>} | deltaSup = calculateBNegative(eps, sSup); |
334,502 | public void read(org.apache.thrift.protocol.TProtocol iprot, Manifest struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // KEY<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {<NEW_LINE>struct.key = iprot.readString();<NEW_LINE>struct.setKeyIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // VALUES<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {<NEW_LINE>{<NEW_LINE>org.apache.thrift.protocol.TList _list98 = iprot.readListBegin();<NEW_LINE>struct.values = new java.util.ArrayList<java.nio.ByteBuffer>(_list98.size);<NEW_LINE>@org.apache.thrift.annotation.Nullable<NEW_LINE>java.nio.ByteBuffer _elem99;<NEW_LINE>for (int _i100 = 0; _i100 < _list98.size; ++_i100) {<NEW_LINE>_elem99 = iprot.readBinary();<NEW_LINE>struct.values.add(_elem99);<NEW_LINE>}<NEW_LINE>iprot.readListEnd();<NEW_LINE>}<NEW_LINE>struct.setValuesIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>} | skip(iprot, schemeField.type); |
342,764 | private static void outputIndex(CompilationDescription indexInfo, String[] args) throws IOException {<NEW_LINE>String outputFile = System.getenv("KYTHE_OUTPUT_FILE");<NEW_LINE>if (!Strings.isNullOrEmpty(outputFile)) {<NEW_LINE>if (outputFile.endsWith(IndexInfoUtils.KZIP_FILE_EXT)) {<NEW_LINE>IndexInfoUtils.writeKzipToFile(indexInfo, outputFile);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException(String.format("Unsupported output file: %s%n", outputFile));<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>if (Strings.isNullOrEmpty(outputDir)) {<NEW_LINE>throw new IllegalArgumentException("required KYTHE_OUTPUT_FILE or KYTHE_OUTPUT_DIRECTORY environment variable is unset");<NEW_LINE>}<NEW_LINE>String name = Hashing.sha256().hashUnencodedChars(Joiner.on(" ").join(args)).toString();<NEW_LINE>String path = IndexInfoUtils.getKzipPath(outputDir, name).toString();<NEW_LINE>IndexInfoUtils.writeKzipToFile(indexInfo, path);<NEW_LINE>} | outputDir = System.getenv("KYTHE_OUTPUT_DIRECTORY"); |
80,845 | public SQLExternalRecordFormat parseRowFormat() {<NEW_LINE>lexer.nextToken();<NEW_LINE>acceptIdentifier("FORMAT");<NEW_LINE>if (lexer.identifierEquals(FnvHash.Constants.DELIMITED)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>}<NEW_LINE>SQLExternalRecordFormat format = new SQLExternalRecordFormat();<NEW_LINE>if (lexer.identifierEquals(FnvHash.Constants.FIELDS)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>acceptIdentifier("TERMINATED");<NEW_LINE>accept(Token.BY);<NEW_LINE>format.setTerminatedBy(this.expr());<NEW_LINE>} else if (lexer.identifierEquals("FIELD")) {<NEW_LINE>throw new ParserException("syntax error, expect FIELDS, " + lexer.info());<NEW_LINE>}<NEW_LINE>if (lexer.identifierEquals(FnvHash.Constants.LINES)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>acceptIdentifier("TERMINATED");<NEW_LINE>accept(Token.BY);<NEW_LINE>format.setLinesTerminatedBy(this.expr());<NEW_LINE>}<NEW_LINE>if (lexer.token() == Token.ESCAPE || lexer.identifierEquals(FnvHash.Constants.ESCAPED)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>accept(Token.BY);<NEW_LINE>format.<MASK><NEW_LINE>}<NEW_LINE>if (lexer.identifierEquals(FnvHash.Constants.COLLECTION)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>acceptIdentifier("ITEMS");<NEW_LINE>acceptIdentifier("TERMINATED");<NEW_LINE>accept(Token.BY);<NEW_LINE>format.setCollectionItemsTerminatedBy(this.expr());<NEW_LINE>}<NEW_LINE>if (lexer.identifierEquals(FnvHash.Constants.MAP)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>acceptIdentifier("KEYS");<NEW_LINE>acceptIdentifier("TERMINATED");<NEW_LINE>accept(Token.BY);<NEW_LINE>format.setMapKeysTerminatedBy(this.expr());<NEW_LINE>}<NEW_LINE>if (lexer.identifierEquals(FnvHash.Constants.SERDE)) {<NEW_LINE>lexer.nextToken();<NEW_LINE>format.setSerde(this.expr());<NEW_LINE>}<NEW_LINE>return format;<NEW_LINE>} | setEscapedBy(this.expr()); |
1,685,269 | private static BgpAdvertisementGroup create(@JsonProperty(PROP_AS_PATH) @Nullable AsPath asPath, @JsonProperty(PROP_DESCRIPTION) @Nullable String description, @JsonProperty(PROP_EXTENDED_COMMUNITIES) @Nullable Set<ExtendedCommunity> extendedCommunities, @JsonProperty(PROP_LOCAL_PREFERENCE) @Nullable Long localPreference, @JsonProperty(PROP_MED) @Nullable Long med, @JsonProperty(PROP_ORIGINATOR) @Nullable Ip originator, @JsonProperty(PROP_ORIGIN_TYPE) @Nullable OriginType originType, @JsonProperty(PROP_PREFIXES) @Nullable Set<Prefix> prefixes, @JsonProperty(PROP_RX_PEER) @Nullable Ip rxPeer, @JsonProperty(PROP_STANDARD_COMMUNITIES) @Nullable Set<Long> standardCommunities, @JsonProperty(PROP_TX_AS) @Nullable Long txAs, @JsonProperty(PROP_TX_PEER) @Nullable Ip txPeer) {<NEW_LINE>checkArgument(asPath != null, "Missing %s", PROP_AS_PATH);<NEW_LINE>checkArgument(localPreference == null || (localPreference >= 0 && localPreference <= MAX_LOCAL_PREFERENCE), "%s must be between 0 and %s", PROP_LOCAL_PREFERENCE, MAX_LOCAL_PREFERENCE);<NEW_LINE>checkArgument(med == null || (med >= 0 && med <= MAX_MED<MASK><NEW_LINE>checkArgument(prefixes != null && !prefixes.isEmpty(), "%s must be nonempty", PROP_PREFIXES);<NEW_LINE>checkArgument(rxPeer != null, "Missing %s", PROP_RX_PEER);<NEW_LINE>checkArgument(txAs == null || (txAs > 0 && txAs <= MAX_AS_NUMBER), "%s must be either null or a number between 1 and %s", PROP_TX_AS, MAX_AS_NUMBER);<NEW_LINE>checkArgument(txPeer != null, "Missing %s", PROP_TX_PEER);<NEW_LINE>return new BgpAdvertisementGroup(asPath, firstNonNull(description, ""), ImmutableSet.copyOf(firstNonNull(extendedCommunities, ImmutableSet.of())), firstNonNull(localPreference, DEFAULT_LOCAL_PREFERENCE), firstNonNull(med, DEFAULT_MED), firstNonNull(originator, txPeer), firstNonNull(originType, DEFAULT_ORIGIN_TYPE), ImmutableSet.copyOf(prefixes), rxPeer, ImmutableSet.copyOf(firstNonNull(standardCommunities, ImmutableSet.of())), txAs, txPeer);<NEW_LINE>} | ), "%s must be between 0 and %s", PROP_MED, MAX_MED); |
1,091,667 | final DescribeOrderableDBInstanceOptionsResult executeDescribeOrderableDBInstanceOptions(DescribeOrderableDBInstanceOptionsRequest describeOrderableDBInstanceOptionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeOrderableDBInstanceOptionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeOrderableDBInstanceOptionsRequest> request = null;<NEW_LINE>Response<DescribeOrderableDBInstanceOptionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeOrderableDBInstanceOptionsRequestMarshaller().marshall(super.beforeMarshalling(describeOrderableDBInstanceOptionsRequest));<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, "Neptune");<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>StaxResponseHandler<DescribeOrderableDBInstanceOptionsResult> responseHandler = new StaxResponseHandler<DescribeOrderableDBInstanceOptionsResult>(new DescribeOrderableDBInstanceOptionsResultStaxUnmarshaller());<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, "DescribeOrderableDBInstanceOptions"); |
548,135 | protected void readSetXCursor(int width, int height, Point hotspot) {<NEW_LINE>byte pr, pg, pb;<NEW_LINE>byte sr, sg, sb;<NEW_LINE>int data_len = ((width + 7) / 8) * height;<NEW_LINE>int mask_len = ((width + 7) / 8) * height;<NEW_LINE>ByteBuffer data = ByteBuffer.allocate(data_len);<NEW_LINE>ByteBuffer mask = ByteBuffer.allocate(mask_len);<NEW_LINE>int x, y;<NEW_LINE>byte[] buf = new byte[width * height * 4];<NEW_LINE>ByteBuffer out;<NEW_LINE>if (width * height == 0)<NEW_LINE>return;<NEW_LINE>pr = (byte) is.readU8();<NEW_LINE>pg = (byte) is.readU8();<NEW_LINE>pb = (byte) is.readU8();<NEW_LINE>sr = (byte) is.readU8();<NEW_LINE>sg = (byte) is.readU8();<NEW_LINE>sb = (byte) is.readU8();<NEW_LINE>is.readBytes(data, data_len);<NEW_LINE>is.readBytes(mask, mask_len);<NEW_LINE>int maskBytesPerRow = (width + 7) / 8;<NEW_LINE>out = ByteBuffer.wrap(buf);<NEW_LINE>for (y = 0; y < height; y++) {<NEW_LINE>for (x = 0; x < width; x++) {<NEW_LINE>int byte_ = y * maskBytesPerRow + x / 8;<NEW_LINE>int bit = 7 - x % 8;<NEW_LINE>// NOTE: BufferedImage needs ARGB, rather than RGBA<NEW_LINE>if ((mask.get(byte_) & (1 << bit)) > 0)<NEW_LINE>out.put(out.position(), (byte) 255);<NEW_LINE>else<NEW_LINE>out.put(out.position(), (byte) 0);<NEW_LINE>if ((data.get(byte_) & (1 << bit)) > 0) {<NEW_LINE>out.put(out.position() + 1, pr);<NEW_LINE>out.put(out.<MASK><NEW_LINE>out.put(out.position() + 3, pb);<NEW_LINE>} else {<NEW_LINE>out.put(out.position() + 1, sr);<NEW_LINE>out.put(out.position() + 2, sg);<NEW_LINE>out.put(out.position() + 3, sb);<NEW_LINE>}<NEW_LINE>out.position(out.position() + 4);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>handler.setCursor(width, height, hotspot, buf);<NEW_LINE>} | position() + 2, pg); |
244,108 | private void validateParamValue(Param param, String currentParamValue, String inputValue) throws ParamValidationException {<NEW_LINE>try {<NEW_LINE>Coin currentParamValueAsCoin, inputValueAsCoin;<NEW_LINE>switch(param.getParamType()) {<NEW_LINE>case UNDEFINED:<NEW_LINE>break;<NEW_LINE>case BSQ:<NEW_LINE>currentParamValueAsCoin = daoStateService.getParamValueAsCoin(param, currentParamValue);<NEW_LINE>inputValueAsCoin = <MASK><NEW_LINE>validateBsqValue(currentParamValueAsCoin, inputValueAsCoin, param);<NEW_LINE>break;<NEW_LINE>case BTC:<NEW_LINE>currentParamValueAsCoin = daoStateService.getParamValueAsCoin(param, currentParamValue);<NEW_LINE>inputValueAsCoin = daoStateService.getParamValueAsCoin(param, inputValue);<NEW_LINE>validateBtcValue(currentParamValueAsCoin, inputValueAsCoin, param);<NEW_LINE>break;<NEW_LINE>case PERCENT:<NEW_LINE>double currentParamValueAsPercentDouble = daoStateService.getParamValueAsPercentDouble(currentParamValue);<NEW_LINE>double inputValueAsPercentDouble = daoStateService.getParamValueAsPercentDouble(inputValue);<NEW_LINE>validatePercentValue(currentParamValueAsPercentDouble, inputValueAsPercentDouble, param);<NEW_LINE>break;<NEW_LINE>case BLOCK:<NEW_LINE>int currentParamValueAsBlock = daoStateService.getParamValueAsBlock(currentParamValue);<NEW_LINE>int inputValueAsBlock = daoStateService.getParamValueAsBlock(inputValue);<NEW_LINE>validateBlockValue(currentParamValueAsBlock, inputValueAsBlock, param);<NEW_LINE>break;<NEW_LINE>case ADDRESS:<NEW_LINE>validateAddressValue(currentParamValue, inputValue);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>log.warn("Param type {} not handled in switch case at validateParamValue", param.getParamType());<NEW_LINE>}<NEW_LINE>} catch (ParamValidationException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (NumberFormatException t) {<NEW_LINE>throw new ParamValidationException(Res.get("validation.numberFormatException", t.getMessage().toLowerCase()));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new ParamValidationException(t);<NEW_LINE>}<NEW_LINE>} | daoStateService.getParamValueAsCoin(param, inputValue); |
1,573,001 | public static void main(String[] args) {<NEW_LINE>Exercise41_OddLengthDirectedCycle oddLengthDirectedCycle = new Exercise41_OddLengthDirectedCycle();<NEW_LINE>Digraph digraph1 = new Digraph(4);<NEW_LINE>digraph1.addEdge(0, 1);<NEW_LINE>digraph1.addEdge(1, 2);<NEW_LINE>digraph1.addEdge(2, 3);<NEW_LINE>digraph1.addEdge(3, 0);<NEW_LINE>StdOut.println("Has odd length directed cycle: " + oddLengthDirectedCycle.hasOddLengthDirectedCycle(digraph1) + " Expected: false");<NEW_LINE>Digraph digraph2 = new Digraph(5);<NEW_LINE>digraph2.addEdge(0, 1);<NEW_LINE>digraph2.addEdge(1, 2);<NEW_LINE>digraph2.addEdge(2, 0);<NEW_LINE>digraph2.addEdge(3, 4);<NEW_LINE>StdOut.println("Has odd length directed cycle: " + oddLengthDirectedCycle.hasOddLengthDirectedCycle(digraph2) + " Expected: true");<NEW_LINE>Digraph digraph3 = new Digraph(10);<NEW_LINE>digraph3.addEdge(0, 1);<NEW_LINE>digraph3.addEdge(1, 2);<NEW_LINE>digraph3.addEdge(3, 4);<NEW_LINE><MASK><NEW_LINE>digraph3.addEdge(6, 8);<NEW_LINE>digraph3.addEdge(8, 5);<NEW_LINE>digraph3.addEdge(5, 9);<NEW_LINE>digraph3.addEdge(9, 4);<NEW_LINE>digraph3.addEdge(7, 0);<NEW_LINE>StdOut.println("Has odd length directed cycle: " + oddLengthDirectedCycle.hasOddLengthDirectedCycle(digraph3) + " Expected: true");<NEW_LINE>Digraph digraph4 = new Digraph(5);<NEW_LINE>digraph4.addEdge(0, 1);<NEW_LINE>digraph4.addEdge(1, 0);<NEW_LINE>digraph4.addEdge(2, 3);<NEW_LINE>digraph4.addEdge(3, 4);<NEW_LINE>StdOut.println("Has odd length directed cycle: " + oddLengthDirectedCycle.hasOddLengthDirectedCycle(digraph4) + " Expected: false");<NEW_LINE>} | digraph3.addEdge(4, 6); |
972,707 | final CreateJobResult executeCreateJob(CreateJobRequest createJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateJobRequest> request = null;<NEW_LINE>Response<CreateJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createJobRequest));<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, "IoT");<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<CreateJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateJobResultJsonUnmarshaller());<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, "CreateJob"); |
954,208 | private static //<NEW_LINE>//<NEW_LINE>void //<NEW_LINE>evaluateForksExecutionPaths(//<NEW_LINE>List<List<Tree>> allExecutionPaths, //<NEW_LINE>List<List<Tree>> currentPaths, //<NEW_LINE>List<Tree> currentPath, //<NEW_LINE>boolean lastIsCurrentPath, List<BreakTree> activeBreaks, Tree[] forks) {<NEW_LINE>int i = 0;<NEW_LINE>List<List<Tree>> generatedExecutionPaths = new LinkedList<>();<NEW_LINE>for (Tree fork : forks) {<NEW_LINE>if (fork != null) {<NEW_LINE>List<List<Tree>> currentPathsForFork;<NEW_LINE>if (lastIsCurrentPath && ++i == forks.length) {<NEW_LINE>currentPathsForFork = pathsList(currentPath);<NEW_LINE>} else {<NEW_LINE>List<Tree> forkedPath = new LinkedList<>(currentPath);<NEW_LINE>allExecutionPaths.add(forkedPath);<NEW_LINE>currentPathsForFork = pathsList(forkedPath);<NEW_LINE>}<NEW_LINE>collectExecutionPaths(<MASK><NEW_LINE>generatedExecutionPaths.addAll(currentPathsForFork);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// we need to merge with paths created by fork<NEW_LINE>addAllWithoutDuplicates(currentPaths, generatedExecutionPaths);<NEW_LINE>} | fork, allExecutionPaths, currentPathsForFork, activeBreaks); |
1,463,223 | protected void drawBar(Graphics2D g2, int startX, int startY, int width, int height) {<NEW_LINE>Polygon topSide = null;<NEW_LINE>Polygon rightSide = null;<NEW_LINE>g2.setPaint(fillPaint);<NEW_LINE>g2.fillRect(startX, startY, width, height);<NEW_LINE>if (draw3D) {<NEW_LINE>topSide = new Polygon();<NEW_LINE>topSide.addPoint(startX, startY);<NEW_LINE>topSide.addPoint(startX + (width / 3), <MASK><NEW_LINE>topSide.addPoint(startX + width + (width / 3), startY - (width / 3));<NEW_LINE>topSide.addPoint(startX + width, startY);<NEW_LINE>rightSide = new Polygon();<NEW_LINE>rightSide.addPoint(startX + width, startY);<NEW_LINE>rightSide.addPoint(startX + width + (width / 3), startY - (width / 3));<NEW_LINE>rightSide.addPoint(startX + width + (width / 3), (startY + height) - (width / 3));<NEW_LINE>rightSide.addPoint(startX + width, startY + height);<NEW_LINE>if (fillPaint instanceof Color) {<NEW_LINE>g2.setPaint(((Color) fillPaint).brighter());<NEW_LINE>}<NEW_LINE>g2.fillPolygon(topSide);<NEW_LINE>if (fillPaint instanceof Color) {<NEW_LINE>g2.setPaint(((Color) fillPaint).darker());<NEW_LINE>}<NEW_LINE>g2.fillPolygon(rightSide);<NEW_LINE>}<NEW_LINE>g2.setStroke(outlineStroke);<NEW_LINE>g2.setPaint(outlinePaint);<NEW_LINE>g2.drawRect(startX, startY, width, height);<NEW_LINE>if (draw3D) {<NEW_LINE>g2.drawPolygon(topSide);<NEW_LINE>g2.drawPolygon(rightSide);<NEW_LINE>}<NEW_LINE>} | startY - (width / 3)); |
1,448,927 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>jLabelConfig = new javax.swing.JLabel();<NEW_LINE>jPanelConfig = new javax.swing.JPanel();<NEW_LINE>setPreferredSize(new java.awt.Dimension(500, 340));<NEW_LINE>setRequestFocusEnabled(false);<NEW_LINE>jLabelConfig.setLabelFor(jPanelConfig);<NEW_LINE>// NOI18N<NEW_LINE>jLabelConfig.setText(org.openide.util.NbBundle.getMessage(JSFConfigurationWizardPanelVisual.class, "LBL_JSF_Config_CRUD_instruction"));<NEW_LINE>jPanelConfig.setLayout(new java.awt.GridBagLayout());<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabelConfig, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE).addComponent(jPanelConfig, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE<MASK><NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabelConfig, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jPanelConfig, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE).addGap(137, 137, 137)));<NEW_LINE>} | )).addContainerGap())); |
104,369 | public void marshall(StudioComponent studioComponent, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (studioComponent == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(studioComponent.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getConfiguration(), CONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getCreatedAt(), CREATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getCreatedBy(), CREATEDBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getEc2SecurityGroupIds(), EC2SECURITYGROUPIDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getInitializationScripts(), INITIALIZATIONSCRIPTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getScriptParameters(), SCRIPTPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getState(), STATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getStatusCode(), STATUSCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getStatusMessage(), STATUSMESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getStudioComponentId(), STUDIOCOMPONENTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getSubtype(), SUBTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(studioComponent.getUpdatedAt(), UPDATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(studioComponent.getUpdatedBy(), UPDATEDBY_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | studioComponent.getType(), TYPE_BINDING); |
1,669,190 | public void deleteById(String id) {<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String accountName = Utils.getValueFromIdByName(id, "batchAccounts");<NEW_LINE>if (accountName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.<MASK><NEW_LINE>}<NEW_LINE>String applicationName = Utils.getValueFromIdByName(id, "applications");<NEW_LINE>if (applicationName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id)));<NEW_LINE>}<NEW_LINE>String versionName = Utils.getValueFromIdByName(id, "versions");<NEW_LINE>if (versionName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id)));<NEW_LINE>}<NEW_LINE>this.deleteWithResponse(resourceGroupName, accountName, applicationName, versionName, Context.NONE);<NEW_LINE>} | format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); |
932,535 | private Object copyingObjects(Object object, boolean copyCacheFields) {<NEW_LINE>if (object instanceof Number) {<NEW_LINE>return (Number) object;<NEW_LINE>} else if (object instanceof String) {<NEW_LINE>return (String) object;<NEW_LINE>} else if (object instanceof Boolean) {<NEW_LINE>return (Boolean) object;<NEW_LINE>} else if (object instanceof List) {<NEW_LINE>List<Object> copy = new ArrayList<>();<NEW_LINE>List<Object> list = (List<Object>) object;<NEW_LINE>for (Object o : list) {<NEW_LINE>copy.add(copyingObjects(o, copyCacheFields));<NEW_LINE>}<NEW_LINE>return copy;<NEW_LINE>} else if (object instanceof Map) {<NEW_LINE>Map<Object, Object> copy = new LinkedHashMap<>();<NEW_LINE>Map<Object, Object> map = (Map<Object, Object>) object;<NEW_LINE>for (Object o : map.keySet()) {<NEW_LINE>copy.put(o, copyingObjects(map.get(o), copyCacheFields));<NEW_LINE>}<NEW_LINE>return copy;<NEW_LINE>} else // OSMAND ANDROID CHANGE BEGIN:<NEW_LINE>// removed instanceOf OpExprEvaluator<NEW_LINE>// OSMAND ANDROID CHANGE END:<NEW_LINE>if (object instanceof OpObject) {<NEW_LINE>return <MASK><NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Type of object is not supported");<NEW_LINE>}<NEW_LINE>} | new OpObject((OpObject) object); |
1,465,280 | public static void dumpLayoutParams(ViewGroup layout, String str) {<NEW_LINE>StackTraceElement s = new Throwable(<MASK><NEW_LINE>String loc = ".(" + s.getFileName() + ":" + s.getLineNumber() + ") " + str + " ";<NEW_LINE>int n = layout.getChildCount();<NEW_LINE>System.out.println(str + " children " + n);<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>View v = layout.getChildAt(i);<NEW_LINE>System.out.println(loc + " " + getName(v));<NEW_LINE>ViewGroup.LayoutParams param = v.getLayoutParams();<NEW_LINE>Field[] declaredFields = param.getClass().getFields();<NEW_LINE>for (int k = 0; k < declaredFields.length; k++) {<NEW_LINE>Field declaredField = declaredFields[k];<NEW_LINE>try {<NEW_LINE>Object value = declaredField.get(param);<NEW_LINE>String name = declaredField.getName();<NEW_LINE>if (!(name.contains("To"))) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (value.toString().equals("-1")) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>System.out.println(loc + " " + declaredField.getName() + " " + value);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).getStackTrace()[1]; |
718,374 | private CompletableFuture<CdmDocumentDefinition> fetchDocumentDefinition(final String relativePath) {<NEW_LINE>return CompletableFuture.supplyAsync(() -> {<NEW_LINE>// get the document object from the import<NEW_LINE>String docPath = this.getCtx().getCorpus().getStorage().createAbsoluteCorpusPath(relativePath, this);<NEW_LINE>if (docPath == null) {<NEW_LINE>Logger.error(this.getCtx(), TAG, "fetchDocumentDefinition", this.getAtCorpusPath(), CdmLogCode.ErrValdnInvalidCorpusPath, relativePath);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final ResolveOptions resOpt = new ResolveOptions();<NEW_LINE>resOpt.setImportsLoadStrategy(ImportsLoadStrategy.Load);<NEW_LINE>final CdmObject objAt = this.getCtx().getCorpus().fetchObjectAsync(docPath, <MASK><NEW_LINE>if (objAt == null) {<NEW_LINE>Logger.error(this.getCtx(), TAG, "fetchDocumentDefinition", this.getAtCorpusPath(), CdmLogCode.ErrPersistObjectNotFound, docPath);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return objAt.getInDocument();<NEW_LINE>});<NEW_LINE>} | null, resOpt).join(); |
724,158 | public EnableEnhancedMonitoringResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>EnableEnhancedMonitoringResult enableEnhancedMonitoringResult = new EnableEnhancedMonitoringResult();<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 enableEnhancedMonitoringResult;<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("StreamName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>enableEnhancedMonitoringResult.setStreamName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("CurrentShardLevelMetrics", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>enableEnhancedMonitoringResult.setCurrentShardLevelMetrics(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DesiredShardLevelMetrics", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>enableEnhancedMonitoringResult.setDesiredShardLevelMetrics(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return enableEnhancedMonitoringResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,427,582 | public void refresh(TableCell cell) {<NEW_LINE>Object ds = cell.getDataSource();<NEW_LINE>// needs to be long so we can shift it for sortVal<NEW_LINE>long percentDone = getPercentDone(ds);<NEW_LINE>long sortValue = 0;<NEW_LINE>if (ds instanceof DownloadManager) {<NEW_LINE>DownloadManager dm = (DownloadManager) cell.getDataSource();<NEW_LINE>// close enough to unique with abs..<NEW_LINE>int hashCode = Math.abs(DisplayFormatters.formatDownloadStatus(dm).hashCode());<NEW_LINE>long completedTime = dm.getDownloadState().getLongParameter(DownloadManagerState.PARAM_DOWNLOAD_COMPLETED_TIME);<NEW_LINE>if (completedTime <= 0 || !dm.isDownloadComplete(false)) {<NEW_LINE>sortValue = (percentDone << 31) + hashCode;<NEW_LINE>} else {<NEW_LINE>sortValue = ((completedTime <MASK><NEW_LINE>}<NEW_LINE>} else if (ds instanceof DiskManagerFileInfo) {<NEW_LINE>DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;<NEW_LINE>int st = fileInfo.getStorageType();<NEW_LINE>if ((st == DiskManagerFileInfo.ST_COMPACT || st == DiskManagerFileInfo.ST_REORDER_COMPACT) && fileInfo.isSkipped()) {<NEW_LINE>sortValue = 1;<NEW_LINE>} else if (fileInfo.isSkipped()) {<NEW_LINE>sortValue = 2;<NEW_LINE>} else if (fileInfo.getPriority() > 0) {<NEW_LINE>int pri = fileInfo.getPriority();<NEW_LINE>sortValue = 4;<NEW_LINE>if (pri > 1) {<NEW_LINE>sortValue += pri;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sortValue = 3;<NEW_LINE>}<NEW_LINE>sortValue = (fileInfo.getDownloadManager().getState() * 10000) + percentDone + sortValue;<NEW_LINE>}<NEW_LINE>long eta = showETA ? getETA(cell) : 0;<NEW_LINE>long speed = showSpeed ? getSpeed(ds) : 0;<NEW_LINE>// System.out.println("REFRESH " + sortValue + ";" + ds);<NEW_LINE>Comparable old = cell.getSortValue();<NEW_LINE>boolean sortChanged = cell.setSortValue(sortValue);<NEW_LINE>if (sortChanged && old != null && !(old instanceof String)) {<NEW_LINE>UIFunctionsManagerSWT.getUIFunctionsSWT().refreshIconBar();<NEW_LINE>}<NEW_LINE>long lastETA = 0;<NEW_LINE>long lastSpeed = 0;<NEW_LINE>TableRow row = cell.getTableRow();<NEW_LINE>if (row != null) {<NEW_LINE>if (showETA) {<NEW_LINE>Object data = row.getData("lastETA");<NEW_LINE>if (data instanceof Number) {<NEW_LINE>lastETA = ((Number) data).longValue();<NEW_LINE>}<NEW_LINE>row.setData("lastETA", new Long(eta));<NEW_LINE>}<NEW_LINE>if (showSpeed) {<NEW_LINE>Object data = row.getData("lastSpeed");<NEW_LINE>if (data instanceof Number) {<NEW_LINE>lastSpeed = ((Number) data).longValue();<NEW_LINE>}<NEW_LINE>row.setData("lastSpeed", new Long(speed));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!sortChanged && (lastETA != eta || lastSpeed != speed)) {<NEW_LINE>cell.invalidate();<NEW_LINE>}<NEW_LINE>} | / 1000) << 31) + hashCode; |
453,153 | public FileTreeInternal tarTree(Object tarPath) {<NEW_LINE>Provider<File> fileProvider = asFileProvider(tarPath);<NEW_LINE>Provider<ReadableResourceInternal> resource = providers.provider(() -> {<NEW_LINE>if (tarPath instanceof ReadableResourceInternal) {<NEW_LINE>return (ReadableResourceInternal) tarPath;<NEW_LINE>} else if (tarPath instanceof ReadableResource) {<NEW_LINE>// custom type<NEW_LINE>return new UnknownBackingFileReadableResource((ReadableResource) tarPath);<NEW_LINE>} else {<NEW_LINE>File tarFile = file(tarPath);<NEW_LINE>return new LocalResourceAdapter(new LocalFileStandInExternalResource(tarFile, fileSystem));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (tarPath instanceof ReadableResource) {<NEW_LINE>boolean hasBackingFile = tarPath instanceof ReadableResourceInternal && ((ReadableResourceInternal) tarPath).getBackingFile() != null;<NEW_LINE>if (!hasBackingFile) {<NEW_LINE>DeprecationLogger.deprecateAction("Using tarTree() on a resource without a backing file").withAdvice("Convert the resource to a file and then pass this file to tarTree(). For converting the resource to a file you can use a custom task or declare a dependency.").willBecomeAnErrorInGradle8().withUpgradeGuideSection(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>TarFileTree tarTree = new TarFileTree(fileProvider, resource.map(MaybeCompressedFileResource::new), getExpandDir(), fileSystem, directoryFileTreeFactory, streamHasher, fileHasher);<NEW_LINE>return new FileTreeAdapter(tarTree, patternSetFactory);<NEW_LINE>} | 7, "tar_tree_no_backing_file").nagUser(); |
1,726,054 | public Batch execute(CommandContext commandContext) {<NEW_LINE>Collection<MASK><NEW_LINE>MigrationPlan migrationPlan = executionBuilder.getMigrationPlan();<NEW_LINE>ensureNotNull(BadUserRequestException.class, "Migration plan cannot be null", "migration plan", migrationPlan);<NEW_LINE>ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot empty", "process instance ids", collectedInstanceIds);<NEW_LINE>ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "process instance ids", collectedInstanceIds);<NEW_LINE>ProcessDefinitionEntity sourceDefinition = resolveSourceProcessDefinition(commandContext);<NEW_LINE>ProcessDefinitionEntity targetDefinition = resolveTargetProcessDefinition(commandContext);<NEW_LINE>String tenantId = sourceDefinition.getTenantId();<NEW_LINE>Map<String, Object> variables = migrationPlan.getVariables();<NEW_LINE>Batch batch = new BatchBuilder(commandContext).type(Batch.TYPE_PROCESS_INSTANCE_MIGRATION).config(getConfiguration(collectedInstanceIds, sourceDefinition.getDeploymentId())).permission(BatchPermissions.CREATE_BATCH_MIGRATE_PROCESS_INSTANCES).permissionHandler(ctx -> checkAuthorizations(ctx, sourceDefinition, targetDefinition)).tenantId(tenantId).operationLogHandler((ctx, instanceCount) -> writeUserOperationLog(ctx, sourceDefinition, targetDefinition, instanceCount, variables, true)).build();<NEW_LINE>if (variables != null) {<NEW_LINE>String batchId = batch.getId();<NEW_LINE>VariableUtil.setVariablesByBatchId(variables, batchId);<NEW_LINE>}<NEW_LINE>return batch;<NEW_LINE>} | <String> collectedInstanceIds = collectProcessInstanceIds(); |
588,764 | // Generate Loan Amortization<NEW_LINE>private String generateAmortization(MFMAgreement loan) {<NEW_LINE>String transactionName = (String) getParameter(FinancialSetting.PARAMETER_TRX_NAME);<NEW_LINE>List<AmortizationValue> amortizationList = new ArrayList<AmortizationValue>();<NEW_LINE>MFMProduct financialProduct = MFMProduct.getById(getCtx(), <MASK><NEW_LINE>loan.set_TrxName(transactionName);<NEW_LINE>List<MFMAccount> accounts = loan.getAccounts();<NEW_LINE>for (MFMAccount account : accounts) {<NEW_LINE>account.set_TrxName(transactionName);<NEW_LINE>if (MFMAmortization.checkAccount(account)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>MFMAmortization.deleteForAccount(account);<NEW_LINE>MCurrency currency = MCurrency.get(getCtx(), account.getC_Currency_ID());<NEW_LINE>BigDecimal capitalAmt = (BigDecimal) account.get_Value("CapitalAmt");<NEW_LINE>int feesQty = Optional.ofNullable(((BigDecimal) account.get_Value("FeesQty"))).orElse(Env.ZERO).intValue();<NEW_LINE>Timestamp startDate = (Timestamp) account.get_Value("StartDate");<NEW_LINE>Timestamp endDate = (Timestamp) account.get_Value("EndDate");<NEW_LINE>Timestamp payDate = (Timestamp) account.get_Value("PayDate");<NEW_LINE>String paymentFrequency = account.get_ValueAsString("PaymentFrequency");<NEW_LINE>amortizationList = (List) LoanUtil.calculateFrenchAmortization(financialProduct.getFM_Product_ID(), capitalAmt, feesQty, startDate, endDate, payDate, paymentFrequency, account.getCtx(), transactionName).get("AMORTIZATION_LIST");<NEW_LINE>for (AmortizationValue amortization : amortizationList) {<NEW_LINE>// Create Amortization<NEW_LINE>MFMAmortization.createAmortization(account.getCtx(), amortization.getCapitalAmtFee().setScale(currency.getStdPrecision(), BigDecimal.ROUND_HALF_UP), "", amortization.getDueDate(), amortization.getEndDate(), account.getFM_Account_ID(), amortization.getInterestAmtFee().setScale(currency.getStdPrecision(), BigDecimal.ROUND_HALF_UP), amortization.getPeriodNo(), amortization.getStartDate(), amortization.getTaxAmtFee().setScale(currency.getStdPrecision(), BigDecimal.ROUND_HALF_UP), transactionName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | loan.getFM_Product_ID(), transactionName); |
1,825,477 | public boolean keyPressed(int key, int scancode, int p_keyPressed_3_) {<NEW_LINE>if (this.nameField.isFocused()) {<NEW_LINE>if (key == GLFW.GLFW_KEY_ENTER) {<NEW_LINE>String name = this.nameField.getValue();<NEW_LINE>if (!tile.targetList.contains(name)) {<NEW_LINE>CompoundTag tag = new CompoundTag();<NEW_LINE>tag.putString("add", name);<NEW_LINE>tile.targetList.add(name);<NEW_LINE>ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(tile, tag));<NEW_LINE>this.init();<NEW_LINE>((GuiReactiveList) this.buttons.get(0)).setOffset(((GuiReactiveList) this.buttons.get(<MASK><NEW_LINE>}<NEW_LINE>} else<NEW_LINE>this.nameField.keyPressed(key, scancode, p_keyPressed_3_);<NEW_LINE>return true;<NEW_LINE>} else<NEW_LINE>return super.keyPressed(key, scancode, p_keyPressed_3_);<NEW_LINE>} | 0)).getMaxOffset()); |
626,778 | private static boolean addVolumes(VolumeManager fs, InitialConfiguration initConfig, ServerDirs serverDirs) {<NEW_LINE>var hadoopConf = initConfig.getHadoopConf();<NEW_LINE>var siteConfig = initConfig.getSiteConf();<NEW_LINE>Set<String> volumeURIs = VolumeConfiguration.getVolumeUris(siteConfig);<NEW_LINE>Set<String> initializedDirs = serverDirs.checkBaseUris(hadoopConf, volumeURIs, true);<NEW_LINE>HashSet<String> uinitializedDirs = new HashSet<>();<NEW_LINE>uinitializedDirs.addAll(volumeURIs);<NEW_LINE>uinitializedDirs.removeAll(initializedDirs);<NEW_LINE>Path aBasePath = new Path(initializedDirs.iterator().next());<NEW_LINE>Path iidPath = new Path(aBasePath, Constants.INSTANCE_ID_DIR);<NEW_LINE>Path versionPath = new Path(aBasePath, Constants.VERSION_DIR);<NEW_LINE>InstanceId iid = VolumeManager.getInstanceIDFromHdfs(iidPath, hadoopConf);<NEW_LINE>for (Pair<Path, Path> replacementVolume : serverDirs.getVolumeReplacements()) {<NEW_LINE>if (aBasePath.equals(replacementVolume.getFirst())) {<NEW_LINE>log.error("{} is set to be replaced in {} and should not appear in {}." + " It is highly recommended that this property be removed as data" + " could still be written to this volume.", aBasePath, Property.INSTANCE_VOLUMES_REPLACEMENTS, Property.INSTANCE_VOLUMES);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>int persistentVersion = serverDirs.getAccumuloPersistentVersion(versionPath.getFileSystem(hadoopConf), versionPath);<NEW_LINE>if (persistentVersion != AccumuloDataVersion.get()) {<NEW_LINE>throw new IOException("Accumulo " + <MASK><NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>log.error("Problem getting accumulo data version", e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return createDirs(fs, iid, uinitializedDirs);<NEW_LINE>} | Constants.VERSION + " cannot initialize data version " + persistentVersion); |
1,822,211 | private void initComments() {<NEW_LINE>displayCommentArrays[MY_EOLS] = codeUnit.getCommentAsArray(CodeUnit.EOL_COMMENT);<NEW_LINE>totalCommentsFound += displayCommentArrays[MY_EOLS].length;<NEW_LINE>displayCommentArrays[MY_REPEATABLES] = codeUnit.getCommentAsArray(CodeUnit.REPEATABLE_COMMENT);<NEW_LINE>totalCommentsFound += displayCommentArrays[MY_REPEATABLES].length;<NEW_LINE>displayCommentArrays[REF_REPEATABLES] = new RefRepeatComment[0];<NEW_LINE>displayCommentArrays[MY_AUTOMATIC] = new String[0];<NEW_LINE>if (totalCommentsFound > maxDisplayLines) {<NEW_LINE>// no more room to display the comments below; don't process them<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// cap the number of references we get (we don't want to process 500000....)<NEW_LINE>Reference[] refs = getReferencesFrom(codeUnit, 100);<NEW_LINE>Arrays.sort(refs);<NEW_LINE>Program program = codeUnit.getProgram();<NEW_LINE>displayCommentArrays[REF_REPEATABLES] = getRepeatableComments(program.<MASK><NEW_LINE>totalCommentsFound += displayCommentArrays[REF_REPEATABLES].length;<NEW_LINE>displayCommentArrays[MY_AUTOMATIC] = getReferencePreviews(program, refs);<NEW_LINE>totalCommentsFound += displayCommentArrays[MY_AUTOMATIC].length;<NEW_LINE>} | getListing(), refs, true); |
1,016,335 | private CanonicalSubscription canonicalizeR4(IBaseResource theSubscription) {<NEW_LINE>org.hl7.fhir.r4.model.Subscription subscription = (org.hl7.fhir.r4.model.Subscription) theSubscription;<NEW_LINE>CanonicalSubscription retVal = new CanonicalSubscription();<NEW_LINE>retVal.setStatus(subscription.getStatus());<NEW_LINE>retVal.setChannelType(getChannelType(theSubscription));<NEW_LINE>retVal.setCriteriaString(subscription.getCriteria());<NEW_LINE>retVal.setEndpointUrl(subscription.getChannel().getEndpoint());<NEW_LINE>retVal.setHeaders(subscription.getChannel().getHeader());<NEW_LINE>retVal.setChannelExtensions(extractExtension(subscription));<NEW_LINE>retVal.setIdElement(subscription.getIdElement());<NEW_LINE>retVal.setPayloadString(subscription.getChannel().getPayload());<NEW_LINE>retVal.setPayloadSearchCriteria(getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA));<NEW_LINE>retVal.setTags(extractTags(subscription));<NEW_LINE>setPartitionIdOnReturnValue(theSubscription, retVal);<NEW_LINE>retVal.setCrossPartitionEnabled(SubscriptionUtil.isCrossPartition(theSubscription));<NEW_LINE>if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) {<NEW_LINE>String from;<NEW_LINE>String subjectTemplate;<NEW_LINE>try {<NEW_LINE>from = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_EMAIL_FROM);<NEW_LINE>subjectTemplate = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);<NEW_LINE>} catch (FHIRException theE) {<NEW_LINE>throw new ConfigurationException(Msg.code(561) + "Failed to extract subscription extension(s): " + theE.getMessage(), theE);<NEW_LINE>}<NEW_LINE>retVal.getEmailDetails().setFrom(from);<NEW_LINE>retVal.getEmailDetails().setSubjectTemplate(subjectTemplate);<NEW_LINE>}<NEW_LINE>if (retVal.getChannelType() == CanonicalSubscriptionChannelType.RESTHOOK) {<NEW_LINE>String stripVersionIds;<NEW_LINE>String deliverLatestVersion;<NEW_LINE>try {<NEW_LINE>stripVersionIds = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS);<NEW_LINE>deliverLatestVersion = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION);<NEW_LINE>} catch (FHIRException theE) {<NEW_LINE>throw new ConfigurationException(Msg.code(562) + "Failed to extract subscription extension(s): " + theE.getMessage(), theE);<NEW_LINE>}<NEW_LINE>retVal.getRestHookDetails().setStripVersionId(Boolean.parseBoolean(stripVersionIds));<NEW_LINE>retVal.getRestHookDetails().setDeliverLatestVersion(Boolean.parseBoolean(deliverLatestVersion));<NEW_LINE>}<NEW_LINE>List<Extension> topicExts = subscription.getExtensionsByUrl("http://hl7.org/fhir/subscription/topics");<NEW_LINE>if (topicExts.size() > 0) {<NEW_LINE>IBaseReference ref = (IBaseReference) topicExts.<MASK><NEW_LINE>if (!"EventDefinition".equals(ref.getReferenceElement().getResourceType())) {<NEW_LINE>throw new PreconditionFailedException(Msg.code(563) + "Topic reference must be an EventDefinition");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Extension extension = subscription.getExtensionByUrl(EX_SEND_DELETE_MESSAGES);<NEW_LINE>if (extension != null && extension.hasValue() && extension.getValue() instanceof BooleanType) {<NEW_LINE>retVal.setSendDeleteMessages(((BooleanType) extension.getValue()).booleanValue());<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | get(0).getValueAsPrimitive(); |
1,510,748 | public void refresh(TableCell cell, long timestamp) {<NEW_LINE>DownloadManager dm = (DownloadManager) cell.getDataSource();<NEW_LINE>long value = 0;<NEW_LINE>if (dm == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (dm.isDownloadComplete(false)) {<NEW_LINE>long completedTime = dm.getDownloadState().getLongParameter(DownloadManagerState.PARAM_DOWNLOAD_COMPLETED_TIME);<NEW_LINE>if (completedTime <= 0) {<NEW_LINE>value = dm.getDownloadState().getLongParameter(DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME);<NEW_LINE>} else {<NEW_LINE>value = completedTime;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>long diff = SystemTime.getCurrentTime() - dm.getStats().getTimeStarted();<NEW_LINE>if (diff > SHOW_ETA_AFTER_MS) {<NEW_LINE>long eta = dm.getStats().getSmoothedETA();<NEW_LINE>if (eta > 0) {<NEW_LINE>String sETA = TimeFormatter.format(eta);<NEW_LINE>value = eta << 42;<NEW_LINE>if (value < 0) {<NEW_LINE>value = Long.MAX_VALUE;<NEW_LINE>}<NEW_LINE>cell.setText(MessageText.getString("MyTorrents.column.ColumnProgressETA.2ndLine", new String[] { sETA }));<NEW_LINE>} else {<NEW_LINE>cell.setText("");<NEW_LINE>// make above<NEW_LINE>value = SystemTime.getCurrentTime() / 1000 * 1001;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>cell.setText("");<NEW_LINE>value = SystemTime.getCurrentTime() / 1000 * 1002;<NEW_LINE>}<NEW_LINE>cell.invalidate();<NEW_LINE>cell.setSortValue(value);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | super.refresh(cell, value); |
143,399 | public static void createKerberosUserEntries() throws Exception {<NEW_LINE>Log.info(c, "startAllServers", "Creating KDC user entries");<NEW_LINE>session = kdcServer.getDirectoryService().getAdminSession();<NEW_LINE>Entry entry = new DefaultEntry(session.getDirectoryService().getSchemaManager());<NEW_LINE>entry.setDn(krbtgtUserDN);<NEW_LINE>entry.add("objectClass", "top", "person", "inetOrgPerson", "krb5principal", "krb5kdcentry");<NEW_LINE>entry.add("cn", "KDC Service");<NEW_LINE>entry.add("sn", "Service");<NEW_LINE>entry.add("uid", krbtgtUser);<NEW_LINE>entry.add("userPassword", "secret");<NEW_LINE>entry.add("krb5PrincipalName", krbtgtPrincipal);<NEW_LINE>entry.add("krb5KeyVersionNumber", "0");<NEW_LINE>session.add(entry);<NEW_LINE>Log.info(c, "createPrincipal", "Created " + entry.getDn());<NEW_LINE>// app service<NEW_LINE>entry = new DefaultEntry(session.getDirectoryService().getSchemaManager());<NEW_LINE>entry.setDn(ldapUserDN);<NEW_LINE>entry.add("objectClass", "top", "person", "inetOrgPerson", "krb5principal", "krb5kdcentry");<NEW_LINE>entry.add("cn", ldapUser.toUpperCase());<NEW_LINE><MASK><NEW_LINE>entry.add("uid", ldapUser);<NEW_LINE>entry.add("userPassword", "secret");<NEW_LINE>entry.add("krb5PrincipalName", ldapPrincipal);<NEW_LINE>entry.add("krb5KeyVersionNumber", "0");<NEW_LINE>session.add(entry);<NEW_LINE>Log.info(c, "createPrincipal", "Created " + entry.getDn());<NEW_LINE>createPrincipal(bindUserName, bindPassword);<NEW_LINE>Log.info(c, "startAllServers", "Created KDC user entries");<NEW_LINE>} | entry.add("sn", "Service"); |
570,411 | default <T2, R1, R2, R3, R> LazyEither3<LT1, LT2, R> forEach4(Function<? super RT, ? extends LazyEither3<LT1, LT2, R1>> value1, BiFunction<? super RT, ? super R1, ? extends LazyEither3<LT1, LT2, R2>> value2, Function3<? super RT, ? super R1, ? super R2, ? extends LazyEither3<LT1, LT2, R3>> value3, Function4<? super RT, ? super R1, ? super R2, ? super R3, ? extends R> yieldingFunction) {<NEW_LINE>return this.flatMap(in -> {<NEW_LINE>LazyEither3<LT1, LT2, R1> <MASK><NEW_LINE>return a.flatMap(ina -> {<NEW_LINE>LazyEither3<LT1, LT2, R2> b = value2.apply(in, ina);<NEW_LINE>return b.flatMap(inb -> {<NEW_LINE>LazyEither3<LT1, LT2, R3> c = value3.apply(in, ina, inb);<NEW_LINE>return c.map(in2 -> yieldingFunction.apply(in, ina, inb, in2));<NEW_LINE>});<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | a = value1.apply(in); |
1,134,223 | private void checkUpdatingShardingKey(SqlInsert sqlInsert, TableMeta baseTableMeta, List<TableMeta> indexMetas, ExecutionContext ec) {<NEW_LINE>List<TableMeta> allTables = new ArrayList<>(indexMetas.size() + 1);<NEW_LINE>allTables.add(baseTableMeta);<NEW_LINE>allTables.addAll(indexMetas);<NEW_LINE>// column names are already in upper case<NEW_LINE>Map<String, String> keyToTable = new HashMap<>();<NEW_LINE>for (TableMeta tableMeta : allTables) {<NEW_LINE>List<String> shardingKeys = GlobalIndexMeta.getShardingKeys(tableMeta, schemaName);<NEW_LINE>for (String key : shardingKeys) {<NEW_LINE>keyToTable.putIfAbsent(key, tableMeta.getTableName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// check sharding key<NEW_LINE>SqlNodeList columnList = sqlInsert.getUpdateColumnList();<NEW_LINE>for (SqlNode column : columnList) {<NEW_LINE>String columnName = ((SqlIdentifier) column)<MASK><NEW_LINE>String tableName = keyToTable.get(columnName);<NEW_LINE>if (tableName != null) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_MODIFY_SHARD_COLUMN, columnName, tableName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// check unique key<NEW_LINE>List<List<String>> uniqueKeys = GlobalIndexMeta.getUniqueKeys(baseTableMeta, true, tm -> true, ec);<NEW_LINE>Set<String> uniqueKeySet = new HashSet<>();<NEW_LINE>uniqueKeys.forEach(uniqueKeySet::addAll);<NEW_LINE>for (SqlNode column : columnList) {<NEW_LINE>String columnName = ((SqlIdentifier) column).getLastName().toUpperCase();<NEW_LINE>if (uniqueKeySet.contains(columnName)) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_GLOBAL_SECONDARY_INDEX_MODIFY_UNIQUE_KEY, columnName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getLastName().toUpperCase(); |
1,165,961 | private void configureClearText(SocketChannel ch) {<NEW_LINE>final ChannelPipeline p = ch.pipeline();<NEW_LINE>final HttpServerCodec sourceCodec = new HttpServerCodec();<NEW_LINE>final HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory);<NEW_LINE>final CleartextHttp2ServerUpgradeHandler cleartextHttp2ServerUpgradeHandler = new CleartextHttp2ServerUpgradeHandler(sourceCodec, upgradeHandler, new HelloWorldHttp2HandlerBuilder().build());<NEW_LINE>p.addLast(cleartextHttp2ServerUpgradeHandler);<NEW_LINE>p.addLast(new SimpleChannelInboundHandler<HttpMessage>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {<NEW_LINE>// If this handler is hit then no upgrade has been attempted and the client is just talking HTTP.<NEW_LINE>System.err.println("Directly talking: " + msg.protocolVersion() + " (no upgrade was attempted)");<NEW_LINE>ChannelPipeline pipeline = ctx.pipeline();<NEW_LINE>pipeline.addAfter(ctx.name(), null, new HelloWorldHttp1Handler("Direct. No Upgrade Attempted."));<NEW_LINE>pipeline.replace(this, null, new HttpObjectAggregator(maxHttpContentLength));<NEW_LINE>ctx.fireChannelRead<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>p.addLast(new UserEventLogger());<NEW_LINE>} | (ReferenceCountUtil.retain(msg)); |
945,507 | public /* public int totalFruit(int[] tree) {<NEW_LINE>// We'll make a list of indexes for which a block starts.<NEW_LINE>List<Integer> blockLefts = new ArrayList();<NEW_LINE><NEW_LINE>// Add the left boundary of each block<NEW_LINE>for (int i = 0; i < tree.length; ++i)<NEW_LINE>if (i == 0 || tree[i-1] != tree[i])<NEW_LINE>blockLefts.add(i);<NEW_LINE><NEW_LINE>// Add tree.length as a sentinel for convenience<NEW_LINE>blockLefts.add(tree.length);<NEW_LINE><NEW_LINE><MASK><NEW_LINE>search: while (true) {<NEW_LINE>// We'll start our scan at block[i].<NEW_LINE>// types : the different values of tree[i] seen<NEW_LINE>// weight : the total number of trees represented<NEW_LINE>// by blocks under consideration<NEW_LINE>Set<Integer> types = new HashSet();<NEW_LINE>int weight = 0;<NEW_LINE><NEW_LINE>// For each block from the i-th and going forward,<NEW_LINE>for (int j = i; j < blockLefts.size() - 1; ++j) {<NEW_LINE>// Add each block to consideration<NEW_LINE>types.add(tree[blockLefts.get(j)]);<NEW_LINE>weight += blockLefts.get(j+1) - blockLefts.get(j);<NEW_LINE><NEW_LINE>// If we have 3+ types, this is an illegal subarray<NEW_LINE>if (types.size() >= 3) {<NEW_LINE>i = j - 1;<NEW_LINE>continue search;<NEW_LINE>}<NEW_LINE><NEW_LINE>// If it is a legal subarray, record the answer<NEW_LINE>ans = Math.max(ans, weight);<NEW_LINE>}<NEW_LINE><NEW_LINE>break;<NEW_LINE>}<NEW_LINE><NEW_LINE>return ans;<NEW_LINE>}*/<NEW_LINE>int totalFruit(int[] tree) {<NEW_LINE>int ans = 0, i = 0;<NEW_LINE>Counter count = new Counter();<NEW_LINE>for (int j = 0; j < tree.length; ++j) {<NEW_LINE>count.add(tree[j], 1);<NEW_LINE>while (count.size() >= 3) {<NEW_LINE>count.add(tree[i], -1);<NEW_LINE>if (count.get(tree[i]) == 0)<NEW_LINE>count.remove(tree[i]);<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>ans = Math.max(ans, j - i + 1);<NEW_LINE>}<NEW_LINE>return ans;<NEW_LINE>} | int ans = 0, i = 0; |
1,043,604 | /*<NEW_LINE>* Only handles instances of SonosSoapFault, all other exceptions fall through to the default Fault Interceptor<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void handleMessage(SoapMessage message) throws Fault {<NEW_LINE>Fault fault = (Fault) message.getContent(Exception.class);<NEW_LINE>LOG.warn("Error with Soap message", fault);<NEW_LINE>if (fault.getCause() instanceof SonosSoapFault) {<NEW_LINE>SonosSoapFault cause = (SonosSoapFault) fault.getCause();<NEW_LINE>fault.setFaultCode(new QName(cause.getFaultCode()));<NEW_LINE>fault.setMessage(cause.getFaultCode());<NEW_LINE>Document document = DOMUtils.createDocument();<NEW_LINE>Element details = document.createElement("detail");<NEW_LINE>fault.setDetail(details);<NEW_LINE>if (cause instanceof TokenRefreshRequired) {<NEW_LINE>try {<NEW_LINE>marshaller.marshal(((TokenRefreshRequired) cause).getRefreshTokens(), details);<NEW_LINE>} catch (JAXBException e) {<NEW_LINE>LOG.warn("Could not marshal Sonos refresh tokens", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>details.appendChild(document.createElement("ExceptionInfo"));<NEW_LINE>Element <MASK><NEW_LINE>sonosError.setTextContent(String.valueOf(cause.getSonosError()));<NEW_LINE>details.appendChild(sonosError);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sonosError = document.createElement("SonosError"); |
181,310 | private synchronized void makeHierarchyMap(AgentObject[] objectList) {<NEW_LINE>elementList.clear();<NEW_LINE>rootMap.clear();<NEW_LINE>Set<Integer> sIds = ServerManager.getInstance().getOpenServerList();<NEW_LINE>for (int serverId : sIds) {<NEW_LINE>Server server = ServerManager.getInstance().getServer(serverId);<NEW_LINE>ServerObject serverObj = new ServerObject(serverId, server.getName());<NEW_LINE>rootMap.put(<MASK><NEW_LINE>if (withServerObjAct.isChecked()) {<NEW_LINE>serverObj.setTotalMemory(server.getTotalMemory());<NEW_LINE>serverObj.setUsedMemory(server.getUsedMemory());<NEW_LINE>elementList.add(serverObj);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (AgentObject originAgent : objectList) {<NEW_LINE>int serverId = originAgent.getServerId();<NEW_LINE>Server server = ServerManager.getInstance().getServer(serverId);<NEW_LINE>if (server == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>HierarchyObject serverObj = rootMap.get(server.getName());<NEW_LINE>if (serverObj == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (objSelManager.isUnselectedObject(originAgent.getObjHash())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>CounterEngine engine = server.getCounterEngine();<NEW_LINE>if (engine.isUnknownObjectType(originAgent.getObjType()))<NEW_LINE>continue;<NEW_LINE>ObjectType type = engine.getObjectType(originAgent.getObjType());<NEW_LINE>if (type != null && type.isSubObject())<NEW_LINE>continue;<NEW_LINE>AgentObject newObj = new AgentObject(originAgent);<NEW_LINE>String objName = newObj.getObjName();<NEW_LINE>HierarchyObject parent = serverObj;<NEW_LINE>int inx = objName.indexOf("/", 1);<NEW_LINE>while (inx != -1) {<NEW_LINE>String childName = objName.substring(0, inx);<NEW_LINE>HierarchyObject child = parent.getChild(childName);<NEW_LINE>if (child == null) {<NEW_LINE>child = new DummyObject(childName);<NEW_LINE>child.setParent(parent);<NEW_LINE>parent.putChild(childName, child);<NEW_LINE>elementList.add(child);<NEW_LINE>}<NEW_LINE>parent = child;<NEW_LINE>inx = objName.indexOf("/", (inx + 1));<NEW_LINE>}<NEW_LINE>HierarchyObject beforeDummyObj = parent.putChild(objName, newObj);<NEW_LINE>if (beforeDummyObj != null && beforeDummyObj instanceof DummyObject) {<NEW_LINE>elementList.remove(beforeDummyObj);<NEW_LINE>newObj.setChildMap(((DummyObject) beforeDummyObj).getChildMap());<NEW_LINE>}<NEW_LINE>newObj.setParent(parent);<NEW_LINE>elementList.add(newObj);<NEW_LINE>}<NEW_LINE>} | server.getName(), serverObj); |
620,579 | public List<MethodCall<Object>> createMethodCallListToBeParsedFromBody(final String addressPrefix, final Object body, final Request<Object> originatingRequest) {<NEW_LINE>List<MethodCall<Object>> methodCalls;<NEW_LINE>if (body != null) {<NEW_LINE>methodCalls = parserRef.get().parseMethodCalls(<MASK><NEW_LINE>} else {<NEW_LINE>methodCalls = Collections.emptyList();<NEW_LINE>}<NEW_LINE>if (methodCalls == null || methodCalls.size() == 0) {<NEW_LINE>if (originatingRequest instanceof WebSocketMessage) {<NEW_LINE>WebSocketMessage webSocketMessage = ((WebSocketMessage) originatingRequest);<NEW_LINE>final Response<Object> response = ResponseImpl.response(-1, Timer.timer().now(), "SYSTEM", "ERROR", "CAN'T HANDLE CALL", originatingRequest, true);<NEW_LINE>final WebSocketSender sender = webSocketMessage.getSender();<NEW_LINE>sender.sendText(encoderRef.get().encodeResponses("SYSTEM", Lists.list(response)));<NEW_LINE>}<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>// noinspection Convert2streamapi<NEW_LINE>for (MethodCall<Object> methodCall : methodCalls) {<NEW_LINE>if (methodCall instanceof MethodCallImpl) {<NEW_LINE>MethodCallImpl method = ((MethodCallImpl) methodCall);<NEW_LINE>method.originatingRequest(originatingRequest);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return methodCalls;<NEW_LINE>} | addressPrefix, body.toString()); |
1,501,674 | public SModelComparePluginConfiguration convertToSObject(ModelComparePluginConfiguration input) {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>SModelComparePluginConfiguration result = new SModelComparePluginConfiguration();<NEW_LINE>result.setOid(input.getOid());<NEW_LINE>result.setUuid(input.getUuid());<NEW_LINE>result.setRid(input.getRid());<NEW_LINE>result.setName(input.getName());<NEW_LINE>result.setEnabled(input.getEnabled());<NEW_LINE>result.<MASK><NEW_LINE>PluginDescriptor pluginDescriptorVal = input.getPluginDescriptor();<NEW_LINE>result.setPluginDescriptorId(pluginDescriptorVal == null ? -1 : pluginDescriptorVal.getOid());<NEW_LINE>ObjectType settingsVal = input.getSettings();<NEW_LINE>result.setSettingsId(settingsVal == null ? -1 : settingsVal.getOid());<NEW_LINE>UserSettings userSettingsVal = input.getUserSettings();<NEW_LINE>result.setUserSettingsId(userSettingsVal == null ? -1 : userSettingsVal.getOid());<NEW_LINE>return result;<NEW_LINE>} | setDescription(input.getDescription()); |
455,921 | final RebootBrokerResult executeRebootBroker(RebootBrokerRequest rebootBrokerRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(rebootBrokerRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RebootBrokerRequest> request = null;<NEW_LINE>Response<RebootBrokerResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new RebootBrokerRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(rebootBrokerRequest));<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, "Kafka");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RebootBroker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RebootBrokerResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RebootBrokerResultJsonUnmarshaller());<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.RequestMarshallTime); |
472,395 | public void report(String target, Controller controller, Action action) {<NEW_LINE>StringBuilder sb = new StringBuilder(title).append(sdf.get().format(new Date())).append(" --------------------------\n");<NEW_LINE>sb.append("Url : ").append(controller.getRequest().getMethod()).append(" ").append(target).append("\n");<NEW_LINE>Class<? extends Controller> cc = action.getControllerClass();<NEW_LINE>sb.append("Controller : ").append(cc.getName()).append(".(").append(cc.getSimpleName<MASK><NEW_LINE>sb.append("\nMethod : ").append(action.getMethodName()).append("\n");<NEW_LINE>String urlParas = controller.getPara();<NEW_LINE>if (urlParas != null) {<NEW_LINE>sb.append("UrlPara : ").append(urlParas).append("\n");<NEW_LINE>}<NEW_LINE>Interceptor[] inters = action.getInterceptors();<NEW_LINE>if (inters.length > 0) {<NEW_LINE>sb.append("Interceptor : ");<NEW_LINE>for (int i = 0; i < inters.length; i++) {<NEW_LINE>if (i > 0)<NEW_LINE>sb.append("\n ");<NEW_LINE>Interceptor inter = inters[i];<NEW_LINE>Class<? extends Interceptor> ic = inter.getClass();<NEW_LINE>sb.append(ic.getName()).append(".(").append(ic.getSimpleName()).append(".java:1)");<NEW_LINE>}<NEW_LINE>sb.append("\n");<NEW_LINE>}<NEW_LINE>// print all parameters<NEW_LINE>HttpServletRequest request = controller.getRequest();<NEW_LINE>Enumeration<String> e = request.getParameterNames();<NEW_LINE>if (e.hasMoreElements()) {<NEW_LINE>sb.append("Parameter : ");<NEW_LINE>while (e.hasMoreElements()) {<NEW_LINE>String name = e.nextElement();<NEW_LINE>String[] values = request.getParameterValues(name);<NEW_LINE>if (values.length == 1) {<NEW_LINE>sb.append(name).append("=");<NEW_LINE>if (values[0] != null && values[0].length() > maxOutputLengthOfParaValue) {<NEW_LINE>sb.append(values[0].substring(0, maxOutputLengthOfParaValue)).append("...");<NEW_LINE>} else {<NEW_LINE>sb.append(values[0]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sb.append(name).append("[]={");<NEW_LINE>for (int i = 0; i < values.length; i++) {<NEW_LINE>if (i > 0)<NEW_LINE>sb.append(",");<NEW_LINE>sb.append(values[i]);<NEW_LINE>}<NEW_LINE>sb.append("}");<NEW_LINE>}<NEW_LINE>sb.append(" ");<NEW_LINE>}<NEW_LINE>sb.append("\n");<NEW_LINE>}<NEW_LINE>sb.append("--------------------------------------------------------------------------------\n");<NEW_LINE>try {<NEW_LINE>writer.write(sb.toString());<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new RuntimeException(ex);<NEW_LINE>}<NEW_LINE>} | ()).append(".java:1)"); |
112,312 | public final void actionPerformed(@Nonnull AnActionEvent e) {<NEW_LINE>DataContext dataContext = e.getDataContext();<NEW_LINE>IdeView view = dataContext.getData(LangDataKeys.IDE_VIEW);<NEW_LINE>if (view == null)<NEW_LINE>return;<NEW_LINE>PsiDirectory dir = getTargetDirectory(dataContext, view);<NEW_LINE>if (dir == null)<NEW_LINE>return;<NEW_LINE>Project project = dir.getProject();<NEW_LINE>FileTemplate <MASK><NEW_LINE>if (selectedTemplate != null) {<NEW_LINE>AnAction action = getReplacedAction(selectedTemplate);<NEW_LINE>if (action != null) {<NEW_LINE>action.actionPerformed(e);<NEW_LINE>} else {<NEW_LINE>FileTemplateManager.getInstance(project).addRecentName(selectedTemplate.getName());<NEW_LINE>AttributesDefaults defaults = getAttributesDefaults(dataContext);<NEW_LINE>Map<String, Object> properties = defaults != null ? defaults.getDefaultProperties() : null;<NEW_LINE>CreateFromTemplateDialog dialog = new CreateFromTemplateDialog(dir, selectedTemplate, defaults, properties);<NEW_LINE>PsiElement createdElement = dialog.create();<NEW_LINE>if (createdElement != null) {<NEW_LINE>elementCreated(dialog, createdElement);<NEW_LINE>view.selectElement(createdElement);<NEW_LINE>if (selectedTemplate.isLiveTemplateEnabled() && createdElement instanceof PsiFile) {<NEW_LINE>Map<String, String> defaultValues = getLiveTemplateDefaults(dataContext, ((PsiFile) createdElement));<NEW_LINE>startLiveTemplate((PsiFile) createdElement, notNull(defaultValues, Collections.emptyMap()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | selectedTemplate = getTemplate(project, dir); |
850,503 | static public View createToggle(LayoutInflater layoutInflater, OsmandApplication ctx, @LayoutRes int layoutId, LinearLayout layout, ApplicationMode mode, boolean useMapTheme) {<NEW_LINE>int metricsX = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);<NEW_LINE>int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);<NEW_LINE>View tb = layoutInflater.inflate(layoutId, null);<NEW_LINE>ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);<NEW_LINE>iv.setImageDrawable(ctx.getUIUtilities().getPaintedIcon(mode.getIconRes(), mode.getProfileColor(isNightMode(ctx, useMapTheme))));<NEW_LINE>iv.setContentDescription(mode.toHumanString());<NEW_LINE>LayoutParams lp = new <MASK><NEW_LINE>layout.addView(tb, lp);<NEW_LINE>return tb;<NEW_LINE>} | LinearLayout.LayoutParams(metricsX, metricsY); |
1,399,413 | private void createLogger(final String flowId) {<NEW_LINE>// Create logger<NEW_LINE>// If this is a containerized execution then there is no need for a custom logger.<NEW_LINE>// The logs would be appended to server logs and persisted from FlowContainer.<NEW_LINE>if (isContainerizedDispatchMethodEnabled()) {<NEW_LINE>this.logger = Logger.getLogger(FlowRunner.class);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Not containerized execution, fallback to existing logic.<NEW_LINE>final String loggerName <MASK><NEW_LINE>this.logger = Logger.getLogger(loggerName);<NEW_LINE>// Create file appender<NEW_LINE>final String logName = "_flow." + loggerName + ".log";<NEW_LINE>this.logFile = new File(this.execDir, logName);<NEW_LINE>final String absolutePath = this.logFile.getAbsolutePath();<NEW_LINE>this.flowAppender = null;<NEW_LINE>try {<NEW_LINE>this.flowAppender = new FileAppender(this.loggerLayout, absolutePath, false);<NEW_LINE>this.logger.addAppender(this.flowAppender);<NEW_LINE>} catch (final IOException e) {<NEW_LINE>this.logger.error("Could not open log file in " + this.execDir, e);<NEW_LINE>}<NEW_LINE>} | = this.execId + "." + flowId; |
357,675 | public ByteBuffer read(long offset, long length) throws IOException {<NEW_LINE>Preconditions.checkState(!mClosed);<NEW_LINE>updateUnderFileSystemInputStream(offset);<NEW_LINE>updateBlockWriter(offset);<NEW_LINE>long bytesToRead = Math.min(length, mBlockMeta.getBlockSize() - offset);<NEW_LINE>if (bytesToRead <= 0) {<NEW_LINE>return ByteBuffer.allocate(0);<NEW_LINE>}<NEW_LINE>byte[] data = new byte[(int) bytesToRead];<NEW_LINE>int bytesRead = 0;<NEW_LINE>Preconditions.checkNotNull(mUnderFileSystemInputStream, "mUnderFileSystemInputStream");<NEW_LINE>while (bytesRead < bytesToRead) {<NEW_LINE>int read;<NEW_LINE>try {<NEW_LINE>read = mUnderFileSystemInputStream.read(data, bytesRead, (<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>throw AlluxioStatusException.fromIOException(e);<NEW_LINE>}<NEW_LINE>if (read == -1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>bytesRead += read;<NEW_LINE>}<NEW_LINE>mInStreamPos += bytesRead;<NEW_LINE>// We should always read the number of bytes as expected since the UFS file length (hence block<NEW_LINE>// size) should be always accurate.<NEW_LINE>Preconditions.checkState(bytesRead == bytesToRead, PreconditionMessage.NOT_ENOUGH_BYTES_READ.toString(), bytesRead, bytesToRead, mBlockMeta.getUnderFileSystemPath());<NEW_LINE>if (mBlockWriter != null && mBlockWriter.getPosition() < mInStreamPos) {<NEW_LINE>try {<NEW_LINE>Preconditions.checkState(mBlockWriter.getPosition() >= offset);<NEW_LINE>mLocalBlockStore.requestSpace(mBlockMeta.getSessionId(), mBlockMeta.getBlockId(), mInStreamPos - mBlockWriter.getPosition());<NEW_LINE>ByteBuffer buffer = ByteBuffer.wrap(data, (int) (mBlockWriter.getPosition() - offset), (int) (mInStreamPos - mBlockWriter.getPosition()));<NEW_LINE>mBlockWriter.append(buffer.duplicate());<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("Failed to cache data read from UFS (on read()): {}", e.toString());<NEW_LINE>try {<NEW_LINE>cancelBlockWriter();<NEW_LINE>} catch (IOException ee) {<NEW_LINE>LOG.error("Failed to cancel block writer:", ee);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mCounter.inc(bytesRead);<NEW_LINE>mMeter.mark(bytesRead);<NEW_LINE>return ByteBuffer.wrap(data, 0, bytesRead);<NEW_LINE>} | int) (bytesToRead - bytesRead)); |
386,938 | private Optional<String> migrateStream(Stream stream) {<NEW_LINE>final List<AlarmCallbackConfiguration> alarmCallbacks = alarmCallbackService.getForStream(stream);<NEW_LINE>final List<Optional<String>> updatedConfigurations = alarmCallbacks.stream().filter(callbackConfiguration -> callbackConfiguration.getType().equals(EmailAlarmCallback.class.getCanonicalName())).map(callbackConfiguration -> this.updateConfiguration(stream, callbackConfiguration)).collect(Collectors.toList());<NEW_LINE>if (!updatedConfigurations.stream().allMatch(Optional::isPresent)) {<NEW_LINE>final long errors = updatedConfigurations.stream().filter(streamId -> !streamId.isPresent()).count();<NEW_LINE>LOG.<MASK><NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>this.dbCollection.update(new BasicDBObject("_id", new ObjectId(stream.getId())), new BasicDBObject("$unset", new BasicDBObject(StreamImpl.FIELD_ALERT_RECEIVERS, "")));<NEW_LINE>LOG.debug("Successfully removed alert receivers from stream <" + stream.getId() + ">.");<NEW_LINE>return Optional.of(updatedConfigurations.stream().map(Optional::get).collect(Collectors.joining(", ")));<NEW_LINE>} | error("Failed moving alert receivers in " + errors + " email alarm callbacks."); |
1,443,970 | private static Num calculateVaR(Returns returns, double confidence) {<NEW_LINE>Num <MASK><NEW_LINE>// select non-NaN returns<NEW_LINE>List<Num> returnRates = returns.getValues().subList(1, returns.getSize() + 1);<NEW_LINE>Num var = zero;<NEW_LINE>if (!returnRates.isEmpty()) {<NEW_LINE>// F(x_var) >= alpha (=1-confidence)<NEW_LINE>int nInBody = (int) (returns.getSize() * confidence);<NEW_LINE>int nInTail = returns.getSize() - nInBody;<NEW_LINE>// The series is not empty, nInTail > 0<NEW_LINE>Collections.sort(returnRates);<NEW_LINE>var = returnRates.get(nInTail - 1);<NEW_LINE>// VaR is non-positive<NEW_LINE>if (var.isGreaterThan(zero)) {<NEW_LINE>var = zero;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return var;<NEW_LINE>} | zero = returns.numOf(0); |
1,849,841 | public void processOpts() {<NEW_LINE>super.processOpts();<NEW_LINE>supportingFiles.add(new SupportingFile("ApiException.mustache", toSrcPath(invokerPackage, srcBasePath), "ApiException.php"));<NEW_LINE>supportingFiles.add(new SupportingFile("Configuration.mustache", toSrcPath(invokerPackage, srcBasePath), "Configuration.php"));<NEW_LINE>supportingFiles.add(new SupportingFile("ObjectSerializer.mustache", toSrcPath(<MASK><NEW_LINE>supportingFiles.add(new SupportingFile("ModelInterface.mustache", toSrcPath(modelPackage, srcBasePath), "ModelInterface.php"));<NEW_LINE>supportingFiles.add(new SupportingFile("HeaderSelector.mustache", toSrcPath(invokerPackage, srcBasePath), "HeaderSelector.php"));<NEW_LINE>supportingFiles.add(new SupportingFile("composer.mustache", "", "composer.json"));<NEW_LINE>supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));<NEW_LINE>supportingFiles.add(new SupportingFile("phpunit.xml.mustache", "", "phpunit.xml.dist"));<NEW_LINE>supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));<NEW_LINE>supportingFiles.add(new SupportingFile(".php_cs", "", ".php_cs"));<NEW_LINE>supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));<NEW_LINE>} | invokerPackage, srcBasePath), "ObjectSerializer.php")); |
594,448 | public Mono<StartCallRecordingResult> startRecording(String recordingStateCallbackUri) {<NEW_LINE>try {<NEW_LINE>Objects.requireNonNull(recordingStateCallbackUri, "'recordingStateCallbackUri' cannot be null.");<NEW_LINE>if (!Boolean.TRUE.equals(new URI(recordingStateCallbackUri).isAbsolute())) {<NEW_LINE>throw logger.<MASK><NEW_LINE>}<NEW_LINE>StartCallRecordingRequest request = new StartCallRecordingRequest();<NEW_LINE>request.setRecordingStateCallbackUri(recordingStateCallbackUri);<NEW_LINE>return serverCallInternal.startRecordingAsync(serverCallId, request).onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException).flatMap(result -> Mono.just(new StartCallRecordingResult(result.getRecordingId())));<NEW_LINE>} catch (RuntimeException ex) {<NEW_LINE>return monoError(logger, ex);<NEW_LINE>} catch (URISyntaxException ex) {<NEW_LINE>return monoError(logger, new RuntimeException(ex.getMessage()));<NEW_LINE>}<NEW_LINE>} | logExceptionAsError(new InvalidParameterException("'recordingStateCallbackUri' has to be an absolute Uri")); |
1,589,023 | byte[] encodeNative(VirtualFrame frame, Object filter, @Cached LZMAFilterConverter filterConverter, @Cached GetOutputNativeBufferNode getBuffer, @Cached NativeLibrary.InvokeNativeFunction createStream, @Cached NativeLibrary.InvokeNativeFunction encodeFilter, @Cached NativeLibrary.InvokeNativeFunction deallocateStream, @Cached ConditionProfile errProfile) {<NEW_LINE>PythonContext ctxt = PythonContext.get(this);<NEW_LINE>NFILZMASupport lzmaSupport = ctxt.getNFILZMASupport();<NEW_LINE>Object lzmast = lzmaSupport.createStream(createStream);<NEW_LINE>long[] opts = filterConverter.execute(frame, filter);<NEW_LINE>int lzret = lzmaSupport.encodeFilter(lzmast, ctxt.getEnv().asGuestValue(opts), encodeFilter);<NEW_LINE>if (errProfile.profile(lzret != LZMA_OK)) {<NEW_LINE><MASK><NEW_LINE>if (lzret == LZMA_PRESET_ERROR) {<NEW_LINE>throw raise(LZMAError, INVALID_COMPRESSION_PRESET, opts[LZMAOption.preset.ordinal()]);<NEW_LINE>}<NEW_LINE>errorHandling(lzret, getRaiseNode());<NEW_LINE>}<NEW_LINE>byte[] encoded = getBuffer.execute(lzmast, ctxt);<NEW_LINE>lzmaSupport.deallocateStream(lzmast, deallocateStream);<NEW_LINE>return encoded;<NEW_LINE>} | lzmaSupport.deallocateStream(lzmast, deallocateStream); |
1,082,570 | private Mono<Response<Flux<ByteBuffer>>> disableMonitoringWithResponseAsync(String resourceGroupName, String clusterName, 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 (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><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 (clusterName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.disableMonitoring(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterName, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
1,064,216 | // Check whether the upgrade is needed<NEW_LINE>private boolean isQualified(EbeanServer server, UpgradeContext context) {<NEW_LINE>boolean v1TableExists = AspectStorageValidationUtil.checkV1TableExists(server);<NEW_LINE>if (v1TableExists) {<NEW_LINE>context.report().addLine("-- V1 table exists");<NEW_LINE>long v1TableRowCount = AspectStorageValidationUtil.getV1RowCount(server);<NEW_LINE>context.report().addLine(String.format("-- V1 table has %d rows", v1TableRowCount));<NEW_LINE>boolean v2TableExists = AspectStorageValidationUtil.checkV2TableExists(server);<NEW_LINE>if (v2TableExists) {<NEW_LINE>context.report().addLine("-- V2 table exists");<NEW_LINE>long <MASK><NEW_LINE>if (v2TableRowCount == 0) {<NEW_LINE>context.report().addLine("-- V2 table is empty");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>context.report().addLine(String.format("-- V2 table has %d rows", v2TableRowCount));<NEW_LINE>context.report().addLine("-- Since V2 table has records, we will not proceed with the upgrade. ");<NEW_LINE>context.report().addLine("-- If V2 table has significantly less rows, consider running the forced upgrade. ");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>context.report().addLine("-- V2 table does not exist");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>context.report().addLine("-- V1 table does not exist");<NEW_LINE>return false;<NEW_LINE>} | v2TableRowCount = AspectStorageValidationUtil.getV2NonSystemRowCount(server); |
1,405,933 | public String report() {<NEW_LINE>if (true)<NEW_LINE>return "-";<NEW_LINE><MASK><NEW_LINE>if (// don't report<NEW_LINE>getRecord_ID() == 0)<NEW_LINE>return "ID=0";<NEW_LINE>if (// new<NEW_LINE>getRecord_ID() == 1) {<NEW_LINE>parameter.append("ISSUE=");<NEW_LINE>HashMap htOut = get_HashMap();<NEW_LINE>try // deserializing in create<NEW_LINE>{<NEW_LINE>ByteArrayOutputStream bOut = new ByteArrayOutputStream();<NEW_LINE>ObjectOutput oOut = new ObjectOutputStream(bOut);<NEW_LINE>oOut.writeObject(htOut);<NEW_LINE>oOut.flush();<NEW_LINE>String hexString = Secure.convertToHexString(bOut.toByteArray());<NEW_LINE>parameter.append(hexString);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.severe(e.getLocalizedMessage());<NEW_LINE>return "New-" + e.getLocalizedMessage();<NEW_LINE>}<NEW_LINE>} else // existing<NEW_LINE>{<NEW_LINE>try {<NEW_LINE>parameter.append("RECORDID=").append(getRecord_ID());<NEW_LINE>parameter.append("&DBADDRESS=").append(URLEncoder.encode(getDBAddress(), "UTF-8"));<NEW_LINE>parameter.append("&COMMENTS=").append(URLEncoder.encode(getComments(), "UTF-8"));<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.severe(e.getLocalizedMessage());<NEW_LINE>return "Update-" + e.getLocalizedMessage();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>InputStreamReader in = null;<NEW_LINE>String target = "http://dev1/wstore/issueReportServlet";<NEW_LINE>try // Send GET Request<NEW_LINE>{<NEW_LINE>StringBuffer urlString = new StringBuffer(target).append(parameter);<NEW_LINE>URL url = new URL(urlString.toString());<NEW_LINE>URLConnection uc = url.openConnection();<NEW_LINE>in = new InputStreamReader(uc.getInputStream());<NEW_LINE>} catch (Exception e) {<NEW_LINE>String msg = "Cannot connect to http://" + target;<NEW_LINE>if (e instanceof FileNotFoundException || e instanceof ConnectException)<NEW_LINE>msg += "\nServer temporarily down - Please try again later";<NEW_LINE>else {<NEW_LINE>msg += "\nCheck connection - " + e.getLocalizedMessage();<NEW_LINE>log.log(Level.FINE, msg);<NEW_LINE>}<NEW_LINE>return msg;<NEW_LINE>}<NEW_LINE>return readResponse(in);<NEW_LINE>} | StringBuffer parameter = new StringBuffer("?"); |
585,298 | public void handleRegularMessage(final Message msg) {<NEW_LINE>final NewMap map = mapRef.get();<NEW_LINE>if (map == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (msg.what == UPDATE_PROGRESS) {<NEW_LINE>if (detailProgress < detailTotal) {<NEW_LINE>detailProgress++;<NEW_LINE>}<NEW_LINE>if (map.waitDialog != null) {<NEW_LINE>final int secondsElapsed = (int) ((System.currentTimeMillis() - detailProgressTime) / 1000);<NEW_LINE>final int secondsRemaining;<NEW_LINE>if (detailProgress > 0) {<NEW_LINE>secondsRemaining = (detailTotal - detailProgress) * secondsElapsed / detailProgress;<NEW_LINE>} else {<NEW_LINE>secondsRemaining = (detailTotal - detailProgress) * secondsElapsed;<NEW_LINE>}<NEW_LINE>map.waitDialog.setProgress(detailProgress);<NEW_LINE>if (secondsRemaining < 40) {<NEW_LINE>map.waitDialog.setMessage(map.res.getString(R.string.caches_downloading) + " " + map.res.getString<MASK><NEW_LINE>} else {<NEW_LINE>final int minsRemaining = secondsRemaining / 60;<NEW_LINE>map.waitDialog.setMessage(map.res.getString(R.string.caches_downloading) + " " + map.res.getQuantityString(R.plurals.caches_eta_mins, minsRemaining, minsRemaining));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (msg.what == FINISHED_LOADING_DETAILS && map.waitDialog != null) {<NEW_LINE>map.waitDialog.dismiss();<NEW_LINE>map.waitDialog.setOnCancelListener(null);<NEW_LINE>}<NEW_LINE>} | (R.string.caches_eta_ltm)); |
1,350,553 | public NDList processInput(TranslatorContext ctx, QAInput input) {<NEW_LINE>BertToken token = tokenizer.encode(input.getQuestion().toLowerCase(), input.getParagraph().toLowerCase(), seqLength);<NEW_LINE>tokens = token.getTokens();<NEW_LINE>List<Long> indices = token.getTokens().stream().map(vocabulary::getIndex).collect(Collectors.toList());<NEW_LINE>float[] indexesFloat = Utils.toFloatArray(indices);<NEW_LINE>float[] types = Utils.toFloatArray(token.getTokenTypes());<NEW_LINE>int validLength = token.getValidLength();<NEW_LINE><MASK><NEW_LINE>NDArray data0 = manager.create(indexesFloat);<NEW_LINE>data0.setName("data0");<NEW_LINE>NDArray data1 = manager.create(types);<NEW_LINE>data1.setName("data1");<NEW_LINE>// avoid to use scalar as MXNet Bert model was trained with 1.5.0<NEW_LINE>// which is not compatible with MXNet NumPy<NEW_LINE>NDArray data2 = manager.create(new float[] { validLength });<NEW_LINE>data2.setName("data2");<NEW_LINE>return new NDList(data0, data1, data2);<NEW_LINE>} | NDManager manager = ctx.getNDManager(); |
1,405,356 | public Description matchVariable(VariableTree varTree, VisitorState state) {<NEW_LINE><MASK><NEW_LINE>Matcher<VariableTree> nameSameAsType = Matchers.variableType((typeTree, s) -> {<NEW_LINE>Symbol typeSymbol = ASTHelpers.getSymbol(typeTree);<NEW_LINE>if (typeSymbol != null) {<NEW_LINE>return typeSymbol.getSimpleName().contentEquals(varName);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>if (!nameSameAsType.matches(varTree, state)) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>String message = String.format("Variable named %s has the type %s. Calling methods using \"%s.something\" are " + "difficult to distinguish between static and instance methods.", varName, SuggestedFixes.prettyType(getType(varTree), /* state= */<NEW_LINE>null), varName);<NEW_LINE>return buildDescription(varTree).setMessage(message).build();<NEW_LINE>} | Name varName = varTree.getName(); |
255,863 | public static boolean migrateMediaOptimizeSettings(SQLiteDatabase db) {<NEW_LINE>Cursor cursor = null;<NEW_LINE>try {<NEW_LINE>String sqlCommand = "SELECT * FROM " + SiteSettingsModel.SETTINGS_TABLE_NAME + ";";<NEW_LINE>cursor = db.rawQuery(sqlCommand, null);<NEW_LINE>if (cursor == null || cursor.getCount() == 0 || !cursor.moveToFirst()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int columnIndex = cursor.getColumnIndex("optimizedImage");<NEW_LINE>if (columnIndex == -1) {<NEW_LINE>// No old columns for media optimization settings<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// we're safe to read all the settings now since all the columns must be there<NEW_LINE>int optimizeImageOldSettings = cursor.getInt(columnIndex);<NEW_LINE>AppPrefs.setImageOptimize(optimizeImageOldSettings == 1);<NEW_LINE>AppPrefs.setImageOptimizeMaxSize(cursor.getInt(cursor.getColumnIndexOrThrow("maxImageWidth")));<NEW_LINE>AppPrefs.setImageOptimizeQuality(cursor.getInt(cursor.getColumnIndexOrThrow("imageEncoderQuality")));<NEW_LINE>AppPrefs.setVideoOptimize(cursor.getInt(cursor.<MASK><NEW_LINE>AppPrefs.setVideoOptimizeWidth(cursor.getInt(cursor.getColumnIndexOrThrow("maxVideoWidth")));<NEW_LINE>AppPrefs.setVideoOptimizeQuality(cursor.getInt(cursor.getColumnIndexOrThrow("videoEncoderBitrate")));<NEW_LINE>// Delete the old columns? --> cannot drop a specific column in SQLite 3 ;(<NEW_LINE>return true;<NEW_LINE>} catch (SQLException e) {<NEW_LINE>AppLog.e(AppLog.T.DB, "Failed to copy media optimization settings", e);<NEW_LINE>} finally {<NEW_LINE>SqlUtils.closeCursor(cursor);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getColumnIndexOrThrow("optimizedVideo")) == 1); |
347,373 | private void printHeader(Object version) {<NEW_LINE>String codeSource = this.getCodeSource();<NEW_LINE>String serviceName = this.service.getName();<NEW_LINE>Side side = this.getSide();<NEW_LINE>MixinEnvironment.logger.info("SpongePowered MIXIN Subsystem Version={} Source={} Service={} Env={}", version, codeSource, serviceName, side);<NEW_LINE>boolean verbose = this.getOption(Option.DEBUG_VERBOSE);<NEW_LINE>if (verbose || this.getOption(Option.DEBUG_EXPORT) || this.getOption(Option.DEBUG_PROFILER)) {<NEW_LINE>PrettyPrinter printer = new PrettyPrinter(32);<NEW_LINE>printer.add("SpongePowered MIXIN%s", verbose ? " (Verbose debugging enabled)" : "").centre().hr();<NEW_LINE>printer.kv("Code source", codeSource);<NEW_LINE>printer.kv("Internal Version", version);<NEW_LINE>printer.kv("Java Version", "%s (supports compatibility %s)", JavaVersion.current(), CompatibilityLevel.getSupportedVersions());<NEW_LINE>printer.kv("Default Compatibility Level", MixinEnvironment.getCompatibilityLevel());<NEW_LINE>printer.kv("Detected ASM Version", ASM.getVersionString());<NEW_LINE>printer.kv("Detected ASM Supports Java", ASM.getClassVersionString()).hr();<NEW_LINE>printer.kv("Service Name", serviceName);<NEW_LINE>printer.kv("Mixin Service Class", this.service.getClass().getName());<NEW_LINE>printer.kv("Global Property Service Class", MixinService.getGlobalPropertyService().getClass().getName());<NEW_LINE>printer.kv("Logger Adapter Type", MixinService.getService().getLogger("mixin").getType()).hr();<NEW_LINE>for (Option option : Option.values()) {<NEW_LINE>StringBuilder indent = new StringBuilder();<NEW_LINE>for (int i = 0; i < option.depth; i++) {<NEW_LINE>indent.append("- ");<NEW_LINE>}<NEW_LINE>printer.kv(option.property, "%s<%s>", indent, option);<NEW_LINE>}<NEW_LINE>printer.hr().kv("Detected Side", side);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | printer.print(System.err); |
877,569 | private void followCodeBack(TaskMonitor monitor, AddressSet flowAddressSet, CodeUnit codeUnit, Address dataAddress) {<NEW_LINE>if (codeUnit == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// additional code to be processed.<NEW_LINE>Stack<CodeUnit> codeUnitStack = new Stack<CodeUnit>();<NEW_LINE>if (codeUnit instanceof Data) {<NEW_LINE>followDataBack(codeUnitStack, flowAddressSet<MASK><NEW_LINE>// Make sure we don't lose the data address from the original selection,<NEW_LINE>// if followDataBack didn't put a pointer in the flow.<NEW_LINE>if (dataAddress != null && !flowAddressSet.contains(dataAddress)) {<NEW_LINE>flowAddressSet.add(dataAddress);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>codeUnitStack.push(codeUnit);<NEW_LINE>}<NEW_LINE>while (!monitor.isCancelled() && !codeUnitStack.isEmpty()) {<NEW_LINE>codeUnit = codeUnitStack.pop();<NEW_LINE>if (codeUnit instanceof Instruction) {<NEW_LINE>// getAdjustedInstruction() will add the instruction and any delay slots to the<NEW_LINE>// flowAddressSet and then return the instruction to flow backwards from.<NEW_LINE>Instruction currentInstr = getAdjustedInstruction((Instruction) codeUnit, flowAddressSet);<NEW_LINE>if (currentInstr != null) {<NEW_LINE>followInstructionBack(codeUnitStack, flowAddressSet, currentInstr);<NEW_LINE>}<NEW_LINE>} else if (codeUnit instanceof Data) {<NEW_LINE>followDataBack(codeUnitStack, flowAddressSet, (Data) codeUnit, dataAddress);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , (Data) codeUnit, dataAddress); |
1,833,814 | void repaint() {<NEW_LINE>int w = (int) Math.ceil(getWidth());<NEW_LINE>int h = (int) Math.ceil(getHeight());<NEW_LINE>if (w <= 0 || h <= 0)<NEW_LINE>return;<NEW_LINE>if (img == null || img.getWidth() != w || img.getHeight() != h) {<NEW_LINE>img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);<NEW_LINE>}<NEW_LINE>Graphics2D g2d = img.createGraphics();<NEW_LINE>// Fill background<NEW_LINE>g2d.setColor(ColorToolsAwt.getCachedColor(PathPrefs.viewerBackgroundColorProperty().get()));<NEW_LINE>g2d.fillRect(0, 0, w, h);<NEW_LINE>g2d.setClip(0, 0, w, h);<NEW_LINE>transform.setToIdentity();<NEW_LINE>transform.translate(getWidth() * .5, getHeight() * .5);<NEW_LINE>double downsample = getDownsampleFactor();<NEW_LINE>transform.scale(1.0 / downsample, 1.0 / downsample);<NEW_LINE>transform.translate(-centerPosition.getX(), -centerPosition.getY());<NEW_LINE>double rotation = mainViewer.getRotation();<NEW_LINE>if (rotation != 0)<NEW_LINE>transform.rotate(rotation, centerPosition.getX(), centerPosition.getY());<NEW_LINE>g2d.transform(transform);<NEW_LINE>if (mousePosition == null)<NEW_LINE>localCursorPosition = null;<NEW_LINE>else<NEW_LINE>localCursorPosition = transform.transform(mousePosition, localCursorPosition);<NEW_LINE>// Paint viewer<NEW_LINE>// imgRGB,<NEW_LINE>mainViewer.getImageRegionStore().// imgRGB,<NEW_LINE>paintRegion(// imgRGB,<NEW_LINE>mainViewer.getServer(), // imgRGB,<NEW_LINE>g2d, // imgRGB,<NEW_LINE>g2d.getClip(), // imgRGB,<NEW_LINE>mainViewer.getZPosition(), // imgRGB,<NEW_LINE>mainViewer.getTPosition(), // imgRGB,<NEW_LINE>downsample, // imgRGB,<NEW_LINE>mainViewer.<MASK><NEW_LINE>float opacity = mainViewer.getOverlayOptions().getOpacity();<NEW_LINE>if (showOverlays.get() && opacity > 0) {<NEW_LINE>if (opacity < 1f)<NEW_LINE>g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));<NEW_LINE>ImageRegion region = AwtTools.getImageRegion(g2d.getClipBounds(), mainViewer.getZPosition(), mainViewer.getTPosition());<NEW_LINE>mainViewer.getOverlayLayers().stream().forEach(o -> {<NEW_LINE>o.paintOverlay(g2d, region, downsample, mainViewer.getImageData(), false);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>g2d.dispose();<NEW_LINE>if (imgFX == null || img.getWidth() != imgFX.getWidth() || img.getHeight() != imgFX.getHeight())<NEW_LINE>imgFX = SwingFXUtils.toFXImage(img, null);<NEW_LINE>else<NEW_LINE>imgFX = SwingFXUtils.toFXImage(img, imgFX);<NEW_LINE>blitter(imgFX);<NEW_LINE>} | getThumbnail(), null, renderer); |
1,110,122 | public void updateStats(IMetaMember member, Map<String, String> attrs) {<NEW_LINE>String fullSignature = member.toString();<NEW_LINE>for (String modifier : MODIFIERS) {<NEW_LINE>if (fullSignature.contains(modifier + S_SPACE)) {<NEW_LINE>String incMethodName = "incCount" + modifier.substring(0, 1).toUpperCase() + modifier.substring(1);<NEW_LINE>try {<NEW_LINE>MethodType mt = MethodType.methodType(void.class);<NEW_LINE>MethodHandle mh = MethodHandles.lookup().findVirtual(<MASK><NEW_LINE>mh.invokeExact(stats);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error("Exception: {}", t.getMessage(), t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String compiler = attrs.get(ATTR_COMPILER);<NEW_LINE>if (compiler != null) {<NEW_LINE>if (C1.equalsIgnoreCase(compiler)) {<NEW_LINE>stats.incCountC1();<NEW_LINE>} else if (C2.equalsIgnoreCase(compiler)) {<NEW_LINE>stats.incCountC2();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String compileKind = attrs.get(ATTR_COMPILE_KIND);<NEW_LINE>boolean isC2N = false;<NEW_LINE>if (compileKind != null) {<NEW_LINE>if (OSR.equalsIgnoreCase(compileKind)) {<NEW_LINE>stats.incCountOSR();<NEW_LINE>} else if (C2N.equalsIgnoreCase(compileKind)) {<NEW_LINE>stats.incCountC2N();<NEW_LINE>isC2N = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String compileID = attrs.get(ATTR_COMPILE_ID);<NEW_LINE>Compilation compilation = member.getCompilationByCompileID(compileID);<NEW_LINE>if (compilation != null) {<NEW_LINE>if (!isC2N) {<NEW_LINE>stats.recordDelay(compilation.getCompilationDuration());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("Didn't find compilation with ID {} on member {}", compileID, member.getFullyQualifiedMemberName());<NEW_LINE>}<NEW_LINE>} | JITStats.class, incMethodName, mt); |
1,127,734 | private static Enumeration<NetworkInterface> NetworkInterface_getNetworkInterfaces() throws SocketException {<NEW_LINE>SocketException se;<NEW_LINE>try {<NEW_LINE>return NetworkInterface.getNetworkInterfaces();<NEW_LINE>} catch (SocketException e) {<NEW_LINE>se = e;<NEW_LINE>}<NEW_LINE>// Java 7 has getByIndex<NEW_LINE>try {<NEW_LINE>Method mGetByIndex = NetworkInterface.class.getDeclaredMethod("getByIndex", int.class);<NEW_LINE>List<NetworkInterface> list = new ArrayList<>();<NEW_LINE>int i = 0;<NEW_LINE>do {<NEW_LINE>// NetworkInterface nif = NetworkInterface.getByIndex(i);<NEW_LINE>NetworkInterface nif = null;<NEW_LINE>try {<NEW_LINE>nif = (NetworkInterface) mGetByIndex.invoke(null, i);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>break;<NEW_LINE>} catch (InvocationTargetException ignore) {<NEW_LINE>// getByIndex throws SocketException<NEW_LINE>}<NEW_LINE>if (nif != null) {<NEW_LINE>list.add(nif);<NEW_LINE>} else if (i > 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>} while (true);<NEW_LINE>if (list.size() > 0) {<NEW_LINE>return Collections.enumeration(list);<NEW_LINE>}<NEW_LINE>} catch (NoSuchMethodException ignore) {<NEW_LINE>}<NEW_LINE>// Worst case, try some common interface names<NEW_LINE>List<NetworkInterface> <MASK><NEW_LINE>final String[] commonNames = { // Some Android's Ethernet<NEW_LINE>"lo", // Some Android's Ethernet<NEW_LINE>"eth", // Some Android's Ethernet<NEW_LINE>"lan", // Some Android's Ethernet<NEW_LINE>"wlan", // Android<NEW_LINE>"en", // Windows, usually TAP<NEW_LINE>"p2p", // Windows<NEW_LINE>"net", "ppp" };<NEW_LINE>for (String commonName : commonNames) {<NEW_LINE>try {<NEW_LINE>NetworkInterface nif = NetworkInterface.getByName(commonName);<NEW_LINE>if (nif != null) {<NEW_LINE>list.add(nif);<NEW_LINE>}<NEW_LINE>// Could interfaces skip numbers? Oh well..<NEW_LINE>int i = 0;<NEW_LINE>while (true) {<NEW_LINE>nif = NetworkInterface.getByName(commonName + i);<NEW_LINE>if (nif != null) {<NEW_LINE>list.add(nif);<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>} catch (Throwable ignore) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (list.size() > 0) {<NEW_LINE>return Collections.enumeration(list);<NEW_LINE>}<NEW_LINE>throw se;<NEW_LINE>} | list = new ArrayList<>(); |
610,083 | public T linkFrom(BatchOperator<?>... inputs) {<NEW_LINE>BatchOperator<<MASK><NEW_LINE>rewriteTreeType(getParams());<NEW_LINE>rewriteLabelType(in.getSchema(), getParams());<NEW_LINE>getParams().set(ModelParamName.FEATURE_TYPES, FlinkTypeConverter.getTypeString(TableUtil.findColTypesWithAssertAndHint(in.getSchema(), getParams().get(RandomForestTrainParams.FEATURE_COLS))));<NEW_LINE>in = Preprocessing.select(in, TreeUtil.trainColNames(getParams()));<NEW_LINE>set(RandomForestTrainParams.CATEGORICAL_COLS, TableUtil.getCategoricalCols(in.getSchema(), getParams().get(RandomForestTrainParams.FEATURE_COLS), getParams().contains(RandomForestTrainParams.CATEGORICAL_COLS) ? getParams().get(RandomForestTrainParams.CATEGORICAL_COLS) : null));<NEW_LINE>labels = Preprocessing.generateLabels(in, getParams(), Criteria.isRegression(getParams().get(TreeUtil.TREE_TYPE)));<NEW_LINE>in = Preprocessing.castLabel(in, getParams(), labels, Criteria.isRegression(getParams().get(TreeUtil.TREE_TYPE)));<NEW_LINE>stringIndexerModel = Preprocessing.generateStringIndexerModel(in, getParams());<NEW_LINE>in = Preprocessing.castWeightCol(Preprocessing.castContinuousCols(Preprocessing.castCategoricalCols(in, stringIndexerModel, getParams()), getParams()), getParams());<NEW_LINE>DataSet<Row> model;<NEW_LINE>if (getParams().get(RandomForestTrainParams.CREATE_TREE_MODE).toUpperCase().equals("PARALLEL")) {<NEW_LINE>model = parallelTrain(in);<NEW_LINE>} else {<NEW_LINE>model = seriesTrain(in);<NEW_LINE>}<NEW_LINE>Table importanceTable = DataSetConversionUtil.toTable(getMLEnvironmentId(), model.reduceGroup(new TreeModelDataConverter.FeatureImportanceReducer()), new String[] { getParams().get(IMPORTANCE_FIRST_COL), getParams().get(IMPORTANCE_SECOND_COL) }, new TypeInformation[] { Types.STRING, Types.DOUBLE });<NEW_LINE>this.setSideOutputTables(new Table[] { importanceTable });<NEW_LINE>setOutput(model, new TreeModelDataConverter(FlinkTypeConverter.getFlinkType(getParams().get(ModelParamName.LABEL_TYPE_NAME))).getModelSchema());<NEW_LINE>return (T) this;<NEW_LINE>} | ?> in = checkAndGetFirst(inputs); |
560,773 | public boolean isCached(RequestAuthenticator authenticator) {<NEW_LINE>logger.debug("Checking if {} is cached", authenticator);<NEW_LINE>SecurityContext context = SecurityContextHolder.getContext();<NEW_LINE>KeycloakAuthenticationToken token;<NEW_LINE>KeycloakSecurityContext keycloakSecurityContext;<NEW_LINE>if (context == null || context.getAuthentication() == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!KeycloakAuthenticationToken.class.isAssignableFrom(context.getAuthentication().getClass())) {<NEW_LINE>logger.warn(<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>logger.debug("Remote logged in already. Establishing state from security context.");<NEW_LINE>token = (KeycloakAuthenticationToken) context.getAuthentication();<NEW_LINE>keycloakSecurityContext = token.getAccount().getKeycloakSecurityContext();<NEW_LINE>if (!deployment.getRealm().equals(keycloakSecurityContext.getRealm())) {<NEW_LINE>logger.debug("Account from security context is from a different realm than for the request.");<NEW_LINE>logout();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (keycloakSecurityContext.getToken().isExpired()) {<NEW_LINE>logger.warn("Security token expired ... not returning from cache");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>request.setAttribute(KeycloakSecurityContext.class.getName(), keycloakSecurityContext);<NEW_LINE>return true;<NEW_LINE>} | "Expected a KeycloakAuthenticationToken, but found {}", context.getAuthentication()); |
604,923 | public DHTStorageBlock keyBlockRequest(DHTTransportContact originating_contact, byte[] request, byte[] signature) {<NEW_LINE>// request is 4 bytes flags, 4 byte time, K byte key<NEW_LINE>// flag: MSB 00 -> unblock, 01 ->block<NEW_LINE>if (request.length <= 8) {<NEW_LINE>return (null);<NEW_LINE>}<NEW_LINE>keyBlock kb = new keyBlock(request, signature, (int) (SystemTime.getCurrentTime() / 1000), originating_contact != null);<NEW_LINE>try {<NEW_LINE>key_block_mon.enter();<NEW_LINE>boolean add_it = false;<NEW_LINE>try {<NEW_LINE>keyBlock old = (keyBlock) key_block_map_cow.get(kb.getKey());<NEW_LINE>if (old != null) {<NEW_LINE>// never override a direct value with an indirect one as direct = first hand knowledge<NEW_LINE>// whereas indirect is hearsay<NEW_LINE>if (old.isDirect() && !kb.isDirect()) {<NEW_LINE>return (null);<NEW_LINE>}<NEW_LINE>// don't let older instructions override newer ones<NEW_LINE>if (old.getCreated() > kb.getCreated()) {<NEW_LINE>return (null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (kb.isAdd()) {<NEW_LINE>if (old == null || !old.isAdd()) {<NEW_LINE>if (!verifyKeyBlock(kb, originating_contact)) {<NEW_LINE>return (null);<NEW_LINE>}<NEW_LINE>add_it = true;<NEW_LINE>}<NEW_LINE>return (kb);<NEW_LINE>} else {<NEW_LINE>// only direct operations can "remove" blocks<NEW_LINE>if (kb.isDirect() && (old == null || old.isAdd())) {<NEW_LINE>if (!verifyKeyBlock(kb, originating_contact)) {<NEW_LINE>return (null);<NEW_LINE>}<NEW_LINE>add_it = true;<NEW_LINE>}<NEW_LINE>return (null);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (add_it) {<NEW_LINE><MASK><NEW_LINE>new_map.put(kb.getKey(), kb);<NEW_LINE>// seeing as we've received this from someone there's no point in replicating it<NEW_LINE>// back to them later - mark them to prevent this<NEW_LINE>if (originating_contact != null) {<NEW_LINE>kb.sentTo(originating_contact);<NEW_LINE>}<NEW_LINE>key_block_map_cow = new_map;<NEW_LINE>key_blocks_direct_cow = buildKeyBlockDetails(key_block_map_cow);<NEW_LINE>writeKeyBlocks();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>key_block_mon.exit();<NEW_LINE>}<NEW_LINE>} | ByteArrayHashMap new_map = key_block_map_cow.duplicate(); |
359,951 | protected <T> Runnable doExport(T proxiedImpl, Class<T> type, URL url) throws RpcException {<NEW_LINE>String key = url.getAddress();<NEW_LINE>ProtocolServer protocolServer = serverMap.computeIfAbsent(key, k -> {<NEW_LINE>DubboHandlerRegistry registry = new DubboHandlerRegistry();<NEW_LINE>NettyServerBuilder builder = NettyServerBuilder.forPort(url.getPort()).fallbackHandlerRegistry(registry);<NEW_LINE>Server originalServer = GrpcOptionsUtils.buildServerBuilder(url, builder).build();<NEW_LINE>GrpcRemotingServer remotingServer = new GrpcRemotingServer(originalServer, registry);<NEW_LINE>return new ProxyProtocolServer(remotingServer);<NEW_LINE>});<NEW_LINE>GrpcRemotingServer grpcServer = (GrpcRemotingServer) protocolServer.getRemotingServer();<NEW_LINE>FrameworkServiceRepository serviceRepository = frameworkModel.getServiceRepository();<NEW_LINE>ProviderModel providerModel = serviceRepository.lookupExportedService(url.getServiceKey());<NEW_LINE>if (providerModel == null) {<NEW_LINE>throw new IllegalStateException("Service " + url.getServiceKey() + "should have already been stored in service repository, " + "but failed to find it.");<NEW_LINE>}<NEW_LINE>Object originalImpl = providerModel.getServiceInstance();<NEW_LINE>Class<?> implClass = originalImpl.getClass();<NEW_LINE>try {<NEW_LINE>Method method = implClass.getMethod("setProxiedImpl", type);<NEW_LINE>method.invoke(originalImpl, proxiedImpl);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>grpcServer.getRegistry().addService((BindableService) originalImpl, url.getServiceKey());<NEW_LINE>if (!grpcServer.isStarted()) {<NEW_LINE>grpcServer.start();<NEW_LINE>}<NEW_LINE>return () -> grpcServer.getRegistry().removeService(url.getServiceKey());<NEW_LINE>} | IllegalStateException("Failed to set dubbo proxied service impl to stub, please make sure your stub " + "was generated by the dubbo-protoc-compiler.", e); |
762,226 | public static void main(String[] args) throws Exception {<NEW_LINE>if (args.length != 2) {<NEW_LINE>System.err.println("Usage : Util <src> <target>");<NEW_LINE>System.err.println("");<NEW_LINE>System.err.println("NOTE: <src>/<target> can be either a file path or a dlog stream");<NEW_LINE>Runtime.getRuntime().exit(-1);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String srcPath = args[0];<NEW_LINE>String destPath = args[1];<NEW_LINE>Namespace srcNs = null;<NEW_LINE>Namespace destNs = null;<NEW_LINE>InputStream is = null;<NEW_LINE>OutputStream os = null;<NEW_LINE>try {<NEW_LINE>if (srcPath.startsWith("distributedlog")) {<NEW_LINE>URI srcUri = URI.create(srcPath);<NEW_LINE>Pair<URI, String> parentAndName = getParentURI(srcUri);<NEW_LINE>srcNs = openNamespace(parentAndName.first);<NEW_LINE>is = openInputStream(srcNs, parentAndName.second);<NEW_LINE>} else {<NEW_LINE>is = new FileInputStream(destPath);<NEW_LINE>}<NEW_LINE>if (destPath.startsWith("distributedlog")) {<NEW_LINE>URI destUri = URI.create(srcPath);<NEW_LINE>Pair<URI, <MASK><NEW_LINE>destNs = openNamespace(parentAndName.first);<NEW_LINE>os = openOutputStream(destNs, parentAndName.second);<NEW_LINE>} else {<NEW_LINE>os = new FileOutputStream(destPath);<NEW_LINE>}<NEW_LINE>copyStream(is, os);<NEW_LINE>} finally {<NEW_LINE>if (null != is) {<NEW_LINE>is.close();<NEW_LINE>}<NEW_LINE>if (null != os) {<NEW_LINE>os.close();<NEW_LINE>}<NEW_LINE>if (null != srcNs) {<NEW_LINE>srcNs.close();<NEW_LINE>}<NEW_LINE>if (null != destNs) {<NEW_LINE>destNs.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String> parentAndName = getParentURI(destUri); |
429,696 | final CreateExplainabilityResult executeCreateExplainability(CreateExplainabilityRequest createExplainabilityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createExplainabilityRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateExplainabilityRequest> request = null;<NEW_LINE>Response<CreateExplainabilityResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateExplainabilityRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createExplainabilityRequest));<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, "forecast");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateExplainability");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateExplainabilityResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateExplainabilityResultJsonUnmarshaller());<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 awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
910,286 | protected void updateLocale(boolean revalidate) {<NEW_LINE>Locale locale = monthView.getLocale();<NEW_LINE>if (getRenderingHandler() != null) {<NEW_LINE>getRenderingHandler().setLocale(locale);<NEW_LINE>}<NEW_LINE>// fixed JW: respect property in UIManager if available<NEW_LINE>// PENDING JW: what to do if weekdays had been set<NEW_LINE>// with JXMonthView method? how to detect?<NEW_LINE>daysOfTheWeek = (String[]) UIManager.get("JXMonthView.daysOfTheWeek");<NEW_LINE>if (daysOfTheWeek == null) {<NEW_LINE>daysOfTheWeek = new String[7];<NEW_LINE>String[] dateFormatSymbols = DateFormatSymbols.getInstance(locale).getShortWeekdays();<NEW_LINE>daysOfTheWeek <MASK><NEW_LINE>for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) {<NEW_LINE>daysOfTheWeek[i - 1] = dateFormatSymbols[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (revalidate) {<NEW_LINE>monthView.invalidate();<NEW_LINE>monthView.validate();<NEW_LINE>}<NEW_LINE>} | = new String[JXMonthView.DAYS_IN_WEEK]; |
1,720,893 | public void execute(AdminCommandContext context) {<NEW_LINE>ActionReport report = context.getActionReport();<NEW_LINE>MonitorContract mContract = null;<NEW_LINE>for (MonitorContract m : habitat.<MonitorContract>getAllServices(MonitorContract.class)) {<NEW_LINE>if ((m.getName()).equals(type)) {<NEW_LINE>mContract = m;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mContract != null) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!habitat.getAllServices(MonitorContract.class).isEmpty()) {<NEW_LINE>StringBuilder buf = new StringBuilder();<NEW_LINE>Iterator<MonitorContract> contractsIterator = habitat.<MonitorContract>getAllServices(MonitorContract.class).iterator();<NEW_LINE>while (contractsIterator.hasNext()) {<NEW_LINE>buf.append(contractsIterator.next().getName());<NEW_LINE>if (contractsIterator.hasNext()) {<NEW_LINE>buf.append(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String validTypes = buf.toString();<NEW_LINE>report.setMessage(LOCALSTRINGS.getLocalString("monitor.type.error", "No type exists in habitat for the given monitor type {0}. " + "Valid types are: {1}", type, validTypes));<NEW_LINE>} else {<NEW_LINE>report.setMessage(LOCALSTRINGS.getLocalString("monitor.type.invalid", "No type exists in habitat for the given monitor type {0}", type));<NEW_LINE>}<NEW_LINE>report.setActionExitCode(ActionReport.ExitCode.FAILURE);<NEW_LINE>} | mContract.process(report, filter); |
1,306,688 | public void onActionClick(int position, Object data) {<NEW_LINE>PopMenuAction action = (PopMenuAction) data;<NEW_LINE>if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.start_conversation))) {<NEW_LINE>TUIUtils.startActivity("StartC2CChatActivity", null);<NEW_LINE>}<NEW_LINE>if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_private_group))) {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.PRIVATE);<NEW_LINE>TUIUtils.startActivity("StartGroupChatActivity", bundle);<NEW_LINE>}<NEW_LINE>if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_group_chat))) {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.PUBLIC);<NEW_LINE>TUIUtils.startActivity("StartGroupChatActivity", bundle);<NEW_LINE>}<NEW_LINE>if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_chat_room))) {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putInt(TUIConversationConstants.GroupType.<MASK><NEW_LINE>TUIUtils.startActivity("StartGroupChatActivity", bundle);<NEW_LINE>}<NEW_LINE>if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_community))) {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.COMMUNITY);<NEW_LINE>TUIUtils.startActivity("StartGroupChatActivity", bundle);<NEW_LINE>}<NEW_LINE>menu.hide();<NEW_LINE>} | TYPE, TUIConversationConstants.GroupType.CHAT_ROOM); |
1,387,356 | public GetRateBasedStatementManagedKeysResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetRateBasedStatementManagedKeysResult getRateBasedStatementManagedKeysResult = new GetRateBasedStatementManagedKeysResult();<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 getRateBasedStatementManagedKeysResult;<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("ManagedKeysIPV4", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getRateBasedStatementManagedKeysResult.setManagedKeysIPV4(RateBasedStatementManagedKeysIPSetJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ManagedKeysIPV6", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getRateBasedStatementManagedKeysResult.setManagedKeysIPV6(RateBasedStatementManagedKeysIPSetJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getRateBasedStatementManagedKeysResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,435,146 | public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'requiredStringGroup' is set<NEW_LINE>if (requiredStringGroup == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'requiredBooleanGroup' is set<NEW_LINE>if (requiredBooleanGroup == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'requiredInt64Group' is set<NEW_LINE>if (requiredInt64Group == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/fake".replaceAll("\\{format\\}", "json");<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group));<NEW_LINE>if (requiredBooleanGroup != null)<NEW_LINE>localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup));<NEW_LINE>if (booleanGroup != null)<NEW_LINE>localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup));<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE><MASK><NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | final String[] localVarContentTypes = {}; |
610,619 | private void updateNic(VmUpdateNicOnHypervisorMsg msg, NoErrorCompletion completion) {<NEW_LINE>checkStateAndStatus();<NEW_LINE><MASK><NEW_LINE>List<VmNicVO> nics = Q.New(VmNicVO.class).eq(VmNicVO_.vmInstanceUuid, msg.getVmInstanceUuid()).list();<NEW_LINE>UpdateNicCmd cmd = new UpdateNicCmd();<NEW_LINE>cmd.setVmInstanceUuid(msg.getVmInstanceUuid());<NEW_LINE>cmd.setNics(VmNicInventory.valueOf(nics).stream().map(this::completeNicInfo).collect(Collectors.toList()));<NEW_LINE>KVMHostInventory inv = (KVMHostInventory) getSelfInventory();<NEW_LINE>for (KVMPreUpdateNicExtensionPoint ext : pluginRgty.getExtensionList(KVMPreUpdateNicExtensionPoint.class)) {<NEW_LINE>ext.preUpdateNic(inv, cmd);<NEW_LINE>}<NEW_LINE>new Http<>(updateNicPath, cmd, AttachNicResponse.class).call(new ReturnValueCompletion<AttachNicResponse>(msg, completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(AttachNicResponse ret) {<NEW_LINE>if (!ret.isSuccess()) {<NEW_LINE>reply.setError(operr("failed to update nic[vm:%s] on kvm host[uuid:%s, ip:%s]," + "because %s", msg.getVmInstanceUuid(), self.getUuid(), self.getManagementIp(), ret.getError()));<NEW_LINE>}<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>completion.done();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>reply.setError(errorCode);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>completion.done();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | final VmUpdateNicOnHypervisorReply reply = new VmUpdateNicOnHypervisorReply(); |
1,519,443 | private void initControls(IProgressReport pReport) {<NEW_LINE>if (null != pReport.getImage()) {<NEW_LINE>imageLabel.setImage(pReport.getImage());<NEW_LINE>} else {<NEW_LINE>imageLabel.setImage(getDisplay().getSystemImage(SWT.ICON_INFORMATION));<NEW_LINE>}<NEW_LINE>nameLabel.setText(formatForDisplay(pReport.getName()));<NEW_LINE>ImageLoader imageLoader = ImageLoader.getInstance();<NEW_LINE>imageLoader.setLabelImage(actionLabel_cancel, "progress_cancel");<NEW_LINE>imageLoader.setLabelImage(actionLabel_remove, "progress_remove");<NEW_LINE>imageLoader.setLabelImage(actionLabel_retry, "progress_retry");<NEW_LINE>Utils.setTT(actionLabel_cancel, MessageText.getString("Progress.reporting.action.label.cancel.tooltip"));<NEW_LINE>Utils.setTT(actionLabel_remove, MessageText.getString("Progress.reporting.action.label.remove.tooltip"));<NEW_LINE>Utils.setTT(actionLabel_retry, MessageText.getString("Progress.reporting.action.label.retry.tooltip"));<NEW_LINE>{<NEW_LINE>if (pReport.isInErrorState()) {<NEW_LINE>updateStatusLabel(MessageText.getString("Progress.reporting.default.error"), true);<NEW_LINE>} else if (pReport.isDone()) {<NEW_LINE>updateStatusLabel(MessageText<MASK><NEW_LINE>} else if (pReport.isCanceled()) {<NEW_LINE>updateStatusLabel(MessageText.getString("Progress.reporting.status.canceled"), false);<NEW_LINE>} else if (pReport.isIndeterminate()) {<NEW_LINE>updateStatusLabel(Constants.INFINITY_STRING, false);<NEW_LINE>} else {<NEW_LINE>updateStatusLabel(pReport.getPercentage() + "%", false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>synchProgressBar(pReport);<NEW_LINE>synchActionLabels(pReport);<NEW_LINE>} | .getString("Progress.reporting.status.finished"), false); |
1,753,242 | public void toModel(Model model) {<NEW_LINE>for (String s1 : altLocations.keySet()) {<NEW_LINE>Resource r = model.createResource();<NEW_LINE><MASK><NEW_LINE>model.add(r, LocationMappingVocab.mapping, e);<NEW_LINE>String k = s1;<NEW_LINE>String v = altLocations.get(k);<NEW_LINE>model.add(e, LocationMappingVocab.name, k);<NEW_LINE>model.add(e, LocationMappingVocab.altName, v);<NEW_LINE>}<NEW_LINE>for (String s : altPrefixes.keySet()) {<NEW_LINE>Resource r = model.createResource();<NEW_LINE>Resource e = model.createResource();<NEW_LINE>model.add(r, LocationMappingVocab.mapping, e);<NEW_LINE>String k = s;<NEW_LINE>String v = altPrefixes.get(k);<NEW_LINE>model.add(e, LocationMappingVocab.prefix, k);<NEW_LINE>model.add(e, LocationMappingVocab.altPrefix, v);<NEW_LINE>}<NEW_LINE>} | Resource e = model.createResource(); |
1,595,416 | private static Collection<Target> targets(Graph shapesGraph, Node shape) {<NEW_LINE>// sh:targetClass : rdfs:Class<NEW_LINE>// sh:targetNode : any IRI or literal<NEW_LINE>// sh:targetObjectsOf : rdf:Property<NEW_LINE>// sh:targetSubjectsOf : rdf:Property<NEW_LINE>// sh:target : uses object for further description.<NEW_LINE>List<Target> <MASK><NEW_LINE>accTarget(x, shapesGraph, shape, TargetType.targetNode);<NEW_LINE>accTarget(x, shapesGraph, shape, TargetType.targetClass);<NEW_LINE>accTarget(x, shapesGraph, shape, TargetType.targetObjectsOf);<NEW_LINE>accTarget(x, shapesGraph, shape, TargetType.targetSubjectsOf);<NEW_LINE>// SHACL-AF<NEW_LINE>accTarget(x, shapesGraph, shape, TargetType.targetExtension);<NEW_LINE>// TargetType.implicitClass : some overlap with TargetOps.implicitClassTargets<NEW_LINE>// Explicitly sh:NodeShape or sh:PropertyShape and also subClassof* rdfs:Class.<NEW_LINE>if (isShapeType(shapesGraph, shape) && isOfType(shapesGraph, shape, rdfsClass))<NEW_LINE>x.add(Target.create(shape, TargetType.implicitClass, shape, null));<NEW_LINE>return x;<NEW_LINE>} | x = new ArrayList<>(); |
430,775 | public Void call() throws Exception {<NEW_LINE>mResult.setRecordStartMs(CommonUtils.getCurrentMs());<NEW_LINE>AtomicLong localCounter = new AtomicLong();<NEW_LINE>while (!sFinish.get() && mRetryPolicy.attempt()) {<NEW_LINE>if (Thread.currentThread().isInterrupted()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>long increment = localCounter.getAndIncrement();<NEW_LINE>if (increment % 100_000 == 0) {<NEW_LINE>LOG.info("[{}] Created {} files", mId, increment);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>mExecutor.submit(() -> {<NEW_LINE>try {<NEW_LINE>applyOperation(increment);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}).get(OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS);<NEW_LINE>mResult.incrementNumSuccess(1);<NEW_LINE>mRetryPolicy = createPolicy();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.info("[{}] Attempt #{} failed: {}", mId, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>sFinish.set(true);<NEW_LINE>// record local results<NEW_LINE>mResult.setEndMs(CommonUtils.getCurrentMs());<NEW_LINE>mResult.setParameters(mParameters);<NEW_LINE>mResult.setBaseParameters(mBaseParameters);<NEW_LINE>LOG.info("[{}] numSuccesses = {}", mId, mResult.getStatistics().mNumSuccess);<NEW_LINE>// merging total results<NEW_LINE>synchronized (mTotalResults) {<NEW_LINE>mTotalResults.merge(mResult);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | mRetryPolicy.getAttemptCount(), e); |
1,213,947 | private boolean isCardFormatValid(Card card, Card commander, FilterMana color) {<NEW_LINE>if (!cardHasValideColor(color, card)) {<NEW_LINE>addError(DeckValidatorErrorType.OTHER, card.getName(), "Invalid color (" + commander.getName() + ')', true);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// 906.5b<NEW_LINE>// Each card must have a converted mana cost of three or less. Cards with {x} in their mana cost count X<NEW_LINE>// as zero for this purpose. Split cards are legal only if both of their halves would be legal independently.<NEW_LINE>List<Integer> costs = new ArrayList<>();<NEW_LINE>if (card instanceof SplitCard) {<NEW_LINE>costs.add(((SplitCard) card).getLeftHalfCard().getManaValue());<NEW_LINE>costs.add(((SplitCard) card).getRightHalfCard().getManaValue());<NEW_LINE>} else if (card instanceof ModalDoubleFacesCard) {<NEW_LINE>costs.add(((ModalDoubleFacesCard) card).getLeftHalfCard().getManaValue());<NEW_LINE>costs.add(((ModalDoubleFacesCard) card).getRightHalfCard().getManaValue());<NEW_LINE>} else {<NEW_LINE>costs.add(card.getManaValue());<NEW_LINE>}<NEW_LINE>return costs.stream().allMatch(cost -> {<NEW_LINE>if (cost > 3) {<NEW_LINE>addError(DeckValidatorErrorType.OTHER, card.getName(), <MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>} | "Invalid cost (" + cost + ')', true); |
417,466 | public UpdateUploadResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateUploadResult updateUploadResult = new UpdateUploadResult();<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 updateUploadResult;<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("upload", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateUploadResult.setUpload(UploadJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return updateUploadResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
224,840 | public InteractionResultHolder<ItemStack> use(Level worldIn, Player playerIn, InteractionHand handIn) {<NEW_LINE>ItemStack itemstack = playerIn.getItemInHand(handIn);<NEW_LINE>if (playerIn.fishing != null) {<NEW_LINE>if (!worldIn.isClientSide) {<NEW_LINE>int i = playerIn.fishing.retrieve(itemstack);<NEW_LINE>itemstack.hurtAndBreak(i, playerIn, (player) -> {<NEW_LINE>player.broadcastBreakEvent(handIn);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>playerIn.swing(handIn);<NEW_LINE>worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / (worldIn.getRandom().nextFloat() * 0.4F + 0.8F));<NEW_LINE>} else {<NEW_LINE>if (!worldIn.isClientSide) {<NEW_LINE>int k = EnchantmentHelper.getFishingSpeedBonus(itemstack);<NEW_LINE>int j = EnchantmentHelper.getFishingLuckBonus(itemstack);<NEW_LINE>FishingHook hook = new FishingHook(playerIn, worldIn, j, k);<NEW_LINE>if (DistValidate.isValid(worldIn)) {<NEW_LINE>PlayerFishEvent playerFishEvent = new PlayerFishEvent(((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity(), null, (FishHook) ((EntityBridge) hook).bridge$getBukkitEntity(), PlayerFishEvent.State.FISHING);<NEW_LINE>Bukkit.getPluginManager().callEvent(playerFishEvent);<NEW_LINE>if (playerFishEvent.isCancelled()) {<NEW_LINE>playerIn.fishing = null;<NEW_LINE>return new InteractionResultHolder<>(InteractionResult.PASS, itemstack);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (worldIn.getRandom().nextFloat() * 0.4F + 0.8F));<NEW_LINE>worldIn.addFreshEntity(new FishingHook(playerIn, worldIn, j, k));<NEW_LINE>}<NEW_LINE>// playerIn.swingArm(handIn);<NEW_LINE>playerIn.awardStat(Stats<MASK><NEW_LINE>}<NEW_LINE>return InteractionResultHolder.sidedSuccess(itemstack, worldIn.isClientSide());<NEW_LINE>} | .ITEM_USED.get(this)); |
1,595,775 | public int LAPACKE_chbgvx_work(int arg0, byte arg1, byte arg2, byte arg3, int arg4, int arg5, int arg6, float[] arg7, int arg8, float[] arg9, int arg10, float[] arg11, int arg12, float arg13, float arg14, int arg15, int arg16, float arg17, int[] arg18, float[] arg19, float[] arg20, int arg21, float[] arg22, float[] arg23, int[] arg24, int[] arg25) {<NEW_LINE>return LAPACKE_chbgvx_work(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, <MASK><NEW_LINE>} | arg22, arg23, arg24, arg25); |
3,669 | static void insertAllSuperInterfaces(CtType<?> targetType, Template<?> template, CtClass<? extends Template<?>> sourceClass) {<NEW_LINE>// insert all the interfaces<NEW_LINE>for (CtTypeReference<?> t : sourceClass.getSuperInterfaces()) {<NEW_LINE>if (!t.equals(targetType.getFactory().Type().createReference(Template.class))) {<NEW_LINE>CtTypeReference<?> t1 = t;<NEW_LINE>// substitute ref if needed<NEW_LINE>if (Parameters.getNames(sourceClass).contains(t.getSimpleName())) {<NEW_LINE>Object o = Parameters.getValue(template, t.getSimpleName(), null);<NEW_LINE>if (o instanceof CtTypeReference) {<NEW_LINE>t1 = (CtTypeReference<?>) o;<NEW_LINE>} else if (o instanceof Class) {<NEW_LINE>t1 = targetType.getFactory().Type().createReference(<MASK><NEW_LINE>} else if (o instanceof String) {<NEW_LINE>t1 = targetType.getFactory().Type().createReference((String) o);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!t1.equals(targetType.getReference())) {<NEW_LINE>Class<?> c = null;<NEW_LINE>try {<NEW_LINE>c = t1.getActualClass();<NEW_LINE>} catch (Exception e) {<NEW_LINE>// swallow it<NEW_LINE>}<NEW_LINE>if (c != null && c.isInterface()) {<NEW_LINE>targetType.addSuperInterface(t1);<NEW_LINE>}<NEW_LINE>if (c == null) {<NEW_LINE>targetType.addSuperInterface(t1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (Class<?>) o); |
78,978 | private static void validateArchive(JReleaserContext context, JReleaserContext.Mode mode, Archive archive, Errors errors) {<NEW_LINE>context.getLogger().debug("archive.{}", archive.getName());<NEW_LINE>if (!archive.isActiveSet()) {<NEW_LINE>archive.setActive(Active.NEVER);<NEW_LINE>}<NEW_LINE>if (!archive.resolveEnabled(context.getModel().getProject()))<NEW_LINE>return;<NEW_LINE>if (isBlank(archive.getName())) {<NEW_LINE>errors.configuration(RB<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Platform platform = archive.getPlatform().merge(context.getModel().getPlatform());<NEW_LINE>archive.setPlatform(platform);<NEW_LINE>if (null == archive.getDistributionType()) {<NEW_LINE>archive.setDistributionType(Distribution.DistributionType.BINARY);<NEW_LINE>}<NEW_LINE>if (isBlank(archive.getArchiveName())) {<NEW_LINE>archive.setArchiveName("{{distributionName}}-{{projectVersion}}");<NEW_LINE>}<NEW_LINE>if (archive.getFormats().isEmpty()) {<NEW_LINE>archive.addFormat(Archive.Format.ZIP);<NEW_LINE>}<NEW_LINE>if (archive.getFileSets().isEmpty()) {<NEW_LINE>errors.configuration(RB.$("validation_archive_empty_fileset", archive.getName()));<NEW_LINE>} else {<NEW_LINE>int i = 0;<NEW_LINE>for (FileSet fileSet : archive.getFileSets()) {<NEW_LINE>validateFileSet(context, mode, archive, fileSet, i++, errors);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .$("validation_must_not_be_blank", "archive.name")); |
327,479 | protected double computeMinWidth(double height) {<NEW_LINE>double left = snappedLeftInset();<NEW_LINE>double right = snappedRightInset();<NEW_LINE>double leftArrowWidth = snapSize(Utils.boundedSize(leftArrowButton.prefWidth(-1), leftArrowButton.minWidth(-1), leftArrowButton.maxWidth(-1)));<NEW_LINE>double rightArrowWidth = snapSize(Utils.boundedSize(rightArrowButton.prefWidth(-1), rightArrowButton.minWidth(-1), rightArrowButton.maxWidth(-1)));<NEW_LINE>double spacing = snapSize(controlBox.getSpacing());<NEW_LINE>double pageInformationWidth = 0;<NEW_LINE>Side side = getPageInformationAlignment();<NEW_LINE>if (Side.LEFT.equals(side) || Side.RIGHT.equals(side)) {<NEW_LINE>pageInformationWidth = snapSize(<MASK><NEW_LINE>}<NEW_LINE>double arrowGap = arrowButtonGap.get();<NEW_LINE>return left + leftArrowWidth + 2 * arrowGap + minButtonSize + /*at least one button*/<NEW_LINE>2 * spacing + rightArrowWidth + right + pageInformationWidth;<NEW_LINE>} | pageInformation.prefWidth(-1)); |
749,415 | public void onError(java.lang.Exception e) {<NEW_LINE>byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;<NEW_LINE>org.apache.thrift.TSerializable msg;<NEW_LINE>ping_result result = new ping_result();<NEW_LINE>if (e instanceof ThriftSecurityException) {<NEW_LINE>result.sec = (ThriftSecurityException) e;<NEW_LINE>result.setSecIsSet(true);<NEW_LINE>msg = result;<NEW_LINE>} else if (e instanceof org.apache.thrift.transport.TTransportException) {<NEW_LINE>_LOGGER.error("TTransportException inside handler", e);<NEW_LINE>fb.close();<NEW_LINE>return;<NEW_LINE>} else if (e instanceof org.apache.thrift.TApplicationException) {<NEW_LINE>_LOGGER.error("TApplicationException inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = (org<MASK><NEW_LINE>} else {<NEW_LINE>_LOGGER.error("Exception inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>fcall.sendResponse(fb, msg, msgType, seqid);<NEW_LINE>} catch (java.lang.Exception ex) {<NEW_LINE>_LOGGER.error("Exception writing to internal frame buffer", ex);<NEW_LINE>fb.close();<NEW_LINE>}<NEW_LINE>} | .apache.thrift.TApplicationException) e; |
951,954 | public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.CapabilityExchange buildPartial() {<NEW_LINE>com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.CapabilityExchange result = new com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.CapabilityExchange(this);<NEW_LINE>int from_bitField0_ = bitField0_;<NEW_LINE>if (capabilitiesBuilder_ == null) {<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>capabilities_ = java.<MASK><NEW_LINE>bitField0_ = (bitField0_ & ~0x00000001);<NEW_LINE>}<NEW_LINE>result.capabilities_ = capabilities_;<NEW_LINE>} else {<NEW_LINE>result.capabilities_ = capabilitiesBuilder_.build();<NEW_LINE>}<NEW_LINE>onBuilt();<NEW_LINE>return result;<NEW_LINE>} | util.Collections.unmodifiableList(capabilities_); |
853,616 | static StructOrError<PathMatcher> parsePathMatcher(io.envoyproxy.envoy.config.route.v3.RouteMatch proto) {<NEW_LINE>boolean caseSensitive = proto.getCaseSensitive().getValue();<NEW_LINE>switch(proto.getPathSpecifierCase()) {<NEW_LINE>case PREFIX:<NEW_LINE>return StructOrError.fromStruct(PathMatcher.fromPrefix(proto.getPrefix(), caseSensitive));<NEW_LINE>case PATH:<NEW_LINE>return StructOrError.fromStruct(PathMatcher.fromPath(proto.getPath(), caseSensitive));<NEW_LINE>case SAFE_REGEX:<NEW_LINE>String rawPattern = proto.getSafeRegex().getRegex();<NEW_LINE>Pattern safeRegEx;<NEW_LINE>try {<NEW_LINE>safeRegEx = Pattern.compile(rawPattern);<NEW_LINE>} catch (PatternSyntaxException e) {<NEW_LINE>return StructOrError.fromError("Malformed safe regex pattern: " + e.getMessage());<NEW_LINE>}<NEW_LINE>return StructOrError.fromStruct<MASK><NEW_LINE>case PATHSPECIFIER_NOT_SET:<NEW_LINE>default:<NEW_LINE>return StructOrError.fromError("Unknown path match type");<NEW_LINE>}<NEW_LINE>} | (PathMatcher.fromRegEx(safeRegEx)); |
385,986 | protected boolean store() {<NEW_LINE>prefs.putBoolean(WinSysPrefs.EDITOR_CLOSE_ACTIVATES_RECENT, isCloseActivatesMostRecentDocument.isSelected());<NEW_LINE>prefs.putBoolean(WinSysPrefs.OPEN_DOCUMENTS_NEXT_TO_ACTIVE_TAB, isNewDocumentOpensNextToActiveTab.isSelected());<NEW_LINE>prefs.put(WinSysPrefs.EDITOR_SORT_TABS, <MASK><NEW_LINE>boolean needsWinsysRefresh = false;<NEW_LINE>needsWinsysRefresh = checkMultiRow.isSelected() != defMultiRow;<NEW_LINE>prefs.putBoolean(WinSysPrefs.DOCUMENT_TABS_MULTIROW, checkMultiRow.isSelected());<NEW_LINE>int tabPlacement = JTabbedPane.TOP;<NEW_LINE>if (radioBottom.isSelected())<NEW_LINE>tabPlacement = JTabbedPane.BOTTOM;<NEW_LINE>else if (radioLeft.isSelected())<NEW_LINE>tabPlacement = JTabbedPane.LEFT;<NEW_LINE>else if (radioRight.isSelected())<NEW_LINE>tabPlacement = JTabbedPane.RIGHT;<NEW_LINE>prefs.putInt(WinSysPrefs.DOCUMENT_TABS_PLACEMENT, tabPlacement);<NEW_LINE>needsWinsysRefresh |= tabPlacement != defTabPlacement;<NEW_LINE>return needsWinsysRefresh;<NEW_LINE>} | getSelectedSortType().name()); |
1,470,072 | public void run(RegressionEnvironment env) {<NEW_LINE>EPStatement[] statements = new EPStatement[5];<NEW_LINE>sendTimer(env, 1000);<NEW_LINE>statements[0] = env.compileDeploy("@name('stmtmetric') select * from " + StatementMetric.class.getName()).statement("stmtmetric");<NEW_LINE>statements[0].addListener(env.listenerNew());<NEW_LINE>statements[1] = env.compileDeploy("@name('runtimemetric') select * from " + RuntimeMetric.class.getName()).statement("runtimemetric");<NEW_LINE>statements[1].addListener(env.listenerNew());<NEW_LINE>statements[2] = env.compileDeploy("@name('stmt-1') select * from SupportBean(intPrimitive=1)#keepall where MyMetricFunctions.takeCPUTime(longPrimitive)").statement("stmt-1");<NEW_LINE>sendEvent(env, "E1", 1, CPUGOALONENANO);<NEW_LINE>sendTimer(env, 11000);<NEW_LINE>assertTrue(env.listener("stmtmetric").getAndClearIsInvoked());<NEW_LINE>assertTrue(env.listener<MASK><NEW_LINE>env.runtime().getMetricsService().setMetricsReportingDisabled();<NEW_LINE>sendEvent(env, "E2", 2, CPUGOALONENANO);<NEW_LINE>sendTimer(env, 21000);<NEW_LINE>assertFalse(env.listener("stmtmetric").getAndClearIsInvoked());<NEW_LINE>assertFalse(env.listener("runtimemetric").getAndClearIsInvoked());<NEW_LINE>sendTimer(env, 31000);<NEW_LINE>sendEvent(env, "E3", 3, CPUGOALONENANO);<NEW_LINE>assertFalse(env.listener("stmtmetric").getAndClearIsInvoked());<NEW_LINE>assertFalse(env.listener("runtimemetric").getAndClearIsInvoked());<NEW_LINE>env.runtime().getMetricsService().setMetricsReportingEnabled();<NEW_LINE>sendEvent(env, "E4", 4, CPUGOALONENANO);<NEW_LINE>sendTimer(env, 41000);<NEW_LINE>assertTrue(env.listener("stmtmetric").getAndClearIsInvoked());<NEW_LINE>assertTrue(env.listener("runtimemetric").getAndClearIsInvoked());<NEW_LINE>env.undeployModuleContaining(statements[2].getName());<NEW_LINE>sendTimer(env, 51000);<NEW_LINE>// metrics statements reported themselves<NEW_LINE>assertTrue(env.listener("stmtmetric").isInvoked());<NEW_LINE>assertTrue(env.listener("runtimemetric").isInvoked());<NEW_LINE>env.undeployAll();<NEW_LINE>} | ("runtimemetric").getAndClearIsInvoked()); |
417,613 | CompletableFuture<Block> importOrSavePendingBlock(final Block block, final Bytes nodeId) {<NEW_LINE>// Synchronize to avoid race condition where block import event fires after the<NEW_LINE>// blockchain.contains() check and before the block is registered, causing onBlockAdded() to be<NEW_LINE>// invoked for the parent of this block before we are able to register it.<NEW_LINE>traceLambda(LOG, "Import or save pending block {}", block::toLogString);<NEW_LINE>synchronized (pendingBlocksManager) {<NEW_LINE>if (!protocolContext.getBlockchain().contains(block.getHeader().getParentHash())) {<NEW_LINE>// Block isn't connected to local chain, save it to pending blocks collection<NEW_LINE>if (pendingBlocksManager.registerPendingBlock(block, nodeId)) {<NEW_LINE>LOG.info("Saving announced block {} for future import", block.toLogString());<NEW_LINE>}<NEW_LINE>return CompletableFuture.completedFuture(block);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!importingBlocks.add(block.getHash())) {<NEW_LINE>traceLambda(LOG, "We're already importing this block {}", block::toLogString);<NEW_LINE>return CompletableFuture.completedFuture(block);<NEW_LINE>}<NEW_LINE>if (protocolContext.getBlockchain().contains(block.getHash())) {<NEW_LINE>traceLambda(LOG, "We've already imported this block {}", block::toLogString);<NEW_LINE>importingBlocks.remove(block.getHash());<NEW_LINE>return CompletableFuture.completedFuture(block);<NEW_LINE>}<NEW_LINE>final BlockHeader parent = protocolContext.getBlockchain().getBlockHeader(block.getHeader().getParentHash()).orElseThrow(() -> new IllegalArgumentException("Incapable of retrieving header from non-existent parent of " + block.toLogString()));<NEW_LINE>final ProtocolSpec protocolSpec = protocolSchedule.getByBlockNumber(block.<MASK><NEW_LINE>final BlockHeaderValidator blockHeaderValidator = protocolSpec.getBlockHeaderValidator();<NEW_LINE>final BadBlockManager badBlockManager = protocolSpec.getBadBlocksManager();<NEW_LINE>return ethContext.getScheduler().scheduleSyncWorkerTask(() -> validateAndProcessPendingBlock(blockHeaderValidator, block, parent, badBlockManager));<NEW_LINE>} | getHeader().getNumber()); |
181,207 | public Sql createIndexSql(Entity<?> en, EntityIndex index) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>if (index.isUnique())<NEW_LINE>sb.append("Create UNIQUE Index ");<NEW_LINE>else<NEW_LINE>sb.append("Create Index ");<NEW_LINE>sb.append(index.getName(en));<NEW_LINE>sb.append(" ON ").append(en.getTableName()).append("(");<NEW_LINE>for (EntityField field : index.getFields()) {<NEW_LINE>if (field instanceof MappingField) {<NEW_LINE>MappingField mf = (MappingField) field;<NEW_LINE>sb.append(mf.getColumnNameInSql()).append(',');<NEW_LINE>} else {<NEW_LINE>throw Lang.makeThrow(DaoException.class, "%s %s is NOT a mapping field, can't use as index field!!", en.getClass(), field.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sb.setCharAt(sb.length() - 1, ')');<NEW_LINE>return Sqls.<MASK><NEW_LINE>} | create(sb.toString()); |
890,581 | public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException {<NEW_LINE>long language = new Long(key.language);<NEW_LINE>Optional<ContentletVersionInfo> info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language);<NEW_LINE>if ((!info.isPresent() || key.mode.showLive && !UtilMethods.isSet(info.get().getLiveInode())) && shouldCheckForVersionInfoInDefaultLanguage(language)) {<NEW_LINE>info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defaultLang);<NEW_LINE>}<NEW_LINE>if (!info.isPresent() || key.mode.showLive && !UtilMethods.isSet(info.get().getLiveInode())) {<NEW_LINE>throw new ResourceNotFoundException("cannot find content for: " + key);<NEW_LINE>}<NEW_LINE>Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.get().getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.get().getWorkingInode(), <MASK><NEW_LINE>Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode());<NEW_LINE>if (null == contentlet) {<NEW_LINE>throw new ResourceNotFoundException("cannot find content for: " + key);<NEW_LINE>}<NEW_LINE>return buildVelocity(contentlet, key.mode, key.path);<NEW_LINE>} | APILocator.systemUser(), false); |
466,353 | public static ListSystemRulesResponse unmarshall(ListSystemRulesResponse listSystemRulesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listSystemRulesResponse.setRequestId(_ctx.stringValue("ListSystemRulesResponse.RequestId"));<NEW_LINE>listSystemRulesResponse.setCode(_ctx.stringValue("ListSystemRulesResponse.Code"));<NEW_LINE>listSystemRulesResponse.setMessage(_ctx.stringValue("ListSystemRulesResponse.Message"));<NEW_LINE>listSystemRulesResponse.setSuccess(_ctx.booleanValue("ListSystemRulesResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setTotalCount(_ctx.integerValue("ListSystemRulesResponse.Data.TotalCount"));<NEW_LINE>data.setTotalPage(_ctx.integerValue("ListSystemRulesResponse.Data.TotalPage"));<NEW_LINE>data.setPageIndex<MASK><NEW_LINE>data.setPageSize(_ctx.integerValue("ListSystemRulesResponse.Data.PageSize"));<NEW_LINE>List<DatasItem> datas = new ArrayList<DatasItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListSystemRulesResponse.Data.Datas.Length"); i++) {<NEW_LINE>DatasItem datasItem = new DatasItem();<NEW_LINE>datasItem.setAppName(_ctx.stringValue("ListSystemRulesResponse.Data.Datas[" + i + "].AppName"));<NEW_LINE>datasItem.setMetricType(_ctx.integerValue("ListSystemRulesResponse.Data.Datas[" + i + "].MetricType"));<NEW_LINE>datasItem.setThreshold(_ctx.floatValue("ListSystemRulesResponse.Data.Datas[" + i + "].Threshold"));<NEW_LINE>datasItem.setEnable(_ctx.booleanValue("ListSystemRulesResponse.Data.Datas[" + i + "].Enable"));<NEW_LINE>datasItem.setRuleId(_ctx.longValue("ListSystemRulesResponse.Data.Datas[" + i + "].RuleId"));<NEW_LINE>datasItem.setNamespace(_ctx.stringValue("ListSystemRulesResponse.Data.Datas[" + i + "].Namespace"));<NEW_LINE>datas.add(datasItem);<NEW_LINE>}<NEW_LINE>data.setDatas(datas);<NEW_LINE>listSystemRulesResponse.setData(data);<NEW_LINE>return listSystemRulesResponse;<NEW_LINE>} | (_ctx.integerValue("ListSystemRulesResponse.Data.PageIndex")); |
1,853,657 | private Element processReadException(@Nullable Exception e) {<NEW_LINE>boolean contentTruncated = e == null;<NEW_LINE>myBlockSavingTheContent = !contentTruncated && (StorageUtil.isProjectOrModuleFile(myFileSpec) || myFileSpec.equals(StoragePathMacros.WORKSPACE_FILE));<NEW_LINE>if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {<NEW_LINE>if (e != null) {<NEW_LINE>LOG.info(e);<NEW_LINE>}<NEW_LINE>new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "Load Settings", "Cannot load settings from file '" + myFile.getPath() + "': " + (e == null ? "content truncated" : e.getMessage()) + "\n" + (myBlockSavingTheContent ? "Please correct the file content" : "File content will be recreated"), NotificationType<MASK><NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | .WARNING).notify(null); |
1,377,100 | private okhttp3.Call replaceNamespacedLeaseValidateBeforeCall(String name, String namespace, V1Lease body, String pretty, String dryRun, String fieldManager, String fieldValidation, final ApiCallback _callback) throws ApiException {<NEW_LINE>// verify the required parameter 'name' is set<NEW_LINE>if (name == null) {<NEW_LINE>throw new ApiException("Missing the required parameter 'name' when calling replaceNamespacedLease(Async)");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'namespace' is set<NEW_LINE>if (namespace == null) {<NEW_LINE>throw new ApiException("Missing the required parameter 'namespace' when calling replaceNamespacedLease(Async)");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'body' is set<NEW_LINE>if (body == null) {<NEW_LINE>throw new ApiException("Missing the required parameter 'body' when calling replaceNamespacedLease(Async)");<NEW_LINE>}<NEW_LINE>okhttp3.Call localVarCall = replaceNamespacedLeaseCall(name, namespace, body, pretty, <MASK><NEW_LINE>return localVarCall;<NEW_LINE>} | dryRun, fieldManager, fieldValidation, _callback); |
928,723 | protected void undeployLeftoverJobs() {<NEW_LINE>try {<NEW_LINE>// See if there are jobs running on any helios agent. If we are using TemporaryJobs,<NEW_LINE>// that class should've undeployed them at this point.<NEW_LINE>// Any jobs still running at this point have only been partially cleaned up.<NEW_LINE>// We look for jobs via hostStatus() because the job may have been deleted from the master,<NEW_LINE>// but the agent may still not have had enough time to undeploy the job from itself.<NEW_LINE>final List<String> hosts = heliosClient.listHosts().get();<NEW_LINE>for (final String host : hosts) {<NEW_LINE>final HostStatus hostStatus = heliosClient.hostStatus(host).get();<NEW_LINE>final Map<JobId, TaskStatus> statuses = hostStatus.getStatuses();<NEW_LINE>for (final Map.Entry<JobId, TaskStatus> status : statuses.entrySet()) {<NEW_LINE>final JobId jobId = status.getKey();<NEW_LINE>final Goal goal = status.getValue().getGoal();<NEW_LINE>if (goal != Goal.UNDEPLOY) {<NEW_LINE>log.info("Job {} is still set to {} on host {}. Undeploying it now.", jobId, goal, host);<NEW_LINE>final JobUndeployResponse undeployResponse = heliosClient.undeploy(jobId, host).get();<NEW_LINE>log.info("Undeploy response for job {} is {}.", <MASK><NEW_LINE>if (undeployResponse.getStatus() != JobUndeployResponse.Status.OK) {<NEW_LINE>log.warn("Undeploy response for job {} was not OK. This could mean that something " + "beat the helios-solo master in telling the helios-solo agent to " + "undeploy.", jobId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.info("Waiting for job {} to actually be undeployed...", jobId);<NEW_LINE>awaitJobUndeployed(heliosClient, host, jobId, jobUndeployWaitSeconds, TimeUnit.SECONDS);<NEW_LINE>log.info("Job {} successfully undeployed.", jobId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.warn("Exception occurred when trying to clean up leftover jobs.", e);<NEW_LINE>}<NEW_LINE>} | jobId, undeployResponse.getStatus()); |
1,579,688 | protected void handleRequest(final HttpServletRequest request, final HttpServletResponse response, final HttpSession hSession) throws ServletException, IOException {<NEW_LINE>final PrintWriter out = response.getWriter();<NEW_LINE>final long start = System.nanoTime();<NEW_LINE>// Pick a random timeout point between [TIMEOUT_BASE, TIMEOUT_BASE + TIMEOUT_RANDOMNESS)<NEW_LINE>// nanoseconds from now.<NEW_LINE>final long end = start + TIMEOUT_BASE + (long) (Math.random() * TIMEOUT_RANDOMNESS);<NEW_LINE>final User user = (User) hSession.getAttribute(SessionAttribute.USER);<NEW_LINE>assert (user != null);<NEW_LINE>user.contactedServer();<NEW_LINE>while (!(user.hasQueuedMessages()) && System.nanoTime() - end < 0) {<NEW_LINE>try {<NEW_LINE>user.waitForNewMessageNotification(TimeUnit.NANOSECONDS.toMillis(end - System.nanoTime()));<NEW_LINE>} catch (final InterruptedException ie) {<NEW_LINE>// pass<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (user.hasQueuedMessages()) {<NEW_LINE>try {<NEW_LINE>// Delay for a short while in case there will be other messages queued to be delivered.<NEW_LINE>// This will certainly happen in some game states. We want to deliver as much to the client<NEW_LINE>// in as few round-trips as possible while not waiting too long.<NEW_LINE>Thread.sleep(WAIT_FOR_MORE_DELAY);<NEW_LINE>} catch (final InterruptedException ie) {<NEW_LINE>// pass<NEW_LINE>}<NEW_LINE>final Collection<QueuedMessage> msgs = user.getNextQueuedMessages(MAX_MESSAGES_PER_POLL);<NEW_LINE>// just in case...<NEW_LINE>if (msgs.size() > 0) {<NEW_LINE>final List<Map<ReturnableData, Object>> data = new ArrayList<Map<ReturnableData, Object>>(msgs.size());<NEW_LINE>for (final QueuedMessage qm : msgs) {<NEW_LINE>data.add(qm.getData());<NEW_LINE>}<NEW_LINE>returnArray(user, out, data);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// otherwise, return that there is no new data<NEW_LINE>final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>();<NEW_LINE>data.put(LongPollResponse.EVENT, LongPollEvent.NOOP.toString());<NEW_LINE>data.put(LongPollResponse.TIMESTAMP, System.currentTimeMillis());<NEW_LINE><MASK><NEW_LINE>} | returnData(user, out, data); |
302,258 | public void defineClassificationStructure(String line) {<NEW_LINE>List<ParsedProbability> list = ParseProbability.parseProbabilityList(this, line);<NEW_LINE>if (list.size() > 1) {<NEW_LINE>throw new BayesianError("Must only define a single probability, not a chain.");<NEW_LINE>}<NEW_LINE>if (list.size() == 0) {<NEW_LINE>throw new BayesianError("Must define at least one probability.");<NEW_LINE>}<NEW_LINE>// first define everything to be hidden<NEW_LINE>for (BayesianEvent event : this.events) {<NEW_LINE>this.query.defineEventType(event, EventType.Hidden);<NEW_LINE>}<NEW_LINE>// define the base event<NEW_LINE>ParsedProbability prob = list.get(0);<NEW_LINE>if (prob.getBaseEvents().size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BayesianEvent be = this.getEvent(prob.getChildEvent().getLabel());<NEW_LINE>this.classificationTarget = this.events.indexOf(be);<NEW_LINE>this.query.defineEventType(be, EventType.Outcome);<NEW_LINE>// define the given events<NEW_LINE>for (ParsedEvent parsedGiven : prob.getGivenEvents()) {<NEW_LINE>BayesianEvent given = this.getEvent(parsedGiven.getLabel());<NEW_LINE>this.query.defineEventType(given, EventType.Evidence);<NEW_LINE>}<NEW_LINE>this.query.locateEventTypes();<NEW_LINE>// set the values<NEW_LINE>for (ParsedEvent parsedGiven : prob.getGivenEvents()) {<NEW_LINE>BayesianEvent event = this.getEvent(parsedGiven.getLabel());<NEW_LINE>this.query.setEventValue(event, parseInt<MASK><NEW_LINE>}<NEW_LINE>this.query.setEventValue(be, parseInt(prob.getBaseEvents().get(0).getValue()));<NEW_LINE>} | (parsedGiven.getValue())); |
393,637 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see com.impetus.kundera.client.Client#find(java.lang.Class,<NEW_LINE>* java.lang.Object)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public Object find(Class entityClass, Object key) {<NEW_LINE>EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);<NEW_LINE>GetResponse get = null;<NEW_LINE>MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());<NEW_LINE>EntityType entityType = metaModel.entity(metadata.getEntityClazz());<NEW_LINE>String keyAsString = getKeyAsString(key, metadata, metaModel);<NEW_LINE>try {<NEW_LINE>get = txClient.prepareGet(metadata.getSchema().toLowerCase(), metadata.getTableName(), keyAsString).setOperationThreaded(false).execute().get();<NEW_LINE>} catch (InterruptedException iex) {<NEW_LINE>logger.error("Error while find record of {}, Caused by :.", entityClass.getSimpleName(), iex);<NEW_LINE>throw new PersistenceException(iex);<NEW_LINE>} catch (ExecutionException eex) {<NEW_LINE>logger.error("Error while find record of {}, Caused by :.", entityClass.getSimpleName(), eex);<NEW_LINE>throw new PersistenceException(eex);<NEW_LINE>}<NEW_LINE>Map<String, Object> results = get.getSource();<NEW_LINE>Object result = null;<NEW_LINE>if (get.isExists()) {<NEW_LINE>result = KunderaCoreUtils.createNewInstance(entityClass);<NEW_LINE>PropertyAccessorHelper.setId(result, metadata, key);<NEW_LINE>result = esResponseReader.wrapFindResult(results, <MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | entityType, result, metadata, true); |
1,794,622 | public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {<NEW_LINE>if (!shouldHoistConstantExpressions()) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (!INIT_LOGGER.matches(tree, state)) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>Type loggerType = LOGGER_TYPE.get(state);<NEW_LINE>if (loggerType == null) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>// An expression should always be inside of a method or a variable (initializer blocks count as<NEW_LINE>// a method), but just in case we use class as a final backstop.<NEW_LINE>TreePath owner = state.findPathToEnclosing(ClassTree.class, MethodTree.class, VariableTree.class);<NEW_LINE>Tree parent = owner.getLeaf();<NEW_LINE>Tree grandparent = owner.getParentPath().getLeaf();<NEW_LINE>boolean isLoggerField = parent instanceof VariableTree && grandparent instanceof ClassTree && ASTHelpers.isSameType(loggerType, ASTHelpers.getType(parent), state);<NEW_LINE>if (isLoggerField) {<NEW_LINE>// Declared as a class member - matchVariable will already have fixed the modifiers, and we<NEW_LINE>// allow calls to forEnclosingClass() in initializer context, so we can just quit here<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>// See if they're defining a static method that produces a FluentLogger. If so, we assume they<NEW_LINE>// are using it to initialize their FluentLogger instance, and we don't stop them from calling<NEW_LINE>// FluentLogger.forEnclosingClass() inside the method.<NEW_LINE>MethodTree owningMethod = state.findEnclosing(MethodTree.class);<NEW_LINE>if (owningMethod != null) {<NEW_LINE>MethodSymbol methodSym = ASTHelpers.getSymbol(owningMethod);<NEW_LINE>if (methodSym != null) {<NEW_LINE><MASK><NEW_LINE>// Could be null for initializer blocks<NEW_LINE>if (ASTHelpers.isSameType(loggerType, returnType, state)) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// They're using forEnclosingClass inside a method that doesn't produce a logger, or in the<NEW_LINE>// initializer for some variable that's not a logger. We'll replace this with a reference to a<NEW_LINE>// class-level logger.<NEW_LINE>state.incrementCounter(this, parent instanceof VariableTree ? "local-variable" : "inline");<NEW_LINE>return replaceWithFieldLookup(tree, state);<NEW_LINE>} | Type returnType = methodSym.getReturnType(); |
1,401,816 | public void paint(@Nonnull Graphics2D g2, int x, int y, int height) {<NEW_LINE>if (myLabels.isEmpty())<NEW_LINE>return;<NEW_LINE>GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);<NEW_LINE>g2.setFont(getReferenceFont());<NEW_LINE>g2.setStroke(new BasicStroke(1.5f));<NEW_LINE>FontMetrics fontMetrics = g2.getFontMetrics();<NEW_LINE>int baseLine = SimpleColoredComponent.getTextBaseLine(fontMetrics, height);<NEW_LINE>g2.setColor(myBackground);<NEW_LINE>g2.fillRect(x, y, myWidth, height);<NEW_LINE>if (myGreyBackground != null && myCompact) {<NEW_LINE>g2.setColor(myGreyBackground);<NEW_LINE>g2.fillRect(x, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING, myWidth, fontMetrics.<MASK><NEW_LINE>}<NEW_LINE>x += LEFT_PADDING;<NEW_LINE>for (Pair<String, LabelIcon> label : myLabels) {<NEW_LINE>LabelIcon icon = label.second;<NEW_LINE>String text = label.first;<NEW_LINE>if (myGreyBackground != null && !myCompact) {<NEW_LINE>g2.setColor(myGreyBackground);<NEW_LINE>g2.fill(new RoundRectangle2D.Double(x - LEFT_PADDING, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING, icon.getIconWidth() + fontMetrics.stringWidth(text) + 3 * LEFT_PADDING, fontMetrics.getHeight() + TOP_TEXT_PADDING + BOTTOM_TEXT_PADDING, LABEL_ARC, LABEL_ARC));<NEW_LINE>}<NEW_LINE>icon.paintIcon(null, g2, x, y + (height - icon.getIconHeight()) / 2);<NEW_LINE>x += icon.getIconWidth();<NEW_LINE>g2.setColor(myForeground);<NEW_LINE>g2.drawString(text, x, y + baseLine);<NEW_LINE>x += fontMetrics.stringWidth(text) + (myCompact ? COMPACT_MIDDLE_PADDING : MIDDLE_PADDING);<NEW_LINE>}<NEW_LINE>config.restore();<NEW_LINE>} | getHeight() + TOP_TEXT_PADDING + BOTTOM_TEXT_PADDING); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.