aboutsummaryrefslogtreecommitdiff
path: root/src/main/model/BrowserState.java
blob: 7b05f8c38e5b43a96f9bb38d2c2755f30c6ecb66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package model;

import java.util.ArrayDeque;

// This BrowserState class collects the stateful portions of the browser into one modelable class.
public class BrowserState {
    private ArrayDeque<String> tabs;
    private String currentTab;

    public BrowserState(ArrayDeque<String> tabs, String currentTab) {
        this.tabs = tabs;
        this.currentTab = currentTab;
    }

    public ArrayDeque<String> getTabs() {
        return this.tabs;
    }

    public String getCurrentTab() {
        return this.currentTab;
    }

    public void setCurrentTab(String tab) {
        this.currentTab = tab;
    }

    public void addTab(String added) {
        if (!this.tabs.contains(added)) {
            this.tabs.add(added);
        }
    }

    public void removeTab(String removed) {
        this.tabs.remove(removed);
    }
}