text:
package org.apache.camel.spring.scan;

import java.lang.annotation.Annotation;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashSet;
import java.util.Set;

import org.apache.camel.impl.DefaultPackageScanClassResolver;
import org.apache.camel.spring.scan.a.ScanTargetOne;
import org.apache.camel.spring.scan.b.ScanTargetTwo;
import org.apache.camel.spring.scan.c.ScanTargetThree;

public class DefaultPackageScanClassResolverTest extends org.apache.camel.spring.scan.ScanTestSupport {

    private DefaultPackageScanClassResolver resolver;
    private Set<Class<? extends Annotation>> annotations = new HashSet<Class<? extends Annotation>>();
    private String scanPackage = "org.apache.camel.spring.scan";

    public void setUp() throws Exception {
        super.setUp();
        resolver = new DefaultPackageScanClassResolver();
        annotations.add(org.apache.camel.spring.scan.ScannableOne.class);
        annotations.add(org.apache.camel.spring.scan.ScannableTwo.class);
    }

    public void testAccepableSchema() {
        assertFalse("We should not accept the test by default!", resolver.isAcceptableScheme("test://test"));
        resolver.setAcceptableSchemes("test:;test2:");
        assertTrue("We should accept the test:!", resolver.isAcceptableScheme("test://test"));
        assertTrue("We should accept the test2:!", resolver.isAcceptableScheme("test2://test"));
    }

    public void testFindByAnnotationWithoutExtraFilters() {
        Set<Class<?>> scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableOne.class, scanPackage);
        validateMatchingSetContains(scanned, ScanTargetOne.class, ScanTargetTwo.class);

        scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableTwo.class, scanPackage);
        validateMatchingSetContains(scanned, ScanTargetThree.class);
    }

    public void testFindByAnnotationsWithoutExtraFilters() {
        Set<Class<?>> scanned = resolver.findAnnotated(annotations, scanPackage);
        validateMatchingSetContains(scanned, ScanTargetOne.class, ScanTargetTwo.class, ScanTargetThree.class);
    }

    public void testFindImplementationsWithoutExtraFilters() {
        Set<Class<?>> scanned = resolver.findImplementations(ScanTargetOne.class, scanPackage);
        validateMatchingSetContains(scanned, ScanTargetOne.class, ScanTargetTwo.class);
    }

    public void testFindByAnnotationWithIncludePackageFilter() {
        filter.addIncludePattern(scanPackage + ".b.*");
        resolver.addFilter(filter);

        Set<Class<?>> scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableOne.class, scanPackage);
        validateMatchingSetContains(scanned, ScanTargetTwo.class);

        scanned = resolver.findAnnotated(ScannableTwo.class, scanPackage);
        validateMatchingSetContains(scanned);
    }

    public void testFindByAnnotationsWithIncludePackageFilter() {
        filter.addIncludePattern(scanPackage + ".b.*");
        filter.addIncludePattern(scanPackage + ".c.*");
        resolver.addFilter(filter);

        Set<Class<?>> scanned = resolver.findAnnotated(annotations, "org.apache.camel.spring.scan");
        validateMatchingSetContains(scanned, ScanTargetTwo.class, ScanTargetThree.class);
    }

    public void testFindByAnnotationWithExcludePackageFilter() {
        filter.addExcludePattern(scanPackage + ".b.*");
        filter.addExcludePattern(scanPackage + ".c.*");
        resolver.addFilter(filter);

        Set<Class<?>> scanned = resolver.findAnnotated(ScannableOne.class, scanPackage);
        validateMatchingSetContains(scanned, ScanTargetOne.class);

        scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableTwo.class, scanPackage);
        validateMatchingSetContains(scanned);
    }

    public void testFindByAnnotationsWithExcludePackageFilter() {
        filter.addExcludePattern(scanPackage + ".a.*");

        Set<Class<?>> scanned = resolver.findAnnotated(annotations, "org.apache.camel.spring.scan");
        validateMatchingSetContains(scanned, ScanTargetTwo.class, ScanTargetThree.class);
    }

    public void testFindByFilterWithIncludePackageFilter() {
        filter.addIncludePattern(scanPackage + ".**.ScanTarget*");
        resolver.addFilter(filter);

        Set<Class<?>> scanned = resolver.findByFilter(filter, "org.apache.camel.spring.scan");
        validateMatchingSetContains(scanned, ScanTargetOne.class, ScanTargetTwo.class, ScanTargetThree.class);
    }

    public void testFindImplementationsWithIncludePackageFilter() {
        filter.addIncludePattern(scanPackage + ".b.*");
        resolver.addFilter(filter);

        Set<Class<?>> scanned = resolver.findImplementations(ScanTargetOne.class, scanPackage);
        validateMatchingSetContains(scanned,  ScanTargetTwo.class);
    }

    public void testFindImplementationsWithExcludePackageFilter() {
        filter.addExcludePattern(scanPackage + ".a.*");
        resolver.addFilter(filter);

        Set<Class<?>> scanned = resolver.findImplementations(ScanTargetOne.class, scanPackage);
        validateMatchingSetContains(scanned,  ScanTargetTwo.class);
    }

    public void testFindByFilterPackageInJarUrl() throws Exception {
        ClassLoader savedClassLoader = null;
        try {
            savedClassLoader = Thread.currentThread().getContextClassLoader();
            URL url = getClass().getResource("/package_scan_test.jar");

            URL urls[] = {new URL("jar:" + url.toString() + "!/")};
            URLClassLoader classLoader = new URLClassLoader(urls, savedClassLoader);

            Thread.currentThread().setContextClassLoader(classLoader);

            // recreate resolver since we mess with context class loader
            resolver = new DefaultPackageScanClassResolver();

            filter.addIncludePattern("a.*.c.*");
            resolver.addFilter(filter);
            Set<Class<?>> scanned = resolver.findByFilter(filter, "a.b.c");
            assertEquals(1, scanned.size());
            assertEquals("class a.b.c.Test", scanned.iterator().next().toString());
        } finally {
            if (savedClassLoader != null) {
                Thread.currentThread().setContextClassLoader(savedClassLoader);
            }
        }
    }

    public void testFindByFilterPackageInJarUrlWithPlusChars() throws Exception {
        ClassLoader savedClassLoader = null;
        try {
            savedClassLoader = Thread.currentThread().getContextClassLoader();
            URL url = getClass().getResource("/package+scan+test.jar");

            URL urls[] = {new URL("jar:" + url.toString() + "!/")};
            URLClassLoader classLoader = new URLClassLoader(urls, savedClassLoader);

            Thread.currentThread().setContextClassLoader(classLoader);

            // recreate resolver since we mess with context class loader
            resolver = new DefaultPackageScanClassResolver();

            filter.addIncludePattern("a.*.c.*");
            resolver.addFilter(filter);
            Set<Class<?>> scanned = resolver.findByFilter(filter, "a.b.c");
            assertEquals(1, scanned.size());
            assertEquals("class a.b.c.Test", scanned.iterator().next().toString());
        } finally {
            if (savedClassLoader != null) {
                Thread.currentThread().setContextClassLoader(savedClassLoader);
            }
        }
    }
}


text:
import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule }   from '@angular/forms';
import { RouterModule }   from '@angular/router';
import { HttpModule, JsonpModule } from '@angular/http';

import { AppComponent }  from './app.component';
import { ListComponent }  from './list.component';
import { IntroductionComponent }  from './introduction.component';

@NgModule({
  imports:      [
    BrowserModule,
    FormsModule,
    RouterModule.forRoot([
      {
        path: '',
        redirectTo: '/introduction',
        pathMatch: 'full'
      },
      {
        path: 'introduction',
        component: IntroductionComponent
      },
      {
        path: 'lists',
        component: ListComponent
      },
    ]),
    HttpModule,
    JsonpModule
  ],
  declarations: [ AppComponent, ListComponent, IntroductionComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

redpajama_set_name: RedPajamaGithub


text:
starting "Setup projects support"

# Cannot be set by environmental_variables.sh
script_dir="/vagrant/setup/base_user"

. "$script_dir/../environmental_variables.sh"

# ~/projects was built by Vagrantfile in synched project folder setup
sudo chown -R vagrant:vagrant ~/projects

mkdir -p $APP_BUILD_FLDR        # ~/srv
mkdir -p ~/scripts

# Add ~/scripts to PATH
if ! grep '# Add scripts' ~/.profile ; then
  cat - >> ~/.profile <<-EOF

	# Add scripts to PATH
	export PATH="$HOME/scripts:\$PATH"
EOF
fi && . ~/.profile

completed "project support setup"


text:
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/more-routing/more-route.html">

<link rel="import" href="bower_components/paper-input/paper-input.html">
<link rel="import" href="bower_components/paper-input/paper-input-decorator.html">

<link rel="import" href="bower_components/paper-button/paper-button.html">

<polymer-element name="page-login">
  <template>
    <style type="text/css">
    :host {
      margin-bottom: 100px;
    }

    paper-button[raised].colored {
      background: #4285f4;
      color: #fff;
    }

    .login-section {
      width: 200px;
      height: 200px;
    }

    </style>
    <more-route context name="login"></more-route>

    <section layout vertical center-justified center fit>
      <div class="login-section">
        <paper-input-decorator label="User Name" floatingLabel>
          <input id="qty" is="core-input">
          </input>
        </paper-input-decorator>

        <paper-input-decorator label="Password" floatingLabel>
          <input id="qty" is="core-input" type="password">
          </input>
        </paper-input-decorator>
        <div layout horizontal center-justified style="margin-top: 30px;">
          <paper-button raised class="colored">Connect</paper-button>
        </div>

      </div>
    </section>

  </template>
  <script>
    Polymer({
      ready: function() {
        //...
      }
    });
  </script>
</polymer-element>


text:
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<html>
<head>
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <title>fic-featured</title>

  <script src="../../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  <script src="../../bower_components/web-component-tester/browser.js"></script>
  <script src="../../bower_components/test-fixture/test-fixture-mocha.js"></script>
  <link rel="import" href="../../bower_components/test-fixture/test-fixture.html">

  <!-- Step 1: import the element to test -->
  <link rel="import" href="../elements/fic-featured/fic-featured.html">

</head>
<body>

<test-fixture id="basic">
  <template>
    <fic-featured></fic-featured>
  </template>
</test-fixture>

<script>
  suite('fic-featured tests', function() {
    var element;

    setup(function() {
      element = fixture('basic');
    });

    test('', function() {

    });

  });
</script>

</body>
</html>


text:
Publication API example
==========================

Example code for interacting with the Zmags Publication API.

## Examples

### Simple
Simple demo of how the Publication API can be used to get and show publication content. Note that while this superficially resembles the viewer webapp, it is very far from it in functionality.

[Demo](http://lugribossk.github.com/publication-api-experiment/src/main/examples/simple/simple.html), [Code](src/main/examples/simple/simple.js).

### Archive
Viewer with archive sidebar using a combination of the Viewer API and Publication API.

[Demo](http://lugribossk.github.com/publication-api-experiment/src/main/examples/archive/archive.html), [Code](src/main/examples/archive/archive.js).

### Publications overview
List of all the *activated* publications on an account, including their ID and link to view them.

[Demo](http://lugribossk.github.com/publication-api-experiment/src/main/examples/overview/overview.html), [Code](src/main/examples/overview/overview.js).

### NodeJS / Grunt
Grunt task that retrieves publication data.

[Code](src/main/examples/grunt/task.js)

## Documentation
[Class documentation](http://lugribossk.github.com/publication-api-experiment/docs/index.html), autogenerated with [JSDuck](https://github.com/senchalabs/jsduck).

## Using as library
Create a single minified file that includes all the relevant classes with `grunt requirejs:library`. You can then use `target/publicationapi.min.js` as a library in other projects. See examples for a [RequireJS project](src/main/examples/library/library-require.html) and as a [global variable](src/main/examples/library/library-global.html).

**AMD module:** jQuery must be loadable as a module under the name "jquery".

**Plain Javascript:** jQuery must be loaded in an earlier script tag.

**NodeJS** Needs the `requirejs`, `request` and `jquery-deferreds` modules.

## Unit tests
Start server with `grunt karma`, run tests with `grunt karma:unit:run`

Continuous integration with `grunt karma:ci`

### Travis CI
[![Build Status](https://travis-ci.org/Lugribossk/publication-api-experiment.png?branch=master)](https://travis-ci.org/Lugribossk/publication-api-experiment)

### Windows environment variables
`PHANTOMJS_BIN=node_modules\phantomjs\lib\phantom\phantomjs.exe`

`CHROME_BIN=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`

## Technical notes

### Coding conventions
- Properties that start with an underscore are private.
- Properties are read-only from outside the class unless specified otherwise.
- Properties, parameters and return values are non-null unless specified otherwise.

### JSHint settings
- See [`.jshintrc`](.jshintrc)

### RequireJS and classes
- RequireJS is used to split each class into its own file, and to have classes depend on each other without polluting the global namespace.
- Each RequireJS module returns a typed class constructor function, rather than a raw object where one of its properties is the class constructor.

### Deferreds/promises
- This project makes heavy use of jQuery [Deferreds](http://api.jquery.com/category/deferred-object/) (aka. "promises" or "futures") to handle the asynchronous nature
  of the Publication API's references.
- Functions that return promises should document the type of the data the promise resolves with.
- Promises are assumed to fail if the requested object could not be found, rather then resolve with null data.

### JSDuck
- [JSDuck](https://github.com/senchalabs/jsduck) is used to generate documentation. It's designed for code using Sencha's frameworks but can be made to work pretty well with some extra tags.
- `@constructor` after the class description but before the parameters makes the constructor function show up in the documentation.
- `@private` and `@static` on all methods that are that, even though it is obvious.
- The live examples work due to a new live example iframe with RequireJS.

### Browser compatibility
- The [jQuery-ajaxTransport-XDomainRequest](https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest) plugin is used to enable non-JSONP cross-domain requests in IE 8 and 9.
- For it to work reliably it seems that:
   - dataType must be set to "json" explicitly for it to activate.
   - timeout may be required for requests to not silently disappear without succeeding or failing.
- [es5-shim and es5-sham](https://github.com/kriskowal/es5-shim) are used to enable ES5 functionality in IE 8 and PhantomJS (it's missing Function.prototype.bind).
- These are set up as dependencies of the `Ajax` and `ES5` classes. ES5 is set up as a dependency in the Logger class and test-main. This should cause it to always be loaded first when using the API classes or running tests.

### Other
- Constructors explicitly copy properties from their data object parameter. This could be replaced with a
  simple $.extend(this, data) but then it would be quite cryptic which properties the class actually has. It also makes it
  possible to turn internal descriptor references into private variables.
- Functions that rely on references or parsing re-do the same work every time they are called.
  An obvious optimization would be to parse on creation and cache the result of references and delete the data they were generated from.
  However that would make it less clear what data is retrieved from the API, and what is constructed by post-processing afterwards.
- "Views" (i.e. functions that generate DOM elements to visualize the various classes) have been split into their own files. On load, these add the functions to the prototype of their associated classes. This lets them stay out of the model objects if not needed, and avoids having them as completely separate classes.

## References
[Viewer API documentation](http://documentation.zmags.com/viewercommonapi/index.html)

[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/d0f7ee2f59e42083370a5e8e5e9519fa "githalytics.com")](http://githalytics.com/Lugribossk/publication-api-experiment)


text:
import fetch from 'isomorphic-fetch';
import * as types from './actionTypes';

export function loadDestsSuccess(destinations) {
  return {type: types.LOAD_ALL_DESTS_SUCCESS, destinations};
}
export function updateDestsSuccess(response) {
  return {type: types.UPDATE_DEST_SUCCESS, response};
}
export function createDestsSuccess(response) {
  return {type: types.CREATE_DEST_SUCCESS, response};
}

export function loadAllDestinations() {
  return dispatch =>{
    return fetch(`http://localhost:3333/api/destinations`)
      .then(function(response) {
        return response.json()
      })
      .then((response) => {
        dispatch(loadDestsSuccess(response));
      })
      .catch(error =>{
        throw(error)
    })
  }
}

export function updateDestination(destination) {
  return (dispatch) =>{
    return fetch(`http://localhost:3333/api/destinations/${destination._id}`, {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(destination)
    })
      .then(function(response) {
        return response.json();
      })
      .then((response)=>{
        dispatch(updateDestsSuccess(response));

      })
      .catch((error)=>{
      throw(error);
    });
  };
}

export function createDestination(destination) {
  return (dispatch) =>{
    return fetch(`http://localhost:3333/api/destinations`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(destination)
    })
      .then(function(response) {
        return response.json();
      })
      .then((response)=>{
        dispatch(createDestsSuccess(response));

      })
      .catch((error)=>{
        throw(error);
      });
  };
}

export function deleteDestination(destination) {
  return (dispatch) =>{
    return fetch(`http://localhost:3333/api/destinations/${destination._id}`, {
      method: 'DELETE',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(destination)
    })
      .then(function() {
        dispatch(loadAllDestinations())
      })
      .catch((error)=>{
        throw(error);
      });
  };
}


text:
title: "High Performance MySQL"
---

Important points and key learning gathered while reading High Performance MySQL.

Chapter 5. Indexing for High Performance
- If you index more than one column, column order is very important
- It can most efficently search on leftmost prefix of the index
- Ex key(last_name, first_name, dob)
    - Sorts according the the order of columns given. In this case, by last_name, first_name and finally dob
    - Works on:
        - Full key value with all columns
        - Match on last_name (left most prefix)
        - Match on last_name starting with J
        - Last names between Allen and Barymore
        - Last name Allen and first_name starts with K
        - B-Tree normally support index-only queries that access only index, not row storage
        - Can be used of lookups and sorting such as order by because sorted
    - Doesn't work
        - Last name ends with a particular letter
        - Only using first_name or dob
        - Can't skip columns like last_name and dob but skipping first_name
        - Can't optimize any columns to the right of the first range condition. Ex. `WHERE last_name="Smith" AND first_name LIKE 'J%' AND dob='1976-12-23'`
    - Create indexes with same columns in different orders to satisfy different queries
- Hash indexes (pg 152)
    - Specialized cases
    - Implementing own pseudohash is blazing fast because the index is on much smaller value. Imagine index on url vs CRC32(url)
    - To avoid collisions, always use a WHERE clause along with your index in the pseudohash table
    - Can automate generation of these hashes by setting up triggers
- R-Tree indexes don't require to operate on left most indexes. Not well supported in MySQL
- Good column order
    - ROT: Place most selective columns in the index first
- Clustered Indexes
    - Rows stored in index's leaf pages
    - Can only use one clustered index per table because can't store the rows in two places at once
    - InnoDB clusters data by primary key
    - You can keep related data closer, for ex cluster on user_id to retrieve all user's messages by fetching only a few pages
    - Data access is fast because both index and data are kept together
    - Queries using covering indexes can use PK values contained at the leaf node
- Covering indexes
    - Secondary indexes hold the row's PK values at their leaf nodes. Thus a secondary index that covers a query avoids another index lookup in the primary key
    - `EXPLAIN SELECT * FROM products WHERE actor='SEAN CARREY' -> AND title like '%APOLLO%'\G`
    - No index covers this query because all columns are selected and no index covers all columns. My understanding is that if only an indexed column was selected and given that actor is also indexed, engine would fetch PK using actor and then fetch the column in the SELECT clause. This way, it won't read the whole data and the index will cover the query


text:
<?php

class OFC_Charts_Area extends OFC_Charts_Base
{

    public function OFC_Charts_Area()
    {
        parent::OFC_Charts_Base();

        $this->type = 'area';
    }
}


text:
//---------------------------------------------------------------------
// <copyright file="TypePromotionTests.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

using Microsoft.OData.Core.UriParser.Semantic;

namespace Microsoft.Test.Taupo.OData.Query.Tests.MetadataBinder
{
    #region Namespaces
    using System;
    using System.Collections.Generic;
    using Microsoft.OData.Core.UriParser.TreeNodeKinds;
    using Microsoft.OData.Edm;
    using Microsoft.OData.Edm.Library;
    using System.Globalization;
    using System.Linq;
    using Microsoft.OData.Core;
    using Microsoft.OData.Core.Metadata;
    using Microsoft.OData.Core.UriParser;
    using Microsoft.Test.Taupo.Common;
    using Microsoft.Test.Taupo.Execution;
    using Microsoft.Test.Taupo.OData.Common;
    using Microsoft.Test.Taupo.OData.Contracts;
    using Microsoft.Test.Taupo.OData.Query.Tests.Common;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    #endregion Namespaces

    /// <summary>
    /// Tests for type promotion in the semantic tree.
    /// </summary>
    [TestClass, TestCase]
    public class TypePromotionTests : ODataTestCase
    {
        [InjectDependency]
        public ICombinatorialEngineProvider CombinatorialEngineProvider { get; set; }

        [InjectDependency(IsRequired = true)]
        public StronglyTypedDataServiceProviderFactory StronglyTypedDataServiceProviderFactory { get; set; }

        #region Property descriptors
        private static readonly PropertyDescriptor stringPropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "StringProperty",
            NullablePropertyName = "StringProperty",
            PromotedType = EdmCoreModel.Instance.GetString(true),
            PropertyType = EdmCoreModel.Instance.GetString(true),
        };

        private static readonly PropertyDescriptor binaryPropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "BinaryProperty",
            NullablePropertyName = "BinaryProperty",
            PromotedType = EdmCoreModel.Instance.GetBinary(true),
            PropertyType = EdmCoreModel.Instance.GetBinary(true),
        };

        private static readonly PropertyDescriptor boolPropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "BoolProperty",
            NullablePropertyName = "NullableBoolProperty",
            PromotedType = EdmCoreModel.Instance.GetBoolean(false),
            PropertyType = EdmCoreModel.Instance.GetBoolean(false),
        };

        private static readonly PropertyDescriptor bytePropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "ByteProperty",
            NullablePropertyName = "NullableByteProperty",
            PromotedType = EdmCoreModel.Instance.GetInt32(false),
            PropertyType = EdmCoreModel.Instance.GetByte(false),
        };

        private static readonly PropertyDescriptor decimalPropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "DecimalProperty",
            NullablePropertyName = "NullableDecimalProperty",
            PromotedType = EdmCoreModel.Instance.GetDecimal(false),
            PropertyType = EdmCoreModel.Instance.GetDecimal(false),
        };

        private static readonly PropertyDescriptor doublePropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "DoubleProperty",
            NullablePropertyName = "NullableDoubleProperty",
            PromotedType = EdmCoreModel.Instance.GetDouble(false),
            PropertyType = EdmCoreModel.Instance.GetDouble(false),
        };

        private static readonly PropertyDescriptor guidPropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "GuidProperty",
            NullablePropertyName = "NullableGuidProperty",
            PromotedType = EdmCoreModel.Instance.GetGuid(false),
            PropertyType = EdmCoreModel.Instance.GetGuid(false),
        };

        private static readonly PropertyDescriptor int16PropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "Int16Property",
            NullablePropertyName = "NullableInt16Property",
            PromotedType = EdmCoreModel.Instance.GetInt32(false),
            PropertyType = EdmCoreModel.Instance.GetInt16(false),
        };

        private static readonly PropertyDescriptor int32PropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "Int32Property",
            NullablePropertyName = "NullableInt32Property",
            PromotedType = EdmCoreModel.Instance.GetInt32(false),
            PropertyType = EdmCoreModel.Instance.GetInt32(false),
        };

        private static readonly PropertyDescriptor int64PropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "Int64Property",
            NullablePropertyName = "NullableInt64Property",
            PromotedType = EdmCoreModel.Instance.GetInt64(false),
            PropertyType = EdmCoreModel.Instance.GetInt64(false),
        };

        private static readonly PropertyDescriptor sbytePropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "SByteProperty",
            NullablePropertyName = "NullableSByteProperty",
            PromotedType = EdmCoreModel.Instance.GetInt32(false),
            PropertyType = EdmCoreModel.Instance.GetSByte(false),
        };

        private static readonly PropertyDescriptor singlePropertyDescriptor = new PropertyDescriptor
        {
            PropertyName = "SingleProperty",
            NullablePropertyName = "NullableSingleProperty",
            PromotedType = EdmCoreModel.Instance.GetSingle(false),
            PropertyType = EdmCoreModel.Instance.GetSingle(false),
        };
        #endregion Property descriptors

        [TestMethod, Variation(Description = "Verifies correct handling of type promotions during binding.")]
        public void RelationalOperatorTypePromotion()
        {
            IEdmModel model = QueryTestMetadata.BuildTestMetadata(this.PrimitiveTypeResolver, this.StronglyTypedDataServiceProviderFactory);

            BinaryOperatorKind[] relationalOperatorKinds = new BinaryOperatorKind[]
            {
                BinaryOperatorKind.Equal,
                BinaryOperatorKind.NotEqual,
                BinaryOperatorKind.GreaterThan,
                BinaryOperatorKind.GreaterThanOrEqual,
                BinaryOperatorKind.LessThan,
                BinaryOperatorKind.LessThanOrEqual
            };

            var testCases = ComputeRelationalTestCases().Concat(ComputeRelationalErrorTestCases());

            this.CombinatorialEngineProvider.RunCombinations(
                testCases,
                relationalOperatorKinds,
                (testCase, relationalOperatorKind) =>
                {
                    string filter = testCase.Arguments[0] + " " + QueryTestUtils.ToOperatorName(relationalOperatorKind) + " " + testCase.Arguments[1];

                    string errorMessage = null;
                    if (testCase.ExpectedErrorMessage != null)
                    {
                        errorMessage = string.Format(CultureInfo.InvariantCulture, testCase.ExpectedErrorMessage, relationalOperatorKind);
                    }

                    var actualFilter = this.BindFilter(model, filter, errorMessage);

                    if (errorMessage == null)
                    {
                        this.Assert.IsNotNull(actualFilter, "Filter must not be null.");

                        BinaryOperatorNode binaryOperatorNode = null;
                        if (actualFilter.Expression.InternalKind == InternalQueryNodeKind.Convert)
                        {
                            binaryOperatorNode = ((ConvertNode)actualFilter.Expression).Source as BinaryOperatorNode;
                        }
                        else
                        {
                            binaryOperatorNode = actualFilter.Expression as BinaryOperatorNode;
                        }
                        this.Assert.IsNotNull(binaryOperatorNode, "Expected a binary operator at the top of the filter.");

                        QueryTestUtils.VerifyTypesAreEqual(
                            testCase.ExpectedResultType,
                            binaryOperatorNode.Left.TypeReference,
                            this.Assert);

                        QueryTestUtils.VerifyTypesAreEqual(
                            testCase.ExpectedResultType,
                            binaryOperatorNode.Right.TypeReference,
                            this.Assert);
                    }

                });
        }

        [TestMethod, Variation(Description = "Verifies correct handling of type promotions during binding.")]
        public void ArithmeticOperatorTypePromotion()
        {
            var metadata = QueryTestMetadata.BuildTestMetadata(this.PrimitiveTypeResolver, this.StronglyTypedDataServiceProviderFactory);

            BinaryOperatorKind[] arithmeticOperatorKinds = new BinaryOperatorKind[]
            {
                BinaryOperatorKind.Add,
                BinaryOperatorKind.Subtract,
                BinaryOperatorKind.Multiply,
                BinaryOperatorKind.Divide,
                BinaryOperatorKind.Modulo,
            };

            var testCases = ComputeArithmeticTestCases().Concat(ComputeArithmeticErrorTestCases());

            this.CombinatorialEngineProvider.RunCombinations(
                testCases,
                arithmeticOperatorKinds,
                (testCase, arithmeticOperatorKind) =>
                {
                    string filter = testCase.Arguments[0] + " " + QueryTestUtils.ToOperatorName(arithmeticOperatorKind) + " " + testCase.Arguments[1] + " le 0";

                    string errorMessage = null;
                    if (testCase.ExpectedErrorMessage != null)
                    {
                        errorMessage = string.Format(CultureInfo.InvariantCulture, testCase.ExpectedErrorMessage, arithmeticOperatorKind);
                    }

                    var actualFilter = this.BindFilter(metadata, filter, errorMessage);

                    if (errorMessage == null)
                    {
                        this.Assert.IsNotNull(actualFilter, "Filter must not be null.");

                        BinaryOperatorNode binaryOperatorNode = null;
                        if (actualFilter.Expression.InternalKind == InternalQueryNodeKind.Convert)
                        {
                            binaryOperatorNode = ((ConvertNode)actualFilter.Expression).Source as BinaryOperatorNode;
                        }
                        else
                        {
                            binaryOperatorNode = actualFilter.Expression as BinaryOperatorNode;
                        }
                        this.Assert.IsNotNull(binaryOperatorNode, "Expected a binary operator at the top of the filter.");

                        if (binaryOperatorNode.Left.InternalKind == InternalQueryNodeKind.Convert)
                        {
                            binaryOperatorNode = ((ConvertNode)binaryOperatorNode.Left).Source as BinaryOperatorNode;
                        }
                        else
                        {
                            binaryOperatorNode = binaryOperatorNode.Left as BinaryOperatorNode;
                        }
                        this.Assert.IsNotNull(binaryOperatorNode, "Expected a binary operator as the left argument of the top-level binary operator.");

                        QueryTestUtils.VerifyTypesAreEqual(
                            testCase.ExpectedResultType,
                            binaryOperatorNode.Left.TypeReference,
                            this.Assert);

                        QueryTestUtils.VerifyTypesAreEqual(
                            testCase.ExpectedResultType,
                            binaryOperatorNode.Right.TypeReference,
                            this.Assert);
                    }
                });
        }

        [TestMethod, Variation(Description = "Verifies correct handling of type promotions for the 'negate' operator during binding.")]
        public void NegateTypePromotion()
        {
            var metadata = QueryTestMetadata.BuildTestMetadata(this.PrimitiveTypeResolver, this.StronglyTypedDataServiceProviderFactory);

            this.CombinatorialEngineProvider.RunCombinations(
                ComputeUnaryTestCases(UnaryOperatorKind.Negate).Concat(ComputeUnaryErrorTestCases(UnaryOperatorKind.Negate)),
                (testCase) =>
                {
                    string filter = "-" + testCase.Arguments[0] + " le 0";

                    string errorMessage = null;
                    if (testCase.ExpectedErrorMessage != null)
                    {
                        errorMessage = string.Format(CultureInfo.InvariantCulture, testCase.ExpectedErrorMessage, "Negate");
                    }

                    var actualFilter = this.BindFilter(metadata, filter, errorMessage);

                    if (errorMessage == null)
                    {
                        this.Assert.IsNotNull(actualFilter, "Filter must not be null.");

                        BinaryOperatorNode binaryOperatorNode = null;
                        if (actualFilter.Expression.InternalKind == InternalQueryNodeKind.Convert)
                        {
                            binaryOperatorNode = ((ConvertNode)actualFilter.Expression).Source as BinaryOperatorNode;
                        }
                        else
                        {
                            binaryOperatorNode = actualFilter.Expression as BinaryOperatorNode;
                        }
                        this.Assert.IsNotNull(binaryOperatorNode, "Expected a binary operator at the top of the filter.");

                        UnaryOperatorNode unaryOperatorNode = null;
                        if (binaryOperatorNode.Left.InternalKind == InternalQueryNodeKind.Convert)
                        {
                            unaryOperatorNode = ((ConvertNode)binaryOperatorNode.Left).Source as UnaryOperatorNode;
                        }
                        else
                        {
                            unaryOperatorNode = binaryOperatorNode.Left as UnaryOperatorNode;
                        }
                        this.Assert.IsNotNull(unaryOperatorNode, "Expected a unary operator as the left argument of the binary operator.");

                        QueryTestUtils.VerifyTypesAreEqual(
                            testCase.ExpectedResultType,
                            unaryOperatorNode.Operand.TypeReference,
                            this.Assert);
                    }
                });
        }

        [TestMethod, Variation(Description = "Verifies correct handling of type promotions for the 'not' operator during binding.")]
        public void NotTypePromotion()
        {
            var metadata = QueryTestMetadata.BuildTestMetadata(this.PrimitiveTypeResolver, this.StronglyTypedDataServiceProviderFactory);

            // run over all operator kinds (not, negate)
            // use all combinations with the same argument types (plain and nullable)

            this.CombinatorialEngineProvider.RunCombinations(
                ComputeUnaryTestCases(UnaryOperatorKind.Not).Concat(ComputeUnaryErrorTestCases(UnaryOperatorKind.Not)),
                (testCase) =>
                {
                    string filter = "not " + testCase.Arguments[0];

                    string errorMessage = null;
                    if (testCase.ExpectedErrorMessage != null)
                    {
                        errorMessage = string.Format(CultureInfo.InvariantCulture, testCase.ExpectedErrorMessage, "Not");
                    }

                    var actualFilter = this.BindFilter(metadata, filter, errorMessage);

                    if (errorMessage == null)
                    {
                        this.Assert.IsNotNull(actualFilter, "Filter must not be null.");

                        UnaryOperatorNode unaryOperatorNode = null;
                        if (actualFilter.Expression.InternalKind == InternalQueryNodeKind.Convert)
                        {
                            unaryOperatorNode = ((ConvertNode)actualFilter.Expression).Source as UnaryOperatorNode;
                        }
                        else
                        {
                            unaryOperatorNode = actualFilter.Expression as UnaryOperatorNode;
                        }
                        this.Assert.IsNotNull(unaryOperatorNode, "Expected a unary operator at the top of the filter.");

                        QueryTestUtils.VerifyTypesAreEqual(
                            testCase.ExpectedResultType,
                            unaryOperatorNode.Operand.TypeReference,
                            this.Assert);
                    }
                });
        }

        private static IEdmTypeReference MakeNullableType(IEdmTypeReference type)
        {
            if (type.IsNullable)
            {
                return type;
            }

            return Microsoft.Test.Taupo.OData.Common.MetadataUtils.ToTypeReference(type.Definition, true);
        }

        private static IEdmTypeReference ComputeResultType(bool firstNullable, bool secondNullable, IEdmTypeReference promotedType)
        {
            // we rely on the promoted type
            if (firstNullable || secondNullable)
                return MakeNullableType(promotedType);
            return promotedType;
        }

        private static IEnumerable<TypePromotionTestCase> ComputeBinaryTestCases(PropertyDescriptor first, PropertyDescriptor second, IEdmTypeReference promotedType)
        {
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.PropertyName, second.PropertyName },
                ExpectedResultType = ComputeResultType(false, false, promotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.NullablePropertyName, second.PropertyName },
                ExpectedResultType = ComputeResultType(true, false, promotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.PropertyName, second.NullablePropertyName },
                ExpectedResultType = ComputeResultType(false, true, promotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.NullablePropertyName, second.NullablePropertyName },
                ExpectedResultType = ComputeResultType(true, true, promotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.PropertyName, "null" },
                ExpectedResultType = MakeNullableType(first.PromotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.NullablePropertyName, "null" },
                ExpectedResultType = MakeNullableType(first.PromotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { "null", second.PropertyName },
                ExpectedResultType = MakeNullableType(second.PromotedType)
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { "null", second.NullablePropertyName },
                ExpectedResultType = MakeNullableType(second.PromotedType)
            };
        }

        private static IEnumerable<TypePromotionTestCase> ComputeBinaryErrorTestCases(PropertyDescriptor first, PropertyDescriptor second)
        {
            string errorMessage = string.Format(
                CultureInfo.InvariantCulture,
                "A binary operator with incompatible types was detected. Found operand types '{0}' and '{1}' for operator kind '{{0}}'.",
                first.PropertyType.TestFullName(),
                second.PropertyType.TestFullName());

            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.PropertyName, second.PropertyName },
                ExpectedErrorMessage = errorMessage
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.NullablePropertyName, second.PropertyName },
                ExpectedErrorMessage = errorMessage
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.PropertyName, second.NullablePropertyName },
                ExpectedErrorMessage = errorMessage
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { first.NullablePropertyName, second.NullablePropertyName },
                ExpectedErrorMessage = errorMessage
            };
        }

        private static IEnumerable<TypePromotionTestCase> ComputeUnaryTestCases(PropertyDescriptor descriptor)
        {
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { descriptor.PropertyName },
                ExpectedResultType = descriptor.PromotedType
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { descriptor.NullablePropertyName },
                ExpectedResultType = MakeNullableType(descriptor.PromotedType)
            };
        }

        private static IEnumerable<TypePromotionTestCase> ComputeUnaryErrorTestCases(PropertyDescriptor descriptor)
        {
            string errorMessage = string.Format(
                CultureInfo.InvariantCulture,
                "A unary operator with an incompatible type was detected. Found operand type '{0}' for operator kind '{{0}}'.",
                descriptor.PropertyType.TestFullName());

            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { descriptor.PropertyName },
                ExpectedErrorMessage = errorMessage
            };
            yield return new TypePromotionTestCase
            {
                Arguments = new string[] { descriptor.NullablePropertyName },
                ExpectedErrorMessage = errorMessage
            };
        }

        private static IEnumerable<TypePromotionTestCase> ComputeArithmeticTestCases()
        {
            var cases = new PropertyComparison[]
                {
                    // same primitive type for both operands
                    new PropertyComparison { First = bytePropertyDescriptor, Second = bytePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = decimalPropertyDescriptor, Second = decimalPropertyDescriptor,  PromotedType = (IEdmPrimitiveTypeReference)EdmCoreModel.Instance.GetDecimal(false) },
                    new PropertyComparison { First = doublePropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                    new PropertyComparison { First = int16PropertyDescriptor, Second = int16PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = int32PropertyDescriptor, Second = int32PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = int64PropertyDescriptor, Second = int64PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt64(false) },
                    new PropertyComparison { First = sbytePropertyDescriptor, Second = sbytePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = singlePropertyDescriptor, Second = singlePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetSingle(false) },

                    // different primitive types for the two operands
                    new PropertyComparison { First = decimalPropertyDescriptor, Second = bytePropertyDescriptor,  PromotedType = (IEdmPrimitiveTypeReference)EdmCoreModel.Instance.GetDecimal(false) },
                    new PropertyComparison { First = decimalPropertyDescriptor, Second = int16PropertyDescriptor,  PromotedType = (IEdmPrimitiveTypeReference)EdmCoreModel.Instance.GetDecimal(false) },
                    new PropertyComparison { First = decimalPropertyDescriptor, Second = int32PropertyDescriptor,  PromotedType = (IEdmPrimitiveTypeReference)EdmCoreModel.Instance.GetDecimal(false) },
                    new PropertyComparison { First = decimalPropertyDescriptor, Second = int64PropertyDescriptor,  PromotedType = (IEdmPrimitiveTypeReference)EdmCoreModel.Instance.GetDecimal(false) },
                    new PropertyComparison { First = bytePropertyDescriptor, Second = int16PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = sbytePropertyDescriptor, Second = int16PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = bytePropertyDescriptor, Second = int32PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = sbytePropertyDescriptor, Second = int32PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = int16PropertyDescriptor, Second = int32PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt32(false) },
                    new PropertyComparison { First = bytePropertyDescriptor, Second = int64PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt64(false) },
                    new PropertyComparison { First = sbytePropertyDescriptor, Second = int64PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt64(false) },
                    new PropertyComparison { First = int16PropertyDescriptor, Second = int64PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt64(false) },
                    new PropertyComparison { First = int32PropertyDescriptor, Second = int64PropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetInt64(false) },
                    new PropertyComparison { First = bytePropertyDescriptor, Second = singlePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetSingle(false) },
                    new PropertyComparison { First = sbytePropertyDescriptor, Second = singlePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetSingle(false) },
                    new PropertyComparison { First = int16PropertyDescriptor, Second = singlePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetSingle(false) },
                    new PropertyComparison { First = int32PropertyDescriptor, Second = singlePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetSingle(false) },
                    new PropertyComparison { First = int64PropertyDescriptor, Second = singlePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetSingle(false) },
                    new PropertyComparison { First = bytePropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                    new PropertyComparison { First = sbytePropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                    new PropertyComparison { First = int16PropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                    new PropertyComparison { First = int32PropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                    new PropertyComparison { First = int64PropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                    new PropertyComparison { First = singlePropertyDescriptor, Second = doublePropertyDescriptor,  PromotedType = EdmCoreModel.Instance.GetDouble(false) },
                };

            return cases.SelectMany(c => ComputeBinaryTestCases(c.First, c.Second, c.PromotedType));
        }

        private static IEnumerable<TypePromotionTestCase> ComputeArithmeticErrorTestCases()
        {
            var cases = new[]
                {
                    new { First = decimalPropertyDescriptor, Second = singlePropertyDescriptor },
                    new { First = decimalPropertyDescriptor, Second = doublePropertyDescriptor },
                };

            // decimal to other type promotion
            return cases.SelectMany(c => ComputeBinaryErrorTestCases(c.First, c.Second));
        }

        private static IEnumerable<TypePromotionTestCase> ComputeRelationalTestCases()
        {
            var cases = new PropertyComparison[]
                {
                    new PropertyComparison { First = stringPropertyDescriptor, Second = stringPropertyDescriptor, PromotedType = EdmCoreModel.Instance.GetString(true) },
                    new PropertyComparison { First = binaryPropertyDescriptor, Second = binaryPropertyDescriptor, PromotedType = EdmCoreModel.Instance.GetBinary(true) },
                    new PropertyComparison { First = boolPropertyDescriptor, Second = boolPropertyDescriptor, PromotedType = EdmCoreModel.Instance.GetBoolean(false) },
                    new PropertyComparison { First = guidPropertyDescriptor, Second = guidPropertyDescriptor, PromotedType = EdmCoreModel.Instance.GetGuid(false) },
                };

            // same primitive type for both operands
            return ComputeArithmeticTestCases()
                .Concat(cases.SelectMany(c => ComputeBinaryTestCases(c.First, c.Second, c.PromotedType)));
        }

        private static IEnumerable<TypePromotionTestCase> ComputeRelationalErrorTestCases()
        {
            var cases = new[]
                {
                    // string to other type promotion
                    new { First = stringPropertyDescriptor, Second = boolPropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = sbytePropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = bytePropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = int16PropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = int32PropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = int64PropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = singlePropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = doublePropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = decimalPropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = guidPropertyDescriptor },
                    new { First = stringPropertyDescriptor, Second = binaryPropertyDescriptor },

                    // Guid to other type promotion
                    new { First = guidPropertyDescriptor, Second = boolPropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = sbytePropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = bytePropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = int16PropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = int32PropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = int64PropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = singlePropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = doublePropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = decimalPropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = stringPropertyDescriptor },
                    new { First = guidPropertyDescriptor, Second = binaryPropertyDescriptor },

                    // Binary to other type promotion
                    new { First = binaryPropertyDescriptor, Second = boolPropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = sbytePropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = bytePropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = int16PropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = int32PropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = int64PropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = singlePropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = doublePropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = decimalPropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = stringPropertyDescriptor },
                    new { First = binaryPropertyDescriptor, Second = guidPropertyDescriptor },

                    // bool to other type promotion
                    new { First = boolPropertyDescriptor, Second = sbytePropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = bytePropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = int16PropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = int32PropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = int64PropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = singlePropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = doublePropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = decimalPropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = stringPropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = binaryPropertyDescriptor },
                    new { First = boolPropertyDescriptor, Second = guidPropertyDescriptor },

                    // decimal to other type promotion
                    new { First = decimalPropertyDescriptor, Second = boolPropertyDescriptor },
                    new { First = decimalPropertyDescriptor, Second = binaryPropertyDescriptor },
                    new { First = decimalPropertyDescriptor, Second = stringPropertyDescriptor },
                    new { First = decimalPropertyDescriptor, Second = guidPropertyDescriptor },
                };

            return ComputeArithmeticErrorTestCases()
                .Concat(cases.SelectMany(c => ComputeBinaryErrorTestCases(c.First, c.Second)));
        }

        private static IEnumerable<TypePromotionTestCase> ComputeUnaryTestCases(UnaryOperatorKind operatorKind)
        {
            switch (operatorKind)
            {
                case UnaryOperatorKind.Negate:
                    var negateCases = new[]
                        {
                            new { Operand = bytePropertyDescriptor },
                            new { Operand = decimalPropertyDescriptor },
                            new { Operand = doublePropertyDescriptor },
                            new { Operand = int16PropertyDescriptor },
                            new { Operand = int32PropertyDescriptor },
                            new { Operand = int64PropertyDescriptor },
                            new { Operand = sbytePropertyDescriptor },
                            new { Operand = singlePropertyDescriptor },
                        };

                    return negateCases.SelectMany(c => ComputeUnaryTestCases(c.Operand));

                case UnaryOperatorKind.Not:
                    var notCases = new[]
                        {
                            new { Operand = boolPropertyDescriptor },
                        };

                    return notCases.SelectMany(c => ComputeUnaryTestCases(c.Operand));

                default:
                    throw new NotSupportedException();
            }
        }

        private static IEnumerable<TypePromotionTestCase> ComputeUnaryErrorTestCases(UnaryOperatorKind operatorKind)
        {

            switch (operatorKind)
            {
                case UnaryOperatorKind.Negate:
                    var negateCases = new[]
                        {
                            new { Operand = stringPropertyDescriptor },
                            new { Operand = boolPropertyDescriptor },
                            new { Operand = guidPropertyDescriptor },
                            new { Operand = binaryPropertyDescriptor },
                        };

                    return negateCases.SelectMany(c => ComputeUnaryErrorTestCases(c.Operand));

                case UnaryOperatorKind.Not:
                    var notCases = new[]
                        {
                            new { Operand = stringPropertyDescriptor },
                            new { Operand = guidPropertyDescriptor },
                            new { Operand = sbytePropertyDescriptor },
                            new { Operand = bytePropertyDescriptor },
                            new { Operand = int16PropertyDescriptor },
                            new { Operand = int32PropertyDescriptor },
                            new { Operand = int64PropertyDescriptor },
                            new { Operand = singlePropertyDescriptor },
                            new { Operand = doublePropertyDescriptor },
                            new { Operand = decimalPropertyDescriptor },
                            new { Operand = binaryPropertyDescriptor },
                        };

                    return notCases.SelectMany(c => ComputeUnaryErrorTestCases(c.Operand));

                default:
                    throw new NotSupportedException();
            }
        }

        private FilterClause BindFilter(IEdmModel model, string filter, string errorMessage)
        {
            FilterClause actualFilter = null;
            TestExceptionUtils.ExpectedException<ODataException>(
                this.Assert,
                () =>
                {
                    string query = "/TypesWithPrimitiveProperties?$filter=" + filter;
                    ODataUri actual = QueryNodeUtils.BindQuery(query, model);

                    // the filter node should be the top-level node in the query tree
                    actualFilter = (FilterClause)actual.Filter;
                },
                errorMessage,
                null);
            return actualFilter;
        }

        public class TypePromotionTestCase
        {
            public string[] Arguments { get; set; }
            public IEdmTypeReference ExpectedResultType { get; set; }
            public string ExpectedErrorMessage { get; set; }
        }

        private sealed class PropertyDescriptor
        {
            public string PropertyName { get; set; }
            public string NullablePropertyName { get; set; }
            public IEdmTypeReference PromotedType { get; set; }
            public IEdmTypeReference PropertyType { get; set; }
        }

        private sealed class PropertyComparison
        {
            public PropertyDescriptor First { get; set; }
            public PropertyDescriptor Second { get; set; }
            public IEdmPrimitiveTypeReference PromotedType { get; set; }
        }
    }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: robin
 * Date: 06/08/14
 * Time: 19:44
 */

namespace Easylib\scrapers;

use Easylib\util\Config;
use Easylib\util\Constants;

use TMDB\Client;
use Easylib\model\Movie;

class TMDB_Scraper extends Scraper{

    private $db;

    function __construct(){
        $this->db = Client::getInstance(Config::get()[Constants::$TMDB_KEY]);
        $this->db->adult = true;  // return adult content
        $this->db->paged = false; // merges all paged results into a single result automatically
    }

    public function search_movie_dependent($full_filename, $title, $year = "Unknown"){

        //If year is found
        if ($year != 'Unknown'){
            $results = $this->db->search('movie', array('query'=>$title, 'year'=>$year));
        }else{ //there is no year in filename, search anyways
            $results = $this->db->search('movie', array('query'=>$title));
        }
        foreach($results as $result){
            echo 'Found: ' . $result->title . "\n";

            /*/create link
            $file_link = "library/" . $this->file($full_filename);
            if(!file_exists(__DIR__ ."/../../web/library")){
                mkdir(__DIR__ ."/../../web/library");
            }
            if(file_exists(__DIR__ ."/../../web/" . $file_link)){
                unlink(__DIR__ ."/../../web/" . $file_link);
            }
            print(__DIR__ ."/../../web/" . $file_link);
            symlink($full_filename, __DIR__ ."/../../web/" . $file_link);*/

            //fetch info form TMDB
            $info = $this->db->info('movie', $result->id);

            $genres = array();
            foreach($info->genres as $genre){
                $genres[$genre->id] = $genre->name;
            }

            $persons = $result->casts();
            $cast = array();
            foreach($persons['cast'] as $person){
                $cast[$person->id] = $person->name;
            }

            $crew = array();
            foreach($persons['crew'] as $person){
                $crew[$person->id] = $person->name;
            }

            $keywords = array();
            foreach($result->keywords()->keywords as $keyword){
                $keywords[$keyword->id] = $keyword->name;
            }

            $trailer = '';
            foreach($result->trailers()->youtube as $clip){
                if($clip->type == 'Trailer'){
                    $trailer = $clip->source;
                    break;
                }
            }

            $movie = new Movie();

            $movie->id = $info->id;
            $movie->imdb_id = $info->imdb_id;
            $movie->title = $info->title;
            $movie->overview = $info->overview;
            $movie->runtime = $info->runtime;
            $movie->genre = $genres;
            $movie->release_date = $info->release_date;
            $movie->cast = $cast;
            $movie->crew = $crew;
            $movie->tags = $keywords;
            $movie->rating = $info->vote_average;
            $movie->votes = $info->vote_count;
            $movie->trailer = $trailer;
            $movie->poster_small_url = $this->db->image_url('poster','w185',$result->poster_path);
            $movie->poster_medium_url = $this->db->image_url('poster','w342',$result->poster_path);
            $movie->poster_large_url = $this->db->image_url('poster','w500',$result->poster_path);
            $movie->backdrop_small_url = $this->db->image_url('backdrop','w300',$result->backdrop_path);
            $movie->backdrop_medium_url = $this->db->image_url('backdrop','w720',$result->backdrop_path);
            $movie->backdrop_large_url = $this->db->image_url('backdrop','w1280',$result->backdrop_path);
            $movie->file_path = $full_filename; //$file_link; <-- used in case link was nessesary

            //print_r($movie);

            return $movie;
        }
        return null;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Parmelia subconfluescens H. Magn.

### Remarks
null


text:
//-----------------------------------------------
//
//	This file is part of the Siv3D Engine.
//
//	Copyright (c) 2008-2022 Ryo Suzuki
//	Copyright (c) 2016-2022 OpenSiv3D Project
//
//	Licensed under the MIT License.
//
//-----------------------------------------------

# pragma once
# include <cmath>
# include "Common.hpp"
# include "PointVector.hpp"
# include "PlaceHolder.hpp"

namespace s3d
{
	namespace Math
	{
		//////////////////////////////////////////////////
		//
		//	Fmod
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Fmod(float x, float y) noexcept;

		[[nodiscard]]
		inline double Fmod(double x, double y) noexcept;

		[[nodiscard]]
		inline Float2 Fmod(Float2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline Float3 Fmod(Float3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline Float4 Fmod(Float4 v1, Float4 v2) noexcept;

		[[nodiscard]]
		inline Vec2 Fmod(Vec2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline Vec3 Fmod(Vec3 v1, Vec3 v2) noexcept;

		[[nodiscard]]
		inline Vec4 Fmod(Vec4 v1, Vec4 v2) noexcept;

		template <class T1, class T2, class R = CommonVector_t<T1, T2>>
		[[nodiscard]]
		inline R Fmod(T1 x, T2 y) noexcept;

		//////////////////////////////////////////////////
		//
		//	Fraction
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Fraction(float x) noexcept;

		[[nodiscard]]
		inline double Fraction(double x) noexcept;

		[[nodiscard]]
		inline Float2 Fraction(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Fraction(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Fraction(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Fraction(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Fraction(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Fraction(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Frexp
		//
		//////////////////////////////////////////////////

		inline float Frexp(float x, float& exp) noexcept;

		inline double Frexp(double x, double& exp) noexcept;

		inline Float2 Frexp(Float2 x, Float2& exp) noexcept;

		inline Float3 Frexp(Float3 x, Float3& exp) noexcept;

		inline Float4 Frexp(Float4 x, Float4& exp) noexcept;

		inline Vec2 Frexp(Vec2 x, Vec2& exp) noexcept;

		inline Vec3 Frexp(Vec3 x, Vec3& exp) noexcept;

		inline Vec4 Frexp(Vec4 x, Vec4& exp) noexcept;

		//////////////////////////////////////////////////
		//
		//	Ldexp
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Ldexp(float x, float y) noexcept;

		[[nodiscard]]
		inline double Ldexp(double x, double y) noexcept;

		[[nodiscard]]
		inline Float2 Ldexp(Float2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline Float3 Ldexp(Float3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline Float4 Ldexp(Float4 v1, Float4 v2) noexcept;

		[[nodiscard]]
		inline Vec2 Ldexp(Vec2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline Vec3 Ldexp(Vec3 v1, Vec3 v2) noexcept;

		[[nodiscard]]
		inline Vec4 Ldexp(Vec4 v1, Vec4 v2) noexcept;

		//////////////////////////////////////////////////
		//
		//	Log
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Log(float x) noexcept;

		[[nodiscard]]
		inline double Log(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Log(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Log(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Log(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Log(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Log(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Log(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Log(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Log2
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Log2(float x) noexcept;

		[[nodiscard]]
		inline double Log2(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Log2(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Log2(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Log2(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Log2(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Log2(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Log2(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Log2(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Log10
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Log10(float x) noexcept;

		[[nodiscard]]
		inline double Log10(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Log10(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Log10(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Log10(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Log10(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Log10(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Log10(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Log10(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Modf
		//
		//////////////////////////////////////////////////

		inline float Modf(float x, float& exp) noexcept;

		inline double Modf(double x, double& exp) noexcept;

		inline Float2 Modf(Float2 x, Float2& exp) noexcept;

		inline Float3 Modf(Float3 x, Float3& exp) noexcept;

		inline Float4 Modf(Float4 x, Float4& exp) noexcept;

		inline Vec2 Modf(Vec2 x, Vec2& exp) noexcept;

		inline Vec3 Modf(Vec3 x, Vec3& exp) noexcept;

		inline Vec4 Modf(Vec4 x, Vec4& exp) noexcept;

		//////////////////////////////////////////////////
		//
		//	Pow
		//
		//////////////////////////////////////////////////

		template <class T1, class T2, std::enable_if_t<std::conjunction_v<std::is_arithmetic<T1>, std::is_arithmetic<T2>>>* = nullptr>
		[[nodiscard]]
		inline auto Pow(T1 x, T2 y) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline Float2 Pow(Float2 x, Arithmetic y) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline Float3 Pow(Float3 x, Arithmetic y) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline Float4 Pow(Float4 x, Arithmetic y) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline Vec2 Pow(Vec2 x, Arithmetic y) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline Vec3 Pow(Vec3 x, Arithmetic y) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline Vec4 Pow(Vec4 x, Arithmetic y) noexcept;

		//////////////////////////////////////////////////
		//
		//	Sign
		//
		//////////////////////////////////////////////////

		SIV3D_CONCEPT_ARITHMETIC
		inline constexpr int32 Sign(Arithmetic x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 Sign(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Sign(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 Sign(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 Sign(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Sign(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 Sign(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	ToRadians
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float ToRadians(float x) noexcept;

		[[nodiscard]]
		inline constexpr double ToRadians(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline constexpr double ToRadians(Arithmetic x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 ToRadians(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 ToRadians(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 ToRadians(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 ToRadians(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 ToRadians(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 ToRadians(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	ToDegrees
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float ToDegrees(float x) noexcept;

		[[nodiscard]]
		inline constexpr double ToDegrees(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline constexpr double ToDegrees(Arithmetic x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 ToDegrees(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 ToDegrees(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 ToDegrees(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 ToDegrees(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 ToDegrees(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 ToDegrees(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Abs
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Abs(float x) noexcept;

		[[nodiscard]]
		inline constexpr double Abs(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline constexpr Arithmetic Abs(Arithmetic x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 Abs(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Abs(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 Abs(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 Abs(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Abs(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 Abs(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	AbsDiff
		//
		//////////////////////////////////////////////////

		template <class T1, class T2, std::enable_if_t<std::conjunction_v<std::is_arithmetic<T1>, std::is_arithmetic<T2>>>* = nullptr>
		[[nodiscard]]
		inline constexpr auto AbsDiff(T1 x, T2 y) noexcept;

		[[nodiscard]]
		inline constexpr Float2 AbsDiff(Float2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline constexpr Float3 AbsDiff(Float3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline constexpr Float4 AbsDiff(Float4 v1, Float4 v2) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 AbsDiff(Vec2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 AbsDiff(Vec3 v1, Vec3 v2) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 AbsDiff(Vec4 v1, Vec4 v2) noexcept;

		//////////////////////////////////////////////////
		//
		//	Square
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Square(float x) noexcept;

		[[nodiscard]]
		inline constexpr double Square(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline constexpr Arithmetic Square(Arithmetic x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 Square(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Square(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 Square(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 Square(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Square(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 Square(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Exp
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Exp(float x) noexcept;

		[[nodiscard]]
		inline double Exp(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Exp(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Exp(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Exp(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Exp(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Exp(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Exp(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Exp(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Exp2
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Exp2(float x) noexcept;

		[[nodiscard]]
		inline double Exp2(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Exp2(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Exp2(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Exp2(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Exp2(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Exp2(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Exp2(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Exp2(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Rsqrt
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Rsqrt(float x) noexcept;

		[[nodiscard]]
		inline double Rsqrt(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Rsqrt(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Rsqrt(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Rsqrt(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Rsqrt(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Rsqrt(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Rsqrt(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Rsqrt(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Sqrt
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Sqrt(float x) noexcept;

		[[nodiscard]]
		inline double Sqrt(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Sqrt(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Sqrt(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Sqrt(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Sqrt(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Sqrt(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Sqrt(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Sqrt(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Ceil
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Ceil(float x) noexcept;

		[[nodiscard]]
		inline double Ceil(double x) noexcept;

		[[nodiscard]]
		inline Float2 Ceil(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Ceil(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Ceil(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Ceil(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Ceil(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Ceil(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Floor
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Floor(float x) noexcept;

		[[nodiscard]]
		inline double Floor(double x) noexcept;

		[[nodiscard]]
		inline Float2 Floor(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Floor(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Floor(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Floor(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Floor(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Floor(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Round
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Round(float x) noexcept;

		[[nodiscard]]
		inline double Round(double x) noexcept;

		[[nodiscard]]
		inline Float2 Round(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Round(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Round(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Round(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Round(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Round(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Clamp
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Clamp(float x, float min, float max) noexcept;

		[[nodiscard]]
		inline constexpr double Clamp(double x, double min, double max) noexcept;

		[[nodiscard]]
		inline constexpr Point Clamp(Point v, int32 min, int32 max) noexcept;

		[[nodiscard]]
		inline constexpr Float2 Clamp(Float2 v, float min, float max) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Clamp(Float3 v, float min, float max) noexcept;

		[[nodiscard]]
		inline constexpr Float4 Clamp(Float4 v, float min, float max) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 Clamp(Vec2 v, double min, double max) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Clamp(Vec3 v, double min, double max) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 Clamp(Vec4 v, double min, double max) noexcept;

		//////////////////////////////////////////////////
		//
		//	Saturate
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Saturate(float x) noexcept;

		[[nodiscard]]
		inline constexpr double Saturate(double x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 Saturate(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Saturate(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 Saturate(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 Saturate(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Saturate(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 Saturate(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Acos
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Acos(float x) noexcept;

		[[nodiscard]]
		inline double Acos(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Acos(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Acos(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Acos(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Acos(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Acos(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Acos(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Acos(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Asin
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Asin(float x) noexcept;

		[[nodiscard]]
		inline double Asin(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Asin(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Asin(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Asin(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Asin(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Asin(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Asin(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Asin(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Atan
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Atan(float x) noexcept;

		[[nodiscard]]
		inline double Atan(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Atan(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Atan(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Atan(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Atan(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Atan(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Atan(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Atan(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Atan2
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Atan2(float y, float x) noexcept;

		[[nodiscard]]
		inline double Atan2(double y, double x) noexcept;

		template <class T1, class T2, std::enable_if_t<std::conjunction_v<std::is_arithmetic<T1>, std::is_arithmetic<T2>>>* = nullptr>
		[[nodiscard]]
		inline auto Atan2(T1 y, T2 x) noexcept;

		[[nodiscard]]
		inline Float2 Atan2(Float2 y, Float2 x) noexcept;

		[[nodiscard]]
		inline Float3 Atan2(Float3 y, Float3 x) noexcept;

		[[nodiscard]]
		inline Float4 Atan2(Float4 y, Float4 x) noexcept;

		[[nodiscard]]
		inline Vec2 Atan2(Vec2 y, Vec2 x) noexcept;

		[[nodiscard]]
		inline Vec3 Atan2(Vec3 y, Vec3 x) noexcept;

		[[nodiscard]]
		inline Vec4 Atan2(Vec4 y, Vec4 x) noexcept;

		//////////////////////////////////////////////////
		//
		//	Cos
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Cos(float x) noexcept;

		[[nodiscard]]
		inline double Cos(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Cos(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Cos(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Cos(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Cos(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Cos(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Cos(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Cos(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Cosh
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Cosh(float x) noexcept;

		[[nodiscard]]
		inline double Cosh(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Cosh(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Cosh(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Cosh(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Cosh(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Cosh(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Cosh(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Cosh(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Sin
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Sin(float x) noexcept;

		[[nodiscard]]
		inline double Sin(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Sin(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Sin(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Sin(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Sin(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Sin(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Sin(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Sin(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Sinh
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Sinh(float x) noexcept;

		[[nodiscard]]
		inline double Sinh(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Sinh(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Sinh(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Sinh(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Sinh(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Sinh(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Sinh(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Sinh(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Tan
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Tan(float x) noexcept;

		[[nodiscard]]
		inline double Tan(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Tan(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Tan(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Tan(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Tan(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Tan(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Tan(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Tan(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Tanh
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline float Tanh(float x) noexcept;

		[[nodiscard]]
		inline double Tanh(double x) noexcept;

		SIV3D_CONCEPT_ARITHMETIC
		[[nodiscard]]
		inline double Tanh(Arithmetic x) noexcept;

		[[nodiscard]]
		inline Float2 Tanh(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Tanh(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Tanh(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Tanh(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Tanh(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Tanh(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Dot
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Dot(Float2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Float2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Vec2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Vec2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline constexpr float Dot(Float3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Vec3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Float3 v1, Vec3 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Vec3 v1, Vec3 v2) noexcept;

		[[nodiscard]]
		inline constexpr float Dot(Float4 v1, Float4 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Vec4 v1, Float4 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Float4 v1, Vec4 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Dot(Vec4 v1, Vec4 v2) noexcept;

		//////////////////////////////////////////////////
		//
		//	Cross
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Cross(Float2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Cross(Float2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Cross(Vec2 v1, Float2 v2) noexcept;

		[[nodiscard]]
		inline constexpr double Cross(Vec2 v1, Vec2 v2) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Cross(Float3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Cross(Float3 v1, Vec3 v2) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Cross(Vec3 v1, Float3 v2) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Cross(Vec3 v1, Vec3 v2) noexcept;

		//////////////////////////////////////////////////
		//
		//	Normalize
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Normalize(float x) noexcept;

		[[nodiscard]]
		inline constexpr double Normalize(double x) noexcept;

		[[nodiscard]]
		inline Vec2 Normalize(Point v) noexcept;

		[[nodiscard]]
		inline Float2 Normalize(Float2 v) noexcept;

		[[nodiscard]]
		inline Float3 Normalize(Float3 v) noexcept;

		[[nodiscard]]
		inline Float4 Normalize(Float4 v) noexcept;

		[[nodiscard]]
		inline Vec2 Normalize(Vec2 v) noexcept;

		[[nodiscard]]
		inline Vec3 Normalize(Vec3 v) noexcept;

		[[nodiscard]]
		inline Vec4 Normalize(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	Smoothstep
		//
		//////////////////////////////////////////////////

		[[nodiscard]]
		inline constexpr float Smoothstep(float min, float max, float x) noexcept;

		[[nodiscard]]
		inline constexpr double Smoothstep(double min, double max, double x) noexcept;

		[[nodiscard]]
		inline constexpr float Smoothstep(float x) noexcept;

		[[nodiscard]]
		inline constexpr double Smoothstep(double x) noexcept;

		[[nodiscard]]
		inline constexpr Float2 Smoothstep(Float2 v) noexcept;

		[[nodiscard]]
		inline constexpr Float3 Smoothstep(Float3 v) noexcept;

		[[nodiscard]]
		inline constexpr Float4 Smoothstep(Float4 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec2 Smoothstep(Vec2 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec3 Smoothstep(Vec3 v) noexcept;

		[[nodiscard]]
		inline constexpr Vec4 Smoothstep(Vec4 v) noexcept;

		//////////////////////////////////////////////////
		//
		//	GCD
		//
		//////////////////////////////////////////////////

		template <class T1, class T2, std::enable_if_t<std::conjunction_v<std::is_integral<T1>, std::is_integral<T2>>>* = nullptr>
		[[nodiscard]]
		inline constexpr auto GCD(T1 x, T2 y) noexcept;

		//////////////////////////////////////////////////
		//
		//	LCM
		//
		//////////////////////////////////////////////////

		template <class T1, class T2, std::enable_if_t<std::conjunction_v<std::is_integral<T1>, std::is_integral<T2>>>* = nullptr>
		[[nodiscard]]
		inline constexpr auto LCM(T1 x, T2 y) noexcept;
	}
}

# include "detail/Math.ipp"
# include "detail/Math_Functors.ipp"


text:
printf_buffer_t::printf_buffer_t() : length_(0), ptr_(data_) {
    data_[0] = 0;
}

printf_buffer_t::printf_buffer_t(const char *format, ...) : length_(0), ptr_(data_) {
    data_[0] = 0;

    va_list ap;
    va_start(ap, format);

    vappendf(format, ap);

    va_end(ap);
}

printf_buffer_t::printf_buffer_t(va_list ap, const char *format) : length_(0), ptr_(data_) {
    data_[0] = 0;

    vappendf(format, ap);
}

printf_buffer_t::~printf_buffer_t() {
    if (ptr_ != data_) {
        delete[] ptr_;
    }
}

void printf_buffer_t::appendf(const char *format, ...) {
    va_list ap;
    va_start(ap, format);

    vappendf(format, ap);

    va_end(ap);
}

ATTR_FORMAT(printf, 5, 0)
inline void alloc_copy_and_format(const char *buf, int64_t length, int append_size, int64_t alloc_limit, const char *fmt, va_list ap, char **buf_out) {
    char *new_ptr = new char[alloc_limit];
    memcpy(new_ptr, buf, length);

    DEBUG_VAR int size = vsnprintf(new_ptr + length, size_t(append_size) + 1, fmt, ap);
    rassert(size == append_size);

    *buf_out = new_ptr;
}

void printf_buffer_t::vappendf(const char *format, va_list ap) {
    va_list aq;
    va_copy(aq, ap);

    if (ptr_ == data_) {
        rassert(length_ < STATIC_DATA_SIZE);

        // the snprintfs return the number of characters they _would_
        // have written, not including the '\0'.
        int _size = vsnprintf(ptr_ + length_, STATIC_DATA_SIZE - length_, format, ap);
        rassert(_size >= 0, "vsnprintf failed, bad format string?");

        if (_size < STATIC_DATA_SIZE - length_) {
            length_ += _size;
        } else {
            char *new_ptr;
            alloc_copy_and_format(ptr_, length_, _size,
                                  int64_round_up_to_power_of_two(length_ + _size + 1),
                                  format, aq, &new_ptr);

            // TODO: Have valgrind mark data_ memory undefined.
            ptr_ = new_ptr;
            length_ += _size;
        }

    } else {
        rassert(length_ >= STATIC_DATA_SIZE);

        char tmp[1];

        int _size = vsnprintf(tmp, sizeof(tmp), format, ap);
        rassert(_size >= 0, "vsnprintf failed, bad format string?");

        int64_t alloc_limit = int64_round_up_to_power_of_two(length_ + 1);
        if (length_ + _size + 1 <= alloc_limit) {
            DEBUG_VAR int size2 = vsnprintf(ptr_ + length_, _size + 1, format, aq);
            rassert(_size == size2);
            length_ += _size;
        } else {

            char *new_ptr;
            alloc_copy_and_format(ptr_, length_, _size,
                                  int64_round_up_to_power_of_two(length_ + _size + 1),
                                  format, aq, &new_ptr);

            delete[] ptr_;
            ptr_ = new_ptr;
            length_ += _size;
        }
    }

    va_end(aq);
}


text:
package com.johnbenjamincassel.conditionable;

public interface ConditionalExpressionInterface extends AbstractExpression {

}