text
stringlengths
14
410k
label
int32
0
9
public void Update(Rectangle playerRect, double visibility) { // No need to update when not moving // -> No collisions, no change of angles, no change of position if (move != Move.IdleStand) { angle = (float) Math.toDegrees(Math.atan2(speed.X, -speed.Y)); Vector2 sign = new Vector2(1, 1); sign.X = si...
9
public void tick(int y) { if ( y > 25000 ) { } else if ( y > 17000 ) { if ((y%100) == 0) { this.generateWing(y); } if ((y%1499) == 0) { this.generatePowerUp(y); } } else { if (this.bossBattle == false) { this.bossBattle = true; this.boss = this.enemyGenerator.make...
7
public GameControllerServerSide(Game g, List<PrintWriter> outWriters, List<BufferedReader> playerInputs) { gameHistory = ""; this.game = g; players = g.getPlayers(); String allPlayerReps = ""; for(int i = 0; i < g.getPlayers().size(); i++){ RemotePlayer player = (RemotePlayer) g.getPlayers().get(i); pla...
4
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } Method other = (Method) obj; if (params == null) { if (other.params != null) { r...
9
public ArrayList<Link> getPrevLinksForNode(Node node, ArrayList<Link> prevLinks) { boolean found = false; if (this.getP2() == node) { for (Link link : prevLinks) { if (link == this) { found = true; } } if (!found) { ...
5
private void setMatrix1Panel() { int rows = Integer.parseInt(matrix1Rows.getText()); int columns = Integer.parseInt(matrix1Columns.getText()); if ((rows == 1 && columns == 1) || rows < 1 || rows > 10 || columns < 1 || columns > 10){ matrix1Rows.setText(matrix1R + ""); matrix1Columns.setText((input1.length /...
7
@Override public String execute() throws Exception { try { User user = (User) myDao.getDbsession().get(User.class, email); if (user.getPassword().equals(password)) { Map session = ActionContext.getContext().getSession(); if (!user.getUserType().equ...
4
public double computeSimilarity(int movie1, int movie2) { double sim = 0; // generate arrays containing ratings from users which rated both movies List<Integer> sharedUsers = findSharedUsers(movie1, movie2); if (sharedUsers.isEmpty()) { return sim; } Double[] movieOneRatings = new Double[sharedUsers.s...
4
private void bookingActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_bookingActionPerformed {//GEN-HEADEREND:event_bookingActionPerformed try { new BookingGui().setVisible(true); } catch (SQLServerException ex) { Logger.getLogger(MemberGui.clas...
4
String longestCompound(String input) { input.replaceAll(",", ""); ArrayList <String> list = (ArrayList<String>) Arrays.asList(input.split("\\s+/")); MyQueue queuer = new MyQueue(); for(String word : list) queuer.offer(word); while (!queuer.isEmpty()) { String start = queuer.poll(); ...
7
public ServerOperator(Monopoly monopoly, Loader loader) { this.monopoly = monopoly; destination = new HashMap<Integer, ClientOperator>(); FieldCircularList go = monopoly.getGo(); FieldCircularList currentField = go; do { //adds eventlisteners to every purchasable field and performs actions if needed if...
5
public static void loadFrameDesigns (int levelNumber) { URL url = LevelDesign.class.getResource("/levels/level" + levelNumber + "/description"); BufferedReader reader = null; int framesNum = 0; int heroX = 0; int heroY = 0; try { reader = new BufferedReader(ne...
9
@Override public void actionPerformed(ActionEvent e) { PanPara panelParam = (PanPara) ((Component)e.getSource()).getParent(); int StepNumber = 15; try { StepNumber = Integer.valueOf(panelParam.getTfStepNumber().getText()); } catch (Exception exp) { } int S...
5
public void setShutdownFont(String font) { if ((font == null) || font.equals("")) { this.shutdownFont = UIFontInits.SHDBTN.getFont(); } else { this.shutdownFont = font; } somethingChanged(); }
2
@Override public int loop() { while (!isStarted) { sleep(500); } while (isStarted) { if (Players.getLocal().isIdle()) { status = "Waiting"; } if (container != null) { final Node job = container.state(); if (job != null) { container.set(job); getContainer().submit(job); job...
6
public List<String[]> getAttributes() { List <String[]> l = new ArrayList<String[]>(); String[] s = new String[2]; s = new String[2]; s[0] = "CAT2OSMSHAPEID"; s[1] = getShapeId(); l.add(s); if (ttggss != null){ l.addAll(ttggssParser(ttggss)); } return l; }
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 boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking, tickID)) return false; seeEnabled = false; if(!(ticking instanceof MOB)) return true; final MOB mob=(MOB)ticking; if(!mob.isInCombat()) return true; if((!CMLib.flags().canBeSeenBy(mob.getVictim(),mob)) &&(CMLi...
8
public VideoOutputFile(File file, int w, int h, int qualityDefinitionId, File dashMediaPresentationDescriptionFile, File dashAudioChannelFile, File dashVideoChannelFile, File hlsPlaylistFile, File hlsSegmentFile) { this.id = file.getId(); this.w = w; this.h = h; this.qualityDefinitionId = qualityDefinitionI...
5
public static void main(String[] args) { // ***************************************************** // The following tasks will be executed in the GUI Circuit circuit = new Circuit(4, 4); circuit.addBattery(new Battery(6), 1, 0, 2, 0, 1, 0); // Extra two arguments set the positive en...
8
private double exptGreaterThan(double b) { double sum=0,interval=(bowSize*12-b)/1000,val=b; for (int i = 0; i <1000; i++) { sum+=phi(val, mu, sigma)*val*interval; val+=interval; } return sum/(1-probLessThan(b)); }
1
public String getAlgorythmType(){ return algorythmType; }
0
public static List<Integer> getIdList(CompatConfig cfg, String path){ List<Integer> out = new LinkedList<Integer>(); List<String> ref = cfg.getStringList(path); if (ref == null) return out; for ( Object x : ref){ Integer id = null; if ( x instanceof Number){ // just in case id = ((Number) x).intVa...
8
@Override public boolean equals(Object o) { if (o == null || !(o instanceof Record)) return false; Record that = (Record) o; return this.user_id == that.user_id && this.username.equals(that.username) && this.keyboardLayout.equals(that.keyboardLayo...
7
@SuppressWarnings("static-access") public void drawHexes(int center, int radius, Graphics2D g, int lineThickness, Color color) { this.centerHex.setHexagon(new Hexagon(center, center, radius)); this.centerHex.getHexagon().setRadius(radius); String text=""+this.centerHex.getHexNumber(); this.centerHex.getHexagon...
4
public void go(String input, String outputdir){ // set location of config file String config = "d:/warcraft data/config.cfg"; // Create data structure MatchData M = new MatchData(input); // Read the config file processConfig(readConfig(config)); // Declare variabl...
6
public static long getLongLE(final byte[] array, final int index, final int size) { switch (size) { case 0: return 0; case 1: return Bytes.getInt1(array, index); case 2: return Bytes.getInt2LE(array, index); case 3: return Bytes.getInt3LE(array, index); case 4: return Bytes.getInt4L...
9
private void expand1(byte[] src, byte[] dst) { for(int i = 1, n = dst.length; i < n; i += 8) { int val = src[1 + (i >> 3)] & 255; switch(n - i) { default: dst[i + 7] = (byte)((val) & 1...
8
@Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { land = new Image("resources/images/ToxicWasteland.png"); chicken1= new Image("resources/images/chickun1.png"); chicken2= new Image("resources/images/chickun2.png"); fire1= new Image("resources/images/fure.png"); fi...
4
private void postOrderRec(Position<T> node) throws InvalidPositionException { if (node != null) { BTPosition<T> BTnode = checkPosition(node); postOrderRec(BTnode.getLeft()); postOrderRec(BTnode.getRight()); System.out.print(node.element() + " "); } }
1
public void visitMethodDef(JCMethodDecl tree) { try { // when producing source output, omit anonymous constructors if (tree.name == tree.name.table.names.init && enclClassName == null && sourceOutput) return; println(); align(); ...
9
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); //Parte para saber el tipo de usuario UsuarioBean oUsuarioBean; oUsuarioBean = (UsuarioBean) request.getSessi...
2
@Test public void findHandFromCardSet_whenOnePairExists_returnsOnePairPlusHighestKicker() { Hand hand = findHandFromCardSet(twoEightsPlusQueenTenSevenKicker()); assertEquals(HandRank.OnePair, hand.handRank); assertEquals(Rank.Eight, hand.ranks.get(0)); assertEquals(Rank.Queen, hand.ranks.get(1)); assertEqual...
0
public Element toElement(Cinema cinema) { Element element = new Element("cinema"); element.setAttribute("name", cinema.getName()); Iterator<CashOffice> cashOffices = cinema.cashOfficeIterator(); while (cashOffices.hasNext()) { element.addContent(new CashOfficeTranslator().toElement(cashOffices.nex...
1
public void death() { do { removeIsDead(); for (int index = 0; index < animalFactory.getQuantityOfPredator(); index++) { for (int i = 0; i < animalFactory.getQuantityOfVictims(); i++) { if (animalFactory.getVictim(i).position.getX() == animalFactory.ge...
5
@Override public List<String> getInheritence() { return inheritence; }
0
void render(float[][] dest, int nsamples) { float[] inbuf = inst.aux1buf; for (int i = 0; i < nsamples; i++) { float in = inbuf[i] * gainin + fcdcoffset; for (int ch = 0; ch < 2; ch++) { float cur = 0.0f; for (int j = 0; j < 4; j++) { /*float dv = combd[ch][j].fetch(); float nv = gainc[j]...
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try{ Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/library_management", "root", "welcome6" ); ...
7
private boolean search(char[] s,char[] p, int i1,int i2) { if (i1 == s.length) { if (i2 == p.length) return true; if (p[i2] == '*') return search(s,p,i1,i2+1); return false; } if (i2 == p.length) return false; if (s[i1] == p[i2] || p[i2] == '?') return search(s,p,i1+1,i2+1); if (p[i2] ...
8
private long toSeconds() { switch (type) { case SECONDS: return value; case MINUTES: return value * 60; case HOURS: return value * 3600; case DAYS: return value * 24 * 3600; case MILLISECO...
5
@org.junit.Test public void testLoadDirScan() throws ClassNotFoundException, java.io.IOException, java.net.URISyntaxException, NoSuchMethodException, IllegalAccessException, java.lang.reflect.InvocationTargetException { boolean hackflag = DynLoader.CLDHACK; DynLoader.setField(DynLoader.class, "CLDHACK", Bool...
8
@Override public void run() { while (true) { System.out.println("Consumer gets " + buffer.get()); } }
1
private boolean save_css_prefs(Preferences prefs) { assert(prefs != null); // // css file preferences // // First, remove any old css files from the preferences. try { Preferences md_prefs = prefs.node(CSS_FILES_NODE); md_prefs.removeNode(); md_pr...
3
void answer(String s, int n, String cur, List<String> res) { if(s.length()>n*3 || s.length()<n) return; if(n==0) { res.add(cur); } for(int i=0;i<3&&i<s.length();i++) { String temp = s.substring(0,i+1); if(validate(temp)) { if(n<4) temp ="."+temp; answer(s.substring(i+1), n-1, cur+temp,...
7
public void sendTeamAndScheduleInfo() { sendCommand("clearSched"); if(control.teams != null) { for(Team t : control.teams.toArray()) { sendCommand("addTeam=" + t.number + "," + t.name); } } if(control.schedule != null) { String setTablesCMD = "setTables="; for(String name : control.schedule.tabl...
8
private void checkDead(){ for(int row = 0; row < ROWS; row++){ for(int col = 0; col < COLS; col++){ if(board[row][col] == null) return; if(checkSurroundingTiles(row, col, board[row][col])){ return; } } } dead = true; if(score >= highScore) highScore = score; setHighScore(); }
5
public PossibleConnection engageIgnoringParagraphs(int i) { /* Inicijalizacija */ // Slucaj spoja mostProbable12.setconnectionCase(12); // Pretpostavimo da je to nemoguc spoj mostProbable12.setProbability(0.0); // Ocistimo listu elemenata koji bi se ovim spojem spojili mostProbable12.getkeysInConnection...
5
public void draw(Graphics g) { if (state == 0) { g.setColor(Color.white); } else if (state == 1) { g.setColor(Color.red); } else if (state == 2) { g.setColor(Color.yellow); } //RESERVED FOR WINNING CIRCLES else if (state == 3) { ...
9
private void term(){ factor(); while( is(TK.TIMES) || is(TK.DIVIDE) ) { gcprint(tok.string); scan(); factor(); } }
2
void table2(){ for (int j = 1; j <= 10; j++) { for (int i = 0; i < higherRows.length; i++) { int result = higherRows[i] * j; String mainCell = higherRows[i] + " x " + j + " = " + result; int spacesNumber = symbolsInCell - mainCell.length(); ...
6
public static boolean phone(String phone){ if(phone.matches("(\\d){10}")) return true; return false; }
1
public String getMiddleName() { return middleName.get(); }
0
public void addwarps(CommandSender cs, Command cmd, String string, String[] args) { Player player = (Player) cs; if (player.hasPermission("warpsandports.user.add") || player.isOp()) { if (args.length == 4) { Player target = player.getServer().getPlayer(args[2]); if (!(MainClass.warps.contains("Warps....
5
public VetVisit remove(VetVisit visitX) { boolean visitHasBeenRemoved = false; int count = 0; if(!this.contains(visitX) || this.visitCount == 0) { return null; } Node<VetVisit> previousNode = null; Node<VetVisit> currentNode = t...
7
@Override public int hashCode() { int hash = 3; hash = 31 * hash + (this.version != null ? this.version.hashCode() : 0); return hash; }
1
public GregorianCalendar getUitleenDatum() { return UitleenDatum; }
0
@Override public Object getClock() { return (Object) this.clock; }
0
public static String stripLeadingSeparators (String path) { if (path.length() == 0) { return path; } if (path.charAt(0) != '/') { return path; } int ii; for (ii = 0; ii < path.length(); ii++) { if (path.charAt(ii) != '/') { ...
4
private void rebuild() { removeAll(); setLayout(new GridLayout(skills.size() + 1, 7)); add(new JLabel("Class Skill")); add(new JLabel("Skill Name")); add(new JLabel("Key Ability")); add(new JLabel("Skill Modifier")); add(new JLabel("Ability Modifier")); ad...
7
public String traversePostorder(){ String result=""; Deque<Node> stack=new ArrayDeque<Node>(); Node node; Node prevNode=null; stack.push(tree.getRootNode()); while(!stack.isEmpty()){ node=stack.peek(); if(prevNode==null||prevNode.leftNode==node||prevNode.rightNode==node){ if(node.leftNode...
9
public void run() { while (true) { // get the prices every 2 minutes and update them myStocks = DataReader.getStocks(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); System.out.println("Last updated stocks at " + dateFormat.format(date)); if (mySto...
4
private Graph(final String name) { this.name = name; }
0
public String multiply(String num1, String num2) { int length2 = num2.length(); int length1 = num1.length(); String[] list = new String[length2+1]; int total = length1+ length2; int i; //pre for( i=0; i < length2;i++ ){ list[i] = zero(length2 -i)+ num1...
1
protected void initSpecialParameters() throws MaltChainedException { if (getConfiguration().getOptionValue("singlemalt", "null_value") != null && getConfiguration().getOptionValue("singlemalt", "null_value").toString().equalsIgnoreCase("none")) { excludeNullValues = true; } else { excludeNullValues = false; ...
9
private void updateRemote() { if (remoteKeys[KeyEvent.VK_R]) reset(); if (ai.getY() >= 2) if (remoteKeys[KeyEvent.VK_UP] || remoteKeys[KeyEvent.VK_Q]) { ai.move(false); } if (ai.getY() <= (height - 50)) if (remoteKeys[KeyEvent.VK_DOWN] || remo...
7
public void calculateEnergyConsumption() { int i = 1; System.out.println("EVALUATING SYSTEMS\n"); for (SoftwareSystem system : systems) {// was:validsystem System.out.println("\tSystem " + (i++) + "\n\t\t" + system); int j = 0; Calculator calculator = new Calculator(this); for (FunctionalRequirement f...
8
public void addActions() { Play.addActionListener(new ActionListener() { // Add an actionListener to the Play button @SuppressWarnings("static-access") public void actionPerformed(ActionEvent e) { // Turn the action into a variable to be used // dispose of the Menu dispose(); // Create a...
1
public void find(String type1, String type2) { int key1 = Math.abs(type1.hashCode() % size); int key2 = Math.abs(type2.hashCode() % size); DictNode list1 = null; DictNode list2 = null; if (typeTable[key1].size == 1) { list1 = typeTable[key1].head; } e...
7
@SuppressWarnings("unused") public void buildPanel() { this.setBounds(250, 250, widthPanelLose, heightPanelLose); this.setVisible(false); this.setBackground(Color.BLACK); JLabel label = new JLabel("La partie est terminée, vous êtes éliminé !"); this.add(label); //Nouveau bouton Relancer une partie ...
5
private String transImm(String immediate, int immLength) throws BadImmFormatError, ImmTooLargeError, UndefinedLabelError, LabelTooFarAwayError { String imm = new String(immediate); if (imm.endsWith("h")) { if (imm.startsWith("-")) { imm = "-0x" + imm.substring(1, ...
8
public static Collection<? extends Bean> scanForBeansFromFields(Class baseType) { Set<Bean> ret = new HashSet<Bean>(); Field[] fields = baseType.getDeclaredFields(); for (Field field : fields) { org.frameworkdi.poc.annotations.Bean bean = field.getAnnotation(org.frameworkdi.poc.anno...
4
private static void processOrderBy(final DB db, final DatabaseMap dbMap, final Criteria crit, final Query query) throws TorqueException { UniqueList orderByClause = query.getOrderByClause(); UniqueList selectClause = query.getSelectClause(); UniqueList orderBy = crit.getOrderByColumns(); if (order...
9
public void setKeysStructure(ArrayList<LangFileElement> enFileStructure) { ArrayList<LangFileElement> elementsToRemove = new ArrayList<>(); for (LangFileElement lfe: fileStructure) { if (lfe.getType() != LangFileElement.HEADER && lfe.getType() != LangFileElement.STATEMENT) { ...
8
public static HashMap<Integer, String> getJdbcTypeName() { HashMap<Integer, String> out = new HashMap<>(); for (Field sqlField : java.sql.Types.class.getFields()) { try { out.put((Integer) sqlField.get(null), sqlField.getName()); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (...
3
@Override public void spring(MOB target) { if(target.location()!=null) { if((!invoker().mayIFight(target)) ||(isLocalExempt(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target)) ||(target==invoker()) ||(doesSaveVsTraps(target))) target.location().show(target,null,null,CMMs...
9
public void writeData(int len, byte[] to_send) { //get_lock(); currline=""; //reset the receive buffer for(int i = 0; i < currbuf.length; i++) currbuf[i] = 0x00; logText = "--> ["+ dump(len, to_send)+"]"; trytolog(logText); //startreader(); this.expected_len = -1; t...
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 Resource(Element secondlevel) throws Exception{ /** Contains all resources defined in config file **/ resourcen = new HashMap<String, Object>(); // There must be at least one childnode (the path to arff files) in resource node if(!(secondlevel.getEnd() instanceof Longend)) { throw new Exception("No...
7
@Override public void Handle(byte[] message, Server server, IOClient player) { if (player instanceof Browser) { String full = ""; try { full = new String(message, "US-ASCII"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String url = full.split("\\ ")[1]; ((Browser)play...
2
public void parseInput(String str) { str.trim(); //if (!str.equals("")) postOutput(str); if (str.startsWith("/")) { // parse as command str.toLowerCase(); if (str.indexOf(" ") > 0) { switch (str.substring(1, str.indexOf(" "))) { case "say": Packet03Speech pack = new Packet03Speech("SERVER", ...
9
public boolean isEnabled() { if(Universe.CHOOSER == null) return true; return false; }
1
public static void Cluster(String[] args) throws IOException, InterruptedException, ClassNotFoundException{ Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 6){ System.err.prin...
2
public void addObservation(float[] bowl){ for (int i = 0; i < NUM_FRUIT_TYPES; i++){ occuranceHist[i][(int) bowl[i]] += 1; } }
1
public AutomobileSalon() { for (int i = 0; i < 3; i++) { this.RacecarI.add(RacecarFactory.createCar("RacecarI")); this.RacecarII.add(RacecarFactory.createCar("RacecarII")); this.TruckI.add(TruckFactory.createCar("TruckI")); this.Automobile1eI.add(AutomobileFactory...
1
public void loadLevel() { BufferedReader br = null; try { br = new BufferedReader(Gdx.files.internal("levels/lvl" + Integer.toString(level)).reader()); String line; while ((line = br.readLine()) != null) { Gdx.app.log("Crate", line); char key = line.charAt(0); String[] strs; switch (key) { ...
9
private void statements(String returnLabel) throws ParsingException { String value = getcurrentValue(), stringValue; ExpressionSimplifier simplify = null; String identifier; switch(value) { case Constants.PRINTF: incrementTokens(Constants.LEFT_PAREN); stringValue = matchNextToken(); print...
9
public void setText(String paramString) { if (this.StreakThread != null) { this.StreakThread.politeStop(); } if (this.BurnThread != null) { this.BurnThread.politeStop(); } if (this.HardHeight > 0) { this.ScrollTranslation = new Point(0, 0); } if (paramString == null...
5
public void joinWait(Client c, int team) { if (c.playerEquipment[c.playerHat] > 0 || c.playerEquipment[c.playerCape] > 0) { c.sendMessage("You may not wear capes or helmets inside of castle wars."); return; } if (team == 1) { if (saradominWait.size() > zamorakWait.size()) { c.sendMessage("This team i...
7
private int getInsertionMarkerPosition(TreeContainerRow parent, int insertAt) { int y = 0; int dividerHeight = getRowDividerHeight(); if (mRoot != parent) { for (TreeRow one : new TreeRowViewIterator(this, mRoot.getChildren())) { y += getRowHeight(one) + dividerHeight; if (one == parent) { break; ...
8
public static int[][] calcScoreMatrix(char[] st1, char[] st2) { int[][] score = new int[st1.length+1][st2.length+1]; long[][] count = new long[st1.length+1][st2.length+1]; // расстояния между одной строкой и другой пустой for (int i = 0; i <= st1.length; i++) { score[i][0] = i; count[i][0] = 1; } for ...
8
public void habilitarFunciones(int perfil){ String consulta="select per_id_perfil,per_id_modulo,per_id_tarea from permiso where per_id_perfil="+perfil; r_con.Connection(); ResultSet rs=r_con.Consultar(consulta); Vector<Vector<Integer>>modulosTarea=new Vector();...
5
public static int indexOfCI(String context, int from, String toFind) { int toFindIndex = 0; char l = toFind.charAt(toFindIndex);// char to match now l = Character.toLowerCase(l); for (int i = from; i < context.length(); i++) { char c = context.charAt(i); c = Character.toLowerCase(c); if (c != l) { ...
3
public static int getStat(boolean player, int statNum, boolean crit) { if (PokemonUtil.isGen1() && statNum == STAT_SPCDEF) statNum = STAT_SPCATK; if (!crit) return Util.getMemoryWordBE((player ? curGb.pokemon.fightBattleMonStatsAddress : curGb.pokemon.fightEnemyMonStatsAddress) + 2*statNum); else { int a...
7
public static Integer fromShortStringToSeconds(String arg) throws Exception { if (StringUtils.isBlank(arg)) { throw new Exception("No walltime string provided."); } int ivalue = 0; try { ivalue = Integer.parseInt(arg); } catch (final NumberFormatException ex) { final Pattern date = Pattern .comp...
8
void number(int i){ num[i]=low[i]=++count; stack.push(i); int j = f[i]; if(num[j]==0){ number(j); low[i]=Math.min(low[i], low[j]); } else if(stack.contains(f[i])){ low[i]=Math.min(low[i], num[j]); } if(num[i]==low[i]){ ...
7
private void updateNode(Node updateNode, Node prevNode, Node nextNode) { if(updateNode.equals(client.getThisNode())) //Node to update is own node { if(prevNode != null) { client.setPrevNode(prevNode); } if(nextNode != null) { client.setNextNode(nextNode); } } else { try ...
6
public static User LoginUser(String username, String password) { try { String query = String.format("SELECT * FROM APPUSERS WHERE USERNAME = '%s' AND PASSWORD ='%s'", username, password); User loginUser = new User(); ResultSet rs = getQueryResults(query); if (rs.next()) ...
2
public Block() { // Default state of a newly created block state = 1; blockType = -1; shape = Shape.None; // Generate random block blockType = rn.nextInt(7) + 1; shape = Shape.get(blockType); // Set block based on shape type // Blocks represented as int arrays int[][] zShape = { {0, 0, 0, ...
7
@Override public boolean isValid() { Position destination = getDestination(); if(!inRange(start) || !inRange(destination)) return false; if (field.getPiece(start)==null) return false; //casella di partenza vuota if (field.getPiece(destination)!=null) return false; //casella di arrivo non vuota ret...
4
public static Class[] findClassesOfType(String packageNameToSearch, Class<?> typeDesired) { ArrayList<Class<?>> classesFound = new ArrayList<Class<?>>(); String[] classNames = findClassNames(packageNameToSearch); for (String className : classNames) { ...
7