text
stringlengths
14
410k
label
int32
0
9
@Override public void mouseClicked(MouseEvent arg0) { JButton button = (JButton) arg0.getSource(); if (button.getName().equalsIgnoreCase("back")){ KanjiMemo.showPanel(KanjiMemo.MAIN_SCENE); } else if (button.getName().equalsIgnoreCase("undo")){ drawingPanel.undo(); } else if (button.getName().equa...
8
protected boolean existsOnServer( String urn ) throws IOException { URL url = urlFor(urn); if( induceHeadErrors ) throw new ServerError("Not a real error ha ha h", 599, null, "HEAD", url.toString()); HttpURLConnection urlCon = (HttpURLConnection)url.openConnection(); urlCon.setRequestMethod("HEAD"); url...
5
private void selected(Object obj) { System.out.println("?"); System.out.println(obj); System.out.println(selectedNo); if (checkable) { WidgetChooserButton button = (WidgetChooserButton)(layout.itemAt(selectedNo).widget()); if (obj != objects.get(selectedNo)) { selectedNo = objects.indexOf(obj); b...
2
@Test public static void testInfoQuery() throws Exception { String jobName = "TestInfoJob-" + System.currentTimeMillis() + Math.random(); final String PSV = "ECONOMODE"; final String on = "ON"; final String off = "OFF"; final String target; ArrayList<Command> commands = new Ar...
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Photo photo = (Photo) o; if (src != null ? !src.equals(photo.src) : photo.src != null) return false; return true; }
5
private boolean readBlock() throws IOException { if (this.debug) { System.err.println("ReadBlock: blkIdx = " + this.currBlkIdx); } if (this.inStream == null) { throw new IOException("reading from an output buffer"); } this.currRecIdx = 0; int of...
7
private int[] updateDateIndexAndFormat(String[] words) { int indexDate1 = -1; int indexDate2 = -1; int toSkip = -1; for (int i = 0; i < words.length; i++) { if (i != toSkip) { for (int j = 0; j < dateFormats.size(); j++) { SimpleDateFormat ...
9
public void update() { int xa = 0, ya = 0; if (up) ya--; if (down) ya++; if (left) xa--; if (right) xa++; if (xa != 0 || ya != 0) move(xa,ya); }
6
@RequestMapping(value = {"search", "s"}) @ResponseBody public Map search( @RequestParam int page, @RequestParam(value = "limit") int pageSize, @RequestParam(required = false, defaultValue = "0") int specialtyId, @RequestParam(required = false, defaultValue = "0") ...
3
public final void stopCutscene(Player player) { if (player.getX() != endTile.getX() || player.getY() != endTile.getY() || player.getPlane() != endTile.getPlane()) player.setNextWorldTile(endTile); if (hiddenMinimap()) player.getPackets().sendBlackOut(0); // unblack player.getPackets().sendConfig(1241, 0...
7
@Override Move makeMove() { Move m = null; if (!_started) { while (true) { String s = getGame().getMove(); if (s.equals("p")) { break; } else { m = Move.create(s); if (getBoard().i...
8
public Bank(int n, double initialBalance) { accounts = new double[n]; for (int i = 0; i < accounts.length; i++) accounts[i] = initialBalance; bankLock = new ReentrantLock(); sufficientFunds = bankLock.newCondition(); }
1
private static void loadUnpackedItemExamines() { Logger.log("MusicHints", "Packing music hints..."); try { BufferedReader in = new BufferedReader( new FileReader(UNPACKED_PATH)); DataOutputStream out = new DataOutputStream(new FileOutputStream( PACKED_PATH)); while (true) { String line = in.r...
7
private boolean smaller(Rectangular base, Rectangular upper) { if (base.length > upper.length && base.width > upper.width) return true; return false; }
2
public static void zigZagTraversal(TreeNode root) { if (root == null) return; Stack<TreeNode> parents = new Stack<TreeNode>(); Stack<TreeNode> childs = new Stack<TreeNode>(); boolean forward = true; parents.add(root); while (!parents.empty()) { TreeNode current = parents.peek(); parents.po...
8
private void sendContentToOutputDevice(Vector<JSONObject> contentToShow, String type){ //if care display is used if(useXMPPConnection){ xmppConnection.sendContentToScreen(contentToShow, type); } //for debugging without care_screen or output on other devices such as robots else{ Utils.printWithDate("Sent...
6
public boolean equals(Object x) { if (!(x instanceof Entry)) return (false); T[] a = arr.get(); if (a == null) return (false); Entry<?> e = (Entry<?>) x; Object[] ea = e.arr.get(); if (ea == null) ret...
8
public int trap(int[] A) { int len = A.length; int [] maxL = new int[len]; int [] maxR = new int[len]; int max = 0; for(int i = 0; i < len; ++i){ maxL[i] = max; if(max < A[i]) max = A[i]; } max = 0; for(int i = len - 1; i >= 0; --i...
6
public Utility(ModManager McLauncher) { if(McLauncher!=null){ this.McLauncher = McLauncher; gamePath = McLauncher.gamePath; modPath = McLauncher.modPath; con = McLauncher.con; if(System.getProperty("os.name").toLowerCase().contains("windows")){ con.log("Log","OS Windows"); //OS="win"; ...
4
@Override protected boolean xhas_in () { // If we are in the middle of reading the messages, there are // definitely more parts available. if (more_in) return true; // We may already have a message pre-fetched. if (prefetched) return true; ...
5
public static void main(String[] args) { boolean b = test1(0) && test2(2) && test3(2); System.out.println("expression is " + b); }
2
public IEntityImage createFile(String... dotStrings) throws IOException, InterruptedException { dotStringFactory = new DotStringFactory(colorSequence, stringBounder, dotData); shapeMap = new HashMap<IEntity, Shape>(); printGroups(null); printEntities(getUnpackagedEntities()); // final Map<Link, Line> lineM...
9
public static boolean zipFolder(File folder, String fileName){ boolean success = false; if(!folder.isDirectory()){ return false; } if(fileName == null){ fileName = folder.getAbsolutePath()+ZIP_EXT; } ZipArchiveOutputStream zipOutput = null; try { zipOutput = new ZipArchiveOutputStream(new F...
5
private final void method2872(int i, int i_90_) { anInt8918++; for (Class348_Sub43 class348_sub43 = ((Class348_Sub43) ((Class348_Sub16_Sub1) aClass348_Sub16_Sub1_8958) .aClass262_8848.getFirst(i + -2005674596)); class348_sub43 != null; class348_sub43 = ((Class348_Sub43) ((Class348_Sub...
7
protected void addImpl(int index, int sublistIndex, int sublistOffset, T item) { if (sublistIndex < headSublistIndex + (calculateSublistsUsed() >>> 1)) { if (index == 0) { addFirst(item); } else { CircularListInternal<T> prev = sublists.get(headSublistIndex); if (sublistOffset ==...
6
public void render(){ for(int y = 0; y < map.length; y++){ for(int x = 0; x < map[0].length; x++){ int tile = map[x][y]; if(tile == Tile.GRASS) screen.render(Tiles.GRASS, x * tileWidth, y * tileHeight); else if(tile == Tile.WALL) ...
4
public void save(){ if(this.getId() != null){ String q = "SELECT id, name " + "FROM call_types " + "WHERE id = ?"; try { PreparedStatement statement = ru.vladambulance.call.Type.Type.getConnection().prepareStatement(q, ...
5
public Vector<BaseClass> getRankedClasses(int rank) { Vector<BaseClass> bc = new Vector<>(); for (ClassMap item : _classMap) { if (item.getRace().getName().equals(_race.getName())) { if (item.getAverage() == rank) { bc.add(item.getClassType()); ...
3
static public int[] arraysDims(String[] arr) { if (arr.length > 1) { int[] idx = new int[arr.length - 1]; for (int i = 1; i < arr.length; i++) { idx[i - 1] = Integer.parseInt(arr[i]); } return idx; } return null; }
2
private int evaluateValueofBoardForWhite(Board board) { int wValue = 0; if (board.isWhiteWinner()) { wValue += POINT_WON; return wValue; } else { wValue = WhiteBlackPiecesDifferencePoints(board); // wValue += BoardPositionPoints(board); ...
1
public ClassFile getClassFile2() { ClassFile cfile = classfile; if (cfile != null) return cfile; classPool.compress(); if (rawClassfile != null) { try { classfile = new ClassFile(new DataInputStream( new...
9
public void migrateToUUID() { // Bail if no-one has ever been warned // or this is a first run if (!getConfig().contains("Warned")) { return; } // Get all the currently warned players and put them in a HashMap Map<String,Object> userList = getConfig().getConfigurationSection("Warned").getValues(fal...
6
public boolean isValidPassword(String userName, String password) { try { String pwdFromDB = loginDao.getUserPassword(userName); if (null != pwdFromDB) { if (pwdFromDB.equals(password)) { return true; } } } catch (Exception ex) { if (!(ex instanceof DaoException)) { ex.printStackTrace()...
4
public void setReachable() { if (!reachable) { reachable = true; setSingleReachable(); } }
1
private void number() { // Some preliminaries int tempCharPos = charPos; int x = nextChar; tempString = ""; //tempString += (char)x; // So if we are here, we have a number so, crunch numbers until a . or non number while((x>= 48)&&(x <=57)){ // while x is an element of the set {0,1,2,3,4,5,6,7,8,9} ...
5
@BeforeMethod @Test(groups = { "Integer-Sorting", "Primitive Sort" }) public void testBubbleSortInt() { Reporter.log("[ ** Bubble Sort ** ]\n"); try { testSortIntegers = new BubbleSort<>( primitiveShuffledArrayInt.clone()); Reporter.log("1. Unsorted Random Array\n"); timeKeeper = System.currentT...
4
public ArrayList<BookType> getAllBookType() { ArrayList<BookType> ret = new ArrayList<BookType>(); Connection conn = null; Statement st = null; ResultSet rs = null; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); st=conn.createStatement(); ...
6
public void buildingWeather(){ if (document != null) { NodeList headerList = document.getElementsByTagName("header"); System.out.println("노드" + headerList.item(0).getChildNodes().getLength()); for (int i = 0; i< headerList.getLength(); i++){ // childNode for (int k = 0; k < headerList.item(i).getChil...
7
public static String getMenuKeyValueStr() { String s = ""; for (int i = 0; i < getMenuKeySymbolCount(); i++) { s += menuSymbols[i].name; if (i < getMenuKeySymbolCount() - 1) s += ", "; } return s; }
2
private Location getRandomLocation(String location) throws DestinationInvalidException { double random = Math.random(); boolean above = false; int x, y, z; World world; // Will it be a positive or negative number if (random > 0.45D) above = true; else above = false; x = getRandomNumberRange(1...
6
private void createComboBox() { comboBox = new JComboBox(); if (ProjectMainView.getCampaign().getQuizes().size()!=0) { for (QuestPoint q : ProjectMainView.getCampaign().getQuizes()) { comboBox.addItem(Integer.toString(q.getId())); } table.getColumnModel().getColumn(1); } comboBox.setVisible(false);...
2
public Typelignepl LignePl(Coords c) { if (this.moveTo(Direction.UPLEFT).equals(c) || c.equals(this.moveTo(Direction.DOWNRIGHT))) { return Typelignepl.DIAGONAL2; } else if (this.moveTo(Direction.UPRIGHT).equals(c) || c.equals(this.moveTo(Direction.DOWNLEFT))) { return Typelignepl.DIAGONAL1...
6
public boolean sameConfig(ComputerPlay compareComputer) { int i=0; if(compareComputer.hasChecksums() && hasChecksums() && !sameChecksum(compareComputer.checksums)) { return false; } Vector<PlayRule> compareComputerPlayRules = compareComputer.getPlayRules(); for(PlayRule rule:playRules) { PlayRule compar...
9
boolean traverseItem(boolean next) { Control[] children = parent._getChildren(); int length = children.length; int index = 0; while (index < length) { if (children[index] == this) break; index++; } /* * It is possible (but unlikely), that application code could have * disposed the widget in ...
8
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if (cmd.getName().equalsIgnoreCase("kit")){ if (!(sender instanceof Player)) { // If sender isn't a player fail sender.sendMessage("This command can Only be run by a player"); return false; } else { Playe...
4
public SimRace() { cars = new Car[numberOfCars]; accident = new Accident(500, cars); for (int i = 0; i < numberOfCars; i++) { cars[i] = new Car(laps); } for (Car c : cars) { c.start(); } accident.run(); try { for (int i = 0; i < cars.length; i++) cars[i].join(); accident.join(); } ...
5
private JSlider getJSliderWordsCount() { if (jSliderWordsCount == null) { jSliderWordsCount = new JSlider(); jSliderWordsCount.setMinimum(5000); jSliderWordsCount.setMaximum(150000); jSliderWordsCount.setValue(50000); jSliderWordsCount.addChangeListener(new ChangeListener() { @Override public v...
1
public static void main(String [] args) { // initialize student and class configuration data int studentNumber = 0; String studentName = "blank"; String studentHandle = "000000"; String className = "297D/"; String configFileName = "./configBatch.txt"; // System.out.println("configFileName: " + ...
4
public static void main(String[] args) { try { HttpURLConnection getConnection = (HttpURLConnection) (new URL(SERVLET_ADDRESS)).openConnection(); getConnection.setDoOutput(true); getConnection.setDoInput(true); getConnection.setInstanceFollowRedirects(false); ...
6
public void solve(char[][] board) { if(board==null || board.length<=1 || board[0].length<=1) return; //use flood fill method at edge rows and columns //first and last rows for(int i=0;i<board[0].length;i++) { fill(board,0,i); //flood fill starting from pos(0, i) fill(...
9
public void draw(Graphics2D g2d) { if (!isOutOfScreen) { g2d.drawImage(img_movingSquare, (int) x, (int) y, null); } }
1
public void registrar(ProxyClient cliente, String password){ String id=""; //BufferedImage image = (BufferedImage)((Image) cliente.icon.getImage()); Image source = cliente.icon.getImage(); int w = source.getWidth(null); int h = source.getHeight(null); BufferedIma...
8
public void updateRow(int index, Object[] array) { // data[rowIndex][columnIndex] = (String) aValue; EntityTransaction userTransaction = manager.getTransaction(); userTransaction.begin(); Project updateRecord = projectService.updateProject((String) array[0], (String) array[1], (String) array[2], (String) ar...
1
public Node getNode(Node node, String nodeName) { NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node serverNode = list.item(i); if (list.item(i).hasChildNodes() && list.item(i).getNodeName().equals(nodeName)) { return serverNod...
3
public void select(IWorkbenchPartReference toSelect) { if(toSelect == null) return; clearSelection(); for (int i = 0; i < listItems.size(); i++) { TabListItemWidget listItem = listItems.get(i); if(listItem.has(toSelect)) { selectedIndex = i; if(selectedItem != null) selectedItem.desele...
4
public void addDownloadFileType(FileType fileType){ this.downloadFileTypes.add(fileType.getType()); }
0
public void reborn(int oldAgentId, int newAgentId) { /*古い様式のtraitsリストの中に最古のtraitが入っていた場合は、preferenceLengthの値を更新する必要がある可能性がある*/ Trait oldTrait = traitMap.get(oldAgentId); traitMap.remove(oldAgentId); //古い様式をHashMapから取り除く if (oldTrait.containsValue(OLDEST_TRAIT_NUM)) { final int INFINITE = 10000; //わざと不正に大きな...
7
public Tile(int x, int y, int typeInt) { tileX = x * 40; tileY = y * 40; type = typeInt; r = new Rectangle(); if (type == 5) { tileImage = StartingClass.tiledirt; } else if (type == 8) { tileImage = StartingClass.tilegrassTop; } else if (type == 4) { tileImage = StartingClass.tilegrassLeft; ...
5
static final void method1760(int i, int i_0_, boolean bool, int i_1_, byte i_2_, int i_3_, int i_4_, int i_5_) { if (i_2_ > -85) method1762(-14, 70, 13, -100); anInt5940++; if (((bool ? ((Class348_Sub51) BitmapTable.aClass348_Sub51_3959) .aClass239_Sub26_7215.method1838(-32350) : ((Clas...
7
@Override public boolean equals(Object o) { if (o instanceof Matrix) { Matrix m = (Matrix) o; if (m.getWidth() == getWidth() && m.getHeight() == getHeight()) { return Arrays.deepEquals(m.data, data); } } return false; }
3
public Queue<String> doubleOsevenXMLUnit(){ try { path = new File(".").getCanonicalPath(); FileInputStream file = new FileInputStream(new File(path + "/xml/papabicho.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); ...
9
public String getArea() { return Area; }
0
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 ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors =new ActionErrors(); if (login.length()<3 && login.length()<30 ) { errors.add("loginError", new ActionMessage("login.error")); } if (password.length()<3 && password.length()<30 ) { errors....
4
public static Locale getLocale() { XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader in = null; File options = FreeColDirectories.getClientOptionsFile(); if (options.canRead()) { try { in = xif.createXMLStreamReader(new FileInputStream(optio...
7
private void checkFourOfAKind() { for (int i = 0; i < 13; i++) { if (getNumberOfValues(i) == 4) { myEvaluation[0] = 8; myEvaluation[1] = i; myEvaluation[2] = i; myEvaluation[3] = 0;// Find leftover card break; } } }
2
@After public void tearDown() throws Exception { scheduler.shutdown(); }
0
public void night() { // End of simulation endOfSimulation = true; for (int i = 0; i < grid.getWidth(); i++) { for (int j = 0; j < grid.getDepth(); j++) { if (getSubject(i, j) == null) { continue; } if (getSubj...
5
public boolean equals(Object _other) { if (_other == null) { return false; } if (_other == this) { return true; } if (!(_other instanceof BillPayeePk)) { return false; } final BillPayeePk _cast = (BillPayeePk) _other; if (billId != _cast.billId) { return false; } if (userId ...
7
private JTextField getTxFieldArtistName() { if (txFieldArtistName == null) { txFieldArtistName = new JTextField(); txFieldArtistName.setText("Eminem"); txFieldArtistName.setBounds(10, 42, 86, 20); txFieldArtistName.setColumns(10); } return txFieldArtistName; }
1
private String determineCurrentCategoryDependingOnGameboardPosition() { int currentPos = currentPlayer.getGameboardPositions(); if (currentPos == 0) return CATEGORY_POP; if (currentPos == 4) return CATEGORY_POP; if (currentPos == 8) return CATEGORY_POP; if (currentPos == 1) return CATEGORY_SCIENCE; if (c...
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
9
final boolean method1534() { boolean bool = Class348_Sub10.method2788() != 0; if (!bool) return false; int i = anIntArray2726.length; for (int i_42_ = 0; i_42_ < i; i_42_++) anIntArray2721[i_42_] = anIntArray2726[i_42_]; int i_43_ = anIntArray2724[anInt2722 - 1]; int i_44_ = Class299.method2253(i_43_ - ...
6
@Override public void removeVisitor(MapleCharacter visitor) { final byte slot = getVisitorSlot(visitor); boolean shouldUpdate = getFreeSlot() == -1; if (slot != -1) { broadcastToVisitors(PlayerShopPacket.shopVisitorLeave(slot)); switch (slot) { case 1: chr1 = new WeakReference(null); bre...
6
public void cadastraProfessor(String nome, String matricula) throws ProfessorJaExisteException { boolean teste = false; for (Professor e : professores) { if (e.getMatricula().equals(matricula)) { teste = true; break; } } if (teste == false) { Professor p = new Professor(nome, matricula); ...
3
private void getDataFromUserTable () { try { connection = DriverManager.getConnection(Utils.DB_URL); statement = connection.createStatement(); resultSet = statement.executeQuery("SELECT id, name, date_created, date_lastlog FROM User"); while (resultSet.next()) { ...
3
public boolean exist(char[][] board, String word) { int m = board.length; int n = board[0].length; if( word.length() == 0 ) return false; if( m * n < word.length() ) return false; for ( int i = 0; i < m; i++ ) { for ( int j = 0; j < n; j++ ) { if( bo...
6
public static void main(String[] args) { String line; BufferedWriter bufferedWriter = null; // try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in))) { try (BufferedReader bufferedReader = new BufferedReader(new FileReader(inputFilePath))) { ...
6
private void getKeywordsInSentence(String sen, int index) { Iterator<String> it = keywords.iterator(); while (it.hasNext()) { String s = it.next(); if (sen.indexOf(s) != -1) { if (!keywordExtracted.containsKey(s)) { KeywordInfo ki = new KeywordInfo(); keywordExtracted.put(s, ki); } keywo...
3
public boolean hit(int upcard, int total, boolean soft) { if (soft) { return total < 18 || (total == 18 && (upcard >= 9 || upcard == 1)); } else { if (total < 12) return true; if (upcard > 6 || upcard == 1) return total <= 16; if (total > 12) return false; return upcard <= 3; } }
8
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); HTTPTokener x = new HTTPTokener(string); String token; token = x.nextToken(); if (token.toUpperCase().startsWith("HTTP")) { // Response jo.p...
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 fe...
6
public void givePlayerOfflineXP(Player player) { String SQL = "SELECT * FROM " + tblOfflineGains + " WHERE `player` = ? AND `world` = ?"; // plugin.info("givePlayerOfflineXP: " + player.getName() + " in " + // player.getWorld().getName()); boolean deleteEntries = false; Connection con = getSQLConnection();...
5
public MicromouseFrameworkGUI() { super("Micromouse Framework GUI"); JPanel panel = new JPanel(true); panel.setLayout(new BorderLayout()); /* * GRID: NORTH */ JPanel p1 = new JPanel(new GridLayout(1, 6, 2, 2)); // make combo box // - label JTextField tit...
2
private static void writeResults(HashMap<Long,HashMap<String,Holder>> map) throws Exception { BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigReader.getBurkholderiaDir()+ File.separator + "summary" + File.separator + "pivotedSNPS.txt"))); HashSet<String> strains= new HashSet<String>...
6
private static void addContigLayer(JsonObject root) throws Exception { List<JsonObject> list = new ArrayList<JsonObject>(); addNodeAndChildren(root, list); System.out.println("Got " + list.size() + " flat nodes"); HashMap<Integer, List<JsonObject>> outerMap = new HashMap<Integer, List<JsonObject>>(); f...
7
public static int drawMultiLineString(Graphics2D g2d, String text, int lineWidth, int x, int y) { FontMetrics m = g2d.getFontMetrics(); int originalY = y; if (m.stringWidth(text) < lineWidth) { g2d.drawString(text, x, y); } else { String[] words = text.split(" "); String currentLine = words[0]; for...
4
@Override public boolean isDiagonalObstacle(Element elementPassingThrough, Element otherDiagonalElement) { if (otherDiagonalElement instanceof LightTrailPart && isConnectedTo((LightTrailPart) otherDiagonalElement)) return true; if (otherDiagonalElement instanceof Player && this.getPlayer().equals(otherDiagonalE...
5
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { ChatColor yellow = ChatColor.YELLOW; ChatColor red = ChatColor.RED; if(args.length < 1) { if(sender instanceof Player) { Player player = (Player) sender; if(player.hasPermission("CrazyFeet.crazymagic...
8
public static Campaign getCampaign() { return campaign; }
0
public Node getHeadNode(int linkedListLength){ if(linkedListLength<=0){ return null; } node.setData(count); node.setNextNode(null); prevNode = node; for(int i=2;i<=linkedListLength;i++){ count++; currNode = new Node(); currNode.setData(count); currNode.setNextNode(null); prevN...
2
public void serve() { if (preSubmitted.isEmpty() && activeEngines.isEmpty()) { return; } if (!preSubmitted.isEmpty()) { Iterator<Engine> it = preSubmitted.iterator(); while (it.hasNext()) { Engine engine = it.next(); if (!engine...
8
public DataProvider() { this.datasets = new ArrayList<DataSet>(); }
0
@SuppressWarnings("unused") public void move(){ if(!motionLock){ double stepX; double stepY; double angle; stepX = new Random().nextInt(3); stepY = new Random().nextInt(3); while(!(posX + stepX > 0) && !(posX + stepX < settings.screenWidth - 40) && !(posY + stepY > 0) && !(posY + ste...
5
public static List<List<Integer>> generate(int numRows) { List<List<Integer>> res = new ArrayList<List<Integer>>(); for (int i = 0; i < numRows; i++) { List<Integer> l = new ArrayList<Integer>(); for (int j = 0; j < i + 1; j++) { if (0 == i || 0 == j || i == j) { l.ad...
5
public void kasitteleKayttajanKomento() { switch(kayttajanKomento) { case SIIRTO_VASEMMALLE: siirraTetriminoa(Suunta.VASEN); break; case SIIRTO_OIKEALLE: siirraTetriminoa(Suunta.OIKEA); break; case KAANTAMINEN: kaannaTetriminoa(Suunta.OIKEA); break; ...
7
private void validateOveractivePolling( final int index, final StubConnection conn, final StubConnection previous) { BOSHClient session = client.get(); if (session == null || previous == null) { // No established session return; } ...
9
protected void endGame(int status) { if(gameEnded) { this.running = false; } else { gameEnded = true; if(pauseScreen != null && !pauseScreen.isDestroyed()) { pauseScreen.canDraw = false; pauseScreen.destroy(); } ...
3
private void getAllRooms(){ Document doc = getXmlFile(); NodeList nList = doc.getElementsByTagName("Location"); if(debugConsole){ System.out.println("Locations in XML-File"); System.out.println("-------------------"); System.out.println(""); System.out.println("Number : "+nList.getLength()); Syste...
6
public int lastIndexOf(Attributes attributeList) { for (int i = size - 1; i >= 0; i--) { if (attributeLists[i] == attributeList) { return i; } } return -1; }
2