diff --git a/Node.java b/Node.java deleted file mode 100644 index 68eef35..0000000 --- a/Node.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.micode.notes.gtask.data; - -// 导入必要的包 -import android.database.Cursor; -import org.json.JSONObject; - - -public abstract class Node { - //// 定义同步操作常量,表示不同的同步动作 - //这段代码定义了不同的常量,表示不同的同步操作类型。这些常量用于表示与远程和本地数据同步的动作。每个动作都用一个整数值标识, - // 例如:SYNC_ACTION_ADD_REMOTE 表示添加远程任务, - // SYNC_ACTION_UPDATE_LOCAL 表示更新本地任务, - // SYNC_ACTION_ERROR 表示同步错误等。 - public static final int SYNC_ACTION_NONE = 0; - - public static final int SYNC_ACTION_ADD_REMOTE = 1; - - public static final int SYNC_ACTION_ADD_LOCAL = 2; - - public static final int SYNC_ACTION_DEL_REMOTE = 3; - - public static final int SYNC_ACTION_DEL_LOCAL = 4; - - public static final int SYNC_ACTION_UPDATE_REMOTE = 5; - - public static final int SYNC_ACTION_UPDATE_LOCAL = 6; - - public static final int SYNC_ACTION_UPDATE_CONFLICT = 7; - - public static final int SYNC_ACTION_ERROR = 8; - - //mGid:一个字符串,存储任务的唯一标识符(Google ID),用于区分不同的任务。 - //mName:任务的名称,存储任务的标题或名称。 - //mLastModified:任务的最后修改时间,使用 long 类型(通常是 Unix 时间戳,表示自1970年1月1日以来的毫秒数)。 - //mDeleted:布尔值,表示该任务是否被删除。 - - // 任务的唯一标识符 - private String mGid; - // 任务的名称 - private String mName; - // 最后修改时间 - private long mLastModified; - // 任务是否已删除 - private boolean mDeleted; - - public Node() { - // 默认构造函数,初始化 mGid 为 null - mGid = null; - // 默认构造函数,初始化 mName 为空字符串 - mName = ""; - // 默认构造函数,初始化 mLastModified 为 0 - mLastModified = 0; - // 默认构造函数,初始化 mDeleted 为 false(表示任务未删除) - mDeleted = false; - } - - //getCreateAction(int actionId):根据给定的 actionId,返回一个 JSONObject,表示创建操作的同步动作。具体内容依赖子类实现。 - //getUpdateAction(int actionId):根据给定的 actionId,返回一个 JSONObject,表示更新操作的同步动作。具体内容依赖子类实现。 - //setContentByRemoteJSON(JSONObject js):从远程的 JSON 数据中设置内容。js 是传入的 JSONObject,该方法的具体实现依赖子类。 - //setContentByLocalJSON(JSONObject js):从本地的 JSON 数据中设置内容。js 是传入的 JSONObject,该方法的具体实现依赖子类。 - //getLocalJSONFromContent():将本地内容转换为 JSONObject,返回一个 JSON 对象。 - //getSyncAction(Cursor c):从 Cursor 对象中获取同步操作的动作,返回一个整数,表示当前同步操作的类型。 - public abstract JSONObject getCreateAction(int actionId); - - public abstract JSONObject getUpdateAction(int actionId); - - public abstract void setContentByRemoteJSON(JSONObject js); - - public abstract void setContentByLocalJSON(JSONObject js); - - public abstract JSONObject getLocalJSONFromContent(); - - public abstract int getSyncAction(Cursor c); - - - //这些是 Node 类的 setter 方法,用于设置成员变量的值: - - //setGid(String gid):设置任务的 Gid(Google ID)。 - //setName(String name):设置任务的名称。 - //setLastModified(long lastModified):设置任务的最后修改时间。 - //setDeleted(boolean deleted):设置任务是否被删除。 - public void setGid(String gid) { - this.mGid = gid; - } - - public void setName(String name) { - this.mName = name; - } - - public void setLastModified(long lastModified) { - this.mLastModified = lastModified; - } - - public void setDeleted(boolean deleted) { - this.mDeleted = deleted; - } - - - //这些是 Node 类的 getter 方法,用于获取成员变量的值: - - //getGid():返回任务的 Gid(Google ID)。 - //getName():返回任务的名称。 - //getLastModified():返回任务的最后修改时间。 - //getDeleted():返回任务是否已删除的布尔值。 - public String getGid() { - return this.mGid; - } - - public String getName() { - return this.mName; - } - - public long getLastModified() { - return this.mLastModified; - } - - public boolean getDeleted() { - return this.mDeleted; - } - -}