text:
package pokeraidbot.infrastructure.jpa.raid;

import net.dv8tion.jda.api.entities.User;
import pokeraidbot.Utils;
import pokeraidbot.domain.config.LocaleService;
import pokeraidbot.domain.errors.UserMessedUpException;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalTime;
import java.util.UUID;

@Entity
public class RaidEntitySignUp implements Serializable {
    @Id
    @Column(nullable = false)
    private String id;
    @Column(nullable = false)
    private String responsible;
    @Column(nullable = false)
    private Integer numberOfPeople;
    @Column(nullable = false)
    private String eta;

    // JPA
    protected RaidEntitySignUp() {
    }

    public RaidEntitySignUp(String responsible, Integer numberOfPeople, String eta) {
        id = UUID.randomUUID().toString();
        this.responsible = responsible;
        this.numberOfPeople = numberOfPeople;
        this.eta = eta;
    }

    public String getResponsible() {
        return responsible;
    }

    public Integer getNumberOfPeople() {
        return numberOfPeople;
    }

    public String getEta() {
        return eta;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RaidEntitySignUp)) return false;

        RaidEntitySignUp that = (RaidEntitySignUp) o;

        if (responsible != null ? !responsible.equals(that.responsible) : that.responsible != null) return false;
        if (numberOfPeople != null ? !numberOfPeople.equals(that.numberOfPeople) : that.numberOfPeople != null)
            return false;
        return eta != null ? eta.equals(that.eta) : that.eta == null;
    }

    @Override
    public int hashCode() {
        int result = responsible != null ? responsible.hashCode() : 0;
        result = 31 * result + (numberOfPeople != null ? numberOfPeople.hashCode() : 0);
        result = 31 * result + (eta != null ? eta.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "RaidEntitySignUp{" +
                "user='" + responsible + '\'' +
                ", numberOfPeople=" + numberOfPeople +
                ", eta='" + eta + '\'' +
                '}';
    }

    public void setNumberOfPeople(int numberOfPeople, LocaleService localeService, User user) {
        if (numberOfPeople < 0 || numberOfPeople > Utils.HIGH_LIMIT_FOR_SIGNUPS) {
            throw new UserMessedUpException((User)null, localeService.getMessageFor(LocaleService.SIGNUP_BAD_NUMBER,
                    localeService.getLocaleForUser(user), String.valueOf(this.numberOfPeople),
                    String.valueOf(numberOfPeople)));
        }
        this.numberOfPeople = numberOfPeople;
    }

    public void setEta(String arrivalTime) {
        this.eta = arrivalTime;
    }

    public LocalTime getArrivalTime() {
        return LocalTime.parse(eta, Utils.timeParseFormatter);
    }
}


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 05/09/2014 15:29:24 by Hibernate Tools 3.6.0 -->
<hibernate-mapping>
    <class name="Hibernate.Fase" table="fase" catalog="sisgranja">
        <id name="codigo" type="java.lang.Integer">
            <column name="codigo" />
            <generator class="identity" />
        </id>
        <property name="nome" type="string">
            <column name="nome" length="50" not-null="true" />
        </property>
        <property name="descricao" type="string">
            <column name="descricao" length="200" not-null="true" />
        </property>
        <property name="tipo" type="int">
            <column name="tipo" not-null="true" />
        </property>
        <property name="inicio" type="int">
            <column name="inicio" not-null="true" />
        </property>
        <property name="duracao" type="int">
            <column name="duracao" not-null="true" />
        </property>
    </class>
</hibernate-mapping>

redpajama_set_name: RedPajamaGithub


text:
// Object Tooltip|Prefabs|0020
namespace VRTK
{
    using UnityEngine;
    using UnityEngine.UI;

    /// <summary>
    /// This adds a UI element into the World Space that can be used to provide additional information about an object by providing a piece of text with a line drawn to a destination point.
    /// </summary>
    /// <remarks>
    /// There are a number of parameters that can be set on the Prefab which are provided by the `VRTK_ObjectTooltip` script which is applied to the prefab.
    /// </remarks>
    /// <example>
    /// `VRTK/Examples/029_Controller_Tooltips` displays two cubes that have an object tooltip added to them along with tooltips that have been added to the controllers.
    /// </example>
    public class VRTK_ObjectTooltip : MonoBehaviour
    {
        [Tooltip("The text that is displayed on the tooltip.")]
        public string displayText;
        [Tooltip("The size of the text that is displayed.")]
        public int fontSize = 14;
        [Tooltip("The size of the tooltip container where `x = width` and `y = height`.")]
        public Vector2 containerSize = new Vector2(0.1f, 0.03f);
        [Tooltip("An optional transform of where to start drawing the line from. If one is not provided the centre of the tooltip is used for the initial line position.")]
        public Transform drawLineFrom;
        [Tooltip("A transform of another object in the scene that a line will be drawn from the tooltip to, this helps denote what the tooltip is in relation to. If no transform is provided and the tooltip is a child of another object, then the parent object's transform will be used as this destination position.")]
        public Transform drawLineTo;
        [Tooltip("The width of the line drawn between the tooltip and the destination transform.")]
        public float lineWidth = 0.001f;
        [Tooltip("The colour to use for the text on the tooltip.")]
        public Color fontColor = Color.black;
        [Tooltip("The colour to use for the background container of the tooltip.")]
        public Color containerColor = Color.black;
        [Tooltip("The colour to use for the line drawn between the tooltip and the destination transform.")]
        public Color lineColor = Color.black;

        private LineRenderer line;

        /// <summary>
        /// The ResetTooltip method resets the tooltip back to its initial state.
        /// </summary>
        public void ResetTooltip()
        {
            SetContainer();
            SetText("UITextFront");
            SetText("UITextReverse");
            SetLine();
            if (drawLineTo == null && transform.parent != null)
            {
                drawLineTo = transform.parent;
            }
        }

        /// <summary>
        /// The UpdateText method allows the tooltip text to be updated at runtime.
        /// </summary>
        /// <param name="newText">A string containing the text to update the tooltip to display.</param>
        public void UpdateText(string newText)
        {
            displayText = newText;
            ResetTooltip();
        }

        private void Start()
        {
            ResetTooltip();
        }

        private void SetContainer()
        {
            transform.FindChild("TooltipCanvas").GetComponent<RectTransform>().sizeDelta = containerSize;
            var tmpContainer = transform.FindChild("TooltipCanvas/UIContainer");
            tmpContainer.GetComponent<RectTransform>().sizeDelta = containerSize;
            tmpContainer.GetComponent<Image>().color = containerColor;
        }

        private void SetText(string name)
        {
            var tmpText = transform.FindChild("TooltipCanvas/" + name).GetComponent<Text>();
            tmpText.material = Resources.Load("UIText") as Material;
            tmpText.text = displayText.Replace("\\n", "\n");
            tmpText.color = fontColor;
            tmpText.fontSize = fontSize;
        }

        private void SetLine()
        {
            line = transform.FindChild("Line").GetComponent<LineRenderer>();
            line.material = Resources.Load("TooltipLine") as Material;
            line.material.color = lineColor;
#if UNITY_5_5_OR_NEWER
            line.startColor = lineColor;
            line.endColor = lineColor;
            line.startWidth = lineWidth;
            line.endWidth = lineWidth;
#else
            line.SetColors(lineColor, lineColor);
            line.SetWidth(lineWidth, lineWidth);
#endif
            if (drawLineFrom == null)
            {
                drawLineFrom = transform;
            }
        }

        private void DrawLine()
        {
            if (drawLineTo)
            {
                line.SetPosition(0, drawLineFrom.position);
                line.SetPosition(1, drawLineTo.position);
            }
        }

        private void Update()
        {
            DrawLine();
        }
    }
}


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

using Twilio.Model;

namespace Twilio.Trunking.Model
{
    public class CredentialListResult : NextGenListBase
    {
        /// <summary>
        /// List of CredentialLists.
        /// </summary>
        public List<CredentialList> CredentialLists { get; set; }
    }
}


text:
<?php

$GLOBALS['translations'] = array_merge($GLOBALS['translations'], array(

// actions/attach.class.php
'ATTACH_ACTION_ATTACH' => 'Action {{attach ...}}',
'ATTACH_PARAM_DESC_REQUIRED' => '"desc" parameter required for an image',
'ATTACH_PARAM_HEIGHT_NOT_NUMERIC' => '"height" parameter, in pixels, should be a number integer',
'ATTACH_PARAM_WIDTH_NOT_NUMERIC' => '"width" parameter, in pixels, should be a number integer',
'ATTACH_UPLOAD_FORM_FOR_FILE' => 'Upload form for file',
'ATTACH_BACK_TO_PAGE' => 'Back to the page',
'NO_RIGHT_TO_WRITE_IN_THIS_PAGE' => 'No rights to write in this page',

// actions/filemanager.php
'ATTACH_NO_RIGHTS_TO_ACCESS_FILEMANAGER' => 'You have no rights to access the filemanager',

// actions/player.php
'ATTACH_ACTION_PLAYER' => 'Action {{player ...}}',
'ATTACH_DOWNLOAD_THE_FILE' => 'Download the file',
'ATTACH_URL_NOT_VALID' => 'Invalid URL or not openable',
'ATTACH_PARAM_URL_REQUIRED' => '"url" parameter required',
'ATTACH_PLAYER_CAN_ONLY_OPEN_FILES_LIKE' => 'The player can only open .mp3, .flv and .mm files and your URL',
'ATTACH_NOT_LINKED_TO_GOOD_FILE_EXTENSION' => 'is not linked to those type of files',

// actions/pointimage.php
'ATTACH_ACTION_POINTIMAGE' => 'Action {{pointimage ...}}',
'ATTACH_PARAM_FILE_NOT_FOUND' => '"file" parameter required',
'ATTACH_PARAM_FILE_MUST_BE_IMAGE' => '"file" parameter must be an image (.gif,.jpg,.jpeg or .png)',
'ATTACH_DEFAULT_MARKER' => 'Default marker',
'ATTACH_ADD_MARKER' => 'Add a marker',
'ATTACH_TITLE' => 'Title',
'ATTACH_DESCRIPTION' => 'Description',
'ATTACH_CANCEL' => 'Cancel',
'ATTACH_SAVE' => 'Save',

// handler edit
'ACTIVATE_JS_TO_UPLOAD_FILES' => 'Activate JavaScript to upload files',
'UPLOAD_A_FILE' => 'Upload a file',
'UPLOAD_FILE' => 'Upload file',
'CANCEL_THIS_UPLOAD' => 'Cancel this upload',
'INSERT' => 'Insert',
'DOWNLOAD_LINK_TEXT' => 'Download link text',
'IMAGE_ALIGN' => 'Image alignment',
'IMAGE_SIZE' => 'Image size',
'THUMBNAIL' => 'Thumbnail',
'MEDIUM' => 'Medium',
'BIG' => 'Big',
'ORIGINAL_SIZE' => 'Original size',
'CAPTION' => 'Caption text',
'SEE_THE_ADVANCED_PARAMETERS' => 'See the advanced parameters',
'ADVANCED_PARAMETERS' => 'Advanced parameters',
'ASSOCIATED_LINK' => 'Associated link',
'GRAPHICAL_EFFECTS' => 'Graphical effects',
'WHITE_BORDER' => 'White border',
'DROP_SHADOW' => 'Drop shadow',
'ZOOM_HOVER' => 'Zoom on hover',
'ALT_INFOS' => 'This texte will be displayed instead of the image, if the image is not found',
'ALTERNATIVE_TEXT' => 'Alternative text',
'LEFT' => 'Left',
'CENTER' => 'Center',
'RIGHT' => 'Right',
'FAILED' => 'Failed'

));


text:
<?php
$db = DB::getInstance();
$query = $db->query("SELECT * FROM email");
$results = $query->first();
?>
<!DOCTYPE html>

    <meta charset="utf-8">

Dear Donor <?=$fname;?>,

Thanks for your donation to Ping Pong Community. We have created an account for you to review your donations and print your donation receipts.

Please click the link below to continue set your password and start to use your account.

<a href="<?php echo $results->verify_url."users/invite_reset.php?email=".$email."&vericode=$vericode&reset=1"; ?>">Set Your Password

Sincerely,

- Ping Pong Community-


text:
**Ender is a full featured package manager for your browser.**

It allows you to search, install, manage, and compile front-end javascript packages and their dependencies for the web. We like to think of it as [NPM](https://github.com/isaacs/npm)'s little sister.

**Ender is not a JavaScript library**.

It's not a jQuery replacement. It's not even a static asset. It's a tool for making the consumption of front-end javascript packages dead simple and incredibly powerful.

![Ender](http://f.cl.ly/items/1W0P3I3D3m3U0e1j2h1c/Screen%20shot%202011-05-09%20at%2011.31.42%20AM.png)

## WHY?

In the browser - **small, loosely coupled modules are the future and large, tightly-bound monolithic libraries are the past!**

Ender capitalizes on this by offering a unique way to bring together the exciting work happening in javascript packages and allows you to mix, match, and customize your own build, suited to your individual needs, without all the extra cruft that comes with larger libraries.

With Ender, if one library goes bad or unmaintained, it can be replaced with another. Need a specific package version? No problem! Does your package have dependencies? Let us handle that for you too!

## MORE INFO

For more information checkout [http://ender.no.de](http://ender.no.de)


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.feed.library.common.concurrent;

import android.os.Handler;
import android.os.Looper;

import org.chromium.chrome.browser.feed.library.common.logging.Logger;

import java.util.concurrent.Executor;

/** Executes a task on the main thread (UI thread) with optional delay. */
/*@DoNotMock("Use org.chromium.chrome.browser.feed.library.common.concurrent.FakeMainThreadRunner
 * instead")*/
public class MainThreadRunner {
    private static final String TAG = "MainThreadRunner";
    private static final Handler sHandler = new Handler(Looper.getMainLooper());

    private final Executor mExecutor;

    public MainThreadRunner() {
        this.mExecutor = sHandler::post;
    }

    /** Executes the {@code runnable} on the {@link Executor} used to initialize this class. */
    public void execute(String name, Runnable runnable) {
        Logger.i(TAG, "Running task [%s] on the Main Thread", name);
        mExecutor.execute(runnable);
    }

    public CancelableTask executeWithDelay(String name, Runnable runnable, long delayMs) {
        CancelableRunnableTask cancelable = new CancelableRunnableTask(runnable);
        Logger.i(TAG, "Running task [%s] on the Main Thread with a delay of %d milliseconds", name,
                delayMs);
        sHandler.postDelayed(cancelable, delayMs);
        return cancelable;
    }
}


text: 'console' in this && 'timeline' in this.console


text:
set -eu

# This script is a convenience wrapper for making fresh test data with no
# extra dependencies.  We create in the current working directory.
#
# Most people should not need to run this; it's an "every few years" maintainer
# task.  So we can depend upon specific tools which make it sane to manage
# extensions.
# We're using github.com/cloudflare/cfssl

progname="$(basename "$0" .sh)"
warn() { printf >&2 '%s: %s\n' "$progname" "$*"; }
die() { warn "$@"; exit 1; }

[ -f tls.conf ] || die "no tls.conf in current directory"

ORG_NAME='Synadia Communications, Inc'
CA_COMMON_NAME='NATS top tool test suite'

# The default duration of the CA in cfssl is 5 years, changing it is
# non-obvious, so let's cap the lifetime of the issued certs to the CA duration
# to avoid confusion when the CA expires.
DURATION_YEARS=5
DURATION_STR="$(( DURATION_YEARS * 365 * 24 ))h"

csr_filter_common() {
  jq --arg org "$ORG_NAME" -r 'del(.CN) | del(.names[0].L) | .names[0].O=$org'
}

ca_csr_json() {
  cfssl print-defaults csr | csr_filter_common | \
    jq --arg cn "$CA_COMMON_NAME" -r '.CN=$cn | del(.hosts)'
}

client_csr_json() {
  cfssl print-defaults csr | csr_filter_common | \
    jq -r 'del(.hosts)'
}

server_csr_json() {
  cfssl print-defaults csr | csr_filter_common | \
    jq -r '.hosts = ["localhost", "127.0.0.1", "::1"]'
}

ca_cfg_json() {
  cfssl print-defaults config | \
    jq --arg dur "$DURATION_STR" -r '.signing.profiles |= map_values(.expiry = $dur)'
}

KEY_CURVE=secp384r1
SUBJ_PREFIX='/C=US/ST=California/O=Synadia Communications, LLC/OU=NATS'

CA_PUBLIC=ca.pem
# We will delete the key when done
CA_KEY=ca-key.pem
CA_CFG=ca-config.json

ca_cfg_json > "./$CA_CFG"

ca_csr_json | cfssl genkey -initca - | cfssljson -bare ca

gencert() { cfssl gencert -ca "$CA_PUBLIC" -ca-key "$CA_KEY" -config "$CA_CFG" "$@" ; }

client_csr_json | gencert -profile=client - | cfssljson -bare client
server_csr_json | gencert -profile=www - | cfssljson -bare server
mv -v client.pem client-cert.pem
mv -v server.pem server-cert.pem

rm -v ./*.csr "$CA_KEY" "$CA_CFG"


text:
/**
 * @module node-zk-treecache
 */

/**  */

/**
 *

 *     Controls which nodes a TreeCache processes. When iterating
 *     over the children of a parent node, a given node's children are
 *     queried only if {@link #traverseChildren(String)} returns true.
 *     When caching the list of nodes for a parent node, a given node is
 *     stored only if {@link #acceptChild(String)} returns true.
 *

 *
 *

 *     E.g. Given:
 *

 * root
 *     n1-a
 *     n1-b
 *         n2-a
 *         n2-b
 *             n3-a
 *     n1-c
 *     n1-d
 *

 *     You could have a TreeCache only work with the nodes: n1-a, n1-b, n2-a, n2-b, n1-d
 *     by returning false from traverseChildren() for "/root/n1-b/n2-b" and returning
 *     false from acceptChild("/root/n1-c").
 *

 */
export interface TreeCacheSelector {
  /**
   * Return true if children of this path should be cached.
   * i.e. if false is returned, this node is not queried to
   * determine if it has children or not
   *
   * @param fullPath full path of the ZNode
   * @return true/false
   */
  traverseChildren(fullPath: string): boolean

  /**
   * Return true if this node should be returned from the cache
   *
   * @param fullPath full path of the ZNode
   * @return true/false
   */
  acceptChild(fullPath: string): boolean
}

/**
 * @private
 */
export class DefaultTreeCacheSelector implements TreeCacheSelector {
  traverseChildren(_: string) {
    return true
  }

  acceptChild(_: string) {
    return true
  }
}


text:
package org.springframework.build.shadow;

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

import org.gradle.api.DefaultTask;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.component.ModuleComponentSelector;
import org.gradle.api.artifacts.query.ArtifactResolutionQuery;
import org.gradle.api.artifacts.result.ArtifactResolutionResult;
import org.gradle.api.artifacts.result.ComponentArtifactsResult;
import org.gradle.api.artifacts.result.DependencyResult;
import org.gradle.api.artifacts.result.ResolutionResult;
import org.gradle.api.artifacts.result.ResolvedArtifactResult;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.FileCopyDetails;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;
import org.gradle.jvm.JvmLibrary;
import org.gradle.language.base.artifact.SourcesArtifact;

/**
 * Gradle task to add source from shadowed jars into our own source jars.
 *
 * @author Phillip Webb
 * @author Andy Wilkinson
 */
public class ShadowSource extends DefaultTask {

	private final DirectoryProperty outputDirectory = getProject().getObjects().directoryProperty();

	private List<Configuration> configurations = new ArrayList<>();

	private final List<Relocation> relocations = new ArrayList<>();

	@Classpath
	@Optional
	public List<Configuration> getConfigurations() {
		return this.configurations;
	}

	public void setConfigurations(List<Configuration> configurations) {
		this.configurations = configurations;
	}

	@Nested
	public List<Relocation> getRelocations() {
		return this.relocations;
	}

	public void relocate(String pattern, String destination) {
		this.relocations.add(new Relocation(pattern, destination));
	}

	@OutputDirectory
	DirectoryProperty getOutputDirectory() {
		return this.outputDirectory;
	}

	@TaskAction
	void syncSourceJarFiles() {
		sync(getSourceJarFiles());
	}

	private List<File> getSourceJarFiles() {
		List<File> sourceJarFiles = new ArrayList<>();
		for (Configuration configuration : this.configurations) {
			ResolutionResult resolutionResult = configuration.getIncoming().getResolutionResult();
			resolutionResult.getRootComponent().get().getDependencies().forEach(dependency -> {
				Set<ComponentArtifactsResult> artifactsResults = resolveSourceArtifacts(dependency);
				for (ComponentArtifactsResult artifactResult : artifactsResults) {
					artifactResult.getArtifacts(SourcesArtifact.class).forEach(sourceArtifact -> {
						sourceJarFiles.add(((ResolvedArtifactResult) sourceArtifact).getFile());
					});
				}
			});
		}
		return Collections.unmodifiableList(sourceJarFiles);
	}

	private Set<ComponentArtifactsResult> resolveSourceArtifacts(DependencyResult dependency) {
		ModuleComponentSelector componentSelector = (ModuleComponentSelector) dependency.getRequested();
		ArtifactResolutionQuery query = getProject().getDependencies().createArtifactResolutionQuery()
				.forModule(componentSelector.getGroup(), componentSelector.getModule(), componentSelector.getVersion());
		return executeQuery(query).getResolvedComponents();
	}

	@SuppressWarnings("unchecked")
	private ArtifactResolutionResult executeQuery(ArtifactResolutionQuery query) {
		return query.withArtifacts(JvmLibrary.class, SourcesArtifact.class).execute();
	}

	private void sync(List<File> sourceJarFiles) {
		getProject().sync(spec -> {
			spec.into(this.outputDirectory);
			spec.eachFile(this::relocateFile);
			spec.filter(this::transformContent);
			spec.exclude("META-INF/**");
			spec.setIncludeEmptyDirs(false);
			sourceJarFiles.forEach(sourceJar -> spec.from(zipTree(sourceJar)));
		});
	}

	private void relocateFile(FileCopyDetails details) {
		String path = details.getPath();
		for (Relocation relocation : this.relocations) {
			path = relocation.relocatePath(path);
		}
		details.setPath(path);
	}

	private String transformContent(String content) {
		for (Relocation relocation : this.relocations) {
			content = relocation.transformContent(content);
		}
		return content;
	}

	private FileTree zipTree(File sourceJar) {
		return getProject().zipTree(sourceJar);
	}

	/**
	 * A single relocation.
	 */
	static class Relocation {

		private final String pattern;

		private final String pathPattern;

		private final String destination;

		private final String pathDestination;

		Relocation(String pattern, String destination) {
			this.pattern = pattern;
			this.pathPattern = pattern.replace('.', '/');
			this.destination = destination;
			this.pathDestination = destination.replace('.', '/');
		}

		@Input
		public String getPattern() {
			return this.pattern;
		}

		@Input
		public String getDestination() {
			return this.destination;
		}

		String relocatePath(String path) {
			return path.replace(this.pathPattern, this.pathDestination);
		}

		public String transformContent(String content) {
			return content.replaceAll("\\b" + this.pattern, this.destination);
		}

	}

}


text:
var util = require("util");
var choreography = require("temboo/core/choreography");

/*
    GetPartners
    Returns detailed listings of all Kiva field partners.
*/

var GetPartners = function(session) {
    /*
        Create a new instance of the GetPartners Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/Kiva/Partners/GetPartners"
    GetPartners.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new GetPartnersResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new GetPartnersInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the GetPartners
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var GetPartnersInputSet = function() {
    GetPartnersInputSet.super_.call(this);
        /*
        Set the value of the AppID input for this Choreo. ((optional, string) Your unique application ID, usually in reverse DNS notation.)
        */
        this.set_AppID = function(value) {
            this.setInput("AppID", value);
        }

        /*
        Set the value of the Page input for this Choreo. ((optional, integer) The page position of results to return. Defaults to 1.)
        */
        this.set_Page = function(value) {
            this.setInput("Page", value);
        }

        /*
        Set the value of the ResponseType input for this Choreo. ((optional, string) Output returned can be XML or JSON. Defaults to JSON.)
        */
        this.set_ResponseType = function(value) {
            this.setInput("ResponseType", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the GetPartners Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var GetPartnersResultSet = function(resultStream) {
    GetPartnersResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. (The response from Kiva.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
}

util.inherits(GetPartners, choreography.Choreography);
util.inherits(GetPartnersInputSet, choreography.InputSet);
util.inherits(GetPartnersResultSet, choreography.ResultSet);
exports.GetPartners = GetPartners;


text:
This directory contains a series of shell scripts to be run at different intervals during the build process:

- Scripts prefixed with `before_` are intended to be first in order to setup any necessary dependencies.

- Scripts prefixed with `after_` are intended to be run after the build to do any post-process reporting.

- Scripts without a decerning prefix are intended to be run as part of the actual build process.

All of these scripts are intended to be run from the root directory of this source code repository, e.g. as `./Build/<build-script>.sh`.

The `./build.sh` script can be used in the top-level directory to run the whole build process, otherwise the project should be built on push, by the [Travis CI server](https://travis-ci.org/ice3-software/between-kit).


text:
import {
  createSimpleTransition,
  createJavaScriptTransition
} from '../../util/helpers'

import ExpandTransitionFunctions from './expand-transition'

// Component specific transitions
export const VBottomSheetTranstion = createSimpleTransition('bottom-sheet-transition')
export const VCarouselTransition = createSimpleTransition('carousel-transition')
export const VCarouselReverseTransition = createSimpleTransition('carousel-reverse-transition')
export const VTabTransition = createSimpleTransition('tab-transition')
export const VTabReverseTransition = createSimpleTransition('tab-reverse-transition')
export const VMenuTransition = createSimpleTransition('menu-transition')
export const VFabTransition = createSimpleTransition('fab-transition', 'center center', 'out-in')

// Generic transitions
export const VDialogTransition = createSimpleTransition('dialog-transition')
export const VDialogBottomTransition = createSimpleTransition('dialog-bottom-transition')
export const VFadeTransition = createSimpleTransition('fade-transition')
export const VScaleTransition = createSimpleTransition('scale-transition')
export const VSlideXTransition = createSimpleTransition('slide-x-transition')
export const VSlideXReverseTransition = createSimpleTransition('slide-x-reverse-transition')
export const VSlideYTransition = createSimpleTransition('slide-y-transition')
export const VSlideYReverseTransition = createSimpleTransition('slide-y-reverse-transition')

// JavaScript transitions
export const VExpandTransition = createJavaScriptTransition('expand-transition', ExpandTransitionFunctions)

export default function install (Vue) {
  Vue.component('v-bottom-sheet-transition', VBottomSheetTranstion)
  Vue.component('v-carousel-transition', VCarouselTransition)
  Vue.component('v-carousel-reverse-transition', VCarouselReverseTransition)
  Vue.component('v-dialog-transition', VDialogTransition)
  Vue.component('v-dialog-bottom-transition', VDialogBottomTransition)
  Vue.component('v-fab-transition', VFabTransition)
  Vue.component('v-fade-transition', VFadeTransition)
  Vue.component('v-menu-transition', VMenuTransition)
  Vue.component('v-scale-transition', VScaleTransition)
  Vue.component('v-slide-x-transition', VSlideXTransition)
  Vue.component('v-slide-x-reverse-transition', VSlideXReverseTransition)
  Vue.component('v-slide-y-transition', VSlideYTransition)
  Vue.component('v-slide-y-reverse-transition', VSlideYReverseTransition)
  Vue.component('v-tab-reverse-transition', VTabReverseTransition)
  Vue.component('v-tab-transition', VTabTransition)
  Vue.component('v-expand-transition', VExpandTransition)
}


text:
@interface MyLinearLayoutTestCase : MyLayoutTestCaseBase

@end

@implementation MyLinearLayoutTestCase

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.

    for (int i = 1; i <=7; i++)
    {
        Class cls = NSClassFromString([NSString stringWithFormat:@"LLTest%dViewController", i]);
        UIViewController *vc = [cls new];
        UIView *v = vc.view;
        [v layoutIfNeeded];
    }

    for (int i = 1; i <=3; i++)
    {
        Class cls = NSClassFromString([NSString stringWithFormat:@"TLTest%dViewController", i]);
        UIViewController *vc = [cls new];
        UIView *v = vc.view;
        [v layoutIfNeeded];
    }

    for (int i = 1; i <=12; i++)
    {
        Class cls = NSClassFromString([NSString stringWithFormat:@"AllTest%dViewController", i]);
        UIViewController *vc = [cls new];
        UIView *v = vc.view;
        [v layoutIfNeeded];
    }

}

-(void)testWrapContentHeight
{

}

-(void)testSubviewSizeDependent
{//测试子视图尺寸依赖

    //垂直线性布局
    {
        MyLinearLayout *rootLayout1 = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 375, 667) orientation:MyOrientation_Vert];
        rootLayout1.heightSize.equalTo(nil);
        //1. 子视图宽度等于自身高度
        UILabel *label1 = [UILabel new];
        label1.myHeight = 100;
        label1.widthSize.equalTo(label1.heightSize);
        [rootLayout1 addSubview:label1];

        //2. 子视图高度等于自身宽度
        UILabel *label2 = [UILabel new];
        label2.widthSize.equalTo(@(MyLayoutSize.wrap));
        label2.heightSize.equalTo(label2.widthSize);
        label2.text = @"hello World";
        [rootLayout1 addSubview:label2];

        //3. 子视图高度等于兄弟视图高度, 子视图宽度等于兄弟视图宽度
        UILabel *label3 = [UILabel new];
        label3.heightSize.equalTo(label1.heightSize);
        label3.widthSize.equalTo(label1.widthSize);
        [rootLayout1 addSubview:label3];

        //4. 子视图高度等于兄弟视图宽度, 子视图宽度等于兄弟视图高度
        UILabel *label4 = [UILabel new];
        label4.widthSize.equalTo(label2.heightSize).add(20);
        label4.heightSize.equalTo(label2.widthSize).add(10).multiply(0.5);
        [rootLayout1 addSubview:label4];

        //5. 子视图宽度等于父视图宽度,高度等于宽度
        UILabel *label5 = [UILabel new];
        label5.widthSize.equalTo(rootLayout1.widthSize).add(-20);
        label5.heightSize.equalTo(label5.widthSize);
        [rootLayout1 addSubview:label5];

        //6. 子视图高度等于父视图高度,宽度等于高度
        UILabel *label6 = [UILabel new];
        label6.heightSize.equalTo(rootLayout1.heightSize).multiply(0.5);
        label6.widthSize.equalTo(label6.heightSize);
        [rootLayout1 addSubview:label6];

        [rootLayout1 layoutIfNeeded];

        XCTAssertTrue(label1.frame.size.width == label1.frame.size.height, @"label1.frame = %@",NSStringFromCGRect(label1.frame));
        XCTAssertTrue(label2.frame.size.width == label2.frame.size.height, @"label1.frame = %@",NSStringFromCGRect(label2.frame));
        XCTAssertTrue(label3.frame.size.width == label1.frame.size.width &&
                      label3.frame.size.height == label1.frame.size.height, @"label3.frame = %@",NSStringFromCGRect(label3.frame));
        XCTAssertTrue(label4.frame.size.width == (label2.frame.size.height + 20) &&
                      label4.frame.size.height == (label2.frame.size.width * 0.5 + 10), @"label4.frame = %@",NSStringFromCGRect(label4.frame));

        XCTAssertTrue(label5.frame.size.width == (rootLayout1.frame.size.width - 20) &&
                      label5.frame.size.height == label5.frame.size.width, @"label5.frame = %@",NSStringFromCGRect(label5.frame));

        XCTAssertTrue(label6.frame.size.width == label6.frame.size.height &&
                      label6.frame.size.height == rootLayout1.frame.size.height * 0.5, @"label6.frame = %@",NSStringFromCGRect(label6.frame));
    }

    //水平线性布局
    {
        MyLinearLayout *rootLayout1 = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 375, 667) orientation:MyOrientation_Horz];
        rootLayout1.widthSize.equalTo(nil);
        //1. 子视图宽度等于自身高度
        UILabel *label1 = [UILabel new];
        label1.myHeight = 100;
        label1.widthSize.equalTo(label1.heightSize);
        [rootLayout1 addSubview:label1];

        //2. 子视图高度等于自身宽度
        UILabel *label2 = [UILabel new];
        label2.widthSize.equalTo(@(MyLayoutSize.wrap));
        label2.heightSize.equalTo(label2.widthSize);
        label2.text = @"hello World";
        [rootLayout1 addSubview:label2];

        //3. 子视图高度等于兄弟视图高度, 子视图宽度等于兄弟视图宽度
        UILabel *label3 = [UILabel new];
        label3.heightSize.equalTo(label1.heightSize);
        label3.widthSize.equalTo(label1.widthSize);
        [rootLayout1 addSubview:label3];

        //4. 子视图高度等于兄弟视图宽度, 子视图宽度等于兄弟视图高度
        UILabel *label4 = [UILabel new];
        label4.widthSize.equalTo(label2.heightSize).add(20);
        label4.heightSize.equalTo(label2.widthSize).add(10).multiply(0.5);
        [rootLayout1 addSubview:label4];

        //5. 子视图宽度等于父视图宽度,高度等于宽度
        UILabel *label5 = [UILabel new];
        label5.widthSize.equalTo(rootLayout1.widthSize).add(-20);
        label5.heightSize.equalTo(label5.widthSize);
        [rootLayout1 addSubview:label5];

        //6. 子视图高度等于父视图高度,宽度等于高度
        UILabel *label6 = [UILabel new];
        label6.heightSize.equalTo(rootLayout1.heightSize).multiply(0.5);
        label6.widthSize.equalTo(label6.heightSize);
        [rootLayout1 addSubview:label6];

        [rootLayout1 layoutIfNeeded];

        XCTAssertTrue(label1.frame.size.width == label1.frame.size.height, @"label1.frame = %@",NSStringFromCGRect(label1.frame));
        XCTAssertTrue(label2.frame.size.width == label2.frame.size.height, @"label1.frame = %@",NSStringFromCGRect(label2.frame));
        XCTAssertTrue(label3.frame.size.width == label1.frame.size.width &&
                      label3.frame.size.height == label1.frame.size.height, @"label3.frame = %@",NSStringFromCGRect(label3.frame));
        XCTAssertTrue(label4.frame.size.width == (label2.frame.size.height + 20) &&
                      label4.frame.size.height == (label2.frame.size.width * 0.5 + 10), @"label4.frame = %@",NSStringFromCGRect(label4.frame));

        XCTAssertTrue(label5.frame.size.width == (rootLayout1.frame.size.width - 20) &&
                      label5.frame.size.height == label5.frame.size.width, @"label5.frame = %@",NSStringFromCGRect(label5.frame));

        XCTAssertTrue(label6.frame.size.width == label6.frame.size.height &&
                      label6.frame.size.height == rootLayout1.frame.size.height * 0.5, @"label6.frame = %@",NSStringFromCGRect(label6.frame));

    }

}

-(void)testSubviewSizeDependent2
{
    //测试隐藏、比重、尺寸依赖。

    MyLinearLayout *layout2 = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 375, 200) orientation:MyOrientation_Horz];
    layout2.widthSize.equalTo(nil);

    UIButton *zoneBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    zoneBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    zoneBtn.titleLabel.textAlignment = NSTextAlignmentCenter;

    UILabel *nameLab = [[UILabel alloc] initWithFrame:CGRectZero];
    nameLab.numberOfLines = 1.0;
    nameLab.font = [UIFont systemFontOfSize:18];
    nameLab.textAlignment = NSTextAlignmentCenter;

    UIButton *placeholderBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];

    zoneBtn.myLeft = 20;
    zoneBtn.myCenterY = 0;
    zoneBtn.widthSize.equalTo(zoneBtn.widthSize).add(20);
    zoneBtn.heightSize.equalTo(zoneBtn.heightSize).add(3);

    nameLab.myCenterY = 0;
    nameLab.weight = 1.0;
    nameLab.heightSize.equalTo(nameLab.heightSize);

    placeholderBtn.myCenterY = 0;
    placeholderBtn.myRight = 20;
    placeholderBtn.widthSize.equalTo(zoneBtn.widthSize);
    placeholderBtn.heightSize.equalTo(zoneBtn.heightSize);

    [layout2 addSubview:zoneBtn];
    [layout2 addSubview:nameLab];
    [layout2 addSubview:placeholderBtn];

    zoneBtn.visibility = MyVisibility_Gone;
    placeholderBtn.visibility = MyVisibility_Gone;

    [layout2 layoutIfNeeded];

    XCTAssertTrue(nameLab.frame.size.width == layout2.frame.size.width &&
                  nameLab.center.y == layout2.frame.size.height * 0.5, @"nameLab.frame = %@",NSStringFromCGRect(nameLab.frame));

}

-(void)testWeight
{//测试均分

    MyLinearLayout* rootLayout1 = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 375, 667) orientation:MyOrientation_Horz];
   // rootLayout1.myMargin = 0;
    rootLayout1.backgroundColor = [UIColor redColor];
    rootLayout1.widthSize.equalTo(nil);

    for (int i = 0; i < 4; i++)
    {
        UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.weight = 1;
        if (i % 2 == 0)
        {
            button.backgroundColor = [UIColor yellowColor];
        }
        else
        {
            button.backgroundColor = [UIColor greenColor];
        }
        [button setTitle:[NSString stringWithFormat:@"%i",i] forState:UIControlStateNormal];
        button.heightSize.equalTo(rootLayout1.heightSize);
        [rootLayout1 addSubview:button];
    }

    [rootLayout1 layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(rootLayout1.subviews[0].frame, CGRectMake(0,0,94,667)), @"the button0.frame = %@",NSStringFromCGRect(rootLayout1.subviews[0].frame));
    XCTAssertTrue(CGRectEqualToRect(rootLayout1.subviews[1].frame, CGRectMake(94,0,94,667)), @"the button0.frame = %@",NSStringFromCGRect(rootLayout1.subviews[1].frame));
    XCTAssertTrue(CGRectEqualToRect(rootLayout1.subviews[2].frame, CGRectMake(188,0,94,667)), @"the button0.frame = %@",NSStringFromCGRect(rootLayout1.subviews[2].frame));
    XCTAssertTrue(CGRectEqualToRect(rootLayout1.subviews[3].frame, CGRectMake(282,0,94,667)), @"the button0.frame = %@",NSStringFromCGRect(rootLayout1.subviews[3].frame));

}

-(void)testWrapContentHeight2
{
    MyLinearLayout *layout = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 375, 0) orientation:MyOrientation_Vert];
    layout.backgroundColor = [UIColor redColor];
    layout.gravity = MyGravity_Horz_Center;
    layout.padding = UIEdgeInsetsMake(15, 0, 0, 0);
    layout.subviewVSpace = 12;

    UILabel *timeLabel = UILabel.new;
    timeLabel.myHorzMargin = 0;
    timeLabel.myHeight = MyLayoutSize.wrap;
    timeLabel.textAlignment = NSTextAlignmentCenter;
    timeLabel.text = @"剩余时间为";
    [layout addSubview:timeLabel];

    // 汇率
    MyLinearLayout *convertLayout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Horz];
    convertLayout.backgroundColor = [UIColor greenColor];
    convertLayout.myHeight = MyLayoutSize.wrap;
    convertLayout.gravity = MyGravity_Vert_Center;
    convertLayout.subviewHSpace = 7;
    [layout addSubview:convertLayout];

    NSArray *items = @[@"$454", @"^sdsf"];
    for (int i=0; i<items.count; i++) {
        UILabel *label = UILabel.new;
        label.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);
        label.text = items[i];
        label.font = [UIFont systemFontOfSize:28];
        [convertLayout addSubview:label];

        if (i==0) {

            UILabel *btn = [UILabel new];
            btn.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);
            btn.text = @"->";
            [convertLayout addSubview:btn];
        }
    }

    [layout layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(layout.frame, CGRectMake(0,0,375,81)), @"the layout.frame = %@",NSStringFromCGRect(layout.frame));
    XCTAssertTrue(CGRectEqualToRect(convertLayout.frame, CGRectMake(105,47.5,165,33.5)), @"the convertLayout.frame = %@",NSStringFromCGRect(convertLayout.frame));

    XCTAssertTrue(CGRectEqualToRect(timeLabel.frame, CGRectMake(0,15,375,20.5)), @"the timeLabel.frame = %@",NSStringFromCGRect(timeLabel.frame));
    XCTAssertTrue(CGRectEqualToRect(convertLayout.subviews[1].frame, CGRectMake(76,6.5,18.5,20.5)), @"the convertLayout.subviews[1].frame = %@",NSStringFromCGRect(convertLayout.subviews[1].frame));

}

-(void)testWrapGravityMinMaxShrink
{
    //测试自适应,停靠,最大和最小。
    MyLinearLayout *testLayout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Horz];
    testLayout.widthSize.min(200).max(300);
    testLayout.heightSize.equalTo(@(MyLayoutSize.wrap)).min(40).max(100);
    testLayout.shrinkType = MySubviewsShrink_Average;
    testLayout.subviewHSpace = 10;
    testLayout.gravity = MyGravity_Center;

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:@"点我" forState:UIControlStateNormal];
    button.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);
    [testLayout addSubview:button];

    UILabel *label1 = [[UILabel alloc] init];
    label1.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);
    label1.text = @"文本1";
    label1.backgroundColor = [UIColor grayColor];
    [testLayout addSubview:label1];

    UILabel *label2 = [[UILabel alloc] init];
    label2.text = @"文本2";
    label2.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);
    label2.backgroundColor = [UIColor cyanColor];
    [testLayout addSubview:label2];

    [testLayout layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(testLayout.frame, CGRectMake(0,0,200,40)), @"the testLayout.frame = %@",NSStringFromCGRect(testLayout.frame));
    XCTAssertTrue(CGRectEqualToRect(button.frame, CGRectMake(28,3,37,34)), @"the button.frame = %@",NSStringFromCGRect(button.frame));
    XCTAssertTrue(CGRectEqualToRect(label1.frame, CGRectMake(75,10,42.5,20.5)), @"the label1.frame = %@",NSStringFromCGRect(label1.frame));

    //字体高度扩高。文字超长。
    button.titleLabel.font = [UIFont systemFontOfSize:30];
    label1.text = @"文本111111111111";
    [testLayout setNeedsLayout];

    [testLayout layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(testLayout.frame, CGRectMake(0,0,251.5,48)), @"the testLayout.frame = %@",NSStringFromCGRect(testLayout.frame));
    XCTAssertTrue(CGRectEqualToRect(button.frame, CGRectMake(0,0,61,48)), @"the button.frame = %@",NSStringFromCGRect(button.frame));
    XCTAssertTrue(CGRectEqualToRect(label1.frame, CGRectMake(71,14,125.5,20.5)), @"the label1.frame = %@",NSStringFromCGRect(label1.frame));

//    label1.text = @"文本111111111111111111111111111";
//    label1.mySize = CGSizeMake(400, 20.5);
//
//    [testLayout setNeedsLayout];
//    [testLayout layoutIfNeeded];
//
//    XCTAssertTrue(CGRectEqualToRect(testLayout.frame, CGRectMake(0,0,330,48)), @"the testLayout.frame = %@",NSStringFromCGRect(testLayout.frame));
//    XCTAssertTrue(CGRectEqualToRect(button.frame, CGRectMake(0,0,44.5,48)), @"the button.frame = %@",NSStringFromCGRect(button.frame));
//    XCTAssertTrue(CGRectEqualToRect(label1.frame, CGRectMake(54.5,14,237,20.5)), @"the label1.frame = %@",NSStringFromCGRect(label1.frame));

}

-(void)testBetweenAndAround
{
    //测试布局视图的gravity属性的between和around特性。

    MyLinearLayout *layout = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 100, 100) orientation:MyOrientation_Vert];
    layout.heightSize.equalTo(nil);

    //一个子视图下的垂直和水平的差异。
    UIView *v1 = [UIView new];
    v1.mySize = CGSizeMake(30, 30);
    [layout addSubview:v1];

    layout.orientation = MyOrientation_Vert;
    layout.gravity = MyGravity_Vert_Between;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,30,30)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));

    layout.orientation = MyOrientation_Horz;
    layout.gravity = MyGravity_Horz_Between;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,30,30)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));

    layout.orientation = MyOrientation_Vert;
    layout.gravity = MyGravity_Vert_Around;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,35,30,30)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));

    layout.orientation = MyOrientation_Horz;
    layout.gravity = MyGravity_Horz_Around;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(35,0,30,30)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));

    //两个子视图
    UIView *v2 = [UIView new];
    v2.mySize = CGSizeMake(30, 30);
    [layout addSubview:v2];

    layout.orientation = MyOrientation_Vert;
    layout.gravity = MyGravity_Vert_Between;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,70,30,30)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));

    layout.orientation = MyOrientation_Horz;
    layout.gravity = MyGravity_Horz_Between;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(70,0,30,30)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));

    layout.orientation = MyOrientation_Vert;
    layout.gravity = MyGravity_Vert_Around;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,60,30,30)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));

    layout.orientation = MyOrientation_Horz;
    layout.gravity = MyGravity_Horz_Around;
    [layout layoutIfNeeded];
    XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(60,0,30,30)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));

}

-(void)testFillAndStretch
{
    //子视图有几个设置了约束,有几个没有设置约束。分别展现Fill 和Stretch的差异。
    if (1){
        MyLinearLayout *rootLayout = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 0, 400) orientation:MyOrientation_Vert];
        rootLayout.padding = UIEdgeInsetsMake(10, 10, 20, 20);
        rootLayout.widthSize.equalTo(@(MyLayoutSize.wrap));
        rootLayout.heightSize.equalTo(nil);

        //视图1宽度依赖父视图,高度设置。
        UILabel *v1 = [UILabel new];
        v1.text = @"你好";  //iPhone8模拟器
        v1.myHorzMargin = 10;
        v1.myHeight = MyLayoutSize.wrap;
        [rootLayout addSubview:v1];

        //视图2宽度定值,右边对齐,高度不设置。
        UIView *v2 = [UIView new];
        v2.myRight = 20;
        v2.myWidth = 50;
        [rootLayout addSubview:v2];

        //视图3宽度定值,居中对齐,高度设置。
        UIView *v3 = [UIView new];
        v3.widthSize.equalTo(v2.widthSize).add(20);
        v3.myCenterX = 0;
        v3.myHeight = 40;
        [rootLayout addSubview:v3];

        //视图4设置左右边距,并且宽度定值,高度不设置。
        UIView *v4 = [UIView new];
        v4.myHorzMargin = 30;
        v4.myWidth = 100;
        [rootLayout addSubview:v4];

        //视图5设置宽度依赖父视图,高度设置。
        UIView *v5 = [UIView new];
        v5.widthSize.equalTo(rootLayout.widthSize).multiply(0.5);
        v5.myHeight = 40;
        [rootLayout addSubview:v5];

        rootLayout.gravity = MyGravity_Vert_Fill;
        [rootLayout layoutIfNeeded];

        XCTAssertTrue(CGRectEqualToRect(rootLayout.frame, CGRectMake(0,0,190,400)), @"the rootLayout.frame = %@",NSStringFromCGRect(rootLayout.frame));

         XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(20,10,140,74.5)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
         XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(100,84.5,50,54)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
         XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(55,138.5,70,94)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));
         XCTAssertTrue(CGRectEqualToRect(v4.frame, CGRectMake(40,232,100,54)), @"the v4 .frame = %@",NSStringFromCGRect(v4.frame));
         XCTAssertTrue(CGRectEqualToRect(v5.frame, CGRectMake(10,286,80,94)), @"the v5 .frame = %@",NSStringFromCGRect(v5.frame));
    }

    if (1){
        MyLinearLayout *rootLayout = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 0, 400) orientation:MyOrientation_Vert];
        rootLayout.padding = UIEdgeInsetsMake(10, 10, 20, 20);
        rootLayout.widthSize.equalTo(@(MyLayoutSize.wrap));
        rootLayout.heightSize.equalTo(nil);

        //视图1宽度依赖父视图,高度设置。
        UILabel *v1 = [UILabel new];
        v1.text = @"你好";  //iPhone8模拟器
        v1.myHorzMargin = 10;
        v1.myHeight = MyLayoutSize.wrap;
        [rootLayout addSubview:v1];

        //视图2宽度定值,右边对齐,高度不设置。
        UIView *v2 = [UIView new];
        v2.myRight = 20;
        v2.myWidth = 50;
        [rootLayout addSubview:v2];

        //视图3宽度定值,居中对齐,高度设置。
        UIView *v3 = [UIView new];
        v3.widthSize.equalTo(v2.widthSize).add(20);
        v3.myCenterX = 0;
        v3.myHeight = 40;
        [rootLayout addSubview:v3];

        //视图4设置左右边距,并且宽度定值,高度不设置。
        UIView *v4 = [UIView new];
        v4.myHorzMargin = 30;
        v4.myWidth = 100;
        [rootLayout addSubview:v4];

        //视图5设置宽度依赖父视图,高度设置。
        UIView *v5 = [UIView new];
        v5.widthSize.equalTo(rootLayout.widthSize).multiply(0.5);
        v5.myHeight = 40;
        [rootLayout addSubview:v5];

        rootLayout.gravity = MyGravity_Vert_Stretch;
        [rootLayout layoutIfNeeded];

        XCTAssertTrue(CGRectEqualToRect(rootLayout.frame, CGRectMake(0,0,190,400)), @"the rootLayout.frame = %@",NSStringFromCGRect(rootLayout.frame));

        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(20,10,140,110.5)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(100,120.5,50,90)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(55,210,70,40)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));
        XCTAssertTrue(CGRectEqualToRect(v4.frame, CGRectMake(40,250,100,90)), @"the v4 .frame = %@",NSStringFromCGRect(v4.frame));
        XCTAssertTrue(CGRectEqualToRect(v5.frame, CGRectMake(10,340,80,40)), @"the v5 .frame = %@",NSStringFromCGRect(v5.frame));
    }

    if (1){
        MyLinearLayout *rootLayout = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 400, 0) orientation:MyOrientation_Horz];
        rootLayout.padding = UIEdgeInsetsMake(10, 10, 20, 20);
        rootLayout.widthSize.equalTo(nil);
        rootLayout.heightSize.equalTo(@(MyLayoutSize.wrap));

        //视图1高度依赖父视图,宽度设置。
        UILabel *v1 = [UILabel new];
        v1.text = @"你好";  //iPhone8模拟器
        v1.myVertMargin = 10;
        v1.myWidth = MyLayoutSize.wrap;
        [rootLayout addSubview:v1];

        //视图2高度定值,下边对齐,宽度不设置。
        UIView *v2 = [UIView new];
        v2.myBottom = 20;
        v2.myHeight = 50;
        [rootLayout addSubview:v2];

        //视图3高度定值,居中对齐,宽度设置。
        UIView *v3 = [UIView new];
        v3.heightSize.equalTo(v2.heightSize).add(20);
        v3.myCenterY = 0;
        v3.myWidth = 40;
        [rootLayout addSubview:v3];

        //视图4设置上下边距,并且高度定值,宽度不设置。
        UIView *v4 = [UIView new];
        v4.myVertMargin = 30;
        v4.myHeight = 100;
        [rootLayout addSubview:v4];

        //视图5设置高度依赖父视图,宽度设置。
        UIView *v5 = [UIView new];
        v5.heightSize.equalTo(rootLayout.heightSize).multiply(0.5);
        v5.myWidth = 40;
        [rootLayout addSubview:v5];

        rootLayout.gravity = MyGravity_Horz_Fill;
        [rootLayout layoutIfNeeded];

        XCTAssertTrue(CGRectEqualToRect(rootLayout.frame, CGRectMake(0,0,400,190)), @"the rootLayout.frame = %@",NSStringFromCGRect(rootLayout.frame));

        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(10,20,86,140)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(96,100,51,50)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(147,55,91,70)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));
        XCTAssertTrue(CGRectEqualToRect(v4.frame, CGRectMake(238,40,51,100)), @"the v4 .frame = %@",NSStringFromCGRect(v4.frame));
        XCTAssertTrue(CGRectEqualToRect(v5.frame, CGRectMake(289,10,91,80)), @"the v5 .frame = %@",NSStringFromCGRect(v5.frame));
    }

    if (1){
        MyLinearLayout *rootLayout = [[MyLinearLayout alloc] initWithFrame:CGRectMake(0, 0, 400, 0) orientation:MyOrientation_Horz];
        rootLayout.padding = UIEdgeInsetsMake(10, 10, 20, 20);
        rootLayout.widthSize.equalTo(nil);
        rootLayout.heightSize.equalTo(@(MyLayoutSize.wrap));

        //视图1高度依赖父视图,宽度设置。
        UILabel *v1 = [UILabel new];
        v1.text = @"你好";  //iPhone8模拟器
        v1.myVertMargin = 10;
        v1.myWidth = MyLayoutSize.wrap;
        [rootLayout addSubview:v1];

        //视图2高度定值,下边对齐,宽度不设置。
        UIView *v2 = [UIView new];
        v2.myBottom = 20;
        v2.myHeight = 50;
        [rootLayout addSubview:v2];

        //视图3高度定值,居中对齐,宽度设置。
        UIView *v3 = [UIView new];
        v3.heightSize.equalTo(v2.heightSize).add(20);
        v3.myCenterY = 0;
        v3.myWidth = 40;
        [rootLayout addSubview:v3];

        //视图4设置上下边距,并且高度定值,宽度不设置。
        UIView *v4 = [UIView new];
        v4.myVertMargin = 30;
        v4.myHeight = 100;
        [rootLayout addSubview:v4];

        //视图5设置高度依赖父视图,宽度设置。
        UIView *v5 = [UIView new];
        v5.heightSize.equalTo(rootLayout.heightSize).multiply(0.5);
        v5.myWidth = 40;
        [rootLayout addSubview:v5];

        rootLayout.gravity = MyGravity_Horz_Stretch;
        [rootLayout layoutIfNeeded];

        XCTAssertTrue(CGRectEqualToRect(rootLayout.frame, CGRectMake(0,0,400,190)), @"the rootLayout.frame = %@",NSStringFromCGRect(rootLayout.frame));

        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(10,20,120,140)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(130,100,85,50)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(215,55,40,70)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));
        XCTAssertTrue(CGRectEqualToRect(v4.frame, CGRectMake(255,40,85,100)), @"the v4 .frame = %@",NSStringFromCGRect(v4.frame));
        XCTAssertTrue(CGRectEqualToRect(v5.frame, CGRectMake(340,10,40,80)), @"the v5 .frame = %@",NSStringFromCGRect(v5.frame));
    }

}

-(void)testequalizeSubviews
{
    //测试均分视图的能力。
    {
        MyLinearLayout *rootLayout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
        rootLayout.heightSize.equalTo(@300);
        rootLayout.frame = CGRectMake(0, 0, 100, 300);
        rootLayout.gravity = MyGravity_Horz_Fill;

        UIView *v1 = [UIView new];
        v1.myHeight = 10;
        UIView *v2 = [UIView new];
        v2.myHeight = 10;
        UIView *v3 = [UIView new];
        v3.myHeight = 10;

        [rootLayout addSubview:v1];
        [rootLayout addSubview:v2];
        [rootLayout addSubview:v3];

        [rootLayout equalizeSubviews:YES];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,43,100,43)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,129,100,43)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(0,215,100,43)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        [rootLayout equalizeSubviews:NO];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,100,60)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,120,100,60)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(0,240,100,60)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.weight = 0;
        v2.weight = 0;
        v3.weight = 0;
        [rootLayout equalizeSubviewsSpace:YES];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,67.5,100,10)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,67.5+10+67.5,100,10)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(0,67.5*3+10*2,100,10)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.myTop = 0;
        v1.myBottom = 0;
        v2.myTop = 0;
        v2.myBottom = 0;
        v3.myTop = 0;
        v3.myBottom = 0;
        [rootLayout equalizeSubviewsSpace:NO];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,100,10)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,135+10,100,10)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(0,135+10+135+10,100,10)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.weight = 0;
        v2.weight = 0;
        v3.weight = 0;
        v1.myTop = 0;
        v1.myBottom = 0;
        v2.myTop = 0;
        v2.myBottom = 0;
        v3.myTop = 0;
        v3.myBottom = 0;
        [rootLayout equalizeSubviews:YES withSpace:10];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,10,100,86.5)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,106.5,100,86.5)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(0,203,100,86.5)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.weight = 0;
        v2.weight = 0;
        v3.weight = 0;
        [rootLayout equalizeSubviews:NO withSpace:10];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,100,93.5)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(0,103.5,100,93.5)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(0,207,100,93.5)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));
    }

    {
        MyLinearLayout *rootLayout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Horz];
        rootLayout.widthSize.equalTo(@300);
        rootLayout.frame = CGRectMake(0, 0, 300, 100);
        rootLayout.gravity = MyGravity_Vert_Fill;

        UIView *v1 = [UIView new];
        v1.myWidth = 10;
        UIView *v2 = [UIView new];
        v2.myWidth = 10;
        UIView *v3 = [UIView new];
        v3.myWidth = 10;

        [rootLayout addSubview:v1];
        [rootLayout addSubview:v2];
        [rootLayout addSubview:v3];

        [rootLayout equalizeSubviews:YES];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(43,0,43,100)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(129,0,43,100)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(215,0,43,100)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        [rootLayout equalizeSubviews:NO];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,60,100)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(120,0,60,100)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(240,0,60,100)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.weight = 0;
        v2.weight = 0;
        v3.weight = 0;
        [rootLayout equalizeSubviewsSpace:YES];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(67.5,0,10,100)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(67.5+10+67.5,0,10,100)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(67.5*3+10*2,0,10,100)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.myLeading = 0;
        v1.myTrailing = 0;
        v2.myLeading = 0;
        v2.myTrailing = 0;
        v3.myLeading = 0;
        v3.myTrailing = 0;
        [rootLayout equalizeSubviewsSpace:NO];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,10,100)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(135+10,0,10,100)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(135+10+135+10,0,10,100)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.weight = 0;
        v2.weight = 0;
        v3.weight = 0;
        v1.myLeading = 0;
        v1.myTrailing = 0;
        v2.myLeading = 0;
        v2.myTrailing = 0;
        v3.myLeading = 0;
        v3.myTrailing = 0;
        [rootLayout equalizeSubviews:YES withSpace:10];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(10,0,86.5,100)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(106.5,0,86.5,100)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(203,0,86.5,100)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));

        v1.weight = 0;
        v2.weight = 0;
        v3.weight = 0;
        [rootLayout equalizeSubviews:NO withSpace:10];
        [rootLayout layoutIfNeeded];
        XCTAssertTrue(CGRectEqualToRect(v1.frame, CGRectMake(0,0,93.5,100)), @"the v1.frame = %@",NSStringFromCGRect(v1.frame));
        XCTAssertTrue(CGRectEqualToRect(v2.frame, CGRectMake(103.5,0,93.5,100)), @"the v2.frame = %@",NSStringFromCGRect(v2.frame));
        XCTAssertTrue(CGRectEqualToRect(v3.frame, CGRectMake(207,0,93.5,100)), @"the v3.frame = %@",NSStringFromCGRect(v3.frame));
    }

}

-(void)testMaxAndMin
{
    MyFrameLayout *rootLayout = [MyFrameLayout new];
    rootLayout.frame = CGRectMake(0, 0, 375, 667);

    // B 视图
    UIScrollView *scrollview = [[UIScrollView alloc] init];
    scrollview.backgroundColor = [UIColor blueColor];
    scrollview.myHorzMargin = 0;
    scrollview.heightSize.equalTo(@(MyLayoutSize.wrap)).min(280).uBound(rootLayout.heightSize, 66.5, 0.5);
    [rootLayout addSubview:scrollview];

    // 内容C视图
    MyLinearLayout * backLinear = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
    backLinear.backgroundColor = [UIColor greenColor];
    backLinear.myHorzMargin = 0;
    backLinear.heightSize.equalTo(@(MyLayoutSize.wrap)).min(280);
    backLinear.gravity = MyGravity_Vert_Bottom;
    [scrollview addSubview:backLinear];

    UIView *v = [UIView new];
    v.myHeight = 100;
    v.myWidth = 100;
    v.backgroundColor = [UIColor redColor];
    [backLinear addSubview:v];

    [rootLayout setNeedsLayout];
    [rootLayout layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(scrollview.frame, CGRectMake(0,0,375,280)), @"the scrollview.frame = %@",NSStringFromCGRect(scrollview.frame));
     XCTAssertTrue(CGSizeEqualToSize(scrollview.contentSize, CGSizeMake(375, 280)), @"the scrollview.contentSize = %@",NSStringFromCGSize(scrollview.contentSize));
    XCTAssertTrue(CGRectEqualToRect(backLinear.frame, CGRectMake(0,0,375,280)), @"the backLinear.frame = %@",NSStringFromCGRect(backLinear.frame));
    XCTAssertTrue(CGRectEqualToRect(v.frame, CGRectMake(0,180,100,100)), @"the v.frame = %@",NSStringFromCGRect(v.frame));

    v.myHeight = 350;
    [rootLayout setNeedsLayout];
    [rootLayout layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(scrollview.frame, CGRectMake(0,0,375,350)), @"the scrollview.frame = %@",NSStringFromCGRect(scrollview.frame));
    XCTAssertTrue(CGSizeEqualToSize(scrollview.contentSize, CGSizeMake(375, 350)), @"the scrollview.contentSize = %@",NSStringFromCGSize(scrollview.contentSize));
    XCTAssertTrue(CGRectEqualToRect(backLinear.frame, CGRectMake(0,0,375,350)), @"the backLinear.frame = %@",NSStringFromCGRect(backLinear.frame));
    XCTAssertTrue(CGRectEqualToRect(v.frame, CGRectMake(0,0,100,350)), @"the v.frame = %@",NSStringFromCGRect(v.frame));

    v.myHeight = 500;
    [rootLayout setNeedsLayout];
    [rootLayout layoutIfNeeded];

    XCTAssertTrue(CGRectEqualToRect(scrollview.frame, CGRectMake(0,0,375,400)), @"the scrollview.frame = %@",NSStringFromCGRect(scrollview.frame));
    XCTAssertTrue(CGSizeEqualToSize(scrollview.contentSize, CGSizeMake(375, 500)), @"the scrollview.contentSize = %@",NSStringFromCGSize(scrollview.contentSize));
    XCTAssertTrue(CGRectEqualToRect(backLinear.frame, CGRectMake(0,0,375,500)), @"the backLinear.frame = %@",NSStringFromCGRect(backLinear.frame));
    XCTAssertTrue(CGRectEqualToRect(v.frame, CGRectMake(0,0,100,500)), @"the v.frame = %@",NSStringFromCGRect(v.frame));

}

-(void)testNoLayoutConstraint1
{
    //这用来测试没有设置约束,直接通过frame来得到布局尺寸自适应的情况。
    {
        MyLinearLayout *rootLayout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
        rootLayout.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);

        UIView *v1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        [rootLayout addSubview:v1];

        UIView *v2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
        [rootLayout addSubview:v2];

        UIView *v3 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
        [rootLayout addSubview:v3];

        [rootLayout layoutIfNeeded];
        MyRectAssert(rootLayout, CGRectMake(0, 0, 300, 100+200+300));
    }

    {
        MyLinearLayout *rootLayout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Horz];
        rootLayout.mySize = CGSizeMake(MyLayoutSize.wrap, MyLayoutSize.wrap);

        UIView *v1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        [rootLayout addSubview:v1];

        UIView *v2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
        [rootLayout addSubview:v2];

        UIView *v3 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
        [rootLayout addSubview:v3];

        [rootLayout layoutIfNeeded];
        MyRectAssert(rootLayout, CGRectMake(0, 0, 100+200+300,300));
    }

}

- (void)testPerformanceExample {
    // This is an example of a performance test case.

//    [self measureBlock:^{
//        // Put the code you want to measure the time of here.
//
//    }];
//

}

@end


text:
/*
 Combined processedModules by KISSY Module Compiler:

 editor/plugin/table
*/

KISSY.add("editor/plugin/table", ["editor", "./dialog-loader", "./contextmenu", "./button"], function(S, require) {
  var Editor = require("editor");
  var OLD_IE = S.UA.ieMode < 11;
  var Walker = Editor.Walker;
  var DialogLoader = require("./dialog-loader");
  require("./contextmenu");
  require("./button");
  var UA = S.UA, Dom = S.DOM, Node = S.Node, tableRules = ["tr", "th", "td", "tbody", "table"], cellNodeRegex = /^(?:td|th)$/;
  function getSelectedCells(selection) {
    var bookmarks = selection.createBookmarks(), ranges = selection.getRanges(), retval = [], database = {};
    function moveOutOfCellGuard(node) {
      if(retval.length > 0) {
        return
      }
      if(node[0].nodeType === Dom.NodeType.ELEMENT_NODE && cellNodeRegex.test(node.nodeName()) && !node.data("selected_cell")) {
        node._4eSetMarker(database, "selected_cell", true, undefined);
        retval.push(node)
      }
    }
    for(var i = 0;i < ranges.length;i++) {
      var range = ranges[i];
      if(range.collapsed) {
        var startNode = range.getCommonAncestor(), nearestCell = startNode.closest("td", undefined) || startNode.closest("th", undefined);
        if(nearestCell) {
          retval.push(nearestCell)
        }
      }else {
        var walker = new Walker(range), node;
        walker.guard = moveOutOfCellGuard;
        while(node = walker.next()) {
          var parent = node.parent();
          if(parent && cellNodeRegex.test(parent.nodeName()) && !parent.data("selected_cell")) {
            parent._4eSetMarker(database, "selected_cell", true, undefined);
            retval.push(parent)
          }
        }
      }
    }
    Editor.Utils.clearAllMarkers(database);
    selection.selectBookmarks(bookmarks);
    return retval
  }
  function clearRow($tr) {
    var $cells = $tr.cells;
    for(var i = 0;i < $cells.length;i++) {
      $cells[i].innerHTML = "";
      if(!OLD_IE) {
        (new Node($cells[i]))._4eAppendBogus(undefined)
      }
    }
  }
  function insertRow(selection, insertBefore) {
    var row = selection.getStartElement().parent("tr");
    if(!row) {
      return
    }
    var newRow = row.clone(true);
    newRow.insertBefore(row);
    clearRow(insertBefore ? newRow[0] : row[0])
  }
  function deleteRows(selectionOrRow) {
    var table;
    if(selectionOrRow instanceof Editor.Selection) {
      var cells = getSelectedCells(selectionOrRow), cellsCount = cells.length, rowsToDelete = [], cursorPosition, previousRowIndex, row, nextRowIndex;
      for(var i = 0;i < cellsCount;i++) {
        row = cells[i].parent();
        var rowIndex = row[0].rowIndex;
        if(!i) {
          previousRowIndex = rowIndex - 1
        }
        rowsToDelete[rowIndex] = row;
        if(i === cellsCount - 1) {
          nextRowIndex = rowIndex + 1
        }
      }
      table = row.parent("table");
      var rows = table[0].rows, rowCount = rows.length;
      cursorPosition = new Node(nextRowIndex < rowCount && table[0].rows[nextRowIndex] || previousRowIndex > 0 && table[0].rows[previousRowIndex] || table[0].parentNode);
      for(i = rowsToDelete.length;i >= 0;i--) {
        if(rowsToDelete[i]) {
          deleteRows(rowsToDelete[i])
        }
      }
      return cursorPosition
    }else {
      if(selectionOrRow instanceof Node) {
        table = selectionOrRow.parent("table");
        if(table[0].rows.length === 1) {
          table.remove()
        }else {
          selectionOrRow.remove()
        }
      }
    }
    return 0
  }
  function insertColumn(selection, insertBefore) {
    var startElement = selection.getStartElement(), cell = startElement.closest("td", undefined) || startElement.closest("th", undefined);
    if(!cell) {
      return
    }
    var table = cell.parent("table"), cellIndex = cell[0].cellIndex;
    for(var i = 0;i < table[0].rows.length;i++) {
      var $row = table[0].rows[i];
      if($row.cells.length < cellIndex + 1) {
        continue
      }
      cell = new Node($row.cells[cellIndex].cloneNode(undefined));
      if(!OLD_IE) {
        cell._4eAppendBogus(undefined)
      }
      var baseCell = new Node($row.cells[cellIndex]);
      if(insertBefore) {
        cell.insertBefore(baseCell)
      }else {
        cell.insertAfter(baseCell)
      }
    }
  }
  function getFocusElementAfterDelCols(cells) {
    var cellIndexList = [], table = cells[0] && cells[0].parent("table"), i, length, targetIndex, targetCell;
    for(i = 0, length = cells.length;i < length;i++) {
      cellIndexList.push(cells[i][0].cellIndex)
    }
    cellIndexList.sort();
    for(i = 1, length = cellIndexList.length;i < length;i++) {
      if(cellIndexList[i] - cellIndexList[i - 1] > 1) {
        targetIndex = cellIndexList[i - 1] + 1;
        break
      }
    }
    if(!targetIndex) {
      targetIndex = cellIndexList[0] > 0 ? cellIndexList[0] - 1 : cellIndexList[cellIndexList.length - 1] + 1
    }
    var rows = table[0].rows;
    for(i = 0, length = rows.length;i < length;i++) {
      targetCell = rows[i].cells[targetIndex];
      if(targetCell) {
        break
      }
    }
    return targetCell ? new Node(targetCell) : table.prev()
  }
  function deleteColumns(selectionOrCell) {
    var i;
    if(selectionOrCell instanceof Editor.Selection) {
      var colsToDelete = getSelectedCells(selectionOrCell), elementToFocus = getFocusElementAfterDelCols(colsToDelete);
      for(i = colsToDelete.length - 1;i >= 0;i--) {
        if(colsToDelete[i]) {
          deleteColumns(colsToDelete[i])
        }
      }
      return elementToFocus
    }else {
      if(selectionOrCell instanceof Node) {
        var table = selectionOrCell.parent("table");
        if(!table) {
          return null
        }
        var cellIndex = selectionOrCell[0].cellIndex;
        for(i = table[0].rows.length - 1;i >= 0;i--) {
          var row = new Node(table[0].rows[i]);
          if(!cellIndex && row[0].cells.length === 1) {
            deleteRows(row);
            continue
          }
          if(row[0].cells[cellIndex]) {
            row[0].removeChild(row[0].cells[cellIndex])
          }
        }
      }
    }
    return null
  }
  function placeCursorInCell(cell, placeAtEnd) {
    var range = new Editor.Range(cell[0].ownerDocument);
    if(!range.moveToElementEditablePosition(cell, placeAtEnd ? true : undefined)) {
      range.selectNodeContents(cell);
      range.collapse(placeAtEnd ? false : true)
    }
    range.select(true)
  }
  function getSel(editor) {
    var selection = editor.getSelection(), startElement = selection && selection.getStartElement(), table = startElement && startElement.closest("table", undefined);
    if(!table) {
      return undefined
    }
    var td = startElement.closest(function(n) {
      var name = Dom.nodeName(n);
      return table.contains(n) && (name === "td" || name === "th")
    }, undefined);
    var tr = startElement.closest(function(n) {
      var name = Dom.nodeName(n);
      return table.contains(n) && name === "tr"
    }, undefined);
    return{table:table, td:td, tr:tr}
  }
  function ensureTd(editor) {
    var info = getSel(editor);
    return info && info.td
  }
  function ensureTr(editor) {
    var info = getSel(editor);
    return info && info.tr
  }
  var statusChecker = {"\u8868\u683c\u5c5e\u6027":getSel, "\u5220\u9664\u8868\u683c":ensureTd, "\u5220\u9664\u5217":ensureTd, "\u5220\u9664\u884c":ensureTr, "\u5728\u4e0a\u65b9\u63d2\u5165\u884c":ensureTr, "\u5728\u4e0b\u65b9\u63d2\u5165\u884c":ensureTr, "\u5728\u5de6\u4fa7\u63d2\u5165\u5217":ensureTd, "\u5728\u53f3\u4fa7\u63d2\u5165\u5217":ensureTd};
  var showBorderClassName = "ke_show_border", cssTemplate = (UA.ie === 6 ? ["table.%2,", "table.%2 td, table.%2 th,", "{", "border : #d3d3d3 1px dotted", "}"] : [" table.%2,", " table.%2 > tr > td,  table.%2 > tr > th,", " table.%2 > tbody > tr > td, " + " table.%2 > tbody > tr > th,", " table.%2 > thead > tr > td,  table.%2 > thead > tr > th,", " table.%2 > tfoot > tr > td,  table.%2 > tfoot > tr > th", "{", "border : #d3d3d3 1px dotted", "}"]).join(""), cssStyleText = cssTemplate.replace(/%2/g,
  showBorderClassName), extraDataFilter = {tags:{table:function(element) {
    var cssClass = element.getAttribute("class"), border = parseInt(element.getAttribute("border"), 10);
    if(!border || border <= 0) {
      element.setAttribute("class", S.trim((cssClass || "") + " " + showBorderClassName))
    }
  }}}, extraHTMLFilter = {tags:{table:function(table) {
    var cssClass = table.getAttribute("class"), v;
    if(cssClass) {
      v = S.trim(cssClass.replace(showBorderClassName, ""));
      if(v) {
        table.setAttribute("class", v)
      }else {
        table.removeAttribute("class")
      }
    }
  }}};
  function TablePlugin(config) {
    this.config = config || {}
  }
  S.augment(TablePlugin, {pluginRenderUI:function(editor) {
    editor.addCustomStyle(cssStyleText);
    var dataProcessor = editor.htmlDataProcessor, dataFilter = dataProcessor && dataProcessor.dataFilter, htmlFilter = dataProcessor && dataProcessor.htmlFilter;
    dataFilter.addRules(extraDataFilter);
    htmlFilter.addRules(extraHTMLFilter);
    var self = this, handlers = {"\u8868\u683c\u5c5e\u6027":function() {
      this.hide();
      var info = getSel(editor);
      if(info) {
        DialogLoader.useDialog(editor, "table", self.config, {selectedTable:info.table, selectedTd:info.td})
      }
    }, "\u5220\u9664\u8868\u683c":function() {
      this.hide();
      var selection = editor.getSelection(), startElement = selection && selection.getStartElement(), table = startElement && startElement.closest("table", undefined);
      if(!table) {
        return
      }
      editor.execCommand("save");
      selection.selectElement(table);
      var range = selection.getRanges()[0];
      range.collapse();
      selection.selectRanges([range]);
      var parent = table.parent();
      if(parent[0].childNodes.length === 1 && parent.nodeName() !== "body" && parent.nodeName() !== "td") {
        parent.remove()
      }else {
        table.remove()
      }
      editor.execCommand("save")
    }, "\u5220\u9664\u884c ":function() {
      this.hide();
      editor.execCommand("save");
      var selection = editor.getSelection();
      placeCursorInCell(deleteRows(selection), undefined);
      editor.execCommand("save")
    }, "\u5220\u9664\u5217 ":function() {
      this.hide();
      editor.execCommand("save");
      var selection = editor.getSelection(), element = deleteColumns(selection);
      if(element) {
        placeCursorInCell(element, true)
      }
      editor.execCommand("save")
    }, "\u5728\u4e0a\u65b9\u63d2\u5165\u884c":function() {
      this.hide();
      editor.execCommand("save");
      var selection = editor.getSelection();
      insertRow(selection, true);
      editor.execCommand("save")
    }, "\u5728\u4e0b\u65b9\u63d2\u5165\u884c":function() {
      this.hide();
      editor.execCommand("save");
      var selection = editor.getSelection();
      insertRow(selection, undefined);
      editor.execCommand("save")
    }, "\u5728\u5de6\u4fa7\u63d2\u5165\u5217":function() {
      this.hide();
      editor.execCommand("save");
      var selection = editor.getSelection();
      insertColumn(selection, true);
      editor.execCommand("save")
    }, "\u5728\u53f3\u4fa7\u63d2\u5165\u5217":function() {
      this.hide();
      editor.execCommand("save");
      var selection = editor.getSelection();
      insertColumn(selection, undefined);
      editor.execCommand("save")
    }};
    var children = [];
    S.each(handlers, function(h, name) {
      children.push({content:name})
    });
    editor.addContextMenu("table", function(node) {
      if(S.inArray(Dom.nodeName(node), tableRules)) {
        return true
      }
    }, {width:"120px", children:children, listeners:{click:function(e) {
      var content = e.target.get("content");
      if(handlers[content]) {
        handlers[content].apply(this)
      }
    }, beforeVisibleChange:function(e) {
      if(e.newVal) {
        var self = this, children = self.get("children");
        var editor = self.get("editor");
        S.each(children, function(c) {
          var content = c.get("content");
          if(!statusChecker[content] || statusChecker[content].call(self, editor)) {
            c.set("disabled", false)
          }else {
            c.set("disabled", true)
          }
        })
      }
    }}});
    editor.addButton("table", {mode:Editor.Mode.WYSIWYG_MODE, listeners:{click:function() {
      DialogLoader.useDialog(editor, "table", self.config, {selectedTable:0, selectedTd:0})
    }}, tooltip:"\u63d2\u5165\u8868\u683c"})
  }});
  return TablePlugin
});


text:
#ifndef __CONFIG_H
#define __CONFIG_H

#define ROCKCHIP_DEVICE_SETTINGS
#include <configs/rk3288_common.h>

#define CONFIG_SYS_MMC_ENV_DEV 0

#endif


text:
package org.apache.pulsar.client.admin;

import java.io.Closeable;
import org.apache.pulsar.client.admin.utils.DefaultImplementation;
import org.apache.pulsar.common.classification.InterfaceAudience;
import org.apache.pulsar.common.classification.InterfaceStability;

@InterfaceAudience.Public
@InterfaceStability.Stable
public interface PulsarAdmin extends Closeable {

    /**
     * Get a new builder instance that can used to configure and build a {@link PulsarAdmin} instance.
     *
     * @return the {@link PulsarAdminBuilder}
     *
     */
    static PulsarAdminBuilder builder() {
        return DefaultImplementation.newAdminClientBuilder();
    }

    /**
     * @return the clusters management object
     */
    Clusters clusters();

    /**
     * @return the brokers management object
     */
    Brokers brokers();

    /**
     * @return the tenants management object
     */
    Tenants tenants();

    /**
     * @return the resourcegroups managements object
     */
    ResourceGroups resourcegroups();

    /**
     *
     * @deprecated since 2.0. See {@link #tenants()}
     */
    @Deprecated
    Properties properties();

    /**
     * @return the namespaces management object
     */
    Namespaces namespaces();

    /**
     * @return the topics management object
     */
    Topics topics();

    /**
     * Get the topic policies management object.
     * @return the topic policies management object
     */
    TopicPolicies topicPolicies();

    /**
     * Get the local/global topic policies management object.
     * @return the topic policies management object
     */
    TopicPolicies topicPolicies(boolean isGlobal);

    /**
     * @return the bookies management object
     */
    Bookies bookies();

    /**
     * @return the persistentTopics management object
     * @deprecated Since 2.0. See {@link #topics()}
     */
    @Deprecated
    NonPersistentTopics nonPersistentTopics();

    /**
     * @return the resource quota management object
     */
    ResourceQuotas resourceQuotas();

    /**
     * @return does a looks up for the broker serving the topic
     */
    Lookup lookups();

    /**
     *
     * @return the functions management object
     */
    Functions functions();

    /**
     * @return the sources management object
     * @deprecated in favor of {@link #sources()}
     */
    @Deprecated
    Source source();

    /**
     * @return the sources management object
     */
    Sources sources();

    /**
     * @return the sinks management object
     * @deprecated in favor of {@link #sinks}
     */
    @Deprecated
    Sink sink();

    /**
     * @return the sinks management object
     */
    Sinks sinks();

    /**
     * @return the Worker stats
     */
    Worker worker();

    /**
     * @return the broker statics
     */
    BrokerStats brokerStats();

    /**
     * @return the proxy statics
     */
    ProxyStats proxyStats();

    /**
     * @return the service HTTP URL that is being used
     */
    String getServiceUrl();

    /**
     * @return the schemas
     */
    Schemas schemas();

    /**
     * @return the packages management object
     */
    Packages packages();

    /**
     *
     * @return the transactions management object
     */
    Transactions transactions();

    /**
     * Close the PulsarAdminClient and release all the resources.
     *
     */
    @Override
    void close();
}


text:
import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './ErrorPage.css';

class ErrorPage extends React.Component {
  static propTypes = {
    error: PropTypes.object.isRequired,
  };

  render() {
    if (process.env.NODE_ENV !== 'production') {
      const { error } = this.props;
      return (

{error.name}

{error.message}

{error.stack}

      );
    }

    return (

Error

Sorry, a critical error occurred on this page.

    );
  }
}

export { ErrorPage as ErrorPageWithoutStyle };
export default withStyles(s)(ErrorPage);


text:
define([], function() {
    return function(module) {
        // nothing to do.
    };
});


text:
#ifndef CFUNCTION_H
#define CFUNCTION_H
#include "language.h"

/**
	@brief
	@author Andreas Mützel <amuetzel@uni-koblenz.de>
*/
class CFunction
{
	public:
		CFunction(string name, vector<CArgument*> *args, CExpr * expr);
		virtual ~CFunction();
		string getName();
		CExpr* getExpression();
		int getNumArguments();
		CArgument* getArgument(unsigned int i);
		void accept(CVisitor* v);
		friend ostream& operator<<(ostream &os, CFunction &obj);
	protected:
		string m_sName;
		vector<CArgument*> *m_vArguments;
		CExpr *m_eExpression;
};

#endif


text:
package ru.rus1f1kat0r.autoenum.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
public @interface AutoEnum {
    String[] value();
    String[] declaredNames() default {};
    String name() default "";
}


text:
import difflib
from xml.dom import Node

from htmltreediff.text import is_text_junk
from htmltreediff.util import (
    copy_dom,
    HashableTree,
    FuzzyHashableTree,
    is_text,
    get_child,
    get_location,
    remove_node,
    insert_or_append,
    attribute_dict,
    walk_dom,
)

def match_node_hash(node):
    if is_text(node):
        return node.nodeValue
    return HashableTree(node)

def fuzzy_match_node_hash(node):
    if is_text(node):
        return node.nodeValue
    return FuzzyHashableTree(node)

class Differ():
    def __init__(self, old_dom, new_dom):
        self.edit_script = []
        self.old_dom = copy_dom(old_dom)
        self.new_dom = copy_dom(new_dom)

    def get_edit_script(self):
        """
        Take two doms, and output an edit script transforming one into the other.

        edit script output format
        Actions:
        - ('delete', location, node_properties)
            delete the node, and all descendants
        - ('insert', location, node_properties)
            insert the node at the given location, with the given properties
        The location argument is a tuple of indices.
        The node properties is a dictionary possibly containing keys:
            {node_type, tag_name, attributes, node_value.}
        Any properties that would be empty may be ommitted. attributes is an attribute dictionary.
        """
        # start diff at the body element
        self.diff_location([], [])
        return self.edit_script

    def diff_location(self, old_location, new_location):
        # Here we match up the children of the given locations. This is done in
        # three steps. First we use full tree equality to match up children
        # that are identical all the way down. Then, we use a heuristic
        # function to match up children that are similar, based on text
        # content. Lastly, we just use node tag types to match up elements. For
        # the text-similar matches and the tag-only matches, we still have more
        # work to do, so we recurse on these. The non-matching parts that
        # remain are used to output edit script entries.
        old_children = list(get_location(self.old_dom, old_location).childNodes)
        new_children = list(get_location(self.new_dom, new_location).childNodes)
        if not old_children and not new_children:
            return

        matching_blocks, recursion_indices = self.match_children(old_children, new_children)

        # Apply changes for this level.
        for tag, i1, i2, j1, j2 in adjusted_ops(get_opcodes(matching_blocks)):
            if tag == 'delete':
                assert j1 == j2
                # delete range from right to left
                for index, child in reversed(list(enumerate(old_children[i1:i2]))):
                    self.delete(old_location + [i1 + index], child)
                    old_children.pop(i1 + index)
            elif tag == 'insert':
                assert i1 == i2
                # insert range from left to right
                for index, child in enumerate(new_children[j1:j2]):
                    self.insert(new_location + [i1 + index], child)
                    old_children.insert(i1 + index, child)
            recursion_indices = list(adjust_indices(recursion_indices, i1, i2, j1, j2))

        # Recurse to deeper level.
        for old_index, new_index in recursion_indices:
            self.diff_location(old_location + [old_index], new_location + [new_index])

    def match_children(self, old_children, new_children):
        # Find whole-tree matches and fuzzy matches.
        sm = match_blocks(match_node_hash, old_children, new_children)
        # If the match is very poor, pretend there were no exact matching blocks at all.
        if sm.ratio() < 0.3:
            matching_blocks = [(len(old_children), len(new_children), 0)]
        else:
            matching_blocks = sm.get_matching_blocks()

        # In each gap between exact matches, find fuzzy matches.
        gaps = get_nonmatching_blocks(matching_blocks)

        fuzzy_matching_blocks = [(0, 0, 0)]
        for nonmatch in gaps:
            alo, ahi, blo, bhi = nonmatch
            sm_fuzzy = match_blocks(
                fuzzy_match_node_hash,
                old_children[alo:ahi],
                new_children[blo:bhi],
            )
            blocks = sm_fuzzy.get_matching_blocks()
            # Move blocks over to the position of the gap.
            blocks = [
                (alo + a, blo + b, size)
                for a, b, size in blocks
            ]
            del fuzzy_matching_blocks[-1] # Remove old sentinel.
            fuzzy_matching_blocks.extend(blocks)

        # We will recurse on each tree that was a fuzzy match at this level.
        recursion_indices = [] # List of tuples, (old_index, new_index)
        for match in fuzzy_matching_blocks:
            for old_index, new_index in match_indices(match):
                recursion_indices.append((old_index, new_index))

        # Zip together the fuzzy and exact matches. They are treated the same
        # from this point forward, except for we recurse on fuzzy matches.
        matching_blocks = merge_blocks(matching_blocks, fuzzy_matching_blocks)

        return matching_blocks, recursion_indices

    def delete(self, location, node):
        # delete from the bottom up, children before parent, right to left
        for child_index, child in reversed(list(enumerate(node.childNodes))):
            self.delete(location + [child_index], child)
        # write deletion to the edit script
        self.edit_script.append((
            'delete',
            location,
            node_properties(node),
        ))
        # actually delete the node
        assert node.parentNode == get_location(self.old_dom, location[:-1])
        assert node.ownerDocument == self.old_dom
        remove_node(node)

    def insert(self, location, node):
        # write insertion to the edit script
        self.edit_script.append((
            'insert',
            location,
            node_properties(node),
        ))
        # actually insert the node
        node_copy = node.cloneNode(deep=False)
        parent = get_location(self.old_dom, location[:-1])
        next_sibling = get_child(parent, location[-1])
        insert_or_append(parent, node_copy, next_sibling)
        # insert from the top down, parent before children, left to right
        for child_index, child in enumerate(node.childNodes):
            self.insert(location + [child_index], child)

def adjusted_ops(opcodes):
    """
    Iterate through opcodes, turning them into a series of insert and delete
    operations, adjusting indices to account for the size of insertions and
    deletions.

    >>> def sequence_opcodes(old, new): return difflib.SequenceMatcher(a=old, b=new).get_opcodes()
    >>> list(adjusted_ops(sequence_opcodes('abc', 'b')))
    [('delete', 0, 1, 0, 0), ('delete', 1, 2, 1, 1)]
    >>> list(adjusted_ops(sequence_opcodes('b', 'abc')))
    [('insert', 0, 0, 0, 1), ('insert', 2, 2, 2, 3)]
    >>> list(adjusted_ops(sequence_opcodes('axxa', 'aya')))
    [('delete', 1, 3, 1, 1), ('insert', 1, 1, 1, 2)]
    >>> list(adjusted_ops(sequence_opcodes('axa', 'aya')))
    [('delete', 1, 2, 1, 1), ('insert', 1, 1, 1, 2)]
    >>> list(adjusted_ops(sequence_opcodes('ab', 'bc')))
    [('delete', 0, 1, 0, 0), ('insert', 1, 1, 1, 2)]
    >>> list(adjusted_ops(sequence_opcodes('bc', 'ab')))
    [('insert', 0, 0, 0, 1), ('delete', 2, 3, 2, 2)]
    """
    while opcodes:
        op = opcodes.pop(0)
        tag, i1, i2, j1, j2 = op
        shift = 0
        if tag == 'equal':
            continue
        if tag == 'replace':
            # change the single replace op into a delete then insert
            # pay careful attention to the variables here, there's no typo
            opcodes = [
                ('delete', i1, i2, j1, j1),
                ('insert', i2, i2, j1, j2),
            ] + opcodes
            continue
        yield op
        if tag == 'delete':
            shift = -(i2 - i1)
        elif tag == 'insert':
            shift = +(j2 - j1)
        new_opcodes = []
        for tag, i1, i2, j1, j2 in opcodes:
            new_opcodes.append((
                tag,
                i1 + shift,
                i2 + shift,
                j1,
                j2,
            ))
        opcodes = new_opcodes

def node_properties(node):
    d = {}
    d['node_type'] = node.nodeType
    d['node_name'] = node.nodeName
    d['node_value'] = node.nodeValue
    d['attributes'] = attribute_dict(node)
    if node.nodeType == Node.TEXT_NODE:
        del d['node_name'] # don't include node name for text nodes
    for key, value in list(d.items()):
        if not value:
            del d[key]
    return d

def match_indices(match):
    """Yield index tuples (old_index, new_index) for each place in the match."""
    a, b, size = match
    for i in range(size):
        yield a + i, b + i

def get_opcodes(matching_blocks):
    """Use difflib to get the opcodes for a set of matching blocks."""
    sm = difflib.SequenceMatcher(a=[], b=[])
    sm.matching_blocks = matching_blocks
    return sm.get_opcodes()

def _is_junk(hashable_node):
    if isinstance(hashable_node, basestring):
        return is_text_junk(hashable_node)
    # Nodes with no text or just whitespace are junk.
    for descendant in walk_dom(hashable_node.node):
        if is_text(descendant):
            if not is_text_junk(descendant.nodeValue):
                return False
    return True

def match_blocks(hash_func, old_children, new_children):
    """Use difflib to find matching blocks."""
    sm = difflib.SequenceMatcher(
        _is_junk,
        a=[hash_func(c) for c in old_children],
        b=[hash_func(c) for c in new_children],
    )
    return sm

def get_nonmatching_blocks(matching_blocks):
    """Given a list of matching blocks, output the gaps between them.

    Non-matches have the format (alo, ahi, blo, bhi). This specifies two index
    ranges, one in the A sequence, and one in the B sequence.
    """
    i = j = 0
    for match in matching_blocks:
        a, b, size = match
        yield (i, a, j, b)
        i = a + size
        j = b + size

def merge_blocks(a_blocks, b_blocks):
    """Given two lists of blocks, combine them, in the proper order.

    Ensure that there are no overlaps, and that they are for sequences of the
    same length.
    """
    # Check sentinels for sequence length.
    assert a_blocks[-1][2] == b_blocks[-1][2] == 0 # sentinel size is 0
    assert a_blocks[-1] == b_blocks[-1]
    combined_blocks = sorted(list(set(a_blocks + b_blocks)))
    # Check for overlaps.
    i = j = 0
    for a, b, size in combined_blocks:
        assert i <= a
        assert j <= b
        i = a + size
        j = b + size
    return combined_blocks

def adjust_indices(indices, i1, i2, j1, j2):
    shift = (j2 - j1) - (i2 - i1)
    for a, b in indices:
        if a >= i2:
            a += shift
        yield a, b