text
stringlengths
14
410k
label
int32
0
9
public void startBoard(Scanner inputReader) { // Asks user for the number of players System.out.println("Welcome to Cludo"); System.out.println("Please enter the number of players (3-6)"); while (inputReader.hasNext()) { int num = inputReader.nextInt(); inputReader.nextLine(); // Checks for a valid nu...
9
public double testMove(Board testBoard, Piece move) { PieceColor myColor = this.player.getColor(); PieceColor theirColor = myColor.getOpposite(); testBoard = testBoard.getDeepCopy(); ArrayList<Piece> validMoves = new ArrayList<Piece>(); ArrayList<Piece> nextValidMoves = new ArrayList<Piece>(); i...
6
public int search(String value) { if (!reversed) { reverse(); } int i = 1; Element tmp = firstElement; while (tmp != null) { if (tmp.getValue().equals(value)) { return i; } tmp = tmp.getNextElement(); i++...
3
public boolean isNearlyLowerHessenberg(double tolerance){ boolean test = true; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ if(i>(j+1) && Math.abs(this.matrix[i][j])>Math.abs(tolerance))test = false; } } ...
4
private void jbHuntGatherKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbHuntGatherKeyPressed if (evt.getKeyCode() == KeyEvent.VK_H) { jbHowToPlayActionPerformed(null); } else if (evt.getKeyCode() == KeyEvent.VK_E) { jbExitActionPerformed(null); } else if (e...
6
SQLExecutor() { readData(); setPassword(); List<String> list = getFileList(); int i; for (i = 0; i < list.size(); i++) { System.out.println(list.get(i)); executeScript(directory + File.separator + list.get(i)); } if (i > 0) { ...
2
protected static ShapePoint makePointForCell(TextGrid.Cell cell, TextGrid grid, int cellWidth, int cellHeight, boolean allRound){ if (DEBUG) System.out.println("Found point at cell "+cell); if(grid.isCorner(cell) && allRound){ return new ShapePoint( cell.x * cellWidth + cellWidth/2, cell.y * cel...
7
public boolean compare (Coord c, float e){ return this.x > (c.x - e) && this.x < (c.x + e) && this.y > (c.y - e) && this.y < (c.y + e); }
3
private void initBlocks(String dir, int initNumberOfBlocks) throws IOException { for (int i = 0; i < initNumberOfBlocks; i++) { freeBlocks.offer(createBlock(i)); blockCount.incrementAndGet(); } activeBlock = freeBlocks.poll(); if (activeBlock == null) { ...
2
private synchronized void fillProductList(Category[] categories) { logger.fine("running fillProductList()"); productList = mdi.getProductsByCategoryPath(categories); String[] header = new String[]{"Produktgruppe", "Artikelnummer", "Artikelbezeichnung"}; List<String[]> rows = new ArrayList<String[]>(); ...
4
private void collision(Rectangle rectSpieler, Rectangle rectangleTmp) { if (rectSpieler.intersects(rectangleTmp)) { Level.run = false; if ((rectangleTmp.x + rectangleTmp.width >= rectSpieler.x) && rectangleTmp.x + rectangleTmp.width <= rectSpieler.x + rectSpieler.width) { this.playerx += 1; }...
9
public void signalSel(int fn) { for (int i = 0; i < 256; i++) { totFreqs[i] = totFreqs[i] + freqs[fn][i]; } fCost = new int[freqs.length]; for (int i2 = 0; i2 < freqs.length; i2 ++) { freqs[i2] = new int[256]; } if (! enCalc) { fCost = new int[freqs.length]; } p...
8
public void go(){ distance = distance + (double)speed/90; speed = speed + acceleration; speedL = speed/10; km_hSpeed = speed * 2; y -= dy; if (speed <= 0) speed = 0; if (speed >= maxSpeed) speed = maxSpeed; if (layerX2 - speed <= 0){ layerX1 = 0; layerX2 = 1100; } else { layerX1 = layer...
9
public static void main(String[] args) throws IOException { long inicio = System.currentTimeMillis(); StringBuilder out = new StringBuilder(); BufferedReader in; File archivo = new File("entrada"); if (archivo.exists()) in = new BufferedReader(new FileReader(archivo)); else in = new BufferedReader(new...
8
public static int getAuctionPrice( int auctionID ) throws DatabaseException { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; int uid, bids; String qGetAuctionPrice = "SELECT currentprice FROM auctionprice WHERE auctionID = ?"; try { conn = DBPool.getInstance().getConnection()...
8
public static OthelloBoardBinary getBoard(long binHasDisk,long binIsBlack, boolean isBattingFirstTurn){ OthelloBoardBinary board = new OthelloBoardBinary(); board.binHasDisk = binHasDisk; board.binIsBlack = binIsBlack; board.isBattingFirstTurn = isBattingFirstTurn; return board; ...
0
public void handleInput() { if (allowClick) { if (game.keybord.singlePress(game.keybord.escape)) { game.log.gsm("[PLAY] Paused"); gsm.setPaused(true); game.jukeBox.play(game.jukeBox.tracks.buttonClick); } if (game.debug) { if (game.keybord.singlePress(game.keybord.f12)) { game.player.se...
4
public void processGuess(EventArgs e) { JQuery stats = $$(JQuery.class, "stats"); TextBox guessEntryField = $$(TextBox.class, "guessEntryField"); int guess; try { guess = Integer.parseInt(guessEntryField.getValue()); } catch (NumberFormatException ex) { J...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof ILerngruppe)) return false; ILerngruppe other = (ILerngruppe) obj; if (name == null) { if (other.getName() != null) return false; } else if (!name.equals(other.get...
6
protected synchronized void handleRecieveBlock(Block block) { System.out.println("block recieved!"); // here goes the code to handle the block broadcast // get the block , add it to the tree SignedBlock sb = (SignedBlock)block; try { this.blockTree.addBlock(sb); // generate a diag...
3
public String toXML() { Error error = getError(); if(error != null) { return error.toXML(); } StringWriter sw = new StringWriter(); String xml = ""; try { JAXBContext context = JAXBContext.newInstance(this.getClass()); Marshaller marshaller = context.createMarshaller(); marshaller.m...
2
private void turn(char turnDirection) { if (turnDirection == 'L') { setFacing(getFacing() - 1); } else if (turnDirection == 'R') { setFacing(getFacing() + 1); } //keeps the directional constants within the bounds if (getFacing() < NORTH) { ...
4
private ByteBuffer Read(int i) { ByteBuffer out_buf = ByteBuffer.allocate(i); byte buf[] = new byte[i]; int len = 0; while (len < i) { try { len += in_s.read(buf,0,i); } catch (Exception e) { System.out.println("Read error: " +...
3
@Override //public int getDistribution(double standardDeviation) public int getDistribution() { //keeps track of packets created int PacketCounter = 0; while (PacketCounter < NumberOfPackets) { int val = (int) (mean + standardDeviation * rand....
1
public static void main(String[] args) { for (int gCount = 0; gCount <= 2000000; gCount++) { ArrayList<Hand> Hands = new ArrayList<Hand>(); Deck d = new Deck(); for (int hCnt = 0; hCnt <= Hands.size(); hCnt++) { Hand h = new Hand(d); h.EvalHand(); Hands.add(h); } Collections.sort(Hands,...
3
public int getColonnes() { return Integer.parseInt(vTxtColonnes.getText()); }
0
public static void main(String[] args){ System.out.println("Enter an int > 3: size of the track"); Scanner s = new Scanner(System.in); int trackSize = s.nextInt(); System.out.println("track Size: " + trackSize); DogTrack d = new DogTrack(trackSize); d.playGame(); ...
0
public Peer(String ip, int port, ByteBuffer peerId) { this.ip = ip; this.port = port; this.hostId = String.format("%s:%d", ip, port); this.setPeerId(peerId); }
0
public static Settings getInstance() { if (instance == null) instance = new Settings(); return instance; }
1
public void assignAmusementParkTickets(int day) { // LIst to store interested clients and their respective values List<ClientValuePair> amusementParkInterest = new ArrayList<ClientValuePair>(); // Find each customer that could use an alligator ticket that day for (int ii = 0; ii < 9; ii++) { if (ii < 8) { ...
9
private void GameLoop() { long visualizingTime = 0, lastVisualizingTime = System.nanoTime(); long beginTime, timeTaken, timeLeft; while(true) { beginTime = System.nanoTime(); switch (gameState) { case R...
8
public String getFossil() { return this.fossil; }
0
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equal...
6
private boolean clickedOnKingPile(MouseEvent e) { //Beautiful return e.getX() >= X_BOARD_OFFSET + CARD_WIDTH + CARD_X_GAP && e.getX() <= X_BOARD_OFFSET + CARD_WIDTH * 2 + CARD_X_GAP && e.getY() >= Y_BOARD_OFFSET && e.getY() < Y_BOARD_OFFSET + CARD_HEIGHT * 4 + CARD_Y_GAP * 3; }
3
* @param high: last index of the object list. * @return: index of the pivot element. */ int partition(int low, int high){ int i = low, j = high + 1, mid = (high - low) / 2; // Find the pivot object's index int pivotIndex = findPivot(low, mid, high); // Swap element at 'low' with pivot T pivot = this....
6
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed char letraActual = 0; char letraObjetivo = (campoLetra.getText().charAt(0)); textArea.setText(""); if(letraObjetivo >= 'a' && letraObjetivo <= 'z') { letraActual = ...
6
public static String cleanString(String str) { Transliterator accentsconverter = Transliterator.getInstance("Latin; NFD; [:Nonspacing Mark:] Remove; NFC;"); str = accentsconverter.transliterate(str); //the character ? seems to not be changed to d by the transliterate function StringBuffer cleanedStr = new...
9
@Override public final void repair() { final String baseValue = this.main.getConfigValue(Main.GLOBAL_SECTION, Main.PATH_KEY, null); if (baseValue == null) { System.out .println("Unable to determine base - The local repository could not been deleted"); return; } final Path base_ = Path.getPath(ba...
5
private void sendLogs_settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendLogs_settingsButtonActionPerformed if (debug) logger.log(Level.DEBUG, "Setting preference \"sendLogs\" from " + settings.sendLogs() + " to " + sendLogs_settingsButton.isSelected()); ...
1
public boolean insert(DataRow row) { if(!checkUser()) { return false; } DataRow parameter = new DataRow(row.getAttribute("name").getValue()); parameter.setTableName(row.getTableName()); parameter.addAttribute("userName", getUserName()); if(!select(...
7
private ListNode merge2(ListNode l1, ListNode l2) { ListNode header = null; ListNode last = null; ListNode cur = null; ListNode n1 = l1; ListNode n2 = l2; if (n1 == null) { return n2; } if (n2 == null) { return n1; } while (n1 != null && n2 != null) { if (n1.val>n2.val) { cur = new List...
8
public static boolean hasSurf(Pokemon[] pokemon) { for (Pokemon aPokemon : pokemon) { if (aPokemon != null) { for (int j = 0; j < 4; j++) { if (aPokemon.move[j] == Pokemon.Move.SURF) return true; } } } ...
4
public boolean copy(File src, File dst){ try { // Copies src file to dst file. // If the dst file does not exist, it is created InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); // Transfer bytes from in to o...
3
public boolean isDelete() { return !(myAdd || myChange); }
1
public Class<?> getColumnClass(int column) { switch (column) { case 0: return ImageIcon.class; case 3: return Long.class; case 4: return Date.class; case 5: case 6: case 7: case 8:...
9
Point3f getMax() { if (max == null) max = new Point3f(); if (list.isEmpty()) { max.set(0, 0, 0); return max; } Object3D c = list.get(0); max.x = c.getMaxX(); max.y = c.getMaxY(); max.z = c.getMaxZ(); synchronized (list) { int n = count(); if (n > 1) { for (int i = 1; i < n; i++) { ...
7
void chooseMaxSufferage() { /* Find the min makespan in one class, and then find the max one */ double tmpMinMakespan = Double.MAX_VALUE; double tmpSecondMinMakespan = Double.MAX_VALUE; double tmpMaxSufferage = -1; int iTmpMinClass = 0; int iTmpMinSite = 0; int iTmpMinCPU = 0; iMinClass = -1; iMinSi...
7
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { leftPressed = false; }if (e.getKeyCode() == KeyEvent.VK_A) { leftPressed = false; } if (e.getKeyCode() == KeyEvent.VK_RIGHT) { rightPressed = false; }if (e.getKeyCode() == KeyEvent.VK_D) { rightPressed = false; } ...
9
public void setHidden( boolean b ) { int h = 0; if( b ) { h = Boundsheet.HIDDEN; } mysheet.setHidden( h ); if( mysheet.getSheetNum() == 0 ) { try { Boundsheet s2 = mybook.getWorkSheetByNumber( mysheet.getSheetNum() + 1 ); mybook.setFirstVisibleSheet( s2 ); } catch( WorkSheetNotFoun...
6
@Override public int compareTo(VersionWebsiteCompare that) { if(that == null) return 1; String[] thisParts = this.get().split("\\."); String[] thatParts = that.get().split("\\."); int length = Math.max(thisParts.length, thatParts.length); for(int i = 0; i < length; i+...
6
private static void assertFullConsumption(Object obj, JsonReader reader) { try { if (obj != null && reader.peek() != JsonToken.END_DOCUMENT) { throw new JsonIOException("JSON document was not fully consumed."); } } catch (MalformedJsonException e) { throw new JsonSyntaxException(e); ...
4
public MacroStatement(SourceFile sourceFile, int lineNo, Token[] definition, Token[][] body) throws SyntaxError { super(sourceFile, lineNo, definition); if(!definition[0].is(TokenType.MACRO_START)){ throwSyntaxError(0, "Not a macro"); } if(!body[body.le...
7
@Override public void deserialize(Buffer buf) { requestId = buf.readUByte(); if (requestId < 0 || requestId > 255) throw new RuntimeException("Forbidden value on requestId = " + requestId + ", it doesn't respect the following condition : requestId < 0 || requestId > 255"); contac...
3
private void initializeEmptyBoard() { for (int i = 0; i < board.length; i++) { board[i] = new ChessPiece[SIDE]; } }
1
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new FileReader("in.in")); perdedores = new ArrayList<String>(); od1enses = new ArrayList<String>(); for (String line; (line=in.readLine())!=null;) { od1enses.add(line); } vo = new boolean[od1enses.size()]; ...
7
public static Polynomial rootsToPoly(double[] roots){ if(roots==null)return null; int pdeg = roots.length; double[] rootCoeff = new double[2]; rootCoeff[0] = -roots[0]; rootCoeff[1] = 1.0; Polynomial rPoly = new Polynomial(rootCoeff); ...
2
static private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { cas...
8
private void populateDataSecondPass(String assemblyLine) throws AssemblerException { insNumber++; boolean legitIntDataLine = Pattern.matches( "[A-Za-z0-9]+\\s+[0-9]+MAU\\s+[^\\s]+", assemblyLine); boolean legitAsciiDataLine = Pattern.matches( "[A-Za-z0-9]+\\s+.ascii\\s+\".+\"", assemblyLine); boolea...
7
public boolean permittedTypeDamage(LifeType... entTypes) { /** * @if Confere se foi passado duas entidades ou uma entidade para o * método. * * Caso for passado dois então o método vai ser utilizado para * comparar a possibilidade de tirar vida em uma colisão de duas * entidades. ...
8
private void resizeImage() { int h = image.getH(); int w = image.getW(); if(h % 8 == 0 && w % 8 == 0) { System.out.println("Image does not need resizing."); wasResized = false; return; } wasResized = true; if(h % 8 != 0) { h += 8 - (h % 8); } if(w % 8 != 0) { w += 8 - ...
6
@Override public final void testIgnored(Description description) throws Exception { super.testIgnored(description); selectListener(description).testIgnored(description); }
0
public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption("min", options); if (tmpStr.length() != 0) setMinThreshold(Double.parseDouble(tmpStr)); else setMinThreshold(-Double.MAX_VALUE); tmpStr = Utils.getOption("min-default", options); ...
9
public String moveCardOntoCardFromDeck(int boardIndexTo) { if (boardIndexTo == 0) { //Moving onto dragon's tail, anything goes. board.get(0).add(deck.poll()); return ""; } else { String result = moveCardOntoCard(Arrays.asList(deck.peek()), boardIndexTo, 0)...
2
public boolean isStalemated(boolean isWhite) { Piece piece = null; int row = 0; int col = 0; int numMoves = 0; boolean result = false; Piece king = null; ArrayList<Move>legalMoves = new ArrayList<Move>(); while (row < 8 && numMoves == 0) { col = 0; while (col < 8 && numMoves == 0) { piece = bo...
9
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int curr = 0; int untreated = 0; while(n-->0){ int t = in.nextInt(); if(t<0){ if(curr <= 0) untreated++; else curr-=1; } else { curr+=t; } } System.out.println(untreated);...
3
private static boolean equals(byte[] a1, int offs1, byte[] a2, int offs2, int num) { while (num-- > 0) { if (a1[offs1++] != a2[offs2++]) { return false; } } return true; }
2
public static void main(String[] args) { final double STARTRATE = 10; final int NRATES = 6; final int NYEARS = 10; // set interest rates to 10 . . . 15% double[] interestRate = new double[NRATES]; for (int j = 0; j < interestRate.length; j++) interestRate[j] = (STARTRATE...
7
public static void isNested(String arg[]){ char [] p = { '(','(','(', ')', '(', ')', ')', '(', ')'}; Stack<Character> openP = new Stack<>(); boolean malformed; int count = 0; for(char c : p){ if(c=='('){ count++; openP.push(c); ...
5
private static void matchRoles() { final ArrayList<Player> matched = new ArrayList<Player>(); final int maxtraitors = TIMV.config.getInt("MaxTraitors"); final int maxdetectives = TIMV.config.getInt("MaxDetective"); final Random r = new Random(); for (final Player player : Bukkit.getOnlinePlayers()) { if (!...
9
public ReleaseType getLatestType() { this.waitForThread(); if (this.versionType != null) { for (ReleaseType type : ReleaseType.values()) { if (this.versionType.equals(type.name().toLowerCase())) { return type; } } } ...
3
public void testToStandardWeeks_months() { Period test = Period.months(1); try { test.toStandardWeeks(); fail(); } catch (UnsupportedOperationException ex) {} test = Period.months(-1); try { test.toStandardWeeks(); fail(); ...
2
public static int weightingMerge(int value) { /* if (value >= 2048) return value * 20; if (value >= 512) return value * 12; if (value >= 128) return value * 8; if (value >= 32) return value * 4; */ return value; }
0
public void restoreIpAddressesHelper(String s, int index, StringBuilder sb, ArrayList<String> result, int counter) { // StringBuilder sbLocal = new StringBuilder(); if (counter > 4) {// to speed up return; } if (index >= s.length()) { if (counter == 4) { sb.deleteCharAt(sb.length() - 1);// delete '...
9
public static boolean isValidVector(Vector4f vector) { if (vector == null) return false; if (Float.isNaN(vector.x) || Float.isNaN(vector.y) || Float.isNaN(vector.z)|| Float.isNaN(vector.w)) return false; if (Float.isInfinite(vector.x) || Float.isInfinite(vector....
9
public void countDiffPixels() { if (image1 == null || image2 == null) { return; } int w1 = image1.getWidth(); int h1 = image1.getHeight(); int w2 = image2.getWidth(); int h2 = image2.getHeight(); int wmax = ...
9
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TaxonObservationFilter)) { return false; } TaxonObservationFilter other = (TaxonObservationFilter) object; if (...
5
private void ButtonRapportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonRapportActionPerformed int idd = (int) jTable3.getModel().getValueAt(jTable3.getSelectedRow(), 0); String pattern = null; String path; FileNameExtensionFilter filter = new FileNameExtension...
5
public void run() { if (!this.player.isOnline()) return; if (!this.player.hasPermission("vijoslogin.login") && player.isOnline()) { player.kickPlayer("\u00A7a[GeoPalz]\u00A7f \u00A7cIncorrect permissions!\u00A7f"); } if (this.getLogin()) { VijosLogin.i().sendLoginMessage(this.player); } }
4
public void matchesAbstract() { Filter isAbstract = isAbstract(); assert isAbstract.matches( AbstractFilter.class ); assert !isAbstract.matches( Filter.class ); }
0
public static void startupSystems() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if (S...
7
private boolean jj_3R_94() { if (jj_3R_72()) return true; return false; }
1
private static void method499(char ac[]) { boolean flag = true; for (int j = 0; j < ac.length; j++) { char c = ac[j]; if (isLetter(c)) { if (flag) { if (isLowerCaseLetter(c)) flag = false; } else if (isUpperCaseLetter(c)) ac[j] = (char) ((c + 97) - 65); } else { flag = true; ...
5
@Override public <T> void update(Class<T> clazz, Long id, Map<String, String[]> valuesOfFields) { if (dao.getObject(clazz, id) == null){ throw new RuntimeException("Object not found"); } if (clazz == Faculty.class){ addFaculty(valuesOfFields, id); ...
2
public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.magenta); int tileSize = parent.tilePanel.getTileSize(); //fill rect by tilemap width (tileID[0]) and tilemap height (tileID[0][0]) g.fillRect(0, 0, tileID[0].length * tileSize...
9
private void show(String[] data){ String option = null; try { option = data[1].toLowerCase(); } catch(Exception e){ System.out.println("Invalid command! Try to input command once more!"); return; } switch(option){ case "all": if(container.isEmpty()) System.out.println("List of employees is em...
5
public void render(){ if(Game.UI.getSelectedEntity() != null && Game.UI.getSelectedEntity() == this){ GL11.glColor3d(1,0,0); }else{ GL11.glColor3d(1,1,1); } }
2
public static Line2D.Double longestVectorWithSignalStrength(List<Measurement> measurements, int threshold) { int strongestPos = -1; HashSet<Integer> items = Generate.randomInts(threshold, measurements.size(), null); for(int i : items) { if(strongestPos < 0) { strongestPos = i; continue; } if(mea...
9
public void creaXLS(HttpServletResponse response) throws ServletException, IOException { ConexionBD bd = new ConexionBD(); ArrayList<Equipo> equipos = bd.reportes(marca, numero, familia, tipoEquipo, fechai, fechaf, departamento, ubicacion, responsable, estado); response.setContentType("applicati...
1
public static void writeHaploStructFiles(String fName, PopulationData popdata) throws IOException { PrintWriter hsa = new PrintWriter( new BufferedWriter(new FileWriter(fName+".hsa"))); PrintWriter hsb = new PrintWriter( new BufferedWriter(new FileWriter(fName...
8
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 void removeBomb(Bomb b) { soundBomb.play(1, 0.3f); boolean hitWallNorth=false, hitWallEast=false, hitWallWest=false, hitWallSouth=false; bombs.remove(b); b.getTile().setBurning(); int tilex = b.getTile().getGridx(); int tiley = b.getTile().getGridy(); int bombSize = b.getBombSize(); /* Handles t...
6
private void closeRequest(OnDemandData onDemandData) { try { if (socket == null) { long l = System.currentTimeMillis(); if (l - openSocketTime < 4000L) return; openSocketTime = l; socket = clientInstance.openSocket(43594 + Client.portOffset); inputStream = socket.getInputStream(); outp...
7
@Override public void run() { CImedWrapper wrapper = new CImedWrapper(this.getProxy(), this.getUsername(), this.getPwd()); boolean bServiceAvailable = false; boolean bReportingAvailable = false; try{ bServiceAvailable = wrapper.CheckServiceAvailable(); LOGGER.debug("Service Available"+b...
3
public boolean shiftOmino(int ominoIndex, Direction direction) { Omino omino; Set<Tile> borderCheck; Tile translation; if(ominoIndex < 0 || ominoIndex >= pieceOrder.size()) return false; omino = pieceOrder.get(ominoIndex); switch (direction) { case UP: borderCheck = omino.getBorderUp(); translat...
8
public void testFactory_FromDateFields_null() throws Exception { try { LocalTime.fromDateFields((Date) null); fail(); } catch (IllegalArgumentException ex) {} }
1
@Override public void run(){ while (true) { this.ms.execForAbonent(this); this.ticksAfterLastLotClosing++; if(this.ticksAfterLastLotClosing == CLOSE_TICKETS_EVERY_X_TICKS){ this.closeLotsByTimeService(); this.ticksAfterLastLotClosing = 0; ...
3
public void setCreature(ICreature creature) { if (creature != null) { textArea.setText(creature.toString()); } else { textArea.setText(null); } }
1
@Override public void onClick(ClickEvent event) { if (!imgSelected) { final String url = Window.prompt("URL", ""); if (url != null && !url.trim().isEmpty()) { execute(new Command() { @Override public void execute() { inserter.insert(currentSurface.getSelection()...
8
private static int getPoint(int point, int eps, int max) { if (point + eps >= 0 && point + eps < max) { return point + eps; } if (eps > 0) return getPoint(point, eps - 1, max); return getPoint(point, eps + 1, max); }
3
public static String substringAfter(String sourceStr, String expr) { if (isEmpty(sourceStr) || expr == null) { return sourceStr; } if (expr.length() == 0) { return sourceStr; } int pos = sourceStr.indexOf(expr); if (pos == -1) { return sourceStr; } return sourceStr.substring(pos + expr.length(...
4