I think [EMAIL PROTECTED] wrote:
> Hi,
> 
> I wonder why jess.ValueVector has a add() method but not a remove() method?
> I have a case where I want to use ValueVector in Java-code where I want to add 
> entries and remove them again but the missing remove() is hindering me there :-)
> Is it a good guess, that just nobody needed it till now or what is
> the reason?

Just that nobody has needed it until now.


> Would it be possible to implement that in the next release of Jess?
> (BTW, I'm using the latest final Jess 6.0)
> 

Here's a version you can use right now:


    /**
     * Remove the item at index i from the ValueVector; move all the
     * higher-numbered elements down.  
     */
    public final ValueVector remove(int i) throws JessException {
        if (i < 0 || i >= m_ptr)
            throw new JessException("ValueVector.set",
                                    "Bad index " + i +
                                    " in call to remove() on this vector:",
                                    toStringWithParens());
        if (i < (m_ptr - 1))
            System.arraycopy(m_v, i+1, m_v, i, m_ptr-i);
        m_v[--m_ptr] = null;
        return this;
    }



> 
> Regards, Peter



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to