text:
require "google/cloud/storage"

class File
  def self.file? f
    true
  end
  def self.readable? f
    true
  end
  def self.read *args
    "fake file data"
  end
end

class OpenSSL::PKey::RSA
  def self.new *args
    "rsa key"
  end
end

module Google
  module Cloud
    module Storage
      class Project
        def signed_url bucket, path, method: nil, expires: nil,
                       content_type: nil, content_md5: nil, headers: nil,
                       issuer: nil, client_email: nil, signing_key: nil,
                       private_key: nil
          # no-op stub, but ensures that calls match this copied signature
        end
      end
      class Bucket
        def signed_url path, method: nil, expires: nil, content_type: nil,
                       content_md5: nil, headers: nil, issuer: nil,
                       client_email: nil, signing_key: nil, private_key: nil
          # no-op stub, but ensures that calls match this copied signature
        end

        def post_object path, policy: nil, issuer: nil,
                        client_email: nil, signing_key: nil,
                        private_key: nil
          Google::Cloud::Storage::PostObject.new "https://storage.googleapis.com",
            { key: "my-todo-app/avatars/heidi/400x400.png",
              GoogleAccessId: "0123456789@gserviceaccount.com",
              signature: "ABC...XYZ=",
              policy: "ABC...XYZ=" }
        end
      end
      class File
        def download path = nil, verify: :md5, encryption_key: nil
          # no-op stub, but ensures that calls match this copied signature
          return StringIO.new("Hello world!") if path.nil?
        end
        def signed_url method: nil, expires: nil, content_type: nil,
                       content_md5: nil, headers: nil, issuer: nil,
                       client_email: nil, signing_key: nil, private_key: nil
          # no-op stub, but ensures that calls match this copied signature
        end
      end
    end
  end
end

module Google
  module Cloud
    module Storage
      def self.stub_new
        define_singleton_method :new do |*args|
          yield *args
        end
      end
      # Create default unmocked methods that will raise if ever called
      def self.new *args
        raise "This code example is not yet mocked"
      end
    end
  end
end

def mock_storage
  Google::Cloud::Storage.stub_new do |*args|
    credentials = OpenStruct.new(client: OpenStruct.new(updater_proc: Proc.new {}))
    storage = Google::Cloud::Storage::Project.new(Google::Cloud::Storage::Service.new("my-todo-project", credentials))

    storage.service.mocked_service = Minitest::Mock.new

    yield storage.service.mocked_service if block_given?

    storage
  end
end

YARD::Doctest.configure do |doctest|
  # Current mocking does not support testing GAPIC layer. (Auth failures occur.)
  doctest.skip "Google::Cloud::Storage::V1beta1::SpeechClient"

  doctest.before "Google::Cloud.storage" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud#storage" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
    end
  end

  doctest.before "Google::Cloud::Storage.new" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
    end
  end

  # Bucket

  doctest.before "Google::Cloud::Storage::Bucket" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#cors" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :patch_bucket, bucket_gapi("my-todo-app"), ["my-todo-app", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#update" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :patch_bucket, bucket_gapi("my-todo-app"), ["my-todo-app", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#delete" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :delete_bucket, nil, ["my-bucket"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#files" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :list_objects, list_files_gapi, ["my-bucket", {:delimiter=>nil, :max_results=>nil, :page_token=>nil, :prefix=>nil, :versions=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#find_files" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :list_objects, list_files_gapi, ["my-bucket", {:delimiter=>nil, :max_results=>nil, :page_token=>nil, :prefix=>nil, :versions=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#create_file" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_object, file_gapi, ["my-bucket", Google::Apis::StorageV1::Object, Hash]
      # Following expectation is only used in last example
      mock.expect :get_object, file_gapi, ["my-bucket", "destination/path/file.ext", Hash]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#new_file" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_object, file_gapi, ["my-bucket", Google::Apis::StorageV1::Object, Hash]
      # Following expectation is only used in last example
      mock.expect :get_object, file_gapi, ["my-bucket", "destination/path/file.ext", Hash]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#upload_file" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_object, file_gapi, ["my-bucket", Google::Apis::StorageV1::Object, Hash]
      # Following expectation is only used in last example
      mock.expect :get_object, file_gapi, ["my-bucket", "destination/path/file.ext", Hash]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#signed_url" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#acl" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :insert_bucket_access_control, object_access_control_gapi, ["my-todo-app", Google::Apis::StorageV1::BucketAccessControl]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#acl@Or, grant access via a predefined permissions list:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-todo-app", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"publicRead", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#default_acl" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :insert_default_object_access_control, object_access_control_gapi, ["my-todo-app", Google::Apis::StorageV1::ObjectAccessControl]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#default_acl@Or, grant access via a predefined permissions list:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-todo-app", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"publicRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#policy" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_bucket_iam_policy, policy_gapi, ["my-todo-app"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#policy@Retrieve the latest policy and update it in a block:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_bucket_iam_policy, policy_gapi, ["my-todo-app"]
      mock.expect :set_bucket_iam_policy, new_policy_gapi, ["my-todo-app", Google::Apis::StorageV1::Policy]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#policy=" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_bucket_iam_policy, policy_gapi, ["my-todo-app"]
      mock.expect :set_bucket_iam_policy, new_policy_gapi, ["my-todo-app", Google::Apis::StorageV1::Policy]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket#test_permissions" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_bucket_iam_policy, policy_gapi, ["my-todo-app"]
      mock.expect :test_bucket_iam_permissions, permissions_gapi, ["my-todo-app", ["storage.buckets.get", "storage.buckets.delete"]]
    end
  end

  # Bucket::Acl

  doctest.before "Google::Cloud::Storage::Bucket::Acl#reload!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      access_controls = Google::Apis::StorageV1::BucketAccessControls.from_json(random_bucket_acl_hash("my-bucket").to_json)
      mock.expect :list_bucket_access_controls, access_controls, ["my-bucket"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      access_controls = Google::Apis::StorageV1::BucketAccessControls.from_json(random_bucket_acl_hash("my-bucket").to_json)
      mock.expect :list_bucket_access_controls, access_controls, ["my-bucket"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#add_owner" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_bucket_access_control, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::BucketAccessControl]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#add_writer" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_bucket_access_control, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::BucketAccessControl]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#add_reader" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_bucket_access_control, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::BucketAccessControl]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#delete" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :delete_bucket_access_control, true, ["my-bucket", "user-heidi@example.net"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#auth" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"authenticatedRead", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#private" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"private", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#project_private!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"projectPrivate", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#projectPrivate!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"projectPrivate", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#public" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"publicRead", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#public_write!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"publicReadWrite", :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Acl#publicReadWrite!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>"publicReadWrite", :predefined_default_object_acl=>nil}]
    end
  end

  # Bucket::DefaultAcl

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      access_controls = Google::Apis::StorageV1::ObjectAccessControls.from_json(random_default_acl_hash("my-bucket").to_json)
      mock.expect :list_default_object_access_controls, access_controls, ["my-bucket"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#add_" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :insert_default_object_access_control, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::ObjectAccessControl]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#delete" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :delete_default_object_access_control, true, ["my-bucket", "user-heidi@example.net"]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#auth" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"authenticatedRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#owner_full!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"bucketOwnerFullControl"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#bucketOwnerFullControl!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"bucketOwnerFullControl"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#owner_read!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"bucketOwnerRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#bucketOwnerRead!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"bucketOwnerRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#private" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"private"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#project" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"projectPrivate"}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::DefaultAcl#public" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, object_access_control_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>"publicRead"}]
    end
  end

  # Bucket::Cors

  doctest.before "Google::Cloud::Storage::Bucket::Cors" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :patch_bucket, bucket_gapi, ["my-bucket", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Bucket::Cors#add_rule" do
    mock_storage do |mock|
      mock.expect :insert_bucket, bucket_gapi, ["my-todo-project", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>nil}]
    end
  end

  # Bucket::List

  doctest.before "Google::Cloud::Storage::Bucket::List" do
    mock_storage do |mock|
      mock.expect :list_buckets, list_buckets_gapi, ["my-todo-project", {:prefix=>nil, :page_token=>nil, :max_results=>nil}]
    end
  end

  # Bucket::Policy

  doctest.before "Google::Cloud::Storage::Policy" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_bucket_iam_policy, policy_gapi, ["my-todo-app"]
      mock.expect :set_bucket_iam_policy, new_policy_gapi, ["my-todo-app", Google::Apis::StorageV1::Policy]
    end
  end

  doctest.before "Google::Cloud::Storage::Policy#role" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_bucket_iam_policy, policy_gapi, ["my-todo-app"]
      mock.expect :set_bucket_iam_policy, new_policy_gapi, ["my-todo-app", Google::Apis::StorageV1::Policy]
    end
  end

  # File

  doctest.before "Google::Cloud::Storage::File" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:download_dest=>"path/to/downloaded/file.ext", :generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#update" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#copy" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :rewrite_object, done_rewrite(file_gapi), ["my-bucket", "path/to/my-file.ext", "new-destination-bucket", "path/to/destination/file.ext", nil, {:destination_predefined_acl=>nil, :source_generation=>nil, :rewrite_token => nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#copy@The file can be copied to a new path in the current bucket:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :rewrite_object, done_rewrite(file_gapi), ["my-bucket", "path/to/my-file.ext", "my-bucket", "path/to/destination/file.ext", nil, {:destination_predefined_acl=>nil, :source_generation=>nil, :rewrite_token => nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#copy@The file can also be copied by specifying a generation:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :rewrite_object, done_rewrite(file_gapi), ["my-bucket", "path/to/my-file.ext", "my-bucket", "copy/of/previous/generation/file.ext", nil, {:destination_predefined_acl=>nil, :source_generation=>123456, :rewrite_token => nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#copy@The file can be modified during copying:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :rewrite_object, done_rewrite(file_gapi), ["my-bucket", "path/to/my-file.ext", "new-destination-bucket", "path/to/destination/file.ext", Google::Apis::StorageV1::Object, {:destination_predefined_acl=>nil, :source_generation=>nil, :rewrite_token => nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#rotate" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", Hash]
      mock.expect :rewrite_object, OpenStruct.new(done: true, resource: file_gapi), ["my-bucket", "path/to/my-file.ext", "my-bucket", "path/to/my-file.ext", nil, Hash]
    end
  end

  doctest.before "Google::Cloud::Storage::File#delete" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :delete_object, file_gapi, ["my-bucket", "path/to/my-file.ext"]
    end
  end

  doctest.before "Google::Cloud::Storage::File#download@Download to an in-memory StringIO object." do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#public_url" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_object, file_gapi, ["my-todo-app", "avatars/heidi/400x400.png", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#url" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_object, file_gapi, ["my-todo-app", "avatars/heidi/400x400.png", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#acl" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_object, file_gapi, ["my-todo-app", "avatars/heidi/400x400.png", {:generation=>nil, :options=>{}}]
      mock.expect :insert_object_access_control, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::ObjectAccessControl, {:generation=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#acl@Or, grant access via a predefined permissions list:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_object, file_gapi, ["my-todo-app", "avatars/heidi/400x400.png", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"publicRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File#signed_url" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      mock.expect :get_object, file_gapi, ["my-todo-app", "avatars/heidi/400x400.png", {:generation=>nil, :options=>{}}]
    end
  end

  # File::Acl

  doctest.before "Google::Cloud::Storage::File::Acl" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      access_controls = Google::Apis::StorageV1::ObjectAccessControls.from_json(random_file_acl_hash("my-bucket", "path/to/my-file.ext").to_json)
      mock.expect :list_object_access_controls, access_controls, ["my-bucket", "path/to/my-file.ext"]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#add_owner" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :insert_object_access_control, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::ObjectAccessControl, {:generation=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#add_reader" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :insert_object_access_control, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::ObjectAccessControl, {:generation=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#delete" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :delete_object_access_control, true, ["my-bucket", "path/to/my-file.ext", "user-heidi@example.net", {:generation=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#auth" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"authenticatedRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#owner_full!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"bucketOwnerFullControl"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#bucketOwnerFullControl!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"bucketOwnerFullControl"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#owner_read!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"bucketOwnerRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#bucketOwnerRead!" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"bucketOwnerRead"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#private" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"private"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#project" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"projectPrivate"}]
    end
  end

  doctest.before "Google::Cloud::Storage::File::Acl#public" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :patch_object, object_access_control_gapi, ["my-bucket", "path/to/my-file.ext", Google::Apis::StorageV1::Object, {:predefined_acl=>"publicRead"}]
    end
  end

  # File::List

  doctest.before "Google::Cloud::Storage::File::List" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :list_objects, list_files_gapi, ["my-bucket", {:delimiter=>nil, :max_results=>nil, :page_token=>nil, :prefix=>nil, :versions=>nil}]
    end
  end

  # Project

  doctest.before "Google::Cloud::Storage::Project" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
    end
  end

  doctest.before "Google::Cloud::Storage::Project#buckets" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :list_buckets, list_buckets_gapi, ["my-todo-project", {:prefix=>nil, :page_token=>nil, :max_results=>nil}]
    end
  end

  doctest.before "Google::Cloud::Storage::Project#buckets@Retrieve buckets with names that begin with a given prefix:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :list_buckets, list_buckets_gapi, ["my-todo-project", {:prefix=>"user-", :page_token=>nil, :max_results=>nil}]
    end
  end

  doctest.skip "Google::Cloud::Storage::Project#find_buckets" # alias for #buckets

  doctest.before "Google::Cloud::Storage::Project#create_bucket" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi, ["my-bucket"]
      mock.expect :get_object, file_gapi, ["my-bucket", "path/to/my-file.ext", {:generation=>nil, :options=>{}}]
      mock.expect :insert_bucket, bucket_gapi, ["my-todo-project", Google::Apis::StorageV1::Bucket, {:predefined_acl=>nil, :predefined_default_object_acl=>nil}]
    end
  end

  # PostObject

  doctest.before "Google::Cloud::Storage::Bucket#post_object" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
    end
  end
  doctest.before "Google::Cloud::Storage::Bucket#post_object@Using a policy to define the upload authorization:" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
    end
  end
  doctest.before "Google::Cloud::Storage::Bucket#post_object@Using the issuer and signing_key options:" do
    mock_storage do |mock|
      OpenSSL::PKey::RSA.stub :new, "key" do
        mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
      end
    end
  end

  doctest.before "Google::Cloud::Storage::PostObject" do
    mock_storage do |mock|
      mock.expect :get_bucket, bucket_gapi("my-todo-app"), ["my-todo-app"]
    end
  end

end

# Fixture helpers

def bucket_gapi name = "my-bucket"
  Google::Apis::StorageV1::Bucket.from_json random_bucket_hash(name).to_json
end

def list_buckets_gapi count = 2, token = nil
  buckets = count.times.map { bucket_gapi }
  Google::Apis::StorageV1::Buckets.new(
    kind: "storage#buckets", items: buckets, next_page_token: token
  )
end

def file_gapi bucket_name = "my-bucket", name = "path/to/my-file.ext"
  Google::Apis::StorageV1::Object.from_json random_file_hash(bucket_name, name).to_json
end

def list_files_gapi count = 2, token = nil, prefixes = nil
  files = count.times.map { file_gapi }
  Google::Apis::StorageV1::Objects.new kind: "storage#objects", items: files, next_page_token: token, prefixes: prefixes
end

def object_access_control_gapi
  entity = "project-owners-1234567890"
  Google::Apis::StorageV1::ObjectAccessControl.new entity: entity
end

def done_rewrite gapi
  Google::Apis::StorageV1::RewriteResponse.new done: true, resource: gapi
end

def random_bucket_hash(name = "my-bucket",
  url_root="https://www.googleapis.com/storage/v1", location="US",
  storage_class="STANDARD", versioning=nil, logging_bucket=nil,
  logging_prefix=nil, website_main=nil, website_404=nil)
  versioning_config = { "enabled" => versioning } if versioning
  { "kind" => "storage#bucket",
    "id" => name,
    "selfLink" => "#{url_root}/b/#{name}",
    "projectNumber" => "1234567890",
    "name" => name,
    "timeCreated" => Time.now,
    "metageneration" => "1",
    "owner" => { "entity" => "project-owners-1234567890" },
    "location" => location,
    "cors" => [{"origin"=>["http://example.org"], "method"=>["GET","POST","DELETE"], "responseHeader"=>["X-My-Custom-Header"], "maxAgeSeconds"=>3600},{"origin"=>["http://example.org"], "method"=>["GET","POST","DELETE"], "responseHeader"=>["X-My-Custom-Header"], "maxAgeSeconds"=>3600}],
    "logging" => logging_hash(logging_bucket, logging_prefix),
    "storageClass" => storage_class,
    "versioning" => versioning_config,
    "website" => website_hash(website_main, website_404),
    "etag" => "CAE=" }.delete_if { |_, v| v.nil? }
end

def logging_hash(bucket, prefix)
  { "logBucket"       => bucket,
    "logObjectPrefix" => prefix,
  }.delete_if { |_, v| v.nil? } if bucket || prefix
end

def website_hash(website_main, website_404)
  { "mainPageSuffix" => website_main,
    "notFoundPage"   => website_404,
  }.delete_if { |_, v| v.nil? } if website_main || website_404
end

def random_file_hash bucket, name, generation="1234567890"
  { "kind" => "storage#object",
    "id" => "#{bucket}/#{name}/1234567890",
    "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket}/o/#{name}",
    "name" => "#{name}",
    "timeCreated" => Time.now,
    "bucket" => "#{bucket}",
    "generation" => generation,
    "metageneration" => "1",
    "cacheControl" => "public, max-age=3600",
    "contentDisposition" => "attachment; filename=filename.ext",
    "contentEncoding" => "gzip",
    "contentLanguage" => "en",
    "contentType" => "text/plain",
    "updated" => Time.now,
    "storageClass" => "STANDARD",
    "size" => rand(10_000),
    "md5Hash" => "HXB937GQDFxDFqUGi//weQ==",
    "mediaLink" => "https://www.googleapis.com/download/storage/v1/b/#{bucket}/o/#{name}?generation=1234567890&alt=media",
    "metadata" => { "player" => "Alice", "score" => "101" },
    "owner" => { "entity" => "user-1234567890", "entityId" => "abc123" },
    "crc32c" => "Lm1F3g==",
    "etag" => "CKih16GjycICEAE=" }
end

def random_bucket_acl_hash bucket_name
  {
   "kind" => "storage#bucketAccessControls",
   "items" => [
    {
     "kind" => "storage#bucketAccessControl",
     "id" => "#{bucket_name}-UUID/project-owners-1234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}-UUID/acl/project-owners-1234567890",
     "bucket" => "#{bucket_name}-UUID",
     "entity" => "project-owners-1234567890",
     "role" => "OWNER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "owners"
     },
     "etag" => "CAE="
    },
    {
     "kind" => "storage#bucketAccessControl",
     "id" => "#{bucket_name}-UUID/project-editors-1234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}-UUID/acl/project-editors-1234567890",
     "bucket" => "#{bucket_name}-UUID",
     "entity" => "project-editors-1234567890",
     "role" => "OWNER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "editors"
     },
     "etag" => "CAE="
    },
    {
     "kind" => "storage#bucketAccessControl",
     "id" => "#{bucket_name}-UUID/project-viewers-1234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}-UUID/acl/project-viewers-1234567890",
     "bucket" => "#{bucket_name}-UUID",
     "entity" => "project-viewers-1234567890",
     "role" => "READER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "viewers"
     },
     "etag" => "CAE="
    }
   ]
  }
end

def random_default_acl_hash bucket_name
  {
   "kind" => "storage#objectAccessControls",
   "items" => [
    {
     "kind" => "storage#objectAccessControl",
     "entity" => "project-owners-1234567890",
     "role" => "OWNER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "owners"
     },
     "etag" => "CAE="
    },
    {
     "kind" => "storage#objectAccessControl",
     "entity" => "project-editors-1234567890",
     "role" => "OWNER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "editors"
     },
     "etag" => "CAE="
    },
    {
     "kind" => "storage#objectAccessControl",
     "entity" => "project-viewers-1234567890",
     "role" => "READER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "viewers"
     },
     "etag" => "CAE="
    }
   ]
  }
end

def random_file_acl_hash bucket_name, file_name
  {
   "kind" => "storage#objectAccessControls",
   "items" => [
    {
     "kind" => "storage#objectAccessControl",
     "id" => "#{bucket_name}/#{file_name}/123/project-owners-1234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}/o/#{file_name}/acl/project-owners-1234567890",
     "bucket" => "#{bucket_name}",
     "object" => "#{file_name}",
     "generation" => "123",
     "entity" => "project-owners-1234567890",
     "role" => "OWNER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "owners"
     },
     "etag" => "abcDEF123="
    },
    {
     "kind" => "storage#objectAccessControl",
     "id" => "#{bucket_name}/#{file_name}/123/project-editors-1234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}/o/#{file_name}/acl/project-editors-1234567890",
     "bucket" => "#{bucket_name}",
     "object" => "#{file_name}",
     "generation" => "123",
     "entity" => "project-editors-1234567890",
     "role" => "OWNER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "editors"
     },
     "etag" => "abcDEF123="
    },
    {
     "kind" => "storage#objectAccessControl",
     "id" => "#{bucket_name}/#{file_name}/123/project-viewers-1234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}/o/#{file_name}/acl/project-viewers-1234567890",
     "bucket" => "#{bucket_name}",
     "object" => "#{file_name}",
     "generation" => "123",
     "entity" => "project-viewers-1234567890",
     "role" => "READER",
     "projectTeam" => {
      "projectNumber" => "1234567890",
      "team" => "viewers"
     },
     "etag" => "abcDEF123="
    },
    {
     "kind" => "storage#objectAccessControl",
     "id" => "#{bucket_name}/#{file_name}/123/user-12345678901234567890",
     "selfLink" => "https://www.googleapis.com/storage/v1/b/#{bucket_name}/o/#{file_name}/acl/user-12345678901234567890",
     "bucket" => "#{bucket_name}",
     "object" => "#{file_name}",
     "generation" => "123",
     "entity" => "user-12345678901234567890",
     "role" => "OWNER",
     "entityId" => "12345678901234567890",
     "etag" => "abcDEF123="
    }
   ]
  }
end

def policy_gapi
  Google::Apis::StorageV1::Policy.new(
    etag: "CAE=",
    bindings: [
      Google::Apis::StorageV1::Policy::Binding.new(
        role: "roles/storage.objectViewer",
        members: [
          "user:viewer@example.com"
        ]
      )
    ]
  )
end

def new_policy_gapi
  Google::Apis::StorageV1::Policy.new(
    etag: "CAE=",
    bindings: [
      Google::Apis::StorageV1::Policy::Binding.new(
        role: "roles/storage.objectViewer",
        members: [
          "user:viewer@example.com",
          "serviceAccount:1234567890@developer.gserviceaccount.com"
        ]
      )
    ]
  )
end

def permissions_gapi
  Google::Apis::StorageV1::TestIamPermissionsResponse.new(
    permissions: ["storage.buckets.get"]
  )
end


text:
module Dragon
  module Events
    class GamblingVictoryEvent < Event
      attr_reader :amount, :outcome

      def initialize(amount: nil, outcome: nil)
        @amount = amount
        @outcome = outcome
      end

      def describe
        "You correctly predicted the outcome #{outcome}, so you win #{amount}"
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2012. All Rights Reserved.                        */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj;

/**
 * A Skeleton object to be used with Kinect data from the
 * FRC Kinect server on the DriverStation
 * @author koconnor
 */
public class Skeleton {

    /**
     * The TrackState of the skeleton
     */
   public static class tTrackState{

       /** The integer value representing this enumeration. */
        public final int value;

        protected static final int kNotTracked_val = 0;
        protected static final int kPositionOnly_val = 1;
        protected static final int kTracked_val = 2;

        /** TrackState: Not Tracked */
        public static final tTrackState kNotTracked = new tTrackState(kNotTracked_val);
        /** TrackState: Position Only */
        public static final tTrackState kPositionOnly = new tTrackState(kPositionOnly_val);
        /** TrackState: Tracked */
        public static final tTrackState kTracked = new tTrackState(kTracked_val);

        private tTrackState(int value){
            this.value = value;
        }
    }

   /**
    * The Joint TrackingState
    */
   public static class tJointTrackingState{
        /** The integer value representing this enumeration. */
        public final int value;

        protected static final int kNotTracked_val = 0;
        protected static final int kInferred_val = 1;
        protected static final int kTracked_val = 2;

        /** Joint TrackingState: Not Tracked */
        public static final tJointTrackingState kNotTracked = new tJointTrackingState(kNotTracked_val);
        /** Joint TrackingState: Inferred */
        public static final tJointTrackingState kInferred = new tJointTrackingState(kInferred_val);
        /** Joint TrackingState: Tracked */
        public static final tJointTrackingState kTracked = new tJointTrackingState(kTracked_val);

        private tJointTrackingState(int value){
            this.value = value;
        }
   }

   /**
    * An individual Joint from Kinect data
    */
   public class Joint {
       protected float x, y, z;
       protected byte trackingState;

       Joint(){ x = y = z = 0;}

       public float getX() {return x;}
       public float getY() {return y;}
       public float getZ() {return z;}
       public tJointTrackingState getTrackingState() {
           switch(trackingState){
           case 1:
               return tJointTrackingState.kInferred;
           case 2:
               return tJointTrackingState.kTracked;
           default:
               return tJointTrackingState.kNotTracked;
           }
       }
   }

   /**
    * Helper class used to index the joints in a (@link Skeleton)
    */
   public static class tJointTypes{
            public final int value;

            protected static final int kHipCenter_val = 0;
            protected static final int kSpine_val = 1;
            protected static final int kShoulderCenter_val = 2;
            protected static final int kHead_val = 3;
            protected static final int kShoulderLeft_val = 4;
            protected static final int kElbowLeft_val = 5;
            protected static final int kWristLeft_val = 6;
            protected static final int kHandLeft_val = 7;
            protected static final int kShoulderRight_val = 8;
            protected static final int kElbowRight_val = 9;
            protected static final int kWristRight_val = 10;
            protected static final int kHandRight_val = 11;
            protected static final int kHipLeft_val = 12;
            protected static final int kKneeLeft_val = 13;
            protected static final int kAnkleLeft_val = 14;
            protected static final int kFootLeft_val = 15;
            protected static final int kHipRight_val = 16;
            protected static final int kKneeRight_val = 17;
            protected static final int kAnkleRight_val = 18;
            protected static final int kFootRight_val = 19;
            protected static final int kCount_val = 20;

            public static final tJointTypes kHipCenter = new tJointTypes(kHipCenter_val);
            public static final tJointTypes kSpine = new tJointTypes(kSpine_val);
            public static final tJointTypes kShoulderCenter = new tJointTypes(kShoulderCenter_val);
            public static final tJointTypes kHead = new tJointTypes(kHead_val);
            public static final tJointTypes kShoulderLeft = new tJointTypes(kShoulderLeft_val);
            public static final tJointTypes kElbowLeft = new tJointTypes(kElbowLeft_val);
            public static final tJointTypes kWristLeft = new tJointTypes(kWristLeft_val);
            public static final tJointTypes kHandLeft = new tJointTypes(kHandLeft_val);
            public static final tJointTypes kShoulderRight = new tJointTypes(kShoulderRight_val);
            public static final tJointTypes kElbowRight = new tJointTypes(kElbowRight_val);
            public static final tJointTypes kWristRight = new tJointTypes(kWristRight_val);
            public static final tJointTypes kHandRight = new tJointTypes(kHandRight_val);
            public static final tJointTypes kHipLeft = new tJointTypes(kHipLeft_val);
            public static final tJointTypes kKneeLeft = new tJointTypes(kKneeLeft_val);
            public static final tJointTypes kAnkleLeft = new tJointTypes(kAnkleLeft_val);
            public static final tJointTypes kFootLeft = new tJointTypes(kFootLeft_val);
            public static final tJointTypes kHipRight = new tJointTypes(kHipRight_val);
            public static final tJointTypes kKneeRight = new tJointTypes(kKneeRight_val);
            public static final tJointTypes kAnkleRight = new tJointTypes(kAnkleRight_val);
            public static final tJointTypes kFootRight = new tJointTypes(kFootRight_val);
            public static final tJointTypes kCount = new tJointTypes(kCount_val);

            private tJointTypes(int value){
                this.value = value;
            }
   }

   	public Joint GetHandRight() { return skeleton[tJointTypes.kHandRight.value]; }
	public Joint GetHandLeft() {  return skeleton[tJointTypes.kHandLeft.value]; }
	public Joint GetWristRight() {  return skeleton[tJointTypes.kWristRight.value]; }
	public Joint GetWristLeft() {  return skeleton[tJointTypes.kWristLeft.value]; }
	public Joint GetElbowLeft() {  return skeleton[tJointTypes.kElbowLeft.value]; }
	public Joint GetElbowRight() {  return skeleton[tJointTypes.kElbowRight.value]; }
	public Joint GetShoulderLeft() {  return skeleton[tJointTypes.kShoulderLeft.value]; }
	public Joint GetShoulderRight() {  return skeleton[tJointTypes.kShoulderRight.value]; }
	public Joint GetShoulderCenter() {  return skeleton[tJointTypes.kShoulderCenter.value]; }
	public Joint GetHead() {  return skeleton[tJointTypes.kHead.value]; }
	public Joint GetSpine() {  return skeleton[tJointTypes.kSpine.value]; }
	public Joint GetHipCenter() {  return skeleton[tJointTypes.kHipCenter.value]; }
	public Joint GetHipRight() {  return skeleton[tJointTypes.kHipRight.value]; }
	public Joint GetHipLeft() {  return skeleton[tJointTypes.kHipLeft.value]; }
	public Joint GetKneeLeft() {  return skeleton[tJointTypes.kKneeLeft.value]; }
	public Joint GetKneeRight() {  return skeleton[tJointTypes.kKneeRight.value]; }
	public Joint GetAnkleLeft() {  return skeleton[tJointTypes.kAnkleLeft.value]; }
	public Joint GetAnkleRight() {  return skeleton[tJointTypes.kAnkleRight.value]; }
	public Joint GetFootLeft() {  return skeleton[tJointTypes.kFootLeft.value]; }
	public Joint GetFootRight() {  return skeleton[tJointTypes.kFootRight.value]; }
	public Joint GetJoint(tJointTypes index) { return skeleton[index.value]; }

        public tTrackState GetTrackState(){ return trackState;}

   Skeleton(){
   for(int i=0; i<20; i++){
       skeleton[i] = new Joint();
       }
   }

   protected Joint[] skeleton = new Joint[20];
   protected tTrackState trackState;
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.ComponentModel.Composition;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.TextManager.Interop;
using IAsyncServiceProvider = Microsoft.VisualStudio.Shell.IAsyncServiceProvider;
using SAsyncServiceProvider = Microsoft.VisualStudio.Shell.Interop.SAsyncServiceProvider;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
{
    [Export(typeof(IOptionPersisterProvider))]
    internal sealed class LanguageSettingsPersisterProvider : IOptionPersisterProvider
    {
        private readonly IThreadingContext _threadingContext;
        private readonly IAsyncServiceProvider _serviceProvider;
        private readonly IGlobalOptionService _optionService;
        private LanguageSettingsPersister? _lazyPersister;

        [ImportingConstructor]
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
        public LanguageSettingsPersisterProvider(
            IThreadingContext threadingContext,
            [Import(typeof(SAsyncServiceProvider))] IAsyncServiceProvider serviceProvider,
            IGlobalOptionService optionService)
        {
            _threadingContext = threadingContext;
            _serviceProvider = serviceProvider;
            _optionService = optionService;
        }

        public async ValueTask<IOptionPersister> GetOrCreatePersisterAsync(CancellationToken cancellationToken)
        {
            if (_lazyPersister is not null)
            {
                return _lazyPersister;
            }

            await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            // Asynchronously load dependent package prior to calling synchronous APIs on IVsTextManager4
            _ = await _serviceProvider.GetServiceAsync(typeof(SVsManagedFontAndColorInformation)).ConfigureAwait(true);

            var textManager = (IVsTextManager4?)await _serviceProvider.GetServiceAsync(typeof(SVsTextManager)).ConfigureAwait(true);
            Assumes.Present(textManager);

            _lazyPersister ??= new LanguageSettingsPersister(_threadingContext, textManager, _optionService);
            return _lazyPersister;
        }

        /// <summary>
        /// Shim to allow asynchronous loading of a package prior to calling synchronous (blocking) APIs that use it.
        /// </summary>
        [Guid("48d069e8-1993-4752-baf3-232236a3ea4f")]
        private class SVsManagedFontAndColorInformation
        {
        }
    }
}


text: Metalsmith {{custom}}


text:
import {
  addNoneTerminalToCst,
  addTerminalToCst,
  setNodeLocationFull,
  setNodeLocationOnlyOffset
} from "../../cst/cst"
import noop from "lodash/noop"
import has from "lodash/has"
import keys from "lodash/keys"
import isUndefined from "lodash/isUndefined"
import {
  createBaseSemanticVisitorConstructor,
  createBaseVisitorConstructorWithDefaults
} from "../../cst/cst_visitor"
import {
  CstNode,
  CstNodeLocation,
  ICstVisitor,
  IParserConfig,
  IToken,
  nodeLocationTrackingOptions
} from "@chevrotain/types"
import { MixedInParser } from "./parser_traits"
import { DEFAULT_PARSER_CONFIG } from "../parser"

/**
 * This trait is responsible for the CST building logic.
 */
export class TreeBuilder {
  outputCst: boolean
  CST_STACK: CstNode[]
  baseCstVisitorConstructor: Function
  baseCstVisitorWithDefaultsConstructor: Function

  // dynamically assigned Methods
  setNodeLocationFromNode: (
    nodeLocation: CstNodeLocation,
    locationInformation: CstNodeLocation
  ) => void
  setNodeLocationFromToken: (
    nodeLocation: CstNodeLocation,
    locationInformation: CstNodeLocation
  ) => void
  cstPostRule: (this: MixedInParser, ruleCstNode: CstNode) => void

  setInitialNodeLocation: (cstNode: CstNode) => void
  nodeLocationTracking: nodeLocationTrackingOptions

  initTreeBuilder(this: MixedInParser, config: IParserConfig) {
    this.CST_STACK = []

    // outputCst is no longer exposed/defined in the pubic API
    this.outputCst = (config as any).outputCst

    this.nodeLocationTracking = has(config, "nodeLocationTracking")
      ? (config.nodeLocationTracking as nodeLocationTrackingOptions) // assumes end user provides the correct config value/type
      : DEFAULT_PARSER_CONFIG.nodeLocationTracking

    if (!this.outputCst) {
      this.cstInvocationStateUpdate = noop
      this.cstFinallyStateUpdate = noop
      this.cstPostTerminal = noop
      this.cstPostNonTerminal = noop
      this.cstPostRule = noop
    } else {
      if (/full/i.test(this.nodeLocationTracking)) {
        if (this.recoveryEnabled) {
          this.setNodeLocationFromToken = setNodeLocationFull
          this.setNodeLocationFromNode = setNodeLocationFull
          this.cstPostRule = noop
          this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery
        } else {
          this.setNodeLocationFromToken = noop
          this.setNodeLocationFromNode = noop
          this.cstPostRule = this.cstPostRuleFull
          this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular
        }
      } else if (/onlyOffset/i.test(this.nodeLocationTracking)) {
        if (this.recoveryEnabled) {
          this.setNodeLocationFromToken = <any>setNodeLocationOnlyOffset
          this.setNodeLocationFromNode = <any>setNodeLocationOnlyOffset
          this.cstPostRule = noop
          this.setInitialNodeLocation =
            this.setInitialNodeLocationOnlyOffsetRecovery
        } else {
          this.setNodeLocationFromToken = noop
          this.setNodeLocationFromNode = noop
          this.cstPostRule = this.cstPostRuleOnlyOffset
          this.setInitialNodeLocation =
            this.setInitialNodeLocationOnlyOffsetRegular
        }
      } else if (/none/i.test(this.nodeLocationTracking)) {
        this.setNodeLocationFromToken = noop
        this.setNodeLocationFromNode = noop
        this.cstPostRule = noop
        this.setInitialNodeLocation = noop
      } else {
        throw Error(
          `Invalid <nodeLocationTracking> config option: "${config.nodeLocationTracking}"`
        )
      }
    }
  }

  setInitialNodeLocationOnlyOffsetRecovery(
    this: MixedInParser,
    cstNode: any
  ): void {
    cstNode.location = {
      startOffset: NaN,
      endOffset: NaN
    }
  }

  setInitialNodeLocationOnlyOffsetRegular(
    this: MixedInParser,
    cstNode: any
  ): void {
    cstNode.location = {
      // without error recovery the starting Location of a new CstNode is guaranteed
      // To be the next Token's startOffset (for valid inputs).
      // For invalid inputs there won't be any CSTOutput so this potential
      // inaccuracy does not matter
      startOffset: this.LA(1).startOffset,
      endOffset: NaN
    }
  }

  setInitialNodeLocationFullRecovery(this: MixedInParser, cstNode: any): void {
    cstNode.location = {
      startOffset: NaN,
      startLine: NaN,
      startColumn: NaN,
      endOffset: NaN,
      endLine: NaN,
      endColumn: NaN
    }
  }

  /**
     *  @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work

     * @param cstNode
     */
  setInitialNodeLocationFullRegular(this: MixedInParser, cstNode: any): void {
    const nextToken = this.LA(1)
    cstNode.location = {
      startOffset: nextToken.startOffset,
      startLine: nextToken.startLine,
      startColumn: nextToken.startColumn,
      endOffset: NaN,
      endLine: NaN,
      endColumn: NaN
    }
  }

  cstInvocationStateUpdate(this: MixedInParser, fullRuleName: string): void {
    const cstNode: CstNode = {
      name: fullRuleName,
      children: Object.create(null)
    }

    this.setInitialNodeLocation(cstNode)
    this.CST_STACK.push(cstNode)
  }

  cstFinallyStateUpdate(this: MixedInParser): void {
    this.CST_STACK.pop()
  }

  cstPostRuleFull(this: MixedInParser, ruleCstNode: CstNode): void {
    // casts to `required<CstNodeLocation>` are safe because `cstPostRuleFull` should only be invoked when full location is enabled
    const prevToken = this.LA(0) as Required<CstNodeLocation>
    const loc = ruleCstNode.location as Required<CstNodeLocation>

    // If this condition is true it means we consumed at least one Token
    // In this CstNode.
    if (loc.startOffset <= prevToken.startOffset === true) {
      loc.endOffset = prevToken.endOffset
      loc.endLine = prevToken.endLine
      loc.endColumn = prevToken.endColumn
    }
    // "empty" CstNode edge case
    else {
      loc.startOffset = NaN
      loc.startLine = NaN
      loc.startColumn = NaN
    }
  }

  cstPostRuleOnlyOffset(this: MixedInParser, ruleCstNode: CstNode): void {
    const prevToken = this.LA(0)
    // `location' is not null because `cstPostRuleOnlyOffset` will only be invoked when location tracking is enabled.
    const loc = ruleCstNode.location!

    // If this condition is true it means we consumed at least one Token
    // In this CstNode.
    if (loc.startOffset <= prevToken.startOffset === true) {
      loc.endOffset = prevToken.endOffset
    }
    // "empty" CstNode edge case
    else {
      loc.startOffset = NaN
    }
  }

  cstPostTerminal(
    this: MixedInParser,
    key: string,
    consumedToken: IToken
  ): void {
    const rootCst = this.CST_STACK[this.CST_STACK.length - 1]
    addTerminalToCst(rootCst, consumedToken, key)
    // This is only used when **both** error recovery and CST Output are enabled.
    this.setNodeLocationFromToken(rootCst.location!, <any>consumedToken)
  }

  cstPostNonTerminal(
    this: MixedInParser,
    ruleCstResult: CstNode,
    ruleName: string
  ): void {
    const preCstNode = this.CST_STACK[this.CST_STACK.length - 1]
    addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult)
    // This is only used when **both** error recovery and CST Output are enabled.
    this.setNodeLocationFromNode(preCstNode.location!, ruleCstResult.location!)
  }

  getBaseCstVisitorConstructor<IN = any, OUT = any>(
    this: MixedInParser
  ): {
    new (...args: any[]): ICstVisitor<IN, OUT>
  } {
    if (isUndefined(this.baseCstVisitorConstructor)) {
      const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(
        this.className,
        keys(this.gastProductionsCache)
      )
      this.baseCstVisitorConstructor = newBaseCstVisitorConstructor
      return newBaseCstVisitorConstructor
    }

    return <any>this.baseCstVisitorConstructor
  }

  getBaseCstVisitorConstructorWithDefaults<IN = any, OUT = any>(
    this: MixedInParser
  ): {
    new (...args: any[]): ICstVisitor<IN, OUT>
  } {
    if (isUndefined(this.baseCstVisitorWithDefaultsConstructor)) {
      const newConstructor = createBaseVisitorConstructorWithDefaults(
        this.className,
        keys(this.gastProductionsCache),
        this.getBaseCstVisitorConstructor()
      )
      this.baseCstVisitorWithDefaultsConstructor = newConstructor
      return newConstructor
    }

    return <any>this.baseCstVisitorWithDefaultsConstructor
  }

  getLastExplicitRuleShortName(this: MixedInParser): number {
    const ruleStack = this.RULE_STACK
    return ruleStack[ruleStack.length - 1]
  }

  getPreviousExplicitRuleShortName(this: MixedInParser): number {
    const ruleStack = this.RULE_STACK
    return ruleStack[ruleStack.length - 2]
  }

  getLastExplicitRuleOccurrenceIndex(this: MixedInParser): number {
    const occurrenceStack = this.RULE_OCCURRENCE_STACK
    return occurrenceStack[occurrenceStack.length - 1]
  }
}


text:
package com.notronix.lw.api.model;

public class ActionablePostSaleSearchFilters
{
    private Boolean Actionable;
    private FilterType Type;
    private String Value;

    public Boolean getActionable() {
        return Actionable;
    }

    public void setActionable(Boolean actionable) {
        Actionable = actionable;
    }

    public FilterType getType() {
        return Type;
    }

    public void setType(FilterType type) {
        Type = type;
    }

    public String getValue() {
        return Value;
    }

    public void setValue(String value) {
        Value = value;
    }
}


text:
namespace Tccc {
    export class AdminSubmissionsController {

        totalTalks = 0;
        pendingSubmissions: Talk[] = [];
        approvedSubmissions: Talk[] = [];
        rejectedSubmissions: Talk[] = [];
        currentTalk: Talk | null = null;
        selectedFilter = TalkApproval.Pending;
        approvalOptions = [
            { value: TalkApproval.Pending, name: "Pending", collection: this.pendingSubmissions },
            { value: TalkApproval.Approved, name: "Approved", collection: this.approvedSubmissions },
            { value: TalkApproval.Rejected, name: "Rejected", collection: this.rejectedSubmissions },
        ];
        isSaving = false;
        readonly eventId: string;

        static $inject = [
            "isUserAdmin",
            "talkApi",
            "$routeParams"
        ];

        constructor(
            private isUserAdmin: boolean,
            private talkApi: TalkService,
            $routeParams) {

            this.eventId = "events/" + $routeParams["eventNumber"];
        }

        $onInit() {
            if (!this.isUserAdmin) {
                window.location.href = "/account/login";
            }

            this.fetchSubmissions();
        }

        //get getGoogleDocText() {
        //    if (this.currentTalk) {
        //        var idLower = this.currentTalk.id ? this.currentTalk.id.toLowerCase() : "";
        //        var tags = this.currentTalk.tags.map(t => "🏷 " + t).join(", ");
        //        return `${this.currentTalk.title} https://twincitiescodecamp.com/#/${idLower} ${tags}`;
        //    }

        //    return "";
        //}

        get currentTalkEmail(): string {
            return this.currentTalk && this.currentTalk.submittedByUserId ?
                this.currentTalk.submittedByUserId.replace("ApplicationUsers/", "") : "";
        }

        get submissions(): Talk[] {
            if (this.selectedFilter === TalkApproval.Approved) {
                return this.approvedSubmissions;
            } else if (this.selectedFilter === TalkApproval.Rejected) {
                return this.rejectedSubmissions;
            }

            return this.pendingSubmissions;
        }

        get currentTalkStatus(): string {
            if (this.currentTalk) {
                var desiredStatus = this.currentTalk.status;
                var status = this.approvalOptions.find(o => o.value === desiredStatus);
                if (status) {
                    return status.name;
                }
            }

            return "";
        }

        fetchSubmissions() {
            this.talkApi.getSubmissions(this.eventId)
                .then(results => {
                    this.pendingSubmissions.push(...results.filter(t => t.status === TalkApproval.Pending));
                    this.approvedSubmissions.push(...results.filter(t => t.status === TalkApproval.Approved));
                    this.rejectedSubmissions.push(...results.filter(t => t.status === TalkApproval.Rejected));
                    this.currentTalk = this.submissions[0];
                    this.totalTalks = results.length;
                });
        }

        setApprovalStatus(talk: Talk, status: TalkApproval) {
            if (!this.isSaving && talk.id) {
                this.isSaving = true;
                if (status === TalkApproval.Approved) {
                    this.talkApi.approve(talk.id)
                        .then(result => {
                            // Approve the talk, move it into the right collection.
                            talk.status = result.status;
                            _.pull(this.pendingSubmissions, talk);
                            this.approvedSubmissions.push(talk);
                            this.currentTalk = this.submissions[0];
                        })
                        .finally(() => this.isSaving = false);
                } else if (status === TalkApproval.Rejected) {
                    this.talkApi.reject(talk.id)
                        .then(result => {
                            // Reject the talk, move it into the right collection.
                            _.pull(this.pendingSubmissions, talk);
                            this.rejectedSubmissions.push(talk);
                            talk.status = result.status;
                            this.currentTalk = this.submissions[0];
                        })
                        .finally(() => this.isSaving = false);
                }
            }
        }
    }

    App.controller("AdminSubmissionsController", AdminSubmissionsController);
}


text:
namespace display {
namespace win {

namespace {

std::vector<ScreenWinDisplay> DisplayInfosToScreenWinDisplays(
    const std::vector<DisplayInfo>& display_infos) {
  std::vector<ScreenWinDisplay> screen_win_displays;
  for (const auto& display_info : display_infos)
    screen_win_displays.push_back(ScreenWinDisplay(display_info));

  return screen_win_displays;
}

std::vector<gfx::Display> ScreenWinDisplaysToDisplays(
    const std::vector<ScreenWinDisplay>& screen_win_displays) {
  std::vector<gfx::Display> displays;
  for (const auto& screen_win_display : screen_win_displays)
    displays.push_back(screen_win_display.display());

  return displays;
}

MONITORINFOEX MonitorInfoFromHMONITOR(HMONITOR monitor) {
  MONITORINFOEX monitor_info;
  ::ZeroMemory(&monitor_info, sizeof(monitor_info));
  monitor_info.cbSize = sizeof(monitor_info);
  ::GetMonitorInfo(monitor, &monitor_info);
  return monitor_info;
}

BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor,
                                  HDC hdc,
                                  LPRECT rect,
                                  LPARAM data) {
  std::vector<DisplayInfo>* display_infos =
      reinterpret_cast<std::vector<DisplayInfo>*>(data);
  DCHECK(display_infos);
  display_infos->push_back(DisplayInfo(MonitorInfoFromHMONITOR(monitor),
                                       gfx::GetDPIScale()));
  return TRUE;
}

std::vector<DisplayInfo> GetDisplayInfosFromSystem() {
  std::vector<DisplayInfo> display_infos;
  EnumDisplayMonitors(nullptr, nullptr, EnumMonitorCallback,
                      reinterpret_cast<LPARAM>(&display_infos));
  DCHECK_EQ(static_cast<size_t>(::GetSystemMetrics(SM_CMONITORS)),
            display_infos.size());
  return display_infos;
}

}  // namespace

ScreenWin::ScreenWin() {
  Initialize();
}

ScreenWin::~ScreenWin() = default;

HWND ScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const {
  NOTREACHED();
  return nullptr;
}

gfx::NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const {
  NOTREACHED();
  return nullptr;
}

gfx::Point ScreenWin::GetCursorScreenPoint() {
  POINT pt;
  ::GetCursorPos(&pt);
  gfx::Point cursor_pos_pixels(pt);
  return gfx::win::ScreenToDIPPoint(cursor_pos_pixels);
}

gfx::NativeWindow ScreenWin::GetWindowUnderCursor() {
  POINT cursor_loc;
  HWND hwnd =
      ::GetCursorPos(&cursor_loc) ? ::WindowFromPoint(cursor_loc) : nullptr;
  return GetNativeWindowFromHWND(hwnd);
}

gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) {
  gfx::Point point_in_pixels = gfx::win::DIPToScreenPoint(point);
  return GetNativeWindowFromHWND(WindowFromPoint(point_in_pixels.ToPOINT()));
}

int ScreenWin::GetNumDisplays() const {
  return static_cast<int>(screen_win_displays_.size());
}

std::vector<gfx::Display> ScreenWin::GetAllDisplays() const {
  return ScreenWinDisplaysToDisplays(screen_win_displays_);
}

gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const {
  HWND window_hwnd = GetHWNDFromNativeView(window);
  if (!window_hwnd) {
    // When |window| isn't rooted to a display, we should just return the
    // default display so we get some correct display information like the
    // scaling factor.
    return GetPrimaryDisplay();
  }
  ScreenWinDisplay screen_win_display =
      GetScreenWinDisplayNearestHWND(window_hwnd);
  return screen_win_display.display();
}

gfx::Display ScreenWin::GetDisplayNearestPoint(const gfx::Point& point) const {
  gfx::Point screen_point(gfx::win::DIPToScreenPoint(point));
  ScreenWinDisplay screen_win_display =
      GetScreenWinDisplayNearestScreenPoint(screen_point);
  return screen_win_display.display();
}

gfx::Display ScreenWin::GetDisplayMatching(const gfx::Rect& match_rect) const {
  ScreenWinDisplay screen_win_display =
      GetScreenWinDisplayNearestScreenRect(match_rect);
  return screen_win_display.display();
}

gfx::Display ScreenWin::GetPrimaryDisplay() const {
  return GetPrimaryScreenWinDisplay().display();
}

void ScreenWin::AddObserver(gfx::DisplayObserver* observer) {
  change_notifier_.AddObserver(observer);
}

void ScreenWin::RemoveObserver(gfx::DisplayObserver* observer) {
  change_notifier_.RemoveObserver(observer);
}

void ScreenWin::UpdateFromDisplayInfos(
    const std::vector<DisplayInfo>& display_infos) {
  screen_win_displays_ = DisplayInfosToScreenWinDisplays(display_infos);
}

void ScreenWin::Initialize() {
  singleton_hwnd_observer_.reset(
      new gfx::SingletonHwndObserver(
          base::Bind(&ScreenWin::OnWndProc, base::Unretained(this))));
  UpdateFromDisplayInfos(GetDisplayInfosFromSystem());
}

MONITORINFOEX ScreenWin::MonitorInfoFromScreenPoint(
    const gfx::Point& screen_point) const {
  POINT initial_loc = { screen_point.x(), screen_point.y() };
  return MonitorInfoFromHMONITOR(::MonitorFromPoint(initial_loc,
                                                    MONITOR_DEFAULTTONEAREST));
}

MONITORINFOEX ScreenWin::MonitorInfoFromScreenRect(const gfx::Rect& screen_rect)
    const {
  RECT win_rect = screen_rect.ToRECT();
  return MonitorInfoFromHMONITOR(::MonitorFromRect(&win_rect,
                                                   MONITOR_DEFAULTTONEAREST));
}

MONITORINFOEX ScreenWin::MonitorInfoFromWindow(HWND hwnd,
                                               DWORD default_options) const {
  return MonitorInfoFromHMONITOR(::MonitorFromWindow(hwnd, default_options));
}

HWND ScreenWin::GetRootWindow(HWND hwnd) const {
  return ::GetAncestor(hwnd, GA_ROOT);
}

void ScreenWin::OnWndProc(HWND hwnd,
                          UINT message,
                          WPARAM wparam,
                          LPARAM lparam) {
  if (message != WM_DISPLAYCHANGE)
    return;

  std::vector<gfx::Display> old_displays = GetAllDisplays();
  UpdateFromDisplayInfos(GetDisplayInfosFromSystem());
  change_notifier_.NotifyDisplaysChanged(old_displays, GetAllDisplays());
}

ScreenWinDisplay ScreenWin::GetScreenWinDisplayNearestHWND(HWND hwnd)
    const {
  return GetScreenWinDisplay(MonitorInfoFromWindow(hwnd,
                                                   MONITOR_DEFAULTTONEAREST));
}

ScreenWinDisplay ScreenWin::GetScreenWinDisplayNearestScreenRect(
    const gfx::Rect& screen_rect) const {
  return GetScreenWinDisplay(MonitorInfoFromScreenRect(screen_rect));
}

ScreenWinDisplay ScreenWin::GetScreenWinDisplayNearestScreenPoint(
    const gfx::Point& screen_point) const {
  return GetScreenWinDisplay(MonitorInfoFromScreenPoint(screen_point));
}

ScreenWinDisplay ScreenWin::GetPrimaryScreenWinDisplay() const {
  MONITORINFOEX monitor_info = MonitorInfoFromWindow(nullptr,
                                                     MONITOR_DEFAULTTOPRIMARY);
  ScreenWinDisplay screen_win_display = GetScreenWinDisplay(monitor_info);
  gfx::Display display = screen_win_display.display();
  // The Windows primary monitor is defined to have an origin of (0, 0).
  DCHECK_EQ(0, display.bounds().origin().x());
  DCHECK_EQ(0, display.bounds().origin().y());
  return screen_win_display;
}

ScreenWinDisplay ScreenWin::GetScreenWinDisplay(
    const MONITORINFOEX& monitor_info) const {
  int64_t id = DisplayInfo::DeviceIdFromDeviceName(monitor_info.szDevice);
  for (const auto& screen_win_display : screen_win_displays_) {
    if (screen_win_display.display().id() == id)
      return screen_win_display;
  }
  // There is 1:1 correspondence between MONITORINFOEX and ScreenWinDisplay.
  // If we make it here, it means we have no displays and we should hand out the
  // default display.
  DCHECK_EQ(screen_win_displays_.size(), 0u);
  return ScreenWinDisplay();
}

}  // namespace win
}  // namespace display


text:
package com.github.ipaas.ideploy.agent.service.action;

import java.util.Map;

import javax.management.MBeanServerConnection;

import org.osgi.framework.BundleContext;

/**
 * 自定义运行管理
 * @author Chenql
 */
public interface CustomActionCall {

	/**
	 * 自定义运行管理
	 * @param context
	 * @param map
	 * @return 操作的结果
	 */
	Object call(BundleContext context, Map<String, Object> map);
}


text:
<Alloy>

	<View id='inicioScreen'>

		<ImageView id="menuBtn" ></ImageView>
		<ImageView id="logoImg"></ImageView>
		<ImageView id="carritoBtn"></ImageView>

		<TableView class="preciosUnicosList">

			<TableViewRow id="list">
				<SearchBar id="search" barColor="#e4e4e4" showCancel="false" top="5%" hintText="Palabra Clave" />
			</TableViewRow>

			<TableViewRow id="list">
    			<View id="categoria">
    				<ImageView id="atrasBtn"></ImageView>
    				 Charallave
    			</View>
    		</TableViewRow>

    		<TableViewRow id="list">
    			<View id="supermercados">
					Centro Comercial Los Samanes.
					Dirección: Av. Bolívar cerca del \nBanco Provincial. Charallave
					<ImageView id="verMasBtn" onClick="infoSupermercado"></ImageView>
				</View>
    		</TableViewRow>

			<TableViewRow id="list">
    			<View id="supermercados">
					Centro Comercial Residencias Charallave.
					Dirección: Av. Bolívar
					<ImageView id="verMasBtn"></ImageView>
				</View>
    		</TableViewRow>

		</TableView>

	</View>
</Alloy>


text:
import subprocess as sp
from libdesktop import system

def set_volume(percentage):
	'''Set the volume.

	Sets the volume to a given percentage (integer between 0 and 100).

	Args:
			percentage (int): The percentage (as a 0 to 100 integer) to set the volume to.

	Raises:
			ValueError: if the percentage is >100 or <0.
	'''

	if percentage > 100 or percentage < 0:
		raise ValueError('percentage must be an integer between 0 and 100')

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		# OS X uses 0-10 instead of percentage
		volume_int = percentage / 10

		sp.Popen(['osascript', '-e', 'set Volume %d' % volume_int]).wait()

	else:
		# Linux/Unix
		formatted = str(percentage) + '%'
		sp.Popen(['amixer', '--quiet', 'sset', 'Master', formatted]).wait()

def get_volume():
	'''Get the volume.

	Get the current volume.

	Returns:
			int: The current volume (percentage, between 0 and 100).
	'''

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		volume = system.get_cmd_out(
			['osascript', '-e', 'set ovol to output volume of (get volume settings); return the quoted form of ovol'])
		return int(volume) * 10

	else:
		# Linux/Unix
		volume = system.get_cmd_out(
				('amixer get Master |grep % |awk \'{print $5}\'|'
				 'sed -e \'s/\[//\' -e \'s/\]//\' | head -n1'))
		return int(volume.replace('%', ''))

def increase_volume(percentage):
	'''Increase the volume.

	Increase the volume by a given percentage.

	Args:
			percentage (int): The percentage (as an integer between 0 and 100) to increase the volume by.

	Raises:
			ValueError: if the percentage is >100 or <0.
	'''

	if percentage > 100 or percentage < 0:
		raise ValueError('percentage must be an integer between 0 and 100')

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		volume_int = percentage / 10
		old_volume = get()

		new_volume = old_volume + volume_int

		if new_volume > 10:
			new_volume = 10

		set_volume(new_volume * 10)

	else:
		# Linux/Unix
		formatted = '%d%%+' % percentage
		# + or - increases/decreases in amixer

		sp.Popen(['amixer', '--quiet', 'sset', 'Master', formatted]).wait()

def decrease_volume(percentage):
	'''Decrease the volume.

	Decrease the volume by a given percentage.

	Args:
			percentage (int): The percentage (as an integer between 0 and 100) to decrease the volume by.

	Raises:
			ValueError: if the percentage is >100 or <0.
	'''

	if percentage > 100 or percentage < 0:
		raise ValueError('percentage must be an integer between 0 and 100')

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		volume_int = percentage / 10
		old_volume = get()

		new_volume = old_volume - volume_int

		if new_volume < 0:
			new_volume = 0

		set_volume(new_volume * 10)

	else:
		# Linux/Unix
		formatted = '%d%%-' % percentage
		# + or - increases/decreases in amixer

		sp.Popen(['amixer', '--quiet', 'sset', 'Master', formatted]).wait()

def unix_is_pulseaudio_server():
	'''Check if PulseAudio is running as sound server.

	Checks if `PulseAudio <https://www.freedesktop.org/wiki/Software/PulseAudio/>`_ is running as the sound server.

	Returns:
			bool: Is PulseAudio the sound server?
	'''

	return bool(system.is_running('pulseaudio'))

def mute():
	'''Mute the volume.

	Mutes the volume.
	'''

	# NOTE: mute != 0 volume

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		sp.Popen(['osascript', '-e', 'set volume output muted true']).wait()

	else:
		# Linux/Unix
		if unix_is_pulseaudio_server():
			sp.Popen(['amixer', '--quiet', '-D', 'pulse', 'sset',
					  'Master', 'mute']).wait()  # sset is *not* a typo

		else:
			sp.Popen(['amixer', '--quiet', 'sset', 'Master', 'mute']).wait()

def unmute():
	'''Unmute the volume.

	Unmutes the system volume.

	Note:
			On some systems, volume is restored to its previous level after unmute, or set to 100.
	'''

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		sp.Popen(['osascript', '-e', 'set volume output muted false']).wait()

	else:
		# Linux/Unix
		if unix_is_pulseaudio_server():
			sp.Popen(['amixer', '--quiet', '-D', 'pulse', 'sset',
					  'Master', 'unmute']).wait()  # sset is *not* a typo

		else:
			sp.Popen(['amixer', '--quiet', 'sset', 'Master', 'unmute']).wait()

def is_muted():
	'''Check if volume is muted.

	Checks if the volume is muted.

	Note:
			This does *not* check for volume == 0.

	Returns:
			bool: Is the volume muted?
	'''

	if system.get_name() == 'windows':
		# TODO: Implement volume for Windows. Looks like WinAPI is the
		# solution...
		pass

	elif system.get_name() == 'mac':
		return system.get_cmd_out(
			['osascript',
			 '-e',
			 'set ismuted to volume output muted; return ismuted']) == 'true'

	else:
		# Linux/Unix
		return system.get_cmd_out(
				('amixer get Master | awk \'$0~/%/{print $6}\' |'
				 ' tr -d \'[]\' | head -n1')) != 'on'


text:
<?php

declare(strict_types=1);

namespace Autowp\TextStorage;

use ArrayObject;
use Laminas\Db\Adapter\Adapter;
use Laminas\Db\Sql\Expression;
use Laminas\Db\Sql\Select;
use Laminas\Db\TableGateway\TableGateway;

use function array_fill;
use function count;
use function implode;
use function method_exists;
use function sprintf;
use function ucfirst;

class Service
{
    private ?Adapter $adapter;

    private TableGateway $textTable;

    private TableGateway $revisionTable;

    private string $textTableName = 'textstorage_text';

    private string $revisionTableName = 'textstorage_revision';

    /**
     * @throws Exception
     */
    public function __construct(array $options = [])
    {
        $this->adapter = null;
        $this->setOptions($options);
    }

    /**
     * @return $this
     * @throws Exception
     */
    public function setOptions(array $options): self
    {
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);

            if (! method_exists($this, $method)) {
                throw new Exception("Unexpected option '$key'");
            }

            $this->$method($value);
        }

        return $this;
    }

    public function setDbAdapter(Adapter $dbAdapter): self
    {
        $this->adapter = $dbAdapter;

        return $this;
    }

    public function setTextTableName(string $name): self
    {
        $this->textTableName = $name;

        return $this;
    }

    public function setRevisionTableName(string $name): self
    {
        $this->revisionTableName = $name;

        return $this;
    }

    private function getTextTable(): TableGateway
    {
        if (! isset($this->textTable)) {
            $this->textTable = new TableGateway($this->textTableName, $this->adapter);
        }

        return $this->textTable;
    }

    private function getRevisionTable(): TableGateway
    {
        if (! isset($this->revisionTable)) {
            $this->revisionTable = new TableGateway($this->revisionTableName, $this->adapter);
        }

        return $this->revisionTable;
    }

    public function getFirstText(array $ids): ?string
    {
        if (! $ids) {
            return null;
        }

        $select = $this->getTextTable()->getSql()->select()
            ->columns(['text'])
            ->where([
                'id' => $ids,
                'length(text) > 0',
            ])
            ->order(new Expression(
                'FIELD(id, ' . implode(', ', array_fill(0, count($ids), '?')) . ')',
                $ids
            ))
            ->limit(1);

        $row = $this->getTextTable()->selectWith($select)->current();

        if (! $row) {
            return null;
        }

        return $row['text'];
    }

    /**
     * @return array|ArrayObject|null
     */
    private function getTextRow(int $textID)
    {
        $select = $this->getTextTable()->getSql()->select()
            ->where(['id' => $textID])
            ->limit(1);

        return $this->getTextTable()->selectWith($select)->current();
    }

    public function getText(int $textID): ?string
    {
        $row = $this->getTextRow($textID);

        if (! $row) {
            return null;
        }

        return $row['text'];
    }

    public function getTextInfo(int $textID): ?array
    {
        $row = $this->getTextRow($textID);

        if ($row) {
            return [
                'text'     => $row['text'],
                'revision' => (int) $row['revision'],
            ];
        }

        return null;
    }

    public function getRevisionInfo(int $textID, int $revision): ?array
    {
        $row = $this->getRevisionTable()->select([
            'text_id'  => $textID,
            'revision' => $revision,
        ])->current();

        if ($row) {
            return [
                'text'     => $row['text'],
                'revision' => $row['revision'],
                'user_id'  => $row['user_id'],
            ];
        }

        return null;
    }

    /**
     * @throws Exception
     */
    public function setText(int $textID, string $text, int $userID): int
    {
        $row = $this->getTextRow($textID);

        if (! $row) {
            throw new Exception(sprintf('Text `%d` not found', $textID));
        }

        if ($row['text'] !== $text) {
            $this->getTextTable()->update([
                'revision'     => new Expression('revision + 1'),
                'text'         => $text,
                'last_updated' => new Expression('NOW()'),
            ], [
                'id' => $row['id'],
            ]);

            $row = $this->getTextRow($textID);

            if (! $row) {
                throw new Exception(sprintf('Text `%d` not found', $textID));
            }

            $this->getRevisionTable()->insert([
                'text_id'   => $row['id'],
                'revision'  => $row['revision'],
                'text'      => $row['text'],
                'timestamp' => $row['last_updated'],
                'user_id'   => $userID,
            ]);
        }

        return (int) $row['id'];
    }

    /**
     * @throws Exception
     */
    public function createText(string $text, int $userID): int
    {
        $table = $this->getTextTable();

        $table->insert([
            'revision'     => 0,
            'text'         => '',
            'last_updated' => new Expression('NOW()'),
        ]);

        return $this->setText((int) $table->getLastInsertValue(), $text, $userID);
    }

    public function getTextUserIds(int $textID): array
    {
        $select = $this->getRevisionTable()->getSql()->select()
            ->columns(['user_id'])
            ->quantifier(Select::QUANTIFIER_DISTINCT)
            ->where([
                'user_id IS NOT NULL',
                'text_id' => $textID,
            ]);
        $rows   = $this->getRevisionTable()->selectWith($select);

        $ids = [];
        foreach ($rows as $row) {
            $ids[] = (int) $row['user_id'];
        }

        return $ids;
    }
}


text:
fn main() {
    let f = |&: 3: int| println!("hello");
    //~^ ERROR refutable pattern in function argument: `_` not covered
    f(4);
}


text:
@import ObjectiveC;

@interface _WXJSTimingObservationWrapper : NSObject @end
@implementation _WXJSTimingObservationWrapper
{
	NSMutableArray<NSNumber*>* _observedTimers;
	NSMutableDictionary* _timers;
}

- (instancetype)initWithTimers:(NSMutableDictionary*)timers
{
	self = [super init];
	if(self)
	{
		_timers = timers;
		_observedTimers = [NSMutableArray new];
	}

	return self;
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
	NSMethodSignature* sig = [super methodSignatureForSelector:aSelector];

	if(sig == nil)
	{
		sig = [_timers methodSignatureForSelector:aSelector];
	}

	return sig;
}

- (void)forwardInvocation:(NSInvocation *)anInvocation
{
	[anInvocation invokeWithTarget:_timers];
}

- (void)addObservedTimer:(NSNumber*)observedNumber
{
	[_observedTimers addObject:observedNumber];
}

- (NSUInteger)countOfObservedTimers
{
	return _observedTimers.count;
}

- (void)removeObjectForKey:(NSNumber*)aKey
{
	if([_observedTimers containsObject:aKey])
	{
		NSLog(@"☣ DETOX:: Removing observed timer %@", aKey);
		[_observedTimers removeObject:aKey];
	}

	[_timers removeObjectForKey:aKey];
}

@end

@implementation WXJSTimerObservationIdlingResource
{
	NSMapTable<id, _WXJSTimingObservationWrapper*>* _observations;
	dispatch_queue_t _timersObservationQueue;
	NSTimeInterval _durationThreshold;
}

- (void)setDurationThreshold:(NSTimeInterval)durationThreshold
{
	_durationThreshold = durationThreshold;
}

- (NSString*)failuireReasonForDuration:(NSTimeInterval)duration repeats:(BOOL)repeats
{
	if(duration == 0)
	{
		return @"duration==0";
	}
	else if(repeats == YES)
	{
		return @"repeats==true";
	}
	else if(duration > _durationThreshold)
	{
		return [NSString stringWithFormat:@"duration>%@", @(_durationThreshold)];
	}

	return @"";
}

- (instancetype)init
{
	self = [super init];
	if(self)
	{
		_timersObservationQueue = dispatch_queue_create("_timersCounterSerialQueue", NULL);
		_observations = [NSMapTable mapTableWithKeyOptions:NSMapTableWeakMemory valueOptions:NSMapTableStrongMemory];
		_durationThreshold = 1.5;

		__weak __typeof(self) weakSelf = self;

		Class cls = NSClassFromString(@"RCTTiming");
		SEL createTimerSel = NSSelectorFromString(@"createTimer:duration:jsSchedulingTime:repeats:");
		Method m = class_getInstanceMethod(cls, createTimerSel);

		void (*orig_createTimer)(id, SEL, NSNumber*, NSTimeInterval, NSDate*, BOOL) = (void(*)(id, SEL, NSNumber*, NSTimeInterval, NSDate*, BOOL))method_getImplementation(m);
		method_setImplementation(m, imp_implementationWithBlock(^(id _self, NSNumber* timerID, NSTimeInterval duration, NSDate* jsDate, BOOL repeats) {
			__strong __typeof(weakSelf) strongSelf = weakSelf;

			dispatch_sync(_timersObservationQueue, ^{
				_WXJSTimingObservationWrapper* _observationWrapper = [strongSelf->_observations objectForKey:_self];

				if(_observationWrapper == nil)
				{
					_observationWrapper = [[_WXJSTimingObservationWrapper alloc] initWithTimers:[_self valueForKey:@"_timers"]];
					[_self setValue:_observationWrapper forKey:@"_timers"];
					[strongSelf->_observations setObject:_observationWrapper forKey:_self];
				}

				if(duration > 0 && duration <= _durationThreshold && repeats == NO)
				{
					NSLog(@"☣ DETOX:: Observing timer: %@ d: %@ r: %@", timerID, @(duration), @(repeats));

					[_observationWrapper addObservedTimer:timerID];
				}
				else
				{
					NSLog(@"☣ DETOX:: Ignoring timer: %@ failure reason: \"%@\"", timerID, [strongSelf failuireReasonForDuration:duration repeats:repeats]);
				}
			});

			orig_createTimer(_self, createTimerSel, timerID, duration, jsDate, repeats);
		}));
	}
	return self;
}

- (BOOL)isIdleNow
{
	__block BOOL rv = YES;

	dispatch_sync(_timersObservationQueue, ^{
		NSUInteger observedTimersCount = 0;

		for(_WXJSTimingObservationWrapper* wrapper in _observations.objectEnumerator)
		{
			observedTimersCount += wrapper.countOfObservedTimers;
		}

		rv = observedTimersCount == 0;
	});

	return rv;
}

- (NSString *)idlingResourceName
{
	return NSStringFromClass([self class]);
}

- (NSString *)idlingResourceDescription
{
	return [self idlingResourceName];
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <item
        android:id="@+id/tasks_config"
        android:icon="@drawable/ic_config"
        android:title="@string/config_project"
        app:showAsAction="always"
        tools:showAsAction="always" />

</menu>