text
stringlengths
14
410k
label
int32
0
9
private void BtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtGravarActionPerformed if (camposobrigatoriospreenchidos()) { if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja realmente Gravar os dados deste funcionário?", "Confirmar", JOptionPane.YES_NO_OPTION...
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=mob; if(mob.isInCombat()) { mob.tell(L("You can't meditate while in combat!")); return false; } if(!CMLib.flags().isSitting(mob)) { mob.tell(L("You must be in a sitt...
7
public void setName(String name) { Name = name; }
0
private void getSaisie(boolean decrypt) { ISaisie s=new Saisie(this.menu,decrypt,this); while(s.estEnCours() && !this.stop) { try { Thread.sleep(100); } catch (InterruptedException e) { } } s.masquer(); if(!this.stop) { this.key=s.getKey(); this.m=s.getMessage(); this.typeCode=s.getTypeC...
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((endDate == null) ? 0 : endDate.hashCode()); result = prime * result + ((startDate == null) ? 0 : startDate.hashCode()); result = prime * result + ((carType == null) ? 0 : carType.hashCode()); return resu...
3
public void Show() { System.out.print("["); for (int i = 0; i < _ListaDeObjetos.size(); i++) { if(_ListaDeObjetos.get(i) != null) { System.out.print(_ListaDeObjetos.get(i).getNombre()); if(i + 1 < _ListaDeObjetos.size()) ...
4
private boolean unzip() { URL url = null; try { url = new URL(src); } catch (MalformedURLException e) { e.printStackTrace(); return false; } if (EventQueue.isDispatchThread()) page.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (Zipper.sharedInstance().getProcessMonitor() == nul...
7
private void moveAllAnimals() { for (int i = 0; i < animalFactory.getQuantityOfVictims(); i++) { animalFactory.getVictim(i).move(); } for (int i = 0; i < animalFactory.getQuantityOfPredator(); i++) { animalFactory.getPredator(i).move(); } }
2
public void buildMatrix() { this.getSize().setWidth(this.RowCells * this.CellSize.getWidth()); this.getSize().setHeight(this.Rows * this.CellSize.getHeight()); this.Matrix.clear(); int row = 0; int z = 0; for(int i = 0; i < Cells; i++) { this.Matr...
2
public Button(String text) { this.text = text; setBounds(0, 0, text != null ? Text.getDefault().getWidth(text) : 1, text != null ? Text.getDefault().getHeight(text) : 1); addMouseListener(new DefaultButtonAdapter()); }
2
public static void collapseToParent(JoeTree tree) { TextKeyListener.collapseToParent(tree.getEditingNode()); return; }
0
private int countMatadors() { // If it's a null game, we don't have multipliers, skip this. if(this.gameType.getGameType() == GameTypeOptions.GameType.Null) return 0; // Create our trump card list. List<Card> trumpList = new ArrayList<Card>(); trumpList.add(new Card(Card.CARD_SUIT.CLUBS, Card.FACE_VALUE...
7
@Override // #TODO: Bug when clicking, sometimes requires a double click? public void mouseClicked(MouseEvent e) { GridLabel g = (GridLabel) e.getSource(); if(currentlyClickedLabel != null && g == currentlyClickedLabel) // Clicked the same button, deselect { g.setBackground(Color.LIGHT_GRAY); GameWindow.r...
9
public static void makeAMove(HanoiGame game, int pileA, int pileB) { int sizeTopPileA = game.getCurrentSituation().get(pileA).seeLast() .getSize(); int sizeTopPileB = game.getCurrentSituation().get(pileB).seeLast() .getSize(); if (sizeTopPileA != 0 && (sizeTopPileB == 0 || sizeTopPileA < sizeTopPileB)...
4
public void die() { Deer prev = null; Deer curr = null; // remove this deer from the linked list of deer if (head == this) head = head.next; else { prev = head; curr = prev.next; while (curr != null && curr != this) { prev = curr; curr = prev...
4
public String toString() { return name; }
0
@Override public PermissionType getType() { return PermissionType.USER; }
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 int getProbableDirectionCode(final String theDir) { if(theDir.length()==0) return -1; final String upDir=theDir.toUpperCase(); for (final Object[] element : DIRECTIONS_FULL_CHART) { if((element[0].toString().equals(upDir)) &&(((Integer)element[1]).intValue()<NUM_DIRECTIONS())) return ((Inte...
9
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if(messedUp) { if(activity == CraftingActivity.LEARNING) commonEmote(mob,L("<S-NAME> fail(s) to learn how to make @x1.",...
7
public T get(int i){ T dato = null; if(i >= 0){ Integer contador = 0; Nodo<T> nodoQ = this.inicio; while(nodoQ != null){ if(i == contador){ dato = nodoQ.getInfo(); break; }else{ nodoQ = nodoQ.getLiga(); contador++; } } return dato; }else{ return dato; } ...
3
@Override public int getAge() { String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); /* save all arguments into an array */ Object[] args = new Object[0]; Class<?>[] argsType = new Class<?>[0]; int ret = 0; try { ret = (Integer)super.invokeMethod(methodName, args, argsType);...
5
private final void capLinePath() { g.draw(linePath); // Dump the path to the graphics... linePath.reset(); // Clear the path... linePath.moveTo((float) currentTurtle.position.getX(), (float) currentTurtle.position.getY()); // We've started anew! }
0
private void GoToRestaurant() { state = AgentState.WaitingInRestaurant; print("Doing GoToRestaurant"); switch(name) { case "0.00": money = 0.00; break; case "5.00": money = 5.00; break; case "10.00": money = 10.00; break; case "15.00": money = 15.00; break; case "20....
7
private boolean checkHorizontal(Cell origin) { int count = 1; Cell next = null; Position pos = origin.getPosition(); // Count coins to the left if (pos.getCol() > 0) { // First cell to the left next = getCell(pos, 0, -1); // Continue left until the cell is empty or placed by another player ...
9
@Override public void mouseEntered(int mx, int m, GUIComponent component) { if (component instanceof CardComponent && component.belongsTo(playersComponent) && ((CardComponent) component).getAssociatedPlayer() instanceof HumanPlayer) { setHoverCardComponent((CardComponent)component); } ...
3
public void renderTile(int xPos, int yPos, Tile tile) { xPos -= xOffset; yPos -= yOffset; for(int y = 0; y < tile.sprite.size; y++){ int ya = y + yPos; for(int x = 0; x < tile.sprite.size; x++) { int xa = x + xPos; if(xa < -tile.sprite.size || xa >= width || ya < 0 || ya > width) break; if(xa < ...
7
@Override public boolean onMouseDown(int mX, int mY, int button) { if(super.onMouseDown(mX, mY, button)) { return true; } for(ShopItemButton sib : itemSlots) { if(sib.onMouseDown(mX, mY, button)) { return true; } } ...
3
static public boolean deleteDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); } } } return (path.delete()); }
3
public static void main(String a[]) throws SocketException, IOException { String hostName = new String(""); int port = 6000; String team = new String("Krislet3"); String prototype = "Krislet"; try { // First look for parameters for( int c = 0 ; c < a.length ; c += 2 ) { if( a[c].compare...
6
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
5
public int getTeamPointsObtained(PlayerModel player, PlayerModel partner) { int combinedBid = player.getNumBid() + partner.getNumBid(); int combinedTricks = player.getNumTricks() + partner.getNumTricks(); boolean BurntMellow1 = player.isBurntMellow(); boolean BurntMellow2 = partner.isBurntMellow(); int sco...
9
private void jButtonUpdateFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpdateFornecedorActionPerformed // UPDATE FORNECEDOR -> DEPOIS DE EDITAR String nome = jTextFieldNomeFornecedor.getText(); String morada = jTextFieldMoradaFornecedor.getText(); S...
7
public static ArrayList<Point> reverseArray(ArrayList<Point> array) { ArrayList<Point> newarray = new ArrayList<Point>(); for (int c = array.size() - 1; c >= 0; c--) { newarray.add(array.get(c)); } return newarray; }
1
private static final int method3963(int i, Class251 class251) { if (i != 594) return 7; if (class251 == Class135_Sub2.aClass251_4835) return 1; if (class251 != Class239_Sub18.aClass251_6030) { if (class251 != Class348_Sub40_Sub38.aClass251_9477) { if (Class57.aClass251_1051 == class251) return 4...
6
private void runHideZigZag(int array[][]) { convolution = zigZag.getHideZigZagArray(array, SIZE); for (int i = 0; i < STEP * STEP; i++) { arrayForZigZag[position++] = convolution[i]; } }
1
public final int getN() { return n; }
0
public String getSortConfig() { StringBuilder buffer = new StringBuilder(); int count = mColumns.size(); boolean hasSort = false; buffer.append('S'); buffer.append(CONFIG_VERSION); buffer.append('\t'); buffer.append(count); for (int i = 0; i < count; i++) { Column column = getColumnAtIndex(i); in...
3
@Override public void in() throws Exception { if (data == null) { throw new ComponentException("Not connected: " + toString()); } Object val = data.getFieldValue(); // fire only if there is a listener if (ens.shouldFire()) { DataflowEvent e = new Dataf...
2
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this); if ((clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavor.stri...
3
@Override public void windowDeiconified(WindowEvent arg0) { }
0
@Id @Column(name = "PRP_MOA_CONSEC") public Integer getPrpMoaConsec() { return prpMoaConsec; }
0
public static String getALError(int err) { switch (err) { case AL_NO_ERROR: return "AL_NO_ERROR"; case AL_INVALID_NAME: return "AL_INVALID_NAME"; case AL_INVALID_ENUM: return "AL_INVALID_ENUM"; case AL_INVALID_VALUE:...
6
public void sendAssignment(File file, String assignment, String course, String vfykey) throws IOException { if (!open) { try { connect(); } catch (KeyManagementException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnrecoverableKeyException e) { // TODO Auto-generated...
8
@Override public void analyze(){ try { for(int i=0; i<numFiles; i++){ File f = files.get(i); InputStream traingInputStrem = new BufferedInputStream(new FileInputStream(f.getPath())); trainSequencer.setSequence(traingInputStrem); Sequence trainSequence = trainSequencer.getSequence(); Tr...
6
public static void displayStudent(int mode) { if (FileReadService.sList.isEmpty()) { System.out.println("There is no Students !"); } else { System.out.println("Which student do you want to choose ?"); int i; for (i = 0; i < FileReadService.sList.size(); i++) { System.out.print(i + ":(" + FileR...
4
public static double getMetric(Evaluation eval, int metric_index) { switch (metric_index) { case METRIC_ACCURACY: return eval.pctCorrect(); case METRIC_RMSE: return 1.0 - eval.rootMeanSquaredError(); case METRIC_ROC: return eval.areaUnderROC(1); //TODO - is 1 right? case METRIC_PRECISION:...
7
public void setDocumentInfo (DocumentInfo someDocInfo) { docInfo = someDocInfo; }
0
@Override protected int processHeader (byte[] header) { // TBD //if (Outliner.DEBUG) // System.out.println ("\tStan_Debug:\tPdbSPReaderWriter:processHeader"); } return SUCCESS ; } // end protected method processRecord
0
@Override public String toString() { return (e.getAttributeValue("name") != null ? e .getAttributeValue("name") : e.getName()); }
1
public void stopAllSounds() { for (Clip sound : managingSounds) { sound.stop(); } }
1
* @return - Position on the board to drop piece */ public Point makeAIMove(ConnectFourBoard board) { Random r = new Random(); int maximum = 0; ArrayList<Point> m_MaxChoice = new ArrayList<Point>(); int arrayPosition; /** Set maximum to be the maximum chain ...
4
@Override // Buscar todos los alojamientos disponibles public int seleccionarUsuarios(JTable pTable){ Connection conn = null; PreparedStatement stmt; ResultSet rs; try{ conn = SQLServerDAOFactory.createConnection(); stmt = con...
9
public void run() { while(isWriter) { int i; int j; synchronized(this) { if(buffIndex == writeIndex) try { wait(); } catch(InterruptedException _ex) { } if(!isWriter) return; j = writeIndex; if(buffIndex >= writeIndex) i = buffIndex - writeIndex; ...
9
private void setBoard(String board){ boolean test = false; if (test || m_test) { System.out.println("Drawing :: setBoard() BEGIN"); } gameBoardGraphics.SetBoard(board); if (test || m_test) System.out.println("Drawing::setBoard() - END"); }
4
public Token getNextToken() { if (m_characterIterator == null) { return ExceptionHandler.getInstance().throwException(Exception.NO_INPUT_STREAM, ExceptionStrength.STRONG); } else { while (m_characterIterator.hasNext()) { if (CharacterUtilities.isWhitespace(m_characterIterator.peek())) { m_characterIt...
8
@Override public Event next() { String input = null; try { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); } //alters state if(input == null || input.equals("")){ return new DefaultState(as); } if(input.equalsIgnoreCase("add")){ return new AuctionCreateState(name, ...
4
public static String getIpClient() throws UnknownHostException, SocketException { String interfaceRede = "wlan0"; String meuIp = null; Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface ...
6
public Point[][] getPointArray(int x, int y){ Point[][] res = new Point[WORD_LENGTH][(int)Math.pow(8,WORD_LENGTH)]; res[0][0] = points[x][y]; for (int i = 0; i < WORD_LENGTH-1; i++){ for (int j = 0; j < (int)Math.pow(8,i); j++){ for (int l = 0; l < 8; l++){ ...
7
public static void createProfessor() { System.out.println("=== Creation of a professor ==="); 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 first name: "); String forename =...
5
@Override protected void execute(CommandSender sender, String Command, List<String> list) { this.init(sender); if (Command.equals("creategp")) { if (this.getGP(list.get(0)) != null) { this.reply("Es gibt bereits einen GlobalPrice mit der ID"); return; } if (list.get(1).matches("\\d*")) { this...
8
public void setMoodleNoteField(String nodeName,String content) { if (nodeName.equals("clientnoteid")) if (!content.isEmpty() && content!=null) setClientNoteId(content); if (nodeName.equals("noteid")) setNoteId(Integer.parseInt(content)); if (getNoteId()==-1) if (nodeName.equals("errorMes...
6
public Set<LinkDigest> addAllLinks(final Set<LinkDigest> all) { for (Block block : mBlocks) { all.addAll(block.getDigests()); } if (all.contains(LinkDigest.NULL_DIGEST)) { throw new RuntimeException("Assertion Failure: NULL_DIGEST in blocks"); } for (Roo...
5
public static long readLong() { long x = 0; for (int i = 0; i < 8; i++) { char c = readChar(); x <<= 8; x |= c; } return x; }
1
public static void createFile(String content, String urlPath) { /* ָurl */ String[] elems = divUrl(urlPath); StringBuffer path = new StringBuffer(); File file = null; for (int i = 1; i < elems.length; i++) { if (i != elems.length - 1) ...
6
public void addAll(String[][] L) { data = new String[L.length][4]; for (int i = 0; i < data.length; i++) { data[i][0] = L[i][0]; data[i][1] = L[i][1]; data[i][2] = L[i][2]; data[i][3] = L[i][3]; } }
1
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); // if it is the Logout button if (o == logout) { client.sendMessage(new ChatMessage(ChatMessage.LOGOUT, "")); return; } // if it the who is in button if (o == whoIsIn) { client.sendMessage(new ChatMessage(ChatMessage.WHOISIN, ""...
9
@Override public ValidationResult validate(Game game) { int allowedQuestionsCount = getQuestionsCount(); int allowedAnswersCount = getAnswersCount(); int allowedCorrectAnswersCount = getCorrectAnswersCount(); List<Question> questions = game.getQuestions(); if (questions == n...
8
public void run() { Map<String, Term> solution; // Variable X = new Variable("X"); // Query q2 = new Query("child_of(joe,ralf)"); System.err.println("child_of(joe,ralf) is " + (q2.hasSolution() ? "provable" : "not provable")); new Query("sleep(?)", new Term[] { new org.jpl7.Integer(delay) }).hasSolution(); ...
5
@Override protected void mutate(Individual indiv) { Sudoku sudoku = (Sudoku)indiv; Sudoku best = null; Random r = new Random(); for(int i=0; i<numOfTries; i++){ //choose a row int row = r.nextInt(9); //choose 2 cols int c1= r.nextInt(9); int c2 = r.nextInt(9); if(c1==c2 || sudoku.r...
7
private String scanString(String listData) { StringBuilder cadenafinal = new StringBuilder(); Scanner innerScan = new Scanner(listData); boolean firstPass = true; while (innerScan.hasNext()) { if (firstPass) { cadenafinal.append(" ").app...
2
public static MilkyWay getMilkyWay(List<String> filePathList) throws IOException { MilkyWay milkyWay = new MilkyWay(); int i = 0; Double ngp = Math.toRadians(27.4); for (String filePath : filePathList) { List<Coord> dataSet = new LinkedList<>(); try ( ...
8
public static List<String> getStructures(CyNetwork network, CyIdentifiable id) { String pdbColumn = getPDBColumnName(network); if (pdbColumn == null || pdbColumn.length() == 0) return null; if (!network.getRow(id).isSet(pdbColumn)) return null; List<String> columnListString = null; if (network.getDefa...
6
@Override public Auction[] search(String criteria) { Predicate<Auction> cp = null; ArrayList<Auction> theSearch = new ArrayList<Auction>(); Stack<Predicate<Auction>> predicateStack = new Stack<Predicate<Auction>>(); Stack<String> operatorStack = new Stack<String>(); Predicate<Auction> firstSearchString...
8
public Format getFormat() throws SQLException { if (format == null && formatNumber > 0) format = GetFormats.create().getFormat(formatNumber); return format; }
2
public static void main (String[] args) { Wordsmith wordsmith = new Wordsmith(); // Choosing the number of topics is tricky. Trial and error is not a bad way necessarily... // Too few topics and it will be more summarization, but not capture a lot of the nuances. // Too many topics, and they can become...
7
@Override public void fixSubtree(String footpath, String subtreePrefix, RepairIssue[] issues) { Host[] failedHosts = new Host[issues.length]; for (int i = 0; i < issues.length; i++) { failedHosts[i] = Deserializer.deserializeHost(issues[i].failedPeer); } delegate_.fixSubt...
1
public void run() { if (DEBUG) log("Now running TaskEdit Command"); if (taskViewsToUpdate != null) { if (DEBUG) log("currentState completed? " + currentState.isCompleted()); if (DEBUG) log("newState completed? " + newState.isCompleted()); if (DEBUG) log("Update currentState to newState")...
8
public void setHLevel(int hLevel) { if(hLevel > 0 && hLevel < 6) { this.hLevel = hLevel; } else { System.err.println("hLevel invalid"); this.hLevel = 5; } }
2
private URL encodeurl(URL raw) throws IOException { /* * This is "kinda" ugly. It is, actually, how the Java documentation * recommend that it be done, though... */ try { return (new URL(new URI(raw.getProtocol(), raw.getHost(), raw.getPath(), raw.getRef()).toASCIIString())); } catch (URI...
1
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!plugin.hasPerm(sender, "warp", false)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } if (args.length == 0) return false; Player player =...
3
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 isMenuKey() { switch(keyCode) { case VK_SHIFT: case VK_CONTROL: case VK_ALT: return true; } return false; }
3
public void setItemNumber(String itemNumber) { this.itemNumber = itemNumber; }
0
public String performAddition(String tal1, String tal2) { StringBuilder sBuilder = new StringBuilder(); int lenght = tal1.length(); tal2 = matchLenght(lenght, tal2); int carry = 0; int i = 0; if(tal2.length() > lenght) { lenght = tal2.length(); tal1 = matchLenght(lenght, tal1); } // Reverse ...
5
@Test public void getVertexSetNeigourhoodTest(){ VertexSet s = new VertexSet(); s.addVertex(city_graph.getCity(6)); VertexSet v = city_graph.getVertexSetNeighbourhood(s); assertTrue(!v.containsID(6)); }
0
public float move(float amtXIn, float amtYIn) { if (amtXIn != 0.0f && amtYIn != 0.0f) { throw new IllegalArgumentException( "Can only move in 1 dimension per call"); } structure.remove(this); double amtX = (double) amtXIn; double amtY = (double) amtYIn; CollisionComponent c = (CollisionComponent) g...
4
public Vector<Block> selectBlocks(Vector<Block> originalPopulation) { Vector<Block> fitBlocks = new Vector<Block>(); //first, calculate the sum of e^(fitness of each of the blocks) double fitnessSum = 0.0; for(Block b : originalPopulation) { fitnessSum += Math.exp(b.getFitness()); } //second figure out...
7
public void guardarDatos(){ try { FileOutputStream fileOut = new FileOutputStream("usuario.ser",true); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(this); out.close(); fileOut.close(); System.out.println("datos guardados en usuario.ser"); }catch (IOException i) { ...
1
public void setState(int state) { this.state=state; // Change the status label if (state==1) theApp.setStatusLabel("Start Tone Hunt"); else if (state==2) theApp.setStatusLabel("Sync Hunt"); else if (state==3) theApp.setStatusLabel("Sync Found"); else if (state==4) theApp.setStatusLabel("Decoding"); else i...
5
public void draw(Graphics2D g) { g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); g.drawImage(board, 0, 123, null); synchronized(model) { if (model.done()) { if (model.hasWon(model.CROSSES)) { drawMessage(1, g); } if (model.hasWon(model.CIRCLES)) { drawMessage(3, g); } } else { dr...
6
public String getURLString() { return assembleURL( this.host, this.port, this.userInfo, this.authority, this.protocol, this.path_list, this.query_list, this.fragment ); }
0
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 ServerReply getReply(HttpPost post) { ServerReply reply = null; HttpClient client = this.getClient(); try { log.finest(String.format("[%s] Executing POST.", post.getURI())); HttpResponse resp = client.execute(post); try { HttpEntity entity = resp.getEntity(); if(resp.get...
5
@SuppressWarnings("resource") public void loadPak(File file, boolean spawnPlayer){ pakFile = file; String thisfile = "properties"; try { ZipFile zipFile = new ZipFile(file); ZipEntry zipEntry = zipFile.getEntry(thisfile); InputStream in = zipFile.getInputStream(zipEntry); BufferedReader input = new B...
8
@Override public Usuario salvar(Usuario entidade) throws ValidacaoException { if (entidade == null) { throw new IllegalArgumentException("'usuario' não pode ser nulo"); } for (Usuario usuario : obterTodos()) { if (usuario.getUsuarioId() == entidade.getUsuarioId()) {...
4
public static final String getHomeDir() { String homeDir = null; try { String os = System.getProperty("os.name").toLowerCase(); try { if (os.startsWith("windows")) { // JRE prior to 1.5 cannot reliably determine USERPROFILE. // Return user.home and hope it's right. ...
6
public static long kthFac(int k, int n) { long res = 1; long limit = n; for (long i = 2; i <= limit; i++) { res *= i; if (i == limit && k > 0) { k--; limit = res; } } return res; }
3
public static void setTerrain(int direction) { switch(direction) { case 1: tiley--; break; case 2: tiley++; break; case 3: tilex++; break; case 4: tilex--; break; } for(int i = 0; i<80; i++) { for(int j = 0; j<60; j++) { ...
6
public static void main(final String[] args) { //check useage if(args.length < 1) { System.out.println("UTF8 Validator version: " + VERSION); System.out.println("Useage: utf8validate [options] <file>"); System.out.println(""); System.out.println("...
8