diff --git a/src/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java b/src/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java index 79a4095..4751c8b 100644 --- a/src/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java +++ b/src/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java @@ -37,7 +37,9 @@ import org.json.JSONObject; import java.util.ArrayList; - +/** + * SqlNote类代表一个笔记实体,它可以从数据库中存储和检索。 + */ public class SqlNote { private static final String TAG = SqlNote.class.getSimpleName(); @@ -121,7 +123,10 @@ public class SqlNote { private ContentValues mDiffNoteValues; private ArrayList mDataList; - + /** + * 构造一个新的SqlNote实例。 + * @param context 上下文对象。 + */ public SqlNote(Context context) { mContext = context; mContentResolver = context.getContentResolver(); @@ -142,7 +147,11 @@ public class SqlNote { mDiffNoteValues = new ContentValues(); mDataList = new ArrayList(); } - + /** + * 从游标构造SqlNote实例。 + * @param context 上下文对象。 + * @param c 数据游标。 + */ public SqlNote(Context context, Cursor c) { mContext = context; mContentResolver = context.getContentResolver(); @@ -153,7 +162,11 @@ public class SqlNote { loadDataContent(); mDiffNoteValues = new ContentValues(); } - + /** + * 从ID加载SqlNote实例。 + * @param context 上下文对象。 + * @param id 笔记ID。 + */ public SqlNote(Context context, long id) { mContext = context; mContentResolver = context.getContentResolver(); @@ -225,7 +238,11 @@ public class SqlNote { c.close(); } } - + /** + * 根据JSON对象设置笔记内容。 + * @param js JSON对象。 + * @return 设置成功返回true,否则返回false。 + */ public boolean setContent(JSONObject js) { try { JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE); @@ -358,7 +375,10 @@ public class SqlNote { } return true; } - + /** + * 获取笔记内容的JSON对象。 + * @return 笔记内容的JSON对象。 + */ public JSONObject getContent() { try { JSONObject js = new JSONObject(); @@ -439,7 +459,10 @@ public class SqlNote { public boolean isNoteType() { return mType == Notes.TYPE_NOTE; } - + /** + * 提交笔记到数据库。 + * @param validateVersion 是否验证版本。 + */ public void commit(boolean validateVersion) { if (mIsCreate) { if (mId == INVALID_ID && mDiffNoteValues.containsKey(NoteColumns.ID)) {