public static TrackableCollection<StackItemView> getCollection( Iterable<SpellAbilityStackInstance> instances) { if (instances == null) { return null; } TrackableCollection<StackItemView> collection = new TrackableCollection<StackItemView>(); for (SpellAbilityStackInstance si : instances) { collection.add(si.getView()); } return collection; }
public StackItemView(SpellAbilityStackInstance si) { super(si.getId()); updateKey(si); updateSourceTrigger(si); updateText(si); updateSourceCard(si); updateActivatingPlayer(si); updateTargetCards(si); updateTargetPlayers(si); updateAbility(si); updateOptionalTrigger(si); updateSubInstance(si); }
void updateTargetPlayers(SpellAbilityStackInstance si) { set( TrackableProperty.TargetPlayers, PlayerView.getCollection(si.getTargetChoices().getTargetPlayers())); }
void updateActivatingPlayer(SpellAbilityStackInstance si) { set(TrackableProperty.ActivatingPlayer, PlayerView.get(si.getActivatingPlayer())); }
void updateSourceCard(SpellAbilityStackInstance si) { set(TrackableProperty.SourceCard, CardView.get(si.getSourceCard())); }
void updateText(SpellAbilityStackInstance si) { set(TrackableProperty.Text, si.getStackDescription()); }
void updateSourceTrigger(SpellAbilityStackInstance si) { set(TrackableProperty.SourceTrigger, si.getSpellAbility(false).getSourceTrigger()); }
void updateKey(SpellAbilityStackInstance si) { set(TrackableProperty.Key, si.getSpellAbility(false).toUnsuppressedString()); }
void updateSubInstance(SpellAbilityStackInstance si) { set( TrackableProperty.SubInstance, si.getSubInstance() == null ? null : new StackItemView(si.getSubInstance())); }
void updateOptionalTrigger(SpellAbilityStackInstance si) { set(TrackableProperty.OptionalTrigger, si.isOptionalTrigger()); }
void updateAbility(SpellAbilityStackInstance si) { set(TrackableProperty.Ability, si.isAbility()); }
public static StackItemView get(SpellAbilityStackInstance si) { return si == null ? null : si.getView(); }