text:
#define _USE_MATH_DEFINES

#include "webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.h"

#include <cmath>

namespace {

float BesselJ0(float x) {
#if WEBRTC_WIN
  return _j0(x);
#else
  return j0(x);
#endif
}

}  // namespace

namespace webrtc {

// Calculates the boxcar-angular desired source distribution at a given
// wavenumber, and stores it in |mat|.
void CovarianceMatrixGenerator::Boxcar(float wave_number,
                                       int num_input_channels,
                                       float mic_spacing,
                                       float half_width,
                                       ComplexMatrix<float>* mat) {
  CHECK_EQ(num_input_channels, mat->num_rows());
  CHECK_EQ(num_input_channels, mat->num_columns());

  complex<float>* const* boxcar_elements = mat->elements();

  for (int i = 0; i < num_input_channels; ++i) {
    for (int j = 0; j < num_input_channels; ++j) {
      if (i == j) {
        boxcar_elements[i][j] = complex<float>(2.f * half_width, 0.f);
      } else {
        float factor = (j - i) * wave_number * mic_spacing;
        float boxcar_real = 2.f * sin(factor * half_width) / factor;
        boxcar_elements[i][j] = complex<float>(boxcar_real, 0.f);
      }
    }
  }
}

void CovarianceMatrixGenerator::GappedUniformCovarianceMatrix(
    float wave_number,
    float num_input_channels,
    float mic_spacing,
    float gap_half_width,
    ComplexMatrix<float>* mat) {
  CHECK_EQ(num_input_channels, mat->num_rows());
  CHECK_EQ(num_input_channels, mat->num_columns());

  complex<float>* const* mat_els = mat->elements();
  for (int i = 0; i < num_input_channels; ++i) {
    for (int j = 0; j < num_input_channels; ++j) {
      float x = (j - i) * wave_number * mic_spacing;
      mat_els[i][j] = BesselJ0(x);
    }
  }

  ComplexMatrix<float> boxcar_mat(num_input_channels, num_input_channels);
  CovarianceMatrixGenerator::Boxcar(wave_number,
                                    num_input_channels,
                                    mic_spacing,
                                    gap_half_width,
                                    &boxcar_mat);
  mat->Subtract(boxcar_mat);
}

void CovarianceMatrixGenerator::AngledCovarianceMatrix(
    float sound_speed,
    float angle,
    int frequency_bin,
    int fft_size,
    int num_freq_bins,
    int sample_rate,
    int num_input_channels,
    float mic_spacing,
    ComplexMatrix<float>* mat) {
  CHECK_EQ(num_input_channels, mat->num_rows());
  CHECK_EQ(num_input_channels, mat->num_columns());

  ComplexMatrix<float> interf_cov_vector(1, num_input_channels);
  ComplexMatrix<float> interf_cov_vector_transposed(num_input_channels, 1);
  PhaseAlignmentMasks(frequency_bin,
                      fft_size,
                      sample_rate,
                      sound_speed,
                      mic_spacing,
                      num_input_channels,
                      sin(angle),
                      &interf_cov_vector);
  interf_cov_vector_transposed.Transpose(interf_cov_vector);
  interf_cov_vector.PointwiseConjugate();
  mat->Multiply(interf_cov_vector_transposed, interf_cov_vector);
}

void CovarianceMatrixGenerator::DCCovarianceMatrix(int num_input_channels,
                                                   float half_width,
                                                   ComplexMatrix<float>* mat) {
  CHECK_EQ(num_input_channels, mat->num_rows());
  CHECK_EQ(num_input_channels, mat->num_columns());

  complex<float>* const* elements = mat->elements();

  float diagonal_value = 1.f - 2.f * half_width;
  for (int i = 0; i < num_input_channels; ++i) {
    for (int j = 0; j < num_input_channels; ++j) {
      if (i == j) {
        elements[i][j] = complex<float>(diagonal_value, 0.f);
      } else {
        elements[i][j] = complex<float>(0.f, 0.f);
      }
    }
  }
}

void CovarianceMatrixGenerator::PhaseAlignmentMasks(int frequency_bin,
                                                    int fft_size,
                                                    int sample_rate,
                                                    float sound_speed,
                                                    float mic_spacing,
                                                    int num_input_channels,
                                                    float sin_angle,
                                                    ComplexMatrix<float>* mat) {
  CHECK_EQ(1, mat->num_rows());
  CHECK_EQ(num_input_channels, mat->num_columns());

  float freq_in_hertz =
      (static_cast<float>(frequency_bin) / fft_size) * sample_rate;

  complex<float>* const* mat_els = mat->elements();
  for (int c_ix = 0; c_ix < num_input_channels; ++c_ix) {
    // TODO(aluebs): Generalize for non-uniform-linear microphone arrays.
    float distance = mic_spacing * c_ix * sin_angle * -1.f;
    float phase_shift = 2 * M_PI * distance * freq_in_hertz / sound_speed;

    // Euler's formula for mat[0][c_ix] = e^(j * phase_shift).
    mat_els[0][c_ix] = complex<float>(cos(phase_shift), sin(phase_shift));
  }
}

}  // namespace webrtc


text:
package com.twitter.finagle.tracing

import java.net.InetSocketAddress
import java.nio.ByteBuffer

/**
 * An ADT describing a tracing annotation. Prefer [[Tracing]] API to creating raw [[Annotation]]
 * instances (especially, when used from Java).
 */
sealed abstract class Annotation

object Annotation {

  case object WireSend extends Annotation
  case object WireRecv extends Annotation
  final case class WireRecvError(error: String) extends Annotation
  case object ClientSend extends Annotation
  case object ClientRecv extends Annotation
  final case class ClientRecvError(error: String) extends Annotation
  case object ServerSend extends Annotation
  case object ServerRecv extends Annotation
  final case class ServerSendError(error: String) extends Annotation
  case object ClientSendFragment extends Annotation
  case object ClientRecvFragment extends Annotation
  case object ServerSendFragment extends Annotation
  case object ServerRecvFragment extends Annotation
  final case class Message(content: String) extends Annotation
  final case class ServiceName(service: String) extends Annotation
  final case class Rpc(name: String) extends Annotation
  final case class ClientAddr(ia: InetSocketAddress) extends Annotation
  final case class ServerAddr(ia: InetSocketAddress) extends Annotation
  final case class LocalAddr(ia: InetSocketAddress) extends Annotation

  final case class BinaryAnnotation(key: String, value: Any) extends Annotation {
    /* Needed to not break backwards compatibility.  Can be removed later */
    def this(key: String, value: ByteBuffer) = this(key, value: Any)
  }
}

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycologia 59(1): 87 (1967)

#### Original name
Helminthosporium septosporum Preuss, 1851

### Remarks
null


text:
#include <cstring>
#include <numeric>
#include <random>
#include <vector>

#include "absl/container/flat_hash_map.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
#include "lingvo/core/ops/text_packing.h"
#include "tensorflow/core/framework/bounds_check.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/strings/str_util.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/threadpool.h"

namespace tensorflow {
namespace lingvo {

namespace {

template <int N>
using DSize = Eigen::DSizes<Eigen::DenseIndex, N>;

struct PackSequencesOutputs {
  Tensor* src_segment_ids = nullptr;
  Tensor* src_segment_pos = nullptr;
  Tensor* src_indices_in_input = nullptr;
  Tensor* tgt_segment_ids = nullptr;
  Tensor* tgt_segment_pos = nullptr;
  Tensor* tgt_indices_in_input = nullptr;
};

// The record of packing one input sequence, i.e. a (src, tgt) pair.
struct PackRecord {
  int index_in_input;
  TextPacking::PackingIndex packing;
};
}  // namespace

// An op that outputs a packing pattern based on actual sequence lengths.
class PackSequencesOp : public OpKernel {
 public:
  explicit PackSequencesOp(OpKernelConstruction* ctx) : OpKernel(ctx) {
    int64_t seed;
    OP_REQUIRES_OK(ctx, ctx->GetAttr("seed", &seed));
    OP_REQUIRES_OK(ctx, ctx->GetAttr("packed_batch_size", &packed_batch_size_));
    OP_REQUIRES_OK(ctx,
                   ctx->GetAttr("packed_src_seq_len", &packed_src_seq_len_));
    OP_REQUIRES_OK(ctx,
                   ctx->GetAttr("packed_tgt_seq_len", &packed_tgt_seq_len_));
    if (seed == 0) {
      // If seed is unspecified, use completely random seed.
      std::random_device device("/dev/urandom");
      seed = std::mt19937_64(device())();
    }
    rnd_.seed(seed);
  }

  ~PackSequencesOp() override {}

  void Compute(OpKernelContext* ctx) override {
    ValidateInputs(ctx);
    if (!ctx->status().ok()) {
      return;
    }

    const auto input_num = ctx->input(0).vec<int32>().size();
    std::vector<PackRecord> pack_records;
    pack_records.reserve(input_num);
    const int output_num = PackEntireInputs(ctx, &pack_records);

    bool dropping_inputs;
    absl::flat_hash_map<int, int> new_indices;
    PackSequencesOutputs outputs;
    if (packed_batch_size_ == 0) {
      AllocateOutputs(ctx, &outputs, output_num);
      dropping_inputs = false;
    } else {
      AllocateOutputs(ctx, &outputs, packed_batch_size_);
      dropping_inputs = DropPackedRows(ctx, output_num, &new_indices);
    }
    WriteOutputs(ctx, pack_records, dropping_inputs, &new_indices, &outputs);
  }

 private:
  // Validates the shapes and types of inputs.
  void ValidateInputs(OpKernelContext* ctx);

  // Allocates (and zero initializes) all outputs.
  void AllocateOutputs(OpKernelContext* ctx, PackSequencesOutputs* outputs,
                       const int32 packed_batch_size);

  // Pack entire inputs. Returns the number of rows needed to pack all of input
  // sequences. Also outputs the packing records.
  int PackEntireInputs(OpKernelContext* ctx,
                       std::vector<PackRecord>* pack_records);

  // Returns whether we need to drop packed rows, and if so, returns a mapping
  // from the original output row index to its new index after dropping.
  bool DropPackedRows(OpKernelContext* ctx, int num_rows,
                      absl::flat_hash_map<int, int>* new_indices);

  // Writes the packing results to the output tensors.
  void WriteOutputs(OpKernelContext* ctx,
                    const std::vector<PackRecord>& pack_records,
                    bool dropping_inputs,
                    const absl::flat_hash_map<int, int>* new_indices,
                    PackSequencesOutputs* outputs);

  int packed_batch_size_;
  int packed_src_seq_len_;
  int packed_tgt_seq_len_;
  mutable absl::Mutex mu_;
  // Used for randomizing the dropping of input rows when needed.
  std::mt19937 rnd_ ABSL_GUARDED_BY(mu_);
  int64_t total_src_tokens_ ABSL_GUARDED_BY(mu_) = 0;
  int64_t total_tgt_tokens_ ABSL_GUARDED_BY(mu_) = 0;
  int64_t total_examples_ ABSL_GUARDED_BY(mu_) = 0;
  int64_t total_packed_records_ ABSL_GUARDED_BY(mu_) = 0;
  int64_t total_dropped_packed_records_ ABSL_GUARDED_BY(mu_) = 0;

  TF_DISALLOW_COPY_AND_ASSIGN(PackSequencesOp);
};

void PackSequencesOp::ValidateInputs(OpKernelContext* ctx) {
  const Tensor& src_actual_seq_len = ctx->input(0);
  OP_REQUIRES(ctx,
              TensorShapeUtils::IsVector(src_actual_seq_len.shape()) &&
                  (src_actual_seq_len.dtype() == DataType::DT_INT32),
              errors::InvalidArgument(
                  "src_actual_seq_len must be a vector of int32, got: ",
                  src_actual_seq_len.DebugString()));
  const Tensor& tgt_actual_seq_len = ctx->input(1);
  OP_REQUIRES(ctx,
              TensorShapeUtils::IsVector(tgt_actual_seq_len.shape()) &&
                  (tgt_actual_seq_len.dtype() == DataType::DT_INT32),
              errors::InvalidArgument(
                  "tgt_actual_seq_len must be a vector of int32, got: ",
                  tgt_actual_seq_len.DebugString()));
  OP_REQUIRES(ctx, src_actual_seq_len.shape() == tgt_actual_seq_len.shape(),
              errors::InvalidArgument(
                  "src_actual_seq_len must be the same shape as "
                  "tgt_actual_seq_len, got: src shape ",
                  src_actual_seq_len.shape().DebugString(), " vs. tgt shape ",
                  tgt_actual_seq_len.shape().DebugString()));
}

void PackSequencesOp::AllocateOutputs(OpKernelContext* ctx,
                                      PackSequencesOutputs* outputs,
                                      const int32 packed_batch_size) {
  TensorShape packed_src_shape({packed_batch_size, packed_src_seq_len_});
  TensorShape packed_tgt_shape({packed_batch_size, packed_tgt_seq_len_});

  int output_id = 0;
  OP_REQUIRES_OK(ctx, ctx->allocate_output(output_id++, packed_src_shape,
                                           &outputs->src_segment_ids));
  OP_REQUIRES_OK(ctx, ctx->allocate_output(output_id++, packed_src_shape,
                                           &outputs->src_segment_pos));
  OP_REQUIRES_OK(ctx, ctx->allocate_output(output_id++, packed_src_shape,
                                           &outputs->src_indices_in_input));
  outputs->src_segment_ids->matrix<int32>().setZero();
  outputs->src_segment_pos->matrix<int32>().setZero();
  outputs->src_indices_in_input->matrix<int32>().setZero();

  OP_REQUIRES_OK(ctx, ctx->allocate_output(output_id++, packed_tgt_shape,
                                           &outputs->tgt_segment_ids));
  OP_REQUIRES_OK(ctx, ctx->allocate_output(output_id++, packed_tgt_shape,
                                           &outputs->tgt_segment_pos));
  OP_REQUIRES_OK(ctx, ctx->allocate_output(output_id++, packed_tgt_shape,
                                           &outputs->tgt_indices_in_input));
  outputs->tgt_segment_ids->matrix<int32>().setZero();
  outputs->tgt_segment_pos->matrix<int32>().setZero();
  outputs->tgt_indices_in_input->matrix<int32>().setZero();
}

int PackSequencesOp::PackEntireInputs(OpKernelContext* ctx,
                                      std::vector<PackRecord>* pack_records) {
  const auto& src_actual_seq_len = ctx->input(0).vec<int32>();
  const auto& tgt_actual_seq_len = ctx->input(1).vec<int32>();
  const auto input_num = src_actual_seq_len.size();

  // We ask for a sufficiently large output batch size to pack all input
  // sequences in its entirety. We drop input sequences if needed afterward,
  // We also ensure that the first `packed_batch_size` rows are never empty
  // by packing into them first.
  TextPacking packing(/*columns=*/2, /*batch=*/input_num,
                      {packed_src_seq_len_, packed_tgt_seq_len_},
                      /*align=*/1,
                      /*pack=*/true, /*spread_first_n=*/packed_batch_size_);
  int max_output_batch_idx = 0;
  int64_t total_src_seq_len = 0, total_tgt_seq_len = 0;
  for (int i = 0; i < input_num; ++i) {
    int src_seq_len = src_actual_seq_len(i);
    int tgt_seq_len = tgt_actual_seq_len(i);
    if (src_seq_len < 1 || tgt_seq_len < 1) {
      LOG_EVERY_N(WARNING, 500)
          << "Input sequence with lengths (src=" << src_seq_len
          << ", tgt=" << tgt_seq_len
          << ") dropped as only positive actual lengths are allowed.";
      continue;
    }
    PackRecord p;
    p.index_in_input = i;
    if (!packing.Add({src_seq_len, tgt_seq_len}, &p.packing)) {
      // This only happens when the actual sequence length of the input is
      // larger than the packed sequence length specified on the output.
      LOG_EVERY_N(WARNING, 500)
          << "Input sequence with lengths (src=" << src_seq_len
          << ", tgt=" << tgt_seq_len
          << ") dropped as its lengths exceed the output sequence length.";
      continue;
    }
    max_output_batch_idx = std::max(p.packing.batch, max_output_batch_idx);
    pack_records->push_back(p);
    total_src_seq_len += src_seq_len;
    total_tgt_seq_len += tgt_seq_len;
  }
  int num_packed_records = max_output_batch_idx + 1;
  {
    absl::MutexLock l(&mu_);
    total_src_tokens_ += total_src_seq_len;
    total_tgt_tokens_ += total_tgt_seq_len;
    total_examples_ += input_num;
    total_packed_records_ += num_packed_records;
    if (packed_batch_size_ > 0 && num_packed_records > packed_batch_size_) {
      total_dropped_packed_records_ += num_packed_records - packed_batch_size_;
    }
    LOG_EVERY_N_SEC(INFO, 60)
        << "Total packed " << total_examples_ << " examples into "
        << total_packed_records_ << " rows, dropped "
        << total_dropped_packed_records_
        << " rows. Average tokens per example: src="
        << 1. * total_src_tokens_ / total_examples_ << ", tgt="
        << 1. * total_tgt_tokens_ / total_examples_
        << ". Post-packing space utilization: src="
        << 1. * total_src_tokens_ / total_packed_records_ / packed_src_seq_len_
        << ", tgt="
        << 1. * total_tgt_tokens_ / total_packed_records_ / packed_tgt_seq_len_;
  }
  return num_packed_records;
}

bool PackSequencesOp::DropPackedRows(
    OpKernelContext* ctx, int num_rows,
    absl::flat_hash_map<int, int>* new_indices) {
  if (num_rows <= packed_batch_size_) {
    return false;
  }

  // Simple reservoir sampling to pick `packed_batch_size` items out of
  // `num_rows`:
  // https://en.wikipedia.org/wiki/Reservoir_sampling#Simple_algorithm
  std::vector<int> indices_kept(packed_batch_size_);
  for (int i = 1; i < packed_batch_size_; ++i) {
    indices_kept[i] = i;
  }
  for (int i = packed_batch_size_; i < num_rows; ++i) {
    std::uniform_int_distribution<> distribution(0, i);
    int j;  // Uniformly picked on [0, i].
    {
      absl::MutexLock l(&mu_);
      j = distribution(rnd_);
    }
    if (j < packed_batch_size_) {
      indices_kept[j] = i;
    }
  }
  for (int i = 0; i < packed_batch_size_; ++i) {
    new_indices->insert({indices_kept[i], i});
  }
  return true;
}

void PackSequencesOp::WriteOutputs(
    OpKernelContext* ctx, const std::vector<PackRecord>& pack_records,
    bool dropping_inputs, const absl::flat_hash_map<int, int>* new_indices,
    PackSequencesOutputs* outputs) {
  const auto& src_actual_seq_len = ctx->input(0).vec<int32>();
  const auto& tgt_actual_seq_len = ctx->input(1).vec<int32>();

  auto src_segment_ids = outputs->src_segment_ids->matrix<int32>();
  auto src_segment_pos = outputs->src_segment_pos->matrix<int32>();
  auto src_indices_in_input = outputs->src_indices_in_input->matrix<int32>();
  auto tgt_segment_ids = outputs->tgt_segment_ids->matrix<int32>();
  auto tgt_segment_pos = outputs->tgt_segment_pos->matrix<int32>();
  auto tgt_indices_in_input = outputs->tgt_indices_in_input->matrix<int32>();

  for (const auto& p : pack_records) {
    int output_idx = p.packing.batch;
    if (dropping_inputs) {
      auto new_idx_iter = new_indices->find(output_idx);
      if (new_idx_iter == new_indices->end()) {
        // This row is being dropped.
        continue;
      }
      output_idx = new_idx_iter->second;
    }
    const int src_seq_idx = p.packing.time[0];
    for (int i = 0; i < src_actual_seq_len(p.index_in_input); ++i) {
      src_segment_ids(output_idx, src_seq_idx + i) = p.packing.seq;
      src_segment_pos(output_idx, src_seq_idx + i) = i;
      src_indices_in_input(output_idx, src_seq_idx + i) = p.index_in_input;
    }
    const int tgt_seq_idx = p.packing.time[1];
    for (int i = 0; i < tgt_actual_seq_len(p.index_in_input); ++i) {
      tgt_segment_ids(output_idx, tgt_seq_idx + i) = p.packing.seq;
      tgt_segment_pos(output_idx, tgt_seq_idx + i) = i;
      tgt_indices_in_input(output_idx, tgt_seq_idx + i) = p.index_in_input;
    }
  }
}

REGISTER_KERNEL_BUILDER(Name("PackSequences").Device(DEVICE_CPU),
                        PackSequencesOp);

// Pack a sequence into a smaller batch given a max length constraint.
// The output batch size is dynamic. No examples are dropped.
class PackSingleSequenceOp : public OpKernel {
 public:
  explicit PackSingleSequenceOp(OpKernelConstruction* ctx) : OpKernel(ctx) {
    OP_REQUIRES_OK(ctx, ctx->GetAttr("max_packed_length", &max_packed_length_));
    OP_REQUIRES_OK(ctx, ctx->GetAttr("require_sequential_order",
                                     &require_sequential_order_));
  }

  void Compute(OpKernelContext* ctx) override {
    const Tensor& input_lengths_t = ctx->input(0);
    const auto& input_lengths = input_lengths_t.vec<int32>();
    const int batch_size = input_lengths.dimension(0);

    for (int i = 0; i < batch_size; ++i) {
      OP_REQUIRES(
          ctx,
          tensorflow::FastBoundsCheck(input_lengths(i), max_packed_length_ + 1),
          errors::InvalidArgument(
              "Input length at index ", i, " is too long: ", input_lengths(i),
              " vs max_packed_length ", max_packed_length_));
    }

    // The index of the output to write to.
    std::vector<int32> output_index;
    int packed_batch_size = ComputeOutputIndex(input_lengths_t, &output_index);

    Tensor* segment_ids_t = nullptr;
    Tensor* indices_in_input_t = nullptr;

    OP_REQUIRES_OK(
        ctx, ctx->allocate_output(0, {packed_batch_size, max_packed_length_},
                                  &segment_ids_t));
    OP_REQUIRES_OK(
        ctx, ctx->allocate_output(1, {packed_batch_size, max_packed_length_},
                                  &indices_in_input_t));

    auto segment_ids = segment_ids_t->matrix<int32>();
    segment_ids.setZero();
    auto indices_in_input = indices_in_input_t->matrix<int32>();
    indices_in_input.setConstant(-1);

    // Current lengths for each packed sequence.
    std::vector<int32> current_lengths(packed_batch_size, 0);
    // Current segment id for each packed sequence.
    std::vector<int32> current_segment_id(packed_batch_size, 1);

    for (int i = 0; i < batch_size; ++i) {
      int idx = output_index[i];
      segment_ids
          .slice(DSize<2>{idx, current_lengths[idx]},
                 DSize<2>{1, input_lengths(i)})
          .setConstant(current_segment_id[idx]);
      indices_in_input
          .slice(DSize<2>{idx, current_lengths[idx]},
                 DSize<2>{1, input_lengths(i)})
          .setConstant(i);
      current_lengths[idx] += input_lengths(i);
      current_segment_id[idx]++;
    }
  }

 private:
  int max_packed_length_;
  bool require_sequential_order_;

  // Populates output_index with the index that each input example should be
  // placed into, and returns the total number of bins used.
  int ComputeOutputIndex(const Tensor& input_lengths_t,
                         std::vector<int32>* output_index);

  TF_DISALLOW_COPY_AND_ASSIGN(PackSingleSequenceOp);
};

int PackSingleSequenceOp::ComputeOutputIndex(const Tensor& input_lengths_t,
                                             std::vector<int32>* output_index) {
  const auto& input_lengths = input_lengths_t.vec<int32>();
  const int batch_size = input_lengths.dimension(0);
  output_index->resize(batch_size);

  // Current lengths for each packed sequence.
  std::vector<int32> current_lengths;

  if (require_sequential_order_) {
    // Append each input in sequence to the last element.
    for (int i = 0; i < batch_size; ++i) {
      if (current_lengths.empty() ||
          current_lengths.back() + input_lengths(i) > max_packed_length_) {
        // Start a new bin.
        current_lengths.push_back(0);
      }
      // Add this input to the last bin.
      output_index->at(i) = current_lengths.size() - 1;
      current_lengths.back() += input_lengths(i);
    }
  } else {
    std::vector<int> idx(batch_size);
    for (int i = 0; i < batch_size; ++i) {
      idx[i] = i;
    }
    // Sort by lengths descending.
    std::sort(idx.begin(), idx.end(), [&](int i, int j) {
      return std::make_pair(input_lengths(i), -i) >
             std::make_pair(input_lengths(j), -j);
    });
    // Best Fit Decreasing as it is easiest to implement in nlogn.
    // Maintain a Binary Search Tree of (remaining_space, bin_id).
    std::multiset<std::pair<int32, int32>> lookup;
    for (int i = 0; i < batch_size; ++i) {
      // First element with remaining_space >= input_length.
      auto it = lookup.lower_bound(std::make_pair(input_lengths(idx[i]), -1));
      if (it == lookup.end()) {
        // Start a new bin.
        current_lengths.push_back(0);
        it = lookup.insert(
            std::make_pair(max_packed_length_, current_lengths.size() - 1));
      }

      // Add to the bin.
      int bin_id = it->second;
      output_index->at(idx[i]) = bin_id;

      lookup.erase(it);
      current_lengths[bin_id] += input_lengths(idx[i]);
      lookup.insert(
          std::make_pair(max_packed_length_ - current_lengths[bin_id], bin_id));
    }
  }
  return current_lengths.size();
}

REGISTER_KERNEL_BUILDER(Name("PackSingleSequence").Device(DEVICE_CPU),
                        PackSingleSequenceOp);

// An op that applies a packing pattern on an input data.
template <typename T>
class ApplyPackingOp : public OpKernel {
 public:
  explicit ApplyPackingOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}

  ~ApplyPackingOp() override {}

  void Compute(OpKernelContext* ctx) override {
    if (!ctx->status().ok()) {
      return;
    }
    const Tensor& input = ctx->input(0);
    if (TensorShapeUtils::IsMatrixOrHigher(input.shape())) {
      // Input is a matrix. We apply the packing pattern by returning a
      // denser, shorter matrix where the elements are re-arranged.
      Tensor* output = nullptr;
      // Allocates output and initializes with padding.
      const Tensor& segment_ids = ctx->input(2);
      auto output_dim_sizes = input.shape().dim_sizes();
      output_dim_sizes[0] = segment_ids.shape().dim_size(0);
      output_dim_sizes[1] = segment_ids.shape().dim_size(1);
      OP_REQUIRES_OK(
          ctx, ctx->allocate_output(0, TensorShape(output_dim_sizes), &output));
      const T padding = ctx->input(1).scalar<T>()();
      output->flat<T>().setConstant(padding);
      ApplyMatrix(ctx, output);
      return;
    }
    // Input is a vector. We apply the packing patterning by returning a
    // shorter vector where the elements are summed.
    Tensor* output = nullptr;
    TensorShape output_shape({ctx->input(3).shape().dim_size(0)});
    OP_REQUIRES_OK(ctx, ctx->allocate_output(0, output_shape, &output));
    ApplyVector(ctx, output);
  }

 private:
  void ApplyMatrix(OpKernelContext* ctx, Tensor* output) {
    if (ctx->input(0).NumElements() == 0) return;
    const auto& input = ctx->input(0).flat_outer_dims<T, 3>();
    const auto input_rows = input.dimension(0);
    const auto input_columns = input.dimension(1);
    const auto input_dim = input.dimension(2);
    const auto& segment_ids = ctx->input(2).matrix<int32>();
    const auto& indices_in_input = ctx->input(3).matrix<int32>();
    auto output_3d = output->flat_outer_dims<T, 3>();
    const int64_t rows = output->dim_size(0);
    const int64_t columns = output->dim_size(1);
    // The CPU cost per each row is linear in the number of elements in that
    // row
    // (`columns`). We need to read segment_ids to discern each segment, and
    // copy from input to output, plus a few extra cycles (e.g. checking
    // bounds). The constant is guesstimated to be 4.
    const int64_t cost_per_unit = columns << 2;
    ctx->device()->tensorflow_cpu_worker_threads()->workers->ParallelFor(
        rows, cost_per_unit, [&](int64_t begin, int64_t end) {
          for (int i = begin; i < end; ++i) {
            for (int j = 0; j < columns; ++j) {
              if (segment_ids(i, j) <= 0) {
                // We do not skip the rest of the row because we cannot assume
                // 0 segment ids only occur at end of row. For example, it
                // might occur due to alignment requirements during packing.
                continue;
              }
              const int start = j;
              for (; j + 1 < columns &&
                     segment_ids(i, j) == segment_ids(i, j + 1);
                   ++j) {
              }
              // [start, j] have the same, positive segment_ids.
              const int actual_seq_len = j - start + 1;
              // At output position (i, start), we need to copy over
              // `actual_seq_len` T values from the input.
              const int index_in_input = indices_in_input(i, start);
              OP_REQUIRES(
                  ctx,
                  tensorflow::FastBoundsCheck(index_in_input, input_rows) &&
                      tensorflow::FastBoundsCheck(actual_seq_len,
                                                  input_columns + 1),
                  errors::InvalidArgument(
                      "out of bound found packing at (", i, ", ", start,
                      ") for input index ", index_in_input, " with length ",
                      actual_seq_len, " where input shape is ",
                      ctx->input(0).shape().DebugString()));
              output_3d.slice(DSize<3>{i, start, 0},
                              DSize<3>{1, actual_seq_len, input_dim}) =
                  input.slice(DSize<3>{index_in_input, 0, 0},
                              DSize<3>{1, actual_seq_len, input_dim});
            }
          }
        });
  }

  void ApplyVector(OpKernelContext* ctx, Tensor* output) {
    const auto& input = ctx->input(0).vec<T>();
    const auto num_input_rows = ctx->input(0).dim_size(0);
    const auto& segment_ids = ctx->input(2).matrix<int32>();
    const auto& indices_in_input = ctx->input(3).matrix<int32>();
    auto output_vec = output->vec<T>();
    for (int i = 0; i < output->dim_size(0); ++i) {
      // input_rows condenses row i of indices_in_input, e.g. from
      // [0, 0, 0, 3, 3, 4, 4, 4, 4, 0, 0] to [0, 3, 4].
      std::vector<int64_t> input_rows;
      for (int j = 0; j < ctx->input(3).dim_size(1); ++j) {
        auto row = indices_in_input(i, j);
        if (segment_ids(i, j) &&
            (input_rows.empty() || input_rows.back() != row)) {
          OP_REQUIRES(ctx, tensorflow::FastBoundsCheck(row, num_input_rows),
                      errors::InvalidArgument(
                          "out of bound found packing at (", i, ", ", j,
                          ") for input index ", row, " where input shape is ",
                          ctx->input(0).shape().DebugString()));
          input_rows.push_back(row);
        }
      }
      std::vector<T> elements;
      elements.reserve(input_rows.size());
      for (auto row : input_rows) {
        elements.push_back(input(row));
      }
      // Output on row i is the reduce_sum of the elements on that row.
      output_vec(i) =
          std::accumulate(elements.begin(), elements.end(), static_cast<T>(0));
    }
  }

  TF_DISALLOW_COPY_AND_ASSIGN(ApplyPackingOp);
};

template <>
class ApplyPackingOp<::tensorflow::tstring> : public OpKernel {
 public:
  explicit ApplyPackingOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}

  ~ApplyPackingOp() override {}

  void Compute(OpKernelContext* ctx) override {
    ValidateInputs(ctx);
    if (!ctx->status().ok()) {
      return;
    }
    Tensor* output = nullptr;
    TensorShape output_shape({ctx->input(3).shape().dim_size(0)});
    OP_REQUIRES_OK(ctx, ctx->allocate_output(0, output_shape, &output));
    Apply(ctx, output);
  }

 private:
  // Validates the shapes and types of inputs.
  void ValidateInputs(OpKernelContext* ctx) {
    const Tensor& input = ctx->input(0);
    OP_REQUIRES(
        ctx, TensorShapeUtils::IsVector(input.shape()),
        errors::InvalidArgument("input must be a vector, got input shape: ",
                                input.shape().DebugString()));

    const Tensor& padding = ctx->input(1);
    OP_REQUIRES(
        ctx, TensorShapeUtils::IsScalar(padding.shape()),
        errors::InvalidArgument("padding must be a scalar, got padding shape: ",
                                padding.shape().DebugString()));

    const Tensor& segment_ids = ctx->input(2);
    const Tensor& indices_in_input = ctx->input(3);
    OP_REQUIRES(
        ctx,
        segment_ids.shape() == indices_in_input.shape() &&
            TensorShapeUtils::IsMatrix(segment_ids.shape()),
        errors::InvalidArgument("segment_ids and indices_in_input must be "
                                "matrices of the same shape, got: ",
                                segment_ids.shape().DebugString(), " vs. ",
                                indices_in_input.shape().DebugString()));
  }

  void Apply(OpKernelContext* ctx, Tensor* output) {
    const auto& input = ctx->input(0).vec<::tensorflow::tstring>();
    const auto num_input_rows = ctx->input(0).dim_size(0);
    const auto& segment_ids = ctx->input(2).matrix<int32>();
    const auto& indices_in_input = ctx->input(3).matrix<int32>();
    auto output_vec = output->vec<::tensorflow::tstring>();
    const auto& sep = ctx->input(1).scalar<::tensorflow::tstring>()();
    for (int i = 0; i < output->dim_size(0); ++i) {
      // input_rows condenses row i of indices_in_input, e.g. from
      // [0, 0, 0, 3, 3, 4, 4, 4, 4, 0, 0] to [0, 3, 4].
      std::vector<int64_t> input_rows;
      for (int j = 0; j < ctx->input(3).dim_size(1); ++j) {
        auto row = indices_in_input(i, j);
        if (segment_ids(i, j) &&
            (input_rows.empty() || input_rows.back() != row)) {
          OP_REQUIRES(ctx, tensorflow::FastBoundsCheck(row, num_input_rows),
                      errors::InvalidArgument(
                          "out of bound found packing at (", i, ", ", j,
                          ") for input index ", row, " where input shape is ",
                          ctx->input(0).shape().DebugString()));
          input_rows.push_back(row);
        }
      }
      std::vector<absl::string_view> strs;
      strs.reserve(input_rows.size());
      for (auto row : input_rows) {
        strs.push_back(input(row));
      }
      // Output on row i is the joined input strings for that row.
      output_vec(i) = absl::StrJoin(strs, sep);
    }
  }

  TF_DISALLOW_COPY_AND_ASSIGN(ApplyPackingOp);
};

#define REGISTER(TYPE)                                                   \
  REGISTER_KERNEL_BUILDER(                                               \
      Name("ApplyPacking").Device(DEVICE_CPU).TypeConstraint<TYPE>("T"), \
      ApplyPackingOp<TYPE>);

TF_CALL_float(REGISTER);
TF_CALL_double(REGISTER);
TF_CALL_bfloat16(REGISTER);
TF_CALL_int32(REGISTER);
TF_CALL_int64(REGISTER);
TF_CALL_uint32(REGISTER);
TF_CALL_uint64(REGISTER);
TF_CALL_bool(REGISTER);
TF_CALL_string(REGISTER);

#undef REGISTER

}  // namespace lingvo
}  // namespace tensorflow


text:
Answer to stack overflow question 29987564 http://stackoverflow.com/questions/29987564/node-js-get-request-returns-404-not-found

To Use
================================================================================

```
cf push myappname
```

Replace myapp name with the name of your app (ex. node-txt-fetcher)

or click the button below

[![Deploy to Bluemix](https://bluemix.net/deploy/button.png)](https://bluemix.net/deploy?repository=https://github.com/jsloyer/stackoverflow-question-29987564.git)

license
================================================================================

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

<http://www.apache.org/licenses/LICENSE-2.0>

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


text:
import Ember from 'ember';

/**
 * Calculates the percentage given two params
 * @param params The arguments for percentage
 * @returns The percentage in the form PP.PP%
 */
export function getPercentage(params) {
  let [arg1, arg2] = params;
  if(Number(arg2)===0) {
    return "0%";
  }

  var percentage = ( arg1 / arg2 ) * 100;
  var percentString = percentage.toFixed(2).toString()+ "%";
  return percentString;
}

export default Ember.Helper.helper(getPercentage);


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ca.ljz.winter.security.interceptors</title>
<meta name="date" content="2017-02-04">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

ca.ljz.winter.security.interceptors

Classes

AuthorizationInterceptor


text:
<!doctype html>

    <title>Code coverage report for app\pages\notes\notes.ts</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../../prettify.css" />
    <link rel="stylesheet" href="../../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      all files / app/pages/notes/ notes.ts

        74.42%
        Statements
        32/43

        87.88%
        Branches
        29/33

        54.55%
        Functions
        6/11

        64.29%
        Lines
        18/28

        3 statements, 15 branches
        Ignored

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62	1×
1×
1×
1×

1×

2×

2×
2×
2×

2×

2×

2×
2×
1×

1×

1×

1×

import {Page, NavController, Events, Alert} from "ionic-angular";
import {EditPage} from "../edit/edit";
import {NoteService} from "../../services/note-service/note-service";
import {Note} from "../../models/note";

@Page({
  templateUrl: "build/pages/home/home.html",
})
export class Notes {
  notes: Note[];

  constructor(public nav: NavController,
    public ns: NoteService,
    public events: Events) {

    this.loadNotes();

    events.subscribe("refreshNotes", () => {
      this.loadNotes();
    });

  }

  loadNotes() {
    this.ns.findAll().then((data) =>
      this.notes = data
    );
  }

  editNote(n: Note) {
    console.log(n);
    if (n == null || n === undefined)
      n = new Note();

    this.nav.push(EditPage, { "note": n });
  }

  deleteNote(n: Note) {
    let prompt = Alert.create({
      message: "Delete " + n.title + "?",
      buttons: [{
        text: "Cancel",
        role: "cancel",
        handler: () => {
          console.log("Cancel clicked");
        }
      },
      {
        text: "Delete",
        handler: () => {
          this.ns.delete(n);
          this.events.publish("refreshNotes");
        }
      }]
    });
    this.nav.present(prompt);
  }
}

  Code coverage
  generated by istanbul at Fri Jun 03 2016 22:15:49 GMT+0800 (China Standard Time)


text:
/*
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/**
 * @file
 * @ingroup lavu
 * Utility Preprocessor macros
 */

#ifndef AVUTIL_MACROS_H
#define AVUTIL_MACROS_H

/**
 * @addtogroup preproc_misc Preprocessor String Macros
 *
 * String manipulation macros
 *
 * @{
 */

#define AV_STRINGIFY(s)         AV_TOSTRING(s)
#define AV_TOSTRING(s) #s

#define AV_GLUE(a, b) a ## b
#define AV_JOIN(a, b) AV_GLUE(a, b)

/**
 * @}
 */

#define AV_PRAGMA(s) _Pragma(#s)

#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))

#endif /* AVUTIL_MACROS_H */


text:
YUI.add('moodle-block_xp-notification', function (Y, NAME) {

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * @module moodle-block_xp-notification
 */

var NAME = 'moodle-block_xp-notification';
var COMPONENT = 'block_xp';
var CSS = {
    BADGE: 'level-badge',
    CONTENT: 'level-message-content',
    HEADLINE: 'level-headline',
    PREFIX: 'block_xp-notification',
    WRAP: 'wrapper',
};

/**
 * Notification.
 *
 * @namespace Y.M.block_xp
 * @class Notification
 * @constructor
 */
var NOTIFICATION = function() {
    NOTIFICATION.superclass.constructor.apply(this, arguments);
};
Y.namespace('M.block_xp').Notification = Y.extend(NOTIFICATION, M.core.dialogue, {

    initializer: function() {
        this.display();
    },

    close: function() {
        this.hide();
    },

    display: function() {
        var footerTpl,
            content,
            tpl;

        tpl = Y.Handlebars.compile(
            '
' +
                '
' +
                    '{{headline}}' +
                '
' +
                '
' +
                    '{{{badge}}}' +
                '
' +
                '
' +
                    '{{{message}}}' +
                '
' +
            '
');

        // Set the header.
        this.getStdModNode(Y.WidgetStdMod.HEADER).prepend(Y.Node.create('
' + this.get('title') + '
'));

        // Set the content.
        content = Y.Node.create(
            tpl({
                badge: this.get('badge'),
                CSS: CSS,
                headline: this.get('headline'),
                message: this.get('message')
            })
        );
        this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);

        // Set the footer.
        footerTpl = Y.Handlebars.compile('<button>{{close}}</button>');
        content = Y.Node.create(
            footerTpl({
                close: M.util.get_string('coolthanks', COMPONENT)
            })
        );
        content.on('click', this.close, this);
        this.setStdModContent(Y.WidgetStdMod.FOOTER, content, Y.WidgetStdMod.REPLACE);

        // Use standard dialogue class name. This removes the default styling of the footer.
        this.get('boundingBox').one('.moodle-dialogue-wrap').addClass('moodle-dialogue-content');

        // Change the visibility.
        this.show();
    }

}, {
    NAME: NAME,
    CSS_PREFIX: CSS.PREFIX,
    ATTRS: {

        badge: {
            validator: Y.Lang.isString,
            value: ''
        },

        headline: {
            validator: Y.Lang.isString,
            value: ''
        },

        level: {
            validator: Y.Lang.isNumber,
            value: 0
        },

        message: {
            validator: Y.Lang.isString,
            value: ''
        }

    }
});

Y.Base.modifyAttrs(Y.namespace('M.block_xp.Notification'), {

    /**
     * List of extra classes.
     *
     * @attribute extraClasses
     * @default [COMPONENT]
     * @type Array
     */
    extraClasses: {
        value: [
            COMPONENT
        ]
    },

    modal: {
        value: true
    },

    render: {
        value: true
    },

    title: {
        valueFn: function() {
            return M.util.get_string('congratulationsyouleveledup', COMPONENT);
        }
    },

    visible: {
        value: false
    }
});

Y.namespace('M.block_xp.Notification').init = function(config) {
    return new NOTIFICATION(config);
};

}, '@VERSION@', {"requires": ["base", "node", "handlebars", "button-plugin", "moodle-core-notification-dialogue"]});


text:
<?php

use yii\db\Schema;
use yii\db\Migration;

class m150914_094715_orderby extends Migration
{
    public function up()
    {
        $this->addColumn('portfolio', 'orderby', $this->integer());
        $this->addColumn('team', 'orderby', $this->integer());
        $this->addColumn('recall', 'orderby', $this->integer());
    }

    public function down()
    {
        $this->dropColumn('portfolio', 'orderby');
        $this->dropColumn('team', 'orderby');
        $this->dropColumn('recall', 'orderby');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}


text:
import medication_statement_dosage_component from 'ember-fhir-adapter/models/medication-statement-dosage-component';
export default medication_statement_dosage_component;


text:
/********************************************************************************
** Form generated from reading UI file 'CQWebGet.ui'
**
** Created by: Qt User Interface Compiler version 5.5.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_CQWEBGET_H
#define UI_CQWEBGET_H

#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTreeWidget>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>

QT_BEGIN_NAMESPACE

class Ui_QWebGet
{
public:
    QAction *action_Quit;
    QAction *action_Help;
    QWidget *centralwidget;
    QVBoxLayout *vboxLayout;
    QVBoxLayout *vboxLayout1;
    QHBoxLayout *hboxLayout;
    QLabel *label;
    QLineEdit *urlText;
    QTreeWidget *urlTree;
    QMenuBar *menubar;
    QMenu *menu_Help;
    QMenu *menuFile;
    QStatusBar *statusbar;

    void setupUi(QMainWindow *QWebGet)
    {
        if (QWebGet->objectName().isEmpty())
            QWebGet->setObjectName(QStringLiteral("QWebGet"));
        QWebGet->resize(777, 572);
        action_Quit = new QAction(QWebGet);
        action_Quit->setObjectName(QStringLiteral("action_Quit"));
        action_Help = new QAction(QWebGet);
        action_Help->setObjectName(QStringLiteral("action_Help"));
        centralwidget = new QWidget(QWebGet);
        centralwidget->setObjectName(QStringLiteral("centralwidget"));
        vboxLayout = new QVBoxLayout(centralwidget);
#ifndef Q_OS_MAC
        vboxLayout->setSpacing(6);
#endif
#ifndef Q_OS_MAC
        vboxLayout->setContentsMargins(9, 9, 9, 9);
#endif
        vboxLayout->setObjectName(QStringLiteral("vboxLayout"));
        vboxLayout1 = new QVBoxLayout();
#ifndef Q_OS_MAC
        vboxLayout1->setSpacing(6);
#endif
#ifndef Q_OS_MAC
        vboxLayout1->setContentsMargins(0, 0, 0, 0);
#endif
        vboxLayout1->setObjectName(QStringLiteral("vboxLayout1"));
        hboxLayout = new QHBoxLayout();
#ifndef Q_OS_MAC
        hboxLayout->setSpacing(6);
#endif
#ifndef Q_OS_MAC
        hboxLayout->setContentsMargins(0, 0, 0, 0);
#endif
        hboxLayout->setObjectName(QStringLiteral("hboxLayout"));
        label = new QLabel(centralwidget);
        label->setObjectName(QStringLiteral("label"));

        hboxLayout->addWidget(label);

        urlText = new QLineEdit(centralwidget);
        urlText->setObjectName(QStringLiteral("urlText"));

        hboxLayout->addWidget(urlText);

        vboxLayout1->addLayout(hboxLayout);

        urlTree = new QTreeWidget(centralwidget);
        urlTree->setObjectName(QStringLiteral("urlTree"));
        urlTree->setColumnCount(2);

        vboxLayout1->addWidget(urlTree);

        vboxLayout->addLayout(vboxLayout1);

        QWebGet->setCentralWidget(centralwidget);
        menubar = new QMenuBar(QWebGet);
        menubar->setObjectName(QStringLiteral("menubar"));
        menubar->setGeometry(QRect(0, 0, 777, 27));
        menu_Help = new QMenu(menubar);
        menu_Help->setObjectName(QStringLiteral("menu_Help"));
        menuFile = new QMenu(menubar);
        menuFile->setObjectName(QStringLiteral("menuFile"));
        QWebGet->setMenuBar(menubar);
        statusbar = new QStatusBar(QWebGet);
        statusbar->setObjectName(QStringLiteral("statusbar"));
        statusbar->setGeometry(QRect(0, 550, 777, 22));
        QWebGet->setStatusBar(statusbar);

        menubar->addAction(menuFile->menuAction());
        menubar->addAction(menu_Help->menuAction());
        menu_Help->addAction(action_Help);
        menuFile->addAction(action_Quit);

        retranslateUi(QWebGet);
        QObject::connect(action_Quit, SIGNAL(triggered()), QWebGet, SLOT(close()));
        QObject::connect(urlText, SIGNAL(returnPressed()), QWebGet, SLOT(load()));

        QMetaObject::connectSlotsByName(QWebGet);
    } // setupUi

    void retranslateUi(QMainWindow *QWebGet)
    {
        QWebGet->setWindowTitle(QApplication::translate("QWebGet", "WebGet", 0));
        action_Quit->setText(QApplication::translate("QWebGet", "&Quit", 0));
        action_Help->setText(QApplication::translate("QWebGet", "&Help", 0));
        label->setText(QApplication::translate("QWebGet", "Url", 0));
        QTreeWidgetItem *___qtreewidgetitem = urlTree->headerItem();
        ___qtreewidgetitem->setText(1, QApplication::translate("QWebGet", "1", 0));
        ___qtreewidgetitem->setText(0, QApplication::translate("QWebGet", "0", 0));
        menu_Help->setTitle(QApplication::translate("QWebGet", "&Help", 0));
        menuFile->setTitle(QApplication::translate("QWebGet", "&File", 0));
    } // retranslateUi

};

namespace Ui {
    class QWebGet: public Ui_QWebGet {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_CQWEBGET_H


text:
/*************************************************************************/
/*  editor_properties.h                                                  */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#ifndef EDITOR_PROPERTIES_H
#define EDITOR_PROPERTIES_H

#include "editor/create_dialog.h"
#include "editor/editor_inspector.h"
#include "editor/editor_locale_dialog.h"
#include "editor/editor_resource_picker.h"
#include "editor/editor_spin_slider.h"
#include "editor/property_selector.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/line_edit.h"

class EditorPropertyNil : public EditorProperty {
	GDCLASS(EditorPropertyNil, EditorProperty);
	LineEdit *text = nullptr;

public:
	virtual void update_property() override;
	EditorPropertyNil();
};

class EditorPropertyText : public EditorProperty {
	GDCLASS(EditorPropertyText, EditorProperty);
	LineEdit *text;

	bool updating;
	bool string_name;
	void _text_changed(const String &p_string);
	void _text_submitted(const String &p_string);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	void set_string_name(bool p_enabled);
	virtual void update_property() override;
	void set_placeholder(const String &p_string);
	EditorPropertyText();
};

class EditorPropertyMultilineText : public EditorProperty {
	GDCLASS(EditorPropertyMultilineText, EditorProperty);
	TextEdit *text;

	AcceptDialog *big_text_dialog;
	TextEdit *big_text;
	Button *open_big_text;

	void _big_text_changed();
	void _text_changed();
	void _open_big_text();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	EditorPropertyMultilineText();
};

class EditorPropertyTextEnum : public EditorProperty {
	GDCLASS(EditorPropertyTextEnum, EditorProperty);

	HBoxContainer *default_layout;
	HBoxContainer *edit_custom_layout;

	OptionButton *option_button;
	Button *edit_button;

	LineEdit *custom_value_edit;
	Button *accept_button;
	Button *cancel_button;

	Vector<String> options;
	bool string_name = false;
	bool loose_mode = false;

	void _emit_changed_value(String p_string);
	void _option_selected(int p_which);

	void _edit_custom_value();
	void _custom_value_submitted(String p_value);
	void _custom_value_accepted();
	void _custom_value_cancelled();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();
	void _notification(int p_what);

public:
	void setup(const Vector<String> &p_options, bool p_string_name = false, bool p_loose_mode = false);
	virtual void update_property() override;
	EditorPropertyTextEnum();
};

class EditorPropertyPath : public EditorProperty {
	GDCLASS(EditorPropertyPath, EditorProperty);
	Vector<String> extensions;
	bool folder;
	bool global;
	bool save_mode;
	EditorFileDialog *dialog;
	LineEdit *path;
	Button *path_edit;

	void _path_selected(const String &p_path);
	void _path_pressed();
	void _path_focus_exited();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();
	void _notification(int p_what);

public:
	void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global);
	void set_save_mode();
	virtual void update_property() override;
	EditorPropertyPath();
};

class EditorPropertyLocale : public EditorProperty {
	GDCLASS(EditorPropertyLocale, EditorProperty);
	EditorLocaleDialog *dialog;
	LineEdit *locale;
	Button *locale_edit;

	void _locale_selected(const String &p_locale);
	void _locale_pressed();
	void _locale_focus_exited();

protected:
	static void _bind_methods();
	void _notification(int p_what);

public:
	void setup(const String &p_hit_string);
	virtual void update_property() override;
	EditorPropertyLocale();
};

class EditorPropertyClassName : public EditorProperty {
	GDCLASS(EditorPropertyClassName, EditorProperty);

private:
	CreateDialog *dialog;
	Button *property;
	String selected_type;
	String base_type;
	void _property_selected();
	void _dialog_created();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	void setup(const String &p_base_type, const String &p_selected_type);
	virtual void update_property() override;
	EditorPropertyClassName();
};

class EditorPropertyMember : public EditorProperty {
	GDCLASS(EditorPropertyMember, EditorProperty);

public:
	enum Type {
		MEMBER_METHOD_OF_VARIANT_TYPE, ///< a method of a type
		MEMBER_METHOD_OF_BASE_TYPE, ///< a method of a base type
		MEMBER_METHOD_OF_INSTANCE, ///< a method of an instance
		MEMBER_METHOD_OF_SCRIPT, ///< a method of a script & base
		MEMBER_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
		MEMBER_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
		MEMBER_PROPERTY_OF_INSTANCE, ///< a property of an instance
		MEMBER_PROPERTY_OF_SCRIPT, ///< a property of a script & base
	};

private:
	Type hint;
	PropertySelector *selector;
	Button *property;
	String hint_text;

	void _property_selected(const String &p_selected);
	void _property_select();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	void setup(Type p_hint, const String &p_hint_text);
	virtual void update_property() override;
	EditorPropertyMember();
};

class EditorPropertyCheck : public EditorProperty {
	GDCLASS(EditorPropertyCheck, EditorProperty);
	CheckBox *checkbox;

	void _checkbox_pressed();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	virtual void update_property() override;
	EditorPropertyCheck();
};

class EditorPropertyEnum : public EditorProperty {
	GDCLASS(EditorPropertyEnum, EditorProperty);
	OptionButton *options;

	void _option_selected(int p_which);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	void setup(const Vector<String> &p_options);
	virtual void update_property() override;
	void set_option_button_clip(bool p_enable);
	EditorPropertyEnum();
};

class EditorPropertyFlags : public EditorProperty {
	GDCLASS(EditorPropertyFlags, EditorProperty);
	VBoxContainer *vbox;
	Vector<CheckBox *> flags;
	Vector<int> flag_indices;

	void _flag_toggled();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	void setup(const Vector<String> &p_options);
	virtual void update_property() override;
	EditorPropertyFlags();
};

///////////////////// LAYERS /////////////////////////

class EditorPropertyLayersGrid : public Control {
	GDCLASS(EditorPropertyLayersGrid, Control);

private:
	Vector<Rect2> flag_rects;
	Rect2 expand_rect;
	bool expand_hovered = false;
	bool expanded = false;
	int expansion_rows = 0;
	int hovered_index = -1;
	bool read_only = false;
	int renamed_layer_index = -1;
	PopupMenu *layer_rename;
	ConfirmationDialog *rename_dialog;
	LineEdit *rename_dialog_text;

	void _rename_pressed(int p_menu);
	void _rename_operation_confirm();
	Size2 get_grid_size() const;

protected:
	void _notification(int p_what);
	static void _bind_methods();

public:
	uint32_t value = 0;
	int layer_group_size = 0;
	int layer_count = 0;
	Vector<String> names;
	Vector<String> tooltips;

	void set_read_only(bool p_read_only);
	virtual Size2 get_minimum_size() const override;
	virtual String get_tooltip(const Point2 &p_pos) const override;
	void gui_input(const Ref<InputEvent> &p_ev) override;
	void set_flag(uint32_t p_flag);
	EditorPropertyLayersGrid();
};

class EditorPropertyLayers : public EditorProperty {
	GDCLASS(EditorPropertyLayers, EditorProperty);

public:
	enum LayerType {
		LAYER_PHYSICS_2D,
		LAYER_RENDER_2D,
		LAYER_NAVIGATION_2D,
		LAYER_PHYSICS_3D,
		LAYER_RENDER_3D,
		LAYER_NAVIGATION_3D,
	};

private:
	EditorPropertyLayersGrid *grid;
	void _grid_changed(uint32_t p_grid);
	String basename;
	LayerType layer_type;
	PopupMenu *layers;
	Button *button;

	void _button_pressed();
	void _menu_pressed(int p_menu);
	void _refresh_names();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	void setup(LayerType p_layer_type);
	void set_layer_name(int p_index, const String &p_name);
	virtual void update_property() override;
	EditorPropertyLayers();
};

class EditorPropertyInteger : public EditorProperty {
	GDCLASS(EditorPropertyInteger, EditorProperty);
	EditorSpinSlider *spin;
	bool setting;
	void _value_changed(int64_t p_val);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser);
	EditorPropertyInteger();
};

class EditorPropertyObjectID : public EditorProperty {
	GDCLASS(EditorPropertyObjectID, EditorProperty);
	Button *edit;
	String base_type;
	void _edit_pressed();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(const String &p_base_type);
	EditorPropertyObjectID();
};

class EditorPropertyFloat : public EditorProperty {
	GDCLASS(EditorPropertyFloat, EditorProperty);
	EditorSpinSlider *spin;
	bool setting = false;
	bool angle_in_radians = false;
	void _value_changed(double p_val);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix = String(), bool p_angle_in_radians = false);
	EditorPropertyFloat();
};

class EditorPropertyEasing : public EditorProperty {
	GDCLASS(EditorPropertyEasing, EditorProperty);
	Control *easing_draw;
	PopupMenu *preset;
	EditorSpinSlider *spin;
	bool setting;

	bool dragging;
	bool full;
	bool flip;

	enum {
		EASING_ZERO,
		EASING_LINEAR,
		EASING_IN,
		EASING_OUT,
		EASING_IN_OUT,
		EASING_OUT_IN,
		EASING_MAX

	};

	void _drag_easing(const Ref<InputEvent> &p_ev);
	void _draw_easing();
	void _set_preset(int);

	void _setup_spin();
	void _spin_value_changed(double p_value);
	void _spin_focus_exited();

	void _notification(int p_what);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(bool p_full, bool p_flip);
	EditorPropertyEasing();
};

class EditorPropertyVector2 : public EditorProperty {
	GDCLASS(EditorPropertyVector2, EditorProperty);
	EditorSpinSlider *spin[2];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyVector2(bool p_force_wide = false);
};

class EditorPropertyRect2 : public EditorProperty {
	GDCLASS(EditorPropertyRect2, EditorProperty);
	EditorSpinSlider *spin[4];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyRect2(bool p_force_wide = false);
};

class EditorPropertyVector3 : public EditorProperty {
	GDCLASS(EditorPropertyVector3, EditorProperty);
	EditorSpinSlider *spin[3];
	bool setting = false;
	bool angle_in_radians = false;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	virtual void update_using_vector(Vector3 p_vector);
	virtual Vector3 get_vector();
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String(), bool p_angle_in_radians = false);
	EditorPropertyVector3(bool p_force_wide = false);
};

class EditorPropertyVector2i : public EditorProperty {
	GDCLASS(EditorPropertyVector2i, EditorProperty);
	EditorSpinSlider *spin[2];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyVector2i(bool p_force_wide = false);
};

class EditorPropertyRect2i : public EditorProperty {
	GDCLASS(EditorPropertyRect2i, EditorProperty);
	EditorSpinSlider *spin[4];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyRect2i(bool p_force_wide = false);
};

class EditorPropertyVector3i : public EditorProperty {
	GDCLASS(EditorPropertyVector3i, EditorProperty);
	EditorSpinSlider *spin[3];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyVector3i(bool p_force_wide = false);
};

class EditorPropertyPlane : public EditorProperty {
	GDCLASS(EditorPropertyPlane, EditorProperty);
	EditorSpinSlider *spin[4];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyPlane(bool p_force_wide = false);
};

class EditorPropertyQuaternion : public EditorProperty {
	GDCLASS(EditorPropertyQuaternion, EditorProperty);
	EditorSpinSlider *spin[4];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyQuaternion();
};

class EditorPropertyAABB : public EditorProperty {
	GDCLASS(EditorPropertyAABB, EditorProperty);
	EditorSpinSlider *spin[6];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyAABB();
};

class EditorPropertyTransform2D : public EditorProperty {
	GDCLASS(EditorPropertyTransform2D, EditorProperty);
	EditorSpinSlider *spin[6];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyTransform2D(bool p_include_origin = true);
};

class EditorPropertyBasis : public EditorProperty {
	GDCLASS(EditorPropertyBasis, EditorProperty);
	EditorSpinSlider *spin[9];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyBasis();
};

class EditorPropertyTransform3D : public EditorProperty {
	GDCLASS(EditorPropertyTransform3D, EditorProperty);
	EditorSpinSlider *spin[12];
	bool setting;
	void _value_changed(double p_val, const String &p_name);

protected:
	virtual void _set_read_only(bool p_read_only) override;
	void _notification(int p_what);
	static void _bind_methods();

public:
	virtual void update_property() override;
	virtual void update_using_transform(Transform3D p_transform);
	void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
	EditorPropertyTransform3D();
};

class EditorPropertyColor : public EditorProperty {
	GDCLASS(EditorPropertyColor, EditorProperty);
	ColorPickerButton *picker;
	void _color_changed(const Color &p_color);
	void _popup_closed();
	void _picker_created();
	void _picker_opening();

	Color last_color;

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();

public:
	virtual void update_property() override;
	void setup(bool p_show_alpha);
	EditorPropertyColor();
};

class EditorPropertyNodePath : public EditorProperty {
	GDCLASS(EditorPropertyNodePath, EditorProperty);
	Button *assign;
	Button *clear;
	SceneTreeDialog *scene_tree;
	NodePath base_hint;
	bool use_path_from_scene_root;

	Vector<StringName> valid_types;
	void _node_selected(const NodePath &p_path);
	void _node_assign();
	void _node_clear();

	bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
	void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
	bool is_drop_valid(const Dictionary &p_drag_data) const;

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();
	void _notification(int p_what);

public:
	virtual void update_property() override;
	void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root = true);
	EditorPropertyNodePath();
};

class EditorPropertyRID : public EditorProperty {
	GDCLASS(EditorPropertyRID, EditorProperty);
	Label *label;

public:
	virtual void update_property() override;
	EditorPropertyRID();
};

class EditorPropertyResource : public EditorProperty {
	GDCLASS(EditorPropertyResource, EditorProperty);

	EditorResourcePicker *resource_picker = nullptr;
	SceneTreeDialog *scene_tree = nullptr;

	bool use_sub_inspector = false;
	EditorInspector *sub_inspector = nullptr;
	VBoxContainer *sub_inspector_vbox = nullptr;
	bool updating_theme = false;
	bool opened_editor = false;

	void _resource_selected(const RES &p_resource, bool p_edit);
	void _resource_changed(const RES &p_resource);

	void _viewport_selected(const NodePath &p_path);

	void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool p_advance);
	void _sub_inspector_resource_selected(const RES &p_resource, const String &p_property);
	void _sub_inspector_object_id_selected(int p_id);

	void _open_editor_pressed();
	void _fold_other_editors(Object *p_self);
	void _update_property_bg();
	void _update_preferred_shader();

protected:
	virtual void _set_read_only(bool p_read_only) override;
	static void _bind_methods();
	void _notification(int p_what);

public:
	virtual void update_property() override;
	void setup(Object *p_object, const String &p_path, const String &p_base_type);

	void collapse_all_folding() override;
	void expand_all_folding() override;

	void set_use_sub_inspector(bool p_enable);

	EditorPropertyResource();
};

///////////////////////////////////////////////////
/// \brief The EditorInspectorDefaultPlugin class
///
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
	GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);

public:
	virtual bool can_handle(Object *p_object) override;
	virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;

	static EditorProperty *get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
};

#endif // EDITOR_PROPERTIES_H


text:
layout: post
status: publish
published: true
title: Edje Flip Policy
author:
  display_name: shorne
  login: admin
  email: shorne@gmail.com
  url: http://blog.shorne-pla.net
author_login: admin
author_email: shorne@gmail.com
author_url: http://blog.shorne-pla.net
wordpress_id: 64
wordpress_url: /?p=64
date: !binary |-
  MjAwNi0wOC0wOSAyMDowNjo0OSArMDkwMA==
date_gmt: !binary |-
  MjAwNi0wOC0wOSAxMjowNjo0OSArMDkwMA==
categories:
- Tech Stories
tags: []
comments: []
---

A while back E17 used to have a cool "bug" in the edge flipping logic.

Edge flipping is used on computer desktops when your have virtual desktop systems. Virtual desktops are very popular in Linux and UNIX desktop systems.  One feature for virtual desktops is edge flipping.  When edge flipping is enabled and one moves the mouse to the edge of the screen the screen will flip to an adjacent desktop if on is available.

This is probably pretty confusing if you are a windows user.

Anyway, I added some configuration:


text:
#ifndef _IRTKSPECTRALDECOMPOSITION_H
#define _IRTKSPECTRALDECOMPOSITION_H

#include <vtkPolyData.h>
#include <vtkPointData.h>
#include <vtkDataArray.h>
#include <vtkIdList.h>
#include <vtkAbstractPointLocator.h>
#include <vtkSmartPointer.h>

#include <irtkPointSet.h>
#include <irtkSparseMatrix.h>

namespace irtkSpectralDecomposition {

// =============================================================================
// Types and constants
// =============================================================================

typedef irtkGenericSparseMatrix<double> SparseMatrix;
typedef vector<pair<int, double> >      FeatureWeights;

extern const double EPSILON;

// =============================================================================
// Bipartite graph matching / Optimal assignment problem
// =============================================================================

/// Find optimal assignment given cost matrix using the Hungarian method
vector<int> WeightedMatching(const irtkMatrix &cost);

// =============================================================================
// Find closest points
// =============================================================================

// -----------------------------------------------------------------------------
/// For each point in the first set, find closest point in the second set
class FindClosestPoints
{
  // Attention: vtkKdTree/vtkKdTreePointLocator is not thread-safe
  //            (cf. http://www.vtk.org/Bug/view.php?id=15206 )!
  const irtkPointSet      &_P1;
  vtkAbstractPointLocator *_P2;
  vector<int>             &_Idx;

  FindClosestPoints(const irtkPointSet &, vtkAbstractPointLocator *, vector<int> &);

public:

  /// Internal function executed by worker threads
  void operator ()(const blocked_range<int> &re) const
  {
    for (int i = re.begin(); i != re.end(); ++i) {
      const irtkPoint &p = _P1(i);
      _Idx[i] = static_cast<int>(_P2->FindClosestPoint(p._x, p._y, p._z));
    }
  }

  /// For each point in the first set, find closest point in the second set
  static vector<int> Run(const irtkPointSet &p1, const irtkPointSet &p2);
};

// -----------------------------------------------------------------------------
/// For each point in the first set, find closest point in the second set
class FindClosestNPoints
{
  // Attention: vtkKdTree/vtkKdTreePointLocator is not thread-safe
  //            (cf. http://www.vtk.org/Bug/view.php?id=15206 )!
  const irtkPointSet      &_P1;
  vtkAbstractPointLocator *_P2;
  vector<vector<int> >    &_Idx;
  int                      _Num;

  FindClosestNPoints(const irtkPointSet &, vtkAbstractPointLocator *, vector<vector<int> > &, int);

public:

  /// Internal function executed by worker threads
  void operator ()(const blocked_range<int> &re) const
  {
    double p[3];
    vtkIdList *ids = vtkIdList::New();
    for (int i = re.begin(); i != re.end(); ++i) {
      _P1.GetPoint(i, p);
      _P2->FindClosestNPoints(_Num, p, ids);
      for (vtkIdType j = 0; j < ids->GetNumberOfIds(); ++j) {
        _Idx[i][j] = static_cast<int>(ids->GetId(j));
      }
    }
    ids->Delete();
  }

  /// For each point in the first set, find closest point in the second set
  static vector<vector<int> > Run(const irtkPointSet &p1, const irtkPointSet &p2, int);
};

// =============================================================================
// Node/edge feature weights
// =============================================================================

/// Get absolute edge weights
///
/// \param[in] dataset  Surface mesh.
/// \param[in] names    Names of feature arrays in \p dataset, e.g., "curvature",
///                     "sulcal depth", "cortical thickness", ..., to use.
/// \param[in] weights  Relative weights of edge features. If \c NULL, the
///                     default weight is used for all features. If only one
///                     weight value given, it is used for all features.
///                     Otherwise, a separate weight must be given for each
///                     named feature array.
///
/// \returns Pairs of feature array indices and corresponding absolute weights.
FeatureWeights EdgeWeights(vtkPolyData          *dataset,
                           const vector<string> &names,
                           const vector<double> *weights = NULL);

/// Get absolute node weights
///
/// \param[in] dataset  Surface mesh.
/// \param[in] names    Names of feature arrays in \p dataset, e.g., "curvature",
///                     "sulcal depth", "cortical thickness", ..., to use.
/// \param[in] weights  Relative weights of node features. If \c NULL, the
///                     default weight is used for all features. If only one
///                     weight value given, it is used for all features.
///                     Otherwise, a separate weight must be given for each
///                     named feature array.
///
/// \returns Pairs of feature array indices and corresponding absolute weights.
FeatureWeights NodeWeights(vtkPolyData          *dataset,
                           const vector<string> &names,
                           const vector<double> *weights = NULL);

// -----------------------------------------------------------------------------
/// Size of node feature vectors
inline int NumberOfFeatures(vtkPolyData *dataset, const FeatureWeights *weights = NULL)
{
  int d = 3;
  if (weights) {
    vtkPointData * const data = dataset->GetPointData();
    FeatureWeights::const_iterator weight = weights->begin();
    while (weight != weights->end()) {
      vtkDataArray * const feature = data->GetArray(weight->first);
      d += feature->GetNumberOfComponents();
      ++weight;
    }
  }
  return d;
}

// -----------------------------------------------------------------------------
/// Get node features
inline void GetFeatures(vtkPolyData *dataset, vtkIdType i, double *p, const FeatureWeights *weights = NULL)
{
  dataset->GetPoint(i, p);
  p += 3;
  if (weights) {
    vtkPointData * const data = dataset->GetPointData();
    FeatureWeights::const_iterator weight = weights->begin();
    while (weight != weights->end()) {
      vtkDataArray * const feature = data->GetArray(weight->first);
      feature->GetTuple(i, p);
      for (int c = 0; c < feature->GetNumberOfComponents(); ++c) {
        p[c] *= weight->second;
      }
      p += feature->GetNumberOfComponents();
      ++weight;
    }
  }
}

// -----------------------------------------------------------------------------
/// Calculate squared distance between 3-dimensional points
inline double Distance2BetweenPoints(const double *p1, const double *p2)
{
  double dx, dist2;
  dx = p2[0] - p1[0], dist2  = dx * dx;
  dx = p2[1] - p1[1], dist2 += dx * dx;
  dx = p2[2] - p1[2], dist2 += dx * dx;
  return dist2;
}

// -----------------------------------------------------------------------------
/// Calculate squared distance between d-dimensional points
inline double Distance2BetweenPoints(const double *p1, const double *p2, int d)
{
  double dx, dist2 = .0;
  for (int i = 0; i < d; ++i) {
    dx = p2[i] - p1[i];
    dist2 += dx * dx;
  }
  return dist2;
}

// =============================================================================
// Graph connectivity
// =============================================================================

/// Calculate intra-mesh affinity weights
void AdjacencyMatrix(SparseMatrix::Entries       adjw[],
                     SparseMatrix::StorageLayout layout,
                     int r1, int c1, vtkPolyData *dataset,
                     FeatureWeights weights = FeatureWeights());

/// Calculate intra-mesh affinity weights
void AdjacencyMatrix(SparseMatrix  &adjw,
                     vtkPolyData   *dataset,
                     FeatureWeights weights = FeatureWeights());

/// Calculate intra-mesh affinity weights
SparseMatrix AdjacencyMatrix(vtkPolyData                *dataset,
                             SparseMatrix::StorageLayout layout  = SparseMatrix::CCS,
                             FeatureWeights              weights = FeatureWeights());

/// Calculate inter-mesh affinity weights (with links at subsampled points only)
template <typename TCorWeight>
void ConnectivityMatrix(SparseMatrix::Entries                      lnkw[],
                        SparseMatrix::StorageLayout                layout,
                        int                                        r1,
                        int                                        c1,
                        vtkPolyData                               *target,
                        const vector<int>                         *target_sample,
                        vtkPolyData                               *source,
                        const vector<int>                         *source_sample,
                        const irtkGenericSparseMatrix<TCorWeight> *weight,
                        bool                                       weight_transpose = false);

/// Calculate inter-mesh affinity weights (with links at subsampled points only)
template <typename TCorWeight>
void ConnectivityMatrix(SparseMatrix                              &lnkw,
                        vtkPolyData                               *target,
                        const vector<int>                         *target_sample,
                        vtkPolyData                               *source,
                        const vector<int>                         *source_sample,
                        const irtkGenericSparseMatrix<TCorWeight> *weight,
                        bool                                       transpose = false);

/// Calculate inter-mesh affinity weights (with links at subsampled points only)
template <typename TCorWeight>
SparseMatrix ConnectivityMatrix(vtkPolyData                               *target,
                                const vector<int>                         *target_sample,
                                vtkPolyData                               *source,
                                const vector<int>                         *source_sample,
                                const irtkGenericSparseMatrix<TCorWeight> *weight,
                                bool                                       transpose = false,
                                SparseMatrix::StorageLayout                layout = SparseMatrix::CCS);

/// Compute node degrees
void Degree(irtkVector &D, const SparseMatrix &A);

/// Compute node degrees
irtkVector Degree(const SparseMatrix &A);

/// Compute degree matrix
void DegreeMatrix(SparseMatrix &D, const SparseMatrix &A);

/// Compute degree matrix
SparseMatrix DegreeMatrix(const SparseMatrix &A);

/// Compute normalized Laplacian
///
/// \param[out] L Normalized Laplacian matrix.
/// \param[in]  A (Weighted) Adjacency matrix.
/// \param[in]  G Optional node weights. If \c NULL, G = Id.
/// \param[in]  D Main diagonal of (precomputed) degree matrix.
///
/// \returns L = G D^-1 (D - A) = G - D^-1 A
void NormalizedLaplacian(SparseMatrix &L, const SparseMatrix &A,
                         const irtkVector *G = NULL, const irtkVector *D = NULL);

/// Compute general graph Laplacian
///
/// \param[out] L            General graph Laplacian matrix.
/// \param[in]  dataset      Surface mesh or contour with optional extra
///                          feature arrays used as edge and/or node weights.
/// \param[in]  edge_weights Weights of edge features if any (cf. EdgeWeights).
/// \param[in]  node_weights Weights of node features if any (cf. NodeWeights).
void Laplacian(SparseMatrix &L, vtkPolyData *dataset,
               FeatureWeights edge_weights = FeatureWeights(),
               FeatureWeights node_weights = FeatureWeights());

// =============================================================================
// Spectral decomposition
// =============================================================================

/// Compute spectral components
///
/// This function performs a spectral analysis of the given graph Laplacian matrix.
///
/// \param[in]  L General graph Laplacian matrix.
/// \oaram[in]  k Number of spectral components.
/// \param[out] m Eigenmodes of \c d, i.e., spectral coordinates.
/// \param[out] v Eigenvalues of \c d, i.e., resonance frequencies.
///
/// \returns Actual number of spectral components found.
int ComputeEigenmodes(const SparseMatrix &L, int k, irtkMatrix &m, irtkVector &v);

/// Compute spectral components
///
/// This function performs a spectral analysis of the general graph Laplacian
/// matrix of the specified surface mesh.
///
/// \param[in]  d   Surface mesh or contour with optional extra
///                 features used as edge and/or node weights.
/// \oaram[in]  k   Number of spectral components.
/// \param[out] m   Eigenmodes of \c d, i.e., spectral coordinates.
/// \param[out] v   Eigenvalues of \c d, i.e., resonance frequencies.
/// \param[in]  ew  Weights of edge features if any (cf. EdgeWeights).
/// \param[in]  nw  Weights of node features if any (cf. NodeWeights).
///
/// \returns Actual number of spectral components found.
int ComputeEigenmodes(vtkPolyData *d, int k, irtkMatrix &m, irtkVector &v,
                      FeatureWeights ew = FeatureWeights(),
                      FeatureWeights nw = FeatureWeights());

/// Compute spectral components
///
/// This function performs a spectral analysis of the general graph Laplacian
/// matrix of the specified surface mesh. The components of the resulting \p k
/// eigenmodes are stored as point data of the input mesh in the array named
/// \"eigenmodes\".
///
/// \param[in,out] d   Surface mesh or contour with optional extra
///                    features used as edge and/or node weights.
/// \oaram[in]     k   Number of spectral components.
/// \param[in]     ew  Weights of edge features if any (cf. EdgeWeights).
/// \param[in]     nw  Weights of node features if any (cf. NodeWeights).
///
/// \returns Actual number of spectral components found.
int ComputeEigenmodes(vtkPolyData *d, int k,
                      FeatureWeights ew = FeatureWeights(),
                      FeatureWeights nw = FeatureWeights());

/// Reorder eigenmodes to correct for sign ambiguity and multiplicity
///
/// \param[in]      p1 First set of spatial coordinates.
/// \param[in]      m1 First set of original eigenmodes.
/// \param[in]      v1 Eigenvalues corresponding to first set of eigenmodes.
/// \param[in]      p2 Second set of spatial coordinates.
/// \param[in,out]  m2 Second set of original eigenmodes which are reordered.
/// \param[in]      v2 Eigenvalues corresponding to second set of eigenmodes.
/// \param[in]   ratio Downsample ratio, e.g., 2 to use only half of the points.
/// \param[in]     knn Number of spatially nearest neighbors to consider.
///
/// \returns Confidence/cost of each match.
irtkVector MatchEigenmodes(const irtkPointSet &p1, const irtkMatrix &m1, const irtkVector &v1,
                           const irtkPointSet &p2,       irtkMatrix &m2,       irtkVector &v2,
                           int ratio = 10, int knn = 1);

/// Reorder eigenmodes to correct for sign ambiguity and multiplicity
///
/// \param[in]      p1 First set of spatial coordinates.
/// \param[in]      m1 First set of original eigenmodes.
/// \param[in]      v1 Eigenvalues corresponding to first set of eigenmodes.
/// \param[in]      p2 Second set of spatial coordinates.
/// \param[in,out]  m2 Second set of original eigenmodes which are reordered.
/// \param[in]      v2 Eigenvalues corresponding to second set of eigenmodes.
/// \param[in]   ratio Downsample ratio, e.g., 2 to use only half of the points.
/// \param[in]     knn Number of spatially nearest neighbors to consider.
///
/// \returns Confidence/cost of each match.
irtkVector MatchEigenmodes(vtkPoints *p1, const irtkMatrix &m1, const irtkVector &v1,
                           vtkPoints *p2,       irtkMatrix &m2,       irtkVector &v2,
                           int ratio = 10, int knn = 1);

/// Compute weights of eigenmodes given the match confidence
///
/// Reduce importance of eigenmode by lowering weight for
/// - Eigenmodes corresponding to high frequencies.
/// - Pairs of eigenmodes with low confidence in the match.
///
/// \param[in]     m1 First set of eigenmodes.
/// \param[in]     v1 Eigenvalues corresponding to first set of eigenmodes.
/// \param[in]     m2 Second set of eigenmodes.
/// \param[in]     v2 Eigenvalues corresponding to second set of eigenmodes.
/// \param[in,out] w  Input: Match confidence/cost. Output: Weights of eigenmodes.
void WeightEigenmodes(const irtkMatrix &m1, const irtkVector &v1,
                      const irtkMatrix &m2, const irtkVector &v2, irtkVector &w);

/// Scale eigenmodes given their individual weights
///
/// \param[in,out] m  (Joint) Eigenmodes.
/// \param[in]     w  Weights of eigenmodes.
void ScaleEigenmodes(irtkMatrix &m, const irtkVector &w);

/// Normalize eigenmodes individually to the range [-1, 1]
void NormalizeEigenmodes(irtkMatrix &m);

/// Scale eigenmodes given their individual weights
///
/// \param[in,out] m1 First set of eigenmodes.
/// \param[in,out] m2 Second set of eigenmodes.
/// \param[in]     w  Weights of eigenmodes (cf. WeightEigenmodes).
void ScaleEigenmodes(irtkMatrix &m1, irtkMatrix &m2, const irtkVector &w);

/// Convert eigenmodes to dataset point data array
vtkSmartPointer<vtkDataArray>
ToPointDataArray(const irtkMatrix &m, int r1 = 0,
                 int n = -1, int k = -1, const char *name = "eigenmodes");

/// Set spectral components as point data of vtkPolyData instance
///
/// \returns Index of eigenmodes point data array.
int SetEigenmodes(vtkPolyData *d, const irtkMatrix &m, const char *name = "eigenmodes");

/// Set spectral components as point data of vtkPolyData instance
///
/// \returns Index of eigenmodes point data array.
int SetEigenmodes(vtkPolyData *d, const irtkMatrix &m,
                  int r1, int k = -1, const char *name = "eigenmodes");

/// Get spectral components from point data of vtkPolyData instance
irtkMatrix GetEigenmodes(vtkPolyData *d, const char *name = "eigenmodes");

/// Compute spectral components and account for sign ambiguity and multiplicity
///
/// The signs of the computed eigenmodes of the second dataset are flipped
/// and the eigenmodes reordered in order to minimize the bipartite assignment
/// cost between the eigenmodes of two datasets. This accounts for the sign
/// ambiguity and multiplicity of the eigenvalue problem. The assignment costs
/// are then used to scale the eigenmodes. The resulting spectral components
/// are added to the point data of the respective vtkPolyData instance with
/// name "eigenmodes". An existing point data array with this name will be
/// overwritten.
///
/// \param[in,out] d1  Surface mesh or contour with optional extra
///                    features used as edge and/or node weights.
/// \param[in,out] d2  Surface mesh or contour with optional extra
///                    features used as edge and/or node weights.
/// \oaram[in]     k   Number of desired spectral components.
/// \param[in]     ew  Weights of edge features if any (cf. EdgeWeights).
/// \param[in]     nw  Weights of node features if any (cf. NodeWeights).
///
/// \returns Actual number of spectral components found for both datasets.
int ComputeEigenmodes(vtkPolyData *d1, vtkPolyData *d2, int k,
                      FeatureWeights ew = FeatureWeights(),
                      FeatureWeights nw = FeatureWeights());

} // namespace irtkSpectralDecomposition

#endif


text:
package ml.dmlc.xgboost4j.scala.spark.mleap

import java.nio.file.Files

import ml.combust.bundle.BundleContext
import ml.combust.bundle.dsl.{Model, NodeShape, Value}
import ml.combust.bundle.op.OpModel
import ml.dmlc.xgboost4j.scala.spark.XGBoostRegressionModel
import ml.dmlc.xgboost4j.scala.{XGBoost => SXGBoost}
import org.apache.spark.ml.bundle._
import org.apache.spark.ml.linalg.Vector
import resource.managed

/**
  * Created by hollinwilkins on 9/16/17.
  */
class XGBoostRegressionModelOp extends SimpleSparkOp[XGBoostRegressionModel] {
  /** Type class for the underlying model.
    */
  override val Model: OpModel[SparkBundleContext, XGBoostRegressionModel] = new OpModel[SparkBundleContext, XGBoostRegressionModel] {
    override val klazz: Class[XGBoostRegressionModel] = classOf[XGBoostRegressionModel]

    override def opName: String = "xgboost.regression"

    override def store(model: Model, obj: XGBoostRegressionModel)
                      (implicit context: BundleContext[SparkBundleContext]): Model = {
      assert(context.context.dataset.isDefined, BundleHelper.sampleDataframeMessage(klazz))

      Files.write(context.file("xgboost.model"), obj._booster.toByteArray)

      val numFeatures = context.context.dataset.get.select(obj.getFeaturesCol).first.getAs[Vector](0).size
      model.withValue("num_features", Value.int(numFeatures)).
        withValue("tree_limit", Value.int(obj.getOrDefault(obj.treeLimit))).
        withValue("missing", Value.float(obj.getOrDefault(obj.missing))).
        withValue("infer_batch_size", Value.int(obj.getOrDefault(obj.inferBatchSize))).
        withValue("use_external_memory", Value.boolean(obj.getOrDefault(obj.useExternalMemory))).
        withValue("allow_non_zero_for_missing", Value.boolean(obj.getOrDefault(obj.allowNonZeroForMissing)))
    }

    override def load(model: Model)
                     (implicit context: BundleContext[SparkBundleContext]): XGBoostRegressionModel = {
      val booster = (for(in <- managed(Files.newInputStream(context.file("xgboost.model")))) yield {
        SXGBoost.loadModel(in)
      }).tried.get

      val xgb = new XGBoostRegressionModel("", booster)

      model.getValue("tree_limit").map(o => xgb.setTreeLimit(o.getInt))
      model.getValue("missing").map(o => xgb.setMissing(o.getFloat))
      model.getValue("allow_non_zero_for_missing").map(o => xgb.setAllowNonZeroForMissing(o.getBoolean))
      model.getValue("infer_batch_size").map(o => xgb.setInferBatchSize(o.getInt))
      model.getValue("use_external_memory").map(o => xgb.set(xgb.useExternalMemory, o.getBoolean))
      xgb
    }
  }

  override def sparkLoad(uid: String,
                         shape: NodeShape,
                         model: XGBoostRegressionModel): XGBoostRegressionModel = {
    val xgb = new XGBoostRegressionModel(uid, model._booster)
    if(model.isSet(model.missing)) xgb.setMissing(model.getOrDefault(model.missing))
    if(model.isSet(model.allowNonZeroForMissing)) xgb.setAllowNonZeroForMissing(model.getOrDefault(model.allowNonZeroForMissing))
    if(model.isSet(model.inferBatchSize)) xgb.setInferBatchSize(model.getOrDefault(model.inferBatchSize))
    if(model.isSet(model.treeLimit)) xgb.setTreeLimit(model.getOrDefault(model.treeLimit))
    if(model.isSet(model.useExternalMemory)) xgb.set(xgb.useExternalMemory, model.getOrDefault(model.useExternalMemory))
    xgb
  }

  override def sparkInputs(obj: XGBoostRegressionModel): Seq[ParamSpec] = {
    Seq("features" -> obj.featuresCol)
  }

  override def sparkOutputs(obj: XGBoostRegressionModel): Seq[SimpleParamSpec] = {
    Seq("prediction" -> obj.predictionCol,
      "leaf_prediction" -> obj.leafPredictionCol,
      "contrib_prediction" -> obj.contribPredictionCol)
  }
}


text:
#include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_LINUX

#include "platform/CCCommon.h"
#include "platform/linux/CCStdC-linux.h"
#include "base/CCConsole.h"

NS_CC_BEGIN

void MessageBox(const char * msg, const char * title)
{
    log("%s: %s", title, msg);
}

void LuaLog(const char * format)
{
    puts(format);
}

NS_CC_END

#endif //  CC_TARGET_PLATFORM == CC_PLATFORM_LINUX


text:
"enable aexpr";

import AbstractAstNode from './abstract-ast-node.js'

export default class AstNodeMemberExpression extends AbstractAstNode {
  async initialize() {
    await super.initialize();
    this.windowTitle = "AstNodeMemberExpression";
  }

  async updateProjection() {
    this.classList.toggle('computed', this.node.computed);

    await this.createSubElementForPath(this.path.get('object'), 'object');
    await this.createSubElementForPath(this.path.get('property'), 'property');
  }

}


text:
package eu.vlaurin.numberstowords.number;

/**
 * @since 1.0
 */
public class Hundreds extends Multiple {

    private static final String HUNDRED = "hundred";

    Hundreds(Integer hundreds, Tens tens) {
        super(new Digit(hundreds), tens);
    }

    Hundreds(Digit hundreds, Tens tens) {
        super(hundreds, tens);
    }

    @Override
    protected String getName() {
        return HUNDRED;
    }
}