本文整理汇总了Java中it.unimi.dsi.lang.MutableString.append方法的典型用法代码示例。如果您正苦于以下问题:Java MutableString.append方法的具体用法?Java MutableString.append怎么用?Java MutableString.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.lang.MutableString
的用法示例。
在下文中一共展示了MutableString.append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetch
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
public void fetch(URI uri) throws IOException {
this.url = uri;
MutableString s = new MutableString();
s.append("<html><head><title>").append(uri).append("</title></head>\n");
s.append("<body>\n");
try {
final int host = Integer.parseInt(uri.getHost());
final int page = Integer.parseInt(uri.getRawPath().substring(1));
final Random random = new Random(host << 32 | page);
for(int i = 0; i < 10; i++)
s.append("<a href=\"http://").append(host).append('/').append(random.nextInt(10000)).append("\">Link ").append(i).append("</a>\n");
s.append("<a href=\"http://").append(random.nextInt(1000)).append('/').append(random.nextInt(10000)).append("\">External link ").append("</a>\n");
}
catch(NumberFormatException e) {}
s.append("</body></html>\n");
inspectableBufferedInputStream.write(ByteBuffer.wrap(Util.toByteArray(s.toString())));
}
示例2: recToString
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
private void recToString(final Node n, final MutableString printPrefix, final MutableString result, final MutableString path, final int level) {
if (n == null) return;
result.append(printPrefix).append('(').append(level).append(')');
if (n.path != null) {
path.append(n.path);
result.append(" path: (").append(n.path.length()).append(") :").append(n.path);
}
result.append('\n');
path.append('0');
recToString(n.left, printPrefix.append('\t').append("0 => "), result, path, level + 1);
path.charAt(path.length() - 1, '1');
recToString(n.right, printPrefix.replace(printPrefix.length() - 5, printPrefix.length(), "1 => "), result, path, level + 1);
path.delete(path.length() - 1, path.length());
printPrefix.delete(printPrefix.length() - 6, printPrefix.length());
path.delete((int)(path.length() - n.path.length()), path.length());
}
示例3: recToString
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
private void recToString(final Node n, final MutableString printPrefix, final MutableString result, final MutableString path, final int level) {
if (n == null) return;
result.append(printPrefix).append('(').append(level).append(')');
if (n.path != null) {
path.append(n.path);
result.append(" path:").append(n.path);
}
result.append('\n');
path.append('0');
recToString(n.left, printPrefix.append('\t').append("0 => "), result, path, level + 1);
path.charAt(path.length() - 1, '1');
recToString(n.right, printPrefix.replace(printPrefix.length() - 5, printPrefix.length(), "1 => "), result, path, level + 1);
path.delete(path.length() - 1, path.length());
printPrefix.delete(printPrefix.length() - 6, printPrefix.length());
//System.err.println("Path now: " + path + " Going to delete from " + (path.length() - n.pathLength));
path.delete((int)(path.length() - n.path.length()), path.length());
}
示例4: getValueString
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
public String getValueString(double position, WindowFunction windowFunction) {
// //LOG.info("getValueString");
MutableString buffer = new MutableString();
buffer.append(entry.toString());
buffer.replace("\n", "<br>");
if (this.isPaired()) {
buffer.append("----------------------" + "<br>");
buffer.append("Mate start = " + getMate().positionString() + "<br>");
buffer.append("Mate is mapped = " + (getMate().isMapped() ? "yes" : "no") + "<br>");
//buf.append("Pair is proper = " + (getProperPairFlag() ? "yes" : "no") + "<br>");
if (getChr().equals(getMate().getChr())) {
buffer.append("Insert size = " + getInferredInsertSize() + "<br>");
}
if (getPairOrientation().length() > 0) {
buffer.append("Pair orientation = " + getPairOrientation() + "<br>");
}
if (isFirstOfPair()) {
buffer.append("First of pair <br>");
}
if (isSecondOfPair()) {
buffer.append("Second of pair <br>");
}
}
return buffer.toString();
}
示例5: binary
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
public static String binary(long l, boolean reverse) {
if (reverse) l = Long.reverse(l);
final MutableString s = new MutableString().append("0000000000000000000000000000000000000000000000000000000000000000000000000").append(Long.toBinaryString(l));
s.delete(0, s.length() - 64);
s.insert(0, '\n');
s.append('\n');
for(int i = 0; i < 32; i++) s.append(" ").append(Long.toHexString((l >>> (31 - i) * 2) & 0x3));
s.append('\n');
for(int i = 0; i < 16; i++) s.append(" ").append(Long.toHexString((l >>> (15 - i) * 4) & 0xF));
s.append('\n');
return s.toString();
}
示例6: binary
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
public static String binary(long l, boolean reverse) {
if (reverse) l = Long.reverse(l);
MutableString s = new MutableString().append("0000000000000000000000000000000000000000000000000000000000000000000000000").append(Long.toBinaryString(l));
s.delete(0, s.length() - 64);
s.insert(0, '\n');
s.append('\n');
for(int i = 0; i < 32; i++) s.append(" ").append(Long.toHexString((l >>> (31 - i) * 2) & 0x3));
s.append('\n');
for(int i = 0; i < 16; i++) s.append(" ").append(Long.toHexString((l >>> (15 - i) * 4) & 0xF));
s.append('\n');
return s.toString();
}
示例7: toString
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
public String toString() {
MutableString ms = new MutableString();
IntIterator ii;
ms.append( "Nodes: " + numNodes() + "\nArcs: " + numArcs() + "\n" );
for ( int i = 0; i < numNodes(); i++ ) {
ms.append( "Successors of " + i + " (degree " + outdegree( i ) + "):" );
ii = successors( i );
while ( ii.hasNext() )
ms.append( " " + ii.nextInt() );
ms.append( "\n" );
}
return ms.toString();
}
示例8: appendNonNull
import it.unimi.dsi.lang.MutableString; //导入方法依赖的package包/类
/**
* @param b Buffer to append to.
* @param str String to append if not null.
* @param substr Suffix or prefix to use if <code>str</code> is not null.
* @param suffix True if <code>substr</code> is a suffix.
*/
private void appendNonNull(MutableString b, String str, String substr,
boolean suffix) {
if (str != null && str.length() > 0) {
if (!suffix) {
b.append(substr);
}
b.append(str);
if (suffix) {
b.append(substr);
}
}
}