001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ 003/* Open Source Software - may be modified and shared by FRC teams. The code */ 004/* must be accompanied by the FIRST BSD license file in the root directory of */ 005/* the project. */ 006/*----------------------------------------------------------------------------*/ 007 008package edu.wpi.first.wpilibj.tables; 009 010/** 011 * A listener that listens to changes in values in a {@link ITable} 012 * @deprecated Use Consumer<{@link edu.wpi.first.networktables.EntryNotification}>, 013 * {@link edu.wpi.first.networktables.TableEntryListener}, or 014 * {@link edu.wpi.first.networktables.TableListener} as appropriate. 015 */ 016@FunctionalInterface 017@Deprecated 018public interface ITableListener { 019 /** 020 * Called when a key-value pair is changed in a {@link ITable} 021 * @param source the table the key-value pair exists in 022 * @param key the key associated with the value that changed 023 * @param value the new value 024 * @param isNew true if the key did not previously exist in the table, otherwise it is false 025 */ 026 public void valueChanged(ITable source, String key, Object value, boolean isNew); 027 028 /** 029 * Extended version of valueChanged. Called when a key-value pair is 030 * changed in a {@link ITable}. The default implementation simply calls 031 * valueChanged(). If this is overridden, valueChanged() will not be 032 * called. 033 * @param source the table the key-value pair exists in 034 * @param key the key associated with the value that changed 035 * @param value the new value 036 * @param flags update flags; for example, NOTIFY_NEW if the key did not 037 * previously exist in the table 038 */ 039 default public void valueChangedEx(ITable source, String key, Object value, int flags) { 040 // NOTIFY_NEW = 0x04 041 valueChanged(source, key, value, (flags & 0x04) != 0); 042 } 043}