text:
package com.dremio.exec.store.hive.exec.apache;

import static com.dremio.exec.store.hive.exec.apache.HadoopFileSystemWrapper.propagateFSError;
import static com.dremio.exec.store.hive.exec.apache.HadoopFileSystemWrapper.propagateFSRuntimeException;

import java.io.IOException;
import java.io.OutputStream;

import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FSError;
import org.apache.hadoop.fs.FileSystem;

/**
 * Wrapper around FSDataOutputStream to catch {@code FSError}.
 */
public class FSDataOutputStreamWrapper extends FSDataOutputStream {
  private final FSDataOutputStream underlyingOS;

  public FSDataOutputStreamWrapper(FSDataOutputStream os) throws IOException {
    this(os, null);
  }

  public FSDataOutputStreamWrapper(FSDataOutputStream os, FileSystem.Statistics stats)
      throws IOException {
    this(os, stats, 0);
  }

  public FSDataOutputStreamWrapper(FSDataOutputStream os, FileSystem.Statistics stats,
      long startPosition) throws IOException {
    super(os, stats, startPosition);
    underlyingOS = os;
  }

  @Override
  public void write(int b) throws IOException {
    try {
      underlyingOS.write(b);
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }

  @Override
  public void write(byte[] b) throws IOException {
    try {
      underlyingOS.write(b);
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }

  @Override
  public void write(byte[] b, int off, int len) throws IOException {
    try {
      underlyingOS.write(b, off, len);
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }

  @Override
  public void flush() throws IOException {
    try {
      underlyingOS.flush();
    } catch(FSError e) {
      propagateFSError(e);
    }
  }

  @Override
  public long getPos() {
    try {
      return underlyingOS.getPos();
    } catch(FSError e) {
      throw propagateFSRuntimeException(e);
    }
  }

  @Override
  public void close() throws IOException {
    try {
      underlyingOS.close();
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }

  @Override
  public OutputStream getWrappedStream() {
    return underlyingOS.getWrappedStream();
  }

  @Override
  public void hflush() throws IOException {
    try {
      underlyingOS.hflush();
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }

  @Override
  public void hsync() throws IOException {
    try {
      underlyingOS.hsync();
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }

  @Override
  public void setDropBehind(Boolean dropBehind) throws IOException {
    try {
      underlyingOS.setDropBehind(dropBehind);
    } catch(FSError e) {
      throw propagateFSError(e);
    }
  }
}


text:
![CI](https://github.com/benji6/meditation-timer/workflows/CI/badge.svg)
[![Netlify Status](https://api.netlify.com/api/v1/badges/5b4f1df4-5a74-43ed-b198-30a81de24eb5/deploy-status)](https://app.netlify.com/sites/meditation-timer/deploys)

## About

Meditate is a free and open source meditation timer. It's simple to use, works offline and aims to be the perfect aide for your meditation practice!

It can be found here: https://meditation-timer.netlify.app

It is free and open source so all contributions are welcome.

## Acknowledgement

Icons from https://feathericons.com (MIT)

Meditation Bell from https://freesound.org/people/fauxpress/sounds/42095 (CC0 1.0)

Deployed with https://www.netlify.com

redpajama_set_name: RedPajamaGithub


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    android:paddingBottom="0dp"
    tools:context="uk.gov.eastlothian.gowalk.ui.LogBookActivity$LogBookFragment">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Your Logbook is empty."
        android:layout_centerInParent="true"
        android:id="@+id/logbook_empty_label"
        style="@android:style/TextAppearance.DeviceDefault.Large" />

    <GridView
        android:id="@+id/log_book_gridview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:columnWidth="90dp"
        android:numColumns="2"
        android:verticalSpacing="0dp"
        android:horizontalSpacing="0dp"
        android:stretchMode="columnWidth"
        android:gravity="center"/>

</RelativeLayout>


text:
import java.io.*;

import com.pdfjet.*;

/**
 *  Example_01.java
 *  We will draw the American flag using Box, Line and Point objects.
 */
public class Example_01 {

    public Example_01() throws Exception {

        PDF pdf = new PDF(
                new BufferedOutputStream(
                        new FileOutputStream("Example_01.pdf")));

        String fileName = "linux-logo.png";
        EmbeddedFile file1 = new EmbeddedFile(
                pdf,
                fileName,
                getClass().getResourceAsStream("images/" + fileName),
                false);     // Don't compress images.

        fileName = "Example_02.java";
        EmbeddedFile file2 = new EmbeddedFile(
                pdf,
                fileName,
                getClass().getResourceAsStream(fileName),
                true);      // Compress text files.

        Page page = new Page(pdf, Letter.PORTRAIT);

        Box flag = new Box();
        flag.setLocation(100f, 100f);
        flag.setSize(190f, 100f);
        flag.setColor(Color.white);
        flag.drawOn(page);

        float[] xy = new float[] {0f, 0f};
        float sw = 7.69f;       // stripe width
        Line stripe = new Line(0.0f, sw/2, 190.0f, sw/2);
        stripe.setWidth(sw);
        stripe.setColor(Color.oldgloryred);
        for (int row = 0; row < 7; row++) {
            stripe.placeIn(flag, 0.0f, row * 2 * sw);
            xy = stripe.drawOn(page);
        }

        Box union = new Box();
        union.setSize(76.0f, 53.85f);
        union.setColor(Color.oldgloryblue);
        union.setFillShape(true);
        union.placeIn(flag, 0f, 0f);
        union.drawOn(page);

        float h_si = 12.6f;     // horizontal star interval
        float v_si = 10.8f;     // vertical star interval
        Point star = new Point(h_si/2, v_si/2);
        star.setShape(Point.STAR);
        star.setRadius(3.0f);
        star.setColor(Color.white);
        star.setFillShape(true);

        for (int row = 0; row < 6; row++) {
            for (int col = 0; col < 5; col++) {
                star.placeIn(union, row * h_si, col * v_si);
                xy = star.drawOn(page);
            }
        }

        star.setLocation(h_si, v_si);
        for (int row = 0; row < 5; row++) {
            for (int col = 0; col < 4; col++) {
                star.placeIn(union, row * h_si, col * v_si);
                xy = star.drawOn(page);
            }
        }

        FileAttachment attachment = new FileAttachment(pdf, file1);
        attachment.setLocation(100f, 300f);
        attachment.setIconPushPin();
        attachment.setIconSize(24f);
        attachment.setTitle("Attached File: " + file1.getFileName());
        attachment.setDescription(
                "Right mouse click or double click on the icon to save the attached file.");
        attachment.drawOn(page);

        attachment = new FileAttachment(pdf, file2);
        attachment.setLocation(200f, 300f);
        attachment.setIconPaperclip();
        attachment.setIconSize(24f);
        attachment.setTitle("Attached File: " + file2.getFileName());
        attachment.setDescription(
                "Right mouse click or double click on the icon to save the attached file.");
        attachment.drawOn(page);

        pdf.close();
    }

    public static void main(String[] args) {
        try {
            new Example_01();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

}   // End of Example_01.java


text:
package org.mifos.framework.business.service;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.mifos.framework.components.logger.ServiceLogger;

public class ServiceProxy implements InvocationHandler {
    private Object service;
    private final ServiceLogger logger;

    ServiceProxy(Object service, ServiceLogger logger) {
        this.service = service;
        this.logger = logger;
    }

    public Object invoke(Object proxy, Method method, Object[] args) {
        Object result = null;
        try {
            logger.startOfServiceCall(method, args);
            result = method.invoke(service, args);
            logger.endOfServiceCall(method, args);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
        return result;
    }
}


text:
{% load rfdocs_tags %}
{% get_settings_param 'USE_GOOGLE_ANALYTICS' as USE_GA %}

        {% include "rfdocs/mixins/filter_active.html" with span=4 %}

                {{ rflibraryversion.name }}

{{ rflibraryversion.library.name }}

    {% include "rfdocs/mixins/filter_tags.html" with filter_tags=rflibraryversion.tags.all klass="inline" %}

        {% if rflibraryversion.source_url %}

                 Open HTML document

        {% endif %}

                    Keywords Shortcuts

                        {% for keyword in rflibraryversion.keywords.all %}

                                {{ keyword.name }}

                        {% empty %}

There are no keywords in this library.

                        {% endfor %}

                    Library Documentation

                        {{ rflibraryversion.parsed_doc|safe }}

                    Related Libraries

                        {% for library in rflibraryversion.similar.all %}

                                {{ library }}

                        {% empty %}

No entries found

                        {% endfor %}

                    Meta Information

Number of keywords

{{ rflibraryversion.keywords.count }}

Generated on

<time datetime="{{ rflibraryversion.date_generated }}">{{ rflibraryversion.date_generated }}</time>

Added to the system

<time datetime="{{ rflibraryversion.date_added }}">{{ rflibraryversion.date_added }}</time>

Last updated

<time datetime="{{ rflibraryversion.date_modified }}">{{ rflibraryversion.date_modified }}</time>

{% if USE_GA %}
    {% include 'mysite/ganalitycs.html' %}
{% endif %}


text:
@class NSArray;

COREIMAGE_EXPORT_CLASS
@interface CITextFeature : CIFeature
@property (readonly) CGRect bounds STUB_PROPERTY;
@property (readonly) NSArray* subFeatures STUB_PROPERTY;
@property (readonly) CGPoint bottomLeft STUB_PROPERTY;
@property (readonly) CGPoint bottomRight STUB_PROPERTY;
@property (readonly) CGPoint topLeft STUB_PROPERTY;
@property (readonly) CGPoint topRight STUB_PROPERTY;
@end


text:
class UserPresenter < BasePresenter
  def_delegators :user, :display_name, :user_name, :email, :provider, :follows,
                        :last_synced_projects_at, :last_signin_at,
                        :github_access_token, :organizations

  use_presenters :projects

  def github_url
    "https://github.com/#{user_name}"
  end

  def name
    display_name
  end

  def service_name
    provider
  end
end


text:
#ifndef _CRIS_ARCH_TLB_H
#define _CRIS_ARCH_TLB_H

/* The TLB can host up to 64 different mm contexts at the same time.
 * The last page_id is never running - it is used as an invalid page_id
 * so we can make TLB entries that will never match.
 */
#define NUM_TLB_ENTRIES 64
#define NUM_PAGEID 64
#define INVALID_PAGEID 63
#define NO_CONTEXT -1

#endif


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Calculator;

use Sylius\Component\Core\Model\ChannelPricingInterface;
use Sylius\Component\Promotion\Model\CatalogPromotionActionInterface;

final class FixedDiscountPriceCalculator implements ActionBasedPriceCalculatorInterface
{
    public function supports(CatalogPromotionActionInterface $action): bool
    {
        return $action->getType() === CatalogPromotionActionInterface::TYPE_FIXED_DISCOUNT;
    }

    public function calculate(ChannelPricingInterface $channelPricing, CatalogPromotionActionInterface $action): int
    {
        if (!isset($action->getConfiguration()[$channelPricing->getChannelCode()])) {
            return $channelPricing->getPrice();
        }

        $price = $channelPricing->getPrice() - $action->getConfiguration()[$channelPricing->getChannelCode()]['amount'];

        $minimumPrice = $this->provideMinimumPrice($channelPricing);
        if ($price < $minimumPrice) {
            return $minimumPrice;
        }

        return $price;
    }

    private function provideMinimumPrice(ChannelPricingInterface $channelPricing): int
    {
        if ($channelPricing->getMinimumPrice() === null || $channelPricing->getMinimumPrice() <= 0) {
            return 0;
        }

        return $channelPricing->getMinimumPrice();
    }
}


text:
package org.apache.ignite.internal.processors.cache.persistence.wal;

import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.pagemem.wal.record.WALRecord;

/**
 * Interface to provide size, read and write operations with WAL records
 * <b>without any headers and meta information</b>.
 */
public interface RecordDataSerializer {
    /**
     * Calculates size of record data.
     *
     * @param record WAL record.
     * @return Size of record in bytes.
     * @throws IgniteCheckedException If it's unable to calculate record data size.
     */
    int size(WALRecord record) throws IgniteCheckedException;

    /**
     * Reads record data of {@code type} from buffer {@code in}.
     *
     * @param type Record type.
     * @param in Buffer to read.
     * @return WAL record.
     * @throws IOException In case of I/O problems.
     * @throws IgniteCheckedException If it's unable to read record.
     */
    WALRecord readRecord(WALRecord.RecordType type, ByteBufferBackedDataInput in) throws IOException, IgniteCheckedException;

    /**
     * Writes record data to buffer {@code buf}.
     *
     * @param record WAL record.
     * @param buf Buffer to write.
     * @throws IgniteCheckedException If it's unable to write record.
     */
    void writeRecord(WALRecord record, ByteBuffer buf) throws IgniteCheckedException;
}


text:
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#pragma once

#include <thrift/lib/cpp2/Thrift.h>
#include <thrift/lib/cpp2/protocol/Protocol.h>
#include <thrift/lib/cpp/TApplicationException.h>
#include <folly/Optional.h>
#include <folly/io/IOBuf.h>
#include <folly/io/Cursor.h>

#include <thrift/lib/cpp2/GeneratedHeaderHelper.h>

namespace cpp2 {

class Color;
class Vehicle;
class Person;

enum class Animal {
  DOG = 1,
  CAT = 2,
  TARANTULA = 3
};

using _Animal_EnumMapFactory = apache::thrift::detail::TEnumMapFactory<Animal, Animal>;
extern const _Animal_EnumMapFactory::ValuesToNamesMapType _Animal_VALUES_TO_NAMES;
extern const _Animal_EnumMapFactory::NamesToValuesMapType _Animal_NAMES_TO_VALUES;

} // cpp2
namespace std {

template<> struct hash<typename  ::cpp2::Animal> : public apache::thrift::detail::enum_hash<typename  ::cpp2::Animal> {};
template<> struct equal_to<typename  ::cpp2::Animal> : public apache::thrift::detail::enum_equal_to<typename  ::cpp2::Animal> {};

} // std
namespace apache { namespace thrift {

template <> struct TEnumDataStorage< ::cpp2::Animal>;
template <> const std::size_t TEnumTraits< ::cpp2::Animal>::size;
template <> const folly::Range<const  ::cpp2::Animal*> TEnumTraits< ::cpp2::Animal>::values;
template <> const folly::Range<const folly::StringPiece*> TEnumTraits< ::cpp2::Animal>::names;
template <> const char* TEnumTraits< ::cpp2::Animal>::findName( ::cpp2::Animal value);
template <> bool TEnumTraits< ::cpp2::Animal>::findValue(const char* name,  ::cpp2::Animal* outValue);

template <> inline constexpr  ::cpp2::Animal TEnumTraits< ::cpp2::Animal>::min() {
  return  ::cpp2::Animal::DOG;
}

template <> inline constexpr  ::cpp2::Animal TEnumTraits< ::cpp2::Animal>::max() {
  return  ::cpp2::Animal::TARANTULA;
}

}} // apache::thrift
namespace cpp2 {

typedef int64_t PersonID;

class Color : private apache::thrift::detail::st::ComparisonOperators<Color> {
 public:

  Color() :
      red(0),
      green(0),
      blue(0),
      alpha(0) {}
  // FragileConstructor for use in initialization lists only

  Color(apache::thrift::FragileConstructor, double red__arg, double green__arg, double blue__arg, double alpha__arg) :
      red(std::move(red__arg)),
      green(std::move(green__arg)),
      blue(std::move(blue__arg)),
      alpha(std::move(alpha__arg)) {}
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Color(::apache::thrift::detail::argument_wrapper<1, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Color(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    red = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Color(::apache::thrift::detail::argument_wrapper<2, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Color(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    green = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Color(::apache::thrift::detail::argument_wrapper<3, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Color(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    blue = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Color(::apache::thrift::detail::argument_wrapper<4, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Color(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    alpha = arg.move();
  }

  Color(Color&&) = default;

  Color(const Color&) = default;

  Color& operator=(Color&&) = default;

  Color& operator=(const Color&) = default;
  void __clear();

  virtual ~Color() {}

  double red;
  double green;
  double blue;
  double alpha;
  bool operator==(const Color& rhs) const;

  bool operator < (const Color& rhs) const {
    if (!(red == rhs.red)) {
      return red < rhs.red;
    }
    if (!(green == rhs.green)) {
      return green < rhs.green;
    }
    if (!(blue == rhs.blue)) {
      return blue < rhs.blue;
    }
    if (!(alpha == rhs.alpha)) {
      return alpha < rhs.alpha;
    }
    (void)rhs;
    return false;
  }

  template <class Protocol_>
  uint32_t read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  static void translateFieldName(FOLLY_MAYBE_UNUSED folly::StringPiece _fname, FOLLY_MAYBE_UNUSED int16_t& fid, FOLLY_MAYBE_UNUSED apache::thrift::protocol::TType& _ftype);
};

void swap(Color& a, Color& b);
extern template uint32_t Color::read<>(apache::thrift::BinaryProtocolReader*);
extern template uint32_t Color::write<>(apache::thrift::BinaryProtocolWriter*) const;
extern template uint32_t Color::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Color::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Color::read<>(apache::thrift::CompactProtocolReader*);
extern template uint32_t Color::write<>(apache::thrift::CompactProtocolWriter*) const;
extern template uint32_t Color::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
extern template uint32_t Color::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;

} // cpp2
namespace apache { namespace thrift {

template <> inline void Cpp2Ops< ::cpp2::Color>::clear( ::cpp2::Color* obj) {
  return obj->__clear();
}

template <> inline constexpr apache::thrift::protocol::TType Cpp2Ops< ::cpp2::Color>::thriftType() {
  return apache::thrift::protocol::T_STRUCT;
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Color>::write(Protocol* proto,  ::cpp2::Color const* obj) {
  return obj->write(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Color>::read(Protocol* proto,  ::cpp2::Color* obj) {
  return obj->read(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Color>::serializedSize(Protocol const* proto,  ::cpp2::Color const* obj) {
  return obj->serializedSize(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Color>::serializedSizeZC(Protocol const* proto,  ::cpp2::Color const* obj) {
  return obj->serializedSizeZC(proto);
}

}} // apache::thrift
namespace cpp2 {

class Vehicle : private apache::thrift::detail::st::ComparisonOperators<Vehicle> {
 public:

  Vehicle() :
      hasAC(false) {}
  // FragileConstructor for use in initialization lists only

  Vehicle(apache::thrift::FragileConstructor,  ::cpp2::Color color__arg, std::string licensePlate__arg, std::string description__arg, std::string name__arg, bool hasAC__arg) :
      color(std::move(color__arg)),
      licensePlate(std::move(licensePlate__arg)),
      description(std::move(description__arg)),
      name(std::move(name__arg)),
      hasAC(std::move(hasAC__arg)) {}
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Vehicle(::apache::thrift::detail::argument_wrapper<1, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Vehicle(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    color = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Vehicle(::apache::thrift::detail::argument_wrapper<2, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Vehicle(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    licensePlate = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Vehicle(::apache::thrift::detail::argument_wrapper<3, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Vehicle(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    description = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Vehicle(::apache::thrift::detail::argument_wrapper<4, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Vehicle(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    name = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Vehicle(::apache::thrift::detail::argument_wrapper<5, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Vehicle(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    hasAC = arg.move();
  }

  Vehicle(Vehicle&&) = default;

  Vehicle(const Vehicle&) = default;

  Vehicle& operator=(Vehicle&&) = default;

  Vehicle& operator=(const Vehicle&) = default;
  void __clear();

  virtual ~Vehicle() {}

   ::cpp2::Color color;
  folly::Optional<std::string> licensePlate;
  folly::Optional<std::string> description;
  folly::Optional<std::string> name;
  folly::Optional<bool> hasAC;
  bool operator==(const Vehicle& rhs) const;
  bool operator < (const Vehicle& rhs) const;

  template <class Protocol_>
  uint32_t read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  static void translateFieldName(FOLLY_MAYBE_UNUSED folly::StringPiece _fname, FOLLY_MAYBE_UNUSED int16_t& fid, FOLLY_MAYBE_UNUSED apache::thrift::protocol::TType& _ftype);
};

void swap(Vehicle& a, Vehicle& b);
extern template uint32_t Vehicle::read<>(apache::thrift::BinaryProtocolReader*);
extern template uint32_t Vehicle::write<>(apache::thrift::BinaryProtocolWriter*) const;
extern template uint32_t Vehicle::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Vehicle::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Vehicle::read<>(apache::thrift::CompactProtocolReader*);
extern template uint32_t Vehicle::write<>(apache::thrift::CompactProtocolWriter*) const;
extern template uint32_t Vehicle::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
extern template uint32_t Vehicle::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;

} // cpp2
namespace apache { namespace thrift {

template <> inline void Cpp2Ops< ::cpp2::Vehicle>::clear( ::cpp2::Vehicle* obj) {
  return obj->__clear();
}

template <> inline constexpr apache::thrift::protocol::TType Cpp2Ops< ::cpp2::Vehicle>::thriftType() {
  return apache::thrift::protocol::T_STRUCT;
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Vehicle>::write(Protocol* proto,  ::cpp2::Vehicle const* obj) {
  return obj->write(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Vehicle>::read(Protocol* proto,  ::cpp2::Vehicle* obj) {
  return obj->read(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Vehicle>::serializedSize(Protocol const* proto,  ::cpp2::Vehicle const* obj) {
  return obj->serializedSize(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Vehicle>::serializedSizeZC(Protocol const* proto,  ::cpp2::Vehicle const* obj) {
  return obj->serializedSizeZC(proto);
}

}} // apache::thrift
namespace cpp2 {

class Person : private apache::thrift::detail::st::ComparisonOperators<Person> {
 public:

  Person() :
      id(0) {}
  // FragileConstructor for use in initialization lists only

  Person(apache::thrift::FragileConstructor,  ::cpp2::PersonID id__arg, std::string name__arg, int16_t age__arg, std::string address__arg,  ::cpp2::Color favoriteColor__arg, std::set< ::cpp2::PersonID> friends__arg,  ::cpp2::PersonID bestFriend__arg, std::map< ::cpp2::Animal, std::string> petNames__arg,  ::cpp2::Animal afraidOfAnimal__arg, std::vector< ::cpp2::Vehicle> vehicles__arg) :
      id(std::move(id__arg)),
      name(std::move(name__arg)),
      age(std::move(age__arg)),
      address(std::move(address__arg)),
      favoriteColor(std::move(favoriteColor__arg)),
      friends(std::move(friends__arg)),
      bestFriend(std::move(bestFriend__arg)),
      petNames(std::move(petNames__arg)),
      afraidOfAnimal(std::move(afraidOfAnimal__arg)),
      vehicles(std::move(vehicles__arg)) {}
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<1, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    id = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<2, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    name = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<3, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    age = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<4, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    address = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<5, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    favoriteColor = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<6, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    friends = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<7, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    bestFriend = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<8, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    petNames = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<9, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    afraidOfAnimal = arg.move();
  }
  template <typename T__ThriftWrappedArgument__Ctor, typename... Args__ThriftWrappedArgument__Ctor>
  Person(::apache::thrift::detail::argument_wrapper<10, T__ThriftWrappedArgument__Ctor> arg, Args__ThriftWrappedArgument__Ctor&&... args):
    Person(std::forward<Args__ThriftWrappedArgument__Ctor>(args)...)
  {
    vehicles = arg.move();
  }

  Person(Person&&) = default;

  Person(const Person&) = default;

  Person& operator=(Person&&) = default;

  Person& operator=(const Person&) = default;
  void __clear();

  virtual ~Person() {}

   ::cpp2::PersonID id;
  std::string name;
  folly::Optional<int16_t> age;
  folly::Optional<std::string> address;
  folly::Optional< ::cpp2::Color> favoriteColor;
  folly::Optional<std::set< ::cpp2::PersonID>> friends;
  folly::Optional< ::cpp2::PersonID> bestFriend;
  folly::Optional<std::map< ::cpp2::Animal, std::string>> petNames;
  folly::Optional< ::cpp2::Animal> afraidOfAnimal;
  folly::Optional<std::vector< ::cpp2::Vehicle>> vehicles;
  bool operator==(const Person& rhs) const;
  bool operator < (const Person& rhs) const;

  template <class Protocol_>
  uint32_t read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  static void translateFieldName(FOLLY_MAYBE_UNUSED folly::StringPiece _fname, FOLLY_MAYBE_UNUSED int16_t& fid, FOLLY_MAYBE_UNUSED apache::thrift::protocol::TType& _ftype);
};

void swap(Person& a, Person& b);
extern template uint32_t Person::read<>(apache::thrift::BinaryProtocolReader*);
extern template uint32_t Person::write<>(apache::thrift::BinaryProtocolWriter*) const;
extern template uint32_t Person::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Person::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Person::read<>(apache::thrift::CompactProtocolReader*);
extern template uint32_t Person::write<>(apache::thrift::CompactProtocolWriter*) const;
extern template uint32_t Person::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
extern template uint32_t Person::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;

} // cpp2
namespace apache { namespace thrift {

template <> inline void Cpp2Ops< ::cpp2::Person>::clear( ::cpp2::Person* obj) {
  return obj->__clear();
}

template <> inline constexpr apache::thrift::protocol::TType Cpp2Ops< ::cpp2::Person>::thriftType() {
  return apache::thrift::protocol::T_STRUCT;
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Person>::write(Protocol* proto,  ::cpp2::Person const* obj) {
  return obj->write(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Person>::read(Protocol* proto,  ::cpp2::Person* obj) {
  return obj->read(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Person>::serializedSize(Protocol const* proto,  ::cpp2::Person const* obj) {
  return obj->serializedSize(proto);
}

template <> template <class Protocol> uint32_t Cpp2Ops< ::cpp2::Person>::serializedSizeZC(Protocol const* proto,  ::cpp2::Person const* obj) {
  return obj->serializedSizeZC(proto);
}

}} // apache::thrift
namespace cpp2 {

} // cpp2


text:
namespace tesseract {

int test_data[] = {8, 1, 2, -4, 7, 9, 65536, 4, 9, 0, -32767, 6, 7};

// The fixture for testing GenericHeap and DoublePtr.
class NthItemTest : public testing::Test {
protected:
  void SetUp() override {
    std::locale::global(std::locale(""));
  }

public:
  ~NthItemTest() override;
  // Pushes the test data onto the KDVector.
  void PushTestData(KDVector *v) {
    for (size_t i = 0; i < countof(test_data); ++i) {
      IntKDPair pair(test_data[i], i);
      v->push_back(pair);
    }
  }
};

// Destructor.
// It is defined here, so the compiler can create a single vtable
// instead of a weak vtable (fixes compiler warning).
NthItemTest::~NthItemTest() = default;

// Tests basic results.
TEST_F(NthItemTest, GeneralTest) {
  KDVector v;
  // Push the test data onto the KDVector.
  PushTestData(&v);
  // Get the min item.
  size_t index = 0;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is -32767.
  EXPECT_EQ(-32767, v[index].key());
  // Get the max item.
  index = v.size() - 1;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 65536.
  EXPECT_EQ(65536, v[index].key());
}

// Tests results on boring data with lots of duplication.
TEST_F(NthItemTest, BoringTest) {
  KDVector v;
  // Push the test data onto the KDVector.
  int test_data[] = {8, 8, 8, 8, 8, 7, 7, 7, 7};
  for (size_t i = 0; i < countof(test_data); ++i) {
    IntKDPair pair(test_data[i], i);
    v.push_back(pair);
  }
  // The 3rd item is 7 but the 4th is 8..
  size_t index = 3;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 7.
  EXPECT_EQ(7, v[index].key());
  index = 4;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 8.
  EXPECT_EQ(8, v[index].key());
  // Get the min item.
  index = 0;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 7.
  EXPECT_EQ(7, v[index].key());
  // Get the max item.
  index = v.size() - 1;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 8.
  EXPECT_EQ(8, v[index].key());
}

// Tests that a unique median in an odd-size array is found correctly.
TEST_F(NthItemTest, UniqueTest) {
  KDVector v;
  // Push the test data onto the KDVector.
  PushTestData(&v);
  // Get the median item.
  size_t index = v.size() / 2;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 6, it started out at index 11.
  EXPECT_EQ(6, v[index].key());
  EXPECT_EQ(11, v[index].data());
}

// Tests that an equal median is found correctly.
TEST_F(NthItemTest, EqualTest) {
  KDVector v;
  // Push the test data onto the KDVector.
  PushTestData(&v);
  // Add an extra 8. This makes the median 7.
  IntKDPair pair(8, 13);
  v.push_back(pair);
  // Get the median item.
  size_t index = v.size() / 2;
  std::nth_element(v.begin(), v.begin() + index, v.end());
  // The result is 7, it started out at index 4 or 12.
  EXPECT_EQ(7, v[index].key());
  EXPECT_TRUE(v[index].data() == 4 || v[index].data() == 12);
}

} // namespace tesseract


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. Soc. mycol. Fr. 19(3): 293 (1903)

#### Original name
Ascochyta kentiae Maubl.

### Remarks
null


text:
import { getColor, isCompatible } from '../helpers';
import { View, TouchableNativeFeedback } from 'react-native';
import Actions from './Actions';
import Body from './Body';
import Media from './Media';
import React, { Component, PropTypes } from 'react';
import Ripple from '../polyfill/Ripple';

import { COLOR } from '../config';

const styles = {
    container: {
        backgroundColor: '#ffffff',
        borderRadius: 2,
        marginVertical: 8,
        marginHorizontal: 8,
        paddingLeft: 16,
        paddingRight: 16,
    },
};

export default class Card extends Component {

    static propTypes = {
        theme: PropTypes.string,
        overrides: PropTypes.shape({
            backgroundColor: PropTypes.string,
            rippleColor: PropTypes.string,
        }),
        elevation: PropTypes.number,
        fullWidth: PropTypes.bool,
        disabled: PropTypes.bool,
        onPress: PropTypes.func,
        children: PropTypes.node.isRequired,
        style: PropTypes.object,
    };

    static defaultProps = {
        elevation: 2,
        disabled: false,
    };

    static Media = Media;

    static Body = Body;

    static Actions = Actions;

    render() {
        const {
            theme,
            overrides,
            elevation,
            fullWidth,
            disabled,
            onPress,
            children,
            style,
        } = this.props;

        const cardStyle = (() => ([
            styles.container, {
                elevation,
            }, fullWidth && {
                marginHorizontal: 0,
            }, !isCompatible('elevation') && {
                borderWidth: 1,
                borderColor: 'rgba(0,0,0,.12)',
            }, theme && {
                backgroundColor: COLOR[theme].color,
            }, overrides && overrides.backgroundColor && {
                backgroundColor: overrides.backgroundColor,
            }, style,
        ]))();

        if (onPress === null || disabled) {
            return (
                <View style={cardStyle}>
                    {children}
                </View>
            );
        }

        const defaultRippleColor = 'rgba(153,153,153,.4)';
        const rippleColor = (() => {
            if (disabled || !(overrides && overrides.rippleColor)) {
                return defaultRippleColor;
            }

            return getColor(overrides.rippleColor);
        })();

        if (!isCompatible('TouchableNativeFeedback')) {
            return (
                <Ripple
                    rippleColor={rippleColor}
                    onPress={onPress}
                >
                    <View style={cardStyle}>
                        {children}
                    </View>
                </Ripple>
            );
        }

        return (
            <TouchableNativeFeedback
                background={TouchableNativeFeedback.Ripple(rippleColor)}
                onPress={onPress}
            >
                <View style={cardStyle}>
                    {children}
                </View>
            </TouchableNativeFeedback>
        );
    }

}


text:
class Iblock < ActiveRecord::Base
  set_table_name :b_iblock

  # version - 1 или 2

  # iblock_type_id это строка, поэтом он срабатывает только если его указывать явано в foreign_key
  belongs_to :iblock_type, :foreign_key=>'iblock_type_id'

  # Они еще связаны между собой через iblock_section_element
  has_many :iblock_sections
  has_many :iblock_elements

  # has_many :iblock_section_elements, :through=>:iblock_sections

  # Список типов свойств по номерам которых создаются поля в
  # таблицах iblock_element_prop_sN
  has_many :iblock_properties

  has_many :iblock_fields
  has_many :iblock_groups

  class << self
    def s_props_class(id)
      # raise 'Только для инфоблоков 2-й версии' unless version==2
      "IblockElementPropS#{id}".constantize
    end

    def m_props_class(id)
      # raise 'Только для инфоблоков 2-й версии' unless version==2
      "IblockElementPropM#{id}".constantize
    end

    def all
      @cached_all ||= super
    end

    def get_properties(id)
      @properties = {} unless @properties
      @properties[id] ||= IblockProperty.where(:iblock_id => id).inject({}) { |a,e| a[e.id] = e; a }
    end

    def get_property(iblock_id, property_id)
      get_properties(iblock_id)[property_id]
    end

    def get_property_codes(id)
      @property_codes = {} unless @property_codes
      @property_codes[id] ||= get_properties(id).values.inject({}){ |a,e| a[e.code] = e.id; a }
    end

    # Определяем методы совпадающие с именами свойств и их установкой, например следующие записи идентичны:
    #
    #   post.iblock_element.property_set.name2 = 'имя'
    #   post.iblock_element.name2 = 'имя'
    #   post.name2 = 'имя'
    #   post.property_name2 = 'имя'
    #
    # Вызывается для классов наследуемых от IblockElement, типа Emitent и расширяемых
    # инфоблоком через has_infoblock, например Post
    #
    def define_delegated_methods(scope, id, is_class=false)
      # TODO Проверять не создали ли мы такие методы уже в рамках класса
      # это так если у класса установлен @iblock_id

      return if scope.is_a?(IblockElement) and scope.class.iblock_id

      eval_method = is_class ? :class_eval : :instance_eval

      get_property_codes(id).each { |code, number|

        if scope.respond_to? code
          logger.warn "Iblock(#{id}): Метод #{code} уже определен в #{scope.class}"
        else
          scope.send eval_method, "def #{code}; property_set.send('#{code}'); end"
        end
        scope.send eval_method,  "def property_#{code}; property_set.send('#{code}'); end"

        # TODO Сделать .to_i если тип свойства NUMERIC, также для boolean
        if scope.respond_to? "#{code}="
          logger.warn "Iblock(#{id}): Метод #{code}= уже определен в #{scope.class}"
        else
          scope.send eval_method, "def #{code}=(value); property_set.send('#{code}=', value); end"
        end
        scope.send eval_method, "def property_#{code}=(value); property_set.send('#{code}=', value); end"
      }

    end
  end # self

  def to_s
    name
  end

  def get_property(property_id)
    self.class.get_property(id, property_id)
  end

  def property_codes
    self.class.get_property_codes(id)
  end
end


text:
package utils.list;

/**
 * Created by yanya04 on 8/5/2017.
 */
public class ListNode {
    public int val;
    public ListNode next, prev;
    public ListNode(int x){val = x;}

    public static void print(ListNode node){
        if(node != null){
            System.out.print(node.val + " -> ");
            print(node.next);
        }
    }
}


text:
package org.wso2.developerstudio.eclipse.gmf.esb.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.RegistryKeyProperty;
import org.wso2.developerstudio.eclipse.gmf.esb.ThrottlePolicyConfiguration;
import org.wso2.developerstudio.eclipse.gmf.esb.ThrottlePolicyEntry;
import org.wso2.developerstudio.eclipse.gmf.esb.ThrottlePolicyType;

/**
 *
 * An implementation of the model object 'Throttle Policy Configuration'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.ThrottlePolicyConfigurationImpl#getPolicyType Policy Type}

 *
{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.ThrottlePolicyConfigurationImpl#getPolicyKey Policy Key}

 *
{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.ThrottlePolicyConfigurationImpl#getMaxConcurrentAccessCount Max Concurrent Access Count}

 *
{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.ThrottlePolicyConfigurationImpl#getPolicyEntries Policy Entries}

 *

 *
 * @generated
 */
public class ThrottlePolicyConfigurationImpl extends EObjectImpl implements ThrottlePolicyConfiguration {
    /**
     * The default value of the '{@link #getPolicyType() Policy Type}' attribute.
     *
     *
     * @see #getPolicyType()
     * @generated
     * @ordered
     */
    protected static final ThrottlePolicyType POLICY_TYPE_EDEFAULT = ThrottlePolicyType.INLINE;

    /**
     * The cached value of the '{@link #getPolicyType() Policy Type}' attribute.
     *
     *
     * @see #getPolicyType()
     * @generated
     * @ordered
     */
    protected ThrottlePolicyType policyType = POLICY_TYPE_EDEFAULT;

    /**
     * The cached value of the '{@link #getPolicyKey() Policy Key}' containment reference.
     *
     *
     * @see #getPolicyKey()
     * @generated
     * @ordered
     */
    protected RegistryKeyProperty policyKey;

    /**
     * The default value of the '{@link #getMaxConcurrentAccessCount() Max Concurrent Access Count}' attribute.
     *
     *
     * @see #getMaxConcurrentAccessCount()
     * @generated
     * @ordered
     */
    protected static final int MAX_CONCURRENT_ACCESS_COUNT_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getMaxConcurrentAccessCount() Max Concurrent Access Count}' attribute.
     *
     *
     * @see #getMaxConcurrentAccessCount()
     * @generated
     * @ordered
     */
    protected int maxConcurrentAccessCount = MAX_CONCURRENT_ACCESS_COUNT_EDEFAULT;

    /**
     * The cached value of the '{@link #getPolicyEntries() Policy Entries}' containment reference list.
     *
     *
     * @see #getPolicyEntries()
     * @generated
     * @ordered
     */
    protected EList<ThrottlePolicyEntry> policyEntries;

    /**
     *
     *
     * @generated
     */
    protected ThrottlePolicyConfigurationImpl() {
        super();
    }

    /**
     *
     *
     * @generated
     */

    @Override
    protected EClass eStaticClass() {
        return EsbPackage.Literals.THROTTLE_POLICY_CONFIGURATION;
    }

    /**
     *
     *
     * @generated
     */
    public ThrottlePolicyType getPolicyType() {
        return policyType;
    }

    /**
     *
     *
     * @generated
     */
    public void setPolicyType(ThrottlePolicyType newPolicyType) {
        ThrottlePolicyType oldPolicyType = policyType;
        policyType = newPolicyType == null ? POLICY_TYPE_EDEFAULT : newPolicyType;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_TYPE, oldPolicyType, policyType));
    }

    /**
     *
     *
     * @generated
     */
    public RegistryKeyProperty getPolicyKey() {
        return policyKey;
    }

    /**
     *
     *
     * @generated
     */
    public NotificationChain basicSetPolicyKey(RegistryKeyProperty newPolicyKey, NotificationChain msgs) {
        RegistryKeyProperty oldPolicyKey = policyKey;
        policyKey = newPolicyKey;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY, oldPolicyKey, newPolicyKey);
            if (msgs == null) msgs = notification; else msgs.add(notification);
        }
        return msgs;
    }

    /**
     *
     *
     * @generated
     */
    public void setPolicyKey(RegistryKeyProperty newPolicyKey) {
        if (newPolicyKey != policyKey) {
            NotificationChain msgs = null;
            if (policyKey != null)
                msgs = ((InternalEObject)policyKey).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY, null, msgs);
            if (newPolicyKey != null)
                msgs = ((InternalEObject)newPolicyKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY, null, msgs);
            msgs = basicSetPolicyKey(newPolicyKey, msgs);
            if (msgs != null) msgs.dispatch();
        }
        else if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY, newPolicyKey, newPolicyKey));
    }

    /**
     *
     *
     * @generated
     */
    public int getMaxConcurrentAccessCount() {
        return maxConcurrentAccessCount;
    }

    /**
     *
     *
     * @generated
     */
    public void setMaxConcurrentAccessCount(int newMaxConcurrentAccessCount) {
        int oldMaxConcurrentAccessCount = maxConcurrentAccessCount;
        maxConcurrentAccessCount = newMaxConcurrentAccessCount;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, EsbPackage.THROTTLE_POLICY_CONFIGURATION__MAX_CONCURRENT_ACCESS_COUNT, oldMaxConcurrentAccessCount, maxConcurrentAccessCount));
    }

    /**
     *
     *
     * @generated
     */
    public EList<ThrottlePolicyEntry> getPolicyEntries() {
        if (policyEntries == null) {
            policyEntries = new EObjectContainmentEList<ThrottlePolicyEntry>(ThrottlePolicyEntry.class, this, EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_ENTRIES);
        }
        return policyEntries;
    }

    /**
     *
     *
     * @generated
     */

    @Override
    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY:
                return basicSetPolicyKey(null, msgs);
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_ENTRIES:
                return ((InternalEList<?>)getPolicyEntries()).basicRemove(otherEnd, msgs);
        }
        return super.eInverseRemove(otherEnd, featureID, msgs);
    }

    /**
     *
     *
     * @generated
     */

    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_TYPE:
                return getPolicyType();
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY:
                return getPolicyKey();
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__MAX_CONCURRENT_ACCESS_COUNT:
                return getMaxConcurrentAccessCount();
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_ENTRIES:
                return getPolicyEntries();
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     *
     *
     * @generated
     */
    @SuppressWarnings("unchecked")
    @Override

    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_TYPE:
                setPolicyType((ThrottlePolicyType)newValue);
                return;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY:
                setPolicyKey((RegistryKeyProperty)newValue);
                return;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__MAX_CONCURRENT_ACCESS_COUNT:
                setMaxConcurrentAccessCount((Integer)newValue);
                return;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_ENTRIES:
                getPolicyEntries().clear();
                getPolicyEntries().addAll((Collection<? extends ThrottlePolicyEntry>)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     *
     *
     * @generated
     */

    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_TYPE:
                setPolicyType(POLICY_TYPE_EDEFAULT);
                return;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY:
                setPolicyKey((RegistryKeyProperty)null);
                return;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__MAX_CONCURRENT_ACCESS_COUNT:
                setMaxConcurrentAccessCount(MAX_CONCURRENT_ACCESS_COUNT_EDEFAULT);
                return;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_ENTRIES:
                getPolicyEntries().clear();
                return;
        }
        super.eUnset(featureID);
    }

    /**
     *
     *
     * @generated
     */

    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_TYPE:
                return policyType != POLICY_TYPE_EDEFAULT;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_KEY:
                return policyKey != null;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__MAX_CONCURRENT_ACCESS_COUNT:
                return maxConcurrentAccessCount != MAX_CONCURRENT_ACCESS_COUNT_EDEFAULT;
            case EsbPackage.THROTTLE_POLICY_CONFIGURATION__POLICY_ENTRIES:
                return policyEntries != null && !policyEntries.isEmpty();
        }
        return super.eIsSet(featureID);
    }

    /**
     *
     *
     * @generated
     */

    @Override
    public String toString() {
        if (eIsProxy()) return super.toString();

        StringBuffer result = new StringBuffer(super.toString());
        result.append(" (policyType: ");
        result.append(policyType);
        result.append(", maxConcurrentAccessCount: ");
        result.append(maxConcurrentAccessCount);
        result.append(')');
        return result.toString();
    }

} // ThrottlePolicyConfigurationImpl


text:
ALTER TABLE SCHEMA_TEST.INDEX_TEST2
ADD CONSTRAINT PK_INDEX_TEST13 PRIMARY KEY
(
  INDEX_TEST2_ID
);


text:
using std::experimental::suspend_always;
using std::experimental::suspend_never;

struct awaitable {
  bool await_ready();
  void await_suspend(std::experimental::coroutine_handle<>); // FIXME: coroutine_handle
  void await_resume();
} a;

struct object { ~object() {} };

struct promise_void_return_value {
  void get_return_object();
  suspend_always initial_suspend();
  suspend_always final_suspend();
  void unhandled_exception();
  void return_value(object);
};

struct VoidTagReturnValue {
  struct promise_type {
    VoidTagReturnValue get_return_object();
    suspend_always initial_suspend();
    suspend_always final_suspend();
    void unhandled_exception();
    void return_value(object);
  };
};

template <typename T1>
struct std::experimental::coroutine_traits<void, T1> { using promise_type = promise_void_return_value; };

VoidTagReturnValue test() {
  object x = {};
  try {
    co_return {};
  } catch (...) {
    throw;
  }
}


text:
artefactjs-example
==================

EXPERIMENTAL: example how to use artefactjs


text:
const join = require('path').join;
const cwd = process.cwd();
const pkgJSON = require(join(cwd, 'package.json'));
const { copySync } = require('fs-extra/lib/copy');

if (pkgJSON.private) {
  return;
}

// Move type declaration files generated by TSC to dist folder
copySync(join(cwd, '../../build/packages/', pkgJSON.name, 'src'), join(cwd, 'dist'), { overwrite: true });


text:
module Analyzer (analyze) where

import Insn

import Data.Array
import Data.List
import Data.Maybe
import Text.Printf (printf)

objArray :: Object -> Array Int Insn
objArray obj = listArray (0, (length obj)) obj

data PipelineState = PipelineState
  { ifetch :: Maybe Int
  , dcd :: Maybe Int
  , mem :: Maybe Int
  , ex :: Maybe Int
  , wb :: Maybe Int
  , staleRegs :: [RegSel] } deriving (Show)

instance Eq PipelineState where
  x == y = (ifetch x) == (ifetch y)
           && (dcd x) == (dcd y)
           && (mem x) == (mem y)
           && (ex x) == (ex y)
           && (wb x) == (wb y)

isValidAddr :: Array Int a -> Int -> Bool
isValidAddr obja i = (b <= i) && (i < t)
  where (b, t) = bounds obja

isValidAddrM :: Array Int a -> Maybe Int -> Bool
isValidAddrM obja (Just i) = isValidAddr obja i
isValidAddrM obja Nothing  = True

isValidState :: Array Int a -> PipelineState -> Bool
isValidState _ PipelineState { ifetch = Nothing
                             , dcd = Nothing
                             , mem = Nothing
                             , ex = Nothing
                             , wb = Nothing } = False
isValidState obja ps = v (ifetch ps) && v (dcd ps) && v (mem ps) && v (ex ps) && v (wb ps)
  where v = isValidAddrM obja

invalidState :: PipelineState
invalidState = PipelineState
               { ifetch = Just 0
               , dcd = Nothing
               , mem = Nothing
               , ex = Nothing
               , wb = Nothing
               , staleRegs = [] }

tryAdvanceAddr :: Array Int a -> Maybe Int -> Maybe Int
tryAdvanceAddr obja (Just i) = if isValidAddr obja (i + 1) then Just (i + 1) else Nothing
tryAdvanceAddr obja Nothing  = Nothing

nextState :: Array Int Insn -> PipelineState -> Maybe Int -> PipelineState
nextState obja curr ifetchAddr = PipelineState
                                 { ifetch = ifetchAddr
                                 , dcd = ifetch curr
                                 , mem = dcd curr
                                 , ex = mem curr
                                 , wb = ex curr
                                 , staleRegs = newStaleRegs}
  where
    staleRegFromAddr addr | isValidAddr obja addr =
      case (obja!addr) of
        ArithInsn{memw=MNone, rd=rd} -> rd
        _                            -> Rc0
    staleRegFromAddr _ = Rc0

    nonStale = fromMaybe Rc0 $ do addr <- wb curr
                                  Just $ staleRegFromAddr addr

    newStale = fromMaybe Rc0 $ do addr <- dcd curr
                                  Just $ staleRegFromAddr addr

    -- delete only deletes the first nonStale, but it is on purpose. There may be multiple stale writes for the same reg in the pipeline.
    filtered = delete nonStale (staleRegs curr)

    newStaleRegs = if newStale == Rc0 then filtered else newStale:filtered

initialState :: Array Int Insn -> PipelineState
initialState obja = nextState obja nullState (Just 0)
  where nullState = PipelineState { ifetch = Nothing, dcd = Nothing, mem = Nothing, ex = Nothing, wb = Nothing, staleRegs = [] }

nextStates :: Array Int Insn -> PipelineState -> [PipelineState]
nextStates obja curr = filter (isValidState obja) [bnt, bt]
  where
    bnt :: PipelineState
    bnt = nextState obja curr $ tryAdvanceAddr obja (ifetch curr)

    btm :: Maybe PipelineState
    btm = do jex <- ex curr
             ja <- branchTargetAddr $ obja!jex
             Just $ nextState obja curr (Just ja)
    bt = fromMaybe invalidState btm

possibleStates :: Array Int Insn -> [PipelineState]
possibleStates obja = populateStates obja (initialState obja) []
  where
    populateStates :: Array Int Insn -> PipelineState -> [PipelineState] -> [PipelineState]
    populateStates obja s ss | (elem s ss) = ss -- Already explored
                             | otherwise   = foldr step (s:ss) nexts
                             where
                               nexts :: [PipelineState]
                               nexts = nextStates obja s

                               step :: PipelineState -> [PipelineState] -> [PipelineState]
                               step = populateStates obja

checkMemRWConflict :: Array Int Insn -> PipelineState -> Maybe String
checkMemRWConflict obja PipelineState{mem=Just mi, wb=Just wbi} =
  case (minsn, wbinsn) of
    (_, ArithInsn{memw=MNone}) -> Nothing
    (ArithInsn{memrs=stgt}, ArithInsn{memw=wtgt}) | stgt == wtgt -> Just (errmsg $ "s = "++(show stgt))
    (ArithInsn{memrt=ttgt}, ArithInsn{memw=wtgt}) | ttgt == wtgt -> Just (errmsg $ "t = "++(show ttgt))
    (_, _) -> Nothing
  where
    minsn  = obja!mi
    wbinsn = obja!wbi
    errmsg rloc = printf (unlines [
      "Found a Memory RW conflict:",
      "  MEM stage reading \"%s\" executing insn:",
      "    %s",
      "  conflicts with WB stage writing to \"%s\" executing insn:",
      "    %s"]) rloc (show minsn) (show $ memw wbinsn) (show wbinsn)

checkMemRWConflict _ _ = Nothing

checkStaleRegRead :: Array Int Insn -> PipelineState -> Maybe String
checkStaleRegRead obja PipelineState{dcd = Just dcdi, staleRegs=staleRegs} | isValidAddr obja dcdi
  = if null sregs then Nothing else Just $ errmsg sregs
    where ifinsn = obja!dcdi
          rsStale = do rs <- maybeRs ifinsn
                       if elem rs staleRegs then Just rs else Nothing
          rtStale = do rt <- maybeRt ifinsn
                       if elem rt staleRegs then Just rt else Nothing
          sregs = catMaybes [rsStale, rtStale]
          errmsg :: [RegSel] -> String
          errmsg sregs = printf (unlines [
            "Found a stale reg read of registers %s:",
            "  %s"]) (show sregs) (show ifinsn)
checkStaleRegRead _ _ = Nothing

type CheckFunc = Array Int Insn -> PipelineState -> Maybe String

-- map show $ reverse states
analyze :: Object -> [String]
analyze obj = pipelineCheckResults
  where
    obja :: Array Int Insn
    obja = objArray obj

    states :: [PipelineState]
    states = possibleStates obja

    checks :: [CheckFunc]
    checks = [checkStaleRegRead, checkMemRWConflict]

    pipelineCheckResults :: [String]
    pipelineCheckResults = checks >>= (\check -> catMaybes $ map (check obja) states)