Source
stringclasses
1 value
Date
int32
2.01k
2.01k
Text
stringlengths
3
15.9M
Token_count
int32
1
2.44M
github-java-corpus
2,012
package battlecode.world; import battlecode.common.*; import battlecode.engine.ErrorReporter; import battlecode.server.Config; import battlecode.world.GameMap.MapProperties; import battlecode.world.signal.NodeConnectionSignal; import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; import javax.xml....
5,853
github-java-corpus
2,012
package battlecode.world; import battlecode.common.*; import battlecode.engine.GenericRobot; import battlecode.engine.signal.Signal; import battlecode.server.Config; import battlecode.world.signal.DeathSignal; import java.util.LinkedList; import java.util.List; import java.util.Map; public class InternalRobot extend...
2,028
github-java-corpus
2,012
package battlecode.common; /** * An exception caused by a robot's interaction with the game world. For instance, trying to move * a robot into an occupied square will cause a <code>GameActionException</code> to be thrown. * <p/> * Each <code>GameActionException</code> has a type that roughly identifies what...
359
github-java-corpus
2,012
package battlecode.common; /** * This enumeration distinguishes objects that are on the ground, or in * the air at a given location. * <p/> * Since RobotLevel is a Java 1.5 enum, you can use it in <code>switch</code> * statements, it has all the standard enum methods (<code>valueOf</code>, * <code>values</code>,...
246
github-java-corpus
2,012
package battlecode.common; import org.apache.commons.lang.StringUtils; import java.io.Serializable; // We don't want contestants to be able to subclass MapLocation because // that would allow them to pass arbitrary data structures in messages /** * This class is an immutable representation of two-dimensional coord...
1,068
github-java-corpus
2,012
package battlecode.common; /** * Defines constants that affect gameplay. */ public interface GameConstants { /* * By convention, the names of the constants should begin with * what they apply to, e.g. GAME_DEFAULT_SEED rather than DEFAULT_GAME_SEED. */ /** * Maximum size of messages ...
592
github-java-corpus
2,012
package battlecode.common; /** * A Robot instance represents a robot in the game world. * * @author Teh Devs * @see battlecode.common.RobotController */ public interface Robot extends GameObject { }
44
github-java-corpus
2,012
package battlecode.common; /** * This enum represents the team of a GameObject; each GameObject has * exactly one team. Robots are either on team A or B, while objects like * mines are neutral. * <p/> * Since Team is a Java 1.5 enum, you can use it in <code>switch</code> * statements, it has all the standard enu...
217
github-java-corpus
2,012
package battlecode.common; /** * A RobotController allows contestants to make their robot sense and interact * with the game world. When a contestant's <code>RobotPlayer</code> is * constructed, it is passed an instance of <code>RobotController</code> that * controls the newly created robot. * * @author ...
3,221
github-java-corpus
2,012
package battlecode.common; /* TODO: */ /** * A GameObject instance represents an object in the game world. * <p/> * A GameObject should have a final, globally unique integer ID. * These fields can be accessed by the accessors in GameObject. Any other, mutable information about the * GameObject m...
355
github-java-corpus
2,012
package battlecode.common; /** * Represents data of the terrain of a location on the map. */ public enum TerrainTile { LAND, VOID, OFF_MAP; /** * Returns <code>true</code> if robots at the given * height can traverse this terrain tile. */ public boolean isTraversableAtHeight(RobotLevel h...
115
github-java-corpus
2,012
package battlecode.common; /** * Struct that stores basic information that was 'sensed' of another Robot. This * info is ephemeral and there is no guarantee any of it will remain the same * between rounds. * * @author Teh Devs */ public class RobotInfo { /** * The robot that was sensed. ...
300
github-java-corpus
2,012
package battlecode.common; /** * A Message is an object that can be broadcast to other robots. You * may freely assign arrays or null to an instance's fields, and when * the Message is broadcast it is copied into the receiving robots' * message queues. Message instances may be mutated and rebroadcast. * <p/> * <...
490
github-java-corpus
2,012
package battlecode.common; /** * A Rift instance represents a rift in the game world. * * @author Teh Devs * @see battlecode.common.RobotController */ public interface Rift extends GameObject { }
44
github-java-corpus
2,012
package battlecode.common; /** * Enumerates the possible errors in GameWorld interactions that cause a GameActionException to be thrown. */ public enum GameActionExceptionType { /** * Internal error in the GameWorld engine. This is bad. */ INTERNAL_ERROR, /** * Indicates when...
190
github-java-corpus
2,012
package battlecode.common; import static battlecode.common.RobotLevel.IN_AIR; import static battlecode.common.RobotLevel.ON_GROUND; import static battlecode.common.GameConstants; public enum RobotType { NEXUS(ON_GROUND, 1000, 0, 0, 0, 0, 0, 100, false, false), TRANSPORTER(IN_AIR, 50, 4, 0, 0, 0, 0, 8, fals...
875
github-java-corpus
2,012
package battlecode.common; import battlecode.engine.Engine; import battlecode.engine.instrumenter.RobotMonitor; /** * A robot's internal clock, used for measuring "time" in bytecodes and rounds. * * @author Teh Devs */ public class Clock { // enforce singleton private Clock() { } ...
199
github-java-corpus
2,012
package battlecode.server.proxy; import battlecode.server.Config; import java.io.IOException; import java.io.OutputStream; /** * This class is a factory for Proxy objects. It returns * implementation-independent Proxies of different types based on the needs of * the server. */ public class ProxyFactory { pu...
398
github-java-corpus
2,012
package battlecode.server.proxy; import battlecode.serial.MatchFooter; import battlecode.serial.MatchHeader; import battlecode.serial.RoundDelta; import battlecode.serial.RoundStats; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream; /** * This class represents a sink for ma...
685
github-java-corpus
2,012
package battlecode.server.proxy; import battlecode.serial.notification.Notification; import battlecode.server.Server; import java.io.*; import java.util.zip.GZIPOutputStream; /** * This class represents a "connection" to a file. It provides a method for * saving binary match data to disk so that it may be read lat...
607
github-java-corpus
2,012
package battlecode.server.proxy; import battlecode.common.MapLocation; import battlecode.common.TerrainTile; import battlecode.engine.signal.Signal; import battlecode.serial.ExtensibleMetadata; import battlecode.serial.MatchFooter; import battlecode.serial.RoundDelta; import battlecode.serial.RoundStats; import battle...
2,405
github-java-corpus
2,012
package battlecode.server; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; // TODO: read default map paths from conf...
1,316
github-java-corpus
2,012
package battlecode.server; import org.apache.commons.cli.*; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.util.Enumeration; import java.util.Properties; /** * Represents a game configuration as provided by configuration files and *...
1,512
github-java-corpus
2,012
package battlecode.server; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.ServerSocket; import java.net.Socket; /** * A utility class for receiving remote method calls. */ public abstract class RPCServer implements Runnable { /** * The sock...
476
github-java-corpus
2,012
package battlecode.server; import java.io.IOException; public class Main { private static void runHeadless(Config options, String saveFile) { try { Server server = ServerFactory.createHeadlessServer(options, saveFile); server.run(); } catch (IOException...
399
github-java-corpus
2,012
package battlecode.server; import battlecode.common.Team; import battlecode.engine.ErrorReporter; import battlecode.engine.GameState; import battlecode.engine.signal.Signal; import battlecode.serial.*; import battlecode.serial.notification.*; import battlecode.server.controller.Controller; import battlecode.server.pro...
2,720
github-java-corpus
2,012
package battlecode.server; /** * Represents the state of a match in a running server. */ public enum State { /** * The match is not ready for running yet. */ NOT_READY, /** * The match is ready to start running. */ READY, /** * The match is running. */ RUNNING...
127
github-java-corpus
2,012
package battlecode.server; import battlecode.common.GameConstants; import battlecode.common.Team; import battlecode.engine.Engine; import battlecode.engine.GameState; import battlecode.engine.GameWorldViewer; import battlecode.engine.signal.Signal; import battlecode.serial.*; import java.util.Observable; //import ba...
1,983
github-java-corpus
2,012
package battlecode.server; import battlecode.server.controller.Controller; import battlecode.server.controller.ControllerFactory; import battlecode.server.proxy.Proxy; import battlecode.server.proxy.ProxyFactory; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.Linked...
673
github-java-corpus
2,012
package battlecode.server.controller; import battlecode.serial.MatchInfo; import battlecode.server.Config; import java.io.IOException; /** * Adapts match parameters from a set of properties (i.e., the configuration * file or command line). */ class HeadlessController extends Controller { /** * The match...
239
github-java-corpus
2,012
package battlecode.server.controller; import battlecode.server.Config; import battlecode.server.proxy.Proxy; import java.io.IOException; import java.util.Observable; import java.util.Observer; public class LocalController extends Controller implements Observer { private final Proxy proxy; public LocalContr...
152
github-java-corpus
2,012
package battlecode.server.controller; import battlecode.server.Config; import battlecode.server.proxy.Proxy; import battlecode.server.proxy.XStreamProxy; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; /** * Produces controller instances from different control data sources....
257
github-java-corpus
2,012
package battlecode.server.controller; import java.io.IOException; import java.util.Observable; /** * This class represents a source for server and match control data, including * match parameters (team and map name), notifications (start, stop, pause), * and actions taken by the user while in debugging mode. It em...
179
github-java-corpus
2,012
package battlecode.server.controller; import battlecode.server.Server; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectInputStream; /** * This class is used to provide a means of controlling the server over TCP. New * matches are started using a request packet, and matches are stopped ...
708
github-java-corpus
2,012
package battlecode.serial; import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; public class ExtensibleMetadata implements Serializable { private static final long serialVersionUID = -8982623693074338715L; private final Map<String, Object> data; publi...
258
github-java-corpus
2,012
package battlecode.serial; import battlecode.common.Team; import java.io.Serializable; // Stub for compatibility with last year's Proxy interface. public class RoundStats implements Serializable { private static final long serialVersionUID = -2422655921465613943L; private final double[] gatheredPoints; ...
157
github-java-corpus
2,012
package battlecode.serial; import battlecode.common.Team; import java.io.Serializable; public class MatchFooter implements Serializable { private static final long serialVersionUID = 1179780102137505202L; private final Team winner; private final long[][] state; public MatchFooter(Team winner, long[...
108
github-java-corpus
2,012
package battlecode.serial; import java.io.Serializable; public class MatchHeader implements Serializable { private static final long serialVersionUID = -4228142649046586925L; private final GenericGameMap map; private final long[][] state; private final int matchNumber, matchCount; public MatchHe...
171
github-java-corpus
2,012
package battlecode.serial; /** * Determines roughly by how much the winning team won. */ public enum DominationFactor { /** * Beat by having more energon at the end of the round limit */ WON_BY_DUBIOUS_REASONS, /** * Beat by having more archons at the end of the round limit ...
175
github-java-corpus
2,012
package battlecode.serial; import battlecode.common.Team; import java.io.Serializable; /** * Used to keep track of various statistics in a given * battlecode match. These should be stats that don't change from round * to round, but rather are given only at the end of the match. * <p/> * excitement factor curre...
754
github-java-corpus
2,012
package battlecode.serial; import java.io.Serializable; public class MatchInfo implements Serializable { private static final long serialVersionUID = 638514128835207033L; private final String teamA; private final String teamB; private final String[] maps; public MatchInfo(String teamA, String t...
173
github-java-corpus
2,012
package battlecode.serial; import java.io.Serializable; public interface GenericGameMap extends Serializable { public int getMaxRounds(); }
26
github-java-corpus
2,012
package battlecode.serial.notification; /** * Represents a "run for n rounds" notification. */ public class RunNotification implements Notification { private static final long serialVersionUID = 2218449423201081302L; private final int rounds; public RunNotification(int rounds) { this.rounds = r...
124
github-java-corpus
2,012
package battlecode.serial.notification; import java.io.ObjectStreamException; /** * Represents a notification that the running server should pause the * match. */ public class PauseNotification implements Notification { private static final long serialVersionUID = 9147823569187364569L; /** * The sin...
152
github-java-corpus
2,012
package battlecode.serial.notification; import java.io.ObjectStreamException; /** * Represents a notification that server waiting from a pause or breakpoint * should resume running. */ public class StartNotification implements Notification { private static final long serialVersionUID = 1623471361235454533L; ...
155
github-java-corpus
2,012
package battlecode.serial.notification; import java.io.ObjectStreamException; public class ResumeNotification implements Notification { private static final long serialVersionUID = 1192877459158275306L; /** * The singleton instance for this notification. */ public static final ResumeNotificati...
121
github-java-corpus
2,012
package battlecode.serial.notification; /** * A flat visitor for processing arbitrary instances of Notification. * * @param <R> the return type of the processing methods in this handler */ public interface NotificationHandler<R> { /** * Processes a start notification. * * @param n the notificat...
217
github-java-corpus
2,012
package battlecode.serial.notification; import java.io.Serializable; /** * Represents a notification to the server. Sort of the opposite of a signal, * at least in the direction that they travel. */ public interface Notification extends Serializable { /** * Accept the notification handler (a visitor) for...
106
github-java-corpus
2,012
package battlecode.serial; public class FieldRequest { public int robotID; public String request; }
22
github-java-corpus
2,012
package battlecode.serial; import battlecode.engine.signal.Signal; import battlecode.world.signal.IndicatorStringSignal; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; public class RoundDelta implements Serializable { ...
465
github-java-corpus
2,012
package battlecode.engine; import battlecode.engine.signal.SignalHandler; /** * An interface that includes the part of the game world that isn't expected to change * from year to year. */ public interface GenericWorld extends GameWorldViewer, SignalHandler { public void beginningOfExecution(int id); publ...
132
github-java-corpus
2,012
package battlecode.engine; public interface GenericController { public GenericRobot getRobot(); }
18
github-java-corpus
2,012
package battlecode.engine; import battlecode.engine.instrumenter.IndividualClassLoader; import battlecode.engine.instrumenter.RobotMonitor; import battlecode.engine.instrumenter.lang.RoboRandom; import battlecode.engine.scheduler.Scheduler; import battlecode.engine.signal.Signal; import battlecode.server.Config...
867
github-java-corpus
2,012
package battlecode.engine; import battlecode.common.Team; /* * Interface containing all of the functions needed by the instrumenter. */ public interface GenericRobot { public int getID(); public Team getTeam(); public int getBytecodesUsed(); public int getBytecodeLimit(); public void suicid...
65
github-java-corpus
2,012
package battlecode.engine; import battlecode.common.Team; import battlecode.engine.signal.Signal; import battlecode.serial.GameStats; import battlecode.serial.GenericGameMap; import battlecode.serial.RoundStats; public interface GameWorldViewer { public int getCurrentRound(); public int getMapSeed(); p...
120
github-java-corpus
2,012
package battlecode.engine.scheduler; import battlecode.engine.ErrorReporter; /** * ScheduledRunnable is a wrapper for a Runnable, that runs the embedded Runnable in a new thread that is locked into the Scheduler. * * @author adamd */ public class ScheduledRunnable implements Runnable { private final...
276
github-java-corpus
2,012
package battlecode.engine.scheduler; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; /** * WaitNotifyLock is faster than ReentrantLock; it wastes about 3 percent of game time as * opposed to about 5 percent for ReentrantLock. It is not well tested though. * <p/> * It is also ...
446
github-java-corpus
2,012
package battlecode.engine.scheduler; import battlecode.engine.ErrorReporter; import battlecode.engine.instrumenter.RobotMonitor; import java.util.concurrent.locks.LockSupport; public class Scheduler { public static class ScheduledThread { volatile ScheduledThread next; volatile ScheduledThread ...
629
github-java-corpus
2,012
package battlecode.engine; // TODO: pass messages along to the client public class ErrorReporter { // reports the error, and tells the contestant to contact the devs public static void report(Throwable e) { report(e, true); } public static void report(String message) { repo...
498
github-java-corpus
2,012
package battlecode.engine.signal; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; /** * A signal handler that delegates to other signal handling methods, which it discovers * automatically. The following criteria are ...
629
github-java-corpus
2,012
package battlecode.engine.signal; /** * Overrides the default behavior for automatic signal discovery. * * @see AutoSignalHandler */ public @interface DiscoverSignal { boolean value() default true; }
40
github-java-corpus
2,012
package battlecode.engine.signal; import java.io.Serializable; // Ideally Signal would be a method-less interface; the accept method exists for legacy reasons public abstract class Signal implements Serializable { public void accept(SignalHandler handler) { handler.visitSignal(this); } }
55
github-java-corpus
2,012
package battlecode.engine.signal; public interface SignalHandler { public void visitSignal(Signal s); }
21
github-java-corpus
2,012
package battlecode.engine; import battlecode.engine.instrumenter.IndividualClassLoader; import battlecode.engine.instrumenter.InstrumentationException; import battlecode.engine.scheduler.ScheduledRunnable; import battlecode.server.Config; /* TODO: - better error reporting */ public class PlayerFactory { ...
353
github-java-corpus
2,012
package battlecode.engine; public enum GameState { RUNNING, BREAKPOINT, DONE; }
20
github-java-corpus
2,012
package battlecode.engine; import battlecode.common.RobotController; import battlecode.engine.instrumenter.RobotDeathException; import battlecode.engine.scheduler.Scheduler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; /* RobotRunn...
547
github-java-corpus
2,012
package battlecode.engine.instrumenter; /** * Used to verify that a team's submission will pass the instrumenter when it's run. * <p/> * Usage:<br> * <code>java battlecode.engine.instrumenter.Verifier teamXXX</code><br> * If the submission passes, the Java process will return 0, and there will be no output...
206
github-java-corpus
2,012
package battlecode.engine.instrumenter; import org.objectweb.asm.signature.SignatureWriter; class BattlecodeSignatureWriter extends SignatureWriter { String teamPackageName; boolean silenced; boolean checkDisallowed; public BattlecodeSignatureWriter(String teamPackageName, boolean silenced, boolean ...
243
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.ErrorReporter; import org.objectweb.asm.Type; import org.objectweb.asm.signature.SignatureReader; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; ...
2,674
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.ErrorReporter; import org.objectweb.asm.ClassReader; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util...
777
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.GenericRobot; import battlecode.engine.GenericWorld; import battlecode.engine.instrumenter.lang.RoboPrintStream; import battlecode.engine.instrumenter.lang.SilencedPrintStream; import battlecode.engine.scheduler.Scheduler; import battlecode.server...
1,537
github-java-corpus
2,012
package battlecode.engine.instrumenter; /** * An exception used to indicate that there was a problem instrumenting a player (e.g., the player references a * disallowed class, or one if its classes can't be found). This must be an unchecked Exception, because it * has to be thrown in overriden methods. * *...
129
github-java-corpus
2,012
package battlecode.engine.instrumenter; /** * An exception used to kill robot threads when their robot dies in the game. In other words, when a robot * dies, a RobotDeathException is thrown in the robot's thread, and it propagates all the way up to RobotRunnable, * ending the robot's thread. This must be an ...
148
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.ErrorReporter; import battlecode.server.Config; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import java.io.IOException; import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS; pu...
819
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.ErrorReporter; import org.objectweb.asm.*; import java.io.IOException; import java.util.HashSet; import static org.objectweb.asm.ClassReader.SKIP_DEBUG; /** * This class transitively reads all interfaces and superclasses implemented or ext...
707
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.ErrorReporter; import java.util.HashMap; import java.util.Map; class SingletonClassLoader extends InstrumentingClassLoader { // caches the classes that have been loaded and designated as reusable, to speed up future attempts to load them priva...
443
github-java-corpus
2,012
package battlecode.engine.instrumenter; import battlecode.engine.ErrorReporter; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import java.io.IOException; import java.util.*; import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS; public class IndividualClassLoader extends Instrumenti...
1,238
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import battlecode.engine.instrumenter.InstrumentationException; public class Thread extends java.lang.Thread { private static Thread INSTANCE = new Thread(false); private Thread(boolean b) { } public Thread() { System.err.println("A new thread!")...
116
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import java.util.Hashtable; import java.util.concurrent.ConcurrentMap; /** * ConcurrentMap implementation that isn't really concurrent. * Needed to instrument Clojure. */ public class ConcurrentHashMap<K, V> extends Hashtable<K, V> implements ConcurrentMap<K, V> { ...
223
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import java.util.Random; import java.util.regex.Pattern; // This class allows us to instrument certain string operations. // The instrumenter replaces calls to java.lang.String methods, // which are not instrumented, with these methods, which are. public class Instrumenta...
264
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; public class AtomicInteger { private int l; public AtomicInteger() { } public AtomicInteger(int x) { l = x; } public int get() { return l; } public void set(int x) { l = x; } public boolean compareAndSet(...
131
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import java.io.PrintStream; /** * A singleton PrintStream, that basically doesn't print anything. * * @author adamd */ public class SilencedPrintStream extends PrintStream { // singleton private static SilencedPrintStream theInstance = new Silenced...
486
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import battlecode.engine.ErrorReporter; import org.hibernate.search.util.WeakIdentityHashMap; import java.lang.reflect.Method; import java.util.HashMap; public class ObjectHashCode { static final Method objectHashCode; static final Method enumHashCode; static...
510
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; public class AtomicReference<V> { private V v; public AtomicReference() { } public AtomicReference(V w) { v = w; } public boolean compareAndSet(V e, V u) { if (v == e) { v = u; return true; } else ...
209
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import java.util.Random; /** * A wrapper for java.util.Random, that uses the map seed in place of system time for the default Random constructor * * @author adamd */ public class RoboRandom extends Random { private static final long serialVersionUID = 0...
174
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import battlecode.engine.Engine; import battlecode.engine.instrumenter.RobotMonitor; import java.io.PrintStream; /** * RoboPrintStream is a wrapper for java.lang.System.out that prepends a string identifying the current robot to * all outputted strings. Also...
922
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; // Fake AtomicLong class, needed by java.util.Random. public class AtomicLong { private long l; public AtomicLong() { } public AtomicLong(long x) { l = x; } public long get() { return l; } public void set(long x) { ...
146
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import java.lang.reflect.Field; /** * Do-nothing replacement for sun.misc.Unsafe. Used by Random. */ public class Unsafe { private Unsafe() { } private static Unsafe instance = new Unsafe(); public static Unsafe getUnsafe() { return instance; ...
103
github-java-corpus
2,012
package battlecode.engine.instrumenter.lang; import battlecode.engine.instrumenter.RobotMonitor; import battlecode.server.Config; import java.io.InputStream; import java.io.PrintStream; /** * A Wrapper for java.lang.System that supports only arraycopy and System.out. battlecode.engine.instrumenter.lang.Sy...
399
github-java-corpus
2,012
package battlecode.engine.instrumenter; import org.objectweb.asm.*; /** * Instruments a class. See InstrumenterASMImpl for more info on what this instrumentation does. * * @author adamd */ public class RoboAdapter extends ClassAdapter implements Opcodes { private String className; private fina...
1,154
github-java-corpus
2,012
package battlecode.engine.instrumenter; // Should produce the exact same results as RoboMethodAdapter. I wrote // this in an attempt to fix a strange bug. RoboMethodTree is more // extensible than RoboMethodAdapter, but also less well tested. -dgulotta import battlecode.common.GameConstants; import battlecode.engin...
4,185
github-java-corpus
2,012
package com.ef; public enum Cell { A1, A2, A3, B1, B2, B3, C1, C2, C3 }
45
github-java-corpus
2,012
package com.ef; import java.util.*; public class Game { private List<Player> players; private GameBoard<Cell, Player> gameBoard; public void startGame() { addPlayersToGame(); resetGameBoard(); } private void addPlayersToGame() { players = new ArrayList<Player>(); ...
221
github-java-corpus
2,012
package com.ef; public enum PlayerType { X, O }
16
github-java-corpus
2,012
package com.ef; public class Player { private PlayerType playerType; public PlayerType getPlayerType() { return playerType; } public void setPlayerType(PlayerType playerType) { this.playerType = playerType; } }
53
github-java-corpus
2,012
package com.ef; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; public class TicTacToe { private static Map<Integer, Cell> cells = new HashMap<Integer,Cell>(){{ put(new Integer(1), Cell.A1); put(new Integer(2), Cell.A2); ...
1,181
github-java-corpus
2,012
package com.ef; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; public class GameBoard<K extends Cell, V extends Player> extends HashMap<K, V> { private List<List<Cell>> winningKeys = new ArrayList<List<Cell>>(){{ add(Arrays.asList(Cell.A1, Cell.A2, Ce...
450
github-java-corpus
2,012
package com.ef; import org.junit.Before; import org.junit.Test; import java.util.*; import static org.junit.Assert.*; public class TicTacToeTest { private Game game; private Player playerX; private Player playerO; @Before public void setUp() { game = new Game(); game.startGame(...
683
github-java-corpus
2,012
package org.cvpcs.android.bionic.bootstrap; import java.io.File; import java.io.FileInputStream; import android.util.Log; import org.json.JSONObject; public class ROMBootstrapSettings { private static final String TAG = "DBB/ROMBootstrapSettings"; private static final File SETTINGS_FILE = new File("/sy...
566
github-java-corpus
2,012
package org.cvpcs.android.bionic.bootstrap; import java.io.DataOutputStream; import java.io.IOException; import android.content.Context; public class Helper { static final String LOGTAG = "BionicBootstrap"; public final static String SCRIPT_NAME = "surunner.sh"; public static Process runSuCommandAsync...
240