hashcode-utils-kt
Module Contents
alltypes
Module Contents
class
FileParsingException
:
RuntimeException
Module Contents
FileParsingException
(
filePath
:
Path
,
cause
:
Exception
)
class
HCReader
:
Closeable
Module Contents
HCReader
(
reader
:
Reader
,
tokenDelimiter
:
Regex
=
DEFAULT_HASHCODE_INPUT_DELIMITER
)
fun
close
(
)
:
Unit
val
lineNumber
:
Int
fun
nextLineText
(
)
:
String
fun
nextLineTokens
(
)
:
List
<
String
>
fun
readBoolean
(
)
:
Boolean
fun
readDouble
(
)
:
Double
fun
readInt
(
)
:
Int
fun
readString
(
)
:
String
fun
skip
(
n
:
Int
=
1
)
:
Unit
class
IncompleteInputReadException
:
InputParsingException
Module Contents
IncompleteInputReadException
(
lineNumber
:
Int
,
nextTokenIndex
:
Int
)
class
IncompleteLineReadException
:
InputParsingException
Module Contents
IncompleteLineReadException
(
lineNum
:
Int
,
unreadEndOfLine
:
String
)
open
class
InputParsingException
:
RuntimeException
Module Contents
InputParsingException
(
message
:
String
)
InputParsingException
(
message
:
String
,
cause
:
Throwable
)
InputParsingException
(
lineNum
:
Int
,
tokenNum
:
Int
,
message
:
String
)
class
NoMoreLinesToReadException
:
InputParsingException
Module Contents
NoMoreLinesToReadException
(
)
class
SolutionWritingException
:
Exception
Module Contents
SolutionWritingException
(
msg
:
String
,
cause
:
Throwable
)
enum
class
UncaughtExceptionsLogger
Module Contents
NOOP
SLF4J
STDERR
STDERR_AND_SLF4J
package
org.hildan.hashcode.utils
Module Contents
fun
computeHCOutputPath
(
inputPath
:
Path
)
:
Path
suspend
fun
solveHCFilesInParallel
(
vararg
filenames
:
String
,
exceptionsLogger
:
UncaughtExceptionsLogger
=
UncaughtExceptionsLogger.STDERR
,
remindExceptionsAtTheEnd
:
Boolean
=
true
,
readAndSolve
:
suspend
HCReader
.
(
)
->
Iterable
<
CharSequence
>
)
:
Unit
inline
fun
solveHCProblemAndWriteFile
(
inputFilePath
:
Path
,
outputFilePath
:
Path
=
computeHCOutputPath(inputFilePath)
,
readAndSolve
:
HCReader
.
(
)
->
Iterable
<
CharSequence
>
)
:
Unit
package
org.hildan.hashcode.utils.reader
Module Contents
val
DEFAULT_HASHCODE_INPUT_DELIMITER
:
Regex
class
FileParsingException
:
RuntimeException
Module Contents
FileParsingException
(
filePath
:
Path
,
cause
:
Exception
)
class
HCReader
:
Closeable
Module Contents
HCReader
(
reader
:
Reader
,
tokenDelimiter
:
Regex
=
DEFAULT_HASHCODE_INPUT_DELIMITER
)
fun
close
(
)
:
Unit
val
lineNumber
:
Int
fun
nextLineText
(
)
:
String
fun
nextLineTokens
(
)
:
List
<
String
>
fun
readBoolean
(
)
:
Boolean
fun
readDouble
(
)
:
Double
fun
readInt
(
)
:
Int
fun
readString
(
)
:
String
fun
skip
(
n
:
Int
=
1
)
:
Unit
class
IncompleteInputReadException
:
InputParsingException
Module Contents
IncompleteInputReadException
(
lineNumber
:
Int
,
nextTokenIndex
:
Int
)
class
IncompleteLineReadException
:
InputParsingException
Module Contents
IncompleteLineReadException
(
lineNum
:
Int
,
unreadEndOfLine
:
String
)
open
class
InputParsingException
:
RuntimeException
Module Contents
InputParsingException
(
message
:
String
)
InputParsingException
(
message
:
String
,
cause
:
Throwable
)
InputParsingException
(
lineNum
:
Int
,
tokenNum
:
Int
,
message
:
String
)
class
NoMoreLinesToReadException
:
InputParsingException
Module Contents
NoMoreLinesToReadException
(
)
inline
fun
<
P
>
withHCReader
(
input
:
String
,
tokenDelimiter
:
Regex
=
DEFAULT_HASHCODE_INPUT_DELIMITER
,
readProblem
:
HCReader
.
(
)
->
P
)
:
P
inline
fun
<
P
>
withHCReader
(
path
:
Path
,
tokenDelimiter
:
Regex
=
DEFAULT_HASHCODE_INPUT_DELIMITER
,
readProblem
:
HCReader
.
(
)
->
P
)
:
P
package
org.hildan.hashcode.utils.runner
Module Contents
suspend
fun
<
I
>
runInParallel
(
vararg
inputs
:
I
,
exceptionsLogger
:
UncaughtExceptionsLogger
=
UncaughtExceptionsLogger.STDERR
,
remindExceptionsAtTheEnd
:
Boolean
=
true
,
block
:
suspend
(
I
)
->
Unit
)
:
Unit
enum
class
UncaughtExceptionsLogger
Module Contents
NOOP
SLF4J
STDERR
STDERR_AND_SLF4J
package
org.hildan.hashcode.utils.writer
Module Contents
class
SolutionWritingException
:
Exception
Module Contents
SolutionWritingException
(
msg
:
String
,
cause
:
Throwable
)
fun
writeHCOutputFile
(
path
:
Path
,
lines
:
Iterable
<
CharSequence
>
)
:
Unit