text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.compute.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.resourcemanager.compute.models.CopyCompletionError;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DataAccessAuthMode;
import com.azure.resourcemanager.compute.models.DiskSecurityProfile;
import com.azure.resourcemanager.compute.models.DiskState;
import com.azure.resourcemanager.compute.models.Encryption;
import com.azure.resourcemanager.compute.models.EncryptionSettingsCollection;
import com.azure.resourcemanager.compute.models.ExtendedLocation;
import com.azure.resourcemanager.compute.models.HyperVGeneration;
import com.azure.resourcemanager.compute.models.NetworkAccessPolicy;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
import com.azure.resourcemanager.compute.models.PublicNetworkAccess;
import com.azure.resourcemanager.compute.models.PurchasePlanAutoGenerated;
import com.azure.resourcemanager.compute.models.SnapshotSku;
import com.azure.resourcemanager.compute.models.SupportedCapabilities;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Snapshot resource. */
@Fluent
public final class SnapshotInner extends Resource {
    /*
     * Unused. Always Null.
     */
    @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY)
    private String managedBy;

    /*
     * The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for
     * incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot
     */
    @JsonProperty(value = "sku")
    private SnapshotSku sku;

    /*
     * The extended location where the snapshot will be created. Extended location cannot be changed.
     */
    @JsonProperty(value = "extendedLocation")
    private ExtendedLocation extendedLocation;

    /*
     * Snapshot resource properties.
     */
    @JsonProperty(value = "properties")
    private SnapshotProperties innerProperties;

    /** Creates an instance of SnapshotInner class. */
    public SnapshotInner() {
    }

    /**
     * Get the managedBy property: Unused. Always Null.
     *
     * @return the managedBy value.
     */
    public String managedBy() {
        return this.managedBy;
    }

    /**
     * Get the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an
     * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as
     * the previous snapshot.
     *
     * @return the sku value.
     */
    public SnapshotSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an
     * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as
     * the previous snapshot.
     *
     * @param sku the sku value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withSku(SnapshotSku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the extendedLocation property: The extended location where the snapshot will be created. Extended location
     * cannot be changed.
     *
     * @return the extendedLocation value.
     */
    public ExtendedLocation extendedLocation() {
        return this.extendedLocation;
    }

    /**
     * Set the extendedLocation property: The extended location where the snapshot will be created. Extended location
     * cannot be changed.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /**
     * Get the innerProperties property: Snapshot resource properties.
     *
     * @return the innerProperties value.
     */
    private SnapshotProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public SnapshotInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SnapshotInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the timeCreated property: The time when the snapshot was created.
     *
     * @return the timeCreated value.
     */
    public OffsetDateTime timeCreated() {
        return this.innerProperties() == null ? null : this.innerProperties().timeCreated();
    }

    /**
     * Get the osType property: The Operating System type.
     *
     * @return the osType value.
     */
    public OperatingSystemTypes osType() {
        return this.innerProperties() == null ? null : this.innerProperties().osType();
    }

    /**
     * Set the osType property: The Operating System type.
     *
     * @param osType the osType value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withOsType(OperatingSystemTypes osType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withOsType(osType);
        return this;
    }

    /**
     * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
     *
     * @return the hyperVGeneration value.
     */
    public HyperVGeneration hyperVGeneration() {
        return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration();
    }

    /**
     * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
     *
     * @param hyperVGeneration the hyperVGeneration value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withHyperVGeneration(HyperVGeneration hyperVGeneration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withHyperVGeneration(hyperVGeneration);
        return this;
    }

    /**
     * Get the purchasePlan property: Purchase plan information for the image from which the source disk for the
     * snapshot was originally created.
     *
     * @return the purchasePlan value.
     */
    public PurchasePlanAutoGenerated purchasePlan() {
        return this.innerProperties() == null ? null : this.innerProperties().purchasePlan();
    }

    /**
     * Set the purchasePlan property: Purchase plan information for the image from which the source disk for the
     * snapshot was originally created.
     *
     * @param purchasePlan the purchasePlan value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withPurchasePlan(purchasePlan);
        return this;
    }

    /**
     * Get the supportedCapabilities property: List of supported capabilities for the image from which the source disk
     * from the snapshot was originally created.
     *
     * @return the supportedCapabilities value.
     */
    public SupportedCapabilities supportedCapabilities() {
        return this.innerProperties() == null ? null : this.innerProperties().supportedCapabilities();
    }

    /**
     * Set the supportedCapabilities property: List of supported capabilities for the image from which the source disk
     * from the snapshot was originally created.
     *
     * @param supportedCapabilities the supportedCapabilities value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withSupportedCapabilities(SupportedCapabilities supportedCapabilities) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withSupportedCapabilities(supportedCapabilities);
        return this;
    }

    /**
     * Get the creationData property: Disk source information. CreationData information cannot be changed after the disk
     * has been created.
     *
     * @return the creationData value.
     */
    public CreationData creationData() {
        return this.innerProperties() == null ? null : this.innerProperties().creationData();
    }

    /**
     * Set the creationData property: Disk source information. CreationData information cannot be changed after the disk
     * has been created.
     *
     * @param creationData the creationData value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withCreationData(CreationData creationData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withCreationData(creationData);
        return this;
    }

    /**
     * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the
     * size of the disk to create. If this field is present for updates or creation with other options, it indicates a
     * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's
     * size.
     *
     * @return the diskSizeGB value.
     */
    public Integer diskSizeGB() {
        return this.innerProperties() == null ? null : this.innerProperties().diskSizeGB();
    }

    /**
     * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the
     * size of the disk to create. If this field is present for updates or creation with other options, it indicates a
     * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's
     * size.
     *
     * @param diskSizeGB the diskSizeGB value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withDiskSizeGB(Integer diskSizeGB) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withDiskSizeGB(diskSizeGB);
        return this;
    }

    /**
     * Get the diskSizeBytes property: The size of the disk in bytes. This field is read only.
     *
     * @return the diskSizeBytes value.
     */
    public Long diskSizeBytes() {
        return this.innerProperties() == null ? null : this.innerProperties().diskSizeBytes();
    }

    /**
     * Get the diskState property: The state of the snapshot.
     *
     * @return the diskState value.
     */
    public DiskState diskState() {
        return this.innerProperties() == null ? null : this.innerProperties().diskState();
    }

    /**
     * Get the uniqueId property: Unique Guid identifying the resource.
     *
     * @return the uniqueId value.
     */
    public String uniqueId() {
        return this.innerProperties() == null ? null : this.innerProperties().uniqueId();
    }

    /**
     * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can
     * contain multiple encryption settings per disk or snapshot.
     *
     * @return the encryptionSettingsCollection value.
     */
    public EncryptionSettingsCollection encryptionSettingsCollection() {
        return this.innerProperties() == null ? null : this.innerProperties().encryptionSettingsCollection();
    }

    /**
     * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can
     * contain multiple encryption settings per disk or snapshot.
     *
     * @param encryptionSettingsCollection the encryptionSettingsCollection value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withEncryptionSettingsCollection(encryptionSettingsCollection);
        return this;
    }

    /**
     * Get the provisioningState property: The disk provisioning state.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy
     * less space than full snapshots and can be diffed.
     *
     * @return the incremental value.
     */
    public Boolean incremental() {
        return this.innerProperties() == null ? null : this.innerProperties().incremental();
    }

    /**
     * Set the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy
     * less space than full snapshots and can be diffed.
     *
     * @param incremental the incremental value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withIncremental(Boolean incremental) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withIncremental(incremental);
        return this;
    }

    /**
     * Get the incrementalSnapshotFamilyId property: Incremental snapshots for a disk share an incremental snapshot
     * family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id.
     *
     * @return the incrementalSnapshotFamilyId value.
     */
    public String incrementalSnapshotFamilyId() {
        return this.innerProperties() == null ? null : this.innerProperties().incrementalSnapshotFamilyId();
    }

    /**
     * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys
     * or platform managed keys.
     *
     * @return the encryption value.
     */
    public Encryption encryption() {
        return this.innerProperties() == null ? null : this.innerProperties().encryption();
    }

    /**
     * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys
     * or platform managed keys.
     *
     * @param encryption the encryption value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withEncryption(Encryption encryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withEncryption(encryption);
        return this;
    }

    /**
     * Get the networkAccessPolicy property: Policy for accessing the disk via network.
     *
     * @return the networkAccessPolicy value.
     */
    public NetworkAccessPolicy networkAccessPolicy() {
        return this.innerProperties() == null ? null : this.innerProperties().networkAccessPolicy();
    }

    /**
     * Set the networkAccessPolicy property: Policy for accessing the disk via network.
     *
     * @param networkAccessPolicy the networkAccessPolicy value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withNetworkAccessPolicy(networkAccessPolicy);
        return this;
    }

    /**
     * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks.
     *
     * @return the diskAccessId value.
     */
    public String diskAccessId() {
        return this.innerProperties() == null ? null : this.innerProperties().diskAccessId();
    }

    /**
     * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks.
     *
     * @param diskAccessId the diskAccessId value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withDiskAccessId(String diskAccessId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withDiskAccessId(diskAccessId);
        return this;
    }

    /**
     * Get the securityProfile property: Contains the security related information for the resource.
     *
     * @return the securityProfile value.
     */
    public DiskSecurityProfile securityProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().securityProfile();
    }

    /**
     * Set the securityProfile property: Contains the security related information for the resource.
     *
     * @param securityProfile the securityProfile value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withSecurityProfile(DiskSecurityProfile securityProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withSecurityProfile(securityProfile);
        return this;
    }

    /**
     * Get the supportsHibernation property: Indicates the OS on a snapshot supports hibernation.
     *
     * @return the supportsHibernation value.
     */
    public Boolean supportsHibernation() {
        return this.innerProperties() == null ? null : this.innerProperties().supportsHibernation();
    }

    /**
     * Set the supportsHibernation property: Indicates the OS on a snapshot supports hibernation.
     *
     * @param supportsHibernation the supportsHibernation value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withSupportsHibernation(Boolean supportsHibernation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withSupportsHibernation(supportsHibernation);
        return this;
    }

    /**
     * Get the publicNetworkAccess property: Policy for controlling export on the disk.
     *
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Policy for controlling export on the disk.
     *
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

    /**
     * Get the completionPercent property: Percentage complete for the background copy when a resource is created via
     * the CopyStart operation.
     *
     * @return the completionPercent value.
     */
    public Float completionPercent() {
        return this.innerProperties() == null ? null : this.innerProperties().completionPercent();
    }

    /**
     * Set the completionPercent property: Percentage complete for the background copy when a resource is created via
     * the CopyStart operation.
     *
     * @param completionPercent the completionPercent value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withCompletionPercent(Float completionPercent) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withCompletionPercent(completionPercent);
        return this;
    }

    /**
     * Get the copyCompletionError property: Indicates the error details if the background copy of a resource created
     * via the CopyStart operation fails.
     *
     * @return the copyCompletionError value.
     */
    public CopyCompletionError copyCompletionError() {
        return this.innerProperties() == null ? null : this.innerProperties().copyCompletionError();
    }

    /**
     * Set the copyCompletionError property: Indicates the error details if the background copy of a resource created
     * via the CopyStart operation fails.
     *
     * @param copyCompletionError the copyCompletionError value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withCopyCompletionError(CopyCompletionError copyCompletionError) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withCopyCompletionError(copyCompletionError);
        return this;
    }

    /**
     * Get the dataAccessAuthMode property: Additional authentication requirements when exporting or uploading to a disk
     * or snapshot.
     *
     * @return the dataAccessAuthMode value.
     */
    public DataAccessAuthMode dataAccessAuthMode() {
        return this.innerProperties() == null ? null : this.innerProperties().dataAccessAuthMode();
    }

    /**
     * Set the dataAccessAuthMode property: Additional authentication requirements when exporting or uploading to a disk
     * or snapshot.
     *
     * @param dataAccessAuthMode the dataAccessAuthMode value to set.
     * @return the SnapshotInner object itself.
     */
    public SnapshotInner withDataAccessAuthMode(DataAccessAuthMode dataAccessAuthMode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SnapshotProperties();
        }
        this.innerProperties().withDataAccessAuthMode(dataAccessAuthMode);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sku() != null) {
            sku().validate();
        }
        if (extendedLocation() != null) {
            extendedLocation().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}


text:
package com.inqbarna.tablefixheaders;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.DataSetObserver;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.Scroller;

import com.inqbarna.tablefixheaders.adapters.TableAdapter;

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

public class CustomTableFixHeaders extends ViewGroup {

    public static final String TAG = "TableFixHeaders";

    private final int HEADER_INDEX = 0;

    private int currentX;
    private int currentY;

    private TableAdapter adapter;
    private int scrollX[];
    private int scrollY;
    //visible rows
    private int firstRow;
    //visible header column
    private int[] leftColumnIndex;
    //items measures
    private int[][] widths;
    private int[] heights;

    private int maxRowWidth;

    //header in left top corner
    @SuppressWarnings("unused")
    private View headView;

    // upper header
    private List<View> rowViewList;
    //left header
    private List<View> columnViewList;
    //items list
    private List<List<View>> bodyViewTable;

    private int rowCount;
    private int columnCount;

    private int width;
    private int height;

    private Recycler recycler;

    private TableAdapterDataSetObserver tableAdapterDataSetObserver;
    private boolean needRelayout;

    private final int minimumVelocity;
    private final int maximumVelocity;

    private final Flinger flinger;

    private VelocityTracker velocityTracker;

    private int touchSlop;

    public CustomTableFixHeaders(Context context) {
        this(context, null);
    }

    public CustomTableFixHeaders(Context context, AttributeSet attrs) {
        super(context, attrs);

        this.headView = null;
        this.rowViewList = new ArrayList<View>();
        this.columnViewList = new ArrayList<View>();
        this.bodyViewTable = new ArrayList<List<View>>();

        this.needRelayout = true;

        this.flinger = new Flinger(context);
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        this.touchSlop = configuration.getScaledTouchSlop();
        this.minimumVelocity = configuration.getScaledMinimumFlingVelocity();
        this.maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    }

    public TableAdapter getAdapter() {
        return adapter;
    }

    public void setAdapter(TableAdapter adapter) {
        if (this.adapter != null) {
            this.adapter.unregisterDataSetObserver(tableAdapterDataSetObserver);
        }

        this.adapter = adapter;
        tableAdapterDataSetObserver = new TableAdapterDataSetObserver();
        this.adapter.registerDataSetObserver(tableAdapterDataSetObserver);

        this.recycler = new Recycler(adapter.getViewTypeCount());

        scrollY = 0;
        firstRow = 0;

        needRelayout = true;
        requestLayout();
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        boolean intercept = false;
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN: {
                currentX = (int) event.getRawX();
                currentY = (int) event.getRawY();
                break;
            }
            case MotionEvent.ACTION_MOVE: {
                int x2 = Math.abs(currentX - (int) event.getRawX());
                int y2 = Math.abs(currentY - (int) event.getRawY());
                if (x2 > touchSlop || y2 > touchSlop) {
                    intercept = true;
                }
                break;
            }
        }
        return intercept;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (velocityTracker == null) { // If we do not have velocity tracker
            velocityTracker = VelocityTracker.obtain(); // then get one
        }
        velocityTracker.addMovement(event); // add this movement to it

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN: {
                if (!flinger.isFinished()) { // If scrolling, then stop now
                    flinger.forceFinished();
                }
                currentX = (int) event.getRawX();
                currentY = (int) event.getRawY();
                break;
            }
            case MotionEvent.ACTION_MOVE: {
                final int x2 = (int) event.getRawX();
                final int y2 = (int) event.getRawY();
                final int diffX = currentX - x2;
                final int diffY = currentY - y2;
                currentX = x2;
                currentY = y2;

                scrollBy(diffX, diffY);
                break;
            }
            case MotionEvent.ACTION_UP: {
                final VelocityTracker velocityTracker = this.velocityTracker;
                velocityTracker.computeCurrentVelocity(1000, maximumVelocity);
                int velocityX = (int) velocityTracker.getXVelocity();
                int velocityY = (int) velocityTracker.getYVelocity();

                if (Math.abs(velocityX) > minimumVelocity || Math.abs(velocityY) > minimumVelocity) {
                    flinger.start(getActualScrollX(), getActualScrollY(), velocityX, velocityY, getMaxScrollX(), getMaxScrollY());
                } else {
                    if (this.velocityTracker != null) { // If the velocity less than threshold
                        this.velocityTracker.recycle(); // recycle the tracker
                        this.velocityTracker = null;
                    }
                }
                break;
            }
        }
        return true;
    }

    @Override
    public void scrollTo(int x, int y) {
        if (needRelayout) {

            for (int i = 0; i < rowCount + 1; i++) {
                leftColumnIndex[i] = 0;
                scrollX[i] = x;
            }

            scrollY = y;
            firstRow = 0;
        } else {

            throw new RuntimeException("scrollTo not supported");
          /*  int tempX;

            if(x!=0){
                for (int row = 0; row < rowCount + 1; row++) {
                    tempX = x;
                    tempX = tempX - sumArray(widths, row, 1, leftColumnIndex[row]) - scrollX[row];
                    scrollX[row] += tempX;
                }
            }

            scrollBy(x, y - sumArray(heights, 1, firstRow) - scrollY);*/
        }
    }

    @Override
    public void scrollBy(int x, int y) {

        if (x != 0) {
            for (int row = 0; row < rowCount + 1; row++) {
                scrollX[row] += x;
            }
        }
        scrollY += y;

        if (x == 0 && y == 0 || needRelayout) {
            return;
        }

        scrollBounds();

		/*
         * TODO Improve the algorithm. Think big diagonal movements. If we are
		 * in the top left corner and scrollBy to the opposite corner. We will
		 * have created the views from the top right corner on the X part and we
		 * will have eliminated to generate the right at the Y.
		 */

        int visibleRowSize = firstRow + columnViewList.size();
        //visible/relation item row
        int itemRow = 0;

        for (int row = 0; row < rowCount + 1; row++) {

            // header
            if (row == 0) {

            } else {
                //item
                if (scrollX[row] != 0) {
                    if (scrollX[row] > 0) {

                        // update non visible views first visible column values
                        if (row > firstRow && row <= visibleRowSize) {

                            while (widths[row][leftColumnIndex[row] + 1] < scrollX[row]) {
                                if (bodyViewTable.get(itemRow).size() > 1) {
                                    removeLeft(itemRow);
                                    scrollX[row] -= widths[row][leftColumnIndex[row] + 1];
                                    leftColumnIndex[row]++;
                                } else {
                                    break;
                                }
                            }

                            int tempItemSize = bodyViewTable.get(itemRow).size();

                            while (getFilledWidth(row, tempItemSize) < width) {
                                if (addRight(itemRow, row)) {
                                    tempItemSize++;
                                } else {
                                    break;
                                }
                            }

                            itemRow++;
                        } else {

                            while (widths[row][leftColumnIndex[row] + 1] < scrollX[row]) {
                                scrollX[row] -= widths[row][leftColumnIndex[row] + 1];
                                leftColumnIndex[row]++;
                            }// update visible views first visible column values, add or delete views
                        }
                    } else {
                        if (row > firstRow && row <= visibleRowSize) {

                            while (getFilledWidth(row, bodyViewTable.get(itemRow).size()) - widths[row][leftColumnIndex[row] + bodyViewTable.get(itemRow).size()] >= width) {
                                removeRight(itemRow);
                            }

                            int tempItemSize = bodyViewTable.get(itemRow).size();

                            if (rowViewList.isEmpty()) {
                                while (scrollX[row] < 0) {
                                    leftColumnIndex[row]--;
                                    scrollX[row] += widths[row][leftColumnIndex[row] + 1];
                                }
                                while (getFilledWidth(row, tempItemSize) < width) {
                                    addRight(itemRow, row);
                                }
                            } else {
                                while (0 > scrollX[row]) {
                                    addLeft(itemRow, row);
                                    leftColumnIndex[row]--;
                                    scrollX[row] += widths[row][leftColumnIndex[row] + 1];
                                }
                            }

                            itemRow++;
                        } else {

                            if (rowViewList.isEmpty()) {
                                while (scrollX[row] < 0) {
                                    leftColumnIndex[row]--;
                                    scrollX[row] += widths[row][leftColumnIndex[row] + 1];
                                }
                            } else {
                                while (0 > scrollX[row]) {
                                    leftColumnIndex[row]--;
                                    scrollX[row] += widths[row][leftColumnIndex[row] + 1];
                                }
                            }
                        }
                    }
                }
            }
        }

        if (scrollY != 0) {
            if (scrollY > 0) {
                while (heights[firstRow + 1] < scrollY) {
                    if (!columnViewList.isEmpty()) {
                        removeTop();
                    }
                    scrollY -= heights[firstRow + 1];
                    firstRow++;
                }
                while (getFilledHeight() < height) {
                    addBottom();
                }
            } else {
                while (!columnViewList.isEmpty() && getFilledHeight() - heights[firstRow + columnViewList.size()] >= height) {
                    removeBottom();
                }
                if (columnViewList.isEmpty()) {
                    while (scrollY < 0) {
                        firstRow--;
                        scrollY += heights[firstRow + 1];
                    }
                    while (getFilledHeight() < height) {
                        addBottom();
                    }
                } else {
                    while (0 > scrollY) {
                        addTop();
                        firstRow--;
                        scrollY += heights[firstRow + 1];
                    }
                }
            }
        }

        repositionViews();
    }

    /**
     * Added right view
     *
     * @param itemRow  relation (относительный) row i.e. visible row position in bodyViewTable
     * @param addedRow row to add (абсолютный)
     */
    private void addLeft(int itemRow, int addedRow) {
        //addHorizontalHeader(leftColumnIndex[row] - 1, 0);
        int column = leftColumnIndex[addedRow] - 1;
        List<View> list = bodyViewTable.get(itemRow);
        View view = makeView(addedRow - 1, column, widths[addedRow][column + 1], heights[addedRow]);
        list.add(0, view);
    }

    /**
     * Added right view
     *
     * @param itemRow  relation (относительный) row i.e. visible row position in bodyViewTable
     * @param addedRow row to add (абсолютный)
     */
    private boolean addRight(int itemRow, int addedRow) {
        //addHorizontalHeader(firstVisibleColumn + rowItemsSize, rowViewList.size());
        List<View> list = bodyViewTable.get(itemRow);
        int rowItemsSize = list.size();

        int column = leftColumnIndex[addedRow] + rowItemsSize;
        //log("Added row " + addedRow + "column " + column);
        if (column < columnCount) {
            //column[0] is for indexes so we need to use [column + 1] to get row data
            //adapter has
            View view = makeView(addedRow - 1, column, widths[addedRow][column + 1], heights[addedRow]);
            list.add(view);
            return true;
        }
        return false;
    }

    private void addHorizontalItem(int column, int row, int itemIndex) {
        //add items
        List<View> list = bodyViewTable.get(row);
        View view = makeView(row, column, widths[row][column + 1], heights[row]);
        list.add(itemIndex, view);
    }

    //add row header
    private void addHorizontalHeader(int column, int headerIndex) {
        View view = makeView(-1, column, widths[0][column + 1], heights[0]);
        rowViewList.add(headerIndex, view);
    }

    private void addTop() {
        addVerticalItem(firstRow - 1, 0);
    }

    private void addBottom() {
        final int size = columnViewList.size();
        addVerticalItem(firstRow + size, size);
    }

    private void addVerticalItem(int row, int index) {
        //add column header
        View view = makeView(row, -1, widths[row + 1][0], heights[row + 1]);
        columnViewList.add(index, view);

        List<View> list = new ArrayList<View>();

        // row + 1 - actual item size in widths
        // row - used in adapter
        int left = widths[row + 1][0] - scrollX[row];
        for (int j = leftColumnIndex[row + 1]; j < columnCount && left < width; j++) {
            left = left + widths[row + 1][j + 1];
            view = makeView(row, j, widths[row + 1][j], heights[row + 1]);
            list.add(view);
        }
        bodyViewTable.add(index, list);
    }

    private void removeLeft(int row) {
        removeLeftOrRight(0, row);
    }

    private synchronized void removeRight(int row) {
        removeLeftOrRight(bodyViewTable.get(row).size() - 1, row);
    }

    private void removeLeftOrRight(int position, int row) {
        removeView(bodyViewTable.get(row).remove(position));
    }

    private void removeBottom() {
        removeTopOrBottom(columnViewList.size() - 1);
    }

    private void removeTop() {
        removeTopOrBottom(0);
    }

    private void removeTopOrBottom(int position) {
        removeView(columnViewList.remove(position));
        List<View> remove = bodyViewTable.remove(position);
        for (View view : remove) {
            removeView(view);
        }
    }

    @Override
    public void removeView(View view) {
        super.removeView(view);

        final int typeView = (Integer) view.getTag(R.id.tag_type_view);
        if (typeView != TableAdapter.IGNORE_ITEM_VIEW_TYPE) {
            recycler.addRecycledView(view, typeView);
        }
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
        final int heightSize = MeasureSpec.getSize(heightMeasureSpec);

        final int w;
        final int h;

        if (adapter != null) {

            this.rowCount = adapter.getRowCount();
            this.columnCount = adapter.getMaxColumnCount();

            if (leftColumnIndex == null) {
                leftColumnIndex = new int[rowCount + 1];
            }

            if (scrollX == null) {
                scrollX = new int[rowCount + 1];
            }

            widths = new int[rowCount + 1][columnCount + 1];

            for (int i = -1; i < rowCount; i++) {
                int maxWidth = 0;
                for (int j = -1; j < columnCount; j++) {
                    int itemWidth = adapter.getWidth(i, j);
                    widths[i + 1][j + 1] = itemWidth;
                    maxWidth += itemWidth;
                }
                if (maxWidth > maxRowWidth) {
                    maxRowWidth = maxWidth;
                }
            }

            heights = new int[rowCount + 1];
            for (int i = -1; i < rowCount; i++) {
                heights[i + 1] += adapter.getHeight(i);
            }

            if (widthMode == MeasureSpec.AT_MOST) {
                w = Math.min(widthSize, maxRowWidth);
            } else if (widthMode == MeasureSpec.UNSPECIFIED) {
                w = maxRowWidth;
            } else {
                w = widthSize;
                if (maxRowWidth < widthSize) {
                    final float factor = widthSize / (float) maxRowWidth;
                    for (int i = 1; i < rowCount; i++) {
                        for (int j = 1; j < columnCount; j++) {
                            widths[i][j] = Math.round(widths[i][j] * factor);
                        }
                    }
                }
            }

            if (heightMode == MeasureSpec.AT_MOST) {
                h = Math.min(heightSize, sumArray(heights));
            } else if (heightMode == MeasureSpec.UNSPECIFIED) {
                h = sumArray(heights);
            } else {
                h = heightSize;
            }
        } else {
            if (heightMode == MeasureSpec.AT_MOST || widthMode == MeasureSpec.UNSPECIFIED) {
                w = 0;
                h = 0;
            } else {
                w = widthSize;
                h = heightSize;
            }
        }

        if (firstRow >= rowCount || getMaxScrollY() - getActualScrollY() < 0) {
            firstRow = 0;
            scrollY = Integer.MAX_VALUE;
        }
        if (leftColumnIndex[0] >= columnCount || getMaxScrollX() - getActualScrollX() < 0) {
            leftColumnIndex[0] = 0;
            for (int i = 0; i < rowCount + 1; i++) {
                scrollX[i] = Integer.MAX_VALUE;
            }
        }
        setMeasuredDimension(w, h);
    }

    @SuppressLint("DrawAllocation")
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        if (needRelayout || changed) {
            needRelayout = false;
            resetTable();

            if (adapter != null) {
                width = r - l;
                height = b - t;

                int left, top, right, bottom;

                right = Math.min(width, maxRowWidth);
                bottom = Math.min(height, sumArray(heights));

                headView = makeAndSetup(-1, -1, 0, 0, widths[0][0], heights[0]);

                scrollBounds();
                adjustFirstCellsAndScroll();

                left = widths[0][0] - scrollX[0];
                for (int i = leftColumnIndex[0]; i < columnCount && left < width; i++) {
                    right = left + widths[0][i + 1];
                    final View view = makeAndSetup(-1, i, left, 0, right, heights[0]);
                    rowViewList.add(view);
                    left = right;
                }

                top = heights[0] - scrollY;
                for (int i = firstRow; i < rowCount && top < height; i++) {
                    bottom = top + heights[i + 1];
                    final View view = makeAndSetup(i, -1, 0, top, widths[i][0], bottom);
                    columnViewList.add(view);
                    top = bottom;
                }

                top = heights[0] - scrollY;
                for (int i = firstRow; i < rowCount && top < height; i++) {
                    // i + 1 skip header position for initial draw
                    bottom = top + heights[i + 1];
                    left = widths[i + 1][0] - scrollX[i + 1];
                    List<View> list = new ArrayList<View>();
                    for (int j = leftColumnIndex[i]; j < columnCount && left < width; j++) {
                        right = left + widths[i + 1][j + 1];
                        final View view = makeAndSetup(i, j, left, top, right, bottom);
                        list.add(view);
                        left = right;
                    }
                    bodyViewTable.add(list);
                    top = bottom;
                }
            }
        }
    }

    private void repositionViews() {
        int left, top, right, bottom, i;

        left = widths[HEADER_INDEX][0] - scrollX[0];
        i = firstRow;
        for (View view : rowViewList) {
            right = left + widths[HEADER_INDEX][0];
            view.layout(left, 0, right, heights[0]);
            left = right;
        }

        top = heights[0] - scrollY;
        i = firstRow;
        for (View view : columnViewList) {
            bottom = top + heights[++i];
            view.layout(0, top, widths[HEADER_INDEX][0], bottom);
            top = bottom;
        }

        top = heights[0] - scrollY;
        i = firstRow;
        for (List<View> list : bodyViewTable) {
            bottom = top + heights[++i];
            int j = leftColumnIndex[i]; //+ 1 >= columnCount ? columnCount - list.size() : leftColumnIndex[i];
            left = widths[0][j] - scrollX[i];
            for (View view : list) {
                try {
                    right = left + widths[i][++j];
                    view.layout(left, top, right, bottom);
                    left = right;
                } catch (ArrayIndexOutOfBoundsException e) {
                    e.printStackTrace();
                }
            }
            top = bottom;
        }
        invalidate();
    }

    private void scrollBounds() {
        for (int row = 0; row < rowCount + 1; row++) {
            scrollX[row] = scrollWidthBounds(scrollX[row], leftColumnIndex[row], widths, width, row);
            scrollY = scrollBounds(scrollY, firstRow, heights, height);
        }
    }

    private int scrollBounds(int desiredScroll, int firstCell, int sizes[], int viewSize) {
        if (desiredScroll == 0) {
            // no op
        } else if (desiredScroll < 0) {
            desiredScroll = Math.max(desiredScroll, -sumArray(sizes, 1, firstCell));
        } else {
            desiredScroll = Math.min(desiredScroll, Math.max(0, sumArray(sizes, firstCell + 1, sizes.length - 1 - firstCell) + sizes[0] - viewSize));
        }
        return desiredScroll;
    }

    private int scrollWidthBounds(int desiredScroll, int firstCell, int sizes[][], int viewSize, int row) {
        if (desiredScroll == 0) {
            // no op
        } else if (desiredScroll < 0) {
            desiredScroll = Math.max(desiredScroll, -sumArray(sizes, row, 1, firstCell));
        } else {
            // columnCount - 1 to get last item index
            if (leftColumnIndex[row] != columnCount - 1) {
                desiredScroll = Math.min(desiredScroll, Math.max(0, sumArray(sizes, row, 0, sizes[row].length - 1 - firstCell + 1) + sizes[row][0] - viewSize));
            }
        }
        return desiredScroll;
    }

    private void adjustFirstCellsAndScroll() {
        int values[];

        for (int row = 0; row < rowCount + 1; row++) {
            values = adjustFirstCellsAndScroll(scrollX[row], leftColumnIndex[row], widths);
            scrollX[row] = values[0];
            leftColumnIndex[row] = values[1];
        }

        values = adjustFirstCellsAndScroll(scrollY, firstRow, heights);
        scrollY = values[0];
        firstRow = values[1];
    }

    private int[] adjustFirstCellsAndScroll(int scroll, int firstCell, int sizes[][]) {
        if (scroll == 0) {
            // no op
        } else if (scroll > 0) {
            while (sizes[firstCell + 1][0] < scroll) {
                firstCell++;
                scroll -= sizes[firstCell][0];
            }
        } else {
            while (scroll < 0) {
                scroll += sizes[firstCell][0];
                firstCell--;
            }
        }
        return new int[]{scroll, firstCell};
    }

    private int[] adjustFirstCellsAndScroll(int scroll, int firstCell, int sizes[]) {
        if (scroll == 0) {
            // no op
        } else if (scroll > 0) {
            while (sizes[firstCell + 1] < scroll) {
                firstCell++;
                scroll -= sizes[firstCell];
            }
        } else {
            while (scroll < 0) {
                scroll += sizes[firstCell];
                firstCell--;
            }
        }
        return new int[]{scroll, firstCell};
    }

    private void resetTable() {
        headView = null;
        rowViewList.clear();
        columnViewList.clear();
        bodyViewTable.clear();

        removeAllViews();
    }

    private View makeAndSetup(int row, int column, int left, int top, int right, int bottom) {
        final View view = makeView(row, column, right - left, bottom - top);
        view.layout(left, top, right, bottom);
        return view;
    }

    private View makeView(int row, int column, int w, int h) {
        final int itemViewType = adapter.getItemViewType(row, column);
        final View recycledView;
        if (itemViewType == TableAdapter.IGNORE_ITEM_VIEW_TYPE) {
            recycledView = null;
        } else {
            recycledView = recycler.getRecycledView(itemViewType);
        }
        final View view = adapter.getView(row, column, recycledView, this);
        view.setTag(R.id.tag_type_view, itemViewType);
        view.setTag(R.id.tag_row, row);
        view.setTag(R.id.tag_column, column);

        view.measure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY));
        addTableView(view, row, column);
        return view;
    }

    private void addTableView(View view, int row, int column) {
        if (row == -1 && column == -1) {
            addView(view, getChildCount() - 4);
        } else if (row == -1 || column == -1) {
            addView(view, getChildCount() - 5);
        } else {
            addView(view, 0);
        }
    }

    private int sumArray(int array[]) {
        return sumArray(array, 0, array.length);
    }

    private int sumArray(int array[], int firstIndex, int count) {
        int sum = 0;
        count += firstIndex;
        for (int i = firstIndex; i < count; i++) {
            sum += array[i];
        }
        return sum;
    }

    private int sumArray(int array[][], int row, int startColumn, int count) {
        int sum = 0;
        count += startColumn;
        if (count > array[row].length) {
            count = array[row].length;
        }
        for (int i = startColumn; i < count; i++) {
            sum += array[row][i];
        }
        return sum;
    }

    public int getActualScrollX() {
        return scrollX[0] + sumArray(widths, 1, 0, leftColumnIndex[0]);
    }

    public int getActualScrollY() {
        return scrollY + sumArray(heights, 1, firstRow);
    }

    private int getMaxScrollX() {
        return Math.max(0, maxRowWidth - width);
    }

    private int getMaxScrollY() {
        return Math.max(0, sumArray(heights) - height);
    }

    private int getFilledWidth(int row, int initialItemsCount) {
        return widths[row][0] + sumArray(widths, row, leftColumnIndex[row] + 1, initialItemsCount) - scrollX[row];
    }

    private int getFilledHeight() {
        return heights[0] + sumArray(heights, firstRow + 1, columnViewList.size()) - scrollY;
    }

    private class TableAdapterDataSetObserver extends DataSetObserver {

        @Override
        public void onChanged() {
            needRelayout = true;
            requestLayout();
        }

        @Override
        public void onInvalidated() {
            // Do nothing
        }
    }

    // http://stackoverflow.com/a/6219382/842697
    private class Flinger implements Runnable {
        private final Scroller scroller;

        private int lastX = 0;
        private int lastY = 0;

        Flinger(Context context) {
            scroller = new Scroller(context);
        }

        void start(int initX, int initY, int initialVelocityX, int initialVelocityY, int maxX, int maxY) {
            scroller.fling(initX, initY, initialVelocityX, initialVelocityY, 0, maxX, 0, maxY);

            lastX = initX;
            lastY = initY;
            post(this);
        }

        public void run() {
            if (scroller.isFinished()) {
                return;
            }

            boolean more = scroller.computeScrollOffset();
            int x = scroller.getCurrX();
            int y = scroller.getCurrY();
            int diffX = lastX - x;
            int diffY = lastY - y;
            if (diffX != 0 || diffY != 0) {
                scrollBy(diffX, diffY);
                lastX = x;
                lastY = y;
            }

            if (more) {
                post(this);
            }
        }

        boolean isFinished() {
            return scroller.isFinished();
        }

        void forceFinished() {
            if (!scroller.isFinished()) {
                scroller.forceFinished(true);
            }
        }
    }

    private void log(String message) {
        Log.d(TAG, message);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.ansorgit.plugins.bash.lang.psi.api.command;

import com.ansorgit.plugins.bash.lang.psi.api.BashPsiElement;
import com.ansorgit.plugins.bash.lang.psi.api.vars.BashVarDef;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import java.util.List;

/**
 * A bash command psi element represents a simple command of the grammar. This can
 * either be an internal bash command, an external bash command or a function call.
 * It's also possible that a command has just assignments and no actual call to
 * a function or internal/external command. Then it's a pure assignment call.
 *

 *

 * Date: 12.04.2009
 * Time: 21:33:53
 *
 * @author Joachim Ansorg
 */
public interface BashCommand extends BashPsiElement {

    @Nonnull
    PsiReference getReference();

    /**
     * Checks whether this command is a call to a declared function.
     *
     * @return True if this command is a function call.
     */
    boolean isFunctionCall();

    /**
     * Returns true if this command is an include command
     *
     * @return True if this is an include command
     */
    boolean isIncludeCommand();

    /**
     * Checks whether this command is a call of an bash-internal command, like "echo" or "cd".
     *
     * @return True if this commmand is an internal command.
     */
    boolean isInternalCommand();

    /**
     * Returns true if this command is a call to an external program.
     *
     * @return True if this is an external command.
     */
    boolean isExternalCommand();

    /**
     * Returns true if this command is a call to an external program.
     *
     * @return True if this only contains assignments without an actual command.
     */
    boolean isPureAssignment();

    /**
     * Returns true if this command is a variable declaring command (e.g. export or read)
     *
     * @return True if it declares variables visible on the outside
     */
    boolean isVarDefCommand();

    /**
     * Returns whether an assignment expression is part of this simple command statement.
     *
     * @return True if one ore more assignments are done for the command.
     */
    boolean hasAssignments();

    /**
     * Returns the element which represents the executed command.
     * e.g. "echo" of the statement "a=b echo a b c"
     *
     * @return The element
     */
    @Nullable
    PsiElement commandElement();

    /**
     * Returns the elements which are parameters to the command
     *
     * @return
     */
    List<BashPsiElement> parameters();

    /**
     * Returns the assignments which are available in this command
     *
     * @return
     */
    BashVarDef[] assignments();

    @Nullable
    String getReferencedCommandName();
}


text:
require('log-update')('⌛ initializing');
require('babel-register');
require('babel-polyfill');
require('./src/fetch-emoji-list.js');


text:
.. _glossary:

Glossary
========

   parameter uncertainty
     An uncertainty is a parameter uncertainty if the range is continuous from
     the lower bound to the upper bound. A parameter uncertainty  can be either
     real valued or discrete valued.
   categorical uncertainty
      An uncertainty is categorical if there is not a range but a set of
      possibilities over which one wants to sample.
   lookup uncertainty
	  vensim specific extension to categorical uncertainty for handling
	  lookups in various ways
   uncertainty space
      the space created by the set of uncertainties
   ensemble
      a python class responsible for running a series of computational
      experiments.
   model interface
      a python class that provides an interface to an underlying model
   working directory
      a directory that contains files that a model needs
   classification trees
      a category of machine learning algorithms for rule induction
   prim (patient rule induction method)
      a rule induction algorithm
   coverage
      a metric developed for scenario discovery
   density
      a metric developed for scenario discovery
   scenario discovery
      a use case of EMA
   case
      A case specifies the input parameters for a run of a model. It is
      a dict instance, with the names of the uncertainties as key, and their
      sampled values as value.
   experiment
      An experiment is a complete specification for a run. It specifies the
      case, the name of the policy, and the name of the model.
   policy
      a policy is by definition an object with a name attribute. So,
      policy['name'] most return the name of the policy
   result
      the combination of an experiment and the associated outcomes for the
      experiment
   outcome
      the data of interest produced by a model given an experiment


text:
title: Discover — Our Imagery and Base Map Server
layout: page_nocrumb
author:
  display_name: Rick Kelson
  email: rkelson@utah.gov
tags:
  - base maps
  - discover
  - google
  - imagery
date: 2017-05-01 15:01:33
update_date: 2018-02-26
categories: []
---

{% include fa_icon.html plane=true class="svg-inline--fa fa-w-18 fa-fw" %} About Discover

Discover is a cloud-based server that provides UGRC's aerial imagery and base maps to anyone who wants to use them in
  their GIS, CAD, or web applications. Discover delivers its services in both <acronym
    title="Web Map Tile Service">WMTS</acronym> and <acronym title="Web Map Service">WMS</acronym> formats from the Open
  Geospatial Consortium (OGC) for broad compatibility. Like other common web map services, they are provided in the Web
  Mercator WGS84 projection (wkid/EPSG 3857).

You will need to register for a free Discover account to access these services. There are two levels of Discover
  access:

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} General access, for
    anyone who wants to use our base maps, NAIP imagery, or HRO imagery.

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Licensed access, for
    Utah's cities, counties, special districts, state agencies, K-12 school districts, colleges, universities,
      and tribal entities (or contractors or formal partners of any of these entities). This provides access to
    statewide high-resolution aerial imagery under the state's Google and Hexagon imagery licenses in
    addition to the general base maps and imagery. Visit the license
      information page for more details.

  Anyone can use the general access imagery and base map services from Discover! To use these services,
  all you need is a free account and its corresponding quad-word connection link.

{% include fa_icon.html keyboard=true class="svg-inline--fa fa-w-18 fa-fw" %} Sign Up

Choose the Right Form

You must choose. But choose wisely, for as the true form will bring you maps, the false form will take them from you.
     — The Grail Knight (probably)

To register a Discover account, fill out the appropriate form:

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Discover
      Server Access Form, for general access.

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Organizational
      Usage Agreement Form, for licensed access by one of Utah's cities, counties, special
      districts, state agencies, school districts, colleges, universities, or tribal entities, or a contractor
    or formal partner of one of these organizations. Students in the state of Utah working on school projects also
    qualify for licensed access.

  Students: Please use the Organizational
    Usage Agreement Form (except for students at out-of-state schools) and provide a school-supplied e-mail if
  possible.

Once you have completed the appropriate form (please only fill out one or the other, not both), we
  will review your request, create your account, and send you an e-mail with information about the services.

{% include fa_icon.html api=true class="svg-inline--fa fa-w-20 fa-fw" %} Get
  Connected

Your account e-mail will contain URLs that you'll enter into your software or web application to access the WMS,
  WMTS, or tile services. They contain a quad-word (e.g.,
  https://discover.agrc.utah.gov/login/path/your-unique-quad-word/) that is unique to your user and should
  not be shared with anyone outside your immediate organization. Multiple requests from the same organization may be
  given the same quad-word.

Example Discover URL Templates

WMS: https://discover.agrc.utah.gov/login/path/{quad-word}/wms

WMTS: https://discover.agrc.utah.gov/login/path/{quad-word}/wmts/1.0.0/WMTSCapabilities.xml

Tiles: https://discover.agrc.utah.gov/login/path/{quad-word}/tiles/{service}/{z}/{x}/{y}

For best performance, we recommend using WMTS when possible. WMS is slower and has technical limitations that
  could prevent the layer from drawing when exporting or printing maps.

Be sure to visit our Discover Server Resources and Information
  page to learn more about using the Discover Server. The following topics are covered in more depth there:

Coordinate system and datum

Horizontal positional accuracy

Adding a service in
      an Esri product

Adding a service in
      ArcGIS Online Web Maps

Use in JavaScript/Web Mapping application

Adding a service in CAD

ArcGIS Pro considerations

Printing Discover
      services

Flight dates

Imagery and base map cache scale information

On-premises use

Layers not exporting when
      using WMS

Other tidbits

If you are looking for non-licensed imagery downloads (NAIP, HRO, etc), check out the aerial photography section of the data pages.

{% include fa_icon.html map=true class="svg-inline--fa fa-w-18 fa-fw" %} Available
  Services

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Utah – Combination of the
    2018 Hexagon 30cm imagery and the 2019 Hexagon 15cm imagery with scale-dependent rendering
    (licensed)

This layer now uses the Hexagon imagery instead of the Google imagery. The rural areas have a slightly
          lower resolution than before but are more up-to-date. The most recent Google imagery is still available in the
          Google service.

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Hexagon 15cm –
    Approximately 6-inch natural-color aerial
      photography from Hexagon collected November 2019 covering the Wasatch Front, Logan, and St. George
      (licensed)

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Hexagon 30cm –
    Approximately 12-inch statewide natural-color aerial
      photography from Hexagon collected in 2018 (licensed)

This layer is a higher-resolution copy of the 2018 NAIP imagery

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Google – Most recent 6-inch
    statewide natural-color aerial photography from
      Google collected over 2011–2018 (licensed)

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Google {year} archive –
    Year-by-year updates to the Google Imagery (the latest blocks are always incorporated into the Google
    service) (licensed)

Available Years: 2011–2018

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Basemap-Address_Points –
    Base map of address point locations

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Basemap-Overlay – General
    reference features—highways and streets, cities, address points, parcels, etc—with a transparent background,
    suitable for layering over your thematic data.

{% include fa_icon.html lock=true class="svg-inline--fa fa-w-14 fa-fw" %} Basemap-Hybrid –
    Combination of the Overlay base map and the Utah imagery service
    (licensed)

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Basemap-Lite – A light,
    muted reference base map that doesn't compete with your thematic data.

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Basemap-Terrain – Base
    map of hillshade, highways and streets, parks, forests, water, etc.

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Basemap-Topo – Base map
    of US Geological Survey topographic maps

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %}
    DOQ 1990s BW – 1-meter statewide black-and-white aerial
    photography, collected in the 1990s

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %}
    HRO 2012 RGB – 12.5-cm natural-color aerial photography of
    the Wasatch Front, collected in 2012

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} NAIP {year} RGB – 1-meter statewide natural-color aerial photography

Available Years: 2006, 2009, 2011, 2014, 2016, 2018

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} NAIP {year} NRG – 1-meter
    statewide color infrared aerial photography

Available Years: 2006, 2011, 2014, 2016, 2018

{% include fa_icon.html circle=true class="svg-inline--fa fa-w-16 fa-fw" %} Hillshade – 10-meter
    statewide combined hillshade and slope

{% include fa_icon.html thumbs=true class="svg-inline--fa fa-w-16 fa-fw" %} Best Practices

We strongly recommended that you use WMTS for the best user experience.

If you are, or will be, printing base maps from the web and are experiencing blank or empty output, read about our
    GP proxy service or our new
    serverless print proxy.

Any end products using the licensed imagery must attribute Google or Hexagon. See the resources page for logos.


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Bactridium bonaërense Speg.

### Remarks
null


text:
void register_ClipNode_class();

#endif//ClipNode_hpp__pyplusplus_wrapper


text:
This project is a WAMP v2 client written in PHP that uses RxPHP Observables instead of promises and event emitters.

If you don't know what [WAMP](http://wamp-proto.org/) is, you should read up on it.

If you don't know what [RxPHP](https://github.com/ReactiveX/RxPHP) or [ReactiveExtensions](http://reactivex.io/) is, you're missing out...

## Installation

```BASH
composer require rx/thruway-client
```

## Usage

```PHP
use Rx\Observable;
use Rx\Thruway\Client;

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

$wamp = new Client('ws://127.0.0.1:9090', 'realm1');
```

## Call

```PHP
$wamp->call('add.rpc', [1, 2])
    ->map(function (Thruway\Message\ResultMessage $r) {
        return $r->getArguments()[0];
    })
    ->subscribe(function ($r) {
        echo $r;
    });
```

## Register

```PHP
$wamp->register('add.rpc', function ($a, $b) { return $a + $b; })->subscribe();
```

>If the Registration Handler throws an exception, `thruway.error.invocation_exception` is returned to the caller. If you would like to allow more specific error messages, you must throw a `WampErrorException` or, if using observable sequences that are returned from the RPC, you can `onError` a `WampErrorException`.

## Publish to topic

```PHP
$wamp->publish('example.topic', 'some value');
$wamp->publish('example.topic', Observable::interval(1000)); // you can also publish an observable
```

## Subscribe to topic

```PHP
$wamp->topic('example.topic')
    ->map(function(Thruway\Message\EventMessage $m) {
        return $m->getArguments()[0];
    })
    ->subscribe(function ($v) { echo $v; });
```


text:
<TITLE>Review for Batman (1989)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Batman (1989)

reviewed by
Mark R. Leeper

                                    BATMAN
                       A film review by Mark R. Leeper
                        Copyright 1989 Mark R. Leeper

          Capsule review:  A triumph of visual imagery over story
     for the music video generation.  Ironically, Keaton is better
     as Batman than Nicholson is as the Joker.  The art design is
     superior but just about everything else is pedestrian.
     Better than the television series or the serials, not as good
     as the comic.  Rating: 0.

     "[The] mind craves [images], and, of late more than ever, the
     keenest experimenters find twenty images better than one,
     especially if contradictory; since the human mind has already
     learned to deal in contradictions."
                                             Henry Adams, 1907

     Excuse the pretentiousness of starting a review with an 82-year-old
quote, but Adams might very well be talking about BATMAN, whose images,
often contradictory or of clashing styles, far overpower the flyweight story
that binds them together.  BATMAN is a triumph of visual imagery over story.
While Jack Nicholson is the top-billed star, his character is paper-thin and
just as flat.  We are down here to the level of villains whose biggest
crimes can be explained only by nastiness.  Nicholson apparently was chosen
not because he had a single responsive chord for the man behind the famous
face, but because both are known for their smirking.  Nicholson does not
even look the part.  His face is not thin and angular enough and his non-
angular body is better suited to playing the Penguin.  Of course, it is a
pity that the original model for the Joker is well past the point where he
could have played the part.  Conrad Veidt, best known for playing Col.
Strasser in CASABLANCA and Cesar in CABINET OF DR. CALIGARI, played the
title role in THE MAN WHO LAUGHS, a poor wretch whose face is twisted into a
perpetual rictus grin.  His nightmarish look was reportedly the real
inspiration for the Joker so he looked the role.  Nicholson can be a decent
actor but he lacks range and in spite of all the fuss and expectation,
Michael Keaton is much better cast as Batman than Nicholson is as the Joker.
Keaton, first of all, looks the part of Batman.  That is not all that
surprising if you realize what you are seeing is two eyes, a perpetual
frown, and a chin.  Everything else is plastic shell.  Any actor with a chin
and reasonable musculature could have looked good in the Batman suit.
Keaton's role was a little more demanding when he played the man behind the
mask--he is not a character out of Dostoevsky, understand, but his role did
require a little acting and while he was neither superior nor memorable, he
was at least equal to the role.  Surprisingly, Michael Gough played against
type as a sympathetic Alfred the butler (sort of a Batman's batman!).  At
one point he does severely overstep what the original Alfred would have
done, but that is a script fault, not Gough's failing.

     The story, what there is of it, gives us an origin for the Joker, a
touch of one for Batman, and one fiendish though not very coherent scheme by
the Joker which is, f course, foiled by Batman.  I will not say much about
the Joker's scheme, but it involves chemical contamination.  The Joker makes
the part about chemical contamination quite public, but apparently Batman is
the only person to do a chemical analysis of the contaminated products.  (To
judge how likely that is, the Berkeley ellness Letter reports, "The smoke
from a single cigarette contains about 100 times more cyanide than did the
two grapes from Chile that were impounded by government officials in March."
Any idea how many chemical labs got involved in analysis after that tiny
level of contamination was found?  How likely do you find it that only
Batman would do a complete chemical analysis of the Joker's product?)  The
plot also concerns what must be the world's tallest cathedral.  At a minimum
it looks to be at least fifty stories tall.  That does not make for a
believable story, but it is there for visual style more than credibility.

     In the quote above, Adams talks about contradictory images, and that is
precisely what BATMAN offers.  There are wide mood swings from somber, dark,
and brooding, to just exactly the sort of tongue-in-cheek campiness that the
producers have long promised would *not* be in this film.  Scenes of the Joker
dancing Mardi Gras fashion to songs by Prince in front of cheering crowds
are not classic Batman style by any means.  And when Batman laments, "This
is not exactly a normal world," this is not exactly a Batman sentiment.
Also, one wonders how many worlds Batman has seen.  Again and again the
story stops--literally stops--in a time-out for a visual image.  One of the
most ridiculous of these has the Batplane break off a confrontation with the
Joker so it can fly above the clouds and be seen outlined against the moon,
looking like an aerial bat-symbol.  If the script gives no explanation, the
cheer of the audience does.  Logic is less important than the visual image.

     BATMAN is an art designer's film all the way.  Gotham City is a highly
stylized New York City with the art deco of the 1930s and the futuristic
feel of Fritz Lang's (not Superman's) Metropolis.  It is a collection of
dark somber streets seen only at night or under overcast skies.  This is a
film without sunshine.  To tie Gotham to the present, the mayor of the city
was cast not for any acting ability, but because he looks like Ed Koch.  In
spite of the beautiful visual design for the city, the eye still rebels
because of the matte paintings and building models that are just not
convincing as being anything but mattes and models.  That is not a serious
fault in a film with a strong story, but when a film's strongest suit is its
art design, it becomes very important to execute those designs flawlessly.

     Finally, a word about the music.  Danny Elfman has written a decent
score, but choosing Prince to write the songs, apparently for the nihilism
of his previous work, was as big a blunder as choosing Nicholson for his
smirk.  Director Tim Burton claims to be a fan of Batman comic books, but it
seems to me they were better than his film.  I have to give the film a
neutral 0 on the -4 to +4 scale.  I guess I did not expect better, but I had
hoped for it nonetheless.

                                        Mark R. Leeper
                                        att!mtgzx!leeper
                                        leeper@mtgzx.att.com

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
package org.geometerplus.zlibrary.text.view;

import org.geometerplus.zlibrary.core.application.ZLApplication;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.library.ZLibrary;
import org.geometerplus.zlibrary.core.util.ZLColor;
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
import org.geometerplus.zlibrary.core.view.ZLView;
import org.geometerplus.zlibrary.text.model.ZLTextMetrics;
import org.geometerplus.zlibrary.text.view.style.ZLTextBaseStyle;
import org.geometerplus.zlibrary.text.view.style.ZLTextExplicitlyDecoratedStyle;
import org.geometerplus.zlibrary.text.view.style.ZLTextStyleCollection;
import org.geometerplus.zlibrary.text.view.style.ZLTextStyleDecoration;

abstract class ZLTextViewBase extends ZLView {
	public static enum ImageFitting {
		none, covers, all
	}

	private ZLTextStyle myTextStyle;
	private int myWordHeight = -1;
	private ZLTextMetrics myMetrics;

	ZLTextViewBase(ZLApplication application) {
		super(application);
	}

	protected void resetMetrics() {
		myMetrics = null;
	}

	private ZLTextMetrics metrics() {
		if (myMetrics == null) {
			final ZLTextStyleCollection collection = getTextStyleCollection();
			final ZLTextBaseStyle base = collection.getBaseStyle();
			myMetrics = new ZLTextMetrics(
				ZLibrary.Instance().getDisplayDPI(),
				collection.getDefaultFontSize(),
				base.getFontSize(),
				// TODO: font X height
				base.getFontSize() * 15 / 10,
				// TODO: screen area width
				100,
				// TODO: screen area height
				100
			);
		}
		return myMetrics;
	}

	final int getWordHeight() {
		if (myWordHeight == -1) {
			final ZLTextStyle textStyle = myTextStyle;
			myWordHeight = getContext().getStringHeight() * textStyle.getLineSpacePercent() / 100 + textStyle.getVerticalShift();
		}
		return myWordHeight;
	}

	public abstract ZLTextStyleCollection getTextStyleCollection();

	public abstract ImageFitting getImageFitting();

	public abstract int getLeftMargin();
	public abstract int getRightMargin();
	public abstract int getTopMargin();
	public abstract int getBottomMargin();
	public abstract int getSpaceBetweenColumns();

	public abstract boolean twoColumnView();

	public abstract ZLFile getWallpaperFile();
	public abstract ZLPaintContext.WallpaperMode getWallpaperMode();
	public abstract ZLColor getBackgroundColor();
	public abstract ZLColor getSelectionBackgroundColor();
	public abstract ZLColor getSelectionForegroundColor();
	public abstract ZLColor getHighlightingBackgroundColor();
	public abstract ZLColor getTextColor(ZLTextHyperlink hyperlink);

	ZLPaintContext.Size getTextAreaSize() {
		return new ZLPaintContext.Size(getTextColumnWidth(), getTextAreaHeight());
	}

	int getTextAreaHeight() {
		return getContextHeight() - getTopMargin() - getBottomMargin();
	}

	int getTextColumnWidth() {
		return twoColumnView()
			? (getContextWidth() - getLeftMargin() - getSpaceBetweenColumns() - getRightMargin()) / 2
			: getContextWidth() - getLeftMargin() - getRightMargin();
	}

	final ZLTextStyle getTextStyle() {
		if (myTextStyle == null) {
			resetTextStyle();
		}
		return myTextStyle;
	}

	final void setTextStyle(ZLTextStyle style) {
		if (myTextStyle != style) {
			myTextStyle = style;
			myWordHeight = -1;
		}
		getContext().setFont(style.getFontFamily(), style.getFontSize(metrics()), style.isBold(), style.isItalic(), style.isUnderline(), style.isStrikeThrough());
	}

	final void resetTextStyle() {
		setTextStyle(getTextStyleCollection().getBaseStyle());
	}

	boolean isStyleChangeElement(ZLTextElement element) {
		return
			element == ZLTextElement.StyleClose ||
			element instanceof ZLTextStyleElement ||
			element instanceof ZLTextControlElement;
	}

	void applyStyleChangeElement(ZLTextElement element) {
		if (element == ZLTextElement.StyleClose) {
			applyStyleClose();
		} else if (element instanceof ZLTextStyleElement) {
			applyStyle((ZLTextStyleElement)element);
		} else if (element instanceof ZLTextControlElement) {
			applyControl((ZLTextControlElement)element);
		}
	}

	void applyStyleChanges(ZLTextParagraphCursor cursor, int index, int end) {
		for (; index != end; ++index) {
			applyStyleChangeElement(cursor.getElement(index));
		}
	}

	private void applyControl(ZLTextControlElement control) {
		if (control.IsStart) {
			final ZLTextStyleDecoration decoration =
				getTextStyleCollection().getDecoration(control.Kind);
			if (control instanceof ZLTextHyperlinkControlElement) {
				setTextStyle(decoration.createDecoratedStyle(myTextStyle, ((ZLTextHyperlinkControlElement)control).Hyperlink));
			} else {
				setTextStyle(decoration.createDecoratedStyle(myTextStyle));
			}
		} else {
			setTextStyle(myTextStyle.Parent);
		}
	}

	private void applyStyle(ZLTextStyleElement element) {
		setTextStyle(new ZLTextExplicitlyDecoratedStyle(myTextStyle, element.Entry));
	}

	private void applyStyleClose() {
		setTextStyle(myTextStyle.Parent);
	}

	protected final ZLPaintContext.ScalingType getScalingType(ZLTextImageElement imageElement) {
		switch (getImageFitting()) {
			default:
			case none:
				return ZLPaintContext.ScalingType.IntegerCoefficient;
			case covers:
				return imageElement.IsCover
					? ZLPaintContext.ScalingType.FitMaximum
					: ZLPaintContext.ScalingType.IntegerCoefficient;
			case all:
				return ZLPaintContext.ScalingType.FitMaximum;
		}
	}

	final int getElementWidth(ZLTextElement element, int charIndex) {
		if (element instanceof ZLTextWord) {
			return getWordWidth((ZLTextWord)element, charIndex);
		} else if (element instanceof ZLTextImageElement) {
			final ZLTextImageElement imageElement = (ZLTextImageElement)element;
			final ZLPaintContext.Size size = getContext().imageSize(
				imageElement.ImageData,
				getTextAreaSize(),
				getScalingType(imageElement)
			);
			return size != null ? size.Width : 0;
		} else if (element == ZLTextElement.Indent) {
			return myTextStyle.getFirstLineIndentDelta();
		} else if (element instanceof ZLTextFixedHSpaceElement) {
			return getContext().getSpaceWidth() * ((ZLTextFixedHSpaceElement)element).Length;
		}
		return 0;
	}

	final int getElementHeight(ZLTextElement element) {
		if (element instanceof ZLTextWord) {
			return getWordHeight();
		} else if (element instanceof ZLTextImageElement) {
			final ZLTextImageElement imageElement = (ZLTextImageElement)element;
			final ZLPaintContext.Size size = getContext().imageSize(
				imageElement.ImageData,
				getTextAreaSize(),
				getScalingType(imageElement)
			);
			return (size != null ? size.Height : 0) +
				Math.max(getContext().getStringHeight() * (myTextStyle.getLineSpacePercent() - 100) / 100, 3);
		}
		return 0;
	}

	final int getElementDescent(ZLTextElement element) {
		return element instanceof ZLTextWord ? getContext().getDescent() : 0;
	}

	final int getWordWidth(ZLTextWord word, int start) {
		return
			start == 0 ?
				word.getWidth(getContext()) :
				getContext().getStringWidth(word.Data, word.Offset + start, word.Length - start);
	}

	final int getWordWidth(ZLTextWord word, int start, int length) {
		return getContext().getStringWidth(word.Data, word.Offset + start, length);
	}

	private char[] myWordPartArray = new char[20];

	final int getWordWidth(ZLTextWord word, int start, int length, boolean addHyphenationSign) {
		if (length == -1) {
			if (start == 0) {
				return word.getWidth(getContext());
			}
			length = word.Length - start;
		}
		if (!addHyphenationSign) {
			return getContext().getStringWidth(word.Data, word.Offset + start, length);
		}
		char[] part = myWordPartArray;
		if (length + 1 > part.length) {
			part = new char[length + 1];
			myWordPartArray = part;
		}
		System.arraycopy(word.Data, word.Offset + start, part, 0, length);
		part[length] = '-';
		return getContext().getStringWidth(part, 0, length + 1);
	}

	int getAreaLength(ZLTextParagraphCursor paragraph, ZLTextElementArea area, int toCharIndex) {
		setTextStyle(area.Style);
		final ZLTextWord word = (ZLTextWord)paragraph.getElement(area.ElementIndex);
		int length = toCharIndex - area.CharIndex;
		boolean selectHyphenationSign = false;
		if (length >= area.Length) {
			selectHyphenationSign = area.AddHyphenationSign;
			length = area.Length;
		}
		if (length > 0) {
			return getWordWidth(word, area.CharIndex, length, selectHyphenationSign);
		}
		return 0;
	}

	//TODO DRAW TEXT WORD
	final void drawWord(int x, int y, ZLTextWord word, int start, int length, boolean addHyphenationSign, ZLColor color) {
		final ZLPaintContext context = getContext();
		context.setTextColor(color);

		if (start == 0 && length == -1) {
			drawString(x, y, word.Data, word.Offset, word.Length, word.getMark(), 0);
		} else {
			if (length == -1) {
				length = word.Length - start;
			}
			if (!addHyphenationSign) {
				drawString(x, y, word.Data, word.Offset + start, length, word.getMark(), start);
			} else {
				char[] part = myWordPartArray;
				if (length + 1 > part.length) {
					part = new char[length + 1];
					myWordPartArray = part;
				}
				System.arraycopy(word.Data, word.Offset + start, part, 0, length);
				part[length] = '-';
				drawString(x, y, part, 0, length + 1, word.getMark(), start);
			}
		}
	}

	private final void drawString(int x, int y, char[] str, int offset, int length, ZLTextWord.Mark mark, int shift) {
		final ZLPaintContext context = getContext();
		if (mark == null) {
			context.drawString(x, y, str, offset, length);
		} else {
			int pos = 0;
			for (; (mark != null) && (pos < length); mark = mark.getNext()) {
				int markStart = mark.Start - shift;
				int markLen = mark.Length;

				if (markStart < pos) {
					markLen += markStart - pos;
					markStart = pos;
				}

				if (markLen <= 0) {
					continue;
				}

				if (markStart > pos) {
					int endPos = Math.min(markStart, length);
					context.drawString(x, y, str, offset + pos, endPos - pos);
					x += context.getStringWidth(str, offset + pos, endPos - pos);
				}

				if (markStart < length) {
					context.setFillColor(getHighlightingBackgroundColor());
					int endPos = Math.min(markStart + markLen, length);
					final int endX = x + context.getStringWidth(str, offset + markStart, endPos - markStart);
					context.fillRectangle(x, y - context.getStringHeight(), endX - 1, y + context.getDescent());
					context.drawString(x, y, str, offset + markStart, endPos - markStart);
					x = endX;
				}
				pos = markStart + markLen;
			}

			if (pos < length) {
				context.drawString(x, y, str, offset + pos, length - pos);
			}
		}
	}
}


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

namespace Core.Trying.Test
{
  class TestException : Exception
  {
  }
}


text:
@interface MainView_E ()<UITableViewDataSource,UITableViewDelegate,UIAlertViewDelegate>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) Fabu_List *fabu_M_List;
@property (nonatomic, strong) NOOrderView *orderView;
@property (nonatomic, assign) NSInteger indexSection;
@property (nonatomic, assign) BOOL refresh;
@property (nonatomic , assign)int                           count;
@end

@implementation MainView_E

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"My form";
    [self tableView];
    [self initUI];

    [self getAllData];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(getAllData)
                                                 name:KNOTIFICATION_ZufangSuccessed
                                               object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(getAllData)
                                                 name:KNOTIFICATION_SECHANDSuccessed
                                               object:nil];
    UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerDone)];
    [self.view addGestureRecognizer:tapAction];
}

- (void)initUI
{
    IMP_BLOCK_SELF(MainView_E);
    MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingBlock:^{
        block_self.count = 0;
        [block_self getAllData];
    }];

    header.lastUpdatedTimeLabel.hidden = YES;
    header.stateLabel.hidden = YES;
    self.tableView.header = header;
    [header beginRefreshing];

}

-(void)actionPickerDone {
    _refresh = YES;
    [_tableView reloadData];
}

- (NOOrderView *)orderView {
    if(!_orderView) {
        _orderView = [[NOOrderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64)];
        [self.view addSubview:_orderView];
        _orderView.titleLabel.text = @"You have not Application form";
        _orderView.orderLabel.text = @"\U0000e601";
    }
    return _orderView;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    _refresh = YES;
    [_tableView reloadData];
}

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

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    [self.view endEditing:YES];
}

#pragma mark - tableview
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return _fabu_M_List.data.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentity = @"cell";
    MyFabuTableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:cellIdentity];
    if(cell == nil) {
        cell = [[MyFabuTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    SecondHandModel *mode = _fabu_M_List.data[indexPath.section];
    [cell setMode:mode withIndexSection:indexPath.section];
    if (_refresh) {
        cell.backView.hidden = YES;
        cell.moreBtn.selected = NO;
    }
    [cell.editBtn addTarget:self action:@selector(editBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [cell.delBtn addTarget:self action:@selector(delBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    return cell;
}

-(void)editBtnAction:(UIButton *)sender {
    SecondHandModel *mode = _fabu_M_List.data[sender.tag];
    [self getDetail:mode.issue_type andId:mode.id];
}

-(void)delBtnAction:(UIButton *)sender {
    [self deleteFabuMessage:sender.tag];
}

#pragma mark UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.01;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [MyFabuTableViewCell getHeight];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    //     SecondHandModel *mode = _fabu_M_List.data[indexPath.section];
    //[self getDetail:mode.issue_type andId:mode.id];
}

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        [self deleteFabuMessage:indexPath.section];
    }
}

#pragma mark - init
- (UITableView *)tableView
{
    if(!_tableView)
    {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT -64)
                                                  style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        [self.view addSubview:_tableView];
    }
    return _tableView;
}

#pragma mark getAllData
- (void)getAllData
{
    IMP_BLOCK_SELF(MainView_E);
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:self.sess_id forKey:@"sess_id"];
    NSMutableString *string = [NSMutableString stringWithString:urlHeader];
    [string appendString:@"Programs_cylce/list_form"];
    [[NetWork shareInstance] netWorkWithUrl:string params:params isPost:YES sucessBlock:^(AFHTTPRequestOperation *operation, id responseObject)
     {
         [self.tableView.header endRefreshing];
         _fabu_M_List = nil;
         if([[responseObject objectForKey:@"code"] isEqual:@200])
         {
             _fabu_M_List = [Fabu_List objectWithKeyValues:responseObject];

             if (_fabu_M_List.data.count == 0) {
                 [self orderView];
                 self.orderView.hidden = NO;
             }
             [block_self.tableView reloadData];
             [block_self.tableView.header endRefreshing];

         }
         else if ([[responseObject objectForKey:@"code"] isEqual:@500])
         {
             _fabu_M_List = nil;
         }

         [self.tableView reloadData];

     }failBlock:^(AFHTTPRequestOperation *operation, NSError *eror)
     {
         _fabu_M_List = nil;
         [block_self.tableView.header endRefreshing];
     }];
}

//
- (void)getDetail:(NSString *)type andId:(NSString *)fabuId
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:self.sess_id forKey:@"sess_id"];
    kSetDict(type, @"issue_type");
    kSetDict(fabuId, @"id");

    NSLog(@"ID form------------------------------>%@",fabuId);

    NSMutableString *string = [NSMutableString stringWithString:urlHeader];
    [string appendString:@"Programs_cylce/details_form"];  // Get all infos from here
   [[NetWork shareInstance] netWorkWithUrl:string params:params isPost:NO sucessBlock:^(AFHTTPRequestOperation *operation, id responseObject)
     {
         if([[responseObject objectForKey:@"code"] isEqual:@200])
         {
             NSDictionary *dic = responseObject[@"data"];
             editApplyForm *saleVC = [[editApplyForm alloc] init];
             saleVC.isMyFabu = YES;
             saleVC.params = [[NSMutableDictionary alloc] initWithDictionary:dic];
             [self.navigationController pushViewController:saleVC animated:YES];

         }

     }failBlock:^(AFHTTPRequestOperation *operation, NSError *eror)
     {
     }];
}

- (void)deleteFabuMessage:(NSInteger)index
{
    NSLog(@"delete Action");

    UIAlertView *alert = [UIAlertView bk_alertViewWithTitle:@"Delete" message:@"Are you sure?"];
    [alert bk_addButtonWithTitle:@"No" handler:^{
        self.refresh = YES;
        [self.tableView reloadData];
    }];
    [alert bk_addButtonWithTitle:@"Yes" handler:^{
        SecondHandModel *mode = _fabu_M_List.data[index];

        NSMutableDictionary *params = [NSMutableDictionary dictionary];
        kSetDict(mode.id, @"id");

        NSLog(@"delete ID--------------------------->%@",mode.id);

        NSMutableString *string = [NSMutableString stringWithString:urlHeader];
        [string appendString:@"Programs_cylce/delete_form"];
         [[NetWork shareInstance] netWorkWithUrl:string params:params isPost:NO sucessBlock:^(AFHTTPRequestOperation *operation, id responseObject) {
            if([[responseObject objectForKey:@"code"] isEqual:@200]) {
                [self.fabu_M_List.data removeObjectAtIndex:index];
                [self.tableView reloadData];
            }
        }failBlock:^(AFHTTPRequestOperation *operation, NSError *eror) {

        }];
    }];
    [alert show];
}

@end