text
stringlengths
14
410k
label
int32
0
9
public void advance(long milliseconds) { // Check to make sure we are given a positive amount of time. if (milliseconds < 0) { throw new IllegalArgumentException("Time interval cannot be less than 1."); } else if (milliseconds == 0) { return; } else { /* Critical Region */ synchronized (this)...
2
public static Transformer newTransformer(String xsltFileName) throws TransformerConfigurationException { File xsltFile = new File(xsltFileName); Templates template = cache.get(xsltFileName); if (template == null) { lock.writeLock().lock(); try { ...
2
@Override public void run(final String... args) { final CommandLine line = parseArguments(args); final String configFile = getConfigFile(line); final SyncConfig config = readConfig(configFile); for (final FolderConfig folderConfig : config.getConfigs()) { if (!folderConfig.isSyncOn()) { System.out.prin...
2
@Override public void gameRenderObjects() { }
0
public ResultSet read(String query){ try { ResultSet result = this.statement.executeQuery(query); result.last(); int rows = result.getRow(); if(rows < 1){ return null; } result.beforeFirst(); return result; ...
2
public static void main(String[] args)throws IOException { File directory = new File("/home/garth/Desktop/stock"); //directory of program files File[] files = directory.listFiles(); List<String> allMatches = new ArrayList<String>(); for(int i=...
6
* @return Returns true if the cell is a valid drop target for the given * cells. */ public boolean isValidDropTarget(Object cell, Object[] cells) { return cell != null && ((isSplitEnabled() && isSplitTarget(cell, cells)) || (!model .isEdge(cell) && (isSwimlane(cell) || (model .getChildCount(cell...
6
@Override public void process(Map<String, Object> jsonrpc2Params) throws Exception { if(method.equals(Constants.Method.LOGIN)){ login(jsonrpc2Params); } else if(method.equals(Constants.Method.GET_ACCOUNT)){ getAccount(jsonrpc2Params); } else if(method....
4
public Font(Library library, Hashtable entries) { super(library, entries); // name of object "Font" name = library.getName(entries, "Name"); // Type of the font, type 0, 1, 2, 3 etc. subtype = library.getName(entries, "Subtype"); // figure out type subTypeForm...
3
public double[] distributionForInstance(BayesNet bayesNet, Instance instance) throws Exception { Instances instances = bayesNet.m_Instances; int nNumClasses = instances.numClasses(); double[] fProbs = new double[nNumClasses]; for (int iClass = 0; iClass < nNumClasses; iClass++) { ...
9
public void saveConfig() { if (config == null || configFile == null) { return; } try { getConfig().save(configFile); } catch (final IOException ex) { plugin.getLogger().log(Level.SEVERE, "Could not save config to " + configFile, ex); } }
3
public Team getTeam(int teamID, Connection con) { Team t = null; String SQLString = "SELECT * " + "FROM TEAMS " + "WHERE teamID = ?"; PreparedStatement statement = null; try { statement = con.prepareStatement(SQLString); statemen...
4
public double computeMax(){ double max_revenue = 0; for(int switch2 = 2; switch2 <= no_weeks+1; switch2++){ for(int switch3 =2; switch3 <= no_weeks+1; switch3++){ for(int switch4=2; switch4 <= no_weeks+1; switch4++){ if(switch4>=switch3 && switch3>=switch2){ double thisrev = getSimRevenue(sw...
5
private void initComponentsNorth() { northPanel = new JPanel(); ActionListener myActionListener = new UserGUIActionListener(this, loginUser); searchLabel = new JLabel("Suchkriterium auswählen "); searchLabel.setFont(new Font(textFont, labelStyle, 14)); searchCombo = new JComboBox<String>(); searchCo...
1
public static boolean registerLog(String addr) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { e.printStackTrace(); return false; } Connection c = null; try { c = DriverManager.getConnection( ...
3
public static Promotion addPromotion(Promotion p) { if (p == null) return null; // We check if the promotion doesn't still exist in the Professor List. boolean exist = false; int pos = 0; for (int i = 0; i < FileReadService.pList.size(); i++) { if (FileReadService.pList.get(i).equals(p)) { exist = ...
4
@Override public void contextInitialized(ServletContextEvent sce) { logger.info("Initialize JdbcRealm database"); Connection cnn = null; try { if (dataSource == null) { throw new IllegalStateException("DataSource not injected, verify in web.xml that 'metadata-comp...
2
public void testFormatAppend_PrinterParser_Printer_null() { PeriodPrinter printer = new PeriodFormatterBuilder().appendYears().appendLiteral("-").toPrinter(); PeriodFormatterBuilder bld = new PeriodFormatterBuilder().append(printer, null).appendMonths(); assertNotNull(bld.toPrinter()); a...
1
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Book book = (Book) o; if (id != book.id) return false; if (!author.equals(book.author)) return false; if (!genre.equals(book.genre)) re...
7
public String constructOrder(){ StringBuffer order = new StringBuffer(); int forCommands = 0; int numberOfPersonsForCommand = 0; String mealForCommand = null; if(this.isEveryOneOrdered()==0){ for(Command command: this.commands){ if(command.isForCommand()){ forCommands ++; numberOfPersonsForComma...
4
public void setImage(String fileName) { boolean old = true; if( image != null && ((isHovered && fileName.equals("hover" + name)) || (!isHovered && fileName.equals(name))) ) return; try { if(old) image = ImageIO.read( new File("Images\\"+ fileName +".png") ); else image = getImageResource(fil...
7
void exportXmlTemplate( XmlWriter xml, String legend ) { if(yVal1 == yVal2 && xVal1 != xVal2) { // hrule xml.startTag("hrule"); xml.writeTag("value", yVal1); xml.writeTag("color", color); xml.writeTag("legend", legend); xml.writeTag("width", lineWidth); xml.closeTag(); // hrule } else if(yVal...
6
@Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } Course course = (Course) object; if (!classCode.equals(course.getClassCode())) { return false; } if (!section.equals(course.getSection())) { return false; } return...
4
public static String removeFormatting(String line) { int length = line.length(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < length; i++) { char ch = line.charAt(i); if (ch == '\u000f' || ch == '\u0002' || ch == '\u001f' || ch == '\u0016') { ...
5
public static void main(String args[]) { String filename = ""; String pattern = "*"; if(args.length == 2){ filename = args[0]; pattern = args[1]; } else if(args.length == 1){ filename = args[0]; } else { System.out.println("Usage: java -jar " + System.getProperty("sun.java.command") + " zipFile...
3
public static Set<PDFInfoHolder> getSimplePDFInfoHolders(File pdfs1, File pdfs2, String prefix) { Set<PDFInfoHolder> pdfInfoHolders = new HashSet<PDFInfoHolder>(); // are those valid pathes if(pdfs1 != null && pdfs2 != null && pdfs1.isDirectory() && pdfs2.isDirectory()) { // create a filter to only get p...
7
public String tooltip(Coord c, boolean again) { if ((c.x >= 10) && (c.x < 10 + prof.hist.length) && (c.y >= 10) && (c.y < 10 + h)) { int x = c.x - 10; int y = c.y - 10; long t = (h - y) * (mt / h); Profile.Frame f = prof.hist[x]; if (f != null) { ...
7
public void moveRandom() { if(getTimeStamp() == 0) // If clock is reset.. { setTimeStamp(TimeHandler.getTime()); // Set clock setActionTime(random.nextInt(1500) + 500); // Set a random duration (500-2000 ms) to move/stay switch(random.nextInt(4)) // Randomize a direction { ...
7
public void focusGained(FocusEvent e) { if (e.getSource() == InchesInput) { InchesInput.setText(" "); } else if (e.getSource() == FeetInput) { FeetInput.setText(" "); } else if (e.getSource() == YardsInput) { YardsInput.setText(" "); } else if (e.getSource() == MillimetersInput) { ...
6
static double NetwonRaphson() { if (f(v, 0) == 0) return 0; double xn = 0.5, x = 0; while (true) { x = xn - f(v, xn) / ff(v, xn); if (Math.abs(x - xn) < EPS) return xn; xn = x; } }
3
public ArrayList<ZoomDataRecord> getZoomData(RPChromosomeRegion selectionRegion, boolean contained) { int chromID, chromStart, chromEnd, validCount; float minVal, maxVal, sumData, sumSquares; int itemHitValue; int recordNumber = 0; ...
8
void addDevice(Device device) { // if device was in list of saved localhost devices, copy saved // preferences to this device for (Device d : model.getDevices()) { if (device.getSerialNumber().equals(d.getSerialNumber())) { device.copyProperties(d); break; } } // if user previously preferred n...
6
@Override public void render(float interpolation) { Vector2 pos = Interpolator.linearInterpolate(oldPos, this.pos, interpolation); Renderer.drawRect(pos, new Vector2(dim.x,20), isSelected ? windowTopColor : windowMainColor, 1.0f); Renderer.drawRect(pos.add(new Vector2(0,20)), dim, windowMainColor, 1.0f); ...
4
private void fillInCounterParty() { for(Statement m : movementDataModel.getAllStatements()) { String name; if (newCounterParty == null) { name = null; } else { name = newCounterParty.getName(); } TmpCounterParty tmp = new TmpCounterParty(); tmp.setName(name); tm...
2
public boolean SetPlayerBirthday(String player, Date bdate) { String datestr; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); datestr = sdf.format(bdate); BirthdayRecord birthday = getPlayerRecord(player); String query; if (birthday == null) { query = "INSERT INTO birthdaygift (birthdayDate,...
1
public boolean havePointInBound( AABB aabb ) { Matrix4f transformation = getTransform().getTransformation(); Vector3f p1 = transformation.transform( point1 ); Vector3f p2 = transformation.transform( point2 ); Vector3f p3 = transformation.transform( point3 ); if ( p1.isInBound( aabb ) || p2.isInBound( aabb )...
3
public void initLevel(int l) throws SlickException{ if(currentLevel <= 10){ pickables = new ArrayList<Pickable>(); mobs = new ArrayList<Mob>(); level = new Level(l); player = new Player(level.startX, level.startY); respawnCounter = 0; } }
1
public static boolean testerPrimalite(long n) { boolean trouve=false; int i=0; long temp=0; while(!trouve && i<NB_TESTS) { temp=(int)((Math.random()*n)); if(temp==0) { temp++; } if(calculSoloStras(temp,n)!=syJacobi(temp,n)) { trouve=true; } i++; } return !trouve; }
4
public static String getMCTimeString(long var0, long var2) { long var4 = (long)((int)((var0 / 1000L + 6L) % 24L)); int var6 = (int)((double)(var0 % 1000L) / 1000.0D * 60.0D); boolean var7 = var4 < 12L; var4 %= var2; String var8 = ""; if (var2 == 24L) { ...
6
public void refreshCaches() throws RegistryErrorException { if(isCachingActive()) { if(caches != null && caches.size() > 0) { List tmpCache = (List) caches.clone(); caches = new ArrayList(); for (int x = 0; tmpCache != null && x != tmpCache.size(); x++) { ...
6
public SecuredMessageTriggerBean execute(SecuredMessageTriggerBean message) throws GranException { SecuredTaskBean task = message.getTask(); String text = message.getDescription(); EggBasket<SecuredUDFValueBean, SecuredTaskBean> refs = AdapterManager.getInstance().getSecuredIndexAda...
5
public void update(String msg) { if (msg.startsWith("CUL:")) { String[] users = msg.substring(4).split("\\|"); userListPanel.removeAll(); userListPanel.add(userLabel); JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); separator.setMaximumSize(new Dimension(32767, 2)); sepa...
8
private void setPiece(int row, int col, Piece p) { if (p == EMP && get(col, row) != EMP) { Piece n = get(col, row); numPiecesRow[row - 1] -= 1; numPiecesCol[col - 1] -= 1; numPiecesDownDiag[row + col - 2] -= 1; numPiecesUpDiag[col - row + 7] -= 1; ...
3
void print(Node t, int n, boolean p) { if (p) { t.print(n, true); } else { if (n > 0) { for (int i = 0; i < n; i++) System.out.print(" "); } System.out.print("("); if ...
6
public static Map<String, String> uriToMap(String uri) { if (StringUtils.isBlank(uri)) { return null; } try { // LinkedHashMap is our impl choice, because order of params is awesome sometimes Map<String, String> params = new LinkedHashMap<String, String>(); ...
9
public String getCp() { return cp; }
0
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 void jTable8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable8MouseClicked System.out.println("Count:" + evt.getClickCount()); if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) { System.out.println("Right Click"); int r = jTable8.rowAtPoint(e...
7
@Override public void setValueAt(Object valor, int rowIndex, int columnIndex) { // Pega o contato referente a linha especificada. Contato contato = linhas.get(rowIndex); switch (columnIndex) { case ID: contato.setId((String) valor); case NOME: contato.setNome((String) valor); ...
8
protected void processPreBlocks(List<String> preBlocks) { if(generateStatistics) { for(String block : preBlocks) { statistics.setPreservedSize(statistics.getPreservedSize() + block.length()); } } }
2
@Override public void onEnable() { instance = this; c = new Config(this); if (Config.defaultConfig) { getLogger().warning("RoyalIRC is disabled until the config is edited."); setEnabled(false); return; } version = getDescription().getVersio...
6
public long getLong(Object key) { Number n = get(key); if (n == null) { return (long) 0; } return n.longValue(); }
1
public void IncrementLeftByBus() { this.leftByBus += 1; }
0
public static void main(String[] args) { try { Window fenetre = new Window(); } catch (Exception e) { e.printStackTrace(); } }
1
private ArrayList addCustomer(HttpServletRequest request) { ArrayList al = new ArrayList(); String passport = request.getParameter("passport"); String name = request.getParameter("name"); String password = request.getParameter("password"); String postal = request.getParameter("po...
5
@Override public void run() { logger.info("Starting announce thread for " + torrent.getName() + " to " + torrent.getAnnounceUrl() + "..."); // Set an initial announce interval to 5 seconds. This will be updated // in real-time by the tracker's responses to our announce requests. this.interval = 5; t...
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; this.mode = this.top == 0 ? 'd' : this.stack[this.top...
5
@Override public void unInvoke() { if((pit!=null) &&(canBeUninvoked()) &&(pit.size()>1)) { final Room R1=pit.get(0); final Room R2=pit.get(pit.size()-1); while(R1.numInhabitants()>0) { final MOB M=R1.fetchInhabitant(0); if(M!=null) { M.killMeDead(false); R1.delInhabitant(M); ...
9
public static int getY(RSInterface parent, RSInterface child) { if (parent == null || parent.children == null || child == null) { return -1; } for (int index = 0; index < parent.children.size(); index++) { if (parent.children.get(index) == child.id) { return parent.childY.get(index); } } return -...
5
public void setStackDepth(int depth) { stackDepth = depth; if (stackDepth > maxStack) maxStack = stackDepth; }
1
public void dragDropEnd(DragSourceDropEvent dsde) { Canvas canvas = (Canvas) dsde.getDragSourceContext().getComponent(); CanvasModel canvasModel = canvas.getCanvasModel(); Rectangle bounds = null; try { bounds = (Rectangle) dsde.getDragSourceContext().getTransferable().getTransferData(widgetFlavor);...
7
@Test public void testPlayerUsesTeleport() throws InvalidActionException { factory.addFlagOfPlayerToPlayerOneInventory(); ElementInfo flag = game.getActivePlayerInfo().getInventoryItems().get(0); game.moveAction(Direction.RIGHTUP); boolean containsFlag = false; for (Position pos : grid.getPositionsArou...
2
@SuppressWarnings("unchecked") private void writeData(Collection<T> data) { try { Set<Col> columnsToAdd = Sets.newTreeSet(); for (T t : data) { if (anyColumn != null) { appendAnyColumns(t, columnsToAdd); } } addColumns(columnsToAdd, true); for (T t : data) {...
8
public void testStoreRawData() { DataSet ds; final String cols = "column1,column2,column3\r\nVAL1,VAL2,VAL3"; Parser p = DefaultParserFactory.getInstance().newDelimitedParser(new StringReader(cols), ',', FPConstants.NO_QUALIFIER); p.setStoreRawDataToDataSet(true); ds = p.parse();...
1
public static boolean borarr(String cod){ try { //creación de un fichero auxiliar donde iremos colocando todos los productos excepto el que queramos borrar BufferedWriter escribe=Files.newBufferedWriter(path2, java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.CREATE); //abr...
4
protected double distance(Instance first, Instance second) { double distance = 0; int firstI, secondI; for (int p1 = 0, p2 = 0; p1 < first.numValues() || p2 < second.numValues();) { if (p1 >= first.numValues()) { firstI = m_instances.numAttributes(); } else { firstI = first.index(p1); ...
8
private void switchActvLabelTxtFieldVisibility(final Component comp, final boolean saveLabelChange){ final boolean visible = true; if( comp instanceof JLabel ){ JLabel jl = (JLabel)comp; jl.setVisible( !visible ); final JTextField jtf = jTextFieldsArr[ Integer.parse...
9
public APacket copy() { log.finer("Copying a Packet!"); APacket p = null; try { p = this.getClass().newInstance(); DataOut dataOut = DataOut.newInstance(); writeToData(dataOut); byte[] b = dataOut.getBytes(); p.readFromData(DataIn.newInstance(b)); } catch(InstantiationException | IllegalAccessExc...
1
public Display() { System.out.println("Display::Display();"); setForeground(UIManager.getColor("Button.highlight")); setBackground(Color.WHITE); setTitle("Modelowanie Wielkoskalowe - Rozrost ziaren"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 1100, 700); JMenuBar menuBar = ...
5
public void perform(Action a) { try { //System.out.println(this + " " + a + " go"); a.go(); } catch (NoSuchMethodException impossible) { } catch (InvocationTargetException impossible) { } catch (IllegalAccessException impossible) { } }
3
public void setjButtonSuiv(JButton jButtonSuiv) { this.jButtonSuiv = jButtonSuiv; }
0
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
6
public int getWidth(String text) { if (text == null) { return 0; } int width = 0; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '@' && i + 4 < text.length() && text.charAt(i + 4) == '@') { i += 4; } else { width += charWidths[text.charAt(i)]; } } return width; }
5
@Override public void display(Boolean showCorrect) { System.out.println(prompt); if (answer!=null && showCorrect){ System.out.println("The answer is: " + answer); } }
2
public void testWithers() { DateTime test = new DateTime(1970, 6, 9, 10, 20, 30, 40, GJ_DEFAULT); check(test.withYear(2000), 2000, 6, 9, 10, 20, 30, 40); check(test.withMonthOfYear(2), 1970, 2, 9, 10, 20, 30, 40); check(test.withDayOfMonth(2), 1970, 6, 2, 10, 20, 30, 40); check(t...
2
public void AIMove(){ if (this._winGFX != null) return; int numAI = this.currPlayers - 1; try { Thread.sleep(1500); } catch (Exception e){ //do nothing } for (int i = 0; i < numAI; i++){ this.diceRoll(); //wait for 1500 try { Thread...
9
private int method1() { return value; }
0
public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = ...
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Contacts)) { return false; } Contacts other = (Contacts) obj; if (emails == null) { if (other.emails != null) { return false; } } else if (!emails...
9
public void loadGame(File file) { FileInputStream fileStream; ObjectInputStream objectStream; try { fileStream = new FileInputStream(file); objectStream = new ObjectInputStream(fileStream); // read IGame object from file game = (IGame) objectStream.readObject(); objectStream.close(); } catch (...
4
public boolean containsTx(){ if(len<2) return false; for (int i = 0; i < len-1; i++) { if(array[i]==84 && array[i+1]==58) return true; } //look for T0: if(len<3) return false; for (int i = 0; i < len-1; i++) { if(array[i]==84 && array[i+1]==48 && array[i+2]==58) return true; } return false; //ASCI...
9
private void packFields() { // Method Instances DiagramFieldPanel fieldPanel; boolean changed; changed = false; if(isPack()) { for(int i = 0; i < fieldsPanel.getComponentCount(); i++) { fieldPanel = (DiagramFieldPanel) fieldsPanel....
7
@Override public boolean update(Object item) { conn = SQLconnect.getConnection(); String sql = "UPDATE `worlds` SET `name`='%s', `time_headnode`='%s' WHERE `id`='%s'"; if (item instanceof Worldnode) { Worldnode newitem = (Worldnode) item; try { sql = String.format(sql, newitem.getName(), newitem...
2
public void push(Object e) { ensureCapacity(); elements[size++] = e; }
0
public <T extends Component> List<T> getAllComponentsOnEntity(UUID entity) { synchronized (componentStores) { LinkedList<T> components = new LinkedList<>(); for (HashMap<UUID, ? extends Component> store : componentStores.values()) { if (store == null) { ...
4
private void initQuery(QueryType queryType) { switch (queryType) { case DELETE: if (this.deleteQuery == null) { this.deleteQuery = new DeleteQuery(_db); } break; case SELECT: if (this.selectQuery == null) { this.selectQuery = new SelectQuery(_db); } break; case UP...
8
private boolean userInputChecker(String input) { boolean matchesInput = false; if(userInputList.size() > 0) { for(int loopCount = 0; loopCount < userInputList.size(); loopCount++) { if(input.equalsIgnoreCase(userInputList.get(loopCount))) { matchesInput = true; userInputList.remove(loo...
3
private final synchronized void method2846(boolean bool, boolean bool_34_, MidiLoader class348_sub2, boolean bool_35_) { do { try { method2840(bool_34_, (byte) -127); anInt8889++; aClass204_8944.initialize(((MidiLoader) class348_sub2) .aByteArray6564); aLong8959 = 0L; aBoo...
5
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html");//设置服务器响应的内容格式 // response.setCharacterEncoding("gb2312");//设置服务器响应的字符编码格式。 DButil ab = new DButil(); try { PrintWriter pw = response.getWriter(); // S...
2
public static void main(String[] args) { String action = args[0]; Properties props = new Properties(); try { props.load(new FileInputStream(new File("migrator.properties"))); } catch (FileNotFoundException e) { throw new RuntimeException( "No migrator.properties file found. Make sure it's in the s...
8
@EventHandler public void EndermanFastDigging(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEndermanConfig().getDouble("Enderm...
6
@Override public <T> T processLine2D(int x0, int y0, int x1, int y1, PointHandler2D<T> handler) { int x = x0; int y = y0; T result = handler.handlePoint(x, y); if (result != null) return result; final int dx = x1 - x0; final int dy = y1 - y0; final int sign...
5
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...
7
public void evaluate() { List<Thread> threads = new ArrayList<>(); Input input = parser.getData(Input.class, "example1.xml"); Masterdata masterData = parser.getData(Masterdata.class, "metadata.xml"); Flight flight = input.getFlight(); Aircraft aircraft = new Finder().inList(masterData.getAircrafts().getAirc...
3
public static void habilitaCampos(Container container) { for (Component component : container.getComponents()) { if (component instanceof JTextComponent) habilitaTextField((JTextComponent) component); else if (component instanceof JComboBox) habilitaCompon...
7
public void run() { try { while (true) { String message = producer.getMessage(); System.out.println("Got message: " + message); Thread.sleep(1500); } } catch (InterruptedException e) { } }
2
public static void main(String[] args) throws Throwable { Scanner in = new Scanner( new InputStreamReader( System.in ) ); StringBuilder sb = new StringBuilder(); sb.append("SHIPPING ROUTES OUTPUT\n\n"); int tc = Integer.parseInt(in.nextLine()); for (int t = 0; t < tc; t++) { sb.append("DATA SET "+(t+1)+"\...
7
public static List<Class<?>> getTypes(final String str) throws IOException { List<Class<?>> result = new ArrayList<>(); byte[] s = str.trim().getBytes(); if (!(s[0] == '(' && s[str.length() - 1] == ')')) { throw new IOException("wrong type (no brackets)"); } for (int ...
9
@Override public String toString() { String returnVal = ""; switch(suit) { case CLUBS: returnVal = "C"; break; case SPADES: returnVal = "S"; break; case DIAMONDS: returnVal = "D"; ...
9
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { List<Category> categories = null; Hashtable<Long, Boolean> canDelete = null; HttpSession session = req.getSession(true); User user = (User)session.getAttribute("currentSessionUser"); // Checks if th...
3