Ejemplo n.º 1
0
 @Override
 public IList listValue(final IScope scope, final IType contentsType, final boolean copy)
     throws GamaRuntimeException {
   // return getPopulation(scope).listValue(scope, contentsType);
   // hqnghi 16/04/14
   IPopulation pop = getPopulation(scope);
   if (pop == null) {
     pop = scope.getSimulationScope().getPopulationFor(contentsType.getName());
   }
   return pop.listValue(scope, contentsType, false);
   // end-hqnghi
 }
Ejemplo n.º 2
0
 @Override
 public IType getType() {
   // Adapter ca pour prendre ne ocmpte les ITypeProvider
   IType tt = facets.getTypeDenotedBy(TYPE, this);
   IType kt = facets.getTypeDenotedBy(INDEX, this, tt.getKeyType());
   IType ct = facets.getTypeDenotedBy(OF, this, tt.getContentType());
   final boolean isContainerWithNoContentsType = tt.isContainer() && ct == Types.NO_TYPE;
   final boolean isContainerWithNoKeyType = tt.isContainer() && kt == Types.NO_TYPE;
   final boolean isSpeciesWithAgentType = tt.id() == IType.SPECIES && ct.id() == IType.AGENT;
   if (isContainerWithNoContentsType || isContainerWithNoKeyType || isSpeciesWithAgentType) {
     compileTypeProviderFacets();
     final IExpression expr = facets.getExpr(INIT, VALUE, UPDATE, FUNCTION, DEFAULT);
     if (expr != null) {
       final IType exprType = expr.getType();
       if (tt.isAssignableFrom(exprType)) {
         tt = exprType;
       } else {
         if (isContainerWithNoKeyType) {
           kt = exprType.getKeyType();
         }
         if (isContainerWithNoContentsType || isSpeciesWithAgentType) {
           ct = exprType.getContentType();
         }
       }
     }
   }
   return GamaType.from(tt, kt, ct);
 }