|
| 1 | +package dev.robotcode.robotcode4ij.testing |
| 2 | + |
| 3 | +import kotlinx.serialization.Serializable |
| 4 | +import kotlinx.serialization.json.JsonElement |
| 5 | + |
| 6 | +@Serializable |
| 7 | +data class Position(val line: UInt, val character: UInt) |
| 8 | + |
| 9 | +@Serializable data class Range(val start: Position, val end: Position) |
| 10 | + |
| 11 | +@Serializable data class RobotCodeTestItem( |
| 12 | + val type: String, |
| 13 | + val id: String, |
| 14 | + val name: String, |
| 15 | + val longname: String, |
| 16 | + val lineno: Int? = null, |
| 17 | + val description: String? = null, |
| 18 | + val uri: String? = null, |
| 19 | + val relSource: String? = null, |
| 20 | + val source: String? = null, |
| 21 | + val needsParseInclude: Boolean? = null, |
| 22 | + var children: Array<RobotCodeTestItem>? = null, |
| 23 | + val range: Range? = null, |
| 24 | + val error: String? = null, |
| 25 | + val tags: Array<String>? = null, |
| 26 | + val rpa: Boolean? = null |
| 27 | +) { |
| 28 | + override fun equals(other: Any?): Boolean { |
| 29 | + if (this === other) return true |
| 30 | + if (javaClass != other?.javaClass) return false |
| 31 | + |
| 32 | + other as RobotCodeTestItem |
| 33 | + |
| 34 | + if (needsParseInclude != other.needsParseInclude) return false |
| 35 | + if (type != other.type) return false |
| 36 | + if (id != other.id) return false |
| 37 | + if (name != other.name) return false |
| 38 | + if (longname != other.longname) return false |
| 39 | + if (description != other.description) return false |
| 40 | + if (uri != other.uri) return false |
| 41 | + if (relSource != other.relSource) return false |
| 42 | + if (children != null) { |
| 43 | + if (other.children == null) return false |
| 44 | + if (!children.contentEquals(other.children)) return false |
| 45 | + } else if (other.children != null) return false |
| 46 | + if (range != other.range) return false |
| 47 | + if (error != other.error) return false |
| 48 | + if (tags != null) { |
| 49 | + if (other.tags == null) return false |
| 50 | + if (!tags.contentEquals(other.tags)) return false |
| 51 | + } else if (other.tags != null) return false |
| 52 | + |
| 53 | + return true |
| 54 | + } |
| 55 | + |
| 56 | + override fun hashCode(): Int { |
| 57 | + var result = needsParseInclude?.hashCode() ?: 0 |
| 58 | + result = 31 * result + type.hashCode() |
| 59 | + result = 31 * result + id.hashCode() |
| 60 | + result = 31 * result + name.hashCode() |
| 61 | + result = 31 * result + longname.hashCode() |
| 62 | + result = 31 * result + description.hashCode() |
| 63 | + result = 31 * result + (uri?.hashCode() ?: 0) |
| 64 | + result = 31 * result + (relSource?.hashCode() ?: 0) |
| 65 | + result = 31 * result + (children?.contentHashCode() ?: 0) |
| 66 | + result = 31 * result + (range?.hashCode() ?: 0) |
| 67 | + result = 31 * result + (error?.hashCode() ?: 0) |
| 68 | + result = 31 * result + (tags?.contentHashCode() ?: 0) |
| 69 | + return result |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +@Serializable data class RobotCodeDiscoverResult( |
| 74 | + val items: Array<RobotCodeTestItem>? = null, |
| 75 | + val diagnostics: Map<String, JsonElement>? = null // TODO val diagnostics: { [Key: string]: Diagnostic[] }; |
| 76 | +) { |
| 77 | + override fun equals(other: Any?): Boolean { |
| 78 | + if (this === other) return true |
| 79 | + if (javaClass != other?.javaClass) return false |
| 80 | + |
| 81 | + other as RobotCodeDiscoverResult |
| 82 | + |
| 83 | + if (items != null) { |
| 84 | + if (other.items == null) return false |
| 85 | + if (!items.contentEquals(other.items)) return false |
| 86 | + } else if (other.items != null) return false |
| 87 | + if (diagnostics != other.diagnostics) return false |
| 88 | + |
| 89 | + return true |
| 90 | + } |
| 91 | + |
| 92 | + override fun hashCode(): Int { |
| 93 | + var result = items?.contentHashCode() ?: 0 |
| 94 | + result = 31 * result + (diagnostics?.hashCode() ?: 0) |
| 95 | + return result |
| 96 | + } |
| 97 | +} |
0 commit comments