1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package androidx.navigation
17 
18 import androidx.savedstate.SavedState
19 import androidx.savedstate.savedState
20 
21 /**
22  * An implementation of [NavDirections] without any arguments.
23  *
24  * This class should not be used directly; prefer the NavDirections classes generated by the Safe
25  * Args plugin.
26  */
27 @Suppress("DataClassDefinition")
28 public data class ActionOnlyNavDirections(override val actionId: Int) : NavDirections {
29     override val arguments: SavedState = savedState()
30 
equalsnull31     public override fun equals(other: Any?): Boolean {
32         if (this === other) {
33             return true
34         }
35         if (other == null || javaClass != other.javaClass) {
36             return false
37         }
38         val that = other as ActionOnlyNavDirections
39         return actionId == that.actionId
40     }
41 
hashCodenull42     public override fun hashCode(): Int {
43         var result = 1
44         result = 31 * result + actionId
45         return result
46     }
47 
toStringnull48     public override fun toString(): String {
49         return "ActionOnlyNavDirections(actionId=$actionId)"
50     }
51 }
52