id
stringlengths
36
36
text
stringlengths
1
1.25M
fbaa79f2-4c89-4857-b5fe-9ebc044ff97a
public static BigDecimal calcularSuporte(String indicador1, String indicador2) throws IOException { Suporte s = new Suporte(); return s.calcularSuporte(indicador1, indicador2); }
d615407e-6ffc-4732-b40d-a9baf2d34063
public static void geraCalculoSuporteComTodosIndicadores() throws IOException{ Suporte s = new Suporte(); s.geraCalculoSuporteComTodosIndicadores(); }
fe8dba13-9968-4e3a-8830-bcea43dfbc30
private static void geraCalculoConfiancaComTodosIndicadores() { Confianca c = new Confianca(); try { c.geraCalculoConfiacaComTodosIndicadores(); } catch (IOException e) { e.printStackTrace(); } }
5dc087e3-dae2-49a8-94e5-050c2eef9ed2
public static void main(String []args) throws IOException { //Aplicar Soma Ponderada com Gestor de Perfil Ambiental ManipuladorProperties manip = new ManipuladorProperties(); SomaPonderada sp = new SomaPonderada(manip.getArquivoMediaDasConfiancas()); ArrayList<RankingIndicador> linhaRanking = new Arra...
431890d5-b744-49e9-b8fa-deef56c38d6b
@Bean public static PropertyPlaceholderConfigurer properties() { PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); org.springframework.core.io.Resource[] resources = new ClassPathResource[] { new ClassPathResource( "elasticsearch.properties") }; ppc.setLocations(resources); ppc.setIg...
cd23ac0e-3201-427b-9357-de998c523a5f
@Bean public ElasticsearchOperations elasticsearchTemplate() { return new ElasticsearchTemplate( transportClientBuilder.buildTransportClient()); }
bdb3d164-2c21-44b6-9cd8-00def1b62abb
public TransportClient buildTransportClient() { LOGGER.info("buildTransportClient start:{} ", clusterNodes); TransportClient client = new TransportClient(settings()); for (String clusterNode : split(clusterNodes, COMMA)) { String hostName = substringBefore(clusterNode, COLON); String port = substringAfter(c...
77f1e9d9-139f-49cf-8b20-3baccfd2d03c
private Settings settings() { return settingsBuilder() .put(CLUSTER_NAME, clusterName) .put(CLIENT_TRANSPORT_SNIFF, clientTransportSniff) .put(CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME, clientIgnoreClusterName) .put(CLIENT_TRANSPORT_PING_TIMEOUT, clientPingTimeout) .put(CLIENT_TRANSPORT_NOTES_SAM...
559a897e-f0c9-4b60-91d1-0880d55d2fa5
public Book addCharacters(String... character) { characters = Arrays.asList(character); return this; }
9c19f173-fc7d-438b-84a3-995882ea344e
public Book addTags(String... tag) { tags = Arrays.asList(tag); return this; }
ccfa7409-1420-4554-a3f2-209ddd77bea1
public String getId() { return id; }
691196ba-1abc-430e-be3d-2205aabacd65
public void setId(String id) { this.id = id; }
f39cc976-d112-456a-9960-1d546c288cbc
public String getAuthor() { return author; }
a074e62c-6a4d-4655-9c3e-47cb500916e0
public void setAuthor(String author) { this.author = author; }
44ded090-58a0-4856-80e8-71488b72a703
public String getTitle() { return title; }
d0554f82-abfc-4a9a-a5ae-ba8bbfbf086a
public void setTitle(String title) { this.title = title; }
9f82ebc5-a1f0-4e61-863f-fbb47bcd1d4c
public String getOtitle() { return otitle; }
ef9e665b-66e7-4ab2-8b1f-58e5428c846b
public void setOtitle(String otitle) { this.otitle = otitle; }
cf1ca7fc-fca7-4711-8fde-6b605c9a5d1f
public List<String> getCharacters() { return characters; }
8590e18c-8fd7-4181-b9d1-5cde02dfffbd
public void setCharacters(List<String> characters) { this.characters = characters; }
35dd40e2-4e53-4d79-bb8d-2722b9dff79f
public List<String> getTags() { return tags; }
46bef250-6ac2-4744-83ef-50b8e53b16f9
public void setTags(List<String> tags) { this.tags = tags; }
c1a66c76-8a97-42a2-bdbf-5c657462f36f
public long getCopies() { return copies; }
f61635a1-31e6-4304-b382-afc34448c3fc
public void setCopies(long copies) { this.copies = copies; }
00a2f08e-baf1-49c8-a4a6-b3aa5f80699b
public boolean isAvailable() { return available; }
00aec77f-2c36-4b37-b263-4bc57b08eaaf
public void setAvailable(boolean available) { this.available = available; }
f34ea61c-9479-4512-bc9b-285cf88bb7b1
public long getYear() { return year; }
e2a17dfd-bf9a-4690-8afd-6b4b68803857
public void setYear(long year) { this.year = year; }
c532df8e-6837-46b4-8c5d-d79a29e435c5
public static Builder getBuilder(String id, String author, String title, String otitle, long copies, boolean available, long year) { return new Builder(id, author, title, otitle, copies, available, year); }
58240564-f5e1-4079-885b-d37d335ba20c
public Builder(String id, String author, String title, String otitle, long copies, boolean available, long year) { built = new Book(); built.id = id; built.author = author; built.title = title; built.otitle = otitle; built.copies = copies; built.available = available; built.year = year; }
8910988a-6071-48b9-b1a6-9874e4e4a160
public Book build() { return built; }
14133bf6-ab65-4615-983a-fdd0bab68010
@Override public boolean equals(Object obj) { EqualsBuilder builder = new EqualsBuilder(); return builder.append(this.id, ((Book) obj).id) .append(this.title, ((Book) obj).title).isEquals(); }
6de9b351-c53e-43cf-b9e2-783f35610518
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); return builder.append(this.id).append(this.title).toHashCode(); }
b5ddd89a-b979-4f3b-a2a6-3358a5e9146a
@Override public String toString() { return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) .append("id", id).append("title", title) .append("otitle", otitle).append("characters", characters) .append("tags", tags).append("copies", copies) .append("available", available).append("year", year).to...
047bff88-c8e8-4204-8b03-30c58839f0c9
List<Book> findByTitle(String title);
96871dd7-391d-4a48-8269-4ff2f62ef8d3
List<Book> findByTitle(String title, Pageable pageable);
d40eb8e7-2ef4-4f51-9a07-188c2c2cd0e7
List<Book> findByAuthor(String author);
861ed515-2466-4e32-927d-e2c3c9373a58
List<Book> findByAvailable(boolean available);
bfead34b-ae95-4bbf-bfdf-48058e1a70e0
public static List<Book> getBuckBooks() { List<Book> books = new ArrayList<Book>(); Book book = Book.getBuilder("1", "Erich Maria Remarque", "All Quiet on the Western Front", "Im Westen nichts Neues", 1, true, 1929).build(); book.addCharacters("Paul Bäumer", "Albert Kropp", "Haie Westhus", "Fredrich ...
9a55a8f9-1f2c-4358-bb6d-1b93bd947ebf
@Before public void emptyData() { elasticsearchTemplate.createIndex(Book.class); elasticsearchTemplate.putMapping(Book.class); elasticsearchTemplate.refresh(Book.class, true); books = TestUtils.getBuckBooks(); existedBooksSize = books.size(); bookRepository.save(books); }
023073fa-2479-4d34-8232-e83ec30ee5fd
@After public void cleanUp() { bookRepository.deleteAll(); elasticsearchTemplate.deleteIndex(Book.class); }
1e0debf3-5c20-46cf-82fa-c347486d5866
@Test public void termQueryTest() { Book foundBook = null; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( termQuery("title", "crime")).build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent().size(), is(1)); foundBook = books.getContent().get(0); ...
0d813746-4b7b-40f8-b1df-381b55848390
@Test public void termsQueryTest() { SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( new TermsQueryBuilder("tags", "novel", "education")).build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent().size(), is(3)); }
6ad3d55f-c5e1-4e5a-ae56-e377d4d2bed8
@Test public void matchAllQueryTest() { SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( matchAllQuery()) // .withPageable(new PageRequest(0,3)) .build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent().size(), is(existedBooksSize)); }
ffc9a815-0d9e-40ee-9265-34ade0001bb2
@Test public void matchQueryTest() { String expectedTitle = "Crime and Punishment"; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( matchQuery("title", "crime and punishment")).build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent().size(), is(1)); ...
3821e70a-29b5-416c-b3c0-8dff7f681114
@Test public void multiMatchQueryTest() { String expectedTitle = "Crime and Punishment"; String queryText = "crime punishment"; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( multiMatchQuery(queryText, "title", "otitle")).build(); Page<Book> books = bookRepository.search(searchQuery); ...
16b8b317-6e0d-4dfe-bea9-2e96190166a7
@Test public void queryStringQueryTest() { String expectedTitle = "Crime and Punishment"; String queryString = "title:crime^10 +title:punishment -otitle:cat +author:(+Fyodor +dostoevsky)"; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( queryString(queryString)).build(); Page<Book> boo...
6490da5d-fdb7-4317-93b3-545480fcfe97
@Test public void identifiersQueryTest() { List<String> ids = new ArrayList<String>(); ids.add("1"); ids.add("2"); ids.add("3"); SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( idsQuery("book").ids("1", "2", "3")).build(); Page<Book> books = bookRepository.search(searchQuery); ass...
0f032b1f-55b9-4f83-ab2e-38c92a6d5522
@Test public void prefixQueryTest() { String expectedTitle = "Crime and Punishment"; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( prefixQuery("title", "cri")).build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent().size(), is(1)); Book foundBo...
79ad9231-941a-42d0-9755-3927da4ffa24
@Test public void prefixAndBoostQueryTest() { String expectedTitle = "Crime and Punishment"; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( prefixQuery("title", "cri").boost(3.0f)).build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent().size(), is(...
0cda1c71-cb55-433c-a94e-fd4d081ee0c7
@Test public void fuzzyLikeThisQueryTest() { String likeText = "crime punishment"; SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery( fuzzyLikeThisQuery("title", "otitle").likeText(likeText)) .build(); Page<Book> books = bookRepository.search(searchQuery); assertThat(books.getContent(...
84c3bb31-5462-442f-8b64-7abb09acf6b9
@Before public void emptyData() { elasticsearchTemplate.createIndex(Book.class); elasticsearchTemplate.putMapping(Book.class); elasticsearchTemplate.refresh(Book.class, true); books = TestUtils.getBuckBooks(); existedBooksSize = books.size(); bookRepository.save(books); }
9f525152-cb5d-4e2f-b88c-9fd4ffc7761c
@After public void cleanUp() { bookRepository.deleteAll(); elasticsearchTemplate.deleteIndex(Book.class); }
4e4c2217-f85f-4367-8993-4674184638cc
@Test public void crudRepositoryTest() { long totalCount = bookRepository.count(); assertThat(totalCount, is(equalTo(new Long(existedBooksSize)))); Iterable<Book> bookList = bookRepository.findAll(); assertThat(bookList, is(notNullValue())); Page<Book> bookPage = bookRepository.findAll(new PageRequest(0, 2...
97b72b46-d548-4ed4-a85c-e33d67a01b54
@Test public void bookRepositoryGeneralFindTest() { String testSearchTitle = "Crime and Punishment"; String testSearchAuthor = "Fyodor Dostoevsky"; List<Book> foundBooks = bookRepository.findByTitle(testSearchTitle); assertThat(foundBooks, is(notNullValue())); assertThat(foundBooks.size(), is(equalTo(1))); ...
d7d02394-25e3-456e-b803-90d5c90de0fd
MaxLength(int maxLength) { super(); this.maxLength = maxLength; }
cc63461b-aec1-4b93-a9f8-f3f7f17ea473
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (str == null) return; if (getLength() + str.length() <= maxLength) super.insertString(offs, str, a); }
6c4431fd-7ffd-4f59-9da5-da55eef84576
void generate(int realWidth, int realHeight) { if (realWidth < 1 || realHeight < 1) throw new RuntimeException("A minimális labirintus méret: 1*1 !"); // alapbeállítások labyrinth.clear(); lineEnd.clear(); createTime = 0; cancel = false; this.realWidth = realWidth; this.realHeight = real...
f21be020-861a-4f9f-92a8-360c160701ca
private boolean inner(int x, int y) { return (x < 0 || x > width || y < 0 || y > height ? false : true); }
feed211a-46b7-4276-981d-216ea5cc0da9
long getCreateTime() { return createTime; }
1ede3fe0-5822-43d8-be07-c37cef0678ae
Object[] getLabyrinth() { Object[] array = labyrinth.toArray(); for (int i = 0; i < array.length; i++) { Point p = (Point)array[i]; array[i] = new Point2D.Double(p.x / 2.0, p.y / 2.0); } return array; }
7e99861c-ab9a-4de1-817f-eac0bcc17f3b
int getWidth() { return realWidth; }
f0d5fdf8-49db-4960-bd78-ecf5397170fd
int getHeight() { return realHeight; }
854d12d0-9b63-46af-9045-8759cb8e0132
double getProgress() { int full = (realWidth + 1) * (realHeight + 1); int part = labyrinth.size(); return 100.0 * part / full; }
2ff7727c-c848-49b0-8f06-d192d7ab147b
void cancel() { cancel = true; }
f93f754e-3e56-4d56-9bed-2fa99ccf1e8e
public static void main(String args[]) { JFrame.setDefaultLookAndFeelDecorated(false); // frame dekoráció new Labirintus().init(); }
fd6e7d75-e8e4-4ba2-b911-e82effc6d22d
public void init() { // model, lines set model = new Model(); model.generate(Au.INIT_WIDTH, Au.INIT_HEIGHT); // widthField set widthField.setDocument(new MaxLength(3)); widthField.setText(String.valueOf(Au.INIT_WIDTH)); widthField.setFont(MONO_FONT); // heightField set heightField.se...
a0a64c6f-fe86-494d-9f90-282b1f4c1558
@Override public void actionPerformed(ActionEvent e) { // newLabButton if (e.getSource() == newLabButton) { if (checkFields()) { frame.setEnabled(false); new Ta().start(); } } // refreshButton if (e.getSource() == refreshButton) { if (checkFields()) { area...
f18b3897-fe28-4707-9b9d-16e979199b8c
void areaReDraw() { pixel = toInt(pixelField.getText()); int lw = 2 * Au.margo + model.getWidth() * (pixel - 1) + 1, // labirintus szélessége pixelben lh = 2 * Au.margo + model.getHeight() * (pixel - 1) + 1; // labirintus magassága pixelben area.setPreferredSize(new Dimension(lw, lh)); area....
27008003-f1d3-40b8-badb-a1851909fd85
boolean checkFields() { int w = toInt(widthField.getText()), h = toInt(heightField.getText()), p = toInt(pixelField.getText()); if (w < 1 || w > 999) { Au.dialogOk(false, frame, "Szélesség: 1-999 lehet !"); widthField.requestFocus(); return false; } if (h < 1 || h > ...
330fbba7-adc4-4076-b26a-029bb6796a6b
int toInt(String s) { try { int i = Integer.parseInt(s); return i; } catch (NumberFormatException e) { return Integer.MIN_VALUE; } }
a6c4f125-142d-4c97-a891-847ffb0098e7
void title() { frame.setTitle("Labirintus " + VERSION + " Méret: " + model.getWidth() + " x " + model.getHeight() + " pixel: " + pixel + " Létrehozva: " + model.getCreateTime() + " ms"); }
1d838124-f3a0-464e-b6b4-a960d2eff413
@Override protected void paintComponent(Graphics g) { int aw = getWidth(), // area szélessége pixelben ah = getHeight(), // area magassága pixelben lw = 2 * Au.margo + model.getWidth() * (pixel - 1) + 1, // labirintus szélesége pixelben lh = 2 * Au.margo + model.getHeight() * ...
bcf8027c-d920-483b-8dc3-979ecd3d3557
@Override public void run() { cancel = false; Tm tm = new Tm(); tm.start(); // 1 másodpercen belüli eredményre várakozás for (int i = 1; i <= 10; i++) { Au.sleep(100); // 0.1 sec sleep if (!tm.isAlive() && tm.model != null) { SwingUtilities.invokeLater(new Tg(...
f0472e48-c7b3-42be-8668-f05551e9f6b2
@Override public void run() { model = new Model(); model.generate(toInt(widthField.getText()), toInt(heightField.getText())); }
84afef6a-ace8-4a95-bd6a-ef3011c989e3
Tg(boolean visible) { runMode = (visible ? DIALOG_SHOW : DIALOG_HIDE); }
1365d1a9-e966-47f5-a4f7-31b73cbe3a61
Tg(double value) { this.value = value; runMode = PERCENT; }
22f3af2b-2beb-46d3-8314-c58471a44c2a
Tg(Model model) { this.model = model; runMode = AREA_REDRAW; }
4a28a844-3f32-4582-b7e1-2cedae5e9fa0
@Override public void run() { switch (runMode) { case DIALOG_SHOW: progressBar.setValue(0); progressPercent.setText(""); progressDialog.setVisible(true); break; case PERCENT: progressBar.setValue((int)value); progressPercent.setText...
996b2166-aeb6-467a-a834-b0d9e8ec389a
private RectanglePrint() { }
b47a71f2-e25e-45ec-ab52-1042bcfdcf6e
public static void make(JFrame frame) { RectanglePrint.frame = frame; try { PrinterJob job = PrinterJob.getPrinterJob(); // page beállítás PageFormat pafoNew = job.pageDialog(pafo); if (pafoNew == pafo) { Au.dialogOk(true, frame, "Nem nyomtatunk !"); return; } ...
f4127a2d-0309-4f99-a1da-b1d03aad1549
public static void makeImageFile(JComponent component) { BufferedImage bi = new BufferedImage(500, 500, BufferedImage.TYPE_INT_RGB); Graphics g = bi.getGraphics(); g.translate(-110, -190); // II. hová toljuk el a kivágott részt g.clipRect(120, 200, 31, 31); // I. mely rész kell a nagy rajzból // ere...
c88df9c1-2acf-4dc9-99c8-4d21c6cd65de
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException { if (pageIndex > 0) return Printable.NO_SUCH_PAGE; int ex = (int)Math.ceil(pageFormat.getImageableX()), // eltolásX ey = (int)Math.ceil(pageFormat.getImageableY()), // eltolásY w = (int)Math.floor(pageF...
11511a76-c270-452f-9e0f-5fa9df7a89ce
public static int irnd(int from, int to) { if (from > to) { int change = from; from = to; to = change; } return from + (int)Math.floor(Math.random()*(to - from + 1)); }
61ca7313-42d3-4962-a4f1-f31b483d8310
public static void dialogOk(boolean information,Component parent,Object message,String title) { JOptionPane.showMessageDialog(parent,message,title, (information ? JOptionPane.INFORMATION_MESSAGE : JOptionPane.ERROR_MESSAGE)); }
7ff2f902-d304-4477-af51-515382fa1d52
public static void dialogOk(boolean information,Component parent,Object message) { dialogOk(information,parent,message,DIALOG_TITLE); }
14c11b33-3525-4b66-90a7-bf2d0fdcf84c
public static boolean dialogYesNo(Component parent,Object message,String title) { Object option0="Igen"; Object[] options={option0,"Nem"}; int choose=JOptionPane.showOptionDialog(parent,message,title,JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,null,options,option0); return (choose == 0...
139307d4-cca8-445f-b710-43d0f48c776a
public static boolean dialogYesNo(Component parent,Object message) { return dialogYesNo(parent,message,DIALOG_TITLE); }
56dd2d62-836c-4ed1-92c1-a4d69d9ead67
public static void sleep(long msec) { try { Thread.sleep(msec); } catch (InterruptedException e) {} }
8aad5844-9297-4c64-91af-aabd3d71abc7
public static void windowCenter(Window window) { Toolkit toolkit = Toolkit.getDefaultToolkit(); window.setLocation(new Point( (toolkit.getScreenSize().width - window.getSize().width) / 2, (toolkit.getScreenSize().height - window.getSize().height) / 2 )); }
27f12ecb-a306-4607-a74e-bde89f23287e
public static String xpad(String str,int length,String fill,boolean left) { for (int i=str.length();i<length;i++) if (left) str=fill+str; else str=str+fill; return str; }
55945c74-2e77-4f32-8a29-0bf833209406
public static String lpad(String str,int length) { return xpad(str,length," ",true); }
ccd96d12-755f-4650-b3a2-33fbc439d7ae
public static String lpad(String str,int length,String fill) { return xpad(str,length,fill,true); }
f50b6451-f329-4187-b877-eea938b9263d
public static String rpad(String str,int length) { return xpad(str,length," ",false); }
fa160821-24a3-48e5-b763-0b93019bca2f
public static String rpad(String str,int length,String fill) { return xpad(str,length,fill,false); }
69c221e5-ddaa-4bfe-9a7f-28342b74af0f
public SharePrint(Labirintus view) { this.view = view; }
ca5cb126-fa2a-47d3-9306-284aee9b1f4d
public void print() { // Létezik nyomtató ? if (defaultService == -1) { Au.dialogOk(false, view.frame, "Sajnos egyetlen nyomtató sem létezik !"); view.printButton.setEnabled(false); return; } // Nyomtató kiválasztó dialógusablak int xxxxxxxxxxxxxxx = 1111111; }
0dcbd5e4-dd2d-443d-8120-2de0892e05a9
public static void main(String[] args) throws Exception { int port = Integer.parseInt(args[0]); ServerSocketChannel ssc = ServerSocketChannel.open(); InetSocketAddress address = new InetSocketAddress(port); ssc.socket().bind(address); ByteBuffer[] buffers = new ByteBuffer[3]; ...
26bd8c90-9930-404f-83d5-098e71176089
public static void main(String[] args) { System.out.println("System.out.println"); StdOut.println("StdOut.println"); }
26006999-6e8d-4637-a7da-94d1e008e5ce
public static void main(String[] args) throws Exception { String infile = args[0]; String outfile = args[1]; // file -> stream FileInputStream fin = new FileInputStream(infile); FileOutputStream fout = new FileOutputStream(outfile); // stream -> channel FileChan...