Initialize grid cell modules
760560
def initialize(self):
    

    if self._modules is None:
      self._modules = []
      for i in xrange(self.moduleCount):
        self._modules.append(ThresholdedGaussian2DLocationModule(
          cellsPerAxis=self.cellsPerAxis,
          scale=self.scale[i],
          orientation=self.orientation[i],
          anchorInputSize=self.anchorInputSize,
          activeFiringRate=self.activeFiringRate,
          bumpSigma=self.bumpSigma,
          activationThreshold=self.activationThreshold,
          initialPermanence=self.initialPermanence,
          connectedPermanence=self.connectedPermanence,
          learningThreshold=self.learningThreshold,
          sampleSize=self.sampleSize,
          permanenceIncrement=self.permanenceIncrement,
          permanenceDecrement=self.permanenceDecrement,
          maxSynapsesPerSegment=self.maxSynapsesPerSegment,
          bumpOverlapMethod=self.bumpOverlapMethod,
          seed=self.seed))

      # Create a projection matrix for each module used to convert higher
      # dimension displacements to 2D
      if self.dimensions > 2:
        self._projection = [
          self.createProjectionMatrix(dimensions=self.dimensions)
            for _ in xrange(self.moduleCount)]
198197
function inits() {
  log( "init", "step="+step+" ajaxOngoing="+ajaxOngoing );
  if ( getParam( 'nc' ) == 'true' ) {
    noCache = "?nc="+ Math.random();
  }

  if ( ajaxOngoing == 0 ) { 
    if ( step == "load-lang" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load module list...');
      loadLang();
      step = "loadmodulemap";
    } else if ( step == "loadmodulemap" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load module list...');
      loadModuleList();
      step = "loaddecor";
    } else if ( step == "loaddecor" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load decor config...');
      loadDecorList();
      step = "loadstructure";
    } else  if ( step == "loadstructure" ) {
      ajaxOngoing++;
      log( 'init', 'Load Structure File ...');
      loadStructure();
      step = "loadincludes";
    } else if ( step == "loadincludes" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load include JS modules ...');
      checkModules( );
      loadIncludes();
      step = "loadmodules";
    } else if ( step == "loadmodules" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load JS modules ...');
      loadModules();
      if ( layout.theme != null ) {
        loadCSSrelPath( 'css-custom/'+layout.theme+'.css' );
        //jQuery('head').append('<link rel="stylesheet" rel="nofollow" href="css-custom/'+layout.theme+'.css" type="text/css" />');        
      }
      loadCSSrelPath( "css-custom/custom.css" );
      if ( pageInfo["layoutMode"] == 'tablet' ) {
        loadCSSrelPath( "css-custom/custom-t.css" );
        //jQuery('head').append('<link rel="stylesheet" rel="nofollow" href="css-custom/custom-t.css" type="text/css" />');        
      } else if ( pageInfo["layoutMode"] == 'mobile' ) {
        loadCSSrelPath( "css-custom/custom-m.css" );
        //jQuery('head').append('<link rel="st<ylesheet" rel="nofollow" href="css-custom/custom-m.css" type="text/css" />');
      } 
      step = "initmodules";
    } else  if ( step == "initmodules" ) {
      ajaxOngoing++;
      log( 'init', 'Load Structure File ...');
      initModules( layout );
      step = "buildstructure";
    } else  if ( step == "buildstructure" ) {
      ajaxOngoing++;
      log( 'init', 'Start to build HTML ...');
      buildStructure( layout );
      step = "loadres-ht";
    } else  if ( step == "loadres-ht" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load resources HTML ...');
      loadResourcesHT();
      step = "call-hooks";
    } else  if ( step == "call-hooks" ) {
      log( 'init', 'Call module hooks ...');
      callHooks();
      step = "loadres-js";
    } else  if ( step == "loadres-js" ) {
      ajaxOngoing++;
      log( 'init', 'Start to load resources JS ...');
      loadResourcesJS();
      step = "callbacks";
    } else  if ( step == "callbacks" ) {
      log( 'init', 'Start callback methods for resources...');
      resourceCallbacks();
      step = "dialogs";
    } else  if ( step == "dialogs" ) {
      log( 'init', 'Start load dialogs for resources...');
      resourceDialogs();
      step = "afterInit";
    } else  if ( step == "afterInit" ) {
      log( 'init', 'Start load dialogs for resources...');
      startModulesAfterPageLoad( layout );
      clearInterval( initTimerId );
      step = "done";
    }
  }  
}
358556
public function initialize(Grid $grid)
    {
        $this->grid = $grid;
        if (method_exists($this, 'initializeComponents')) {
            $this->initializeComponents($grid);
        }
    }
106715
@Override
    public void initModule() throws ModuleInitializationException {

        String dsMediation = getParameter("doMediateDatastreams");
        if (dsMediation == null) {
            throw new ModuleInitializationException("doMediateDatastreams parameter must be specified.",
                                                    getRole());
        }
    }
1154945
private void initialize() {
        this.setName(Constant.messages.getString("options.script.title"));
        this.setLayout(new GridBagLayout());

        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.weightx = 1.0;
        gbc.anchor = GridBagConstraints.LINE_START;
        gbc.fill = GridBagConstraints.BOTH;

        this.add(new JLabel(Constant.messages.getString("options.script.label.dirs")), gbc);

        tokensOptionsPanel = new AntiCsrfMultipleOptionsPanel(this.extension, getScriptDirModel());
        
        gbc.weighty = 1.0;
        this.add(tokensOptionsPanel, gbc);
	}
569612
private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        splSqlQuery = new javax.swing.JSplitPane();
        pnlSqlQuery = new javax.swing.JPanel();
        scrSqlQuery = new javax.swing.JScrollPane();
        txtSqlQuery = new javax.swing.JTextArea();
        cmdExecute = new javax.swing.JButton();
        pnlQueryResult = new javax.swing.JPanel();
        scrQueryResult = new javax.swing.JScrollPane();
        tblQueryResult = new javax.swing.JTable();

        setBorder(javax.swing.BorderFactory.createTitledBorder("SQL Query"));
        setAlignmentX(5.0F);
        setAlignmentY(5.0F);
        setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        setPreferredSize(new java.awt.Dimension(640, 480));
        setLayout(new java.awt.BorderLayout(5, 5));

        splSqlQuery.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        splSqlQuery.setResizeWeight(0.3);

        pnlSqlQuery.setMinimumSize(new java.awt.Dimension(156, 100));
        pnlSqlQuery.setPreferredSize(new java.awt.Dimension(156, 100));
        pnlSqlQuery.setLayout(new java.awt.GridBagLayout());

        scrSqlQuery.setPreferredSize(new java.awt.Dimension(600, 100));

        txtSqlQuery.setColumns(20);
        txtSqlQuery.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        txtSqlQuery.setLineWrap(true);
        txtSqlQuery.setRows(2);
        txtSqlQuery.setBorder(null);
        txtSqlQuery.setPreferredSize(new java.awt.Dimension(600, 100));
        scrSqlQuery.setViewportView(txtSqlQuery);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 2.0;
        gridBagConstraints.weighty = 2.0;
        pnlSqlQuery.add(scrSqlQuery, gridBagConstraints);

        cmdExecute.setIcon(IconLoader.getImageIcon("images/execute.png"));
        cmdExecute.setMnemonic('x');
        cmdExecute.setText("Execute");
        cmdExecute.setToolTipText("Execute the SQL query");
        cmdExecute.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        cmdExecute.setContentAreaFilled(false);
        cmdExecute.setMargin(new java.awt.Insets(5, 14, 5, 14));
        cmdExecute.setMaximumSize(new java.awt.Dimension(85, 25));
        cmdExecute.setMinimumSize(new java.awt.Dimension(85, 25));
        cmdExecute.setPreferredSize(new java.awt.Dimension(85, 25));
        cmdExecute.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdExecuteActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        pnlSqlQuery.add(cmdExecute, gridBagConstraints);

        splSqlQuery.setLeftComponent(pnlSqlQuery);

        pnlQueryResult.setLayout(new java.awt.BorderLayout());

        tblQueryResult.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Results"
            }
        ));
        tblQueryResult.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        scrQueryResult.setViewportView(tblQueryResult);

        pnlQueryResult.add(scrQueryResult, java.awt.BorderLayout.CENTER);

        splSqlQuery.setRightComponent(pnlQueryResult);

        add(splSqlQuery, java.awt.BorderLayout.CENTER);
    }
680246
def createCells(self):
        ''''''
        # add individual cells
        if 'cellsList' in self.tags:
            cells = self.createCellsList()

        # create cells based on fixed number of cells
        elif 'numCells' in self.tags:
            cells = self.createCellsFixedNum()

        # create cells based on density (optional ynorm-dep)
        elif 'density' in self.tags:
            cells = self.createCellsDensity()

        # create cells based on density (optional ynorm-dep)
        elif 'gridSpacing' in self.tags:
            cells = self.createCellsGrid()

        # not enough tags to create cells
        else:
            self.tags['numCells'] = 1
            print('Warninig: number or density of cells not specified for population %s; defaulting to numCells = 1' % (self.tags['pop']))
            cells = self.createCellsFixedNum()

        return cells
1104487
private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        pnlSavedQuery = new javax.swing.JPanel();
        scrSavedQuery = new javax.swing.JScrollPane();
        treSavedQuery = new javax.swing.JTree();
        pnlCommandPanel = new javax.swing.JPanel();
        lblSavedQuery = new javax.swing.JLabel();
        cmdRemove = new javax.swing.JButton();
        cmdAdd = new javax.swing.JButton();

        setLayout(new java.awt.BorderLayout());

        pnlSavedQuery.setMinimumSize(new java.awt.Dimension(200, 50));
        pnlSavedQuery.setLayout(new java.awt.BorderLayout());

        scrSavedQuery.setMinimumSize(new java.awt.Dimension(400, 200));
        scrSavedQuery.setOpaque(false);
        scrSavedQuery.setPreferredSize(new java.awt.Dimension(300, 200));

        treSavedQuery.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        treSavedQuery.setForeground(new java.awt.Color(51, 51, 51));
        treSavedQuery.setModel(queryControllerModel);
        treSavedQuery.setCellRenderer(new SavedQueriesTreeCellRenderer());
        treSavedQuery.setMaximumSize(new java.awt.Dimension(5000, 5000));
        treSavedQuery.setRootVisible(false);
        treSavedQuery.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                reselectQueryNode(evt);
            }
        });
        treSavedQuery.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                selectQueryNode(evt);
            }
        });
        scrSavedQuery.setViewportView(treSavedQuery);

        pnlSavedQuery.add(scrSavedQuery, java.awt.BorderLayout.CENTER);

        pnlCommandPanel.setLayout(new java.awt.GridBagLayout());

        lblSavedQuery.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
        lblSavedQuery.setForeground(new java.awt.Color(153, 153, 153));
        lblSavedQuery.setText("Stored Query:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.5;
        pnlCommandPanel.add(lblSavedQuery, gridBagConstraints);

        cmdRemove.setIcon(IconLoader.getImageIcon("images/minus.png"));
        cmdRemove.setText("Remove");
        cmdRemove.setToolTipText("Remove the selected query");
        cmdRemove.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        cmdRemove.setContentAreaFilled(false);
        cmdRemove.setIconTextGap(5);
        cmdRemove.setMaximumSize(new java.awt.Dimension(25, 25));
        cmdRemove.setMinimumSize(new java.awt.Dimension(25, 25));
        cmdRemove.setPreferredSize(new java.awt.Dimension(80, 25));
        cmdRemove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdRemoveActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
        pnlCommandPanel.add(cmdRemove, gridBagConstraints);

        cmdAdd.setIcon(IconLoader.getImageIcon("images/plus.png"));
        cmdAdd.setText("Add");
        cmdAdd.setToolTipText("Add a new query");
        cmdAdd.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        cmdAdd.setContentAreaFilled(false);
        cmdAdd.setIconTextGap(4);
        cmdAdd.setMaximumSize(new java.awt.Dimension(25, 25));
        cmdAdd.setMinimumSize(new java.awt.Dimension(25, 25));
        cmdAdd.setPreferredSize(new java.awt.Dimension(63, 25));
        cmdAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdAddActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
        pnlCommandPanel.add(cmdAdd, gridBagConstraints);

        pnlSavedQuery.add(pnlCommandPanel, java.awt.BorderLayout.NORTH);

        add(pnlSavedQuery, java.awt.BorderLayout.CENTER);
    }
303478
private void initComponents()//GEN-BEGIN:initComponents
    {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel1 = new javax.swing.JPanel();
        lblEnabled = new javax.swing.JLabel();
        cbEnabled = new javax.swing.JCheckBox();
        lblDisabledByParent = new javax.swing.JLabel();
        cbDisabledByParent = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        lblColumnName = new javax.swing.JLabel();
        tfColumnName = new javax.swing.JTextField();
        lblJavaFieldName = new javax.swing.JLabel();
        tfJavaFieldName = new javax.swing.JTextField();
        lblSQLTypeName = new javax.swing.JLabel();
        tfSQLTypeName = new javax.swing.JTextField();
        lblSQLType = new javax.swing.JLabel();
        cmbSQLType = new javax.swing.JComboBox();
        lblJavaType = new javax.swing.JLabel();
        cmbJavaType = new javax.swing.JComboBox();

        setLayout(new java.awt.GridBagLayout());

        addComponentListener(new java.awt.event.ComponentAdapter()
        {
            public void componentShown(java.awt.event.ComponentEvent evt)
            {
                formComponentShown(evt);
            }
            public void componentHidden(java.awt.event.ComponentEvent evt)
            {
                formComponentHidden(evt);
            }
        });

        addHierarchyListener(new java.awt.event.HierarchyListener()
        {
            public void hierarchyChanged(java.awt.event.HierarchyEvent evt)
            {
                formHierarchyChanged(evt);
            }
        });

        jPanel1.setLayout(new java.awt.GridLayout(8, 2));

        lblEnabled.setDisplayedMnemonic('e');
        lblEnabled.setText("enabled:");
        jPanel1.add(lblEnabled);

        cbEnabled.setMnemonic('e');
        cbEnabled.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cbEnabledActionPerformed(evt);
            }
        });

        jPanel1.add(cbEnabled);

        lblDisabledByParent.setText("disabled by Parent:");
        jPanel1.add(lblDisabledByParent);

        cbDisabledByParent.setMnemonic('d');
        cbDisabledByParent.setEnabled(false);
        jPanel1.add(cbDisabledByParent);

        jPanel1.add(jLabel4);

        jPanel1.add(jLabel3);

        lblColumnName.setLabelFor(tfColumnName);
        lblColumnName.setText("Column Name:");
        jPanel1.add(lblColumnName);

        tfColumnName.setEditable(false);
        tfColumnName.setText("jTextField1");
        tfColumnName.setBorder(null);
        tfColumnName.setDisabledTextColor((java.awt.Color) javax.swing.UIManager.getDefaults().get("windowText"));
        tfColumnName.setEnabled(false);
        jPanel1.add(tfColumnName);

        lblJavaFieldName.setLabelFor(tfColumnName);
        lblJavaFieldName.setText("Java Field Name:");
        jPanel1.add(lblJavaFieldName);

        tfJavaFieldName.setText("jTextField1");
        tfJavaFieldName.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                tfJavaFieldNameActionPerformed(evt);
            }
        });

        tfJavaFieldName.addFocusListener(new java.awt.event.FocusAdapter()
        {
            public void focusLost(java.awt.event.FocusEvent evt)
            {
                tfJavaFieldNameFocusLost(evt);
            }
        });

        tfJavaFieldName.addKeyListener(new java.awt.event.KeyAdapter()
        {
            public void keyTyped(java.awt.event.KeyEvent evt)
            {
                tfJavaFieldNameKeyTyped(evt);
            }
        });

        jPanel1.add(tfJavaFieldName);

        lblSQLTypeName.setLabelFor(tfColumnName);
        lblSQLTypeName.setText("SQL Type Name:");
        jPanel1.add(lblSQLTypeName);

        tfSQLTypeName.setEditable(false);
        tfSQLTypeName.setText("jTextField1");
        tfSQLTypeName.setBorder(null);
        tfSQLTypeName.setDisabledTextColor((java.awt.Color) javax.swing.UIManager.getDefaults().get("windowText"));
        tfSQLTypeName.setEnabled(false);
        jPanel1.add(tfSQLTypeName);

        lblSQLType.setText("Java SQL Type:");
        jPanel1.add(lblSQLType);

        cmbSQLType.setModel(new javax.swing.DefaultComboBoxModel(Utilities.vJDBCTypeNames));
        cmbSQLType.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cmbSQLTypeActionPerformed(evt);
            }
        });

        jPanel1.add(cmbSQLType);

        lblJavaType.setText("Java Type:");
        jPanel1.add(lblJavaType);

        cmbJavaType.setEditable(true);
        cmbJavaType.setModel( new org.apache.ojb.tools.swing.SortingComboBoxModel(Utilities.vJavaTypes)
            /*new javax.swing.DefaultComboBoxModel(at.citec.ojb.schemegenerator.Utilities.vJavaTypes)*/);
        cmbJavaType.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cmbJavaTypeActionPerformed(evt);
            }
        });

        jPanel1.add(cmbJavaType);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        add(jPanel1, gridBagConstraints);

    }
950368
def _initialize_components(self, kwargs):
        
        tomodir = None

        # load/assign grid
        if 'tomodir' in kwargs:
            # load grid
            tomodir = kwargs.get('tomodir')
            print('importing tomodir {}'.format(tomodir))
            assert os.path.isdir(tomodir)
            grid = CRGrid.crt_grid(
                tomodir + os.sep + 'grid' + os.sep + 'elem.dat',
                tomodir + os.sep + 'grid' + os.sep + 'elec.dat',
            )
            self.grid = grid
        elif 'grid' in kwargs:
            self.grid = kwargs.get('grid')
        elif 'elem_file' in kwargs and 'elec_file' in kwargs:
            grid = CRGrid.crt_grid()
            grid.load_grid(
                kwargs['elem_file'],
                kwargs['elec_file'],
            )
            self.grid = grid
        else:
            raise Exception(
                'You must provide either a grid instance or ' +
                'elem_file/elec_file file paths'
            )

        crmod_cfg = kwargs.get('crmod_cfg', CRcfg.crmod_config())
        self.crmod_cfg = crmod_cfg

        crtomo_cfg = kwargs.get('crtomo_cfg', CRcfg.crtomo_config())
        self.crtomo_cfg = crtomo_cfg

        parman = kwargs.get('parman', pM.ParMan(self.grid))
        self.parman = parman

        nodeman = kwargs.get('nodeman', nM.NodeMan(self.grid))
        self.nodeman = nodeman

        configs_abmn = kwargs.get('configs_abmn', None)
        config = cConf.ConfigManager(
            nr_of_electrodes=self.grid.nr_of_electrodes
        )
        if configs_abmn is not None:
            config.add_to_configs(configs_abmn)
        self.configs = config

        config_file = kwargs.get('config_file', None)
        if config_file is not None:
            self.configs.load_crmod_config(config_file)

        voltage_file = kwargs.get('volt_file', None)
        if voltage_file is not None:
            cids = self.configs.load_crmod_volt(voltage_file)
            self.assignments['measurements'] = cids

        self.plot = PlotManager.plotManager(
            grid=self.grid,
            nm=self.nodeman,
            pm=self.parman,
        )

        # if we load from a tomodir, also load configs and inversion results
        if tomodir is not None:
            print('importing tomodir results')
            # forward configurations
            config_file = tomodir + os.sep + 'config' + os.sep + 'config.dat'
            if os.path.isfile(config_file):
                self.configs.load_crmod_config(config_file)
            # load inversion results
            self.read_inversion_results(tomodir)
173075
function gridMesh(nx, ny, origin, dx, dy) {
  //Unpack default arguments
  origin = origin || [0,0]
  if(!dx || dx.length < origin.length) {
    dx = dup(origin.length)
    if(origin.length > 0) {
      dx[0] = 1
    }
  }
  if(!dy || dy.length < origin.length) {
    dy = dup(origin.length)
    if(origin.length > 1) {
      dy[1] = 1
    }
  }
  //Initialize cells
  var cells = []
    , positions = dup([(nx+1) * (ny+1), origin.length])
    , i, j, k, q, d = origin.length
  for(j=0; j<ny; ++j) {
    for(i=0; i<nx; ++i) {
      cells.push([ p(i,j,nx), p(i+1, j,nx), p(i, j+1,nx) ])
      cells.push([ p(i+1,j,nx), p(i+1,j+1,nx), p(i,j+1,nx) ])
    }
  }
  //Initialize positions
  for(j=0; j<=ny; ++j) {
    for(i=0; i<=nx; ++i) {
      q = positions[ p(i, j, nx) ]
      for(k=0; k<d; ++k) {
        q[k] = origin[k] + dx[k] * i + dy[k] * j
      }
    }
  }
  return {
    positions: positions,
    cells: cells
  }
}
546339
protected void init() {
        this.gridHeader = createGridHeader();
        this.grid = createGrid();
        buildLayout();
        setSizeFull();
        setImmediate(true);
        if (doSubscribeToEventBus()) {
            eventBus.subscribe(this);
        }
    }
703126
private void initGrid() {
        // Setting up images grid
        final int cols = getResources().getInteger(R.integer.images_grid_columns);

        views.grid.setLayoutManager(new GridLayoutManager(this, cols));

        gridAdapter = new PhotoListAdapter(this);
        gridAdapter.setLoadingOffset(PAGE_SIZE / 2);
        gridAdapter.setCallbacks(new EndlessRecyclerAdapter.LoaderCallbacks() {
            @Override
            public boolean canLoadNextItems() {
                return gridAdapter.canLoadNext();
            }

            @Override
            public void loadNextItems() {
                // We should either load all items that were loaded before state save / restore,
                // or next page if we already loaded all previously shown items
                int count = Math.max(savedPhotoCount, gridAdapter.getCount() + PAGE_SIZE);
                Events.create(FlickrApi.LOAD_IMAGES_EVENT).param(count).post();
            }
        });
        views.grid.setAdapter(gridAdapter);
    }
597937
function init() {
  var root = new THREERoot();
  root.renderer.setClearColor(0x000000);
  root.camera.position.set(12, 12, 0);

  var light = new THREE.DirectionalLight(0xffffff, 1.0);
  light.position.set(0, 1, 0);
  root.add(light);
  root.addUpdateCallback(function() {
    light.position.copy(root.camera.position).normalize();
  });

  var pointLight = new THREE.PointLight();
  pointLight.position.set(0, 10, 0);
  root.add(pointLight);

  var gridHelper, animation, tween;

  // html stuff
  var elCount = document.querySelector('.count');
  var elBtnLeft = document.querySelector('.btn.left');
  var elBtnRight = document.querySelector('.btn.right');

  var sizes = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000];
  var index = 0;

  function createAnimation(i) {
    var gridSize = sizes[i];

    elCount.innerHTML = gridSize;
    elBtnRight.classList.toggle('disabled', i === sizes.length - 1);
    elBtnLeft.classList.toggle('disabled', index === 0);

    if (gridHelper) {
      root.remove(gridHelper);
      gridHelper.material.dispose();
      gridHelper.geometry.dispose();
    }

    if (animation) {
      root.remove(animation);
      animation.material.dispose();
      animation.geometry.dispose();
    }

    gridHelper = new THREE.GridHelper(gridSize * 0.5, 1, 0x222222, 0x444444);
    root.add(gridHelper);

    animation = new Animation(gridSize);
    root.add(animation);

    tween = animation.animate({repeat:-1, repeatDelay: 0.0, ease:Power0.easeNone}).timeScale(2.0);
  }

  elBtnLeft.addEventListener('click', function() {
    index = Math.max(0, index - 1);
    createAnimation(index);
  });
  elBtnRight.addEventListener('click', function() {
    index = Math.min(index + 1, sizes.length - 1);
    createAnimation(index);
  });

  createAnimation(index);
}
185422
def _createGsshaPyObjects(self, cell):
        
        # Initialize GSSHAPY PipeGridCell object
        gridCell = GridStreamCell(cellI=cell['i'],
                                  cellJ=cell['j'],
                                  numNodes=cell['numNodes'])

        # Associate GridStreamCell with GridStreamFile
        gridCell.gridStreamFile = self

        for linkNode in cell['linkNodes']:
            # Create GSSHAPY GridStreamNode object
            gridNode = GridStreamNode(linkNumber=linkNode['linkNumber'],
                                      nodeNumber=linkNode['nodeNumber'],
                                      nodePercentGrid=linkNode['percent'])

            # Associate GridStreamNode with GridStreamCell
            gridNode.gridStreamCell = gridCell
55289
public void init(BaseScreen gridScreen, int iIconField, int iStartDateTimeField, int iEndDateTimeField, int iDescriptionField, int iStatusField)
    {
        super.init(gridScreen, iIconField, iStartDateTimeField, iEndDateTimeField, iDescriptionField, iStatusField);
    }
181857
protected void initializeClusters() {

		int offsetX = Math.max(BORDER,((input.width-1) % gridInterval)/2);
		int offsetY = Math.max(BORDER,((input.height-1) % gridInterval)/2);

		int clusterId = 0;
		clusters.reset();
		for( int y = offsetY; y < input.height-BORDER; y += gridInterval ) {
			for( int x = offsetX; x < input.width-BORDER; x += gridInterval ) {
				Cluster c = clusters.grow();
				c.id = clusterId++;
				if( c.color == null)
					c.color = new float[numBands];

				// sets the location and color at the local minimal gradient point
				perturbCenter( c , x , y );
			}
		}
	}