Class ComplexPofValue

  • All Implemented Interfaces:
    PofValue
    Direct Known Subclasses:
    PofArray, PofSparseArray

    public abstract class ComplexPofValue
    extends AbstractPofValue
    An abstract base class for complex POF types, such as collections, arrays, maps, and user types.
    Since:
    Coherence 3.5
    Author:
    as 2009.02.12
    • Constructor Detail

      • ComplexPofValue

        public ComplexPofValue​(PofValue valueParent,
                               ReadBuffer bufValue,
                               PofContext ctx,
                               int of,
                               int nType,
                               int ofChildren)
        Construct a PofValue instance wrapping the supplied buffer.
        Parameters:
        valueParent - parent value within the POF stream
        bufValue - buffer containing POF representation of this value
        ctx - POF context to use when reading or writing properties
        of - offset of this value from the beginning of POF stream
        nType - POF type identifier for this value
        ofChildren - offset of the first child element within this value
    • Method Detail

      • getChild

        public PofValue getChild​(int nIndex)
        Locate a child PofValue contained within this PofValue.

        Note: the returned PofValue could represent a non-existent (null) value.

        Parameters:
        nIndex - index of the child value
        Returns:
        the child PofValue
      • getChildrenIterator

        public Iterator getChildrenIterator()
        Return an iterator over all parsed child values.
        Returns:
        a children iterator
      • getUniformElementType

        protected int getUniformElementType()
        Return the uniform element type (if this is a uniform collection).
        Returns:
        uniform element type, or PofConstants.T_UNKNOWN if this is not a uniform collection
      • setUniformElementType

        protected void setUniformElementType​(int nElementType)
        Set the uniform element type for this collection.
        Parameters:
        nElementType - uniform element type
      • findChild

        protected PofValue findChild​(int nIndex)
        Find the child value with the specified index.
        Parameters:
        nIndex - index of the child value to find
        Returns:
        the child value
      • getLastChildIndex

        protected int getLastChildIndex​(int nIndex)
        Return index of the last parsed child with an index lower than the specified one.
        Parameters:
        nIndex - index to find the preceding child index for
        Returns:
        index of the last parsed child, or -1 if one does not exist
      • isUniformCollection

        protected boolean isUniformCollection()
        Return true if this complex value is encoded as one of uniform collection types.
        Returns:
        true if this is a uniform collection
      • extractChild

        protected PofValue extractChild​(ReadBuffer buf,
                                        int of,
                                        int cb)
        Extract child PofValue from a buffer.
        Parameters:
        buf - parent buffer to extract the child from
        of - offset of the child within the parent buffer
        cb - length of the child in bytes
        Returns:
        extracted PofValue
      • findChildInternal

        protected abstract PofValue findChildInternal​(int nIndex,
                                                      int ofStart,
                                                      int iStart)
        Find the child value with the specified index.
        Parameters:
        nIndex - index of the child value to find
        ofStart - offset within the parent buffer to start search from
        iStart - index of the child value to start search from
        Returns:
        the child value