text:
package io.cloudslang.orchestrator.services;

import io.cloudslang.engine.node.entities.WorkerNode;
import io.cloudslang.engine.node.services.WorkerLockService;
import io.cloudslang.engine.node.services.WorkerNodeService;
import io.cloudslang.engine.queue.entities.ExecutionMessage;
import io.cloudslang.engine.queue.services.QueueDispatcherService;
import io.cloudslang.orchestrator.entities.Message;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.ArrayList;
import java.util.List;

import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyList;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when;

/**
 * Created with IntelliJ IDEA.
 * User: kravtsov
 * Date: 24/07/14
 * Time: 08:58
 */

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class OrchestratorDispatcherServiceTest {

    @InjectMocks
    private OrchestratorDispatcherService orchestratorDispatcherService = new OrchestratorDispatcherServiceImpl();

    @Mock
    WorkerNodeService workerNodeService;

    @Mock
    WorkerLockService workerLockService;

    @Mock
    private QueueDispatcherService queueDispatcher;

    @Mock
    private SplitJoinService splitJoinService;

    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
    }

    @Test
    public void simpleDispatchTest(){
        List<Message> messages = new ArrayList<>();
        messages.add(new ExecutionMessage());

        String newBulkNumber = "2";
        String uuid = "123";

        WorkerNode node = new WorkerNode();
        node.setBulkNumber("1");
        node.setWorkerRecoveryVersion("1");

        when(workerNodeService.readByUUID(anyString())).thenReturn(node);

        orchestratorDispatcherService.dispatch(messages, newBulkNumber, "1", uuid);
        Mockito.verify(workerLockService, times(1)).lock(uuid);
        Mockito.verify(queueDispatcher, times(1)).dispatch(anyList());
        Mockito.verify(workerNodeService, times(1)).updateBulkNumber(uuid, newBulkNumber);
    }

    @Test
    public void firstDispatchTest(){
        List<Message> messages = new ArrayList<>();
        messages.add(new ExecutionMessage());

        String newBulkNumber = "2";
        String uuid = "123";

        WorkerNode node = new WorkerNode(); //node with NULL bulk number since it is first dispatch
        node.setWorkerRecoveryVersion("1");

        when(workerNodeService.readByUUID(anyString())).thenReturn(node);

        orchestratorDispatcherService.dispatch(messages, newBulkNumber, "1", uuid);
        Mockito.verify(workerLockService, times(1)).lock(uuid);
        Mockito.verify(queueDispatcher, times(1)).dispatch(anyList());
        Mockito.verify(workerNodeService, times(1)).updateBulkNumber(uuid, newBulkNumber);
    }

    @Test
    public void sameBulkDispatchTest(){
        List<Message> messages = new ArrayList<>();
        messages.add(new ExecutionMessage());

        String newBulkNumber = "1";
        String uuid = "123";

        WorkerNode node = new WorkerNode();
        node.setBulkNumber("1");
        node.setWorkerRecoveryVersion("1");

        when(workerNodeService.readByUUID(anyString())).thenReturn(node);

        orchestratorDispatcherService.dispatch(messages, newBulkNumber, "1", uuid);
        Mockito.verify(workerLockService, times(1)).lock(uuid);
        Mockito.verify(queueDispatcher, times(0)).dispatch(anyList());
        Mockito.verify(workerNodeService, times(0)).updateBulkNumber(uuid, newBulkNumber);
    }

    @Test
        public void dispatchAfterRecoveryTest(){
            List<Message> messages = new ArrayList<>();
            messages.add(new ExecutionMessage());

            String newBulkNumber = "2";
            String uuid = "123";

            WorkerNode node = new WorkerNode();
            node.setBulkNumber("1");
            node.setWorkerRecoveryVersion("1");

            when(workerNodeService.readByUUID(anyString())).thenReturn(node);

            //worker dispatches with wrong WRV
            orchestratorDispatcherService.dispatch(messages, newBulkNumber, "0", uuid);

            Mockito.verify(queueDispatcher, times(0)).dispatch(anyList());
            Mockito.verify(workerNodeService, times(0)).updateBulkNumber(uuid, newBulkNumber);
        }

    @Configuration
    static class EmptyConfig {

    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using Lithnet.Miiserver.Client;
using PreMailer.Net;

namespace Lithnet.Miiserver.AutoSync
{
    public static class MessageBuilder
    {
        private const string SimpleRow = "
{0}	{1}
";
        private const string FirstRow = "
{0}{1}	{2}
";
        private const string TwoColumnHeader = "{1}	{2}	";
        private const string ThreeColumnHeader = "{1}	{2}	{3}	";

        private static string GetTemplate(string name)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            string resourceName = $"Lithnet.Miiserver.AutoSync.Resources.{name}.html";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                if (stream == null)
                {
                    throw new InvalidOperationException($"The resource {resourceName} was missing from the assembly");
                }

                using (StreamReader reader = new StreamReader(stream))
                {
                    return reader.ReadToEnd();
                }
            }
        }

        public static string GetMessageBody(string maName, string triggerType, string triggerDetails, DateTime errorTime, bool hasTerminated, Exception ex)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat(MessageBuilder.GetTemplate("TriggerErrorFragment"), maName, triggerType, triggerDetails, errorTime, hasTerminated ? "Yes" : "No", ex);

            InlineResult result = PreMailer.Net.PreMailer.MoveCssInline(MessageBuilder.GetTemplate("EmailTemplate").Replace("%BODY%", builder.ToString()));

            return result.Html;
        }

        public static string GetMessageBody(RunDetails r)
        {
            return GetMessageBody(r, null);
        }

        public static string GetMessageBody(RunDetails r, string thresholdMessage)
        {
            StringBuilder builder = new StringBuilder();

            if (thresholdMessage != null)
            {
                builder.AppendFormat(MessageBuilder.GetTemplate("ThresholdExceededFragment"), r.RunProfileName, r.MAName, r.StartTime, r.EndTime, r.SecurityID, r.LastStepStatus, r.RunNumber, thresholdMessage);
            }
            else
            {
                builder.AppendFormat(MessageBuilder.GetTemplate("RunSummaryFragment"), r.RunProfileName, r.MAName, r.StartTime, r.EndTime, r.SecurityID, r.LastStepStatus, r.RunNumber);
            }

            builder.AppendFormat(MessageBuilder.GetTemplate("StepTableFragment"), MessageBuilder.BuildStepDetails(r.StepDetails));

            string stagingErrors = MessageBuilder.BuildStagingErrorDetails(r.StepDetails);

            if (stagingErrors != null)
            {
                builder.AppendLine(stagingErrors);
            }

            string importErrors = MessageBuilder.BuildImportErrorDetails(r.StepDetails);

            if (importErrors != null)
            {
                builder.AppendLine(importErrors);
            }

            string exportErrors = MessageBuilder.BuildExportErrorDetails(r.StepDetails);

            if (exportErrors != null)
            {
                builder.AppendLine(exportErrors);
            }

            string syncErrors = MessageBuilder.BuildSyncErrorDetails(r.StepDetails);

            if (syncErrors != null)
            {
                builder.AppendLine(syncErrors);
            }

            InlineResult result = PreMailer.Net.PreMailer.MoveCssInline(MessageBuilder.GetTemplate("EmailTemplate").Replace("%BODY%", builder.ToString()));

            return result.Html;
        }

        private static string BuildStepDetails(IReadOnlyList<StepDetails> details)
        {
            StringBuilder builder = new StringBuilder();

            foreach (StepDetails d in details)
            {

                if (d.StepDefinition.IsExportStep)
                {
                    builder.AppendLine(BuildExportStepDetails(d));
                }
                else if (d.StepDefinition.IsImportStep)
                {
                    builder.AppendLine(BuildImportStepDetails(d));
                }

                if (d.StepDefinition.IsSyncStep)
                {
                    builder.AppendLine(BuildSyncStepDetails(d));
                }
            }

            return builder.ToString();
        }

        private static string BuildExportStepDetails(StepDetails d)
        {
            StringBuilder builder = new StringBuilder();

            string stepDetails = string.Format(MessageBuilder.TwoColumnHeader, 6, d.StepNumber, d.StepDefinition.StepTypeDescription);
            builder.AppendFormat(MessageBuilder.FirstRow, stepDetails, "Export adds", d.ExportCounters.ExportAdd);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Export deletes", d.ExportCounters.ExportDelete);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Export delete-adds", d.ExportCounters.ExportDeleteAdd);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Export rename", d.ExportCounters.ExportRename);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Export update", d.ExportCounters.ExportUpdate);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Export failures", d.ExportCounters.ExportFailure);

            return builder.ToString();
        }

        private static string BuildImportStepDetails(StepDetails d)
        {
            StringBuilder builder = new StringBuilder();

            string stepDetails = string.Format(MessageBuilder.TwoColumnHeader, 7, d.StepNumber, d.StepDefinition.StepTypeDescription);
            builder.AppendFormat(MessageBuilder.FirstRow, stepDetails, "Import adds", d.StagingCounters.StageAdd);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Import deletes", d.StagingCounters.StageDelete);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Import delete-adds", d.StagingCounters.StageDeleteAdd);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Import rename", d.StagingCounters.StageRename);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Import update", d.StagingCounters.StageUpdate);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Import no change", d.StagingCounters.StageNoChange);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Import failures", d.StagingCounters.StageFailure);

            return builder.ToString();
        }

        private static string BuildStagingErrorDetails(IReadOnlyList<StepDetails> details)
        {
            StringBuilder b = new StringBuilder();

            foreach (StepDetails d in details)
            {
                string result = BuildStagingErrorDetails(d);

                if (result != null)
                {
                    b.AppendLine(result);
                }
            }

            if (b.Length == 0)
            {
                return null;
            }
            else
            {
                return b.ToString();
            }
        }

        private static string BuildImportErrorDetails(IReadOnlyList<StepDetails> details)
        {
            StringBuilder b = new StringBuilder();

            foreach (StepDetails d in details)
            {
                string result = BuildImportErrorDetails(d);

                if (result != null)
                {
                    b.AppendLine(result);
                }
            }

            if (b.Length == 0)
            {
                return null;
            }
            else
            {
                return b.ToString();
            }
        }

        private static string BuildExportErrorDetails(IReadOnlyList<StepDetails> details)
        {
            StringBuilder b = new StringBuilder();

            foreach (StepDetails d in details)
            {
                string result = BuildExportErrorDetails(d);

                if (result != null)
                {
                    b.AppendLine(result);
                }
            }

            if (b.Length == 0)
            {
                return null;
            }
            else
            {
                return b.ToString();
            }
        }

        private static string BuildSyncErrorDetails(IReadOnlyList<StepDetails> details)
        {
            StringBuilder b = new StringBuilder();

            foreach (StepDetails d in details)
            {
                string result = BuildSyncErrorDetails(d);

                if (result != null)
                {
                    b.AppendLine(result);
                }
            }

            if (b.Length == 0)
            {
                return null;
            }
            else
            {
                return b.ToString();
            }
        }

        private static string BuildStagingErrorDetails(StepDetails d)
        {
            if (d.MADiscoveryErrors.Count == 0)
            {
                return null;
            }

            IEnumerable<MAObjectError> errors;
            int remainingErrors = 0;

            if (Program.ActiveConfig.Settings.MailMaxErrors <= 0 || d.MADiscoveryErrors.Count <= Program.ActiveConfig.Settings.MailMaxErrors)
            {
                errors = d.MADiscoveryErrors;
            }
            else
            {
                errors = d.MADiscoveryErrors.Take(Program.ActiveConfig.Settings.MailMaxErrors);
                remainingErrors = d.MADiscoveryErrors.Count - Program.ActiveConfig.Settings.MailMaxErrors;
            }

            StringBuilder errorsBuilder = new StringBuilder();

            errorsBuilder.AppendLine("
Staging errors
");

            foreach (MAObjectError error in errors)
            {
                StringBuilder errorBuilder = new StringBuilder();

                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "DN", error.DN);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error type", error.ErrorType);

                if (error.CDError != null)
                {
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error code", error.CDError.ErrorCode);
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error literal", error.CDError.ErrorLiteral);
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Server error detail", error.CDError.ServerErrorDetail);

                    if (error.CDError.Value != null)
                    {
                        errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Value", string.Join(", ", error.CDError.Value));
                    }
                }

                if (error.LineNumber > 0)
                {
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Line number", error.LineNumber);
                }

                if (error.ColumnNumber > 0)
                {
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Column number", error.ColumnNumber);
                }

                if (error.AttributeName != null)
                {
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Attribute name", error.AttributeName);
                }

                errorsBuilder.AppendLine(string.Format(MessageBuilder.GetTemplate("ErrorTableFragment"), errorBuilder));
                errorsBuilder.AppendLine("
");
            }

            if (remainingErrors > 0)
            {
                errorsBuilder.Append($"There are {remainingErrors} more errors that are not shown in this report
");
            }

            return errorsBuilder.ToString();
        }

        private static string BuildImportErrorDetails(StepDetails d)
        {
            if (d.SynchronizationErrors.ImportErrors.Count == 0)
            {
                return null;
            }

            IEnumerable<ImportError> errors;
            int remainingErrors = 0;

            if (Program.ActiveConfig.Settings.MailMaxErrors <= 0 || d.SynchronizationErrors.ImportErrors.Count <= Program.ActiveConfig.Settings.MailMaxErrors)
            {
                errors = d.SynchronizationErrors.ImportErrors;
            }
            else
            {
                errors = d.SynchronizationErrors.ImportErrors.Take(Program.ActiveConfig.Settings.MailMaxErrors);
                remainingErrors = d.SynchronizationErrors.ImportErrors.Count - Program.ActiveConfig.Settings.MailMaxErrors;
            }

            StringBuilder errorsBuilder = new StringBuilder();

            errorsBuilder.AppendLine("
Inbound synchronization errors
");

            foreach (ImportError error in errors)
            {
                StringBuilder errorBuilder = new StringBuilder();

                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "DN", error.DN);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error type", error.ErrorType);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Date occurred", error.DateOccurred);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Retry count", error.RetryCount);

                MessageBuilder.BuildErrorExtensionInfo(error.ExtensionErrorInfo, errorBuilder);
                MessageBuilder.BuildRulesErrorInfo(error.RulesErrorInfo, errorBuilder);

                errorsBuilder.AppendLine(string.Format(MessageBuilder.GetTemplate("ErrorTableFragment"), errorBuilder));
                errorsBuilder.AppendLine("
");
            }

            if (remainingErrors > 0)
            {
                errorsBuilder.Append($"There are {remainingErrors} more errors that are not shown in this report
");
            }

            return errorsBuilder.ToString();
        }

        private static string BuildExportErrorDetails(StepDetails d)
        {
            if (d.SynchronizationErrors.ExportErrors.Count == 0)
            {
                return null;
            }

            IEnumerable<ExportError> errors;
            int remainingErrors = 0;

            if (Program.ActiveConfig.Settings.MailMaxErrors <= 0 || d.SynchronizationErrors.ExportErrors.Count <= Program.ActiveConfig.Settings.MailMaxErrors)
            {
                errors = d.SynchronizationErrors.ExportErrors;
            }
            else
            {
                errors = d.SynchronizationErrors.ExportErrors.Take(Program.ActiveConfig.Settings.MailMaxErrors);
                remainingErrors = d.SynchronizationErrors.ExportErrors.Count - Program.ActiveConfig.Settings.MailMaxErrors;
            }

            StringBuilder errorsBuilder = new StringBuilder();

            errorsBuilder.AppendLine("
Export errors
");

            foreach (ExportError error in errors)
            {
                StringBuilder errorBuilder = new StringBuilder();

                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "DN", error.DN);

                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error type", error.ErrorType);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Date occurred", error.DateOccurred);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "First occurred", error.FirstOccurred);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Retry count", error.RetryCount);

                if (error.CDError != null)
                {
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error code", error.CDError.ErrorCode);
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error literal", error.CDError.ErrorLiteral);
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Server error detail", error.CDError.ServerErrorDetail);
                }

                errorsBuilder.AppendLine(string.Format(MessageBuilder.GetTemplate("ErrorTableFragment"), errorBuilder));
                errorsBuilder.AppendLine("
");
            }

            if (remainingErrors > 0)
            {
                errorsBuilder.Append($"There are {remainingErrors} more errors that are not shown in this report
");
            }

            return errorsBuilder.ToString();
        }

        private static string BuildSyncStepDetails(StepDetails d)
        {
            StringBuilder builder = new StringBuilder();

            string stepDetails = string.Format(MessageBuilder.ThreeColumnHeader, 10, d.StepNumber, d.StepDefinition.StepTypeDescription, "Inbound");
            builder.AppendFormat(MessageBuilder.FirstRow, stepDetails, "Projections", d.InboundFlowCounters.TotalProjections);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Joins", d.InboundFlowCounters.TotalJoins);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Filtered disconnectors", d.InboundFlowCounters.DisconnectorFiltered);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Disconnectors", d.InboundFlowCounters.DisconnectedRemains);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Connectors with flow updates", d.InboundFlowCounters.ConnectorFlow);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Connectors without flow updates", d.InboundFlowCounters.ConnectorNoFlow);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Filtered connectors", d.InboundFlowCounters.TotalFilteredConnectors);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Deleted connectors", d.InboundFlowCounters.TotalDeletedConnectors);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Metaverse object deletes", d.InboundFlowCounters.TotalMVObjectDeletes);
            builder.AppendFormat(MessageBuilder.SimpleRow, "Flow errors", d.InboundFlowCounters.FlowFailure);

            foreach (OutboundFlowCounters item in d.OutboundFlowCounters)
            {
                string f = string.Format(MessageBuilder.ThreeColumnHeader, 5, string.Empty, string.Empty, "Outbound: " + item.ManagementAgent);
                builder.AppendFormat(MessageBuilder.FirstRow, f, "Export attribute flow", item.ConnectorFlow);
                builder.AppendFormat(MessageBuilder.SimpleRow, "Provisioning adds", (item.ProvisionedAddFlow + item.ProvisionedAddNoFlow));
                builder.AppendFormat(MessageBuilder.SimpleRow, "Provisioning renames", (item.ProvisionRenameFlow + item.ProvisionedRenameNoFlow));
                builder.AppendFormat(MessageBuilder.SimpleRow, "Provisioning disconnects", item.ProvisionedDisconnect);
                builder.AppendFormat(MessageBuilder.SimpleRow, "Provisioning delete-adds", (item.ProvisionedDeleteAddFlow + item.ProvisionedDeleteAddNoFlow));

            }

            return builder.ToString();
        }

        private static string BuildSyncErrorDetails(StepDetails d)
        {
            if (d.MVRetryErrors == null || d.MVRetryErrors.Count == 0)
            {
                return null;
            }

            IEnumerable<MVRetryError> errors;
            int remainingErrors = 0;

            if (Program.ActiveConfig.Settings.MailMaxErrors <= 0 || d.MVRetryErrors.Count <= Program.ActiveConfig.Settings.MailMaxErrors)
            {
                errors = d.MVRetryErrors;
            }
            else
            {
                errors = d.MVRetryErrors.Take(Program.ActiveConfig.Settings.MailMaxErrors);
                remainingErrors = d.MVRetryErrors.Count - Program.ActiveConfig.Settings.MailMaxErrors;
            }

            StringBuilder errorsBuilder = new StringBuilder();

            errorsBuilder.AppendLine("
Outbound synchronization errors
");

            foreach (MVRetryError error in errors)
            {
                StringBuilder errorBuilder = new StringBuilder();

                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Object", error.DisplayName ?? error.MVID);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Step", error.AlgorithmStep?.Value);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Error type", error.ErrorType);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Date occurred", error.DateOccurred);

                MessageBuilder.BuildErrorExtensionInfo(error.ExtensionErrorInfo, errorBuilder);
                MessageBuilder.BuildRulesErrorInfo(error.RulesErrorInfo, errorBuilder);

                errorsBuilder.AppendLine(string.Format(MessageBuilder.GetTemplate("ErrorTableFragment"), errorBuilder));
                errorsBuilder.AppendLine("
");
            }

            if (remainingErrors > 0)
            {
                errorsBuilder.Append($"There are {remainingErrors} more errors that are not shown in this report
");
            }

            return errorsBuilder.ToString();
        }

        private static void BuildRulesErrorInfo(RulesErrorInfoContext c, StringBuilder errorBuilder)
        {
            if (c != null)
            {
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "CS Object ID", c.CSObjectID);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "DN", c.DN);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "MA Name", c.MAName);

                if (c.AttributeFlow != null)
                {
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Context", c.AttributeFlow.ContextID);
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Destination attribute", c.AttributeFlow.DestinationAttribute);
                    errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Flow rule", c.AttributeFlow.FlowRule);
                }
            }
        }

        private static void BuildErrorExtensionInfo(ExtensionErrorInfo error, StringBuilder errorBuilder)
        {
            if (error != null)
            {
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Extension name", error.ExtensionName);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Context", error.ExtensionContext);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Call site", error.ExtensionCallSite);
                errorBuilder.AppendFormat(MessageBuilder.SimpleRow, "Call stack", error.CallStack);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkUnstructuredGridBaseAlgorithmWrap.h"
#include "vtkUnstructuredGridGeometryFilterWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkIncrementalPointLocatorWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkUnstructuredGridGeometryFilterWrap::ptpl;

VtkUnstructuredGridGeometryFilterWrap::VtkUnstructuredGridGeometryFilterWrap()
{ }

VtkUnstructuredGridGeometryFilterWrap::VtkUnstructuredGridGeometryFilterWrap(vtkSmartPointer<vtkUnstructuredGridGeometryFilter> _native)
{ native = _native; }

VtkUnstructuredGridGeometryFilterWrap::~VtkUnstructuredGridGeometryFilterWrap()
{ }

void VtkUnstructuredGridGeometryFilterWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkUnstructuredGridGeometryFilter").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("UnstructuredGridGeometryFilter").ToLocalChecked(), ConstructorGetter);
}

void VtkUnstructuredGridGeometryFilterWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkUnstructuredGridGeometryFilterWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkUnstructuredGridBaseAlgorithmWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkUnstructuredGridBaseAlgorithmWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkUnstructuredGridGeometryFilterWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "CellClippingOff", CellClippingOff);
	Nan::SetPrototypeMethod(tpl, "cellClippingOff", CellClippingOff);

	Nan::SetPrototypeMethod(tpl, "CellClippingOn", CellClippingOn);
	Nan::SetPrototypeMethod(tpl, "cellClippingOn", CellClippingOn);

	Nan::SetPrototypeMethod(tpl, "CreateDefaultLocator", CreateDefaultLocator);
	Nan::SetPrototypeMethod(tpl, "createDefaultLocator", CreateDefaultLocator);

	Nan::SetPrototypeMethod(tpl, "DuplicateGhostCellClippingOff", DuplicateGhostCellClippingOff);
	Nan::SetPrototypeMethod(tpl, "duplicateGhostCellClippingOff", DuplicateGhostCellClippingOff);

	Nan::SetPrototypeMethod(tpl, "DuplicateGhostCellClippingOn", DuplicateGhostCellClippingOn);
	Nan::SetPrototypeMethod(tpl, "duplicateGhostCellClippingOn", DuplicateGhostCellClippingOn);

	Nan::SetPrototypeMethod(tpl, "ExtentClippingOff", ExtentClippingOff);
	Nan::SetPrototypeMethod(tpl, "extentClippingOff", ExtentClippingOff);

	Nan::SetPrototypeMethod(tpl, "ExtentClippingOn", ExtentClippingOn);
	Nan::SetPrototypeMethod(tpl, "extentClippingOn", ExtentClippingOn);

	Nan::SetPrototypeMethod(tpl, "GetCellClipping", GetCellClipping);
	Nan::SetPrototypeMethod(tpl, "getCellClipping", GetCellClipping);

	Nan::SetPrototypeMethod(tpl, "GetDuplicateGhostCellClipping", GetDuplicateGhostCellClipping);
	Nan::SetPrototypeMethod(tpl, "getDuplicateGhostCellClipping", GetDuplicateGhostCellClipping);

	Nan::SetPrototypeMethod(tpl, "GetExtentClipping", GetExtentClipping);
	Nan::SetPrototypeMethod(tpl, "getExtentClipping", GetExtentClipping);

	Nan::SetPrototypeMethod(tpl, "GetLocator", GetLocator);
	Nan::SetPrototypeMethod(tpl, "getLocator", GetLocator);

	Nan::SetPrototypeMethod(tpl, "GetMerging", GetMerging);
	Nan::SetPrototypeMethod(tpl, "getMerging", GetMerging);

	Nan::SetPrototypeMethod(tpl, "GetOriginalCellIdsName", GetOriginalCellIdsName);
	Nan::SetPrototypeMethod(tpl, "getOriginalCellIdsName", GetOriginalCellIdsName);

	Nan::SetPrototypeMethod(tpl, "GetOriginalPointIdsName", GetOriginalPointIdsName);
	Nan::SetPrototypeMethod(tpl, "getOriginalPointIdsName", GetOriginalPointIdsName);

	Nan::SetPrototypeMethod(tpl, "GetPassThroughCellIds", GetPassThroughCellIds);
	Nan::SetPrototypeMethod(tpl, "getPassThroughCellIds", GetPassThroughCellIds);

	Nan::SetPrototypeMethod(tpl, "GetPassThroughPointIds", GetPassThroughPointIds);
	Nan::SetPrototypeMethod(tpl, "getPassThroughPointIds", GetPassThroughPointIds);

	Nan::SetPrototypeMethod(tpl, "GetPointClipping", GetPointClipping);
	Nan::SetPrototypeMethod(tpl, "getPointClipping", GetPointClipping);

	Nan::SetPrototypeMethod(tpl, "MergingOff", MergingOff);
	Nan::SetPrototypeMethod(tpl, "mergingOff", MergingOff);

	Nan::SetPrototypeMethod(tpl, "MergingOn", MergingOn);
	Nan::SetPrototypeMethod(tpl, "mergingOn", MergingOn);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "PassThroughCellIdsOff", PassThroughCellIdsOff);
	Nan::SetPrototypeMethod(tpl, "passThroughCellIdsOff", PassThroughCellIdsOff);

	Nan::SetPrototypeMethod(tpl, "PassThroughCellIdsOn", PassThroughCellIdsOn);
	Nan::SetPrototypeMethod(tpl, "passThroughCellIdsOn", PassThroughCellIdsOn);

	Nan::SetPrototypeMethod(tpl, "PassThroughPointIdsOff", PassThroughPointIdsOff);
	Nan::SetPrototypeMethod(tpl, "passThroughPointIdsOff", PassThroughPointIdsOff);

	Nan::SetPrototypeMethod(tpl, "PassThroughPointIdsOn", PassThroughPointIdsOn);
	Nan::SetPrototypeMethod(tpl, "passThroughPointIdsOn", PassThroughPointIdsOn);

	Nan::SetPrototypeMethod(tpl, "PointClippingOff", PointClippingOff);
	Nan::SetPrototypeMethod(tpl, "pointClippingOff", PointClippingOff);

	Nan::SetPrototypeMethod(tpl, "PointClippingOn", PointClippingOn);
	Nan::SetPrototypeMethod(tpl, "pointClippingOn", PointClippingOn);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetCellClipping", SetCellClipping);
	Nan::SetPrototypeMethod(tpl, "setCellClipping", SetCellClipping);

	Nan::SetPrototypeMethod(tpl, "SetDuplicateGhostCellClipping", SetDuplicateGhostCellClipping);
	Nan::SetPrototypeMethod(tpl, "setDuplicateGhostCellClipping", SetDuplicateGhostCellClipping);

	Nan::SetPrototypeMethod(tpl, "SetExtent", SetExtent);
	Nan::SetPrototypeMethod(tpl, "setExtent", SetExtent);

	Nan::SetPrototypeMethod(tpl, "SetExtentClipping", SetExtentClipping);
	Nan::SetPrototypeMethod(tpl, "setExtentClipping", SetExtentClipping);

	Nan::SetPrototypeMethod(tpl, "SetLocator", SetLocator);
	Nan::SetPrototypeMethod(tpl, "setLocator", SetLocator);

	Nan::SetPrototypeMethod(tpl, "SetMerging", SetMerging);
	Nan::SetPrototypeMethod(tpl, "setMerging", SetMerging);

	Nan::SetPrototypeMethod(tpl, "SetOriginalCellIdsName", SetOriginalCellIdsName);
	Nan::SetPrototypeMethod(tpl, "setOriginalCellIdsName", SetOriginalCellIdsName);

	Nan::SetPrototypeMethod(tpl, "SetOriginalPointIdsName", SetOriginalPointIdsName);
	Nan::SetPrototypeMethod(tpl, "setOriginalPointIdsName", SetOriginalPointIdsName);

	Nan::SetPrototypeMethod(tpl, "SetPassThroughCellIds", SetPassThroughCellIds);
	Nan::SetPrototypeMethod(tpl, "setPassThroughCellIds", SetPassThroughCellIds);

	Nan::SetPrototypeMethod(tpl, "SetPassThroughPointIds", SetPassThroughPointIds);
	Nan::SetPrototypeMethod(tpl, "setPassThroughPointIds", SetPassThroughPointIds);

	Nan::SetPrototypeMethod(tpl, "SetPointClipping", SetPointClipping);
	Nan::SetPrototypeMethod(tpl, "setPointClipping", SetPointClipping);

#ifdef VTK_NODE_PLUS_VTKUNSTRUCTUREDGRIDGEOMETRYFILTERWRAP_INITPTPL
	VTK_NODE_PLUS_VTKUNSTRUCTUREDGRIDGEOMETRYFILTERWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkUnstructuredGridGeometryFilterWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkUnstructuredGridGeometryFilter> native = vtkSmartPointer<vtkUnstructuredGridGeometryFilter>::New();
		VtkUnstructuredGridGeometryFilterWrap* obj = new VtkUnstructuredGridGeometryFilterWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkUnstructuredGridGeometryFilterWrap::CellClippingOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->CellClippingOff();
}

void VtkUnstructuredGridGeometryFilterWrap::CellClippingOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->CellClippingOn();
}

void VtkUnstructuredGridGeometryFilterWrap::CreateDefaultLocator(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->CreateDefaultLocator();
}

void VtkUnstructuredGridGeometryFilterWrap::DuplicateGhostCellClippingOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->DuplicateGhostCellClippingOff();
}

void VtkUnstructuredGridGeometryFilterWrap::DuplicateGhostCellClippingOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->DuplicateGhostCellClippingOn();
}

void VtkUnstructuredGridGeometryFilterWrap::ExtentClippingOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->ExtentClippingOff();
}

void VtkUnstructuredGridGeometryFilterWrap::ExtentClippingOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->ExtentClippingOn();
}

void VtkUnstructuredGridGeometryFilterWrap::GetCellClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetCellClipping();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::GetDuplicateGhostCellClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDuplicateGhostCellClipping();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::GetExtentClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetExtentClipping();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::GetLocator(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	vtkIncrementalPointLocator * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetLocator();
	VtkIncrementalPointLocatorWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkIncrementalPointLocatorWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkIncrementalPointLocatorWrap *w = new VtkIncrementalPointLocatorWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkUnstructuredGridGeometryFilterWrap::GetMerging(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetMerging();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::GetOriginalCellIdsName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetOriginalCellIdsName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkUnstructuredGridGeometryFilterWrap::GetOriginalPointIdsName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetOriginalPointIdsName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkUnstructuredGridGeometryFilterWrap::GetPassThroughCellIds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetPassThroughCellIds();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::GetPassThroughPointIds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetPassThroughPointIds();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::GetPointClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetPointClipping();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkUnstructuredGridGeometryFilterWrap::MergingOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->MergingOff();
}

void VtkUnstructuredGridGeometryFilterWrap::MergingOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->MergingOn();
}

void VtkUnstructuredGridGeometryFilterWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	vtkUnstructuredGridGeometryFilter * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkUnstructuredGridGeometryFilterWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkUnstructuredGridGeometryFilterWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkUnstructuredGridGeometryFilterWrap *w = new VtkUnstructuredGridGeometryFilterWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkUnstructuredGridGeometryFilterWrap::PassThroughCellIdsOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->PassThroughCellIdsOff();
}

void VtkUnstructuredGridGeometryFilterWrap::PassThroughCellIdsOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->PassThroughCellIdsOn();
}

void VtkUnstructuredGridGeometryFilterWrap::PassThroughPointIdsOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->PassThroughPointIdsOff();
}

void VtkUnstructuredGridGeometryFilterWrap::PassThroughPointIdsOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->PassThroughPointIdsOn();
}

void VtkUnstructuredGridGeometryFilterWrap::PointClippingOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->PointClippingOff();
}

void VtkUnstructuredGridGeometryFilterWrap::PointClippingOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->PointClippingOn();
}

void VtkUnstructuredGridGeometryFilterWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectBaseWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectBaseWrap *a0 = ObjectWrap::Unwrap<VtkObjectBaseWrap>(info[0]->ToObject());
		vtkUnstructuredGridGeometryFilter * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObjectBase *) a0->native.GetPointer()
		);
		VtkUnstructuredGridGeometryFilterWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkUnstructuredGridGeometryFilterWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkUnstructuredGridGeometryFilterWrap *w = new VtkUnstructuredGridGeometryFilterWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetCellClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCellClipping(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetDuplicateGhostCellClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetDuplicateGhostCellClipping(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetExtent(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsFloat64Array())
	{
		v8::Local<v8::Float64Array>a0(v8::Local<v8::Float64Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 6 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetExtent(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		double b0[6];
		if( a0->Length() < 6 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 6; i++ )
		{
			if( !a0->Get(i)->IsNumber() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->NumberValue();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetExtent(
			b0
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				if(info.Length() > 3 && info[3]->IsNumber())
				{
					if(info.Length() > 4 && info[4]->IsNumber())
					{
						if(info.Length() > 5 && info[5]->IsNumber())
						{
														if(info.Length() != 6)
							{
								Nan::ThrowError("Too many parameters.");
								return;
							}
							native->SetExtent(
								info[0]->NumberValue(),
								info[1]->NumberValue(),
								info[2]->NumberValue(),
								info[3]->NumberValue(),
								info[4]->NumberValue(),
								info[5]->NumberValue()
							);
							return;
						}
					}
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetExtentClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetExtentClipping(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetLocator(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkIncrementalPointLocatorWrap::ptpl))->HasInstance(info[0]))
	{
		VtkIncrementalPointLocatorWrap *a0 = ObjectWrap::Unwrap<VtkIncrementalPointLocatorWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetLocator(
			(vtkIncrementalPointLocator *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetMerging(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetMerging(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetOriginalCellIdsName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetOriginalCellIdsName(
			*a0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetOriginalPointIdsName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetOriginalPointIdsName(
			*a0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetPassThroughCellIds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetPassThroughCellIds(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetPassThroughPointIds(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetPassThroughPointIds(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkUnstructuredGridGeometryFilterWrap::SetPointClipping(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkUnstructuredGridGeometryFilterWrap *wrapper = ObjectWrap::Unwrap<VtkUnstructuredGridGeometryFilterWrap>(info.Holder());
	vtkUnstructuredGridGeometryFilter *native = (vtkUnstructuredGridGeometryFilter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetPointClipping(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}


text:
[![Build Status](https://travis-ci.org/simpleviewinc/url-browser-require.svg?branch=master)](https://travis-ci.org/simpleviewinc/url-browser-require)

# url-browser-require

`npm install url-browser-require`

Node `url` browserified and wrapped in require UMD to be usable in node and browser environments. It can be used in the browser with requirejs or without requirejs. In addition it can be used on the server.

# In the Browser

- Standalone: If you aren't using requirejs simply add a script tag to index.min.js and it will be exported to window.url.
- RequireJS: Add an entry to your requirejs config which points to index.min.js and export it on whatever name you desire.


text:
"""
luksmeta - command ``luksmeta show -d <device_name>``
=====================================================
This class provides parsing for the output of luksmeta <device_name>.
"""

from insights import parser, CommandParser
from insights.specs import Specs

class KeyslotSpecification:
    """
    Class ``KeyslotSpecification`` describes information about a keyslot
    collected by the ``luksmeta show`` command.

    Attributes:
        index (int): the index of the described keyslot
        state (str): the state of the described keyslot
        metadata (str): the UUID of the application that stored metadata into
            the described keyslot
    """

    def __init__(self, index, state, metadata):
        self.index = index
        self.state = state
        self.metadata = metadata

    def __repr__(self):
        ret = "Keyslot on index " + str(self.index) + " is '" + self.state + "' "
        if self.metadata:
            ret += "with metadata stored by application with UUID '" + self.metadata + "'"
        else:
            ret += "with no embedded metadata"

        return ret

@parser(Specs.luksmeta)
class LuksMeta(CommandParser, dict):
    """
    Class ``LuksMeta`` parses the output of the ``luksmeta show -d <device>`` command.

    This command prints information if the device has custom user-defined
    metadata embedded in the keyslots (used e.g. by clevis). If the device was
    not initialized using ``luksmeta``, the parser raises SkipComponent.

    The parser can be indexed by the keyslot index (in the range 0-7).
    A KeyslotSpecification object is returned, which describes every LUKS
    keyslot. The KeyslotSpecification contains the ``index``, ``state`` and
    ``metadata`` fileds. Metadata field stores the UUID of the application that
    has stored metadata in the keyslot.

    Sample input data is in the format::

        0   active empty
        1   active cb6e8904-81ff-40da-a84a-07ab9ab5715e
        2   active empty
        3   active empty
        4 inactive empty
        5   active empty
        6   active cb6e8904-81ff-40da-a84a-07ab9ab5715e
        7   active cb6e8904-81ff-40da-a84a-07ab9ab5715e

    Examples:
        >>> type(parsed_result)
        <class 'insights.parsers.luksmeta.LuksMeta'>

        >>> parsed_result[0].index
        0

        >>> parsed_result[0].state
        'active'

        >>> parsed_result[4].state
        'inactive'

        >>> parsed_result[0].metadata is None
        True

        >>> parsed_result[1].metadata
        'cb6e8904-81ff-40da-a84a-07ab9ab5715e'
    """  # noqa

    BAD_LINES = [
            "device is not initialized",
            "luksmeta data appears corrupt",
            "unknown error",
            "invalid slot",
            "is not a luksv1 device",
            "invalid argument",
            "unable to read luksv1 header"
    ]

    def __init__(self, context):
        super(LuksMeta, self).__init__(context, LuksMeta.BAD_LINES)

    def parse_content(self, content):
        filename_split = self.file_name.split(".")

        if len(filename_split) >= 4 and filename_split[-4] == "dev" and filename_split[-3] == "disk" and filename_split[-2] == "by-uuid":
            self["device_uuid"] = self.file_name.split(".")[-1] if self.file_name else None

        for line in content:
            index, state, metadata = line.split()
            index = int(index)
            metadata = None if metadata == "empty" else metadata
            self[index] = KeyslotSpecification(index, state, metadata)


text:
<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitb31a49491b1f55562394980f01ee05d1
{
    private static $loader;

    public static function loadClassLoader($class)
    {
        if ('Composer\Autoload\ClassLoader' === $class) {
            require __DIR__ . '/ClassLoader.php';
        }
    }

    public static function getLoader()
    {
        if (null !== self::$loader) {
            return self::$loader;
        }

        spl_autoload_register(array('ComposerAutoloaderInitb31a49491b1f55562394980f01ee05d1', 'loadClassLoader'), true, true);
        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
        spl_autoload_unregister(array('ComposerAutoloaderInitb31a49491b1f55562394980f01ee05d1', 'loadClassLoader'));

        $vendorDir = dirname(__DIR__);
        $baseDir = dirname($vendorDir);

        $map = require __DIR__ . '/autoload_namespaces.php';
        foreach ($map as $namespace => $path) {
            $loader->set($namespace, $path);
        }

        $map = require __DIR__ . '/autoload_psr4.php';
        foreach ($map as $namespace => $path) {
            $loader->setPsr4($namespace, $path);
        }

        $classMap = require __DIR__ . '/autoload_classmap.php';
        if ($classMap) {
            $loader->addClassMap($classMap);
        }

        $loader->register(true);

        return $loader;
    }
}

function composerRequireb31a49491b1f55562394980f01ee05d1($file)
{
    require $file;
}


text:
package com.spryrocks.imgsearch.presentation.ui.screens.core;

import android.annotation.SuppressLint;
import android.os.Bundle;

import com.spryrocks.imgsearch.presentation.ui.UiComponent;
import com.spryrocks.imgsearch.presentation.ui.utils.AlertDialogHelper;

import javax.inject.Inject;

@SuppressLint("Registered")
public class BaseActivity extends com.spryrocks.android.modules.ui.BaseActivity {
    @Inject
    AlertDialogHelper alertDialogHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        UiComponent.create(this).inject(this);

        registerLifecycleListener(alertDialogHelper);

        super.onCreate(savedInstanceState);
    }

    public void handleError(Throwable error) {
        showError(error);
    }

    public void showError(Throwable error) {
        alertDialogHelper.showError(error);
    }
}


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

namespace SqlSugar
{
    public class DmDbBind : DbBindProvider
    {
        public override string GetDbTypeName(string csharpTypeName)
        {
            if (csharpTypeName == UtilConstants.ByteArrayType.Name)
                return "blob";
            if (csharpTypeName.ToLower() == "int32")
                csharpTypeName = "int";
            if (csharpTypeName.ToLower() == "int16")
                csharpTypeName = "short";
            if (csharpTypeName.ToLower() == "int64")
                csharpTypeName = "long";
            if (csharpTypeName.ToLower().IsIn("boolean", "bool"))
                csharpTypeName = "bool";
            var mappings = this.MappingTypes.Where(it => it.Value.ToString().Equals(csharpTypeName, StringComparison.CurrentCultureIgnoreCase));
            return mappings.HasValue() ? mappings.First().Key : "varchar";
        }
        public override string GetPropertyTypeName(string dbTypeName)
        {
            dbTypeName = dbTypeName.ToLower();
            var propertyTypes = MappingTypes.Where(it => it.Value.ToString().ToLower() == dbTypeName || it.Key.ToLower() == dbTypeName);
            if (dbTypeName == "int32")
            {
                return "int";
            }
            else if (dbTypeName == "int64")
            {
                return "long";
            }
            else if (dbTypeName == "int16")
            {
                return "short";
            }
            else if (propertyTypes == null)
            {
                return "other";
            }
            else if (dbTypeName == "xml" || dbTypeName == "string")
            {
                return "string";
            }
            if (dbTypeName == "byte[]")
            {
                return "byte[]";
            }
            else if (propertyTypes == null || propertyTypes.Count() == 0)
            {
                Check.ThrowNotSupportedException(string.Format(" \"{0}\" Type NotSupported, DbBindProvider.GetPropertyTypeName error.", dbTypeName));
                return null;
            }
            else if (propertyTypes.First().Value == CSharpDataType.byteArray)
            {
                return "byte[]";
            }
            else
            {
                return propertyTypes.First().Value.ToString();
            }
        }
        public override List<KeyValuePair<string, CSharpDataType>> MappingTypes
        {
            get
            {
                var extService = this.Context.CurrentConnectionConfig.ConfigureExternalServices;
                if (extService != null && extService.AppendDataReaderTypeMappings.HasValue())
                {
                    return extService.AppendDataReaderTypeMappings.Union(MappingTypesConst).ToList();
                }
                else
                {
                    return MappingTypesConst;
                }
            }
        }
        public static List<KeyValuePair<string, CSharpDataType>> MappingTypesConst = new List<KeyValuePair<string, CSharpDataType>>()
                {
                  new KeyValuePair<string, CSharpDataType>("int",CSharpDataType.@int),
                  new KeyValuePair<string, CSharpDataType>("integer",CSharpDataType.@int),
                  new KeyValuePair<string, CSharpDataType>("interval year to  month",CSharpDataType.@int),
                  new KeyValuePair<string, CSharpDataType>("interval day to  second",CSharpDataType.@int),

                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@int),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@float),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@short),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@byte),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@double),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@long),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@bool),
                  new KeyValuePair<string, CSharpDataType>("bit",CSharpDataType.@bool),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@decimal),
                  new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.Single),
                  new KeyValuePair<string, CSharpDataType>("decimal",CSharpDataType.@decimal),
                  new KeyValuePair<string, CSharpDataType>("decimal",CSharpDataType.Single),

                  new KeyValuePair<string, SqlSugar.CSharpDataType>("double precision",CSharpDataType.@double),
                  new KeyValuePair<string, SqlSugar.CSharpDataType>("binary", CSharpDataType.@byteArray),

                  new KeyValuePair<string, CSharpDataType>("varchar",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("varchar",CSharpDataType.@Guid),
                  new KeyValuePair<string, CSharpDataType>("varchar2",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("nvarchar2",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("longvarchar",CSharpDataType.@string),

                  new KeyValuePair<string, CSharpDataType>("char",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("nchar",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("clob",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("text",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("long",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("nclob",CSharpDataType.@string),
                  new KeyValuePair<string, CSharpDataType>("rowid",CSharpDataType.@string),

                  new KeyValuePair<string, CSharpDataType>("date",CSharpDataType.DateTime),
                  new KeyValuePair<string, CSharpDataType>("timestamp",CSharpDataType.DateTime),
                  new KeyValuePair<string, CSharpDataType>("timestamp with local time zone",CSharpDataType.DateTime),
                  new KeyValuePair<string, CSharpDataType>("timestamp with time zone",CSharpDataType.DateTime),
                  new KeyValuePair<string, CSharpDataType>("timestamp with time zone",CSharpDataType.DateTime),

                  new KeyValuePair<string, CSharpDataType>("float",CSharpDataType.@decimal),

                  new KeyValuePair<string, CSharpDataType>("blob",CSharpDataType.byteArray),
                  new KeyValuePair<string, CSharpDataType>("long raw",CSharpDataType.byteArray),
                  new KeyValuePair<string, CSharpDataType>("raw",CSharpDataType.byteArray),
                  new KeyValuePair<string, CSharpDataType>("bfile",CSharpDataType.byteArray),
                  new KeyValuePair<string, CSharpDataType>("varbinary",CSharpDataType.byteArray) };
        public override List<string> StringThrow
        {
            get
            {
                return new List<string>() { "int32", "datetime", "decimal", "double", "byte" };
            }
        }
    }
}


text:
package com.rishi.dailywagers.util;

import android.util.Log;

import com.prolificinteractive.materialcalendarview.CalendarDay;
import com.rishi.dailywagers.constants.ExcludedDaysOfWeek;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * Utility to work with dates as per requirement
 * Created by rishi on 6/30/16.
 */
public class DateUtil {

    private static final String TAG = "DateUtil";
    private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("dd MMM yyy");

    /**
     * Returns the current display date in provided format
     * @return
     */
    public static String getCurrentDisplayDate(){
        Calendar cal = Calendar.getInstance();
        Date date = cal.getTime();

        return FORMATTER.format(date);
    }

    /**
     * Returns display date based on the year, month and day provided.
     * @param year
     * @param month
     * @param day
     * @return
     */
    public static String getDisplayDate(int year, int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(0);
        cal.set(year, month, day);
        Date date = cal.getTime();

        return FORMATTER.format(date);
    }

    /**
     * Returns the display date using {@link CalendarDay}
     * @param calendarDay
     * @return
     */
    public static String getDisplayDate(CalendarDay calendarDay) {
        Date date = calendarDay.getDate();
        return FORMATTER.format(date);
    }

    /**
     * Returns {@link CalendarDay} using date as string
     * @param strDate
     * @return
     */
    public static CalendarDay getCalendarDay(String strDate){
        try {
            Date date = FORMATTER.parse(strDate);
            return CalendarDay.from(date);
        }catch (ParseException ex){
            Log.e(TAG, "Error parsing date "+ ex.getStackTrace());
        }
        return null;
    }

    /**
     * Calculates and returns the total days between the days
     * @param start
     * @param end
     * @param excludedDaysOfWeek
     * @return
     */
    public static int getDays(CalendarDay start, CalendarDay end, List<ExcludedDaysOfWeek> excludedDaysOfWeek){
        Log.d(TAG, "Start date "+start.toString() + " end date is "+ end.toString());
        Date startDate = start.getDate();
        Date endDate = end.getDate();
        long diff = endDate.getTime() - startDate.getTime();
        long deno = 24*60*60*1000;
        Log.d(TAG, "Final days "+ diff/deno);
        int totalDays = (int)(diff/deno) + 1;
        int excludedDays = 0;

        Calendar calStart = Calendar.getInstance();
        calStart.setTime(startDate);
        Calendar calEnd = Calendar.getInstance();
        calEnd.setTime(endDate);

        while(!calStart.after(calEnd)) {
            for(ExcludedDaysOfWeek day : excludedDaysOfWeek){
                if(calStart.get(Calendar.DAY_OF_WEEK) == day.getDay()) {
                    excludedDays++;
                }
            }
            calStart.add(Calendar.DATE,1);
        }
        Log.d(TAG, "Days to be excluded are "+ excludedDays);
        totalDays = totalDays - excludedDays;
        return totalDays;
    }

    /**
     * Returns days when end date is available
     * @param endDate
     * @param excludedDaysOfWeek
     * @return
     */
    public static int getDaysUsingEndDate(CalendarDay endDate, List<ExcludedDaysOfWeek> excludedDaysOfWeek){
        CalendarDay startDate = getCalendarDay(getDisplayDate(endDate.getYear(), endDate.getMonth(), 1));
        return getDays(startDate, endDate, excludedDaysOfWeek);
    }

    public static CalendarDay getMonthStartDate(CalendarDay endDate){
        return getCalendarDay(getDisplayDate(endDate.getYear(), endDate.getMonth(), 1));
    }

    public static CalendarDay getMonthEndDate(CalendarDay startDate){
        return getCalendarDay(getDisplayDate(startDate.getYear(), startDate.getMonth(), startDate.getCalendar().getActualMaximum(Calendar.DAY_OF_MONTH)));
    }

    /**
     * Returns days when start is available
     * @param startDate
     * @param excludedDaysOfWeek
     * @return
     */
    public static int getDaysUsingStartDate(CalendarDay startDate, List<ExcludedDaysOfWeek> excludedDaysOfWeek){
        CalendarDay endDate = getCalendarDay(getDisplayDate(startDate.getYear(), startDate.getMonth(), startDate.getCalendar().getActualMaximum(Calendar.DAY_OF_MONTH)));
        return getDays(startDate, endDate, excludedDaysOfWeek);
    }

    /**
     * Returns days in the month
     * @param currentMonth
     * @param excludedDaysOfWeek
     * @return
     */
    public static int getDaysInMonth(int currentMonth, List<ExcludedDaysOfWeek> excludedDaysOfWeek){
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MONTH, currentMonth);
        int totalDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        int excludedDays = 0;
        for(ExcludedDaysOfWeek day : excludedDaysOfWeek){
            calendar.set(Calendar.DAY_OF_WEEK, day.getDay());
            excludedDays = excludedDays + calendar.getActualMaximum(Calendar.DAY_OF_WEEK_IN_MONTH);
        }
        totalDays = totalDays - excludedDays;
        Log.d(TAG, "After excluding days "+ totalDays);
        return totalDays;
    }
}


text:
@interface NewsTableViewController : UITableViewController

// 请求地址
@property (nonatomic, copy) NSString *urlStr;

@end


text:
package testing

import (
	"appengine/datastore"
	"fmt"
	"reflect"

	. "launchpad.net/gocheck"
)

// reflect.TypeOf(int64)
var typeOfInt64 = reflect.TypeOf((*int64)(nil)).Elem()

// Key builds a datastore.Key from pairs of (kind, id) arguments. Kind must
// be a string while id can be any value. If it is convertible to int64 then
// it is used as an IntID, otherwise it is stringified and used as the
// StringID. If more than one pair of values are given, the first becomes the
// parent of the second, and so on. If any errors occur, nil is returned.
func (ctx *Context) Key(args ...interface{}) (key *datastore.Key) {
	// Must have an even number of args
	if len(args)%2 != 0 {
		return nil
	}

	// Loop through the arg pairs
	for i := 0; i < len(args); i += 2 {
		kind, ok := args[i].(string)
		if !ok {
			return nil
		}
		value := args[i+1]

		// Parse the second arg as either a number or a string id
		stringId, intId := "", int64(0)
		typeOf := reflect.TypeOf(value)
		if typeOf.ConvertibleTo(typeOfInt64) {
			intId = reflect.ValueOf(value).Convert(typeOfInt64).Interface().(int64)
		} else {
			stringId = fmt.Sprint(value)
		}

		// Create the key as a child of the previous key (if any)
		key = datastore.NewKey(ctx, kind, stringId, intId, key)
	}

	return key
}

type Entity map[string]interface{}

func (e Entity) Key() *datastore.Key {
	key := e["__key__"]
	if key != nil {
		return key.(*datastore.Key)
	} else {
		return nil
	}
}

func (e Entity) Load(c <-chan datastore.Property) error {
	for p := range c {
		e[p.Name] = p.Value
	}

	return nil
}

func (e Entity) Save(c chan<- datastore.Property) error {
	defer close(c)

	for name, value := range e {
		if name != "__key__" {
			// TODO: handle slices?
			c <- datastore.Property{
				Name:  name,
				Value: value,
			}
		}
	}

	return nil
}

func (ctx *Context) PutAll(c *C, entities ...Entity) {
	// Get the keys for each Entity
	keys := make([]*datastore.Key, len(entities))
	for i, e := range entities {
		keys[i] = e.Key()
	}

	// Insert into the database
	_, err := datastore.PutMulti(ctx, keys, entities)
	c.Assert(err, IsNil)
}

func (ctx *Context) GetAll(c *C) map[string]Entity {
	// Get the keys for all currently stored Entities
	keys := ctx.allKeys(c)

	// Create a slice for the resulting values
	values := make([]Entity, len(keys))
	for i, key := range keys {
		values[i] = Entity{"__key__": key}
	}

	// Get the Entities
	err := datastore.GetMulti(ctx, keys, values)
	c.Assert(err, IsNil)

	// Convert the slices into a map to return
	all := make(map[string]Entity, len(keys))
	for i, k := range keys {
		all[k.Encode()] = values[i]
	}
	return all
}


text:
#ifndef EXPONENTIATE_HPP_UK24TBWI
#define EXPONENTIATE_HPP_UK24TBWI

#include "binaryoperator.hpp"
#include <cmath>
#include <ostream>

namespace AEC {
    template<typename NumberType>
    class Exponentiate : public BinaryOperator<NumberType> {
    public:
        using BinaryOperator<NumberType>::BinaryOperator;

        virtual std::ostream& outputString(std::ostream& os) const {
            return os << "^";
        }

        virtual NumberType perform(NumberType left, NumberType right) const {
            return std::pow(left, right);
        }
    };
}

#endif /* end of include guard: EXPONENTIATE_HPP_UK24TBWI */


text:
module Thinkspace
  module ReadinessAssurance
    module Api
      class ChatsController < ::Totem::Settings.class.thinkspace.authorization_api_controller
        load_and_authorize_resource class: totem_controller_model_class
        totem_action_authorize!

        def add
          value = validate_and_set_chat_data
          if team?
            publish(value)
          else
            access_denied "Chat messages are only for team based ownerables [ownerable: #{ownerable.inspect}]"
          end
        end

        private

        include ReadinessAssurance::ControllerHelpers::Base

        def validate_and_set_chat_data
          response = @chat.thinkspace_readiness_assurance_response
          access_denied "Chat id #{@chat.id} response is blank."  if response.blank?
          @assessment = response.thinkspace_readiness_assurance_assessment
          message     = params[:message]
          access_denied "Chat message is blank."  if message.blank?
          messages = @chat.messages
          access_denied "Chat messages is not a Hash."  unless messages.is_a?(Hash)
          question_messages = (messages[question_id] ||= Array.new)
          access_denied "Chat question messages is not an array."  unless question_messages.is_a?(Array)
          chat_message = {message: message, time: Time.now.utc}.merge(current_user_json)
          question_messages.push(chat_message)
          access_denied "Could not save chat.  Validation errors: #{@chat.errors.messages}."  unless @chat.save
          {question_id: question_id, message: chat_message}
        end

        def publish(value)
          pubsub.data.
            room(pubsub_room).
            room_event(:chat).
            value(value).
            publish
          controller_render_no_content
        end

      end
    end
  end
end


text:
import java.util.Arrays;

public class LCS {

	// LCS using Non-Linear memory algorithm
	static class NonLinear {

		public static String computeLCS(String s1, String s2) {

			// Calculating the edit distance table and storing in 2-D array
			int[][] edTable = new int[s2.length() + 1][s1.length() + 1];
			computeEditDistanceTable(s1, s2, edTable);

			// Stitch the Longest common subsequence by Backtracking
			return computeLCSUtil(s1.toCharArray(), s2.toCharArray(), edTable);
		}

		private static void computeEditDistanceTable(String s1, String s2,
				int[][] edTable) {

			// Initial Check for empty strings as input
			if (s1.length() == 0 || s2.length() == 0) {
				// Print Normalized edit distance
				// System.out.println("Normalized Edit Distance is: "
				// + (float)(s1.length()+s2.length()-Math.max(s1.length(),
				// s2.length()))/(float)(s1.length()+s2.length()) );
				return;
			}

			int topDownIndex = 0;

			// Initializing the first row of the table
			for (int i = 0; i < edTable[0].length; i++) {
				edTable[0][i] = i;
			}

			// This call is to build the remaining rows of the table using the
			// buildTable() method
			buildTable(s1.toCharArray(), s2.toCharArray(), topDownIndex,
					edTable);

			// Print the computed table
			//printTable(edTable);
			// Print Normalized edit distance
			// System.out.println("Normalized Edit Distance is: "
			// +
			// (float)(s1.length()+s2.length()-edTable[s2.length()][s1.length()])/(float)(s1.length()+s2.length()));

		}

		private static void buildTable(char[] s1, char[] s2, int topDownIndex,
				int[][] edTable) {

			// Using the values of previous row and left cell of the current
			// row, computing the remaining values of current row
			edTable[topDownIndex + 1][0] = topDownIndex + 1;
			for (int i = 1; i < edTable[topDownIndex + 1].length; i++) {

				if (s2[topDownIndex] == s1[i - 1]) {
					edTable[topDownIndex + 1][i] = edTable[topDownIndex][i - 1];
				} else {
					edTable[topDownIndex + 1][i] = (edTable[topDownIndex + 1][i - 1] < edTable[topDownIndex][i]) ? edTable[topDownIndex + 1][i - 1] + 1
							: edTable[topDownIndex][i] + 1;
				}
			}

			// [***EXIT CHECK***]
			// Check for the 'topDownIndex' reached the last symbol of the
			// top-down string
			if (topDownIndex == s2.length - 1) {
				return;
			}

			// Tail recursion to build the next row
			buildTable(s1, s2, topDownIndex + 1, edTable);
		}

		private static String computeLCSUtil(char[] s1, char[] s2,
				int[][] edTable) {

			// Initial check of empty strings in given inputs
			if (s1.length == 0 || s2.length == 0) {
				return "Empty String!!";
			}

			int row = s2.length;
			int column = s1.length;
			String lcs = "";

			// Backtracking the edTable to find the Longest common subsequence
			for (int i = 0; i < s1.length + s2.length + 2 && row > 0
					&& column > 0; i++) {

				if (s1[column - 1] == s2[row - 1]) {
					lcs = String.valueOf(s1[column - 1]) + lcs;
					row--;
					column--;
				} else {
					if (edTable[row][column - 1] <= edTable[row - 1][column]) {
						column--;
					} else {
						row--;
					}
				}
			}

			return lcs;

		}

		private static void printTable(int[][] edTable) {

			for (int i = 0; i < edTable.length; i++) {
				for (int j = 0; j < edTable[i].length; j++) {
					System.out.print(edTable[i][j] + " ");
				}
				System.out.println();
			}

		}

	}

	// LCS using Linear memory algorithm
	static class Linear {

		// Reason for using this static variable 'finalLCS' instead of passing
		// as argument is,
		// to avoid stack overflow error on recursive calls. Because java keep
		// track of recursive calls in a
		// stack, when the string length is very large, there will be so many
		// recursive calls and eventually
		// that will cause the stack overflow error.
		// JVM does not provide tail calls in its byte code, so the stack
		// implementation

		private static String finalLCS = "";

		public static String computeLCS(String s1, String s2) {

			computeLCSUtil(s1, s2);
			return finalLCS;

		}

		private static void computeLCSUtil(String s1, String s2) {

			// Check for the base case, whether the divided table has either one
			// row or one column
			if (s1.length() == 1) {

				for (int i = 0; i < s2.length(); i++) {
					if (s1.toCharArray()[0] == s2.toCharArray()[i]) {
						finalLCS = finalLCS + s1;
						return;
					}
				}
			} else if (s2.length() == 1) {

				for (int i = 0; i < s1.length(); i++) {
					if (s2.toCharArray()[0] == s1.toCharArray()[i]) {
						finalLCS = finalLCS + s2;
						return;
					}
				}
			}
			// Else
			// Compute the middle two rows
			// Find the minimum edit distance pair and make a vertical and
			// horizontal split of the table
			// Discard the 1st and 3rd quadrant of the table and repeat this
			// process until it reaches the base case
			else {

				int[] topRow = new int[s1.length() + 1];
				int[] forwardMiddleRow = new int[s1.length() + 1];
				int[] reverseMiddleRow = new int[s1.length() + 1];
				int topDownIndex = 0;

				// Initialize topRow once
				for (int i = 0; i < topRow.length; i++) {
					topRow[i] = i;
				}

				// Forward Middle Row
				computeMiddleRows(s1.toCharArray(),
						s2.substring(0, s2.length() / 2).toCharArray(), topRow,
						topDownIndex, forwardMiddleRow);

				// Reverse Middle Row
				int[] tempReverseMiddleRow = new int[s1.length() + 1];
				computeMiddleRows(new StringBuilder(s1).reverse().toString()
						.toCharArray(),
						new StringBuilder(s2.substring(s2.length() / 2))
								.reverse().toString().toCharArray(), topRow,
						topDownIndex, tempReverseMiddleRow);

				// tempReverseMiddle row is computed like forwardMiddle row,
				// Hence we need to reverse it to get the actual
				// reverseMiddleRow
				for (int i = 0, j = tempReverseMiddleRow.length - 1; i < tempReverseMiddleRow.length; i++) {
					reverseMiddleRow[i] = tempReverseMiddleRow[j];
					j--;
				}

				// Finding the vertical and horizontal splits
				int verticalSplit = 0, horizontalSplit = 0;
				horizontalSplit = s2.length() / 2;
				int smallest = forwardMiddleRow[0] + reverseMiddleRow[0];
				// Compute Using the middle rows
				for (int i = 1; i < forwardMiddleRow.length; i++) {
					if (smallest > forwardMiddleRow[i] + reverseMiddleRow[i]) {
						smallest = forwardMiddleRow[i] + reverseMiddleRow[i];
						verticalSplit = i;
					}
				}

				// Splitting the strings for the recursive calls
				String s1_front = s1.substring(0, verticalSplit);
				String s1_back = s1.substring(verticalSplit, s1.length());
				String s2_front = s2.substring(0, horizontalSplit);
				String s2_back = s2.substring(horizontalSplit, s2.length());

				// Recursive calls
				computeLCSUtil(s1_front, s2_front);
				computeLCSUtil(s1_back, s2_back);

				// Print two rows
				// System.out.println(Arrays.toString(forwardMiddleRow));
				// System.out.println(Arrays.toString(reverseMiddleRow));

			}

		}

		private static void computeMiddleRows(char[] s1, char[] s2,
				int[] topRow, int topDownIndex, int[] computedRow) {

			// Computing the current row using the previous row values
			computedRow[0] = topDownIndex + 1;
			for (int i = 1; i < computedRow.length; i++) {

				if (s2[topDownIndex] == s1[i - 1]) {
					computedRow[i] = topRow[i - 1];
				} else {
					computedRow[i] = (computedRow[i - 1] < topRow[i]) ? computedRow[i - 1] + 1
							: topRow[i] + 1;
				}
			}

			// [***Exit Check***]
			// Check for the 'topDownIndex' reached the last symbol of the
			// top-down string
			if (topDownIndex == s2.length - 1) {
				return;
			}

			// Since arrays are passed by reference, copying just the values of
			// bottom row to top row and making bottom row empty
			for (int i = 0; i < topRow.length; i++) {
				topRow[i] = computedRow[i];
			}
			Arrays.fill(computedRow, 0);
			computeMiddleRows(s1, s2, topRow, topDownIndex + 1, computedRow);

		}

	}

}


text:
package com.jaquadro.minecraft.chameleon.core;

public class CommonProxy
{
    public void preInitSidedResources ()
    { }

    public void initSidedResources ()
    { }
}


text:
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.

This example shows you how to implement and configure a simple incoming, server-side interceptor with ActiveMQ Artemis.

ActiveMQ Artemis allows an application to use an interceptor to hook into the messaging system. To intercept "core" packets all that needs to be done is to implement the `org.apache.activemq.artemis.api.core.Interceptor` interface.

Once you have your own interceptor class, add it to the broker.xml, as follows:

    <core>
       ...
       <remoting-incoming-interceptors>
          <class-name>org.apache.activemq.artemis.jms.example.SimpleInterceptor</class-name>
       </remoting-incoming-interceptors>
       ...
    </core>

With interceptors, you can handle various events in message processing. In this example, a simple interceptor, SimpleInterceptor, is implemented and configured. When the example is running the interceptor will print out each events that are passed in the interceptor. And it will add a string property to the message being delivered. You can see that after the message is received, there will be a new string property appears in the received message.

With our interceptor we always return `true` from the `intercept` method. If we were to return `false` that signifies that no more interceptors are to run or the target is not to be called. Return `false` to abort processing of the packet.


text:
import yaml
import time
import sched
import logging
import importlib

class checks():
    def __init__(self, config):
        # Init data
        self.tests = {}
        self.checks = []

        # Get logger
        self.logger = logging.getLogger('supext')
        self.logger.info('Loading checks and test modules')

        # Init scheduler for muted checks
        self.scheduler = sched.scheduler(time.time, time.sleep)
        self.scheduler.run()

        # Get checks, add them to self.check and load new test module if needed
        for name, data in config.items():
            # Add it to self.checks and format data
            try:
                check = {
                    'name': name,
                    'test': data.pop('test'),
                    'canary': data.pop('canary', False),
                    'config': data.pop('config', None),
                    'location': data.pop('location', None),
                    'meta': data,
                    'muted': False,
                    'last_result': {}
                }
            except (KeyError):
                self.logger.error('Check {0} is missing a type, ignoring it'.format(name))
                continue

            # Check if the test module isn't already loaded, if it isn't, load it
            # also, add the check to self.checks only if already present or loaded correctly
            # to avoid having checks that tries to call a unloaded test module
            test = check['test']
            if not test in self.tests:
                try:
                    # Get class from module dynamically
                    module = importlib.import_module('supext.modules.tests.{0}'.format(test))
                    self.tests[test] = getattr(module, test)()
                    self.logger.debug('Loaded test {0}'.format(test))
                    self.checks.append(check)
                except (ImportError, AttributeError):
                    self.logger.error('Cannot load test {0}'.format(test))
            else:
                self.checks.append(check)

    def run(self, name, update=True):
        check = self.get(name)
        result = self.tests[check['test']].run(check['config'])
        if update:
            check['last_result'] = result
        return result

    def getCanaries(self):
        canaries = []
        for check in self.checks:
            if check['canary'] == True:
                self.logger.debug('Got canary check {0}'.format(check['name']))
                canaries.append(check)
        return canaries

    def getAll(self):
        return self.checks

    def get(self, name):
        for check in self.checks:
            if check['name'] == name:
                return check
        return None

    def getFromLocation(self, name):
        checks = []
        for check in self.checks:
            if check['location'] == name:
                checks.append(check)
        return checks

    def getMuted(self):
        muted = []
        for check in self.checks:
            if check['muted']:
                muted.append(check)
        return muted

    def mute(self, name, duration=120):
        def unmute(check):
            check['muted'] = False

        check = self.get(name)
        location = self.getFromLocation(name)

        if not check and not location:
            self.logger.warn('Tried to mute unknown check or location {0}'.format(name))
            return False

        # Try to mute the check first
        # Else try location (= mute all checks for location)
        if check:
            check['muted'] = True
            self.scheduler.enter(int(duration), 1, unmute, (check))
        elif location:
            for check in location:
                self.mute(check['name'], duraction)

        return True


text:
<?php
Class Home_Model extends MY_Model{
	var $table = 'tb_employee';
	var $key = 'id';
}


text:
package io.druid.indexer.path;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.druid.indexer.HadoopDruidIndexerConfig;
import org.apache.hadoop.mapreduce.Job;

import java.io.IOException;

/**
 */
@JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property="type")
@JsonSubTypes(value={
    @JsonSubTypes.Type(name="granular_unprocessed", value=GranularUnprocessedPathSpec.class),
    @JsonSubTypes.Type(name="granularity", value=GranularityPathSpec.class),
    @JsonSubTypes.Type(name="static", value=StaticPathSpec.class),
    @JsonSubTypes.Type(name="dataSource", value=DatasourcePathSpec.class),
    @JsonSubTypes.Type(name="multi", value=MultiplePathSpec.class)
})
public interface PathSpec
{
  public Job addInputPaths(HadoopDruidIndexerConfig config, Job job) throws IOException;
}


text:
package name.brian_gordon.java8_demo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author Brian Gordon
 */
public class SortList {
	public static void main(String[] args) {
		List<String> items = new ArrayList<>();
		items.add("Banana");
		items.add("Apple");
		items.add("Apricot");
		items.add("Papaya");
		items.add("Durian");
		items.add("Kiwi");

		// Sort items in reverse.
		Collections.sort(items, new Comparator<String>() {
			@Override
			public int compare(String o1, String o2) {
				return o2.compareTo(o1);
			}
		});

		for(String item : items) {
			System.out.println(item);
		}
	}
}