# SubspaceModifierNodeElement

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/subspace/node/SubspaceModifierNodeElement.kt+class:androidx.xr.compose.subspace.node.SubspaceModifierNodeElement) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)


```
abstract class SubspaceModifierNodeElement<N : SubspaceModifier.Node> : SubspaceModifier
```

<br />

*** ** * ** ***

Modifier elements manage an instance of a particular `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` implementation. A given `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` implementation can only be used when a `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement`, which creates and updates that implementation, is applied to a layout.

A `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement` should be very lightweight, and do little more than hold the information necessary to create and maintain an instance of the associated `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` type.

| Parameters |
|---|---|
| `<N : https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node>` | The type of node that this element creates and updates. |

## Summary

| ### Public constructors |
|---|
| `<N : https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node> https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement#SubspaceModifierNodeElement()()` |

| ### Public functions |
|---|---|
| `abstract N` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement#create()()` This will be called the first time the modifier is applied to the layout and it should construct and return the corresponding `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` instance. |
| `abstract operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Require equals() to be implemented. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement#hashCode()()` Require hashCode() to be implemented. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement#update(androidx.xr.compose.subspace.layout.SubspaceModifier.Node)(node: N)` Called when a modifier is applied to a layout whose inputs have changed from the previous application. |

### Inherited functions

From [androidx.xr.compose.subspace.layout.SubspaceModifier](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#all(kotlin.Function1)(
predicate: (https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement<https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html
)`

Returns `true` if `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#all(kotlin.Function1)` returns true for all `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement`s in this `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier` or if this `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier` contains no Elements.
`open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#any(kotlin.Function1)(
predicate: (https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement<https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html
)`

Returns `true` if `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#any(kotlin.Function1)` returns true for any `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement` in this `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier`.
`open R` `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#foldIn(kotlin.Any,kotlin.Function2)(
initial: R,
operation: (https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement<https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node>, R) -> R
)`

Accumulates a value starting with `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#foldIn(kotlin.Any,kotlin.Function2)` and applying `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#foldIn(kotlin.Any,kotlin.Function2)` to the current value and each `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement` from outside in.
`open R` `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#foldOut(kotlin.Any,kotlin.Function2)(
initial: R,
operation: (https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement<https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node>, R) -> R
)`

Accumulates a value starting with `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#foldOut(kotlin.Any,kotlin.Function2)` and applying `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#foldOut(kotlin.Any,kotlin.Function2)` to the current value and each `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/node/SubspaceModifierNodeElement` from inside out.
`open infix https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier` `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier#then(androidx.xr.compose.subspace.layout.SubspaceModifier)(other: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier)`

Concatenates this modifier with another.

## Public constructors

### SubspaceModifierNodeElement

```
<N : SubspaceModifier.Node> SubspaceModifierNodeElement()
```

| Parameters |
|---|---|
| `<N : https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node>` | The type of node that this element creates and updates. |

## Public functions

### create

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
abstract fun create(): N
```

This will be called the first time the modifier is applied to the layout and it should construct and return the corresponding `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` instance.

### equals

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
abstract operator fun equals(other: Any?): Boolean
```

Require equals() to be implemented. Using a data class is sufficient. Singletons may implement this function with referential equality (`this === other`). Modifiers with no inputs may implement this function by checking the type of the other object.

| Parameters |
|---|---|
| `other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The object to compare this element against. |

### hashCode

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
abstract fun hashCode(): Int
```

Require hashCode() to be implemented. Using a data class is sufficient. Singletons and modifiers with no parameters may implement this function by returning an arbitrary constant.

### update

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
abstract fun update(node: N): Unit
```

Called when a modifier is applied to a layout whose inputs have changed from the previous application. This function will have the current node instance passed in as a parameter, and it is expected that the node will be brought up to date.

| Parameters |
|---|---|
| `node: N` | The node instance to be updated. |