Initializes table form a DFA
        Args:
            mma: The input automaton
        Returns:
            None
331579
def _init_table_from_dfa(self, mma):
        
        observation_table_init = ObservationTableInit(self.epsilon, self.alphabet)
        sm_vector, smi_vector, em_vector = observation_table_init.initialize(mma, True)
        self.observation_table.sm_vector = sm_vector
        self.observation_table.smi_vector = smi_vector
        self.observation_table.em_vector = em_vector

        logging.info('Initialized from DFA em_vector table is the following:')
        logging.info(em_vector)

        self._fill_table_entry(self.epsilon, self.epsilon)

        # list(set([])) is used to remove duplicates, [1:0] to remove epsilon
        for row in sorted(list(set(sm_vector + smi_vector)), key=len)[1:]:
            for column in em_vector:
                self._fill_table_entry(str(row), str(column))
954976
def _init_datatable(self):
        
        try:
            self.datatable = Table(self.name, Base.metadata, autoload=True)
        except NoSuchTableError:
            print "Creating datatable, cause it doesn't exist"
            self.datatable = self._datatable_factory()
            self.datatable.create()
        self.datatable_exists = True
993442
void buildStateTable() {
           //
           // Add a dummy state 0 - the stop state.  Not from Aho.
           int      lastInputSymbol = fRB.fSetBuilder.getNumCharCategories() - 1;
           RBBIStateDescriptor failState = new RBBIStateDescriptor(lastInputSymbol);
           fDStates.add(failState);

           // initially, the only unmarked state in Dstates is firstpos(root),
           //       where toot is the root of the syntax tree for (r)#;
           RBBIStateDescriptor initialState = new RBBIStateDescriptor(lastInputSymbol);
           initialState.fPositions.addAll(fRB.fTreeRoots[fRootIx].fFirstPosSet);
           fDStates.add(initialState);

           // while there is an unmarked state T in Dstates do begin
           for (;;) {
               RBBIStateDescriptor T = null;
               int              tx;
               for (tx=1; tx<fDStates.size(); tx++) {
                   RBBIStateDescriptor temp  = fDStates.get(tx);
                   if (temp.fMarked == false) {
                       T = temp;
                       break;
                   }
               }
               if (T == null) {
                   break;
               }

               // mark T;
               T.fMarked = true;

               // for each input symbol a do begin
               int  a;
               for (a = 1; a<=lastInputSymbol; a++) {
                   // let U be the set of positions that are in followpos(p)
                   //    for some position p in T
                   //    such that the symbol at position p is a;
                   Set<RBBINode> U = null;
                   for (RBBINode p : T.fPositions) {
                       if ((p.fType == RBBINode.leafChar) &&  (p.fVal == a)) {
                           if (U == null) {
                               U = new HashSet<RBBINode>();
                           }
                           U.addAll(p.fFollowPos);
                       }
                   }

                   // if U is not empty and not in DStates then
                   int  ux = 0;
                   boolean    UinDstates = false;
                   if (U != null) {
                       Assert.assrt(U.size() > 0);
                       int  ix;
                       for (ix=0; ix<fDStates.size(); ix++) {
                           RBBIStateDescriptor temp2;
                           temp2 = fDStates.get(ix);
                           if (U.equals(temp2.fPositions)) {
                               U  = temp2.fPositions;
                               ux = ix;
                               UinDstates = true;
                               break;
                           }
                       }

                       // Add U as an unmarked state to Dstates
                       if (!UinDstates)
                       {
                           RBBIStateDescriptor newState = new RBBIStateDescriptor(lastInputSymbol);
                           newState.fPositions = U;
                           fDStates.add(newState);
                           ux = fDStates.size()-1;
                       }

                       // Dtran[T, a] := U;
                       T.fDtran[a] = ux;
                   }
               }
           }
       }
844565
protected static <O> void initializeMatrices(MatrixParadigm mat, ArrayModifiableDBIDs prots, DistanceQuery<O> dq) {
    final DBIDArrayIter ix = mat.ix, iy = mat.iy;
    final double[] distances = mat.matrix;
    int pos = 0;
    for(ix.seek(0); ix.valid(); ix.advance()) {
      for(iy.seek(0); iy.getOffset() < ix.getOffset(); iy.advance()) {
        distances[pos] = dq.distance(ix, iy);
        prots.add(iy);
        pos++;
      }
    }
    assert (prots.size() == pos);
  }
1256536
def main():
    """"""
    if len(argv) < 2:
        targetfile = 'target.y'
    else:
        targetfile = argv[1]
    print 'Parsing ruleset: ' + targetfile,
    flex_a = Flexparser()
    mma = flex_a.yyparse(targetfile)
    print 'OK'
    print 'Perform minimization on initial automaton:',
    mma.minimize()
    print 'OK'
    print 'Perform StateRemoval on minimal automaton:',
    state_removal = StateRemoval(mma)
    mma_regex = state_removal.get_regex()
    print mma_regex
859111
private static function init() {
        self::$huffmanLookup = self::huffmanLookupInit();
        self::$huffmanCodes = self::huffmanCodesInit();
        self::$huffmanLengths = self::huffmanLengthsInit();

        foreach (\array_column(self::TABLE, 0) as $index => $name) {
            if (isset(self::$indexMap[$name])) {
                continue;
            }

            self::$indexMap[$name] = $index + 1;
        }
    }
355593
private MsgFormat init()
        throws EFapsException
    {
        if (!this.initialized) {
            for (final Class<?> clazz : new EsjpScanner().scan(EFapsFormatFactory.class)) {
                try {
                    final FormatFactory factory = (FormatFactory) clazz.newInstance();
                    final EFapsFormatFactory ano = clazz.getAnnotation(EFapsFormatFactory.class);
                    this.registry.put(ano.name(), factory);
                } catch (final InstantiationException | IllegalAccessException e) {
                    MsgFormat.LOG.error("Catched error on instantiotion", e);
                }
            }
            MsgFormat.LOG.info("registered FormatFactories: {}", this.registry);
            this.initialized = true;
        }
        return this;
    }
104572
public void init(BaseDatabase database, Record record)
    {
        super.init(database, record);
        if (((QueryRecord)record).getBaseRecord() != null)
            m_tableNext = ((QueryRecord)record).getBaseRecord().getTable();   // Pass most commands thru to the main record's table
    }
1119833
def main():
    
    argv = sys.argv
    if len(argv) < 2:
        targetfile = 'target.y'
    else:
        targetfile = argv[1]
    print 'Parsing ruleset: ' + targetfile,
    flex_a = Flexparser()
    mma = flex_a.yyparse(targetfile)
    print 'OK'
    print 'Perform minimization on initial automaton:',
    mma.minimize()
    print 'OK'
    print 'Perform Brzozowski on minimal automaton:',
    brzozowski_a = Brzozowski(mma)
    mma_regex = brzozowski_a.get_regex()
    print mma_regex
811084
def initialize_constraint_table(cfg_list):
    """"""
    for cfg in cfg_list:
        constraint_table.update(dict.fromkeys(cfg.nodes, 0))
569826
public static void init() throws JMFSchemaIdException {
    // Register the MFP diagnostic module
    MfpDiagnostics.initialize();


    try {
      JMFRegistry.instance.register(JsHdrAccess.schema);
      JMFRegistry.instance.register(JsHdr2Access.schema);
      JMFRegistry.instance.register(JsApiAccess.schema);
      JMFRegistry.instance.register(JsPayloadAccess.schema);
      JMFRegistry.instance.register(JmsBytesBodyAccess.schema);
      JMFRegistry.instance.register(JmsTextBodyAccess.schema);
      JMFRegistry.instance.register(JmsObjectBodyAccess.schema);
      JMFRegistry.instance.register(JmsStreamBodyAccess.schema);
      JMFRegistry.instance.register(JmsMapBodyAccess.schema);
      JMFRegistry.instance.register(TrmAccess.schema);
      JMFRegistry.instance.register(SubscriptionAccess.schema);
      JMFRegistry.instance.register(ControlAccess.schema);
      JMFRegistry.instance.register(TrmFirstContactAccess.schema);

      
    } catch (JMFSchemaIdException e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.SchemaManager.<clinit>", "188");
      throw e;
    }
  }
919675
public static FA create(FA nfa) {
        if (nfa.getStart() == -1) {
            throw new IllegalArgumentException();
        }

        FA dfa;                // result
        int dfaIdx, nextDfaIdx, nfaIdx;
        int transition, max;
        State dfaState;       // current state
        State nfaState;
        IntBitSet closure;       // all nfa state represented by current state
        IntBitSet nextClosure;
        IntBitSet[] epsilonClosures;

        Object tmp;
        int i, rangeCount;
        List<Range> ranges;
        Range small, large;

        epsilonClosures = nfa.epsilonClosures();
        closure = new IntBitSet();
        closure.add(nfa.getStart());
        closure.addAllSets(epsilonClosures);
        dfa = new FA();
        dfa.setStart(dfa.add(closure));

        // dfa grows during the loop
        for (dfaIdx = 0; dfaIdx < dfa.size(); dfaIdx++) {

            // state under construction
            dfaState = dfa.get(dfaIdx);

            closure = (IntBitSet) dfaState.getLabel();

            // collect all possible transitions;
            // mark end states
            ranges = new ArrayList<Range>();
            for (nfaIdx = closure.first(); nfaIdx != -1;
                 nfaIdx = closure.next(nfaIdx)) {

                if (nfa.isEnd(nfaIdx)) {
                    dfa.setEnd(dfaIdx);
                }

                nfaState = nfa.get(nfaIdx);
                max = nfaState.size();
                for (transition = 0; transition < max; transition++) {
                    tmp = nfaState.getInput(transition);
                    if (tmp != null) {
                        ranges.add((Range) tmp);
                    }
                }
            }

            Range.normalizeRanges(ranges);

            rangeCount = ranges.size();
            for (i = 0; i < rangeCount; i++) {
                small = (Range) ranges.get(i);
                nextClosure = new IntBitSet();
                for (nfaIdx = closure.first(); nfaIdx != -1;
                     nfaIdx = closure.next(nfaIdx)) {

                    nfaState = nfa.get(nfaIdx);
                    max = nfaState.size();
                    for (transition = 0; transition < max; transition++) {
                        large = (Range) nfaState.getInput(transition);
                        if ((large != null) && large.contains(small)) {
                            nextClosure.add(nfaState.getEnd(transition));
                        }
                    }
                }
                nextClosure.addAllSets(epsilonClosures);
                nextDfaIdx = dfa.find(nextClosure);
                if (nextDfaIdx == -1) {
                    nextDfaIdx = dfa.add(nextClosure);
                }

                dfaState.add(nextDfaIdx, small);
            }
        }

        Label.combineLabels(dfa, nfa);

        return dfa;
    }
617120
def _initialize(self, con):
        """"""
        if self.initialized:
            return

        SQLite3Database()._initialize(con)  # ASE db initialization

        cur = con.execute(
            'SELECT COUNT(*) FROM sqlite_master WHERE name="reaction"')

        if cur.fetchone()[0] == 0:  # no reaction table
            for init_command in init_commands:
                con.execute(init_command)  # Create tables
            con.commit()

        self.initialized = True
829633
def fmap(proc=nil, &block)
      result = (proc || block).call(value)
      self.class.new(result)
    end
1316171
protected void initialize(DDFManager manager, Object data, Class<?>[] typeSpecs, String name, Schema schema)
      throws DDFException {
    this.validateSchema(schema);
    this.setManager(manager); // this must be done first in case later stuff needs a manager

    if (typeSpecs != null) {
      this.getRepresentationHandler().set(data, typeSpecs);
    }

    this.getSchemaHandler().setSchema(schema);
    if(schema!= null && schema.getTableName() == null) {
      String tableName = this.getSchemaHandler().newTableName();
      schema.setTableName(tableName);
    }

    manager.setDDFUUID(this, UUID.randomUUID());

    if(!Strings.isNullOrEmpty(name)) manager.setDDFName(this, name);

    // Facades
    this.ML = new MLFacade(this, this.getMLSupporter());
    this.VIEWS = new ViewsFacade(this, this.getViewHandler());
    this.Transform = new TransformFacade(this, this.getTransformationHandler());
    this.R = new RFacade(this, this.getAggregationHandler());
  }
670870
function(ident, defFunc) {

	/**
	 * Here's the actual class we're making.
	 */
	var model = function(params) {
		var me = this;

		if (Object.keys(model.columns).length == 0) {
			logger.error("Attempting to initialize `" + model.ident + "` instance before filling schema!");
			return null;
		} else if (model.primary === undefined) {
			logger.error("No primary key found for `" + model.ident + "`!");
			return null;
		}

		Object.defineProperty(me, 'values', {
			value: {},
			enumerable: false,
			writable: true,
			configurable: true,
		}); // Raw column values, accessed by setter/getter functions.

		params = params || {};

		/* --- Instance Methods --- */

		/**
		 * Saves the object's properties corresponding to table columns into the database.
		 */
		function save() {
			var act = new NobleMachine(function() {
				setStrs = [];

				for (var key in model.columns) {
					if ([model.primary].indexOf(key) == -1 && me[key] !== undefined) {
						setStrs.push('`' + key + '`' + " = " + nrutil.serialize(me[key]));
					}
				}

				if (model.columns['updatedAt'])
					setStrs.push('`updatedAt` = NOW()');

				var sql;
				if (me[model.primary]) {
					sql = "UPDATE " + model.table
							+ " SET " + setStrs.join(',')
							+ " WHERE `" + model.primary + "` = " + me[model.primary];
				} else {
					if (model.columns['createdAt'])
						setStrs.push('`createdAt` = NOW()');

					sql = "INSERT"
							+ " INTO " + model.table
							+ " SET " + setStrs.join(',');
				}


				act.toNext(db_query(sql));
			});

			act.next(function(result) {
				//log.debug("RESULT: " + JSON.stringify(result));

				if (result.insert_id) {
					me[model.primary] = result.insert_id;
				} else if (!me[model.primary]) {
					act.toError("No insert_id, and no extant primary key!");
					return;
				}

				
				logger.log("Successfully saved `" + model.ident + "` record `" + me[model.primary] + "`");

				act.toNext(me);
			});

			act.error(function(err) {
				logger.error("Error saving `" + model.ident + "` record: " + JSON.stringify(err));
				act.emitError(err);
			});

			return act;
		}

		/**
		 * Reloads the object's properties with the current database values.
		 */
		function reload() {
			var params = {}

			params[model.primary] = me[model.primary]
		
			var act = new NobleMachine(model.find(params));

			act.next(function(newInst) {
				if (newInst) {
					for (var col in model.columns) {
						me[col] = newInst[col];
					}

					act.toNext(me);
				} else {
					for (var key in model.columns) {
						me[key] = undefined
					}

					act.toNext(null);
				}
			});

			return act;
		}

		/**
		 * Removes this object's corresponding database row.
		 */
		function destroy() {
			var act = new NobleMachine(function() {
				if (me.onDestroy) {
					var preact = me.onDestroy();
					if (preact && preact.start instanceof Function) {
						act.toNext(preact)
						return;
					}
				}
			});

			act.next(function() {
				var sql = "DELETE FROM " + model.table
						+ " WHERE `" + model.primary + "` = " + me[model.primary];

				act.toNext(db_query(sql));
			});

			act.next(function() {
				logger.log("Successfully deleted `" + model.ident + "` record `" + me[model.primary] + "`");

				for (var param in me) {
					delete me[param];	
				}
			});

			act.error(function(err) {
				logger.error("Error deleting `" + model.ident + "` record: " + JSON.stringify(err));
				act.emitError(err);
			});

			return act;
		}

		// Generic setter for SQL-correspondent values. Forces typecasting for database compatibility.
		function setValue(key, val) {
			//util.log(key + ": " + JSON.stringify(val));

			if (val === null) {
				me.values[key] = null;
			} else if (val === undefined) {
				me.values[key] = undefined;
			} else {
				type = model.columns[key]['DATA_TYPE'];

				switch (type) {
					case 'datetime':
					case 'timestamp':
						me.values[key] = new Date(val);
						break;
					case 'text':
					case 'varchar':
						me.values[key] = val.toString();
						break;
					case 'int':
					case 'tinyint':
						if (model.columns[key]['COLUMN_TYPE'] == 'tinyint(1)') {
							me.values[key] = !!val // Boolean
						} else {
							me.values[key] = parseInt(val);
						}
						break;
					default:
						me.values[key] = val;
				}
			}
		}

		// Generic getter for SQL-correspondent values.
		function getValue(key) {
			return me.values[key];
		}

		for (var key in model.columns) {
			me.__defineSetter__(key, setValue.bind(me, key));
			me.__defineGetter__(key, getValue.bind(me, key));

			if (params[key] !== undefined) {
				setValue(key, params[key]);
			}
		}

		_.extend(me, {
			save: save,
			reload: reload,
			destroy: destroy,
			setValue: setValue
		});

		if (defFunc !== undefined) {
			defFunc(me);
		}

		return me;
	}

	// This should be a unique, proper-cased identifier for the model as a whole.
	model.ident = ident;

	// Will be filled with INFORMATION_SCHEMA data.
	model.columns = {};

	// Guess the table name based on clever pluralization of the identifier.
	model.table = 'tbl' + ident.pluralize();

	/* --- Definition Methods --- */

	// Use this to override the default guess based on ident pluralization.
	model.setTableName = function(name) {
		model.table = name;
	}

	model.hasOne = function(foreignIdent) {
		model.prototype["get" + foreignIdent] = function() {
			var foreign = Models[foreignIdent];

			var opts = {}
			opts[model.primary] = this[model.primary];
			return foreign.find(opts);
		}
	}

	model.belongsTo = function(foreignIdent) {
		model.prototype["get" + foreignIdent] = function() {
			var foreign = Models[foreignIdent];

			var opts = {}
			opts[foreign.primary] = this[foreign.primary];
			return foreign.find(opts);
		}
	}

	/* --- Retrieval Methods --- */

	/**
	 * Executes a SELECT query on the table associated with this class and returns
	 * the result.
	 * @param where Qualifier to be passed to WHERE e.g "`this` = 'that'""
	 * @param fields Fields to return. Defaults to '*'.
	 */
	model.select = function(where, fields) {
		fields = fields || '*';

		var act = new NobleMachine(function() {
			var sql = "SELECT " + fields + " FROM " + model.table +
					  (where.length ? " WHERE " : '') + where + ";"

			act.toNext(db_query(sql));
		});

		act.next(function(result) {
			if (result.affected_rows == -1)
				act.toNext([]);
			else
				act.toNext(result.map(function(sqlobj) {
					return new model(sqlobj);
				}));
		});

		act.error(function(err) {
			logger.error("Error executing select statement for `" + model.ident +"`: " + JSON.stringify(err));
			act.emitError(err);
		});

		return act;
	}

	/**
     * A very simple SELECT query wrapper that returns a list of model instances.
	 * @param params Key-value pairs to be matched.
	 * @param conjunction Default 'AND'.
	 * @param fields Fields to return. Default in select().
     */
	model.where = function(params, conjunction, fields) {
		conjunction = conjunction || 'AND'
		var where = '';
		var first = true;

		logger.log("Finding all `" + model.ident + "`" + (params === undefined ? '' : " matching: " + util.inspect(params) + " with conjunction '" + conjunction + "'"));

		if (params) {
			for (var key in model.columns) {
				if (params[key] !== undefined) {
					where += (first ? '' : " " + conjunction + " ")
					if (params[key] == null) {
						where += "`" + key + "` IS NULL";
					} else {
						where += "`" + key + "` = " + nrutil.serialize(params[key]);
					}

					first = false;
				}
			}
		}

		return model.select(where, fields);
	}

	/**
	 * Emits first result from where() query
	 * @param params Params for find().
	 */
	model.find = function(params) {
		var act = new NobleMachine(function() {
			act.toNext(model.where(params));
		});

		act.next(function(objs) {
			act.toNext(objs.length ? objs[0] : null);
		});

		return act;
	}

	/**
	 * Retrieves every record of this type!
	 */
	model.all = function() {
		return model.where({});
	}

	/* --- Initialization Methods --- */

	/**
	 * This action queries the database to determine the structure of the table we are bound to.
	 */
	model.fillSchema = function() {
		var act = new NobleMachine(function() {
			var sql = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS"
					+ " WHERE TABLE_SCHEMA = '" + common.config.database.options.database + "'"
					+ " AND TABLE_NAME = '" + model.table + "';";

			act.toNext(db_query(sql));
		});

		act.next(function(res) {
			if (res.length == 0) {
				act.toError("No columns found for table `" + model.table + "`.");
				return;
			}

			res.forEach(function(col) {
				model.columns[col['COLUMN_NAME']] = col;

				if (col['COLUMN_KEY'] == 'PRI') { // Primary key!
					model.primary = col['COLUMN_NAME'];
				}
			});

			if (!model.primary) {
				act.toError("Could not detect primary key for table `" + model.table + "`.");
				return;
			}
		});

		return act;
	}

	Models[model.ident] = model;

	return model;
}
812704
public void init(String tableName, ResultSet columnMetaRs) throws SQLException {
		this.tableName = tableName;

		this.name = columnMetaRs.getString("COLUMN_NAME");
		this.type = columnMetaRs.getInt("DATA_TYPE");
		this.size = columnMetaRs.getInt("COLUMN_SIZE");
		this.isNullable = columnMetaRs.getBoolean("NULLABLE");
		this.comment = columnMetaRs.getString("REMARKS");
	}