java.lang.StringBuilder#append ( )源码实例Demo

下面列出了java.lang.StringBuilder#append ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: algorithms   文件: Utilities.java
public static String toString(int[][] a) {
    if (a == null) return "[[]]";
    StringBuilder b = new StringBuilder();

    b.append("\n[\n");
    for (int i = 0; i < a.length; i ++) {
        b.append("\t[");
        for (int j = 0; j < a[i].length; j ++) {
            b.append(a[i][j]);
            if (j < a[i].length - 1) b.append(", ");
        }
        b.append("]\n");
    }
    b.append("]");

    return b.toString();
}
 
源代码2 项目: Java   文件: Graphs.java
/**
 * this gives a list of verticies in the graph and their adjacencies
 *
 * @return returns a string describing this graph
 */
@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    for (Vertex v : verticies) {
        sb.append("Vertex: ");
        sb.append(v.data);
        sb.append("\n");
        sb.append("Adjacent verticies: ");
        for (Vertex v2 : v.adjacentVerticies) {
            sb.append(v2.data);
            sb.append(" ");
        }
        sb.append("\n");
    }
    return sb.toString();
}
 
源代码3 项目: android_9.0.0_r45   文件: Plog.java
private String formatCurve(String name, float[] xs, float[] ys) {
    StringBuilder sb = new StringBuilder();
    sb.append("curve: " + name + ": [");
    int n = xs.length <= ys.length ? xs.length : ys.length;
    for (int i = 0; i < n; i++) {
        sb.append("(" + xs[i] + "," + ys[i] + "),");
    }
    sb.append("]");
    return sb.toString();
}
 
源代码4 项目: nalu   文件: ApplicationWithComposite04Impl.java
@Override
public void loadDefaultRoutes() {
  StringBuilder sb01 = new StringBuilder();
  this.startRoute = "/mockShell/route04";
  sb01.append("found startRoute >>/mockShell/route04<<");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
  sb01.setLength(0);
  ClientLogger.get().logDetailed(sb01.toString(), 2);
}
 
源代码5 项目: ecosys   文件: PostDataFromSpark.java
public static void main(String[] args) {
  // type is vertex or edge
  String type = args[0];
  // graph name
  String graphName = args[1];
  // ddl loading job name
  String loadingJobName = args[2];
  // file name declared in ddl loading job
  String fileName = args[3];
  // file separator
  String separator = args[4];
  // end of line charactor
  String endOfLineChar = args[5];
  // path to input data
  inputPath = args[6];

  postInfo = "ddl/" + graphName+ "?tag=" + loadingJobName + "&filename="
            + fileName + "&sep=" + separator + "&eol=" + endOfLineChar;

  // create a spark session
  SparkSession sc = SparkSession.builder().getOrCreate();

  StringBuilder sbData = new StringBuilder();
  List<Row> arrayList= new ArrayList<>();

  // read input file to spark
  Dataset<Row> dataInSpark = sc.read().csv(inputPath);
  arrayList = dataInSpark.collectAsList();

  // convert Dataset<Row> to string, which is the payload info to post into tigergraph
  for(Row cur : arrayList) {
    String tmp = cur.toString();
    sbData.append(tmp.substring(1, tmp.length() - 1) + "\n");

  }
  String data = sbData.toString();
  sendHTTPRequest(postInfo, data, type);
}
 
@Override
public void loadShells() {
  StringBuilder sb01 = new StringBuilder();
  sb01.append("load shell references");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
  super.shellConfiguration.getShells().add(new ShellConfig("/mockShell", "com.github.nalukit.nalu.processor.common.MockShell"));
  sb01.setLength(0);
  sb01.append("register shell >>/mockShell<< with class >>com.github.nalukit.nalu.processor.common.MockShell<<");
  ClientLogger.get().logDetailed(sb01.toString(), 3);
}
 
源代码7 项目: nalu   文件: ApplicationWithComposite03Impl.java
@Override
public void logProcessorVersion() {
  ClientLogger.get().logDetailed("", 0);
  ClientLogger.get().logDetailed("=================================================================================", 0);
  StringBuilder sb01 = new StringBuilder();
  sb01.append("Nalu processor version  >>2.0.1<< used to generate this source");
  ClientLogger.get().logDetailed(sb01.toString(), 0);
  ClientLogger.get().logDetailed("=================================================================================", 0);
  ClientLogger.get().logDetailed("", 0);
}
 
@Override
public void loadDefaultRoutes() {
  StringBuilder sb01 = new StringBuilder();
  this.startRoute = "/mockShell/route01";
  sb01.append("found startRoute >>/mockShell/route01<<");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
  sb01.setLength(0);
  ClientLogger.get().logDetailed(sb01.toString(), 2);
}
 
@Override
public void loadRoutes() {
  StringBuilder sb01 = new StringBuilder();
  sb01.append("load routes");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
  super.routerConfiguration.getRouters().add(new RouteConfig("/mockShell/route01/*", Arrays.asList(new String[]{"parameter01"}), "selector01", "com.github.nalukit.nalu.processor.common.ui.component01.Controller01"));
  sb01.setLength(0);
  sb01.append("register route >>/mockShell/route01/*<< with parameter >>parameter01<< for selector >>selector01<< for controller >>com.github.nalukit.nalu.processor.common.ui.component01.Controller01<<");
  ClientLogger.get().logDetailed(sb01.toString(), 3);
}
 
源代码10 项目: nalu   文件: MyApplicationImpl.java
@Override
public void loadDefaultRoutes() {
  StringBuilder sb01 = new StringBuilder();
  this.startRoute = "/mockShell/route01";
  sb01.append("found startRoute >>/mockShell/route01<<");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
  sb01.setLength(0);
  ClientLogger.get().logDetailed(sb01.toString(), 2);
}
 
源代码11 项目: nalu   文件: ApplicationWithComposite07Impl.java
@Override
public void logProcessorVersion() {
  ClientLogger.get().logDetailed("", 0);
  ClientLogger.get().logDetailed("=================================================================================", 0);
  StringBuilder sb01 = new StringBuilder();
  sb01.append("Nalu processor version  >>2.0.1<< used to generate this source");
  ClientLogger.get().logDetailed(sb01.toString(), 0);
  ClientLogger.get().logDetailed("=================================================================================", 0);
  ClientLogger.get().logDetailed("", 0);
}
 
源代码12 项目: nalu   文件: ApplicationWithTrackerImpl.java
@Override
public void logProcessorVersion() {
  ClientLogger.get().logDetailed("", 0);
  ClientLogger.get().logDetailed("=================================================================================", 0);
  StringBuilder sb01 = new StringBuilder();
  sb01.append("Nalu processor version  >>2.0.1<< used to generate this source");
  ClientLogger.get().logDetailed(sb01.toString(), 0);
  ClientLogger.get().logDetailed("=================================================================================", 0);
  ClientLogger.get().logDetailed("", 0);
}
 
源代码13 项目: android-unicode   文件: Base64.java
public static String encode(byte[] data)
{
    char[] tbl = {
        'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
        'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
        'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
        'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' };

    StringBuilder buffer = new StringBuilder();
    int pad = 0;
    for (int i = 0; i < data.length; i += 3) {

        int b = ((data[i] & 0xFF) << 16) & 0xFFFFFF;
        if (i + 1 < data.length) {
            b |= (data[i+1] & 0xFF) << 8;
        } else {
            pad++;
        }
        if (i + 2 < data.length) {
            b |= (data[i+2] & 0xFF);
        } else {
            pad++;
        }

        for (int j = 0; j < 4 - pad; j++) {
            int c = (b & 0xFC0000) >> 18;
            buffer.append(tbl[c]);
            b <<= 6;
        }
    }
    for (int j = 0; j < pad; j++) {
        buffer.append("=");
    }

    return buffer.toString();
}
 
源代码14 项目: nalu   文件: GenerateWithIsComponentCreatorImpl.java
@Override
public void loadShells() {
  StringBuilder sb01 = new StringBuilder();
  sb01.append("load shell references");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
  super.shellConfiguration.getShells().add(new ShellConfig("/mockShell", "com.github.nalukit.nalu.processor.common.MockShell"));
  sb01.setLength(0);
  sb01.append("register shell >>/mockShell<< with class >>com.github.nalukit.nalu.processor.common.MockShell<<");
  ClientLogger.get().logDetailed(sb01.toString(), 3);
}
 
源代码15 项目: openjdk-jdk9   文件: CompactStringsInitialCoder.java
public static void test(String expected, String actual) {
   if (!expected.equals(actual)) {
       StringBuilder sb = new StringBuilder();
       sb.append("Expected = ");
       sb.append(expected);
       sb.append(", actual = ");
       sb.append(actual);
       throw new IllegalStateException(sb.toString());
   }
}
 
源代码16 项目: nalu   文件: ApplicationWithTrackerImpl.java
@Override
public void loadErrorPopUpController() {
  StringBuilder sb01 = new StringBuilder();
  sb01.append("no ErrorPopUpController found!°");
}
 
源代码17 项目: nalu   文件: MyApplicationImpl.java
@Override
public void loadErrorPopUpController() {
  StringBuilder sb01 = new StringBuilder();
  sb01.append("no ErrorPopUpController found!°");
}
 
private void __fetchRelationshipAutofillHintAscomExampleAndroidAutofillServiceModelAutofillHint(final ArrayMap<String, ArrayList<AutofillHint>> _map) {
  final Set<String> __mapKeySet = _map.keySet();
  if (__mapKeySet.isEmpty()) {
    return;
  }
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT autofillHint,fieldTypeName FROM `AutofillHint` WHERE fieldTypeName IN (");
  final int _inputSize = __mapKeySet.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(")");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _stmt = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : __mapKeySet) {
    if (_item == null) {
      _stmt.bindNull(_argIndex);
    } else {
      _stmt.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_stmt);
  try {
    final int _itemKeyIndex = _cursor.getColumnIndex("fieldTypeName");
    if (_itemKeyIndex == -1) {
      return;
    }
    final int _cursorIndexOfMAutofillHint = _cursor.getColumnIndexOrThrow("autofillHint");
    final int _cursorIndexOfMFieldTypeName = _cursor.getColumnIndexOrThrow("fieldTypeName");
    while(_cursor.moveToNext()) {
      if (!_cursor.isNull(_itemKeyIndex)) {
        final String _tmpKey = _cursor.getString(_itemKeyIndex);
        ArrayList<AutofillHint> _tmpCollection = _map.get(_tmpKey);
        if (_tmpCollection != null) {
          final AutofillHint _item_1;
          final String _tmpMAutofillHint;
          _tmpMAutofillHint = _cursor.getString(_cursorIndexOfMAutofillHint);
          final String _tmpMFieldTypeName;
          _tmpMFieldTypeName = _cursor.getString(_cursorIndexOfMFieldTypeName);
          _item_1 = new AutofillHint(_tmpMAutofillHint,_tmpMFieldTypeName);
          _tmpCollection.add(_item_1);
        }
      }
    }
  } finally {
    _cursor.close();
  }
}
 
@Override
public List<FieldTypeWithHeuristics> getFieldTypesForAutofillHints(List<String> autofillHints) {
  StringBuilder _stringBuilder = StringUtil.newStringBuilder();
  _stringBuilder.append("SELECT DISTINCT typeName, autofillTypes, saveInfo, partition, strictExampleSet, textTemplate, dateTemplate FROM FieldType, AutofillHint WHERE FieldType.typeName = AutofillHint.fieldTypeName AND AutofillHint.autofillHint IN (");
  final int _inputSize = autofillHints.size();
  StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
  _stringBuilder.append(") UNION SELECT DISTINCT typeName, autofillTypes, saveInfo, partition, strictExampleSet, textTemplate, dateTemplate FROM FieldType, ResourceIdHeuristic WHERE FieldType.typeName = ResourceIdHeuristic.fieldTypeName");
  final String _sql = _stringBuilder.toString();
  final int _argCount = 0 + _inputSize;
  final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
  int _argIndex = 1;
  for (String _item : autofillHints) {
    if (_item == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, _item);
    }
    _argIndex ++;
  }
  final Cursor _cursor = __db.query(_statement);
  try {
    final ArrayMap<String, ArrayList<AutofillHint>> _collectionAutofillHints = new ArrayMap<String, ArrayList<AutofillHint>>();
    final ArrayMap<String, ArrayList<ResourceIdHeuristic>> _collectionResourceIdHeuristics = new ArrayMap<String, ArrayList<ResourceIdHeuristic>>();
    final int _cursorIndexOfMTypeName = _cursor.getColumnIndexOrThrow("typeName");
    final int _cursorIndexOfMAutofillTypes = _cursor.getColumnIndexOrThrow("autofillTypes");
    final int _cursorIndexOfMSaveInfo = _cursor.getColumnIndexOrThrow("saveInfo");
    final int _cursorIndexOfMPartition = _cursor.getColumnIndexOrThrow("partition");
    final int _cursorIndexOfStrictExampleSet = _cursor.getColumnIndexOrThrow("strictExampleSet");
    final int _cursorIndexOfTextTemplate = _cursor.getColumnIndexOrThrow("textTemplate");
    final int _cursorIndexOfDateTemplate = _cursor.getColumnIndexOrThrow("dateTemplate");
    final List<FieldTypeWithHeuristics> _result = new ArrayList<FieldTypeWithHeuristics>(_cursor.getCount());
    while(_cursor.moveToNext()) {
      final FieldTypeWithHeuristics _item_1;
      final FieldType _tmpFieldType;
      if (! (_cursor.isNull(_cursorIndexOfMTypeName) && _cursor.isNull(_cursorIndexOfMAutofillTypes) && _cursor.isNull(_cursorIndexOfMSaveInfo) && _cursor.isNull(_cursorIndexOfMPartition) && _cursor.isNull(_cursorIndexOfStrictExampleSet) && _cursor.isNull(_cursorIndexOfTextTemplate) && _cursor.isNull(_cursorIndexOfDateTemplate))) {
        final String _tmpMTypeName;
        _tmpMTypeName = _cursor.getString(_cursorIndexOfMTypeName);
        final Converters.IntList _tmpMAutofillTypes;
        final String _tmp;
        _tmp = _cursor.getString(_cursorIndexOfMAutofillTypes);
        _tmpMAutofillTypes = Converters.storedStringToIntList(_tmp);
        final Integer _tmpMSaveInfo;
        if (_cursor.isNull(_cursorIndexOfMSaveInfo)) {
          _tmpMSaveInfo = null;
        } else {
          _tmpMSaveInfo = _cursor.getInt(_cursorIndexOfMSaveInfo);
        }
        final Integer _tmpMPartition;
        if (_cursor.isNull(_cursorIndexOfMPartition)) {
          _tmpMPartition = null;
        } else {
          _tmpMPartition = _cursor.getInt(_cursorIndexOfMPartition);
        }
        final FakeData _tmpMFakeData;
        final Converters.StringList _tmpStrictExampleSet;
        final String _tmp_1;
        _tmp_1 = _cursor.getString(_cursorIndexOfStrictExampleSet);
        _tmpStrictExampleSet = Converters.storedStringToStringList(_tmp_1);
        final String _tmpTextTemplate;
        _tmpTextTemplate = _cursor.getString(_cursorIndexOfTextTemplate);
        final String _tmpDateTemplate;
        _tmpDateTemplate = _cursor.getString(_cursorIndexOfDateTemplate);
        _tmpMFakeData = new FakeData(_tmpStrictExampleSet,_tmpTextTemplate,_tmpDateTemplate);
        _tmpFieldType = new FieldType(_tmpMTypeName,_tmpMAutofillTypes,_tmpMSaveInfo,_tmpMPartition,_tmpMFakeData);
      }  else  {
        _tmpFieldType = null;
      }
      _item_1 = new FieldTypeWithHeuristics();
      if (!_cursor.isNull(_cursorIndexOfMTypeName)) {
        final String _tmpKey = _cursor.getString(_cursorIndexOfMTypeName);
        ArrayList<AutofillHint> _tmpCollection = _collectionAutofillHints.get(_tmpKey);
        if(_tmpCollection == null) {
          _tmpCollection = new ArrayList<AutofillHint>();
          _collectionAutofillHints.put(_tmpKey, _tmpCollection);
        }
        _item_1.autofillHints = _tmpCollection;
      }
      if (!_cursor.isNull(_cursorIndexOfMTypeName)) {
        final String _tmpKey_1 = _cursor.getString(_cursorIndexOfMTypeName);
        ArrayList<ResourceIdHeuristic> _tmpCollection_1 = _collectionResourceIdHeuristics.get(_tmpKey_1);
        if(_tmpCollection_1 == null) {
          _tmpCollection_1 = new ArrayList<ResourceIdHeuristic>();
          _collectionResourceIdHeuristics.put(_tmpKey_1, _tmpCollection_1);
        }
        _item_1.resourceIdHeuristics = _tmpCollection_1;
      }
      _item_1.fieldType = _tmpFieldType;
      _result.add(_item_1);
    }
    __fetchRelationshipAutofillHintAscomExampleAndroidAutofillServiceModelAutofillHint(_collectionAutofillHints);
    __fetchRelationshipResourceIdHeuristicAscomExampleAndroidAutofillServiceModelResourceIdHeuristic(_collectionResourceIdHeuristics);
    return _result;
  } finally {
    _cursor.close();
    _statement.release();
  }
}
 
@Override
public void loadCompositeReferences() {
  StringBuilder sb01 = new StringBuilder();
  sb01.append("load composite references");
  ClientLogger.get().logDetailed(sb01.toString(), 2);
}