/*
 * 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 {
  // 定义同步动作常量
    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;

    // 节点ID
    private String mGid;

    // 节点名称
    private String mName;

    // 最后修改时间
    private long mLastModified;

    // 是否已删除
    private boolean mDeleted;

    // 构造函数
 // 构造函数，初始化Node对象
    public Node() {
        // 初始化mGid为null
        mGid = null;
        // 初始化mName为空字符串
        mName = "";
        // 初始化mLastModified为0
        mLastModified = 0;
        // 初始化mDeleted为false
        mDeleted = false;
    }

// 获取创建动作
    public abstract JSONObject getCreateAction(int actionId);

// 获取更新动作
    public abstract JSONObject getUpdateAction(int actionId);

// 根据远程JSON设置内容
    public abstract void setContentByRemoteJSON(JSONObject js);

// 根据本地JSON设置内容
    public abstract void setContentByLocalJSON(JSONObject js);

// 从内容中获取本地JSON
    public abstract JSONObject getLocalJSONFromContent();

// 根据游标获取同步动作
    public abstract int getSyncAction(Cursor c);

 // 设置GID
    public void setGid(String gid) {
        this.mGid = gid;
    }

 // 设置名字的方法
    public void setName(String name) {
        // 将传入的name参数赋值给成员变量mName
        this.mName = name;
    }

 // 设置最后修改时间
    public void setLastModified(long lastModified) {
        this.mLastModified = lastModified;
    }

// 设置是否被删除的标志
    public void setDeleted(boolean deleted) {
        this.mDeleted = deleted;
    }

 // 获取Gid
    public String getGid() {
        return this.mGid;
    }

 // 获取名字
    public String getName() {
        return this.mName;
    }

 // 获取最后修改时间
    public long getLastModified() {
        return this.mLastModified;
    }

    public boolean getDeleted() {
        // 返回mDeleted的值
        return this.mDeleted;
    }

}
