Populates a resource availability table.

@param table resource availability table
@param data file data
346120
public void process(AvailabilityTable table, byte[] data)
   {
      if (data != null)
      {
         Calendar cal = DateHelper.popCalendar();
         int items = MPPUtility.getShort(data, 0);
         int offset = 12;

         for (int loop = 0; loop < items; loop++)
         {
            double unitsValue = MPPUtility.getDouble(data, offset + 4);
            if (unitsValue != 0)
            {
               Date startDate = MPPUtility.getTimestampFromTenths(data, offset);
               Date endDate = MPPUtility.getTimestampFromTenths(data, offset + 20);
               cal.setTime(endDate);
               cal.add(Calendar.MINUTE, -1);
               endDate = cal.getTime();
               Double units = NumberHelper.getDouble(unitsValue / 100);
               Availability item = new Availability(startDate, endDate, units);
               table.add(item);
            }
            offset += 20;
         }
         DateHelper.pushCalendar(cal);
         Collections.sort(table);
      }
   }
1295764
private void createIndexTables(AccumuloTable table)
    {
        // Early-out if table is not indexed
        if (!table.isIndexed()) {
            return;
        }

        // Create index table if it does not exist (for 'external' table)
        if (!tableManager.exists(table.getIndexTableName())) {
            tableManager.createAccumuloTable(table.getIndexTableName());
        }

        // Create index metrics table if it does not exist
        if (!tableManager.exists(table.getMetricsTableName())) {
            tableManager.createAccumuloTable(table.getMetricsTableName());
        }

        // Set locality groups on index and metrics table
        Map<String, Set<Text>> indexGroups = Indexer.getLocalityGroups(table);
        tableManager.setLocalityGroups(table.getIndexTableName(), indexGroups);
        tableManager.setLocalityGroups(table.getMetricsTableName(), indexGroups);

        // Attach iterators to metrics table
        for (IteratorSetting setting : Indexer.getMetricIterators(table)) {
            tableManager.setIterator(table.getMetricsTableName(), setting);
        }
    }
1116564
public void apply(InMemoryLookupTable table) {
        for (Map.Entry<Integer, Set<INDArray>> entry : changes.entrySet()) {
            Set<INDArray> changes = entry.getValue();
            INDArray toChange = table.getSyn0().slice(entry.getKey());
            for (INDArray syn1 : changes)
                Nd4j.getBlasWrapper().level1().axpy(toChange.length(), 1, syn1, toChange);
        }
    }
1267959
def load_table(self, table):
        
        region = table.database if table.database else self.default_region
        resource_name, collection_name = table.table.split('_', 1)
        # we use underscore "_" instead of dash "-" for region name but boto3 need dash
        boto_region_name = region.replace('_', '-')
        resource = self.boto3_session.resource(resource_name, region_name=boto_region_name)
        if not hasattr(resource, collection_name):
            raise QueryError(
                'Unknown collection <{0}> of resource <{1}>'.format(collection_name, resource_name))

        self.attach_region(region)
        self.refresh_table(region, table.table, resource, getattr(resource, collection_name))
866885
static void populateIfChanged(CallInfo callInfo, DataSet data) {
    Table table = asTable(data.getSource()); 
    if ( table.getDirtyStatus() ) {
      table.setDirtyStatus(true);
      doPopulate(callInfo, table, data);
    }
  }
1339447
private void addDataSources(Table table, int hostId,
            List<Pair<Integer, Integer>> localPartitionsToSites,
            Set<Integer> partitionsInUse,
            final ExportDataProcessor processor,
            final long genId,
            boolean isCatalogUpdate)
    {
        for (Pair<Integer, Integer> partitionAndSiteId : localPartitionsToSites) {

            /*
             * IOException can occur if there is a problem
             * with the persistent aspects of the datasource storage
             */
            int partition = partitionAndSiteId.getFirst();
            int siteId = partitionAndSiteId.getSecond();
            synchronized(m_dataSourcesByPartition) {
                try {
                    Map<String, ExportDataSource> dataSourcesForPartition = m_dataSourcesByPartition.get(partition);
                    if (dataSourcesForPartition == null) {
                        dataSourcesForPartition = new HashMap<String, ExportDataSource>();
                        m_dataSourcesByPartition.put(partition, dataSourcesForPartition);
                    }
                    final String key = table.getTypeName();
                    if (!dataSourcesForPartition.containsKey(key)) {
                        ExportDataSource exportDataSource = new ExportDataSource(this,
                                processor,
                                "database",
                                key,
                                partition,
                                siteId,
                                genId,
                                table.getColumns(),
                                table.getPartitioncolumn(),
                                m_directory.getPath());
                        int migrateBatchSize = CatalogUtil.getPersistentMigrateBatchSize(key);
                        exportDataSource.setupMigrateRowsDeleter(migrateBatchSize);
                        if (exportLog.isDebugEnabled()) {
                            exportLog.debug("Creating ExportDataSource for table in catalog " + key
                                    + " partition " + partition + " site " + siteId);
                        }
                        dataSourcesForPartition.put(key, exportDataSource);
                        if (isCatalogUpdate) {
                            exportDataSource.updateCatalog(table, genId);
                        }
                    } else {
                        // Associate any existing EDS to the export client in the new processor
                        ExportDataSource eds = dataSourcesForPartition.get(key);

                        ExportClientBase client = processor.getExportClient(key);
                        if (client != null) {
                            // Associate to an existing export client
                            eds.setClient(client);
                            eds.setRunEveryWhere(client.isRunEverywhere());
                        } else {
                            // Reset to no export client
                            eds.setClient(null);
                            eds.setRunEveryWhere(false);
                        }

                        // Mark in catalog only if partition is in use
                        eds.markInCatalog(partitionsInUse.contains(partition));
                        if (isCatalogUpdate) {
                            eds.updateCatalog(table, genId);
                        }
                    }
                } catch (IOException e) {
                    VoltDB.crashLocalVoltDB(
                            "Error creating datasources for table " +
                            table.getTypeName() + " host id " + hostId, true, e);
                }
            }
        }
    }
834987
private void processColumnData(ProjectFile file, Table table, byte[] data)
   {
      //System.out.println("Table=" + table.getName());
      //System.out.println(ByteArrayHelper.hexdump(data, 8, data.length-8, false, 12, ""));
      if (data != null)
      {
         int columnCount = MPPUtility.getShort(data, 4) + 1;
         int index = 8;
         int columnTitleOffset;
         Column column;
         int alignment;

         for (int loop = 0; loop < columnCount; loop++)
         {
            column = new Column(file);
            int fieldType = MPPUtility.getShort(data, index);
            if (table.getResourceFlag() == false)
            {
               column.setFieldType(MPPTaskField.getInstance(fieldType));
            }
            else
            {
               column.setFieldType(MPPResourceField.getInstance(fieldType));
            }

            //                        if (column.getFieldType() == null)
            //                        {
            //                           System.out.println(loop + ": Unknown column type " + fieldType);
            //                        }
            //                        else
            //                        {
            //                           System.out.println(loop + ": " + column.getFieldType());
            //                        }

            column.setWidth(MPPUtility.getByte(data, index + 4));

            columnTitleOffset = MPPUtility.getShort(data, index + 6);
            if (columnTitleOffset != 0)
            {
               column.setTitle(MPPUtility.getUnicodeString(data, columnTitleOffset));
            }

            alignment = MPPUtility.getByte(data, index + 8);
            if ((alignment & 0x0F) == 0x00)
            {
               column.setAlignTitle(Column.ALIGN_LEFT);
            }
            else
            {
               if ((alignment & 0x0F) == 0x01)
               {
                  column.setAlignTitle(Column.ALIGN_CENTER);
               }
               else
               {
                  column.setAlignTitle(Column.ALIGN_RIGHT);
               }
            }

            alignment = MPPUtility.getByte(data, index + 10);
            if ((alignment & 0x0F) == 0x00)
            {
               column.setAlignData(Column.ALIGN_LEFT);
            }
            else
            {
               if ((alignment & 0x0F) == 0x01)
               {
                  column.setAlignData(Column.ALIGN_CENTER);
               }
               else
               {
                  column.setAlignData(Column.ALIGN_RIGHT);
               }
            }

            table.addColumn(column);
            index += 12;
         }
      }
   }
219156
public void processResources(List<Row> permanentRows, List<Row> consumableRows)
   {
      //
      // Process permanent resources
      //
      for (Row row : permanentRows)
      {
         Resource resource = m_project.addResource();
         resource.setType(ResourceType.WORK);
         resource.setUniqueID(row.getInteger("PERMANENT_RESOURCEID"));
         resource.setEmailAddress(row.getString("EMAIL_ADDRESS"));
         // EFFORT_TIME_UNIT
         resource.setName(row.getString("NASE"));
         resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV")));
         resource.setMaxUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100));
         resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER"));
         resource.setInitials(getInitials(resource.getName()));
      }

      //
      // Process groups
      //
      /*
            for (Row row : permanentRows)
            {
               Resource resource = m_project.getResourceByUniqueID(row.getInteger("PERMANENT_RESOURCEID"));
               Resource group = m_project.getResourceByUniqueID(row.getInteger("ROLE"));
               if (resource != null && group != null)
               {
                  resource.setGroup(group.getName());
               }
            }
      */
      //
      // Process consumable resources
      //
      for (Row row : consumableRows)
      {
         Resource resource = m_project.addResource();
         resource.setType(ResourceType.MATERIAL);
         resource.setUniqueID(row.getInteger("CONSUMABLE_RESOURCEID"));
         resource.setCostPerUse(row.getDouble("COST_PER_USEDEFAULTSAMOUNT"));
         resource.setPeakUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100));
         resource.setName(row.getString("NASE"));
         resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV")));
         resource.setAvailableFrom(row.getDate("AVAILABLE_FROM"));
         resource.setAvailableTo(row.getDate("AVAILABLE_TO"));
         resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER"));
         resource.setMaterialLabel(row.getString("MEASUREMENT"));
         resource.setInitials(getInitials(resource.getName()));
      }
   }
449111
public function initialize(Table $table)
    {
        $this->table = $table;
        $this->table->setData($this->getData());
    }
1310865
private void processColumnData(ProjectFile file, Table table, byte[] data)
   {
      //System.out.println("Table=" + table);
      //System.out.println(ByteArrayHelper.hexdump(data, 12, data.length-12, true, 115, ""));

      if (data != null)
      {
         int columnCount = MPPUtility.getShort(data, 4) + 1;
         int index = 12;
         Column column;
         int alignment;

         for (int loop = 0; loop < columnCount; loop++)
         {
            column = new Column(file);
            int fieldType = MPPUtility.getShort(data, index);
            if (table.getResourceFlag() == false)
            {
               column.setFieldType(MPPTaskField14.getInstance(fieldType));
            }
            else
            {
               column.setFieldType(MPPResourceField14.getInstance(fieldType));
            }

            //System.out.println(fieldType);

            //            if (column.getFieldType() == null)
            //            {
            //               System.out.println(loop + ": Unknown column type " + fieldType);
            //            }
            //            else
            //            {
            //               System.out.println(loop + ": " + column.getFieldType());
            //            }

            column.setWidth(MPPUtility.getByte(data, index + 4));

            String columnTitle = MPPUtility.getUnicodeString(data, index + 13);
            if (columnTitle.length() != 0)
            {
               column.setTitle(columnTitle);
            }

            alignment = MPPUtility.getByte(data, index + 5);
            if ((alignment & 0x0F) == 0x00)
            {
               column.setAlignTitle(Column.ALIGN_LEFT);
            }
            else
            {
               if ((alignment & 0x0F) == 0x01)
               {
                  column.setAlignTitle(Column.ALIGN_CENTER);
               }
               else
               {
                  column.setAlignTitle(Column.ALIGN_RIGHT);
               }
            }

            alignment = MPPUtility.getByte(data, index + 7);
            if ((alignment & 0x0F) == 0x00)
            {
               column.setAlignData(Column.ALIGN_LEFT);
            }
            else
            {
               if ((alignment & 0x0F) == 0x01)
               {
                  column.setAlignData(Column.ALIGN_CENTER);
               }
               else
               {
                  column.setAlignData(Column.ALIGN_RIGHT);
               }
            }

            table.addColumn(column);
            index += 115;
         }
      }
   }
76975
public synchronized void setPartitionStatistics(Table table, Map<List<String>, PartitionStatistics> partitionStatisticsMap)
    {
        setExclusive((delegate, hdfsEnvironment) ->
                partitionStatisticsMap.forEach((partitionValues, newPartitionStats) ->
                        delegate.updatePartitionStatistics(
                                table.getDatabaseName(),
                                table.getTableName(),
                                getPartitionName(table, partitionValues),
                                oldPartitionStats -> updatePartitionStatistics(oldPartitionStats, newPartitionStats))));
    }
73704
public void setDataSource(XADataSource dataSource) {
		this.dataSource = dataSource;
		setClassName(DirectXADataSource.class.getName());
		setDriverProperties(new Properties());
	}
1217111
private void loadCSVFile(TableDefinition tableDef, File file) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF8_CHARSET))
            ) {
            loadCSVFromReader(tableDef, file.getAbsolutePath(), file.length(), reader);
        }
    }
507958
private void addOrUpdateTable(File file) {
        try {
            String insertStmnt = FileUtils.readFileToString(file);
            DataSource ds = processSql(insertStmnt);
            DataSource existingDs = db().getDataSource(ds.getName());
            if (existingDs == null) {//We never saw this table before.
                db().addDataSource(ds);
                return;
            }
            // If startTime/endTime/templatePath changed then we should update the table.
            if (existingDs.getStartTime() != ds.getStartTime() || 
                    existingDs.getEndTime() != ds.getEndTime() ||
                    !existingDs.getTemplatePath().equals(ds.getTemplatePath())) {
                // We have to reuse the existing entity bean(else update will fail).
                existingDs.updateFrom(ds);
                db().updateDataSource(existingDs);
            }                 
        } catch (IOException ex) {
            log.error("Exception while loading druid sql file {} : {}", file, ex);
        }
    }
761607
private void processResources()
   {
      FastTrackTable table = m_data.getTable(FastTrackTableType.RESOURCES);
      for (MapRow row : table)
      {
         int uniqueID = row.getInt(ResourceField.RESOURCE_ID);
         if (uniqueID <= 0)
         {
            continue;
         }

         Resource resource = m_project.addResource();
         resource.setCode(row.getString(ResourceField.CODE));
         resource.setCostPerUse(row.getCurrency(ResourceField.PER_USE_COST));
         resource.setEmailAddress(row.getString(ResourceField.EMAIL_ADDRESS));
         resource.setFlag(1, row.getBoolean(ResourceField.FLAG_1));
         resource.setFlag(2, row.getBoolean(ResourceField.FLAG_2));
         resource.setFlag(3, row.getBoolean(ResourceField.FLAG_3));
         resource.setFlag(4, row.getBoolean(ResourceField.FLAG_4));
         resource.setFlag(5, row.getBoolean(ResourceField.FLAG_5));
         resource.setFlag(6, row.getBoolean(ResourceField.FLAG_6));
         resource.setFlag(7, row.getBoolean(ResourceField.FLAG_7));
         resource.setFlag(8, row.getBoolean(ResourceField.FLAG_8));
         resource.setFlag(9, row.getBoolean(ResourceField.FLAG_9));
         resource.setFlag(10, row.getBoolean(ResourceField.FLAG_10));
         resource.setFlag(11, row.getBoolean(ResourceField.FLAG_11));
         resource.setFlag(12, row.getBoolean(ResourceField.FLAG_12));
         resource.setFlag(13, row.getBoolean(ResourceField.FLAG_13));
         resource.setFlag(14, row.getBoolean(ResourceField.FLAG_14));
         resource.setFlag(15, row.getBoolean(ResourceField.FLAG_15));
         resource.setFlag(16, row.getBoolean(ResourceField.FLAG_16));
         resource.setFlag(17, row.getBoolean(ResourceField.FLAG_17));
         resource.setFlag(18, row.getBoolean(ResourceField.FLAG_18));
         resource.setFlag(19, row.getBoolean(ResourceField.FLAG_19));
         resource.setFlag(20, row.getBoolean(ResourceField.FLAG_20));
         resource.setGroup(row.getString(ResourceField.GROUP));
         resource.setGUID(row.getUUID(ResourceField._RESOURCE_GUID));
         resource.setInitials(row.getString(ResourceField.INITIALS));
         resource.setMaterialLabel(row.getString(ResourceField.MATERIAL_LABEL));
         resource.setName(row.getString(ResourceField.RESOURCE_NAME));
         resource.setNotes(row.getString(ResourceField.RESOURCE_NOTES));
         resource.setNumber(1, row.getDouble(ResourceField.NUMBER_1));
         resource.setNumber(2, row.getDouble(ResourceField.NUMBER_2));
         resource.setNumber(3, row.getDouble(ResourceField.NUMBER_3));
         resource.setNumber(4, row.getDouble(ResourceField.NUMBER_4));
         resource.setNumber(5, row.getDouble(ResourceField.NUMBER_5));
         resource.setNumber(6, row.getDouble(ResourceField.NUMBER_6));
         resource.setNumber(7, row.getDouble(ResourceField.NUMBER_7));
         resource.setNumber(8, row.getDouble(ResourceField.NUMBER_8));
         resource.setNumber(9, row.getDouble(ResourceField.NUMBER_9));
         resource.setNumber(10, row.getDouble(ResourceField.NUMBER_10));
         resource.setNumber(11, row.getDouble(ResourceField.NUMBER_11));
         resource.setNumber(12, row.getDouble(ResourceField.NUMBER_12));
         resource.setNumber(13, row.getDouble(ResourceField.NUMBER_13));
         resource.setNumber(14, row.getDouble(ResourceField.NUMBER_14));
         resource.setNumber(15, row.getDouble(ResourceField.NUMBER_15));
         resource.setNumber(16, row.getDouble(ResourceField.NUMBER_16));
         resource.setNumber(17, row.getDouble(ResourceField.NUMBER_17));
         resource.setNumber(18, row.getDouble(ResourceField.NUMBER_18));
         resource.setNumber(19, row.getDouble(ResourceField.NUMBER_19));
         resource.setNumber(20, row.getDouble(ResourceField.NUMBER_20));
         resource.setText(1, row.getString(ResourceField.TEXT_1));
         resource.setText(2, row.getString(ResourceField.TEXT_2));
         resource.setText(3, row.getString(ResourceField.TEXT_3));
         resource.setText(4, row.getString(ResourceField.TEXT_4));
         resource.setText(5, row.getString(ResourceField.TEXT_5));
         resource.setText(6, row.getString(ResourceField.TEXT_6));
         resource.setText(7, row.getString(ResourceField.TEXT_7));
         resource.setText(8, row.getString(ResourceField.TEXT_8));
         resource.setText(9, row.getString(ResourceField.TEXT_9));
         resource.setText(10, row.getString(ResourceField.TEXT_10));
         resource.setText(11, row.getString(ResourceField.TEXT_11));
         resource.setText(12, row.getString(ResourceField.TEXT_12));
         resource.setText(13, row.getString(ResourceField.TEXT_13));
         resource.setText(14, row.getString(ResourceField.TEXT_14));
         resource.setText(15, row.getString(ResourceField.TEXT_15));
         resource.setText(16, row.getString(ResourceField.TEXT_16));
         resource.setText(17, row.getString(ResourceField.TEXT_17));
         resource.setText(18, row.getString(ResourceField.TEXT_18));
         resource.setText(19, row.getString(ResourceField.TEXT_19));
         resource.setText(20, row.getString(ResourceField.TEXT_20));
         resource.setText(21, row.getString(ResourceField.TEXT_21));
         resource.setText(22, row.getString(ResourceField.TEXT_22));
         resource.setText(23, row.getString(ResourceField.TEXT_23));
         resource.setText(24, row.getString(ResourceField.TEXT_24));
         resource.setText(25, row.getString(ResourceField.TEXT_25));
         resource.setText(26, row.getString(ResourceField.TEXT_26));
         resource.setText(27, row.getString(ResourceField.TEXT_27));
         resource.setText(28, row.getString(ResourceField.TEXT_28));
         resource.setText(29, row.getString(ResourceField.TEXT_29));
         resource.setText(30, row.getString(ResourceField.TEXT_30));
         resource.setUniqueID(Integer.valueOf(uniqueID));
         m_eventManager.fireResourceReadEvent(resource);
      }
   }
310449
def _read_table_file(self, table_file):
        """"""
        self._table_file = table_file
        if os.path.exists(self._table_file):
            self._table = Table.read(self._table_file, hdu='JOB_ARCHIVE')
            self._table_ids = Table.read(self._table_file, hdu='FILE_IDS')
        else:
            self._table, self._table_ids = JobDetails.make_tables({})
        self._table_id_array = self._table_ids['file_id'].data
        self._fill_cache()
1230273
public function setControllerSource($table = null)
    {
        if (is_null($this->controller)) {
            throw $this->exception('Call setControllerData before');
        }
        $this->controller->setSource($this, $table);
    }