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

📄 observable.java

📁 利用SyncML开发客户端程序的中间件
💻 JAVA
字号:
/*
 * Copyright (C) 2006-2007 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 com.funambol.util;

import com.funambol.util.Observer;

/**
 * this interface is used by classes running tasks to implements Observer / Observable 
 * paradigm.
 *<p>
 * Eache watchable can have multiple watchers and must call the method update(object) of 
 * his watchers each time the watchable state changes.
 */

public interface Observable extends Runnable{
    /**
     * add a observer to this observable
     *
     * @return false if observable
     * does not support more observers 
     *
     */ 
    public boolean addObserver(Observer o);
    
    /**
     * remove an observer from this observable
     */ 
    public void removeObserver (Observer o);
    
    
    /**
     * returns a long between 0 an 100 that indicate the %
     * of the task completed. Should be formatted inside the watchable, i.e.
     * returning 13.742913341 is a bad thing :)
     * long is returned instead of double because of cld 1.0 limitations
     */
    public long getProgressPercent();
    
    /**
     * returns a integere between 0 and max giving the progress of the task.
     * if we are syncronizing 37 contacts progress should return the number of
     * contacts syncronized.
     */
    public int getProgress();
    
    /**
     * returns the number of steps the task will use. if we are syncronizing 37 contacts
     * this should return 37
     */ 
    public int getMax();
     
    /**
     * a string that describes the current operation. 
     * if we are syncronizing contacts this should
     * be something like "syncronizing contacts"
     */
    public String getMessage();
    
    /**
     * boolean returning true if task is finished
     */
    public boolean isFinished();
}

⌨️ 快捷键说明

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