text
stringlengths
14
410k
label
int32
0
9
public void initTraining(){ //by Budhitama Subagdja int previdx = 0; int diffidx = 0; int maxseqlimit = SEQLENGTH; if(events.isEmpty()){ System.out.println("ERROR: EMPTY EVENT SET!!"); return; } int seqcount=0; int curSeqLen=0; seqStartIndexes = new ArrayList();...
8
public int[] plusOne(int[] digits) { if ((digits[digits.length - 1] + 1) < 10) { digits[digits.length - 1] += 1;; return digits; } else { for (int i = digits.length - 1; i >= 0; i--) { if ((digits[i] + 1) == 10) { digits[i] = 0; ...
5
public void followPlayer(Rachel r){ if(seePlayer(r)){ follow++; } if(follow > 0){ if(r.getY() > getY()){ setDown(true); } else { setDown(false); } if(r.getY() < getY()){ setUp(true); } else { setUp(false); } if(r.getX() < getX()){ setLeft(true); } else { se...
6
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException { LOGGER.info("message received"); String ip = req.getRemoteHost(); String result = ""; InputStream is = null; OutputStream os = null; try ...
7
private static int askForNumberBetween( String question, int min, int max ) { println( question ); while( scanner.hasNext() ) { try { int number = Integer.parseInt( scanner.next() ); if( number>=min && number<=max ) { return number; } else if( number<min ) { println( "Sorry, this number is ...
6
public int getDepartureStop() { return this._departureStop; }
0
protected AttributeSet[] getAttributeSets(String use, List list) throws XPathException { if (list == null) { list = new ArrayList(4); } XSLStylesheet stylesheet = getPrincipalStylesheet(); List toplevel = stylesheet.getTopLevel(); StringTokenizer st = n...
9
public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNext()) { int num = input.nextInt(); if (num == 1) { System.out.println("Jolly"); continue; } boolean[] isJolly = new boolean[num]; boolean jolly = true; int left = input.nextInt(); int...
9
public void union(GoTerm goTerm) { if( symbolIdSet != null ) symbolIdSet.addAll(goTerm.symbolIdSet); if( interestingSymbolIdSet != null ) interestingSymbolIdSet.addAll(goTerm.interestingSymbolIdSet); }
2
@Override public EntityPlayer loadTexture() { try { texture = TextureLoader.getTexture("PNG", new FileInputStream("./res/" + unlocalized_name + ".png")); animation.put(Direction.FRONT, texture); } catch (Exception e) { try {...
2
@Test public void testGitHubPropertiesHome() { MavenProperties properties = new MavenProperties("~/.m2/settings.xml"); try { properties.fetchProperties(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace()...
3
@Override public void logicUpdate(GameTime gameTime) { // Update the current state currentState.logicUpdate(gameTime); // Attempt to change the current state to the offered transition state // if it is not null, and it exists within the system if (currentState.getTransitionStateName() == null) { // This s...
1
public static void scrollBothPaneH(String str, int delta) { if (str == "inc") { scrollPane1.getHorizontalScrollBar().setValue(scrollPane1.getHorizontalScrollBar().getValue() + delta); scrollPane2.getHorizontalScrollBar().setValue(scrollPane2.getHorizontalScrollBar().getValue() + delta); ...
2
@Override public void startSetup(Attributes atts) { super.startSetup(atts); // we start out disabled setEnabled(false); // Add us to our parent menu. ((JMenu) GUITreeLoader.elementStack.get(GUITreeLoader.elementStack.size() - 2)).add(this); // set size of Recent Files list currentRecentFilesList...
3
@Override public void compute() { }
0
public static void main(String[] args) throws IOException { String fileToRead = "../data/test_set_tweets.mini.txt"; Corpus c = new Corpus(new Parser(fileToRead)); System.out.println("CORPUS CREATED"); Generator g = new Generator(c); for(int i = 0; i < 500; i++){ String gs = g.createSentence(); Syst...
1
public static void updateArticle(int id,int idCouleur,int idtva,String libelle,String reference,float prixht, int photo) throws SQLException { String query; try { query = "UPDATE ARTICLE set ID_COULEUR=?,ID_TVA=?,ARTLIBELLE=?,ARTREF=?,ARTPRXHT=?,ARTPHOTO=? WHERE ID_ARTICLE=? "; ...
1
public static void main(String[] args) { try { runProcess("javac C:\\Users\\Adam\\workspace\\Main.java"); runProcess("java -cp C:\\Users\\Adam\\Desktop Main"); } catch (Exception e) { e.printStackTrace(); } }
1
public int returnHighestBin () { try { int a,highBin=-1; int highVal=Integer.MIN_VALUE; for (a=0;a<circBufferCounter;a++) { if (circDataBuffer[a]>highVal) { highVal=circDataBuffer[a]; highBin=a; } } return highBin; } catch (Exception e) { JOptionPane.showMessageDialog(null,"Err...
3
@SuppressWarnings("deprecation") public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (taskId >= 0) { return true; } System.out.println("METRICS STARTING"); // Begin hitting the server with glorious data ...
6
private void showFileOpenDialog(){ JFileChooser fileOpen = new JFileChooser("./"); // FileNameExtensionFilter filter = new FileNameExtensionFilter( // "Algorythm workspace files .wks", "wks"); // fileOpen.setFileFilter(filter); int ret = fileOpen.showDialog(null, "Open file"...
2
private void giveTreasurePoints() { for (int i = 0; i < bombers.length; i++) { if (bombers[i].getTile() != null) { bombers[i].getTile().collectTreasure(); } } }
2
public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // ID return ID; case 2: // NAME return NAME; case 3: // PRICE return PRICE; default: return null; } }
3
private static void handleInput(int nGramLength) { NGramWrapper ngw = new NGramWrapper(nGramLength); ngw.readFile(new File("/Users/JAsketorp/Documents/DD2380/smsCorpusAsText.txt")); System.err.println("Corpus:"); System.err.println("Number of sentences: "+ngw.numberOfSentences); ...
5
public void checkShipInBox(){ // If the pirate ship is in the red box if(checkedAlready) { if( (pirateShip.getxCoord() < (boxX+(boxWidth-95)) && pirateShip.getxCoord() > boxX) && (pirateShip.getyCoord() < boxY+(boxHeight+20) && pirate...
5
@Override public void master() { log.debug("master"); }
0
public static void main(String[] args) { // 多态创建建造者(部件) Builder builder = new ConcreteBuilder(); // 根据建造着实例化指导者 (构建过程) Director director = new Director(builder); // 利用指导者来创建 director.construct(); // 表现 Product product = builder.getResult(); System.out.println(product); System.out.println(product.get...
0
public static void main(String args[]) throws InterruptedException { // Delay, in milliseconds before // we interrupt MessageLoop // thread (default one hour). long patience = 1000 * 60 * 60; // If command line argument // present, gives patience // in seconds. ...
5
public static void main(String[] args) throws IOException { String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://127.0.0.1:3306/export"; String user = "root"; String password = "root"; /** * Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnect...
6
private void runExperiment1(int[] query) { System.out.print("How many rounds you want? "); int round = scanner.nextInt(); SGM sgm = new SGM(); TJSGM tjsgm = new TJSGM(); PRM prm = new PRM(); long[][][][] result = new long[3][round][query.length][4]; for (int j = 0; j < round; j++) { for (int i = 0; i <...
9
public String getFromToString() { River r = trip.getRiver(); if (r == null) { return "<?> \u25BA <?>"; } return r.getTripFrom() + " \u25BA " + r.getTripTo(); }
1
public static boolean isChunkIDEuqal(byte[] one, int oneOffset, byte[] another, int anotherOffset) { if (one != null && another != null && one.length >= 4 + oneOffset && another.length >= 4 + anotherOffset) { ...
6
static final int method3958(int i, Class68 class68, Class304 class304) { if (class68 == Class68.aClass68_1183) { if (AbstractMouseEvent.aClass304_7103 != class304) { if (Class108.aClass304_1662 == class304) return 21; if (Class348_Sub40_Sub38.aClass304_9471 == class304) return 28; if (Class34...
8
private void checkPruned(String method) { if (wasPruned) throw new RuntimeException(method + "(): " + getName() + " was pruned."); }
1
public void setDocument(Document doc) {this.doc = doc;}
0
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Use /title ? for help."); return true; } try { if (!cmdMap.dispatch(sender, args)) { sender.sendMessage(ChatColor.RED + "Unknown com...
3
private int findFreeId() { for (int i=0; i<corridors.length; i++) { if (corridors[i] == null) { //check if null's have to be put return i; } } int onGoingId = corridors.length; doubleSize(); return onGoingId; }
2
public Tile getTile(int id) { if (id < 0 || id >= tiles.length) return Tile.VOID; return tiles[id]; }
2
@Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { if (!Configuration.isRequestFromTaskQueue(req, resp)) { return; } String devicesJSon = req.getParameter("devices"); if (devicesJSon == null) { log.warning("Missing 'devices' argument on tas...
3
public int getAge() { return age; }
0
public static void readConfig() { try { if(curDir.exists()) { BufferedReader in = new BufferedReader(new FileReader(curDir)); String inLine; for(; (inLine = in.readLine()) != null;) { String[] parseVar = inLine.split(":"); if(parseVar[0].startsWith("eUser")) setEmailUser(pa...
8
protected Object instanceToArray(Instance instance) throws Exception { int index; int count; int i; Object result; // determine number of non-zero attributes count = 0; for (i = 0; i < instance.numValues(); i++) { if (instance.index(i) == instance.classIndex()) c...
8
@Test public void testReceiveMultiple() { int noOfMessages = 5; try { consumer = new AbstractMessageConsumer(mockTopic) { }; assertNotNull(mockTopic.getTopicSubscriber()); HashSet<Message> messages = new HashSet<Message>(); for (int i = 0; i < noOfMessages; i++) { Message msg = new MockMessage(...
4
public void delete(int idEntidadBancaria){ try{ String deleteEntidad = "DELETE FROM entidadBancaria where idEntidad = ?"; Connection connection = connectionFactory.getConnection(); PreparedStatement prepared = null; prepared = connection.prepareStatement(deleteEntidad); p...
2
@FXML private void handleMenuSuppliers(ActionEvent event) { final Node pos = rootPane.getChildren().get(0); if (pos.getId().equals("borderPaneRegister")) { return; } final Region registerItem; try { registerItem = FXMLLoader.load(PosApplication.class....
2
@Override int utrDistance(Variant seqChange, Transcript tr) { int cdsStart = tr.getCdsStart(); if (cdsStart < 0) return -1; if (isStrandPlus()) return cdsStart - seqChange.getEnd(); return seqChange.getStart() - cdsStart; }
2
private Comparison.Op cmp_op() { switch (peekType()) { case LT: consume(LT); return Comparison.Op.LT; case LE: consume(LE); return Comparison.Op.LE; case EQ: consume(EQ); return Comparison.Op.EQ; case GE: consume(GE); return Comparison.Op.GE; case GT: consume(GT); return Compar...
6
@Override public boolean equals(Object ob) { if(ob instanceof Poblacion) { Poblacion p = (Poblacion)ob; //if(this.individuos.length != p.individuos.length) { if(this.indi.size()!=p.indi.size()) { return false; } //int n = this.i...
4
protected int emptyNeeded() { State[] states = automaton.getStates(); int needed = 0; for (int i = 0; i < states.length; i++) for (int j = 0; j < states.length; j++) if (automaton.getTransitionsFromStateToState(states[i], states[j]).length == 0) needed++; return needed; }
3
@Test public void testLongCoding() { class Valider { byte[] buf = null; void valid(long l) { buf = BytesUtils.encodeLong(l); long bl = BytesUtils.decodeLong(buf, new Offset()); if (bl != l) { System.err.println(String.format("Wrong with %d while bl = %d, and buf = %s", l, bl , Arrays.to...
2
public float getTexHeight() { if(animation != null) { return animation.getFrameHeight(); } return tex.getHeight(); }
1
public void disposeEditors(String editor){ // Dispose the editor do it doesn't leave a ghost table item if(actionEditor.getEditor() != null && ((editor.equals("action") || editor.equals("all")))) actionEditor.getEditor().dispose(); if(matchEditor.getEditor() != null && ((editor.equals("match") || editor.equ...
6
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((compartment == null) ? 0 : compartment.hashCode()); result = prime * result + ((hasOnlySubstanceUnits == null) ? 0 : hasOnlySubstanceUnits .hashCode()); result = prime * result + ((id == n...
4
@Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { return id; }
0
@Override public int compare(Integer index1, Integer index2) { // TODO Auto-generated method stub if(map.get(index1) < map.get(index2)){ return 1; }else if(map.get(index1) == map.get(index2)){ return 0; }else{ return -1; } }
2
@Override public StaticChoice askChoice(boolean cancel) { String playerName = control.getPlayer().getName(); System.out.println(playerName + ", " + promptMessage); int choice = -1; List<StaticChoice> choices = new ArrayList<>(); choices.addAll(Arrays.asList(control.getMenuName().getChoices())); choices.re...
7
public void setSecretAlphabeticCipher(String secretAlphabeticCode) { secretAlphabeticCode = secretAlphabeticCode.toLowerCase(); StringBuffer sb = new StringBuffer(secretAlphabeticCode); for (int z=0; z<sb.length(); z++) { char buchstabe = sb.charAt(z); for (int i...
8
public boolean compareUserList(ArrayList<User> userList) { for (int i = 0; i < usersDecryptedTable.size(); i++) { if (!usersDecryptedTable.get(i).getID() .equals(userList.get(i).getID())) { return false; } } return true; }
2
private boolean verify_IN_Hierarchy(boolean conclusion, Set<Node> toVerifyNodes, Set<Node> verifiedNodes) { final Iterator itr = toVerifyNodes.iterator(); Node cur = (Node) itr.next(); toVerifyNodes.remove(cur); if (verifiedNodes.contains(cur)) { conclusion = false; ...
3
private NoeudArbre rechercheClefList(E clef) { NoeudArbre<E> result = NIL; int i = 0; while (result == NIL && i < listNoeudArbres.size()) { if (listNoeudArbres.get(i).clef.compareTo(clef) == 0) { result = listNoeudArbres.get(i); } i++; ...
3
public boolean equals(Stats stats) { return stats != null && getPlayCount() == stats.getPlayCount() && getTotalHits() == stats.getTotalHits() && getTotalScore() == stats.getTotalScore() && getRank() == stats.getRank(); }
4
public Tile nearestUndefendedCity() { City nearest = null; if (owner.cities.size() > 0) { for (int i = 0; i < owner.cities.size(); i++) { City candidate = owner.cities.get(i); if (candidate.location.occupants.size() > 1) continue; else if (candidate.location.occupants.size() < 3) if (...
8
public TwitterBullingAnalysisMain(String pathToSWN) throws IOException { // This is our main dictionary representation dictionary = new HashMap<String, Double>(); // From String to list of doubles. HashMap<String, HashMap<Integer, Double>> tempDictionary = new HashMap<String, HashMap<Integer, Double>>(); Bu...
9
public void run() { InputStream lIn = null; OutputStream lOut = null; try { // Get the streams. lIn = socket.getInputStream(); lOut = socket.getOutputStream(); if(!login(lIn, lOut, uid, pwd)) return; // Start the ...
7
public boolean treesSymmetric(treeNode leftRoot, treeNode rightRoot){ if (leftRoot == null && rightRoot == null) return true; if (leftRoot == null || rightRoot == null) return false; return ( leftRoot.value == rightRoot.value && treesSymmetr...
6
public int getPort() { if (rpcURL != null) { return rpcURL.getPort(); } else { return 0; } }
1
public Scenery() { for (int x = 0; x < Realm.WORLD_WIDTH; x++) { for (int y = 0; y < Realm.WORLD_HEIGHT; y++) { if (Realm.world.getTile(x, y) == Tile.GRASS) { int seed = iRandom.nextInt(30); if (seed < 3) { if (seed == 0) scenobjects[x][y] = GameObject.RED_FLOWER; else if (seed ==...
7
public NewsInfoDto getNewsInfoDto(int id) { PreparedStatement stmt = null; ResultSet rs = null; NewsInfoDto newsInfoDto = null; try { stmt = conn .prepareStatement("select author,title,content,creatTime from NewsInfo where id = ? "); stmt.setInt(1, id); rs = stmt.executeQuery(); String tit...
4
public static void setIntBE(final byte[] array, final int index, final int value, final int size) { switch (size) { case 0: return; case 1: Bytes.setInt1(array, index, value); break; case 2: Bytes.setInt2BE(array, index, value); break; case 3: Bytes.setInt3BE(array, index, value); ...
5
public Object nextEntity(char ampersand) throws TXMLException { StringBuffer sb = new StringBuffer(); for(;;) { char c = next(); if(Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if(c == ';') { break; } else { throw syntaxError("Missing ';' in TXML en...
5
public void mouseEntered(MouseEvent evt) { if (evt.getSource()==commercial){ mousein = 1; } if (evt.getSource()==residential){ mousein = 2; } if (evt.getSource()==industrial){ mousein = 3; } if (evt.getSource()==lumbermill){ mousein = 4; } if (evt.getSource()==government){ ...
7
public static void main(String[] args) { ArrayList<ArrayList<String>> puzzle = loadFile("puzzle.txt"); State parent = new State(puzzle); System.out.println("Welcome to Josh's Sokoban searcher!"); System.out.println("1) Breadth first search"); System.out.println("2) Depth first search"); System.out.pr...
7
@Test public void test_pauser() throws Exception { stop_tunnel_in(1000); final String lipsum = StringUtils.lipsum(20); final long start = System.currentTimeMillis(); new StringTrafficker(getInt("pauser_local_port"), getInt("pauser_remote_port"), new St...
0
public void setDefaults() { //Default objects final Map<String, Object> defaults = new LinkedHashMap<String, Object>(); defaults.put("Language", "English"); ArrayList<String> defaultPrintingCosts = new ArrayList<String>(); ArrayList<String> defaultClearingCosts = new ArrayList<String>(); //Default va...
2
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : ""; if((!mob.isAttributeSet(MOB.Attrib.SYSOPMSGS) && (parm.length()==0))||(parm.equalsIgnoreCase("ON"))) mob.setAttribute(MOB.Attri...
9
public void setPriceForMultiple(ArrayList<Stock> sList) { HashMap<String, Float> priceMap = new HashMap<>(); for (Stock s : sList) { priceMap.put(s.getIdentifier(), s.getPrice()); } NodeList nl = doc.getDocumentElement().getElementsByTagName("stock"); for (in...
3
protected void buildOutlineElement(Node node, String lineEnding, StringBuffer buf) { // buf.append("<").append(ELEMENT_OUTLINE).append(" "); // // if (node.getCommentState() == Node.COMMENT_TRUE) { // buf.append(ATTRIBUTE_IS_COMMENT).append("=\"true\" "); // buf.append(ATTRIBUTE_IS_COMMENT_INHERITED).append("=\...
0
public Object nextValue() throws JSONException { char c = nextClean(); String s; switch (c) { case '"': case '\'': return nextString(c); case '{': back(); return new JSONObject(this); case '[': ...
8
public static void main(String[] args) { /* * Scanner keyboard = new Scanner(System.in); * System.out.print("Please enter your age: "); int age = * keyboard.nextInt(); * * switch (age) { case 21: System.out.println( * "You are 21 and the same age as Miley Cyrus! Not sure if that's good or bad." ...
6
public static char three(int r, int c, int f) { if (s4(r, c, f) || s5(r, c, f)) return '|'; else if (s3(r, c, f) || s6(r, c, f) || s7(r, c, f)) return '_'; return '.'; }
5
public String determineSign(int[] A) { int n = 0; for(int i = 0;i < A.length;i++){ if(A[i] < 0){ n++; }else if(A[i] == 0){ return "ZERO"; } } if(n % 2 == 0){ return "POSITIVE"; }else{ return "NEGATIVE"; } }
4
public void stud_avg_cal(BuyOrder order) { int su = 0; for(Student stud : order.getStudList()) { int sum = 0; int i2 =0; for(Double i : getJum()) { sum += stud.getJum().get(i2) * i; i2++; } ...
4
@SuppressWarnings({ "unchecked", "unused" }) static String parseSingle(Element element) throws JdaoHandlerException { String tableName = element.attributeValue("name"); List<Element> lists = element.elements("field"); String Tablename = Utils.upperFirstChar(Utils.delUnderline(tableName)); StringBuilder sb = ne...
7
public GameActor createActor(String resource) { // if not yet created, create a new prototype if(!actors.containsKey(resource)) { createPrototype(resource); } GameActor actor = actors.get(resource); GameActor returned = factory.createActor(resource); ...
1
public static void outPutRailcarItinerary(ArrayList<ArrayList<Block>> bl){ try{ jxl.Workbook readWorkBook = jxl.Workbook.getWorkbook(new File("Output_File.xls")); //唯讀的Excel工作薄物件 jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("Output_File.xls"), readWorkBook); //寫入 jxl.write....
7
@Override public ExecutionContext run(ExecutionContext context) throws InterpretationException { int x = context.ui.dw.turtle.getPosX(); int y = context.ui.dw.turtle.getPosY(); Value value = ((AbsValueNode) this.getChildAt(0)).evaluate(context); if (value.getType() == VariableType.N...
3
public RigidBody getRigidBody(TransformGroup transformGroup) { for (Iterator<RigidBodyContainer> it = rigidBodies.iterator(); it .hasNext();) { RigidBodyContainer container = (RigidBodyContainer) it.next(); if (container.transformGroup == transformGroup) { return container.rigidBody; } else if (conta...
3
private void updateGame(Scene scene){ // Update the input devices: for (InputDevice device : inputDevices.values()) device.update(); // Check scheduled Callbacks: scene.checkCallbacks(); // Update the game: if (!isFrozen()){ ...
4
public void handleNextButton() { if(!isChild){ ListModel<String> tapeAlphabetList = startView.getTapeAlphabetList().getModel(); ListModel<String> inputAlphabetList = startView.getInputAlphabetList().getModel(); ListModel<String> stateList = startView.getStateList().getModel(); ...
5
public listUser() { this.info = "list all users"; }
0
void setNames(String leftName, String rightName) { leftScorePanel.setName(leftName); rightScorePanel.setName(rightName); }
0
public String getClipboardContents() { String result = ""; Transferable contents = clipboard.getContents(null); boolean hasTransferableText = contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor); if (hasTransferableText) { ...
4
public static void main(String[] args) { ExemploExecuteStatementSP obj = new ExemploExecuteStatementSP(); Scanner var = new Scanner(System.in).useDelimiter(System.getProperty("line.separator")); String nome = null; while (true) { try { System.out.println("OBS.: Caso a tabela agenda não exista excutar a c...
9
private void insertNumbers() { Board board = getBoard(); BoardNumbers[] boardNumbers = new BoardNumbers[4]; for (int i = 0; i < boardNumbers.length; i++) { boardNumbers[i] = new BoardNumbers(); } /* Easter (New Year) egg */ int year = 0; DateFormat dateFormat = new SimpleDateFormat("yyyy", Locale...
9
void showInfo(Graphics2D g, Subject s) { final int x = 320; final int y = 560; g.setColor(shadow); g.fillRect(0, y, 1200, 160); g.setColor(border); g.drawLine(0, y, 1200, y); drawer.setStyle(mainFont); if (s != null) { Meta meta = s.meta...
5
public boolean removeFile( String removeFile ) { // if the file does not exist in the list of the files parsed, exit // the method if( ! filesParsed.contains( removeFile ) ) { return false; } // create an iterator to parse through all the key value s...
4
public String getOldestPerson() throws ParseException { String name = ""; long age = 0; for (String[] item : data) { long ageInSeconds = getAgeInSeconds(item[DOB_INDEX].trim()); if (ageInSeconds > age) { age = ageInSeconds; name = item[NAME...
2
public void run() throws Exception { connection = DriverManager.getConnection(dbUrl); // create projects PreparedStatement ps = connection .prepareStatement("select jg_key, jg_name, jg_description" + " from t_project"); ps.execute(); Result...
9
private void ParseOutElements(org.w3c.dom.Element parentElement) { Node child = parentElement.getFirstChild(); while (child != null) { if (! handleGeneralProperty(child)) { String nodeName = child.getNodeName(); // Room specific properties: type, border[ ], container[ ], item[ ], creature[ ] if (node...
7
private void loadBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadBrowseButtonActionPerformed JFileChooser f = new JFileChooser(loadFromField.getText()); File fi = new File(loadFromField.getText()); if(fi.isDirectory()) { f.setCurrentDirectory(fi); ...
4