From 5def8c7b73c3239c59a3ff004a52bafbc7fc0847 Mon Sep 17 00:00:00 2001 From: Saanteye <1269321486@qq.com> Date: Fri, 19 Apr 2024 19:09:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/micode/notes/gtask/data/TaskList.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Notes/src/net/micode/notes/gtask/data/TaskList.java b/src/Notes/src/net/micode/notes/gtask/data/TaskList.java index 4ea21c5..d3b34cf 100644 --- a/src/Notes/src/net/micode/notes/gtask/data/TaskList.java +++ b/src/Notes/src/net/micode/notes/gtask/data/TaskList.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package net.micode.notes.gtask.data; +package net.micode.notes.gtask.data;//打开这个包// -import android.database.Cursor; -import android.util.Log; +import android.database.Cursor;//数据获取并且使用// +import android.util.Log;//传入参数// -import net.micode.notes.data.Notes; -import net.micode.notes.data.Notes.NoteColumns; -import net.micode.notes.gtask.exception.ActionFailureException; -import net.micode.notes.tool.GTaskStringUtils; +import net.micode.notes.data.Notes;//管理数据// +import net.micode.notes.data.Notes.NoteColumns;//定义列或字段// +import net.micode.notes.gtask.exception.ActionFailureException;//用于处理与Google任务集成相关的操作失败的异常// +import net.micode.notes.tool.GTaskStringUtils;//用于处理与Google任务集成相关的字符串操作的实用方法或功能。// -import org.json.JSONException; -import org.json.JSONObject; +import org.json.JSONException;//用于处理JSON解析过程中可能发生的异常// +import org.json.JSONObject;//创建和操作JSON对象,包括添加、获取和修改JSON对象中的键值对等操作// -import java.util.ArrayList; +import java.util.ArrayList;//存储一组对象并且可以动态地调整大小// public class TaskList extends Node { @@ -41,7 +41,7 @@ public class TaskList extends Node { super(); mChildren = new ArrayList(); mIndex = 1; - } + }//定义公开类// public JSONObject getCreateAction(int actionId) { JSONObject js = new JSONObject(); @@ -72,7 +72,7 @@ public class TaskList extends Node { } return js; - } + }//生成一个包含创建操作信息的JSON对象// public JSONObject getUpdateAction(int actionId) { JSONObject js = new JSONObject(); @@ -101,7 +101,7 @@ public class TaskList extends Node { } return js; - } + }//生成一个包含更新操作信息的JSON对象// public void setContentByRemoteJSON(JSONObject js) { if (js != null) { @@ -127,7 +127,7 @@ public class TaskList extends Node { throw new ActionFailureException("fail to get tasklist content from jsonobject"); } } - } + }//根据远程 JSON 对象来设置当前对象的相关属性// public void setContentByLocalJSON(JSONObject js) { if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)) { @@ -155,7 +155,7 @@ public class TaskList extends Node { Log.e(TAG, e.toString()); e.printStackTrace(); } - } + }//根据提供的 JSON 对象设置当前对象的名称// public JSONObject getLocalJSONFromContent() { try { @@ -181,7 +181,7 @@ public class TaskList extends Node { e.printStackTrace(); return null; } - } + }//将当前对象的内容转换为一个 JSON 对象// public int getSyncAction(Cursor c) { try { @@ -214,11 +214,11 @@ public class TaskList extends Node { } return SYNC_ACTION_ERROR; - } + }//通过检查传入的 Cursor 对象中的不同字段来确定同步操作的类型,返回一个表示操作的整数值// public int getChildTaskCount() { return mChildren.size(); - } + }//返回子对象的数量// public boolean addChildTask(Task task) { boolean ret = false; @@ -232,7 +232,7 @@ public class TaskList extends Node { } } return ret; - } + }//向当前任务对象的子任务列表中添加一个新的子任务// public boolean addChildTask(Task task, int index) { if (index < 0 || index > mChildren.size()) { @@ -258,7 +258,7 @@ public class TaskList extends Node { } return true; - } + }//在特定索引位置向当前任务对象的子任务列表中添加一个新的子任务// public boolean removeChildTask(Task task) { boolean ret = false; @@ -279,7 +279,7 @@ public class TaskList extends Node { } } return ret; - } + }//用于从当前任务对象的子任务列表中移除特定的子任务// public boolean moveChildTask(Task task, int index) { @@ -297,7 +297,7 @@ public class TaskList extends Node { if (pos == index) return true; return (removeChildTask(task) && addChildTask(task, index)); - } + }//用于移动子任务列表中特定任务的位置到指定的索引位置 // public Task findChildTaskByGid(String gid) { for (int i = 0; i < mChildren.size(); i++) { @@ -307,11 +307,11 @@ public class TaskList extends Node { } } return null; - } + }//根据给定的 GID在子任务列表中查找相应的任务对象// public int getChildTaskIndex(Task task) { return mChildren.indexOf(task); - } + }//获取给定任务对象在子任务列表中的索引位置// public Task getChildTaskByIndex(int index) { if (index < 0 || index >= mChildren.size()) { @@ -319,7 +319,7 @@ public class TaskList extends Node { return null; } return mChildren.get(index); - } + }//根据给定的索引位置获取子任务列表中相应索引处的任务对象// public Task getChilTaskByGid(String gid) { for (Task task : mChildren) { @@ -327,17 +327,17 @@ public class TaskList extends Node { return task; } return null; - } + }//根据给定的 GID在子任务列表中查找相应的任务对象// public ArrayList getChildTaskList() { return this.mChildren; - } + }//返回当前对象的子任务列表的引用// public void setIndex(int index) { this.mIndex = index; - } + }//设置任务对象的索引值// public int getIndex() { return this.mIndex; - } + }//返回任务对象的当前索引值 mIndex// } -- 2.34.1