Loading...
Searching...
No Matches
matlab.gams.control.Symbol Class Reference

Representation of a symbol in GAMS. More...

Inheritance diagram for matlab.gams.control.Symbol:
matlab.gams.control.Equation matlab.gams.control.Parameter matlab.gams.control.Set matlab.gams.control.Variable

Public Member Functions

gams.control.SymbolRecord addRecord (varargin)
 Add record to Symbol.
 
logical checkDomains ()
 Check domains of all SymbolRecord instances of the symbol.
 
logical clear ()
 Clear symbol by removing all records of this symbol.
 
void copySymbol (gams.control.Symbol target)
 Copy all records of this Symbol to target Symbol.
 
logical deleteRecord (varargin)
 Delete record from Symbol.
 
logical equals (any object)
 Indicates whether some other object is "equal to" this one.
 
gams.control.SymbolRecord findRecord (varargin)
 Find record in Symbol.
 
gams.control.SymbolRecord getFirstRecord (varargin)
 Get the first record of Symbol.
 
gams.control.SymbolRecord getLastRecord (varargin)
 Get the last record of Symbol.
 
cell getSymbolDomainViolations (integer maxNoViolation)
 Check domains of all SymbolRecord instances in the Symbol.
 
integer hashCode ()
 Returns a hash code value for the object.
 
Iterator iterator ()
 Returns an iterator over a set of SymbolRecord instances.
 
gams.control.SymbolRecord mergeRecord (varargin)
 Find record with specified keys in Symbol.
 

Public Attributes

gams.control.Database database
 (read only) Database containing Symbol
 
integer dimension
 (read only) Symbol dimension
 
cell domains
 (read only) Domains of Symbol, each element is either a Set (real domain) or a string (relaxed domain)
 
cell domainsAsStrings
 (read only) Domains of Symbol, each element is a string
 
gams.control.SymbolRecord firstRecord
 (read only) first record of Symbol
 
gams.control.SymbolRecord lastRecord
 (read only) last record of Symbol
 
string name
 (read only) Symbol name
 
integer numberOfRecords
 (read only) Number of records of the Symbol
 
gams.control.SymbolRecord record
 (read only) record of Symbol
 
cell records
 (read only) list of SymbolRecord instances contained in Symbol
 
string text
 (read only) Symbol explanatory text
 

Detailed Description

Representation of a symbol in GAMS.

A Symbol exists in a Database and contains SymbolRecord instances which one can iterate through. Derived classes are Equation, Parameter, Set and Variable.

See also
Database, SymbolRecord, Equation, Parameter, Set, Variable

Member Function Documentation

◆ addRecord()

gams.control.SymbolRecord matlab.gams.control.Symbol.addRecord ( varargin  )

Add record to Symbol.

Valid VARARGIN signatures:

  • {string key1, ..., string keyN}
  • string key1, ..., string keyN

Arguments:

  • key1,...,keyN: Keys of record. Empty string is not a valid key.

Return: instance of SymbolRecord

See also
SymbolRecord

Reimplemented in matlab.gams.control.Equation, matlab.gams.control.Parameter, matlab.gams.control.Set, and matlab.gams.control.Variable.

◆ checkDomains()

logical matlab.gams.control.Symbol.checkDomains ( )

Check domains of all SymbolRecord instances of the symbol.

Return: true if every instance does not contain a domain violation, false otherwise

See also
SymbolRecord

◆ clear()

logical matlab.gams.control.Symbol.clear ( )

Clear symbol by removing all records of this symbol.

Return: True if cleared successfully, otherwise false

◆ copySymbol()

void matlab.gams.control.Symbol.copySymbol ( gams.control.Symbol  target)

Copy all records of this Symbol to target Symbol.

Note: If target had records, they will be deleted.

Arguments:

◆ deleteRecord()

logical matlab.gams.control.Symbol.deleteRecord ( varargin  )

Delete record from Symbol.

In case SymbolRecord T has been successfully deleted, the iteration reference will be reseted as it is no longer possible to iterate to the next symbol using using reference of T.

There are a number of methods to obtain several SymbolRecord instances with the same underlying data. The behavior of an instance of SymbolRecord is unspecified if the underlying data has been deleted.

Valid VARARGIN signatures:

  • {string key1, ..., string keyN}
  • string key1, ..., string keyN

Arguments:

  • key1,...,keyN: Keys of record. Empty string is not a valid key.
See also
SymbolRecord

◆ equals()

logical matlab.gams.control.Symbol.equals ( any  object)

Indicates whether some other object is "equal to" this one.

The two Symbol(s) are equivalent if and only if they are objects of the same class, same database, same name, same dimension, same explanatory text, and same internal reference.

Arguments:

  • object: the reference object with which to compare

Return: true if this object is the same as the obj argument, false otherwise

◆ findRecord()

gams.control.SymbolRecord matlab.gams.control.Symbol.findRecord ( varargin  )

Find record in Symbol.

Valid VARARGIN signatures:

  • {string key1, ..., string keyN}
  • string key1, ..., string keyN

Arguments:

  • key1,...,keyN: Keys of record. Empty string is not a valid key.

Reimplemented in matlab.gams.control.Equation, matlab.gams.control.Parameter, matlab.gams.control.Set, and matlab.gams.control.Variable.

◆ getFirstRecord()

gams.control.SymbolRecord matlab.gams.control.Symbol.getFirstRecord ( varargin  )

Get the first record of Symbol.

Retrieve the first record in Symbol that meets the slice criteria. For example:

* try
* fprintf('Transportation costs to chicago\n');
* slice = {' ', 'chicago'};
* c = t1.outDB.getParameter('c');
* x1 = c.getFirstRecord(slice);
* while true
* fprintf('from %s to %s\n', x1.key(1), x1.key(2));
* if ~x1.moveNext()
* break;
* end
* end
* catch
* fprintf('No records found\n');
* end
* 

Valid VARARGIN signatures:

  • {string slice1, ..., string sliceN}
  • string slice1, ..., string sliceN

Arguments:

  • slice1,...,sliceN: Define filter for elements whose record should be retrieved

Return: instance of first SymbolRecord found

See also
SymbolRecord

Reimplemented in matlab.gams.control.Equation, matlab.gams.control.Parameter, matlab.gams.control.Set, and matlab.gams.control.Variable.

◆ getLastRecord()

gams.control.SymbolRecord matlab.gams.control.Symbol.getLastRecord ( varargin  )

Get the last record of Symbol.

Retrieve the first record in Symbol that meets the slice criteria.

Valid VARARGIN signatures:

  • {string slice1, ..., string sliceN}
  • string slice1, ..., string sliceN

Arguments:

  • slice1,...,sliceN: Define filter for elements whose record should be retrieved

Return: instance of first SymbolRecord found

See also
SymbolRecord

Reimplemented in matlab.gams.control.Equation, matlab.gams.control.Parameter, matlab.gams.control.Set, and matlab.gams.control.Variable.

◆ getSymbolDomainViolations()

cell matlab.gams.control.Symbol.getSymbolDomainViolations ( integer  maxNoViolation)

Check domains of all SymbolRecord instances in the Symbol.

It returns a list of SymbolDomainViolation instances containing domain violation information for problematic records. Each SymbolDomainViolation instance contains information of which SymbolRecord instance whose domain is violated as well as a violation array of boolean value with the size of the Symbol instance dimension. The array position contains {true} value means there is a domain violation at the relative dimension, otherwise it contains {false} value.

Arguments:

  • maxNoViolation: The maximum number of domain violation records which should be stored (0 for no limit)

Return: a list of DatabaseDomainViolation containing domain violation information

◆ hashCode()

integer matlab.gams.control.Symbol.hashCode ( )

Returns a hash code value for the object.

Return: a hash code value for this object

◆ iterator()

Iterator matlab.gams.control.Symbol.iterator ( )

Returns an iterator over a set of SymbolRecord instances.

Return: an iterator over a set of SymbolRecord instances

Reimplemented in matlab.gams.control.Equation, matlab.gams.control.Parameter, matlab.gams.control.Set, and matlab.gams.control.Variable.

◆ mergeRecord()

gams.control.SymbolRecord matlab.gams.control.Symbol.mergeRecord ( varargin  )

Find record with specified keys in Symbol.

In case the record is not found, the record with the specified keys will be added and returned the call.

Valid VARARGIN signatures:

  • {string key1, ..., string keyN}
  • string key1, ..., string keyN

Arguments:

  • key1,...,keyN: Keys of record. Empty string is not a valid key.

Return: Reference to record that is found or added

Reimplemented in matlab.gams.control.Equation, matlab.gams.control.Parameter, matlab.gams.control.Set, and matlab.gams.control.Variable.

Member Data Documentation

◆ domainsAsStrings

cell matlab.gams.control.Symbol.domainsAsStrings

(read only) Domains of Symbol, each element is a string

Note: If the domain is an alias in GAMS, this call will return the name of the alias, not the name of the aliased set

◆ record

gams.control.SymbolRecord matlab.gams.control.Symbol.record

(read only) record of Symbol

If the Symbol contains multiple records, it points to the first record, but raises a warning. In that case, please use firstRecord.

◆ records

cell matlab.gams.control.Symbol.records

(read only) list of SymbolRecord instances contained in Symbol

Performance Note: This cell is created from Java data records for every read. Thus, a loop like

* for i = 1:numel(sym.records)
* disp(sym.records{i}.keys);
* end
* 

would create the symbols list numel(sym.records)+1 times. Please use either of the following:

* recs = sym.records;
* for i = 1:numel(recs)
* disp(sym.records{i}.keys);
* end
* 
* for rec = sym.records
* disp(rec{1}.keys);
* end
*