@SuppressWarnings("rawtypes") @Override public boolean createFrom(final IScope scope,final List<Map<String,Object>> inits,final Integer max,final Object input,final Arguments init,final CreateStatement statement){
  final GamaCSVFile source=(GamaCSVFile)input;
  final IExpression header=statement.getHeader();
  if (header != null) {
    source.forceHeader(Cast.asBool(scope,header.value(scope)));
  }
  final boolean hasHeader=source.hasHeader();
  final IMatrix<?> mat=source.getContents(scope);
  if (mat == null || mat.isEmpty(scope)) {
    return false;
  }
  int rows=mat.getRows(scope);
  final int cols=mat.getCols(scope);
  rows=max == null ? rows : CmnFastMath.min(rows,max);
  List<String> headers;
  if (hasHeader) {
    headers=source.getAttributes(scope);
  }
 else {
    headers=new ArrayList<String>();
    for (int j=0; j < cols; j++) {
      headers.add(String.valueOf(j));
    }
  }
  for (int i=0; i < rows; i++) {
    final Map<String,Object> map=GamaMapFactory.create(hasHeader ? Types.STRING : Types.INT,Types.NO_TYPE);
    final IList vals=mat.getRow(scope,i);
    for (int j=0; j < cols; j++) {
      map.put(headers.get(j),vals.get(j));
    }
    statement.fillWithUserInit(scope,map);
    inits.add(map);
  }
  return true;
}

@ SuppressWarnings ( "rawtypes" ) @ Override public boolean createFrom ( final IScope scope , final List < Map < String , Object > > inits , final Integer max , final Object input , final Arguments init , final CreateStatement statement ) { final GamaCSVFile source = ( GamaCSVFile ) input ; final IExpression header = statement . getHeader ( ) ; if ( header != null ) { source . forceHeader ( Cast . asBool ( scope , header . value ( scope ) ) ) ; } final boolean hasHeader = source . hasHeader ( ) ; final IMatrix < ? > mat = source . getContents ( scope ) ; if ( mat == null || mat . isEmpty ( scope ) ) { return false ; } int rows = mat . getRows ( scope ) ; final int cols = mat . getCols ( scope ) ; rows = max == null ? rows : CmnFastMath . min ( rows , max ) ; List < String > headers ; if ( hasHeader ) { headers = source . getAttributes ( scope ) ; } else { headers = new ArrayList < String > ( ) ; for ( int j = 0 ; j < cols ; j ++ ) { headers . add ( String . valueOf ( j ) ) ; } } for ( int i = 0 ; i < rows ; i ++ ) { final Map < String , Object > map = GamaMapFactory . create ( hasHeader ? Types . STRING : Types . INT , Types . NO_TYPE ) ; final IList vals = mat . getRow ( scope , i ) ; for ( int j = 0 ; j < cols ; j ++ ) { map . put ( headers . get ( j ) , vals . get ( j ) ) ; } statement . fillWithUserInit ( scope , map ) ; inits . add ( map ) ; } return true ; }
method createfrom ( ) method used to read initial values and attributes from a csv values descring a synthetic population
