Sha256: 59f8e046c34a4f00bd5ddcbad47ea334bbb5950a6fd80d0d05ef9ebf9f85fd21

Contents?: true

Size: 1.84 KB

Versions: 23

Compression:

Stored size: 1.84 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 ( m_enumKeys != null && m_enumKeys.hasMoreElements() )
    		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

23 entries across 23 versions & 1 rubygems

Version Path
rhodes-3.0.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.2.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.8 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.7 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.6 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.5 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.4 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.3 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.1.beta.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.7 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.6 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.5 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.4 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.3 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.2 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-3.0.0.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.4.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
rhodes-2.4.1.beta.1 platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java