text
stringlengths
14
410k
label
int32
0
9
@Override public void add(Component component) { if (mList != null) { mList.add(component); } }
1
public void printString(TeaNode parent) { String line = "|"; for (int i = 0; i < parent.level; i++) { line += "-"; } if (!parent.label.equals("")) { line += "[" + parent.label + "]"; } if (parent.classValue == null) { line += parent.attribute; } else { line += " -> " + parent.classValue; } ...
4
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // Start: if (jTable1.isEditing()) { JOptionPane.showMessageDialog(rootPane, "In part 3 select the cell with 'a' in the first column", "ERROR", JOptionPane.ERROR_MESSAGE); ...
5
public void test_add_RP_int_intarray_int() { int[] values = new int[] {10, 20, 30, 40}; int[] expected = new int[] {10, 20, 30, 40}; OffsetDateTimeField field = new MockStandardDateTimeField(); int[] result = field.add(new TimeOfDay(), 2, values, 0); assertEquals(true, Arrays.equ...
2
private void whois(CommandArgsIterator args_it) throws IOException { if (args_it.hasNext()) { String user_name = args_it.next(); if (!args_it.hasNext()) { Map<String, Client> users = this._server.getUsers(); String[] chan_names = null; ...
5
void setOtherOptions() { reverseMouseButtons2And3 = choices[mouseButtonIndex].getSelectedItem() .equals("Reversed"); viewOnly = choices[viewOnlyIndex].getSelectedItem().equals("Yes"); if (viewer.vc != null) viewer.vc.enableInput(!viewOnly); shareDesktop = choices[shareDesktopIndex].getSelectedItem().e...
9
public String buildSearchString(String metr, String cont, String popu, boolean greater, boolean exact) { String qString = "SELECT * FROM " + dbase_name + " WHERE "; ArrayList<String> queries = new ArrayList<String>(); if (!metr.equals("")) { String str = ""; if (exact) { str += "metropoli...
8
public int selectDivision(double[] v) { int num = 0; int[] topind = new int[RAND_DIM]; for (int i = 0; i < numberOfDimensions; i++) { if (num < RAND_DIM || v[i] > v[topind[num - 1]]) { if (num < RAND_DIM) { topind[num++] = i; } else { topind[num - 1] = i; } // Bubble the right-most ...
6
private void updateArduinoSensors() { //get all actual Measurements from Arduino //send 23 to get the data RS485.hsWrite(sendBuffer,0,sendBuffer.length); int readBytesSumm = 0; int timeoutc =0; byte[] sensorBytes = new byte[14]; //wait for an answer while (readBytesSumm < 14 && timeoutc<20) { readBy...
6
public int executerRequeteMaj(Object... params) throws SQLException, IllegalStateException { // Vérification de l'existence de la connexion. if (this.conn == null) { fermerConnexion(); throw new IllegalStateException("Impossible d'exécuter la requête car la connexion à la base de données n'a pas été établi...
5
int insertKeyRehash(double 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...
9
@Override public String toString() { switch (this) { case SUNDAY: return "Su"; case MONDAY: return "M"; case TUESDAY: return "T"; case WEDNESDAY: return "W"; case THURSDAY: return "R"; case FRIDAY: return "F"; case SATURDAY: return "Sa"; case ANY: return " "; default: throw new IllegalArgumentException(); } ...
8
String effTranslate(EffectType eff) { switch (eff) { case UTR_5_PRIME: case START_GAINED: return "5PRIME_UTR"; case UTR_3_PRIME: return "3PRIME_UTR"; case NON_SYNONYMOUS_START: case START_LOST: return "NON_SYNONYMOUS_CODING"; case INTRON: return "INTRONIC"; } return eff.toString(); }
6
public static Reduce computeReduce(Sort sort, IORatioModel ioRatio) { Reduce reduce = new Reduce(); FinalSortMerge eFinalSortMerge = sort.getFinalSortMerge(); MixSortMerge eMixSortMerge = sort.getMixSortMerge(); InMemorySortMerge eInMemorySortMerge = sort.getInMemorySortMerge(); assert(eFinalSortMerge !...
7
public static Integer lt(Object o1, Object o2){ if (o1 == null && o2 == null){ return 0; } else if (o1 == null && o2 != null){ return 1; } else if (o1 instanceof Number && o2 instanceof Number){ return ((Number)o1).doubleValue() < ((Number)o2).doubleValue() ? 1 : 0; } return 0; }
7
public String getValue(Keyword key) { String value = ""; if (key.equals(Keyword.CONTENT)) { value = content; } else if (key.equals(Keyword.START)) { value = start; } else if (key.equals(Keyword.END)) { value = end; } else if (key.equals(Keyword...
7
public void setSpeed(int newSpeed) { Speed = newSpeed; }
0
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Province)) { return false; } Province other = (Province) object; if ((this.provinceID == null && other.province...
5
private void tabProdutosKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tabProdutosKeyReleased performNavigateAction(evt); if (evt.getKeyCode() == KeyEvent.VK_DOWN) { if (booAlteracao) { btnCancelar.doClick(); booAlteracao = false; } el...
9
@Override public String stringify(int level) { ArrayList<String> strArray = new ArrayList<String>(); int width = 0; String strJSON; for (Entry<Object, JSON> e : mapObject.entrySet()) { strJSON = escape((String) e.getKey()) + ": " + e.getValue().stringify(level + 1); strArray.add(strJSON); width += st...
8
public void psvdIteration () { initPara (); boolean convergedY = false; boolean convergedCb = false; boolean convergedCr = false; while (!convergedY) { iter[0]++; solveR(0); solveD(0); updatePara(0); convergedY = judge...
4
@Override public void execute() { if (Game.getClientState() != Game.INDEX_MAP_LOADED) { Ivy.stop = 1000; } if (Game.getClientState() == Game.INDEX_MAP_LOADED && Ivy.stop == 1000) { Ivy.stop = 50; } if (Ivy.client != Bot.client()) { WidgetCache.purge(); Bot.context().getEventManager().addListe...
7
private ArrayList<File> getAllFilesInDirectory(File directory) { ArrayList<File> filesInDirectory = new ArrayList<File>(); File[] files = directory.listFiles(); System.out.println(directory.getPath()); for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { filesInDirectory.add(files[i]); ...
4
public static double[][] computeSpectrogram(double[] wavedata, int fft_window_length, int fft_window_inc, String window_type) { int segSize = wavedata.length; int numWin = ((segSize - fft_window_length) / fft_window_inc) + 1; FFT FFTreal = new FFT(); Window windowfunc = new...
2
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed JFileChooser chooser = new JFileChooser("/"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(this); if(returnVal == JFileCh...
1
public String getFolderPath() { return folderPath; }
0
public void accept(final MethodVisitor mv) { Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = ((LabelNode) this.labels.get(i)).getLabel(); } mv.visitTableSwitchInsn(min, max, dflt.getLabel(), labels); }
1
@EventHandler(priority = EventPriority.LOWEST) public void preprocessHandler(PlayerCommandPreprocessEvent event) { if(event.isCancelled()) { return; } if(event.getMessage().equalsIgnoreCase("/who") || event.getMessage().equalsIgnoreCase("/list") || event.getMessage().equalsIgnoreCase("/playerlist") || even...
6
public Map<String, Object> getValues(boolean deep) { Map<String, Object> result = new LinkedHashMap<String, Object>(); Configuration root = getRoot(); if (root != null && root.options().copyDefaults()) { ConfigurationSection defaults = getDefaultSection(); if (defaults ...
3
public static DataType fromString(String value) { switch (value) { case "STRING": return STRING; case "INTEGER": return INTEGER; case "DOUBLE": return DOUBLE; case "DATE": return DATE; case "BOOLEAN": return BOOLEAN; default: return null; } }
5
@Override public void startSetup(Attributes atts) { super.startSetup(atts); setEnabled(false); addActionListener(this); Outliner.documents.addDocumentRepositoryListener(this); }
0
@Test public void testIsFullOutOfRange() { Percolation p = new Percolation(10); try { p.isFull(-5, 5); fail("Line above should throw exception"); } catch (IndexOutOfBoundsException e) { /* Expected */ } try { p.isFull(0, 5); fail("Line above should throw exception")...
6
@Override public int hashCode() { int hash = 5; hash = 37 * hash + (this.type != null ? this.type.hashCode() : 0); return hash; }
1
public void run() { long lastTime = System.nanoTime(); long timer = System.currentTimeMillis(); final double ns = 1000000000.0 / 60.0; double delta=0; int frames=0; int updates=0; while(running){ long now = System.nanoTime(); delta += (now-lastTime) / ns; lastTime=now; while(delta >=1){...
3
public void addFileVariablesAppearances(List<VariableAppearance> fileVariablesAppearances) { fileVariablesAppearances = setFileToAppearanceList(fileVariablesAppearances); for (VariableAppearance variableAppearance : fileVariablesAppearances) { if (!this.fileVariablesAppearances.contains(variableAppearance)){ ...
2
public Object [][] getDatos(){ Object[][] data = new String[getCantidadElementos()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TabelProdSubBrand other = (TabelProdSubBrand) obj; if (!Objects.equals(this.subBrandId, other.subBrandId)...
3
public String toString() { String modstr = ""; switch (modifier) { case ABOUT: modstr = "[ABOUT]"; break; case ESTIMATED: modstr = "[ESTIMATED]"; break; case CALCULATED: modstr = "[CALCULATED]"; break; case WFT_ESTIMATED: modstr = "[WFT-ESTIMATED]"; break; } return (day...
7
public static int hg_step6(int step, double[][] cost, int[] rowCover, int[] colCover, double maxCost, int[][] mask) { System.out.println("STEP 6"); //What STEP 6 does: //Find smallest uncovered value in cost: a. Add it to every element of covered rows //b. Subtract it from every element of uncovered ...
9
public String getDescription() { if(fullDescription == null) { if(description == null || isExtensionListInDescription()) { fullDescription = description==null ? "(" : description + " ("; // build the description from the extension list Enumeration<String> extensions = filters.keys(); if(extensions != nul...
6
public boolean getScrollableTracksViewportWidth() { if (scrollableWidth == ScrollableSizeHint.NONE) return false; if (scrollableWidth == ScrollableSizeHint.FIT) return true; // STRETCH sizing, use the greater of the panel or viewport width if (getParent() instanceof JViewport) { return (((JVi...
3
@Override public double computeNetAssetValue() { return 0; }
0
private void updateGamePanel() { gamePanel.removeAll(); gamePanel.setLayout(new GridLayout(2,6)); Card[] deck = latest.getBoard().getDeck(); for(int i = 0; i < 6-deck.length; i++) { gamePanel.add(new JLabel()); } for(Card c : deck) { JLabel label = getClickableCardLabel(c); label.s...
4
public static void main(String[] args) { Log.addListener(new ConsoleLogger()); Log.setDebugMode(false); try { TorrentManager.getInstance().load(XML_SETTINGS); } catch (XMLException e) {} catch (IOException e) { Log.e("Eblast:: IOException", "IO problem"); } if (System.getProperty("os.name")...
5
private void catchAction(HttpServletRequest request){ Enumeration paramNames = request.getParameterNames(); while(paramNames.hasMoreElements()) { String paramName = (String)paramNames.nextElement(); String[] paramValues = request.getParameterValues(paramName); ...
2
public static void resetId() { id = 1; }
0
private static String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); ...
1
public static void main(String[] args) { Meowzy bot = new Meowzy(); Log.consoleLog("Starting up..."); Config.loadConfiguration(); File check = new File("meowzy.db"); if(!check.exists()) { bot.sql.resetDatabase(); } try { bot.co...
5
public static URL getRenderURL(int typeID, short size) throws ApiException { if(Arrays.binarySearch(renderSizes, size) < 0) throw new ApiException("Invallid image size: "+Short.toString(size)+". Allowed sizes are: "+Arrays.toString(characterPortraitSizes)); try { return new URL(IMAGE_SERVICE_URL+"/Render/"+In...
2
public static boolean isAllianceID(int id) { try { InputSource data; String notCorp = "{\"info\":null,\"characters\":[]}"; data = Download .getFromHTTP("http://evewho.com/api.php?type=allilist&id=" + id); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(data.get...
2
* @return Returns true if the cell is movable. */ public boolean isCellMovable(Object cell) { mxCellState state = view.getState(cell); Map<String, Object> style = (state != null) ? state.getStyle() : getCellStyle(cell); return isCellsMovable() && !isCellLocked(cell) && mxUtils.isTrue(style, mxConstan...
3
synchronized public void finished(int status, Recording rec){ // if the video downloaded successful remove the video from the list and // update the database that the video download was successful if(status == FINISHED_SUCCESSFUL){ LOG.info("The recording with id " + rec.getId() + " was downloaded suces...
7
public void run() { String producedData = ""; try { while (true) { if (producedData.length()>75) break; producedData = new String("Hi! "+producedData); sleep(1000); // It takes a second to obtain data. theBuffer.putLine(producedData); } } catch (Exception e) { // Just let thread termina...
3
public static Matrix read (BufferedReader input) throws java.io.IOException { StreamTokenizer tokenizer= new StreamTokenizer(input); // Although StreamTokenizer will parse numbers, it doesn't recognize // scientific notation (E or D); however, Double.valueOf does. // The strategy here is to dis...
8
public UnitsSettings(final ScheduleDialog scheduleDialog) { super(new FlowLayout(FlowLayout.LEFT, 0, 0)); input = new JTextField[6][]; JPanel p1 = new JPanel(new GridLayout(7, 3, 10, 5)); p1.add(new JLabel(" Number ")); p1.add(new JLabel("Stations")); p1.add(new JLabel(" Cycles ")); for (int i = 0; ...
8
protected void initializePhase(int w) { Arrays.fill(committedWorkers, false); Arrays.fill(parentWorkerByCommittedJob, -1); committedWorkers[w] = true; for (int j = 0; j < dim; j++) { minSlackValueByJob[j] = costMatrix[w][j] - labelByWorker[w] - labelByJob[j]; minSlackWorkerByJob[j] = w; } }
1
private static void main2(String[] args) { Config.cmdline(args); ThreadGroup g = HackThread.tg(); setupres(); MainFrame f = new MainFrame(800, 600); if (Config.fullscreen) f.setfs(); f.resetCenter(); f.g = g; if (g instanceof haven.error.ErrorHandler) { final haven.error.ErrorHandler hg = (haven.e...
6
public NewParticipantMessage(String name) { this.name = name; }
0
private IRemoteCallObject setResponse(long key, IRemoteCallObject response, boolean complete, boolean error) { IRemoteCallObject obj = getCallObj(key); if (obj != null) { obj.setResponseRemoteCallObject(response); obj.setComplete(complete); obj.setError(error); } return obj; ...
1
public void setjScrollPane2(JScrollPane jScrollPane2) { this.jScrollPane2 = jScrollPane2; }
0
public static void receiveAndBounceMessage(String incomingMessage, Socket socket) { incomingMessage = incomingMessage.substring(6); ServerSocket temp = null; int id = Integer.parseInt(incomingMessage.split("\\\\")[0]); String fileName = incomingMessage.split("\\\\")[1]; writeToAll("/file " + id + "\\" + file...
7
public double calculate(double a, double b) { switch (value) { case '+': return a+b; case '-': return a-b; case '*': return a*b; case '/': return a/b; case '^': return Math.pow(a, b); } return 0; }
5
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
9
public synchronized <U extends T> U put(U obj) { if (obj == null) { return null; } Entry<T>[] entries = mEntries; int hash = hashCode(obj); int index = (hash & 0x7fffffff) % entries.length; for (Entry<T> e = entries[index], prev = null; e != null; e = e.mNext...
9
public static void unpackConfig(Archive container) { Stream stream = new Stream(container.get("varp.dat")); Varp.anInt702 = 0; int cacheSize = stream.getUnsignedShort(); if (Varp.cache == null) { Varp.cache = new Varp[cacheSize]; } if (Varp.anIntArray703 == null) { Varp.anIntArray703 = new int[cacheSi...
5
private static String select_action() { String result = null; System.out.print("available action: "); Vector<String> actions = new Vector<String>(Arrays.asList("lvlup", "catacomb", "pack_of_wolves", "calendar", "pray")); for(int i = 0; i < actions.size(); i++) { System.out.print("[" + i + "]" + actions.get(i...
5
public int getFileCreatedMask() { return JNotify.FILE_CREATED; }
0
private static String compute(String nBlocksStr, String kBlocksStr, int blocksCount) { StringBuilder solutionStringBuilder = new StringBuilder(); double nBlocks[] = new double[blocksCount]; double kBlocks[] = new double[blocksCount]; int index = 0; for (String blockToken : nBloc...
8
@Override public void actionPerformed(ActionEvent e) { boolean selection = false; DocUtils.buttonDoClick(e); wordProcessor.area1.requestFocus(); String text = wordProcessor.area1.getSelectedText(); int start = 0, length = 0; if (text != null) { selection = true; start = wordProcessor.area1.getSele...
6
protected void calcDIR_FileSize() { byte[] bTemp = new byte[4]; for (int i = 28;i < 32; i++) { bTemp[i-28] = bytesOfFAT32Element[i]; } DIR_FileSize = byteArrayToInt(bTemp); if (DIR_FileSize >= 1024) { fileSize = DIR_FileSize / 1024; fil...
2
public String weekdayF() { int when = weekday(); if (when == 0) return "Sunday"; else if (when == 1) return "Monday"; else if (when == 2) return "Tuesday"; else if (when ==3) return "Wednesday"; else if (when ==4) return "Thursday"; else i...
7
public List<Juoma> haeJuomat() throws DAOPoikkeus { // avataan yhteys Connection yhteys = avaaYhteys(); ArrayList<Juoma> juomat = new ArrayList<Juoma>(); try { // Haetaan tietokannasta tuotteet String sql = "SELECT tuoteID, numero, nimi, hinta FROM Tuote WHERE tuoteryhmaID = 2 OR tuoteryhmaID = 3 AND a...
2
public static void initLevel() throws SlickException{ // game objects meds = new ArrayList<Pickable>(); mobs = new ArrayList<Enemy>(); alpha = 0; new Level(++level); new Character(Level.startPoint.getX(), Level.startPoint.getY()-1); timer = 10000; if(level == -1){ Sounds.music.stop(); } }
1
public String readParameter(String name, boolean required) { if (inAnApplet) { String s = getParameter(name); if ((s == null) && required) { fatalError(name + " parameter not specified"); } return s; } for (int i = 0; i < mainArgs.length; i += 2) { if (mainArgs[i].equalsIgnor...
8
public static boolean getRoadsData(String pathName) { DocumentBuilderFactory docBuilderFactory; DocumentBuilder docBuilder; Document document = null; try { docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilder = docBuilderFactory.newDocumentBuilder(); document = docBuilder.parse(new Fi...
6
public boolean onNode(TreeNode node, double x, double y) { return Math.sqrt(x * x + y * y) <= NODE_RADIUS; }
0
public static Cons kifVariableDeclarationsToStella(Stella_Object tree, boolean errorP) { if (Logic.stellaVariableDeclarationsP(tree)) { { return (((Cons)(tree))); } } else { if (Logic.kifVariableDeclarationP(tree)) { { return (Cons.cons(Logic.oneKifVariableDeclara...
8
public static void main(String[] args) throws IOException { Properties props = new Properties(); props.setProperty("email", "gmail"); OutputStream os = new FileOutputStream("D:\\Java SE\\src\\xml\\properties_into_xml\\exmaple.xml"); props.storeToXML(os, "Email", "UTF-8"); ...
0
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = new PrintWriter(response.getOutputStream()); response.setContentType("application/json"); HostsSettings hostssettings = new HostsSettings(); JSONArray hypervisorList=...
9
public void run() { //Create Map map = new HashMap<Double, Planet>(); for (Planet p : oldPlanets) { map.put(p.getId(), p); } for (Planet p : currentPlanets) { if (map.get(p.getId()) == null) { continue; } if (!(map....
4
public int getDamage(){ int dmg = 0; int rand = (int) (Math.random() * 100); if(rand < 50){ dmg = level; }else if(rand < 60){ dmg = (int) (level * 1.2); }else if(rand < 70){ dmg = (int) (level * 1.4); }else if(rand < 80){ dmg = (int) (level * 1.6); }else if(rand < 90){ dmg = (int) (level * ...
7
public Atom getLoc() { if(location != null) return location; else return null; }
1
private synchronized void rollback(){ // Do not show this window this.setVisible(false); JOptionPane.showMessageDialog(null,"Rolling Back Installation ...", "Software Rollback",JOptionPane.WARNING_MESSAGE); if(installationDirectory != null){ // Get all the directories where t...
5
public static void main(String[] args) { // read in bipartite network with 2N vertices and E edges // we assume the vertices on one side of the bipartition // are named 0 to N-1 and on the other side are N to 2N-1. int N = Integer.parseInt(args[0]); int E = Integer.parseInt(args...
6
public String getID() { return ID; }
0
public static RealMatrixExt median(RealMatrixExt[] matrices) { int numMat = matrices.length; double[] aggregator = new double[numMat]; int nRows = matrices[0].getRowDimension(); int nCols = matrices[0].getColumnDimension(); // TODO: check if #rows and #cols is equal in all matri...
5
@Override public void cover(ImageBit[][] list) { ImageBit ib = new ImageBit(); for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { ib = list[i][j]; if (ib.isCovered()) { continue; } Leg...
8
public boolean execute() { DonneesSimulation donnees = this.donnees; Robot robot = donnees.getRobot(this.nRobot); int temp = 0, is_incendie = 0; boolean return_value = false; for(int i = 0; i<donnees.getIncendies().size(); i++) { /* On vérifie qu'il y a bien un incendie sur la case du robot */ if (donnees...
8
public static TokenizerTable unstringifyTokenizerTable(String table) { { TokenizerTable result = TokenizerTable.newTokenizerTable(); int acode = (int) 'A'; String line = null; int count = 0; StringBuffer transitions = null; char separator = '|'; int start = 0; int end = 0; ...
6
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
5
public static void main(String[] args) { // TODO code application logic here int mult = 0; for (int i = 1; i < 1000; i++) { for (int j = i + 1; j < 1000; j++) { for (int k = j + 1; k < 1000; k++) { if (((i * i + j * j) == k * k) && (i + j + k == 10...
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE> ...
8
private void readAvgDays() { try { CsvReader csvReader = new CsvReader(sourceFileAvgDays); if(csvReader.readHeaders() == true) { while(csvReader.readRecord()==true) { //apar_id,apar_name,address,place,province,Country_code,zip_code,telephone_1,comp_reg_no,acctype // TODO : constants for...
8
public void save() { AccessTasks tasks = new AccessTasks(); String title = txtTitle.getText(); User creator = null; User assignedTo = null; for (User u : users.getUsers()) { if (u.getUserName().equals(lblCreatedByField.getText())) { creator = u; } if (u.getUserName().equals(cboxAssignedT...
7
public CodeTree buildCodeTree() { // Note that if two nodes have the same frequency, then the tie is broken by which tree contains the lowest symbol. Thus the algorithm is not dependent on how the queue breaks ties. Queue<NodeWithFrequency> pqueue = new PriorityQueue<NodeWithFrequency>(); // Ad...
8
public Object clone() { // use reflection to create the correct subclass Constructor constructor = getClass().getConstructors()[0]; try { return constructor.newInstance( new Object[] {(Animation)anim.clone()}); } catch (Exception ex) { // s...
1
@SuppressWarnings("unchecked") public int getCorrectChoiceIndex() { ArrayList<String> questionList = (ArrayList<String>) question; for (int i = 0; i < questionList.size(); i++) { if (questionList.get(i).equals((String)answer)) return i-1; } System.out.println("Cannot find correct choice index"); retur...
2
public BusyTile(Piece piece){ this.setImage(selectImage(piece)); this.setBorder(BorderFactory.createEmptyBorder()); this.color=piece.getColor(); }
0
public void clearBoard() { for (Field field : this.fields) { field.makeInactive(); field.clear(); } }
1
private void generateMatrix(){ for(int i=0;i<breite;i++){ for(int j=0;j<breite;j++){ if(i==j){ m.setElement(i, j, 2.0);//m.setElement(zeile, spalte, wert); }else if(j==(i+1) || j==(i-1)){ m.setElement(i, j, -1.0); }else{ m.setElement(i, j, 0.0); } } } }
5