Package dev.roanh.cpqindex
Interface ProgressListener
- All Known Implementing Classes:
ProgressListener.StreamListener
public interface ProgressListener
Interface for index construction progress listeners.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Progress listener that logs to a print stream all events except for intermediate updates, which are printed to standard out. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ProgressListener
Default listener that logs all events to standard out.static final ProgressListener
Default listener that ignores all events. -
Method Summary
Modifier and TypeMethodDescriptionvoid
computeBlocksEnd
(int k) Called when blocks are done being computed for a new index layer.void
computeBlocksStart
(int k) Called when blocks are being computed for a new index layer.void
coresBlocksDone
(int done, int total) Intermediate core computation progress update.void
coresEnd
(int k) Called when cores for a new layer are done being computed.void
coresStart
(int k) Called when cores for a new layer start being computed.static ProgressListener
Constructs a new progress listener that logs all events to the given file and to Discord.static ProgressListener
Constructs a new progress listener that logs all event to the given file.void
intermediateProgress
(long cores, int blockDone, int totalBlocks) Logs and intermediate progress update.void
mapEnd()
Called when mapping cores to blocks is done.void
mapStart()
Called when mapping cores to blocks starts.void
partitionCombinationEnd
(int k1, int k2) Called when partitions are constructed from two previous blocks from a different layer (end).void
partitionCombinationStart
(int k1, int k2) Called when partitions are constructed from two previous blocks from a different layer (start).void
partitionEnd
(int k) Called when graph partitioning for a new layer ends.void
partitionStart
(int k) Called when graph partitioning for a new layer starts.static ProgressListener
stream
(PrintStream out) Constructs a new progress listener that logs all event to the given print stream.
-
Field Details
-
LOG
Default listener that logs all events to standard out. -
NONE
Default listener that ignores all events.
-
-
Method Details
-
partitionStart
void partitionStart(int k) Called when graph partitioning for a new layer starts.- Parameters:
k
- The diameter for the layer being partitioned.
-
partitionCombinationStart
void partitionCombinationStart(int k1, int k2) Called when partitions are constructed from two previous blocks from a different layer (start).- Parameters:
k1
- The diameter of the first block.k2
- The diameter of the second block.
-
partitionCombinationEnd
void partitionCombinationEnd(int k1, int k2) Called when partitions are constructed from two previous blocks from a different layer (end).- Parameters:
k1
- The diameter of the first block.k2
- The diameter of the second block.
-
partitionEnd
void partitionEnd(int k) Called when graph partitioning for a new layer ends.- Parameters:
k
- The diameter for the layer that was partitioned.
-
computeBlocksStart
void computeBlocksStart(int k) Called when blocks are being computed for a new index layer.- Parameters:
k
- The diameter for the layer that blocks are being computed for.
-
computeBlocksEnd
void computeBlocksEnd(int k) Called when blocks are done being computed for a new index layer.- Parameters:
k
- The diameter for the layer that blocks were computed for.
-
coresStart
void coresStart(int k) Called when cores for a new layer start being computed.- Parameters:
k
- The diameter for the layer cores are computed for.
-
coresBlocksDone
void coresBlocksDone(int done, int total) Intermediate core computation progress update.- Parameters:
done
- Total number of computed blocks.total
- The number of blocks to compute in total.
-
coresEnd
void coresEnd(int k) Called when cores for a new layer are done being computed.- Parameters:
k
- The diameter for the layer cores were computed for.
-
mapStart
void mapStart()Called when mapping cores to blocks starts. -
mapEnd
void mapEnd()Called when mapping cores to blocks is done. -
intermediateProgress
void intermediateProgress(long cores, int blockDone, int totalBlocks) Logs and intermediate progress update.- Parameters:
cores
- The total number of cores computed so far.blockDone
- The total number of blocks done.totalBlocks
- THe total number of blocks.
-
stream
Constructs a new progress listener that logs all event to the given print stream. Intermediate updates are still printed to standard out.- Parameters:
out
- The print stream to log to.- Returns:
- The constructed progress listener.
-
file
Constructs a new progress listener that logs all event to the given file.- Parameters:
logFile
- The name of the file to log to.- Returns:
- The constructed progress listener.
- Throws:
IOException
- When an IOException occurs.
-
discord
static ProgressListener discord(String logFile, String webhookUrl) throws IOException, URISyntaxException Constructs a new progress listener that logs all events to the given file and to Discord. Block updates are not logged to Discord and intermediate updates are not logged to the file and also printed to standard out.- Parameters:
logFile
- The name of the file to log to.webhookUrl
- The Discord webhook to log to.- Returns:
- The constructed progress listener.
- Throws:
IOException
- When an IOException occurs.URISyntaxException
- When the URI is invalid.
-