|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object viper.descriptors.attributes.FrameSpan
This class represents the numeric span of frames in a video, consisting of the beginning and end frame and a bitmask on all frames in between, as well as several actions upon them, such as intersection, union, and size. Frame indexes cannot fall below zero.
Nested Class Summary |
Nested classes inherited from class viper.filters.Filterable |
Filterable.Rule |
Nested classes inherited from class viper.descriptors.attributes.Measurable |
Measurable.Difference |
Field Summary | |
static double |
alpha
The factor used to apply to the extents distance exponent when converting it from an unbounded number to the range from zero to one. |
Fields inherited from interface viper.descriptors.attributes.Composable |
ORDERED, UNORDERED |
Constructor Summary | |
FrameSpan()
Default constructor; returns an empty framespan. |
|
FrameSpan(int start,
int finish)
Initializes a new FrameSpan with specified bounds. |
Method Summary | |
int |
beginning()
Returns the index of the first frame of this FrameSpan. |
void |
clear(int frameNumber)
Clears the specified frame. |
void |
clear(int start,
int stop)
Removes all frames in the range start to stop, inclusive. |
java.lang.Object |
clone()
Returns a copy of the FrameSpan. |
boolean |
coincide(FrameSpan other,
int tolerance)
Determines if this span and another's bounds are within a certain tolerance |
Composable |
compose(Composable partner)
Generate the composition of this object with its partner. |
boolean |
containsFrame(int frameNumber)
Tests to see if a given frame is contained in this FrameSpan. |
Filterable.Rule |
convertRule(java.lang.String unparsedRule,
java.util.List unparsedValues,
ErrorWriter err)
This converts a string into a rule, writing out errors in the format to err . |
int |
ending()
Returns the index of the end frame of this FrameSpan. |
boolean |
equals(FrameSpan other)
Tests the equality of two FrameSpans. |
int |
extents(FrameSpan other)
Returns the sum of the absolute values of the differences between the beginning and ending points of this FrameSpan object and another. |
int |
getCompositionType()
Get the type of composition to try. |
Measurable.Difference |
getDifference(Measurable beta,
Measurable blackout,
Measurable ignore,
CanonicalFileDescriptor cfd)
Not optimized version. |
Measurable.Difference |
getDifference(Measurable beta,
Measurable blackout,
Measurable ignore,
CanonicalFileDescriptor cfd,
Measurable.Difference old)
For performance reasons, takes an optional (could be null) Measurable.Difference to replace the data from. |
java.lang.String |
getType()
Gets the type name. |
int |
hashCode()
Gets the hash code as the xor of the first and last frames, and the internal bit mask. |
FrameSpan |
intersect(FrameSpan other)
Returns the span that is shared between this and the other. |
boolean |
intersects(FrameSpan other)
Tests to see if this span intersects with the other. |
void |
intersectWith(FrameSpan other)
Removes all frames in this frame span not present in the other frame span. |
boolean |
isContiguous()
Determines if the span is contiguous. |
boolean |
isEmpty()
Tests to see if there are any frames in this frame span. |
boolean |
isValidRule(java.lang.String ruleName)
Tell if a name is a valid rule or not |
FrameSpan |
minus(FrameSpan other)
Returns this span withou any frames in the other. |
int |
numFrames()
Counts the number of active frames in this FrameSpan. |
double |
overlap(FrameSpan other)
Calculates the overlap of another FrameSpan with this one. |
static FrameSpan |
parseFrameSpan(java.lang.String S)
Reads a String in and parses it. |
boolean |
passes(Filterable.Rule rule)
Tests to see if the value passes the given rule. |
void |
set(int frameNumber)
Sets the specified frame to active. |
void |
shift(int offset)
Shifts all frames by the specified offset. |
int |
size()
Returns the total number of frames included in the span. |
java.util.List |
split()
Returns a list of non-adjacent, individually contiguous FrameSpan objects from a single disjoint framespan. |
java.lang.String |
toString()
Returns a String representing the FrameSpan. |
FrameSpan |
union(FrameSpan other)
Returns the span that is shared between the first beginning and the last end. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static double alpha
Constructor Detail |
public FrameSpan()
public FrameSpan(int start, int finish)
start
- the index of the first framefinish
- the index of the last frameMethod Detail |
public boolean isEmpty()
public int hashCode()
public boolean equals(FrameSpan other)
other
- the span to compare with
public boolean intersects(FrameSpan other)
this
span intersects with the other.
other
- the span to check
true
if there is a shared framepublic FrameSpan intersect(FrameSpan other)
|---------- ---| |---- -----| becomes: |-- - -|
other
- The FrameSpan that this is to be intersected with.
public FrameSpan minus(FrameSpan other)
|---------- ---| |---- -----| becomes: |------| H
other
- The FrameSpan to remove from this
other
and calling clear(int)
for each
valid frame.public void intersectWith(FrameSpan other)
other
- the span to intersect withpublic FrameSpan union(FrameSpan other)
|---- ----- - --| |-- --- ----| becomes: |---- ----- --------|and
|---------| |----------| becomes: |---------- -----------|
other
- -
the FrameSpan that this is to be unioned with
public void shift(int offset)
offset
- the number of frames to shift the span by
java.lang.IndexOutOfBoundsException
- if there is a negative framepublic int size()
ending
-
beginning
+ 1).public java.lang.Object clone()
public java.lang.String toString()
public static FrameSpan parseFrameSpan(java.lang.String S) throws BadDataException
Start Frame
:End Frame
, eg "1:1" or
"10:1000". Please note that you might have to write your own parse
function to read the toString
method's output,
probably by using a StringTokenizer or the
like
.
S
- the FrameSpan string. Must be in the form ##:##
BadDataException
- if the data is malformedpublic boolean coincide(FrameSpan other, int tolerance)
other
- FrameSpan to compare this FrameSpan with.tolerance
- Integer value representing the number of frames each
terminating frame is allowed from truth.
true
if they are within the tolerance.public double overlap(FrameSpan other)
other
- The FrameSpan to compare this with.
public int numFrames()
public boolean containsFrame(int frameNumber)
frameNumber
- The index to find.
true
if the frame is set.public int extents(FrameSpan other)
other
- The FrameSpan to compare with this.
public int ending()
public int beginning()
public void set(int frameNumber)
frameNumber
- the index of the frame to set. If out of this FrameSpan's
boundary, it will increase in size to accomidate.
java.lang.IndexOutOfBoundsException
- if the frame is negativepublic boolean isContiguous()
true
if the span contains all frames in its extentpublic java.util.List split()
public void clear(int start, int stop)
start
- the first frame to removestop
- the last frame to removepublic void clear(int frameNumber)
frameNumber
- resets the specified framepublic Filterable.Rule convertRule(java.lang.String unparsedRule, java.util.List unparsedValues, ErrorWriter err) throws BadDataException
Filterable
err
.
convertRule
in interface Filterable
unparsedRule
- A string containing a single rule.unparsedValues
- A string containing values.err
- A place to log the errors.
BadDataException
public boolean isValidRule(java.lang.String ruleName)
Filterable
isValidRule
in interface Filterable
ruleName
- the name of the rule
public int getCompositionType()
Composable
getCompositionType
in interface Composable
Composable.UNORDERED
public java.lang.String getType()
Measurable
getType
in interface Measurable
public Measurable.Difference getDifference(Measurable beta, Measurable blackout, Measurable ignore, CanonicalFileDescriptor cfd) throws IgnoredValueException
Measurable
getDifference (..., null)
.
getDifference
in interface Measurable
beta
- the value to subtract/get the difference fromblackout
- the bad regionignore
- the ignored regioncfd
- the media's information
IgnoredValueException
- if this and beta are totally ignoredMeasurable.getDifference(Measurable, Measurable, Measurable,
CanonicalFileDescriptor, Measurable.Difference)
public Measurable.Difference getDifference(Measurable beta, Measurable blackout, Measurable ignore, CanonicalFileDescriptor cfd, Measurable.Difference old) throws IgnoredValueException
Measurable
getDistance (alpha, beta, blackout, ignore)
should
have the same effect as
getDistance (alpha.getDifference (beta, blackout, ignore))
(Except for if alpha is null... then it will use
Distances.DefaultDifference
getDifference
in interface Measurable
beta
- the difference to get againstblackout
- the measurable to count as badignore
- the measurable region to ignorecfd
- the media file descriptorold
- an old difference to copy into, if possible, like the array
passed to list.toArray()
IgnoredValueException
- if everything is ignoredpublic Composable compose(Composable partner) throws java.lang.ClassCastException
Composable
compose
in interface Composable
partner
-
java.lang.ClassCastException
public boolean passes(Filterable.Rule rule)
Filterable
passes
in interface Filterable
rule
- the rule to check this value against
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |