Skip to content

Commit

Permalink
add: hashCode, equals
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Sep 1, 2023
1 parent 5bde1d6 commit 59ff38a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5310,12 +5310,14 @@ public final class net/mamoe/mirai/message/data/SuperFace : net/mamoe/mirai/mess
public static final field SERIAL_NAME Ljava/lang/String;
public synthetic fun <init> (IILjava/lang/String;ILkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun contentToString ()Ljava/lang/String;
public fun equals (Ljava/lang/Object;)Z
public static final fun from (Lnet/mamoe/mirai/message/data/Face;)Lnet/mamoe/mirai/message/data/SuperFace;
public final fun getFace ()I
public final fun getId ()Ljava/lang/String;
public fun getKey ()Lnet/mamoe/mirai/message/data/MessageKey;
public final fun getName ()Ljava/lang/String;
public final fun getType ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun tryFrom (Lnet/mamoe/mirai/message/data/Face;)Lnet/mamoe/mirai/message/data/SuperFace;
public static final fun write$Self (Lnet/mamoe/mirai/message/data/SuperFace;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
Expand Down
2 changes: 2 additions & 0 deletions mirai-core-api/compatibility-validation/jvm/api/jvm.api
Original file line number Diff line number Diff line change
Expand Up @@ -5310,12 +5310,14 @@ public final class net/mamoe/mirai/message/data/SuperFace : net/mamoe/mirai/mess
public static final field SERIAL_NAME Ljava/lang/String;
public synthetic fun <init> (IILjava/lang/String;ILkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun contentToString ()Ljava/lang/String;
public fun equals (Ljava/lang/Object;)Z
public static final fun from (Lnet/mamoe/mirai/message/data/Face;)Lnet/mamoe/mirai/message/data/SuperFace;
public final fun getFace ()I
public final fun getId ()Ljava/lang/String;
public fun getKey ()Lnet/mamoe/mirai/message/data/MessageKey;
public final fun getName ()Ljava/lang/String;
public final fun getType ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun tryFrom (Lnet/mamoe/mirai/message/data/Face;)Lnet/mamoe/mirai/message/data/SuperFace;
public static final fun write$Self (Lnet/mamoe/mirai/message/data/SuperFace;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
Expand Down
13 changes: 13 additions & 0 deletions mirai-core-api/src/commonMain/kotlin/message/data/SuperFace.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import kotlin.jvm.Throws
* 超级表情
*
* @see Face
* @since 2.16
*/
@OptIn(MiraiExperimentalApi::class)
@Serializable
Expand Down Expand Up @@ -119,6 +120,18 @@ public class SuperFace @MiraiInternalApi constructor(
override fun <D, R> accept(visitor: MessageVisitor<D, R>, data: D): R {
return visitor.visitSuperFace(this, data)
}

override fun hashCode(): Int {
var result = face.hashCode()
result = 31 * result + id.hashCode()
result = 31 * result + type.hashCode()
return result
}

override fun equals(other: Any?): Boolean {
if (other !is SuperFace) return false
return face == other.face && id == other.id && type == other.type
}
}

@JvmSynthetic
Expand Down

0 comments on commit 59ff38a

Please sign in to comment.