Matlab.GAMS.GAMSSymbol Class Reference

Representation of a symbol in GAMS. More...

Inheritance diagram for Matlab.GAMS.GAMSSymbol:
Matlab.GAMS.GAMSEquation Matlab.GAMS.GAMSParameter Matlab.GAMS.GAMSSet Matlab.GAMS.GAMSVariable

Public Member Functions

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

Public Attributes

GAMSDatabase database
 (read only) GAMSDatabase containing GAMSSymbol
 
integer dimension
 (read only) GAMSSymbol dimension
 
cell domains
 (read only) Domains of GAMSSymbol, each element is either a GAMSSet (real domain) or a string (relaxed domain)
 
cell domainsAsStrings
 (read only) Domains of GAMSSymbol, each element is a string More...
 
GAMSSymbolRecord firstRecord
 (read only) first record of GAMSSymbol
 
GAMSSymbolRecord lastRecord
 (read only) last record of GAMSSymbol
 
string name
 (read only) GAMSSymbol name
 
integer numberOfRecords
 (read only) Number of records of the GAMSSymbol
 
GAMSSymbolRecord record
 (read only) record of GAMSSymbol More...
 
cell records
 (read only) list of GAMSSymbolRecord instances contained in GAMSSymbol More...
 
string text
 (read only) GAMSSymbol explanatory text
 

Detailed Description

Representation of a symbol in GAMS.

A GAMSSymbol exists in a GAMSDatabase and contains GAMSSymbolRecord instances which one can iterate through. Derived classes are GAMSEquation, GAMSParameter, GAMSSet and GAMSVariable.

See also
GAMSDatabase, GAMSSymbolRecord, GAMSEquation, GAMSParameter, GAMSSet, GAMSVariable

Member Function Documentation

◆ addRecord()

GAMSSymbolRecord Matlab.GAMS.GAMSSymbol.addRecord ( varargin  )

Add record to GAMSSymbol.

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 GAMSSymbolRecord

See also
GAMSSymbolRecord

Reimplemented in Matlab.GAMS.GAMSEquation, Matlab.GAMS.GAMSSet, Matlab.GAMS.GAMSVariable, and Matlab.GAMS.GAMSParameter.

◆ checkDomains()

logical Matlab.GAMS.GAMSSymbol.checkDomains ( )

Check domains of all GAMSSymbolRecord instances of the symbol.

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

See also
GAMSSymbolRecord

◆ clear()

logical Matlab.GAMS.GAMSSymbol.clear ( )

Clear symbol by removing all records of this symbol.

Return: True if cleared successfully, otherwise false

◆ copySymbol()

void Matlab.GAMS.GAMSSymbol.copySymbol ( GAMS.GAMSSymbol  target)

Copy all records of this GAMSSymbol to target GAMSSymbol.

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

Arguments:

◆ deleteRecord()

logical Matlab.GAMS.GAMSSymbol.deleteRecord ( varargin  )

Delete record from GAMSSymbol.

In case GAMSSymbolRecord 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 GAMSSymbolRecord instances with the same underlying data. The behavior of an instance of GAMSSymbolRecord 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
GAMSSymbolRecord

◆ equals()

logical Matlab.GAMS.GAMSSymbol.equals ( any  object)

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

The two GAMSSymbols 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()

GAMSSymbolRecord Matlab.GAMS.GAMSSymbol.findRecord ( varargin  )

Find record in GAMSSymbol.

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.GAMSEquation, Matlab.GAMS.GAMSSet, Matlab.GAMS.GAMSVariable, and Matlab.GAMS.GAMSParameter.

◆ getFirstRecord()

GAMSSymbolRecord Matlab.GAMS.GAMSSymbol.getFirstRecord ( varargin  )

Get the first record of GAMSSymbol.

Retrieve the first record in GAMSSymbol 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 GAMSSymbolRecord found

See also
GAMSSymbolRecord

Reimplemented in Matlab.GAMS.GAMSEquation, Matlab.GAMS.GAMSSet, Matlab.GAMS.GAMSVariable, and Matlab.GAMS.GAMSParameter.

◆ getLastRecord()

GAMSSymbolRecord Matlab.GAMS.GAMSSymbol.getLastRecord ( varargin  )

Get the last record of GAMSSymbol.

Retrieve the first record in GAMSSymbol 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 GAMSSymbolRecord found

See also
GAMSSymbolRecord

Reimplemented in Matlab.GAMS.GAMSEquation, Matlab.GAMS.GAMSSet, Matlab.GAMS.GAMSVariable, and Matlab.GAMS.GAMSParameter.

◆ getSymbolDomainViolations()

cell Matlab.GAMS.GAMSSymbol.getSymbolDomainViolations ( integer  maxNoViolation)

Check domains of all GAMSSymbolRecord instances in the Symbol.

It returns a list of GAMSSymbolDomainViolation instances containing domain violation information for problematic records. Each GAMSSymbolDomainViolation instance contains information of which GAMSSymbolRecord instance whose domain is violated as well as a violation array of boolean value with the size of the GAMSSymbol 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 GAMSDatabaseDomainViolation containing domain violation information

◆ hashCode()

integer Matlab.GAMS.GAMSSymbol.hashCode ( )

Returns a hash code value for the object.

Return: a hash code value for this object

◆ iterator()

GAMSIterator Matlab.GAMS.GAMSSymbol.iterator ( )

Returns an iterator over a set of GAMSSymbolRecord instances.

Return: an iterator over a set of GAMSSymbolRecord instances

Reimplemented in Matlab.GAMS.GAMSEquation, Matlab.GAMS.GAMSSet, Matlab.GAMS.GAMSVariable, and Matlab.GAMS.GAMSParameter.

◆ mergeRecord()

GAMSSymbolRecord Matlab.GAMS.GAMSSymbol.mergeRecord ( varargin  )

Find record with specified keys in GAMSSymbol.

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.GAMSEquation, Matlab.GAMS.GAMSSet, Matlab.GAMS.GAMSVariable, and Matlab.GAMS.GAMSParameter.

Member Data Documentation

◆ domainsAsStrings

cell Matlab.GAMS.GAMSSymbol.domainsAsStrings

(read only) Domains of GAMSSymbol, 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

GAMSSymbolRecord Matlab.GAMS.GAMSSymbol.record

(read only) record of GAMSSymbol

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

◆ records

cell Matlab.GAMS.GAMSSymbol.records

(read only) list of GAMSSymbolRecord instances contained in GAMSSymbol

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
*