text:
function New-VSGreengrassResourceDefinition {
    <#
    .SYNOPSIS
        Adds an AWS::Greengrass::ResourceDefinition resource to the template. The AWS::Greengrass::ResourceDefinition resource represents a resource definition for AWS IoT Greengrass. Resource definitions are used to organize your resource definition versions.

    .DESCRIPTION
        Adds an AWS::Greengrass::ResourceDefinition resource to the template. The AWS::Greengrass::ResourceDefinition resource represents a resource definition for AWS IoT Greengrass. Resource definitions are used to organize your resource definition versions.

Resource definitions can reference multiple resource definition versions. All resource definition versions must be associated with a resource definition. Each resource definition version can contain one or more resources. (In AWS CloudFormation, resources are named *resource instances*.

**Note**

When you create a resource definition, you can optionally include an initial resource definition version. To associate a resource definition version later, create an https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinitionversion.html: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinitionversion.html resource and specify the ID of this resource definition.

After you create the resource definition version that contains the resources you want to deploy, you must add it to your group version. For more information, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html.

    .LINK
        http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinition.html

    .PARAMETER LogicalId
        The logical ID must be alphanumeric (A-Za-z0-9) and unique within the template. Use the logical name to reference the resource in other parts of the template. For example, if you want to map an Amazon Elastic Block Store volume to an Amazon EC2 instance, you reference the logical IDs to associate the block stores with the instance.

    .PARAMETER InitialVersion
        The resource definition version to include when the resource definition is created. A resource definition version contains a list of https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-resourcedefinition-resourceinstance.html: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-resourcedefinition-resourceinstance.html property types.
To associate a resource definition version after the resource definition is created, create an https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinitionversion.html: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinitionversion.html resource and specify the ID of this resource definition.

        Type: ResourceDefinitionVersion
        Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinition.html#cfn-greengrass-resourcedefinition-initialversion
        UpdateType: Immutable

    .PARAMETER Tags
        Application-specific metadata to attach to the resource definition. You can use tags in IAM policies to control access to AWS IoT Greengrass resources. You can also use tags to categorize your resources. For more information, see Tagging Your AWS IoT Greengrass Resources: https://docs.aws.amazon.com/greengrass/latest/developerguide/tagging.html in the *AWS IoT Greengrass Developer Guide*.
This Json property type is processed as a map of key-value pairs. It uses the following format, which is different from most Tags implementations in AWS CloudFormation templates.

"Tags": {
"KeyName0": "value",
"KeyName1": "value",
"KeyName2": "value"
}

        Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinition.html#cfn-greengrass-resourcedefinition-tags
        PrimitiveType: Json
        UpdateType: Mutable

    .PARAMETER Name
        The name of the resource definition.

        Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-resourcedefinition.html#cfn-greengrass-resourcedefinition-name
        PrimitiveType: String
        UpdateType: Mutable

    .PARAMETER DeletionPolicy
        With the DeletionPolicy attribute you can preserve or (in some cases) backup a resource when its stack is deleted. You specify a DeletionPolicy attribute for each resource that you want to control. If a resource has no DeletionPolicy attribute, AWS CloudFormation deletes the resource by default.

        To keep a resource when its stack is deleted, specify Retain for that resource. You can use retain for any resource. For example, you can retain a nested stack, S3 bucket, or EC2 instance so that you can continue to use or modify those resources after you delete their stacks.

        You must use one of the following options: "Delete","Retain","Snapshot"

    .PARAMETER UpdateReplacePolicy
        Use the UpdateReplacePolicy attribute to retain or (in some cases) backup the existing physical instance of a resource when it is replaced during a stack update operation.

        When you initiate a stack update, AWS CloudFormation updates resources based on differences between what you submit and the stack's current template and parameters. If you update a resource property that requires that the resource be replaced, AWS CloudFormation recreates the resource during the update. Recreating the resource generates a new physical ID. AWS CloudFormation creates the replacement resource first, and then changes references from other dependent resources to point to the replacement resource. By default, AWS CloudFormation then deletes the old resource. Using the UpdateReplacePolicy, you can specify that AWS CloudFormation retain or (in some cases) create a snapshot of the old resource.

        For resources that support snapshots, such as AWS::EC2::Volume, specify Snapshot to have AWS CloudFormation create a snapshot before deleting the old resource instance.

        You can apply the UpdateReplacePolicy attribute to any resource. UpdateReplacePolicy is only executed if you update a resource property whose update behavior is specified as Replacement, thereby causing AWS CloudFormation to replace the old resource with a new one with a new physical ID. For example, if you update the Engine property of an AWS::RDS::DBInstance resource type, AWS CloudFormation creates a new resource and replaces the current DB instance resource with the new one. The UpdateReplacePolicy attribute would then dictate whether AWS CloudFormation deleted, retained, or created a snapshot of the old DB instance. The update behavior for each property of a resource is specified in the reference topic for that resource in the AWS Resource and Property Types Reference. For more information on resource update behavior, see Update Behaviors of Stack Resources.

        The UpdateReplacePolicy attribute applies to stack updates you perform directly, as well as stack updates performed using change sets.

        Note
        Resources that are retained continue to exist and continue to incur applicable charges until you delete those resources. Snapshots that are created with this policy continue to exist and continue to incur applicable charges until you delete those snapshots. UpdateReplacePolicy retains the old physical resource or snapshot, but removes it from AWS CloudFormation's scope.

        UpdateReplacePolicy differs from the DeletionPolicy attribute in that it only applies to resources replaced during stack updates. Use DeletionPolicy for resources deleted when a stack is deleted, or when the resource definition itself is deleted from the template as part of a stack update.

        You must use one of the following options: "Delete","Retain","Snapshot"

    .PARAMETER DependsOn
        With the DependsOn attribute you can specify that the creation of a specific resource follows another. When you add a DependsOn attribute to a resource, that resource is created only after the creation of the resource specified in the DependsOn attribute.

        This parameter takes a string or list of strings representing Logical IDs of resources that must be created prior to this resource being created.

    .PARAMETER Metadata
        The Metadata attribute enables you to associate structured data with a resource. By adding a Metadata attribute to a resource, you can add data in JSON or YAML to the resource declaration. In addition, you can use intrinsic functions (such as GetAtt and Ref), parameters, and pseudo parameters within the Metadata attribute to add those interpreted values.

        You must use a PSCustomObject containing key/value pairs here. This will be returned when describing the resource using AWS CLI.

    .PARAMETER UpdatePolicy
        Use the UpdatePolicy attribute to specify how AWS CloudFormation handles updates to the AWS::AutoScaling::AutoScalingGroup resource. AWS CloudFormation invokes one of three update policies depending on the type of change you make or whether a scheduled action is associated with the Auto Scaling group.

        You must use the "Add-UpdatePolicy" function here.
    .PARAMETER Condition
        Logical ID of the condition that this resource needs to be true in order for this resource to be provisioned.

    .FUNCTIONALITY
        Vaporshell
    #>
    [OutputType('Vaporshell.Resource.Greengrass.ResourceDefinition')]
    [cmdletbinding()]
    Param
    (
        [parameter(Mandatory = $true,Position = 0)]
        [ValidateScript( {
                if ($_ -match "^[a-zA-Z0-9]*$") {
                    $true
                }
                else {
                    $PSCmdlet.ThrowTerminatingError((New-VSError -String 'The LogicalID must be alphanumeric (a-z, A-Z, 0-9) and unique within the template.'))
                }
            })]
        [System.String]
        $LogicalId,
        [parameter(Mandatory = $false)]
        $InitialVersion,
        [parameter(Mandatory = $false)]
        [ValidateScript( {
                $allowedTypes = "System.String","System.Collections.Hashtable","System.Management.Automation.PSCustomObject"
                if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") {
                    $true
                }
                else {
                    $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ")."))
                }
            })]
        $Tags,
        [parameter(Mandatory = $true)]
        [ValidateScript( {
                $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition"
                if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") {
                    $true
                }
                else {
                    $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ")."))
                }
            })]
        $Name,
        [ValidateSet("Delete","Retain","Snapshot")]
        [System.String]
        $DeletionPolicy,
        [ValidateSet("Delete","Retain","Snapshot")]
        [System.String]
        $UpdateReplacePolicy,
        [parameter(Mandatory = $false)]
        [System.String[]]
        $DependsOn,
        [parameter(Mandatory = $false)]
        [ValidateScript( {
                $allowedTypes = "System.Management.Automation.PSCustomObject"
                if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") {
                    $true
                }
                else {
                    $PSCmdlet.ThrowTerminatingError((New-VSError -String "The UpdatePolicy parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ")."))
                }
            })]
        $Metadata,
        [parameter(Mandatory = $false)]
        [ValidateScript( {
                $allowedTypes = "Vaporshell.Resource.UpdatePolicy"
                if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") {
                    $true
                }
                else {
                    $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ")."))
                }
            })]
        $UpdatePolicy,
        [parameter(Mandatory = $false)]
        $Condition
    )
    Begin {
        $ResourceParams = @{
            LogicalId = $LogicalId
            Type = "AWS::Greengrass::ResourceDefinition"
        }
        $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable')
    }
    Process {
        foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) {
            switch ($key) {
                LogicalId {}
                DeletionPolicy {
                    $ResourceParams.Add("DeletionPolicy",$DeletionPolicy)
                }
                UpdateReplacePolicy {
                    $ResourceParams.Add("UpdateReplacePolicy",$UpdateReplacePolicy)
                }
                DependsOn {
                    $ResourceParams.Add("DependsOn",$DependsOn)
                }
                Metadata {
                    $ResourceParams.Add("Metadata",$Metadata)
                }
                UpdatePolicy {
                    $ResourceParams.Add("UpdatePolicy",$UpdatePolicy)
                }
                Condition {
                    $ResourceParams.Add("Condition",$Condition)
                }
                Tags {
                    if (($PSBoundParameters[$key]).PSObject.TypeNames -contains "System.String"){
                        try {
                            $JSONObject = (ConvertFrom-Json -InputObject $PSBoundParameters[$key] -ErrorAction Stop)
                        }
                        catch {
                            $PSCmdlet.ThrowTerminatingError((New-VSError -String "Unable to convert parameter '$key' string value to PSObject! Please use a JSON string OR provide a Hashtable or PSCustomObject instead!"))
                        }
                    }
                    else {
                        $JSONObject = ([PSCustomObject]$PSBoundParameters[$key])
                    }
                    if (!($ResourceParams["Properties"])) {
                        $ResourceParams.Add("Properties",([PSCustomObject]@{}))
                    }
                    $ResourceParams["Properties"] | Add-Member -MemberType NoteProperty -Name $key -Value $JSONObject
                }
                Default {
                    if (!($ResourceParams["Properties"])) {
                        $ResourceParams.Add("Properties",([PSCustomObject]@{}))
                    }
                    $ResourceParams["Properties"] | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters[$key]
                }
            }
        }
    }
    End {
        $obj = New-VaporResource @ResourceParams
        $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.Greengrass.ResourceDefinition'
        Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$(@{$obj.LogicalId = $obj.Props} | ConvertTo-Json -Depth 5)`n"
    }
}


text:
package org.ops4j.pax.cdi.sample1.client;

import java.util.ArrayList;
import java.util.List;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;

import org.ops4j.pax.cdi.api.Component;
import org.ops4j.pax.cdi.api.Dynamic;
import org.ops4j.pax.cdi.api.Filter;
import org.ops4j.pax.cdi.api.Immediate;
import org.ops4j.pax.cdi.api.Service;
import org.ops4j.pax.cdi.api.SingletonScoped;
import org.ops4j.pax.cdi.api.event.ServiceAdded;
import org.ops4j.pax.cdi.api.event.ServiceCdiEvent;
import org.ops4j.pax.cdi.api.event.ServiceRemoved;
import org.ops4j.pax.cdi.sample1.IceCreamService;

@Service @Component @Immediate @SingletonScoped
public class IceCreamClient {

    @Inject
    @Service @Dynamic @Filter("(flavour=chocolate)")
    private IceCreamService iceCreamService;

    @Inject
    @Service @Dynamic
    private Instance<IceCreamService> iceCreamServices;

    private List<String> events = new ArrayList<>();

    // we may be in trouble when this even is sent to us before reaching pax-cdi extension...

//    public void onInit(@Observes @Initialized(ApplicationScoped.class) Object object) {
//        events.add("initialized application scope");
//    }
//
//    public void onShutdown(@Observes @Destroyed(ApplicationScoped.class) Object object) {
//        events.add("destroyed application scope");
//    }

    public void onInit(@Observes @ServiceAdded BeanManager manager) {
        events.add("registered BeanManager");
    }

    public void onIceCreamServiceAdded(@Observes @ServiceAdded ServiceCdiEvent<? extends IceCreamService> event) {
        String flavour = (String) event.getReference().getProperty("flavour");
        events.add("added IceCreamService with flavour " + flavour);
    }

    public void onIceCreamServiceAdded(@Observes @ServiceAdded IceCreamService service) {
        events.add("added IceCreamService with class " + service.getClass().getName());
    }

    public void onIceCreamServiceRemoved(@Observes @ServiceRemoved ServiceCdiEvent<? extends IceCreamService> event) {
        String flavour = (String) event.getReference().getProperty("flavour");
        events.add("removed IceCreamService with flavour " + flavour);
    }

    public void onIceCreamServiceRemoved(@Observes @ServiceRemoved IceCreamService service) {
        events.add("removed IceCreamService with class " + service.getClass().getName());
    }

    public String getFlavour() {
        return iceCreamService.getFlavour();
    }

    public List<String> getAllFlavours() {
        List<String> flavours = new ArrayList<String>();
        for (IceCreamService service : iceCreamServices) {
            String flavour = service.getFlavour();
            flavours.add(flavour);
        }
        return flavours;
    }

    public List<String> getEvents() {
        return events;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.broadleafcommerce.core.catalog.domain;

import org.broadleafcommerce.common.copy.MultiTenantCloneable;
import org.broadleafcommerce.common.media.domain.Media;
import org.broadleafcommerce.common.money.Money;
import org.broadleafcommerce.common.vendor.service.type.ContainerShapeType;
import org.broadleafcommerce.common.vendor.service.type.ContainerSizeType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Implementations of this interface are used to hold data for a Product.  A product is a general description
 * of an item that can be sold (for example: a hat).  Products are not sold or added to a cart.  {@link Sku}s
 * which are specific items (for example: a XL Blue Hat) are sold or added to a cart.
 *

 *

 * You should implement this class if you want to make significant changes to how the
 * Product is persisted.  If you just want to add additional fields then you should extend {@link ProductImpl}.
 *
 * @author btaylor
 * @see {@link ProductImpl},{@link Sku}, {@link Category}
 */
public interface Product extends Serializable, MultiTenantCloneable<Product> {

    /**
     * The id of the Product.
     *
     * @return the id of the Product
     */
    public Long getId();

    /**
     * Sets the id of the Product.
     *
     * @param id - the id of the product
     */
    public void setId(Long id);

    /**
     * Returns the name of the product that is used for display purposes.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return the name of the product
     */
    public String getName();

    /**
     * Sets the name of the product that is used for display purposes.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param name - the name of the Product
     */
    public void setName(String name);

    /**
     * Returns a brief description of the product that is used for display.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return a brief description of the product
     */
    public String getDescription();

    /**
     * Sets a brief description of the product that is used for display.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param description - a brief description of the product
     */
    public void setDescription(String description);

    /**
     * Returns a long description of the product that is used for display.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return a long description of the product
     */
    public String getLongDescription();

    /**
     * Sets a long description of the product that is used for display.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param longDescription the long description
     */
    public void setLongDescription(String longDescription);

    /**
     * Returns the first date a product will be available that is used to determine whether
     * to display the product.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return the first date the product will be available
     */
    public Date getActiveStartDate();

    /**
     * Sets the first date a product will be available that is used to determine whether
     * to display the product.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param activeStartDate - the first day the product is available
     */
    public void setActiveStartDate(Date activeStartDate);

    /**
     * Returns the last date a product will be available that is used to determine whether
     * to display the product.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return the last day the product is available
     */
    public Date getActiveEndDate();

    /**
     * Sets the last date a product will be available that is used to determine whether
     * to display the product.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param activeEndDate - the last day the product is available
     */
    public void setActiveEndDate(Date activeEndDate);

    /**
     * Returns a boolean that indicates if the product is currently active.
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return a boolean indicates if the product is active.
     */
    public boolean isActive();

    /**
     * Gets the default {@link Sku} associated with this Product. A Product is
     * required to have a default Sku which holds specific information about the Product
     * like weight, dimensions, price, etc.  Many of the Product attributes that
     * have getters and setters on Product are actually pass-through to the default Sku.
     *

     *

     * Products can also have multiple Skus associated with it that are represented by
     * {@link ProductOption}s. For instance, a large, blue shirt. For more information on
     * that relationship see {@link #getAdditionalSkus()}.
     *
     * @return the default Sku for this Product
     */
    public Sku getDefaultSku();

    /**
     * Sets the default Sku for this Product
     *

     *

     * Note: this operation is cascaded with CascadeType.ALL which saves from having to persist the Product
     * in 2 operations: first persist the Sku and then take the merged Sku, set it as this Product's default
     * Sku, and then persist this Product.
     *
     * @param defaultSku - the Sku that should be the default for this Product
     */
    public void setDefaultSku(Sku defaultSku);

    /**
     * @return whether or not the default sku can be used for a multi-sku product in the case that no
     * product options are set. Defaults to false if not specified. Note that this only affects multi-sku
     * products.
     */
    public Boolean getCanSellWithoutOptions();

    /**
     * Sets whether or not the default sku can be sold in the case that no product options are specified. Note
     * that this only affects multi-sku products.
     *
     * @param canSellWithoutOptions
     */
    public void setCanSellWithoutOptions(Boolean canSellWithoutOptions);

    /**
     * Returns a list of {@link Sku}s filtered by whether the Skus are active or not.
     * This list does not contain the {@link #getDefaultSku()} and filters by {@link Sku#isActive()}.
     *
     * @return a list of active Skus from {@link #getAdditionalSkus()} for this Product
     * @deprecated use {@link #getAdditionalSkusXrefs()} instead
     */
    @Deprecated
    public List<Sku> getSkus();

    /**
     * Gets all the additional Skus associated with this Product. For instance, if this
     * Product represented a T-shirt and you could pick the size of the T-shirt as a
     * {@link ProductOption} (like "small", "medium", "large") this would return 3 Skus
     * if you had different inventory or price constraints on each {@link ProductOptionValue}.
     *

     *

     * This list does not take into account whether any of these additional Skus are active or not, nor
     * does it contain the {@link #getDefaultSku()} for this Product.  For this functionality, see
     * {@link #getSkus()} and {@link #getAllSkus()}, respectively.
     *
     * @return the additional Skus for this Product
     * @see {@link ProductOption}, {@link ProductOptionValue}
     */
    public List<Sku> getAdditionalSkus();

    /**
     * Sets the additional Skus associated to this Product. These additional Skus should
     * come from {@link ProductOptionValue}s and are used in instance where you need to track inventory
     * or change pricing on a per-option value basis.
     *
     * @param skus - a List of {@link Sku}s to associate with this Product, usually based off of {@link ProductOption}s
     * @see {@link #getAdditionalSkus()}, {@link ProductOption}, {@link ProductOptionValue}
     */
    public void setAdditionalSkus(List<Sku> skus);

    /**
     * Returns all the {@link Sku}s that are associated with this Product (including {@link #getDefaultSku()})
     * regardless of whether or not the {@link Sku}s are active or not
     *

     *

     * Note: in the event that the default Sku was added to the list of {@link #getAdditionalSkus()}, it is filtered out
     * so that only a single instance of {@link #getDefaultSku()} is contained in the resulting list
     *
     * @return all the Skus associated to this Product
     */
    public List<Sku> getAllSkus();

    /**
     * Gets the media for this product. This serves as a pass-through to
     * the {@link getDefaultSku()} media
     *
     * @return the Media for the default Sku associated with this Product
     * @see Sku
     */
    public Map<String, Media> getMedia();

    /**
     * Gets the media for this product. This serves as a pass-through to
     * the {@link getDefaultSku()} media
     *
     * @param media Media map to set on the default Sku associated with this Product
     * @see Sku
     */
    public void setMedia(Map<String, Media> media);

    /**
     * Convenience method for returning all of the media associated with this Product by adding
     * all the media in {@link #getDefaultSku()} as well as all the media in the Skus represented by
     * {@link #getAdditionalSkus()}
     *
     * @return all of the Media for all of the Skus for this Product
     */
    public Map<String, Media> getAllSkuMedia();

    /**
     * Return the {@link org.broadleafcommerce.core.catalog.domain.Category} that contains this product
     *
     * @return
     */
    public Category getCategory();

    /**
     * Set the {@link org.broadleafcommerce.core.catalog.domain.Category} that contains this product
     *
     * @param category
     */
    public void setCategory(Category category);

    /**
     * Returns the default {@link Category} this product is associated with. This method will delegate to
     * {@link #getCategory()} by default, unless the "use.legacy.default.category.mode" property is set to
     * true in the implementation's property file. If set to true, this method will use legacy behavior,
     * which is to return the deprecated defaultCategory field.
     *
     * @deprecated use {@link #getCategory()} instead
     */
    @Deprecated
    public Category getDefaultCategory();

    /**
     * Sets the default {@link Category} to associate this product with. This method will delegate to
     * {@link #setCategory(Category)} by default, unless the "use.legacy.default.category.mode" property is set to
     * true in the implementation's property file. If set to true, this method will use legacy behavior,
     * which is to set the deprecated defaultCategory field.
     *
     * @deprecated use {@link #setCategory(Category)} instead
     * @param defaultCategory - the default {@link Category} to associate this product with
     */
    @Deprecated
    public void setDefaultCategory(Category defaultCategory);

    /**
     * Returns the model number of the product
     * @return the model number
     */
    public String getModel();

    /**
     * Sets the model number of the product
     * @param model
     */
    public void setModel(String model);

    /**
     * Returns the manufacture name for this product
     * @return the manufacture name
     */
    public String getManufacturer();

    /**
     * Sets the manufacture for this product
     * @param manufacturer
     */
    public void setManufacturer(String manufacturer);

    /**
     * Returns the {@link Dimension} for this product
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return a ProductDimensions object
     *
     */
    public Dimension getDimension();

    /**
     * Sets the {@link Dimension} for this product
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param dimension
     *
     */
    public void setDimension(Dimension dimension);

    /**
     * Returns the dimension width
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return width dimension of the product
     *
     */
    public BigDecimal getWidth();

    /**
     * Sets the dimension width
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param width
     *
     */
    public void setWidth(BigDecimal width);

    /**
     * Returns the dimension height
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return height dimension of the product
     *
     */
    public BigDecimal getHeight();

    /**
     * Sets the dimension height
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param height
     *
     */
    public void setHeight(BigDecimal height);

    /**
     * Returns the dimension depth
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return width depth of the product
     *
     */
    public BigDecimal getDepth();

    /**
     * Sets the dimension depth
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param depth
     */
    public void setDepth(BigDecimal depth);

    /**
     * Gets the dimension girth
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return the dimension girth
     */
    public BigDecimal getGirth();

    /**
     * Sets the dimension girth
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param girth
     */
    public void setGirth(BigDecimal girth);

    /**
     * Returns the dimension container size
     *
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return dimension container size
     */
    public ContainerSizeType getSize();

    /**
     * Sets the dimension container size
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param size
     */
    public void setSize(ContainerSizeType size);

    /**
     * Gets the dimension container shape
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return dimension container shape
     */
    public ContainerShapeType getContainer();

    /**
     * Sets the dimension container shape
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param container
     */
    public void setContainer(ContainerShapeType container);

    /**
     * Returns a String representation of the dimension
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return a dimension String
     */
    public String getDimensionString();

    /**
     * Returns the weight of the product
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @return weight of product
     */
    public Weight getWeight();

    /**
     * Sets the product weight
     *

     *

     * Note: this is a convenience method that merely serves as
     * a pass-through to the same method via {@link getDefaultSku()}
     *
     * @param weight
     */
    public void setWeight(Weight weight);

    /**
     * Returns a List of this product's related Cross Sales
     * @return
     */
    public List<RelatedProduct> getCrossSaleProducts();

    /**
     * Sets the related Cross Sales
     * @param crossSaleProducts
     */
    public void setCrossSaleProducts(List<RelatedProduct> crossSaleProducts);

    /**
     * Returns a List of this product's related Up Sales
     * @return
     */
    public List<RelatedProduct> getUpSaleProducts();

    /**
     * Sets the related Up Sales
     * @param upSaleProducts
     */
    public void setUpSaleProducts(List<RelatedProduct> upSaleProducts);

    /**
     * Returns whether or not the product is featured
     * @return isFeaturedProduct as Boolean
     */
    public boolean isFeaturedProduct();

    /**
     * Sets whether or not the product is featured
     * @param isFeaturedProduct
     */
    public void setFeaturedProduct(boolean isFeaturedProduct);

    /**
     * Generic key-value pair of attributes to associate to this Product for maximum
     * extensibility.
     *
     * @return the attributes for this Product
     */
    public Map<String, ProductAttribute> getProductAttributes();

    /**
     * Sets a generic list of key-value pairs for Product
     * @param productAttributes
     */
    public void setProductAttributes(Map<String, ProductAttribute> productAttributes);

    /**
     * Gets the promotional message for this Product. For instance, this could be a limited-time
     * Product
     *
     * @return the Product's promotional message
     */
    public String getPromoMessage();

    /**
     * Sets the promotional message for this Product
     *
     * @param promoMessage
     */
    public void setPromoMessage(String promoMessage);

    /**
     * The available {@link ProductOption}s for this Product.  For instance, if this
     * Product is a T-Shirt, you might be able to specify a size and color. This would
     * be modeled by 2 {@link ProductOption}s, each that could have multiple {@link ProductOptionValue}s
     * (which could be "small" "medium" "large", "blue", "yellow", "green").  For specific pricing or
     * inventory needs on a per-value basis, multiple Skus can be associated to this Product based
     * off of the {@link ProductOptionValue}s
     *
     * @deprecated use getProductOptionXrefs instead
     * @return the {@link ProductOption}s for this Product
     * @see Product#getAdditionalSkus(), {@link ProductOption}, {@link ProductOptionValue}
     */
    @Deprecated
    public List<ProductOption> getProductOptions();

    public List<ProductOptionXref> getProductOptionXrefs();

    /**
     * Sets the list of available ProductOptions for this Product
     *
     * @deprecated use setProductOptionXrefs instead
     * @param productOptions
     */
    @Deprecated
    public void setProductOptions(List<ProductOption> productOptions);

    public void setProductOptionXrefs(List<ProductOptionXref> productOptions);

    /**
     * Returns a Map of product option values, keyed by the product option name.
     * E.g. "color":["red","green","black"]
     * @return
     */
    public Map<String, Set<String>> getProductOptionValuesMap();

    /**
     * A product can have a designated URL.   When set, the ProductHandlerMapping will check for this
     * URL and forward this user to the {@link #getDisplayTemplate()}.
     *
     * Alternatively, most sites will rely on the {@link Product#getGeneratedUrl()} to define the
     * url for a product page.
     *
     * @see org.broadleafcommerce.core.web.catalog.ProductHandlerMapping
     * @return
     */
    public String getUrl();

    /**
     * Sets the URL that a customer could type in to reach this product.
     *
     * @param url
     */
    public void setUrl(String url);

    /**
     * @return the flag for whether or not the URL should not be generated in the admin
     */
    public Boolean getOverrideGeneratedUrl();

    /**
     * Sets the flag for whether or not the URL should not be generated in the admin
     *
     * @param overrideGeneratedUrl
     */
    public void setOverrideGeneratedUrl(Boolean overrideGeneratedUrl);

    /**
     * Sets a url-fragment.  By default, the system will attempt to create a unique url-fragment for
     * this product by taking the {@link Product.getName()} and removing special characters and replacing
     * dashes with spaces.
     */
    public String getUrlKey();

    /**
     * Sets a url-fragment to be used with this product.  By default, the system will attempt to create a
     * unique url-fragment for this product by taking the {@link Product.getName()} and removing special characters and replacing
     * dashes with spaces.
     */
    public void setUrlKey(String url);

    /**
     * Returns the name of a display template that is used to render this product.   Most implementations have a default
     * template for all products.    This allows for the user to define a specific template to be used by this product.
     *
     * @return
     */
    public String getDisplayTemplate();

    /**
     * Sets the name of a display template that is used to render this product.   Most implementations have a default
     * template for all products.    This allows for the user to define a specific template to be used by this product.
     * @param displayTemplate
     */
    public void setDisplayTemplate(String displayTemplate);

    /**
     * Generates a URL that can be used to access the product.
     * Builds the url by combining the url of the default category with the getUrlKey() of this product.
     */
    public String getGeneratedUrl();

    /**
     * Returns a list of the cross sale products for this product as well
     * all cross sale products in all parent categories of this product.
     *
     * @return the cumulative cross sale products
     */
    public List<RelatedProduct> getCumulativeCrossSaleProducts();

    /**
     * Returns a list of the upsale products for this product as well as
     * all upsale products in all parent categories of this product.
     *
     * @return the cumulative upsale products
     */
    public List<RelatedProduct> getCumulativeUpSaleProducts();

    /**
     * Removes any currently stored dynamic pricing
     */
    public void clearDynamicPrices();

    /**
     * Retrieve all the xref entities linking this product to parent categories
     */
    public List<CategoryProductXref> getAllParentCategoryXrefs();

    /**
     * Set all the xref entities linking this product to parent categories
     */
    public void setAllParentCategoryXrefs(List<CategoryProductXref> allParentCategories);

    /**
     * Returns all parent {@link Category}(s) this product is associated with.
     *
     * @deprecated Use getAllParentCategoryXrefs() instead.
     * @return the all parent categories for this product
     */
    @Deprecated
    public List<Category> getAllParentCategories();

    /**
     * Sets all parent {@link Category}s this product is associated with.
     *
     * @deprecated Use setAllParentCategoryXrefs() instead.
     * @param allParentCategories - a List of all parent {@link Category}(s) to associate this product with
     */
    @Deprecated
    public void setAllParentCategories(List<Category> allParentCategories);

    /**
     * Returns the tax code of the product. If the tax code is null, then returns the tax code of this products category.
     * @return taxCode
     */
    public String getTaxCode();

    /**
     * Sets the tax code for this product.
     * @param taxCode
     */
    public void setTaxCode(String taxCode);

    /**
     * added just for convenience, references to defaultSku.retailPrice
     * @return
     */
    public Money getRetailPrice();

    /**
     * added just for convenience, references defaultSku.retailPrice
     * @return
     */
    public Money getSalePrice();

}


text:
Crear tipo documento

<form name="form" sg-read-only="!access.administrarDocumentos" class="form-horizontal" novalidate>

		* Tipo persona:

			<ui-select name="tipoPersona" data-ng-model="combo.selected.tipoPersona" ng-disabled="!access.administrarDocumentos" autofocus required>
				<ui-select-match placeholder="Seleccione">{{$select.selected.denominacion}}</ui-select-match>
				<ui-select-autoload pk-name="denominacion" comparator="view.tipoDocumento.tipoPersona" ignore-case="true"></ui-select-autoload>
				<ui-select-choices repeat="item in combo.tipoPersona | filter: $select.search">

				</ui-select-choices>
			</ui-select>

Ingrese tipo persona.

		* Abreviatura:

			<input name="abreviatura" type="text" data-ng-model="view.tipoDocumento.abreviatura" data-ng-minlength="1" data-ng-maxlength="20" class="form-control" required/>

Ingrese abreviatura.

Ingrese abreviatura.

Abreviatura muy extensa, maximo 20 caracteres.

		* Denominacion:

			<input name="denominacion" type="text" data-ng-model="view.tipoDocumento.denominacion" data-ng-minlength="1" data-ng-maxlength="60" class="form-control" required/>

Ingrese denominacion.

Ingrese denominacion.

Denominacion muy extensa, maximo 60 caracteres.

		* Cantidad caracteres:

			<input name="cantidadCaracteres" type="text" data-ng-model="view.tipoDocumento.cantidadCaracteres" ui-number-mask="0" min="1" max="20" ng-init="1" class="form-control" required />

Ingrese cantidad caracteres.

Minimo 1.

Maximo 20.

			<button sg-save>Guardar</button>
			<button sg-cancel ui-sref="^.buscarTipoDocumento">Cancelar</button>

</form>


text:
package com.sharksharding.sql.ast.statement;

import com.sharksharding.sql.ast.SQLStatementImpl;
import com.sharksharding.sql.visitor.SQLASTVisitor;

public class SQLSelectStatement extends SQLStatementImpl {

    protected SQLSelect select;

    public SQLSelectStatement(){

    }

    public SQLSelectStatement(String dbType){
        super (dbType);
    }

    public SQLSelectStatement(SQLSelect select){
        this.setSelect(select);
    }

    public SQLSelectStatement(SQLSelect select, String dbType){
        this(dbType);
        this.setSelect(select);
    }

    public SQLSelect getSelect() {
        return this.select;
    }

    public void setSelect(SQLSelect select) {
        if (select != null) {
            select.setParent(this);
        }
        this.select = select;
    }

    public void output(StringBuffer buf) {
        this.select.output(buf);
    }

    protected void accept0(SQLASTVisitor visitor) {
        if (visitor.visit(this)) {
            acceptChild(visitor, this.select);
        }
        visitor.endVisit(this);
    }
}


text:
#include "test/core/end2end/end2end_tests.h"

#include <stdio.h>
#include <string.h>

#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"

static void* tag(intptr_t t) { return (void*)t; }

static gpr_timespec n_seconds_from_now(int n) {
  return grpc_timeout_seconds_to_deadline(n);
}

static gpr_timespec five_seconds_from_now(void) {
  return n_seconds_from_now(5);
}

static void drain_cq(grpc_completion_queue* cq) {
  grpc_event ev;
  do {
    ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
  } while (ev.type != GRPC_QUEUE_SHUTDOWN);
}

static void shutdown_server(grpc_end2end_test_fixture* f) {
  if (!f->server) return;
  grpc_server_destroy(f->server);
  f->server = nullptr;
}

static void shutdown_client(grpc_end2end_test_fixture* f) {
  if (!f->client) return;
  grpc_channel_destroy(f->client);
  f->client = nullptr;
}

static void end_test(grpc_end2end_test_fixture* f) {
  shutdown_server(f);
  shutdown_client(f);

  grpc_completion_queue_shutdown(f->cq);
  drain_cq(f->cq);
  grpc_completion_queue_destroy(f->cq);

  /* Note: shutdown_cq was unused in this test */
  grpc_completion_queue_destroy(f->shutdown_cq);
}

static void do_request_and_shutdown_server(grpc_end2end_test_config /*config*/,
                                           grpc_end2end_test_fixture* f,
                                           cq_verifier* cqv) {
  grpc_call* c;
  grpc_call* s;
  grpc_op ops[6];
  grpc_op* op;
  grpc_metadata_array initial_metadata_recv;
  grpc_metadata_array trailing_metadata_recv;
  grpc_metadata_array request_metadata_recv;
  grpc_call_details call_details;
  grpc_status_code status;
  grpc_call_error error;
  grpc_slice details;
  int was_cancelled = 2;

  gpr_timespec deadline = five_seconds_from_now();
  c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS,
                               f->cq, grpc_slice_from_static_string("/foo"),
                               nullptr, deadline, nullptr);
  GPR_ASSERT(c);

  grpc_metadata_array_init(&initial_metadata_recv);
  grpc_metadata_array_init(&trailing_metadata_recv);
  grpc_metadata_array_init(&request_metadata_recv);
  grpc_call_details_init(&call_details);

  memset(ops, 0, sizeof(ops));
  op = ops;
  op->op = GRPC_OP_SEND_INITIAL_METADATA;
  op->data.send_initial_metadata.count = 0;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  op->op = GRPC_OP_RECV_INITIAL_METADATA;
  op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
  op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
  op->data.recv_status_on_client.status = &status;
  op->data.recv_status_on_client.status_details = &details;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1),
                                nullptr);
  GPR_ASSERT(GRPC_CALL_OK == error);

  error =
      grpc_server_request_call(f->server, &s, &call_details,
                               &request_metadata_recv, f->cq, f->cq, tag(101));
  GPR_ASSERT(GRPC_CALL_OK == error);
  CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
  cq_verify(cqv);

  /* should be able to shut down the server early
     - and still complete the request */
  grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));

  memset(ops, 0, sizeof(ops));
  op = ops;
  op->op = GRPC_OP_SEND_INITIAL_METADATA;
  op->data.send_initial_metadata.count = 0;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
  op->data.send_status_from_server.trailing_metadata_count = 0;
  op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
  grpc_slice status_details = grpc_slice_from_static_string("xyz");
  op->data.send_status_from_server.status_details = &status_details;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
  op->data.recv_close_on_server.cancelled = &was_cancelled;
  op->flags = 0;
  op->reserved = nullptr;
  op++;
  error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(102),
                                nullptr);
  GPR_ASSERT(GRPC_CALL_OK == error);

  CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
  CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
  CQ_EXPECT_COMPLETION(cqv, tag(1000), 1);
  cq_verify(cqv);
  /* Please refer https://github.com/grpc/grpc/issues/21221 for additional
   * details.
   * TODO(yashykt@) - The following line should be removeable after C-Core
   * correctly handles GOAWAY frames. Internal Reference b/135458602. If this
   * test remains flaky even after this, an alternative fix would be to send a
   * request when the server is in the shut down state.
   */
  cq_verify_empty(cqv);

  GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
  GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
  GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
  GPR_ASSERT(was_cancelled == 0);

  grpc_slice_unref(details);
  grpc_metadata_array_destroy(&initial_metadata_recv);
  grpc_metadata_array_destroy(&trailing_metadata_recv);
  grpc_metadata_array_destroy(&request_metadata_recv);
  grpc_call_details_destroy(&call_details);

  grpc_call_unref(c);
  grpc_call_unref(s);
}

static void disappearing_server_test(grpc_end2end_test_config config) {
  grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr);
  cq_verifier* cqv = cq_verifier_create(f.cq);

  gpr_log(GPR_INFO, "Running test: %s/%s", "disappearing_server_test",
          config.name);

  config.init_client(&f, nullptr);
  config.init_server(&f, nullptr);

  do_request_and_shutdown_server(config, &f, cqv);

  /* now destroy and recreate the server */
  config.init_server(&f, nullptr);

  do_request_and_shutdown_server(config, &f, cqv);

  cq_verifier_destroy(cqv);

  end_test(&f);
  config.tear_down_data(&f);
}

void disappearing_server(grpc_end2end_test_config config) {
  GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION);
#ifndef GPR_WINDOWS /* b/148110727 for more details */
  disappearing_server_test(config);
#endif /* GPR_WINDOWS */
}

void disappearing_server_pre_init(void) {}


text:
package cz.kamenitxan.jakon.validation.validators;

import cz.kamenitxan.jakon.validation.ValidatedBy;
import cz.kamenitxan.jakon.webui.entity.MessageSeverity;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.time.Year;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * The annotated element must be an instant, date or time in the present or in the future.
 *

 *
 * The notion of present here is defined relatively to the type on which the constraint is
 * used. For instance, if the constraint is on a {@link Year}, present would mean the whole
 * current year.
 *

 * Supported types are:
 *

 *
{@code java.time.Instant}

 *
{@code java.time.LocalDate}

 *
{@code java.time.LocalDateTime}

 *
{@code java.time.LocalTime}

 *
{@code java.time.MonthDay}

 *
{@code java.time.OffsetDateTime}

 *
{@code java.time.OffsetTime}

 *
{@code java.time.Year}

 *
{@code java.time.YearMonth}

 *
{@code java.time.ZonedDateTime}

 *
{@code java.time.chrono.HijrahDate}

 *
{@code java.time.chrono.JapaneseDate}

 *
{@code java.time.chrono.MinguoDate}

 *
{@code java.time.chrono.ThaiBuddhistDate}

 *

 *

 * {@code null} elements are considered valid.
 */
@Target({FIELD})
@Retention(RUNTIME)
@ValidatedBy(DummyValidator.class)
public @interface FutureOrPresent {
	MessageSeverity severity() default MessageSeverity.ERROR;

}


text:
package gnu.java.beans.decoder;

import java.beans.ExceptionListener;

import org.xml.sax.Attributes;

/** XML element handler that is specialized on tags that contains a simple string in their
 * body which has to be parsed in a specific way.
 *
All of these tags have in common that they do not accept attributes. A warning is
 * send to the parser's ExceptionListener when one or more attributes exist.

 *
 * @author Robert Schuster
 */
abstract class SimpleHandler extends AbstractElementHandler
{
  private ObjectContext context;

  /**
   * @param PersistenceParser
   */
  SimpleHandler(ElementHandler parent)
  {
    super(parent, false);

    // SimpleHandler do not accept any subelements
  }

  protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener)
    throws AssemblyException
  {

    // note: simple elements should not have any attributes. We inform
    // the user of this syntactical but uncritical problem by sending
    // an IllegalArgumentException for each unneccessary attribute
    int size = attributes.getLength();
    for (int i = 0; i < size; i++) {
            String attributeName = attributes.getQName(i);
            Exception e =
                    new IllegalArgumentException(
                            "Unneccessary attribute '"
                                    + attributeName
                                    + "' discarded.");
            exceptionListener.exceptionThrown(e);
    }

    return context = new ObjectContext();
  }

  public void endElement(String characters)
    throws AssemblyException, AssemblyException
  {
    // reports the number when the character data can be parsed
    try
      {
        context.setObject(parse(characters));
      }
    catch (NumberFormatException nfe)
      {
        throw new AssemblyException(nfe);
      }
  }

  /** Returns an object that is created from the given characters. If the string is
   * converted into a number a NumberFormatException is cathed and reported
   * appropriately.
   *
   * @param characters A string of characters that has to be processed in some way.
   * @return An Object instance generated from the given data.
   * @throws AssemblerException When the string was invalid.
   * @throws NumberFormatException When the string could not be parsed into a number.
   */
  protected abstract Object parse(String characters)
    throws AssemblyException, NumberFormatException;
}


text:
using System;
using System.Runtime.CompilerServices;

namespace BEPUutilities2
{
    /// <summary>
    /// Contains helper math methods.
    /// </summary>
    public static class MathHelper
    {
        /// <summary>
        /// Approximate value of Pi.
        /// </summary>
        public const float Pi = 3.141592653589793239f;

        /// <summary>
        /// Approximate value of Pi multiplied by two.
        /// </summary>
        public const float TwoPi = 6.283185307179586477f;

        /// <summary>
        /// Approximate value of Pi divided by two.
        /// </summary>
        public const float PiOver2 = 1.570796326794896619f;

        /// <summary>
        /// Approximate value of Pi divided by four.
        /// </summary>
        public const float PiOver4 = 0.785398163397448310f;

        /// <summary>
        /// Reduces the angle into a range from -Pi to Pi.
        /// </summary>
        /// <param name="angle">Angle to wrap.</param>
        /// <returns>Wrapped angle.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float WrapAngle(float angle)
        {
            angle = (float)System.Math.IEEERemainder(angle, TwoPi);
            if (angle < -Pi)
            {
                angle += TwoPi;
                return angle;
            }
            if (angle >= Pi)
            {
                angle -= TwoPi;
            }
            return angle;

        }

        /// <summary>
        /// Clamps a value between a minimum and maximum value.
        /// </summary>
        /// <param name="value">Value to clamp.</param>
        /// <param name="min">Minimum value.  If the value is less than this, the minimum is returned instead.</param>
        /// <param name="max">Maximum value.  If the value is more than this, the maximum is returned instead.</param>
        /// <returns>Clamped value.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float Clamp(float value, float min, float max)
        {
            if (value < min)
                return min;
            else if (value > max)
                return max;
            return value;
        }

        /// <summary>
        /// Returns the higher value of the two parameters.
        /// </summary>
        /// <param name="a">First value.</param>
        /// <param name="b">Second value.</param>
        /// <returns>Higher value of the two parameters.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float Max(float a, float b)
        {
            return a > b ? a : b;
        }

        /// <summary>
        /// Returns the lower value of the two parameters.
        /// </summary>
        /// <param name="a">First value.</param>
        /// <param name="b">Second value.</param>
        /// <returns>Lower value of the two parameters.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float Min(float a, float b)
        {
            return a < b ? a : b;
        }

        /// <summary>
        /// Clamps a value between a minimum and maximum value.
        /// </summary>
        /// <param name="value">Value to clamp.</param>
        /// <param name="min">Minimum value.  If the value is less than this, the minimum is returned instead.</param>
        /// <param name="max">Maximum value.  If the value is more than this, the maximum is returned instead.</param>
        /// <returns>Clamped value.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static int Clamp(int value, int min, int max)
        {
            if (value < min)
                return min;
            else if (value > max)
                return max;
            return value;
        }

        /// <summary>
        /// Returns the higher value of the two parameters.
        /// </summary>
        /// <param name="a">First value.</param>
        /// <param name="b">Second value.</param>
        /// <returns>Higher value of the two parameters.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static int Max(int a, int b)
        {
            return a > b ? a : b;
        }

        /// <summary>
        /// Returns the lower value of the two parameters.
        /// </summary>
        /// <param name="a">First value.</param>
        /// <param name="b">Second value.</param>
        /// <returns>Lower value of the two parameters.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static int Min(int a, int b)
        {
            return a < b ? a : b;
        }

        /// <summary>
        /// Clamps a value between a minimum and maximum value.
        /// </summary>
        /// <param name="value">Value to clamp.</param>
        /// <param name="min">Minimum value.  If the value is less than this, the minimum is returned instead.</param>
        /// <param name="max">Maximum value.  If the value is more than this, the maximum is returned instead.</param>
        /// <returns>Clamped value.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static long Clamp(long value, long min, long max)
        {
            if (value < min)
                return min;
            else if (value > max)
                return max;
            return value;
        }

        /// <summary>
        /// Returns the higher value of the two parameters.
        /// </summary>
        /// <param name="a">First value.</param>
        /// <param name="b">Second value.</param>
        /// <returns>Higher value of the two parameters.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static long Max(long a, long b)
        {
            return a > b ? a : b;
        }

        /// <summary>
        /// Returns the lower value of the two parameters.
        /// </summary>
        /// <param name="a">First value.</param>
        /// <param name="b">Second value.</param>
        /// <returns>Lower value of the two parameters.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static long Min(long a, long b)
        {
            return a < b ? a : b;
        }

        /// <summary>
        /// Converts degrees to radians.
        /// </summary>
        /// <param name="degrees">Degrees to convert.</param>
        /// <returns>Radians equivalent to the input degrees.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float ToRadians(float degrees)
        {
            return degrees * (Pi / 180f);
        }

        /// <summary>
        /// Converts radians to degrees.
        /// </summary>
        /// <param name="radians">Radians to convert.</param>
        /// <returns>Degrees equivalent to the input radians.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float ToDegrees(float radians)
        {
            return radians * (180f / Pi);
        }

        /// <summary>
        /// Returns -1 if the value is negative and 1 otherwise.
        /// </summary>
        /// <param name="x">Value to compute the sign of.</param>
        /// <returns>-1 if the input is negative, and 1 otherwise.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float BinarySign(float x)
        {
            return x < 0 ? -1 : 1;
        }
    }
}


text:
namespace {

DWORD kBasicProcessAccess =
  PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE;

} // namespace

namespace base {

Process::Process(ProcessHandle handle)
    : process_(handle), is_current_process_(false) {
  CHECK_NE(handle, ::GetCurrentProcess());
}

Process::Process(Process&& other)
    : process_(other.process_.release()),
      is_current_process_(other.is_current_process_) {
  other.Close();
}

Process::~Process() {
}

Process& Process::operator=(Process&& other) {
  DCHECK_NE(this, &other);
  process_.Set(other.process_.release());
  is_current_process_ = other.is_current_process_;
  other.Close();
  return *this;
}

// static
Process Process::Current() {
  Process process;
  process.is_current_process_ = true;
  return process;
}

// static
Process Process::Open(ProcessId pid) {
  return Process(::OpenProcess(kBasicProcessAccess, FALSE, pid));
}

// static
Process Process::OpenWithExtraPrivileges(ProcessId pid) {
  DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ;
  return Process(::OpenProcess(access, FALSE, pid));
}

// static
Process Process::OpenWithAccess(ProcessId pid, DWORD desired_access) {
  return Process(::OpenProcess(desired_access, FALSE, pid));
}

// static
bool Process::CanBackgroundProcesses() {
  return true;
}

// static
void Process::TerminateCurrentProcessImmediately(int exit_code) {
#if BUILDFLAG(CLANG_PROFILING)
  WriteClangProfilingProfile();
#endif
  ::TerminateProcess(GetCurrentProcess(), exit_code);
  // There is some ambiguity over whether the call above can return. Rather than
  // hitting confusing crashes later on we should crash right here.
  IMMEDIATE_CRASH();
}

bool Process::IsValid() const {
  return process_.is_valid() || is_current();
}

ProcessHandle Process::Handle() const {
  return is_current_process_ ? GetCurrentProcess() : process_.get();
}

Process Process::Duplicate() const {
  if (is_current())
    return Current();

  ProcessHandle out_handle;
  if (!IsValid() || !::DuplicateHandle(GetCurrentProcess(),
                                       Handle(),
                                       GetCurrentProcess(),
                                       &out_handle,
                                       0,
                                       FALSE,
                                       DUPLICATE_SAME_ACCESS)) {
    return Process();
  }
  return Process(out_handle);
}

ProcessHandle Process::Release() {
  if (is_current())
    return ::GetCurrentProcess();
  return process_.release();
}

ProcessId Process::Pid() const {
  DCHECK(IsValid());
  return GetProcId(Handle());
}

Time Process::CreationTime() const {
  FILETIME creation_time = {};
  FILETIME ignore1 = {};
  FILETIME ignore2 = {};
  FILETIME ignore3 = {};
  if (!::GetProcessTimes(Handle(), &creation_time, &ignore1, &ignore2,
                         &ignore3)) {
    return Time();
  }
  return Time::FromFileTime(creation_time);
}

bool Process::is_current() const {
  return is_current_process_;
}

void Process::Close() {
  is_current_process_ = false;
  if (!process_.is_valid())
    return;

  process_.Close();
}

bool Process::Terminate(int exit_code, bool wait) const {
  constexpr DWORD kWaitMs = 60 * 1000;

  DCHECK(IsValid());
  bool result = (::TerminateProcess(Handle(), exit_code) != FALSE);
  if (result) {
    // The process may not end immediately due to pending I/O
    if (wait && ::WaitForSingleObject(Handle(), kWaitMs) != WAIT_OBJECT_0)
      DPLOG(ERROR) << "Error waiting for process exit";
    Exited(exit_code);
  } else {
    // The process can't be terminated, perhaps because it has already exited or
    // is in the process of exiting. An error code of ERROR_ACCESS_DENIED is the
    // undocumented-but-expected result if the process has already exited or
    // started exiting when TerminateProcess is called, so don't print an error
    // message in that case.
    if (GetLastError() != ERROR_ACCESS_DENIED)
      DPLOG(ERROR) << "Unable to terminate process";
    // A non-zero timeout is necessary here for the same reasons as above.
    if (::WaitForSingleObject(Handle(), kWaitMs) == WAIT_OBJECT_0) {
      DWORD actual_exit;
      Exited(::GetExitCodeProcess(Handle(), &actual_exit) ? actual_exit
                                                          : exit_code);
      result = true;
    }
  }
  return result;
}

Process::WaitExitStatus Process::WaitForExitOrEvent(
    const base::win::ScopedHandle& stop_event_handle,
    int* exit_code) const {
  // Record the event that this thread is blocking upon (for hang diagnosis).
  base::debug::ScopedProcessWaitActivity process_activity(this);

  HANDLE events[] = {Handle(), stop_event_handle.get()};
  DWORD wait_result =
      ::WaitForMultipleObjects(std::size(events), events, FALSE, INFINITE);

  if (wait_result == WAIT_OBJECT_0) {
    DWORD temp_code;  // Don't clobber out-parameters in case of failure.
    if (!::GetExitCodeProcess(Handle(), &temp_code))
      return Process::WaitExitStatus::FAILED;

    if (exit_code)
      *exit_code = temp_code;

    Exited(temp_code);
    return Process::WaitExitStatus::PROCESS_EXITED;
  }

  if (wait_result == WAIT_OBJECT_0 + 1) {
    return Process::WaitExitStatus::STOP_EVENT_SIGNALED;
  }

  return Process::WaitExitStatus::FAILED;
}

bool Process::WaitForExit(int* exit_code) const {
  return WaitForExitWithTimeout(TimeDelta::Max(), exit_code);
}

bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const {
  TRACE_EVENT0("base", "Process::WaitForExitWithTimeout");

  // Record the event that this thread is blocking upon (for hang diagnosis).
  absl::optional<debug::ScopedProcessWaitActivity> process_activity;
  if (!timeout.is_zero()) {
    process_activity.emplace(this);
    // Assert that this thread is allowed to wait below. This intentionally
    // doesn't use ScopedBlockingCallWithBaseSyncPrimitives because the process
    // being waited upon tends to itself be using the CPU and considering this
    // thread non-busy causes more issue than it fixes: http://crbug.com/905788
    internal::AssertBaseSyncPrimitivesAllowed();
  }

  // Limit timeout to INFINITE.
  DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds());
  if (::WaitForSingleObject(Handle(), timeout_ms) != WAIT_OBJECT_0)
    return false;

  DWORD temp_code;  // Don't clobber out-parameters in case of failure.
  if (!::GetExitCodeProcess(Handle(), &temp_code))
    return false;

  if (exit_code)
    *exit_code = temp_code;

  Exited(temp_code);
  return true;
}

void Process::Exited(int exit_code) const {
  base::debug::GlobalActivityTracker::RecordProcessExitIfEnabled(Pid(),
                                                                 exit_code);
}

bool Process::IsProcessBackgrounded() const {
  DCHECK(IsValid());
  DWORD priority = GetPriority();
  if (priority == 0)
    return false;  // Failure case.
  return ((priority == BELOW_NORMAL_PRIORITY_CLASS) ||
          (priority == IDLE_PRIORITY_CLASS));
}

bool Process::SetProcessBackgrounded(bool value) {
  DCHECK(IsValid());
  // Vista and above introduce a real background mode, which not only
  // sets the priority class on the threads but also on the IO generated
  // by it. Unfortunately it can only be set for the calling process.
  DWORD priority;
  if (is_current()) {
    priority = value ? PROCESS_MODE_BACKGROUND_BEGIN :
                       PROCESS_MODE_BACKGROUND_END;
  } else {
    priority = value ? IDLE_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS;
  }

  return (::SetPriorityClass(Handle(), priority) != 0);
}

int Process::GetPriority() const {
  DCHECK(IsValid());
  return ::GetPriorityClass(Handle());
}

}  // namespace base


text:
using System.ComponentModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Ravelin.Models.Enums;

namespace Ravelin.Models
{
	public class Score
	{
		/// <summary>
		/// Identifier for this customer, as supplied by the client
		/// </summary>
		public string CustomerId { get; set; }

		/// <summary>
		/// Action to take for this customer, according to Ravelin. One of ALLOW, REVIEW, PREVENT.
		/// </summary>
		public ScoreAction Action { get; set; }

		/// <summary>
		/// Ravelin score for this customer as an integer. Debugging purposes only
		/// </summary>
		[JsonProperty(PropertyName = "score")]
		public int ScoreValue { get; set; }

		/// <summary>
		/// Source of the score (e.g. RAVELIN or MANUAL_REVIEW)
		/// </summary>
		public string Source { get; set; }

		/// <summary>
		/// Unique identifier for this score or callback
		/// </summary>
		public string ScoreId { get; set; }

		/// <summary>
		/// In the case of manual review, this is the comment left by the reviewer on this particular review action
		/// </summary>
		public string Comment { get; set; }
	}
}


text:
@interface SAMergesort : NSObject

+ (void)sort:(NSMutableArray *)array;

@end


text:
typedef int SOCKET;
typedef sockaddr_in SOCKADDR_IN;
typedef sockaddr SOCKADDR;
typedef in_addr IN_ADDR;
typedef protoent PROTOENT;
# define INVALID_SOCKET -1
# define SOCKET_ERROR -1
# define closesocket(s) close(s)

# ifndef SLEEPMS
#  define SLEEPMS(c) usleep(c * 1000)
# endif

#endif

#include "SocketErrors.hpp"

#endif


text:
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpc/support/port_platform.h>

#include "src/core/ext/transport/binder/wire_format/wire_writer.h"

#ifndef GRPC_NO_BINDER

#include <utility>

#include "absl/cleanup/cleanup.h"
#include "absl/types/variant.h"

#include <grpc/support/log.h>

#define RETURN_IF_ERROR(expr)           \
  do {                                  \
    const absl::Status status = (expr); \
    if (!status.ok()) return status;    \
  } while (0)

namespace grpc_binder {

bool CanBeSentInOneTransaction(const Transaction& tx) {
  return (tx.GetFlags() & kFlagMessageData) == 0 ||
         static_cast<int64_t>(tx.GetMessageData().size()) <=
             WireWriterImpl::kBlockSize;
}

// Simply forward the call to `WireWriterImpl::RunScheduledTx`.
void RunScheduledTx(void* arg, grpc_error_handle /*error*/) {
  auto* run_scheduled_tx_args =
      static_cast<WireWriterImpl::RunScheduledTxArgs*>(arg);
  run_scheduled_tx_args->writer->RunScheduledTxInternal(run_scheduled_tx_args);
}

absl::Status WriteInitialMetadata(const Transaction& tx,
                                  WritableParcel* parcel) {
  if (tx.IsClient()) {
    // Only client sends method ref.
    RETURN_IF_ERROR(parcel->WriteString(tx.GetMethodRef()));
  }
  RETURN_IF_ERROR(parcel->WriteInt32(tx.GetPrefixMetadata().size()));
  for (const auto& md : tx.GetPrefixMetadata()) {
    RETURN_IF_ERROR(parcel->WriteByteArrayWithLength(md.first));
    RETURN_IF_ERROR(parcel->WriteByteArrayWithLength(md.second));
  }
  return absl::OkStatus();
}

absl::Status WriteTrailingMetadata(const Transaction& tx,
                                   WritableParcel* parcel) {
  if (tx.IsServer()) {
    if (tx.GetFlags() & kFlagStatusDescription) {
      RETURN_IF_ERROR(parcel->WriteString(tx.GetStatusDesc()));
    }
    RETURN_IF_ERROR(parcel->WriteInt32(tx.GetSuffixMetadata().size()));
    for (const auto& md : tx.GetSuffixMetadata()) {
      RETURN_IF_ERROR(parcel->WriteByteArrayWithLength(md.first));
      RETURN_IF_ERROR(parcel->WriteByteArrayWithLength(md.second));
    }
  } else {
    // client suffix currently is always empty according to the wireformat
    if (!tx.GetSuffixMetadata().empty()) {
      gpr_log(GPR_ERROR, "Got non-empty suffix metadata from client.");
    }
  }
  return absl::OkStatus();
}

WireWriterImpl::WireWriterImpl(std::unique_ptr<Binder> binder)
    : binder_(std::move(binder)), combiner_(grpc_combiner_create()) {}

WireWriterImpl::~WireWriterImpl() {
  GRPC_COMBINER_UNREF(combiner_, "wire_writer_impl");
  while (!pending_outgoing_tx_.empty()) {
    delete pending_outgoing_tx_.front();
    pending_outgoing_tx_.pop();
  }
}

// Flow control constant are specified at
// https://github.com/grpc/proposal/blob/master/L73-java-binderchannel/wireformat.md#flow-control
const int64_t WireWriterImpl::kBlockSize = 16 * 1024;
const int64_t WireWriterImpl::kFlowControlWindowSize = 128 * 1024;

absl::Status WireWriterImpl::MakeBinderTransaction(
    BinderTransportTxCode tx_code,
    std::function<absl::Status(WritableParcel*)> fill_parcel) {
  grpc_core::MutexLock lock(&write_mu_);
  RETURN_IF_ERROR(binder_->PrepareTransaction());
  WritableParcel* parcel = binder_->GetWritableParcel();
  RETURN_IF_ERROR(fill_parcel(parcel));
  // Only stream transaction is accounted in flow control spec.
  if (static_cast<int32_t>(tx_code) >= kFirstCallId) {
    int64_t parcel_size = parcel->GetDataSize();
    if (parcel_size > 2 * kBlockSize) {
      gpr_log(GPR_ERROR,
              "Unexpected large transaction (possibly caused by a very large "
              "metadata). This might overflow the binder "
              "transaction buffer. Size: %" PRId64 " bytes",
              parcel_size);
    }
    num_outgoing_bytes_ += parcel_size;
    gpr_log(GPR_INFO, "Total outgoing bytes: %" PRId64,
            num_outgoing_bytes_.load());
  }
  GPR_ASSERT(!is_transacting_);
  is_transacting_ = true;
  absl::Status result = binder_->Transact(tx_code);
  is_transacting_ = false;
  return result;
}

absl::Status WireWriterImpl::RpcCallFastPath(std::unique_ptr<Transaction> tx) {
  return MakeBinderTransaction(
      BinderTransportTxCode(tx->GetTxCode()),
      [this, tx = tx.get()](
          WritableParcel* parcel) ABSL_EXCLUSIVE_LOCKS_REQUIRED(write_mu_) {
        RETURN_IF_ERROR(parcel->WriteInt32(tx->GetFlags()));
        RETURN_IF_ERROR(parcel->WriteInt32(next_seq_num_[tx->GetTxCode()]++));
        if (tx->GetFlags() & kFlagPrefix) {
          RETURN_IF_ERROR(WriteInitialMetadata(*tx, parcel));
        }
        if (tx->GetFlags() & kFlagMessageData) {
          RETURN_IF_ERROR(
              parcel->WriteByteArrayWithLength(tx->GetMessageData()));
        }
        if (tx->GetFlags() & kFlagSuffix) {
          RETURN_IF_ERROR(WriteTrailingMetadata(*tx, parcel));
        }
        return absl::OkStatus();
      });
}

absl::Status WireWriterImpl::RunStreamTx(
    RunScheduledTxArgs::StreamTx* stream_tx, WritableParcel* parcel,
    bool* is_last_chunk) {
  Transaction* tx = stream_tx->tx.get();
  // Transaction without data flag should go to fast path.
  GPR_ASSERT(tx->GetFlags() & kFlagMessageData);

  absl::string_view data = tx->GetMessageData();
  GPR_ASSERT(stream_tx->bytes_sent <= static_cast<int64_t>(data.size()));

  int flags = kFlagMessageData;

  if (stream_tx->bytes_sent == 0) {
    // This is the first transaction. Include initial
    // metadata if there's any.
    if (tx->GetFlags() & kFlagPrefix) {
      flags |= kFlagPrefix;
    }
  }
  // There is also prefix/suffix in transaction beside the transaction data so
  // actual transaction size will be greater than `kBlockSize`. This is
  // unavoidable because we cannot split the prefix metadata and trailing
  // metadata into different binder transactions. In most cases this is fine
  // because single transaction size is not required to be strictly lower than
  // `kBlockSize`, as long as it won't overflow Android's binder buffer.
  int64_t size = std::min<int64_t>(WireWriterImpl::kBlockSize,
                                   data.size() - stream_tx->bytes_sent);
  if (stream_tx->bytes_sent + WireWriterImpl::kBlockSize >=
      static_cast<int64_t>(data.size())) {
    // This is the last transaction. Include trailing
    // metadata if there's any.
    if (tx->GetFlags() & kFlagSuffix) {
      flags |= kFlagSuffix;
    }
    size = data.size() - stream_tx->bytes_sent;
    *is_last_chunk = true;
  } else {
    // There are more messages to send.
    flags |= kFlagMessageDataIsPartial;
    *is_last_chunk = false;
  }
  RETURN_IF_ERROR(parcel->WriteInt32(flags));
  RETURN_IF_ERROR(parcel->WriteInt32(next_seq_num_[tx->GetTxCode()]++));
  if (flags & kFlagPrefix) {
    RETURN_IF_ERROR(WriteInitialMetadata(*tx, parcel));
  }
  RETURN_IF_ERROR(parcel->WriteByteArrayWithLength(
      data.substr(stream_tx->bytes_sent, size)));
  if (flags & kFlagSuffix) {
    RETURN_IF_ERROR(WriteTrailingMetadata(*tx, parcel));
  }
  stream_tx->bytes_sent += size;
  return absl::OkStatus();
}

void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
  GPR_ASSERT(args->writer == this);
  if (absl::holds_alternative<RunScheduledTxArgs::AckTx>(args->tx)) {
    int64_t num_bytes =
        absl::get<RunScheduledTxArgs::AckTx>(args->tx).num_bytes;
    absl::Status result =
        MakeBinderTransaction(BinderTransportTxCode::ACKNOWLEDGE_BYTES,
                              [num_bytes](WritableParcel* parcel) {
                                RETURN_IF_ERROR(parcel->WriteInt64(num_bytes));
                                return absl::OkStatus();
                              });
    if (!result.ok()) {
      gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
              result.ToString().c_str());
    }
    delete args;
    return;
  }
  GPR_ASSERT(absl::holds_alternative<RunScheduledTxArgs::StreamTx>(args->tx));
  RunScheduledTxArgs::StreamTx* stream_tx =
      &absl::get<RunScheduledTxArgs::StreamTx>(args->tx);
  // Be reservative. Decrease CombinerTxCount after the data size of this
  // transaction has already been added to `num_outgoing_bytes_`, to make sure
  // we never underestimate `num_outgoing_bytes_`.
  auto decrease_combiner_tx_count = absl::MakeCleanup([this]() {
    {
      grpc_core::MutexLock lock(&flow_control_mu_);
      GPR_ASSERT(num_non_acked_tx_in_combiner_ > 0);
      num_non_acked_tx_in_combiner_--;
    }
    // New transaction might be ready to be scheduled.
    TryScheduleTransaction();
  });
  if (CanBeSentInOneTransaction(*stream_tx->tx.get())) {  // NOLINT
    absl::Status result = RpcCallFastPath(std::move(stream_tx->tx));
    if (!result.ok()) {
      gpr_log(GPR_ERROR, "Failed to handle non-chunked RPC call %s",
              result.ToString().c_str());
    }
    delete args;
    return;
  }
  bool is_last_chunk = true;
  absl::Status result = MakeBinderTransaction(
      BinderTransportTxCode(stream_tx->tx->GetTxCode()),
      [stream_tx, &is_last_chunk, this](WritableParcel* parcel)
          ABSL_EXCLUSIVE_LOCKS_REQUIRED(write_mu_) {
            return RunStreamTx(stream_tx, parcel, &is_last_chunk);
          });
  if (!result.ok()) {
    gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
            result.ToString().c_str());
  }
  if (!is_last_chunk) {
    {
      grpc_core::MutexLock lock(&flow_control_mu_);
      pending_outgoing_tx_.push(args);
    }
    TryScheduleTransaction();
  } else {
    delete args;
  }
}

absl::Status WireWriterImpl::RpcCall(std::unique_ptr<Transaction> tx) {
  // TODO(mingcl): check tx_code <= last call id
  GPR_ASSERT(tx->GetTxCode() >= kFirstCallId);
  auto args = new RunScheduledTxArgs();
  args->writer = this;
  args->tx = RunScheduledTxArgs::StreamTx();
  absl::get<RunScheduledTxArgs::StreamTx>(args->tx).tx = std::move(tx);
  absl::get<RunScheduledTxArgs::StreamTx>(args->tx).bytes_sent = 0;
  {
    grpc_core::MutexLock lock(&flow_control_mu_);
    pending_outgoing_tx_.push(args);
  }
  TryScheduleTransaction();
  return absl::OkStatus();
}

absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
  // Ensure combiner will be run if this is not called from top-level gRPC API
  // entrypoint.
  grpc_core::ExecCtx exec_ctx;
  gpr_log(GPR_INFO, "Ack %" PRId64 " bytes received", num_bytes);
  if (is_transacting_) {
    // This can happen because NDK might call our registered callback function
    // in the same thread while we are telling it to send a transaction
    // `is_transacting_` will be true. `Binder::Transact` is now being called on
    // the same thread or the other thread. We are currently in the call stack
    // of other transaction, Liveness of ACK is still guaranteed even if this is
    // a race with another thread.
    gpr_log(
        GPR_INFO,
        "Scheduling ACK transaction instead of directly execute it to avoid "
        "deadlock.");
    auto args = new RunScheduledTxArgs();
    args->writer = this;
    args->tx = RunScheduledTxArgs::AckTx();
    absl::get<RunScheduledTxArgs::AckTx>(args->tx).num_bytes = num_bytes;
    auto cl = GRPC_CLOSURE_CREATE(RunScheduledTx, args, nullptr);
    combiner_->Run(cl, GRPC_ERROR_NONE);
    return absl::OkStatus();
  }
  // Otherwise, we can directly send ack.
  absl::Status result = MakeBinderTransaction(
      BinderTransportTxCode(BinderTransportTxCode::ACKNOWLEDGE_BYTES),
      [num_bytes](WritableParcel* parcel) {
        RETURN_IF_ERROR(parcel->WriteInt64(num_bytes));
        return absl::OkStatus();
      });
  if (!result.ok()) {
    gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
            result.ToString().c_str());
  }
  return result;
}

void WireWriterImpl::OnAckReceived(int64_t num_bytes) {
  // Ensure combiner will be run if this is not called from top-level gRPC API
  // entrypoint.
  grpc_core::ExecCtx exec_ctx;
  gpr_log(GPR_INFO, "OnAckReceived %" PRId64, num_bytes);
  // Do not try to obtain `write_mu_` in this function. NDKBinder might invoke
  // the callback to notify us about new incoming binder transaction when we are
  // sending transaction. i.e. `write_mu_` might have already been acquired by
  // this thread.
  {
    grpc_core::MutexLock lock(&flow_control_mu_);
    num_acknowledged_bytes_ = std::max(num_acknowledged_bytes_, num_bytes);
    int64_t num_outgoing_bytes = num_outgoing_bytes_;
    if (num_acknowledged_bytes_ > num_outgoing_bytes) {
      gpr_log(GPR_ERROR,
              "The other end of transport acked more bytes than we ever sent, "
              "%" PRId64 " > %" PRId64,
              num_acknowledged_bytes_, num_outgoing_bytes);
    }
  }
  TryScheduleTransaction();
}

void WireWriterImpl::TryScheduleTransaction() {
  while (true) {
    grpc_core::MutexLock lock(&flow_control_mu_);
    if (pending_outgoing_tx_.empty()) {
      // Nothing to be schduled.
      break;
    }
    // Number of bytes we have scheduled in combiner but have not yet be
    // executed by combiner. Here we make an assumption that every binder
    // transaction will take `kBlockSize`. This should be close to truth when a
    // large message is being cut to `kBlockSize` chunks.
    int64_t num_bytes_scheduled_in_combiner =
        num_non_acked_tx_in_combiner_ * kBlockSize;
    // An estimation of number of bytes of traffic we will eventually send to
    // the other end, assuming all tasks in combiner will be executed and we
    // receive no new ACK from the other end of transport.
    int64_t num_total_bytes_will_be_sent =
        num_outgoing_bytes_ + num_bytes_scheduled_in_combiner;
    // An estimation of number of bytes of traffic that will not be
    // acknowledged, assuming all tasks in combiner will be executed and we
    // receive no new ack message fomr the other end of transport.
    int64_t num_non_acked_bytes_estimation =
        num_total_bytes_will_be_sent - num_acknowledged_bytes_;
    if (num_non_acked_bytes_estimation < 0) {
      gpr_log(
          GPR_ERROR,
          "Something went wrong. `num_non_acked_bytes_estimation` should be "
          "non-negative but it is %" PRId64,
          num_non_acked_bytes_estimation);
    }
    // If we can schedule another transaction (which has size estimation of
    // `kBlockSize`) without exceeding `kFlowControlWindowSize`, schedule it.
    if ((num_non_acked_bytes_estimation + kBlockSize <
         kFlowControlWindowSize)) {
      num_non_acked_tx_in_combiner_++;
      combiner_->Run(GRPC_CLOSURE_CREATE(RunScheduledTx,
                                         pending_outgoing_tx_.front(), nullptr),
                     GRPC_ERROR_NONE);
      pending_outgoing_tx_.pop();
    } else {
      // It is common to fill `kFlowControlWindowSize` completely because
      // transactions are send at faster rate than the other end of transport
      // can handle it, so here we use `GPR_DEBUG` log level.
      gpr_log(GPR_DEBUG,
              "Some work cannot be scheduled yet due to slow ack from the "
              "other end of transport. This transport might be blocked if this "
              "number don't go down. pending_outgoing_tx_.size() = %zu "
              "pending_outgoing_tx_.front() = %p",
              pending_outgoing_tx_.size(), pending_outgoing_tx_.front());
      break;
    }
  }
}

}  // namespace grpc_binder

#endif


text:
package ulima.isw2.expoulima;

import ulima.somoviles.expoulima.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class MainActivity extends Activity implements OnClickListener{
	private ImageView iviUno, iviDos;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		iviUno = (ImageView) findViewById(R.id.iviUno);
		iviDos = (ImageView) findViewById(R.id.iviDos);

		iviUno.setOnClickListener(this);
		iviDos.setOnClickListener(this);
	}

	@Override
	public void onClick(View view) {
		if (view.getId() == R.id.iviUno){

		}else if (view.getId() == R.id.iviDos){
			Intent intent = new Intent();
			intent.putExtra("PARAM1", "android rulez");
			intent.putExtra("PARAM2", 11235);
			intent.setClass(this, InscribeteActivity.class);

			startActivity(intent);
		}
	}
}


text:
import {
  _, Component, component, Events, onMouseOut, onMouseOver, containsRelatedTarget, invalidate, render,
} from "ivi";
import { div } from "ivi-html";

function useHover(c: Component) {
  let v = false;
  return {
    state: () => v,
    events: [
      onMouseOver((ev) => {
        if (!containsRelatedTarget(ev)) {
          v = true;
          invalidate(c);
        }
      }),
      onMouseOut((ev) => {
        if (!containsRelatedTarget(ev)) {
          v = false;
          invalidate(c);
        }
      }),
    ],
  };
}

const Row = component((c) => {
  const hover = useHover(c);
  return () => (
    div("row", _,
      Events(hover.events, [
        div(hover.state() ? "row row-hover" : "row"),
        div(hover.state() ? "row row-hover" : "row"),
      ]),
    )
  );
});

const Collection = component((c) => {
  const hover = useHover(c);
  return () => (
    div(hover.state() ? "collection collection-hover" : "collection", _,
      // hover events will be triggered only when mouse goes over internal rows
      Events(hover.events, [
        Row(),
        Row(),
        Row(),
      ]),
    )
  );
});

render(Collection(), document.getElementById("app")!);


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

// DO NOT EDIT. GENERATED BY 'gomobile help documentation doc.go'.

/*
Gomobile is a tool for building and running mobile apps written in Go.

To install:

	$ go get golang.org/x/mobile/cmd/gomobile
	$ gomobile init

At least Go 1.5 is required.
For detailed instructions, see https://golang.org/wiki/Mobile.

Usage:

	gomobile command [arguments]

Commands:

	bind        build a shared library for android APK and iOS app
	build       compile android APK and iOS app
	init        install android compiler toolchain
	install     compile android APK and install on device
	version     print version

Use 'gomobile help [command]' for more information about that command.

Build a shared library for android APK and iOS app

Usage:

	gomobile bind [-target android|ios] [-o output] [build flags] [package]

Bind generates language bindings for the package named by the import
path, and compiles a library for the named target system.

The -target flag takes a target system name, either android (the
default) or ios.

For -target android, the bind command produces an AAR (Android ARchive)
file that archives the precompiled Java API stub classes, the compiled
shared libraries, and all asset files in the /assets subdirectory under
the package directory. The output is named '<package_name>.aar' by
default. This AAR file is commonly used for binary distribution of an
Android library project and most Android IDEs support AAR import. For
example, in Android Studio (1.2+), an AAR file can be imported using
the module import wizard (File > New > New Module > Import .JAR or
.AAR package), and setting it as a new dependency
(File > Project Structure > Dependencies).  This requires 'javac'
(version 1.7+) and Android SDK (API level 9 or newer) to build the
library for Android. The environment variable ANDROID_HOME must be set
to the path to Android SDK.

For -target ios, gomobile must be run on an OS X machine with Xcode
installed. Support is not complete.

The -v flag provides verbose output, including the list of packages built.

The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work
are shared with the build command. For documentation, see 'go help build'.

Compile android APK and iOS app

Usage:

	gomobile build [-target android|ios] [-o output] [build flags] [package]

Build compiles and encodes the app named by the import path.

The named package must define a main function.

The -target flag takes a target system name, either android (the
default) or ios.

For -target android, if an AndroidManifest.xml is defined in the
package directory, it is added to the APK output. Otherwise, a default
manifest is generated.

For -target ios, gomobile must be run on an OS X machine with Xcode
installed. Support is not complete.

If the package directory contains an assets subdirectory, its contents
are copied into the output.

The -o flag specifies the output file name. If not specified, the
output file name depends on the package built.

The -v flag provides verbose output, including the list of packages built.

The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work are
shared with the build command. For documentation, see 'go help build'.

Install android compiler toolchain

Usage:

	gomobile init [-u]

Init installs the Android C++ compiler toolchain and builds copies
of the Go standard library for mobile devices.

When first run, it downloads part of the Android NDK.
The toolchain is installed in $GOPATH/pkg/gomobile.

The -u option forces download and installation of the new toolchain
even when the toolchain exists.

Compile android APK and install on device

Usage:

	gomobile install [-target android] [build flags] [package]

Install compiles and installs the app named by the import path on the
attached mobile device.

Only -target android is supported. The 'adb' tool must be on the PATH.

The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work are
shared with the build command.
For documentation, see 'go help build'.

Print version

Usage:

	gomobile version

Version prints versions of the gomobile binary and tools
*/
package main


text:
from batchq.core.batch import Shell
#from profilehooks import profile
## CreateTemporaryDirectory( )
## DeleteDirectory( )

class CreateDirectory(Shell):
    def __init__(self, terminal, directory, working_directory = None,
                 intermediate=True, dependencies=None, identifier = None,
                 **kwargs):
        self.directory = directory
        self.intermediate =  intermediate
        self._was_executed = False

        super(CreateDirectory,self).__init__(terminal, working_directory = working_directory, dependencies = dependencies,identifier = identifier,**kwargs)

    def state(self):
        super(CreateDirectory, self).state()
        if self._state == self.STATE.FINISHED: return self._state
        if self._state == self.STATE.QUEUED: return self._state

        if self.terminal.isdir(self.directory):
            self._state = self.STATE.FINISHED
        elif self._was_executed:
            self._state = self.STATE.FAILED

        return self._state

#    @profile(immediate=True)
    def run(self):
        super(CreateDirectory,self).run()
        if self.state() != self.STATE.READY:
            return False
        self._pushw()
        try:
            if self.terminal.mkdir(self.directory, self.intermediate):
                self._state = self.STATE.FINISHED
            self._was_executed = True
        except:
            self._popw()
            raise
        self._popw()
        return True


text:
package es.ucm.gpd.irparser.ast.expr.case_;

import es.ucm.gpd.irparser.ast.VariableDeclaration;
import es.ucm.sexp.SexpParser;

import java.util.Collections;
import java.util.List;

import static es.ucm.gpd.irparser.ast.ASTUtils.*;

/**
 * @author Santiago Saavedra
 */
public class CasePatternConstructorApplication implements
        CasePattern {
    private final String constructorName;
    private final List<VariableDeclaration> arguments;

    public CasePatternConstructorApplication(String constructorName, List<VariableDeclaration> arguments) {

        this.constructorName = constructorName;
        this.arguments = arguments;
    }

    public String getConstructorName() {
        return constructorName;
    }

    public List<VariableDeclaration> getArguments() {
        return Collections.unmodifiableList(arguments);
    }

    @Override
    public SexpParser.Expr unparse() {
        return reverseConsAfter(
                unparseList(arguments),

                atom("@@"),
                atom(constructorName)
        );
    }
}