Package sc2002.FCS1.grp2.builders
Class Bar.Builder
Object
Builder
- Enclosing class:
Bar
Builder class to add values and build text like a bar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intMax value of the set of bars.private intMax size of the bar, units: character.Built values of bars chart -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd value, representing a bar.private StringStandardised bar formatting Title [----Bar----] Percentagevoidprint()Directly print the built bar contents in console.toString()Retrieve all formatted content as a string.toValues()Retrieve all formatted bar and details strings as a list.
-
Field Details
-
presentationSize
private int presentationSizeMax size of the bar, units: character. -
max
private int maxMax value of the set of bars. -
values
Built values of bars chart
-
-
Constructor Details
-
Builder
public Builder(int presentationSize, int max)
-
-
Method Details
-
getFormat
Standardised bar formatting Title [----Bar----] Percentage- Returns:
- format string.
-
add
Add value, representing a bar.- Parameters:
type- Render type, how it should be rendered, solid or dotted.value- Value of this bar. (e.g. 5 / 10)title- What this bar represents.showPercentage- Set this to true to show percentage beside bar.- Returns:
- builder object.
-
toValues
Retrieve all formatted bar and details strings as a list.- Returns:
- a list of strings.
-
toString
Retrieve all formatted content as a string. -
print
public void print()Directly print the built bar contents in console.
-