org.pz.platypus.utilities
Class ClosingBraceBuilder
java.lang.Object
org.pz.platypus.utilities.ClosingBraceBuilder
public class ClosingBraceBuilder
- extends java.lang.Object
Builds a string that shows what the matching closing brace(s) should look be for
a given open set of braces.
So, if the opening braces are '{', this class returns '}'
If the opening braces are '{{{', this class returns '}}}'
- Author:
- alb
Method Summary |
private int |
countOpeningBraces(java.lang.String text)
Counts the number of opening braces at the start of text |
java.lang.String |
getClosingBrace()
|
private java.lang.String |
makeClosingBrace(int braceCount)
Generate a string containing as many closing braces as specified in braceCount
Note: the number of opening braces is guaranteed to be > 0 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
closingBrace
private java.lang.String closingBrace
ClosingBraceBuilder
public ClosingBraceBuilder(java.lang.String text)
countOpeningBraces
private int countOpeningBraces(java.lang.String text)
- Counts the number of opening braces at the start of text
- Parameters:
text
- the text that should begin with opening brace or braces ({)
- Returns:
- number of opening braces, or 0 in case of error
makeClosingBrace
private java.lang.String makeClosingBrace(int braceCount)
- Generate a string containing as many closing braces as specified in braceCount
Note: the number of opening braces is guaranteed to be > 0
- Parameters:
braceCount
- number of closing brace characters (}) in the returned string
- Returns:
- string with brace counts
getClosingBrace
public java.lang.String getClosingBrace()
Copyright © 2008-10 Pacific Data Works LLC