text
stringlengths
14
410k
label
int32
0
9
public boolean check() { for (InputNode in : this.input) { if (!in.check()) { // System.out.println("Input Node " + in.getName() + " is not valid"); return false; } } for (InnerNode in : this.inner) { if (!in.check()) { // System.out.println("Inner Node " + in.getName() + " is not valid"); ...
6
protected void onEntryRemove(Object key, ICacheable data){ if(null != mDiskLruCache){ mDiskLruCache.put(key, data); } }
1
public static final boolean isPrimitiveArray(Object array) { if (array != null) { Class<?> clazz = array.getClass(); if (clazz.isArray()) { String className = array.getClass().getName(); return className.length() == 2 && className.charAt(0) == '['; } } return false; }
4
public static void main(String[] args) { QArrayCount<Integer> q = new QArrayCount<Integer>(); for (int i = 1; i <= 567; i++) q.enqueue(i); for (int i = 1; i <= 89; i++) q.dequeue(); for (int i = 8; i <= 9; i++) q.enqueue(i); for (int i = 1; i <= 43; i++) q.dequeue(); for (Integer i : q) ...
5
public void setHmac(Key key){ Mac hmac = null; try { hmac = Mac.getInstance("HmacSHA256"); } catch (NoSuchAlgorithmException e) { // TODO vernuenftiges handling e.printStackTrace(); } try { hmac.init(key); } catch (InvalidKeyException e) { // TODO vernuenftiges handling e.printStackTrace()...
2
@Override public Move chooseMove(State s) { // return if there are no moves available if (s.findMoves().size() == 0) return null; synchronized (s) { try { s.wait(); } catch (InterruptedException e) {} return Board.getMove(); } }
2
@Test public void testRandom () { System.err.println ("testRandom"); int numRects = 100000; int numRounds = 10; Random random = new Random (1234); // same random every time for (int round = 0; round < numRounds; round++) { tree = new PRTree<Rectangle2D> (converter, 10); List<Rectangle2D> rects = ne...
5
public void replenishmentOrder(String manu, String modNum, int q) { System.out.println("Sending replenishment order..."); Statement s = null; String updateRep = "UPDATE ProductDepot p SET p.replenishment = '" + q + "' WHERE p.manufacturer = '" + manu + "' AND p.model_number = '" + modNum + "'"; try { s =...
2
private String getDescription() { String desc = "@MongoBatchInsert(" + this.getParsedShell().getOriginalExpression() + ")"; if (!StringUtils.isEmpty(globalCollectionName)) { desc = ",@MongoCollection(" + globalCollectionName + ")"; } return desc; }
1
@SuppressWarnings("unchecked") @Override public B get(A a) { B b = null; try { b = (B) getMethod.invoke(a, new Object[0]); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTra...
3
@Override public int compareTo(CButton o) { final int compareTo = this.getText().compareTo(o.getText()); if (this != o && compareTo == 0) return this.name.compareTo(o.getText()); else return compareTo; }
2
private static void updateSecondProjectView() { getInstance().secondProjectTitleL.setText("Second Project: " + getInstance().secondProject.getProjectName()); getInstance().secondProjectScreensCBL.setListData(getScreenCheckBoxes( getInstance().secondProject, false)); getInstance().secondProj...
0
private static void printConfiguration (int indent, Configuration c) { String temp; // atypical: should always be able to read configuration if (c == null) { indentLine (indent, "<!-- null configuration -->"); return; } indentLine (indent, "<config value='" + c.getConfigurationValue () +...
7
private int sMax(int sMax) { if (radius <= 100) { return (int) Math.floor(0.65 * sMax); } else if (radius >= 800) { return sMax; } else { double result = 0.18 * Math.log1p(radius) - 0.2; return (int) Math.floor(result*sMax); } }
2
private static void mergePreferences( CommonPrefResource prefFile, Properties properties, MultiStatus status) { if (prefFile == null && properties == null) return; if (!prefFile.exists) return; InputStream input = null; // Added this code for testing /*try { input = prefFile.getInputStream(...
8
@Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); // null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot =...
6
@Override protected boolean doDelete(final String key) { try { return cache.remove(key); } catch (Throwable e) { CacheErrorHandler.handleError(e); return false; } }
1
public List<Integer> analyze() { List<Integer> features = new ArrayList<Integer>(); try { // find min and max values: for (String chr : decompressorISS.getChromosomes()) { boolean lastBaseOverThreshold = true; CompressedCoverageIterator it = decompressorISS .getCoverageIterator(); while (it....
8
private boolean gameInitFromFile(File fin){ DataInputStream file; try{ file = new DataInputStream(new BufferedInputStream(new FileInputStream(fin))); }catch (FileNotFoundException ex){ return false; } try{ asteroids = new ArrayList<Asteroid>(); bullets = new ArrayList<Bullet>(); //write ...
7
public void createObj(){ for(int i=0; i<1100000;i++){ TestGarbageCollector t = new TestGarbageCollector(); } System.out.println(Runtime.getRuntime().freeMemory()/1024+"MB"); }
1
public double characterEnergy() { if (P2character.equals("White")) { return whiteKnight.characterEnergy(); } else if (P2character.equals("Bond")) { return jamesBond.characterEnergy(); } else if (P2character.equals("Ninja")) { ...
4
public TreeNode nodeAtPoint(Point2D point, Dimension2D size) { Iterator it = nodeToPoint.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); Point2D p = scalePoint((Point2D) entry.getValue(), size); TreeNode node = (TreeNode) entry.getKey(); if (nodeDrawer.onNode(no...
2
public void updateFiles() throws ClassNotFoundException, IOException{ boolean found=false; File dropins = new File("./dropins/plugins/"); File [] names = dropins.listFiles(new PluginFilter(dropins)); if(names.length==0){ return; } Collection<File> pluginstmp = new ArrayList<File>(); for(File p...
6
public void damageTile(int x, int y, int damage) { if (x < 0 || x >= width || y < 0 || y >= height) { return; } if (getTile(tiles[x + y * width][0]).isSolid() && getTile(tiles[x + y * width][0]).canBeDamaged()) { tiles[x + y * width][1] += damage; if (getTile(tiles[x + y * width][0]).getMaxDamage() <=...
7
public static byte[] unencodedSeptetsToEncodedSeptets(byte[] septetBytes) { byte[] txtBytes; byte[] txtSeptets; int txtBytesLen; BitSet bits; int i, j; txtBytes = septetBytes; txtBytesLen = txtBytes.length; bits = new BitSet(); for (i = 0; i < txtBytesLen; i++) for (j = 0; j < 7; j++) if ((txt...
7
@Override public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isPet) { if (attacker == null) return null; L2Character originalAttackTarget = (isPet ? attacker.getPet() : attacker); if (attacker.isInParty() && attacker.getParty().isInDimensionalRift()) { byte riftType =...
6
private void click() { if(curPage == 0) { if(options.get(curPage)[curOption].getTitle().equals("Resume")) { game.enterState(Game.IN_GAME_STATE_ID, new FadeOutTransition(), new FadeInTransition()); } else if(options.get(curPage)[curOption].getTitle().equals("Exit to Main M...
3
@Override public String toString() { String[][] board = new String[8][8]; Iterator<Piece> it = this.whitePieces.iterator(); while (it.hasNext()) { Piece next = it.next(); Point p = next.getPosition(); if (next.isKing()) board[p.x][p.y] = "W"; else board[p.x][p.y] = "w"; } // end while ...
7
public static Object kettleCast(Object value) { if (value == null) { return value; } Class<?> c = value.getClass(); if (c == Integer.class || c == int.class) { return ((Integer) value).longValue(); } if (c == Float.class || c == float.class) { return ((Float) value).doubleValue(); } if (c == Bi...
7
public double lorentzInnerProduct(Matrix matrix2, boolean isRowVector) { // Can only operate on a "vector" (nx1 matrix) if ((!isRowVector && ((numCols > 1) || (matrix2.numCols > 1))) || (isRowVector && ((numRows > 1) || (matrix2.numRows > 1)))) return Double.NaN; double result = 0.0; for (int i = 0; i...
9
public List<ZoneResource> listZoneRecords(final Zone zone) { Set<ZoneResource> zoneResources = new HashSet<ZoneResource>(); boolean readMore = true; Map<String, String> query = new HashMap<String, String>(); while (readMore) { String result = pilot.executeResourceRecordSetGet(zone.getExistentZoneId(), ...
7
private void btnAgregarEventoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarEventoActionPerformed //obtenemos lo necesario de la vista: int idCliente = obtenerClaveClienteSeleccionado(); int idEmpleado = obtenerClaveEmpleadoSeleccionado(); int idMesa = obten...
3
public List<Noeud> genererPlanDepuisXML() throws XmlParserException { File xml = this.fichierATraiter; ArrayList<Noeud> listeDesNoeuds=null; if (xml != null) { try { // creation d'un constructeur de documents a l'aide d'une fabrique ...
6
public static long directorySize(File directory) { long length = 0; for (File file : directory.listFiles ()) { if (file.isFile ()) { length += file.length (); } else { length += directorySize (file); } } return length; }
2
public TagParseResult clone() { ByteArrayOutputStream byteOut = null; ObjectOutputStream out = null; ByteArrayInputStream byteIn = null; ObjectInputStream in = null; try { byteOut = new ByteArrayOutputStream(); out = new ObjectOutputStream(byteOut); out.writeObject(this); byteIn = new By...
9
private void requestFriends(int startIndex) { HttpGet httpget = new HttpGet("http://m.facebook.com/" + user.getUserUIDString() + "?v=friends&startindex=" + startIndex); CloseableHttpResponse response = null; HttpEntity entity = null; String str = null; try { response = httpClient.execute(httpget...
8
protected void onPrivateMessage(String sender, String login, String hostname, String message) { if (sender.equals("geordi") || sender.equals("clang")) { sendMessage(MAINCHAN,message); return; } if (message.startsWith("?") && sender.equals("IsmAvatar")) this.sendRawLineViaQueue(message.substring(1))...
8
public static boolean processTripleMegaPhone(final MapleClient c, final List<String> message, final byte numlines, final boolean ear) { String tag = ""; String legend = ""; final List<String> messages = new LinkedList<String>(); String msg = "-"; for (byte i = 0; i < numlines; i+...
8
public void draw(Graphics2D g, int rotation) { if (!isFinished()) { setRotationAngle(getRotationAngle() + rotation); double xRotation = getXRotation(); double yRotation = getYRotation(); boolean canDraw = true; boolean leftTurn = false; for (Block block : blockArray) { if (rotation > 0)...
8
public synchronized boolean updateCrashedPeers(Set<Byte> crashedPeerOrds) { boolean somethingChanged = false; //DEBUG for (byte b : crashedPeerOrds) { System.out.println(String.format("MORTO: %s", b)); } if (crashedPeerOrds.contains(this.getOrd())) { gameTable.forceEndGame("La tua connessione è troppo...
5
String readByteXByteSIBmsg() { //configurable buffer size int buffsize= 4 *1024; StringBuilder builder = new StringBuilder(); char[] buffer = new char[buffsize]; String msg = ""; int charRead =0; try { while ((charRead = in.read(buffer, 0, buffer.length)) != (-1)) { builder.append(buffer, ...
5
double getAttack(Match match, Team team) { int countMatches = 0; int[] goals = new int[deep]; Match currentMatch = getPrevMatch(team, match); for (int i = 0; i < deep && currentMatch != null; i++, currentMatch = getPrevMatch( team, currentMatch), countMatches++) { ...
4
@Override public String toString() { int i; StringBuilder sb = new StringBuilder(); if (this.getMarks() != null) { try { if (average() != 0) { sb.append(super.toString()); sb.append("\n\tPromotion: " + p.getName()); sb.append("\n\tId: ").append(id).append("\n\tMarks: "); for (i = 0; ...
5
public synchronized String kick(String player) { player = player.toLowerCase().trim(); MiniServer bannedPlayer = null; System.out.println("1. " + player); System.out.println("2. " + host.getClientName().toLowerCase().trim()); if(player.equals(host.getClientName().toLowerCase().trim())) { try { host....
9
public boolean almostEquals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; Root other = (Root) obj; if (expr == null) { if (other.expr != null) return false; } else if (!expr.equals(other.expr)) return false; if (nthRoot != other.nthRoot) retur...
6
@Override public boolean isReallyNeutral(FactionMember M) { if(M != null) { Faction F=null; Faction.FRange FR=null; for(final Enumeration<String> e=M.factions();e.hasMoreElements();) { F=CMLib.factions().getFaction(e.nextElement()); if(F!=null) { FR=CMLib.factions().getRange(F.faction...
7
@Override public String introduceYourself() { return "DecisionQuest"; }
0
public void newGame() { final int rows = this.mRows; final int cols = this.mCols; if (null == this.mCellsState) { this.mCellsState = new CellState[rows][cols]; } for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { this.mCel...
9
private static boolean isKingInCheckAfterMoveRec(byte[][] board, byte piece, int hPos, int vPos, int skiphPos, int skipvPos, int tohPos, int tovPos, int hAdd, int vAdd) { hPos += hAdd; vPos += vAdd; if (hPos < 0 || hPos > 7 || vPos < 0 || vPos > 7 || (hPos == tohPos && vPos == tovPos)) { return false; } ...
9
public void notifyWorldModelListeners() { for (final WorldModelListener listener : this.listenersWorld) { notifyWorldModelListener(listener); } }
1
*/ private GrammarTable initGrammarTable() { grammarTable = new GrammarTable(new GrammarTableModel(grammar) { public boolean isCellEditable(int r, int c) { return false; } }); return grammarTable; }
0
@Override public int[] next() { if (started == false) { this.current = new int[size]; for (int i = 0; i < size; i++) this.current[i] = i + 1; this.started = true; return this.current; } int[] new_digits = current.clone(); int n = new_digits.length - 1; int j = n - 1; while...
7
public void tick() { snake.move(); for (int i = 0; i < food.getFood().size(); i++) { if (snake.getHead().getX() == food.getFood().get(i).getX() && snake.getHead().getY() == food.getFood().get(i).getY()) { food.ateMeat(i); snake.increase...
3
@Override public T validate(String fieldName, T value) throws ValidationException { if (value == null) { return null; } if (max.compareTo(value) <= 0) { throw new ValidationException(fieldName, value, "must be less than " + max); } return value; }
2
public static String half2Fullchange(String QJstr) throws Exception { StringBuffer outStrBuf = new StringBuffer(""); String Tstr = ""; byte[] b = null; for (int i = 0; i < QJstr.length(); i++) { Tstr = QJstr.substring(i, i + 1); if (Tstr.equals(" ")) { ...
3
public static void engine() { if (World.world[World.PLAYER_POS_X][World.PLAYER_POS_Y] .equals(GlobalParams.paling)) { System.out.println("Забор не помеха? Ну-ну..."); World.PLAYER_POS_X = x; World.PLAYER_POS_Y = y; } if (World.world[World.PLAYER_POS_X][World.PLAYER_POS_Y] .equals(GlobalParams....
5
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); StringBuilder sb = new StringBuilder( ); int casos = Integer.parseInt( in.readLine( ) ); in.readLine( ); for (int t = 0; t < casos; t++) { lineas = new ArrayList<String>();...
7
private void smoothOver(Run start, Run end) { Run currentRun = start; while(currentRun != end.getNext()) { if(currentRun.next.getRunLength() == 0) remove(currentRun.getNext()); else if((currentRun.getRunType() == currentRun.getNext().getRunType()) && (currentRun.getHungerVal() == curre...
4
@Override public void deletePerson(Person person) throws SQLException { Connection dbConnection = null; PreparedStatement preparedStatement = null; String deletePerson = "DELETE FROM person WHERE name = '"+ person.getName() + "' AND surname = '" + person.getSurname()+"'"; try { dbConnection = PSQL.getCon...
3
private IdentificadorVariavelVetor completarIdVariavelVetor(Identificador id) throws SemanticError { int limiteSuperior = tipoConstante == Tipo.INTEIRO ? Integer.parseInt(valorConstante) : valorConstante.charAt(0); int tamanho = limiteSuperior - valorLimiteInferior + 1; int deslocamentoVetor = deslocam...
1
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
@Override public void run() { BufferedReader reply = makeRequest(); if(reply == null) // Stop immediately if the request did not generate a response. return; /* Send the request to be interpreted and alert the user * about the response. */ if(parseXml(reply)) { if(mReply == REPLY_SUCCESS) { mUi.d...
4
public void carregarProfessoresDeArquivo(String nomeArquivo) throws ProfessorJaExisteException, IOException { BufferedReader leitor = null; try { leitor = new BufferedReader(new FileReader(nomeArquivo)); String nomeProf = null; do { nomeProf = leitor.readLine(); // lê a próxima linha do arquivo, ...
3
public void update(){ }
0
public void keyReleased(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_UP||e.getKeyCode()==KeyEvent.VK_W){ Up = false; } if(e.getKeyCode()==KeyEvent.VK_DOWN||e.getKeyCode()==KeyEvent.VK_S){ Down = false; } if(e.getKeyCode()==KeyEvent.VK_LEFT||e.getKeyCode()==KeyEvent.VK_A)...
9
@Override public int compareTo(Element<T> o) { if(this.isHead()) return 1; if(this.isTail()) return -1; if(o.isHead()) return -1; if(o.isTail()) return 1; return (this.value).compareTo(o.value); }
4
public Building(double x, double y, double width, double height) { if (x == 0 && y == 0 && width == 0 && height == 0) { x = Board.getInstance().getWidth() - 1; y = Board.getRandom(200, 250); width = Board.getRandom(500, 1000); height = 300; } this....
5
public void setup() { //CREATE WALKER OBJECT Walker walker = new Walker(BUFFER); // load program properties Config config = new Config("props/superD.properties"); //list of directories to scan List<File> rootDirs = new ArrayList<File>(); //Load in all directories to sca...
7
public ArrayList<DrawableItem> getItems() { return items; }
0
private void saveSQL(PrintStream out) throws IOException { out.println("<br><br>"); out.println("<h3>Script SQL</h3>"); String name, str, text, textFinal, requete; List<String> keywords = sql.getKeywords(); List<String> types = sql.getTypes(); text = sql.ge...
6
private void makeRoom(int numValues) { if (values == null) { values = new float[2 * numValues]; types = new int[2]; numVals = 0; numSeg = 0; return; } int newSize = numVals + numValues; if (newSize > values.length) { int nlen = values.length * 2; if (nlen < newSize) nlen = newSize...
4
* @param text messages to be added about the meeting. * @throws IllegalArgumentException if the list of contacts is * empty, or any of the contacts does not exist * @throws NullPointerException if any of the arguments is null */ public void addNewPastMeeting(Set<Contact> contacts, Calendar date, String text) t...
3
public static void setSkin(Plugin plugin, final Player p, final String toSkin) { new BukkitRunnable() { @Override public void run() { try { Packet packet = new PacketPlayOutNamedEntitySpawn(((CraftPlayer) p).getHandle()); Field ...
3
private void setUpLogin() { setUpRegister(); login = new JPanel(); // Controls final JTextField username = new PlaceholderTextField("username"); final JPasswordField password = new PlaceholderPasswordField("password"); JButton submit = new JButton("Login"); JButton register = new JButton("Register"); ...
2
public void wdgmsg(Widget sender, String msg, Object... args) { int ep; if((ep = epoints.indexOf(sender)) != -1) { if(msg == "drop") { wdgmsg("drop", ep); return; } else if(msg == "xfer") { return; } } if((ep = equed.indexOf(sender)) != -1) { if(msg == "take") wdgmsg("take", ep, args[0])...
8
public boolean doCheck() { return this.check; }
0
public void WGOverridePwd(String sender, Command command) { if(command.arguments.length == 3) { User user; for(Game game : games.values()) { user = getUserByNick(game, command.arguments[1]); if(user != null) { user.setPassword(command.a...
4
protected void updateView(String machineFileName, String input, JTableExtender table) { ArrayList machines = this.getEnvironment().myObjects; Object current = null; if(machines != null) current = machines.get(0); else current = this.getEnvironment().getObject(); if(current in...
6
public static boolean isValid( RushHourCar car, ArrayList<RushHourCar> cars, int width, int height ) { ArrayList<Point> carBlocks = car.getBlocks(); for( Point carBlock : carBlocks ) { if( carBlock.x >= width || carBlock.x < 0 || carBlock.y >= height || carBlock.y < 0 ) { return false; } for( RushHour...
8
public static String reverse1(String s) { String rev = ""; int n = s.length(); for (int i = 0; i < n; i++) rev += s.charAt(n - i - 1); return rev; }
1
protected void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed if(JOptionPane.showConfirmDialog(rootPane,"Deseja Salvar os dados?") == 0){ /*if(txtNome.getText().isEmpty()){ JOptionPane.showMessageDialog(rootPane, "O campo nome não...
8
public static Image gaussianNoise(Image original, double avg, double dev, double p) { if (original == null) return null; Image gaussian = original.shallowClone(); for (int x = 0; x < original.getWidth(); x++) { for (int y = 0; y < original.getHeight(); y++) { double rand = Math.random(); double n...
4
public void setRatingId(int ratingId) { this.ratingId = ratingId; }
0
@Override public boolean handleCommandParametersCommand(String providedCommandLine, PrintStream outputStream, IServerStatusInterface targetServerInterface) { String[] commandParts = GenericUtilities.splitBySpace(providedCommandLine); if(commandParts.length == 2) { List<String> params = targetServerInt...
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Instructions other = (Instructions) obj; if (!Objects.equals(this.gameInstructions, other.gameInstruction...
4
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 onMouseClick(int mouseX, int mouseY, int mouseButton) { if (mouseButton == 0) { // Left-click for (Button button : buttons) { if (button.active && mouseX >= button.x && mouseY >= button.y && mouseX < button.x + button.width && mouseY < button.y ...
7
private void jTableProductosMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProductosMousePressed // TODO add your handling code here: try { jButton1.setEnabled(true); jButton2.setEnabled(true); Cant = Integer.parseInt(JOptionPane.showInputDialog(...
8
public static InputStream getInputFromJar(String path) throws IOException { if (path == null) { throw new IllegalArgumentException("The path can not be null"); } URL url = plugin.getClass().getClassLoader().getResource(path); if (url == null) { return null; } URLConnection connection = url.openConn...
2
public static int fieldNum(String name) { int fieldNum = 0; if (name.equals("NMD.GENE")) return fieldNum; fieldNum++; if (name.equals("NMD.GENEID")) return fieldNum; fieldNum++; if (name.equals("NMD.NUMTR")) return fieldNum; fieldNum++; if (name.equals("NMD.PERC")) return fieldNum; fieldNum++; ...
4
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed if (txtNomUsager.getText().equals("") || txtPrenomUsager.getText().equals("") || txtNomOeuvre.getText().equals("")) { JOptionPane.showMessageDialog(null, "Tous les champs sont requis.", "Err...
8
private int requestEngineMove() { int move = Game.NULL_MOVE; int ponder = Game.NULL_MOVE; try { if (client.isPondering()) { client.send("stop"); while (client.isPondering()) client.receive(); } ...
9
@Override public void task(int tId) { try { int nRow, nCol; int[][] mat; int[] vec; int[] product; File file; BufferedReader reader; PrintWriter printWriter; String line; String[] elements; //read the shared matrix file file = new File("fs/exampl...
9
public void createBasis(double[][] A, double[] c, String[] I){ //Identifies how many artificial variables are needed //Finds an identity matrix in A //Indicates in which columns are the necessary columns to form a base B= new double[0][0]; int numArt=0; for (int i = 0; i < A.length; i++) { double[...
9
public static String getSavePath(){ String os = System.getProperty("os.name").toUpperCase(); String path = null; String subFolder = "Operation5a"; if (os.contains("WIN")) path = System.getenv("APPDATA") + "/" + subFolder + "/"; else if (os.contains("MAC")) path = System.getProperty("user.h...
3
public static void main(String[] args) { new Enter("NetFlow"); }
0
public final static Opponent getByName(String name) throws NotFound { Opponent o = new Opponent(); o.setName(name); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("playerName", name)); try { JSONObject ob = Utils.getJSON("fights/searchCharacterJson/1", nvps); ...
3
public void setEventDescription(String[] eventDescription) { this.eventDescription = eventDescription; }
0
private void jButton_passwordOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_passwordOKActionPerformed password = jPasswordField1.getPassword(); StringBuilder str1 = new StringBuilder(); for (int i = 0; i < password.length; i++) { str1.append(password[i]...
4
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { if (l1 == null) { if (l2 == null) return null; return l2; } if (l2 == null) return l1; ListNode out = null; ListNode p1 = l1; ListNode ...
9