| mn8 Language Reference | Index | ||
TypedSeries |
||
|
||
TypedSeries is a special Series which can be contain only a single concept type. When the type is Nil then the TypedSeries will be defined a Series.
Create the new entry for one "Person" concept and load data in it.
define TSeries [
static : main ( $args typeof Series ) [
$person = TypedSeries.create("TSeries:Person")
$person.createNewEntry
$person.lastEntry/firstName="Csaba"
$person.lastEntry/lastName="Szabo"
$person.lastEntry/address/city="Satu Mare"
$person.lastEntry/address/street@name="Aleea Humulesti"
$person.lastEntry/address/street@nr=12
$person.lastEntry/address/zipCode=3900
print $person.toXML]]
define TSeries:Person label "Person" [
firstName
lastName
address typeof TSeries:Address]
define TSeries:Address label "Address" [
city
street typeof TSeries:Street
zipCode]
define TSeries:Street label "Street" [
@name
@nr]
| Version: | 0.1 |
| Authors: | Remus Pereni (http://neuro.nolimits.ro) |
| Location: | |
| Inherits: | Concept, Series |
| @hasNext TYPEOF Logical LABEL "Has next " | |
| @hasPrevious TYPEOF Logical LABEL "Has previous " | |
| @index TYPEOF Integer LABEL "Index" | |
| @length TYPEOF Integer LABEL "Length" |
Attributes inherited from: Series
|
| create (String $type) |
| create (String $type, Series $values) |
| addEntry (Concept $value) | |
| Concept | createNewEntry |
| String | getType |
| Concept | lastEntry |
| setType (String $type) |
| Label: | Has next |
| Type: | Logical |
| Is Static: | false |
| Is Hidden: | false |
| Show Empty: | true |
Specify whenever the index represents the last element of the series or not.
| Label: | Has previous |
| Type: | Logical |
| Is Static: | false |
| Is Hidden: | false |
| Show Empty: | true |
Specify whenever the index represents the first element of the series or not.
| Label: | Index |
| Type: | Integer |
| Is Static: | false |
| Is Hidden: | false |
| Show Empty: | true |
Specify the current position of the cursor in the Series, also used to move the cursor at the wanted position. Initially the index is positioned at the first element of the TypedSeries.
| Label: | Length |
| Type: | Integer |
| Is Static: | false |
| Is Hidden: | false |
| Show Empty: | true |
Specify the number of items this TypedSeries contains.
| Label: | Has next |
| Type: | Logical |
| Is Static: | false |
| Is Hidden: | true |
| Show Empty: | true |
Specify whenever the index represents the last element of the series or not.
| Label: | Has previous |
| Type: | Logical |
| Is Static: | false |
| Is Hidden: | true |
| Show Empty: | true |
Specify whenever the index represents the first element of the series or not.
| Label: | Index |
| Type: | Integer |
| Is Static: | false |
| Is Hidden: | true |
| Show Empty: | true |
Specify the current position of the cursor in the Series, also used to move the cursor at the wanted position. Initially the index is positioned at the first element of the series.
| Label: | Length |
| Type: | Integer |
| Is Static: | false |
| Is Hidden: | true |
| Show Empty: | true |
Specify the number of items this Series contains.
| create (String $type) |
| Parameters: | ||
|
Creates a new TypedSeries of the specified type.
| create (String $type, Series $values) |
| Parameters: | ||||
|
Creates a new TypedSeries of the specified type and with the given values.
| addEntry (Concept $value) |
| Parameters: | ||
|
| Returns: |
Adds the specified value to this TypedSeries.
define test7 [
static : main ( $args typeof Series ) [
$person = TypedSeries.create("test7:Person")
$prs typeof test7:Person
$prs/firstName="Csaba"
$prs/lastName="Szabo"
$prs/city="Satu Mare"
$person.addEntry( $prs )
print $person.toXML
]
]
define test7:Person label "Person" [
firstName
lastName
city
]
-- the result is --
<Person>
<firstName>Csaba</firstName>
<lastName>Szabo</lastName>
<city>Satu Mare</city>
</Person>
| createNewEntry |
| Returns: Concept |
Creates a new instance with the default type and label and adds to this TypedSeries.
define test7 [
static : main ( $args typeof Series ) [
$person = TypedSeries.create("test7:Person")
$person.createNewEntry
$person.lastEntry/firstName="Csaba"
$person.lastEntry/lastName="Szabo"
$person.lastEntry/city="Satu Mare"
print $person.toXML
]
]
define test7:Person label "Person" [
firstName
lastName
city
]
-- the result is --
<Person>
<firstName>Csaba</firstName>
<lastName>Szabo</lastName>
<city>Satu Mare</city>
</Person>
| getType |
| Returns: String |
Returns this TypedSeries type.
define test7 [
static : main ( $args typeof Series ) [
$person = TypedSeries.create("test7:Person")
print $person.getType
]
]
define test7:Person label "Person" [
firstName
lastName
city
]
-- the result is --
test7:Person
| lastEntry |
| Returns: Concept |
Returns the last concept in the typed series.
define test7 [
static : main ( $args typeof Series ) [
$person = TypedSeries.create("test7:Person")
$person.createNewEntry
print $person.lastEntry.getConceptType
]
]
define test7:Person label "Person" [
firstName
lastName
city
]
-- the result is --
test7:Person
| setType (String $type) |
| Parameters: | ||
|
| Returns: |
Sets this TypedSeries type to the specified value.
define test7 [
static : main ( $args typeof Series ) [
$person = TypedSeries.create("test7:Person")
$person.setType("MyPerson")
print $person.getType
]
]
define test7:Person label "Person" [
firstName
lastName
city
]
-- the result is --
MyPerson