Rabbit-R1/android (non root)/java/sources/androidx/compose/ui/text/input/DeleteSurroundingTextCommand.java
2024-05-21 17:08:36 -04:00

68 lines
3.9 KiB
Java

package androidx.compose.ui.text.input;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: EditCommand.kt */
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0007\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0016J\u0013\u0010\r\u001a\u00020\u000e2\b\u0010\u000f\u001a\u0004\u0018\u00010\u0010H\u0096\u0002J\b\u0010\u0011\u001a\u00020\u0003H\u0016J\b\u0010\u0012\u001a\u00020\u0013H\u0016R\u0011\u0010\u0004\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u0007¨\u0006\u0014"}, d2 = {"Landroidx/compose/ui/text/input/DeleteSurroundingTextCommand;", "Landroidx/compose/ui/text/input/EditCommand;", "lengthBeforeCursor", "", "lengthAfterCursor", "(II)V", "getLengthAfterCursor", "()I", "getLengthBeforeCursor", "applyTo", "", "buffer", "Landroidx/compose/ui/text/input/EditingBuffer;", "equals", "", "other", "", "hashCode", "toString", "", "ui-text_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class DeleteSurroundingTextCommand implements EditCommand {
public static final int $stable = 0;
private final int lengthAfterCursor;
private final int lengthBeforeCursor;
public final int getLengthAfterCursor() {
return this.lengthAfterCursor;
}
public final int getLengthBeforeCursor() {
return this.lengthBeforeCursor;
}
public int hashCode() {
return (this.lengthBeforeCursor * 31) + this.lengthAfterCursor;
}
public DeleteSurroundingTextCommand(int i, int i2) {
this.lengthBeforeCursor = i;
this.lengthAfterCursor = i2;
if (i < 0 || i2 < 0) {
throw new IllegalArgumentException(("Expected lengthBeforeCursor and lengthAfterCursor to be non-negative, were " + i + " and " + i2 + " respectively.").toString());
}
}
@Override // androidx.compose.ui.text.input.EditCommand
public void applyTo(EditingBuffer buffer) {
Intrinsics.checkNotNullParameter(buffer, "buffer");
int selectionEnd = buffer.getSelectionEnd();
int i = this.lengthAfterCursor;
int i2 = selectionEnd + i;
if (((selectionEnd ^ i2) & (i ^ i2)) < 0) {
i2 = buffer.getLength$ui_text_release();
}
buffer.delete$ui_text_release(buffer.getSelectionEnd(), Math.min(i2, buffer.getLength$ui_text_release()));
buffer.delete$ui_text_release(Math.max(0, MathUtilsKt.subtractExactOrElse(buffer.getSelectionStart(), this.lengthBeforeCursor, new Function0<Integer>() { // from class: androidx.compose.ui.text.input.DeleteSurroundingTextCommand$applyTo$start$1
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final Integer invoke() {
return 0;
}
})), buffer.getSelectionStart());
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof DeleteSurroundingTextCommand)) {
return false;
}
DeleteSurroundingTextCommand deleteSurroundingTextCommand = (DeleteSurroundingTextCommand) other;
return this.lengthBeforeCursor == deleteSurroundingTextCommand.lengthBeforeCursor && this.lengthAfterCursor == deleteSurroundingTextCommand.lengthAfterCursor;
}
public String toString() {
return "DeleteSurroundingTextCommand(lengthBeforeCursor=" + this.lengthBeforeCursor + ", lengthAfterCursor=" + this.lengthAfterCursor + ')';
}
}