text:
@implementation BZEmojiView

- (id)initWithFrame:(CGRect)frame emojis:(NSArray *)emojis
{
    self = [super initWithFrame:frame];
    if (self) {
        self.emojis = emojis;

        [self loadEmoji];

        self.clipsToBounds = YES;
    }

    return self;
}

- (void)loadEmoji
{
    @autoreleasepool {
        CGFloat emojiWidth = (CGRectGetWidth([UIScreen mainScreen].bounds))/(CGFloat)(kNumberOfColumn);

        for (int i = 0; i < kNumberOfRow; i++) {
            for (int j = 0; j < kNumberOfColumn; j++) {
                NSString *title = nil;
                int index = i*kNumberOfColumn + j;
                if (index < [self.emojis count]) {
                    title = [self.emojis objectAtIndex:index];

                    UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
                    button.backgroundColor = [UIColor clearColor];
                    button.frame = CGRectMake(j*emojiWidth, i*kEmojiHeight, emojiWidth, kEmojiHeight);
                    button.titleLabel.font = [UIFont fontWithName:@"AppleColorEmoji" size:29.0];
                    [self addSubview:button];
                    [button addTarget:self action:@selector(emojiSelected:) forControlEvents:UIControlEventTouchUpInside];

                    [button setTitle:title forState:UIControlStateNormal];
                    button.tag = kEmojiButtonBaseTag + index;
                }
            }
        }

    }
}

- (void)emojiSelected:(id)sender
{
    UIButton *button = (UIButton *)sender;
    NSInteger index = button.tag - kEmojiButtonBaseTag;
    if (index < [self.emojis count]) {
        NSString *emoji = [self.emojis objectAtIndex:index];
        if (_delegate && [_delegate respondsToSelector:@selector(emojiView:didSelected:)]) {
            [_delegate emojiView:self didSelected:emoji];
        }
    }
}

@end


text:
internal class LogMessages
{
    public string Debug { get; internal set; }
    public object Error { get; internal set; }
    public string Info { get; internal set; }
    public string Warn { get; internal set; }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef _ARROWVISUAL_HH_
#define _ARROWVISUAL_HH_

#include <string>
#include "gazebo/rendering/Visual.hh"
#include "gazebo/util/system.hh"

namespace gazebo
{
  namespace rendering
  {
    /// \addtogroup gazebo_rendering Rendering
    /// \{

    /// \class ArrowVisual ArrowVisual.hh rendering/rendering.hh
    /// \brief Basic arrow visualization
    class GAZEBO_VISIBLE ArrowVisual : public Visual
    {
      /// \brief Constructor
      /// \param[in] _name Name of the arrow visual
      /// \param[in] _vis Pointer to the parent visual
      public: ArrowVisual(const std::string &_name, VisualPtr _vis);

      /// \brief Destructor
      public: virtual ~ArrowVisual();

      /// \brief Load the visual with default parameters
      public: virtual void Load();

      /// \brief Show the rotation of the visual
      public: void ShowRotation();
    };
    /// \}
  }
}
#endif


text:
require 'helper'

describe Esendex::Accounts do
  let(:credentials) { dummy_credentials }
  subject { Esendex::Accounts.new(credentials) }

  describe '#each' do
    let(:data) { mock }
    let(:data_list) { [mock, mock] }
    let(:accounts) { stub(accounts: data_list) }
    let(:account_list) { [mock, mock] }

    before {
      Esendex::Client
        .expects(:get)
        .with(credentials, 'v1.0/accounts')
        .yields(200, data)
        .returns(account_list)

      Esendex::Responses::Accounts
        .expects(:deserialise)
        .with(data)
        .returns(accounts)

      accounts
        .expects(:accounts)
        .returns(data_list)

      data_list.zip(account_list).each do |d, a|
        Esendex::Account.expects(:new).with(credentials, d).returns(a)
      end
    }

    it 'retrieves all accounts' do
      returned_accounts = []
      subject.each do |account|
        returned_accounts << account
      end

      returned_accounts.must_equal account_list
    end
  end

  describe '#get' do
    let(:id)       { SecureRandom.uuid }
    let(:data)     { mock }
    let(:response) { mock }
    let(:account)  { mock }

    before {
      Esendex::Client
        .expects(:get)
        .with(credentials, "v1.0/accounts/#{id}")
        .yields(200, data)
        .returns(account)

      Esendex::Responses::Account
        .expects(:deserialise)
        .with(data)
        .returns(response)

      Esendex::Account
        .expects(:new)
        .with(credentials, response)
        .returns(account)
    }

    it 'retrieves the specified account' do
      subject.get(id).must_equal account
    end
  end
end


text:
<?php

namespace Nodes\Backend\Models\User\Token;

use Nodes\Database\Eloquent\Model;

/**
 * Class Token.
 */
class Token extends Model
{
    /**
     * Database table.
     *
     * @var string
     */
    protected $table = 'backend_user_tokens';

    /**
     * Fillable columns.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'token',
        'expire',
    ];

    /*
    |-----------------------------------------------------------
    | Relations
    |-----------------------------------------------------------
    */

    /**
     * Token belongs to user.
     *
     * @author Morten Rugaard <moru@nodes.dk>
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo(\Nodes\Backend\Models\User\User::class, 'user_id');
    }
}


text:
#include "tensorflow/core/lib/io/record_reader.h"

#include <limits.h>

#include "tensorflow/core/lib/core/coding.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/hash/crc32c.h"
#include "tensorflow/core/lib/io/buffered_inputstream.h"
#include "tensorflow/core/lib/io/compression.h"
#include "tensorflow/core/lib/io/random_inputstream.h"
#include "tensorflow/core/platform/env.h"

namespace tensorflow {
namespace io {

RecordReaderOptions RecordReaderOptions::CreateRecordReaderOptions(
    const string& compression_type) {
  RecordReaderOptions options;
  if (compression_type == "ZLIB") {
    options.compression_type = io::RecordReaderOptions::ZLIB_COMPRESSION;
#if defined(IS_SLIM_BUILD)
    LOG(ERROR) << "Compression is not supported but compression_type is set."
               << " No compression will be used.";
#else
    options.zlib_options = io::ZlibCompressionOptions::DEFAULT();
#endif  // IS_SLIM_BUILD
  } else if (compression_type == compression::kGzip) {
    options.compression_type = io::RecordReaderOptions::ZLIB_COMPRESSION;
#if defined(IS_SLIM_BUILD)
    LOG(ERROR) << "Compression is not supported but compression_type is set."
               << " No compression will be used.";
#else
    options.zlib_options = io::ZlibCompressionOptions::GZIP();
#endif  // IS_SLIM_BUILD
  } else if (compression_type != compression::kNone) {
    LOG(ERROR) << "Unsupported compression_type:" << compression_type
               << ". No compression will be used.";
  }
  return options;
}

RecordReader::RecordReader(RandomAccessFile* file,
                           const RecordReaderOptions& options)
    : src_(file), options_(options) {
  if (options.buffer_size > 0) {
    input_stream_.reset(new BufferedInputStream(file, options.buffer_size));
  } else {
    input_stream_.reset(new RandomAccessInputStream(file));
  }
  if (options.compression_type == RecordReaderOptions::ZLIB_COMPRESSION) {
// We don't have zlib available on all embedded platforms, so fail.
#if defined(IS_SLIM_BUILD)
    LOG(FATAL) << "Zlib compression is unsupported on mobile platforms.";
#else   // IS_SLIM_BUILD
    zlib_input_stream_.reset(new ZlibInputStream(
        input_stream_.get(), options.zlib_options.input_buffer_size,
        options.zlib_options.output_buffer_size, options.zlib_options));
#endif  // IS_SLIM_BUILD
  } else if (options.compression_type == RecordReaderOptions::NONE) {
    // Nothing to do.
  } else {
    LOG(FATAL) << "Unspecified compression type :" << options.compression_type;
  }
}

// Read n+4 bytes from file, verify that checksum of first n bytes is
// stored in the last 4 bytes and store the first n bytes in *result.
// May use *storage as backing store.
Status RecordReader::ReadChecksummed(uint64 offset, size_t n,
                                     StringPiece* result, string* storage) {
  if (n >= SIZE_MAX - sizeof(uint32)) {
    return errors::DataLoss("record size too large");
  }

  const size_t expected = n + sizeof(uint32);
  storage->resize(expected);

#if !defined(IS_SLIM_BUILD)
  if (zlib_input_stream_) {
    // If we have a zlib compressed buffer, we assume that the
    // file is being read sequentially, and we use the underlying
    // implementation to read the data.
    //
    // No checks are done to validate that the file is being read
    // sequentially.  At some point the zlib input buffer may support
    // seeking, possibly inefficiently.
    TF_RETURN_IF_ERROR(zlib_input_stream_->ReadNBytes(expected, storage));

    if (storage->size() != expected) {
      if (storage->empty()) {
        return errors::OutOfRange("eof");
      } else {
        return errors::DataLoss("truncated record at ", offset);
      }
    }

    uint32 masked_crc = core::DecodeFixed32(storage->data() + n);
    if (crc32c::Unmask(masked_crc) != crc32c::Value(storage->data(), n)) {
      return errors::DataLoss("corrupted record at ", offset);
    }
    *result = StringPiece(storage->data(), n);
  } else {
#endif  // IS_SLIM_BUILD
    if (options_.buffer_size > 0) {
      // If we have a buffer, we assume that the file is being read
      // sequentially, and we use the underlying implementation to read the
      // data.
      //
      // No checks are done to validate that the file is being read
      // sequentially.
      TF_RETURN_IF_ERROR(input_stream_->ReadNBytes(expected, storage));

      if (storage->size() != expected) {
        if (storage->empty()) {
          return errors::OutOfRange("eof");
        } else {
          return errors::DataLoss("truncated record at ", offset);
        }
      }

      const uint32 masked_crc = core::DecodeFixed32(storage->data() + n);
      if (crc32c::Unmask(masked_crc) != crc32c::Value(storage->data(), n)) {
        return errors::DataLoss("corrupted record at ", offset);
      }
      *result = StringPiece(storage->data(), n);
    } else {
      // This version supports reading from arbitrary offsets
      // since we are accessing the random access file directly.
      StringPiece data;
      TF_RETURN_IF_ERROR(src_->Read(offset, expected, &data, &(*storage)[0]));
      if (data.size() != expected) {
        if (data.empty()) {
          return errors::OutOfRange("eof");
        } else {
          return errors::DataLoss("truncated record at ", offset);
        }
      }
      const uint32 masked_crc = core::DecodeFixed32(data.data() + n);
      if (crc32c::Unmask(masked_crc) != crc32c::Value(data.data(), n)) {
        return errors::DataLoss("corrupted record at ", offset);
      }
      *result = StringPiece(data.data(), n);
    }
#if !defined(IS_SLIM_BUILD)
  }
#endif  // IS_SLIM_BUILD

  return Status::OK();
}

Status RecordReader::ReadRecord(uint64* offset, string* record) {
  static const size_t kHeaderSize = sizeof(uint64) + sizeof(uint32);
  static const size_t kFooterSize = sizeof(uint32);

  // Read header data.
  StringPiece lbuf;
  Status s = ReadChecksummed(*offset, sizeof(uint64), &lbuf, record);
  if (!s.ok()) {
    return s;
  }
  const uint64 length = core::DecodeFixed64(lbuf.data());

  // Read data
  StringPiece data;
  s = ReadChecksummed(*offset + kHeaderSize, length, &data, record);
  if (!s.ok()) {
    if (errors::IsOutOfRange(s)) {
      s = errors::DataLoss("truncated record at ", *offset);
    }
    return s;
  }

  if (record->data() != data.data()) {
    // RandomAccessFile placed the data in some other location.
    memmove(&(*record)[0], data.data(), data.size());
  }

  record->resize(data.size());

  *offset += kHeaderSize + length + kFooterSize;
  return Status::OK();
}

Status RecordReader::SkipNBytes(uint64 offset) {
#if !defined(IS_SLIM_BUILD)
  if (zlib_input_stream_) {
    TF_RETURN_IF_ERROR(zlib_input_stream_->SkipNBytes(offset));
  } else {
#endif
    if (options_.buffer_size > 0) {
      TF_RETURN_IF_ERROR(input_stream_->SkipNBytes(offset));
    }
  }
  return Status::OK();
}  // namespace io

SequentialRecordReader::SequentialRecordReader(
    RandomAccessFile* file, const RecordReaderOptions& options)
    : underlying_(file, options), offset_(0) {}

}  // namespace io
}  // namespace tensorflow


text:
from google.cloud import dlp_v2

async def sample_delete_deidentify_template():
    # Create a client
    client = dlp_v2.DlpServiceAsyncClient()

    # Initialize request argument(s)
    request = dlp_v2.DeleteDeidentifyTemplateRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_deidentify_template(request=request)

# [END dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async]


text:
function htmlescape(untrusted_string) {
    var better_string = untrusted_string.replace(/&/g, '&');
    better_string = better_string.replace(/>/g, '>');
    better_string = better_string.replace(/</g, '<');
    better_string = better_string.replace(/"/g, '"');
    better_string = better_string.replace(/'/g, ''');
    return better_string;
}


text:
package org.sleuthkit.autopsy.casemodule;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.sleuthkit.autopsy.coreutils.Version;
import org.sleuthkit.autopsy.coreutils.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
 * Provides access to the case metadata stored in the case metadata file.
 */
public final class CaseMetadata {

    private static final String FILE_EXTENSION = ".aut";
    private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss (z)");

    /*
     * Fields from schema version 1
     */
    private static final String SCHEMA_VERSION_ONE = "1.0";
    private final static String ROOT_ELEMENT_NAME = "AutopsyCase"; //NON-NLS
    private final static String SCHEMA_VERSION_ELEMENT_NAME = "SchemaVersion"; //NON-NLS
    private final static String CREATED_DATE_ELEMENT_NAME = "CreatedDate"; //NON-NLS
    private final static String AUTOPSY_VERSION_ELEMENT_NAME = "AutopsyCreatedVersion"; //NON-NLS
    private final static String CASE_ELEMENT_NAME = "Case"; //NON-NLS
    private final static String CASE_NAME_ELEMENT_NAME = "Name"; //NON-NLS
    private final static String CASE_NUMBER_ELEMENT_NAME = "Number"; //NON-NLS
    private final static String EXAMINER_ELEMENT_NAME = "Examiner"; //NON-NLS
    private final static String CASE_TYPE_ELEMENT_NAME = "CaseType"; //NON-NLS
    private final static String CASE_DATABASE_NAME_ELEMENT_NAME = "DatabaseName"; //NON-NLS
    private final static String TEXT_INDEX_NAME_ELEMENT = "TextIndexName"; //NON-NLS

    /*
     * Fields from schema version 2
     */
    private static final String SCHEMA_VERSION_TWO = "2.0";
    private final static String AUTOPSY_CREATED_BY_ELEMENT_NAME = "CreatedByAutopsyVersion"; //NON-NLS
    private final static String CASE_DB_ABSOLUTE_PATH_ELEMENT_NAME = "Database"; //NON-NLS
    private final static String TEXT_INDEX_ELEMENT = "TextIndex"; //NON-NLS

    /*
     * Fields from schema version 3
     */
    private static final String SCHEMA_VERSION_THREE = "3.0";
    private final static String CASE_DISPLAY_NAME_ELEMENT_NAME = "DisplayName"; //NON-NLS
    private final static String CASE_DB_NAME_RELATIVE_ELEMENT_NAME = "CaseDatabase"; //NON-NLS

    /*
     * Unread fields, regenerated on save.
     */
    private final static String MODIFIED_DATE_ELEMENT_NAME = "ModifiedDate"; //NON-NLS
    private final static String AUTOPSY_SAVED_BY_ELEMENT_NAME = "SavedByAutopsyVersion"; //NON-NLS

    private final static String CURRENT_SCHEMA_VERSION = SCHEMA_VERSION_THREE;

    private final Path metadataFilePath;
    private Case.CaseType caseType;
    private String caseName;
    private String caseDisplayName;
    private String caseNumber;
    private String examiner;
    private String caseDatabaseName;
    private String caseDatabasePath; // Legacy
    private String textIndexName; // Legacy
    private String createdDate;
    private String createdByVersion;

    /**
     * Gets the file extension used for case metadata files.
     *
     * @return The file extension.
     */
    public static String getFileExtension() {
        return FILE_EXTENSION;
    }

    /**
     * Constructs a CaseMetadata object for a new case. The metadata is not
     * persisted to the case metadata file until writeFile or a setX method is
     * called.
     *
     * @param caseDirectory   The case directory.
     * @param caseType        The type of case.
     * @param caseName        The immutable name of the case.
     * @param caseDisplayName The display name of the case, can be changed by a
     *                        user.
     * @param caseNumber      The case number.
     * @param examiner        The name of the case examiner.
     */
    CaseMetadata(String caseDirectory, Case.CaseType caseType, String caseName, String caseDisplayName, String caseNumber, String examiner) {
        metadataFilePath = Paths.get(caseDirectory, caseDisplayName + FILE_EXTENSION);
        this.caseType = caseType;
        this.caseName = caseName;
        this.caseDisplayName = caseDisplayName;
        this.caseNumber = caseNumber;
        this.examiner = examiner;
        caseDatabaseName = "";
        caseDatabasePath = "";
        textIndexName = "";
        createdByVersion = Version.getVersion();
        createdDate = CaseMetadata.DATE_FORMAT.format(new Date());
    }

    /**
     * Constructs a CaseMetadata object for an existing case. The metadata is
     * read from an existing case metadata file.
     *
     * @param metadataFilePath The full path to the case metadata file.
     *
     * @throws CaseMetadataException If the new case metadata file cannot be
     *                               read.
     */
    public CaseMetadata(Path metadataFilePath) throws CaseMetadataException {
        this.metadataFilePath = metadataFilePath;
        readFromFile();
    }

    /**
     * Gets the full path to the case metadata file.
     *
     * @return The path to the metadata file
     */
    Path getFilePath() {
        return metadataFilePath;
    }

    /**
     * Gets the case directory.
     *
     * @return The case directory.
     */
    public String getCaseDirectory() {
        return metadataFilePath.getParent().toString();
    }

    /**
     * Gets the case type.
     *
     * @return The case type.
     */
    public Case.CaseType getCaseType() {
        return caseType;
    }

    /**
     * Gets the unique and immutable case name.
     *
     * @return The case display name.
     */
    public String getCaseName() {
        return caseName;
    }

    /**
     * Gets the case display name.
     *
     * @return The case display name.
     */
    public String getCaseDisplayName() {
        return caseDisplayName;
    }

    /**
     * Sets the case display name.
     *
     * @param caseDisplayName A case display name.
     *
     * @throws CaseMetadataException If the operation fails.
     */
    void setCaseDisplayName(String caseDisplayName) throws CaseMetadataException {
        String oldCaseDisplayName = this.caseDisplayName;
        this.caseDisplayName = caseDisplayName;
        try {
            writeToFile();
        } catch (CaseMetadataException ex) {
            this.caseDisplayName = oldCaseDisplayName;
            throw ex;
        }
    }

    /**
     * Gets the case number.
     *
     * @return The case number, may be empty.
     */
    public String getCaseNumber() {
        return caseNumber;
    }

    /**
     * Gets the examiner.
     *
     * @return The examiner, may be empty.
     */
    public String getExaminer() {
        return examiner;
    }

    /**
     * Gets the name of the case database.
     *
     * @return The case database name, may be empty.
     */
    public String getCaseDatabaseName() {
        return caseDatabaseName;
    }

    /**
     * Sets the name of the case database.
     *
     * @param caseDatabaseName The case database name.
     *
     * @throws CaseMetadataException If the operation fails.
     */
    void setCaseDatabaseName(String caseDatabaseName) throws CaseMetadataException {
        String oldCaseDatabaseName = this.caseDatabaseName;
        this.caseDatabaseName = caseDatabaseName;
        try {
            writeToFile();
        } catch (CaseMetadataException ex) {
            this.caseDatabaseName = oldCaseDatabaseName;
            throw ex;
        }
    }

    /**
     * Gets the text index name. This is a legacy field and will be empty for
     * cases created with Autopsy 4.4.0 and above.
     *
     * @return The name of the text index for the case, may be empty.
     */
    public String getTextIndexName() {
        return textIndexName;
    }

    /**
     * Gets the date the case was created.
     *
     * @return The date this case was created, as a string.
     */
    String getCreatedDate() {
        return createdDate;
    }

    /**
     * Sets the date the case was created. Used for preserving the case creation
     * date during single-user to multi-user case conversion.
     *
     * @param createdDate The date the case was created, as a string.
     *
     * @throws CaseMetadataException If the operation fails.
     */
    void setCreatedDate(String createdDate) throws CaseMetadataException {
        String oldCreatedDate = createdDate;
        this.createdDate = createdDate;
        try {
            writeToFile();
        } catch (CaseMetadataException ex) {
            this.createdDate = oldCreatedDate;
            throw ex;
        }
    }

    /**
     * Gets the Autopsy version that created the case.
     *
     * @return A build identifier.
     */
    String getCreatedByVersion() {
        return createdByVersion;
    }

    /**
     * Sets the Autopsy version that created the case. Used for preserving this
     * metadata during single-user to multi-user case conversion.
     *
     * @param buildVersion A build version identifier.
     *
     * @throws CaseMetadataException If the operation fails.
     */
    void setCreatedByVersion(String buildVersion) throws CaseMetadataException {
        String oldCreatedByVersion = this.createdByVersion;
        this.createdByVersion = buildVersion;
        try {
            writeToFile();
        } catch (CaseMetadataException ex) {
            this.createdByVersion = oldCreatedByVersion;
            throw ex;
        }
    }

    /**
     * Writes the case metadata to the metadata file.
     *
     * @throws CaseMetadataException If there is an error writing to the case
     *                               metadata file.
     */
    private void writeToFile() throws CaseMetadataException {
        try {
            /*
             * Create the XML DOM.
             */
            Document doc = XMLUtil.createDocument();
            createXMLDOM(doc);
            doc.normalize();

            /*
             * Prepare the DOM for pretty printing to the metadata file.
             */
            Source source = new DOMSource(doc);
            StringWriter stringWriter = new StringWriter();
            Result streamResult = new StreamResult(stringWriter);
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //NON-NLS
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); //NON-NLS
            transformer.transform(source, streamResult);

            /*
             * Write the DOM to the metadata file.
             */
            try (BufferedWriter fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metadataFilePath.toFile())))) {
                fileWriter.write(stringWriter.toString());
                fileWriter.flush();
            }

        } catch (ParserConfigurationException | TransformerException | IOException ex) {
            throw new CaseMetadataException(String.format("Error writing to case metadata file %s", metadataFilePath), ex);
        }
    }

    /*
     * Creates an XML DOM from the case metadata.
     */
    private void createXMLDOM(Document doc) {
        /*
         * Create the root element and its children.
         */
        Element rootElement = doc.createElement(ROOT_ELEMENT_NAME);
        doc.appendChild(rootElement);
        createChildElement(doc, rootElement, SCHEMA_VERSION_ELEMENT_NAME, CURRENT_SCHEMA_VERSION);
        createChildElement(doc, rootElement, CREATED_DATE_ELEMENT_NAME, createdDate);
        createChildElement(doc, rootElement, MODIFIED_DATE_ELEMENT_NAME, DATE_FORMAT.format(new Date()));
        createChildElement(doc, rootElement, AUTOPSY_CREATED_BY_ELEMENT_NAME, createdByVersion);
        createChildElement(doc, rootElement, AUTOPSY_SAVED_BY_ELEMENT_NAME, Version.getVersion());
        Element caseElement = doc.createElement(CASE_ELEMENT_NAME);
        rootElement.appendChild(caseElement);

        /*
         * Create the children of the case element.
         */
        createChildElement(doc, caseElement, CASE_NAME_ELEMENT_NAME, caseName);
        createChildElement(doc, caseElement, CASE_DISPLAY_NAME_ELEMENT_NAME, caseDisplayName);
        createChildElement(doc, caseElement, CASE_NUMBER_ELEMENT_NAME, caseNumber);
        createChildElement(doc, caseElement, EXAMINER_ELEMENT_NAME, examiner);
        createChildElement(doc, caseElement, CASE_TYPE_ELEMENT_NAME, caseType.toString());
        createChildElement(doc, caseElement, CASE_DB_ABSOLUTE_PATH_ELEMENT_NAME, caseDatabasePath);
        createChildElement(doc, caseElement, CASE_DB_NAME_RELATIVE_ELEMENT_NAME, caseDatabaseName);
        createChildElement(doc, caseElement, TEXT_INDEX_ELEMENT, textIndexName);
    }

    /**
     * Creates an XML element for the case metadata XML DOM.
     *
     * @param doc            The document.
     * @param parentElement  The parent element of the element to be created.
     * @param elementName    The name of the element to be created.
     * @param elementContent The text content of the element to be created, may
     *                       be empty.
     */
    private void createChildElement(Document doc, Element parentElement, String elementName, String elementContent) {
        Element element = doc.createElement(elementName);
        element.appendChild(doc.createTextNode(elementContent));
        parentElement.appendChild(element);
    }

    /**
     * Reads the case metadata from the metadata file.
     *
     * @throws CaseMetadataException If there is an error reading from the case
     *                               metadata file.
     */
    private void readFromFile() throws CaseMetadataException {
        try {
            /*
             * Parse the file into an XML DOM and get the root element.
             */
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = builder.parse(this.getFilePath().toFile());
            doc.getDocumentElement().normalize();
            Element rootElement = doc.getDocumentElement();
            if (!rootElement.getNodeName().equals(ROOT_ELEMENT_NAME)) {
                throw new CaseMetadataException("Case metadata file corrupted");
            }

            /*
             * Get the content of the relevant children of the root element.
             */
            String schemaVersion = getElementTextContent(rootElement, SCHEMA_VERSION_ELEMENT_NAME, true);
            this.createdDate = getElementTextContent(rootElement, CREATED_DATE_ELEMENT_NAME, true);
            if (schemaVersion.equals(SCHEMA_VERSION_ONE)) {
                this.createdByVersion = getElementTextContent(rootElement, AUTOPSY_VERSION_ELEMENT_NAME, true);
            } else {
                this.createdByVersion = getElementTextContent(rootElement, AUTOPSY_CREATED_BY_ELEMENT_NAME, true);
            }

            /*
             * Get the content of the children of the case element.
             */
            NodeList caseElements = doc.getElementsByTagName(CASE_ELEMENT_NAME);
            if (caseElements.getLength() == 0) {
                throw new CaseMetadataException("Case metadata file corrupted");
            }
            Element caseElement = (Element) caseElements.item(0);
            this.caseName = getElementTextContent(caseElement, CASE_NAME_ELEMENT_NAME, true);
            if (schemaVersion.equals(SCHEMA_VERSION_ONE) || schemaVersion.equals(SCHEMA_VERSION_TWO)) {
                this.caseDisplayName = caseName;
            } else {
                this.caseDisplayName = getElementTextContent(caseElement, CASE_DISPLAY_NAME_ELEMENT_NAME, true);
            }
            this.caseNumber = getElementTextContent(caseElement, CASE_NUMBER_ELEMENT_NAME, false);
            this.examiner = getElementTextContent(caseElement, EXAMINER_ELEMENT_NAME, false);
            this.caseType = Case.CaseType.fromString(getElementTextContent(caseElement, CASE_TYPE_ELEMENT_NAME, true));
            if (null == this.caseType) {
                throw new CaseMetadataException("Case metadata file corrupted");
            }
            switch (schemaVersion) {
                case SCHEMA_VERSION_ONE:
                    this.caseDatabaseName = getElementTextContent(caseElement, CASE_DATABASE_NAME_ELEMENT_NAME, true);
                    this.textIndexName = getElementTextContent(caseElement, TEXT_INDEX_NAME_ELEMENT, true);
                    break;
                case SCHEMA_VERSION_TWO:
                    this.caseDatabaseName = getElementTextContent(caseElement, CASE_DB_ABSOLUTE_PATH_ELEMENT_NAME, true);
                    this.textIndexName = getElementTextContent(caseElement, TEXT_INDEX_ELEMENT, false);
                    break;
                default:
                    this.caseDatabaseName = getElementTextContent(caseElement, CASE_DB_NAME_RELATIVE_ELEMENT_NAME, true);
                    this.textIndexName = getElementTextContent(caseElement, TEXT_INDEX_ELEMENT, false);
                    break;
            }

            /*
             * Fix up the case database name due to a bug that for a time caused
             * the absolute paths of single-user case databases to be stored.
             * Derive the missing (absolute/relative) value from the one
             * present.
             */
            Path possibleAbsoluteCaseDbPath = Paths.get(this.caseDatabaseName);
            Path caseDirectoryPath = Paths.get(getCaseDirectory());
            if (possibleAbsoluteCaseDbPath.getNameCount() > 1) {
                this.caseDatabasePath = this.caseDatabaseName;
                this.caseDatabaseName = caseDirectoryPath.relativize(possibleAbsoluteCaseDbPath).toString();
            } else {
                this.caseDatabasePath = caseDirectoryPath.resolve(caseDatabaseName).toAbsolutePath().toString();
            }

        } catch (ParserConfigurationException | SAXException | IOException ex) {
            throw new CaseMetadataException(String.format("Error reading from case metadata file %s", metadataFilePath), ex);
        }
    }

    /**
     * Gets the text content of an XML element.
     *
     * @param parentElement     The parent element.
     * @param elementName       The element name.
     * @param contentIsRequired Whether or not the content is required.
     *
     * @return The text content, may be empty If not required.
     *
     * @throws CaseMetadataException If the element is missing or content is
     *                               required and it is empty.
     */
    private String getElementTextContent(Element parentElement, String elementName, boolean contentIsRequired) throws CaseMetadataException {
        NodeList elementsList = parentElement.getElementsByTagName(elementName);
        if (elementsList.getLength() == 0) {
            throw new CaseMetadataException(String.format("Missing %s element from case metadata file %s", elementName, metadataFilePath));
        }
        String textContent = elementsList.item(0).getTextContent();
        if (textContent.isEmpty() && contentIsRequired) {
            throw new CaseMetadataException(String.format("Empty %s element in case metadata file %s", elementName, metadataFilePath));
        }
        return textContent;
    }

    /**
     * Exception thrown by the CaseMetadata class when there is a problem
     * accessing the metadata for a case.
     */
    public final static class CaseMetadataException extends Exception {

        private static final long serialVersionUID = 1L;

        private CaseMetadataException(String message) {
            super(message);
        }

        private CaseMetadataException(String message, Throwable cause) {
            super(message, cause);
        }
    }

    /**
     * Gets the full path to the case database file if the case is a single-user
     * case.
     *
     * @return The full path to the case database file for a single-user case.
     *
     * @throws UnsupportedOperationException If called for a multi-user case.
     * @deprecated Do not use.
     */
    @Deprecated
    public String getCaseDatabasePath() throws UnsupportedOperationException {
        if (Case.CaseType.SINGLE_USER_CASE == caseType) {
            return Paths.get(getCaseDirectory(), caseDatabaseName).toString();
        } else {
            throw new UnsupportedOperationException();
        }
    }

}


text:
package wlml.ml

import breeze.linalg._
import breeze.linalg.qr.QR
import breeze.optimize._

trait Optimizer extends wlml.ml.Opts {

  // Start Gradient Descent for Sparse Types

  def gdSolver(weights: SparseVector[Double], features: CSCMatrix[Double],
    outputs: SparseVector[Double], params: Parameters, iter: Int)
  (costFunc: (CSCMatrix[Double], SparseVector[Double],SparseVector[Double], Parameters) => (Double,SparseVector[Double])): SparseVector[Double] = {

    def checkNecessity(chVal: Double, iter: Int, ps: Parameters): Boolean = {
      if (((chVal < ps.tolerance) && (iter != 0)) || (iter >= ps.maxiter)) false
      else true
    }

    def descentAmountChecker(cost: Double, pa: Parameters): Double = {
      (pa.earlierCost - cost) / pa.earlierCost
    }

    // Calculate cost

    val (cost:Double, gradient:SparseVector[Double]) = costFunc(features, outputs, weights, params)

    val checkValue = descentAmountChecker(cost, params)
    val nextWeights = weights.copy
    nextWeights :-= gradient * params.stepSize

    println(iter, cost, checkValue)

    if (checkNecessity(checkValue, iter, params)) {
      val paramsNext = params.copy(earlierCost = cost)
      gdSolver(nextWeights, features, outputs, paramsNext, iter + 1)(costFunc)
    } else weights

  }

  // End of Gradient Descent for Sparse Types

  // Start of QR Decomposition for Dense Types

  def qrSolver(features: DenseMatrix[Double], outputs: DenseVector[Double],
    params: Parameters): DenseVector[Double] = {

    val n: Int = features.cols

    val feats = DenseMatrix.vertcat(features, DenseMatrix.eye[Double](n) * params.l2_penalty)
    val outs = DenseVector.vertcat(outputs, DenseVector.zeros[Double](n))

    val QR(qValue, rValue) = qr.reduced(feats)
    inv(rValue) * (qValue.t * outs)

  }

  def lbfgsSolver(initialWeights: SparseVector[Double], features: CSCMatrix[Double], outputs: SparseVector[Double], params: Parameters)
  (costFunc: (CSCMatrix[Double], SparseVector[Double],SparseVector[Double], Parameters) => (Double,SparseVector[Double])) = {
    val obj = new DiffFunction[SparseVector[Double]] {
      override def calculate(weights: SparseVector[Double]): (Double, SparseVector[Double]) = {

        costFunc(features, outputs, weights, params)

      }
    }
    //val initWeights = SparseVector(Array.fill(features.cols)(1.0))
    new LBFGS[SparseVector[Double]](tolerance = params.tolerance).minimize(obj, initialWeights)

  }
}


text:
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/app_list/app_list_controller_impl.h"
#include "ash/app_list/app_list_model_provider.h"
#include "ash/app_list/model/app_list_item.h"
#include "ash/app_list/views/apps_grid_view.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/public/cpp/tablet_mode.h"
#include "ash/public/cpp/test/app_list_test_api.h"
#include "ash/public/cpp/test/shell_test_api.h"
#include "ash/shell.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "chrome/browser/ash/accessibility/spoken_feedback_browsertest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_client_impl.h"
#include "chrome/browser/ui/app_list/chrome_app_list_model_updater.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chrome/browser/ui/app_list/search/search_controller_impl.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
#include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "components/user_manager/user_names.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/browsertest_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/display/display.h"
#include "ui/display/manager/display_manager.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/test/event_generator.h"

namespace ash {

namespace {

void SendKeyPressWithShiftAndControl(ui::KeyboardCode key) {
  ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
      nullptr, key, true, true, false, false)));
}

class TestSearchResult : public ChromeSearchResult {
 public:
  TestSearchResult(const std::string& id, double relevance) {
    set_id(id);
    SetTitle(base::UTF8ToUTF16(id));
    SetDisplayScore(relevance);
  }

  TestSearchResult(const TestSearchResult&) = delete;
  TestSearchResult& operator=(const TestSearchResult&) = delete;

  ~TestSearchResult() override {}

  // ChromeSearchResult overrides:
  void Open(int event_flags) override {}
};

class TestSearchProvider : public app_list::SearchProvider {
 public:
  TestSearchProvider(const std::string& prefix,
                     ChromeSearchResult::DisplayType display_type,
                     ChromeSearchResult::Category category,
                     ChromeSearchResult::ResultType result_type)
      : prefix_(prefix),
        display_type_(display_type),
        category_(category),
        result_type_(result_type) {}

  TestSearchProvider(const TestSearchProvider&) = delete;
  TestSearchProvider& operator=(const TestSearchProvider&) = delete;

  ~TestSearchProvider() override {}

  // SearchProvider overrides:
  void Start(const std::u16string& query) override {
    auto create_result =
        [this](int index) -> std::unique_ptr<ChromeSearchResult> {
      const std::string id =
          base::StringPrintf("%s %d", prefix_.c_str(), index);
      double relevance = 1.0f - index / 100.0;
      auto result = std::make_unique<TestSearchResult>(id, relevance);

      result->SetDisplayType(display_type_);
      result->SetCategory(category_);
      result->SetResultType(result_type_);

      return result;
    };

    std::vector<std::unique_ptr<ChromeSearchResult>> results;
    for (size_t i = 0; i < count_ + best_match_count_; ++i) {
      std::unique_ptr<ChromeSearchResult> result = create_result(i);
      result->SetBestMatch(i < best_match_count_);
      results.push_back(std::move(result));
    }

    SwapResults(&results);
  }

  ChromeSearchResult::ResultType ResultType() const override {
    return result_type_;
  }

  void set_count(size_t count) { count_ = count; }
  void set_best_match_count(size_t count) { best_match_count_ = count; }

 private:
  std::string prefix_;
  size_t count_ = 0;
  size_t best_match_count_ = 0;
  ChromeSearchResult::DisplayType display_type_;
  ChromeSearchResult::Category category_;
  ChromeSearchResult::ResultType result_type_;
};

// Adds two test providers to `search_controller` - one for app results, and
// another one for omnibox results. Returns pointers to created providers
// through `apps_provder_ptr` and `web_provider_ptr`.
void InitializeTestSearchProviders(
    app_list::SearchController* search_controller,
    TestSearchProvider** apps_provider_ptr,
    TestSearchProvider** web_provider_ptr) {
  std::unique_ptr<TestSearchProvider> apps_provider =
      std::make_unique<TestSearchProvider>(
          "app", ChromeSearchResult::DisplayType::kList,
          ChromeSearchResult::Category::kApps,
          ChromeSearchResult::ResultType::kInstalledApp);
  *apps_provider_ptr = apps_provider.get();
  search_controller->AddProvider(std::move(apps_provider));

  std::unique_ptr<TestSearchProvider> web_provider =
      std::make_unique<TestSearchProvider>(
          "item", ChromeSearchResult::DisplayType::kList,
          ChromeSearchResult::Category::kWeb,
          ChromeSearchResult::ResultType::kOmnibox);
  *web_provider_ptr = web_provider.get();
  search_controller->AddProvider(std::move(web_provider));
}

}  // namespace

enum SpokenFeedbackAppListTestVariant { kTestAsNormalUser, kTestAsGuestUser };

class SpokenFeedbackAppListBaseTest : public LoggedInSpokenFeedbackTest {
 public:
  explicit SpokenFeedbackAppListBaseTest(
      SpokenFeedbackAppListTestVariant variant)
      : variant_(variant) {}
  ~SpokenFeedbackAppListBaseTest() override = default;

  // LoggedInSpokenFeedbackTest:
  void SetUp() override {
    // Do not run expand arrow hinting animation to avoid msan test crash.
    // (See https://crbug.com/926038)
    zero_duration_mode_ =
        std::make_unique<ui::ScopedAnimationDurationScaleMode>(
            ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);

    // Disable the app list nudge in the spoken feedback app list test.
    AppListTestApi().DisableAppListNudge(true);

    LoggedInSpokenFeedbackTest::SetUp();
  }

  void TearDown() override {
    LoggedInSpokenFeedbackTest::TearDown();
    zero_duration_mode_.reset();
  }

  void SetUpCommandLine(base::CommandLine* command_line) override {
    if (variant_ == kTestAsGuestUser) {
      command_line->AppendSwitch(switches::kGuestSession);
      command_line->AppendSwitch(::switches::kIncognito);
      command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
      command_line->AppendSwitchASCII(
          switches::kLoginUser, user_manager::GuestAccountId().GetUserEmail());
    }
  }

  void SetUpOnMainThread() override {
    LoggedInSpokenFeedbackTest::SetUpOnMainThread();
    AppListClientImpl::GetInstance()->UpdateProfile();
  }

  // Populate apps grid with |num| items.
  void PopulateApps(size_t num) {
    // Only folders or page breaks are allowed to be added from the Ash side.
    // Therefore new apps should be added through `ChromeAppListModelUpdater`.
    ::test::PopulateDummyAppListItems(num);
  }

  // Moves to the first test app in a populated list of apps.
  // Returns the index of that item.
  int MoveToFirstTestApp() {
    // Focus the shelf. This selects the launcher button.
    sm_.Call([this]() {
      EXPECT_TRUE(PerformAcceleratorAction(AcceleratorAction::FOCUS_SHELF));
    });
    sm_.ExpectSpeechPattern("Launcher");
    sm_.ExpectSpeech("Button");
    sm_.ExpectSpeech("Shelf");
    sm_.ExpectSpeech("Tool bar");

    // Activate the launcher button. This opens bubble launcher.
    sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
    sm_.ExpectSpeechPattern("Search your *");
    sm_.ExpectSpeech("Edit text");

    sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_RIGHT); });
    sm_.ExpectSpeech("Button");

    int test_item_index = 0;
    AppListItem* test_item = FindItemByName("app 0", &test_item_index);
    EXPECT_TRUE(test_item);

    // Skip over apps that were installed before the test item.
    // This selects the first app installed by the test.
    for (int i = 0; i < test_item_index; ++i) {
      sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_RIGHT); });
    }
    sm_.ExpectSpeech("app 0");
    sm_.ExpectSpeech("Button");

    return test_item_index;
  }

  AppListItem* FindItemByName(const std::string& name, int* index) {
    AppListModel* const model = AppListModelProvider::Get()->model();
    AppListItemList* item_list = model->top_level_item_list();
    for (size_t i = 0; i < item_list->item_count(); ++i) {
      if (item_list->item_at(i)->name() == name) {
        if (index)
          *index = i;
        return item_list->item_at(i);
      }
    }
    return nullptr;
  }

  void ReadWindowTitle() {
    extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait(
        browser()->profile(), extension_misc::kChromeVoxExtensionId,
        "import('/chromevox/background/"
        "command_handler_interface.js').then(module => "
        "module.CommandHandlerInterface.instance.onCommand('readCurrentTitle'))"
        ";");
  }

 private:
  const SpokenFeedbackAppListTestVariant variant_;
  std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
};

class SpokenFeedbackAppListTest
    : public SpokenFeedbackAppListBaseTest,
      public ::testing::WithParamInterface<SpokenFeedbackAppListTestVariant> {
 public:
  SpokenFeedbackAppListTest()
      : SpokenFeedbackAppListBaseTest(/*variant=*/GetParam()) {}
  ~SpokenFeedbackAppListTest() override = default;
};

INSTANTIATE_TEST_SUITE_P(TestAsNormalAndGuestUser,
                         SpokenFeedbackAppListTest,
                         ::testing::Values(kTestAsNormalUser,
                                           kTestAsGuestUser));

class NotificationSpokenFeedbackAppListTest : public SpokenFeedbackAppListTest {
 protected:
  NotificationSpokenFeedbackAppListTest() = default;
  ~NotificationSpokenFeedbackAppListTest() override = default;

  void SetUpCommandLine(base::CommandLine* command_line) override {
    SpokenFeedbackAppListTest::SetUpCommandLine(command_line);
    command_line->AppendSwitch(switches::kAshEnableTabletMode);
  }
};

INSTANTIATE_TEST_SUITE_P(TestAsNormalAndGuestUser,
                         NotificationSpokenFeedbackAppListTest,
                         ::testing::Values(kTestAsNormalUser,
                                           kTestAsGuestUser));

class SpokenFeedbackAppListSearchTest
    : public SpokenFeedbackAppListBaseTest,
      public ::testing::WithParamInterface<
          std::tuple<SpokenFeedbackAppListTestVariant, bool /*tablet_mode*/>> {
 public:
  SpokenFeedbackAppListSearchTest()
      : SpokenFeedbackAppListBaseTest(/*variant=*/std::get<0>(GetParam())),
        tablet_mode_(std::get<1>(GetParam())) {}
  ~SpokenFeedbackAppListSearchTest() override = default;

  // SpokenFeedbackAppListTest:
  void SetUpOnMainThread() override {
    SpokenFeedbackAppListBaseTest::SetUpOnMainThread();

    AppListClientImpl* app_list_client = AppListClientImpl::GetInstance();

    // Reset default search controller, so the test has better control over the
    // set of results shown in the search result UI.
    std::unique_ptr<app_list::SearchController> search_controller =
        std::make_unique<app_list::SearchControllerImpl>(
            app_list_client->GetModelUpdaterForTest(), app_list_client, nullptr,
            browser()->profile());
    // Disable ranking, which may override the explicitly set relevance scores
    // and best match status of results.
    search_controller->disable_ranking_for_test();
    InitializeTestSearchProviders(search_controller.get(), &apps_provider_,
                                  &web_provider_);
    ASSERT_TRUE(apps_provider_);
    ASSERT_TRUE(web_provider_);
    app_list_client->SetSearchControllerForTest(std::move(search_controller));

    ShellTestApi().SetTabletModeEnabledForTest(tablet_mode_);
  }

  void TearDownOnMainThread() override {
    AppListClientImpl::GetInstance()->SetSearchControllerForTest(nullptr);
    SpokenFeedbackAppListBaseTest::TearDownOnMainThread();
  }

  void ShowAppList() {
    if (tablet_mode_) {
      // Minimize the test window to transition to tablet mode home screen.
      sm_.Call([this]() { browser()->window()->Minimize(); });
    } else {
      // Focus the home button and press it to open the bubble launcher.
      sm_.Call([this]() {
        EXPECT_TRUE(PerformAcceleratorAction(AcceleratorAction::FOCUS_SHELF));
      });
      sm_.ExpectSpeechPattern("Launcher");
      sm_.ExpectSpeech("Button");
      sm_.ExpectSpeech("Shelf");
      sm_.ExpectSpeech("Tool bar");

      sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
    }
  }

 protected:
  // Whether the test runs in tablet mode.
  const bool tablet_mode_;

  TestSearchProvider* apps_provider_ = nullptr;
  TestSearchProvider* web_provider_ = nullptr;
};

// Instantiate test by user variant and tablet mode state.
INSTANTIATE_TEST_SUITE_P(TestAsNormalAndGuestUserInTabletAndClamshell,
                         SpokenFeedbackAppListSearchTest,
                         ::testing::Combine(::testing::Values(kTestAsNormalUser,
                                                              kTestAsGuestUser),
                                            ::testing::Bool()));

// Checks that when an app list item with a notification badge is focused, an
// announcement is made that the item requests your attention.
IN_PROC_BROWSER_TEST_P(NotificationSpokenFeedbackAppListTest,
                       AppListItemNotificationBadgeAnnounced) {
  PopulateApps(1);

  int test_item_index = 0;
  AppListItem* test_item = FindItemByName("app 0", &test_item_index);
  ASSERT_TRUE(test_item);
  test_item->UpdateNotificationBadgeForTesting(true);

  EnableChromeVox();

  // Focus the shelf. This selects the launcher button.
  sm_.Call([this]() {
    EXPECT_TRUE(PerformAcceleratorAction(AcceleratorAction::FOCUS_SHELF));
  });
  sm_.ExpectSpeechPattern("Launcher");
  sm_.ExpectSpeech("Button");
  sm_.ExpectSpeech("Shelf");
  sm_.ExpectSpeech("Tool bar");

  // Activate the launcher button. This opens bubble launcher.
  sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");

  // Skip over apps that were installed before the test item.
  sm_.Call([this, &test_item_index]() {
    for (int i = 0; i < test_item_index + 1; ++i)
      SendKeyPressWithSearch(ui::VKEY_RIGHT);
  });

  // Check that the announcement for items with a notification badge occurs.
  sm_.ExpectSpeech("app 0 requests your attention.");
  sm_.Replay();
}

// Checks that when a paused app list item is focused, an announcement 'Paused'
// is made.
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
                       AppListItemPausedAppAnnounced) {
  PopulateApps(1);

  int test_item_index = 0;
  AppListItem* test_item = FindItemByName("app 0", &test_item_index);
  ASSERT_TRUE(test_item);
  test_item->UpdateAppStatusForTesting(AppStatus::kPaused);

  EnableChromeVox();

  // Focus the shelf. This selects the launcher button.
  sm_.Call([this]() {
    EXPECT_TRUE(PerformAcceleratorAction(AcceleratorAction::FOCUS_SHELF));
  });
  sm_.ExpectSpeechPattern("Launcher");
  sm_.ExpectSpeech("Button");
  sm_.ExpectSpeech("Shelf");
  sm_.ExpectSpeech("Tool bar");

  // Activate the launcher button. This opens bubble launcher.
  sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");

  // Skip over apps that were installed before the test item.
  sm_.Call([this, &test_item_index]() {
    for (int i = 0; i < test_item_index + 1; ++i)
      SendKeyPressWithSearch(ui::VKEY_RIGHT);
  });

  // Check that the announcement for items with a pause badge occurs.
  sm_.ExpectSpeech("app 0");
  sm_.ExpectSpeech("Paused");
  sm_.Replay();
}

// Checks that when a blocked app list item is focused, an announcement
// 'Blocked' is made.
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
                       AppListItemBlockedAppAnnounced) {
  PopulateApps(1);

  int test_item_index = 0;
  AppListItem* test_item = FindItemByName("app 0", &test_item_index);
  ASSERT_TRUE(test_item);
  test_item->UpdateAppStatusForTesting(AppStatus::kBlocked);

  EnableChromeVox();

  // Focus the shelf. This selects the launcher button.
  sm_.Call([this]() {
    EXPECT_TRUE(PerformAcceleratorAction(AcceleratorAction::FOCUS_SHELF));
  });
  sm_.ExpectSpeechPattern("Launcher");
  sm_.ExpectSpeech("Button");
  sm_.ExpectSpeech("Shelf");
  sm_.ExpectSpeech("Tool bar");

  // Activate the launcher button. This opens bubble launcher.
  sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");

  // Skip over apps that were installed before the test item.
  sm_.Call([this, &test_item_index]() {
    for (int i = 0; i < test_item_index + 1; ++i)
      SendKeyPressWithSearch(ui::VKEY_RIGHT);
  });

  // Check that the announcement for items with a block badge occurs.
  sm_.ExpectSpeech("app 0");
  sm_.ExpectSpeech("Blocked");
  sm_.Replay();
}

// Checks that entering and exiting tablet mode with a browser window open does
// not generate an accessibility event.
IN_PROC_BROWSER_TEST_P(
    SpokenFeedbackAppListTest,
    HiddenAppListDoesNotCreateAccessibilityEventWhenTransitioningToTabletMode) {
  EnableChromeVox();

  sm_.Call([]() { ShellTestApi().SetTabletModeEnabledForTest(true); });
  sm_.ExpectNextSpeechIsNot("Launcher, all apps");
  sm_.Call([]() { ShellTestApi().SetTabletModeEnabledForTest(false); });
  sm_.ExpectNextSpeechIsNot("Launcher, all apps");
  sm_.Replay();
}

// Checks that rotating the display in tablet mode does not generate an
// accessibility event.
IN_PROC_BROWSER_TEST_P(
    SpokenFeedbackAppListTest,
    LauncherAppListScreenRotationDoesNotCreateAccessibilityEvent) {
  display::DisplayManager* display_manager = Shell::Get()->display_manager();
  const int display_id = display_manager->GetDisplayAt(0).id();
  EnableChromeVox();

  sm_.Call([]() { ShellTestApi().SetTabletModeEnabledForTest(true); });

  sm_.Call([this]() { browser()->window()->Minimize(); });
  // Set screen rotation to 90 degrees. No ChromeVox event should be created.
  sm_.Call([&, display_manager, display_id]() {
    display_manager->SetDisplayRotation(display_id, display::Display::ROTATE_90,
                                        display::Display::RotationSource::USER);
  });
  sm_.ExpectNextSpeechIsNot("Launcher, all apps");

  // Set screen rotation to 0 degrees. No ChromeVox event should be created.
  sm_.Call([&, display_manager, display_id]() {
    display_manager->SetDisplayRotation(display_id, display::Display::ROTATE_0,
                                        display::Display::RotationSource::USER);
  });
  sm_.ExpectNextSpeechIsNot("Launcher, all apps");

  sm_.Replay();
}

// TODO(https://crbug.com/1393235): Update this browser test to test recent
// apps.
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest, ClamshellLauncher) {
  PopulateApps(3);

  int test_item_index = 0;
  AppListItem* test_item = FindItemByName("app 0", &test_item_index);
  ASSERT_TRUE(test_item);

  EnableChromeVox();

  // Focus the shelf. This selects the launcher button.
  sm_.Call([this]() {
    EXPECT_TRUE(PerformAcceleratorAction(AcceleratorAction::FOCUS_SHELF));
  });
  sm_.ExpectSpeechPattern("Launcher");
  sm_.ExpectSpeech("Button");
  sm_.ExpectSpeech("Shelf");
  sm_.ExpectSpeech("Tool bar");

  // Activate the launcher button. This opens bubble launcher.
  sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");
  sm_.ExpectSpeech("Launcher, all apps");
  sm_.Call([this]() { ReadWindowTitle(); });
  sm_.ExpectSpeech("Launcher");

  sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_RIGHT); });
  sm_.ExpectSpeech("Button");

  // Skip over apps that were installed before the test item.
  // This selects the first app installed by the test.
  for (int i = 0; i < test_item_index; ++i) {
    sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_RIGHT); });
  }
  sm_.ExpectSpeech("app 0");
  sm_.ExpectSpeech("Button");

  // Move the focused item to the right. The announcement does not include a
  // page because the bubble launcher apps grid is scrollable, not paged.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_RIGHT); });

  std::string expected_text;
  sm_.ExpectSpeech(base::SStringPrintf(
      &expected_text, "Moved to row 1, column %d.", test_item_index + 2));

  sm_.Replay();
}

// Checks that app list keyboard reordering is announced.
// TODO(mmourgos): The current method of accessibility announcements for item
// reordering uses alerts, this works for spoken feedback but does not work as
// well for braille users. The preferred way to handle this is to actually
// change focus as the user navigates, and to have each object's
// accessible name describe its position. (See crbug.com/1098495)
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest, AppListReordering) {
  PopulateApps(22);
  EnableChromeVox();
  const int test_item_index = MoveToFirstTestApp();

  // The default column of app 0.
  const int original_column = test_item_index + 1;

  // The column of app 0 after rightward move.
  const int column_after_horizontal_move = original_column + 1;

  // Move the first item to the right.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_RIGHT); });
  sm_.ExpectNextSpeechIsNot("Alert");

  std::string expected_text;
  sm_.ExpectSpeech(base::SStringPrintf(&expected_text,
                                       "Moved to row 1, column %d.",
                                       column_after_horizontal_move));

  // Move the focused item down.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech(base::SStringPrintf(&expected_text,
                                       "Moved to row 2, column %d.",
                                       column_after_horizontal_move));

  // Move the focused item down.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech(base::SStringPrintf(&expected_text,
                                       "Moved to row 3, column %d.",
                                       column_after_horizontal_move));

  // Move the focused item down.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech(base::SStringPrintf(&expected_text,
                                       "Moved to row 4, column %d.",
                                       column_after_horizontal_move));

  // Move the focused item left.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_LEFT); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech(base::SStringPrintf(
      &expected_text, "Moved to row 4, column %d.", original_column));

  // Move the focused item back up.
  sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_UP); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech(base::SStringPrintf(
      &expected_text, "Moved to row 3, column %d.", original_column));

  sm_.Replay();
}

IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest, AppListFoldering) {
  // Add 3 apps and move to the first one.
  PopulateApps(3);
  EnableChromeVox();
  const int test_item_index = MoveToFirstTestApp();

  // Combine items and create a new folder.
  sm_.Call([]() { SendKeyPressWithShiftAndControl(ui::VKEY_RIGHT); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech("Folder Unnamed");
  sm_.ExpectSpeech("Expanded");
  sm_.ExpectSpeech("app 0 combined with app 1 to create new folder.");

  // Move focus to the first item in folder.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
  sm_.ExpectSpeech("app 1");
  sm_.ExpectSpeech("Button");

  // Remove the first item from the folder back to the top level app list.
  sm_.Call([]() { SendKeyPressWithShiftAndControl(ui::VKEY_LEFT); });

  sm_.ExpectSpeech("app 1");
  sm_.ExpectSpeech("Button");
  sm_.ExpectNextSpeechIsNot("Alert");

  std::string expected_text;
  sm_.ExpectSpeech(base::SStringPrintf(
      &expected_text, "Moved to row 1, column %d.", test_item_index + 1));

  sm_.Replay();
}

IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
                       CloseFolderMakesA11yAnnouncement) {
  // Add 3 apps and move to the first one.
  PopulateApps(3);
  EnableChromeVox();
  MoveToFirstTestApp();

  // Combine items and create a new folder.
  sm_.Call([]() { SendKeyPressWithShiftAndControl(ui::VKEY_RIGHT); });
  sm_.ExpectNextSpeechIsNot("Alert");
  sm_.ExpectSpeech("Folder Unnamed");
  sm_.ExpectSpeech("Expanded");
  sm_.ExpectSpeech("app 0 combined with app 1 to create new folder.");

  // Move focus to the first item in folder.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
  sm_.ExpectSpeech("app 1");
  sm_.ExpectSpeech("Button");

  // Press Escape to close the folder. ChromeVox should announce that the
  // folder has been closed.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_ESCAPE); });
  sm_.ExpectSpeech("Close folder");

  sm_.Replay();
}

IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
                       SortAppsMakesA11yAnnouncement) {
  // Add 3 apps and move to the first one.
  PopulateApps(3);
  EnableChromeVox();
  MoveToFirstTestApp();

  // The AppListTestApi's ReorderByMouseClickAtToplevelAppsGridMenu times out
  // when called with ReorderAnimationEndState::kCompleted due to the run loop
  // in WaitForReorderAnimationAndVerifyItemVisibility. So we do some of that
  // work here manually.

  // Show the context menu for the AppsGridView.
  sm_.Call([]() {
    AppsGridView* grid_view = AppListTestApi().GetTopLevelAppsGridView();
    EXPECT_TRUE(grid_view);
    grid_view->ShowContextMenu(grid_view->GetBoundsInScreen().CenterPoint(),
                               ui::MENU_SOURCE_KEYBOARD);
  });
  sm_.ExpectSpeech("menu opened");

  // Press N to activate sort by name. This will result in focus being moved
  // to a button to undo the sort just completed.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_N); });
  sm_.ExpectSpeech("Apps are sorted by name");
  sm_.ExpectSpeech("Undo sort order by name");
  sm_.ExpectSpeech("Button");

  // Press the undo button.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_SPACE); });
  sm_.ExpectSpeech("Sort undo successful");

  // Show the context menu for the AppsGridView.
  sm_.Call([]() {
    AppsGridView* grid_view = AppListTestApi().GetTopLevelAppsGridView();
    EXPECT_TRUE(grid_view);
    grid_view->ShowContextMenu(grid_view->GetBoundsInScreen().CenterPoint(),
                               ui::MENU_SOURCE_KEYBOARD);
  });
  sm_.ExpectSpeech("menu opened");

  // Press C to activate sort by color. This will result in focus being moved
  // to a button to undo the sort just completed.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_C); });
  sm_.ExpectSpeech("Apps are sorted by color");
  sm_.ExpectSpeech("Undo sort order by color");
  sm_.ExpectSpeech("Button");

  // Press the undo button.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_SPACE); });
  sm_.ExpectSpeech("Sort undo successful");

  sm_.Replay();
}

IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListSearchTest, LauncherSearch) {
  EnableChromeVox();
  ShowAppList();

  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");
  sm_.Call([this]() { ReadWindowTitle(); });
  sm_.ExpectSpeech("Launcher");

  sm_.Call([this]() {
    apps_provider_->set_best_match_count(2);
    apps_provider_->set_count(3);
    web_provider_->set_count(4);
    SendKeyPress(ui::VKEY_G);
  });

  sm_.ExpectSpeech("G");
  sm_.ExpectSpeech("app 0");
  sm_.ExpectSpeech("List item 1 of 2");
  sm_.ExpectSpeech("Best Match");
  sm_.ExpectSpeech("List box");

  // Traverse best match results;
  for (int i = 1; i < 2; ++i) {
    sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
    sm_.ExpectSpeech(base::StringPrintf("app %d", i));
    sm_.ExpectSpeech(base::StringPrintf("List item %d of 2", i + 1));
  }

  // Traverse non-best-match app results.
  for (int i = 2; i < 5; ++i) {
    sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
    sm_.ExpectSpeech(base::StringPrintf("app %d", i));
    sm_.ExpectSpeech(base::StringPrintf("List item %d of 3", (i - 2) % 3 + 1));
    if (i == 2) {
      sm_.ExpectSpeech("Apps");
      sm_.ExpectSpeech("List box");
    }
  }

  // Traverse omnibox results.
  for (int i = 0; i < 3; ++i) {
    sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
    sm_.ExpectSpeech(base::StringPrintf("item %d", i));
    sm_.ExpectSpeech(base::StringPrintf("List item %d of 3", i + 1));
    if (i == 0) {
      sm_.ExpectSpeech("Websites");
      sm_.ExpectSpeech("List box");
    }
  }

  // Cycle focus to the close button.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
  sm_.ExpectSpeech("Clear searchbox text");

  // Go back to the last result.
  sm_.Call([this]() { SendKeyPress(ui::VKEY_UP); });
  sm_.ExpectSpeech("item 2");

  // Update the query, to initiate new search.
  sm_.Call([this]() {
    apps_provider_->set_best_match_count(0);
    apps_provider_->set_count(3);
    web_provider_->set_count(2);
    SendKeyPress(ui::VKEY_A);
  });

  sm_.ExpectSpeech("A");
  sm_.ExpectSpeech("app 0");

  // Verify traversal works after result change.
  for (int i = 1; i < 3; ++i) {
    sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
    sm_.ExpectSpeech(base::StringPrintf("app %d", i));
    sm_.ExpectSpeech(base::StringPrintf("List item %d of 3", i + 1));
  }

  for (int i = 0; i < 2; ++i) {
    sm_.Call([this]() { SendKeyPress(ui::VKEY_DOWN); });
    sm_.ExpectSpeech(base::StringPrintf("item %d", i));
    sm_.ExpectSpeech(base::StringPrintf("List item %d of 2", i + 1));
    if (i == 0) {
      sm_.ExpectSpeech("Websites");
      sm_.ExpectSpeech("List box");
    }
  }

  sm_.Replay();
}

IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListSearchTest,
                       TouchExploreLauncherSearchResult) {
  EnableChromeVox();
  ShowAppList();

  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");

  sm_.Call([this]() {
    apps_provider_->set_best_match_count(2);
    apps_provider_->set_count(3);
    web_provider_->set_count(4);
    SendKeyPress(ui::VKEY_G);
  });

  sm_.ExpectSpeech("G");
  sm_.ExpectSpeech("Displaying 8 results for g");

  base::SimpleTestTickClock clock;
  clock.SetNowTicks(base::TimeTicks::Now());
  auto* clock_ptr = &clock;
  ui::SetEventTickClockForTesting(clock_ptr);

  auto* root_window = Shell::Get()->GetPrimaryRootWindow();
  ui::test::EventGenerator generator(root_window);
  auto* generator_ptr = &generator;

  // Start touch exploration, and go to the third result in the UI (expected to
  // be "app 2").
  sm_.Call([clock_ptr, generator_ptr]() {
    views::View* target_view =
        AppListTestApi().GetVisibleSearchResultView(/*index=*/2);
    ASSERT_TRUE(target_view);

    gfx::Point touch_point = target_view->GetBoundsInScreen().CenterPoint();
    ui::TouchEvent touch_press(
        ui::ET_TOUCH_PRESSED, touch_point, base::TimeTicks::Now(),
        ui::PointerDetails(ui::EventPointerType::kTouch, 0));
    generator_ptr->Dispatch(&touch_press);

    clock_ptr->Advance(base::Seconds(1));

    ui::TouchEvent touch_move(
        ui::ET_TOUCH_MOVED, touch_point, base::TimeTicks::Now(),
        ui::PointerDetails(ui::EventPointerType::kTouch, 0));
    generator_ptr->Dispatch(&touch_move);
  });

  // The result under touch pointer should be announced.
  sm_.ExpectSpeech("app 2");
  sm_.ExpectSpeech("List item 1 of 3");
  sm_.ExpectSpeech("Apps");
  sm_.Replay();
}

IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListSearchTest, VocalizeResultCount) {
  EnableChromeVox();
  ShowAppList();

  sm_.ExpectSpeechPattern("Search your *");
  sm_.ExpectSpeech("Edit text");

  sm_.Call([this]() {
    apps_provider_->set_best_match_count(2);
    apps_provider_->set_count(3);
    web_provider_->set_count(4);
    SendKeyPress(ui::VKEY_G);
  });

  sm_.ExpectSpeech("G");
  sm_.ExpectSpeech("Displaying 8 results for g");

  // Update the query, to initiate new search.
  sm_.Call([this]() {
    apps_provider_->set_best_match_count(0);
    apps_provider_->set_count(3);
    web_provider_->set_count(2);
    SendKeyPress(ui::VKEY_A);
  });

  sm_.ExpectSpeech("A");
  sm_.ExpectSpeech("Displaying 5 results for ga");

  sm_.Replay();
}

}  // namespace ash


text:
package com.morgan.server.util.stat;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;

/**
 * An enumeration describing various parameters that can be added to an image URL for a stat
 * chart.
 *
 * @author mark@mark-morgan.net (Mark Morgan)
 */
enum StatChartParam {
  ACTION("action"),
  CONTEXT("context"),
  HEIGHT("height"),
  WIDTH("width");

  private final String paramName;

  private StatChartParam(String paramName) {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(paramName));
    this.paramName = paramName;
  }

  String getParameterName() {
    return paramName;
  }
}


text:
namespace Apress.Recipes.WebApi
{
    public interface IService
    {
        string SaySomething();
    }
}


text:
package org.apache.fineract.integrationtests.common;

import java.util.ArrayList;
import java.util.List;

import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.batch.domain.BatchResponse;
import org.junit.Assert;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;

/**
 * Helper class for {@link org.apache.fineract.integrationtests.BatchApiTest}. It
 * takes care of creation of {@code BatchRequest} list and posting this list to
 * the server.
 *
 * @author Rishabh Shukla
 *
 * @see org.apache.fineract.integrationtests.BatchApiTest
 */
public class BatchHelper {

    private static final String BATCH_API_URL = "/fineract-provider/api/v1/batches?" + Utils.TENANT_IDENTIFIER;
    private static final String BATCH_API_URL_EXT = BATCH_API_URL + "&enclosingTransaction=true";

    private BatchHelper() {
        super();
    }

    /**
     * Returns a JSON String for a list of {@code BatchRequest}s
     *
     * @param batchRequests
     * @return JSON String of BatchRequest
     */
    public static String toJsonString(final List<BatchRequest> batchRequests) {
        return new Gson().toJson(batchRequests);
    }

    /**
     * Returns the converted string response into JSON.
     *
     * @param json
     * @return List<BatchResponse>
     */
    private static List<BatchResponse> fromJsonString(final String json) {
        return new Gson().fromJson(json, new TypeToken<List<BatchResponse>>() {}.getType());
    }

    /**
     * Returns a list of BatchResponse with query parameter enclosing
     * transaction set to false by posting the jsonified BatchRequest to the
     * server.
     *
     * @param requestSpec
     * @param responseSpec
     * @param jsonifiedBatchRequests
     * @return a list of BatchResponse
     */
    public static List<BatchResponse> postBatchRequestsWithoutEnclosingTransaction(final RequestSpecification requestSpec,
            final ResponseSpecification responseSpec, final String jsonifiedBatchRequests) {
        final String response = Utils.performServerPost(requestSpec, responseSpec, BATCH_API_URL, jsonifiedBatchRequests, null);
        return BatchHelper.fromJsonString(response);
    }

    /**
     * Returns a list of BatchResponse with query parameter enclosing
     * transaction set to true by posting the jsonified BatchRequest to the
     * server.
     *
     * @param requestSpec
     * @param responseSpec
     * @param jsonifiedBatchRequests
     * @return a list of BatchResponse
     */
    public static List<BatchResponse> postBatchRequestsWithEnclosingTransaction(final RequestSpecification requestSpec,
            final ResponseSpecification responseSpec, final String jsonifiedBatchRequests) {
        final String response = Utils.performServerPost(requestSpec, responseSpec, BATCH_API_URL_EXT, jsonifiedBatchRequests, null);
        return BatchHelper.fromJsonString(response);
    }

    /**
     * Returns a BatchResponse based on the given BatchRequest, by posting the
     * request to the server.
     *
     * @param BatchRequest
     * @return List<BatchResponse>
     */
    public static List<BatchResponse> postWithSingleRequest(final RequestSpecification requestSpec,
            final ResponseSpecification responseSpec, final BatchRequest br) {

        final List<BatchRequest> batchRequests = new ArrayList<>();
        batchRequests.add(br);

        final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
        final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(requestSpec, responseSpec,
                jsonifiedRequest);

        // Verifies that the response result is there
        Assert.assertNotNull(response);
        Assert.assertTrue(response.size() > 0);

        return response;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.CreateClientCommandStrategy}
     * Request as one of the request in Batch.
     *
     * @param reqId
     * @param externalId
     * @return BatchRequest
     */
    public static BatchRequest createClientRequest(final Long requestId, final String externalId) {

        final BatchRequest br = new BatchRequest();
        br.setRequestId(requestId);
        br.setRelativeUrl("clients");
        br.setMethod("POST");

        final String extId;
        if (externalId.equals("")) {
            extId = "ext" + String.valueOf((10000 * Math.random())) + String.valueOf((10000 * Math.random()));
        } else {
            extId = externalId;
        }

        final String body = "{ \"officeId\": 1, \"firstname\": \"Petra\", \"lastname\": \"Yton\"," + "\"externalId\": " + extId
                + ",  \"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en\"," + "\"active\": false, \"submittedOnDate\": \"04 March 2009\"}";

        br.setBody(body);

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy}
     * Request with given requestId and reference.
     *
     * @param reqId
     * @param clientId
     * @return BatchRequest
     */
    public static BatchRequest updateClientRequest(final Long requestId, final Long reference) {

        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("clients/$.clientId");
        br.setMethod("PUT");
        br.setReference(reference);
        br.setBody("{\"firstname\": \"TestFirstName\", \"lastname\": \"TestLastName\"}");

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy}
     * Request with given requestId and reference.
     *
     * @param requestId
     * @param reference
     * @param productId
     * @return BatchRequest
     */
    public static BatchRequest applyLoanRequest(final Long requestId, final Long reference, final Integer productId) {

        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("loans");
        br.setMethod("POST");
        br.setReference(reference);

        final String body = "{\"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en_GB\", \"clientId\": \"$.clientId\"," + "\"productId\": "
                + productId + ", \"principal\": \"10,000.00\", \"loanTermFrequency\": 12,"
                + "\"loanTermFrequencyType\": 2, \"loanType\": \"individual\", \"numberOfRepayments\": 10,"
                + "\"repaymentEvery\": 1, \"repaymentFrequencyType\": 2, \"interestRatePerPeriod\": 10,"
                + "\"amortizationType\": 1, \"interestType\": 0, \"interestCalculationPeriodType\": 1,"
                + "\"transactionProcessingStrategyId\": 1, \"expectedDisbursementDate\": \"10 Jun 2013\","
                + "\"submittedOnDate\": \"10 Jun 2013\"}";
        br.setBody(body);

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy}
     * Request with given requestId and reference.
     *
     * @param requestId
     * @param reference
     * @param productId
     * @return BatchRequest
     */
    public static BatchRequest applySavingsRequest(final Long requestId, final Long reference, final Integer productId) {

        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("savingsaccounts");
        br.setMethod("POST");
        br.setReference(reference);

        final String body = "{\"clientId\": \"$.clientId\", \"productId\": " + productId + ","
                + "\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"submittedOnDate\": \"01 March 2011\"}";
        br.setBody(body);

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy}
     * Request with given requestId and reference
     *
     * @param requestId
     * @param reference
     * @return BatchRequest
     */
    public static BatchRequest createChargeRequest(final Long requestId, final Long reference) {

        final BatchRequest br = new BatchRequest();
        br.setRequestId(requestId);
        br.setRelativeUrl("loans/$.loanId/charges");
        br.setMethod("POST");
        br.setReference(reference);

        final String body = "{\"chargeId\": \"2\", \"locale\": \"en\", \"amount\": \"100\", "
                + "\"dateFormat\": \"dd MMMM yyyy\", \"dueDate\": \"29 April 2013\"}";
        br.setBody(body);

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy}
     * Request with given requestId and reference.
     *
     * @param requestId
     * @param reference
     * @return BatchRequest
     */
    public static BatchRequest collectChargesRequest(final Long requestId, final Long reference) {

        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("loans/$.loanId/charges");
        br.setReference(reference);
        br.setMethod("GET");
        br.setBody("{ }");

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy}
     * Request with given requestId and reference.
     *
     *
     * @param requestId
     * @param reference
     * @return BatchRequest
     */
    public static BatchRequest activateClientRequest(final Long requestId, final Long reference) {

        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("clients/$.clientId?command=activate");
        br.setReference(reference);
        br.setMethod("POST");
        br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"activationDate\": \"01 March 2011\"}");

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy}
     * Request with given requestId and reference.
     *
     *
     * @param requestId
     * @param reference
     * @return BatchRequest
     */
    public static BatchRequest approveLoanRequest(final Long requestId, final Long reference) {
        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("loans/$.loanId?command=approve");
        br.setReference(reference);
        br.setMethod("POST");
        br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"approvedOnDate\": \"12 September 2013\","
                + "\"note\": \"Loan approval note\"}");

        return br;
    }

    /**
     * Creates and returns a
     * {@link org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy}
     * Request with given requestId and reference.
     *
     *
     * @param requestId
     * @param reference
     * @return BatchRequest
     */
    public static BatchRequest disburseLoanRequest(final Long requestId, final Long reference) {
        final BatchRequest br = new BatchRequest();

        br.setRequestId(requestId);
        br.setRelativeUrl("loans/$.loanId?command=disburse");
        br.setReference(reference);
        br.setMethod("POST");
        br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"actualDisbursementDate\": \"15 September 2013\"}");

        return br;
    }

    /**
     * Checks that the client with given externalId is not created on the
     * server.
     *
     * @param requestSpec
     * @param responseSpec
     * @param externalId
     */
    public static void verifyClientCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
            final String externalId) {
        System.out.println("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
        final String CLIENT_URL = "/fineract-provider/api/v1/clients?externalId=" + externalId + "&" + Utils.TENANT_IDENTIFIER;
        final Integer responseRecords = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "totalFilteredRecords");
        Assert.assertEquals("No records found with given externalId", (long) responseRecords, (long) 0);
    }
}


text:
package jp.co.flect.sendgrid.model;

import java.util.Date;
import java.util.Map;

public class Block extends AbstractModel {

	public Block(Map<String, Object> map) {
		super(map);
	}
	public String getStatus() { return doGetString("status");}
	public String getReason() { return doGetString("reason");}
	public Date getCreated() { return doGetDate("created", true);}
	public String getEmail() { return doGetString("email");}

	public static class Get extends BasicGetRequest {
	}

	public static class Delete extends AbstractRequest {

		public String getEmail() { return doGetString("email");}
		public void setEmail(String s) { doSetString("email", s);}
	}

}


text:
package com.github.pockethub.ui.issue;

import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;

import com.github.pockethub.Intents.Builder;
import com.github.pockethub.R;
import com.github.pockethub.RequestFuture;
import com.github.pockethub.core.issue.IssueFilter;
import com.github.pockethub.persistence.AccountDataManager;
import com.github.pockethub.ui.ConfirmDialogFragment;
import com.github.pockethub.ui.DialogFragment;
import com.github.pockethub.ui.MainActivity;
import com.google.inject.Inject;

/**
 * Activity to display a list of saved {@link com.github.pockethub.core.issue.IssueFilter} objects
 */
public class FiltersViewFragment extends DialogFragment implements
    OnItemLongClickListener {

    /**
     * Create intent to browse issue filters
     *
     * @return intent
     */
    public static Intent createIntent() {
        return new Builder("repo.issues.filters.VIEW").toIntent();
    }

    private static final String ARG_FILTER = "filter";

    private static final int REQUEST_DELETE = 1;

    @Inject
    private AccountDataManager cache;

    private FilterListFragment fragment;

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.issues_filter_list, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        fragment = (FilterListFragment) getChildFragmentManager().findFragmentById(android.R.id.list);
        fragment.getListView().setOnItemLongClickListener(this);
    }

    @Override
    public void onDialogResult(int requestCode, int resultCode, Bundle arguments) {
        if (requestCode == REQUEST_DELETE && resultCode == Activity.RESULT_OK) {
            IssueFilter filter = arguments.getParcelable(ARG_FILTER);
            cache.removeIssueFilter(filter, new RequestFuture<IssueFilter>() {

                @Override
                public void success(IssueFilter response) {
                    if (fragment != null)
                        fragment.refresh();
                }
            });
            return;
        }

        super.onDialogResult(requestCode, resultCode, arguments);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                Intent intent = new Intent(getActivity(), MainActivity.class);
                intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
                startActivity(intent);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    @Override
    public boolean onItemLongClick(AdapterView<?> parent, View view,
        int position, long id) {
        IssueFilter filter = (IssueFilter) parent.getItemAtPosition(position);
        Bundle args = new Bundle();
        args.putParcelable(ARG_FILTER, filter);
        ConfirmDialogFragment.show(getActivity(), REQUEST_DELETE,
            getString(R.string.confirm_bookmark_delete_title),
            getString(R.string.confirm_bookmark_delete_message), args);
        return true;
    }
}


text:
Development Guide
=============================

.. toctree::
   :titlesonly:

   Repositories <repositories>
   API Versioning Conventions <api_versioning>
   Naming Conventions <naming_conventions>
   Debugging Guide <debugging_guide>
   Logging in RackHD <log_levels>
   AMQP Message Bus Conventions <amqp_conventions>
   Messenger Design Notes <messenger_overview>
   Contributing Code Changes <contributing>


text:
<?php

/**
 * Outputs test code coverage.
 *
 * @package    symfony
 * @subpackage task
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id$
 */
class sfTestCoverageTask extends sfBaseTask
{
  /**
   * @see sfTask
   */
  protected function configure()
  {
    $this->addArguments(array(
      new sfCommandArgument('test_name', sfCommandArgument::REQUIRED, 'A test file name or a test directory'),
      new sfCommandArgument('lib_name', sfCommandArgument::REQUIRED, 'A lib file name or a lib directory for wich you want to know the coverage'),
    ));

    $this->addOptions(array(
      new sfCommandOption('detailed', null, sfCommandOption::PARAMETER_NONE, 'Output detailed information'),
    ));

    $this->namespace = 'test';
    $this->name = 'coverage';
    $this->briefDescription = 'Outputs test code coverage';

    $this->detailedDescription = <<<EOF
The [test:coverage|INFO] task outputs the code coverage
given a test file or test directory
and a lib file or lib directory for which you want code
coverage:

  [./symfony test:coverage test/unit/model lib/model|INFO]

To output the lines not covered, pass the [--detailed|INFO] option:

  [./symfony test:coverage --detailed test/unit/model lib/model|INFO]
EOF;
  }

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    require_once(sfConfig::get('sf_symfony_lib_dir').'/vendor/lime/lime.php');

    $coverage = $this->getCoverage($this->getTestHarness(), $options['detailed']);

    $testFiles = $this->getFiles(sfConfig::get('sf_root_dir').'/'.$arguments['test_name']);
    $max = count($testFiles);
    foreach ($testFiles as $i => $file)
    {
      $this->logSection('coverage', sprintf('running %s (%d/%d)', $file, $i + 1, $max));
      $coverage->process($file);
    }

    $coveredFiles = $this->getFiles(sfConfig::get('sf_root_dir').'/'.$arguments['lib_name']);
    $coverage->output($coveredFiles);
  }

  protected function getTestHarness()
  {
    $harness = new lime_harness(new lime_output_color());
    $harness->base_dir = sfConfig::get('sf_root_dir');

    return $harness;
  }

  protected function getCoverage(lime_harness $harness, $detailed = false)
  {
    $coverage = new lime_coverage($harness);
    $coverage->verbose = $detailed;
    $coverage->base_dir = sfConfig::get('sf_root_dir');

    return $coverage;
  }

  protected function getFiles($directory)
  {
    if (is_dir($directory))
    {
      return sfFinder::type('file')->name('*.php')->in($directory);
    }
    else if (file_exists($directory))
    {
      return array($directory);
    }
    else
    {
      throw new sfCommandException(sprintf('File or directory "%s" does not exist.', $directory));
    }
  }
}


text:
using namespace std;

void save(int i, std::vector<Body> *bodies) {
    std::stringstream ss;

    ss << i << ".bin";
    std::ofstream outfile (ss.str(), std::ofstream::binary);

    char block[3 * 4];
    int *triplet = (int *)█
    for (vector<Body>::iterator body = bodies->begin() ; body != bodies->end(); ++body) {
        triplet[0] = floor(body->pos.x + 0.5);
        triplet[1] =floor(body->pos.y + 0.5);
        triplet[2] = floor(body->pos.z + 0.5);
        //    cout << triplet[0] << "," << triplet[1] << "," << triplet[2] << " <- node" << endl;
        outfile.write(block, 3 * 4);
    }
    outfile.close();
}

struct FileContent {
    int *content;
    size_t size;
};

FileContent readFile(const char *fileName) {
    streampos size;
    char * memblock;
    ifstream file (fileName, ios::in|ios::binary|ios::ate);
    if (file.is_open())
    {
        size = file.tellg();
        memblock = new char [size];
        file.seekg(0, ios::beg);
        file.read(memblock, size);
        file.close();
        FileContent result;
        result.size = size/4;
        result.content = (int *) memblock;
        return result;
    } else {
        throw "Could not open file";
    }
}

int getIterationNumberFromPositionFileName(const char *positionFileName) {
    cmatch match;
    regex pattern(".*?(\\d+)\\.bin$");
    regex_match(positionFileName, match, pattern);
    if (match.size() == 2) {
        try {
            return stoi(match[1]) + 1;
        }
        catch (...) {
            return 0;
        }
    }
    return 0;
}

int main(int argc, const char * argv[]) {
    if (argc < 2) {
        cout << "Usage: " << endl
        << "  layout++ links.bin [positions.bin]" << endl
        << "Where" << endl
        << " `links.bin` is a path to the serialized graph. See " << endl
        << "    https://github.com/anvaka/ngraph.tobinary for format description" << endl
        << "  `positoins.bin` is optional file with previously saved positions. " << endl
        << "    This file should match `links.bin` graph, otherwis bad things " << endl
        << "    will happen" << endl;
        return -1;
    }
    const char * graphFileName = argv[1];
    cout << argv[0] << endl;
    srand(42);

    cout << "Loading links from " << graphFileName << "... " << endl;
    FileContent graphFile = readFile(graphFileName);

    Layout graphLayout;
    int startFrom = 0;
    if (argc < 3) {
        graphLayout.init(graphFile.content, graphFile.size);
        cout << "Done. " << endl;
        cout << "Loaded " << graphLayout.getBodiesCount() << " bodies;" << endl;
    } else {
        const char * posFileName = argv[2];
        startFrom = getIterationNumberFromPositionFileName(posFileName);
        cout << "Loading positions from " << posFileName << "... ";
        FileContent positions = readFile(posFileName);
        cout << "Done." << endl;
        graphLayout.init(graphFile.content, graphFile.size, positions.content, positions.size);
        cout << "Loaded " << graphLayout.getBodiesCount() << " bodies;" << endl;
    }
    cout << "Starting layout from " << startFrom << " iteration;" << endl;

    for (int i = startFrom; i <= 10000; ++i) {
        cout << "Step " << i << endl;
        bool done = graphLayout.step();
        if (done) {
            cout << "Done!" << endl;
            break;
        }
        if (i % 5 == 0) {
            save(i, graphLayout.getBodies());
        }
    }

    delete[] graphFile.content;
}


text:
package ops

import (
	"vitess.io/vitess/go/vt/sqlparser"
	"vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext"
)

type (
	// Operator forms the tree of operators, representing the declarative query provided.
	// While planning, the operator tree starts with logical operators, and later moves to physical operators.
	// The difference between the two is that when we get to a physical operator, we have made decisions on in
	// which order to do the joins, and how to split them up across shards and keyspaces.
	// In some situation we go straight to the physical operator - when there are no options to consider,
	// we can go straight to the end result.
	Operator interface {
		Clone(inputs []Operator) Operator
		Inputs() []Operator

		// AddPredicate is used to push predicates. It pushed it as far down as is possible in the tree.
		// If we encounter a join and the predicate depends on both sides of the join, the predicate will be split into two parts,
		// where data is fetched from the LHS of the join to be used in the evaluation on the RHS
		AddPredicate(ctx *plancontext.PlanningContext, expr sqlparser.Expr) (Operator, error)

		// AddColumn tells an operator to also output an additional column specified.
		// The offset to the column is returned.
		AddColumn(ctx *plancontext.PlanningContext, expr sqlparser.Expr) (int, error)
	}

	// PhysicalOperator means that this operator is ready to be turned into a logical plan
	PhysicalOperator interface {
		Operator
		IPhysical()
	}
)


text:
<?php

namespace Hydrogen\Config\Exception;

class CacheStorageNotSupported extends \Exception
{}


text:
import type { StateParams } from '@uirouter/angularjs';
import { module } from 'angular';

import type { ApplicationStateProvider, INestedState } from '@spinnaker/core';
import { APPLICATION_STATE_PROVIDER } from '@spinnaker/core';

import { TargetGroupDetails } from './TargetGroupDetails';

export const TARGET_GROUP_STATES = 'spinnaker.amazon.loadBalancer.targetGroup.states';
module(TARGET_GROUP_STATES, [APPLICATION_STATE_PROVIDER]).config([
  'applicationStateProvider',
  (applicationStateProvider: ApplicationStateProvider) => {
    const targetGroupDetails: INestedState = {
      name: 'targetGroupDetails',
      url: '/targetGroupDetails/:provider/:accountId/:region/:vpcId/:loadBalancerName/:name',
      params: {
        vpcId: {
          value: null,
          squash: true,
        },
      },
      views: {
        'detail@../insight': {
          component: TargetGroupDetails,
          $type: 'react',
        },
      },
      resolve: {
        accountId: ['$stateParams', ($stateParams: StateParams) => $stateParams.accountId],
        targetGroup: [
          '$stateParams',
          ($stateParams: StateParams) => {
            return {
              loadBalancerName: $stateParams.loadBalancerName,
              name: $stateParams.name,
              accountId: $stateParams.accountId,
              region: $stateParams.region,
              vpcId: $stateParams.vpcId,
            };
          },
        ],
      },
      data: {
        pageTitleDetails: {
          title: 'Target Group Details',
          nameParam: 'name',
          accountParam: 'accountId',
          regionParam: 'region',
        },
      },
    };

    applicationStateProvider.addInsightDetailState(targetGroupDetails);
  },
]);