text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-optimize: machine learning in Python">

  <title>API Reference — scikit-optimize 0.9.0 documentation</title>

  <link rel="canonical" href="https://scikit-optimize.github.io/modules/classes.html" />

  <link rel="shortcut icon" href="../_static/favicon.ico"/>

  <link rel="stylesheet" href="../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/sg_gallery.css" type="text/css" />
  <link rel="stylesheet" href="../_static/sg_gallery-binder.css" type="text/css" />
  <link rel="stylesheet" href="../_static/sg_gallery-dataframe.css" type="text/css" />
  <link rel="stylesheet" href="../_static/sg_gallery-rendered-html.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />

    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >

    </button>

          Install

          User Guide

          API

          Examples

          Getting Started

          Development

          GitHub

          Other Versions

          More

              Getting Started
              Development
              GitHub
              Other Versions

          <form class="search" action="../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>

    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    Toggle Menu

            Prev
            Up
            Next

          scikit-optimize 0.9.0

            Other versions

API Reference

skopt: module

Base classes

Functions

skopt.acquisition: Acquisition

skopt.benchmarks: A collection of benchmark problems.

Functions

skopt.callbacks: Callbacks

skopt.learning: Machine learning extensions for model-based optimization.

skopt.optimizer: Optimizer

skopt.plots: Plotting functions.

skopt.utils: Utils functions.

skopt.sampler: Samplers

skopt.space.space: Space

skopt.space.transformers: transformers

API Reference¶

Scikit-Optimize, or skopt, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements several methods for sequential model-based optimization. skopt is reusable in many contexts and accessible.

skopt: module¶

Base classes¶

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

BayesSearchCV(estimator, search_spaces[, ...])

Bayesian optimization over hyper parameters.

Optimizer(dimensions[, base_estimator, ...])

Run bayesian optimisation loop.

Space(dimensions)

Initialize a search space from given specifications.

Functions¶

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

dummy_minimize(func, dimensions[, n_calls, ...])

Random search by uniform sampling within the given bounds.

dump(res, filename[, store_objective])

Store an skopt optimization result into a file.

expected_minimum(res[, n_random_starts, ...])

Compute the minimum over the predictions of the last surrogate model.

expected_minimum_random_sampling(res[, ...])

Minimum search by doing naive random sampling, Returns the parameters that gave the minimum function value.

forest_minimize(func, dimensions[, ...])

Sequential optimisation using decision trees.

gbrt_minimize(func, dimensions[, ...])

Sequential optimization using gradient boosted trees.

gp_minimize(func, dimensions[, ...])

Bayesian optimization using Gaussian Processes.

load(filename, **kwargs)

Reconstruct a skopt optimization result from a file persisted with skopt.dump.

skopt.acquisition: Acquisition¶

User guide: See the Acquisition section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

acquisition.gaussian_acquisition_1D(X, model)

A wrapper around the acquisition function that is called by fmin_l_bfgs_b.

acquisition.gaussian_ei(X, model[, y_opt, ...])

Use the expected improvement to calculate the acquisition values.

acquisition.gaussian_lcb(X, model[, kappa, ...])

Use the lower confidence bound to estimate the acquisition values.

acquisition.gaussian_pi(X, model[, y_opt, ...])

Use the probability of improvement to calculate the acquisition values.

skopt.benchmarks: A collection of benchmark problems.¶

A collection of benchmark problems.

User guide: See the Benchmarks section for
further details.

Functions¶

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

benchmarks.bench1(x)

A benchmark function for test purposes.

benchmarks.bench1_with_time(x)

Same as bench1 but returns the computation time (constant).

benchmarks.bench2(x)

A benchmark function for test purposes.

benchmarks.bench3(x)

A benchmark function for test purposes.

benchmarks.bench4(x)

A benchmark function for test purposes.

benchmarks.bench5(x)

A benchmark function for test purposes.

benchmarks.branin(x[, a, b, c, r, s, t])

Branin-Hoo function is defined on the square \(x1 \in [-5, 10], x2 \in [0, 15]\).

benchmarks.hart6(x[, alpha, P, A])

The six dimensional Hartmann function is defined on the unit hypercube.

skopt.callbacks: Callbacks¶

Monitor and influence the optimization procedure via callbacks.

Callbacks are callables which are invoked after each iteration of the optimizer
and are passed the results "so far". Callbacks can monitor progress, or stop
the optimization early by returning True.

User guide: See the Callbacks section for further
details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

callbacks.CheckpointSaver(checkpoint_path, ...)

Save current state after each iteration with skopt.dump.

callbacks.DeadlineStopper(total_time)

Stop the optimization before running out of a fixed budget of time.

callbacks.DeltaXStopper(delta)

Stop the optimization when |x1 - x2| < delta

callbacks.DeltaYStopper(delta[, n_best])

Stop the optimization if the n_best minima are within delta

callbacks.EarlyStopper()

Decide to continue or not given the results so far.

callbacks.TimerCallback()

Log the elapsed time between each iteration of the minimization loop.

callbacks.VerboseCallback(n_total[, n_init, ...])

Callback to control the verbosity.

skopt.learning: Machine learning extensions for model-based optimization.¶

Machine learning extensions for model-based optimization.

User guide: See the Learning section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

learning.ExtraTreesRegressor([n_estimators, ...])

ExtraTreesRegressor that supports conditional standard deviation.

learning.GaussianProcessRegressor([kernel, ...])

GaussianProcessRegressor that allows noise tunability.

learning.GradientBoostingQuantileRegressor([...])

Predict several quantiles with one estimator.

learning.RandomForestRegressor([...])

RandomForestRegressor that supports conditional std computation.

skopt.optimizer: Optimizer¶

User guide: See the Optimizer, an ask-and-tell interface section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

optimizer.Optimizer(dimensions[, ...])

Run bayesian optimisation loop.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

optimizer.base_minimize(func, dimensions, ...)

Base optimizer class

optimizer.dummy_minimize(func, dimensions[, ...])

Random search by uniform sampling within the given bounds.

optimizer.forest_minimize(func, dimensions)

Sequential optimisation using decision trees.

optimizer.gbrt_minimize(func, dimensions[, ...])

Sequential optimization using gradient boosted trees.

optimizer.gp_minimize(func, dimensions[, ...])

Bayesian optimization using Gaussian Processes.

skopt.plots: Plotting functions.¶

Plotting functions.

User guide: See the Plotting tools section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

plots.partial_dependence(space, model, i[, ...])

Calculate the partial dependence for dimensions i and j with respect to the objective value, as approximated by model.

plots.partial_dependence_1D(space, model, i, ...)

Calculate the partial dependence for a single dimension.

plots.partial_dependence_2D(space, model, i, ...)

Calculate the partial dependence for two dimensions in the search-space.

plots.plot_convergence(*args, **kwargs)

Plot one or several convergence traces.

plots.plot_evaluations(result[, bins, ...])

Visualize the order in which points were sampled during optimization.

plots.plot_gaussian_process(res, **kwargs)

Plots the optimization results and the gaussian process for 1-D objective functions.

plots.plot_objective(result[, levels, ...])

Plot a 2-d matrix with so-called Partial Dependence plots of the objective function.

plots.plot_objective_2D(result, ...[, ...])

Create and return a Matplotlib figure and axes with a landscape contour-plot of the last fitted model of the search-space, overlaid with all the samples from the optimization results, for the two given dimensions of the search-space.

plots.plot_histogram(result, ...[, bins, ...])

Create and return a Matplotlib figure with a histogram of the samples from the optimization results, for a given dimension of the search-space.

plots.plot_regret(*args, **kwargs)

Plot one or several cumulative regret traces.

skopt.utils: Utils functions.¶

User guide: See the Utility functions section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

utils.cook_estimator(base_estimator[, space])

Cook a default estimator.

utils.cook_initial_point_generator(...)

Cook a default initial point generator.

utils.dimensions_aslist(search_space)

Convert a dict representation of a search space into a list of dimensions, ordered by sorted(search_space.keys()).

utils.expected_minimum(res[, ...])

Compute the minimum over the predictions of the last surrogate model.

utils.expected_minimum_random_sampling(res)

Minimum search by doing naive random sampling, Returns the parameters that gave the minimum function value.

utils.dump(res, filename[, store_objective])

Store an skopt optimization result into a file.

utils.load(filename, **kwargs)

Reconstruct a skopt optimization result from a file persisted with skopt.dump.

utils.point_asdict(search_space, point_as_list)

Convert the list representation of a point from a search space to the dictionary representation, where keys are dimension names and values are corresponding to the values of dimensions in the list.

utils.point_aslist(search_space, point_as_dict)

Convert a dictionary representation of a point from a search space to the list representation.

utils.use_named_args(dimensions)

Wrapper / decorator for an objective function that uses named arguments to make it compatible with optimizers that use a single list of parameters.

skopt.sampler: Samplers¶

Utilities for generating initial sequences

User guide: See the Sampling methods section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

sampler.Lhs([lhs_type, criterion, iterations])

Latin hypercube sampling

sampler.Sobol([skip, randomize])

Generates a new quasirandom Sobol' vector with each call.

sampler.Halton([min_skip, max_skip, primes])

Creates Halton sequence samples.

sampler.Hammersly([min_skip, max_skip, primes])

Creates Hammersley sequence samples.

skopt.space.space: Space¶

User guide: See the Space section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

space.space.Categorical(categories[, prior, ...])

Search space dimension that can take on categorical values.

space.space.Dimension()

Base class for search space dimensions.

space.space.Integer(low, high[, prior, ...])

Search space dimension that can take on integer values.

space.space.Real(low, high[, prior, base, ...])

Search space dimension that can take on any real value.

space.space.Space(dimensions)

Initialize a search space from given specifications.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

space.space.check_dimension(dimension[, ...])

Turn a provided dimension description into a dimension object.

skopt.space.transformers: transformers¶

User guide: See the Transformers section for further details.

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

space.transformers.CategoricalEncoder()

OneHotEncoder that can handle categorical variables.

space.transformers.Identity()

Identity transform.

space.transformers.LogN(base)

Base N logarithm transform.

space.transformers.Normalize(low, high[, is_int])

Scales each dimension into the interval [0, 1].

space.transformers.Pipeline(transformers)

A lightweight pipeline to chain transformers.

space.transformers.Transformer()

Base class for all 1-D transformers.

space.transformers.LabelEncoder([X])

LabelEncoder that can handle categorical variables.

space.transformers.StringEncoder([dtype])

StringEncoder transform.

            © 2017 - 2020, scikit-optimize contributors (BSD License).
          Show this page source


text:
package com.fishercoder.solutions;

public class _81 {

    public static class Solution1 {
        public boolean search(int[] nums, int target) {
            int start = 0;
            int end = nums.length - 1;

            //check each num so we will check start == end
            //We always get a sorted part and a half part
            //we can check sorted part to decide where to go next
            while (start <= end) {
                int mid = start + (end - start) / 2;
                if (nums[mid] == target) {
                    return true;
                }

                //if left part is sorted
                if (nums[start] < nums[mid]) {
                    if (target < nums[start] || target > nums[mid]) {
                        //target is in rotated part
                        start = mid + 1;
                    } else {
                        end = mid - 1;
                    }
                } else if (nums[start] > nums[mid]) {
                    //right part is rotated

                    //target is in rotated part
                    if (target < nums[mid] || target > nums[end]) {
                        end = mid - 1;
                    } else {
                        start = mid + 1;
                    }
                } else {
                    //duplicates, we know nums[mid] != target, so nums[start] != target
                    //based on current information, we can only move left pointer to skip one cell
                    //thus in the worst case, we would have target: 2, and array like 11111111, then
                    //the running time would be O(n)
                    start++;
                }
            }
            return false;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
from okdataset import ChainableList, Context, Logger

logger = Logger("sum example")

context = Context()
logger.info("Building list")
l = ChainableList([ x for x in xrange(1, 30) ])

logger.info("Building dataset")
ds = context.dataSet(l, label="sum", bufferSize=1)

logger.info("Calling reduce")
print ds.reduce(lambda x, y: x + y)
logger.info("All done!")


text:
from syned.beamline.shape import BoundaryShape
from syned.beamline.shape import Rectangle, Ellipse, Circle

from syned.beamline.optical_elements.absorbers.absorber import Absorber

class Slit(Absorber):
    def __init__(self, name="Undefined", boundary_shape=None):
        if boundary_shape is None:
            boundary_shape = BoundaryShape()
        Absorber.__init__(self, name=name, boundary_shape=boundary_shape)

    def set_rectangle(self,width=3e-3,height=4e-3,center_x=0.0,center_y=0.0):
        self._boundary_shape=Rectangle(-0.5*width+center_x,0.5*width+center_x,-0.5*height+center_y,0.5*height+center_y)

    def set_circle(self,radius=3e-3,center_x=0.0,center_y=0.0):
        self._boundary_shape=Circle(radius,center_x,center_y)

    def set_ellipse(self,width=3e-3,height=4e-3,center_x=0.0,center_y=0.0):
        self._boundary_shape=Ellipse(-0.5*width+center_x,0.5*width+center_x,-0.5*height+center_y,0.5*height+center_y)


text:
__version__='3.3.0'
__doc__='''Helper for the test suite - determines where to write output.

When our test suite runs as source, a script "test_foo.py" will typically
create "test_foo.pdf" alongside it.  But if you are testing a package of
compiled code inside a zip archive, this won't work.  This determines
where to write test suite output, creating a subdirectory of /tmp/ or
whatever if needed.

'''
_rl_tempdir=None
__all__ = ('get_rl_tempdir', 'get_rl_tempdir')
import os, tempfile
def _rl_getuid():
    if hasattr(os,'getuid'):
        return os.getuid()
    else:
        return ''

def get_rl_tempdir(*subdirs):
    global _rl_tempdir
    if _rl_tempdir is None:
        _rl_tempdir = os.path.join(tempfile.gettempdir(),'ReportLab_tmp%s' % str(_rl_getuid()))
    d = _rl_tempdir
    if subdirs: d = os.path.join(*((d,)+subdirs))
    try:
        os.makedirs(d)
    except:
        pass
    return d

def get_rl_tempfile(fn=None):
    if not fn:
        fn = tempfile.mktemp()
    return os.path.join(get_rl_tempdir(),fn)


text:
<?php

	namespace Seliton\Client\Resource\Enum;

	class ScriptCodePosition {
		const END_OF_BODY = 'end_of_body';
		const END_OF_HEAD = 'end_of_head';
	}
?>


text:
"""
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""

import re

def CheckChange(input_api, output_api):
  errors = []

  for f in input_api.AffectedFiles():
    if not f.LocalPath().endswith('suppressions.txt'):
      continue
    for line_num, line in enumerate(f.NewContents()):
      line = line.strip()
      if line.startswith('#') or not line:
        continue
      if not line.startswith('leak:'):
        errors.append('"%s" should be "leak:..." in %s line %d' %
                      (line, f.LocalPath(), line_num))
  if errors:
    return [output_api.PresubmitError('\n'.join(errors))]
  return []

def CheckChangeOnUpload(input_api, output_api):
  return CheckChange(input_api, output_api)

def CheckChangeOnCommit(input_api, output_api):
  return CheckChange(input_api, output_api)


text:
angular.module('sample', []);
//Here we don't have to return anything, Angular will do the new by itself
//We have won one line of code...
.service('UserService', ['$resource', function($resource) {
    this.fn1= function(){};
    this.fn2= function(){};
}]);


text:
package cherry.example.web.applied.ex50;

import static cherry.example.web.util.ModelAndViewBuilder.redirect;
import static cherry.example.web.util.ModelAndViewBuilder.withViewname;
import static cherry.example.web.util.ModelAndViewBuilder.withoutView;
import static org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder.fromMethodCall;
import static org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder.on;

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

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mobile.device.site.SitePreference;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;

import cherry.example.web.util.ViewNameUtil;
import cherry.foundation.logicalerror.LogicalErrorUtil;
import cherry.foundation.onetimetoken.OneTimeTokenValidator;

@Controller
public class AppliedEx51ControllerImpl implements AppliedEx51Controller {

	@Autowired
	private OneTimeTokenValidator oneTimeTokenValidator;

	@Autowired
	private AppliedEx51Service service;

	private final String viewnameOfStart = ViewNameUtil.fromMethodCall(on(AppliedEx51Controller.class).start(null,
			null, null, null, null, null, null));

	@Override
	public ModelAndView init(String redirTo, AppliedEx50to51Form form, BindingResult binding, Authentication auth,
			Locale locale, SitePreference sitePref, NativeWebRequest request, SessionStatus status) {
		if (StringUtils.isNotEmpty(redirTo)) {
			status.setComplete();
			return redirect(redirectTo(redirTo)).build();
		}
		if (binding.hasErrors()) {
			status.setComplete();
			return redirect(redirectToSearchResult()).build();
		}

		AppliedEx51SessionForm f = createSessionForm(form);
		return redirect(redirectToStart()).addObject(f).build();
	}

	@Override
	public ModelAndView start(AppliedEx51SessionForm form, BindingResult binding, Authentication auth, Locale locale,
			SitePreference sitePref, NativeWebRequest request, SessionStatus status) {
		if (binding.hasErrors()) {
			status.setComplete();
			return redirect(redirectToSearchResult()).build();
		}
		AppliedEx51Form f = createForm(form);
		if (f.getItem().isEmpty()) {
			status.setComplete();
			return redirect(redirectToSearchResult()).build();
		}
		return withViewname(viewnameOfStart).addObject(f).build();
	}

	@Override
	public ModelAndView update(AppliedEx51Form form, BindingResult binding, Authentication auth, Locale locale,
			SitePreference sitePref, NativeWebRequest request) {
		return withViewname(viewnameOfStart).build();
	}

	@Override
	public ModelAndView confirm(AppliedEx51Form form, BindingResult binding, Authentication auth, Locale locale,
			SitePreference sitePref, NativeWebRequest request) {

		if (hasErrors(form, binding)) {
			return withViewname(viewnameOfStart).build();
		}

		return withoutView().build();
	}

	@Override
	public ModelAndView back(AppliedEx51Form form, BindingResult binding, Authentication auth, Locale locale,
			SitePreference sitePref, NativeWebRequest request) {
		return withViewname(viewnameOfStart).build();
	}

	@Override
	public ModelAndView execute(AppliedEx51Form form, BindingResult binding, AppliedEx51SessionForm sessionForm,
			Authentication auth, Locale locale, SitePreference sitePref, NativeWebRequest request) {

		if (hasErrors(form, binding)) {
			return withViewname(viewnameOfStart).build();
		}

		if (!oneTimeTokenValidator.isValid(request.getNativeRequest(HttpServletRequest.class))) {
			LogicalErrorUtil.rejectOnOneTimeTokenError(binding);
			return withViewname(viewnameOfStart).build();
		}

		long count = service.update(form);
		if (count != form.getItem().size()) {
			LogicalErrorUtil.rejectOnOptimisticLockError(binding);
			return withViewname(viewnameOfStart).build();
		}

		AppliedEx51SessionForm sf = createSessionForm(form);
		sessionForm.setId(sf.getId());

		AppliedEx51Form f = createForm(sf);
		return withoutView().addObject(f).build();
	}

	private UriComponents redirectTo(String redir) {
		return UriComponentsBuilder.fromPath(redir).build();
	}

	private UriComponents redirectToSearchResult() {
		return fromMethodCall(on(AppliedEx50Controller.class).execute(null, null, null, null, null, null)).build();
	}

	private UriComponents redirectToStart() {
		return fromMethodCall(on(AppliedEx51Controller.class).start(null, null, null, null, null, null, null)).build();
	}

	private boolean hasErrors(AppliedEx51Form form, BindingResult binding) {

		// 単項目チェック
		if (binding.hasErrors()) {
			return true;
		}

		// 項目間チェック

		// 整合性チェック

		return false;
	}

	private AppliedEx51SessionForm createSessionForm(AppliedEx50to51Form form) {
		List<Long> l = new ArrayList<>(form.getItem().size());
		for (AppliedEx50to51SubForm subform : form.getItem()) {
			if (subform.getChecked().booleanValue()) {
				l.add(subform.getId());
			}
		}
		AppliedEx51SessionForm f = new AppliedEx51SessionForm();
		f.setId(l);
		return f;
	}

	private AppliedEx51SessionForm createSessionForm(AppliedEx51Form form) {
		List<Long> l = new ArrayList<>(form.getItem().size());
		for (AppliedEx51SubForm subform : form.getItem()) {
			l.add(subform.getId());
		}
		AppliedEx51SessionForm f = new AppliedEx51SessionForm();
		f.setId(l);
		return f;
	}

	private AppliedEx51Form createForm(AppliedEx51SessionForm form) {
		AppliedEx51Form f = new AppliedEx51Form();
		f.setItem(service.search(form.getId()));
		return f;
	}

}


text:
/******************************************************************************/
/*                                                                            */
/*  Unit Name : message.cpp                                                   */
/*                                                                            */
/*  Abstract  : Source file for functions implementing the classless          */
/*              diagnostic output functions.                                  */
/*                                                                            */
/*  Dependencies : Auto-Generated                                             */
/*                                                                            */
/*  Operating System : MS-DOS 6.2, Windows 3.1                                */
/*                                                                            */
/*  Compiler : MSVC V1.5                                                      */
/*                                                                            */
/*  Naming Conventions :                                                      */
/*                                                                            */
/*      Public Functions    : Mixed case with no underscores                  */
/*      Private Functions   : Mixed case with no underscores                  */
/*      Public Functions    : Mixed case with no underscores                  */
/*      Global Variables    : Mixed case with no underscores                  */
/*      Classless Functions : Mixed case with no underscores                  */
/*      Classes             : All upper case seperated by an underscore       */
/*      Defined Constants   : All upper case seperated by an underscore       */
/*      Macros              : All upper case seperated by an underscore       */
/*      Structs/Types       : All upper case seperated by an underscore       */
/*      Private Variables   : All lower case seperated by an underscore       */
/*      Public Variables    : All lower case seperated by an underscore       */
/*      Local Variables     : All lower case seperated by an underscore       */
/*                                                                            */
/*  Development History :                                                     */
/*  Date      Programer           Description                                 */
/*----------------------------------------------------------------------------*/
/*  23-Jan-95 LR                  Initial Write                               */
/*                                                                            */
/******************************************************************************/
#include <windows.h>
#include "stdhdr.h"
#include "dispcfg.h"

char debstr[10][120];

/********************************************************************/
/*                                                                  */
/* Routine: SIM_INT SimLibPrintError (char *, ...)                  */
/*                                                                  */
/* Description:                                                     */
/*    Dump an error message to the screen                           */
/*                                                                  */
/* Inputs:                                                          */
/*    char *fmt - Format string ala printf                          */
/*    ...       - Whatever is to be displayed                       */
/*                                                                  */
/* Outputs:                                                         */
/*    SIMLIB_OK                                                     */
/*                                                                  */
/*  Development History :                                           */
/*  Date      Programer           Description                       */
/*------------------------------------------------------------------*/
/*  23-Jan-95 LR                  Initial Write                     */
/*                                                                  */
/********************************************************************/
SIM_INT SimLibPrintError(char *fmt, ...)
{
    va_list ap;
    char new_str[1023];

    /* This comment is for LINT */
    /*CONSTCOND*/
    va_start(ap, fmt);

    vsprintf(new_str, fmt, ap);

    va_end(ap);

    MessageBox(FalconDisplay.appWin, new_str, "ERROR", MB_OK bitor MB_ICONSTOP);
    return (SIMLIB_OK);
}

/********************************************************************/
/*                                                                  */
/* Routine: SIM_INT SimLibPrintMessage (char *, ...)                */
/*                                                                  */
/* Description:                                                     */
/*    Dump an error message to the screen                           */
/*                                                                  */
/* Inputs:                                                          */
/*    char *fmt - Format string ala printf                          */
/*    ...       - Whatever is to be displayed                       */
/*                                                                  */
/* Outputs:                                                         */
/*    SIMLIB_OK                                                     */
/*                                                                  */
/*  Development History :                                           */
/*  Date      Programer           Description                       */
/*------------------------------------------------------------------*/
/*  23-Jan-95 LR                  Initial Write                     */
/*                                                                  */
/********************************************************************/
SIM_INT SimLibPrintMessage(char *fmt, ...)
{
    va_list ap;
    char new_str[1023];

    /* This comment is for LINT */
    /*CONSTCOND*/
    va_start(ap, fmt);

    vsprintf(new_str, fmt, ap);

    va_end(ap);

    MessageBox(FalconDisplay.appWin, new_str, "Message", MB_OK);
    return (SIMLIB_OK);
}


text:
#include <iostream>
#include <fstream>
#include <memory>
#include <boost/algorithm/string.hpp>

using namespace std;

/* Becasue I want to use OpenMP,
 * So I must use vector as the container for paras, because openmp require random access iterator.
 * And must use list as the container for results, because vector need to relocate, and therefore not thread-safe.
 */

// type define
typedef array<double, 3> Row;
typedef shared_ptr< list<Row> > RowList;
typedef array<double, 3> Para;
typedef shared_ptr< vector<Para> > ParaList;
typedef pair<Para, int> Score;

// function defines
RowList readFile(const string& fileName);
int sign(const Row& row, const Para& para);
int errors(const Para& para);
int predictErrors(const Para& para);
Para patch(const Para& para, const Row& row);
ParaList analysys(const Para& para);
Score deepin(const int now, const Para& para, const int limit);

// overloading define
ostream &operator<<(ostream& out, const Para& para) {
	out << "[" << para[0] << ", " << para[1] << ", " << para[2] << "]";
	return out;
}

ostream &operator<<(ostream& out, const Score& score) {
	out << "<" << score.first << ", " << score.second << ">";
	return out;
}

// preset data defines
Para initPara = {0, 0, 0};
auto trainFileContent = readFile("train_1_5.csv");
auto testFileContent = readFile("test_1_5.csv");

// main
int main(void) {
	Score trainResult = deepin(0, initPara, 1);
	int predictionError = predictErrors(trainResult.first);

	cout << "Train Result: " << trainResult << endl;
	cout << "Prediction Error: " << predictionError << endl;
}

// function implementation
RowList readFile(const string& fileName) {
	ifstream inFile(fileName);
	string line;
	vector<string> words;
	Row nums;
	RowList fileContent = static_cast<RowList>(new list<Row>);

	while(getline(inFile, line)){
		boost::split(words, line, boost::is_any_of(","));
		nums = {
			stod(words[0]),
			stod(words[1]),
			stod(words[2])
		};
		fileContent->push_back(nums);
	}

	return fileContent;
}

inline int sign(const Row& row, const Para& para) {
	double result = para[0] * row[0] + para[1] * row[1] + para[2];
	if(result >= 0){
		return 1;
	} else{
		return -1;
	}
}

int errors(const Para& para) {
	int sum = 0;

	for(auto it = trainFileContent->begin(); it != trainFileContent->end(); it++){
		Row& row = *it;
		if(sign(row, para) != row[2]){
			sum++;
		}
	}

	return sum;
}

int predictErrors(const Para& para) {
	int sum = 0;

	for(auto it = testFileContent->begin(); it != testFileContent->end(); it++){
		Row& row = *it;
		if(sign(row, para) != row[2]){
			sum++;
		}
	}

	return sum;
}

Para patch(const Para& para, const Row& row) {
	Para tryPara = {
		para[0] + row[2] * row[0],
		para[1] + row[2] * row[1],
		para[2] + row[2]
	};

	return tryPara;
}

ParaList analysys(const Para& para) {
	ParaList candidatePara = static_cast<ParaList>(new vector<Para>);

	for(auto it = trainFileContent->begin(); it != trainFileContent->end(); it++){
		Row& row = *it;
		if(sign(row, para) != row[2]){
			candidatePara->push_back(patch(para, row));
		}
	}

	return candidatePara;
}

/* @parameter: init para
 * @return: the best para among the child and sub-child para created by this para.
 */
Score deepin(const int now, const Para& para, const int limit) {
	list<Score> thisResult;
	thisResult.push_back(Score(para, errors(para)));

	if(now < limit){
		auto tryParas = *analysys(para);
		const unsigned int size = tryParas.size();

		//#pragma omp parallel for
		for(unsigned int i = 0; i < size; i++){
			Para& childPara = tryParas[i];
			thisResult.push_back(deepin(now+1, childPara, limit));
			if(now == 0){
				cout << "No: " << i << ", Score: " << *thisResult.rbegin() << endl;
			}
		}
	} else{
		auto tryParas = *analysys(para);
		const unsigned int size = tryParas.size();

		for(unsigned int i = 0; i < size; i++){
			Para& subPara = tryParas[i];
			thisResult.push_back(Score(subPara, errors(subPara)));
		}
	}

	Para bestPara = thisResult.begin()->first;
	int bestError = thisResult.begin()->second;

	for(auto it = thisResult.begin(); it != thisResult.end(); it++){
		if(it->second < bestError){
			bestPara = it->first;
			bestError = it->second;
		}
	}

	return(Score(bestPara, bestError));
}


text:
package com.s4game.server.executor;
/**
 * @Author zeusgooogle@gmail.com
 * @sine   2015年5月9日 下午4:57:36
 *
 */
public interface IRuleChecker {

	public boolean valid(Object rule);

}


text:
'use strict';

const expect = require('code').expect;
const Lab = require('lab');
const lab = exports.lab = Lab.script();
const server = require('../app');

lab.describe('Tests should be initialized', () => {

  lab.after((done) => {
    server.stop(done);
  });

  lab.it('Should be run', (done) => {
    expect(true).to.be.true;
    done();
  });

  lab.it('Server should be defined', (done) => {
    expect(server).to.exist();
    expect(server.stop).to.be.a.function();
    done();
  });
});


text:
package org.yu55.yagga.handler.git.command.version;

import static org.assertj.core.api.AssertionsForClassTypes.catchThrowable;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.yu55.yagga.handler.git.command.version.GitVersionValueFactory.factorizeGitVersionValue;

import org.junit.Test;
import org.yu55.yagga.handler.generic.command.CommandOutput;
import org.yu55.yagga.handler.generic.command.CommandOutputLine;

public class GitVersionValueFactoryTest {

    @Test
    public void shouldReturnGitVersionValue() {
        // given
        CommandOutput commandOutput = new CommandOutput()
                .addOutputLine(new CommandOutputLine("git version 2.5.0"));

        // when
        int version = factorizeGitVersionValue(commandOutput);

        // then
        assertThat(version).isEqualTo(250);
    }

    @Test
    public void shouldThrowExceptionForEmptyCommandOutput() {
        // given
        CommandOutput commandOutput = new CommandOutput();

        // when
        Throwable throwable = catchThrowable(() -> factorizeGitVersionValue(commandOutput));

        // then
        assertThat(throwable).isInstanceOf(IllegalArgumentException.class).hasMessage("Cannot parse git version.");
    }

    @Test
    public void shouldThrowExceptionFoIncorrectCommandOutput() {
        // given
        CommandOutput commandOutput = new CommandOutput()
                .addOutputLine(new CommandOutputLine("incorrect git version string"));

        // when
        Throwable throwable = catchThrowable(() -> factorizeGitVersionValue(commandOutput));

        // then
        assertThat(throwable).isInstanceOf(IllegalArgumentException.class).hasMessage("Cannot parse git version.");
    }
}


text:
from distutils.core import setup
from Cython.Build import cythonize

setup(
    name='wordcloud',
    version='1.0.0',
    url='https://github.com/amueller/word_cloud',
    license='MIT',
    ext_modules=cythonize('wordcloud/query_integral_image.pyx'),
    packages=['wordcloud'],
    package_data={'wordcloud': ['stopwords']}
)


text:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>${groupId}</groupId>
        <artifactId>${rootArtifactId}-plugins</artifactId>
        <version>${version}</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>welcome-plugin</artifactId>
    <version>${version}</version>
    <packaging>jar</packaging>
    <name>Welcom Plugin</name>

    <properties>
        <plugin.id>welcome-plugin</plugin.id>
        <plugin.class>${package}.welcome.WelcomePlugin</plugin.class>
        <plugin.version>${version}</plugin.version>
        <plugin.provider/>
        <plugin.dependencies/>
    </properties>

    <dependencies>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>

</project>


text:
<?php

namespace Barryvdh\StackMiddleware\Tests;

use Barryvdh\StackMiddleware\ServiceProvider;

abstract class TestCase extends \Orchestra\Testbench\TestCase
{
    /**
     * @param \Illuminate\Foundation\Application $app
     * @return string[]
     */
    protected function getPackageProviders($app)
    {
        return [ServiceProvider::class];
    }

    public function getMock($className)
    {
        return $this->getMockBuilder($className)->getMock();
    }
}


text:
/* global _babelPolyfill */
export default typeof _babelPolyfill !== "undefined" && _babelPolyfill === true


text:
#import <Cocoa/Cocoa.h>

@class DVTCheapReusableSubstring, DVTStringBuffer, NSMutableArray, NSString;

@interface DVTCharStream : NSObject
{
    DVTStringBuffer *_stringBuffer;
    NSString *_realString;
    DVTCheapReusableSubstring *_cheapString;
    NSMutableArray *_savedTokens;
    id _savedBottomToken;
    BOOL _isAtBOL;
    BOOL _isAtColumnZero;
    BOOL _BOLIsKnown;
    BOOL _SeenOneCharAtBOL;
    BOOL _SeenWhitespaceAtBOL;
}

//- (void).cxx_destruct;
- (id)savedToken;
- (BOOL)hasSavedTokens;
- (void)saveToken:(id)arg1;
- (id)stringWithRange:(struct _NSRange)arg1;
- (unsigned long long)locationOfNewlineFrom:(unsigned long long)arg1 searchBackwards:(BOOL)arg2;
- (unsigned long long)peekCharacterInSet:(id)arg1;
- (unsigned short)peekCharSkippingWhitespace;
- (unsigned short)peekChar;
- (BOOL)isAtColumnZero;
- (BOOL)isAtBOL;
- (void)_computeBOL;
- (unsigned short)nextCharSkippingWhitespace;
- (unsigned short)nextChar;
- (void)setLocation:(unsigned long long)arg1;
- (unsigned long long)location;
- (unsigned long long)length;
- (id)string;
- (void)setString:(id)arg1;
- (id)initWithString:(id)arg1;

@end


text:
namespace multiverso {

AllreduceEngine::AllreduceEngine()
  :block_start_(nullptr), block_len_(nullptr), buffer_(nullptr) {

}

void AllreduceEngine::Init(const NetInterface* linkers) {
  linkers_ = linkers;
  rank_ = linkers_->rank();
  num_machines_ = linkers_->size();
  bruck_map_ = BruckMap::Construct(rank_, num_machines_);
  recursive_halving_map_ = RecursiveHalvingMap::Construct(rank_, num_machines_);
  block_start_ = new int[num_machines_];
  block_len_ = new int[num_machines_];
  buffer_size_ = 1024 * 1024;
  buffer_ = new char[buffer_size_];
}

AllreduceEngine::~AllreduceEngine() {
  if (block_start_ != nullptr) { delete[]block_start_; }
  if (block_len_ != nullptr) { delete[]block_len_; }
  if (buffer_ != nullptr) { delete[] buffer_; }
}

void AllreduceEngine::Allreduce(char* input, int input_size, int type_size, char* output, ReduceFunction reducer) {

  int count = input_size / type_size;
  //if small package or small count , do it by all gather.(reduce the communication times.)
  if (count < num_machines_ || input_size < 4096) {
    AllreduceByAllGather(input, input_size, type_size, output, reducer);
    return;
  }
  //assign the blocks to every rank_s.
  int step = (count + num_machines_ - 1) / num_machines_;
  if (step < 1) {
    step = 1;
  }
  block_start_[0] = 0;
  for (int i = 0; i < num_machines_ - 1; ++i) {
    block_len_[i] = step * type_size < input_size - block_start_[i] ? step * type_size : input_size - block_start_[i];
    block_start_[i + 1] = block_start_[i] + block_len_[i];
  }
  block_len_[num_machines_ - 1] = input_size - block_start_[num_machines_ - 1];
  //do reduce scatter
  ReduceScatter(input, input_size, type_size, block_start_, block_len_, output, reducer);
  //do all gather
  Allgather(output, input_size, block_start_, block_len_, output);
}

// REVIEW(feiga): the third argument type_size never used
void AllreduceEngine::AllreduceByAllGather(char* input, int input_size, int, char* output, ReduceFunction reducer) {
  //assign blocks
  int all_size = input_size * num_machines_;
  block_start_[0] = 0;
  block_len_[0] = input_size;
  for (int i = 1; i < num_machines_; ++i) {
    block_start_[i] = block_start_[i - 1] + block_len_[i - 1];
    block_len_[i] = input_size;
  }

  if (input_size*num_machines_ > buffer_size_) {
    delete[] buffer_;
    buffer_size_ = input_size*num_machines_;
    buffer_ = new char[buffer_size_];
  }
  Allgather(input, all_size, block_start_, block_len_, buffer_);
  for (int i = 1; i < num_machines_; ++i) {
    reducer(buffer_ + block_start_[i], buffer_ + block_start_[0], input_size);
  }
  std::memcpy(output, buffer_, input_size);
}

void AllreduceEngine::Allgather(char* input, int send_size, char* output) {
  //assign blocks
  block_start_[0] = 0;
  block_len_[0] = send_size;
  for (int i = 1; i < num_machines_; ++i) {
    block_start_[i] = block_start_[i - 1] + block_len_[i - 1];
    block_len_[i] = send_size;
  }
  Allgather(input, send_size * num_machines_, block_start_, block_len_, output);
}

void AllreduceEngine::Allgather(char* input, int all_size, int* block_start, int* block_len, char* output) {
  int write_ptr = 0;
  std::memcpy(output, input, block_len[rank_]);
  write_ptr += block_len[rank_];
  int accumulated_block = 1;
  for (int i = 0; i < bruck_map_.k; ++i) {
    int cur_block_size = (1 << i) < num_machines_ - accumulated_block ? (1 << i) : num_machines_ - accumulated_block;
    int target = bruck_map_.out_ranks[i];
    int send_len = 0;
    for (int j = 0; j < cur_block_size; ++j) {
      send_len += block_len[(rank_ + j) % num_machines_];
    }

    int incoming = bruck_map_.in_ranks[i];
    int need_recv_cnt = 0;
    for (int j = 0; j < cur_block_size; ++j) {
      need_recv_cnt += block_len[(rank_ + accumulated_block + j) % num_machines_];
    }

    linkers_->SendRecv(target, output, send_len, incoming, output + write_ptr, need_recv_cnt);
    write_ptr += need_recv_cnt;
    accumulated_block += cur_block_size;
  }
  //rotate right
  std::reverse<char*>(output, output + all_size);
  std::reverse<char*>(output, output + block_start[rank_]);
  std::reverse<char*>(output + block_start[rank_], output + all_size);
}

// REVIEW(feiga): the third argument type_size never used
void AllreduceEngine::ReduceScatter(char* input, int input_size, int, int* block_start, int* block_len, char* output, ReduceFunction reducer) {

  bool is_powerof_2 = (num_machines_ & (num_machines_ - 1)) == 0 ? true : false;
  if (!is_powerof_2) {
    if (recursive_halving_map_.type == RecursiveHalvingNodeType::Other) {
      //send local data to neighbor first
      linkers_->SendTo(recursive_halving_map_.neighbor, input, input_size);
    }
    else if (recursive_halving_map_.type == RecursiveHalvingNodeType::GroupLeader) {
      //receive neighbor data first
      int need_recv_cnt = input_size;
      linkers_->RecvFrom(recursive_halving_map_.neighbor, output, need_recv_cnt);
      reducer(output, input, input_size);
    }
  }
  //start recursive halfing
  if (recursive_halving_map_.type != RecursiveHalvingNodeType::Other) {

    for (int i = 0; i < recursive_halving_map_.k; ++i) {
      int target = recursive_halving_map_.ranks[i];
      int send_block_start = recursive_halving_map_.send_block_start[i];
      int recv_block_start = recursive_halving_map_.recv_block_start[i];
      int send_size = 0;
      for (int j = 0; j < recursive_halving_map_.send_block_len[i]; ++j) {
        send_size += block_len[send_block_start + j];
      }

      int need_recv_cnt = 0;
      for (int j = 0; j < recursive_halving_map_.recv_block_len[i]; ++j) {
        need_recv_cnt += block_len[recv_block_start + j];
      }

      linkers_->SendRecv(target, input + block_start[send_block_start], send_size, target, output, need_recv_cnt);
      //reduce
      reducer(output, input + block_start[recv_block_start], need_recv_cnt);
    }
  }
  int my_reduce_block_idx = rank_;

  if (!is_powerof_2) {
    if (recursive_halving_map_.type == RecursiveHalvingNodeType::GroupLeader) {
      //send result to neighbor
      linkers_->SendTo(recursive_halving_map_.neighbor, input + block_start[recursive_halving_map_.neighbor], block_len[recursive_halving_map_.neighbor]);
    }
    else if (recursive_halving_map_.type == RecursiveHalvingNodeType::Other) {
      //receive result from neighbor
      int need_recv_cnt = block_len[my_reduce_block_idx];
      linkers_->RecvFrom(recursive_halving_map_.neighbor, output, need_recv_cnt);
      return;
    }
  }
  std::memcpy(output, input + block_start[my_reduce_block_idx], block_len[my_reduce_block_idx]);
}

}


text:
import { Mock } from "../lib/mock";
import { Times } from "../lib/times";
import { It } from "../lib/reflector/expression-predicates";

interface IMyService {
    findSomething(value: number): number;

    doSomething(value: IData): any;
}

class MyClass {
    constructor(private myService: IMyService) {
    }

    public method(value: number): void {
        const field1 = this.myService.findSomething(value);
        this.myService.doSomething({field1});
    }
}

interface IData {
    field1: number;
}

describe("#1 Verify context of a named function expression is incorrect", () => {
   it("the bug", () => {
        const value = 4;
        const field1 = 2;
        const myServiceMock = new Mock<IMyService>();
        myServiceMock
            .setup(instance => instance.doSomething(It.IsAny()))
            .returns(undefined)
            .setup(instance => instance.findSomething(value))
            .returns(field1);

        const myClass = new MyClass(myServiceMock.object());
        myClass.method(value);

        myServiceMock.verify(instance => instance.doSomething(It.Is<IData>(data =>
            // data: expected {field1: 2}, actual: 4;
             data.field1 === field1
        )), Times.Once());
    });
});


text:
<!doctype html>
<meta charset=utf8>
<meta content="width=device-width, initial-scale=1" name=viewport>
<title>Proximity Events Test Suite</title>

Test Suite for Proximity Events


text:
package de.madcyph3r.example.example.headerTypes;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;

import de.madcyph3r.example.R;
import de.madcyph3r.example.example.FragmentDummy;
import de.madcyph3r.example.example.FragmentInstruction;
import de.madcyph3r.materialnavigationdrawer.MaterialNavigationDrawer;
import de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu;
import de.madcyph3r.materialnavigationdrawer.menu.item.MaterialSection;

public class CustomHeaderBelowToolbarActivity extends MaterialNavigationDrawer {

    MaterialNavigationDrawer drawer = null;

    @Override
    public int headerType() {
        // set type. you get the available constant from MaterialNavigationDrawer class
        return MaterialNavigationDrawer.DRAWERHEADER_CUSTOM;
    }

    @Override
    protected boolean finishActivityOnNewIntent() {
        return false;
    }

    @Override
    protected int getNewIntentRequestCode(Class clazz) {
        return 0;
    }

    @Override
    public void init(Bundle savedInstanceState) {

        // see AndroidManifest.xml and styles.xml, for belowToolbar. And example_custom_header_below_toolbar

        Bundle bundle = new Bundle();
        bundle.putString("instruction", "This example has an custom header in the drawer. " +
                "The drawer is shown under the toolbar. " +
                "See the method headerType in the source code. And don't forget to call " +
                "setCustomMenu(), to set your menu and setDrawerHeaderImage(), to set your image.");

        drawer = this;

        MaterialMenu menu = new MaterialMenu();

        //create instruction fragment
        Fragment fragmentInstruction = new FragmentInstruction();
        fragmentInstruction.setArguments(bundle);

        // menu items
        MaterialSection instruction = this.newSection("Instruction", fragmentInstruction , false, menu);
        instruction.setFragmentTitle("Custom Header Below Toolbar");
        this.newDevisor(menu);
        this.newLabel("Label", false, menu);
        this.newSection("Section", new FragmentDummy(), false, menu);

        // set start index
        menu.setStartIndex(0);

        // set this menu
        this.setCustomMenu(menu);

        // create and set the recycleview_header
        View view = LayoutInflater.from(this).inflate(R.layout.example_custom_header_below_toolbar,null);
        this.setDrawerHeaderCustom(view);

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
 <extension
       point="org.eclipse.ui.views">
    <view
          category="gov.nasa.ensemble.core.plan"
          class="gov.nasa.arc.spife.core.plan.pear.view.ui.ProfileEffectsAndRequirementsView"
          icon="icons/effects_and_conditions.png"
          id="gov.nasa.arc.spife.core.plan.pear.view.ui.ProfileEffectsAndRequirementsView"
          name="Profile Effects && Requirements"
          restorable="true">
    </view>
 </extension>
 <extension point="org.eclipse.ui.startup">
      <startup
            class="gov.nasa.arc.spife.core.plan.pear.view.ui.ProfileEffectsAndRequirementsViewStartup">
      </startup>
   </extension>
   <extension
       point="org.eclipse.ui.viewActions">
    <viewContribution
          id="gov.nasa.arc.spife.core.plan.pear.view.contribution"
          targetID="gov.nasa.arc.spife.core.plan.pear.view.ui.ProfileEffectsAndRequirementsView">
       <action
             class="gov.nasa.arc.spife.core.plan.pear.view.ui.RemoveProfileMemberPageRowAction"
             icon="icons/trash.png"
             id="gov.nasa.arc.spife.core.plan.pear.view.remove"
             label="-"
             style="push"
             toolbarPath="additions"
             tooltip="Delete">
       </action>
       <action
             class="gov.nasa.arc.spife.core.plan.pear.view.ui.AddProfileMemberPageRowAction"
             icon="icons/add.png"
             id="gov.nasa.arc.spife.core.plan.pear.view.add"
             label="+"
             style="push"
             toolbarPath="additions"
             tooltip="Add">
       </action>
    </viewContribution>
    <viewContribution
          id="gov.nasa.arc.score.member.profiletreeview.contribution"
          targetID="gov.nasa.ensemble.core.jscience.ui.profile.tree.ProfileTreeView">
       <action
             class="gov.nasa.arc.spife.core.plan.pear.view.ui.DeleteProfileMemberAction"
             icon="icons/trash.png"
             id="gov.nasa.arc.spife.core.plan.pear.view.delete"
             label="-"
             style="push"
             toolbarPath="additions"
             tooltip="Delete">
          <enablement>
             <objectClass
                   name="gov.nasa.ensemble.core.plan.editor.MultiPagePlanEditor">
             </objectClass>
          </enablement>
       </action>
       <action
             class="gov.nasa.arc.spife.core.plan.pear.view.ui.CreateProfileMemberAction"
             icon="icons/add.png"
             id="gov.nasa.arc.spife.core.plan.pear.view.create"
             label="+"
             style="push"
             toolbarPath="additions"
             tooltip="Add">
       </action>
    </viewContribution>
 </extension>

</plugin>


text:
package bwyap.familyfeud.gui.control;

import static bwyap.familyfeud.gui.window.ControlWindow.DEFAULT_BORDER_WIDTH;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

import bwyap.familyfeud.game.fastmoney.state.FastMoney;
import bwyap.familyfeud.gui.GBC;
import bwyap.familyfeud.gui.UIManager;
import bwyap.familyfeud.sound.SoundManager;
import bwyap.gridgame.res.ResourceLoader;

/**
 * This panel holds the input components for a player in Fast Money
 * @author bwyap
 *
 */
public class FastMoneyAnswerPanel extends JPanel {

	private static final long serialVersionUID = -4766058372180946035L;

	public static final int WIDTH = UIManager.getInstance().getProperty("fastmoneyanswerpanel.width");
	public static final int HEIGHT = UIManager.getInstance().getProperty("fastmoneyanswerpanel.height");

	private FastMoney fastmoney;
	private final int PLAYER;

	private JLabel title;
	private List<JLabel> labels;
	private List<JTextField> answers;
	private List<JTextField> scores;
	private List<JButton> revealAnswers;
	private List<JButton> revealScores;
	private JButton save;
	private JButton showAnswers;

	public FastMoneyAnswerPanel(FastMoney fastmoney, int player) {
		this.fastmoney = fastmoney;
		this.PLAYER = player;

		setPreferredSize(new Dimension(WIDTH, HEIGHT));
		setBorder(BorderFactory.createLineBorder(Color.BLACK, DEFAULT_BORDER_WIDTH));
		setLayout(new GridBagLayout());
		initComponents();
	}

	/**
	 * Initialize panel components
	 */
	private void initComponents() {
		title = new JLabel("PLAYER " + (PLAYER + 1) + " ANSWERS");
		title.setFont(new Font(ResourceLoader.DEFAULT_FONT_NAME, Font.BOLD, 14));

		showAnswers = new JButton("Hide answers");
		showAnswers.setToolTipText("Hide the player's answers from the screen");
		showAnswers.setPreferredSize(new Dimension(150, 30));
		showAnswers.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if (fastmoney.showAnswers(PLAYER)) {
					fastmoney.setShow(PLAYER, false);
					showAnswers.setText("Show answers");
					showAnswers.setToolTipText("Show the player's answers on the screen");
				}
				else {
					fastmoney.setShow(PLAYER, true);
					showAnswers.setText("Hide answers");
					showAnswers.setToolTipText("Hide the player's answers from the screen");
				}
			}
		});

		labels = new ArrayList<JLabel>();
		answers = new ArrayList<JTextField>();
		scores = new ArrayList<JTextField>();
		revealAnswers = new ArrayList<JButton>();
		revealScores = new ArrayList<JButton>();

		for(int i = 0; i < FastMoney.QUESTIONS; i++) {
			JLabel label = new JLabel("Q" + (i+1) + ".");
			JTextField answer = new JTextField();
			answer.setPreferredSize(new Dimension(140, 30));
			answer.setMinimumSize(new Dimension(150, 30));
			answer.setToolTipText("Player " + (PLAYER + 1) + "\'s answer");
			answer.getDocument().addDocumentListener(new DocumentListener() {
				@Override
				public void insertUpdate(DocumentEvent e) { save.setEnabled(true); save.setText("Save"); }
				@Override
				public void removeUpdate(DocumentEvent e) { save.setEnabled(true); save.setText("Save"); }
				@Override
				public void changedUpdate(DocumentEvent e) {}
			});

			JTextField score = new JTextField();
			score.setToolTipText("Answer score (must be a non-negative integer)");
			score.setPreferredSize(new Dimension(30, 30));
			score.setMinimumSize(new Dimension(50, 30));
			score.getDocument().addDocumentListener(new DocumentListener() {
				@Override
				public void insertUpdate(DocumentEvent e) { validateScores(); }
				@Override
				public void removeUpdate(DocumentEvent e) { validateScores(); }
				@Override
				public void changedUpdate(DocumentEvent e) {}
			});

			final int question = i;

			JButton revealScore = new JButton("Reveal S");
			revealScore.setToolTipText("Reveal the score");
			revealScore.setEnabled(false);
			revealScore.setPreferredSize(new Dimension(85, 30));
			revealScore.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					if (fastmoney.getAnswer(PLAYER, question).isRevealedScore()) {
						fastmoney.setRevealedScore(PLAYER, question, false);
						revealScore.setText("Reveal S");
						revealScore.setToolTipText("Reveal the score");
					}
					else {
						fastmoney.setRevealedScore(PLAYER, question, true);
						revealScore.setText("Hide S");
						revealScore.setToolTipText("Hide the score");
						if (fastmoney.getAnswer(PLAYER, question).getScore() > 0) {
							SoundManager.getInstance().playClip("fm_answer");
						}
						else SoundManager.getInstance().playClip("fm_strike");
					}
				}
			});

			JButton revealAnswer = new JButton("Reveal A");
			revealAnswer.setToolTipText("Reveal the answer");
			revealAnswer.setEnabled(false);
			revealAnswer.setPreferredSize(new Dimension(85, 30));
			revealAnswer.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					if (fastmoney.getAnswer(PLAYER, question).isRevealedAnswer()) {
						fastmoney.setRevealedAnswer(PLAYER, question, false);
						revealAnswer.setText("Reveal A");
						revealAnswer.setToolTipText("Reveal the answer");
						if (fastmoney.getAnswer(PLAYER, question).isRevealedScore()) revealScore.doClick();
					}
					else {
						SoundManager.getInstance().playClip("blip");
						fastmoney.setRevealedAnswer(PLAYER, question, true);
						revealAnswer.setText("Hide A");
						revealAnswer.setToolTipText("Hide the answer");
					}
				}
			});

			labels.add(label);
			answers.add(answer);
			scores.add(score);
			revealAnswers.add(revealAnswer);
			revealScores.add(revealScore);
			add(label, new GBC(0, i + 1));
			add(answer, new GBC(1, i + 1));
			add(score, new GBC(2, i + 1));
			add(revealAnswer, new GBC(3, i + 1));
			add(revealScore, new GBC(4, i + 1));
		}

		save = new JButton("Save");
		save.setToolTipText("Save the scores and answers (all inputs must be valid)");
		save.setPreferredSize(new Dimension(100, 30));
		save.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				// Save the answers to the fastmoney object
				for(int i = 0; i < FastMoney.QUESTIONS; i++) {
					if (!scores.get(i).getText().equals("")) {
						int score = Integer.parseInt(scores.get(i).getText());
						fastmoney.setScore(PLAYER, i, score);
						fastmoney.setAnswer(PLAYER, i, answers.get(i).getText());
						save.setEnabled(false);
						save.setText("Saved");
						enableReveal(!fastmoney.isTimerRunning());
					}
				}
			}
		});

		add(title, new GBC(0, 0).setSpan(6, 1));
		add(save, new GBC(0, 6).setSpan(3, 1));
		add(showAnswers, new GBC(3, 6).setSpan(2, 1));
	}

	/**
	 * Reset all controls
	 */
	public void reset() {
		for(int i = 0; i < FastMoney.QUESTIONS; i++) {
			answers.get(i).setText("");
			scores.get(i).setText("");
			revealAnswers.get(i).setText("Reveal A");
			revealScores.get(i).setText("Reveal S");
		}
		validateScores();
		enableReveal(false);
		showAnswers.setEnabled(true);
		showAnswers.setText("Hide answers");
		showAnswers.setToolTipText("Hide the player's answers from the screen");
	}

	/**
	 * Validate that the scores are numerical
	 */
	private void validateScores() {
		boolean valid = true;
		for(JTextField score : scores) {
			String text = score.getText();
			try {
				if (!text.equals("")) {
					if (Integer.parseInt(text) < 0)
						throw new Exception();
				}
				score.setBackground(Color.WHITE);
				save.setEnabled(true);
				save.setText("Save");
			}
			catch (Exception e) {
				score.setBackground(new Color(0xff9999));
				valid = false;
			}
		}

		save.setEnabled(valid);
	}

	/**
	 * Set whether the user can reveal answers or not
	 * @param reveal
	 */
	public void enableReveal(boolean reveal) {
		if (reveal) {
			for(int i = 0; i < FastMoney.QUESTIONS; i++) {
				if (!scores.get(i).getText().equals("")) {
					this.revealAnswers.get(i).setEnabled(true);
					this.revealScores.get(i).setEnabled(true);
				}
			}
		}
		else {
			for(int i = 0; i < FastMoney.QUESTIONS; i++) {
				this.revealAnswers.get(i).setEnabled(false);
				this.revealScores.get(i).setEnabled(false);
			}
		}
	}

}


text:
from pychron.pyscripts.decorators import verbose_skip
from pychron.pyscripts.measurement_pyscript import MeasurementPyScript, command_register

ESTIMATED_DURATION_FF = 1.0

class ThermoMeasurementPyScript(MeasurementPyScript):
    @verbose_skip
    @command_register
    def set_deflection(self, detname, v=""):
        """
        if v is an empty str (default) then get the deflection value from
        the configuration file.

        :param detname: name of detector
        :type detname: str
        :param v: deflection value or an empty string
        :type v: '', int, float

        """
        if v == "":
            v = self._get_deflection_from_file(detname)

        if v is not None:
            v = "{},{}".format(detname, v)
            self._set_spectrometer_parameter("SetDeflection", v)
        else:
            self.debug(
                "no deflection value for {} supplied or in the config file".format(
                    detname
                )
            )

    @verbose_skip
    @command_register
    def get_deflection(self, detname):
        """
        Read the deflection from the spectrometer

        :param detname: name of detector
        :type detname: str
        :return: float
        """
        return self._get_spectrometer_parameter("GetDeflection", detname)

    @verbose_skip
    @command_register
    def set_deflections(self):
        """
        Set deflections to values stored in config.cfg
        """
        func = self._set_spectrometer_parameter

        config = self._get_config()
        section = "Deflections"
        dets = config.options(section)
        for dn in dets:
            v = config.getfloat(section, dn)
            if v is not None:
                func("SetDeflection", "{},{}".format(dn, v))

    @verbose_skip
    @command_register
    def set_ysymmetry(self, v):
        """
        Set YSymmetry to v

        :param v: ysymmetry value
        :type v: int, float

        """
        self._set_spectrometer_parameter("SetYSymmetry", v)

    @verbose_skip
    @command_register
    def set_zsymmetry(self, v):
        """
        Set ZSymmetry to v

        :param v: zsymmetry value
        :type v: int, float
        """
        self._set_spectrometer_parameter("SetZSymmetry", v)

    @verbose_skip
    @command_register
    def set_zfocus(self, v):
        """
        Set ZFocus to v

        :param v: zfocus value
        :type v: int, float
        """
        self._set_spectrometer_parameter("SetZFocus", v)

    @verbose_skip
    @command_register
    def set_extraction_focus(self, v):
        """
        Set ExtractionFocus to v

        :param v: extractionfocus value
        :type v: int, float
        """
        self._set_spectrometer_parameter("SetExtractionFocus", v)

    @verbose_skip
    @command_register
    def set_extraction_symmetry(self, v):
        """
        Set Extraction Symmetry to v

        :param v: extraction symmetry value
        :type v: int, float
        """
        self._set_spectrometer_parameter("SetExtractionSymmetry", v)

    @verbose_skip
    @command_register
    def set_extraction_lens(self, v):
        """
        Set Extraction Lens to v

        :param v: extraction lens value
        :type v: int, float
        """
        self._set_spectrometer_parameter("SetExtractionLens", v)

    @verbose_skip
    @command_register
    def set_cdd_operating_voltage(self, v=""):
        """
        if v is '' (default) use value from file

        :param v: cdd operating voltage
        :type v: '', int, float
        """
        if v == "":
            config = self._get_config()
            v = config.getfloat("CDDParameters", "OperatingVoltage")

        self._set_spectrometer_parameter("SetIonCounterVoltage", v)

    @verbose_skip
    @command_register
    def set_source_optics(self, **kw):
        """
        example ::

            # set all source parameters to values stored in config.cfg
            set_source_optics()

            # set ysymmetry to 10.
            # set all other values using config.cfg
            set_source_optics(YSymmetry=10.0)

        """
        self._set_from_file("SourceOptics", **kw)

    @verbose_skip
    @command_register
    def set_source_parameters(self, **kw):
        self._set_from_file("SourceParameters", **kw)

    @verbose_skip
    @command_register
    def set_accelerating_voltage(self, v=""):
        self._set_spectrometer_parameter("SetHV", v)

class NGXMeasurementPyScript(MeasurementPyScript):
    pass

# ============= EOF =============================================


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package com.cloud.hypervisor.ovm3.resources.helpers;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.naming.ConfigurationException;

import org.apache.commons.lang.BooleanUtils;
import org.apache.log4j.Logger;

import com.cloud.hypervisor.ovm3.objects.Network;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.net.NetUtils;

/* holds config data for the Ovm3 Hypervisor */
public class Ovm3Configuration {
    private static final Logger LOGGER = Logger
            .getLogger(Ovm3Configuration.class);
    private String agentIp;
    private Long agentZoneId;
    private Long agentPodId;
    private String agentPoolId;
    private Long agentClusterId;
    private String agentHostname;
    private String csHostGuid;
    private String agentSshUserName = "root";
    private String agentSshPassword;
    private String agentOvsAgentUser = "oracle";
    private String agentOvsAgentPassword;
    private Integer agentOvsAgentPort = 8899;
    private Boolean agentOvsAgentSsl = false;
    private String agentSshKeyFile = "id_rsa.cloud";
    private String agentOwnedByUuid = "d1a749d4295041fb99854f52ea4dea97";
    private Boolean agentIsMaster = false;
    private Boolean agentHasMaster = false;
    private Boolean agentInOvm3Pool = false;
    private Boolean agentInOvm3Cluster = false;
    private String ovm3PoolVip = "";
    private String agentPrivateNetworkName;
    private String agentPublicNetworkName;
    private String agentGuestNetworkName;
    private String agentStorageNetworkName;
    private String agentControlNetworkName = "control0";
    private String agentOvmRepoPath = "/OVS/Repositories";
    private String agentSecStoragePath = "/nfsmnt";
    private String agentScript = "cloudstack.py";
    private String agentCheckStorageScript = "storagehealth.py";
    private Integer agentStorageCheckTimeout = 120;
    private Integer agentStorageCheckInterval = 1;
    private List<String> agentScripts = Arrays.asList(agentCheckStorageScript, agentScript);
    private String agentScriptsDir = "/opt/cloudstack/bin";
    private int domRSshPort = 3922;
    private String domRCloudPath = "/opt/cloud/bin/";
    private String virtualdiskdir = "VirtualDisks";
    private String templatedir = "Templates";
    private Map<String, Network.Interface> agentInterfaces = null;
    private Boolean istest = false;
    private Map<String, Object> rawParams = new HashMap<String, Object>();

    public Ovm3Configuration(Map<String, Object> params)
            throws ConfigurationException {
        setAgentZoneId(Long.parseLong((String) params.get("zone")));
        setAgentPodId(Long.parseLong(validateParam("PodId",
                (String) params.get("pod"))));
        setAgentClusterId(Long.parseLong((String) params.get("cluster")));
        setOvm3PoolVip(String.valueOf(params.get("ovm3vip")));
        setAgentInOvm3Pool(BooleanUtils.toBoolean((String) params
                .get("ovm3pool")));
        setAgentInOvm3Cluster(BooleanUtils.toBoolean((String) params
                .get("ovm3cluster")));
        setAgentHostname(validateParam("Hostname", (String) params.get("host")));
        setAgentIp((String) params.get("ip"));
        if (params.get("agentport") != null) {
            setAgentOvsAgentPort(Integer.parseInt((String) params
                    .get("agentport")));
        }
        setAgentSshUserName(validateParam("Username",
                (String) params.get("username")));
        setAgentSshPassword(validateParam("Password",
                (String) params.get("password")));
        setCsHostGuid(validateParam("Cloudstack Host GUID", (String) params.get("guid")));
        setAgentOvsAgentUser(validateParam("OVS Username",
                (String) params.get("agentusername")));
        setAgentOvsAgentPassword(validateParam("OVS Password",
                (String) params.get("agentpassword")));
        setAgentPrivateNetworkName((String) params
                .get("private.network.device"));
        setAgentPublicNetworkName((String) params.get("public.network.device"));
        setAgentGuestNetworkName((String) params.get("guest.network.device"));
        setAgentStorageNetworkName((String) params
                .get("storage.network.device1"));
        this.setAgentStorageCheckTimeout(NumbersUtil.parseInt(
                (String) params.get("ovm3.heartbeat.timeout"),
                agentStorageCheckTimeout));
        this.setAgentStorageCheckInterval(NumbersUtil.parseInt(
                (String) params.get("ovm3.heartbeat.interval"),
                agentStorageCheckInterval));
        validatePoolAndCluster();
        if (params.containsKey("istest")) {
            setIsTest((Boolean) params.get("istest"));
        }
    }

    /**
     * validatePoolAndCluster:
     * A cluster is impossible with a  pool.
     * A pool is impossible without a vip.
     */
    private void validatePoolAndCluster() {
        if (agentInOvm3Cluster) {
            LOGGER.debug("Clustering requires a pool, setting pool to true");
            agentInOvm3Pool = true;
        }
        if (!NetUtils.isValidIp(ovm3PoolVip)) {
            LOGGER.debug("No VIP, Setting ovm3pool and ovm3cluster to false");
            agentInOvm3Pool = false;
            agentInOvm3Cluster = false;
            ovm3PoolVip = "";
        }
    }

    public String getAgentName() {
        return agentHostname;
    }

    public void setAgentName(String agentName) {
        this.agentHostname = agentName;
    }

    public String getAgentIp() {
        return agentIp;
    }

    public void setAgentIp(String agentIp) {
        this.agentIp = agentIp;
    }

    public Long getAgentZoneId() {
        return agentZoneId;
    }

    public void setAgentZoneId(Long agentZoneId) {
        this.agentZoneId = agentZoneId;
    }

    public Long getAgentPodId() {
        return agentPodId;
    }

    public void setAgentPodId(Long agentPodId) {
        this.agentPodId = agentPodId;
    }

    public String getAgentPoolId() {
        return agentPoolId;
    }

    public void setAgentPoolId(String agentPoolId) {
        this.agentPoolId = agentPoolId;
    }

    public Long getAgentClusterId() {
        return agentClusterId;
    }

    public void setAgentClusterId(Long agentClusterId) {
        this.agentClusterId = agentClusterId;
    }

    public String getAgentHostname() {
        return agentHostname;
    }

    public void setAgentHostname(String agentHostname) {
        this.agentHostname = agentHostname;
    }

    public String getCsHostGuid() {
        return csHostGuid;
    }

    public void setCsHostGuid(String csHostGuid) {
        this.csHostGuid = csHostGuid;
    }

    public String getAgentSshUserName() {
        return agentSshUserName;
    }

    public void setAgentSshUserName(String agentSshUserName) {
        this.agentSshUserName = agentSshUserName;
    }

    public String getAgentSshPassword() {
        return agentSshPassword;
    }

    public void setAgentSshPassword(String agentSshPassword) {
        this.agentSshPassword = agentSshPassword;
    }

    public String getAgentOvsAgentUser() {
        return agentOvsAgentUser;
    }

    public void setAgentOvsAgentUser(String agentOvsAgentUser) {
        this.agentOvsAgentUser = agentOvsAgentUser;
    }

    public String getAgentOvsAgentPassword() {
        return agentOvsAgentPassword;
    }

    public void setAgentOvsAgentPassword(String agentOvsAgentPassword) {
        this.agentOvsAgentPassword = agentOvsAgentPassword;
    }

    public Integer getAgentOvsAgentPort() {
        return agentOvsAgentPort;
    }

    public void setAgentOvsAgentPort(Integer agentOvsAgentPort) {
        this.agentOvsAgentPort = agentOvsAgentPort;
    }

    public Boolean getAgentOvsAgentSsl() {
        return agentOvsAgentSsl;
    }

    public void setAgentOvsAgentSsl(Boolean agentOvsAgentSsl) {
        this.agentOvsAgentSsl = agentOvsAgentSsl;
    }

    public String getAgentSshKeyFileName() {
        return agentSshKeyFile;
    }

    public void setAgentSshKeyFileName(String agentSshFile) {
        this.agentSshKeyFile = agentSshFile;
    }

    public String getAgentOwnedByUuid() {
        return agentOwnedByUuid;
    }

    public void setAgentOwnedByUuid(String agentOwnedByUuid) {
        this.agentOwnedByUuid = agentOwnedByUuid;
    }

    public Boolean getAgentIsMaster() {
        return agentIsMaster;
    }

    public void setAgentIsMaster(Boolean agentIsMaster) {
        this.agentIsMaster = agentIsMaster;
    }

    public Boolean getAgentHasMaster() {
        return agentHasMaster;
    }

    public void setAgentHasMaster(Boolean agentHasMaster) {
        this.agentHasMaster = agentHasMaster;
    }

    public Boolean getAgentInOvm3Pool() {
        return agentInOvm3Pool;
    }

    public void setAgentInOvm3Pool(Boolean agentInOvm3Pool) {
        this.agentInOvm3Pool = agentInOvm3Pool;
    }

    public Boolean getAgentInOvm3Cluster() {
        return agentInOvm3Cluster;
    }

    public void setAgentInOvm3Cluster(Boolean agentInOvm3Cluster) {
        this.agentInOvm3Cluster = agentInOvm3Cluster;
    }

    public String getOvm3PoolVip() {
        return ovm3PoolVip;
    }

    public void setOvm3PoolVip(String ovm3PoolVip) {
        this.ovm3PoolVip = ovm3PoolVip;
    }

    public String getAgentPrivateNetworkName() {
        return agentPrivateNetworkName;
    }

    public void setAgentPrivateNetworkName(String agentPrivateNetworkName) {
        this.agentPrivateNetworkName = agentPrivateNetworkName;
    }

    public String getAgentPublicNetworkName() {
        return agentPublicNetworkName;
    }

    public void setAgentPublicNetworkName(String agentPublicNetworkName) {
        this.agentPublicNetworkName = agentPublicNetworkName;
    }

    public String getAgentGuestNetworkName() {
        return agentGuestNetworkName;
    }

    public void setAgentGuestNetworkName(String agentGuestNetworkName) {
        this.agentGuestNetworkName = agentGuestNetworkName;
    }

    public String getAgentStorageNetworkName() {
        return agentStorageNetworkName;
    }

    public void setAgentStorageNetworkName(String agentStorageNetworkName) {
        this.agentStorageNetworkName = agentStorageNetworkName;
    }

    public String getAgentControlNetworkName() {
        return agentControlNetworkName;
    }

    public void setAgentControlNetworkName(String agentControlNetworkName) {
        this.agentControlNetworkName = agentControlNetworkName;
    }

    public String getAgentOvmRepoPath() {
        return agentOvmRepoPath;
    }

    public void setAgentOvmRepoPath(String agentOvmRepoPath) {
        this.agentOvmRepoPath = agentOvmRepoPath;
    }

    public String getAgentSecStoragePath() {
        return agentSecStoragePath;
    }

    public void setAgentSecStoragePath(String agentSecStoragePath) {
        this.agentSecStoragePath = agentSecStoragePath;
    }

    public int getDomRSshPort() {
        return domRSshPort;
    }

    public void setDomRSshPort(int domRSshPort) {
        this.domRSshPort = domRSshPort;
    }

    public String getDomRCloudPath() {
        return domRCloudPath;
    }

    public void setDomRCloudPath(String domRCloudPath) {
        this.domRCloudPath = domRCloudPath;
    }
    public Boolean getIsTest() {
        return istest;
    }
    public void setIsTest(Boolean t) {
        istest = t;
    }
    public String getAgentScript() {
        return agentScript;
    }

    public void setAgentScript(String agentScript) {
        this.agentScript = agentScript;
    }

    public String getAgentScriptsDir() {
        return agentScriptsDir;
    }

    public void setAgentScriptsDir(String agentScriptsDir) {
        this.agentScriptsDir = agentScriptsDir;
    }

    public Map<String, Network.Interface> getAgentInterfaces() {
        return agentInterfaces;
    }

    public void setAgentInterfaces(Map<String, Network.Interface> agentInterfaces) {
        this.agentInterfaces = agentInterfaces;
    }
    public List<String> getAgentScripts() {
        return agentScripts;
    }

    public void setAgentScripts(List<String> agentScripts) {
        this.agentScripts = agentScripts;
    }
    public String getAgentCheckStorageScript() {
        return agentCheckStorageScript;
    }

    public void setAgentCheckStorageScript(String agentCheckStorageScript) {
        this.agentCheckStorageScript = agentCheckStorageScript;
    }
    public Integer getAgentStorageCheckTimeout() {
        return agentStorageCheckTimeout;
    }
    public void setAgentStorageCheckTimeout(Integer agentStorageCheckTimeout) {
        this.agentStorageCheckTimeout = agentStorageCheckTimeout;
    }

    public Integer getAgentStorageCheckInterval() {
        return agentStorageCheckInterval;
    }

    public void setAgentStorageCheckInterval(Integer agentStorageCheckInterval) {
        this.agentStorageCheckInterval = agentStorageCheckInterval;
    }
    public String getVirtualDiskDir() {
        return this.virtualdiskdir;
    }
    public String getTemplateDir() {
        return this.templatedir;
    }
    /**
     * ValidateParam: Validate the input for configure
     * @param name
     * @param param
     * @return param
     * @throws ConfigurationException
     */
    private String validateParam(String name, String param) throws ConfigurationException {
        if (param == null) {
            String msg = "Unable to get " + name + " params are null";
            LOGGER.debug(msg);
            throw new ConfigurationException(msg);
        }
        return param;
    }

    public Map<String, Object> getRawParams() {
        return rawParams;
    }
    public void setRawParams(Map<String, Object> params) {
        rawParams.putAll(params);
    }
}


text:
package eu.lunisolar.magma.func.tuple;

import eu.lunisolar.magma.basics.meta.LTuple;
import eu.lunisolar.magma.basics.Null;
import eu.lunisolar.magma.basics.fluent.Fluent;
import eu.lunisolar.magma.basics.meta.aType;
import eu.lunisolar.magma.basics.meta.aType.*;
import eu.lunisolar.magma.basics.meta.functional.*;
import eu.lunisolar.magma.func.*;
import eu.lunisolar.magma.func.consumer.*;  ;
import eu.lunisolar.magma.func.consumer.primitives.bi.*;
import eu.lunisolar.magma.func.consumer.primitives.tri.*;
import eu.lunisolar.magma.func.function.*;
import eu.lunisolar.magma.func.function.to.*;
import eu.lunisolar.magma.func.function.from.*;
import eu.lunisolar.magma.func.operator.unary.*;
import eu.lunisolar.magma.func.operator.binary.*;
import eu.lunisolar.magma.func.predicate.*;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import java.util.*;
import java.util.stream.*;

/**
 * Exact equivalent of input parameters used in LCharConsumer.
 */
@SuppressWarnings("UnusedDeclaration")
public interface LCharSingle extends LTuple<Character> , Comparable<LCharSingle>
  {

    int SIZE = 1;

    char value();

    default char first() {
        return value();
    }

    @Override default Character get(int index) {
        switch(index) {
            case 1: return value();
            default: throw new NoSuchElementException();
        }
    }

    default char getChar(int index) {
        switch(index) {
            case 1: return value();
            default: throw new NoSuchElementException();
        }
    }

    /** Tuple size */
    @Override default int tupleSize() {
        return SIZE;
    }

    /** Static hashCode() implementation method that takes same arguments as fields of the LCharSingle and calculates hash from it. */
    static  int argHashCode(char a) {
        final int prime = 31;
        int result = 1;
            result = prime * result + Character.hashCode(a);
        return result;
    }

    /** Static equals() implementation that takes same arguments (doubled) as fields of the LCharSingle and checks if all values are equal. */
    static  boolean argEquals(char a, char b) {
        return
            a==b;  //
    }

    /**
     * Static equals() implementation that takes two tuples and checks if they are equal.
     * Tuples are considered equal if are implementing LCharSingle interface (among others) and their LCharSingle values are equal regardless of the implementing class
     * and how many more values there are.
     */
    static  boolean argEquals(LCharSingle the, Object that) {
        return Null.equals(the, that, (one, two) -> {
                // Intentionally all implementations of LCharSingle are allowed.
            if (!(two instanceof LCharSingle)) {
                return false;
            }

            LCharSingle other = (LCharSingle) two;

            return argEquals(one.value(), other.value());
        });
    }

    /**
     * Static equals() implementation that takes two tuples and checks if they are equal.
     */
    public static  boolean tupleEquals(LCharSingle the, Object that) {
        return Null.equals(the, that, (one, two) -> {
                // Intentionally all implementations of LCharSingle are allowed.
            if (!(two instanceof LCharSingle)) {
                return false;
            }

            LCharSingle other = (LCharSingle) two;

            return  one.tupleSize() == other.tupleSize() &&
                    argEquals(one.value(), other.value());
        });
    }

    @Override default Iterator<Character> iterator() {
        return new Iterator<Character>() {

            private int index;

            @Override public boolean hasNext() {
                return index<SIZE;
            }

            @Override public Character next() {
                index++;
                return get(index);
            }
        };
    }

    default PrimitiveIterator.OfInt intIterator() {
        return new PrimitiveIterator.OfInt() {

            private int index;

            @Override public boolean hasNext() {
                return index<SIZE;
            }

            @Override public int nextInt() {
                index++;
                return getChar(index);
            }
        };
    }
        @Override
        default int compareTo(LCharSingle that) {
            return Null.compare(this, that, (one, two) -> {
                int retval = 0;

                return
                    (retval = Character.compare(one.value(), two.value())) != 0 ? retval : 0; //
            });
        }

    abstract class AbstractCharSingle implements LCharSingle {

        @Override
        public boolean equals(Object that) {
            return LCharSingle.tupleEquals(this, that);
        }

        @Override
        public int hashCode() {
            return LCharSingle.argHashCode(value());
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append('(');
                sb.append(value());
            sb.append(')');
            return sb.toString();
        }

    }

    /**
     * Mutable tuple.
     */

     interface  Mut<SELF extends Mut<SELF>>  extends LCharSingle   {

        SELF value(char value) ;

        default SELF setValue(char value) {
            this.value(value);
            return (SELF) this;
        }

        /** Sets value if predicate(newValue) OR newValue::predicate is true */
        default SELF setValueIfArg(char value, LCharPredicate predicate) {
            if (predicate.test(value())) {
                return this.value(value);
            }
            return (SELF) this;
        }

        /** Sets value derived from non-null argument, only if argument is not null. */
        default <R> SELF setValueIfArgNotNull(R arg, LToCharFunction<R> func) {
            if ( arg != null ) {
                return this.value(func.applyAsChar(arg));
            }
            return (SELF) this;
        }

        /** Sets value if predicate(current) OR current::predicate is true */
        default SELF setValueIf(LCharPredicate predicate, char value) {
            if (predicate.test(this.value())) {
                return this.value(value);
            }
            return (SELF) this;
        }

        /** Sets new value if predicate predicate(newValue, current) OR newValue::something(current) is true. */
        default SELF setValueIf(char value, LBiCharPredicate predicate) {
            // the order of arguments is intentional, to allow predicate:
            if (predicate.test(value, this.value())) {
                return this.value(value);
            }
            return (SELF) this;
        }

        /** Sets new value if predicate predicate(current, newValue) OR current::something(newValue) is true. */
        default SELF setValueIf(LBiCharPredicate predicate, char value) {
            if (predicate.test(this.value(), value)) {
                return this.value(value);
            }
            return (SELF) this;
        }

        default SELF reset()   {
                this.value('\u0000');
            return (SELF) this;
        }
    }

  public static  MutCharSingle of() {
      return of(  '\u0000' );
  }

  public static  MutCharSingle of(char a){
        return new MutCharSingle(a);
  }

  public static  MutCharSingle copyOf(LCharSingle tuple) {
        return of(tuple.value());
  }

    /**
     * Mutable, non-comparable tuple.
     */

     class  MutCharSingle  extends AbstractCharSingle implements Mut<MutCharSingle>   {

        private  char value;

        public MutCharSingle(char a){
            this.value = a;
        }

        public @Override char value() {
            return value;
        }

        public @Override MutCharSingle value(char value)    {
            this.value = value;
            return this;
        }

    }

  public static  ImmCharSingle immutableOf(char a){
        return new ImmCharSingle(a);
  }

  public static  ImmCharSingle immutableCopyOf(LCharSingle tuple) {
        return immutableOf(tuple.value());
  }

    /**
     * Immutable, non-comparable tuple.
     */
@Immutable
    final  class  ImmCharSingle  extends AbstractCharSingle    {

        private final char value;

        public ImmCharSingle(char a){
            this.value = a;
        }

        public @Override char value() {
            return value;
        }

    }

}


text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System.Collections;
using System.Collections.Generic;

namespace Microsoft.TestCommon
{
    /// <summary>
    /// Helper class for generating test data for XUnit's <see cref="Xunit.Extensions.TheoryAttribute"/>-based tests.
    /// Should be used in combination with <see cref="Xunit.Extensions.PropertyDataAttribute"/>.
    /// </summary>
    /// <typeparam name="TParam">First parameter type</typeparam>
    public class TheoryDataSet<TParam> : TheoryDataSet
    {
        public void Add(TParam p)
        {
            AddItem(p);
        }
    }

    /// <summary>
    /// Helper class for generating test data for XUnit's <see cref="Xunit.Extensions.TheoryAttribute"/>-based tests.
    /// Should be used in combination with <see cref="Xunit.Extensions.PropertyDataAttribute"/>.
    /// </summary>
    /// <typeparam name="TParam1">First parameter type</typeparam>
    /// <typeparam name="TParam2">Second parameter type</typeparam>
    public class TheoryDataSet<TParam1, TParam2> : TheoryDataSet
    {
        public void Add(TParam1 p1, TParam2 p2)
        {
            AddItem(p1, p2);
        }
    }

    /// <summary>
    /// Helper class for generating test data for XUnit's <see cref="Xunit.Extensions.TheoryAttribute"/>-based tests.
    /// Should be used in combination with <see cref="Xunit.Extensions.PropertyDataAttribute"/>.
    /// </summary>
    /// <typeparam name="TParam1">First parameter type</typeparam>
    /// <typeparam name="TParam2">Second parameter type</typeparam>
    /// <typeparam name="TParam3">Third parameter type</typeparam>
    public class TheoryDataSet<TParam1, TParam2, TParam3> : TheoryDataSet
    {
        public void Add(TParam1 p1, TParam2 p2, TParam3 p3)
        {
            AddItem(p1, p2, p3);
        }
    }

    /// <summary>
    /// Helper class for generating test data for XUnit's <see cref="Xunit.Extensions.TheoryAttribute"/>-based tests.
    /// Should be used in combination with <see cref="Xunit.Extensions.PropertyDataAttribute"/>.
    /// </summary>
    /// <typeparam name="TParam1">First parameter type</typeparam>
    /// <typeparam name="TParam2">Second parameter type</typeparam>
    /// <typeparam name="TParam3">Third parameter type</typeparam>
    /// <typeparam name="TParam4">Fourth parameter type</typeparam>
    public class TheoryDataSet<TParam1, TParam2, TParam3, TParam4> : TheoryDataSet
    {
        public void Add(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4)
        {
            AddItem(p1, p2, p3, p4);
        }
    }

    /// <summary>
    /// Helper class for generating test data for XUnit's <see cref="Xunit.Extensions.TheoryAttribute"/>-based tests.
    /// Should be used in combination with <see cref="Xunit.Extensions.PropertyDataAttribute"/>.
    /// </summary>
    /// <typeparam name="TParam1">First parameter type</typeparam>
    /// <typeparam name="TParam2">Second parameter type</typeparam>
    /// <typeparam name="TParam3">Third parameter type</typeparam>
    /// <typeparam name="TParam4">Fourth parameter type</typeparam>
    /// <typeparam name="TParam5">Fifth parameter type</typeparam>
    public class TheoryDataSet<TParam1, TParam2, TParam3, TParam4, TParam5> : TheoryDataSet
    {
        public void Add(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5)
        {
            AddItem(p1, p2, p3, p4, p5);
        }
    }

    /// <summary>
    /// Base class for <c>TheoryDataSet</c> classes.
    /// </summary>
    public abstract class TheoryDataSet : IEnumerable<object[]>
    {
        private readonly List<object[]> data = new List<object[]>();

        protected void AddItem(params object[] values)
        {
            data.Add(values);
        }

        public IEnumerator<object[]> GetEnumerator()
        {
            return data.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}


text:
namespace Azure.Messaging.EventGrid.SystemEvents
{
    /// <summary> Schema of the Data property of an EventGridEvent for an VaultAccessPolicyChanged event. </summary>
    public partial class KeyVaultAccessPolicyChangedEventData
    {
        /// <summary> Initializes a new instance of KeyVaultAccessPolicyChangedEventData. </summary>
        internal KeyVaultAccessPolicyChangedEventData()
        {
        }

        /// <summary> Initializes a new instance of KeyVaultAccessPolicyChangedEventData. </summary>
        /// <param name="id"> The id of the object that triggered this event. </param>
        /// <param name="vaultName"> Key vault name of the object that triggered this event. </param>
        /// <param name="objectType"> The type of the object that triggered this event. </param>
        /// <param name="objectName"> The name of the object that triggered this event. </param>
        /// <param name="version"> The version of the object that triggered this event. </param>
        /// <param name="nbf"> Not before date of the object that triggered this event. </param>
        /// <param name="exp"> The expiration date of the object that triggered this event. </param>
        internal KeyVaultAccessPolicyChangedEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp)
        {
            Id = id;
            VaultName = vaultName;
            ObjectType = objectType;
            ObjectName = objectName;
            Version = version;
            Nbf = nbf;
            Exp = exp;
        }

        /// <summary> The id of the object that triggered this event. </summary>
        public string Id { get; }
        /// <summary> Key vault name of the object that triggered this event. </summary>
        public string VaultName { get; }
        /// <summary> The type of the object that triggered this event. </summary>
        public string ObjectType { get; }
        /// <summary> The name of the object that triggered this event. </summary>
        public string ObjectName { get; }
        /// <summary> The version of the object that triggered this event. </summary>
        public string Version { get; }
        /// <summary> Not before date of the object that triggered this event. </summary>
        public float? Nbf { get; }
        /// <summary> The expiration date of the object that triggered this event. </summary>
        public float? Exp { get; }
    }
}