|
AVPKit
|


Public Member Functions | |
| virtual IRational * | copy () |
| Creates a new IRational object by copying (by value) this object. More... | |
| virtual int32_t | getNumerator () |
| Get the numerator for this rational. More... | |
| virtual int32_t | getDenominator () |
| Get the denominator for this rational. More... | |
| virtual int32_t | compareTo (IRational *other) |
| Compare a rational to this rational. More... | |
| virtual double | getDouble () |
| Rational to double conversion. More... | |
| virtual int32_t | reduce (int64_t num, int64_t den, int64_t max) |
| Reduce a fraction to it's lowest common denominators. More... | |
| virtual IRational * | multiply (IRational *arg) |
| Multiplies this number by arg. More... | |
| virtual IRational * | divide (IRational *arg) |
| Divides this rational by arg. More... | |
| virtual IRational * | subtract (IRational *arg) |
| Subtracts arg from this rational. More... | |
| virtual IRational * | add (IRational *arg) |
| Adds arg to this rational. More... | |
| virtual int64_t | rescale (int64_t origValue, IRational *origBase) |
| Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this Rational. More... | |
| virtual int64_t | rescale (int64_t origValue, IRational *origBase, Rounding rounding) |
| Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this Rational. More... | |
| virtual void | setNumerator (int32_t value) |
| Sets the numerator on this object. More... | |
| virtual void | setDenominator (int32_t value) |
| Sets the denominator on this object. More... | |
| virtual void | setValue (double value) |
| Sets the numerator and denominator on this object by reducing the double to the closest integer numerator and denominator. More... | |
| virtual double | getValue () |
| An alias for getDouble() but matching JavaBean conventions. More... | |
| virtual bool | isFinalized () |
| Returns true if init() has been called and this object is now considered finalized and immutable. More... | |
| virtual void | init () |
| Marks this object as finalized and immutable. More... | |
Public Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual int32_t | acquire () |
| Internal Only. More... | |
| virtual int32_t | release () |
| Internal Only. More... | |
| virtual RefCounted * | copyReference () |
| Create a new Java object that refers to the same native object. More... | |
| virtual int32_t | getCurrentRefCount () |
| Return the current reference count on this object. More... | |
| void | setJavaAllocator (void *allocator) |
| This method is public but not part of the standard API. More... | |
| void * | getJavaAllocator () |
| This method is public but not part of the standard API. More... | |
Static Public Member Functions | |
| static Rational * | make (double d) |
| Converts a double precision floating point number to a rational. More... | |
| static Rational * | make (AVRational *src) |
| Create a Rational from an AVRational struct. More... | |
| static Rational * | make (Rational *src) |
| Creates copy of a Rational from another Rational. More... | |
| static Rational * | make (int32_t num, int32_t den) |
| Create a rational from a numerator and denominator. More... | |
| static int64_t | rescale (int64_t srcValue, int32_t dstNumerator, int32_t dstDenominator, int32_t srcNumerator, int32_t srcDenominator, Rounding rounding) |
Static Public Member Functions inherited from com::avpkit::core::IRational | |
| static int32_t | sCompareTo (IRational *a, IRational *b) |
| Compare two rationals. More... | |
| static int32_t | sReduce (IRational *dst, int64_t num, int64_t den, int64_t max) |
| Reduce a fraction to it's lowest common denominators. More... | |
| static IRational * | sMultiply (IRational *a, IRational *b) |
| Multiples a by b. More... | |
| static IRational * | sDivide (IRational *a, IRational *b) |
| Divides a by b. More... | |
| static IRational * | sSubtract (IRational *a, IRational *b) |
| Subtracts a from b. More... | |
| static IRational * | sAdd (IRational *a, IRational *b) |
| Adds a to b. More... | |
| static int64_t | sRescale (int64_t origValue, IRational *origBase, IRational *newBase) |
| Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this Rational. More... | |
| static IRational * | make () |
| Get a new rational that will be set to 0/0. More... | |
| static IRational * | make (double d) |
| Converts a double precision floating point number to a rational. More... | |
| static IRational * | make (IRational *src) |
| Creates deep copy of a Rational from another Rational. More... | |
| static IRational * | make (int32_t num, int32_t den) |
| Create a rational from a numerator and denominator. More... | |
| static int64_t | sRescale (int64_t origValue, IRational *origBase, IRational *newBase, Rounding rounding) |
| Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this Rational. More... | |
| static int64_t | rescale (int64_t srcValue, int32_t dstNumerator, int32_t dstDenominator, int32_t srcNumerator, int32_t srcDenominator, Rounding rounding) |
| Rescales a long value to another long value. More... | |
Additional Inherited Members | |
Public Types inherited from com::avpkit::core::IRational | |
| enum | Rounding { ROUND_ZERO = 0 , ROUND_INF = 1 , ROUND_DOWN = 2 , ROUND_UP = 3 , ROUND_NEAR_INF = 5 } |
| typedef enum com::avpkit::core::IRational::Rounding | Rounding |
Protected Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual void | destroy () |
| This method is called by RefCounted objects when their Ref Count reaches zero and they are about to be destroyed. | |
Protected Attributes inherited from com::avpkit::ferry::RefCounted | |
| AtomicInteger * | mRefCount |
| This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe. | |
| void * | mAllocator |
| Not part of public API. | |
Definition at line 29 of file Rational.h.
Adds arg to this rational.
| arg | The amount to add to this. |
Implements com::avpkit::core::IRational.
Definition at line 227 of file Rational.cpp.
References com::avpkit::core::IRational::make().
|
virtual |
Compare a rational to this rational.
| other | second rational |
Implements com::avpkit::core::IRational.
Definition at line 141 of file Rational.cpp.
|
virtual |
Creates a new IRational object by copying (by value) this object.
Implements com::avpkit::core::IRational.
Definition at line 92 of file Rational.cpp.
References com::avpkit::core::IRational::make().
Divides this rational by arg.
| arg | The divisor to use. |
Implements com::avpkit::core::IRational.
Definition at line 194 of file Rational.cpp.
References com::avpkit::core::IRational::make().
|
inlinevirtual |
Get the denominator for this rational.
Implements com::avpkit::core::IRational.
Definition at line 37 of file Rational.h.
|
virtual |
Rational to double conversion.
Implements com::avpkit::core::IRational.
Definition at line 151 of file Rational.cpp.
Referenced by getValue().
|
inlinevirtual |
Get the numerator for this rational.
Implements com::avpkit::core::IRational.
Definition at line 36 of file Rational.h.
|
virtual |
An alias for getDouble() but matching JavaBean conventions.
Implements com::avpkit::core::IRational.
Definition at line 71 of file Rational.cpp.
References getDouble().
|
virtual |
Marks this object as finalized and immutable.
Any setters called after the first init() call will be ignored.
Most make methods will call this method automatically, with the exception of the blank factory method make().
Implements com::avpkit::core::IRational.
Definition at line 41 of file Rational.cpp.
References reduce().
Referenced by make().
|
virtual |
Returns true if init() has been called and this object is now considered finalized and immutable.
Implements com::avpkit::core::IRational.
Definition at line 124 of file Rational.cpp.
|
static |
Create a Rational from an AVRational struct.
| src | The source AVRational object. |
Definition at line 77 of file Rational.cpp.
References init(), and com::avpkit::core::IRational::make().
|
static |
Converts a double precision floating point number to a rational.
| d | double to convert |
Definition at line 52 of file Rational.cpp.
References init(), com::avpkit::core::IRational::make(), and setValue().
|
static |
Create a rational from a numerator and denominator.
We will always reduce this to the lowest num/den pair we can, but never having den exceed what was passed in.
Definition at line 129 of file Rational.cpp.
References init(), com::avpkit::core::IRational::make(), setDenominator(), and setNumerator().
Creates copy of a Rational from another Rational.
Note: This is a NEW object. To just keep tabs on the original, use acquire() to keep a reference.
| src | The source Rational to copy. |
Definition at line 98 of file Rational.cpp.
References init(), and com::avpkit::core::IRational::make().
Multiplies this number by arg.
| arg | number to mulitply by. |
Implements com::avpkit::core::IRational.
Definition at line 177 of file Rational.cpp.
References com::avpkit::core::IRational::make().
|
virtual |
Reduce a fraction to it's lowest common denominators.
This is useful for framerate calculations.
| num | the src numerator. |
| den | the src denominator. |
| max | the maximum allowed for nom & den in the reduced fraction. |
Implements com::avpkit::core::IRational.
Definition at line 168 of file Rational.cpp.
Referenced by init().
|
virtual |
Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this Rational.
| origValue | The original int64_t value you care about. |
| origBase | The original base Rational that origValue is scaled with. |
Implements com::avpkit::core::IRational.
Definition at line 244 of file Rational.cpp.
Referenced by com::avpkit::core::IRational::rescale().
|
virtual |
Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this Rational.
| origValue | The original int64_t value you care about. |
| origBase | The original base Rational that origValue is scaled with. |
| rounding | How you want rounding to occur |
Implements com::avpkit::core::IRational.
Definition at line 257 of file Rational.cpp.
|
virtual |
Sets the denominator on this object.
If isFinalized is true, then this method is ignored.
Implements com::avpkit::core::IRational.
Definition at line 118 of file Rational.cpp.
Referenced by make().
|
virtual |
Sets the numerator on this object.
If isFinalized is true, then this method is ignored.
Implements com::avpkit::core::IRational.
Definition at line 112 of file Rational.cpp.
Referenced by make().
|
virtual |
Sets the numerator and denominator on this object by reducing the double to the closest integer numerator and denominator.
If isFinalized is true, then this method is ignored.
Implements com::avpkit::core::IRational.
Definition at line 64 of file Rational.cpp.
Referenced by make().
Subtracts arg from this rational.
| arg | The amount to subtract from this. |
Implements com::avpkit::core::IRational.
Definition at line 211 of file Rational.cpp.
References com::avpkit::core::IRational::make().