Package org.opensourcephysics.display
Class DataClip
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.display.DataClip
This defines a subset of data elements called steps. The steps are the
elements with array index that meets the conditions: 1. index >= startIndex
2. index <= startIndex + (clipLength-1)*stride 3. (index-startIndex) % stride
= 0.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the available clip length (step count).int
Gets the clip length (number of video frames on which the data is displayed unless limited by the video clip or stride).int
Gets the data length (number of data elements in the Data object).static XML.ObjectLoader
Returns an XML.ObjectLoader to save and load data for this class.int
Gets the start index.int
Gets the stride (number of data elements per step).boolean
includesIndex
(int n) Determines whether the specified index is a step index.int
indexToStep
(int index) Converts data index to step number.boolean
Gets the adjusting flag.void
setAdjusting
(boolean adjusting) Sets the adjusting flag.int
setClipLength
(int length) Sets the clip length (number of video frames on which the data is displayed).void
setDataLength
(int length) Sets the data length (number of data elements in the Data object).int
setStartIndex
(int start) Sets the start index.int
setStride
(int stride) Sets the stride (number of data elements per step).int
stepToIndex
(int stepNumber) Converts step number to data index.Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
PROPERTY_DATACLIP_CLIPLENGTH
- See Also:
-
PROPERTY_DATACLIP_STARTINDEX
- See Also:
-
PROPERTY_DATACLIP_CLIPSTRIDE
- See Also:
-
PROPERTY_DATACLIP_CLIPADJUSTING
- See Also:
-
-
Constructor Details
-
DataClip
public DataClip()
-
-
Method Details
-
setDataLength
public void setDataLength(int length) Sets the data length (number of data elements in the Data object).- Parameters:
length
- the data length
-
getDataLength
public int getDataLength()Gets the data length (number of data elements in the Data object).- Returns:
- the data length
-
setClipLength
public int setClipLength(int length) Sets the clip length (number of video frames on which the data is displayed). If the clip length is set to zero or less then it is reported as equal to the entire data length.- Parameters:
clipLength
- the desired clip length- Returns:
- the resulting clip length
-
getClipLength
public int getClipLength()Gets the clip length (number of video frames on which the data is displayed unless limited by the video clip or stride).- Returns:
- the clip length
-
setStartIndex
public int setStartIndex(int start) Sets the start index.- Parameters:
start
- the desired start index- Returns:
- the resulting start index
-
getStartIndex
public int getStartIndex()Gets the start index.- Returns:
- the start index
-
setStride
public int setStride(int stride) Sets the stride (number of data elements per step).- Parameters:
stride
- the desired stride- Returns:
- the resulting stride
-
getStride
public int getStride()Gets the stride (number of data elements per step).- Returns:
- the stride
-
getAvailableClipLength
public int getAvailableClipLength()Gets the available clip length (step count). A step is available if it's index is less than the data length. Available clip length <= clip length- Returns:
- the index
-
stepToIndex
public int stepToIndex(int stepNumber) Converts step number to data index.- Parameters:
stepNumber
- the step number- Returns:
- the data index
-
indexToStep
public int indexToStep(int index) Converts data index to step number. An index that falls between two steps maps to the previous step.- Parameters:
index
- the data index- Returns:
- the step number
-
includesIndex
public boolean includesIndex(int n) Determines whether the specified index is a step index.- Parameters:
n
- the index number- Returns:
true
if the index is a step index
-
setAdjusting
public void setAdjusting(boolean adjusting) Sets the adjusting flag.- Parameters:
adjusting
- true if adjusting
-
isAdjusting
public boolean isAdjusting()Gets the adjusting flag.- Returns:
- true if adjusting
-
getLoader
Returns an XML.ObjectLoader to save and load data for this class.- Returns:
- the object loader
-