Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: made LineIter implement Iterator. #13

Merged
merged 1 commit into from
May 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/com/github/sttk/linebreak/LineIter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
import com.ibm.icu.lang.UProperty;
import com.ibm.icu.util.CodePointMap;
import java.util.Arrays;
import java.util.Iterator;

/**
* {@code LineIter} is the class that outputs the given string line by line.
* This class can control the overall line width and the indentation from any
* desired line.
*/
public class LineIter {
public class LineIter implements Iterator<String> {

enum LboType {
Never,
Expand Down Expand Up @@ -94,6 +95,7 @@ public void init(String text) {
*
* @return True if the remaining string exists.
*/
@Override
public boolean hasNext() {
return this.hasNext;
}
Expand All @@ -103,6 +105,7 @@ public boolean hasNext() {
*
* @return A next line string.
*/
@Override
public String next() {
int limit = this.limit - this.indentCodepointCount;

Expand Down