Objects and Their Attributes - Part 1 of 3



Creating New Objects

An Analytica model consists of a set of Objects, such as variables, modules, and functions. The Analytica language also contains Objects, including attributes, system functions, and commands. Each object has a unique Identifier, and a set of properties known as Attributes. For example, a Variable has a Title, Units, Description, and Definition attribute. Each object belongs to a general category, called a Class. Object classes include variables, functions, modules, and attributes.

You can create new objects of the following base classes: variable, Function, attribute, and model. Some classes form a hierarchy. There are additional variable and model classes. The usual way to create a new object is to specify the Object class, followed by a unique identifier. For example, in the Typescript window:

Example>variable life
Note
Analytica will not be able to evaluate variables in the :model until it understands the definitions of all of the objects it contains.

When creating a new object, you should also specify the following user-specified attributes by default:

Variable Title, Units, Description, Definition.
Module Title, Description, Author.
Attribute Title, Description.
Function Title, Description, Definition, Parameters.
Button Title, Description, Script.

Attribute values That are Longer Than One Line

User-specified attributes may be longer than one line. To continue a Definition, Description, or other attribute over several lines, you place a tilde (“~”) or continuation character (option-L, “¬”) at the end of each line to be continued (Analytica will finish the Description or Definition when it receives a line that does not end with a tilde).

Analytica will also allow you to continue an attribute over several lines if you leave an open parenthesis on the first line of the attribute. When you close the parentheses, Analytica will assume that you have finished typing in the attribute.

  • Note When entering attributes using the Analytica user interface (the Object window, Diagram window etc.), you do not need to specify a continuation character.

In ADE, it is best to build a large string, and then pass that string directly to the Command property, without using the continuation characters. For example,

s = “very long string…..”
Ana.Command = “title: “ & s
Ana.Send

Object classes

As an Analytica user, you can create objects of these classes as part of a model:

  • Variable: An element of a model that can have a value. Variable has subclasses Chance, Decision, Objective, Index, and Determ.
  • Module: An object that contains a set of variables and other user-defined objects. A Model, Library, LinkModule, and LinkLibrary are subclasses of Module.
  • Function: A user-defined mathematical function that may have one or more parameters and returns a value.
  • Alias: A node in a diagram that depicts an object in a different module -- and so whose original node is in a different diagram. The text in an Alias node is italic.
  • Attribute: A property of an object, such as Class, Title, Identifier, or Description.

The Analytica language includes objects of these classes, which you cannot create:

  • Command: An instruction to Analytica. You may use commands used only in Typescript, not in normal Analytica expression.
  • Keyword: A textual word used in some language constructs -- such as, IF THEN ELSE, FOR DO, or BEGIN END.
  • Sysfunction: A standard built-in function, such as Sine (Sin), Standard Deviation (SDeviation), etc.
  • Sysvar: A pre-defined variable that controls formats or options, or designates version. Examples include: AnalyticaEdition, Run, SampleSize, and Time.

Classes are organized into a hierarchy, where subclasses inherit properties of their parent classes:

Class Hierarchy.PNG

Identifiers

Each object has a unique identifier of up to 20 characters. (Analytica ignores any characters beyond the 20th.) The first character must be a letter. The rest may be letters, digits, underscore ("_"), or period ("."). An identifier may not include other characters, including space (" ") or accented characters. Analytica treats upper and lower case letters as equivalent (i.e., it is case-insensitive). These are examples of legal identifiers:

a, Alpha1, OOOOO, B.B.C., X12345678901, net_value

See the Identifiers Already Used for a list of all predefined identifiers.

Abbreviations of Identifiers

Analytica permits abbreviation of identifiers in many, but not all, cases. You can abbreviate the identifier of an object when you type it at the prompt (">"). If your abbreviation is ambiguous, Analytica will report an error and will not execute the command. In such cases, you must type the full identifier of the object. For example:

Fishinapond>sh
Syntax error:
?The Identifier 'Sh' is ambiguous. Choose one of:
Show Showhier Showkey Showundef

You cannot abbreviate identifiers of variables or other objects when you put them in the Definition of another object.

See Also


Comments


You are not allowed to post comments.