mn8 Language Reference | Index    

Method

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

Description

Method concept, you can get the methods using the .getConceptMethods, and you can get some informations about those methods using this concept.

Usage

I suppose you have an mn8 script named Test.mn8 and you want to obtain the methods from your script and you want to work with the informations from methods.

    # first step is collecting the methods from script
    # but without the methods inherited from Concept
    $tmp1 = Concept.getConceptMethods
    $tmp2 = Test.getConceptMethods
    $methods typeof Series
    each $i in $tmp2 do [
      if not $tmp1.contains($i) then [
        $methods.add($i)
      ]
    ]
    # now in the $methods we have only the 
    # methods from script

    # in the second step we are printing out all the 
    # parameter names and types from methods
    each $i in $methods do [
      print "The method name is: " + $i.getName
      print "The return type is: " + $i.getReturnType
      $ser1 = $i.getParameterTypes
      $ser2 = $i.getParameterNames      
      each $p in $ser1 do [
        $idx = $ser1@index
        print "parameter nr." + $idx
        print "   - name: " + $ser2.elementAt($idx)
        print "   - type: " + $p
      ]
    ]
      
Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Location:
Inherits: Concept

Method List

Conceptinvoke (Concept $on, Series $parameters)
StringgetMethodSignature
StringgetName
StringgetDeclaringConcept
StringgetReturnType
LogicalhasReturn
LogicalisStatic
SeriesgetParameterTypes
SeriesgetParameterNames
SeriesgetModifiers
StringtoTXT
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 Method Info

invoke (Concept $on, Series $parameters)
Parameters:
$on :The method will be invoked in this concept
$parameters :The invoked method parameters
Returns: Concept

Usefull method to invoke a method from another Concept.

top
getMethodSignature
Returns: String

Getting the method signature in method name and parameter types format.

top
getName
Returns: String

Obtaining the method name.

top
getDeclaringConcept
Returns: String

The concept name were the method was declared.

top
getReturnType
Returns: String

Obtaining the the method's return type.

top
hasReturn
Returns: Logical

Loking after the method's return, if it have will returns true.

top
isStatic
Returns: Logical

True if the method is static.

top
getParameterTypes
Returns: Series

Gets the parameter types.

top
getParameterNames
Returns: Series

Gets the parameter names.

top
getModifiers
Returns: Series

Returns the method modifiers: null, static (others like public, private is not implemented yet)

top
toTXT
Returns: String

Human readable 'about' form of method.

top