Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

WIP

  • Loading branch information...
commit 91ac1064d0386fa5b7b82ab707305fd24af1c701 1 parent 66d2bbb
@thejohnfreeman authored
Showing with 57 additions and 44 deletions.
  1. +57 −44 lib/model/model.js
View
101 lib/model/model.js
@@ -1,9 +1,5 @@
/**
- * @fileOverview
- * Base classes for variables, methods, and constraints. <br />
- * {@link hotdrink.model.Variable} <br />
- * {@link hotdrink.model.Method} <br />
- * {@link hotdrink.model.Constraint}
+ * Base classes for variables, methods, and constraints.
* @author John Freeman
*/
@@ -23,17 +19,20 @@
/**
* A variable in the model.
- *
+ * @class Variable
+ * @memberOf hotdrink.model
+ */
+ /**
+ * @constructor Variable
* @memberOf hotdrink.model
- * @constructor
- * @param {concept.model.CellType} cellType
+ * @param cellType {CellType}
* We need the cellType at construction time so that behaviors can
* differentiate variables.
- * @param {concept.model.Value} initialValue
+ * @param initialValue {Value}
* It is a good practice to intialize every variable. If this variable is
* part of a constraint, however, it may be overwritten during the first
* update.
- * <br />
+ *
* If this is a function, then the variable will have a function value.
*/
var Variable = function Variable(cellType, initialValue) {
@@ -53,16 +52,18 @@
var toId = function toId() { return this.id; };
/**
- * @methodOf hotdrink.model.Variable#
+ * @method toString
+ * @memberOf hotdrink.model.Variable
* @returns {String}
- * Shows name and abbreviated {@link concept.model.cellType}.
+ * Shows name and abbreviated $CellType.
*/
Variable.prototype.toString = function () {
return this.id + " (" + this.cellType.slice(0, 3) + ")";
};
/**
- * @methodOf hotdrink.model.Variable#
+ * @method toJSON
+ * @memberOf hotdrink.model.Variable
* @returns {Object}
* A simplified object with just the fields to be JSONified.
*/
@@ -73,9 +74,10 @@
publisher.mixin(Variable);
/**
- * @methodOf hotdrink.model.Variable#
+ * @method toProxy
+ * @memberOf hotdrink.model.Variable
* @param {hotdrink.model.Runtime} runtime
- * @returns {concept.model.Proxy}
+ * @returns {Proxy}
*/
Variable.prototype.toProxy = function toProxy(runtime) {
var vv = this;
@@ -113,37 +115,39 @@
};
/**
- * @name is
- * @methodOf hotdrink.model.Variable
+ * @method is
+ * @memberOf hotdrink.model.Variable
* @param {Unknown} proxy
- * @returns {boolean} True if the argument is a {@link concept.model.Proxy}.
+ * @returns {Boolean} True if the argument is a $Proxy.
*/
Variable.is = function is(proxy) {
return (typeof proxy === "function") && (proxy.hotdrink);
};
/**
- * @lends hotdrink
+ * @extends hotdrink
*/
namespace.extend("hotdrink", {
/**
+ * @function isVariable
+ * @memberOf hotdrink
* @param {Unknown} getter
- * @returns {boolean}
- * True if the argument is a {@link concept.model.Proxy} for a
- * {@link hotdrink.model.Variable} that is not a
- * {@link concept.model.Command}.
+ * @returns {Boolean}
+ * True if the argument is a $concept.model.Proxy for a
+ * $hotdrink.model.Variable that is not a $Command.
*/
isVariable : function isVariable(getter) {
return Variable.is(getter) && (getter.hotdrink.cellType !== "output");
},
/**
+ * @function isCommand
+ * @memberOf hotdrink
* @param {Unknown} getter
- * @returns {boolean}
- * True if the argument is a {@link concept.model.Proxy} for a
- * {@link hotdrink.model.Variable} that is a
- * {@link concept.model.Command}.
+ * @returns {Boolean}
+ * True if the argument is a $Proxy for a $hotdrink.model.Variable that is
+ * a $Command.
*/
isCommand : function isCommand(getter) {
return Variable.is(getter) && (getter.hotdrink.cellType === "output");
@@ -155,19 +159,21 @@
/**
* A method in the model.
- *
+ * @class Method
* @memberOf hotdrink.model
- * @constructor
- * @param {[hotdrink.model.Variable]} outputs
- * @param {Function :: () -> [concept.model.Value]} fn
+ */
+ /**
+ * @constructor Method
+ * @memberOf hotdrink.model
+ * @param outputs {[hotdrink.model.Variable]}
+ * @param fn {Function :: () -> [Value]}
* The function that computes new values for the variables.
- * <br />
+ *
* Methods may not set values for any variable in their function body; such
* values must be returned by the method, in the order matching that given
* for the outputs parameter.
- * <br />
- * Methods may use 'this' to access variables defined in their
- * {@link concept.model.Model}.
+ *
+ * Methods may use 'this' to access variables defined in their $Model.
*/
var Method = function Method(outputs, fn) {
this.id = makeName("method");
@@ -178,7 +184,8 @@
};
/**
- * @methodOf hotdrink.model.Method#
+ * @method toString
+ * @memberOf hotdrink.model.Method
* @returns {String} Shows inputs and outputs.
*/
Method.prototype.toString = function () {
@@ -186,7 +193,8 @@
};
/**
- * @methodOf hotdrink.model.Method#
+ * @method toJSON
+ * @memberOf hotdrink.model.Method
* @returns {Object}
* A simplified object with just the fields to be JSONified.
*/
@@ -198,10 +206,13 @@
/**
* A constraint in the model.
- *
+ * @class Constraint
+ * @memberOf hotdrink.model
+ */
+ /**
+ * @constructor Constraint
* @memberOf hotdrink.model
- * @constructor
- * @param {[hotdrink.model.Method]} methods
+ * @param methods {[hotdrink.model.Method]}
*/
var Constraint = function Constraint(methods) {
this.id = makeName("constraint");
@@ -209,13 +220,15 @@
};
/**
- * @methodOf hotdrink.model.Constraint#
+ * @method toString
+ * @memberOf hotdrink.model.Constraint
* @returns {String} Shows the name.
*/
Constraint.prototype.toString = toId;
/**
- * @methodOf hotdrink.model.Constraint#
+ * @method toJSON
+ * @memberOf hotdrink.model.Constraint
* @returns {Object}
* A simplified object with just the fields to be JSONified.
*/
@@ -224,8 +237,8 @@
}
/**
- * @name hotdrink.model
- * @namespace For model data structures and algorithms.
+ * For model data structures and algorithms.
+ * @namespace hotdrink.model
*/
namespace.extend("hotdrink.model", {
Variable : Variable,
Please sign in to comment.
Something went wrong with that request. Please try again.