Sha256: 4b65e1f9d93e58aad7d80858bc95783bbb7b3a0b56ac18fe6bda693a7b4692f9

Contents?: true

Size: 1.8 KB

Versions: 28

Compression:

Stored size: 1.8 KB

Contents

package com.rho.sync;

import org.json.me.RhoJSONException;
import org.json.me.RhoJSONObject;
import java.util.Enumeration;
class JSONStructIterator
{
	RhoJSONObject m_object;
	Enumeration m_enumKeys;
	String m_strCurKey;
	
    JSONStructIterator(String szData)throws RhoJSONException
    {
    	m_object = new RhoJSONObject(szData);
    	m_enumKeys = m_object.keys();
    	if ( m_enumKeys != null && m_enumKeys.hasMoreElements() )
    		m_strCurKey = (String)m_enumKeys.nextElement();
    }

    JSONStructIterator(JSONEntry oEntry, String strName)throws RhoJSONException
    {
    	m_object = (RhoJSONObject)oEntry.m_object.get(strName);
    	m_enumKeys = m_object.keys();
    	if ( m_enumKeys != null && m_enumKeys.hasMoreElements() )
    		m_strCurKey = (String)m_enumKeys.nextElement();
    }

    JSONStructIterator(JSONEntry oEntry)
    {
    	m_object = oEntry.m_object;
    	m_enumKeys = m_object.keys();
    	if ( m_enumKeys != null && m_enumKeys.hasMoreElements() )
    		m_strCurKey = (String)m_enumKeys.nextElement();
    }

    boolean isEnd()
    {
        return m_strCurKey == null;
    }

    void  next()
    {
    	if ( m_enumKeys != null && m_enumKeys.hasMoreElements() )
    		m_strCurKey = (String)m_enumKeys.nextElement();
    	else
    		m_strCurKey = null;
    }

    void reset()
    {
    	m_enumKeys = m_object.keys();
    	if ( !isEnd() )
    		m_strCurKey = (String)m_enumKeys.nextElement();
    }

    String getCurKey()
    {
        return isEnd() ? new String() : m_strCurKey;
    }

	String getCurString()throws RhoJSONException
	{
		return m_object.getString(m_strCurKey);
	}
    
    JSONEntry getCurValue()throws RhoJSONException
    {
    	if ( isEnd() )
    		return new JSONEntry( (RhoJSONObject)null );
    	
		return new JSONEntry( (RhoJSONObject)m_object.getJSONObject(m_strCurKey) );
    }

}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rhodes-2.3.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.2.beta.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.2.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.1.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.0 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.0.beta.3 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.0.beta.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.3.0.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.6 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.6.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.5 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.5.beta.3 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.5.beta.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.5.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.4.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.3 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.3.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.2.2.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java