2013-04-12 19:32:25 -07:00
|
|
|
package magic.model;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2015-11-09 21:59:32 -08:00
|
|
|
import java.util.Arrays;
|
2020-01-15 12:02:42 -08:00
|
|
|
import java.util.List;
|
2013-04-12 19:32:25 -07:00
|
|
|
|
2015-12-02 02:19:01 -08:00
|
|
|
@SuppressWarnings("serial")
|
2013-04-12 19:32:25 -07:00
|
|
|
public class MagicPermanentList extends ArrayList<MagicPermanent> implements MagicCopyable {
|
|
|
|
|
|
|
|
public MagicPermanentList() {}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2015-11-09 21:59:32 -08:00
|
|
|
public MagicPermanentList(final MagicPermanent... permanents) {
|
|
|
|
addAll(Arrays.asList(permanents));
|
|
|
|
}
|
|
|
|
|
2014-04-19 05:25:28 -07:00
|
|
|
public MagicPermanentList(final List<MagicPermanent> list) {
|
2013-04-12 19:32:25 -07:00
|
|
|
addAll(list);
|
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
MagicPermanentList(final MagicCopyMap copyMap,final MagicPermanentList list) {
|
|
|
|
for (final MagicPermanent permanent : list) {
|
|
|
|
add(copyMap.copy(permanent));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public MagicPermanentList copy(final MagicCopyMap copyMap) {
|
|
|
|
return new MagicPermanentList(copyMap, this);
|
|
|
|
}
|
2015-12-31 02:54:52 -08:00
|
|
|
|
2014-04-19 05:43:37 -07:00
|
|
|
public long getStateId() {
|
2014-04-19 05:25:28 -07:00
|
|
|
final long[] keys = new long[size()];
|
|
|
|
int idx = 0;
|
|
|
|
for (final MagicPermanent permanent : this) {
|
|
|
|
keys[idx] = permanent.getStateId();
|
|
|
|
idx++;
|
|
|
|
}
|
2017-01-28 07:08:10 -08:00
|
|
|
return MurmurHash3.hash(keys);
|
2014-04-19 05:25:28 -07:00
|
|
|
}
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|