text:
module FFXIV
  module Lodestone
    class FreeCompany < Model

      attr_accessor :id, :name, :server, :tag, :logo_uri, :formed, :members, :num_members, :rank,
                    :grand_company, :grand_company_standing, :slogan, :focus, :seeking, :active,
                    :recruiting, :housing, :weekly_rank, :monthly_rank
      alias :recruiting? :recruiting

      class << self

        def search(keyword, server: nil, page: 1, verbose: false)
          dom = Lodestone.fetch("freecompany/?q=#{URI.escape(keyword)}&worldname=#{URI.escape(server)}&page=#{URI.escape(page.to_s)}")
          free_companies = dom.search("table.table_elements_com_fc tr").map do |tr|
            h4 = tr.at("td h4")
            a = h4.at("a")
            id = a.attr("href").split("/")[-1].to_i
            if verbose
              self.find_by_id(id)
            else
              self.new({
                id: id,
                name: a.content,
                server: h4.at("span").content.strip[1...-1],
                grand_company: tr.at("div.groundcompany_name").content
              })
            end
          end
          pagination = dom.at("div.current_list")
          if pagination
            total = pagination.at("span.total").content.to_i
            results = {
              show_start: pagination.at("span.show_start").content.to_i,
              show_end: pagination.at("span.show_end").content.to_i,
              total: total,
              num_pages: (total / 50.0).ceil,
              free_companies: free_companies
            }
          end
        end

        def name_to_id(name, server)
          search_results = self.search(name, server: server)
          if search_results
            search_results[:free_companies].each do |fc|
              return fc.id if name.downcase == fc.name.downcase
            end
          end
          nil
        end

        def find_by_id(id)
          begin
            dom = Lodestone.fetch("freecompany/#{id}")

            props = {}
            props[:id] = id

            props[:logo_uri] = dom.search("div.ic_crest_64 img").map{|n| n.attr("src")}

            gcs_node = dom.at("span.friendship_color")
            props[:grand_company_standing] = gcs_node.inner_text[1...-1]

            gc_node = gcs_node.previous_sibling
            props[:grand_company] = gc_node.inner_text.strip

            name_node = gcs_node.next_sibling.next_sibling.next_sibling
            props[:name] = name_node.inner_text

            server_node = name_node.next_sibling.next_sibling
            props[:server] = server_node.inner_text[1...-1]

            props[:tag] = dom.at("td.vm").last_element_child.next_sibling.inner_text[1...-1]

            dom.search("table.table_style2 tr").each do |tr|
              td_node = tr.at("td")
              td_text = td_node.inner_text.strip
              case tr.at("th").inner_text
                when "Formed"
                  props[:formed] = Time.at(td_text.match(/ldst_strftime\((\d{10}), 'YMD'\)/)[1].to_i).utc
                when "Rank"
                  props[:rank] = td_text.to_i
                when "Active Members"
                  props[:num_members] = td_text.to_i
                when "Ranking"
                  weekly, monthly, __garbage = td_node.inner_html.split("<br>").map(&:strip)
                  props[:weekly_rank] = weekly.include?("--") ? nil : weekly.match(/\d+/)[0].to_i
                  props[:monthly_rank] = monthly.include?("--") ? nil : monthly.match(/\d+/)[0].to_i
                when "Company Slogan"
                  props[:slogan] = td_text == "" ? nil : td_text
                when "Active"
                  props[:active] = td_text == "Not specified" ? nil : td_text
                when "Recruitment"
                  props[:recruiting] = td_text == "Open"
                when "Focus"
                  props[:focus] = td_node.search("li:not(.icon_off) img").map{|n| n.attr("title")}
                when "Seeking"
                  props[:seeking] = td_node.search("li:not(.icon_off) img").map{|n| n.attr("title")}
                when "Estate Profile"
                  name_node = td_node.at("div.txt_yellow")
                  if name_node
                    address_size, greeting = td_node.search("p").map(&:inner_text)
                    address, size = address_size.split(" (")
                    props[:housing] = {
                      name: name_node.inner_text,
                      address: address,
                      size: size[0...-1],
                      greeting: greeting == "No greeting available." ? nil : greeting
                    }
                  else
                    props[:housing] = nil
                  end
              end
            end
            self.new(props)
          rescue => e
            pp e
            nil
          end
        end
      end

      def members
        if @members.nil?
          members = {}
          num_pages = (@num_members / 50.0).ceil # 50 members / page
          1.upto(num_pages) do |page_no|
            dom = Lodestone.fetch("freecompany/#{@id}/member/?page=#{page_no}")
            dom.search("div.player_name_area").each do |node|
              cid = node.at("div.name_box a").attr("href").split("/")[-1]
              fcrank = node.at("div.fc_member_status").content.strip
              members[cid] = fcrank
            end
          end
          characters = []
          members.each do |cid, fcrank|
            character = Character.find_by_id(cid)
            character.free_company_rank = fcrank.strip
            characters << character
          end
          @members = characters
        end
        @members
      end

      private

    end
  end
end


text:
package graph.objects;

import java.nio.MappedByteBuffer;
import nio.base.IDNio;

/**
 * Vrchol ako objket, ktory sa nachadza v pameti
 * a nie v namapovanom subore. Takto si mozem opytat
 * vicero vrcholov zo suboru. Pomocou garbace collectoru
 * viem ze ked sa objekt nevyuzije uvolni sa. Ziskam
 * tak viacej pameti.
 *
 * @author Lukas Sekerak
 */
public class VertexMetaData implements IDNio
{
	protected char[]	value;
	protected int		priority;

	public static int Size(int valuelength) {
		return 4 + // priorita
		2 + 2 * valuelength; // Value - dynamicke nech ide posledne
	}
	@Override
	public int nioSize() {
		return Size(value.length);
	}

	public void set(char[] value, int priority) {
		this.value = value;
		this.priority = priority;
	}

	@Override
	public void nioWrite(MappedByteBuffer buffer) {
		buffer.putInt(priority);

		// Uloz do bufferua
		buffer.putChar((char) value.length);
		for (int i = 0; i < value.length; i++)
			buffer.putChar(value[i]);
	}

	@Override
	public void nioRead(MappedByteBuffer buffer) {
		int size;
		priority = buffer.getInt();

		size = buffer.getChar();
		value = new char[size];
		buffer.asCharBuffer().get(value, 0, size);
		/*
		 * for (int i = 0; i < size; i++)
		 * value[i] = buffer.getChar();
		 */
	}

	public static VertexMetaData PriorityOnly() {
		return new VertexMetaData()
		{
			@Override
			public void nioWrite(MappedByteBuffer buffer) {
				buffer.putInt(priority);
			}
			@Override
			public void nioRead(MappedByteBuffer buffer) {
				priority = buffer.getInt();
			}
			@Override
			public int nioSize() {
				return -1;
			}
		};
	}
}

redpajama_set_name: RedPajamaGithub


text:
namespace tgui
{
    class TGUI_API Table: public BoxLayout
    {
    public:
        typedef std::shared_ptr<Table> Ptr; ///< Shared widget pointer
        typedef std::shared_ptr<const Table> ConstPtr; ///< Shared constant widget pointer

        Table();

        virtual Widget::Ptr clone() const override
        {
            return std::make_shared<Table>(*this);
        }

        virtual void setFont(const Font& font) override;
        void setTextSize(unsigned int size);

        virtual void setSize(const Layout2d& size) override;
        using Transformable::setSize;

        bool insert(std::size_t index, const tgui::Widget::Ptr& widget, const sf::String& widgetName = "");
        virtual void add(const tgui::Widget::Ptr& widget, const sf::String& widgetName = "") override;
        void addRow(const std::vector<std::string>& columns);

        void setHeader(const tgui::TableRow::Ptr& row);
        void setHeaderColumns(const std::vector<std::string>& columns);
        // getHeader()

        void setFixedColumnWidth(std::size_t column, float size);
        void setColumnRatio(std::size_t column, float ratio);

        // virtual void setFixedRowsHeight(float size);

        // void showTableBorders(bool show = true);
        // void showColumnsBorders(bool show = true);
        // void setTableBordersColor(const sf::Color& color);
        // void setColumnsBorder(const sf::Color& color);

        void setRowsColor(const sf::Color& color);
        void setStripesRowsColor(const sf::Color& evenColor, const sf::Color& oddColor);

        void setTextColor(const sf::Color& color);

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    private:
        virtual void updateWidgetPositions() override;
        void calculateLabelHeight();
        void updateColumnsDelimitatorsPosition();
        void updateColumnsDelimitatorsSize();

        virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    private:
        tgui::TableRow::Ptr m_header = std::make_shared<tgui::TableRow>();

        float m_rowHeight = 20;

        sf::RectangleShape m_tableBorder;
        sf::RectangleShape m_headerSeparator;
        std::vector<sf::RectangleShape> m_columnsDelimitators;
        sf::Color m_bordersColor;

        sf::Color m_rowsOddColor;
        sf::Color m_rowsEvenColor = sf::Color::Transparent;

        unsigned int m_characterSize = 18;

        sf::Color m_normalTextColor = sf::Color::Black;
    };

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#endif // TGUI_TABLE_HPP


text:
<?php

namespace ReckiCT\Analyzer\GraphProcessor;

use ReckiCT\Type;
use ReckiCT\Graph\Helper;
use ReckiCT\Graph\Assignment;
use ReckiCT\Graph\Vertex\Phi;

use Gliph\Graph\DirectedAdjacencyList;

use ReckiCT\Analyzer\GraphState;

use ReckiCT\Analyzer\GraphProcessor;

class PhiResolver implements GraphProcessor
{
    public function process(GraphState $state)
    {
        $graph = $state->getGraph();
        do {
            $rerun = false;
            $phiNodes = [];
            foreach ($graph->vertices() as $vertex) {
                if ($vertex instanceof Phi) {
                    $phiNodes[] = $vertex;
                    $rerun = $rerun || $this->resolve($vertex, $state);
                }
            }
            if (!$rerun) {
                $rerun = $this->checkForCircularReference($phiNodes, $state);
            }
        } while ($rerun);
    }

    public function resolve(Phi $vertex, GraphState $state)
    {
        $types = [];
        foreach ($vertex->getVariables() as $value) {
            $types[] = $value->getType()->getType();
        }
        $types = array_unique($types);
        switch (count($types)) {
            case 1:
                if ($types[0] !== Type::TYPE_UNKNOWN || 0 === count($vertex->getValues())) {
                    // resolve variables to result
                    $this->removePhi($vertex, $state);

                    return true;
                }
                break;
            case 2:
                if (in_array(Type::TYPE_NUMERIC, $types)) {
                    if (in_array(Type::TYPE_LONG, $types) || in_array(Type::TYPE_DOUBLE, $types)) {
                        $this->removePhi($vertex, $state);

                        return true;
                    } elseif (in_array(Type::TYPE_BOOLEAN, $types)) {
                        $vertex->getResult()->setType(new Type(Type::TYPE_NUMERIC));
                        $this->removePhi($vertex, $state);

                        return true;
                    }
                }
                break;
        }

        return false;
    }

    public function removePhi(Phi $vertex, GraphState $state)
    {
        $graph = $state->getGraph();
        Helper::remove($vertex, $graph);
        $to = $vertex->getResult();
        foreach ($vertex->getValues() as $value) {
            foreach ($graph->vertices() as $v) {
                $v->replaceVariable($value, $to);
                if ($v instanceof Assignment && $v->getResult() === $value) {
                    $v->setResult($to);
                }
            }
        }
    }

    public function checkForCircularReference(array $phiNodes, GraphState $state)
    {
        $graph = new DirectedAdjacencyList();
        foreach ($phiNodes as $phi) {
            $result = $phi->getResult();
            foreach ($phi->getValues() as $value) {
                $graph->ensureArc($value, $result);
            }
        }
        $cycles = $graph->getCycles();
        foreach ($cycles as $cycle) {
            if ($this->areAllUnknown($cycle)) {
                // All are unknown, process!
                $types = array();
                foreach ($cycle as $component) {
                    foreach (Helper::getInboundNodes($component, $graph) as $node) {
                        if (in_array($node, $cycle, true)) continue;
                        $types[] = $node->getType()->getType();
                    }
                }
                $types = array_unique($types);
                $newType = 0;
                switch (count($types)) {
                    case 1:
                        if ($types[0] != Type::TYPE_UNKNOWN) {
                            $newType = $types[0];
                        }
                        break;
                    case 2:
                        if (in_array(Type::TYPE_NUMERIC, $types) && in_array(Type::TYPE_LONG, $types)) {
                            $newType = Type::TYPE_NUMERIC;
                        } elseif (in_array(Type::TYPE_NUMERIC, $types) && in_array(Type::TYPE_DOUBLE, $types)) {
                            $newType = Type::TYPE_DOUBLE;
                        }
                        break;
                }
                if ($newType) {
                    foreach ($cycle as $component) {
                        $component->setType(new Type($newType));
                    }

                    return true;
                }
            }
        }

        return false;
    }

    public function areAllUnknown(array $phiNodes)
    {
        foreach ($phiNodes as $node) {
            if (!$node->getType()->isUnknown()) {
                return false;
            }
        }

        return true;
    }
}


text:
'use strict';

angular.module('openhds')
    .service('PregnancyObservationService',
             ['EntityService', PregnancyObservationService]);

function PregnancyObservationService(EntityService) {
    var service = this;
    var urlBase = "/pregnancyObservations";

    function Request(model) {
        return {
            collectedByUuid: model.fieldWorker.uuid,
            visitUuid: model.visit.uuid,
            motherUuid: model.mother.uuid,
            pregnancyObservation: {
                pregnancyDate: model.visit.visitDate,
                expectedDeliveryDate: model.event.deliveryDate,
                collectionDateTime: model.visit.visitDate
            }
        };
    }

    service.submit = function(fieldWorker, collectionDate, visit,
                              mother, event) {
        var model = {
            fieldWorker: fieldWorker,
            collectionDate: collectionDate,
            visit: visit,
            mother: mother,
            event: event
        };
        return EntityService.submit(urlBase, Request, model);
    };

    return service;
}


text:
import numpy as np
from parity_machine import PermutationParityMachine
from utils import gen_ppm_inputs

def train_step(model_a, model_b):
    """Updates model a and model b if they have the same tau given the random input.

    Args:
        model_a (PermutationParityMachine): Model used to sync weights with Model B.
        model_b (PermutationParityMachine): Model used to sync weights with Model A.

    Returns:
        (bool). If True, then Model A and B updated.
    """
    if not hyperparams_same(model_a, model_b):
        raise ValueError("Models are incompatible. Need same hyper-parameters (K, N, L).")

    K, N, L = model_a.get_hyper_params()
    x = gen_ppm_inputs(K, N)

    tau_a = model_a.output(x)
    tau_b = model_b.output(x)

    if tau_a == tau_b:
        model_a.update(tau_b)
        model_b.update(tau_a)

    return tau_a == tau_b

def train_step(model_a, model_b, eve):
    """Updates model a and model b if they have the same tau given the random input.
    Will also update the snooper model, eve, if matches with model a and model b.

    Args:
        model_a (PermutationParityMachine): Model used to sync weights with Model B.
        model_b (PermutationParityMachine): Model used to sync weights with Model A.
        eve (PermutationParityMachine): Snooper model attempting to sync with Model A and B.

    Returns:
        (tuple). If first element is True, then Model A and B updated.
        If the second element is True then Eve also updated.
    """
    if not hyperparams_same(model_a, model_b) or not hyperparams_same(model_a, eve):
        raise ValueError("Models are incompatible. Need same hyper-parameters (K, N).")

    K, N, L = model_a.get_hyper_params()
    x = gen_ppm_inputs(K, N)

    tau_a = model_a.output(x)
    tau_b = model_b.output(x)
    tau_eve = eve.output(x)

    if tau_a == tau_b:
        model_a.update(tau_b)
        model_b.update(tau_a)

        if tau_a == tau_eve:
            eve.update(tau_a)

    return (tau_a == tau_b), (tau_a == tau_b) and (tau_a == tau_eve)

def train(model_a, model_b, total_iter=np.infty, print_step=None):
    """Runs through several training steps with model A and B, attempting to have a closer match.

    Args:
        model_a (PermutationParityMachine): Model used to sync weights with Model B.
        model_b (PermutationParityMachine): Model used to sync weights with Model A.
        total_iter (int): The total number of training steps to run or until matching.
            Can be set to np.infty, which will run the training until Model A matches B.
            (Optional: np.infty)
        print_step (int): Prints training information every print_step. If None, won't print anything.
            (i.e. print_step = 100 would print information every 100 steps)
            (Optional: None)

    Returns:
        (list).
        trained (bool): If True, Model A and B are synced.
        n_iter (int): Number iterations it took to train Model A and B.
        progress (list): Consists of the matching percentage between Model A and B each iteration.
    """
    trained = False
    n_iter = 0
    progress = []
    while total_iter > 0 or not trained:
        progress.append(np.equal(model_a.get_key() == model_b.get_key(), True).sum() *
                        1. / np.prod(model_a.get_key().shape))

        if np.array_equal(model_a.weights, model_b.weights):
            trained = True
            break

        if print_step is not None and ((n_iter + 1) % print_step) == 0:
            print "Step:", n_iter + 1
            print "Percent Match (A & B):", progress[-1][0]
            print ""

        train_step(model_a, model_b)
        n_iter += 1
    return [trained, n_iter, progress]

def train(model_a, model_b, eve, total_iter=np.infty, print_step=None):
    """Runs through several training steps with model A and B, attempting to have a closer match.

    Args:
        model_a (PermutationParityMachine): Model used to sync weights with Model B.
        model_b (PermutationParityMachine): Model used to sync weights with Model A.
        eve (PermutationParityMachine): Model used to snoop on Models A and B.
        total_iter (int): The total number of training steps to run or until matching.
            Can be set to np.infty, which will run the training until Model A matches B.
            (Optional: np.infty)
        print_step (int): Prints training information every print_step. If None, won't print anything.
            (i.e. print_step = 100 would print information every 100 steps)
            (Optional: None)

    Returns:
        (list).
        trained (bool): If True, Model A and B are synced.
        n_iter (int): Number iterations it took to train Model A and B.
        progress (list): Consists of the matching percentage between Model A, B, and Eve each iteration.
    """
    trained = False
    n_iter = 0
    progress = []
    while total_iter > 0 or not trained:
        progress.append([np.equal(model_a.get_key(), model_b.get_key()).sum() *
                         1. / np.prod(model_a.get_key().shape),
                         np.equal(model_a.get_key(), eve.get_key()).sum() *
                         1. / np.prod(model_a.get_key().shape),
                         np.equal(model_b.get_key(), eve.get_key()).sum() *
                         1. / np.prod(model_a.get_key().shape)])

        if np.array_equal(model_a.weights, model_b.weights):
            trained = True
            break

        if print_step is not None and ((n_iter + 1) % print_step) == 0:
            print "Step:", n_iter + 1
            print "Percent Match (A & B):", progress[-1][0]
            print "Percent Match (A & Eve):", progress[-1][1]
            print "Percent Match (B & Eve):", progress[-1][2]
            print ""

        train_step(model_a, model_b, eve)
        n_iter += 1
    return [trained, n_iter, progress]

def hyperparams_same(model_a, model_b):
    """Confirms that two models have the same hyper-parameters for their models.

    Args:
        model_a (PermutationParityMachine): Compared with model_b.
        model_b (PermutationParityMachine): Compared with model_a.

    Returns:
        Boolean. True if the hyper-parameters are the same, False otherwise.
    """
    if model_a.get_hyper_params() == model_b.get_hyper_params():
        return True
    return False


text:
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Authors: Pasquale Imputato <p.imputato@gmail.com>
 *          Stefano Avallone <stefano.avallone@unina.it>
 */

#include "ns3/log.h"
#include "queue-limits.h"

namespace ns3 {

NS_LOG_COMPONENT_DEFINE ("QueueLimits");

NS_OBJECT_ENSURE_REGISTERED (QueueLimits);

TypeId
QueueLimits::GetTypeId (void)
{
  static TypeId tid = TypeId ("ns3::QueueLimits")
    .SetParent<Object> ()
    .SetGroupName ("Network")
  ;
  return tid;
}

QueueLimits::~QueueLimits ()
{
  NS_LOG_FUNCTION (this);
}

} // namespace ns3


text:
package client

import (
	"net/http"
	"regexp"
	"strings"

	"github.com/go-openapi/strfmt"
	"github.com/opentracing/opentracing-go"
	"github.com/opentracing/opentracing-go/ext"
	"github.com/opentracing/opentracing-go/log"

	"github.com/go-openapi/runtime"
)

type tracingTransport struct {
	transport runtime.ClientTransport
	host      string
	opts      []opentracing.StartSpanOption
}

func newOpenTracingTransport(transport runtime.ClientTransport, host string, opts []opentracing.StartSpanOption,
) runtime.ClientTransport {
	return &tracingTransport{
		transport: transport,
		host:      host,
		opts:      opts,
	}
}

func (t *tracingTransport) Submit(op *runtime.ClientOperation) (interface{}, error) {
	authInfo := op.AuthInfo
	reader := op.Reader

	var span opentracing.Span
	defer func() {
		if span != nil {
			span.Finish()
		}
	}()

	op.AuthInfo = runtime.ClientAuthInfoWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error {
		span = createClientSpan(op, req.GetHeaderParams(), t.host, t.opts)
		return authInfo.AuthenticateRequest(req, reg)
	})

	op.Reader = runtime.ClientResponseReaderFunc(func(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
		if span != nil {
			code := response.Code()
			ext.HTTPStatusCode.Set(span, uint16(code))
			if code >= 400 {
				ext.Error.Set(span, true)
			}
		}
		return reader.ReadResponse(response, consumer)
	})

	submit, err := t.transport.Submit(op)
	if err != nil && span != nil {
		ext.Error.Set(span, true)
		span.LogFields(log.Error(err))
	}
	return submit, err
}

func createClientSpan(op *runtime.ClientOperation, header http.Header, host string,
	opts []opentracing.StartSpanOption) opentracing.Span {
	ctx := op.Context
	span := opentracing.SpanFromContext(ctx)

	if span != nil {
		opts = append(opts, ext.SpanKindRPCClient)
		span, _ = opentracing.StartSpanFromContextWithTracer(
			ctx, span.Tracer(), toSnakeCase(op.ID), opts...)

		ext.Component.Set(span, "go-openapi")
		ext.PeerHostname.Set(span, host)
		span.SetTag("http.path", op.PathPattern)
		ext.HTTPMethod.Set(span, op.Method)

		_ = span.Tracer().Inject(
			span.Context(),
			opentracing.HTTPHeaders,
			opentracing.HTTPHeadersCarrier(header))

		return span
	}
	return nil
}

var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)")
var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])")

func toSnakeCase(str string) string {
	snake := matchFirstCap.ReplaceAllString(str, "${1}_${2}")
	snake = matchAllCap.ReplaceAllString(snake, "${1}_${2}")
	return strings.ToLower(snake)
}


text:
#ifndef __PluginParameters_Parameter_h__
#define __PluginParameters_Parameter_h__

#include <string>
#include <vector>

namespace teragon {

typedef std::string ParameterString;
typedef double ParameterValue;

static const unsigned int kDefaultDisplayPrecision = 2;

class Parameter;

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

#if PLUGINPARAMETERS_MULTITHREADED
    virtual bool isRealtimePriority() const = 0;
#endif

    /**
     * Method to be called when a parameter's value has been updated.
     */
    virtual void onParameterUpdated(const Parameter *parameter) = 0;
};

typedef std::vector<ParameterObserver *> ParameterObserverMap;

class Parameter {
public:
    /**
     * Create a new parameter with defaults for the minimum and maximum values.
     *
     * @param inName The parameter name
     */
    Parameter(const ParameterString &inName) :
    name(inName), unit(""), minValue(0.0), maxValue(1.0), defaultValue(0.0), value(0.0),
    precision(kDefaultDisplayPrecision), description("") {}

    /**
      * Create a new floating point parameter. This is probably the most common
      * parameter type used in a plugin.
      *
      * @param inName The parameter name
      * @param inMinValue The parameter's minimum value
      * @param inMaxValue The parameter's maximum value
      * @param inDefaultValue The parameter's initial default value
      *
      * Note that there is *no* checking done for the parameter ranges, so you
      * need to make sure that they are sane. If the range was otherwise invalid,
      * an exception would need to be thrown, and that would therefore impose the
      * requirement of exception handling on the plugin developer.
      *
      * Therefore this class has been intentionally kept rather minimal, and
      * operates under the assumption that you are not insane and choose sensible
      * values for the minimum, maximum, and default values.
      */
    Parameter(const ParameterString &inName,
              ParameterValue inMinValue,
              ParameterValue inMaxValue,
              ParameterValue inDefaultValue) :
    name(inName), unit(""), minValue(inMinValue), maxValue(inMaxValue), defaultValue(inDefaultValue),
    value(inDefaultValue), precision(kDefaultDisplayPrecision), description("") {}

    virtual ~Parameter() {}

    /**
     * @return The parameter's display name
     */
    const ParameterString &getName() const {
        return name;
    }

    /**
     * Get the parameter's name for serialization operations. All characters which
     * are not in the A-Z, a-z, 0-9 range are simply removed.
     *
     * @return A the parameter's name, safe for serialization operations
     */

    const ParameterString getSafeName() const {
        return makeSafeName(name);
    }

    /**
     * Get the serialized version of a string
     *
     * @param string The string to convert
     * @return A string safe for serialization operations
     */
    static const ParameterString makeSafeName(const ParameterString &string) {
        ParameterString result;
        for(size_t i = 0; i < string.length(); ++i) {
            if(((string[i] >= 'a' && string[i] <= 'z') ||
                (string[i] >= '0' && string[i] <= '9') ||
                (string[i] >= 'A' && string[i] <= 'Z'))) {
                result += string[i];
            }
        }
        return result;
    }

    /**
     * @return The display text for the parameter
     */
    virtual const ParameterString getDisplayText() const = 0;

    /**
     * @return The parameter's value, scaled in the range {0.0 - 1.0}
     */
    virtual const ParameterValue getScaledValue() const = 0;

    /**
     * Get the parameter's interval value, which will be between the minimum
     * and maximum values set in the constructor.
     */
    virtual const ParameterValue getValue() const {
        return value;
    }

#if PLUGINPARAMETERS_MULTITHREADED
    friend class Event;
    friend class ScaledEvent;

    // The multi-threaded version shouldn't allow parameters to have their value
    // be directly set in this manner. Instead, all parameter setting must be
    // done by the owning parameter set, as it can dispatch the operation on
    // the correct thread. Allowing this function to remain public might tempt
    // misuse when caching parameters to directly get/set their value, as this
    // would not notify all observers on both threads (not to mention other
    // potential concurrency problems).
protected:
#endif

    /**
     * Set the parameter's interval value directly.
     *
     * @param value Value, which must be between the minimum and maximum values
     */
    virtual void setValue(const ParameterValue inValue) {
        // TODO: Possible ABA problem here
        if(value != inValue) {
            value = inValue;
            notifyObservers();
        }
    }

    /**
     * Set the parameter's value, scaled in the range {0.0 - 1.0}
     *
     * @param value The parameter value, must be between {0.0 - 1.0}
     */
    virtual void setScaledValue(const ParameterValue value) = 0;

#if PLUGINPARAMETERS_MULTITHREADED
public:
#endif

    /**
     * @return Get the parameter's minimum value
     */
    virtual const ParameterValue getMinValue() const {
        return minValue;
    }

    /**
     * @return Get the parameter's maximum value
     */
    virtual const ParameterValue getMaxValue() const {
        return maxValue;
    }

    /**
     * @return Get the parameter's initial default value. Useful for resetting parameters.
     */
    virtual const ParameterValue getDefaultValue() const {
        return defaultValue;
    }

    /**
     * Get the number of decimal places for displaying floating-point parameter values.
     */
    virtual const unsigned int getDisplayPrecision() const {
        return precision;
    }

    /**
     * Number of floating point digits to be displayed, for parameters which support
     * display precision.
     *
     * @param inPrecision Number of decimal digits to display
     */
    virtual void setDisplayPrecision(unsigned int inPrecision) {
        this->precision = inPrecision;
    }

    /**
     * Get the unit string for the parameter. This is generally used by getDisplayText(),
     * and is by default an empty string.
     */
    virtual const ParameterString &getUnit() const {
        return unit;
    }

    /**
     * Set a display unit (such as "ms" for milliseconds) to be shown in the
     * parameter's getDisplayText() string.
     *
     * @param inUnit Unit string to display
     */
    virtual void setUnit(const ParameterString &inUnit) {
        this->unit = inUnit;
    }

    /**
     * Get the parameter description, which is a string that describes what the function of
     * the parameter is. This can be used to provide user-facing help for parameters.
     */
    const ParameterString &getDescription() const {
        return description;
    }

    /**
     * Set the parameter's description.
     *
     * @param description Parameter description
     */
    void setDescription(const ParameterString &inDescription) {
        this->description = inDescription;
    }

    /**
     * Add an observer to be alerted any time this parameter is set to a new value.
     *
     * @param observer Pointer to observing instance
     */
    virtual void addObserver(ParameterObserver *observer) {
        observers.push_back(observer);
    }

    /**
     * Get a given observer for the parameter.
     *
     * @param index Observer to get. If the index is invalid, NULL will be returned.
     * @return The ParameterObserver, or NULL if the index is out of range.
     */
    virtual ParameterObserver *getObserver(const size_t index) const {
        return index < observers.size() ? observers.at(index) : NULL;
    }

    /**
     * Get the total number of observers for the parameter. Useful for iterating over
     * the list of observers.
     */
    virtual const size_t getNumObservers() const {
        return observers.size();
    }

    /**
     * Remove an observer from the list of observers for this parameter. If you do not call
     * this method before your observer goes out of scope, future calls to this parameter's
     * setValue() method may result in segfaults.
     *
     * @param observer Instance to remove
     */
    virtual void removeObserver(ParameterObserver *observer) {
        ParameterObserverMap::iterator iterator = observers.begin();
        while(iterator != observers.end() && observers.size() > 0) {
            if(*iterator == observer) {
                iterator = observers.erase(iterator);
            }
            else {
                ++iterator;
            }
        }
    }

protected:
    /**
     * Notify all observers that a parameter has been updated. If PluginParameters
     * is built with PLUGINPARAMETERS_MULTITHREADED=1, this method has no effect, since it
     * will be called synchronously, and observer updates are instead executed
     * from the EventDispatcher in that case.
     */
    virtual void notifyObservers() const {
#if !PLUGINPARAMETERS_MULTITHREADED
        for(ParameterObserverMap::const_iterator iterator = observers.begin(); iterator != observers.end(); ++iterator) {
            (*iterator)->onParameterUpdated(this);
        }
#endif
    }

private:
    // Disallow assignment operator. It doesn't really make sense to try
    // to assign one parameter to another, and if this is allowed then we
    // must drop the const several fields.
    Parameter &operator = (const Parameter &) {
        return *this;
    }

private:
    const ParameterString name;
    ParameterString unit;
    const ParameterValue minValue;
    const ParameterValue maxValue;
    const ParameterValue defaultValue;
    ParameterValue value;
    unsigned int precision;
    ParameterString description;

    ParameterObserverMap observers;
};

} // namespace teragon

#endif // __PluginParameters_Parameter_h__


text:
package osgi.executor.provider;

import aQute.bnd.annotation.metatype.Meta.AD;
import aQute.bnd.annotation.metatype.Meta.OCD;

@OCD(description = "Configuration for the enRoute::Executor")
public interface Configuration {
	@AD(description = "The minimum number of threads allocated to this pool", deflt = "20", required=false)
	int coreSize();

	@AD(description = "Maximum number of threads allocated to this pool", deflt = "0", required=false)
	int maximumPoolSize();

	@AD(description = "Nr of seconds an idle free thread should survive before being destroyed", deflt = "60", required=false)
	long keepAliveTime();

	@AD(description= "Ranking", deflt="-1000", required=false)
	long ranking();
}


text:
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="stylesheet" href="/ui/extras/chrome/cc/layer_view.css">

<link rel="import" href="/base/raf.html">
<link rel="import" href="/base/settings.html">
<link rel="import" href="/extras/chrome/cc/constants.html">
<link rel="import" href="/extras/chrome/cc/picture.html">
<link rel="import" href="/model/event_set.html">
<link rel="import" href="/ui/base/drag_handle.html">
<link rel="import" href="/ui/extras/chrome/cc/layer_tree_quad_stack_view.html">

<script>
'use strict';

/**
 * @fileoverview LayerView coordinates graphical and analysis views of layers.
 */

tr.exportTo('tr.ui.e.chrome.cc', function() {
  var constants = tr.e.cc.constants;

  /**
   * @constructor
   */
  var LayerView = tr.ui.b.define('tr-ui-e-chrome-cc-layer-view');

  LayerView.prototype = {
    __proto__: HTMLUnknownElement.prototype,

    decorate: function() {
      this.layerTreeQuadStackView_ =
          new tr.ui.e.chrome.cc.LayerTreeQuadStackView();
      this.dragBar_ = new tr.ui.b.DragHandle();
      this.analysisEl_ =
          document.createElement('tr-ui-e-chrome-cc-layer-view-analysis');
      this.analysisEl_.addEventListener('requestSelectionChange',
          this.onRequestSelectionChangeFromAnalysisEl_.bind(this));

      this.dragBar_.target = this.analysisEl_;

      this.appendChild(this.layerTreeQuadStackView_);
      this.appendChild(this.dragBar_);
      this.appendChild(this.analysisEl_);

      this.layerTreeQuadStackView_.addEventListener('selection-change',
          function() {
            this.layerTreeQuadStackViewSelectionChanged_();
          }.bind(this));
      this.layerTreeQuadStackViewSelectionChanged_();
    },

    get layerTreeImpl() {
      return this.layerTreeQuadStackView_.layerTreeImpl;
    },

    set layerTreeImpl(newValue) {
      return this.layerTreeQuadStackView_.layerTreeImpl = newValue;
    },

    set isRenderPassQuads(newValue) {
      return this.layerTreeQuadStackView_.isRenderPassQuads = newValue;
    },

    get selection() {
      return this.layerTreeQuadStackView_.selection;
    },

    set selection(newValue) {
      this.layerTreeQuadStackView_.selection = newValue;
    },

    regenerateContent: function() {
      this.layerTreeQuadStackView_.regenerateContent();
    },

    layerTreeQuadStackViewSelectionChanged_: function() {
      var selection = this.layerTreeQuadStackView_.selection;
      if (selection) {
        this.dragBar_.style.display = '';
        this.analysisEl_.style.display = '';
        this.analysisEl_.textContent = '';

        var layer = selection.layer;
        if (layer && layer.args && layer.args.pictures) {
          this.analysisEl_.appendChild(
              this.createPictureBtn_(layer.args.pictures));
        }

        var analysis = selection.createAnalysis();
        this.analysisEl_.appendChild(analysis);
      } else {
        this.dragBar_.style.display = 'none';
        this.analysisEl_.style.display = 'none';
        var analysis = this.analysisEl_.firstChild;
        if (analysis)
          this.analysisEl_.removeChild(analysis);
        this.layerTreeQuadStackView_.style.height =
            window.getComputedStyle(this).height;
      }
      tr.b.dispatchSimpleEvent(this, 'selection-change');
    },

    createPictureBtn_: function(pictures) {
      if (!(pictures instanceof Array))
        pictures = [pictures];

      var link = document.createElement('tr-ui-a-analysis-link');
      link.selection = function() {
        var layeredPicture = new tr.e.cc.LayeredPicture(pictures);
        var snapshot = new tr.e.cc.PictureSnapshot(layeredPicture);
        snapshot.picture = layeredPicture;

        var selection = new tr.model.EventSet();
        selection.push(snapshot);
        return selection;
      };
      link.textContent = 'View in Picture Debugger';
      return link;
    },

    onRequestSelectionChangeFromAnalysisEl_: function(e) {
      if (!(e.selection instanceof tr.ui.e.chrome.cc.Selection))
        return;

      e.stopPropagation();
      this.selection = e.selection;
    },

    get extraHighlightsByLayerId() {
      return this.layerTreeQuadStackView_.extraHighlightsByLayerId;
    },

    set extraHighlightsByLayerId(extraHighlightsByLayerId) {
      this.layerTreeQuadStackView_.extraHighlightsByLayerId =
          extraHighlightsByLayerId;
    }
  };

  return {
    LayerView: LayerView
  };
});
</script>


text:
package org.springframework.security.oauth2.core.oidc;

import java.time.Instant;

/**
 * Test {@link OidcIdToken}s
 *
 * @author Josh Cummings
 */
public final class TestOidcIdTokens {

	private TestOidcIdTokens() {
	}

	public static OidcIdToken.Builder idToken() {
		// @formatter:off
		return OidcIdToken.withTokenValue("id-token")
				.issuer("https://example.com")
				.subject("subject")
				.issuedAt(Instant.now())
				.expiresAt(Instant.now()
				.plusSeconds(86400))
				.claim("id", "id");
		// @formatter:on
	}

}


text:
FROM debian:wheezy

MAINTAINER Björn A. Grüning, bjoern.gruening@gmail.com

# make sure the package repository is up to date
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update

# Set Apache User and Group
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2

# Install all requirements that are recommend by the Galaxy project
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y autoconf
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y automake
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y build-essential
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y gfortran
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y cmake
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y git-core
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y libatlas-base-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y libblas-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y liblapack-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y mercurial
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y subversion
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y pkg-config
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y openjdk-7-jre
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python-setuptools

# Used to get Galaxy running in Docker with Apache2 and PostgreSQL
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y postgresql
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y apache2
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y libapache2-mod-xsendfile
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y sudo

# samtools is used to handle BAM files inside of Galaxy
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y samtools

# Load required Apache Modules
RUN a2enmod xsendfile
RUN a2enmod proxy
RUN a2enmod proxy_balancer
RUN a2enmod proxy_http
RUN a2enmod rewrite

# Download and update Galaxy to the latest stable release
RUN hg clone https://bitbucket.org/galaxy/galaxy-central/
WORKDIR /galaxy-central
RUN hg pull
RUN hg update stable

# Configure Galaxy to use the Tool Shed
RUN cp ~/galaxy-central/universe_wsgi.ini.sample ~/galaxy-central/universe_wsgi.ini
RUN mkdir ~/shed_tools
RUN mkdir ~/galaxy-central/tool_deps

RUN sed -i 's|#database_connection.*|database_connection = postgres://galaxy:galaxy@localhost:5432/galaxy|g' ~/galaxy-central/universe_wsgi.ini
RUN sed -i 's|#tool_dependency_dir = None|tool_dependency_dir = ./tool_deps|g' ~/galaxy-central/universe_wsgi.ini
RUN sed -i 's|#tool_config_file|tool_config_file|g' ~/galaxy-central/universe_wsgi.ini
RUN sed -i 's|#tool_path|tool_path|g' ~/galaxy-central/universe_wsgi.ini
RUN sed -i 's|#admin_users = None|admin_users = admin@galaxy.org|g' ~/galaxy-central/universe_wsgi.ini
RUN sed -i 's|#master_api_key=changethis|master_api_key=HSNiugRFvgT574F43jZ7N9F3|g' ~/galaxy-central/universe_wsgi.ini
# Render SVG images properly
RUN sed -i 's|#serve_xss_vulnerable_mimetypes.*|serve_xss_vulnerable_mimetypes = True|g' ~/galaxy-central/universe_wsgi.ini
RUN sed -i 's|#brand = None|brand = Galaxy Docker Build|g' ~/galaxy-central/universe_wsgi.ini

# Fetching all Galaxy python dependencies
RUN python scripts/fetch_eggs.py

# Define the default postgresql database path
# If you want to save your data locally you need to set GALAXY_DOCKER_MODE=HOST
ENV PG_DATA_DIR_DEFAULT /var/lib/postgresql/9.1/main/

# Include all needed scripts from the host
ADD ./setup_postgresql.py /galaxy-central/setup_postgresql.py
ADD ./create_galaxy_user.py /galaxy-central/create_galaxy_user.py
ADD ./export_user_files.py /galaxy-central/export_user_files.py
ADD ./ctb.apache /tmp/ctb.apache
ADD ./startup.sh /usr/bin/startup

RUN chmod +x /usr/bin/startup
RUN cp /tmp/ctb.apache /etc/apache2/sites-available/

RUN a2ensite ctb.apache
RUN service apache2 restart
RUN service postgresql stop

# Configure PostgreSQL
# 1. Remove all old configuration
# 2. Create DB-user 'galaxy' with password 'galaxy' in database 'galaxy'
# 3. Create Galaxy Admin User 'admin@galaxy.org' with password 'admin' and API key 'admin'
RUN service postgresql stop
RUN rm $PG_DATA_DIR_DEFAULT -rf
RUN python setup_postgresql.py --dbuser galaxy --dbpassword galaxy --db-name galaxy --dbpath $PG_DATA_DIR_DEFAULT
RUN service postgresql start && sh create_db.sh
RUN service postgresql start && sleep 5 && python create_galaxy_user.py --user admin@galaxy.org --password admin --key admin
RUN service postgresql start && sh run.sh --daemon && sleep 120

# Mark one folders as imported from the host.
VOLUME ["/export/"]

# Expose port 80 to the host
EXPOSE :80

# Autostart script that is invoked during container start
CMD ["/usr/bin/startup"]
RUN rm ./.hg/ -rf
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


text:
IMPLEMENT_DYNCREATE(ResourcerList, CListView)

ResourcerList::ResourcerList()
{
}

ResourcerList::~ResourcerList()
{
}

BEGIN_MESSAGE_MAP(ResourcerList, CListView)
	//{{AFX_MSG_MAP(ResourcerList)
	ON_COMMAND(ID_PORTS_DELETE, OnPortsDelete)
	ON_COMMAND(ID_EDIT_RENAME, OnEditRename)
	ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT, OnEndlabeledit)
	ON_COMMAND(ID_VIEW_REFRESH, OnViewRefresh)
	ON_COMMAND(ID_PORTS_PROPERTIES, OnPortsProperties)
	ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
	ON_WM_CONTEXTMENU()
	ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
	ON_COMMAND(ID_EDIT_CUT, OnEditCut)
	ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
	ON_UPDATE_COMMAND_UI(ID_EDIT_CUT, OnUpdateEditCut)
	ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy)
	ON_COMMAND(ID_PORTS_SHELLOPEN, OnPortsShellopen)
	ON_UPDATE_COMMAND_UI(ID_PORTS_DELETE, OnUpdatePortsDelete)
	ON_UPDATE_COMMAND_UI(ID_PORTS_PROPERTIES, OnUpdatePortsProperties)
	ON_UPDATE_COMMAND_UI(ID_PORTS_SHELLOPEN, OnUpdatePortsShellopen)
	ON_WM_DROPFILES()
	ON_COMMAND(ID_DOCUMENT_BUILDSELECTED, OnDocumentBuildselected)
	ON_UPDATE_COMMAND_UI(ID_DOCUMENT_BUILDSELECTED, OnUpdateDocumentBuildselected)
	ON_COMMAND(ID_PORTS_DEPENDENCIES, OnPortsDependencies)
	ON_UPDATE_COMMAND_UI(ID_PORTS_DEPENDENCIES, OnUpdatePortsDependencies)
	ON_COMMAND(ID_PORTS_TOUCH, OnPortsTouch)
	ON_COMMAND(ID_PORTS_UPGRADE, OnPortsUpgrade)
	ON_UPDATE_COMMAND_UI(ID_PORTS_UPGRADE, OnUpdatePortsUpgrade)
	//}}AFX_MSG_MAP
	ON_COMMAND(ID_FILE_IMPORT, OnFileImport)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ResourcerList drawing

void ResourcerList::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// ResourcerList diagnostics

#ifdef _DEBUG
void ResourcerList::AssertValid() const
{
	CListView::AssertValid();
}

void ResourcerList::Dump(CDumpContext& dc) const
{
	CListView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// ResourcerList message handlers

void ResourcerList::OnPortsProperties()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
		{
			CharString sFileName = CharString( pDoc->currentDirectory() ) + GetListCtrl().GetItemText(i,0);

			// open up ports using this program, other file types send to windows
			if ( stricmp<char>( Path( sFileName ).extension(), ".PRT" ) == 0 )
				AfxGetApp()->OpenDocumentFile( sFileName );
			else
				ShellExecute( NULL, "open", sFileName, NULL, pDoc->currentDirectory(), SW_SHOWNORMAL );

		}

	OnUpdate(this,0,NULL);
}

void ResourcerList::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
{
	if (GetAsyncKeyState(VK_SHIFT) < 0)
		OnPortsShellopen();
	else
		OnPortsProperties();

	*pResult = 0;
}

void ResourcerList::OnPortsDelete()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	if (MessageBox("Are you sure you want to delete all selected ports?","Delete Port", MB_YESNO) == IDYES)
	{
		for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
			if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
			{
				CharString sFile = pDoc->currentDirectory();
				sFile += GetListCtrl().GetItemText(i,0);
				sFile.lower();

				if ( FileDisk::deleteFile( sFile ) )
					pDoc->pushMessage( CharString().format("%s deleted...", sFile) );
				else
					pDoc->pushMessage( CharString().format("Failed to delete %s...", sFile) );
			}

		OnUpdate(NULL,0,NULL);
	}
}

//-------------------------------------------------------------------------------

BOOL ResourcerList::PreCreateWindow(CREATESTRUCT& cs)
{
	//m_dwDefaultStyle |= LVS_SHOWSELALWAYS|LVS_SHAREIMAGELISTS|LVS_EDITLABELS|LVS_REPORT;
	return CListView::PreCreateWindow(cs);
}

void ResourcerList::OnInitialUpdate()
{
	CListView::OnInitialUpdate();

	m_ListIcons.Create( 16,16,ILC_COLOR32 | ILC_MASK,0,0);
	for(int i=0;i<Port::portCount();i++)
		m_ListIcons.Add( Port::portIcon( i ));

	int index = m_ListIcons.Add( AfxGetApp()->LoadIcon(IDI_LOCKED) );
	m_ListIcons.SetOverlayImage(index, 1);
	index = m_ListIcons.Add( AfxGetApp()->LoadIcon(IDI_UPDATE) );
	m_ListIcons.SetOverlayImage(index, 2 );
	index = m_ListIcons.Add( AfxGetApp()->LoadIcon(IDI_LOCKEDUPDATE) );
	m_ListIcons.SetOverlayImage(index, 3 );

	GetListCtrl().SetImageList( &m_ListIcons, LVSIL_SMALL );
	GetListCtrl().ModifyStyle( LVS_ICON|LVS_SMALLICON|LVS_LIST,
		LVS_SHOWSELALWAYS|LVS_SHAREIMAGELISTS|LVS_EDITLABELS|LVS_REPORT|LVS_SORTASCENDING);
	//GetListCtrl().ModifyStyleEx( 0, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES  );

	// setup the report columns
	RECT rect;
	GetListCtrl().GetWindowRect(&rect);

	int	cwidth = (rect.right - rect.left) / 5;
	GetListCtrl().InsertColumn(0,"Name",LVCFMT_LEFT,cwidth);
	GetListCtrl().InsertColumn(1,"Type",LVCFMT_LEFT,cwidth);
	GetListCtrl().InsertColumn(2,"Date",LVCFMT_LEFT,cwidth);
	GetListCtrl().InsertColumn(3,"Size",LVCFMT_LEFT,cwidth);
	GetListCtrl().InsertColumn(4,"Widget Size",LVCFMT_LEFT,cwidth);

	DragAcceptFiles();
}

void ResourcerList::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	// release all items from the list control
	GetListCtrl().DeleteAllItems();

	// search the current directory
	CString searchPath( CString(pDoc->currentDirectory()) + "*.*" );

	// add the directories to the parent
	WIN32_FIND_DATA	ff;
	HANDLE ffh = FindFirstFile( searchPath , &ff);
	if (ffh == INVALID_HANDLE_VALUE)
		return;

	BOOL found = true;
	while(found)
	{
		if ( (ff.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN)) == 0 )
		{
			CharString	sFileName = CharString( pDoc->currentDirectory() ) + ff.cFileName;

			int		nImage = -1;
			dword	nState = 0;
			CharString	sFileType = Path( ff.cFileName ).extension();
			dword	nFileDate = FileDisk::fileDate( sFileName );
			dword	nFileSize = FileDisk::fileSize( sFileName );
			dword	nWidgetSize = 0;

			Port::PortInfo info;
			if ( Port::portInfo( sFileName, info ) )
			{
				nImage = info.type;
				sFileType = Port::portName( info.type );
				nFileDate = info.version;
				nState = info.locked ? INDEXTOOVERLAYMASK(1) : 0;
				nWidgetSize = pDoc->m_Broker.size( info.widgetKey );

				// get broker information
				if ( nWidgetSize == 0 || pDoc->m_Broker.version( info.widgetKey ) < info.version )
				{
					if ( nState )
						nState = INDEXTOOVERLAYMASK(3);
					else
						nState = INDEXTOOVERLAYMASK(2);
				}
			}

			// add list item
			int nItem = GetListCtrl().InsertItem( 0, ff.cFileName , nImage );
			// set the port state, locked or unlocked
			GetListCtrl().SetItemState( nItem, nState, LVIS_OVERLAYMASK );
			// set the type
			GetListCtrl().SetItemText( nItem, 1, sFileType );
			// set the version
			GetListCtrl().SetItemText( nItem, 2, CTime( nFileDate ).Format("%m/%d/%y %I:%M:%S %p") );
			// set the size
			CString sSize;
			sSize.Format("%.1f k", float(nFileSize) / 1024.0f );
			GetListCtrl().SetItemText( nItem, 3, sSize );

			sSize.Format("%.1f k", float(nWidgetSize) / 1024.0f );
			GetListCtrl().SetItemText( nItem, 4, sSize );
		}

		found = FindNextFile(ffh,&ff);
	}
	FindClose(ffh);
}

void ResourcerList::OnEditRename()
{
	GetListCtrl().EditLabel( GetListCtrl().GetNextItem( -1, LVNI_FOCUSED) );
}

void ResourcerList::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
	LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;

	if ( pDispInfo->item.pszText != NULL)
	{
		CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
		ASSERT( pDoc );

		CString newName( pDispInfo->item.pszText );
		CString oldName( GetListCtrl().GetItemText( pDispInfo->item.iItem, 0 ) );

		if (! ::MoveFile( pDoc->currentDirectory() + oldName, pDoc->currentDirectory() + newName ) )
		{
			MessageBox("Failed to rename port", oldName );
			return;
		}

		GetListCtrl().SetItemText( pDispInfo->item.iItem, 0, newName );
	}

	*pResult = 0;
}

void ResourcerList::OnViewRefresh()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	OnUpdate(NULL,0,NULL);
}

//-------------------------------------------------------------------------------

void ResourcerList::OnContextMenu(CWnd* pWnd, CPoint point)
{
	CMenu		ctmenu;		// context menu

	ctmenu.CreatePopupMenu();
	ctmenu.AppendMenu(MF_STRING,ID_EDIT_COPY,"Copy");
	ctmenu.AppendMenu(MF_STRING,ID_EDIT_CUT,"Cut");
	ctmenu.AppendMenu(MF_STRING,ID_EDIT_PASTE,"Paste");
	ctmenu.AppendMenu(MF_SEPARATOR);
	ctmenu.AppendMenu(MF_STRING,ID_PORTS_PROPERTIES,"Open");
	ctmenu.AppendMenu(MF_STRING,ID_PORTS_UPGRADE,"Upgrade");
	ctmenu.AppendMenu(MF_STRING,ID_PORTS_SHELLOPEN,"Shell Open");
	ctmenu.AppendMenu(MF_STRING,ID_PORTS_DELETE,"Delete");
	ctmenu.AppendMenu(MF_SEPARATOR);
	ctmenu.AppendMenu(MF_STRING,ID_PORTS_DEPENDENCIES,"Dependencies");
	ctmenu.AppendMenu(MF_SEPARATOR);
	ctmenu.AppendMenu(MF_STRING,ID_DOCUMENT_BUILDSELECTED,"Build");
	ctmenu.AppendMenu(MF_STRING,ID_PORTS_TOUCH,"Touch");

	// track the context menu
	ctmenu.TrackPopupMenu(TPM_LEFTALIGN,point.x,point.y,GetParent());
	ctmenu.DestroyMenu();
}

const unsigned int	RESOURCER_CLIP_ID = 'RSRC';

void ResourcerList::OnEditCopy()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	//OnUpdate(this,0,NULL);

	// serialize all selected ports into a FileMemory object, then store the data on the clipboard
	FileMemory::Ref pFile = new FileMemory();

	OutStream output( pFile );
	output << RESOURCER_CLIP_ID;
	output << GetListCtrl().GetSelectedCount();

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
		{
			CString portName( GetListCtrl().GetItemText(i,0) );
			CString fileName( pDoc->currentDirectory() + portName );

			Port::Ref port = Port::portLoad( fileName, false );

			if ( port.valid() )
			{
				// create a copy of this port, so all new keys get generated for any internal widgets
				Port::Ref portCopy = (Port *)port->copy();
				if (! portCopy.valid() )
					return;

				// save the port copy
				output << CharString( portName );
				output << portCopy.pointer();
			}
		}

	HGLOBAL pasteGlobal = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, pFile->size() );
	memcpy(GlobalLock(pasteGlobal), pFile->bytes(), pFile->size() );
	GlobalUnlock(pasteGlobal);

	if (OpenClipboard())
	{
		SetClipboardData( CF_PRIVATEFIRST, pasteGlobal );
		CloseClipboard();
	}
}

void ResourcerList::OnUpdateEditCopy(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnEditCut()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	// copy the ports before deleting them
	OnEditCopy();

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
		{
			CString sFile( pDoc->currentDirectory() + GetListCtrl().GetItemText(i,0) );

			// remove actual file
			if ( FileDisk::deleteFile( sFile ) )
				pDoc->pushMessage( CharString().format("%s cut...", sFile) );
			else
				pDoc->pushMessage( CharString().format("Failed to cut %s...", sFile) );
		}

	OnUpdate(NULL,0,NULL);
}

void ResourcerList::OnUpdateEditCut(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnEditPaste()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	if (!OpenClipboard())
		return;

	HGLOBAL hPaste = GetClipboardData( CF_PRIVATEFIRST );
	if ( hPaste == NULL )
	{
		// no data, close the clipboard and exit..
		CloseClipboard();
		return;
	}

	try {
		FileMemory::Ref pFile = new FileMemory( GlobalLock( hPaste ), GlobalSize( hPaste ), true );
		GlobalUnlock( hPaste );
		CloseClipboard();

		InStream input( pFile );
		unsigned int validateId;
		input >> validateId;

		if ( validateId != RESOURCER_CLIP_ID )
			return;			// invalid clipboard data, return...

		int count;
		input >> count;

		for(int i=0;i<count;i++)
		{
			// get the port name
			CharString portName;
			input >> portName;
			// get the object
			Port::Ref port;
			input >> port;

			// generate a unique file name
			CharString sFileName( (CharString)pDoc->currentDirectory() + portName );

			int fileIndex = 1;
			while( GetFileAttributes( sFileName ) != 0xffffffff )
			{
				sFileName = (CharString)pDoc->currentDirectory() + Path( portName ).name() +
					CharString().format("%d", fileIndex++) + Path( portName ).extension();
			}

			try {
				OutStream( new FileDisk( sFileName,
					FileDisk::READ_WRITE) ) << port;
			}
			catch( File::FileError )
			{
				MessageBox(_T("Failed to write port to disk!"), sFileName );
				break;
			}
		}

		OnUpdate( NULL, 0, NULL );
	}
	catch( File::FileError )
	{
		MessageBox( _T("Error reading clipboard data!") );
	}

}

void ResourcerList::OnPortsShellopen()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
		{
			CharString sFileName = CharString( pDoc->currentDirectory() ) + GetListCtrl().GetItemText(i,0);
			if ( stricmp<char>( Path( sFileName ).extension(), ".PRT" ) == 0 )
			{
				Port::Ref pPort = Port::portLoad( sFileName, false );
				if ( pPort.valid() )
					pPort->shellOpen();
			}
			else
			{
				ShellExecute( NULL, "open", sFileName, NULL, pDoc->currentDirectory(), SW_SHOWNORMAL );
			}
		}
}

void ResourcerList::OnPortsTouch()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
			pDoc->touchPorts( pDoc->currentDirectory() + GetListCtrl().GetItemText(i,0), false );
}

void ResourcerList::OnPortsUpgrade()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
	{
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
			pDoc->upgradePorts( pDoc->currentDirectory() + GetListCtrl().GetItemText(i,0), false );
	}
}

void ResourcerList::OnUpdatePortsUpgrade(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnUpdatePortsDelete(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnUpdatePortsProperties(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnUpdatePortsShellopen(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnPortsDependencies()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	Array< CharString > dep;
	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
		{
			CString port( CString(pDoc->currentDirectory()) + GetListCtrl().GetItemText(i,0) );
			dep.push( CharString( port ) );
		}

	// show dependencies
	CPortDepend( dep ).DoModal();
}

void ResourcerList::OnUpdatePortsDependencies(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

void ResourcerList::OnDropFiles(HDROP hDropInfo)
{
	int count = DragQueryFile(hDropInfo,-1,NULL,0);

	CWaitCursor	wait;		// show wait cursor
	for(int f = 0; f < count; f++)
	{
		char charPath[MAX_PATH];
		DragQueryFile(hDropInfo,f,charPath,MAX_PATH);

		ImportFile( charPath );
	}

	OnUpdate(NULL,0,NULL);
}

void ResourcerList::OnFileImport()
{
    CFileDialog dialog(TRUE, NULL, NULL,
		OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT,
		_T("All Files|*.*||"));

	TCHAR fileBuffer[ 16 * 1024 + 1];
	fileBuffer[0] = 0;

	dialog.m_ofn.lpstrFile = fileBuffer;
	dialog.m_ofn.nMaxFile = 16 * 1024;

	if (dialog.DoModal() == IDOK)
	{
		POSITION pos = dialog.GetStartPosition();
		while( pos != NULL )
		{
			ImportFile( dialog.GetNextPathName( pos ) );
		}
    }

	OnUpdate(NULL,0,NULL);
}

bool ResourcerList::ImportFile( const char * a_pFile )
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	Path path( a_pFile );

	int portIndex = Port::findImportExt( path.extension() );
	if ( portIndex >= 0 )
	{
		Factory * pFactory = Port::portFactory( portIndex );
		ASSERT( pFactory );

		// create the object and store the it to disk
		Port::Ref pPort = dynamic_cast<Port *>( pFactory->createWidget() );
		// get the port name
		CharString sPortName( (CharString)pDoc->currentDirectory() + path.name() + ".prt" );
		pPort->SetPathName( sPortName, false );

		// update the port
		if ( ! pPort->importFile( a_pFile ) )
		{
			MessageBox(_T("Failed to import file!"), a_pFile );
			return false;
		}

		// save the port to disk
		try {
			OutStream( new FileDisk( sPortName, FileDisk::WRITE ) ) << pPort;
		}
		catch(...)
		{
			MessageBox(_T("Failed to save port!"), sPortName );
			return false;
		}
	}

	return true;
}

void ResourcerList::OnDocumentBuildselected()
{
	CResourcerDoc *pDoc = dynamic_cast<CResourcerDoc *>(GetDocument());
	ASSERT( pDoc );

	pDoc->beginBuild();

	CWaitCursor	wait;

	for(int i=0;i<GetListCtrl().GetItemCount(); i++ )
		if (GetListCtrl().GetItemState(i,LVIS_SELECTED))
			pDoc->updateBroker( pDoc->currentDirectory() + GetListCtrl().GetItemText(i,0) );

	pDoc->endBuild();
}

void ResourcerList::OnUpdateDocumentBuildselected(CCmdUI* pCmdUI)
{
	pCmdUI->Enable( GetListCtrl().GetSelectedCount() > 0 ? TRUE : FALSE );
}

//----------------------------------------------------------------------------
// EOF


text:
read -p "Press [Enter] to uninstall then install hypatia_engine..."
# uninstall
py -2 -m pip uninstall hypatia_engine -y
py -3 -m pip uninstall hypatia_engine -y
# install
py -2 -m pip install --user --no-cache-dir .
py -3 -m pip install --user --no-cache-dir .

# RUN THE DEMO
cd demo

read -p "Press [Enter] to test game.py in Python 2..."
py -2 game.py

read -p "Press [Enter] to test game.py in Python 3..."
py -3 game.py

cd ..


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using beRemote.Core.ProtocolSystem.ProtocolBase.Types;
using beRemote.Core.ProtocolSystem.ProtocolBase.Interfaces;
using beRemote.Core.ProtocolSystem.ProtocolBase;
using System.ComponentModel.Composition;

namespace beRemote.VendorProtocols.HyperVManager
{
    [ProtocolMetadata(
        PluginName = "HyperV Manager",
        PluginFullQualifiedName = "beRemote.VendorProtocols.HyperVManager.HyperVManagerProtocol",
        PluginConfigFolder = "beRemote.VendorProtocols.HyperVManager",
        PluginIniFile = "plugin.ini",
        PluginVersionCode = 1,
        ProtocolAuthIsHandled=true)]
    [Export(typeof(Protocol))]
    public class HyperVManagerProtocol : Protocol
    {
        public override ServerType[] GetPrtocolCompatibleServers()
        {
            return new ServerType[] { ServerType.LINUX, ServerType.MACOS, ServerType.WINDOWS };
        }

        public override Session NewSession(IServer server, long dbConfigId)
        {
            return new HyperVManagerSession(server, this, dbConfigId);
        }
    }
}


text:
package psidev.psi.mi.jami.xml.model.extension.xml254;

import psidev.psi.mi.jami.model.CvTerm;
import psidev.psi.mi.jami.model.Organism;
import psidev.psi.mi.jami.model.Xref;
import psidev.psi.mi.jami.xml.model.extension.AbstractXmlComplex;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * Xml implementation of ModelledInteraction
 *
 * @author Marine Dumousseau (marine@ebi.ac.uk)
 * @version $Id$
 * @since
08/10/13

 */
@XmlRootElement(name = "interaction", namespace = "http://psi.hupo.org/mi/mif")
@XmlAccessorType(XmlAccessType.NONE)
public class XmlComplex extends AbstractXmlComplex {

    /**
     *
Constructor for XmlComplex.

     */
    public XmlComplex() {
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     */
    public XmlComplex(String name, CvTerm type) {
        super(name, type);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     */
    public XmlComplex(String name, String fullName, CvTerm type) {
        super(name, fullName, type);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, String fullName, Organism organism, Xref uniqueId) {
        super(name, fullName, organism, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, Organism organism, Xref uniqueId) {
        super(name, organism, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, String fullName, Xref uniqueId) {
        super(name, fullName, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, Xref uniqueId) {
        super(name, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     */
    public XmlComplex(String name, String fullName, Organism organism) {
        super(name, fullName, organism);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     */
    public XmlComplex(String name, Organism organism) {
        super(name, organism);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     */
    public XmlComplex(String name, String fullName) {
        super(name, fullName);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     */
    public XmlComplex(String name) {
        super(name);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, String fullName, CvTerm type, Organism organism, Xref uniqueId) {
        super(name, fullName, type, organism, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, CvTerm type, Organism organism, Xref uniqueId) {
        super(name, type, organism, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, String fullName, CvTerm type, Xref uniqueId) {
        super(name, fullName, type, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     * @param uniqueId a {@link psidev.psi.mi.jami.model.Xref} object.
     */
    public XmlComplex(String name, CvTerm type, Xref uniqueId) {
        super(name, type, uniqueId);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param fullName a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     */
    public XmlComplex(String name, String fullName, CvTerm type, Organism organism) {
        super(name, fullName, type, organism);
    }

    /**
     *
Constructor for XmlComplex.

     *
     * @param name a {@link java.lang.String} object.
     * @param type a {@link psidev.psi.mi.jami.model.CvTerm} object.
     * @param organism a {@link psidev.psi.mi.jami.model.Organism} object.
     */
    public XmlComplex(String name, CvTerm type, Organism organism) {
        super(name, type, organism);
    }
}


text:
from datetime import datetime

from .base import BasePackager
from .constants import RENDERERS
from .utils import instantiate_classpath

class Renderer(BasePackager):
    def __init__(self, settings):
        super(Renderer, self).__init__(settings)
        syntax_adapter = RENDERERS[self.settings['template']['syntax']]
        self.template_engine = instantiate_classpath(syntax_adapter)

    def render(self, content, context):
        return self.template_engine.render(content, self.get_context_data(**context))

    def get_context_data(self, **kwargs):
        kwargs.update({
            'year': datetime.now().year
        })
        return kwargs


text:
package org.apache.bcel.classfile;

import java.io.DataInput;
import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.bcel.Const;

import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.framework.qual.AnnotatedFor;

/**
 * This class represents the table of exceptions that are thrown by a
 * method. This attribute may be used once per method.  The name of
 * this class is ExceptionTable for historical reasons; The
 * Java Virtual Machine Specification, Second Edition defines this
 * attribute using the name Exceptions (which is inconsistent
 * with the other classes).
 *
 * @see     Code
 */
@AnnotatedFor({"signedness"})
public final class ExceptionTable extends Attribute {

    private int[] exceptionIndexTable; // constant pool

    /**
     * Initialize from another object. Note that both objects use the same
     * references (shallow copy). Use copy() for a physical copy.
     */
    public ExceptionTable(final ExceptionTable c) {
        this(c.getNameIndex(), c.getLength(), c.getExceptionIndexTable(), c.getConstantPool());
    }

    /**
     * @param name_index Index in constant pool
     * @param length Content length in bytes
     * @param exceptionIndexTable Table of indices in constant pool
     * @param constant_pool Array of constants
     */
    public ExceptionTable(final @NonNegative int name_index, final @NonNegative int length, final int[] exceptionIndexTable,
            final ConstantPool constant_pool) {
        super(Const.ATTR_EXCEPTIONS, name_index, length, constant_pool);
        this.exceptionIndexTable = exceptionIndexTable != null ? exceptionIndexTable : new int[0];
    }

    /**
     * Construct object from input stream.
     * @param nameIndex Index in constant pool
     * @param length Content length in bytes
     * @param input Input stream
     * @param constantPool Array of constants
     * @throws IOException
     */
    ExceptionTable(final @NonNegative int nameIndex, final @NonNegative int length, final DataInput input, final ConstantPool constantPool) throws IOException {
        this(nameIndex, length, (int[]) null, constantPool);
        final int number_of_exceptions = input.readUnsignedShort();
        exceptionIndexTable = new int[number_of_exceptions];
        for (int i = 0; i < number_of_exceptions; i++) {
            exceptionIndexTable[i] = input.readUnsignedShort();
        }
    }

    /**
     * Called by objects that are traversing the nodes of the tree implicitely
     * defined by the contents of a Java class. I.e., the hierarchy of methods,
     * fields, attributes, etc. spawns a tree of objects.
     *
     * @param v Visitor object
     */
    @Override
    public void accept( final Visitor v ) {
        v.visitExceptionTable(this);
    }

    /**
     * Dump exceptions attribute to file stream in binary format.
     *
     * @param file Output file stream
     * @throws IOException
     */
    @Override
    public void dump( final DataOutputStream file ) throws IOException {
        super.dump(file);
        file.writeShort(exceptionIndexTable.length);
        for (final int index : exceptionIndexTable) {
            file.writeShort(index);
        }
    }

    /**
     * @return Array of indices into constant pool of thrown exceptions.
     */
    @Pure
    public int[] getExceptionIndexTable() {
        return exceptionIndexTable;
    }

    /**
     * @return Length of exception table.
     */
    @Pure
    public @NonNegative int getNumberOfExceptions() {
        return exceptionIndexTable == null ? 0 : exceptionIndexTable.length;
    }

    /**
     * @return class names of thrown exceptions
     */
    public String[] getExceptionNames() {
        final String[] names = new String[exceptionIndexTable.length];
        for (int i = 0; i < exceptionIndexTable.length; i++) {
            names[i] = super.getConstantPool().getConstantString(exceptionIndexTable[i],
                    Const.CONSTANT_Class).replace('/', '.');
        }
        return names;
    }

    /**
     * @param exceptionIndexTable the list of exception indexes
     * Also redefines number_of_exceptions according to table length.
     */
    public void setExceptionIndexTable( final int[] exceptionIndexTable ) {
        this.exceptionIndexTable = exceptionIndexTable != null ? exceptionIndexTable : new int[0];
    }

    /**
     * @return String representation, i.e., a list of thrown exceptions.
     */
    @Override
    public String toString() {
        final StringBuilder buf = new StringBuilder();
        String str;
        buf.append("Exceptions: ");
        for (int i = 0; i < exceptionIndexTable.length; i++) {
            str = super.getConstantPool().getConstantString(exceptionIndexTable[i], Const.CONSTANT_Class);
            buf.append(Utility.compactClassName(str, false));
            if (i < exceptionIndexTable.length - 1) {
                buf.append(", ");
            }
        }
        return buf.toString();
    }

    /**
     * @return deep copy of this attribute
     */
    @Override
    public Attribute copy( final ConstantPool _constant_pool ) {
        final ExceptionTable c = (ExceptionTable) clone();
        if (exceptionIndexTable != null) {
            c.exceptionIndexTable = new int[exceptionIndexTable.length];
            System.arraycopy(exceptionIndexTable, 0, c.exceptionIndexTable, 0,
                    exceptionIndexTable.length);
        }
        c.setConstantPool(_constant_pool);
        return c;
    }
}


text:
package com.lge.stark.smp.smpframe;

import com.fasterxml.jackson.annotation.JsonProperty;

public class CreateMessage extends Smpframe {

	@JsonProperty("channelId")
	String channelId;

	@JsonProperty("creatorId")
	String creatorId;

	@JsonProperty("text")
	String text;

	public String channelId() {
		return channelId;
	}

	public String creatorId() {
		return creatorId;
	}

	public String text() {
		return text;
	}
}


text:
package org.osgl.concurrent;

import org.osgl.$;

/**
 * Provide access to context local bag. E.g JDKThreadLocal
 */
public interface ContextLocal<T> {

    /**
     * Returns the value in the current context's copy of this
     * context-local variable.  If the variable has no value for the
     * current context, it is first initialized to the value returned
     * by an invocation of the {@link #initialValue} method.
     *
     * @return the current thread's value of this thread-local
     */
    T get();

    /**
     * Sets the current context's copy of this context-local variable
     * to the specified value.  Most subclasses will have no need to
     * override this method, relying solely on the {@link #initialValue}
     * method to set the values of context-locals.
     *
     * @param value the value to be stored in the current context's copy of
     *        this context-local.
     */
    void set(T value);

    /**
     * Removes the current context's value for this context-local
     * variable.  If this context-local variable is subsequently
     * {@linkplain #get read} by the current thread, its value will be
     * reinitialized by invoking its {@link #initialValue} method,
     * unless its value is {@linkplain #set set} by the current context
     * in the interim.  This may result in multiple invocations of the
     * <tt>initialValue</tt> method in the current context.
     */
    void remove();

    /**
     * Returns the current context's "initial value" for this
     * context-local variable.  This method will be invoked the first
     * time a context accesses the variable with the {@link #get}
     * method, unless the context previously invoked the {@link #set}
     * method, in which case the <tt>initialValue</tt> method will not
     * be invoked for the context.  Normally, this method is invoked at
     * most once per context, but it may be invoked again in case of
     * subsequent invocations of {@link #remove} followed by {@link #get}.
     *
     * @return the initial value for this context-local
     */
    T initialValue();

    public abstract static class InitialValueProvider<T> extends $.F0<T> {
        @Override
        public T apply() {
            return initialValue();
        }

        public abstract T initialValue();
    }

    public static final String CONF_CONTEXT_LOCAL_FACTORY = "osgl.context_local.factory";

    public static interface Factory {
        <T> ContextLocal<T> create();
        <T> ContextLocal<T> create(InitialValueProvider<T> ivp);

        public static enum Predefined {
            ;
            public static Factory JDKThreadLocalFactory = new Factory() {
                @Override
                public <T> ContextLocal<T> create() {
                    return new JDKThreadLocal<T>();
                }

                @Override
                public <T> ContextLocal<T> create(InitialValueProvider<T> ivp) {
                    return new JDKThreadLocal<T>(ivp);
                }
            };

            public static Factory defaultFactory() {
                return JDKThreadLocalFactory;
            }
        }
    }

}


text:
import { Injectable } from '@angular/core';
import { Headers, Http, Response } from '@angular/http'
import { Observable } from 'rxjs/Observable';
import { Doctor } from './doctor.model';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';

@Injectable()

export class DoctorService {
    constructor(private http: Http) { }

    private getHeaders() {
        let headers = new Headers();
        headers.append('Accept', 'application/json');
        return headers;
    }

    private handleError(error: any): Observable<any> {
        let errorMsg = error.message || `Oh nooo! Server error!`
        console.error(errorMsg);

        // throw an application level error
        return Observable.throw(errorMsg);
    }

    getDoctors(): Observable<Doctor[]> {
        return this.http.get('doctor/doctors')
            .map(response => response.json() as Doctor[])
            .catch(this.handleError);
    }

    saveDoctor(doctor: Doctor): Observable<Response> {
        let url: string = 'doctor/new';
        if (doctor.Id != null) {
            url = 'doctor/edit'
        }

        return this.http.post(url, doctor)
            .map(response => response.json())
            .catch(this.handleError);
    }
}


text:
	T.vstudio_vs2010_compile_settings = { }
	local suite = T.vstudio_vs2010_compile_settings
	local vc2010 = premake.vstudio.vc2010
	local project = premake5.project

--
-- Setup
--

	local sln, prj, cfg

	function suite.setup()
		sln, prj = test.createsolution()
	end

	local function prepare(platform)
		cfg = project.getconfig(prj, "Debug", platform)
		vc2010.clCompile(cfg)
	end

 --
-- Check the basic element structure with default settings.
--

	function suite.defaultSettings()
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
		</ClCompile>
		]]
	end

--
-- If precompiled headers are specified, add those elements.
--

	function suite.usePrecompiledHeaders_onPrecompiledHeaders()
		pchheader "include/afxwin.h"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>Use</PrecompiledHeader>
			<PrecompiledHeaderFile>afxwin.h</PrecompiledHeaderFile>
		]]
	end

	function suite.noPrecompiledHeaders_onNoPCH()
		pchheader "afxwin.h"
		flags "NoPCH"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
		]]
	end

--
-- If the ExtraWarnings flag is specified, pump up the volume.
--

	function suite.warningLevel_onExtraWarnings()
		flags "ExtraWarnings"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level4</WarningLevel>
		]]
	end

--
-- If the NoWarnings flag is specified, mute on warnings.
--

	function suite.warningLevel_onNoWarnings()
		flags "NoWarnings"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level0</WarningLevel>
		]]
	end

--
-- NoWarnings disables ExtraWarnings FatalWarnings flagss.
--

	function suite.warningLevel_onNoWarningsOverOtherWarningsFlags()
		flags { "NoWarnings", "ExtraWarnings", "FatalWarnings" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level0</WarningLevel>
		]]
	end

--
-- Check the optimization flags.
--

	function suite.optimization_onOptimize()
		flags "Optimize"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Full</Optimization>
			<FunctionLevelLinking>true</FunctionLevelLinking>
			<IntrinsicFunctions>true</IntrinsicFunctions>
			<MinimalRebuild>false</MinimalRebuild>
			<StringPooling>true</StringPooling>
		]]
	end

	function suite.optimization_onOptimizeSize()
		flags "OptimizeSize"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>MinSpace</Optimization>
			<FunctionLevelLinking>true</FunctionLevelLinking>
			<IntrinsicFunctions>true</IntrinsicFunctions>
			<MinimalRebuild>false</MinimalRebuild>
			<StringPooling>true</StringPooling>
		]]
	end

	function suite.optimization_onOptimizeSpeed()
		flags "OptimizeSpeed"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>MaxSpeed</Optimization>
			<FunctionLevelLinking>true</FunctionLevelLinking>
			<IntrinsicFunctions>true</IntrinsicFunctions>
			<MinimalRebuild>false</MinimalRebuild>
			<StringPooling>true</StringPooling>
		]]
	end

	function suite.omitFrames_onNoFramePointer()
		flags "NoFramePointer"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<OmitFramePointers>true</OmitFramePointers>
		]]
	end

--
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
--

	function suite.preprocessorDefinitions_onDefines()
		defines { "DEBUG", "_DEBUG" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<PreprocessorDefinitions>DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
		]]
	end

--
-- If build options are specified, the <AdditionalOptions> element should be specified.
--

	function suite.additionalOptions_onBuildOptions()
		buildoptions { "/xyz", "/abc" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<AdditionalOptions>/xyz /abc %(AdditionalOptions)</AdditionalOptions>
		]]
	end

--
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
--

	function suite.additionalIncludeDirs_onIncludeDirs()
		includedirs { "include/lua", "include/zlib" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
		]]
	end

--
-- Turn off minimal rebuilds if the NoMinimalRebuild flag is set.
--

	function suite.minimalRebuild_onNoMinimalRebuild()
		flags "NoMinimalRebuild"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<MinimalRebuild>false</MinimalRebuild>
		]]
	end

--
-- Can't minimal rebuild with the C7 debugging format.
--

	function suite.minimalRebuild_onC7()
		debugformat "C7"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<MinimalRebuild>false</MinimalRebuild>
		]]
	end

--
-- Debug builds with extra warnings unlock smaller type checks.
--

	function suite.smallerTypeCheck_onDebugWithExtraWarnings()
		flags { "Symbols", "ExtraWarnings" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level4</WarningLevel>
			<SmallerTypeCheck>true</SmallerTypeCheck>
		]]
	end

--
-- If the StaticRuntime flag is specified, add the <RuntimeLibrary> element.
--

	function suite.runtimeLibrary_onStaticRuntime()
		flags { "StaticRuntime" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
		]]
	end

	function suite.runtimeLibrary_onStaticRuntimeAndSymbols()
		flags { "StaticRuntime", "Symbols" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
			<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
			<Optimization>Disabled</Optimization>
			<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
		]]
	end

--
-- Add <TreatWarningAsError> if FatalWarnings flag is set.
--

	function suite.treatWarningsAsError_onFatalWarnings()
		flags { "FatalWarnings" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<TreatWarningAsError>true</TreatWarningAsError>
		]]
	end

--
-- Check the handling of the Symbols flag.
--

	function suite.onSymbolsFlag()
		flags "Symbols"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
			<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
			<Optimization>Disabled</Optimization>
		</ClCompile>
		]]
	end

--
-- Check the handling of the C7 debug information format.
--

	function suite.onC7DebugFormat()
		flags "Symbols"
		debugformat "c7"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>OldStyle</DebugInformationFormat>
			<Optimization>Disabled</Optimization>
		]]
	end

--
-- Check handling of floating point and SSE flags.
--

	function suite.instructionSet_onSSE()
		flags "EnableSSE"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
		]]
	end

	function suite.instructionSet_onSSE2()
		flags "EnableSSE2"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
		]]
	end

	function suite.floatingPoint_onFloatFast()
		flags "FloatFast"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<FloatingPointModel>Fast</FloatingPointModel>
		]]
	end

	function suite.floatingPoint_onFloatStrict()
		flags "FloatStrict"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<FloatingPointModel>Strict</FloatingPointModel>
		]]
	end

--
-- Verify character handling.
--

	function suite.wchar_onNative()
		flags "NativeWChar"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
		]]
	end

	function suite.wchar_onNoNative()
		flags "NoNativeWChar"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
		]]
	end

--
-- Check exception handling and RTTI.
--

	function suite.exceptions_onNoExceptions()
		flags "NoExceptions"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<ExceptionHandling>false</ExceptionHandling>
		]]
	end

	function suite.exceptions_onSEH()
		flags "SEH"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<ExceptionHandling>Async</ExceptionHandling>
		]]
	end

	function suite.runtimeTypeInfo_onNoRTTI()
		flags "NoRTTI"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<Optimization>Disabled</Optimization>
			<RuntimeTypeInfo>false</RuntimeTypeInfo>
		]]
	end

--
-- On Win32 builds, use the Edit-and-Continue debug information format.
--

	function suite.debugFormat_onWin32()
		flags "Symbols"
		architecture "x32"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
		]]
	end

--
-- Edit-and-Continue is not support on 64-bit builds.
--

	function suite.debugFormat_onWin64()
		flags "Symbols"
		architecture "x64"
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
		]]
	end

--
-- Check the handling of the NoEditAndContinue flag.
--

	function suite.debugFormat_onNoEditAndContinue()
		flags { "Symbols", "NoEditAndContinue" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
		]]
	end

--
-- Edit-and-Continue is not supported for optimized builds.
--

	function suite.debugFormat_onOptimizedBuild()
		flags { "Symbols", "Optimize" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
		]]
	end

--
-- Edit-and-Continue is not supported for Managed builds.
--

	function suite.debugFormat_onManagedCode()
		flags { "Symbols", "Managed" }
		prepare()
		test.capture [[
		<ClCompile>
			<PrecompiledHeader>NotUsing</PrecompiledHeader>
			<WarningLevel>Level3</WarningLevel>
			<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
		]]
	end


text:
#pragma once

#include <pulsar/c/result.h>
#include <pulsar/c/message.h>

#ifdef __cplusplus
extern "C" {
#endif

#pragma GCC visibility push(default)

typedef struct _pulsar_reader pulsar_reader_t;

typedef void (*pulsar_result_callback)(pulsar_result, void *);

/**
 * @return the topic this reader is reading from
 */
const char *pulsar_reader_get_topic(pulsar_reader_t *reader);

/**
 * Read a single message.
 *
 * If a message is not immediately available, this method will block until a new
 * message is available.
 *
 * @param msg a non-const reference where the received message will be copied
 * @return ResultOk when a message is received
 * @return ResultInvalidConfiguration if a message listener had been set in the configuration
 */
pulsar_result pulsar_reader_read_next(pulsar_reader_t *reader, pulsar_message_t **msg);

/**
 * Read a single message
 *
 * @param msg a non-const reference where the received message will be copied
 * @param timeoutMs the receive timeout in milliseconds
 * @return ResultOk if a message was received
 * @return ResultTimeout if the receive timeout was triggered
 * @return ResultInvalidConfiguration if a message listener had been set in the configuration
 */
pulsar_result pulsar_reader_read_next_with_timeout(pulsar_reader_t *reader, pulsar_message_t **msg,
                                                   int timeoutMs);

pulsar_result pulsar_reader_close(pulsar_reader_t *reader);

void pulsar_reader_close_async(pulsar_reader_t *reader, pulsar_result_callback callback, void *ctx);

void pulsar_reader_free(pulsar_reader_t *reader);

pulsar_result pulsar_reader_has_message_available(pulsar_reader_t *reader, int *available);

#pragma GCC visibility pop

#ifdef __cplusplus
}
#endif