示例#1
0
 void set_untrusted(int val=1) {
   flags().Untrusted = val;
 }
示例#2
0
文件: oop.hpp 项目: julio/rubinius
 bool is_untrusted_p() const {
   if(reference_p()) {
     return flags().Untrusted == 1;
   }
   return false;
 }
示例#3
0
文件: oop.hpp 项目: julio/rubinius
 bool check_type(object_type type) const {
   return reference_p() && flags().obj_type == type;
 }
示例#4
0
文件: oop.hpp 项目: julio/rubinius
 bool in_immix_p() const {
   return flags().InImmix == 1;
 }
示例#5
0
文件: oop.hpp 项目: julio/rubinius
 bool is_frozen_p() const {
   return flags().Frozen == 1;
 }
示例#6
0
文件: oop.hpp 项目: julio/rubinius
 bool forwarded_p() const {
   return flags().Forwarded == 1;
 }
示例#7
0
文件: oop.hpp 项目: julio/rubinius
 int which_mark() const {
   return flags().Marked;
 }
 bool is_private     () { return flags().is_private(); }
 bool is_protected   () { return flags().is_protected(); }
示例#10
0
 inline timezone get_timezone()
 {
   return (flags() & uses_local) ? timezone::local : timezone::utc;
 }
 // Java access flags
 bool is_public      () { return flags().is_public(); }
示例#12
0
 inline duration_style get_duration_style()
 {
   return (flags() & uses_symbol) ? duration_style::symbol : duration_style::prefix;
 }
示例#13
0
void Curve::intersect(StandardScene *scene, osg::Plane plane, osg::Polytope polytope, osg::Quat quat, bool culling) {
	if (!scene) return;
	
	this->m_segments.clear();
	osgUtil::PlaneIntersector *picker = new osgUtil::PlaneIntersector(
			osgUtil::Intersector::CoordinateFrame::WINDOW, plane, polytope);
	osgUtil::IntersectionVisitor iv(picker);
	iv.setTraversalMask(StandardScene::NodeMask::Pickable);
	scene->screen().camera()->accept(iv);
	if (picker->containsIntersections()) {

		osgUtil::PlaneIntersector::Intersections &raws(picker->getIntersections());
		
		// Detects and culls occlusion.
		if (culling) {

			// Rotates polylines to xy-plane.
			std::vector<std::vector<bool> > flags(raws.size());
			for (size_t i = 0; i < raws.size(); ++i) {
				size_t size = raws[i].polyline.size();
				flags[i].resize(size, true);
				for (size_t j = 0; j < size; ++j) {
					raws[i].polyline[j] = quat * raws[i].polyline[j];
					raws[i].polyline[j].z() = 0;
				}
			}

			// Sorts knots with respect to x-coordinate.
			std::vector<std::pair<real_t, index_t> > knots;
			for (size_t i = 0; i < raws.size(); ++i) {
				for (size_t j = 0; j < raws[i].polyline.size(); ++j) {
					knots.push_back(std::pair<real_t, index_t>(raws[i].polyline[j].x(), index_t(i, j)));
				}
			}
			std::sort(knots.begin(), knots.end(), pred_t());

			// Marks occluded knots.
			for (size_t i = 0; i < raws.size(); ++i) {
				for (size_t j = 0; j < raws[i].polyline.size() - 1; ++j) {
					real_t x1 = raws[i].polyline[j].x(), x2 = raws[i].polyline[j + 1].x();
					real_t y1 = raws[i].polyline[j].y(), y2 = raws[i].polyline[j + 1].y();
					auto beg = std::lower_bound(knots.begin(), knots.end(), std::make_pair(std::min<real_t>(x1, x2), index_t()), pred_t()) + 1;
					auto end = std::upper_bound(knots.begin(), knots.end(), std::make_pair(std::max<real_t>(x1, x2), index_t()), pred_t()) - 1;
					for (auto iter = beg; iter < end; ++iter) {
						real_t x = raws[iter->second.line].polyline[iter->second.knot].x();
						real_t y = raws[iter->second.line].polyline[iter->second.knot].y();
						real_t det = ((x - x1) * (y2 - y) - (y - y1) * (x2 - x)) * (x2 - x1);
						if (det > 0) flags[iter->second.line][iter->second.knot] = false;
					}
				}
			}

			// Reconstructs polylines.
			std::vector<std::vector<osg::Vec3d> > polylines;
			for (size_t i = 0; i < raws.size(); ++i) {
				polylines.push_back(std::vector<osg::Vec3d>());
				for (size_t j = 0; j < raws[i].polyline.size(); ++j) {
					if (flags[i][j]) polylines.back().push_back(raws[i].polyline[j]);
					else {
						if (polylines.back().size() < 2) polylines.back().clear();
						else polylines.push_back(std::vector<osg::Vec3d>());
					}
				}
				if (polylines.back().size() < 2) polylines.pop_back();
			}

			// Translates to matrix storage.
			for (size_t i = 0; i < polylines.size(); ++i) {
				size_t size = polylines[i].size();
				this->m_segments.push_back(Segment(3, size));
				for (size_t j = 0; j < size; ++j) {
					this->m_segments.back().col(j) = algo::Util::toVector(polylines[i][j]);
				}
				this->m_segments.back().row(2).setZero();
			}

		} else {

			// Translates to matrix storage.
			for (size_t i = 0; i < raws.size(); ++i) {
				size_t size = raws[i].polyline.size();
				this->m_segments.push_back(Segment(3, size));
				for (size_t j = 0; j < size; ++j) {
					this->m_segments.back().col(j) = algo::Util::toVector(quat * raws[i].polyline[j]);
				}
				this->m_segments.back().row(2).setZero();
			}
		}
	}
}
示例#14
0
void IWnd_stc::UpdateStyle()
{

	bool flag =
		param.nlang == tempp.nlang &&
		param.nsize == tempp.nsize &&
		(param.flags.get(FLAG_FOLD) == tempp.flags.get(FLAG_FOLD)) &&
		(param.flags.get(FLAG_SYNTAX) == tempp.flags.get(FLAG_SYNTAX))
		;

	param=tempp;	

	if(flag)
	{
		_DoUpdateStyle();
		return;
	}


	BitFlags& flags(param.flags);

	StcLangInfo& lf(StcManager::current().langs[param.nlang]);

	wxFont fontNr (param.nsize, wxMODERN, wxNORMAL, wxNORMAL,false,str2wx(param.sface));
    for (int Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++)
	{
        StyleSetFont (Nr, fontNr);
    }

	if(!flags.get(FLAG_FOLD))
	{
		ClearDocumentStyle();
	}

    StyleClearAll();
    SetLexer (lf.lexer);

    SetMarginType (StcManager::LINE_NR_ID, wxSTC_MARGIN_NUMBER);
    StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY")));
    StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
    SetMarginWidth (StcManager::LINE_NR_ID, 0);

    // set common styles
    StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY")));
    StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY")));

	SetMarginType(StcManager::DIVIDER_ID, wxSTC_MARGIN_SYMBOL);
	SetMarginMask(StcManager::DIVIDER_ID, wxSTC_MASK_FOLDERS);
    SetMarginWidth (StcManager::DIVIDER_ID, 0);
    SetMarginSensitive (StcManager::DIVIDER_ID, false);

    // folding
    SetMarginType (StcManager::FOLDING_ID, wxSTC_MARGIN_SYMBOL);
    SetMarginMask (StcManager::FOLDING_ID, wxSTC_MASK_FOLDERS);
    StyleSetBackground (StcManager::FOLDING_ID, *wxWHITE);
    SetMarginWidth (StcManager::FOLDING_ID, 0);
    SetMarginSensitive (StcManager::FOLDING_ID, false);

	if (flags.get(FLAG_FOLD)) 
	{

		SetMarginWidth (StcManager::FOLDING_ID,StcManager::FOLDING_MARGIN);
		SetMarginSensitive (StcManager::FOLDING_ID, true);

		SetPropertyEx ("fold", true);
		SetPropertyEx ("fold.comment",true);
		SetPropertyEx ("fold.compact",true);
		SetPropertyEx ("fold.preprocessor",true);
		SetPropertyEx ("fold.html", true);
		SetPropertyEx ("fold.html.preprocessor",true);
		SetPropertyEx ("fold.comment.python", true);
		SetPropertyEx ("fold.quotes.python", true);
	}
	else
	{
		SetMarginWidth (StcManager::DIVIDER_ID, StcManager::FOLDING_MARGIN);
	}

	SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED| wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);

	if (flags.get(FLAG_SYNTAX))
	{
		int keywordnr = 0;

		for(StcLangInfo::map_type::iterator it=lf.mapStyles.begin();it!=lf.mapStyles.end();++it)
		{
			int Nr=(*it).first;
			StcLangInfo::StyleWords& s((*it).second);
			StcStyleInfo& curType(StcManager::current().style[s.id]);

			wxFont font (param.nsize, wxMODERN, wxNORMAL, wxNORMAL, false,str2wx(curType.fontname));

			StyleSetFont (Nr, font);
			if (curType.foreground!=wxEmptyString) 
			{
				StyleSetForeground (Nr, wxColour (curType.foreground.c_str()));
			}
			if (curType.background!=wxEmptyString) 
			{
				StyleSetBackground (Nr, wxColour (curType.background.c_str()));
			}

			StyleSetBold (Nr, curType.fontstyle.get(StcManager::STYLE_BOLD));
			StyleSetItalic (Nr, curType.fontstyle.get(StcManager::STYLE_ITALIC));
			StyleSetUnderline (Nr, curType.fontstyle.get(StcManager::STYLE_UNDERL));
			StyleSetVisible (Nr, !curType.fontstyle.get(StcManager::STYLE_HIDDEN));

			//StyleSetCase (Nr, curType.lettercase);
			if (s.words!="") 
			{
				SetKeyWords (keywordnr, str2wx(s.words));
				keywordnr += 1;
			}
		}
	}

	_DoUpdateStyle();

	Colourise(0,this->GetLastPosition());

}
示例#15
0
文件: oop.hpp 项目: julio/rubinius
 gc_zone zone() const {
   return flags().zone;
 }
 bool is_static      () { return flags().is_static(); }
示例#17
0
文件: oop.hpp 项目: julio/rubinius
 unsigned int age() const {
   return flags().age;
 }
 bool is_final       () { return flags().is_final(); }
示例#19
0
文件: oop.hpp 项目: julio/rubinius
 bool marked_p(unsigned int which) const {
   return flags().Marked == which;
 }
 bool is_volatile    () { return flags().is_volatile(); }
示例#21
0
文件: oop.hpp 项目: julio/rubinius
 bool pinned_p() const {
   return flags().Pinned == 1;
 }
 bool is_transient   () { return flags().is_transient(); }
示例#23
0
文件: oop.hpp 项目: julio/rubinius
 bool remembered_p() const {
   return flags().Remember == 1;
 }
示例#24
0
文件: kwidget.cpp 项目: kxtry/kxmob
bool KWidget::hasContent()
{
    return !(flags() & QGraphicsItem::ItemHasNoContents);
}
示例#25
0
文件: oop.hpp 项目: julio/rubinius
 bool is_tainted_p() const {
   if(reference_p()) {
     return flags().Tainted == 1;
   }
   return false;
 }
示例#26
0
 inline bool isContainer(int node) const { return flags(node) & Directory; }
示例#27
0
文件: oop.hpp 项目: julio/rubinius
 object_type type_id() const {
   return flags().obj_type;
 }
示例#28
0
 inline bool isCompressed(int node) const { return flags(node) & Compressed; }
示例#29
0
int main(int argc, char* argv[])
{
    if(argc < 3)
    {
        std::cout
            << "Error: no se especificaron suficientes archivos de entrada." 
            << std::endl;
        return 1;
    }
    
    std::string filename1 = argv[1];
    std::string filename2 = argv[2];
    
    FASTAReader reader1(filename1);
    FASTAReader reader2(filename2);
    
    reader1.setDefault(0);
    reader2.setDefault(1);
    
    //matriz de sustitucion
    int smatrix[]{ 5, -4, -4, -4,
                -4,  5, -4, -4,
                -4, -4,  5, -4,
                -4, -4, -4,  5};
    int gap_open   = 10;
    int gap_extend =  1;
    int match = 5;
    int mismatch = -4;
    
    #pragma omp parallel
    {
        int seq_len = DEFAULT_SEQ_LEN;
        
        //container vectors for sequences
        Buffer<int16_t> seqs1(seq_len * VSIZE, ALNSIZE);
        Buffer<int16_t> seqs2(seq_len * VSIZE, ALNSIZE);
        
        //containers for ids
        std::vector<std::string> seqs1_ids(VSIZE);
        std::vector<std::string> seqs2_ids(VSIZE);
        
        
        
        //legths of sequences
        int seqs1_len[VSIZE];
        int seqs2_len[VSIZE];
        
        //containter for flags
        Buffer<int8_t> flags(seq_len * seq_len * VSIZE, ALNSIZE);
        int16_t __attribute((aligned(ALNSIZE))) scores[VSIZE];
        int16_t __attribute((aligned(ALNSIZE))) ipos[VSIZE];
        int16_t __attribute((aligned(ALNSIZE))) jpos[VSIZE];
        
        //containers for arrays
        int16_t inf = gap_open + gap_extend + 1;
        //int16_t aF[256 * VSIZE] __attribute((aligned(ALNSIZE))) = {(int16_t)(-inf)};
        //int16_t aH[256 * VSIZE] __attribute((aligned(ALNSIZE))) = {0};

        int bsize = 128 * VSIZE;
	
        //Buffer<int16_t> E(bsize, ALNSIZE);
        Buffer<int16_t> F(bsize, ALNSIZE);
        Buffer<int16_t> H(bsize, ALNSIZE);
        //int16_t __attribute((aligned(ALNSIZE))) H[128 * VSIZE];
        
        //alignments
        char aln1[256];
        char aln2[256];
        
        //max sizes
        int max_x, max_y;
        
        //alignment start position
        int x0, y0;
        
        while(read_seqs(reader1, reader2, &seqs1, &seqs2, seqs1_len, seqs2_len, 
              &seqs1_ids, &seqs2_ids))
        {
            max_x = *std::max_element(seqs1_len, seqs1_len + VSIZE) + 1;
            max_y = *std::max_element(seqs2_len, seqs2_len + VSIZE) + 1;
            //E.clear(-inf);
            F.clear(-inf);
            H.clear(0);
            //flags.clear(0);
	    
            smith_waterman(seqs1.data(), seqs2.data(), match, mismatch, gap_open, gap_extend, 
			   flags.data(), scores, ipos, jpos, max_x, max_y, F.data(), H.data());
            
            for(int i = 0; i < VSIZE; i++)
            {
                //std::cout << scores[i] << std::endl;
                //std::cout << ipos[i] << std::endl;
                //std::cout << jpos[i] << std::endl;
                sw_backtrack(i, flags.data(), seqs1.data(), seqs2.data(), max_x, max_y,
                    aln1, aln2, ipos[i], jpos[i], x0, y0);
                //puts(aln1);
                //puts(aln2);
                print_alignment (stdout, seqs1_ids, seqs2_ids, scores, 
                    aln1, aln2, strlen(aln1), i);
            }
        }
    }
    return 0;
}
示例#30
0
 bool is_untrusted_p() {
   return flags().Untrusted == 1;
 }