text:
#ifndef WEBRTC_COMMON_TYPES_H_
#define WEBRTC_COMMON_TYPES_H_

#include <assert.h>
#include <stddef.h>
#include <string.h>

#include <string>
#include <vector>

#include "webrtc/typedefs.h"

#if defined(_MSC_VER)
// Disable "new behavior: elements of array will be default initialized"
// warning. Affects OverUseDetectorOptions.
#pragma warning(disable:4351)
#endif

#ifdef WEBRTC_EXPORT
#define WEBRTC_DLLEXPORT _declspec(dllexport)
#elif WEBRTC_DLL
#define WEBRTC_DLLEXPORT _declspec(dllimport)
#else
#define WEBRTC_DLLEXPORT
#endif

#ifndef NULL
#define NULL 0
#endif

#define RTP_PAYLOAD_NAME_SIZE 32u

#if defined(WEBRTC_WIN) || defined(WIN32)
// Compares two strings without regard to case.
#define STR_CASE_CMP(s1, s2) ::_stricmp(s1, s2)
// Compares characters of two strings without regard to case.
#define STR_NCASE_CMP(s1, s2, n) ::_strnicmp(s1, s2, n)
#else
#define STR_CASE_CMP(s1, s2) ::strcasecmp(s1, s2)
#define STR_NCASE_CMP(s1, s2, n) ::strncasecmp(s1, s2, n)
#endif

namespace webrtc {

class Config;

class InStream
{
public:
 // Reads |length| bytes from file to |buf|. Returns the number of bytes read
 // or -1 on error.
    virtual int Read(void *buf, size_t len) = 0;
    virtual int Rewind();
    virtual ~InStream() {}
protected:
    InStream() {}
};

class OutStream
{
public:
 // Writes |length| bytes from |buf| to file. The actual writing may happen
 // some time later. Call Flush() to force a write.
    virtual bool Write(const void *buf, size_t len) = 0;
    virtual int Rewind();
    virtual ~OutStream() {}
protected:
    OutStream() {}
};

enum TraceModule
{
    kTraceUndefined              = 0,
    // not a module, triggered from the engine code
    kTraceVoice                  = 0x0001,
    // not a module, triggered from the engine code
    kTraceVideo                  = 0x0002,
    // not a module, triggered from the utility code
    kTraceUtility                = 0x0003,
    kTraceRtpRtcp                = 0x0004,
    kTraceTransport              = 0x0005,
    kTraceSrtp                   = 0x0006,
    kTraceAudioCoding            = 0x0007,
    kTraceAudioMixerServer       = 0x0008,
    kTraceAudioMixerClient       = 0x0009,
    kTraceFile                   = 0x000a,
    kTraceAudioProcessing        = 0x000b,
    kTraceVideoCoding            = 0x0010,
    kTraceVideoMixer             = 0x0011,
    kTraceAudioDevice            = 0x0012,
    kTraceVideoRenderer          = 0x0014,
    kTraceVideoCapture           = 0x0015,
    kTraceRemoteBitrateEstimator = 0x0017,
};

enum TraceLevel
{
    kTraceNone               = 0x0000,    // no trace
    kTraceStateInfo          = 0x0001,
    kTraceWarning            = 0x0002,
    kTraceError              = 0x0004,
    kTraceCritical           = 0x0008,
    kTraceApiCall            = 0x0010,
    kTraceDefault            = 0x00ff,

    kTraceModuleCall         = 0x0020,
    kTraceMemory             = 0x0100,   // memory info
    kTraceTimer              = 0x0200,   // timing info
    kTraceStream             = 0x0400,   // "continuous" stream of data

    // used for debug purposes
    kTraceDebug              = 0x0800,  // debug
    kTraceInfo               = 0x1000,  // debug info

    // Non-verbose level used by LS_INFO of logging.h. Do not use directly.
    kTraceTerseInfo          = 0x2000,

    kTraceAll                = 0xffff
};

// External Trace API
class TraceCallback {
 public:
  virtual void Print(TraceLevel level, const char* message, int length) = 0;

 protected:
  virtual ~TraceCallback() {}
  TraceCallback() {}
};

enum FileFormats
{
    kFileFormatWavFile        = 1,
    kFileFormatCompressedFile = 2,
    kFileFormatPreencodedFile = 4,
    kFileFormatPcm16kHzFile   = 7,
    kFileFormatPcm8kHzFile    = 8,
    kFileFormatPcm32kHzFile   = 9
};

enum ProcessingTypes
{
    kPlaybackPerChannel = 0,
    kPlaybackAllChannelsMixed,
    kRecordingPerChannel,
    kRecordingAllChannelsMixed,
    kRecordingPreprocessing
};

enum FrameType {
  kEmptyFrame = 0,
  kAudioFrameSpeech = 1,
  kAudioFrameCN = 2,
  kVideoFrameKey = 3,
  kVideoFrameDelta = 4,
};

// Statistics for an RTCP channel
struct RtcpStatistics {
  RtcpStatistics()
    : fraction_lost(0),
      cumulative_lost(0),
      extended_max_sequence_number(0),
      jitter(0) {}

  uint8_t fraction_lost;
  uint32_t cumulative_lost;
  uint32_t extended_max_sequence_number;
  uint32_t jitter;
};

class RtcpStatisticsCallback {
 public:
  virtual ~RtcpStatisticsCallback() {}

  virtual void StatisticsUpdated(const RtcpStatistics& statistics,
                                 uint32_t ssrc) = 0;
  virtual void CNameChanged(const char* cname, uint32_t ssrc) = 0;
};

// Statistics for RTCP packet types.
struct RtcpPacketTypeCounter {
  RtcpPacketTypeCounter()
    : first_packet_time_ms(-1),
      nack_packets(0),
      fir_packets(0),
      pli_packets(0),
      nack_requests(0),
      unique_nack_requests(0) {}

  void Add(const RtcpPacketTypeCounter& other) {
    nack_packets += other.nack_packets;
    fir_packets += other.fir_packets;
    pli_packets += other.pli_packets;
    nack_requests += other.nack_requests;
    unique_nack_requests += other.unique_nack_requests;
    if (other.first_packet_time_ms != -1 &&
       (other.first_packet_time_ms < first_packet_time_ms ||
        first_packet_time_ms == -1)) {
      // Use oldest time.
      first_packet_time_ms = other.first_packet_time_ms;
    }
  }

  void Subtract(const RtcpPacketTypeCounter& other) {
    nack_packets -= other.nack_packets;
    fir_packets -= other.fir_packets;
    pli_packets -= other.pli_packets;
    nack_requests -= other.nack_requests;
    unique_nack_requests -= other.unique_nack_requests;
    if (other.first_packet_time_ms != -1 &&
        (other.first_packet_time_ms > first_packet_time_ms ||
         first_packet_time_ms == -1)) {
      // Use youngest time.
      first_packet_time_ms = other.first_packet_time_ms;
    }
  }

  int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
    return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
  }

  int UniqueNackRequestsInPercent() const {
    if (nack_requests == 0) {
      return 0;
    }
    return static_cast<int>(
        (unique_nack_requests * 100.0f / nack_requests) + 0.5f);
  }

  int64_t first_packet_time_ms;  // Time when first packet is sent/received.
  uint32_t nack_packets;   // Number of RTCP NACK packets.
  uint32_t fir_packets;    // Number of RTCP FIR packets.
  uint32_t pli_packets;    // Number of RTCP PLI packets.
  uint32_t nack_requests;  // Number of NACKed RTP packets.
  uint32_t unique_nack_requests;  // Number of unique NACKed RTP packets.
};

class RtcpPacketTypeCounterObserver {
 public:
  virtual ~RtcpPacketTypeCounterObserver() {}
  virtual void RtcpPacketTypesCounterUpdated(
      uint32_t ssrc,
      const RtcpPacketTypeCounter& packet_counter) = 0;
};

// Rate statistics for a stream.
struct BitrateStatistics {
  BitrateStatistics() : bitrate_bps(0), packet_rate(0), timestamp_ms(0) {}

  uint32_t bitrate_bps;   // Bitrate in bits per second.
  uint32_t packet_rate;   // Packet rate in packets per second.
  uint64_t timestamp_ms;  // Ntp timestamp in ms at time of rate estimation.
};

// Callback, used to notify an observer whenever new rates have been estimated.
class BitrateStatisticsObserver {
 public:
  virtual ~BitrateStatisticsObserver() {}

  virtual void Notify(const BitrateStatistics& total_stats,
                      const BitrateStatistics& retransmit_stats,
                      uint32_t ssrc) = 0;
};

struct FrameCounts {
  FrameCounts() : key_frames(0), delta_frames(0) {}
  int key_frames;
  int delta_frames;
};

// Callback, used to notify an observer whenever frame counts have been updated.
class FrameCountObserver {
 public:
  virtual ~FrameCountObserver() {}
  virtual void FrameCountUpdated(const FrameCounts& frame_counts,
                                 uint32_t ssrc) = 0;
};

// Callback, used to notify an observer whenever the send-side delay is updated.
class SendSideDelayObserver {
 public:
  virtual ~SendSideDelayObserver() {}
  virtual void SendSideDelayUpdated(int avg_delay_ms,
                                    int max_delay_ms,
                                    uint32_t ssrc) = 0;
};

// Callback, used to notify an observer whenever a packet is sent to the
// transport.
// TODO(asapersson): This class will remove the need for SendSideDelayObserver.
// Remove SendSideDelayObserver once possible.
class SendPacketObserver {
 public:
  virtual ~SendPacketObserver() {}
  virtual void OnSendPacket(uint16_t packet_id,
                            int64_t capture_time_ms,
                            uint32_t ssrc) = 0;
};

// ==================================================================
// Voice specific types
// ==================================================================

// Each codec supported can be described by this structure.
struct CodecInst {
  int pltype;
  char plname[RTP_PAYLOAD_NAME_SIZE];
  int plfreq;
  int pacsize;
  size_t channels;
  int rate;  // bits/sec unlike {start,min,max}Bitrate elsewhere in this file!

  bool operator==(const CodecInst& other) const {
    return pltype == other.pltype &&
           (STR_CASE_CMP(plname, other.plname) == 0) &&
           plfreq == other.plfreq &&
           pacsize == other.pacsize &&
           channels == other.channels &&
           rate == other.rate;
  }

  bool operator!=(const CodecInst& other) const {
    return !(*this == other);
  }
};

// RTP
enum {kRtpCsrcSize = 15}; // RFC 3550 page 13

enum PayloadFrequencies
{
    kFreq8000Hz = 8000,
    kFreq16000Hz = 16000,
    kFreq32000Hz = 32000
};

enum VadModes                 // degree of bandwidth reduction
{
    kVadConventional = 0,      // lowest reduction
    kVadAggressiveLow,
    kVadAggressiveMid,
    kVadAggressiveHigh         // highest reduction
};

struct NetworkStatistics           // NETEQ statistics
{
    // current jitter buffer size in ms
    uint16_t currentBufferSize;
    // preferred (optimal) buffer size in ms
    uint16_t preferredBufferSize;
    // adding extra delay due to "peaky jitter"
    bool jitterPeaksFound;
    // Loss rate (network + late); fraction between 0 and 1, scaled to Q14.
    uint16_t currentPacketLossRate;
    // Late loss rate; fraction between 0 and 1, scaled to Q14.
    uint16_t currentDiscardRate;
    // fraction (of original stream) of synthesized audio inserted through
    // expansion (in Q14)
    uint16_t currentExpandRate;
    // fraction (of original stream) of synthesized speech inserted through
    // expansion (in Q14)
    uint16_t currentSpeechExpandRate;
    // fraction of synthesized speech inserted through pre-emptive expansion
    // (in Q14)
    uint16_t currentPreemptiveRate;
    // fraction of data removed through acceleration (in Q14)
    uint16_t currentAccelerateRate;
    // fraction of data coming from secondary decoding (in Q14)
    uint16_t currentSecondaryDecodedRate;
    // clock-drift in parts-per-million (negative or positive)
    int32_t clockDriftPPM;
    // average packet waiting time in the jitter buffer (ms)
    int meanWaitingTimeMs;
    // median packet waiting time in the jitter buffer (ms)
    int medianWaitingTimeMs;
    // min packet waiting time in the jitter buffer (ms)
    int minWaitingTimeMs;
    // max packet waiting time in the jitter buffer (ms)
    int maxWaitingTimeMs;
    // added samples in off mode due to packet loss
    size_t addedSamples;
};

// Statistics for calls to AudioCodingModule::PlayoutData10Ms().
struct AudioDecodingCallStats {
  AudioDecodingCallStats()
      : calls_to_silence_generator(0),
        calls_to_neteq(0),
        decoded_normal(0),
        decoded_plc(0),
        decoded_cng(0),
        decoded_plc_cng(0) {}

  int calls_to_silence_generator;  // Number of calls where silence generated,
                                   // and NetEq was disengaged from decoding.
  int calls_to_neteq;  // Number of calls to NetEq.
  int decoded_normal;  // Number of calls where audio RTP packet decoded.
  int decoded_plc;  // Number of calls resulted in PLC.
  int decoded_cng;  // Number of calls where comfort noise generated due to DTX.
  int decoded_plc_cng;  // Number of calls resulted where PLC faded to CNG.
};

typedef struct
{
    int min;              // minumum
    int max;              // maximum
    int average;          // average
} StatVal;

typedef struct           // All levels are reported in dBm0
{
    StatVal speech_rx;   // long-term speech levels on receiving side
    StatVal speech_tx;   // long-term speech levels on transmitting side
    StatVal noise_rx;    // long-term noise/silence levels on receiving side
    StatVal noise_tx;    // long-term noise/silence levels on transmitting side
} LevelStatistics;

typedef struct        // All levels are reported in dB
{
    StatVal erl;      // Echo Return Loss
    StatVal erle;     // Echo Return Loss Enhancement
    StatVal rerl;     // RERL = ERL + ERLE
    // Echo suppression inside EC at the point just before its NLP
    StatVal a_nlp;
} EchoStatistics;

enum NsModes    // type of Noise Suppression
{
    kNsUnchanged = 0,   // previously set mode
    kNsDefault,         // platform default
    kNsConference,      // conferencing default
    kNsLowSuppression,  // lowest suppression
    kNsModerateSuppression,
    kNsHighSuppression,
    kNsVeryHighSuppression,     // highest suppression
};

enum AgcModes                  // type of Automatic Gain Control
{
    kAgcUnchanged = 0,        // previously set mode
    kAgcDefault,              // platform default
    // adaptive mode for use when analog volume control exists (e.g. for
    // PC softphone)
    kAgcAdaptiveAnalog,
    // scaling takes place in the digital domain (e.g. for conference servers
    // and embedded devices)
    kAgcAdaptiveDigital,
    // can be used on embedded devices where the capture signal level
    // is predictable
    kAgcFixedDigital
};

// EC modes
enum EcModes                   // type of Echo Control
{
    kEcUnchanged = 0,          // previously set mode
    kEcDefault,                // platform default
    kEcConference,             // conferencing default (aggressive AEC)
    kEcAec,                    // Acoustic Echo Cancellation
    kEcAecm,                   // AEC mobile
};

// AECM modes
enum AecmModes                 // mode of AECM
{
    kAecmQuietEarpieceOrHeadset = 0,
                               // Quiet earpiece or headset use
    kAecmEarpiece,             // most earpiece use
    kAecmLoudEarpiece,         // Loud earpiece or quiet speakerphone use
    kAecmSpeakerphone,         // most speakerphone use (default)
    kAecmLoudSpeakerphone      // Loud speakerphone
};

// AGC configuration
typedef struct
{
    unsigned short targetLeveldBOv;
    unsigned short digitalCompressionGaindB;
    bool           limiterEnable;
} AgcConfig;                  // AGC configuration parameters

enum StereoChannel
{
    kStereoLeft = 0,
    kStereoRight,
    kStereoBoth
};

// Audio device layers
enum AudioLayers
{
    kAudioPlatformDefault = 0,
    kAudioWindowsWave = 1,
    kAudioWindowsCore = 2,
    kAudioLinuxAlsa = 3,
    kAudioLinuxPulse = 4
};

// TODO(henrika): to be removed.
enum NetEqModes             // NetEQ playout configurations
{
    // Optimized trade-off between low delay and jitter robustness for two-way
    // communication.
    kNetEqDefault = 0,
    // Improved jitter robustness at the cost of increased delay. Can be
    // used in one-way communication.
    kNetEqStreaming = 1,
    // Optimzed for decodability of fax signals rather than for perceived audio
    // quality.
    kNetEqFax = 2,
    // Minimal buffer management. Inserts zeros for lost packets and during
    // buffer increases.
    kNetEqOff = 3,
};

// TODO(henrika): to be removed.
enum OnHoldModes            // On Hold direction
{
    kHoldSendAndPlay = 0,    // Put both sending and playing in on-hold state.
    kHoldSendOnly,           // Put only sending in on-hold state.
    kHoldPlayOnly            // Put only playing in on-hold state.
};

// TODO(henrika): to be removed.
enum AmrMode
{
    kRfc3267BwEfficient = 0,
    kRfc3267OctetAligned = 1,
    kRfc3267FileStorage = 2,
};

// ==================================================================
// Video specific types
// ==================================================================

// Raw video types
enum RawVideoType
{
    kVideoI420     = 0,
    kVideoYV12     = 1,
    kVideoYUY2     = 2,
    kVideoUYVY     = 3,
    kVideoIYUV     = 4,
    kVideoARGB     = 5,
    kVideoRGB24    = 6,
    kVideoRGB565   = 7,
    kVideoARGB4444 = 8,
    kVideoARGB1555 = 9,
    kVideoMJPEG    = 10,
    kVideoNV12     = 11,
    kVideoNV21     = 12,
    kVideoBGRA     = 13,
    kVideoUnknown  = 99
};

// Video codec
enum { kConfigParameterSize = 128};
enum { kPayloadNameSize = 32};
enum { kMaxSimulcastStreams = 4};
enum { kMaxSpatialLayers = 5 };
enum { kMaxTemporalStreams = 4};

enum VideoCodecComplexity
{
    kComplexityNormal = 0,
    kComplexityHigh    = 1,
    kComplexityHigher  = 2,
    kComplexityMax     = 3
};

enum VideoCodecProfile
{
    kProfileBase = 0x00,
    kProfileMain = 0x01
};

enum VP8ResilienceMode {
  kResilienceOff,    // The stream produced by the encoder requires a
                     // recovery frame (typically a key frame) to be
                     // decodable after a packet loss.
  kResilientStream,  // A stream produced by the encoder is resilient to
                     // packet losses, but packets within a frame subsequent
                     // to a loss can't be decoded.
  kResilientFrames   // Same as kResilientStream but with added resilience
                     // within a frame.
};

class TemporalLayersFactory;
// VP8 specific
struct VideoCodecVP8 {
  bool                 pictureLossIndicationOn;
  bool                 feedbackModeOn;
  VideoCodecComplexity complexity;
  VP8ResilienceMode    resilience;
  unsigned char        numberOfTemporalLayers;
  bool                 denoisingOn;
  bool                 errorConcealmentOn;
  bool                 automaticResizeOn;
  bool                 frameDroppingOn;
  int                  keyFrameInterval;
  const TemporalLayersFactory* tl_factory;
};

// VP9 specific.
struct VideoCodecVP9 {
  VideoCodecComplexity complexity;
  int                  resilience;
  unsigned char        numberOfTemporalLayers;
  bool                 denoisingOn;
  bool                 frameDroppingOn;
  int                  keyFrameInterval;
  bool                 adaptiveQpMode;
  bool                 automaticResizeOn;
  unsigned char        numberOfSpatialLayers;
  bool                 flexibleMode;
};

// H264 specific.
struct VideoCodecH264 {
  VideoCodecProfile profile;
  bool           frameDroppingOn;
  int            keyFrameInterval;
  // These are NULL/0 if not externally negotiated.
  const uint8_t* spsData;
  size_t         spsLen;
  const uint8_t* ppsData;
  size_t         ppsLen;
};

// Video codec types
enum VideoCodecType {
  kVideoCodecVP8,
  kVideoCodecVP9,
  kVideoCodecH264,
  kVideoCodecI420,
  kVideoCodecRED,
  kVideoCodecULPFEC,
  kVideoCodecGeneric,
  kVideoCodecUnknown
};

union VideoCodecUnion {
  VideoCodecVP8       VP8;
  VideoCodecVP9       VP9;
  VideoCodecH264      H264;
};

// Simulcast is when the same stream is encoded multiple times with different
// settings such as resolution.
struct SimulcastStream {
  unsigned short      width;
  unsigned short      height;
  unsigned char       numberOfTemporalLayers;
  unsigned int        maxBitrate;  // kilobits/sec.
  unsigned int        targetBitrate;  // kilobits/sec.
  unsigned int        minBitrate;  // kilobits/sec.
  unsigned int        qpMax; // minimum quality
};

struct SpatialLayer {
  int scaling_factor_num;
  int scaling_factor_den;
  int target_bitrate_bps;
  // TODO(ivica): Add max_quantizer and min_quantizer?
};

enum VideoCodecMode {
  kRealtimeVideo,
  kScreensharing
};

// Common video codec properties
struct VideoCodec {
  VideoCodecType      codecType;
  char                plName[kPayloadNameSize];
  unsigned char       plType;

  unsigned short      width;
  unsigned short      height;

  unsigned int        startBitrate;  // kilobits/sec.
  unsigned int        maxBitrate;  // kilobits/sec.
  unsigned int        minBitrate;  // kilobits/sec.
  unsigned int        targetBitrate;  // kilobits/sec.

  unsigned char       maxFramerate;

  VideoCodecUnion     codecSpecific;

  unsigned int        qpMax;
  unsigned char       numberOfSimulcastStreams;
  SimulcastStream     simulcastStream[kMaxSimulcastStreams];
  SpatialLayer spatialLayers[kMaxSpatialLayers];

  VideoCodecMode      mode;

  bool operator==(const VideoCodec& other) const = delete;
  bool operator!=(const VideoCodec& other) const = delete;
};

// Bandwidth over-use detector options.  These are used to drive
// experimentation with bandwidth estimation parameters.
// See modules/remote_bitrate_estimator/overuse_detector.h
struct OverUseDetectorOptions {
  OverUseDetectorOptions()
      : initial_slope(8.0/512.0),
        initial_offset(0),
        initial_e(),
        initial_process_noise(),
        initial_avg_noise(0.0),
        initial_var_noise(50) {
    initial_e[0][0] = 100;
    initial_e[1][1] = 1e-1;
    initial_e[0][1] = initial_e[1][0] = 0;
    initial_process_noise[0] = 1e-13;
    initial_process_noise[1] = 1e-3;
  }
  double initial_slope;
  double initial_offset;
  double initial_e[2][2];
  double initial_process_noise[2];
  double initial_avg_noise;
  double initial_var_noise;
};

// This structure will have the information about when packet is actually
// received by socket.
struct PacketTime {
  PacketTime() : timestamp(-1), not_before(-1) {}
  PacketTime(int64_t timestamp, int64_t not_before)
      : timestamp(timestamp), not_before(not_before) {
  }

  int64_t timestamp;   // Receive time after socket delivers the data.
  int64_t not_before;  // Earliest possible time the data could have arrived,
                       // indicating the potential error in the |timestamp|
                       // value,in case the system is busy.
                       // For example, the time of the last select() call.
                       // If unknown, this value will be set to zero.
};

struct RTPHeaderExtension {
  RTPHeaderExtension();

  bool hasTransmissionTimeOffset;
  int32_t transmissionTimeOffset;
  bool hasAbsoluteSendTime;
  uint32_t absoluteSendTime;
  bool hasTransportSequenceNumber;
  uint16_t transportSequenceNumber;

  // Audio Level includes both level in dBov and voiced/unvoiced bit. See:
  // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
  bool hasAudioLevel;
  bool voiceActivity;
  uint8_t audioLevel;

  // For Coordination of Video Orientation. See
  // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
  // ts_126114v120700p.pdf
  bool hasVideoRotation;
  uint8_t videoRotation;
};

struct RTPHeader {
  RTPHeader();

  bool markerBit;
  uint8_t payloadType;
  uint16_t sequenceNumber;
  uint32_t timestamp;
  uint32_t ssrc;
  uint8_t numCSRCs;
  uint32_t arrOfCSRCs[kRtpCsrcSize];
  size_t paddingLength;
  size_t headerLength;
  int payload_type_frequency;
  RTPHeaderExtension extension;
};

struct RtpPacketCounter {
  RtpPacketCounter()
    : header_bytes(0),
      payload_bytes(0),
      padding_bytes(0),
      packets(0) {}

  void Add(const RtpPacketCounter& other) {
    header_bytes += other.header_bytes;
    payload_bytes += other.payload_bytes;
    padding_bytes += other.padding_bytes;
    packets += other.packets;
  }

  void Subtract(const RtpPacketCounter& other) {
    assert(header_bytes >= other.header_bytes);
    header_bytes -= other.header_bytes;
    assert(payload_bytes >= other.payload_bytes);
    payload_bytes -= other.payload_bytes;
    assert(padding_bytes >= other.padding_bytes);
    padding_bytes -= other.padding_bytes;
    assert(packets >= other.packets);
    packets -= other.packets;
  }

  void AddPacket(size_t packet_length, const RTPHeader& header) {
    ++packets;
    header_bytes += header.headerLength;
    padding_bytes += header.paddingLength;
    payload_bytes +=
        packet_length - (header.headerLength + header.paddingLength);
  }

  size_t TotalBytes() const {
    return header_bytes + payload_bytes + padding_bytes;
  }

  size_t header_bytes;   // Number of bytes used by RTP headers.
  size_t payload_bytes;  // Payload bytes, excluding RTP headers and padding.
  size_t padding_bytes;  // Number of padding bytes.
  uint32_t packets;      // Number of packets.
};

// Data usage statistics for a (rtp) stream.
struct StreamDataCounters {
  StreamDataCounters();

  void Add(const StreamDataCounters& other) {
    transmitted.Add(other.transmitted);
    retransmitted.Add(other.retransmitted);
    fec.Add(other.fec);
    if (other.first_packet_time_ms != -1 &&
       (other.first_packet_time_ms < first_packet_time_ms ||
        first_packet_time_ms == -1)) {
      // Use oldest time.
      first_packet_time_ms = other.first_packet_time_ms;
    }
  }

  void Subtract(const StreamDataCounters& other) {
    transmitted.Subtract(other.transmitted);
    retransmitted.Subtract(other.retransmitted);
    fec.Subtract(other.fec);
    if (other.first_packet_time_ms != -1 &&
        (other.first_packet_time_ms > first_packet_time_ms ||
         first_packet_time_ms == -1)) {
      // Use youngest time.
      first_packet_time_ms = other.first_packet_time_ms;
    }
  }

  int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
    return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
  }

  // Returns the number of bytes corresponding to the actual media payload (i.e.
  // RTP headers, padding, retransmissions and fec packets are excluded).
  // Note this function does not have meaning for an RTX stream.
  size_t MediaPayloadBytes() const {
    return transmitted.payload_bytes - retransmitted.payload_bytes -
           fec.payload_bytes;
  }

  int64_t first_packet_time_ms;  // Time when first packet is sent/received.
  RtpPacketCounter transmitted;  // Number of transmitted packets/bytes.
  RtpPacketCounter retransmitted;  // Number of retransmitted packets/bytes.
  RtpPacketCounter fec;  // Number of redundancy packets/bytes.
};

// Callback, called whenever byte/packet counts have been updated.
class StreamDataCountersCallback {
 public:
  virtual ~StreamDataCountersCallback() {}

  virtual void DataCountersUpdated(const StreamDataCounters& counters,
                                   uint32_t ssrc) = 0;
};

// RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size
// RTCP mode is described by RFC 5506.
enum class RtcpMode { kOff, kCompound, kReducedSize };

enum NetworkState {
  kNetworkUp,
  kNetworkDown,
};

}  // namespace webrtc

#endif  // WEBRTC_COMMON_TYPES_H_


text:
package net.glowstone.entity.meta;

import org.bukkit.entity.*;
import org.bukkit.entity.minecart.PoweredMinecart;

import static net.glowstone.entity.meta.MetadataType.*;

/**
 * Index constants for entity metadata.
 */
public enum MetadataIndex {

    STATUS(0, BYTE, Entity.class),
    AIR_TIME(1, SHORT, Entity.class),

    HEALTH(6, FLOAT, LivingEntity.class),
    POTION_COLOR(7, INT, LivingEntity.class),
    POTION_AMBIENT(8, BYTE, LivingEntity.class),
    ARROW_COUNT(9, BYTE, LivingEntity.class),
    NAME_TAG(10, STRING, LivingEntity.class),
    SHOW_NAME_TAG(11, BYTE, LivingEntity.class),

    // allowed to override NAME_TAG from LivingEntity
    PLAYER_SKIN_FLAGS(10, BYTE, HumanEntity.class),

    AGE(12, BYTE, Ageable.class),

    HORSE_FLAGS(16, INT, Horse.class),
    HORSE_TYPE(19, BYTE, Horse.class),
    HORSE_STYLE(20, INT, Horse.class),
    HORSE_OWNER(21, STRING, Horse.class),
    HORSE_ARMOR(22, INT, Horse.class),

    BAT_HANGING(16, BYTE, Bat.class),

    OCELOT_FLAGS(16, BYTE, Ocelot.class),
    OCELOT_OWNER(17, STRING, Ocelot.class),
    OCELOT_TYPE(18, BYTE, Ocelot.class),

    WOLF_FLAGS(16, BYTE, Wolf.class),
    WOLF_OWNER(17, STRING, Wolf.class),
    WOLF_HEALTH(18, FLOAT, Wolf.class),
    WOLF_BEGGING(19, BYTE, Wolf.class),
    WOLF_COLOR(20, BYTE, Wolf.class),

    PIG_SADDLE(16, BYTE, Pig.class),

    SHEEP_DATA(16, BYTE, Sheep.class),

    VILLAGER_TYPE(16, INT, Villager.class),

    ENDERMAN_BLOCK(16, SHORT, Enderman.class),
    ENDERMAN_BLOCK_DATA(17, BYTE, Enderman.class),
    ENDERMAN_ALERTED(18, BYTE, Enderman.class),

    ZOMBIE_IS_CHILD(12, BYTE, Zombie.class),
    ZOMBIE_IS_VILLAGER(13, BYTE, Zombie.class),
    ZOMBIE_IS_CONVERTING(14, BYTE, Zombie.class),

    BLAZE_ON_FIRE(16, BYTE, Blaze.class),

    SPIDER_CLIMBING(16, BYTE, Spider.class),

    CREEPER_STATE(16, BYTE, Creeper.class),
    CREEPER_POWERED(17, BYTE, Creeper.class),

    GHAST_ATTACKING(16, BYTE, Ghast.class),

    SLIME_SIZE(16, BYTE, Slime.class),

    SKELETON_TYPE(13, BYTE, Skeleton.class),

    WITCH_AGGRESSIVE(21, BYTE, Witch.class),

    GOLEM_PLAYER_BUILT(16, BYTE, IronGolem.class),

    WITHER_TARGET_1(17, INT, Wither.class),
    WITHER_TARGET_2(18, INT, Wither.class),
    WITHER_TARGET_3(19, INT, Wither.class),
    WITHER_INVULN_TIME(20, INT, Wither.class),

    BOAT_HIT_TIME(17, INT, Boat.class),
    BOAT_DIRECTION(18, INT, Boat.class),
    BOAT_DAMAGE_TAKEN(19, FLOAT, Boat.class),

    MINECART_SHAKE_POWER(17, INT, Minecart.class),
    MINECART_SHAKE_DIRECTION(18, INT, Minecart.class),
    MINECART_DAMAGE_TAKEN(19, INT, Minecart.class),
    MINECART_BLOCK(20, INT, Minecart.class),
    MINECART_BLOCK_OFFSET(21, INT, Minecart.class),
    MINECART_BLOCK_SHOWN(22, BYTE, Minecart.class),

    FURNACE_MINECART_POWERED(16, BYTE, PoweredMinecart.class),

    ITEM_ITEM(10, ITEM, Item.class),

    ARROW_CRITICAL(16, BYTE, Arrow.class),

    FIREWORK_INFO(8, ITEM, Firework.class),

    ITEM_FRAME_ITEM(8, ITEM, ItemFrame.class),
    ITEM_FRAME_ROTATION(9, BYTE, ItemFrame.class),

    ENDER_CRYSTAL_HEALTH(8, INT, EnderCrystal.class),

    RABBIT_TYPE(18, BYTE, Rabbit.class),
    ;

    private final int index;
    private final MetadataType type;
    private final Class<? extends Entity> appliesTo;

    private MetadataIndex(int index, MetadataType type, Class<? extends Entity> appliesTo) {
        this.index = index;
        this.type = type;
        this.appliesTo = appliesTo;
    }

    public int getIndex() {
        return index;
    }

    public MetadataType getType() {
        return type;
    }

    public Class<?> getAppliesTo() {
        return appliesTo;
    }

    public boolean appliesTo(Class<? extends Entity> clazz) {
        return appliesTo.isAssignableFrom(clazz);
    }

    public static MetadataIndex getIndex(int index, MetadataType type) {
        MetadataIndex output = null;
        for (MetadataIndex entry : values()) {
            if (entry.getIndex() == index && entry.getType().equals(type)) {
                output = entry;
                break;
            }
        }
        return output;
    }

    public interface StatusFlags {
        int ON_FIRE = 0x01;
        int SNEAKING = 0x02;
        int SPRINTING = 0x08;
        int ARM_UP = 0x10; // eating, drinking, blocking
        int INVISIBLE = 0x20;
    }

    public interface HorseFlags {
        int IS_TAME = 0x02;
        int HAS_SADDLE = 0x04;
        int HAS_CHEST = 0x08;
        int IS_BRED = 0x10;
        int IS_EATING = 0x20;
        int IS_REARING = 0x40;
        int MOUTH_OPEN = 0x80;
    }

    public interface TameableFlags {
        int IS_SITTING = 0x01;
        int WOLF_IS_ANGRY = 0x02;
        int IS_TAME = 0x04;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using DataDogCSharp.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace DataDogCSharp
{
    public interface IDataDogClient
    {
        Task<HttpResponseMessage> Gauge(string metric, double point, IEnumerable<string> tags);
        Task<HttpResponseMessage> Gauge(string metric, IEnumerable<double> points, IEnumerable<string> tags);
        Task<HttpResponseMessage> Gauge(string metric, IEnumerable<DataDogPoint> points, IEnumerable<string> tags);
        Task<HttpResponseMessage> PostToDataDog(DataDogPayload payload);
    }

    public class DataDogClient : IDataDogClient
    {
        private readonly string _apiUrl;
        private readonly HttpClient _httpClient;

        public DataDogClient(string apiKey, string url = "https://app.datadoghq.com/api/v1/series?api_key=")
        {
            _apiUrl = $"{url}{apiKey}";
            _httpClient = new HttpClient();
        }
        public async Task<HttpResponseMessage> Gauge(string metric, double point, IEnumerable<string> tags)
        {
            var dataPoints = new List<DataDogPoint> { new DataDogPoint(point) };
            return await Gauge(metric, dataPoints, tags);
        }

        public async Task<HttpResponseMessage> Gauge(string metric, IEnumerable<double> points, IEnumerable<string> tags)
        {
            var dataPoints = points.Select(p => new DataDogPoint(p));
            return await Gauge(metric, dataPoints, tags);
        }

        public async Task<HttpResponseMessage> Gauge(string metric, IEnumerable<DataDogPoint> points, IEnumerable<string> tags)
        {
            DataDogMetric dataMetric = new DataDogMetric
            {
                Metric = metric,
                Points = points,
                Tags = tags,
                Type = "gauge"
            };

            DataDogPayload payload = new DataDogPayload()
            {
                Series = new List<DataDogMetric> { dataMetric }
            };

            return await PostToDataDog(payload);
        }

        public async Task<HttpResponseMessage> PostToDataDog(DataDogPayload payload)
        {
            var json = JsonConvert.SerializeObject(payload);
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            var result = await _httpClient.PostAsync(_apiUrl, content);
            return result;
        }
    }
}


text:
<?php

include_once dirname(__FILE__) . '/' . '../env_variables.php';
include_once dirname(__FILE__) . '/' . '../utils/system_utils.php';
include_once dirname(__FILE__) . '/' . '../utils/file_utils.php';
include_once dirname(__FILE__) . '/' . '../utils/dataset_utils.php';

// require_once 'components/env_variables.php';
// require_once 'components/utils/system_utils.php';
// require_once 'components/utils/file_utils.php';
// require_once 'components/utils/dataset_utils.php';

class SMException extends Exception
{
    /**
     * @param Captions $captions
     * @return string
     */
    public function getLocalizedMessage($captions)
    {
        return $this->getMessage();
    }
}

class FileSizeExceedMaxSize extends SMException
{
    private $fieldName;
    private $actualFileSize;
    private $maxSize;

    public function  __construct($fieldName, $actualFileSize, $maxSize)
    {
        parent::__construct('', 0);
        $this->fieldName = $fieldName;
        $this->actualFileSize = $actualFileSize;
        $this->maxSize = $maxSize;
    }

    public function GetFieldName()
    {
        return $this->fieldName;
    }

    /**
     * @param Captions $captions
     * @return string
     */
    public function getLocalizedMessage($captions)
    {
        return sprintf($captions->GetMessageString('FileSizeExceedMaxSizeForField'), $this->fieldName, $this->actualFileSize, $this->maxSize);
    }
}

class ImageSizeExceedMaxSize extends SMException
{
    private $fieldName;
    private $actualWidth;
    private $actualHeight;
    private $maxWidth;
    private $maxHeight;

    public function  __construct($fieldName, $actualWidth, $actualHeight, $maxWidth, $maxHeight)
    {
        parent::__construct('', 0);
        $this->fieldName = $fieldName;
        $this->actualWidth = $actualWidth;
        $this->actualHeight = $actualHeight;
        $this->maxWidth = $maxWidth;
        $this->maxHeight = $maxHeight;
    }

    public function GetFieldName()
    {
        return $this->fieldName;
    }

    /**
     * @param Captions $captions
     * @return string
     */
    public function getLocalizedMessage($captions)
    {
        return sprintf($captions->GetMessageString('ImageSizeExceedMaxSizeForField'), $this->fieldName, $this->actualWidth, $this->actualHeight, $this->maxWidth, $this->maxHeight);
    }
}

class CustomEditColumn
{
    private $caption;
    private $editControl;
    private $fieldName;
    private $dataset;

    /** @var Grid */
    private $grid;

    private $allowSetToNull;
    private $allowSetToDefault;
    private $insertDefaultValue;

    private $commitOperations = array(OPERATION_COMMIT, OPERATION_COMMIT_INSERT, OPERATION_AJAX_REQUERT_INLINE_EDIT_COMMIT, OPERATION_AJAX_REQUERT_INLINE_INSERT_COMMIT);
    private $editOperations = array(OPERATION_EDIT, OPERATION_INSERT, OPERATION_COPY, OPERATION_AJAX_REQUERT_INLINE_EDIT, OPERATION_AJAX_REQUERT_INLINE_INSERT);
    private $fieldIsReadOnly;
    private $showSetToNullCheckBox;
    private $readOnly;
    private $variableContainer;

    /**
     * @param string $caption
     * @param string $fieldName
     * @param CustomEditor $editControl
     * @param Dataset $dataset
     * @param bool $allowSetToNull
     * @param bool $allowSetToDefault
     */
    public function __construct($caption, $fieldName, $editControl, $dataset, $allowSetToNull = false, $allowSetToDefault = false)
    {
        $this->caption = $caption;
        $this->editControl = $editControl;
        if ($dataset->GetFieldByName($fieldName) != null)
            $this->fieldIsReadOnly = $dataset->GetFieldByName($fieldName)->GetReadOnly();
        else
            $this->fieldIsReadOnly = true;
        $this->editControl->SetReadOnly($this->fieldIsReadOnly);
        $this->editControl->SetFieldName($fieldName);

        $this->fieldName = $fieldName;
        $this->dataset = $dataset;
        $this->SetAllowSetToNull($allowSetToNull);
        $this->allowSetToDefault = $allowSetToDefault;
        $this->showSetToNullCheckBox = true;
        $this->readOnly = false;
        $this->SetVariableContainer(null);
    }

    /**
     * @return string
     */
    public function GetFieldName()
    { return $this->fieldName; }

    /**
     * @return string
     */
    public function GetCaption()
    { return $this->caption; }

    /**
     * @return CustomEditor
     */
    public function GetEditControl()
    { return $this->editControl; }

    /**
     * @return Dataset
     */
    public function GetDataset()
    { return $this->dataset; }

    public function GetAllowSetToNull()
    {
        return $this->allowSetToNull && !($this->fieldIsReadOnly || $this->readOnly);
    }
    public function SetAllowSetToNull($value)
    {
        $this->allowSetToNull = $value;
        //$this->GetEditControl()->SetAllowNullValue($value);
    }

    /**
     * @return boolean
     */
    public function DisplayAsRequired()
    {
        return !$this->allowSetToNull;
    }

    public function GetAllowSetToDefault()
    { return $this->allowSetToDefault && !($this->fieldIsReadOnly || $this->readOnly); }
    public function SetAllowSetToDefault($value)
    { $this->allowSetToDefault = $value; }

    public function GetInsertDefaultValue()
    { return $this->insertDefaultValue; }
    public function SetInsertDefaultValue($value)
    { $this->insertDefaultValue = $value; }

    public function SetVariableContainer(IVariableContainer $variableContainer = null)
    {
        if ($variableContainer == null)
            $this->variableContainer = new NullVariableContainer();
        else
            $this->variableContainer = $variableContainer;
    }

    public function GetShowSetToNullCheckBox()
    {
        if ($this->GetEditControl()->CanSetupNullValues())
            return false;
        else
            return  $this->GetAllowSetToNull() && $this->showSetToNullCheckBox;
    }

    public function SetShowSetToNullCheckBox($value)
    { $this->showSetToNullCheckBox = $value; }

    public function GetGrid()
    {
        return $this->grid;
    }

    /**
     * @param Grid $value
     * @return void
     */
    public function SetGrid($value)
    {
        $this->grid = $value;
        $this->caption = $this->grid->GetPage()->RenderText($this->caption);
    }

    public function Accept($renderer)
    {
        $this->editControl->Accept($renderer);
    }

    public function GetSetToNullFromPost()
    {
        return
            GetApplication()->IsPOSTValueSet($this->GetFieldName() . '_null') &&
            GetApplication()->GetPOSTValue($this->GetFieldName() . '_null') == 1;
    }

    public function GetSetToDefaultFromPost()
    {
        return
            GetApplication()->IsPOSTValueSet($this->GetFieldName() . '_def') &&
            GetApplication()->GetPOSTValue($this->GetFieldName() . '_def') == 1;
    }

    public function SetControlValuesFromPost()
    {
        $valueChanged = true;
        $value = $this->editControl->ExtractsValueFromPost($valueChanged);
        $this->editControl->SetValue($value);
    }

    public function PrepareEditorControl()
    { }

    protected function CheckValueIsCorrect($value)
    { }

    public function DoSetDatasetValuesFromPost($value) {
        if ($value == '' && $this->allowSetToNull)
            $this->dataset->SetFieldValueByName($this->GetFieldName(), null);
        else
            $this->dataset->SetFieldValueByName($this->GetFieldName(), $value);
    }

    public function SetDatasetValuesFromPost()
    {
        $valueChanged = true;
        $value = $this->editControl->ExtractsValueFromPost($valueChanged);
        $this->SetControlValuesFromPost();

        $this->CheckValueIsCorrect($value);

        if (!$this->readOnly)
        {
            if ($valueChanged)
            {
                if ($this->GetSetToNullFromPost())
                    $this->dataset->SetFieldValueByName($this->GetFieldName(), null);
                elseif ($this->GetSetToDefaultFromPost())
                    $this->dataset->SetFieldValueByName($this->GetFieldName(), null, true);
                else
                    $this->DoSetDatasetValuesFromPost($value);
            }
        }
        else
        {
            if (in_array(GetOperation(), array(OPERATION_COMMIT_INSERT, OPERATION_AJAX_REQUERT_INLINE_INSERT_COMMIT)))
            {
                if ($this->GetInsertDefaultValue() != '')
                {
                    $insertValue = $this->GetInsertDefaultValue();
                    $insertValue = EnvVariablesUtils::EvaluateVariableTemplate($this->variableContainer, $insertValue);
                    $this->DoSetDatasetValuesFromPost($insertValue);
                }
            }
        }
    }

    public function GetValue() {
        return $this->dataset->GetFieldValueByName($this->GetFieldName());
    }

    public function IsValueNull()
    {
        if (GetOperation() == OPERATION_INSERT)
            return false;
        else
        {
            $value = $this->dataset->GetFieldValueByName($this->GetFieldName());
            return !isset($value);
        }
    }

    public function IsValueSetToDefault()
    {
        return $this->GetDataset()->GetFieldByName($this->GetFieldName())->GetIsAutoincrement();
    }

    public function DoSetDefaultValues()
    {
        $insertValue = $this->GetInsertDefaultValue();
        $insertValue = EnvVariablesUtils::EvaluateVariableTemplate($this->variableContainer, $insertValue);
        $this->editControl->SetValue($insertValue);
    }

    public function SetReadOnly($value)
    {
        $this->readOnly = $value;
        $this->GetEditControl()->SetReadOnly($value || $this->fieldIsReadOnly);
    }

    public function GetReadOnly()
    { return $this->readOnly; }

    public function SetControlValuesFromDataset()
    {
        if (!$this->dataset->GetFieldByName($this->fieldName)->GetReadOnly())
        {

            if ((GetOperation() == OPERATION_EDIT) || (GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT))
            {
                $this->editControl->SetValue(
                    $this->dataset->GetFieldValueByName($this->GetFieldName())
                    );
            }
            elseif (GetOperation() == OPERATION_COPY)
            {
                $this->editControl->SetValue(
                    $this->dataset->GetFieldValueByName($this->GetFieldName())
                    );
                $masterFieldValue = $this->dataset->GetMasterFieldValueByName($this->fieldName);
                if (isset($masterFieldValue))
                    $this->editControl->SetValue($masterFieldValue);

            }
            elseif (GetOperation() == OPERATION_INSERT || (GetOperation() == OPERATION_AJAX_REQUERT_INLINE_INSERT))
            {
                $masterFieldValue = $this->dataset->GetMasterFieldValueByName($this->fieldName);
                if (!isset($masterFieldValue))
                    $this->DoSetDefaultValues();
                else
                    $this->editControl->SetValue($masterFieldValue);
            }
        }
        else
        {
            $this->editControl->SetValue(
                $this->dataset->GetFieldByName($this->fieldName)->GetDefaultValue());
        }
    }

    public function ProcessMessages()
    {
        $operation = GetOperation();
        if (in_array($operation, $this->commitOperations))
            $this->SetDatasetValuesFromPost();
        elseif(in_array($operation, $this->editOperations))
            $this->SetControlValuesFromDataset();
    }

    public function AfterSetAllDatasetValues()
    { }
}

class LookUpEditColumn extends CustomEditColumn
{
    /** @var stirng */
    private $linkFieldName;

    /** @var string */
    private $displayFieldName;

    /** @var Dataset */
    private $lookUpDataset;

    /** @var string|null */
    private $captionTemplate;

    /**
     * @param string $caption
     * @param string $fieldName
     * @param CustomEditor $editControl
     * @param Dataset $dataset
     * @param string $linkFieldName
     * @param string $displayFieldName
     * @param Dataset $lookUpDataset
     */
    public function __construct($caption, $fieldName, $editControl, $dataset,
        $linkFieldName, $displayFieldName, $lookUpDataset)
    {
        parent::__construct($caption, $fieldName, $editControl, $dataset);
        $this->linkFieldName = $linkFieldName;
        $this->displayFieldName = $displayFieldName;
        $this->lookUpDataset = $lookUpDataset;
        $this->captionTemplate = null;
    }

    private function GetLookupValues()
    {
        $result = array();
        $this->lookUpDataset->Open();
        while ($this->lookUpDataset->Next())
        {
            $result[$this->lookUpDataset->GetFieldValueByName($this->linkFieldName)] =
                StringUtils::IsNullOrEmpty($this->captionTemplate) ?
                    $this->lookUpDataset->GetFieldValueByName($this->displayFieldName) :
                    DatasetUtils::FormatDatasetFieldsTemplate($this->lookUpDataset, $this->captionTemplate);
        }
        $this->lookUpDataset->Close();

        return $result;
    }

    public function IsValueNull()
    {
        if (GetOperation() == OPERATION_INSERT)
            return false;
        else
        {
            $value = $this->GetDataset()->GetFieldValueByName($this->GetFieldName());
            return !isset($value);
        }
    }

    public function PrepareEditorControl()
    {
        foreach($this->GetLookupValues() as $name => $value)
            $this->GetEditControl()->AddValue($name, $value);
    }

    public function SetControlValuesFromDataset()
    {
        $this->PrepareEditorControl();
        parent::SetControlValuesFromDataset();
    }

    public function GetCaptionTemplate() { return $this->captionTemplate; }

    public function SetCaptionTemplate($value) { $this->captionTemplate = $value; }
}

class DynamicLookupEditColumn extends CustomEditColumn
{
    /** @var string */
    private $displayFieldName;

    /** @var \Dataset */
    private $lookupDataset;

    /** @var string */
    private $lookupIdFieldName;

    /** @var string */
    private $lookupDisplayFieldName;

    /**
     * @param string $caption
     * @param string $fieldName
     * @param string $displayFieldName
     * @param string $handlerName
     * @param AutocomleteComboBox $editControl
     * @param Dataset $dataset
     * @param Dataset $lookupDataset
     * @param string $lookupIdFieldName
     * @param string $lookupDisplayFieldName
     * @param string $captionTemplate
     */
    public function __construct($caption,
        $fieldName,
        $displayFieldName,
        $handlerName,
        $editControl,
        $dataset,
        $lookupDataset,
        $lookupIdFieldName,
        $lookupDisplayFieldName,
        $captionTemplate)
    {
        parent::__construct($caption, $fieldName, $editControl, $dataset);
        $this->displayFieldName = $displayFieldName;
        $editControl->SetHandlerName($handlerName);

        $this->lookupDataset = $lookupDataset;
        $this->lookupIdFieldName = $lookupIdFieldName;
        $this->lookupDisplayFieldName = $lookupDisplayFieldName;
        $this->captionTemplate = $captionTemplate;
    }

    public function PrepareEditorControl()
    {
        $this->GetEditControl()->SetDisplayValue($this->GetDisplayValueFromDataset());
    }

    private function GetDisplayValueFromDataset() {
        if (!StringUtils::IsNullOrEmpty($this->captionTemplate)) {
            $this->lookupDataset->AddFieldFilter(
                $this->lookupIdFieldName,
                new FieldFilter($this->GetDataset()->GetFieldValueByName($this->GetFieldName()), '='));

            $this->lookupDataset->Open();
            if ($this->lookupDataset->Next())
            {
                $displayValue = DatasetUtils::FormatDatasetFieldsTemplate($this->lookupDataset, $this->captionTemplate);
                return $displayValue;
            }
            $this->lookupDataset->Close();
        }
        return $this->GetDataset()->GetFieldValueByName($this->displayFieldName);
    }

    public function SetControlValuesFromDataset()
    {
        if (GetOperation() == OPERATION_EDIT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT )
        {
            $this->GetEditControl()->SetDisplayValue($this->GetDisplayValueFromDataset());
        }
        elseif (GetOperation() == OPERATION_COPY)
        {
            $this->GetEditControl()->SetDisplayValue($this->GetDisplayValueFromDataset());

            /* $masterFieldValue = $this->dataset->GetMasterFieldValueByName($this->fieldName);
            if (isset($masterFieldValue))
                $this->editControl->SetValue($masterFieldValue); */
        }
        elseif (GetOperation() == OPERATION_INSERT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_INSERT )
        {
            $insertDefaultValue = $this->GetInsertDefaultValue();
            if (isset($insertDefaultValue))
            {
                $this->lookupDataset->AddFieldFilter(
                    $this->lookupIdFieldName,
                    new FieldFilter($insertDefaultValue, '='));

                $this->lookupDataset->Open();
                if ($this->lookupDataset->Next())
                {
                    $displayValue = $this->lookupDataset->GetFieldValueByName($this->lookupDisplayFieldName);
                    $this->GetEditControl()->SetDisplayValue($displayValue);
                }
                $this->lookupDataset->Close();
            }
        }
        parent::SetControlValuesFromDataset();
    }
}

class MultiLevelLookupEditColumn extends CustomEditColumn
{
    public function __construct($caption,
        $fieldName,
        $editControl,
        $dataset,
        $allowSetToNull = false, $allowSetToDefault = false)
    {
        parent::__construct($caption, $fieldName, $editControl, $dataset, $allowSetToNull, $allowSetToDefault);
    }

    public function PrepareEditorControl()
    {
        $this->GetEditControl()->SetValue($this->GetDataset()->GetFieldValueByName($this->GetFieldName()));
        $this->GetEditControl()->ProcessLevelValues();
    }

    public function SetControlValuesFromDataset()
    {
        if (GetOperation() == OPERATION_EDIT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT )
        {
            $this->GetEditControl()->SetValue(
                $this->GetDataset()->GetFieldValueByName($this->GetFieldName())
            );
            $this->GetEditControl()->ProcessLevelValues();
        }
    }
}

class FileUploadingColumn extends CustomEditColumn
{
    private $handlerName;
    private $sizeCheckEnabled;
    private $imageSizeCheckEnabled;
    private $maxSize;
    private $maxWidth;
    private $maxHeight;
    private $fileTypeFieldName;
    private $fileNameFieldName;
    private $fileSizeFieldName;
    private $imageFilter;

    public function __construct($caption, $fieldName, $editControl, $dataset, $allowSetToNull = false, $allowSetToDefault = false, $handlerName = '')
    {
        parent::__construct($caption, $fieldName, $editControl, $dataset, $allowSetToNull, $allowSetToDefault);
        $this->handlerName = $handlerName;
        $this->sizeCheckEnabled = false;
        $this->maxSize = 0;

        $this->imageSizeCheckEnabled = false;
        $this->maxWidth = 0;
        $this->maxHeight = 0;
        $this->imageFilter = new NullFilter();
    }

    public function SetFileTypeFieldName($value) { $this->fileTypeFieldName = $value; }
    public function SetFileNameFieldName($value) { $this->fileNameFieldName = $value; }
    public function SetFileSizeFieldName($value) { $this->fileSizeFieldName = $value; }

    public function GetFileTypeFieldName() { return $this->fileTypeFieldName; }
    public function GetFileNameFieldName() { return $this->fileNameFieldName; }
    public function GetFileSizeFieldName() { return $this->fileSizeFieldName; }

    public function DoSetDatasetValuesFromPost($value)
    {
        if ($value) {
            $tempFileName = FileUtils::GetTempFileName();
            $this->imageFilter->ApplyFilter(file_get_contents($value), $tempFileName);

            $this->GetDataset()->SetFieldValueAsFileNameByName($this->GetFieldName(), $tempFileName);

            DatasetUtils::SetDatasetFieldValue($this->GetDataset(),
                $this->GetFileTypeFieldName(),
                $this->GetEditControl()->ExtractFileTypeFromPost()
            );
            DatasetUtils::SetDatasetFieldValue($this->GetDataset(),
                $this->GetFileNameFieldName(),
                $this->GetEditControl()->ExtractFileNameFromPost()
            );
            ;
            DatasetUtils::SetDatasetFieldValue($this->GetDataset(),
                $this->GetFileSizeFieldName(),
                filesize($tempFileName)
            );
        }
        else {
            $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), null);
        }

    }

    public function GetFullImageLink()
    {
        if (GetOperation() == OPERATION_EDIT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT ||
            GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT_COMMIT)
        {
            $result = $this->GetGrid()->CreateLinkBuilder();
            $result->AddParameter('hname', $this->handlerName);
            $result->AddParameter('large', '1');
            AddPrimaryKeyParameters($result, $this->GetDataset()->GetPrimaryKeyValues());
            return $result->GetLink();
        }
    }

    public function SetFileSizeCheckMode($enabled, $maxSize = 0)
    {
        if ($enabled && $maxSize <= 0)
            $this->sizeCheckEnabled = false;
        else
        {
            $this->sizeCheckEnabled = $enabled;
            $this->maxSize = $maxSize;
        }
    }

    public function SetImageSizeCheckMode($enabled, $maxWidth, $maxHeight)
    {
        if ($enabled && ($maxWidth <= 0) || ($maxHeight <= 0))
        {
            $this->imageSizeCheckEnabled = false;
            $this->maxWidth = 0;
            $this->maxHeight = 0;
        }
        else
        {
            $this->imageSizeCheckEnabled = $enabled;
            $this->maxWidth = $maxWidth;
            $this->maxHeight = $maxHeight;
        }
    }

    protected function CheckValueIsCorrect($value)
    {
        $filename = $value;
        if ($this->sizeCheckEnabled)
        {
            if (filesize($filename) > $this->maxSize)
                throw new FileSizeExceedMaxSize($this->GetFieldName(), filesize($filename), $this->maxSize);
        }
        if ($this->imageSizeCheckEnabled)
        {
            if (!ImageUtils::CheckImageSize($filename, $this->maxWidth, $this->maxHeight))
            {
                list($actualWidth, $actualHeight) = ImageUtils::GetImageSize($filename);
                throw new ImageSizeExceedMaxSize($this->GetFieldName(), $actualWidth, $actualHeight, $this->maxWidth, $this->maxHeight);
            }
        }
    }

    public function IsValueNull()
    {
        return false;
    }

    public function SetControlValuesFromPost()
    {
        $this->GetEditControl()->SetLink($this->GetFullImageLink());
    }

    public function PrepareEditorControl()
    {
        if (GetOperation() == OPERATION_EDIT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT ||
            GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT_COMMIT)
            $this->GetEditControl()->SetLink($this->GetFullImageLink());
    }

    public function SetControlValuesFromDataset()
    {
        $this->PrepareEditorControl();
    }

    public function SetImageFilter(ImageFilter $imageFilter)
    {
        $this->imageFilter = $imageFilter;
    }
}

class UploadFileToFolderColumn extends CustomEditColumn
{
    private $targetFolderTemplate;
    public $OnCustomFileName;

    private $useThumbnailGeneration;
    private $fieldNameToSaveThumbnailPath;

    /** @var Delegate */
    private $generateFileNameDelegate;

    /** @var ImageFilter */
    private $thumbnailImageFilter;
    private $directoryToSaveThumbnails;
    private $replaceUploadedFileIfExist;

    public function __construct($caption, $fieldName, $editControl, $dataset, $allowSetToNull = false, $allowSetToDefault = false, $targetFolderTemplate = '', $fileExtension = '')
    {
        parent::__construct($caption, $fieldName, $editControl, $dataset, $allowSetToNull, $allowSetToDefault);
        $this->targetFolderTemplate = $targetFolderTemplate;
        $this->OnCustomFileName = new Event();
        $this->useThumbnailGeneration = false;
        $this->replaceUploadedFileIfExist = true;
    }

    public function GetFullImageLink()
    {
        if (GetOperation() == OPERATION_EDIT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT)
        {
            $value = $this->GetDataset()->GetFieldValueByName($this->GetFieldName());
            return $value;
        }
    }

    public function IsValueNull()
    { return false; }

    private function GetNewFileName($original_file_name, $original_file_extension, $file_size)
    {
        $result = '';
        $handled = false;
        $this->OnCustomFileName->Fire(array(&$result, &$handled, $original_file_name, $original_file_extension, $file_size));

        $targetFolder = FormatDatasetFieldsTemplate($this->GetDataset(), $this->targetFolderTemplate);
        FileUtils::ForceDirectories($targetFolder);

        if (!$handled)
        {
            $filename = FileUtils::AppendFileExtension(rand(), $original_file_extension);
            $result = Path::Combine($targetFolder, $filename);

            while (file_exists($result))
            {
                $filename = FileUtils::AppendFileExtension(rand(), $original_file_extension);
                $result = Path::Combine($targetFolder, $filename);
            }
        }

        return $result;
    }

    private function GetThumbnailFileName($original_file_name, $original_file_extension, $file_size)
    {
        $result = '';
        $handled = false;
        $this->generateFileNameDelegate->CallFromArray(
            array(&$result, &$handled, $original_file_name, $original_file_extension, $file_size));

        $targetFolder = FormatDatasetFieldsTemplate($this->GetDataset(), $this->directoryToSaveThumbnails);
        FileUtils::ForceDirectories($this->directoryToSaveThumbnails);
        if (!$handled)
        {
            $filename = FileUtils::AppendFileExtension(rand(), $original_file_extension);
            $result = Path::Combine($targetFolder, $filename);

            while (file_exists($result))
            {
                $filename = FileUtils::AppendFileExtension(rand(), $original_file_extension);
                $result = Path::Combine($targetFolder, $filename);
            }
        }

        return $result;
    }

    public function AfterSetAllDatasetValues()
    {
        $valueChanged = true;

        $value = $this->GetEditControl()->ExtractsValueFromPost($valueChanged);

        $original_file_extension = $this->GetEditControl()->ExtractFileTypeFromPost($valueChanged);
        $original_file_name = $this->GetEditControl()->ExtractFileNameFromPost($valueChanged);
        $file_size = $this->GetEditControl()->ExtractFileSizeFromPost($valueChanged);

        $target = $this->GetNewFileName($original_file_name, $original_file_extension, $file_size);

        if ($valueChanged && isset($target) && !empty($target))
        {
            FileUtils::MoveUploadedFile($value, $target, $this->replaceUploadedFileIfExist);

            if ($this->GetSetToNullFromPost())
            {
                $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), null);
                if ($this->useThumbnailGeneration)
                   $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, null);
            }
            elseif ($this->GetSetToDefaultFromPost())
            {
                $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), null, true);
                if ($this->useThumbnailGeneration)
                   $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, null);
            }
            else
            {
                $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), $target);

                if ($this->useThumbnailGeneration)
                {
                    $image = file_get_contents($target);
                    $thumbnailFileName = $this->GetThumbnailFileName($original_file_name,
                        $original_file_extension, $file_size);
                    $this->thumbnailImageFilter->ApplyFilter($image, $thumbnailFileName);
                    $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, $thumbnailFileName);
                }
            }
        }
    }

    public function SetDatasetValuesFromPost()
    { }

    public function SetControlValuesFromPost()
    {
        $this->GetEditControl()->SetLink($this->GetFullImageLink());
    }

    public function PrepareEditorControl()
    {
        if (GetOperation() == OPERATION_EDIT || GetOperation() == OPERATION_AJAX_REQUERT_INLINE_EDIT)
            $this->GetEditControl()->SetLink($this->GetFullImageLink());
    }

    public function SetControlValuesFromDataset()
    {
        $this->PrepareEditorControl();
    }

    public function SetGenerationImageThumbnails($fieldNameToSaveThumbnailPath,
        $directoryToSave, IDelegate $generateFileNameDelegate, ImageFilter $thumbnailImageFilter)
    {
        $this->useThumbnailGeneration = true;
        $this->directoryToSaveThumbnails = $directoryToSave;
        $this->fieldNameToSaveThumbnailPath = $fieldNameToSaveThumbnailPath;
        $this->generateFileNameDelegate = $generateFileNameDelegate;
        $this->thumbnailImageFilter = $thumbnailImageFilter;

    }

    public function GetReplaceUploadedFileIfExist()
    {
        return $this->replaceUploadedFileIfExist;
    }

    public function SetReplaceUploadedFileIfExist($replaceUploadedFileIfExist)
    {
        $this->replaceUploadedFileIfExist = $replaceUploadedFileIfExist;
    }
}

?>


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

<title>DigitalChannel</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.qualcomm.robotcore.hardware

Interface DigitalChannel

All Superinterfaces:

HardwareDevice

All Known Implementing Classes:

DigitalChannelImpl

public interface DigitalChannel
extends HardwareDevice

DigitalChannel is an interface by which digital channels can be controlled.
 Such channels have a boolean state, and are modal as to direction, being either input
 channels or output channels.

Nested Class Summary

Nested Classes

Modifier and Type
Interface and Description

static class
DigitalChannel.Mode

Digital channel mode - input or output

Nested classes/interfaces inherited from interface com.qualcomm.robotcore.hardware.HardwareDevice

HardwareDevice.Manufacturer

Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods

Modifier and Type
Method and Description

DigitalChannel.Mode
getMode()

Returns whether the channel is in input or output mode

boolean
getState()

Returns the current state of the channel

void
setMode(DigitalChannel.Mode mode)

Changes whether the channel is in input or output mode

void
setMode(DigitalChannelController.Mode mode)

Deprecated.

use setMode(Mode) instead

void
setState(boolean state)

Sets the current state of the channel

Methods inherited from interface com.qualcomm.robotcore.hardware.HardwareDevice

close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode

Method Detail

getMode

DigitalChannel.Mode getMode()

Returns whether the channel is in input or output mode

Returns:

whether the channel is in input or output mode

See Also:

setMode(Mode)

setMode

void setMode(DigitalChannel.Mode mode)

Changes whether the channel is in input or output mode

Parameters:

mode - whether the channel is in input or output mode

getState

boolean getState()

Returns the current state of the channel

Returns:

the current state of the channel

setState

void setState(boolean state)

Sets the current state of the channel

Parameters:

state - the new state of the channel

setMode

@Deprecated
void setMode(DigitalChannelController.Mode mode)

Deprecated. use setMode(Mode) instead

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
@class YJDropdownMenu;
@protocol YJDropdownMenuDeletege <NSObject>
@optional
- (void)dropdownMenuDidDismiss:(YJDropdownMenu *)menu;
- (void)dropdownMenuDidshow:(YJDropdownMenu *)menu;
@end

@interface YJDropdownMenu : UIView

@property(nonatomic,weak) id<YJDropdownMenuDeletege> deletege;

+(instancetype) menu;
// 显示
-(void)showFrom:(UIView *)from;
// 销毁
-(void)dismiss;
// 内容
@property(nonatomic,strong)UIView *content;
// 内容控制器
@property(nonatomic,strong) UIViewController *contentController;
@end


text:
//
//  IXAttributedText.h
//  Ignite Engine
//
//  Created by Brandon on 3/13/14.
//

//

#import "IXBaseControl.h"

@interface IXAttributedText : IXBaseControl

@end


text:
class PizzaCalc
  attr_reader :amount, :people

  def initialize(people)
    @people = people.to_i
    @amount = total
  end

  # X * 3/8 = P
  def total
    (people * 0.375).ceil
  end
end


text:
public class AddBinary {
    public String addBinary(String a, String b) {
        return Integer.toBinaryString(Integer.parseInt(a, 2) + Integer.parseInt(b, 2));
    }
}


text:
package com.airbnb.reair.incremental.primitives;

import com.airbnb.reair.common.HiveMetastoreClient;
import com.airbnb.reair.common.HiveMetastoreException;
import com.airbnb.reair.common.HiveObjectSpec;
import com.airbnb.reair.common.HiveParameterKeys;
import com.airbnb.reair.incremental.RunInfo;
import com.airbnb.reair.incremental.configuration.Cluster;
import com.airbnb.reair.multiprocessing.Lock;
import com.airbnb.reair.multiprocessing.LockSet;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.metastore.api.Table;

import java.util.Optional;

public class DropTableTask implements ReplicationTask {

  private static final Log LOG = LogFactory.getLog(DropTableTask.class);

  private Cluster srcCluster;
  private Cluster destCluster;
  private HiveObjectSpec spec;
  private Optional<String> sourceTldt;

  /**
   * TODO.
   *
   * @param srcCluster TODO
   * @param destCluster TODO
   * @param spec TODO
   * @param sourceTldt TODO
   */
  public DropTableTask(
      Cluster srcCluster,
      Cluster destCluster,
      HiveObjectSpec spec,
      Optional<String> sourceTldt) {
    this.srcCluster = srcCluster;
    this.destCluster = destCluster;
    this.spec = spec;
    this.sourceTldt = sourceTldt;
  }

  @Override
  public RunInfo runTask() throws HiveMetastoreException {
    LOG.debug("Looking to drop: " + spec);
    LOG.debug("Source TLDT is : " + sourceTldt);

    if (!sourceTldt.isPresent()) {
      LOG.error("For safety, not completing drop task since source " + " object TLDT is missing!");
      return new RunInfo(RunInfo.RunStatus.NOT_COMPLETABLE, 0);
    }
    String expectedTldt = sourceTldt.get();

    HiveMetastoreClient ms = destCluster.getMetastoreClient();
    Table destTable = ms.getTable(spec.getDbName(), spec.getTableName());

    if (destTable == null) {
      LOG.warn("Missing " + spec + " on destination, so can't drop!");
      return new RunInfo(RunInfo.RunStatus.NOT_COMPLETABLE, 0);
    }

    LOG.debug("Destination object is: " + destTable);

    String destTldt = destTable.getParameters().get(HiveParameterKeys.TLDT);

    if (expectedTldt.equals(destTldt)) {
      LOG.debug(
          String.format("Destination table %s matches expected" + " TLDT (%s)", spec, destTldt));
      LOG.debug("Dropping " + spec);
      ms.dropTable(spec.getDbName(), spec.getTableName(), true);
      LOG.debug("Dropped " + spec);
      return new RunInfo(RunInfo.RunStatus.SUCCESSFUL, 0);
    } else {
      LOG.debug(
          String.format("Not dropping %s as source(%s) and " + "destination(%s) TLDT's dont match",
              spec.toString(), expectedTldt, destTldt));
      return new RunInfo(RunInfo.RunStatus.NOT_COMPLETABLE, 0);
    }
  }

  @Override
  public LockSet getRequiredLocks() {
    LockSet lockSet = new LockSet();
    lockSet.add(new Lock(Lock.Type.EXCLUSIVE, spec.toString()));
    return lockSet;
  }
}


text:
namespace webkit_glue {

static const char kIntentsInlineDisposition[] = "inline";

WebIntentServiceData::WebIntentServiceData()
    : disposition(WebIntentServiceData::DISPOSITION_WINDOW) {
}

WebIntentServiceData::WebIntentServiceData(const GURL& svc_url,
                                           const string16& svc_action,
                                           const string16& svc_type,
                                           const string16& svc_title)
    : service_url(svc_url),
      action(svc_action),
      type(svc_type),
      title(svc_title),
      disposition(WebIntentServiceData::DISPOSITION_WINDOW) {
}

WebIntentServiceData::~WebIntentServiceData() {}

bool WebIntentServiceData::operator==(const WebIntentServiceData& other) const {
  return service_url == other.service_url &&
         action == other.action &&
         type == other.type &&
         title == other.title &&
         disposition == other.disposition;
}

void WebIntentServiceData::setDisposition(const string16& disp) {
  if (disp == ASCIIToUTF16(webkit_glue::kIntentsInlineDisposition))
    disposition = DISPOSITION_INLINE;
  else
    disposition = DISPOSITION_WINDOW;
}

std::ostream& operator<<(::std::ostream& os,
                         const WebIntentServiceData& intent) {
  return os <<
         "{" << intent.service_url <<
         ", " << UTF16ToUTF8(intent.action) <<
         ", " << UTF16ToUTF8(intent.type) <<
         ", " << UTF16ToUTF8(intent.title) <<
         ", " << intent.disposition <<
         "}";
}

}  // namespace webkit_glue


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE locale SYSTEM "../../../../../lib/pkp/dtd/locale.dtd">

<locale name="en_US" full_name="U.S. English">
	<message key="plugins.paymethod.paypal.displayName">PayPal Fee Payment</message>

	<message key="plugins.paymethod.paypal.settings.paypalenable">Enable PayPal</message>
	<message key="plugins.paymethod.paypal.settings.paypalurl">IPN URL</message>
	<message key="plugins.paymethod.paypal.settings.paypalurl.description"><![CDATA[This is the URL to PayPal's Instant Payment Notification (IPN) service. For testing, use https://www.sandbox.paypal.com/cgi-bin/webscr; for production systems, use https://www.paypal.com/cgi-bin/webscr.]]></message>
	<message key="plugins.paymethod.paypal.settings.selleraccount">Seller Account</message>
	<message key="plugins.paymethod.paypal.settings.selleraccount.description">This is the PayPal account username for the sellers' account to be used, typically an email address. Ensure that you activate Instant Payment Notification (IPN) in your seller account Profile.</message>
	<message key="plugins.paymethod.paypal.settings.curlNotInstalled">Warning: CURL support for PHP is not installed. PayPal payment support requires the CURL library and will not function until it is installed.</message>
	<message key="plugins.paymethod.paypal.settings">PayPal Settings</message>

	<message key="plugins.paymethod.paypal">PayPal Fee Payment</message>
	<message key="plugins.paymethod.paypal.description"><![CDATA[PayPal enables users, whether or not they are PayPal members, to use all major credit cards. The Manager will need to set up a PayPal Business Account.]]></message>
	<message key="plugins.paymethod.paypal.warning">Click the Continue button below to go to the PayPal site, where credit cards can be used to pay the fee (without having to join PayPal). Use the "Return to Merchant" button after making payment to return to this site.</message>
	<message key="plugins.paymethod.paypal.purchase.title">Title</message>
	<message key="plugins.paymethod.paypal.purchase.fee">Fee</message>
	<message key="plugins.paymethod.paypal.purchase.description">Description</message>
	<message key="plugins.paymethod.paypal.purchase.cancelled">Your purchase has been cancelled.</message>
	<message key="plugins.paymethod.paypal.purchase.cancelled.title">Purchase Cancelled</message>
</locale>


text:
package com.siyeh.ig.psiutils;

import com.intellij.lang.ASTFactory;
import com.intellij.lang.ASTNode;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;

import java.util.*;
import java.util.function.Function;
import java.util.function.Predicate;

/**
 * A helper class to implement quick-fix which collects removed comments from the PSI and can restore them at once.
 *
 * After this object restores comments, it becomes unusable.
 *
 * @author Tagir Valeev
 */
public class CommentTracker {
  private Set<PsiElement> ignoredParents = new HashSet<>();
  private List<PsiComment> comments = new ArrayList<>();

  /**
   * Marks the element as unchanged and returns its text. The unchanged elements are assumed to be preserved
   * in the resulting code as is, so the comments from them will not be extracted.
   *
   * @param element element to return the text
   * @return a text to be inserted into refactored code
   */
  public @NotNull String text(@NotNull PsiElement element) {
    checkState();
    addIgnored(element);
    return element.getText();
  }

  /**
   * Marks the element as unchanged and returns it. The unchanged elements are assumed to be preserved
   * in the resulting code as is, so the comments from them will not be extracted.
   *
   * @param element element to mark
   * @param <T> the type of the element
   * @return the passed argument
   */
  public @NotNull <T extends PsiElement> T markUnchanged(@NotNull T element) {
    checkState();
    addIgnored(element);
    return element;
  }

  /**
   * Deletes given PsiElement collecting all the comments inside it.
   *
   * @param element element to delete
   */
  public void delete(@NotNull PsiElement element) {
    grabComments(element);
    element.delete();
  }

  /**
   * Deletes all given PsiElement's collecting all the comments inside them.
   *
   * @param elements elements to delete (all not null)
   */
  public void delete(@NotNull PsiElement... elements) {
    for(PsiElement element : elements) {
      delete(element);
    }
  }

  /**
   * Deletes given PsiElement replacing it with the comments including comments inside the deleted element
   * and previously gathered comments.
   *
   *
After calling this method the tracker cannot be used anymore.

   *
   * @param element element to delete
   */
  public void deleteAndRestoreComments(@NotNull PsiElement element) {
    grabComments(element);
    insertCommentsBefore(element instanceof PsiVariable ? element.getParent() : element);
    element.delete();
  }

  /**
   * Replaces given PsiElement collecting all the comments inside it.
   *
   * @param element element to replace
   * @param replacement replacement element
   * @return the element which was actually inserted in the tree (either {@code replacement} or its copy)
   */
  public @NotNull PsiElement replace(@NotNull PsiElement element, @NotNull PsiElement replacement) {
    grabComments(element);
    return element.replace(replacement);
  }

  /**
   * Creates a replacement element from the text and replaces given element,
   * collecting all the comments inside it.
   *
   *

   *   The type of the created replacement will mimic the type of supplied element.
   *   Supported element types are: {@link PsiExpression}, {@link PsiStatement},
   *   {@link PsiTypeElement}, {@link PsiIdentifier}, {@link PsiComment}.
   *

   *
   * @param element element to replace
   * @param text replacement text
   * @return the element which was actually inserted in the tree
   */
  public @NotNull PsiElement replace(@NotNull PsiElement element, @NotNull String text) {
    PsiElement replacement = createElement(element, text);
    return replace(element, replacement);
  }

  /**
   * Replaces given PsiElement collecting all the comments inside it and restores comments putting them
   * to the appropriate place before replaced element.
   *
   *
After calling this method the tracker cannot be used anymore.

   *
   * @param element element to replace
   * @param replacement replacement element
   * @return the element which was actually inserted in the tree (either {@code replacement} or its copy)
   */
  public @NotNull PsiElement replaceAndRestoreComments(@NotNull PsiElement element, @NotNull PsiElement replacement) {
    PsiElement result = replace(element, replacement);
    PsiElement anchor = PsiTreeUtil.getNonStrictParentOfType(result, PsiStatement.class, PsiLambdaExpression.class, PsiVariable.class);
    if(anchor instanceof PsiLambdaExpression && anchor != result) {
      anchor = ((PsiLambdaExpression)anchor).getBody();
    }
    if(anchor instanceof PsiVariable && anchor.getParent() instanceof PsiDeclarationStatement) {
      anchor = anchor.getParent();
    }
    if(anchor == null) anchor = result;
    insertCommentsBefore(anchor);
    return result;
  }

  /**
   * Creates a replacement element from the text and replaces given element,
   * collecting all the comments inside it and restores comments putting them
   * to the appropriate place before replaced element.
   *
   *
After calling this method the tracker cannot be used anymore.

   *
   *

   *   The type of the created replacement will mimic the type of supplied element.
   *   Supported element types are: {@link PsiExpression}, {@link PsiStatement},
   *   {@link PsiTypeElement}, {@link PsiIdentifier}, {@link PsiComment}.
   *

   *
   * @param element element to replace
   * @param text replacement text
   * @return the element which was actually inserted in the tree
   */
  public @NotNull PsiElement replaceAndRestoreComments(@NotNull PsiElement element, @NotNull String text) {
    PsiElement replacement = createElement(element, text);
    return replaceAndRestoreComments(element, replacement);
  }

  @NotNull
  private static PsiElement createElement(@NotNull PsiElement element, @NotNull String text) {
    PsiElementFactory factory = JavaPsiFacade.getElementFactory(element.getProject());
    PsiElement replacement;
    if(element instanceof PsiExpression) {
      replacement = factory.createExpressionFromText(text, element);
    } else if(element instanceof PsiStatement) {
      replacement = factory.createStatementFromText(text, element);
    } else if(element instanceof PsiTypeElement) {
      replacement = factory.createTypeElementFromText(text, element);
    } else if(element instanceof PsiIdentifier) {
      replacement = factory.createIdentifier(text);
    } else if(element instanceof PsiComment) {
      replacement = factory.createCommentFromText(text, element);
    } else {
      throw new IllegalArgumentException("Unsupported element type: "+element);
    }
    return replacement;
  }

  /**
   * Inserts gathered comments just before given anchor element
   *
   *
After calling this method the tracker cannot be used anymore.

   *
   * @param anchor
   */
  public void insertCommentsBefore(@NotNull PsiElement anchor) {
    checkState();
    if(!comments.isEmpty()) {
      PsiElement parent = anchor.getParent();
      PsiElementFactory factory = JavaPsiFacade.getElementFactory(anchor.getProject());
      for(PsiComment comment : comments) {
        if (shouldIgnore(comment)) continue;
        PsiElement added = parent.addBefore(factory.createCommentFromText(comment.getText(), anchor), anchor);
        PsiElement prevSibling = added.getPrevSibling();
        if (prevSibling instanceof PsiWhiteSpace) {
          ASTNode whiteSpaceBefore = normalizeWhiteSpace((PsiWhiteSpace)prevSibling);
          PsiElement prev = anchor.getPrevSibling();
          parent.getNode().addChild(whiteSpaceBefore, anchor.getNode());
          if (prev instanceof PsiWhiteSpace) {
            prev.delete();
          }
        }
      }
    }
    comments = null;
  }

  @NotNull
  private static ASTNode normalizeWhiteSpace(PsiWhiteSpace whiteSpace) {
    String text = whiteSpace.getText();
    int endLPos = text.lastIndexOf('\n');
    if(text.lastIndexOf('\n', endLPos-1) >= 0) {
      // has at least two line breaks
      return ASTFactory.whitespace(text.substring(endLPos));
    }
    return ASTFactory.whitespace(text);
  }

  private boolean shouldIgnore(PsiComment comment) {
    return ignoredParents.stream().anyMatch(p -> PsiTreeUtil.isAncestor(p, comment, false));
  }

  private void grabComments(PsiElement element) {
    checkState();
    for(PsiComment comment : PsiTreeUtil.collectElementsOfType(element, PsiComment.class)) {
      if (!shouldIgnore(comment)) {
        comments.add(comment);
      }
    }
  }

  private void checkState() {
    if(comments == null) {
      throw new IllegalStateException(getClass().getSimpleName()+" has been already used");
    }
  }

  private void addIgnored(PsiElement element) {
    if(element instanceof LeafPsiElement && !(element instanceof PsiComment)) return;
    ignoredParents.add(element);
  }

  public static String textWithSurroundingComments(PsiElement element) {
    Predicate<PsiElement> commentOrWhiteSpace = e -> e instanceof PsiComment || e instanceof PsiWhiteSpace;
    List<PsiElement> prev = StreamEx.iterate(element.getPrevSibling(), commentOrWhiteSpace, PsiElement::getPrevSibling).toList();
    List<PsiElement> next = StreamEx.iterate(element.getNextSibling(), commentOrWhiteSpace, PsiElement::getNextSibling).toList();
    if(StreamEx.of(prev, next).flatCollection(Function.identity()).anyMatch(PsiComment.class::isInstance)) {
      return StreamEx.ofReversed(prev).append(element).append(next).map(PsiElement::getText).joining();
    }
    return element.getText();
  }

  /**
   * Returns a string containing all the comments (possibly with some white-spaces) between given elements
   * (not including given elements themselves). This method also deletes all the comments actually used
   * in the returned string.
   *
   * @param start start element
   * @param end   end element, must strictly follow the start element and be located in the same file
   *              (though possibly on another hierarchy level)
   * @return a string containing all the comments between start and end.
   */
  @NotNull
  public static String commentsBetween(@NotNull PsiElement start, @NotNull PsiElement end) {
    PsiElement parent = PsiTreeUtil.findCommonParent(start, end);
    if (parent == null) {
      throw new IllegalStateException("Common parent is not found: [" + start + ".." + end + "]");
    }
    PsiElement cur = next(start, parent);
    List<PsiComment> comments = new ArrayList<>();
    while (cur != null && !PsiTreeUtil.isAncestor(cur, end, false)) {
      comments.addAll(PsiTreeUtil.findChildrenOfType(cur, PsiComment.class));
      if (cur instanceof PsiComment) {
        comments.add((PsiComment)cur);
      }
      cur = next(cur, parent);
    }
    if (cur == null) {
      throw new IllegalStateException("End is not reached: [" + start + ".." + end + "]");
    }
    PsiElement tail = prev(end, cur);
    Deque<PsiComment> tailComments = new ArrayDeque<>();
    while (tail != null) {
      PsiTreeUtil.findChildrenOfType(tail, PsiComment.class).forEach(tailComments::addFirst);
      if (cur instanceof PsiComment) {
        comments.add((PsiComment)cur);
      }
      tail = prev(tail, cur);
    }
    comments.addAll(tailComments);
    StringBuilder sb = new StringBuilder();
    for (PsiComment comment : comments) {
      PsiElement prev = prev(comment, parent);
      if (prev instanceof PsiWhiteSpace) {
        sb.append(prev.getText());
      }
      sb.append(comment.getText());
      PsiElement next = next(comment, parent);
      if (next instanceof PsiWhiteSpace) {
        sb.append(next.getText());
      }
      comment.delete();
    }
    return sb.toString();
  }

  private static PsiElement next(PsiElement cur, PsiElement stopAtParent) {
    if (cur == stopAtParent) return null;
    PsiElement next = cur.getNextSibling();
    if (next != null) return next;
    PsiElement parent = cur.getParent();
    if (parent == stopAtParent) return null;
    return next(parent, stopAtParent);
  }

  private static PsiElement prev(PsiElement cur, PsiElement stopAtParent) {
    if (cur == stopAtParent) return null;
    PsiElement prev = cur.getPrevSibling();
    if (prev != null) return prev;
    PsiElement parent = cur.getParent();
    if (parent == stopAtParent || parent == null) return null;
    return prev(parent, stopAtParent);
  }
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { addCheckin, deleteCheckin } from '../reducers/checkin.reducer';
import { inviteUser, removeMember, deleteTeam, addTeam } from '../reducers/team.reducer';
import { joinTeam } from '../reducers/user.reducer';
import { setTitle } from '../reducers/page-title.reducer';
import HasTeam from './team.has-team';
import {
  getTodaysCheckins,
  getTeamMembers,
  getTeam
} from './utils';

class TeamPage extends React.Component {

  static propTypes = {
    query: PropTypes.object,
    user: PropTypes.object,
    team: PropTypes.object,
    checkins: PropTypes.object,
    members: PropTypes.object,
    invite: PropTypes.func,
    unsubscribe: PropTypes.func,
    join: PropTypes.func,
    dispatchDeleteCheckin: PropTypes.func,
    dispatchCheckin: PropTypes.func,
    deleteTeam: PropTypes.func
  };

  componentWillReceiveProps({ dispatchTitle, team } = {}) {
    if (team) {
      dispatchTitle(team.teamName);
    }
  };

  render() {
    const { team, join, user, query: { teamId } } = this.props;
    return (
      <div>
        { team ? <HasTeam { ...this.props } /> : null }
        { user && !team ? <button onClick={join({ userId: user.uid, teamId })}>Join</button> : null }
      </div>
    );
  };

};

const mapStateToProps = ({ checkins, teams, user, users }, { query: { teamId } }) => ({
  team: getTeam({ teams, teamId }),
  checkins: getTodaysCheckins({ checkins, teamId }),
  members: getTeamMembers({ users, teams, teamId }),
  user
});

const mapDispatchToProps = dispatch => ({
  invite: ({email, teamId} = {}) => dispatch(inviteUser({email, teamId})),
  unsubscribe: ({userId, teamId} = {}) => () => dispatch(removeMember({userId, teamId})),
  join: ({userId, teamId} = {}) => () => dispatch(joinTeam({userId, teamId})),
  deleteTeam: team => dispatch(deleteTeam(team)),
  dispatchTitle: title => dispatch(setTitle(title)),
  dispatchCheckin: values => dispatch(addCheckin(values)),
  dispatchDeleteCheckin: ({teamId, checkinId}) => () => dispatch(deleteCheckin({teamId, checkinId}))
});

export default connect(mapStateToProps, mapDispatchToProps)(TeamPage);


text:
module.exports = angular.module('app.controls', []);
require('./qjcomboboxCtrl.js');
require('./qjfilterCtrl.js');
require('./qjlistviewCtrl.js');
require('./qjselectkeyCtrl.js');
require('./qjtimercounterCtrl.js');


text:
package io.hgc.jarspec.fixtures.rules;

import io.hgc.jarspec.JarSpecJUnitRunner;
import io.hgc.jarspec.Specification;
import io.hgc.jarspec.SpecificationNode;
import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
import org.junit.runners.model.Statement;

import static org.junit.Assert.assertTrue;

@RunWith(JarSpecJUnitRunner.class)
public class ErrorInRuleSpec implements Specification {
    @Override
    public SpecificationNode root() {
        return it("has a passing test with a failing block rule", () -> assertTrue(true)).withBlockRule(ruleWithError);
    }

    private static TestRule ruleWithError = (base, description) -> new Statement() {
        @Override
        public void evaluate() throws Throwable {
            throw new RuntimeException("Test exception thrown from rule");
        }
    };
}


text:
goog.require('ol.Map');
goog.require('ngeo.LayertreeController');

describe('ngeo.layertreeDirective', () => {

  let roottreeCtrl;

  beforeEach(() => {

    const map = new ol.Map({
      view: new ol.View({
        center: [0, 0],
        zoom: 0
      })
    });

    const element = angular.element(
      '<div ngeo-layertree="tree"' +
        'ngeo-layertree-map="map"' +
        'ngeo-layertree-nodelayer="getLayer(node)"' +
      '
'
    );

    const tree = {
      'name': 'Root',
      'children': [{
        'name': 'Node 0',
        'children': [{
          'name': 'Leaf 00'
        }, {
          'name': 'Leaf 01'
        }]
      }, {
        'name': 'Leaf 1'
      }]
    };

    const getLayer = function(node) {
      return new ol.layer.Image();
    };

    inject(($rootScope, $compile, $sce) => {
      $rootScope.tree = tree;
      $rootScope.map = map;
      $rootScope.getLayer = getLayer;
      $compile(element)($rootScope);
      $rootScope.$digest();
    });

    roottreeCtrl = element.scope().layertreeCtrl;
  });

  it('Get state', () => {
    const treeNode0 = roottreeCtrl.children[0];
    const treeLeaf00 = treeNode0.children[0];
    const treeLeaf01 = treeNode0.children[1];
    const treeLeaf1 = roottreeCtrl.children[1];
    expect(roottreeCtrl.getState()).toBe('off');
    expect(treeNode0.getState()).toBe('off');
    expect(treeLeaf00.getState()).toBe('off');
    expect(treeLeaf01.getState()).toBe('off');
    expect(treeLeaf1.getState()).toBe('off');
  });

  it('Set state', () => {
    const treeNode0 = roottreeCtrl.children[0];
    const treeLeaf00 = treeNode0.children[0];
    const treeLeaf01 = treeNode0.children[1];
    const treeLeaf1 = roottreeCtrl.children[1];

    treeLeaf01.setState('on');
    expect(roottreeCtrl.getState()).toBe('indeterminate');
    expect(treeNode0.getState()).toBe('indeterminate');
    expect(treeLeaf00.getState()).toBe('off');
    expect(treeLeaf01.getState()).toBe('on');
    expect(treeLeaf1.getState()).toBe('off');

    treeLeaf00.setState('on');
    expect(roottreeCtrl.getState()).toBe('indeterminate');
    expect(treeNode0.getState()).toBe('on');
    expect(treeLeaf00.getState()).toBe('on');
    expect(treeLeaf01.getState()).toBe('on');
    expect(treeLeaf1.getState()).toBe('off');

    treeLeaf1.setState('on');
    expect(roottreeCtrl.getState()).toBe('on');
    expect(treeNode0.getState()).toBe('on');
    expect(treeLeaf00.getState()).toBe('on');
    expect(treeLeaf01.getState()).toBe('on');
    expect(treeLeaf1.getState()).toBe('on');

    roottreeCtrl.setState('This is not a state'); // = 'off'
    expect(roottreeCtrl.getState()).toBe('off');
    expect(treeNode0.getState()).toBe('off');
    expect(treeLeaf00.getState()).toBe('off');
    expect(treeLeaf01.getState()).toBe('off');
    expect(treeLeaf1.getState()).toBe('off');

    treeNode0.setState('on');
    expect(roottreeCtrl.getState()).toBe('indeterminate');
    expect(treeNode0.getState()).toBe('on');
    expect(treeLeaf00.getState()).toBe('on');
    expect(treeLeaf01.getState()).toBe('on');
    expect(treeLeaf1.getState()).toBe('off');
  });

  it('Refresh state', () => {
    const treeNode0 = roottreeCtrl.children[0];
    const treeLeaf01 = treeNode0.children[1];
    treeLeaf01.state_ = 'on';
    treeNode0.refreshState();
    expect(treeNode0.getState()).toBe('indeterminate');
    expect(roottreeCtrl.getState()).toBe('indeterminate');
  });

  it('Get calculate state', () => {
    const treeNode0 = roottreeCtrl.children[0];
    const treeLeaf01 = treeNode0.children[1];
    treeLeaf01.state_ = 'on';
    expect(roottreeCtrl.getCalculateState()).toBe('indeterminate');
    expect(treeNode0.getCalculateState()).toBe('indeterminate');
    expect(treeLeaf01.getCalculateState()).toBe('on');
  });

  it('Get first parent tree', () => {
    const treeNode0 = roottreeCtrl.children[0];
    const treeLeaf01 = treeNode0.children[1];
    const treeLeaf1 = roottreeCtrl.children[1];
    expect(ngeo.LayertreeController.getFirstParentTree(treeLeaf01).node.name).toBe(treeNode0.node.name);
    expect(ngeo.LayertreeController.getFirstParentTree(treeLeaf1).node.name).toBe(treeLeaf1.node.name);
  });

  it('Traverse tree', () => {
    // All nodes of the graph
    let visited = '';
    roottreeCtrl.traverseDepthFirst((treeCtrl) => {
      visited += `, ${treeCtrl.node.name}`;
    });
    expect(visited).toBe(', Root, Node 0, Leaf 00, Leaf 01, Leaf 1');

    // Stop at first node
    visited = '';
    roottreeCtrl.traverseDepthFirst((treeCtrl) => {
      visited = `${visited}, ${treeCtrl.node.name}`;
      return ngeo.LayertreeController.VisitorDecision.STOP;
    });
    expect(visited).toBe(', Root');

    // Stop at leaf01 node
    visited = '';
    roottreeCtrl.traverseDepthFirst((treeCtrl) => {
      visited = `${visited}, ${treeCtrl.node.name}`;
      if (treeCtrl.node.name === 'Leaf 01') {
        return ngeo.LayertreeController.VisitorDecision.STOP;
      }
    });
    expect(visited).toBe(', Root, Node 0, Leaf 00, Leaf 01');

    // Skip Node0 children
    visited = '';
    roottreeCtrl.traverseDepthFirst((treeCtrl) => {
      visited = `${visited}, ${treeCtrl.node.name}`;
      if (treeCtrl.node.name === 'Node 0') {
        return ngeo.LayertreeController.VisitorDecision.SKIP;
      }
    });
    expect(visited).toBe(', Root, Node 0, Leaf 1');
  });
});


text:
#ifndef _VMX_TIMER_H_
#define _VMX_TIMER_H_

// Function : vmx_timer_hw_setup
// Purpose  : Checks if VMX timer is supported by hardware and if so,
//          : calculates its rate relative to TSC.
// Arguments: void
// Return   : TRUE id supported
// Note     : Must be call 1st on the given core.
BOOLEAN vmx_timer_hw_setup(void);
BOOLEAN vmx_timer_create(GUEST_CPU_HANDLE gcpu);
BOOLEAN vmx_timer_start(GUEST_CPU_HANDLE gcpu);
BOOLEAN vmx_timer_stop(GUEST_CPU_HANDLE gcpu);
BOOLEAN vmx_timer_set_period(GUEST_CPU_HANDLE gcpu, UINT64 period);
BOOLEAN vmx_timer_launch(GUEST_CPU_HANDLE gcpu, UINT64 time_to_expiration, BOOLEAN periodic);
BOOLEAN vmx_timer_set_mode(GUEST_CPU_HANDLE gcpu, BOOLEAN save_value_mode);

#endif // _VMX_TIMER_H_