text
stringlengths
14
410k
label
int32
0
9
@Override public EntidadBancaria insert(EntidadBancaria entidad) { PreparedStatement preparedStatement; Connection connection = connectionFactory.getConnection(); try { preparedStatement = connection.prepareStatement("INSERT INTO entidadbancaria(nombre, fechaCreacion, codigoEntid...
3
public MdpApp getAppPassword(File file) { ObjectInputStream ois = null; MdpApp mdpApp = null; try { ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file))); mdpApp = (MdpApp) ois.readObject(); AppUtils.setConsoleMessage("*** FileDAO ***\n mdp crypté : " + mdpApp.getMdpSha256(),...
5
@Override public void propertyChanged(String id, String value) { if(id.equals(PRP_MODE)) { if(this.isVisible()) updateControls(); } if (id.equals(PRP_LANGUAGE_CODE)) { createControls(); if (this.isV...
4
public static String getSkin(Block block) { if (!isApplicable(block)) return null; TileEntitySkull skull = (TileEntitySkull) ((CraftWorld) block .getWorld()).getHandle().getTileEntity(block.getX(), block.getY(), block.getZ()); try { Field field = TileEntitySkull.class.getDeclaredField("c"); field.se...
5
final void method1716(boolean bool) { anInt5897++; int i = ((Class239) this).aClass348_Sub51_3136.method3428 ((byte) -105).method1458(-23688); if ((i ^ 0xffffffff) > -97) ((Class239) this).anInt3138 = 0; if (bool != false) aClass355_5900 = null; if (((Class239) this).anInt3138 > 1 && (i ^ 0xfffffff...
8
private int[] createBowl(int [] platter) { int[] bowl = new int[NUM_FRUITS]; int sz = 0; while (sz < bowlsize) { // pick a fruit according to current fruit distribution int fruit = pickFruit(platter); int c = 1 + random.nextInt(3); c = Math.mi...
1
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Bid other = (Bid) obj; if (bid == null) { if (other.bid != null) return false; } else if (!bid.equals(other.bid)) return...
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); PrintWriter out = response.getWriter(); String username = request.getParameter("username"); String password = request....
2
@Override public String toString() { return String.format("Equivalence { uri: %s, amount: %s, duplicates: %s }", this.uri, this.getAmount(), this.duplicates); }
0
public void moveY(int playerY) { if(!dead){ if(playerY > y){ dy = .3; }else if(playerY < y){ dy = -.3; } if(!knockback){ y += dy; }else{ y += dy * -1; } } }
4
private void fushImage(String url,String httpQueryString,OutputStream outputStream, MydfsTrackerServer storageTracker){ System.out.println("getQueryString():"+httpQueryString); if(httpQueryString!=null){ url = url+"?"+httpQueryString; } System.out.println(url); InputStream inputStream = storageTracker.rec...
7
public static void main(String[] args) { // ûΨһƾ֤ String appId = "000000000000000000"; // ûΨһƾ֤Կ String appSecret = "00000000000000000000000000000000"; // ýӿڻȡaccess_token AccessToken at = WeixinUtil.getAccessToken(appId, appSecret); if (null !...
2
public long remainingSeconds() { if ( !isActive() ) return 0; return whenStarted + seconds - CurrentTime.inSeconds(); }
1
public boolean pushRequest(Request r){ if(conState != ConnectionState.connected){ throw new RuntimeException("Can only send requests on 'connected' connections"); }else if(peer_choking){ throw new RuntimeException("Can only send requests on unchoked connections"); } if(ourRequests.contains(r.index)){ r...
5
public long getLong(int index) throws JSONException { Object object = get(index); try { return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object); } catch (Exception e) { throw new JSONExcepti...
2
@Test public void testGcdBaseCase() { // the base case means that q == 0, so return p int q = 0; int p = 5; int result = BasicMath.gcd(p, q); assertEquals(result, p); }
0
public RushTeam(String name, String displayName) { setName(name); setDisplayName(displayName); switch(displayName) { case "Blue": setColor(ChatColor.BLUE); break; case "Orange": setColor(ChatColor.GOLD); break; default: break; } }
2
private static void testTimeSVM(){ svm_problem prob = new svm_problem(); prob.l = storeFile.length; int noFea = storeFile[0].length-1; prob.x = new svm_node[prob.l][noFea]; prob.y = new double[prob.l]; for (int i = 0; i <prob.l; i++){ svm_node[] nodeList = pro...
7
public UnrestrictedBruteParser(Grammar grammar, String target) { super(grammar, target); }
0
public signUpAdmin(){ JPanel dialogPanel2 = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; //adding the the label for the Username setLocation(560,380); fNameAdd = new JLabel...
6
public void setTileCircuit(Vector2f pos, int circuit, int inputID){ Vector2f temp = TileUtil.getCoordinate(pos); for(Tile tile : tileList ) { if (TileUtil.getCoordinate(tile.getPosition()).equals(temp)){ tile.setCircuit(circuit); tile.setInput(inputID); } } }
2
public BuscaEmpresa() { System.out.println("Instanciando uma Tarefa do tipo BuscaEmpresa " + this); }
0
public static BusSubmodesOfTransportEnumeration fromValue(String v) { for (BusSubmodesOfTransportEnumeration c: BusSubmodesOfTransportEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
2
public void setTexture(String texturePath){ try { texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(texturePath)); } catch (IOException e) { e.printStackTrace(); } }
1
public PartB getPartB() { return partB; }
0
public String getVersionFromManagementDependency(Dependency dependency) { for (DependencyType depType: Arrays.asList(DEPENDENCY_MANAGEMENT_LIST, PLUGIN_MANAGEMENT, PLUGIN_MANAGEMENT_DEPENDENCIES)) { for (Dependency mgtDep: dependencies.get(depType)) { if (mgtDep.equalsIgnoreVersion(d...
5
protected void updateLandingStrip() { if (landingStrip == null || landingStrip.destroyed()) { final LandingStrip newStrip = new LandingStrip(this) ; final Tile o = origin() ; final int S = this.size ; for (int n : TileConstants.N_ADJACENT) { n = (n + 2) % 8 ; newStrip.setPos...
4
static void processCommandLine(String[] arguments) { if (arguments.length > 0) { ArrayList<String> args = new ArrayList<String>(); for (String arg : arguments) { args.add(arg); } while (args.size() > 0) { if ("-a".equalsIgnoreCase(args.get(0))) { //$NON-NLS-1$ args.remove(0); try { ...
9
public void setAddress(Address address) { Address = address; }
0
public static void bfs(int root) { Queue<Integer> q = new LinkedList<Integer>(); Arrays.fill(v, 0, V, false); q.add(root); v[root] = true; while (!q.isEmpty()) { int node = q.poll(); for (int i = 0; i < G[node].size(); i++) { Edge nodde = G[node].get(i); int neigh = nodde.destino; if (!v[nei...
3
void add(float v) { switch(dim) { case 0: x = v; dim ++; return; case 1: y = v; dim ++; return; case 2: z = v; ...
4
public void setStartDate(XMLGregorianCalendar value) { this.startDate = value; }
0
@Override public void propertyChange(PropertyChangeEvent e) { String name = e.getPropertyName(); if (name.equals("page")) { setTitle(getTitle()); } }
1
private void makeDropTarget(final java.io.PrintStream out, final java.awt.Component c, final boolean recursive) { // Make drop target final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget(); try { dt.addDropTargetListener(dropListener); } // end try ...
6
public String getPartName(String xpathExpression){ if (xpathExpression.contains("/")){ String varPart = xpathExpression.substring(0, xpathExpression.indexOf("/")); return varPart.substring(varPart.indexOf(".")+1); }else{ return xpathExpression.substring(xpathExpression.indexOf(".")+1); } }
1
@Override public Object getValueAt(int row, int column) { Mannschaft m = WettkampfTag.get().getMannschaften().get(row); switch (column) { case -1: return m; case 0: return icon; case 1: return m.getName(); case 2: return m.getVerein(); case 3: return m.getRiege() != null ? m.getRiege().get...
8
public CSProperties getParameter() throws IOException { CSProperties p = DataIO.properties(); for (Params paras : getParams()) { String f = paras.getFile(); if (f != null) { // original properties. p.putAll(DataIO.properties(new FileReader(new File(f)), "Parameter")); // check for tables in ...
5
public static double toDouble(Object object) { if (object instanceof Number) { return ((Number) object).doubleValue(); } try { return Double.valueOf(object.toString()); } catch (NumberFormatException e) { } catch (NullPointerException e) { } ...
3
public ArrayList<Tayte> haeTaytteet() throws DAOPoikkeus{ System.out.println("haetaan taytteita"); String sql = "select * from Tayte"; Connection yhteys = avaaYhteys(); ArrayList<Tayte> taytteet = new ArrayList<Tayte>(); PreparedStatement lause; try { lause = yhteys.prepareStatement(sql); Sys...
2
public static By by(String locator) { By by; if(locator.startsWith("//")) by = By.xpath(locator); else if(locator.startsWith("class=")) by =By.className(locator.replace("class=","")); else if(locator.startsWith("css=")) by = By.cssSelector(locator....
9
public Piece createPromotionPiece(boolean isWhite) { return new Queen(isWhite, isWhite ? this.board.whiteQueenImage : this.board.blackQueenImage); }
1
public boolean onCommand(CommandSender cs, Command cmd, String string, String[] args) { Home Home = new Home(MainClass); SetHome SetHome = new SetHome(MainClass); if(string.equalsIgnoreCase("sethome")){ if(!(cs instanceof Player)){ return false; } else SetHome.setHome(cs, cmd, string, args); ...
4
@Override public void Play(PlayerResponse response) { try { List<Card> cards = response.getCards(); if(cards.size() < 4) throw new Exception("not enough cards"); if(mP.getCurrentTurn() == bidPartner.getPosition()) { passCards(bidPartner, bidWinner, cards); mP.setCurrentTurn(bidWinner.getPosi...
6
public void print_heap(Binarynode root) { System.out.println(root.value); if (root.left != null) { print_heap(root.left); } if (root.right != null) { print_heap(root.right); } }
2
public static void writeDataToFile(DataContainer dataContainer) throws IOException { File fileDir = new File(backupFilePath); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileDir), "UTF-8")); Set<TableDescription> tableDescriptions = dataContainer.getTable...
1
private void initControls() throws RemoteException, NotBoundException, MalformedURLException { this.setLocationRelativeTo(null); //setExtendedState(this.getExtendedState() | MAXIMIZED_BOTH) // ############## INITIATE PERSONS ################ List<IPersonDTO> personsDTO = personControl...
9
public Relation readFile(){ BufferedReader reader; String currentLine; try { reader = new BufferedReader(new FileReader(input)); //Read the first line, that will be the relation name storedRelation.relationName = reader.readLine().split(" ")[1]; //Burn one - blank line reader.readLine(); ...
5
void resetEditors (boolean tab) { TableItem oldItem = comboEditor.getItem (); comboEditor.setEditor (null, null, -1); if (oldItem != null) { int row = table.indexOf (oldItem); try { new String (nameText.getText ()); } catch (NumberFormatException e) { nameText.setText (oldItem.getText (NAME_C...
4
@Test public void isEmptyReturnsTrueWhenEmpty() { assertTrue(s.isEmpty()); }
0
private Coordinates getNextCoordinates() throws CloneNotSupportedException { try { Coordinates lastHitCopy = lasthit.clone(); switch (direction) { case 0: if (lasthit.getX() == 9) { return null; ...
9
public void draw() { // Get the loaded materials and initialise necessary variables Material[] materials = couchMesh.materials; Material material; Triangle drawTriangle; int currentMaterial = -1; int triangle = 0; // For each triangle in the object for (triangle = 0; triangle < couchMesh.triangles.len...
8
public void setTrue(TTrue node) { if(this._true_ != null) { this._true_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
3
public void openConnection(String driverClassName, String url, String username, String password) throws IllegalArgumentException, ClassNotFoundException, SQLException { String msg = "Error: url is null or zero length!"; if (url == null || url.length() == 0) { throw new IllegalArg...
4
@Override public synchronized List<String> getDocumentList() throws RemoteException { try { unlockDocument(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } List<String> docum...
5
private boolean WriteConfigFile() { //write status boolean status = false; try { //open the file output stream outStream = new FileOutputStream(System.getProperty("user.dir")+"/Data.csv"); //get the data stream for the file ...
1
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }
0
public double getPriority(T item) throws NoSuchElementException { int index; try { index = map.get(item); } catch (NullPointerException npe) { throw new NoSuchElementException(); } PQElement<T...
1
public int attackNormal( Character opponent ) { int type = (int)(Math.random()*2); int damage = 0; if (type == 0){ System.out.println(_name+" asks annoying question!"); damage = askQuestion(opponent);} else { System.out.println(_name + " does his homework using code found online!"); dama...
2
@Override public ISocketServerConnection getConnectionById(long aIdConnection) { for (Iterator<ISocketServerConnection> it = getConnections().iterator(); it.hasNext();) { ISocketServerConnection ssc = it.next(); if (aIdConnection == ssc.getIdConnection()) return ssc; } return null; }
2
public void processFileAssoc(Source sourceInput, String localName, File outputFile, ArrayList parameterList, String initialMode, PrintStream traceDestination) throws TransformerException { if (showTime) { System.err.println("Processing " + sourceInput.get...
9
public List<String> openFile(File file) { List<String> list = new ArrayList<String>(); if (!file.isDirectory() && file.canWrite()) { path = Paths.get(file.getAbsolutePath()); try (BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) { String line = null; while ((line = reade...
4
public List<File> getArgumentsAsFiles() { List<File> arguments = new ArrayList<>(); for (CmdLineData one : mData) { if (!one.isOption()) { arguments.add(new File(one.getArgument())); } } return arguments; }
2
public void modificarImagen(int id, ArrayList datos) { // Cambiamos todos los datos, que se puedan cambiar, a minúsculas for(int i = 0 ; i < datos.size() ; i++) { try{datos.set(i, datos.get(i).toString().toLowerCase());} catch(Exception e){} } bibliote...
2
public VariableDependencyGraph getVariableDependencyGraph(Grammar grammar) { VariableDependencyGraph graph = new VariableDependencyGraph(); initializeDependencyGraph(graph, grammar); Production[] uprods = getUnitProductions(grammar); for (int k = 0; k < uprods.length; k++) { graph .addTransition(getTran...
1
public int put(int key, int n) { int pos, t = 1; while (t < m) { pos = toHash(key, t); if (table[pos] == null) { table[pos] = new HashEntry(key, t); // ???????????????????????????????????????????????????????????????????????????????????? // ...
3
public boolean choisirLigne(int id) throws IOException { connexion.envoyer("CHOIX "+id+" "+Main.controleur.getId()); reponse = connexion.recevoir(); return (reponse.equals("OK") ? true : false); }
1
public static void string_cppOutputLiteral(String string) { { int free = Stella.$CPP_MAX_STRING_LITERAL_LENGTH$; ((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("\""); { char ch = Stella.NULL_CHARACTER; String vector000 = string; int index000 = 0; int length00...
6
protected void removeFromTeamAOrB(String teamType) { Object selectedValue = null; String selectedStudent = null; int selectedIndex = 0; if (teamType.equals("A")) { selectedValue = teamACDJlst.getSelectedValue(); if (selectedValue == null ) { //warn no selected student JOptionPane.showMessageDialog...
4
public List<ParkManager> getManagerList() { return managerList; }
0
@Override public void keyPressed (KeyEvent keyEvent) { //System.out.println("key pressed"); switch (keyEvent.getExtendedKeyCode()) { case 32: frame.getHero().attack(); break; case 37: frame.getHero().setHeroOwnHorizontalSpeed(-...
5
public Matrix<T> getVer () throws Exception { if (this.cols != this.rows) { throw new MatrixIsNotInversebleException(); } Matrix<T> ex = this.getEx(); // set the diagonal line elements of the Matrix as "1" for (int r = 0; r < rows; r++) { T c = ex.get(r, r); if (!c.isOne()) { ex.set(r, r, thi...
9
@Basic @Column(name = "log_time") public Timestamp getLogTime() { return logTime; }
0
public static void buyItemTester(String name){ if(!ItemStorageInventory.create().addItem(ItemFactory.create().buyItem(name)) ){ System.out.println(name + " cannot be bought\n"); } }
1
private void executeAdding() { if (action.contains("rooms")) { Coordinate coordinate = sphereConverter.giveMouseCoordinates(mouseCoordinateX, mouseCoordinateY); if (coordinate.giveLatitude() >= -90 && coordinate.giveLongitude() <= 90) { Room room = new Room(-1, 50); room.setLocation(coordinate.giveLongi...
7
public final DBMultipleStatement createMultipleStatement(final String... queries) { if ((queries == null)||(queries.length == 0)) return null; try { final Connection connection = m_Pool.getConnection(); /* Disable auto commit */ connection.setAutoCommit(...
5
public void update() { if (centerX <= 350 || speedX <= 0) { centerX += speedX; bg1.setSpeedX(0); bg2.setSpeedX(0); } else { bg1.setSpeedX(-MOVESPEED); bg2.setSpeedX(-MOVESPEED); } centerY += speedY; // Handles Jumping if (jumping == true) { speedY++; } // Prevents from going out o...
4
public final boolean isVisited(){ if (isStranded()) return false; if (tile1 == null){ return tile2.isVisited(); } if (tile2 == null){ return tile1.isVisited(); } return tile1.isVisited() || tile2.isVisited(); }
4
@Override protected void read(InputBuffer b) throws IOException, ParsingException { VariableLengthIntegerMessage vLength = getMessageFactory().parseVariableLengthIntegerMessage(b); b = b.getSubBuffer(vLength.length()); long length = vLength.getLong(); if (length > MAX_LENGTH || length < 0) { throw new Pars...
3
public void deleteRowFromTable(int id) { int currentTable = tabbedPane.getSelectedIndex(); if(currentTable == 0) { for(int row = 0;row < movieModel.getRowCount();row++) { if(movieModel.getValueAt(row, 0).equals(Integer.toString(id))) { movieModel.removeRow(row); } } } if (currentTable == ...
9
@Override public void render() { for(int x = 0; x < Game.WIDTH; x+= Tile.TILE_SIZE) { for(int y = 0; y < Game.HEIGHT; y+= Tile.TILE_SIZE) { g.drawImage(Images.WALL, x, y, Tile.TILE_SIZE, Tile.TILE_SIZE, null); } } g.drawImage(Images.BLANK_GUI, 62, 8, 900, 740, null); renderText(new Font("Impact...
2
public void setIdentificador(TIdentificador node) { if(this._identificador_ != null) { this._identificador_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } ...
3
public void SetNodeSubscriptField(Field field, Persistent obj, NodeReference node) { Long Id = obj.Id; String fieldName = field.getName(); try { Object fieldValue = field.get(obj); if (fieldValue instanceof java.lang.String) { node.set(fieldValue.toString(), Id, fieldName); } ...
4
public void RemoveFromMenu() { if (Glob.instance != null) Glob.instance.paginae.remove(res); RemoveListener(); }
1
private void changeAccount() { setVisible(false); ArrayList<Booking> bookings = table.getSelectedObjects(); for (Booking booking : bookings) { AccountSelector sel = AccountSelector.getAccountSelector(accounts, accountTypes); sel.setVisible(true); Account accou...
2
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { AcessoSistema login = new AcessoSistema(); String nome = request.getParameter("nomeUsuario"); String senha = request.getParameter("Senha"); int resul...
3
static String format(String msg, Object... args) { try { if (args != null && args.length > 0) { return String.format(msg, args); } return msg; } catch (Exception e) { return msg; } }
3
public void clientInput(String input, int type) { if (type == 1) // audio { try { sendMessage("/audio " + Compressor.byteArrayToString(Compressor.compress(Compressor.stringToByteArray(input)))); } catch (IOException e) {} } ...
8
public double[][][] getGridD2ydx1dx3(){ double[][][] ret = new double[this.lPoints][this.mPoints][this.nPoints]; for(int i=0; i<this.lPoints; i++){ for(int j=0; j<this.mPoints; j++){ for(int k=0; k<this.nPoints; k++){ ret[this.x1indices...
3
public Object [] getResultTypes() { int addm = (m_AdditionalMeasures != null) ? m_AdditionalMeasures.length : 0; int overall_length = RESULT_SIZE+addm; overall_length += NUM_IR_STATISTICS; overall_length += NUM_WEIGHTED_IR_STATISTICS; overall_length += NUM_UNWEIGHTED_IR_STATISTICS; ...
7
public boolean createUser(DataRow row) { if(!select(row).isEmpty()) { ErrorDialog errorDialog = new ErrorDialog(true, "W bazie danych istnieje wpis o podanych parametrach.", "DatabaseManager", "createUser(DataRow row)", "row"); errorDialog.setVisible(true); return...
6
private Tile getTileFromGid(Document d, Map m, int x, int y, int gid) { if (gid == 0) { return null; } Tileset tileset = null; NodeList tilesets = d.getElementsByTagName("tileset"); ArrayList<Tileset> ts = new ArrayList<>(); for (in...
5
public boolean covers (GeneralizedConditionChunk cond) { if(cond == null) return false; if(!equalsKeys(cond)) return false; for(Dimension i : cond.values()) { Dimension d = get(i.getID()); if(!d.checkMatchAll()) { for(Value j : i.values()) { if(!(d.containsKey(j.getID()))) ret...
8
public Point awayFromSegmentationPoint(Point point, int... numbersToSkip) { boolean lResult = false; double lAbsoluteDistance = shape.getDelta() / 2; double lDistance; double lDistance2; double minDistance = 10000; Point firstMinPoint = null; Point secondMinPoint ...
6
@Override public List<SearchResult<SequenceMatcher>> searchForwards(final WindowReader reader, final long fromPosition, final long toPosition) throws IOException { // Initialise: final int sequenceLength = matcher.length(); final int lastSequencePosition = sequenceLength - 1; ...
9
public List<Image> getImages() { List<Image> images = new ArrayList<Image>(); Document document = Jsoup.parseBodyFragment(getContent()); for(Element img : document.body().select("img")) { try { URL src = new URL(BakaTsuki.getAbsolute(img.attr("src"))); if (isColorful(src)) { String url = src.toS...
3
public void setOutputMode(String outputMode) { if( !outputMode.equals(AlchemyAPI_Params.OUTPUT_XML) && !outputMode.equals(OUTPUT_RDF) ) { throw new RuntimeException("Invalid setting " + outputMode + " for parameter outputMode"); } this.outputMode = outputMode; }
2
@Override public boolean test(String value) { // TODO Auto-generated method stub if (value == null || value.equals("")) return true; try { int i = Integer.parseInt(value); if (i >= 0 && i <= 9999) return true; return false; } catch (Exception e) { // TODO: handle exception return false; } }
5
public static void add(Node node) { getController().rootPane.getChildren().add(node); }
0
public int getGold() { return gold; }
0
@Override public V put(K key, V value) { if (size > loadFactor * this.array.length) { resizeTable(); } int i = 0; V data = null; int hash = hash(key, i); Entry<K, V> entry = this.array[hash]; while (entry != null) { if (key.equa...
6