Skip to content
Open
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
30 changes: 28 additions & 2 deletions src/org/daisy/dotify/api/formatter/TextProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class TextProperties {
private final String locale;
private final String translationMode;
private final boolean hyphenate;

private final boolean markCapitalLetters;

/**
* Provides a builder for creating text properties instances.
*
Expand All @@ -28,6 +29,7 @@ public static class Builder {
private final String locale;
private String translationMode = null;
private boolean hyphenate = true;
private boolean markCapitalLetters = true;

/**
* Creates a new builder with the specified locale
Expand All @@ -46,7 +48,17 @@ public Builder hyphenate(boolean value) {
this.hyphenate = value;
return this;
}


/**
* Sets the markCapitalLetters value for this builder
* @param value the value
* @return returns this object
*/
public Builder markCapitalLetters(boolean value) {
this.markCapitalLetters = value;
return this;
}

/**
* Sets the translation mode for the builder
* @param mode the translation mode
Expand All @@ -70,6 +82,7 @@ private TextProperties(Builder builder) {
this.locale = builder.locale;
this.translationMode = builder.translationMode;
this.hyphenate = builder.hyphenate;
this.markCapitalLetters = builder.markCapitalLetters;
}

/**
Expand All @@ -96,11 +109,21 @@ public boolean isHyphenating() {
return hyphenate;
}

/**
* Returns true if the mark capital letters property is true, false otherwise
* @return returns true if the mark capital letters property is true
*/
public boolean shouldMarkCapitalLetters() {
return markCapitalLetters;
}


@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (hyphenate ? 1231 : 1237);
result = prime * result + (markCapitalLetters ? 1241 : 1247);
result = prime * result + ((locale == null) ? 0 : locale.hashCode());
result = prime * result + ((translationMode == null) ? 0 : translationMode.hashCode());
return result;
Expand All @@ -121,6 +144,9 @@ public boolean equals(Object obj) {
if (hyphenate != other.hyphenate) {
return false;
}
if (markCapitalLetters != other.markCapitalLetters) {
return false;
}
if (locale == null) {
if (other.locale != null) {
return false;
Expand Down