text
stringlengths
14
410k
label
int32
0
9
public String generate() { String error = "No errors."; if (details) System.out.println("Temperature flags: PRODUCE="+ioflags.PRODUCE+", SAVE="+ioflags.SAVE+", LOAD="+ioflags.LOAD); if (Utils.flagsCheck(ioflags) != 0) { System.out.println("ERROR: IOFlags object is corrupted, error: "+Utils.flagsCheck(...
4
public void doHit() { if (goinUp < 20) { setY(getY() - 5); } else if (goinUp < 40) { setY(getY() + 5); } goinUp++; }
2
public static void main(String[]args) { int limit = 100; int n = 2; ArrayList<Integer> primes = new ArrayList<Integer>(); for(int i = 2; i <= limit ; i++) { System.out.println("i is " + i); boolean isNotPrime = true; while(isNotPrime) { for(int j = 2; j < i; j++) { if(i % j == 0) ...
6
private static void processMessage(GameState state, byte[] data, String senderGID){ Decoder dec = new Decoder(data); try { if(dec.getTypeByte()==UpdateShip.asnType && state==GameState.PLAYING) { if(DEBUG)System.out.println("processMessage: UpdateShip(start)"); ...
9
public synchronized boolean dispatch() throws IOException { try { while (this.messages.isEmpty()) { wait(); } } catch (InterruptedException ex) { //The thread was interrupted, silent failure. System.out.println("Thread interrupted"); return false; } Message msg = this.messages.remove(0...
5
public int decodeInstruction(int instruction) { switch (instruction & 0b11110000) { case 0b00000000: return 0; case 0b00010000: return 16; case 0b00100000: return 32; case 0b00110000: return 48; case 0b01000000: return 64; case 0b01010000: return 80; case 0...
8
private void searchZipCode(String zipcodeOrg) { lstM.clear(); //郵便番号検索 String serchZip = zipcodeOrg.replaceAll("-", ""); int serchL = serchZip.length(); if ((serchL == 3) || (serchL == 5) || (serchL == 7)) { //3桁・5,7桁指定 //CSVファイルの読み込み ...
8
public static QuestionEquation decode(String str) throws DecodeException { QuestionEquation res; if (str.substring(0, 17).compareTo("#QuestionEquation") == 0) { res = new QuestionEquation(); int i = 17; if (str.charAt(i) == '<') { while (str.charAt(i) ...
9
private void attachPushedMBlocks(Direction dir) { int x = 0; int y =0; if (dir == Direction.LEFT) x = -1; else if (dir == Direction.RIGHT) x = 1; else if (dir == Direction.UP) y = -1; else if (dir == Direction.DOWN) y = 1; for (MBlock b : mBlocks) { Point p = b.location(); if (gBlock.getAttachedPoin...
9
public void printSubtree(int spaces) { if (child4 != null) { child4.printSubtree(spaces + 5); } if (keys == 3) { for (int i = 0; i < spaces; i++) { System.out.print(" "); } System.out.println(key3); } if (child3 != null) { child3.printSubtree(spaces + 5); }...
9
@Override public JList load() { if (loaded) return this; String body = null; try { body = JHttpClientUtil.postText( context.getUrl() + JHttpClientUtil.Lists.URL, JHttpClientUtil.Lists.GetList.replace("{listName}", String.format("{%s}", get...
9
public void actionPerformed(ActionEvent e){ //button 1 if(e.getSource()==XD){ //change button function when a player wins to change if(win) { for(Player p : players) { p.update(gametrack.getStart()) ; } gamedeck.shuffle() ; counter.setText(pl1.getName() + "'s turn"); ...
7
public void setAmount(double amount) { this.amount = amount; }
0
public static Long getLongValue(String key){ return Long.valueOf(getStringValue(key)); }
0
@Override public Date deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JsonProcessingException { String value = jp.getText(); if (value.contains("y")) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, Calendar.JANUARY); cal....
5
public boolean validaComponenteProtheus(String produto, String componenteDigitado) { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; String setor = jComboBoxSetor.getSelectedItem().toString(); String sql = "select G1_COD, G1_COMP, G1_QUANT fr...
9
@Override public File download(URI uri) throws FileSizeLimitExceededException, FileDownloadException { InputStream input = null; OutputStream output = null; try { log.debug("Connecting to {}", uri); HttpClient client = new DefaultHttpClient(); HttpGet ge...
9
private InferenceParameter getInferenceParameter(CycSymbol parameterName) throws RuntimeException { InferenceParameterDescriptions descriptions = getDefaultInferenceParameterDescriptions(); if (descriptions == null) { throw new RuntimeException("Cannot find inference parameter descriptions"); } In...
2
@SuppressWarnings("unused") private static void RollADiceAgain(){ Scanner keyboard = new Scanner(System.in); Random r = new Random(); int roll1 = 1 + r.nextInt(6); int roll2 = 1 + r.nextInt(6); int tries = 1; String input = ""; System.out.println("HERE COME THE DICE!\n"); do{ System.out.printl...
5
public static String decimalToBinary(int decimal) { String binary = ""; while (decimal != 0) { if (decimal % 2 == 0) binary = "0" + binary; else binary = "1" + binary; decimal = decimal / 2; } for (int i = binary.length(); i < 16; i++) { binary = "0" + binary; } return binary; }
3
@Override public double getElementAt(int row, int column) throws OutOfBoundsException { if (row > _rowNum || column > _colNum || row < 1 || column < 1) { throw new OutOfBoundsException(); } return _values[row-1][column-1]; }
4
public List<Class<? extends APacket>> getPackageClassList(){ return new ArrayList<>(classes); }
1
private void validateOptions() { // No validation if we found a help parameter if (m_helpWasSpecified) { return; } if (!m_requiredFields.isEmpty()) { StringBuilder missingFields = new StringBuilder(); for (ParameterDescription pd : m_requiredFields.values()) { missingFields.append(pd.getNa...
6
public void update(long nowTime) { // TODO: probably we should do something else here. if ((m_dt = nowTime - m_lastUpdate) < m_updateFreq) { return; } float dThetaMax = 0.01f; float vMax = 2.1f; double accMax = 0.01f; float dt = 1; Point2D.Float v = new Point2D.Float(); for (Entity e : m_world.ge...
5
private boolean isAttacking(){ if(state == StateActor.ATTACKINGUP || state == StateActor.ATTACKINGDOWN || state == StateActor.ATTACKINGLEFT || state == StateActor.ATTACKINGRIGHT){ return true; } else return false; }
4
public static int computeMaximumCardinality(NamedDescription relation, Stella_Object instance) { { Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get(); try { Native.setBooleanSpecial(Logic.$REVERSEPOLARITYp$, false); { Surrogate relationref = relation.surrogateValueInverse; ...
9
private void automaticallyCreateOrders() { createSupplyProductList(); orderStockItemList = new ArrayList<StockItem>(); for (int i = 0; i < 308; i++) { for (ArrayList<Product> list : productList) { orderStockItemList = new ArrayList<StockItem>(); for (Product product : list) { int randomQuantity =...
4
public ShellCommand lookupCommand(String discriminator, List<Token> tokens) throws CLIException { List<ShellCommand> collectedTable = commandsByName(discriminator); // reduction List<ShellCommand> reducedTable = new ArrayList<ShellCommand>(); for (ShellCommand cs : collectedTable) ...
7
public long getMilliseconds() { return milliseconds; }
0
@Override public void saveToFile(ArrayList<ArrayList<String>> code, String filename) { if (code != null && filename != null) { if (!filename.endsWith(".cecil")) { filename += ".cecil"; } Program program = new Program(code); File file = model.programToFile(program, filename); view.setFilename(file....
3
@RequestMapping(value = {"/TransaccionBancaria"}, method = RequestMethod.POST) public void insert(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @RequestBody String json) throws JsonProcessingException { try { ObjectMapper objectMapper = new ObjectMapper(); ...
4
public static void main(String[] args) throws Exception { int ponder = 5; if(args.length > 0) { ponder = Integer.parseInt(args[0]); } int size = 5; if(args.length > 1) { size = Integer.parseInt(args[1]); } ExecutorService exec = Executors...
6
void removeColumn (CTableColumn column, int index) { int columnCount = parent.columns.length; if (columnCount == 0) { /* reverts to normal table when last column disposed */ cellBackgrounds = cellForegrounds = null; displayTexts = null; cellFonts = null; fontHeights = null; GC gc = new GC (parent); com...
9
@Override public Collider getCollider() { if(hover == null) hover = new Vector2(0,0); Vector2 point1 = this.point1.x==-1 ? hover : this.point1; Vector2 point2 = this.point2.x==-1 ? hover : this.point2; return point1.getColliderWithDim(point2.subtract(point1)); }
3
public void initTiles() { Tile voidTile = new Tile(game); for(int i = 0; i < 64; i++) { for(int j = 0; j < 46; j++) { voidTile = null; voidTile = new Tile(game); tileArray[i][j] = voidTile; } } }
2
public static void clearFilter(){ if (results.containsKey(currentTab) && sorters.get(getCurrentTab()) != null ) sorters.get(getCurrentTab()).setRowFilter(null); }
2
public void DrawSingleNode (Node node, Graphics2D g2d) { int nLvl; if (asap) nLvl = node.GetASAPLevel (); else nLvl = node.GetALAPLevel (); int nSeq = node.GetSeqNo (); int pLvlSize = (nodeLevels.get (currentLevel - 1)).size (); if (nLvl == currentLevel) { if (pLvlSize >= 1) currentX +...
9
public static ArrayList<Kill> findVictim(ArrayList<Kill> killboard, String victim) { ArrayList<Kill> resultBoard = new ArrayList<Kill>(); for (Kill K : killboard) { if (K.getVictim().findAttribute(victim)) { resultBoard.add(K); } } return resultBoard; }
2
@Test public void test() { Suggestion suggestion = (Suggestion) MongoHelper.fetch(mySuggestion, "suggestions"); if (suggestion == null) { TestHelper.failed("suggestion not found"); } suggestion.setSubject("Test Subject"); if (!MongoHelper.save(sug...
6
public static void main(String[] args) { Context ctx = new Context(new ConcreteState_Morning()); // 呼び出すたびに状態がかわる。 ctx.doSomething(); ctx.doSomething(); ctx.doSomething(); }
0
public void restButtons(String type) { ResultSet rs = null; for (JButton but : restButtons) { this.remove(but); } restButtons.clear(); try { db = new JDBC(); rs = db.getRestByType(type); int x = 200; int y = 65; int count = 0; while (rs.next()) { String str = rs.getString("name"); ...
6
public static void printNewUserToXMLFile(String userName, String password, String id){ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = null; Document doc = null; try { db = dbf.newDocumentBuilder(); } catch (ParserConfiguratio...
5
public List<Interval> merge(List<Interval> intervals) { List<Interval> res = new ArrayList<>(); Collections.sort(intervals,new Comparator<Interval>() { @Override public int compare(Interval o1, Interval o2) { if(o1.start < o2.start) return 1; ...
9
private Alphabet(int codeLength, int alphabetSize, String[] letters, Map<String, Byte> letterIndices, Map<Byte, Byte> reverseComplements) { if (Math.pow(alphabetSize, codeLength) != letters.length) { throw new IllegalArgumentException("letters array size should be equal to alphabetSize ** codeLength"); } ...
8
@Override public RowCol getBestBox() { int minPos = 10; int row = -1; int col = -1; int countMinPos = 0; for (int r = 0; r < 9; r++) { for (int c = 0; c < 9; c++) { int size = grid[r][c].getPossibleValues().size(); if (size != 0) { if (size == minPos) { countMinPos++; } else if ...
9
public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(br.readLine()); for(int i = 0; i < n; i++){ String[] words = br.readLine()...
5
public void setStatustextFonttype(Fonttype fonttype) { if (fonttype == null) { this.statustextFontType = UIFontInits.STATUS.getType(); } else { this.statustextFontType = fonttype; } somethingChanged(); }
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); String forwardTo = ""; if (action != null) { if (action.equals("creerUtilisateursDeTest")) { ...
9
public double noise(double xin, double yin){ double s = (xin + yin) * F2; int i = fastFloor(xin + s); int j = fastFloor(yin + s); double t = (i+j) * G2; double X0 = i - t; double Y0 = j - t; double x0 = xin - X0; double y0 = yin - Y0; int i1, j1; if(x0 > y0){ i1 = 1; j1 = 0; }else{ i1 ...
4
public Instances defineDataFormat() throws Exception { // initialize setOptions(getOptions()); checkCoverage(); Random random = new Random (getSeed()); setRandom(random); Instances dataset; FastVector attributes = new FastVector(3); Attribute attribute; boolean classFlag = getClas...
9
public boolean isRecordWithNumber(int rowId, Object[] row){ final int orderColumnNum = 0; final int startColumnNum = 1; try{ if(records != null){ for(ArrayList<String> l : records){ if(Integer.parseInt(l.get(orderColumnNum)) == rowId){ for(int i=0;i<l.size()-1;i++){ String rowValue...
6
private Token getTokenConstant(char[] input, int start) { TokenConstant token = null; Pattern pattern = getPattern("^[0-9]"); Matcher matcher = pattern.matcher(String.valueOf(input[start])); if (matcher.find()) { pattern = getPattern("^[0-9]*\\.?[0-9]+"); String subString = getSubString(input, start, MAX_...
5
@Override public void keyTyped(KeyEvent event) { char ch = event.getKeyChar(); if (ch == '\n' || ch == '\r') { if (mModel.hasSelection()) { notifyActionListeners(); } event.consume(); } else if (ch == '\b' || ch == KeyEvent.VK_DELETE) { if (canDeleteSelection()) { deleteSelection(); } e...
6
public int read() throws IOException { boolean weiter = false ; int back = 0 ; while ( !weiter ) { back = inStream.read() ; if (back > -1) { if ( back != '#') // no comment sign { if (comment) // comment found in previous loop { if ...
5
public static HashMap<String, ItemMold> loadItems(){ HashMap<String, ItemMold> terrainMap = new HashMap(); try{ // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("resources/configfiles/items.txt"); /...
6
public static void handleEvent(int eventId) { if(eventId == 1) { System.out.println("Exit high score menu selected"); Main.highScoreMenu.setVisible(false); Main.highScoreMenu.setEnabled(false); Main.highScoreMenu.setFocusable(false); Main.mainFrame.remove(Main.highScoreMenu); Main.main...
5
public static String encryptMD5(String pwd) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(pwd.getBytes()); StringBuffer stringBuffer = new StringBuffer(); int n; byte[] b = md.digest(); for (int i = 0; i < b.length; i++) { n = b[i]; if (n < 0) { ...
4
@Override public double predict(T data) { if (log) System.out.println("Trying to predict: " + data.getNome()); double result = 0; for(int i = 0; i < w.length; i ++) { if (log) System.out.print("w[" + i+ "]=" + w[i] +" "); result += w[i]*data.getAttr(i); } if (log) { System.out.println(); ...
5
public void mouseClicked(MouseEvent e) { if (isInside(e.getX(), e.getY())) { if (first == null) { first = this; select(); } else { this.deselect(); first.deselect(); panel.permut(this, first); first = null; } } }
2
@Override public Object getValueAt(int row, int col) { switch(col) { case 0: int x = row+1; switch(x) { case 1: return "Sunday"; case 2: return "Monday"...
9
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if(getValueAt(0, column)==null) return String.class; returnValue = getValueAt(0, column).getClass(); ...
3
public static int[] getPixels(BufferedImage img, int x, int y, int w, int h, int[] pixels) { if (w == 0 || h == 0) { return new int[0]; } if (pixels == null) { pixels = new int[w * h]; } else if (pixels.length < w * h) { ...
6
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace(); } finally { if (gzos != null) { try { ...
3
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
7
public void run() { while(!killed()) { long nextFlushLocal = nextFlush.get(); long currentTime = System.currentTimeMillis(); //System.out.println("next flush local: " + nextFlushLocal + " currentTime " + currentTime); if(nextFlushLocal != 0 && nextFlushLocal < currentTime + 2) { //if(l...
6
public Class getTypeClass() throws ClassNotFoundException { if (clazz != null) return Class.forName(clazz.getName()); else if (ifaces.length > 0) return Class.forName(ifaces[0].getName()); else return Class.forName("java.lang.Object"); }
2
final void method1970(int i, int i_61_, int i_62_, boolean bool, int i_63_, int i_64_, int i_65_, int i_66_, byte[] is, int i_67_) { if (i_63_ == 0) i_63_ = i_62_; anInt8539++; if (bool) { int i_68_ = Class183.method1382(i_65_, -6409); int i_69_ = i_68_ * i_62_; int i_70_ = i_63_ * i_68...
6
public TetrisEngine(){ this.score = 0; this.fLines = 0; this.toggle = true; // @todo pull initialization out of constructor and add to variable definitions t = new Tetrimino(); b = new Tetrimino(); next = new Tetrimino(); p = new Playfield(); pause = false; gameStatus = true; gui = new Te...
7
public void addPersoon(Geslacht geslacht, String[] vnamen, String anaam, String tvoegsel, GregorianCalendar gebdat, Gezin ouderlijkGezin) { if (geslacht != null && vnamen != null && anaam != null && tvoegsel != null && gebdat != null) { Persoon persoon = new Persoon(nextPersNr, vnamen, a...
5
public void insertString( int off, String string, AttributeSet abr ) throws BadLocationException { if ( string == null ) { return; } boolean ok = true; char[] chars = string.toCharArray(); for ( int i = 0; i < chars.length; i++ ) { ...
5
public String to(String field, int min, int max) { String newField = ""; for(int i = 1; i <= field.length(); i++) { if(isNumber(field.substring(i - 1, i))) { newField = newField + field.substring(i - 1, i); } else {...
8
public static void main(String[] args) { //creates an array to store student data LAB6 CLASS[] = new LAB6[11]; //basic counter and [i] is place in the array int i,j,k = 0,counter=0; boolean is_running=true; //creates new columns for the array for(i=0;i<CLASS.length;i++) CLASS[i]= new LAB6(); //defines...
8
public static JsonObject getJsonForURL(String url, List<ResponseErrors> possibleErrors) { HttpURLConnection connection = null; StringBuilder builder = null; JsonObject json = null; try { URL inputURL = new URL(url); connection = (HttpURLConnection) inputU...
7
@Test public void testRetirarProduto() { try { Assert.assertEquals(10, facade.getQuantidadeProduto(1)); } catch (FacadeException e) { Assert.fail(e.getMessage()); } try { facade.retirarProduto(1, 5); Assert.assertEquals(5, facade.getQuantidadeProduto(1)); } catch (FacadeException e) { Assert.f...
5
@Override public long invert(long element) { isInField(element); if (element == 1) { return 1; } if (element == 0) { throw new MathArithmeticException("Cannot find inverse for ZERO."); } //prepare for division long remainder = elemen...
8
@EventHandler public void GiantInvisibility(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.getGiantConfig().getDouble("Giant.Invis...
6
void close(Dockable dockable) { int count = getComponentCount(); for (int i = 0; i < count; i++) { Component child = getComponent(i); if (child instanceof DockTab) { if (((DockTab) child).getDockable() == dockable) { remove(child); return; } } } }
3
public static void main(String[] args) { Scanner in = new Scanner(System.in); String input = in.nextLine(); String[] inputSplit = input.split(" "); Integer[] num = new Integer[inputSplit.length]; int caunt = 1; int indexI = 0; int sumCaunt =0; ArrayList<Integer> sample = new ArrayList<>(); for (int i ...
8
private int getNumberOfSuits(int suit) { int num = 0; for (int i = 0; i < 5; i++) { if (hand[i].getSuit() == suit) { num += 1; } } return num; }
2
@Test public void kingAndRook() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(KING.toString(), 2); figureQuantityMap.put(ROOK.toString(), 2); int dimension = 7; assertThat("all elements are not present on each board", prepa...
7
public String getConsumerKey() { return consumerKey; }
0
public static <T extends DC> Set<DC> dMax(Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> indexedDelta) { if(indexedDelta!=null) { if(indexedDelta.getNext()!=null) { return new Set(indexedDelta.getFst().fst().delta(indexedDelta.getFst().snd()).diff(),dMax(indexedDelta.getNext())); } else ...
2
public static Cons yieldInitialValueAssignments(Stella_Class renamed_Class, Keyword mode) { { Cons assignments = Stella.NIL; Stella_Object initialvalueassignment = null; { Slot slot = null; Iterator iter000 = renamed_Class.classSlots(); while (iter000.nextP()) { slot = ((Slot...
6
public static void main(String[] args) { int mapsize = 2000; int aircraftAmmount = 50; int objectAmmount = 100; //int [][]m = map.getMap(); float objectMap[][] = new float[objectAmmount][5]; Map map = new Map(mapsize); for (int i = 0; i < objectAmmount; i++) ...
1
public LinkedList<TuileBonus> initialisationTuileBonus(){ LinkedList<TuileBonus> lltb = new LinkedList<TuileBonus>(); for(Troupes t : hashTroupes){ for(Bonus b : hashBonus){ TuileBonus tb = new TuileBonus(t, b); for(int i=1; i<3; i++){ ...
3
public static MoveRequestState swigToEnum(int swigValue) { if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) return swigValues[swigValue]; for (int i = 0; i < swigValues.length; i++) if (swigValues[i].swigValue == swigValue) return swigValue...
5
public boolean isRGB() { return colorType == COLOR_TRUEALPHA || colorType == COLOR_TRUECOLOR || colorType == COLOR_INDEXED; }
2
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSeq...
9
private void read() throws IOException { if (isEndOfText()) { throw error("Unexpected end of input"); } if (index == fill) { if (captureStart != -1) { captureBuffer.append(buffer, captureStart, fill - captureStart); captureStart = 0; } bufferOffset += fill; fill = reader.read(buffer, 0, buf...
5
public EventList() { muffinbag = new EnumMap<Priority, ArrayList<RegisteredListener>>(Priority.class); for (Priority o : Priority.values()) { muffinbag.put(o, new ArrayList<RegisteredListener>()); } synchronized(mail) { mail.add(this); } }
1
public void onRandomTick (World world, int x, int y) { int xa = (world.random.nextBoolean()) ? 1 : -1; int ya = world.random.nextInt(3) - 1; Tile tilea = world.getTile(x + xa, y + ya); if (tilea != null && tilea.id == Tile.dirt.id) { Tile tileb = world.getTi...
5
private void copyRGBtoRGBA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
6
public void validate_insert(String dataBaseName, String tableName, ArrayList<Field> entries) { boolean flag = true; if (check_dataBase(dataBaseName)) { if (check_table(dataBaseName, tableName)) { for (Field element : entries) { if (!check_type(dataBaseName, tableName, element.getValue(), el...
5
public TravelFileBean getFileName(int idx) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; TravelFileBean fileBean = null; String sql = ""; String filename = ""; String fileTmp = ""; try{ conn = getConnection(); sql = "select * from travelfile where i...
9
public static void connectToDatabase() { if(connect != null) return; try{ Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mysql://localhost/CN?user=shas&password=shas"); } catch(ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException e) { e...
3
private void setDimensions(String dataType) { if (dataType.equals("xor")) { Point.nrDimensions = 2; Point.setClasses(new int[]{-1,1}); } else if (dataType.equals("diabetes")) { Point.nrDimensions = 8; Point.setClasses(new int[]{0,1}); } else if (dataT...
7
@Override public boolean containsAll(Collection<?> c) { // TODO Auto-generated method stub return false; }
1
public void showCustomerOrders() { textArea.setText(""); for (int i = 0; i < driver.getOrderDB().getCustomerOrderList().size(); i++) { Order order = (driver.getOrderDB().getCustomerOrderList().get(i)); textArea.append("Order " + order.getId() + " was created by " + order.getCurrentlyLoggedInStaff().getNa...
2
public void init() { TotalBudget.getInstance(); Integer height = null; Integer width = null; Map<String,List<String>> parameters = Window.Location.getParameterMap(); if ( parameters.containsKey("w") && parameters.containsKey("h") ) { height= Integer.parseInt( parameters.get("h").get(0) ); width ...
8
@Override public void messageReceived(IoSession session, Object message) throws Exception { String text = UTFCoder.decode(message); System.out.printf("Recieved : %s \n", text); String[] parameter = parse(text); if(parameter.length>=1){ if (parameter[0].equalsIgnoreCase("prepared")) { this.sendAccept(key...
5