text
stringlengths
14
410k
label
int32
0
9
public void copyStateTo(RrdUpdater other) throws IOException, RrdException { if(!(other instanceof Robin)) { throw new RrdException( "Cannot copy Robin object to " + other.getClass().getName()); } Robin robin = (Robin) other; int rowsDiff = rows - robin.rows; if(rowsDiff == 0) { // Identical dimensi...
4
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Command cmd; String action = request.getParameter("action"); switch (action) { case "saveUser": cmd = new SalvarUsuarioCom...
7
public void resolution() { //temperature double T = plat.getScore2(); //iterations a chaque pas de temperature int Nt = 10; //coef pour le recalcul de la temperature double coef=0.6; //generation d'un second plateau (pour comparaison) Plateau plateau2; while(plat.getScore2()!=...
3
@Override public void onMessage(Message message) { try { TextMessage textMsg = (TextMessage) message; String text = textMsg.getText(); System.out.println(text); String mode[] = text.split("/"); if(mode.length ...
8
public String returnBook(int isbn, int customerID) { try{ String result = formattedTitle("Return Book"); // begin transaction conn.setAutoCommit(false); stmt = conn.createStatement(); // check the customer exists and lock String sql = String.format("SELECT * FROM Customer WHERE CustomerID = %d FO...
8
public int getDegree(int node) { assert (node < N); int result = 0; switch (getState()) { case ARR_ADJ: for (int i = 0; i < N; i++) { if (arr_adj[node][i] != 0) result++; } break; case ARR_INC: for (int i = 0; i < M; i++) if (arr_inc[node][i] < 0) result++; break; case LIST...
7
public void actionPerformed (ActionEvent event) { char turn=game.getTurn(); String nextTurn = "Black" ; if(turn == 'W') nextTurn = "Black"; if(turn == 'B') nextTurn = "White"; ...
9
public void update() { this.Velocity.mult(0.975f); if((this.Velocity.X() < 0.1f && this.Velocity.X() > 0f) || (this.Velocity.X() > -0.1f && this.Velocity.X() < 0f)) this.Velocity.X(0f); if((this.Velocity.Y() < 0.1f && this.Velocity.Y() > 0f) || (this.Velocity.Y() > -0.1f ...
8
public static void printUsage(Class<?> resourceClass, String resourceName) { InputStream is = resourceClass.getResourceAsStream(resourceName); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line = null; try { while ((line = reader.readLine()) != null) { Syste...
5
public void updateCurrentUser() { try { String statement = new String("UPDATE " + DBTable + " SET " + "username=?, password=?, url=?, permission=?, isblocked=?, isdead=?, practicenumber=?, highscorenumber=?" + " WHERE userid=?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); ...
1
@Override public void keyReleased(KeyEvent e) { switch(e.getKeyCode()){ case(KeyEvent.VK_W) : rocket.player.buttom[0] = false; break; case(KeyEvent.VK_A) : rocket.player.buttom[1] = false; break; case(KeyEvent.VK_S) : rocket.player.buttom[2] = false; break; case(KeyEvent.VK_D) : rocket.player.buttom[3] = fal...
4
private void compute() throws EmptyStackException{ LinkedRBinaryTree<?> op=opStack.pop(); LinkedRBinaryTree<?> right=valueStack.pop(); LinkedRBinaryTree<?> left=null; // Ni cos, ni sin if(!(op.root().element().equals("sin") || op.root().element().equals("cos"))){ left=valueStack.pop(); op.setLeft(left)...
5
private static boolean hasAlpha(Image image) { // If buffered image, the color model is readily available if (image instanceof BufferedImage) { BufferedImage bufferedImage = (BufferedImage) image; return bufferedImage.getColorModel().hasAlpha(); } // Use a pixel g...
3
public void exec(ILineConsumer out, ILineConsumer err) throws IOException{ logger.info("Command to execute :" + iCmd); iSession = iConnection.getSession(); iSession.execCommand(iCmd); // conditions for processing the streams. Such processing will not exit the call execu...
9
public SearchLayer(Dimension dim, GridLayer roadsLayer) { setSize(dim); this.roads = roadsLayer; visInfo = VisInfo.getInstance(); initComponents(); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { ...
7
public String getValue(String key) { for(int i = 0; i < MAX_PROPS; i++) { if(keys_[i].equals(key)) { return values_[i]; } } return ""; }
2
private void btnSwitchProfileMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSwitchProfileMousePressed if (currentProfile.getUsername().compareTo("andersonmaaron") == 0) { currentProfile = manager.getProfiles().get("orsobianco"); } else { currentProfile = manage...
1
public final void free() { // reset the linkage between this edge and the edge in the other direction, if it exists if(oppositeEdge != null) { if(oppositeEdge.oppositeEdge == this) { oppositeEdge.oppositeEdge = null; } oppositeEdge = null; } this.startNode = null; this.endNode = null; this.def...
2
public void moveIndexes(int i) { index = i + 1; if (nextElement == null) { return; } else { nextElement.moveIndexes(index); } }
1
public static List<Persona> consultaLicPer(ObjectContainer em) { ObjectSet<Persona> listaPer = em.query(new Predicate<Persona>() { private Map<String, List<LicenciaConductor>> licenciasPorCategoria = new HashMap<>(); private Set<Departamento> deptos = new HashSet<>(); @Over...
5
@Override public void run() { System.out.println("TCP Thread started."); // falls Connection fehlschlägt, dann brich ab. if (!connectionToServerSuceeded()) return; // ask for name (mutltiple times). // wird erfolgreich, oder bricht mit storageService.stop() ab. regi...
4
public int getY() { return y; }
0
public void doGet(HttpServletRequest request, HttpServletResponse response) { try { CommunityDAO dao = CommunityDAO.get(); long id = Long.parseLong(request.getParameter("id")); PublishedSwarm swarm = CommunityDAO.get().getSwarm(id); Principal p = request.getUserPrincipal(); CommunityAccount acct =...
4
public static int countMatches(String str, String sub) { if (isEmpty(str) || isEmpty(sub)) { return 0; } int count = 0; int idx = 0; while ((idx = str.indexOf(sub, idx)) != -1) { count++; idx += sub.length(); } ...
3
public static List<File> getFolderInList(String path) { List<File> list = null; File file = new File(path); if (file.isDirectory()) { list = new LinkedList<File>(); File[] ary = file.listFiles(); for (int i = 0; i < StringUtil.size(ary); i++) if (ary[i].isDirectory()) list.add(ary[i]); } re...
3
public static void main(String[] args) { Game.Builder b = new Game.Builder(); InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); System.out.println("Welcome to the game 'The Traveler Problem'"); System.out.println("First, creat...
2
public int getID() { System.out.println("test2"); this.waitForTurn = true; while (!doneTurn) { try { Thread.sleep(200); //System.out.println("waiting"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } doneTurn = false; ret...
2
@Override public boolean execute(CommandSender sender, String[] args) { if(!(sender instanceof CommandSender) || (sender instanceof Player && !sender.isOp())) { sender.sendMessage("You don't have permission to perform this command"); return true; } Collection<Group> groups = groupManager.getAllGroup...
5
public void send() { String msg = msg_box.getText(); if (msg == null || msg.equals("") || msg.equals("\n")){ msg_box.setText(""); return; } if(enterIsSend){ msg = msg.substring(0, msg.length()-1); } if (msg.startsWith("@")) { String to = msg.split(" ")[0].substring(1); msg = msg.substring(...
5
static void emitStringConstant(String str, PrintStream s) { ascii = false; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); switch (c) { case '\n': asciiMode(s); s.print("\\n"); break; case '\t': asciiMode(s); s.print("\\t"); break; case '\\': byteMode(s)...
7
private void put(JsonElement value) { if (pendingName != null) { if (!value.isJsonNull() || getSerializeNulls()) { JsonObject object = (JsonObject) peek(); object.add(pendingName, value); } pendingName = null; } else if (stack.isEmpty()) { product = value; } else { ...
5
@Override public Result getRevision () { List<Integer> parents = getParentsImpl(); if (parents.size() == 0) { // new repository return new Result(0, null); } final String branch = getBranchImpl(); // get all revisions that are not ancestors of the parent revisions // i.e. all revisions not y...
6
public void set(final long i, final Object value) { if (value instanceof Boolean) { setBoolean(i, (Boolean) value); } else if (value instanceof Byte) { setByte(i, (Byte) value); } else if (value instanceof Short) { setShort(i, (Short) value); } els...
7
public static NamedDescription getDescription(Stella_Object self) { { Surrogate testValue000 = Stella_Object.safePrimaryType(self); if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) { { NamedDescription self000 = ((NamedDescription)(self)); return (self000); ...
6
public static void withMeta(Response resp, JSONObject rootJsonObj) { try { resp.version = String.valueOf(rootJsonObj.get(Constants.VERSION)); resp.status = rootJsonObj.getString(Constants.STATUS); if(rootJsonObj.has(Constants.RESPONSE)) { JSONObject respJson = rootJsonObj.getJSONObject(Con...
4
public synchronized void holdFinalMeeting(Employee em){ while(lastMeeting.size() < 13 && timer.getTimeOfDay() < 4950){ try { em.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } String meetingTime = timer.getCurrentTime(); System.out.println(meetingTime + " The Manager is g...
5
private byte[] decrypt(byte[] data) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException { if (data.length > MAX_ENC_SIZE) { System.err .println("Data to long to decrypt. Reason: Possible cheating! Fix: Exit"); System.exit(1); } RSAKeyParameters kp = new RSAKeyParameters(tr...
1
public static int executer_update(String requete) { int key = 0; if (BD_MySQL.debug){ System.out.println("DEBUG : REQUETE : "+requete); } try { BD_MySQL.stmt.executeUpdate(requete, Statement.RETURN_GENERATED_KEYS); } catch (SQLException ex) { L...
4
public static int spiralOrderHelper(int[][] matrix, int x, int y, int[][] matrixHelper, int count) { // if(x > matrix[0].length/2 || y> matrix.length/2 ){ // return newList; // } // top for (int i = x; i < matrix[0].length - x; i++) { if (matrixHelper[y][i] == 1) return count; matrix[y][i] = coun...
8
public void createGUI() { //initializing the game grid gameButtonGrid = new JPanel(); gameButtonGrid.setLayout(new GridLayout(mmg.getMaxGuessAmt(),4)); gameButtonGrid.setPreferredSize(new Dimension(320,320)); Integer i = 1; Integer x = 0; Integer y = 0; hintPanel = new JPanel(); hintPanel.setLay...
9
public void setDynamicAdjustment(boolean isDynamicAdjustment) { // May need to add or remove the TableModelListener when changed if (this.isDynamicAdjustment != isDynamicAdjustment) { if (isDynamicAdjustment) { table.addPropertyChangeListener( this ); table.getModel().addTableModelListener( this ...
2
public void recursiveLight(float level, int[] loc, Color color) { if(level <= 0) return; int x = loc[0]; int y = loc[1]; if(x < 0 || x >= lightLevelGrid.length || y < 0 || y >= lightLevelGrid[x].length) return; if(lightLevelGrid[x][y].a > 1 - (Math.min(level, LightSource.maxStrength) / LightSource....
6
public Polynomials(String str){ polynomial = new ArrayList<>(); Scanner scan = new Scanner(str); for(Term t = Term.scanTerm(scan); t != null; t = Term.scanTerm(scan)) polynomial.add(t); quickSortPolynomial(0, polynomial.size() - 1); }
1
public boolean kaufeGebaeude( int auswahl, int gold, Land freiesLand ) { switch ( auswahl ) { case 0: // kein Kauf -> zurück zum Gebäude bearbeiten break; case 1: // Feld kaufen if ( gold >= this.preisGebaeude ) { Feld neuesFeld = new Feld(); this.aktiverSpieler.besetzeLandMitGebaeude( ...
7
private boolean validAddress(String s) { if (s != null && (s.length() > 26 && s.length() < 35) && (s.startsWith("1") || s.startsWith("3")) && !s.contains("0") && !s.contains("O") && !s.contains("I") && !s.contains("l")) return true; else return false; }
9
public String text() { if(subObjects.size() == 1) if(subObjects.get(0) instanceof String) return (String)(subObjects.get(0)); return null; }
2
private boolean fireAttemptClientConnectEvent(AttemptClientConnectEvent evt) { ISocketServerConnection ssc = evt.getSocketServerConnection(); logger.debug(getName() + " attempt client: " + ssc.getRemoteAddress() + " <idconnection=" + ssc.getIdConnection() + ">"); if (attemptClientCo...
1
private String GetMessageToSend(){ String Message; while(true){ if(!catalogue.MessageInUse){ Message = catalogue.GetClientMessage(Tabid); break; } } return Message; }
2
public void setIdElemento(int idElemento) { this.idElemento = idElemento; }
0
public List<Utr5prime> get5primeUtrs() { ArrayList<Utr5prime> list = new ArrayList<Utr5prime>(); for (Utr utr : utrs) if (utr instanceof Utr5prime) list.add((Utr5prime) utr); return list; }
2
public void soldatenVersorgen( int sold ) { int benötigtesMehl = this.soldaten * 2; int benötigtesGold = this.soldaten * sold; int satteSoldaten = Integer.valueOf( Math.round( this.mehl / 2 ) ); int hungrigeSoldaten = this.soldaten - satteSoldaten; int bezahlteSoldaten = Integer.valueOf( Math.round( this.g...
6
public static Vertex at(Graph g, int x, int y) { DynamicArray<Vertex> vertices = g.getVertices(); Vertex v = vertices.get(0); Vertex closestVertex = v; double closest = Integer.MAX_VALUE; for (int i = 0; i < vertices.getSize(); i++) { v = vertices.get(i); ...
3
public static void setMap(){ jPanel1 = new JPanel(new GridLayout(19,48,0,0)); JLabel labels[] = new JLabel[(19*48)]; String bufferMap = carte.lire("./ressources/map.txt"); for (int i = 0,j = 0; i < bufferMap.length(); i++) { if(bufferMap.charAt(i) =...
7
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if(getValueAt(0, column)==null) return String.class; returnValue = getValueAt(0, column).getClass(); ...
3
public void deposit(BigInteger amount) throws IllegalArgumentException { if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) ) throw new IllegalArgumentException(); setBalance(this.getBalance().add(amount)); }
2
@Override public void handlePeerChoked(SharingPeer peer) { /* Do nothing */ }
0
@Override public void caseAParaComando(AParaComando node) { inAParaComando(node); { List<PComando> copy = new ArrayList<PComando>(node.getComando()); Collections.reverse(copy); for(PComando e : copy) { e.apply(this); } ...
4
void resetColorsAndFonts () { Color oldColor = foregroundColor; foregroundColor = null; setExampleWidgetForeground (); if (oldColor != null) oldColor.dispose(); oldColor = backgroundColor; backgroundColor = null; setExampleWidgetBackground (); if (oldColor != null) oldColor.dispose(); Font oldFont = f...
3
public static void main(java.lang.String args[]) throws NullPointerException, IOException { /** * Starting Up Server */ System.setOut(new Logger(System.out)); System.setErr(new Logger(System.err)); System.out.println("Running Warlords of Hell..."); /** * Accepting Connections */ acceptor ...
8
double getProfit(double predict, double result, double eps1, double eps2) { if (Math.abs(predict - total) >= eps1) { predict = -1; } else if (Math.abs(predict - total) <= eps2) { predict = 1; } else { return 0; } if (result == total) { ...
7
public List get(String alias) { List result = new LinkedList(); for (Iterator it = entries.iterator(); it.hasNext(); ) { Entry e = (Entry) it.next(); if (e instanceof EnvelopeEntry) { if (!((EnvelopeEntry) e).containsAlias(alias)) { continue; } ...
7
public static void dumpXML(XMLStreamReader parser) throws XMLStreamException { int depth = 0; do { switch(parser.getEventType()) { case XMLStreamConstants.START_ELEMENT: for(int i = 1; i < depth; ++i) { System.out.print(" "); } System.out.print("<"); System.out.print(parser.getLocalNam...
9
@Override public void run() { if (state == GameState.WAITING_FOR_PLAYERS) { if (getPlayers(PlayerState.WAITING).size() >= battleground.getMinPlayers()) { //TODO: broadcast message state = GameState.COUNTDOWN; currentCounter = new Counter(30);//TO...
6
public void addCatchPhi(final Block block) { if (phis[cfg.preOrderIndex(block)] != null) { return; } if (prototype instanceof LocalExpr) { final LocalExpr target = (LocalExpr) prototype.clone(); final PhiCatchStmt phi = new PhiCatchStmt(target); phis[cfg.preOrderIndex(block)] = phi; if (SSA.DEBU...
3
private void processRingNumberingAndIrregularities() throws StructureBuildingException { for (Element group : groupsInFusedRing) { Fragment ring = group.getFrag(); if (ALKANESTEM_SUBTYPE_VAL.equals(group.getAttributeValue(SUBTYPE_ATR))){ aromatiseCyclicAlkane(group); }...
9
public void dehoist() { // Shorthand JoeTree tree = hoistedNode.getTree(); tree.setRootNodeCommentState(oldTreeCommentState); hoistedNode.setHoisted(false); // Prune things tree.setRootNode(oldNodeSet); tree.getVisibleNodes().clear(); hoistedNodeParent.insertChild(hoistedNode, hoistedNodeIndex); h...
1
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { double expected; double offset; // Calculate Bowl Size bowlSize = 0; for(int i=0; i<bowl.length; i++) bowlSize += bowl[i]; // Total Fruits n_fruits = n_players*bo...
5
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpo...
9
@Override public Object execute(Object obj, Object[] args) { // 获取实际的PreparedSQL和调用参数 String actualSql = definition.getActualSql(args); List<Object[]> paramArrays = ReflectionUtils.generateBatchQueryArguments(args, definition); KeyHolder keyHolder = null; if (definition.isReturnId()) { keyHolder = dataAc...
2
public boolean mirarPal() { int flush = 0; for (int i=0; i < ma.size()-1; i++) { if (ma.get(i).getPal().equals(ma.get(i+1).getPal())) { flush++; } else { } } if (flush == 4) { return true; } else { return false; } }
3
public void write(JsonWriter out, Map<K, V> map) throws IOException { if (map == null) { out.nullValue(); return; } if (!complexMapKeySerialization) { out.beginObject(); for (Map.Entry<K, V> entry : map.entrySet()) { out.name(String.valueOf(entry.getKey())); ...
8
public static Growth getGrowth(int i) { switch (i) { case 1: return Slow; case 2: return Medium; case 3: return Fast; case 4: return Medium_slow; case 5: return Erratic; case 6: return Fluctuating; } return null; }
6
private static ServerJoinInfo getDetailsFromDirectUrl(final String url) { if (url == null) { throw new NullPointerException("url"); } ServerJoinInfo result = new ServerJoinInfo(); final Matcher directUrlMatch = directUrlRegex.matcher(url); if (directUrlMatch.matches()...
8
@Override public void run() { if (!stats) return; try { ResultSet r = sql.query("SELECT * FROM ctt_stats"); HashMap<String, PlayerStats> p = new HashMap<String, PlayerStats>(); while (r.next()) { p.put(r.getString("player"), new PlayerS...
8
public RouterPacket GetRecentPacket() { return recentPacket; }
0
public static void showSearchResultsTable(ResultSet rs, String searchQuery, List<String> inputs) { int numCols; ResultSetMetaData rsmd; JTextArea tableTitle = null; JTable table = null; try { rsmd = rs.getMetaData(); numCols = rsmd.getColumnCount() + 2; String columnNames[] = new String[numCols]...
8
protected boolean objectShouldBeDrawn(DrawnObject d) { // If the drawnobject is collidingdrawnobject, checks the drawing more // carefully if (d instanceof CollidingDrawnObject) { CollidingDrawnObject cd = (CollidingDrawnObject) d; DoublePoint[] collisionpoints = cd.getCollisionPoints(); // D...
5
public static void main(String[] args) throws EnrycherException, MalformedURLException { // input document String docString = "Tiger Woods emerged from a traffic jam of his " + "own making to thrill thousands of fans with a six-under 66 at " + "the $1.4 million Australian Masters on Thursday."; // URL of E...
6
public List<BranchLeader> getBranchLeaderList() { return branchLeaderList; }
0
public int assignPlayer(String name) { for(int i = 1; i <=4 ; i++) { if(players.get(i).isEmpty()) { players.add(i, new Player(new Bat(new Point2D.Float(50, 400), new Point2D.Double(5,100), 2,new Point2D.Float(0, -4)), 0, name)); return i; } } return 0; }
2
public void run() { while (!isInterrupted()) { String input = new String(); char ch; try { do { ch = (char) s.getInputStream().read(); input = input + ch; } while (ch != '\n' && !isInterrupted()); } catch (IOException e) { e.printStackTrace(); } if (!isInterrupted()) Syste...
5
public double frobeniusNorm(){ double norm=0.0D; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ norm=hypot(norm, Math.abs(matrix[i][j])); } } return norm; }
2
public boolean isBorder() { boolean borderWidth = false; Object border = getObject(BORDER_KEY); if (border != null && border instanceof Vector) { Vector borderProps = (Vector) border; if (borderProps.size() == 3) { borderWidth = ((Number) borderProps.get(2...
4
public Vehicule requestVehicule() { if (!vehicules.isEmpty()) { Vehicule v = vehicules.get(0); vehicules.remove(0); return v; } else return null; }
1
public void printSum(File dir) throws IOException { PrintWriter w; if (file != null) { w = new PrintWriter(new FileWriter(new File(dir, file), true)); } else { w = new PrintWriter(new OutputStreamWriter(System.out)); } w.println(out.toString()); w....
2
private StdImage getDisclosureControl(Row row) { return row.isOpen() ? row == mRollRow ? mDownTriangleRoll : mDownTriangle : row == mRollRow ? mRightTriangleRoll : mRightTriangle; }
3
public void run() { try { init(); } catch (Exception Stacktrace) { Stacktrace.printStackTrace(); } long lastTime = System.nanoTime(); double amountOfTicks = 60.0; double nanoSeconds = 1000000000 / amountOfTicks; double Delta = 0; long Timer = System.currentTimeMillis(); ...
5
public void fillObject(Credit credit, ResultSet result) { //Заполняем кредит try { credit.setId(result.getInt("ID")); credit.setDate(result.getDate("CREDITDATE")); credit.setSum(result.getDouble("CREDITSUM")); credit.setStatus(result.getInt("CREDITSTATUS")...
1
public static int min(int[] element) throws IllegalArgumentException{ if (element.length == 0){ throw new IllegalArgumentException ("tom samling"); } int[] sekvens = element; int antaletPar = sekvens.length / 2; int antaletOparadeElement = sekvens.length % 2; int antaletTankbaraElement ...
5
public ClassAnalyzer getClassAnalyzer(ClassInfo cinfo) { if (cinfo == getClazz()) return this; if (parent == null) return null; return getParent().getClassAnalyzer(cinfo); }
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 TimeSlotHelper(long startOfDay, int nDay) { this.startOfDay = startOfDay; this.nDay = nDay; this.nSlot = nDaySlot * nDay; this.aIsAvailable = new boolean[this.nSlot]; Arrays.fill(this.aIsAvailable, true); }
0
public void gravity(Collection<GameObject> objects){ for(GameObject gameObject : objects){ if(gameObject.getEffectedByGravity()){ applyForce(gameObject, 0, 1); } } }
2
public static ArrayList<PokerHandEvaluation> getWinners(ArrayList<PokerHandEvaluation> potentialWinners) { //we have a tie and we need the rank of the first player (the rank is the same for all players TIE) PokerHandEvaluation firstPlayerEvaluation = potentialWinners.get(0); int rank = firstPlayerEvaluation.ge...
8
public void setorderBy(int column) { /* if the users clicks on the same column again, flip the order */ if(lastClickedColumn == column) { order = !order; } lastClickedColumn = column; switch(column) { case 0: orderby = "Title"; break; case 1: orderby = "Artist"; break; ...
8
public SMTPHostAuth(String unparsedServerInfo) { final List<String> info=CMParms.parseCommas(unparsedServerInfo,false); if(info.size()==0) return; host = info.remove(0); if((info.size()==0)||(host.length()==0)) return; final String s=info.get(0); if(s.equalsIgnoreCase("plain")||s.equalsIgnor...
7
@Override public boolean evaluate(T t) { if(firstSearchString.evaluate(t) || secondSearchString.evaluate(t)){ return true; } else{ return false; } }
2
public Audience updateAudience(String userName, String password, String firstName, String lastName,String email) { Audience viewer = manager.find(Audience.class, userName); if (viewer != null) { viewer.setUserName(userName); viewer.setPassword(password); viewer.setFirstName(firstName)...
1
public static Double getPrejudice(AllocationInfo allocationToTake, AllocationInfo allocationToWin, List<AllocationInfo> allAllocations, final Map<String, Double> balances) { double totalAllocations = 0; double totalPeerBalance = 0; for (AllocationInfo info : allAllocations) { totalAllocations += info...
7
public static int createStudent() { System.out.println("=== Creation of a student ==="); Scanner scId = new Scanner(System.in); System.out.print("Give a name: "); String name = ""; while (name.equals("")) { Scanner scName = new Scanner(System.in); name = scName.nextLine(); } System.out.print("Give a...
6