/* 
 * Copyright (c) 2014-2016 medini Technologies AG
 * All rights reserved.
 */

/**
  * Object List()
  * @constructor
  * @extends Object
  * @since Part of standard Java language
  * see java.util.List
 */
function List(){};
List.prototype = new Object();

/**
 * function size
 * @memberOf List
 * @returns {Number}
 * @see     List
 * @since Part of standard Java language
 * see java.util.List
 */  
List.prototype.size = function() { return 0;};

// TODO Add remaining important List functions

/**
 * Object Filter()
 * @constructor
 * @since 3.0.0
 * @see Finder.filter(Filter)
 * @stability 1 - Experimental
 */
function Filter(){};
Filter.prototype = new Object();

/**
 * function accept(object)
 * @param   {Object} object
 * @memberOf   Filter
 * @returns {Boolean}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
Filter.prototype.accept = function(object){return object != undefined;};

/**
 * Object Finder()
 * @constructor
 * @since 3.0.0
 * @see Global.getFinder()
 * @stability 1 - Experimental
 */
function Finder(){};
Finder.prototype = new Object();

/**
 * function find(attribute, value)
 * @param   {String} attribute
 * @param   {Object} value
 * @memberOf   Finder
 * @returns {FindResult}
 * @since 3.0.0
 * @stability 2 - Unstable
 */  
Finder.prototype.find = function(attribute, value){return new FindResult();};

/**
 * function findByType(type, strict)
 * @param   {Object} type
 * @param   {Boolean} strict
 * @memberOf   Finder
 * @returns {FindResult}
 * @since 3.0.0
 * @stability 2 - Unstable
 * 
 * Note: the second argument is optional since 3.2.0. If not set, <code>false</code> is assumed
 */  
Finder.prototype.findByType = function(type, strict){return new FindResult();};

/**
 * Object ScopedFinder()
 * @super Finder
 * @constructor
 * @since 3.0.0
 * @see Global.getFinder()
 * @stability 1 - Experimental
 */
function ScopedFinder(scope){};
ScopedFinder.prototype = new Finder();

/**
 * function getScope(type, strict)
 * @memberOf   ScopedFinder
 * @returns {Object}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
ScopedFinder.prototype.getScope = function(){return new Object();};

/**
 * Object FindResult()
 * @super ScopedFinder
 * @constructor
 * @since 3.0.0
 * @see Finder.find()
 * @stability 1 - Experimental
 */
function FindResult(){};
FindResult.prototype = new ScopedFinder();

/**
 * function and(attribute, value)
 * @param   {String} attribute
 * @param   {Object} value
 * @memberOf   FindResult
 * @returns {FindResult}
 * @since 3.0.0
 * @stability 2 - Unstable
 */  
FindResult.prototype.and = function(attribute, value){return new FindResult();};

/**
 * function butNot(attribute, value)
 * @param   {String} attribute
 * @param   {Object} value
 * @memberOf   FindResult
 * @returns {FindResult}
 * @since 3.0.0
 * @stability 2 - Unstable
 */  
FindResult.prototype.butNot = function(attribute, value){return new FindResult();};

/**
 * function filter(filter)
 * @param   {Filter} filter
 * @memberOf   FindResult
 * @returns {FindResult}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.filter = function(filter){return new FindResult();};

/**
 * function size()
 * @memberOf   FindResult
 * @returns {Number}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.size = function(){return 0.0;};

/**
 * function isEmpty()
 * @memberOf   FindResult
 * @returns {Boolean}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.isEmpty = function(){return false;};

/**
 * function notEmpty()
 * @memberOf   FindResult
 * @returns {Boolean}
 * @since 3.2.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.notEmpty = function(){return false;};

/**
 * function first()
 * @memberOf   FindResult
 * @returns {Object}
 * @since 3.0.2
 * @stability 1 - Experimental
 */  
FindResult.prototype.first = function(){return new Object();};

/**
 * function elapsedTime()
 * @memberOf   FindResult
 * @returns {Number}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.elapsedTime = function(){return 1.0;};

/**
 * function asList()
 * @memberOf   FindResult
 * @returns {List}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.asList = function(){return {};};

/**
 * function asArray()
 * @memberOf   FindResult
 * @returns {Array}
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.asArray = function(){return [];};

/**
 * function forEach(consumer)
 * @param   {Function} consumer
 * @memberOf   FindResult
 * @since 3.4.0
 * @stability 1 - Experimental
 */  
FindResult.prototype.forEach = function(consumer){};

/**
 * Object ProgressMonitor()
 * @constructor
 * @since 3.0.0
 * @stability 1 - Experimental
 */
function ProgressMonitor(){};
ProgressMonitor.prototype = new Object();

/**
 * Object Console()
 * @constructor
 * @since 3.0.0
 * @stability 1 - Experimental
 */
function Console(){};
Console.prototype = new Object();

/**
 * function log(format, arguments)
 * @param   {String} format
 * @memberOf Console
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
Console.prototype.log = function(format, arguments){};

/**
 * function info(format, arguments)
 * @param   {String} format
 * @memberOf Console
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
Console.prototype.info = function(format, arguments){};

/**
 * function error(format, arguments)
 * @param   {String} format
 * @memberOf Console
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
Console.prototype.error = function(format, arguments){};

/*
 * Globals
 */

/**
 * Finder instance defined on project scope (project that the script is executed in).
 * @memberOf Global
 * @since 3.0.0
 * @stability 3 - Stable
 */
Global.prototype.finder = new ScopedFinder("");

/**
 * @memberOf Global
 * @param {String} file or URL
 * @since 3.0.0
 * @stability 1 - Experimental
 */
Global.prototype.load = function (file) {
	// load and evaluate the given file
};

/**
 * Show a modal dialog with the given object converted to text.
 * @memberOf Global
 * @param {Object} value
 * @since 3.0.0
 * @stability 3 - Stable
 */
Global.prototype.alert = function (object) {
	// load and evaluate the given file
};

/**
 * Name of the script file being executed. 
 * @memberOf Global
 * @since 3.0.0
 * @stability 2 - Unstable
 */
Global.prototype.__filename = "";

/**
 * Full qualified path of the script file being executed. 
 * @since 3.0.0
 * @stability 2 - Unstable
 */
Global.prototype.__filepath = "";

/**
 * Full qualified path of parent folder of the script file being executed. 
 * @since 3.0.1
 * @stability 2 - Unstable
 */
Global.prototype.__filedir = "";

/**
 * Full qualified version of the tool as shown in the about dialog. 
 * @since 3.4.0
 * @stability 1 - Experimental
 */
Global.prototype.__tool_version = "";

/**
 * Full version of the tool as a numeric value. 
 * @since 3.4.0
 * @stability 1 - Experimental
 */
Global.prototype.__tool_version_number = 340;

/**
 * @memberOf Global
 * @since 3.0.0
 * @stability 2 - Unstable
 */
Global.prototype.selection = [];

/**
 * @memberOf Global
 * @since 3.0.0
 * @stability 2 - Unstable
 */
Global.prototype.progressMonitor = new ProgressMonitor();

/**
 * @memberOf Global
 * @since 3.0.0
 * @stability 3 - Stable
 */
Global.prototype.console = new Console();

/**
 * static function getFinder(scope)
 * @memberOf Global
 * @param {Object} scope
 * @returns {ScopedFinder}
 * @static
 * @see     Finder
 * @since 3.0.0
 * @stability 2 - Unstable
 */  
Global.getFinder = function(scope){return new ScopedFinder(scope);};

/**
 * static function getProjects()
 * @memberOf Global
 * @returns {List}
 * @static
 * @since 3.0.0
 * @stability 1 - Experimental
 */  
Global.getProjects = function(){return new List();};
