code
stringlengths
3
1.18M
language
stringclasses
1 value
package org.dodgybits.shuffle.gwt.core; import com.google.gwt.core.client.GWT; import com.google.gwt.event.shared.EventBus; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.web.bindery.requestfactory.shared.Receiver; import com.google.web.bindery.requestfactory.shared.Reques...
Java
package org.dodgybits.shuffle.gwt.core; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import com.gwtplatform.mvp.client.ViewImpl; public class ErrorView extends ViewImpl implements ErrorPresenter.MyView { private final Widget w...
Java
package org.dodgybits.shuffle.gwt.core; import com.gwtplatform.mvp.client.UiHandlers; public interface EditEntityUiHandlers extends UiHandlers { void save(String description, String details); void cancel(); void previous(); void next(); }
Java
package org.dodgybits.shuffle.gwt.core; import com.google.gwt.event.shared.EventBus; import com.google.inject.Inject; import com.gwtplatform.mvp.client.Presenter; import com.gwtplatform.mvp.client.View; import com.gwtplatform.mvp.client.annotations.NameToken; import com.gwtplatform.mvp.client.annotations.ProxyC...
Java
package org.dodgybits.shuffle.gwt.cursor; import com.google.gwt.event.shared.EventBus; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.web.bindery.requestfactory.shared.EntityProxyChange; import com.google.web.bindery.requestfactory.shared.EntityProxyId; import com.google.web.bind...
Java
package org.dodgybits.shuffle.gwt.cursor; import com.google.gwt.event.shared.EventBus; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.web.bindery.requestfactory.shared.EntityProxyChange; import com.google.web.bindery.requestfactory.shared.EntityProxyId; import com.google.web.bind...
Java
package org.dodgybits.shuffle.gwt.cursor; import com.google.gwt.core.client.GWT; import com.google.gwt.event.shared.EventBus; import com.google.gwt.util.tools.shared.StringUtils; import com.google.gwt.view.client.AsyncDataProvider; import com.google.gwt.view.client.HasData; import com.google.gwt.view.client.Range; imp...
Java
package org.dodgybits.shuffle.gwt.cursor; import com.google.common.base.Function; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gwt.core.client.GWT; import com.google.in...
Java
/* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
package org.dodgybits.shuffle.server.service; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.googlecode.objectify.Key; import com.googlecode.objectify.NotFoundException; import com.googlecode.objectify.Query; import org.dodgybits.shuffle.server.model.*; import org.dodgybits.s...
Java
package org.dodgybits.shuffle.server.service; import com.google.common.collect.Lists; import org.dodgybits.shuffle.server.model.TaskQuery; import org.dodgybits.shuffle.server.model.WatchedContext; import org.dodgybits.shuffle.server.model.WatchedProject; import org.dodgybits.shuffle.server.model.WatchedTask; import j...
Java
package org.dodgybits.shuffle.server.service; import com.googlecode.objectify.Key; import com.googlecode.objectify.Query; import org.dodgybits.shuffle.server.model.*; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class ProjectService { private static final Logger ...
Java
package org.dodgybits.shuffle.server.service; import com.googlecode.objectify.ObjectifyOpts; import java.util.ConcurrentModificationException; import java.util.logging.Level; import java.util.logging.Logger; public class TransactionalObjectifyDao<T> extends ObjectifyDao<T> { private static final Logger log = Lo...
Java
package org.dodgybits.shuffle.server.service; import org.dodgybits.shuffle.server.model.*; import java.util.List; /** * Combine task, context and project services into one * client facing interface. This makes it possible to chain * multiple requests in a single call using RequestFactory. */ public class EntityS...
Java
package org.dodgybits.shuffle.server.service; import com.googlecode.objectify.Key; import com.googlecode.objectify.Query; import org.dodgybits.shuffle.server.model.AppUser; import org.dodgybits.shuffle.server.model.WatchedContext; import java.util.Arrays; import java.util.List; import java.util.logging.Level; import ...
Java
package org.dodgybits.shuffle.server.service; import com.googlecode.objectify.Key; import com.googlecode.objectify.ObjectifyOpts; import com.googlecode.objectify.ObjectifyService; import com.googlecode.objectify.Query; import com.googlecode.objectify.util.DAOBase; import org.dodgybits.shuffle.server.model.*; i...
Java
package org.dodgybits.shuffle.server.service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.dodgybits.shuffle.server.model.AppUser; import org.dodgybits.shuffle.server.servlet.AuthFilter; import com.google.appengine.api.users.UserService; import com.google.ap...
Java
package org.dodgybits.shuffle.server.service; import com.googlecode.objectify.Query; import org.dodgybits.shuffle.server.model.AppUser; import org.dodgybits.shuffle.server.model.TaskQuery; import org.dodgybits.shuffle.shared.PredefinedQuery; import java.util.List; import java.util.logging.Level; import java.util.logg...
Java
/* * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
package org.dodgybits.shuffle.server.servlet; import com.google.web.bindery.requestfactory.server.ExceptionHandler; import com.google.web.bindery.requestfactory.server.RequestFactoryServlet; import com.google.web.bindery.requestfactory.shared.ServerFailure; import java.util.logging.Level; import java.util.logging.Log...
Java
package org.dodgybits.shuffle.server.servlet; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.googlecode.objectify.Key; import org.apache.commons.fileupload.FileItemIterator; import org.apache.commons.fileupload.FileItemStream; import org.apache.commons.fileupload.FileUploadEx...
Java
/* * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
/* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
/* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
package org.dodgybits.shuffle.server.locator; public class TaskLocator extends ObjectifyLocator { }
Java
package org.dodgybits.shuffle.server.locator; import com.google.web.bindery.requestfactory.shared.Locator; import com.googlecode.objectify.util.DAOBase; import org.dodgybits.shuffle.server.model.DatastoreObject; /** * Generic @Locator for objects that extend DatastoreObject */ public class ObjectifyLocator extends ...
Java
package org.dodgybits.shuffle.server.locator; import com.google.web.bindery.requestfactory.shared.ServiceLocator; /** * Generic locator service that can be referenced in the @Service annotation * for any RequestFactory service stub */ public class DaoServiceLocator implements ServiceLocator { @Override public ...
Java
/* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
/* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Java
package org.dodgybits.shuffle.server.model; import javax.persistence.Transient; public class WatchedProject extends Project { @Transient private boolean activeChanged = false; @Transient private boolean deletedChanged = false; @Transient private boolean parallelChanged = false; @Override...
Java
package org.dodgybits.shuffle.server.model; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Indexed; import com.googlecode.objectify.annotation.NotSaved; import com.googlecode.objectify.annotation.Unindexed; import com.googlecode.object...
Java
package org.dodgybits.shuffle.server.model; import javax.persistence.Id; import javax.persistence.PrePersist; public class DatastoreObject { @Id private Long id; private Integer version = 0; /** * Auto-increment version # whenever persisted */ @PrePersist void onPersist() { this.version++; } public ...
Java
package org.dodgybits.shuffle.server.model; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Indexed; import org.dodgybits.shuffle.server.service.ObjectifyDao; public class UserDatastoreObject extends DatastoreObject { @Indexed private Key<AppUser> owner; public AppUser ge...
Java
package org.dodgybits.shuffle.server.model; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Indexed; import com.googlecode.objectify.annotation.NotSaved; import com.googlecode.objectify.condition.IfDefault; import javax.persistence.Transient; import java.util.List; import java.util.log...
Java
package org.dodgybits.shuffle.server.model; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Indexed; import com.googlecode.objectify.annotation.Unindexed; import javax.persistence.PrePersist; import java.util.Date; @Entity @Unindexed public class Context extends UserData...
Java
package org.dodgybits.shuffle.server.model; import javax.persistence.Transient; public class WatchedContext extends Context { @Transient private boolean activeChanged = false; @Transient private boolean deletedChanged = false; @Override public void setActive(boolean active) { if (act...
Java
package org.dodgybits.shuffle.server.model; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Indexed; import com.googlecode.objectify.annotation.NotSaved; im...
Java
package org.dodgybits.shuffle.server.model; import java.util.List; public class TaskQueryResult { private List<WatchedTask> mEntities; private int mTotalCount; private int mOffset; public List<WatchedTask> getEntities() { return mEntities; } public void setEntities(List<WatchedTask>...
Java
package org.dodgybits.shuffle.server.model; import com.google.appengine.api.datastore.Text; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Indexed; import ...
Java
package org.dodgybits.shuffle.server.model; import com.googlecode.objectify.annotation.Entity; /** * An application user, named with a prefix to avoid confusion with GAE User type */ @Entity public class AppUser extends DatastoreObject { private String email; public AppUser() { // No-arg constructor required ...
Java
package Spil; import java.util.Scanner; public class Spil { //Test public static void main(String[] args) { System.out.println("Velkommen til Adventure Time!"); Spiller sp1 = new Spiller(); Spiller sp2 = new Spiller(); Feltliste feltliste = new Feltliste(); Scanner scan = new Scanner(System.in); Sy...
Java
package Spil; import java.util.Scanner; public class Spiller { // Ting, som programmet skal huske om spilleren. private String navn; private int point; private Konto konto; private Terning ter1 = new Terning(); private Terning ter2 = new Terning(); //Konstruktoer er den der laver et objekt fx. e...
Java
package Spil; import static org.junit.Assert.*; import org.junit.Test; public class Test1 { Spiller spiller = new Spiller(); Feltliste feltliste = new Feltliste(); @Test public void testNegativKonto() { // Finde ud af, om naar man er gaaet i 0, at den saa ikke traekker mere fra, saa den gaar i ...
Java
package Spil; import java.util.ArrayList; public class Feltliste { private ArrayList<Felter> feltliste; public Feltliste() { feltliste = new ArrayList<Felter>(); feltliste.add(new Felter (250, "Tower", "Du slog 2: Du finder et hoejt taarn og kravler op i det, du finder 250kr. ")); feltliste...
Java
package Spil; public class Konto { private int beholdning; public Konto() { beholdning=1000; } public void plus(int beloeb) { beholdning += beloeb; } public int getBeholdning() { return beholdning; } public void nulstil() { beholdning=0; } // Test }
Java
package Spil; public class Terning { private final int MAX = 6; private int terningVaerdi; public Terning() { terningVaerdi = 1; } public int roll() { terningVaerdi = (int)(Math.random()* MAX) + 1; return terningVaerdi; } public void setTerningVaerdi (int vaerdi) { terningVaerdi = vae...
Java
/* * Copyright 2013 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2013 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/** Automatically generated file. DO NOT MODIFY */ package com.google.android.gcm; public final class BuildConfig { public final static boolean DEBUG = true; }
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
import java.util.Scanner; import server.IListener; import server.Listener; import controller.IMenuController; import controller.MenuController; import entity.Data; import entity.IData; import boundary.IMenu; import boundary.Menu; public class Main { public static void main(String[] args) { int port; if (arg...
Java
package entity; public class Data implements IData { private double weight; private double taraWeight; private String p111, rm201, rm202, rm203, display, debug1, debug2; public Data(){ p111 = ""; rm201 = ""; rm202 = ""; rm203 = ""; display = ""; debug1 = ""; debug2 = ""; } public void setDisp...
Java
package entity; public interface IData { public abstract double getWeight(); public abstract void setWeight(double weight); public abstract double getTaraWeight(); public abstract void setTaraWeight(double tara); public abstract void setDisplay(String sString); public abstract void setP111(String p111); ...
Java
package boundary; import java.util.InputMismatchException; import java.util.Scanner; import java.util.concurrent.locks.ReentrantLock; public class Menu implements IMenu { private Scanner menuScan; private String rm20; private int port; volatile private ReentrantLock lock; public Menu(Scanner menuScan, int po...
Java
package boundary; import java.util.concurrent.locks.ReentrantLock; /* * Viser tekst i en konsol - skal vise 25 linier af gangen hver kan der vises noget nyt. * Se evt. opgaveoplæg som inspiration. */ public interface IMenu { /** * Viser menuvalg på konsollen * @return Brugerens valg */ void showMenu(doub...
Java
package server; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import controller.IMenuController; import controller.IRemoteController; import controller.RemoteController; import entity.IData; public class Listener implements Runnable, IListener { private int port; private IData ...
Java
package server; /* * IListener lytter til en port og såfremt der bliver skabt en connection * startes en IRemoteController i en ny tråd så IListener kan fortsætte med at lytte * efter yderligere forbindelsesforsøg. */ public interface IListener{ }
Java
package controller; /* * Klassen skal fungere som controller og bestemme hvad der skal opdateres på vægten * når en forbindelse til vægten er oprettet. */ public interface IRemoteController { String writeInDisplay(String clientData); String getBrutto(); String taraWeigth(); String resetDisplay(); String ...
Java
package controller; import boundary.IMenu; import entity.IData; public class MenuController implements Runnable, IMenuController { private IMenu menu; private IData data; private boolean dState; public MenuController(IMenu menu, IData data) { this.menu = menu; this.data = data; dState = false; } /* (no...
Java
package controller; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import entity.IData; public class RemoteController implements Runnable, IRemoteController { private IData data; private Socket clientSocket; private...
Java
package controller; /* * Klassen skal kontrollere hvad der vises på vægtens forskellige display vha. boundary IMenu. * Klassen skal håndtere at der kan vælges forskellige punkter i menuen, f.eks. at sætte vægt en bruttovægt */ public interface IMenuController { String showRM20(); void resetRM20(); void re...
Java
package test; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import entity.Data; import entity.IData; public class UnittestData { IData data; @Before public void setUp() throws Exception { data = new Data(); } @Test public void testGetWeight() { assertEqua...
Java
package spil; public class Dice { private int d1; private int d2; public Dice() { d1 = 0; d2 = 0; } public int getd1() { return d1; } public int getd2() { return d2; } public void setDice(int d1, int d2) { this.d1 = d1; this.d2 = d2; } public void roll() { d1 = (int)(Math.random()*6)...
Java
package spil; import boundaryToMatador.GUI; import java.util.*; public class Game { static Dice d1 = new Dice(); static Scanner in = new Scanner(System.in); public static void main(String[] args) { Player p1 = new Player(1); Player p2 = new Player(2); do { playerTurn(p1); if(p1.hasWon()) break; ...
Java
package spil; public class Konto { private int balance; public Konto() { balance = 1000; } public void setBalance(int balance) { this.balance = balance; if(this.balance < 0) this.balance = 0; } public int getBalance() { return balance; } public void insert(int penge) { balance += penge; }...
Java
package spil; public class Player { private int felt; private int number; private boolean winner; private boolean extraTurn; public Konto konto; public Player(int number) { felt = 0; //starter på felt 1 this.number = number; winner = false; extraTurn = false; konto = new Konto(); } public void ...
Java
// Copyright 2007 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); You may not // use this file except in compliance with the License. You may obtain a copy of // the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by // applicable law or agree...
Java
// Copyright 2007 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); You may not // use this file except in compliance with the License. You may obtain a copy of // the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by // applicable law or agre...
Java
// Copyright 2007 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); You may not // use this file except in compliance with the License. You may obtain a copy of // the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by // applicable law or agree...
Java