id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
d2fa9ea3-f93b-47d1-a32c-81a5c17a99b5 | @Override
boolean isOk(RouteStatus rs) {
return rs.stops == this.stops;
} |
be8f9e36-2f43-4861-8d47-5cf4c26f46cc | public MaxDistanceFilter(int maximumDistance) {
this.maximumDistance = maximumDistance;
} |
683476c0-3182-4a7b-bdd0-8c97d0802b4e | @Override
public boolean isOk(RouteStatus routeStatus) {
return routeStatus.distance < this.maximumDistance;
} |
99f28961-d365-407c-9107-efa4780d2f0f | public MaxStopsFilter(int maxStops) {
this.maxStops = maxStops;
} |
11a575b7-766b-4c85-a5e3-c67d01db5197 | @Override
public boolean isOk(RouteStatus routeStatus) {
return routeStatus.stops <= maxStops; //To change body of implemented methods use File | Settings | File Templates.
} |
dd872d99-d4f9-4371-af7d-207a457787b3 | @Override
public void filter(Collection<T> elems) {
Iterator<T> it = elems.iterator();
while (it.hasNext()) {
if (!this.isOk(it.next())) {
it.remove();
}
}
} |
5497c2e2-f14a-45df-8f72-eca7b85e2c1a | abstract boolean isOk(T t); |
513703af-c355-4acf-8ff7-70a2296b0d19 | @BeforeClass
public static void setup() {
algorithms = new RailroadAlgorithms();
createRailroadMap();
} |
f244e69c-1d00-4081-9754-e8e818fa563e | public static void createRailroadMap() {
map = new RailroadMap();
map.addRoute("A", "B", 5);
map.addRoute("B", "C", 4);
map.addRoute("C", "D", 8);
map.addRoute("D", "C", 8);
map.addRoute("D", "E", 6);
map.addRoute("A", "D", 5);
map.addRoute("C", "E", 2);
map.addRoute("E", "B", 3);
map.addRoute("A", "E", 7);
map.addRoute("F", "H", 1);
} |
c70e30dd-1d48-4292-90ec-5d0d381372da | public Object[][] followPathTestProvider() {
return new Object[][] {
{this.createTownList("A", "B", "C"), 9}, //Test #1
{this.createTownList("A", "D"), 5}, //Test #2
{this.createTownList("A", "D", "C"), 13}, //Test #3
{this.createTownList("A", "E", "B", "C", "D"), 22}, //Test #4
{this.createTownList("A", "E", "D"), -1}, //Test #5
{this.createTownList("A", "A"), -1},
{this.createTownList("A", "D", "C", "D"), 21}
};
} |
acf53a0a-1462-4262-96ee-ed7e34db5700 | @Test
public void followPathTest() {
Object[][] testSet = followPathTestProvider();
for (Object[] testCase : testSet) {
List<Town> param = (List<Town>) testCase[0];
Integer expected = (Integer) testCase[1];
Assert.assertEquals(expected.intValue(), algorithms.followPath(map, param));
}
} |
d7355d12-3a97-4397-a0e4-4058b53d63aa | public Object[][] numberOfRoutesMaxStopsTestProvider() {
return new Object[][] {
{new Town("C"), new Town("C"), 3, false, 2},
{new Town("A"), new Town("C"), 4, true, 3},
{new Town("A"), new Town("F"), 10, false, 0},
{new Town("F"), new Town("H"), 5, false, 1},
{new Town("F"), new Town("H"), 1, false, 1},
{new Town("F"), new Town("H"), 2, true, 0}
};
} |
21f51414-687b-4651-bb32-b0b631e0fd39 | @Test
public void numberOfRoutesMaxStopsTest() {
Object[][] testSet = numberOfRoutesMaxStopsTestProvider();
for (Object[] testCase : testSet) {
Town from = (Town) testCase[0];
Town to = (Town) testCase[1];
Integer maxStops = (Integer) testCase[2];
Boolean isExact = (Boolean) testCase[3];
Integer expected = (Integer) testCase[4];
Assert.assertEquals(expected.intValue(),
algorithms.numberOfRoutesWithStopsFilter(map, from, to, maxStops.intValue(), isExact.booleanValue()));
}
} |
9cbb4dae-42bf-4575-85ca-4556ae56fba7 | public Object[][] numberOfRoutesMaxDistanceTestProvider() {
return new Object[][] {
{new Town("C"), new Town("C"), 30, false, 7},
{new Town("A"), new Town("B"), 15, false, 4},
{new Town("A"), new Town("B"), 13, false, 2},
{new Town("A"), new Town("B"), 14, true, 2},
{new Town("A"), new Town("F"), 100, false, 0},
{new Town("A"), new Town("F"), 100, true, 0},
{new Town("F"), new Town("H"), 100, false, 1}
};
} |
33f136dd-1c61-477e-bffb-195d242815c1 | @Test
public void numberOfRoutesMaxDistanceTest() {
Object[][] testSet = numberOfRoutesMaxDistanceTestProvider();
for (Object[] testCase : testSet) {
Town from = (Town) testCase[0];
Town to = (Town) testCase[1];
Integer maxDistance = (Integer) testCase[2];
Boolean isExact = (Boolean) testCase[3];
Integer expected = (Integer) testCase[4];
Assert.assertEquals(expected.intValue(),
algorithms.numberOfRoutesWithDistanceFilter(map, from, to, maxDistance.intValue(), isExact.booleanValue()));
}
} |
eed68e6e-4b1a-4315-8c5a-0ee30653b695 | public Object[][] shortestRouteTestProvider() {
return new Object[][] {
{new Town("A"), new Town("C"), 9},
{new Town("B"), new Town("B"), 9},
{new Town("A"), new Town("F"), -1},
{new Town("F"), new Town("H"), 1}
};
} |
7d994c8d-6149-456f-a812-c0150e4a7989 | @Test
public void shortestRouteTest() {
Object[][] testSet = shortestRouteTestProvider();
for (Object[] testCase : testSet) {
Town from = (Town) testCase[0];
Town to = (Town) testCase[1];
Integer expected = (Integer) testCase[2];
Assert.assertEquals(expected.intValue(), algorithms.shortestPathLength(map, from, to));
}
} |
80905aa3-a982-412a-8c38-a1d639c19bc7 | public List<Town> createTownList(String... towns) {
List<Town> result = new LinkedList<Town>();
for (String x : towns) {
result.add(new Town(x));
}
return result;
} |
0d9ebff2-7856-4b5b-baf9-c010091eb1b7 | public Usuario(){
} |
966ce387-ee3c-4d25-98ea-f2e0b7db80cc | public void finalize() throws Throwable {
} |
5cc1b49c-e5de-440e-9277-bcdb02ef903a | public Oferente(){
} |
f76c4df3-81d9-473a-a82f-5136295ab366 | public void finalize() throws Throwable {
super.finalize();
} |
133203a5-55c0-410e-a133-b4347076a099 | public Inversionista(){
} |
e0286769-a7a0-43f5-89fb-215d10ad7641 | public void finalize() throws Throwable {
super.finalize();
} |
334e47da-baef-4731-95cb-dfb4a917e3fd | public Operacion(){
} |
b671ea8d-5bd9-4f7f-870d-ae906c3a5fdd | public void finalize() throws Throwable {
} |
fce7c8e3-5c7d-4290-b62d-1da993a1c01d | public Intermediario(){
} |
6099aa86-b14a-4215-a61c-0725773e6e30 | public void finalize() throws Throwable {
super.finalize();
} |
2d155697-9ca0-4ce9-a7ec-4f9f80762c00 | public TipoVal(){
} |
e86b5da2-b2f1-4698-ae91-e6960056ea7f | public void finalize() throws Throwable {
} |
4a25be60-915d-4e6d-a83b-6e4f60efa49c | public Valor(){
} |
46ba8b47-789c-44a5-8b34-0431300dbdbf | public void finalize() throws Throwable {
} |
45aa675f-c11c-4304-a64a-39a6a2327bbf | public Rentabilidad(){
} |
be717d2b-3610-4d0b-ba0a-f4da324d7ba1 | public void finalize() throws Throwable {
} |
4c9d5892-1d31-4367-8b98-104ea20dabef | public int getId() {
return id;
} |
7d5dc4df-2174-4406-a749-a7c1e900180a | public void setId(int id) {
this.id = id;
} |
8d192ac0-58ff-4f17-baf6-8725d5b8211a | public String getName() {
return name;
} |
28336dc1-303d-4818-9ca5-f093ad850289 | public void setName(String name) {
this.name = name;
} |
e761ebd3-c8d1-444c-9134-ab5277b3207f | public String getSurname() {
return surname;
} |
f7cc70ff-152a-400d-ae0c-b83476eaa7f0 | public void setSurname(String surname) {
this.surname = surname;
} |
a4b4a7d6-5516-437e-9181-862b7742156d | @GET
@Path("/{id}")
public User getUser(@PathParam("id") int id); |
3e6ec125-013f-4a41-a14f-1ee501ddc90b | public User getUser(int id) {
return UsersDao.getUser(id);
} |
232ee142-735e-4c9f-9e3b-86a1d1f73144 | @GET
@Path("/{param}")
public Response printMessage(@PathParam("param") String msg) {
String result = "Welcome to our Adroid world: " + msg;
return Response.status(200).entity(result).build();
} |
aaa15cb0-3a63-4ae2-9342-9e641fe9e711 | public User getUser(int id) {
return em.find(User.class, id);
} |
239b7d4b-ae2f-455e-9569-925599ff9622 | @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void addUsers(List<User> Users) {
for (User User : Users) {
em.persist(User);
}
} |
b2e06688-1056-4501-ae42-774ad22931fb | @Override
public void trabalhar() {
System.out.println("Ir curar pessoas");
} |
f4c85cd0-859c-4cef-ad4e-c466027dd69c | @Override
public void trabalhar() {
System.out.println("Ir Jogar");
} |
2068527e-263e-4aa4-b304-736c35e0c8a1 | @Override
public void trabalhar() {
System.out.println("ir defender no tribunal");
} |
c7c1d883-0ed1-42ef-8092-c098b9c57482 | public Pessoa() {} |
3e083568-3350-42b4-94d6-874443cd8b6d | public Pessoa(String nome) {
this.nome = nome;
} |
81015511-0d81-4bb1-b680-738ad4402172 | public abstract void trabalhar(); |
64d60ce0-5175-456b-ad58-d8990b56941d | public String getNome() {
return nome;
} |
b77c7bd8-0cf0-42ec-8836-fafe9ba2d9cb | public void setNome(String nome) {
this.nome = nome;
} |
037fe360-5a5b-4473-afb7-cb0f7986170c | public void trabalhar(String outraOpcao){
System.out.println("Trabalho secundário com: " + outraOpcao);
} |
0a7e933c-214d-406c-a3f8-971ba010c3e4 | public static void main(String[] args) {
Carro carro = new Carro();
Pessoa pessoa1 = new Medico();
Pessoa pessoa2 = new Jogador();
Pessoa pessoa3 = new Advogado();
pessoa1.trabalhar();
pessoa2.trabalhar();
pessoa3.trabalhar();
JogadorIniciante iniciante = new JogadorIniciante();
iniciante.trabalhar();
iniciante.trabalhar("Vendas");
carro.dirigir(pessoa1);
carro.dirigir(pessoa2);
carro.dirigir(new Advogado());
} |
b547b019-c85c-4692-990f-1ae040314c53 | public void dirigir(Pessoa motorista){
System.out.println( "Pessoa dirigindo ");
} |
c064bef3-061e-4ddb-b734-143079786fb6 | @Id
@GeneratedValue
@Column(name="id_produto")
public int getId() {
return id;
} |
c6b2279c-b949-4320-8341-ed0bb69c4ce7 | public void setId(int id) {
this.id = id;
} |
bc6182c5-3d88-4ebb-bc53-0005d266248b | @Column(name="nome")
public String getNome() {
return nome;
} |
8360b3ef-af63-4e85-b8d5-d95f552e46f2 | public void setNome(String nome) {
this.nome = nome;
} |
fb666643-3578-4710-b572-470d2c014e42 | @Column(name="marca")
public String getMarca() {
return marca;
} |
7dcdbf2a-a66d-42cd-8f4f-449ec30e12d5 | public void setMarca(String marca) {
this.marca = marca;
} |
9b47c455-2bfc-44bd-83bd-7cd9d6f0a5b4 | @Column(name="preco")
public Double getPreco() {
return preco;
} |
fb39754c-5996-4076-a8e3-b38c3d5e8bed | public void setPreco(Double preco) {
this.preco = preco;
} |
aec91a73-0d6c-49ed-9544-f8a2104093ef | @Column(name="tipo")
public String getTipo() {
return tipo;
} |
1954a9c2-b148-46e7-926d-1fabcaadc41a | public void setTipo(String tipo) {
this.tipo = tipo;
} |
ee7e1b3d-71aa-4e00-8023-260d19d46d07 | @Column(name="url")
public String getUrl() {
return url;
} |
a958109a-1b46-4403-a657-2118566cbe7f | public void setUrl(String url) {
this.url = url;
} |
05ce4526-6fff-4a78-9686-a6f54fd3edb4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((marca == null) ? 0 : marca.hashCode());
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
result = prime * result + ((preco == null) ? 0 : preco.hashCode());
result = prime * result + ((tipo == null) ? 0 : tipo.hashCode());
result = prime * result + ((url == null) ? 0 : url.hashCode());
return result;
} |
3a88ca96-aae1-4514-b64b-e414473f25ee | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Produto other = (Produto) obj;
if (id != other.id)
return false;
if (marca == null) {
if (other.marca != null)
return false;
} else if (!marca.equals(other.marca))
return false;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return false;
if (preco == null) {
if (other.preco != null)
return false;
} else if (!preco.equals(other.preco))
return false;
if (tipo == null) {
if (other.tipo != null)
return false;
} else if (!tipo.equals(other.tipo))
return false;
if (url == null) {
if (other.url != null)
return false;
} else if (!url.equals(other.url))
return false;
return true;
} |
18733e8e-7171-4278-8478-da2adf364118 | public VendaProdutofk getId() {
return id;
} |
00b7ec9d-7b55-4603-8fbd-9bbe6e121fd8 | public void setId(VendaProdutofk id) {
this.id = id;
} |
9996e4e6-5163-406b-bd5b-3607ed837ad1 | public double getPreco() {
return preco;
} |
170c3a49-0603-444e-8027-49173d7d6672 | public void setPreco(double preco) {
this.preco = preco;
} |
534b5d26-d578-4be3-bead-1e185c38ffc4 | public int getQuantidade() {
return quantidade;
} |
51011915-12e2-4bee-9720-851f1b728e67 | public void setQuantidade(int quantidade) {
this.quantidade = quantidade;
} |
1ab301c8-006e-4836-a2ce-f9a999bb4816 | public VendaProdutofk(){
this.venda = new Venda();
this.produto = new Produto();
} |
7c9fbd17-152d-440f-b9b8-883edfe5253a | public Venda getVenda() {
return venda;
} |
186dc8fe-c458-4e4b-a175-372853f31754 | public void setVenda(Venda venda) {
this.venda = venda;
} |
4d15267a-0c27-445c-92cb-3c33007a21ef | public Produto getProduto() {
return produto;
} |
4aae4df3-aa55-4ade-96f3-6fc8f639ce23 | public void setProduto(Produto produto) {
this.produto = produto;
} |
eea6008b-3381-41f6-86b1-73d780bdc8a3 | @Id
@GeneratedValue
@Column(name="id_venda")
public int getId() {
return id;
} |
5dab7b2f-fa95-4bb0-b225-99079f8e346e | public void setId(int id) {
this.id = id;
} |
dcc2c793-e8ab-4f66-822a-189eb1923e0e | @OneToMany(mappedBy="id.venda")
public Collection<VendaProduto> getVendaProdutoList() {
return vendaProdutoList;
} |
458591ca-e24c-4fe0-b1bb-a1d1277a4768 | public void setVendaProdutoList(Collection<VendaProduto> vendaProdutoList) {
this.vendaProdutoList = vendaProdutoList;
} |
6f1dd53b-e457-4d82-9db4-333684f998ba | @ManyToOne
@JoinColumn(name="id_cliente")
public Cliente getCliente() {
return cliente;
} |
85145a6c-d17b-45da-89de-569239606f16 | public void setCliente(Cliente cliente) {
this.cliente = cliente;
} |
5d1e2454-ac84-4c7f-87f1-4adc9366ecf0 | @Id
@GeneratedValue
@Column(name="id_cliente")
public int getId() {
return id;
} |
d635200c-52cc-436e-9f13-3c4dc57ca620 | public void setId(int id) {
this.id = id;
} |
c8e07872-fa1f-47ac-a5ba-1994c7e25ad5 | @Column(name="nome")
public String getNome() {
return nome;
} |
a79ca2d4-3f1e-4274-813d-7d3557337625 | public void setNome(String nome) {
this.nome = nome;
} |
f0a54d98-057a-4364-b9b8-ac013180135e | @Column(name="cpf")
public String getCpf() {
return cpf;
} |
6418f6a6-7b4d-4d89-a710-4839055bceda | public void setCpf(String cpf) {
this.cpf = cpf;
} |
2b819ad8-74d7-4d95-b0a7-a477afd312ec | @Column(name="email")
public String getEmail() {
return email;
} |
9bd7e1a2-6be7-473a-b210-a0bb7c196a7d | public void setEmail(String email) {
this.email = email;
} |
150e5154-28de-400f-a262-c4cb3346b337 | @Column(name="logradouro")
public String getLogradouro() {
return logradouro;
} |
2d6b02a0-d248-40a8-bd30-b38ed6302f36 | public void setLogradouro(String logradouro) {
this.logradouro = logradouro;
} |
4631bf25-4668-40e1-be65-c3fcd7031d98 | @Column(name="bairro")
public String getBairro() {
return bairro;
} |
b184c1d4-f9f4-4cd1-998e-35f7e7eda323 | public void setBairro(String bairro) {
this.bairro = bairro;
} |
554730bd-820a-4e5d-a6c9-eb90191d258d | @Column(name="cidade")
public String getCidade() {
return cidade;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.