From a281bb25a79d0eda562a12d2f5bf3eb89ff1b131 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 13 May 2022 17:02:16 -0700 Subject: [PATCH] cleanup: remove dead code and add asserts --- .../java/org/eehouse/android/xw4/GamesListDelegate.java | 4 ---- .../java/org/eehouse/android/xw4/XWExpListAdapter.java | 7 ++----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 3c461b83c..93f1bfdc4 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -435,16 +435,12 @@ public class GamesListDelegate extends ListDelegateBase private void removeChildrenOf( long groupID ) { int indx = findGroupItem( makeGroupTestFor( groupID ) ); - GroupRec rec = (GroupRec)getObjectAt( indx ); - // rec.m_ggi.m_expanded = false; removeChildrenOf( indx ); } private void addChildrenOf( long groupID ) { int indx = findGroupItem( makeGroupTestFor( groupID ) ); - GroupRec rec = (GroupRec)getObjectAt( indx ); - // rec.m_ggi.m_expanded = false; addChildrenOf( indx, makeChildren( groupID ) ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java index c4e92bd90..637709210 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java @@ -98,11 +98,6 @@ abstract class XWExpListAdapter extends XWListAdapter { return m_nGroups; } - protected Object getObjectAt( int indx ) - { - return m_listObjs[indx]; - } - protected int findGroupItem( GroupTest test ) { int result = -1; @@ -135,6 +130,7 @@ abstract class XWExpListAdapter extends XWListAdapter { protected void removeChildrenOf( int groupIndex ) { + Assert.assertTrueNR( 0 <= groupIndex ); Assert.assertTrue( m_groupClass == m_listObjs[groupIndex].getClass() ); int end = findGroupEnd( groupIndex ); int nChildren = end - groupIndex - 1; // 1: don't remove parent @@ -151,6 +147,7 @@ abstract class XWExpListAdapter extends XWListAdapter { protected void addChildrenOf( int groupIndex, List children ) { + Assert.assertTrueNR( 0 <= groupIndex ); int nToAdd = children.size(); Object[] newArray = new Object[m_listObjs.length + nToAdd]; System.arraycopy( m_listObjs, 0, newArray, 0, groupIndex + 1 ); // up to and including parent