<commit_before>package views;

import java.util.ArrayList;
import java.util.Stack;

import utlils.Console;
import controllers.GroupController;
import models.Group;
import models.MainUser;

public class MyGroupView implements View{
	
	private boolean done;
	private ArrayList<Group> grupper;

	public MyGroupView(){
		grupper = GroupController.getAllGroups(MainUser.getInstance());
		this.done = false;
	}
	
	@Override
	public boolean isDone() {
		return done;
	}

	@Override
	public void setUnDone() {
		this.done = false;
		
	}

	@Override
	public String getTitle() {
		return "Dine grupper";
	}

	@Override
	public ArrayList<String> getContent() {
		ArrayList<String> content = new ArrayList<String>();
		int i = 1;
		content.add(" ID  | NAVN");
		content.add("-----+---------------------");
		for (Group gruppe : grupper) {
			String id = Console.matchLength(i++ + "" , 3);
			content.add(" " + id + " | " + gruppe.getName());
		}
		return content;
		
	}

	@Override
	public String getQuery() {
		return "Press 0 for å gå tilbake, eller velg gruppe";
	}

	@Override
	public void giveInput(String input, Stack<View> viewStack) {
		if(input.equals("0")){
			this.done = true;
			return;
		}
		try {
			int id = Integer.parseInt(input);
			if (id > 0 && id <= grupper.size()) {<commit_msg>En liten todo.<commit_after>package views;

import java.util.ArrayList;
import java.util.Stack;

import utlils.Console;
import controllers.GroupController;
import models.Group;
import models.MainUser;

public class MyGroupView implements View{
	
	private boolean done;
	private ArrayList<Group> grupper;

	public MyGroupView(){
		grupper = GroupController.getAllGroups(MainUser.getInstance());
		this.done = false;
	}
	
	@Override
	public boolean isDone() {
		return done;
	}

	@Override
	public void setUnDone() {
		this.done = false;
		
	}

	@Override
	public String getTitle() {
		return "Dine grupper";
	}

	@Override
	public ArrayList<String> getContent() {
		ArrayList<String> content = new ArrayList<String>();
		int i = 1;
		content.add(" ID  | NAVN");
		content.add("-----+---------------------");
		for (Group gruppe : grupper) {
			String id = Console.matchLength(i++ + "" , 3);
			content.add(" " + id + " | " + gruppe.getName());
		}
		content.add("");
		content.add("TODO: Lag ny gruppe");
		return content;
		
	}

	@Override
	public String getQuery() {
		return "Press 0 for å gå tilbake, eller velg gruppe";
	}

	@Override
	public void giveInput(String input, Stack<View> viewStack) {
		if(input.equals("0")){
			this.done = true;
			return;
		}
		try {
			int id = Integer.parseInt(input);
			if (id > 0 && id <= grupper.size()) {
{'fraction_non_alphanumeric': 0.15326251896813353, 'fraction_numerical': 0.0037936267071320183, 'mean_word_length': 3.4468802698145025, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3798831', 'n_tokens_mistral': 966, 'n_tokens_neox': 860, 'n_words': 231}