idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
646,881 | public static Book parseChm(FileObject chmRootDir, String inputHtmlEncoding) throws IOException, ParserConfigurationException, XPathExpressionException {<NEW_LINE>Book result = new Book();<NEW_LINE>result.getMetadata().addTitle(findTitle(chmRootDir));<NEW_LINE>FileObject hhcFileObject = findHhcFileObject(chmRootDir);<NEW_LINE>if (hhcFileObject == null) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>if (inputHtmlEncoding == null) {<NEW_LINE>inputHtmlEncoding = DEFAULT_CHM_HTML_INPUT_ENCODING;<NEW_LINE>}<NEW_LINE>Resources resources = findResources(chmRootDir, inputHtmlEncoding);<NEW_LINE>List<TOCReference> tocReferences = HHCParser.parseHhc(hhcFileObject.getContent().getInputStream(), resources);<NEW_LINE>result.setTableOfContents(new TableOfContents(tocReferences));<NEW_LINE>result.setResources(resources);<NEW_LINE>result.generateSpineFromTableOfContents();<NEW_LINE>return result;<NEW_LINE>} | IllegalArgumentException("No index file found in directory " + chmRootDir + ". (Looked for file ending with extension '.hhc'"); |
459,935 | public void paste(ActionEvent event, Transferable t) {<NEW_LINE>try {<NEW_LINE>final NodeModel target = Controller.getCurrentController().getSelection().getSelected();<NEW_LINE>final String transferData = (String) t.getTransferData(AttributeTransferable.attributesFlavor);<NEW_LINE>final IXMLParser parser = XMLLocalParserFactory.createLocalXMLParser();<NEW_LINE>final IXMLReader xmlReader = new <MASK><NEW_LINE>parser.setReader(xmlReader);<NEW_LINE>int targetRow = targetRow(event);<NEW_LINE>while (!xmlReader.atEOF()) {<NEW_LINE>final XMLElement storage = (XMLElement) parser.parse();<NEW_LINE>String name = storage.getAttribute("name", null);<NEW_LINE>final String object = storage.getAttribute("object", null);<NEW_LINE>Object value = TypeReference.create(object);<NEW_LINE>Attribute attribute = new Attribute(name, value);<NEW_LINE>if (targetRow >= 0)<NEW_LINE>attributeController.insertAttribute(target, targetRow++, attribute);<NEW_LINE>else<NEW_LINE>attributeController.addAttribute(target, attribute);<NEW_LINE>}<NEW_LINE>} catch (UnsupportedFlavorException | IOException | XMLException e) {<NEW_LINE>throw new IllegalArgumentException(e);<NEW_LINE>}<NEW_LINE>} | StdXMLReader(new StringReader(transferData)); |
207,538 | public ConnectionProvider createConnectionProvider(DBSchemaWizardData data, SchemaElement elem) throws SQLException {<NEW_LINE>DatabaseConnection dbconn = findDatabaseConnection(elem);<NEW_LINE>if (dbconn == null) {<NEW_LINE>if (debug) {<NEW_LINE>System.out.<MASK><NEW_LINE>}<NEW_LINE>String message = MessageFormat.format(bundle.getString("EXC_CouldNotCreateConnection"), elem.getUrl());<NEW_LINE>throw new SQLException(message);<NEW_LINE>}<NEW_LINE>if (debug) {<NEW_LINE>System.out.println("[dbschema-ccp] found dbconn='" + dbconn.getDatabaseURL() + "'");<NEW_LINE>}<NEW_LINE>data.setDatabaseConnection(dbconn);<NEW_LINE>ConnectionHandler ch = new ConnectionHandler(data);<NEW_LINE>if (ch.ensureConnection()) {<NEW_LINE>dbconn = data.getDatabaseConnection();<NEW_LINE>if (debug) {<NEW_LINE>System.out.println("[dbschema-ccp] connection ensured ='" + dbconn.getDatabaseURL() + "'");<NEW_LINE>}<NEW_LINE>ConnectionProvider connectionProvider = new ConnectionProvider(dbconn.getJDBCConnection(), dbconn.getDriverClass());<NEW_LINE>connectionProvider.setSchema(dbconn.getSchema());<NEW_LINE>// String schemaName = cni.getName();<NEW_LINE>// schemaElementImpl.setName(DBIdentifier.create(schemaName));<NEW_LINE>return connectionProvider;<NEW_LINE>}<NEW_LINE>if (debug) {<NEW_LINE>System.out.println("[dbschema-ccp] connection not ensured, returning null");<NEW_LINE>}<NEW_LINE>String message = MessageFormat.format(bundle.getString("EXC_UnableToConnect"), elem.getUrl());<NEW_LINE>throw new SQLException(message);<NEW_LINE>} | println("[dbschema-ccp] not found dbconn='" + dbconn + "'"); |
663,244 | private RouteSearchParameters processRouteRequestOptions(RouteSearchParameters params) throws StatusCodeException {<NEW_LINE><MASK><NEW_LINE>if (routeOptions.hasProfileParams())<NEW_LINE>params.setProfileParams(convertParameters(routeOptions, params.getProfileType()));<NEW_LINE>if (routeOptions.hasVehicleType())<NEW_LINE>params.setVehicleType(convertVehicleType(routeOptions.getVehicleType(), params.getProfileType()));<NEW_LINE>if (routeOptions.hasRoundTripOptions()) {<NEW_LINE>RouteRequestRoundTripOptions roundTripOptions = routeOptions.getRoundTripOptions();<NEW_LINE>if (roundTripOptions.hasLength()) {<NEW_LINE>params.setRoundTripLength(roundTripOptions.getLength());<NEW_LINE>} else {<NEW_LINE>throw new MissingParameterException(RoutingErrorCodes.MISSING_PARAMETER, RouteRequestRoundTripOptions.PARAM_LENGTH);<NEW_LINE>}<NEW_LINE>if (roundTripOptions.hasPoints()) {<NEW_LINE>params.setRoundTripPoints(roundTripOptions.getPoints());<NEW_LINE>}<NEW_LINE>if (roundTripOptions.hasSeed()) {<NEW_LINE>params.setRoundTripSeed(roundTripOptions.getSeed());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return params;<NEW_LINE>} | params = processRequestOptions(routeOptions, params); |
690,524 | private Expr parseExpr(String s) throws QueryParseException {<NEW_LINE>try {<NEW_LINE>ARQParser parser = new ARQParser(new StringReader("SELECT " + s));<NEW_LINE>parser.setQuery(new Query());<NEW_LINE>parser.getQuery().setPrefixMapping(query.getPrefixMapping());<NEW_LINE>parser.SelectClause();<NEW_LINE>Query q = parser.getQuery();<NEW_LINE>VarExprList vel = q.getProject();<NEW_LINE>return vel.getExprs().values().iterator().next();<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginLine);<NEW_LINE>} catch (TokenMgrError tErr) {<NEW_LINE>throw new QueryParseException(tErr.getMessage(<MASK><NEW_LINE>} catch (Error err) {<NEW_LINE>// The token stream can throw java.lang.Error's<NEW_LINE>String tmp = err.getMessage();<NEW_LINE>if (tmp == null)<NEW_LINE>throw new QueryParseException(err, -1, -1);<NEW_LINE>throw new QueryParseException(tmp, -1, -1);<NEW_LINE>}<NEW_LINE>} | ), -1, -1); |
1,778,583 | public LookupImpl createLookup(@Nonnull final Editor editor, @Nonnull LookupElement[] items, @Nonnull final String prefix, @Nonnull final LookupArranger arranger) {<NEW_LINE>hideActiveLookup();<NEW_LINE>final LookupImpl lookup = createLookup(editor, arranger, myProject);<NEW_LINE>final Alarm alarm = new Alarm();<NEW_LINE>ApplicationManager.getApplication().assertIsDispatchThread();<NEW_LINE>myActiveLookup = lookup;<NEW_LINE>myActiveLookupEditor = editor;<NEW_LINE>myActiveLookup.addLookupListener(new LookupListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void itemSelected(@Nonnull LookupEvent event) {<NEW_LINE>lookupClosed();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void lookupCanceled(@Nonnull LookupEvent event) {<NEW_LINE>lookupClosed();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void currentItemChanged(@Nonnull LookupEvent event) {<NEW_LINE>alarm.cancelAllRequests();<NEW_LINE>CodeInsightSettings settings = CodeInsightSettings.getInstance();<NEW_LINE>if (settings.AUTO_POPUP_JAVADOC_INFO && DocumentationManager.getInstance(myProject).getDocInfoHint() == null) {<NEW_LINE>alarm.addRequest(() -> showJavadoc(lookup), settings.JAVADOC_INFO_DELAY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>private void lookupClosed() {<NEW_LINE>ApplicationManager.getApplication().assertIsDispatchThread();<NEW_LINE>alarm.cancelAllRequests();<NEW_LINE>lookup.removeLookupListener(this);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Disposer.register(lookup, new Disposable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void dispose() {<NEW_LINE>myActiveLookup = null;<NEW_LINE>myActiveLookupEditor = null;<NEW_LINE>myPropertyChangeSupport.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (items.length > 0) {<NEW_LINE>CamelHumpMatcher matcher = new CamelHumpMatcher(prefix);<NEW_LINE>for (LookupElement item : items) {<NEW_LINE>myActiveLookup.addItem(item, matcher);<NEW_LINE>}<NEW_LINE>myActiveLookup.refreshUi(true, true);<NEW_LINE>} else {<NEW_LINE>// no items -> no doc<NEW_LINE>alarm.cancelAllRequests();<NEW_LINE>}<NEW_LINE>myPropertyChangeSupport.firePropertyChange(PROP_ACTIVE_LOOKUP, null, myActiveLookup);<NEW_LINE>return lookup;<NEW_LINE>} | firePropertyChange(PROP_ACTIVE_LOOKUP, lookup, null); |
1,834,414 | public void read(org.apache.thrift.protocol.TProtocol iprot, ping_result struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // SEC<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.sec = new ThriftSecurityException();<NEW_LINE>struct.sec.read(iprot);<NEW_LINE>struct.setSecIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.<MASK><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); |
324 | public void solve() {<NEW_LINE>model.getSolver().solve();<NEW_LINE>System.out.println(String.format("Ortho latin square(%s)", m));<NEW_LINE>StringBuilder st = new StringBuilder();<NEW_LINE>st.append("\t");<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>for (int j = 0; j < m; j++) {<NEW_LINE>st.append(String.format("%d ", square1[i * m + <MASK><NEW_LINE>}<NEW_LINE>st.append("\n\t");<NEW_LINE>}<NEW_LINE>st.append("\n\t");<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>for (int j = 0; j < m; j++) {<NEW_LINE>st.append(String.format("%d ", square2[i * m + j].getValue()));<NEW_LINE>}<NEW_LINE>st.append("\n\t");<NEW_LINE>}<NEW_LINE>System.out.println(st);<NEW_LINE>} | j].getValue())); |
869,625 | public GetDeviceMethodsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetDeviceMethodsResult getDeviceMethodsResult = new GetDeviceMethodsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getDeviceMethodsResult;<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("deviceMethods", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDeviceMethodsResult.setDeviceMethods(new ListUnmarshaller<DeviceMethod>(DeviceMethodJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getDeviceMethodsResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
643,332 | public void marshall(ListStudioLifecycleConfigsRequest listStudioLifecycleConfigsRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (listStudioLifecycleConfigsRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getMaxResults(), MAXRESULTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getNextToken(), NEXTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getNameContains(), NAMECONTAINS_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getAppTypeEquals(), APPTYPEEQUALS_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getCreationTimeBefore(), CREATIONTIMEBEFORE_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getCreationTimeAfter(), CREATIONTIMEAFTER_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getModifiedTimeBefore(), MODIFIEDTIMEBEFORE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getSortBy(), SORTBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(listStudioLifecycleConfigsRequest.getSortOrder(), SORTORDER_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | listStudioLifecycleConfigsRequest.getModifiedTimeAfter(), MODIFIEDTIMEAFTER_BINDING); |
712,212 | public static void vertical9(Kernel1D_S32 kernel, GrayU8 src, GrayI16 dst) {<NEW_LINE>final byte[] dataSrc = src.data;<NEW_LINE>final short[] dataDst = dst.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int k8 = kernel.data[7];<NEW_LINE>final int k9 = kernel.data[8];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int imgWidth = dst.getWidth();<NEW_LINE>final int imgHeight = dst.getHeight();<NEW_LINE>final int yEnd = imgHeight - radius;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(radius, yEnd, y -> {<NEW_LINE>for (int y = radius; y < yEnd; y++) {<NEW_LINE>int indexDst = dst.startIndex + y * dst.stride;<NEW_LINE>int i = src.startIndex + (<MASK><NEW_LINE>final int iEnd = i + imgWidth;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>int total = (dataSrc[indexSrc] & 0xFF) * k1;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k2;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k3;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k4;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k5;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k6;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k7;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k8;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k9;<NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | y - radius) * src.stride; |
1,512,252 | private void toSlime(CloudTenant tenant, Cursor root) {<NEW_LINE>// BillingInfo was never used and always just a static default value. To retire this<NEW_LINE>// field we continue to write the default value and stop reading it.<NEW_LINE>// TODO(ogronnesby, 2020-08-05): Remove when a version where we do not read the field has propagated.<NEW_LINE>var legacyBillingInfo <MASK><NEW_LINE>tenant.creator().ifPresent(creator -> root.setString(creatorField, creator.getName()));<NEW_LINE>developerKeysToSlime(tenant.developerKeys(), root.setArray(pemDeveloperKeysField));<NEW_LINE>toSlime(legacyBillingInfo, root.setObject(billingInfoField));<NEW_LINE>toSlime(tenant.info(), root);<NEW_LINE>toSlime(tenant.tenantSecretStores(), root);<NEW_LINE>tenant.archiveAccessRole().ifPresent(role -> root.setString(archiveAccessRoleField, role));<NEW_LINE>} | = new BillingInfo("customer", "Vespa"); |
1,362,372 | public void show(Callback prefsChanged) {<NEW_LINE>SwipeActions.Actions actions = SwipeActions.getPrefsWithDefaults(context, tag);<NEW_LINE>leftAction = actions.left;<NEW_LINE>rightAction = actions.right;<NEW_LINE>final AlertDialog.Builder builder = new AlertDialog.Builder(context);<NEW_LINE>keys = SwipeActions.swipeActions;<NEW_LINE>String forFragment = "";<NEW_LINE>switch(tag) {<NEW_LINE>case EpisodesFragment.TAG:<NEW_LINE>forFragment = context.getString(R.string.episodes_label);<NEW_LINE>break;<NEW_LINE>case FeedItemlistFragment.TAG:<NEW_LINE>forFragment = context.getString(R.string.feeds_label);<NEW_LINE>break;<NEW_LINE>case QueueFragment.TAG:<NEW_LINE>forFragment = context.getString(R.string.queue_label);<NEW_LINE>keys = Stream.of(keys).filter(a -> !a.getId().equals(SwipeAction.ADD_TO_QUEUE) && !a.getId().equals(SwipeAction.REMOVE_FROM_INBOX)).toList();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (!tag.equals(QueueFragment.TAG)) {<NEW_LINE>keys = Stream.of(keys).filter(a -> !a.getId().equals(SwipeAction.REMOVE_FROM_QUEUE)).toList();<NEW_LINE>}<NEW_LINE>builder.setTitle(context.getString(R.string.swipeactions_label) + " - " + forFragment);<NEW_LINE>SwipeactionsDialogBinding viewBinding = SwipeactionsDialogBinding.inflate(LayoutInflater.from(context));<NEW_LINE>builder.<MASK><NEW_LINE>viewBinding.enableSwitch.setOnCheckedChangeListener((compoundButton, b) -> {<NEW_LINE>viewBinding.actionLeftContainer.getRoot().setAlpha(b ? 1.0f : 0.4f);<NEW_LINE>viewBinding.actionRightContainer.getRoot().setAlpha(b ? 1.0f : 0.4f);<NEW_LINE>});<NEW_LINE>viewBinding.enableSwitch.setChecked(SwipeActions.isSwipeActionEnabled(context, tag));<NEW_LINE>setupSwipeDirectionView(viewBinding.actionLeftContainer, LEFT);<NEW_LINE>setupSwipeDirectionView(viewBinding.actionRightContainer, RIGHT);<NEW_LINE>builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {<NEW_LINE>savePrefs(tag, rightAction.getId(), leftAction.getId());<NEW_LINE>saveActionsEnabledPrefs(viewBinding.enableSwitch.isChecked());<NEW_LINE>prefsChanged.onCall();<NEW_LINE>});<NEW_LINE>builder.setNegativeButton(R.string.cancel_label, null);<NEW_LINE>builder.create().show();<NEW_LINE>} | setView(viewBinding.getRoot()); |
1,620,156 | public void undoCommand() {<NEW_LINE>if (getUndoCommand() == null) {<NEW_LINE>throw new IllegalStateException("Can't undo command");<NEW_LINE>}<NEW_LINE>List<CommandInfo> processedCommands = new ArrayList<>();<NEW_LINE>synchronized (commands) {<NEW_LINE>CommandInfo lastCommand = commands.get(<MASK><NEW_LINE>if (!lastCommand.command.isUndoable()) {<NEW_LINE>throw new IllegalStateException("Last executed command is not undoable");<NEW_LINE>}<NEW_LINE>// Undo command batch<NEW_LINE>while (lastCommand != null) {<NEW_LINE>commands.remove(lastCommand);<NEW_LINE>undidCommands.add(lastCommand);<NEW_LINE>processedCommands.add(lastCommand);<NEW_LINE>lastCommand = lastCommand.prevInBatch;<NEW_LINE>}<NEW_LINE>clearCommandQueues();<NEW_LINE>getCommandQueues();<NEW_LINE>}<NEW_LINE>refreshCommandState();<NEW_LINE>// Undo UI changes (always because undo doesn't make sense in atomic contexts)<NEW_LINE>for (CommandInfo cmd : processedCommands) {<NEW_LINE>if (cmd.reflector != null && !atomic) {<NEW_LINE>cmd.reflector.undoCommand(cmd.command);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | commands.size() - 1); |
284,254 | Optional<Candidate> fromCandidateRecord(final I_MD_Candidate candidateRecordOrNull) {<NEW_LINE>if (candidateRecordOrNull == null || isNew(candidateRecordOrNull) || candidateRecordOrNull.getMD_Candidate_ID() <= 0) {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>final CandidateBuilder builder = createAndInitializeBuilder(candidateRecordOrNull);<NEW_LINE>final CandidateBusinessCase businessCase = getBusinesCaseOrNull(candidateRecordOrNull);<NEW_LINE>builder.businessCase(businessCase);<NEW_LINE>final ProductionDetail productionDetailOrNull = createProductionDetailOrNull(candidateRecordOrNull);<NEW_LINE><MASK><NEW_LINE>final PurchaseDetail purchaseDetailOrNull = PurchaseDetailRepoHelper.getSingleForCandidateRecordOrNull(candidateRecordOrNull);<NEW_LINE>final StockChangeDetail stockChangeDetailOrNull = stockChangeDetailRepo.getSingleForCandidateRecordOrNull(candidateRecordOrNull);<NEW_LINE>final int hasProductionDetail = productionDetailOrNull == null ? 0 : 1;<NEW_LINE>final int hasDistributionDetail = distributionDetailOrNull == null ? 0 : 1;<NEW_LINE>final int hasPurchaseDetail = purchaseDetailOrNull == null ? 0 : 1;<NEW_LINE>final int hasStockChangeDetail = stockChangeDetailOrNull == null ? 0 : 1;<NEW_LINE>Check.errorIf(hasProductionDetail + hasDistributionDetail + hasPurchaseDetail + hasStockChangeDetail > 1, "A candidate may not have both a distribution, production, production detail and a hasStockChangeDetail; candidateRecord={}", candidateRecordOrNull);<NEW_LINE>final DemandDetail demandDetailOrNull = createDemandDetailOrNull(candidateRecordOrNull);<NEW_LINE>final BusinessCaseDetail businessCaseDetail = CoalesceUtil.coalesce(productionDetailOrNull, distributionDetailOrNull, purchaseDetailOrNull, demandDetailOrNull, stockChangeDetailOrNull);<NEW_LINE>builder.businessCaseDetail(businessCaseDetail);<NEW_LINE>if (hasProductionDetail > 0 || hasDistributionDetail > 0 || hasPurchaseDetail > 0) {<NEW_LINE>builder.additionalDemandDetail(demandDetailOrNull);<NEW_LINE>}<NEW_LINE>builder.transactionDetails(createTransactionDetails(candidateRecordOrNull));<NEW_LINE>final Dimension candidateDimension = dimensionService.getFromRecord(candidateRecordOrNull);<NEW_LINE>builder.dimension(candidateDimension);<NEW_LINE>return Optional.of(builder.build());<NEW_LINE>} | final DistributionDetail distributionDetailOrNull = createDistributionDetailOrNull(candidateRecordOrNull); |
719,656 | public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction) {<NEW_LINE>switch(simpleInstruction.opcode) {<NEW_LINE>case InstructionConstants.OP_AASTORE:<NEW_LINE>// Mark array parameters whose element is modified.<NEW_LINE>markModifiedParameters(method, offset, simpleInstruction.stackPopCount(clazz) - 1);<NEW_LINE>// Mark reference values that are put in the array.<NEW_LINE>markEscapingParameters(method, offset, 0);<NEW_LINE>break;<NEW_LINE>case InstructionConstants.OP_IASTORE:<NEW_LINE>case InstructionConstants.OP_LASTORE:<NEW_LINE>case InstructionConstants.OP_FASTORE:<NEW_LINE>case InstructionConstants.OP_DASTORE:<NEW_LINE>case InstructionConstants.OP_BASTORE:<NEW_LINE>case InstructionConstants.OP_CASTORE:<NEW_LINE>case InstructionConstants.OP_SASTORE:<NEW_LINE>// Mark array parameters whose element is modified.<NEW_LINE>markModifiedParameters(method, offset, simpleInstruction.stackPopCount(clazz) - 1);<NEW_LINE>break;<NEW_LINE>case InstructionConstants.OP_ARETURN:<NEW_LINE>// Mark returned reference values.<NEW_LINE>markReturnedParameters(<MASK><NEW_LINE>break;<NEW_LINE>case InstructionConstants.OP_ATHROW:<NEW_LINE>// Mark the escaping reference values.<NEW_LINE>markEscapingParameters(method, offset, 0);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | clazz, method, offset, 0); |
723,720 | public void write(AwtImage image, ImageMetadata metadata, OutputStream out) throws IOException {<NEW_LINE>javax.imageio.ImageWriter writer = ImageIO.getImageWritersByFormatName("jpeg").next();<NEW_LINE>ImageWriteParam params = writer.getDefaultWriteParam();<NEW_LINE>if (compression < 100) {<NEW_LINE>params.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);<NEW_LINE>params.setCompressionQuality(compression / 100f);<NEW_LINE>}<NEW_LINE>if (params.canWriteProgressive()) {<NEW_LINE>if (progressive) {<NEW_LINE>params.setProgressiveMode(ImageWriteParam.MODE_DEFAULT);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// in openjdk, awt cannot write out jpegs that have a transparency bit, even if that is set to 255.<NEW_LINE>// see http://stackoverflow.com/questions/464825/converting-transparent-gif-png-to-jpeg-using-java<NEW_LINE>// so have to convert to a non alpha type<NEW_LINE>BufferedImage noAlpha;<NEW_LINE>if (image.awt().getColorModel().hasAlpha()) {<NEW_LINE>noAlpha = image.toImmutableImage().removeTransparency(java.awt.Color.WHITE).toNewBufferedImage(BufferedImage.TYPE_INT_RGB);<NEW_LINE>} else {<NEW_LINE>noAlpha = image.awt();<NEW_LINE>}<NEW_LINE>MemoryCacheImageOutputStream output = new MemoryCacheImageOutputStream(out);<NEW_LINE>writer.setOutput(output);<NEW_LINE>writer.write(null, new IIOImage(noAlpha, null, null), params);<NEW_LINE>output.close();<NEW_LINE>writer.dispose();<NEW_LINE>// IOUtils.closeQuietly(out);<NEW_LINE>} | params.setProgressiveMode(ImageWriteParam.MODE_DISABLED); |
179,886 | public Object doQuery(Object[] objs) {<NEW_LINE>if (objs == null || objs.length < 2) {<NEW_LINE>throw new RQException("InfluxDB function.missingParam");<NEW_LINE>}<NEW_LINE>InfluxDBClient m_influxDB = null;<NEW_LINE>if (objs[0] instanceof InfluxDBClient) {<NEW_LINE>m_influxDB <MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>WriteApi writeApi = m_influxDB.makeWriteApi();<NEW_LINE>List<String> records = new ArrayList<String>();<NEW_LINE>if (objs[1] instanceof Sequence) {<NEW_LINE>Sequence seq = (Sequence) objs[1];<NEW_LINE>for (int i = 1; i <= seq.length(); i++) records.add(seq.get(i).toString());<NEW_LINE>} else {<NEW_LINE>records.add(objs[1].toString());<NEW_LINE>}<NEW_LINE>writeApi.writeRecords(WritePrecision.NS, records);<NEW_LINE>return "write success";<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return "write fail";<NEW_LINE>} | = (InfluxDBClient) objs[0]; |
172,073 | final UpdateContactAttributesResult executeUpdateContactAttributes(UpdateContactAttributesRequest updateContactAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateContactAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<UpdateContactAttributesRequest> request = null;<NEW_LINE>Response<UpdateContactAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateContactAttributesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateContactAttributesRequest));<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, "Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateContactAttributes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateContactAttributesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateContactAttributesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
555,428 | public BookmarksStatus check(List<Object> contents, boolean remediate) throws IOException {<NEW_LINE>// Before..<NEW_LINE>// write(XmlUtils.marshaltoString(documentPart.getJaxbElement(), true, true));<NEW_LINE>List<Object> faulty = inspectBookmarks(contents);<NEW_LINE>if (remediate) {<NEW_LINE>for (Object o : faulty) {<NEW_LINE>if (o instanceof CTBookmark) {<NEW_LINE>CTBookmark start = (CTBookmark) o;<NEW_LINE>Object parent = start.getParent();<NEW_LINE>if (parent instanceof ContentAccessor) {<NEW_LINE>// write("attempting to remove " + start.getClass().getName());<NEW_LINE>if (remove(((ContentAccessor) parent).getContent(), o)) {<NEW_LINE>// ok<NEW_LINE>} else {<NEW_LINE>// shouldn't happen<NEW_LINE>write("FIXME Couldn't find start " + start.getName() + start.getId().intValue());<NEW_LINE>log.warn("FIXME Couldn't find start " + start.getName() + start.getId().intValue());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.warn("TODO: handle parent:" + parent.getClass().getName());<NEW_LINE>write("TODO: handle parent:" + parent.getClass().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (o instanceof CTMarkupRange && /* ends */<NEW_LINE>(!(o instanceof CTBookmark))) {<NEW_LINE>CTMarkupRange end = (CTMarkupRange) o;<NEW_LINE><MASK><NEW_LINE>if (parent instanceof ContentAccessor) {<NEW_LINE>if (remove(((ContentAccessor) parent).getContent(), o)) {<NEW_LINE>} else {<NEW_LINE>// shouldn't happen<NEW_LINE>write("FIXME Couldn't find end " + end.getId().longValue());<NEW_LINE>log.warn("FIXME Couldn't find end " + end.getId().longValue());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.warn("TODO: handle parent:" + parent.getClass().getName());<NEW_LINE>write("TODO: handle parent:" + parent.getClass().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (faulty.size() == 0) {<NEW_LINE>log.debug("Nothing to fix");<NEW_LINE>write("Nothing to fix");<NEW_LINE>return BookmarksStatus.OK;<NEW_LINE>} else if (remediate) {<NEW_LINE>return BookmarksStatus.FIXED;<NEW_LINE>} else {<NEW_LINE>return BookmarksStatus.BROKEN;<NEW_LINE>}<NEW_LINE>} | Object parent = end.getParent(); |
518,434 | public final void quit() {<NEW_LINE>AgentInstanceContext agentInstanceContext = evalFollowedByNode.getContext().getAgentInstanceContext();<NEW_LINE>agentInstanceContext.getInstrumentationProvider().qPatternFollowedByQuit(evalFollowedByNode.factoryNode);<NEW_LINE>agentInstanceContext.getAuditProvider().patternInstance(false, evalFollowedByNode.factoryNode, agentInstanceContext);<NEW_LINE>for (Map.Entry<EvalStateNode, Integer> entry : nodes.entrySet()) {<NEW_LINE>entry<MASK><NEW_LINE>if (evalFollowedByNode.isTrackWithPool()) {<NEW_LINE>if (entry.getValue() > 0) {<NEW_LINE>PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();<NEW_LINE>poolSvc.getRuntimeSvc().decreaseCount(evalFollowedByNode, evalFollowedByNode.getContext().getAgentInstanceContext());<NEW_LINE>poolSvc.getStmtHandler().decreaseCount();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>agentInstanceContext.getInstrumentationProvider().aPatternFollowedByQuit();<NEW_LINE>} | .getKey().quit(); |
63,260 | private void processHeaderData(ZipModel zipModel, OutputStream outputStream) throws IOException {<NEW_LINE>int currentSplitFileCounter = 0;<NEW_LINE>if (outputStream instanceof OutputStreamWithSplitZipSupport) {<NEW_LINE>zipModel.getEndOfCentralDirectoryRecord().setOffsetOfStartOfCentralDirectory(((OutputStreamWithSplitZipSupport) outputStream).getFilePointer());<NEW_LINE>currentSplitFileCounter = ((OutputStreamWithSplitZipSupport) outputStream).getCurrentSplitFileCounter();<NEW_LINE>}<NEW_LINE>if (zipModel.isZip64Format()) {<NEW_LINE>if (zipModel.getZip64EndOfCentralDirectoryRecord() == null) {<NEW_LINE>zipModel.setZip64EndOfCentralDirectoryRecord(new Zip64EndOfCentralDirectoryRecord());<NEW_LINE>}<NEW_LINE>if (zipModel.getZip64EndOfCentralDirectoryLocator() == null) {<NEW_LINE>zipModel.setZip64EndOfCentralDirectoryLocator(new Zip64EndOfCentralDirectoryLocator());<NEW_LINE>}<NEW_LINE>zipModel.getZip64EndOfCentralDirectoryRecord().setOffsetStartCentralDirectoryWRTStartDiskNumber(zipModel.<MASK><NEW_LINE>zipModel.getZip64EndOfCentralDirectoryLocator().setNumberOfDiskStartOfZip64EndOfCentralDirectoryRecord(currentSplitFileCounter);<NEW_LINE>zipModel.getZip64EndOfCentralDirectoryLocator().setTotalNumberOfDiscs(currentSplitFileCounter + 1);<NEW_LINE>}<NEW_LINE>zipModel.getEndOfCentralDirectoryRecord().setNumberOfThisDisk(currentSplitFileCounter);<NEW_LINE>zipModel.getEndOfCentralDirectoryRecord().setNumberOfThisDiskStartOfCentralDir(currentSplitFileCounter);<NEW_LINE>} | getEndOfCentralDirectoryRecord().getOffsetOfStartOfCentralDirectory()); |
969,790 | public Schema resolve(Type type) {<NEW_LINE>if (processedTypes.contains(type)) {<NEW_LINE>return modelByType.get(type);<NEW_LINE>} else {<NEW_LINE>processedTypes.add(type);<NEW_LINE>}<NEW_LINE>// if (LOGGER.isDebugEnabled()) {<NEW_LINE>// LOGGER.debug(String.format("resolve %s", type));<NEW_LINE>// }<NEW_LINE>Iterator<ModelConverter> converters = this.getConverters();<NEW_LINE>Schema resolved = null;<NEW_LINE>if (converters.hasNext()) {<NEW_LINE>ModelConverter converter = converters.next();<NEW_LINE>// LOGGER.debug("trying extension " + converter);<NEW_LINE>resolved = converter.<MASK><NEW_LINE>}<NEW_LINE>if (resolved != null) {<NEW_LINE>modelByType.put(type, resolved);<NEW_LINE>SchemaImpl resolvedImpl = (SchemaImpl) resolved;<NEW_LINE>if (resolvedImpl.getName() != null) {<NEW_LINE>modelByName.put(resolvedImpl.getName(), resolved);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resolved;<NEW_LINE>} | resolve(type, this, converters); |
1,348,885 | private I_PP_Cost_Collector createCollector(@NonNull final CostCollectorCreateRequest request) {<NEW_LINE>trxManager.assertThreadInheritedTrxExists();<NEW_LINE>final I_PP_Order ppOrder = request.getOrder();<NEW_LINE>final DocTypeId docTypeId = docTypeDAO.getDocTypeId(DocTypeQuery.builder().docBaseType(X_C_DocType.DOCBASETYPE_ManufacturingCostCollector).adClientId(ppOrder.getAD_Client_ID()).adOrgId(ppOrder.getAD_Org_ID()).build());<NEW_LINE>final I_PP_Cost_Collector cc = InterfaceWrapperHelper.newInstance(I_PP_Cost_Collector.class);<NEW_LINE>cc.setDocAction(X_PP_Cost_Collector.DOCACTION_Complete);<NEW_LINE>cc.setDocStatus(X_PP_Cost_Collector.DOCSTATUS_Drafted);<NEW_LINE>cc.setPosted(false);<NEW_LINE>cc.setProcessed(false);<NEW_LINE>cc.setProcessing(false);<NEW_LINE>cc.setIsActive(true);<NEW_LINE>updateCostCollectorFromOrder(cc, ppOrder);<NEW_LINE>cc.setC_DocType_ID(docTypeId.getRepoId());<NEW_LINE>cc.setC_DocTypeTarget_ID(docTypeId.getRepoId());<NEW_LINE>cc.setCostCollectorType(request.getCostCollectorType().getCode());<NEW_LINE>cc.setM_Locator_ID(LocatorId.toRepoId(request.getLocatorId()));<NEW_LINE>cc.setM_AttributeSetInstance_ID(request.getAttributeSetInstanceId().getRepoId());<NEW_LINE>cc.setS_Resource_ID(ResourceId.toRepoId(request.getResourceId()));<NEW_LINE>cc.setMovementDate(TimeUtil.asTimestamp(request.getMovementDate()));<NEW_LINE>cc.setDateAcct(TimeUtil.asTimestamp(request.getMovementDate()));<NEW_LINE>cc.setM_Product_ID(ProductId.toRepoId(request.getProductId()));<NEW_LINE>setQuantities(cc, PPCostCollectorQuantities.builder().movementQty(request.getQty()).scrappedQty(request.getQtyScrap()).rejectedQty(request.getQtyReject()).build());<NEW_LINE>final PPOrderRoutingActivity orderActivity = request.getOrderActivity();<NEW_LINE>if (orderActivity != null) {<NEW_LINE>cc.setPP_Order_Node_ID(orderActivity.getId().getRepoId());<NEW_LINE>cc.setIsSubcontracting(orderActivity.isSubcontracting());<NEW_LINE>final WFDurationUnit durationUnit = orderActivity.getDurationUnit();<NEW_LINE>cc.setDurationUnit(durationUnit.getCode());<NEW_LINE>cc.setSetupTimeReal(durationUnit.toBigDecimal(request.getDurationSetup()));<NEW_LINE>cc.setDurationReal(durationUnit.toBigDecimal<MASK><NEW_LINE>}<NEW_LINE>// If this is an material issue, we should use BOM Line's UOM<NEW_LINE>if (request.getPpOrderBOMLineId() != null) {<NEW_LINE>cc.setPP_Order_BOMLine_ID(request.getPpOrderBOMLineId().getRepoId());<NEW_LINE>}<NEW_LINE>if (request.getPickingCandidateId() > 0) {<NEW_LINE>cc.setM_Picking_Candidate_ID(request.getPickingCandidateId());<NEW_LINE>}<NEW_LINE>costCollectorDAO.save(cc);<NEW_LINE>//<NEW_LINE>// Process the Cost Collector<NEW_LINE>// expectedDocStatus<NEW_LINE>documentBL.// expectedDocStatus<NEW_LINE>processEx(// expectedDocStatus<NEW_LINE>cc, // expectedDocStatus<NEW_LINE>X_PP_Cost_Collector.DOCACTION_Complete, null);<NEW_LINE>return cc;<NEW_LINE>} | (request.getDuration())); |
822,381 | private boolean validateImage(BufferedImage pic) {<NEW_LINE>int height = pic.getHeight();<NEW_LINE>int width = pic.getWidth();<NEW_LINE>boolean bottomEdgeFound = false;<NEW_LINE>for (int x = 0; x < width; ++x) {<NEW_LINE>for (int y = 0; y < height; ++y) {<NEW_LINE>// Clear alpha, we don't care about it<NEW_LINE>int pixel = pic.getRGB(x, y) & 0x00FFFFFF;<NEW_LINE>// Convert to black & white<NEW_LINE>int red = (pixel & 0x00FF0000) >> 16;<NEW_LINE>int green = (pixel & 0x0000FF00) >> 8;<NEW_LINE><MASK><NEW_LINE>pixel = (int) (0.299 * red + 0.587 * green + 0.114 * blue);<NEW_LINE>if (pixel > 200)<NEW_LINE>// White<NEW_LINE>pixel = 0xFFFFFF;<NEW_LINE>else<NEW_LINE>// Black<NEW_LINE>pixel = 0;<NEW_LINE>pic.setRGB(x, y, pixel);<NEW_LINE>if (y == height - 1) {<NEW_LINE>if (pixel == 0) {<NEW_LINE>bottomEdgeFound = true;<NEW_LINE>if (startX == -1)<NEW_LINE>startX = x;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return bottomEdgeFound;<NEW_LINE>} | int blue = (pixel & 0x000000FF); |
426,806 | public IdentityDocument unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>IdentityDocument identityDocument = new IdentityDocument();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("DocumentIndex", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>identityDocument.setDocumentIndex(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("IdentityDocumentFields", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>identityDocument.setIdentityDocumentFields(new ListUnmarshaller<IdentityDocumentField>(IdentityDocumentFieldJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return identityDocument;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
520,027 | public static TreeNode commonAncestorBad(TreeNode root, TreeNode p, TreeNode q) {<NEW_LINE>if (root == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (root == p && root == q) {<NEW_LINE>return root;<NEW_LINE>}<NEW_LINE>TreeNode x = commonAncestorBad(root.left, p, q);<NEW_LINE>if (x != null && x != p && x != q) {<NEW_LINE>// Found common ancestor<NEW_LINE>return x;<NEW_LINE>}<NEW_LINE>TreeNode y = commonAncestorBad(root.right, p, q);<NEW_LINE>if (y != null && y != p && y != q) {<NEW_LINE>return y;<NEW_LINE>}<NEW_LINE>if (x != null && y != null) {<NEW_LINE>// This is the common ancestor<NEW_LINE>return root;<NEW_LINE>} else if (root == p || root == q) {<NEW_LINE>return root;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | return x == null ? y : x; |
1,385,910 | private String listTemplates() {<NEW_LINE>Collection<RuleTemplate> collection = autoCommands.getTemplates(locale);<NEW_LINE>Map<String, Template> templates = new Hashtable<>();<NEW_LINE>Map<String, String> listTemplates = null;<NEW_LINE>if (collection != null && !collection.isEmpty()) {<NEW_LINE>addCollection(collection, templates);<NEW_LINE>String[] uids = new String[templates.size()];<NEW_LINE>Utils.quickSort(templates.keySet().toArray(uids), 0, templates.size());<NEW_LINE>listTemplates = Utils.putInHastable(uids);<NEW_LINE>}<NEW_LINE>if (listTemplates != null && !listTemplates.isEmpty()) {<NEW_LINE>if (id != null) {<NEW_LINE>collection = getTemplateByFilter(listTemplates);<NEW_LINE>if (collection.size() == 1) {<NEW_LINE>Template t = (Template) collection.toArray()[0];<NEW_LINE>if (t != null) {<NEW_LINE>return Printer.printTemplate(t);<NEW_LINE>} else {<NEW_LINE>return String.format("Nonexistent ID: %s", id);<NEW_LINE>}<NEW_LINE>} else if (collection.isEmpty()) {<NEW_LINE>return String.format("Nonexistent ID: %s", id);<NEW_LINE>} else {<NEW_LINE>if (!templates.isEmpty()) {<NEW_LINE>templates.clear();<NEW_LINE>}<NEW_LINE>addCollection(collection, templates);<NEW_LINE>listTemplates = <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (listTemplates != null && !listTemplates.isEmpty()) {<NEW_LINE>return Printer.printTemplates(listTemplates);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return "There are no Templates available!";<NEW_LINE>} | Utils.filterList(templates, listTemplates); |
948,161 | private Manifest createManifest() {<NEW_LINE>// Getting the jarFileName of the root module of this executable<NEW_LINE>PlatformLibrary rootModuleJarFile = codeGeneratedLibrary(packageContext.packageId(), packageContext.defaultModuleContext().moduleName());<NEW_LINE>String mainClassName;<NEW_LINE>try (JarInputStream jarStream = new JarInputStream(Files.newInputStream(rootModuleJarFile.path()))) {<NEW_LINE><MASK><NEW_LINE>mainClassName = (String) mf.getMainAttributes().get(Attributes.Name.MAIN_CLASS);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("Generated jar file cannot be found for the module: " + packageContext.defaultModuleContext().moduleName());<NEW_LINE>}<NEW_LINE>Manifest manifest = new Manifest();<NEW_LINE>Attributes mainAttributes = manifest.getMainAttributes();<NEW_LINE>mainAttributes.put(Attributes.Name.MANIFEST_VERSION, "1.0");<NEW_LINE>mainAttributes.put(Attributes.Name.MAIN_CLASS, mainClassName);<NEW_LINE>return manifest;<NEW_LINE>} | Manifest mf = jarStream.getManifest(); |
468,422 | /*<NEW_LINE>void runInEDT(JPopupMenu menu) {<NEW_LINE>for (int i = 0; i < instructions.length; i++) {<NEW_LINE>switch (instructions[i]) {<NEW_LINE>case ACTIONS_TOPCOMPONENT:<NEW_LINE>addTopComponentActions(menu, (Action[])initedObjects.get(i));<NEW_LINE>break;<NEW_LINE>case ACTION_CREATEITEM:<NEW_LINE>addActionInstance(menu, (Action<MASK><NEW_LINE>break;<NEW_LINE>case ACTION_EXTKIT_BYNAME:<NEW_LINE>addExtKitAction(menu, (String)initedObjects.get(i));<NEW_LINE>break;<NEW_LINE>case ACTION_SYSTEM:<NEW_LINE>addSystemAction(menu, (Action)initedObjects.get(i));<NEW_LINE>break;<NEW_LINE>case ACTION_FOLDER:<NEW_LINE>addFolder(menu, (SubFolderData)initedObjects.get(i));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>private void addFolder(JPopupMenu pm, SubFolderData data) {<NEW_LINE>pm.add(<NEW_LINE>new LayerSubFolderMenu(<NEW_LINE>component, data.localizedName, data.objects, data.instructions<NEW_LINE>)<NEW_LINE>);<NEW_LINE>}<NEW_LINE><NEW_LINE>private void addTopComponentActions(JPopupMenu popupMenu, Action[] actions) {<NEW_LINE>Component[] comps = org.openide.util.Utilities.actionsToPopup(actions, contextLookup).getComponents();<NEW_LINE>for (int i = 0; i < comps.length; i++) {<NEW_LINE>popupMenu.add(comps[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>private void addExtKitAction(JPopupMenu popupMenu, String actionName) {<NEW_LINE>NbBuildPopupMenuAction.super.addAction(component, popupMenu, actionName);<NEW_LINE>}<NEW_LINE><NEW_LINE>private void addSystemAction(JPopupMenu popupMenu, Action action) {<NEW_LINE>JMenuItem item = (action != null) ? createLocalizedMenuItem(action) : null;<NEW_LINE>if (item != null) {<NEW_LINE>if (item instanceof DynamicMenuContent) {<NEW_LINE>Component[] cmps = ((DynamicMenuContent)item).getMenuPresenters();<NEW_LINE>for (int i = 0; i < cmps.length; i++) {<NEW_LINE>if(cmps[i] != null) {<NEW_LINE>popupMenu.add(cmps[i]);<NEW_LINE>} else {<NEW_LINE>popupMenu.addSeparator();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!(item instanceof JMenu)) {<NEW_LINE>if (Boolean.TRUE.equals(action.getValue(DynamicMenuContent.HIDE_WHEN_DISABLED)) && !action.isEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>assignAccelerator(<NEW_LINE>(Keymap)Lookup.getDefault().lookup(Keymap.class),<NEW_LINE>action,<NEW_LINE>item<NEW_LINE>);<NEW_LINE>}<NEW_LINE>debugPopupMenuItem(item, action);<NEW_LINE>popupMenu.add(item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>private void addActionInstance(JPopupMenu popupMenu, Action action) {<NEW_LINE>JMenuItem item = createLocalizedMenuItem(action);<NEW_LINE>if (item instanceof DynamicMenuContent) {<NEW_LINE>Component[] cmps = ((DynamicMenuContent)item).getMenuPresenters();<NEW_LINE>for (int i = 0; i < cmps.length; i++) {<NEW_LINE>if(cmps[i] != null) {<NEW_LINE>popupMenu.add(cmps[i]);<NEW_LINE>} else {<NEW_LINE>popupMenu.addSeparator();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (Boolean.TRUE.equals(action.getValue(DynamicMenuContent.HIDE_WHEN_DISABLED)) && !action.isEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>item.setEnabled(action.isEnabled());<NEW_LINE>Object helpID = action.getValue ("helpID"); // NOI18N<NEW_LINE>if (helpID != null && (helpID instanceof String)) {<NEW_LINE>item.putClientProperty ("HelpID", helpID); // NOI18N<NEW_LINE>}<NEW_LINE>assignAccelerator(component.getKeymap(), action, item);<NEW_LINE>debugPopupMenuItem(item, action);<NEW_LINE>popupMenu.add(item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>*/<NEW_LINE>private void addInitedObject(Object inited, int instr) {<NEW_LINE>initedObjects.add(inited);<NEW_LINE>instructions[index++] = instr;<NEW_LINE>} | )initedObjects.get(i)); |
1,232,761 | protected Map<String, FieldReader> assignReaders(boolean useIndexOnSingleReturn) {<NEW_LINE>Map<String, FieldReader> readers = new HashMap<>();<NEW_LINE>JRField[] fields = queryExecuter<MASK><NEW_LINE>Type[] returnTypes = queryExecuter.getReturnTypes();<NEW_LINE>String[] aliases = queryExecuter.getReturnAliases();<NEW_LINE>Map<String, Integer> aliasesMap = new HashMap<>();<NEW_LINE>if (aliases != null) {<NEW_LINE>for (int i = 0; i < aliases.length; i++) {<NEW_LINE>aliasesMap.put(aliases[i], i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (returnTypes.length == 1) {<NEW_LINE>if (returnTypes[0].isEntityType() || returnTypes[0].isComponentType()) {<NEW_LINE>for (int i = 0; i < fields.length; i++) {<NEW_LINE>JRField field = fields[i];<NEW_LINE>readers.put(field.getName(), getFieldReaderSingleReturn(aliasesMap, field, useIndexOnSingleReturn));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (fields.length > 1) {<NEW_LINE>throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_MANY_FIELDS_DETECTED, (Object[]) null);<NEW_LINE>}<NEW_LINE>if (fields.length == 1) {<NEW_LINE>JRField field = fields[0];<NEW_LINE>if (useIndexOnSingleReturn) {<NEW_LINE>readers.put(field.getName(), new IndexFieldReader(0));<NEW_LINE>} else {<NEW_LINE>readers.put(field.getName(), new IdentityFieldReader());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < fields.length; i++) {<NEW_LINE>JRField field = fields[i];<NEW_LINE>readers.put(field.getName(), getFieldReader(returnTypes, aliasesMap, field));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return readers;<NEW_LINE>} | .getDataset().getFields(); |
1,546,534 | public Map<String, List<ArgDescriptorProposal>> doReflectionsExtraction() {<NEW_LINE>Map<String, List<ArgDescriptorProposal>> ret = new HashMap<>();<NEW_LINE>Reflections reflections = new Reflections("org.nd4j");<NEW_LINE>Set<Class<? extends DifferentialFunction>> subTypesOf = reflections.getSubTypesOf(DifferentialFunction.class);<NEW_LINE>Set<Class<? extends CustomOp>> subTypesOfOp = <MASK><NEW_LINE>Set<Class<?>> allClasses = new HashSet<>();<NEW_LINE>allClasses.addAll(subTypesOf);<NEW_LINE>allClasses.addAll(subTypesOfOp);<NEW_LINE>Set<String> opNamesForDifferentialFunction = new HashSet<>();<NEW_LINE>for (Class<?> clazz : allClasses) {<NEW_LINE>if (Modifier.isAbstract(clazz.getModifiers()) || clazz.isInterface()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>processClazz(ret, opNamesForDifferentialFunction, clazz);<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | reflections.getSubTypesOf(CustomOp.class); |
1,248,046 | private void editDialog(Mount mount) {<NEW_LINE>View view = LayoutInflater.from(this).inflate(R.layout.properties_mounts, null);<NEW_LINE>EditText inputSrc = view.findViewById(R.id.editTextSrc);<NEW_LINE>EditText inputTarget = view.findViewById(R.id.editTextTarget);<NEW_LINE>inputSrc.setText(mount.getSource());<NEW_LINE>inputSrc.setSelection(mount.getSource().length());<NEW_LINE>inputTarget.setText(mount.getTarget());<NEW_LINE>inputTarget.setSelection(mount.getTarget().length());<NEW_LINE>new AlertDialog.Builder(this).setTitle(R.string.edit_mount_title).setView(view).setPositiveButton(android.R.string.ok, (dialog, whichButton) -> {<NEW_LINE>String src = inputSrc.getText().toString(<MASK><NEW_LINE>String target = inputTarget.getText().toString().replaceAll("[ :]", "_");<NEW_LINE>if (!src.isEmpty()) {<NEW_LINE>mount.setSource(src);<NEW_LINE>mount.setTarget(target);<NEW_LINE>adapter.notifyDataSetChanged();<NEW_LINE>}<NEW_LINE>}).setNegativeButton(android.R.string.cancel, (dialog, whichButton) -> dialog.cancel()).show();<NEW_LINE>} | ).replaceAll("[ :]", "_"); |
1,781,059 | void visitTree(PageCursor cursor, PageCursor writeCursor, GBPTreeVisitor<KEY, VALUE> visitor, CursorContext cursorContext) throws IOException {<NEW_LINE>// TreeState<NEW_LINE>long currentPage = cursor.getCurrentPageId();<NEW_LINE>Pair<TreeState, TreeState> statePair = TreeStatePair.readStatePages(cursor, IdSpace.STATE_PAGE_A, IdSpace.STATE_PAGE_B);<NEW_LINE>visitor.treeState(statePair);<NEW_LINE>TreeNode.goTo(cursor, "back to tree node from reading state", currentPage);<NEW_LINE>assertOnTreeNode(select(cursor, writeCursor));<NEW_LINE>// Traverse the tree<NEW_LINE>int level = 0;<NEW_LINE>do {<NEW_LINE>// One level at the time<NEW_LINE>visitor.beginLevel(level);<NEW_LINE>long leftmostSibling = cursor.getCurrentPageId();<NEW_LINE>// Go right through all siblings<NEW_LINE>visitLevel(cursor, writeCursor, visitor, cursorContext);<NEW_LINE>visitor.endLevel(level);<NEW_LINE>level++;<NEW_LINE>// Then go back to the left-most node on this level<NEW_LINE>TreeNode.<MASK><NEW_LINE>} while (// And continue down to next level if this level was an internal level<NEW_LINE>goToLeftmostChild(cursor, writeCursor));<NEW_LINE>} | goTo(cursor, "back", leftmostSibling); |
120,471 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see com.vaadin.addon.sqlcontainer.query.generator.SQLGenerator#<NEW_LINE>* generateSelectQuery(java.lang.String, java.util.List, java.util.List,<NEW_LINE>* int, int, java.lang.String)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public StatementHelper generateSelectQuery(String tableName, List<Filter> filters, List<OrderBy> orderBys, int offset, int pagelength, String toSelect) {<NEW_LINE>if (tableName == null || tableName.trim().equals("")) {<NEW_LINE>throw new IllegalArgumentException("Table name must be given.");<NEW_LINE>}<NEW_LINE>toSelect = toSelect == null ? "*" : toSelect;<NEW_LINE>StatementHelper sh = getStatementHelper();<NEW_LINE>StringBuffer query = new StringBuffer();<NEW_LINE>query.append("SELECT " + toSelect + " FROM ").append(SQLUtil.escapeSQL(tableName));<NEW_LINE>if (filters != null) {<NEW_LINE>query.append(QueryBuilder<MASK><NEW_LINE>}<NEW_LINE>if (orderBys != null) {<NEW_LINE>for (OrderBy o : orderBys) {<NEW_LINE>generateOrderBy(query, o, orderBys.indexOf(o) == 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (pagelength != 0) {<NEW_LINE>generateLimits(query, offset, pagelength);<NEW_LINE>}<NEW_LINE>sh.setQueryString(query.toString());<NEW_LINE>return sh;<NEW_LINE>} | .getWhereStringForFilters(filters, sh)); |
284,942 | public static void inverse(GrayF32 inputR, GrayF32 inputI, GrayF32 outputR) {<NEW_LINE>GrayF32 tempR = new GrayF32(inputR.width, inputR.height);<NEW_LINE>GrayF32 tempI = new GrayF32(inputI.width, inputI.height);<NEW_LINE>for (int y = 0; y < inputR.height; y++) {<NEW_LINE>int index = inputR.startIndex + inputR.stride * y;<NEW_LINE>transform(false, inputR.data, inputI.data, tempR.data, tempI.data, index, inputR.width);<NEW_LINE>}<NEW_LINE>float[] columnR0 <MASK><NEW_LINE>float[] columnI0 = new float[inputR.height];<NEW_LINE>float[] columnR1 = new float[inputR.height];<NEW_LINE>for (int x = 0; x < inputR.width; x++) {<NEW_LINE>// copy the column<NEW_LINE>for (int y = 0; y < inputR.height; y++) {<NEW_LINE>columnR0[y] = tempR.unsafe_get(x, y);<NEW_LINE>columnI0[y] = tempI.unsafe_get(x, y);<NEW_LINE>}<NEW_LINE>inverse(columnR0, columnI0, columnR1, 0, inputR.height);<NEW_LINE>// copy the results back<NEW_LINE>for (int y = 0; y < inputR.height; y++) {<NEW_LINE>outputR.unsafe_set(x, y, columnR1[y]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new float[inputR.height]; |
805,724 | final DeleteTrialResult executeDeleteTrial(DeleteTrialRequest deleteTrialRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteTrialRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteTrialRequest> request = null;<NEW_LINE>Response<DeleteTrialResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteTrialRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTrialRequest));<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, "SageMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTrial");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteTrialResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTrialResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
1,448,767 | private void generateFields(StringBuilder bd, boolean wasSecurityException, List<ExecutionResult> results) {<NEW_LINE>if (Properties.RESET_STANDARD_STREAMS) {<NEW_LINE>bd.append(METHOD_SPACE);<NEW_LINE>bd.append("private PrintStream systemOut = null;" + '\n');<NEW_LINE>bd.append(METHOD_SPACE);<NEW_LINE>bd.append("private PrintStream systemErr = null;" + '\n');<NEW_LINE>bd.append(METHOD_SPACE);<NEW_LINE>bd.append("private PrintStream logStream = null;" + '\n');<NEW_LINE>}<NEW_LINE>if (wasSecurityException) {<NEW_LINE>bd.append(METHOD_SPACE);<NEW_LINE>bd.append("protected static ExecutorService " + EXECUTOR_SERVICE + "; \n");<NEW_LINE>bd.append("\n");<NEW_LINE>}<NEW_LINE>if (TestSuiteWriterUtils.shouldResetProperties(results)) {<NEW_LINE>bd.append(METHOD_SPACE);<NEW_LINE>bd.append("private static final java.util.Properties " + DEFAULT_PROPERTIES);<NEW_LINE>bd.append(" = (java.util.Properties) java.lang.System.getProperties().clone(); \n");<NEW_LINE>bd.append("\n");<NEW_LINE>}<NEW_LINE>bd.append(METHOD_SPACE);<NEW_LINE>bd.append("private ").append(ThreadStopper.class.getName()).append(" ").append(THREAD_STOPPER).append(" = ");<NEW_LINE>bd.append(" new ").append(ThreadStopper.class.getName<MASK><NEW_LINE>bd.append(KillSwitchHandler.class.getName()).append(".getInstance(), ");<NEW_LINE>bd.append(Properties.TIMEOUT);<NEW_LINE>// this shouldn't appear among the threads in the generated tests<NEW_LINE>// threadsToIgnore.add(TestCaseExecutor.TEST_EXECUTION_THREAD);<NEW_LINE>Set<String> threadsToIgnore = new LinkedHashSet<>(Arrays.asList(Properties.IGNORE_THREADS));<NEW_LINE>for (String s : threadsToIgnore) {<NEW_LINE>bd.append(", ").append(s);<NEW_LINE>}<NEW_LINE>bd.append(");\n\n");<NEW_LINE>} | ()).append(" ("); |
1,410,930 | private void fixLibraryLocation(EarProjectOperations original) throws IllegalArgumentException {<NEW_LINE>String libPath = original.libraryPath;<NEW_LINE>if (libPath != null) {<NEW_LINE>if (!new File(libPath).isAbsolute()) {<NEW_LINE>// relative path to libraries<NEW_LINE>if (!original.libraryWithinProject) {<NEW_LINE>File file = original.libraryFile;<NEW_LINE>if (file == null) {<NEW_LINE>// could happen in some rare cases, but in that case the original project was already broken, don't fix.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String relativized = PropertyUtils.relativizeFile(FileUtil.toFile(project.getProjectDirectory()), file);<NEW_LINE>if (relativized != null) {<NEW_LINE>project.getAntProjectHelper().setLibrariesLocation(relativized);<NEW_LINE>} else {<NEW_LINE>// cannot relativize, use absolute path<NEW_LINE>project.getAntProjectHelper().setLibrariesLocation(file.getAbsolutePath());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// got copied over to new location.. the relative path is the same..<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// absolute path to libraries..<NEW_LINE>if (original.libraryWithinProject) {<NEW_LINE>if (original.absolutesRelPath != null) {<NEW_LINE>project.getAntProjectHelper().setLibrariesLocation(PropertyUtils.resolveFile(FileUtil.toFile(project.getProjectDirectory()), original<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// absolute path to an external folder stays the same.<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .absolutesRelPath).getAbsolutePath()); |
539,199 | // submit the map/reduce job.<NEW_LINE>public int run(final String[] args) throws Exception {<NEW_LINE>if (args.length != 4) {<NEW_LINE>return printUsage();<NEW_LINE>}<NEW_LINE>int i;<NEW_LINE>input_path = <MASK><NEW_LINE>output_path = new Path(args[1]);<NEW_LINE>nreducers = Integer.parseInt(args[2]);<NEW_LINE>double additional_multiplier = Double.parseDouble(args[3]);<NEW_LINE>System.out.println("\n-----===[PEGASUS: A Peta-Scale Graph Mining System]===-----\n");<NEW_LINE>System.out.println("[PEGASUS] Normalizing a vector. input_path=" + args[0] + ", output_path=" + args[1] + "\n");<NEW_LINE>final FileSystem fs = FileSystem.get(getConf());<NEW_LINE>FileSystem lfs = FileSystem.getLocal(getConf());<NEW_LINE>// compute l1 norm<NEW_LINE>String[] new_args = new String[1];<NEW_LINE>new_args[0] = args[0];<NEW_LINE>ToolRunner.run(getConf(), new L1norm(), new_args);<NEW_LINE>double scalar = PegasusUtils.read_l1norm_result(getConf());<NEW_LINE>lfs.delete(new Path("l1norm"), true);<NEW_LINE>System.out.println("L1norm = " + scalar);<NEW_LINE>// multiply by scalar<NEW_LINE>new_args = new String[2];<NEW_LINE>new_args[0] = args[0];<NEW_LINE>new_args[1] = new String("" + additional_multiplier / scalar);<NEW_LINE>ToolRunner.run(getConf(), new ScalarMult(), new_args);<NEW_LINE>fs.delete(output_path, true);<NEW_LINE>fs.rename(new Path("smult_output"), output_path);<NEW_LINE>System.out.println("\n[PEGASUS] Normalization completed. The normalized vecotr is saved in HDFS " + args[1] + ".\n");<NEW_LINE>return 0;<NEW_LINE>} | new Path(args[0]); |
615,966 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>Bundle args = getArguments();<NEW_LINE>if (args != null) {<NEW_LINE>poiCount = args.getInt(POI_COUNT_KEY);<NEW_LINE>osmNotesCount = args.getInt(NOTES_COUNT_KEY);<NEW_LINE>}<NEW_LINE>items.add(new TitleItem(getString(R.string.shared_string_export)));<NEW_LINE>items.add(new ShortDescriptionItem(getString(<MASK><NEW_LINE>BaseBottomSheetItem poiItem = new BottomSheetItemWithDescription.Builder().setDescription(String.valueOf(poiCount)).setIcon(getContentIcon(R.drawable.ic_action_info_dark)).setTitle(getString(R.string.poi)).setLayoutId(R.layout.bottom_sheet_item_with_right_descr).setDisabled(!(poiCount > 0)).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI);<NEW_LINE>}<NEW_LINE>dismiss();<NEW_LINE>}<NEW_LINE>}).create();<NEW_LINE>items.add(poiItem);<NEW_LINE>BaseBottomSheetItem osmNotesItem = new BottomSheetItemWithDescription.Builder().setDescription(String.valueOf(osmNotesCount)).setIcon(getContentIcon(R.drawable.ic_action_osm_note)).setTitle(getString(R.string.osm_notes)).setLayoutId(R.layout.bottom_sheet_item_with_right_descr).setDisabled(!(osmNotesCount > 0)).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES);<NEW_LINE>}<NEW_LINE>dismiss();<NEW_LINE>}<NEW_LINE>}).create();<NEW_LINE>items.add(osmNotesItem);<NEW_LINE>BaseBottomSheetItem allDataItem = new BottomSheetItemWithDescription.Builder().setDescription(String.valueOf(poiCount + osmNotesCount)).setIcon(getContentIcon(R.drawable.ic_action_folder)).setTitle(getString(R.string.all_data)).setLayoutId(R.layout.bottom_sheet_item_with_right_descr).setDisabled(!(poiCount + osmNotesCount > 0)).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL);<NEW_LINE>}<NEW_LINE>dismiss();<NEW_LINE>}<NEW_LINE>}).create();<NEW_LINE>items.add(allDataItem);<NEW_LINE>} | R.string.osm_edits_export_desc))); |
75,010 | public static boolean executeAntTask(String buildXmlFileFullPath, String target, Properties properties) {<NEW_LINE>boolean success = false;<NEW_LINE>DefaultLogger consoleLogger = getConsoleLogger();<NEW_LINE>// Prepare Ant project<NEW_LINE>Project project = new Project();<NEW_LINE>File buildFile = new File(buildXmlFileFullPath);<NEW_LINE>project.setBasedir(buildFile.getParentFile().getAbsolutePath());<NEW_LINE>project.setBaseDir(buildFile.getParentFile());<NEW_LINE>project.setUserProperty("ant.file", buildFile.getAbsolutePath());<NEW_LINE>if (properties != null) {<NEW_LINE>for (String k : properties.stringPropertyNames()) {<NEW_LINE>project.setProperty(k<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>project.addBuildListener(consoleLogger);<NEW_LINE>// Capture event for Ant script build start / stop / failure<NEW_LINE>try {<NEW_LINE>project.fireBuildStarted();<NEW_LINE>project.init();<NEW_LINE>ProjectHelper projectHelper = ProjectHelper.getProjectHelper();<NEW_LINE>project.addReference("ant.projectHelper", projectHelper);<NEW_LINE>projectHelper.parse(project, buildFile);<NEW_LINE>// If no target specified then default target will be executed.<NEW_LINE>String targetToExecute = (target != null && target.trim().length() > 0) ? target.trim() : project.getDefaultTarget();<NEW_LINE>project.executeTarget(targetToExecute);<NEW_LINE>project.fireBuildFinished(null);<NEW_LINE>success = true;<NEW_LINE>} catch (BuildException buildException) {<NEW_LINE>project.fireBuildFinished(buildException);<NEW_LINE>throw new RuntimeException("!!! Unable to restart the IEHS App !!!", buildException);<NEW_LINE>}<NEW_LINE>return success;<NEW_LINE>} | , properties.getProperty(k)); |
1,334,608 | protected final View makeContentView() {<NEW_LINE>LinearLayout rootLayout = new LinearLayout(activity);<NEW_LINE>rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));<NEW_LINE>rootLayout.setBackgroundColor(backgroundColor);<NEW_LINE>rootLayout.setOrientation(LinearLayout.VERTICAL);<NEW_LINE>rootLayout.setGravity(Gravity.CENTER);<NEW_LINE>rootLayout.setPadding(0, 0, 0, 0);<NEW_LINE>rootLayout.setClipToPadding(false);<NEW_LINE>View headerView = makeHeaderView();<NEW_LINE>if (headerView != null) {<NEW_LINE>rootLayout.addView(headerView);<NEW_LINE>}<NEW_LINE>if (topLineVisible) {<NEW_LINE>View lineView = new View(activity);<NEW_LINE>lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, topLineHeightPixels));<NEW_LINE>lineView.setBackgroundColor(topLineColor);<NEW_LINE>rootLayout.addView(lineView);<NEW_LINE>}<NEW_LINE>if (centerView == null) {<NEW_LINE>centerView = makeCenterView();<NEW_LINE>}<NEW_LINE>int lr = 0;<NEW_LINE>int tb = 0;<NEW_LINE>if (contentLeftAndRightPadding > 0) {<NEW_LINE>lr = ConvertUtils.toPx(activity, contentLeftAndRightPadding);<NEW_LINE>}<NEW_LINE>if (contentTopAndBottomPadding > 0) {<NEW_LINE>tb = ConvertUtils.toPx(activity, contentTopAndBottomPadding);<NEW_LINE>}<NEW_LINE>centerView.setPadding(lr, tb, lr, tb);<NEW_LINE>ViewGroup vg = (ViewGroup) centerView.getParent();<NEW_LINE>if (vg != null) {<NEW_LINE>// IllegalStateException: The specified child already has a parent<NEW_LINE>vg.removeView(centerView);<NEW_LINE>}<NEW_LINE>rootLayout.addView(centerView, new LinearLayout.LayoutParams<MASK><NEW_LINE>View footerView = makeFooterView();<NEW_LINE>if (footerView != null) {<NEW_LINE>rootLayout.addView(footerView);<NEW_LINE>}<NEW_LINE>return rootLayout;<NEW_LINE>} | (MATCH_PARENT, 0, 1.0f)); |
1,802,757 | public int alterNameAndTypeAndFlag(String tableSchema, String originName, String newName, int tableType, long flag) {<NEW_LINE>try {<NEW_LINE>final Map<Integer, ParameterContext> params = new HashMap<>(12);<NEW_LINE>MetaDbUtil.setParameter(1, params, ParameterMethod.setString, newName);<NEW_LINE>MetaDbUtil.setParameter(2, params, ParameterMethod.setInt, tableType);<NEW_LINE>MetaDbUtil.setParameter(3, params, ParameterMethod.setLong, flag);<NEW_LINE>MetaDbUtil.setParameter(4, params, ParameterMethod.setString, tableSchema);<NEW_LINE>MetaDbUtil.setParameter(5, params, ParameterMethod.setString, originName);<NEW_LINE><MASK><NEW_LINE>return MetaDbUtil.update(UPDATE_TABLES_EXT_SWITCH_NAME_TYPE_FLAG, params, connection);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_GMS_ACCESS_TO_SYSTEM_TABLE, e, "update", TABLES_EXT_TABLE, e.getMessage());<NEW_LINE>}<NEW_LINE>} | DdlMetaLogUtil.logSql(UPDATE_TABLES_EXT_SWITCH_NAME_TYPE_FLAG, params); |
746,736 | public List<Article> queryCrossWikiLookup(String label, Logger logger) throws IOException {<NEW_LINE>List<Article> results = new LinkedList<>();<NEW_LINE>String capitalisedLabel = super.capitalizeTitle(label);<NEW_LINE>String encodedName = URLEncoder.encode(capitalisedLabel, "UTF-8").replace("+", "%20");<NEW_LINE>String requestURL = crossWikiLookupUrl + "/search/" + encodedName + "?ver=1";<NEW_LINE><MASK><NEW_LINE>URLConnection connection = request.openConnection();<NEW_LINE>Gson gson = new Gson();<NEW_LINE>JsonReader jr = new JsonReader(new InputStreamReader(connection.getInputStream()));<NEW_LINE>jr.beginObject();<NEW_LINE>// results :<NEW_LINE>jr.nextName();<NEW_LINE>jr.beginArray();<NEW_LINE>while (jr.hasNext()) {<NEW_LINE>Article o = gson.fromJson(jr, Article.class);<NEW_LINE>o.getByCWLookup = true;<NEW_LINE>results.add(o);<NEW_LINE>logger.debug("sqlite-lookup({}) returned: p{} ~{} [{}] {} {}", label, o.getProb(), o.getMatchedLabel(), o.getCanonLabel(), o.getName(), o.getPageID());<NEW_LINE>}<NEW_LINE>jr.endArray();<NEW_LINE>jr.endObject();<NEW_LINE>return results;<NEW_LINE>} | URL request = new URL(requestURL); |
832,790 | public void replayDropBackend(Backend backend) {<NEW_LINE>LOG.debug("replayDropBackend: {}", backend);<NEW_LINE>// update idToBackend<NEW_LINE>Map<Long, Backend> copiedBackends = Maps.newHashMap(idToBackendRef);<NEW_LINE>copiedBackends.remove(backend.getId());<NEW_LINE>ImmutableMap<Long, Backend> newIdToBackend = ImmutableMap.copyOf(copiedBackends);<NEW_LINE>idToBackendRef = newIdToBackend;<NEW_LINE>// update idToReportVersion<NEW_LINE>Map<Long, AtomicLong> copiedReportVersions = Maps.newHashMap(idToReportVersionRef);<NEW_LINE>copiedReportVersions.remove(backend.getId());<NEW_LINE>ImmutableMap<Long, AtomicLong> newIdToReportVersion = ImmutableMap.copyOf(copiedReportVersions);<NEW_LINE>idToReportVersionRef = newIdToReportVersion;<NEW_LINE>// update cluster<NEW_LINE>final Cluster cluster = Env.getCurrentEnv().getCluster(backend.getOwnerClusterName());<NEW_LINE>if (null != cluster) {<NEW_LINE>cluster.<MASK><NEW_LINE>} else {<NEW_LINE>LOG.error("Cluster " + backend.getOwnerClusterName() + " no exist.");<NEW_LINE>}<NEW_LINE>} | removeBackend(backend.getId()); |
199,270 | /*<NEW_LINE>private AmopCommonArgs buildAmopCommonArgs(TransmissionlRequestWarp<?> requestWarp) {<NEW_LINE>AmopCommonArgs amopCommonArgs = buildAmopCommonArgs(requestWarp.getRequest());<NEW_LINE>amopCommonArgs.setChannelId(requestWarp.getWeIdAuthObj().getChannelId());<NEW_LINE>amopCommonArgs.setMessage(requestWarp.getEncodeData());<NEW_LINE>return amopCommonArgs;<NEW_LINE>}<NEW_LINE>*/<NEW_LINE>private AmopCommonArgs buildAmopCommonArgs(TransmissionRequest<?> request) {<NEW_LINE>AmopCommonArgs args = new AmopCommonArgs();<NEW_LINE>args.setServiceType(request.getServiceType());<NEW_LINE>args.setFromAmopId(amopTransmissionPoxy.getCurrentAmopId());<NEW_LINE>args.setMessage(super.getOriginalData<MASK><NEW_LINE>args.setToAmopId(request.getAmopId());<NEW_LINE>args.setMessageId(DataToolUtils.getUuId32());<NEW_LINE>return args;<NEW_LINE>} | (request.getArgs())); |
1,215,303 | public static String repeat(String value, int count) {<NEW_LINE>if (count < 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (value == null || value.length() == 0 || count == 1) {<NEW_LINE>return value;<NEW_LINE>}<NEW_LINE>if (count == 0) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>if (value.length() > Integer.MAX_VALUE / count) {<NEW_LINE>throw new OutOfMemoryError("Repeating " + value.length() + " bytes String " + count + " times will produce a String exceeding maximum size.");<NEW_LINE>}<NEW_LINE>int len = value.length();<NEW_LINE>int limit = len * count;<NEW_LINE>char[] array = new char[limit];<NEW_LINE>value.getChars(0, len, array, 0);<NEW_LINE>int copied;<NEW_LINE>for (copied = len; copied < limit - copied; copied <<= 1) {<NEW_LINE>System.arraycopy(array, 0, array, copied, copied);<NEW_LINE>}<NEW_LINE>System.arraycopy(array, 0, array, copied, limit - copied);<NEW_LINE>return new String(array);<NEW_LINE>} | throw new IllegalArgumentException("count is negative: " + count); |
1,611,514 | public static boolean isAvailable(@NonNull @Mode String mode) {<NEW_LINE>switch(mode) {<NEW_LINE>case MODE_OPEN_PGP:<NEW_LINE>String keyIds = (String) AppPref.get(AppPref.PrefKey.PREF_OPEN_PGP_USER_ID_STR);<NEW_LINE>// FIXME(1/10/20): Check for the availability of the provider<NEW_LINE>return !TextUtils.isEmpty(keyIds);<NEW_LINE>case MODE_AES:<NEW_LINE>try {<NEW_LINE>return KeyStoreManager.getInstance().containsKey(AESCrypto.AES_KEY_ALIAS);<NEW_LINE>} catch (Exception e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>case MODE_RSA:<NEW_LINE>try {<NEW_LINE>return KeyStoreManager.getInstance(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>case MODE_NO_ENCRYPTION:<NEW_LINE>return true;<NEW_LINE>default:<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | ).containsKey(RSACrypto.RSA_KEY_ALIAS); |
433,734 | /*<NEW_LINE>* Update records associated with a particular object id<NEW_LINE>*<NEW_LINE>* @param query Query to retrieve all of the statistics records associated with<NEW_LINE>* a particular object<NEW_LINE>*<NEW_LINE>* @param field Field to use for grouping records<NEW_LINE>*<NEW_LINE>* @return number of items processed. 0 indicates that no more work is available<NEW_LINE>* (or the max processed has been reached).<NEW_LINE>*/<NEW_LINE>private int updateRecords(String query) throws SolrServerException, SQLException, IOException {<NEW_LINE>int initNumProcessed = numProcessed;<NEW_LINE>SolrQuery sQ = new SolrQuery();<NEW_LINE>sQ.setQuery(query);<NEW_LINE>sQ.setRows(batchSize);<NEW_LINE>// Ensure that items are grouped by id<NEW_LINE>// Sort by id fails due to presense of id and string fields. The ord function<NEW_LINE>// seems to help<NEW_LINE>sQ.addSort("type", SolrQuery.ORDER.desc);<NEW_LINE>sQ.addSort("scopeType", SolrQuery.ORDER.desc);<NEW_LINE>sQ.addSort("ord(owningItem)", SolrQuery.ORDER.desc);<NEW_LINE>sQ.addSort("ord(id)", SolrQuery.ORDER.asc);<NEW_LINE>sQ.addSort("ord(scopeId)", SolrQuery.ORDER.asc);<NEW_LINE>QueryResponse sr = server.query(sQ);<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < sdl.size() && (numProcessed < numRec); i++) {<NEW_LINE>SolrDocument sd = sdl.get(i);<NEW_LINE>// ClientUtils.toSolrInputDocument(sd);<NEW_LINE>SolrInputDocument input = new SolrInputDocument();<NEW_LINE>for (String name : sd.getFieldNames()) {<NEW_LINE>// https://stackoverflow.com/a/38536843/2916377<NEW_LINE>input.addField(name, sd.getFieldValue(name));<NEW_LINE>}<NEW_LINE>input.remove("_version_");<NEW_LINE>for (FIELD col : FIELD.values()) {<NEW_LINE>mapField(input, col);<NEW_LINE>}<NEW_LINE>docs.add(input);<NEW_LINE>++numProcessed;<NEW_LINE>}<NEW_LINE>return numProcessed - initNumProcessed;<NEW_LINE>} | SolrDocumentList sdl = sr.getResults(); |
874,721 | public ResponseEntity<?> filterEntities(DomainTypeAdministrationConfiguration domainTypeAdministrationConfiguration, RootResourceInformation repoRequest, PersistentEntityResourceAssembler assembler, WebRequest request, Pageable pageable, @PathVariable String scopeName) throws Exception {<NEW_LINE>DynamicRepositoryInvoker repositoryInvoker = (DynamicRepositoryInvoker) repoRequest.getInvoker();<NEW_LINE>PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();<NEW_LINE>final ScopeMetadata scope = domainTypeAdministrationConfiguration.getScopes().getScope(scopeName);<NEW_LINE>final Specification filterSpecification = specificationFromRequest(request, persistentEntity);<NEW_LINE>if (isPredicateScope(scope)) {<NEW_LINE>final PredicateScopeMetadata predicateScope = (PredicateScopeMetadata) scope;<NEW_LINE>final Page page = findBySpecificationAndPredicate(repositoryInvoker, filterSpecification, predicateScope.predicate(), pageable);<NEW_LINE>Object <MASK><NEW_LINE>return new ResponseEntity(resources, HttpStatus.OK);<NEW_LINE>}<NEW_LINE>if (isSpecificationScope(scope)) {<NEW_LINE>final Specification scopeSpecification = ((ScopeMetadataUtils.SpecificationScopeMetadata) scope).specification();<NEW_LINE>Page page = findItemsBySpecification(repositoryInvoker, and(scopeSpecification, filterSpecification), pageable);<NEW_LINE>Object resources = resultToResources(page, assembler);<NEW_LINE>return new ResponseEntity(resources, HttpStatus.OK);<NEW_LINE>}<NEW_LINE>Page page = findItemsBySpecification(repositoryInvoker, filterSpecification, pageable);<NEW_LINE>Object resources = resultToResources(page, assembler);<NEW_LINE>return new ResponseEntity(resources, HttpStatus.OK);<NEW_LINE>} | resources = resultToResources(page, assembler); |
1,020,779 | public void parse(ParserRequest request, StreamObserver<ParserResponse> responseObserver) {<NEW_LINE>ParseResult parseResult = new ParseResult();<NEW_LINE>try {<NEW_LINE>ParseInterface parser = parserFactory.newParser(request.getDialect());<NEW_LINE>parseResult = parser.parse(request.getSqlProgram());<NEW_LINE>} catch (Exception e) {<NEW_LINE>parseResult.statements = new ArrayList<String>();<NEW_LINE>parseResult.position = -1;<NEW_LINE>parseResult.error = e.getClass().getName() + " " + e.getMessage();<NEW_LINE>parseResult.isUnfinishedSelect = false;<NEW_LINE>}<NEW_LINE>ParserResponse.Builder responseBuilder = ParserResponse.newBuilder();<NEW_LINE>responseBuilder.addAllSqlStatements(parseResult.statements);<NEW_LINE><MASK><NEW_LINE>responseBuilder.setError(parseResult.error);<NEW_LINE>responseBuilder.setIsUnfinishedSelect(parseResult.isUnfinishedSelect);<NEW_LINE>if (parseResult.inputOutputTables != null) {<NEW_LINE>for (int i = 0; i < parseResult.inputOutputTables.size(); i++) {<NEW_LINE>InputOutputTables.Builder tablesBuilder = InputOutputTables.newBuilder();<NEW_LINE>tablesBuilder.addAllInputs(parseResult.inputOutputTables.get(i).inputTables);<NEW_LINE>tablesBuilder.addAllOutputs(parseResult.inputOutputTables.get(i).outputTables);<NEW_LINE>responseBuilder.addInputOutputTables(tablesBuilder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>responseObserver.onNext(responseBuilder.build());<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} | responseBuilder.setIndex(parseResult.position); |
1,794,387 | private List<String> createUpdateSqls(String classname) {<NEW_LINE>final List<String> updateSqls = new ArrayList<>();<NEW_LINE>final Class<?> clazz = loadClass(classname);<NEW_LINE>final Field[] classFields = clazz.getFields();<NEW_LINE>for (final Field field : classFields) {<NEW_LINE>final <MASK><NEW_LINE>if (!fieldName.endsWith(SUFFIX_AD_Reference_ID)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final int adReferenceId = getFieldValueAsInt(field);<NEW_LINE>final String prefix = fieldName.substring(0, fieldName.length() - SUFFIX_AD_Reference_ID.length());<NEW_LINE>final Map<String, String> name2value = extractNameAndValueForPrefix(prefix, classFields);<NEW_LINE>updateSqls.add("\n\n-- " + prefix);<NEW_LINE>updateSqls.addAll(createUpdateSqls(adReferenceId, name2value));<NEW_LINE>}<NEW_LINE>return updateSqls;<NEW_LINE>} | String fieldName = field.getName(); |
1,697,735 | protected void doColorPicking(ColorPickerInfo pickerInfo) {<NEW_LINE>ObjectColorPicker picker = pickerInfo.getPicker();<NEW_LINE>picker.getRenderTarget().bind();<NEW_LINE>// Set background color (to Object3D.UNPICKABLE to prevent any conflicts)<NEW_LINE>GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);<NEW_LINE>// Clear buffers used for color-picking<NEW_LINE>GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);<NEW_LINE>// Get the picking material<NEW_LINE>Material pickingMaterial = picker.getMaterial();<NEW_LINE>// Can't blend picking colors<NEW_LINE>GLES20.glDisable(GLES20.GL_BLEND);<NEW_LINE>// Render the Skybox first (no need for depth testing)<NEW_LINE>if (mSkybox != null && mSkybox.isPickingEnabled()) {<NEW_LINE>GLES20.glDisable(GLES20.GL_DEPTH_TEST);<NEW_LINE>GLES20.glDepthMask(false);<NEW_LINE>mSkybox.renderColorPicking(mCamera, pickingMaterial);<NEW_LINE><MASK><NEW_LINE>GLES20.glDepthMask(true);<NEW_LINE>}<NEW_LINE>// Render all children using their picking colors<NEW_LINE>synchronized (mChildren) {<NEW_LINE>for (int i = 0, j = mChildren.size(); i < j; ++i) {<NEW_LINE>mChildren.get(i).renderColorPicking(mCamera, pickingMaterial);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// pickObject() unbinds the renderTarget's framebuffer...<NEW_LINE>ObjectColorPicker.pickObject(pickerInfo);<NEW_LINE>} | GLES20.glEnable(GLES20.GL_DEPTH_TEST); |
1,733,415 | public MethodNode generate() {<NEW_LINE>int size = Bytecode.getArgsSize(this.argTypes) + this.returnType.getSize() + (this.targetIsStatic ? 0 : 1);<NEW_LINE>MethodNode method = this.createMethod(size, size);<NEW_LINE>if (!this.targetIsStatic) {<NEW_LINE>method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));<NEW_LINE>}<NEW_LINE>Bytecode.loadArgs(this.argTypes, method.instructions, this.info.isStatic ? 0 : 1);<NEW_LINE>boolean isPrivate = Bytecode.hasFlag(this.targetMethod, Opcodes.ACC_PRIVATE);<NEW_LINE>int opcode = this.targetIsStatic ? Opcodes.INVOKESTATIC : (isPrivate ? Opcodes.INVOKESPECIAL : Opcodes.INVOKEVIRTUAL);<NEW_LINE>method.instructions.add(new MethodInsnNode(opcode, this.info.getClassNode().name, this.targetMethod.name, this<MASK><NEW_LINE>method.instructions.add(new InsnNode(this.returnType.getOpcode(Opcodes.IRETURN)));<NEW_LINE>return method;<NEW_LINE>} | .targetMethod.desc, false)); |
1,668,889 | public static void checkToken(String path, final MainActivity mainActivity) {<NEW_LINE>new AsyncTask<String, Void, Boolean>() {<NEW_LINE><NEW_LINE>OpenMode serviceType;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected Boolean doInBackground(String... params) {<NEW_LINE>final <MASK><NEW_LINE>boolean isTokenValid = true;<NEW_LINE>String path = params[0];<NEW_LINE>final CloudStorage cloudStorage;<NEW_LINE>if (path.startsWith(CloudHandler.CLOUD_PREFIX_DROPBOX)) {<NEW_LINE>// dropbox account<NEW_LINE>serviceType = OpenMode.DROPBOX;<NEW_LINE>cloudStorage = dataUtils.getAccount(OpenMode.DROPBOX);<NEW_LINE>} else if (path.startsWith(CloudHandler.CLOUD_PREFIX_ONE_DRIVE)) {<NEW_LINE>serviceType = OpenMode.ONEDRIVE;<NEW_LINE>cloudStorage = dataUtils.getAccount(OpenMode.ONEDRIVE);<NEW_LINE>} else if (path.startsWith(CloudHandler.CLOUD_PREFIX_BOX)) {<NEW_LINE>serviceType = OpenMode.BOX;<NEW_LINE>cloudStorage = dataUtils.getAccount(OpenMode.BOX);<NEW_LINE>} else if (path.startsWith(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE)) {<NEW_LINE>serviceType = OpenMode.GDRIVE;<NEW_LINE>cloudStorage = dataUtils.getAccount(OpenMode.GDRIVE);<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>cloudStorage.getUserLogin();<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>isTokenValid = false;<NEW_LINE>}<NEW_LINE>return isTokenValid;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onPostExecute(Boolean aBoolean) {<NEW_LINE>super.onPostExecute(aBoolean);<NEW_LINE>if (!aBoolean) {<NEW_LINE>// delete account and create a new one<NEW_LINE>Toast.makeText(mainActivity, mainActivity.getResources().getString(R.string.cloud_token_lost), Toast.LENGTH_LONG).show();<NEW_LINE>mainActivity.deleteConnection(serviceType);<NEW_LINE>mainActivity.addConnection(serviceType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}.execute(path);<NEW_LINE>} | DataUtils dataUtils = DataUtils.getInstance(); |
236,942 | // rbDelete().<NEW_LINE>void move(AbstractTreeMap.Entry x, AbstractTreeMap.Entry y) throws ObjectManagerException {<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, "move", new Object[] { x, y });<NEW_LINE>Entry yParent = (Entry) y.getParent();<NEW_LINE>// Set x into the position occupied by y.<NEW_LINE>x.setParent(yParent);<NEW_LINE>if (yParent == null)<NEW_LINE>setRoot(x);<NEW_LINE>else if (yParent.getRight() == y)<NEW_LINE>yParent.setRight(x);<NEW_LINE>else<NEW_LINE>yParent.setLeft(x);<NEW_LINE>x.<MASK><NEW_LINE>x.setRight(y.getRight());<NEW_LINE>// Set the x to be the parent of y's children.<NEW_LINE>if (y.getLeft() != null)<NEW_LINE>y.getLeft().setParent(x);<NEW_LINE>if (y.getRight() != null)<NEW_LINE>y.getRight().setParent(x);<NEW_LINE>x.setColor(y.getColor());<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, "move", new Object[] { x });<NEW_LINE>} | setLeft(y.getLeft()); |
553,494 | private void addLocalFieldsAndVars(final Env env) throws IOException {<NEW_LINE>final CompilationController controller = env.getController();<NEW_LINE>final Elements elements = controller.getElements();<NEW_LINE>final Types types = controller.getTypes();<NEW_LINE>final <MASK><NEW_LINE>Set<? extends TypeMirror> smartTypes = options.contains(Options.ALL_COMPLETION) ? null : getSmartTypes(env);<NEW_LINE>final TypeElement enclClass = scope.getEnclosingClass();<NEW_LINE>for (Element e : getLocalMembersAndVars(env)) {<NEW_LINE>switch(simplifyElementKind(e.getKind())) {<NEW_LINE>case ENUM_CONSTANT:<NEW_LINE>case EXCEPTION_PARAMETER:<NEW_LINE>case LOCAL_VARIABLE:<NEW_LINE>case RESOURCE_VARIABLE:<NEW_LINE>case PARAMETER:<NEW_LINE>results.add(itemFactory.createVariableItem(env.getController(), (VariableElement) e, e.asType(), anchorOffset, null, env.getScope().getEnclosingClass() != e.getEnclosingElement(), elements.isDeprecated(e), isOfSmartType(env, e.asType(), smartTypes), env.assignToVarPos()));<NEW_LINE>break;<NEW_LINE>case FIELD:<NEW_LINE>String name = e.getSimpleName().toString();<NEW_LINE>if (THIS_KEYWORD.equals(name) || SUPER_KEYWORD.equals(name)) {<NEW_LINE>results.add(itemFactory.createKeywordItem(name, null, anchorOffset, isOfSmartType(env, e.asType(), smartTypes)));<NEW_LINE>} else {<NEW_LINE>TypeMirror tm = asMemberOf(e, enclClass != null ? enclClass.asType() : null, types);<NEW_LINE>results.add(itemFactory.createVariableItem(env.getController(), (VariableElement) e, tm, anchorOffset, null, env.getScope().getEnclosingClass() != e.getEnclosingElement(), elements.isDeprecated(e), isOfSmartType(env, tm, smartTypes), env.assignToVarPos()));<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Scope scope = env.getScope(); |
294,275 | public static Parameter createInstance(AnnotationModel annotation, ApiContext context) {<NEW_LINE>ParameterImpl from = new ParameterImpl();<NEW_LINE>from.setName(annotation.getValue("name", String.class));<NEW_LINE>EnumModel inEnum = annotation.<MASK><NEW_LINE>if (inEnum != null) {<NEW_LINE>from.setIn(In.valueOf(inEnum.getValue()));<NEW_LINE>}<NEW_LINE>from.setDescription(annotation.getValue("description", String.class));<NEW_LINE>from.setRequired(annotation.getValue("required", Boolean.class));<NEW_LINE>from.setDeprecated(annotation.getValue("deprecated", Boolean.class));<NEW_LINE>from.setAllowEmptyValue(annotation.getValue("allowEmptyValue", Boolean.class));<NEW_LINE>String ref = annotation.getValue("ref", String.class);<NEW_LINE>if (ref != null && !ref.isEmpty()) {<NEW_LINE>from.setRef(ref);<NEW_LINE>}<NEW_LINE>EnumModel styleEnum = annotation.getValue("style", EnumModel.class);<NEW_LINE>if (styleEnum != null) {<NEW_LINE>from.setStyle(Style.valueOf(styleEnum.getValue()));<NEW_LINE>}<NEW_LINE>from.setExplode(annotation.getValue("explode", Boolean.class));<NEW_LINE>from.setAllowReserved(annotation.getValue("allowReserved", Boolean.class));<NEW_LINE>AnnotationModel schemaAnnotation = annotation.getValue("schema", AnnotationModel.class);<NEW_LINE>if (schemaAnnotation != null) {<NEW_LINE>Boolean hidden = schemaAnnotation.getValue("hidden", Boolean.class);<NEW_LINE>if (hidden == null || !hidden) {<NEW_LINE>from.setSchema(SchemaImpl.createInstance(schemaAnnotation, context));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>extractAnnotations(annotation, context, "examples", "name", ExampleImpl::createInstance, from::addExample);<NEW_LINE>from.setExample(annotation.getValue("example", Object.class));<NEW_LINE>final List<ContentImpl> contents = createList();<NEW_LINE>extractAnnotations(annotation, context, "content", ContentImpl::createInstance, contents::add);<NEW_LINE>for (ContentImpl content : contents) {<NEW_LINE>content.getMediaTypes().forEach(from.content::addMediaType);<NEW_LINE>}<NEW_LINE>return from;<NEW_LINE>} | getValue("in", EnumModel.class); |
193,325 | private void checkMemberOfNativeJsType(Member member) {<NEW_LINE>MemberDescriptor memberDescriptor = member.getDescriptor();<NEW_LINE>if (memberDescriptor.isJsOverlay() || memberDescriptor.isSynthetic()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String readableDescription = member.getReadableDescription();<NEW_LINE>JsMemberType jsMemberType = memberDescriptor<MASK><NEW_LINE>switch(jsMemberType) {<NEW_LINE>case CONSTRUCTOR:<NEW_LINE>if (!((Method) member).isEmpty()) {<NEW_LINE>problems.error(member.getSourcePosition(), "Native JsType constructor '%s' cannot have non-empty method body.", readableDescription);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case METHOD:<NEW_LINE>case GETTER:<NEW_LINE>case SETTER:<NEW_LINE>if (!member.isAbstract() && !member.isNative()) {<NEW_LINE>problems.error(member.getSourcePosition(), "Native JsType method '%s' should be native, abstract or JsOverlay.", readableDescription);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case PROPERTY:<NEW_LINE>Field field = (Field) member;<NEW_LINE>if (field.getDescriptor().isFinal()) {<NEW_LINE>problems.error(field.getSourcePosition(), "Native JsType field '%s' cannot be final.", member.getReadableDescription());<NEW_LINE>} else if (field.hasInitializer()) {<NEW_LINE>problems.error(field.getSourcePosition(), "Native JsType field '%s' cannot have initializer.", readableDescription);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case NONE:<NEW_LINE>problems.error(member.getSourcePosition(), "Native JsType member '%s' cannot have @JsIgnore.", readableDescription);<NEW_LINE>break;<NEW_LINE>case UNDEFINED_ACCESSOR:<NEW_LINE>// Nothing to check here. An error will be emitted for UNDEFINED_ACCESSOR elsewhere.<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | .getJsInfo().getJsMemberType(); |
155,054 | // Run the job.<NEW_LINE>void runJob() throws IOException {<NEW_LINE>++currentAttempt;<NEW_LINE>if (!shouldRetry()) {<NEW_LINE>throw new RuntimeException(String.format("Failed to create job with prefix %s, " + "reached max retries: %d, last failed job: %s.", currentJobId.getJobIdPrefix(), maxRetries, BigQueryHelpers.jobToPrettyString(lastJobAttempted)));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>this.started = false;<NEW_LINE>executeJob.apply(currentJobId);<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>LOG.warn("Job {} failed.", currentJobId.getJobId(), e);<NEW_LINE>// It's possible that the job actually made it to BQ even though we got a failure here.<NEW_LINE>// For example, the response from BQ may have timed out returning. getRetryJobId will<NEW_LINE>// return the correct job id to use on retry, or a job id to continue polling (if it turns<NEW_LINE>// out that the job has not actually failed yet).<NEW_LINE>RetryJobIdResult <MASK><NEW_LINE>currentJobId = result.jobId;<NEW_LINE>if (result.shouldRetry) {<NEW_LINE>// Otherwise the jobs either never started or started and failed. Try the job again with<NEW_LINE>// the job id returned by getRetryJobId.<NEW_LINE>LOG.info("Will retry with job id {}", currentJobId.getJobId());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.info("job {} started", currentJobId.getJobId());<NEW_LINE>// The job has reached BigQuery and is in either the PENDING state or has completed<NEW_LINE>// successfully.<NEW_LINE>this.started = true;<NEW_LINE>} | result = getRetryJobId(currentJobId, lookupJob); |
77,144 | protected static void clearIndexLabel(HugeGraphParams graph, Id id) {<NEW_LINE>Id olapIndexLabel = findOlapIndexLabel(graph, id);<NEW_LINE>if (olapIndexLabel == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>GraphTransaction graphTx = graph.graphTransaction();<NEW_LINE>SchemaTransaction schemaTx = graph.schemaTransaction();<NEW_LINE>IndexLabel indexLabel = schemaTx.getIndexLabel(olapIndexLabel);<NEW_LINE>// If the index label does not exist, return directly<NEW_LINE>if (indexLabel == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LockUtil.Locks locks = new LockUtil.Locks(graph.name());<NEW_LINE>try {<NEW_LINE>locks.lockWrites(LockUtil.INDEX_LABEL_DELETE, olapIndexLabel);<NEW_LINE>// Set index label to "rebuilding" status<NEW_LINE>schemaTx.updateSchemaStatus(indexLabel, SchemaStatus.REBUILDING);<NEW_LINE>try {<NEW_LINE>// Remove index data<NEW_LINE>graphTx.removeIndex(indexLabel);<NEW_LINE>graph.graph().tx().commit();<NEW_LINE>schemaTx.updateSchemaStatus(indexLabel, SchemaStatus.CREATED);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>schemaTx.<MASK><NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>locks.unlock();<NEW_LINE>}<NEW_LINE>} | updateSchemaStatus(indexLabel, SchemaStatus.INVALID); |
1,165,854 | public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutput pageOutput) {<NEW_LINE>final PluginTask task = loadPluginTaskFromTaskSource(taskSource);<NEW_LINE>final ConfigSource originalConfig = task.getOriginalConfig();<NEW_LINE>final <MASK><NEW_LINE>// get sample buffer<NEW_LINE>Buffer sample = readSample(input, guessParserSampleBufferBytes);<NEW_LINE>// load guess plugins<NEW_LINE>ImmutableList.Builder<GuessPlugin> builder = ImmutableList.builder();<NEW_LINE>for (PluginType guessType : task.getGuessPluginTypes()) {<NEW_LINE>GuessPlugin guess = ExecInternal.newPlugin(GuessPlugin.class, guessType);<NEW_LINE>builder.add(guess);<NEW_LINE>}<NEW_LINE>List<GuessPlugin> guesses = builder.build();<NEW_LINE>// run guess plugins<NEW_LINE>ConfigSource mergedConfig = originalConfig.deepCopy();<NEW_LINE>ConfigDiff mergedGuessed = Exec.newConfigDiff();<NEW_LINE>for (int i = 0; i < guesses.size(); i++) {<NEW_LINE>ConfigDiff guessed = guesses.get(i).guess(originalConfig, sample);<NEW_LINE>guessed = addAssumedDecoderConfigs(originalConfig, guessed);<NEW_LINE>mergedGuessed.merge(guessed);<NEW_LINE>mergedConfig.merge(mergedGuessed);<NEW_LINE>if (!mergedConfig.equals(originalConfig)) {<NEW_LINE>// config updated<NEW_LINE>throw new GuessedNoticeError(mergedGuessed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new GuessedNoticeError(mergedGuessed);<NEW_LINE>} | int guessParserSampleBufferBytes = task.getGuessParserSampleBufferBytes(); |
891,062 | public TagCollection unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>TagCollection tagCollection = new TagCollection();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("AppBoundaryKey", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>tagCollection.setAppBoundaryKey(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("TagValues", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>tagCollection.setTagValues(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return tagCollection;<NEW_LINE>} | class).unmarshall(context)); |
1,754,279 | public static void deleteBreakpoints(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {<NEW_LINE>Preconditions.checkNotNull(debuggerProvider, "IE01886: Debugger provider argument can not be null");<NEW_LINE>Preconditions.checkNotNull(rows, "IE02253: Rows argument can't be null");<NEW_LINE>final ArrayList<Pair<IDebugger, BreakpointAddress>> addresses = new ArrayList<Pair<MASK><NEW_LINE>for (final int row : rows) {<NEW_LINE>final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(debuggerProvider, row);<NEW_LINE>final BreakpointManager manager = breakpoint.first().getBreakpointManager();<NEW_LINE>final int breakpointIndex = breakpoint.second();<NEW_LINE>addresses.add(new Pair<IDebugger, BreakpointAddress>(breakpoint.first(), manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress()));<NEW_LINE>}<NEW_LINE>for (final Pair<IDebugger, BreakpointAddress> p : addresses) {<NEW_LINE>final BreakpointManager manager = p.first().getBreakpointManager();<NEW_LINE>final BreakpointAddress address = p.second();<NEW_LINE>manager.setBreakpointStatus(Sets.newHashSet(address), BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DELETING);<NEW_LINE>}<NEW_LINE>} | <IDebugger, BreakpointAddress>>(); |
373,640 | public static MarkdownParagraphGroup parse(final char[] raw) {<NEW_LINE>final CharArrSubstring[] rawLines = CharArrSubstring.generateFromLines(raw);<NEW_LINE>final MarkdownLine[] lines = new MarkdownLine[rawLines.length];<NEW_LINE>for (int i = 0; i < rawLines.length; i++) {<NEW_LINE>lines[i] = MarkdownLine<MASK><NEW_LINE>}<NEW_LINE>final ArrayList<MarkdownLine> mergedLines = new ArrayList<>(rawLines.length);<NEW_LINE>MarkdownLine currentLine = null;<NEW_LINE>for (int i = 0; i < lines.length; i++) {<NEW_LINE>if (currentLine != null) {<NEW_LINE>switch(lines[i].type) {<NEW_LINE>case BULLET:<NEW_LINE>case NUMBERED:<NEW_LINE>case HEADER:<NEW_LINE>case CODE:<NEW_LINE>case HLINE:<NEW_LINE>case QUOTE:<NEW_LINE>mergedLines.add(currentLine);<NEW_LINE>currentLine = lines[i];<NEW_LINE>break;<NEW_LINE>case EMPTY:<NEW_LINE>mergedLines.add(currentLine);<NEW_LINE>currentLine = null;<NEW_LINE>break;<NEW_LINE>case TEXT:<NEW_LINE>switch(lines[i - 1].type) {<NEW_LINE>case QUOTE:<NEW_LINE>case BULLET:<NEW_LINE>case NUMBERED:<NEW_LINE>case TEXT:<NEW_LINE>if (lines[i - 1].spacesAtEnd >= 2) {<NEW_LINE>mergedLines.add(currentLine);<NEW_LINE>currentLine = lines[i];<NEW_LINE>} else {<NEW_LINE>currentLine = currentLine.rejoin(lines[i]);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case CODE:<NEW_LINE>case HEADER:<NEW_LINE>case HLINE:<NEW_LINE>mergedLines.add(currentLine);<NEW_LINE>currentLine = lines[i];<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else if (lines[i].type != MarkdownParagraphType.EMPTY) {<NEW_LINE>currentLine = lines[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (currentLine != null) {<NEW_LINE>mergedLines.add(currentLine);<NEW_LINE>}<NEW_LINE>final ArrayList<MarkdownParagraph> outputParagraphs = new ArrayList<>(mergedLines.size());<NEW_LINE>for (final MarkdownLine line : mergedLines) {<NEW_LINE>final MarkdownParagraph lastParagraph = outputParagraphs.isEmpty() ? null : outputParagraphs.get(outputParagraphs.size() - 1);<NEW_LINE>final MarkdownParagraph paragraph = line.tokenize(lastParagraph);<NEW_LINE>if (!paragraph.isEmpty()) {<NEW_LINE>outputParagraphs.add(paragraph);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new MarkdownParagraphGroup(outputParagraphs.toArray(new MarkdownParagraph[0]));<NEW_LINE>} | .generate(rawLines[i]); |
93,951 | private void validateVector(String name, ValueVector vector) {<NEW_LINE>if (vector instanceof BitVector) {<NEW_LINE>validateBitVector(name, (BitVector) vector);<NEW_LINE>} else if (vector instanceof RepeatedBitVector) {<NEW_LINE>validateRepeatedBitVector(name, (RepeatedBitVector) vector);<NEW_LINE>} else if (vector instanceof NullableVector) {<NEW_LINE>validateNullableVector(name, (NullableVector) vector);<NEW_LINE>} else if (vector instanceof VarCharVector) {<NEW_LINE>validateVarCharVector(name, (VarCharVector) vector);<NEW_LINE>} else if (vector instanceof VarBinaryVector) {<NEW_LINE>validateVarBinaryVector(name, (VarBinaryVector) vector);<NEW_LINE>} else if (vector instanceof FixedWidthVector || vector instanceof ZeroVector) {<NEW_LINE>// Not much to do. The only item to check is the vector<NEW_LINE>// count itself, which was already done. There is no inner<NEW_LINE>// structure to check.<NEW_LINE>} else if (vector instanceof BaseRepeatedValueVector) {<NEW_LINE>validateRepeatedVector(name, (BaseRepeatedValueVector) vector);<NEW_LINE>} else if (vector instanceof AbstractRepeatedMapVector) {<NEW_LINE>// RepeatedMapVector or DictVector<NEW_LINE>// In case of DictVector, keys and values vectors are not validated explicitly to avoid NPE<NEW_LINE>// when keys and values vectors are not set. This happens when output dict vector's keys and<NEW_LINE>// values are not constructed while copying values from input reader to dict writer and the<NEW_LINE>// input reader is an instance of NullReader for all rows which does not have schema.<NEW_LINE>validateRepeatedMapVector(name, (AbstractRepeatedMapVector) vector);<NEW_LINE>} else if (vector instanceof MapVector) {<NEW_LINE>validateMapVector(name, (MapVector) vector);<NEW_LINE>} else if (vector instanceof RepeatedListVector) {<NEW_LINE>validateRepeatedListVector(name, (RepeatedListVector) vector);<NEW_LINE>} else if (vector instanceof UnionVector) {<NEW_LINE>validateUnionVector(name, (UnionVector) vector);<NEW_LINE>} else if (vector instanceof VarDecimalVector) {<NEW_LINE>validateVarDecimalVector(name, (VarDecimalVector) vector);<NEW_LINE>} else {<NEW_LINE>logger.debug("Don't know how to validate vector: {} of class {}", name, vector.<MASK><NEW_LINE>}<NEW_LINE>} | getClass().getSimpleName()); |
1,095,871 | protected XMLResource createEmfXmlResource(MediaType mediaType) {<NEW_LINE>XMLResource result = null;<NEW_LINE>if (MediaType.APPLICATION_ECORE.isCompatible(getMediaType())) {<NEW_LINE>result = new EMOFResourceImpl();<NEW_LINE>} else if (MediaType.APPLICATION_XMI.isCompatible(getMediaType())) {<NEW_LINE>result = new XMIResourceImpl();<NEW_LINE>} else {<NEW_LINE>result = new XMLResourceImpl();<NEW_LINE>}<NEW_LINE>if (getCharacterSet() != null) {<NEW_LINE>result.setEncoding(getCharacterSet().getName());<NEW_LINE>} else {<NEW_LINE>result.setEncoding(CharacterSet.UTF_8.getName());<NEW_LINE>}<NEW_LINE>// Set XML load options<NEW_LINE>result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);<NEW_LINE>result.getDefaultLoadOptions().put(<MASK><NEW_LINE>result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);<NEW_LINE>// Set XML save options<NEW_LINE>result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);<NEW_LINE>result.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, getLineWidth());<NEW_LINE>result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, isUsingEncodedAttributeStyle());<NEW_LINE>result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);<NEW_LINE>// Set other XML options<NEW_LINE>XMLOptions xmlOptions = new XMLOptionsImpl();<NEW_LINE>xmlOptions.setProcessAnyXML(true);<NEW_LINE>xmlOptions.setProcessSchemaLocations(true);<NEW_LINE>result.getDefaultLoadOptions().put(XMLResource.OPTION_XML_OPTIONS, xmlOptions);<NEW_LINE>return result;<NEW_LINE>} | XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); |
1,289,411 | protected void validateMissingJndiName(Class<?> instanceClass, A annotation) throws InjectionException {<NEW_LINE>if (// F50309.6<NEW_LINE>isValidationLoggable()) {<NEW_LINE>Tr.error(tc, "MISSING_CLASS_LEVEL_ANNOTATION_NAME_CWNEN0073E", '@' + annotation.annotationType().getSimpleName(), instanceClass.getName(), ivNameSpaceConfig.getModuleName(), ivNameSpaceConfig.getApplicationName());<NEW_LINE>if (isValidationFailable()) {<NEW_LINE>throw new InjectionException("The @" + annotation.annotationType().getSimpleName() + " class-level annotation on the " + instanceClass.getName() + " class in the " + ivNameSpaceConfig.getModuleName() + " module of the " + <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())<NEW_LINE>Tr.debug(tc, "ignoring class-level annotation without name");<NEW_LINE>}<NEW_LINE>} | ivNameSpaceConfig.getApplicationName() + " application does not specify a JNDI name."); |
1,195,886 | private Mono<PagedResponse<VmmServerInner>> listByResourceGroupSinglePageAsync(String resourceGroupName, 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>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null));<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
931,402 | private Mono<Response<VMExtensionPayloadInner>> vMHostPayloadWithResponseAsync(String resourceGroupName, String monitorName) {<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.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (monitorName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.vMHostPayload(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, monitorName, this.client.getApiVersion(), accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext(<MASK><NEW_LINE>} | )).readOnly())); |
622,651 | private void openDialog(Section section, KeyBind name) {<NEW_LINE>rebindDialog = new Dialog(rebindAxis ? bundle.get("keybind.press.axis", "Press an axis or key...") : bundle.get("keybind.press", "Press a key..."));<NEW_LINE>rebindKey = name;<NEW_LINE>rebindDialog.titleTable.getCells().first().pad(4);<NEW_LINE>if (section.device.type() == DeviceType.keyboard) {<NEW_LINE>rebindDialog.<MASK><NEW_LINE>rebindDialog.addListener(new InputListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button) {<NEW_LINE>if (Core.app.isAndroid())<NEW_LINE>return false;<NEW_LINE>rebind(section, name, button);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean keyDown(InputEvent event, KeyCode keycode) {<NEW_LINE>rebindDialog.hide();<NEW_LINE>if (keycode == KeyCode.escape)<NEW_LINE>return false;<NEW_LINE>rebind(section, name, keycode);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean scrolled(InputEvent event, float x, float y, float amountX, float amountY) {<NEW_LINE>if (!rebindAxis)<NEW_LINE>return false;<NEW_LINE>rebindDialog.hide();<NEW_LINE>rebind(section, name, KeyCode.scroll);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>rebindDialog.show();<NEW_LINE>Time.runTask(1f, () -> getScene().setScrollFocus(rebindDialog));<NEW_LINE>} | keyDown(i -> setup()); |
1,458,083 | protected int doChooseSplitIndex(List<DBTreeRecord<?, ? extends NS>> children, Comparator<NS> axis) {<NEW_LINE>children.sort(Comparator.comparing(DBTreeRecord::getBounds, axis));<NEW_LINE>// Distributions as described in Section 4.2<NEW_LINE>// Precompute the bounding boxes of each pair, incrementally.<NEW_LINE>// ************X (M = 12)<NEW_LINE>// mmm-------mmm (m = 3)<NEW_LINE>// 8 distributions : 12 - 2*3 + 2<NEW_LINE>Collection<? extends NS> firstBounds = Collections2.transform(children.subList(0, minChildren), DBTreeRecord::getBounds);<NEW_LINE>NS boundsFirstKChildren = BoundingShape.boundsUnion(firstBounds);<NEW_LINE>Collection<? extends NS> secondBounds = Collections2.transform(children.subList(maxChildren + 1 - minChildren, maxChildren + 1), DBTreeRecord::getBounds);<NEW_LINE>NS boundsLastKChildren = BoundingShape.boundsUnion(secondBounds);<NEW_LINE>int maxK = maxChildren + 1 - minChildren * 2;<NEW_LINE>Deque<NS> <MASK><NEW_LINE>Deque<NS> boundsSeconds = new ArrayDeque<>();<NEW_LINE>boundsFirsts.addLast(boundsFirstKChildren);<NEW_LINE>boundsSeconds.addFirst(boundsLastKChildren);<NEW_LINE>for (int k = 0; k <= maxK; k++) {<NEW_LINE>NS forFirst = children.get(minChildren + k).getBounds();<NEW_LINE>NS forSecond = children.get(maxChildren - minChildren - k).getBounds();<NEW_LINE>boundsFirstKChildren = boundsFirstKChildren.unionBounds(forFirst);<NEW_LINE>boundsLastKChildren = boundsLastKChildren.unionBounds(forSecond);<NEW_LINE>boundsFirsts.addLast(boundsFirstKChildren);<NEW_LINE>boundsSeconds.addFirst(boundsLastKChildren);<NEW_LINE>}<NEW_LINE>// CSI1<NEW_LINE>double bestOverlapValue = Double.MAX_VALUE;<NEW_LINE>double bestAreaValue = Double.MAX_VALUE;<NEW_LINE>int bestIndex = -1;<NEW_LINE>for (int k = 0; k <= maxK; k++) {<NEW_LINE>NS boundsFirstGroup = boundsFirsts.removeFirst();<NEW_LINE>NS boundsSecondGroup = boundsSeconds.removeFirst();<NEW_LINE>double overlapValue = boundsFirstGroup.computeAreaIntersection(boundsSecondGroup);<NEW_LINE>double areaValue = boundsFirstGroup.getArea() + boundsSecondGroup.getArea();<NEW_LINE>if (bestIndex == -1 || overlapValue < bestOverlapValue || (overlapValue == bestOverlapValue && areaValue < bestAreaValue)) {<NEW_LINE>bestIndex = k;<NEW_LINE>bestOverlapValue = overlapValue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert bestIndex != -1;<NEW_LINE>return bestIndex + minChildren;<NEW_LINE>} | boundsFirsts = new ArrayDeque<>(); |
1,768,780 | private static WMSEndpoint extractService(Node element, WMSEndpoint ret) {<NEW_LINE>for (int i = 0; i < element.getChildNodes().getLength(); i++) {<NEW_LINE>Node e = element.getChildNodes().item(i);<NEW_LINE>String name = e.getNodeName();<NEW_LINE>// Starts by looking for the entry tag<NEW_LINE>if (name.contains("Name")) {<NEW_LINE>ret.setName(e.getTextContent());<NEW_LINE>} else if (name.contains("Title")) {<NEW_LINE>ret.setTitle(e.getTextContent());<NEW_LINE>} else if (name.contains("Abstract")) {<NEW_LINE>ret.setDescription(e.getTextContent());<NEW_LINE>} else if (name.contains("OnlineResource")) {<NEW_LINE>Node namedItem = e.<MASK><NEW_LINE>Node namedItem2 = e.getAttributes().getNamedItem("href");<NEW_LINE>String baseUrl = null;<NEW_LINE>if (namedItem != null)<NEW_LINE>baseUrl = namedItem.getNodeValue();<NEW_LINE>if (namedItem2 != null)<NEW_LINE>baseUrl = namedItem2.getNodeValue();<NEW_LINE>if (baseUrl != null) {<NEW_LINE>ret.setBaseurl(baseUrl);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | getAttributes().getNamedItem("xlink:href"); |
1,213,993 | private void readTheme(final List<ModelNode> list, final XMLExtendedStreamReader reader) throws XMLStreamException {<NEW_LINE>ModelNode addThemeDefaults = new ModelNode();<NEW_LINE>addThemeDefaults.get(ModelDescriptionConstants.OP<MASK><NEW_LINE>PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(ThemeResourceDefinition.TAG_NAME, ThemeResourceDefinition.RESOURCE_NAME));<NEW_LINE>addThemeDefaults.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode());<NEW_LINE>list.add(addThemeDefaults);<NEW_LINE>while (reader.hasNext() && nextTag(reader) != END_ELEMENT) {<NEW_LINE>String tagName = reader.getLocalName();<NEW_LINE>if (MODULES.getName().equals(tagName)) {<NEW_LINE>readModules(reader, addThemeDefaults);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>SimpleAttributeDefinition def = KeycloakExtension.THEME_DEFINITION.lookup(tagName);<NEW_LINE>if (def == null)<NEW_LINE>throw new XMLStreamException("Unknown theme tag " + tagName);<NEW_LINE>def.parseAndSetParameter(reader.getElementText(), addThemeDefaults, reader);<NEW_LINE>}<NEW_LINE>} | ).set(ModelDescriptionConstants.ADD); |
1,184,378 | private void copyMethods(ProviderConfig<T> providerConfig, ServiceConfig<T> serviceConfig) {<NEW_LINE>Map<String, MethodConfig<MASK><NEW_LINE>if (CommonUtils.isNotEmpty(methodConfigs)) {<NEW_LINE>List<com.alibaba.dubbo.config.MethodConfig> dubboMethodConfigs = new ArrayList<com.alibaba.dubbo.config.MethodConfig>();<NEW_LINE>for (Map.Entry<String, MethodConfig> entry : methodConfigs.entrySet()) {<NEW_LINE>MethodConfig methodConfig = entry.getValue();<NEW_LINE>com.alibaba.dubbo.config.MethodConfig dubboMethodConfig = new com.alibaba.dubbo.config.MethodConfig();<NEW_LINE>dubboMethodConfig.setName(methodConfig.getName());<NEW_LINE>dubboMethodConfig.setParameters(methodConfig.getParameters());<NEW_LINE>dubboMethodConfigs.add(dubboMethodConfig);<NEW_LINE>}<NEW_LINE>serviceConfig.setMethods(dubboMethodConfigs);<NEW_LINE>}<NEW_LINE>} | > methodConfigs = providerConfig.getMethods(); |
885,907 | public X509Certificate createAndSignCertificate(String username, X500Name subject, KeyPair newCertKeyPair, X509Certificate caCert, PrivateKey pk, Map<String, Integer> subjectAltNames) throws Exception {<NEW_LINE>log.debug("Called createAndSignCertificate for: {}, {}", username, subject);<NEW_LINE>X500Name newCertSubject = new X500Name(String.format("CN=%s", username));<NEW_LINE>BigInteger newCertSerial = BigInteger.valueOf(System.currentTimeMillis());<NEW_LINE>PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder(newCertSubject, newCertKeyPair.getPublic());<NEW_LINE>ContentSigner csrContentSigner = new JcaContentSignerBuilder(CertificateHelper<MASK><NEW_LINE>PKCS10CertificationRequest csr = p10Builder.build(csrContentSigner);<NEW_LINE>KeyUsage keyUsage = new KeyUsage(KeyUsage.digitalSignature | KeyUsage.nonRepudiation | KeyUsage.keyEncipherment | KeyUsage.keyCertSign);<NEW_LINE>X509v3CertificateBuilder newCertBuilder = new X509v3CertificateBuilder(subject, newCertSerial, caCert.getNotBefore(), caCert.getNotAfter(), csr.getSubject(), csr.getSubjectPublicKeyInfo());<NEW_LINE>JcaX509ExtensionUtils newCertExtUtils = new JcaX509ExtensionUtils();<NEW_LINE>newCertBuilder.addExtension(Extension.basicConstraints, true, new BasicConstraints(false).toASN1Primitive());<NEW_LINE>newCertBuilder.addExtension(Extension.authorityKeyIdentifier, false, newCertExtUtils.createAuthorityKeyIdentifier(caCert));<NEW_LINE>newCertBuilder.addExtension(Extension.subjectKeyIdentifier, false, newCertExtUtils.createSubjectKeyIdentifier(csr.getSubjectPublicKeyInfo()));<NEW_LINE>newCertBuilder.addExtension(Extension.keyUsage, false, keyUsage.toASN1Primitive());<NEW_LINE>GeneralNames generalNames = CertificateHelper.extractGeneralNames(subjectAltNames);<NEW_LINE>if (generalNames != null)<NEW_LINE>newCertBuilder.addExtension(Extension.subjectAlternativeName, false, generalNames);<NEW_LINE>X509CertificateHolder newCertHolder = newCertBuilder.build(csrContentSigner);<NEW_LINE>X509Certificate newCert = new JcaX509CertificateConverter().setProvider(new BouncyCastleProvider()).getCertificate(newCertHolder);<NEW_LINE>newCert.verify(caCert.getPublicKey(), "BC");<NEW_LINE>return newCert;<NEW_LINE>} | .SIGNATURE_ALGO).build(pk); |
1,215,278 | public static StatementResourceHolder populateHolder(AgentInstanceContext agentInstanceContext, StatementAgentInstanceFactoryResult startResult) {<NEW_LINE>StatementResourceHolder holder = new StatementResourceHolder(agentInstanceContext, startResult.getStopCallback(), startResult.getFinalView(), startResult.getOptionalAggegationService(), startResult.getPriorStrategies(), startResult.getPreviousGetterStrategies(), startResult.getRowRecogPreviousStrategy());<NEW_LINE>holder.setSubselectStrategies(startResult.getSubselectStrategies());<NEW_LINE>holder.setTableAccessStrategies(startResult.getTableAccessStrategies());<NEW_LINE>if (startResult instanceof StatementAgentInstanceFactorySelectResult) {<NEW_LINE>StatementAgentInstanceFactorySelectResult selectResult = (StatementAgentInstanceFactorySelectResult) startResult;<NEW_LINE>holder.<MASK><NEW_LINE>holder.setEventStreamViewables(selectResult.getEventStreamViewables());<NEW_LINE>holder.setPatternRoots(selectResult.getPatternRoots());<NEW_LINE>holder.setAggregationService(selectResult.getOptionalAggegationService());<NEW_LINE>holder.setJoinSetComposer(selectResult.getJoinSetComposer());<NEW_LINE>} else if (startResult instanceof StatementAgentInstanceFactoryCreateContextResult) {<NEW_LINE>StatementAgentInstanceFactoryCreateContextResult createResult = (StatementAgentInstanceFactoryCreateContextResult) startResult;<NEW_LINE>holder.setContextManagerRealization(createResult.getContextManagerRealization());<NEW_LINE>} else if (startResult instanceof StatementAgentInstanceFactoryCreateNWResult) {<NEW_LINE>StatementAgentInstanceFactoryCreateNWResult createResult = (StatementAgentInstanceFactoryCreateNWResult) startResult;<NEW_LINE>holder.setTopViewables(new Viewable[] { createResult.getTopView() });<NEW_LINE>holder.setNamedWindowInstance(createResult.getNamedWindowInstance());<NEW_LINE>} else if (startResult instanceof StatementAgentInstanceFactoryCreateTableResult) {<NEW_LINE>StatementAgentInstanceFactoryCreateTableResult createResult = (StatementAgentInstanceFactoryCreateTableResult) startResult;<NEW_LINE>holder.setTopViewables(new Viewable[] { createResult.getFinalView() });<NEW_LINE>holder.setTableInstance(createResult.getTableInstance());<NEW_LINE>} else if (startResult instanceof StatementAgentInstanceFactoryOnTriggerResult) {<NEW_LINE>StatementAgentInstanceFactoryOnTriggerResult onResult = (StatementAgentInstanceFactoryOnTriggerResult) startResult;<NEW_LINE>if (onResult.getOptPatternRoot() != null) {<NEW_LINE>holder.setPatternRoots(new EvalRootState[] { onResult.getOptPatternRoot() });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return holder;<NEW_LINE>} | setTopViewables(selectResult.getTopViews()); |
416,875 | protected CompletableFuture<Boolean> addAsync(String requestQueueName, RemoteServiceRequest request) {<NEW_LINE>ScheduledParameters params = (ScheduledParameters) <MASK><NEW_LINE>params.setRequestId(request.getId());<NEW_LINE>long expireTime = 0;<NEW_LINE>if (params.getTtl() > 0) {<NEW_LINE>expireTime = System.currentTimeMillis() + params.getTtl();<NEW_LINE>}<NEW_LINE>RFuture<Boolean> f = // check if executor service not in shutdown state<NEW_LINE>commandExecutor.// check if executor service not in shutdown state<NEW_LINE>evalWriteNoRetryAsync(// check if executor service not in shutdown state<NEW_LINE>name, // check if executor service not in shutdown state<NEW_LINE>LongCodec.INSTANCE, // check if executor service not in shutdown state<NEW_LINE>RedisCommands.EVAL_BOOLEAN, // if new task added to queue head then publish its startTime<NEW_LINE>"if redis.call('exists', KEYS[2]) == 0 then " + "local retryInterval = redis.call('get', KEYS[6]); " + "if retryInterval ~= false then " + "local time = tonumber(ARGV[1]) + tonumber(retryInterval);" + "redis.call('zadd', KEYS[3], time, 'ff' .. ARGV[2]);" + "elseif tonumber(ARGV[4]) > 0 then " + "redis.call('set', KEYS[6], ARGV[4]);" + "local time = tonumber(ARGV[1]) + tonumber(ARGV[4]);" + "redis.call('zadd', KEYS[3], time, 'ff' .. ARGV[2]);" + "end; " + "if tonumber(ARGV[5]) > 0 then " + "redis.call('zadd', KEYS[7], ARGV[5], ARGV[2]);" + "end; " + "redis.call('zadd', KEYS[3], ARGV[1], ARGV[2]);" + "redis.call('hset', KEYS[5], ARGV[2], ARGV[3]);" + "redis.call('incr', KEYS[1]);" + "local v = redis.call('zrange', KEYS[3], 0, 0); " + // to all scheduler workers<NEW_LINE>"if v[1] == ARGV[2] then " + "redis.call('publish', KEYS[4], ARGV[1]); " + "end " + "return 1;" + "end;" + "return 0;", Arrays.asList(tasksCounterName, statusName, schedulerQueueName, schedulerChannelName, tasksName, tasksRetryIntervalName, tasksExpirationTimeName), params.getStartTime(), request.getId(), encode(request), tasksRetryInterval, expireTime);<NEW_LINE>return f.toCompletableFuture();<NEW_LINE>} | request.getArgs()[0]; |
1,759,638 | public void onEnum(final Token fieldToken, final DirectBuffer buffer, final int bufferIndex, final List<Token> tokens, final int fromIndex, final int toIndex, final int actingVersion) {<NEW_LINE>final Token typeToken = tokens.get(fromIndex + 1);<NEW_LINE>final long encodedValue = readEncodingAsLong(buffer, bufferIndex, typeToken, fieldToken, actingVersion);<NEW_LINE>String value = null;<NEW_LINE>if (fieldToken.isConstantEncoding()) {<NEW_LINE>final String refValue = fieldToken.encoding()<MASK><NEW_LINE>final int indexOfDot = refValue.indexOf('.');<NEW_LINE>value = -1 == indexOfDot ? refValue : refValue.substring(indexOfDot + 1);<NEW_LINE>} else {<NEW_LINE>for (int i = fromIndex + 1; i < toIndex; i++) {<NEW_LINE>if (encodedValue == tokens.get(i).encoding().constValue().longValue()) {<NEW_LINE>value = tokens.get(i).name();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>property(determineName(0, fieldToken, tokens, fromIndex));<NEW_LINE>doubleQuote();<NEW_LINE>output.append(value);<NEW_LINE>doubleQuote();<NEW_LINE>next();<NEW_LINE>} | .constValue().toString(); |
550,310 | private void startSwarmExecContainer(Task task, String[] command, String containerId) throws DockerException, InterruptedException {<NEW_LINE>String taskId = task.id();<NEW_LINE>List<String> parsedCmd = new ArrayList<>();<NEW_LINE>String[] splittedCmd = (command[2].replace("notify 'Zalenium'", "notify, Zalenium")).split(",");<NEW_LINE>List<String> binds = new ArrayList<>();<NEW_LINE>binds.add("/var/run/docker.sock:/var/run/docker.sock");<NEW_LINE>HostConfig.Builder hostConfigBuilder = HostConfig.builder().autoRemove(true).appendBinds(binds);<NEW_LINE>HostConfig hostConfig = hostConfigBuilder.build();<NEW_LINE>parsedCmd.add("task-exec");<NEW_LINE>parsedCmd.add(taskId);<NEW_LINE>parsedCmd.addAll(Arrays.asList(splittedCmd));<NEW_LINE>logger.debug("Executing command: {} - on Container: {}", Arrays.toString(command), containerId);<NEW_LINE>ContainerConfig containerConfig = ContainerConfig.builder().image(SWARM_EXEC_IMAGE).hostConfig(hostConfig).<MASK><NEW_LINE>SwarmUtilities.startContainer(containerConfig);<NEW_LINE>} | cmd(parsedCmd).build(); |
1,425,031 | public CreateChannelBanResult createChannelBan(CreateChannelBanRequest createChannelBanRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createChannelBanRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateChannelBanRequest> request = null;<NEW_LINE>Response<CreateChannelBanResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateChannelBanRequestMarshaller().marshall(createChannelBanRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<CreateChannelBanResult, JsonUnmarshallerContext> unmarshaller = new CreateChannelBanResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<CreateChannelBanResult> responseHandler = <MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | new JsonResponseHandler<CreateChannelBanResult>(unmarshaller); |
46 | public static void main(String[] args) throws Exception {<NEW_LINE>HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();<NEW_LINE>JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();<NEW_LINE>Discovery discovery = new Discovery.Builder(httpTransport, jsonFactory, null).build();<NEW_LINE>RestDescription api = discovery.apis().getRest("ml", "v1").execute();<NEW_LINE>RestMethod method = api.getResources().get("projects").<MASK><NEW_LINE>JsonSchema param = new JsonSchema();<NEW_LINE>String projectId = "YOUR_PROJECT_ID";<NEW_LINE>// You should have already deployed a model and a version.<NEW_LINE>// For reference, see https://cloud.google.com/ml-engine/docs/deploying-models.<NEW_LINE>String modelId = "YOUR_MODEL_ID";<NEW_LINE>String versionId = "YOUR_VERSION_ID";<NEW_LINE>param.set("name", String.format("projects/%s/models/%s/versions/%s", projectId, modelId, versionId));<NEW_LINE>GenericUrl url = new GenericUrl(UriTemplate.expand(api.getBaseUrl() + method.getPath(), param, true));<NEW_LINE>System.out.println(url);<NEW_LINE>String contentType = "application/json";<NEW_LINE>File requestBodyFile = new File("input.txt");<NEW_LINE>HttpContent content = new FileContent(contentType, requestBodyFile);<NEW_LINE>System.out.println(content.getLength());<NEW_LINE>List<String> scopes = new ArrayList<>();<NEW_LINE>scopes.add("https://www.googleapis.com/auth/cloud-platform");<NEW_LINE>GoogleCredentials credential = GoogleCredentials.getApplicationDefault().createScoped(scopes);<NEW_LINE>HttpRequestFactory requestFactory = httpTransport.createRequestFactory(new HttpCredentialsAdapter(credential));<NEW_LINE>HttpRequest request = requestFactory.buildRequest(method.getHttpMethod(), url, content);<NEW_LINE>String response = request.execute().parseAsString();<NEW_LINE>System.out.println(response);<NEW_LINE>} | getMethods().get("predict"); |
280,773 | public boolean requestArmMode(PowermaxArmMode armMode, String pinCode) {<NEW_LINE>logger.debug("requestArmMode(): armMode = {}", armMode.getShortName());<NEW_LINE>boolean done = false;<NEW_LINE>if (!armMode.isAllowedCommand()) {<NEW_LINE>logger.debug(<MASK><NEW_LINE>} else if (pinCode.length() != 4) {<NEW_LINE>logger.debug("Powermax alarm binding: requested arm mode {} rejected due to invalid PIN code", armMode.getShortName());<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>byte[] dynPart = new byte[3];<NEW_LINE>dynPart[0] = armMode.getCommandCode();<NEW_LINE>dynPart[1] = (byte) Integer.parseInt(pinCode.substring(0, 2), 16);<NEW_LINE>dynPart[2] = (byte) Integer.parseInt(pinCode.substring(2, 4), 16);<NEW_LINE>done = sendMessage(new PowermaxBaseMessage(PowermaxSendType.ARM, dynPart), false, 0, true);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>logger.debug("Powermax alarm binding: requested arm mode {} rejected due to invalid PIN code", armMode.getShortName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return done;<NEW_LINE>} | "Powermax alarm binding: requested arm mode {} rejected", armMode.getShortName()); |
257,002 | protected void internalTransform(Body b, String phaseName, Map<String, String> options) {<NEW_LINE>if (b == null) {<NEW_LINE>throw new NullPointerException();<NEW_LINE>}<NEW_LINE>final Date start;<NEW_LINE>if (Options.v().verbose()) {<NEW_LINE>start = new Date();<NEW_LINE>logger.debug("[TypeAssigner] typing system started on " + start);<NEW_LINE>} else {<NEW_LINE>start = null;<NEW_LINE>}<NEW_LINE>final JBTROptions opt = new JBTROptions(options);<NEW_LINE>final JimpleBody jb = (JimpleBody) b;<NEW_LINE>//<NEW_LINE>// Setting this guard to true enables comparison of the original and new type assigners.<NEW_LINE>// This will be slow since type assignment will always happen twice. The actual types<NEW_LINE>// used for Jimple are determined by the use-old-type-assigner option.<NEW_LINE>//<NEW_LINE>// Each comparison is written as a separate semicolon-delimited line to the standard<NEW_LINE>// output, and the first field is always 'cmp' for use in grep. The format is:<NEW_LINE>//<NEW_LINE>// cmp;Method Name;Stmt Count;Old Inference Time (ms); New Inference Time (ms);Typing Comparison<NEW_LINE>//<NEW_LINE>// The Typing Comparison field compares the old and new typings:<NEW_LINE>// -2 = Old typing contains fewer variables (BAD!)<NEW_LINE>// -1 = Old typing is tighter (BAD!)<NEW_LINE>// 0 = Typings are equal<NEW_LINE>// 1 = New typing is tighter<NEW_LINE>// 2 = New typing contains fewer variables<NEW_LINE>// 3 = Typings are incomparable (inspect manually)<NEW_LINE>//<NEW_LINE>// In a final release this guard, and anything in the first branch, would probably be removed.<NEW_LINE>//<NEW_LINE>if (opt.compare_type_assigners()) {<NEW_LINE>compareTypeAssigners(<MASK><NEW_LINE>} else {<NEW_LINE>if (opt.use_older_type_assigner()) {<NEW_LINE>soot.jimple.toolkits.typing.TypeResolver.resolve(jb, Scene.v());<NEW_LINE>} else {<NEW_LINE>(new soot.jimple.toolkits.typing.fast.TypeResolver(jb)).inferTypes();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (Options.v().verbose()) {<NEW_LINE>Date finish = new Date();<NEW_LINE>long runtime = finish.getTime() - start.getTime();<NEW_LINE>long mins = runtime / 60000;<NEW_LINE>long secs = (runtime % 60000) / 1000;<NEW_LINE>logger.debug("[TypeAssigner] typing system ended. It took " + mins + " mins and " + secs + " secs.");<NEW_LINE>}<NEW_LINE>if (!opt.ignore_nullpointer_dereferences()) {<NEW_LINE>replaceNullType(jb);<NEW_LINE>}<NEW_LINE>if (typingFailed(jb)) {<NEW_LINE>throw new RuntimeException("type inference failed!");<NEW_LINE>}<NEW_LINE>} | jb, opt.use_older_type_assigner()); |
1,344,844 | public static int[] effectiveKernelSize(int[] kernel, int[] dilation) {<NEW_LINE>// Determine the effective kernel size, accounting for dilation<NEW_LINE>// http://deeplearning.net/software/theano/tutorial/conv_arithmetic.html#dilated-convolutions<NEW_LINE>if (kernel.length == 2) {<NEW_LINE>if (dilation[0] == 1 && dilation[1] == 1) {<NEW_LINE>return kernel;<NEW_LINE>} else {<NEW_LINE>return new int[] { kernel[0] + (kernel[0] - 1) * (dilation[0] - 1), kernel[1] + (kernel[1] - 1) * (dilation[1] - 1) };<NEW_LINE>}<NEW_LINE>} else if (kernel.length == 3) {<NEW_LINE>if (dilation[0] == 1 && dilation[1] == 1 && dilation[2] == 1) {<NEW_LINE>return kernel;<NEW_LINE>} else {<NEW_LINE>return new int[] { kernel[0] + (kernel[0] - 1) * (dilation[0] - 1), kernel[1] + (kernel[1] - 1) * (dilation[1] - 1), kernel[2] + (kernel[2] - 1) * (<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Kernel size has to be either two or three, got: " + kernel.length);<NEW_LINE>}<NEW_LINE>} | dilation[2] - 1) }; |
918,828 | private String constructLocationIdentifier(@NonNull final JsonRequestLocation location, @Nullable final BPartnerLookupAdvise bpartnerLookupAdvise) {<NEW_LINE>if (bpartnerLookupAdvise != null) {<NEW_LINE>// JsonRequestBPartnerLocationAndContact validated in its constructor that this actually works!<NEW_LINE>final String result;<NEW_LINE>switch(bpartnerLookupAdvise) {<NEW_LINE>case Code:<NEW_LINE>// nothing we can do<NEW_LINE>result = null;<NEW_LINE>break;<NEW_LINE>case ExternalId:<NEW_LINE>result = IdentifierString.PREFIX_EXTERNAL_ID + location.getExternalId().getValue();<NEW_LINE>break;<NEW_LINE>case GLN:<NEW_LINE>result = IdentifierString.PREFIX_GLN + location.getGln();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new AdempiereException("Unsupported bpartnerLookupAdvise=" + bpartnerLookupAdvise).setParameter("jsonRequestLocation", location);<NEW_LINE>}<NEW_LINE>if (result != null) {<NEW_LINE>logger.debug("jsonRequestLocation has partnerLookupAdvise={}; -> return identifierString={}", bpartnerLookupAdvise, result);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (location.getExternalId() != null) {<NEW_LINE>final String result = IdentifierString.PREFIX_EXTERNAL_ID + location.getExternalId().getValue();<NEW_LINE>logger.debug("jsonRequestLocation has partnerLookupAdvise={}, but an externalId; -> return identifierString={}", bpartnerLookupAdvise, result);<NEW_LINE>return result;<NEW_LINE>} else if (!Check.isEmpty(location.getGln(), true)) {<NEW_LINE>final String result = IdentifierString.PREFIX_GLN + location.getGln();<NEW_LINE>logger.debug("jsonRequestLocation has partnerLookupAdvise={}, but a GLN; -> return identifierString={}", bpartnerLookupAdvise, result);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>throw new InvalidEntityException(TranslatableStrings.constant("JsonRequestLocation needs either an externalId or GLN")).appendParametersToMessage(<MASK><NEW_LINE>} | ).setParameter("jsonRequestLocation", location); |
256,853 | public void renderTileEntityAt(TileQuarry quarry, double x, double y, double z, float partialTicks, int arg) {<NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("bc");<NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("quarry");<NEW_LINE>super.renderTileEntityAt(quarry, x, <MASK><NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("arm");<NEW_LINE>if (quarry.arm != null) {<NEW_LINE>if (quarry.arm.xArm != null) {<NEW_LINE>renderCuboid(quarry, quarry.arm.xArm, x, y, z, partialTicks);<NEW_LINE>}<NEW_LINE>if (quarry.arm.yArm != null) {<NEW_LINE>renderCuboid(quarry, quarry.arm.yArm, x, y, z, partialTicks);<NEW_LINE>}<NEW_LINE>if (quarry.arm.zArm != null) {<NEW_LINE>renderCuboid(quarry, quarry.arm.zArm, x, y, z, partialTicks);<NEW_LINE>}<NEW_LINE>if (quarry.arm.headEntity != null) {<NEW_LINE>renderCuboid(quarry, quarry.arm.headEntity, x, y, z, partialTicks);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>} | y, z, partialTicks, arg); |
1,266,777 | public void write(org.apache.thrift.protocol.TProtocol oprot, TActiveTraceHistogram struct) throws org.apache.thrift.TException {<NEW_LINE>struct.validate();<NEW_LINE>oprot.writeStructBegin(STRUCT_DESC);<NEW_LINE>oprot.writeFieldBegin(VERSION_FIELD_DESC);<NEW_LINE>oprot.writeI16(struct.version);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>if (struct.isSetHistogramSchemaType()) {<NEW_LINE>oprot.writeFieldBegin(HISTOGRAM_SCHEMA_TYPE_FIELD_DESC);<NEW_LINE>oprot.writeI32(struct.histogramSchemaType);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>if (struct.activeTraceCount != null) {<NEW_LINE>if (struct.isSetActiveTraceCount()) {<NEW_LINE>oprot.writeFieldBegin(ACTIVE_TRACE_COUNT_FIELD_DESC);<NEW_LINE>{<NEW_LINE>oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct<MASK><NEW_LINE>for (int _iter27 : struct.activeTraceCount) {<NEW_LINE>oprot.writeI32(_iter27);<NEW_LINE>}<NEW_LINE>oprot.writeListEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>oprot.writeFieldStop();<NEW_LINE>oprot.writeStructEnd();<NEW_LINE>} | .activeTraceCount.size())); |
1,146,327 | private DiffNodeState determineStateFromContent() {<NEW_LINE>if (getRight() == null) {<NEW_LINE>if (originalRight == null) {<NEW_LINE>return DiffNodeState.NONE;<NEW_LINE>} else if (getLeft() == null) {<NEW_LINE>return DiffNodeState.ALL;<NEW_LINE>} else {<NEW_LINE>return DiffNodeState.PARTIAL;<NEW_LINE>}<NEW_LINE>} else if (getRight() instanceof FilteredBufferedResourceNode) {<NEW_LINE>FilteredBufferedResourceNode right = (FilteredBufferedResourceNode) getRight();<NEW_LINE>try {<NEW_LINE>Shell shell = new Shell();<NEW_LINE>shell.setVisible(false);<NEW_LINE>// Content difference<NEW_LINE>try {<NEW_LINE>TextMergeViewer contentViewer = (TextMergeViewer) CompareUI.findContentViewer(new NullViewer(shell), this, shell, getCompareConfiguration());<NEW_LINE>if (contentViewer != null) {<NEW_LINE>contentViewer.setInput(this);<NEW_LINE>IMergeViewerTestAdapter testAdapter = contentViewer.getAdapter(IMergeViewerTestAdapter.class);<NEW_LINE>if (testAdapter.getChangesCount() == 0) {<NEW_LINE>return DiffNodeState.ALL;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Log.<MASK><NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>shell.dispose();<NEW_LINE>}<NEW_LINE>if (Arrays.equals(right.getContent(), right.initialContent())) {<NEW_LINE>return DiffNodeState.NONE;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.log(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return DiffNodeState.PARTIAL;<NEW_LINE>} | error("No Viewer created for " + getName()); |
1,656,636 | public List<ValidateError> validate(Map<String, String> values) {<NEW_LINE>List<ValidateError> errors = new ArrayList<>();<NEW_LINE>Validator validator;<NEW_LINE>ValidateError error;<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.REQUIRED);<NEW_LINE>error = validator.validate(values.get("functionKey"), convLabelName("Function Key"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH);<NEW_LINE>error = validator.validate(values.get("functionKey")<MASK><NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH);<NEW_LINE>error = validator.validate(values.get("description"), convLabelName("Description"), 256);<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH);<NEW_LINE>error = validator.validate(values.get("rowId"), convLabelName("Row Id"), 64);<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get("insertUser"), convLabelName("Insert User"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get("updateUser"), convLabelName("Update User"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get("deleteFlag"), convLabelName("Delete Flag"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>return errors;<NEW_LINE>} | , convLabelName("Function Key"), 64); |
475,884 | public void processView(EventBean[] newData, EventBean[] oldData, boolean isGenerateSynthetic) {<NEW_LINE>generateRemoveStreamJustOnce(isGenerateSynthetic, false);<NEW_LINE>if (newData != null) {<NEW_LINE>for (EventBean aNewData : newData) {<NEW_LINE>EventBean[] eventsPerStream = new EventBean[] { aNewData };<NEW_LINE>Object mk = processor.generateGroupKeySingle(eventsPerStream, true);<NEW_LINE>groupReps.put(mk, eventsPerStream);<NEW_LINE>if (processor.isSelectRStream() && !groupRepsOutputLastUnordRStream.containsKey(mk)) {<NEW_LINE>EventBean event = processor.generateOutputBatchedNoSortWMap(false, mk, eventsPerStream, true, isGenerateSynthetic);<NEW_LINE>if (event != null) {<NEW_LINE>groupRepsOutputLastUnordRStream.put(mk, event);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>processor.getAggregationService().applyEnter(eventsPerStream, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (oldData != null) {<NEW_LINE>for (EventBean anOldData : oldData) {<NEW_LINE>EventBean[] eventsPerStream = new EventBean[] { anOldData };<NEW_LINE>Object mk = processor.generateGroupKeySingle(eventsPerStream, true);<NEW_LINE>if (processor.isSelectRStream() && !groupRepsOutputLastUnordRStream.containsKey(mk)) {<NEW_LINE>EventBean event = processor.generateOutputBatchedNoSortWMap(false, mk, eventsPerStream, false, isGenerateSynthetic);<NEW_LINE>if (event != null) {<NEW_LINE>groupRepsOutputLastUnordRStream.put(mk, event);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>processor.getAggregationService().applyLeave(eventsPerStream, mk, processor.getExprEvaluatorContext());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | mk, processor.getExprEvaluatorContext()); |
1,178,492 | public void sendWeather(Player[] players) {<NEW_LINE>if (players == null) {<NEW_LINE>players = this.getPlayers().values().toArray(new Player[0]);<NEW_LINE>}<NEW_LINE>LevelEventPacket pk = new LevelEventPacket();<NEW_LINE>if (this.isRaining()) {<NEW_LINE>pk.evid = LevelEventPacket.EVENT_START_RAIN;<NEW_LINE>pk.data = this.rainTime;<NEW_LINE>} else {<NEW_LINE>pk.evid = LevelEventPacket.EVENT_STOP_RAIN;<NEW_LINE>}<NEW_LINE>Server.broadcastPacket(players, pk);<NEW_LINE>if (this.isThundering()) {<NEW_LINE>pk.evid = LevelEventPacket.EVENT_START_THUNDER;<NEW_LINE>pk.data = this.thunderTime;<NEW_LINE>} else {<NEW_LINE>pk.evid = LevelEventPacket.EVENT_STOP_THUNDER;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | Server.broadcastPacket(players, pk); |
1,383,551 | /* (non-Javadoc)<NEW_LINE>* @see com.ibm.wsspi.channelfw.InterChannelCallback#error(com.ibm.wsspi.channelfw.VirtualConnection, java.lang.Throwable)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void error(VirtualConnection vc, Throwable t) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())<NEW_LINE>Tr.debug(<MASK><NEW_LINE>// reset the reqState<NEW_LINE>WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);<NEW_LINE>reqState.init();<NEW_LINE>synchronized (_hout._writeReadyLockObj) {<NEW_LINE>// Make sure the ready is set to true before calling onError<NEW_LINE>_hout.set_internalReady(true);<NEW_LINE>_hout.setWriteReady(true);<NEW_LINE>reqState.setAttribute("com.ibm.ws.webcontainer.AllowWriteFromE", true);<NEW_LINE>reqState.setAttribute("com.ibm.ws.webcontainer.WriteAllowedonThisThread", true);<NEW_LINE>}<NEW_LINE>SRTServletRequestThreadData.getInstance().init(_requestDataAsyncWriteCallbackThread);<NEW_LINE>// Push the original thread's context onto the current thread, also save off the current thread's context<NEW_LINE>tcm.pushContextData();<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "WriteListener enabled: " + this._wl + " , calling user's onError : " + vc);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>synchronized (_hout) {<NEW_LINE>// An error occurred. Issue the onError call on the user's WriteListener<NEW_LINE>_wl.onError(t);<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "WriteListener enabled: " + this._wl + " , returned from user's onError : " + vc);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Tr.error(tc, "writeListener.onError.failed", new Object[] { this._wl, e.toString() });<NEW_LINE>} finally {<NEW_LINE>// Revert back to the thread's current context<NEW_LINE>tcm.popContextData();<NEW_LINE>reqState.removeAttribute("com.ibm.ws.webcontainer.AllowWriteFromE");<NEW_LINE>}<NEW_LINE>} | tc, "error callback called , WriteListener enabled: " + this._wl); |
542,201 | public HllSketch apply(final Iterable<Object> iterable) {<NEW_LINE>final HllSketch hllp = new HllSketch(logK);<NEW_LINE>if (nonNull(iterable)) {<NEW_LINE>for (final Object o : iterable) {<NEW_LINE>if (nonNull(o)) {<NEW_LINE>if (o instanceof String) {<NEW_LINE>hllp.update((String) o);<NEW_LINE>} else if (o instanceof Long) {<NEW_LINE>hllp.update<MASK><NEW_LINE>} else if (o instanceof byte[]) {<NEW_LINE>hllp.update(((byte[]) o));<NEW_LINE>} else if (o instanceof Double) {<NEW_LINE>hllp.update(((double) o));<NEW_LINE>} else if (o instanceof char[]) {<NEW_LINE>hllp.update(((char[]) o));<NEW_LINE>} else if (o instanceof long[]) {<NEW_LINE>hllp.update(((long[]) o));<NEW_LINE>} else if (o instanceof int[]) {<NEW_LINE>hllp.update(((int[]) o));<NEW_LINE>} else {<NEW_LINE>hllp.update(o.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return hllp;<NEW_LINE>} | (((long) o)); |
350,252 | public Bandwidth fromJsonCompatibleSnapshot(Map<String, Object> snapshot, Version backwardCompatibilityVersion) throws IOException {<NEW_LINE>int formatNumber = readIntValue(snapshot, "version");<NEW_LINE>Versions.check(formatNumber, v_7_0_0, v_7_0_0);<NEW_LINE>long capacity = readLongValue(snapshot, "capacity");<NEW_LINE>long initialTokens = readLongValue(snapshot, "initialTokens");<NEW_LINE>long <MASK><NEW_LINE>long refillTokens = readLongValue(snapshot, "refillTokens");<NEW_LINE>boolean refillIntervally = (boolean) snapshot.get("refillIntervally");<NEW_LINE>long timeOfFirstRefillMillis = readLongValue(snapshot, "timeOfFirstRefillMillis");<NEW_LINE>boolean useAdaptiveInitialTokens = (boolean) snapshot.get("useAdaptiveInitialTokens");<NEW_LINE>String id = (String) snapshot.get("id");<NEW_LINE>return new Bandwidth(capacity, refillPeriodNanos, refillTokens, initialTokens, refillIntervally, timeOfFirstRefillMillis, useAdaptiveInitialTokens, id);<NEW_LINE>} | refillPeriodNanos = readLongValue(snapshot, "refillPeriodNanos"); |
297,405 | private String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) {<NEW_LINE>// break infinite recursion. Return, in case a model is already processed in the current context.<NEW_LINE>String model = codegenModel.name;<NEW_LINE>if (processedModelMap.containsKey(model)) {<NEW_LINE>int count = processedModelMap.get(model);<NEW_LINE>if (count == 1) {<NEW_LINE>processedModelMap.put(model, 2);<NEW_LINE>} else if (count == 2) {<NEW_LINE>return "";<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Invalid count when constructing example: " + count);<NEW_LINE>}<NEW_LINE>} else if (codegenModel.isEnum) {<NEW_LINE>List<Map<String, String>> enumVars = (List<Map<String, String>>) codegenModel.allowableValues.get("enumVars");<NEW_LINE>return moduleName + "::" + codegenModel.classname + "::" + enumVars.get(0).get("name");<NEW_LINE>} else if (codegenModel.oneOf != null && !codegenModel.oneOf.isEmpty()) {<NEW_LINE>String subModel = (String) codegenModel.oneOf.toArray()[0];<NEW_LINE>if (modelMaps.containsKey(subModel)) {<NEW_LINE>// oneOf models<NEW_LINE>return constructExampleCode(modelMaps.get(subModel), modelMaps, processedModelMap);<NEW_LINE>} else {<NEW_LINE>// TODO oneOf primitive type not supported at the moment<NEW_LINE>LOGGER.warn("oneOf example value not supported at the moment.");<NEW_LINE>return "nil";<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>List<String> propertyExamples = new ArrayList<>();<NEW_LINE>for (CodegenProperty codegenProperty : codegenModel.requiredVars) {<NEW_LINE>propertyExamples.add(codegenProperty.name + ": " + constructExampleCode(codegenProperty, modelMaps, processedModelMap));<NEW_LINE>}<NEW_LINE>String example = moduleName + "::" + toModelName(model) + ".new";<NEW_LINE>if (!propertyExamples.isEmpty()) {<NEW_LINE>example += "({" + StringUtils.join(propertyExamples, ", ") + "})";<NEW_LINE>}<NEW_LINE>return example;<NEW_LINE>} | processedModelMap.put(model, 1); |
1,500,944 | protected void paintTabBorder(Graphics g, int index, int x, int y, int width, int height) {<NEW_LINE>Color borderColor = UIManager.getColor("NbTabControl.borderColor");<NEW_LINE>Color borderShadowColor = UIManager.getColor("NbTabControl.borderShadowColor");<NEW_LINE>g.setColor(borderColor);<NEW_LINE>if (index > 0) {<NEW_LINE>drawLine(g, x, y, x, y + height);<NEW_LINE>if (!isSelected(index)) {<NEW_LINE>g.setColor(borderShadowColor);<NEW_LINE>drawLine(g, x + 1, y + 1, x + 1, y + height - 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (index < getDataModel().size() - 1 || !isUseStretchingTabs()) {<NEW_LINE>g.setColor(borderColor);<NEW_LINE>drawLine(g, x + width, y, x + width, y + height);<NEW_LINE>if (!isSelected(index)) {<NEW_LINE>g.setColor(borderShadowColor);<NEW_LINE>drawLine(g, x + width - 1, y + 1, x + width - 1, y + height - 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>g.setColor(borderColor);<NEW_LINE>if (!isSelected(index)) {<NEW_LINE>drawLine(g, x, y + height - 1, x + width, y + height - 1);<NEW_LINE>}<NEW_LINE>drawLine(g, x, y, x + width, y);<NEW_LINE>if (getDataModel().size() == 1) {<NEW_LINE>g.setColor(UIManager.getColor("NbTabControl.editorTabBackground"));<NEW_LINE>drawLine(g, x, y + height - 1, x + <MASK><NEW_LINE>}<NEW_LINE>if (isSelected(index) && isFocused(index)) {<NEW_LINE>g.setColor(UIManager.getColor("NbTabControl.focusedTabBackground"));<NEW_LINE>drawLine(g, x + (index == 0 ? 0 : 1), y + 1, x + width - 1, y + 1);<NEW_LINE>drawLine(g, x + (index == 0 ? 0 : 1), y + 2, x + width - 1, y + 2);<NEW_LINE>}<NEW_LINE>} | width, y + height - 1); |
1,734,036 | PointLatLon resolveAsPoint(final TermNode termNode, final IBindingSet bs) {<NEW_LINE>final Literal lit = resolveAsLiteral(termNode, bs);<NEW_LINE>if (lit == null || lit.stringValue().isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final String pointAsStr = lit.stringValue();<NEW_LINE>IGeoSpatialLiteralSerializer serializer = null;<NEW_LINE>GeoSpatialDatatypeConfiguration pconfig = null;<NEW_LINE>if (lit.getDatatype() != null) {<NEW_LINE>// If we have datatype that can extract coordinates, use it to exteract<NEW_LINE>pconfig = geoSpatialConfig.getConfigurationForDatatype(lit.getDatatype());<NEW_LINE>if (pconfig.hasLat() && pconfig.hasLon()) {<NEW_LINE>serializer = pconfig.getLiteralSerializer();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (serializer == null) {<NEW_LINE>return new PointLatLon(pointAsStr);<NEW_LINE>} else {<NEW_LINE>final String[] comps = serializer.toComponents(pointAsStr);<NEW_LINE>final Double lat = Double.parseDouble(comps[pconfig.<MASK><NEW_LINE>final Double lon = Double.parseDouble(comps[pconfig.idxOfField(ServiceMapping.LONGITUDE)]);<NEW_LINE>return new PointLatLon(lat, lon);<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new GeoSpatialSearchException("Input could not be resolved as point: '" + pointAsStr + "'.");<NEW_LINE>}<NEW_LINE>} | idxOfField(ServiceMapping.LATITUDE)]); |
1,518,232 | public Dialog onCreateDialog(Bundle savedInstanceState) {<NEW_LINE>final OpeningHoursParser.BasicOpeningHourRule item = (OpeningHoursParser.BasicOpeningHourRule) getArguments().getSerializable(ITEM);<NEW_LINE>final int positionToAdd = getArguments().getInt(POSITION_TO_ADD);<NEW_LINE>AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());<NEW_LINE><MASK><NEW_LINE>Calendar inst = Calendar.getInstance();<NEW_LINE>final int first = inst.getFirstDayOfWeek();<NEW_LINE>final boolean[] dayToShow = new boolean[7];<NEW_LINE>String[] daysToShow = new String[7];<NEW_LINE>for (int i = 0; i < 7; i++) {<NEW_LINE>int d = (first + i - 1) % 7 + 1;<NEW_LINE>inst.set(Calendar.DAY_OF_WEEK, d);<NEW_LINE>CharSequence dayName = DateFormat.format("EEEE", inst);<NEW_LINE>String result = "" + Character.toUpperCase(dayName.charAt(0)) + dayName.subSequence(1, dayName.length());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>daysToShow[i] = result;<NEW_LINE>final int pos = (d + 5) % 7;<NEW_LINE>dayToShow[i] = item.getDays()[pos];<NEW_LINE>}<NEW_LINE>builder.setTitle(getResources().getString(R.string.working_days));<NEW_LINE>builder.setMultiChoiceItems(daysToShow, dayToShow, new DialogInterface.OnMultiChoiceClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which, boolean isChecked) {<NEW_LINE>dayToShow[which] = isChecked;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.setPositiveButton(createNew ? R.string.next_proceed : R.string.shared_string_save, new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>boolean[] days = item.getDays();<NEW_LINE>boolean activeDaysAvailable = false;<NEW_LINE>for (int i = 0; i < 7; i++) {<NEW_LINE>days[(first + 5 + i) % 7] = dayToShow[i];<NEW_LINE>activeDaysAvailable = activeDaysAvailable || dayToShow[i];<NEW_LINE>}<NEW_LINE>if (activeDaysAvailable) {<NEW_LINE>if (createNew) {<NEW_LINE>OpeningHoursHoursDialogFragment.createInstance(item, positionToAdd, true, 0).show(getFragmentManager(), "TimePickerDialogFragment");<NEW_LINE>} else {<NEW_LINE>((BasicEditPoiFragment) getParentFragment()).setBasicOpeningHoursRule(item, positionToAdd);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Toast.makeText(getContext(), getString(R.string.set_working_days_to_continue), Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.setNegativeButton(getActivity().getString(R.string.shared_string_cancel), null);<NEW_LINE>return builder.create();<NEW_LINE>} | final boolean createNew = positionToAdd == -1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.