text:
using System.Collections.Generic;
using System.Linq;
using Tobasco.FileBuilder;
using Tobasco.Manager;
using Tobasco.Model.Builders.Base;
using Tobasco.Properties;
using Tobasco.Templates;

namespace Tobasco.Model.Builders
{
    public class DefaultGenericRepositoryBuilder : GenericRepositoryBuilderBase
    {
        public DefaultGenericRepositoryBuilder() : base() { }

        protected virtual string SaveMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositorySave);
            return template.GetText;
        }

        protected virtual string ListSaveMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryBulkSave);
            return template.GetText;
        }

        protected virtual string InsertMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryInsert);
            return template.GetText;
        }

        protected virtual string DeleteMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryDelete);
            return template.GetText;
        }

        protected virtual string GetByIdMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryGetById);
            return template.GetText;
        }

        protected virtual string UpdateMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryUpdate);
            return template.GetText;
        }

        protected virtual string ToAnonymousMethod()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryToAnonymous);
            return template.GetText;
        }

        protected virtual string QueryMutlipleT()
        {
            var template = new Template();
            template.SetTemplate(GenericRepositoryResources.GenericRepositoryQueryMultipleT);
            return template.GetText;
        }

        protected virtual ClassFile BuildClassFile()
        {
            var classFile = FileManager.StartNewClassFile(GetGenericRepositoryName, Classlocation.Project, Classlocation.Folder);
            classFile.Namespaces.AddRange(new[] { "System.Configuration", "System.Data.SqlClient", "Dapper", "System.Data", Interfacelocation.GetProjectLocation, "System.Linq", "System.Collections.Generic", "static Dapper.SqlMapper" });
            classFile.Namespaces.AddRange(MainInfoManager.EntityInformation.Repository.Namespaces.Select(x => x.Value).Concat(MainInfoManager.EntityInformation.GenericRepository.Namespaces.Select(x => x.Value)));
            classFile.Namespaces.Add("System.Globalization");
            classFile.OwnNamespace = MainInfoManager.EntityInformation.Repository.FileLocation.GetNamespace;
            classFile.NameExtension = "<T>";
            classFile.BaseClass = ": IGenericRepository<T> where T : EntityBase, new()";
            classFile.Constructor.Parameters.Add(new TypeWithName("connectionFactory", "IConnectionFactory"));
            classFile.Constructor.CustomImplementation.Add("ConnectionFactory = connectionFactory;");
            classFile.Properties.Add("public IConnectionFactory ConnectionFactory { get; }");
            classFile.Methods.Add(SaveMethod());
            classFile.Methods.Add(InsertMethod());
            classFile.Methods.Add(UpdateMethod());
            classFile.Methods.Add(DeleteMethod());
            classFile.Methods.Add(ListSaveMethod());
            classFile.Methods.Add(GetByIdMethod());
            classFile.Methods.Add(ToAnonymousMethod());
            classFile.Methods.Add(QueryMutlipleT());
            return classFile;
        }

        protected virtual InterfaceFile BuildInterfaceFile()
        {
            var interfaceFile = FileManager.StartNewInterfaceFile(GetInterfaceGenericRepositoryName, Interfacelocation.Project, Interfacelocation.Folder);
            interfaceFile.Namespaces.AddRange(new[] { "System.Configuration", "System.Data.SqlClient", Interfacelocation.GetProjectLocation, "System.Collections.Generic", "Dapper", "static Dapper.SqlMapper" });
            interfaceFile.Namespaces.AddRange(MainInfoManager.EntityInformation.Repository.Namespaces.Select(x => x.Value).Concat(MainInfoManager.EntityInformation.GenericRepository.Namespaces.Select(x => x.Value)));
            interfaceFile.OwnNamespace = Interfacelocation.GetNamespace;
            interfaceFile.NameExtension = "<T> where T : EntityBase, new()";
            interfaceFile.Properties.Add("IConnectionFactory ConnectionFactory { get; }");
            interfaceFile.Methods.Add("T Save(T entity);");
            interfaceFile.Methods.Add("T GetById(long id); ");
            interfaceFile.Methods.Add("IEnumerable<T> Save(IEnumerable<T> entities);");
            interfaceFile.Methods.Add("IEnumerable<T> QueryMultiple(string StoredProcedure, DynamicParameters parameters, Func<GridReader, IEnumerable<T>> readerFunc);");

            return interfaceFile;
        }

        public override IEnumerable<FileBuilder.OutputFile> Build()
        {
            return new List<FileBuilder.OutputFile> { BuildClassFile(), BuildInterfaceFile() };
        }
    }
}


text:
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/detection/bbox_util.h"
#include "paddle/fluid/operators/detection/mask_util.h"
#include "paddle/fluid/operators/gather.h"
#include "paddle/fluid/operators/math/concat_and_split.h"
#include "paddle/fluid/operators/math/math_function.h"

namespace paddle {
namespace operators {

using Tensor = framework::Tensor;
using LoDTensor = framework::LoDTensor;
const int kBoxDim = 4;

template <typename T>
void AppendMask(LoDTensor* out, int64_t offset, Tensor* to_add) {
  auto* out_data = out->data<T>();
  auto* to_add_data = to_add->data<T>();
  memcpy(out_data + offset, to_add_data, to_add->numel() * sizeof(T));
}

class GenerateMaskLabelsOp : public framework::OperatorWithKernel {
 public:
  using framework::OperatorWithKernel::OperatorWithKernel;

  void InferShape(framework::InferShapeContext* ctx) const override {
    PADDLE_ENFORCE(ctx->HasInput("ImInfo"), "Input(ImInfo) shouldn't be null.");
    PADDLE_ENFORCE(ctx->HasInput("GtClasses"),
                   "Input(GtClasses) shouldn't be null.");
    PADDLE_ENFORCE(ctx->HasInput("IsCrowd"),
                   "Input(IsCrowd) shouldn't be null.");
    PADDLE_ENFORCE(ctx->HasInput("GtSegms"),
                   "Input(GtSegms) shouldn't be null.");
    PADDLE_ENFORCE(ctx->HasInput("Rois"), "Input(Rois) shouldn't be null.");
    PADDLE_ENFORCE(ctx->HasInput("LabelsInt32"),
                   "Input(LabelsInt32) shouldn't be null.");

    PADDLE_ENFORCE(
        ctx->HasOutput("MaskRois"),
        "Output(MaskRois) of GenerateMaskLabelsOp should not be null");
    PADDLE_ENFORCE(
        ctx->HasOutput("RoiHasMaskInt32"),
        "Output(RoiHasMaskInt32) of GenerateMaskLabelsOp should not be null");
    PADDLE_ENFORCE(
        ctx->HasOutput("MaskInt32"),
        "Output(MaskInt32) of GenerateMaskLabelsOp should not be null");

    auto im_info_dims = ctx->GetInputDim("ImInfo");
    auto gt_segms_dims = ctx->GetInputDim("GtSegms");
    PADDLE_ENFORCE_EQ(im_info_dims.size(), 2,
                      "The rank of Input(ImInfo) must be 2.");
    PADDLE_ENFORCE_EQ(gt_segms_dims.size(), 2,
                      "The rank of Input(GtSegms) must be 2.");
    PADDLE_ENFORCE_EQ(gt_segms_dims[1], 2,
                      "The second dim of Input(GtSegms) must be 2.");
    int num_classes = ctx->Attrs().Get<int>("num_classes");
    int resolution = ctx->Attrs().Get<int>("resolution");

    ctx->SetOutputDim("MaskRois", {-1, 4});
    ctx->SetOutputDim("RoiHasMaskInt32", {-1, 1});
    ctx->SetOutputDim("MaskInt32", {-1, num_classes * resolution * resolution});
  }

 protected:
  framework::OpKernelType GetExpectedKernelType(
      const framework::ExecutionContext& ctx) const override {
    auto data_type = OperatorWithKernel::IndicateVarDataType(ctx, "Rois");
    return framework::OpKernelType(data_type, platform::CPUPlace());
  }
};

/*
 * Expand masks from shape (#masks, M ** 2) to (#masks, #classes * M ** 2)
 * to encode class specific mask targets.
 */
template <typename T>
static inline void ExpandMaskTarget(const platform::CPUDeviceContext& ctx,
                                    const Tensor& masks,
                                    const Tensor& mask_class_labels,
                                    const int resolution, const int num_classes,
                                    Tensor* mask_targets) {
  const uint8_t* masks_data = masks.data<uint8_t>();
  int64_t num_mask = masks.dims()[0];
  const int* mask_class_labels_data = mask_class_labels.data<int>();
  const int M = resolution * resolution;
  const int mask_dim = M * num_classes;

  int* mask_targets_data =
      mask_targets->mutable_data<int>({num_mask, mask_dim}, ctx.GetPlace());
  math::set_constant(ctx, mask_targets, -1);
  for (int64_t mask_id = 0; mask_id < num_mask; ++mask_id) {
    int cls = mask_class_labels_data[mask_id];
    int start = M * cls;
    if (cls > 0) {
      for (int i = 0; i < M; ++i) {
        mask_targets_data[mask_id * mask_dim + start + i] =
            static_cast<int>(masks_data[mask_id * M + i]);
      }
    }
  }
}

template <typename T>
std::vector<Tensor> SampleMaskForOneImage(
    const platform::CPUDeviceContext& ctx, const Tensor& im_info,
    const Tensor& gt_classes, const Tensor& is_crowd, const Tensor& gt_segms,
    const Tensor& rois, const Tensor& label_int32, const int num_classes,
    const int resolution, const framework::LoD& segm_length) {
  // Prepare the mask targets by associating one gt mask to each training roi
  // that has a fg (non-bg) class label.
  const int64_t gt_size = static_cast<int64_t>(gt_classes.dims()[0]);
  const int64_t roi_size = static_cast<int64_t>(rois.dims()[0]);
  const int* gt_classes_data = gt_classes.data<int>();
  const int* is_crowd_data = is_crowd.data<int>();
  const int* label_int32_data = label_int32.data<int>();
  PADDLE_ENFORCE_EQ(roi_size, label_int32.dims()[0]);

  std::vector<int> mask_gt_inds, fg_inds;
  std::vector<std::vector<std::vector<T>>> gt_polys;

  auto polys_num = segm_length[1];
  auto segm_lod_offset = framework::ConvertToOffsetBasedLoD(segm_length);
  auto lod1 = segm_lod_offset[1];
  auto lod2 = segm_lod_offset[2];
  const T* polys_data = gt_segms.data<T>();
  for (int64_t i = 0; i < gt_size; ++i) {
    if ((gt_classes_data[i] > 0) && (is_crowd_data[i] == 0)) {
      mask_gt_inds.emplace_back(i);

      // slice fg segmentation polys
      int poly_num = polys_num[i];
      std::vector<std::vector<T>> polys;
      int s_idx = lod1[i];
      for (int j = 0; j < poly_num; ++j) {
        int s = lod2[s_idx + j];
        int e = lod2[s_idx + j + 1];
        PADDLE_ENFORCE_NE(s, e);
        std::vector<T> plts(polys_data + s * 2, polys_data + e * 2);
        polys.push_back(plts);
      }
      gt_polys.push_back(polys);
    }
  }
  for (int64_t i = 0; i < roi_size; ++i) {
    if (label_int32_data[i] > 0) {
      fg_inds.emplace_back(i);
    }
  }
  int gt_num = mask_gt_inds.size();
  int fg_num = fg_inds.size();

  Tensor boxes_from_polys;
  boxes_from_polys.mutable_data<T>({gt_num, 4}, platform::CPUPlace());
  Poly2Boxes(gt_polys, boxes_from_polys.data<T>());

  std::vector<int> roi_has_mask =
      std::vector<int>(fg_inds.begin(), fg_inds.end());
  Tensor mask_class_labels;
  Tensor masks;
  Tensor rois_fg;

  auto im_scale = im_info.data<T>()[2];
  if (fg_num > 0) {
    // Class labels for the foreground rois
    mask_class_labels.mutable_data<int>({fg_num, 1}, ctx.GetPlace());
    Gather<int>(label_int32_data, 1, fg_inds.data(), fg_inds.size(),
                mask_class_labels.data<int>());

    uint8_t* masks_data = masks.mutable_data<uint8_t>(
        {fg_num, resolution * resolution}, ctx.GetPlace());

    // Find overlap between all foreground rois and the bounding boxes
    // enclosing each segmentation
    T* rois_fg_data = rois_fg.mutable_data<T>({fg_num, 4}, ctx.GetPlace());
    Gather<T>(rois.data<T>(), 4, fg_inds.data(), fg_inds.size(),
              rois_fg.data<T>());

    for (int k = 0; k < rois_fg.numel(); ++k) {
      rois_fg_data[k] = rois_fg_data[k] / im_scale;
    }

    Tensor overlaps_bbfg_bbpolys;
    overlaps_bbfg_bbpolys.mutable_data<T>({fg_num, gt_num}, ctx.GetPlace());
    BboxOverlaps<T>(rois_fg, boxes_from_polys, &overlaps_bbfg_bbpolys);

    // Map from each fg rois to the index of the mask with highest overlap
    // (measured by bbox overlap)
    T* overlaps_bbfg_bbpolys_data = overlaps_bbfg_bbpolys.data<T>();
    std::vector<int> fg_masks_inds;
    for (int64_t i = 0; i < fg_num; ++i) {
      const T* v = overlaps_bbfg_bbpolys_data + i * gt_num;
      T max_overlap = std::numeric_limits<T>::min();
      int id = 0;
      for (int64_t j = 0; j < gt_num; ++j) {
        if (v[j] > max_overlap) {
          max_overlap = v[j];
          id = j;
        }
      }
      fg_masks_inds.push_back(id);
    }

    // add fg targets
    for (int64_t i = 0; i < fg_num; ++i) {
      int fg_polys_ind = fg_masks_inds[i];
      T* roi_fg = rois_fg_data + i * 4;
      uint8_t* mask = masks_data + i * resolution * resolution;
      Polys2MaskWrtBox(gt_polys[fg_polys_ind], roi_fg, resolution, mask);
    }
  } else {
    // The network cannot handle empty blobs, so we must provide a mask
    // We simply take the first bg roi, given it an all -1's mask (ignore
    // label), and label it with class zero (bg).
    int bg_num = 1;
    T* rois_fg_data = rois_fg.mutable_data<T>({bg_num, 4}, ctx.GetPlace());
    const T* rois_data = rois.data<T>();
    std::vector<int> bg_inds;
    for (int64_t i = 0; i < roi_size; ++i) {
      if (label_int32_data[i] == 0) {
        bg_inds.emplace_back(i);
        rois_fg_data[0] = rois_data[0] / im_scale;
        rois_fg_data[1] = rois_data[1] / im_scale;
        rois_fg_data[2] = rois_data[2] / im_scale;
        rois_fg_data[3] = rois_data[3] / im_scale;
        break;
      }
    }
    masks.mutable_data<uint8_t>({bg_num, resolution * resolution},
                                ctx.GetPlace());
    math::set_constant(ctx, &masks, -1);
    int* mask_class_labels_data =
        mask_class_labels.mutable_data<int>({bg_num, 1}, ctx.GetPlace());
    mask_class_labels_data[0] = 0;
    roi_has_mask = std::vector<int>(bg_inds.begin(), bg_inds.end());
  }

  Tensor masks_expand;
  ExpandMaskTarget<T>(ctx, masks, mask_class_labels, resolution, num_classes,
                      &masks_expand);

  T* rois_fg_data = rois_fg.data<T>();
  for (int k = 0; k < rois_fg.numel(); ++k) {
    rois_fg_data[k] = rois_fg_data[k] * im_scale;
  }

  Tensor roi_has_mask_t;
  int roi_has_mask_size = roi_has_mask.size();
  int* roi_has_mask_data =
      roi_has_mask_t.mutable_data<int>({roi_has_mask_size, 1}, ctx.GetPlace());
  std::copy(roi_has_mask.begin(), roi_has_mask.end(), roi_has_mask_data);

  std::vector<Tensor> res;
  res.emplace_back(rois_fg);
  res.emplace_back(roi_has_mask_t);
  res.emplace_back(masks_expand);
  return res;
}

template <typename T>
class GenerateMaskLabelsKernel : public framework::OpKernel<T> {
 public:
  void Compute(const framework::ExecutionContext& ctx) const override {
    auto* im_info = ctx.Input<LoDTensor>("ImInfo");
    auto* gt_classes = ctx.Input<LoDTensor>("GtClasses");
    auto* is_crowd = ctx.Input<LoDTensor>("IsCrowd");
    auto* gt_segms = ctx.Input<LoDTensor>("GtSegms");
    auto* rois = ctx.Input<LoDTensor>("Rois");
    auto* label_int32 = ctx.Input<LoDTensor>("LabelsInt32");

    auto* mask_rois = ctx.Output<LoDTensor>("MaskRois");
    auto* roi_has_mask_int32 = ctx.Output<LoDTensor>("RoiHasMaskInt32");
    auto* mask_int32 = ctx.Output<LoDTensor>("MaskInt32");

    int num_classes = ctx.Attr<int>("num_classes");
    int resolution = ctx.Attr<int>("resolution");

    PADDLE_ENFORCE_EQ(gt_classes->lod().size(), 1UL,
                      "GenerateMaskLabelsOp gt_classes needs 1 level of LoD");
    PADDLE_ENFORCE_EQ(is_crowd->lod().size(), 1UL,
                      "GenerateMaskLabelsOp is_crowd needs 1 level of LoD");
    PADDLE_ENFORCE_EQ(rois->lod().size(), 1UL,
                      "GenerateMaskLabelsOp rois needs 1 level of LoD");
    PADDLE_ENFORCE_EQ(label_int32->lod().size(), 1UL,
                      "GenerateMaskLabelsOp label_int32 needs 1 level of LoD");

    PADDLE_ENFORCE_EQ(gt_segms->lod().size(), 3UL);

    int64_t n = static_cast<int64_t>(gt_classes->lod().back().size() - 1);
    PADDLE_ENFORCE_EQ(gt_segms->lod()[0].size() - 1, n);

    int mask_dim = num_classes * resolution * resolution;
    int roi_num = rois->lod().back()[n];
    mask_rois->mutable_data<T>({roi_num, kBoxDim}, ctx.GetPlace());
    roi_has_mask_int32->mutable_data<int>({roi_num, 1}, ctx.GetPlace());
    mask_int32->mutable_data<int>({roi_num, mask_dim}, ctx.GetPlace());

    framework::LoD lod;
    std::vector<size_t> lod0(1, 0);

    int64_t num_mask = 0;
    auto& dev_ctx = ctx.device_context<platform::CPUDeviceContext>();

    auto gt_classes_lod = gt_classes->lod().back();
    auto is_crowd_lod = is_crowd->lod().back();
    auto rois_lod = rois->lod().back();
    auto label_int32_lod = label_int32->lod().back();
    auto gt_segms_lod = gt_segms->lod();

    for (int i = 0; i < n; ++i) {
      if (rois_lod[i] == rois_lod[i + 1]) {
        lod0.emplace_back(num_mask);
        continue;
      }
      Tensor im_info_slice = im_info->Slice(i, i + 1);
      Tensor gt_classes_slice =
          gt_classes->Slice(gt_classes_lod[i], gt_classes_lod[i + 1]);
      Tensor is_crowd_slice =
          is_crowd->Slice(is_crowd_lod[i], is_crowd_lod[i + 1]);
      Tensor label_int32_slice =
          label_int32->Slice(label_int32_lod[i], label_int32_lod[i + 1]);
      Tensor rois_slice = rois->Slice(rois_lod[i], rois_lod[i + 1]);

      auto sub_lod_and_offset =
          framework::GetSubLoDAndAbsoluteOffset(gt_segms_lod, i, i + 1, 0);
      auto lod_length = sub_lod_and_offset.first;
      size_t s = sub_lod_and_offset.second.first;
      size_t e = sub_lod_and_offset.second.second;
      Tensor gt_segms_slice = gt_segms->Slice(s, e);

      std::vector<Tensor> tensor_output = SampleMaskForOneImage<T>(
          dev_ctx, im_info_slice, gt_classes_slice, is_crowd_slice,
          gt_segms_slice, rois_slice, label_int32_slice, num_classes,
          resolution, lod_length);

      Tensor sampled_mask_rois = tensor_output[0];
      Tensor sampled_roi_has_mask_int32 = tensor_output[1];
      Tensor sampled_mask_int32 = tensor_output[2];

      AppendMask<T>(mask_rois, kBoxDim * num_mask, &sampled_mask_rois);
      AppendMask<int>(roi_has_mask_int32, num_mask,
                      &sampled_roi_has_mask_int32);
      AppendMask<int>(mask_int32, mask_dim * num_mask, &sampled_mask_int32);

      num_mask += sampled_mask_rois.dims()[0];
      lod0.emplace_back(num_mask);
    }

    lod.emplace_back(lod0);
    mask_rois->set_lod(lod);
    roi_has_mask_int32->set_lod(lod);
    mask_int32->set_lod(lod);
    mask_rois->Resize({num_mask, kBoxDim});
    roi_has_mask_int32->Resize({num_mask, 1});
    mask_int32->Resize({num_mask, mask_dim});
  }
};

class GenerateMaskLabelsOpMaker : public framework::OpProtoAndCheckerMaker {
 public:
  void Make() override {
    AddInput("ImInfo",
             "(Tensor), This input is a 2D Tensor with shape [B, 3]. "
             "B is the number of input images, "
             "each element consists of im_height, im_width, im_scale.");
    AddInput("GtClasses",
             "(LoDTensor), This input is a 2D LoDTensor with shape [M, 1]. "
             "M is the number of groundtruth, "
             "each element is a class label of groundtruth.");
    AddInput(
        "IsCrowd",
        "(LoDTensor), This input is a 2D LoDTensor with shape [M, 1]. "
        "M is the number of groundtruth, "
        "each element is a flag indicates whether a groundtruth is crowd.");
    AddInput(
        "GtSegms",
        "(LoDTensor), This input is a 2D LoDTensor with shape [S, 2], it's LoD "
        "level is 3. The LoD[0] represents the gt objects number of each "
        "instance. LoD[1] represents the segmentation counts of each objects. "
        "LoD[2] represents the polygons number of each segmentation. S the "
        "total number of polygons coordinate points. Each element is (x, y) "
        "coordinate points.");
    AddInput(
        "Rois",
        "(LoDTensor), This input is a 2D LoDTensor with shape [R, 4]. "
        "R is the number of rois which is the output of "
        "generate_proposal_labels, "
        "each element is a bounding box with (xmin, ymin, xmax, ymax) format.");
    AddInput("LabelsInt32",
             "(LoDTensor), This intput is a 2D LoDTensor with shape [R, 1], "
             "each element repersents a class label of a roi");
    AddOutput(
        "MaskRois",
        "(LoDTensor), This output is a 2D LoDTensor with shape [P, 4]. "
        "P is the number of mask, "
        "each element is a bounding box with [xmin, ymin, xmax, ymax] format.");
    AddOutput("RoiHasMaskInt32",
              "(LoDTensor), This output is a 2D LoDTensor with shape [P, 1], "
              "each element repersents the output mask rois index with regard "
              "to input rois");
    AddOutput("MaskInt32",
              "(LoDTensor), This output is a 4D LoDTensor with shape [P, Q], "
              "Q equal to num_classes * resolution * resolution");

    AddAttr<int>("num_classes", "Class number.");
    AddAttr<int>("resolution", "Resolution of mask.");

    AddComment(R"DOC(
This operator can be, for given the RoIs and corresponding labels,
to sample foreground RoIs. This mask branch also has
a :math: `K \\times M^{2}` dimensional output targets for each foreground
RoI, which encodes K binary masks of resolution M x M, one for each of the
K classes. This mask targets are used to compute loss of mask branch.
    )DOC");
  }
};

}  // namespace operators
}  // namespace paddle

namespace ops = paddle::operators;
REGISTER_OPERATOR(generate_mask_labels, ops::GenerateMaskLabelsOp,
                  ops::GenerateMaskLabelsOpMaker,
                  paddle::framework::EmptyGradOpMaker);
REGISTER_OP_CPU_KERNEL(generate_mask_labels,
                       ops::GenerateMaskLabelsKernel<float>);

redpajama_set_name: RedPajamaGithub


text:
package org.onosproject.k8snode.api;

import org.onosproject.net.DeviceId;

/**
 * K8s bridge interface.
 */
public interface K8sBridge {

    /**
     * Returns device identifier.
     *
     * @return device identifier
     */
    DeviceId deviceId();

    /**
     * Return the datapath identifier.
     *
     * @return datapath identifier
     */
    String dpid();

    /**
     * Returns bridge name.
     *
     * @return bridge name
     */
    String name();
}


text:
<?php

namespace App\ClientBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * App\ClientBundle\Entity\ClientInvoicePurchase
 *
 * @ORM\Table(name="client_invoice_purchase")
 * @ORM\Entity
 */
class ClientInvoicePurchase
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer $idInvoice
     *
     * @ORM\Column(name="id_invoice", type="integer", nullable=true)
     */
    private $idInvoice;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @var \DateTime $purchaseDate
     *
     * @ORM\Column(name="purchase_date", type="date", nullable=true)
     */
    private $purchaseDate;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set idInvoice
     *
     * @param integer $idInvoice
     * @return ClientInvoicePurchase
     */
    public function setIdInvoice($idInvoice)
    {
        $this->idInvoice = $idInvoice;

        return $this;
    }

    /**
     * Get idInvoice
     *
     * @return integer
     */
    public function getIdInvoice()
    {
        return $this->idInvoice;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return ClientInvoicePurchase
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set purchaseDate
     *
     * @param \DateTime $purchaseDate
     * @return ClientInvoicePurchase
     */
    public function setPurchaseDate($purchaseDate)
    {
        $this->purchaseDate = $purchaseDate;

        return $this;
    }

    /**
     * Get purchaseDate
     *
     * @return \DateTime
     */
    public function getPurchaseDate()
    {
        return $this->purchaseDate;
    }
}


text:
<?php

namespace Nette\Security;

use Nette;

/**
 * Performs authentication.
 *
 * @author     David Grudl
 */
interface IAuthenticator
{
	/** Credential key */
	const USERNAME = 0,
		PASSWORD = 1;

	/** Exception error code */
	const IDENTITY_NOT_FOUND = 1,
		INVALID_CREDENTIAL = 2,
		FAILURE = 3,
		NOT_APPROVED = 4;

	/**
	 * Performs an authentication against e.g. database.
	 * and returns IIdentity on success or throws AuthenticationException
	 * @return IIdentity
	 * @throws AuthenticationException
	 */
	function authenticate(array $credentials);

}


text:
/* Generated By:JJTree: Do not edit this line. ASTSHA256.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package org.eclipse.rdf4j.query.parser.sparql.ast;

public class ASTSHA256 extends SimpleNode {

	public ASTSHA256(int id) {
		super(id);
	}

	public ASTSHA256(SyntaxTreeBuilder p, int id) {
		super(p, id);
	}

	/** Accept the visitor. **/
	@Override
	public Object jjtAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException {
		return visitor.visit(this, data);
	}
}
/* JavaCC - OriginalChecksum=84e26bf8c75693550a4612482f7ec1c3 (do not edit this line) */


text:
"""Tests for modules/search/."""

__author__ = 'Ellis Michael (emichael@google.com)'

import logging
import re
import urllib

from common import utils as common_utils
from controllers import sites
from models import courses
from models import resources_display
from models import models
from models import transforms
from modules.announcements import announcements
from modules.i18n_dashboard import i18n_dashboard
from modules.search import search
from modules.search import search_unit_tests
from tests.functional import actions

from google.appengine.api import namespace_manager

class SearchTest(search_unit_tests.SearchTestBase):
    """Tests the search module."""

    @classmethod
    def get_xsrf_token(cls, body, form_name):
        match = re.search(form_name + r'.+[\n\r].+value="([^"]+)"', body)
        assert match
        return match.group(1)

    def index_test_course(self):
        email = 'admin@google.com'
        actions.login(email, is_admin=True)
        response = self.get('/test/dashboard?action=settings_search')
        index_token = self.get_xsrf_token(response.body, 'gcb-index-course')
        response = self.post('/test/dashboard?action=index_course',
                             {'xsrf_token': index_token})
        self.execute_all_deferred_tasks()

    def setUp(self):
        super(SearchTest, self).setUp()
        assert search.custom_module.enabled

        self.logged_error = ''
        def error_report(string, *args, **unused_kwargs):
            self.logged_error = string % args
        self.error_report = error_report

    def test_module_enabled(self):
        email = 'admin@google.com'
        actions.login(email, is_admin=True)

        response = self.get('course')
        self.assertIn('gcb-search-box', response.body)

        response = self.get('/search?query=lorem')
        self.assertEqual(response.status_code, 200)

        response = self.get('dashboard?action=settings_search')
        self.assertIn('Google > Dashboard > Search', response.body)
        self.assertIn('Index Course', response.body)

    def test_indexing_button(self):
        email = 'admin@google.com'
        actions.login(email, is_admin=True)

        response = self.get('dashboard?action=settings_search')

        index_token = self.get_xsrf_token(response.body, 'gcb-index-course')

        response = self.post('dashboard?action=index_course',
                             {'xsrf_token': index_token})
        self.assertEqual(response.status_int, 302)

        response = self.post('dashboard?action=index_course', {},
                             expect_errors=True)
        assert response.status_int == 403

    def test_bad_search(self):
        email = 'user@google.com'
        actions.login(email, is_admin=False)

        # %3A is a colon, and searching for only punctuation will cause App
        # Engine's search to throw an error that should be handled
        response = self.get('search?query=%3A')
        self.assertEqual(response.status_int, 200)
        self.assertIn('gcb-search-info', response.body)

    def test_errors_not_displayed_to_user(self):
        exception_code = '0xDEADBEEF'
        def bad_fetch(*unused_vargs, **unused_kwargs):
            raise Exception(exception_code)
        self.swap(search, 'fetch', bad_fetch)

        self.swap(logging, 'error', self.error_report)
        response = self.get('search?query=cogito')
        self.assertEqual(response.status_int, 200)
        self.assertIn('unavailable', response.body)
        self.assertNotIn('gcb-search-result', response.body)
        self.assertIn('gcb-search-info', response.body)
        self.assertIn(exception_code, self.logged_error)

    def test_unicode_pages(self):
        sites.setup_courses('course:/test::ns_test, course:/:/')
        course = courses.Course(None,
                                app_context=sites.get_all_courses()[0])
        unit = course.add_unit()
        unit.availability = courses.AVAILABILITY_AVAILABLE
        lesson_a = course.add_lesson(unit)
        lesson_a.notes = search_unit_tests.UNICODE_PAGE_URL
        lesson_a.availability = courses.AVAILABILITY_AVAILABLE
        course.update_unit(unit)
        course.save()

        self.index_test_course()

        self.swap(logging, 'error', self.error_report)
        response = self.get('/test/search?query=paradox')
        self.assertEqual('', self.logged_error)
        self.assertNotIn('unavailable', response.body)
        self.assertIn('gcb-search-result', response.body)

    def test_external_links(self):
        sites.setup_courses('course:/test::ns_test, course:/:/')
        course = courses.Course(None, app_context=sites.get_all_courses()[0])
        unit = course.add_unit()
        unit.availability = courses.AVAILABILITY_AVAILABLE
        lesson_a = course.add_lesson(unit)
        lesson_a.notes = search_unit_tests.VALID_PAGE_URL
        objectives_link = 'http://objectiveslink.null/'
        lesson_a.objectives = '' % (
            search_unit_tests.LINKED_PAGE_URL, objectives_link)
        lesson_a.availability = courses.AVAILABILITY_AVAILABLE
        course.update_unit(unit)
        course.save()

        self.index_test_course()

        response = self.get('/test/search?query=What%20hath%20God%20wrought')
        self.assertIn('gcb-search-result', response.body)

        response = self.get('/test/search?query=Cogito')
        self.assertIn('gcb-search-result', response.body)
        self.assertIn(search_unit_tests.VALID_PAGE_URL, response.body)
        self.assertIn(objectives_link, response.body)
        self.assertNotIn(search_unit_tests.PDF_URL, response.body)

        # If this test fails, indexing will crawl the entire web
        response = self.get('/test/search?query=ABORT')
        self.assertNotIn('gcb-search-result', response.body)
        self.assertNotIn(search_unit_tests.SECOND_LINK_PAGE_URL, response.body)

    def test_youtube(self):
        sites.setup_courses('course:/test::ns_test, course:/:/')
        default_namespace = namespace_manager.get_namespace()
        try:
            namespace_manager.set_namespace('ns_test')

            course = courses.Course(None,
                                    app_context=sites.get_all_courses()[0])
            unit = course.add_unit()
            unit.availability = courses.AVAILABILITY_AVAILABLE
            lesson_a = course.add_lesson(unit)
            lesson_a.video = 'portal'
            lesson_a.availability = courses.AVAILABILITY_AVAILABLE
            lesson_b = course.add_lesson(unit)
            lesson_b.objectives = '<gcb-youtube videoid="glados">'
            lesson_b.availability = courses.AVAILABILITY_AVAILABLE
            course.update_unit(unit)
            course.save()

            entity = announcements.AnnouncementEntity.make(
                'New Announcement', '<gcb-youtube videoid="aperature">', False)
            entity.put()

            self.index_test_course()

            response = self.get('/test/search?query=apple')
            self.assertIn('gcb-search-result', response.body)
            self.assertIn('start=3.14', response.body)
            self.assertIn('v=portal', response.body)
            self.assertIn('v=glados', response.body)
            self.assertIn('v=aperature', response.body)
            self.assertIn('lemon', response.body)
            self.assertIn('Medicus Quis', response.body)
            self.assertIn('http://thumbnail.null', response.body)

            # Test to make sure empty notes field doesn't cause a urlfetch
            response = self.get('/test/search?query=cogito')
            self.assertNotIn('gcb-search-result', response.body)
        finally:
            namespace_manager.set_namespace(default_namespace)

    def _add_announcement(self, form_settings):
        response = actions.view_announcements(self)
        add_form = response.forms['gcb-add-announcement']
        response = self.submit(add_form).follow()
        match = re.search(r'\'([^\']+rest/announcements/item\?key=([^\']+))',
                          response.body)
        url = match.group(1)
        key = match.group(2)
        response = self.get(url)
        json_dict = transforms.loads(response.body)
        payload_dict = transforms.loads(json_dict['payload'])
        payload_dict.update(form_settings)
        request = {}
        request['key'] = key
        request['payload'] = transforms.dumps(payload_dict)
        request['xsrf_token'] = json_dict['xsrf_token']
        response = self.put('rest/announcements/item?%s' % urllib.urlencode(
            {'request': transforms.dumps(request)}), {})

    def test_announcements(self):
        email = 'admin@google.com'
        actions.login(email, is_admin=True)

        self._add_announcement({
            'title': 'My Test Title',
            'date': '2015-02-03 00:00',
            'is_draft': False,
            'html': 'Four score and seven years ago, our founding fathers'
            })
        self._add_announcement({
            'title': 'My Test Title',
            'date': '2015-02-03 00:00',
            'is_draft': True,
            'html': 'Standing beneath this serene sky, overlooking these',
            })

        response = self.get('dashboard?action=settings_search')
        index_token = self.get_xsrf_token(response.body, 'gcb-index-course')
        response = self.post('dashboard?action=index_course',
                             {'xsrf_token': index_token})
        self.execute_all_deferred_tasks()

        # This matches an announcement in the Power Searching course
        response = self.get(
            'search?query=Four%20score%20seven%20years')
        self.assertIn('gcb-search-result', response.body)
        self.assertIn('announcements#', response.body)

        # The draft announcement in Power Searching should not be indexed
        response = self.get('search?query=Standing%20beneath%20serene')
        self.assertNotIn('gcb-search-result', response.body)
        self.assertNotIn('announcements#', response.body)

    def test_private_units_and_lessons(self):
        sites.setup_courses('course:/test::ns_test, course:/:/')
        course = courses.Course(None, app_context=sites.get_all_courses()[0])

        unit1 = course.add_unit()
        lesson11 = course.add_lesson(unit1)
        lesson11.notes = search_unit_tests.VALID_PAGE_URL
        lesson11.objectives = search_unit_tests.VALID_PAGE
        lesson11.video = 'portal'
        unit2 = course.add_unit()
        lesson21 = course.add_lesson(unit2)
        lesson21.notes = search_unit_tests.VALID_PAGE_URL
        lesson21.objectives = search_unit_tests.VALID_PAGE
        lesson21.video = 'portal'

        unit1.availability = courses.AVAILABILITY_AVAILABLE
        lesson11.availability = courses.AVAILABILITY_UNAVAILABLE
        course.update_unit(unit1)

        unit2.availability = courses.AVAILABILITY_UNAVAILABLE
        lesson21.availability = courses.AVAILABILITY_AVAILABLE
        course.update_unit(unit2)

        course.save()
        self.index_test_course()

        response = self.get('/test/search?query=cogito%20ergo%20sum')
        self.assertNotIn('gcb-search-result', response.body)

        response = self.get('/test/search?query=apple')
        self.assertNotIn('gcb-search-result', response.body)
        self.assertNotIn('v=portal', response.body)

    def test_tracked_lessons(self):
        context = actions.simple_add_course('test', 'admin@google.com',
                                            'Test Course')
        course = courses.Course(None, context)
        actions.login('admin@google.com')
        actions.register(self, 'Some Admin', 'test')

        with common_utils.Namespace('ns_test'):
            foo_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Foo',
                       'descripton': 'foo',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            bar_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Bar',
                       'descripton': 'bar',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))

        unit1 = course.add_unit()
        unit1.availability = courses.AVAILABILITY_AVAILABLE
        unit1.labels = str(foo_id)
        lesson11 = course.add_lesson(unit1)
        lesson11.objectives = 'common plugh <gcb-youtube videoid="glados">'
        lesson11.availability = courses.AVAILABILITY_AVAILABLE
        lesson11.notes = search_unit_tests.VALID_PAGE_URL
        lesson11.video = 'portal'
        course.update_unit(unit1)
        unit2 = course.add_unit()
        unit2.availability = courses.AVAILABILITY_AVAILABLE
        unit1.labels = str(bar_id)
        lesson21 = course.add_lesson(unit2)
        lesson21.objectives = 'common plover'
        lesson21.availability = courses.AVAILABILITY_AVAILABLE
        course.update_unit(unit2)
        course.save()
        self.index_test_course()

        # Registered, un-tracked student sees all.
        response = self.get('/test/search?query=common')
        self.assertIn('common', response.body)
        self.assertIn('plugh', response.body)
        self.assertIn('plover', response.body)
        response = self.get('/test/search?query=link')  # Do see followed links
        self.assertIn('Partial', response.body)
        self.assertIn('Absolute', response.body)
        response = self.get('/test/search?query=lemon')  # Do see video refs
        self.assertIn('v=glados', response.body)

        # Student with tracks sees filtered view.
        with common_utils.Namespace('ns_test'):
            models.Student.set_labels_for_current(str(foo_id))
        response = self.get('/test/search?query=common')
        self.assertIn('common', response.body)
        self.assertNotIn('plugh', response.body)
        self.assertIn('plover', response.body)
        response = self.get('/test/search?query=link')  # Links are filtered
        self.assertNotIn('Partial', response.body)
        self.assertNotIn('Absolute', response.body)
        response = self.get('/test/search?query=lemon')  # Don't see video refs
        self.assertNotIn('v=glados', response.body)

    def test_localized_search(self):
        def _text(elt):
            return ''.join(elt.itertext())

        dogs_page = """

              A page about dogs.

          """
        dogs_link = 'http://dogs.null/'
        self.pages[dogs_link + '$'] = (dogs_page, 'text/html')

        dogs_page_fr = """

              A page about French dogs.

          """
        dogs_link_fr = 'http://dogs_fr.null/'
        self.pages[dogs_link_fr + '$'] = (dogs_page_fr, 'text/html')

        self.base = '/test'
        context = actions.simple_add_course(
            'test', 'admin@google.com', 'Test Course')
        course = courses.Course(None, context)
        actions.login('admin@google.com')
        actions.register(self, 'Some Admin')

        unit = course.add_unit()
        unit.availability = courses.AVAILABILITY_AVAILABLE
        lesson = course.add_lesson(unit)
        lesson.objectives = 'A lesson about dogs' % dogs_link
        lesson.availability = courses.AVAILABILITY_AVAILABLE
        course.save()

        lesson_bundle = {
            'objectives': {
                'type': 'html',
                'source_value': (
                    'A lesson about dogs' % dogs_link),
                'data': [{
                    'source_value': (
                        'A lesson about dogs' % dogs_link),
                    'target_value': (
                        'A lesson about French '
                        'dogs' % dogs_link_fr)}]
            }
        }
        lesson_key_fr = i18n_dashboard.ResourceBundleKey(
            resources_display.ResourceLesson.TYPE, lesson.lesson_id, 'fr')
        with common_utils.Namespace('ns_test'):
            i18n_dashboard.ResourceBundleDAO.save(
                i18n_dashboard.ResourceBundleDTO(
                    str(lesson_key_fr), lesson_bundle))

        extra_locales = [{'locale': 'fr', 'availability': 'available'}]
        with actions.OverriddenEnvironment({'extra_locales': extra_locales}):

            self.index_test_course()

            dom = self.parse_html_string(self.get('search?query=dogs').body)
            snippets = dom.findall('.//div[@class="gcb-search-result-snippet"]')
            self.assertEquals(2, len(snippets))  # Expect no French hits
            self.assertIn('page about dogs', _text(snippets[0]))
            self.assertIn('lesson about dogs', _text(snippets[1]))

            # Switch locale to 'fr'
            with common_utils.Namespace('ns_test'):
                prefs = models.StudentPreferencesDAO.load_or_default()
                prefs.locale = 'fr'
                models.StudentPreferencesDAO.save(prefs)

            dom = self.parse_html_string(self.get('search?query=dogs').body)
            snippets = dom.findall('.//div[@class="gcb-search-result-snippet"]')
            self.assertEquals(2, len(snippets))  # Expect no Engish hits
            self.assertIn('page about French dogs', _text(snippets[0]))
            self.assertIn('lesson about French dogs', _text(snippets[1]))

    def test_cron(self):
        app_context = sites.get_all_courses()[0]
        app_context.set_current_locale('en_US')
        course = courses.Course(None, app_context=app_context)
        actions.login('admin@google.com', is_admin=True)

        # Call cron URL without indexing enabled; expect 0 results found.
        self.get(search.CronIndexCourse.URL)
        self.execute_all_deferred_tasks()
        response = search.fetch(course, 'color')
        self.assertEquals(0, response['total_found'])

        # Call cron URL with indexing enabled; expect results.
        with actions.OverriddenEnvironment(
            {'course': {search.AUTO_INDEX_SETTING: 'True'}}):
            self.get(search.CronIndexCourse.URL)
        self.execute_all_deferred_tasks()
        response = search.fetch(course, 'color')
        self.assertEquals(1, response['total_found'])


text:
module.exports={
	name:'Node-Server-Manager'
};


text:
package org.finos.waltz.model.application;

public enum ApplicationKind {
    /** Applications which have been developed by in-house software teams */
    IN_HOUSE,

    /** Deprecated, use THIRD_PARTY or CUSTOMISED instead **/
    @Deprecated
    INTERNALLY_HOSTED,

    /** Externally hosted applications such as Salesforce **/
    EXTERNALLY_HOSTED,

    /** End user computing - Applications not owned by IT **/
    EUC,

    /** Third party applications which have not been customised **/
    THIRD_PARTY,

    /** Third party applications which have been customised **/
    CUSTOMISED,

    /** Applications which are not owned by the organisation **/
    EXTERNAL
}


text:
{% extends 'layout.html' %}

{% block title %}401 Not Authorised{{ super() }}{% endblock %}

{% block content %}

Not Authorised!

Sorry, kiddo - we can't let you do that!

{% endblock %}


text:
var express = require('express');
var router = express.Router();

router.get('/celebrities.json', function(req, res) {
    var db = req.db;
    db.collection('celebrities').find().toArray(function (err, items) {
        res.json(items);
    });
});

/*
 * DELETE to deletecelebrity.
 */

router.delete('/deletecelebrity/:id', function(req, res) {
    var db = req.db;
    var celebrityToDelete = req.params.id;
    db.collection('celebrities').removeById(celebrityToDelete, function(err, result) {
        res.send((result === 1) ? { msg: '' } : { msg:'error: ' + err });
    });
});

module.exports = router;


text:
<?xml version="1.0"?>
<!-- Sample XML Configuration -->
<configuration>

    <!-- Defines how to deploy AggregateServer -->
    <!-- The server can be deployed in either standalone or cluster mode -->

    <!-- If cluster mode is specified, then there MUST be one additional file:
         conf/slaves which indicates slave machines to deploy the server onto
    -->

    <!-- This property is MANDATORY -->

    <property>
        <name>deploy.type</name>
        <value>standalone</value>
    </property>
</configuration>


text:
package com.microsoft.projectoxford.face.contract;

import java.util.UUID;

public class Candidate {
    public UUID personId;

    public double confidence;
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Wechat Web Platform index</title>
    <link rel="stylesheet" href="/static/index/index.css">
    <link rel="stylesheet" href="/static/public/font-awesome.min.css">

          Web Automation Platform

{{ message }} {{ user }}

              friends list

            free expansion


text:
Reflect excells as a fast and lighweight extent to the C typography

## Introduction

Reflect is a compiled programmation language designed for performance, simplicity, readability and
typing economy (in this order). It is a global usage language, but excells when performance or
compatibility are required. It is designed to create programs directly but also allows for C code
prototyping.

It is compatible out of the box with any existing C library, and using a Reflect library in a C
program is very easy.

It is distributed under the MIT license. In short, do whatever you want, but keep the original
license text in any distribution and dont point at me if you get problems. See the `Copying` file
for details.

## Hello world example

Note that the language is still a work in progress, this example will likely change in the future.

    import stdio

    int main(int ac, string[] av)
    {
        printf("Hello, world!\n")
        return 0
    }

## More resources

* Quick tutorial on [how to build a program](docs/Usage.md)
* See [Language features](docs/Features.md)
* Learn the [language](docs/Language.md)
* Learn how [translation in C code](docs/Implementation.md) is actually made
* Understand the [rationales](docs/Rationales.md) hidden behind design decisions


text:
<head>
  <title>Digits</title>
  <link rel="stylesheet" type="text/css" href="http://fonts.googleapi.com/css?family=Open+Sans">
</head>


text:
package com.hpw.myapp.widget.media;

/**
 * Created by hpw on 16/12/3.
 */

import android.animation.Animator;
import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hpw.myapp.R;

public class HorMediaControllView extends FrameLayout {

    private Handler mHandler = new Handler();
    private View rootView;
    public RelativeLayout layout_topbar;
    public ImageView img_btn_back;
    public LinearLayout top_ll;
    public CheckBox check_gift_switch;
    public TextView txt_btn_clarity;
    public CheckBox check_focus;
    public ImageView img_btn_share;
    public TextView txt_btn_describe;
    public TextView txt_get_seed;
    public ListView lv_quality;
    public TextView tv_volume_brightness;
    public LinearLayout layout_bottom_thelive;
    public CheckBox player_switch;
    public ImageView img_btn_refresh;
    public ImageView txt_btn_hot_word;
    public EditText ediit_comment;
    public ImageView img_btn_send;
    public CheckBox rad_btn_danmu_switch;
    public ImageView img_btn_gift;
    private OnHorControllListener onHorControllListener;

    public HorMediaControllView(Context context) {
        this(context, null, 0);
    }

    public HorMediaControllView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public HorMediaControllView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
        initListener();
    }

    //init
    private void initView(Context context) {
        rootView = View.inflate(context, R.layout.widget_hor_controller, this);
        layout_topbar = (RelativeLayout) findViewById(R.id.layout_topbar);
        img_btn_back = (ImageView) findViewById(R.id.img_btn_back);
        top_ll = (LinearLayout) findViewById(R.id.top_ll);
        check_gift_switch = (CheckBox) findViewById(R.id.check_gift_switch);
        txt_btn_clarity = (TextView) findViewById(R.id.txt_btn_clarity);
        check_focus = (CheckBox) findViewById(R.id.check_focus);
        img_btn_share = (ImageView) findViewById(R.id.img_btn_share);
        txt_btn_describe = (TextView) findViewById(R.id.txt_btn_describe);
        txt_get_seed = (TextView) findViewById(R.id.txt_get_seed);
        lv_quality = (ListView) findViewById(R.id.lv_quality);
        tv_volume_brightness = (TextView) findViewById(R.id.tv_volume_brightness);
        layout_bottom_thelive = (LinearLayout) findViewById(R.id.layout_bottom_thelive);
        player_switch = (CheckBox) findViewById(R.id.rad_btn_player_switch);
        img_btn_refresh = (ImageView) findViewById(R.id.img_btn_refresh);
        txt_btn_hot_word = (ImageView) findViewById(R.id.txt_btn_hot_word);
        ediit_comment = (EditText) findViewById(R.id.ediit_comment);
        img_btn_send = (ImageView) findViewById(R.id.img_btn_send);
        rad_btn_danmu_switch = (CheckBox) findViewById(R.id.rad_btn_danmu_switch);
        img_btn_gift = (ImageView) findViewById(R.id.img_btn_gift);
    }

    private void initListener() {
        img_btn_back.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onHorControllListener != null) {
                    onHorControllListener.onHorClickBack();
                }

            }
        });
        player_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    if (onHorControllListener != null) {
                        onHorControllListener.onHorClickPause();
                    }
                } else {
                    if (onHorControllListener != null) {
                        onHorControllListener.onHorClickStart();
                    }
                }
            }
        });
    }

    //life recycler
    public void onCreate() {
        show();
    }

    public void onDestroy() {
        rootView.setVisibility(INVISIBLE);
        mHandler.removeCallbacksAndMessages(null);
    }

    //action
    public boolean onTouchEvent(boolean isVertical, MotionEvent event) {
        if (!isVertical) {
            show();
        }
        return onTouchEvent(event);
    }

    private void hide() {
        rootView.setAlpha(1f);
        rootView.setVisibility(INVISIBLE);
    }

    private void show() {
        rootView.setVisibility(VISIBLE);
        mHandler.removeCallbacks(hiddenControll);
        mHandler.postDelayed(hiddenControll, 3000);
    }

    //listener
    private Runnable hiddenControll = new Runnable() {
        @Override
        public void run() {
            rootView.animate().alpha(0).setDuration(1000).setListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {

                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    hide();

                }

                @Override
                public void onAnimationCancel(Animator animation) {

                }

                @Override
                public void onAnimationRepeat(Animator animation) {

                }
            }).start();
        }
    };

    public void setOnHorControllListener(OnHorControllListener onHorControllListener) {
        this.onHorControllListener = onHorControllListener;
    }

    public interface OnHorControllListener {
        void onHorClickPause();

        void onHorClickStart();

        void onHorClickBack();
    }

}


text:
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Queryish
{
    public class QueryFactory<T>
    {
        private static ConcurrentDictionary<string, QueryTree> ExpressionCache = new ConcurrentDictionary<string, QueryTree>();
        private Query<T> searcher;

        public QueryFactory()
        {
            searcher = new Query<T>();
        }
        public IQueryable<T> Queryable<T>(IQueryable<T> dataSet, Filter filter, string sortProperty, bool overridePagination = false)
        {
            #region README
            /**********************************************************************************************************
             * This function turns a Filter into a Linq query and returns an IQueryable<EBillView>.  When we write
             * Linq queries we are really writing Expression Trees that get translated into SQL.  This is great if you
             * know what the query is at design time - but if you don't know the query until run time then you are kinda
             * stuck.  That is why this class exists.  It turns a Filter into an Expression Tree and then to SQL
             ******************************************************************************************************* */
            #endregion README
            //Sanity Check - Provide sane defaults
            if (filter.Page <= 1)
                filter.Page = 1;

            if (filter.Size < 1)
                filter.Size = 100;

            if (string.IsNullOrEmpty(filter.OrderColumn))
                filter.OrderColumn = sortProperty;

            ParameterExpression parameter = Expression.Parameter(typeof(T), "x");

            //used as a key in the ExpressionCache
            string json = JsonConvert.SerializeObject(filter);

            ParameterExpression whereParameter = null;
            ParameterExpression orderByParameter = null;
            ParameterExpression thenByParameter = null;
            Expression searchExpression = null;
            Expression orderExpression = null;
            Expression thenExpression = null;
            Expression skipExpression = null;
            Expression takeExpression = null;

            //Is this Filter in the cache?  Then use that expression tree instead of making another one
            if (!ExpressionCache.ContainsKey(json))
            {
                whereParameter = parameter;
                orderByParameter = Expression.Parameter(typeof(T), "y");
                thenByParameter = Expression.Parameter(typeof(T), "z");
                searchExpression = BuildQueryExpression(filter, whereParameter);
                orderExpression = BuildOrderByExpression(filter, orderByParameter);
                thenExpression = BuildThenByExpression(thenByParameter, sortProperty);
                skipExpression = BuildSkipExpression(filter);
                takeExpression = BuildTakeExpression(filter);

                QueryTree searchTree = new QueryTree()
                {
                    WhereParameter = whereParameter,
                    OrderByParameter = orderByParameter,
                    ThenByParameter = thenByParameter,
                    SearchExpression = searchExpression,
                    OrderExpression = orderExpression,
                    ThenExpression = thenExpression,
                    SkipExpression = skipExpression,
                    TakeExpression = takeExpression
                };
                ExpressionCache.AddOrUpdate(json, searchTree, (x, y) => { return y; });
            }
            else
            {
                QueryTree searchTree = ExpressionCache[json];
                whereParameter = searchTree.WhereParameter;
                orderByParameter = searchTree.OrderByParameter;
                thenByParameter = searchTree.ThenByParameter;
                searchExpression = searchTree.SearchExpression;
                orderExpression = searchTree.OrderExpression;
                thenExpression = searchTree.ThenExpression;
                if (!overridePagination)
                {
                    skipExpression = searchTree.SkipExpression;
                    takeExpression = searchTree.TakeExpression;
                }
            }
            MethodCallExpression finalQuery = null;
            MethodCallExpression where = BuildWhereMethodCallExpression<T>(dataSet, whereParameter, searchExpression);
            MethodCallExpression whereOrder = BuildOrderByMethodCallExpression<T>(dataSet, where, orderByParameter, orderExpression, filter.OrderDirection);
            //MethodCallExpression whereOrderThen = BuildThenByMethodCallExpression<T>(dataSet, whereOrder, thenByParameter, thenExpression);
            finalQuery = whereOrder;
            if (!overridePagination)
            {
                MethodCallExpression whereOrderThenSkip = BuildSkipMethodCallExpression<T>(dataSet, finalQuery, skipExpression);
                MethodCallExpression whereOrderThenSkipTake = BuildTakeMethodCallExpression<T>(dataSet, whereOrderThenSkip, takeExpression);
                finalQuery = whereOrderThenSkipTake;
            }
            // Create an executable query from the expression tree.
            var query = dataSet.Provider.CreateQuery<T>(finalQuery);
            return query;

        }

        private static MethodCallExpression BuildWhereMethodCallExpression<T>(IQueryable<T> dataSet, ParameterExpression parameter, Expression searchExpression)
        {
            if (searchExpression == null)
                searchExpression = Expression.Equal(Expression.Constant(true), Expression.Constant(true));

            return Expression.Call(
                typeof(Queryable), "Where",
                new Type[] { dataSet.ElementType },
                dataSet.Expression,
                Expression.Lambda<Func<T, bool>>(searchExpression, new ParameterExpression[] { parameter }));
        }

        private static MethodCallExpression BuildOrderByMethodCallExpression<T>(IQueryable<T> dataSet, MethodCallExpression where, ParameterExpression parameter, Expression orderExpression, string sortDirection)
        {
            bool sortAscending = true;
            if (!string.IsNullOrEmpty(sortDirection) && sortDirection.ToLower() == "desc")
                sortAscending = false;

            Type[] orderType = null;
            Expression lambda = null;

            string methodName = "OrderBy";
            if(sortAscending)
                methodName = "OrderByDescending";

            if (orderExpression.Type == typeof(DateTime))
            {
                orderType = new Type[] { dataSet.ElementType, typeof(DateTime) };
                lambda = BuildLambdaExpression<DateTime, T>(orderExpression, parameter);
            }
            else if (orderExpression.Type == typeof(int))
            {
                orderType = new Type[] { dataSet.ElementType, typeof(int) };
                lambda = BuildLambdaExpression<int, T>(orderExpression, parameter);
            }
            else if (orderExpression.Type == typeof(double))
            {
                orderType = new Type[] { dataSet.ElementType, typeof(double) };
                lambda = BuildLambdaExpression<double, T>(orderExpression, parameter);
            }
            else if (orderExpression.Type == typeof(decimal))
            {
                orderType = new Type[] { dataSet.ElementType, typeof(decimal) };
                lambda = BuildLambdaExpression<decimal, T>(orderExpression, parameter);
            }
            else
            {
                orderType = new Type[] { dataSet.ElementType, typeof(string) };
                lambda = BuildLambdaExpression<string, T>(orderExpression, parameter);
            }

            return  Expression.Call(
              typeof(Queryable),
              methodName,
              orderType,
              where,
              lambda);
        }

        private static Expression BuildLambdaExpression<U, T>(Expression orderExpression, ParameterExpression parameter)
        {
            return Expression.Lambda<Func<T, U>>(orderExpression, new ParameterExpression[] { parameter });
        }

        private static MethodCallExpression BuildThenByMethodCallExpression<T>(IQueryable<T> dataSet, MethodCallExpression whereOrder, ParameterExpression parameter, Expression orderExpression)
        {
            return Expression.Call(
              typeof(Queryable),
              "ThenBy",
              new Type[] { dataSet.ElementType, typeof(string) },
              whereOrder,
              Expression.Lambda<Func<T, string>>(orderExpression, new ParameterExpression[] { parameter }));
        }

        private static MethodCallExpression BuildSkipMethodCallExpression<T>(IQueryable<T> dataSet, MethodCallExpression whereOrderThen, Expression skipExpression)
        {
            return Expression.Call(
              typeof(Queryable),
              "Skip",
              new Type[] { dataSet.ElementType },
              whereOrderThen,
              skipExpression);
        }

        private static MethodCallExpression BuildTakeMethodCallExpression<T>(IQueryable<T> dataSet, MethodCallExpression whereOrderThenSkip, Expression takeExpression)
        {
            return Expression.Call(
              typeof(Queryable),
              "Take",
              new Type[] { dataSet.ElementType },
              whereOrderThenSkip,
              takeExpression);
        }

        private Expression BuildQueryExpression(Filter filter, ParameterExpression parameter)
        {
            List<Expression> ands = new List<Expression>();
            Dictionary<string, List<FilterItem>> filters = new Dictionary<string, List<FilterItem>>();

            //Build the Dictionary.  columns will be or'd and then and'd
            foreach (var search in filter.FilterCollection)
            {
                string key = search.Column + search.Operation;
                if (!filters.Keys.Contains(key))
                {
                    List<FilterItem> searchCollection = new List<FilterItem>();
                    searchCollection.Add(search);
                    filters.Add(key, searchCollection);
                }
                else
                {
                    filters[key].Add(search);
                }
            }
            //Create or expressions
            foreach (var item in filters)
            {
                if (item.Value.Count > 0)
                {
                    ands.Add(BuildOrExpression(item.Value, parameter));
                }
            }
            //Create and expression
            Expression searchExpression = BuildAndExpression(ands);
            return searchExpression;
        }

        private Expression BuildOrExpression(List<FilterItem> searchList, ParameterExpression parameter)
        {
            Expression expression = null;
            foreach (var searchItem in searchList)
            {
                var searchExpression = searcher.BuildSearchFunction(searchItem, parameter);
                if (expression == null)
                {
                    expression = searchExpression;
                }
                else
                {
                    if (searchItem.Operation.Equals("Not", StringComparison.InvariantCultureIgnoreCase))
                    {
                        expression = Expression.And(expression, searchExpression);
                    }
                    else
                    {
                        expression = Expression.Or(expression, searchExpression);
                    }
                }
            }
            return expression;
        }

        private Expression BuildAndExpression(List<Expression> andList)
        {
            Expression expression = null;
            foreach (var and in andList)
            {
                if (expression == null)
                {
                    expression = and;
                }
                else
                {
                    expression = Expression.And(expression, and);
                }
            }
            return expression;
        }

        private Expression BuildOrderByExpression(Filter filter, ParameterExpression orderParameter)
        {
            string orderColumn = filter.OrderColumn;
            return Expression.Property(orderParameter, orderColumn);
        }

        private Expression BuildThenByExpression(ParameterExpression orderParameter, string orderColumn)
        {
            return Expression.Property(orderParameter, orderColumn);
        }

        private Expression BuildSkipExpression(Filter filter)
        {
            return Expression.Constant((filter.Page -1 ) * filter.Size);
        }

        private Expression BuildTakeExpression(Filter filter)
        {
            return Expression.Constant(filter.Size);
        }
    }
}


text:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:c="http://www.springframework.org/schema/c" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
             http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
             http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
             http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
             http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

	<context:component-scan base-package="com.dangdang.config.service.easyzk.demo.simple" />

</beans>


text:
#include <parameters/param.h>

// 16 is max name length

/**
 * Optical flow z offset from center
 *
 * @group Local Position Estimator
 * @unit m
 * @min -1
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_FLW_OFF_Z, 0.0f);

/**
 * Optical flow scale
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.1
 * @max 10.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_FLW_SCALE, 1.3f);

/**
 * Optical flow rotation (roll/pitch) noise gain
 *
 * @group Local Position Estimator
 * @unit m/s/rad
 * @min 0.1
 * @max 10.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_FLW_R, 7.0f);

/**
 * Optical flow angular velocity noise gain
 *
 * @group Local Position Estimator
 * @unit m/rad
 * @min 0.0
 * @max 10.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_FLW_RR, 7.0f);

/**
 * Optical flow minimum quality threshold
 *
 * @group Local Position Estimator
 * @min 0
 * @max 255
 * @decimal 0
 */
PARAM_DEFINE_INT32(LPE_FLW_QMIN, 150);

/**
 * Sonar z standard deviation.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_SNR_Z, 0.05f);

/**
 * Sonar z offset from center of vehicle +down
 *
 * @group Local Position Estimator
 * @unit m
 * @min -1
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_SNR_OFF_Z, 0.00f);

/**
 * Lidar z standard deviation.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_LDR_Z, 0.03f);

/**
 * Lidar z offset from center of vehicle +down
 *
 * @group Local Position Estimator
 * @unit m
 * @min -1
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_LDR_OFF_Z, 0.00f);

/**
 * Accelerometer xy noise density
 *
 * Data sheet noise density = 150ug/sqrt(Hz) = 0.0015 m/s^2/sqrt(Hz)
 *
 * Larger than data sheet to account for tilt error.
 *
 * @group Local Position Estimator
 * @unit m/s^2/sqrt(Hz)
 * @min 0.00001
 * @max 2
 * @decimal 4
 */
PARAM_DEFINE_FLOAT(LPE_ACC_XY, 0.012f);

/**
 * Accelerometer z noise density
 *
 * Data sheet noise density = 150ug/sqrt(Hz) = 0.0015 m/s^2/sqrt(Hz)
 *
 * @group Local Position Estimator
 * @unit m/s^2/sqrt(Hz)
 * @min 0.00001
 * @max 2
 * @decimal 4
 */
PARAM_DEFINE_FLOAT(LPE_ACC_Z, 0.02f);

/**
 * Barometric presssure altitude z standard deviation.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 100
 * @decimal 2
 */
PARAM_DEFINE_FLOAT(LPE_BAR_Z, 3.0f);

/**
 * GPS delay compensaton
 *
 * @group Local Position Estimator
 * @unit s
 * @min 0
 * @max 0.4
 * @decimal 2
 */
PARAM_DEFINE_FLOAT(LPE_GPS_DELAY, 0.29f);

/**
 * Minimum GPS xy standard deviation, uses reported EPH if greater.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 5
 * @decimal 2
 */
PARAM_DEFINE_FLOAT(LPE_GPS_XY, 1.0f);

/**
 * Minimum GPS z standard deviation, uses reported EPV if greater.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 200
 * @decimal 2
 */
PARAM_DEFINE_FLOAT(LPE_GPS_Z, 3.0f);

/**
 * GPS xy velocity standard deviation.
 *
 * EPV used if greater than this value.
 *
 * @group Local Position Estimator
 * @unit m/s
 * @min 0.01
 * @max 2
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_GPS_VXY, 0.25f);

/**
 * GPS z velocity standard deviation.
 *
 * @group Local Position Estimator
 * @unit m/s
 * @min 0.01
 * @max 2
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_GPS_VZ, 0.25f);

/**
 * Max EPH allowed for GPS initialization
 *
 * @group Local Position Estimator
 * @unit m
 * @min 1.0
 * @max 5.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_EPH_MAX, 3.0f);

/**
 * Max EPV allowed for GPS initialization
 *
 * @group Local Position Estimator
 * @unit m
 * @min 1.0
 * @max 5.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_EPV_MAX, 5.0f);

/**
 * Vision delay compensaton.
 *
 * Set to zero to enable automatic compensation from measurement timestamps
 *
 * @group Local Position Estimator
 * @unit s
 * @min 0
 * @max 0.1
 * @decimal 2
 */
PARAM_DEFINE_FLOAT(LPE_VIS_DELAY, 0.1f);

/**
 * Vision xy standard deviation.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_VIS_XY, 0.1f);

/**
 * Vision z standard deviation.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.01
 * @max 100
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_VIS_Z, 0.5f);

/**
 * Vicon position standard deviation.
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.0001
 * @max 1
 * @decimal 4
 */
PARAM_DEFINE_FLOAT(LPE_VIC_P, 0.001f);

/**
 * Position propagation noise density
 *
 * Increase to trust measurements more.
 * Decrease to trust model more.
 *
 * @group Local Position Estimator
 * @unit m/s/sqrt(Hz)
 * @min 0
 * @max 1
 * @decimal 8
 */
PARAM_DEFINE_FLOAT(LPE_PN_P, 0.1f);

/**
 * Velocity propagation noise density
 *
 * Increase to trust measurements more.
 * Decrease to trust model more.
 *
 * @group Local Position Estimator
 * @unit m/s^2/sqrt(Hz)
 * @min 0
 * @max 1
 * @decimal 8
 */
PARAM_DEFINE_FLOAT(LPE_PN_V, 0.1f);

/**
 * Accel bias propagation noise density
 *
 * @group Local Position Estimator
 * @unit m/s^3/sqrt(Hz)
 * @min 0
 * @max 1
 * @decimal 8
 */
PARAM_DEFINE_FLOAT(LPE_PN_B, 1e-3f);

/**
 * Terrain random walk noise density, hilly/outdoor (0.1), flat/Indoor (0.001)
 *
 * @group Local Position Estimator
 * @unit m/s/sqrt(Hz)
 * @min 0
 * @max 1
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_PN_T, 0.001f);

/**
 * Terrain maximum percent grade, hilly/outdoor (100 = 45 deg), flat/Indoor (0 = 0 deg)
 *
 * Used to calculate increased terrain random walk nosie due to movement.
 *
 * @group Local Position Estimator
 * @unit %
 * @min 0
 * @max 100
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_T_MAX_GRADE, 1.0f);

/**
 * Flow gyro high pass filter cut off frequency
 *
 * @group Local Position Estimator
 * @unit Hz
 * @min 0
 * @max 2
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_FGYRO_HP, 0.001f);

/**
 * Enable publishing of a fake global position (e.g for AUTO missions using Optical Flow)
 *
 * By initializing the estimator to the LPE_LAT/LON parameters when global information is unavailable
 *
 * @group Local Position Estimator
 * @min 0
 * @max 1
 */
PARAM_DEFINE_INT32(LPE_FAKE_ORIGIN, 0);

/**
 * Local origin latitude for nav w/o GPS
 *
 * @group Local Position Estimator
 * @unit deg
 * @min -90
 * @max 90
 * @decimal 8
 */
PARAM_DEFINE_FLOAT(LPE_LAT, 47.397742f);

/**
 * Local origin longitude for nav w/o GPS
 *
 * @group Local Position Estimator
 * @unit deg
 * @min -180
 * @max 180
 * @decimal 8
 */
PARAM_DEFINE_FLOAT(LPE_LON, 8.545594);

/**
 * Cut frequency for state publication
 *
 * @group Local Position Estimator
 * @unit Hz
 * @min 5
 * @max 1000
 * @decimal 0
 */
PARAM_DEFINE_FLOAT(LPE_X_LP, 5.0f);

/**
 * Required velocity xy standard deviation to publish position
 *
 * @group Local Position Estimator
 * @unit m/s
 * @min 0.01
 * @max 1.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_VXY_PUB, 0.3f);

/**
 * Required z standard deviation to publish altitude/ terrain
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.3
 * @max 5.0
 * @decimal 1
 */
PARAM_DEFINE_FLOAT(LPE_Z_PUB, 1.0f);

/**
 * Land detector z standard deviation
 *
 * @group Local Position Estimator
 * @unit m
 * @min 0.001
 * @max 10.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_LAND_Z, 0.03f);

/**
 * Land detector xy velocity standard deviation
 *
 * @group Local Position Estimator
 * @unit m/s
 * @min 0.01
 * @max 10.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(LPE_LAND_VXY, 0.05f);

/**
 * Minimum landing target standard covariance, uses reported covariance if greater.
 *
 * @group Local Position Estimator
 * @unit m^2
 * @min 0.0
 * @max 10
 * @decimal 2
 */
PARAM_DEFINE_FLOAT(LPE_LT_COV, 0.0001f);

/**
 * Integer bitmask controlling data fusion
 *
 * Set bits in the following positions to enable:
 * 0 : Set to true to fuse GPS data if available, also requires GPS for altitude init
 * 1 : Set to true to fuse optical flow data if available
 * 2 : Set to true to fuse vision position
 * 3 : Set to true to enable landing target
 * 4 : Set to true to fuse land detector
 * 5 : Set to true to publish AGL as local position down component
 * 6 : Set to true to enable flow gyro compensation
 * 7 : Set to true to enable baro fusion
 *
 * default (145 - GPS, baro, land detector)
 *
 * @group Local Position Estimator
 * @min 0
 * @max 255
 * @bit 0  fuse GPS, requires GPS for alt. init
 * @bit 1  fuse optical flow
 * @bit 2  fuse vision position
 * @bit 3  fuse landing target
 * @bit 4  fuse land detector
 * @bit 5  pub agl as lpos down
 * @bit 6  flow gyro compensation
 * @bit 7  fuse baro
 */
PARAM_DEFINE_INT32(LPE_FUSION, 145);


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.hoac.materialdesigndemo.RecyclerViewDemo">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/my_recycler_view"
        android:scrollbars="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>


text:
<?xml version="1.0"?>
<Document>

	<Sentence>
		<value>Hydramnios may occur in normal pregnancies with more than one baby (twins, triplets, or more).</value>
		<pattern_crowdsource> Hydramnios may occur in normal pregnancies with more than one [[baby|C0021270]] ([[twins|C0041427]], triplets, or more).		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Hydramnios</surface-form>
				<RDF-ID>C0020224</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>normal pregnancies</surface-form>
				<RDF-ID>C0232989</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>more</surface-form>
				<RDF-ID>C0205172</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>one</surface-form>
				<RDF-ID>C0205447</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>baby</surface-form>
				<RDF-ID>C0021270</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>twins</surface-form>
				<RDF-ID>C0041427</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>triplets</surface-form>
				<RDF-ID>C0041095</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>more</surface-form>
				<RDF-ID>C0205172</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0041427 ISA C0021270</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>If you have severe hydramnios, your health care provider will look for these problems:  - Birth defects of the brain and spinal column  - Blockages in the digestive system  - A genetic problem (a problem with the chromosomes that is inherited)   Many times, the cause of hydramnios is not found.</value>
		<pattern_crowdsource> If you have severe [[hydramnios|C0020224]], your health care provider will look for these problems:  - [[Birth defects|C0000768]] of the [[brain|C0006104]] and [[spinal column|C0037949]]  - Blockages in the digestive system  - A genetic problem (a problem with the chromosomes that is inherited)   Many times, the cause of [[hydramnios|C0020224]] is not found.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>severe</surface-form>
				<RDF-ID>C0205082</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>hydramnios</surface-form>
				<RDF-ID>C0020224</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>health care provider</surface-form>
				<RDF-ID>C0018724</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>problems</surface-form>
				<RDF-ID>C1546466</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>Birth defects</surface-form>
				<RDF-ID>C0000768</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>brain</surface-form>
				<RDF-ID>C0006104</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>spinal column</surface-form>
				<RDF-ID>C0037949</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>digestive system</surface-form>
				<RDF-ID>C0012240</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>genetic</surface-form>
				<RDF-ID>C0314603</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>chromosomes</surface-form>
				<RDF-ID>C0008633</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>times</surface-form>
				<RDF-ID>C0040223</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>cause</surface-form>
				<RDF-ID>C0015127</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>hydramnios</surface-form>
				<RDF-ID>C0020224</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>not</surface-form>
				<RDF-ID>C1518422</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0006104 LOCATION_OF C0000768</triple>
			<triple>C0037949 LOCATION_OF C0000768</triple>
			<triple>C0020224 MANIFESTATION_OF C0020224</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>In some cases it is linked to pregnancy in women who have diabetes or when the fetus is very large.</value>
		<pattern_crowdsource> In some cases it is linked to [[pregnancy|C0032961]] in [[women|C0043210]] who have [[diabetes|C0011847]] or when the fetus is very large.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>cases</surface-form>
				<RDF-ID>C0868928</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>pregnancy</surface-form>
				<RDF-ID>C0032961</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>women</surface-form>
				<RDF-ID>C0043210</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>diabetes</surface-form>
				<RDF-ID>C0011847</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>fetus</surface-form>
				<RDF-ID>C0015965</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>very large</surface-form>
				<RDF-ID>C0450093</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0032961 PROCESS_OF C0043210</triple>
			<triple>C0011847 PROCESS_OF C0043210</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Be sure to tell your provider if you have:  - A hard time breathing  - Belly pain  - Swelling or bloating of your belly   To check for hydramnios, your provider will measure your "fundal height" during your prenatal check-ups.</value>
		<pattern_crowdsource> Be sure to tell your [[provider|C1441436]] if you have:  - A hard time breathing  - Belly pain  - Swelling or bloating of your belly   To check for [[hydramnios|C0020224]], your provider will measure your "fundal height" during your prenatal check-ups.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>provider</surface-form>
				<RDF-ID>C1441436</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>hard</surface-form>
				<RDF-ID>C0018599</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>time</surface-form>
				<RDF-ID>C0040223</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>breathing  - Belly pain</surface-form>
				<RDF-ID>C0423729</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>Swelling</surface-form>
				<RDF-ID>C0038999</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>hydramnios</surface-form>
				<RDF-ID>C0020224</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>provider</surface-form>
				<RDF-ID>C1441436</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>fundal height</surface-form>
				<RDF-ID>C0426012</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>prenatal check-ups</surface-form>
				<RDF-ID>C0848224</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C1441436 TREATS C0020224</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Fundal height is the distance from your pubic bone to the top of your uterus.</value>
		<pattern_crowdsource> [[Fundal height|C0426012]] is the distance from your [[pubic bone|C0034014]] to the top of your uterus.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Fundal height</surface-form>
				<RDF-ID>C0426012</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>distance</surface-form>
				<RDF-ID>C0012751</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>pubic bone</surface-form>
				<RDF-ID>C0034014</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>top</surface-form>
				<RDF-ID>C0000811</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>uterus</surface-form>
				<RDF-ID>C0042149</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0034014 LOCATION_OF C0426012</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>- Your provider may also prescribe medicine to prevent a preterm delivery.</value>
		<pattern_crowdsource> - Your [[provider|C1441436]] may also prescribe medicine to prevent a [[preterm delivery|C0151526]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>provider</surface-form>
				<RDF-ID>C1441436</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>medicine</surface-form>
				<RDF-ID>C0025118</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>preterm delivery</surface-form>
				<RDF-ID>C0151526</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C1441436 PREVENTS C0151526</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>- Nonstress tests can be done to make sure the fetus is not in danger (Nonstress tests involve listening to the baby's heart rate and monitoring contractions for 20 to 30 minutes.)</value>
		<pattern_crowdsource> - Nonstress tests can be done to make sure the fetus is not in danger ([[Nonstress tests|C1314734]] involve [[listening|C0018767]] to the baby's heart rate and monitoring contractions for 20 to 30 minutes.)		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Nonstress tests</surface-form>
				<RDF-ID>C1314734</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>fetus</surface-form>
				<RDF-ID>C1305737</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>not</surface-form>
				<RDF-ID>C1518422</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>danger</surface-form>
				<RDF-ID>C0010968</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>Nonstress tests</surface-form>
				<RDF-ID>C1314734</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>listening</surface-form>
				<RDF-ID>C0018767</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>baby's</surface-form>
				<RDF-ID>C0021270</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart rate</surface-form>
				<RDF-ID>C0018810</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>contractions</surface-form>
				<RDF-ID>C1140999</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>30 minutes</surface-form>
				<RDF-ID>C0456693</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C1314734 AFFECTS C0018767</triple>
		</triples>
	</Sentence>

</Document>