/*******************************************************************************
*   Copyright 2012 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.schedulers.scheduleEntry;

import java.util.Map;

import org.eclipse.jdt.annotation.Nullable;

import com.analog.lyric.dimple.model.core.FactorGraph;
import com.analog.lyric.dimple.model.core.INode;


/**
 * @author jeffb
 * 
 */
public interface IScheduleEntry
{
	/**
	 * Identifies {@linkplain IScheduleEntry#type type} of {@link IScheduleEntry}.
	 * 
	 * @since 0.08
	 * @author Christopher Barber
	 */
	public static enum Type
	{
		/**
		 * Type of {@link EdgeScheduleEntry} instances.
		 */
		EDGE,
		/**
		 * Type of {@link NodeScheduleEntry} instances.
		 */
		NODE,
		/**
		 * Type of {@link BlockScheduleEntry} instances.
		 */
		VARIABLE_BLOCK,
		/**
		 * Type of {@link SubgraphScheduleEntry} instances,
		 */
		SUBGRAPH,
		/**
		 * Type of {@link SubScheduleEntry} instances.
		 */
		@Deprecated
		SUBSCHEDULE,
		/**
		 * Type that should be returned by a user-defined {@link IScheduleEntry} implementation.
		 * Note that such an entry will only be supported by a user-defined solver.
		 */
		CUSTOM;
	}
	
	public @Nullable IScheduleEntry copy(Map<Object,Object> old2new, boolean copyToRoot);
	
	/**
	 * Returns parent graph of entry, if applicable.
	 * @since 0.08
	 */
	public @Nullable FactorGraph getParentGraph();
	
	/**
	 * Returns iterator over nodes referenced in schedule entry.
	 * @since 0.08
	 */
	public Iterable<? extends INode> getNodes();
	
	/**
	 * Indicates the type of schedule entry.
	 * <p>
	 * This can be used in a switch statement to avoid doing instanceof checks.
	 * @since 0.08
	 */
	public Type type();
}
