docs: added missing javadocs

This commit is contained in:
zaaarf 2024-10-15 21:55:23 +02:00
parent b452cb822f
commit 2e583028a6
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B
5 changed files with 12 additions and 7 deletions

View file

@ -70,6 +70,7 @@ public final class BufferController {
/** /**
* Tries to send a {@link TextChange} update. * Tries to send a {@link TextChange} update.
* @param change the update to send
* @throws ControllerException if the controller was stopped * @throws ControllerException if the controller was stopped
*/ */
public void send(TextChange change) throws ControllerException { public void send(TextChange change) throws ControllerException {
@ -81,6 +82,8 @@ public final class BufferController {
/** /**
* Registers a callback to be invoked whenever a {@link BufferUpdate} occurs. * Registers a callback to be invoked whenever a {@link BufferUpdate} occurs.
* This will not work unless a Java thread has been dedicated to the event loop. * This will not work unless a Java thread has been dedicated to the event loop.
* @param cb a {@link Consumer} that receives the controller when the change occurs;
* you should probably spawn a new thread in here, to avoid deadlocking
* @see Extensions#drive(boolean) * @see Extensions#drive(boolean)
*/ */
public void callback(Consumer<BufferController> cb) { public void callback(Consumer<BufferController> cb) {

View file

@ -43,14 +43,15 @@ public final class CursorController {
return recv(this.ptr); return recv(this.ptr);
} }
private static native void send(long self, Selection cursor) throws ControllerException; private static native void send(long self, Selection selection) throws ControllerException;
/** /**
* Tries to send a {@link Selection} update. * Tries to send a {@link Selection} update.
* @param selection the update to send
* @throws ControllerException if the controller was stopped * @throws ControllerException if the controller was stopped
*/ */
public void send(Selection cursor) throws ControllerException { public void send(Selection selection) throws ControllerException {
send(this.ptr, cursor); send(this.ptr, selection);
} }
private static native void callback(long self, Consumer<CursorController> cb); private static native void callback(long self, Consumer<CursorController> cb);
@ -58,6 +59,8 @@ public final class CursorController {
/** /**
* Registers a callback to be invoked whenever a {@link Cursor} update occurs. * Registers a callback to be invoked whenever a {@link Cursor} update occurs.
* This will not work unless a Java thread has been dedicated to the event loop. * This will not work unless a Java thread has been dedicated to the event loop.
* @param cb a {@link Consumer} that receives the controller when the change occurs;
* you should probably spawn a new thread in here, to avoid deadlocking
* @see Extensions#drive(boolean) * @see Extensions#drive(boolean)
*/ */
public void callback(Consumer<CursorController> cb) { public void callback(Consumer<CursorController> cb) {

View file

@ -33,7 +33,7 @@ public final class Extensions {
* <p> * <p>
* You may alternatively call this with true, in a separate and dedicated Java thread; * You may alternatively call this with true, in a separate and dedicated Java thread;
* it will remain active in the background and act as event loop. Assign it like this: * it will remain active in the background and act as event loop. Assign it like this:
* <p><code>new Thread(() -> Extensions.drive(true)).start();</code></p> * <p><code>new Thread(() -&gt; Extensions.drive(true)).start();</code></p>
* @param block true if it should use the current thread * @param block true if it should use the current thread
*/ */
public static native void drive(boolean block); public static native void drive(boolean block);

View file

@ -196,6 +196,8 @@ public final class Workspace {
/** /**
* Registers a callback to be invoked whenever a new {@link Event} is ready to be received. * Registers a callback to be invoked whenever a new {@link Event} is ready to be received.
* This will not work unless a Java thread has been dedicated to the event loop. * This will not work unless a Java thread has been dedicated to the event loop.
* @param cb a {@link Consumer} that receives the controller when the change occurs;
* you should probably spawn a new thread in here, to avoid deadlocking
* @see Extensions#drive(boolean) * @see Extensions#drive(boolean)
*/ */
public void callback(Consumer<Workspace> cb) { public void callback(Consumer<Workspace> cb) {

View file

@ -3,9 +3,6 @@ package mp.code.data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.ToString; import lombok.ToString;
import mp.code.Extensions;
import java.util.OptionalLong;
/** /**
* A data class holding information about a text change. * A data class holding information about a text change.