/*******************************************************************************
* Copyright 2014 Analog Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
package com.analog.lyric.dimple.events;
import org.eclipse.jdt.annotation.Nullable;
import com.analog.lyric.dimple.model.core.FactorGraph;
import com.analog.lyric.options.IOptionHolder;
/**
* Interface for classes of objects that may produce {@link DimpleEvent}s.
*
* @since 0.06
* @author Christopher Barber
*/
public interface IDimpleEventSource extends IOptionHolder
{
/**
* Returns factor graph most immediately containing this object. Returns this object if
* it is already a {@link FactorGraph}.
*
* @since 0.06
*/
public @Nullable FactorGraph getContainingGraph();
/**
* Returns the event listener, if any, that will receive events generated by this object.
*
* @since 0.06
*/
public @Nullable IDimpleEventListener getEventListener();
/**
* The parent of this object in the event hierarchy or null if at root.
* <p>
* Unless otherwise noted, this will always have the same value as {@link #getOptionParent()}.
* <p>
* @since 0.06
*/
public @Nullable IDimpleEventSource getEventParent();
/**
* Name of source for use in {@link DimpleEvent}.
*
* @since 0.06
*/
public String getEventSourceName();
/**
* The model object that is most closely associated with the source.
* <p>
* If this object is itself a {@link IModelEventSource} this method should simply
* return this object.
*/
public @Nullable IModelEventSource getModelEventSource();
/**
* Notify the source that it should refresh its event setting.
* <p>
* This can be used when the event listener settings affecting this object
* have changed dynamically and you want the changes to take effect earlier
* than would be the case automatically. For instance, objects that can generate
* high-frequency events may normally refresh their settings during the initialization phase.
*
* @since 0.06
*/
public void notifyListenerChanged();
}