Skip to content

Instantly share code, notes, and snippets.

View rodrigovilar's full-sized avatar

Rodrigo Vilar rodrigovilar

  • Campina Grande - PB, Brazil
View GitHub Profile
@rodrigovilar
rodrigovilar / FilaTest.java
Last active July 15, 2022 20:06
Implementação de Pilha baseada em Lista encadeada
import static org.junit.Assert.*;
import org.junit.Test;
public class FilaTest {
@Test
public void fifo() {
Fila fila = new Fila();
@rodrigovilar
rodrigovilar / Fila.java
Last active February 15, 2019 01:08
Pilha e Fila
package fila;
public class Fila {
private Object[] itens = new Object[5];
private int inicio = 0; // desenfileirar
private int fim = 0; // enfileirar
private int tamanho = 0;
public void enfileirar(Object o) {
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class PilhaTest {
@Test
public void lifo() {
Pilha pilha = new Pilha();
pilha.empilhar("a");
@rodrigovilar
rodrigovilar / Aula1.java
Created November 23, 2018 18:14
Material da Aula 1
import java.util.Arrays;
public class Aula1 {
static int [ ] items = {12, 3, 43, 55, 25, 1, 6, 2};
public static void main(String[] args) {
Aula1 aula1 = new Aula1();
System.out.println(aula1.maiorInteiro(items));
System.out.println(aula1.maiorInteiroForeach(items));
System.out.println(aula1.menorInteiro(items));
public String extrato() {
double valorTotal = 0.0;
int pontosDeAlugadorFrequente = 0;
String resultado = "Registro de Alugueis de " + getNome();
for (Aluguel cada : fitasAlugadas) {
double valorCorrente = 0.0;
switch (cada.getFita().getCodigoDePreço()) {
case normal:
valorCorrente += 2;
if (cada.getDiasAlugada() > 2)
package br.ufpb.dcx.poo.crud;
import static com.jayway.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
import static com.jayway.restassured.module.jsv.JsonSchemaValidator.*;
import org.junit.Test;
public class TesteEndpointCliente {
private static final String SERVIDOR = "http://localhost:8081";
@rodrigovilar
rodrigovilar / AppBanco.java
Created September 19, 2018 01:18
Aula de Threads
public class AppBanco {
public static void main(String[] args) {
ContaBancaria a = new ContaBancaria("a", 1000);
ContaBancaria b = new ContaBancaria("b", 500);
LogicaBanco logica = new LogicaBanco();
Thread transferir = new Thread(new Transferencia(logica, a, b, 700));
Thread sacar = new Thread(new Saque(logica, a, 500));
@rodrigovilar
rodrigovilar / Produto.java
Created July 15, 2018 19:22
POO Aula 11/07/2018
public class Produto {
private int id;
private String descricao;
private double preco;
public Produto() { }
public Produto(int id, String descricao, double preco) {
this.id = id;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.junit.BeforeClass;
import org.junit.Ignore;
@rodrigovilar
rodrigovilar / COMPOR-results-3.csv
Last active August 29, 2015 14:06
Paper for SAC 2015: COMPOR experiment results
Login Task Tech Pair Tries Date Time LOC Coverage Compl
Team 01 T 1.01 OO PAIR R2 D 41838 106 20 100 100
Team 01 T 1.02 OO PAIR R2 D 41838 111 31 73 100
Team 01 T 1.03 OO PAIR R1 D 41837 30 11 88 100
Team 01 T 1.04 OO PAIR R1 D 41837 30 16 91 120
Team 01 T 1.05 OO PAIR R1 D 41837 20 13 88 141
Team 01 T 1.06 OO PAIR R1 D 41841 48 13 93 133
Team 01 T 1.07 OO PAIR R1 D 41841 10 2 93 133
Team 01 T 1.08 OO PAIR R1 D 41841 2 2 93 133
Team 01 T 1.09 OO PAIR R1 D 41841 17 18 95 121