You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CJR_DXW_CYW/doc/data/Node.java

105 lines
3.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* 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; //引用cursor此公用接口提供对数据库查询返回的结果集的随机读写访问。
import org.json.JSONObject;//引用 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;//同步出现错误
private String mGid; //记录最后一次修改时间
private String mName;//bool类型表明表征是否被删除
private long mLastModified;//记录最后一次修改时间
private boolean mDeleted;//判断 表征是否被删除
//构造函数进行初始化界面没有名字为空最后一次修改时间为0没有修改表征是否删除。
public Node() {
mGid = null;
mName = "";
mLastModified = 0;
mDeleted = false;
}
// 创建JSONObject对象创建操作和更新操作形参是操作号
public abstract JSONObject getCreateAction(int actionId);
public abstract JSONObject getUpdateAction(int actionId);//获取需要更新活动的ID
public abstract void setContentByRemoteJSON(JSONObject js);//都是JSONObject和Curson中的一些操作主要是创建相应的对象进行远端和本地同步操作
public abstract void setContentByLocalJSON(JSONObject js);//声明JSONObject对象抽象类从本地JSON中同步设置目录
public abstract JSONObject getLocalJSONFromContent();//声明JSONObject对象抽象类从目录中获取本地JSON
public abstract int getSyncAction(Cursor c);//声明int抽象类获取同步行为代号
public void setGid(String gid) {
this.mGid = gid;
} //对构造函数中的对象进行赋值或者获取对象的具体内容将gid赋给mGid以下均为Node函数参数的输入与赋值
public void setName(String name) {
this.mName = name;
} //设置名字
public void setLastModified(long lastModified) {
this.mLastModified = lastModified;
}//时间标识
public void setDeleted(boolean deleted) {
this.mDeleted = deleted;
}//删除标识
public String getGid() {
return this.mGid;
}//返回git
public String getName() {
return this.mName;
}//返回mname
public long getLastModified() {
return this.mLastModified;
}//获取时间标识
public boolean getDeleted() {
return this.mDeleted;
}//获取删除标识
}