idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,524,508 | final DBClusterSnapshotAttributesResult executeModifyDBClusterSnapshotAttribute(ModifyDBClusterSnapshotAttributeRequest modifyDBClusterSnapshotAttributeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyDBClusterSnapshotAttributeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyDBClusterSnapshotAttributeRequest> request = null;<NEW_LINE>Response<DBClusterSnapshotAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyDBClusterSnapshotAttributeRequestMarshaller().marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Neptune");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyDBClusterSnapshotAttribute");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DBClusterSnapshotAttributesResult> responseHandler = new StaxResponseHandler<DBClusterSnapshotAttributesResult>(new DBClusterSnapshotAttributesResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(modifyDBClusterSnapshotAttributeRequest)); |
413,298 | public void updateQtyTU(final I_C_Invoice_Line_Alloc invoiceLineAlloc) {<NEW_LINE>final IProductBL productBL = <MASK><NEW_LINE>//<NEW_LINE>// Get Invoice Line<NEW_LINE>if (invoiceLineAlloc.getC_InvoiceLine_ID() <= 0) {<NEW_LINE>// shouldn't happen, but it's not really our business<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final I_C_InvoiceLine invoiceLine = InterfaceWrapperHelper.create(invoiceLineAlloc.getC_InvoiceLine(), I_C_InvoiceLine.class);<NEW_LINE>final boolean isFreightCost = productBL.getProductType(ProductId.ofRepoId(invoiceLine.getM_Product_ID())).isFreightCost();<NEW_LINE>if (isFreightCost) {<NEW_LINE>// the freight cost doesn't need any Qty TU<NEW_LINE>invoiceLine.setQtyEnteredTU(BigDecimal.ZERO);<NEW_LINE>save(invoiceLine);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// 08469<NEW_LINE>final BigDecimal qtyTUs;<NEW_LINE>final I_M_InOutLine iol = InterfaceWrapperHelper.create(invoiceLine.getM_InOutLine(), I_M_InOutLine.class);<NEW_LINE>if (iol != null) {<NEW_LINE>qtyTUs = iol.getQtyEnteredTU();<NEW_LINE>} else //<NEW_LINE>// Update Invoice Line<NEW_LINE>{<NEW_LINE>qtyTUs = calculateQtyTUsFromInvoiceCandidates(invoiceLine);<NEW_LINE>}<NEW_LINE>invoiceLine.setQtyEnteredTU(qtyTUs);<NEW_LINE>save(invoiceLine);<NEW_LINE>} | Services.get(IProductBL.class); |
136,614 | public void testDeliveryDelayForDifferentDelaysTopicClassicApi(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>TopicConnection con = jmsTCFBindings.createTopicConnection();<NEW_LINE>con.start();<NEW_LINE>Topic topic = (Topic) new InitialContext().lookup("java:comp/env/eis/topic");<NEW_LINE>TopicSession session = con.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);<NEW_LINE>TopicPublisher publisher = session.createPublisher(topic);<NEW_LINE>int delay = 15100;<NEW_LINE>publisher.setDeliveryDelay(delay);<NEW_LINE>StreamMessage sm = session.createStreamMessage();<NEW_LINE>String msgText = "TopicBindingsMessage1-ClassicApi";<NEW_LINE>sm.writeString(msgText);<NEW_LINE>sm.writeLong(Calendar.getInstance().getTimeInMillis() + delay);<NEW_LINE>publisher.publish(sm);<NEW_LINE>delay = 11200;<NEW_LINE>publisher.setDeliveryDelay(delay);<NEW_LINE>sm = session.createStreamMessage();<NEW_LINE>msgText = "TopicBindingsMessage2-ClassicApi";<NEW_LINE>sm.writeString(msgText);<NEW_LINE>sm.writeLong(Calendar.getInstance(<MASK><NEW_LINE>publisher.publish(sm);<NEW_LINE>Thread.sleep(20000);<NEW_LINE>con.close();<NEW_LINE>} | ).getTimeInMillis() + delay); |
310,353 | public boolean preload(SourceLoader sourceLoader) {<NEW_LINE>SourceLibrary library = sourceLoader.getLibrary();<NEW_LINE>ModulePath modulePath = getModulePath();<NEW_LINE>ChildGroup group = null;<NEW_LINE>try (InputStream inputStream = getInputStream()) {<NEW_LINE>if (inputStream == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>CodedInputStream codedInputStream = CodedInputStream.newInstance(inputStream);<NEW_LINE>codedInputStream.setRecursionLimit(Integer.MAX_VALUE);<NEW_LINE>ModuleProtos.Module moduleProto = ModuleProtos.Module.parseFrom(codedInputStream);<NEW_LINE>boolean isComplete = moduleProto.getComplete();<NEW_LINE>if (!isComplete && !library.hasRawSources()) {<NEW_LINE>sourceLoader.getLibraryErrorReporter().report(new PartialModuleError(modulePath));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (ModuleProtos.ModuleCallTargets moduleCallTargets : moduleProto.getModuleCallTargetsList()) {<NEW_LINE>ModulePath module = new ModulePath(moduleCallTargets.getNameList());<NEW_LINE>sourceLoader.markDependency(modulePath, module);<NEW_LINE>if (library.containsModule(module) && !sourceLoader.preloadBinary(module, myKeyRegistry, myDefinitionListener)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ReferableConverter referableConverter = sourceLoader.getReferableConverter();<NEW_LINE>myModuleDeserialization = new ModuleDeserialization(moduleProto, referableConverter, myKeyRegistry, myDefinitionListener, library instanceof PreludeLibrary);<NEW_LINE>if (!sourceLoader.isInPreviewBinariesMode()) {<NEW_LINE>if (referableConverter == null) {<NEW_LINE>group = myModuleDeserialization.readGroup(new ModuleLocation(library, ModuleLocation.LocationKind.SOURCE, modulePath));<NEW_LINE>library.groupLoaded(modulePath, group, false, false);<NEW_LINE>} else {<NEW_LINE>group = library.getModuleGroup(modulePath, false);<NEW_LINE>if (group == null) {<NEW_LINE>sourceLoader.getLibraryErrorReporter().report(LibraryError.moduleNotFound(modulePath, library.getName()));<NEW_LINE>library.groupLoaded(<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>myModuleDeserialization.readDefinitions(group);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} catch (IOException | DeserializationException e) {<NEW_LINE>loadingFailed(sourceLoader, modulePath, group, e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | modulePath, null, false, false); |
1,471,801 | private double f(int state, Double[] dp, int[] history) {<NEW_LINE>if (dp[state] != null) {<NEW_LINE>return dp[state];<NEW_LINE>}<NEW_LINE>if (state == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int p1, p2;<NEW_LINE>// Seek to find active bit position (p1)<NEW_LINE>for (p1 = 0; p1 < n; p1++) {<NEW_LINE>if ((state & (1 << p1)) > 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int bestState = -1;<NEW_LINE>double minimum = Double.MAX_VALUE;<NEW_LINE>for (p2 = p1 + 1; p2 < n; p2++) {<NEW_LINE>// Position `p2` is on. Try matching the pair (p1, p2) together.<NEW_LINE>if ((state & (1 << p2)) > 0) {<NEW_LINE>int reducedState = state ^ (1 << <MASK><NEW_LINE>double matchCost = f(reducedState, dp, history) + cost[p1][p2];<NEW_LINE>if (matchCost < minimum) {<NEW_LINE>minimum = matchCost;<NEW_LINE>bestState = reducedState;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>history[state] = bestState;<NEW_LINE>return dp[state] = minimum;<NEW_LINE>} | p1) ^ (1 << p2); |
1,028,057 | public List<Map<String, String>> entries() {<NEW_LINE>if (raw.isEmpty())<NEW_LINE>return emptyList();<NEW_LINE>List<String> headers = raw.get(0);<NEW_LINE>List<Map<String, String>> headersAndRows = new ArrayList<>();<NEW_LINE>for (int i = 1; i < raw.size(); i++) {<NEW_LINE>List<String> row = raw.get(i);<NEW_LINE>LinkedHashMap<String, String> headersAndRow = new LinkedHashMap<>();<NEW_LINE>for (int j = 0; j < headers.size(); j++) {<NEW_LINE>String <MASK><NEW_LINE>String value = row.get(j);<NEW_LINE>if (headersAndRow.containsKey(key)) {<NEW_LINE>String wouldBeReplaced = headersAndRow.get(key);<NEW_LINE>throw duplicateKeyException(String.class, String.class, key, value, wouldBeReplaced);<NEW_LINE>}<NEW_LINE>headersAndRow.put(key, value);<NEW_LINE>}<NEW_LINE>headersAndRows.add(unmodifiableMap(headersAndRow));<NEW_LINE>}<NEW_LINE>return unmodifiableList(headersAndRows);<NEW_LINE>} | key = headers.get(j); |
990,386 | final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTagsForResourceRequest> request = null;<NEW_LINE>Response<ListTagsForResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SSM Contacts");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListTagsForResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
315,280 | public TransferResult<V, S> visitFieldAccess(FieldAccessNode n, TransferInput<V, S> p) {<NEW_LINE>TransferResult<V, S> result = super.visitFieldAccess(n, p);<NEW_LINE>assert !result.containsTwoStores();<NEW_LINE>S store = result.getRegularStore();<NEW_LINE>if (store.isFieldInitialized(n.getElement()) && n.getReceiver() instanceof ThisNode) {<NEW_LINE>AnnotatedTypeMirror fieldAnno = analysis.getTypeFactory().getAnnotatedType(n.getElement());<NEW_LINE>// Only if the field has the type system's invariant annotation,<NEW_LINE>// such as @NonNull.<NEW_LINE>if (fieldAnno.hasAnnotation(atypeFactory.getFieldInvariantAnnotation())) {<NEW_LINE>AnnotationMirror inv = atypeFactory.getFieldInvariantAnnotation();<NEW_LINE>V oldResultValue = result.getResultValue();<NEW_LINE>V refinedResultValue = analysis.createSingleAnnotationValue(<MASK><NEW_LINE>V newResultValue = refinedResultValue.mostSpecific(oldResultValue, null);<NEW_LINE>result.setResultValue(newResultValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | inv, oldResultValue.getUnderlyingType()); |
237,906 | public com.amazonaws.services.lexruntime.model.UnsupportedMediaTypeException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.lexruntime.model.UnsupportedMediaTypeException unsupportedMediaTypeException = new com.amazonaws.services.lexruntime.model.UnsupportedMediaTypeException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return unsupportedMediaTypeException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
992,443 | public Flux<CommandResponse<GroupCommand, String>> xGroup(Publisher<GroupCommand> commands) {<NEW_LINE>return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {<NEW_LINE>Assert.notNull(command.getKey(), "Key must not be null!");<NEW_LINE>Assert.notNull(command.getGroupName(), "GroupName must not be null!");<NEW_LINE>if (command.getAction().equals(GroupCommandAction.CREATE)) {<NEW_LINE>Assert.notNull(command.getReadOffset(), "ReadOffset must not be null!");<NEW_LINE>StreamOffset offset = StreamOffset.from(command.getKey(), command.<MASK><NEW_LINE>return cmd.xgroupCreate(offset, ByteUtils.getByteBuffer(command.getGroupName()), XGroupCreateArgs.Builder.mkstream(command.isMkStream())).map(it -> new CommandResponse<>(command, it));<NEW_LINE>}<NEW_LINE>if (command.getAction().equals(GroupCommandAction.DELETE_CONSUMER)) {<NEW_LINE>return cmd.xgroupDelconsumer(command.getKey(), io.lettuce.core.Consumer.from(ByteUtils.getByteBuffer(command.getGroupName()), ByteUtils.getByteBuffer(command.getConsumerName()))).map(it -> new CommandResponse<>(command, "OK"));<NEW_LINE>}<NEW_LINE>if (command.getAction().equals(GroupCommandAction.DESTROY)) {<NEW_LINE>return cmd.xgroupDestroy(command.getKey(), ByteUtils.getByteBuffer(command.getGroupName())).map(it -> new CommandResponse<>(command, Boolean.TRUE.equals(it) ? "OK" : "Error"));<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Unknown group command " + command.getAction());<NEW_LINE>}));<NEW_LINE>} | getReadOffset().getOffset()); |
609,958 | public void translate(ProxySession session, ServerPlayerActionAckPacket packet) {<NEW_LINE>if (!packet.isSuccessful()) {<NEW_LINE>log.info(TextFormat.GRAY + "(debug) Player action not successful: " + packet.getAction().name());<NEW_LINE>// return;<NEW_LINE>}<NEW_LINE>LevelEventPacket levelEventPacket = new LevelEventPacket();<NEW_LINE>Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ());<NEW_LINE>switch(packet.getAction()) {<NEW_LINE>case START_DIGGING:<NEW_LINE>double breakTime = Math.ceil(BlockUtils.getBreakTime(session.getCachedEntity().getMainHand(), BlockTranslator.translateToBedrock(packet.getNewState())) * 20);<NEW_LINE>levelEventPacket.setType(LevelEventType.BLOCK_START_BREAK);<NEW_LINE>levelEventPacket.setPosition(position);<NEW_LINE>levelEventPacket.setData((int) (65535 / breakTime));<NEW_LINE>break;<NEW_LINE>case CANCEL_DIGGING:<NEW_LINE><MASK><NEW_LINE>levelEventPacket.setPosition(position);<NEW_LINE>levelEventPacket.setData(0);<NEW_LINE>session.sendPacket(levelEventPacket);<NEW_LINE>break;<NEW_LINE>case FINISH_DIGGING:<NEW_LINE>session.getChunkCache().updateBlock(session, position.toInt(), packet.getNewState());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | levelEventPacket.setType(LevelEventType.BLOCK_STOP_BREAK); |
670,575 | public double modifiedDurationFromYield(ResolvedFixedCouponBond bond, LocalDate settlementDate, double yield) {<NEW_LINE>ImmutableList<FixedCouponBondPaymentPeriod> payments = bond.getPeriodicPayments();<NEW_LINE>int nCoupon = payments.size() - couponIndex(payments, settlementDate);<NEW_LINE>FixedCouponBondYieldConvention yieldConv = bond.getYieldConvention();<NEW_LINE>if (nCoupon == 1) {<NEW_LINE>if (yieldConv.equals(US_STREET) || yieldConv.equals(DE_BONDS)) {<NEW_LINE>double couponPerYear = bond.getFrequency().eventsPerYear();<NEW_LINE>double factor = factorToNextCoupon(bond, settlementDate);<NEW_LINE>return factor / couponPerYear / (1d + factor * yield / couponPerYear);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (yieldConv.equals(US_STREET) || yieldConv.equals(GB_BUMP_DMO) || yieldConv.equals(DE_BONDS)) {<NEW_LINE>return modifiedDurationFromYieldStandard(bond, settlementDate, yield);<NEW_LINE>}<NEW_LINE>if (yieldConv.equals(JP_SIMPLE)) {<NEW_LINE><MASK><NEW_LINE>if (settlementDate.isAfter(maturityDate)) {<NEW_LINE>return 0d;<NEW_LINE>}<NEW_LINE>double maturity = bond.getDayCount().relativeYearFraction(settlementDate, maturityDate);<NEW_LINE>double num = 1d + bond.getFixedRate() * maturity;<NEW_LINE>double den = 1d + yield * maturity;<NEW_LINE>double dirtyPrice = dirtyPriceFromCleanPrice(bond, settlementDate, num / den);<NEW_LINE>return num * maturity / den / den / dirtyPrice;<NEW_LINE>}<NEW_LINE>throw new UnsupportedOperationException("The convention " + yieldConv.name() + " is not supported.");<NEW_LINE>} | LocalDate maturityDate = bond.getUnadjustedEndDate(); |
612,134 | MethodTree generateFormMethod(TreeMaker maker, WorkingCopy copy) {<NEW_LINE>// NOI18N<NEW_LINE>String mvMapClass = "javax.ws.rs.core.MultivaluedMap";<NEW_LINE>TypeElement mvMapEl = copy.getElements().getTypeElement(mvMapClass);<NEW_LINE>// NOI18N<NEW_LINE>String mvType = mvMapEl == null ? mvMapClass : "MultivaluedMap";<NEW_LINE>// NOI18N<NEW_LINE>String // NOI18N<NEW_LINE>body = // NOI18N<NEW_LINE>"{" + mvType + // NOI18N<NEW_LINE>"<String,String> qParams = new com.sun.jersey.api.representation.Form();" + // NOI18N<NEW_LINE>"for (int i=0;i< paramNames.length;i++) {" + // NOI18N<NEW_LINE>" if (paramValues[i] != null) {" + // NOI18N<NEW_LINE>" qParams.add(paramNames[i], paramValues[i]);" + // NOI18N<NEW_LINE>" }" + // NOI18N<NEW_LINE>"}" + // NOI18N<NEW_LINE>"return qParams;" + "}";<NEW_LINE>ModifiersTree methodModifier = maker.Modifiers(Collections.<Modifier>singleton(Modifier.PRIVATE));<NEW_LINE>ExpressionTree returnTree = mvMapEl == null ? copy.getTreeMaker().Identifier(mvMapClass) : copy.<MASK><NEW_LINE>List<VariableTree> paramList = new ArrayList<VariableTree>();<NEW_LINE>ModifiersTree paramModifier = maker.Modifiers(Collections.<Modifier>emptySet());<NEW_LINE>// NOI18N<NEW_LINE>paramList.add(maker.Variable(paramModifier, "paramNames", maker.Identifier("String[]"), null));<NEW_LINE>// NOI18N<NEW_LINE>paramList.add(maker.Variable(paramModifier, "paramValues", maker.Identifier("String[]"), null));<NEW_LINE>return // NOI18N<NEW_LINE>maker.// NOI18N<NEW_LINE>Method(// NOI18N<NEW_LINE>methodModifier, // NOI18N<NEW_LINE>"getQueryOrFormParams", // NOI18N<NEW_LINE>returnTree, // NOI18N<NEW_LINE>Collections.<TypeParameterTree>emptyList(), // NOI18N<NEW_LINE>paramList, // NOI18N<NEW_LINE>Collections.<ExpressionTree>emptyList(), // NOI18N<NEW_LINE>body, null);<NEW_LINE>} | getTreeMaker().QualIdent(mvMapEl); |
1,089,698 | protected Control createDialogArea(Composite parent) {<NEW_LINE>Composite compositeTop = (Composite) super.createDialogArea(parent);<NEW_LINE>String titleMsg;<NEW_LINE>if (confirmPassword)<NEW_LINE>titleMsg = Messages.passwordChangeTitle;<NEW_LINE>else if (passwordChange)<NEW_LINE>titleMsg = Messages.messageLoginChange;<NEW_LINE>else<NEW_LINE>titleMsg = Messages.dialogTitle;<NEW_LINE>setTitle(titleMsg);<NEW_LINE>Composite composite = new <MASK><NEW_LINE>new Label(composite, SWT.LEFT).setText(Messages.labelPassword);<NEW_LINE>password = new Text(composite, SWT.LEFT | SWT.BORDER);<NEW_LINE>password.addModifyListener(new ModifyListener() {<NEW_LINE><NEW_LINE>public void modifyText(ModifyEvent event) {<NEW_LINE>okButton.setEnabled(validatePassword());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (confirmPassword) {<NEW_LINE>new Label(composite, SWT.LEFT).setText(Messages.labelConfirm);<NEW_LINE>confirm = new Text(composite, SWT.LEFT | SWT.BORDER);<NEW_LINE>confirm.addModifyListener(new ModifyListener() {<NEW_LINE><NEW_LINE>public void modifyText(ModifyEvent event) {<NEW_LINE>okButton.setEnabled(validatePassword());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else<NEW_LINE>confirm = null;<NEW_LINE>// filler<NEW_LINE>new Label(composite, SWT.LEFT);<NEW_LINE>showPassword = new Button(composite, SWT.CHECK | SWT.RIGHT);<NEW_LINE>showPassword.setText(Messages.showPassword);<NEW_LINE>showPassword.addSelectionListener(new SelectionListener() {<NEW_LINE><NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>passwordVisibility();<NEW_LINE>}<NEW_LINE><NEW_LINE>public void widgetDefaultSelected(SelectionEvent e) {<NEW_LINE>passwordVisibility();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>showPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));<NEW_LINE>// by default don't display password as clear text<NEW_LINE>showPassword.setSelection(false);<NEW_LINE>passwordVisibility();<NEW_LINE>composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));<NEW_LINE>GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(composite);<NEW_LINE>return compositeTop;<NEW_LINE>} | Composite(compositeTop, SWT.NONE); |
1,056,278 | public void fetchEnd(DBCSession session, DBCResultSet resultSet) throws DBCException {<NEW_LINE>WebSession webSession = contextInfo.getProcessor().getWebSession();<NEW_LINE>DBSEntity entity = dataContainer instanceof DBSEntity ? (DBSEntity) dataContainer : null;<NEW_LINE>try {<NEW_LINE>DBExecUtils.bindAttributes(session, entity, resultSet, bindings, rows);<NEW_LINE>} catch (DBException e) {<NEW_LINE>log.error("Error binding attributes", e);<NEW_LINE>}<NEW_LINE>if (dataFormat != WebDataFormat.document) {<NEW_LINE>convertComplexValuesToRelationalView(session);<NEW_LINE>}<NEW_LINE>// Set proper order position<NEW_LINE>for (int i = 0; i < bindings.length; i++) {<NEW_LINE>DBDAttributeBinding binding = bindings[i];<NEW_LINE>if (binding instanceof DBDAttributeBindingType) {<NEW_LINE>// Type bindings are produced by dynamic map resolve<NEW_LINE>// Their positions are valid only within parent value<NEW_LINE>// In web we make plain list of attributes so we must reorder leaf attributes<NEW_LINE>((DBDAttributeBindingType) binding).setOrdinalPosition(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Convert row values<NEW_LINE>for (Object[] row : rows) {<NEW_LINE>for (int i = 0; i < bindings.length; i++) {<NEW_LINE>DBDAttributeBinding binding = bindings[i];<NEW_LINE>row[i] = WebSQLUtils.makeWebCellValue(webSession, binding<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>webResultSet.setColumns(bindings);<NEW_LINE>webResultSet.setRows(rows.toArray(new Object[0][]));<NEW_LINE>WebSQLResultsInfo resultsInfo = contextInfo.saveResult(dataContainer, bindings);<NEW_LINE>webResultSet.setResultsInfo(resultsInfo);<NEW_LINE>boolean isSingleEntity = DBExecUtils.detectSingleSourceTable(bindings) != null;<NEW_LINE>webResultSet.setSingleEntity(isSingleEntity);<NEW_LINE>} | , row[i], dataFormat); |
1,225,034 | public Object call(Job<Object> job, Map<String, Object> parameters) {<NEW_LINE>this.checkAndCollectParameters(parameters);<NEW_LINE>// Read configuration<NEW_LINE>try {<NEW_LINE>this.initializeConfig((ComputerJob) job);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new HugeException("Failed to initialize computer config file", e);<NEW_LINE>}<NEW_LINE>// Set current computer job's specified parameters<NEW_LINE>Map<String, Object> configs = new HashMap<>();<NEW_LINE><MASK><NEW_LINE>configs.putAll(this.checkAndCollectParameters(parameters));<NEW_LINE>// Construct shell command for computer job<NEW_LINE>String[] command = this.constructShellCommands(configs);<NEW_LINE>LOG.info("Execute computer job: {}", String.join(SPACE, command));<NEW_LINE>// Execute current computer<NEW_LINE>try {<NEW_LINE>ProcessBuilder builder = new ProcessBuilder(command);<NEW_LINE>builder.redirectErrorStream(true);<NEW_LINE>builder.directory(new File(executeDir()));<NEW_LINE>Process process = builder.start();<NEW_LINE>StringBuilder output = new StringBuilder();<NEW_LINE>try (LineNumberReader reader = new LineNumberReader(new InputStreamReader(process.getInputStream()))) {<NEW_LINE>String line;<NEW_LINE>while ((line = reader.readLine()) != null) {<NEW_LINE>output.append(line).append("\n");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int exitCode = process.waitFor();<NEW_LINE>if (exitCode == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>throw new HugeException("The computer job exit with code %s: %s", exitCode, output);<NEW_LINE>} catch (HugeException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new HugeException("Failed to execute computer job", e);<NEW_LINE>}<NEW_LINE>} | configs.putAll(this.commonConfig); |
163,571 | public static void renderWires(TilePipeHolder pipe, double x, double y, double z, BufferBuilder bb) {<NEW_LINE>int combinedLight = pipe.getWorld().getCombinedLight(pipe.getPipePos(), 0);<NEW_LINE>int skyLight = combinedLight >> 16 & 0xFFFF;<NEW_LINE>int blockLight = combinedLight & 0xFFFF;<NEW_LINE>RenderHelper.disableStandardItemLighting();<NEW_LINE>GlStateManager.pushMatrix();<NEW_LINE>GlStateManager.translate(x, y, z);<NEW_LINE>for (Map.Entry<EnumWirePart, EnumDyeColor> partColor : pipe.getWireManager().parts.entrySet()) {<NEW_LINE>EnumWirePart part = partColor.getKey();<NEW_LINE>EnumDyeColor color = partColor.getValue();<NEW_LINE>boolean isOn = pipe.wireManager.isPowered(part);<NEW_LINE>int idx = getIndex(part, color, isOn);<NEW_LINE>if (wireRenderingCache[idx] == -1) {<NEW_LINE>wireRenderingCache[idx] = compileWire(part, color, isOn);<NEW_LINE>}<NEW_LINE>OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, isOn ? 240 : blockLight, skyLight);<NEW_LINE>GlStateManager.callList(wireRenderingCache[idx]);<NEW_LINE>}<NEW_LINE>for (Map.Entry<EnumWireBetween, EnumDyeColor> betweenColor : pipe.getWireManager().betweens.entrySet()) {<NEW_LINE>EnumWireBetween between = betweenColor.getKey();<NEW_LINE><MASK><NEW_LINE>boolean isOn = pipe.wireManager.isPowered(between.parts[0]);<NEW_LINE>int idx = getIndex(between, color, isOn);<NEW_LINE>if (wireRenderingCache[idx] == -1) {<NEW_LINE>wireRenderingCache[idx] = compileWire(between, color, isOn);<NEW_LINE>}<NEW_LINE>OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, isOn ? 240 : blockLight, skyLight);<NEW_LINE>GlStateManager.callList(wireRenderingCache[idx]);<NEW_LINE>}<NEW_LINE>GlStateManager.popMatrix();<NEW_LINE>GlStateManager.enableLighting();<NEW_LINE>GL11.glColor3f(1, 1, 1);<NEW_LINE>GlStateManager.color(1, 1, 1, 1);<NEW_LINE>} | EnumDyeColor color = betweenColor.getValue(); |
1,066,698 | public List<CompilationUnit> compile(FrontendOptions options, Problems problems) {<NEW_LINE>try {<NEW_LINE>// Temporary workaround to turn Kotlin compiler dep into a soft runtime dependency.<NEW_LINE>// TODO(b/217287994): Remove after a regular dependency is allowed.<NEW_LINE>Class<?> <MASK><NEW_LINE>Constructor<?> parserCtor = Iterables.getOnlyElement(Arrays.asList(kotlinParser.getDeclaredConstructors()));<NEW_LINE>Object parserInstance = parserCtor.newInstance(options.getClasspaths(), problems);<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<CompilationUnit> compilationUnits = (List<CompilationUnit>) kotlinParser.getMethod("parseFiles", List.class).invoke(parserInstance, options.getSources());<NEW_LINE>problems.abortIfHasErrors();<NEW_LINE>return compilationUnits;<NEW_LINE>} catch (Exception e) {<NEW_LINE>Throwables.throwIfUnchecked(e);<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | kotlinParser = Class.forName("com.google.j2cl.transpiler.frontend.kotlin.KotlinParser"); |
1,033,518 | private void updateTraceAttributeNamePartitionKeyPart2() throws Exception {<NEW_LINE>if (!tableExists("trace_attribute_name_temp")) {<NEW_LINE>// previously failed mid-upgrade prior to updating schema version<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>dropTableIfExists("trace_attribute_name");<NEW_LINE>session.createTableWithLCS("create table if not exists trace_attribute_name (agent_rollup" + " varchar, transaction_type varchar, trace_attribute_name varchar, primary key" + " (agent_rollup, transaction_type, trace_attribute_name))");<NEW_LINE>PreparedStatement insertPS = session.prepare("insert into trace_attribute_name" + " (agent_rollup, transaction_type, trace_attribute_name) values (?, ?, ?) using" + " ttl ?");<NEW_LINE>int ttl = <MASK><NEW_LINE>ResultSet results = session.read("select agent_rollup, transaction_type," + " trace_attribute_name from trace_attribute_name_temp");<NEW_LINE>Queue<ListenableFuture<?>> futures = new ArrayDeque<>();<NEW_LINE>for (Row row : results) {<NEW_LINE>BoundStatement boundStatement = insertPS.bind();<NEW_LINE>boundStatement.setString(0, row.getString(0));<NEW_LINE>boundStatement.setString(1, row.getString(1));<NEW_LINE>boundStatement.setString(2, row.getString(2));<NEW_LINE>boundStatement.setInt(3, ttl);<NEW_LINE>futures.add(session.writeAsync(boundStatement));<NEW_LINE>waitForSome(futures);<NEW_LINE>}<NEW_LINE>MoreFutures.waitForAll(futures);<NEW_LINE>dropTableIfExists("trace_attribute_name_temp");<NEW_LINE>} | getCentralStorageConfig(session).getTraceTTL(); |
1,181,741 | private static void checkTableSequences(Properties ctx, SvrProcess sp) {<NEW_LINE>String trxName = null;<NEW_LINE>if (sp != null)<NEW_LINE>trxName = sp.get_TrxName();<NEW_LINE>String sql = "SELECT TableName " + "FROM AD_Table t " + "WHERE IsActive='Y' AND IsView='N'" + " AND NOT EXISTS (SELECT * FROM AD_Sequence s " + "WHERE UPPER(s.Name)=UPPER(t.TableName) AND s.IsTableID='Y')";<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, trxName);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>while (rs.next()) {<NEW_LINE>String <MASK><NEW_LINE>if (MSequence.createTableSequence(ctx, tableName, trxName)) {<NEW_LINE>if (sp != null)<NEW_LINE>sp.addLog(0, null, null, tableName);<NEW_LINE>else<NEW_LINE>s_log.fine(tableName);<NEW_LINE>} else {<NEW_LINE>rs.close();<NEW_LINE>throw new Exception("Error creating Table Sequence for " + tableName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>s_log.log(Level.SEVERE, sql, e);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>// Sync Table Name case<NEW_LINE>sql = "UPDATE AD_Sequence s " + "SET Name = (SELECT TableName FROM AD_Table t " + "WHERE t.IsView='N' AND UPPER(s.Name)=UPPER(t.TableName)) " + "WHERE s.IsTableID='Y'" + " AND EXISTS (SELECT * FROM AD_Table t " + "WHERE t.IsActive='Y' AND t.IsView='N'" + " AND UPPER(s.Name)=UPPER(t.TableName) AND s.Name<>t.TableName)";<NEW_LINE>int no = DB.executeUpdate(sql, trxName);<NEW_LINE>if (no > 0) {<NEW_LINE>if (sp != null)<NEW_LINE>sp.addLog(0, null, null, "SyncName #" + no);<NEW_LINE>else<NEW_LINE>s_log.fine("Sync #" + no);<NEW_LINE>}<NEW_LINE>if (no >= 0)<NEW_LINE>return;<NEW_LINE>sql = "SELECT TableName, s.Name " + "FROM AD_Table t, AD_Sequence s " + "WHERE t.IsActive='Y' AND t.IsView='N'" + " AND UPPER(s.Name)=UPPER(t.TableName) AND s.Name<>t.TableName";<NEW_LINE>//<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, null);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>while (rs.next()) {<NEW_LINE>String TableName = rs.getString(1);<NEW_LINE>String SeqName = rs.getString(2);<NEW_LINE>sp.addLog(0, null, null, "ERROR: TableName=" + TableName + " - Sequence=" + SeqName);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>s_log.log(Level.SEVERE, sql, e);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>} | tableName = rs.getString(1); |
511,030 | public boolean onCreateOptionsMenu(Menu menu) {<NEW_LINE>MenuItem menuItem;<NEW_LINE>if (mFlash) {<NEW_LINE>menuItem = menu.add(Menu.NONE, R.id.menu_flash, 0, R.string.flash_on);<NEW_LINE>} else {<NEW_LINE>menuItem = menu.add(Menu.NONE, R.id.menu_flash, 0, R.string.flash_off);<NEW_LINE>}<NEW_LINE>MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);<NEW_LINE>if (mAutoFocus) {<NEW_LINE>menuItem = menu.add(Menu.NONE, R.id.menu_auto_focus, 0, R.string.auto_focus_on);<NEW_LINE>} else {<NEW_LINE>menuItem = menu.add(Menu.NONE, R.id.menu_auto_focus, 0, R.string.auto_focus_off);<NEW_LINE>}<NEW_LINE>MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);<NEW_LINE>menuItem = menu.add(Menu.NONE, R.id.menu_formats, 0, R.string.formats);<NEW_LINE>MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);<NEW_LINE>menuItem = menu.add(Menu.NONE, R.id.menu_camera_selector, 0, R.string.select_camera);<NEW_LINE>MenuItemCompat.<MASK><NEW_LINE>return super.onCreateOptionsMenu(menu);<NEW_LINE>} | setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER); |
1,197,281 | static void onModification(MQTTClient thisClient, final SecurityContext securityContext, final ErrorBuffer errorBuffer, final ModificationQueue modificationQueue) throws FrameworkException {<NEW_LINE>if (modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "mainBrokerURL")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "fallbackBrokerURLs"))) {<NEW_LINE>MQTTContext.disconnect(thisClient);<NEW_LINE>}<NEW_LINE>if (modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "isEnabled")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "mainBrokerURL")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "fallbackBrokerURLs"))) {<NEW_LINE>MQTTClientConnection connection = MQTTContext.getClientForId(thisClient.getUuid());<NEW_LINE>boolean enabled = thisClient.getIsEnabled();<NEW_LINE>if (!enabled) {<NEW_LINE>if (connection != null && connection.isConnected()) {<NEW_LINE>MQTTContext.disconnect(thisClient);<NEW_LINE>thisClient.setProperties(securityContext, new PropertyMap(StructrApp.key(MQTTClient.class, "isConnected"), false));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (connection == null || !connection.isConnected()) {<NEW_LINE>MQTTContext.connect(thisClient);<NEW_LINE>MQTTContext.subscribeAllTopics(thisClient);<NEW_LINE>}<NEW_LINE>connection = MQTTContext.getClientForId(thisClient.getUuid());<NEW_LINE>if (connection != null) {<NEW_LINE>if (connection.isConnected()) {<NEW_LINE>thisClient.setProperties(securityContext, new PropertyMap(StructrApp.key(MQTTClient.<MASK><NEW_LINE>} else {<NEW_LINE>thisClient.setProperties(securityContext, new PropertyMap(StructrApp.key(MQTTClient.class, "isConnected"), false));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | class, "isConnected"), true)); |
393,839 | public void read(org.apache.thrift.protocol.TProtocol iprot, TCMResult 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 // CMID<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.I64) {<NEW_LINE>struct.cmid = iprot.readI64();<NEW_LINE>struct.setCmidIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // STATUS<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.I32) {<NEW_LINE>struct.status = org.apache.accumulo.core.dataImpl.thrift.TCMStatus.findByValue(iprot.readI32());<NEW_LINE>struct.setStatusIsSet(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); |
1,802,163 | public boolean apply(Game game, Ability source, Ability abilityToModify) {<NEW_LINE>Player controller = game.<MASK><NEW_LINE>if (controller != null) {<NEW_LINE>Mana mana = abilityToModify.getManaCostsToPay().getMana();<NEW_LINE>int reduceMax = mana.getGeneric();<NEW_LINE>if (reduceMax > 2) {<NEW_LINE>reduceMax = 2;<NEW_LINE>}<NEW_LINE>if (reduceMax > 0) {<NEW_LINE>int reduce;<NEW_LINE>if (game.inCheckPlayableState() || controller.isComputer()) {<NEW_LINE>reduce = reduceMax;<NEW_LINE>} else {<NEW_LINE>ChoiceImpl choice = new ChoiceImpl(true);<NEW_LINE>Set<String> set = new LinkedHashSet<>();<NEW_LINE>for (int i = 0; i <= reduceMax; i++) {<NEW_LINE>set.add(String.valueOf(i));<NEW_LINE>}<NEW_LINE>choice.setChoices(set);<NEW_LINE>choice.setMessage("Reduce cycling cost");<NEW_LINE>if (controller.choose(Outcome.Benefit, choice, game)) {<NEW_LINE>reduce = Integer.parseInt(choice.getChoice());<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CardUtil.reduceCost(abilityToModify, reduce);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getPlayer(abilityToModify.getControllerId()); |
1,509,794 | public <A, R> StreamStage<KeyedWindowResult<K, R>> buildStream(@Nonnull AggregateOperation<A, ? extends R> aggrOp) {<NEW_LINE>List<Transform> upstreamTransforms = toList(upstreamStages, s -> s.transform);<NEW_LINE>FunctionAdapter fnAdapter = ADAPT_TO_JET_EVENT;<NEW_LINE>// Casts in this expression are a workaround for JDK 8 compiler bug:<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<FunctionEx<?, ? extends K>> adaptedKeyFns = toList(keyFns, fn -> fnAdapter.adaptKeyFn((FunctionEx) fn));<NEW_LINE>AbstractTransform transform = new WindowGroupTransform<K, R>(upstreamTransforms, wDef, adaptedKeyFns<MASK><NEW_LINE>pipelineImpl.connect(upstreamStages, transform);<NEW_LINE>return new StreamStageImpl<>(transform, fnAdapter, pipelineImpl);<NEW_LINE>} | , fnAdapter.adaptAggregateOperation(aggrOp)); |
321,716 | public static void main(String[] args) {<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>System.out.println("Enter n and m:");<NEW_LINE>// 1st line of input<NEW_LINE>int n = sc.nextInt(), m = sc.nextInt();<NEW_LINE>int[] A = new int[m], B = new int[m], arr = new int[n];<NEW_LINE><MASK><NEW_LINE>// 2nd Line of input<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>arr[i] = sc.nextInt();<NEW_LINE>}<NEW_LINE>System.out.println("Enter elements of A:");<NEW_LINE>// 3rd line of input<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>A[i] = sc.nextInt();<NEW_LINE>}<NEW_LINE>System.out.println("Enter elements of B:");<NEW_LINE>// 4th line of input<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>B[i] = sc.nextInt();<NEW_LINE>}<NEW_LINE>int happiness = findHappiness(arr, A, B);<NEW_LINE>System.out.println("Happiness: " + happiness);<NEW_LINE>sc.close();<NEW_LINE>} | System.out.println("Enter elements of array:"); |
1,400,885 | public String replace(Parameters parameters) {<NEW_LINE>int origin = 0;<NEW_LINE>int bound;<NEW_LINE>if (b == null) {<NEW_LINE>// Only bound<NEW_LINE>String valueA = a.replace(parameters);<NEW_LINE>if (!Item.checkReq(isRequired, valueA)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>bound = parseInt(valueA, Integer.MAX_VALUE - 1);<NEW_LINE>} else {<NEW_LINE>// Origin and bound<NEW_LINE>String valueA = a.replace(parameters);<NEW_LINE>String valueB = b.replace(parameters);<NEW_LINE>if (!Item.checkReq(isRequired, valueA, valueB)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>origin = parseInt(valueA, 0);<NEW_LINE>bound = parseInt(valueB, Integer.MAX_VALUE - 1);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return String.valueOf(ThreadLocalRandom.current().nextInt<MASK><NEW_LINE>} catch (Exception ex) {<NEW_LINE>return "0";<NEW_LINE>}<NEW_LINE>} | (origin, bound + 1)); |
1,396,965 | protected void verifyAudience(List<AudienceRestriction> audienceRestrictions) throws SamlException {<NEW_LINE>// Need fix it to use metadata's entityId<NEW_LINE>String audienceUrl = // "/ibm/saml20/"<NEW_LINE>RequestUtil.// "/ibm/saml20/"<NEW_LINE>getEntityUrl(// "/ibm/saml20/"<NEW_LINE>this.context.getHttpServletRequest(), Constants.SAML20_CONTEXT_PATH, this.context.getSsoService().getProviderId(), this.context.getSsoConfig());<NEW_LINE>SamlException lastException = null;<NEW_LINE>for (AudienceRestriction audienceRestriction : audienceRestrictions) {<NEW_LINE>for (Audience aud : audienceRestriction.getAudiences()) {<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Audience=" + aud.getAudienceURI());<NEW_LINE>}<NEW_LINE>if (audienceUrl.equals(aud.getAudienceURI())) {<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>lastException = new // SAML20_AUDIENCE_UNKNOWN_ERR=CWWKS5060E: The Conditions contain an invalid Audience attribute [{0}]. The expected Audience attribute is [{1}].<NEW_LINE>SamlException(// SAML20_AUDIENCE_UNKNOWN_ERR=CWWKS5060E: The Conditions contain an invalid Audience attribute [{0}]. The expected Audience attribute is [{1}].<NEW_LINE>"SAML20_AUDIENCE_UNKNOWN_ERR", null, new Object[] { aud.getAudienceURI(), audienceUrl });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (lastException != null) {<NEW_LINE>throw lastException;<NEW_LINE>}<NEW_LINE>throw new // SAML20_AUDIENCE_NO_ERR=CWWKS5061E: The Conditions element must contain Audience attribute.<NEW_LINE>SamlException(// SAML20_AUDIENCE_NO_ERR=CWWKS5061E: The Conditions element must contain Audience attribute.<NEW_LINE>"SAML20_ELEMENT_ATTR_ERR", null, new Object[] { "Audience", "Conditions" });<NEW_LINE>} | Tr.debug(tc, "Invalid audience"); |
1,354,985 | protected void addCategorySiteMapEntries(Category parentCategory, int currentDepth, CategorySiteMapGeneratorConfiguration categorySMGC, SiteMapBuilder siteMapBuilder) {<NEW_LINE>// If we've reached beyond the ending depth, don't proceed<NEW_LINE>if (currentDepth > categorySMGC.getEndingDepth()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// If we're at or past the starting depth, add this category to the site map<NEW_LINE>if (currentDepth >= categorySMGC.getStartingDepth()) {<NEW_LINE>constructSiteMapURLs(categorySMGC, siteMapBuilder, parentCategory);<NEW_LINE>}<NEW_LINE>// Recurse on child categories in batches of size rowLimit<NEW_LINE>int rowOffset = 0;<NEW_LINE>List<Category> categories;<NEW_LINE>do {<NEW_LINE>categories = categoryDao.readActiveSubCategoriesByCategory(parentCategory, rowLimit, rowOffset);<NEW_LINE>rowOffset += categories.size();<NEW_LINE>for (Category category : categories) {<NEW_LINE>if (StringUtils.isNotEmpty(category.getUrl())) {<NEW_LINE>addCategorySiteMapEntries(category, currentDepth + 1, categorySMGC, siteMapBuilder);<NEW_LINE>} else {<NEW_LINE>LOG.debug("Skipping empty category URL: " + category.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} while (<MASK><NEW_LINE>} | categories.size() == rowLimit); |
1,419,549 | public void writeCrosstab(JRCrosstab crosstab) throws IOException {<NEW_LINE>writer.startElement(JRCrosstabFactory.ELEMENT_crosstab, getNamespace());<NEW_LINE>writer.addAttribute(JRCrosstabFactory.ATTRIBUTE_isRepeatColumnHeaders, crosstab.isRepeatColumnHeaders(), true);<NEW_LINE>writer.addAttribute(JRCrosstabFactory.ATTRIBUTE_isRepeatRowHeaders, crosstab.isRepeatRowHeaders(), true);<NEW_LINE>writer.addAttribute(JRCrosstabFactory.ATTRIBUTE_columnBreakOffset, crosstab.getColumnBreakOffset(), JRCrosstab.DEFAULT_COLUMN_BREAK_OFFSET);<NEW_LINE>writer.addAttribute(JRXmlConstants.ATTRIBUTE_runDirection, crosstab.getRunDirectionValue(), RunDirectionEnum.LTR);<NEW_LINE>writer.addAttribute(JRXmlConstants.ATTRIBUTE_horizontalPosition, crosstab.getHorizontalPosition());<NEW_LINE>if (isNewerVersionOrEqual(JRConstants.VERSION_3_5_3)) {<NEW_LINE>writer.addAttribute(JRCrosstabFactory.ATTRIBUTE_ignoreWidth, crosstab.getIgnoreWidth());<NEW_LINE>}<NEW_LINE>writeReportElement(crosstab);<NEW_LINE>if (isNewerVersionOrEqual(JRConstants.VERSION_4_5_0)) {<NEW_LINE>writeBox(crosstab.getLineBox());<NEW_LINE>}<NEW_LINE>JRCrosstabParameter[] parameters = crosstab.getParameters();<NEW_LINE>if (parameters != null) {<NEW_LINE>for (int i = 0; i < parameters.length; i++) {<NEW_LINE>if (!parameters[i].isSystemDefined()) {<NEW_LINE>writeCrosstabParameter(parameters[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeExpression(JRCrosstabFactory.ELEMENT_parametersMapExpression, crosstab.getParametersMapExpression(), false);<NEW_LINE>writeCrosstabDataset(crosstab);<NEW_LINE>writeCrosstabTitle(crosstab);<NEW_LINE>writeCrosstabHeaderCell(crosstab);<NEW_LINE>JRCrosstabRowGroup[] rowGroups = crosstab.getRowGroups();<NEW_LINE>for (int i = 0; i < rowGroups.length; i++) {<NEW_LINE>writeCrosstabRowGroup(rowGroups[i]);<NEW_LINE>}<NEW_LINE>JRCrosstabColumnGroup[] columnGroups = crosstab.getColumnGroups();<NEW_LINE>for (int i = 0; i < columnGroups.length; i++) {<NEW_LINE>writeCrosstabColumnGroup(columnGroups[i]);<NEW_LINE>}<NEW_LINE>JRCrosstabMeasure[] measures = crosstab.getMeasures();<NEW_LINE>for (int i = 0; i < measures.length; i++) {<NEW_LINE>writeCrosstabMeasure(measures[i]);<NEW_LINE>}<NEW_LINE>if (crosstab instanceof JRDesignCrosstab) {<NEW_LINE>List<JRCrosstabCell> cellsList = ((JRDesignCrosstab) crosstab).getCellsList();<NEW_LINE>for (Iterator<JRCrosstabCell> it = cellsList.iterator(); it.hasNext(); ) {<NEW_LINE><MASK><NEW_LINE>writeCrosstabCell(cell);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>JRCrosstabCell[][] cells = crosstab.getCells();<NEW_LINE>Set<JRCrosstabCell> cellsSet = new HashSet<>();<NEW_LINE>for (int i = cells.length - 1; i >= 0; --i) {<NEW_LINE>for (int j = cells[i].length - 1; j >= 0; --j) {<NEW_LINE>JRCrosstabCell cell = cells[i][j];<NEW_LINE>if (cell != null && cellsSet.add(cell)) {<NEW_LINE>writeCrosstabCell(cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeCrosstabWhenNoDataCell(crosstab);<NEW_LINE>writer.closeElement();<NEW_LINE>} | JRCrosstabCell cell = it.next(); |
1,762,208 | public void actionPerformed(ActionEvent arg0) {<NEW_LINE>String oldPath = assertion.getPath();<NEW_LINE>String oldContent = assertion.getExpectedContent();<NEW_LINE>boolean oldAllowWildcards = assertion.isAllowWildcards();<NEW_LINE>setAssertionParameters(pathArea.getText().trim(), contentArea.getText(), allowWildcardsCheckBox.isSelected());<NEW_LINE>assertion.setIgnoreNamespaceDifferences(ignoreNamespaceDifferencesCheckBox.isSelected());<NEW_LINE>assertion.setIgnoreComments(ignoreCommentsCheckBox.isSelected());<NEW_LINE>try {<NEW_LINE>String assertableContent = assertion.getAssertable().getAssertableContent();<NEW_LINE>if (// Backward compatibility<NEW_LINE>XPathContainsAssertion.ID.equals(assertion.getConfig().getType()) || (!JsonUtil.seemsToBeJson(assertableContent))) {<NEW_LINE>assertableContent = assertion.getAssertable().getAssertableContentAsXml();<NEW_LINE>}<NEW_LINE>if (assertableContent == null) {<NEW_LINE>UISupport.showErrorMessage("Missing content!!");<NEW_LINE>setAssertionParameters(oldPath, oldContent, oldAllowWildcards);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String msg = assertion.assertContent(assertableContent, new WsdlTestRunContext(assertion.getAssertable()<MASK><NEW_LINE>UISupport.showInfoMessage(msg, "Success");<NEW_LINE>} catch (AssertionException e) {<NEW_LINE>UISupport.showErrorMessage(e.getMessage());<NEW_LINE>}<NEW_LINE>setAssertionParameters(oldPath, oldContent, oldAllowWildcards);<NEW_LINE>} | .getTestStep()), "Response"); |
654,833 | private static void doBucketLifecycleOperations() {<NEW_LINE>final String ruleId0 = "delete obsoleted files";<NEW_LINE>final String matchPrefix0 = "obsoleted/";<NEW_LINE>final String ruleId1 = "delete temporary files";<NEW_LINE>final String matchPrefix1 = "temporary/";<NEW_LINE>SetBucketLifecycleRequest request = new SetBucketLifecycleRequest(bucketName);<NEW_LINE>request.AddLifecycleRule(new LifecycleRule(ruleId0, matchPrefix0, RuleStatus.Enabled, 3));<NEW_LINE>request.AddLifecycleRule(new LifecycleRule(ruleId1, matchPrefix1, RuleStatus.Enabled, parseISO8601Date("2022-10-12T00:00:00.000Z")));<NEW_LINE>System.out.println("Setting bucket lifecycle\n");<NEW_LINE>client.setBucketLifecycle(request);<NEW_LINE><MASK><NEW_LINE>List<LifecycleRule> rules = client.getBucketLifecycle(bucketName);<NEW_LINE>LifecycleRule r0 = rules.get(0);<NEW_LINE>LifecycleRule r1 = rules.get(1);<NEW_LINE>System.out.println("\tRule0: Id=" + r0.getId() + ", Prefix=" + r0.getPrefix() + ", Status=" + r0.getStatus() + ", ExpirationDays=" + r0.getExpirationDays());<NEW_LINE>System.out.println("\tRule1: Id=" + r1.getId() + ", Prefix=" + r1.getPrefix() + ", Status=" + r1.getStatus() + ", ExpirationTime=" + formatISO8601Date(r1.getExpirationTime()));<NEW_LINE>System.out.println();<NEW_LINE>System.out.println("Deleting bucket lifecycle\n");<NEW_LINE>client.deleteBucketLifecycle(bucketName);<NEW_LINE>} | System.out.println("Getting bucket lifecycle:"); |
535,782 | public void configure(Parameterization config) {<NEW_LINE>//<NEW_LINE>//<NEW_LINE>new IntParameter(MINPTS_ID).//<NEW_LINE>addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT).grab(config, x -> minPts = x);<NEW_LINE>//<NEW_LINE>//<NEW_LINE>new IntParameter(MAXLEVEL_ID).//<NEW_LINE>addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT).grab(config, x -> maxLevel = x);<NEW_LINE>//<NEW_LINE>//<NEW_LINE>new IntParameter(MINDIM_ID, 1).//<NEW_LINE>addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT).grab(<MASK><NEW_LINE>//<NEW_LINE>//<NEW_LINE>new DoubleParameter(JITTER_ID).//<NEW_LINE>addConstraint(CommonConstraints.GREATER_THAN_ZERO_DOUBLE).grab(config, x -> jitter = x);<NEW_LINE>new Flag(ADJUST_ID).grab(config, x -> adjust = x);<NEW_LINE>} | config, x -> minDim = x); |
1,734,532 | public void updated(Dictionary config) throws ConfigurationException {<NEW_LINE>if (config != null) {<NEW_LINE>ip = (String) config.get("ip");<NEW_LINE>if (StringUtils.isBlank(ip)) {<NEW_LINE>ip = discoveryGatewayIp();<NEW_LINE>}<NEW_LINE>String portString = (String) config.get("port");<NEW_LINE>if (portString != null && !portString.isEmpty()) {<NEW_LINE>if (port > 0 && port <= 65535) {<NEW_LINE>port = Integer.parseInt(portString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String refreshIntervalString = (String) config.get("refreshInterval");<NEW_LINE>if (refreshIntervalString != null && !refreshIntervalString.isEmpty()) {<NEW_LINE>refreshInterval = Long.parseLong(refreshIntervalString);<NEW_LINE>}<NEW_LINE>String exclusiveString = (String) config.get("exclusive");<NEW_LINE>if (StringUtils.isNotBlank(exclusiveString)) {<NEW_LINE>exclusive = Boolean.parseBoolean(exclusiveString);<NEW_LINE>}<NEW_LINE>String maxRequestsPerConnectionString = (String) config.get("maxRequestsPerConnection");<NEW_LINE>if (maxRequestsPerConnectionString != null && !maxRequestsPerConnectionString.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ip = discoveryGatewayIp();<NEW_LINE>}<NEW_LINE>setProperlyConfigured(ip != null);<NEW_LINE>} | maxRequestsPerConnection = Integer.parseInt(maxRequestsPerConnectionString); |
158,583 | public Either<WebDriverException, ActiveSession> apply(CreateSessionRequest sessionRequest) {<NEW_LINE>if (currentSession != null) {<NEW_LINE>return Either.left(new RetrySessionRequestException("Slot is busy. Try another slot."));<NEW_LINE>}<NEW_LINE>if (!test(sessionRequest.getDesiredCapabilities())) {<NEW_LINE>return Either.left(new SessionNotCreatedException("New session request capabilities do not " + "match the stereotype."));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Either<WebDriverException, ActiveSession> possibleSession = factory.apply(sessionRequest);<NEW_LINE>if (possibleSession.isRight()) {<NEW_LINE><MASK><NEW_LINE>currentSession = session;<NEW_LINE>return Either.right(session);<NEW_LINE>} else {<NEW_LINE>return Either.left(possibleSession.left());<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.log(Level.WARNING, "Unable to create session", e);<NEW_LINE>return Either.left(new SessionNotCreatedException(e.getMessage()));<NEW_LINE>}<NEW_LINE>} | ActiveSession session = possibleSession.right(); |
1,338,594 | public void execute() throws MojoExecutionException, MojoFailureException {<NEW_LINE>Bundlers bundlers = Bundlers.createBundlersInstance();<NEW_LINE>getLog().info("Available bundlers:");<NEW_LINE>getLog().info("-------------------");<NEW_LINE>Map<String, ? super Object> dummyParams = new HashMap<>();<NEW_LINE>bundlers.getBundlers().stream().forEach((bundler) -> {<NEW_LINE>try {<NEW_LINE>bundler.validate(dummyParams);<NEW_LINE>} catch (UnsupportedPlatformException ex) {<NEW_LINE>return;<NEW_LINE>} catch (ConfigException ex) {<NEW_LINE>// NO-OP<NEW_LINE>// bundler is supported on this OS<NEW_LINE>}<NEW_LINE>getLog().info("ID: " + bundler.getID());<NEW_LINE>getLog().info("Name: " + bundler.getName());<NEW_LINE>getLog().info("Description: " + bundler.getDescription());<NEW_LINE>Collection<BundlerParamInfo<?>> bundleParameters = bundler.getBundleParameters();<NEW_LINE>Optional.ofNullable(bundleParameters).ifPresent(nonNullBundleArguments -> {<NEW_LINE>getLog().info("Available bundle arguments: ");<NEW_LINE>nonNullBundleArguments.stream().forEach(bundleArgument -> {<NEW_LINE>getLog().info("\t\tArgument ID: " + bundleArgument.getID());<NEW_LINE>getLog().info("\t\tArgument Type: " + bundleArgument.<MASK><NEW_LINE>getLog().info("\t\tArgument Name: " + bundleArgument.getName());<NEW_LINE>getLog().info("\t\tArgument Description: " + bundleArgument.getDescription());<NEW_LINE>getLog().info("");<NEW_LINE>});<NEW_LINE>});<NEW_LINE>getLog().info("-------------------");<NEW_LINE>});<NEW_LINE>} | getValueType().getName()); |
1,219,138 | // willBeDeleted().<NEW_LINE>// --------------------------------------------------------------------------<NEW_LINE>// extends ManagedObject.<NEW_LINE>// --------------------------------------------------------------------------<NEW_LINE>void reserveSpaceInStore(ObjectManagerByteArrayOutputStream byteArrayOutputStream) throws ObjectManagerException {<NEW_LINE>// During recovery we use the defeault mechanism because we have not pre-reserved the space,<NEW_LINE>// store full exceptions are supressed during recovery.<NEW_LINE>if (owningToken.getObjectStore().getObjectManagerState().getObjectManagerStateState() == ObjectManagerState.stateReplayingLog)<NEW_LINE>super.reserveSpaceInStore(byteArrayOutputStream);<NEW_LINE>else {<NEW_LINE>// Adjust the space reserved in the ObjectStore to reflect what we just serialized<NEW_LINE>// and will eventually give to the ObjectStore.<NEW_LINE>// We reserve the largset size even the ManagedObject may have become smaller because<NEW_LINE>// there may be a larger version of this Object still about to commit.<NEW_LINE>int currentSerializedSize = byteArrayOutputStream.getCount() <MASK><NEW_LINE>if (currentSerializedSize > latestSerializedSize) {<NEW_LINE>latestSerializedSizeDelta = currentSerializedSize - latestSerializedSize;<NEW_LINE>treeMap.reservedSpaceInStore = treeMap.reservedSpaceInStore - latestSerializedSizeDelta;<NEW_LINE>latestSerializedSize = currentSerializedSize;<NEW_LINE>}<NEW_LINE>// if (currentSerializedSize > latestSerializedSize).<NEW_LINE>}<NEW_LINE>} | + owningToken.objectStore.getAddSpaceOverhead(); |
989,240 | protected void updateTable(boolean pack) {<NEW_LINE>ServerStatus status = gitblit.getStatus();<NEW_LINE>header.setText(Translation.get("gb.status"));<NEW_LINE>version.setText(Constants.NAME + (status.isGO ? " GO v" : " WAR v") + status.version);<NEW_LINE><MASK><NEW_LINE>bootDate.setText(status.bootDate.toString() + " (" + Translation.getTimeUtils().timeAgo(status.bootDate) + ")");<NEW_LINE>url.setText(gitblit.url);<NEW_LINE>servletContainer.setText(status.servletContainer);<NEW_LINE>ByteFormat byteFormat = new ByteFormat();<NEW_LINE>heapMaximum.setText(byteFormat.format(status.heapMaximum));<NEW_LINE>heapAllocated.setText(byteFormat.format(status.heapAllocated));<NEW_LINE>heapUsed.setText(byteFormat.format(status.heapAllocated - status.heapFree) + " (" + byteFormat.format(status.heapFree) + " " + Translation.get("gb.free") + ")");<NEW_LINE>tableModel.setProperties(status.systemProperties);<NEW_LINE>tableModel.fireTableDataChanged();<NEW_LINE>} | releaseDate.setText(status.releaseDate); |
1,783,885 | public AutoCloseable start() throws IOException, InterruptedException {<NEW_LINE>File bootstrapScript = File.createTempFile("bootstrap_beam_venv", ".py");<NEW_LINE>bootstrapScript.deleteOnExit();<NEW_LINE>try (FileOutputStream fout = new FileOutputStream(bootstrapScript.getAbsolutePath())) {<NEW_LINE>ByteStreams.copy(getClass().getResourceAsStream("bootstrap_beam_venv.py"), fout);<NEW_LINE>}<NEW_LINE>List<String> bootstrapCommand = ImmutableList.of("python", bootstrapScript.getAbsolutePath());<NEW_LINE>LOG.info("Running bootstrap command " + bootstrapCommand);<NEW_LINE>Process bootstrap = new ProcessBuilder("python", bootstrapScript.getAbsolutePath()).redirectError(ProcessBuilder.Redirect.INHERIT).start();<NEW_LINE>bootstrap.getOutputStream().close();<NEW_LINE>BufferedReader reader = new BufferedReader(new InputStreamReader(bootstrap.getInputStream(), Charsets.UTF_8));<NEW_LINE>String lastLine = reader.readLine();<NEW_LINE>String lastNonEmptyLine = lastLine;<NEW_LINE>while (lastLine != null) {<NEW_LINE>LOG.info(lastLine);<NEW_LINE>if (lastLine.length() > 0) {<NEW_LINE>lastNonEmptyLine = lastLine;<NEW_LINE>}<NEW_LINE>lastLine = reader.readLine();<NEW_LINE>}<NEW_LINE>// Make SpotBugs happy.<NEW_LINE>reader.close();<NEW_LINE>int result = bootstrap.waitFor();<NEW_LINE>if (result != 0) {<NEW_LINE>throw new RuntimeException(<MASK><NEW_LINE>}<NEW_LINE>String pythonExecutable = lastNonEmptyLine;<NEW_LINE>List<String> command = new ArrayList<>();<NEW_LINE>command.add(pythonExecutable);<NEW_LINE>command.add("-m");<NEW_LINE>command.add(module);<NEW_LINE>command.addAll(args);<NEW_LINE>LOG.info("Starting python service with arguments " + command);<NEW_LINE>Process p = new ProcessBuilder(command).redirectError(ProcessBuilder.Redirect.INHERIT).redirectOutput(ProcessBuilder.Redirect.INHERIT).start();<NEW_LINE>return p::destroy;<NEW_LINE>} | "Python boostrap failed with error " + result + ", " + lastNonEmptyLine); |
548,114 | private void initColumnsData() {<NEW_LINE>// Width of the first column fits to width<NEW_LINE>columnWidths = new int[columnCount - 1];<NEW_LINE>columnNames = new String[columnCount];<NEW_LINE>columnToolTips = new String[columnCount];<NEW_LINE>columnRenderers = new TableCellRenderer[columnCount];<NEW_LINE>columnNames[0] = Bundle.ReferencesBrowserControllerUI_FieldColumnName();<NEW_LINE>columnToolTips[0] = Bundle.ReferencesBrowserControllerUI_FieldColumnDescr();<NEW_LINE>columnNames[1] = Bundle.ReferencesBrowserControllerUI_TypeColumnName();<NEW_LINE>columnToolTips[1] = Bundle.ReferencesBrowserControllerUI_TypeColumnDescr();<NEW_LINE>columnNames[2] = Bundle.ReferencesBrowserControllerUI_FullTypeColumnName();<NEW_LINE>columnToolTips[2] = Bundle.ReferencesBrowserControllerUI_FullTypeColumnDescr();<NEW_LINE>columnNames[3] = Bundle.ReferencesBrowserControllerUI_ValueColumnName();<NEW_LINE>columnToolTips[3] = Bundle.ReferencesBrowserControllerUI_ValueColumnDescr();<NEW_LINE>columnNames[4] = Bundle.ReferencesBrowserControllerUI_SizeColumnName();<NEW_LINE>columnToolTips[4] = Bundle.ReferencesBrowserControllerUI_SizeColumnDescr();<NEW_LINE>if (retainedSizeSupported) {<NEW_LINE>columnNames[5] = Bundle.ReferencesBrowserControllerUI_RetainedSizeColumnName();<NEW_LINE>columnToolTips[<MASK><NEW_LINE>}<NEW_LINE>// NOI18N // initial width of data columns<NEW_LINE>int unitWidth = getFontMetrics(getFont()).charWidth('W');<NEW_LINE>// FieldTreeCellRenderer treeCellRenderer = new FieldTreeCellRenderer();<NEW_LINE>// treeCellRenderer.setLeafIcon(null);<NEW_LINE>// treeCellRenderer.setClosedIcon(null);<NEW_LINE>// treeCellRenderer.setOpenIcon(null);<NEW_LINE>LabelTableCellRenderer dataCellRendererL = new LabelTableCellRenderer(JLabel.LEADING);<NEW_LINE>LabelTableCellRenderer dataCellRendererT = new LabelTableCellRenderer(JLabel.TRAILING);<NEW_LINE>// method / class / package name<NEW_LINE>columnRenderers[0] = null;<NEW_LINE>columnWidths[1 - 1] = unitWidth * 18;<NEW_LINE>columnRenderers[1] = dataCellRendererL;<NEW_LINE>columnWidths[2 - 1] = unitWidth * 28;<NEW_LINE>columnRenderers[2] = dataCellRendererL;<NEW_LINE>columnWidths[3 - 1] = unitWidth * 20;<NEW_LINE>columnRenderers[3] = new FieldTableCellRenderer();<NEW_LINE>columnWidths[4 - 1] = unitWidth * 7;<NEW_LINE>columnRenderers[4] = dataCellRendererT;<NEW_LINE>if (retainedSizeSupported) {<NEW_LINE>columnWidths[5 - 1] = unitWidth * 7;<NEW_LINE>columnRenderers[5] = dataCellRendererT;<NEW_LINE>}<NEW_LINE>} | 5] = Bundle.ReferencesBrowserControllerUI_RetainedSizeColumnDescr(); |
863,600 | protected final void handleMessage(Object m1) throws InterruptedException, SuspendExecution {<NEW_LINE>if (m1 instanceof RequestMessage) {<NEW_LINE>final RequestMessage req = (RequestMessage) m1;<NEW_LINE>try {<NEW_LINE>if (req instanceof GetChildMessage) {<NEW_LINE>reply(req, getChild(((<MASK><NEW_LINE>} else if (req instanceof GetChildrenMessage) {<NEW_LINE>reply(req, getChildren());<NEW_LINE>} else if (req instanceof AddChildMessage) {<NEW_LINE>reply(req, addChild(((AddChildMessage) req).spec));<NEW_LINE>} else if (req instanceof RemoveChildMessage) {<NEW_LINE>final RemoveChildMessage m = (RemoveChildMessage) req;<NEW_LINE>reply(req, m.name instanceof ActorRef ? removeChild((ActorRef<?>) m.name, m.terminate) : removeChild(m.name, m.terminate));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>replyError(req, e);<NEW_LINE>}<NEW_LINE>} else if (m1 instanceof ExitMessage) {<NEW_LINE>final ExitMessage death = (ExitMessage) m1;<NEW_LINE>final ActorRef actor = death.actor;<NEW_LINE>final ChildEntry child = findEntry(actor);<NEW_LINE>if (child != null) {<NEW_LINE>log().info("Detected child death: " + child + ". cause: ", death.cause);<NEW_LINE>if (!restartStrategy.onChildDeath(this, child, death.cause)) {<NEW_LINE>log().info("Supervisor {} giving up.", this);<NEW_LINE>shutdown();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | GetChildMessage) req).name)); |
1,644,741 | final DescribeTransitGatewayAttachmentsResult executeDescribeTransitGatewayAttachments(DescribeTransitGatewayAttachmentsRequest describeTransitGatewayAttachmentsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeTransitGatewayAttachmentsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeTransitGatewayAttachmentsRequest> request = null;<NEW_LINE>Response<DescribeTransitGatewayAttachmentsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeTransitGatewayAttachmentsRequestMarshaller().marshall(super.beforeMarshalling(describeTransitGatewayAttachmentsRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeTransitGatewayAttachments");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeTransitGatewayAttachmentsResult> responseHandler = new StaxResponseHandler<DescribeTransitGatewayAttachmentsResult>(new DescribeTransitGatewayAttachmentsResultStaxUnmarshaller());<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.SERVICE_ID, "EC2"); |
875,737 | public CreateFunctionResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateFunctionResult createFunctionResult = new CreateFunctionResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createFunctionResult;<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("functionConfiguration", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createFunctionResult.setFunctionConfiguration(FunctionConfigurationJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createFunctionResult;<NEW_LINE>} | ().unmarshall(context)); |
1,188,807 | private I_C_OrderLine createPurchaseOrderLine(final I_C_OrderLine salesOrderLine) {<NEW_LINE>final I_M_AttributeSetInstance poASI;<NEW_LINE>if (salesOrderLine.getM_AttributeSetInstance_ID() > 0) {<NEW_LINE>final I_M_AttributeSetInstance soASI = salesOrderLine.getM_AttributeSetInstance();<NEW_LINE>poASI = attributeDAO.copy(soASI);<NEW_LINE>} else {<NEW_LINE>poASI = null;<NEW_LINE>}<NEW_LINE>final I_C_OrderLine <MASK><NEW_LINE>purchaseOrderLine.setC_Charge_ID(salesOrderLine.getC_Charge_ID());<NEW_LINE>final ProductId productId = ProductId.ofRepoIdOrNull(salesOrderLine.getM_Product_ID());<NEW_LINE>if (productId != null) {<NEW_LINE>purchaseOrderLine.setM_Product_ID(productId.getRepoId());<NEW_LINE>// we use the product's uom, i.e. the internal stocking uom, because<NEW_LINE>// 1. we can assume to have an UOM conversion from any sales order line's UOM.<NEW_LINE>// 2. that way we can use the "internal-UOMs" Qty also for QtyEntered in addItemToGroup()<NEW_LINE>final UomId uomId = Services.get(IProductBL.class).getStockUOMId(productId);<NEW_LINE>purchaseOrderLine.setC_UOM_ID(uomId.getRepoId());<NEW_LINE>}<NEW_LINE>purchaseOrderLine.setQtyEntered(BigDecimal.ZERO);<NEW_LINE>purchaseOrderLine.setDescription(salesOrderLine.getDescription());<NEW_LINE>final Timestamp datePromised = CoalesceUtil.coalesceSuppliers(salesOrderLine::getDatePromised, () -> salesOrderLine.getC_Order().getDatePromised());<NEW_LINE>purchaseOrderLine.setDatePromised(datePromised);<NEW_LINE>if (PurchaseTypeEnum.MEDIATED.equals(purchaseType)) {<NEW_LINE>copyBPartnerAndLocationDetailsFromSalesToPurchaseOrderLine(salesOrderLine, purchaseOrderLine);<NEW_LINE>} else {<NEW_LINE>OrderLineDocumentLocationAdapterFactory.locationAdapter(purchaseOrderLine).setFromOrderHeader(purchaseOrder);<NEW_LINE>}<NEW_LINE>copyUserIdFromSalesToPurchaseOrderLine(salesOrderLine, purchaseOrderLine);<NEW_LINE>purchaseOrderLine.setM_AttributeSetInstance(poASI);<NEW_LINE>// (08091)<NEW_LINE>IModelAttributeSetInstanceListener.DYNATTR_DisableASIUpdateOnModelChange.setValue(purchaseOrderLine, true);<NEW_LINE>return purchaseOrderLine;<NEW_LINE>} | purchaseOrderLine = orderLineBL.createOrderLine(purchaseOrder); |
211,711 | private void updateDependencyResolutionContext(List<Map<String, String>> bomDependencies) {<NEW_LINE>URI[] uris = Grape.getInstance().resolve(null, bomDependencies.toArray(new Map<?, ?>[0]));<NEW_LINE>DefaultModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance();<NEW_LINE>for (URI uri : uris) {<NEW_LINE>try {<NEW_LINE>DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();<NEW_LINE>request.setModelResolver(new GrapeModelResolver());<NEW_LINE>request.setModelSource(new org.apache.maven.model.building.UrlModelSource(uri.toURL()));<NEW_LINE>request.setSystemProperties(System.getProperties());<NEW_LINE>Model model = modelBuilder.build(request).getEffectiveModel();<NEW_LINE>this.resolutionContext.<MASK><NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new IllegalStateException("Failed to build model for '" + uri + "'. Is it a valid Maven bom?", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | addDependencyManagement(new MavenModelDependencyManagement(model)); |
1,068,249 | public static String formatDateTime(Date time, TimeZone tz) {<NEW_LINE>Calendar cal = Calendar.getInstance(tz, Locale.ENGLISH);<NEW_LINE>cal.setTime(time);<NEW_LINE>int offset = cal.get(Calendar.ZONE_OFFSET);<NEW_LINE>offset += cal.get(Calendar.DST_OFFSET);<NEW_LINE>// DateFormat is operating on GMT so adjust for time zone offset<NEW_LINE>Date dt1 = new Date(time.getTime() + offset);<NEW_LINE>StringBuffer sb = new StringBuffer();<NEW_LINE>sb.append(DATE_FORMAT.format(dt1));<NEW_LINE>// Convert to minutes<NEW_LINE>offset /= (1000 * 60);<NEW_LINE>if (offset == 0) {<NEW_LINE>sb.append('Z');<NEW_LINE>} else {<NEW_LINE>if (offset > 0) {<NEW_LINE>sb.append('+');<NEW_LINE>} else {<NEW_LINE>sb.append('-');<NEW_LINE>}<NEW_LINE>int offsetHour = Math.abs(offset / 60);<NEW_LINE>int offsetMinutes = <MASK><NEW_LINE>if (offsetHour < 10) {<NEW_LINE>sb.append('0');<NEW_LINE>}<NEW_LINE>sb.append(Integer.toString(offsetHour));<NEW_LINE>sb.append('\'');<NEW_LINE>if (offsetMinutes < 10) {<NEW_LINE>sb.append('0');<NEW_LINE>}<NEW_LINE>sb.append(Integer.toString(offsetMinutes));<NEW_LINE>sb.append('\'');<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | Math.abs(offset % 60); |
750,256 | public static <L1, L2, L3, L4, T> LazyEither5<L1, L2, L3, L4, ReactiveSeq<T>> sequence(ReactiveSeq<? extends LazyEither5<L1, L2, L3, L4, T>> stream) {<NEW_LINE>LazyEither5<L1, L2, L3, L4, ReactiveSeq<T>> identity = <MASK><NEW_LINE>BiFunction<LazyEither5<L1, L2, L3, L4, ReactiveSeq<T>>, LazyEither5<L1, L2, L3, L4, T>, LazyEither5<L1, L2, L3, L4, ReactiveSeq<T>>> combineToStream = (acc, next) -> acc.zip(next, (a, b) -> a.append(b));<NEW_LINE>BinaryOperator<LazyEither5<L1, L2, L3, L4, ReactiveSeq<T>>> combineStreams = (a, b) -> a.zip(b, (z1, z2) -> z1.appendStream(z2));<NEW_LINE>return stream.reduce(identity, combineToStream, combineStreams);<NEW_LINE>} | right(ReactiveSeq.empty()); |
325,514 | private boolean tryToSyncSchema() {<NEW_LINE>schemaFilePos = readSyncSchemaPos(getSchemaPosFile());<NEW_LINE>// start to sync file data and get digest of this file.<NEW_LINE>try (FileInputStream fis = new FileInputStream(getSchemaLogFile());<NEW_LINE>ByteArrayOutputStream bos = new ByteArrayOutputStream(SyncConstant.DATA_CHUNK_SIZE)) {<NEW_LINE>serviceClient.initSyncData(MetadataConstant.METADATA_LOG);<NEW_LINE>long skipNum = fis.skip(schemaFilePos);<NEW_LINE>if (skipNum != schemaFilePos) {<NEW_LINE>logger.warn("The schema file has been smaller when sync, please check whether the logic of schema persistence has changed!");<NEW_LINE>schemaFilePos = skipNum;<NEW_LINE>}<NEW_LINE>MessageDigest md = MessageDigest.getInstance(SyncConstant.MESSAGE_DIGIT_NAME);<NEW_LINE>byte[] buffer <MASK><NEW_LINE>int dataLength;<NEW_LINE>while ((dataLength = fis.read(buffer)) != -1) {<NEW_LINE>bos.write(buffer, 0, dataLength);<NEW_LINE>md.update(buffer, 0, dataLength);<NEW_LINE>ByteBuffer buffToSend = ByteBuffer.wrap(bos.toByteArray());<NEW_LINE>SyncStatus status = serviceClient.syncData(buffToSend);<NEW_LINE>if (status.code != SUCCESS_CODE) {<NEW_LINE>logger.error("Receiver failed to receive metadata because {}, retry.", status.msg);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>schemaFilePos += dataLength;<NEW_LINE>}<NEW_LINE>// check digest<NEW_LINE>return checkDigestForSchema(new BigInteger(1, md.digest()).toString(16));<NEW_LINE>} catch (TException e) {<NEW_LINE>logger.error("Can not finish transfer schema to receiver, thrift error happen {}, try to reconnect", e);<NEW_LINE>isSyncConnect = false;<NEW_LINE>return false;<NEW_LINE>} catch (NoSuchAlgorithmException | IOException e) {<NEW_LINE>logger.error("Can not finish transfer schema to receiver", e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | = new byte[SyncConstant.DATA_CHUNK_SIZE]; |
1,404,965 | public Set instantiate() throws IOException {<NEW_LINE>Set result = new HashSet();<NEW_LINE>String displayName = (String) wizard.getProperty(PROP_DISPLAY_NAME);<NEW_LINE>WildflyPluginUtils.Version version = WildflyPluginUtils.<MASK><NEW_LINE>String url = WildflyDeploymentFactory.URI_PREFIX;<NEW_LINE>if (version != null && "7".equals(version.getMajorNumber())) {<NEW_LINE>// NOI18N<NEW_LINE>url += "//" + host + ":" + port + "?targetType=as7";<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>url += host + ":" + port;<NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>server != null && !server.equals(""))<NEW_LINE>// NOI18N<NEW_LINE>url += "#" + server;<NEW_LINE>// NOI18N<NEW_LINE>url += "&" + installLocation;<NEW_LINE>try {<NEW_LINE>Map<String, String> initialProperties = new HashMap<String, String>();<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_SERVER, server);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_SERVER_DIR, serverPath);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_ROOT_DIR, installLocation);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_HOST, host);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_PORT, port);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_CONFIG_FILE, configFile);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_ADMIN_PORT, adminPort);<NEW_LINE>initialProperties.put(WildflyPluginProperties.PROPERTY_JAVA_OPTS, WILDFLY_JAVA_OPTS);<NEW_LINE>InstanceProperties ip = InstanceProperties.createInstanceProperties(url, userName, password, displayName, initialProperties);<NEW_LINE>result.add(ip);<NEW_LINE>} catch (InstanceCreationException e) {<NEW_LINE>// NOI18N<NEW_LINE>showInformation(e.getLocalizedMessage(), NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "MSG_INSTANCE_REGISTRATION_FAILED"));<NEW_LINE>Logger.getLogger("global").log(Level.SEVERE, e.getMessage());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | getServerVersion(new File(installLocation)); |
679,856 | public void startGame() {<NEW_LINE>// Initialize values<NEW_LINE>int cpuRemoves = 0;<NEW_LINE>int matchesLeft = MATCH_COUNT_START;<NEW_LINE>int playerRemoves = 0;<NEW_LINE>// Flip coin and decide who goes first.<NEW_LINE>CoinSide coinSide = flipCoin();<NEW_LINE>if (coinSide == CoinSide.HEADS) {<NEW_LINE>System.out.println(Messages.HEADS);<NEW_LINE>matchesLeft -= 2;<NEW_LINE>} else {<NEW_LINE>System.<MASK><NEW_LINE>}<NEW_LINE>// Game loop<NEW_LINE>while (true) {<NEW_LINE>// Show matches left if CPU went first or Player already removed matches<NEW_LINE>if (coinSide == CoinSide.HEADS) {<NEW_LINE>System.out.format(Messages.MATCHES_LEFT, matchesLeft);<NEW_LINE>}<NEW_LINE>coinSide = CoinSide.HEADS;<NEW_LINE>// Player removes matches<NEW_LINE>System.out.println(Messages.REMOVE_MATCHES_QUESTION);<NEW_LINE>playerRemoves = turnOfPlayer();<NEW_LINE>matchesLeft -= playerRemoves;<NEW_LINE>System.out.format(Messages.REMAINING_MATCHES, matchesLeft);<NEW_LINE>// If 1 match is left, the CPU has to take it. You win!<NEW_LINE>if (matchesLeft <= 1) {<NEW_LINE>System.out.println(Messages.WIN);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// CPU removes matches<NEW_LINE>// At least two matches are left, because win condition above was not triggered.<NEW_LINE>if (matchesLeft <= 4) {<NEW_LINE>cpuRemoves = matchesLeft - 1;<NEW_LINE>} else {<NEW_LINE>cpuRemoves = 4 - playerRemoves;<NEW_LINE>}<NEW_LINE>System.out.format(Messages.CPU_TURN, cpuRemoves);<NEW_LINE>matchesLeft -= cpuRemoves;<NEW_LINE>// If 1 match is left, the Player has to take it. You lose!<NEW_LINE>if (matchesLeft <= 1) {<NEW_LINE>System.out.println(Messages.LOSE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | out.println(Messages.TAILS); |
544,550 | public void run(RegressionEnvironment env) {<NEW_LINE>AtomicInteger milestone = new AtomicInteger();<NEW_LINE><MASK><NEW_LINE>UUID uuid = UUID.fromString("b7dc7f66-4f6d-4f03-14d7-83da210dfba6");<NEW_LINE>runAssertion(env, MyLocalVMTypeUUID.class, UUID.class, uuid.toString(), uuid, valueOfOne, milestone);<NEW_LINE>OffsetDateTime odt = OffsetDateTime.now();<NEW_LINE>runAssertion(env, MyLocalVMTypeOffsetDateTime.class, OffsetDateTime.class, odt.toString(), odt, valueOfOne, milestone);<NEW_LINE>LocalDate ld = LocalDate.now();<NEW_LINE>runAssertion(env, MyLocalVMTypeLocalDate.class, LocalDate.class, ld.toString(), ld, valueOfOne, milestone);<NEW_LINE>LocalDateTime ldt = LocalDateTime.now();<NEW_LINE>runAssertion(env, MyLocalVMTypeLocalDateTime.class, LocalDateTime.class, ldt.toString(), ldt, valueOfOne, milestone);<NEW_LINE>ZonedDateTime zdt = ZonedDateTime.now();<NEW_LINE>runAssertion(env, MyLocalVMTypeZonedDateTime.class, ZonedDateTime.class, zdt.toString(), zdt, valueOfOne, milestone);<NEW_LINE>URL url;<NEW_LINE>try {<NEW_LINE>url = new URL("http", "host", 1000, "/file");<NEW_LINE>assertEquals(url, new URL(url.toString()));<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>runAssertion(env, MyLocalVMTypeURL.class, URL.class, url.toString(), url, valueOfOne, milestone);<NEW_LINE>URI uri;<NEW_LINE>try {<NEW_LINE>uri = new URI("ftp://ftp.is.co.za/rfc/rfc1808.txt");<NEW_LINE>assertEquals(uri, new URI(uri.toString()));<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>runAssertion(env, MyLocalVMTypeURI.class, URI.class, uri.toString(), uri, new JsonString("a b"), milestone);<NEW_LINE>} | JsonValue valueOfOne = new JsonNumber("1"); |
1,622,334 | public static byte[] generateUniverseKey(UUID universeUUID, UUID configUUID, String algorithm, int keySize, ObjectNode authConfig) throws Exception {<NEW_LINE>LOG.debug("generateUniverseKey called : {}, {}", algorithm, keySize);<NEW_LINE>// we can also use transit/random/<keySize> to generate random key<NEW_LINE>// but would require call to hashicorp and the return data is secret, hence not using it.<NEW_LINE>KeyGenerator keyGen = KeyGenerator.getInstance(algorithm);<NEW_LINE>keyGen.init(keySize);<NEW_LINE>SecretKey secretKey = keyGen.generateKey();<NEW_LINE>byte[] keyBytes = secretKey.getEncoded();<NEW_LINE>LOG.debug("Generated key: of size {}", keyBytes.length);<NEW_LINE>try {<NEW_LINE>final String engineKey = getVaultKeyForUniverse(universeUUID, configUUID);<NEW_LINE>VaultSecretEngineBase hcVaultSecretEngine = VaultSecretEngineBuilder.getVaultSecretEngine(authConfig);<NEW_LINE>byte[] encryptedKeyBytes = <MASK><NEW_LINE>return encryptedKeyBytes;<NEW_LINE>} catch (VaultException e) {<NEW_LINE>LOG.error("Vault Exception with httpStatusCode: {}", e.getHttpStatusCode());<NEW_LINE>throw new Exception(e);<NEW_LINE>}<NEW_LINE>} | hcVaultSecretEngine.encryptString(engineKey, keyBytes); |
1,019,529 | public ServiceResponse serviceImpl(Query post, HttpServletResponse response, Authorization rights, JsonObjectWithDefault permissions) throws APIException {<NEW_LINE>Path settings = Paths.get(DAO.data_dir.getPath(), "settings");<NEW_LINE>String fileName = post.get("file", "accounting");<NEW_LINE>Path filePath = IO.resolvePath(settings, fileName + ".json");<NEW_LINE>System.out.println(filePath);<NEW_LINE>int length = 0;<NEW_LINE>File file = filePath.toFile();<NEW_LINE>try {<NEW_LINE>ServletOutputStream outStream = response.getOutputStream();<NEW_LINE>ServletContext context = getServletConfig().getServletContext();<NEW_LINE>String mimetype = context.getMimeType(filePath.toString());<NEW_LINE>if (mimetype == null) {<NEW_LINE>mimetype = "application/octet-stream";<NEW_LINE>}<NEW_LINE>response.setContentType(mimetype);<NEW_LINE>response.setContentLength((int) file.length());<NEW_LINE>response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".json");<NEW_LINE>byte[] byteBuffer = new byte[BUFSIZE];<NEW_LINE>DataInputStream in = new DataInputStream(new FileInputStream(file));<NEW_LINE>while ((in != null) && ((length = in.read(byteBuffer)) != -1)) {<NEW_LINE>outStream.write(byteBuffer, 0, length);<NEW_LINE>}<NEW_LINE>in.close();<NEW_LINE>outStream.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.out.println(e.getCause() + <MASK><NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | "\n" + e.getMessage()); |
1,301,169 | private Mono<Response<Flux<ByteBuffer>>> cancelWithResponseAsync(String resourceGroupName, String registryName, String runId, 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 (registryName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter registryName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (runId == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter runId is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2019-06-01-preview";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.cancel(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, registryName, apiVersion, runId, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
1,145,002 | @Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@ApiOperation(value = "Deletes a service", code = 204)<NEW_LINE>@ApiResponses(value = { @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Access to the specified service is forbidden"), @ApiResponse(code = 404, message = "The UUID of the service could not be found") })<NEW_LINE>@PermissionRequired(Permissions.Constants.PORTFOLIO_MANAGEMENT)<NEW_LINE>public Response deleteService(@ApiParam(value = "The UUID of the service to delete", required = true) @PathParam("uuid") String uuid) {<NEW_LINE>try (QueryManager qm = new QueryManager()) {<NEW_LINE>final ServiceComponent service = qm.getObjectByUuid(ServiceComponent.class, uuid, ServiceComponent.FetchGroup.ALL.name());<NEW_LINE>if (service != null) {<NEW_LINE>if (!qm.hasAccess(super.getPrincipal(), service.getProject())) {<NEW_LINE>return Response.status(Response.Status.FORBIDDEN).entity("Access to the specified service is forbidden").build();<NEW_LINE>}<NEW_LINE>qm.recursivelyDelete(service, false);<NEW_LINE>qm.commitSearchIndex(ServiceComponent.class);<NEW_LINE>return Response.status(Response.<MASK><NEW_LINE>} else {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity("The UUID of the service could not be found.").build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Status.NO_CONTENT).build(); |
855,875 | private Map<String, List<String>> discoverModulesIn(Path path) {<NEW_LINE>Map<String, List<String>> mapModuleClasses = new HashMap<String, List<String>>();<NEW_LINE>try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {<NEW_LINE>for (Path entry : stream) {<NEW_LINE>BasicFileAttributes attrs;<NEW_LINE>try {<NEW_LINE>attrs = Files.<MASK><NEW_LINE>} catch (NoSuchFileException ignore) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (attrs.isDirectory()) {<NEW_LINE>if (Files.exists(entry.resolve(SootModuleInfo.MODULE_INFO_FILE))) {<NEW_LINE>mapModuleClasses.putAll(buildModuleForExplodedModule(entry));<NEW_LINE>}<NEW_LINE>} else if (attrs.isRegularFile() && entry.getFileName().toString().endsWith(".jar")) {<NEW_LINE>mapModuleClasses.putAll(buildModuleForJar(entry));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return mapModuleClasses;<NEW_LINE>} | readAttributes(entry, BasicFileAttributes.class); |
1,329,276 | public static ToolPredicate deserialize(JsonObject json) {<NEW_LINE>// item<NEW_LINE>Item item = null;<NEW_LINE>if (json.has("item")) {<NEW_LINE>item = RecipeHelper.deserializeItem(GsonHelper.getAsString(json, "item"), "item", Item.class);<NEW_LINE>}<NEW_LINE>// tag<NEW_LINE>Tag<Item> tag = null;<NEW_LINE>if (json.has("tag")) {<NEW_LINE>ResourceLocation tagName = new ResourceLocation(GsonHelper.getAsString(json, "tag"));<NEW_LINE>tag = SerializationTags.getInstance().getTagOrThrow(Registry.ITEM_REGISTRY, tagName, name -> new JsonSyntaxException("Unknown item tag '" + name + '\''));<NEW_LINE>}<NEW_LINE>// materials<NEW_LINE>List<MaterialId<MASK><NEW_LINE>if (json.has("materials")) {<NEW_LINE>materials = JsonHelper.parseList(json, "materials", (element, key) -> new MaterialId(GsonHelper.convertToString(element, key)));<NEW_LINE>}<NEW_LINE>// upgrades<NEW_LINE>boolean hasUpgrades = GsonHelper.getAsBoolean(json, "has_upgrades", false);<NEW_LINE>ModifierMatch upgrades = ModifierMatch.ALWAYS;<NEW_LINE>if (json.has("upgrades")) {<NEW_LINE>upgrades = ModifierMatch.deserialize(GsonHelper.getAsJsonObject(json, "upgrades"));<NEW_LINE>}<NEW_LINE>// modifiers<NEW_LINE>ModifierMatch modifiers = ModifierMatch.ALWAYS;<NEW_LINE>if (json.has("modifiers")) {<NEW_LINE>modifiers = ModifierMatch.deserialize(GsonHelper.getAsJsonObject(json, "modifiers"));<NEW_LINE>}<NEW_LINE>// stats<NEW_LINE>List<StatPredicate> stats = Collections.emptyList();<NEW_LINE>if (json.has("stats")) {<NEW_LINE>stats = JsonHelper.parseList(json, "stats", StatPredicate::deserialize);<NEW_LINE>}<NEW_LINE>return new ToolPredicate(item, tag, materials, hasUpgrades, upgrades, modifiers, stats);<NEW_LINE>} | > materials = Collections.emptyList(); |
1,752,529 | private Iterator<OIdentifiable> query(String className, OWhereClause oWhereClause, OCommandContext ctx) {<NEW_LINE>final ODatabaseDocument database = getDatabase();<NEW_LINE>OClass schemaClass = database.getMetadata().getSchema().getClass(className);<NEW_LINE>database.checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_READ, schemaClass.getName().toLowerCase(Locale.ENGLISH));<NEW_LINE>Iterable<ORecord> baseIterable = fetchFromIndex(schemaClass, oWhereClause);<NEW_LINE>// OSelectStatement stm = buildSelectStatement(className, oWhereClause);<NEW_LINE>// return stm.execute(ctx);<NEW_LINE>String text;<NEW_LINE>if (oWhereClause == null) {<NEW_LINE>text = "(select from " + className + ")";<NEW_LINE>} else {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>oWhereClause.toString(ctx.getInputParameters(), builder);<NEW_LINE>// TODO make it more OO!<NEW_LINE>// synchronized (oWhereClause) { //this instance is shared...<NEW_LINE>// replaceIdentifier(oWhereClause, "$currentMatch", "@this"); //<NEW_LINE>// newWhere = oWhereClause.replaceIdentifier("$currentMatch", "@this");<NEW_LINE>text = "(select from " + className + " where " + builder.toString().replaceAll("\\$currentMatch", "@this") + ")";<NEW_LINE>// replaceIdentifier(oWhereClause, "@this", "$currentMatch");<NEW_LINE>// }<NEW_LINE>}<NEW_LINE>OSQLTarget target = new OSQLTarget(text, ctx);<NEW_LINE>Iterable targetResult = (Iterable) target.getTargetRecords();<NEW_LINE>if (targetResult == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (targetResult instanceof OCommandExecutorSQLSelect) {<NEW_LINE>((OCommandExecutorSQLSelect) targetResult).getContext().setRecordingMetrics(ctx.isRecordingMetrics());<NEW_LINE>} else if (targetResult instanceof OCommandExecutorSQLResultsetDelegate) {<NEW_LINE>OCommandExecutor delegate = ((OCommandExecutorSQLResultsetDelegate) targetResult).getDelegate();<NEW_LINE>if (delegate instanceof OCommandExecutorSQLSelect) {<NEW_LINE>delegate.getContext().<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return targetResult.iterator();<NEW_LINE>} | setRecordingMetrics(ctx.isRecordingMetrics()); |
1,695,929 | // ----- static methods -----<NEW_LINE>public static PropertyMap javaTypeToDatabaseType(SecurityContext securityContext, GraphObject wrapped, Map<String, Object> source) throws FrameworkException {<NEW_LINE>final PropertyMap resultMap = new PropertyMap();<NEW_LINE>final GraphObject entity = unwrap(wrapped);<NEW_LINE>if (source != null) {<NEW_LINE>for (Entry<String, Object> entry : source.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE>Object value = entry.getValue();<NEW_LINE>if (key != null) {<NEW_LINE>final PropertyKey propertyKey = StructrApp.getConfiguration().getPropertyKeyForDatabaseName(entity.getClass(), key);<NEW_LINE>final PropertyConverter converter = propertyKey.databaseConverter(securityContext, entity);<NEW_LINE>if (converter != null) {<NEW_LINE>try {<NEW_LINE>Object propertyValue = converter.convert(value);<NEW_LINE>resultMap.put(propertyKey, propertyValue);<NEW_LINE>} catch (ClassCastException cce) {<NEW_LINE>throw new FrameworkException(422, "Invalid JSON input for key " + propertyKey.jsonName() + ", expected a JSON " + <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>resultMap.put(propertyKey, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resultMap;<NEW_LINE>} | propertyKey.typeName() + "."); |
489,774 | public void marshall(DescribeEvaluationsRequest describeEvaluationsRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (describeEvaluationsRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getFilterVariable(), FILTERVARIABLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getEQ(), EQ_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getGT(), GT_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getLT(), LT_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getLE(), LE_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getNE(), NE_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getPrefix(), PREFIX_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getSortOrder(), SORTORDER_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getNextToken(), NEXTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getLimit(), LIMIT_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | describeEvaluationsRequest.getGE(), GE_BINDING); |
1,809,323 | public void preVisit(ExploreNode exploreNode) {<NEW_LINE>if (skipNode(exploreNode)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ExploreNode parent = stack.peek();<NEW_LINE>if (exploreNode == this.rootModule) {<NEW_LINE>assert parent == null;<NEW_LINE>final ModuleNode mn = (ModuleNode) exploreNode;<NEW_LINE>this.writer.append(Integer.toString(mn.hashCode()));<NEW_LINE>this.writer.append(" [label=\"");<NEW_LINE>this.writer.append(mn.<MASK><NEW_LINE>this.writer.append("\",style = filled]");<NEW_LINE>this.writer.append(";\n");<NEW_LINE>stack.push(exploreNode);<NEW_LINE>} else {<NEW_LINE>final SemanticNode sn = (SemanticNode) exploreNode;<NEW_LINE>this.writer.append(Integer.toString(sn.hashCode()));<NEW_LINE>this.writer.append(type2format.getOrDefault(exploreNode.getClass(), " [") + "label=\"");<NEW_LINE>if (exploreNode instanceof OpDefNode) {<NEW_LINE>this.writer.append(toDot(((OpDefNode) sn).getName().toString()));<NEW_LINE>} else {<NEW_LINE>this.writer.append(toDot(sn.getTreeNode().getHumanReadableImage()));<NEW_LINE>}<NEW_LINE>if (includeLineNumbers) {<NEW_LINE>// Wrap location for more compact nodes in dot output.<NEW_LINE>final String loc = sn.getLocation().toString();<NEW_LINE>this.writer.append("\n");<NEW_LINE>this.writer.append(loc.replace("of module", "\n"));<NEW_LINE>this.writer.append("\n" + sn.getClass().getSimpleName());<NEW_LINE>}<NEW_LINE>this.writer.append("\"]");<NEW_LINE>this.writer.append(";\n");<NEW_LINE>this.writer.append(Integer.toString(parent.hashCode()));<NEW_LINE>this.writer.append(" -> ");<NEW_LINE>this.writer.append(Integer.toString(sn.hashCode()));<NEW_LINE>this.writer.append("\n");<NEW_LINE>stack.push(sn);<NEW_LINE>}<NEW_LINE>} | getName().toString()); |
954,330 | protected void onCreate(@Nullable Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>Bundle extra = getIntent().getExtras();<NEW_LINE>String prelayout = extra.getString(Utils.KEY);<NEW_LINE>setTitle(layout_name = prelayout);<NEW_LINE>Context ctx = getApplicationContext();<NEW_LINE>int id = ctx.getResources().getIdentifier(prelayout, "layout", ctx.getPackageName());<NEW_LINE>setContentView(id);<NEW_LINE>mMotionLayout = Utils.findMotionLayout(this);<NEW_LINE>populateRecyclerView();<NEW_LINE>TextView text = findViewById(R.id.text);<NEW_LINE>if (text != null) {<NEW_LINE>mMotionLayout.setTransitionListener(new TransitionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onTransitionStarted(MotionLayout motionLayout, int startId, int endId) {<NEW_LINE>Log.v(TAG, Debug.getLoc() + " " + Debug.getName(getApplicationContext(), startId));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onTransitionChange(MotionLayout motionLayout, int startId, int endId, float progress) {<NEW_LINE>Log.v(TAG, Debug.getLoc() + " progress " + progress);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onTransitionCompleted(MotionLayout motionLayout, int currentId) {<NEW_LINE>text.setText((currentId == R.id.expanded) ? "cb down" : "cb up");<NEW_LINE>Log.v(TAG, Debug.getLoc() + " " + Debug.getName(getApplicationContext(), currentId));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | Log.v(TAG, " --------------------------------------------------------------------"); |
147,010 | private void initInfo(int record_id, String value, String whereClause) {<NEW_LINE>//<NEW_LINE>if (!(record_id == 0) && value != null && value.length() > 0) {<NEW_LINE>log.severe(<MASK><NEW_LINE>}<NEW_LINE>// Set Value and boolean criteria (if any)<NEW_LINE>if (!(record_id == 0)) {<NEW_LINE>fieldID = record_id;<NEW_LINE>} else {<NEW_LINE>// Use the value if any<NEW_LINE>if (value != null && value.length() > 0) {<NEW_LINE>fieldValue.setText(value);<NEW_LINE>} else {<NEW_LINE>// Try to find the context - A_Asset_ID<NEW_LINE>String aid = Env.getContext(Env.getCtx(), p_WindowNo, "A_Asset_ID");<NEW_LINE>if (aid != null && aid.length() != 0) {<NEW_LINE>fieldID = new Integer(aid).intValue();<NEW_LINE>}<NEW_LINE>// C_BPartner_ID<NEW_LINE>String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");<NEW_LINE>if (bp != null && bp.length() != 0) {<NEW_LINE>fBPartner_ID.setValue(new Integer(bp).intValue());<NEW_LINE>}<NEW_LINE>// M_Product_ID<NEW_LINE>String pid = Env.getContext(Env.getCtx(), p_WindowNo, "M_Product_ID");<NEW_LINE>if (pid != null && pid.length() != 0) {<NEW_LINE>fProduct_ID.setValue(new Integer(pid).intValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Received both a record_id and a value: " + record_id + " - " + value); |
1,594,508 | public int copyLinesFrom(final MProject project) {<NEW_LINE>if (isProcessed() || project == null)<NEW_LINE>return 0;<NEW_LINE>int count = 0;<NEW_LINE>final List<MProjectLine> fromLines = project.getLines();<NEW_LINE>for (final MProjectLine fromLine : fromLines) {<NEW_LINE>final MProjectLine line = new MProjectLine(getCtx(), <MASK><NEW_LINE>PO.copyValues(fromLine, line, getAD_Client_ID(), getAD_Org_ID());<NEW_LINE>line.setC_Project_ID(getC_Project_ID());<NEW_LINE>line.setInvoicedAmt(BigDecimal.ZERO);<NEW_LINE>line.setInvoicedQty(BigDecimal.ZERO);<NEW_LINE>line.setC_OrderPO_ID(0);<NEW_LINE>line.setC_Order_ID(0);<NEW_LINE>line.setProcessed(false);<NEW_LINE>if (line.save())<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>if (fromLines.size() != count)<NEW_LINE>log.error("Lines difference - Project=" + fromLines.size() + " <> Saved=" + count);<NEW_LINE>return count;<NEW_LINE>} | 0, project.get_TrxName()); |
360,137 | private static ImmutableList<InstantInterval> removeGaps(@NonNull final List<AnnotatedPoint> annotatedPointList) {<NEW_LINE>final List<InstantInterval> result = new ArrayList<>();<NEW_LINE>// iterate over the annotatedPointList<NEW_LINE>boolean isInterval = false;<NEW_LINE>boolean isGap = false;<NEW_LINE>Instant intervalStart = null;<NEW_LINE>for (final AnnotatedPoint point : annotatedPointList) {<NEW_LINE>switch(point.type) {<NEW_LINE>case Start:<NEW_LINE>if (!isGap) {<NEW_LINE>intervalStart = point.value;<NEW_LINE>}<NEW_LINE>isInterval = true;<NEW_LINE>break;<NEW_LINE>case End:<NEW_LINE>if (!isGap) {<NEW_LINE>// ignore the null warning as we are on the End case branch<NEW_LINE>result.add(InstantInterval.of(intervalStart, point.value));<NEW_LINE>}<NEW_LINE>isInterval = false;<NEW_LINE>break;<NEW_LINE>case GapStart:<NEW_LINE>if (isInterval) {<NEW_LINE>result.add(InstantInterval.of<MASK><NEW_LINE>}<NEW_LINE>isGap = true;<NEW_LINE>break;<NEW_LINE>case GapEnd:<NEW_LINE>if (isInterval) {<NEW_LINE>intervalStart = point.value;<NEW_LINE>}<NEW_LINE>isGap = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ImmutableList.copyOf(result);<NEW_LINE>} | (intervalStart, point.value)); |
1,802,151 | public static void addTermToTarget(Urn labelUrn, Urn targetUrn, String subResource, Urn actor, EntityService entityService) throws URISyntaxException {<NEW_LINE>if (subResource == null || subResource.equals("")) {<NEW_LINE>com.linkedin.common.GlossaryTerms terms = (com.linkedin.common.GlossaryTerms) getAspectFromEntity(targetUrn.toString(), GLOSSARY_TERM_ASPECT_NAME, entityService, new GlossaryTerms());<NEW_LINE>terms.setAuditStamp(getAuditStamp(actor));<NEW_LINE>if (!terms.hasTerms()) {<NEW_LINE>terms.setTerms(new GlossaryTermAssociationArray());<NEW_LINE>}<NEW_LINE>addTermIfNotExistsToEntity(terms, labelUrn);<NEW_LINE>persistAspect(targetUrn, GLOSSARY_TERM_ASPECT_NAME, terms, actor, entityService);<NEW_LINE>} else {<NEW_LINE>com.linkedin.schema.EditableSchemaMetadata editableSchemaMetadata = (com.linkedin.schema.EditableSchemaMetadata) getAspectFromEntity(targetUrn.toString(), EDITABLE_SCHEMA_METADATA<MASK><NEW_LINE>EditableSchemaFieldInfo editableFieldInfo = getFieldInfoFromSchema(editableSchemaMetadata, subResource);<NEW_LINE>if (!editableFieldInfo.hasGlossaryTerms()) {<NEW_LINE>editableFieldInfo.setGlossaryTerms(new GlossaryTerms());<NEW_LINE>}<NEW_LINE>editableFieldInfo.getGlossaryTerms().setAuditStamp(getAuditStamp(actor));<NEW_LINE>addTermIfNotExistsToEntity(editableFieldInfo.getGlossaryTerms(), labelUrn);<NEW_LINE>persistAspect(targetUrn, EDITABLE_SCHEMA_METADATA, editableSchemaMetadata, actor, entityService);<NEW_LINE>}<NEW_LINE>} | , entityService, new EditableSchemaMetadata()); |
1,269,125 | public void addArgs(List<String> args) throws Exception {<NEW_LINE>ArgumentWriter writer = new ArgumentWriter(instance);<NEW_LINE>writer.writeIfSet("-a", BIT_LISTEN_ADDRESS);<NEW_LINE><MASK><NEW_LINE>writer.writeIfSet("-NOBITS", NOBITS);<NEW_LINE>writer.writeIfSet("-z", VERBOSE_TRANSPORT_LOGGING);<NEW_LINE>writer.writeIfSet("-r", RESURRECT_FROM_FILE);<NEW_LINE>writer.writeIfSet("-FederatorConfig", FEDERATOR_CONFIG);<NEW_LINE>writer.writeIfSet("-FederationId", FEDERATION_ID);<NEW_LINE>writer.writeIfSet("-FederateWith", FEDERATE_WITH);<NEW_LINE>writer.writeIfSet("-ReassociateDelay", REASSOCIATE_DELAY);<NEW_LINE>String persistentFile = (String) instance.getAttribute(PERSISTENT_FILE);<NEW_LINE>if (!Strings.isEmpty(persistentFile)) {<NEW_LINE>SvcConfDirective directive = new SvcConfDirective();<NEW_LINE>directive.setServiceName("PersistenceUpdaterSvc");<NEW_LINE>directive.addOptions("-file", persistentFile);<NEW_LINE>directive.writeTo(writer);<NEW_LINE>}<NEW_LINE>writer.writeTo(args);<NEW_LINE>} | writer.writeIfSet("-o", IOR_FILE); |
1,003,970 | public double evaluate(int[] designations, DataSet dataSet, int clusterID) {<NEW_LINE>int N = 0;<NEW_LINE>double sum = 0;<NEW_LINE>List<Vec> X = dataSet.getDataVectors();<NEW_LINE>List<Double> cache = dm.getAccelerationCache(X);<NEW_LINE>if (// special case, can compute in O(N) isntead<NEW_LINE>dm instanceof EuclideanDistance) {<NEW_LINE>Vec mean = new DenseVector(X.get(0).length());<NEW_LINE>for (int i = 0; i < dataSet.size(); i++) {<NEW_LINE>if (designations[i] != clusterID)<NEW_LINE>continue;<NEW_LINE>mean.mutableAdd(X.get(i));<NEW_LINE>N++;<NEW_LINE>}<NEW_LINE>// 1e-10 incase N=0<NEW_LINE>mean.mutableDivide((N + 1e-10));<NEW_LINE>List<Double> qi = dm.getQueryInfo(mean);<NEW_LINE>for (int i = 0; i < dataSet.size(); i++) {<NEW_LINE>if (designations[i] == clusterID)<NEW_LINE>sum += Math.pow(dm.dist(i, mean, qi, X, cache), 2);<NEW_LINE>}<NEW_LINE>return sum;<NEW_LINE>}<NEW_LINE>// regulare case, O(N^2)<NEW_LINE>for (int i = 0; i < dataSet.size(); i++) {<NEW_LINE>if (designations[i] != clusterID)<NEW_LINE>continue;<NEW_LINE>N++;<NEW_LINE>for (int j = i + 1; j < dataSet.size(); j++) {<NEW_LINE>if (designations[j] == clusterID)<NEW_LINE>sum += 2 * Math.pow(dm.dist(i, j, X, cache), 2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | return sum / (N * 2); |
1,638,461 | public JdbcCustomConversions jdbcCustomConversions() {<NEW_LINE>System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");<NEW_LINE>System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");<NEW_LINE>System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");<NEW_LINE>System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");<NEW_LINE>System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO");<NEW_LINE><MASK><NEW_LINE>return new JdbcCustomConversions(Arrays.asList(new UserIdReadingConverter(), new UserIdWritingConverter()));<NEW_LINE>} | System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOO"); |
1,135,104 | private void initTable(Composite control) {<NEW_LINE>if (tv == null) {<NEW_LINE>tv = TableViewFactory.createTableViewSWT(TagDiscovery.class, TABLE_TAGDISCOVERY, TABLE_TAGDISCOVERY, new TableColumnCore[0], ColumnTagName.COLUMN_ID, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);<NEW_LINE>SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) getSkinObject("filterbox");<NEW_LINE>if (soFilter != null) {<NEW_LINE>tv.enableFilterCheck(<MASK><NEW_LINE>}<NEW_LINE>tv.setRowDefaultHeightEM(1);<NEW_LINE>table_parent = new Composite(control, SWT.BORDER);<NEW_LINE>table_parent.setLayoutData(Utils.getFilledFormData());<NEW_LINE>GridLayout layout = new GridLayout();<NEW_LINE>layout.marginHeight = layout.marginWidth = layout.verticalSpacing = layout.horizontalSpacing = 0;<NEW_LINE>table_parent.setLayout(layout);<NEW_LINE>tv.addMenuFillListener(this);<NEW_LINE>tv.addSelectionListener(this, false);<NEW_LINE>tv.initialize(table_parent);<NEW_LINE>}<NEW_LINE>control.layout(true);<NEW_LINE>} | soFilter.getBubbleTextBox(), this); |
1,124,667 | private void processILeappFs(Content dataSource, Case currentCase, DataSourceIngestModuleProgress statusHelper, String directoryToProcess) {<NEW_LINE>statusHelper.progress(NbBundle.getMessage(this.getClass(), "ILeappAnalyzerIngestModule.processing.filesystem"));<NEW_LINE>// NON-NLS<NEW_LINE>String currentTime = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss z", Locale.US).format(System.currentTimeMillis());<NEW_LINE>Path moduleOutputPath = Paths.get(currentCase.getModuleDirectory(), ILEAPP, currentTime);<NEW_LINE>try {<NEW_LINE>Files.createDirectories(moduleOutputPath);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>logger.log(Level.SEVERE, String.format("Error creating iLeapp output directory %s", moduleOutputPath.toString()), ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ProcessBuilder iLeappCommand = <MASK><NEW_LINE>try {<NEW_LINE>int result = ExecUtil.execute(iLeappCommand, new DataSourceIngestModuleProcessTerminator(context, true));<NEW_LINE>if (result != 0) {<NEW_LINE>logger.log(Level.WARNING, String.format("Error when trying to execute iLeapp program getting file paths to search for result is %d", result));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>addILeappReportToReports(moduleOutputPath, currentCase);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>logger.log(Level.SEVERE, String.format("Error when trying to execute iLeapp program against file system"), ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (context.dataSourceIngestIsCancelled()) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.INFO, "ILeapp Analyser ingest module run was canceled");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>iLeappFileProcessor.processFileSystem(dataSource, moduleOutputPath, statusHelper);<NEW_LINE>} | buildiLeappCommand(moduleOutputPath, directoryToProcess, "fs"); |
1,834,204 | private void checkDuplicate(Collection<? extends Dom> beans) {<NEW_LINE>if (beans == null || beans.size() <= 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WeakHashMap keyBeanMap = new WeakHashMap();<NEW_LINE>ArrayList<String> keys = new ArrayList<String>(beans.size());<NEW_LINE>for (Dom b : beans) {<NEW_LINE>String key = b.getKey();<NEW_LINE>keyBeanMap.put(key, b);<NEW_LINE>keys.add(key);<NEW_LINE>}<NEW_LINE>WeakHashMap<String, Class<ConfigBeanProxy>> errorKeyBeanMap = new WeakHashMap<String<MASK><NEW_LINE>String[] strKeys = keys.toArray(new String[beans.size()]);<NEW_LINE>for (int i = 0; i < strKeys.length; i++) {<NEW_LINE>for (int j = i + 1; j < strKeys.length; j++) {<NEW_LINE>// If the keys are same and if the indexes don't match<NEW_LINE>// we have a duplicate. So output that error<NEW_LINE>if ((strKeys[i].equals(strKeys[j]))) {<NEW_LINE>errorKeyBeanMap.put(strKeys[i], ((Dom) keyBeanMap.get(strKeys[i])).getProxyType());<NEW_LINE>error = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry e : errorKeyBeanMap.entrySet()) {<NEW_LINE>Result result = new Result(STRINGS.get("VerifyDupKey", e.getKey(), e.getValue()));<NEW_LINE>output(result);<NEW_LINE>}<NEW_LINE>} | , Class<ConfigBeanProxy>>(); |
1,387,743 | public void testCriteriaQuery_String(TestExecutionContext testExecCtx, TestExecutionResources testExecResources, Object managedComponentObject) throws Throwable {<NEW_LINE>final String testName = getTestName();<NEW_LINE>// Verify parameters<NEW_LINE>if (testExecCtx == null || testExecResources == null) {<NEW_LINE>Assert.fail(testName + ": Missing context and/or resources. Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final JPAResource jpaResource = testExecResources.getJpaResourceMap().get("test-jpa-resource");<NEW_LINE>if (jpaResource == null) {<NEW_LINE>Assert.fail("Missing JPAResource 'test-jpa-resource'). Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Process Test Properties<NEW_LINE>final Map<String, Serializable> testProps = testExecCtx.getProperties();<NEW_LINE>if (testProps != null) {<NEW_LINE>for (String key : testProps.keySet()) {<NEW_LINE>System.out.println("Test Property: " + key + " = " <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>EntityManager em = jpaResource.getEm();<NEW_LINE>TransactionJacket tx = jpaResource.getTj();<NEW_LINE>// Execute Test Case<NEW_LINE>try {<NEW_LINE>tx.beginTransaction();<NEW_LINE>if (jpaResource.getPcCtxInfo().getPcType() == PersistenceContextType.APPLICATION_MANAGED_JTA)<NEW_LINE>em.joinTransaction();<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<Entity0005> cq = cb.createQuery(Entity0005.class);<NEW_LINE>Root<Entity0005> root = cq.from(Entity0005.class);<NEW_LINE>cq.select(root);<NEW_LINE>TypedQuery<Entity0005> tq = em.createQuery(cq);<NEW_LINE>Entity0005 findEntity = tq.getSingleResult();<NEW_LINE>System.out.println("Object returned by query: " + findEntity);<NEW_LINE>assertNotNull("Did not find entity in criteria query", findEntity);<NEW_LINE>assertTrue("Entity returned by find was not contained in the persistence context.", em.contains(findEntity));<NEW_LINE>assertEquals("c", findEntity.getEntity0005_id());<NEW_LINE>assertEquals("Entity0005_STRING01", findEntity.getEntity0005_string01());<NEW_LINE>assertEquals("Entity0005_STRING02", findEntity.getEntity0005_string02());<NEW_LINE>assertEquals("Entity0005_STRING03", findEntity.getEntity0005_string03());<NEW_LINE>tx.commitTransaction();<NEW_LINE>} finally {<NEW_LINE>System.out.println(testName + ": End");<NEW_LINE>}<NEW_LINE>} | + testProps.get(key)); |
500,956 | public static I_C_Invoice_Candidate createIcAndSetCommonFields(@NonNull final I_C_Flatrate_Term term) {<NEW_LINE>// Services<NEW_LINE>final DimensionService dimensionService = SpringContextHolder.instance.getBean(DimensionService.class);<NEW_LINE>final IOrderDAO orderDAO = Services.get(IOrderDAO.class);<NEW_LINE>final IDocTypeBL docTypeBL = Services.get(IDocTypeBL.class);<NEW_LINE>final I_C_Invoice_Candidate ic = newInstance(I_C_Invoice_Candidate.class);<NEW_LINE>ic.setAD_Org_ID(term.getAD_Org_ID());<NEW_LINE>ic.setAD_Table_ID(InterfaceWrapperHelper.getTableId(I_C_Flatrate_Term.class));<NEW_LINE>ic.setRecord_ID(term.getC_Flatrate_Term_ID());<NEW_LINE>ic.setC_Async_Batch_ID(term.getC_Async_Batch_ID());<NEW_LINE>ic.setM_Product_ID(term.getM_Product_ID());<NEW_LINE>ic.setC_Currency_ID(term.getC_Currency_ID());<NEW_LINE>// to be computed<NEW_LINE>ic.setQtyToInvoice(BigDecimal.ZERO);<NEW_LINE>InvoiceCandidateLocationAdapterFactory.billLocationAdapter(ic).setFrom(ContractLocationHelper.extractBillLocation(term));<NEW_LINE>ic.setM_PricingSystem_ID(term.getM_PricingSystem_ID());<NEW_LINE>// 07442 activity and tax<NEW_LINE>final ActivityId activityId = Services.get(IProductAcctDAO.class).retrieveActivityForAcct(ClientId.ofRepoId(term.getAD_Client_ID()), OrgId.ofRepoId(term.getAD_Org_ID()), ProductId.ofRepoId(term.getM_Product_ID()));<NEW_LINE>ic.setIsTaxIncluded(term.isTaxIncluded());<NEW_LINE>if (term.getC_OrderLine_Term_ID() > 0) {<NEW_LINE>final I_C_OrderLine orderLine = orderDAO.getOrderLineById(OrderLineId.ofRepoId(term.getC_OrderLine_Term_ID()));<NEW_LINE>ic.setC_OrderLine_ID(orderLine.getC_OrderLine_ID());<NEW_LINE>final I_C_Order order = orderDAO.getById(OrderId.ofRepoId(orderLine.getC_Order_ID()));<NEW_LINE>ic.setC_Order_ID(orderLine.getC_Order_ID());<NEW_LINE>ic.setC_Incoterms_ID(order.getC_Incoterms_ID());<NEW_LINE>ic.setIncotermLocation(order.getIncotermLocation());<NEW_LINE>// DocType<NEW_LINE>final DocTypeId orderDocTypeId = CoalesceUtil.coalesceSuppliers(() -> DocTypeId.ofRepoIdOrNull(order.getC_DocType_ID()), () -> DocTypeId.ofRepoIdOrNull(order.getC_DocTypeTarget_ID()));<NEW_LINE>if (orderDocTypeId != null) {<NEW_LINE>final I_C_DocType orderDocType = docTypeBL.getById(orderDocTypeId);<NEW_LINE>final DocTypeId invoiceDocTypeId = DocTypeId.ofRepoIdOrNull(orderDocType.getC_DocTypeInvoice_ID());<NEW_LINE>if (invoiceDocTypeId != null) {<NEW_LINE>ic.setC_DocTypeInvoice_ID(invoiceDocTypeId.getRepoId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Dimension orderLineDimension = dimensionService.getFromRecord(orderLine);<NEW_LINE>if (orderLineDimension.getActivityId() == null) {<NEW_LINE>dimensionService.updateRecord(ic<MASK><NEW_LINE>} else {<NEW_LINE>dimensionService.updateRecord(ic, orderLineDimension);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ic;<NEW_LINE>} | , orderLineDimension.withActivityId(activityId)); |
1,709,679 | public void start(Stage stage) {<NEW_LINE>stage.setTitle("ColorPicker");<NEW_LINE>EventHandler<ActionEvent> actionEventHandler = t -> {<NEW_LINE>ColorPicker cp = (ColorPicker) t.getTarget();<NEW_LINE>Color c = cp.getValue();<NEW_LINE>System.out.println("New Color's RGB = " + c.getRed() + " " + c.getGreen() + " " + c.getBlue());<NEW_LINE>};<NEW_LINE>// default mode combobox<NEW_LINE>final ColorPicker normalColorPicker = new ColorPicker();<NEW_LINE>normalColorPicker.setOnAction(actionEventHandler);<NEW_LINE>// simple button mode<NEW_LINE>final ColorPicker buttonColorPicker = new ColorPicker();<NEW_LINE>buttonColorPicker.getStyleClass().add(ColorPicker.STYLE_CLASS_BUTTON);<NEW_LINE>buttonColorPicker.setOnAction(actionEventHandler);<NEW_LINE>// SplitMenuButton mode<NEW_LINE>final ColorPicker splitMenuColorPicker = new ColorPicker();<NEW_LINE>splitMenuColorPicker.getStyleClass().add(ColorPicker.STYLE_CLASS_SPLIT_BUTTON);<NEW_LINE>splitMenuColorPicker.setOnAction(actionEventHandler);<NEW_LINE>// Hidden label mode<NEW_LINE>final ColorPicker noLabelColorPicker = new ColorPicker();<NEW_LINE>noLabelColorPicker.setStyle("-fx-color-label-visible: false;");<NEW_LINE>noLabelColorPicker.setOnAction(actionEventHandler);<NEW_LINE>GridPane grid = new GridPane();<NEW_LINE>grid.setHgap(10);<NEW_LINE>grid.setVgap(10);<NEW_LINE>grid.setPadding(new Insets(10));<NEW_LINE>grid.add(new Label("Default ColorPicker: "), 1, 1);<NEW_LINE>grid.add(normalColorPicker, 2, 1);<NEW_LINE>grid.add(new Label("'Button' ColorPicker: "), 1, 2);<NEW_LINE>grid.<MASK><NEW_LINE>grid.add(new Label("'SplitButton' ColorPicker: "), 1, 3);<NEW_LINE>grid.add(splitMenuColorPicker, 2, 3);<NEW_LINE>grid.add(new Label("'Hidden Label' ColorPicker: "), 1, 4);<NEW_LINE>grid.add(noLabelColorPicker, 2, 4);<NEW_LINE>Scene scene = new Scene(grid, 620, 190);<NEW_LINE>stage.setScene(scene);<NEW_LINE>stage.show();<NEW_LINE>} | add(buttonColorPicker, 2, 2); |
1,517,235 | public static double[] placement3DToMatrix(IfcAxis2Placement3D ifcAxis2Placement3D) {<NEW_LINE>if (ifcAxis2Placement3D.getAxis() != null && ifcAxis2Placement3D.getRefDirection() != null) {<NEW_LINE>double[] cross = Vector.crossProduct(new double[] { ifcAxis2Placement3D.getAxis().getDirectionRatios().get(0), ifcAxis2Placement3D.getAxis().getDirectionRatios().get(1), ifcAxis2Placement3D.getAxis().getDirectionRatios().get(2), 1 }, new double[] { ifcAxis2Placement3D.getRefDirection().getDirectionRatios().get(0), ifcAxis2Placement3D.getRefDirection().getDirectionRatios().get(1), ifcAxis2Placement3D.getRefDirection().getDirectionRatios().get(2), 1 });<NEW_LINE>return new double[] { ifcAxis2Placement3D.getRefDirection().getDirectionRatios().get(0), ifcAxis2Placement3D.getRefDirection().getDirectionRatios().get(1), ifcAxis2Placement3D.getRefDirection().getDirectionRatios().get(2), 0, cross[0], cross[1], cross[2], 0, ifcAxis2Placement3D.getAxis().getDirectionRatios().get(0), ifcAxis2Placement3D.getAxis().getDirectionRatios().get(1), ifcAxis2Placement3D.getAxis().getDirectionRatios().get(2), 0, ifcAxis2Placement3D.getLocation().getCoordinates().get(0), ifcAxis2Placement3D.getLocation().getCoordinates().get(1), ifcAxis2Placement3D.getLocation().getCoordinates()<MASK><NEW_LINE>} else if (ifcAxis2Placement3D.getLocation() != null) {<NEW_LINE>return new double[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ifcAxis2Placement3D.getLocation().getCoordinates().get(0), ifcAxis2Placement3D.getLocation().getCoordinates().get(1), ifcAxis2Placement3D.getLocation().getCoordinates().get(2), 1 };<NEW_LINE>}<NEW_LINE>return Matrix.identity();<NEW_LINE>} | .get(2), 1 }; |
1,440,575 | // Ask by finding all the rdf:_N + rdf:type<NEW_LINE>private QueryIterator execEvaluatedCalc(Binding binding, Node containerNode, Node predicate, Node member, ExecutionContext execCxt) {<NEW_LINE>Graph graph = execCxt.getActiveGraph();<NEW_LINE>if (!containerNode.isVariable()) {<NEW_LINE>// Container a ground term.<NEW_LINE>if (!GraphContainerUtils.isContainer(execCxt.getActiveGraph(), containerNode, typeNode))<NEW_LINE>return IterLib.noResults(execCxt);<NEW_LINE>return oneContainer(binding, containerNode, member, execCxt);<NEW_LINE>}<NEW_LINE>// Container a variable.<NEW_LINE>Collection<Node> c = null;<NEW_LINE>if (member.isVariable())<NEW_LINE>c = findContainers(graph, typeNode);<NEW_LINE>else<NEW_LINE>c = <MASK><NEW_LINE>QueryIterConcat cIter = new QueryIterConcat(execCxt);<NEW_LINE>Var cVar = Var.alloc(containerNode);<NEW_LINE>for (Node cn : c) {<NEW_LINE>// Binding the container node.<NEW_LINE>Binding b = BindingFactory.binding(binding, cVar, cn);<NEW_LINE>Node m = member;<NEW_LINE>// Special case of ?x rdfs:member ?x<NEW_LINE>if (Var.isVar(member) && member.equals(cVar)) {<NEW_LINE>m = cn;<NEW_LINE>}<NEW_LINE>cIter.add(oneContainer(b, cn, m, execCxt));<NEW_LINE>}<NEW_LINE>return cIter;<NEW_LINE>// throw new QueryFatalException(Utils.className(this)+": Arg 1 is too hard : "+containerNode) ;<NEW_LINE>} | findContainingContainers(graph, typeNode, member); |
309,555 | public void draw(TextureRegion region, float x, float y, float width, float height) {<NEW_LINE>if (!drawing)<NEW_LINE>throw new IllegalStateException("PolygonSpriteBatch.begin must be called before draw.");<NEW_LINE>final short[] triangles = this.triangles;<NEW_LINE>final float[] vertices = this.vertices;<NEW_LINE>Texture texture = region.texture;<NEW_LINE>if (texture != lastTexture)<NEW_LINE>switchTexture(texture);<NEW_LINE>else if (//<NEW_LINE>triangleIndex + 6 > triangles.length || vertexIndex + SPRITE_SIZE > vertices.length)<NEW_LINE>flush();<NEW_LINE>int triangleIndex = this.triangleIndex;<NEW_LINE>final int startVertex = vertexIndex / VERTEX_SIZE;<NEW_LINE>triangles[triangleIndex++] = (short) startVertex;<NEW_LINE>triangles[triangleIndex++] = (short) (startVertex + 1);<NEW_LINE>triangles[triangleIndex++] = (short) (startVertex + 2);<NEW_LINE>triangles[triangleIndex++] = (short) (startVertex + 2);<NEW_LINE>triangles[triangleIndex++] = (short) (startVertex + 3);<NEW_LINE>triangles[<MASK><NEW_LINE>this.triangleIndex = triangleIndex;<NEW_LINE>final float fx2 = x + width;<NEW_LINE>final float fy2 = y + height;<NEW_LINE>final float u = region.u;<NEW_LINE>final float v = region.v2;<NEW_LINE>final float u2 = region.u2;<NEW_LINE>final float v2 = region.v;<NEW_LINE>float color = this.colorPacked;<NEW_LINE>int idx = this.vertexIndex;<NEW_LINE>vertices[idx++] = x;<NEW_LINE>vertices[idx++] = y;<NEW_LINE>vertices[idx++] = color;<NEW_LINE>vertices[idx++] = u;<NEW_LINE>vertices[idx++] = v;<NEW_LINE>vertices[idx++] = x;<NEW_LINE>vertices[idx++] = fy2;<NEW_LINE>vertices[idx++] = color;<NEW_LINE>vertices[idx++] = u;<NEW_LINE>vertices[idx++] = v2;<NEW_LINE>vertices[idx++] = fx2;<NEW_LINE>vertices[idx++] = fy2;<NEW_LINE>vertices[idx++] = color;<NEW_LINE>vertices[idx++] = u2;<NEW_LINE>vertices[idx++] = v2;<NEW_LINE>vertices[idx++] = fx2;<NEW_LINE>vertices[idx++] = y;<NEW_LINE>vertices[idx++] = color;<NEW_LINE>vertices[idx++] = u2;<NEW_LINE>vertices[idx++] = v;<NEW_LINE>this.vertexIndex = idx;<NEW_LINE>} | triangleIndex++] = (short) startVertex; |
524,059 | String buildUnloadStatement(UnloadConfig unloadConfig, boolean maskCredentials) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(String.format("UNLOAD ('%s') TO '%s'\n", escapeParam(unloadConfig.query), escapeParam(unloadConfig.toWithPrefixDir)));<NEW_LINE>// credentials<NEW_LINE>appendCredentialsPart(sb, unloadConfig, maskCredentials);<NEW_LINE>// Options<NEW_LINE>appendOption(sb, "MANIFEST", unloadConfig.manifest);<NEW_LINE>appendOption(sb, "ENCRYPTED", unloadConfig.encrypted);<NEW_LINE>appendOption(sb, "DELIMITER", unloadConfig.delimiter);<NEW_LINE>appendOption(sb, "FIXEDWIDTH", unloadConfig.fixedwidth);<NEW_LINE>appendOption(sb, "GZIP", unloadConfig.gzip);<NEW_LINE>appendOption(<MASK><NEW_LINE>appendOption(sb, "ADDQUOTES", unloadConfig.addquotes);<NEW_LINE>appendOption(sb, "NULL AS", unloadConfig.nullAs);<NEW_LINE>appendOption(sb, "ESCAPE", unloadConfig.escape);<NEW_LINE>appendOption(sb, "ALLOWOVERWRITE", unloadConfig.allowoverwrite);<NEW_LINE>appendOption(sb, "PARALLEL", unloadConfig.parallel, true);<NEW_LINE>return sb.toString();<NEW_LINE>} | sb, "BZIP2", unloadConfig.bzip2); |
626,766 | public License sign(License licenseSpec) throws IOException {<NEW_LINE>XContentBuilder contentBuilder = XContentFactory.contentBuilder(XContentType.JSON);<NEW_LINE>final Map<String, String> licenseSpecViewMode = Collections.singletonMap(License.LICENSE_SPEC_VIEW_MODE, "true");<NEW_LINE>licenseSpec.toXContent(contentBuilder, new ToXContent.MapParams(licenseSpecViewMode));<NEW_LINE>final byte[] signedContent;<NEW_LINE>final boolean preV4 = licenseSpec.version() < License.VERSION_CRYPTO_ALGORITHMS;<NEW_LINE>try {<NEW_LINE>final Signature rsa = Signature.getInstance("SHA512withRSA");<NEW_LINE>PrivateKey decryptedPrivateKey = CryptUtils.readEncryptedPrivateKey(Files.readAllBytes(privateKeyPath));<NEW_LINE>rsa.initSign(decryptedPrivateKey);<NEW_LINE>final BytesRefIterator iterator = BytesReference.bytes(contentBuilder).iterator();<NEW_LINE>BytesRef ref;<NEW_LINE>while ((ref = iterator.next()) != null) {<NEW_LINE>rsa.update(ref.bytes, ref.offset, ref.length);<NEW_LINE>}<NEW_LINE>signedContent = rsa.sign();<NEW_LINE>} catch (InvalidKeyException | IOException | NoSuchAlgorithmException | SignatureException e) {<NEW_LINE>throw new IllegalStateException(e);<NEW_LINE>}<NEW_LINE>final byte[] magic = new byte[MAGIC_LENGTH];<NEW_LINE>SecureRandom random = new SecureRandom();<NEW_LINE>random.nextBytes(magic);<NEW_LINE>final byte[] <MASK><NEW_LINE>PublicKey publicKey = CryptUtils.readPublicKey(publicKeyBytes);<NEW_LINE>final byte[] pubKeyFingerprint = preV4 ? Base64.getEncoder().encode(CryptUtils.writeEncryptedPublicKey(publicKey)) : getPublicKeyFingerprint(publicKeyBytes);<NEW_LINE>byte[] bytes = new byte[4 + 4 + MAGIC_LENGTH + 4 + pubKeyFingerprint.length + 4 + signedContent.length];<NEW_LINE>ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);<NEW_LINE>byteBuffer.putInt(licenseSpec.version()).putInt(magic.length).put(magic).putInt(pubKeyFingerprint.length).put(pubKeyFingerprint).putInt(signedContent.length).put(signedContent);<NEW_LINE>return License.builder().fromLicenseSpec(licenseSpec, Base64.getEncoder().encodeToString(bytes)).build();<NEW_LINE>} | publicKeyBytes = Files.readAllBytes(publicKeyPath); |
1,634,031 | public PwGroup search(Database db, String qStr) {<NEW_LINE>PwDatabase pm = db.pm;<NEW_LINE>PwGroup group;<NEW_LINE>if (pm instanceof PwDatabaseV3) {<NEW_LINE>group = new PwGroupV3();<NEW_LINE>} else if (pm instanceof PwDatabaseV4) {<NEW_LINE>group = new PwGroupV4();<NEW_LINE>} else {<NEW_LINE>Log.d("SearchDbHelper", "Tried to search with unknown db");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>group.name = mCtx.<MASK><NEW_LINE>group.childEntries = new ArrayList<PwEntry>();<NEW_LINE>// Search all entries<NEW_LINE>Locale loc = Locale.getDefault();<NEW_LINE>qStr = qStr.toLowerCase(loc);<NEW_LINE>boolean isOmitBackup = omitBackup();<NEW_LINE>Queue<PwGroup> worklist = new LinkedList<PwGroup>();<NEW_LINE>if (pm.rootGroup != null) {<NEW_LINE>worklist.add(pm.rootGroup);<NEW_LINE>}<NEW_LINE>while (worklist.size() != 0) {<NEW_LINE>PwGroup top = worklist.remove();<NEW_LINE>if (pm.isGroupSearchable(top, isOmitBackup)) {<NEW_LINE>for (PwEntry entry : top.childEntries) {<NEW_LINE>processEntries(entry, group.childEntries, qStr, loc);<NEW_LINE>}<NEW_LINE>for (PwGroup childGroup : top.childGroups) {<NEW_LINE>if (childGroup != null) {<NEW_LINE>worklist.add(childGroup);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return group;<NEW_LINE>} | getString(R.string.search_results); |
11,934 | protected void fillIntent(Activity activity, Intent intent) {<NEW_LINE>super.fillIntent(activity, intent);<NEW_LINE>boolean modal = false;<NEW_LINE>if (hasProperty(TiC.PROPERTY_MODAL)) {<NEW_LINE>modal = TiConvert.toBoolean(getProperty(TiC.PROPERTY_MODAL), false);<NEW_LINE>if (modal) {<NEW_LINE>intent.setClass(activity, TiTranslucentActivity.class);<NEW_LINE>}<NEW_LINE>intent.putExtra(TiC.PROPERTY_MODAL, modal);<NEW_LINE>}<NEW_LINE>if (!modal && hasProperty(TiC.PROPERTY_OPACITY)) {<NEW_LINE>intent.<MASK><NEW_LINE>} else if (hasProperty(TiC.PROPERTY_BACKGROUND_COLOR)) {<NEW_LINE>int bgColor = TiConvert.toColor(properties, TiC.PROPERTY_BACKGROUND_COLOR, getActivity());<NEW_LINE>if (Color.alpha(bgColor) < 0xFF) {<NEW_LINE>intent.setClass(activity, TiTranslucentActivity.class);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hasProperty(TiC.PROPERTY_WINDOW_PIXEL_FORMAT)) {<NEW_LINE>intent.putExtra(TiC.PROPERTY_WINDOW_PIXEL_FORMAT, TiConvert.toInt(getProperty(TiC.PROPERTY_WINDOW_PIXEL_FORMAT), PixelFormat.UNKNOWN));<NEW_LINE>}<NEW_LINE>// Set the splitActionBar property<NEW_LINE>if (hasProperty(TiC.PROPERTY_SPLIT_ACTIONBAR)) {<NEW_LINE>boolean splitActionBar = TiConvert.toBoolean(getProperty(TiC.PROPERTY_SPLIT_ACTIONBAR), false);<NEW_LINE>if (splitActionBar) {<NEW_LINE>intent.putExtra(TiC.PROPERTY_SPLIT_ACTIONBAR, splitActionBar);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setClass(activity, TiTranslucentActivity.class); |
955,611 | public Object clusterOverview(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>if (!Env.getCurrentEnv().isMaster()) {<NEW_LINE>return redirectToMaster(request, response);<NEW_LINE>}<NEW_LINE>Map<String, Object> resultMap = Maps.newHashMap();<NEW_LINE>Env env = Env.getCurrentEnv();<NEW_LINE>SystemInfoService infoService = Env.getCurrentSystemInfo();<NEW_LINE>resultMap.put("dbCount", env.getInternalCatalog().getDbIds().size());<NEW_LINE>resultMap.put<MASK><NEW_LINE>resultMap.put("diskOccupancy", getDiskOccupancy(infoService));<NEW_LINE>resultMap.put("beCount", infoService.getClusterBackendIds(SystemInfoService.DEFAULT_CLUSTER).size());<NEW_LINE>resultMap.put("feCount", env.getFrontends(null).size());<NEW_LINE>resultMap.put("remainDisk", getRemainDisk(infoService));<NEW_LINE>return ResponseEntityBuilder.ok(resultMap);<NEW_LINE>} | ("tblCount", getTblCount(env)); |
28,583 | private void loadNode442() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.CertificateGroupFolderType_AdditionalGroup_Placeholder_TrustList_OpenWithMasks_InputArguments, new QualifiedName(0, "InputArguments"), new LocalizedText("en", "InputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Argument, 1, new UInteger[] { org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger.valueOf(0) }, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_AdditionalGroup_Placeholder_TrustList_OpenWithMasks_InputArguments, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_AdditionalGroup_Placeholder_TrustList_OpenWithMasks_InputArguments, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.CertificateGroupFolderType_AdditionalGroup_Placeholder_TrustList_OpenWithMasks_InputArguments, Identifiers.HasProperty, Identifiers.CertificateGroupFolderType_AdditionalGroup_Placeholder_TrustList_OpenWithMasks<MASK><NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<ListOfExtensionObject xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\"><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>Masks</Name><DataType><Identifier>i=7</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject>");<NEW_LINE>String xml = sb.toString();<NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));<NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new DataValue(new Variant(o));<NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), false)); |
26,362 | public void commit(TableMetadata base, TableMetadata metadata) {<NEW_LINE>UpdateTableRequest.Builder requestBuilder;<NEW_LINE>List<MetadataUpdate> baseChanges;<NEW_LINE>Consumer<ErrorResponse> errorHandler;<NEW_LINE>switch(updateType) {<NEW_LINE>case CREATE:<NEW_LINE>Preconditions.checkState(base == null, "Invalid base metadata for create transaction, expected null: %s", base);<NEW_LINE>requestBuilder = UpdateTableRequest.builderForCreate();<NEW_LINE>baseChanges = createChanges;<NEW_LINE>// throws NoSuchTableException<NEW_LINE>errorHandler = ErrorHandlers.tableErrorHandler();<NEW_LINE>break;<NEW_LINE>case REPLACE:<NEW_LINE>Preconditions.checkState(base != null, "Invalid base metadata: null");<NEW_LINE>// use the original replace base metadata because the transaction will refresh<NEW_LINE>requestBuilder = UpdateTableRequest.builderForReplace(replaceBase);<NEW_LINE>baseChanges = createChanges;<NEW_LINE>errorHandler = ErrorHandlers.tableCommitHandler();<NEW_LINE>break;<NEW_LINE>case SIMPLE:<NEW_LINE>Preconditions.checkState(base != null, "Invalid base metadata: null");<NEW_LINE>requestBuilder = UpdateTableRequest.builderFor(base);<NEW_LINE>baseChanges = ImmutableList.of();<NEW_LINE>errorHandler = ErrorHandlers.tableCommitHandler();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new UnsupportedOperationException(String<MASK><NEW_LINE>}<NEW_LINE>baseChanges.forEach(requestBuilder::update);<NEW_LINE>metadata.changes().forEach(requestBuilder::update);<NEW_LINE>UpdateTableRequest request = requestBuilder.build();<NEW_LINE>// the error handler will throw necessary exceptions like CommitFailedException and UnknownCommitStateException<NEW_LINE>// TODO: ensure that the HTTP client lib passes HTTP client errors to the error handler<NEW_LINE>LoadTableResponse response = client.post(path, request, LoadTableResponse.class, errorHandler);<NEW_LINE>// all future commits should be simple commits<NEW_LINE>this.updateType = UpdateType.SIMPLE;<NEW_LINE>updateCurrentMetadata(response);<NEW_LINE>} | .format("Update type %s is not supported", updateType)); |
1,600,183 | public void changeIconSize(final NodeModel node, final Quantity<LengthUnit> iconSize) {<NEW_LINE>final IActor actor = new IActor() {<NEW_LINE><NEW_LINE>private Quantity<LengthUnit> oldIconSize;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void act() {<NEW_LINE>oldIconSize = node.getSharedData().getIcons().getIconSize();<NEW_LINE>node.getSharedData().getIcons().setIconSize(iconSize);<NEW_LINE>Controller.getCurrentModeController().getMapController().nodeChanged(node, NodeModel.NODE_ICON_SIZE, null, iconSize);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getDescription() {<NEW_LINE>return "changeIconSize";<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void undo() {<NEW_LINE>node.getSharedData().getIcons().setIconSize(oldIconSize);<NEW_LINE>Controller.getCurrentModeController().getMapController().nodeChanged(node, NodeModel.NODE_ICON_SIZE, oldIconSize, null);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Controller.getCurrentModeController().execute(<MASK><NEW_LINE>} | actor, node.getMap()); |
625,196 | protected static Member[] expandMultiPositionSlicerMembers(Member[] members, Evaluator evaluator) {<NEW_LINE>Map<Hierarchy, <MASK><NEW_LINE>if (evaluator instanceof RolapEvaluator) {<NEW_LINE>// get the slicer members from the evaluator<NEW_LINE>mapOfSlicerMembers = ((RolapEvaluator) evaluator).getSlicerMembersByHierarchy();<NEW_LINE>}<NEW_LINE>if (mapOfSlicerMembers != null) {<NEW_LINE>List<Member> listOfMembers = new ArrayList<Member>();<NEW_LINE>// Iterate the given list of members, removing any whose hierarchy<NEW_LINE>// has multiple members on the slicer axis<NEW_LINE>for (Member member : members) {<NEW_LINE>Hierarchy hierarchy = member.getHierarchy();<NEW_LINE>if (!mapOfSlicerMembers.containsKey(hierarchy) || mapOfSlicerMembers.get(hierarchy).size() < 2 || member instanceof RolapResult.CompoundSlicerRolapMember) {<NEW_LINE>listOfMembers.add(member);<NEW_LINE>} else {<NEW_LINE>listOfMembers.addAll(mapOfSlicerMembers.get(hierarchy));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>members = listOfMembers.toArray(new Member[listOfMembers.size()]);<NEW_LINE>}<NEW_LINE>return members;<NEW_LINE>} | Set<Member>> mapOfSlicerMembers = null; |
1,705,939 | public static DescribeDatabaseResourceUsageResponse unmarshall(DescribeDatabaseResourceUsageResponse describeDatabaseResourceUsageResponse, UnmarshallerContext context) {<NEW_LINE>describeDatabaseResourceUsageResponse.setRequestId<MASK><NEW_LINE>List<MonitorData> monitorDatas = new ArrayList<MonitorData>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeDatabaseResourceUsageResponse.MonitorDatas.Length"); i++) {<NEW_LINE>MonitorData monitorData = new MonitorData();<NEW_LINE>monitorData.setDate(context.stringValue("DescribeDatabaseResourceUsageResponse.MonitorDatas[" + i + "].Date"));<NEW_LINE>monitorData.setBinlogSize(context.longValue("DescribeDatabaseResourceUsageResponse.MonitorDatas[" + i + "].BinlogSize"));<NEW_LINE>monitorData.setDataSize(context.longValue("DescribeDatabaseResourceUsageResponse.MonitorDatas[" + i + "].DataSize"));<NEW_LINE>monitorData.setOtherSize(context.longValue("DescribeDatabaseResourceUsageResponse.MonitorDatas[" + i + "].OtherSize"));<NEW_LINE>monitorData.setTotalSize(context.longValue("DescribeDatabaseResourceUsageResponse.MonitorDatas[" + i + "].TotalSize"));<NEW_LINE>monitorDatas.add(monitorData);<NEW_LINE>}<NEW_LINE>describeDatabaseResourceUsageResponse.setMonitorDatas(monitorDatas);<NEW_LINE>return describeDatabaseResourceUsageResponse;<NEW_LINE>} | (context.stringValue("DescribeDatabaseResourceUsageResponse.RequestId")); |
237,523 | synchronized Document runKBP(Properties props) {<NEW_LINE>if (haveRunKBP) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>// Run prerequisites<NEW_LINE>coref(props);<NEW_LINE>Supplier<Annotator> entityMention = (props == EMPTY_PROPS || props == SINGLE_SENTENCE_DOCUMENT) ? defaultEntityMentions : getOrCreate(STANFORD_ENTITY_MENTIONS, props, () -> backend.entityMentions(props, STANFORD_ENTITY_MENTIONS));<NEW_LINE>Annotation ann = asAnnotation(true);<NEW_LINE>entityMention.get().annotate(ann);<NEW_LINE>// Run annotator<NEW_LINE>Supplier<Annotator> kbp = (props == EMPTY_PROPS || props == SINGLE_SENTENCE_DOCUMENT) ? defaultKBP : getOrCreate(STANFORD_KBP, props, () <MASK><NEW_LINE>kbp.get().annotate(ann);<NEW_LINE>// Update data<NEW_LINE>synchronized (serializer) {<NEW_LINE>for (int i = 0; i < sentences.size(); ++i) {<NEW_LINE>CoreMap sentence = ann.get(CoreAnnotations.SentencesAnnotation.class).get(i);<NEW_LINE>Collection<RelationTriple> triples = sentence.get(CoreAnnotations.KBPTriplesAnnotation.class);<NEW_LINE>sentences.get(i).updateKBP(triples.stream().map(ProtobufAnnotationSerializer::toProto));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Return<NEW_LINE>haveRunKBP = true;<NEW_LINE>return this;<NEW_LINE>} | -> backend.kbp(props)); |
191,003 | List<PaddingVector> createMissingMacByteVectors(CipherSuite suite, ProtocolVersion version) {<NEW_LINE>List<PaddingVector> vectorList = new LinkedList<>();<NEW_LINE>int macSize = AlgorithmResolver.getMacAlgorithm(<MASK><NEW_LINE>byte[] padding = createPaddingBytes(DEFAULT_CIPHERTEXT_LENGTH - macSize);<NEW_LINE>// Missing first MAC byte because of overlong valid padding<NEW_LINE>vectorList.add(new TripleVector("MissingMacByteFirst", "MissingMacByteFirst", new ByteArrayExplicitValueModification(new byte[0]), new ByteArrayDeleteModification(0, 1), new ByteArrayExplicitValueModification(padding)));<NEW_LINE>// Missing last MAC byte because of overlong valid padding<NEW_LINE>padding = createPaddingBytes(DEFAULT_CIPHERTEXT_LENGTH - macSize);<NEW_LINE>vectorList.add(new TripleVector("MissingMacByteLast", "MissingMacByteLast", new ByteArrayExplicitValueModification(new byte[0]), new ByteArrayDeleteModification((macSize - 1), 1), new ByteArrayExplicitValueModification(padding)));<NEW_LINE>return vectorList;<NEW_LINE>} | version, suite).getSize(); |
352,838 | static CommandResult createReply(Packet packet, JDWPContext context) {<NEW_LINE>PacketStream input = new PacketStream(packet);<NEW_LINE>PacketStream reply = new PacketStream().replyPacket().id(packet.id);<NEW_LINE>long refTypeId = input.readLong();<NEW_LINE>KlassRef klass = verifyRefType(refTypeId, reply, context);<NEW_LINE>if (klass == null) {<NEW_LINE>return new CommandResult(reply);<NEW_LINE>}<NEW_LINE>// check if class has been prepared<NEW_LINE>if (klass.getStatus() < ClassStatusConstants.PREPARED) {<NEW_LINE>reply.errorCode(ErrorCodes.CLASS_NOT_PREPARED);<NEW_LINE>return new CommandResult(reply);<NEW_LINE>}<NEW_LINE>MethodRef[] declaredMethods = klass.getDeclaredMethodRefs();<NEW_LINE>int numDeclaredMethods = declaredMethods.length;<NEW_LINE>reply.writeInt(numDeclaredMethods);<NEW_LINE>for (MethodRef method : declaredMethods) {<NEW_LINE>reply.writeLong(context.getIds().getIdAsLong(method));<NEW_LINE>reply.writeString(method.getNameAsString());<NEW_LINE>reply.<MASK><NEW_LINE>reply.writeString(method.getGenericSignatureAsString());<NEW_LINE>int modBits = checkSyntheticFlag(method.getModifiers());<NEW_LINE>reply.writeInt(modBits);<NEW_LINE>}<NEW_LINE>return new CommandResult(reply);<NEW_LINE>} | writeString(method.getSignatureAsString()); |
416,071 | /* ======<NEW_LINE>* EXTRAS<NEW_LINE>* ====== */<NEW_LINE>@Override<NEW_LINE>public void onBackPressed() {<NEW_LINE>// If Drawer is open, back key closes it<NEW_LINE>if (mDrawer.isDrawerOpen(GravityCompat.START)) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// If ActionMode is active, back key closes it<NEW_LINE>if (mActionModeHelper.destroyActionModeIfCan())<NEW_LINE>return;<NEW_LINE>// If SearchView is visible, back key cancels search and iconify it<NEW_LINE>if (mSearchView != null && !mSearchView.isIconified()) {<NEW_LINE>mSearchView.setIconified(true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Return to Overall View<NEW_LINE>if (DatabaseService.getInstance().getDatabaseType() != DatabaseType.OVERALL) {<NEW_LINE>MenuItem menuItem = mNavigationView.getMenu().findItem(R.id.nav_overall);<NEW_LINE>onNavigationItemSelected(menuItem);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Close the App<NEW_LINE>DatabaseService.onDestroy();<NEW_LINE>super.onBackPressed();<NEW_LINE>} | mDrawer.closeDrawer(GravityCompat.START); |
1,664,709 | public void marshall(AutoMLCandidate autoMLCandidate, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (autoMLCandidate == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getCandidateName(), CANDIDATENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getFinalAutoMLJobObjectiveMetric(), FINALAUTOMLJOBOBJECTIVEMETRIC_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getCandidateSteps(), CANDIDATESTEPS_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getCandidateStatus(), CANDIDATESTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getInferenceContainers(), INFERENCECONTAINERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getEndTime(), ENDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getFailureReason(), FAILUREREASON_BINDING);<NEW_LINE>protocolMarshaller.marshall(autoMLCandidate.getCandidateProperties(), CANDIDATEPROPERTIES_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | autoMLCandidate.getObjectiveStatus(), OBJECTIVESTATUS_BINDING); |
658,898 | private VirtualMachine connect(int port) throws IOException {<NEW_LINE>VirtualMachineManager manager = Bootstrap.virtualMachineManager();<NEW_LINE>// Find appropiate connector<NEW_LINE>List<AttachingConnector<MASK><NEW_LINE>AttachingConnector chosenConnector = null;<NEW_LINE>for (AttachingConnector c : connectors) {<NEW_LINE>if (c.transport().name().equals(TRANSPORT_NAME)) {<NEW_LINE>chosenConnector = c;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (chosenConnector == null) {<NEW_LINE>throw new IllegalStateException("Could not find socket connector");<NEW_LINE>}<NEW_LINE>// Set port argument<NEW_LINE>AttachingConnector connector = chosenConnector;<NEW_LINE>Map<String, Argument> defaults = connector.defaultArguments();<NEW_LINE>Argument arg = defaults.get(PORT_ARGUMENT_NAME);<NEW_LINE>if (arg == null) {<NEW_LINE>throw new IllegalStateException("Could not find port argument");<NEW_LINE>}<NEW_LINE>arg.setValue(Integer.toString(port));<NEW_LINE>// Attach<NEW_LINE>try {<NEW_LINE>System.out.println("Connector arguments: " + defaults);<NEW_LINE>return connector.attach(defaults);<NEW_LINE>} catch (IllegalConnectorArgumentsException e) {<NEW_LINE>throw new IllegalArgumentException("Illegal connector arguments", e);<NEW_LINE>}<NEW_LINE>} | > connectors = manager.attachingConnectors(); |
1,662,981 | public void initRemoteProxy() {<NEW_LINE>// reading the proxy host name<NEW_LINE>final String host = this.getConfig("remoteProxyHost", "").trim();<NEW_LINE>// reading the proxy host port<NEW_LINE>int port;<NEW_LINE>try {<NEW_LINE>port = Integer.parseInt(this<MASK><NEW_LINE>} catch (final NumberFormatException e) {<NEW_LINE>port = 3128;<NEW_LINE>}<NEW_LINE>// create new config<NEW_LINE>ProxySettings.port = port;<NEW_LINE>ProxySettings.host = host;<NEW_LINE>ProxySettings.setProxyUse4HTTP(ProxySettings.host != null && ProxySettings.host.length() > 0 && this.getConfigBool("remoteProxyUse", false));<NEW_LINE>ProxySettings.setProxyUse4HTTPS(this.getConfig("remoteProxyUse4SSL", "true").equalsIgnoreCase("true"));<NEW_LINE>ProxySettings.user = this.getConfig("remoteProxyUser", "").trim();<NEW_LINE>ProxySettings.password = this.getConfig("remoteProxyPwd", "").trim();<NEW_LINE>// determining addresses for which the remote proxy should not be used<NEW_LINE>final String remoteProxyNoProxy = this.getConfig("remoteProxyNoProxy", "").trim();<NEW_LINE>ProxySettings.noProxy = CommonPattern.COMMA.split(remoteProxyNoProxy);<NEW_LINE>// trim split entries<NEW_LINE>int i = 0;<NEW_LINE>for (final String pattern : ProxySettings.noProxy) {<NEW_LINE>ProxySettings.noProxy[i] = pattern.trim();<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>} | .getConfig("remoteProxyPort", "3128")); |
1,227,834 | private Query newTermQuery(IndexReader reader, Term term) throws IOException {<NEW_LINE>if (ignoreTF) {<NEW_LINE>return new <MASK><NEW_LINE>} else {<NEW_LINE>// we build an artificial TermStates that will give an overall df and ttf<NEW_LINE>// equal to 1<NEW_LINE>TermStates context = new TermStates(reader.getContext());<NEW_LINE>for (LeafReaderContext leafContext : reader.leaves()) {<NEW_LINE>Terms terms = Terms.getTerms(leafContext.reader(), term.field());<NEW_LINE>TermsEnum termsEnum = terms.iterator();<NEW_LINE>if (termsEnum.seekExact(term.bytes())) {<NEW_LINE>// we want the total df and ttf to be 1<NEW_LINE>int freq = 1 - context.docFreq();<NEW_LINE>context.register(termsEnum.termState(), leafContext.ord, freq, freq);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new TermQuery(term, context);<NEW_LINE>}<NEW_LINE>} | ConstantScoreQuery(new TermQuery(term)); |
372,340 | public static ByteBuffer generateAuthenticateMessage(NtlmState ntlmState) {<NEW_LINE>// Allocate memory for blocks from given fixed offset<NEW_LINE>int blocksCursor = BLOCKS_OFFSET;<NEW_LINE>ByteBuffer buf = new ByteBuffer(4096);<NEW_LINE>// Signature: "NTLMSSP\0"<NEW_LINE>buf.writeString(NTLMSSP, RdpConstants.CHARSET_8);<NEW_LINE>buf.writeByte(0);<NEW_LINE>// NTLM Message Type: NTLMSSP_AUTH (0x00000003)<NEW_LINE>buf.writeIntLE(NtlmConstants.NTLMSSP_AUTH);<NEW_LINE>// Although the protocol allows authentication to succeed if the client<NEW_LINE>// provides either LmChallengeResponse or NtChallengeResponse, Windows<NEW_LINE>// implementations provide both.<NEW_LINE>// LM V2 response<NEW_LINE>blocksCursor = writeBlock(buf, ntlmState.lmChallengeResponse, blocksCursor);<NEW_LINE>// NT v2 response<NEW_LINE>blocksCursor = writeBlock(buf, ntlmState.ntChallengeResponse, blocksCursor);<NEW_LINE>// DomainName<NEW_LINE>blocksCursor = writeStringBlock(buf, ntlmState.domain, blocksCursor, RdpConstants.CHARSET_16);<NEW_LINE>// UserName<NEW_LINE>blocksCursor = writeStringBlock(buf, ntlmState.user, blocksCursor, RdpConstants.CHARSET_16);<NEW_LINE>// Workstation<NEW_LINE>blocksCursor = writeStringBlock(buf, ntlmState.workstation, blocksCursor, RdpConstants.CHARSET_16);<NEW_LINE>// EncryptedRandomSessionKey, 16 bytes<NEW_LINE>blocksCursor = writeBlock(<MASK><NEW_LINE>// NegotiateFlags (4 bytes): In connection-oriented mode, a NEGOTIATE<NEW_LINE>// structure that contains the set of bit flags (section 2.2.2.5) negotiated<NEW_LINE>// in the previous messages.<NEW_LINE>// FIXME: remove hardcoded value<NEW_LINE>buf.writeIntLE(/*ntlmState.negotiatedFlags.value*/<NEW_LINE>0xe288b235);<NEW_LINE>buf.writeBytes(generateVersion());<NEW_LINE>// If the CHALLENGE_MESSAGE TargetInfo field (section 2.2.1.2) has an<NEW_LINE>// MsvAvTimestamp present, the client SHOULD provide a MIC(Message Integrity<NEW_LINE>// Check)<NEW_LINE>// Save cursor position to write MIC<NEW_LINE>int savedCursorForMIC = buf.cursor;<NEW_LINE>// later<NEW_LINE>// Write 16 zeroes<NEW_LINE>buf.writeBytes(new byte[16]);<NEW_LINE>if (BLOCKS_OFFSET != buf.cursor)<NEW_LINE>throw new RuntimeException("BUG: Actual offset of first byte of allocated blocks is not equal hardcoded offset. Hardcoded offset: " + BLOCKS_OFFSET + ", actual offset: " + buf.cursor + ". Update hardcoded offset to match actual offset.");<NEW_LINE>buf.cursor = blocksCursor;<NEW_LINE>buf.trimAtCursor();<NEW_LINE>ntlmState.authenticateMessage = buf.toByteArray();<NEW_LINE>// Calculate and write MIC to reserved position<NEW_LINE>ntlmState.ntlm_compute_message_integrity_check();<NEW_LINE>buf.cursor = savedCursorForMIC;<NEW_LINE>buf.writeBytes(ntlmState.messageIntegrityCheck);<NEW_LINE>buf.rewindCursor();<NEW_LINE>return buf;<NEW_LINE>} | buf, ntlmState.encryptedRandomSessionKey, blocksCursor); |
814,101 | public List<? extends Token> tokenize(String pattern) {<NEW_LINE>// split pattern into chunks: sea (raw input) and islands (<ID>, <expr>)<NEW_LINE>List<Chunk> chunks = split(pattern);<NEW_LINE>// create token stream from text and tags<NEW_LINE>List<Token> tokens = new ArrayList<Token>();<NEW_LINE>for (Chunk chunk : chunks) {<NEW_LINE>if (chunk instanceof TagChunk) {<NEW_LINE>TagChunk tagChunk = (TagChunk) chunk;<NEW_LINE>// add special rule token or conjure up new token from name<NEW_LINE>if (Character.isUpperCase(tagChunk.getTag().charAt(0))) {<NEW_LINE>Integer ttype = parser.getTokenType(tagChunk.getTag());<NEW_LINE>if (ttype == Token.INVALID_TYPE) {<NEW_LINE>throw new IllegalArgumentException("Unknown token " + tagChunk.getTag() + " in pattern: " + pattern);<NEW_LINE>}<NEW_LINE>TokenTagToken t = new TokenTagToken(tagChunk.getTag(), <MASK><NEW_LINE>tokens.add(t);<NEW_LINE>} else if (Character.isLowerCase(tagChunk.getTag().charAt(0))) {<NEW_LINE>int ruleIndex = parser.getRuleIndex(tagChunk.getTag());<NEW_LINE>if (ruleIndex == -1) {<NEW_LINE>throw new IllegalArgumentException("Unknown rule " + tagChunk.getTag() + " in pattern: " + pattern);<NEW_LINE>}<NEW_LINE>int ruleImaginaryTokenType = parser.getATNWithBypassAlts().ruleToTokenType[ruleIndex];<NEW_LINE>tokens.add(new RuleTagToken(tagChunk.getTag(), ruleImaginaryTokenType, tagChunk.getLabel()));<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("invalid tag: " + tagChunk.getTag() + " in pattern: " + pattern);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>TextChunk textChunk = (TextChunk) chunk;<NEW_LINE>ANTLRInputStream in = new ANTLRInputStream(textChunk.getText());<NEW_LINE>lexer.setInputStream(in);<NEW_LINE>Token t = lexer.nextToken();<NEW_LINE>while (t.getType() != Token.EOF) {<NEW_LINE>tokens.add(t);<NEW_LINE>t = lexer.nextToken();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// System.out.println("tokens="+tokens);<NEW_LINE>return tokens;<NEW_LINE>} | ttype, tagChunk.getLabel()); |
307,516 | public boolean verifySignature(byte[] message, BigInteger r, BigInteger s) {<NEW_LINE>BigInteger n = key.getParameters().getN();<NEW_LINE>BigInteger e = calculateE(n, message);<NEW_LINE>// r in the range [1,n-1]<NEW_LINE>if (r.compareTo(ONE) < 0 || r.compareTo(n) >= 0) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// s in the range [1,n-1]<NEW_LINE>if (s.compareTo(ONE) < 0 || s.compareTo(n) >= 0) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>BigInteger c = s.modInverse(n);<NEW_LINE>BigInteger u1 = e.multiply(c).mod(n);<NEW_LINE>BigInteger u2 = r.multiply(c).mod(n);<NEW_LINE>ECPoint G = key<MASK><NEW_LINE>ECPoint Q = ((ECPublicKeyParameters) key).getQ();<NEW_LINE>ECPoint point = ECAlgorithms.sumOfTwoMultiplies(G, u1, Q, u2);<NEW_LINE>// components must be bogus.<NEW_LINE>if (point.isInfinity()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>BigInteger v = point.getX().toBigInteger().mod(n);<NEW_LINE>return v.equals(r);<NEW_LINE>} | .getParameters().getG(); |
301,013 | public void removeMemberFromGroup(String groupDn, String memberAttrName, String value) {<NEW_LINE>BasicAttribute attr = new BasicAttribute(memberAttrName, value);<NEW_LINE>ModificationItem item = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attr);<NEW_LINE>try {<NEW_LINE>this.operationManager.modifyAttributesNaming(groupDn, new ModificationItem[] { item }, null);<NEW_LINE>} catch (NoSuchAttributeException e) {<NEW_LINE>logger.<MASK><NEW_LINE>} catch (SchemaViolationException e) {<NEW_LINE>// schema violation removing one member => add the empty attribute, it cannot be other thing<NEW_LINE>logger.infof("Schema violation in group %s removing member %s. Trying adding empty member attribute.", groupDn, value);<NEW_LINE>try {<NEW_LINE>this.operationManager.modifyAttributesNaming(groupDn, new ModificationItem[] { item, new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute(memberAttrName, LDAPConstants.EMPTY_MEMBER_ATTRIBUTE_VALUE)) }, null);<NEW_LINE>} catch (NamingException ex) {<NEW_LINE>throw new ModelException("Could not modify attribute for DN [" + groupDn + "]", ex);<NEW_LINE>}<NEW_LINE>} catch (NamingException e) {<NEW_LINE>throw new ModelException("Could not modify attribute for DN [" + groupDn + "]", e);<NEW_LINE>}<NEW_LINE>} | debugf("Group %s does not contain the member %s", groupDn, value); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.