Teaching Aid

Query (4) / operator “empty”

 

 
Copy/Paste the following code to your GroIMP project:
//**********************************************************
/*
You will learn:
– the use of the aggregation operator empty()
to check the result set of a query.
*/

module B extends Sphere(0.1)
{{setShader(GREEN);}};

// module A is not drawn
module A;

protected void init()
[
Axiom ==> P(1) D(0.5) F(10) [ RU(30) B ] A B;
]

public void runB()
[

// The query is used in a condition.
// The set of results of the query (set of graphs) is checked
// by the aggregating function empty() for emptyness.

b:B, (empty((* b -ancestor-> A *))) ==> F(5) B;
]

public void runAB()
[
A B ==> F(10) [ RU(30) B ] A B;
]

//**********************************************************
 

DATE: 2009

 

AUTHOR: W. Kurth

 

DESCRIPTION: see model

 

Welcome to the website grogra.de. This site is the web centre of growth grammars of the Department Ecoinformatics, Biometrics and Forest Growth at the Georg-August University of Göttingen and its cooperation partners.