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.netapp.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.netapp.models.AvsDataStore;
import com.azure.resourcemanager.netapp.models.EnableSubvolumes;
import com.azure.resourcemanager.netapp.models.EncryptionKeySource;
import com.azure.resourcemanager.netapp.models.NetworkFeatures;
import com.azure.resourcemanager.netapp.models.PlacementKeyValuePairs;
import com.azure.resourcemanager.netapp.models.SecurityStyle;
import com.azure.resourcemanager.netapp.models.ServiceLevel;
import com.azure.resourcemanager.netapp.models.SmbAccessBasedEnumeration;
import com.azure.resourcemanager.netapp.models.SmbNonBrowsable;
import com.azure.resourcemanager.netapp.models.VolumePropertiesDataProtection;
import com.azure.resourcemanager.netapp.models.VolumePropertiesExportPolicy;
import com.azure.resourcemanager.netapp.models.VolumeStorageToNetworkProximity;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Volume resource. */
@Fluent
public final class VolumeInner extends Resource {
    /*
     * A unique read-only string that changes whenever the resource is updated.
     */
    @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY)
    private String etag;

    /*
     * Availability Zone
     */
    @JsonProperty(value = "zones")
    private List<String> zones;

    /*
     * Volume properties
     */
    @JsonProperty(value = "properties", required = true)
    private VolumeProperties innerProperties = new VolumeProperties();

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /**
     * Get the etag property: A unique read-only string that changes whenever the resource is updated.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Get the zones property: Availability Zone.
     *
     * @return the zones value.
     */
    public List<String> zones() {
        return this.zones;
    }

    /**
     * Set the zones property: Availability Zone.
     *
     * @param zones the zones value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withZones(List<String> zones) {
        this.zones = zones;
        return this;
    }

    /**
     * Get the innerProperties property: Volume properties.
     *
     * @return the innerProperties value.
     */
    private VolumeProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

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

    /**
     * Get the fileSystemId property: FileSystem ID
     *
     *
Unique FileSystem Identifier.
     *
     * @return the fileSystemId value.
     */
    public String fileSystemId() {
        return this.innerProperties() == null ? null : this.innerProperties().fileSystemId();
    }

    /**
     * Get the creationToken property: Creation Token or File Path
     *
     *
A unique file path for the volume. Used when creating mount targets.
     *
     * @return the creationToken value.
     */
    public String creationToken() {
        return this.innerProperties() == null ? null : this.innerProperties().creationToken();
    }

    /**
     * Set the creationToken property: Creation Token or File Path
     *
     *
A unique file path for the volume. Used when creating mount targets.
     *
     * @param creationToken the creationToken value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withCreationToken(String creationToken) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withCreationToken(creationToken);
        return this;
    }

    /**
     * Get the serviceLevel property: serviceLevel
     *
     *
The service level of the file system.
     *
     * @return the serviceLevel value.
     */
    public ServiceLevel serviceLevel() {
        return this.innerProperties() == null ? null : this.innerProperties().serviceLevel();
    }

    /**
     * Set the serviceLevel property: serviceLevel
     *
     *
The service level of the file system.
     *
     * @param serviceLevel the serviceLevel value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withServiceLevel(ServiceLevel serviceLevel) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withServiceLevel(serviceLevel);
        return this;
    }

    /**
     * Get the usageThreshold property: usageThreshold
     *
     *
Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum
     * size is 500 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes.
     *
     * @return the usageThreshold value.
     */
    public long usageThreshold() {
        return this.innerProperties() == null ? 0L : this.innerProperties().usageThreshold();
    }

    /**
     * Set the usageThreshold property: usageThreshold
     *
     *
Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum
     * size is 500 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes.
     *
     * @param usageThreshold the usageThreshold value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withUsageThreshold(long usageThreshold) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withUsageThreshold(usageThreshold);
        return this;
    }

    /**
     * Get the exportPolicy property: exportPolicy
     *
     *
Set of export policy rules.
     *
     * @return the exportPolicy value.
     */
    public VolumePropertiesExportPolicy exportPolicy() {
        return this.innerProperties() == null ? null : this.innerProperties().exportPolicy();
    }

    /**
     * Set the exportPolicy property: exportPolicy
     *
     *
Set of export policy rules.
     *
     * @param exportPolicy the exportPolicy value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withExportPolicy(VolumePropertiesExportPolicy exportPolicy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withExportPolicy(exportPolicy);
        return this;
    }

    /**
     * Get the protocolTypes property: protocolTypes
     *
     *
Set of protocol types, default NFSv3, CIFS for SMB protocol.
     *
     * @return the protocolTypes value.
     */
    public List<String> protocolTypes() {
        return this.innerProperties() == null ? null : this.innerProperties().protocolTypes();
    }

    /**
     * Set the protocolTypes property: protocolTypes
     *
     *
Set of protocol types, default NFSv3, CIFS for SMB protocol.
     *
     * @param protocolTypes the protocolTypes value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withProtocolTypes(List<String> protocolTypes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withProtocolTypes(protocolTypes);
        return this;
    }

    /**
     * Get the provisioningState property: Azure lifecycle management.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the snapshotId property: Snapshot ID
     *
     *
UUID v4 or resource identifier used to identify the Snapshot.
     *
     * @return the snapshotId value.
     */
    public String snapshotId() {
        return this.innerProperties() == null ? null : this.innerProperties().snapshotId();
    }

    /**
     * Set the snapshotId property: Snapshot ID
     *
     *
UUID v4 or resource identifier used to identify the Snapshot.
     *
     * @param snapshotId the snapshotId value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSnapshotId(String snapshotId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSnapshotId(snapshotId);
        return this;
    }

    /**
     * Get the deleteBaseSnapshot property: If enabled (true) the snapshot the volume was created from will be
     * automatically deleted after the volume create operation has finished. Defaults to false.
     *
     * @return the deleteBaseSnapshot value.
     */
    public Boolean deleteBaseSnapshot() {
        return this.innerProperties() == null ? null : this.innerProperties().deleteBaseSnapshot();
    }

    /**
     * Set the deleteBaseSnapshot property: If enabled (true) the snapshot the volume was created from will be
     * automatically deleted after the volume create operation has finished. Defaults to false.
     *
     * @param deleteBaseSnapshot the deleteBaseSnapshot value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withDeleteBaseSnapshot(Boolean deleteBaseSnapshot) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withDeleteBaseSnapshot(deleteBaseSnapshot);
        return this;
    }

    /**
     * Get the backupId property: Backup ID
     *
     *
UUID v4 or resource identifier used to identify the Backup.
     *
     * @return the backupId value.
     */
    public String backupId() {
        return this.innerProperties() == null ? null : this.innerProperties().backupId();
    }

    /**
     * Set the backupId property: Backup ID
     *
     *
UUID v4 or resource identifier used to identify the Backup.
     *
     * @param backupId the backupId value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withBackupId(String backupId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withBackupId(backupId);
        return this;
    }

    /**
     * Get the baremetalTenantId property: Baremetal Tenant ID
     *
     *
Unique Baremetal Tenant Identifier.
     *
     * @return the baremetalTenantId value.
     */
    public String baremetalTenantId() {
        return this.innerProperties() == null ? null : this.innerProperties().baremetalTenantId();
    }

    /**
     * Get the subnetId property: The Azure Resource URI for a delegated subnet. Must have the delegation
     * Microsoft.NetApp/volumes.
     *
     * @return the subnetId value.
     */
    public String subnetId() {
        return this.innerProperties() == null ? null : this.innerProperties().subnetId();
    }

    /**
     * Set the subnetId property: The Azure Resource URI for a delegated subnet. Must have the delegation
     * Microsoft.NetApp/volumes.
     *
     * @param subnetId the subnetId value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSubnetId(String subnetId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSubnetId(subnetId);
        return this;
    }

    /**
     * Get the networkFeatures property: Network features
     *
     *
Basic network, or Standard features available to the volume.
     *
     * @return the networkFeatures value.
     */
    public NetworkFeatures networkFeatures() {
        return this.innerProperties() == null ? null : this.innerProperties().networkFeatures();
    }

    /**
     * Set the networkFeatures property: Network features
     *
     *
Basic network, or Standard features available to the volume.
     *
     * @param networkFeatures the networkFeatures value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withNetworkFeatures(NetworkFeatures networkFeatures) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withNetworkFeatures(networkFeatures);
        return this;
    }

    /**
     * Get the networkSiblingSetId property: Network Sibling Set ID
     *
     *
Network Sibling Set ID for the the group of volumes sharing networking resources.
     *
     * @return the networkSiblingSetId value.
     */
    public String networkSiblingSetId() {
        return this.innerProperties() == null ? null : this.innerProperties().networkSiblingSetId();
    }

    /**
     * Get the storageToNetworkProximity property: Storage to Network Proximity
     *
     *
Provides storage to network proximity information for the volume.
     *
     * @return the storageToNetworkProximity value.
     */
    public VolumeStorageToNetworkProximity storageToNetworkProximity() {
        return this.innerProperties() == null ? null : this.innerProperties().storageToNetworkProximity();
    }

    /**
     * Get the mountTargets property: mountTargets
     *
     *
List of mount targets.
     *
     * @return the mountTargets value.
     */
    public List<MountTargetProperties> mountTargets() {
        return this.innerProperties() == null ? null : this.innerProperties().mountTargets();
    }

    /**
     * Get the volumeType property: What type of volume is this. For destination volumes in Cross Region Replication,
     * set type to DataProtection.
     *
     * @return the volumeType value.
     */
    public String volumeType() {
        return this.innerProperties() == null ? null : this.innerProperties().volumeType();
    }

    /**
     * Set the volumeType property: What type of volume is this. For destination volumes in Cross Region Replication,
     * set type to DataProtection.
     *
     * @param volumeType the volumeType value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withVolumeType(String volumeType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withVolumeType(volumeType);
        return this;
    }

    /**
     * Get the dataProtection property: DataProtection
     *
     *
DataProtection type volumes include an object containing details of the replication.
     *
     * @return the dataProtection value.
     */
    public VolumePropertiesDataProtection dataProtection() {
        return this.innerProperties() == null ? null : this.innerProperties().dataProtection();
    }

    /**
     * Set the dataProtection property: DataProtection
     *
     *
DataProtection type volumes include an object containing details of the replication.
     *
     * @param dataProtection the dataProtection value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withDataProtection(VolumePropertiesDataProtection dataProtection) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withDataProtection(dataProtection);
        return this;
    }

    /**
     * Get the isRestoring property: Restoring.
     *
     * @return the isRestoring value.
     */
    public Boolean isRestoring() {
        return this.innerProperties() == null ? null : this.innerProperties().isRestoring();
    }

    /**
     * Set the isRestoring property: Restoring.
     *
     * @param isRestoring the isRestoring value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withIsRestoring(Boolean isRestoring) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withIsRestoring(isRestoring);
        return this;
    }

    /**
     * Get the snapshotDirectoryVisible property: If enabled (true) the volume will contain a read-only snapshot
     * directory which provides access to each of the volume's snapshots (default to true).
     *
     * @return the snapshotDirectoryVisible value.
     */
    public Boolean snapshotDirectoryVisible() {
        return this.innerProperties() == null ? null : this.innerProperties().snapshotDirectoryVisible();
    }

    /**
     * Set the snapshotDirectoryVisible property: If enabled (true) the volume will contain a read-only snapshot
     * directory which provides access to each of the volume's snapshots (default to true).
     *
     * @param snapshotDirectoryVisible the snapshotDirectoryVisible value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSnapshotDirectoryVisible(Boolean snapshotDirectoryVisible) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSnapshotDirectoryVisible(snapshotDirectoryVisible);
        return this;
    }

    /**
     * Get the kerberosEnabled property: Describe if a volume is KerberosEnabled. To be use with swagger version
     * 2020-05-01 or later.
     *
     * @return the kerberosEnabled value.
     */
    public Boolean kerberosEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().kerberosEnabled();
    }

    /**
     * Set the kerberosEnabled property: Describe if a volume is KerberosEnabled. To be use with swagger version
     * 2020-05-01 or later.
     *
     * @param kerberosEnabled the kerberosEnabled value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withKerberosEnabled(Boolean kerberosEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withKerberosEnabled(kerberosEnabled);
        return this;
    }

    /**
     * Get the securityStyle property: The security style of volume, default unix, defaults to ntfs for dual protocol or
     * CIFS protocol.
     *
     * @return the securityStyle value.
     */
    public SecurityStyle securityStyle() {
        return this.innerProperties() == null ? null : this.innerProperties().securityStyle();
    }

    /**
     * Set the securityStyle property: The security style of volume, default unix, defaults to ntfs for dual protocol or
     * CIFS protocol.
     *
     * @param securityStyle the securityStyle value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSecurityStyle(SecurityStyle securityStyle) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSecurityStyle(securityStyle);
        return this;
    }

    /**
     * Get the smbEncryption property: Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol
     * volume. To be used with swagger version 2020-08-01 or later.
     *
     * @return the smbEncryption value.
     */
    public Boolean smbEncryption() {
        return this.innerProperties() == null ? null : this.innerProperties().smbEncryption();
    }

    /**
     * Set the smbEncryption property: Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol
     * volume. To be used with swagger version 2020-08-01 or later.
     *
     * @param smbEncryption the smbEncryption value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSmbEncryption(Boolean smbEncryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSmbEncryption(smbEncryption);
        return this;
    }

    /**
     * Get the smbAccessBasedEnumeration property: smbAccessBasedEnumeration
     *
     *
Enables access based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume.
     *
     * @return the smbAccessBasedEnumeration value.
     */
    public SmbAccessBasedEnumeration smbAccessBasedEnumeration() {
        return this.innerProperties() == null ? null : this.innerProperties().smbAccessBasedEnumeration();
    }

    /**
     * Set the smbAccessBasedEnumeration property: smbAccessBasedEnumeration
     *
     *
Enables access based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume.
     *
     * @param smbAccessBasedEnumeration the smbAccessBasedEnumeration value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSmbAccessBasedEnumeration(SmbAccessBasedEnumeration smbAccessBasedEnumeration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSmbAccessBasedEnumeration(smbAccessBasedEnumeration);
        return this;
    }

    /**
     * Get the smbNonBrowsable property: smbNonBrowsable
     *
     *
Enables non browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume.
     *
     * @return the smbNonBrowsable value.
     */
    public SmbNonBrowsable smbNonBrowsable() {
        return this.innerProperties() == null ? null : this.innerProperties().smbNonBrowsable();
    }

    /**
     * Set the smbNonBrowsable property: smbNonBrowsable
     *
     *
Enables non browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume.
     *
     * @param smbNonBrowsable the smbNonBrowsable value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSmbNonBrowsable(SmbNonBrowsable smbNonBrowsable) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSmbNonBrowsable(smbNonBrowsable);
        return this;
    }

    /**
     * Get the smbContinuouslyAvailable property: Enables continuously available share property for smb volume. Only
     * applicable for SMB volume.
     *
     * @return the smbContinuouslyAvailable value.
     */
    public Boolean smbContinuouslyAvailable() {
        return this.innerProperties() == null ? null : this.innerProperties().smbContinuouslyAvailable();
    }

    /**
     * Set the smbContinuouslyAvailable property: Enables continuously available share property for smb volume. Only
     * applicable for SMB volume.
     *
     * @param smbContinuouslyAvailable the smbContinuouslyAvailable value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withSmbContinuouslyAvailable(Boolean smbContinuouslyAvailable) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withSmbContinuouslyAvailable(smbContinuouslyAvailable);
        return this;
    }

    /**
     * Get the throughputMibps property: Maximum throughput in MiB/s that can be achieved by this volume and this will
     * be accepted as input only for manual qosType volume.
     *
     * @return the throughputMibps value.
     */
    public Float throughputMibps() {
        return this.innerProperties() == null ? null : this.innerProperties().throughputMibps();
    }

    /**
     * Set the throughputMibps property: Maximum throughput in MiB/s that can be achieved by this volume and this will
     * be accepted as input only for manual qosType volume.
     *
     * @param throughputMibps the throughputMibps value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withThroughputMibps(Float throughputMibps) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withThroughputMibps(throughputMibps);
        return this;
    }

    /**
     * Get the encryptionKeySource property: Source of key used to encrypt data in volume. Applicable if NetApp account
     * has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp,
     * Microsoft.KeyVault'.
     *
     * @return the encryptionKeySource value.
     */
    public EncryptionKeySource encryptionKeySource() {
        return this.innerProperties() == null ? null : this.innerProperties().encryptionKeySource();
    }

    /**
     * Set the encryptionKeySource property: Source of key used to encrypt data in volume. Applicable if NetApp account
     * has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp,
     * Microsoft.KeyVault'.
     *
     * @param encryptionKeySource the encryptionKeySource value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withEncryptionKeySource(EncryptionKeySource encryptionKeySource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withEncryptionKeySource(encryptionKeySource);
        return this;
    }

    /**
     * Get the keyVaultPrivateEndpointResourceId property: The resource ID of private endpoint for KeyVault. It must
     * reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'.
     *
     * @return the keyVaultPrivateEndpointResourceId value.
     */
    public String keyVaultPrivateEndpointResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().keyVaultPrivateEndpointResourceId();
    }

    /**
     * Set the keyVaultPrivateEndpointResourceId property: The resource ID of private endpoint for KeyVault. It must
     * reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'.
     *
     * @param keyVaultPrivateEndpointResourceId the keyVaultPrivateEndpointResourceId value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withKeyVaultPrivateEndpointResourceId(String keyVaultPrivateEndpointResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withKeyVaultPrivateEndpointResourceId(keyVaultPrivateEndpointResourceId);
        return this;
    }

    /**
     * Get the ldapEnabled property: Specifies whether LDAP is enabled or not for a given NFS volume.
     *
     * @return the ldapEnabled value.
     */
    public Boolean ldapEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().ldapEnabled();
    }

    /**
     * Set the ldapEnabled property: Specifies whether LDAP is enabled or not for a given NFS volume.
     *
     * @param ldapEnabled the ldapEnabled value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withLdapEnabled(Boolean ldapEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withLdapEnabled(ldapEnabled);
        return this;
    }

    /**
     * Get the coolAccess property: Specifies whether Cool Access(tiering) is enabled for the volume.
     *
     * @return the coolAccess value.
     */
    public Boolean coolAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().coolAccess();
    }

    /**
     * Set the coolAccess property: Specifies whether Cool Access(tiering) is enabled for the volume.
     *
     * @param coolAccess the coolAccess value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withCoolAccess(Boolean coolAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withCoolAccess(coolAccess);
        return this;
    }

    /**
     * Get the coolnessPeriod property: Specifies the number of days after which data that is not accessed by clients
     * will be tiered.
     *
     * @return the coolnessPeriod value.
     */
    public Integer coolnessPeriod() {
        return this.innerProperties() == null ? null : this.innerProperties().coolnessPeriod();
    }

    /**
     * Set the coolnessPeriod property: Specifies the number of days after which data that is not accessed by clients
     * will be tiered.
     *
     * @param coolnessPeriod the coolnessPeriod value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withCoolnessPeriod(Integer coolnessPeriod) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withCoolnessPeriod(coolnessPeriod);
        return this;
    }

    /**
     * Get the unixPermissions property: UNIX permissions for NFS volume accepted in octal 4 digit format. First digit
     * selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the
     * owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same
     * group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and
     * read/execute to group and other users.
     *
     * @return the unixPermissions value.
     */
    public String unixPermissions() {
        return this.innerProperties() == null ? null : this.innerProperties().unixPermissions();
    }

    /**
     * Set the unixPermissions property: UNIX permissions for NFS volume accepted in octal 4 digit format. First digit
     * selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the
     * owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same
     * group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and
     * read/execute to group and other users.
     *
     * @param unixPermissions the unixPermissions value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withUnixPermissions(String unixPermissions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withUnixPermissions(unixPermissions);
        return this;
    }

    /**
     * Get the cloneProgress property: When a volume is being restored from another volume's snapshot, will show the
     * percentage completion of this cloning process. When this value is empty/null there is no cloning process
     * currently happening on this volume. This value will update every 5 minutes during cloning.
     *
     * @return the cloneProgress value.
     */
    public Integer cloneProgress() {
        return this.innerProperties() == null ? null : this.innerProperties().cloneProgress();
    }

    /**
     * Get the avsDataStore property: avsDataStore
     *
     *
Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose.
     *
     * @return the avsDataStore value.
     */
    public AvsDataStore avsDataStore() {
        return this.innerProperties() == null ? null : this.innerProperties().avsDataStore();
    }

    /**
     * Set the avsDataStore property: avsDataStore
     *
     *
Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose.
     *
     * @param avsDataStore the avsDataStore value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withAvsDataStore(AvsDataStore avsDataStore) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withAvsDataStore(avsDataStore);
        return this;
    }

    /**
     * Get the isDefaultQuotaEnabled property: Specifies if default quota is enabled for the volume.
     *
     * @return the isDefaultQuotaEnabled value.
     */
    public Boolean isDefaultQuotaEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().isDefaultQuotaEnabled();
    }

    /**
     * Set the isDefaultQuotaEnabled property: Specifies if default quota is enabled for the volume.
     *
     * @param isDefaultQuotaEnabled the isDefaultQuotaEnabled value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withIsDefaultQuotaEnabled(Boolean isDefaultQuotaEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withIsDefaultQuotaEnabled(isDefaultQuotaEnabled);
        return this;
    }

    /**
     * Get the defaultUserQuotaInKiBs property: Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set,
     * the minimum value of 4 KiBs applies .
     *
     * @return the defaultUserQuotaInKiBs value.
     */
    public Long defaultUserQuotaInKiBs() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultUserQuotaInKiBs();
    }

    /**
     * Set the defaultUserQuotaInKiBs property: Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set,
     * the minimum value of 4 KiBs applies .
     *
     * @param defaultUserQuotaInKiBs the defaultUserQuotaInKiBs value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withDefaultUserQuotaInKiBs(Long defaultUserQuotaInKiBs) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withDefaultUserQuotaInKiBs(defaultUserQuotaInKiBs);
        return this;
    }

    /**
     * Get the defaultGroupQuotaInKiBs property: Default group quota for volume in KiBs. If isDefaultQuotaEnabled is
     * set, the minimum value of 4 KiBs applies.
     *
     * @return the defaultGroupQuotaInKiBs value.
     */
    public Long defaultGroupQuotaInKiBs() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultGroupQuotaInKiBs();
    }

    /**
     * Set the defaultGroupQuotaInKiBs property: Default group quota for volume in KiBs. If isDefaultQuotaEnabled is
     * set, the minimum value of 4 KiBs applies.
     *
     * @param defaultGroupQuotaInKiBs the defaultGroupQuotaInKiBs value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withDefaultGroupQuotaInKiBs(Long defaultGroupQuotaInKiBs) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withDefaultGroupQuotaInKiBs(defaultGroupQuotaInKiBs);
        return this;
    }

    /**
     * Get the maximumNumberOfFiles property: Maximum number of files allowed. Needs a service request in order to be
     * changed. Only allowed to be changed if volume quota is more than 4TiB.
     *
     * @return the maximumNumberOfFiles value.
     */
    public Long maximumNumberOfFiles() {
        return this.innerProperties() == null ? null : this.innerProperties().maximumNumberOfFiles();
    }

    /**
     * Get the volumeGroupName property: Volume Group Name.
     *
     * @return the volumeGroupName value.
     */
    public String volumeGroupName() {
        return this.innerProperties() == null ? null : this.innerProperties().volumeGroupName();
    }

    /**
     * Get the capacityPoolResourceId property: Pool Resource Id used in case of creating a volume through volume group.
     *
     * @return the capacityPoolResourceId value.
     */
    public String capacityPoolResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().capacityPoolResourceId();
    }

    /**
     * Set the capacityPoolResourceId property: Pool Resource Id used in case of creating a volume through volume group.
     *
     * @param capacityPoolResourceId the capacityPoolResourceId value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withCapacityPoolResourceId(String capacityPoolResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withCapacityPoolResourceId(capacityPoolResourceId);
        return this;
    }

    /**
     * Get the proximityPlacementGroup property: Proximity placement group associated with the volume.
     *
     * @return the proximityPlacementGroup value.
     */
    public String proximityPlacementGroup() {
        return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup();
    }

    /**
     * Set the proximityPlacementGroup property: Proximity placement group associated with the volume.
     *
     * @param proximityPlacementGroup the proximityPlacementGroup value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withProximityPlacementGroup(String proximityPlacementGroup) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup);
        return this;
    }

    /**
     * Get the t2Network property: T2 network information.
     *
     * @return the t2Network value.
     */
    public String t2Network() {
        return this.innerProperties() == null ? null : this.innerProperties().t2Network();
    }

    /**
     * Get the volumeSpecName property: Volume spec name is the application specific designation or identifier for the
     * particular volume in a volume group for e.g. data, log.
     *
     * @return the volumeSpecName value.
     */
    public String volumeSpecName() {
        return this.innerProperties() == null ? null : this.innerProperties().volumeSpecName();
    }

    /**
     * Set the volumeSpecName property: Volume spec name is the application specific designation or identifier for the
     * particular volume in a volume group for e.g. data, log.
     *
     * @param volumeSpecName the volumeSpecName value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withVolumeSpecName(String volumeSpecName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withVolumeSpecName(volumeSpecName);
        return this;
    }

    /**
     * Get the encrypted property: Specifies if the volume is encrypted or not. Only available on volumes created or
     * updated after 2022-01-01.
     *
     * @return the encrypted value.
     */
    public Boolean encrypted() {
        return this.innerProperties() == null ? null : this.innerProperties().encrypted();
    }

    /**
     * Get the placementRules property: Volume placement rules
     *
     *
Application specific placement rules for the particular volume.
     *
     * @return the placementRules value.
     */
    public List<PlacementKeyValuePairs> placementRules() {
        return this.innerProperties() == null ? null : this.innerProperties().placementRules();
    }

    /**
     * Set the placementRules property: Volume placement rules
     *
     *
Application specific placement rules for the particular volume.
     *
     * @param placementRules the placementRules value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withPlacementRules(List<PlacementKeyValuePairs> placementRules) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withPlacementRules(placementRules);
        return this;
    }

    /**
     * Get the enableSubvolumes property: Flag indicating whether subvolume operations are enabled on the volume.
     *
     * @return the enableSubvolumes value.
     */
    public EnableSubvolumes enableSubvolumes() {
        return this.innerProperties() == null ? null : this.innerProperties().enableSubvolumes();
    }

    /**
     * Set the enableSubvolumes property: Flag indicating whether subvolume operations are enabled on the volume.
     *
     * @param enableSubvolumes the enableSubvolumes value to set.
     * @return the VolumeInner object itself.
     */
    public VolumeInner withEnableSubvolumes(EnableSubvolumes enableSubvolumes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VolumeProperties();
        }
        this.innerProperties().withEnableSubvolumes(enableSubvolumes);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property innerProperties in model VolumeInner"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(VolumeInner.class);
}


text:
namespace ui {

namespace {

// This is used to pop a std::queue when returning from a function.
class ScopedPop {
 public:
  explicit ScopedPop(std::queue<TouchEvent*>* queue) : queue_(queue) {
  }

  ~ScopedPop() {
    delete queue_->front();
    queue_->pop();
  }

 private:
  std::queue<TouchEvent*>* queue_;
  DISALLOW_COPY_AND_ASSIGN(ScopedPop);
};

// CancelledTouchEvent mirrors a TouchEvent object.
class MirroredTouchEvent : public TouchEvent {
 public:
  explicit MirroredTouchEvent(const TouchEvent* real)
      : type_(real->GetEventType()),
        location_(real->GetLocation()),
        touch_id_(real->GetTouchId()),
        flags_(real->GetEventFlags()),
        timestamp_(real->GetTimestamp()),
        radius_x_(real->RadiusX()),
        radius_y_(real->RadiusY()),
        rotation_angle_(real->RotationAngle()),
        force_(real->Force()) {
  }

  virtual ~MirroredTouchEvent() {
  }

  // Overridden from TouchEvent.
  virtual EventType GetEventType() const OVERRIDE {
    return type_;
  }

  virtual gfx::Point GetLocation() const OVERRIDE {
    return location_;
  }

  virtual int GetTouchId() const OVERRIDE {
    return touch_id_;
  }

  virtual int GetEventFlags() const OVERRIDE {
    return flags_;
  }

  virtual base::TimeDelta GetTimestamp() const OVERRIDE {
    return timestamp_;
  }

  virtual float RadiusX() const OVERRIDE {
    return radius_x_;
  }

  virtual float RadiusY() const OVERRIDE {
    return radius_y_;
  }

  virtual float RotationAngle() const OVERRIDE {
    return rotation_angle_;
  }

  virtual float Force() const OVERRIDE {
    return force_;
  }

 protected:
  void set_type(const EventType type) { type_ = type; }

 private:
  EventType type_;
  gfx::Point location_;
  int touch_id_;
  int flags_;
  base::TimeDelta timestamp_;
  float radius_x_;
  float radius_y_;
  float rotation_angle_;
  float force_;

  DISALLOW_COPY_AND_ASSIGN(MirroredTouchEvent);
};

// A mirrored event, except for the type, which is always ET_TOUCH_CANCELLED.
class CancelledTouchEvent : public MirroredTouchEvent {
 public:
  explicit CancelledTouchEvent(const TouchEvent* src)
      : MirroredTouchEvent(src) {
    set_type(ET_TOUCH_CANCELLED);
  }

  virtual ~CancelledTouchEvent() {}

 private:
  DISALLOW_COPY_AND_ASSIGN(CancelledTouchEvent);
};

// Touches which are cancelled by a touch capture are routed to a
// GestureEventIgnorer, which ignores them.
class GestureConsumerIgnorer : public GestureConsumer {
 public:
  GestureConsumerIgnorer()
      : GestureConsumer(true) {
  }
};

template <typename T>
void TransferConsumer(GestureConsumer* current_consumer,
                      GestureConsumer* new_consumer,
                      std::map<GestureConsumer*, T>* map) {
  if (map->count(current_consumer)) {
    (*map)[new_consumer] = (*map)[current_consumer];
    map->erase(current_consumer);
  }
}

void RemoveConsumerFromMap(GestureConsumer* consumer,
                           GestureRecognizerImpl::TouchIdToConsumerMap* map) {
  for (GestureRecognizerImpl::TouchIdToConsumerMap::iterator i = map->begin();
       i != map->end();) {
    if (i->second == consumer)
      map->erase(i++);
    else
      ++i;
  }
}

void TransferTouchIdToConsumerMap(
    GestureConsumer* old_consumer,
    GestureConsumer* new_consumer,
    GestureRecognizerImpl::TouchIdToConsumerMap* map) {
  for (GestureRecognizerImpl::TouchIdToConsumerMap::iterator i = map->begin();
       i != map->end(); ++i) {
    if (i->second == old_consumer)
      i->second = new_consumer;
  }
}

}  // namespace

////////////////////////////////////////////////////////////////////////////////
// GestureRecognizerImpl, public:

GestureRecognizerImpl::GestureRecognizerImpl(GestureEventHelper* helper)
    : helper_(helper) {
  gesture_consumer_ignorer_.reset(new GestureConsumerIgnorer());
}

GestureRecognizerImpl::~GestureRecognizerImpl() {
}

// Checks if this finger is already down, if so, returns the current target.
// Otherwise, returns NULL.
GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget(
    TouchEvent* event) {
  return touch_id_target_[event->GetTouchId()];
}

GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent(
    GestureEvent* event) {
  GestureConsumer* target = NULL;
  int touch_id = event->GetLowestTouchId();
  target = touch_id_target_for_gestures_[touch_id];
  return target;
}

GestureConsumer* GestureRecognizerImpl::GetTargetForLocation(
    const gfx::Point& location) {
  const GesturePoint* closest_point = NULL;
  int closest_distance_squared = 0;
  std::map<GestureConsumer*, GestureSequence*>::iterator i;
  for (i = consumer_sequence_.begin(); i != consumer_sequence_.end(); ++i) {
    const GesturePoint* points = i->second->points();
    for (int j = 0; j < GestureSequence::kMaxGesturePoints; ++j) {
      if (!points[j].in_use())
        continue;
      gfx::Point delta =
          points[j].last_touch_position().Subtract(location);
      int distance = delta.x() * delta.x() + delta.y() * delta.y();
      if (!closest_point || distance < closest_distance_squared) {
        closest_point = &points[j];
        closest_distance_squared = distance;
      }
    }
  }

  const int max_distance =
      GestureConfiguration::max_separation_for_gesture_touches_in_pixels();

  if (closest_distance_squared < max_distance * max_distance && closest_point)
    return touch_id_target_[closest_point->touch_id()];
  else
    return NULL;
}

void GestureRecognizerImpl::TransferEventsTo(GestureConsumer* current_consumer,
                                             GestureConsumer* new_consumer) {
  // Send cancel to all those save |new_consumer| and |current_consumer|.
  // Don't send a cancel to |current_consumer|, unless |new_consumer| is NULL.
  for (TouchIdToConsumerMap::iterator i = touch_id_target_.begin();
       i != touch_id_target_.end(); ++i) {
    if (i->second != new_consumer &&
        (i->second != current_consumer || new_consumer == NULL) &&
        i->second != gesture_consumer_ignorer_.get()) {
      scoped_ptr<TouchEvent> touch_event(helper_->CreateTouchEvent(
            ui::ET_TOUCH_CANCELLED, gfx::Point(0, 0),
            i->first,
            base::Time::NowFromSystemTime() - base::Time()));
      helper_->DispatchCancelTouchEvent(touch_event.get());
      i->second = gesture_consumer_ignorer_.get();
    }
  }

  // Transer events from |current_consumer| to |new_consumer|.
  if (current_consumer && new_consumer) {
    TransferTouchIdToConsumerMap(current_consumer, new_consumer,
                                 &touch_id_target_);
    TransferTouchIdToConsumerMap(current_consumer, new_consumer,
                                 &touch_id_target_for_gestures_);
    TransferConsumer(current_consumer, new_consumer, &event_queue_);
    TransferConsumer(current_consumer, new_consumer, &consumer_sequence_);
  }
}

bool GestureRecognizerImpl::GetLastTouchPointForTarget(
    GestureConsumer* consumer,
    gfx::Point* point) {
  if (consumer_sequence_.count(consumer) == 0)
    return false;

  *point = consumer_sequence_[consumer]->last_touch_location();
  return true;
}

////////////////////////////////////////////////////////////////////////////////
// GestureRecognizerImpl, protected:

GestureSequence* GestureRecognizerImpl::CreateSequence(
    GestureEventHelper* helper) {
  return new GestureSequence(helper);
}

////////////////////////////////////////////////////////////////////////////////
// GestureRecognizerImpl, private:

GestureSequence* GestureRecognizerImpl::GetGestureSequenceForConsumer(
    GestureConsumer* consumer) {
  GestureSequence* gesture_sequence = consumer_sequence_[consumer];
  if (!gesture_sequence) {
    gesture_sequence = CreateSequence(helper_);
    consumer_sequence_[consumer] = gesture_sequence;
  }
  return gesture_sequence;
}

GestureSequence::Gestures* GestureRecognizerImpl::ProcessTouchEventForGesture(
    const TouchEvent& event,
    ui::TouchStatus status,
    GestureConsumer* target) {
  if (event.GetEventType() == ui::ET_TOUCH_RELEASED ||
      event.GetEventType() == ui::ET_TOUCH_CANCELLED) {
    touch_id_target_[event.GetTouchId()] = NULL;
  } else {
    touch_id_target_[event.GetTouchId()] = target;
    if (target)
      touch_id_target_for_gestures_[event.GetTouchId()] = target;
  }

  GestureSequence* gesture_sequence = GetGestureSequenceForConsumer(target);
  return gesture_sequence->ProcessTouchEventForGesture(event, status);
}

void GestureRecognizerImpl::QueueTouchEventForGesture(GestureConsumer* consumer,
                                                      const TouchEvent& event) {
  if (!event_queue_[consumer])
    event_queue_[consumer] = new std::queue<TouchEvent*>();
  event_queue_[consumer]->push(new MirroredTouchEvent(&event));
}

GestureSequence::Gestures* GestureRecognizerImpl::AdvanceTouchQueue(
    GestureConsumer* consumer,
    bool processed) {
  if (!event_queue_[consumer] || event_queue_[consumer]->empty()) {
    LOG(ERROR) << "Trying to advance an empty gesture queue for " << consumer;
    return NULL;
  }

  ScopedPop pop(event_queue_[consumer]);
  TouchEvent* event = event_queue_[consumer]->front();

  GestureSequence* sequence = GetGestureSequenceForConsumer(consumer);

  if (processed && event->GetEventType() == ui::ET_TOUCH_RELEASED) {
    // A touch release was was processed (e.g. preventDefault()ed by a
    // web-page), but we still need to process a touch cancel.
    CancelledTouchEvent cancelled(event);
    return sequence->ProcessTouchEventForGesture(cancelled,
                                                 ui::TOUCH_STATUS_UNKNOWN);
  }

  return sequence->ProcessTouchEventForGesture(
      *event,
      processed ? ui::TOUCH_STATUS_CONTINUE : ui::TOUCH_STATUS_UNKNOWN);
}

void GestureRecognizerImpl::FlushTouchQueue(GestureConsumer* consumer) {
  if (consumer_sequence_.count(consumer)) {
    delete consumer_sequence_[consumer];
    consumer_sequence_.erase(consumer);
  }

  if (event_queue_.count(consumer)) {
    delete event_queue_[consumer];
    event_queue_.erase(consumer);
  }

  RemoveConsumerFromMap(consumer, &touch_id_target_);
  RemoveConsumerFromMap(consumer, &touch_id_target_for_gestures_);
}

// GestureRecognizer, static
GestureRecognizer* GestureRecognizer::Create(GestureEventHelper* helper) {
  return new GestureRecognizerImpl(helper);
}

}  // namespace ui

redpajama_set_name: RedPajamaGithub


text:
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Linq;
using System.Collections.Generic;
using RSUnityToolkit;

[CustomPropertyDrawer(typeof(RotationMax2D))]
public class RotationMax2DDrawer : PropertyDrawer {

	 public override void OnGUI (Rect position,
                                SerializedProperty property,
                                GUIContent label)
	{
		EditorGUIUtility.LookLikeControls();

		EditorGUI.BeginProperty (position, label, property);

		position.x+=4;
		// Draw label
		EditorGUI.PrefixLabel( position, GUIUtility.GetControlID (FocusType.Passive), label);

		Rect rect = new Rect(position);
		rect.y+=2;
		rect.width = 50;
		rect.height = 15;

		SerializedProperty int1 = property.FindPropertyRelative("MaxNeg");
		SerializedProperty int2 = property.FindPropertyRelative("MaxPos");

		rect.x+=80;
		rect.width = 70;
		EditorGUI.LabelField(rect,new GUIContent("Max Neg"));

		rect.x+=65;
		rect.width = 50;
		int1.intValue = EditorGUI.IntField(rect, int1.intValue);

		rect.x+=60;
		rect.width = 65;
		EditorGUI.LabelField(rect,new GUIContent("Max Pos"));

		rect.x+=60;
		rect.width = 50;
		int2.intValue = EditorGUI.IntField(rect, int2.intValue);

		EditorGUI.EndProperty ();

	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Urnula megalocrater Malençon & Le Gal

### Remarks
null


text:
import {Rule, SchematicsException, Tree} from '@angular-devkit/schematics';
import {dirname, relative} from 'path';
import * as ts from 'typescript';

import {getProjectTsConfigPaths} from '../../utils/project_tsconfig_paths';
import {parseTsconfigFile} from '../../utils/typescript/parse_tsconfig';
import {COMMON_IMPORT, DOCUMENT_TOKEN_NAME, DocumentImportVisitor, ResolvedDocumentImport} from './document_import_visitor';
import {addToImport, createImport, removeFromImport} from './move-import';

/** Entry point for the V8 move-document migration. */
export default function(): Rule {
  return (tree: Tree) => {
    const {buildPaths, testPaths} = getProjectTsConfigPaths(tree);
    const basePath = process.cwd();

    if (!buildPaths.length && !testPaths.length) {
      throw new SchematicsException(`Could not find any tsconfig file. Cannot migrate DOCUMENT
          to new import source.`);
    }

    for (const tsconfigPath of [...buildPaths, ...testPaths]) {
      runMoveDocumentMigration(tree, tsconfigPath, basePath);
    }
  };
}

/**
 * Runs the DOCUMENT InjectionToken import migration for the given TypeScript project. The
 * schematic analyzes the imports within the project and moves the deprecated symbol to the
 * new import source.
 */
function runMoveDocumentMigration(tree: Tree, tsconfigPath: string, basePath: string) {
  const parsed = parseTsconfigFile(tsconfigPath, dirname(tsconfigPath));
  const host = ts.createCompilerHost(parsed.options, true);

  // We need to overwrite the host "readFile" method, as we want the TypeScript
  // program to be based on the file contents in the virtual file tree. Otherwise
  // if we run the migration for multiple tsconfig files which have intersecting
  // source files, it can end up updating query definitions multiple times.
  host.readFile = fileName => {
    const buffer = tree.read(relative(basePath, fileName));
    return buffer ? buffer.toString() : undefined;
  };

  const program = ts.createProgram(parsed.fileNames, parsed.options, host);
  const typeChecker = program.getTypeChecker();
  const visitor = new DocumentImportVisitor(typeChecker);
  const sourceFiles = program.getSourceFiles().filter(
      f => !f.isDeclarationFile && !program.isSourceFileFromExternalLibrary(f));

  // Analyze source files by finding imports.
  sourceFiles.forEach(sourceFile => visitor.visitNode(sourceFile));

  const {importsMap} = visitor;

  // Walk through all source files that contain resolved queries and update
  // the source files if needed. Note that we need to update multiple queries
  // within a source file within the same recorder in order to not throw off
  // the TypeScript node offsets.
  importsMap.forEach((resolvedImport: ResolvedDocumentImport, sourceFile: ts.SourceFile) => {
    const {platformBrowserImport, commonImport, documentElement} = resolvedImport;
    if (!documentElement || !platformBrowserImport) {
      return;
    }
    const update = tree.beginUpdate(relative(basePath, sourceFile.fileName));

    const platformBrowserDeclaration = platformBrowserImport.parent.parent;
    const newPlatformBrowserText =
        removeFromImport(platformBrowserImport, sourceFile, DOCUMENT_TOKEN_NAME);
    const newCommonText = commonImport ?
        addToImport(commonImport, sourceFile, documentElement.name, documentElement.propertyName) :
        createImport(COMMON_IMPORT, sourceFile, documentElement.name, documentElement.propertyName);

    // Replace the existing query decorator call expression with the updated
    // call expression node.
    update.remove(platformBrowserDeclaration.getStart(), platformBrowserDeclaration.getWidth());
    update.insertRight(platformBrowserDeclaration.getStart(), newPlatformBrowserText);

    if (commonImport) {
      const commonDeclaration = commonImport.parent.parent;
      update.remove(commonDeclaration.getStart(), commonDeclaration.getWidth());
      update.insertRight(commonDeclaration.getStart(), newCommonText);
    } else {
      update.insertRight(platformBrowserDeclaration.getStart(), newCommonText);
    }

    tree.commitUpdate(update);
  });
}


text:
package org.chromium.payments.mojom;

import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.mojo.bindings.DeserializationException;

public final class BasicCardNetwork {

    public static final int AMEX = 0;

    public static final int DINERS = AMEX + 1;

    public static final int DISCOVER = DINERS + 1;

    public static final int JCB = DISCOVER + 1;

    public static final int MASTERCARD = JCB + 1;

    public static final int MIR = MASTERCARD + 1;

    public static final int UNIONPAY = MIR + 1;

    public static final int VISA = UNIONPAY + 1;

    private static final boolean IS_EXTENSIBLE = false;

    public static boolean isKnownValue(int value) {
        switch (value) {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                return true;
        }
        return false;
    }

    public static void validate(int value) {
        if (IS_EXTENSIBLE || isKnownValue(value))
            return;

        throw new DeserializationException("Invalid enum value.");
    }

    private BasicCardNetwork() {}

}


text:
package org.camelcookbook.transformation.simple;

import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SimpleSpringTest extends CamelSpringTestSupport {

    @Override
    protected AbstractApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("META-INF/spring/simple-context.xml");
    }

    @Test
    public void testSimple() throws Exception {
        String response = template.requestBody("direct:start", "Camel Rocks", String.class);

        assertEquals("Hello Camel Rocks", response);
    }
}


text:
/*
 * libnetlink.hh
 * =============
 * Sources adapted for C++ linkage from libnetlink.h, available through iproute-20100519.
 * CODE AS-IS. Any licensing applied to iproute-20100519 also applies here.
 *
 *  Created on: Feb 14, 2011
 *      Author: bill <carlos.nilton@gmail.com>
 */

#ifndef LIBNETLINK_HH_
#define LIBNETLINK_HH_

#include <asm/types.h>
#include <linux/if_link.h>
#include <linux/if_addr.h>
#include <linux/neighbour.h>
#include <linux/rtnetlink.h>
#include <linux/netlink.h>

struct rtnl_handle {
	int fd;
	struct sockaddr_nl local;
	struct sockaddr_nl peer;
	__u32 seq;
	__u32 dump;
};

extern "C" int rcvbuf;

extern "C" int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
extern "C" int rtnl_open_byproto(struct rtnl_handle *rth,
		unsigned subscriptions, int protocol);
extern "C" void rtnl_close(struct rtnl_handle *rth);
extern "C" int
		rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type);
extern "C" int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
		int len);

typedef int (*rtnl_filter_t)(const struct sockaddr_nl *, struct nlmsghdr *n,
		void *);

struct rtnl_dump_filter_arg {
	rtnl_filter_t filter;
	void *arg1;
	rtnl_filter_t junk;
	void *arg2;
};

extern "C" int rtnl_dump_filter_l(struct rtnl_handle *rth,
		const struct rtnl_dump_filter_arg *arg);
extern "C" int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter,
		void *arg1, rtnl_filter_t junk, void *arg2);

extern "C" int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
		pid_t peer, unsigned groups, struct nlmsghdr *answer,
		rtnl_filter_t junk, void *jarg);
extern "C" int rtnl_send(struct rtnl_handle *rth, const char *buf, int);
extern "C" int rtnl_send_check(struct rtnl_handle *rth, const char *buf, int);

extern "C" int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
extern "C" int addattr_l(struct nlmsghdr *n, int maxlen, int type,
		const void *data, int alen);
extern "C" int addraw_l(struct nlmsghdr *n, int maxlen, const void *data,
		int len);
extern "C" struct rtattr
		*addattr_nest(struct nlmsghdr *n, int maxlen, int type);
extern "C" int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
extern "C" struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen,
		int type, const void *data, int len);
extern "C" int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest);
extern "C" int rta_addattr32(struct rtattr *rta, int maxlen, int type,
		__u32 data);
extern "C" int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
		const void *data, int alen);

extern "C" int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta,
		int len);
extern "C" int parse_rtattr_byindex(struct rtattr *tb[], int max,
		struct rtattr *rta, int len);
extern "C" int __parse_rtattr_nested_compat(struct rtattr *tb[], int max,
		struct rtattr *rta, int len);

#define parse_rtattr_nested(tb, max, rta) \
	(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))

#define parse_rtattr_nested_compat(tb, max, rta, data, len) \
({	data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
	__parse_rtattr_nested_compat(tb, max, rta, len); })

extern "C" int rtnl_listen(struct rtnl_handle *, rtnl_filter_t handler,
		void *jarg);
extern "C" int rtnl_from_file(FILE *, rtnl_filter_t handler, void *jarg);

#define NLMSG_TAIL(nmsg) \
	((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))

#ifndef IFA_RTA
#define IFA_RTA(r) \
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
#endif
#ifndef IFA_PAYLOAD
#define IFA_PAYLOAD(n)	NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
#endif

#ifndef IFLA_RTA
#define IFLA_RTA(r) \
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
#endif
#ifndef IFLA_PAYLOAD
#define IFLA_PAYLOAD(n)	NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
#endif

#ifndef NDA_RTA
#define NDA_RTA(r) \
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
#endif
#ifndef NDA_PAYLOAD
#define NDA_PAYLOAD(n)	NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
#endif

#ifndef NDTA_RTA
#define NDTA_RTA(r) \
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndtmsg))))
#endif
#ifndef NDTA_PAYLOAD
#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
#endif

#endif /* LIBNETLINK_HH_ */


text:
<?php

namespace Cloudtek\DynamoDM\Mapping\Annotation;

use Doctrine\Common\Annotations\Annotation;

/**
 * Marks a method as a preUpdate lifecycle callback.
 *
 * @Annotation
 */
final class PreUpdate extends Annotation
{
}


text:
<?php

namespace Furniture\PostBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Furniture\UserBundle\Entity\User;
use Furniture\FactoryBundle\Entity\Factory;
use Sylius\Component\Translation\Model\AbstractTranslatable;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * @ORM\Entity
 * @UniqueEntity("slug")
 */
class Post extends AbstractTranslatable
{
    const TYPE_NEWS     = 1;
    const TYPE_CIRCULAR = 2;

    /**
     * @var int
     */
    private $id;

    /**
     * @var \Doctrine\Common\Collections\Collection|PostTranslation[]
     *
     * @Assert\Valid
     */
    protected $translations;

    /**
     * The name for display on administer pages
     *
     * @var string
     *
     * @Assert\NotBlank()
     */
    private $displayName;

    /**
     * @var string
     * @ORM\Column(name="slug", type="string", length=255, unique=true)
     */
    private $slug;

    /**
     * @var int
     */
    private $type = self::TYPE_NEWS;

    /**
     * @var Factory
     */
    private $factory;

    /**
     * @var User
     */
    private $creator;

    /**
     * @var \DateTime
     */
    private $createdAt;

    /**
     * @var \DateTime
     */
    private $updatedAt;

    /**
     * @var \DateTime
     */
    private $publishedAt;

    /**
     * @var Collection|PostImage[]
     */
    private $images;

    /**
     * @var Collection|PostFile[]
     */
    private $files;

    /**
     * @var boolean
     */
    private $useOnSlider = false;

    /**
     * Construct
     */
    public function __construct()
    {
        parent::__construct();

        $this->images = new ArrayCollection();
        $this->files = new ArrayCollection();
        $this->createdAt = new \DateTime();
        $this->updatedAt = new \DateTime();
        $this->publishedAt = new \DateTime();
    }

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set display name
     *
     * @param string $name
     *
     * @return Post
     */
    public function setDisplayName($name)
    {
        $this->displayName = $name;

        return $this;
    }

    /**
     * Get display name
     *
     * @return string
     */
    public function getDisplayName()
    {
        return $this->displayName;
    }

    /**
     * Set slug
     *
     * @param string $slug
     *
     * @return Post
     */
    public function setSlug($slug)
    {
        $this->slug = $slug;

        return $this;
    }

    /**
     * Get slug
     *
     * @return string
     */
    public function getSlug()
    {
        return $this->slug;
    }

    /**
     * Set type
     *
     * @param int $type
     *
     * @return Post
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

    /**
     * Get type
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Set creator
     *
     * @param User $creator
     *
     * @return Post
     */
    public function setCreator(User $creator)
    {
        $this->creator = $creator;

        return $this;
    }

    /**
     * Get creator
     *
     * @return User
     */
    public function getCreator()
    {
        return $this->creator;
    }

    /**
     * Set factory
     *
     * @param Factory $factory
     *
     * @return Post
     */
    public function setFactory(Factory $factory = null)
    {
        $this->factory = $factory;

        return $this;
    }

    /**
     * Get factory
     *
     * @return Factory
     */
    public function getFactory()
    {
        return $this->factory;
    }

    /**
     * Get created at
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Get updated at
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Set published at
     *
     * @param \DateTime $publishedAt
     *
     * @return Post
     */
    public function setPublishedAt(\DateTime $publishedAt)
    {
        $this->publishedAt = $publishedAt;

        return $this;
    }

    /**
     * Get published at
     *
     * @return \DateTime
     */
    public function getPublishedAt()
    {
        return $this->publishedAt;
    }

    /**
     * Set images
     *
     * @param Collection|PostImage[] $images
     *
     * @return Post
     */
    public function setImages(Collection $images)
    {
        $this->images = $images;

        return $this;
    }

    /**
     * Get images
     *
     * @return Collection|PostImage[]
     */
    public function getImages()
    {
        return $this->images;
    }

    /**
     * Has image
     *
     * @param PostImage $image
     *
     * @return bool
     */
    public function hasImage(PostImage $image)
    {
        return $this->images->contains($image);
    }

    /**
     * Add image
     *
     * @param PostImage $image
     *
     * @return Factory
     */
    public function addImage(PostImage $image)
    {
        if(!$this->hasImage($image)){
            $image->setPost($this);
            $this->images->add($image);
        }

        return $this;
    }

    /**
     * Remove image
     *
     * @param PostImage $image
     *
     * @return Factory
     */
    public function removeImage(PostImage $image)
    {
        if($this->hasImage($image)){
            $this->images->removeElement($image);
        }

        return $this;
    }

    /**
     * Set files
     *
     * @param Collection|PostFile[] $files
     *
     * @return Post
     */
    public function setFiles(Collection $files)
    {
        $this->files = $files;

        return $this;
    }

    /**
     * Get files
     *
     * @return Collection|PostFile[]
     */
    public function getFiles()
    {
        return $this->files;
    }

    /**
     * Has file?
     *
     * @param PostFile $file
     *
     * @return bool
     */
    public function hasFile(PostFile $file)
    {
        return $this->files->contains($file);
    }

    /**
     * Add file
     *
     * @param PostFile $file
     *
     * @return Post
     */
    public function addFile(PostFile $file)
    {
        if (!$this->hasFile($file)) {
            $file->setPost($this);
            $this->files->add($file);
        }

        return $this;
    }

    /**
     * Remove file
     *
     * @param PostFile $file
     *
     * @return Post
     */
    public function removeFile(PostFile $file)
    {
        if ($this->hasFile($file)) {
            $this->files->removeElement($file);
        }

        return $this;
    }

    /**
     * @return boolean
     */
    public function isUseOnSlider()
    {
        return $this->useOnSlider;
    }

    /**
     * @param boolean $useOnSlider
     * @return Post
     */
    public function setUseOnSlider($useOnSlider)
    {
        $this->useOnSlider = $useOnSlider;

        return $this;
    }

    /**
     * Is news?
     *
     * @return bool
     */
    public function isNews()
    {
        return $this->type == self::TYPE_NEWS;
    }

    /**
     * Is circular?
     *
     * @return bool
     */
    public function isCircular()
    {
        return $this->type == self::TYPE_CIRCULAR;
    }

    /**
     * On update
     */
    public function onUpdate()
    {
        $this->updatedAt = new \DateTime();
    }
}


text:
"""Utilities
=============

Module for extracting cython headers from the fly capture c headers.
For example::

    header = r'E:\Point Grey Research\FlyCapture2\include\FlyCapture2_C'
    content = parse_header('{}.h'.format(header))
    dump_cython(content, '{}.h'.format(header), '{}.pxi'.format(header))
"""

from re import compile, match, sub, split
import traceback
import re
from functools import partial
from collections import namedtuple

__all__ = (
    'VariableSpec', 'FunctionSpec', 'StructSpec', 'EnumSpec', 'EnumMemberSpec',
    'TypeDef', 'strip_comments', 'parse_prototype', 'parse_struct',
    'parse_enum', 'parse_header', 'format_typedef', 'format_enum',
    'format_variable', 'format_function', 'format_struct', 'dump_cython')

tab = '    '
sp_pat = compile(' +')
func_pat = compile('FLYCAPTURE2_C_API +([\\w ]+?)(\\**) *(\\w+) *\\((.*?)\\);')
func_pat_short = compile('(FLYCAPTURE2_C_API.+?\\(.+?\\);)', re.DOTALL)
arg_split_pat = compile(' *, *')
variable_pat = compile(
    '^([\\w]+(?: +[\\w]+)?(?: *\\*+ *)?(?: +[\\w]+)?)((?: *\\*+ *)| +)([\\w]+)'
    '(?: *\\[([ \\w]+)\\] *)?;?$'
)
struct_pat = compile(
    'typedef +(struct|enum) +([\\w]+)[ \n]*\\{([\\w ,=\n;\\-\\*\\[\\]]+)\\}'
    '[ \n]*([\\w ,]+) *;', re.DOTALL
)
typedef_pat = compile('typedef +(.+?);')

VariableSpec = namedtuple('VariableSpec', ['type', 'pointer', 'name', 'count'])
'''Represents a variable declaration in e.g. the definition of a function
or its return value.
'''

FunctionSpec = namedtuple('FunctionSpec',
                          ['dec', 'type', 'pointer', 'name', 'args'])
'''Represents a c function prototype.
'''

StructSpec = namedtuple('StructSpec', ['tp_name', 'names', 'members'])
'''Represents a c struct definition.
'''

EnumSpec = namedtuple('EnumSpec', ['tp_name', 'names', 'values'])
'''Represents a c enum definition.
'''

EnumMemberSpec = namedtuple('EnumMemberSpec', ['name', 'value'])
'''Represents a c enum member.
'''

TypeDef = namedtuple('TypeDef', ['body'])
'''Represents a c typedef.
'''

def strip_comments(code):
    '''Returns the headers with comments removed.
    '''
    single_comment = compile('//.*')  # single line comment
    multi_comment = compile('/\\*\\*.*?\\*/', re.DOTALL)  # multiline comment
    code = sub(single_comment, '', code)
    code = sub(multi_comment, '', code)
    return '\n'.join([c for c in code.splitlines() if c.strip()])

def parse_prototype(prototype):
    '''Returns a :attr:`FunctionSpec` instance from the input.
    '''
    val = ' '.join(prototype.splitlines())
    f = match(func_pat, val)  # match the whole function
    if f is None:
        raise Exception('Cannot parse function prototype "{}"'.format(val))
    ftp, pointer, name, arg = [v.strip() for v in f.groups()]

    args = []
    if arg.strip():  # split each arg into type, zero or more *, and name
        for item in split(arg_split_pat, arg):
            m = match(variable_pat, item.strip())
            if m is None:
                raise Exception('Cannot parse function prototype "{}"'.format(val))

            tp, star, nm, count = [v.strip() if v else '' for v in m.groups()]
            args.append(VariableSpec(tp, star, nm, count))

    return FunctionSpec('FLYCAPTURE2_C_API', ftp, pointer, name, args)

def parse_struct(type_name, body, name):
    '''Returns a :attr:`StructSpec` instance from the input.
    '''
    type_name, name = type_name.strip(), name.strip()
    lines = [l.strip() for l in body.splitlines() if l.strip()]
    members = []

    for line in lines:
        m = match(variable_pat, line)
        if m is None:
            raise Exception('Cannot parse "{}" for "{}"'.format(line, name))

        tp, star, nm, count = [v.strip() if v else '' for v in m.groups()]
        members.append(VariableSpec(tp, star, nm, count))
    return StructSpec(type_name, [n.strip() for n in name.split(',')], members)

def parse_enum(type_name, body, name):
    '''Returns a :attr:`EnumSpec` instance from the input.
    '''
    type_name, name = type_name.strip(), name.strip()
    lines = [l.strip(' ,') for l in body.splitlines() if l.strip(', ')]
    members = []

    for line in lines:
        vals = [v.strip() for v in line.split('=')]
        if len(vals) == 1:
            members.append(EnumMemberSpec(vals[0], ''))
        else:
            members.append(EnumMemberSpec(*vals))

    return EnumSpec(type_name, [n.strip() for n in name.split(',')], members)

def parse_header(filename):
    '''Returns a list of :attr:`VariableSpec`, :attr:`FunctionSpec`,
    :attr:`StructSpec`, :attr:`EnumSpec`, :attr:`EnumMemberSpec`, and
    :attr:`TypeDef` instances representing the c header file.
    '''
    with open(filename, 'rb') as fh:
        content = '\n'.join(fh.read().splitlines())

    content = sub('\t', ' ', content)
    content = strip_comments(content)

    # first get the functions
    content = split(func_pat_short, content)

    for i, s in enumerate(content):
        if i % 2 and content[i].strip():  # matched a prototype
            try:
                content[i] = parse_prototype(content[i])
            except Exception as e:
                traceback.print_exc()

    # now process structs
    res = []
    for i, item in enumerate(content):
        if not isinstance(item, str):  # if it's already a func etc. skip it
            res.append(item)
            continue

        items = split(struct_pat, item)
        j = 0
        while j < len(items):
            if not j % 5:
                res.append(items[j])
                j += 1
            else:
                if items[j].strip() == 'enum':
                    res.append(parse_enum(*items[j + 1: j + 4]))
                else:
                    res.append(parse_struct(*items[j + 1: j + 4]))
                j += 4

    # now do remaining simple typedefs
    content = res
    res = []
    for i, item in enumerate(content):
        if not isinstance(item, str):  # if it's already processed skip it
            res.append(item)
            continue

        items = split(typedef_pat, item)
        for j, item in enumerate(items):
            res.append(TypeDef(item.strip()) if j % 2 else item)

    content = [c for c in res if not isinstance(c, str) or c.strip()]
    return content

def format_typedef(typedef):
    '''Generates a cython typedef from a :attr:`TypeDef` instance.
    '''
    return ['ctypedef {}'.format(typedef.body)]

def format_enum(enum_def):
    '''Returns a cython enum from a :attr:`EnumSpec` instance.
    '''
    text = []
    text.append('cdef enum {}:'.format(enum_def.tp_name))
    for member in enum_def.values:
        if member.value:
            text.append('{}{} = {}'.format(tab, *member))
        else:
            text.append('{}{}'.format(tab, member.name))

    for name in enum_def.names:
        text.append('ctypedef {} {}'.format(enum_def.tp_name, name))

    return text

def format_variable(variable):
    '''Returns a cython variable from a :attr:`VariableSpec` instance.
    '''
    if variable.count:
        return '{}{} {}[{}]'.format(*variable)
    return '{} {}{}'.format(*variable[:-1])

def format_function(function):
    '''Returns a cython function from a :attr:`FunctionSpec` instance.
    '''
    args = [format_variable(arg) for arg in function.args]
    return ['{}{} {}({})'.format(
        function.type, function.pointer, function.name, ', '.join(args))]

def format_struct(struct_def):
    '''Returns a cython struct from a :attr:`StructSpec` instance.
    '''
    text = []
    text.append('cdef struct {}:'.format(struct_def.tp_name))
    text.extend(
        ['{}{}'.format(tab, format_variable(var))
         for var in struct_def.members]
    )

    for name in struct_def.names:
        text.append('ctypedef {} {}'.format(struct_def.tp_name, name))

    return text

def dump_cython(content, name, ofile):
    '''Generates a cython pxi file from the output of :func:`parse_header`.
    '''
    with open(ofile, 'wb') as fh:
        fh.write('cdef extern from "{}":\n'.format(name))
        for item in content:
            if isinstance(item, FunctionSpec):
                code = format_function(item)
            elif isinstance(item, StructSpec):
                code = format_struct(item)
            elif isinstance(item, EnumSpec):
                code = format_enum(item)
            elif isinstance(item, TypeDef):
                code = format_typedef(item)
            else:
                fh.write('>>>>>>>>\n{}\n<<<<<<<<'.format(item))
                code = []

            fh.write('{}\n\n'.format('\n'.join(['{}{}'.format(tab, c)
                                                for c in code])))

if __name__ == '__main__':
    from os.path import join
    include = r'E:\Point Grey Research\FlyCapture2\include'

    for name in ('FlyCapture2Defs_C', 'FlyCapture2_C', 'FlyCapture2GUI_C'):
        content = parse_header(join(include, 'C', '{}.h'.format(name)))
        dump_cython(content, '{}.h'.format(name), '{}.pxi'.format(name))

        print('{} done!'.format(name))


text:
Generating X12
==============

Stupidedi has a simple interface for generating X12 documents. Once you have
defined a transaction set or implementation guide (see {file:Defining.md Defining}),
you can generate well-formed documents using [`BuilderDsl`][1].

  [1]: Stupidedi/Builder/BuilderDsl.html

Configuration
-------------

Minimal configuration is needed so Stupidedi can load the correct definitions
and ensure well-formedness. The configuration below links interchange version
00501 to an instance of [`InterchangeDef`][2], the functional group version
005010 to an instance of [`FunctionalGroupDef`][3] and links the transaction set
(identified by three elements) to an instance of [`TransactionSetDef`][4].

  [2]: Stupidedi/Envelope/InterchangeDef.html
  [3]: Stupidedi/Envelope/FunctionalGroupDef.html
  [4]: Stupidedi/Envelope/TransactionSetDef.html

    config = Stupidedi::Config.new

    # Link the "00501" value in ISA12 element to the 5010 interchange definition
    config.interchange.register("00501") do
      Stupidedi::Versions::Interchanges::FiveOhOne::InterchangeDef
    end

    # Link the "005010" value in GS08 to the 5010 functional group definition
    config.functional_group.register("005010") do
      Stupidedi::Versions::FunctionalGroups::FiftyTen::FunctionalGroupDef
    end

    # Link "005010X222" in GS08 or ST03, "HC" in GS01, and "837"
    # in ST01 to the implementation guide definition
    config.transaction_set.register("005010X222", "HC", "837") do
      Stupidedi::Guides::FiftyTen::X222::HC837P
    end

    # Instantiate a new BuilderDsl
    b = Stupidedi::Builder::BuilderDsl.build(config)

[`InterchangeDef`][2] specifies which segments can occur directly in the
interchange envelope (e.g. `ISA` and `ISE`), the order in which they can occur,
and the definition of those segments.

[`FunctionalGroupDef`][3] specifies which segments can occur directly in the
functional group envelope (e.g. `GS` and `GE`), the order in which they occur,
and the definition of _every_ segment that can occur _inside_ the envelope.

[`TransactionSetDef`][4] specifies the structure of an X12 message, including
groupings of segments (e.g. tables and loops), and the order in which segments
and groups of segments may occur. The definition of each segment is given by the
parent [`FunctionalGroupDef`][3].

Generating a Segment
--------------------

The [`BuilderDsl`][1] API uses `method_missing` to dynamically respond to method
calls. If the method name matches the format of a segment identifier, a segment
is constructed and added to the parse tree. The arguments to the method call
should be the elements of the segment.

    b.ISA("00", "",             # authorization information
          "00", "",             # authentication information
          "ZZ", "SUBMITTER ID", # submitter identification
          "ZZ", "RECEIVER ID",  # recipient identification
          Time.now.utc,         # date
          Time.now.utc,         # time
          "^",                  # repetition separator
          "00501",              # interchange version
          "333666999",          # control number
          "1",                  # acknowledgement request
          "T",                  # usage indicator
          ":")                  # component separator

> _Note_: The repetition separator "ˆ" and component separator ":" have no
> special meaning when generating X12. These elements are only meaningful to
> Stupidedi when parsing X12 from an input stream (see
> [Parsing X12](Parsing.html)).

Alternatively, the [`#segment!`][5] method can be used to avoid the method
lookup overhead incurred by `method_missing`.

  [5]: Stupidedi/Builder/BuilderDsl.html#segment!-instance_method

### Simple Elements

Simple elements of _any_ type can be constructed from Strings (this is how X12
is parsed from a file), but certain element types can be constructed from other
types of Ruby values.

The description of each element type below pertains to the `FiftyTen` functional
group definition. The [`SimpleElementDef`][7] and [`SimpleElementVal`][8] classes
define the minimal interfaces that are extended by subclasses like `AN` and
`StringVal`. See the [`FiftyTen::ElementTypes`][6] namespace for more examples.

  [6]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes.html
  [7]: Stupidedi/Schema/SimpleElementDef.html
  [8]: Stupidedi/Values/SimpleElementVal.html

#### Strings

String elements (declared with type `AN`) can be constructed from any value that
responds to `#to_s`. The constructed element is a [`StringVal`][9].

  [9]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes/StringVal.html

#### Identifiers

Identifier elements (declared with type `ID`) can be constructed from any value
that responds to `#to_s`. The constructed element is an [`IdentifierVal`][10].

  [10]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes/IdentifierVal.html

#### Dates

Date elements (declared with type `DT`) can be constructed from a `String` of
either six or eight characters, and from any value that responds to `#year`,
`#month`, and `#day`. This includes the `Date`, `Time`, and `DateTime` classes
included with the standard Ruby libraries. The constructed element is a
[`DateVal`][11].

  [11]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes/DateVal.html

#### Times

Time elements (declared with type `TM`) can be constructed from a `String` of
either two, four, six, or more than six characters, and from the `Time` and
`DateTime` value types. The constructed element is a [`TimeVal`][12].

  [12]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes/TimeVal.html

#### Numbers

Numeric and decimal elements (declared with type `Nn` and `R`, respectively) can
be constructed from any value that responds to `#to_d`. The constructed element
is a [`FixnumVal`][13] or [`FloatVal`][14].

  [13]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes/FixnumVal.html
  [14]: Stupidedi/Versions/FunctionalGroups/FiftyTen/ElementTypes/FloatVal.html

### Composite Elements

Composite elements are constructed with the [`#composite`][24] method. The
constructed element is a [`CompositeElementVal`][15]. Arguments to the method
call should be the component elements. For instance, to generate an `HI` segment
with three composite elements:

    b.HI(b.composite("ABK", "7868"),
         b.composite("ABF", "052"),
         b.composite("ABF", "E9283"))

  [15]: Stupidedi/Values/CompositeElementVal.html

### Repeated Elements

Repeated elements are constructed using the [`#repeated`][25] method. The
constructed element is a [`RepeatedElementVal`][16]. The arguments to the method
call should be either all simple elements or all composite elements, according
to the element definition.

    b.AK9(b.repeated("R", "X", "E"), 1, 1, 0)

    b.IK4(b.repeated(
            b.composite(3, 1),
            b.composite(4)),
          1068, 7, "B")

  [16]: Stupidedi/Values/RepeatedElementVal.html

Element Placeholders
--------------------

Because [`BuilderDsl`][1] builds a parse tree as segments are generated, it can
infer and validate certain information about the elements in a segment.

### Blank Elements

Blank elements (simple, composite, and repeated) can be generated from a `nil`
argument, but you can improve readability by using [`#blank`][26], and
no-argument calls to [`#composite`][24] and [`#repeated`][25]. These are
arguably more self-documenting.

    b.AK9(nil, 1, 1, 0)
    b.AK9(b.repeated, 1, 1, 0)

    b.HI(nil, b.composite(b.blank, "052"))
    b.HI(b.composite, b.composite(b.blank, "052"))

Also, if fewer than the defined number of elements are given as arguments, the
missing arguments generate blank elements. For example, the following statements
both generate the same segment.

    b.ST("835", "1234")
    b.ST("835", "1234", b.blank)

### Default Elements

Certain elements are declared with a single value in [`#allowed_values`][18].
These are usually qualifier elements, like `NM103`, whose value adds little
readability. These values can be inferred by [`BuilderDsl`][1] when the
[`#default`][27] placeholder is used. For example, when generating the X222 837P
the following statements generate the same segment.

    b.BHT("0019", "00", control_number, Time.now.utc, Time.now.utc, "CH")

    b.BHT(b.default, "00", control_number, Time.now.utc, Time.now.utc, "CH")

When a default value cannot be inferred, a [`ParseError`][17] is thrown. Note
that repeated and composite elements can only be generated by [`#default`][27],
when they are declared `NOT USED`.

  [17]: Stupidedi/Exceptions/ParseError.html
  [18]: Stupidedi/Schema/SimpleElementUse.html#allowed_values-instance_method

### Unused Elements

For elements that are declared to never be sent, `nil` or [`#blank`][26] will
generate the empty element; however using [`#not_used`][28] is arguably more
self-documenting. If [`BuilderDsl`][1] determines that the element is not
declared as such, it will raise a [`ParseError`][17]. For example the X221 835
document declares ST03 with `NOT USED`:

    b.ST("835", "1234", b.not_used)

Syntax Validation
-----------------

The parse tree that [`BuilderDsl`][1] maintains is used to ensure only
well-formed X12 is generated. This means segments occur in the correct order
and have the correct number and type of elements.

### Segment Order

The order in which segments may occur is defined by the active
[`TransactionSetDef`][4], [`FunctionalGroupDef`][3], and [`InterchangeDef`][2].
Internally, an instance of [`StateMachine`][19] is used to both
incrementally build the parse tree and keep track of which segments can occur
from the given state. The [`#successors`][21] method will return one or more
[`InstructionTable`][20] values which enumerate the segments that may occur in
the current state:

    pp b.successors

    [InstructionTable(
      1: Instruction[REF: Subscriber Secon..](pop: 0, drop: 0),
      2: Instruction[REF: Property and Cas..](pop: 0, drop: 0),
      3: Instruction[PER: Property and Cas..](pop: 0, drop: 3),
      4: Instruction[NM1: Subscriber Name   ](pop: 1, drop: 0, push: LoopState),
      5: Instruction[NM1: Payer Name        ](pop: 1, drop: 0, push: LoopState),
      6: Instruction[CLM: Claim Informatio..](pop: 1, drop: 2, push: LoopState),
      7: Instruction[ HL: Subscriber Hiera..](pop: 2, drop: 0, push: LoopState),
      8: Instruction[ HL: Billing Provider..](pop: 3, drop: 0, push: TableState),
      9: Instruction[ HL: Subscriber Hiera..](pop: 3, drop: 0, push: TableState),
     10: Instruction[ HL: Patient Hierachi..](pop: 3, drop: 0, push: TableState),
     11: Instruction[ SE: Transaction Set ..](pop: 3, drop: 4, push: TableState),
     12: Instruction[ ST](pop: 4, drop: 0, push: TransactionSetState),
     13: Instruction[ GE: Functional Group..](pop: 4, drop: 2),
     14: Instruction[ GS](pop: 5, drop: 0, push: FunctionalGroupState),
     15: Instruction[IEA: Interchange Cont..](pop: 5, drop: 2),
     16: Instruction[ISA](pop: 6, drop: 0, push: InterchangeState))]

  [19]: Stupidedi/Builder/StateMachine.html
  [20]: Stupidedi/Builder/InstructionTable.html
  [21]: Stupidedi/Builder/BuilderDsl.html#successors-instance_method

The above output pertains to the X222 837 implementation guide. The output shows
a single active [`InstructionTable`][20] and the segments it is able to accept.
For more information about how the parser works, see {file:design/Parser.md Parser Design}.
Attempting to generate a segment that is not a member of at least one of the
instruction tables will cause a [`ParseError`][17] to be raised.

    b.N3("SUITE 111", "1234 OCEAN BLVD")
      #=> Segment N3 cannot occur here (Stupidedi::Exceptions::ParseError)

### Element Types

The [`InterchangeDef`][2] and [`TransactionSetDef`][4] classes both respond to
`#segment_dict`, which allows looking up a [`SegmentDef`][23] by segment its
identifier. The [`SegmentDef`][23] indicates the number of elements and their
types (composite, repeated, simple).  This information allows [`BuilderDsl`][1]
to raise a [`ParseError`][17] on the following conditions:

  [23]: Stupidedi/Schema/SegmentDef.html

Generating a composite element where a simple or repeated element is defined:

    b.NM1(b.composite(nil, "B"), nil)
      #=> NM101 is a simple element (Stupidedi::Exceptions::ParseError)

Generating a simple element where a repeated or composite element is defined:

    b.REF(nil, nil, nil, "D")
      #=> REF04 is a composite element (Stupidedi::Exceptions::ParseError)

    b.DMG(nil, nil, nil, nli, "E")
      #=> DMG05 is a repeatable element (Stupiedi::Exceptions::ParseError)

    b.DMG(nil, nil, nil, nil, b.repeated("E"))
      #=> DMG05 is a composite element (Stupidedi::Exceptions::ParseError)

Generating a repeated element where a non-repeated element is defined:

    b.NM1(b.repeated("A", "B"))
      #=> NM101 is a simple element (Stupidedi::Exceptions::ParseError)

Generating more than the defined number of elements:

    b.N3(nil, nil, nil)
      #=> N3 has only 4 elements (Stupidedi::Exceptions::ParseError)

    b.REF(nil, nil, nil, b.composite("A", "B", "C", "D", "E", "F", "G"))
      #=> REF04 has only 6 components (Stupidedi::Exceptions::ParseError)

  [24]: Stupidedi/Builder/BuilderDsl.html#composite-instance_method
  [25]: Stupidedi/Builder/BuilderDsl.html#repeated-instance_method
  [26]: Stupidedi/Builder/BuilderDsl.html#blank-instance_method
  [27]: Stupidedi/Builder/BuilderDsl.html#default-instance_method
  [28]: Stupidedi/Builder/BuilderDsl.html#not_used-instance_method


text:
require_relative 'aggregator/control_segment'
require_relative 'aggregator/isa'
require_relative 'aggregator/gs'
require_relative 'aggregator/st'
require_relative 'aggregator/loops'
module Edi835
  class Aggregator

    attr_reader :sets

    def initialize(segments)
      @segments = segments
    end

    def aggregate
      @sets = ISA.new(@segments).sets
    end
  end

end


text:
namespace pn::rdb {

// ----- TYPEDEFS ----------

using resource_id_t			= unsigned long long;
using mesh_resource_id_t	= resource_id_t;

}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. Soc. bot. Genève, 2 sér. 5: 222 (1889)

#### Original name
Lepiota brunneoincarnata Chodat & C. Martín, 1889

### Remarks
null


text:
import {Controller, Request} from '../helpers'

class ResumoAtividadesController extends Controller {

}

export default ResumoAtividadesController


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
	<!-- 没有焦点时字体颜色 -->
	<item
		android:state_selected="false"
		android:drawable="@drawable/ic_item_category_download"/>
	<!--选中时的字体颜色  -->
	<item
		android:state_selected="true"
		android:drawable="@drawable/ic_item_category_activated"/>
	<!-- 非触摸模式下获得焦点并单击时的字体颜色 -->
	<item
		android:state_focused="true"
		android:state_pressed="true"
		android:drawable="@drawable/ic_item_category_activated"/>
</selector>


text:
package de.iron42.hub;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;

public class Messages implements Listener{
	@EventHandler
	public void on(PlayerJoinEvent e) {
		Player p = e.getPlayer();
		e.setJoinMessage("");
		p.teleport(new Location(Bukkit.getWorld("Game"), 79.5, 155.5, 323.5));
	}

	@EventHandler
	public void on(PlayerQuitEvent e) {
		e.setQuitMessage("");
	}

}