text:
"""Python file with invalid syntax, used by scripts/linters/
python_linter_test.py. This file contains just one newline between imports and
class defintion but two newlines are required on line 26.
"""

from __future__ import annotations

class FakeClass:
    """This is a fake docstring for valid syntax purposes."""

    def __init__(self, fake_arg):
        self.fake_arg = fake_arg

    def fake_method(self, name):
        """This doesn't do anything.

        Args:
            name: str. Means nothing.

        Yields:
            tuple(str, str). The argument passed in but twice in a tuple.
        """
        yield (name, name)


text: color/randomness for JS

redpajama_set_name: RedPajamaGithub


text:
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"

#include <string.h>

#include <set>
#include <string>

#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/system_wrappers/include/trace.h"

#ifdef _WIN32
// Disable warning C4355: 'this' : used in base member initializer list.
#pragma warning(disable : 4355)
#endif

namespace webrtc {

RTPExtensionType StringToRtpExtensionType(const std::string& extension) {
  if (extension == RtpExtension::kTimestampOffsetUri)
    return kRtpExtensionTransmissionTimeOffset;
  if (extension == RtpExtension::kAudioLevelUri)
    return kRtpExtensionAudioLevel;
  if (extension == RtpExtension::kAbsSendTimeUri)
    return kRtpExtensionAbsoluteSendTime;
  if (extension == RtpExtension::kVideoRotationUri)
    return kRtpExtensionVideoRotation;
  if (extension == RtpExtension::kTransportSequenceNumberUri)
    return kRtpExtensionTransportSequenceNumber;
  if (extension == RtpExtension::kPlayoutDelayUri)
    return kRtpExtensionPlayoutDelay;
  RTC_NOTREACHED() << "Looking up unsupported RTP extension.";
  return kRtpExtensionNone;
}

RtpRtcp::Configuration::Configuration()
    : audio(false),
      receiver_only(false),
      clock(nullptr),
      receive_statistics(NullObjectReceiveStatistics()),
      outgoing_transport(nullptr),
      intra_frame_callback(nullptr),
      bandwidth_callback(nullptr),
      transport_feedback_callback(nullptr),
      rtt_stats(nullptr),
      rtcp_packet_type_counter_observer(nullptr),
      remote_bitrate_estimator(nullptr),
      paced_sender(nullptr),
      transport_sequence_number_allocator(nullptr),
      send_bitrate_observer(nullptr),
      send_frame_count_observer(nullptr),
      send_side_delay_observer(nullptr),
      event_log(nullptr),
      send_packet_observer(nullptr) {}

RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
  if (configuration.clock) {
    return new ModuleRtpRtcpImpl(configuration);
  } else {
    // No clock implementation provided, use default clock.
    RtpRtcp::Configuration configuration_copy;
    memcpy(&configuration_copy, &configuration,
           sizeof(RtpRtcp::Configuration));
    configuration_copy.clock = Clock::GetRealTimeClock();
    return new ModuleRtpRtcpImpl(configuration_copy);
  }
}

ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
    : rtp_sender_(configuration.audio,
                  configuration.clock,
                  configuration.outgoing_transport,
                  configuration.paced_sender,
                  configuration.transport_sequence_number_allocator,
                  configuration.transport_feedback_callback,
                  configuration.send_bitrate_observer,
                  configuration.send_frame_count_observer,
                  configuration.send_side_delay_observer,
                  configuration.event_log,
                  configuration.send_packet_observer),
      rtcp_sender_(configuration.audio,
                   configuration.clock,
                   configuration.receive_statistics,
                   configuration.rtcp_packet_type_counter_observer,
                   configuration.event_log,
                   configuration.outgoing_transport),
      rtcp_receiver_(configuration.clock,
                     configuration.receiver_only,
                     configuration.rtcp_packet_type_counter_observer,
                     configuration.bandwidth_callback,
                     configuration.intra_frame_callback,
                     configuration.transport_feedback_callback,
                     this),
      clock_(configuration.clock),
      audio_(configuration.audio),
      collision_detected_(false),
      last_process_time_(configuration.clock->TimeInMilliseconds()),
      last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()),
      last_rtt_process_time_(configuration.clock->TimeInMilliseconds()),
      packet_overhead_(28),  // IPV4 UDP.
      nack_last_time_sent_full_(0),
      nack_last_time_sent_full_prev_(0),
      nack_last_seq_number_sent_(0),
      key_frame_req_method_(kKeyFrameReqPliRtcp),
      remote_bitrate_(configuration.remote_bitrate_estimator),
      rtt_stats_(configuration.rtt_stats),
      rtt_ms_(0) {
  // Make sure that RTCP objects are aware of our SSRC.
  uint32_t SSRC = rtp_sender_.SSRC();
  rtcp_sender_.SetSSRC(SSRC);
  SetRtcpReceiverSsrcs(SSRC);
  SetMaxTransferUnit(IP_PACKET_SIZE);
}

// Returns the number of milliseconds until the module want a worker thread
// to call Process.
int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() {
  const int64_t now = clock_->TimeInMilliseconds();
  const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5;
  return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_);
}

// Process any pending tasks such as timeouts (non time critical events).
void ModuleRtpRtcpImpl::Process() {
  const int64_t now = clock_->TimeInMilliseconds();
  last_process_time_ = now;

  const int64_t kRtpRtcpBitrateProcessTimeMs = 10;
  if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) {
    rtp_sender_.ProcessBitrate();
    last_bitrate_process_time_ = now;
  }

  const int64_t kRtpRtcpRttProcessTimeMs = 1000;
  bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs;
  if (rtcp_sender_.Sending()) {
    // Process RTT if we have received a receiver report and we haven't
    // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds.
    if (rtcp_receiver_.LastReceivedReceiverReport() >
        last_rtt_process_time_ && process_rtt) {
      std::vector<RTCPReportBlock> receive_blocks;
      rtcp_receiver_.StatisticsReceived(&receive_blocks);
      int64_t max_rtt = 0;
      for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin();
           it != receive_blocks.end(); ++it) {
        int64_t rtt = 0;
        rtcp_receiver_.RTT(it->remoteSSRC, &rtt, NULL, NULL, NULL);
        max_rtt = (rtt > max_rtt) ? rtt : max_rtt;
      }
      // Report the rtt.
      if (rtt_stats_ && max_rtt != 0)
        rtt_stats_->OnRttUpdate(max_rtt);
    }

    // Verify receiver reports are delivered and the reported sequence number
    // is increasing.
    int64_t rtcp_interval = RtcpReportInterval();
    if (rtcp_receiver_.RtcpRrTimeout(rtcp_interval)) {
      LOG_F(LS_WARNING) << "Timeout: No RTCP RR received.";
    } else if (rtcp_receiver_.RtcpRrSequenceNumberTimeout(rtcp_interval)) {
      LOG_F(LS_WARNING) <<
          "Timeout: No increase in RTCP RR extended highest sequence number.";
    }

    if (remote_bitrate_ && rtcp_sender_.TMMBR()) {
      unsigned int target_bitrate = 0;
      std::vector<unsigned int> ssrcs;
      if (remote_bitrate_->LatestEstimate(&ssrcs, &target_bitrate)) {
        if (!ssrcs.empty()) {
          target_bitrate = target_bitrate / ssrcs.size();
        }
        rtcp_sender_.SetTargetBitrate(target_bitrate);
      }
    }
  } else {
    // Report rtt from receiver.
    if (process_rtt) {
       int64_t rtt_ms;
       if (rtt_stats_ && rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms)) {
         rtt_stats_->OnRttUpdate(rtt_ms);
       }
    }
  }

  // Get processed rtt.
  if (process_rtt) {
    last_rtt_process_time_ = now;
    if (rtt_stats_) {
      // Make sure we have a valid RTT before setting.
      int64_t last_rtt = rtt_stats_->LastProcessedRtt();
      if (last_rtt >= 0)
        set_rtt_ms(last_rtt);
    }
  }

  // For sending streams, make sure to not send a SR before media has been sent.
  if (rtcp_sender_.TimeToSendRTCPReport()) {
    RTCPSender::FeedbackState state = GetFeedbackState();
    // Prevent sending streams to send SR before any media has been sent.
    if (!rtcp_sender_.Sending() || state.packets_sent > 0)
      rtcp_sender_.SendRTCP(state, kRtcpReport);
  }

  if (UpdateRTCPReceiveInformationTimers()) {
    // A receiver has timed out
    rtcp_receiver_.UpdateTMMBR();
  }
}

void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) {
  rtp_sender_.SetRtxStatus(mode);
}

int ModuleRtpRtcpImpl::RtxSendStatus() const {
  return rtp_sender_.RtxStatus();
}

void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) {
  rtp_sender_.SetRtxSsrc(ssrc);
}

void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type,
                                              int associated_payload_type) {
  rtp_sender_.SetRtxPayloadType(payload_type, associated_payload_type);
}

int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket(
    const uint8_t* rtcp_packet,
    const size_t length) {
  // Allow receive of non-compound RTCP packets.
  RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true);

  const bool valid_rtcpheader = rtcp_parser.IsValid();
  if (!valid_rtcpheader) {
    LOG(LS_WARNING) << "Incoming invalid RTCP packet";
    return -1;
  }
  RTCPHelp::RTCPPacketInformation rtcp_packet_information;
  int32_t ret_val = rtcp_receiver_.IncomingRTCPPacket(
      rtcp_packet_information, &rtcp_parser);
  if (ret_val == 0) {
    rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information);
  }
  return ret_val;
}

int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
    const CodecInst& voice_codec) {
  return rtp_sender_.RegisterPayload(
           voice_codec.plname,
           voice_codec.pltype,
           voice_codec.plfreq,
           voice_codec.channels,
           (voice_codec.rate < 0) ? 0 : voice_codec.rate);
}

int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) {
  return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType,
                                     90000, 0, 0);
}

void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type,
                                                 const char* payload_name) {
  RTC_CHECK_EQ(
      0, rtp_sender_.RegisterPayload(payload_name, payload_type, 90000, 0, 0));
}

int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) {
  return rtp_sender_.DeRegisterSendPayload(payload_type);
}

int8_t ModuleRtpRtcpImpl::SendPayloadType() const {
  return rtp_sender_.SendPayloadType();
}

uint32_t ModuleRtpRtcpImpl::StartTimestamp() const {
  return rtp_sender_.StartTimestamp();
}

// Configure start timestamp, default is a random number.
void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) {
  rtcp_sender_.SetStartTimestamp(timestamp);
  rtp_sender_.SetStartTimestamp(timestamp, true);
}

uint16_t ModuleRtpRtcpImpl::SequenceNumber() const {
  return rtp_sender_.SequenceNumber();
}

// Set SequenceNumber, default is a random number.
void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) {
  rtp_sender_.SetSequenceNumber(seq_num);
}

void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) {
  SetStartTimestamp(rtp_state.start_timestamp);
  rtp_sender_.SetRtpState(rtp_state);
}

void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) {
  rtp_sender_.SetRtxRtpState(rtp_state);
}

RtpState ModuleRtpRtcpImpl::GetRtpState() const {
  return rtp_sender_.GetRtpState();
}

RtpState ModuleRtpRtcpImpl::GetRtxState() const {
  return rtp_sender_.GetRtxRtpState();
}

uint32_t ModuleRtpRtcpImpl::SSRC() const {
  return rtp_sender_.SSRC();
}

// Configure SSRC, default is a random number.
void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) {
  rtp_sender_.SetSSRC(ssrc);
  rtcp_sender_.SetSSRC(ssrc);
  SetRtcpReceiverSsrcs(ssrc);
}

void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) {
  rtcp_sender_.SetCsrcs(csrcs);
  rtp_sender_.SetCsrcs(csrcs);
}

// TODO(pbos): Handle media and RTX streams separately (separate RTCP
// feedbacks).
RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() {
  StreamDataCounters rtp_stats;
  StreamDataCounters rtx_stats;
  rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats);

  RTCPSender::FeedbackState state;
  state.send_payload_type = SendPayloadType();
  state.frequency_hz = CurrentSendFrequencyHz();
  state.packets_sent = rtp_stats.transmitted.packets +
                       rtx_stats.transmitted.packets;
  state.media_bytes_sent = rtp_stats.transmitted.payload_bytes +
                           rtx_stats.transmitted.payload_bytes;
  state.module = this;

  LastReceivedNTP(&state.last_rr_ntp_secs,
                  &state.last_rr_ntp_frac,
                  &state.remote_sr);

  state.has_last_xr_rr = LastReceivedXrReferenceTimeInfo(&state.last_xr_rr);

  uint32_t tmp;
  BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp);
  return state;
}

int ModuleRtpRtcpImpl::CurrentSendFrequencyHz() const {
  return rtp_sender_.SendPayloadFrequency();
}

int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
  if (rtcp_sender_.Sending() != sending) {
    // Sends RTCP BYE when going from true to false
    if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) {
      LOG(LS_WARNING) << "Failed to send RTCP BYE";
    }

    collision_detected_ = false;

    // Generate a new time_stamp if true and not configured via API
    // Generate a new SSRC for the next "call" if false
    rtp_sender_.SetSendingStatus(sending);
    if (sending) {
      // Make sure the RTCP sender has the same timestamp offset.
      rtcp_sender_.SetStartTimestamp(rtp_sender_.StartTimestamp());
    }

    // Make sure that RTCP objects are aware of our SSRC (it could have changed
    // Due to collision)
    uint32_t SSRC = rtp_sender_.SSRC();
    rtcp_sender_.SetSSRC(SSRC);
    SetRtcpReceiverSsrcs(SSRC);

    return 0;
  }
  return 0;
}

bool ModuleRtpRtcpImpl::Sending() const {
  return rtcp_sender_.Sending();
}

void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
  rtp_sender_.SetSendingMediaStatus(sending);
}

bool ModuleRtpRtcpImpl::SendingMedia() const {
  return rtp_sender_.SendingMedia();
}

int32_t ModuleRtpRtcpImpl::SendOutgoingData(
    FrameType frame_type,
    int8_t payload_type,
    uint32_t time_stamp,
    int64_t capture_time_ms,
    const uint8_t* payload_data,
    size_t payload_size,
    const RTPFragmentationHeader* fragmentation,
    const RTPVideoHeader* rtp_video_hdr) {
  rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
  // Make sure an RTCP report isn't queued behind a key frame.
  if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
      rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
  }
  return rtp_sender_.SendOutgoingData(
      frame_type, payload_type, time_stamp, capture_time_ms, payload_data,
      payload_size, fragmentation, rtp_video_hdr);
}

bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
                                         uint16_t sequence_number,
                                         int64_t capture_time_ms,
                                         bool retransmission,
                                         int probe_cluster_id) {
  if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
    return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms,
                                        retransmission, probe_cluster_id);
  }
  // No RTP sender is interested in sending this packet.
  return true;
}

size_t ModuleRtpRtcpImpl::TimeToSendPadding(size_t bytes,
                                            int probe_cluster_id) {
  return rtp_sender_.TimeToSendPadding(bytes, probe_cluster_id);
}

uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const {
  return rtp_sender_.MaxPayloadLength();
}

uint16_t ModuleRtpRtcpImpl::MaxDataPayloadLength() const {
  return rtp_sender_.MaxDataPayloadLength();
}

int32_t ModuleRtpRtcpImpl::SetTransportOverhead(
    const bool tcp,
    const bool ipv6,
    const uint8_t authentication_overhead) {
  uint16_t packet_overhead = 0;
  if (ipv6) {
    packet_overhead = 40;
  } else {
    packet_overhead = 20;
  }
  if (tcp) {
    // TCP.
    packet_overhead += 20;
  } else {
    // UDP.
    packet_overhead += 8;
  }
  packet_overhead += authentication_overhead;

  if (packet_overhead == packet_overhead_) {
    // Ok same as before.
    return 0;
  }

  size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
  size_t max_payload_length = mtu - packet_overhead;
  packet_overhead_ = packet_overhead;
  rtcp_sender_.SetMaxPayloadLength(max_payload_length);
  rtp_sender_.SetMaxPayloadLength(max_payload_length);
  return 0;
}

int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) {
  RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu;
  RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu;
  size_t max_payload_length = mtu - packet_overhead_;
  rtcp_sender_.SetMaxPayloadLength(max_payload_length);
  rtp_sender_.SetMaxPayloadLength(max_payload_length);
  return 0;
}

RtcpMode ModuleRtpRtcpImpl::RTCP() const {
  return rtcp_sender_.Status();
}

// Configure RTCP status i.e on/off.
void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) {
  rtcp_sender_.SetRTCPStatus(method);
}

int32_t ModuleRtpRtcpImpl::SetCNAME(const char* c_name) {
  return rtcp_sender_.SetCNAME(c_name);
}

int32_t ModuleRtpRtcpImpl::AddMixedCNAME(uint32_t ssrc, const char* c_name) {
  return rtcp_sender_.AddMixedCNAME(ssrc, c_name);
}

int32_t ModuleRtpRtcpImpl::RemoveMixedCNAME(const uint32_t ssrc) {
  return rtcp_sender_.RemoveMixedCNAME(ssrc);
}

int32_t ModuleRtpRtcpImpl::RemoteCNAME(
    const uint32_t remote_ssrc,
    char c_name[RTCP_CNAME_SIZE]) const {
  return rtcp_receiver_.CNAME(remote_ssrc, c_name);
}

int32_t ModuleRtpRtcpImpl::RemoteNTP(
    uint32_t* received_ntpsecs,
    uint32_t* received_ntpfrac,
    uint32_t* rtcp_arrival_time_secs,
    uint32_t* rtcp_arrival_time_frac,
    uint32_t* rtcp_timestamp) const {
  return rtcp_receiver_.NTP(received_ntpsecs,
                            received_ntpfrac,
                            rtcp_arrival_time_secs,
                            rtcp_arrival_time_frac,
                            rtcp_timestamp)
             ? 0
             : -1;
}

// Get RoundTripTime.
int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
                               int64_t* rtt,
                               int64_t* avg_rtt,
                               int64_t* min_rtt,
                               int64_t* max_rtt) const {
  int32_t ret = rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt);
  if (rtt && *rtt == 0) {
    // Try to get RTT from RtcpRttStats class.
    *rtt = rtt_ms();
  }
  return ret;
}

// Force a send of an RTCP packet.
// Normal SR and RR are triggered via the process function.
int32_t ModuleRtpRtcpImpl::SendRTCP(RTCPPacketType packet_type) {
  return rtcp_sender_.SendRTCP(GetFeedbackState(), packet_type);
}

// Force a send of an RTCP packet.
// Normal SR and RR are triggered via the process function.
int32_t ModuleRtpRtcpImpl::SendCompoundRTCP(
    const std::set<RTCPPacketType>& packet_types) {
  return rtcp_sender_.SendCompoundRTCP(GetFeedbackState(), packet_types);
}

int32_t ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData(
    const uint8_t sub_type,
    const uint32_t name,
    const uint8_t* data,
    const uint16_t length) {
  return  rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
}

// (XR) VOIP metric.
int32_t ModuleRtpRtcpImpl::SetRTCPVoIPMetrics(
  const RTCPVoIPMetric* voip_metric) {
  return  rtcp_sender_.SetRTCPVoIPMetrics(voip_metric);
}

void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) {
  rtcp_receiver_.SetRtcpXrRrtrStatus(enable);
  rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable);
}

bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const {
  return rtcp_sender_.RtcpXrReceiverReferenceTime();
}

// TODO(asapersson): Replace this method with the one below.
int32_t ModuleRtpRtcpImpl::DataCountersRTP(
    size_t* bytes_sent,
    uint32_t* packets_sent) const {
  StreamDataCounters rtp_stats;
  StreamDataCounters rtx_stats;
  rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats);

  if (bytes_sent) {
    *bytes_sent = rtp_stats.transmitted.payload_bytes +
                  rtp_stats.transmitted.padding_bytes +
                  rtp_stats.transmitted.header_bytes +
                  rtx_stats.transmitted.payload_bytes +
                  rtx_stats.transmitted.padding_bytes +
                  rtx_stats.transmitted.header_bytes;
  }
  if (packets_sent) {
    *packets_sent = rtp_stats.transmitted.packets +
                    rtx_stats.transmitted.packets;
  }
  return 0;
}

void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
    StreamDataCounters* rtp_counters,
    StreamDataCounters* rtx_counters) const {
  rtp_sender_.GetDataCounters(rtp_counters, rtx_counters);
}

void ModuleRtpRtcpImpl::GetRtpPacketLossStats(
    bool outgoing,
    uint32_t ssrc,
    struct RtpPacketLossStats* loss_stats) const {
  if (!loss_stats) return;
  const PacketLossStats* stats_source = NULL;
  if (outgoing) {
    if (SSRC() == ssrc) {
      stats_source = &send_loss_stats_;
    }
  } else {
    if (rtcp_receiver_.RemoteSSRC() == ssrc) {
      stats_source = &receive_loss_stats_;
    }
  }
  if (stats_source) {
    loss_stats->single_packet_loss_count =
        stats_source->GetSingleLossCount();
    loss_stats->multiple_packet_loss_event_count =
        stats_source->GetMultipleLossEventCount();
    loss_stats->multiple_packet_loss_packet_count =
        stats_source->GetMultipleLossPacketCount();
  }
}

int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) {
  return rtcp_receiver_.SenderInfoReceived(sender_info);
}

// Received RTCP report.
int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
    std::vector<RTCPReportBlock>* receive_blocks) const {
  return rtcp_receiver_.StatisticsReceived(receive_blocks);
}

// (REMB) Receiver Estimated Max Bitrate.
bool ModuleRtpRtcpImpl::REMB() const {
  return rtcp_sender_.REMB();
}

void ModuleRtpRtcpImpl::SetREMBStatus(const bool enable) {
  rtcp_sender_.SetREMBStatus(enable);
}

void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate,
                                    const std::vector<uint32_t>& ssrcs) {
  rtcp_sender_.SetREMBData(bitrate, ssrcs);
}

int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension(
    const RTPExtensionType type,
    const uint8_t id) {
  return rtp_sender_.RegisterRtpHeaderExtension(type, id);
}

int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
    const RTPExtensionType type) {
  return rtp_sender_.DeregisterRtpHeaderExtension(type);
}

// (TMMBR) Temporary Max Media Bit Rate.
bool ModuleRtpRtcpImpl::TMMBR() const {
  return rtcp_sender_.TMMBR();
}

void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) {
  rtcp_sender_.SetTMMBRStatus(enable);
}

void ModuleRtpRtcpImpl::SetTMMBN(
    const std::vector<rtcp::TmmbItem>* bounding_set) {
  rtcp_sender_.SetTMMBN(bounding_set);
}

// Returns the currently configured retransmission mode.
int ModuleRtpRtcpImpl::SelectiveRetransmissions() const {
  return rtp_sender_.SelectiveRetransmissions();
}

// Enable or disable a retransmission mode, which decides which packets will
// be retransmitted if NACKed.
int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
  return rtp_sender_.SetSelectiveRetransmissions(settings);
}

// Send a Negative acknowledgment packet.
int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
                                    const uint16_t size) {
  for (int i = 0; i < size; ++i) {
    receive_loss_stats_.AddLostPacket(nack_list[i]);
  }
  uint16_t nack_length = size;
  uint16_t start_id = 0;
  int64_t now = clock_->TimeInMilliseconds();
  if (TimeToSendFullNackList(now)) {
    nack_last_time_sent_full_ = now;
    nack_last_time_sent_full_prev_ = now;
  } else {
    // Only send extended list.
    if (nack_last_seq_number_sent_ == nack_list[size - 1]) {
      // Last sequence number is the same, do not send list.
      return 0;
    }
    // Send new sequence numbers.
    for (int i = 0; i < size; ++i) {
      if (nack_last_seq_number_sent_ == nack_list[i]) {
        start_id = i + 1;
        break;
      }
    }
    nack_length = size - start_id;
  }

  // Our RTCP NACK implementation is limited to kRtcpMaxNackFields sequence
  // numbers per RTCP packet.
  if (nack_length > kRtcpMaxNackFields) {
    nack_length = kRtcpMaxNackFields;
  }
  nack_last_seq_number_sent_ = nack_list[start_id + nack_length - 1];

  return rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpNack, nack_length,
                               &nack_list[start_id]);
}

void ModuleRtpRtcpImpl::SendNack(
    const std::vector<uint16_t>& sequence_numbers) {
  rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpNack, sequence_numbers.size(),
                        sequence_numbers.data());
}

bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const {
  // Use RTT from RtcpRttStats class if provided.
  int64_t rtt = rtt_ms();
  if (rtt == 0) {
    rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
  }

  const int64_t kStartUpRttMs = 100;
  int64_t wait_time = 5 + ((rtt * 3) >> 1);  // 5 + RTT * 1.5.
  if (rtt == 0) {
    wait_time = kStartUpRttMs;
  }

  // Send a full NACK list once within every |wait_time|.
  if (rtt_stats_) {
    return now - nack_last_time_sent_full_ > wait_time;
  }
  return now - nack_last_time_sent_full_prev_ > wait_time;
}

// Store the sent packets, needed to answer to Negative acknowledgment requests.
void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable,
                                              const uint16_t number_to_store) {
  rtp_sender_.SetStorePacketsStatus(enable, number_to_store);
}

bool ModuleRtpRtcpImpl::StorePackets() const {
  return rtp_sender_.StorePackets();
}

void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback(
    RtcpStatisticsCallback* callback) {
  rtcp_receiver_.RegisterRtcpStatisticsCallback(callback);
}

RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() {
  return rtcp_receiver_.GetRtcpStatisticsCallback();
}

bool ModuleRtpRtcpImpl::SendFeedbackPacket(
    const rtcp::TransportFeedback& packet) {
  return rtcp_sender_.SendFeedbackPacket(packet);
}

// Send a TelephoneEvent tone using RFC 2833 (4733).
int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(
    const uint8_t key,
    const uint16_t time_ms,
    const uint8_t level) {
  return rtp_sender_.SendTelephoneEvent(key, time_ms, level);
}

// Set audio packet size, used to determine when it's time to send a DTMF
// packet in silence (CNG).
int32_t ModuleRtpRtcpImpl::SetAudioPacketSize(
    const uint16_t packet_size_samples) {
  return rtp_sender_.SetAudioPacketSize(packet_size_samples);
}

int32_t ModuleRtpRtcpImpl::SetAudioLevel(
    const uint8_t level_d_bov) {
  return rtp_sender_.SetAudioLevel(level_d_bov);
}

// Set payload type for Redundant Audio Data RFC 2198.
int32_t ModuleRtpRtcpImpl::SetSendREDPayloadType(
    const int8_t payload_type) {
  return rtp_sender_.SetRED(payload_type);
}

// Get payload type for Redundant Audio Data RFC 2198.
int32_t ModuleRtpRtcpImpl::SendREDPayloadType(int8_t* payload_type) const {
  return rtp_sender_.RED(payload_type);
}

void ModuleRtpRtcpImpl::SetTargetSendBitrate(uint32_t bitrate_bps) {
  rtp_sender_.SetTargetBitrate(bitrate_bps);
}

int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
    const KeyFrameRequestMethod method) {
  key_frame_req_method_ = method;
  return 0;
}

int32_t ModuleRtpRtcpImpl::RequestKeyFrame() {
  switch (key_frame_req_method_) {
    case kKeyFrameReqPliRtcp:
      return SendRTCP(kRtcpPli);
    case kKeyFrameReqFirRtcp:
      return SendRTCP(kRtcpFir);
  }
  return -1;
}

int32_t ModuleRtpRtcpImpl::SendRTCPSliceLossIndication(
    const uint8_t picture_id) {
  return rtcp_sender_.SendRTCP(
      GetFeedbackState(), kRtcpSli, 0, 0, false, picture_id);
}

void ModuleRtpRtcpImpl::SetGenericFECStatus(
    const bool enable,
    const uint8_t payload_type_red,
    const uint8_t payload_type_fec) {
  rtp_sender_.SetGenericFECStatus(enable, payload_type_red, payload_type_fec);
}

void ModuleRtpRtcpImpl::GenericFECStatus(bool* enable,
                                         uint8_t* payload_type_red,
                                         uint8_t* payload_type_fec) {
  rtp_sender_.GenericFECStatus(enable, payload_type_red, payload_type_fec);
}

int32_t ModuleRtpRtcpImpl::SetFecParameters(
    const FecProtectionParams* delta_params,
    const FecProtectionParams* key_params) {
  return rtp_sender_.SetFecParameters(delta_params, key_params);
}

void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) {
  // Inform about the incoming SSRC.
  rtcp_sender_.SetRemoteSSRC(ssrc);
  rtcp_receiver_.SetRemoteSSRC(ssrc);

  // Check for a SSRC collision.
  if (rtp_sender_.SSRC() == ssrc && !collision_detected_) {
    // If we detect a collision change the SSRC but only once.
    collision_detected_ = true;
    uint32_t new_ssrc = rtp_sender_.GenerateNewSSRC();
    if (new_ssrc == 0) {
      // Configured via API ignore.
      return;
    }
    if (RtcpMode::kOff != rtcp_sender_.Status()) {
      // Send RTCP bye on the current SSRC.
      SendRTCP(kRtcpBye);
    }
    // Change local SSRC and inform all objects about the new SSRC.
    rtcp_sender_.SetSSRC(new_ssrc);
    SetRtcpReceiverSsrcs(new_ssrc);
  }
}

void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate,
                                    uint32_t* video_rate,
                                    uint32_t* fec_rate,
                                    uint32_t* nack_rate) const {
  *total_rate = rtp_sender_.BitrateSent();
  *video_rate = rtp_sender_.VideoBitrateSent();
  *fec_rate = rtp_sender_.FecOverheadRate();
  *nack_rate = rtp_sender_.NackOverheadRate();
}

void ModuleRtpRtcpImpl::OnRequestSendReport() {
  SendRTCP(kRtcpSr);
}

int32_t ModuleRtpRtcpImpl::SendRTCPReferencePictureSelection(
    const uint64_t picture_id) {
  return rtcp_sender_.SendRTCP(
      GetFeedbackState(), kRtcpRpsi, 0, 0, false, picture_id);
}

void ModuleRtpRtcpImpl::OnReceivedNACK(
    const std::list<uint16_t>& nack_sequence_numbers) {
  for (uint16_t nack_sequence_number : nack_sequence_numbers) {
    send_loss_stats_.AddLostPacket(nack_sequence_number);
  }
  if (!rtp_sender_.StorePackets() ||
      nack_sequence_numbers.size() == 0) {
    return;
  }
  // Use RTT from RtcpRttStats class if provided.
  int64_t rtt = rtt_ms();
  if (rtt == 0) {
    rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
  }
  rtp_sender_.OnReceivedNACK(nack_sequence_numbers, rtt);
}

void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks(
    const ReportBlockList& report_blocks) {
  rtp_sender_.OnReceivedRtcpReportBlocks(report_blocks);
}

bool ModuleRtpRtcpImpl::LastReceivedNTP(
    uint32_t* rtcp_arrival_time_secs,  // When we got the last report.
    uint32_t* rtcp_arrival_time_frac,
    uint32_t* remote_sr) const {
  // Remote SR: NTP inside the last received (mid 16 bits from sec and frac).
  uint32_t ntp_secs = 0;
  uint32_t ntp_frac = 0;

  if (!rtcp_receiver_.NTP(&ntp_secs,
                          &ntp_frac,
                          rtcp_arrival_time_secs,
                          rtcp_arrival_time_frac,
                          NULL)) {
    return false;
  }
  *remote_sr =
      ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16);
  return true;
}

bool ModuleRtpRtcpImpl::LastReceivedXrReferenceTimeInfo(
    RtcpReceiveTimeInfo* info) const {
  return rtcp_receiver_.LastReceivedXrReferenceTimeInfo(info);
}

bool ModuleRtpRtcpImpl::UpdateRTCPReceiveInformationTimers() {
  // If this returns true this channel has timed out.
  // Periodically check if this is true and if so call UpdateTMMBR.
  return rtcp_receiver_.UpdateRTCPReceiveInformationTimers();
}

// Called from RTCPsender.
int32_t ModuleRtpRtcpImpl::BoundingSet(bool* tmmbr_owner,
                                       TMMBRSet* bounding_set) {
  return rtcp_receiver_.BoundingSet(tmmbr_owner, bounding_set);
}

int64_t ModuleRtpRtcpImpl::RtcpReportInterval() {
  if (audio_)
    return RTCP_INTERVAL_AUDIO_MS;
  else
    return RTCP_INTERVAL_VIDEO_MS;
}

void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
  std::set<uint32_t> ssrcs;
  ssrcs.insert(main_ssrc);
  if (rtp_sender_.RtxStatus() != kRtxOff)
    ssrcs.insert(rtp_sender_.RtxSsrc());
  rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);
}

void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
  rtc::CritScope cs(&critical_section_rtt_);
  rtt_ms_ = rtt_ms;
}

int64_t ModuleRtpRtcpImpl::rtt_ms() const {
  rtc::CritScope cs(&critical_section_rtt_);
  return rtt_ms_;
}

void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
    StreamDataCountersCallback* callback) {
  rtp_sender_.RegisterRtpStatisticsCallback(callback);
}

StreamDataCountersCallback*
    ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
  return rtp_sender_.GetRtpStatisticsCallback();
}
}  // namespace webrtc


text:
How to Submit Patches for Open vSwitch
======================================

Send changes to Open vSwitch as patches to dev@openvswitch.org.
One patch per email, please.  More details are included below.

If you are using Git, then `git format-patch` takes care of most of
the mechanics described below for you.

Before You Start
----------------

Before you send patches at all, make sure that each patch makes sense.
In particular:

  - A given patch should not break anything, even if later
    patches fix the problems that it causes.  The source tree
    should still build and work after each patch is applied.
    (This enables `git bisect` to work best.)

  - A patch should make one logical change.  Don't make
    multiple, logically unconnected changes to disparate
    subsystems in a single patch.

  - A patch that adds or removes user-visible features should
    also update the appropriate user documentation or manpages.

Testing is also important:

  - A patch that adds or deletes files should be tested with
    `make distcheck` before submission.

  - A patch that modifies Linux kernel code should be at least
    build-tested on various Linux kernel versions before
    submission.  I suggest versions 2.6.32 and whatever
    the current latest release version is at the time.

  - A patch that modifies the ofproto or vswitchd code should be
    tested in at least simple cases before submission.

  - A patch that modifies xenserver code should be tested on
    XenServer before submission.

If you are using GitHub, then you may utilize the travis-ci.org CI build
system by linking your GitHub repository to it. This will run some of
the above tests automatically when you push changes to your repository.
See the "Continuous Integration with Travis-CI" in the [INSTALL.md] file
for details on how to set it up.

Email Subject
-------------

The subject line of your email should be in the following format:
`[PATCH <n>/<m>] <area>: <summary>`

  - `[PATCH <n>/<m>]` indicates that this is the nth of a series
    of m patches.  It helps reviewers to read patches in the
    correct order.  You may omit this prefix if you are sending
    only one patch.

  - `<area>:` indicates the area of the Open vSwitch to which the
    change applies (often the name of a source file or a
    directory).  You may omit it if the change crosses multiple
    distinct pieces of code.

  - `<summary>` briefly describes the change.

The subject, minus the `[PATCH <n>/<m>]` prefix, becomes the first line
of the commit's change log message.

Description
-----------

The body of the email should start with a more thorough description of
the change.  This becomes the body of the commit message, following
the subject.  There is no need to duplicate the summary given in the
subject.

Please limit lines in the description to 79 characters in width.

The description should include:

  - The rationale for the change.

  - Design description and rationale (but this might be better
    added as code comments).

  - Testing that you performed (or testing that should be done
    but you could not for whatever reason).

  - Tags (see below).

There is no need to describe what the patch actually changed, if the
reader can see it for himself.

If the patch refers to a commit already in the Open vSwitch
repository, please include both the commit number and the subject of
the patch, e.g. 'commit 632d136c (vswitch: Remove restriction on
datapath names.)'.

If you, the person sending the patch, did not write the patch
yourself, then the very first line of the body should take the form
`From: <author name> <author email>`, followed by a blank line.  This
will automatically cause the named author to be credited with
authorship in the repository.

Tags
----

The description ends with a series of tags, written one to a line as
the last paragraph of the email.  Each tag indicates some property of
the patch in an easily machine-parseable manner.

Examples of common tags follow.

    Signed-off-by: Author Name <author.name@email.address...>

        Informally, this indicates that Author Name is the author or
        submitter of a patch and has the authority to submit it under
        the terms of the license.  The formal meaning is to agree to
        the Developer's Certificate of Origin (see below).

        If the author and submitter are different, each must sign off.
        If the patch has more than one author, all must sign off.

        Signed-off-by: Author Name <author.name@email.address...>
        Signed-off-by: Submitter Name <submitter.name@email.address...>

    Co-authored-by: Author Name <author.name@email.address...>

        Git can only record a single person as the author of a given
        patch.  In the rare event that a patch has multiple authors,
        one must be given the credit in Git and the others must be
        credited via Co-authored-by: tags.  (All co-authors must also
        sign off.)

    Acked-by: Reviewer Name <reviewer.name@email.address...>

        Reviewers will often give an Acked-by: tag to code of which
        they approve.  It is polite for the submitter to add the tag
        before posting the next version of the patch or applying the
        patch to the repository.  Quality reviewing is hard work, so
        this gives a small amount of credit to the reviewer.

        Not all reviewers give Acked-by: tags when they provide
        positive reviews.  It's customary only to add tags from
        reviewers who actually provide them explicitly.

    Tested-by: Tester Name <reviewer.name@email.address...>

        When someone tests a patch, it is customary to add a
        Tested-by: tag indicating that.  It's rare for a tester to
        actually provide the tag; usually the patch submitter makes
        the tag himself in response to an email indicating successful
        testing results.

    Reported-by: Reporter Name <reporter.name@email.address...>

        When a patch fixes a bug reported by some person, please
        credit the reporter in the commit log in this fashion.  Please
        also add the reporter's name and email address to the list of
        people who provided helpful bug reports in the AUTHORS file at
        the top of the source tree.

        Fairly often, the reporter of a bug also tests the fix.
        Occasionally one sees a combined "Reported-and-tested-by:" tag
        used to indicate this.  It is also acceptable, and more
        common, to include both tags separately.

        (If a bug report is received privately, it might not always be
        appropriate to publicly credit the reporter.  If in doubt,
        please ask the reporter.)

    Requested-by: Requester Name <requester.name@email.address...>
    Suggested-by: Suggester Name <suggester.name@email.address...>

        When a patch implements a request or a suggestion made by some
        person, please credit that person in the commit log in this
        fashion.  For a helpful suggestion, please also add the
        person's name and email address to the list of people who
        provided suggestions in the AUTHORS file at the top of the
        source tree.

        (If a suggestion or a request is received privately, it might
        not always be appropriate to publicly give credit.  If in
        doubt, please ask.)

    Reported-at: <URL>

        If a patch fixes or is otherwise related to a bug reported in
        a public bug tracker, please include a reference to the bug in
        the form of a URL to the specific bug, e.g.:

        Reported-at: https://bugs.debian.org/743635

        This is also an appropriate way to refer to bug report emails
        in public email archives, e.g.:

        Reported-at: http://openvswitch.org/pipermail/dev/2014-June/040952.html

    VMware-BZ: #1234567
    ONF-JIRA: EXT-12345

        If a patch fixes or is otherwise related to a bug reported in
        a private bug tracker, you may include some tracking ID for
        the bug for your own reference.  Please include some
        identifier to make the origin clear, e.g. "VMware-BZ" refers
        to VMware's internal Bugzilla instance and "ONF-JIRA" refers
        to the Open Networking Foundation's JIRA bug tracker.

    Bug #1234567.
    Issue: 1234567

        These are obsolete forms of VMware-BZ: that can still be seen
        in old change log entries.  (They are obsolete because they do
        not tell the reader what bug tracker is referred to.)

Developer's Certificate of Origin
---------------------------------

To help track the author of a patch as well as the submission chain,
and be clear that the developer has authority to submit a patch for
inclusion in openvswitch please sign off your work.  The sign off
certifies the following:

    Developer's Certificate of Origin 1.1

    By making a contribution to this project, I certify that:

    (a) The contribution was created in whole or in part by me and I
        have the right to submit it under the open source license
        indicated in the file; or

    (b) The contribution is based upon previous work that, to the best
        of my knowledge, is covered under an appropriate open source
        license and I have the right under that license to submit that
        work with modifications, whether created in whole or in part
        by me, under the same open source license (unless I am
        permitted to submit under a different license), as indicated
        in the file; or

    (c) The contribution was provided directly to me by some other
        person who certified (a), (b) or (c) and I have not modified
        it.

    (d) I understand and agree that this project and the contribution
        are public and that a record of the contribution (including all
        personal information I submit with it, including my sign-off) is
        maintained indefinitely and may be redistributed consistent with
        this project or the open source license(s) involved.

Comments
--------

If you want to include any comments in your email that should not be
part of the commit's change log message, put them after the
description, separated by a line that contains just `---`.  It may be
helpful to include a diffstat here for changes that touch multiple
files.

Patch
-----

The patch should be in the body of the email following the description,
separated by a blank line.

Patches should be in `diff -up` format.  We recommend that you use Git
to produce your patches, in which case you should use the `-M -C`
options to `git diff` (or other Git tools) if your patch renames or
copies files.  Quilt (http://savannah.nongnu.org/projects/quilt) might
be useful if you do not want to use Git.

Patches should be inline in the email message.  Some email clients
corrupt white space or wrap lines in patches.  There are hints on how
to configure many email clients to avoid this problem at:
        http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/email-clients.txt
If you cannot convince your email client not to mangle patches, then
sending the patch as an attachment is a second choice.

Please follow the style used in the code that you are modifying.  The
[CodingStyle.md] file describes the coding style used in most of Open
vSwitch. Use Linux kernel coding style for Linux kernel code.

Example
-------

```
From fa29a1c2c17682879e79a21bb0cdd5bbe67fa7c0 Mon Sep 17 00:00:00 2001
From: Jesse Gross <jesse@nicira.com>
Date: Thu, 8 Dec 2011 13:17:24 -0800
Subject: [PATCH] datapath: Alphabetize include/net/ipv6.h compat header.

Signed-off-by: Jesse Gross <jesse@nicira.com>
---
 datapath/linux/Modules.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
index fdd952e..f6cb88e 100644
--- a/datapath/linux/Modules.mk
+++ b/datapath/linux/Modules.mk
@@ -56,11 +56,11 @@ openvswitch_headers += \
 	linux/compat/include/net/dst.h \
 	linux/compat/include/net/genetlink.h \
 	linux/compat/include/net/ip.h \
+	linux/compat/include/net/ipv6.h \
 	linux/compat/include/net/net_namespace.h \
 	linux/compat/include/net/netlink.h \
 	linux/compat/include/net/protocol.h \
 	linux/compat/include/net/route.h \
-	linux/compat/include/net/ipv6.h \
 	linux/compat/genetlink.inc

 both_modules += brcompat
--
1.7.7.3
```

[INSTALL.md]:INSTALL.md
[CodingStyle.md]:CodingStyle.md


text: export { default } from 'ember-ui-components/utils/get-mouse-position';


text:
require 'test_helper'

class TimeboxesControllerTest < ActionController::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
/*
 * put your module comment here
 * formatted with JxBeauty (c) johann.langhofer@nextra.at
 */

package com.kutsyy.util.nr;

import com.kutsyy.util.*;

/**
 *  Title: com.kutsyy.util Description: Mathematical and Statistical Utilities.
 *  Requires
 *  Colt and Jama
 *  libraries. Copyright: Copyright (c) 2000 Company: The University of Michigan
 *
 *@author     Vadim Kutsyy
 *@created    December 1, 2000
 *@version    1.0
 */
public class lnsrch {
	/**
	 *  Description of the Field
	 */
	public double f;
	/**
	 *  Description of the Field
	 */
	public int check;
	private final double ALF = 1.0e-4;
	private final double TOLX = 1.0e-7;
	private int n;
	private int i;
	private double a;
	private double alam;
	private double alam2 = 0;
	private double alamin;
	private double b;
	private double disc;
	private double f2 = 0;
	private double fold2 = 0;
	private double rhs1;
	private double rhs2;
	private double slope;
	private double sum;
	private double temp;
	private double test;
	private double tmplam;

	/**
	 *  put your documentation comment here
	 *
	 *@param  xold                                 Description of Parameter
	 *@param  fold                                 Description of Parameter
	 *@param  g                                    Description of Parameter
	 *@param  p                                    Description of Parameter
	 *@param  x                                    Description of Parameter
	 *@param  stpmax                               Description of Parameter
	 *@param  func                                 Description of Parameter
	 *@exception  java.lang.IllegalStateException  Description of Exception
	 *@exception  IllegalArgumentException         Description of Exception
	 */
	public lnsrch(double[] xold, double fold, double[] g, double[] p, double[] x,
			double stpmax, MvFunction func)
			 throws java.lang.IllegalStateException, IllegalArgumentException {
		lnsrch(xold, fold, g, p, x, stpmax, func);
	}

	/**
	 *  Description of the Method
	 *
	 *@param  xold                                 Description of Parameter
	 *@param  fold                                 Description of Parameter
	 *@param  g                                    Description of Parameter
	 *@param  p                                    Description of Parameter
	 *@param  x                                    Description of Parameter
	 *@param  stpmax                               Description of Parameter
	 *@param  func                                 Description of Parameter
	 *@exception  java.lang.IllegalStateException  Description of Exception
	 *@exception  IllegalArgumentException         Description of Exception
	 */
	public void lnsrch(double[] xold, double fold, double[] g, double[] p, double[] x,
			double stpmax, MvFunction func)
			 throws java.lang.IllegalStateException, IllegalArgumentException {
		if (xold.lenth != g.length || g.length != p.length || p.length != x.lnegth) {
			throw new IllegalArgumentException("dimentions must agree");
		}
		n = xold.length;
		check = 0;
		sum = 0.0;
		for (i = 0; i < n; i++) {
			sum += p[i] * p[i];
		}
		sum = Math.sqrt(sum);
		if (sum > stpmax) {
			for (i = 0; i < n; i++) {
				p[i] *= stpmax / sum;
			}
		}
		slope = 0.0;
		for (i = 0; i < n; i++) {
			slope += g[i] * p[i];
		}
		test = 0.0;
		for (i = 0; i < n; i++) {
			temp = Math.abs(p[i]) / Math.max(Math.abs(xold[i]), 1.0);
			if (temp > test) {
				test = temp;
			}
		}
		alamin = TOLX / test;
		alam = 1.0;
		while (true) {
			for (i = 0; i < n; i++) {
				x[i] = xold[i] + alam * p[i];
			}
			f = func.f(x);
			if (alam < alamin) {
				for (i = 0; i < n; i++) {
					x[i] = xold[i];
				}
				check = 1;
				return;
			}
			else if (f <= fold + ALF * alam * slope) {
				return;
			}
			else {
				if (alam == 1.0) {
					tmplam = -slope / (2.0 * (f - fold - slope));
				}
				else {
					rhs1 = f - fold - alam * slope;
					rhs2 = f2 - fold2 - alam2 * slope;
					a = (rhs1 / (alam * alam) - rhs2 / (alam2 * alam2)) / (alam - alam2);
					b = (-alam2 * rhs1 / (alam * alam) + alam * rhs2 / (alam2 * alam2)) / (
							alam - alam2);
					if (a == 0.0) {
						tmplam = -slope / (2.0 * b);
					}
					else {
						disc = b * b - 3.0 * a * slope;
						if (disc < 0.0) {
							throw new java.lang.IllegalStateException("Roundoff problem in lnsrch.");
						}
						else {
							tmplam = (-b + Math.sqrt(disc)) / (3.0 * a);
						}
					}
					if (tmplam > 0.5 * alam) {
						tmplam = 0.5 * alam;
					}
				}
			}
			alam2 = alam;
			f2 = f;
			fold2 = fold;
			alam = Math.max(tmplam, 0.1 * alam);
		}
	}
}


text:
{% extends 'base.html' %}
{% load bootstrap3 %}
{% load static from staticfiles %}
{% load django_bootstrap_breadcrumbs %}
{% load i18n %}

{% block head_title %} CFP submission is closed | {{ block.super }} {% endblock %}

{% block breadcrumbs %}
    {{ block.super }}
    {% breadcrumb conference.name "conference-detail" conference.slug %}
    {% breadcrumb "Proposals" "proposals-list" conference.slug %}
    {% breadcrumb "New" "" %}
{% endblock %}

{% block content %}

{% trans "CFP submission is closed" %}

{% trans "We are no longer accepting proposals. You can prepare a session for open spaces or flash talks." %}

{% endblock %}


text:
#include "KWindow.h"
#include "KGUIProc.h"
#include "KTimer.h"
#include "KIDGenerator.h"

KWindow::KWindow() : KComponent(true), componentList(50, false)
{
	compText.AssignStaticText(TXT_WITH_LEN("KWindow"));

	compWidth = 400;
	compHeight = 200;

	compVisible = false;
	enableDPIUnawareMode = false;
	compDwStyle = WS_POPUP;
	compDwExStyle = WS_EX_APPWINDOW | WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT;
	wc.style = CS_HREDRAW | CS_VREDRAW;
	compCtlID = 0; // control id is zero for top level window
	lastFocusedChild = 0;
	dpiChangeListener = NULL;
}

bool KWindow::Create(bool requireInitialMessages)
{
	DPI_AWARENESS_CONTEXT prevContext = 0;
	bool dpiAwarenessContextChanged = false;

	if ((KApplication::dpiAwareness == KDPIAwareness::MIXEDMODE_ONLY) && KApplication::dpiAwareAPICalled && enableDPIUnawareMode)
	{
		if (KDPIUtility::pSetThreadDpiAwarenessContext)
		{
			prevContext = KDPIUtility::pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
			dpiAwarenessContextChanged = true;
		}
	}

	bool retVal = KComponent::Create(requireInitialMessages);

	if(dpiAwarenessContextChanged)
		KDPIUtility::pSetThreadDpiAwarenessContext(prevContext);

	if(retVal && (KApplication::dpiAwareness != KDPIAwareness::UNAWARE_MODE) && (!enableDPIUnawareMode) && KApplication::dpiAwareAPICalled)
	{
		int dpi = KDPIUtility::GetWindowDPI(compHWND);
		if (dpi != USER_DEFAULT_SCREEN_DPI)
			this->SetDPI(dpi);
	}

	return retVal;
}

void KWindow::Flash()
{
	::FlashWindow(compHWND, TRUE);
}

void KWindow::SetIcon(KIcon *icon)
{
	::SetClassLongPtrW(compHWND, GCLP_HICON, (LONG_PTR)icon->GetHandle());
}

void KWindow::SetDPIChangeListener(KDPIChangeListener* dpiChangeListener)
{
	this->dpiChangeListener = dpiChangeListener;
}

void KWindow::SetEnableDPIUnawareMode(bool enable)
{
	enableDPIUnawareMode = enable;
}

void KWindow::OnClose()
{
	this->Destroy();
}

void KWindow::OnDestroy()
{
	::PostQuitMessage(0);
}

void KWindow::PostCustomMessage(WPARAM msgID, LPARAM param)
{
	::PostMessageW(compHWND, RFC_CUSTOM_MESSAGE, msgID, param);
}

void KWindow::OnCustomMessage(WPARAM msgID, LPARAM param)
{

}

void KWindow::CenterScreen()
{
	this->SetPosition((::GetSystemMetrics(SM_CXSCREEN) - compWidth) / 2, (::GetSystemMetrics(SM_CYSCREEN) - compHeight) / 2);
}

bool KWindow::AddComponent(KComponent *component, bool requireInitialMessages)
{
	if(component)
	{
		if(compHWND)
		{
			component->SetParentHWND(compHWND);

			if ((KApplication::dpiAwareness != KDPIAwareness::UNAWARE_MODE) && (!enableDPIUnawareMode) && KApplication::dpiAwareAPICalled )
				component->SetDPI(compDPI);

			componentList.AddPointer(component);

			return component->Create(requireInitialMessages);
		}
	}
	return false;
}

void KWindow::RemoveComponent(KComponent* component)
{
	int index = componentList.GetID(component);
	if (index != -1)
	{
		componentList.RemovePointer(index);
		component->Destroy();
	}
}

bool KWindow::SetClientAreaSize(int width, int height)
{
	if (compHWND)
	{
		RECT wndRect;
		::GetClientRect(compHWND, &wndRect);

		wndRect.right = wndRect.left + width;
		wndRect.bottom = wndRect.top + height;

		::AdjustWindowRect(&wndRect, compDwStyle, ::GetMenu(compHWND) == NULL ? FALSE : TRUE);
		this->SetSize(wndRect.right - wndRect.left, wndRect.bottom - wndRect.top);

		return true;
	}
	return false;
}

bool KWindow::IsOffScreen(int posX, int posY)
{
	POINT point;
	point.x = posX;
	point.y = posY;
	return (::MonitorFromPoint(point, MONITOR_DEFAULTTONULL) == NULL);
}

bool KWindow::GetClientAreaSize(int *width, int *height)
{
	if (compHWND)
	{
		RECT wndRect;
		::GetClientRect(compHWND, &wndRect);

		if (width)
			*width = wndRect.right - wndRect.left;

		if (height)
			*height = wndRect.bottom - wndRect.top;

		return true;
	}
	return false;
}

void KWindow::OnMoved()
{

}

void KWindow::OnResized()
{

}

LRESULT KWindow::WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_DRAWITEM: // owner-drawn button, combo box and list box... (menu ignored. use windowProc of parent window if you want to draw menu)
			{
				if (wParam != 0) // ignore menus
				{
					KComponent *component = (KComponent*)::GetPropW(((LPDRAWITEMSTRUCT)lParam)->hwndItem, MAKEINTATOM(KGUIProc::AtomComponent));
					if (component)
					{
						LRESULT result = 0; // just for safe
						if (component->EventProc(msg, wParam, lParam, &result))
							return result;
					}
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_NOTIFY: // GridView, Custom drawing etc...
			{
				KComponent *component = (KComponent*)::GetPropW(((LPNMHDR)lParam)->hwndFrom, MAKEINTATOM(KGUIProc::AtomComponent));
				if (component)
				{
					LRESULT result = 0; // just for safe
					if (component->EventProc(msg, wParam, lParam, &result))
						return result;
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_VKEYTOITEM:
		case WM_CHARTOITEM:
		case WM_HSCROLL: // trackbar
		case WM_VSCROLL:
		case WM_CTLCOLORBTN: // buttons
		case WM_CTLCOLOREDIT: // edit controls
		case WM_CTLCOLORLISTBOX: // listbox controls
		case WM_CTLCOLORSCROLLBAR: // scroll bar controls
		case WM_CTLCOLORSTATIC: // static controls
			{
				KComponent *component = (KComponent*)::GetPropW((HWND)lParam, MAKEINTATOM(KGUIProc::AtomComponent));
				if (component)
				{
					LRESULT result = 0; // just for safe
					if (component->EventProc(msg, wParam, lParam, &result))
						return result;
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_MEASUREITEM: // combo box, list box, list-view control... (menu ignored. use windowProc of parent window if you want to set the size of menu)
			{
				if (wParam != 0) // ignore menus
				{
					KComponent *component = (KComponent*)::GetPropW(GetDlgItem(hwnd,((LPMEASUREITEMSTRUCT)lParam)->CtlID), MAKEINTATOM(KGUIProc::AtomComponent));
					if (component)
					{
						LRESULT result = 0; // just for safe
						if (component->EventProc(msg, wParam, lParam, &result))
							return result;
					}
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_COMPAREITEM: // owner-drawn combo box or list box
			{
				KComponent *component = (KComponent*)::GetPropW(((LPCOMPAREITEMSTRUCT)lParam)->hwndItem, MAKEINTATOM(KGUIProc::AtomComponent));
				if (component)
				{
					LRESULT result = 0; // just for safe
					if (component->EventProc(msg, wParam, lParam, &result))
						return result;
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_TIMER:
			{
				KTimer *timer = KIDGenerator::GetInstance()->GetTimerByID((UINT)wParam);
				if(timer)
				{
					timer->OnTimer();
					break;
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_SIZE: // window has been resized! we can't use lparam since it's giving client area size instead of window...
			{
				RECT rect;
				::GetWindowRect(compHWND, &rect);

				this->compWidth = rect.right - rect.left;
				this->compHeight = rect.bottom - rect.top;

				this->OnResized();
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_MOVE: // window has been moved! we can't use lparam since it's giving client area pos instead of window...
			{
				RECT rect;
				::GetWindowRect(compHWND, &rect);

				this->compX = rect.left;
				this->compY = rect.top;

				this->OnMoved();
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_DPICHANGED:
			{
				if ((KApplication::dpiAwareness == KDPIAwareness::UNAWARE_MODE) || enableDPIUnawareMode || (!KApplication::dpiAwareAPICalled))
					return KComponent::WindowProc(hwnd, msg, wParam, lParam);

				this->compDPI = HIWORD(wParam);
				RECT* const prcNewWindow = (RECT*)lParam;

				this->compX = prcNewWindow->left;
				this->compY = prcNewWindow->top;
				this->compWidth = prcNewWindow->right - prcNewWindow->left;
				this->compHeight = prcNewWindow->bottom - prcNewWindow->top;

				::SetWindowPos(compHWND,
					NULL,
					this->compX,
					this->compY,
					this->compWidth,
					this->compHeight,
					SWP_NOZORDER | SWP_NOACTIVATE);

				::InvalidateRect(compHWND, NULL, TRUE);

				for (int i = 0; i < componentList.GetSize(); i++)
				{
					componentList[i]->SetDPI(compDPI);
				}

				if (dpiChangeListener)
					dpiChangeListener->OnDPIChange(compHWND, compDPI);

				return 0;
			}

		case WM_COMMAND: // button, checkbox, radio button, listbox, combobox or menu-item
			{
				if( (HIWORD(wParam) == 0) && (lParam == 0) ) // its menu item! unfortunately windows does not send menu handle with clicked event!
				{
					KMenuItem *menuItem = KIDGenerator::GetInstance()->GetMenuItemByID(LOWORD(wParam));
					if(menuItem)
					{
						menuItem->OnPress();
						break;
					}
				}
				else if(lParam)// send to appropriate component
				{
					KComponent *component = (KComponent*)::GetPropW((HWND)lParam, MAKEINTATOM(KGUIProc::AtomComponent));
					if (component)
					{
						LRESULT result = 0; // just for safe
						if (component->EventProc(msg, wParam, lParam, &result))
							return result;
					}
				}
				else if (LOWORD(wParam) == IDOK) // enter key pressed. (lParam does not contain current comp hwnd)
				{
					HWND currentComponent = ::GetFocus();

					// simulate enter key pressed event into current component. (might be a window)
					::SendMessageW(currentComponent, WM_KEYDOWN, VK_RETURN, 0);
					::SendMessageW(currentComponent, WM_KEYUP, VK_RETURN, 0);
					::SendMessageW(currentComponent, WM_CHAR, VK_RETURN, 0);

					return 0;
				}
				else if (LOWORD(wParam) == IDCANCEL) // Esc key pressed. (lParam does not contain current comp hwnd)
				{
					HWND currentComponent = ::GetFocus();

					// simulate esc key pressed event into current component. (might be a window)
					::SendMessageW(currentComponent, WM_KEYDOWN, VK_ESCAPE, 0);
					::SendMessageW(currentComponent, WM_KEYUP, VK_ESCAPE, 0);
					::SendMessageW(currentComponent, WM_CHAR, VK_ESCAPE, 0);

					return 0;
				}
			}
			return KComponent::WindowProc(hwnd, msg, wParam, lParam);

		case WM_ACTIVATE: // save last focused item when inactive
			if (wParam != WA_INACTIVE)
				return KComponent::WindowProc(hwnd, msg, wParam, lParam);
			this->lastFocusedChild = ::GetFocus();
			break;

		case WM_SETFOCUS:
			if (this->lastFocusedChild) // set focus to last item
				::SetFocus(this->lastFocusedChild);
			else // set focus to first child
				::SetFocus(::GetNextDlgTabItem(this->compHWND, NULL, FALSE));
			break;

		case WM_CLOSE:
			this->OnClose();
			break;

		case WM_DESTROY:
			this->OnDestroy();
			break;

		case RFC_CUSTOM_MESSAGE:
			this->OnCustomMessage(wParam, lParam);
			break;

		default:
			return KComponent::WindowProc(hwnd,msg,wParam,lParam);
	}
	return 0;
}

KWindow::~KWindow()
{

}


text:
package org.apache.taverna.workbench.ui.servicepanel;

import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;

/**
 * @author alanrw
 */
public class PathElementFilterTreeNode extends FilterTreeNode {
	private static final long serialVersionUID = 6491242031931630314L;

	public PathElementFilterTreeNode(String userObject) {
		super(userObject);
	}
}


text:
layout: post
title: 'Nina Simone: The Ballad of Hollis Brown'
date: 2008-10-18 17:47:04.000000000 -04:00
type: post
published: true
status: publish
categories:
- SpatialTrack
location:
- point:19
tags:
- the number 7
- bob dylan
- lyle lofgren
- sudden death and/or murder
- nina simone
- south dakota
- suicide
meta:
  geotag_region: Jackson, SD
  _edit_last: '2'
  geotag_country: United States
  geo_address: Jackson, SD, United States
  geo_latitude: '43.661329'
  geo_longitude: "-101.484092"
  author:
  display_name: cecois
  first_name: CEÇOIS
  last_name: McGee
---

Remember that time when Bob Dylan shot a fire full of holes? Well he's not always super fun like that. In [The Ballad of Hollis Brown](https://open.spotify.com/track/3Si9u9FVlUTcUXVcawnstJ) he drops some bleak rurality on us:

There's seven breezes a-blowin'
All around the cabin door
There's seven breezes a-blowin'
All around the cabin door
Seven shots ring out
Like the ocean's pounding roar

Ok, ok, it's easy to poke a shotgun into a stanza for some immediate backwoods cred. But to have "seven breezes blowing" around the door and then this punchline:

There's seven people dead
On a South Dakota farm
There's seven people dead
On a South Dakota farm
Somewhere in the distance
There's seven new people born

...oof!

This first appeared on *[The Times They Are a-Changin'](https://open.spotify.com/album/7DZeLXvr9eTVpyI1OlqtcS)* in 1964, just after *[The Freewheelin' Bob Dylan](https://open.spotify.com/album/0o1uFxZ1VTviqvNaYkTJek)* (1963 - ["Blowin' in the Wind"](https://open.spotify.com/track/18GiV1BaXzPVYpp9rmOg0E) and all that) and here's what happened[^1] at Columbia:

Exec

Bob, Bob, great stuff. *Great* stuff. Listen, the boys and I were wondering about the seven dead. Thinking maybe -- maybe that number could come down a little.

Dylan

[rambles on about a bunch of bullshit - truth and whatnot]

Exec

Sure, sure, babe. We get that. It's cool. Of course. It's just...yeah, that's all cool, babe, but maybe it could go a little more like Blowin', whaddya think? Just a little more, uh, hopeful, you see?

# MAPPING IT
  Although [Lyle Lofgren](http://www.lizlyle.lofgrens.org/LyleJour/HollisBrown.html) and [others](http://www.celestialmonochord.org/2006/03/hollis_browns_s.html) seem convinced (and are probably right) that the origin of the song could be traced to a true crime, nobody can find any evidence of it. So here it goes in rando rural South Dakota - northeast cuz maybe news of a crime like this would have reached Hibbard that way.

# HEARING IT
So you're getting "The Ballad of Hollis Brown", but guess what: it's a Nina Simone performance (from 1966's *[Let it All Out](https://open.spotify.com/album/3vBx19MVX89jILEWWE4syK)*) instead of Dylan's. Why? Because Nina Simone is a kick-ass mama. Take it up with her.

[^1]: More lies.


text:
#import <Foundation/Foundation.h>

@interface Fixtures : NSObject
{
}
+ (Fixtures *) sharedInstance;
- (void) removeData;
- (void) createData;
- (void) resetData;
@end


text:
@import url(//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/color-brewer.min.css);
a{color:#333}
a:hover{color:#888}
input{background-color:rgba(100,100,100,.25);color:#000}
textarea{background-color:rgba(100,100,100,.25)}
.color-elight{color:#999}
.color-yellow{color:#f0f0c3}
.color-blue{color:#3287f5}
.color-lightBlue{color:#64cdfa}
.color-green{color:#50be55}
.color-red{color:#f07d5f}
.background-color{background-color:rgba(255,255,255,.75)}
.submit{background-color:rgba(0,0,0,.3)}
.dark-mode{display:none!important}
.post-header{text-shadow:0 0 5px #fff}
.color-text,.page-button i{color:#000}
.post-title a,.color-title{color:#444}
.color-ccc,.widget a:hover{color:#ccc}
.color-light,.tags{color:#777}
.color-white,.widget a{color:#FFF}
.dark,#dark-wallpaper{display:none}
#sidebar{background-color:rgba(255,255,255,.35);text-shadow:1px 1px 1px #000}
#switch-icon{background:rgba(170,170,170,.85)}


text:
package apple.avfoundation;

import apple.NSObject;
import apple.foundation.NSArray;
import apple.foundation.NSMethodSignature;
import apple.foundation.NSSet;
import apple.foundation.NSUUID;
import org.moe.natj.c.ann.FunctionPtr;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Mapped;
import org.moe.natj.general.ann.NInt;
import org.moe.natj.general.ann.NUInt;
import org.moe.natj.general.ann.Owned;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.general.ptr.VoidPtr;
import org.moe.natj.objc.Class;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.SEL;
import org.moe.natj.objc.ann.ObjCClassBinding;
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.map.ObjCObjectMapper;

/**
 * AVCoordinatedPlaybackParticipant
 *

 * A participant in a coordinated playback group connected through AVPlaybackCoordinator.
 */
@Generated
@Library("AVFoundation")
@Runtime(ObjCRuntime.class)
@ObjCClassBinding
public class AVCoordinatedPlaybackParticipant extends NSObject {
    static {
        NatJ.register();
    }

    @Generated
    protected AVCoordinatedPlaybackParticipant(Pointer peer) {
        super(peer);
    }

    @Generated
    @Selector("accessInstanceVariablesDirectly")
    public static native boolean accessInstanceVariablesDirectly();

    @Generated
    @Owned
    @Selector("alloc")
    public static native AVCoordinatedPlaybackParticipant alloc();

    @Owned
    @Generated
    @Selector("allocWithZone:")
    public static native AVCoordinatedPlaybackParticipant allocWithZone(VoidPtr zone);

    @Generated
    @Selector("automaticallyNotifiesObserversForKey:")
    public static native boolean automaticallyNotifiesObserversForKey(String key);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:")
    public static native void cancelPreviousPerformRequestsWithTarget(@Mapped(ObjCObjectMapper.class) Object aTarget);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:selector:object:")
    public static native void cancelPreviousPerformRequestsWithTargetSelectorObject(
            @Mapped(ObjCObjectMapper.class) Object aTarget, SEL aSelector,
            @Mapped(ObjCObjectMapper.class) Object anArgument);

    @Generated
    @Selector("classFallbacksForKeyedArchiver")
    public static native NSArray<String> classFallbacksForKeyedArchiver();

    @Generated
    @Selector("classForKeyedUnarchiver")
    public static native Class classForKeyedUnarchiver();

    @Generated
    @Selector("debugDescription")
    public static native String debugDescription_static();

    @Generated
    @Selector("description")
    public static native String description_static();

    @Generated
    @Selector("hash")
    @NUInt
    public static native long hash_static();

    /**
     * [@property] identifier
     *

     * A unique id for the participant.
     *

     * Use this identifier to distinguish participants.
     */
    @Generated
    @Selector("identifier")
    public native NSUUID identifier();

    @Generated
    @Selector("init")
    public native AVCoordinatedPlaybackParticipant init();

    @Generated
    @Selector("instanceMethodForSelector:")
    @FunctionPtr(name = "call_instanceMethodForSelector_ret")
    public static native NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(SEL aSelector);

    @Generated
    @Selector("instanceMethodSignatureForSelector:")
    public static native NSMethodSignature instanceMethodSignatureForSelector(SEL aSelector);

    @Generated
    @Selector("instancesRespondToSelector:")
    public static native boolean instancesRespondToSelector(SEL aSelector);

    /**
     * [@property] readyToPlay
     *

     * YES if the participant is ready to play.
     */
    @Generated
    @Selector("isReadyToPlay")
    public native boolean isReadyToPlay();

    @Generated
    @Selector("isSubclassOfClass:")
    public static native boolean isSubclassOfClass(Class aClass);

    @Generated
    @Selector("keyPathsForValuesAffectingValueForKey:")
    public static native NSSet<String> keyPathsForValuesAffectingValueForKey(String key);

    @Generated
    @Owned
    @Selector("new")
    public static native AVCoordinatedPlaybackParticipant new_objc();

    @Generated
    @Selector("resolveClassMethod:")
    public static native boolean resolveClassMethod(SEL sel);

    @Generated
    @Selector("resolveInstanceMethod:")
    public static native boolean resolveInstanceMethod(SEL sel);

    @Generated
    @Selector("setVersion:")
    public static native void setVersion_static(@NInt long aVersion);

    @Generated
    @Selector("superclass")
    public static native Class superclass_static();

    /**
     * [@property] suspensionReasons
     *

     * The reason, if any, this participant is currently not participating in coordinated playback.
     */
    @Generated
    @Selector("suspensionReasons")
    public native NSArray<String> suspensionReasons();

    @Generated
    @Selector("version")
    @NInt
    public static native long version_static();
}


text:
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Sannel.House.Web.Data.Migrations
{
    public partial class ChangedDateTypeForTemperatureSetting : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "StartTime",
                table: "TemperatureSettings",
                nullable: true);

            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "EndTime",
                table: "TemperatureSettings",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "TemperatureSettings",
                nullable: true);

            migrationBuilder.AlterColumn<DateTime>(
                name: "EndTime",
                table: "TemperatureSettings",
                nullable: true);
        }
    }
}


text:
\defmodule {sres}

This module defines common structures used to keep the results of tests
in the {\tt s} modules. They are useful in tests where the statistics
obey either a chi-square, a normal or a Poisson distribution or some other
simple distribution. Some tests require more specialized structures for
the results and those are defined in the appropriate modules.

The first argument of each testing function is the random number generator
to be tested. It must be created by calling the appropriate function
in one of the module {\tt u}, and deleted when no longer needed.
The second argument of each testing function is a structure
{\tt s\ldots\_Res} that can keep the test results (intermediate and final).
This is useful if one wishes to do something else with the
results or the information generated during a test. In that case, one
{\it must} call the appropriate {\tt Create} function to create the
 {\tt s\ldots\_Res} structure. Simply declaring a variable  {\tt
s\ldots\_Res} and passing its address as the argument will not work.
That structure must also be deleted when no longer needed.
The same structure can
be used to call a test many times with different parameters.
If one does not want to post-process or use the results after a test,
it suffices to set the {\tt \ldots\_Res} argument to the {\tt NULL} pointer.
Then, the structure is created and deleted automatically inside the
testing function.

\bigskip\hrule
\code\hide
/* sres.h  for ANSI C */
#ifndef SRES_H
#define SRES_H
\endhide
#include "gofw.h"
#include "statcoll.h"
\endcode

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\guisec{Basic structure for test results (continuous distribution)}

The detailed results for tests based on very simple continuous
distributions can be recovered in the structure defined below. In
 particular, it is used for test statistics which obey a {\em normal\/} law.
\index{normal results}

\code

typedef struct {

   statcoll_Collector *sVal1, *pVal1;
\endcode
 \tabb
  These collectors contain the values of the test statistic and their
  $p$-values  (at the first level) for the $N$ replications of the current
  test. The number $N$ of observations is in {\tt sVal1->NObs} and the
  observations themselves are in \{{\tt sVal1->V[1], \ldots,
  sVal1->V[N]}\}. They have been sorted.
  The corresponding $p$-values are in {\tt pVal1}.
 \endtabb
\code

   gofw_TestArray sVal2, pVal2;
\endcode
 \tabb
  These arrays contain the values of the statistics and their $p$-values
  at the second level. In the case $N=1$, the value of the  statistic at
  the first level is returned in {\tt sVal2[gofw\_Mean]} and its $p$-value
  in {\tt pVal2[gofw\_Mean]}.
 \endtabb
\code

   char *name;
\endcode
 \tabb
  The name of the test which produced the above results.
 \endtabb
\code

} sres_Basic;
\endcode
 \tab
  This is the default basic structure used in the {\tt s} modules
  to keep the results of tests when the statistic of the tests can take
  continuous real values. Test results which require many parameters or
  variables use more complicated structures.
 \endtab
\code

sres_Basic * sres_CreateBasic (void);
\endcode
 \tab
  Creates and returns a structure that will hold the results
  of a simple test.
 \endtab
\code

void sres_DeleteBasic (sres_Basic *res);
\endcode
 \tab
  Frees the memory allocated to {\tt res} by {\tt sres\_CreateBasic}.
 \endtab
\code

void sres_InitBasic (sres_Basic *res, long N, char *nam);
\endcode
 \tab
   Initializes the {\tt res} structure, ensures that its
   collector {\tt sVal1}  can contain up to  {\tt N} values and sets
   its  {\tt name} field to  {\tt nam}. This function must not be called
   directly by the user. It has been made public because it is called
   internally by the tests in different modules.
 \endtab
\code

void sres_GetNormalSumStat (sres_Basic *res);
\endcode
 \tab
  Computes the sample sum and the sample variance $S^2$ of the $N$ observations in
  the collector {\tt res->sVal1}. Then computes the $p$-value of the sum, assuming
  that it obeys a {\em normal\/} law with mean 0 and variance $N$. Computes also
  the $p$-value of $(N-1)S^2$, assuming it obeys a {\em chi-square\/} law with
  $N-1$ degrees of freedom. The computed values are put in
  {\tt res->sVal2[gofw\_Sum]}, {\tt res->pVal2[gofw\_Sum]},
  {\tt res->sVal2[gofw\_Var]} and {\tt res->pVal2[gofw\_Var]}.
 \endtab

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\guisec{Basic structure for test results (discrete distribution)}

The detailed results for tests based on very simple discrete
distributions can be recovered in the structure defined below.

\code

typedef struct {

   statcoll_Collector *sVal1;
\endcode
 \tabb
  This collector contain the values of the test statistic
  (at the first level) for the $N$ replications of the current
  test. The number $N$ of observations is in {\tt sVal1->NObs} and the
  observations themselves are in \{{\tt sVal1->V[1], \ldots, sVal1->V[N]}\}.
 \endtabb
\code

   double sVal2;
\endcode
 \tabb
  The value of the statistic at the second level. It could be the sum,
  the maximum or another combination of all $s$-values at the first
  level (in  {\tt sVal1}).
 \endtabb
\code

   double pLeft, pRight, pVal2;
\endcode
 \tabb
  These are the left $p$-value, the right $p$-value, and the resulting
  $p$-value (as computed in function {\tt gofw\_pDisc} of library
  ProbDist) for the statistic at the second level ({\tt sVal12}).
 \endtabb
\code

   char *name;
\endcode
 \tabb
  The name of the test which produced the above results.
 \endtabb
\code

} sres_Disc;
\endcode
 \tab
  This structure is used to keep the results of a simple
  test involving a discrete distribution in the {\tt s} modules.
 \endtab
\code

sres_Disc * sres_CreateDisc (void);
\endcode
 \tab
  Creates and returns a structure that will hold the results
  of a simple test based on a discrete distribution.
 \endtab
\code

void sres_DeleteDisc (sres_Disc *res);
\endcode
 \tab
  Frees the memory allocated to {\tt res} by {\tt sres\_CreateDisc}.
 \endtab
\code

void sres_InitDisc (sres_Disc *res, long N, char *nam);
\endcode
 \tab
   Initializes the {\tt res} structure and ensures that its statistical
   collector {\tt sVal1} can contain up to  {\tt N} statistic values.
   Also sets its  {\tt name} field to  {\tt nam}.
   This function must not be called
   directly by the user. It has been made public because it is called
   internally by the tests in different modules.
 \endtab

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\guisec{Structure for chi-square test results}

The detailed results of a chi-square test can be recovered in the
following  structure.\index{chi-square results}

\code

typedef struct {

   double *NbExp;
   long *Count;
   long *Loc;
   long jmin;
   long jmax;
\endcode
 \tabb
  {\tt NbExp} and {\tt Count} contain the expected and
  observed numbers of observations in each class, respectively.
  {\tt Loc} give the classes
  redirections which ensure that the expected numbers in each class
  are large enough to justify the application of the chi-square law.
  The indices {\tt jmin} and {\tt jmax} are the lowest
  and highest valid indices for these arrays. In the rare cases where
  the above arrays are unused, we set {\tt jmax }$< 0$.
 \endtabb
\code

   long degFree;
\endcode
 \tabb
  Gives the number of degrees of freedom of the chi-square.
 \endtabb
\code

   statcoll_Collector *sVal1, *pVal1;
\endcode
 \tabb
  These collectors contain the values of the test statistic and their
  $p$-values  (at the first level) for the $N$ replications of the current
  test. The number $N$ of observations is in {\tt sVal1->NObs} and the
  observations themselves are in \{{\tt sVal1->V[1], \ldots, sVal1->V[N]}\}.
   They have been sorted. The corresponding $p$-values are in {\tt pVal1}.
 \endtabb
\code

   gofw_TestArray sVal2, pVal2;
\endcode
 \tabb
  These arrays contain the values of the statistics and their $p$-values
  at the second level. In the case $N=1$, the value of the  statistic at
  the first level is returned in {\tt sVal2[gofw\_Mean]} and its $p$-value
  in {\tt pVal2[gofw\_Mean]}.
 \endtabb
\code

   char *name;
\endcode
 \tabb
  The name of the test which produced the above results.
 \endtabb
\code

} sres_Chi2;
\endcode
 \tab
  This structure is used to keep the results of a chi-square
  test in the {\tt s} modules.
 \endtab
\code

sres_Chi2 * sres_CreateChi2 (void);
\endcode
 \tab
  Creates and returns a structure that will hold the results
  of a chi-square test.
 \endtab
\code

void sres_DeleteChi2 (sres_Chi2 *res);
\endcode
 \tab
  Frees the memory allocated to {\tt res} by {\tt sres\_CreateChi2}.
 \endtab
\code

void sres_InitChi2 (sres_Chi2 *res, long N, long jmax, char *nam);
\endcode
 \tab
   Initializes the {\tt res} structure and ensures that its statistical
   collector  {\tt sVal1} can contain up to  {\tt N} statistic values
   while the counters can contain up to  {\tt jmax + 1} classes. Also sets
   its  {\tt name} field to  {\tt nam}. This function must not be called
   directly by the user. It has been made public because it is called
   internally by the tests in different modules.
 \endtab
\code

void sres_GetChi2SumStat (sres_Chi2 *res);
\endcode
 \tab
  Computes the sum of the $N$ observations in the collector {\tt res->sVal1}.
  Then computes the $p$-value of the sum, assuming that it obeys a
  {\em chi-square\/} law with $N\ell$ degrees of freedom, where $\ell$ is the
  number of degrees of freedom of the chi-square for each observation.
  The computed values are put in {\tt res->sVal2[gofw\_Sum]} and
  {\tt res->pVal2[gofw\_Sum]}.
 \endtab

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\guisec{Structure for Poisson test results}

The detailed results for a Poisson test can be recovered in the
following structure.\index{Poisson results}

\code

typedef struct {

   double Lambda, Mu;
\endcode
 \tabb
  The Poisson mean is {\tt Lambda}. When the number of replications
  $N>1$, {\tt Mu = $N*\;$Lambda} gives the mean of the sum of all
  Poisson means for the $N$ replications.
 \endtabb
\code

   statcoll_Collector *sVal1;
\endcode
 \tabb
  This collector contain the values of the test statistic
  (at the first level) for the $N$ replications of the current
  test. The number $N$ of observations is in {\tt sVal1->NObs} and the
  observations themselves are in \{{\tt sVal1->V[1], \ldots, sVal1->V[N]}\}.
 \endtabb
\code

   double sVal2;
\endcode
 \tabb
  The value of the statistic at the second level
  (the sum of all Poisson values in  {\tt sVal1}).
 \endtabb
\code

   double pLeft, pRight, pVal2;
\endcode
 \tabb
  These are the left $p$-value, the right $p$-value, and the resulting
  $p$-value (as computed in function {\tt gofw\_pDisc} of library
  ProbDist) for the Poisson statistic at the second level.
 \endtabb
\code

   char *name;
\endcode
 \tabb
  The name of the test which produced the above results.
 \endtabb
\code

} sres_Poisson;
\endcode
 \tab
  This structure is used to keep the results of a Poisson
  test in the {\tt s} modules.
 \endtab
\code

sres_Poisson * sres_CreatePoisson (void);
\endcode
 \tab
  Creates and returns a structure that will hold the results
  of a test based on the Poisson distribution.
 \endtab
\code

void sres_DeletePoisson (sres_Poisson *res);
\endcode
 \tab
  Frees the memory allocated to {\tt res} by {\tt sres\_CreatePoisson}.
 \endtab
\code

void sres_InitPoisson (sres_Poisson *res, long N, double Lambda, char *nam);
\endcode
 \tab
   Initializes the {\tt res} structure and ensures that its statistical
   collector {\tt sVal1} can contain up to  {\tt N} statistic values.
   Also sets its {\tt Lambda} field to the Poisson mean {\tt Lambda} and
   its  {\tt name} field to  {\tt nam}. This function must not be called
   directly by the user. It has been made public because it is called
   internally by the tests in different modules.
 \endtab

\code
\hide
#endif
\endhide
\endcode


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>nl.uva.vlet</groupId>
        <artifactId>mvnbuild</artifactId>
        <version>1.5.0-dev-2</version>
        <relativePath>../../../mvnbuild/pom.xml</relativePath>
    </parent>

    <!-- -->

    <groupId>nl.uva.vlet</groupId>
    <artifactId>vlet-vrs.core</artifactId>
    <version>${vlet.version}</version>
    <name>vrs.core (${vlet.version})</name>

    <build>
        <sourceDirectory>source/main</sourceDirectory>

        <!--  NOT  <testSourceDirectory>testsrc</testSourceDirectory> -->

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <configuration>
                            <sources>
                                <source>source/bootstrap</source>
                                <source>source/vdriver</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- The configuration of maven-assembly-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <!-- The configuration of the plugin -->
                <configuration>
                    <!-- Specifies the configuration file of the assembly plugin -->
                    <descriptors>
                        <descriptor>bin.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

            <!-- The configuration of maven-jar-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <!-- The configuration of the plugin -->
                <configuration>
                    <!-- Configuration of the archiver -->
                    <archive>
                        <!-- Manifest specific configuration -->
                        <manifest>
                            <!-- Classpath is added to the manifest of the created jar file. -->
                            <addClasspath>true</addClasspath>
                            <!--
                                Configures the classpath prefix. This configuration option is
                                used to specify that all needed libraries are found under lib/
                                directory.
                            -->
                            <classpathPrefix>lib/</classpathPrefix>
                            <!-- Specifies the main class of the application -->
                            <mainClass>nl.uva.vlet.bootstrap.Bootstrapper</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

        </plugins>

    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jmimemagic</groupId>
            <artifactId>jmimemagic</artifactId>
            <version>0.1.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.7.0</version>
        </dependency>
        <dependency>
            <groupId>nl.ikarus.nxt.priv.imageio.icoreader</groupId>
            <artifactId>ICOReader</artifactId>
            <version>1.04</version>
        </dependency>
    </dependencies>

</project>


text:
// timber -- Copyright 2012-2021 -- Justin Patterson
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.scalawag.timber.api

import org.scalawag.timber.api.level._

/** Provides a [[org.scalawag.timber.api.BaseLogger BaseLogger]] that can be used out-of-the-box with a default set
  * of level-specific log methods.
  *
  * @param attributes the logger attributes that this logger associates with the entries it creates
  * @param tags the tags that this logger associates with the entries it creates
  */
class Logger(override val attributes: Map[String, Any] = Map.empty, override val tags: Set[Tag] = Set.empty)(implicit
    dispatcher: Dispatcher
) extends BaseLogger(attributes, tags)(dispatcher)
    with Trace
    with Debug
    with Info
    with Warn
    with Error


text:
package com.playtika.test.couchbase;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

public class CouchbasePropertiesTest {

    @Test
    public void shouldFailIfPasswordHas5Chars() {
        CouchbaseProperties couchbaseProperties = new CouchbaseProperties();
        assertThatExceptionOfType(IllegalArgumentException.class)
                .isThrownBy(() -> couchbaseProperties.setPassword("12345"));
    }

    @Test
    public void shouldNotFailIfPasswordHas6Chars() {
        CouchbaseProperties couchbaseProperties = new CouchbaseProperties();
        assertThatCode(() -> couchbaseProperties.setPassword("123456")).doesNotThrowAnyException();
    }
}


text:
class WXDLLIMPEXP_XRC wxPanelXmlHandler : public wxXmlResourceHandler
{
    DECLARE_DYNAMIC_CLASS(wxPanelXmlHandler)

public:
    wxPanelXmlHandler();
    virtual wxObject *DoCreateResource();
    virtual bool CanHandle(wxXmlNode *node);
};

#endif // wxUSE_XRC

#endif // _WX_XH_PANEL_H_