use of com.ichi2.libanki.Utils.checksum in project AnkiChinaAndroid by ankichinateam.
the class Models method scmhash.
/**
* Schema hash ***********************************************************************************************
*/
/**
* Return a hash of the schema, to see if models are compatible.
*/
public String scmhash(Model m) {
String s = "";
JSONArray flds = m.getJSONArray("flds");
for (int i = 0; i < flds.length(); ++i) {
s += flds.getJSONObject(i).getString("name");
}
JSONArray tmpls = m.getJSONArray("tmpls");
for (int i = 0; i < tmpls.length(); ++i) {
JSONObject t = tmpls.getJSONObject(i);
s += t.getString("name");
}
return Utils.checksum(s);
}
use of com.ichi2.libanki.Utils.checksum in project Anki-Android by ankidroid.
the class Models method scmhash.
/*
Schema hash ***********************************************************************************************
*/
@NonNull
@Override
public String scmhash(Model m) {
StringBuilder s = new StringBuilder();
JSONArray flds = m.getJSONArray("flds");
for (JSONObject fld : flds.jsonObjectIterable()) {
s.append(fld.getString("name"));
}
JSONArray tmpls = m.getJSONArray("tmpls");
for (JSONObject t : tmpls.jsonObjectIterable()) {
s.append(t.getString("name"));
}
return Utils.checksum(s.toString());
}
Aggregations