Class ChunkModel
- java.lang.Object
- 
- ghidra.framework.main.logviewer.model.ChunkModel
 
- 
- All Implemented Interfaces:
- java.lang.Iterable<Chunk>
 
 public class ChunkModel extends java.lang.Object implements java.lang.Iterable<Chunk> Stores all chunks read-in by theChunkReader. The model is responsible for handling all interaction with the list of chunks.
- 
- 
Field SummaryFields Modifier and Type Field Description intMAX_VISIBLE_CHUNKSintNUM_LINESlongselectedByteEndlongselectedByteStart
 - 
Constructor SummaryConstructors Constructor Description ChunkModel()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Chunk chunk)Adds a chunk at the given index to the model.voidadd(Chunk chunk)Adds the given chunk to the model.voidclear()Clears all chunks from the model.Chunkget(int index)Returns the chunk at the given index.PairgetFilePositionForRow(int row)Returns the start/end byte positions within the input file for the given row.intgetNumChunks()intgetRowForBytePos(long selectedByte)Searches the visible chunks to see if any of them contain the given byte.intgetSize()Returns the number of chunks in the model.java.util.Iterator<Chunk>iterator()Chunkremove(int index)Removes the chunk at the given index from the model.
 
- 
- 
- 
Field Detail- 
selectedByteStartpublic long selectedByteStart 
 - 
selectedByteEndpublic long selectedByteEnd 
 - 
NUM_LINESpublic final int NUM_LINES - See Also:
- Constant Field Values
 
 - 
MAX_VISIBLE_CHUNKSpublic final int MAX_VISIBLE_CHUNKS - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
addpublic void add(Chunk chunk) Adds the given chunk to the model.- Parameters:
- chunk-
 
 - 
addpublic void add(int index, Chunk chunk)Adds a chunk at the given index to the model.- Parameters:
- index-
- chunk-
 
 - 
removepublic Chunk remove(int index) Removes the chunk at the given index from the model.- Parameters:
- index-
 
 - 
clearpublic void clear() Clears all chunks from the model.
 - 
getSizepublic int getSize() Returns the number of chunks in the model.- Returns:
 
 - 
getpublic Chunk get(int index) Returns the chunk at the given index.- Parameters:
- index-
- Returns:
 
 - 
iteratorpublic java.util.Iterator<Chunk> iterator() - Specified by:
- iteratorin interface- java.lang.Iterable<Chunk>
 
 - 
getNumChunkspublic int getNumChunks() - Returns:
 
 - 
getFilePositionForRowpublic Pair getFilePositionForRow(int row) Returns the start/end byte positions within the input file for the given row. To do this we have to loop over all chunks in theChunkModeland count the number of lines in each chunk until we get to the line (row) we're looking for. We then grab the correct value from the byteMap for that chunk line, which is the starting byte for it.- Parameters:
- row-
- Returns:
- the byte position in the file this row corresponds to
 
 - 
getRowForBytePospublic int getRowForBytePos(long selectedByte) Searches the visible chunks to see if any of them contain the given byte. If so, returns the row in the table where it resides. Returns -1 otherwise.- Parameters:
- selectedByte-
- Returns:
 
 
- 
 
-