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 classWrapper object for transcript elements including Comments, Gems and Records -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Visitor<Transcript.Element> visitor) Accept the given visitor.voidaddComment(int elementIndex, Comment comment) Add new comment at the given element index.voidaddComment(Comment comment) Add a new comment to end of the transcriptvoidaddElement(int idx, Transcript.Element element) Add element and insert at specified location.voidaddElement(Transcript.Element element) Add element to end of listvoidAdd gem at given position in transcriptvoidAdd a new gem to the end of the transcriptvoidAdd a new record to the list in the given position.voidAdd a new record to the sessionintfindBeginGem(String label) Return element index for start of given gem labelintfindEndGem(String label) Return element index for end of given gem labelintfindLazyGem(String label) Return element index for lazy gem with given labelgetElementAt(int idx) Get element at specified indexintgetElementIndex(Comment comment) Return the element indexintgetElementIndex(Gem gem) Return the element indexintReturn the element indexintReturn the element indexintGet number of transcript elementsgetRecord(int recordIndex) Return the record at the given index.intReturn the number of records.intgetRecordElementIndex(int recordIndex) Get index of recordintgetRecordIndex(int elementIndex) Get the record index of the given element index or the highest record indexintgetRecordIndex(Record record) Get the record index of the given record.iterator()removeComment(Comment comment) Remove given commentremoveElement(int idx) Remove element at specified indexvoidremoveElement(Transcript.Element element) Remove specified element from transcriptremoveRecord(int recordIndex) Remove a record from the sessionvoidremoveRecord(Record record) Remove a record from the session.voidsetRecordIndex(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, removeExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:VisitableAccept the given visitor.- Specified by:
acceptin interfaceVisitable<Transcript.Element>
-
iterator
- Specified by:
iteratorin interfaceIterable<Transcript.Element>
-
stream
-
stream
-