本文整理汇总了C++中Term类的典型用法代码示例。如果您正苦于以下问题:C++ Term类的具体用法?C++ Term怎么用?C++ Term使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Term类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: symbol_obj
bool TagType::contains(Term &t)
{
if (!t.is_tagged_obj())
return false;
Term tag_obj = symbol_obj(t.get_tag());
return tag_type->contains(tag_obj) && obj_type->contains(t.untag());
}
开发者ID:gianantonio71,项目名称:amber-interpreter,代码行数:7,代码来源:types.cpp
示例2: QMimeData
QMimeData *TableModelVariables::mimeData(const QModelIndexList &indexes) const
{
QMimeData *mimeData = new QMimeData();
QByteArray encodedData;
QDataStream dataStream(&encodedData, QIODevice::WriteOnly);
dataStream << indexes.length();
foreach (const QModelIndex &index, indexes)
{
if (index.isValid())
{
Term term = _variables.at(index.row());
dataStream << term.asQString();
}
}
TableModelVariables* th1s = (TableModelVariables*) this;
th1s->_mimeData = mimeData;
mimeData->setData(_mimeType, encodedData);
return mimeData;
}
开发者ID:AlexanderLyNL,项目名称:jasp-desktop,代码行数:25,代码来源:tablemodelvariables.cpp
示例3: block_update_state_type
void block_update_state_type(Block* block)
{
if (!block_state_type_is_out_of_date(block))
return;
// Recreate the state type
Type* type = create_compound_type();
// TODO: give this new type a nice name
for (int i=0; i < block->length(); i++) {
Term* term = block->get(i);
if (term == NULL)
continue;
if (term->function != FUNCS.unpack_state || FUNCS.unpack_state == NULL)
continue;
Term* identifyingTerm = term->input(1);
caValue* fieldName = get_unique_name(identifyingTerm);
ca_assert(is_string(fieldName));
ca_assert(!string_eq(fieldName, ""));
compound_type_append_field(type, declared_type(term), as_cstring(fieldName));
}
block->stateType = type;
block_remove_property(block, sym_DirtyStateType);
// Might need to update any existing pack_state calls.
block_update_pack_state_calls(block);
}
开发者ID:whunmr,项目名称:circa,代码行数:33,代码来源:stateful_code.cpp
示例4: bug_reproducing_list_after_eval
void bug_reproducing_list_after_eval()
{
// There once was a bug where source repro would fail when using a list
// in a vectorized function, but only after that piece of code had been
// evaluated. This was because vectorize_vv was calling apply() which
// was changing the 'statement' property of its inputs.
Branch branch;
Term* sum = branch.compile("[1 1] + [1 1]");
Term* in0 = sum->input(0);
Term* in1 = sum->input(0);
test_equals(get_term_source_text(in0), "[1 1]");
test_equals(get_term_source_text(in1), "[1 1]");
test_equals(get_input_source_text(sum, 0), "[1 1] ");
test_equals(get_input_source_text(sum, 1), " [1 1]");
test_equals(get_branch_source_text(&branch), "[1 1] + [1 1]");
evaluate_branch(&branch);
test_equals(get_term_source_text(in0), "[1 1]");
test_equals(get_term_source_text(in1), "[1 1]");
test_equals(get_input_source_text(sum, 0), "[1 1] ");
test_equals(get_input_source_text(sum, 1), " [1 1]");
test_equals(get_branch_source_text(&branch), "[1 1] + [1 1]");
}
开发者ID:julianhaslinger,项目名称:circa,代码行数:27,代码来源:source_repro_tests.cpp
示例5: openIndex
/**
* find matching terms.
* @param inQuery the term with a wildcard for which the matching terms should be found.
* @param
*
*/
void LuceneSearcher::findMatchingTerms(string inTerm, map<string, int> &ioTerms){
if (mLuceneSearcher == 0){
openIndex();
}
set<string> matchingTerms;
TCHAR buffer[200];
char buffer2[200];
STRCPY_AtoT(buffer, inTerm.c_str(), 200);
Term *theTerm = new Term(_T("content"), buffer, false);
lucene::analysis::Analyzer *theAnalyzer =
new lucene::analysis::standard::StandardAnalyzer();
set<string>::iterator iter;
STRCPY_TtoA(buffer2, theTerm->text(), 200);
//cerr << "findMatchingTerms for the words: " << buffer2 << endl;
//cerr << "findMatchingTerms getReader is " << mLuceneSearcher->getReader() << endl;
//cerr << "getDirectgory is " << mLuceneSearcher->getReader()->getDirectory() << endl;
TermEnum *tEnum = mLuceneSearcher->getReader()->terms();
//cerr << "Termenum is " << tEnum << endl;
//cerr << "numdocs is " << mLuceneSearcher->getReader()->numDocs() << endl;
WildcardTermEnum termEnum(mLuceneSearcher->getReader(), theTerm);
//cerr << "Wildcardenum succeeded" << endl;
while(termEnum.next()){
Term *term = termEnum.term(false);
STRCPY_TtoA(buffer2, term->text(), 200);
//cerr << "adding term " << term->text() << endl;
ioTerms[string(buffer2)] += termEnum.docFreq();
}
//cerr << "done findMatchingTerms" << endl;
_CLDECDELETE(theTerm);
}
开发者ID:DNPA,项目名称:OcfaArch,代码行数:41,代码来源:LuceneSearcher.cpp
示例6: main
main()
{
Polynomial p;
Polynomial *q = new Polynomial;
Term e;
cout << "start" << endl;
e.Init(3, 14); p.Add(e);
e.Init(2,8); p.Add(e);
e.Init(1,0); p.Add(e);
cout << "p" << endl << p << endl;
e.Init(-3,13) ; q->Add(e);
e.Init(-2,8); q->Add(e);
e.Init(-1,1) ; q->Add(e);
cout << "q" << endl << *q << endl;
Polynomial r = p + *q;
cout << "r = p + q" << endl << r << endl;
Polynomial s;
cout << "s" << endl << s << endl;
Polynomial t = s + s;
cout << "t = s + s" << endl << t << endl;
Polynomial u = p + p;
cout << "u = p + p" << endl << u << endl;
}
开发者ID:ChenBoTang,项目名称:fds,代码行数:32,代码来源:cpoly2.cpp
示例7: FindTermOfProductType
bool Multivector::CollectTerms( Term::ProductType productType )
{
Term::ProductType otherProductType = Term::OtherProductType( productType );
for(;;)
{
SumOfTerms::Node* node = FindTermOfProductType( otherProductType );
if( !node )
break;
Term* term = node->data;
Multivector multivector;
if( !term->PerformProductMorphism( multivector ) )
return false;
sumOfTerms.Remove( node, true );
sumOfTerms.Absorb( &multivector.sumOfTerms );
}
if( productType == Term::OUTER_PRODUCT )
{
// STPTODO: Presort all term products, accounting for the sign change. This way we can use CombineWidth( ..., false ) to save time.
}
// STPTODO: Combine terms here.
// STPTODO: Cull zero terms here.
return true;
}
开发者ID:mapleyustat,项目名称:GACompute,代码行数:31,代码来源:Multivector.cpp
示例8: append_final_pack_state
static void append_final_pack_state(Branch* branch)
{
TermList inputs;
get_list_of_state_outputs(branch, branch->length(), &inputs);
Term* term = apply(branch, FUNCS.pack_state, inputs);
term->setBoolProp("final", true);
}
开发者ID:levelplane,项目名称:circa,代码行数:7,代码来源:stateful_code.cpp
示例9: start_building_for_loop
void start_building_for_loop(Block* contents, Term* listExpr, Value* indexName,
Value* elementName, Type* iteratorType)
{
Term* iterator = apply(contents, FUNCS.loop_iterator, TermList(listExpr));
Term* done = apply_dynamic_method(contents, s_done, TermList(iterator));
hide_from_source(done);
Term* getKey = apply_dynamic_method(contents, s_key, TermList(iterator));
hide_from_source(getKey);
if (!is_null(indexName)) {
Term* getIndex = apply_dynamic_method(contents, s_key, TermList(iterator), indexName);
hide_from_source(getIndex);
}
Term* getCurrent = apply_dynamic_method(contents, s_current, TermList(iterator), elementName);
getCurrent->setBoolProp(s_iterator_value, true);
hide_from_source(getCurrent);
if (iteratorType != NULL) {
Term* castedValue = apply(contents, FUNCS.cast,
TermList(getCurrent, iteratorType->declaringTerm), elementName);
}
}
开发者ID:andyfischer,项目名称:circa,代码行数:25,代码来源:loops.cpp
示例10: loop_find_condition
Term* loop_find_condition(Block* block)
{
Term* conditionCheck = loop_find_condition_check(block);
if (conditionCheck != NULL)
return conditionCheck->input(0);
return NULL;
}
开发者ID:andyfischer,项目名称:circa,代码行数:7,代码来源:loops.cpp
示例11: term
Term* TermEnum::term(bool pointer)
{
Term* ret = term();
if (!pointer)
ret->__cl_decref();
return ret;
}
开发者ID:marsender,项目名称:atoll-digital-library,代码行数:7,代码来源:Terms.cpp
示例12: finish_for_loop
void finish_for_loop(Term* forTerm)
{
Branch* contents = nested_contents(forTerm);
// Need to finish here to prevent error
branch_finish_changes(contents);
// Add a a primary output
Term* primaryOutput = apply(contents, FUNCS.output,
TermList(loop_get_primary_result(contents)));
primaryOutput->setBoolProp("accumulatingOutput", true);
respecialize_type(primaryOutput);
// pack_any_open_state_vars(contents);
for_loop_fix_state_input(contents);
check_to_add_state_output_placeholder(contents);
add_implicit_placeholders(forTerm);
repoint_terms_to_use_input_placeholders(contents);
check_to_insert_implicit_inputs(forTerm);
update_extra_outputs(forTerm);
branch_finish_changes(contents);
}
开发者ID:mokerjoke,项目名称:circa,代码行数:25,代码来源:loops.cpp
示例13: contains
bool Enum::contains(Term &t)
{
if (!t.is_symbol())
return false;
return in_sorted_vector(t.get_symbol(), symbols);
}
开发者ID:gianantonio71,项目名称:amber-interpreter,代码行数:7,代码来源:types.cpp
示例14: switch
Term* ArithmeticTerm::canonicalize(ArithmeticTerm* at)
{
if(at->get_elems().size() == 0) {
long int constant = at->get_constant();
delete at;
return ConstantTerm::make(constant);
}
if(at->get_constant() == 0 && at->get_elems().size() == 1 &&
(at->get_elems().begin())->second ==1)
{
Term* t = at->get_elems().begin()->first;
switch(t->get_term_type())
{
case VARIABLE_TERM:
case FUNCTION_TERM:
{
delete at;
return t;
}
default:
assert(false);
}
}
return Term::get_term(at);
}
开发者ID:xwangsd,项目名称:mistral,代码行数:26,代码来源:ArithmeticTerm.cpp
示例15: repoint_terms_to_use_input_placeholders
void repoint_terms_to_use_input_placeholders(Branch* contents)
{
// Visit every term
for (int i=0; i < contents->length(); i++) {
Term* term = contents->get(i);
// Visit every input
for (int inputIndex=0; inputIndex < term->numInputs(); inputIndex++) {
Term* input = term->input(inputIndex);
if (input == NULL)
continue;
// If the input is outside this branch, then see if we have a named
// input that could be used instead.
if (input->owningBranch == contents || input->name == "")
continue;
Term* replacement = find_input_placeholder_with_name(contents, input->name.c_str());
if (replacement == NULL)
continue;
set_input(term, inputIndex, replacement);
}
}
}
开发者ID:levelplane,项目名称:circa,代码行数:25,代码来源:loops.cpp
示例16: Term__num_inputs
void Term__num_inputs(VM* vm)
{
Term* t = as_term_ref(vm->input(0));
if (t == NULL)
return vm->throw_str("NULL term");
set_int(vm->output(), t->numInputs());
}
开发者ID:ShenTensen,项目名称:circa,代码行数:7,代码来源:reflection.cpp
示例17: Search
//////////////////////////////////////
// initialize matching terms iterator
//
int DbIntlog::Search(Term t, DbEntryIter &iter, DbIntlog *dbs)
{
#ifdef _DEBUG
CCP tstring = t.get_funct();
#endif
DbEntry e = DbEntry(t.get_funct(), t.get_arity()),
*dbe = isin(e);
if (!dbe)
{
if (dbs == 0 ||
(dbe = dbs->isin(e)) == 0 ||
dbe->vProp != DbEntry::dynamic)
{
iter.pcc = 0;
iter.own = iter.mod = 0;
return 0;
}
iter.mod =
iter.own = dbs;
}
else
{
iter.mod = this;
iter.own = dbs;
}
// initialize for later search
iter.pcc = (e_DbList*)dbe->get_first()->fix_clause(dbs);
iter.pcp = 0;
return 1;
}
开发者ID:CapelliC,项目名称:IL,代码行数:37,代码来源:dbintlog.cpp
示例18: invoiceTermId
fixed
ServiceCharges::balanceOn(const Gltx& gltx, QDate date)
{
QDate dueDate = gltx.postDate();
if (gltx.dataType() == DataObject::INVOICE) {
Id term_id = invoiceTermId(gltx.id());
if (term_id != INVALID_ID) {
Term term;
if (findTerm(term_id, term))
dueDate = gltx.postDate() + term.dueDays();
}
}
if (date < dueDate) return 0.0;
fixed balance = gltx.cardTotal();
for (unsigned int i = 0; i < gltx.payments().size(); ++i) {
Id payment_id = gltx.payments()[i].gltx_id;
fixed amount = gltx.payments()[i].amount;
Gltx payment;
if (!findGltx(payment_id, payment))
continue;
if (payment.postDate() <= date)
balance -= amount;
}
return balance;
}
开发者ID:cwarden,项目名称:quasar,代码行数:27,代码来源:service_charges.cpp
示例19: itdb
///////////////////////////////////////
// on qualified name, select direct DB
//
DbIntlog *DbIntlog::FixPathName(Term *t) const
{
DbIntlog *db = (DbIntlog*)this;
Term r = *t;
while (db && r.is_expr(Operator::PATHNAME) && r.getarg(0).type(f_ATOM))
{
kstring dbid = r.getarg(0).kstr();
if (!strcmp(dbid, ".."))
db = db->m_father;
else
{
DbInherIter itdb(db);
while ((db = itdb.next()) != 0)
if (db->GetId() == dbid)
break;
}
if (db)
r = r.getarg(1);
}
*t = r;
return db;
}
开发者ID:CapelliC,项目名称:IL,代码行数:29,代码来源:dbintlog.cpp
示例20: IIFTYPE
/////////////////////////////////////////////////////////////////
// attempt a parse and call
// if query succeed, copy vars values to v[] (up to nv elements)
// you must guarantee that nv >= 'num of vars in src'
//
IIFTYPE(int) IAFX_QueryString(const char *src, EngHandle h, Term **var_val, kstr_list *var_ids)
{
int rc = -1; // if some error occurs
IntlogExec *ile = GetEngines()->HtoD(h);
if (ile != 0)
{
// prepare input source stream
IntlogParser* parser = GetEngines()->get_parser();
istringstream srcstream(src);
// save status
parser->SetSource(&srcstream, "QueryString", var_ids);
// submit source line: if parse ok, query
if (parser->getinput() == IntlogParser::NewClause)
{
Term tparsed = parser->parsed;
int nv = var_ids->numel();
if (nv > 0)
*var_val = new Term[nv];
rc = runquery(ile, tparsed, var_ids, *var_val, var_ids->numel());
tparsed.Destroy();
}
}
// some error occurred
return rc;
}
开发者ID:CapelliC,项目名称:IL,代码行数:37,代码来源:iafx.cpp
注:本文中的Term类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论