text:
namespace mojo {

bool StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter>::
    Read(arc::mojom::IntentFilterDataView data,
         arc::IntentFilter* out) {
  std::vector<arc::IntentFilter::AuthorityEntry> authorities;
  if (!data.ReadDataAuthorities(&authorities))
    return false;

  std::vector<arc::IntentFilter::PatternMatcher> paths;
  if (!data.ReadDataPaths(&paths))
    return false;

  *out = arc::IntentFilter(std::move(authorities), std::move(paths));
  return true;
}

bool StructTraits<arc::mojom::AuthorityEntryDataView,
                    arc::IntentFilter::AuthorityEntry>::
    Read(arc::mojom::AuthorityEntryDataView data,
         arc::IntentFilter::AuthorityEntry* out) {
  std::string host;
  bool result = data.ReadHost(&host);
  if (!result)
    return false;

  *out = arc::IntentFilter::AuthorityEntry(std::move(host), data.port());
  return true;
}

bool StructTraits<arc::mojom::PatternMatcherDataView,
                    arc::IntentFilter::PatternMatcher>::
  Read(arc::mojom::PatternMatcherDataView data,
                   arc::IntentFilter::PatternMatcher* out) {
  std::string pattern;
  if (!data.ReadPattern(&pattern))
    return false;

  arc::mojom::PatternType type;
  if (!data.ReadType(&type))
    return false;

  *out = arc::IntentFilter::PatternMatcher(std::move(pattern), type);
  return true;
}

}  // namespace mojo


text:
use DocId;

use super::fieldnorm_to_id;
use super::FieldNormsSerializer;
use schema::Field;
use schema::Schema;
use std::io;

/// The `FieldNormsWriter` is in charge of tracking the fieldnorm byte
/// of each document for each field with field norms.
///
/// `FieldNormsWriter` stores a Vec<u8> for each tracked field, using a
/// byte per document per field.
pub struct FieldNormsWriter {
    fields: Vec<Field>,
    fieldnorms_buffer: Vec<Vec<u8>>,
}

impl FieldNormsWriter {
    /// Returns the fields that should have field norms computed
    /// according to the given schema.
    pub(crate) fn fields_with_fieldnorm(schema: &Schema) -> Vec<Field> {
        schema
            .fields()
            .iter()
            .enumerate()
            .filter(|&(_, field_entry)| field_entry.is_indexed())
            .map(|(field, _)| Field(field as u32))
            .collect::<Vec<Field>>()
    }

    /// Initialize with state for tracking the field norm fields
    /// specified in the schema.
    pub fn for_schema(schema: &Schema) -> FieldNormsWriter {
        let fields = FieldNormsWriter::fields_with_fieldnorm(schema);
        let max_field = fields
            .iter()
            .map(|field| field.0)
            .max()
            .map(|max_field_id| max_field_id as usize + 1)
            .unwrap_or(0);
        FieldNormsWriter {
            fields,
            fieldnorms_buffer: (0..max_field).map(|_| Vec::new()).collect::<Vec<_>>(),
        }
    }

    /// Ensure that all documents in 0..max_doc have a byte associated with them
    /// in each of the fieldnorm vectors.
    ///
    /// Will extend with 0-bytes for documents that have not been seen.
    pub fn fill_up_to_max_doc(&mut self, max_doc: DocId) {
        for &field in self.fields.iter() {
            self.fieldnorms_buffer[field.0 as usize].resize(max_doc as usize, 0u8);
        }
    }

    /// Set the fieldnorm byte for the given document for the given field.
    ///
    /// Will internally convert the u32 `fieldnorm` value to the appropriate byte
    /// to approximate the field norm in less space.
    ///
    /// * doc       - the document id
    /// * field     - the field being set
    /// * fieldnorm - the number of terms present in document `doc` in field `field`
    pub fn record(&mut self, doc: DocId, field: Field, fieldnorm: u32) {
        let fieldnorm_buffer: &mut Vec<u8> = &mut self.fieldnorms_buffer[field.0 as usize];
        assert!(
            fieldnorm_buffer.len() <= doc as usize,
            "Cannot register a given fieldnorm twice"
        );
        // we fill intermediary `DocId` as  having a fieldnorm of 0.
        fieldnorm_buffer.resize(doc as usize + 1, 0u8);
        fieldnorm_buffer[doc as usize] = fieldnorm_to_id(fieldnorm);
    }

    /// Serialize the seen fieldnorm values to the serializer for all fields.
    pub fn serialize(&self, fieldnorms_serializer: &mut FieldNormsSerializer) -> io::Result<()> {
        for &field in self.fields.iter() {
            let fieldnorm_values: &[u8] = &self.fieldnorms_buffer[field.0 as usize][..];
            fieldnorms_serializer.serialize_field(field, fieldnorm_values)?;
        }
        Ok(())
    }
}

redpajama_set_name: RedPajamaGithub


text:
require "colorize"

module Langular

	module Command

		def self.init(given_arg)

			concurrent_args = ARGV[1..ARGV.length]

			begin
				puts "Calling #{given_arg}() with #{concurrent_args}"
				self.method(given_arg).call(concurrent_args)
			rescue => error
				puts "the method #{given_arg} was not found or #{concurrent_args} returned an error.\nTech details: #{error}".red
			end
		end

		def self.make(args)

			puts "got here with #{args} in make()"

		end

		def self.generate(args)

			#templates = {}
			puts "got here with #{args} in generate()"

			#x = File.read()
			#do_interpolation = x % {}
			#File.open()

		end

		def self.directive(args)

			template = "directive.js"
			puts "got here with #{args} in directive()"
			the_directive = args[0]
			x = %x(node spencer/dashify.js #{the_directive})
			puts x

			#x = File.read("./langular/#{template}")
			#do_interpolation x % { :name => args[0] }

		end

		def self.new(args)

			template = "app.js"
			puts "got here  with #{args} in new()"

			x = File.read("./Langular/#{template}")
			do_interpolation = x % { :name => args[0], :modules => (args.drop(1).collect {|y| "\"#{y}\""}).join(", ") }
			File.open("./app/#{template}", "w") { |file| file.puts do_interpolation }

		end

	end

	def self.do_args

		self::Command.init(ARGV[0])

	end

end

Langular.do_args


text:
#import <Foundation/Foundation.h>

/*!
 @category NSString (Apigee)
 @discussion This category provides methods that capture network performance
 metrics on built-in NSString methods that perform network calls.
 */
@interface NSString (Apigee)

/*!
 @abstract Returns a string created by reading data from a given URL interpreted
    using a given encoding.
 @param url The URL to read.
 @param enc The encoding of the data at url.
 @param error If an error occurs, upon returns contains an NSError object that
    describes the problem. If you are not interested in possible errors, you may
    pass in NULL.
 @return A string created by reading data from URL using the encoding, enc. If
    the URL can't be opened or there is an encoding error, returns nil.
 @discussion This method simply calls the NSString class method
    stringWithContentsOfURL:encoding:error: while capturing the network performance
    metrics for that call.
 */
+ (NSString*) stringWithTimedContentsOfURL:(NSURL *) url
                                  encoding:(NSStringEncoding) enc
                                     error:(NSError **) error;

/*!
 @abstract Returns a string created by reading data from a given URL and returns
    by reference the encoding used to interpret the data.
 @param url The URL from which to read data.
 @param enc Upon return, if url is read successfully, contains the encoding used
    to interpret the data.
 @param error If an error occurs, upon returns contains an NSError object that
    describes the problem. If you are not interested in possible errors, you may
    pass in NULL.
 @return A string created by reading data from url. If the URL can't be opened
    or there is an encoding error, returns nil.
 @discussion This method simply calls the NSString class method
    stringWithContentsOfURL:usedEncoding:error: while capturing the network
    performance metrics for that call.
 */
+ (NSString*) stringWithTimedContentsOfURL:(NSURL *) url
                              usedEncoding:(NSStringEncoding *) enc
                                     error:(NSError **) error;

/*!
 @abstract Returns an NSString object initialized by reading data from a given
    URL interpreted using a given encoding.
 @param url The URL to read.
 @param enc The encoding of the file at url.
 @param error If an error occurs, upon returns contains an NSError object that
    describes the problem. If you are not interested in possible errors, pass
    in NULL.
 @return An NSString object initialized by reading data from url. If the URL
    can't be opened or there is an encoding error, returns nil.
 @discussion This method simply calls the NSString instance method
    initWithContentsOfURL:encoding:error: while capturing the network
    performance metrics for that call.
 */
- (id) initWithTimedContentsOfURL:(NSURL *) url
                         encoding:(NSStringEncoding) enc
                            error:(NSError **) error;

/*!
 @abstract Returns an NSString object initialized by reading data from a given
    URL and returns by reference the encoding used to interpret the data.
 @param url The URL from which to read data.
 @param enc Upon return, if url is read successfully, contains the encoding
    used to interpret the data.
 @param error If an error occurs, upon returns contains an NSError object that
    describes the problem. If you are not interested in possible errors, pass
    in NULL.
 @return An NSString object initialized by reading data from url. If url can't
    be opened or the encoding cannot be determined, returns nil.
 @discussion  This method simply calls the NSString instance method
    initWithContentsOfURL:usedEncoding:error: while capturing the network
    performance metrics for that call.
 */
- (id) initWithTimedContentsOfURL:(NSURL *) url
                     usedEncoding:(NSStringEncoding *) enc
                            error:(NSError **) error;

// convenience methods
/*!
 @internal
 */
- (BOOL) containsString:(NSString *)substringToLookFor;

@end


text:
package com.maddhacker.ol.serialization.json.deserializer;

import java.io.IOException;
import java.math.BigDecimal;

import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;

public class JsonBigDecimalDeserializer extends JsonDeserializer<BigDecimal> {

	@Override
	public BigDecimal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
			JsonProcessingException {
		return new BigDecimal(jp.getValueAsDouble());
	}

}


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

namespace Hyperstore.Modeling.Statistics
{
    ///-------------------------------------------------------------------------------------------------
    /// <summary>
    ///  Interface for statistic counter.
    /// </summary>
    ///-------------------------------------------------------------------------------------------------
    public interface IStatisticCounter
    {
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Gets the type of the counter.
        /// </summary>
        /// <value>
        ///  The total number of er type.
        /// </value>
        ///-------------------------------------------------------------------------------------------------
        StatisticCounterType CounterType { get; }

        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Gets the description.
        /// </summary>
        /// <value>
        ///  The description.
        /// </value>
        ///-------------------------------------------------------------------------------------------------
        string Description { get; }

        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Gets the value.
        /// </summary>
        /// <value>
        ///  The value.
        /// </value>
        ///-------------------------------------------------------------------------------------------------
        double Value { get; }

        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Decs this instance.
        /// </summary>
        ///-------------------------------------------------------------------------------------------------
        void Dec();

        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Incrs this instance.
        /// </summary>
        ///-------------------------------------------------------------------------------------------------
        void Incr();

        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Increment by.
        /// </summary>
        /// <param name="value">
        ///  The value.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        void IncrBy(long value);
    }
}


text:
<?php

require __DIR__ . '/../vendor/autoload.php';

class AAA {}
class BBB {}
class CCC {
    public function __construct(BBB $bbb) {}
    public function setBbb(BBB $bbb) {}
    public $aaa;
}
class DDD {}
function get_a_bbb() { return new BBB; }

/**
 * @property-read AAA $aaa
 * @property-read BBB $bbb1
 * @property-read BBB $bbb2
 * @property-read BBB $bbb3
 * @property-read CCC $ccc
 * @property-read DDD $ddd
 *
 * @method AAA new_aaa()
 */
class MyContainer extends \Props\Container {
    public function __construct() {
        // store plain old values
        $this->ddd = new DDD;
        $this->{'bbb.class'} = 'BBB';

        // set a factory, which will construct an object on demand
        $this->aaa = function () {
            return new AAA();
        };

        // alternative factory syntax, and using a reference to specify the class name
        $this->setFactory('bbb1', function (MyContainer $c) {
            return new $c->{'bbb.class'};
        });

        // fetch with a callback
        $this->setFactory('bbb2', 'get_a_bbb');

        // Closures automatically used as factories
        $this->bbb3 = function (MyContainer $c) {
            return $c->bbb2;
        };

        // more advanced factory
        $this->ccc = function (MyContainer $c) {
            $val = new CCC($c->bbb1);
            $val->setBbb($c->bbb2);
            $val->aaa = $c->aaa;
            return $val;
        };
    }
}

$c = new MyContainer;

$c->aaa; // factory builds a AAA
$c->aaa; // the same AAA
$c->new_aaa(); // always a freshly-built AAA

$c->bbb1; // factory resolves bar.class, builds a BBB
$c->bbb2; // invoker calls get_a_bbb()
$c->bbb3; // invoker executes anon func, returning the already-cached $c->bbb2 instance

$c->ccc; // factory creates CCC, passing a new BBB object,
          // calls setBbb(), passing in $c->bbb2,
          // and sets the aaa property to $c->aaa


text:
The `KNITRO.jl` package provides an interface for using the [Artelys Knitro solver](http://www.ziena.com/knitro.htm) from the [Julia language](http://julialang.org). You cannot use `KNITRO.jl` without having purchased and installed a copy of Artelys Knitro from [Artelys](https://www.artelys.com). This package is available free of charge and in no way replaces or alters any functionality of the Artelys Knitro solver.

Artelys Knitro functionality is extensive, so `KNITRO.jl`'s coverage is incomplete, but the basic functionality for solving linear, nonlinear, and mixed-integer programs is provided.

## Installation

1. First, you must obtain a copy of the Artelys Knitro software and a license; trial versions and academic licenses are available [here](https://www.artelys.com/en/optimization-tools/knitro#downloads-tab).

2. Once Artelys Knitro is installed on your machine, point the `LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (OS X) variable to the Artelys Knitro library by adding, e.g. `export LD_LIBRARY_PATH="$HOME/knitro-9.0.1-z/lib:$LD_LIBRARY_PATH"` or `export DYLD_LIBRARY_PATH="$HOME/knitro-9.0.1-z/lib:$DYLD_LIBRARY_PATH"` to your start-up file (e.g. `.bash_profile`).

3. At the Julia prompt, run `Pkg.add("KNITRO")`.

4. Test that KNITRO.jl works by runnning `Pkg.test("KNITRO")`.

### Setting up Knitro on Windows
Note that currently *only 64-bit* Windows is supported. That is, you must use 64-bit Julia and install the Win64 version of Artelys Knitro.

1. First, you must obtain a copy of the Artelys Knitro software and a license; trial versions and academic licenses are available [here](https://www.artelys.com/en/optimization-tools/knitro#downloads-tab).

2. Once Artelys Knitro is installed on your machine, add the directory containing `knitro.dll` to the `PATH` environment variable, as described in the Artelys Knitro documentation.

3. At the Julia prompt, run `Pkg.add("KNITRO")`

4. Test that KNITRO.jl works by runnning `Pkg.test("KNITRO")`.


text:
require 'rubygems'

unless $spec_helper_loaded
  $spec_helper_loaded = true

  $LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
  SPEC_TMP_DIR = File.expand_path('tmp', File.dirname(__FILE__))
  require 'spork'
  require 'stringio'
  require 'fileutils'
  require 'rspec'

  RSpec.configure do |config|
    config.before(:each) do
      $test_stdout = StringIO.new
      $test_stderr = StringIO.new
      @current_dir = nil
    end

    config.after(:each) do
      FileUtils.rm_rf(SPEC_TMP_DIR) if File.directory?(SPEC_TMP_DIR)

    end

    def create_file(filename, contents)
      FileUtils.mkdir_p(SPEC_TMP_DIR) unless File.directory?(SPEC_TMP_DIR)

      in_current_dir do
        FileUtils.mkdir_p(File.dirname(filename))
        File.open(filename, 'wb') { |f| f << contents }
      end
    end

    def create_helper_file(test_framework = FakeFramework)
      create_file(test_framework.helper_file, "# stub spec helper file")
    end

    def in_current_dir(&block)
      Dir.chdir(current_dir, &block)
    end

    def current_dir
      @current_dir ||= SPEC_TMP_DIR
    end

    def change_current_dir(sub_path)
      @current_dir = File.expand_path(sub_path, SPEC_TMP_DIR)
    end

    def windows?
      ENV['OS'] == 'Windows_NT'
    end
  end

  module RSpec
    module Matchers
      class IncludeAStringLike
        def initialize(substring_or_regex)
          case substring_or_regex
          when String
            @regex = Regexp.new(Regexp.escape(substring_or_regex))
          when Regexp
            @regex = substring_or_regex
          else
            raise ArgumentError, "don't know what to do with the #{substring_or_regex.class} you provided"
          end
        end

        def matches?(list_of_strings)
          @list_of_strings = list_of_strings
          @list_of_strings.any? { |s| s =~ @regex }
        end
        def failure_message
          "#{@list_of_strings.inspect} expected to include a string like #{@regex.inspect}"
        end
        def negative_failure_message
          "#{@list_of_strings.inspect} expected to not include a string like #{@regex.inspect}, but did"
        end
      end

      def include_a_string_like(substring_or_regex)
        IncludeAStringLike.new(substring_or_regex)
      end
    end
  end

  module Spork::TestIOStreams
    def self.included(klass)
      klass.send(:extend, ::Spork::TestIOStreams::ClassMethods)
    end

    def stderr
      self.class.stderr
    end

    def stdout
      self.class.stdout
    end

    module ClassMethods
      def stderr
        $test_stderr
      end

      def stdout
        $test_stdout
      end
    end
  end

  Dir.glob(File.dirname(__FILE__) + "/support/*.rb").each { |f| require(f) }
end


text:
package monasca.api.domain.model.alarmstatehistory;

import java.util.List;

import monasca.common.model.alarm.AlarmTransitionSubAlarm;
import org.joda.time.DateTime;

import monasca.common.model.alarm.AlarmState;
import monasca.common.model.domain.common.AbstractEntity;
import monasca.common.model.metric.MetricDefinition;
import monasca.common.util.Conversions;

public class AlarmStateHistory  extends AbstractEntity {
  private String alarmId;
  private List<MetricDefinition> metrics;
  private AlarmState oldState;
  private AlarmState newState;
  private String reason;
  private String reasonData;
  private DateTime timestamp;
  private List<AlarmTransitionSubAlarm> subAlarms;

  public AlarmStateHistory() {}

  public AlarmStateHistory(
      String alarmId,
      List<MetricDefinition> metrics,
      AlarmState oldState,
      AlarmState newState,
      List<AlarmTransitionSubAlarm> subAlarms,
      String reason,
      String reasonData,
      DateTime timestamp) {
    this.alarmId = alarmId;
    this.setMetrics(metrics);
    this.oldState = oldState;
    this.newState = newState;
    this.subAlarms = subAlarms;
    this.reason = reason;
    this.reasonData = reasonData;
    this.timestamp = Conversions.variantToDateTime(timestamp);
    this.id = timestamp.toString();
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (!(obj instanceof AlarmStateHistory))
      return false;
    AlarmStateHistory other = (AlarmStateHistory) obj;
    if (alarmId == null) {
      if (other.alarmId != null)
        return false;
    } else if (!alarmId.equals(other.alarmId))
      return false;
    if (metrics == null) {
      if (other.metrics != null)
        return false;
    } else if (!metrics.equals(other.metrics))
      return false;
    if (newState != other.newState)
      return false;
    if (oldState != other.oldState)
      return false;
    if (subAlarms == null) {
      if (other.subAlarms != null)
        return false;
      } else if (!subAlarms.equals(other.subAlarms))
      return false;
    if (reason == null) {
      if (other.reason != null)
        return false;
    } else if (!reason.equals(other.reason))
      return false;
    if (reasonData == null) {
      if (other.reasonData != null)
        return false;
    } else if (!reasonData.equals(other.reasonData))
      return false;
    if (timestamp == null) {
      if (other.timestamp != null)
        return false;
    } else if (!timestamp.equals(other.timestamp))
      return false;
    return true;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getAlarmId() {
    return alarmId;
  }

  public List<MetricDefinition> getMetrics() {
    return metrics;
  }

  public AlarmState getNewState() {
    return newState;
  }

  public AlarmState getOldState() {
    return oldState;
  }

  public String getReason() {
    return reason;
  }

  public String getReasonData() {
    return reasonData;
  }

  public DateTime getTimestamp() {
    return timestamp;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((alarmId == null) ? 0 : alarmId.hashCode());
    result = prime * result + ((metrics == null) ? 0 : metrics.hashCode());
    result = prime * result + ((newState == null) ? 0 : newState.hashCode());
    result = prime * result + ((oldState == null) ? 0 : oldState.hashCode());
    result = prime * result + ((subAlarms == null) ? 0 : subAlarms.hashCode());
    result = prime * result + ((reason == null) ? 0 : reason.hashCode());
    result = prime * result + ((reasonData == null) ? 0 : reasonData.hashCode());
    result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode());
    return result;
  }

  public void setAlarmId(String alarmId) {
    this.alarmId = alarmId;
  }

  public void setMetrics(List<MetricDefinition> metrics) {
    this.metrics = metrics;
  }

  public void setNewState(AlarmState newState) {
    this.newState = newState;
  }

  public void setOldState(AlarmState oldState) {
    this.oldState = oldState;
  }

  public void setReason(String reason) {
    this.reason = reason;
  }

  public void setReasonData(String reasonData) {
    this.reasonData = reasonData;
  }

  public List<AlarmTransitionSubAlarm> getSubAlarms() {
    return subAlarms;
  }

  public void setSubAlarms(List<AlarmTransitionSubAlarm> subAlarms) {
    this.subAlarms = subAlarms;
  }

  public void setTimestamp(DateTime timestamp) {
    this.timestamp = Conversions.variantToDateTime(timestamp);
    // Set the id in the AbstractEntity class.
    id = timestamp.toString();
  }

  @Override
  public String toString() {
    return "AlarmStateHistory [alarmId=" + alarmId + ", metrics=" + metrics + ", oldState="
        + oldState + ", newState=" + newState + ", subAlarms=" + subAlarms + ", reason=" + reason + ", reasonData=" + reasonData
        + ", timestamp=" + timestamp + "]";
  }
}


text:
function simPractice
global xInit uExternal
alphaVar = [1 pi/6, 1.2, 1.2, 12];
% options = simset('Solver', 'ode23t', 'OutputVariables', 'xy');
params.Solver = 'ode23t';
params.SaveFinalState = 'on';
params.FinalStateName = 'xFinal';
params.SaveFormat = 'Structure';
params.StartTime = '10';
params.StopTime = '13';
params.OutputTimes = 'linspace(10,13, 30*6)';
params.LoadExternalInput = 'on';
uExternal = ['[' num2str(alphaVar) ']'];
params.ExternalInput = 'uExternal';

simOut = sim('salpChain', params);

xInit = simOut.find('xFinal');

params.LoadInitialState = 'on';
params.InitialState = 'xInit';
params.StartTime = '13';
params.StopTime = '16';
params.OutputTimes = 'linspace(13,16, 30*6)';
% simget(options)
% input('simulate sext second');
simOut = sim('salpChain', params);

params.StartTime = '10';
params.StopTime = '16';
params.OutputTimes = 'linspace(10,16, 30*12)';
params.LoadInitialState = 'off';
simOut = sim('salpChain', params);

end
%
% function [frequency, delay, amp] = UT(t)
%     frequency = 1;
%     delay = pi/6;
%     amp = [2 0.1 0.1];
% end
%


text:
<?php

/**
 * LaterPay statistics helper.
 *
 * Plugin Name: LaterPay
 * Plugin URI: https://github.com/laterpay/laterpay-typo3-extension
 * Author URI: https://laterpay.net/
 */
class tx_laterpay_helper_statistic {

	/**
	 * Content view inserter
	 *
	 * @param tslib_cObj $contentObject Content object
	 *
	 * @return void
	 */
	public static function addContentView(tslib_cObj $contentObject) {

		if (tx_laterpay_helper_pricing::isPurchasable($contentObject)) {
			$data = array(
				'content_id' => $contentObject->data['uid'],
				'ip' => ip2long($_SERVER['REMOTE_ADDR']),
			);
			$model = new tx_laterpay_model_post_view();
			$model->updateContentViews($data);
		}
	}
}


text:
<?php

namespace Tests\AppBundle\Controller\Dtp\Backend;

use AppBundle\Controller\Dtp\Backend\PlayerController;
use AppBundle\Entity\DTP\Tournament;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;

class PlayerControllerTest extends WebTestCase
{
    public function testCreateWithEmptySessionRedirectsToDashboard()
    {
        $client = static::createClient([], [
            'PHP_AUTH_USER' => 'micha',
            'PHP_AUTH_PW' => 'secret'
        ]);

        $client->request('GET', '/tipprunde/admin/player/create');

        $this->assertTrue(
            $client->getResponse()->isRedirect('/tipprunde/admin'),
            'response is a redirect to /tipprunde/admin'
        );
    }

    public function testCreate()
    {
        $session = new Session(new MockArraySessionStorage());
        $session->set('dtp.backend.tournament', new Tournament());

        $client = static::createClient([], [
            'PHP_AUTH_USER' => 'micha',
            'PHP_AUTH_PW' => 'secret'
        ]);

        $client->request('GET', '/tipprunde/admin/player/create');

        $this->assertEquals(302, $client->getResponse()->getStatusCode());
    }
}


text:
<?php

/* TopxiaWebBundle:Announcement:announcement.html.twig */
class __TwigTemplate_a11ef9141a5bdf3552a677d9cc69ea97d07eaf67fef5ecca2b6c27e2bb84a568 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        $context["announcements"] = $this->env->getExtension('Topxia\WebBundle\Twig\Extension\DataExtension')->getData("Announcement", array("count" => 3));
        // line 2
        if (((isset($context["announcements"]) ? $context["announcements"] : null) &&  !$this->getAttribute($this->getAttribute($this->getAttribute((isset($context["app"]) ? $context["app"] : null), "request", array()), "cookies", array()), "get", array(0 => "close_announcements_alert"), "method"))) {
            // line 3
            echo "

      ";
            // line 6
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable((isset($context["announcements"]) ? $context["announcements"] : null));
            foreach ($context['_seq'] as $context["_key"] => $context["announcement"]) {
                // line 7
                echo "        ";
                if ($this->getAttribute($context["announcement"], "url", array())) {
                    // line 8
                    echo "

          env, $this->getAttribute($context["announcement"], "url", array()), "html", null, true);
                    echo "\" target=\"_blank\">
            ";
                    // line 11
                    echo $this->env->getExtension('Topxia\WebBundle\Twig\Extension\WebExtension')->subTextFilter($this->getAttribute($context["announcement"], "content", array()), 50);
                    echo "

        ";
                } else {
                    // line 15
                    echo "

          ";
                    // line 17
                    echo $this->env->getExtension('Topxia\WebBundle\Twig\Extension\WebExtension')->subTextFilter($this->getAttribute($context["announcement"], "content", array()), 50);
                    echo "

        ";
                }
                // line 20
                echo "      ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['announcement'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 21
            echo "

    <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">
      ×
    </button>

";
        }
    }

    public function getTemplateName()
    {
        return "TopxiaWebBundle:Announcement:announcement.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  66 => 21,  60 => 20,  54 => 17,  50 => 15,  43 => 11,  39 => 10,  35 => 8,  32 => 7,  28 => 6,  23 => 3,  21 => 2,  19 => 1,);
    }

    public function getSource()
    {
        return "";
    }
}


text:
package com.ikanow.aleph2.management_db.services;

import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.Test;

import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadJobBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadJobBean.AnalyticThreadJobInputBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadJobBean.AnalyticThreadJobInputConfigBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadJobBean.AnalyticThreadJobOutputBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadTriggerBean.AnalyticThreadComplexTriggerBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadTriggerBean;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadTriggerBean.AnalyticThreadComplexTriggerBean.TriggerOperator;
import com.ikanow.aleph2.data_model.objects.data_analytics.AnalyticThreadTriggerBean.AnalyticThreadComplexTriggerBean.TriggerType;
import com.ikanow.aleph2.data_model.objects.data_import.DataBucketBean;
import com.ikanow.aleph2.data_model.objects.data_import.DataBucketBean.MasterEnrichmentType;
import com.ikanow.aleph2.data_model.objects.shared.BasicMessageBean;
import com.ikanow.aleph2.data_model.utils.BeanTemplateUtils;

public class TestDataBucketCrudService_Analytics {

	@Test
	public void test_basicAnalyticsValidation() {

		// (Base check:)
		List<String> res0 = DataBucketCrudService.validateAnalyticBucket(getBaseBucket("/tb0", null, null));
		assertTrue("Simple bucket validates: " + res0.stream().collect(Collectors.joining(";")), res0.isEmpty());

		// 2) Jobs

		// Job should have valid name

		{
			final AnalyticThreadJobBean job = getBaseJob("/invalid/name", null, null, null);

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb2a", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			assertEquals(1, res.size());
		}

		// Jobs should have a a valid analytic_technology_name_or_id

		{
			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, null, null))
					.with(AnalyticThreadJobBean::analytic_technology_name_or_id, null)
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb2a", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}

		// Jobs should have a valid analytic type

		{
			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, null, null))
					.with(AnalyticThreadJobBean::analytic_type, null)
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb2a", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		{
			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, null, null))
					.with(AnalyticThreadJobBean::analytic_type, MasterEnrichmentType.none)
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb2a", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}

		// 3) Inputs

		// Valid data service
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::data_service, null)
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3a", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::data_service, "banana")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3b", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		//(check some non-default valid ones)
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::data_service, "search_index_service")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3c", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::data_service, "storage_service")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3d", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::data_service, "batch")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3e", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}

		// Valid resource name
		// (invalid ones)
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::resource_name_or_id, null)
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3f", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::resource_name_or_id, "::")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3g", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		//(check some valid ones)
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::resource_name_or_id, "test1")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3h", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::resource_name_or_id, ":test1")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3i", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::resource_name_or_id, "/valid:test1")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3j", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.with(AnalyticThreadJobInputBean::resource_name_or_id, "/valid")
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3k", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}

		// Valid times:
		// (invalid)
		{
			final AnalyticThreadJobInputConfigBean in_cfg = getBaseInputConfig("rabbit", "banana");

			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(in_cfg))
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3l", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(2, res.size());

		}
		// (invalid pulled from global)
		{
			final AnalyticThreadJobInputConfigBean in_cfg = getBaseInputConfig("rabbit", "banana");

			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(null))
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, in_cfg))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3m", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(2, res.size());

		}
		// (some valid)
		{
			final AnalyticThreadJobInputConfigBean in_cfg = getBaseInputConfig("1 week ago", "now");

			final AnalyticThreadJobInputBean input = BeanTemplateUtils.clone(getBaseInput(in_cfg))
					.done();

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", input, null, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb3n", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());

		}

		// 4) Output

		//invalid
		{
			final AnalyticThreadJobOutputBean output = getBaseOutput(true, null, "invalid");

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, output, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4a", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(2, res.size());
		}
		{
			final AnalyticThreadJobOutputBean output = getBaseOutput(true, MasterEnrichmentType.none, null);

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, output, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4b", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		//valid
		{
			final AnalyticThreadJobOutputBean output = getBaseOutput(true, MasterEnrichmentType.streaming, null);

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, output, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4c", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final AnalyticThreadJobOutputBean output = getBaseOutput(false, null, "invalid");

			final AnalyticThreadJobBean job = BeanTemplateUtils.clone(getBaseJob("name", null, output, null))
					.done();

			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4d", job, null))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
	}

	@Test
	public void test_analyticsValidation_triggers() {

		// 5) Top level trigger test

		// (Base check:)
		List<String> res0 = DataBucketCrudService.validateAnalyticBucket(getBaseBucket("/tb5/a", null, getBaseTriggerBean("hourly", getComplexTriggerBean(0))));
		assertTrue("Simple bucket validates: " + res0.stream().collect(Collectors.joining(";")), res0.isEmpty());

		// Invalid time
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4d", null, getBaseTriggerBean("rabbit", getComplexTriggerBean(0))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}

		// 6) Complex trigger tests

		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/1", null, getBaseTriggerBean(null, getComplexTriggerBean(1))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/2", null, getBaseTriggerBean(null, getComplexTriggerBean(2))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(2, res.size());
		}
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/3", null, getBaseTriggerBean(null, getComplexTriggerBean(3))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/31", null, getBaseTriggerBean(null, getComplexTriggerBean(31))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(0, res.size());
		}
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/4", null, getBaseTriggerBean(null, getComplexTriggerBean(4))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/5/1", null, getBaseTriggerBean(null, getComplexTriggerBean(51))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(2, res.size());
		}
		{
			final DataBucketBean tb = BeanTemplateUtils.clone(getBaseBucket("/tb4e/5/2", null, getBaseTriggerBean(null, getComplexTriggerBean(52))))
					.done();

			List<BasicMessageBean> res = DataBucketCrudService.staticValidation(tb);
			System.out.println("validation errs = " + res.stream().map(m->m.message()).collect(Collectors.joining(" ; ")));
			assertEquals(1, res.size());
		}
	}

	protected AnalyticThreadComplexTriggerBean getComplexTriggerBean(int type) {

		if (0 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					.with(AnalyticThreadComplexTriggerBean::resource_name_or_id, "/test")
					.with(AnalyticThreadComplexTriggerBean::type, TriggerType.bucket)
					.done().get();
		}
		else if (1 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(both op and resource id null)
					.done().get();
		}
		else if (2 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(both op and resource id non null)
					.with(AnalyticThreadComplexTriggerBean::resource_name_or_id, "/test")
					.with(AnalyticThreadComplexTriggerBean::type, TriggerType.file)
					.with(AnalyticThreadComplexTriggerBean::op, TriggerOperator.and)
					.with(AnalyticThreadComplexTriggerBean::dependency_list, Arrays.asList(getComplexTriggerBean(1)))
					.done().get();
		}
		else if (3 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(custom type with no analytic tech specified)
					.with(AnalyticThreadComplexTriggerBean::resource_name_or_id, "/test")
					.with(AnalyticThreadComplexTriggerBean::type, TriggerType.custom)
					.done().get();
		}
		else if (31 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(custom type with no analytic tech specified)
					.with(AnalyticThreadComplexTriggerBean::custom_analytic_technology_name_or_id, "/test")
					.with(AnalyticThreadComplexTriggerBean::type, TriggerType.custom)
					.with(AnalyticThreadComplexTriggerBean::resource_name_or_id, "/test")
					.done().get();
		}
		else if (4 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(operator with empty list)
					.with(AnalyticThreadComplexTriggerBean::op, TriggerOperator.and)
					.done().get();
		}
		else if (51 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(type no resource id)
					.with(AnalyticThreadComplexTriggerBean::type, TriggerType.file)
					.done().get();
		}
		else if (52 == type) {
			return BeanTemplateUtils.build(AnalyticThreadComplexTriggerBean.class)
					//(resource id no type)
					.with(AnalyticThreadComplexTriggerBean::resource_name_or_id, "/test")
					.done().get();
		}
		else return null;
	}

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

	protected AnalyticThreadTriggerBean getBaseTriggerBean(String schedule, AnalyticThreadComplexTriggerBean complex_trigger) {

		return BeanTemplateUtils.build(AnalyticThreadTriggerBean.class)
				.with(AnalyticThreadTriggerBean::schedule, schedule)
				.with(AnalyticThreadTriggerBean::trigger, complex_trigger)
				.done().get();
	}

	protected AnalyticThreadJobInputConfigBean getBaseInputConfig(String tmin, String tmax) {
		return BeanTemplateUtils.build(AnalyticThreadJobInputConfigBean.class)
				.with(AnalyticThreadJobInputConfigBean::time_min, tmin)
				.with(AnalyticThreadJobInputConfigBean::time_max, tmax)
				.done().get();
	}

	protected AnalyticThreadJobInputBean getBaseInput(AnalyticThreadJobInputConfigBean config) {

		return BeanTemplateUtils.build(AnalyticThreadJobInputBean.class)
				.with(AnalyticThreadJobInputBean::data_service, "stream")
				.with(AnalyticThreadJobInputBean::resource_name_or_id, "stream")
				.with(AnalyticThreadJobInputBean::config, config)
				.done().get();
	}

	protected AnalyticThreadJobOutputBean getBaseOutput(Boolean is_transient, MasterEnrichmentType transient_type, String sub_bucket_patch) {

		return BeanTemplateUtils.build(AnalyticThreadJobOutputBean.class)
				.with(AnalyticThreadJobOutputBean::is_transient, is_transient)
				.with(AnalyticThreadJobOutputBean::transient_type, transient_type)
				.with(AnalyticThreadJobOutputBean::sub_bucket_path, sub_bucket_patch)
				.done().get();
	}

	protected AnalyticThreadJobBean getBaseJob(final String name, AnalyticThreadJobInputBean input, AnalyticThreadJobOutputBean output, AnalyticThreadJobInputConfigBean global_config) {
		return BeanTemplateUtils.build(AnalyticThreadJobBean.class)
				.with(AnalyticThreadJobBean::analytic_technology_name_or_id, "/test")
				.with(AnalyticThreadJobBean::analytic_type, MasterEnrichmentType.streaming)
				.with(AnalyticThreadJobBean::name, name)
				.with(AnalyticThreadJobBean::inputs, input == null ? Collections.emptyList() : Arrays.asList(input))
				.with(AnalyticThreadJobBean::global_input_config, global_config)
				.with(AnalyticThreadJobBean::output, output)
				.done().get();

	}

	protected DataBucketBean getBaseBucket(final String test_name, final AnalyticThreadJobBean job, final AnalyticThreadTriggerBean trigger) {
		return BeanTemplateUtils.build(DataBucketBean.class)
				.with(DataBucketBean::_id, "id1")
				.with(DataBucketBean::full_name, test_name)
				.with(DataBucketBean::display_name, test_name)
				.with(DataBucketBean::created, new Date())
				.with(DataBucketBean::modified, new Date())
				.with(DataBucketBean::analytic_thread,
						BeanTemplateUtils.build(AnalyticThreadBean.class)
						.with(AnalyticThreadBean::jobs, job == null ? Collections.emptyList() : Arrays.asList(job))
						.with(AnalyticThreadBean::trigger_config, trigger)
						.done().get()
						)
						.with(DataBucketBean::owner_id, "owner1")
						.done().get();
	}
}


text:
package "hadoop-namenode" do
  action :install
end

script "Setting Permissions for NameNode format" do
  interpreter "bash"
  user "root"
  code <<-EOH
  mkdir #{node[:hortonworks_hdp][:namenode][:dfs_name_dir_root]}
  chown -R hdfs:hadoop #{node[:hortonworks_hdp][:namenode][:dfs_name_dir_root]}
  EOH
  not_if { ::File.exists?("#{node[:hortonworks_hdp][:namenode][:dfs_name_dir_root]}") }
end

execute "Namenode format" do
	#command "chown -R hdfs  #{node[:hortonworks_hdp][:namenode][:dfs_name_dir_root]}/*"
  command "su - hdfs -c '/usr/lib/hadoop/bin/hadoop namenode -format'"
  #ignore_failure true
  not_if { ::File.exists?("#{node[:hortonworks_hdp][:namenode][:dfs_name_dir_root]}/var/lib/hadoop/cache/hadoop/dfs/name") }
end

service "hadoop-namenode" do
  action [ :enable, :start ]
end

# mkdir #{node[:hortonworks_hdp][:namenode][:dfs_name_dir_root]}
# chown -R hdfs:hadoop /media/ephemeral0/


text:
@interface TBMoneySelectViewController : TBBaseViewController

@property (weak, nonatomic) IBOutlet UITableView *tableview;
@end


text:
#ifndef CQChartsPenData_H
#define CQChartsPenData_H

#include <CQChartsAlpha.h>
#include <CQChartsLength.h>
#include <CQChartsLineDash.h>

/*!
 * \brief Pen Data
 *
 * visible, color, alpha, width, dash
 */
class CQChartsPenData {
 public:
  using Alpha    = CQChartsAlpha;
  using Length   = CQChartsLength;
  using LineDash = CQChartsLineDash;
  using LineCap  = CQChartsLineCap;
  using LineJoin = CQChartsLineJoin;

 public:
  CQChartsPenData() = default;

  explicit CQChartsPenData(bool visible, const QColor &color=QColor(), const Alpha &alpha=Alpha(),
                           const Length &width=Length(), const LineDash &dash=LineDash(),
                           const LineCap &lineCap=LineCap(), const LineJoin &lineJoin=LineJoin()) :
   visible_(visible), color_(color), alpha_(alpha), width_(width), dash_(dash),
   lineCap_(lineCap), lineJoin_(lineJoin) {
  }

  CQChartsPenData(bool visible, const QColor &color, const CQChartsStrokeData &strokeData) :
   visible_(visible), color_(color), alpha_(strokeData.alpha()), width_(strokeData.width()),
   dash_(strokeData.dash()), lineCap_(strokeData.lineCap()), lineJoin_(strokeData.lineJoin()) {
  }

  //---

  //! get/set visible
  bool isVisible() const { return visible_; }
  void setVisible(bool b) { visible_ = b; }

  //! get/set color
  const QColor &color() const { return color_; }
  void setColor(const QColor &v) { color_ = v; }

  //! get/set alpha
  const Alpha &alpha() const { return alpha_; }
  void setAlpha(const Alpha &a) { alpha_ = a; }

  //! get/set width
  const Length &width() const { return width_; }
  void setWidth(const Length &v) { width_ = v; }

  //! get/set line dash
  const LineDash &dash() const { return dash_; }
  void setDash(const LineDash &v) { dash_ = v; }

  //! get/set line cap
  const LineCap &lineCap() const { return lineCap_; }
  void setLineCap(const LineCap &c) { lineCap_ = c; }

  //! get/set line join
  const LineJoin &lineJoin() const { return lineJoin_; }
  void setLineJoin(const LineJoin &j) { lineJoin_ = j; }

 private:
  bool     visible_  { true };             //!< visible
  QColor   color_;                         //!< pen color
  Alpha    alpha_;                         //!< pen alpha
  Length   width_    { Length::pixel(0) }; //!< pen width
  LineDash dash_;                          //!< pen line dash
  LineCap  lineCap_;                       //!< pen line cap
  LineJoin lineJoin_;                      //!< pen line join
};

#endif


text:
<?php

class Google_Service_TagManager_RevertTagResponse extends Google_Model
{
  protected $tagType = 'Google_Service_TagManager_Tag';
  protected $tagDataType = '';

  public function setTag(Google_Service_TagManager_Tag $tag)
  {
    $this->tag = $tag;
  }
  public function getTag()
  {
    return $this->tag;
  }
}


text:
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType;
import org.jetbrains.plugins.groovy.lang.psi.impl.signatures.GrClosureSignatureUtil;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrCallExpressionTypeCalculator;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;

import java.util.Set;

import static org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil.isCompileStatic;

/**
 * @author sergey.evdokimov
 */
public class DefaultCallExpressionTypeCalculator extends GrCallExpressionTypeCalculator {
  private static final Logger LOG = Logger.getInstance(DefaultCallExpressionTypeCalculator.class);

  @Override
  public PsiType calculateReturnType(@NotNull GrMethodCall callExpression, GroovyResolveResult[] resolveResults) {
    GrExpression invoked = callExpression.getInvokedExpression();
    if (invoked instanceof GrReferenceExpression) {
      GrReferenceExpression refExpr = (GrReferenceExpression) invoked;
      PsiManager manager = callExpression.getManager();
      PsiType result = null;
      for (GroovyResolveResult resolveResult : resolveResults) {
        PsiType returnType = calculateReturnTypeInner(callExpression, refExpr, resolveResult);
        if (returnType == null) return null;

        PsiType nonVoid = PsiType.VOID.equals(returnType) && !isCompileStatic(callExpression) ? PsiType.NULL : returnType;

        PsiType normalized;
        if (nonVoid instanceof GrLiteralClassType) {
          normalized = nonVoid;
        }
        else {
          boolean needsSubstitutor = hasGenerics(nonVoid);
          PsiSubstitutor substitutor = needsSubstitutor ? resolveResult.getSubstitutor() : PsiSubstitutor.EMPTY;
          normalized = TypesUtil.substituteAndNormalizeType(nonVoid, substitutor, resolveResult.getSpreadState(), callExpression);
          LOG.assertTrue(normalized != null, "return type: " + returnType + "; substitutor: " + substitutor);
        }

        if (result == null || normalized.isAssignableFrom(result)) {
          result = normalized;
        }
        else if (!result.isAssignableFrom(normalized)) {
          result = TypesUtil.getLeastUpperBound(result, normalized, manager);
        }
      }

      return result;
    }
    else {
      return extractReturnTypeFromType(invoked.getType(), false, callExpression);
    }
  }

  @Nullable
  private static PsiType calculateReturnTypeInner(GrMethodCall callExpression,
                                                  GrReferenceExpression refExpr,
                                                  GroovyResolveResult resolveResult) {
    PsiElement resolved = resolveResult.getElement();
    if (resolved instanceof PsiMethod) {
      PsiMethod method = (PsiMethod)resolved;
      if (resolveResult.isInvokedOnProperty()) {
        final PsiType propertyType = PsiUtil.getSmartReturnType(method);
        return extractReturnTypeFromType(propertyType, true, callExpression);
      }
      else {
        PsiType closureReturnType = getClosureMethodsReturnType(callExpression, refExpr, method);
        if (closureReturnType != null) {
          return closureReturnType;
        }
        else {
          final PsiType smartReturnType = PsiUtil.getSmartReturnType(method);
          return smartReturnType;
        }
      }
    }
    else if (resolved instanceof GrVariable) {
      PsiType refType = refExpr.getType();
      refType = TypesUtil.boxPrimitiveType(refType, callExpression.getManager(), callExpression.getResolveScope());
      final PsiType type = refType == null ? ((GrVariable)resolved).getTypeGroovy() : refType;
      return extractReturnTypeFromType(type, false, callExpression);
    }
    return null;
  }

  @Nullable
  private static PsiType extractReturnTypeFromType(PsiType type, boolean returnTypeIfFail, GrMethodCall callExpression) {
    PsiType returnType = returnTypeIfFail ? type: null;
    if (type instanceof GrClosureType) {
      returnType = GrClosureSignatureUtil.getReturnType(((GrClosureType)type).getSignatures(), callExpression);
    }
    else if (TypesUtil.isPsiClassTypeToClosure(type)) {
      assert type instanceof PsiClassType;
      final PsiType[] parameters = ((PsiClassType)type).getParameters();
      if (parameters.length == 1) {
        returnType = parameters[0];
      }
    }
    else if (type instanceof PsiClassType) {
      final GrExpression invoked = callExpression.getInvokedExpression();
      final GroovyResolveResult[] calls = ResolveUtil
        .getMethodCandidates(type, "call", invoked != null ? invoked : callExpression, PsiUtil.getArgumentTypes(invoked, false));
      returnType = null;
      final PsiManager manager = callExpression.getManager();
      for (GroovyResolveResult call : calls) {
        final PsiType substituted = ResolveUtil.extractReturnTypeFromCandidate(call, callExpression, PsiUtil.getArgumentTypes(invoked, true));
        returnType = TypesUtil.getLeastUpperBoundNullable(returnType, substituted, manager);
      }
    }
    return returnType;
  }

  private static final Set<String> CLOSURE_METHODS = new HashSet<>();
  static {
    CLOSURE_METHODS.add("call");
    CLOSURE_METHODS.add("curry");
    CLOSURE_METHODS.add("ncurry");
    CLOSURE_METHODS.add("rcurry");
    CLOSURE_METHODS.add("memoize");
    CLOSURE_METHODS.add("trampoline");
  }
  @Nullable
  private static PsiType getClosureMethodsReturnType(GrMethodCall callExpression, GrReferenceExpression refExpr, PsiMethod resolved) {
    PsiClass clazz = resolved.getContainingClass();
    if (clazz == null || !GroovyCommonClassNames.GROOVY_LANG_CLOSURE.equals(clazz.getQualifiedName())) return null;

    if (!CLOSURE_METHODS.contains(resolved.getName())) return null;

    GrExpression qualifier = refExpr.getQualifierExpression();
    if (qualifier == null) return null;

    PsiType qType = qualifier.getType();
    if (!(qType instanceof GrClosureType)) return null;

    if ("call".equals(resolved.getName())) {
      return GrClosureSignatureUtil.getReturnType(((GrClosureType)qType).getSignatures(), callExpression);
    }
    else if ("curry".equals(resolved.getName()) || "trampoline".equals(resolved.getName())) {
      return ((GrClosureType)qType).curry(PsiUtil.getArgumentTypes(refExpr, false), 0, callExpression);
    }
    else if ("memoize".equals(resolved.getName())) {
      return qType;
    }
    else if ("rcurry".equals(resolved.getName())) {
      return ((GrClosureType)qType).curry(PsiUtil.getArgumentTypes(refExpr, false), -1, callExpression);
    }
    else if ("ncurry".equals(resolved.getName())) {
      final GrArgumentList argList = callExpression.getArgumentList();
      final GrExpression[] arguments = argList.getExpressionArguments();
      if (arguments.length > 0) {
        final GrExpression first = arguments[0];
        if (first instanceof GrLiteral) {
          final Object value = ((GrLiteral)first).getValue();
          if (value instanceof Integer) {
            final PsiType[] argTypes = PsiUtil.getArgumentTypes(refExpr, false);
            if (argTypes != null) {
              return ((GrClosureType)qType).curry(ArrayUtil.remove(argTypes, 0), (Integer)value, callExpression);
            }
          }
        }
      }
      return qType;
    }
    return null;
  }

  private static boolean hasGenerics(@NotNull PsiType type) {
    if (!Registry.is("groovy.return.type.optimization")) {
      // optimization is disabled, fall back to old behaviour
      return true;
    }
    return type.accept(new PsiTypeVisitor<Boolean>() {

      @Nullable
      @Override
      public Boolean visitClassType(PsiClassType classType) {
        if (classType.resolve() instanceof PsiTypeParameter) {
          return true;
        }
        if (!classType.hasParameters()) return null;
        for (PsiType parameter : classType.getParameters()) {
          if (parameter.accept(this) == Boolean.TRUE) return true;
        }
        return null;
      }

      @Nullable
      @Override
      public Boolean visitArrayType(PsiArrayType arrayType) {
        return arrayType.getComponentType().accept(this);
      }

      @Nullable
      @Override
      public Boolean visitWildcardType(PsiWildcardType wildcardType) {
        final PsiType bound = wildcardType.getBound();
        return bound == null ? null : bound.accept(this);
      }
    }) == Boolean.TRUE;
  }
}


text:
package com.grum.geocalc;

import static java.lang.Math.*;

/**
 * Earth related calculations.
 *
 * @author rgallet
 */
public class EarthCalc {

    public static final double EARTH_DIAMETER = 6371.01 * 1000; //meters

    /**
     * Returns the distance between two points using spherical law of cosines.
     *
     * @param standPoint The stand point
     * @param forePoint  The fore point
     * @return The distance, in meters
     */
    public static double getDistance(Point standPoint, Point forePoint) {

        double diffLongitudes = toRadians(abs(forePoint.longitude - standPoint.longitude));
        double slat = toRadians(standPoint.latitude);
        double flat = toRadians(forePoint.latitude);

        //spherical law of cosines
        double c = acos((sin(slat) * sin(flat)) + (cos(slat) * cos(flat) * cos(diffLongitudes)));

        return EARTH_DIAMETER * c;
    }

    /**
     * Returns the distance between two points using Harvesine formula.
     *
     * @param standPoint The stand point
     * @param forePoint  The fore point
     * @return The distance, in meters
     */
    public static double getHarvesineDistance(Point standPoint, Point forePoint) {

        double diffLongitudes = toRadians(abs(forePoint.longitude - standPoint.longitude));
        double slat = toRadians(standPoint.latitude);
        double flat = toRadians(forePoint.latitude);

        // haversine formula
        double diffLatitudes = toRadians(abs(forePoint.latitude - standPoint.latitude));
        double a = sin(diffLatitudes / 2) * sin(diffLatitudes / 2) + cos(slat) * cos(flat) * sin(diffLongitudes / 2) * sin(diffLongitudes / 2);
        double c = 2 * atan2(sqrt(a), sqrt(1 - a)); //angular distance in radians

        return EARTH_DIAMETER * c;
    }

    /**
     * Calculate distance, (azimuth) bearing and final bearing between standPoint and forePoint.
     *
     * @param standPoint The stand point
     * @param forePoint  The fore point
     * @return Vincenty object which holds all 3 values
     */
    private static Vincenty getVincenty(Point standPoint, Point forePoint) {
        double λ1 = toRadians(standPoint.longitude);
        double λ2 = toRadians(forePoint.longitude);

        double φ1 = toRadians(standPoint.latitude);
        double φ2 = toRadians(forePoint.latitude);

        double a = 6_378_137;
        double b = 6_356_752.314245;
        double f = 1 / 298.257223563;

        double L = λ2 - λ1;
        double tanU1 = (1 - f) * tan(φ1), cosU1 = 1 / sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1;
        double tanU2 = (1 - f) * tan(φ2), cosU2 = 1 / sqrt((1 + tanU2 * tanU2)), sinU2 = tanU2 * cosU2;

        double λ = L, λʹ, iterationLimit = 100, cosSqα, σ, cos2σM, cosσ, sinσ, sinλ, cosλ;
        do {
            sinλ = sin(λ);
            cosλ = cos(λ);
            double sinSqσ = (cosU2 * sinλ) * (cosU2 * sinλ) + (cosU1 * sinU2 - sinU1 * cosU2 * cosλ) * (cosU1 * sinU2 - sinU1 * cosU2 * cosλ);
            sinσ = sqrt(sinSqσ);
            if (sinσ == 0) return new Vincenty(0, 0, 0);  // co-incident points
            cosσ = sinU1 * sinU2 + cosU1 * cosU2 * cosλ;
            σ = atan2(sinσ, cosσ);
            double sinα = cosU1 * cosU2 * sinλ / sinσ;
            cosSqα = 1 - sinα * sinα;
            cos2σM = cosσ - 2 * sinU1 * sinU2 / cosSqα;

            if (Double.isNaN(cos2σM)) cos2σM = 0;  // equatorial line: cosSqα=0 (§6)
            double C = f / 16 * cosSqα * (4 + f * (4 - 3 * cosSqα));
            λʹ = λ;
            λ = L + (1 - C) * f * sinα * (σ + C * sinσ * (cos2σM + C * cosσ * (-1 + 2 * cos2σM * cos2σM)));
        } while (abs(λ - λʹ) > 1e-12 && --iterationLimit > 0);

        if (iterationLimit == 0) throw new IllegalStateException("Formula failed to converge");

        double uSq = cosSqα * (a * a - b * b) / (b * b);
        double A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
        double B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
        double Δσ = B * sinσ * (cos2σM + B / 4 * (cosσ * (-1 + 2 * cos2σM * cos2σM) -
                B / 6 * cos2σM * (-3 + 4 * sinσ * sinσ) * (-3 + 4 * cos2σM * cos2σM)));

        double distance = b * A * (σ - Δσ);

        double initialBearing = atan2(cosU2 * sinλ, cosU1 * sinU2 - sinU1 * cosU2 * cosλ);
        initialBearing = (initialBearing + 2 * PI) % (2 * PI); //turning value to trigonometric direction

        double finalBearing = atan2(cosU1 * sinλ, -sinU1 * cosU2 + cosU1 * sinU2 * cosλ);
        finalBearing = (finalBearing + 2 * PI) % (2 * PI);  //turning value to trigonometric direction

        return new Vincenty(distance, toDegrees(initialBearing), toDegrees(finalBearing));

    }

    public static double getVincentyDistance(Point standPoint, Point forePoint) {
        return getVincenty(standPoint, forePoint).distance;
    }

    /**
     * Returns (azimuth) bearing using Vincenty formula.
     *
     * @param standPoint The stand point
     * @param forePoint  The fore point
     * @return (azimuth) bearing in degrees to the North
     *
     * @link http://www.movable-type.co.uk/scripts/latlong.html
     */
    public static double getVincentyBearing(Point standPoint, Point forePoint) {
        return getVincenty(standPoint, forePoint).initialBearing;
    }

    /**
     * Returns final bearing in direction of standPoint→forePoint using Vincenty formula.
     *
     * @param standPoint The stand point
     * @param forePoint  The fore point
     * @return (azimuth) bearing in degrees to the North
     *
     * @link http://www.movable-type.co.uk/scripts/latlong.html
     */
    public static double getVincentyFinalBearing(Point standPoint, Point forePoint) {
        return getVincenty(standPoint, forePoint).finalBearing;
    }

    /**
     * Returns the coordinates of a point which is "distance" away
     * from standPoint in the direction of "bearing"
     * <p>
     * Note: North is equal to 0 for bearing value
     *
     * @param standPoint Origin
     * @param bearing    Direction in degrees
     * @param distance   distance in meters
     * @return forePoint coordinates
     *
     * @link http://www.movable-type.co.uk/scripts/latlong.html
     */
    public static Point pointRadialDistance(Point standPoint, double bearing, double distance) {
        /**
         var φ2 = asin( sin(φ1)*cos(d/R) + cos(φ1)*sin(d/R)*cos(brng) );
         var λ2 = λ1 + atan2(sin(brng)*sin(d/R)*cos(φ1), cos(d/R)-sin(φ1)*sin(φ2));
         */

        double rlat1 = toRadians(standPoint.latitude);
        double rlon1 = toRadians(standPoint.longitude);
        double rbearing = toRadians(bearing);
        double rdistance = distance / EARTH_DIAMETER; // normalize linear distance to radian angle

        double lat2 = asin(sin(rlat1) * cos(rdistance) + cos(rlat1) * sin(rdistance) * cos(rbearing));
        double lon2 = rlon1 + atan2(sin(rbearing) * sin(rdistance) * cos(rlat1), cos(rdistance) - sin(rlat1) * sin(lat2));

        return new Point(new RadianCoordinate(lat2), new RadianCoordinate(lon2));
    }

    /**
     * Returns the (azimuth) bearing, in decimal degrees, from standPoint to forePoint
     *
     * @param standPoint Origin point
     * @param forePoint  Destination point
     * @return (azimuth) bearing, in decimal degrees
     */
    public static double getBearing(Point standPoint, Point forePoint) {
        /**
         * Formula: θ = atan2( 	sin(Δlong).cos(lat2), cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong) )
         */

        double y = sin(toRadians(forePoint.longitude - standPoint.longitude)) * cos(toRadians(forePoint.latitude));
        double x = cos(toRadians(standPoint.latitude)) * sin(toRadians(forePoint.latitude))
                - sin(toRadians(standPoint.latitude)) * cos(toRadians(forePoint.latitude)) * cos(toRadians(forePoint.longitude - standPoint.longitude));

        double bearing = (atan2(y, x) + 2 * PI) % (2 * PI);

        return toDegrees(bearing);
    }

    /**
     * Returns an area around standPoint
     *
     * @param standPoint The centre of the area
     * @param distance   Distance around standPoint, im meters
     * @return The area
     *
     * @link http://www.movable-type.co.uk/scripts/latlong.html
     */
    public static BoundingArea getBoundingArea(Point standPoint, double distance) {

        //45 degrees going north-west
        Point northWest = pointRadialDistance(standPoint, 45, distance);

        //225 degrees going south-east
        Point southEast = pointRadialDistance(standPoint, 225, distance);

        return new BoundingArea(northWest, southEast);
    }

    private static class Vincenty {
        /**
         * distance is the distance in meter
         * initialBearing is the initial bearing, or forward azimuth (in reference to North point), in degrees
         * finalBearing is the final bearing (in direction p1→p2), in degrees
         */
        double distance, initialBearing, finalBearing;

        public Vincenty(double distance, double initialBearing, double finalBearing) {
            this.distance = distance;
            this.initialBearing = initialBearing;
            this.finalBearing = finalBearing;
        }
    }
}


text:
package org.fusesource.fabric.bridge.internal;

import org.apache.activemq.pool.PooledConnectionFactory;
import org.fusesource.fabric.bridge.model.BridgeDestinationsConfig;
import org.fusesource.fabric.bridge.model.BridgedDestination;
import org.fusesource.fabric.bridge.model.BrokerConfig;
import org.fusesource.fabric.bridge.model.DispatchPolicy;
import org.springframework.beans.BeanUtils;
import org.springframework.jms.JmsException;
import org.springframework.jms.UncategorizedJmsException;
import org.springframework.jms.listener.AbstractMessageListenerContainer;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.jms.support.destination.DestinationResolver;

import javax.jms.*;
import java.beans.PropertyDescriptor;
import java.lang.IllegalStateException;
import java.util.*;
import java.util.Map.Entry;

/**
 * Connects destinations on local broker to a staging queue on remote broker.
 *
 * @author Dhiraj Bokde
 *
 */
public class SourceConnector extends AbstractConnector {

	private BrokerConfig localBrokerConfig;

	private BrokerConfig remoteBrokerConfig;

	private BridgeDestinationsConfig outboundDestinations;

	private boolean reuseSession;

	private boolean reuseMessage;

	private Destination stagingQueue;

	private ConnectionFactory localConnectionFactory;

	private ConnectionFactory remoteConnectionFactory;

	private Map<BridgedDestination, AbstractMessageListenerContainer> listenerMap = new HashMap<BridgedDestination, AbstractMessageListenerContainer>();

	@Override
	public void afterPropertiesSet() throws Exception {

		if (outboundDestinations == null || localBrokerConfig == null) {
			throw new IllegalArgumentException("Both outboundDestinations and localBrokerConfig properties must be set");
		}
        if (remoteBrokerConfig == null && !outboundDestinations.isUseStagingQueue()) {
            throw new IllegalArgumentException("Property remoteBrokerConfig is missing but property useStagingQueue is false");
        }
        if (remoteBrokerConfig == null && outboundDestinations.isDefaultStagingLocation()) {
            throw new IllegalArgumentException("Property remoteBrokerConfig is missing but property defaultStagingLocation is true");
        }
		if (remoteBrokerConfig != null && !outboundDestinations.isDefaultStagingLocation()) {
			throw new IllegalArgumentException("Property remoteBrokerConfig is set but property defaultStagingLocation is false");
		}
		if ((localBrokerConfig.getBrokerUrl() == null && localBrokerConfig.getConnectionFactory() == null) ||
				(localBrokerConfig.getBrokerUrl() != null && localBrokerConfig.getConnectionFactory() != null)) {
			throw new IllegalArgumentException("Either a local broker url or connection factory must be provided");
		}
		if (remoteBrokerConfig != null) {
			if ((remoteBrokerConfig.getBrokerUrl() == null && remoteBrokerConfig.getConnectionFactory() == null) ||
					(remoteBrokerConfig.getBrokerUrl() != null && remoteBrokerConfig.getConnectionFactory() != null)) {
				throw new IllegalArgumentException("Either a remote broker url or connection factory must be provided");
			}
		}
	}

	protected void doInitialize() {

		// get local and remote connection factories
		localConnectionFactory = getConnectionFactory(localBrokerConfig);
		LOG.debug("Using local connection factory " + localConnectionFactory);

		if (remoteBrokerConfig != null && outboundDestinations.isDefaultStagingLocation()) {
			remoteConnectionFactory = getConnectionFactory(remoteBrokerConfig);
			LOG.debug("Using remote connection factory " + remoteConnectionFactory);
			reuseSession = false;
		} else {
			// Note that this is sub-optimal, as consumer connections from
			// remote broker to local broker can't be 'occasionally connected'
			// like producer connections from local to remote broker that are
			// only used when messages are being sent.
			// Set the defaultStagingLocation to false if it hasn't been set
			// already since the staging queue will be created locally
			LOG.warn("Using local broker for staging queue");
			outboundDestinations.setDefaultStagingLocation(false);
			remoteConnectionFactory = localConnectionFactory;
			reuseSession = true;
		}

		reuseMessage = false;
        Connection localConnection = null;
        Connection remoteConnection = null;
        try {

			// check if messages need to be copied for different JMS providers
			localConnection = localConnectionFactory.createConnection();
			Session localSession = localConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
			Message localMessage = localSession.createMessage();

			remoteConnection = remoteConnectionFactory.createConnection();
			Session remoteSession = remoteConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
			Message remoteMessage = remoteSession.createMessage();

			if (localMessage.getClass().isInstance(remoteMessage)) {
				reuseMessage  = true;
			}

			// also get the stagingQueue from remoteSession
			stagingQueue = getStagingQueue(remoteSession);

		} catch (JMSException e) {
			String msg = "Error checking whether local and remote broker providers are the same: " + e.getMessage();
			LOG.error(msg, e);
			throw new IllegalStateException(msg, e);
		} finally {
            if (localConnection != null) {
                try {
                    localConnection.close();
                } catch (JMSException e) {}
            }
            if (remoteConnection != null) {
                try {
                    remoteConnection.close();
                } catch (JMSException e) {}
            }
        }

		for (BridgedDestination destination : outboundDestinations.getDestinations()) {
			try {
				listenerMap.put(destination, createListenerContainer(destination));
			} catch (Exception e) {
				final String msg = "Error creating listener for destination: " + destination;
				LOG.error(msg, e);
				throw new IllegalStateException(msg, e);
			}
		}

		LOG.info("Initialized");
	}

	private Destination getStagingQueue(Session remoteSession) throws JMSException {
        // check if a staging queue is required
        if (!outboundDestinations.isUseStagingQueue()) {
            return null;
        }

		DestinationResolver destinationResolver = null;
		if (remoteBrokerConfig != null) {
			destinationResolver  = remoteBrokerConfig.getDestinationResolver();
		} else {
			destinationResolver = localBrokerConfig.getDestinationResolver();
		}
		return destinationResolver.resolveDestinationName(remoteSession, outboundDestinations.getStagingQueueName(), false);
	}

	protected void doStart() {

		JmsException failedException = null;
		// start all the listener containers
		for (Entry<BridgedDestination, AbstractMessageListenerContainer> entry : listenerMap.entrySet()) {
			final BridgedDestination destination = entry.getKey();
			final AbstractMessageListenerContainer listener = entry.getValue();

			if (!listener.isRunning()) {
				try {
					if (LOG.isDebugEnabled()) {
						LOG.debug("Starting listener for " + destination);
					}
					listener.start();

					if (LOG.isDebugEnabled()) {
						LOG.debug("Listener started for " + destination);
					}
				} catch (JmsException e) {
					failedException = e;
					LOG.error("Error stopping connector for listener " + listener + ": " + e.getMessage(), e);
					break;
				}
			}
		}

		if (failedException != null) {
			// stop all listeners
			stop();
			throw failedException;
		}

		LOG.info("Started");
	}

	protected void doStop() {

		// stop all listener containers
		for (Entry<BridgedDestination, AbstractMessageListenerContainer> entry : listenerMap.entrySet()) {

			final BridgedDestination destination = entry.getKey();
			final AbstractMessageListenerContainer listener = entry.getValue();

			if (listener.isRunning()) {
				try {
					if (LOG.isDebugEnabled()) {
						LOG.debug("Stopping listener for " + destination);
					}
					listener.stop();
					if (LOG.isDebugEnabled()) {
						LOG.debug("Listener stopped for " + destination);
					}

				} catch (JmsException e) {
					LOG.error("Error stopping connector for listener " + listener + ": " + e.getMessage(), e);
				}
			}
		}

		LOG.info("Stopped");
	}

	protected void doDestroy() {

		// destroy all listener containers
		for (Entry<BridgedDestination, AbstractMessageListenerContainer> entry : listenerMap.entrySet()) {

			final BridgedDestination destination = entry.getKey();
			final AbstractMessageListenerContainer listener = entry.getValue();

			if (listener.isActive()) {
				try {

					if (LOG.isDebugEnabled()) {
						LOG.debug("Destroying listener for " + destination);
					}
					listener.destroy();
					if (LOG.isDebugEnabled()) {
						LOG.debug("Listener destroyed for " + destination);
					}

				} catch (JmsException e) {
					LOG.error("Error destroying listener for destination "
							+ destination.getName() + " : " + e.getMessage(), e);
				}
			}
		}

		listenerMap.clear();

		// check if we created pooled connection factories
		if (localBrokerConfig.getConnectionFactory() == null && localConnectionFactory != null) {
			((PooledConnectionFactory)localConnectionFactory).stop();
		}
        if (remoteBrokerConfig != null && remoteBrokerConfig.getConnectionFactory() == null
            && remoteConnectionFactory != null) {
			((PooledConnectionFactory)remoteConnectionFactory).stop();
		}

		LOG.info("Destroyed");
	}

	protected AbstractMessageListenerContainer createListenerContainer(BridgedDestination destination) {
		// create listener container using localConnectionFactory
		// and DeliveryHandler using remoteConnectionFactory
		DispatchPolicy resolvedPolicy = getResolvedPolicy(destination.getDispatchPolicy(), outboundDestinations.getDispatchPolicy());
		if (LOG.isDebugEnabled()) {
			LOG.debug("Resolved policy for destination " + destination + " is : " + resolvedPolicy);
		}

		// both batch size and timeout are required to enable batch listener
		// set them both to <= zero to use the Spring default listener
		DefaultMessageListenerContainer listenerContainer;
		AbstractDeliveryHandler deliveryHandler = createDeliveryHandler(
				resolvedPolicy,
				(destination.getTargetName() != null) ? destination.getTargetName() : destination.getName(),
				destination.isPubSubDomain());

		if (resolvedPolicy.getBatchSize() <= 0 || resolvedPolicy.getBatchTimeout() <= 0) {

			if (LOG.isDebugEnabled()) {
				LOG.debug("Creating default message listener container for " + destination.getName());
			}

			listenerContainer = new DefaultMessageListenerContainer();
			configureListenerContainer(listenerContainer, resolvedPolicy, true, localBrokerConfig.getDestinationResolver());
			listenerContainer.setMessageListener(deliveryHandler);

		} else {

			if (LOG.isDebugEnabled()) {
				LOG.debug("Creating batch message listener container for " + destination.getName());
			}

			listenerContainer = new BatchMessageListenerContainer();
			configureListenerContainer((BatchMessageListenerContainer)listenerContainer, resolvedPolicy, true, localBrokerConfig.getDestinationResolver());
			((BatchMessageListenerContainer) listenerContainer).setBatchMessageListener(deliveryHandler);

		}

		listenerContainer.setConnectionFactory(localConnectionFactory);
		listenerContainer.setDestinationName(destination.getName());
		listenerContainer.setPubSubDomain(destination.isPubSubDomain());
		listenerContainer.setClientId(localBrokerConfig.getClientId());
		listenerContainer.setDurableSubscriptionName(destination.getDurableSubscriptionName());
		listenerContainer.setSubscriptionDurable(destination.isSubscriptionDurable());

		// initialize the listener
		listenerContainer.afterPropertiesSet();

		return listenerContainer;
	}

	protected DispatchPolicy getResolvedPolicy(DispatchPolicy dispatchPolicy,
			DispatchPolicy defaultDispatchPolicy) {

		if (dispatchPolicy == null) {
			return defaultDispatchPolicy;
		}

		DispatchPolicy resolvedPolicy = new DispatchPolicy();
		BeanUtils.copyProperties(defaultDispatchPolicy, resolvedPolicy);

		Set<String> propertiesSet = dispatchPolicy.getPropertiesSet();
		PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(DispatchPolicy.class);
		Set<String> ignoreProperties = new HashSet<String>();

		for (PropertyDescriptor property : propertyDescriptors) {
			if (!propertiesSet.contains(property.getName())) {
				ignoreProperties.add(property.getName());
			}
		}

		BeanUtils.copyProperties(dispatchPolicy, resolvedPolicy,
				ignoreProperties.toArray(new String[ignoreProperties.size()]));

		return resolvedPolicy;
	}

    protected AbstractDeliveryHandler createDeliveryHandler(DispatchPolicy resolvedPolicy, String destinationName, boolean pubSubDomain) {
        // create delivery handler for staging queue using remoteConnectionFactory
		// delivery is always done in the same thread as the receiving destination
		SourceDeliveryHandler deliveryHandler = new SourceDeliveryHandler();

		deliveryHandler.setDispatchPolicy(resolvedPolicy);
		deliveryHandler.setDestinationNameHeader(outboundDestinations.getDestinationNameHeader());
		deliveryHandler.setDestinationTypeHeader(outboundDestinations.getDestinationTypeHeader());
		deliveryHandler.setDestinationName(destinationName);
		deliveryHandler.setPubSubDomain(pubSubDomain);
		deliveryHandler.setReuseSession(reuseSession);
		deliveryHandler.setReuseMessage(reuseMessage);
		deliveryHandler.setTargetConnectionFactory(remoteConnectionFactory);

        // check if a staging queue is used or not
        if (stagingQueue != null) {
		    deliveryHandler.setStagingDestination(stagingQueue);
        } else {
            // creating a connection for every remote destination resolve seems inefficient,
            // but we cannot make that stateful, also pooling makes it a moot point
            Connection remoteConnection = null;
            try {
                remoteConnection = remoteConnectionFactory.createConnection();
                Session remoteSession = remoteConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                deliveryHandler.setStagingDestination(
                    remoteBrokerConfig.getDestinationResolver().resolveDestinationName(
                        remoteSession, destinationName, pubSubDomain));
            } catch (JMSException e) {
                String msg = "Error resolving remote destination " + destinationName + " : " + e.getMessage();
                LOG.error(msg, e);
                throw new IllegalStateException(msg, e);
            } finally {
                try {
                    remoteConnection.close();
                } catch (JMSException e) {}
            }
        }
		return deliveryHandler;
	}

	@Override
	public BridgeDestinationsConfig getDestinationsConfig() {
		synchronized (lifecycleMonitor) {
			return outboundDestinations;
		}
	}

	@Override
	public void setDestinationsConfig(BridgeDestinationsConfig destinationsConfig) {
		synchronized (lifecycleMonitor) {

			if (destinationsConfig == null || destinationsConfig.getDestinations() == null) {
				throw new UncategorizedJmsException("Invalid destinations config");
			}

			// remember current state
			boolean wasRunning = isRunning();

			// destroy and recreate the connector
			try {
				destroy();
			} catch (Exception e) {
				LOG.error("Error destorying connector: " + e.getMessage(), e);
				// ignore and keep going??
			}

			this.outboundDestinations = destinationsConfig;

			try {
				afterPropertiesSet();
			} catch (Exception e) {
				throw new UncategorizedJmsException(e.getMessage(), e);
			}

			if (wasRunning) {
				start();
			}
		}
	}

	@Override
	public void addDestinations(List<BridgedDestination> destinations) {
		synchronized (lifecycleMonitor) {
			final Set<String> outboundDestinationNames = getOutboundDestinationNames();

			// remove any duplicate destinations
			final List<BridgedDestination> newDestinations = new ArrayList<BridgedDestination>();
			for (BridgedDestination destination : destinations) {
				if (!outboundDestinationNames.contains(destination.getName())) {
					newDestinations.add(destination);
				} else {
					LOG.warn("Ignoring destination " + destination.getName() + " as it already exists as an outbound destination");
				}
			}

			// process new destinations depending upon current state
			if (!isInitialized()) {
				// just add destinations to current config
				outboundDestinations.getDestinations().addAll(newDestinations);
			} else {
				// create listeners for new destinations
				Map<BridgedDestination, AbstractMessageListenerContainer> newListenerMap = new HashMap<BridgedDestination, AbstractMessageListenerContainer>();
				for (BridgedDestination destination : newDestinations) {
					try {
						newListenerMap.put(destination, createListenerContainer(destination));
					} catch (Exception e) {
						final String msg = "Error creating listener for new destination: " + destination;
						LOG.error(msg, e);

						// destroy any listeners created so far
						for (Entry<BridgedDestination, AbstractMessageListenerContainer> entry : newListenerMap.entrySet()) {
							try {
								entry.getValue().destroy();
							} catch (Exception ex) {
								LOG.warn("Error destorying listener for " + entry.getKey(), ex);
							}
						}

						newListenerMap.clear();
						newDestinations.clear();
						throw new IllegalStateException(msg, e);
					}
				}

				// add destinations to current config
				outboundDestinations.getDestinations().addAll(newDestinations);

				// add listeners to current config
				listenerMap.putAll(newListenerMap);

				// do we need to start the new listeners??
				if (isRunning()) {
					start();
				}
			}
		}
	}

	@Override
	public void removeDestinations(List<BridgedDestination> destinations) {
		synchronized (lifecycleMonitor) {

			Set<String> outboundDestinationNames = getOutboundDestinationNames();

			// remove any missing destinations
			final List<BridgedDestination> currentDestinations = new ArrayList<BridgedDestination>();
			for (BridgedDestination destination : destinations) {
				if (outboundDestinationNames.contains(destination.getName())) {
					currentDestinations.add(destination);
				} else {
					LOG.warn("Ignoring destination " + destination + " as it does not exist as an outbound destination");
				}
			}

			// process current destinations depending upon current state
			if (!isInitialized()) {
				// just remove destinations from current config
				outboundDestinations.getDestinations().removeAll(currentDestinations);
			} else {
				// destroy listeners for current destinations
				for (BridgedDestination destination : currentDestinations) {
					try {
						// remove listener from current config
						AbstractMessageListenerContainer listener = listenerMap.remove(destination);

						// this will also stop the listener before destroying it
						listener.destroy();

					} catch (Exception e) {
						final String msg = "Error destroying listener for destination: " + destination;
						LOG.warn(msg, e);
						// ignore and keep processing the rest??
					}
				}

				// remove destinations from current config
				outboundDestinations.getDestinations().removeAll(currentDestinations);
			}
		}
	}

	private Set<String> getOutboundDestinationNames() {
		final Set<String> outboundDestinationNames = new HashSet<String>();
		for (BridgedDestination dest : outboundDestinations.getDestinations()) {
			outboundDestinationNames.add(dest.getName());
		}
		return outboundDestinationNames;
	}

	public BrokerConfig getLocalBrokerConfig() {
		return localBrokerConfig;
	}

	public void setLocalBrokerConfig(BrokerConfig localBrokerConfig) {
		this.localBrokerConfig = localBrokerConfig;
	}

	public BrokerConfig getRemoteBrokerConfig() {
		return remoteBrokerConfig;
	}

	public void setRemoteBrokerConfig(BrokerConfig remoteBrokerConfig) {
		this.remoteBrokerConfig = remoteBrokerConfig;
	}

	public BridgeDestinationsConfig getOutboundDestinations() {
		return outboundDestinations;
	}

	public void setOutboundDestinations(BridgeDestinationsConfig outboundDestinations) {
		this.outboundDestinations = outboundDestinations;
	}

}


text:
import React, { ComponentProps } from 'react'

export default function Link(props: ComponentProps<'a'>) {
  return <a {...props} target="_blank" rel="noopener noreferrer" />
}