<commit_before>part of kan_colle_wrapper.models;

class Fleet extends Observable implements IIdentifiable {
  final Homeport _homeport;
  bool _isInSortie;
  StreamSubscription _subscription;
  @observable int id;

  @observable String name;

  @observable List<Ship> ships;

  @observable double averageLevel;

  @observable int totalLevel;

  @observable int airSuperiorityPotential;

  @observable int totalViewRange;

  @observable int speed;

  @observable FleetState state;

  FleetCondition condition;

  Expedition expedition;

  @observable bool isReady;

  @observable bool isWounded;

  @observable bool isInShortSupply;

  @observable bool isRepairling;

  Fleet(Homeport this._homeport, rawData) {
    ships = [];

    condition = new FleetCondition(this);
    expedition = new Expedition(this);
    update(rawData);
    _subscription = KanColleClient.current.settings.changes.listen((records) {
      records.forEach((record) {
        if (record is PropertyChangeRecord &&
            record.name == #viewRangeCalcLogic) {
          calculate();
        }
      });
    });
  }

  void update(rawData) {
    id = rawData["api_id"];
    name = rawData["api_name"];

    expedition.update(rawData["api_mission"]);
    updateShips(
        rawData["api_ship"].map((id) => _homeport.organization.ships[id]).toList());
  }<commit_msg>Listen to property changes using onPropertyChange<commit_after>part of kan_colle_wrapper.models;

class Fleet extends Observable implements IIdentifiable {
  final Homeport _homeport;
  bool _isInSortie;
  StreamSubscription _subscription;
  @observable int id;

  @observable String name;

  @observable List<Ship> ships;

  @observable double averageLevel;

  @observable int totalLevel;

  @observable int airSuperiorityPotential;

  @observable int totalViewRange;

  @observable int speed;

  @observable FleetState state;

  FleetCondition condition;

  Expedition expedition;

  @observable bool isReady;

  @observable bool isWounded;

  @observable bool isInShortSupply;

  @observable bool isRepairling;

  Fleet(Homeport this._homeport, rawData) {
    ships = [];

    condition = new FleetCondition(this);
    expedition = new Expedition(this);
    update(rawData);
    _subscription = onPropertyChange(
        KanColleClient.current.settings,
        #viewRangeCalcLogic,
        calculate);
  }

  void update(rawData) {
    id = rawData["api_id"];
    name = rawData["api_name"];

    expedition.update(rawData["api_mission"]);
    updateShips(
        rawData["api_ship"].map((id) => _homeport.organization.ships[id]).toList());
  }
{'fraction_non_alphanumeric': 0.09718472811415349, 'fraction_numerical': 0.0, 'mean_word_length': 3.9222011385199242, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1971936', 'n_tokens_mistral': 806, 'n_tokens_neox': 786, 'n_words': 180}