Twine

Rope data structure for any type of element.

License

License

GroupId

GroupId

uk.me.candle
ArtifactId

ArtifactId

twine
Last Version

Last Version

0.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

Twine
Rope data structure for any type of element.
Project URL

Project URL

https://github.com/CandleCandle/twine
Source Code Management

Source Code Management

https://github.com/CandleCandle/twine

Download twine

How to add to project

<!-- https://jarcasting.com/artifacts/uk.me.candle/twine/ -->
<dependency>
    <groupId>uk.me.candle</groupId>
    <artifactId>twine</artifactId>
    <version>0.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/uk.me.candle/twine/
implementation 'uk.me.candle:twine:0.0.5'
// https://jarcasting.com/artifacts/uk.me.candle/twine/
implementation ("uk.me.candle:twine:0.0.5")
'uk.me.candle:twine:jar:0.0.5'
<dependency org="uk.me.candle" name="twine" rev="0.0.5">
  <artifact name="twine" type="jar" />
</dependency>
@Grapes(
@Grab(group='uk.me.candle', module='twine', version='0.0.5')
)
libraryDependencies += "uk.me.candle" % "twine" % "0.0.5"
[uk.me.candle/twine "0.0.5"]

Dependencies

test (5)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.5.2
org.junit.jupiter : junit-jupiter-engine jar 5.5.2
org.junit.platform : junit-platform-runner jar 1.5.0
org.mockito : mockito-junit-jupiter jar 3.1.0
org.hamcrest : hamcrest-core jar 2.2

Project Modules

There are no modules declared in this project.

Twine

Generic library implementing a rope data structure.

Usage

Maven

Include a dependency in your pom.xml

<dependency>
    <groupId>uk.me.candle.twine</groupId>
    <artifactId>twine</artifactId>
    <version>[latest version]</version>
</dependency>

The latest version can be found on maven central: https://search.maven.org/search?q=g:uk.me.candle%20a:twine

Java

Rope<Character, CharSeqSliceable> rope = new BasicMutableRope<>();
// create a new empty Rope.

rope.append(new CharSeqSliceable("this is a rope element.\n"));
rope.append(new CharSeqSliceable("this is another rope element."));
// `rope` now contains "this is a rope element.\nthis is another rope element."

List<Character, CharSeqSliceable>> parts = rope.split(15);
// parts.get(0) now contains a Rope containing "this is a rope "
// parts.get(1) now contains a Rope containing " element.\nthis is another rope element."

Rope<Character, CharSeqSliceable> another = rope.insert(new CharSeqSliceable("\r"), 24);
// `another now contains "this is a rope element.\r\nthis is another rope element."

Extending

Implement the Sliceable interface for your array/list-like data structure.

public class MySliceable implements Sliceable<ElementType, MySliceable> { ... }

Create a Rope using it:

Rope<ElementType, MySliceable> rope = new BasicMutableRope<>();

Versions

Version
0.0.5
0.0.4