java.util.Observable.clearChanged()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中java.util.Observable.clearChanged()方法的一些代码示例,展示了Observable.clearChanged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.clearChanged()方法的具体详情如下:
包路径:java.util.Observable
类名称:Observable
方法名:clearChanged

Observable.clearChanged介绍

[英]Clears the changed flag for this Observable. After calling clearChanged(), hasChanged() will return false.
[中]清除此可观察对象的已更改标志。调用clearChanged()后,hasChanged()将返回false。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: io.github.oliviercailloux.jmcda/utils

@Override
  public synchronized void clearChanged() {
    super.clearChanged();
  }
}

代码示例来源:origin: nifty-gui/nifty-gui

@Override
public synchronized void clearChanged() {
 super.clearChanged();
}

代码示例来源:origin: com.att.research/grappa

/**
 * Use to indicate that this object has no longer changed, or that it has already notified all of its observers of
 * its most recent change. This method is a convenience method that calls the corresponding protected method of the
 * Observable class.
 *
 * @see java.util.Observable#clearChanged()
 */
@Override
public final void clearChanged()
{
  super.clearChanged();
}

代码示例来源:origin: igvteam/igv

public void clearChanged() {
  super.clearChanged();
}

代码示例来源:origin: triplea-game/triplea

private void notifyObs() {
 super.setChanged();
 super.notifyObservers(gameData);
 super.clearChanged();
}

代码示例来源:origin: ibinti/bugvm

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * If {@code hasChanged()} returns {@code true}, calls the {@code update()}
 * method for every Observer in the list of observers using the specified
 * argument. Afterwards calls {@code clearChanged()}.
 *
 * @param data
 *            the argument passed to {@code update()}.
 */
@SuppressWarnings("unchecked")
public void notifyObservers(Object data) {
  int size = 0;
  Observer[] arrays = null;
  synchronized (this) {
    if (hasChanged()) {
      clearChanged();
      size = observers.size();
      arrays = new Observer[size];
      observers.toArray(arrays);
    }
  }
  if (arrays != null) {
    for (Observer observer : arrays) {
      observer.update(this, data);
    }
  }
}

代码示例来源:origin: stackoverflow.com

setChanged();
notifyObservers();
clearChanged();

相关文章