bool CBioseq_Handle::ContainsSegment(CSeq_id_Handle id, size_t resolve_depth, EFindSegment limit_flag) const { CBioseq_Handle h = GetScope().GetBioseqHandle(id); CConstRef<CSynonymsSet> syns; if ( h ) { syns = h.GetSynonyms(); } SSeqMapSelector sel; sel.SetFlags(CSeqMap::fFindRef); if ( limit_flag == eFindSegment_LimitTSE ) { sel.SetLimitTSE(GetTopLevelEntry()); } sel.SetResolveCount(resolve_depth); CSeqMap_CI it = GetSeqMap().BeginResolved(&GetScope(), sel); for ( ; it; ++it) { if ( syns ) { if ( syns->ContainsSynonym(it.GetRefSeqid()) ) { return true; } } else { if (it.GetRefSeqid() == id) { return true; } } } return false; }
void CSeqMap_CI::x_Push(const CConstRef<CSeqMap>& seqMap, const CTSE_Handle& tse, TSeqPos from, TSeqPos length, bool minusStrand, TSeqPos pos) { TSegmentInfo push; push.m_SeqMap = seqMap; push.m_TSE = tse; push.m_LevelRangePos = from; push.m_LevelRangeEnd = from + length; if (push.m_LevelRangeEnd < push.m_LevelRangePos) { // Detect (from + length) overflow NCBI_THROW(CSeqMapException, eDataError, "Sequence position overflow"); } push.m_MinusStrand = minusStrand; TSeqPos findOffset = !minusStrand? pos: length - 1 - pos; push.m_Index = seqMap->x_FindSegment(from + findOffset, GetScope()); if ( push.m_Index == size_t(-1) ) { if ( !m_Stack.empty() ) { return; } push.m_Index = !minusStrand? seqMap->x_GetLastEndSegmentIndex(): seqMap->x_GetFirstEndSegmentIndex(); } else { _ASSERT(push.m_Index > seqMap->x_GetFirstEndSegmentIndex() && push.m_Index < seqMap->x_GetLastEndSegmentIndex()); if ( pos >= length ) { if ( !minusStrand ) { if ( seqMap->x_GetSegmentPosition(push.m_Index, 0) < push.m_LevelRangeEnd ) { ++push.m_Index; _ASSERT(seqMap->x_GetSegmentPosition(push.m_Index, 0) >= push.m_LevelRangeEnd); } } else { if ( seqMap->x_GetSegmentEndPosition(push.m_Index, 0) > push.m_LevelRangePos ) { --push.m_Index; _ASSERT(seqMap->x_GetSegmentEndPosition(push.m_Index, 0) <= push.m_LevelRangePos); } } } } // update length of current segment seqMap->x_GetSegmentLength(push.m_Index, GetScope()); m_Stack.push_back(push); // update position m_Selector.m_Position += x_GetTopOffset(); // update length m_Selector.m_Length = push.x_CalcLength(); }
void CamShiftPlugin::OnOK() { wxBeginBusyCursor(); if (!GetScope()) ProcessImage(cm->book[cm->GetPos()], cm->GetPos()); else{ FetchParams(); ImagePlus *oimg; CvRect orect, searchwin; CvPoint ocenter; oimg = cm->book[0]; int numContours = (int) oimg->contourArray.size(); for (int i=1; i<cm->GetFrameCount(); i++) cm->book[i]->CloneContours(oimg); int frameCount = cm->GetFrameCount(); CreateProgressDlg(numContours*frameCount); bool cont=true; for (int j=0; j<numContours && cont; j++){ for (int i=1; i<frameCount && (cont=progressDlg->Update(j*frameCount+i, wxString::Format("Cell %d of %d, Frame %d of %d", j+1,numContours, i+1, frameCount))); i++){ ProcessStatic(j, cm->book[i], cm->book[useFirst ? 0 : i-1], hsizes, criteria, planes, hist, backproject, orect, ocenter, searchwin, rotation, shift, i>1); } } DestroyProgressDlg(); } cm->ReloadCurrentFrameContours(true, false); wxEndBusyCursor(); }
bool TagEntry::IsConstructor() const { if(GetKind() != wxT("function") && GetKind() != wxT("prototype")) return false; return GetName() == GetScope(); }
void CSeqMap_CI::x_Select(const CConstRef<CSeqMap>& seqMap, const SSeqMapSelector& selector, TSeqPos pos) { m_Selector = selector; if ( m_Selector.m_Length == kInvalidSeqPos ) { TSeqPos len = seqMap->GetLength(GetScope()); len -= min(len, m_Selector.m_Position); m_Selector.m_Length = len; } if ( pos < m_Selector.m_Position ) { pos = m_Selector.m_Position; } else if ( pos > m_Selector.m_Position + m_Selector.m_Length ) { pos = m_Selector.m_Position + m_Selector.m_Length; } x_Push(seqMap, m_Selector.m_TopTSE, m_Selector.m_Position, m_Selector.m_Length, m_Selector.m_MinusStrand, pos - m_Selector.m_Position); while ( !x_Found() && GetPosition() < m_SearchEnd ) { if ( !x_Push(pos - m_Selector.m_Position) ) { x_SettleNext(); break; } } }
void PHPEntityVariable::Store(wxSQLite3Database& db) { // we keep only the function arguments in the databse and globals if(IsFunctionArg() || IsMember()) { try { wxSQLite3Statement statement = db.PrepareStatement("INSERT OR REPLACE INTO VARIABLES_TABLE VALUES (NULL, " ":SCOPE_ID, :FUNCTION_ID, :NAME, :FULLNAME, :SCOPE, :TYPEHINT, " ":FLAGS, :DOC_COMMENT, :LINE_NUMBER, :FILE_NAME)"); statement.Bind(statement.GetParamIndex(":SCOPE_ID"), IsMember() ? Parent()->GetDbId() : wxLongLong(-1)); statement.Bind(statement.GetParamIndex(":FUNCTION_ID"), IsFunctionArg() ? Parent()->GetDbId() : wxLongLong(-1)); statement.Bind(statement.GetParamIndex(":NAME"), GetShortName()); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope()); statement.Bind(statement.GetParamIndex(":TYPEHINT"), GetTypeHint()); statement.Bind(statement.GetParamIndex(":FLAGS"), (int)GetFlags()); statement.Bind(statement.GetParamIndex(":DOC_COMMENT"), GetDocComment()); statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine()); statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath()); statement.ExecuteUpdate(); SetDbId(db.GetLastRowId()); } catch(wxSQLite3Exception& exc) { wxUnusedVar(exc); } } }
CConstRef<CSynonymsSet> CBioseq_Handle::GetSynonyms(void) const { if ( !*this ) { return CConstRef<CSynonymsSet>(); } return GetScope().GetSynonyms(*this); }
void NewScalar(const char *scope, const char *lval, const char *rval, enum cfdatatype dt) { Rval rvald; Scope *ptr; CfDebug("NewScalar(%s,%s,%s)\n", scope, lval, rval); ptr = GetScope(scope); if (ptr == NULL) { CfOut(cf_error, "", "!! Attempt to add variable \"%s\" to non-existant scope \"%s\" - ignored", lval, scope); return; } // Newscalar allocates memory through NewAssoc if (GetVariable(scope, lval, &rvald) != cf_notype) { DeleteScalar(scope, lval); } /* * We know AddVariableHash does not change passed Rval structure or its * contents, but we have no easy way to express it in C type system, hence cast. */ AddVariableHash(scope, lval, (Rval) {(char *) rval, CF_SCALAR}, dt, NULL, 0); }
TAstNode::ValueReturned TAstNodeForSentence::Execute() const { auto secondChild = m_firstChild->GetSibling(); auto thirdChild = secondChild->GetSibling(); auto firstValue = m_firstChild->Execute(); auto sencondValue = secondChild->Execute(); //auto thirdValue = thirdChild->Execute(); auto scope = GetScope(); auto name = m_firstChild->GetFirstChild()->GetToken()->Name(); auto type = TVariateManager::GetInstance()->GetVariateSrollUp(scope, name)->GetType(); UpdateValue(type, scope, name, firstValue.value); if (GetValue(type, scope, name)<sencondValue.value) { Context::interpreterContext.SetNextNode(thirdChild->GetSibling().get()); } else { Context::interpreterContext.SetNextNode(FindNextValidNode()); } return ValueReturned{ 0, SYMBOL_TYPE::TYPE_VOID }; }
int TagEntry::Store(wxSQLite3Statement& insertPerepareStmnt) { // If this node is a dummy, (IsOk() == false) we dont insert it to database if( !IsOk() ) return TagOk; try { // see TagsDatabase::GetInsertOneStatement() for the order of binding insertPerepareStmnt.Bind(1, GetParentId()); insertPerepareStmnt.Bind(2, GetName()); insertPerepareStmnt.Bind(3, GetFile()); insertPerepareStmnt.Bind(4, GetLine()); insertPerepareStmnt.Bind(5, GetKind()); insertPerepareStmnt.Bind(6, GetAccess()); insertPerepareStmnt.Bind(7, GetSignature()); insertPerepareStmnt.Bind(8, GetPattern()); insertPerepareStmnt.Bind(9, GetParent()); insertPerepareStmnt.Bind(10, GetInherits()); insertPerepareStmnt.Bind(11, GetPath()); insertPerepareStmnt.Bind(12, GetTyperef()); insertPerepareStmnt.Bind(13, GetScope()); insertPerepareStmnt.ExecuteUpdate(); insertPerepareStmnt.Reset(); } catch(wxSQLite3Exception& exc) { if(exc.ErrorCodeAsString(exc.GetErrorCode()) == wxT("SQLITE_CONSTRAINT")) return TagExist; wxLogMessage(exc.GetMessage()); return TagError; } return TagOk; }
int TagEntry::Update(wxSQLite3Statement& updatePerepareStmnt) { // If this node is a dummy, (IsOk() == false) we dont update it to database if( !IsOk() ) return TagOk; try { // see TagsDatabase::GetUpdateOneStatement() function for the order of binding updatePerepareStmnt.Bind(1, GetParentId()); updatePerepareStmnt.Bind(2, GetName()); updatePerepareStmnt.Bind(3, GetFile()); updatePerepareStmnt.Bind(4, GetLine()); updatePerepareStmnt.Bind(5, GetAccess()); updatePerepareStmnt.Bind(6, GetPattern()); updatePerepareStmnt.Bind(7, GetParent()); updatePerepareStmnt.Bind(8, GetInherits()); updatePerepareStmnt.Bind(9, GetTyperef()); updatePerepareStmnt.Bind(10, GetScope()); updatePerepareStmnt.Bind(11, GetKind()); updatePerepareStmnt.Bind(12, GetSignature()); updatePerepareStmnt.Bind(13, GetPath()); updatePerepareStmnt.ExecuteUpdate(); updatePerepareStmnt.Reset(); } catch(wxSQLite3Exception& exc) { wxLogMessage(exc.GetMessage()); return TagError; } return TagOk; }
CSeq_id_Handle CBioseq_Handle::GetAccessSeq_id_Handle(void) const { CSeq_id_Handle id = GetSeq_id_Handle(); // First try original id if ( id ) { return id; } // Then try to find gi ITERATE ( TId, it, GetId() ) { if ( it->IsGi() ) { CBioseq_Handle bh = GetScope().GetBioseqHandleFromTSE(*it, GetTSE_Handle()); if ( bh == *this ) { id = *it; _ASSERT(id); return id; } } } // Then try to find accession ITERATE ( TId, it, GetId() ) { if ( !it->IsGi() && it->GetSeqId()->GetTextseq_Id() ) { CBioseq_Handle bh = GetScope().GetBioseqHandleFromTSE(*it, GetTSE_Handle()); if ( bh == *this ) { id = *it; _ASSERT(id); return id; } } } // Then try to find any other id ITERATE ( TId, it, GetId() ) { if ( !it->IsGi() && !it->GetSeqId()->GetTextseq_Id() ) { CBioseq_Handle bh = GetScope().GetBioseqHandleFromTSE(*it, GetTSE_Handle()); if ( bh == *this ) { id = *it; _ASSERT(id); return id; } } } NCBI_THROW(CObjMgrException, eOtherError, "CBioseq_Handle::GetAccessSeq_id_Handle " "can not find seq-id to access this bioseq"); }
NS_IMETHODIMP HTMLTableCellElement::GetScope(nsAString& aScope) { DOMString scope; GetScope(scope); scope.ToString(aScope); return NS_OK; }
NS_IMETHODIMP HTMLTableCellElement::GetScope(nsAString& aScope) { nsString scope; GetScope(scope); aScope = scope; return NS_OK; }
bool CSeqMap_CI::x_RefTSEMatch(const CSeqMap::CSegment& seg) const { _ASSERT(m_Selector.x_HasLimitTSE()); _ASSERT(CSeqMap::ESegmentType(seg.m_SegType) == CSeqMap::eSeqRef); CSeq_id_Handle id = CSeq_id_Handle:: GetHandle(x_GetSeqMap().x_GetRefSeqid(seg)); return m_Selector.x_GetLimitTSE(GetScope()).GetBioseqHandle(id); }
// The aln_id_map argument is required because TScopeAlnStat keeps const // reference to the id-map. So, the map needs to be returned to the caller. CRef<TScopeAlnStats> InitAlnStats(const CAlnContainer& aligns, auto_ptr<TScopeAlnIdMap>& aln_id_map) { TScopeAlnSeqIdConverter id_conv(&GetScope()); TScopeIdExtract id_extract(id_conv); aln_id_map.reset(new TScopeAlnIdMap(id_extract, aligns.size())); ITERATE(CAlnContainer, aln_it, aligns) { aln_id_map->push_back(**aln_it); }
TSeqPos CBioseq_Handle::GetBioseqLength(void) const { if ( IsSetInst_Length() ) { return GetInst_Length(); } else { return GetSeqMap().GetLength(&GetScope()); } }
bool CSeqMap_CI::x_TopPrev(void) { TSegmentInfo& top = x_GetSegmentInfo(); if ( !top.x_Move(!top.m_MinusStrand, GetScope()) ) { m_Selector.m_Length = 0; return false; } else { m_Selector.m_Length = x_GetSegmentInfo().x_CalcLength(); m_Selector.m_Position -= m_Selector.m_Length; return true; } }
void DeleteScalar(const char *scope_name, const char *lval) { Scope *scope = GetScope(scope_name); if (scope == NULL) { return; } if (HashDeleteElement(scope->hashtable, lval) == false) { CfDebug("Attempt to delete non-existent variable %s in scope %s\n", lval, scope_name); } }
CRef<CDense_seg> CAlnVec::CreateConsensus(int& consensus_row, const CSeq_id& consensus_id) const { CRef<CBioseq> bioseq(new CBioseq); CRef<CDense_seg> ds = CreateConsensus(consensus_row, *bioseq, consensus_id); // add bioseq to the scope CRef<CSeq_entry> entry(new CSeq_entry()); entry->SetSeq(*bioseq); GetScope().AddTopLevelSeqEntry(*entry); return ds; }
void DeleteVariable(char *scope, char *id) { Scope *ptr = GetScope(scope); if (ptr == NULL) { return; } if (HashDeleteElement(ptr->hashtable, id) == false) { CfDebug("No variable matched %s\n", id); } }
void ProjectVariatesXmlManager::WriteScopeVariates(QXmlStreamWriter& writer, const QString& scope, QVector<QByteArray>& variatesArray) const { writer.writeStartElement(scope); for (auto& variateBytes : variatesArray) { auto variate = TVariateFactory::GetVariate(variateBytes); if (variate->GetScope() == scope) { WriteVariate(writer, variate); } } writer.writeEndElement(); }
void GUICursor::Build() { m_elements.clear(); BuildElements(m_elements); SpriteRect rect; GetScope(rect); rect.GetFourBorders(m_renderer, m_fourBorders); matrix4x4 mat; Matrix4x4_set_one(&mat); GetMatrix(&mat); m_fourBorders.ApplyTranform(&mat); }
void XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp *fop, JSObject *obj) { NS_ASSERTION(obj == mJSProtoObject, "huh?"); // Map locking is not necessary since we are running gc. // Only remove this proto from the map if it is the one in the map. ClassInfo2WrappedNativeProtoMap* map = GetScope()->GetWrappedNativeProtoMap(ClassIsMainThreadOnly()); if (map->Find(mClassInfo) == this) map->Remove(mClassInfo); GetRuntime()->GetDetachedWrappedNativeProtoMap()->Remove(this); GetRuntime()->GetDyingWrappedNativeProtoMap()->Add(this); mJSProtoObject.finalize(js::CastToJSFreeOp(fop)->runtime()); }
//_____________________________________________________________________________ // void AUScope::SetNumberOfElements(UInt32 numElements) { if (mDelegate) return mDelegate->SetNumberOfElements(numElements); if (numElements > mElements.size()) { mElements.reserve(numElements); while (numElements > mElements.size()) { AUElement *elem = mCreator->CreateElement(GetScope(), mElements.size()); mElements.push_back(elem); } } else while (numElements < mElements.size()) { AUElement *elem = mElements.back(); mElements.pop_back(); delete elem; } }
const CBioseq_Handle& CAlnVec::GetBioseqHandle(TNumrow row) const { TBioseqHandleCache::iterator i = m_BioseqHandlesCache.find(row); if (i != m_BioseqHandlesCache.end()) { return i->second; } else { CBioseq_Handle bioseq_handle = GetScope().GetBioseqHandle(GetSeqId(row)); if (bioseq_handle) { return m_BioseqHandlesCache[row] = bioseq_handle; } else { string errstr = string("CAlnVec::GetBioseqHandle(): ") + "Seq-id cannot be resolved: " + GetSeqId(row).AsFastaString(); NCBI_THROW(CAlnException, eInvalidSeqId, errstr); } } }
void PHPEntityFunctionAlias::Store(wxSQLite3Database& db) { try { wxSQLite3Statement statement = db.PrepareStatement( "INSERT OR REPLACE INTO FUNCTION_ALIAS_TABLE VALUES(NULL, :SCOPE_ID, :NAME, :REALNAME, :FULLNAME, :SCOPE, " ":LINE_NUMBER, :FILE_NAME)"); statement.Bind(statement.GetParamIndex(":SCOPE_ID"), Parent()->GetDbId()); statement.Bind(statement.GetParamIndex(":NAME"), GetShortName()); statement.Bind(statement.GetParamIndex(":REALNAME"), GetRealname()); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope()); statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine()); statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath()); statement.ExecuteUpdate(); SetDbId(db.GetLastRowId()); } catch(wxSQLite3Exception& exc) { CL_WARNING("PHPEntityFunctionAlias::Store: %s", exc.GetMessage()); } }
void CAlnMrgApp::LoadSeqEntry(CNcbiIstream& is) { string se_asn_type; {{ auto_ptr<CObjectIStream> obj_is (CObjectIStream::Open(eSerial_AsnText, is)); se_asn_type = obj_is->ReadFileHeader(); obj_is->Close(); is.seekg(0); }} auto_ptr<CObjectIStream> obj_is (CObjectIStream::Open(eSerial_AsnText, is)); if (se_asn_type == "Seq-entry") { CRef<CSeq_entry> se (new CSeq_entry); *obj_is >> *se; GetScope().AddTopLevelSeqEntry(*se); } else {
void XPCWrappedNativeProto::JSProtoObjectFinalized(JSContext *cx, JSObject *obj) { NS_ASSERTION(obj == mJSProtoObject, "huh?"); // Map locking is not necessary since we are running gc. if(IsShared()) { // Only remove this proto from the map if it is the one in the map. ClassInfo2WrappedNativeProtoMap* map = GetScope()->GetWrappedNativeProtoMap(ClassIsMainThreadOnly()); if(map->Find(mClassInfo) == this) map->Remove(mClassInfo); } GetRuntime()->GetDetachedWrappedNativeProtoMap()->Remove(this); GetRuntime()->GetDyingWrappedNativeProtoMap()->Add(this); mJSProtoObject = nsnull; }
static void XmlExportVariables(Writer *writer, const char *scope) { char *filebuffer = NULL; Rlist *rp = NULL; Rlist *list = NULL; /* START XML ELEMENT -- VARIABLE*-SCOPE */ XmlAttribute scope_name_attr = { "name", scope }; XmlStartTag(writer, XMLTAG_VARSCOPE, 1, scope_name_attr); /* XML ELEMENT -- INTRO */ filebuffer = ReadTexinfoFileF("varcontexts/%s_intro.texinfo", scope); XmlTag(writer, XMLTAG_INTRO, filebuffer, 0); free(filebuffer); HashToList(GetScope(scope), &list); list = AlphaSortRListNames(list); for (rp = list; rp != NULL; rp = rp->next) { /* START XML ELEMENT -- VARIABLE */ XmlAttribute var_name_attr = { "name", ScalarValue(rp) }; XmlStartTag(writer, XMLTAG_VARIABLE, 1, var_name_attr); /* XML ELEMENT -- LONG-DESCRIPTION */ filebuffer = ReadTexinfoFileF("vars/%s_%s.texinfo", scope, ScalarValue(rp)); XmlTag(writer, XMLTAG_LONGDESCRIPTION, filebuffer, 0); free(filebuffer); /* END XML ELEMENT -- VARIABLE */ XmlEndTag(writer, XMLTAG_VARIABLE); } DeleteRlist(list); /* END XML ELEMENT -- VARIABLE-SCOPE */ XmlEndTag(writer, XMLTAG_VARSCOPE); }