Test4353056.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:openjdk9 作者:
public void propertyChange(PropertyChangeEvent event) {
    Object value = event.getNewValue();
    if (value.equals(event.getOldValue())) {
        throw new Error("new value is equal to old one");
    }
    if (!this.name.equals(event.getPropertyName())) {
        throw new Error("unexpected property name");
    } else if (this.name.equals(COLOR)) {
        if (!value.equals(this.color)) {
            throw new Error("unexpected object value");
        }
    } else if (this.name.equals(BOOLEAN)) {
        if (!value.equals(Boolean.valueOf(this.flag))) {
            throw new Error("unexpected boolean value");
        }
    } else if (this.name.equals(INTEGER)) {
        if (!value.equals(Integer.valueOf(this.value))) {
            throw new Error("unexpected integer value");
        }
    } else {
        throw new Error("unexpected property name");
    }
    if (event instanceof IndexedPropertyChangeEvent) {
        IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
        if (this.index != ipce.getIndex()) {
            throw new Error("unexpected property index");
        }
    } else {
        throw new Error("unexpected event type");
    }
    System.out.println(this.name + " at " + this.index + " is " + value);

    this.name = null;
    this.index = -1;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号