mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
Use android.util.Pair
Use the Android builtin Pair class instead of a DroidFish specific class that does the same thing.
This commit is contained in:
parent
6c4ff122ac
commit
2a01797dfa
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.petero.droidfish.PGNOptions;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -45,7 +47,7 @@ public class PGNFileTest extends TestCase {
|
|||
};
|
||||
writeFile(f, lines);
|
||||
PGNFile pgnFile = new PGNFile(f.getAbsolutePath());
|
||||
Pair<GameInfoResult,ArrayList<GameInfo>> res = pgnFile.getGameInfo(null, null);
|
||||
Pair<GameInfoResult,ArrayList<GameInfo>> res = pgnFile.getGameInfo(null, null);
|
||||
assertEquals(GameInfoResult.OK, res.first);
|
||||
ArrayList<GameInfo> gi = res.second;
|
||||
assertEquals(1, gi.size());
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import org.petero.droidfish.Speech;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
|||
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.MoveGen;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Piece;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
@ -32,6 +31,7 @@ import android.content.Context;
|
|||
import android.content.res.Configuration;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Pair;
|
||||
import android.widget.Toast;
|
||||
|
||||
/** Chess board widget suitable for play mode. */
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.petero.droidfish.engine.UCIOptions;
|
|||
import org.petero.droidfish.gamelogic.DroidChessController;
|
||||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Piece;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
@ -135,6 +134,7 @@ import android.text.style.BackgroundColorSpan;
|
|||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.LeadingMarginSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Pair;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewConfiguration;
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.petero.droidfish.Util;
|
|||
import org.petero.droidfish.Util.MaterialDiff;
|
||||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Piece;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
@ -58,6 +57,7 @@ import android.preference.PreferenceManager;
|
|||
import androidx.core.view.MotionEventCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.os.Bundle;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Pair;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -50,7 +51,6 @@ import org.petero.droidfish.Util;
|
|||
import org.petero.droidfish.activities.PGNFile.GameInfo;
|
||||
import org.petero.droidfish.activities.PGNFile.GameInfoResult;
|
||||
import org.petero.droidfish.databinding.SelectGameBinding;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -22,10 +22,9 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.util.Pair;
|
||||
|
||||
public class FENFile {
|
||||
private final File fileName;
|
||||
|
|
|
@ -32,10 +32,10 @@ import android.content.SharedPreferences.Editor;
|
|||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -50,7 +50,6 @@ import org.petero.droidfish.activities.FENFile.FenInfo;
|
|||
import org.petero.droidfish.activities.FENFile.FenInfoResult;
|
||||
import org.petero.droidfish.databinding.LoadFenBinding;
|
||||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
||||
|
|
|
@ -29,11 +29,10 @@ import java.util.ArrayList;
|
|||
|
||||
import org.petero.droidfish.DroidFishApp;
|
||||
import org.petero.droidfish.R;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.util.Pair;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class PGNFile {
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
package org.petero.droidfish.book;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.util.Pair;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -31,7 +32,6 @@ import org.petero.droidfish.gamelogic.Move;
|
|||
import org.petero.droidfish.gamelogic.MoveGen;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
|
||||
/** Implements an opening book. */
|
||||
public final class DroidBook {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.petero.droidfish.book;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.style.TabStopSpan;
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -32,7 +32,6 @@ import org.petero.droidfish.DroidFishApp;
|
|||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.GameTree;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
import org.petero.droidfish.gamelogic.UndoInfo;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.engine;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
@ -28,7 +30,6 @@ import org.petero.droidfish.book.BookOptions;
|
|||
import org.petero.droidfish.book.DroidBook;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.MoveGen;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.SearchListener;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
DroidFish - An Android chess program.
|
||||
Copyright (C) 2011 Peter Österlund, peterosterlund2@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
/** A helper class that makes it possible to return two values from a function. */
|
||||
public final class Pair<T1, T2> {
|
||||
public final T1 first;
|
||||
public final T2 second;
|
||||
|
||||
public Pair(T1 first, T2 second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
}
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.petero.droidfish.gamelogic;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
|
||||
package org.petero.droidfish.tb;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.MoveGen;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Piece;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
|
Loading…
Reference in New Issue
Block a user