text
stringlengths
14
410k
label
int32
0
9
public int checkReactionID(int IDCheck){ int index=-1; for(int i=0; i<graphNodes.size(); i++){ if( (graphNodes.get(i).getID()==IDCheck) && (graphNodes.get(i).getType() == _REACTION_) ){ index=i; } } return index; }
3
public String getSchedule() { ByteArrayOutputStream outputString = new ByteArrayOutputStream(); PrintWriter output = new PrintWriter(outputString, true); if (timePoints.size() == 0) return ""; BusStop[] tp = new BusStop[timePoints.size()]; output.println("SCHEDULE FOR LINE " + name); ...
5
@Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { Input input = gc.getInput(); Character.update(input, delta); for (Iterator<Enemy> iterator = mobs.iterator(); iterator.hasNext(); ) { Enemy e = iterator.next(); e.update(delta); } // check collisio...
7
public ContainmentProblem(Query query, Query view, String shouldMatch) { this.query = query; this.view = view; if (shouldMatch.equals("true")) { this.shouldMatch = 0; } else if (shouldMatch.equals("false")) { this.shouldMatch = 1; } //System.out.pr...
2
public static List<Integer> parseNumericStringArrayObject(Object object) throws InvalidRpcDataException { if (object == null) { return null; } if (object instanceof String[]) { return parseNumericStringArray((String[]) object); } else { throw new In...
2
private void readToken() { while (true) { prompt(); String token = _input.findWithinHorizon(TOKEN_PATN, 0); if (token == null) { token = "*EOF*"; } else if (token.startsWith("'")) { if (token.length() == 1 || !token.endsWith("'")) {...
9
static final int method2064(int i, int i_0_, int i_1_, int i_2_) { anInt3549++; if (aa_Sub1.aSArray5191 == null) return 0; int i_3_ = i >> 937361225; int i_4_ = i_2_ >> -1589419447; if ((i_3_ ^ 0xffffffff) > -1 || (i_4_ ^ 0xffffffff) > -1 || i_3_ > -1 + Class367_Sub4.mapSizeX || ((Class348_Sub40_Sub...
8
@Override public void destroy() { super.destroy(); if (gameTimer != null) { gameTimer.cancel(); } }
1
public static final String getName(final byte level) { switch (level) { case 0: return "Rookie"; case 1: return "Genin"; case 2: return "Chunin"; case 3: return "Jounin"; case 4: ...
6
@Override public void update(final int delta) { if (Controls.getInstance().wasEnter()) isStarted = true; if (!isStarted) return; if (currentLevel.isFinished()) { System.out.println("Level comlete..."); System.out.println("New Level"); } currentLevel.update(delta); }
3
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed // TODO add your handling code here: String str=""; int l; str = this.jTextField23.getText().toUpperCase(); if(Biblio.containsKey(str)){ j = (Ju...
8
public List<String> logInUser() { List<String> serviceList = null; // Get user's service list if (user.getUserType().equals(UserTypes.buyer)) { serviceList = med .logInBuyer(user.getUsername(), user.getPassword()); } else { if (user.getUserType().equals(UserTypes.seller)) { serviceList = med.log...
3
private ArrayList<members> searchForMembers(ArrayList<members> memberList, String input){ ArrayList<members> updated_memberList = new ArrayList<members>(); for(members current: memberList){ try { if (current.getId().toString().contains((input))){ updated_m...
5
@Override public void epoch(Player p) { if (TRAIN_score && score_file != null) score_net.export(score_file); }
2
private static float calculatePriceMain(int[] seriesCounts) { Arrays.sort(seriesCounts); int numBooks = 0; int numUniqueBooks = 0; for(int series = 0; series < seriesSize; series++) { numBooks += seriesCounts[series]; if(seriesCounts[series] > 0) { numUniqueBooks++; } } if(numBooks...
6
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; for (int id = 0; id < shapes.size(); id++) { GradientPaint p = null; if (select + 1 == id) p = new GradientPaint(300, 0, new Color(0xff, 0x5f, 0), 600, 0, new Color(0, 0x5f, 0xff)); else p = new G...
8
public String getManufacturer() { return manufacturer; }
0
public TypeBinding postConversionType(Scope scope) { TypeBinding convertedType = this.resolvedType; // if (this.valueCast != null) // convertedType = this.valueCast; int runtimeType = (this.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4; switch (runtimeType) { case T_boolean : convertedType = TypeBinding....
8
private static Image drawBorder(Frontier frontier, Image image) { if (image.isRgb()) { // for (Point p : frontier.getInnerBorder()) { // image.setPixel(p.x, p.y, RED, 255); // image.setPixel(p.x, p.y, GREEN, 0); // image.setPixel(p.x, p.y, BLUE, 0); // } for (Point p : frontier.getOuterBorder()) { ...
4
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) { try { if(args.length == 4) { int checkradius; int allowednumberofblocks; Material matchmaterial = Material.matchMaterial(args[1]); if(matchmaterial == null) { throw new IllegalArgumentExcep...
5
public AutomatonDirectedGraph(Automaton automaton) { super(automaton); }
0
void closeNoMsgPlayer() { // Disabled this check... if this is called, the player needs to be closed. // if (blnIsClosing) // { // /* // ** Already closing elsewhere // */ // return; // } blnIsClosing = true; blnWorking = false; removeFromGroup(); if (vctConditions.size() != 0) { engGame.vctCh...
9
@Override public boolean tick(Tickable ticking, int tickID) { Item I=null; if(affected instanceof Item) I=(Item)affected; if((canBeUninvoked())&&(I!=null)&&(I.owner() instanceof MOB) &&(I.amWearingAt(Wearable.WORN_LEGS)||I.amWearingAt(Wearable.WORN_ARMS))) { final MOB mob=(MOB)I.owner(); if((!mob.a...
9
@SuppressWarnings("unchecked") private T createExtension(String name) { Class<?> clazz = getExtensionClasses().get(name); if (clazz == null) { throw new IllegalStateException("Error when load extension class(interface: " + iFaceType); } try { T instance = (T) EXTENSION_INSTANCES.get(clazz); if (instan...
4
@Override public void update(final int delta) { super.update(delta); if (controls.isRIGHT()) { direction.add(SPEED * delta, 0); left = false; } if (controls.isLEFT()) { direction.add(-SPEED * delta, 0); left = true; } // if (controls.isUP()) { // direction.add(0, -SPEED * delta); // } // ...
9
private void drawTooltip() { if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) return; String s; if(itemSelected == 1 && menuActionRow < 2) s = "Use " + selectedItemName + " with..."; else if(spellSelected == 1 && menuActionRow < 2) s = spellTooltip + "..."; else s = menuActionName[...
8
public int find(int[] sequence) { int n = sequence.length; int a[] = new int[48]; int ans = 0; int f = 0; for(int i = 0;i < n - 1;i++){ for(int j = i + 1;j < n;j++){ if(sequence[i] != sequence[j]){ ans++; }else{ if(a[sequence[i]] == 0&&f == 0){ ans++; a[sequence[i]]++; f...
5
@Override public SpecialTile getSpecialTile(Location loc) { if(!isValidLocation(loc)) return null; for(Location l : specialTiles){ if(l.sameCoord(loc)){ return (SpecialTile) l.getTile(); } } return null; }
3
public ImagePlus applyWithMask() { final int width = input.getWidth(); final int height = input.getHeight(); final int depth = input.getStackSize(); //final ImagePlus imageOutput = input.duplicate(); //final ImageStack imageStackOutput = imageOutput.getStack(); final ImageStack inputStack = input.getStac...
8
private void processMouse() { while (Mouse.next()) { boolean handled = false; for (MouseEventHandler handler: mouseEventHandlers) { if (Mouse.getEventButton()!=-1) { if (Mouse.getEventButtonState()) { handled = handler.onMouseDo...
6
@Test public void test_addPawn() { assertNotNull(board); assertEquals(numberOfPawns, board.numberOfPawns()); Pawn pawn1 = new Pawn('l', 3, 4, board); board.addPawn(pawn1); assertEquals(numberOfPawns + 1, board.numberOfPawns()); }
0
protected void drawItemLabel(Graphics2D g2, XYDataset dataset, int series, int item, XYPlot plot, XYItemLabelGenerator generator, Rectangle2D bar, boolean negative) { String label = generator.generateLabel(dataset, series, item); if (label =...
8
@SuppressWarnings("unchecked") public void load(File modelDirectory, String modelPrefix) throws JChunkerException { ObjectInputStream featDictClassInputStream = null; try { featDictClassInputStream = new ObjectInputStream(new FileInputStream(new File(modelDirectory, modelPrefix ...
8
public Counter() {}
0
public void paint(Graphics g) { g.setColor(mouseHovering ? HOVER_BACKGROUND_COLOR : BASE_BACKGROUND_COLOR); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); g.setColor(BORDER_COLOR); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); g.setColor(TEXT_COLOR); int textX = bounds.x + ((bou...
1
public static boolean computeCell(long world,int col,int row) { // liveCell is true if the cell at position (col,row) in world is live boolean liveCell = getCell(world, col, row); // neighbours is the number of live neighbours to cell (col,row) int neighbours = countNeighbours(world, col, row); // ...
7
@Override public List<Funcionario> listAll() { Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; List<Funcionario> funcionarios = new ArrayList<>(); try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(L...
3
public void testGetValue() { Partial test = createHourMinPartial(COPTIC_PARIS); assertEquals(10, test.getValue(0)); assertEquals(20, test.getValue(1)); try { test.getValue(-1); } catch (IndexOutOfBoundsException ex) {} try { test.getValue(2); ...
2
public static int itemAmount(int itemID, int itemX, int itemY) { for (int i = 0; i <= 5000; i++) { // Phate: Loop through all item spots if(globalItemID[i] == itemID && globalItemX[i] == itemX && globalItemY[i] == itemY) // Phate: Found item return globalItemAmount[i]; } return 0; // Phate: Item does...
4
public JuliaMandelbrotFrame() { setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new GridLayout(1,2)); setSize(700,300); mand = new MandelbrotPanelDouble(); mand.addMouseMotionListener(new MouseMotionListener(){ @Override public void mouseDragged(M...
0
public static String getTriadChordName(ArrayList<Key> chord){ String name = ""; //add the root note name += chord.get(0).getStringNote(); //check if the third is major or minor String third = (NotesUtils.getIntervalBetweenTwoKeys(chord.get(1).getMidiKey(), chord.get(0).getMidi...
9
public static GameMaster fromGenerator(TargetGenerator targetGenerator) { return new GameMaster(targetGenerator.generate()); }
0
public void addCalendars(List<EventCalendar> calendars) { Connection connection = null; PreparedStatement statement = null; PreparedStatement selectStatement = null; try { // Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); // Ope...
8
protected void notifyReceivedMsg(MqttWireMessage message) throws MqttException { final String methodName = "notifyReceivedMsg"; this.lastInboundActivity = System.currentTimeMillis(); // @TRACE 651=received key={0} message={1} log.fine(className, methodName, "651", new Object[] { new Integer(message.getMess...
9
private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed int result = openChooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File[] selected = openChooser.getSelectedFiles(); if (selected.length > ...
4
private void updateStateWaiting(List<Keyword> keywords, List<String> terms) { if (keywords!= null && !keywords.isEmpty()) { for (Keyword kw : keywords) { if (kw.getWord().equals("ingredient") || kw.getWord().equals("ingredients")) { newObjectClass = Ingredient.class; } if (kw.getWord().equals("tool") || kw.getWord().eq...
8
public static void main(String[] args){ // Socket which will connect to the engine. Socket socket = null; // Reader to read packets from engine BufferedReader inStream = null; // Convenience wrapper to write back to engine PrintWriter outStream = null; // port number...
7
@Override public <E extends IElement> E create(Class<E> ElementClass, WebElement element) { try{ return ElementClass.getConstructor(WebElement.class).newInstance(element); } catch(Exception e){ throw new RuntimeException(e); } }
1
public static int findWordEnd(String line, int pos, String noWordSep) { char ch = line.charAt(pos); if(noWordSep == null) noWordSep = ""; boolean selectNoLetter = (!Character.isLetterOrDigit(ch) && noWordSep.indexOf(ch) == -1); int wordEnd = line.length(); for(int i = pos; i < line.length(); i++) {...
5
@Override public void run(){ try{ while(true){ move(); for(int i = 0; i < shots.length; i++){ if(shots[i] != null){ shots[i].moveShot(id); shots[i] = GameFrame.checkShots(shot...
9
public void drawOptions(SpriteBatch sb) { int x, y, px = font[0].getRegionWidth()-1, py = font[0].getRegionHeight() + 2; for (int j = 0; j <= menuMaxY; j++) for (int i = 0; i <= menuMaxX; i++) { x = (Game.width/2 - menuOptions[i][j].length() * px - px/2)/2 ; y = (Game.height/4 - j * py - 28); i...
4
public Writer write(Writer writer) throws JSONException { try { boolean b = false; int len = this.length(); writer.write('['); for (int i = 0; i < len; i += 1) { if (b) { writer.write(','); } ...
5
public Boolean close() { try { this.con.close(); return true; } catch (SQLException e) { log.severe("Couldn't close Connection: "); LogHandler.writeStackTrace(log, e, Level.SEVERE); return false; } }
1
@FXML private void handleTxtPriceAction(ActionEvent event) { if (txtPrice.getText().isEmpty()) { return; } cobSuppliers.requestFocus(); }
1
public List<AlumnoDTO> getAlumnosPorGrupo(int idGrupo){ List<AlumnoDTO> alumnos = new ArrayList<AlumnoDTO>(); Connection con = null; PreparedStatement pst = null; ResultSet rs = null; try { con = EscolarConnectionFactory .getInstance().getConnection(); String sql = "select a.matricula, a.apellido...
6
private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; }
7
public CircleTile(int rank) { super(rank); setToolTipText(toString()); switch(rank){ case 1: circles[0] = new Pancake( 49, 29, Color.RED); break; case 2: circles[0] = new Circle(45 + 3, 35 - 21, MYGREEN); circles[1] = new Circle(45 + 3, 35 + 9, Color.RED); break; case 3: circles[0] = new ...
9
@AfterClass public static void tearDownClass() { }
0
void designateTask(int i, int i0, TaskEnum type) { if(this.getTile(i, i0).getDesignate()==type) { this.getTile(i, i0).setDesignate(null); this.getTaskmanager().undesignateTask(this.getMap().getTile(i, i0).getActualTask(), this.getBeastcollection()); return; ...
8
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null) { return; } if (!Room.CheckRights(Main.Data, true)) { return; } ...
5
public static void main(String[] args) { LinearProbingHashST<String, Integer> st = new LinearProbingHashST<String, Integer>(); for (int i = 0; !StdIn.isEmpty(); i++) { String key = StdIn.readString(); st.put(key, i); } // print keys for (String s : st.keys()) StdOut.println(s + " " + st.get(s));...
4
public boolean equals(Wall wall){ if (wall.getX() == x && wall.getY() == y && wall.width == width && wall.height == height){ return true; } return false; }
4
private void addDatabaseLoadPanel(JScrollPanelledPane stepScroll) { JPanel dbLoad = JComponentFactory .makePanel(JComponentFactory.HORIZONTAL); CustomButton loadDB = JComponentFactory.makeLoadDatabaseButton( "Load Database", confirmLoad); if (programSettings.autoLoadDatabase) { autoLoad.setSelected(tr...
1
public boolean growCrops(Player player, String[] args, int radius) { Block playerCenter = player.getLocation().getBlock(); // Get Centrepoint (Player) int crops = 0; for (int x = -radius; x < radius; x++) { for (int y = -radius; y < radius; y++) { for (int z = -radius; z < radius; z++...
6
public static void caught(int index) { if(index>=151) { System.out.println("MISSINGNO caught; system crash"); System.exit(-1); } if(caught[index] == false) { caught[index] = true; totalCaught++; } }
2
protected void padTabRun(int tabPlacement, int start, int end, int max) { Rectangle lastRect = rects[end]; if (tabPlacement == TOP || tabPlacement == BOTTOM) { int runWidth = (lastRect.x + lastRect.width) - rects[start].x; int deltaWidth = max - (lastRect.x + last...
6
private JPanel buildTop() { JPanel panel = new JPanel(); panel.setLayout(gl); JLabel reportLabel = new JLabel("Duplicate Report Folder:"); gc.gridx = 0; gc.gridy = 0; gl.setConstraints(reportLabel, gc); panel.add(reportLabel); reportFolder = new JTextField("C:\\report\\",60); gc.gri...
7
public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pessoa other = (Pessoa) obj; if (matricula == null) { if (other.matricula != null) return false; } else if (!matricula.equals(other.matricula)) return false; return true...
5
public Deck(Graphics g) { String cardName = ""; for (int i = 0; i < suitArray.length; i++) { for (int j = 0; j < valueArray.length; j++) { Card card = new Card(valueArray[j],suitArray[i]); if (valueArray[j] == 1) { cardName = "A" + suitArray[i]; } else if (valueArray[j] == 11) {...
7
@Override public boolean doMove() { int curIndex = curGb.readMemory(curGb.pokemon.fightCurMoveNumAddress); //System.out.println("current move index "+curIndex+", goal position is "+goalIndex); int stepsDown = (goalIndex + numOwnMoves - curIndex) % numOwnMoves; int stepsUp = (curIndex + numOwnMoves - goalIndex...
4
protected static double convertDist( double value, DistType from, DistType to ) { //first convert to nautical miles if( from == DistType.KILO ) value *= 0.539957; else if( from == DistType.MILES ) value *= 0.868976; //now convert to the to type if( to == DistType.KILO ) value *= 1.852; else if...
4
public static ScoreManagerSingleton getInstance() { return ourInstance; }
0
@Override public String execute(SessionRequestContent request) throws ServletLogicException { String page = ConfigurationManager.getProperty("path.page.order"); try { Criteria criteria = new Criteria(); Order order = (Order) request.getSessionAttribute(JSP_CURRENT_ORDER); ...
3
public Collection<AbstractClassPathLocation> findBelow(URI toplevel) { final Collection<AbstractClassPathLocation> rval = new ArrayList<AbstractClassPathLocation>(); final File startPoint = new File(toplevel); // First, check if the entry represents a multi-plugin (in that case we don't add ...
8
public void newInput() { if (!running) { running = true; if (moveInput()) { YSPL.world.getWorldFrame().getGUI().step(); } running = false; } }
2
public EnvParams(){ //nothing }
0
private int pushDownMax(int i) { int iBound = queue.size(); E v = queue.get(i); while (true) { int iDown = (i << 1) + 1; E vDown; if (iBound < iDown) { break; } if (iDown == iBound) { iDown = iBound - 1; ...
7
private boolean IsPermutation(int n1, int n2) { char[] n1Chars = Integer.toString(n1).toCharArray(); char[] n2Chars = Integer.toString(n2).toCharArray(); if (n1Chars.length != n2Chars.length) { return false; } for (int i = 0; i < n1Chars.length; i++) { b...
9
private static int[] generate(int size) { int[] ints = new int[size]; for (int i = 0; i < size; i++) { ints[i] = RANDOM.nextInt(); } return ints; }
1
public void auxEliminar( T pElemento, Retorno retorno ) throws ElementoNoExisteException { // Compara el elemento con el valor almacenado en el nodo int resultado = elem.compareTo( pElemento ); if( resultado == 0 ) { // Caso 1: El elemento est� en el nodo actual ...
9
@Override public void report() { final List<String> busiestActors = new ArrayList<>(); int highestCount = 0; for (final Map.Entry<String, Integer> actorYearToMovieCountEntry : actorYearToMovieCount.entrySet()) if (actorYearToMovieCountEntry.getValue() > highestCount) { ...
3
public boolean hasItem(Point p) { if(inventory.size()==0) return false; System.out.println("Clicked on (" + p.getX() + ", " + p.getY()+ ")"); Point topLeft = new Point(IMG_XOFFSET, IMG_YOFFSET); int totalHeight = IMG_YOFFSET + ITEM_HEIGHT * inventory.size(); if(withinBounds(p, topLeft, ITEM_WIDTH, ...
2
@Override public double evaluate(int[][] board) { int max = 0; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++) { max = Math.max(max, board[i][j]); cnt[board[i][j]]++; } } int target = -1; ...
9
int insertKeyRehash(byte val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
9
@Override public String execute(HttpServletRequest request) throws SQLException, ClassNotFoundException { String tableName = request.getParameter("TableName"); System.out.println(tableName); if (tableName != null && tableName != "") { try { Class.forName("org.h...
7
public static void removeCols(JTable paymentTable) { TableColumnModel tcm = paymentTable.getColumnModel(); System.out.println("getColumnCount:" + tcm.getColumnCount()); if (tcm.getColumnCount() == 7) { paymentTable.removeColumn(tcm.getColumn(6)); } if (tcm.getColumn...
3
private boolean updateAfterPlace(TPoint [] coordPts) { boolean rowFilled = false; for (int j = 0; j < coordPts.length; j++) { int checkX = coordPts[j].x; int checkY = coordPts[j].y; widths[checkY] += 1; if (widths[checkY] == width) rowFilled = true; if (heights[checkX] < checkY + ...
6
public void setAbsoluteVolume(float volume) { for(int i = 0; i < playList.size(); i++) { GameSong gs = playList.get(i); if(gs != null) { gs.setVolume(volume); } } }
2
@Override public void retirada(BigDecimal valor) { switch(status) { case Platinum: saldo = saldo.subtract(valor); if(saldo.compareTo(new BigDecimal("100000.0")) == -1) { status = Categorias.Gold; } break; case Gold: saldo = saldo.subtract(valor); if(saldo.compareTo(new BigDecimal("25000.0")...
5
private void bubbleDown(int pos) { int c1Pos = 2*pos + 1; int c2Pos = 2*pos + 2; int maxPos = c1Pos; if(c1Pos <= len - 1) { if(c2Pos <= len - 1) { if(heap[c1Pos] < heap[c2Pos]) maxPos = c2Pos; } if(heap[maxPos] > heap[pos]) { ...
4
protected void drawDays() { Calendar tmpCalendar = (Calendar) calendar.clone(); int firstDayOfWeek = tmpCalendar.getFirstDayOfWeek(); tmpCalendar.set(Calendar.DAY_OF_MONTH, 1); int firstDay = tmpCalendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeek; if (firstDay < 0) { firstDay += 7; } int i; fo...
7
private String getMD5Hash(String password){ try { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] messageDigest = md.digest(password.getBytes()); BigInteger number = new BigInteger(1, messageDigest); String hashtext = number.toString(16); whil...
2
public Controller(Grid lagrille,List<Integer[]> lesPersonnes, ChartLine chartline) { /* * STEP 1 : Definition de la grille */ drawArea = new DrawAreaUI(); this.grid = lagrille; drawArea.setGridUi(new GridUI(grid)); drawArea.paintGrid(); /* * STEP 2 : Definition des personnes */ this.person...
8
public static void getPathHeuristics(int[] start,int[] goal,int obj[]){ //System.out.println("Score goal :"+score[goal[0]][goal[1]][0]+" "+score[goal[0]][goal[1]][1]); if(finiteStateMachine.value==null){ finiteStateMachine.value = new int[10][10]; for (int i = 0; i < size; i++) ...
8
private int findNoneZero(int n, int k) { int[] arr = new int[10]; int index = 0; for (int i = 0; i < 10; i++) { if (i == k) continue; arr[index] = i; index++; } ArrayList<Integer> nineBase = getNineInvertedDigits(n); in...
3
@Override public void endElement(String uri, String localName, String qName) throws SAXException{ switch (qName){ case "plane": planes.add(plane); break; case "model": ...
9
public Bear(boolean randomAge, Field field, Location location) { super(field, location); if(randomAge) { setAge(getRandom().nextInt(MAX_AGE)); setFoodLevel(getRandom().nextInt(RABBIT_FOOD_VALUE + FOX_FOOD_VALUE)); } else{ setAge(0); s...
1
public boolean isEmpty() { for (ItemStack item : this.items) { if (item != null && item.getType() != Material.AIR) { return false; } } return true; }
3
public static int gMin(ArrayList<node> list){ int min = (list.get(0)).frequency; int index = 0; for(int i=1; i<list.size(); i++){ if((list.get(i)).frequency < min){ min = (list.get(i)).frequency; index=i; } } return index; }
2