text
stringlengths
14
410k
label
int32
0
9
@Override public void reduce(Text key, Iterable<Text> values, Context context) throws IOException { String[] arr; float num1 = -1; float num2 = -1; float f; synchronized (this) { if (null == AIDReducer.fs) { AIDReducer.fs = FileSystem.get(context.getConfiguration()); } ...
8
public String enkodeRC4(String result) { try { String text2Encrypt; byte[] ciphertext1; ab.system.libraries.security.ABSecurity.ControllEncRC4Engine s1 = new ab.system.libraries.security.ABSecurity.ControllEncRC4Engine(); text2Encrypt = result; ...
1
public boolean shipInBounds(Ship ship) { for(int x = ship.x; x < ship.x+ship.xSize; x++) for(int y = ship.y; y < ship.y+ship.ySize; y++) if(!isTile(x,y)) return false; return true; }
3
private static void mergeSort(WoodInterface[] src, WoodInterface[] dest, int low, int high, int off) { int length = high - low; // Insertion sort on smallest arrays if (length < INSERTIONSORT_THRESHOLD) { for (int i = low; i < high; i++) for (int j = i; j > low && (dest[j - 1]).compareTo(dest[j]....
9
public String toString(Collection<State> states, String[] alphabet, State starting) { int maxCellLen = 0; for (State state : states) { if (state.name().length() > maxCellLen) { maxCellLen = state.name().length(); } List<String> eachStateMovesList = state.movesStringList(); for (String eachMove : ...
7
public void completeAll() { do { completeStep(); } while (step != FINISHED); }
1
public Server(int port, String locationIP) { ip = locationIP; try { serverS = new ServerSocket(port); } catch (IOException e) { e.printStackTrace(); } }
1
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int nCase = Integer.parseInt(in.readLine().trim()); for (int t = 0; t < nCase; t++) { in.readLine(); if (t != 0) out.append("\n...
9
public boolean jsFunction_waitEndProgress(int timeout) { deprecated(); int curr = 0; if(timeout == 0) timeout = 10000; while(JSBotUtils.hourGlass) { if(curr > timeout) return false; Sleep(25); curr += 25; } return true; }
3
public void initCommands() { LOGGER.debug("method initCommands starting..."); // 1. Initialize the standard commands exitCommand = propertiesLoader.loadProperty(Constants.MAIN_EXIT_COMMAND); helpCommand = propertiesLoader.loadProperty(Constants.MAIN_HELP_COMMAND); commands = new HashMap<String, Command>(); ...
1
private String getFileToOpen() { JFileChooser projectFC = new JFileChooser(); int validPath = projectFC.showOpenDialog(myCP); if (validPath == JFileChooser.ERROR_OPTION || validPath == JFileChooser.CANCEL_OPTION) { return null; } else { return projectFC.getSelectedFile().toString(); } ...
2
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(...
1
public void mousePressed(MouseEvent e) { if(Global.isRunning) { return; } // block mouse input while simulating if(e.getButton() == MouseEvent.BUTTON1) { // translate the view shiftStartPoint = e.getPoint(); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } else if(e.getButton() == MouseEvent.BUT...
4
@Override public int hashCode() { int hash = 5; hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 97 * hash + (this.supportedTypes != null ? this.supportedTypes.hashCode() : 0); hash = 97 * hash + (this.required ? 1 : 0); hash = 97 * hash + (this.notNu...
5
@Override public String toString() { // Alignment not performed if (score == null) return ""; char matching[] = new char[alignmentA.length]; for (int i = 0; i < alignmentA.length; i++) { if ((alignmentA[i] == ' ') || (alignmentB[i] == ' ') || (alignmentA[i] == '-') || (alignmentB[i] == '-')) matching[i] =...
7
private static boolean isAllDataValid(TreeMap<Float, float[]> value) { for (float[] f : value.values()) { for (float f1 : f) { if (f1 != f1) { return false; } } } return true; }
3
public int size() { return N; }
0
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed int filaseleccionada = tablaRegistrar.getSelectedRow(); if(filaseleccionada>=0) { if(JOptionPane.showConfirmDialog(null, "Esa seguro de eliminar")==0){ ...
2
@Override public String getJarName() { return jarName; }
0
public Map<Integer, List<String>> getFolderContentsInfo(String folderName) { Map<Integer, List<String>> map = new HashMap<Integer, List<String>>(); ArrayList<String> result = new ArrayList<String>(); //Folder root = session.getRootFolder(); Folder root = null; if (!folderName.eq...
4
public List<Integer> verifyVotes(List<Integer> u_votes, int user_id){ List<Integer> accepted=new LinkedList<Integer>(); Iterator<Integer> it=u_votes.listIterator(); while(it.hasNext()){ Integer i=it.next(); if(!tempCandidates.contains(new Candidate("","",i))){ continue; } if(votes.get(user_id).con...
5
@Override public void componentMoved(ComponentEvent e) { }
0
@Override public void removerUsuario(){ if ( this.num_usuarios == 0 ) System.out.println("\nNão existem " + "usuários."); else{ System.out.println("\nQual dos usuários você gostaria de remover? " + "[ 1 - " + this.num_usuarios + " ]" ); int...
9
@Override public void execute(CommandSender sender, String worldName, List<String> args) { this.sender = sender; if (worldName == null) { error("No world given."); reply("Usage: /gworld setinventorygroup <worldname> <groupname>"); } else if (!hasWorld(worldName)) { reply("World not found: " + worldNa...
3
public ConnectionInfo getConnectionInfo() { return connectionInfo; }
0
private String toMatrixString(int[][] counts, int[] clusterTotals, Instances inst) throws Exception { StringBuffer ms = new StringBuffer(); int maxval = 0; for (int i = 0; i < m_numClusters; i++) { for (int j = 0; j < counts[i].length; j...
8
public static void main(String args[]) { Scanner s = new Scanner(System.in); int N, i; System.out.println("Enter value of N"); N = s.nextInt(); int array[] = new int[N]; System.out.println("Enter " + N + " Elements"); for (i = 0; i < N; i++) array[i] = s.nextInt(); sorter(array); System.out.println...
2
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof DefaultHighLowDataset)) { return false; } DefaultHighLowDataset that = (DefaultHighLowDataset) obj; if (!this.seriesKey.equals(that.seriesKey)) { ...
9
private ConfigurationAreaChangeInformation[] parseConfigurationChanges() throws SAXException, InterruptedException { final List<ConfigurationAreaChangeInformation> areaChangeInformations = new LinkedList<ConfigurationAreaChangeInformation>(); while(_xmlStream.matchStartElement("konfigurationsAenderung")) { // ...
8
public int compareTo(Individual arg) { // Compare by class name first: String first = getClass().getSimpleName(); String argFirst = arg.getClass().getSimpleName(); int firstCompare = first.compareTo(argFirst); if (firstCompare != 0) return firstCompare; if (name != null && arg.name != null) { int seco...
6
private void handleKeys(int delta) { Player.p.setSpeed(speed); if(rotateRight){ Player.p.rotate(delta* 0.1,0); } if(rotateLeft){ Player.p.rotate(delta* -0.1,0); } if (forward) { Player.p.moveForward(delta, true); } if (backward) { Player.p.moveForward(delta, false); } if (left) { ...
6
@Override public void valitseVuoroToimepide(){ if (r.nextInt(2) == 0){ valinta = Valinta.LUOLASTO; int r3 = r.nextInt(3); super.setValittuLuolasto(super.peli.getLuolastot().get(r3)); } else { valinta = Valinta.KORTTI; int r3 = r.nextInt(3)+...
8
public boolean select(final int... ids) { if (selected() && !selectedIsOnOf(ids)) { deselect(); } if (selectedIsOnOf(ids)) { return true; } final Item item = ctx.inventory.select().id(ids).shuffle().poll(); if ((ctx.game.tab() == Game.Tab.INVENTORY || ctx.game.tab(Game.Tab.INVENTORY)) && item.click(...
6
public XMLChecker(String args[]) { // Get input from the console String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: "); String checkType = ConsoleTools.getNonEmptyInput("Enter check type (v) validate, (w) well-formed: ").toLowerCase(); while (!(checkType.equals(VALID) || checkType.equa...
3
public void RemoveChannel(String channel) { if(VoiceChannels.contains(channel)) VoiceChannels.remove(channel); if(OpChannels.contains(channel)) OpChannels.remove(channel); }
2
public static void oldOutputANOVAs(GroupedChannels data, List<String> groupNames, List<Integer> conditions, int numChunks, int precision) { // get all condition-group sequences: ArrayList<GroupedChannels.TaggedDataSequence> allTDSs = data .getAllSelectedTDSs(groupNames, conditions); chunkData(allTDSs, ...
5
@SuppressWarnings("deprecation") private void parseCommand(CommandSender sender, String... args) throws EntityEffectError { Player senderPlayer = (sender instanceof Player ? ((Player) sender) : null); Player player = null; PlayableEntityEffect effect = null; ...
6
public int cdl3WhiteSoldiersLookback( ) { return ((( ((( (this.candleSettings[CandleSettingType.ShadowVeryShort.ordinal()].avgPeriod) ) > ( (this.candleSettings[CandleSettingType.BodyShort.ordinal()].avgPeriod) )) ? ( (this.candleSettings[CandleSettingType.ShadowVeryShort.ordinal()].avgPeriod) ) : ( (this.cand...
5
public void run() { Scanner in = new Scanner(System.in); // get first line and get the number of cases to test. int caseCount = Integer.parseInt(in.nextLine()); int loopCount = 0; while (caseCount - loopCount > 0) { String line = in.nextLine(); // extract numbers, this is the node coun...
8
private byte[] getSound(String fileName) { try { URL url = Talker.class.getResource(fileName); AudioInputStream stream = AudioSystem.getAudioInputStream(url); AudioFormat format = stream.getFormat(); if ((format.getEncoding() == AudioFormat.Encoding.ULAW) || (format.getEncoding() == AudioFormat.Enco...
7
private void computePrimeFactors() { long X = N; long i; for (i = 2; i != 1 && i * i < X; i++) { if (X % i == 0) { primes[primeCount++] = i; do { X /= i; } while (X % i == 0); } } if (X !=...
6
public static void isiTabel(){ final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; final String DB_URL = "jdbc:mysql://localhost/perpus"; // Database credentials final String USER = "root"; final String PASS = ""; Connection conn = null; Statement stmt = null; ...
7
public void createNodes(OpdrachtCatalogus opdrachtCatalogus){ top.removeAllChildren(); try { DefaultMutableTreeNode opdracht = null; List<Opdracht> opdrachten = opdrachtCatalogus.getOpdrachten(); for(Opdracht o : opdrachten){ String nameOpdracht = o.toString(); opdracht = new DefaultMutableTre...
4
public static void setupConsoleLogging() { Logger rootLogger = getRootLogger(); consoleHandler.setLevel(Level.ALL); consoleHandler.setFormatter(new Formatter() { private StringBuffer recordBuffer = new StringBuffer(); private DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z"); ...
5
public void sendKeyData() { PlayerManager playerManager = registry.getPlayerManager(); if (playerManager != null) { Player p = registry.getPlayerManager().getCurrentPlayer(); if (p != null) { UDPKeys uk = new UDPKeys( p.getId(), ...
4
void notifyListeners(Object created, Page modified) { for (TreeModelListener l : modelListeners) { if (created != null) { TreeModelEvent e = null; if (created instanceof Name) { e = new TreeModelEvent(this, ((Name)created).getPath()); ...
4
public void setData(int x, int y, int val) { if (x < 0 || y < 0 || x >= w || y >= h) return; data[x + y * w] = (byte) val; }
4
public JavaScriptObject getJsObject() { JavaScriptObject jsObj = JsoHelper.createObject(); if (tag != null) JsoHelper.setAttribute(jsObj, "tag", tag); if (id != null) JsoHelper.setAttribute(jsObj, "id", id); if (cls != null) JsoHelper.setAttribute(jsObj, "cls", cls); if (style != null) JsoHelper.s...
8
private NearbyPlace toNearbyPlace(RequestBean request, SearchLocation location) throws CitysearchException { NearbyPlace nearbyPlace = new NearbyPlace(); String addr = Utils.getLocationString(location.getCity(), location.getState()); nearbyPlace.setStreet(location.getStreet()); ...
7
public static void main(String[] args) throws IOException { StreamTokenizer st = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); while (st.nextToken() != StreamTokenizer.TT_EOF) { int n = (int) st.nval; if (n == 0) System.out.println("NULL"); else { int[] array = new...
7
private void figthButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_figthButtonActionPerformed //Set Rounds from textflield rounds = 0; try { rounds = Integer.parseInt(throwsPerTextField.getText()); } catch (NumberFormatException e) { extraT...
3
public static Point[] generateControls(final int sx, final int sy, final int ex, final int ey, int ctrlSpacing, int ctrlVariance) { final double dist = Math.sqrt((sx - ex) * (sx - ex) + (sy - ey) * (sy - ey)); final double angle = Math.atan2(ey - sy, ex - sx); int ctrlPoints = (int) Math.floor(dist / ctr...
4
public void actionPerformed(ActionEvent ae){ if (ae.getSource() == addEmp){ for (int i = 0; i < 6; i++){ int n = 0; int x = 0; int y = 0; if (i == 0){ n = 5; x = 0; y = 2; newTextField = new JTextField(n); g.anchor = GridBa...
8
private void addAndRemoveButton(boolean justRemove) { boolean added = false; for (Iterator<CButton> it = FileWalker.getInstance().getSetButtons().iterator(); it.hasNext();) { CButton cButton = it.next(); if (cButton == button) { it.remove(); if (justRemove) retu...
7
@Override public void drawSolutionk(Graphics drawingArea, int... arg) { int diameter = arg[2]; int x = arg[0]; int y = arg[1]; int depth = arg[3]; int toDraw = DRAW_ALL; if(arg.length == 5){ toDraw = arg[4]; } if(depth == 0){return;} drawingArea.drawOval(x - diameter/2, y - diameter/2, diam...
6
public void welcome() { while (!finished) { str = ""; int selection = 0; System.out .println("------------------------------------------------------"); System.out .println("Welcome to the new and improved Contact Manager Pro!"); System.out.println("What would you like to do?"); System....
6
public static int wordLadder(String start, String end, Set<String> dict) { if(start == null || end == null) { return -1; } if(dict == null) { return start.equals(end) ? 0 : -1; } LinkedList<String> queue = new LinkedList<>(); Map<String, String>...
9
private String DNS_resolve() { @SuppressWarnings("unchecked") LinkedList<Packet> buf = (LinkedList<Packet>) this.buffer.clone(); Iterator<Packet> itr = buf.iterator(); Pattern p = Pattern.compile("addr (\\d+\\.\\d+\\.\\d+\\.\\d+)"); //procura uma requisição DNS na lista de pacotes recebidos while (itr.has...
3
public void clearmemory(){ for(int i=0;i<65536;i++) memnc[i]=0; }
1
public Pearson(UserPreferences user1, UserPreferences user2) { userId1 = user1.getUserId(); userId2 = user2.getUserId(); intersection(user1, user2); if (itemIds.length == user1.getItemIds().length && itemIds.length == user2.getItemIds().length) { return; } pearson = calculatePearson(); calculateWeights...
2
public void enqueue(E element) { queue.insert(element); }
0
public void render() { for (int c = 0; c < textElements.size(); c++) { UITextElement text = textElements.get(c); text.print(); } for (int c = 0; c < boxElements.size(); c++) { UIBoxElement element = boxElements.get(c); element.draw(); } ...
5
public int getComboBox3 () { if (jComboBox3.getSelectedIndex() == 0) return 10; else if (jComboBox3.getSelectedIndex() == 1) return 50; else if (jComboBox3.getSelectedIndex() == 2) return 100; else if (jComboBox3.getSelectedIndex() == 3) return 250; else if (jComboBox3.getSelec...
6
public String get(int searchID) { if(searchID == 0) throw new IllegalArgumentException("Illegal Key: " + searchID); try { // Execute a query this.stmt = this.conn.prepareStatement("SELECT v FROM api_results WHERE k=?"); this.stmt.setInt(1, searchID); ResultSet rs = this.stmt.executeQuery(); ...
7
public void update() { if (this.parent1 != null) { this.parent1.child = null; } if (this.parent2 != null) { this.parent2.child = null; } if (this.node1 != null) { this.parent1 = this.node1.getPotential(); } if (this.node2 != null) { this.parent2 = this.node2.getPotential(); } if (this.pa...
9
private void rb_insert_fixup(RBNode z) { // makeDotFile(); // com.andreydev.rbtree.RBNode y; RBNode y = nil; while (z.getParrent().getColor() == Color.RED) { if (z.getParrent() == z.getParrent().getParrent().getLeft()) { y = z.getParrent().getParrent().get...
6
public boolean initialiseWithLines(ArrayList<StringBuffer> lines, ProcessingOptions options) throws UnsupportedEncodingException { //remove blank rows at the bottom boolean done = false; int i; for(i = lines.size() - 1; !done; i--){ StringBuffer row = lines.get(i); if(!StringUtils.isBlank(row.toString())...
8
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { return new SAXAnnotationAdapter(getContentHandler(), "annotation", visible ? 1 : -1, null, desc); }
1
protected OgexCameraNode toCameraNode( DataStructure ds, Map<BaseStructure, Object> index ) { OgexCameraNode result = (OgexCameraNode)index.get(ds); if( result != null ) { return result; } result = new OgexCameraNode(); index.put(ds, result); configureNode(res...
6
public static void main(String[] _args) { final int NUMELEMENTS = 40; double[] inArray = new double[NUMELEMENTS]; double[] outArray = new double[NUMELEMENTS]; // initialize inArray for (int i=0; i<NUMELEMENTS; i++) { inArray[i] = (double)i; } String sourceFileName = "SquaresDbl.hsail"; String squ...
8
public boolean canBuyDevCard(){ if(resources.getOre()>0&&resources.getSheep()>0&&resources.getWheat()>0){ return true; } return false; }
3
public void handleBattleMenuInput(){ boolean safeChoice = false; String userChoice; while(!safeChoice){ System.out.println("Command: "); userChoice = input.nextLine(); if(userChoice.compareTo("Melee") == 0 || userChoice.compareTo("melee") == 0){ Battle battle = new Battle(); safeChoice =...
5
public static String intelligentCapitalize(String pText) { boolean lDoCap = false; final StringTokenizer lST = new StringTokenizer(pText, ".- ", true); final StringBuffer lSB = new StringBuffer(50); while(lST.hasMoreTokens()) { String lWord = lST.nextToken(); if(lWord.equals(".") || l...
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (this.getClass() != obj.getClass() || obj == null) return false; Edge e = (Edge)obj; return (n1 == e.n1) && (n2 == e.n2) || (n2 == e.n1) && (n1 == e.n2); // TODO should i support multigraphs? beacuse currently i excl...
6
protected void cellDrawn(mxICanvas canvas, mxCellState state, Object element, Object labelElement) { if (element instanceof Element) { String link = getLinkForCell(state.getCell()); if (link != null) { String title = getToolTipForCell(state.getCell()); Element elem = (Element) element; if...
8
public static void gcd2rgb(byte[] gcdPlane, int[] rgbPlane) { for (int i = 0; i < gcdPlane.length; i++) { switch (gcdPlane[i]) { case cORANGE: rgbPlane[i] = Color.ORANGE.getRGB(); break; case cCYAN: rgbPlane[i] = Color.CYAN.getRGB(); break; case cBLUE: rgbPlane[i] = Color.BLU...
9
public void end() { if (position=='B') { position='U'; } else if (position=='I') { position='E'; } }
2
public boolean contains(Tile loc) { HashSet<Tile> tiles = cols.get(loc.getX()); if (tiles != null) { for (Tile t : tiles) { if (t.getY() > loc.getY() || t.getPlane() != loc.getPlane()) continue; byte[] arr = data.get(t); if (loc.getY() - t.getY() < arr.length) { return true; } } } ...
5
public void setOrderNumber(String orderNumber) { this.orderNumber = orderNumber; }
0
public static void setMaxAge(int newMAX_AGE) { MAX_AGE = newMAX_AGE; }
0
public void initializeId() { String string = ""; for (HardwareSetAlternative hardwareSetAlternative : hardwareSetAlternatives) string += hardwareSetAlternative.getId(); setId(Utils.getHash(string)); }
1
private int valorMin( Partida partida, EstatPartida estat_partida, int alfa, int beta, EstatCasella estat_casella, int profunditat, int profunditat_maxima, EstatCasella fitxa_jugador ) { Tauler tauler = partida.getTauler(); if ( profunditat == profunditat_maxima || estat_partida == EstatPart...
8
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof UnorderedPair)) return false; final UnorderedPair pair = (UnorderedPair) o; return (((first == null ? pair.first == null : first.equals(pair.first)) && (second == null ? pair.second == null : second.equals(pair.second))) ...
9
public static ListNode reverseKGroup(ListNode head, int k) { ListNode h = null; ListNode t = null; ListNode lt = null; ListNode p = head; ListNode q = null; ListNode hres = null; int n = k; while (null != p) { t = p; h = null; while (null != p && n > 0) { ...
9
public String getIntegralByUID(Statement statement,String UID)//根据用户名获取积分 { String result = null; sql = "select integral from Users where UID = '" + UID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("integral"); } } catch (SQLException e) ...
2
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed if (txtMemberID.getText() != "") { btnEdit.setEnabled(true); try { ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from members where MemberID='" + ...
5
public void draw(Graphics2D g2){ if(getyOffset()>0){ g2.drawImage(Tile.dropDownBackground,0,getyOffset()-2*getWidth(),KarpfenGame.WIDTH, getWidth()*2,null); for(int i=0;i<Skill.getNr();i++){ int addition=0; if(i==enabledSkill){ g2.drawImage(Tile.dropDownSelected,i*...
8
public Texture loadTexture(String path){ Texture tex = null; try { tex = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(path)); } catch (IOException e) { e.printStackTrace(); } return tex; }
1
public void edit() throws Exception { List<File> l = new ArrayList<File>(); for (Params p : model.getParams()) { if (p.getFile() != null) { l.add(new File(p.getFile())); } } if (l.isEmpty()) { throw new ComponentException("No parameter ...
5
static void drawTopLine(Graphics2D ctx, Game game, World world) { if (topLine == null) { topLine = new BufferedImage(1200, 66, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = topLine.createGraphics(); g2d.setPaint(textures.toTexture(15 * 12, 2)); g2d.fillRect(0, 0...
6
public void selectAll() { expandMenu(); for(int i = 0; i < methodTree.getRowCount(); i++) { TreePath path = methodTree.getPathForRow(i); if(path == null) return; DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) path.getLastPathComponent(); if(tre...
5
protected void updatePowerUps() { for (int i = 0; i < powerUpList.size(); i++) { if (powerUpList.get(i).isExpired()) { powerUpList.remove(i); } } for (PowerUp p : powerUpList) { p.move(); p.bounceOffWalls(); p.score(pad...
4
public int getAlignedChar(int iMinusOne,boolean preferHigherIndices) { // internally to this package, strings are indexed 1...N, so // we need to convert from the usual 0...N-1 Java convention int i = iMinusOne+1; int bestJ = -1; double bestScore = -Double.MAX_VALUE; ...
5
private void buildPorts() { int i=0, portIndex=0; // Compteur, numero des tuiles ports. i = 0; for (int j: portIndexes) { // Pour chaque tuile mer. waterTile[i] = (WaterTile) grid[j]; // Ajouter la tuile mer au tableau des tuiles mers. i++; // Incremente le compteur de tuiles mers. } for (i = 0 ; ...
9
public void printModel(Model pm,String sdfilename, boolean autostart, int line) throws InterruptedException { if (state.connecting) { cons.appendText("Still connecting. Please wait until connecting is established."); return; } if (!state.connected) { cons.appendText("Not connected"); return; } sta...
8
public boolean fetchAll(InputStream is) throws IOException { //Decoder dec = new Decoder(sr,0,msglen); while(true) { int asrlen = objectLen(); if(DEBUG)System.out.println("Object size="+asrlen+"; Buffer size="+data.length+"; Current size="+length); if((asrlen>0) && (asrlen>data.length)){ System.out.pri...
9
@Override public Channel clone() { Channel newChannel = new Channel(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { newChannel.setPixel(i, j, this.getPixel(i, j)); } } return newChannel; }
2
public static void printMat(Double[][] mat) throws IOException { String matrix = "{"; for (int i = 0; i < mat.length; i++) { matrix += "{"; for (int j = 0; j < mat[i].length; j++) { if (j != mat[i].length - 1) matrix += mat[i][j] + ", "; else matrix += mat[i][j]; } if (i != mat.l...
4
private static void sobelFile(String filename, int numIterations, boolean rle) { System.out.println("Reading image file " + filename); PixImage image = ImageUtils.readTIFFPix(filename); PixImage blurred = image; if (numIterations > 0) { System.out.println("Blurring...
3
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerInteract(PlayerInteractEvent E) { if (E.getClickedBlock() == null || E.getPlayer().getItemInHand() == null) return; if (E.getClickedBlock().getType() == M.conf.PressBlock && E.getAction() == Action.LEFT_CLICK_BLOCK && E.getClickedBlock().ge...
9