Exemplo n.º 1
0
	size_t getViolationChild(size_t ind) const
	{
		size_t violationIndex = ind;
		size_t leftChildIndex = leftChild(ind);
		size_t rightChildIndex = rightChild(ind);

		if (leftChildIndex < m_size && m_predicate(m_d[leftChildIndex], m_d[ind])) 
			violationIndex = leftChildIndex;
		if (rightChildIndex < m_size && m_predicate(m_d[rightChildIndex], m_d[violationIndex]))
			violationIndex = rightChildIndex;

		return violationIndex;
	}
Exemplo n.º 2
0
 reference_type dereference_impl() {
     if(! m_full) {
         while(! m_predicate(* this->base_reference()))
             ++(this->base_reference());
         m_full = true;
     }
     return * this->base_reference();
 }
Exemplo n.º 3
0
 reference_type dereference_impl(){
     if(! m_end){
         while(! m_predicate(* this->base_reference()))
             ++ this->base_reference();
         m_end = true;
     }
     return * this->base_reference();
 }
Exemplo n.º 4
0
  bool operator()(drape_ptr<RenderGroup> && group) const
  {
    if (m_predicate(group))
    {
      group->Disappear();
      group->DeleteLater();
      m_deletionMark = true;
      return group->CanBeDeleted();
    }

    return false;
  }
Exemplo n.º 5
0
	void discover_vertex( Vertex u, const Graph& /*g*/ ) /*const*/
	{
		vgd::Shp< vgd::node::Node > node = getNode(u);

		if ( m_predicate( node ) )
		{
			m_trueNodes->push_back( node );
		}
		else
		{
			m_falseNodes->push_back( node );
		}
	}
Exemplo n.º 6
0
    /**
     * Writes writes a UTF-16 code unit that isn't
     * part of the surrogate pair
     */
    void
    write(XalanDOMChar    theChar)
    {
        assert(
            isUTF16HighSurrogate(theChar) == false &&
            isUTF16LowSurrogate(theChar) == false);

        if (m_bufferRemaining == 0)
        {
            flushBuffer();
        }

        if(m_predicate(theChar))
        {
            *m_bufferPosition = theChar;

            ++m_bufferPosition;
            --m_bufferRemaining;
        }
        else
        {
            writeNumericCharacterReference(theChar);
        }
    }
Exemplo n.º 7
0
    /**
     * Writes CDATA chars , if not presentable, fixes it
     * with addition CDATA sections
     */
    size_type
    writeCDATAChar(
        const XalanDOMChar  chars[],
        size_type           start,
        size_type           length,
        bool&               outsideCDATA)
    {
        assert(chars != 0 && length > 0 && start < length);

        const XalanDOMChar  theChar = chars[start];

        XalanUnicodeChar    value = theChar;

        size_type   result = start;

        if (isUTF16HighSurrogate(theChar) == true)
        {
            if (start + 1 >= length)
            {
                throwInvalidUTF16SurrogateException(
                    theChar,
                    0,
                    getMemoryManager());
            }
            else
            {
                value = decodeUTF16SurrogatePair(theChar, chars[start+1],  getMemoryManager());

                ++result;
            }
        }

        if(m_predicate(value))
        {
            if (outsideCDATA == false)
            {
                // We have a representable char in the normal state,
                // so just print it.
                write(value);
            }
            else
            {
                // The previous character was a not representable.
                // Open the CDATA section again, print the character,
                // then change the flag.
                write(
                    m_constants.s_cdataOpenString,
                    m_constants.s_cdataOpenStringLength);

                write(value);

                outsideCDATA = false;
            }
        }
        else
        {
            if(outsideCDATA == false)
            {
                // we have a non-representable char in the normal state -
                // close the CDATA section and print the value
                write(
                    m_constants.s_cdataCloseString,
                    m_constants.s_cdataCloseStringLength);

                writeNumericCharacterReference(value);

                outsideCDATA = true;
            }
            else
            {
                writeNumericCharacterReference(value);
            }
        }

        return result;
    }