text:
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: network_firewall
using AWS.Compat
using AWS.UUIDs

"""
    AssociateFirewallPolicy()

Associates a FirewallPolicy to a Firewall.  A firewall policy defines how to monitor and manage your VPC network traffic, using a collection of inspection rule groups and other settings. Each firewall requires one firewall policy association, and you can use the same firewall policy for multiple firewalls.

# Required Parameters
- `FirewallPolicyArn`: The Amazon Resource Name (ARN) of the firewall policy.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
associate_firewall_policy(FirewallPolicyArn; aws_config::AWSConfig=global_aws_config()) = network_firewall("AssociateFirewallPolicy", Dict{String, Any}("FirewallPolicyArn"=>FirewallPolicyArn); aws_config=aws_config)
associate_firewall_policy(FirewallPolicyArn, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("AssociateFirewallPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FirewallPolicyArn"=>FirewallPolicyArn), args)); aws_config=aws_config)

"""
    AssociateSubnets()

Associates the specified subnets in the Amazon VPC to the firewall. You can specify one subnet for each of the Availability Zones that the VPC spans.  This request creates an AWS Network Firewall firewall endpoint in each of the subnets. To enable the firewall's protections, you must also modify the VPC's route tables for each subnet's Availability Zone, to redirect the traffic that's coming into and going out of the zone through the firewall endpoint.

# Required Parameters
- `SubnetMappings`: The IDs of the subnets that you want to associate with the firewall.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
associate_subnets(SubnetMappings; aws_config::AWSConfig=global_aws_config()) = network_firewall("AssociateSubnets", Dict{String, Any}("SubnetMappings"=>SubnetMappings); aws_config=aws_config)
associate_subnets(SubnetMappings, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("AssociateSubnets", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("SubnetMappings"=>SubnetMappings), args)); aws_config=aws_config)

"""
    CreateFirewall()

Creates an AWS Network Firewall Firewall and accompanying FirewallStatus for a VPC.  The firewall defines the configuration settings for an AWS Network Firewall firewall. The settings that you can define at creation include the firewall policy, the subnets in your VPC to use for the firewall endpoints, and any tags that are attached to the firewall AWS resource.  After you create a firewall, you can provide additional settings, like the logging configuration.  To update the settings for a firewall, you use the operations that apply to the settings themselves, for example UpdateLoggingConfiguration, AssociateSubnets, and UpdateFirewallDeleteProtection.  To manage a firewall's tags, use the standard AWS resource tagging operations, ListTagsForResource, TagResource, and UntagResource. To retrieve information about firewalls, use ListFirewalls and DescribeFirewall.

# Required Parameters
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it.
- `FirewallPolicyArn`: The Amazon Resource Name (ARN) of the FirewallPolicy that you want to use for the firewall.
- `SubnetMappings`: The public subnets to use for your Network Firewall firewalls. Each subnet must belong to a different Availability Zone in the VPC. Network Firewall creates a firewall endpoint in each subnet.
- `VpcId`: The unique identifier of the VPC where Network Firewall should create the firewall.  You can't change this setting after you create the firewall.

# Optional Parameters
- `DeleteProtection`: A flag indicating whether it is possible to delete the firewall. A setting of TRUE indicates that the firewall is protected against deletion. Use this setting to protect against accidentally deleting a firewall that is in use. When you create a firewall, the operation initializes this flag to TRUE.
- `Description`: A description of the firewall.
- `FirewallPolicyChangeProtection`: A setting indicating whether the firewall is protected against a change to the firewall policy association. Use this setting to protect against accidentally modifying the firewall policy for a firewall that is in use. When you create a firewall, the operation initializes this setting to TRUE.
- `SubnetChangeProtection`: A setting indicating whether the firewall is protected against changes to the subnet associations. Use this setting to protect against accidentally modifying the subnet associations for a firewall that is in use. When you create a firewall, the operation initializes this setting to TRUE.
- `Tags`: The key:value pairs to associate with the resource.
"""
create_firewall(FirewallName, FirewallPolicyArn, SubnetMappings, VpcId; aws_config::AWSConfig=global_aws_config()) = network_firewall("CreateFirewall", Dict{String, Any}("FirewallName"=>FirewallName, "FirewallPolicyArn"=>FirewallPolicyArn, "SubnetMappings"=>SubnetMappings, "VpcId"=>VpcId); aws_config=aws_config)
create_firewall(FirewallName, FirewallPolicyArn, SubnetMappings, VpcId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("CreateFirewall", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FirewallName"=>FirewallName, "FirewallPolicyArn"=>FirewallPolicyArn, "SubnetMappings"=>SubnetMappings, "VpcId"=>VpcId), args)); aws_config=aws_config)

"""
    CreateFirewallPolicy()

Creates the firewall policy for the firewall according to the specifications.  An AWS Network Firewall firewall policy defines the behavior of a firewall, in a collection of stateless and stateful rule groups and other settings. You can use one firewall policy for multiple firewalls.

# Required Parameters
- `FirewallPolicy`: The rule groups and policy actions to use in the firewall policy.
- `FirewallPolicyName`: The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it.

# Optional Parameters
- `Description`: A description of the firewall policy.
- `DryRun`: Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.  If set to TRUE, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to FALSE, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.  If set to FALSE, Network Firewall makes the requested changes to your resources.
- `Tags`: The key:value pairs to associate with the resource.
"""
create_firewall_policy(FirewallPolicy, FirewallPolicyName; aws_config::AWSConfig=global_aws_config()) = network_firewall("CreateFirewallPolicy", Dict{String, Any}("FirewallPolicy"=>FirewallPolicy, "FirewallPolicyName"=>FirewallPolicyName); aws_config=aws_config)
create_firewall_policy(FirewallPolicy, FirewallPolicyName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("CreateFirewallPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FirewallPolicy"=>FirewallPolicy, "FirewallPolicyName"=>FirewallPolicyName), args)); aws_config=aws_config)

"""
    CreateRuleGroup()

Creates the specified stateless or stateful rule group, which includes the rules for network traffic inspection, a capacity setting, and tags.  You provide your rule group specification in your request using either RuleGroup or Rules.

# Required Parameters
- `Capacity`: The maximum operating resources that this rule group can use. Rule group capacity is fixed at creation. When you update a rule group, you are limited to this capacity. When you reference a rule group from a firewall policy, Network Firewall reserves this capacity for the rule group.  You can retrieve the capacity that would be required for a rule group before you create the rule group by calling CreateRuleGroup with DryRun set to TRUE.   You can't change or exceed this capacity when you update the rule group, so leave room for your rule group to grow.    Capacity for a stateless rule group  For a stateless rule group, the capacity required is the sum of the capacity requirements of the individual rules that you expect to have in the rule group.  To calculate the capacity requirement of a single rule, multiply the capacity requirement values of each of the rule's match settings:   A match setting with no criteria specified has a value of 1.    A match setting with Any specified has a value of 1.    All other match settings have a value equal to the number of elements provided in the setting. For example, a protocol setting [\"UDP\"] and a source setting [\"10.0.0.0/24\"] each have a value of 1. A protocol setting [\"UDP\",\"TCP\"] has a value of 2. A source setting [\"10.0.0.0/24\",\"10.0.0.1/24\",\"10.0.0.2/24\"] has a value of 3.    A rule with no criteria specified in any of its match settings has a capacity requirement of 1. A rule with protocol setting [\"UDP\",\"TCP\"], source setting [\"10.0.0.0/24\",\"10.0.0.1/24\",\"10.0.0.2/24\"], and a single specification or no specification for each of the other match settings has a capacity requirement of 6.   Capacity for a stateful rule group  For a stateful rule group, the minimum capacity required is the number of individual rules that you expect to have in the rule group.
- `RuleGroupName`: The descriptive name of the rule group. You can't change the name of a rule group after you create it.
- `Type`: Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.

# Optional Parameters
- `Description`: A description of the rule group.
- `DryRun`: Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.  If set to TRUE, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to FALSE, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.  If set to FALSE, Network Firewall makes the requested changes to your resources.
- `RuleGroup`: An object that defines the rule group rules.   You must provide either this rule group setting or a Rules setting, but not both.
- `Rules`: The name of a file containing stateful rule group rules specifications in Suricata flat format, with one rule per line. Use this to import your existing Suricata compatible rule groups.   You must provide either this rules setting or a populated RuleGroup setting, but not both.   You can provide your rule group specification in a file through this setting when you create or update your rule group. The call response returns a RuleGroup object that Network Firewall has populated from your file. Network Firewall uses the file contents to populate the rule group rules, but does not maintain a reference to the file or use the file in any way after performing the create or update. If you call DescribeRuleGroup to retrieve the rule group, Network Firewall returns rules settings inside a RuleGroup object.
- `Tags`: The key:value pairs to associate with the resource.
"""
create_rule_group(Capacity, RuleGroupName, Type; aws_config::AWSConfig=global_aws_config()) = network_firewall("CreateRuleGroup", Dict{String, Any}("Capacity"=>Capacity, "RuleGroupName"=>RuleGroupName, "Type"=>Type); aws_config=aws_config)
create_rule_group(Capacity, RuleGroupName, Type, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("CreateRuleGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Capacity"=>Capacity, "RuleGroupName"=>RuleGroupName, "Type"=>Type), args)); aws_config=aws_config)

"""
    DeleteFirewall()

Deletes the specified Firewall and its FirewallStatus. This operation requires the firewall's DeleteProtection flag to be FALSE. You can't revert this operation.  You can check whether a firewall is in use by reviewing the route tables for the Availability Zones where you have firewall subnet mappings. Retrieve the subnet mappings by calling DescribeFirewall. You define and update the route tables through Amazon VPC. As needed, update the route tables for the zones to remove the firewall endpoints. When the route tables no longer use the firewall endpoints, you can remove the firewall safely. To delete a firewall, remove the delete protection if you need to using UpdateFirewallDeleteProtection, then delete the firewall by calling DeleteFirewall.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
"""
delete_firewall(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteFirewall"; aws_config=aws_config)
delete_firewall(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteFirewall", args; aws_config=aws_config)

"""
    DeleteFirewallPolicy()

Deletes the specified FirewallPolicy.

# Optional Parameters
- `FirewallPolicyArn`: The Amazon Resource Name (ARN) of the firewall policy. You must specify the ARN or the name, and you can specify both.
- `FirewallPolicyName`: The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it. You must specify the ARN or the name, and you can specify both.
"""
delete_firewall_policy(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteFirewallPolicy"; aws_config=aws_config)
delete_firewall_policy(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteFirewallPolicy", args; aws_config=aws_config)

"""
    DeleteResourcePolicy()

Deletes a resource policy that you created in a PutResourcePolicy request.

# Required Parameters
- `ResourceArn`: The Amazon Resource Name (ARN) of the rule group or firewall policy whose resource policy you want to delete.

"""
delete_resource_policy(ResourceArn; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteResourcePolicy", Dict{String, Any}("ResourceArn"=>ResourceArn); aws_config=aws_config)
delete_resource_policy(ResourceArn, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteResourcePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceArn"=>ResourceArn), args)); aws_config=aws_config)

"""
    DeleteRuleGroup()

Deletes the specified RuleGroup.

# Optional Parameters
- `RuleGroupArn`: The Amazon Resource Name (ARN) of the rule group. You must specify the ARN or the name, and you can specify both.
- `RuleGroupName`: The descriptive name of the rule group. You can't change the name of a rule group after you create it. You must specify the ARN or the name, and you can specify both.
- `Type`: Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.   This setting is required for requests that do not include the RuleGroupARN.
"""
delete_rule_group(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteRuleGroup"; aws_config=aws_config)
delete_rule_group(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DeleteRuleGroup", args; aws_config=aws_config)

"""
    DescribeFirewall()

Returns the data objects for the specified firewall.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
"""
describe_firewall(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeFirewall"; aws_config=aws_config)
describe_firewall(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeFirewall", args; aws_config=aws_config)

"""
    DescribeFirewallPolicy()

Returns the data objects for the specified firewall policy.

# Optional Parameters
- `FirewallPolicyArn`: The Amazon Resource Name (ARN) of the firewall policy. You must specify the ARN or the name, and you can specify both.
- `FirewallPolicyName`: The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it. You must specify the ARN or the name, and you can specify both.
"""
describe_firewall_policy(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeFirewallPolicy"; aws_config=aws_config)
describe_firewall_policy(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeFirewallPolicy", args; aws_config=aws_config)

"""
    DescribeLoggingConfiguration()

Returns the logging configuration for the specified firewall.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
"""
describe_logging_configuration(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeLoggingConfiguration"; aws_config=aws_config)
describe_logging_configuration(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeLoggingConfiguration", args; aws_config=aws_config)

"""
    DescribeResourcePolicy()

Retrieves a resource policy that you created in a PutResourcePolicy request.

# Required Parameters
- `ResourceArn`: The Amazon Resource Name (ARN) of the rule group or firewall policy whose resource policy you want to retrieve.

"""
describe_resource_policy(ResourceArn; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeResourcePolicy", Dict{String, Any}("ResourceArn"=>ResourceArn); aws_config=aws_config)
describe_resource_policy(ResourceArn, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeResourcePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceArn"=>ResourceArn), args)); aws_config=aws_config)

"""
    DescribeRuleGroup()

Returns the data objects for the specified rule group.

# Optional Parameters
- `RuleGroupArn`: The Amazon Resource Name (ARN) of the rule group. You must specify the ARN or the name, and you can specify both.
- `RuleGroupName`: The descriptive name of the rule group. You can't change the name of a rule group after you create it. You must specify the ARN or the name, and you can specify both.
- `Type`: Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.   This setting is required for requests that do not include the RuleGroupARN.
"""
describe_rule_group(; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeRuleGroup"; aws_config=aws_config)
describe_rule_group(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DescribeRuleGroup", args; aws_config=aws_config)

"""
    DisassociateSubnets()

Removes the specified subnet associations from the firewall. This removes the firewall endpoints from the subnets and removes any network filtering protections that the endpoints were providing.

# Required Parameters
- `SubnetIds`: The unique identifiers for the subnets that you want to disassociate.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
disassociate_subnets(SubnetIds; aws_config::AWSConfig=global_aws_config()) = network_firewall("DisassociateSubnets", Dict{String, Any}("SubnetIds"=>SubnetIds); aws_config=aws_config)
disassociate_subnets(SubnetIds, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("DisassociateSubnets", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("SubnetIds"=>SubnetIds), args)); aws_config=aws_config)

"""
    ListFirewallPolicies()

Retrieves the metadata for the firewall policies that you have defined. Depending on your setting for max results and the number of firewall policies, a single call might not return the full list.

# Optional Parameters
- `MaxResults`: The maximum number of objects that you want Network Firewall to return for this request. If more objects are available, in the response, Network Firewall provides a NextToken value that you can use in a subsequent call to get the next batch of objects.
- `NextToken`: When you request a list of objects with a MaxResults setting, if the number of objects that are still available for retrieval exceeds the maximum you requested, Network Firewall returns a NextToken value in the response. To retrieve the next batch of objects, use the token returned from the prior request in your next request.
"""
list_firewall_policies(; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListFirewallPolicies"; aws_config=aws_config)
list_firewall_policies(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListFirewallPolicies", args; aws_config=aws_config)

"""
    ListFirewalls()

Retrieves the metadata for the firewalls that you have defined. If you provide VPC identifiers in your request, this returns only the firewalls for those VPCs. Depending on your setting for max results and the number of firewalls, a single call might not return the full list.

# Optional Parameters
- `MaxResults`: The maximum number of objects that you want Network Firewall to return for this request. If more objects are available, in the response, Network Firewall provides a NextToken value that you can use in a subsequent call to get the next batch of objects.
- `NextToken`: When you request a list of objects with a MaxResults setting, if the number of objects that are still available for retrieval exceeds the maximum you requested, Network Firewall returns a NextToken value in the response. To retrieve the next batch of objects, use the token returned from the prior request in your next request.
- `VpcIds`: The unique identifiers of the VPCs that you want Network Firewall to retrieve the firewalls for. Leave this blank to retrieve all firewalls that you have defined.
"""
list_firewalls(; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListFirewalls"; aws_config=aws_config)
list_firewalls(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListFirewalls", args; aws_config=aws_config)

"""
    ListRuleGroups()

Retrieves the metadata for the rule groups that you have defined. Depending on your setting for max results and the number of rule groups, a single call might not return the full list.

# Optional Parameters
- `MaxResults`: The maximum number of objects that you want Network Firewall to return for this request. If more objects are available, in the response, Network Firewall provides a NextToken value that you can use in a subsequent call to get the next batch of objects.
- `NextToken`: When you request a list of objects with a MaxResults setting, if the number of objects that are still available for retrieval exceeds the maximum you requested, Network Firewall returns a NextToken value in the response. To retrieve the next batch of objects, use the token returned from the prior request in your next request.
"""
list_rule_groups(; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListRuleGroups"; aws_config=aws_config)
list_rule_groups(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListRuleGroups", args; aws_config=aws_config)

"""
    ListTagsForResource()

Retrieves the tags associated with the specified resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing. For example, you might set the tag key to \"customer\" and the value to the customer name or ID. You can specify one or more tags to add to each AWS resource, up to 50 tags for a resource. You can tag the AWS resources that you manage through AWS Network Firewall: firewalls, firewall policies, and rule groups.

# Required Parameters
- `ResourceArn`: The Amazon Resource Name (ARN) of the resource.

# Optional Parameters
- `MaxResults`: The maximum number of objects that you want Network Firewall to return for this request. If more objects are available, in the response, Network Firewall provides a NextToken value that you can use in a subsequent call to get the next batch of objects.
- `NextToken`: When you request a list of objects with a MaxResults setting, if the number of objects that are still available for retrieval exceeds the maximum you requested, Network Firewall returns a NextToken value in the response. To retrieve the next batch of objects, use the token returned from the prior request in your next request.
"""
list_tags_for_resource(ResourceArn; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListTagsForResource", Dict{String, Any}("ResourceArn"=>ResourceArn); aws_config=aws_config)
list_tags_for_resource(ResourceArn, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("ListTagsForResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceArn"=>ResourceArn), args)); aws_config=aws_config)

"""
    PutResourcePolicy()

Creates or updates an AWS Identity and Access Management policy for your rule group or firewall policy. Use this to share rule groups and firewall policies between accounts. This operation works in conjunction with the AWS Resource Access Manager (RAM) service to manage resource sharing for Network Firewall.  Use this operation to create or update a resource policy for your rule group or firewall policy. In the policy, you specify the accounts that you want to share the resource with and the operations that you want the accounts to be able to perform.  When you add an account in the resource policy, you then run the following Resource Access Manager (RAM) operations to access and accept the shared rule group or firewall policy.     GetResourceShareInvitations - Returns the Amazon Resource Names (ARNs) of the resource share invitations.     AcceptResourceShareInvitation - Accepts the share invitation for a specified resource share.    For additional information about resource sharing using RAM, see AWS Resource Access Manager User Guide.

# Required Parameters
- `Policy`: The AWS Identity and Access Management policy statement that lists the accounts that you want to share your rule group or firewall policy with and the operations that you want the accounts to be able to perform.  For a rule group resource, you can specify the following operations in the Actions section of the statement:   network-firewall:CreateFirewallPolicy   network-firewall:UpdateFirewallPolicy   network-firewall:ListRuleGroups   For a firewall policy resource, you can specify the following operations in the Actions section of the statement:   network-firewall:CreateFirewall   network-firewall:UpdateFirewall   network-firewall:AssociateFirewallPolicy   network-firewall:ListFirewallPolicies   In the Resource section of the statement, you specify the ARNs for the rule groups and firewall policies that you want to share with the account that you specified in Arn.
- `ResourceArn`: The Amazon Resource Name (ARN) of the account that you want to share rule groups and firewall policies with.

"""
put_resource_policy(Policy, ResourceArn; aws_config::AWSConfig=global_aws_config()) = network_firewall("PutResourcePolicy", Dict{String, Any}("Policy"=>Policy, "ResourceArn"=>ResourceArn); aws_config=aws_config)
put_resource_policy(Policy, ResourceArn, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("PutResourcePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Policy"=>Policy, "ResourceArn"=>ResourceArn), args)); aws_config=aws_config)

"""
    TagResource()

Adds the specified tags to the specified resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing. For example, you might set the tag key to \"customer\" and the value to the customer name or ID. You can specify one or more tags to add to each AWS resource, up to 50 tags for a resource. You can tag the AWS resources that you manage through AWS Network Firewall: firewalls, firewall policies, and rule groups.

# Required Parameters
- `ResourceArn`: The Amazon Resource Name (ARN) of the resource.
- `Tags`:

"""
tag_resource(ResourceArn, Tags; aws_config::AWSConfig=global_aws_config()) = network_firewall("TagResource", Dict{String, Any}("ResourceArn"=>ResourceArn, "Tags"=>Tags); aws_config=aws_config)
tag_resource(ResourceArn, Tags, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("TagResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceArn"=>ResourceArn, "Tags"=>Tags), args)); aws_config=aws_config)

"""
    UntagResource()

Removes the tags with the specified keys from the specified resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing. For example, you might set the tag key to \"customer\" and the value to the customer name or ID. You can specify one or more tags to add to each AWS resource, up to 50 tags for a resource. You can manage tags for the AWS resources that you manage through AWS Network Firewall: firewalls, firewall policies, and rule groups.

# Required Parameters
- `ResourceArn`: The Amazon Resource Name (ARN) of the resource.
- `TagKeys`:

"""
untag_resource(ResourceArn, TagKeys; aws_config::AWSConfig=global_aws_config()) = network_firewall("UntagResource", Dict{String, Any}("ResourceArn"=>ResourceArn, "TagKeys"=>TagKeys); aws_config=aws_config)
untag_resource(ResourceArn, TagKeys, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UntagResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceArn"=>ResourceArn, "TagKeys"=>TagKeys), args)); aws_config=aws_config)

"""
    UpdateFirewallDeleteProtection()

Modifies the flag, DeleteProtection, which indicates whether it is possible to delete the firewall. If the flag is set to TRUE, the firewall is protected against deletion. This setting helps protect against accidentally deleting a firewall that's in use.

# Required Parameters
- `DeleteProtection`: A flag indicating whether it is possible to delete the firewall. A setting of TRUE indicates that the firewall is protected against deletion. Use this setting to protect against accidentally deleting a firewall that is in use. When you create a firewall, the operation initializes this flag to TRUE.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
update_firewall_delete_protection(DeleteProtection; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallDeleteProtection", Dict{String, Any}("DeleteProtection"=>DeleteProtection); aws_config=aws_config)
update_firewall_delete_protection(DeleteProtection, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallDeleteProtection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DeleteProtection"=>DeleteProtection), args)); aws_config=aws_config)

"""
    UpdateFirewallDescription()

Modifies the description for the specified firewall. Use the description to help you identify the firewall when you're working with it.

# Optional Parameters
- `Description`: The new description for the firewall. If you omit this setting, Network Firewall removes the description for the firewall.
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
update_firewall_description(; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallDescription"; aws_config=aws_config)
update_firewall_description(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallDescription", args; aws_config=aws_config)

"""
    UpdateFirewallPolicy()

Updates the properties of the specified firewall policy.

# Required Parameters
- `FirewallPolicy`: The updated firewall policy to use for the firewall.
- `UpdateToken`: A token used for optimistic locking. Network Firewall returns a token to your requests that access the firewall policy. The token marks the state of the policy resource at the time of the request.  To make changes to the policy, you provide the token in your request. Network Firewall uses the token to ensure that the policy hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall policy again to get a current copy of it with current token. Reapply your changes as needed, then try the operation again using the new token.

# Optional Parameters
- `Description`: A description of the firewall policy.
- `DryRun`: Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.  If set to TRUE, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to FALSE, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.  If set to FALSE, Network Firewall makes the requested changes to your resources.
- `FirewallPolicyArn`: The Amazon Resource Name (ARN) of the firewall policy. You must specify the ARN or the name, and you can specify both.
- `FirewallPolicyName`: The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it. You must specify the ARN or the name, and you can specify both.
"""
update_firewall_policy(FirewallPolicy, UpdateToken; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallPolicy", Dict{String, Any}("FirewallPolicy"=>FirewallPolicy, "UpdateToken"=>UpdateToken); aws_config=aws_config)
update_firewall_policy(FirewallPolicy, UpdateToken, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FirewallPolicy"=>FirewallPolicy, "UpdateToken"=>UpdateToken), args)); aws_config=aws_config)

"""
    UpdateFirewallPolicyChangeProtection()

# Required Parameters
- `FirewallPolicyChangeProtection`: A setting indicating whether the firewall is protected against a change to the firewall policy association. Use this setting to protect against accidentally modifying the firewall policy for a firewall that is in use. When you create a firewall, the operation initializes this setting to TRUE.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
update_firewall_policy_change_protection(FirewallPolicyChangeProtection; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallPolicyChangeProtection", Dict{String, Any}("FirewallPolicyChangeProtection"=>FirewallPolicyChangeProtection); aws_config=aws_config)
update_firewall_policy_change_protection(FirewallPolicyChangeProtection, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateFirewallPolicyChangeProtection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FirewallPolicyChangeProtection"=>FirewallPolicyChangeProtection), args)); aws_config=aws_config)

"""
    UpdateLoggingConfiguration()

Sets the logging configuration for the specified firewall.  To change the logging configuration, retrieve the LoggingConfiguration by calling DescribeLoggingConfiguration, then change it and provide the modified object to this update call. You must change the logging configuration one LogDestinationConfig at a time inside the retrieved LoggingConfiguration object.  You can perform only one of the following actions in any call to UpdateLoggingConfiguration:    Create a new log destination object by adding a single LogDestinationConfig array element to LogDestinationConfigs.   Delete a log destination object by removing a single LogDestinationConfig array element from LogDestinationConfigs.   Change the LogDestination setting in a single LogDestinationConfig array element.   You can't change the LogDestinationType or LogType in a LogDestinationConfig. To change these settings, delete the existing LogDestinationConfig object and create a new one, using two separate calls to this update operation.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `LoggingConfiguration`: Defines how Network Firewall performs logging for a firewall. If you omit this setting, Network Firewall disables logging for the firewall.
"""
update_logging_configuration(; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateLoggingConfiguration"; aws_config=aws_config)
update_logging_configuration(args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateLoggingConfiguration", args; aws_config=aws_config)

"""
    UpdateRuleGroup()

Updates the rule settings for the specified rule group. You use a rule group by reference in one or more firewall policies. When you modify a rule group, you modify all firewall policies that use the rule group.  To update a rule group, first call DescribeRuleGroup to retrieve the current RuleGroup object, update the object as needed, and then provide the updated object to this call.

# Required Parameters
- `UpdateToken`: A token used for optimistic locking. Network Firewall returns a token to your requests that access the rule group. The token marks the state of the rule group resource at the time of the request.  To make changes to the rule group, you provide the token in your request. Network Firewall uses the token to ensure that the rule group hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the rule group again to get a current copy of it with a current token. Reapply your changes as needed, then try the operation again using the new token.

# Optional Parameters
- `Description`: A description of the rule group.
- `DryRun`: Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.  If set to TRUE, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to FALSE, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.  If set to FALSE, Network Firewall makes the requested changes to your resources.
- `RuleGroup`: An object that defines the rule group rules.   You must provide either this rule group setting or a Rules setting, but not both.
- `RuleGroupArn`: The Amazon Resource Name (ARN) of the rule group. You must specify the ARN or the name, and you can specify both.
- `RuleGroupName`: The descriptive name of the rule group. You can't change the name of a rule group after you create it. You must specify the ARN or the name, and you can specify both.
- `Rules`: The name of a file containing stateful rule group rules specifications in Suricata flat format, with one rule per line. Use this to import your existing Suricata compatible rule groups.   You must provide either this rules setting or a populated RuleGroup setting, but not both.   You can provide your rule group specification in a file through this setting when you create or update your rule group. The call response returns a RuleGroup object that Network Firewall has populated from your file. Network Firewall uses the file contents to populate the rule group rules, but does not maintain a reference to the file or use the file in any way after performing the create or update. If you call DescribeRuleGroup to retrieve the rule group, Network Firewall returns rules settings inside a RuleGroup object.
- `Type`: Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.   This setting is required for requests that do not include the RuleGroupARN.
"""
update_rule_group(UpdateToken; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateRuleGroup", Dict{String, Any}("UpdateToken"=>UpdateToken); aws_config=aws_config)
update_rule_group(UpdateToken, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateRuleGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("UpdateToken"=>UpdateToken), args)); aws_config=aws_config)

"""
    UpdateSubnetChangeProtection()

# Required Parameters
- `SubnetChangeProtection`: A setting indicating whether the firewall is protected against changes to the subnet associations. Use this setting to protect against accidentally modifying the subnet associations for a firewall that is in use. When you create a firewall, the operation initializes this setting to TRUE.

# Optional Parameters
- `FirewallArn`: The Amazon Resource Name (ARN) of the firewall. You must specify the ARN or the name, and you can specify both.
- `FirewallName`: The descriptive name of the firewall. You can't change the name of a firewall after you create it. You must specify the ARN or the name, and you can specify both.
- `UpdateToken`: An optional token that you can use for optimistic locking. Network Firewall returns a token to your requests that access the firewall. The token marks the state of the firewall resource at the time of the request.  To make an unconditional change to the firewall, omit the token in your update request. Without the token, Network Firewall performs your updates regardless of whether the firewall has changed since you last retrieved it. To make a conditional change to the firewall, provide the token in your update request. Network Firewall uses the token to ensure that the firewall hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the firewall again to get a current copy of it with a new token. Reapply your changes as needed, then try the operation again using the new token.
"""
update_subnet_change_protection(SubnetChangeProtection; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateSubnetChangeProtection", Dict{String, Any}("SubnetChangeProtection"=>SubnetChangeProtection); aws_config=aws_config)
update_subnet_change_protection(SubnetChangeProtection, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = network_firewall("UpdateSubnetChangeProtection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("SubnetChangeProtection"=>SubnetChangeProtection), args)); aws_config=aws_config)


text:
module NativeXML

include("./Events.jl")
include("./Lexical.jl")

import .Events
import .Lexical

end # module

ext: jl

max_stars_repo_name: jlegare/NativeXML

max_issues_repo_name: jlegare/NativeXML

max_forks_repo_name: jlegare/NativeXML


text:
"""
    getDaysBetweenDates_includeLast
calculates the days between two Dates (inluding the last day)
"""
function getDaysBetweenDates_includeLast(beginDate::Date, endDate::Date)::Float64
    endDate = endDate + Dates.Day(1)
    return Dates.value(endDate - beginDate)
end

max_stars_repo_name: RainerNeu/tradeStatistics

max_issues_repo_name: RainerNeu/tradeStatistics

max_forks_repo_name: RainerNeu/tradeStatistics


text:
function EmpiricalDistribution()
    return EmpiricalDistribution(())
end

function EmpiricalDistribution(arg0::RandomGenerator)
    return EmpiricalDistribution((RandomGenerator,), arg0)
end

function EmpiricalDistribution(arg0::jint)
    return EmpiricalDistribution((jint,), arg0)
end

function EmpiricalDistribution(arg0::jint, arg1::RandomGenerator)
    return EmpiricalDistribution((jint, RandomGenerator), arg0, arg1)
end

function cumulative_probability(obj::EmpiricalDistribution, arg0::jdouble)
    return jcall(obj, "cumulativeProbability", jdouble, (jdouble,), arg0)
end

function density(obj::EmpiricalDistribution, arg0::jdouble)
    return jcall(obj, "density", jdouble, (jdouble,), arg0)
end

function equals(obj::Object, arg0::Object)
    return jcall(obj, "equals", jboolean, (Object,), arg0)
end

function get_bin_count(obj::EmpiricalDistribution)
    return jcall(obj, "getBinCount", jint, ())
end

function get_bin_stats(obj::EmpiricalDistribution)
    return jcall(obj, "getBinStats", List, ())
end

function get_class(obj::Object)
    return jcall(obj, "getClass", Class, ())
end

function get_generator_upper_bounds(obj::EmpiricalDistribution)
    return jcall(obj, "getGeneratorUpperBounds", Vector{jdouble}, ())
end

function get_next_value(obj::EmpiricalDistribution)
    return jcall(obj, "getNextValue", jdouble, ())
end

function get_numerical_mean(obj::EmpiricalDistribution)
    return jcall(obj, "getNumericalMean", jdouble, ())
end

function get_numerical_variance(obj::EmpiricalDistribution)
    return jcall(obj, "getNumericalVariance", jdouble, ())
end

function get_sample_stats(obj::EmpiricalDistribution)
    return jcall(obj, "getSampleStats", StatisticalSummary, ())
end

function get_support_lower_bound(obj::EmpiricalDistribution)
    return jcall(obj, "getSupportLowerBound", jdouble, ())
end

function get_support_upper_bound(obj::EmpiricalDistribution)
    return jcall(obj, "getSupportUpperBound", jdouble, ())
end

function get_upper_bounds(obj::EmpiricalDistribution)
    return jcall(obj, "getUpperBounds", Vector{jdouble}, ())
end

function hash_code(obj::Object)
    return jcall(obj, "hashCode", jint, ())
end

function inverse_cumulative_probability(obj::EmpiricalDistribution, arg0::jdouble)
    return jcall(obj, "inverseCumulativeProbability", jdouble, (jdouble,), arg0)
end

function is_loaded(obj::EmpiricalDistribution)
    return jcall(obj, "isLoaded", jboolean, ())
end

function is_support_connected(obj::EmpiricalDistribution)
    return jcall(obj, "isSupportConnected", jboolean, ())
end

function load(obj::EmpiricalDistribution, arg0::File)
    return jcall(obj, "load", void, (File,), arg0)
end

function load(obj::EmpiricalDistribution, arg0::URL)
    return jcall(obj, "load", void, (URL,), arg0)
end

function load(obj::EmpiricalDistribution, arg0::Vector{jdouble})
    return jcall(obj, "load", void, (Vector{jdouble},), arg0)
end

function log_density(obj::AbstractRealDistribution, arg0::jdouble)
    return jcall(obj, "logDensity", jdouble, (jdouble,), arg0)
end

function notify(obj::Object)
    return jcall(obj, "notify", void, ())
end

function notify_all(obj::Object)
    return jcall(obj, "notifyAll", void, ())
end

function probability(obj::AbstractRealDistribution, arg0::jdouble, arg1::jdouble)
    return jcall(obj, "probability", jdouble, (jdouble, jdouble), arg0, arg1)
end

function re_seed(obj::EmpiricalDistribution, arg0::jlong)
    return jcall(obj, "reSeed", void, (jlong,), arg0)
end

function reseed_random_generator(obj::EmpiricalDistribution, arg0::jlong)
    return jcall(obj, "reseedRandomGenerator", void, (jlong,), arg0)
end

function to_string(obj::Object)
    return jcall(obj, "toString", JString, ())
end

function wait(obj::Object)
    return jcall(obj, "wait", void, ())
end

function wait(obj::Object, arg0::jlong)
    return jcall(obj, "wait", void, (jlong,), arg0)
end

function wait(obj::Object, arg0::jlong, arg1::jint)
    return jcall(obj, "wait", void, (jlong, jint), arg0, arg1)
end


text:
module Eugrid

# geometry.jl
export sps, disorder
export b2d, d2b, i2d, d2i
export Grid, chessboard, manhattan, isplanar
export Vertex, vertices
export distance, eccentricity, euclidean_eccentricity
export geodesics, circle_points, midpoints, two_circle_points

# growth.jl
export grow_corner_diags, gamma_score, grow_gamma_diags

# sampling.jl
export geodesic_model, diags_sampling, randgrid, rand_sampling, disordered_NG_sampling

# figures.jl
export draw_hg, draw_gg, draw_tg, draw_ag, draw_rand, draw_gamma, draw_gamma_disordered

import DataFrames, GLM, OffsetArrays, Optim, Plots, Statistics

using KahanSummation: sum_kbn
using LaTeXStrings
using LinearAlgebra: checksquare
using StableRNGs: StableRNG

include("geometry.jl")
include("growth.jl")
include("sampling.jl")
include("figures.jl")

end # module

max_stars_repo_name: moshelooks/eugrid

max_issues_repo_name: moshelooks/eugrid

max_forks_repo_name: moshelooks/eugrid


text:
using ForwardDiff
using LinearAlgebra
include("backtracking_line_search.jl")

function coordinate_algo(dimension,epsilon,objective,x,alpha,beta,step)
    g = x -> ForwardDiff.gradient(objective, x); # g = ∇f
    gradient = g(x)
    while sum(abs,gradient) > epsilon
        gradient = g(x)
        i = argmax(gradient)
        j = argmin(gradient)
        if abs(gradient[j]) > abs(gradient[i])
            i = j
        end
        arc = zeros(dimension)
        arc[i] = - gradient[i]
        demanding_step = backtracking_line_search(objective,x,alpha,beta,step,arc,gradient)
        x = x + demanding_step * arc
    end
    return x
end

max_stars_repo_name: zhuhs-q/basic-optimal-method

max_issues_repo_name: Jacob-jinxy/basic-optimal-method

max_forks_repo_name: Jacob-jinxy/basic-optimal-method


text:
module StipplePlotly

import Genie
import Stipple
using Stipple.Reexport

#===#

function deps() :: String
  Genie.Router.route("/js/stipple/plotly.min.js") do
    Genie.Renderer.WebRenderable(
      read(joinpath(@__DIR__, "..", "files", "js", "plotly.min.js"), String),
      :javascript) |> Genie.Renderer.respond
  end

  Genie.Router.route("/js/stipple/resizesensor.min.js") do
    Genie.Renderer.WebRenderable(
      read(joinpath(@__DIR__, "..", "files", "js", "resizesensor.min.js"), String),
      :javascript) |> Genie.Renderer.respond
  end

  Genie.Router.route("/js/stipple/lodash.min.js") do
    Genie.Renderer.WebRenderable(
      read(joinpath(@__DIR__, "..", "files", "js", "lodash.min.js"), String),
      :javascript) |> Genie.Renderer.respond
  end

  Genie.Router.route("/js/stipple/vueresize.min.js") do
    Genie.Renderer.WebRenderable(
      read(joinpath(@__DIR__, "..", "files", "js", "vueresize.min.js"), String),
      :javascript) |> Genie.Renderer.respond
  end

  vueplotly = Genie.Configuration.isprod() ? "vueplotly.min.js" : "vueplotly.js"
  Genie.Router.route("/js/stipple/$vueplotly") do
    Genie.Renderer.WebRenderable(
      read(joinpath(@__DIR__, "..", "files", "js", vueplotly), String),
      :javascript) |> Genie.Renderer.respond
  end

  string(
    Genie.Renderer.Html.script(src="$(Genie.config.base_path)js/stipple/plotly.min.js"),
    Genie.Renderer.Html.script(src="$(Genie.config.base_path)js/stipple/resizesensor.min.js"),
    Genie.Renderer.Html.script(src="$(Genie.config.base_path)js/stipple/lodash.min.js"),
    Genie.Renderer.Html.script(src="$(Genie.config.base_path)js/stipple/vueresize.min.js"),
    Genie.Renderer.Html.script(src="$(Genie.config.base_path)js/stipple/$vueplotly"),
  )
end

#===#

include("Charts.jl")
@reexport using .Charts

function __init__()
  push!(Stipple.DEPS, deps)
end

end # module


text:
#we want the coloring of the nodes to be the same as the graphs to make it an easy look up
#have the init set up the arrays of the country region labels
southWest = ["Portugal","Spain","Malta","SanMarino","Andorra","Monaco","Morocco","Italy"]
north = ["Iceland","Denmark","Norway","Sweden","Finland"]
northWest = ["UnitedKingdom","Ireland","Belgium","France","Luxembourg"]
central = ["Germany","Austria","TheNetherlands","Switzerland","Slovenia","CzechRepublic","Hungary","Slovakia"]
southEast = ["Greece","Montenegro","Cyprus","Albania","Bulgaria","Croatia","BosniaHerzegovina","Turkey","FYRMacedonia","Romania","Serbia","Israel","Yugoslavia","SerbiaMontenegro"]
east = ["Russia","Ukraine","Moldova","Belarus","Poland","Georgia","Armenia","Azerbaijan","Estonia","Lithuania","Latvia"]
other = ["Australia"]

#so I am going to put in a dictionary pair tuple, for the low and high/upper. this will first look at a single window and count the NEGLECT total and then the PREFERENCE significance. printout the total for NEGLECT AND PREFERENCE : (RECEIVE AND PRODUCE)
#this function will need the aggregate neglect/avoid and the aggregate prefer biases
#before we needed the network connectivity and now we need aggregate for each country label

#needed for the plots
using Plots
#use pyplot()
pyplot()
#StatsBase (for Kendall Tau)
using StatsBase
#To get the cdf of the student t distribution
using Distributions
using RCall
using LaTeXStrings
#julia> ll=LaTeXString("an equation:  1 + \\alpha^2 ")
#julia> plot([1,2,3,4],[1,2,3,4],title=ll)

TITLE_FONT_SIZE = 17

function analyzeBiases(wAGupper,wAGlower)

    #get the total of the out and inward biases of every country for each time window as a total count
    countryDictTotalsOutIn = produceSingleWindowsOutIn(wAGupper)
    #for each window look at the out/in for the upper lower (pref neg)
    plotOutIn(countryDictTotalsOutIn,wAGupper["side"],wAGupper["windowSize"],wAGupper["alpha"])
    #the scatter plot for the countries for the full year set overlap/overlay
    plotOutInAgg(wAGupper,countryDictTotalsOutIn,wAGupper["side"],wAGupper["windowSize"],wAGupper["alpha"])
    #the scatter plot from the thresholdSignificantAdjListTOTAL
    #the total in/out for the countries over all the time windows
    totalTimeInOutScatter(wAGupper)

    #now for the lower
    countryDictTotalsOutIn = produceSingleWindowsOutIn(wAGlower)
    plotOutIn(countryDictTotalsOutIn,wAGlower["side"],wAGlower["windowSize"],wAGlower["alpha"])
    plotOutInAgg(wAGlower,countryDictTotalsOutIn,wAGlower["side"],wAGlower["windowSize"],wAGlower["alpha"])
    totalTimeInOutScatter(wAGlower)

    #now for the upper and lower comparisons
    totalTimeInOutScatterNegPref(wAGupper,wAGlower)

    #the total score received VS how much significant neglect edges inwards counted
    totalTimeScoreNeglectScatter(wAGupper,wAGlower)

    #to avoid too many plots
    closeall()
end

#now a plot for the total (score VS neglect) for the years in all time windows
function totalTimeScoreNeglectScatter(wAGupper,wAGlower)
    alpha = wAGupper["alpha"]
    winSize = wAGupper["windowSize"]
    totalsUpper = wAGupper["thresholdSignificantAdjListTOTAL"]#n by 3 array
    totalsLower = wAGlower["thresholdSignificantAdjListTOTAL"]#n by 3 array
    cntryAr = unique(vcat(totalsUpper[:,1],totalsLower[:,1]))

    s1 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total score received", ylabel="total in neglect",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsNeg = (totalsLower[:,2] .== cntryTmp)

        negTotalTmp = sum(totalsLower[indsNeg,3])
        println(cntryTmp)
        totalScoreTmp = totalCountryScoreReceive(wAGupper,cntryTmp)
        println(totalScoreTmp)
        s1 = scatter!([totalScoreTmp],[negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,totalScoreTmp)
        push!(ytmp,negTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    yearMin,yearMax = getYearsMinMax(wAGupper)#will be identical for both upper/lower windows
    scatter!(title=string("Received Neglect VS Score ", yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau) ($(testTau))
    #display(s1)
    filename = string("scatter","ScoreVSneglectIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
    filename = string("scatter","ScoreVSneglectIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    #pref in VS score
    s2 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total score received", ylabel="total in preference",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsPref = (totalsUpper[:,2] .== cntryTmp)

        prefTotalTmp = sum(totalsUpper[indsPref,3])
        totalScoreTmp = totalCountryScoreReceive(wAGupper,cntryTmp)
        s2 = scatter!([totalScoreTmp],[prefTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,totalScoreTmp)
        push!(ytmp,prefTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    scatter!(title=string("Received Preference VS Score ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s2)
    filename = string("scatter","ScoreVSpreferenceIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
        filename = string("scatter","ScoreVSpreferenceIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    #(pref in - neg in) VS score
    s3 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total score received", ylabel="total in pref-neg",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsPref = (totalsUpper[:,2] .== cntryTmp)
        indsNeg = (totalsLower[:,2] .== cntryTmp)

        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        totalScoreTmp = totalCountryScoreReceive(wAGupper,cntryTmp)
        s3 = scatter!([totalScoreTmp],[prefTotalTmp-negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,totalScoreTmp)
        push!(ytmp,prefTotalTmp-negTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    scatter!(title=string("Received Pref-Neg VS Score ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s3)
    filename = string("scatter","ScoreVSprefMinusNegIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
    filename = string("scatter","ScoreVSprefMinusNegIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    #(pref out) VS score
    s4 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total score received", ylabel="total out preference",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsPref = (totalsUpper[:,1] .== cntryTmp)
        indsNeg = (totalsLower[:,2] .== cntryTmp)

        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        totalScoreTmp = totalCountryScoreReceive(wAGupper,cntryTmp)
        s4 = scatter!([totalScoreTmp],[prefTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,totalScoreTmp)
        push!(ytmp,prefTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#round(tau,3)
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    scatter!(title=string("Out Preference VS Score ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s4)
    filename = string("scatter","ScoreVSprefOut",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
savefig("./plots/$filename")
    filename = string("scatter","ScoreVSprefOut",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    #(neg out) VS score
    s5 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total score received", ylabel="total out neglect",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsPref = (totalsUpper[:,1] .== cntryTmp)
        indsNeg = (totalsLower[:,1] .== cntryTmp)

        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        totalScoreTmp = totalCountryScoreReceive(wAGupper,cntryTmp)
        s5 = scatter!([totalScoreTmp],[negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,totalScoreTmp)
        push!(ytmp,negTotalTmp)
    end
tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
tau = round(tau,digits=2)
testTau = rkendallSig(xtmp,ytmp,alpha)#round(tau,3)
rho = corspearman(xtmp,ytmp)
rho = round(rho,digits=2)
testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
scatter!(title=string("Out Neglect VS Score ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s5)
    filename = string("scatter","ScoreVSNegOut",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
savefig("./plots/$filename")
    filename = string("scatter","ScoreVSNegOut",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

end

#return for a country the total scores/points received (not significance but raw scores)
function totalCountryScoreReceive(wAGupper,cntryTmp)
    total = 0
    for kk in keys(wAGupper)
        if(kk[1] == '1' || kk[1] == '2')
            totalsUpper = wAGupper[kk]["scoreAggregateAdjList"]
            indsScores = (totalsUpper[:,2] .== cntryTmp)
            #println(indsScores)
            if(count(indsScores) > 0)
                scoreTmp = sum(totalsUpper[indsScores,3])
                total += scoreTmp
            end

        end
    end
    return total
end

#now plot the total neglect out VS the total pref out
#
function totalTimeInOutScatterNegPref(wAGupper,wAGlower)
    alpha = wAGupper["alpha"]
    winSize = wAGupper["windowSize"]
    totalsUpper = wAGupper["thresholdSignificantAdjListTOTAL"]#n by 3 array
    totalsLower = wAGlower["thresholdSignificantAdjListTOTAL"]#n by 3 array

    cntryAr = unique(vcat(totalsUpper[:,1],totalsLower[:,1]))
    println(cntryAr)

    s1 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total out preference", ylabel="total out neglect",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsNeg = (totalsLower[:,1] .== cntryTmp)
        indsPref = (totalsUpper[:,1] .== cntryTmp)
        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        s1 = scatter!([prefTotalTmp],[negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,prefTotalTmp)
        push!(ytmp,negTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#round(tau,3)
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    yearMin,yearMax = getYearsMinMax(wAGupper)#will be identical for both upper/lower windows

    scatter!(title=string("Preference VS Neglect ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s1)
    filename = string("scatter","TotalYearsOutPrefNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
        filename = string("scatter","TotalYearsOutPrefNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    #now for inwards
    s2 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total in preference", ylabel="total in neglect",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsNeg = (totalsLower[:,2] .== cntryTmp)
        indsPref = (totalsUpper[:,2] .== cntryTmp)
        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        s2 = scatter!([prefTotalTmp],[negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,prefTotalTmp)
        push!(ytmp,negTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#rspearmanSig#round(tau,3)
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    scatter!(title=string("Preference VS Neglect ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s2)
    filename = string("scatter","TotalYearsInPrefNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
        filename = string("scatter","TotalYearsInPrefNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    #now plot the total neglect In VS the total pref OUT
    s3 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total out preference", ylabel="total in neglect",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsNeg = (totalsLower[:,2] .== cntryTmp)
        indsPref = (totalsUpper[:,1] .== cntryTmp)
        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        s3 = scatter!([prefTotalTmp],[negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,prefTotalTmp)
        push!(ytmp,negTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#round(tau,3)
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    yearMin,yearMax = getYearsMinMax(wAGupper)#will be identical for both upper/lower windows

    scatter!(title=string("Preference VS Neglect ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s3)
    filename = string("scatter","TotalYearsOutPrefInNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
        filename = string("scatter","TotalYearsOutPrefInNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

    s4 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total in preference", ylabel="total out neglect",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    xtmp = Int[]
    ytmp = Int[]
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsNeg = (totalsLower[:,1] .== cntryTmp)
        indsPref = (totalsUpper[:,2] .== cntryTmp)
        negTotalTmp = sum(totalsLower[indsNeg,3])
        prefTotalTmp = sum(totalsUpper[indsPref,3])
        s4 = scatter!([prefTotalTmp],[negTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,prefTotalTmp)
        push!(ytmp,negTotalTmp)
    end
tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
tau = round(tau,digits=2)
testTau = rkendallSig(xtmp,ytmp,alpha)#round(tau,3)
rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
rho = round(rho,digits=2)
testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
yearMin,yearMax = getYearsMinMax(wAGupper)#will be identical for both upper/lower windows

scatter!(title=string("Preference VS Neglect ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
#display(s4)
filename = string("scatter","TotalYearsInPrefOutNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
savefig("./plots/$filename")
filename = string("scatter","TotalYearsInPrefOutNeg",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
savefig("./plots/$filename")

end

function plotOutIn(outInDict,side,windowSize,alpha)

    for winKey in keys(outInDict)#time window keys

        winDict = outInDict[winKey]
        countriesWin = unique(vcat(collect(keys(winDict["out"])),collect(keys(winDict["in"]))))
        scatter(markersize=8,c=:black,leg=false,overwrite_figure=false)
        xtmp = Int[]
        ytmp = Int[]
        for cW in 1:length(countriesWin)
            outDeg = 0
            inDeg = 0
            if(haskey(winDict["out"],countriesWin[cW]))
                outDeg = winDict["out"][countriesWin[cW]]
            end
            if(haskey(winDict["in"],countriesWin[cW]))
                inDeg = winDict["in"][countriesWin[cW]]
            end
            scatter!([outDeg],[inDeg],markersize=8,c=:black,leg=false)
            push!(xtmp,outDeg)
            push!(ytmp,inDeg)
        end
        tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
        tau = round(tau,digits=2)
        testTau = rkendallSig(xtmp,ytmp,alpha)#rspearmanSig#round(tau,3)
        rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
        rho = round(rho,digits=2)
        testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
        if(side == "Lower")
            scatter!(title=string("Neglect $(winKey) \n \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
        else
            scatter!(title=string("Preference $(winKey) \n \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
        end
        scatter!(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="out degree", ylabel="in degree",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16))
        tmp = ""
        side == "Lower" ? tmp="Neglect" : tmp="Preference"
        filename = string("scatter",tmp,"SingleWin",winKey,"win",windowSize,"alpha",alpha,".png")
        savefig("./plots/$filename")
        filename = string("scatter",tmp,"SingleWin",winKey,"win",windowSize,"alpha",alpha,".pdf")
        savefig("./plots/$filename")
        ss = 0
    end
end

#for each country produce an array/matrix for the total bias in/out
function produceSingleWindowsOutIn(wAG)
    #for each window the total in/out of each country
    countryDictTotalsOutIn = Dict()

    for kk in keys(wAG)
        if(kk[1] == '1' || kk[1] == '2')
            countryDictTotalsOutIn[kk] = Dict()#just putting the totals of each country
            countryDictTotalsOutIn[kk]["out"] = Dict()
            countryDictTotalsOutIn[kk]["in"] = Dict()
            sigAdjList = wAG[kk]["thresholdSigAdjList"]

            for ii in 1:size(sigAdjList,1)
                if(sigAdjList[ii,3] > 0)
                    cntry1 = sigAdjList[ii,1]
                    cntry1 = fixBadChars(cntry1)
                    cntry2 = sigAdjList[ii,2]
                    cntry2 = fixBadChars(cntry2)
                    #one country
                    if( isempty(countryDictTotalsOutIn[kk]["out"]) || !haskey(countryDictTotalsOutIn[kk]["out"],cntry1) )
                        countryDictTotalsOutIn[kk]["out"][cntry1] = 1
                    else
                        countryDictTotalsOutIn[kk]["out"][cntry1] += 1
                    end
                    if( isempty(countryDictTotalsOutIn[kk]["in"]) || !haskey(countryDictTotalsOutIn[kk]["in"],cntry2) )
                        countryDictTotalsOutIn[kk]["in"][cntry2] = 1
                    else
                        countryDictTotalsOutIn[kk]["in"][cntry2] += 1
                    end

                end
            end

        end

    end
    return countryDictTotalsOutIn
end

function fixBadChars(str_Pre)

    strPre = replace(str_Pre,"&"=>"")
    strPre = replace(strPre,"."=>"")
    strPre =  replace(strPre," "=>"")

    return strPre
end

#given a country string, it will check the region selection to return the node configuration color
function regionNodeString(countryInput)

    if(countryInput in east)
        nodeStr = " [style=filled,fillcolor=olivedrab3]; "
    elseif(countryInput in southWest)
        nodeStr = " [style=filled,fillcolor=indianred1]; "
    elseif(countryInput in north)
        nodeStr = " [style=filled,fillcolor=dodgerblue]; "
    elseif(countryInput in northWest)
        nodeStr = " [style=filled,fillcolor=darkslategray2]; "
    elseif(countryInput in central)
        nodeStr = " [style=filled,fillcolor=gray]; "
    elseif(countryInput in southEast)
        nodeStr = " [style=filled,fillcolor=darkgoldenrod1]; "
    elseif(countryInput in other)
        nodeStr = " [style=filled,fillcolor=whitesmoke]; "
    else

        print("country to region not found: ")
        println(countryInput)
    end

    return nodeStr
end

#have a scatter accumulation of the countries not as a total but OVERLAY
#each point encountered in the different windows is put independently on a scatter
function plotOutInAgg(wAG,outInDict,side,windowSize,alpha)
    ss = 0
    s1 = []
    println(isempty(s1))
    xtmp = Int[]
    ytmp = Int[]
    for winKey in keys(outInDict)#time window keys
        winDict = outInDict[winKey]
        countriesWin = unique(vcat(collect(keys(winDict["out"])),collect(keys(winDict["in"]))))

        for cW in 1:length(countriesWin)
            outDeg = 0
            inDeg = 0
            if(haskey(winDict["out"],countriesWin[cW]))
                outDeg = winDict["out"][countriesWin[cW]]
            end
            if(haskey(winDict["in"],countriesWin[cW]))
                inDeg = winDict["in"][countriesWin[cW]]
            end
            if( ss == 0 )
                ss += 1
                s1 =scatter([outDeg],[inDeg],markersize=8,c=:black,leg=false,overwrite_figure=false)
            else
                scatter!([outDeg],[inDeg],markersize=8,c=:black,leg=false)
            end
            push!(xtmp,outDeg)
            push!(ytmp,inDeg)
        end
    end
    yearMin,yearMax = getYearsMinMax(wAG)
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#rspearmanSig#round(tau,3)
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    if(side == "Lower")
        scatter!(title=string("Overlapping Neglect $(yearMin)-$(yearMax) \n window size=$(windowSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    else
        scatter!(title=string("Overlapping Preference $(yearMin)-$(yearMax) \n window size=$(windowSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    end
    scatter!(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="out degree", ylabel="in degree",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16))
    #display(s1)
    tmp = ""
    side == "Lower" ? tmp="Neglect" : tmp="Preference"
    filename = string("scatter",tmp,"OverlapWindows",yearMin,"to",yearMax,"win",windowSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
        filename = string("scatter",tmp,"OverlapWindows",yearMin,"to",yearMax,"win",windowSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")
    #ss = 0#one fig only
end

#shows: HOW MANY EDGES IN AN OUT FOR EACH COUNTRY OVER ALL WINDOW PERIODS
function totalTimeInOutScatter(wAG)
    alpha = wAG["alpha"]
    winSize = wAG["windowSize"]
    side = wAG["side"]
    totals = wAG["thresholdSignificantAdjListTOTAL"]#n by 3 array

    cntryAr = unique(totals[:,1])
    xtmp = Int[]
    ytmp = Int[]
    s1 = scatter(titlefontsize=TITLE_FONT_SIZE,yguidefontsize=18,xguidefontsize=18,xlabel="total out degree", ylabel="total in degree",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16),overwrite_figure=false)
    for cInd in 1:length(cntryAr)
        cntryTmp = cntryAr[cInd]
        indsOut = (totals[:,1] .== cntryTmp)
        indsIn = (totals[:,2] .== cntryTmp)
        inTotalTmp = sum(totals[indsIn,3])
        outTotalTmp = sum(totals[indsOut,3])
        s1 = scatter!([outTotalTmp],[inTotalTmp],markersize=8,c=:black,leg=false)
        push!(xtmp,outTotalTmp)
        push!(ytmp,inTotalTmp)
    end
    tau = rkendallVal(xtmp,ytmp)#corkendall(xtmp,ytmp)
    tau = round(tau,digits=2)
    testTau = rkendallSig(xtmp,ytmp,alpha)#rspearmanSig#round(tau,3)
    rho = rspearmanVal(xtmp,ytmp)#corspearman(xtmp,ytmp)
    rho = round(rho,digits=2)
    testRho = rspearmanSig(xtmp,ytmp,alpha)#spearmanTval(rho,length(xtmp),alpha)
    yearMin,yearMax = getYearsMinMax(wAG)
    tmp = ""
    side == "Lower" ? tmp="Neglect" : tmp="Preference"
    scatter!(title=string(tmp," ",yearMin,"-",yearMax,"\n window size=$(winSize), \u03C1=$(rho)($(testRho))"))# \u03C4=$(tau)($(testTau))
    #display(s1)
    filename = string("scatter",tmp,"TotalYearsOutIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".png")
    savefig("./plots/$filename")
    filename = string("scatter",tmp,"TotalYearsOutIn",yearMin,"-",yearMax,"win",winSize,"alpha",alpha,".pdf")
    savefig("./plots/$filename")

end

function getYearsMinMax(wAG)
    keys1 = [(if(kk[1]=='1' || kk[1] == '2'); kk;end)  for kk in keys(wAG)]
    keys1 = keys1[keys1 .!= nothing]
    yearsWin = [split(k1,"-") for k1 in keys1]
    years = vcat(yearsWin)
    years = [j for i in years for j in i]
    years = sort(years)
    yearMin = parse(Int,years[1])
    yearMax = parse(Int,years[end])
    return yearMin,yearMax
end

#what is the spearman rho value found from R
function rkendallVal(xx,yy)

    return R"cor.test($xx,$yy,method='kendall', exact=FALSE)$estimate"[1]
end

#what is the spearman rho value found from R
function rspearmanVal(xx,yy)

    return R"cor.test($xx,$yy,method='spearman', exact=FALSE)$estimate"[1]
end

#returns whether the p value for the spearman Rho is significant
function rspearmanSig(xx,yy,alpha)
    pval = R"cor.test($xx,$yy,method='spearman', exact=FALSE)$p.value"[1]
    println(pval)
    if(pval < (alpha/2))
        return "significant"
    else
        return "not significant"
    end
end

#returns whether the p value for the kendall tau is significant
function rkendallSig(xx,yy,alpha)
    pval = R"cor.test($xx,$yy,method='kendall', exact=FALSE)$p.value"[1]
    println(pval)
    if(pval < (alpha/2))
        return "significant"
    else
        return "not significant"
    end
end

#=

#from the spearman rho value get the student t-distribution val
function spearmanTval(r,n,alpha)
    tval = r * ( sqrt( (n-2) / (1-(r^2)) ) )
    #println(r);println(tval)
    return tsignificance(n,tval,alpha)
end

function tsignificance(degfree,tval,alpha)
    #println(degfree);println(tval);println(alpha);
    pval = cdf(TDist(degfree),tval)
    #println(pval)
    if(pval < (alpha/2) || pval > (1-(alpha/2)))
        return "significant"
    else
        return "not significant"
    end
end

x=[1,2,3,4,5,6,7,8,9,10];
y=[1,2,3,4,5,7,10,-11,1,10];
r=corspearman(x,y)
tt(r,n) = r*(sqrt((n-2)/(1-r^2)))
t=tt(r,length(x))
cdf(TDist(10),8)
=#

#=
#plotOutInTotal(countryDictTotalsOutIn,wAG["side"],wAG["windowSize"],wAG["alpha"])

#look at the total key set and produce an aggregate scatter plot, don't over complicate auto-amigo
function plotOutInTotal(outInDict,side,windowSize,alpha)

    s1 = []
    ss = 0
    countriesTotal = []
    for winKey in keys(outInDict)#time window keys, prior making single windows, now just not new?

        println(winKey)
        winDict = outInDict[winKey]
        countriesTotal = append!(countriesTotal,unique(vcat(collect(keys(winDict["out"])),collect(keys(winDict["in"])))))
        println(countriesTotal)
        println(typeof(countriesTotal))

    end
    countriesTotal = unique(countriesTotal)
    println(countriesTotal)

    #now with total country set, we iterate over them, for each country then inside each key time window
    #we aggregate and add to the plot of the temp total
    for cTmp in countriesTotal
        println(cTmp)
        outDegT = 0
        inDegT = 0
        for winKey in keys(outInDict)#time window keys, prior making single windows, now just not new?
            if(haskey(outInDict[winKey]["in"],cTmp))
                outDegT += outInDict[winKey]["in"][cTmp]
                println(outInDict[winKey]["in"][cTmp])
            end
            if(haskey(outInDict[winKey]["out"],cTmp))
                inDegT += outInDict[winKey]["out"][cTmp]
                println(outInDict[winKey]["out"][cTmp])
            end
            println(winKey)
        end
        println([outDegT, inDegT])
        if( ss == 0 )
            ss += 1
            s1 =scatter([outDegT],[inDegT],markersize=8,c=:black,leg=false,overwrite_figure=false)
        else
            scatter!([outDegT],[inDegT],markersize=8,c=:black,leg=false)
        end
    end

    keys1 = [(if(kk[1]=='1' || kk[1] == '2'); kk;end)  for kk in keys(outInDict)]
    keys1 = keys1[keys1 .!= nothing]
    yearsWin = [split(k1,"-") for k1 in keys1]
    years = vcat(yearsWin)
    years = [j for i in years for j in i]
    years = sort(years)
    yearMin = parse(Int,years[1])
    yearMax = parse(Int,years[end])

    if(side == "Lower")
        scatter!(title=string("significant Total neglect $yearMin to $yearMax"))
    else
        scatter!(title=string("significant Total preference $yearMin to $yearMax"))
    end

    scatter!(titlefontsize=18,yguidefontsize=18,xguidefontsize=18,xlabel="out degree", ylabel="in degree",xlabfont=font(20), xtickfont = font(14), ytickfont = font(16))#scatter!(xguide="x axis" , yguide="y axis")xlabel="outdegree"
    #display(s1)

    tmp = ""
    side == "Lower" ? tmp="Neglect":tmp="Prefer"
    filename = string("scatter",tmp,"TotalWin",yearMin,"to",yearMax,"win",windowSize,"alpha",alpha,".png")
    savefig("./plots/$filename")

end

tmp=R"cor.test($tt,$t,method='spearman')$p.value"[1]
=#

max_stars_repo_name: mantzaris/eurovisionBias

max_issues_repo_name: mantzaris/eurovisionBias

max_forks_repo_name: mantzaris/eurovisionBias


text:
using FlexJuMP
@static if VERSION < v"0.7.0-DEV.2005"
    using Base.Test
else
    using Test
end
using Pavito, GLPKMathProgInterface, Ipopt
using JuMP
using LinearAlgebra

# Run basic model definition tests

@time @testset "Model Definition Testing" begin
    @test include("initialize_model.jl")
    @test include("set_single_variables.jl")
    @test include("set_vector_variables.jl")
    @test include("define_constraints.jl")
    @test include("define_real_model.jl")
end
print("\n")

# Check basic data manipulation functions
@time @testset "Data Access Testing" begin
    @testset "Data Extraction" begin include("get_flexdata.jl") end
    @testset "Get/Set Covariance Matrix" begin include("manage_covariance.jl") end
    @testset "Get/Set Mean" begin include("manage_mean.jl") end
end
print("\n")

# Check functions that can be used before solving the model
@time @testset "Pre-Solve Method Testing" begin
    @testset "Set Uncertainty Set" begin include("define_uncertainty_set.jl") end
    @testset "Check Mean" begin include("check_mean.jl") end
    @testset "Find Centered Mean" begin include("find_center.jl") end
    @testset "SF Index" begin include("sf_index.jl") end
end
print("\n")

# Extensively test the solvehook
@time @testset "Solvehook Testing" begin include("solvehook_checks.jl") end
print("\n")

# Test function that can be called after the solution of the solvehook
@time @testset "Post-Solve Method Testing" begin
    @testset "Confidence Level" begin include("confidence_level.jl") end
    @testset "Critical Point" begin include("retrieve_critical_pt.jl") end
    @testset "Rank Constraints" begin include("constraint_ranker.jl") end
    @testset "SF Index" begin include("sf_index2.jl") end
end