text:
#include <iterator>
#include <vector>

#include "tensorflow/core/common_runtime/function.h"
#include "tensorflow/core/common_runtime/input_colocation_exemption_registry.h"
#include "tensorflow/core/framework/dataset.h"
#include "tensorflow/core/framework/partial_tensor_shape.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/kernels/data/captured_function.h"
#include "tensorflow/core/kernels/data/dataset_utils.h"
#include "tensorflow/core/lib/random/random.h"

namespace tensorflow {
namespace data {
namespace experimental {
namespace {

class ScanDatasetOp : public UnaryDatasetOpKernel {
 public:
  explicit ScanDatasetOp(OpKernelConstruction* ctx)
      : UnaryDatasetOpKernel(ctx) {
    FunctionMetadata::Params params;
    params.is_multi_device_function = true;
    if (ctx->HasAttr("use_default_device")) {
      OP_REQUIRES_OK(ctx,
                     ctx->GetAttr("use_default_device", &use_default_device_));
      params.use_default_device = use_default_device_;
    }
    OP_REQUIRES_OK(ctx,
                   FunctionMetadata::Create(ctx, "f", params, &func_metadata_));
    OP_REQUIRES_OK(ctx, ctx->GetAttr("Tstate", &state_types_));
    OP_REQUIRES_OK(ctx, ctx->GetAttr("output_types", &output_types_));
    OP_REQUIRES_OK(ctx, ctx->GetAttr("output_shapes", &output_shapes_));
    OP_REQUIRES_OK(
        ctx, ctx->GetAttr("preserve_cardinality", &preserve_cardinality_));
  }

  void MakeDataset(OpKernelContext* ctx, DatasetBase* input,
                   DatasetBase** output) override {
    OpInputList initial_state_inputs;
    OP_REQUIRES_OK(ctx,
                   ctx->input_list("initial_state", &initial_state_inputs));
    std::vector<Tensor> initial_state(initial_state_inputs.begin(),
                                      initial_state_inputs.end());

    std::unique_ptr<CapturedFunction> captured_func;
    OP_REQUIRES_OK(
        ctx, CapturedFunction::Create(ctx, func_metadata_, "other_arguments",
                                      &captured_func));

    *output =
        new Dataset(ctx, input, std::move(initial_state),
                    std::move(captured_func), state_types_, output_types_,
                    output_shapes_, preserve_cardinality_, use_default_device_);
  }

 private:
  class Dataset : public DatasetBase {
   public:
    Dataset(OpKernelContext* ctx, const DatasetBase* input,
            std::vector<Tensor> initial_state,
            std::unique_ptr<CapturedFunction> captured_func,
            const DataTypeVector& state_types,
            const DataTypeVector& output_types,
            const std::vector<PartialTensorShape>& output_shapes,
            bool preserve_cardinality, bool use_default_device)
        : DatasetBase(DatasetContext(ctx)),
          input_(input),
          initial_state_(std::move(initial_state)),
          captured_func_(std::move(captured_func)),
          state_types_(state_types),
          output_types_(output_types),
          output_shapes_(output_shapes),
          preserve_cardinality_(preserve_cardinality),
          use_default_device_(use_default_device) {
      input_->Ref();
    }

    ~Dataset() override { input_->Unref(); }

    std::unique_ptr<IteratorBase> MakeIteratorInternal(
        const string& prefix) const override {
      return absl::make_unique<Iterator>(
          Iterator::Params{this, strings::StrCat(prefix, "::Scan")});
    }

    const DataTypeVector& output_dtypes() const override {
      return output_types_;
    }
    const std::vector<PartialTensorShape>& output_shapes() const override {
      return output_shapes_;
    }

    string DebugString() const override { return "ScanDatasetOp::Dataset"; }

    int64 Cardinality() const override { return input_->Cardinality(); }

    Status CheckExternalState() const override {
      TF_RETURN_IF_ERROR(captured_func_->CheckExternalState());
      return input_->CheckExternalState();
    }

   protected:
    Status AsGraphDefInternal(SerializationContext* ctx,
                              DatasetGraphDefBuilder* b,
                              Node** output) const override {
      Node* input_node;
      TF_RETURN_IF_ERROR(b->AddInputDataset(ctx, input_, &input_node));
      std::vector<Node*> initial_state_nodes;
      initial_state_nodes.reserve(initial_state_.size());
      for (const Tensor& t : initial_state_) {
        Node* node;
        TF_RETURN_IF_ERROR(b->AddTensor(t, &node));
        initial_state_nodes.emplace_back(node);
      }
      std::vector<Node*> other_arguments;
      DataTypeVector other_arguments_types;
      TF_RETURN_IF_ERROR(captured_func_->AddToGraph(ctx, b, &other_arguments,
                                                    &other_arguments_types));
      AttrValue f;
      b->BuildAttrValue(captured_func_->func(), &f);
      AttrValue state_types;
      b->BuildAttrValue(state_types_, &state_types);
      AttrValue other_arguments_types_attr;
      b->BuildAttrValue(other_arguments_types, &other_arguments_types_attr);
      AttrValue preserve_cardinality_attr;
      b->BuildAttrValue(preserve_cardinality_, &preserve_cardinality_attr);
      AttrValue use_default_device_attr;
      b->BuildAttrValue(use_default_device_, &use_default_device_attr);
      TF_RETURN_IF_ERROR(
          b->AddDataset(this, {{0, input_node}},
                        {{1, initial_state_nodes}, {2, other_arguments}},
                        {{"f", f},
                         {"Tstate", state_types},
                         {"Targuments", other_arguments_types_attr},
                         {"preserve_cardinality", preserve_cardinality_attr},
                         {"use_default_device", use_default_device_attr}},
                        output));
      return Status::OK();
    }

   private:
    class Iterator : public DatasetIterator<Dataset> {
     public:
      explicit Iterator(const Params& params)
          : DatasetIterator<Dataset>(params),
            state_(params.dataset->initial_state_) {}

      Status Initialize(IteratorContext* ctx) override {
        TF_RETURN_IF_ERROR(
            dataset()->input_->MakeIterator(ctx, this, prefix(), &input_impl_));
        return dataset()->captured_func_->Instantiate(
            ctx, &instantiated_captured_func_);
      }

      Status GetNextInternal(IteratorContext* ctx,
                             std::vector<Tensor>* out_tensors,
                             bool* end_of_sequence) override {
        mutex_lock l(mu_);

        std::vector<Tensor> next_element;
        TF_RETURN_IF_ERROR(
            input_impl_->GetNext(ctx, &next_element, end_of_sequence));
        if (*end_of_sequence) {
          return Status::OK();
        }

        std::vector<Tensor> args;
        args.reserve(state_.size() + next_element.size());
        std::copy(state_.begin(), state_.end(), std::back_inserter(args));
        std::copy(next_element.begin(), next_element.end(),
                  std::back_inserter(args));

        std::vector<Tensor> state_and_output;
        state_and_output.reserve(dataset()->state_types_.size() +
                                 output_dtypes().size());

        Status s = instantiated_captured_func_->Run(ctx, std::move(args),
                                                    &state_and_output);
        DCHECK(state_and_output.size() <=
               dataset()->state_types_.size() + output_dtypes().size());
        if (s.ok()) {
          state_.clear();
          size_t i = 0;
          for (; i < dataset()->state_types_.size(); ++i) {
            if (state_and_output[i].dtype() != dataset()->state_types_[i]) {
              return errors::InvalidArgument(
                  "Got wrong type for scan_func return value ", i,
                  " (expected ", DataTypeString(dataset()->state_types_[i]),
                  ", got ", DataTypeString(state_and_output[i].dtype()), ").");
            }
            state_.push_back(std::move(state_and_output[i]));
          }
          for (; i < state_and_output.size(); ++i) {
            const size_t output_index = i - dataset()->state_types_.size();
            if (state_and_output[i].dtype() != output_dtypes()[output_index]) {
              return errors::InvalidArgument(
                  "Got wrong type for scan_func return value ", i,
                  " (expected ",
                  DataTypeString(dataset()->state_types_[output_index]),
                  ", got ", DataTypeString(state_and_output[i].dtype()), ").");
            }
            if (!output_shapes()[output_index].IsCompatibleWith(
                    state_and_output[i].shape())) {
              return errors::InvalidArgument(
                  "Got wrong shape for scan_func return value ", i,
                  " (expected ", output_shapes()[output_index].DebugString(),
                  ", got ", state_and_output[i].shape().DebugString(), ").");
            }

            out_tensors->push_back(std::move(state_and_output[i]));
          }
        } else if (errors::IsOutOfRange(s)) {
          if (dataset()->preserve_cardinality_) {
            // To guarantee that the transformation preserves the cardinality of
            // the dataset, we convert `OutOfRange` to `InvalidArgument` as the
            // former may be interpreted by a caller as the end of sequence.
            return errors::InvalidArgument(
                "Function invocation produced OutOfRangeError: ",
                s.error_message());
          } else {
            // `f` may deliberately raise `errors::OutOfRange` to indicate
            // that we should terminate the iteration early.
            *end_of_sequence = true;
            return Status::OK();
          }
        }
        return s;
      }

     protected:
      std::shared_ptr<model::Node> CreateNode(
          IteratorContext* ctx, model::Node::Args args) const override {
        return model::MakeKnownRatioNode(std::move(args),
                                         /*ratio=*/1);
      }

      Status SaveInternal(IteratorStateWriter* writer) override {
        TF_RETURN_IF_ERROR(dataset()->captured_func_->CheckExternalState());
        mutex_lock l(mu_);
        TF_RETURN_IF_ERROR(SaveInput(writer, input_impl_));
        if (!state_.empty()) {
          TF_RETURN_IF_ERROR(
              writer->WriteScalar(full_name("state_size"), state_.size()));
          for (int idx = 0; idx < state_.size(); idx++) {
            TF_RETURN_IF_ERROR(writer->WriteTensor(
                full_name(strings::StrCat("state[", idx, "]")), state_[idx]));
          }
        }
        return Status::OK();
      }

      Status RestoreInternal(IteratorContext* ctx,
                             IteratorStateReader* reader) override {
        mutex_lock l(mu_);
        TF_RETURN_IF_ERROR(RestoreInput(ctx, reader, input_impl_));
        if (reader->Contains(full_name("state_size"))) {
          int64 size;
          TF_RETURN_IF_ERROR(
              reader->ReadScalar(full_name("state_size"), &size));
          state_.resize(size);
          for (int idx = 0; idx < size; idx++) {
            TF_RETURN_IF_ERROR(reader->ReadTensor(
                full_name(strings::StrCat("state[", idx, "]")), &state_[idx]));
          }
        }
        return Status::OK();
      }

     private:
      mutex mu_;
      std::unique_ptr<IteratorBase> input_impl_ TF_GUARDED_BY(mu_);
      std::vector<Tensor> state_ TF_GUARDED_BY(mu_);
      std::unique_ptr<InstantiatedCapturedFunction> instantiated_captured_func_;
    };

    const DatasetBase* const input_;
    const std::vector<Tensor> initial_state_;
    const std::unique_ptr<CapturedFunction> captured_func_;
    const DataTypeVector state_types_;
    const DataTypeVector output_types_;
    const std::vector<PartialTensorShape> output_shapes_;
    const bool preserve_cardinality_;
    const bool use_default_device_;
  };

  std::shared_ptr<FunctionMetadata> func_metadata_ = nullptr;
  DataTypeVector state_types_;
  DataTypeVector output_types_;
  std::vector<PartialTensorShape> output_shapes_;
  bool preserve_cardinality_;
  bool use_default_device_;
};

REGISTER_KERNEL_BUILDER(Name("ScanDataset").Device(DEVICE_CPU), ScanDatasetOp);
REGISTER_KERNEL_BUILDER(Name("ExperimentalScanDataset").Device(DEVICE_CPU),
                        ScanDatasetOp);

REGISTER_INPUT_COLOCATION_EXEMPTION("ScanDataset");
REGISTER_INPUT_COLOCATION_EXEMPTION("ExperimentalScanDataset");

}  // namespace
}  // namespace experimental
}  // namespace data
}  // namespace tensorflow


text:
exports.Promise = require("meteor-promise");

// Define MeteorPromise.Fiber so that every Promise callback can run in a
// Fiber drawn from a pool of reusable Fibers.
exports.Promise.Fiber = require("fibers");

redpajama_set_name: RedPajamaGithub


text:
//-----------------------------------------------------------------------
// <copyright file="ConfigurationSpec.cs" company="Akka.NET Project">
//     Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
//     Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

using System;
using Akka.Configuration.Hocon;
using System.Linq;
using System.Threading;
using Akka.Actor;
using Akka.Configuration;
using Akka.Dispatch;
using Akka.Event;
using Akka.TestKit;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Tests.Configuration
{
    public class ConfigurationSpec : AkkaSpec
    {
        public ConfigurationSpec() : base(ConfigurationFactory.Default())
        {
        }

        [Fact]
        public void The_default_configuration_file_contain_all_configuration_properties()
        {
            var settings = Sys.Settings;
            var config = Sys.Settings.Config;

            // settings.ConfigVersion.ShouldBe(ActorSystem.Version);
            settings.Loggers.Count.ShouldBe(1);
            settings.Loggers[0].ShouldBe(typeof (DefaultLogger).FullName);
            // settings.LoggingFilter.ShouldBe(typeof(DefaultLoggingFilter));
            settings.LoggersDispatcher.ShouldBe(Dispatchers.DefaultDispatcherId);
            settings.LoggerStartTimeout.Seconds.ShouldBe(5);
            settings.LogLevel.ShouldBe("INFO");
            settings.StdoutLogLevel.ShouldBe("WARNING");
            settings.LogConfigOnStart.ShouldBeFalse();
            settings.LogDeadLetters.ShouldBe(10);
            settings.LogDeadLettersDuringShutdown.ShouldBeTrue();

            settings.ProviderClass.ShouldBe(typeof (LocalActorRefProvider).FullName);
            settings.SupervisorStrategyClass.ShouldBe(typeof (DefaultSupervisorStrategy).FullName);
            settings.CreationTimeout.Seconds.ShouldBe(20);
            settings.AskTimeout.ShouldBe(Timeout.InfiniteTimeSpan);
            settings.SerializeAllMessages.ShouldBeFalse();
            settings.SerializeAllCreators.ShouldBeFalse();
            settings.UnstartedPushTimeout.Seconds.ShouldBe(10);
            settings.DefaultVirtualNodesFactor.ShouldBe(10);

            settings.AddLoggingReceive.ShouldBeFalse();
            settings.DebugAutoReceive.ShouldBeFalse();
            settings.DebugLifecycle.ShouldBeFalse();
            settings.FsmDebugEvent.ShouldBe(false);
            settings.DebugEventStream.ShouldBeFalse();
            settings.DebugUnhandledMessage.ShouldBeFalse();
            settings.DebugRouterMisconfiguration.ShouldBeFalse();

            settings.SchedulerClass.ShouldBe(typeof (HashedWheelTimerScheduler).FullName);
        }

#if CONFIGURATION
        [Fact]
        public void Deserializes_hocon_configuration_from_net_config_file()
        {
            var section = (AkkaConfigurationSection)System.Configuration.ConfigurationManager.GetSection("akka");
            Assert.NotNull(section);
            Assert.False(string.IsNullOrEmpty(section.Hocon.Content));
            var akkaConfig = section.AkkaConfig;
            Assert.NotNull(akkaConfig);
        }
#endif

        [Fact]
        public void Can_create_config_from_source_object()
        {
            var source = new MyObjectConfig
            {
                StringProperty = "aaa",
                BoolProperty = true,
                IntegerArray = new[] {1, 2, 3, 4}
            };

            var config = ConfigurationFactory.FromObject(source);

            Assert.Equal("aaa", config.GetString("StringProperty"));
            Assert.Equal(true, config.GetBoolean("BoolProperty"));

            Assert.Equal(new[] {1, 2, 3, 4}, config.GetIntList("IntegerArray").ToArray());
        }

        [Fact]
        public void Can_merge_objects()
        {
            var hocon1 = @"
a {
    b = 123
    c = 456
    d = 789
    sub {
        aa = 123
    }
}
";

            var hocon2 = @"
a {
    c = 999
    e = 888
    sub {
        bb = 456
    }
}
";

            var root1 = Parser.Parse(hocon1, null);
            var root2 = Parser.Parse(hocon2, null);

            var obj1 = root1.Value.GetObject();
            var obj2 = root2.Value.GetObject();
            obj1.Merge(obj2);

            var config = new Config(root1);

            Assert.Equal(123, config.GetInt("a.b"));
            Assert.Equal(456, config.GetInt("a.c"));
            Assert.Equal(789, config.GetInt("a.d"));
            Assert.Equal(888, config.GetInt("a.e"));
            Assert.Equal(888, config.GetInt("a.e"));
            Assert.Equal(123, config.GetInt("a.sub.aa"));
            Assert.Equal(456, config.GetInt("a.sub.bb"));

        }

        [Fact(DisplayName = @"Scalar value should not be overriden by an object during merge")]
        public void Scalar_value_should_not_be_overriden_by_an_object_during_merge()
        {
            var hocon1 = @"
a {
    b = 1
}
";
            var hocon2 = @"
a {
    b {
        c = 2
    }
}
";

            var root1 = Parser.Parse(hocon1, null);
            var root2 = Parser.Parse(hocon2, null);

            var obj1 = root1.Value.GetObject();
            var obj2 = root2.Value.GetObject();
            obj1.Merge(obj2);

            var config = new Config(root1);

            Assert.Equal(1, config.GetInt("a.b"));
            Assert.Throws<NullReferenceException>(() => config.GetInt("a.b.c"));
        }

        public class MyObjectConfig
        {
            public string StringProperty { get; set; }
            public bool BoolProperty { get; set; }
            public int[] IntegerArray { get; set; }
        }

        [Fact]
        public void Parsing_empty_string_should_produce_empty_hocon_root()
        {
            var value = Parser.Parse(string.Empty, null).Value;
            value.IsEmpty.ShouldBeTrue();
        }

        [Fact]
        public void Config_Empty_is_Empty()
        {
            ConfigurationFactory.Empty.IsEmpty.ShouldBeTrue();
        }
    }
}


text:
$(document).ready(function() {
    $active = {};

    $.ajax({
        // url: './api',
        method: 'GET',
        headers: {
            accept: 'application/hal+json'
        },
        success: function(result) {
            $active._links = result._links;

            $('button[data-url]').click(goToPage);

            updateSMNExamples(result._links['w2:smn-examples'].href);
            updateDomainOverview(result._links['w2:domains'].href);
        },
        error: function(err) {
            console.log("INITIAL: err=", err);
        }
    });

    updateNavBar(["WarpWorks", "#"]);

    $("#domainWizardB").click(function() {
        $("#domainWizardM").modal();
    });

    initializeSMNWizard();
});

function goToPage() {
    window.location.href = $(this).data('url');
}

function initializeSMNWizard() {
    $("#wizardAddEntityB").on("click", function() {
        $("#wizardFormDataT").val($("#wizardFormDataT").val() +
            "\n// Basic Entity Definitions:" +
            "\nCustomer: DoB:date, FirstName, LastName" +
            "\nProduct: productID:string, stock:number, isOnSale:boolean" +
            "\nOrder: quantity:number, payment:[PayPal|CreditCard]");
    });
    $("#wizardAddInheritanceB").on("click", function() {
        $("#wizardFormDataT").val(
            $("#wizardFormDataT").val() +
            "\nEnterprise(Customer): VATID");
    });
    $("#wizardAddAggB").on("click", function() {
        $("#wizardFormDataT").val(
            $("#wizardFormDataT").val() +
            "\n" +
            "\n// Aggregation Hierarchy:" +
            "\nCustomer: {myOrders:Order*}");
    });
    $("#wizardAddAssocB").on("click", function() {
        $("#wizardFormDataT").val(
            $("#wizardFormDataT").val() +
            "\n" +
            "\n// Associations:" +
            "\nOrder: products=>Product");
    });
    $("#wizardAddDomainB").on("click", function() {
        $("#wizardFormDataT").val(
            "// Domain:" +
            "\n#MyShop: {Customer*, Product*}" +
            "\n" +
            $("#wizardFormDataT").val());
    });
}

function updateDomainOverview(url) {
    $.ajax({
        url: url,
        type: 'GET',
        contentType: 'application/json; charset=utf-8',
        success: function(result) {
            if (result.success) {
                $("#domainOverviewLG").empty();
                $("#domainOverviewLG").append(
                    "
Available Domains
");
                result._embedded.domains.forEach(function(domain) {
                    var elem = $(
                        "
" + domain.name + "
" +
                        // TBD: "
" + elem.desc + "
" +
                        "");
                    $("#domainOverviewLG").append(elem);
                });
            } else {
                console.log("GET: Could not get domain overview!");
            }
        },
        error: function() {
            console.log("GET: Error - could not get domain overview!");
        }
    });
}

function updateSMNExamples(url) {
    $.ajax({
        url: url,
        type: 'GET',
        contentType: 'application/json; charset=utf-8',
        success: function(result) {
            if (result.success) {
                $active.smnExamples = {};

                $("#SMNExamplesUL").empty();
                if (result.smnExamples) {
                    result.smnExamples.forEach(function(smnExample) {
                        $active.smnExamples[smnExample.name] = smnExample;
                        var elem = $("
" + smnExample.name + "
");
                        $("#SMNExamplesUL").append(elem);
                        elem.click(function() {
                            var smn = $(this).attr("id");
                            console.log("Using: " + $active.smnExamples[smn].name);
                            $("#wizardFormDataT").val($active.smnExamples[smn].template);
                        });
                    });
                }
            } else {
                console.log("GET: Could not get SMNExamples!");
            }
        },
        error: function() {
            console.log("GET: Could not get SMNExamples - Server Error!");
        }
    });
}


text:
package com.rcl.xpression.model;

import java.io.Serializable;
import java.util.Date;

public class Note implements Serializable {

    private Date creationDate;
    private Mood mood;
    private String description;

    public Note() {
    }

    public Note(Date creationDate, Mood mood, String description) {
        this.creationDate = creationDate;
        this.mood = mood;
        this.description = description;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Mood getMood() {
        return mood;
    }

    public void setMood(Mood mood) {
        this.mood = mood;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">

   <context:annotation-config/>

   <!-- Definition for profile bean -->
   <bean id="profile" class="com.springCore.useOfQualifierAnnotation.Profile">
   </bean>

   <!-- Definition for student1 bean -->
   <bean id="student1" class="com.springCore.useOfQualifierAnnotation.Student">
      <property name="name"  value="Zara" />
      <property name="age"  value="11"/>
   </bean>

   <!-- Definition for student2 bean -->
   <bean id="student2" class="com.springCore.useOfQualifierAnnotation.Student">
      <property name="name"  value="Nuha" />
      <property name="age"  value="2"/>
   </bean>

</beans>


text:
package db;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;

import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;

import tools.XmlEventTool;

import model.DataSet;
import model.DataSetConfig;
import model.DataSetEntry;
import model.GrapherPlot;
import model.LineColor;
import model.LineItem;
import model.LineType;

/**
 * This class reads an XML-File and returns a GrapherPlot object
 * or generates XML from a GrapherPlot object and stores the XML
 * in a file or a string.
 *
 */
public class GrapherPlotDAOxml implements GrapherPlotDAO {

	private GrapherPlot grapherPlot = null;
	private String fileName = null;

	@Override
	public void saveToFile(String file, GrapherPlot grapherPlot) throws FileNotFoundException, XMLStreamException {
		saveToFile(file, grapherPlot, true, true);
	}

	/**
	 * A GrapherPlot object will be turned into XML (optionally with tabs and
	 * line feeds) and saved into a file.
	 *
	 * @param file	The file name, into which the XML will be stored
	 * @param grapherPlot	The GrapherPlot object, from which XML gets generated
	 * @param tabbed If true, then the file will be formatted with tabs and line feeds
	 * @param header	If true, than a header will be printed
	 * @throws XMLStreamException
	 * @throws FileNotFoundException
	 */
	public void saveToFile(String file, GrapherPlot grapherPlot, boolean tabbed, boolean header) throws XMLStreamException, FileNotFoundException {
		this.grapherPlot = grapherPlot;
		// Create OutputFactory, EventViewer and EventFactory
		XMLOutputFactory of = XMLOutputFactory.newInstance();
		FileOutputStream stream = new FileOutputStream(file);
		XMLEventWriter ew = of.createXMLEventWriter(stream);;
		writeToEventWriter(ew, tabbed, header);
		try {
			stream.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	@Override
	public String getString(GrapherPlot grapherPlot) throws XMLStreamException {
		return getString(grapherPlot, true, true);
	}

	/**
	 * A GrapherPlot object will be turned into XML (optionally with tabs and
	 * line feeds) and return as a string.
	 *
	 * @param grapherPlot	The GrapherPlot object, from which XML gets generated
	 * @param tabbed If true, then the file will be formatted with tabs and line feeds
	 * @param header	If true, than a header will be printed
	 * @return grapherPlot as a XML string
	 * @throws XMLStreamException
	 */
	public String getString(GrapherPlot grapherPlot, boolean tabbed, boolean header) throws XMLStreamException {
		this.grapherPlot = grapherPlot;
		XMLOutputFactory of = XMLOutputFactory.newInstance();
		StringWriter sw = new StringWriter();
		XMLEventWriter ew = of.createXMLEventWriter(sw);
		writeToEventWriter(ew, tabbed, header);
		String string = sw.toString();
		try {
			sw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return string;
	}

	/**
	 * Writes the member object grapherPlot to a XMLEventWriter
	 *
	 * @param eventWriter XMLEventWriter
	 * @param tabbed if ture, tabs and line feeds will be used
	 * @param header	if true, a header will be printed
	 * @throws XMLStreamException
	 */
	private void writeToEventWriter(XMLEventWriter eventWriter, boolean tabbed, boolean header) throws XMLStreamException {
		XMLEventFactory ef = XMLEventFactory.newInstance();

		// Create line feed
		XMLEvent lf = ef.createDTD("\n");

		if(header) {
			// Opening tag
			eventWriter.add(ef.createStartDocument());
			// Create comment
			if(tabbed) eventWriter.add(lf);
			String comment = "XML generated by the Sensory Data Grapher";
			eventWriter.add(ef.createComment(comment));
		}
		if (tabbed) eventWriter.add(lf);

		//###################################################################
		// Converting grapherPlot to XML
		boolean newLine = tabbed;
		int level = 0;
		//Write root start element
		XmlEventTool.createStartElement(eventWriter, XmlTags.GRAPHERPLOT.toString(), level, newLine);
			if(tabbed) level++;
			//xmin
			XmlEventTool.createNode(eventWriter, XmlTags.XMIN.toString(), grapherPlot.getXmin().toString(), level, newLine);
			//xmax
			XmlEventTool.createNode(eventWriter, XmlTags.XMAX.toString(), grapherPlot.getXmax().toString(), level, newLine);
			//ymin
			XmlEventTool.createNode(eventWriter, XmlTags.YMIN.toString(), grapherPlot.getYmin().toString(), level, newLine);
			//ymax
			XmlEventTool.createNode(eventWriter, XmlTags.YMAX.toString(), grapherPlot.getYmax().toString(), level, newLine);
			//getxAutoSet
			XmlEventTool.createNode(eventWriter, XmlTags.XAUTO.toString(), grapherPlot.getxAutoSet().toString(), level, newLine);
			//getyAutoSet
			XmlEventTool.createNode(eventWriter, XmlTags.YAUTO.toString(), grapherPlot.getyAutoSet().toString(), level, newLine);
			//dataSet1
			writeDataSet(eventWriter, grapherPlot.getDataSet1(), level, tabbed);
			//dataSet2
			writeDataSet(eventWriter, grapherPlot.getDataSet2(), level, tabbed);
			if(tabbed) level--;
		//Write root end element
		XmlEventTool.createEndElement(eventWriter, XmlTags.GRAPHERPLOT.toString(), level, newLine);
		// finished grapherPlot to XML
		//###################################################################

		//Write end of document
		if(header) eventWriter.add(ef.createEndDocument());
		eventWriter.flush();
		eventWriter.close();
	}

	private void writeDataSet(XMLEventWriter eventWriter, DataSet ds, int level, boolean tabbed) throws XMLStreamException {
		boolean newLine = tabbed;
		if(ds != null) {
			XmlEventTool.createStartElement(eventWriter, XmlTags.DATASET.toString(), level, newLine);
			if(tabbed) level++;
				//config
				DataSetConfig conf = ds.getConfig();
				XmlEventTool.createStartElement(eventWriter, XmlTags.CONFIG.toString(), level, newLine);
				if(tabbed) level++;
					XmlEventTool.createNode(eventWriter, XmlTags.LEGEND.toString(), conf.getLegend(), level, newLine);
					XmlEventTool.createNode(eventWriter, XmlTags.LINECOLOR.toString(), conf.getLineColor().toString(), level, newLine);
					XmlEventTool.createNode(eventWriter, XmlTags.LINEITEM.toString(), conf.getLineItem().toString(), level, newLine);
					XmlEventTool.createNode(eventWriter, XmlTags.LINETYPE.toString(), conf.getLineType().toString(), level, newLine);
				if(tabbed) level--;
				XmlEventTool.createEndElement(eventWriter, XmlTags.CONFIG.toString(), level, newLine);
				//Entries
				XmlEventTool.createStartElement(eventWriter, XmlTags.DATASETENTRIES.toString(), level, newLine);
				if(tabbed) level++;
					List<DataSetEntry> entries = ds.getEntries();
					Iterator<DataSetEntry> it = entries.iterator();
					while(it.hasNext()) {
						DataSetEntry entry = it.next();
						XmlEventTool.createStartElement(eventWriter, XmlTags.DATASETENTRY.toString(), level, false);
						XmlEventTool.createNode(eventWriter, XmlTags.X.toString(), entry.getX().toString(), 0, false);
						XmlEventTool.createNode(eventWriter, XmlTags.Y.toString(), entry.getY().toString(), 0, false);
						XmlEventTool.createEndElement(eventWriter, XmlTags.DATASETENTRY.toString(), 0, newLine);
					}
				if(tabbed) level--;
				XmlEventTool.createEndElement(eventWriter, XmlTags.DATASETENTRIES.toString(), level, newLine);
			if(tabbed) level--;
			XmlEventTool.createEndElement(eventWriter, XmlTags.DATASET.toString(), level, newLine);
			}
	}

	@Override
	public GrapherPlot readInFile(String fileName) throws FileNotFoundException, XMLStreamException {
		this.fileName = fileName;
		// First create a new XMLInputFactory
	    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
	    // Setup a new eventReader
	    InputStream in = new FileInputStream(this.fileName);
	    XMLEventReader eventReader = inputFactory.createXMLEventReader(in);

	    XMLEvent event = eventReader.nextEvent();

    	if(event.isStartDocument()) {
    		event = eventReader.nextEvent();
    	} else {
    		throw new XMLStreamException("No XML header found");
    	}

    	event = eventReader.nextEvent();

    	GrapherPlot gp = null;
    	if(event.isStartElement()) {
    		grapherPlot = null;
    		if (event.asStartElement().getName().getLocalPart() == XmlTags.GRAPHERPLOT.toString()) {
    			//System.out.println(event.asStartElement().getName().getLocalPart());
    			gp = new GrapherPlot();
    			eventReader.nextEvent();
    		} else {
    			throw new XMLStreamException("Did not find root element " + XmlTags.GRAPHERPLOT.toString());
    		}
    	}

    	Double xmin = null;
    	Double ymin = null;
    	Double xmax = null;
    	Double ymax = null;
    	Boolean xAutoSet = null;
    	Boolean yAutoSet = null;
    	DataSet ds = null;
    	LinkedList<DataSet> dsList = new LinkedList<DataSet>();

    	while(eventReader.hasNext()) {
    		event = eventReader.nextEvent();

    		if(event.isStartElement()) {
    			String localPart = event.asStartElement().getName().getLocalPart();
    			if(localPart.equals(XmlTags.XMIN.toString())) {
    				event = eventReader.nextEvent();
    				if(event.isCharacters()) {
	    				try {
	    				xmin = Double.parseDouble(event.asCharacters().getData());
	    				} catch (NumberFormatException e) {
	    					throw new XMLStreamException("Could not parse xMin data.", event.getLocation(), e);
	    				}
    				}
    				continue;
    			}
    			if(localPart.equals(XmlTags.XMAX.toString())) {
    				event = eventReader.nextEvent();
    				if(event.isCharacters()) {
	    				try {
	    				xmax = Double.parseDouble(event.asCharacters().getData());
	    				} catch (NumberFormatException e) {
	    					throw new XMLStreamException("Could not parse xMax data.", event.getLocation(), e);
	    				}
    				}
    				continue;
    			}
    			if(localPart.equals(XmlTags.YMIN.toString())) {
    				event = eventReader.nextEvent();
    				if(event.isCharacters()) {
	    				try {
	    				ymin = Double.parseDouble(event.asCharacters().getData());
	    				} catch (NumberFormatException e) {
	    					throw new XMLStreamException("Could not parse yMin data.", event.getLocation(), e);
	    				}
    				}
    				continue;
    			}
    			if(localPart.equals(XmlTags.YMAX.toString())) {
    				event = eventReader.nextEvent();
    				if(event.isCharacters()) {
	    				try {
	    				ymax = Double.parseDouble(event.asCharacters().getData());
	    				} catch (NumberFormatException e) {
	    					throw new XMLStreamException("Could not parse yMax data.", event.getLocation(), e);
	    				}
    				}
    				continue;
    			}
    			if(localPart.equals(XmlTags.XAUTO.toString())) {
    				event = eventReader.nextEvent();
    				if(event.isCharacters()) {
    					xAutoSet = Boolean.parseBoolean(event.asCharacters().getData());
    				}
    				continue;
    			}
    			if(localPart.equals(XmlTags.YAUTO.toString())) {
    				event = eventReader.nextEvent();
    				if(event.isCharacters()) {
    					yAutoSet = Boolean.parseBoolean(event.asCharacters().getData());
    				}
    				continue;
    			}
    			// Parsing dataset
    			//****************
    			if(localPart.equals(XmlTags.DATASET.toString())) {
    				ds = new DataSet();
    				while(eventReader.hasNext()) {
    					event = eventReader.nextEvent();
    					if(event.isStartElement()) {
    						localPart = event.asStartElement().getName().getLocalPart();
    		    			// Parsing config
    		    			//****************
    		    			if(localPart.equals(XmlTags.CONFIG.toString())) {
    		    				DataSetConfig conf = new DataSetConfig();
    		    				while(eventReader.hasNext()) {
    		    					event = eventReader.nextEvent();
    		    					if(event.isStartElement()) {
    		    						localPart = event.asStartElement().getName().getLocalPart();
    		    						if(localPart.equals(XmlTags.LEGEND.toString())) {
    		    							event = eventReader.nextEvent();
    		    							if(event.isCharacters()) {
    		    								String legend = event.asCharacters().getData();
    	    		    						conf.setLegend(legend);
    	    		    					}
    		    							continue;
    		    						}
    		    						if(localPart.equals(XmlTags.LINECOLOR.toString())) {
    		    							event = eventReader.nextEvent();
    		    							if(event.isCharacters()) {
    		    								try {
    		    									LineColor lineColor = LineColor.parse(event.asCharacters().getData());
    		    									conf.setLineColor(lineColor);
    		    								} catch (ParseException e) {
    		    									throw new XMLStreamException("Could not parse line color.", event.getLocation(), e);
    		    								}
    	    		    					}
    		    							continue;
    		    						}
    		    						if(localPart.equals(XmlTags.LINEITEM.toString())) {
    		    							event = eventReader.nextEvent();
    		    							if(event.isCharacters()) {
    		    								try {
    		    									LineItem lineItem = LineItem.parse(event.asCharacters().getData());
    		    									conf.setLineItem(lineItem);
    		    								} catch (ParseException e) {
    		    									throw new XMLStreamException("Could not parse line item.", event.getLocation(), e);
    		    								}
    	    		    					}
    		    							continue;
    		    						}
    		    						if(localPart.equals(XmlTags.LINETYPE.toString())) {
    		    							event = eventReader.nextEvent();
    		    							if(event.isCharacters()) {
    		    								try {
    		    									LineType lineType = LineType.parse(event.asCharacters().getData());
    		    									conf.setLineType(lineType);
    		    								} catch (ParseException e) {
    		    									throw new XMLStreamException("Could not parse line type.", event.getLocation(), e);
    		    								}
    	    		    					}
    		    							continue;
    		    						}
    		    					}
    		    					if(event.isEndElement()) {
    		    						if(event.asEndElement().getName().getLocalPart().equals(XmlTags.CONFIG.toString())) {
    		    							ds.setConfig(conf);
    		    							break;
    		    						}
    		    					}
    		    				}
    		    				continue;
    		    			}
    		    			// finished parsing config
    		    			//****************

    		    			// Parsing data entries
    		    			//****************
    		    			if(localPart.equals(XmlTags.DATASETENTRIES.toString())) {
    		    				List<DataSetEntry> entries = Collections.synchronizedList(new ArrayList<DataSetEntry>());
    		    				while(eventReader.hasNext()) {
    		    					event = eventReader.nextEvent();
    		    					if(event.isStartElement()) {
    		    						localPart = event.asStartElement().getName().getLocalPart();
    		    						if(localPart.equals(XmlTags.DATASETENTRY.toString())) {
    		    		    				Double x = null;
    		    		    				Double y = null;
    		    		    				while(eventReader.hasNext()) {
    		    		    					event = eventReader.nextEvent();
    		    		    					if(event.isStartElement()) {
    		    		    						localPart = event.asStartElement().getName().getLocalPart();
    		    		    						if(localPart.equals(XmlTags.X.toString())) {
    		    		    							event = eventReader.nextEvent();
    		    		    							if(event.isCharacters()) {
    		    		    								try {
    		    		    				    				x = Double.parseDouble(event.asCharacters().getData());
    		    		    				    			} catch (NumberFormatException e) {
    		    		    				    				throw new XMLStreamException("Could not parse x data.", event.getLocation(), e);
    		    		    				    			}
    		    		    							}
    		    		    							continue;
    		    		    						}
    		    		    						if(localPart.equals(XmlTags.Y.toString())) {
    		    		    							event = eventReader.nextEvent();
    		    		    							if(event.isCharacters()) {
    		    		    								try {
    		    		    				    				y = Double.parseDouble(event.asCharacters().getData());
    		    		    				    			} catch (NumberFormatException e) {
    		    		    				    				throw new XMLStreamException("Could not parse y data.", event.getLocation(), e);
    		    		    				    			}
    		    		    							}
    		    		    							continue;
    		    		    						}
    		    		    					}
    		    		    					if(event.isEndElement()) {
    		    		    						if(event.asEndElement().getName().getLocalPart().equals(XmlTags.DATASETENTRY.toString())) {
    		    		    							DataSetEntry entry = new DataSetEntry(x, y);
    		    		    							entries.add(entry);
    		    		    							break;
    		    		    						}
    		    		    					}
    		    		    				}
    		    						}
    		    					}
    		    					if(event.isEndElement()) {
    		    						if(event.asEndElement().getName().getLocalPart().equals(XmlTags.DATASETENTRIES.toString())) {
    		    							ds.setEntries(entries);
    		    							break;
    		    						}
    		    					}
    		    				}
    		    				continue;
    		    			}
    		    			// finished parsing data entries
    		    			//**************
    					}

    					if (event.isEndElement()) {
    						localPart = event.asEndElement().getName().getLocalPart();
    						if(localPart.equals(XmlTags.DATASET.toString())) {
    	        				dsList.add(ds);
    	        				break;
    	        			}
    					}

    				continue;
    				}
    			}
    			// finished parsing dataset
    			//****************
    		}

    		//detect end tags, add staged content
    		if(event.isEndElement()) {
    			String localPart = event.asEndElement().getName().getLocalPart();
    			if(localPart.equals(XmlTags.XMIN.toString())) {
    				gp.setXmin(xmin);
    				continue;
    			}
    			if(localPart.equals(XmlTags.XMAX.toString())) {
    				gp.setXmax(xmax);
    				continue;
    			}
    			if(localPart.equals(XmlTags.YMIN.toString())) {
    				gp.setYmin(ymin);
    				continue;
    			}
    			if(localPart.equals(XmlTags.YMAX.toString())) {
    				gp.setYmax(ymax);
    				continue;
    			}
    			if(localPart.equals(XmlTags.XAUTO.toString())) {
    				gp.setxAutoSet(xAutoSet);
    				continue;
    			}
    			if(localPart.equals(XmlTags.YAUTO.toString())) {
    				gp.setyAutoSet(yAutoSet);
    				continue;
    			}
    			if(localPart.equals(XmlTags.GRAPHERPLOT.toString())) {
    				try {
    					gp.setDataSet1(dsList.remove());
    				} catch (NoSuchElementException e) {
    					//ignore
    				}
    				try {
    					gp.setDataSet2(dsList.remove());
    				} catch (NoSuchElementException e) {
    					//ignore
    				}

    				grapherPlot = gp;
    				break;
    			}

    		}

    	}

		return grapherPlot;

	}
}


text:
package com.hyrax.client.email.api.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
@ConfigurationProperties(prefix = "email.event.rest.client")
public class EmailEventRESTClientProperties {

    private String headerName;
    private String token;

    private String serviceUrl;
}


text:
package addressbook;

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

public class VirtualAddressBook {
	// Final static members
	// TODO: decide if having a character that is hard to type on Windows should be in our file extension.
	// Atlee says, "probably not wise".
	public static final String DEFAULT_DATA_FILENAME = "address_book_default_data"; // will be *.pond�
	public static final String FILE_EXTENSION = "pond�";

	// --- Private Data Members ---
	List<Field> fields;
	List<Contact> contacts;
	int indexToSortBy;

	// --- Constructor ---
	public VirtualAddressBook() {
		this(getDefaultBook());
	}

	VirtualAddressBook(File addressBookFile) {
		this(new VirtualBookReader(addressBookFile).read());
	}

	public VirtualAddressBook(List<Field> fields, List<Contact> contactsSet) {
		this.fields = fields;
		this.contacts = contactsSet;
		this.indexToSortBy = 0;
	}

	// private copy constructor
	public VirtualAddressBook(VirtualAddressBook vab) {
		this(vab.fields, vab.contacts);
	}

	// --- Public Class Methods ---
	public static VirtualAddressBook createDefaultBook() {
		return new VirtualAddressBook( Field.createDefaultFieldList(), new ArrayList<Contact>());
	}

	// --- File I/O ---
	public static VirtualAddressBook createFromFile(File file) {
		return VirtualBookIO.openBook(file);
	}
	public static VirtualAddressBook importFromFile(File file) {
		return VirtualBookIO.importBook(file);
	}

	public boolean exportToFile(File file) {
		return VirtualBookIO.exportBook(this, file);
	}

	public boolean writeToFile(File file) {
		return VirtualBookIO.saveBook(this, file);
	}

	public void switchFields(int index1, int index2) {
		Collections.swap(fields, index1, index2);
		for (Contact contact : contacts) {
			Collections.swap(contact.getContactDataArray(), index1, index2);
		}
	}
	/**
	 * Compares ONLY the selected field, without trying to break ties.
	 * Empty fields are put LAST.
	 * TODO: decide if we WANT empty fields to be LAST.
	 * @param contact1
	 * @param contact2
	 * @param fieldIndex such as Field.FIRSTNAME
	 */
	private int compareSimple(Contact contact1, Contact contact2, int fieldIndex) {
		String value1 = contact1.getContactDataAt(fieldIndex);
		String value2 = contact2.getContactDataAt(fieldIndex);
		boolean v1empty = value1 == null || value1.isEmpty();
		boolean v2empty = value2 == null || value2.isEmpty();
		if( v1empty ) {
			if( v2empty ) return 0;
			return 1;
		}
		if( v2empty ) return -1;
		return value1.compareToIgnoreCase(value2);
	}
	public void sortByFieldAtIndex(int index) {
		// Custom comparators to sort by specified index
		this.indexToSortBy = index;
		Comparator<Contact> comparator = null;
		switch( index ) {
		case Field.LASTNAME:
			final Comparator<Contact> lastNameComparator = new Comparator<Contact>() {
				public int compare(Contact contact1, Contact contact2) {
					int comp = compareSimple(contact1, contact2, Field.LASTNAME);
					if( comp == 0 ) comp = compareSimple(contact1, contact2, Field.FIRSTNAME);
					return comp;
				}
			};
			comparator = lastNameComparator;
			break;
		case Field.ZIP:
			final Comparator<Contact> zipComparator = new Comparator<Contact>() {
				public int compare(Contact contact1, Contact contact2) {
					int comp = compareSimple(contact1, contact2, Field.ZIP);
					if( comp == 0 ) { // break ties by last name
						comp = compareSimple(contact1, contact2, Field.LASTNAME);
						if( comp == 0 ) { // break ties by first name
							comp = compareSimple(contact1,contact2, Field.FIRSTNAME);
						}
					}
					return comp;
				}
			};
			comparator = zipComparator;
			break;
		default:
			final Comparator<Contact> defaultComparator = new Comparator<Contact>() {
				public int compare(Contact contact1, Contact contact2) {
					return compareSimple(contact1, contact2, index);
				}
			};
			comparator = defaultComparator;
		}
		Collections.sort(contacts, comparator);
	}

	// SETTERS:
	public void newField(Field newField) {
		fields.add(newField);
		for (Contact contact : contacts) {
			contact.newCell();
		}
	}
	public void newFieldAtIndex(Field newField, int index) {
		fields.add(index, newField);
		for (Contact contact : contacts) {
			contact.newCellAtIndex(index);
		}
	}
	public void setFieldAtIndex(String newData, int index) {
		fields.get(index).name = newData;
	}
	public void newContact(Contact contact) {
		contacts.add(contact);

		// Do not sort when adding a new contact
		// sortByFieldAtIndex(indexToSortBy);
	}
	public void setContactAtIndexes(String newData, int contactIndex, int fieldIndex) {
		contacts.get(contactIndex).editDataAtIndex(newData, fieldIndex);;
	}
	// GETTERS:
	public Field getFieldAtIndex(int index) {
		return fields.get(index);
	}
	public List<Field> getFields() {
		return fields;
	}
	public List<Contact> getContacts() {
		return contacts;
	}

	// --- Private Class Methods ---
	private static VirtualAddressBook getDefaultBook() {
		return new VirtualBookReader(DEFAULT_DATA_FILENAME, true).read();
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>XLabs: XLabs.Forms.Exceptions.InvalidBindableException Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

XLabs

Cross-platform reusable C# libraries

Main Page

Packages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Public Member Functions |
Properties |
List of all members

XLabs.Forms.Exceptions.InvalidBindableException Class Reference

Thrown when an invalid bindable object has been passed to a callback
 More...

Inheritance diagram for XLabs.Forms.Exceptions.InvalidBindableException:

  <map id="XLabs.Forms.Exceptions.InvalidBindableException_map" name="XLabs.Forms.Exceptions.InvalidBindableException_map">
</map>

Public Member Functions

 	InvalidBindableException (BindableObject bindable, Type expected,[CallerMemberName]string name=null)

 	Constructs the exception and passes a meaningful message to the base Exception  More...

Properties

BindableObject 	IncorrectBindableObject [get, set]

 	The bindable object that was passed  More...

Type 	ExpectedType [get, set]

 	The expected type of the bindable object  More...

Detailed Description

Thrown when an invalid bindable object has been passed to a callback

Constructor & Destructor Documentation

          XLabs.Forms.Exceptions.InvalidBindableException.InvalidBindableException
          (
          BindableObject
          bindable,

          Type
          expected,

          [CallerMemberName] string
          name = null

          )

Constructs the exception and passes a meaningful message to the base Exception

Parameters

bindable	The bindable object that was passed

expected	The expected type

name	The calling methods name, uses [CallerMemberName]

Property Documentation

          Type XLabs.Forms.Exceptions.InvalidBindableException.ExpectedType

getset

The expected type of the bindable object

          BindableObject XLabs.Forms.Exceptions.InvalidBindableException.IncorrectBindableObject

getset

The bindable object that was passed

The documentation for this class was generated from the following file:

F:/Projects/Xamarin-Forms-Labs/src/Forms/XLabs.Forms/Exceptions/InvalidBindableException.cs

XLabs

Forms

Exceptions

InvalidBindableException

Generated by

     1.8.10


text:
class Dictionary {
 public:
  Dictionary();

  std::string Generate() const;
 private:
  Wordlist adjectives_;
  Wordlist nouns_;
};

#endif  //  SPACETYPER_DICTIONARY_H


text:
import java.util.Scanner;
/**
 * Contiene un metodo main.
 * Interactua con los datos recibidos por el usario.
 * @author Chompy129
 * @version 1.0
 */
public class DatosPalabras{
    public static void main(String[] args){
        String datosTeclado= "";
        Scanner entradaDeScanner= new Scanner(System.in);
        String fraseFinal= ""; //Frase que ira construyendose.

        System.out.print("Introdusca una frase: ");
        datosTeclado= entradaDeScanner.nextLine();

        //Introduce en la frase si tiene mas de 15 caracteres, entre 15 y 5 caracteres o menos de 5 caracteres.
        if(datosTeclado.length() > 15){
            fraseFinal= "La cadena introducida tiene mas de 15 caracteres";
        }
        else if (datosTeclado.length() <= 15 && datosTeclado.length() >= 5){
            fraseFinal= "La cadena introducida tiene entre 5 y 15 caracteres";
        }
        else{
            fraseFinal= "La cadena introducida tiene menos de 5 caracteres";
        }

        //Añade en la frase si inicia por la letra A (Sea mayuscula o minuscula).
        if(datosTeclado.substring(0, 1).equalsIgnoreCase("a")){
            fraseFinal += " y empieza por la letra A.";
        }
        else{
            fraseFinal += " y no empieza por la letra A.";
        }

        System.out.println(fraseFinal);
    }//Cierre de metodo
}//Cierre de clase


text:
#ifndef MPEG3VIDEOPROTOS_H
#define MPEG3VIDEOPROTOS_H

void mpeg3video_idct_conversion(short* block);
unsigned int mpeg3slice_showbits(mpeg3_slice_buffer_t *slice_buffer, int bits);

int mpeg3video_get_cbp(mpeg3_slice_t *slice);
int mpeg3video_clearblock(mpeg3_slice_t *slice, int comp, int size);
void mpeg3video_getintrablock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp, int dc_dct_pred[]);
int mpeg3video_getinterblock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp);
void mpeg3video_getmpg2intrablock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp, int dc_dct_pred[]);
void mpeg3video_getmpg2interblock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp);
int mpeg3video_getpicture(mpeg3video_t *video, int framenum);
int mpeg3video_getgophdr(mpeg3video_t *video);
int mpeg3video_getpicturehdr(mpeg3video_t *video);
int mpeg3video_get_header(mpeg3video_t *video, int dont_repeat);
int mpeg3video_getslicehdr(mpeg3_slice_t *slice, mpeg3video_t *video);
int mpeg3video_get_macroblock_address(mpeg3_slice_t *slice);
int mpeg3video_macroblock_modes(mpeg3_slice_t *slice, mpeg3video_t *video, int *pmb_type, int *pstwtype, int *pstwclass, int *pmotion_type, int *pmv_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
int mpeg3_mmx_test(void);
void mpeg3video_calc_dmv(mpeg3video_t *video, int DMV[][2], int *dmvector, int mvx, int mvy);
void mpeg3video_motion_vector(mpeg3_slice_t *slice, mpeg3video_t *video, int *PMV, int *dmvector, int h_r_size, int v_r_size, int dmv, int mvscale, int full_pel_vector);
int mpeg3video_motion_vectors(mpeg3_slice_t *slice, mpeg3video_t *video, int PMV[2][2][2], int dmvector[2], int mv_field_sel[2][2], int s, int mv_count, int mv_format, int h_r_size, int v_r_size, int dmv, int mvscale);
int mpeg3video_read_frame_backend(mpeg3video_t *video, int skip_bframes);
int mpeg3video_set_cpus(mpeg3video_t *video, int cpus);
int mpeg3video_set_mmx(mpeg3video_t *video, int use_mmx);
int mpeg3video_seek_percentage(mpeg3video_t *video, double percentage);
int mpeg3video_previous_frame(mpeg3video_t *video);
int mpeg3video_seek_frame(mpeg3video_t *video, long frame);
int mpeg3video_read_raw(mpeg3video_t *video, unsigned char *output, long *size, long max_size);
int mpeg3video_read_yuvframe(mpeg3video_t *video, long frame_number, char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h);
int mpeg3video_init_output(void);
int mpeg3video_ditherframeFastRGBA(mpeg3video_t *video, unsigned char **src, unsigned char **output_rows);
int mpeg3video_ditherframeFastRGB555(mpeg3video_t *video, unsigned char **src, unsigned char **output_rows);
int mpeg3video_present_frame(mpeg3video_t *video);
int mpeg3video_display_second_field(mpeg3video_t *video);
int mpeg3video_reconstruct(mpeg3video_t *video, int bx, int by, int mb_type, int motion_type, int PMV[2][2][2], int mv_field_sel[2][2], int dmvector[2], int stwtype);
int mpeg3video_match_refframes(mpeg3video_t *video);
int mpeg3video_seek(mpeg3video_t *video);
int mpeg3video_drop_frames(mpeg3video_t *video, long frames);
int mpeg3_new_slice_buffer(mpeg3_slice_buffer_t *slice_buffer);
int mpeg3_delete_slice_buffer(mpeg3_slice_buffer_t *slice_buffer);
int mpeg3_expand_slice_buffer(mpeg3_slice_buffer_t *slice_buffer);
int mpeg3_new_slice_decoder(void *video, mpeg3_slice_t *slice);
int mpeg3_delete_slice_decoder(mpeg3_slice_t *slice);
/* mpeg3video.c */
int mpeg3video_set_cpus(mpeg3video_t *video, int cpus);
int mpeg3video_set_mmx(mpeg3video_t *video, int use_mmx);
int mpeg3video_seek_percentage(mpeg3video_t *video, double percentage);
int mpeg3video_previous_frame(mpeg3video_t *video);
int mpeg3video_seek_frame(mpeg3video_t *video, long frame);
int mpeg3video_read_raw(mpeg3video_t *video, unsigned char *output, long *size, long max_size);
int mpeg3video_read_yuvframe(mpeg3video_t *video, long frame_number, char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h);
/* seek.c */
unsigned int mpeg3bits_next_startcode(mpeg3_bits_t *stream);
int mpeg3video_next_code(mpeg3_bits_t *stream, unsigned int code);
int mpeg3video_prev_code(mpeg3_bits_t *stream, unsigned int code);
int mpeg3video_drop_frames(mpeg3video_t *video, long frames);
#endif


text:
#ifndef MASTERNODELIST_H
#define MASTERNODELIST_H

#include "masternode.h"
#include "platformstyle.h"
#include "sync.h"
#include "util.h"

#include <QMenu>
#include <QTimer>
#include <QWidget>

#define MY_MASTERNODELIST_UPDATE_SECONDS 60
#define MASTERNODELIST_UPDATE_SECONDS 15
#define MASTERNODELIST_FILTER_COOLDOWN_SECONDS 3

class PlatformStyle;

namespace Ui
{
class MasternodeList;
}

class ClientModel;
class WalletModel;

QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE

/** Masternode Manager page widget */
class MasternodeList : public QWidget
{
    Q_OBJECT

public:
    explicit MasternodeList(const PlatformStyle *platformStyle,QWidget* parent = 0);
    ~MasternodeList();

    void setClientModel(ClientModel* clientModel);
    void setWalletModel(WalletModel* walletModel);
    void StartAlias(std::string strAlias);
    void StartAll(std::string strCommand = "start-all");

private:
    QMenu* contextMenu;
    int64_t nTimeFilterUpdated;
    bool fFilterUpdated;

public Q_SLOTS:
    void updateMyMasternodeInfo(QString strAlias, QString strAddr, CMasternode* pmn);
    void updateMyNodeList(bool fForce = false);
    void updateNodeList();

Q_SIGNALS:

private:
    QTimer* timer;
    Ui::MasternodeList* ui;
    ClientModel* clientModel;
    WalletModel* walletModel;
    CCriticalSection cs_mnlistupdate;
    QString strCurrentFilter;
    const PlatformStyle *platformStyle;

private Q_SLOTS:
    void showContextMenu(const QPoint&);
    void on_filterLineEdit_textChanged(const QString& strFilterIn);
    void on_startButton_clicked();
    void on_startAllButton_clicked();
    void on_startMissingButton_clicked();
    void on_tableWidgetMyMasternodes_itemSelectionChanged();
    void on_UpdateButton_clicked();
};
#endif // MASTERNODELIST_H


text:
from django.test import TestCase

from fwdform.helpers import get_next_url

class TestModelForms(TestCase):

    def setUp(self):
        self.referrer = 'http://example.com/contact-form/'
        self.absolute_url = 'http://example.com/thank-you/'
        self.relative_url = '/thank-you/'

    def test_get_next_url_with_absolute_url(self):
        next_url = get_next_url(referrer=self.referrer, next_url=self.absolute_url)
        self.assertEquals(next_url, self.absolute_url)

    def test_get_next_url_with_relative_url(self):
        next_url = get_next_url(referrer=self.referrer, next_url=self.relative_url)
        self.assertEquals(next_url, self.absolute_url)

    def test_get_next_url_with_relative_url_and_no_referrer(self):
        self.assertIsNone(get_next_url(referrer='', next_url=self.relative_url))

    def test_get_next_url_with_empty_url(self):
        self.assertIsNone(get_next_url(referrer=self.referrer, next_url=None))


text:
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using NUnit.Framework;
using osu.Game.Overlays;

namespace osu.Game.Tests.Visual
{
    [TestFixture]
    public class TestCaseKeyConfiguration : OsuTestCase
    {
        private readonly KeyBindingOverlay overlay;

        public TestCaseKeyConfiguration()
        {
            Child = overlay = new KeyBindingOverlay();
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            overlay.Show();
        }
    }
}


text:
// Package fakediscovery provides a fake, in-memory discovery implementation.
package fakediscovery

import (
	"context"
	"math/rand"

	"github.com/stretchr/testify/assert"

	"vitess.io/vitess/go/vt/vtadmin/cluster/discovery"

	vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin"
)

type vtctlds struct {
	byTag     map[string][]*vtadminpb.Vtctld
	byName    map[string]*vtadminpb.Vtctld
	shouldErr bool
}

type gates struct {
	byTag     map[string][]*vtadminpb.VTGate
	byName    map[string]*vtadminpb.VTGate
	shouldErr bool
}

// Fake is a fake discovery implementation for use in testing.
type Fake struct {
	gates   *gates
	vtctlds *vtctlds
}

// New returns a new fake.
func New() *Fake {
	return &Fake{
		gates: &gates{
			byTag:  map[string][]*vtadminpb.VTGate{},
			byName: map[string]*vtadminpb.VTGate{},
		},
		vtctlds: &vtctlds{
			byTag:  map[string][]*vtadminpb.Vtctld{},
			byName: map[string]*vtadminpb.Vtctld{},
		},
	}
}

// AddTaggedGates adds the given gates to the discovery fake, associating each
// gate with each tag. To tag different gates with multiple tags, call multiple
// times with the same gates but different tag slices. Gates are uniquely
// identified by hostname.
func (d *Fake) AddTaggedGates(tags []string, gates ...*vtadminpb.VTGate) {
	for _, tag := range tags {
		d.gates.byTag[tag] = append(d.gates.byTag[tag], gates...)
	}

	for _, g := range gates {
		d.gates.byName[g.Hostname] = g
	}
}

// AddTaggedVtctlds adds the given vtctlds to the discovery fake, associating
// each vtctld with each tag. To tag different vtctlds with multiple tags, call
// multiple times with the same vtctlds but different tag slices. Vtctlds are
// uniquely identified by hostname.
func (d *Fake) AddTaggedVtctlds(tags []string, vtctlds ...*vtadminpb.Vtctld) {
	for _, tag := range tags {
		d.vtctlds.byTag[tag] = append(d.vtctlds.byTag[tag], vtctlds...)
	}

	for _, vtctld := range vtctlds {
		d.vtctlds.byName[vtctld.Hostname] = vtctld
	}
}

// SetGatesError instructs whether the fake should return an error on gate
// discovery functions.
func (d *Fake) SetGatesError(shouldErr bool) {
	d.gates.shouldErr = shouldErr
}

var _ discovery.Discovery = (*Fake)(nil)

// DiscoverVTGates is part of the discovery.Discovery interface.
func (d *Fake) DiscoverVTGates(ctx context.Context, tags []string) ([]*vtadminpb.VTGate, error) {
	if d.gates.shouldErr {
		return nil, assert.AnError
	}

	if len(tags) == 0 {
		results := make([]*vtadminpb.VTGate, 0, len(d.gates.byName))
		for _, gate := range d.gates.byName {
			results = append(results, gate)
		}

		return results, nil
	}

	set := d.gates.byName

	for _, tag := range tags {
		intermediate := map[string]*vtadminpb.VTGate{}

		gates, ok := d.gates.byTag[tag]
		if !ok {
			return []*vtadminpb.VTGate{}, nil
		}

		for _, g := range gates {
			if _, ok := set[g.Hostname]; ok {
				intermediate[g.Hostname] = g
			}
		}

		set = intermediate
	}

	results := make([]*vtadminpb.VTGate, 0, len(set))

	for _, gate := range set {
		results = append(results, gate)
	}

	return results, nil
}

// DiscoverVTGate is part of the discovery.Discovery interface.
func (d *Fake) DiscoverVTGate(ctx context.Context, tags []string) (*vtadminpb.VTGate, error) {
	gates, err := d.DiscoverVTGates(ctx, tags)
	if err != nil {
		return nil, err
	}

	if len(gates) == 0 {
		return nil, assert.AnError
	}

	return gates[rand.Intn(len(gates))], nil
}

// DiscoverVTGateAddr is part of the discovery.Discovery interface.
func (d *Fake) DiscoverVTGateAddr(ctx context.Context, tags []string) (string, error) {
	gate, err := d.DiscoverVTGate(ctx, tags)
	if err != nil {
		return "", err
	}

	return gate.Hostname, nil
}

// DiscoverVtctlds is part of the discover.Discovery interface.
func (d *Fake) DiscoverVtctlds(ctx context.Context, tags []string) ([]*vtadminpb.Vtctld, error) {
	if d.vtctlds.shouldErr {
		return nil, assert.AnError
	}

	if len(tags) == 0 {
		results := make([]*vtadminpb.Vtctld, 0, len(d.vtctlds.byName))
		for _, vtctld := range d.vtctlds.byName {
			results = append(results, vtctld)
		}

		return results, nil
	}

	set := d.vtctlds.byName

	for _, tag := range tags {
		intermediate := map[string]*vtadminpb.Vtctld{}

		vtctlds, ok := d.vtctlds.byTag[tag]
		if !ok {
			return []*vtadminpb.Vtctld{}, nil
		}

		for _, v := range vtctlds {
			if _, ok := set[v.Hostname]; ok {
				intermediate[v.Hostname] = v
			}
		}

		set = intermediate
	}

	results := make([]*vtadminpb.Vtctld, 0, len(set))

	for _, vtctld := range set {
		results = append(results, vtctld)
	}

	return results, nil
}

// DiscoverVtctldAddr is part of the discover.Discovery interface.
func (d *Fake) DiscoverVtctldAddr(ctx context.Context, tags []string) (string, error) {
	vtctld, err := d.DiscoverVtctld(ctx, tags)
	if err != nil {
		return "", err
	}

	return vtctld.Hostname, nil
}

// DiscoverVtctld is part of the discover.Discovery interface.
func (d *Fake) DiscoverVtctld(ctx context.Context, tags []string) (*vtadminpb.Vtctld, error) {
	vtctlds, err := d.DiscoverVtctlds(ctx, tags)
	if err != nil {
		return nil, err
	}

	if len(vtctlds) == 0 {
		return nil, assert.AnError
	}

	return vtctlds[rand.Intn(len(vtctlds))], nil
}


text:
package org.wso2.carbon.apimgt.rest.api.publisher.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;

/**
 * DocumentDTO
 */
public class DocumentDTO   {
  @JsonProperty("documentId")
  private String documentId = null;

  @JsonProperty("name")
  private String name = null;

  /**
   * Gets or Sets type
   */
  public enum TypeEnum {
    HOWTO("HOWTO"),

    SAMPLES("SAMPLES"),

    PUBLIC_FORUM("PUBLIC_FORUM"),

    SUPPORT_FORUM("SUPPORT_FORUM"),

    API_MESSAGE_FORMAT("API_MESSAGE_FORMAT"),

    SWAGGER_DOC("SWAGGER_DOC"),

    OTHER("OTHER");

    private String value;

    TypeEnum(String value) {
      this.value = value;
    }

    @Override
    @JsonValue
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static TypeEnum fromValue(String text) {
      for (TypeEnum b : TypeEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }
  }

  @JsonProperty("type")
  private TypeEnum type = null;

  @JsonProperty("summary")
  private String summary = null;

  /**
   * Gets or Sets sourceType
   */
  public enum SourceTypeEnum {
    INLINE("INLINE"),

    URL("URL"),

    FILE("FILE");

    private String value;

    SourceTypeEnum(String value) {
      this.value = value;
    }

    @Override
    @JsonValue
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static SourceTypeEnum fromValue(String text) {
      for (SourceTypeEnum b : SourceTypeEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }
  }

  @JsonProperty("sourceType")
  private SourceTypeEnum sourceType = null;

  @JsonProperty("sourceUrl")
  private String sourceUrl = null;

  @JsonProperty("fileName")
  private String fileName = null;

  @JsonProperty("inlineContent")
  private String inlineContent = null;

  @JsonProperty("otherTypeName")
  private String otherTypeName = null;

  @JsonProperty("permission")
  private String permission = null;

  /**
   * Gets or Sets visibility
   */
  public enum VisibilityEnum {
    OWNER_ONLY("OWNER_ONLY"),

    PRIVATE("PRIVATE"),

    API_LEVEL("API_LEVEL");

    private String value;

    VisibilityEnum(String value) {
      this.value = value;
    }

    @Override
    @JsonValue
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static VisibilityEnum fromValue(String text) {
      for (VisibilityEnum b : VisibilityEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }
  }

  @JsonProperty("visibility")
  private VisibilityEnum visibility = null;

  @JsonProperty("createdTime")
  private String createdTime = null;

  @JsonProperty("createdBy")
  private String createdBy = null;

  @JsonProperty("lastUpdatedTime")
  private String lastUpdatedTime = null;

  @JsonProperty("lastUpdatedBy")
  private String lastUpdatedBy = null;

  public DocumentDTO documentId(String documentId) {
    this.documentId = documentId;
    return this;
  }

   /**
   * Get documentId
   * @return documentId
  **/
  @ApiModelProperty(example = "01234567-0123-0123-0123-012345678901", value = "")
  public String getDocumentId() {
    return documentId;
  }

  public void setDocumentId(String documentId) {
    this.documentId = documentId;
  }

  public DocumentDTO name(String name) {
    this.name = name;
    return this;
  }

   /**
   * Get name
   * @return name
  **/
  @ApiModelProperty(example = "CalculatorDoc", required = true, value = "")
  public String getName() {
    return name;
  }

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

  public DocumentDTO type(TypeEnum type) {
    this.type = type;
    return this;
  }

   /**
   * Get type
   * @return type
  **/
  @ApiModelProperty(example = "HOWTO", required = true, value = "")
  public TypeEnum getType() {
    return type;
  }

  public void setType(TypeEnum type) {
    this.type = type;
  }

  public DocumentDTO summary(String summary) {
    this.summary = summary;
    return this;
  }

   /**
   * Get summary
   * @return summary
  **/
  @ApiModelProperty(example = "Summary of Calculator Documentation", value = "")
  public String getSummary() {
    return summary;
  }

  public void setSummary(String summary) {
    this.summary = summary;
  }

  public DocumentDTO sourceType(SourceTypeEnum sourceType) {
    this.sourceType = sourceType;
    return this;
  }

   /**
   * Get sourceType
   * @return sourceType
  **/
  @ApiModelProperty(example = "INLINE", required = true, value = "")
  public SourceTypeEnum getSourceType() {
    return sourceType;
  }

  public void setSourceType(SourceTypeEnum sourceType) {
    this.sourceType = sourceType;
  }

  public DocumentDTO sourceUrl(String sourceUrl) {
    this.sourceUrl = sourceUrl;
    return this;
  }

   /**
   * Get sourceUrl
   * @return sourceUrl
  **/
  @ApiModelProperty(example = "", value = "")
  public String getSourceUrl() {
    return sourceUrl;
  }

  public void setSourceUrl(String sourceUrl) {
    this.sourceUrl = sourceUrl;
  }

  public DocumentDTO fileName(String fileName) {
    this.fileName = fileName;
    return this;
  }

   /**
   * Get fileName
   * @return fileName
  **/
  @ApiModelProperty(example = "", value = "")
  public String getFileName() {
    return fileName;
  }

  public void setFileName(String fileName) {
    this.fileName = fileName;
  }

  public DocumentDTO inlineContent(String inlineContent) {
    this.inlineContent = inlineContent;
    return this;
  }

   /**
   * Get inlineContent
   * @return inlineContent
  **/
  @ApiModelProperty(example = "This is doc content. This can have many lines.", value = "")
  public String getInlineContent() {
    return inlineContent;
  }

  public void setInlineContent(String inlineContent) {
    this.inlineContent = inlineContent;
  }

  public DocumentDTO otherTypeName(String otherTypeName) {
    this.otherTypeName = otherTypeName;
    return this;
  }

   /**
   * Get otherTypeName
   * @return otherTypeName
  **/
  @ApiModelProperty(example = "", value = "")
  public String getOtherTypeName() {
    return otherTypeName;
  }

  public void setOtherTypeName(String otherTypeName) {
    this.otherTypeName = otherTypeName;
  }

  public DocumentDTO permission(String permission) {
    this.permission = permission;
    return this;
  }

   /**
   * Get permission
   * @return permission
  **/
  @ApiModelProperty(example = "[{"groupId" : 1000, "permission" : ["READ","UPDATE"]},{"groupId" : 1001, "permission" : ["READ","UPDATE"]}]", value = "")
  public String getPermission() {
    return permission;
  }

  public void setPermission(String permission) {
    this.permission = permission;
  }

  public DocumentDTO visibility(VisibilityEnum visibility) {
    this.visibility = visibility;
    return this;
  }

   /**
   * Get visibility
   * @return visibility
  **/
  @ApiModelProperty(example = "API_LEVEL", required = true, value = "")
  public VisibilityEnum getVisibility() {
    return visibility;
  }

  public void setVisibility(VisibilityEnum visibility) {
    this.visibility = visibility;
  }

  public DocumentDTO createdTime(String createdTime) {
    this.createdTime = createdTime;
    return this;
  }

   /**
   * Get createdTime
   * @return createdTime
  **/
  @ApiModelProperty(example = "2017-02-20T13:57:16.229+0000", value = "")
  public String getCreatedTime() {
    return createdTime;
  }

  public void setCreatedTime(String createdTime) {
    this.createdTime = createdTime;
  }

  public DocumentDTO createdBy(String createdBy) {
    this.createdBy = createdBy;
    return this;
  }

   /**
   * Get createdBy
   * @return createdBy
  **/
  @ApiModelProperty(value = "")
  public String getCreatedBy() {
    return createdBy;
  }

  public void setCreatedBy(String createdBy) {
    this.createdBy = createdBy;
  }

  public DocumentDTO lastUpdatedTime(String lastUpdatedTime) {
    this.lastUpdatedTime = lastUpdatedTime;
    return this;
  }

   /**
   * Get lastUpdatedTime
   * @return lastUpdatedTime
  **/
  @ApiModelProperty(example = "2017-02-20T13:57:16.229+0000", value = "")
  public String getLastUpdatedTime() {
    return lastUpdatedTime;
  }

  public void setLastUpdatedTime(String lastUpdatedTime) {
    this.lastUpdatedTime = lastUpdatedTime;
  }

  public DocumentDTO lastUpdatedBy(String lastUpdatedBy) {
    this.lastUpdatedBy = lastUpdatedBy;
    return this;
  }

   /**
   * Get lastUpdatedBy
   * @return lastUpdatedBy
  **/
  @ApiModelProperty(value = "")
  public String getLastUpdatedBy() {
    return lastUpdatedBy;
  }

  public void setLastUpdatedBy(String lastUpdatedBy) {
    this.lastUpdatedBy = lastUpdatedBy;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    DocumentDTO document = (DocumentDTO) o;
    return Objects.equals(this.documentId, document.documentId) &&
        Objects.equals(this.name, document.name) &&
        Objects.equals(this.type, document.type) &&
        Objects.equals(this.summary, document.summary) &&
        Objects.equals(this.sourceType, document.sourceType) &&
        Objects.equals(this.sourceUrl, document.sourceUrl) &&
        Objects.equals(this.fileName, document.fileName) &&
        Objects.equals(this.inlineContent, document.inlineContent) &&
        Objects.equals(this.otherTypeName, document.otherTypeName) &&
        Objects.equals(this.permission, document.permission) &&
        Objects.equals(this.visibility, document.visibility) &&
        Objects.equals(this.createdTime, document.createdTime) &&
        Objects.equals(this.createdBy, document.createdBy) &&
        Objects.equals(this.lastUpdatedTime, document.lastUpdatedTime) &&
        Objects.equals(this.lastUpdatedBy, document.lastUpdatedBy);
  }

  @Override
  public int hashCode() {
    return Objects.hash(documentId, name, type, summary, sourceType, sourceUrl, fileName, inlineContent, otherTypeName, permission, visibility, createdTime, createdBy, lastUpdatedTime, lastUpdatedBy);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class DocumentDTO {\n");

    sb.append("    documentId: ").append(toIndentedString(documentId)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    summary: ").append(toIndentedString(summary)).append("\n");
    sb.append("    sourceType: ").append(toIndentedString(sourceType)).append("\n");
    sb.append("    sourceUrl: ").append(toIndentedString(sourceUrl)).append("\n");
    sb.append("    fileName: ").append(toIndentedString(fileName)).append("\n");
    sb.append("    inlineContent: ").append(toIndentedString(inlineContent)).append("\n");
    sb.append("    otherTypeName: ").append(toIndentedString(otherTypeName)).append("\n");
    sb.append("    permission: ").append(toIndentedString(permission)).append("\n");
    sb.append("    visibility: ").append(toIndentedString(visibility)).append("\n");
    sb.append("    createdTime: ").append(toIndentedString(createdTime)).append("\n");
    sb.append("    createdBy: ").append(toIndentedString(createdBy)).append("\n");
    sb.append("    lastUpdatedTime: ").append(toIndentedString(lastUpdatedTime)).append("\n");
    sb.append("    lastUpdatedBy: ").append(toIndentedString(lastUpdatedBy)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}


text: A 4 player local deathmatch arena.


text:
using OctoAwesome.Components;
using OctoAwesome.Definitions;
using OctoAwesome.Notifications;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

namespace OctoAwesome
{
    /// <summary>
    /// Interface for managing Resources in OctoAwesome.
    /// </summary>
    public interface IResourceManager
    {
        /// <summary>
        /// Gets a manager for managing definitions.
        /// </summary>
        IDefinitionManager DefinitionManager { get; }

        /// <summary>
        /// Creates a new universe.
        /// </summary>
        /// <param name="name">The name for the new universe.</param>
        /// <param name="seed">Random seed for generating the universe.</param>
        /// <returns>Die <see cref="Guid"/> of the new universe that was created.</returns>
        Guid NewUniverse(string name, int seed);

        /// <summary>
        /// Tries to load an existing universe by its <see cref="Guid"/>.
        /// </summary>
        /// <param name="universeId">The <see cref="Guid"/> for the universe to load.</param>
        bool TryLoadUniverse(Guid universeId);

        /// <summary>
        /// Gets the currently loaded universe.
        /// </summary>
        /// <remarks><c>null</c> if no universe is loaded.</remarks>
        IUniverse? CurrentUniverse { get; }

        /// <summary>
        /// Unloads the currently loaded universe.
        /// </summary>
        void UnloadUniverse();

        /// <summary>
        /// Gets a list for all universes which can be loaded.
        /// </summary>
        /// <returns>A list for universes that can be loaded.</returns>
        IUniverse[] ListUniverses();

        /// <summary>
        /// Deletes a universe by its identifying <see cref="Guid"/>.
        /// </summary>
        /// <param name="id"><see cref="Guid"/> for the universe to delete.</param>
        void DeleteUniverse(Guid id);

        /// <summary>
        /// Loads a player by his player name.
        /// </summary>
        /// <param name="playerName">The name of the player.</param>
        /// <returns>The loaded player.</returns>
        Player LoadPlayer(string playerName);

        /// <summary>
        /// Saves a player.
        /// </summary>
        /// <param name="player">The player.</param>
        void SavePlayer(Player player);

        /// <summary>
        /// Gets a planet from the <see cref="CurrentUniverse"/>.
        /// </summary>
        /// <param name="planetId">The id of the planet to get.</param>
        /// <returns>Gets the planet of the current universe.</returns>
        IPlanet GetPlanet(int planetId);

        /// <summary>
        /// Gets a planet id to planet mapping in the <see cref="CurrentUniverse"/>.
        /// </summary>
        ConcurrentDictionary<int, IPlanet> Planets { get; }

        /// <summary>
        /// Gets the update hub.
        /// </summary>
        IUpdateHub UpdateHub { get; }

        /// <summary>
        /// Gets the current player.
        /// </summary>
        Player CurrentPlayer { get; }

        /// <summary>
        /// Saves the given component container.
        /// </summary>
        /// <param name="componentContainer">The component container to save.</param>
        /// <typeparam name="TContainer">The type of the component container.</typeparam>
        /// <typeparam name="TComponent">The type of the components contained in the container.</typeparam>
        void SaveComponentContainer<TContainer, TComponent>(TContainer componentContainer)
            where TContainer : ComponentContainer<TComponent>
            where TComponent : IComponent;

        /// <summary>
        /// Saves the given chunk column.
        /// </summary>
        /// <param name="value">The chunk column to save.</param>
        void SaveChunkColumn(IChunkColumn value);

        /// <summary>
        /// Load a chunk column for a given planet at a location.
        /// </summary>
        /// <param name="planet">The planet to load the chunk column of.</param>
        /// <param name="index">The location to load the chunk column from.</param>
        /// <returns></returns>
        IChunkColumn? LoadChunkColumn(IPlanet planet, Index2 index);

        /// <summary>
        /// Loads an entity by its id.
        /// </summary>
        /// <param name="entityId">The id of the entity to load.</param>
        /// <returns>The loaded entity; or <c>null</c> if no matching entity was found.</returns>
        Entity? LoadEntity(Guid entityId);

        /// <summary>
        /// Gets all components of a specific type and their corresponding component ids.
        /// </summary>
        /// <typeparam name="T">The type of the components to get.</typeparam>
        /// <returns>
        /// All components of a specific type and their corresponding component ids.
        /// </returns>
        (Guid Id, T Component)[] GetAllComponents<T>() where T : IComponent, new();

        /// <summary>
        /// Get a component of a specific type by its <see cref="Guid"/>.
        /// </summary>
        /// <param name="id">The identifying <see cref="Guid"/> for the component.</param>
        /// <typeparam name="T">The type of the component to get.</typeparam>
        /// <returns></returns>
        T GetComponent<T>(Guid id) where T : IComponent, new();

        /// <summary>
        /// Loads a component container by its given id.
        /// </summary>
        /// <param name="id">
        /// The <see cref="Guid"/> to load the component container by(<see cref="ComponentContainer.Id"/>).</param>
        /// <typeparam name="TContainer">The type of the container to load.</typeparam>
        /// <typeparam name="TComponent">The type of the components contained in the container.</typeparam>
        /// <returns>
        /// The loaded component container; or <c>null</c> if no matching component container was found.
        /// </returns>
        TContainer? LoadComponentContainer<TContainer, TComponent>(Guid id)
            where TContainer : ComponentContainer<TComponent>
            where TComponent : IComponent;
    }
}


text:
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------------------------------------------

using Xunit;

namespace Microsoft.PSharp.LanguageServices.Tests
{
    public class UsingTests
    {
        [Fact(Timeout=5000)]
        public void TestUsingDeclaration()
        {
            var test = @"
using System.Text;";
            var expected = @"
using Microsoft.PSharp;
using System.Text;
";
            LanguageTestUtilities.AssertRewritten(expected, test);
        }

        [Fact(Timeout=5000)]
        public void TestIncorrectUsingDeclaration()
        {
            var test = "using System.Text";
            LanguageTestUtilities.AssertFailedTestLog("Expected \";\".", test);
        }

        [Fact(Timeout=5000)]
        public void TestUsingDeclarationWithoutIdentifier()
        {
            var test = "using;";
            LanguageTestUtilities.AssertFailedTestLog("Expected identifier.", test);
        }
    }
}


text:
- Fix conflict between ```Serializer``` and ```autonotify```

## 0.7.3
- Update to polymer 1.0.0-rc.14

## 0.7.0
- Implementation of ```polymer_autonotify```
- ```init``` function on ```PolymerService``` class
- Breaking Changes
    * No need to call the constructor of a service.
    * One init function ```initPolymerApp()``` wrapper of:
        + ```initSerializer()```
        + ```initServices()```
        + ```initPolymer()```
    * Use of ```PolymerService.getService(String name)``` to get a service;

## 0.6.1
- fix minor issue on Service

## 0.6.0
- Breaking Changes:
    * commands:
        + ```new_application to app```
        + ```new_element``` to ```element```
        + ```new_route``` to ```route```
        + ```new_behavior``` to ```behavior```
        + ```new_service``` to ```service```
        + ```new_model``` to ```model```
        + ```new_config``` to ```config```
    * No more factory constructor for service class. Service class is now a class extending PolymerModel automatically instanciate and assignate to a global.
        + HttpService http_service = new HttpService();
        + It can be serialize and use in the dom.
- Add ```version``` command
- update to ```polymer 1.0.0-rc.13```

## 0.5.0
- Breaking Change (see [wiki](https://github.com/walletek/polymer_app/wiki))
- Add theme to root_element
- Add ```as_shell``` command
- Multiple Material design layout
    * nav-view
    * nav-header

## 0.4.1
- Add ```serve``` command (do pub get then pub serve)

## 0.4.0
- Breaking Change:
    * polymer_app cli with ```cupid```
    * new commands :
        + new_application
        + new_route
        + new_element
        + new_behavior
        + new_service
        + new_model

## 0.3.1
- Serialize Date

## 0.3.0
- Serializer (first version)
    * ```toJson, fromJson, toMap, fromMap, fromList```
    * Serializer in HttpService
- Use ```reflectable instead of mirror```

## 0.2.0
- New Route
    * No need to instanciate a new ```Page()```
    * Use of ```@PolymerRoute``` and ```PolymerRouterBehavior```

## 0.1.4
- fix route creation
- fix model creation
- fix material toolbar

## 0.1.2
- Clean some code
- Add github buttons

## 0.1.1
- Material Design Template for new app
- Add 'new config' command

## 0.1.0
- Refactor Manager
- Implement --output-folder option

## 0.0.7
- Implement 'polymer_app.json' config

## 0.0.6
- Solid base of tools

## 0.0.1

- Initial version


text:
"""!banner <text> [--font <font>] [-l] return a banner displaying <text>. Use the -l option to list available fonts"""

import argparse
import re
import pyfiglet

FIGLET = pyfiglet.Figlet()
FONTS = FIGLET.getFonts()

ARGPARSE = argparse.ArgumentParser()
ARGPARSE.add_argument('--font')
ARGPARSE.add_argument('-l', action='store_const', const=True)
ARGPARSE.add_argument('bannertext', nargs='*')

def make_banner(query):
    # Slack turns -- into an emdash; un-turn it
    query = query.replace(u"\u2014", u"--")

    ns = ARGPARSE.parse_args(query.split(" "))
    if ns.l:
        return "```{0}```".format(", ".join(FONTS))
    font = ns.font or "standard"

    if font not in FONTS:
        return "Unable to find font {0}".format(font)

    banner = pyfiglet.figlet_format(" ".join(ns.bannertext), font=font).rstrip()
    if not banner:
        return

    return "```{0}```".format(banner)

def on_message(msg, server):
    text = msg.get("text", "")
    match = re.findall(r"!banner (.*)", text)
    if not match:
        return

    return make_banner(match[0])


text:
angular.module('reportjs', []);

angular.module('reportjs').directive('reportJs', function() {

    return {
        restrict: 'EA',
        link: function(scope, element, attrs) {
            var data, layout;

            function render (data, layout) {
                if (angular.isObject(data) && angular.isObject(layout)) {
                    element.empty();
                    var renderer =new reportjs.Renderer();
                    renderer.renderTo(element, {
                        data: data,
                        layout: layout
                    });
                }
            }

            scope.$watchGroup([attrs.reportData, attrs.layout], function(values) {
                data = values[0];
                layout = values[1];
                render(data, layout);
            }, true);

            $(element).parent().resize(function() {
              render(data, layout);
            });
        }
    };

});


text:
import cuisine
from os.path import join

def dir_attribs_recursive(location, mode=None, dir_mode=None, file_mode=None,
                          owner=None, group=None):
    '''Updates the mode/owner/group for the remote dir at the given
    location.'''
    if mode:
        cuisine.run('chmod -R {} "{}"'.format(mode, location))
    if dir_mode:
        cuisine.run('find "{}" -type d '
                    '-exec chmod {} {{}} \;'.format(location, dir_mode))
    if file_mode:
        cuisine.run('find "{}" -type f '
                    '-exec chmod {} {{}} \;'.format(location, file_mode))
    if owner:
        cuisine.run('chown -R {} "{}"'.format(owner, location))
    if group:
        cuisine.run('chgrp -R {} "{}"'.format(group, location))

def package_ensure_multiple(packages, update=False):
    '''Runs package_ensure for a list'''
    for package in packages:
        cuisine.package_ensure(package, update=update)

def python_package_ensure_multiple(packages):
    '''Runs python_package_ensure for a list'''
    for package in packages:
        cuisine.python_package_ensure(package)

def apache_site_ensure(name, config, root_dir=None):
    '''Configures and loads an apache site config'''
    root_dir = root_dir or join('/var/www', name)
    with cuisine.mode_sudo():
        cuisine.dir_ensure(root_dir, recursive=True)
    cuisine.file_write('/etc/apache2/sites-available/{}'.format(name),
                       config, sudo=True)
    if not cuisine.file_exists('/etc/apache2/sites-enabled/{}'.format(name)):
        cuisine.sudo('a2ensite {}'.format(name))
    cuisine.sudo('service apache2 reload')


text:
sap.ui.define([
	"sap/ui/base/Object",
	"sap/ui/testrecorder/Dialects"
], function (BaseObject, Dialects) {
	"use strict";

	var DEFAULT_DIALECT = Dialects.OPA5;

	var oDialectRegistry = null;

	var DialectRegistry = BaseObject.extend("sap.ui.testrecorder.DialectRegistry", {
		constructor: function () {
			if (!oDialectRegistry) {
				BaseObject.apply(this, arguments);
				this.setActiveDialect(DEFAULT_DIALECT);
			} else {
				return oDialectRegistry;
			}
		}
	});

	DialectRegistry.prototype.getActiveDialect = function () {
		return this._sDialect;
	};

	DialectRegistry.prototype.setActiveDialect = function (sDialect) {
		for (var sKey in Dialects) {
			if (sDialect === Dialects[sKey]) {
				this._sDialect = sDialect;
			}
		}
	};

	oDialectRegistry = new DialectRegistry();

	return oDialectRegistry;
});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>CachingSecurityManager (River-Internet vtrunk API Documentation (internals))</title>
<meta name="date" content="2016-03-28">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.river.api.security

Interface CachingSecurityManager

All Known Implementing Classes:

CombinerSecurityManager, DelegateSecurityManager

public interface CachingSecurityManager

A CachingSecurityManager caches the result of check permission calls for
 AccessControlContexts.

Since:

3.0.0

Author:

Peter Firmstone.

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
clearCache()

Clears permissions from the checked cache, it must be
 called after calling Policy.refresh();  It is recommended that it
 be called by a Policy provider, rather than application code.

Method Detail

clearCache

void clearCache()
         throws SecurityException

Clears permissions from the checked cache, it must be
 called after calling Policy.refresh();  It is recommended that it
 be called by a Policy provider, rather than application code.

Throws:

SecurityException

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.


text:
Our goal is build an application that someone who is moving or selling things can easily configure.
You can view or open issues [here](https://github.com/anapaulagomes/to-vendendo/issues). Please say hi at [gitter](https://gitter.im/to-vendendo/Lobby) if you have any questions.

## Steps

Steps to contribute:

1. Look for a issue or open a new one [here](https://github.com/anapaulagomes/to-vendendo/issues) or just drop by our [gitter](https://gitter.im/to-vendendo/Lobby)
2. Create a new branch with an intuitive name (thinking about the concept of [feature branch](https://martinfowler.com/bliki/FeatureBranch.html)
3. Build amazing stuff and have fun
4. Run tests
5. If the tests pass then you are free to commit and push
6. Open a Pull Request with a description and the issue reference

Test-Driven Development is awesome. Think about the design first and keep things simples. We recommend it.

## Best Pratices

Let's try to keep the code as simple and clean as we can. Some good pratices to follow during the contributing process:

- **Respect the PEP8**: don't forget to check the PEP8 complains; you can use pre-commit hook to help you with
- **Write Tests**: **always** write tests for your code
- **Use Feature Branch**: if you are fixing a bug, please add `hotfix/branch-name` to your branch name; if is a feature, add `feature/branch-name`
- **Keep the Cordiality**: be polite and kind; words like please and thank you are welcome :)

## Configuration

To run the code you need `Postgres 9.6` and `Python 3.6`. After that, in the repository folder execute:

`make setup`

We recommend to use virtual environments like [virtualenv](https://virtualenv.pypa.io/en/stable/) or [pipenv](https://docs.pipenv.org/).

- Docker

_Available soon_

## Troubleshooting

- Database is not running

```
E         sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
E       	Is the server running on host "127.0.0.1" and accepting
E       	TCP/IP connections on port 5432?
```

- Database was not created

`sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL:  database "tovendendo_test" does not exist`


text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>Namespace LINE\LINEBot\Event\Parser | line-bot-sdk-php</title>

	<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">

		Overview

Namespaces

						LINE

						LINEBot

						Constant

						Event

						MessageEvent

						Parser

						Exception

						HTTPClient

						ImagemapActionBuilder

						MessageBuilder

						Imagemap

						TemplateBuilder

						TemplateActionBuilder

Classes

EventRequestParser

	<form id="search">
		<input type="hidden" name="cx" value="">
		<input type="hidden" name="ie" value="UTF-8">
		<input type="text" name="q" class="text" placeholder="Search">
	</form>

				Overview

Namespace

Class

Namespace LINE\LINEBot\Event\Parser

Classes summary

	EventRequestParser

		line-bot-sdk-php API documentation generated by ApiGen


text:
module SubdomainRoutes
  module TestUnitMatcher
    class Base
      class TestCase < ActionController::TestCase
      end

      def initialize(count_method, messages, spec)
        @count_method, @messages, @spec = count_method, messages, spec
      end

      def run_test(target)
        result = Test::Unit::TestResult.new
        spec = @spec
        TestCase.send :define_method, :test do
          copy_instance_variables_from(spec)
          instance_eval(&target)
        end
        TestCase.new(:test).run(result) {}
        result
      end

      def matches?(target)
        @result = run_test(target)
        @result_count = @result.send(@count_method)
        @result_count > 0
      end

      def failure_message
        "Expected #{@count_method.to_s.humanize.downcase} to be more than zero, got zero.\n"
      end

      def negative_failure_message
        "Expected #{@count_method.to_s.humanize.downcase} to be zero, got #{@result_count}:\n" +
        @result.instance_variable_get(@messages).map(&:inspect).join("\n")
      end
    end

    def have_errors
      Base.new(:error_count, :@errors, self)
    end

    def fail
      Base.new(:failure_count, :@failures, self)
    end
  end
end