text:
#include <app/InteractionModelEngine.h>
#include <app/MessageDef/TimedRequestMessage.h>
#include <app/StatusResponse.h>
#include <app/tests/AppTestContext.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLV.h>
#include <lib/support/UnitTestContext.h>
#include <lib/support/UnitTestRegistration.h>
#include <lib/support/UnitTestUtils.h>
#include <protocols/interaction_model/Constants.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SessionManager.h>

#include <nlunit-test.h>

using TestContext = chip::Test::AppContext;

namespace chip {
namespace app {

using namespace Messaging;
using namespace Protocols::InteractionModel;

class TestTimedHandler
{
public:
    static void TestInvokeFastEnough(nlTestSuite * aSuite, void * aContext);
    static void TestWriteFastEnough(nlTestSuite * aSuite, void * aContext);

    static void TestInvokeTooSlow(nlTestSuite * aSuite, void * aContext);
    static void TestWriteTooSlow(nlTestSuite * aSuite, void * aContext);

    static void TestInvokeNeverComes(nlTestSuite * aSuite, void * aContext);

private:
    static void TestFollowingMessageFastEnough(nlTestSuite * aSuite, void * aContext, MsgType aMsgType);
    static void TestFollowingMessageTooSlow(nlTestSuite * aSuite, void * aContext, MsgType aMsgType);

    static void GenerateTimedRequest(nlTestSuite * aSuite, uint16_t aTimeoutValue, System::PacketBufferHandle & aPayload);
};

namespace {

class TestExchangeDelegate : public Messaging::ExchangeDelegate
{
    CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * aExchangeContext, const PayloadHeader & aPayloadHeader,
                                 System::PacketBufferHandle && aPayload) override
    {
        mNewMessageReceived   = true;
        mLastMessageWasStatus = aPayloadHeader.HasMessageType(MsgType::StatusResponse);
        if (mLastMessageWasStatus)
        {
            mError = StatusResponse::ProcessStatusResponse(std::move(aPayload));
        }
        if (mKeepExchangeOpen)
        {
            aExchangeContext->WillSendMessage();
        }
        return CHIP_NO_ERROR;
    }

    void OnResponseTimeout(Messaging::ExchangeContext *) override {}

public:
    bool mKeepExchangeOpen     = false;
    bool mNewMessageReceived   = false;
    bool mLastMessageWasStatus = false;
    CHIP_ERROR mError          = CHIP_NO_ERROR;
};

} // anonymous namespace

void TestTimedHandler::GenerateTimedRequest(nlTestSuite * aSuite, uint16_t aTimeoutValue, System::PacketBufferHandle & aPayload)
{
    aPayload = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize);
    NL_TEST_ASSERT(aSuite, !aPayload.IsNull());

    System::PacketBufferTLVWriter writer;
    writer.Init(std::move(aPayload));

    TimedRequestMessage::Builder builder;
    CHIP_ERROR err = builder.Init(&writer);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);

    builder.TimeoutMs(aTimeoutValue);
    NL_TEST_ASSERT(aSuite, builder.GetError() == CHIP_NO_ERROR);

    err = writer.Finalize(&aPayload);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);
}

void TestTimedHandler::TestFollowingMessageFastEnough(nlTestSuite * aSuite, void * aContext, MsgType aMsgType)
{
    TestContext & ctx = *static_cast<TestContext *>(aContext);

    System::PacketBufferHandle payload;
    GenerateTimedRequest(aSuite, 500, payload);

    TestExchangeDelegate delegate;
    ExchangeContext * exchange = ctx.NewExchangeToAlice(&delegate);
    NL_TEST_ASSERT(aSuite, exchange != nullptr);

    NL_TEST_ASSERT(aSuite, !delegate.mNewMessageReceived);

    delegate.mKeepExchangeOpen = true;

    CHIP_ERROR err = exchange->SendMessage(MsgType::TimedRequest, std::move(payload), SendMessageFlags::kExpectResponse);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);

    ctx.DrainAndServiceIO();
    NL_TEST_ASSERT(aSuite, delegate.mNewMessageReceived);
    NL_TEST_ASSERT(aSuite, delegate.mLastMessageWasStatus);
    NL_TEST_ASSERT(aSuite, delegate.mError == CHIP_NO_ERROR);

    // Send an empty payload, which will error out but not with the
    // UNSUPPORTED_ACCESS status we expect if we miss our timeout.
    payload = MessagePacketBuffer::New(0);
    NL_TEST_ASSERT(aSuite, !payload.IsNull());

    delegate.mKeepExchangeOpen   = false;
    delegate.mNewMessageReceived = false;

    err = exchange->SendMessage(aMsgType, std::move(payload), SendMessageFlags::kExpectResponse);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);

    ctx.DrainAndServiceIO();
    NL_TEST_ASSERT(aSuite, delegate.mNewMessageReceived);
    NL_TEST_ASSERT(aSuite, delegate.mLastMessageWasStatus);
    NL_TEST_ASSERT(aSuite, StatusIB(delegate.mError).mStatus != Status::UnsupportedAccess);
}

void TestTimedHandler::TestInvokeFastEnough(nlTestSuite * aSuite, void * aContext)
{
    TestFollowingMessageFastEnough(aSuite, aContext, MsgType::InvokeCommandRequest);
}

void TestTimedHandler::TestWriteFastEnough(nlTestSuite * aSuite, void * aContext)
{
    TestFollowingMessageFastEnough(aSuite, aContext, MsgType::WriteRequest);
}

void TestTimedHandler::TestFollowingMessageTooSlow(nlTestSuite * aSuite, void * aContext, MsgType aMsgType)
{
    TestContext & ctx = *static_cast<TestContext *>(aContext);

    System::PacketBufferHandle payload;
    GenerateTimedRequest(aSuite, 50, payload);

    TestExchangeDelegate delegate;
    ExchangeContext * exchange = ctx.NewExchangeToAlice(&delegate);
    NL_TEST_ASSERT(aSuite, exchange != nullptr);

    NL_TEST_ASSERT(aSuite, !delegate.mNewMessageReceived);

    delegate.mKeepExchangeOpen = true;

    CHIP_ERROR err = exchange->SendMessage(MsgType::TimedRequest, std::move(payload), SendMessageFlags::kExpectResponse);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);

    ctx.DrainAndServiceIO();
    NL_TEST_ASSERT(aSuite, delegate.mNewMessageReceived);
    NL_TEST_ASSERT(aSuite, delegate.mLastMessageWasStatus);
    NL_TEST_ASSERT(aSuite, delegate.mError == CHIP_NO_ERROR);

    // Sleep for > 50ms so we miss our time window.
    chip::test_utils::SleepMillis(75);

    // Send an empty payload, which will error out but not with the
    // UNSUPPORTED_ACCESS status we expect if we miss our timeout.
    payload = MessagePacketBuffer::New(0);
    NL_TEST_ASSERT(aSuite, !payload.IsNull());

    delegate.mKeepExchangeOpen   = false;
    delegate.mNewMessageReceived = false;

    err = exchange->SendMessage(aMsgType, std::move(payload), SendMessageFlags::kExpectResponse);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);

    ctx.DrainAndServiceIO();
    NL_TEST_ASSERT(aSuite, delegate.mNewMessageReceived);
    NL_TEST_ASSERT(aSuite, delegate.mLastMessageWasStatus);
    NL_TEST_ASSERT(aSuite, StatusIB(delegate.mError).mStatus == Status::UnsupportedAccess);
}

void TestTimedHandler::TestInvokeTooSlow(nlTestSuite * aSuite, void * aContext)
{
    TestFollowingMessageTooSlow(aSuite, aContext, MsgType::InvokeCommandRequest);
}

void TestTimedHandler::TestWriteTooSlow(nlTestSuite * aSuite, void * aContext)
{
    TestFollowingMessageTooSlow(aSuite, aContext, MsgType::WriteRequest);
}

void TestTimedHandler::TestInvokeNeverComes(nlTestSuite * aSuite, void * aContext)
{
    TestContext & ctx = *static_cast<TestContext *>(aContext);

    System::PacketBufferHandle payload;
    GenerateTimedRequest(aSuite, 50, payload);

    TestExchangeDelegate delegate;
    ExchangeContext * exchange = ctx.NewExchangeToAlice(&delegate);
    NL_TEST_ASSERT(aSuite, exchange != nullptr);

    NL_TEST_ASSERT(aSuite, !delegate.mNewMessageReceived);

    CHIP_ERROR err = exchange->SendMessage(MsgType::TimedRequest, std::move(payload), SendMessageFlags::kExpectResponse);
    NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR);

    ctx.DrainAndServiceIO();
    NL_TEST_ASSERT(aSuite, delegate.mNewMessageReceived);
    NL_TEST_ASSERT(aSuite, delegate.mLastMessageWasStatus);
    NL_TEST_ASSERT(aSuite, delegate.mError == CHIP_NO_ERROR);

    // Do nothing else; exchange on the server remains open.  We are testing to
    // see whether shutdown cleans it up properly.
}

} // namespace app
} // namespace chip

namespace {

/**
 *   Test Suite. It lists all the test functions.
 */

// clang-format off
const nlTest sTests[] =
{
        NL_TEST_DEF("TimedHandlerTestInvokeFastEnough", chip::app::TestTimedHandler::TestInvokeFastEnough),
        NL_TEST_DEF("TimedHandlerTestInvokeTooSlow", chip::app::TestTimedHandler::TestInvokeTooSlow),
        NL_TEST_DEF("TimedHandlerTestInvokeNeverComes", chip::app::TestTimedHandler::TestInvokeNeverComes),
        NL_TEST_SENTINEL()
};
// clang-format on

// clang-format off
nlTestSuite sSuite =
{
    "TestTimedHandler",
    &sTests[0],
    TestContext::Initialize,
    TestContext::Finalize
};
// clang-format on

} // namespace

int TestTimedHandler()
{
    return chip::ExecuteTestsWithContext<TestContext>(&sSuite);
}

CHIP_REGISTER_TEST_SUITE(TestTimedHandler)


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

/**
 * MaterialParameterCollection.h - defines an asset that has a list of parameters, which can be referenced by any material and updated efficiently at runtime
 */

#pragma once
#include "MaterialParameterCollection.generated.h"

/** Base struct for collection parameters */
USTRUCT()
struct FCollectionParameterBase
{
	GENERATED_USTRUCT_BODY()

	FCollectionParameterBase()
	{
		FPlatformMisc::CreateGuid(Id);
	}

	/** The name of the parameter.  Changing this name will break any blueprints that reference the parameter. */
	UPROPERTY(EditAnywhere, Category=Parameter)
	FName ParameterName;

	/** Uniquely identifies the parameter, used for fixing up materials that reference this parameter when renaming. */
	UPROPERTY()
	FGuid Id;
};

/** A scalar parameter */
USTRUCT()
struct FCollectionScalarParameter : public FCollectionParameterBase
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, Category=Parameter)
	float DefaultValue;
};

/** A vector parameter */
USTRUCT()
struct FCollectionVectorParameter : public FCollectionParameterBase
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, Category=Parameter)
	FLinearColor DefaultValue;
};

/**
 * Asset class that contains a list of parameter names and their default values.
 * Any number of materials can reference these parameters and get new values when the parameter values are changed.
 */
UCLASS(hidecategories=object, MinimalAPI)
class UMaterialParameterCollection : public UObject
{
	GENERATED_UCLASS_BODY()

	/** Used by materials using this collection to know when to recompile. */
	UPROPERTY(duplicatetransient)
	FGuid StateId;

	UPROPERTY(EditAnywhere, Category=Material)
	TArray<FCollectionScalarParameter> ScalarParameters;

	UPROPERTY(EditAnywhere, Category=Material)
	TArray<FCollectionVectorParameter> VectorParameters;

	// Begin UObject interface.
#if WITH_EDITOR
	virtual void PreEditChange(class FEditPropertyChain& PropertyAboutToChange) override;
	virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
	virtual void PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent) override;
#endif // WITH_EDITOR
	virtual void PostLoad() override;
	// End UObject interface.

	/** Finds a parameter name given an Id, returns NAME_None if the parameter was not found. */
	FName GetParameterName(const FGuid& Id) const;

	/** Finds a parameter id given a name, returns the default guid if the parameter was not found. */
	FGuid GetParameterId(FName ParameterName) const;

	/** Gets a vector and component index for the given parameter, used when compiling materials, to know where to access a certain parameter. */
	void GetParameterIndex(const FGuid& Id, int32& OutIndex, int32& OutComponentIndex) const;

	/** Populates an array with either scalar or vector parameter names. */
	ENGINE_API void GetParameterNames(TArray<FName>& OutParameterNames, bool bVectorParameters) const;

	/** Utility to find a scalar parameter struct given a parameter name.  Returns NULL if not found. */
	const FCollectionScalarParameter* GetScalarParameterByName(FName ParameterName) const;

	/** Utility to find a vector parameter struct given a parameter name.  Returns NULL if not found. */
	const FCollectionVectorParameter* GetVectorParameterByName(FName ParameterName) const;

	/** Accessor for the uniform buffer layout description. */
	const FUniformBufferStruct& GetUniformBufferStruct() const
	{
		check(UniformBufferStruct);
		return *UniformBufferStruct;
	}

private:

	TScopedPointer<FUniformBufferStruct> UniformBufferStruct;

	void CreateBufferStruct();
};

redpajama_set_name: RedPajamaGithub


text:
package models;

import java.util.Map;

public class PersonWithParameters {

    private String name;
    private Map<String, String> parameters;
    private Long a;
    private String b;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, String> getParameters() {
        return parameters;
    }

    public void setParameters(Map<String, String> parameters) {
        this.parameters = parameters;
    }

    public Long getA() {
        return a;
    }

    public void setA(Long a) {
        this.a = a;
    }

    public String getB() {
        return b;
    }

    public void setB(String b) {
        this.b = b;
    }

}


text:
namespace Microsoft.Protocols.TestSuites.MS_ASCON
{
    using System.Collections.ObjectModel;

    /// <summary>
    /// Wrapper conversion item class for the conversation id and the server id
    /// </summary>
    public class ConversationItem
    {
        /// <summary>
        /// The server id collection in the current conversion.
        /// </summary>
        private Collection<string> serverId;

        /// <summary>
        /// Initializes a new instance of the ConversationItem class.
        /// </summary>
        public ConversationItem()
        {
            if (this.serverId != null)
            {
                this.serverId.Clear();
            }
            else
            {
                this.serverId = new Collection<string>();
            }
        }

        /// <summary>
        /// Gets or sets the conversation id
        /// </summary>
        public string ConversationId { get; set; }

        /// <summary>
        /// Gets the server id collection
        /// </summary>
        public Collection<string> ServerId
        {
            get { return this.serverId; }
        }
    }
}


text:
(function () {
    function createCanvas(width, height) {
        var canvas = document.createElement("canvas");
        canvas.setAttribute("class", "mabes-chart");
        canvas.width = width;
        canvas.height = height;
        return canvas;
    }
    function setFont(context, font, size) {
        context.font = size + "px " + font;
    }
    function drawText(context, text, color, align, start, top) {
        context.fillStyle = color;
        context.textAlign = align;
        context.fillText(text, start, top);
    }
    function drawLine(context, start, end, top, size) {
        context.lineWidth = size;
        context.beginPath();
        context.moveTo(start, top);
        context.lineTo(end, top);
        context.stroke();
    }
    function drawSegitiga(context, sl, lc, bg, bgc, x1, y1, x2, y2, x3, y3) {
        context.beginPath();
        context.moveTo(x1, y1);
        context.lineTo(x2, y2);
        context.lineTo(x3, y3);
        context.closePath();
        if (bg) {
            context.fillStyle = bgc;
            context.fill();
        }
        if (sl > 0) {
            context.lineWidth = sl;
            context.strokeStyle = lc;
            context.stroke();
        }
    }
    function addEvent(obj, eventType, fn, useCapture) {
        if (obj.addEventListener) {
            obj.addEventListener(eventType, fn, useCapture || false);
        } else if (obj.attachEvent) {
            obj.attachEvent("on" + eventType, function (e) {
                e = e || window.event;
                e.preventDefault = e.preventDefault || function () {
                    e.returnValue = false;
                };
                e.stopPropagation = e.stopPropagation || function () {
                    e.cancelBubble = true;
                };
                fn.call(obj, e);
            });
        } else
            return false;
    }
    function NiceText(str) {
        return str.toLowerCase().split(' ').map(function (word) {
            return word[0].toUpperCase() + word.substr(1);
        }).join(' ');
    }

    function MabesChart(containerId, options) {
        this._options = options;
        this._chartWidth = 1100;
        this._chartHeight = 1500;
        var _this = this;
        this._containerId = containerId;
        addEvent(window, "resize", function () {
            if (_this._updateSize())
                _this.render();
        });
    }

    MabesChart.prototype._updateSize = function () {
        var width = 0;
        var height = 0;
        this.width = width = this._container.clientWidth > 0 ? this._container.clientWidth : this.width;
        this.height = height = this._container.clientHeight > 0 ? this._container.clientHeight : this.height;
        if (this.canvas.width !== width || this.canvas.height !== height) {
            this.canvas.width = width;
            this.canvas.height = height;
            return true;
        }
        return false;
    };
    MabesChart.prototype.render = function () {
        var data = this._options;
        this._container = typeof (this._containerId) === "string" ? document.getElementById(this._containerId) : this._containerId;
        if (data.max === 0) {
            this._container.innerHTML = "Belum ada data...";
        } else {
            var max_width = data.max * 2;
            var jumlahPangkat = data.pangkat.length;
            if (jumlahPangkat > 0) {
                this._container.innerHTML = "";
                this._mabesChartContainer = document.createElement("div");
                this._mabesChartContainer.setAttribute("class", "mabes-chart-container");
                this._mabesChartContainer.style.position = "relative";
                this._mabesChartContainer.style.textAlign = "left";
                this._mabesChartContainer.style.cursor = "auto";
                this._container.appendChild(this._mabesChartContainer);
                var scale = Math.round(this._mabesChartContainer.clientWidth / this._chartWidth);
                if (scale === 0)
                    scale = 1;
//        console.log(scale);

                this.canvas = createCanvas(this._chartWidth * scale, this._chartHeight * scale);
                this.canvas.style.width = '100%';
                this._mabesChartContainer.appendChild(this.canvas);
                var context = this.canvas.getContext("2d");
                var lebar = this._chartWidth * scale;
                var jarak = 70 * scale;
                var titleTop = 90 * scale;
                var segitigaTop = 140 * scale;
                var garisTop = 170 * scale;
                var pangkatTop = garisTop + jarak / 2 + 10;
                var kiriGambar = 100 * scale;
                var kananGambar = lebar;
                var lebarGambar = kananGambar - kiriGambar;
                var tengahGambar = kiriGambar + lebarGambar / 2;
                var tebalBar = jarak / 2;
                var scale10 = 10 * scale;
                var scale15 = 15 * scale;
                var scale20 = 20 * scale;
                var scale25 = 25 * scale;
                // header
                setFont(context, "Arial Narrow", 14 * scale);
                drawText(context, "MARKAS BESAR ANGKATAN DARAT", "black", "center", 120 * scale, scale20);
                drawText(context, "STAF UMUM PERSONEL", "black", "center", 120 * scale, 34 * scale);
                drawLine(context, scale10, 230 * scale, 40 * scale, 1 * scale);
                // judul
                setFont(context, "Arial", 22 * scale);
                drawText(context, "PIRAMIDA KEKUATAN PERSONEL", "black", "center", tengahGambar, titleTop);
                drawText(context, data.struktur + " STRUKTUR TNI AD BULAN " + data.triwulan + " TAHUN " + data.tahun, "black", "center", tengahGambar, titleTop + scale20);
                // bayangan segitiga
                drawSegitiga(context, 0, null, true, "#CCCCCC", tengahGambar, segitigaTop - scale20, kiriGambar + 88 * scale, garisTop + jumlahPangkat * jarak + 8 * scale, kananGambar - 88 * scale, garisTop + jumlahPangkat * jarak + 8 * scale);
                // segitiga
                drawSegitiga(context, 3 * scale, '#000000', true, "#33AA33", tengahGambar, segitigaTop, kiriGambar + 100 * scale, garisTop + jumlahPangkat * jarak, kananGambar - 100 * scale, garisTop + jumlahPangkat * jarak);
                // garis tengah
                context.beginPath();
                context.lineWidth = 1 * scale;
                context.moveTo(tengahGambar, segitigaTop + 30 * scale);
                context.lineTo(tengahGambar, garisTop + jumlahPangkat * jarak);
                context.stroke();
                // garis pangkat
                context.setLineDash([10, 5]);
                context.lineWidth = 1 * scale;
                for (i = 0; i <= jumlahPangkat; i++) {
                    context.beginPath();
                    context.moveTo(10, garisTop + i * jarak);
                    context.lineTo(kananGambar - scale10, garisTop + i * jarak);
                    context.stroke();
                }

                // garis perwira
                context.beginPath();
                context.setLineDash([2]);
                context.moveTo(tengahGambar - 300 * scale, (garisTop + scale10));
                context.lineTo(tengahGambar - 300 * scale, (garisTop + scale10) + 9 * jarak - scale15);
                context.lineTo(tengahGambar + 300 * scale, (garisTop + scale10) + 9 * jarak - scale15);
                context.lineTo(tengahGambar + 300 * scale, (garisTop + scale10));
                context.stroke();
                // garis bintara
                context.beginPath();
                context.moveTo(tengahGambar - 300 * scale, (garisTop + scale10) + 9 * jarak);
                context.lineTo(tengahGambar - 300 * scale, (garisTop + scale10) + 12 * jarak - scale15);
                context.lineTo(tengahGambar + 300 * scale, (garisTop + scale10) + 12 * jarak - scale15);
                context.lineTo(tengahGambar + 300 * scale, (garisTop + scale10) + 9 * jarak);
                context.stroke();
                // garis tamtama
                context.beginPath();
                context.moveTo(tengahGambar - 300 * scale, (garisTop + scale10) + 12 * jarak);
                context.lineTo(tengahGambar - 300 * scale, (garisTop + scale10) + 14 * jarak - scale15);
                context.lineTo(tengahGambar + 300 * scale, (garisTop + scale10) + 14 * jarak - scale15);
                context.lineTo(tengahGambar + 300 * scale, (garisTop + scale10) + 12 * jarak);
                context.stroke();
                // garis pati
                context.beginPath();
                context.moveTo(tengahGambar - 200 * scale, (garisTop + scale10) + 4 * jarak - scale20);
                context.lineTo(tengahGambar + 200 * scale, (garisTop + scale10) + 4 * jarak - scale20);
                context.stroke();
                // garis pamen
                context.beginPath();
                context.moveTo(tengahGambar - 200 * scale, (garisTop + scale10) + 7 * jarak - scale20);
                context.lineTo(tengahGambar + 200 * scale, (garisTop + scale10) + 7 * jarak - scale20);
                context.stroke();
                // garis pama
                context.beginPath();
                context.moveTo(tengahGambar - 130 * scale, (garisTop) + 9 * jarak - tebalBar);
                context.lineTo(tengahGambar + 130 * scale, (garisTop) + 9 * jarak - tebalBar);
                context.stroke();
                // segitiga perwira
                context.setLineDash([]);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar - 300 * scale, garisTop + scale10, tengahGambar - 305 * scale, garisTop + scale20, tengahGambar - 295 * scale, garisTop + scale20);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar + 300 * scale, garisTop + scale10, tengahGambar + 305 * scale, garisTop + scale20, tengahGambar + 295 * scale, garisTop + scale20);
                // segitiga pati
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar - 200 * scale, (garisTop + scale10) + 4 * jarak - scale20, tengahGambar - 190 * scale, (garisTop + 5 * scale) + 4 * jarak - scale20, tengahGambar - 190 * scale, (garisTop + scale15) + 4 * jarak - scale20);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar + 200 * scale, (garisTop + scale10) + 4 * jarak - scale20, tengahGambar + 190 * scale, (garisTop + 5 * scale) + 4 * jarak - scale20, tengahGambar + 190 * scale, (garisTop + scale15) + 4 * jarak - scale20);
                // segitiga pamen
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar - 200 * scale, (garisTop + scale10) + 7 * jarak - scale20, tengahGambar - 190 * scale, (garisTop + 5 * scale) + 7 * jarak - scale20, tengahGambar - 190 * scale, (garisTop + scale15) + 7 * jarak - scale20);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar + 200 * scale, (garisTop + scale10) + 7 * jarak - scale20, tengahGambar + 190 * scale, (garisTop + 5 * scale) + 7 * jarak - scale20, tengahGambar + 190 * scale, (garisTop + scale15) + 7 * jarak - scale20);
                // segitiga pama
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar - 130 * scale, (garisTop + 0) + 9 * jarak - tebalBar, tengahGambar - 120 * scale, (garisTop - 5 * scale) + 9 * jarak - tebalBar, tengahGambar - 120 * scale, (garisTop + 5 * scale) + 9 * jarak - tebalBar);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar + 130 * scale, (garisTop + 0) + 9 * jarak - tebalBar, tengahGambar + 120 * scale, (garisTop - 5 * scale) + 9 * jarak - tebalBar, tengahGambar + 120 * scale, (garisTop + 5 * scale) + 9 * jarak - tebalBar);
                // segitiga bintara
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar - 300 * scale, (garisTop + scale10) + 9 * jarak, tengahGambar - 305 * scale, (garisTop + scale20) + 9 * jarak, tengahGambar - 295 * scale, (garisTop + scale20) + 9 * jarak);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar + 300 * scale, (garisTop + scale10) + 9 * jarak, tengahGambar + 305 * scale, (garisTop + scale20) + 9 * jarak, tengahGambar + 295 * scale, (garisTop + scale20) + 9 * jarak);
                // segitiga tamtama
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar - 300 * scale, (garisTop + scale10) + 12 * jarak, tengahGambar - 305 * scale, (garisTop + scale20) + 12 * jarak, tengahGambar - 295 * scale, (garisTop + scale20) + 12 * jarak);
                drawSegitiga(context, 0, null, true, "#000000", tengahGambar + 300 * scale, (garisTop + scale10) + 12 * jarak, tengahGambar + 305 * scale, (garisTop + scale20) + 12 * jarak, tengahGambar + 295 * scale, (garisTop + scale20) + 12 * jarak);
                // data grafik
                var total_nyata = 0;
                var total_top = 0;
                for (i = 0; i < jumlahPangkat; i++) {
                    jmlNyata = (data.pangkat[i].nyata / max_width * 500 * scale);
                    jmlTop = (data.pangkat[i].top / max_width * 500 * scale);
                    setFont(context, "Agency FB", 24 * scale);
                    drawText(context, data["pangkat"][i].label, "black", "left", scale20, pangkatTop + i * jarak);
                    context.lineWidth = 1 * scale;
                    context.beginPath();
                    context.moveTo(tengahGambar - jmlNyata, garisTop + i * jarak);
                    context.lineTo(tengahGambar - jmlNyata, garisTop + i * jarak + tebalBar);
                    context.lineTo(tengahGambar + jmlNyata, garisTop + i * jarak + tebalBar);
                    context.lineTo(tengahGambar + jmlNyata, garisTop + i * jarak);
                    context.closePath();
                    context.fillStyle = "#FFFFFF";
                    context.fill();
                    context.strokeStyle = '#000000';
                    context.stroke();
                    context.beginPath();
                    context.moveTo(tengahGambar - jmlTop, garisTop + i * jarak + tebalBar);
                    context.lineTo(tengahGambar - jmlTop, garisTop + i * jarak + tebalBar + tebalBar);
                    context.lineTo(tengahGambar + jmlTop, garisTop + i * jarak + tebalBar + tebalBar);
                    context.lineTo(tengahGambar + jmlTop, garisTop + i * jarak + tebalBar);
                    context.closePath();
                    context.fillStyle = "#000000";
                    context.fill();
                    context.strokeStyle = '#000000';
                    context.stroke();
                    setFont(context, "Agency FB", scale20);
                    if (i > 9) {
                        drawText(context, Number(data.pangkat[i].nyata).toLocaleString('id'), "black", "right", tengahGambar + jmlNyata - scale10, garisTop + i * jarak + scale25);
                        drawText(context, Number(data.pangkat[i].top).toLocaleString('id'), "white", "left", tengahGambar - jmlTop + scale10, garisTop + i * jarak + tebalBar + scale25);
                    } else {
                        drawText(context, Number(data.pangkat[i].nyata).toLocaleString('id'), "black", "left", tengahGambar + jmlNyata + 5 * scale, garisTop + i * jarak + scale25);
                        drawText(context, Number(data.pangkat[i].top).toLocaleString('id'), "white", "right", tengahGambar - jmlTop - 5 * scale, garisTop + i * jarak + tebalBar + scale25);
                    }
                    total_nyata += parseInt(data.pangkat[i].nyata);
                    total_top += parseInt(data.pangkat[i].top);
                }

                // text pati
                setFont(context, "Agency FB", scale20);
                drawText(context, data.tingkat[0].label + " (" + Number(data.tingkat[0].top).toLocaleString('id') + ")", "black", "center", tengahGambar - 200 * scale, garisTop + 4 * jarak - 30);
                drawText(context, data.tingkat[0].label + " (" + Number(data.tingkat[0].nyata).toLocaleString('id') + ")", "black", "center", tengahGambar + 200 * scale, garisTop + 4 * jarak - 30);
                // text pamen
                drawText(context, data.tingkat[1].label + " (" + Number(data.tingkat[1].top).toLocaleString('id') + ")", "black", "right", tengahGambar - 200 * scale, garisTop + 7 * jarak - 30);
                drawText(context, data.tingkat[1].label + " (" + Number(data.tingkat[1].nyata).toLocaleString('id') + ")", "black", "left", tengahGambar + 200 * scale, garisTop + 7 * jarak - 30);
                // text pama
                drawText(context, data.tingkat[2].label + " (" + Number(data.tingkat[2].top).toLocaleString('id') + ")", "black", "right", tengahGambar - 140 * scale, garisTop + 9 * jarak - 30);
                drawText(context, data.tingkat[2].label + " (" + Number(data.tingkat[2].nyata).toLocaleString('id') + ")", "black", "left", tengahGambar + 140 * scale, garisTop + 9 * jarak - 30);
                // text perwira
                drawText(context, data.golongan[0].label, "black", "right", tengahGambar - 310 * scale, garisTop + tebalBar);
                drawText(context, "(" + Number(data.golongan[0].top).toLocaleString('id') + ")", "black", "right", tengahGambar - 310 * scale, garisTop + tebalBar + scale20);
                drawText(context, data.golongan[0].label, "black", "left", tengahGambar + 310 * scale, garisTop + tebalBar);
                drawText(context, "(" + Number(data.golongan[0].nyata).toLocaleString('id') + ")", "black", "left", tengahGambar + 310 * scale, garisTop + tebalBar + scale20);
                // text bintara
                drawText(context, data.golongan[1].label, "black", "right", tengahGambar - 310 * scale, garisTop + 9 * jarak + tebalBar);
                drawText(context, "(" + Number(data.golongan[1].top).toLocaleString('id') + ")", "black", "right", tengahGambar - 310 * scale, garisTop + 9 * jarak + tebalBar + scale20);
                drawText(context, data.golongan[1].label, "black", "left", tengahGambar + 310 * scale, garisTop + 9 * jarak + tebalBar);
                drawText(context, "(" + Number(data.golongan[1].nyata).toLocaleString('id') + ")", "black", "left", tengahGambar + 310 * scale, garisTop + 9 * jarak + tebalBar + scale20);
                // text tamtama
                drawText(context, data.golongan[2].label, "black", "right", tengahGambar - 310 * scale, garisTop + 12 * jarak + tebalBar);
                drawText(context, "(" + Number(data.golongan[2].top).toLocaleString('id') + ")", "black", "right", tengahGambar - 310 * scale, garisTop + 12 * jarak + tebalBar + scale20);
                drawText(context, data.golongan[2].label, "black", "left", tengahGambar + 310 * scale, garisTop + 12 * jarak + tebalBar);
                drawText(context, "(" + Number(data.golongan[2].nyata).toLocaleString('id') + ")", "black", "left", tengahGambar + 310 * scale, garisTop + 12 * jarak + tebalBar + scale20);
            }

            // Note
            drawText(context, "1.  " + NiceText(data.tingkat[0].label) + " (" + Number(data.tingkat[0].nyata).toLocaleString('id') + " = " + (data.tingkat[0].top > 0 ? data.tingkat[0].nyata / data.tingkat[0].top * 100 : 0).toLocaleString('id') + " %)", "black", "left", 10, garisTop + jumlahPangkat * jarak + 100 * scale);
            drawText(context, "2.  " + NiceText(data.tingkat[1].label) + " (" + Number(data.tingkat[1].nyata).toLocaleString('id') + " = " + (data.tingkat[1].top > 0 ? data.tingkat[1].nyata / data.tingkat[1].top * 100 : 0).toLocaleString('id') + " %)", "black", "left", 10, garisTop + jumlahPangkat * jarak + 120 * scale);
            drawText(context, "3.  " + NiceText(data.tingkat[2].label) + " (" + Number(data.tingkat[2].nyata).toLocaleString('id') + " = " + (data.tingkat[2].top > 0 ? data.tingkat[2].nyata / data.tingkat[2].top * 100 : 0).toLocaleString('id') + " %)", "black", "left", 10, garisTop + jumlahPangkat * jarak + 140 * scale);
            drawText(context, "4.  " + NiceText(data.golongan[1].label) + " (" + Number(data.golongan[1].nyata).toLocaleString('id') + " = " + (data.golongan[1].top > 0 ? data.golongan[1].nyata / data.golongan[1].top * 100 : 0).toLocaleString('id') + " %)", "black", "left", 10, garisTop + jumlahPangkat * jarak + 160 * scale);
            drawText(context, "5.  " + NiceText(data.golongan[2].label) + " (" + Number(data.golongan[2].nyata).toLocaleString('id') + " = " + (data.golongan[2].top > 0 ? data.golongan[2].nyata / data.golongan[2].top * 100 : 0).toLocaleString('id') + " %)", "black", "left", 10, garisTop + jumlahPangkat * jarak + 180 * scale);
            drawText(context, "6.  " + "Jumlah " + NiceText(data.struktur) + " Struktur (" + total_nyata.toLocaleString('id') + " = " + (total_top > 0 ? total_nyata / total_top * 100 : 0).toLocaleString('id') + " %)", "black", "left", 10, garisTop + jumlahPangkat * jarak + 200 * scale);

            context.beginPath();
            context.moveTo(800, garisTop + jumlahPangkat * jarak + 100 * scale);
            context.lineTo(800, garisTop + jumlahPangkat * jarak + 120 * scale);
            context.lineTo(820, garisTop + jumlahPangkat * jarak + 120 * scale);
            context.lineTo(820, garisTop + jumlahPangkat * jarak + 100 * scale);
            context.closePath();
            context.fillStyle = "#000000";
            context.fill();
            context.lineWidth = 1;
            context.strokeStyle = "#000000";
            context.stroke();
            drawText(context, "Kekuatan sesuai TDP/DSPP", "black", "left", 830, garisTop + jumlahPangkat * jarak + 116 * scale);

            context.beginPath();
            context.moveTo(800, garisTop + jumlahPangkat * jarak + 130 * scale);
            context.lineTo(800, garisTop + jumlahPangkat * jarak + 150 * scale);
            context.lineTo(820, garisTop + jumlahPangkat * jarak + 150 * scale);
            context.lineTo(820, garisTop + jumlahPangkat * jarak + 130 * scale);
            context.closePath();
            context.fillStyle = "#FFFFFF";
            context.fill();
            context.lineWidth = 1;
            context.strokeStyle = "#000000";
            context.stroke();
            drawText(context, "Kekuatan sesuai kondisi Nyata", "black", "left", 830, garisTop + jumlahPangkat * jarak + 146 * scale);

        }
    };
    window.MabesChart = MabesChart;
})();


text: Glowbo is HYPER


text:
package org.apache.tomcat.util.bcel.classfile;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;

import org.apache.tomcat.util.bcel.Constants;
import org.apache.tomcat.util.bcel.util.BCELComparator;

/**
 * Abstract superclass for classes to represent the different constant types
 * in the constant pool of a class file. The classes keep closely to
 * the JVM specification.
 *
 * @version $Id: Constant.java 992409 2010-09-03 18:35:59Z markt $
 * @author  M. Dahm
 */
public abstract class Constant implements Cloneable, Serializable {

    private static final long serialVersionUID = 2827409182154809454L;
    private static BCELComparator _cmp = new BCELComparator() {

        @Override
        public boolean equals( Object o1, Object o2 ) {
            Constant THIS = (Constant) o1;
            Constant THAT = (Constant) o2;
            return THIS.toString().equals(THAT.toString());
        }

        @Override
        public int hashCode( Object o ) {
            Constant THIS = (Constant) o;
            return THIS.toString().hashCode();
        }
    };
    /* In fact this tag is redundant since we can distinguish different
     * `Constant' objects by their type, i.e., via `instanceof'. In some
     * places we will use the tag for switch()es anyway.
     *
     * First, we want match the specification as closely as possible. Second we
     * need the tag as an index to select the corresponding class name from the
     * `CONSTANT_NAMES' array.
     */
    protected byte tag;

    Constant(byte tag) {
        this.tag = tag;
    }

    public abstract void dump( DataOutputStream file ) throws IOException;

    /**
     * @return Tag of constant, i.e., its type. No setTag() method to avoid
     * confusion.
     */
    public final byte getTag() {
        return tag;
    }

    /**
     * @return String representation.
     */
    @Override
    public String toString() {
        return Constants.CONSTANT_NAMES[tag] + "[" + tag + "]";
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    /**
     * Read one constant from the given file, the type depends on a tag byte.
     *
     * @param file Input stream
     * @return Constant object
     */
    static final Constant readConstant( DataInputStream file ) throws IOException,
            ClassFormatException {
        byte b = file.readByte(); // Read tag byte
        switch (b) {
            case Constants.CONSTANT_Class:
                return new ConstantClass(file);
            case Constants.CONSTANT_Fieldref:
                return new ConstantFieldref(file);
            case Constants.CONSTANT_Methodref:
                return new ConstantMethodref(file);
            case Constants.CONSTANT_InterfaceMethodref:
                return new ConstantInterfaceMethodref(file);
            case Constants.CONSTANT_String:
                return new ConstantString(file);
            case Constants.CONSTANT_Integer:
                return new ConstantInteger(file);
            case Constants.CONSTANT_Float:
                return new ConstantFloat(file);
            case Constants.CONSTANT_Long:
                return new ConstantLong(file);
            case Constants.CONSTANT_Double:
                return new ConstantDouble(file);
            case Constants.CONSTANT_NameAndType:
                return new ConstantNameAndType(file);
            case Constants.CONSTANT_Utf8:
                return new ConstantUtf8(file);
            default:
                throw new ClassFormatException("Invalid byte tag in constant pool: " + b);
        }
    }

    /**
     * Return value as defined by given BCELComparator strategy.
     * By default two Constant objects are said to be equal when
     * the result of toString() is equal.
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals( Object obj ) {
        return _cmp.equals(this, obj);
    }

    /**
     * Return value as defined by given BCELComparator strategy.
     * By default return the hashcode of the result of toString().
     *
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return _cmp.hashCode(this);
    }
}


text:
extern int undo_current;		// Current undo level in buffer
extern int undo_last;			// Last undo level in buffer
extern int undo_save;			// Last undo level that was saved

void redo_cb(Fl_Widget *, void *);	// Redo menu callback
void undo_cb(Fl_Widget *, void *);	// Undo menu callback
void undo_checkpoint();			// Save current file to undo buffer
void undo_clear();			// Clear undo buffer
void undo_resume();			// Resume undo checkpoints
void undo_suspend();			// Suspend undo checkpoints

#endif // !undo_h

//
// End of "$Id$".
//


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

/// <summary>
/// This controller is driven by being directly connected to a
/// data group, allowing it to react to the music.
/// </summary>
[AddComponentMenu("Visualizer Studio/Controllers/Frequency Controller")]
public class VisFrequencyController : VisBaseController, IVisDataGroupTarget
{
	#region Defaults Static Class

	/// <summary>
	/// This internal class holds all of the defaults of the VisFrequencyController class.
	/// </summary>
	public new static class Defaults
	{
		public const VisDataValueType subValueType = VisDataValueType.Sum;
		public const VisDataValueType finalValueType = VisDataValueType.Average;
	}

	#endregion

	#region IVisDataGroupTarget Implementation

	/// <summary>
	///	This is the data group that this controller is targeting.
	/// </summary>
	//[HideInInspector()]
	[SerializeField()]
    private VisDataGroup dataGroup = null;

    /// <summary>
    /// This is the name of the last data group that was set to this base modifier
    /// </summary>
    [HideInInspector()]
    [SerializeField()]
    private string m_szLastDataGroupName = null;

	/// <summary>
	/// This property gets/sets the target data group for this controller.
	/// </summary>
	public VisDataGroup DataGroup
	{
        get { return dataGroup; }
        set
        {
            dataGroup = value;
            if (dataGroup != null)
                m_szLastDataGroupName = dataGroup.dataGroupName;
            else
                m_szLastDataGroupName = null;
        }
    }

    /// <summary>
    /// This gets the name of the last data group that was set to this target.
    /// </summary>
    public string LastDataGroupName
    {
        get { return m_szLastDataGroupName; }
    }

	#endregion

	#region Public Member Variables

	/// <summary>
	/// This is the value type to pull from all of the sub data
	/// groups on the target data group.  Such as the Maximum
	/// of each sub data group values.
    /// </summary>
    //[HideInInspector()]
	public VisDataValueType subValueType = Defaults.subValueType;

	/// <summary>
	/// This is the final value type to pull from the result of the
	/// sub data groups.  Such as, the Average (final value type)
	/// of the Maximums (sub value type).
    /// </summary>
    //[HideInInspector()]
	public VisDataValueType finalValueType = Defaults.finalValueType;

	#endregion

	#region Init/Deinit Functions

	/// <summary>
	/// This function resets this controller to default values
	/// </summary>
	public override void Reset()
	{
		base.Reset();

		subValueType = Defaults.subValueType;
		finalValueType = Defaults.finalValueType;
	}

	/// <summary>
	/// The main start function.
	/// </summary>
	public override void Start()
	{
		base.Start();

		if (base.Manager == null)
				Debug.LogError("This controller must have a VisManager assigned to it in order to function.");
		if (dataGroup == null)
			Debug.LogError("This controller must have a VisDataGroup assigned to it in order to function. Please double check the spelling of the target data group.");
	}

	#endregion

	#region VisBaseController Implementation

	/// <summary>
	/// This function returns the current value for this controller.
	/// TO IMPLEMENT A CUSTOM CONTROLLER, override this function
	/// to return the current target value.
	/// </summary>
	/// <returns>
	/// The custom controller value.
	/// </returns>
	public override float GetCustomControllerValue()
	{
		if (dataGroup != null)
		{
			return dataGroup.GetValue(finalValueType, subValueType);
		}
		return base.GetCustomControllerValue();
	}

	#endregion

	#region Debug Functions

	/// <summary>
	/// This displays the debug information of this controller.
	/// </summary>
	/// <param name="x">
	/// The x location to display this data group.
	/// </param>
	/// <param name="y">
	/// The y location to display this data group.
	/// </param>
	/// <param name="barWidth">
	/// This is the width in pixels of the debug bars.
	/// </param>
	/// <param name="barHeight">
	/// This is the height in pixels of the debug bars.
	/// </param>
	/// <param name="separation">
	/// This is the separation in pixels of the debug bars.
	/// </param>
	/// <param name="debugTexture">
	/// This is the texture used to display the debug information.
	/// </param>
	/// <returns>
	/// This is the rect of the of the debug information that was displayed.
	/// </returns>
	public override Rect DisplayDebugGUI(int x, int y, int barWidth, int barHeight, int separation, Texture debugTexture)
	{
		if (debugTexture != null)
		{
			int labelWidth = 150;
			int labelHeight = 20;
			int padding = 5;
			int frameWidth = Mathf.Max(barWidth, labelWidth) + padding * 2;
			int frameHeight = padding * 2 + labelHeight * 5 + barHeight;
			Rect frameRect = new Rect(x - padding, y - padding, frameWidth, frameHeight);

            GUI.BeginGroup(frameRect);
            GUI.color = new Color(0, 0, 0, 0.5f);
            GUI.DrawTexture(new Rect(0, 0, frameRect.width, frameRect.height), debugTexture);
            GUI.color = Color.white;
			GUI.Label(new Rect(padding, padding, labelWidth, labelHeight + 3), "Controller: \"" + controllerName + "\"");
			GUI.Label(new Rect(padding, padding + labelHeight, labelWidth, labelHeight + 3), "Data Group: \"" + (dataGroup != null ? dataGroup.dataGroupName : "NONE") + "\"");
			GUI.Label(new Rect(padding, padding + labelHeight * 2, labelWidth, labelHeight + 3), "Sub Type: \"" + subValueType + "\"");
			GUI.Label(new Rect(padding, padding + labelHeight * 3, labelWidth, labelHeight + 3), "Final Type: \"" + finalValueType + "\"");
			GUI.Label(new Rect(padding, padding + labelHeight * 4, labelWidth, labelHeight + 3), "VALUE: " + GetCurrentValue().ToString("F4"));

			float perc = ((m_fValue - MinValue) / (MaxValue - MinValue)) * 0.975f + 0.025f;
			if (dataGroup != null)
				GUI.color = dataGroup.debugColor;
			GUI.DrawTexture(new Rect(padding, padding + labelHeight * 5, (int)(((float)barWidth)*perc), barHeight), debugTexture);

			GUI.color = Color.white;
			GUI.DrawTexture(new Rect(0, 0, frameWidth, 1), debugTexture);
			GUI.DrawTexture(new Rect(0, frameHeight - 1, frameWidth, 1), debugTexture);
			GUI.DrawTexture(new Rect(0, 0, 1, frameHeight), debugTexture);
			GUI.DrawTexture(new Rect(frameWidth - 1, 0, 1, frameHeight), debugTexture);
			GUI.EndGroup();

			return frameRect;
		}
		return new Rect(0,0,0,0);
	}

	#endregion
}


text:
// 32feet.NET - Personal Area Networking for .NET
//
// Copyright (c) 2013 Alan J McFarlane, All rights reserved.
// Copyright (c) 2013 In The Hand Ltd, All rights reserved.
// This source code is licensed under the MIT License

#if ANDROID_BTH
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Android.Bluetooth;
using System.Diagnostics;

namespace InTheHand.Net.Bluetooth.Droid
{
    class AndroidBthSocketStream : Utils.PairStream
    {
        BluetoothSocket _sock;
        readonly Stream _in;
        readonly Stream _out;

        internal AndroidBthSocketStream(BluetoothSocket sock)
            : base(sock.InputStream, sock.OutputStream)
        {
            Debug.Assert(sock != null, "sock IS null");
            _sock = sock;
            _in = _sock.InputStream;
            _out = _sock.OutputStream;
        }

        ~AndroidBthSocketStream()
        {
            Dispose(false);
        }

        protected override void Dispose(bool disposing)
        {
            try {
                base.Dispose(disposing);
            } finally {
                _sock.Close();
            }
        }

    }
}
#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<com.yeungeek.hencoder.draw3.sample.Sample01DrawTextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Canvas 2d Context Font Property Speed</title>
</head>
<body>
  <canvas id='thecanvas' height=100 width=100/>
  <script>
    var canvas = document.getElementById('thecanvas');
    var context = canvas.getContext('2d');
    var t0 = Date.now();
    for (var i = 0; i < 1000; i++) {
      if(i % 2 == 0)
        context.font = 'bold 13px Arial';
      else
        context.font = 'italic 13px Arial';
    }
    alert('Elapsed for 1000 font switches: ' + (Date.now() - t0));
  </script>
</body>
</html>


text:
describe group('ibm') do
  it { should exist }
end

describe user('ibm') do
  it { should exist }
  its('groups') { should eq ['ibm'] }
end

describe file('/opt/IBM/InstallationManager/eclipse/tools/imcl') do
  it { should exist }
end

describe command('/opt/IBM/InstallationManager/eclipse/tools/imcl listInstalledPackages') do
  its(:stdout) { should match(/com.ibm.websphere.ND.v85_8.5.5014.*/) }
  its(:stdout) { should match(/com.ibm.websphere.IBMJAVA.v80_8.0.*/) }
end

describe command('/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -conntype SOAP -host localhost -user admin -password '\
  'admin -c "AdminServerManagement.listServers(\'\', \'\')"') do
  its(:stdout) { should match(%r{nodeagent\(cells/MyNewCell/nodes/AppProfile1_node/servers/nodeagent}) }
  its(:stdout) { should match(%r{dmgr\(cells/MyNewCell/nodes/MyNewNode/servers/dmgr}) }
end

# check dmgr security attribtue is set
describe command('/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -conntype SOAP -host localhost -user admin '\
  '-password admin -c "AdminTask.isAppSecurityEnabled()"') do
  its(:stdout) { should match(/true/) }
end

services = %w(Dmgr01 AppProfile1_node)
services.each do |service|
  describe service(service) do
    it { should be_enabled }
    it { should be_running }
  end
end

describe file('/etc/init.d/Dmgr01') do
  its(:content) { should match(/startScript=startManager.sh/) }
end
describe file('/etc/init.d/AppProfile1_node') do
  its(:content) { should match(/startScript=startServer.sh/) }
end

ports = %w(9043 8879)
ports.each do |p|
  describe port(p) do
    it { should be_listening }
  end
end

# java tests
describe command('/opt/IBM/WebSphere/AppServer/bin/managesdk.sh -listEnabledProfile -profileName AppProfile1') do
  its(:stdout) { should match(/Node AppProfile1_node SDK name: 1.8_64/) }
end


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

package com.google.exposurenotification.privateanalytics.ingestion.pipeline;

import static com.google.common.truth.Truth.assertThat;
import static com.google.exposurenotification.privateanalytics.ingestion.pipeline.FirestoreConnector.formatDateTime;
import static org.junit.Assert.assertThrows;

import com.google.api.core.ApiFutures;
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.api.gax.rpc.NotFoundException;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.v1.FirestoreClient;
import com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
import com.google.cloud.firestore.v1.FirestoreSettings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Streams;
import com.google.firestore.v1.BatchWriteRequest;
import com.google.firestore.v1.DatabaseRootName;
import com.google.firestore.v1.Document;
import com.google.firestore.v1.GetDocumentRequest;
import com.google.firestore.v1.ListDocumentsRequest;
import com.google.firestore.v1.Write;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.beam.runners.dataflow.options.DataflowPipelineOptions;
import org.apache.beam.sdk.PipelineResult;
import org.apache.beam.sdk.metrics.MetricNameFilter;
import org.apache.beam.sdk.metrics.MetricsFilter;
import org.apache.beam.sdk.testing.NeedsRunner;
import org.apache.beam.sdk.testing.TestPipeline;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Integration tests for {@link DeletionPipeline}. */
@RunWith(JUnit4.class)
public class DeletionPipelineIT {

  // Randomize document creation time to avoid collisions between simultaneously running tests.
  // FirestoreReader will query all documents with created times within one hour of this time.
  static final long CREATION_TIME = ThreadLocalRandom.current().nextLong(0L, 1500000000L);
  static final long DURATION = 10800L;
  static final String PROJECT = System.getenv("PROJECT");
  // Randomize test collection name to avoid collisions between simultaneously running tests.
  static final String TEST_COLLECTION_NAME =
      "uuid" + UUID.randomUUID().toString().replace("-", "_");
  static final String KEY_RESOURCE_NAME = System.getenv("KEY_RESOURCE_NAME");
  static final DatabaseRootName DATABASE_ROOT_NAME = DatabaseRootName.of(PROJECT, "(default)");
  static final String BASE_COLLECTION_NAME =
      String.format("%s/documents/%s", DATABASE_ROOT_NAME, TEST_COLLECTION_NAME);

  List<String> documentNames;
  FirestoreClient client;

  public transient IngestionPipelineOptions testOptions =
      TestPipeline.testingPipelineOptions().as(IngestionPipelineOptions.class);

  @Rule public final transient TestPipeline testPipeline = TestPipeline.fromOptions(testOptions);

  @Before
  public void setUp() throws IOException {
    documentNames = new ArrayList<>();
    client = getFirestoreClient();
  }

  @After
  public void tearDown() throws ExecutionException, InterruptedException {
    cleanUpParentResources(client);
    FirestoreClientTestUtils.shutdownFirestoreClient(client);
  }

  @Test
  @Category(NeedsRunner.class)
  public void testFirestoreDeleterDeletesDocs() throws InterruptedException {
    testOptions.as(DataflowPipelineOptions.class).setMaxNumWorkers(1);
    testOptions.setStartTime(CREATION_TIME);
    testOptions.setProject(PROJECT);
    testOptions.setDuration(DURATION);
    testOptions.setKeyResourceName(KEY_RESOURCE_NAME);
    int numDocs = 500;
    seedDatabase(numDocs);

    DeletionPipeline.buildDeletionPipeline(testOptions, testPipeline);
    PipelineResult result = testPipeline.run();
    result.waitUntilFinish();

    // Assert that processed documents have been deleted.
    documentNames.forEach(
        name ->
            assertThrows(NotFoundException.class, () -> fetchDocumentFromFirestore(name, client)));
    MetricNameFilter documentsDeletedMetricName =
        MetricNameFilter.named(
            "org.apache.beam.sdk.io.gcp.firestore.FirestoreV1.BatchWrite", "writes_successful");
    long documentsDeleted =
        result
            .metrics()
            .queryMetrics(MetricsFilter.builder().addNameFilter(documentsDeletedMetricName).build())
            .getCounters()
            .iterator()
            .next()
            .getCommitted();
    assertThat(documentsDeleted).isEqualTo(numDocs);
  }

  private static FirestoreClient getFirestoreClient() throws IOException {
    FirestoreSettings settings =
        FirestoreSettings.newBuilder()
            .setCredentialsProvider(
                FixedCredentialsProvider.create(GoogleCredentials.getApplicationDefault()))
            .build();
    return FirestoreClient.create(settings);
  }

  private static void cleanUpParentResources(FirestoreClient client)
      throws ExecutionException, InterruptedException {
    ListDocumentsPagedResponse documents =
        client.listDocuments(
            ListDocumentsRequest.newBuilder()
                .setParent("projects/" + PROJECT + "/databases/(default)/documents")
                .setCollectionId(TEST_COLLECTION_NAME)
                .build());
    ApiFutures.allAsList(
            Streams.stream(Iterables.partition(documents.iterateAll(), 500))
                .map(
                    docs ->
                        docs.stream()
                            .map(Document::getName)
                            .map(name -> Write.newBuilder().setDelete(name).build())
                            .collect(Collectors.toList()))
                .map(DeletionPipelineIT::getBatchWriteRequest)
                .map(request -> client.batchWriteCallable().futureCall(request))
                .collect(Collectors.toList()))
        .get();
  }

  private static Document fetchDocumentFromFirestore(String path, FirestoreClient client) {
    return client.getDocument(GetDocumentRequest.newBuilder().setName(path).build());
  }

  private void seedDatabase(int numDocsToSeed) throws InterruptedException {
    // Adding a wait here to give the Firestore instance time to initialize before attempting
    // to connect.
    TimeUnit.SECONDS.sleep(1);
    documentNames =
        IntStream.rangeClosed(1, numDocsToSeed)
            .mapToObj(
                i ->
                    String.format(
                        "%s/testDoc%05d/%s/metric1",
                        BASE_COLLECTION_NAME, i, formatDateTime(CREATION_TIME)))
            .collect(Collectors.toList());

    List<BatchWriteRequest> batchWriteRequests =
        Streams.stream(Iterables.partition(documentNames, 500))
            .map(
                names ->
                    names.stream()
                        .map(
                            name ->
                                Write.newBuilder()
                                    .setUpdate(Document.newBuilder().setName(name).build())
                                    .build())
                        .collect(Collectors.toList()))
            .map(DeletionPipelineIT::getBatchWriteRequest)
            .collect(Collectors.toList());

    for (BatchWriteRequest batchWriteRequest : batchWriteRequests) {
      client.batchWrite(batchWriteRequest);
    }
  }

  private static BatchWriteRequest getBatchWriteRequest(List<Write> writes) {
    return BatchWriteRequest.newBuilder()
        .setDatabase(DATABASE_ROOT_NAME.toString())
        .addAllWrites(writes)
        .build();
  }
}


text:
layout: post
title: 4/6/16 Weekly Meeting Update
author: Sarah
category: feed
---

Come see us in CCB 346 this Tuesday at 6:00pm for our project meeting where we'll be working on developing our ROS for the car project. This Wednesday we will be having our weekly club meeting in CCB 345 at 6:30pm on word2vec! Join us for pizza, drinks, and knowledge:)

Make sure to follow us on [twitter](https://twitter.com/TheAgencyGT) for important updates throughout the meeting!

You can find Wednesday's talk slides [here!](https://l.facebook.com/l.php?u=https%3A%2F%2Fdocs.google.com%2Fpresentation%2Fd%2F1FPjOyPCrW-wD77NZX63rgM3QrG74gLGVcnT_xNrUTuM%2Fedit%3Fusp%3Dsharing&h=uAQH19gZu)

See you soon!


text:
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import Card, { CardActions, CardContent } from 'material-ui/Card';
import Button from 'material-ui/Button';
import Typography from 'material-ui/Typography';

const styles = {
  card: {
    minWidth: 275,
  },
  bullet: {
    display: 'inline-block',
    margin: '0 2px',
    transform: 'scale(0.8)',
  },
  title: {
    marginBottom: 16,
    fontSize: 14,
  },
  pos: {
    marginBottom: 12,
  },
};

function SimpleCard(props) {
  const { classes } = props;
  const bull = •;

  return (

      <Card className={classes.card}>
        <CardContent>
          <Typography className={classes.title} color="textSecondary">
            Word of the Day
          </Typography>
          <Typography variant="headline" component="h2">
            be{bull}nev{bull}o{bull}lent
          </Typography>
          <Typography className={classes.pos} color="textSecondary">
            adjective
          </Typography>
          <Typography component="p">
            well meaning and kindly.

            {'"a benevolent smile"'}
          </Typography>
        </CardContent>
        <CardActions>
          <Button size="small">Learn More</Button>
        </CardActions>
      </Card>

  );
}

SimpleCard.propTypes = {
  classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(SimpleCard);


text:
package org.eclipse.deeplearning4j.nd4j.autodiff.internal;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.nd4j.autodiff.samediff.internal.DependencyList;
import org.nd4j.autodiff.samediff.internal.DependencyTracker;
import org.nd4j.autodiff.samediff.internal.IdentityDependencyTracker;
import org.nd4j.common.primitives.Pair;
import org.nd4j.common.tests.tags.NativeTag;
import org.nd4j.common.tests.tags.TagNames;
import org.nd4j.linalg.BaseNd4jTestWithBackends;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.factory.Nd4jBackend;

import java.util.Collections;

import static org.junit.jupiter.api.Assertions.*;
@Tag(TagNames.JAVA_ONLY)
public class TestDependencyTracker extends BaseNd4jTestWithBackends {

    @Override
    public char ordering() {
        return 'c';
    }

    private static <E> boolean isNullOrEmpty(Iterable<E> iterable) {
        if (iterable != null) {

            for (E e : iterable) {
                if (e != null)
                    return false;
            }
        }
        return true;

    }

    @ParameterizedTest
    @MethodSource("org.nd4j.linalg.BaseNd4jTestWithBackends#configs")
    public void testSimple(Nd4jBackend backend){

        DependencyTracker<String,String> dt = new DependencyTracker<>();

        dt.addDependency("y", "x");
        assertTrue(dt.hasDependency("y"));
        assertFalse(dt.hasDependency("x"));
        assertFalse(dt.hasDependency("z"));

        DependencyList<String,String> dl = dt.getDependencies("y");
        assertEquals("y", dl.getDependencyFor());
        assertNotNull(dl.getDependencies());
        assertNull(dl.getOrDependencies());
        assertEquals(Collections.singletonList("x"), dl.getDependenciesAsCollection());

        dt.removeDependency("y", "x");
        assertFalse(dt.hasDependency("y"));
        assertFalse(dt.hasDependency("x"));
        dl = dt.getDependencies("y");
        assertTrue(isNullOrEmpty(dl.getDependencies()));
        assertTrue(isNullOrEmpty(dl.getOrDependencies()));

        //Or dep
        dt.addOrDependency("y", "x1", "x2");
        assertTrue(dt.hasDependency("y"));
        dl = dt.getDependencies("y");
        assertTrue(isNullOrEmpty(dl.getDependencies()));
        assertTrue(!isNullOrEmpty(dl.getOrDependencies()));
        assertEquals(Collections.singletonList(new Pair<>("x1", "x2")), dl.getOrDependenciesAsCollection());

        dt.removeDependency("y", "x1");
        assertFalse(dt.hasDependency("y"));
        dl = dt.getDependencies("y");
        assertTrue(isNullOrEmpty(dl.getDependencies()));
        assertTrue(isNullOrEmpty(dl.getOrDependencies()));

        dt.addOrDependency("y", "x1", "x2");
        dl = dt.getDependencies("y");
        assertTrue(isNullOrEmpty(dl.getDependencies()));
        assertTrue(!isNullOrEmpty(dl.getOrDependencies()));
        assertEquals(Collections.singletonList(new Pair<>("x1", "x2")), dl.getOrDependenciesAsCollection());
        dt.removeDependency("y", "x2");
        assertTrue(dt.isEmpty());
    }

    @ParameterizedTest
    @MethodSource("org.nd4j.linalg.BaseNd4jTestWithBackends#configs")
    public void testSatisfiedBeforeAdd(Nd4jBackend backend) {
        DependencyTracker<String,String> dt = new DependencyTracker<>();

        //Check different order of adding dependencies: i.e., mark X as satisfied, then add x -> y dependency
        // and check that y is added to satisfied list...
        dt.markSatisfied("x", true);
        dt.addDependency("y", "x");
        assertTrue(dt.hasNewAllSatisfied());
        assertEquals("y", dt.getNewAllSatisfied());

        //Same as above - x satisfied, add x->y, then add z->y
        //y should go from satisfied to not satisfied
        dt.clear();
        assertTrue(dt.isEmpty());
        dt.markSatisfied("x", true);
        dt.addDependency("y", "x");
        assertTrue(dt.hasNewAllSatisfied());
        dt.addDependency("y", "z");
        assertFalse(dt.hasNewAllSatisfied());

        //x satisfied, then or(x,y) -> z added
        dt.markSatisfied("x", true);
        dt.addOrDependency("z", "x", "y");
        assertTrue(dt.hasNewAllSatisfied());
        assertEquals("z", dt.getNewAllSatisfied());

        //x satisfied, then or(x,y) -> z added, then or(a,b)->z added (should be unsatisfied)
        dt.clear();
        assertTrue(dt.isEmpty());
        dt.markSatisfied("x", true);
        dt.addOrDependency("z", "x", "y");
        assertTrue(dt.hasNewAllSatisfied());
        dt.addOrDependency("z", "a", "b");
        assertFalse(dt.hasNewAllSatisfied());
    }

    @ParameterizedTest
    @MethodSource("org.nd4j.linalg.BaseNd4jTestWithBackends#configs")
    public void testMarkUnsatisfied(Nd4jBackend backend){

        DependencyTracker<String,String> dt = new DependencyTracker<>();
        dt.addDependency("y", "x");
        dt.markSatisfied("x", true);
        assertTrue(dt.hasNewAllSatisfied());

        dt.markSatisfied("x", false);
        assertFalse(dt.hasNewAllSatisfied());
        dt.markSatisfied("x", true);
        assertTrue(dt.hasNewAllSatisfied());
        assertEquals("y", dt.getNewAllSatisfied());
        assertFalse(dt.hasNewAllSatisfied());

        //Same for OR dependencies
        dt.clear();
        assertTrue(dt.isEmpty());
        dt.addOrDependency("z", "x", "y");
        dt.markSatisfied("x", true);
        assertTrue(dt.hasNewAllSatisfied());

        dt.markSatisfied("x", false);
        assertFalse(dt.hasNewAllSatisfied());
        dt.markSatisfied("x", true);
        assertTrue(dt.hasNewAllSatisfied());
        assertEquals("z", dt.getNewAllSatisfied());
        assertFalse(dt.hasNewAllSatisfied());
    }

    @ParameterizedTest
    @MethodSource("org.nd4j.linalg.BaseNd4jTestWithBackends#configs")
    @NativeTag
    public void testIdentityDependencyTracker(){
        IdentityDependencyTracker<INDArray, String> dt = new IdentityDependencyTracker<>();
        assertTrue(dt.isEmpty());

        INDArray y1 = Nd4j.scalar(0);
        INDArray y2 = Nd4j.scalar(0);
        String x1 = "x1";
        dt.addDependency(y1, x1);

        assertFalse(dt.hasNewAllSatisfied());
        assertTrue(dt.hasDependency(y1));
        assertFalse(dt.hasDependency(y2));
        assertFalse(dt.isSatisfied(x1));

        DependencyList<INDArray, String> dl = dt.getDependencies(y1);
        assertSame(y1, dl.getDependencyFor());      //Should be same object
        assertEquals(Collections.singletonList(x1), dl.getDependenciesAsCollection());
        assertNull(dl.getOrDependencies());

        //Mark as satisfied, check if it's added to list
        dt.markSatisfied(x1, true);
        assertTrue(dt.isSatisfied(x1));
        assertTrue(dt.hasNewAllSatisfied());
        INDArray get = dt.getNewAllSatisfied();
        assertSame(y1, get);
        assertFalse(dt.hasNewAllSatisfied());
    }

}


text:
#ifndef SPHEREVOLUMEEMITTER_H
#define SPHEREVOLUMEEMITTER_H

#include "baseParticleEmitter.h"

/**
 * Describes a voluminous spherical region in which particles are generated.
 */
class EXPCL_PANDAPHYSICS SphereVolumeEmitter : public BaseParticleEmitter {
PUBLISHED:
  SphereVolumeEmitter();
  SphereVolumeEmitter(const SphereVolumeEmitter &copy);
  virtual ~SphereVolumeEmitter();

  virtual BaseParticleEmitter *make_copy();

  INLINE void set_radius(PN_stdfloat r);
  INLINE PN_stdfloat get_radius() const;

  virtual void output(ostream &out) const;
  virtual void write(ostream &out, int indent=0) const;

private:
  PN_stdfloat _radius;

  // CUSTOM EMISSION PARAMETERS none

  // scratch variables that carry over from position calc to velocity calc
  LPoint3 _particle_pos;

  virtual void assign_initial_position(LPoint3& pos);
  virtual void assign_initial_velocity(LVector3& vel);
};

#include "sphereVolumeEmitter.I"

#endif // SPHEREVOLUMEEMITTER_H


text:
<?php

namespace spec\CarlosGoce\Expressive;

use CarlosGoce\Expressive\Execute;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

/**
 * Class ExecuteSpec
 * @package spec\CarlosGoce\Expressive
 * @mixin Execute
 */
class ExecuteSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('CarlosGoce\Expressive\Execute');
    }

    function it_can_execute_a_closure_and_return_its_value()
    {
        $this->it(function(){
            return true;
        })->shouldReturn(true);
    }

    function it_executes_a_closure_if_condition_is_true()
    {
        $closure = function() {
            return true;
        };

        $this->when(true, $closure)->shouldReturn(true);
        $this->when(false, $closure)->shouldReturn(null);
        $this->unless(true, $closure)->shouldReturn(null);
        $this->unless(false, $closure)->shouldReturn(true);
    }

}


text: Import-NpsConfiguration -Path "<%= scope['npsradius::configfile'] %>";


text:
namespace AcademyRPG
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    public class Giant : Character, IFighter, IGatherer
    {
        private bool increaseAttack;

        public Giant(string name, Point position) : base(name, position, 0)
        {
            this.HitPoints = 200;
            this.increaseAttack = false;
        }

        public bool IncreaseAttack
        {
            get { return this.increaseAttack; }
            private set
            {
                if (value == true)
                {
                    this.increaseAttack = value;
                }
            }
        }
        public int AttackPoints
        {
            get
            {
                if (increaseAttack)
                {
                    return 250;
                }
                return 150;
            }
        }

        public int DefensePoints
        {
            get
            {
                return 80;
            }
        }

        public int GetTargetIndex(List<WorldObject> availableTargets)
        {
            for (int i = 0; i < availableTargets.Count; i++)
            {
                if (availableTargets[i].Owner != 0)
                {
                    return i;
                }
            }

            return -1;
        }

        public bool TryGather(IResource resource)
        {
            if (resource.Type == ResourceType.Stone)
            {

                this.IncreaseAttack = true;

                return true;
            }

            return false;
        }
    }
}


text:
namespace SurgSim
{
namespace Math
{

/// Interval defines the concept of a mathematical interval and provides operations on it
/// including arithmetic operations, construction, and IO.
///
/// \tparam T underlying data type over which the interval is defined.
///
/// \sa IntervalND<T, N> and IntervalND<T, 3>
template <class T>
class Interval
{
	template <class P>
	friend void IntervalArithmetic_add(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // +
	template <class P>
	friend void IntervalArithmetic_addadd(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // +=( + )
	template <class P>
	friend void IntervalArithmetic_sub(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // -
	template <class P>
	friend void IntervalArithmetic_addsub(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // +=( - )
	template <class P>
	friend void IntervalArithmetic_mul(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // *
	template <class P>
	friend void IntervalArithmetic_addmul(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // += ( * )
	template <class P>
	friend void IntervalArithmetic_submul(const Interval<P>& a, const Interval<P>& b, Interval<P>* res); // -= ( * )

public:
	/// Constructor
	Interval();

	/// Constructor
	/// \param min Lower bound of the constructed interval
	/// \param max Upper bound of the constructed interval
	/// \exception if max is less than min
	Interval(const T& min, const T& max);

	/// Copy constructor
	/// \param i Interval to be copied
	Interval(const Interval<T>& i);

	/// Move constructor
	/// \param i Interval to be copied
	Interval(Interval<T>&& i);

	/// Assignment operator
	/// \param i Interval to be copied
	Interval<T>& operator =(const Interval<T>& i);

	/// Move assignment operator
	/// \param i Interval to be moved
	Interval<T>& operator=(Interval<T>&& i);

	/// Generate an interval from min to max based on the inputs
	/// \param a1 first input value
	/// \param a2 second input value
	/// \return an interval spanning the minimum input to the maximum input.
	static Interval<T> minToMax(const T& a1, const T& a2);

	/// Generate an interval from min to max based on the inputs
	/// \param a1 first input value
	/// \param a2 second input value
	/// \param a3 third input value
	/// \return an interval spanning the minimum input to the maximum input.
	static Interval<T> minToMax(const T& a1, const T& a2, const T& a3);

	/// Generate an interval from min to max based on the inputs
	/// \param a1 first input value
	/// \param a2 second input value
	/// \param a3 third input value
	/// \param a4 fourth input value
	/// \return an interval spanning the minimum input to the maximum input.
	static Interval<T> minToMax(const T& a1, const T& a2, const T& a3, const T& a4);

	/// \param i the interval the current interval will be tested against
	/// \return true if the input interval overlaps the current interval
	bool overlapsWith(const Interval<T>& i) const;

	/// \param val the value to test for inclusion in the interval
	/// \return true if the current interval contains val
	bool contains(const T& val) const;

	/// \return true if the current interval contains 0
	bool containsZero() const;

	/// \param i the interval to be tested
	/// \param epsilon the nearness parameter
	/// \return true if the current interval is within epsilon of the input interval
	bool isApprox(const Interval<T>& i, const T& epsilon) const;

	/// \param i the interval to be tested
	/// \return true if the current interval is identical to the input interval
	bool operator ==(const Interval<T>& i) const;

	/// \param i the interval to be tested
	/// \return true if the current interval is not identical to the input interval
	bool operator !=(const Interval<T>& i) const;

	/// Widens the current interval by thickness on both sides
	/// \param thickness the amount to widen the current interval on both sides
	/// \return the current interval after modification
	Interval<T>& addThickness(const T& thickness);

	/// Widens the current interval on one end to include x
	/// \param x the value to be included in the interval
	/// \return the current interval extended to include x
	Interval<T>& extendToInclude(const T& x);

	/// Widens the current interval on both ends to include i
	/// \param i the interval to be wholly contained in the current interval
	/// \return the current interval extended to include the entirety of i
	Interval<T>& extendToInclude(const Interval<T>& i);

	/// @{
	/// Standard arithmetic operators extended to intervals
	Interval<T> operator +(const Interval<T>& i) const;
	Interval<T> operator +(const T& v) const;
	Interval<T>& operator +=(const Interval<T>& i);
	Interval<T>& operator +=(const T& v);
	Interval<T> operator -() const;
	Interval<T> operator -(const Interval<T>& i) const;
	Interval<T> operator -(const T& v) const;
	Interval<T>& operator -=(const Interval<T>& i);
	Interval<T>& operator -=(const T& v);
	Interval<T> operator *(const Interval<T>& i) const;
	Interval<T> operator *(const T& v) const;
	Interval<T>& operator *=(const Interval<T>& i);
	Interval<T>& operator *=(const T& v);
	/// @}

	/// \return the inverse of the current interval
	/// \exception if the interval includes 0
	Interval<T> inverse() const;

	/// \param i the interval to be divided by
	/// \return the current interval multiplied by the inverse of i
	/// \exception if i includes 0
	Interval<T> operator /(const Interval<T>& i) const;

	/// \param i the interval to be divided by
	/// \return the current interval multiplied by the inverse of i
	/// \exception if i includes 0
	/// \note the current interval is modified by this operation
	Interval<T>& operator /=(const Interval<T>& i);

	/// \return the square of the current interval
	/// \note if the original interval contains 0, then the result will have the minimum identically set to 0
	Interval<T> square() const;

	/// \return the lower limit of the interval
	T getMin() const;

	/// \return the upper limit of the interval
	T getMax() const;

	/// \return the interval from the lower limit to the midpoint
	Interval<T> lowerHalf() const;

	/// \return the interval from the midpoint to the upper limit
	Interval<T> upperHalf() const;

private:
	/// The lower (m_min) and upper (m_max) limits of the interval
	T m_min, m_max;
};

/// IntervalND defines the concept of a group of mathematical intervals and provides operations on them
/// including arithmetic operations, construction, and IO.
///
/// \tparam T underlying data type over which the interval is defined.
/// \tparam N number of intervals in the group.
///
/// \sa Interval<T> and IntervalND<T, 3>
template <class T, int N>
class IntervalND
{
public:
	static_assert(N >= 1, "IntervalND<T, N> cannot be instantiated with N<=0.");

	/// Constructor
	IntervalND();

	/// Constructor
	/// \param x array of N intervals to be copied into the group
	explicit IntervalND(const std::array<Interval<T>, N>& x);

	/// Copy constructor
	/// \param interval interval group to copied
	IntervalND(const IntervalND<T, N>& interval);

	/// Move constructor
	/// \param i Interval to be copied
	IntervalND(IntervalND<T, N>&& i);

	/// Constructor
	/// \param a array of N values to be used as the respective minimums for the interval entries.
	/// \param b array of N values to be used as the respective maximums for the interval entries.
	IntervalND(const std::array<T, N>& a, const std::array<T, N>& b);

	/// Assignment operator
	/// \param interval Interval group to be copied
	IntervalND<T, N>& operator =(const IntervalND<T, N>& interval);

	/// Move assignment operator
	/// \param i Interval to be moved
	IntervalND<T, N>& operator=(IntervalND<T, N>&& i);

	/// \param interval the interval group the current group will be tested against
	/// \return true if the input group interval overlaps the current group
	bool overlapsWith(const IntervalND<T, N>& interval) const;

	/// \param interval the interval group to be tested
	/// \param epsilon the nearness parameter
	/// \return true if each interval in the input group is approximately equal to its correspondent
	/// element in interval.
	bool isApprox(const IntervalND<T, N>& interval, const T& epsilon) const;

	/// \param interval the interval group to be tested
	/// \return true if the current interval group is identical to the input group
	bool operator ==(const IntervalND<T, N>& interval) const;

	/// \param interval the interval group to be tested
	/// \return true if the current interval group is not identical to the input group
	bool operator !=(const IntervalND<T, N>& interval) const;

	/// Widens every interval in the current interval group by thickness on both sides
	/// \param thickness the amount to widen on both sides
	/// \return the current interval group after modification
	IntervalND<T, N>& addThickness(const T& thickness);

	/// @{
	/// Standard arithmetic operators extended to interval groups
	IntervalND<T, N> operator +(const IntervalND<T, N>& interval) const;
	IntervalND<T, N>& operator +=(const IntervalND<T, N>& interval);
	IntervalND<T, N> operator -(const IntervalND<T, N>& interval) const;
	IntervalND<T, N>& operator -=(const IntervalND<T, N>& interval);
	IntervalND<T, N> operator *(const IntervalND<T, N>& interval) const;
	IntervalND<T, N>& operator *=(const IntervalND<T, N>& interval);
	/// @}

	/// \return the inverse of each interval in the interval group
	/// \exception if any interval includes 0
	IntervalND<T, N> inverse() const;

	/// \param interval the interval to be divided by
	/// \return the product of each interval in the group multiplied by the inverse of
	/// its correspondent in interval
	/// \exception if any component of interval includes 0
	IntervalND<T, N> operator /(const IntervalND<T, N>& interval) const;

	/// \param interval the interval to be divided by
	/// \return the product of each interval in the group multiplied by the inverse of
	/// its correspondent in interval
	/// \note the current interval is modified by this operation
	IntervalND<T, N>& operator /=(const IntervalND<T, N>& interval);

	/// \param interval the input interval group
	/// \return the interval dot product of the current group and interval
	Interval<T> dotProduct(const IntervalND<T, N>& interval) const;

	/// \return the square of the interval magnitude for the current group
	Interval<T> magnitudeSquared() const;

	/// \return the interval magnitude for the current group
	Interval<T> magnitude() const;

	/// \param i the selector for the interval to be returned
	/// \return the ith interval in the current group
	const Interval<T>& getAxis(size_t i) const;

private:
	/// The N dimensional group of intervals
	std::array<Interval<T>, N> m_interval;
};

/// IntervalND<T,3> defines the concept of a group of mathematical intervals specialized to 3 intervals and provides
/// operations on them including arithmetic operations, construction, and IO.
///
/// \tparam T underlying data type over which the interval is defined.
///
/// \sa Interval<T> and IntervalND<T, N>
template <class T>
class IntervalND<T, 3>
{
	template <class P>
	friend void IntervalArithmetic_add(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b, IntervalND<P, 3>* res);
	template <class P>
	friend void IntervalArithmetic_sub(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b, IntervalND<P, 3>* res);
	template <class P>
	friend void IntervalArithmetic_crossProduct(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b,
			IntervalND<P, 3>* res);
	template <class P>
	friend void IntervalArithmetic_dotProduct(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b,
			Interval<P>* res);

public:
	/// Constructor
	IntervalND();

	/// Constructor
	/// \param x array of 3 intervals to be copied into the group
	explicit IntervalND(const std::array<Interval<T>, 3>& x);

	/// Constructor
	/// \param x first interval to be added to the 3 group
	/// \param y second interval to be added to the 3 group
	/// \param z third interval to be added to the 3 group
	IntervalND(const Interval<T>& x, const Interval<T>& y, const Interval<T>& z);

	/// Copy constructor
	/// \param i interval 3 group to copied
	IntervalND(const IntervalND<T, 3>& i);

	/// Move constructor
	/// \param i Interval to be copied
	IntervalND(IntervalND<T, 3>&& i);

	/// Constructor
	/// \param a array of 3 values to be used as the respective minimums for the interval entries.
	/// \param b array of 3 values to be used as the respective maximums for the interval entries.
	IntervalND(const std::array<T, 3>& a, const std::array<T, 3>& b);

	/// Assignment operator
	/// \param i Interval 3 group to be copied
	IntervalND<T, 3>& operator =(const IntervalND<T, 3>& i);

	/// Move assignment operator
	/// \param i Interval to be moved
	IntervalND<T, 3>& operator=(IntervalND<T, 3>&& i);

	/// \param interval the interval group the current group will be tested against
	/// \return true if the input 3 group interval overlaps the current 3 group
	bool overlapsWith(const IntervalND<T, 3>& interval) const;

	/// \param interval the interval group to be tested
	/// \param epsilon the nearness parameter
	/// \return true if each interval in the input group is approximately equal to its correspondent
	/// element in interval.
	bool isApprox(const IntervalND<T, 3>& interval, const T& epsilon) const;

	/// \param i the interval group to be tested
	/// \return true if the current interval 3 group is identical to the input 3 group i
	bool operator ==(const IntervalND<T, 3>& i) const;

	/// \param i the interval group to be tested
	/// \return true if the current interval 3 group is not identical to the input 3 group i
	bool operator !=(const IntervalND<T, 3>& i) const;

	/// Widens every interval in the current interval group by thickness on both sides
	/// \param thickness the amount to widen on both sides
	/// \return the current interval group after modification
	IntervalND<T, 3>& addThickness(const T& thickness);

	/// @{
	/// Standard arithmetic operators extended to 3 interval groups
	IntervalND<T, 3> operator +(const IntervalND<T, 3>& i) const;
	IntervalND<T, 3>& operator +=(const IntervalND<T, 3>& i);
	IntervalND<T, 3> operator -(const IntervalND<T, 3>& i) const;
	IntervalND<T, 3>& operator -=(const IntervalND<T, 3>& i);
	IntervalND<T, 3> operator *(const IntervalND<T, 3>& i) const;
	IntervalND<T, 3>& operator *=(const IntervalND<T, 3>& i);
	/// @}

	/// \return the inverse of each interval in the 3 interval group
	/// \exception if any interval includes 0
	IntervalND<T, 3> inverse() const;

	/// \param i the interval to be divided by
	/// \return the product of each interval in the 3 group multiplied by the inverse of
	/// its correspondent in i
	/// \exception if any component of interval includes 0
	IntervalND<T, 3> operator /(const IntervalND<T, 3>& i) const;

	/// \param i the interval to be divided by
	/// \return the product of each interval in the 3 group multiplied by the inverse of
	/// its correspondent in i
	/// \note the current interval is modified by this operation
	IntervalND<T, 3>& operator /=(const IntervalND<T, 3>& i);

	/// \param i the input interval group
	/// \return the interval dot product of the current 3 group and interval
	Interval<T> dotProduct(const IntervalND<T, 3>& i) const;

	/// \param i the input interval group
	/// \return the interval cross product of the current 3 group and interval
	IntervalND<T, 3> crossProduct(const IntervalND<T, 3>& i) const;

	/// \return the square of the interval magnitude for the current 3 group
	Interval<T> magnitudeSquared() const;

	/// \return the interval magnitude for the current 3 group
	Interval<T> magnitude() const;

	/// \param i the selector for the interval to be returned
	/// \return the ith interval in the current 3 group
	const Interval<T>& getAxis(size_t i) const;

private:
	/// The 3 dimensional group of intervals
	std::array<Interval<T>, 3> m_interval;
};

// Interval utilities

/// \tparam T underlying type of the interval
/// \param v the scalar
/// \param i the interval
/// \return the sum of the scalar v and the interval i
template <typename T>
Interval<T> operator+ (T v, const Interval<T>& i);

/// \tparam T underlying type of the interval
/// \param v the scalar
/// \param i the interval
/// \return the product of the scalar v and the interval i
template <typename T>
Interval<T> operator* (T v, const Interval<T>& i);

/// Write a textual version of the interval to an output stream
/// \tparam T underlying type of the interval
/// \param o the ostream to be written to
/// \param interval the interval to write
/// \return the active ostream
template <typename T>
std::ostream& operator<< (std::ostream& o, const Interval<T>& interval);

/// Calculate the sum of two intervals
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [out] the result of a + b
template <class P>
void IntervalArithmetic_add(const Interval<P>& a, const Interval<P>& b,
							Interval<P>* res); // +

/// Calculate the sum of three intervals res + a + b
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [in/out] the result of res + a + b
template <class P>
void IntervalArithmetic_addadd(const Interval<P>& a, const Interval<P>& b,
							   Interval<P>* res); // +=( + )

/// Calculate the difference of two intervals
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [out] the result of a - b
template <class P>
void IntervalArithmetic_sub(const Interval<P>& a, const Interval<P>& b,
							Interval<P>* res); // -

/// Add the difference of two intervals to an existing value
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [in/out] the result of res + (a - b)
template <class P>
void IntervalArithmetic_addsub(const Interval<P>& a, const Interval<P>& b,
							   Interval<P>* res); // +=( - )

/// Calculate the product of two intervals
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [out] the result of a * b
template <class P>
void IntervalArithmetic_mul(const Interval<P>& a, const Interval<P>& b,
							Interval<P>* res); // *

/// Add the product of two intervals to an existing value
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [in/out] the result of res + (a * b)
template <class P>
void IntervalArithmetic_addmul(const Interval<P>& a, const Interval<P>& b,
							   Interval<P>* res); // += ( * )

/// Subtract the product of two intervals from an existing value
/// \tparam P underlying type of the interval
/// \param a the first interval
/// \param b the second interval
/// \param res [in/out] the result of res - (a * b)
template <class P>
void IntervalArithmetic_submul(const Interval<P>& a, const Interval<P>& b,
							   Interval<P>* res); // -= ( * )

// Interval ND utilities

/// Write a textual version of an interval group to an output stream
/// \tparam T underlying type of the interval
/// \tparam N number of intervals in the group
/// \param o the ostream to be written to
/// \param interval the interval group to write
/// \return the active ostream
template <typename T, int N>
std::ostream& operator<< (std::ostream& o, const IntervalND<T, N>& interval);

// Interval 3D utilities

/// Calculate the sum of two interval groups
/// \tparam P underlying type of the interval
/// \param a the first interval group
/// \param b the second interval group
/// \param res [out] the result of a + b
template <class P>
void IntervalArithmetic_add(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b,
							IntervalND<P, 3>* res);

/// Calculate the difference of two interval groups
/// \tparam P underlying type of the interval
/// \param a the first interval group
/// \param b the second interval group
/// \param res [out] the result of a - b
template <class P>
void IntervalArithmetic_sub(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b,
							IntervalND<P, 3>* res);

/// Calculate the dot product of two interval groups
/// \tparam P underlying type of the interval
/// \param a the first interval group
/// \param b the second interval group
/// \param res [out] the dot product of a and b
template <class P>
void IntervalArithmetic_dotProduct(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b,
								   Interval<P>* res);

/// Calculate the cross product of two interval groups
/// \tparam P underlying type of the interval
/// \param a the first interval group
/// \param b the second interval group
/// \param res [out] the cross product of a and b
template <class P>
void IntervalArithmetic_crossProduct(const IntervalND<P, 3>& a, const IntervalND<P, 3>& b,
									 IntervalND<P, 3>* res);

}; // Math
}; // SurgSim

#include "SurgSim/Math/IntervalArithmetic-inl.h"

#endif // SURGSIM_MATH_INTERVALARITHMETIC_H


text:
import deepFreeze from "deep-freeze-node";
import {HEAD} from "http-methods-constants";
import {name as packageName, version as packageVersion} from "../../package.json";
import TAGS from "./tags";
import userAgent from "default-user-agent";

export default deepFreeze(
{
	cacheMaxAge: 3_600_000,
	cacheResponses: true,
	excludedKeywords: [],
	excludeExternalLinks: false,
	excludeInternalLinks: false,
	excludeLinksToSamePage: false,
	filterLevel: 1,
	honorRobotExclusions: true,
	includedKeywords: [],
	includeLink: () => true,
	includePage: () => true,
	maxSockets: Infinity,  // @todo change to `maxExternalSockets`
	maxSocketsPerHost: 1,  // @todo separate to `maxInternalSockets=5` and `maxExternalSocketsPerHost=1`
	rateLimit: 0,
	requestMethod: HEAD,
	retryHeadCodes: [405],
	retryHeadFail: true,
	tags: TAGS,
	userAgent: userAgent(packageName, packageVersion)
});