text stringlengths 3 1.18M |
|---|
/**
* Provides expandable Tree View implementation.
*/
package pl.polidea.treeview; |
package pl.polidea.treeview;
import android.app.Activity;
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.v... |
package pl.polidea.treeview;
/**
* Exception thrown when there is a problem with configuring tree.
*
*/
public class TreeConfigurationException extends RuntimeException {
private static final long serialVersionUID = 1L;
public TreeConfigurationException(final String detailMessage) {
super(detailM... |
package pl.polidea.treeview;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
/**
* Node. It is package protected so that it cannot be used outside.
*
* @param <T>
* type of the identifier used by the tree
*/
class InMemoryTreeNode<T> implements Serializable {
priv... |
package pl.polidea.treeview;
import java.io.Serializable;
import java.util.List;
import android.database.DataSetObserver;
/**
* Manages information about state of the tree. It only keeps information about
* tree elements, not the elements themselves.
*
* @param <T>
* type of the identifier for nodes... |
package pl.polidea.treeview;
/**
* This exception is thrown when the tree does not contain node requested.
*
*/
public class NodeNotInTreeException extends RuntimeException {
private static final long serialVersionUID = 1L;
public NodeNotInTreeException(final String id) {
super("The tree does not... |
package pl.polidea.treeview;
/**
* Information about the node.
*
* @param <T>
* type of the id for the tree
*/
public class TreeNodeInfo<T> {
private final T id;
private final int level;
private final boolean withChildren;
private final boolean visible;
private final boolean expand... |
/**
* Provides just demo of the TreeView widget.
*/
package pl.polidea.treeview.demo; |
package pl.polidea.treeview.demo;
import java.util.Arrays;
import java.util.Set;
import pl.polidea.treeview.AbstractTreeViewAdapter;
import pl.polidea.treeview.R;
import pl.polidea.treeview.TreeNodeInfo;
import pl.polidea.treeview.TreeStateManager;
import android.view.View;
import android.view.ViewGroup;
import andro... |
package pl.polidea.treeview.demo;
import java.util.Set;
import pl.polidea.treeview.R;
import pl.polidea.treeview.TreeNodeInfo;
import pl.polidea.treeview.TreeStateManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.View... |
package pl.polidea.treeview.demo;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import pl.polidea.treeview.InMemoryTreeStateManager;
import pl.polidea.treeview.R;
import pl.polidea.treeview.TreeBuilder;
import pl.polidea.treeview.TreeNodeInfo;
import pl.polidea.treeview.TreeStateManager... |
package buggy;
public class C2 extends C0{
C2(int x, int y)
{
this.x = x;
this.y = y;
}
@Override
public int compute() {
return x-y;
}
}
|
package buggy;
public class C1 extends C0{
C1(int x, int y)
{
this.x = x;
this.y = y;
}
@Override
public int compute() {
return x+y;
}
}
|
package buggy;
public class C0 {
int x = 0;
int y = 0;
int compute()
{
return 0;
}
}
|
package buggy;
import java.io.*;
import java.util.*;
public class Main {
public static void main (String[] args) throws java.io.IOException {
int num1 = readInteger();
System.out.println ("\nYou entered the integer: " + num1);
int num2 = rev_num(num1);
int result = product(num1,num2);
... |
/**
* @author Chris Ray
* Created on 8:40:28 PM Nov 27, 2011
*
*/
/**
* @author Chris Ray Created on 8:40:28 PM Nov 27, 2011
*/
public class GlobalState {// /commit test Chris
}
|
package gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.J... |
package gui;
public enum Views {
TITLE,MAP,HOST,JOIN,BATTLE,PREVIOUS
}
|
package gui;
import javax.swing.JPanel;
/**
* A KeyEventedPanel is a JPanel that can be placed inside of any JFrame or
* other JPanel. It also implements the KeyListener interface so that keyboard
* input can be used to the control the model and all keyboard input goes
* through the MasterView. It a... |
package gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.... |
package gui;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;... |
package server;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public clas... |
package server;
public interface Serverbase {
// make creates a server and starts its processes (listening and adding
// players to the chat).
public void make(int port);
// start game should create the game with the specified number of players
// starting with clients and filling the rest with AI.
p... |
package server;
/**
* The Epic Chat client class.
* @author Nik Stemm
*/
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Observable;
import javax.swing.JOptionPane;
public class RiskiCli... |
package server;
import javax.swing.JOptionPane;
public class EpicChat {
public static void main(String[] args) {
RiskiClient client = new RiskiClient(JOptionPane.showInputDialog("Please enter your name."), JOptionPane
.showInputDialog("Please enter the ip address you'd like to connect to."), Integer.p... |
package server;
public interface ClientBase {
}
|
package server;
/**
* The Epic Chat server class.
* @author Nik Stemm
*/
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.concurrent.LinkedBl... |
/**
* @author Chris Ray
* Created on 8:15:11 PM Nov 26, 2011
*
*/
package baseModel;
import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Observable;
import java.util.Obser... |
/**
* @author Chris Ray
* Created on 6:11:09 PM Nov 25, 2011
*
*/
package baseModel;
/**
* @author Chris Ray Created on 6:11:09 PM Nov 25, 2011 <br />
* This enum defines what type of Territory Card a card is.
*/
public enum CardType {
/**
* @author Chris Ray Created on 6:11:34 PM Nov 25... |
/**
* @author Chris Ray
* Created on 8:20:02 PM Nov 26, 2011
*
*/
package baseModel;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Observable;
/**
* @author Chris Ray Created on 8:20:02 PM Nov 26, 2011
*/
public abstract class CommandInterface extends Observable {
/... |
/**
* @author Chris Ray
* Created on 11:41:14 AM Dec 4, 2011
*
*/
package baseModel;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;
/**
* @author Chris Ray Created on 11:41:14 AM Dec 4, 2011
*/
public class PlayerAI extends Player im... |
/**
* @author Chris Ray
* Created on 2:10:44 AM Nov 27, 2011
*
*/
package baseModel;
import java.util.ArrayList;
/**
* @author Chris Ray Created on 2:10:44 AM Nov 27, 2011
*/
public class Territory {
private ArrayList<Territory> neighbors;
private final String name;
private final String pare... |
/**
* @author Chris Ray
* Created on 6:02:03 PM Nov 25, 2011
*
*/
package baseModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Observable;
/**
* @author Chris Ray Created on 6:02:03 PM Nov 25, 2011
*/
public class Player extends Observable {
private int numberOfUni... |
/**
* @author Chris Ray
* Created on 9:01:50 PM Nov 29, 2011
*
*/
package baseModel;
import java.io.Serializable;
/**
* @author Chris Ray Created on 9:01:50 PM Nov 29, 2011 <br />
*
* Contains all the parameters if a move is made
*/
public class Move implements Serializable {
/**
*... |
/**
* @author Chris Ray
* Created on 2:13:57 AM Nov 27, 2011
*
*/
package baseModel;
import java.util.ArrayList;
import java.util.HashMap;
/**
* @author Chris Ray Created on 2:13:57 AM Nov 27, 2011
*/
public class Continent {
private final String name;
private final ArrayList<Territory> childre... |
/**
* @author Chris Ray
* Created on 6:08:01 PM Nov 25, 2011
*
*/
package baseModel;
import java.util.UUID;
/**
* @author Chris Ray Created on 6:08:01 PM Nov 25, 2011
*/
public class TerritoryCard {
private CardType cardType;
private Territory cardTerritory;
/**
*
* useful for detecti... |
/**
* @author Chris Ray
* Created on 2:30:47 AM Nov 27, 2011
*
*/
package baseModel;
import java.util.ArrayList;
import java.util.HashMap;
/**
* @author Chris Ray Created on 2:30:47 AM Nov 27, 2011
*
*
*/
public class Map {
// set up continents
private String na;
private Territory ala... |
/**
* @author Chris Ray
* Created on 6:05:20 PM Nov 25, 2011
*
*/
package baseModel;
/**
* @author Chris Ray Created on 6:05:20 PM Nov 25, 2011
*/
public enum Team {
/**
* @author Chris Ray Created on 6:06:18 PM Nov 25, 2011
*
*/
GREEN, /**
* @author Chris Ray Created on 6:06:20 PM Nov... |
/**
* @author Chris Ray
* Created on 6:37:08 PM Nov 25, 2011
*
*/
package baseModel;
import java.util.Collections;
import java.util.Iterator;
import java.util.Stack;
/**
* @author Chris Ray Created on 6:37:08 PM Nov 25, 2011
*/
public class CardDeck {// //
private Stack<TerritoryCard> deck;
... |
/**
* @author Chris Ray
* Created on 7:25:14 PM Nov 25, 2011
*
*/
package baseModel;
import java.util.Random;
/**
* @author Chris Ray Created on 7:25:14 PM Nov 25, 2011
*/
public class Die implements Comparable<Die> {// test
private int roll;
/**
*
* @author Chris Ray Created on 8:12:25... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dbConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSetMetaData;
/**
*
* @autho... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* GUI.java
*
* Created on May 7, 2011, 9:05:02 PM
*/
package GUI;
import java.awt.event.ActionEvent;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import java.util.Date;
import java.util.... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ... |
/*
* 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 writing, software
* distribu... |
/*
* 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 writing, software
* distribu... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ap... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ap... |
/*
* Copyright (C) 2010 keystoremanager authors
*
* 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 ap... |
package com.android.test.mykeystore;
/**
* <p>Encodes and decodes to and from Base64 notation.</p>
* <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
*
* <p>Example:</p>
*
* <code>String encoded = Base64.encode( myByteArray );</code>
* <br />
* <code>byte[] myByteArray = Ba... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Turret.java
/*
/* Aim that turret
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Main.java
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
public class Main extends IterativeR... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* DashBoard.java
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.*;
public class DashBoard {
private st... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* AutonProcess.java
/* Has the Autonomous routine
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Timer;
public class Au... |
/*----------------------------------------------------------------------------*/
/* From Team 399/254
/* LinearVictor.java
/*
/* This is a victor that has its output curve corrected to be linear
/* Victors tend to have a log-like signal/output ratio
/*--------------------------------------------------------------------... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* PSoC.java
/* PSoC methods for I/O
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.w... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Tower.java
/*
/* Ball Lift controls
/* Ball Stop
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Solenoid;
import edu.w... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* OffBoardCompressor.java
/*
/* Compressor init code
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Compressor;
public ... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* DriveBase.java
/* Has all driving functions and bridge lowering
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Joystic... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Shooter.java
/* Has all driving functions and bridge lowering
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Counte... |
package logomotion_2011;
import edu.wpi.first.wpilibj.DigitalInput;
public class Line_Sensor_Test {
//Line Sensors
public static DigitalInput sen_1 = new DigitalInput(14);
public static DigitalInput sen_2 = new DigitalInput(11);//3
public static DigitalInput sen_3 = new DigitalInput(13); //4
... |
/*----------------------------------------------------------------------------*/
/* Mark Liu
/* Joystick.java
/* Joysticks instance vars
*
* PS3 test method
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.Joystick;
public class... |
/* Mark Liu
/* Claw.java
/* All the methods for running the claw
* Motor for up and down
* Pneumatics for the fingers
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Victor;
public class C... |
/*----------------------------------------------------------------------------*/
/* Mark Liu + Jacob Cole (2 lines...)
/* Control_Drive.java
/* All driving functions
*
* Stick_drive for one joystick driving
* Drive method that runs drive motors.
/*--------------------------------------------------------------------... |
/*----------------------------------------------------------------------------*/
/* Mark Liu
/* Compressor.java
/* Compressor var
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.Compressor;
public class Compressor_Int {
//... |
/*----------------------------------------------------------------------------*/
/* Mark Liu
/* Tower.java
/* Method for running the lift
*
* Up down and pasue methods
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.Solenoid;
pu... |
/*----------------------------------------------------------------------------*/
/* Joanne Li :D
/* Constants.java
/* All the port numbers with the PSoC
/* Joy stick button numbers
/*----------------------------------------------------------------------------*/
package logomotion_2011;
public class Constants {
... |
/*----------------------------------------------------------------------------*/
/* Mark Liu
/* DriverStation_IO.java
/* PSoC methods for I/O
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;
import edu.wpi.fi... |
/*----------------------------------------------------------------------------*/
/* Mark Liu
/* RobotControl.java
/* Methods used with the cRIO
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.f... |
/*----------------------------------------------------------------------------*/
/* Ali
/* Linessssss.java
/* Methods used with the cRIO
/*----------------------------------------------------------------------------*/
package logomotion_2011;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Tim... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* All subroutines are called from here
/*----------------------------------------------------------------------------*/
package Robot;
import edu.wpi.first.wpilibj.IterativeRobot;
public class Main extends Iterati... |
/*----------------------------------------------------------------------------*/
/* From Team 399/254
/* LinearVictor.java
/*
/* This is a victor that has its output curve corrected to be linear
/* Victors tend to have a log-like signal/output ratio
/*--------------------------------------------------------------... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Tower.java
/*
/* Ball Lift controls
/* Ball Stop
/*----------------------------------------------------------------------------*/
package Robot;
import edu.wpi.first.wpilibj.Solenoid;
public class Tower {
... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Auton.java
/* Auton Routine
/*----------------------------------------------------------------------------*/
package Robot;
public class Auton {
public static final double RPM = 2650;
private stat... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* DriveBase.java
/* Has all driving functions and bridge lowering
/*----------------------------------------------------------------------------*/
package Robot;
import edu.wpi.first.wpilibj.Compressor;
import edu.wp... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Shooter.java
/*----------------------------------------------------------------------------*/
package Robot;
import edu.wpi.first.wpilibj.CounterBase;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpil... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Hanger.java
/* Hanger pneumatics and controls
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Solenoid;
publi... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* JoySticks.java
/* Has all joystick booleans
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Joystick;
pu... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Loader.java
/* Collector and feeder controls
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Solenoid;
import... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Main.java
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
public class Main extends IterativeR... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* DriveTrain.java
/* Drive functions and compressor
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Compressor... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Auton.java
/* Auton Routine
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Timer;
public class Auton {
... |
/* ----------------------------------------------------------------------------
/* Team 3647
/* Shooter.java
/* Shooter Controler
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi... |
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
public class RobotTemplate extends IterativeRobot {
public void robotInit() {
}
public void autonomousPeriodic() {
}
public void teleopPeriodic() {
}
}
|
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.SerialPort;
//import edu.wpi.first.wpilibj.*;
public class Serial {
public SerialPort serial;
public Serial() {
System.out.println("NOTHIN!!!");
}
public void startPort() {
try {
this.serial = new Seri... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* Main.java
/*----------------------------------------------------------------------------*/
package Kit;
import edu.wpi.first.wpilibj.IterativeRobot;
public class Main extends IterativeRobot {
public void ro... |
/*----------------------------------------------------------------------------*/
/* From Team 399/254
* LinearVictor.java
*
* This is a victor that has its output curve corrected to be linear
* Victors tend to have a log-like signal/output ratio
/*--------------------------------------------------------------------... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* PSoC.java
/* PSoC methods for I/O
/*----------------------------------------------------------------------------*/
package Kit;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;
import edu.wpi.first.wpilibj.DriverStati... |
/*----------------------------------------------------------------------------*/
/* Team 3647
/* DriveBase.java
/* Has all driving functions and bridge lowering
/*----------------------------------------------------------------------------*/
package Kit;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpil... |
import game.Console;
import game.Game;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Console console = new Console();
Game theGame = new Game(console);
theGame.init();
theGame.play();
theGame.finish();
}
}
|
package game;
import java.util.Random;
public class Game {
private Player player1, player2;
private Console console;
private Random rand;
public Game(Console con)
{
player1 = null;
player2 = null;
console = con;
rand = new Random();
}
public void init()
{
console.show(GameM... |
package game;
import java.util.Random;
public class Dice {
Random random;
int actualValue;
public Dice(Random rand)
{
random = rand;
}
public void rollDice() {
actualValue = random.nextInt(6) + 1;
}
public int getNumber() {
return actualValue;
}
}
|
package game;
public class Player {
private String playerName;
int points;
public Player(String name) {
setPlayerName(name);
points = 0;
}
public void setPlayerName(String name)
{
playerName = name;
}
public String getPlayerName() {
return playerName;
}
public int getAccumula... |
package game;
import java.util.Scanner;
public class Console {
Scanner input = new Scanner(System.in);
public void show(String message)
{
System.out.println(message);
}
public String readLine()
{
return input.nextLine();
}
}
|
package game;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class Shot {
private final int MAXDICES = 5;
private final int SCORE_WHEN_3_DICES[] = {0, 1000, 200, 300, 400, 500, 600};
private Random random;
private List<Dice> diceList;
public Shot(Random rand) {
... |
package tests;
import static org.junit.Assert.*;
import java.util.Random;
import game.Dice;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
public class DiceTest {
Random random;
Dice dice;
@Before
public void d... |
package tests;
//import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import game.Console;
import game.Game;
import game.GameMessages;
import org.junit.Before;
import org.junit.Test;
public class GameTest {
Console consoleMock;
Game game;
@Before
public void doBefore()
{
... |
package tests;
import static org.junit.Assert.*;
import game.Player;
import org.junit.Test;
public class PlayerTest {
@Test
public void testCreatePlayer() {
Player aPlayer = new Player("Player1");
assertEquals("Player1", aPlayer.getPlayerName());
}
@Test
public void testCreatePlayerAn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.