All Downloads are FREE. Search and download functionalities are using the official Maven repository.

example.CppSTL Maven / Gradle / Ivy

/*
 * Zorbage: an algebraic data hierarchy for use in numeric processing.
 *
 * Copyright (c) 2016-2021 Barry DeZonia All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list
 * of conditions and the following disclaimer.
 * 
 * Redistributions in binary form must reproduce the above copyright notice, this
 * list of conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.
 * 
 * Neither the name of the  nor the names of its contributors may
 * be used to endorse or promote products derived from this software without specific
 * prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 */
package example;

/**
 * @author Barry DeZonia
 */
class CppSTL {

	// Zorbage has implemented most of the algorithms as defined in the C++ Standard
	// Template library as documented on cppreference.com. See here for more info:
	//   https://en.cppreference.com/w/cpp/algorithm
	
	void example1() {
		
		// AllOf.compute(Algebra algebra, Predicate condition, IndexedDataSource a);
		
		// NoneOf.compute(Algebra algebra, Predicate condition, IndexedDataSource a);
		
		// AnyOf.compute(Algebra algebra, Predicate condition, IndexedDataSource a);

		//   see https://en.cppreference.com/w/cpp/algorithm/all_any_none_of
	}

	void example2() {

		// ForEach.compute(Algebra algU, Procedure2 proc, IndexedDataSource a);
		
		//   see https://en.cppreference.com/w/cpp/algorithm/for_each
	}
	
	void example3() {
		
		// Count.compute(Algebra algebra, Algebra addAlgebra, U value, IndexedDataSource a, W sum);
		
		// CountIf.compute(Algebra algebra, Algebra addAlgebra, Predicate condition, IndexedDataSource a, W sum);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/count
	}
	
	void example4() {
		
		// Mismatch.compute(Algebra algebra, IndexedDataSource a, IndexedDataSource b);
		
		// Mismatch.compute(Algebra algebra, Predicate> cond, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/mismatch
	}
	
	void example5() {
		
		// Find.compute(Algebra algebra, U value, IndexedDataSource a);
		
		// Find.compute(Algebra algebra, U value, long start, long count, IndexedDataSource a);
		
		// FindIf.compute(Algebra algebra, Predicate condition, IndexedDataSource a);
		
		// FindIfNot.compute(Algebra algebra, Predicate condition, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/find
	}

	void example6() {
		
		// FindEnd.compute(Algebra algebra, IndexedDataSource values, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/find_end
	}
	
	void example7() {
	
		// FindFirstOf.compute(Algebra algebra, IndexedDataSource elements, IndexedDataSource a);
		
		// FindFirstOf.compute(Algebra algebra, Predicate> cond, IndexedDataSource elements, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/find_first_of
	}
	
	void example8() {
		
		// AdjacentFind.compute(Algebra algebra, IndexedDataSource a);
		
		// AdjacentFind.compute(Algebra algebra, long start, long count, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/adjacent_find
	}
	
	void example9() {
		
		// Search.compute(Algebra algebra, IndexedDataSource elements, IndexedDataSource a);
		
		// Search.compute(Algebra algebra, Predicate> cond, IndexedDataSource elements, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/search
	}
	
	void example10() {
	
		// SearchN.compute(Algebra algebra, long count, U value, IndexedDataSource a);
		
		// SearchN.compute(Algebra algebra, Predicate> cond, long count, U value, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/search_n
	}
	
	void example11() {
		
		// Copy.compute(Algebra algebra, IndexedDataSource a, IndexedDataSource b);
		
		// CopyIf.compute(Algebra algebra, Predicate cond, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/copy
	}
	
	void example12() {
		
		// CopyBackward.compute(Algebra algebra, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/copy_backward
	}
	
	void example13() {
	
		// Fill.compute(Algebra algebra, Procedure1 proc, IndexedDataSource storage);
		
		// Fill.compute(Algebra algebra, U value, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/fill
	}
	
	void example14() {
		
		// The following commands are all loosely based upon the CPP methods. These here are
		// more powerful and flexible.
		
		// Transform1.compute(algU, proc, a);
		// Transform2.compute(algU, proc, a, b);
		// Transform2.compute(algU, algW, proc, a, b);
		// Transform3.compute(algU, proc, a, b, c);
		// Transform3.compute(algU, algW, algY, proc, a, b, c);
		// Transform4.compute(algU, proc, a, b, c, d);
		// Transform4.compute(algM, algO, algQ, algS, proc, a, b, c, d);
		
		// ParallelTransform1.compute(algU, proc, a);
		// ParallelTransform2.compute(algU, proc, a, b);
		// ParallelTransform2.compute(algU, algW, proc, a, b);
		// ParallelTransform3.compute(algU, proc, a, b, c);
		// ParallelTransform3.compute(algU, algW, algY, proc, a, b, c);
		// ParallelTransform4.compute(algU, proc, a, b, c, d);
		// ParallelTransform4.compute(algU, algW, algY, algA, proc, a, b, c, d);
		
		// FixedTransform2a.compute(algU, fixedValue, proc, a, b);
		// FixedTransform2b.compute(algU, fixedValue, proc, a, b);
		// FixedTransform2a.compute(algD, algF, fixedValue, proc, a, b);
		// FixedTransform2b.compute(algD, algF, fixedValue, proc, a, b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/transform
	}
	
	void example15() {
		
		// Generate.compute(Algebra algU, Procedure proc, IndexedDataSource a, U... inputs);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/generate
	}
	
	void example16() {
		
		// Replace.compute(Algebra algebra, U target, U replacement, IndexedDataSource storage);

		// ReplaceIf.compute(Algebra algebra, Predicate cond, U replacement, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/replace
	}
	
	void example17() {
		
		// ReplaceCopy.compute(Algebra algebra, U old_value, U new_value, IndexedDataSource a, IndexedDataSource b);
		
		// ReplaceCopyIf.compute(Algebra algebra, Predicate cond, U new_value, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/replace_copy
	}
	
	void example18() {
		
		// Swap.compute(Algebra alg, U a, U b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/swap
	}
	
	void example19() {
		
		// SwapRanges.compute(Algebra algebra, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/swap_ranges
	}
	
	void example20() {
		
		// Reverse.compute(Algebra algebra, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/reverse
	}
	
	void example21() {
		
		// ReverseCopy.compute(Algebra algebra, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/reverse_copy
	}
	
	void example22a() {
		
		// LeftRotate.compute(Algebra algebra, long delta, IndexedDataSource a);
		
		// RightRotate.compute(Algebra algebra, long delta, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/rotate
	}
	
	void example22b() {
		
		// RotateCopy.compute(Algebra algebra, long delta, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/rotate_copy
	}
	
	void example23() {
		
		// Shuffle.compute(Algebra algebra, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/random_shuffle
	}
	
	void example24() {
		
		// Sample.compute(Algebra algebra, long n, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/sample
	}
	
	void example25() {
		
		// Unique.compute(Algebra alg, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/unique
	}
	
	void example26() {
		
		// IsPartitioned.compute(Algebra algebra, Predicate cond, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/is_partitioned
	}
	
	void example27() {
		
		// Partition.compute(Algebra alg, Predicate cond, IndexedDataSource storage);

		//  see https://en.cppreference.com/w/cpp/algorithm/partition
	}
	
	void example28() {
		
		// StablePartition.compute(Algebra alg, Predicate cond, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/stable_partition
	}
	
	void example29() {
		
		// PartitionPoint.compute(Algebra alg, Predicate cond, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/partition_point
	}
	
	void example30() {
		
		// IsSorted.compute(Algebra alg, IndexedDataSource storage);
		
		// IsSorted.compute(Algebra alg, Function2 isLeftOf, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/is_sorted
	}
	
	void example31() {
		
		// IsSortedUntil.compute(Algebra alg, IndexedDataSource storage);
		
		// IsSortedUntil.compute(Algebra alg, Function2 isLeftOf, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/is_sorted_until
	}
	
	void example32() {
		
		// Sort.compute(Algebra alg, IndexedDataSource storage);
		
		// Sort.compute(Algebra alg, Function2 compare, IndexedDataSource storage);

		//  see https://en.cppreference.com/w/cpp/algorithm/sort
	}
	
	void example33() {
		
		// StableSort.compute(Algebra alg, IndexedDataSource storage);
		
		// StableSort.compute(Algebra alg, Function2 lessOrEqual, IndexedDataSource storage);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/stable_sort
	}
	
	void example34() {
		
		// LowerBound.compute(Algebra alg, U val, IndexedDataSource a);
		
		// LowerBound.compute(Algebra alg, U val, Predicate> isLess, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/lower_bound
	}
	
	void example35() {
	
		// UpperBound.compute(Algebra alg, U val, IndexedDataSource a);
		
		// UpperBound.compute(Algebra alg, U val, Predicate> isLess, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/upper_bound
	}
	
	void example36() {
		
		// BinarySearch.compute(Algebra algebra, U value, IndexedDataSource data);
		
		// BinarySearchLeft.compute(Algebra algebra, U value, IndexedDataSource data);
		
		// BinarySearchRight.compute(Algebra algebra, U value, IndexedDataSource data);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/binary_search
	}
	
	void example37() {
		
		// EqualRange.compute(Algebra alg, U val, IndexedDataSource a);
		
		// EqualRange.compute(Algebra alg, U val, Predicate> isLess, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/equal_range
	}
	
	void example38() {
		
		// Merge.compute(Algebra alg, IndexedDataSource a, IndexedDataSource b, IndexedDataSource c);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/merge
	}
	
	void example39() {
		
		// Includes.compute(Algebra alg, IndexedDataSource list, IndexedDataSource sublist);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/includes
	}
	
	void example40() {
		
		// SetDifference.compute(Algebra alg, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/set_difference
	}
	
	void example41() {
		
		// SetIntersection.compute(Algebra alg, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/set_intersection
	}
	
	void example42() {
		
		// SetSymmetricDifference.compute(Algebra alg, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/set_symmetric_difference
	}
	
	void example43() {
		
		// SetUnion.compute(Algebra alg, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/set_union
	}
	
	void example44() {
		
		// Max.compute(Algebra algebra, U a, U b, U result);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/max
	}
	
	void example45() {
		
		// MaxElement.compute(Algebra algebra, IndexedDataSource storage, U max);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/max_element
	}
	void example46() {
		
		// Min.compute(Algebra algebra, U a, U b, U result);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/min
	}
	
	void example47() {
		
		// MinElement.compute(Algebra algebra, IndexedDataSource storage, U max);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/min_element
	}
	void example48() {
		
		// MinMax.compute(Algebra algebra, U a, U b, U min, U max);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/minmax
	}
	
	void example49() {
	
		// MinMaxElement.compute(Algebra algebra, IndexedDataSource storage, U min, U max);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/minmax_element
	}
	
	void example50() {
		
		// Clamp.compute(Algebra algebra, U min, U max, U value, U result);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/clamp
	}
	
	void example51() {
		
		// Equal.compute(Algebra algebra, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/equal
	}
	
	void example52() {
		
		// LexicographicalCompare.compute(Algebra alg, IndexedDataSource a, IndexedDataSource b);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/lexicographical_compare
	}
	
	void example53() {
		
		// NextPermutation.compute(Algebra alg, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/next_permutation
	}
	
	void example54() {
		
		// PrevPermutation.compute(Algebra alg, IndexedDataSource a);
		
		//  see https://en.cppreference.com/w/cpp/algorithm/prev_permutation
	}
}