text
stringlengths
14
410k
label
int32
0
9
public static Sha1Hash forByteBuffer (ByteBuffer buffer) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { // If the SHA1 algorithm doesn't exist, returns null return null; } ByteBu...
2
public void run () { while (true) { try { CommandSender sender = queue.take().get(); if (sender == null) break; if (autoUpdater.updateCheck()) { if (autoUpdater.hasDo...
6
public static String getScaleName(Scale scale) { // backup old flatSharp resolution FlatSharpConflictResolution oldFlatRes = Namer.flatSharpRes; // DUR if(scale.scaleType.equals(ScaleType.DUR) || scale.scaleType.equals(ScaleType.DUR_HARMONIC) ) { if(isSharpDur(scale.midiNum) && isFlatDur(scale.midiNum)) { ...
9
@Override public void run() { for(final RefreshTokenListener listener : listeners) { listener.onTokenTaskBegin(); } final HashMap<User, AuthSession> result = new HashMap<User, AuthSession>(); if(Skyolauncher.isOnline) { try { final Gson gson = new Gson(); for(final User user : users) { LogUt...
8
private String readResource(String filename) { StringBuilder builder = new StringBuilder(); try { FileInputStream stream = new FileInputStream(new File(resPath + filename)); try { Reader reader = new BufferedReader(new InputStreamReader(stream)); char[] buffer = new char[8192]; int read; ...
2
private void loadPublications() { if (publLoaded) return; publlist.clear(); hp = null; try { URL u = new URL("http://dblp.uni-trier.de/rec/pers/" + urlpt + "/xk"); publParser.parse(u.openStream(), publHandler); } catch (IOEx...
3
@Override public void mouseClicked(MouseEvent e) { if (getScreen().getGUI().getOptions().enableClickToSelect) { Point point = e.getPoint(); for (WormSprite sprite : getScreen().getSpritesOfType( WormSprite.class)) { Worm worm = sprite.getWorm(); if (sprite.hitTest(point.getX(), point.getY())) { ...
3
protected void addBodyLiterals(Rule rule, List<Literal> literals, String postfix) throws RuleException { try { if (literals == null || literals.size() == 0) { } else { if ("".equals(postfix)) { for (Literal literal : literals) { rule.addBodyLiteral(literal); } } else { for (Literal ...
6
public static void main(String[] args) { // Command-line argument parsing int port = 4444; // default port Queue<String> arguments = new LinkedList<String>(Arrays.asList(args)); try { while (!arguments.isEmpty()) { String flag = arguments.remove(); ...
8
private static String getVersion() { Properties prop = new Properties(); try { prop.load(GrooveJaar.class.getResourceAsStream("version.properties")); } catch (IOException e) { e.printStackTrace(); return "1.0.0"; } return prop.getProperty("version") + " BETA"; }
1
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...
6
public boolean isAdministrativo(UsuarioDTO u) { Connection co = null; PreparedStatement pst = null; ResultSet rs = null; String bandera = null;; String sql = null; try { co = EscolarConnectionFactory .getInstance().getConnection(); sql = "SELECT link_id, usuario, contrasena FROM usuarios where...
7
@Override protected void leave() { final GameObject bank = ctx.objects.select().select(ObjectDefinition.name(ctx, "Bank booth")).nearest().poll(); if (bank.valid()) { final GameObject door = Banker.doorsInYByX(ctx, bank).reverse().poll(); if (ctx.camera.prepare(door) && door.click("Open")) { Condition.wa...
4
public static Participant getParticipantByInfo(String type, String first, String last, String chapter){ ArrayList<Object>data = ReadFromFile.getData("PARTICIPANTS"); Participant p = null; for(int i = 0; i < data.size();i++){ Participant temp = (Participant)data.get(i); if(temp.getType().equals(type) && temp...
5
public void updatePosition() { if (xPos < xDestination) xPos++; else if (xPos > xDestination) xPos--; if (yPos < yDestination) yPos++; else if (yPos > yDestination) yPos--; else if (xPos == xDestination && yPos == yDestination && isMoving==true) { customer.msgSemaphoreRelease(); isMoving=f...
7
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed //Se crea un objeto y se muestra la interfaz de abrir el archivo Abrir abrir = new Abrir(); abrir.setVisible(rootPaneCheckingEnabled); }//GEN-LAST:event_jMenuItem2ActionPerform...
0
public void msgTableIsFree(Waiter waiter, Customer customer, int tableNumber) {//from animation MyCustomer cust = new MyCustomer(null); synchronized(myWaiters) { for (MyWaiter wait: myWaiters) { synchronized(wait.customers) { for (MyCustomer c: wait.customers) { if (c.cust==customer) { ...
7
public void setMatch(String match) {this.match = match;}
0
public static boolean savePersons(ArrayList<String> stringArray, String filename) { if( stringArray == null ) { return false; } //Checking parameter for null. FileWriter output; //Creating reference for filewriter. try { output = new FileWriter(new File(filename))...
3
Gene findOrCreateGene(String geneName, String trId, Chromosome chromo, int start, int end, int strand, boolean isCoding) { Marker tr = new Marker(chromo, start, end, strand, trId); List<Gene> genes = genesByName.get(geneName); int geneIndex = 0; if (genes != null) { for (Gene gene : genes) { if (gene.int...
7
public int getEvaluatedIndex(int xVal, int yVal) { boolean flipX = ((attrib & 0x40) == 0x40); boolean flipY = ((attrib & 0x80) == 0x80); int newX = xVal - x; int newY = yVal - y; if((newX < 0) || (newX >= 8) || (newY < 0) || (newY>= 8) ){ System.err.println("BAD ARGS"...
6
private synchronized boolean mustPerformBackup() { final Calendar backupDate = getLastBackupDate(); final long lastBackupDate = (backupDate != null) ? backupDate.getTimeInMillis() : 0; final long now = Calendar.getInstance().getTimeInMillis(); final BackupPeriod backupPeriod = getBackupPeriod(); if (...
8
public void displayOld() { for (int i = 0; i < width; i++) { // draw the north edge for (int j = 0; j < length; j++) { System.out.print((maze[j][i] & 1) == 0 ? "+---" : "+ "); } System.out.println("+"); // draw the west edge for (int j = 0; j < length; j++) { System.out.print((maze[j][i] &...
6
private void type(String locator, String name) { driver.findElement(By.name(locator)).clear(); driver.findElement(By.name(locator)).sendKeys(name); }
0
private boolean checkOneParam(ParamCons cons, String value) { if(value==null) return cons.isOptional; switch(cons.type) { case ParamCons.INTEGER: return StringUtils.isNumeric(value); } return true; }
2
public static void BuildMaxHeap(List<Integer> array, double x){ int heapLength = array.size(); for(int i = (int)Math.floor((heapLength)/2); i>0; i--){ MaxHeapify(array, i); } if(x!=0){ x = x - 1; BuildMaxHeap(array, x); } }
2
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
8
@Override public void keyTyped(KeyEvent event) { if (event.getKeyChar() == " ".charAt(0)) { gui.train(); } if (event.getKeyChar() == "t".charAt(0)) { Pong.gui2.pause(); } if (event.getKeyChar() == "l".charAt(0)) { Pong.gui.toggleLearn(); } if (event.getKeyChar() == "r".charAt(0)) { Pong.gui.s...
4
private String getProjection() { switch (cbProj.getSelectedIndex()) { case 0: return FlatGlobe.PROJECTION_LAT_LON; case 1: return FlatGlobe.PROJECTION_MERCATOR; case 2: return FlatGlobe.PROJECTION_SINUSOIDAL; case 3:...
4
public static void main(String args[]) { Initializer initilizer = new Initializer(); try { initilizer.initializeRandomData(); } catch (SchemaAlreadyExistsException e) { e.printStackTrace(); } catch (CubeAlreadyExistsException e) { e.printStackTrace();...
7
Class367_Sub7(DirectxToolkit class378, IndexLoader class45, Class269 class269) { super(class378); aClass269_7348 = class269; aClass378_7346 = class378; if (null == class45 || !((NativeToolkit) ((Class367_Sub7) this).aHa_Sub3_4479).aBoolean8101 || !((NativeToolkit) ((Class367_Sub7) this).aHa_Sub3_4479).aBo...
6
public void solution(String inputFilePath, String usrOutputFilePath) throws IOException { Scanner scanner = null; FileWriter writer = null; try { scanner = new Scanner(new File(inputFilePath)); testCaseNumber = scanner.nextInt(); writer = new FileWriter(usrOut...
8
protected void onPlayerInteract(final PlayerInteractEvent interaction) { if (interaction.getAction() != Action.RIGHT_CLICK_BLOCK) return; if (!Kiosk.SIGN_BLOCKS.contains(interaction.getClickedBlock().getTypeId())) return; final Sign state = (Sign) interaction.getClickedBlock().getState(); ...
3
public void setValueAt(Object value, int row, int col) { //On interdit la modification sur certaines colonnes ! // Matière modifiée. if(col == 0 && !value.equals("")) { Field theField = null; // On récupère le nom de la matière, puis on retrouve le bon objet Field en fonction d...
9
public int availableLaser(){ // for player's lasers, enemy uses different method lCurTime=System.nanoTime(); if(laserTime<=2000000000){ if(lSparks){ if(index==1){ temp = User.getLaser1Pos(); rot.rotX(-Math.PI/2); temp.mul(rot); new WrapParticles(50,20,1,init,last,10000,temp,sceneBG).ru...
7
public User createItemFromElement(DomElement element) { User user = new User(element.getChildText("name"), element.getChildText("url")); user.id = element.getChildText("id"); if (element.hasChild("realname")) user.realname = element.getChildText("realname"); ImageHolder.loadImages(user, element); use...
7
@Override public Iterator<T> iterator() { return new Iterator<T>() { private Node<T> cursor = getFirstNode(); private T lastReturn; @Override public boolean hasNext() { return cursor != null; } @Override public T next() { if (cursor == null) { ...
4
public URLTextFetcher(String URLF){ try{ URL connection = new URL(URLF); HttpURLConnection comTest = (HttpURLConnection)connection.openConnection(); comTest.setDoOutput(true); if(comTest.getResponseCode() == HttpURLConnection.HTTP_OK){ System.out.println("Successfully connected to serv...
3
private void calcViewPositions() { viewPositions = new HashMap<>(); byte lastId = view.literals[0].id; int lastStart = 0; for (int i = 1; i < view.literals.length; i++) { if (lastId != view.literals[i].id) { viewPositions.put(lastId, new int[]{lastStart, i}); ...
2
public List<Film> getFilmByCondition(String sql) { if(conn!=null&&sql!="") { try{ Statement stmt=conn.createStatement(); // PreparedStatement pstmt=conn.prepareStatement(); ResultSet rs = stmt.executeQuery(sql) ; if(!rs.wasNull()) { List<Film> films=new ArrayList<Film...
5
void mergesort(int start, int length) { // Vorl. S. 24 // VOID MergeSort( const PPOINTL start, INT length ) int first, second; int[] h; int i = 0; if (length <= 1) return; // nothing to do h = new int[length]; first = start; second = start + length / 2; mergesort(first, length / 2); m...
9
public void analzarLexico() { lectura.setCad(cadena); String cad = lectura.getToken(); while (cad != null) { if (cad.matches("[0-9.]+")) { listaToken.add(new Token(cad, Token.NUMERO)); } else if (cad.equals("+")) { listaToken.add(new Token(...
6
private int calcPointsFAforWhite(Board board, int r, int c) { CellEntry entry = board.cell[r][c]; assert ((entry == CellEntry.white || entry == CellEntry.whiteKing)); int points = 0; if (r < Board.rows - 1) { if (c < Board.cols - 1) { //Debit points for unsa...
8
public void update(float xOffset, float yOffset){ //Fetch information SpriterKeyFrame[] keyframes = this.keyframes.get(animationIndex); SpriterKeyFrame firstKeyFrame; SpriterKeyFrame secondKeyFrame; if(this.transitionFixed){ firstKeyFrame = keyframes[this.currentKey]; secondKeyFrame = keyframes[(this.c...
4
public void calcularGyF(Casilla ini, Casilla vecino){ int xv=vecino.getcordenadaX(); int yv=vecino.getcordenadaY(); int costo_d_movimiento=0; if (casilla[yv][xv].getG()==0 && casilla[yv][xv].getF()==0){ if ( (ini.getcordenadaX()==vecino.getcordenadaX() && ini.getcordenadaY()!=v...
8
private void checkLink(String href) throws UnknownHostException, MalformedURLException { if (href.length() > 1) if (!href.contains("@")) { if (!href.contains("http://")) { href = base_url + href; } String ipToCheck = checkDNS(href); if (ipToCheck != null) if...
7
private int isPrime(int n, int a, int b, int[] p){ if (n*n+a*n+b < 0) return 0; return p[n*n+a*n+b]; }
1
protected boolean pickAndExecuteAnAction() { for (Order order: orders){ if(order.s==OrderState.ready){ //RequestPayment(order); //SendOrder(order); order.s = OrderState.ignore; //Can also remove order from list return true; } } for (Order order: orders){ if(order.s==OrderState.payment...
6
public void setSpectrumInfo(String name, String key, String precursor, String spType, boolean invalid) { typeLbl1 = " "; typeLbl2 = " "; // 統合スペクトルの場合は「MERGED SPECTRUM」を表示 if (key.length() != 0 ) { typeLbl1 = spType; if ( !invalid ) { if ( name.indexOf("MERGED") != -1 ) { typeLbl2 = SP_TYPE...
5
protected void addToCloseReaderList(final Reader r) { if (readersToClose == null) { readersToClose = new ArrayList<Reader>(); } readersToClose.add(r); }
1
void getCamino(mouseNode rootNode, Pair<Integer, Integer> target) { List<Pair<Integer, mouseNode>> candidatos = new ArrayList<>(); //Guarda la profundidad del nodo y el nodo HashMap<Pair<Integer, Integer>, mouseNode> anteriores = new HashMap<>(); mouseNode targetNode = null; //Llamadas ...
6
private void merge(JsonObject genNode, JsonObject custNode, List<String> genPath) { for (Entry<String, JsonElement> entry : custNode.entrySet()) { JsonElement custChildNode = entry.getValue(); JsonElement genChildNode = genNode.get(entry.getKey()); if (genChildNode != null) { String n...
9
public boolean shouldAllowOnlyFinalStateChange() { return false; }
0
public static double getTotalFuture() { double total = 0; for (double i = 1; i < lookAhead - 1; i++) { total += futureDirection((int)i) / 2 * i; } return total; }
1
public void ready() { if (!selectionKey.isValid()) { return; } // Service the request. try { if (selectionKey.isAcceptable()) { RequestHandler.serveAccept(this); } if (selectionKey.isReadable()) { RequestHandler.serveRead(this); } if (selectionKey.isWritable()) { RequestHandler.se...
5
public static void namensfrage() throws IOException { JTextField spielername01 = new JTextField(new MaxSizeDocument(12), "", 0); JTextField spielername02 = new JTextField(new MaxSizeDocument(12), "", 0); Object[] namensfrage = {"Name von Spieler 1", spielername01, "Name von Spieler 2", spielername02}; ...
4
@Override public void mouseReleased(MouseEvent e) { switch (global) { case EditMode: if (e.getButton() == MouseEvent.BUTTON1) { switch (mode) { case EditPoly: if (grabbed != null) { ...
5
public void setPlayer2Name(JLabel label) { boolean test = false; if (test || m_test) { System.out.println("Drawing :: setPlayer2Name() BEGIN"); } m_player2Name = label; if (test || m_test) System.out.println("Drawing:: setPlayer2Name() - END"); }
4
public String getInput() { String newDifficulty = null; Scanner in = new Scanner(System.in); boolean valid = false; while (!valid) { System.out.println("\n\t" + "Bob" + ", enter how many numbers you want the board to start " ...
6
@Override public void verificaCadastro(Categoria entidade) throws ValidacaoException { Integer id = entidade.getCodigo() == null ? 0 : entidade.getCodigo(); List<LogicalExpression> listExpressao = new ArrayList<LogicalExpression>(); Criterion nome = Restrictions.eq("nome", entidade.getNome()...
2
public boolean checkIntegrity(){ if(ic != null){ if(ic.length == CrimeWatch.auth.getBytes().length) { int i; for(i = 0; i < ic.length; i++){ if(ic[i] != CrimeWatch.auth.getBytes()[i]) return false; } return true; } else return false; } else return false; }
4
private boolean checkAllPlayerFlagsCaptured() { final List<Player> playersOnGrid = getGrid().getAllPlayersOnGrid(); if (capturedPlayerFlags.size() >= playersOnGrid.size() - 1){ for (Player player : getGrid().getAllPlayersOnGrid()){ if (!this.equals(player) && !capturedPlayerFlags.contains((PlayerInfo) player...
4
public void act(){ if (clicked){ if (counter >= 10){ counter = 0; clicked = false; } else{ counter++; hoverCounter = 0; this.setImage (bg[2]); } } else if (selected){ ...
4
@Override public void save(Output output, String name, int chunksX, int chunksY) { this.filepath = "output/"+name+"/build/"+name+".ow"; System.out.println(":: OutlanderWorld format (.ow format) ::"); System.out.println(": The file will be located in: "+filepath); File f = new File(filepath); if (f.exis...
6
public static Cons nextEquivalentSelectionPattern(AbstractPropositionsIterator self) { { Cons pattern = self.selectionPattern; LogicObject keywithequivalents = null; Cons equivalentsstack = self.equivalentsStack; LogicObject newskolem = null; Cons equivalentskolems = null; if (equival...
7
@Override public void update() { // TODO Auto-generated method stub }
0
public Writer write(Writer writer) throws JSONException { try { boolean b = false; int len = length(); writer.write('['); for (int i = 0; i < len; i += 1) { if (b) { writer.write(','); } Object ...
5
private boolean criteriaCheck2( String field, Ptg[] curRow, DB db ) { boolean pass = true; for( int t = 0; t < curRow.length; t++ ) { String valcheck = curRow[t].getValue().toString(); // for each value check all the criteria for( Ptg[] row : rows ) { List r = getCriteria( db.colHeaders[t] ); ...
5
@Override public void paintComponent(Graphics g) { // Set the brush color. g.setColor(new Color(255, 0, 0, 128)); // If the canvas is requested to be cleared, clear the screen. if (clearCanvas) { g.clearRect(0, 0, totalScreenWidth, totalScreenHeight); clearCan...
5
private final String getSourceCodeForDelegateMethod( Method delegating, String referenceName, String delegatedName ){ // if no delegated suppose the delegate has the same properties // of the delegating method if( delegatedName == null || delegatedName.isEmpty() ) delegatedName = delegating.getName(); // wha...
9
private boolean sequenceDisabled() { if ( !table.getColumn( 0 ).isSequenceDisabled() && ( !( table.getColumn( 0 ).getFldType().equalsIgnoreCase( "string" ) && table.getColumn( 0 ).isKey() ) ) ) { return true; } return false; }
3
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { //cargo Parametros del Reporte Map parametros = new HashMap(); parametros.put("name_empresa", r_con.getRazon_social()); if (jCheckBox1...
7
public synchronized static void nextEX(String table, UseIdEX use) throws SQLException { Long id = cache.get(table); if (null == id) { id = new Long(1); } if (use.useId(id)) { cache.put(table, id + 1); } }
2
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String strid = request.getParameter("id"); if (strid==null){ request.setAttribute("message", "Le parametre id n'est pas specifié."); request...
9
@Override public ProvaDidatica alterar(IEntidade entidade) throws SQLException { Connection connection = ConnectionFactory.getConnection(); ProvaDidatica provaDidatica = (ProvaDidatica) entidade; String sql_Altera = "DELETE FROM candidato_aptos_prova_didatica WHERE id_prova_didatica=?"; ...
5
public void removeUnexistingEntries() { for (Iterator<CButton> it = setButtons.iterator(); it.hasNext();) { CButton cButton = it.next(); for (Iterator<MediaElement> it1 = cButton.getMedias().iterator(); it1.hasNext();) { MediaElement mediaElement = it1.next(); if (mediaElemen...
5
protected mxAtomicGraphModelChange[] decodeChanges(Node node) { // Updates the document in the existing codec codec.setDocument(node.getOwnerDocument()); LinkedList<mxAtomicGraphModelChange> changes = new LinkedList<mxAtomicGraphModelChange>(); while (node != null) { Object change; if (node.getNodeN...
5
private void click() { if(curPage == 0) { if(options.get(curPage)[curOption].getTitle().equals("Start")) { game.enterState(Game.IN_GAME_STATE_ID, new FadeOutTransition(), new FadeInTransition()); } else if(options.get(curPage)[curOption].getTitle().equals("Options")) { ...
8
public void compile(ClassFile cf) { chi[0].compile(cf); if (chi[1]!=null) { // in the case condition was impossible to evaluate at compile-time cf.code(0xE4); // start "true" branch chi[1].compile(cf); cf.code(0xE5); // finish "true" branch / start "false" branch chi[2].compile(cf)...
1
private static void appendToCsvFile(String csvFileName, List<QcTestCase> qcTestCases) throws Exception { File csvFile = new File(csvFileName); BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(csvFile, true)); for (QcTestCase qcTestCase : qcTestCases)...
3
public Position findMove() { if (this.mDepth > this.mMaxDepth) { return null; } this.mDepth++; Position computerMove = new Position(); Position humanMove = new Position(); int countMove = 0; this.mEvaluateBo...
8
public void deleteAnnotation(Annotation annot) { // make sure the page annotations have been initialized. if (!isInited) { try { initPageAnnotations(); } catch (InterruptedException e) { logger.warning("Annotation Initialization interupted"); ...
8
public void calculateSelection(List<Drawable> drawables) { if (!acceptingUserInput() || captured) return; double ptClosestDist = Double.POSITIVE_INFINITY; double projectionPtClosestDist = Double.POSITIVE_INFINITY; for (Drawable drawable : drawables) { Point pt = drawable.getClosestPoint(mouseLoc); ...
5
public void encryptFile(PlainDocument doc){ try { BufferedReader br = new BufferedReader(new FileReader(doc.getId() + ".txt")); StringBuilder sb = new StringBuilder(); File file = new File(doc.getId() + "-cipher.txt"); // if file doesnt exists, t...
4
private void checkAttribute() { ExpressionDecomposer ed=new ExpressionDecomposer(); //check select Iterator<Expression> s=select.iterator(); while(s.hasNext()) { ArrayList<String> selectAttrs=ed.getIdentifiers(s.next()); Iterator<String> selectIterator=selectAttrs.iterator(); while(selectIterator.ha...
5
public static void run(InputStream in) throws IOException { List<String> inputLines = new LinkedList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String currentLine; while ((currentLine = reader.readLine()) != null) { inputLines.add(currentLine); } List<String> reg...
9
public void setEmbed( String embed ) { // Have a shape with an embed? String e = null; OOXMLElement oe = getObject( SP ); if( oe != null ) { e = ((Sp) oe).getEmbed(); } if( e != null ) { ((Sp) oe).setEmbed( embed ); return; } // how's about a picture? oe = getObject( PIC ); if( oe != n...
6
@EventHandler(priority = EventPriority.MONITOR) public void onBlockBreak(BlockBreakEvent event) { Player player = event.getPlayer(); String playername = player.getName(); World world = player.getWorld(); String worldname = world.getName(); Boolean staff = false; int x = event.getBlock().getLocation().getB...
9
private String getStringFromReader(Reader reader) throws IOException { StringBuffer sb = new StringBuffer(); if(reader != null){ BufferedReader bufferedReader = new BufferedReader(reader); while(bufferedReader.readLine() != null) { sb.append(bufferedReader.readLin...
2
public List<String> getZipFileUrls(File task) throws IOException { List<String> urls = new ArrayList<String>(); BufferedReader br = new BufferedReader(new FileReader(task)); String line = null; while ((line = br.readLine()) != null) { int hrefIndex = line.indexOf("href"); if (hrefIndex != -1) { String...
7
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...
6
public void run() { SolrInputDocument theDoc = null; while (isRunning) { synchronized(documents) { if (documents.isEmpty()) { try { documents.wait(); } catch (Exception e) {} } if (isRunning && !documents.isEmpty()) { theDoc = documents.remove(0); } } if (i...
7
@Override public ChessBoard[] reproduce(ChessBoard partner, int pivot) { int[] configurationChildren1 = new int[boardLength]; int[] configurationChildren2 = new int[boardLength]; for (int i = 0; i < boardLength; i++) { configurationChildren1[i] = (i < pivot) ? dna[i] : partner....
3
private void persistPayment(Details details, String[] lastPayerID, String[] lastRecipientID, long lastDetailID) throws SQLException { Connection connection = null; PreparedStatement preparedStatement = null; String insertSQL = "INSERT INTO payments" + "(id_physical_payer,id_legal_payer,id_physical_recipi...
4
@Test public void testDoLogout() { // Richiamo l'helper per aggiungere due utenti ("abc" e "abd") e avere testingToken e testingToken2. aggiungiDueUtenti(); // Aggiungo tutti gli utenti come nel test testDoAccessoPartita // Li creo, li loggo, creo le razze e li faccio accedere alla partita. // Non ammetto ec...
9
public int GetMin(Color channel) { int treshhold = 5; // if value is below treshhold we do not account for it to minimize noise influence int[][] hist_value = Parent.Camera.GetHistogram(0); int ret = 255; if (channel == Color.red) { for (int i = 0; i < hist_value[0].length; ...
9
public ArrowIcon(int width, int height) { this.width = width; this.height = height; }
0
@Override public String getParameter(String key) { if (key.equals("javax.script.engine")) { return getEngineName(); } if (key.equals("javax.script.engine_version")) { return getEngineVersion(); } if (key.equals("javax.script.name")) { return getEngineName(); } if (key.equals("javax.script...
6
final public void createTableColumnDef() throws ParseException { /*@bgen(jjtree) createTableColumnDef */ SimpleNode jjtn000 = new SimpleNode(JJTCREATETABLECOLUMNDEF); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { tabl...
8
private String[] getUnclaimed(){ ArrayList<String> unclaimed = new ArrayList<String>(); ArrayList<String> worlds = new ArrayList<String>(); String[] defaults = getDefaults(); for(int i = 0; i < defaults.length; i++){ String world = xm.getPermissions().get().getString("groups." + defaults[i] + ".default");...
7