text
stringlengths
14
410k
label
int32
0
9
public void setState(State _state) { if(getWidth() > 0 && getHeight() > 0) { getGui().setVisible(false); state = _state; getGui().setVisible(true); }else{ ServerHelper.log(LogType.GUI, "GuiManager: setState wurde vor setBounds aufgerufen"); ...
2
public Object get(int index){ if(index <= 0){ return null; } Node current = head.getNext(); for(int i = 0; i < index; i++){ if(current.getNext() == null){ return null; } current = current.getNext(); } return current.getData(); }
3
public void startupMapHook() { super.startupMapHook(); boolean nodeExport = Tools.safeEquals("node", getResourceString("export_type")); HashMap transcodingHints = null; List selecteds = getController().getSelecteds(); Vector documentsToOpen = new Vector(); ...
9
private ArrayList<Integer> selectPondaratedRandomIndexesFromList(Integer number, List<Kanji> kanjis) { ArrayList<Pair<Double, Kanji>> weighedKanjis = new ArrayList<Pair<Double,Kanji>>(); Double totalWeight = 0.; for(Kanji k : kanjis) { totalWeight += k.getWeight(); weighedKanjis.add(new Pair<Double, Kanj...
5
public void dinTur() { if(loading == 0 && actraiser2 == Consts.KANON) { loading = Consts.KANONLOADING; actraiser2 = Consts.RADAR; kanon[0] = new Vektor2D(Math.cos((double)actraiser/10), Math.sin((double)actraiser/10)); ...
9
@Test public void validationIntegerWithDoubleNegativeTest() { view.getNumberOfPointsTextField().setText("11.6"); view.getNumberOfPointsTextField().getInputVerifier().verify(view.getNumberOfPointsTextField()); assertFalse(view.getDrawButton().isEnabled()); }
0
private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3R_45()) { jj_scanpos = xsp; if (jj_3R_46()) { jj_scanpos = xsp; if (jj_3R_47()) { jj_scanpos = xsp; if (jj_3R_48()) { jj_scanpos = xsp; if (jj_3R_49()) { ...
9
public TreeNode findRecursive(TreeNode root, int n) { TreeNode temp = null; if (root == null) { return null; } if (root.left == null && root.right == null && root.info > n) { return root; } if (root.info < n) { temp = root; findRecursive(root.right, n); } else { temp = root; findRecursiv...
5
private boolean ContainSameDigits(int n1, int n2) { char[] n1String = Integer.toString(n1).toCharArray(); char[] n2String = Integer.toString(n2).toCharArray(); if (n1String.length != n2String.length) { return false; } for (int i = 0; i < n1String.length; i++) { ...
9
public boolean equals(Object o) { // This probably has the same effect as Object.equals, but that may change... if (o instanceof PircBot) { PircBot other = (PircBot) o; return other == this; } return false; }
1
public static int getOptionValueAsInt(String option) { String value = CommandLineUtilities.getOptionValue(option); if (value != null) return Integer.parseInt(value); return -1; }
1
public static ItemDefinition getDefinition(int id) { for (int i = 0; i < 10; i++) if (cache[i].id == id) return cache[i]; cacheIndex = (cacheIndex + 1) % 10; ItemDefinition definition = cache[cacheIndex]; stream.position = streamOffsets[id]; definition.id = id; definition.setDefaults(); definition...
5
public boolean contentEquals(LastFmConfig other) { return nullEquals(getUser(), other.getUser()) && nullEquals(getPollInterval(), other.getPollInterval()) && nullEquals(getApiScheme(), other.getApiScheme()) && nullEquals(getApiBase(), other.getApiBase()) && nullEquals(getApiPath(), other.getApiPath()) ...
5
public static void main(String args[]) { RegExMultiReplace sr = new RegExMultiReplace(args); }
0
protected String getRandomOrderId(String prefix) { String orderId = null; Date date = new Date(); StringBuilder sb = new StringBuilder(); if (prefix != null) { sb.append(prefix); sb.append("_"); } SimpleDateFormat df = new SimpleDateFormat("MMkkmmssSSSS"); sb.append(sequence.getAndIncrement()); sb...
2
@Override public PaginationSupport<T> handle(ResultSet rs) throws SQLException { PaginationSupport<T> ps = new PaginationSupport<T>(); int cur = rsl.getStartPage() * rsl.getPageSize() + 1; // 计算第一行行号 boolean atLast = false; // 游标是否在最后一行后面了(结果集是否被取完) // 光标放置到第一行之前 if (cur > 1) { if (!rs.absolute(cur ...
9
public void handle(HotUserCrawlingEvent event) { //long timeMilli = System.currentTimeMillis(); try { List<User> users = SinaWeibo.getInstance().getHotUsers(); List<com.julu.weibouser.model.User> juluUsers = new ArrayList<com.julu.weibouser.model.User>(); for (User u...
8
String guessFields() { StringBuilder sb = new StringBuilder(); Field fields[] = getClass().getFields(); for (Field f : fields) sb.append(f.getName() + FIELD_NAME_SEPARATOR); // Remove last ';' if (sb.charAt(sb.length() - 1) == FIELD_NAME_SEPARATOR) sb.deleteCharAt(sb.length() - 1); return sb.toString(...
2
private PositionGetter makePositionGetter(final GenericOffice<?, ?, ?, ?, ?> computer) { return new PositionGetter() { @Override public Point getWorksheetPosition() { return computer.worksheet.getAccessLocation(); } @Override public Po...
5
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg....
7
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 fe...
7
public boolean hasPendingMessage() { return pendingMessage != null; }
0
public void addName(int i, String s) { this.names.add(i, s); ((DefaultListModel) Outliner.findReplace.FIND_REPLACE_LIST.getModel()).insertElementAt(s,i); }
0
public User build() { try { User record = new User(); record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]); record.favorite_number = fieldSetFlags()[1] ? this.favorite_number : (java.lang.Integer) defaultValue(fields()[1]); record.favori...
4
public static Object newInstance(Class<?> cl, Object[] args, Class<?>... constructParameterType) { Object obj = null; try { Constructor<?> constructor = cl .getConstructor(constructParameterType); obj = constructor.newInstance(args); } catch (Exception e) { return null; } return obj; }
4
public Number addNumbers(Number a, Number b) throws NumberClassNotFoundException { Number sum = null; if (a instanceof Double && b instanceof Double) { sum = new Double(roundDouble(a.doubleValue() + b.doubleValue())); // trimNumber(sum); } else if (a instanceof Integer && b ...
8
protected void paintComponent(Graphics g) { super.paintComponent(g); //If Product Text box is blank if(blankText){ g.setColor(Color.RED); g.drawString("Please enter a product",282,80); g.setColor(Color.black); blankText = false; } //If Email id Text box is blank if(emailFlag){ ...
8
@Test public void testPageIterator() throws IOException, TesseractException { ImageAnalyzerFactory factory = TestContext.getImageAnaylzerFactory(); try { ImageAnalyzer analyzer = TestContext.getImageAnalyzer(factory, TestContext.poetryImageFile); LayoutIterator i...
2
private static int calculate_num_channels( byte[] module_header ) { int num_channels; switch( ( module_header[ 1082 ] << 8 ) | module_header[ 1083 ] ) { case 0x4b2e: /* M.K. */ case 0x4b21: /* M!K! */ case 0x542e: /* N.T. */ case 0x5434: /* FLT4 */ num_channels = 4; break; case 0x484e: /* xCH...
6
final public CycList genericSentence(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycObject pred = null; CycList args = null; pred = predicate(false); args = argumentList(false); args.add(0, pred); eof(requireEOF); ...
1
public static void main(String[] args) throws UnsupportedAudioFileException { try { File file = new File("/Users/rawanfarwana/Documents/workspace/Test/bin/extractingFromMp3/test.wav"); AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file); AudioFormat format = audioInputStream.ge...
5
public Item dequeue() { if (isEmpty()) throw new NoSuchElementException("Queue underflow"); Item item = first.item; first = first.next; N--; if (isEmpty()) last = null; // to avoid loitering return item; }
2
public void shuffle() { for (int i = 0; i < deck.length; i++) { // Generate an index randomly int index = (int) (Math.random() * deck.length); int temp = deck[i]; deck[i] = deck[index]; deck[index] = temp; } log.debug("[" + Deck.class.getName() + "] shuffle() method"); }
1
public static boolean configExists() { File file = new File(CONFIG_FILE); if (file.exists()) return true; else return false; }
1
int count_bit_short( int [] ix, int start, int end, int table ) { int i, sum; int x,y; if(table < 0 || table > 34) return 0; sum = 0; int ylen = this.ylen[table]; int linbits = this.linbits[table]; for ( int line = start; line < end; line += 2 ) { for ( int window = 0; window < ...
9
public static ArrayList<Category> showAll() { ArrayList<Category> category = new ArrayList<Category>(); Database db = dbconnect(); try { db.prepare("SELECT * FROM problem_category ORDER BY CategoryID"); ResultSet rs = db.executeQuery(); while(rs.next()) { category.add(CategoryObjec...
2
public Enemy(int d, int spacing){ generalDirection = d; path = d; //For ammunition tracking enemyID = spacing; goldValue += waveNumber*2; int x = 0; int y = 0; if (path == BLUE){ x = 50; y = 300; velocityX = -speed; direction = LEFT; enemyColor = Color.BLUE; debuffedC...
2
public static List<Laureate> filterByYear(List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<Laureate>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner.getYear())) { ...
2
public Builder location(String location) { this.location = location; return this; }
0
@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; } Us...
6
public static double[] toLab(final int red, final int green, final int blue, final double chromaWeight) { int ir = red ; if (ir < 0) ir += 1 << 8; int ig = green; if (ig < 0) ig += 1 << 8; int ib = blue ; if (ib < 0) ib += 1 << 8; double r = ir / 255.; r = r <= 0.4045 ? r / 12.92 ...
9
@Override public String toString() { StringBuilder b = new StringBuilder(); for(TLNode stat : statements) { b.append(stat).append("\n"); } if(returnStatement != null) { b.append("return ").append(returnStatement).append("\n"); } return b.toString(); }
2
public static void encodeMessage(final Message message,final OutputStream out) throws IOException { // Wrap a DataOutputStream for convenience. DataOutputStream dout = new DataOutputStream(out); // Check to see if there's more to encode. if (message.getLength() >= 1) { switch (message.getType()) { c...
9
private void processRectangle(RdpPacket_Localised data, RectangleOrder rect, int present, boolean delta) { if ((present & 0x01) != 0) rect.setX(setCoordinate(data, rect.getX(), delta)); if ((present & 0x02) != 0) rect.setY(setCoordinate(data, rect.getY(), delta)); ...
7
@Override public void show() { setCanceled(false); setMaximum(1); super.show(); }
0
public Date genernateSystemTime() { Timestamp systemTime = null; Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connection = dataSource.getConnection(); preparedStatement = connection.prepareStatement("select current_timestamp() "); result...
7
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 JPanel createLastUsedSettingsPanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createTitledBorder("Zuletzt verwendete Einstellungen")); panel.setLayout(new BorderLayout()); _lastUsedSettingsTable.setRowSelectionAllowed(true); _lastUsedSettingsTable.setSelectionMode(ListSelectionMod...
9
public static void writeFile(String content, String fileName, String destEncoding) throws FileNotFoundException, IOException { File file = null; try { file = new File(fileName); if (!file.exists()) { if (file.createNewFile() == false) { throw new IOException("create file '" + fileName + "' failure.")...
8
public Scheduler parse(String str) { Matcher m = msh.matcher(str); if (m.find()) { TimeUnit t = null; if (str.contains("m")) t = TimeUnit.MINUTES; if (str.contains("s")) t = TimeUnit.SECONDS; if (str.contains("h")) t = TimeUnit.HOURS; return ne...
5
@Override public void mousePressed(MouseEvent e) { if (!isEnabled()) click(true); else { if (e.getButton() == MouseEvent.BUTTON1) leftClick = true; if (e.getButton() == MouseEvent.BUTTON3) { if (!leftClick) { if (isFlagged) { mf.updateMineCount(1); setText(""); } else { ...
7
@Override public void deserialize(Buffer buf) { super.deserialize(buf); spellId = buf.readShort(); if (spellId < 0) throw new RuntimeException("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0"); spellLevel = buf.readB...
3
void setScoreText(String text) { if (scoreText != null) { removeChild(scoreText); } scoreText = new TextComponent(text, 24); scoreText.setTextColor(0xffffffff); this.addChild(scoreText, getWidth()/2 - scoreText.getWidth()/2, startGame.getTop() - scoreText.getHeight()-...
1
private void rightRotate(RBNode x) { RBNode y = x.getLeftChild(); x.setLeftChild(y.getRightChild()); if (y.hasRightChild()) { y.getRightChild().setParent(x); } y.setParent(x.getParent()); if (!x.hasParent()) { setRoot(y); } else if (x ==...
3
public void damage() { if(getState() == NORMAL) { setState(BROKEN); } else if(getState() == BROKEN) { remove(); } }
2
public ArrayList<MassAttractObject3D> getSystem() { return system; }
0
public Object run() { int[] table = new int[size]; if (option == UNSORTED) table = Random.randArrayInt(size, 0, 100); if (option == SORTED) Arrays.fill(table, 1); if (printResult) System.out.println("Table before sort \n" + Arrays.toString(table)); // the main algorithm sw.start(); QuickSort....
4
@Override public void onLogMessage(Level logLevel, int indentLevel, String message, Object... objects) { if (null == logger || !logger.isLoggable(logLevel)) return; StringBuilder sb = new StringBuilder(); for (int i = 0; i < indentLevel; i++) { sb.append(AppConst.IDENTATOR); } String msg = ""; if (nul...
9
public void showColorAndPositionKmean(int K, boolean useNativeColors) { try { Kmean kmean; float mult = 255.0f / 2 / (float) (portableMap.getHeight()*portableMap.getHeight() + portableMap.getWidth()*portableMap.getWidth()); if(useNativeColors) kmean = new Kmean(portableMap.getHeight(), portableMap.getWid...
4
@Override public String getRawData() { if (!parser.isStoreRawDataToDataSet()) { // option needs to be set for this functionality // throw an exception throw new FPInvalidUsageException("Parser.isStoreRawDataToDataSet(true) must be set before using getRawData()"); ...
2
public static ArrayList<String> getHashMap(HashMap<String, String> hm) { ArrayList<String> a = new ArrayList<String>(); Set s = hm.entrySet(); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry m = (Map.Entry) it.next(); a.add(m.getKey() + "\t" + m.getValue()); } return a; }
1
@Test public void testNum2wordWithConsecutiveNoMatch() { List<String> wordList = _phonewordFinder.num2words("35693710"); assertEquals(0, wordList.size()); }
0
public void mouseClicked(java.awt.event.MouseEvent evt) { if (evt.getSource() == jTablePedidos) { PanelPedidos.this.jTablePedidosMouseClicked(evt); } else if (evt.getSource() == jTextField1) { PanelPedidos.this.jTextField1MouseClicked(evt); } }
2
final public void Program_return_declaration() throws ParseException { /*@bgen(jjtree) Program_return_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTPROGRAM_RETURN_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1))...
8
public boolean isGameOver() { boolean gameOver = false; ArrayList<Player> playersToRemove = new ArrayList<Player>(); //Make a new list of players, without those who can not do a move for (Player player : players) { if (!canDoMove(player)) { playersToRemove.add(player); //TODO Debug Line. System....
5
protected void prepare_sample_reading(Header header, int allocation, //float[][] groupingtable, int channel, float[] factor, int[] codelength, float[] c, float[] d) { int channel_bitrate = header.bitra...
7
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 fe...
6
private int countBackToBacks(List<Pairing> pairs) { int backs = 0; for (int x = 0; x < pairs.size() - 1; ++x) { Pairing a = pairs.get(x); Pairing b = pairs.get(x + 1); if (a.contestantA == b.contestantA || a.contestantA == b.contestantB || a.contestantB == b.contestantA || a.contestantB == b.contestantB) {...
5
public static void recall(DMatrix[] pointset) { for(int i = 0; i < pointset.length; i++){ for(int j = 0; j < pointset[i].samplenum(); j++){ } } }
2
protected int diff_commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. int text1_length = text1.length(); int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; } // Truncate th...
9
void createCanvas(Composite parent) { int style = SWT.NO_BACKGROUND; if (dbItem.getSelection()) style |= SWT.DOUBLE_BUFFERED; canvas = new Canvas(parent, style); canvas.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { GC gc = event.gc; Rectangle rect = canvas.getClientArea(); ...
6
public int playGame() { Move m; int winner, turn; long s_time; moves0 = 0; moves1 = 0; time0 = 0; time1 = 0; // Show the initial status of the board. board.showBoard(); winner = -1; turn = 0; while (winner == -1) { // Roll the dice. d.toss(); out_stream.println("The Toss: " + d....
4
public void clearNodes() { for ( Edge<T> e : edges) e.visited=false; for ( Vertex<T> v : vetexes) v.visited=false; }
2
private void resolveConflicts(ArrayList<Person> nextPersonnes) { int i = 0; for (Person p : nextPersonnes) { int j = 0; for (Person p2 : nextPersonnes) { if(p.getLine() == p2.getLine() && p.getColonne() == p2.getColonne() && p.getId() != p2.getId()) { //System.out.println("conflit"); ...
6
public Object nextEntity(char ampersand) throws JSONException { StringBuffer sb = new StringBuffer(); for (; ; ) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { ...
5
private void setFields() { if(thisCourse.getInstructor() != null) instructor = new JLabel("Instructor: " + thisCourse.getInstructor()); else instructor = new JLabel("Instructor: N/A"); dayList = ""; // if(thisCourse.getDays() != null) { for (Day d:thisCourse.getDays(...
5
public final void initWorld() { //create wall and gem objects Wall wall; Gem gem; //variables used to keep track of coordinates during loop int x = 0; int y = 0; for (int i = 0; i < level.length(); i++) { //Grab the item i...
7
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } Player player = (Player) sender; if (args.length > 0 && args[0].equalsIgnoreCase("*"))...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MyCrAftAPI other = (MyCrAftAPI) obj; if (callExecutor == null) { if (other.callExecutor != null) return false; } else if (!callExecutor....
9
private void drawTableCards(Graphics g) { for(int i = 0; i < cards.length; i++){ drawRowOfCards(g, i); } }
1
public static boolean shouldTrackViewportWidth(Component comp) { Container parent = comp.getParent(); if (parent instanceof JViewport) { Dimension available = parent.getSize(); Dimension prefSize = comp.getPreferredSize(); return prefSize.width < available.width; } return false; }
1
static public BigDecimal calculateMinedPrice(Class<? extends Item> genericItem) { BigDecimal price = BigDecimal.ZERO; Item item = getItem(genericItem); //System.out.println(item.toString() + " is mijnbaar met " + item.getRequiredMiningPickaxe()); //price = price.add(calculatePrice(ite...
4
private static void loadServer(){ try { FileInputStream fis = new FileInputStream(serverSave); ObjectInputStream ois = new ObjectInputStream(fis); DataServer temp = (DataServer)ois.readObject(); if(temp != null){ server = temp; System.out.println("server loaded"); } } catc...
4
public void prayed(final Player player, final AGPlayer agp, final God god, final Praying praying, Shrine s) { agp.setPraying(true); agp.getPrayed().put(s, System.currentTimeMillis()); if(!agp.getFoundShrines().contains(s)) { Messenger.sendMessage(player, Message.foundShrine); agp.getFoundShrines().add...
5
private void se_remplis(){ if (this.curent.coord != this.forum.coord){ this.rapproche(this.forum); } else { if (this.takeForum()){} // s'il est sur une case "Forum" , alors il se charge de 1. else { // Sinon il regarde sur les cases adjacentes pour voir s'il n'y a pas un Forum if (this.forum ==n...
3
public void calcularSolucion() { int n = cartas.length; for ( int i = 0; i < n; i++ ) { cache[i][i] = cartas[i]; jugadas[i][i].desdeIzquierda( 1 ); } for ( int columna = 1; columna < n; columna++ ) { for ( int diagonal = 0; diagonal < n - columna; diagonal++ ) { int i = diagonal; int j = colum...
9
private static String removeSpaces(String input) { char[] withSpace = input.toCharArray(); input = ""; for(char element : withSpace) { if(element != ' ') { input += element; } } return input; }
2
@Override public void happen(int rollResult) { // For testing purposes only int i = 0; Boolean greaterThan2 = true; while (i < 4){ if (rollResult < 2 ){ greaterThan2 = false; switch (i){ case 0: Game.getInstance().getCurrentCharacter().decrementKnowledge(); break; case 1: Game.getInstance(...
7
protected String _render(String tpl) { recursion ++ ; if ( recursion > MAX_RECURSIVITY ) { throw new UnsupportedOperationException("Maximum recursivity reached") ; } int len = tpl.length(), i; String result = "", tag = null; char character; for (i = 0; i < len; i++) { character = tpl.charAt(i);...
7
private void save() { JFileChooser fc = new JFileChooser(); File currentDir = new File("."); File defaultFile = new File(currentDir, "Untitled." + FILE_EXTENSION); boolean saving = true; while(saving) { fc.setSelectedFile(defaultFile); int result ...
7
public static void PlayerCreateRandomInventory(Player player, String PlayerName, String PlayerRank, List<?> PerkList) { // loop thru all perks and prepeare / give items to player for (int i = 0; i < PerkList.size(); i++) { // item description - get all lines String Line1 = GChub.getPlugin().getMainConf...
5
private static void createAndShowGUI() { // Logger.global. if ( TLanguageNames.runtime.isAvailable() ) { Logger.global.finer( "languages found" ) ; } else { Logger.global.warning( "languages NOT found" ) ; } // load icons, initialize other resources and load theme GUIGl...
7
@Override public double dotProduct(Vector v) { verifyMatchingDimensions(v); if (v instanceof DenseVector) { @SuppressWarnings("unchecked") // checked w. instanceof double[] vValues = ((DenseVector)v).mValues; double sum = 0.0; int[] keys1 = mKeys; ...
8
public boolean removeCoffer(Chest chest){ if(chest==null) return false; if(!isCoffer(chest)) return false; coffers.remove(chest); saveCoffers(); return true; }
2
public static void main(String[] args) { //create object Car car = new Car("Maruthi Swift ZDi", 2013, "KA03-MT2165", "21.40"); //Serialize object try { FileOutputStream outfile = new FileOutputStream("car.ext"); ObjectOutputStream out = new ObjectOutputStream(outfile); out.writeObject(car); out.c...
6
private void InserirNovoFornecedor() { String nome = jTextFieldNomeFornecedor.getText(); String morada = jTextFieldMoradaFornecedor.getText(); String codPostal = jTextFieldCodPostalFornecedor.getText(); String localidade = jTextFieldLocalidadeFornecedor.getText(); String contacto...
8
public void loadPDBInfo(final TaskMonitor monitor, final CyNetwork network, String idColumn, final List<CyIdentifiable> ids) { Map<CyIdentifiable, List<String>> idMap = getIdentifiers(network, idColumn, ids); if (idMap == null || idMap.size() == 0) return; // Get the valid IDs from the P...
5
public static void main(String []agrs) throws IOException { JFrame jFrame = new MainForm(); jFrame.setTitle("Park"); jFrame.setSize(300, 220); jFrame.setLocationRelativeTo(null); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jFrame.setVisible(true); while(true) { ServerSocket ss = new...
2
public List<String> summaryRanges(int[] nums) { List<String> rtList = new ArrayList<String>(); String range = ""; int range_1 = 0; for (int i = 0; i < nums.length; i++) { if (nums.length == 1) { range_1 = nums[i]; range = range_1 + ""; rtList.add(range); break; } if (i == 0) { r...
8
@Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub canvas.removeMouseListener(canvas.getDrawListener()); canvas.removeMouseMotionListener(canvas.getDrawListener()); switch (buttonNum) { case 1: listener = new PencilListener(canvas); break; case 2: listene...
7