Ejemplo n.º 1
0
void RichQtfParser::FinishTable()
{
	FinishCell();
	while(table.Top().cell % Table().GetColumns())
		FinishCell();
	tablepart = pick(Table());
	istable = true;
	table.Drop();
}
Ejemplo n.º 2
0
int eval_Table(long M, long N, int i, int j){
	if ( _flag_Table(i,j) == 'N' ) {
		_flag_Table(i,j) = 'I';
	//Body for Table
		Table(i,j) = (((j == 0 && i == 0))?__max_int(0,__max_int((c)+(similarity_function(seq_A(i),seq_B(j))),__max_int((A(i))+(eval_gap_penalty(M,N)),(B(j))+(eval_gap_penalty(M,N))))):(((i == 0 && j >= 1))?__max_int(0,__max_int((B(j-1))+(similarity_function(seq_A(i),seq_B(j))),__max_int((eval_Table(M,N,i,j-1))+(eval_gap_penalty(M,N)),(B(j))+(eval_gap_penalty(M,N))))):(((j == 0 && i >= 1))?__max_int(0,__max_int((A(i-1))+(similarity_function(seq_A(i),seq_B(j))),__max_int((A(i))+(eval_gap_penalty(M,N)),(eval_Table(M,N,i-1,j))+(eval_gap_penalty(M,N))))):(__max_int(0,__max_int((eval_Table(M,N,i-1,j-1))+(similarity_function(seq_A(i),seq_B(j))),__max_int((eval_Table(M,N,i,j-1))+(eval_gap_penalty(M,N)),(eval_Table(M,N,i-1,j))+(eval_gap_penalty(M,N)))))))));
		_flag_Table(i,j) = 'F';
	} else if ( _flag_Table(i,j) == 'I' ) {
		printf("There is a self dependence on Table at (%d,%d) \n",i,j);
		exit(-1);
	}
	return Table(i,j);
}
//everything in t1 that is not in t2
Table Database::set_difference(Table t1, Table t2){
	if(!union_compatible(t1,t2)){
		throw runtime_error("Error: Sets are incompatible\n");
		return Table("NULL");
	}
	Table diff = Table(t1.get_name());
	for (int i = 0; i < t1.get_records().size(); ++i)
	{
		if(!record_exists(t2,t1.get_records()[i]))
			diff.add_record(t1.get_records()[i]);
	}
	diff.set_attributes(t1.get_attributes());
	return diff;
}
Ejemplo n.º 4
0
/*
 * HndResetAgeMap
 *
 * Service to forceably reset the age map for a set of handles.
 *
 * Provided for GC-time resetting the handle table's write barrier.  This is not
 * normally advisable, as it increases the amount of work that will be done in
 * subsequent scans.  Under some circumstances, however, this is precisely what is
 * desired.  Generally this entrypoint should only be used under some exceptional
 * condition during garbage collection, like objects being demoted from a higher
 * generation to a lower one.
 *
 */
void HndResetAgeMap(HHANDLETABLE hTable, const UINT *types, UINT typeCount, UINT flags)
{
    // fetch the table pointer
    HandleTable *pTable = Table(hTable);

    // set up parameters for scan callbacks
    ScanCallbackInfo info;

    info.uFlags          = flags;
    info.fEnumUserData   = FALSE;
    info.dwAgeMask       = 0;
    info.pCurrentSegment = NULL;
    info.pfnScan         = NULL;
    info.param1          = 0;
    info.param2          = 0;

    // lock the table down
    pTable->pLock->Enter();

    // perform the scan
    TableScanHandles(pTable, types, typeCount, QuickSegmentIterator, BlockResetAgeMapForBlocks, &info);

    // unlock the table
    pTable->pLock->Leave();
}
Ejemplo n.º 5
0
/*
 * HndDestroyHandles
 *
 * Entrypoint for freeing handles in bulk.
 *
 */
void HndDestroyHandles(HHANDLETABLE hTable, UINT uType, const OBJECTHANDLE *pHandles, UINT uCount)
{
    // fetch the handle table pointer
    HandleTable *pTable = Table(hTable);

    // sanity check the type index
    _ASSERTE(uType < pTable->uTypeCount);

    // is this a small number of handles?
    if (uCount <= SMALL_ALLOC_COUNT)
    {
        // yes - free them via the handle cache
        TableFreeHandlesToCache(pTable, uType, pHandles, uCount);
        return;
    }

    // acquire the handle manager lock
    pTable->pLock->Enter();

    // free the unsorted handles in bulk to the main handle table
    TableFreeBulkUnpreparedHandles(pTable, uType, pHandles, uCount);

    // update perf-counters: track number of handles
    COUNTER_ONLY(GetGlobalPerfCounters().m_GC.cHandles -= uCount);
    COUNTER_ONLY(GetPrivatePerfCounters().m_GC.cHandles -= uCount);

    // release the handle manager lock
    pTable->pLock->Leave();
}
Ejemplo n.º 6
0
/*
 * HndGetHandleTableIndex
 *
 * Retrieves the AppDomain index associated with a handle table at creation
 */
UINT HndGetHandleTableADIndex(HHANDLETABLE hTable)
{
    // fetch the handle table pointer
    HandleTable *pTable = Table(hTable);

    return pTable->uADIndex;
}
Ejemplo n.º 7
0
/*
 * HndGetHandleTableIndex
 *
 * Sets the index associated with a handle table at creation
 */
void HndSetHandleTableIndex(HHANDLETABLE hTable, UINT uTableIndex)
{
    // fetch the handle table pointer
    HandleTable *pTable = Table(hTable);

    pTable->uTableIndex = uTableIndex;
}
Ejemplo n.º 8
0
/*
 * HndDestroyHandleTable
 *
 * Cleans up and frees the specified handle table.
 *
 */
void HndDestroyHandleTable(HHANDLETABLE hTable)
{
    // fetch the handle table pointer
    HandleTable *pTable = Table(hTable);

    // We are going to free the memory for this HandleTable.
    // Let us reset the copy in g_pHandleTableArray to NULL.
    // Otherwise, GC will think this HandleTable is still available.
    Ref_RemoveHandleTable (hTable);
    
    // null out the lock pointer and release and free the lock
    delete pTable->pLock;
    pTable->pLock = NULL;

    // fetch the segment list and null out the list pointer
    TableSegment *pSegment = pTable->pSegmentList;
    pTable->pSegmentList = NULL;

    // walk the segment list, freeing the segments as we go
    while (pSegment)
    {
        // fetch the next segment
        TableSegment *pNextSegment = pSegment->pNextSegment;

        // free the current one and advance to the next
        SegmentFree(pSegment);
        pSegment = pNextSegment;
    }

    // free the table's memory
    HeapFree(g_hProcessHeap, 0, (HLOCAL)pTable);
}
Ejemplo n.º 9
0
PyObject *lua_table(PyObject *self, PyObject *args) {
    char *filename, *res, *table, *key;
    if(!PyArg_ParseTuple(args, "sss", &filename, &table, &key)) return NULL;
    res = Table(filename, table, key);
    if(!res) res = "nil";
    return Py_BuildValue("s", res);
}
void backgroundEstimation::ImportMTTailCorrectionFromTemplateFitMethod()
{
    Table SFR_table = Table("../MTtailCorrection/results/SF_MTtail.tab");
    //Table SFR_table = Table("../MTtailCorrection/signalContamination/"+string(SIGNAL_CONTAMINATION_INPUT)+"/SF_MTtail.tab");

    // Remove low/medium/highDM suffix in label for BDT's
    string signalRegionLabel_ = signalRegionLabel;
    if (findSubstring(signalRegionLabel_,"BDT"))
    {
        size_t pos;
        pos = signalRegionLabel_.find("_low");
        if (pos != string::npos) signalRegionLabel_ = signalRegionLabel_.substr(0,pos);
        pos = signalRegionLabel_.find("_med");
        if (pos != string::npos) signalRegionLabel_ = signalRegionLabel_.substr(0,pos);
        pos = signalRegionLabel_.find("_high");
        if (pos != string::npos) signalRegionLabel_ = signalRegionLabel_.substr(0,pos);
    }

    SF_MTtail_Wjets = SFR_table.Get("SFR_Wjets",signalRegionLabel_);
    SF_MTtail_1ltop = SFR_table.Get("SFR_1ltop",signalRegionLabel_);

    // Fix for signal contamination crazy values : we assume that SFR_1ltop is >= 1.
    // We keep the same relative uncertainty
    if (SF_MTtail_1ltop.value() < 1) { SF_MTtail_1ltop = Figure(1.0,SF_MTtail_1ltop.value() / SF_MTtail_1ltop.error()); }

    if (SF_MTtail_Wjets_variation) SF_MTtail_Wjets.keepVariation(SF_MTtail_Wjets_variation,"noNegativeValue");
    if (SF_MTtail_1ltop_variation) SF_MTtail_1ltop.keepVariation(SF_MTtail_1ltop_variation,"noNegativeValue");
}
Ejemplo n.º 11
0
///
/// Property: entityName 
///	Used for xmlGeneration
///
/// getter
QString RecordBase::EntityName() 
{
	if (_entityName.size() == 0) 
		_entityName = Table() + "RecordBase";
	
	return _entityName;
}
int main()
{
	int k;
	input(&k);
	int n = 1;
	//n=2k(k>=1)个选手参加比赛  
	for (int i = 1; i <= k; i++)
		n *= 2;
	//根据n动态分配二维数组a  
	int **a = (int**)malloc((n + 1)*sizeof(int*));
	for (int i = 0; i <= n; i++)
	{
		a[i] = (int*)malloc((n + 1)*sizeof(int));
	}
	Table(k, n, a);
	printf("循环赛事日程表为:\n");
	output(a, n);
	//释放空间  
	for (int i = 0; i <= n; i++)
	{
		free(a[i]);
	}
	free(a);
	return 0;
}
Ejemplo n.º 13
0
void RichQtfParser::FinishCell()
{
	EndPart();
	RichTable& t = Table();
	Tab& b = table.Top();
	int i, j;
	if(oldtab) {
		i = b.rown.GetCount() - 1;
		j = b.rown.Top();
		b.rown.Top()++;
	}
	else {
		i = b.cell / t.GetColumns();
		j = b.cell % t.GetColumns();
	}
	t.SetPick(i, j, pick(b.text));
	b.text.Clear();
	t.SetFormat(i, j, b.format);
	t.SetSpan(i, j, b.vspan, b.hspan);
	if(oldtab && b.rown.GetCount() > 1 && j + 1 < b.rown[0])
		b.format = t.GetFormat(0, j + 1);
	else {
		b.cell++;
		b.vspan = 0;
		b.hspan = oldtab;
	}
	b.format.keep = false;
	b.format.round = false;
}
Ejemplo n.º 14
0
Table Database::getTable(const std::string &tableName) throw (DbException)
{
	uint32_t dbFlags = DB_CREATE | DB_AUTO_COMMIT;
	Db *db = new Db(&m_env, 0);
	db->open(NULL, tableName.c_str(), NULL, DB_BTREE, dbFlags, 0);
	return Table(db);
}
Ejemplo n.º 15
0
void Parser::parse_rating_final(Database& d)
{
	vector<pair<string, Attribute>> TableDef;
	pair<string, Attribute> p;

	p.first = "userID";
	p.second.setType("String");
	TableDef.push_back(p);

	p.first = "placeID";
	p.second.setType("String");
	TableDef.push_back(p);

	p.first = "rating";
	p.second.setType("Int");
	TableDef.push_back(p);

	p.first = "food_rating";
	p.second.setType("Int");
	TableDef.push_back(p);

	p.first = "service_rating";
	p.second.setType("Int");
	TableDef.push_back(p);

	Table t = Table(TableDef);
	Table result = ReadFile("RCdata\\CorrectFormat\\rating_final.txt",t);
	d.addTable(result,"ratings");
}
Ejemplo n.º 16
0
/* Function main */
void  main()
{
	int i, number, index;
	int mat [size][size];
	struct Vertex vert [size];
	struct Edge *List;
	printf("\n Input the number of vertices in the graph: ");
	scanf("%d", &number);
	Input(number, mat);
	Output(number, mat);
	Table(number, mat, vert);
	printf("\n Input the starting vertex 0- %d :",number-1);
	scanf("%d", &index);
	BFS (index, vert);
	printf("\n Path length of the vertex from %c", vert[index].info)
	    ;             
	printf("\n Vertex Length Vertex Connectivity \n ");
	for (i = 0; i < number; i++)
	{
		printf("\n   %c    %d   ",vert[i].info, vert[i].path_length);
		for (List= vert[i].Edge_Ptr; List; List = List->next)
		{
			printf(" ");
			putchar(List->terminal+'A');
		}
	}
}
Ejemplo n.º 17
0
int Catalog::add_rec(const char* table_name, const id_list_t * attrlist)
{
	int count=0;
	const char * ptr=table_name;
	while(*ptr){
		ptr++;
		count++;
	}
	if(count>3){
		std::cout <<"Table name longer than 3!\n";
		return 0;
	}
	if(tables.find(table_name) != tables.end())
	{
		std::cout << "Table with the same name already existed!\n";
		return 0;
	}
	//else
	if(numOfTables < MAX_TABLES)
	{
		
		tables[table_name] = Table(table_name, attrlist);
		numOfTables++;
		return 1;
	}
	return 0;
}
Ejemplo n.º 18
0
std::string Channel::BasicConsume(const std::string &queue,
                                  const std::string &consumer_tag,
                                  bool no_local, bool no_ack, bool exclusive,
                                  boost::uint16_t message_prefetch_count) {
  return BasicConsume(queue, consumer_tag, no_local, no_ack, exclusive,
                      message_prefetch_count, Table());
}
int main(){
	long n;
	Table();
	while(scanf("%ld", &n)==1){
		printf("%ld\n", N[n]);
	}
	return 0;
}
Ejemplo n.º 20
0
/*
 * HndGetHandleTableIndex
 *
 * Retrieves the index associated with a handle table at creation
 */
UINT HndGetHandleTableIndex(HHANDLETABLE hTable)
{
    // fetch the handle table pointer
    HandleTable *pTable = Table(hTable);

    _ASSERTE (pTable->uTableIndex != (UINT) -1);  // We have not set uTableIndex yet.
    return pTable->uTableIndex;
}
Ejemplo n.º 21
0
std::string Channel::DeclareQueue(const std::string &queue_name,
                                  bool passive,
                                  bool durable,
                                  bool exclusive,
                                  bool auto_delete)
{
    return DeclareQueue(queue_name, passive, durable, exclusive, auto_delete, Table());
}
Ejemplo n.º 22
0
void Channel::DeclareExchange(const std::string &exchange_name,
                              const std::string &exchange_type,
                              bool passive,
                              bool durable,
                              bool auto_delete)
{
    DeclareExchange(exchange_name, exchange_type, passive, durable, auto_delete, Table());
}
// setValues
// Description: Initializes the default values and then attempts
// to read the restaurant.confg file.
void Restaurant::setValues(void){

	// Initialize values
	timeRun = 0;
	line = list<PatronGroup>();
	tables = vector<Table>();
	totalPatronGroups = 0;
	averageTotalTime = 0;
	averageWaitTime = 0;
	averageInLine = 0;

	// Set defaults
	name = "Restaurant";
	type = "DINER";

	totalTables = 20;
	tableSize = 4;

	waiterSkill = "SEASONED";

	startCapacity = "SLOW";

	patronGroupArriveInterval = 30;
	patronGroupMinArrive = 0;
	patronGroupMaxArrive = 3;
	patronGroupMinSize = 1;
	patronGroupMaxSize = tableSize;

	updateInterval = 15;

	totalTimeToRun = 600;

	readConfig(); // Attempt to read config and overwrite defaults

	Waiter::setSkillLevel(waiterSkill); // Set waiter skill level

	// Create tables at correct quantity and size
	tables.resize(totalTables);
	for(int i = 0; i < totalTables; i++){
		tables[i] = Table(tableSize);
	}

	// Setup PatronFactory
	PatronFactory::setDefaultMinMax(patronGroupMinSize, patronGroupMaxSize);
	PatronFactory::setRestaurantType(type);

	// Write header to logfile
	string filePath = "log" + TimeStamp::get() + ".csv";
	ofstream output;

	output.open(filePath, ofstream::app);
	output << "ID;Number Patrons;Total Time;Wait Time;Dining Time;Target Dining Time; Waiter Time;\n";
	output.close();

	setupRestaurant(startCapacity);
	seatLine();
} // End setValues
Ejemplo n.º 24
0
 template <class Enum, class Table> Table  load_safe(Enum type)
 {
     Table tmp;
     if (!load<Enum, Table>(type, tmp))
     {
         return std::move(Table());
     }
     return std::move(tmp);
 }
Ejemplo n.º 25
0
 // **************************************************************
 void Print_Table(const Double factor_x = 1.0, const Double factor_y = 1.0)
 {
     for (int i = 0 ; i < n ; i++)
     {
         //std_cout.Format(20,10,'g'); std_cout << Get_x_from_i(i)*factor_x << "  "; std_cout.Format(20,10,'g'); std_cout << Table(i)*factor_y << "\n";
         //fprintf(stderr, "%20.10g   %20.10g\n", Get_x_from_i(i)*factor_x, Table(i)*factor_y*Get_x_from_i(i));
         fprintf(stderr, "%20.10g   %20.10g\n", Get_x_from_i(i)*factor_x, Table(i)*factor_y);
     }
 }
Table Database::get_table(string table_name){
	if(table_exists(table_name)){
		return	*find_table(table_name);
	}
	else{
		cout<<"Error: Table not found: "+table_name+"\n";
		return Table("NULL");
	}
}
Ejemplo n.º 27
0
std::string Channel::DeclareQueueWithCounts(const std::string &queue_name,
                                            boost::uint32_t &message_count,
                                            boost::uint32_t &consumer_count,
                                            bool passive, bool durable,
                                            bool exclusive, bool auto_delete) {
  return DeclareQueueWithCounts(queue_name, message_count, consumer_count,
                                passive, durable, exclusive, auto_delete,
                                Table());
}
Ejemplo n.º 28
0
void RichQtfParser::FinishOldTable()
{
	FinishCell();
	Index<int>  pos;
	Vector<int> srow;
	RichTable& t = Table();
	Tab& b = table.Top();
	for(int i = 0; i < t.GetRows(); i++) {
		int& s = srow.Add();
		s = 0;
		int nx = b.rown[i];
		for(int j = 0; j < nx; j++)
			s += t.GetSpan(i, j).cx;
		int xn = 0;
		for(int j = 0; j < nx; j++) {
			pos.FindAdd(xn * 10000 / s);
			xn += t.GetSpan(i, j).cx;
		}
	}
	Vector<int> h = pos.PickKeys();
	if(h.GetCount() == 0)
		Error("table");
	Sort(h);
	pos = pick(h);
	pos.Add(10000);
	RichTable tab;
	tab.SetFormat(t.GetFormat());
	for(int i = 0; i < pos.GetCount() - 1; i++) {
		tab.AddColumn(pos[i + 1] - pos[i]);
	}
	for(int i = 0; i < t.GetRows(); i++) {
		int s = srow[i];
		int nx = b.rown[i];
		int xn = 0;
		int xi = 0;
		for(int j = 0; j < nx; j++) {
			Size span = t.GetSpan(i, j);
			xn += span.cx;
			int nxi = pos.Find(xn * 10000 / s);
			tab.SetPick(i, xi, t.GetPick(i, j));
			tab.SetFormat(i, xi, t.GetFormat(i, j));
			tab.SetSpan(i, xi, max(span.cy - 1, 0), nxi - xi - 1);
			xi = nxi;
		}
	}
	table.Drop();
	if(table.GetCount())
		table.Top().text.CatPick(pick(tab));
	else
		target.CatPick(pick(tab));
	oldtab = false;
}
Ejemplo n.º 29
0
Archivo: slp.c Proyecto: oyzh/tiger
Table_ update(Table_ t,string index,int valueble){
  Table_ p;
  p = t;
  while(p){
    if(strcmp(index,p->id) == 0){
      p->value = valueble;
      return t;
    }
    p = p->tail;
  }
  p = Table(index,valueble,t);
  return p;
}
//---------------------------------------------------------
bool CVIEW_Table_Control::Load(const wxString &File_Name)
{
	CSG_Table	Table(&File_Name);

	bool	bResult	= Table.Get_Count() > 0
		&& Table.Get_Field_Count() == m_pTable->Get_Field_Count()
		&& m_pTable->Assign_Values(&Table)
		&& Update_Table();

	PROCESS_Set_Okay();

	return( bResult );
}