Class Transcript
java.lang.Object
ca.phon.extensions.ExtendableObject
ca.phon.session.Transcript
- All Implemented Interfaces:
IExtendable
,Visitable<Transcript.Element>
,Iterable<Transcript.Element>
public final class Transcript
extends ExtendableObject
implements Iterable<Transcript.Element>, Visitable<Transcript.Element>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Wrapper object for transcript elements including Comments, Gems and Records -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(Visitor<Transcript.Element> visitor) Accept the given visitor.void
addComment
(int elementIndex, Comment comment) Add new comment at the given element index.void
addComment
(Comment comment) Add a new comment to end of the transcriptvoid
addElement
(int idx, Transcript.Element element) Add element and insert at specified location.void
addElement
(Transcript.Element element) Add element to end of listvoid
Add gem at given position in transcriptvoid
Add a new gem to the end of the transcriptvoid
Add a new record to the list in the given position.void
Add a new record to the sessionint
findBeginGem
(String label) Return element index for start of given gem labelint
findEndGem
(String label) Return element index for end of given gem labelint
findLazyGem
(String label) Return element index for lazy gem with given labelgetElementAt
(int idx) Get element at specified indexint
getElementIndex
(Comment comment) Return the element indexint
getElementIndex
(Gem gem) Return the element indexint
Return the element indexint
Return the element indexint
Get number of transcript elementsgetRecord
(int recordIndex) Return the record at the given index.int
Return the number of records.int
getRecordElementIndex
(int recordIndex) Get index of recordint
getRecordIndex
(int elementIndex) Get the record index of the given element index or the highest record indexint
getRecordIndex
(Record record) Get the record index of the given record.iterator()
removeComment
(Comment comment) Remove given commentremoveElement
(int idx) Remove element at specified indexvoid
removeElement
(Transcript.Element element) Remove specified element from transcriptremoveRecord
(int recordIndex) Remove a record from the sessionvoid
removeRecord
(Record record) Remove a record from the session.void
setRecordIndex
(Record record, int recordIndex) Set the position of the given record.stream()
stream
(boolean parallel) Methods inherited from class ca.phon.extensions.ExtendableObject
getExtension, getExtensions, putExtension, removeExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getNumberOfElements
public int getNumberOfElements()Get number of transcript elements- Returns:
- number of comments and records
-
getElementAt
Get element at specified index- Parameters:
idx
-- Returns:
- element at given index
- Throws:
ArrayIndexOutOfBoundsException
-
addElement
-
addElement
Add element and insert at specified location.- Parameters:
idx
-element
-- Throws:
ArrayIndexOutOfBoundsException
-
removeElement
Remove specified element from transcript- Parameters:
element
-
-
removeElement
Remove element at specified index- Parameters:
idx
-- Returns:
- session element that was removed
- Throws:
ArrayIndexOutOfBoundsException
-
getElementIndex
Return the element index- Parameters:
ele
-- Returns:
- element index in transcript or -1 if not found
-
getElementIndex
Return the element index- Parameters:
r
-- Returns:
- element index in transcript or -1 if not found
-
getElementIndex
Return the element index- Parameters:
comment
-- Returns:
- element index in transcript or -1 if not found
-
getElementIndex
Return the element index- Parameters:
gem
-- Returns:
- element index in transcript or -1 if not found
-
addComment
Add a new comment to end of the transcript- Parameters:
comment
-
-
addComment
Add new comment at the given element index. Note this is different from asRecord(int recordIndex, Record record) which is a helper function to insert a record at the correct location between comments and records.- Parameters:
elementIndex
-comment
-
-
removeComment
-
addGem
-
addGem
Add gem at given position in transcript- Parameters:
elementIndex
-gem
-
-
removeGem
-
findBeginGem
Return element index for start of given gem label- Parameters:
label
-- Returns:
- element index of BeginGem (@Bg) or -1 if not found
-
findEndGem
Return element index for end of given gem label- Parameters:
label
-- Returns:
- element index of EndGem (@Eg) or -1 if not found
-
findLazyGem
Return element index for lazy gem with given label- Parameters:
label
-- Returns:
- element index of EndGem (@Eg) or -1 if not found
-
addRecord
-
getRecordElementIndex
public int getRecordElementIndex(int recordIndex) Get index of record- Parameters:
recordIndex
-- Returns:
- element index of record, or -1 if not found
-
getRecordIndex
public int getRecordIndex(int elementIndex) Get the record index of the given element index or the highest record index- Parameters:
elementIndex
-
-
addRecord
Add a new record to the list in the given position.- Parameters:
recordIndex
-record
-- Throws:
ArrayIndexOutOfBoundsException
-
removeRecord
-
removeRecord
Remove a record from the session- Parameters:
recordIndex
-- Throws:
ArrayIndexOutOfBoundsException
-
getRecord
Return the record at the given index.- Parameters:
recordIndex
-- Returns:
- the specified record
- Throws:
ArrayIndexOutOfBoundsException
-
getRecordCount
public int getRecordCount()Return the number of records.- Returns:
- the number of records
-
getRecordIndex
Get the record index of the given record.- Parameters:
record
-- Returns:
- record index or -1 if not found
-
setRecordIndex
Set the position of the given record. This will remove the record from the element list and then re-add it at the requested record index- Parameters:
record
-recordIndex
-- Throws:
ArrayIndexOutOfBoundsException
-
accept
Description copied from interface:Visitable
Accept the given visitor.- Specified by:
accept
in interfaceVisitable<Transcript.Element>
-
iterator
- Specified by:
iterator
in interfaceIterable<Transcript.Element>
-
stream
-
stream
-