text
stringlengths
14
410k
label
int32
0
9
public static void stringExperiment(PrintWriter pen, SortedList<String> slist) { VerboseSortedList<String> strings = new VerboseSortedList<String>(slist, pen, "strings"); // Add a bunch of strings heading(pen, "Adding first"); String[] first = new String[] { "twas", "brillig", "an...
6
public void writeTermsToFile(String strNumber, Hashtable<String, Double> oTermVsTFIDF) throws IOException { String strKey = null; Double maxValue = Double.MIN_VALUE; String strTerms = ""; int len = oTermVsTFIDF.size() < 5 ? oTermVsTFIDF.size() : 5; for (int i = 0; i < len; ++i) { for (Map.Entry<Strin...
7
private static String stringForJSON(String input) { if (input == null || input.isEmpty()) return ""; final int len = input.length(); final StringBuilder result = new StringBuilder(len + len / 4); final StringCharacterIterator iterator = new StringCharacterIterator(input); char c...
7
public void update(long currentTime) { if (isFinished || target == null) { return; } if (!isStarted) { startTracking(currentTime); return; } int dt = (int)(currentTime - lastTime); lastTime += dt; Point nextLocation; ...
5
private void jMenuItem1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem1MousePressed try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); JFrame mainFra...
5
public Object makeDefaultValue(Class type) { if (type == int.class) return new Integer(0); else if (type == boolean.class) return Boolean.FALSE; else if (type == double.class) return new Double(0); else if (type == S...
8
public synchronized Connection getConnection() throws ConnectionException{ Connection connection; for ( int i = 0; i < POOL_SIZE; i++ ){ if ( pooledConnections[i] == null ){ connection = createConnection(); PooledSqlConnection pooledConnection = new PooledSqlC...
5
@Override public void run() { if(elCliente.entrada==null){ System.out.println("El Stream esta null"); return; } System.out.println("Iniciando el Thread el Input"); System.out.println("Esperando mensajes..."); try{ Object in=elCliente.entrada.readObject(); do{ String mensaje=(String)in; //...
6
private ServerConnectionType(String type) { this.type = type; }
0
public Counter nextTurn(Counter lastPlaced, Board b) { Counter next = Counter.EMPTY; if (lastPlaced == Counter.BLACK) { next = Counter.WHITE; } else if (lastPlaced == Counter.WHITE) { next = Counter.BLACK; } return next; }
2
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public static int searchInt(int[] arr,int low,int high,int x){ if(low>high) return -1; int mid = (low+high)/2; if(x==arr[mid]) return mid; if(arr[mid]>=arr[low]&&arr[mid]>=arr[high]){ if(x>=arr[low]&&x<arr[mid]) return searchInt(arr,low,mid-1,x);//could replace this with binarySearch else return searchInt...
8
public void updateUnicodeString( String s ) { if( s.equals( toString() ) ) { return; } // 0 cch 2 Count of characters in string (NOT the number of bytes) // 2 grbit 1 Option flags // make sure to get formatting runs if present byte[] strbytes = null; try { ...
7
private static void buildCode(String[] st, Node x, String s) { if (!x.isLeaf()) { buildCode(st, x.left, s + '0'); buildCode(st, x.right, s + '1'); } else { st[x.ch] = s; } }
1
public void testCorrectColorList() { Combination<Colors> combination = DefaultValues.DEFAULTATTEMPTCOMBINATION1; List<Colors> list = combination.getColorsList(); assertEquals(list.get(0), Colors.R); assertEquals(list.get(1), Colors.O); assertEquals(list.get(2), Colors.Y); assertEquals(list.get(3), Color...
0
private JList createJList(Object[] data){ JList list = new JList(data) { private static final long serialVersionUID = 1L; // Subclass JList to workaround bug 4832765, which can cause the // scroll pane to not let the user easily scroll up to the beginning // of the list. An alternative would be to s...
7
public int calculateDay(int day) { if (day == 1) return 0; if (day == 2) return 1; if (day == 3) return 2; if (day == 4) return 3; if (day == 5) return 4; if (day == 6) return 5; return day != 7 ? 7 : 6; }
7
public boolean compareNames(String... names) { if (names.length != 2) return false; NameComparison nameUtil = NameComparison.get(); String[] firsts = get("firstName"), lasts = get("lastName"), boths = get("name"); if (firsts.length == 0 || lasts.length == 0) { for (String both : boths) { if (nameUtil....
8
@SuppressWarnings("unchecked") public static TreeMap<String, float[]> restoreTM1D(String findFromFile) { TreeMap<String, float[]> dataSet = null; try { FileInputStream filein = new FileInputStream(findFromFile); ObjectInputStream objin = new ObjectInputStream(filein); try { dataSet = (TreeMap<String, ...
2
private void drawHands(){ for (int i = 0; i < playerHand.size(); i ++){ boolean isSelected = false; Card c = playerHand.getCard(i); for (Integer iS: selections) if (iS == i) isSelected = true; if (isSelected){ // any selected card will be signified by lowering the alpha Image a = cardImag...
7
public void setCategories(String newCategories) { categories = newCategories.split(","); }
0
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vector2f vector2f = (Vector2f) o; if (Float.compare(vector2f.x, x) != 0) return false; if (Float.compare(vector2f.y, y) != 0) return false; ...
5
public double getMarkerHeight() { return markerRect.getHeightCoordinates(); }
0
public static int awtKeyToLWJGL(KeyEvent e) { int key_code = e.getKeyCode(); int position = e.getKeyLocation(); /* Code taken from LWJGL, specifically org.lwjgl.opengl.KeyboardEventQueue */ switch (key_code) { case KeyEvent.VK_ALT: // fall through if (position == KeyEvent.KEY_LOCATION_RIGHT) retu...
9
public void tick(){ if(alive){ if(listener.isPressed(40)){ if(y<750){ y = y + 8; } } if(listener.isPressed(38)){ if(y>0){ y = y - 8; } } if(listener.isPressed(32)){ if(delay<=20){ shots = shots.add(new laser(x+34,y+28)); delay = delay + 20; } } ...
8
public BattleField(int width, int heigth) { hitCount = 0; if (width > 5) { this.width = width; } if (heigth > 5) { this.width = heigth; } ships = new HashSet<>(); initFields(); }
2
@Override public Data read(int index) { if (index > -1 && index < 16) { //Ensure valid index (0-15) return generalPurposeRegisters[index]; } return null; }
2
@Override public void removeOne(int intId, String strTabla) throws Exception { Statement oStatement; try { oStatement = (Statement) oConexionMySQL.createStatement(); String strSQL = "DELETE FROM " + strTabla + " WHERE id = " + intId; oStatement.executeUpdate(strSQ...
1
public boolean getScrollableTracksViewportWidth() { if (adapt) return true; return getPreferredSize().width < getParent().getSize().width; }
1
public void visitEnd() { if (state != CLASS_TYPE) { throw new IllegalStateException(); } state = END; if (sv != null) { sv.visitEnd(); } }
2
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { prevRowIndex = currentRowIndex; prevColumnIndex = currentColumnIndex; currentRowIndex = rowIndex; currentColumnIndex = columnIndex; // logger.debug("prevRowIndex=" + prevRowIndex); ...
8
public static Stella_Object accessMeasureSlotValue(Measure self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Utilities.SYM_UTILITIES_BASE_UNIT) { if (setvalueP) { self.baseUnit = ((StringWrapper)(value)).wrapperValue; } else { value = StringWrapper.wr...
8
public PathNode search(final Unit unit, Location start, final GoalDecider goalDecider, final CostDecider costDecider, final int maxTurns, final Unit carrier) { Location entry = findRealStart(unit, start, carrier); int initi...
8
public static String getDesc(int bookId) { return bookDesc[bookId-300]; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PID other = (PID) obj; if (id != other.id) return false; return true; }
4
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
6
public void itemStateChanged(ItemEvent arg0) { if (arg0.getSource().equals(playerBox) && arg0.getStateChange() == ItemEvent.SELECTED) { // config.setActivePlayer((Class)arg0.getItem()); selectedPlayer = (Class) arg0.getItem(); config.setPlayerClass((Class<Player>) playerBox.getSelectedItem()); if(selec...
5
private static void displayRateReview(BufferedReader reader, VideoStore videoStore) { try { System.out.println("Please enter the title of the video the review was for:"); String isbn = getISBNFromTitle(reader, videoStore, reader.readLine()); System.out.println("Please enter ...
3
public void init() throws IOException { //create a vector to hold the lines of text read from the file buffer = new ArrayList<>(1000); modified = false; //no data has yet been modified or added //create various decimal formats DecimalFormats = new DecimalFormat[11]; DecimalFormats[0] = new D...
7
public List<Airfield> getRecentAirfield() { try{ List<Airfield> airfields = DatabaseDataObjectUtilities.getAirfields(); List<Airfield> recentAirfieldList = new ArrayList<Airfield>(); if(instance == null) { return null; } ...
7
public CheckResultMessage check19(int day) { return checkReport.check19(day); }
0
private static void printListOldWay(String type) { System.out.println("Old Way " + type + ":"); for (User u : users) { System.out.println("\t" + u); } System.out.println(); }
1
@BeforeTest public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://localhost:8888/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
0
public void setWeights(int node) { for (int i = 0; i < result.length; i++) { if (adjMatrix[node][i] != 0 && visited[i] != 1 && (result[i] > (result[node] + adjMatrix[node][i]) || result[i] == -1)) result[i] = result[node] + adjMatrix[node][i]; } vi...
6
public void body() { int resourceID[] = new int[this.totalResource_]; double resourceCost[] = new double[this.totalResource_]; String resourceName[] = new String[this.totalResource_]; LinkedList resList; ResourceCharacteristics resChar; // waiting to get list of res...
4
@Override public void run() { Random rnd = new Random(); try (ServerSocket server = new ServerSocket(port)) { System.out.println("server up and running on port " + port); ServerOutputHandler output = new ServerOutputHandler( allConnections, m, rnd.nextLong()); output.start(); while (true) { S...
4
public void setState(State _state) { if(getWidth() > 0 && getHeight() > 0) { getGui().setVisible(false); state = _state; getGui().setVisible(true); }else{ ClientHelper.log(LogType.GUI, "GuiManager: setState wurde vor setBounds aufgerufen"); ...
2
public void processArgs(Option opt, ListIterator iter) throws ParseException { // loop until an option is found while (iter.hasNext()) { String str = (String) iter.next(); // found an Option, not an argument if (getOptions().hasOption(str) && str.startsWi...
6
@Override public void runClient(GameEntity entity, float delta) { if(EntityManager.interpolate && prevSnapshot != null && nextSnapshot != null) { float progress = acc/0.05f; Vector3 pos = nextSnapshot.v3_0; Vector3 vel = nextSnapshot.v3_1; Vector3 imp = nextSnapshot.v3_2; if(progress < 1f) { ...
7
private void addDependent(JSRTargetInfo result) { if (dependent == null || dependent == result) dependent = result; else if (dependent instanceof JSRTargetInfo) { Set newDeps = new HashSet(); newDeps.add(dependent); newDeps.add(result); } else if (dependent instanceof Collection) { ((Collec...
4
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
@Override public void run() { try { BamWindow window = bamWindows.getWindow(); VariantCandidateEmitter emitter = new VariantCandidateEmitter(referenceFile, counters, window, options); List<VariantCandidate> variantCandidates = new ArrayList<VariantCandidate>(); ...
8
public int getValue() { return value; }
0
public int getKeyCode(int game) { String name; switch(game){ case UP: name = "UP"; break; case DOWN: name = "DOWN"; break; case LEFT: name = "LEFT"; break; case RIGHT: name = "RIGHT"; break; case FIRE: name = "FIRE"; break; default: return game; } return Applicati...
5
@Test public void testRunStartServerSpotFaculty()throws Exception{ AccessControlServer server = new AccessControlServer(1932); server.start(); SpotStub spot = new SpotStub("101",1932); spot.start(); sleep(1000); String ans = ""; int x = 0; ...
3
public GridWorker(GridProcessingManager gpm, int id) { this.gpm = gpm; this.id = id; }
0
public String diff_toDelta(LinkedList<Diff> diffs) { StringBuilder text = new StringBuilder(); for (Diff aDiff : diffs) { switch (aDiff.operation) { case INSERT: try { text.append("+").append(URLEncoder.encode(aDiff.text, "UTF-8") .replac...
6
private void drawLine(HomCoords2D homCoords1, HomCoords2D homCoords2, BufferedImage textureTop, BufferedImage textureBottom, Color colour) { // We note that we speak about points in the textured image as (x, y) where (0, 0) represents the middle of the image, // and the coordinates are scaled so that (+-1, +-1) are...
9
public void setCountry(String country) { this.country = country; }
0
private void button_delete_selectedMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_delete_selectedMousePressed if(hitbox_index_selected!=-1) { int i=0; for(Node hitboxes_node=current_frame.getFirstChild();hitboxes_node!=null;hitboxes_node=hitboxes_node.getNextSibling())//Hi...
7
protected List<Getter> getters(Class<?> type) { List<Getter> result=new ArrayList<Getter>(); for(Class<?> c=type;c!=null;c=c.getSuperclass()) for(Field field : c.getDeclaredFields()) if((field.getModifiers()&Modifier.STATIC) != 0) { // We never serialize s...
7
private void doCalculation(double xf, double yf, int xi, int yi) { double a, b, aa, bb; float hue, huesat, new_gamma; double[] iter; a = 2 * (xf - 0.5) * zoom + xcen; b = 2 * (yf - 0.5) * zoom + ycen; aa = a; bb = b; iter = NewtonIterate(aa, bb, alg); if (mandelbrotAddition) { // get Color based...
6
private void populate() { Random rand = Randomizer.getRandom(); field.clear(); for(int row = 0; row < field.getDepth(); row++) { for(int col = 0; col < field.getWidth(); col++) { if(rand.nextDouble() <= fox_creation_probability) { Location loca...
8
private TagCompound saveObjective(Objective o) { TagCompound c = new TagCompound(o.getID()); c.setTag("name", new TagString("name", o.getName())); c.setTag("target", new TagString("target", o.getTarget())); c.setTag("type", new TagString("type", o.getType().getClass().getName())); c.setTag("iconid", new TagI...
5
private List<Tuple> joinResults() { boolean continueReading = true; List<Tuple> result = new LinkedList<Tuple>(); while(continueReading) { try { String line = null; Tuple t2 = null; while( (line = input2.getNextString()) != null ){ if (line.indexOf("END") == 0) { continueReading = false...
6
public static boolean isValidClassName(String s) { if (s.length() < 1) return false; if (s.equals("package-info")) return true; if (surrogatesSupported) { int cp = s.codePointAt(0); if (!Character.isJavaIdentifierStart(cp)) return false; for (i...
9
public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); char[] v = new char[]{'A','U','E','O','I'}; char[] c = new char[]{'J','S','B','K','T','C','L','D','M','V','N','W','F','X','G','P','Y','H','Q','Z','R','S'}; ...
7
public void visit_invokevirtual(final Instruction inst) { final MemberRef method = (MemberRef) inst.operand(); final Type type = method.nameAndType().type(); stackHeight -= type.stackHeight() + 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += type.returnType().stack...
1
public void drawSquares() { for (byte i = 0; i < board.length; i++) { for (byte y = 0; y < board[i].length; y++) { switch (board[i][y]) { case WALL: theG.setColor(Color.BLUE); theG.fillRect(y * SCALE, i * SCALE, SCALE, SCALE); break; ...
9
@Override public void mouseDragged(MouseEvent event) { Point where = mListener.convertToLocalCoordinates(new Point(event.getX(), event.getY())); mInterimBounds.setBounds(mBoundsToAdjust); mAdjuster.adjust(where.x - mSnapshot.x, where.y - mSnapshot.y, mBoundsToAdjust, mBoundsSnapshot); if (!mInterimBounds.equal...
1
@Override public String toString() { return StringUtil.concatenateStrings("Watcher: ", watchKey.toString()); }
0
public Date getStart() { return start; }
0
public void borrarElement(String dia, int hora, Element e) { int i; if (dia.equals("dilluns")) i = 0; else if (dia.equals("dimarts")) i = 1; else if (dia.equals("dimecres")) i = 2; else if (dia.equals("dijous")) i = 3; else if (dia.equals("divendres")) i = 4; els...
6
public void renderAll(){ render(); for (GameObject child: children){ child.renderAll(); } }
1
public boolean actionPatrol(Actor actor, Target spot) { //I.say("Patrolling to: "+spot) ; if (actor.base() != null) { final IntelMap map = actor.base().intelMap ; map.liftFogAround(spot, actor.health.sightRange() * 1.207f) ; } // // If you're on sentry duty, check whether you need ...
5
public void useFuel(int amount) { if((amount <= fuelLevel) && (amount > 0) && !infinite) { fuelLevel -= amount; } }
3
public void inorderPrint( )//LNR { if (left != null) { left.inorderPrint( ); } System.out.println(data); if (right != null) { right.inorderPrint( ); } }
2
public static AudioInputStream toAudioInputStream( double[] audioData, float sampleRate ) { int m = audioData.length; AudioFormat format = new AudioFormat(sampleRate, 16, 1, true, false); // build byte array byte[] byteArray = new byte[m * 2]; int val; for ( int i = 0; i < m; ++i ) { val = (int)(audioData[i]...
2
public static void main(String[] args) { try { MainMenuUI mainMenu = new MainMenuUI(); boolean exit = false; while (!exit) { int option = mainMenu.firstMenu(); switch (option) { case 1: createInfo(); break; case 2: editInfo(); break; case 3: doLogin(); brea...
8
private double getMatchFactor(int index){ double matchFactor = 0; int j = 1; for (int i = index; i < index+7; i++){ double velocityDiff = this.log.get(i).getVelocity() - this.pattern.get(j).getVelocity(); double logHeadingDelta = this.log.get(i).getHeadingRadians() - thi...
1
private String buildMyUrl(String apilink, String link, int out, String nastavka) { StringBuffer urlBuilder = new StringBuffer(); urlBuilder.append(apilink); urlBuilder.append("format=").append(out==Constants.JSON_FORMAT? "json" : out==Constants.PLAIN_TEXT_FORMAT? "plaintext" : out==Constants.XML_FORMAT? "x...
8
public void tick() { if (input.menu.clicked) game.setMenu(null); if (input.up.clicked) selected--; if (input.down.clicked) selected++; int len = player.inventory.items.size(); if (len == 0) selected = 0; if (selected < 0) selected += len; if (selected >= len) selected -= len; if (input.attack.clicked...
8
private void dropAlarm() { BufferedReader in; try { AlarmListViewHelper helper = (AlarmListViewHelper) dropAlarmComboBox.getSelectedItem(); if(helper == null) return; Alarm a = helper.getAlarm(); DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); in = new BufferedReader...
4
public void actionPerformed(ActionEvent arg0) { if (((JButton) arg0.getSource()).getText().compareTo("start") == 0) { player.setReady(true); } else if (((JButton) arg0.getSource()).getText().compareTo("pause") == 0) { player.rest(); } else if (((JButton) arg0.getSource()).getText().compar...
7
private boolean verifyAddress(String address){ char[] charAdd = address.toCharArray(); char[] invalid = new char[]{'(', ')', '{', '}', '$', ';', '@', ':', '#', '%', '<', '>', '§'}; for (int i=0; i<address.length(); i++) { for (char anInvalid : invalid) { if (charAdd[...
3
@Override public Solution solve(Graph graph, long time, long duration) { // return newGreedy(graph, time, duration); int n = graph.getNodes(); Solution solution = new Solution(n); if (n == 2) { solution.path = new short[] {0, 1}; return solution; } ...
7
public static ListNode reverseKGroup(ListNode head, int k) { if (head==null||k<=1){ return head; } ListNode superHead = new ListNode(0); superHead.next=head; ListNode check = head; ListNode insert = superHead; int count = 1; ArrayList<ListNode>...
6
public static Map<String, Object> getPrimaryKey(Object obj) throws Exception { Map<String, Object> attrs = new HashMap<String, Object>(); String pkName = null; for (Field field : obj.getClass().getDeclaredFields()) { Annotation[] annotations = field.getDeclaredAnnotations(); if (annotations.length > 0 ...
3
public Modelo(Data data) throws IloException, FileNotFoundException { this.data = data; cplex = new IloCplex(); cplex.setOut(new PrintStream("./solution/" + data.filename + ".log")); //decision variable y (integer) y = new IloIntVar[data.nLinks]; for (int i = 0; i < data.nLinks; i++) { Link lin...
7
public void cargarProductos() { try { String sql = "SELECT * FROM productos"; Connection conn = Conexion.GetConnection(); PreparedStatement ps = conn.prepareStatement(sql); pro = ps.executeQuery(); while (pro.next()) { String[] row = ...
2
public boolean stem() { int v_1; int v_2; // (, line 464 // (, line 465 // call more_than_one_syllable_word, line 465 if (!r_more_than_one_syllable_word()) { return false; ...
7
@Override protected void doLoadTestData(StdConverter.Operation oper, File dir) throws Exception { /* First of all, read in all the data, bind to in-memory object(s), * and then (if read test), convert to the specific type converter * uses. */ byte[] readBuffer = new by...
7
@Override public Object esegui() throws ExtraTokenException, OperazioneNonValidaException, ParentesiParsingException, OperandoMissingException, ParsingException, OperatoreMissingException { Token stampa; VarRepository variabili = VarRepository.getInstance(); ArrayList<Token> daStampareProvvisoria = (ArrayList<T...
8
public Object clone() { TicTacToeBoard deepClone = new TicTacToeBoard(); for (int row = 0; row < TicTacToeBoard.SIZE; row++) { for (int col = 0; col < TicTacToeBoard.SIZE; col++) { deepClone.square[row][col] = this.square[row][col]; } } deepClone.turn = this.turn; deepClone.numEmptySquares = this.nu...
2
public static void formatResults(ArrayList<Agent[]> generations, String file) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file, false)); } catch (IOException ex) { ex.printStackTrace(); } int gens = generations.size(); // header for (int i = 0; i < gens; i++) {...
9
private Response sendLimitedRequest(String requestUrl, String requestBody) { //Lock to prevent multiple requests from executing at once rateLock.lock(); try { //Wait (if required) for the request time limit if(limiterEnabled) { try { if(requestQueueShort.size() == limitShort) req...
5
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this); if ((clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavor.stri...
3
@Override protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { DatabaseManager manager=DatabaseManager.getManager(); try { ServletResult.sendResult(response, manager.getRoomDao() .deleteById(Integer.parseInt(request.getParameter(ID)))==1 ? S...
3
private static int getCharWidth(char c) { int charWidth = 5; if(width5.indexOf(c) >= 0) { charWidth = 5; } if(width4.indexOf(c) >= 0) { charWidth = 4; } if(width3.indexOf(c) >= 0) { charWidth = 3; } if(width2.indexOf(c) >= 0) { charWidth = 2; } if(width1.indexOf(c) >= 0) { charWidth =...
5
@Test public void testPlayerCapturesOneFlagAndLastPlayerBoxedIn() throws InvalidActionException { final GameEnded gameEnded = new GameEnded(); game.addEventListener(new Listener() { @Override public void handleEvent(Event event) { if(event.getType() == EventType.END_GAME) gameEnded.setToTrue(...
1