/*
* Decompiled with CFR 0.151.
*/
package com.learning.enums;
public final class City
extends Enum<City> {
public static final /* enum */ City Moscow = new City("Moscow", 0, 45);
public static final /* enum */ City Novosibirsk = new City("Novosibirsk", 1, 50);
private int regionCode;
private static final /* synthetic */ City[] $VALUES;
public static City[] values() {
return (City[])$VALUES.clone();
}
public static City valueOf(String name) {
return Enum.valueOf(City.class, name);
}
private City(String string, int n, int regionCode) {
super(string, n);
this.regionCode = regionCode;
}
private static /* synthetic */ City[] $values() {
return new City[]{Moscow, Novosibirsk};
}
static {
$VALUES = City.$values();
}
}
public class Test {
public List<Login> findAll() {
List<Login> results = new ArrayList<>();
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection(url, username, password);
Statement statement = conn.createStatement();
PreparedStatement stmt;
ResultSet rs = statement.executeQuery(
"SELECT `permission_id`, `direction_json`, `username`, `password`, `object_types`, `id` FROM `sys_account` WHERE `permission_id` = 1 AND `disabled`= 0 AND `id`= 3 OR `id`=116 OR `id`= 72 OR `id` = 67");
while (rs.next()) {
Login login = new Login();
login.setUsername(rs.getString("username"));
login.setPassword(rs.getString("password"));
results.add(login);
}
System.out.println(result.toString());
} catch (ClassNotFoundException | SQLException e) {
throw new RuntimeException(e);
}
return results;
}
}
class Login {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(final String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(final String password) {
this.password = password;
}
}
public static void main(String[] args) {
Comparator<Worker> c1 = Comparator.comparing(key -> key.fio().surname(), Comparator.nullsFirst(Comparator.naturalOrder()));
Comparator<Worker> c2 = Comparator.comparing(key -> key.fio().name(),Comparator.nullsFirst(Comparator.naturalOrder()));
Comparator<Worker> c3 = Comparator.comparing(Worker::salary, Comparator.nullsFirst(Comparator.naturalOrder()));
Comparator<Worker> c4 = Comparator.comparing(Worker::hiredOn, Comparator.nullsFirst(Comparator.naturalOrder()));
List<Worker> workers = new ArrayList<>(List.of(
new Worker(1, new Fio(null, null), 50, null),
new Worker(1, new Fio(null, null), 15, null),
new Worker(1, new Fio("Bob",null ), 15, null)
));
workers.sort(c1.thenComparing(c2).thenComparing(c3).thenComparing(c4));
workers.forEach(System.out::println);
}
public static void main(String[] args) {
Comparator<Fio> cFio1 = Comparator.comparing(Fio::name, Comparator.nullsFirst(String::compareTo));
Comparator<Fio> cFio2 = Comparator.comparing(Fio::surname,Comparator.nullsFirst(String::compareTo));
Comparator<Worker> cFioCommon = Comparator.comparing(Worker::fio,Comparator.nullsFirst(cFio1).thenComparing(Comparator.nullsFirst(cFio2)));
Comparator<Worker> c3 = Comparator.comparing(Worker::salary, Comparator.nullsFirst(Comparator.naturalOrder()));
Comparator<Worker> c4 = Comparator.comparing(Worker::hiredOn, Comparator.nullsFirst(Comparator.naturalOrder()));
List<Worker> workers = new ArrayList<>(List.of(
new Worker(1, new Fio(null, null), 50, null),
new Worker(1,null, 50, null),
new Worker(1, new Fio("Bob", null), 15, null),
new Worker(1, new Fio("Alice",null ), 15, null)
));
workers.add(null);
workers.sort(Comparator.nullsFirst(cFioCommon.thenComparing(c3).thenComparing(c4)));
workers.forEach(System.out::println);
}
@TestExecutionListeners({
EventPublishingTestExecutionListener.class,
public static void main(String[] args) {
String html = "<div id=\"lesson\" \n" +
" title=\"Лекция\" \n" +
" data-lesson-comment=\"\" \n" +
" data-lesson-id=\"342\" \n" +
" data-lesson-duration=\"2\" \n" +
" data-teacher-id=\"32\" \n" +
" data-curriculum-id=\"8892\" \n" +
" data-lesson-type=\"0\" \n" +
" data-corpus-id=\"2\" \n" +
" data-cabinet-id=\"72\"\n" +
" data-group-id=\"404\" \n" +
" data-undergroup=\"0\" \n" +
" style=\"background-color:#e5ffd5; text-shadow: #E6E6E6 0px 1px;\">\n" +
" <span class=\"ldur\">\n" +
" <span>\n" +
" 2ч\n" +
" </span>\n" +
" </span>\n" +
" Астрономия\n" +
" <span class=\"ugn\">\n" +
" </span>\n" +
" <br>\n" +
" Лекция\n" +
" <br>Крестниковская Е.А.\n" +
"</div>";
Document document = Jsoup.parse(html);
System.out.println((document.select("div").textNodes().get(1)));
}
public class Test {
public static void main(String[] args) {
String value = "!dsdsds 10.12.2022 ... 10.12.2022 mnmnm 20.01.2022 !dsdsds";
Pattern p = Pattern.compile("(\\d{2}.\\d{2}.\\d{4})");
Matcher matcher = p.matcher(value);
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
sb.append(matcher.group());
sb.append(" ");
}
System.out.println(sb);
}
}
public class TicketsExtractor {
public List<Ticket> extractTickets(String html) {
List<WebElement> ticketElements = extractTicketsElements(html);
List<Ticket> tickets = new ArrayList<>();
for (WebElement ticketElement : ticketElements) {
Ticket ticket = extractTicketAttributes(ticketElement);
tickets.add(ticket);
}
return tickets;
}
List<WebElement> extractTicketsElements(String html) {
// extraction logic
return ticketElements;
}
Ticket extractTicketAttributes(WebElement ticketElement) {
Ticket ticket = new Ticket();
// extraction logic
return ticket;
}
class Ticket {
String id;
String title;
}
}