text:
Installing GeoMesa Redis
========================

.. note::

    GeoMesa currently supports Redis version |redis_version|.

.. note::

    The examples below expect a version to be set in the environment:

    .. parsed-literal::

        $ export TAG="|release_version|"
        # note: |scala_binary_version| is the Scala build version
        $ export VERSION="|scala_binary_version|-${TAG}"

Installing the Binary Distribution
----------------------------------

GeoMesa Redis artifacts are available for download or can be built from source.
The easiest way to get started is to download the most recent binary version from `GitHub`__.

__ https://github.com/locationtech/geomesa/releases

Download and extract it somewhere convenient:

.. code-block:: bash

    # download and unpackage the most recent distribution:
    $ wget "https://github.com/locationtech/geomesa/releases/download/geomesa-${TAG}/geomesa-redis_${VERSION}-bin.tar.gz"
    $ tar xvf geomesa-redis_${VERSION}-bin.tar.gz
    $ cd geomesa-redis_${VERSION}

.. _redis_install_source:

Building from Source
--------------------

GeoMesa Redis may also be built from source. For more information refer to :ref:`building_from_source`
in the developer manual, or to the ``README.md`` file in the the source distribution.
The remainder of the instructions in this chapter assume the use of the binary GeoMesa Redis
distribution. If you have built from source, the distribution is created in the ``target`` directory of
``geomesa-redis/geomesa-redis-dist``.

More information about developing with GeoMesa may be found in the :doc:`/developer/index`.

.. _setting_up_redis_commandline:

Setting up the Redis Command Line Tools
---------------------------------------

GeoMesa comes with a set of command line tools for managing Redis features located in
``geomesa-redis_${VERSION}/bin/`` of the binary distribution.

.. note::

    See :ref:`slf4j_configuration` for information about configuring the SLF4J implementation.

Test the command that invokes the GeoMesa Tools:

.. code-block:: bash

    $ ./bin/geomesa-redis

The output should look like this::

    INFO  Usage: geomesa-redis [command] [command options]
      Commands:
      ...

For more details on the available commands, see :ref:`redis_tools`.

Due to licensing restrictions, dependencies for shape file support must be separately installed.
Do this with the following command:

.. code-block:: bash

    $ ./bin/install-shapefile-support.sh

Use the ``geomesa-redis classpath`` command in order to see what JARs are being used.

If the classpath needs to be modified, ``geomesa-redis`` will pull additional entries from the
``GEOMESA_EXTRA_CLASSPATHS`` environment variable, if it is defined.

Note that the ``GEOMESA_EXTRA_CLASSPATHS`` variable follows standard
`Java Classpath <http://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html>`_ conventions, which
generally means that entries must be directories, JAR, or zip files. Individual XML files will be ignored. For example,
to add a ``core-site.xml`` file to the classpath you must either include a directory on the
classpath or add the file to a zip or JAR archive to be included on the classpath.

.. _install_redis_geoserver:

Installing GeoMesa Redis in GeoServer
-------------------------------------

.. warning::

    See :ref:`geoserver_versions` to ensure that GeoServer is compatible with your GeoMesa version.

The Redis GeoServer plugin is bundled by default in a GeoMesa binary distribution. To install, extract
``$GEOMESA_REDIS_HOME/dist/gs-plugins/geomesa-redis-gs-plugin_${VERSION}-install.tar.gz`` into GeoServer's
``WEB-INF/lib`` directory.

Restart GeoServer after the JARs are installed. See :doc:`/user/redis/geoserver` for details on configuring stores
and layers.


text:
/**
 spectra_dataset.h
 Purpose: This file defines the class SpectraDataset. This class contains the variables necessary to store a generic spectra dataset. This class is a specialization of the Dataset class

 @author Ignasi Pérez-Ràfols (iprafols@icc.ub.edu)
 @version 1.0 10/02/2014

 */

#ifndef _SpectraDataset_h
#define _SpectraDataset_h

// libraries needed
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <stdio.h>
#include <vector>
////////

// classes needed
#include "dataset.h"
#include "input.h"
#include "z_dist_interpolation_map.h"
#include "lya_spectrum.h"
////////

// functions needed
////////

#include "typedefs.h"

class SpectraDataset: public Dataset{

public:

    // -------------------------------------------------------------
    // access methods

    // access functions for list_
    PlatesMapVector<LyaSpectrum>::map list() const {return list_;}
    std::vector<LyaSpectrum> list(int plate_number) const;
    LyaSpectrum list(int plate_number, size_t pos) const;

    // -------------------------------------------------------------
    // other methods

    // adds the objects' RA-DEC values to ostream
    void GiveRADEC(std::ostream& out) const;

    // adds the objects' redshift values to ostream
    void GiveZ(std::ostream& out) const;

    // load the dataset
    virtual void Load(const std::string& object_list, const std::string& lya_spectra_dir, const double& lya_wl) =0;

    // set the distance to every object in the dataset
    void SetDistances(const ZDistInterpolationMap& redshift_distance_map);

protected:
    // map with the plates information
    PlatesMapVector<LyaSpectrum>::map list_;

};

#endif

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace FormKit\Widget;
use FormKit\FormKit;
use FormKit\Element;
use Exception;
use InvalidArgumentException;

/**
 * BaseWidget defines the basic features of a widget,
 *
 *
 * Synopsis
 * ========
 *
 *     // create a widget with 'name'
 *     $widget = new FooInput('name');
 *
 *     // create a widget with 'name' and attributes or options
 *     $widget = new FooInput('name',array( ...attributes ... ));
 *
 * Attributes and Options
 * ======================
 *
 * If the name is the same as the class property name,
 * the value will be stored into the property.
 *
 * If the name is not a class property name,
 * the value will be stored into the $this->_attributes array.
 *
 *
 * Attribute Value
 * ======================
 *
 * Attribute value can be an associative-array, an indexed-array or
 * a boolean value.
 *
 * An associative-array contains key-value pair, which is treated as a style
 * property:
 *
 *    'style' => array( 'border' => '1px solid #ccc' );
 *
 * Which is rendered as:
 *
 *    "style"="border: 1px solid #ccc;"
 *
 * An indexed-array contains values with index numbers:
 *
 *    "class" => array("class1", "class2", "class3")
 *
 * Which is rendered as:
 *
 *    "class"="class1 class2 class3"
 *
 * A boolean value is rendered as:
 *
 *    "readonly"="readonly"
 *
 *
 * Attribute Rendering
 * ======================
 *
 *
 *
 *
 * Widget Initialization Flow
 * ==========================
 *
 * Below is the widget construction flow:
 *
 * BaseWidget::__construct
 *  (parent) Element::__construct
 * BaseWidget::init
 *  (parent) Element::init
 *
 */
abstract class BaseWidget extends Element
{

    /**
     * @var string field name
     */
    public $name;

    public $useSerialId = false;

    /**
     * @var array Style sheet paths
     */
    protected $stylesheets = array();

    /**
     * @var array js files
     */
    protected $js = array();

    /**
     * Widget options, widgets may declare its option names
     * so that when setting attributes, these options won't be set into the
     * attributes.
     */
    protected $optionNames = array();

    protected $customAttributes = array('name');

    /**
     *
     * @param string $name
     * @param array $attributes
     *
     *    valid attributes:
     *      - name
     *      - type
     *      - value
     *      - hint
     *      - tooltip
     *      - disabled
     *      - readonly
     *      - placeholder
     */
    public function __construct()
    {
        $args = func_get_args();
        $attributes = array();

        //  new FooInput('name',array( ...attributes ... ));
        if ( 2 === count($args) ) {
            $this->name = $args[0];
            if( $args[1] && is_array($args[1]) ) {
                $attributes = $args[1];
            }
        }
        elseif ( 1 === count($args) ) {
            $arg = $args[0];
            if ( is_string($arg) ) {
                $this->name = $arg;
            } elseif ( is_array($arg) ) {
                $attributes = $arg;
            } else {
                throw new InvalidArgumentException('Unsupported argument type');
            }
        }

        if ( ! $this->tagName ) {
            throw new Exception("tagName is not defined in " . get_class($this) );
        }
        parent::__construct($this->tagName,$attributes); // create element
    }

    protected function init($attributes)
    {
        $this->setAttributeType( 'name', self::ATTR_STRING );
        $this->setAttributeType( 'type', self::ATTR_STRING );

        // virtual attribute (not for rendering widget elements )
        $this->setAttributeType( 'label'       , self::ATTR_STRING );
        $this->setAttributeType( 'hint'        , self::ATTR_STRING );
        $this->setAttributeType( 'tooltip'     , self::ATTR_STRING );
        $this->setAttributeType( 'disabled'    , self::ATTR_FLAG );
        $this->setAttributeType( 'readonly'    , self::ATTR_FLAG );
        $this->setAttributeType( 'placeholder' , self::ATTR_STRING );

        if( $this->useSerialId ) {
            $id = $this->getSerialId();
        }
        parent::init($attributes);
    }

    /**
     * Set attributes
     *
     */
    public function setAttributes($as)
    {
        // filter out options
        $intersects = array_intersect(array_keys($as),$this->optionNames);
        foreach( $intersects as $k ) {
            unset($as[$k]);
        }
        parent::setAttributes($as);
    }

    public function getStylesheets()
    {
        $path = FormKit::$assetPath;
        return array_map(function($file) use($path) {
                return $path ? $path . '/' . $file : $file;
            }, (array) $this->stylesheets );
    }

    public function addStylesheet($css) {
        $this->stylesheets[] = $css;
        return $this;
    }

    public function getJavascripts()
    {
        $path = FormKit::$assetPath;
        return array_map(function($file) use($path) {
                return $path ? $path . '/' . $file : $file;
            }, (array) $this->js );
    }

    public function addJavascript($js) {
        $this->js[] = $js;
        return $this;
    }

    /**
     * Get a new serial id
     */
    public function getSerialId()
    {
        if($this->id)
            return $this->id;
        $id = $this->generateSerialId();
        $this->setId( $id );
        return $id;
    }

    public function convertClassToCssClassName()
    {
        return str_replace('\\', '-', strtolower( get_class($this))  );
    }

    public function generateSerialId()
    {
        return uniqid($this->name ?: 'widget_');
    }

    public function getName()
    {
        return $this->name;
    }

}


text:
treeNode *constructTree(int key, treeNode *left, treeNode *right) {
   treeNode *node = (treeNode *)malloc(sizeof(treeNode));
   if (node == NULL) {
      fprintf(stderr, "tree.c:5 | ERROR 03: Memory allocation unsuccessful");
      return NULL;
   }

   //Constructing root node
   node->value = key;
   node->left = left;
   node->right = right;

   return node;
}

//Deconstructing a tree
void destructTree(treeNode *node) {
   if (node == NULL)
      return;

   //postorder free
   destructTree(node->left);
   destructTree(node->right);
   free(node);
}

//Checking if node is a leaf
int isLeaf(treeNode *node) {
   if (node != NULL) { //node exists
      //If the left and right nodes don't exists, return TRUE
      if (node->left == NULL && node->right == NULL)
         return TRUE;
      //Otherwise return FALSE
      else
         return FALSE;
   }

   //Input is NULL
   return EXCEPTION;
}


text:
@interface ESFlatButton()
{
    BOOL _secondDraw;
    __strong UIColor *_backgroundColor;
}
UIColor *_ESFlatButtontint(UIColor *clr, UIColor *tintColor);
void _ESFlatButtonCGContextAddRoundRect(CGContextRef context, CGRect rect, float radius);
@end

@implementation ESFlatButton
@synthesize innerBevelHeight=_innerBevelHeight,outerBevelColor=_outerBevelColor,cornerRadius=_cornerRadius,innerBevelColor=_innerBevelColor,outerBevelHeight=_outerBevelHeight,highlightColor=_highlightColor,selectedColor=_selectedColor,pressedWhenSelected=_pressedWhenSelected;

#pragma mark - Properties
// ____________________________________________________________________________________________________________________

- (void)setPressedWhenSelected:(BOOL)aPressedWhenSelected
{
    _pressedWhenSelected = aPressedWhenSelected;
    [self setNeedsDisplay];
}

- (void)setBackgroundColor:(UIColor *)aBackgroundColor
{
    _backgroundColor = aBackgroundColor;
    [self setNeedsDisplay];
}

- (void)setHighlightColor:(UIColor *)anHighlightColor
{
    _highlightColor = anHighlightColor;
    [self setNeedsDisplay];
}

- (void)setSelectedColor:(UIColor *)aSelectedColor
{
    _selectedColor = aSelectedColor;
    [self setNeedsDisplay];
}

- (UIColor *)backgroundColor
{
    return _backgroundColor;
}

- (void)setInnerBevelHeight:(CGFloat)anInnerBevelHeight
{
    _innerBevelHeight = anInnerBevelHeight;
    [self setNeedsDisplay];
}

- (void)setOuterBevelColor:(UIColor *)anOuterBevelColor
{
    _outerBevelColor = anOuterBevelColor;
    [self setNeedsDisplay];
}

- (void)setInnerBevelColor:(UIColor *)anInnerBevelColor
{
    _innerBevelColor = anInnerBevelColor;
    [self setNeedsDisplay];
}

- (void)setCornerRadius:(CGFloat)aCornerRadius
{
    _cornerRadius = aCornerRadius;
    [self setNeedsDisplay];
}

- (void)setOuterBevelHeight:(CGFloat)anOuterBevelHeight
{
    _outerBevelHeight = anOuterBevelHeight;
    [self _correctInsets];
    [self setNeedsDisplay];
}

- (void)_correctInsets
{
   if (self.isHighlighted) {
        [self setContentEdgeInsets:UIEdgeInsetsMake(self.outerBevelHeight, 0, 0, 0)];
    } else {
        [self setContentEdgeInsets:UIEdgeInsetsMake(0, 0, self.outerBevelHeight, 0)];
    }
}

- (void)setHighlighted:(BOOL)highlighted
{
    [super setHighlighted:highlighted];
    [self _correctInsets];
    [self setNeedsDisplay];
}

- (void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    [self _correctInsets];
    [self setNeedsDisplay];
}

#pragma mark - Drawing
// ____________________________________________________________________________________________________________________

- (void)drawRect:(CGRect)rect
{
    // First draw?
    if (!_secondDraw) {
        if (self.outerBevelHeight == 0) {
            self.outerBevelHeight = 3.0f;
        }
        if (_backgroundColor == nil) {
            _backgroundColor = [UIColor whiteColor];
        }
        _secondDraw = YES;
    }

    // Figure out what background color the button should have
    UIColor *bgColor = _backgroundColor;
    if (self.isHighlighted && self.highlightColor != nil) {
        bgColor = self.highlightColor;

    } else if (self.isSelected && self.selectedColor != nil) {
        bgColor = self.selectedColor;
    }

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGRect r = rect;
    CGFloat bh = self.outerBevelHeight;
    UIColor *bevelColor;
    // Figure out what (inner or outer) bevel color should be used
    if (self.isHighlighted || (self.isSelected && self.pressedWhenSelected)) {
        if (self.innerBevelColor == nil) {
            bevelColor = _ESFlatButtontint(bgColor, [UIColor colorWithRed:1 green:1 blue:1 alpha:.15]);
        } else {
            bevelColor = self.innerBevelColor;
        }
        bh = self.innerBevelHeight;
    } else {
        if (self.outerBevelColor == nil) {
            bevelColor = _ESFlatButtontint(bgColor, [UIColor colorWithRed:0 green:0 blue:0 alpha:.35]);
        } else {
            bevelColor = self.outerBevelColor;
        }
    }

    // Draw the bevel
    CGContextSetFillColorWithColor(context, bevelColor.CGColor);
    r.origin.y = 10;
    r.size.height = rect.size.height - r.origin.y;
    _ESFlatButtonCGContextAddRoundRect(context, r, self.cornerRadius);
    CGContextFillPath(context);

    // Draw the actual button
    CGContextSetFillColorWithColor(context, bgColor.CGColor);
    r.origin.y = self.outerBevelHeight - bh;
    r.size.height = rect.size.height - (r.origin.y + bh);
    _ESFlatButtonCGContextAddRoundRect(context, r, self.cornerRadius);
    CGContextFillPath(context);
}

#pragma mark - Helpers
// ____________________________________________________________________________________________________________________

void _ESFlatButtonCGContextAddRoundRect(CGContextRef context, CGRect rect, float radius)
{
    if (radius == 0) {
        CGContextAddRect(context, rect);
        return;
    }
    CGContextMoveToPoint(context, rect.origin.x, rect.origin.y + radius);
    CGContextAddLineToPoint(context, rect.origin.x, rect.origin.y + rect.size.height - radius);
    CGContextAddArc(context, rect.origin.x + radius, rect.origin.y + rect.size.height - radius, radius, M_PI / 4, M_PI / 2, 1);
    CGContextAddLineToPoint(context, rect.origin.x + rect.size.width - radius, rect.origin.y + rect.size.height);
    CGContextAddArc(context, rect.origin.x + rect.size.width - radius, rect.origin.y + rect.size.height - radius, radius, M_PI / 2, 0.0f, 1);
    CGContextAddLineToPoint(context, rect.origin.x + rect.size.width, rect.origin.y + radius);
    CGContextAddArc(context, rect.origin.x + rect.size.width - radius, rect.origin.y + radius, radius, 0.0f, -M_PI / 2, 1);
    CGContextAddLineToPoint(context, rect.origin.x + radius, rect.origin.y);
    CGContextAddArc(context, rect.origin.x + radius, rect.origin.y + radius, radius, -M_PI / 2, M_PI, 1);
}

UIColor *_ESFlatButtontint(UIColor *clr, UIColor *tintColor)
{
    CGFloat r, g, b, alpha;
    [tintColor getRed:&r green:&g blue:&b alpha:&alpha];

    alpha = MIN(1.0, MAX(0.0, alpha));
    CGFloat beta = 1.0 - alpha;
    CGFloat r1, g1, b1, a1, r2, g2, b2, a2;
    [clr getRed:&r1 green:&g1 blue:&b1 alpha:&a1];
    [tintColor getRed:&r2 green:&g2 blue:&b2 alpha:&a2];
    CGFloat red     = r1 * beta + r2 * alpha;
    CGFloat green   = g1 * beta + g2 * alpha;
    CGFloat blue    = b1 * beta + b2 * alpha;
    alpha   = a1 + (a2 * alpha);
    return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}

@end


text:
package org.xtreemfs.foundation;

import java.util.Map;

/**
 *
 * @author bjko
 */
public class CrashReporter {

    public static void reportXtreemFSCrash(String report) {
        /*try {
            URL u = new URL("http://www.xtreemfs.org/dump/dump.php?srv=server");
            HttpURLConnection con = (HttpURLConnection) u.openConnection();
            con.setRequestMethod("PUT");
            con.setDoOutput(true);
            con.connect();
            OutputStream os = con.getOutputStream();
            os.write(report.getBytes());
            os.flush();
            os.close();

            InputStream is = con.getInputStream();
            is.available();
            is.close();
        } catch (Throwable th) {
            System.out.println("cannot send crash report: "+th);
        }*/
    }

    public static String createCrashReport(String service, String version, Throwable cause) {
        try {
            StringBuilder report = new StringBuilder();
            report.append("----------------------------------------------------------------\n");
            report.append("We are sorry, but your "+service+" has crashed. To report this bug\n");
            report.append("please go to http://www.xtreemfs.org and file an issue and attach\n");
            report.append("this crash report.\n\n");
            report.append("service: ");
            report.append(service);
            report.append("    version: ");
            report.append(version);
            report.append("\n");
            report.append("JVM version: ");
            report.append(System.getProperty("java.version"));
            report.append(" ");
            report.append(System.getProperty("java.vendor"));
            report.append(" on ");
            report.append(System.getProperty("os.name"));
            report.append(" ");
            report.append(System.getProperty("os.version"));
            report.append("\n");
            report.append("exception: ");
            report.append(cause.toString());
            report.append("\n");
            for (StackTraceElement elem : cause.getStackTrace()) {
                report.append(elem.toString());
                report.append("\n");
            }
            if (cause.getCause() != null) {
                report.append("\nroot cause: ");
                report.append(cause.getCause());
                report.append("\n");
                for (StackTraceElement elem : cause.getCause().getStackTrace()) {
                    report.append(elem.toString());
                    report.append("\n");
                }
            }
            reportThreadStates(report);

            report.append("----------------------------------------------------------------\n");
            return report.toString();
        } catch (Exception ex) {
            ex.printStackTrace();
            return "Could not write crash report for: "+service+","+version+","+cause+" due to "+ex;
        }
    }

    /** Logs the stack trace of each thread into {@code report}. */
    public static void reportThreadStates(StringBuilder report) {
        report.append("\n--- THREAD STATES ---\n");
        final Map<Thread,StackTraceElement[]> traces =  Thread.getAllStackTraces();
        for (Thread t : traces.keySet()) {
            report.append("thread: ");
            report.append(t.getName());
            report.append("\n");
            for (StackTraceElement e : traces.get(t)) {
                report.append(e.toString());
                report.append("\n");
            }
            report.append("\n");
        }
    }

}


text:
.class public interface abstract Landroid/widget/Adapter;
.super Ljava/lang/Object;
.source "Adapter.java"

# static fields
.field public static final IGNORE_ITEM_VIEW_TYPE:I = -0x1

.field public static final NO_SELECTION:I = -0x80000000

# virtual methods
.method public getAutofillOptions()[Ljava/lang/CharSequence;
    .locals 1

    const/4 v0, 0x0

    return-object v0
.end method

.method public abstract getCount()I
.end method

.method public abstract getItem(I)Ljava/lang/Object;
.end method

.method public abstract getItemId(I)J
.end method

.method public abstract getItemViewType(I)I
.end method

.method public abstract getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
.end method

.method public abstract getViewTypeCount()I
.end method

.method public abstract hasStableIds()Z
.end method

.method public abstract isEmpty()Z
.end method

.method public abstract registerDataSetObserver(Landroid/database/DataSetObserver;)V
.end method

.method public abstract unregisterDataSetObserver(Landroid/database/DataSetObserver;)V
.end method


text:
package com.getui.logful.appender;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

import com.getui.logful.layout.Layout;
import com.getui.logful.util.LogUtil;

public abstract class AbstractOutputStreamAppender<M extends OutputStreamManager> extends AbstractAppender {

    protected final boolean immediateFlush;

    private final M manager;

    private final ReadWriteLock rwLock = new ReentrantReadWriteLock();

    private final Lock readLock = rwLock.readLock();

    private boolean isWriting;

    protected AbstractOutputStreamAppender(String loggerName, Layout layout, boolean ignoreExceptions,
            final boolean immediateFlush, final M manager) {
        super(loggerName, layout, ignoreExceptions);
        this.manager = manager;
        this.immediateFlush = immediateFlush;
        this.isWriting = false;
    }

    public M getManager() {
        return manager;
    }

    @Override
    public void start() {
        super.start();
    }

    @Override
    public void stop() {
        super.stop();
        manager.release();
    }

    @Override
    public boolean writing() {
        return isWriting;
    }

    @Override
    public synchronized void append(LogEvent logEvent) {
        readLock.lock();
        isWriting = true;
        try {
            final byte[] bytes = getLayout().toBytes(logEvent);
            if (bytes.length > 0) {
                manager.write(bytes);
                if (this.immediateFlush) {
                    manager.flush();
                }
            }
        } catch (final AppenderLoggingException e) {
            LogUtil.e("AbstractOutputStreamAppender", "", e);
        } finally {
            isWriting = false;
            readLock.unlock();
        }
    }
}


text:
@interface MEMERealTimeData : MEMEData

@property UInt8 fitError; // 0: 正常 1: 装着エラー
@property UInt8 isWalking;

@property UInt8 powerLeft; // 5: フル充電 0: 空

@property UInt8 eyeMoveUp;
@property UInt8 eyeMoveDown;
@property UInt8 eyeMoveLeft;
@property UInt8 eyeMoveRight;

@property UInt8 blinkSpeed;    // in ms
@property UInt8 blinkStrength;

@property float roll;
@property float pitch;
@property float yaw;

@property SInt8 accX;
@property SInt8 accY;
@property SInt8 accZ;

@end


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

<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

001
016package squidpony.squidmath;
017
018import squidpony.StringConvert;
019import squidpony.StringKit;
020import squidpony.annotation.GwtIncompatible;
021
022import java.io.Serializable;
023import java.util.Arrays;
024
025/** A resizable, ordered or unordered variable-length int array. Avoids boxing that occurs with ArrayList of Integer.
026 * If unordered, this class avoids a memory copy when removing elements (the last element is moved to the removed
027 * element's position).
028 * <br>
029 * Was called IntArray in libGDX; to avoid confusion with the fixed-length primitive array type, VLA (variable-length
030 * array) was chosen as a different name.
031 * Copied from LibGDX by Tommy Ettinger on 10/1/2015.
032 * @author Nathan Sweet */
033public class IntVLA implements Serializable, Cloneable {
034    private static final long serialVersionUID = -2948161891082748626L;
035
036    public int[] items;
037    public int size;
038
039    /** Creates an ordered array with a capacity of 16. */
040    public IntVLA() {
041        this(16);
042    }
043
044    /** Creates an ordered array with the specified capacity. */
045    public IntVLA(int capacity) {
046        items = new int[capacity];
047    }
048
049    /** Creates a new array containing the elements in the specific array. The new array will be ordered if the specific array is
050     * ordered. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be
051     * grown. */
052    public IntVLA(IntVLA array) {
053        size = array.size;
054        items = new int[size];
055        System.arraycopy(array.items, 0, items, 0, size);
056    }
057
058    /** Creates a new ordered array containing the elements in the specified array. The capacity is set to the number of elements,
059     * so any subsequent elements added will cause the backing array to be grown. */
060    public IntVLA(int[] array) {
061        this(array, 0, array.length);
062    }
063
064    /** Creates a new array containing the elements in the specified array. The capacity is set to the number of elements, so any
065     * subsequent elements added will cause the backing array to be grown.
066     * @param array the int array to copy from
067     * @param startIndex the first index in array to copy from
068     * @param count the number of ints to copy from array into this IntVLA
069     */
070    public IntVLA(int[] array, int startIndex, int count) {
071        this(count);
072        size = count;
073        System.arraycopy(array, startIndex, items, 0, count);
074    }
075
076    public void add (int value) {
077        int[] items = this.items;
078        if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
079        items[size++] = value;
080    }
081
082    public void addAll (IntVLA array) {
083        addAll(array, 0, array.size);
084    }
085
086    public void addAll (IntVLA array, int offset, int length) {
087        if (offset + length > array.size)
088            throw new IllegalArgumentException("offset + length must be <= size: " + offset + " + " + length + " <= " + array.size);
089        addAll(array.items, offset, length);
090    }
091
092    public void addAll (int... array) {
093        addAll(array, 0, array.length);
094    }
095
096    public void addAll (int[] array, int offset, int length) {
097        int[] items = this.items;
098        int sizeNeeded = size + length;
099        if (sizeNeeded > items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f)));
100        System.arraycopy(array, offset, items, size, length);
101        size += length;
102    }
103
104    public void addRange (int start, int end) {
105        int[] items = this.items;
106        int sizeNeeded = size + end - start;
107        if (sizeNeeded > items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f)));
108        for(int r = start, i = size; r < end; r++, i++)
109        {
110            items[i] = (int)r;
111        }
112        size += end - start;
113    }
114
115    public void addFractionRange (int start, int end, int fraction) {
116        int[] items = this.items;
117        int sizeNeeded = size + (end - start) / fraction + 2;
118        if (sizeNeeded > items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f)));
119        for(int r = start, i = size; r < end; r = fraction * ((r / fraction) + 1), i++, size++)
120        {
121            items[i] = r;
122        }
123    }
124
125    public int get (int index) {
126        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
127        return items[index];
128    }
129
130    public void set (int index, int value) {
131        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
132        items[index] = value;
133    }
134
135    /**
136     * Adds value to the item in the IntVLA at index. Calling it "add" would overlap with the collection method.
137     * @param index
138     * @param value
139     */
140    public void incr (int index, int value) {
141        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
142        items[index] += value;
143    }
144
145    public void mul (int index, int value) {
146        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
147        items[index] *= value;
148    }
149
150    public void insert (int index, int value) {
151        if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size);
152        int[] items = this.items;
153        if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
154        System.arraycopy(items, index, items, index + 1, size - index);
155        size++;
156        items[index] = value;
157    }
158
159    public void swap (int first, int second) {
160        if (first >= size) throw new IndexOutOfBoundsException("first can't be >= size: " + first + " >= " + size);
161        if (second >= size) throw new IndexOutOfBoundsException("second can't be >= size: " + second + " >= " + size);
162        int[] items = this.items;
163        int firstValue = items[first];
164        items[first] = items[second];
165        items[second] = firstValue;
166    }
167
168    /**
169     * Given an array or varargs of replacement indices for the values of this IntVLA, reorders this so the first item
170     * in the returned version is the same as {@code get(ordering[0])} (with some care taken for negative or too-large
171     * indices), the second item in the returned version is the same as {@code get(ordering[1])}, etc.
172     * <br>
173     * Negative indices are considered reversed distances from the end of ordering, so -1 refers to the same index as
174     * {@code ordering[ordering.length - 1]}. If ordering is smaller than this IntVLA, only the indices up to the
175     * length of ordering will be modified. If ordering is larger than this IntVLA, only as many indices will be
176     * affected as this IntVLA's size, and reversed distances are measured from the end of this IntVLA instead of the
177     * end of ordering. Duplicate values in ordering will produce duplicate values in the returned IntVLA.
178     * <br>
179     * This method modifies this IntVLA in-place and also returns it for chaining.
180     *
181     * @param ordering an array or varargs of int indices, where the nth item in ordering changes the nth item in this
182     *                 IntVLA to have the value currently in this IntVLA at the index specified by the value in ordering
183     * @return this for chaining, after modifying it in-place
184     */
185    public IntVLA reorder (int... ordering) {
186        int ol;
187        if (ordering == null || (ol = Math.min(size, ordering.length)) == 0)
188            return this;
189        int[] items = this.items, alt = new int[ol];
190        for (int i = 0; i < ol; i++) {
191            alt[i] = items[(ordering[i] % ol + ol) % ol];
192        }
193        System.arraycopy(alt, 0, items, 0, ol);
194        return this;
195    }
196
197    public boolean contains (int value) {
198        int i = size - 1;
199        int[] items = this.items;
200        while (i >= 0)
201            if (items[i--] == value) return true;
202        return false;
203    }
204
205    public int indexOf (int value) {
206        int[] items = this.items;
207        for (int i = 0, n = size; i < n; i++)
208            if (items[i] == value) return i;
209        return -1;
210    }
211
212    public int lastIndexOf (int value) {
213        int[] items = this.items;
214        for (int i = size - 1; i >= 0; i--)
215            if (items[i] == value) return i;
216        return -1;
217    }
218
219    /**
220     * Removes the first occurrence of the requested value, and returns the index it was removed at (-1 if not found)
221     * @param value a value in this IntVLA to remove
222     * @return the index the value was found and removed at, or -1 if it was not present
223     */
224    public int removeValue (int value) {
225        int[] items = this.items;
226        for (int i = 0, n = size; i < n; i++) {
227            if (items[i] == value) {
228                removeIndex(i);
229                return i;
230            }
231        }
232        return -1;
233    }
234
235    /** Removes and returns the item at the specified index. */
236    public int removeIndex (int index) {
237        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
238        int[] items = this.items;
239        int value = items[index];
240        size--;
241        System.arraycopy(items, index + 1, items, index, size - index);
242        return value;
243    }
244
245    /** Removes the items between the specified indices, inclusive. */
246    public void removeRange (int start, int end) {
247        if (end >= size) throw new IndexOutOfBoundsException("end can't be >= size: " + end + " >= " + size);
248        if (start > end) throw new IndexOutOfBoundsException("start can't be > end: " + start + " > " + end);
249        int[] items = this.items;
250        int count = end - start + 1;
251        System.arraycopy(items, start + count, items, start, size - (start + count));
252        size -= count;
253    }
254
255    /** Removes from this array all of elements contained in the specified array.
256     * @return true if this array was modified. */
257    public boolean removeAll (IntVLA array) {
258        int size = this.size;
259        int startSize = size;
260        int[] items = this.items;
261        for (int i = 0, n = array.size; i < n; i++) {
262            int item = array.get(i);
263            for (int ii = 0; ii < size; ii++) {
264                if (item == items[ii]) {
265                    removeIndex(ii);
266                    size--;
267                    break;
268                }
269            }
270        }
271        return size != startSize;
272    }
273
274
275    /** Moves the item at the specified index to the first index and returns it. */
276    public int moveToFirst (int index) {
277        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
278        int[] items = this.items;
279        int value = items[index];
280        if(index == 0) return value;
281        System.arraycopy(items, 0, items, 1, index);
282        items[0] = value;
283        return value;
284    }
285
286    /** Moves the item at the specified index to the last index and returns it. */
287    public int moveToLast (int index) {
288        if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
289        int[] items = this.items;
290        int value = items[index];
291        if(index == size - 1) return value;
292        System.arraycopy(items, index + 1, items, index, size - index - 1);
293        items[size - 1] = value;
294        return value;
295    }
296
297    /** Removes and returns the last item. */
298    public int pop () {
299        return items[--size];
300    }
301
302    /** Returns the last item. */
303    public int peek () {
304        return items[size - 1];
305    }
306
307    /** Returns the first item. */
308    public int first () {
309        if (size == 0) throw new IllegalStateException("IntVLA is empty.");
310        return items[0];
311    }
312
313    public void clear () {
314        size = 0;
315    }
316
317    /** Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items have
318     * been removed, or if it is known that more items will not be added.
319     * @return {@link #items} */
320    public int[] shrink () {
321        if (items.length != size) resize(size);
322        return items;
323    }
324
325    /** Increases the size of the backing array to accommodate the specified number of additional items. Useful before adding many
326     * items to avoid multiple backing array resizes.
327     * @return {@link #items} */
328    public int[] ensureCapacity (int additionalCapacity) {
329        int sizeNeeded = size + additionalCapacity;
330        if (sizeNeeded > items.length) resize(Math.max(8, sizeNeeded));
331        return items;
332    }
333
334    /** Sets the array size, leaving any values beyond the current size undefined.
335     * @return {@link #items} */
336    public int[] setSize (int newSize) {
337        if (newSize > items.length) resize(Math.max(8, newSize));
338        size = newSize;
339        return items;
340    }
341
342    protected int[] resize (int newSize) {
343        int[] newItems = new int[newSize];
344        int[] items = this.items;
345        System.arraycopy(items, 0, newItems, 0, Math.min(size, newItems.length));
346        this.items = newItems;
347        return newItems;
348    }
349
350    public void sort () {
351        Arrays.sort(items, 0, size);
352    }
353
354    public void reverse () {
355        int[] items = this.items;
356        for (int i = 0, lastIndex = size - 1, n = size / 2; i < n; i++) {
357            int ii = lastIndex - i;
358            int temp = items[i];
359            items[i] = items[ii];
360            items[ii] = temp;
361        }
362    }
363
364    /** Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is
365     * taken. */
366    public void truncate (int newSize) {
367        if (size > newSize) size = newSize;
368    }
369
370    public int getRandomElement(RNG random)
371    {
372        return items[random.nextInt(items.length)];
373    }
374
375    /**
376     * Shuffles this IntVLA in place using the given RNG.
377     * @param random an RNG used to generate the shuffled order
378     * @return this object, modified, after shuffling
379     */
380    public IntVLA shuffle(RNG random)
381    {
382        int n = size;
383        for (int i = 0; i < n; i++)
384        {
385            swap(i + random.nextInt(n - i), i);
386        }
387        return this;
388
389    }
390
391    public int[] toArray () {
392        int[] array = new int[size];
393        System.arraycopy(items, 0, array, 0, size);
394        return array;
395    }
396
397    public IntVLA copy()
398    {
399        return new IntVLA(this);
400    }
401
402    @GwtIncompatible
403    @SuppressWarnings("unchecked")
404    @Override
405    public Object clone() {
406        try {
407            IntVLA nx = (IntVLA) super.clone();
408            nx.items = new int[items.length];
409            System.arraycopy(items, 0, nx.items, 0, items.length);
410            return nx;
411        } catch (CloneNotSupportedException e) {
412            throw new InternalError(e + (e.getMessage() != null ? "; " + e.getMessage() : ""));
413        }
414    }
415    @Override
416    public int hashCode () {
417        int[] items = this.items;
418        int h = 1;
419        for (int i = 0, n = size; i < n; i++)
420            h = h * 31 + items[i];
421        return h;
422    }
423    public int hashWisp () {
424        int[] data = this.items;
425        int result = 0x9E3779B9, a = 0x632BE5AB;
426        final int len = size;
427        for (int i = 0; i < len; i++) {
428            result += (a ^= 0x85157AF5 * data[i]);
429        }
430        return result * (a | 1) ^ (result >>> 11 | result << 21);
431    }
432
433    public long hash64 () {
434        return CrossHash.Lightning.hash64(items);
435    }
436
437    @Override
438        public boolean equals (Object object) {
439        if (object == this) return true;
440        if (!(object instanceof IntVLA)) return false;
441        IntVLA array = (IntVLA)object;
442        int n = size;
443        if (n != array.size) return false;
444        for (int i = 0; i < n; i++)
445            if (items[i] != array.items[i]) return false;
446        return true;
447    }
448
449    @Override
450        public String toString () {
451        if (size == 0) return "[]";
452        int[] items = this.items;
453        StringBuilder buffer = new StringBuilder(32);
454        buffer.append('[');
455        buffer.append(items[0]);
456        for (int i = 1; i < size; i++) {
457            buffer.append(", ");
458            buffer.append(items[i]);
459        }
460        buffer.append(']');
461        return buffer.toString();
462    }
463
464    public String toString (String separator) {
465        if (size == 0) return "";
466        int[] items = this.items;
467        StringBuilder buffer = new StringBuilder(32);
468        buffer.append(items[0]);
469        for (int i = 1; i < size; i++) {
470            buffer.append(separator);
471            buffer.append(items[i]);
472        }
473        return buffer.toString();
474    }
475
476    public static IntVLA deserializeFromString(String data)
477    {
478        int amount = StringKit.count(data, ",");
479        if (amount <= 0) return new IntVLA();
480        IntVLA iv = new IntVLA(amount+1);
481        int dl = 1, idx = -dl, idx2;
482        for (int i = 0; i < amount; i++) {
483            iv.add(Integer.parseInt(StringKit.safeSubstring(data, idx+dl, idx = data.indexOf(",", idx+dl))));
484        }
485        if((idx2 = data.indexOf(",", idx+dl)) < 0)
486        {
487            iv.add(Integer.parseInt(StringKit.safeSubstring(data, idx+dl, data.length())));
488        }
489        else
490        {
491            iv.add(Integer.parseInt(StringKit.safeSubstring(data, idx+dl, idx2)));
492        }
493        return iv;
494    }
495
496    /** @see #IntVLA(int[]) */
497    public static IntVLA with (int... array) {
498        return new IntVLA(array);
499    }
500
501    public boolean isEmpty() {
502        return size == 0;
503    }
504
505    public static class Convert extends StringConvert<IntVLA>
506    {
507        @Override
508        public String stringify(IntVLA item) {
509            return item.toString(",");
510        }
511
512        @Override
513        public IntVLA restore(String text) {
514            return deserializeFromString(text);
515        }
516    }
517    public static final StringConvert<IntVLA> convert = new Convert();
518}


text:
using System;
using Rhino.PersistentHashTable;

namespace Rhino.DistributedHashTable.Parameters
{
	public class ExtendedGetRequest : GetRequest, IExtendedRequest
	{
		public ExtendedGetRequest()
		{
			Segment = -1;
		}
		public int Segment { get; set; }
		public bool IsReplicationRequest { get; set; }
		public bool IsLocal { get; set; }
	}
}


text:
using System;

namespace ClosedXML.Excel
{
    public enum XLErrorStyle { Stop, Warning, Information }
    public enum XLAllowedValues { AnyValue, WholeNumber, Decimal, Date, Time, TextLength, List, Custom }
    public enum XLOperator { EqualTo, NotEqualTo, GreaterThan, LessThan, EqualOrGreaterThan, EqualOrLessThan, Between, NotBetween }
    public interface IXLDataValidation
    {
        IXLRanges Ranges { get; set; }
        //void Delete();
        //void CopyFrom(IXLDataValidation dataValidation);
        Boolean ShowInputMessage { get; set; }
        Boolean ShowErrorMessage { get; set; }
        Boolean IgnoreBlanks { get; set; }
        Boolean InCellDropdown { get; set; }
        String InputTitle { get; set; }
        String InputMessage { get; set; }
        String ErrorTitle { get; set; }
        String ErrorMessage { get; set; }
        XLErrorStyle ErrorStyle { get; set; }
        XLAllowedValues AllowedValues { get; set; }
        XLOperator Operator { get; set; }

        String Value { get; set; }
        String MinValue { get; set; }
        String MaxValue { get; set; }

        XLWholeNumberCriteria WholeNumber { get; }
        XLDecimalCriteria Decimal { get; }
        XLDateCriteria Date { get; }
        XLTimeCriteria Time { get; }
        XLTextLengthCriteria TextLength { get; }

        void List(String list);
        void List(String list, Boolean inCellDropdown);
        void List(IXLRange range);
        void List(IXLRange range, Boolean inCellDropdown);

        void Custom(String customValidation);
        void Clear();
        Boolean IsDirty();
    }
}


text:
package com.microsoft.applicationinsights.internal.channel.common;

/**
 * Created by gupele on 2/10/2015.
 */
final class StaticBackOffTimesPolicy implements BackOffTimesPolicy {
    public static final int NUMBER_OF_BACK_OFFS = 20;

    private static final long TEN_SECONDS_IN_MS = 10000;
    @Override
    public long[] getBackOffTimeoutsInMillis() {
        long[] backOffInSeconds = new long[NUMBER_OF_BACK_OFFS];
        int couples = NUMBER_OF_BACK_OFFS / 2;
        for (int i = 0; i < couples; ++i) {
            int position = i * 2;
            backOffInSeconds[position] = BackOffTimesPolicy.MIN_TIME_TO_BACK_OFF_IN_MILLS;
            backOffInSeconds[position + 1] = TEN_SECONDS_IN_MS;
        }

        return backOffInSeconds;
    }
}


text:
package megaman.model;

import megaman.controller.Scheduler;

import javax.xml.bind.annotation.XmlElement;
import java.io.Serializable;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class MegaMan implements Serializable {
    @XmlElement
    int energyLevel;

    @XmlElement
    Direction direction;

    private Territory territory;
    private ReadWriteLock lock;

    private transient Scheduler scheduler;

    public MegaMan() {
        energyLevel = 0;
        direction = Direction.EAST;
        lock = new ReentrantReadWriteLock();
    }

    public void setScheduler(Scheduler scheduler) {
        this.scheduler = scheduler;
    }

    public void setTerritory(Territory territory) {
        this.territory = territory;
    }

    public void main() {
    }

    public void vor() {
        scheduler.yield(lock.writeLock(), () -> {
            territory.megaManVor();
            return null;
        });
    }

    public void blast(int energy) {
        scheduler.yield(lock.writeLock(), () -> {
            territory.megaManBlast(energy);
            return null;
        });
    }

    public void rechtsUm() {
        scheduler.yield(lock.writeLock(), () -> {
            territory.megaManRechtsUm();
            return null;
        });
    }

    public boolean monsterInSicht() {
        return scheduler.yield(lock.readLock(), () -> territory.megaManMonsterInSicht());
    }

    public boolean powerUpDa() {
        return scheduler.yield(lock.readLock(), () -> territory.megaManPowerUpDa());
    }

    public void nimmPowerUp() {
        scheduler.yield(lock.writeLock(), () -> {
            territory.megaManNimmPowerup();
            return null;
        });
    }

    public int getEnergyLevel() {
        return scheduler.yield(lock.readLock(), () -> energyLevel);
    }
}


text:
using EdiEngine.Common.Enums;
using EdiEngine.Common.Definitions;
using EdiEngine.Standards.X12_004010.Segments;

namespace EdiEngine.Standards.X12_004010.Maps
{
	public class M_852 : MapLoop
	{
		public M_852() : base(null)
		{
			Content.AddRange(new MapBaseEntity[] {
				new XQ() { ReqDes = RequirementDesignator.Mandatory, MaxOccurs = 1 },
				new XPO() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
				new N9() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
				new PER() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 3 },
				new L_N1(this) { ReqDes = RequirementDesignator.Optional, MaxOccurs = 200 },
				new L_LIN(this) { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
				new CTT() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
			});
		}

		//1000
		public class L_N1 : MapLoop
		{
			public L_N1(MapLoop parentLoop) : base(parentLoop)
			{
				Content.AddRange(new MapBaseEntity[] {
					new N1() { ReqDes = RequirementDesignator.Mandatory, MaxOccurs = 1 },
					new N2() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new N3() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 2 },
					new N4() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new FOB() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new TD5() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new DTM() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
					new N9() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
					new PER() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 3 },
				});
			}
		}

		//2000
		public class L_LIN : MapLoop
		{
			public L_LIN(MapLoop parentLoop) : base(parentLoop)
			{
				Content.AddRange(new MapBaseEntity[] {
					new LIN() { ReqDes = RequirementDesignator.Mandatory, MaxOccurs = 1 },
					new CTP() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 25 },
					new PO4() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new N9() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
					new AMT() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 10 },
					new PAL() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new QTY() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new L_ZA(this) { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
				});
			}
		}

		//2100
		public class L_ZA : MapLoop
		{
			public L_ZA(MapLoop parentLoop) : base(parentLoop)
			{
				Content.AddRange(new MapBaseEntity[] {
					new ZA() { ReqDes = RequirementDesignator.Mandatory, MaxOccurs = 1 },
					new QTY() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
					new CTP() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 25 },
					new SDQ() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 999999 },
					new L_G95(this) { ReqDes = RequirementDesignator.Optional, MaxOccurs = 1 },
				});
			}
		}

		//2110
		public class L_G95 : MapLoop
		{
			public L_G95(MapLoop parentLoop) : base(parentLoop)
			{
				Content.AddRange(new MapBaseEntity[] {
					new G95() { ReqDes = RequirementDesignator.Mandatory, MaxOccurs = 1 },
					new DTM() { ReqDes = RequirementDesignator.Optional, MaxOccurs = 2 },
				});
			}
		}

	}
 }


text:
<?php

namespace Magento\Customer\Model;

use Magento\Customer\Api\AccountManagementInterface;
use Magento\Customer\Api\AddressRepositoryInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\AddressInterface;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\State\ExpiredException;
use Magento\Framework\Reflection\DataObjectProcessor;
use Magento\TestFramework\Helper\Bootstrap;

/**
 * Integration test for service layer \Magento\Customer\Model\AccountManagementTest
 *
 * @SuppressWarnings(PHPMD.TooManyMethods)
 * @SuppressWarnings(PHPMD.ExcessivePublicCount)
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 * @magentoAppArea frontend
 */
class AccountManagementTest extends \PHPUnit_Framework_TestCase
{
    /** @var AccountManagementInterface */
    private $accountManagement;

    /** @var CustomerRepositoryInterface */
    private $customerRepository;

    /** @var AddressRepositoryInterface needed to setup tests */
    private $addressRepository;

    /** @var \Magento\Framework\ObjectManagerInterface */
    private $objectManager;

    /** @var AddressInterface[] */
    private $_expectedAddresses;

    /** @var \Magento\Customer\Api\Data\AddressInterfaceFactory */
    private $addressFactory;

    /** @var \Magento\Customer\Api\Data\CustomerInterfaceFactory */
    private $customerFactory;

    /** @var DataObjectProcessor */
    private $dataProcessor;

    /** @var \Magento\Framework\Api\ExtensibleDataObjectConverter */
    private $extensibleDataObjectConverter;

    /** @var  \Magento\Framework\Api\DataObjectHelper */
    protected $dataObjectHelper;

    protected function setUp()
    {
        $this->objectManager = Bootstrap::getObjectManager();
        $this->accountManagement = $this->objectManager
            ->create('Magento\Customer\Api\AccountManagementInterface');
        $this->customerRepository = $this->objectManager
            ->create('Magento\Customer\Api\CustomerRepositoryInterface');
        $this->addressRepository =
            $this->objectManager->create('Magento\Customer\Api\AddressRepositoryInterface');

        $this->addressFactory = $this->objectManager->create('Magento\Customer\Api\Data\AddressInterfaceFactory');
        $this->customerFactory = $this->objectManager->create('Magento\Customer\Api\Data\CustomerInterfaceFactory');
        $this->dataObjectHelper = $this->objectManager->create('Magento\Framework\Api\DataObjectHelper');

        $regionFactory = $this->objectManager->create('Magento\Customer\Api\Data\RegionInterfaceFactory');
        $address = $this->addressFactory->create();
        $address->setId('1')
            ->setCountryId('US')
            ->setCustomerId('1')
            ->setPostcode('75477')
            ->setRegion(
                $regionFactory->create()->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)
            )
            ->setRegionId(1)
            ->setCompany('CompanyName')
            ->setStreet(['Green str, 67'])
            ->setTelephone('3468676')
            ->setCity('CityM')
            ->setFirstname('John')
            ->setLastname('Smith')
            ->setIsDefaultShipping(true)
            ->setIsDefaultBilling(true);

        $address2 = $this->addressFactory->create();
        $address2->setId('2')
            ->setCountryId('US')
            ->setCustomerId('1')
            ->setPostcode('47676')
            ->setRegion(
                $regionFactory->create()->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)
            )
            ->setRegionId(1)
            ->setCompany('Company')
            ->setStreet(['Black str, 48'])
            ->setCity('CityX')
            ->setTelephone('3234676')
            ->setFirstname('John')
            ->setLastname('Smith');

        $this->_expectedAddresses = [$address, $address2];

        $this->dataProcessor = $this->objectManager
            ->create('Magento\Framework\Reflection\DataObjectProcessor');

        $this->extensibleDataObjectConverter = $this->objectManager
            ->create('Magento\Framework\Api\ExtensibleDataObjectConverter');
    }

    /**
     * Clean up shared dependencies
     */
    protected function tearDown()
    {
        /** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */
        $customerRegistry = $this->objectManager->get('Magento\Customer\Model\CustomerRegistry');
        /** @var \Magento\Customer\Model\CustomerRegistry $addressRegistry */
        $addressRegistry = $this->objectManager->get('Magento\Customer\Model\AddressRegistry');
        //Cleanup customer from registry
        $customerRegistry->remove(1);
        $addressRegistry->remove(1);
        $addressRegistry->remove(2);
    }

    /**
     * @magentoAppArea frontend
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testLogin()
    {
        // Customer email and password are pulled from the fixture customer.php
        $customer = $this->accountManagement->authenticate('customer@example.com', 'password');

        $this->assertSame('customer@example.com', $customer->getEmail());
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     *
     * @expectedException \Magento\Framework\Exception\InvalidEmailOrPasswordException
     * @expectedExceptionMessage Invalid login or password.
     */
    public function testLoginWrongPassword()
    {
        // Customer email and password are pulled from the fixture customer.php
        $this->accountManagement->authenticate('customer@example.com', 'wrongPassword');
    }

    /**
     * @expectedException \Magento\Framework\Exception\InvalidEmailOrPasswordException
     * @expectedExceptionMessage Invalid login or password.
     */
    public function testLoginWrongUsername()
    {
        // Customer email and password are pulled from the fixture customer.php
        $this->accountManagement->authenticate('non_existing_user', 'password');
    }

    /**
     * @magentoAppArea frontend
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testChangePassword()
    {
        $this->accountManagement->changePassword('customer@example.com', 'password', 'new_password');

        $this->accountManagement->authenticate('customer@example.com', 'new_password');
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     *
     * @expectedException \Magento\Framework\Exception\InvalidEmailOrPasswordException
     * @expectedExceptionMessage The password doesn't match this account.
     */
    public function testChangePasswordWrongPassword()
    {
        $this->accountManagement->changePassword('customer@example.com', 'wrongPassword', 'new_password');
    }

    /**
     * @expectedException \Magento\Framework\Exception\InvalidEmailOrPasswordException
     * @expectedExceptionMessage Invalid login or password.
     */
    public function testChangePasswordWrongUser()
    {
        $this->accountManagement->changePassword('wrong.email@example.com', 'password', 'new_password');
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/inactive_customer.php
     * @magentoAppArea frontend
     */
    public function testActivateAccount()
    {
        /** @var \Magento\Customer\Model\Customer $customerModel */
        $customerModel = $this->objectManager->create('Magento\Customer\Model\Customer');
        $customerModel->load(1);
        // Assert in just one test that the fixture is working
        $this->assertNotNull($customerModel->getConfirmation(), 'New customer needs to be confirmed');

        $this->accountManagement->activate($customerModel->getEmail(), $customerModel->getConfirmation());

        $customerModel = $this->objectManager->create('Magento\Customer\Model\Customer');
        $customerModel->load(1);
        $this->assertNull($customerModel->getConfirmation(), 'Customer should be considered confirmed now');
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/inactive_customer.php
     * @expectedException \Magento\Framework\Exception\State\InputMismatchException
     */
    public function testActivateCustomerConfirmationKeyWrongKey()
    {
        /** @var \Magento\Customer\Model\Customer $customerModel */
        $customerModel = $this->objectManager->create('Magento\Customer\Model\Customer');
        $customerModel->load(1);
        $key = $customerModel->getConfirmation();

        try {
            $this->accountManagement->activate($customerModel->getEmail(), $key . $key);
            $this->fail('Expected exception was not thrown');
        } catch (InputException $ie) {
            $this->assertEquals('', $ie->getMessage());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/inactive_customer.php
     */
    public function testActivateCustomerWrongAccount()
    {
        /** @var \Magento\Customer\Model\Customer $customerModel */
        $customerModel = $this->objectManager->create('Magento\Customer\Model\Customer');
        $customerModel->load(1);
        $key = $customerModel->getConfirmation();
        try {
            $this->accountManagement->activate('1234' . $customerModel->getEmail(), $key);
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $nsee) {
            $this->assertEquals(
                'No such entity with email = 1234customer@needAconfirmation.com, websiteId = 1',
                $nsee->getMessage()
            );
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/inactive_customer.php
     * @magentoAppArea frontend
     * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException
     */
    public function testActivateCustomerAlreadyActive()
    {
        /** @var \Magento\Customer\Model\Customer $customerModel */
        $customerModel = $this->objectManager->create('Magento\Customer\Model\Customer');
        $customerModel->load(1);
        $key = $customerModel->getConfirmation();
        $this->accountManagement->activate($customerModel->getEmail(), $key);
        // activate it one more time to produce an exception
        $this->accountManagement->activate($customerModel->getEmail(), $key);
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testValidateResetPasswordLinkToken()
    {
        $this->setResetPasswordData('token', 'Y-m-d');
        $this->accountManagement->validateResetPasswordLinkToken(1, 'token');
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     * @expectedException \Magento\Framework\Exception\State\ExpiredException
     */
    public function testValidateResetPasswordLinkTokenExpired()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $this->setResetPasswordData($resetToken, '1970-01-01');
        $this->accountManagement->validateResetPasswordLinkToken(1, $resetToken);
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testValidateResetPasswordLinkTokenInvalid()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $invalidToken = 0;
        $this->setResetPasswordData($resetToken, 'Y-m-d');
        try {
            $this->accountManagement->validateResetPasswordLinkToken(1, $invalidToken);
            $this->fail('Expected exception not thrown.');
        } catch (InputException $ie) {
            $this->assertEquals(InputException::REQUIRED_FIELD, $ie->getRawMessage());
            $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage());
            $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage());
            $this->assertEmpty($ie->getErrors());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     *
     */
    public function testValidateResetPasswordLinkTokenWrongUser()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';

        try {
            $this->accountManagement->validateResetPasswordLinkToken(4200, $resetToken);
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $nsee) {
            $this->assertEquals('No such entity with customerId = 4200', $nsee->getMessage());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     *
     */
    public function testValidateResetPasswordLinkTokenNull()
    {
        try {
            $this->accountManagement->validateResetPasswordLinkToken(1, null);
            $this->fail('Expected exception not thrown.');
        } catch (InputException $ie) {
            $this->assertEquals(InputException::REQUIRED_FIELD, $ie->getRawMessage());
            $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage());
            $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage());
            $this->assertEmpty($ie->getErrors());
        }
    }

    /**
     * @magentoAppArea frontend
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testSendPasswordResetLink()
    {
        $email = 'customer@example.com';

        $this->accountManagement->initiatePasswordReset($email, AccountManagement::EMAIL_RESET, 1);
    }

    /**
     * @magentoAppArea frontend
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testSendPasswordResetLinkDefaultWebsite()
    {
        $email = 'customer@example.com';

        $this->accountManagement->initiatePasswordReset($email, AccountManagement::EMAIL_RESET);
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     *
     */
    public function testSendPasswordResetLinkBadEmailOrWebsite()
    {
        $email = 'foo@example.com';

        try {
            $this->accountManagement->initiatePasswordReset(
                $email,
                AccountManagement::EMAIL_RESET,
                0
            );
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $e) {
            $expectedParams = [
                'fieldName' => 'email',
                'fieldValue' => $email,
                'field2Name' => 'websiteId',
                'field2Value' => 0,
            ];
            $this->assertEquals($expectedParams, $e->getParameters());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testSendPasswordResetLinkBadEmailDefaultWebsite()
    {
        $email = 'foo@example.com';

        try {
            $this->accountManagement->initiatePasswordReset(
                $email,
                AccountManagement::EMAIL_RESET
            );
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $nsee) {
            // App area is frontend, so we expect websiteId of 1.
            $this->assertEquals('No such entity with email = foo@example.com, websiteId = 1', $nsee->getMessage());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testResetPassword()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $password = 'new_password';

        $this->setResetPasswordData($resetToken, 'Y-m-d');
        $this->assertTrue($this->accountManagement->resetPassword('customer@example.com', $resetToken, $password));
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testResetPasswordTokenExpired()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $password = 'new_password';

        $this->setResetPasswordData($resetToken, '1970-01-01');
        try {
            $this->accountManagement->resetPassword('customer@example.com', $resetToken, $password);
            $this->fail('Expected exception not thrown.');
        } catch (ExpiredException $e) {
            $this->assertEquals('Reset password token expired.', $e->getMessage());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     *
     */
    public function testResetPasswordTokenInvalid()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $invalidToken = 0;
        $password = 'new_password';

        $this->setResetPasswordData($resetToken, 'Y-m-d');
        try {
            $this->accountManagement->resetPassword('customer@example.com', $invalidToken, $password);
            $this->fail('Expected exception not thrown.');
        } catch (InputException $ie) {
            $this->assertEquals(InputException::REQUIRED_FIELD, $ie->getRawMessage());
            $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage());
            $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage());
            $this->assertEmpty($ie->getErrors());
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testResetPasswordTokenWrongUser()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $password = 'new_password';
        $this->setResetPasswordData($resetToken, 'Y-m-d');
        try {
            $this->accountManagement->resetPassword('invalid-customer@example.com', $resetToken, $password);
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $nsee) {
            $this->assertEquals(
                'No such entity with email = invalid-customer@example.com, websiteId = 1',
                $nsee->getMessage()
            );
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testResetPasswordTokenInvalidUserEmail()
    {
        $resetToken = 'lsdj579slkj5987slkj595lkj';
        $password = 'new_password';

        $this->setResetPasswordData($resetToken, 'Y-m-d');

        try {
            $this->accountManagement->resetPassword('invalid', $resetToken, $password);
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $e) {
            $this->assertEquals('No such entity with email = invalid, websiteId = 1', $e->getMessage());
        }
    }

    /**
     * @magentoAppArea frontend
     * @magentoAppIsolation enabled
     * @magentoDataFixture Magento/Customer/_files/inactive_customer.php
     */
    public function testResendConfirmation()
    {
        $this->accountManagement->resendConfirmation('customer@needAconfirmation.com', 1);
        //TODO assert
    }

    /**
     * @magentoAppArea frontend
     * @magentoAppIsolation enabled
     * @magentoDataFixture Magento/Customer/_files/inactive_customer.php
     */
    public function testResendConfirmationBadWebsiteId()
    {
        try {
            $this->accountManagement->resendConfirmation('customer@needAconfirmation.com', 'notAWebsiteId');
        } catch (NoSuchEntityException $nsee) {
            $this->assertEquals(
                'No such entity with email = customer@needAconfirmation.com, websiteId = notAWebsiteId',
                $nsee->getMessage()
            );
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testResendConfirmationNoEmail()
    {
        try {
            $this->accountManagement->resendConfirmation('wrongemail@example.com', 1);
            $this->fail('Expected exception not thrown.');
        } catch (NoSuchEntityException $nsee) {
            $this->assertEquals(
                'No such entity with email = wrongemail@example.com, websiteId = 1',
                $nsee->getMessage()
            );
        }
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException
     */
    public function testResendConfirmationNotNeeded()
    {
        $this->accountManagement->resendConfirmation('customer@example.com', 1);
    }

    /**
     * @magentoDbIsolation enabled
     */
    public function testCreateCustomerException()
    {
        $customerEntity = $this->customerFactory->create();

        try {
            $this->accountManagement->createAccount($customerEntity);
            $this->fail('Expected exception not thrown');
        } catch (InputException $ie) {
            $this->assertEquals(InputException::DEFAULT_MESSAGE, $ie->getMessage());
            $errors = $ie->getErrors();
            $this->assertCount(3, $errors);
            $this->assertEquals('firstname is a required field.', $errors[0]->getLogMessage());
            $this->assertEquals('lastname is a required field.', $errors[1]->getLogMessage());
            $this->assertEquals('Invalid value of "" provided for the email field.', $errors[2]->getLogMessage());
        }
    }

    /**
     * @magentoAppArea frontend
     * @magentoDataFixture Magento/Customer/_files/customer.php
     * @magentoDbIsolation enabled
     */
    public function testCreateNonexistingCustomer()
    {
        $existingCustId = 1;
        $existingCustomer = $this->customerRepository->getById($existingCustId);

        $email = 'savecustomer@example.com';
        $firstName = 'Firstsave';
        $lastName = 'Lastsave';
        $customerData = array_merge(
            $existingCustomer->__toArray(),
            [
                'email' => $email,
                'firstname' => $firstName,
                'lastname' => $lastName,
                'id' => null
            ]
        );
        $customerEntity = $this->customerFactory->create();
        $this->dataObjectHelper->populateWithArray(
            $customerEntity,
            $customerData,
            '\Magento\Customer\Api\Data\CustomerInterface'
        );

        $customerAfter = $this->accountManagement->createAccount($customerEntity, 'aPassword');
        $this->assertGreaterThan(0, $customerAfter->getId());
        $this->assertEquals($email, $customerAfter->getEmail());
        $this->assertEquals($firstName, $customerAfter->getFirstname());
        $this->assertEquals($lastName, $customerAfter->getLastname());
        $this->accountManagement->authenticate(
            $customerAfter->getEmail(),
            'aPassword'
        );
        $attributesBefore = $this->extensibleDataObjectConverter->toFlatArray(
            $existingCustomer,
            [],
            '\Magento\Customer\Api\Data\CustomerInterface'
        );
        $attributesAfter = $this->extensibleDataObjectConverter->toFlatArray(
            $customerAfter,
            [],
            '\Magento\Customer\Api\Data\CustomerInterface'
        );
        // ignore 'updated_at'
        unset($attributesBefore['updated_at']);
        unset($attributesAfter['updated_at']);
        $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter);
        $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore);
        $expectedInBefore = [
            'email',
            'firstname',
            'id',
            'lastname',
        ];
        sort($expectedInBefore);
        $actualInBeforeOnly = array_keys($inBeforeOnly);
        sort($actualInBeforeOnly);
        $this->assertEquals($expectedInBefore, $actualInBeforeOnly);
        $expectedInAfter = [
            'created_in',
            'email',
            'firstname',
            'id',
            'lastname',
        ];
        sort($expectedInAfter);
        $actualInAfterOnly = array_keys($inAfterOnly);
        sort($actualInAfterOnly);
        $this->assertEquals($expectedInAfter, $actualInAfterOnly);
    }

    /**
     * @magentoDbIsolation enabled
     */
    public function testCreateCustomerInServiceVsInModel()
    {
        $email = 'email@example.com';
        $email2 = 'email2@example.com';
        $firstname = 'Tester';
        $lastname = 'McTest';
        $groupId = 1;
        $password = 'aPassword';

        /** @var \Magento\Customer\Model\Customer $customerModel */
        $customerModel = $this->objectManager->create('Magento\Customer\Model\CustomerFactory')->create();
        $customerModel->setEmail($email)
            ->setFirstname($firstname)
            ->setLastname($lastname)
            ->setGroupId($groupId)
            ->setPassword($password);
        $customerModel->save();
        /** @var \Magento\Customer\Model\Customer $customerModel */
        $savedModel = $this->objectManager
            ->create('Magento\Customer\Model\CustomerFactory')
            ->create()
            ->load($customerModel->getId());
        $dataInModel = $savedModel->getData();

        $newCustomerEntity = $this->customerFactory->create()
            ->setEmail($email2)
            ->setFirstname($firstname)
            ->setLastname($lastname)
            ->setGroupId($groupId);
        $customerData = $this->accountManagement->createAccount($newCustomerEntity, $password);
        $this->assertNotNull($customerData->getId());
        $savedCustomer = $this->customerRepository->getById($customerData->getId());

        /** @var \Magento\Framework\Api\SimpleDataObjectConverter $simpleDataObjectConverter */
        $simpleDataObjectConverter = Bootstrap::getObjectManager()
            ->get('Magento\Framework\Api\SimpleDataObjectConverter');

        $dataInService = $simpleDataObjectConverter->toFlatArray(
            $savedCustomer,
            'Magento\Customer\Api\Data\CustomerInterface'
        );
        $expectedDifferences = [
            'created_at',
            'updated_at',
            'email',
            'is_active',
            'entity_id',
            'entity_type_id',
            'password_hash',
            'attribute_set_id',
            'disable_auto_group_change',
            'confirmation',
            'reward_update_notification',
            'reward_warning_notification',
        ];
        foreach ($dataInModel as $key => $value) {
            if (!in_array($key, $expectedDifferences)) {
                if ($value === null) {
                    $this->assertArrayNotHasKey($key, $dataInService);
                } else {
                    $this->assertEquals($value, $dataInService[$key], 'Failed asserting value for ' . $key);
                }
            }
        }
        $this->assertEquals($email2, $dataInService['email']);
        $this->assertArrayNotHasKey('is_active', $dataInService);
        $this->assertArrayNotHasKey('password_hash', $dataInService);
    }

    /**
     * @magentoDbIsolation enabled
     */
    public function testCreateNewCustomer()
    {
        $email = 'email@example.com';
        $storeId = 1;
        $firstname = 'Tester';
        $lastname = 'McTest';
        $groupId = 1;

        $newCustomerEntity = $this->customerFactory->create()
            ->setStoreId($storeId)
            ->setEmail($email)
            ->setFirstname($firstname)
            ->setLastname($lastname)
            ->setGroupId($groupId);
        $savedCustomer = $this->accountManagement->createAccount($newCustomerEntity, 'aPassword');
        $this->assertNotNull($savedCustomer->getId());
        $this->assertEquals($email, $savedCustomer->getEmail());
        $this->assertEquals($storeId, $savedCustomer->getStoreId());
        $this->assertEquals($firstname, $savedCustomer->getFirstname());
        $this->assertEquals($lastname, $savedCustomer->getLastname());
        $this->assertEquals($groupId, $savedCustomer->getGroupId());
        $this->assertTrue(!$savedCustomer->getSuffix());
    }

    /**
     * @magentoDbIsolation enabled
     */
    public function testCreateNewCustomerWithPasswordHash()
    {
        $email = 'email@example.com';
        $storeId = 1;
        $firstname = 'Tester';
        $lastname = 'McTest';
        $groupId = 1;

        $newCustomerEntity = $this->customerFactory->create()
            ->setStoreId($storeId)
            ->setEmail($email)
            ->setFirstname($firstname)
            ->setLastname($lastname)
            ->setGroupId($groupId);
        /** @var \Magento\Framework\Math\Random $mathRandom */
        $password = $this->objectManager->get('Magento\Framework\Math\Random')->getRandomString(
            AccountManagement::MIN_PASSWORD_LENGTH
        );
        /** @var \Magento\Framework\Encryption\EncryptorInterface $encryptor */
        $encryptor = $this->objectManager->get('Magento\Framework\Encryption\EncryptorInterface');
        $passwordHash = $encryptor->getHash($password, true);
        $savedCustomer = $this->accountManagement->createAccountWithPasswordHash(
            $newCustomerEntity,
            $passwordHash
        );
        $this->assertNotNull($savedCustomer->getId());
        $this->assertEquals($email, $savedCustomer->getEmail());
        $this->assertEquals($storeId, $savedCustomer->getStoreId());
        $this->assertEquals($firstname, $savedCustomer->getFirstname());
        $this->assertEquals($lastname, $savedCustomer->getLastname());
        $this->assertEquals($groupId, $savedCustomer->getGroupId());
        $this->assertTrue(!$savedCustomer->getSuffix());
        $this->assertEquals(
            $savedCustomer->getId(),
            $this->accountManagement->authenticate($email, $password)->getId()
        );
    }

    /**
     * @magentoAppArea frontend
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testCreateNewCustomerFromClone()
    {
        $email = 'savecustomer@example.com';
        $firstName = 'Firstsave';
        $lastname = 'Lastsave';

        $existingCustId = 1;
        $existingCustomer = $this->customerRepository->getById($existingCustId);
        $customerEntity = $this->customerFactory->create();
        $this->dataObjectHelper->mergeDataObjects(
            '\Magento\Customer\Api\Data\CustomerInterface',
            $customerEntity,
            $existingCustomer
        );
        $customerEntity->setEmail($email)
            ->setFirstname($firstName)
            ->setLastname($lastname)
            ->setId(null);

        $customer = $this->accountManagement->createAccount($customerEntity, 'aPassword');
        $this->assertNotEmpty($customer->getId());
        $this->assertEquals($email, $customer->getEmail());
        $this->assertEquals($firstName, $customer->getFirstname());
        $this->assertEquals($lastname, $customer->getLastname());
        $this->accountManagement->authenticate(
            $customer->getEmail(),
            'aPassword',
            true
        );
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testIsEmailAvailable()
    {
        $this->assertFalse($this->accountManagement->isEmailAvailable('customer@example.com', 1));
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testIsEmailAvailableNoWebsiteSpecified()
    {
        $this->assertFalse($this->accountManagement->isEmailAvailable('customer@example.com'));
    }

    /**
     * @magentoDataFixture Magento/Customer/_files/customer.php
     */
    public function testIsEmailAvailableNoWebsiteSpecifiedNonExistent()
    {
        $this->assertTrue($this->accountManagement->isEmailAvailable('nonexistent@example.com'));
    }

    public function testIsEmailAvailableNonExistentEmail()
    {
        $this->assertTrue($this->accountManagement->isEmailAvailable('nonexistent@example.com', 1));
    }

    /**
     * @magentoDataFixture  Magento/Customer/_files/customer.php
     * @magentoDataFixture  Magento/Customer/_files/customer_address.php
     * @magentoDataFixture  Magento/Customer/_files/customer_two_addresses.php
     */
    public function testGetDefaultBillingAddress()
    {
        $customerId = 1;
        $address = $this->accountManagement->getDefaultBillingAddress($customerId);

        $expected = $this->dataProcessor->buildOutputDataArray(
            $this->_expectedAddresses[0],
            'Magento\Customer\Api\Data\AddressInterface'
        );
        $result = $this->dataProcessor->buildOutputDataArray($address, 'Magento\Customer\Api\Data\AddressInterface');
        /*
         * TODO : Data builder / populateWithArray currently does not detect
         * array type and returns street as string instead of array. Need to fix this.
         */
        unset($expected[AddressInterface::STREET]);
        unset($result[AddressInterface::STREET]);
        $this->assertEquals($expected, $result);
    }

    /**
     * @magentoDataFixture  Magento/Customer/_files/customer.php
     */
    public function testSaveNewAddressDefaults()
    {
        $customerId = 1;

        /** @var $addressShipping \Magento\Customer\Api\Data\AddressInterface */
        $addressShipping = $this->_expectedAddresses[0]->setId(null);
        $addressShipping->setIsDefaultShipping(true)->setIsDefaultBilling(false)->setCustomerId($customerId);
        //TODO : Will be fixed as part of fixing populate. For now Region is set as Data Object instead of array
        $addressShipping->setRegion($this->_expectedAddresses[0]->getRegion());

        /** @var $addressBilling \Magento\Customer\Api\Data\AddressInterface */
        $addressBilling = $this->_expectedAddresses[1]->setId(null);
        $addressBilling->setIsDefaultBilling(true)->setIsDefaultShipping(false)->setCustomerId($customerId);
        //TODO : Will be fixed as part of fixing populate
        $addressBilling->setRegion($this->_expectedAddresses[1]->getRegion());

        $addressShippingExpected = $this->addressRepository->save($addressShipping);
        $addressBillingExpected = $this->addressRepository->save($addressBilling);

        // Call api under test
        $shippingResponse = $this->accountManagement->getDefaultShippingAddress($customerId);
        $billingResponse = $this->accountManagement->getDefaultBillingAddress($customerId);

        // Verify if the new Shipping address created is same as returned by the api under test :
        // \Magento\Customer\Api\AccountManagementInterface::getDefaultShippingAddress
        $addressShippingExpected = $this->dataProcessor->buildOutputDataArray(
            $addressShippingExpected,
            'Magento\Customer\Api\Data\AddressInterface'
        );
        $shippingResponse = $this->dataProcessor->buildOutputDataArray(
            $shippingResponse,
            'Magento\Customer\Api\Data\AddressInterface'
        );

        // Response should have this set since we save as default shipping
        $addressShippingExpected[AddressInterface::DEFAULT_SHIPPING] = true;
        $this->assertEquals($addressShippingExpected, $shippingResponse);

        // Verify if the new Billing address created is same as returned by the api under test :
        // \Magento\Customer\Api\AccountManagementInterface::getDefaultShippingAddress
        $addressBillingExpected = $this->dataProcessor->buildOutputDataArray(
            $addressBillingExpected,
            'Magento\Customer\Api\Data\AddressInterface'
        );
        $billingResponse = $this->dataProcessor->buildOutputDataArray(
            $billingResponse,
            'Magento\Customer\Api\Data\AddressInterface'
        );

        // Response should have this set since we save as default billing
        $addressBillingExpected[AddressInterface::DEFAULT_BILLING] = true;
        $this->assertEquals($addressBillingExpected, $billingResponse);
    }

    /**
     * @magentoDataFixture  Magento/Customer/_files/customer.php
     */
    public function testGetDefaultAddressesForNonExistentAddress()
    {
        $customerId = 1;
        $this->assertNull($this->accountManagement->getDefaultBillingAddress($customerId));
        $this->assertNull($this->accountManagement->getDefaultShippingAddress($customerId));
    }

    /**
     * Set Rp data to Customer in fixture
     *
     * @param $resetToken
     * @param $date
     */
    protected function setResetPasswordData($resetToken, $date)
    {
        $customerIdFromFixture = 1;
        /** @var \Magento\Customer\Model\Customer $customerModel */
        $customerModel = $this->objectManager->create('Magento\Customer\Model\Customer');
        $customerModel->load($customerIdFromFixture);
        $customerModel->setRpToken($resetToken);
        $customerModel->setRpTokenCreatedAt(date($date));
        $customerModel->save();
    }
}


text:
//
//  faxiantuijianViewController.m
//  喜马拉雅项目
//
//  Created by 大米 on 15/11/17.
//  Copyright © 2015年 rice. All rights reserved.
//

#import "faxiantuijianViewController.h"
#import "scrollView.h"

#define kViewWidth self.view.frame.size.width
#define kViewHeight self.view.frame.size.height
#define kPageHeight 160

@interface faxiantuijianViewController ()<UITableViewDataSource,UITableViewDelegate,SDRefreshViewAnimationDelegate>
@property (nonatomic,strong)faxianDataHandle * datahandle;
@property (nonatomic,strong) UITableView * tabelView;
@property (nonatomic,strong)NSMutableArray * mutableArray;
@property (nonatomic,strong)NSMutableDictionary * mutableDictionary;
@property (nonatomic,strong)NSMutableArray * mutableDictionaryArray;
@property (nonatomic, weak) SDRefreshHeaderView *refreshHeader;

@property (nonatomic, weak) UIImageView *animationView;
@property (nonatomic, weak) UIImageView *boxView;
@property (nonatomic, weak) UILabel *label;
@end

@implementation faxiantuijianViewController
-(void)viewWillAppear:(BOOL)animated{
    self.datahandle = [faxianDataHandle createDataHandle];
    [self uploadInfo];
////    下拉刷新
//    [self setupHeader];

}

- (void)uploadInfo{

    //    加载提示图
    Indicator *indicator = [[Indicator alloc]initWithFrame:CGRectMake((kViewWidth - 50) / 2, 250, 50, 50)];
    [indicator startAnimating];
    [self.view addSubview:indicator];
    [self.datahandle tuijianData:^(id jsonObject1,id jsonObject2,id jsonObject3) {
        self.mutableArray = [NSMutableArray array];
        self.mutableDictionary = [NSMutableDictionary dictionary];

        _mutableArray = jsonObject1;
        _mutableDictionary = jsonObject2;
        _mutableDictionaryArray = jsonObject3;

        [_tabelView reloadData];
        [indicator setHidden:YES];
    }];

}

#pragma mark - SDRefreshView Animation Delegate

- (void)refreshView:(SDRefreshView *)refreshView didBecomeNormalStateWithMovingProgress:(CGFloat)progress
{
    refreshView.hidden = NO;
    if (progress == 0) {
        _animationView.transform = CGAffineTransformMakeScale(0.1, 0.1);
        _boxView.hidden = NO;
        _label.text = @"下拉加载最新数据";
        [_animationView stopAnimating];
    }

    self.animationView.transform = CGAffineTransformConcat(CGAffineTransformMakeTranslation(progress * 10, -20 * progress), CGAffineTransformMakeScale(progress, progress));
    self.boxView.transform = CGAffineTransformMakeTranslation(- progress * 85, progress * 35);

}

- (void)refreshView:(SDRefreshView *)refreshView didBecomeRefreshingStateWithMovingProgress:(CGFloat)progress
{
    _label.text = @"客官别急,正在加载数据...";
    [UIView animateWithDuration:1.5 animations:^{
        self.animationView.transform = CGAffineTransformMakeTranslation(200, -20);
    }];
}

- (void)refreshView:(SDRefreshView *)refreshView didBecomeWillRefreshStateWithMovingProgress:(CGFloat)progress
{
    _boxView.hidden = YES;
    _label.text = @"放开我,我才帮你加载数据";
    _animationView.transform = CGAffineTransformConcat(CGAffineTransformMakeTranslation(10, -20), CGAffineTransformMakeScale(1, 1));
    [_animationView startAnimating];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];

    self.tabelView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kViewWidth, kViewHeight - 64 - 49) style:(UITableViewStyleGrouped)];
    _tabelView.sectionFooterHeight = 1;
    _tabelView.sectionHeaderHeight = 1;

    _tabelView.dataSource = self;
    _tabelView.delegate = self;

    [_tabelView registerNib:[UINib nibWithNibName:@"TableViewCell" bundle:nil] forCellReuseIdentifier:@"cellReuse"];

    scrollView * scroll = [[scrollView alloc]init];
    _tabelView.tableHeaderView = scroll.view;

    [self.view addSubview:_tabelView];
    [_tabelView reloadData];
}

#pragma mark tableViewDataSource

// 可选择实现 设置分区个数  不写 默认为1
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

// 必须实现 设置每个分区有多少行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (_mutableArray.count == 0) {
        return 1;
    }
    else{
        return (_mutableArray.count + _mutableDictionaryArray.count);
    }
}

//必须实现  每一行显示的信息 cell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    //    注册后 重用cell
    TableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellReuse"];
    if (indexPath.row == 0) {
        if (_mutableArray != NULL) {
            cell.focusImageArray = _mutableArray;

            faXianTuiJianlieBiaoModel * liebiaoModel1 = _mutableArray[0];
            NSMutableDictionary *dic1 = [NSMutableDictionary dictionary];
            //添加字典
            [dic1 setObject:liebiaoModel1.albumId forKey:@"albumId"];
            [dic1 setObject:@"1" forKey:@"position"];
            [dic1 setObject:liebiaoModel1.title forKey:@"title"];
            [cell.image1 addClickedWithTarget:self action:@selector(clickToAlbumld:) withObjcet:dic1];

            faXianTuiJianlieBiaoModel * liebiaoModel2 = _mutableArray[1];
            NSMutableDictionary *dic2 = [NSMutableDictionary dictionary];
            //添加字典
            [dic2 setObject:liebiaoModel2.albumId forKey:@"albumId"];
            [dic2 setObject:@"2" forKey:@"position"];
            [dic2 setObject:liebiaoModel2.title forKey:@"title"];
            [cell.image2 addClickedWithTarget:self action:@selector(clickToAlbumld:) withObjcet:dic2];

            faXianTuiJianlieBiaoModel * liebiaoModel3 = _mutableArray[2];
            NSMutableDictionary *dic3 = [NSMutableDictionary dictionary];
            //添加字典
            [dic3 setObject:liebiaoModel3.albumId forKey:@"albumId"];
            [dic3 setObject:@"3" forKey:@"position"];
            [dic3 setObject:liebiaoModel3.title forKey:@"title"];
            [cell.image3 addClickedWithTarget:self action:@selector(clickToAlbumld:) withObjcet:dic3];

        }
    }
    else {
        if (indexPath.row < _mutableDictionaryArray.count) {
            cell.titleType.text = _mutableDictionaryArray[indexPath.row  - 1];
            cell.focusImageDictionary = _mutableDictionary[_mutableDictionaryArray[indexPath.row  - 1]];

            faXianTuiJianlieBiaoModel * liebiaoModel1 = _mutableDictionary[_mutableDictionaryArray[indexPath.row  - 1]][0];
            NSMutableDictionary *dic1 = [NSMutableDictionary dictionary];
            //添加字典
            [dic1 setObject:liebiaoModel1.albumId forKey:@"albumId"];
            [dic1 setObject:@"1" forKey:@"position"];
            [dic1 setObject:liebiaoModel1.title forKey:@"title"];
            [cell.image1 addClickedWithTarget:self action:@selector(clickToAlbumld:) withObjcet:dic1];

            faXianTuiJianlieBiaoModel * liebiaoModel2 = _mutableDictionary[_mutableDictionaryArray[indexPath.row  - 1]][1];
            NSMutableDictionary *dic2 = [NSMutableDictionary dictionary];
            //添加字典
            [dic2 setObject:liebiaoModel2.albumId forKey:@"albumId"];
            [dic2 setObject:@"2" forKey:@"position"];
            [dic2 setObject:liebiaoModel2.title forKey:@"title"];
            [cell.image2 addClickedWithTarget:self action:@selector(clickToAlbumld:) withObjcet:dic2];

            faXianTuiJianlieBiaoModel * liebiaoModel3 = _mutableDictionary[_mutableDictionaryArray[indexPath.row  - 1]][2];
            NSMutableDictionary *dic3 = [NSMutableDictionary dictionary];
            //添加字典
            [dic3 setObject:liebiaoModel3.albumId forKey:@"albumId"];
            [dic3 setObject:@"3" forKey:@"position"];
            [dic3 setObject:liebiaoModel3.title forKey:@"title"];
            [cell.image3 addClickedWithTarget:self action:@selector(clickToAlbumld:) withObjcet:dic3];

        }
    }
    return cell;

}

- (void)clickToAlbumld:(NSMutableDictionary *)dic{

    //使用Storyboard初始化根界面
//    1、加载storyboard
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"ZhuanjiStoryboard" bundle:nil];
//    2、下面这个方法代表着创建storyboard中箭头指向的控制器(初始控制器)
    UINavigationController *nav= [storyBoard instantiateInitialViewController];
    ZhuanjiTableViewController *zhunji = nav.viewControllers[0];
    zhunji.paramDictionary = dic;
    [self showDetailViewController:nav sender:nil];

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 160;
}

//// 设置显示数据 与viewForHeaderInSection 不可以共存
//- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
//    return @"猜你喜欢";
//}

#pragma mark tableViewDelegate

// 必须实现 设置行高
////必须实现 分区header的高度
//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return 100;
//}
//
////必须实现 分区footer的高度
//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
//    return 10;
//}

// 点击row时 获取路径
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation

 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end


text:
<?php
namespace Dinnovos\Amazonas\Models\Base;
/**
* @Table("blocks")
*/
Class BlockModelBase
{
	const table = 'as_blocks';
	const title = 'label';
	const primary = 'id';
	const hasTimestampable = true;
    const modelLanguage = 'Dinnovos\Amazonas\Models\LanguageModel';
    const modelTranslation = 'Dinnovos\Amazonas\Models\BlockTranslationModel';
}