text
stringlengths
14
410k
label
int32
0
9
public int getScore(String s, int boardSize) { switch (s.length()) { case 0: case 1: case 2: return 0; case 3: return boardSize <= 4 ? 1 : 0; case 4: return 1; case 5: return 2; case 6: return 3; case 7: return 5; ...
9
@Override protected void Poll() { //if the robot re-oriented itself, cached sine and cosine values need to be re-calculated double rotation = m_robot.GetTransformedData().GetRotation() + m_rotation; if (Math.abs(rotation - m_cacheNetRotation) > PhysicsModel.EPSILON) { m_cacheNetRotation = rotation; m_ca...
9
public static void main(String[] args) { int i; float inputs06[] = { 20, 22, 21, 24, 24, 23, 25, 26, 20, 24, 26, 26, 25, 27, 28, 27, 29, 27, 25, 24 }; float inputs10[] = { 20, 22, 24, 25, 23, 26, 28, 26, 29, 27...
4
@Override public void actionPerformed(ActionEvent arg0) { switch(arg0.getActionCommand()) { case ButtonNames.NEWOBJBUTTON: { new ObjCreateDialog(this).setVisible(true); } } }
1
private void exitOnGLError(String errorMessage) { int errorValue = GL11.glGetError(); if (errorValue != GL11.GL_NO_ERROR) { String errorString = GLU.gluErrorString(errorValue); System.err.println("ERROR - " + errorMessage + ": " + errorString); if (Display.isCreated()) Display.destroy(); System.e...
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
private void setToBlack(byte[] buffer, int lineOffset, int bitOffset, int numBits) { int bitNum = (8 * lineOffset) + bitOffset; int lastBit = bitNum + numBits; int byteNum = bitNum >> 3; // Handle bits in first byte int shift = bitNum & 0x7; if (shift > 0) { int maskVal = 1 << (7 - shift); byte v...
5
public void testBlackCount() { List<AnswerCombination> combinations = generateAnswerCombinationList(); assertEquals(0, combinations.get(0).getBlackCount()); assertEquals(1, combinations.get(1).getBlackCount()); assertEquals(2, combinations.get(2).getBlackCount()); assertEquals(3, combinations.get(3)...
0
public void setTipo(PTipo node) { if(this._tipo_ != null) { this._tipo_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
3
private void addValueElement( final String element, final String name, final String desc, final String value) { AttributesImpl att = new AttributesImpl(); if (name != null) { att.addAttribute("", "name", "name", "", name); } if (desc != nul...
3
public static void rezeptAuswahlKommentar(List<Rezept> rezeptList, Marshaller marshaller , Rezepteseite rezepteseite) throws JAXBException, FileNotFoundException{ int rnr, rnr2; // Rezeptauswahl, anschliessend kommentieren starten // Menüaufbau System.out.println(); System.out.println("Geben sie die Re...
7
@BeforeClass public static void setUpBeforeClass() { try { String localTestProperty = System .getProperty(BookStoreConstants.PROPERTY_KEY_LOCAL_TEST); localTest = (localTestProperty != null) ? Boolean .parseBoolean(localTestProperty) : localTest; if (localTest) { CertainBookStore store = new C...
3
public void paint(Graphics g) { // draw main backgdound g.drawImage( Asset.boardlg.getImage() , Asset.boardlg.getPosition().getX(), Asset.boardlg.getPosition().getY(), this); // draw bet backgroud if ( game.getSetting().getGameState() == Setting.GAME_STATE.BET ) drawBet(g...
8
public void step() { for(int x = 0; x < xSize; x++) { for(int y = 0; y < ySize; y++) { grid[x][y].grow(); // YOU WILL NEED TO IMPLEMENT GROW() YOURSELF. } } Collections.shuffle(agents); for(int a = agents.size()-1; a >= 0; a--) { Agent agent = agents.elementAt(a); agent.act(); ...
3
public boolean setUserlistImageFrameWidth(int width) { boolean ret = true; if (width <= 0) { this.userlistImgFrame_Width = UISizeInits.USERLIST_IMAGEFRAME.getWidth(); ret = false; } else { this.userlistImgFrame_Width = width; } setUserlistIm...
1
boolean contains(int x, int y) { return y > y0 && y < (y0 + height) && x > x0 && x < (x0 + width); }
3
public void sendMessage(ChatMessage msg) { //permet de mettre en forme les messages et de les envoyer try { msg.setSender(username); msg.setPassword(serverKeys.encrypt(clientUI.getPassword()).toString()); msg.setTimeStamp(simpleDate.format(new Date()).toString()); if (msg.getMessage().length() > 1 &&...
7
public static void fizzbuzz(Integer n) { for (int i = 1; i <= n; i++) { if (i % 3 == 0) { if (i % 5 == 0) System.out.println("FizzBuzz"); else System.out.println("Fizz"); } else if (i % 5 == 0) System.out.println("Bu...
4
public String convertFromCell(HSSFCell cell){ Object data = null; int dataType = cell.getCellType(); switch(dataType){ case HSSFCell.CELL_TYPE_NUMERIC: data = cell.getNumericCellValue(); break; case HSSFCell.CELL_TYPE_STRING: ...
3
@Override public void mouseReleased(MouseEvent arg0) { if (StorageUnitDisplayPanel.this.displayMode != DisplayMode.FULL) { StorageUnitDisplayPanel.this.fireClick(); return; } int y = arg0.getY(); if (StorageUnitDisplayPanel.this.storageUnit != null) { int height = StorageUnitDisplayPanel.this....
5
public void putAll( Map<? extends Double, ? extends V> map ) { Iterator<? extends Entry<? extends Double,? extends V>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Double,? extends V> e = it.next(); this.put( e.getKey(), e.getValue() ); ...
8
public static void removeCopy(int copyId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedState...
4
private void execSQLWrapper(String query) throws SPARULException { try { execSQL(query); } catch (Exception e) { String expMessage = e.toString(); // This means that VOS is probably down if (expMessage.contains("Broken pipe") || expMessage.contains("Virtu...
7
public void passKeyReleasedInpute(ArrayList<KeyButtons> keyPressed) { switch (whatcha) { case PLAYING: stage.handleReleasedKeys(keyPressed); break; case SELECTSTAGE: stageSelector.handleReleasedKeys(keyPressed); ...
2
public static void main(String[] args) { FoneApiClient client = new FoneApiClient( "http://foneapi_server/api/1.0/switch", "****************************", "****************************"); CommandResponse response = client.dial(eDialDestinationType.number, "5551234567", "htt://your_server/location_of...
1
private void saveSong() { try { FileChooser f = new FileChooser(); f.setInitialDirectory(new File(System.getProperty("user.dir"))); f.setInitialFileName(controller.getNameTextField().getText() + ".txt"); f.getExtensionFilters().addAll( ...
4
public void saveToFile() { File f = location; File dir = f.getParentFile(); if (!dir.isDirectory()) { dir.mkdirs(); } if (f.isFile()) { f.delete(); } try { BufferedWriter output = new BufferedWriter(new FileWriter(f)); output.write("### Savefile used for the application. Version: 2\n"); ...
5
public V get(K key) { int internalKey = generateKey(key); int count = 0; while (array[internalKey] != null && count < size) { if (array[internalKey].getKey().equals(key) && array[internalKey].hashCode() == internalKey) return array[internalKey].getValue(); internalKey++; count++; if (intern...
5
public boolean contains(String key) { return get(key) != null; }
0
public boolean isOutOfBounds(int x, int y, int xMin, int yMin, int xMax, int yMax) { if(x <= xMin || x >= xMax+xMin) return true; if(y <= yMin || y >= yMax+yMin) return true; return false; }
4
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
7
private static void findPairIntersections() { for (Pair p1 : values) { Card[] c1 = p1.cards; int i1 = p1.ordinal; for (Pair p2 : values) { int i2 = p1.ordinal; Card[] c2 = p2.cards; intersectsPair[i1][i2] = false; if(c1[0] == c2[0]) intersectsPair[i1][i2] = true; if(c1[0] == c2[1]) inters...
6
@Override public int getValues(Component target, int tweenType, float[] returnValues) { switch (tweenType) { case X: returnValues[0] = target.getX(); return 1; case Y: returnValues[0] = target.getY(); return 1; case XY: returnValues[0] = target.getX(); returnValues[1] = ta...
7
public void renderMeanForce(Graphics2D g) { if (!showFMean) return; if (aQ == null || aQ.isEmpty()) return; if (outOfView()) return; float x = aQ.getQueue1().getAverage(); float y = aQ.getQueue2().getAverage(); if (Math.abs(x) <= ZERO && Math.abs(y) <= ZERO) return; g.setColor(getView().getBac...
7
public Map<String, String> getDirectoriesAndDestinations() { final File sourceDirectory = new File(source.getDirectory()); // Scan for directories final DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(sourceDirectory); scanner.setIncludes(source.getIncludes().toAr...
4
public void encryptOrDecrypt(String key, int mode, InputStream is,OutputStream os) throws Throwable { DESKeySpec dks = new DESKeySpec(key.getBytes()); SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); SecretKey desKey = skf.generateSecret(dks); Cipher cipher = Cipher.getInstance("DES"); // DES/ECB/PK...
2
private void ExecuteInternal() { try { Reset(); if(m_CurrentLM == null) return; long botY = PopScanbeam(); do { InsertLocalMinimaIntoAEL(botY); m_HorizJoins.clear(); ProcessHorizontals(); long topY = PopScanbeam(); ProcessIntersections(botY, topY); ProcessEdgesAtTopOfScanbeam(t...
8
@Override public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) { if (argumentList.size() > 0) { UserInterface.println("This command takes no arguments."); HelpCommand.displayHelp(this); return false; } return true; }
1
public static ActionsFunction getActionsFunction() { if (null == _actionsFunction) { _actionsFunction = new SudokuActionsFunction(); } return _actionsFunction; }
1
protected GameState findSetToTrue(GameState state, Card card) { //Check the hand for(Card c : state.getPlayer(card.getFaction()).getHand()) { if(c.equals(card)) { state.getPlayer(card.getFaction()).removeFromHand(c); c.setTrue(state.getTime()); state.getPlayer(card.getFaction()).addToHand(c); ...
8
public static Main getInstance() { return instance; }
0
private void promoteUser(ChangeRolePacket r) { OperationStatusPacket opStat; int flag = OperationStatusPacket.SUCCESS; User sender = null; User affected = null; for (User u : users.keySet()) { if(u.getID() == r.getSenderID()) { ...
8
private void handleKeyboardInput() { final boolean leftPressed = Keyboard.isKeyDown(Keyboard.KEY_LEFT); final boolean rightPressed = Keyboard.isKeyDown(Keyboard.KEY_RIGHT); final boolean returnPressed = Keyboard.isKeyDown(Keyboard.KEY_RETURN); if (!Commons.get().isKeyPressed()) { if (leftPressed || rightPres...
9
public Inventory solveFractional() { int availableCapacity = capacity; ArrayList<Double> amounts = new ArrayList<Double>(); if (availableCapacity <= 0) { return new Inventory(this, amounts); } for (Item i : items) { if (availableCapacity < i.getWeight()) {...
3
public synchronized void addListener(final CycLeaseManagerListener cycLeaseManagerListener) { //// Preconditions if (cycLeaseManagerListener == null) { throw new InvalidParameterException("cycLeaseManagerListener must not be null"); } if (listeners.contains(cycLeaseManagerListener)) { throw ...
3
public void destroy () { assert (!plugged); if (handle != null) { try { handle.close(); } catch (IOException e) { } handle = null; } }
2
public void render() { gc.art.fill(width, height, 0, 0, 0xFF000000); if (level != null) level.render(gc.art); }
1
private void update() { for (turn = 1; turn <= MAXTURNS; turn++) { while(isPaused) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } for (Ant ant : ants) { if (ant.isAlive()) { if (ant.getResting() > 0) { ant.setResti...
9
public static void main(String[] args) { String line = ""; String message = ""; int c; try { while ((c = System.in.read()) >= 0) { switch (c) { case '\n': if (line.equals("go")) { PlanetWars pw = new PlanetWars(message); DoTurn(pw); pw.FinishTurn(); message = ""; } e...
4
public static byte[] toByteArray(Object o){ try{ ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; out = new ObjectOutputStream(bos); out.writeObject(o); byte[] yourBytes = bos.toByteArray(); try{ bos.close(); out.close(); }catch(Exception e){System.out....
2
public Set<TrapezoidLine> naiveMap(int height, int width) { Set<TrapezoidLine> trapezoidMap = new HashSet<TrapezoidLine>(); // Add the borders of the window as temporary shapes Shape border = new Shape(); Shape border2 = new Shape(); border.getPoints().add(new Point(0, 0)); border.getPoints().add(new Poi...
9
public void execute(String[] args) throws Exception { processArguments(args); if (objectName == null) throw new CommandException("Missing object name"); MBeanServerConnection server = getMBeanServer(); MBeanInfo mbeanInfo = server.getMBeanInfo(objectName); MBeanAttributeInfo[...
9
public Capabilities getCapabilities() { Capabilities result; Capabilities classes; Iterator iter; Capability capab; if (getFilter() == null) result = super.getCapabilities(); else result = getFilter().getCapabilities(); // only nominal and numeric classes allowed ...
8
public static CustomButton doPathBrowseButton(final JTextArea textToUpdate) { final JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); final CustomButton a = new CustomButton("browse"); a.addActionListener(new ActionListener() { @Override public void actionPerfor...
1
public static int[][] createInverseLookupTable(int[] chars) { int[][] tables = new int[256][]; for (int i = 0; i < 256; i++) { int c = chars[i]; if (c > -1) { int high = (c >>> 8) & 0xFF; int low = c & 0xFF; int[] table = tables[hig...
4
public void start() { running = true; t = new Thread(new Runnable() { @Override public void run() { try { serverSocket = new ServerSocket(10188); } catch (IOException e) { System.err.println("Could not listen on port: 10188 (is it in use?."); e.printStackTrace(); } try { c...
9
public void encode_ascii(String encoded_string) throws IOException { File op = new File("output.txt"); n=0; BufferedWriter bw = new BufferedWriter(new FileWriter(op)); String temp=String.valueOf(encoded_string.charAt(0)); for(int i=1;i<encoded_string.length();i++) ...
4
@Override public void execute(MapleClient c, MessageCallback mc, String[] splitted) { if (splitted[0].equals("startProfiling")) { CPUSampler sampler = CPUSampler.getInstance(); sampler.addIncluded("net.sf.odinms"); sampler.start(); } else if (splitted[0].equals("stopProfiling")) { CPUSampler sampler = ...
5
public void setPlayers(ArrayList<Player> players, boolean resetGame) { if (players.size() <= 0) { players.add(new HumanPlayer()); players.get(0).setName("Nope. Nope. Nope."); } if (resetGame || players.size() != this.players.size()) { this.players = players; ...
4
private void declarationList() { while (have(NonTerminal.DECLARATION_LIST)) { declaration(); } }
1
public static Element createProductionElement(Document document, Production production) { Element pe = createElement(document, PRODUCTION_NAME, null, null); pe.appendChild(createElement(document, PRODUCTION_LEFT_NAME, null, production.getLHS())); pe.appendChild(createElement(document, PRODUCTION_RIGHT_NAME...
0
private void testConflict(final ChangedFile c) { if (this.checkedInFiles.isEmpty()) { readCache(); } final String filename; { final int offset = c.s.lastIndexOf('/'); if (offset < 0) { filename = c.s; } else { filename = c.s.substring(offset + 1); } } final String filenameRemove = thi...
6
public static void main(final String[] args) { try { // load mysql jdbc driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB Importer.connect = DriverManager.getConnection("jdbc:mysql://localhost/" + props.getString(Importer.MOVIEDB_KEY) + "?user=" + props.getString(Im...
9
private LinkedList<Actor> removeDuplicateActors(LinkedList<Actor> actors) { if (((actors.get(2).getName().equals(actors.get(1).getName())) && (actors .get(2).getBirthday().equals(actors.get(1).getBirthday()))) || ((actors.get(2).getName().equals(actors.get(0).getName())) && (actors .get(2).getBirthday().equals...
6
@Override public void mouseClicked(final MouseEvent e) { this.e = e; player.setActivityTimer(1000); //if(player.getActivityTimer()==0){ new Thread(new Runnable(){ @Override public void run() { ToiletOverlay overlay = (ToiletOverlay)((JLabel) e.getSource()).getParent(); ov...
6
@Test public void testInsertAndDeleteOfArrays() throws Exception { PersistenceManager pm = new PersistenceManager(driver,database,login,password); for(int x = 0;x<10;x++) { //insert 10 objects for(int t = 0;t<10;t++) { ObjectArrayContainingObject aco = new ObjectArrayContainingObject(); aco.se...
3
public static void main(String[] args){ //Local var declaration Scanner sc = new Scanner(System.in); String src,dst; if(args.length < 2){ //User inout interface System.out.println("=============================================="); System.out.p...
7
public void mouseReleased(MouseEvent e) { removeMouseMotionListener(this); if (creationLien && enabled) { creationLien = false; ZElement cibleLien = chercheElement(e.getX(), e.getY()); if (cibleLien != null) { lienTemp.setElement(cibleLien, Consta...
9
private static void initializePhiGrid() { // Defines the phis across the grid scalePhisHere = new ArrayList<ArrayList<Double>> (); int numGridLines = getNumGridlines(); double scaleNormalizer = Math.pow(2, Settings.startLevel/2.0); double i1 = Settings.getMinimumRange(); // Loop across the gridline...
6
public String toString() { int i, spaces; boolean longParam = false; StringBuilder buf = new StringBuilder(100); buf.append(" "); buf.append(arg); spaces = 20 - arg.length(); if (spaces <= 0) { sp...
6
public void removeAllListeners() { Object[] listenerArray = listeners.getListenerList(); for (int i = 0, size = listenerArray.length; i < size; i += 2) { listeners.remove((Class)listenerArray[i], (EventListener)listenerArray[i+1]); } }
1
public boolean isFine( String n, int w, int h ) { if ( !n.equals( name ) ) return false; switch ( compare ) { case 0: return ( w == width && h == height ); case 1: return ( w <= width && h <= height ); case 2: ...
7
public void removeClassPath(String path) { int index = paths.indexOf(path); paths.remove(index); }
0
public static void readXML() throws Exception { puzzleHighscores = new Vector<SlidingPuzzleHighscore>(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new File("highscore.xml"...
1
private JobConf jobConf(HadoopContext hadoopContext) { JobConf jobconf = new JobConf(); jobconf.setJobName("stackoverflow"); jobconf.setUser("hduser"); jobconf.setMapperClass(StackoverflowCommentsToCsv.Map.class); jobconf.setNumReduceTasks(0); jobconf.setOutputValueClass(...
0
public void play() throws PlayWaveException{ //FileInputStream inputStream; try { waveStream = new FileInputStream(filename); } catch (FileNotFoundException e) { return; } AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(thi...
7
public void saveChunk(World var1, Chunk var2) throws IOException { var1.checkSessionLock(); File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition); if(var3.exists()) { WorldInfo var4 = var1.getWorldInfo(); var4.setSizeOnDisk(var4.getSizeOnDisk() - var3.length()); } ...
3
public static boolean validate(String name, String pass, PersonBean bean) { boolean status = false; PreparedStatement pst = null; ResultSet rs = null; Connection conn=null; try { conn=ConnectionPool.getConnectionFromPool(); pst = conn .prepareStatement("select * from person w...
7
@Override public void keyPressed(KeyEvent e) { //Implement send on enter press if (e.getKeyCode() == KeyEvent.VK_ENTER && !txtField.getText().equals("")) { send(); } //Implement message last sent text field population //can be used to re-send last message with a spelling correction if (e.getKeyCode() ==...
3
static private void insertGetString (ClassWriter cw, String classNameInternal, ArrayList<Field> fields) { int maxStack = 6; MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "getString", "(Ljava/lang/Object;I)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 2); if (!fields.isEmpty()) { ...
6
final void method2136(int i, int i_0_, byte i_1_) { anInt6224++; if (aClass61_6222 != null) { if (i_1_ >= -42) method2149(-65); ((Class286) this).aHa_Sub2_3684.method3738(-15039, 1); if ((i & 0x80) != 0) ((Class286) this).aHa_Sub2_3684.method3771((byte) -122, null); else if ((0x1 & i_0_) != 1)...
9
@EventHandler public void CreeperNightVision(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getCreeperConfig().getDouble("Creeper....
6
@Test @DatabaseSetup(value="classpath:databaseEntries.xml", type=DatabaseOperation.CLEAN_INSERT) public void testListLecturers() { List<LecturerImpl> lect_list = lecturerJdbcDaoSupportObject.listLecturers(); assertEquals(2, lect_list.size()); for(LecturerImpl l : lect_list){ String fn = l.getFirstN...
4
public void calc() { if(operator== "+") { firstNum += secondNum; System.out.println("firstNum plus secondNum is: " + firstNum); } if(operator == "-"){ firstNum -= secondNum; System.out.println("firstNum minus secondNum is: " + firstNum);} if(operator == "*") { firstNum *= secondNum; Syst...
8
private void err(String prefix, String message, Throwable throwable) { String log = buildMessage(prefix, message); System.err.println(log); if (outputStream != null) { try { outputStream.write((log + "\r\n").getBytes()); } catch (IOException e) { // TODO Auto-generated catch block ...
5
public static Object asType(Object typeKey, Object value) { if (value==null) { return null; } if (typeKey==null) { return value; } // Check if the provided value is already of the target type if (typeKey instanceof Class && ((Class)typeKey)!=Object.class) { if (((Class)typeKey).isInstance(valu...
8
public TreeColumn overColumn(int x) { if (x >= 0 && !mColumns.isEmpty()) { int divider = getColumnDividerWidth(); int count = mColumns.size() - 1; int pos = 0; for (int i = 0; i < count; i++) { TreeColumn column = mColumns.get(i); pos += column.getWidth() + divider; if (x < pos) { return ...
4
private int computeEdgeParameters(DynamicGraph dynamicGraph, List<Date> sortedDates) { AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(); AttributeColumn overlapColumn = attributeModel.getEdgeTable().addColumn("overlapd", AttributeType.DYNAMIC_DOUBLE); in...
9
@Override public void propertyChange(PropertyChangeEvent evt) { if (programExit) if (evt.getPropertyName().equals("state")&& (evt.getNewValue()).toString().equals("DONE")){ System.exit(0); } if (makeNewDocument) if (evt.getPropertyName().equals("state")&& (evt.getNewValue()).toString().equals("D...
6
public void drawPoint(Chimera3DLVertex vertex[]) { Chimera3DMatrix mat = matrixWorld.mod(matrixCamera).mod(matrixProjection).mod(matrixViewPort); Chimera3DVector dest = new Chimera3DVector(); for(int i = 0; i < vertex.length; ++i) { mat.transformVectorPosition(dest, vertex[i].pos); ...
7
*/ public void convertDragRowsToSelf(List<Row> list) { Row[] rows = mModel.getDragRows(); rows[0].getOwner().removeRows(rows); for (Row element : rows) { mModel.collectRowsAndSetOwner(list, element, false); } }
1
private void generateField() { field = new MinefieldCell[rows][cols]; for (int i = 0; i < rows; i++) for (int j = 0; j < cols; j++) field[i][j] = new MinefieldCell(); for (int i = 0; i < mines; i++) { int row = (int) (Math.random() * rows); int col = (int) (Math.random() * cols); while (field[...
6
public static boolean checkUpdatesMain() { //Nastavi številko za najnovejšo verzijo iz strežnika double version=0; try { URL url=new URL("http://"+Main.ip+"/d0941e68da8f38151ff86a61fc59f7c5cf9fcaa2/computer/mainVersion.html"); BufferedReader in=new BufferedReader(new Inpu...
3
@Override public MinesweeperTile[] getSurroundingTiles() { ArrayList<MinesweeperTile> surrondingList = new ArrayList<MinesweeperTile>(8); for (int x = xPos - 1 ; x <= xPos + 1; x++) { for (int y = yPos - 1 ; y <= yPos + 1; y++) { if (x >= 0 && y >= 0 && x < board.amountOfTiles.width && y < board.amountOfTi...
9
public static void Update(){ room.Update(); boolean change_room = false; //OFFSCREEN LEFT if (room.player.x+room.player.rb/2 < 0){ change_room = true; room.player.x = room.MAP_WIDTH*Tile.WIDTH - 16; int x = (int)coordinates.getX(); x--; if (x < 0) x = world_width-1; coordinates.setLocatio...
9
public void update(){ for(int i = 0; i < particles.size(); i++){ Particle p = particles.get(i); p.update(); if (p.isDead()){ particles.remove(i); i--; } } }
2
public void toggleSquare(int x, int y) { //first check we are are allowed to make a move if (!checkValidMove(x, y)) return; Square square = board.getSquare(x, y); if (square.isRevealed()) { //do nothing return; } if (square.isFlagged()) minesUnflagged++; //toggle flag and notify listener ...
6
private void scheduleSchemaForProcessing(URL schemaLocation) { if (cache.hasSchema(schemaLocation)) { return; //schema has already been compiled before, or on another thread } for (ProcessingEntry it : schemasToCompile) { if (it.schemaLocation.toString().equals(schemaLoc...
5
public Menu() { // Elements of the bar: JMenu menuFile = new JMenu("File"); add(menuFile); JMenu menuHelp = new JMenu("Help"); add(menuHelp); // Elements of File: JMenuItem fileConnect = new JMenuItem("Connect"); fileConnect.addActionListener(new ActionListener() { @Override ...
3
private static boolean method517(char arg0) { return !Censor.isLetter(arg0) && !Censor.isDigit(arg0); }
1