⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syncstate.java

📁 实现了SyncML无线同步协议
💻 JAVA
字号:
/** * Copyright (C) 2003-2004 Funambol * *  This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  */package sync4j.framework.server.session;import java.util.ArrayList;import sync4j.framework.core.AbstractCommand;import sync4j.framework.core.Alert;import sync4j.framework.core.Map;import sync4j.framework.core.Sync;/**  * This class represents the state of the Syncronization process because cache  * all informations that could be used in that process. * It is set during the Initialization process. * * @author Luigia Fassina @ funambol.com * @version $Id: SyncState.java,v 1.7 2004/05/20 16:16:34 luigiafassina Exp $ */public class SyncState {        // ---------------------------------------------------------- Public Methods        /**     * Cache all AbstractCommand (Alert, Put, Get)     */    private ArrayList listClientCommands = new ArrayList();       public void addClientCommands(AbstractCommand[] clientCommands) {        for (int i=0; ((clientCommands != null) && (i<clientCommands.length)); i++) {            listClientCommands.add(clientCommands[i]);        }    }        public AbstractCommand[] getClientCommands() {        return (AbstractCommand[])listClientCommands.toArray(new AbstractCommand[listClientCommands.size()]);    }    /**     * Cache the AlertCommand     */    private ArrayList listClientAlerts = new ArrayList();       public void addClientAlerts(Alert[] clientAlerts) {        for (int i=0; ((clientAlerts != null) && (i<clientAlerts.length)); i++) {            listClientAlerts.add(clientAlerts[i]);        }    }        public void resetClientAlerts() {        listClientAlerts = new ArrayList();    }        public Alert[] getClientAlerts() {        return (Alert[])listClientAlerts.toArray(new Alert[listClientAlerts.size()]);    }        /**     * Cache the MapCommand     */    private ArrayList listMapCommands = new ArrayList();        public void addMapCommands(Map[] mapCommands) {        for (int i=0; ((mapCommands != null) && (i<mapCommands.length)); i++) {            listMapCommands.add(mapCommands[i]);        }    }        public Map[] getMapCommands() {        return (Map[])listMapCommands.toArray(new Map[listMapCommands.size()]);    }        /**     * Cache the SyncCommand     */    private ArrayList listSyncCommands = new ArrayList();        public void addSyncCommands(Sync[] syncCommands) {        for (int i=0; ((syncCommands != null) && (i<syncCommands.length)); i++) {            listSyncCommands.add(syncCommands[i]);        }    }        public Sync[] getSyncCommands() {        return (Sync[])listSyncCommands.toArray(new Sync[listSyncCommands.size()]);    }        /**     * Cache the server modification commands: in the case of multimessage these      * commands must be sent only when the client has sent its package     */    private ArrayList listServerModifications = new ArrayList();        public void setServerModifications(AbstractCommand[] serverModifications) {        for (int i=0; ((serverModifications != null) && (i<serverModifications.length)); i++) {            listServerModifications.add(serverModifications[i]);        }    }        public AbstractCommand[] getServerModifications() {        return (AbstractCommand[])listServerModifications.toArray(new AbstractCommand[listServerModifications.size()]);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -