Trait lipsi::SetOperations [] [src]

pub trait SetOperations {
    fn complement(&self) -> Self;
    fn retrograde(&self) -> Self;
    fn sort(&self) -> Self;
    fn rotate(&self, _: usize) -> Self;
    fn zero(&self) -> Self;
    fn normal(&self) -> Self;
    fn reduced(&self) -> Self;
    fn prime(&self) -> Self;
    fn intervals(&self) -> Vec<i8>;
    fn transposition_number(&self, other: &Self) -> Option<i8>;
    fn index_number(&self, other: &Self) -> Option<i8>;
}

Required Methods

Returns the complement of the pitch-class set

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.complement(), vec![0,4,5,6,7,8,9,10,11]);

Returns the retrograde of the pitch-class set

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.retrograde(), vec![3,2,1]);

Returns the sorted pitch-class set in ascending order

Examples

use lipsi::*;

let pcset: PcSet = vec![3,2,1];
assert_eq!(pcset.sort(), vec![1,2,3]);

Returns the rotation of the pitch-class set by n semitones

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.rotate(4), vec![3,1,2]);

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.zero(), vec![0,1,2]);

Returns the normal form of the pitch-class set

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.normal(), vec![1,2,3]);

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.reduced(), vec![0,1,2]);

Returns the prime form of the pitch-class set

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.prime(), vec![0,1,2]);

Helper function that returns a vector containing the interval-classes for the first and n to last pitch-class in a pitch-class set

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
assert_eq!(pcset.intervals(), vec![2,1,0]);

Returns the transposition number of two pitch-class sets if they are related by transposition

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
let other: PcSet = vec![5,6,7];
assert_eq!(pcset.transposition_number(&other), Some(4));

Returns the index number of two pitch-class sets if they are related by inversion

Examples

use lipsi::*;

let pcset: PcSet = vec![1,2,3];
let other: PcSet = vec![3,2,1];
assert_eq!(pcset.index_number(&other), Some(4));

Implementors