text
stringlengths
14
410k
label
int32
0
9
private void button3MousePressed(MouseEvent event) { if (!button3.isEnabled()) { return; } JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogTitle("Trove Install Location"); if (TroveUtils....
6
public void handleKeyEvent(KeyEvent keyEvent) { // The code of the key that is associated with this event. int key = keyEvent.getKeyCode(); switch(keyEvent.getID()) { case KeyEvent.KEY_PRESSED: Log.debug("Pressed key: " + key); keyPressed.add(key); break; case KeyEvent.KEY_RELEASED: ...
2
void settitle1 () { String S; if (BigTimer) S = Global.resourceString("Game_") + GameNumber + ": " + WhiteName + " " + formmoves(WhiteMoves) + " - " + BlackName + " " + formmoves(BlackMoves); else S = Global.resourceString("Game_") + GameNumber + ": " + WhiteName + " " + formtime(WhiteTime - WhiteR...
6
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!plugin.hasPerm(sender, "hunger", true)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } if (args.length == 0) { if (plugin.isPlayer(sender)) { ...
5
protected Language getAnimalSpeak(final MOB M) { if((M!=null) &&(canSpeakWithThis(M))) { final Race r=M.charStats().getMyRace(); for(Ability A : r.racialAbilities(M)) { if(((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_LANGUAGE) &&(A instanceof Language)) { Ability effectA=...
8
public ProgramSetupThread(String pname) { this.pname = pname; }
0
public void listCatalogs(String org) { this.vccPreCheck(); Organization orgObj = this.getOrganization(org); try { Formatter.printInfoLine("Catalogs:\n"); for (ReferenceType catalogRef : orgObj.getCatalogRefs()) { Catalog catalog = Catalog.getCatalogByReference(this.vcc, catalogRef); Formatter.prin...
7
public static String get(String code) { return codes.get(code); }
0
public double scoreCompetencesHash(Set<Competence> lstCompsCherche) { // On initialise scoreCompetences à 0 double scoreCompetences = 0; double poidsMotClef; double sommePoids; // On récupère toutes les compétences se situant dans la HashMap Set setComps = this.m_tblComps...
4
public int read(int width) throws IOException { if (width == 0) { return 0; } if (width < 0 || width > 32) { throw new IOException("Bad read width."); } int result = 0; while (width > 0) { if (this.available == 0) { this...
7
private static int factorial(int n){ if(n<2) return 1; return n*factorial(n-1); }
1
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { writer.println(output[type] + ((count == 1) ? "" : "2") + ((depth == 0) ? "" : "_X" + depth)); }
2
private int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); return 2; } switch(curChar) { case 108: ...
3
public void removeCommand(Command _command) { this.commands.remove(_command); }
0
public String value() { return value; }
0
private Object newBuffer(Object template) { if(template instanceof Object[]) return new Object [((Object[]) template).length] ; if(template instanceof byte[]) return new byte [((byte[]) template).length] ; if(template instanceof char[]) return new char [((char[]) template).length] ; ...
9
private String convertLength(int i) { switch(i) { case 1: return "s "; case 2: return "i "; case 3: return "i. "; case 4: return "q "; case 6: return "q. "; case 8: return "h "; case 12: return "h. "; case 16: return "w "; } return ""; }
8
@Override public void Play(PlayerResponse response) { deal(); // Send all Users their dealt hand for (PinochlePlayer player : mP.getPlayers()) { PinochleMessage message = new PinochleMessage(); message.setCards(player.getCurrentCards()); player.setMessage(message); } mP.updateAll(); // Check...
2
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhpposAppConfigEntity that = (PhpposAppConfigEntity) o; if (key != null ? !key.equals(that.key) : that.key != null) return false; if (value != ...
7
public static int evalRPN(String[] tokens){ int result=0; Stack<Integer> stack = new Stack<Integer>(); for(int i=0;i<tokens.length;i++){ if(!tokens[i].equals("+") && !tokens[i].equals("-") && !tokens[i].equals("*") && !tokens[i].equals("/")){ stack.push(Integer.parseInt(tokens[i])); } else{ ...
9
public final boolean isValidMove (final char action) { final char direct = getDirectByAction(action); if (direct == '\0') { // It's a invalid action. return false; } final Point newPos = new Point(minerPos); movePos(newPos, direct); if (!isInBound...
8
private void updateSimChangeSpeedValues() { //Since this is called many times (the GUI responds to many events...some of which //aren't changes the simulator needs to know about), we compare the current values with //the values the last time this is called...if no change we don't notify the simu...
7
public int GetCLPrayer(int ItemID) { if (ItemID == 10716) { return 100; } if (ItemID == 10718) { return 100; } if (ItemID == -1) { return 1; } String ItemName = GetItemName(ItemID); if (ItemName.startsWith("Prayer cape")) { return 100; } if (ItemName.startsWith("Prayer hood")) { return 100;...
5
public void assignMowerTasksByFootprint(LinkedList<FootPrint> footPrint) { for(FootPrint fp:footPrint) { Util.debugPrint(fp.toDebugString(),Util.LOG_DEBUG); Util.debugPrint("Mower Task:"+this.mowerTasks.size()+" "+this.mowerTasks.get(0).getBlocksCount(),Util.LOG_DEBUG); if(this.mowerTasks.size()>0) { ...
8
public static boolean createFunny(ConditionalBlock cb, StructuredBlock last) { if (cb.jump == null || !(cb.getInstruction() instanceof CompareUnaryOperator) || !(last.outer instanceof SequentialBlock) || !(last.outer.getSubBlocks()[0] instanceof IfThenElseBlock)) return false; CompareUnaryOperator ...
6
public AbstractFace build() { AbstractFace face = null; switch (faceClass.toLowerCase()) { case "black": face = new BlackFace(); break; case "white": default: face = new WhiteFace(); break; } ...
8
public void setHome(CommandSender cs, Command cmd, String string, String[] args) { Player player = (Player) cs; if (args.length == 0) { if (player.hasPermission("warpsandports.homes.set.default") || player.isOp()) { Location loc = player.getLocation(); String world = loc.getWorld().getName(); in...
7
public editUser() { this.requireLogin = true; this.addParamConstraint("id", ParamCons.INTEGER); this.addParamConstraint("password", true); this.addParamConstraint("username", true); this.addParamConstraint("fullName", true); this.addParamConstraint("email", true); this.addRtnCode(405, "permission denied"...
0
private List<FBPhoto> processPhotoData(List<Facebook> fbData) throws ParseException { // TODO Auto-generated method stub List<FBPhoto> list=new ArrayList<FBPhoto>(); try { for (Facebook facebook : fbData) { JSONObject photoJson=new JSONObject(facebook.getData()); String dateString=photoJson.getString(...
5
public String getName() { return name; }
0
private void fixCorrespondingGates(Graph<Vertex,Edge> g) { TreeMap<String, Integer> scoreTallyOut = new TreeMap<String, Integer>(); TreeMap<String, Integer> scoreTallyIn = new TreeMap<String, Integer>(); LinkedList<String> gateways = new LinkedList<String>(); KShortestPaths<Vertex, Edge> sp = new KShortestPa...
7
private void compileShader() { glLinkProgram( resource.getProgram() ); if ( glGetProgrami( resource.getProgram(), GL_LINK_STATUS ) == 0 ) { System.err.println( glGetProgramInfoLog( resource.getProgram(), 1024 ) ); System.exit( 1 ); } glValidateProgram( resource.getProgram() ); if ( glGetProgrami( ...
2
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); Connection conn; Statement stmt; ResultSet rs; HttpSession hs=request.getSession(true); hs.setAttribute("...
3
public float getA() { return a; }
0
private void DeleteTopmost() { ConstructEditor deleteMeEditor = mConstructSelector.getSelected(); if(deleteMeEditor.getParent() != null) { int index = deleteMeEditor.construct.parent.children.indexOf(deleteMeEditor.construct); int added = AddChildrenTo(deleteMeEditor.construct, deleteMeEditor.construct.par...
4
public void ProcessVulnerabilityXML(javax.swing.JTextField XMLFileName, javax.swing.JTextField XSSAttackName, javax.swing.JTextArea XSSAttackCode, javax.swing.JTextArea XSSAttackDesc, javax.swing.JTextField XSSAttackLabel, javax.swing.JTextArea XSSAttackBrowser, javax.swing.JList XSSAttackNames) { //Adapted fro...
6
private void save(){ Calendar calendar = Calendar.getInstance(); calendar.set( (Integer)dateReceivedYearField.getSelectedItem(), (Integer)dateReceivedMonthField.getSelectedItem()-1, (Integer)dateReceivedDayField.getSelectedItem(), (Integer)...
6
private boolean validateValue(String value) { value = value.toLowerCase(); if (value.lastIndexOf("ms") != -1) { if (Integer.parseInt(value.replaceAll("ms", "")) > 999) { return false; } } else if (value.lastIndexOf("s") != ...
8
public void setPos(Point2D p) { myBottomLeft = new Point2D.Double(p.getX(), p.getY()); }
0
public String getName() { return name; }
0
private String getSituacao(Integer situacao){ switch(situacao){ case 0: return "Aberto"; case 1: return "Em Julgamento"; case 2: return "Julgado"; case 3: return "Cancelado"; } return null; }
4
public static InputTableModel getModel(Automaton automaton, boolean multipleFile) { InputTableModel model = (InputTableModel) INPUTS_TO_MODELS .get(new Integer(inputsForMachine(automaton))); if (model != null && (model.isMultiple == multipleFile)) { model = new InputTableModel(model); // Clear out...
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Token token = (Token) o; if (type != token.type) return false; if (value != null ? !value.equals(token.value) : token.value != null) return fal...
6
public static HashMap<String, Integer> rankVarianceWeight(LinkedHashMap<String, HashMap<String, Double>> listOfWeightMaps) { HashMap<String, ArrayList<Double>> attributeVals = new HashMap<String, ArrayList<Double>>(); HashMap<String, Double> attributeMeans = new HashMap<String, Double>(); for (H...
5
private boolean isPrimeable(int n) { if (n < 10) { return true; } int[] numbers = Problem30.getNumbers(n); for (int i = 0; i < numbers.length; i++) { int x = numbers[i]; switch (x) { case 1: case 3: case 7: case 9: break; default: return false; } } int mod = n % 6; ...
8
@Override public User findByEmail(String email) { User user = null; try { connection = getConnection(); ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE email =?;"); ptmt.setString(1, email); resultSet = ptmt.executeQuery(); result...
5
private double edgeX(int x, int y, double[][] smoothedGray) { return 1*smoothedGray[x-1][y-1] + 2*smoothedGray[x][y-1] + 1*smoothedGray[x+1][y-1] - 1*smoothedGray[x-1][y+1] - 2*smoothedGray[x][y+1] - 1*smoothedGray[x+1][y+1]; }
0
public RunGenerator(){ // Makes it look pretty try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // ...
3
public void set(Block block,int x,int y,int z){ Block current = blocks[x%16][y%16][z%16]; if(current != null)current.removeFromParent();; if( block != null) block.addToWorld(x, y, z); blocks[x%16][y%16][z%16] = block; }
2
private void interpolate(int iLower, int iUpper) { int dx = xRaster[iUpper] - xRaster[iLower]; if (dx < 0) dx = -dx; int dy = yRaster[iUpper] - yRaster[iLower]; if (dy < 0) dy = -dy; if ((dx + dy) <= 1) return; float tLower = tRaster[iLower]; float tUpper = tRaster[iUpper]; int iMid = allocRast...
8
@Override public void run() { File musicFolder = new File(dir, "music"); File stepsFolder = new File(new File(dir, "newsound"), "step"); File digFolder = new File(new File(dir, "sound3"), "dig"); File randomFolder = new File(new File(dir, "sound3"), "random"); File newMusicFo...
6
private void cliques( List<Vertex> likelyC, List<Vertex> C, List<Vertex> F) { List<Vertex> candidates_array = new ArrayList<Vertex>(C); if (!allEdgesSeen(C, F)) { for (Vertex candidate : candidates_array) { List<Vertex> new_candidates =...
8
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 static void keyReleased(KeyEvent e) { key.clear(e.getKeyCode()); if (!key.get(KeyEvent.VK_SPACE)) { setFire(false); } if (!key.get(KeyEvent.VK_LEFT)) { setX(0); } if (!key.get(KeyEvent.VK_RIGHT)) { setX(0); } if (...
5
public void disconnect(){ try { if(input != null) input.close(); } catch(Exception e) {} try { if(output != null) output.close(); } catch(Exception e) {} try{ if(socket != null) socket.close(); } catch(Exception...
7
public void visit_swap(final Instruction inst) { // 0 1 -> 1 0 if (Tree.USE_STACK) { saveStack(); final StackExpr s1 = (StackExpr) stack.pop1(); final StackExpr s0 = (StackExpr) stack.pop1(); final StackExpr[] s = new StackExpr[] { s0, s1 }; manip(s, new int[] { 1, 0 }, StackManipStmt.SWAP); } e...
3
public void pintar(int x, int y, int type) { int [] xy = new int [2]; if(type == 5) { xy = buscaType(5); if((xy[0] != -1) && (xy[0] != -1)) { cambiarCasilla(tablero[xy[0]][xy[1]],7); } } if(type == 6) { xy = buscaType(6); if((xy[0] != -1) && (xy[0] != -1)) { ...
8
public void update (double elapsedTime) { Dimension bounds = myView.getSize(); for (Assembly a : myAssemblies) { a.update(elapsedTime, bounds, myActiveForces); } int lastKey = myView.getLastKeyPressed(); if (myKeyPresses.containsKey(lastKey)) { myKeyPresse...
2
public static EntityMinecart placeCart(GameProfile owner, ItemStack cart, WorldServer world, int x, int y, int z) { if (cart == null) return null; cart = cart.copy(); if (cart.getItem() instanceof IMinecartItem) { IMinecartItem mi = (IMinecartItem) cart.getItem(); ...
6
private void makeCircularStreetList(Street street, ArrayList<FieldCircularList> fieldArrayList) { for(int i = 0; i < fieldArrayList.size(); i++) { if(fieldArrayList.get(i) instanceof Street && ((Street) fieldArrayList.get(i)).isSameColor(street)) { street.setNextGroupElement(((Street) fieldArrayList.get(i))); ...
3
public boolean valideCoord(int x,int y){ return ( x < row && y < col && x > 0 && y > 0); }
3
public boolean intersects(S2Polygon b) { // A.intersects(B) if and only if !complement(A).contains(B). However, // implementing a complement() operation is trickier than it sounds, // and in any case it's more efficient to test for intersection directly. // If both polygons have one loop, use the more ...
9
public ArrayList<Tile> adjacent(int r, int c) { ArrayList<Tile> temp = new ArrayList<Tile>(); if (getTile(r+1,c) != null) {temp.add(getTile(r+1,c));} if (getTile(r-1,c) != null) {temp.add(getTile(r-1,c));} if (getTile(r,c-1) != null) {temp.add(getTile(r,c-1));} if (getTile(r,c+1) != null) {temp.add(getTil...
8
private WarMachine platziereWarMachine(WarMachine newWarMachine) { boolean invalidInput = true; String input = null; Koordinate platzKoordinate = null; Ausrichtung platzAusrichtung = null; while (invalidInput) { try { input = generateRandomKoordinate() + "," + generateRandomAusrichtung(); } ...
5
private Map func_27415_a(File var1, File var2, File var3) { return var1.exists()?this.func_27408_a(var1):(var3.exists()?this.func_27408_a(var3):(var2.exists()?this.func_27408_a(var2):null)); }
3
@Override public List<OrderDetail> getOrderDetailByID(final Integer id) { Connection conn = null; PreparedStatement stmt=null; List<OrderDetail> OrderDetailList=new ArrayList<>(); ResultSet rs =null; try { conn = dataSource.getConnection(); stmt = co...
8
public void test_isoChrononolgy_Chicago() { DateTimeZone zone = DateTimeZone.forID("America/Chicago"); Chronology lenient = ISOChronology.getInstance(zone); try { new DateTime(2007, 3, 11, 2, 30, 0, 0, lenient); fail(); } catch (IllegalArgumentException ex) { ...
1
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("["); for(HashBucket bucket : map) { sb.append(bucket.toString()); } sb.append("]"); return sb.toString(); }
1
public void listen(int port) { try { server = new ServerSocket(port); listening = true; while (listening) { new TCPClient(server.accept()).start(); } } catch (Exception ex) { if (!ex.getMessage().equals("socket closed") && !server.isClosed()) ex.printStackTrace(); } }
4
public static ToolsRunner getRunnerTool(String actionName) { Preconditions.checkNotNull(actionName, "No Action is set. Please see usage:\n" + getUsageStr()); Preconditions.checkArgument( actionName.equals("sar") || actionName.equals("jobserver") || actionName.equals("schemaserver") || a...
9
protected void setDirtiness(double dirtiness) { this.dirtiness = dirtiness; if (this.dirtiness < 0) { this.dirtiness = 0; } else if (this.dirtiness > 0.25) { this.dirtiness = 0.25; } }
2
public static void removeProject(Project project, boolean delete) { int sym = project.getSym(); boolean found = false; ArrayList<Project> projects = new ArrayList<Project>(); if( project.isLocal() ) projects = getProjects(project.getDir()); else projects = getProjects(sym); int i = 0; for (Pr...
8
public byte[] getCode(int bit) { byte[] res; assert ((bit == 0) || (bit == 1)) : "getCode: input isn't a bit!"; if (bit == 0) { if (code0 == null) return(null); res = new byte[code0.length]; for (int i = 0 ; i < code0.length ; i++) res[i] = co...
6
protected void doubleLoop(RasterAccessor src, RasterAccessor dst, int filterSize) { int dwidth = dst.getWidth(); int dheight = dst.getHeight(); int dnumBands = dst.getNumBands(); double dstDataArrays[][] = dst.getDoubleDataA...
9
protected void setLineList(List<String> lines) { if ((lines == null) || (lines.size() == 0)) { IllegalArgumentException iae = new IllegalArgumentException("The list must not be null or without entries!"); Main.handleUnhandableProblem(iae); } this.uiFileLines = new ArrayL...
2
private void selectAndPossiblyCenter(JTextComponent component, int start, int end) { component.setSelectionStart(start); component.setSelectionEnd(end); Rectangle r = null; try { r = component.modelToView(start); if (r == ...
8
private static boolean deleteSchedule(Schedule bean, PreparedStatement stmt) throws SQLException{ stmt.setDate(1, bean.getWorkDay()); stmt.setString(2, bean.getUsername()); int affected=stmt.executeUpdate(); if(affected==1){ System.out.println("Employee with username "+bean.getUsername()+" is not work...
1
public void teleopPeriodic() { // Runs commands & stuff Scheduler.getInstance().run(); }
0
public ArrayList<Libros> getById(Libros l){ PreparedStatement ps; ArrayList<Libros> libros = new ArrayList<>(); try { ps = mycon.prepareStatement("SELECT * FROM Libros WHERE codigo=?"); ps.setString(1, l.getCodigolibro()); ResultSet rs = ps.executeQuery(); ...
4
public static void FinalBoss() { currentRoomName = "Final Boss"; currentRoom = 9; RoomDescription = "The door swings open and as you take a step in, the lights turn on and confetti falls from the " + "ceiling, a party of giant dancing lobsters come out from hiding and start to boogie.\n\n" + "Congratulat...
0
public static void getServerList() { if (Global.FIRST_IP.equals(Global.NO_FIRST_SERVER)) { Donnees.fillingServers(false); return; // premier serveur } Stockage.Donnees.fillingServers(true); try (SocketChannel clientSocket = SocketChannel.open()) { InetSocketAddress local = new InetSocketAdd...
8
private void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed if (txtConclusao.getText().equals("") || txtHoras.getText().equals("")) { JOptionPane.showMessageDialog(null, "Erro ao realizar o Lançamento !!! \n Por Favor Preencha os...
5
public RSStub() { String source; try { source = getPageSource(getCodeBase()); Matcher aMatcher = aPattern.matcher(source); if (aMatcher.find()) { Matcher pMatcher = pPattern.matcher(source); while (pMatcher.find()) { String key = pMatcher.group(1); String value = pMatcher.group(2); p...
4
private static double hue_2_RGB(double v1, double v2, double vH) { if (vH < 0.0) vH += 1; if (vH > 1.0) vH -= 1; if (6 * vH < 1) return ( v1 + (v2-v1) * 6.0 * vH); if (2 * vH < 1) return ( v2 ); if (3 * vH < 2) return v1 + (v2-v1) * ((2.0/3.0) - vH) * 6; return v1; }
5
public String getStworz() { return stworz; }
0
private BlankExpression evalExpression(String rawExpression) throws Exception { BlankVar var; // variavel auxiliar para guardar uma BlankVar String[] analysis = rawExpression.split(operationIdentifier.toString()); // Identifica a operação realizada Matcher operationMatcher = operationIdentifier.matcher(rawExp...
4
public String getSimpleCode(){ String str = ""; if(expression != null){ str += expression.getSimpleCode() + this.printLineNumber(true) + identifier.getNewName() + " := " + expression.place + "\n"; } return str; }
1
@Override public Map<String, Integer> getIngressoDisponiveis(Evento evento){ Map<String, Integer> ingresso = new HashMap<>(); try{ conn = ConnectionFactory.getConnection(); String sql = " SELECT secao.nome " + " ,count(ingresso.id) AS ingr...
3
public boolean close() { if (!isOpen()) { return true; } Widget close = ctx.widgets.getValidated(new Filter<Widget>() { @Override public boolean accept(Widget element) { return element.getParentId() == WIDGET_ID && element.getId() == CLOE_COMP_...
5
void jMenuItem_zoom_actionPerformed(ActionEvent e) { int zoomFactor = 0; if (e.getSource() == jMenuItem_zoom1) zoomFactor = 1; else if (e.getSource() == jMenuItem_zoom2) zoomFactor = 2; else if (e.getSource() == jMenuItem_zoom4) zoomFactor = 4; else if (e.getSource() == jMenuItem_zoom8) zoomFactor...
5
protected static boolean isFlacSpecial(OggPacket packet) { byte[] d = packet.getData(); byte type = d[0]; // Ensure 0x7f then "FLAC" if(type == 0x7f) { if(d[1] == (byte)'F' && d[2] == (byte)'L' && d[3] == (byte)'A' && ...
5
public static List<Utilisateur> selectUtilisateur() throws SQLException { String query = null; List<Utilisateur> util = new ArrayList<Utilisateur>(); ResultSet resultat; try { query = "SELECT * from UTILISATEUR "; PreparedStatement pStatement = (PreparedStatemen...
2
private void handleSpecialistQueues() { for (int i = 1; i < 8; i++) { HospitalPart hp = HospitalPart.values()[i]; Sector sec = sectors.get(hp); LinkedBlockingDeque<Patient> q = doc_queues.get(hp); if (sec.hasBusyDoc()) { int[] tmp = sec.getFinishTimes(); for (int j = 0; j < sec.getDocCount(); j++...
8
public static void addStock(String uid, String id, int amount) { if(checkUserExistance(uid)) { stocks = UserControl.getUserStock(uid); if (stocks.containsKey(id)) { stocks.put(id, stocks.get(id) + amount); } else { stocks.put(id, amount); } t...
3
private void calcG(int choice) { /* calculates the g values. choice parameter is the stage selection */ int index, grstep, i; double d2; switch (choice) { case 1:// initialization for (i = 0; i < ngr; i++) { g[i] = 0.0; } ...
9
/*Update Permissions*/public boolean changePermissions(String username, PermissionsList list){ try{ if(username.length() > 40)return false; select1.setString(1, username); ResultSet rs = select1.executeQuery(); while(rs.next()){ if(rs.getString("username").equals(username)){ updatePermissi...
4
public String getRoomNames(){ Set<String> keys = chatRooms.keySet(); StringBuffer ret = new StringBuffer(keys.toString().length()+11); ret.append("Chat rooms: ["); for (String key : keys){ ret.append(""+chatRooms.get(key).getName()+", "); } ret.delete(ret.leng...
1
static private DamageCause[] getTypes() { if (typecache != null) return typecache; List<DamageCause> causes = new ArrayList<DamageCause>(); Field[] materialFields = DamageCause.class.getFields(); for (Field f : materialFields) { try { Object got = f.get(null); if (got instanceof DamageCause) { ...
9
public void showPauseMenu(){ pauseMenu.show(); }
0
@Override public String toString() { String result = ""; if(useShift) { if(System.getProperty("os.name").toLowerCase().indexOf("mac") >= 0) result+='\u2191'; else result+="SHFT"; } if(useControl) result+="CTRL"; if(useMeta) result += "\u2318"; for(int x : shortcuts) { result += ...
5