Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open class Letter(hash: BigInteger, var lineHeight: Int) {
- var pixels: Int = countBinaryOnes(hash)
- var hash: BigInteger = hash
- set(value) {
- pixels = countBinaryOnes(hash)
- field = value
- }
- }
- class DeterminedLetter(val char: Char, hash: BigInteger, lineHeight: Int): Letter(hash, lineHeight) {
- private class Params(val char: Char, val hash: BigInteger, val lineHeight: Int)
- private constructor(params: Params): this(params.char, params.hash, params.lineHeight)
- constructor(line: String): this(constructFromString(line))
- constructor(char: Char, letter: Letter): this(char, letter.hash, letter.lineHeight)
- companion object {
- private fun constructFromString(line: String): Params {
- val pair = line.split(',')
- val char = pair[0].toInt().toChar()
- val lineHeight = pair[1].toInt()
- val hash = pair[2].toBigInteger()
- return Params(char, hash, lineHeight)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement