Lab 5, started.
This commit is contained in:
parent
2b8f88a45f
commit
2ddeaab94f
|
@ -0,0 +1,11 @@
|
|||
package OOP.Java.lab_5
|
||||
|
||||
class Letter(val character: Char) {
|
||||
override fun toString(): String {
|
||||
return this.character.toString()
|
||||
}
|
||||
|
||||
fun equals(letter: Letter, ignoreCase: Boolean): Boolean {
|
||||
return this.character.toString().equals(letter.toString(), ignoreCase)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package OOP.Java.lab_5
|
||||
|
||||
class Punctuation(var punctuationMark: String) {
|
||||
private val punctuationMarkOptions: Regex = Regex("\\p{Punct}")
|
||||
|
||||
init {
|
||||
if (!punctuationMarkOptions.containsMatchIn(punctuationMark)){
|
||||
this.punctuationMark = ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package OOP.Java.lab_5
|
||||
|
||||
class Sentence {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package OOP.Java.lab_5
|
||||
|
||||
class Word(var letters: Array<Letter>) {
|
||||
override fun toString(): String {
|
||||
val wordString = StringBuilder()
|
||||
this.letters.forEach { wordString.append(it) }
|
||||
|
||||
return wordString.toString()
|
||||
}
|
||||
constructor(
|
||||
word: String
|
||||
) : this((word.toCharArray().map { n -> Letter(n) }).toTypedArray())
|
||||
}
|
Loading…
Reference in New Issue