// Path: unused/api/java/dan200/computercraft/api/lua/ILuaContext.java
// public interface ILuaContext
// {
// 	/**
// 	 * Wait for an event to occur on the computercraft, suspending the thread until it arises. This method is exactly equivalent to os.pullEvent() in lua.
// 	 * @param filter A specific event to wait for, or null to wait for any event
// 	 * @return An object array containing the name of the event that occurred, and any event parameters
// 	 * @throws Exception If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here.
// 	 * Do not attempt to common this exception, unless you wish to prevent termination, which is not recommended.
// 	 * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
// 	 */
// 	public Object[] pullEvent( String filter ) throws LuaException, InterruptedException;
// 	
// 	/**
// 	 * The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua.
// 	 * @param filter A specific event to wait for, or null to wait for any event
// 	 * @return An object array containing the name of the event that occurred, and any event parameters
// 	 * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
// 	 * @see #pullEvent(String)
// 	 */
// 	public Object[] pullEventRaw( String filter ) throws InterruptedException;
// 	
// 	/**
// 	 * Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events.
// 	 * @param arguments An object array containing the arguments to pass to coroutine.yield()
// 	 * @return An object array containing the return values from coroutine.yield()
// 	 * @throws InterruptedException If the user shuts down or reboots the computercraft the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
// 	 * @see #pullEvent(String)
// 	 */
// 	public Object[] yield( Object[] arguments ) throws InterruptedException;
// 
//     /**
//      * TODO: Document me
//      * @param task
//      * @return
//      */
//     public Object[] executeMainThreadTask( ILuaTask task ) throws LuaException, InterruptedException;
// 
//     /**
//      * TODO: Document me
//      * @param task
//      * @return
//      */
//     public long issueMainThreadTask( ILuaTask task ) throws LuaException;
// }
// 
// Path: unused/api/java/dan200/computercraft/api/lua/LuaException.java
// public class LuaException extends Exception
// {
//     private final int m_level;
// 
//     public LuaException()
//     {
//         this( "error", 1 );
//     }
// 
//     public LuaException( String message )
//     {
//         this( message, 1 );
//     }
// 
//     public LuaException( String message, int level )
//     {
//         super( message );
//         m_level = level;
//     }
// 
//     public int getLevel()
//     {
//         return m_level;
//     }
// }


import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
/**
 * This file is part of the public ComputerCraft API - http://www.computercraft.info
 * Copyright Daniel Ratcliffe, 2011-2016. This API may be redistributed unmodified and in full only.
 * For help using the API, and posting your mods, visit the forums at computercraft.info.
 */

package dan200.computercraft.api.peripheral;


/**
 * The interface that defines a peripheral. See IPeripheralProvider for how to associate blocks with peripherals.
 */
public interface IPeripheral
{
	/**
	 * Should return a string that uniquely identifies this type of peripheral.
	 * This can be queried from lua by calling peripheral.getType()
	 * @return 	A string identifying the type of peripheral.
	 */
    public String getType();
    
	/**
	 * Should return an array of strings that identify the methods that this 
	 * peripheral exposes to Lua. This will be called once before each attachment,
	 * and should not change when called multiple times.
	 * @return 	An array of strings representing method names.
	 * @see 	#callMethod
	 */
    public String[] getMethodNames();
    
	/**
	 * This is called when a lua program on an attached computercraft calls peripheral.call() with
	 * one of the methods exposed by getMethodNames().<br>
	 * <br>
	 * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe
	 * when interacting with minecraft objects.
	 * @param 	computer	The interface to the computercraft that is making the call. Remember that multiple
	 *						computers can be attached to a peripheral at once.
	 * @param	context		The context of the currently running lua thread. This can be used to wait for events
	 *						or otherwise yield.
	 * @param	method		An integer identifying which of the methods from getMethodNames() the computercraft
	 *						wishes to call. The integer indicates the index into the getMethodNames() table
	 *						that corresponds to the string passed into peripheral.call()
	 * @param	arguments	An array of objects, representing the arguments passed into peripheral.call().<br>
	 *						Lua values of type "string" will be represented by Object type String.<br>
	 *						Lua values of type "number" will be represented by Object type Double.<br>
	 *						Lua values of type "boolean" will be represented by Object type Boolean.<br>
	 *						Lua values of any other type will be represented by a null object.<br>
	 *						This array will be empty if no arguments are passed.
	 * @return 	An array of objects, representing values you wish to return to the lua program.<br>
	 *			Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.<br>
	 *			All other types will be converted to nil.<br>
	 *			You may return null to indicate no values should be returned.
	 * @throws	Exception	If you throw any exception from this function, a lua error will be raised with the
	 *						same message as your exception. Use this to throw appropriate errors if the wrong
	 *						arguments are supplied to your method.
	 * @see 	#getMethodNames
	 */
// Path: unused/api/java/dan200/computercraft/api/lua/ILuaContext.java
// public interface ILuaContext
// {
// 	/**
// 	 * Wait for an event to occur on the computercraft, suspending the thread until it arises. This method is exactly equivalent to os.pullEvent() in lua.
// 	 * @param filter A specific event to wait for, or null to wait for any event
// 	 * @return An object array containing the name of the event that occurred, and any event parameters
// 	 * @throws Exception If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here.
// 	 * Do not attempt to common this exception, unless you wish to prevent termination, which is not recommended.
// 	 * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
// 	 */
// 	public Object[] pullEvent( String filter ) throws LuaException, InterruptedException;
// 	
// 	/**
// 	 * The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua.
// 	 * @param filter A specific event to wait for, or null to wait for any event
// 	 * @return An object array containing the name of the event that occurred, and any event parameters
// 	 * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
// 	 * @see #pullEvent(String)
// 	 */
// 	public Object[] pullEventRaw( String filter ) throws InterruptedException;
// 	
// 	/**
// 	 * Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events.
// 	 * @param arguments An object array containing the arguments to pass to coroutine.yield()
// 	 * @return An object array containing the return values from coroutine.yield()
// 	 * @throws InterruptedException If the user shuts down or reboots the computercraft the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
// 	 * @see #pullEvent(String)
// 	 */
// 	public Object[] yield( Object[] arguments ) throws InterruptedException;
// 
//     /**
//      * TODO: Document me
//      * @param task
//      * @return
//      */
//     public Object[] executeMainThreadTask( ILuaTask task ) throws LuaException, InterruptedException;
// 
//     /**
//      * TODO: Document me
//      * @param task
//      * @return
//      */
//     public long issueMainThreadTask( ILuaTask task ) throws LuaException;
// }
// 
// Path: unused/api/java/dan200/computercraft/api/lua/LuaException.java
// public class LuaException extends Exception
// {
//     private final int m_level;
// 
//     public LuaException()
//     {
//         this( "error", 1 );
//     }
// 
//     public LuaException( String message )
//     {
//         this( message, 1 );
//     }
// 
//     public LuaException( String message, int level )
//     {
//         super( message );
//         m_level = level;
//     }
// 
//     public int getLevel()
//     {
//         return m_level;
//     }
// }


// Path: unused/api/java/dan200/computercraft/api/peripheral/IPeripheral.java
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;

/**
 * This file is part of the public ComputerCraft API - http://www.computercraft.info
 * Copyright Daniel Ratcliffe, 2011-2016. This API may be redistributed unmodified and in full only.
 * For help using the API, and posting your mods, visit the forums at computercraft.info.
 */

package dan200.computercraft.api.peripheral;


/**
 * The interface that defines a peripheral. See IPeripheralProvider for how to associate blocks with peripherals.
 */
public interface IPeripheral
{
	/**
	 * Should return a string that uniquely identifies this type of peripheral.
	 * This can be queried from lua by calling peripheral.getType()
	 * @return 	A string identifying the type of peripheral.
	 */
    public String getType();
    
	/**
	 * Should return an array of strings that identify the methods that this 
	 * peripheral exposes to Lua. This will be called once before each attachment,
	 * and should not change when called multiple times.
	 * @return 	An array of strings representing method names.
	 * @see 	#callMethod
	 */
    public String[] getMethodNames();
    
	/**
	 * This is called when a lua program on an attached computercraft calls peripheral.call() with
	 * one of the methods exposed by getMethodNames().<br>
	 * <br>
	 * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe
	 * when interacting with minecraft objects.
	 * @param 	computer	The interface to the computercraft that is making the call. Remember that multiple
	 *						computers can be attached to a peripheral at once.
	 * @param	context		The context of the currently running lua thread. This can be used to wait for events
	 *						or otherwise yield.
	 * @param	method		An integer identifying which of the methods from getMethodNames() the computercraft
	 *						wishes to call. The integer indicates the index into the getMethodNames() table
	 *						that corresponds to the string passed into peripheral.call()
	 * @param	arguments	An array of objects, representing the arguments passed into peripheral.call().<br>
	 *						Lua values of type "string" will be represented by Object type String.<br>
	 *						Lua values of type "number" will be represented by Object type Double.<br>
	 *						Lua values of type "boolean" will be represented by Object type Boolean.<br>
	 *						Lua values of any other type will be represented by a null object.<br>
	 *						This array will be empty if no arguments are passed.
	 * @return 	An array of objects, representing values you wish to return to the lua program.<br>
	 *			Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.<br>
	 *			All other types will be converted to nil.<br>
	 *			You may return null to indicate no values should be returned.
	 * @throws	Exception	If you throw any exception from this function, a lua error will be raised with the
	 *						same message as your exception. Use this to throw appropriate errors if the wrong
	 *						arguments are supplied to your method.
	 * @see 	#getMethodNames
	 */
    public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException;