mn8 Language Reference | Index    

TypedSeries

SUMMARY: ATTRIBUTES SUMMARY  NO ELEMENTS  CONSTRUCTORS SUMMARY  NO OPERATORS  METHODS SUMMARYDETAIL: ATTRIBUTE DETAILS  NO ELEMENTS  CONSTRUCTOR DETAILS  NO OPERATORS  METHOD DETAILS

Description

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.

Usage

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

Attribute List

 @hasNext TYPEOF Logical LABEL "Has next "
 @hasPrevious TYPEOF Logical LABEL "Has previous "
 @index TYPEOF Integer LABEL "Index"
 @length TYPEOF Integer LABEL "Length"
top
Attributes inherited from: Series
hasNext, hasPrevious, index, length

Constructor List

create (String $type)
create (String $type, Series $values)
top

Method List

addEntry (Concept $value)
ConceptcreateNewEntry
StringgetType
ConceptlastEntry
setType (String $type)
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI
Methods inherited from: Series
IndexOf, add, contains, current, elementAt, getConceptElement, getConceptElements, insert, insert, next, previous, remove, remove, setIndex, setValue, sort, toTXT, toXML

Detailed Attribute Info

@hasNext

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.

top

@hasPrevious

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.

top

@index

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.

top

@length

Label:Length
Type:Integer
Is Static:false
Is Hidden:false
Show Empty:true

Specify the number of items this TypedSeries contains.

top

@hasNext

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.

top

@hasPrevious

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.

top

@index

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.

top

@length

Label:Length
Type:Integer
Is Static:false
Is Hidden:true
Show Empty:true

Specify the number of items this Series contains.

top

Detailed Constructor Info

create (String $type)
Parameters:
$type :A string which specifies this TypedSeries type.

Creates a new TypedSeries of the specified type.

top
create (String $type, Series $values)
Parameters:
$type :A string which specifies this TypedSeries type.
$values :The values which this TypedSeries will contain.

Creates a new TypedSeries of the specified type and with the given values.

top

Detailed Method Info

addEntry (Concept $value)
Parameters:
$value :The value to add.
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>
            

top
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>
            

top
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
            

top
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
            

top
setType (String $type)
Parameters:
$type :The type to set.
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
            

top