text
stringlengths
14
410k
label
int32
0
9
public Object nextValue() throws JSONException { char c = nextClean(); String s; switch (c) { case '"': case '\'': return nextString(c); case '{': back(); return new JSONObject(this); case '[': ...
8
public void keyReleased(KeyEvent e){ KeyEvent nextPress = (KeyEvent)Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent(KeyEvent.KEY_PRESSED); if ((nextPress == null) || (nextPress.getWhen() != e.getWhen()) || (nextPress.getKeyCode() != e.getKeyCode())) { for(ListenerQueuePair pa...
4
public void setSomeObjArray(SomeBean[] someObjArray) { this.someObjArray = someObjArray; }
0
public String getEmail() { return email; }
0
private void deliver (Message m) { int source = m.getSource(); int destination = m.getDestination(); if (destination != -1) { unicast(m, getDelay()); } else { int delay; boolean drop = false; boolean first = true; /* Broadcast. */ for (int i = 1; i <= r.n; i++) { drop = (source == i ...
5
protected int completeLineComment(TokenizerProperty prop) throws TokenizerException { String[] images = prop.getImages(); int len = images[0].length(); while (_currentReadPos + len < _currentWritePos || readMoreDataFromBase() > 0) { switch (getChar(_currentReadPos + len)) { case '\r':...
7
public byte[] readArchive(ArchiveRequest query) { int currentChunk = 0; int nextSectorId = query.getStartSector(); ByteBuffer outputBuffer = ByteBuffer.allocate(query.getFileSize()); while (nextSectorId != 0) { Sector sector; try { sector = readSector(query.getFileId(), nextSectorId); } catch (IOEx...
5
public void elevatorBoundary(Character c1) { if(c1.xCord<506) { c1.xCord = 506; } if(c1.xCord>782) { c1.xCord = 782; } if(c1.yCord < 349) { c1.yCord = 349; } ...
9
public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException { // Select the appropriate MockExternalContext implementation class Class clazz = MockExternal...
9
private boolean isOtherPunctuation(String str) { char ch = str.charAt(0); return ch == '~' || ch == '`' || ch == '!' || ch == '@' || ch == '#' || ch == '$' || ch == '%' || ch == '?'; }
7
@Transient public List<LabelValue> getRoleList() { List<LabelValue> userRoles = new ArrayList<LabelValue>(); if (this.roles != null) { for (Role role : roles) { // convert the user's roles to LabelValue Objects userRoles.add(new LabelValue(role.getName(),...
2
public boolean equalsIntensities(Run r){ if (getRed() == r.getRed() && getGreen() == r.getGreen() && getBlue() == r.getBlue()){ return true; } return false; }
3
private void checkName(final String name) { if (named && name == null) { throw new IllegalArgumentException( "Annotation value name must not be null"); } }
2
public static Kind parse(HtmlElement element, String str){ switch(str){ case "captions": return CAPTIONS; case "chapters": return CHAPTERS; case "descriptions": return DESCRIPTIONS; case "metadata": return METADATA; case "subtitles": return SUBTITLES; defa...
5
public void keyReleased(KeyEvent event) { switch (event.getKeyCode()) { case KeyEvent.VK_SHIFT: b1 = false; break; case KeyEvent.VK_CONTROL: b2 = false; break; case KeyEvent.VK_LEFT: bl = false; break; case KeyEvent.VK_UP: bu = false; break; case KeyEvent.VK_DOWN: bd...
6
public static void main(String[] args) { //This program determines the even factorial of an even positive integer //ie: n(n-2)(n-4)....4*2 int positiveInt; Scanner input = new Scanner(System.in); for (;;) { System.out.print("Please enter a positive even integer (0 to exit): "); positiveInt ...
4
public List<User> getAll() { Enumeration<User> elements = USER_MAP.elements(); List<User> users = new ArrayList<>(); while (elements.hasMoreElements()) { users.add(elements.nextElement()); } return users; }
1
private final double[][] readMatrixFromFile() throws IOException { final BufferedReader br = new BufferedReader(new FileReader(new File("C:/Users/Christina/Java1-workspace/AntColonyTest/src/AntColony/test.tsp"))); final LinkedList<Record> records = new LinkedList<Record>(); ...
7
@Override public void run() { Graphics g = bstrategy.getDrawGraphics(); if(bstrategy.contentsLost() == false){ Insets insets = frame1.getInsets(); g.translate(insets.left, insets.top); if(isgameover == true){ g.setColor(Color.RED); g.setFont(new Font("Sanserif", Font.BOLD, 80)); draw...
8
public void write(String fileName) throws IOException { try (BufferedWriter bw = new BufferedWriter(new FileWriter(fileName))) { Iterator<Entry<String, String>> it = map.entrySet().iterator(); while (it.hasNext()) { Entry<String, String> pair = it.next(); String line = pair.getKey() + "=" + pair.getValu...
1
public synchronized void editar(int i) { try { new PesquisadorView(this, list.get(i)); } catch (Exception e) { } }
1
String assemble(Decomp d, String reply[], Key gotoKey) { String lines[] = new String[3]; d.stepRule(); String rule = d.nextRule(); if (EString.match(rule, "goto *", lines)) { // goto rule -- set gotoKey and return false. gotoKey.copy(keys.getKey(lines[0])); ...
7
public static void main(String[] args) { int N = 12; double[] X = new double[N]; double sum = 0.0; for(int i = 1; i < N-1; i ++){ X[i] = poisson(10, i); sum += X[i]; System.out.println(i + " "+ X[i]); } for(int i = 1; i < N-1; i ++){ X[i] = X[i]/sum; } System.out.println("Normali...
4
public static void getFeaturesFromCDD(String queryString, Map<String, CyIdentifiable> reverseMap, Map<CyIdentifiable, List<CDDFeature>> featureMap) throws Exception { BufferedReader in = queryCDD("feats", queryString); List<String> inputLines = new ArrayList<String>(); Strin...
6
public void testGoodAnswerGameToBeWon() { System.out.println("Test 1 : gameToBeWon"); Game gameToBeWon = new Game(new GameMaster( DefaultValues.DEFAULTATTEMPTCOMBINATION1), new Board()); int attemptsCount = 0; // 1. Wrong combinations input. Answer answer = gameToBeWon .giveAnswer(D...
0
public static void exit() { if (Game.client != null && Game.client.isConnected()) Game.client.disconnect(); if (Game.server != null) Game.server.shutdown(); running = false; UpdateThread.requestStop = true; Settings.saveSettings(); System.exit(0); }
3
private long getCPtrAddRefMarketData(MarketData element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theObject = ele...
4
private void CheckConnection() throws IOException { if(!ClientSocket.isConnected()){ String username = null; for(int i=0 ; i<goChatServer.connectedSockets.size();i++){ if (goChatServer.connectedSockets.get(i) == ClientSocket){ goChatServer.connectedSockets.remove(i); } } for(Map.Entry<Str...
8
private static URLConnection fetchClass0(String host, int port, String filename) throws IOException { URL url; try { url = new URL("http", host, port, filename); } catch (MalformedURLException e) { // should...
1
public Behaviour jobFor(Actor actor) { if (! structure.intact()) return null ; // // First and foremost, check to see whether a meltdown is in progress, and // arrest it if possible: final Choice choice = new Choice(actor) ; if (meltdown > 0) { final Action check = new Action( ac...
7
public static long pop_xor(long A[], long B[], int wordOffset, int numWords) { int n = wordOffset + numWords; long tot = 0, tot8 = 0; long ones = 0, twos = 0, fours = 0; int i; for( i = wordOffset; i <= n - 8; i += 8 ) { /*** C macro from Hacker's Delight #define CSA(h,l, a,b,c) \ {unsigned u = a...
4
public void RemoveStartMenuElement() { if (elementStart != null) { elementStart.RemoveFromMenu(); elementStart = null; } }
1
@Override public boolean isActive() { final ReentrantLock l = lock; l.lock(); try { return active; } finally { l.unlock(); } }
0
private void makeDropTarget( final java.io.PrintStream out, final java.awt.Component c, boolean recursive ) { // Make drop target final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget(); try { dt.addDropTargetListener( dropListener ); } // end try catch( ...
6
public boolean placeBet(Bet bet) { boolean succes = false; for (Player p : players) { if(p.getId() == bet.getPlayerId()) { if ((p.getStash() - bet.getValue()) >= 0 && bet.getValue() >= minBet && bet.getValue() <= maxBet) { bets.add(bet); p.removeFromStash(bet.getValue()); succes = true; ...
5
public static ArrayList<String> makePanDigitals() { char arr[] = new char[10]; for (int i = 0; i < 10; i++) { arr[i] = (char) (i + 48); } ArrayList<String> retarr = new ArrayList<String>(3628800); for (int i = 0; i < 3628800 - 1; i++) { int j = arr.length - 1; while (arr[j - 1] >= arr[j]) { j--; ...
5
private void HTTP2WebApplication(String HostPath, String MODE) { Connection conn = null; PreparedStatement ps_http = null; PreparedStatement ps = null; Statement s = null; ResultSet rs = null; String HTTP_REQUEST_HOST = "", HTTP_REQUEST_PATH = "", HTTP_...
5
public void updateImage() { //we will update animation when delay counter reaches delay, then reset delay counter delayCounter++; if(delayCounter>delay) { delayCounter=0; frameNumber++;//updates frame to next frame frameNumber%=totalFrame;// if surpass 3rd frame, back to frameNumber 0 //sets image to s...
1
@Override public SnpEffectPredictor create() { // Create chromo chromo = new Chromosome(genome, 0, 2 * maxGeneLen, 1, "chr1"); genome.add(chromo); // Create sequence chromoSequence = GprSeq.randSequence(random, chromo.size()); // Create gene int start = random.nextInt(maxGeneLen); int end = start + M...
3
public boolean isMatch(String s, String p) { StringBuilder sb = new StringBuilder(); for(int i = 0; i < p.length(); ++i){ if(p.charAt(i) != '*') sb.append(p.charAt(i)); else { if(i == 0 || i > 0 && p.charAt(i-1) != '?'){ sb.append("?*"); ...
5
public static int getFByYaw(float yaw) { float f = (yaw * 4.0f / 360.0f); if (f < 0) { f = 4 - Math.abs(f); } return Math.round(f); }
1
public double getValueRomberg(double a, double b, double eps) { int m, n, i, k; double h, ep, p, x, s, q = 0; double[] y = new double[10]; // 迭代初值 h = b - a; y[0] = h * (func(a) + func(b)) * 0.5; m = 1; n = 1; ep = eps + 1.0; // 迭代计算 while ((ep >= eps) && (m <= 9)) { p = 0.0; for (i = 0; i...
4
public void testCustomBroadcast () throws IOException { ServerDiscoveryHandler serverDiscoveryHandler = new ServerDiscoveryHandler() { @Override public boolean onDiscoverHost (DatagramChannel datagramChannel, InetSocketAddress fromAddress, Serialization serialization) throws IOException { DiscoveryRes...
3
private void drawAllBonds() { for (int i = 0; i < bonds.length; i++) { int n = Integer.parseInt(bonds[i][0]); if (bonds[i][1].equals("R")) { drawBond(n, 0, false); } else if (bonds[i][1].equals("L")) { drawBond(n, Math.PI, true); } else if (bonds[i][1].equals("D")) { drawBond(n, Math.PI / 2, f...
9
protected boolean writeDailyLog(String logStr, Time logTime) { boolean ret = false; Path logFilePath; if ((logStr != null) && (logTime != null)) { try { if ((m_curLog == null) || (m_curLogTime == null) || (!m_curLogTime.isSameDay(logTime))) { if (m_curLog != null) { m_curLog.close(); ...
8
private void ChooseAction(Socket s) throws IOException, ClassNotFoundException { ObjectInputStream in = new ObjectInputStream(s.getInputStream()); Message msg = (Message) in.readObject(); if (msg.getType().equals("CONNECT")) { mypeer.addNeighbor(msg.getHost(), msg.getPort()); ...
9
public int divide(int dividend, int divisor) { if (divisor == 0) throw new ArithmeticException("devide by zero"); // convert dividend and divisor to negative numbers a and b int a = (dividend < 0) ? dividend : (0 - dividend); int b = (divisor < 0) ? divisor : (0 - divisor);...
4
public void getTickets(String fechaDesde, String fechaHasta, String lineaAerea, String nfile, String numeroTicket) throws SQLException { tickets = TicketDAO.getInstance().getTickets(fechaDesde, fechaHasta, lineaAerea, nfile, numeroTicket); if (tickets.isEmpty()) { JOptionPane.showMessageDia...
1
@Test public void func1() throws Exception { List<Compound> l = new ArrayList<Compound>(); for (int i = 0; i < 10; i++) { HRU c = new HRU(); c.in = "1-" + i; l.add(c); } // long start = System.currentTimeMillis(); // Runner.parallel2(l); // long end = System.currentTimeMillis(); HRU c = new ...
1
public void createRoster() { Calendar today = (Calendar) startDate.clone(); int count; for(int i=0; i<numberOfDays; i++) { count = 0; numberOfServices = getNumberOfServices(today.getTime()); driversUsed = new driverUsed[numberOfServices]; busesUsed = new busU...
6
private boolean checkStop(double[] rst, double minDL, double dl){ if(dl > minDL+MAX_DL_SURPLUS){ if(m_Debug) System.err.println("DL too large: "+dl+" | "+minDL); return true; } else if(!Utils.gr(rst[2], 0.0)){// Covered positives if(m_Debug) System.err.println("Too few positives.")...
8
@Override public void actionPerformed(ActionEvent event) { if ((event.getSource().equals(btnOk)) || (event.getSource().equals(btnCancel))) { modalResult = (event.getActionCommand().equals("ok")); MainWindow.setupData.setEventStartDate(eventStart.getTime()); MainWindow.setupData.setEventEndDate(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
public boolean containsAndDeletes(int fRow, int fCol, int toRow, int toCol, int [][] a) { for (int i = 0; i < moveList.size(); i++){ if (moveList.get(i).getFromRow() == fRow && moveList.get(i).getFromCol() == fCol && moveList.get(i).getToRow() == toRow && moveList.get(i).getToCol() == toCol){ for (int p = 0...
8
public void attackBuilding(Unit attacker, Building toBeAttacked, boolean aiMove) { if (aiMove || Teams.comparePlayers(this.getOwner(),game.getCurrentPlayer())) { HashSet<Player> tmp = Teams.getTeamFriends(Teams .getTeamOfPlayer(owner)); if (attacker.getAtt...
4
protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) { List result = new java.util.ArrayList(); Font tickLabelFont = getTickLabelFont(); g2.setFont(tickLabelFont); i...
7
public List<Dependency> getRelocatedArtifacts() { List<Dependency> artifacts = new ArrayList<Dependency>(); if (relocate != null) { for (String element : relocate.split(",")) { String[] coordinates = element.split(":"); if (coordinates.length < 2) { ...
4
@Test public void branchInstrInvalidOpcodeTest_BRE() { //Tests instruction isn't created with illegal opcode for format try { instr = new BranchInstr(Opcode.BRE, 0); //BRE requires 3 parameters; the third representing a register } catch (IllegalStateException e) { System.out.println(e.getMessage()); } a...
1
public void enrgOffre(String v_titre, String v_region, int v_exp, int v_salMin, int v_salMax, HashMap<Competence, CompType> tblComps) { try { int compsSize = tblComps.size(); System.out.println("size" + tblComps.size()); System.out.println(tblComps); String compst...
5
public Tree<String> buildAST( StringTokenizer st ) { // make our tree... the root is the string "root" // if a node has children then it is an application // if not then it is a value Tree<String> tree = new Tree<String>("root"); Tree.Node<String> node = tree.getNode(); ...
9
public static String printCFGBody(Block root, String blockName, boolean wholeGraph) { StringBuilder sb = new StringBuilder(); if (wholeGraph) { sb.append("graph: {title: \"").append(blockName).append("CFG\"").append('\n'); // sb.append("layoutalgorithm:bfs").append('\n'); sb.append("manhattan_edges:yes").a...
8
public final void cleanUp() { Bucket died; while ((died = (Bucket) queue.poll()) != null) { int diedSlot = Math.abs(died.hash % buckets.length); if (buckets[diedSlot] == died) buckets[diedSlot] = died.next; else { Bucket b = buckets[diedSlot]; while (b.next != died) b = b.next; b.next ...
3
public void click() { JPopupMenu menu = new JPopupMenu(); List<DockTab> tabs = new ArrayList<>(mHidden); Collections.sort(tabs); for (DockTab tab : tabs) { JMenuItem item = new JMenuItem(tab.getFullTitle(), tab.getIcon()); item.putClientProperty(this, tab.getDockable()); item.addActionListener(this); ...
1
@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 Customer)) { return false; } Customer other = (Customer) object; if ((this.id == null && other.id != null) || (...
5
public static void main(String[] args) { String[] hexList; Scanner scanner = new Scanner(System.in); do { // Read input, until it has correct length (normally 8 bytes = 16 hex digits) do { // Read line System.out.println("Please enter " + numberOfRows + " hexadecimal bytes:"); String line = s...
5
public static TunableParameters getInstance(){ if(_currentInstance == null) _currentInstance = new TunableParameters(); return _currentInstance; }
1
@Override public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) { ...
7
@Override public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) { iterations = 0; Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel))); Complex[] complex = new Complex[2]; complex[0] = tempz;//z complex[1] = new Complex(pixel);//c ...
9
public void setId(int id) { this.id = id; }
0
public int nextIndex() { if (next == null) { return size(); } if (cache == null) { cache = toArray(); } return next.index; }
2
public T getAt(int row, int col) throws ArrayIndexOutOfBoundsException { if (row>rows || col>columns || row<0 || col<0) throw new ArrayIndexOutOfBoundsException(); if (RList.getHead()==null && CList.getHead()==null) return null; if (RList.isInList(row) && CList.isInList...
8
@Override public Usuario findByLoginSenha(Usuario usuario) { EntityManagerFactory factory = Persistence .createEntityManagerFactory("classeEncanto"); EntityManager em = beginTransaction(factory); try { CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<Usuario> criteria = builder ...
5
public Object getValueAt(int row, int column) { if (column == 0) return variables[row]; return spaceSet(entries[row][column - 1]); }
1
public boolean addSignalisationRoute(String nomR, Signalisation s) { if (mapRouteSignalisation.containsKey(nomR)) { int index = 0; boolean b = false; for (int i = 0; i < this.listeRoutes.size(); i++) { if (this.listeRoutes.get(i).getNomRoute().equals(nomR)) { ...
4
public void runFixedTimeSteps() { long lastTime = System.nanoTime(); double lag = 0; isPreRendering(true); boolean doRendering = false; while (isRunning && !Display.isCloseRequested()) { long currentTime = System.nanoTime(); double timeDiff = (currentTime - lastTime) / 1000000d; lastTime = currentTim...
9
public static int isVersionGreater(String base, String test) { base = convertOldReleases(base); test = convertOldReleases(test); if(base.equalsIgnoreCase(test)) return 0; StringTokenizer t1 = new StringTokenizer(base, "."); StringTokenizer t2 = new StringTokenizer(test, "."); while(t1.hasMoreTokens() ||...
6
private void paintWrappedLineNumbers(Graphics g, Rectangle visibleRect) { // The variables we use are as follows: // - visibleRect is the "visible" area of the text area; e.g. // [0,100, 300,100+(lineCount*cellHeight)-1]. // actualTop.y is the topmost-pixel in the first logical line we // paint. Note that w...
6
public String getScript(String scriptName) { InputStream stream = null; try { stream = ClassLoader.getSystemResourceAsStream(scriptName); @SuppressWarnings("resource") Scanner s = new Scanner(stream).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } catch (Exception e) { _logger.error("F...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Antwort)) return false; Antwort other = (Antwort) obj; if (antwort == null) { if (other.antwort != null) return false; } else if (!antwort.equals(other.antwort)) ...
7
private static boolean isInUsefulVariableSet(char ch, Set set) { Iterator it = set.iterator(); while (it.hasNext()) { String variable = (String) it.next(); char var = variable.charAt(0); if (ch == var) { return true; } } return false; }
2
@SuppressWarnings("unused") private void Chrwood() { if(this.vie <= 0){ this.killAgent(this); this.curent.personne.remove(this); } switch(this.al.IA){ case 2 : IA2(); break; case 3 : IA3(); break; default : IA1(); break; } }
3
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JTextField editor = new JTextField(); if (value != null) { editor.setText(value.toString()); } ...
4
public List<PlayerInfo> getPlayers() { List<PlayerInfo> playersInfo = new ArrayList<PlayerInfo>(); for (Player p : players) playersInfo.add(new PlayerInfo(p)); return playersInfo; }
1
public static void main(String[] args) { ArrayList newWordList = new ArrayList(); ArrayList filteredWordList = new ArrayList(); try { FileInputStream fstream = new FileInputStream("newword.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamR...
9
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
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (request.getParameter("question") != null && !request.getParameter("question").isEmpty() && request.getParameter("reponse") != null && !request.getParameter("reponse").isEmpty()) { ...
8
private static void loot() throws Exception { int goldLooted = 0; if(killConfirmed == true) { switch(enemyNumber) { case 0: { goldLooted = generator.nextInt(10) + 5; } break; case 1: { goldLooted = generator.nextInt(10) + 20; currentMessage = "You have absorbed the...
9
public synchronized void init() throws ServerAlreadyStartedException { if (alreadyStarted) { throw new ServerAlreadyStartedException(); } // queue = new ArrayBlockingQueue<Runnable>(10); // threadPool = new ThreadPoolExecutor(1,1,10,TimeUnit.SECONDS,queue); try{ LocalDevice.getLocalDevice().setDiscover...
2
public BigInteger attack(BsGs_Key key) throws Error{ BigInteger t = sqrt(key.p.subtract(BigInteger.ONE)).add(BigInteger.ONE); // t>sqrt(p) // ------------------------- // -- Hier programmieren --- // ------------------------- List<BigInteger> babyStep = new ArrayList<BigInteger>(); List<BigInteger> giantSte...
4
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, ((Integer) value).intValue() + 1); } else if (value instanceof Long) { ...
5
public PublicWorkType getPublicWorkType() { double t = nextRand(); if ( t < 0.5 ) return PublicWorkType.PRESCRIBE; else if ( t < 0.8 ) return PublicWorkType.HOSPTILIZE; else return PublicWorkType.REFER; }
2
public boolean addNode(UrlNode node){ if (node.parentUrl.equals(this.selfUrl)){ childNodes.add(node) ; return true ; }else{ for(UrlNode urlNode : childNodes){ if( urlNode.addNode(node) ) return true ; } } return false ; }
3
protected void readScaleFactors() { for (int i = 0; i < num_subbands; ++i) subbands[i].read_scalefactor(stream, header); }
1
public void incrementPlayerTrappedCount(Player player) { if (player == null) throw new IllegalArgumentException("The given arguments are invalid!"); if (trappedPlayerCount.containsKey(player)) { int numberOfTimes = trappedPlayerCount.get(player); numberOfTimes++; trappedPlayerCount.remove(player); ...
3
public static void pause(double seconds) { if (!(instance != null && instance.screen != null)) { return; } if (seconds == 0) { // waiting for the user input (press any key); long time1 = System.currentTimeMillis(); KeyEvent event = null; while(event == null) { if ((System.currentTimeMillis() - ...
8
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(); if (c < ' ') { throw syntaxError("Unterminated string."); } if...
9
public void Run() { int Grid [][] = { {8,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,8}, {49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00}, {81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65}, {52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91}, {22,31,16,71,5...
8
public boolean isValidMove(int startCol, int startRow, int endCol, int endRow) { if(!hasMoved) { //If first move was successful if((startCol == endCol && endRow - startRow <= 2) || (startCol == endCol && startRow - endRow <= 2)) { hasMoved = true; System.out.println("this pawn has moved: has...
8
public ArrayList<NbrCostPair> getData() { return data; }
0
public ServerInputThread(Socket socket) { this.socket = socket; }
0