text
stringlengths
14
410k
label
int32
0
9
public int hashCode() { int h = instanceOrClass.hashCode(); h += method.hashCode(); if (n > 0) { h += (arg1 == null ? 0 : arg1.hashCode()); if (n > 1) { h += (arg2 == null ? 0 : arg2.hashCode()); if (n > 2) { h += (arg3 == null ? 0 : arg3.hashCode()); if (n > ...
9
public static String getString(String domain, String key, String fallback) { if ( !config.containsKey(domain) ) config.put(domain, new HashMap<String,String>()); if ( !config.get(domain).containsKey(key) ) config.get(domain).put(key, fallback); return config.get(domain).get(key); }
2
@Override public void deserialize(Buffer buf) { super.deserialize(buf); targetId = buf.readInt(); casterCellId = buf.readShort(); if (casterCellId < -1 || casterCellId > 559) throw new RuntimeException("Forbidden value on casterCellId = " + casterCellId + ", it doesn't re...
4
@Override protected boolean executeGameEvents(Integer[] events) { if(events == null){ events = new Integer[0]; } for(Integer event : events){ switch (event) { case EVENT_START_GAME:{ break; } case EVENT_SHOW_COUNTDOWN:{ break; } case EVENT_MATCH_OVER:{ endMatch(); break; }...
5
protected List<Node> generateSuccessors(Node node) { List<Node> ret = new LinkedList<Node>(); int x = node.x; int y = node.y; if (y < map.length - 1 && map[y + 1][x] == 1) { ret.add(new Node(x, y + 1)); } if (x < map[0].length - 1 && map[y][x + 1] == 1) { ...
8
void syncToDB() { Map<K, Modification> toMods = mods; mods = new ConcurrentHashMap<>(); new Thread(() -> { for (Map.Entry<K, Modification> entry : toMods.entrySet()) { K k = entry.getKey(); Modification modification = entry.getValue(); if (modification.isPut) { synchronizer.put(k, modi...
2
public void actionPerformed(ActionEvent e) { SelectionDrawer drawer = new SelectionDrawer(automaton); NondeterminismDetector d = NondeterminismDetectorFactory .getDetector(automaton); State[] nd = d.getNondeterministicStates(automaton); for (int i = 0; i < nd.length; i++) drawer.addSelected(nd[i]); Aut...
1
public static boolean handleSurvivalExceptions(ArrayList<String[]> clinicalValues){ boolean valid = true; HashSet<String> vitals = new HashSet<String>(); for (int i=0; i<clinicalValues.size(); i++){ if (clinicalValues.get(i).length<3){ System.err.println("Please enter 3 columns for log rank"); return f...
9
public static String reverseComlement(String str){ char[] dna = str.toCharArray(); char[] dnaReverseComplement = new char[dna.length]; int j = 0; for (int i = dna.length-1; i >=0 ; i--) { switch (dna[i]) { case 'A' : dnaReverseComplement[j] = 'T';break; case 'T' : dnaReverseComplement[j] = 'A';break; ...
5
public void hyperMutate(int mutations, Random rand) { int mutationsDone = 0; while (mutationsDone < mutations) { int indexA = rand.nextInt(projectSize); int indexB = rand.nextInt(projectSize); if (indexA == indexB) { if (indexB == projectSize-1) indexB--; else indexB++; ...
5
public void binaryFilter(double cutOff, double value) { for(int i=0; i < data.length; i++) { double[] block = data[i]; for(int j=0; j < block.length; j++) { block[j] = (block[j] >= cutOff ? 1.0 : 0.0) * value; } } }
3
@Override public void toFtanML(Writer writer) { try { //Calculate count of double quotation marks (") and single quotation marks (') in the string int numberDQuotes = 0; int numberSQuotes = 0; for (int i=0;i<value.length();++i) { switch (value.charAt(i)) { case '"': ++numberDQuotes; bre...
5
static LookAndFeel getFactory(CHOICE choice) { switch (choice) { case WINDOWS: lookAndFeel = new WindowsLookAndFeel(); break; case MOTIF: lookAndFeel = new MotifLookAndFeel(); break; } return lookAndFeel; ...
2
public static void expand() { boolean bit = false; while (!BinaryStdIn.isEmpty()) { int run = BinaryStdIn.readInt(lgR); // read lgR bit for (int i = 0; i < run; i ++) BinaryStdOut.write(bit); bit = !bit; } BinaryStdOut.close(); }
2
private static void exerciseList(List<MutableTypes> list, long length, Runnable setSize) { assertEquals(length, list.size()); gcPrintUsed(); long start = System.currentTimeMillis(); do { System.out.println("Updating"); long startWrite = System.nanoTime(); setSize.run(); populate...
8
protected void interrupted() { end(); }
0
public static JTableRenderer getVertex(Component component) { while (component != null) { if (component instanceof JTableRenderer) { return (JTableRenderer) component; } component = component.getParent(); } return null; }
2
public static final void exampleContantsManipulations() { System.out.println("Starting Cyc constant manipulation examples."); try { CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator"); CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE"); access...
3
public void run() { for(int i = 1 ; i < 100 ; i ++) { System.out.println("Runnable implements Thread " + i + " !"); } }
1
public static String camel4underline(String param) { Pattern p = Pattern.compile("[A-Z]"); if (param == null || param.equals("")) { return ""; } StringBuilder builder = new StringBuilder(param); Matcher mc = p.matcher(param); int i = 0; while (mc.find()) { builder.replace(mc.start() + i, mc.end() + ...
4
public static boolean BookingCollides(int cabin_id, Date from_date, Date to_date) { Database db = new Database(); ArrayList<Booking> bookings = db.getBooking(cabin_id); db.close(); for(Booking b : bookings) { if(to_date.compareTo(b.getDate_To()) <= 0 && to_date.compareTo(b.getDate_From()) >= 0) return tr...
5
public void setParams(Object params) { this.params = params; }
0
protected void generateMetaLevel(Instances newData, Random random) throws Exception { m_MetaFormat = metaFormat(newData); Instances [] metaData = new Instances[m_Classifiers.length]; for (int i = 0; i < m_Classifiers.length; i++) { metaData[i] = metaFormat(newData); } for (int j = 0; j <...
7
public static void appendHostAddress(StringBuilder sbuf, InetAddress addr) { if (addr == null) { throw new IllegalArgumentException("addr must not be null"); } if (!(addr instanceof Inet4Address)) { throw new IllegalArgumentException("addr must be an instance of Inet4Addr...
2
private void appendDigits(String digits,int digitIndex,List<String> list,StringBuffer letter){ if(digitIndex == digits.length()){ list.add(letter.toString()); return; } int index= digits.charAt(digitIndex)-48; String buttonString = board[index]; System.out...
2
protected void initRunnableTask() { if(taskThread != null) { new IllegalStateException("The Task Thread has already been created"); } //Create the Thread but don't start it if(progressDescriptor.getRunnableTask() != null) { taskThread = new Thread(progressDescript...
8
static int entrance() { int x = 0, y = 0; for (int i = 0; i < layout.length; ++i) for (int j = 0; j < layout[i].length; ++j) { if (layout[i][j] == 2) { x = i; y = j; break; } } lea...
6
public boolean play(Player player) { System.out.println("Welcome to Sudoku!\nYour goal is to fill your board up with numbers 1-9 while abiding by the following rules: in each row there can be no repeated numbers, in each column there can be no repeated numbers, and in each square (3x3 space alloted) there can be no r...
5
public static long inet_pton(String ip) { if (ip == null) return -1; long f1, f2, f3, f4; String tokens[] = ip.split("\\."); if (tokens.length != 4) return -1; try { f1 = Long.parseLong(tokens[0]) << 24; f2 = Long.parseLong(tokens[1]) << 16; f3 = Long.parseLong(tokens[2]) << 8; f4 = Long.parseLong...
3
public void startElement(String uri, String localName, String qName, Attributes attributes){ if(qName.equals("objects")){ uiElements = new LinkedList<UIElement>(); } else if(qName.equals("label")){ element = new Label(); element.setType("label"); } ...
4
public static boolean handlePawnJump(){ boolean shouldCallContinue = false; // Returns whether the while loop should skip the current iteration if (target == null && chosen.getType().equals("PAWN") && !chosen.hasMoved() && Math.abs(myYCoor - targYCoor) == 2 && chosen.validMovement(myXCoor, myYCoor, targXCoor, targY...
6
public void testMonthNames_monthMiddle() { DateTimeFormatter printer = DateTimeFormat.forPattern("MMMM"); for (int i=0; i<ZONES.length; i++) { for (int month=1; month<=12; month++) { DateTime dt = new DateTime(2004, month, 15, 12, 20, 30, 40, ZONES[i]); String...
2
public void setPrice(int price) { this.price = price; notifyListeners(); }
0
public User authenticate(String login, String password, HttpServletRequest request) throws BusinessException { // TODO ver um padrõa de projeto para isso tipo fabrica. User user = null; user = userDAO.findOneByField("login", "=", login); try { // Usuário informou um login valido if(user != null) { ...
5
@Override public boolean allowSource( ConnectionableCapability item, ConnectionFlavor flavor ) { return item != this || allowSelfReference( flavor ); }
1
public int getAddiction(String player, Column column) { String query = "SELECT * FROM nosecandy WHERE playername='" + player + "';"; ResultSet result = null; result = this.sqlite.query(query); try { if (result != null && result.next()) { String name = result.getString("playername"); int addiction = ...
5
public boolean playerIsAffected(Player player) // returns whether or not a player is currently affected by Arctica { boolean affected = false; if((null != player ) && (playersToAffect.contains(player.getName()))) { affected = true; } return (affected); }
2
public final TLParser.andExpr_return andExpr() throws RecognitionException { TLParser.andExpr_return retval = new TLParser.andExpr_return(); retval.start = input.LT(1); Object root_0 = null; Token string_literal112=null; TLParser.equExpr_return equExpr111 = null; TLPar...
4
public boolean isInterleave(String s1, String s2, String s3) { if (s1.length() + s2.length() != s3.length()) { return false; } boolean[] m = new boolean[s1.length() + 1]; m[0] = true; for (int i = 1; i <= s1.length(); i++) { m[i] = m[i - 1] && s3.charAt(i...
9
public void leave(String address) { for (int i = 0; i < size(); i++) { if (getNode(i).getAddress().equals(address)) { notifySuccessor(getSuccessor(getNode(i)), getNode(i).getKeys()); nodeList.remove(i); } } }
2
public void unpackBuild() throws Throwable { File configBackupDir = new File("config_backup"); File modsBackupDir = new File("mods_backup"); if (configBackupDir.exists()) FileUtils.deleteDirectory(configBackupDir); if (modsBackupDir.exists()) FileUtils.deleteDirectory(modsBackupDir); File configD...
5
private void assertMe() { assert x != 0 || y != 0; assert x == 0 || x == 1 || x== -1; assert y == 0 || y == 1 || y == -1; }
5
public SubsetSum(int[] arr) { int sum = Comparison.SUM(arr); System.out.println("Sum "+sum); int m[][] = new int[arr.length][sum+1]; for(int i=0;i<arr.length;i++) m[i][arr[i]] = 1; for(int j = 0;j<=sum;j++){ for(int i=1;i<arr.length;i++){ if(j == arr[i]){ m[i][j]=1; continue; } ...
8
private void descargaProcedimiento(String nombre) { int procACargar = 0; while (!procedimientos.get(procACargar).getNombre().equals(nombre)) procACargar++; for (int i = 0; i < procedimientos.get(procACargar).getvariablesEnterasL(); i++) { contEntLoc.remove(contEntLoc.size()-1); } for (int i = 0; ...
9
public void mostraDialegVictoria( String missatge ) { boolean te_situacio_inicial = PresentacioCtrl.getInstancia().esPartidaAmbSituacioInicial(); try { PresentacioCtrl.getInstancia().finalitzaPartida(); } catch ( Exception excepcio ) { VistaDialeg dialeg_error = new VistaDialeg(); String[] botons_...
4
public void printBoard() { for (int row = 0; row < board.getN(); row++) { for (int col = 0; col < board.getN(); col++) { if (board.get(row,col) == PLAYER1_VAL) System.out.print(PLAYER1_CELL); else if (board.get(row,col) == PLAYER2_VAL) System.out.print (PLAYER2_CELL); else System.out.pri...
7
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) { HGPersistentHandle[] layout = graph.getStore().getLink(handle); Pair<?,?> result = (Pair<?,?>)TypeUtils.getValueFor(graph, handle); if (result != null) return result; Object first = null, second...
7
@SuppressWarnings("deprecation") public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input; //INITIALIZE THE PARAMETERS initParams(); int listenerPort= 9898; //ASSIGN MACHINE IDs String fullMachineID = getFullMac...
8
public void reportException(IllegalArgumentException e) { JOptionPane.showMessageDialog(getParent(), "Bad format!\n" + e.getMessage(), "Bad Format", JOptionPane.ERROR_MESSAGE); }
0
public static String removeContraction(String s){ String[] words = s.split("\\s+"); String output = ""; for (int i=0; i<words.length; i++){ String current = words[i]; if (current.contains("'")){ int index = current.indexOf("'"); if (current.charAt(index+1) == 's'){ output += current.substring(0...
7
public void execute() throws Exception { int keuze = menu.getMenuKeuze(); quizCatalogus = new QuizCatalogus(); opdrachtCatalogus = new OpdrachtCatalogus(); quizCatalogus.lezen(); //De code die hier stond om enkele opdrachten en quizzen aan te maken staat onderaan buiten de klasse in commentaar switch (...
7
@Transactional public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException{ try { Person p = personModelDao.getPersonByLogin(username); boolean enabled = true; boolean accountNonExpired = true; boolean credentialsNonExpired = true; boolean accountNonLocke...
1
private void parseTranscripts() { logger.info("Parsing gene model file..."); long tstart = System.currentTimeMillis(); this.transcripts = new ArrayList<TranscriptRecord>(); try { BufferedReader reader = IOUtils.toBufferedReader(new InputStreamReader(new FileInputStre...
6
private final String decode(final String val) throws SAXException { StringBuffer sb = new StringBuffer(val.length()); try { int n = 0; while (n < val.length()) { char c = val.charAt(n); if (c == '\\') { n++; c = val.charAt(n); if (c == '\\') { sb.append('\\'); } el...
4
public Hand[] deel(int aantalHanden, String algorythm) { if (aantalHanden * Vars.handGrote > Vars.SET_GROTE) new IndexOutOfBoundsException("Alle kaarten zijn op! Sorry :( Volgende potje mag je meespelen."); if(algorythm.equals("fikius")){ Hand[] out = new Hand[aantalHanden]; for(int i = 0; i < out.lengt...
8
private ArrayList<Profile.Entry> toArrayList(int partId, double startTime, double finishTime) { if(partId >= partitions.length || partId < 0) { throw new IndexOutOfBoundsException("It is not possible to " + "add a partition with index: " + partId + "."); } ArrayList<Entry> subProfile = new ArrayL...
7
public String getKeyName() { return this.name; }
0
public Mapper(Board board, int whatGameType, int useZones) { game = board; gameType = whatGameType; if(gameType == 0) tileWidth = 64; gameZones = useZones; if(gameZones == NO_ZONES) { zoneArray = new Tiles[1][1]; zoneCountX = 1; ...
2
public static boolean isSyntax (char c) { return c == ')' || c == '(' || c == ';' || c == '[' || c == ']'; }
4
public void moveAutomatonStates() { Object[] vertices = vertices(); for (int i = 0; i < vertices.length; i++) { State state = (State) vertices[i]; Point2D point = pointForVertex(state); state.setPoint(new Point((int) point.getX(), (int) point.getY())); } }
1
public boolean isSymmetric(){ boolean test = true; if(this.numberOfRows==this.numberOfColumns){ for(int i=0; i<this.numberOfRows; i++){ for(int j=i+1; j<this.numberOfColumns; j++){ if(this.matrix[i][j]!=this.matrix[j][i])test = false; ...
4
private String viewTempDigit(final int td) { String s = ""; StringBuilder sb = new StringBuilder(); for (int i = 1;i<=td-1;i++) { sb.append(i).append(" "); } sb.append(td); return sb.toString(); }
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
public int uniquePathsWithObstacles(int[][] obstacleGrid) { if (obstacleGrid == null || obstacleGrid.length == 0 || obstacleGrid[0].length == 0) return 0; int row = obstacleGrid.length; int col = obstacleGrid[0].length; int[] path = new int[col]; ...
9
protected void AdjustBuffSize() { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = 0; available = tokenBegin; } else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 204...
4
public static List<String> generateAddress(String[] nums, int position, List<String> addressList, String tmp) { String[] parts = tmp.split("\\."); if(parts.length == 5) { return addressList; } if(position == nums.length) { if(parts.length == 4) { addressList.add(tmp); return addressList; }else ...
6
private void inorderRec(List<Integer> list, TreeNode lastroot) { if(lastroot.left != null) inorderRec(list,lastroot.left); list.add(lastroot.val); if(lastroot.right != null) inorderRec(list,lastroot.right); }
2
private int calcDmg() { if (leadership > 92) { // For high Leadership commanders return Math.round(leadership + intelligence * 2 / 10); } else if (combatPower > 92) { // For high combatPower commanders return Math.round(combatPower * 8 / 10 + leadership ...
3
@Override public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if ((index % 2) == 0) { if (!isSelected) { ...
4
Set<Position> getDiagNeighbors(Position p) { Set<Position> neighbors = new HashSet<Position>(); if (p.i+1 < n && p.j+1 < m) neighbors.add(board[p.i+1][p.j+1]); if (p.i-1 >= 0 && p.j+1 < m) neighbors.add(board[p.i-1][p.j+1]); if (p.i+1 < n && p.j-1 >= 0) neighbors.add(board[p.i+1][p.j-1]); if (p.i-1 >=0 && p...
8
public void RandomizeNodeConnections(int X0, int Y0, int XLoc, int YLoc, int X1, int Y1) {// Sparsely connect a node with its neighbors. double Azar; Node ctr = GetNodeFromXY(XLoc, YLoc);// get this from xloc and yloc ctr.CleanEverything();// clean out all dead neighbor links and routes that refer to them ...
8
protected void drawBase(Graphics2D g2d, int x, int y, int colWidth, int rowHeight, int row, int site, Sequence seq) { if (translate) { throw new IllegalStateException("Not sure drawBase is supposed to get called for a translated sequence..?"); } if (site>=seq.length()) base[0] = ' '; else base[0] = ...
8
public Annotation addAnnotation(Annotation newAnnotation) { // make sure the page annotations have been initialized. if (!isInited) { try { initPageAnnotations(); } catch (InterruptedException e) { logger.warning("Annotation Initialization interup...
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
private void finish() { if (restricted == null) { JOptionPane.showMessageDialog(parent, "There is no one right answer in this case.", "Ambiguity", JOptionPane.ERROR_MESSAGE); return; } HashSet toAdd = new HashSet(restricted); toAdd.removeAll(alreadyChosen); Iterator it = toAdd.iterator(); wh...
2
public void addContact ( InetAddress iaIn , int iPort , String strName , int iSysState , int iState , String strStatus ) { InetAddress iaTmp = this.normalizeAddressIfLocal(iaIn); if (this.idxContact(iaTmp) == -1) { synchronized(this.list) { try { EzimContact ecTmp = null; ...
5
public static void main(String[] args) throws RemoteException { /* try { java.rmi.registry.LocateRegistry.createRegistry(1099); } catch (RemoteException e) { e.printStackTrace(); } */ if (args.length < 1) { System.err.println("Please specify the registry of this Scheduler!"); return; } //...
8
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub }
0
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
6
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) { return true; } if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) { re...
7
public Class<?> loadClass(String url, String name) throws ClassNotFoundException { try { URL myUrl = new URL(url); URLConnection connection = myUrl.openConnection(); InputStream input = connection.getInputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int d...
4
public AST rBlock() throws SyntaxError { expect(Tokens.LeftBrace); AST t = new BlockTree(); while (true) { // get decls try { t.addKid(rDecl()); } catch (SyntaxError e) { break; } } while (true) { // get statements try { ...
4
public Option<Zipper<A>> deleteRight() { return left.isEmpty() && right.isEmpty() ? Option.<Zipper<A>>none() : some(zipper(right.isEmpty() ? left.tail()._1() : left, right.isEmpty() ? left.head() : right.head(), right.isEmpty() ? right : right....
5
public boolean copierFichier(ObjectInputStream input, ObjectOutputStream output) throws ClassNotFoundException { //Methode permettant la copie d'un fichier boolean resultat = false; File source = null; File destination = null; // Declaration des flux FileInputStr...
5
StringBuffer generateCode () { /* Make sure all information being entered is stored in the table */ resetEditors (); /* Get names for controls in the layout */ names = new String [children.length]; for (int i = 0; i < children.length; i++) { TableItem myItem = table.getItem(i); String name = myItem.g...
4
private static byte[] insertGap(byte[] info, int where, int gap) { int len = info.length; byte[] newinfo = new byte[len + gap]; for (int i = 0; i < len; i++) newinfo[i + (i < where ? 0 : gap)] = info[i]; return newinfo; }
2
public static String extractFileNameFromUrl(String url) { HashMap<Integer, String> map = new HashMap<Integer, String>(); map.put(4, "html,aspx"); map.put(3, "jsp,php"); StringBuilder fileName = null; StringBuilder builder = new StringBuilder(url); boolean found = false; for (int i = builder.lastIndexOf("....
9
@Override public boolean isCellEditable(int rowIndex, int columnIndex) { if ((columnIndex == 0) || (columnIndex == 5)) { return true; } return false; }
2
@Override public Converter put(String key, Converter value) { Converter v = super.put(key, value); if (v != null) { throw new IllegalArgumentException("Duplicate Converter for " + key); } return v; }
1
@Override public String toString() { return "Action("+b+" goes to " + p + ")"; }
0
public void deleteMealById(long id) { Session session = null; Transaction tx = null; SimpleMealDaoImpl dao = getSimpleMealDaoImpl(); try { session = HbUtil.getSession(); //TRANSACTION START tx = session.beginTransaction(); SimpleMeal meal...
4
public static AbstractUIItem createItem(FeatureType t, Panel panel) { switch(t) { case Constant: return new ConstantUIItem(panel); case Sink: return new SinkUIItem(panel); case Source: return new SourceUIItem(panel); case Saddle: return new SaddleUIItem(panel); case Center: return new Center...
9
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public static void addAbilities(LivingEntity entity, SpawnReason spawnReason) { // Fetch the mob config for this entity MobAbilityConfig ma, rateMa; rateMa = ma = AbilityConfig.i().getMobConfig(entity.getWorld().getName(), ExtendedEntityType.valueOf(entity), spawnReason); // If there is not config for the e...
7
public void collision() { for (int i = 0; i < mobs.size(); i++) { Mob m = mobs.get(i); if (m instanceof Projectile) { for (int c = 0; c < mobs.size(); c++) { Mob a = mobs.get(c); if (!(a instanceof Projectile)) { if (m.getBounds().intersects(a.getBounds())) { System...
7
public static void rectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys = scal...
4
private String stringify(final InputStream inputStream) { if (inputStream == null) { return ""; } try { int ichar; ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (;;) { ichar = inputStream.read(); if (ichar < 0) { break; } baos.write(ichar); } return baos.toSt...
6
public Set<Long> getListIDs() { if (toListIDs == null || toListIDs.length() == 0) return null; HashSet<Long> listIDs = new HashSet<Long>(); for (String listID : toListIDs.split(",")) listIDs.add(Long.parseLong(listID)); return listIDs; }
3
public static void insertAlerts(EventsBean event) { PreparedStatement pst = null; Connection conn=null; String str = "There is an event "+event.getEventName() +" added for category "; try { conn=ConnectionPool.getConnectionFromPool(); pst = conn .prepareStatement("INSERT INTO STUDENT_ALERTS (PE...
4
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Usuario)) { return false; } Usuario other = (Usuario) object; if ((this.login == null && other.login != null) |...
5