Nasal library/geo: Difference between revisions

Jump to navigation Jump to search
→‎PositionedSearch: some more, but still WIP
(→‎PositionedSearch: some more, but still WIP)
Line 295: Line 295:
|param4text = Optional <code>'''me'''</code> reference. This will be used as the <code>'''me'''</code> reference in each of the above fucntions.
|param4text = Optional <code>'''me'''</code> reference. This will be used as the <code>'''me'''</code> reference in each of the above fucntions.
|example1 = var searchCmd = func(){
|example1 = var searchCmd = func(){
     return ["a", "b", "c"];
     return positioned.findAirportsWithinRange(2);
};
};
var added = func(el){
var added = func(apt){
     print("Element '", el, "' added");
     print("Airport ", apt.id, " added");
}
}
var removed = func(el){
var removed = func(apt){
     print("Element '", el, "' removed");
     print("Airport ", apt.id, " removed");
}
}


Line 323: Line 323:
|param1 = searchCmd
|param1 = searchCmd
|param1text = Optional search function to use instead of the one given in <code>[[#new()_2|PositionedSearch.new()]]</code>.
|param1text = Optional search function to use instead of the one given in <code>[[#new()_2|PositionedSearch.new()]]</code>.
|example1 =  
|example1 = var searchCmd = func(){
    return positioned.findAirportsWithinRange(2);
};
var added = func(apt){
    print("Airport ", apt.id, " added");
}
var removed = func(apt){
    print("Airport ", apt.id, " removed");
}
 
var searcher = geo.PositionedSearch.new(searchCmd, added, removed);
searcher.update();
}}
}}
==== _equals ====
==== _equals ====
{{Nasal doc
|syntax = geo.PositionedSearch._equals;
|text = Checks if two objects are equal. You must redefine this function to use <code>geo.PositionedSearch</code> for other uses.
|param1 = searchCmd
|param1text = Optional search function to use instead of the one given in <code>[[#new()_2|PositionedSearch.new()]]</code>.
|example1 = var searchCmd = func(){
    return positioned.findAirportsWithinRange(2);
};
var added = func(apt){
    print("Airport ", apt.id, " added");
}
var removed = func(apt){
    print("Airport ", apt.id, " removed");
}
var searcher = geo.PositionedSearch.new(searchCmd, added, removed);
searcher.update();
}}


== Functions ==
== Functions ==

Navigation menu