mn8 Language Reference | Index    

Attribute

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

Description

Attributes are the most primitive elements from the complex data types. Their role is to associate a value with a name.

Usage

Create a 'name' named attribute with 'jon' value.

            $a typeof Attribute
            $a.setLabel("name")
            $a.setValue("jon")

            print $a
                name: jon

            print $a.toXML
                name="jon"

            print $a.getName
                name

            print $a.getvalue
                jon

This example show how to set attribute value

            define AttrAssign [
                static @att1="test" typeof String

                static :main ($args typeof Series) [
                    $current typeof AttrAssign
                    print $current.toXML<AttrAssign att1="test"></AttrAssign>

                    AttrAssign@att1 = "hello"
                    print $current.toXML<AttrAssign att1="hello"></AttrAssign>

                    $current@att1 = "oh boy"
                    print $current.toXML<AttrAssign att1="oh boy"></AttrAssign>]]

Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Location:
Inherits: Concept

Constructor List

create (String , Concept )
top

Method List

StringgetLabel
StringgetName
ConceptgetValue
StringgetValueType
setLabel (String $label)
setValue (Concept $value)
StringtoXML
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

Detailed Constructor Info

create (String , Concept )
Parameters:
:The label of this Attribute.
:The value of this Attribute.

Constructs a new Attribute concept with the specified value and label.

top

Detailed Method Info

getLabel
Returns: String

Returns a string concept representing this Attribute's label.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").getLabel
              ]
            ]
            -- the result is --
            AttrLabel
            

top
getName
Returns: String

Returns a string concept representing this Attribute's name.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").getName
              ]
            ]
            -- the result is --
            attr
            

top
getValue
Returns: Concept

Returns a concept representing this Attribute's value.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").getValue
              ]
            ]
            -- the result is --
            blue
            

top
getValueType
Returns: String

Returns this concept's value type.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").getValueType
              ]
            ]
            -- the result is --
            String
            

top
setLabel (String $label)
Parameters:
$label :The new label to be set.
Returns:

Sets the label of this Attribute concept to the specified text.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").getLabel
                $test.getConceptAttribute("attr").setLabel("NewLabel")
                print $test.getConceptAttribute("attr").getLabel
              ]
            ]
            -- the result is --
            AttrLabel
            NewLabel
            

top
setValue (Concept $value)
Parameters:
$value :The value to be set.
Returns:

Sets the value of this Attribute concept to the specified value.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").getValue
                $test.getConceptAttribute("attr").setValue("green")
                print $test.getConceptAttribute("attr").getValue
              ]
            ]
            -- the result is --
            blue
            green
            

top
toXML
Returns: String

Returns a stream representing the XML rendering of this concept.

            define Test [
              @attr="blue" label "AttrLabel"

              static : main ($args typeof Series) [
                $test typeof Test
                print $test.getConceptAttribute("attr").toXML
              ]
            ]
            -- the result is --
            AttrLabel="blue"
            

top