org.apache.commons.lang3.text.StrBuilder Java Examples

The following examples show how to use org.apache.commons.lang3.text.StrBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphMetrics.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public String getLongDescription() {
	return new StrBuilder()
		.appendln("Computes metrics on a directed or undirected graph.")
		.appendNewLine()
		.appendln("Vertex metrics:")
		.appendln("- number of vertices")
		.appendln("- number of edges")
		.appendln("- number of unidirectional edges (directed only)")
		.appendln("- number of bidirectional edges (directed only)")
		.appendln("- average degree")
		.appendln("- number of triplets")
		.appendln("- maximum degree")
		.appendln("- maximum out degree (directed only)")
		.appendln("- maximum in degree (directed only)")
		.appendln("- maximum number of triplets")
		.appendNewLine()
		.appendln("Edge metrics:")
		.appendln("- number of triangle triplets")
		.appendln("- number of rectangle triplets")
		.appendln("- maximum number of triangle triplets")
		.append("- maximum number of rectangle triplets")
		.toString();
}
 
Example #2
Source File: AT_08a_TargetTranslator_Latex.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"String text = \"A sentence with some normal text, not specific to LaTeX. \" +",
			"		\"Now for some characters that require conversion: # % &. \" +",
			"		\"And some more: © § ¤. \" +",
			"		\"And even more: È É Ê Ë. \" +",
			"		\"And some arrows as well: ← ↑ → ↓ ↔\"",
			";",
			"",
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(text, text).getCells().get(1).getContext().setTargetTranslator(new Text2Latex());",
			"at.addRule();",
			"at.setTextAlignment(TextAlignment.LEFT);",
			"",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #3
Source File: AT_00g_AddColumn_DoesRenderToWidth.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public void showOutput(){
	// tag::example[]
	AsciiTable at = new AsciiTable();
	class ObjectDoesRenderToWidth implements DoesRenderToWidth{
		@Override
		public String render(int width) {
			return new StrBuilder().appendWithSeparators(Text_To_FormattedText.left(new LoremIpsum().getWords(10), width), "\n").toString();
		}
	}

	at.addRule();
	at.addRow(new ObjectDoesRenderToWidth());
	at.addRule();
	System.out.println(at.render(30));
	// end::example[]
}
 
Example #4
Source File: AT_00g_AddColumn_DoesRenderToWidth.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"class ObjectDoesRenderToWidth implements DoesRenderToWidth{",
			"	@Override",
			"	public String render(int width) {",
			"		return new StrBuilder().appendWithSeparators(Text_To_FormattedText.left(new LoremIpsum().getWords(10), width), \"\n\").toString();",
			"	}",
			"}",
			"",
			"at.addRule();",
			"at.addRow(new ObjectDoesRenderToWidth());",
			"at.addRule();",
			"System.out.println(at.render(30));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #5
Source File: AT_07e_LongestWordMax.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"first\", \"information\");",
			"at.addRule();",
			"at.addRow(\"second\", \"info\");",
			"at.addRule();",
			"",
			"at.getRenderer().setCWC(new CWC_LongestWordMax(8));",
			"System.out.println(at.render());",
			"",
			"at.getRenderer().setCWC(new CWC_LongestWordMax(new int[]{4,-1}));",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #6
Source File: AT_02_ColSpan.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(null, null, null, null, \"span all 5 columns\");",
			"at.addRule();",
			"at.addRow(null, null, null, \"span 4 columns\", \"just 1 column\");",
			"at.addRule();",
			"at.addRow(null, null, \"span 3 columns\", null, \"span 2 columns\");",
			"at.addRule();",
			"at.addRow(null, \"span 2 columns\", null, null, \"span 3 columns\");",
			"at.addRule();",
			"at.addRow(\"just 1 column\", null, null, null, \"span 4 columns\");",
			"at.addRule();",
			"at.addRow(\"just 1 column\", \"just 1 column\", \"just 1 column\", \"just 1 column\", \"just 1 column\");",
			"at.addRule();",
			"System.out.println(at.render(71));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #7
Source File: Runner.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * List available algorithms. This is displayed to the user when no valid
 * algorithm is given in the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
	StrBuilder strBuilder = new StrBuilder();

	strBuilder
		.appendNewLine()
		.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
		.appendNewLine()
		.appendln("Available algorithms:");

	for (Driver algorithm : driverFactory) {
		strBuilder.append("  ")
			.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
			.append(algorithm.getShortDescription()).appendNewLine();
	}

	return strBuilder.toString();
}
 
Example #8
Source File: AT_00e_AddColumn_HasTextCluster.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"class ObjectHasTextCluster implements HasTextCluster{",
			"	@Override",
			"	public Collection<String> getTextAsCollection() {",
			"		ArrayList<String> text = new ArrayList<>();",
			"		text.add(new LoremIpsum().getWords(10));",
			"		text.add(new LoremIpsum().getWords(10));",
			"		text.add(new LoremIpsum().getWords(10));",
			"		return text;",
			"	}",
			"}",
			"",
			"at.addRule();",
			"at.addRow(new ObjectHasTextCluster());",
			"at.addRule();",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #9
Source File: AT_05_MarginBehavior.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"row 1 col 1\", \"row 1 col 2\");",
			"at.addRule();",
			"at.addRow(\"row 2 col 1\", \"row 2 col 2\");",
			"at.addRule();",
			"",
			"at.getContext().setFrameTopChar('v');",
			"at.getContext().setFrameBottomChar('^');",
			"at.getContext().setFrameLeftChar('>');",
			"at.getContext().setFrameRightChar('<');",
			"",
			"at.getContext().setFrameTopMargin(1);",
			"at.getContext().setFrameBottomMargin(2);",
			"at.getContext().setFrameLeftMargin(3);",
			"at.getContext().setFrameRightMargin(4);",
			"",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #10
Source File: GraphMetrics.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public String getLongDescription() {
	return new StrBuilder()
		.appendln("Computes metrics on a directed or undirected graph.")
		.appendNewLine()
		.appendln("Vertex metrics:")
		.appendln("- number of vertices")
		.appendln("- number of edges")
		.appendln("- number of unidirectional edges (directed only)")
		.appendln("- number of bidirectional edges (directed only)")
		.appendln("- average degree")
		.appendln("- number of triplets")
		.appendln("- maximum degree")
		.appendln("- maximum out degree (directed only)")
		.appendln("- maximum in degree (directed only)")
		.appendln("- maximum number of triplets")
		.appendNewLine()
		.appendln("Edge metrics:")
		.appendln("- number of triangle triplets")
		.appendln("- number of rectangle triplets")
		.appendln("- maximum number of triangle triplets")
		.append("- maximum number of rectangle triplets")
		.toString();
}
 
Example #11
Source File: AT_03_AlignmentOptions.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"String text = new LoremIpsum().getWords(19);",
			"AT_Row row;",
			"at.addRule();",
			"row = at.addRow(text, text, text);",
			"row.getCells().get(0).getContext().setTextAlignment(TextAlignment.JUSTIFIED_LEFT);",
			"row.getCells().get(1).getContext().setTextAlignment(TextAlignment.JUSTIFIED);",
			"row.getCells().get(2).getContext().setTextAlignment(TextAlignment.JUSTIFIED_RIGHT);",
			"at.addRule();",
			"row = at.addRow(text, text, text);",
			"row.getCells().get(0).getContext().setTextAlignment(TextAlignment.LEFT);",
			"row.getCells().get(1).getContext().setTextAlignment(TextAlignment.CENTER);",
			"row.getCells().get(2).getContext().setTextAlignment(TextAlignment.RIGHT);",
			"at.addRule();",
			"System.out.println(at.render(79));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #12
Source File: AT_00f_AddColumn_DoesRender.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"class ObjectDoesRender implements DoesRender{",
			"	@Override",
			"	public String render() {",
			"		return new LoremIpsum().getWords(10);",
			"	}",
			"}",
			"",
			"at.addRule();",
			"at.addRow(new ObjectDoesRender());",
			"at.addRule();",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #13
Source File: AT_07c_LongestLine.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"0\", \"1\", \"22\", \"333\", \"4444\");",
			"at.addRule();",
			"CWC_LongestLine cwc = new CWC_LongestLine();",
			"",
			"at.getRenderer().setCWC(cwc);",
			"System.out.println(at.render());",
			"",
			"cwc.add(4, 0);",
			"System.out.println(at.render());",
			"",
			"cwc.add(6, 0).add(0, 0).add(0, 0).add(0, 2);",
			"System.out.println(at.render());",
			"",
			"at.addRow(\"0\", \"1\", \"22\", \"333<br>55555\", \"4444\");",
			"at.addRule();",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #14
Source File: AT_04a_Padding_Table.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"row 1 col 1\", \"row 1 col 2\");",
			"at.addRule();",
			"at.addRow(\"row 2 col 1\", \"row 2 col 2\");",
			"at.addRule();",
			"",
			"at.setPaddingTopChar('v');",
			"at.setPaddingBottomChar('^');",
			"at.setPaddingLeftChar('>');",
			"at.setPaddingRightChar('<');",
			"at.setTextAlignment(TextAlignment.CENTER);",
			"at.setPadding(1);",
			"System.out.println(at.render(33));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #15
Source File: AT_07b_Width_Fixed.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"col1\", \"col2\", \"col3\");",
			"at.addRule();",
			"",
			"at.getRenderer().setCWC(new CWC_FixedWidth().add(10).add(20).add(30));",
			"System.out.println(at.render());",
			"",
			"at.getRenderer().setCWC(new CWC_FixedWidth().add(5).add(10).add(15));",
			"System.out.println(at.render());",
			"",
			"at.getRenderer().setCWC(new CWC_FixedWidth().add(3).add(5).add(7));",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #16
Source File: AT_08b_TargetTranslator_HTML.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"String text = \"A sentence with some normal text, not specific to HTML. \" +",
			"		\"Now for some characters that require conversion: # % & < >. \" +",
			"		\"And some more: © § ¤. \" +",
			"		\"And even more: Ē ē Ĕ ĕ Ė ė Ę ę Ě ě. \" +",
			"		\"And some arrows as well: ← ↑ → ↓ ↔ ↕\"",
			";",
			"",
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(text, text).getCells().get(1).getContext().setTargetTranslator(new Text2Html());",
			"at.addRule();",
			"at.setTextAlignment(TextAlignment.LEFT);",
			"",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #17
Source File: GraphMetrics.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public String getLongDescription() {
	return new StrBuilder()
		.appendln("Computes metrics on a directed or undirected graph.")
		.appendNewLine()
		.appendln("Vertex metrics:")
		.appendln("- number of vertices")
		.appendln("- number of edges")
		.appendln("- number of unidirectional edges (directed only)")
		.appendln("- number of bidirectional edges (directed only)")
		.appendln("- average degree")
		.appendln("- number of triplets")
		.appendln("- maximum degree")
		.appendln("- maximum out degree (directed only)")
		.appendln("- maximum in degree (directed only)")
		.appendln("- maximum number of triplets")
		.appendNewLine()
		.appendln("Edge metrics:")
		.appendln("- number of triangle triplets")
		.appendln("- number of rectangle triplets")
		.appendln("- maximum number of triangle triplets")
		.append("- maximum number of rectangle triplets")
		.toString();
}
 
Example #18
Source File: AT_04c_Padding_Cell.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"row 1 col 1\", \"row 1 col 2\");",
			"at.addRule();",
			"AT_Cell cell = at.addRow(\"row 2 col 1\", \"row 2 col 2\").getCells().get(1);",
			"at.addRule();",
			"",
			"at.setPaddingTopChar('v');",
			"at.setPaddingBottomChar('^');",
			"at.setPaddingLeftChar('>');",
			"at.setPaddingRightChar('<');",
			"at.setTextAlignment(TextAlignment.CENTER);",
			"at.setPadding(1);",
			"System.out.println(at.render(33));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #19
Source File: AT_00d_AddColumn_HasText.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"class ObjectHasText implements HasText{",
			"	@Override",
			"	public String getText() {",
			"		return new LoremIpsum().getWords(10);",
			"	}",
			"}",
			"",
			"at.addRule();",
			"at.addRow(new ObjectHasText());",
			"at.addRule();",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #20
Source File: AT_00b_WidthBehavior.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"row 1 col 1\", \"row 1 col 2\");",
			"at.addRule();",
			"at.addRow(\"row 2 col 1\", \"row 2 col 2\");",
			"at.addRule();",
			"",
			"at.getContext().setWidth(50);",
			"System.out.println(at.render());",
			"",
			"at.getContext().setWidth(40);",
			"System.out.println(at.render());",
			"",
			"at.getContext().setWidth(30);",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #21
Source File: AT_06b_GridRuleStyle.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"rc 11\", \"rc 12\");",
			"at.addLightRule();",
			"at.addRow(\"rc 21\", \"rc 22\");",
			"at.addStrongRule();",
			"at.addRow(\"rc 31\", \"rc 32\");",
			"at.addHeavyRule();",
			"",
			"at.getContext().setGrid(A8_Grids.lineDobuleBlocks());",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #22
Source File: HtmlUtils.java    From appstatus with Apache License 2.0 6 votes vote down vote up
/**
 * Outputs one table row.
 * <p>
 * <b>WARNING</b> : this method accepts HTML content as row content. Any
 * sensitive value must be encoded before calling this method.
 *
 *
 * @param sb
 *            The target string builder.
 * @param status
 *            status class name.
 * @param cols
 *            Column titles (HTML).
 * @throws IOException
 */
public static void generateRow(StrBuilder sb, String status, Object... cols) throws IOException {
	sb.append("<tr>");

	sb.append(("<td class='icon'><img src='?icon=" + escapeHtml4(status) + "'></td>"));

	for (Object obj : cols) {
		sb.append("<td>");
		if (obj != null) {

			if (obj instanceof Date) {
				DateFormat dateFormat = getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
				sb.append(dateFormat.format((Date) obj));
			} else {
				sb.append(obj.toString());
			}
		}
		sb.append("</td>");

	}
	sb.append("</tr>");
}
 
Example #23
Source File: HtmlUtils.java    From appstatus with Apache License 2.0 6 votes vote down vote up
/**
 * Outputs table headers.
 *
 * <p>
 * <b>WARNING</b> : this method accepts HTML content as table headers. Any
 * sensitive value must be encoded before calling this method.
 *
 * @param sb
 *            The target string builder.
 * @param cols
 *            Column titles (HTML).
 */
public static void generateHeaders(StrBuilder sb, Object... cols) {
	sb.append("<thead><tr>");
	for (Object obj : cols) {
		sb.append("<th>");
		if (obj != null) {

			if (obj instanceof Long) {
				sb.append(((Long) obj).longValue());
			} else {
				sb.append(obj.toString());
			}
		}
		sb.append("</th>");
	}
	sb.append("</tr></thead><tbody>");
}
 
Example #24
Source File: Runner.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * List available algorithms. This is displayed to the user when no valid
 * algorithm is given in the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
	StrBuilder strBuilder = new StrBuilder();

	strBuilder
		.appendNewLine()
		.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
		.appendNewLine()
		.appendln("Available algorithms:");

	for (Driver algorithm : driverFactory) {
		strBuilder.append("  ")
			.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
			.append(algorithm.getShortDescription()).appendNewLine();
	}

	return strBuilder.toString();
}
 
Example #25
Source File: AT_07f_LongestWordMin.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"first\", \"information\");",
			"at.addRule();",
			"at.addRow(\"second\", \"info\");",
			"at.addRule();",
			"",
			"at.getRenderer().setCWC(new CWC_LongestWordMax(8));",
			"System.out.println(at.render());",
			"",
			"at.getRenderer().setCWC(new CWC_LongestWordMax(new int[]{4,-1}));",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #26
Source File: AT_04b_Padding_Row.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"row 1 col 1\", \"row 1 col 2\");",
			"at.addRule();",
			"AT_Row row = at.addRow(\"row 2 col 1\", \"row 2 col 2\");",
			"at.addRule();",
			"",
			"row.setPaddingTopChar('v');",
			"row.setPaddingBottomChar('^');",
			"row.setPaddingLeftChar('>');",
			"row.setPaddingRightChar('<');",
			"row.setTextAlignment(TextAlignment.CENTER);",
			"row.setPadding(1);",
			"System.out.println(at.render(33));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #27
Source File: AbstractReader.java    From swagger-maven-plugin with Apache License 2.0 6 votes vote down vote up
protected String getOperationId(Method method, String httpMethod) {
if (this.operationIdFormat == null) {
	this.operationIdFormat = OPERATION_ID_FORMAT_DEFAULT;
}

String packageName = method.getDeclaringClass().getPackage().getName();
String className = method.getDeclaringClass().getSimpleName();
String methodName = method.getName();
    
StrBuilder sb = new StrBuilder(this.operationIdFormat);
sb.replaceAll("{{packageName}}", packageName);
sb.replaceAll("{{className}}", className);
sb.replaceAll("{{methodName}}", methodName);
sb.replaceAll("{{httpMethod}}", httpMethod);

return sb.toString();
}
 
Example #28
Source File: AT_06d_NewGrid.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"TA_Grid myGrid = TA_Grid.create(\"grid using UTF-8 light border characters\")",
			"		.addCharacterMap(TA_GridConfig.RULESET_NORMAL, ' ', '#', '&', '#', '#', '%', '%', '+', '+', '+', '#', '%')",
			";",
			"",
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"rc 11\", \"rc 12\");",
			"at.addRule();",
			"at.addRow(\"rc 21\", \"rc 22\");",
			"at.addRule();",
			"at.getContext().setWidth(13);",
			"",
			"at.getContext().setGrid(myGrid);",
			"System.out.println(at.render());",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}
 
Example #29
Source File: Runner.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * List available algorithms. This is displayed to the user when no valid
 * algorithm is given in the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
	StrBuilder strBuilder = new StrBuilder();

	strBuilder
		.appendNewLine()
		.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
		.appendNewLine()
		.appendln("Available algorithms:");

	for (Driver algorithm : driverFactory) {
		strBuilder.append("  ")
			.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
			.append(algorithm.getShortDescription()).appendNewLine();
	}

	return strBuilder.toString();
}
 
Example #30
Source File: AT_09a_URIs.java    From asciitable with Apache License 2.0 5 votes vote down vote up
@Override
public StrBuilder getSource(){
	String[] source = new String[]{
			"AsciiTable at = new AsciiTable();",
			"at.addRule();",
			"at.addRow(\"scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]\", \"scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]\");",
			"at.addRule();",
			"at.addRow(null, \"scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]\");",
			"at.addRule();",
			"at.addRow(\"abc://username:[email protected]:123/path/data?key=value#fragid1\", \"abc://username:[email protected]:123/path/data?key=value#fragid1\");",
			"at.addRule();",
			"at.addRow(null, \"abc://username:[email protected]:123/path/data?key=value#fragid1\");",
			"at.addRule();",
			"at.addRow(\"urn:example:mammal:monotreme:echidna\", \"urn:example:mammal:monotreme:echidna\");",
			"at.addRule();",
			"at.addRow(null, \"urn:example:mammal:monotreme:echidna\");",
			"at.addRule();",
			"at.addRow(\"http://www.example.com/test1/test2\", \"http://www.example.com/test1/test2\");",
			"at.addRule();",
			"at.addRow(null, \"http://www.example.com/test1/test2\");",
			"at.addRule();",
			"at.addRow(\"mailto:[email protected]\", \"mailto:[email protected]\");",
			"at.addRule();",
			"at.addRow(null, \"mailto:[email protected]\");",
			"at.addRule();",
			"",
			"System.out.println(at.render(73));",
	};
	return new StrBuilder().appendWithSeparators(source, "\n");
}