file_id
int64 1
46.7k
| content
stringlengths 14
344k
| repo
stringlengths 7
109
| path
stringlengths 8
171
|
---|---|---|---|
2,142 |
package gr.aueb.cf.ch2;
import java.util.Scanner;
/**
* Λαμβάνει απόψ το stdin ένα ακέραιο που
* αναπαριστά λίρες Σκωτίας, τις μετατρέπει
* σε δολάρια και λεπτά USD (1$ = 100cents)
* και εκτυπώνει το αποτέλεσμα ως εξής, για
* παράδειγμα: 10 λίρες Σκωτίας = χχ δολάρια
* USD και yy cents.
*/
public class BankOfScotlandApp {
public static void main(String[] args) {
int scottishPounds = 0;
int usdDollars= 0;
int usdCents = 0;
int totalUsdCents = 0;
final int PARITY = 137;
Scanner scanner = new Scanner(System.in);
System.out.println("Please insert the amount of Scottish pounds");
scottishPounds = scanner.nextInt();
totalUsdCents = scottishPounds * PARITY;
usdDollars = totalUsdCents / 100;
usdCents = totalUsdCents % 100;
System.out.printf("£%d (Scottish Pounds) = $%d (USD Dollars) and %d USD Cents",
scottishPounds, usdDollars, usdCents);
}
}
|
MytilinisV/codingfactorytestbed
|
ch2/BankOfScotlandApp.java
|
2,148 |
package api;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
/**
* Η κλάση αυτή περιέχει μεθόδους για τη διαχείριση των αξιολογήσεων των καταλυμάτων.
*/
public class ManageEvaluations implements Serializable {
private ArrayList<Evaluation> evaluations;
/**
* Κατασκευαστής της κλάσης ManageEvaluations. Αρχικοποιεί τη λίστα των αξιολογήσεων.
*/
public ManageEvaluations() {
evaluations = new ArrayList<>();
}
/**
* Η μέθοδος αυτή αποθηκεύει το παρόν αντικείμενο στο αντίστοιχο αρχείο εξόδου.
*/
public void saveToOutputFiles() {
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("evaluationsManager.bin"))) {
out.writeObject(this);
} catch (IOException e1) {
System.out.println("Δεν βρέθηκε αρχείο εξόδου");
}
}
/**
* H μέθοδος αυτή αφαιρεί τις αξιολογήσεις που αντιστοιχεούν σε κατάλυμα που έχει διαγραφεί.
* @param accommodation Το κατάλυμα που έχει διαγραφεί
*/
public void removedAccommodationAlert(Accommodation accommodation) {
if (evaluations.isEmpty())
return;
for (Iterator<Evaluation> iterator = evaluations.iterator(); iterator.hasNext();) {
Evaluation evaluation = iterator.next();
if (evaluation.getAccommodation().equals(accommodation))
iterator.remove();
}
}
/**
* Η μέθοδος αυτή καλεί τις μεθόδους που ενημερώνουν τον μέσο όρο βαθμολογίας του καταλύματος που δίνεται ως όρισμα
* και τον μέσο όρο βαθμολόγησης του χρήστη με βάση τις αξιολογήσεις που έχει κάνει.
* @param accommodation Το κατάλυμμα.
* @param user Ο χρήστης.
*/
private void updateAvgRatings(Accommodation accommodation, SimpleUser user) {
accommodation.getProvider().updateAvgRatingOfAllAccom(evaluations);
accommodation.updateAvgRatingOfAccommodation(evaluations);
user.updateAvgRatingOfUser(evaluations);
}
/**
* Η μέθοδος αυτή ελέγχει έαν ο χρήστης έχει αξιολογήσει ήδη το κατάλυμα.
* @param user Ο χρήστης.
* @param accommodation Το κατάλυμα.
* @return True αν ο χρήστης έχει αξιολογήσει ήδη το κατάλυμα, false διαφορετικά.
*/
public boolean userAlreadyEvaluatedThis(SimpleUser user, Accommodation accommodation) {
if (evaluations.isEmpty())
return false;
for (Evaluation evaluation : evaluations) { // μάλλον μπορεί να γίνει με μια απλή contains αφού η equals της evaluation ελέγχει χρήστη και κατάλυμα
if (evaluation.getUser().equals(user) && evaluation.getAccommodation().equals(accommodation))
return true;
}
return false;
}
/**
* Η μέθοδος αυτή προσθέτει μια αξιολόγηση στη λίστα αξιολογήσεων.
* @param text Το κείμενο της νέας αξιολόγησης.
* @param grade Ο βαθμός της νέας αξιολόγησης.
* @param user Ο χρήστης που αξιολογεί.
* @param accommodation Το κατάλυμα που αξιολογείται.
* @return True ή false ανάλογα με το αν ο χρήστης έχει αξιολογήσει ήδη το κατάλυμα ή όχι.
*/
public boolean addEvaluation(String text, float grade, SimpleUser user, Accommodation accommodation) {
Evaluation submittedEvaluation = new Evaluation(text, grade, user, accommodation);
if (userAlreadyEvaluatedThis(user, accommodation))
return false;
evaluations.add(submittedEvaluation);
updateAvgRatings(accommodation, user); //επανυπολογισμοί μέσων όρων μετά την προσθήκη
return true;
}
/**
* Η μέθοδος αυτή αφαιρεί μία αξιολόγηση από τη λίστα αξιολογήσεων εφόσον αυτή υπάρχει.
* @param toDeleteEvaluation Η αξιολόγηση που πρόκειται να διαγραφεί
* @return True αν βρέθηκε και αφαιρέθηκε η αξιολόγηση, false διαφορετικά
*/
public boolean removeEvaluation(Evaluation toDeleteEvaluation) {
if (evaluations.isEmpty())
return false;
for (Evaluation evaluation : evaluations) {
if (evaluation.equals(toDeleteEvaluation)) {
if (!evaluations.remove(toDeleteEvaluation))
return false;
updateAvgRatings(toDeleteEvaluation.getAccommodation(), toDeleteEvaluation.getUser()); //επανυπολογισμοί μέσων όρων μετά τη διαγραφή
return true;
}
}
return false;
}
/**
* Η μέθοδος αυτή χρησιμοποιείται για την εύρεση αξιολογήσεων του χρήστη που δίνεται ως όρισμα και τις επιστρέφει
* σε μορφή λίστας.
* @param user Ο χρήστης.
* @return Λίστα με τις αξιολογήσεις του χρήστη.
*/
public ArrayList<Evaluation> getUserEvaluations(SimpleUser user) { //Μπορεί να επιστρέφει κενή λίστα --> πρέπει να ελέγχεται
ArrayList<Evaluation> userEvaluations = new ArrayList<>();
if (!evaluations.isEmpty()) {
for (Evaluation evaluation : evaluations) {
if (evaluation.getUser().equals(user))
userEvaluations.add(evaluation);
}
}
return userEvaluations;
}
/**
* Η μέθοδος αυτή χρησιμοποιείται για την εύρεση των αξιολογήσεων ενός καταλύματος και τις επιστρέφει σε μορφή
* λίστας
* @param accommodation Το κατάλυμα.
* @return Η λίστα με τις αξιολογήσεις του καταλύματος.
*/
public ArrayList<Evaluation> getAccommodationEvaluations (Accommodation accommodation) { //Μπορει να επιστρέφει null ή και κενή λίστα --> πρέπει να ελέγχεται
ArrayList<Evaluation> accommodationEvaluations = new ArrayList<>();
if (!evaluations.isEmpty()) {
for (Evaluation evaluation : evaluations) {
if (evaluation.getAccommodation().equals(accommodation))
accommodationEvaluations.add(evaluation);
}
}
return accommodationEvaluations;
}
/**
* Μέθοδος για την επεξεργασία μιας παλιάς αξιολόγησης. Αλλάζει το κείμενο και ο βαθμός της αξιολόγησης και γίνονται
* οι αντίστοιχοι έλεγχοι για το αν τα νέα δεδομένα πληρούν τις προϋποθέσεις μιας ολοκληρωμένης αξιολόγησης.
* @param oldEvaluation Παλιά αξιολόγηση
* @param nextGrade Νέος βαθμός
* @param nextText Νέα κείμενο
* @return True τα νέα δεδομένα πληρούν τις προϋποθέσεις μιας ολοκληρωμένης αξιολόγησης, false διαφορετικά
*/
public boolean alterEvaluation(Evaluation oldEvaluation, float nextGrade, String nextText) {
if (evaluations.isEmpty())
return false;
for (Evaluation evaluation : evaluations) {
if (oldEvaluation.equals(evaluation)) {
if (evaluationTextTooLong(nextText))
return false;
if (gradeOutOfBounds(nextGrade))
return false;
removeEvaluation(evaluation); //πρέπει να γίνει αυτή η διαδικασία αλλιώς αλλάζει μόνο η τοπική μεταβλητή στο for loop
evaluation.setGrade(nextGrade);
evaluation.setEvaluationText(nextText);
addEvaluation(nextText, nextGrade, oldEvaluation.getUser(), oldEvaluation.getAccommodation());
return true;
}
}
return false;
}
/**
* Η μέθοδος αυτή επιστρέφει τον αριθμό των αξιολογήσεων που έχουν γίνει στα καταλύματα ενός παρόχου και επιστρέφει
* τον αριθμό αυτό.
* @param provider Ο πάροχος.
* @return Ο αριθμός των αξιολογήσεων που έχουν τα καταλύματα του παρόχου.
*/
public int getProvidersNumOfEvaluations(Provider provider) {
int counter = 0;
if (evaluations.isEmpty())
return 0;
for (Evaluation evaluation : evaluations) {
if (evaluation.getAccommodation().getProvider().equals(provider))
counter++;
}
return counter;
}
/**
* Η μέθοδος ελέγχει αν η αξιολόγηση που δίνεται ως όρισμα έχει γίνει από τον χρήστη που δίνεται ως όρισμα.
* @param user Ο χρήστης.
* @param evaluation Η αξιολόγηση.
* @return Η αξιολόγηση του χρήστη.
*/
public boolean isUsersEvaluation(User user, Evaluation evaluation) {
return evaluation.getUser().equals(user);
}
/**
* Η μέθοδος αυτή ελέγχει εάν το κείμενο της αξιολόγησης ενός καταλύματος είναι μεγαλύτερο από το
* επιτρεπτό όριο των 500 χαρακτήρων.
* @param text Το κείμενο.
* @return True αν το κείμενο υπερβαίνει τους 500 χαρακτήρες, false διαφορετικά.
*/
public boolean evaluationTextTooLong(String text) {
return text.length() > 500;
}
/**
* Η μέθοδος αυτή ελέγχει εάν ο βαθμός αξιολόγησης ενός καταλύματος βρίσκεται εντός των επιτρεπτών
* ορίων, δηλαδή εντός του [1,5].
* @param grade Ο βαθμός αξιολόγησης.
* @return True εάν ο βαθμός αξιολόγησης ενός καταλύματος βρίσκεται του [1,5], false διαφορετικά.
*/
public boolean gradeOutOfBounds(float grade) {
return grade < 1 || grade > 5;
}
/**
* Η μέθοδος αυτή επιστρέφει τις όλες τις αξιολογήσεις που έχουν γίνει.
* @return Οι αξιολογήσεις.
*/
public ArrayList<Evaluation> getEvaluations() {
return evaluations;
}
/**
* Η μέθοδος αυτή ελέγχει εάν καταχωρούνται τα πεδία της αξιολόγησης ενός καταλύματος και εάν καταχωρούνται
* σωστά ως προς τα όρια που έχουν τεθεί. Ελέγχεται με τη χρήση προηγούμενων μεθόδων εάν η
* βαθμολογία βρίσκεται εντός των επιτρεπτών ορίων ([1,5]) και αν οι χαρακτήρες του κειμένου είναι περισσότεροι απο το
* μέγιστο όριο (500).
* @param evaluationText Το κείμενο αξιολόγησης.
* @param grade Ο βαθμός αξιολόγησης.
* @return Κατάλληλα μηνύματα ανάλογα το σφάλμα που έχει προκύψει κατά την υποβολή της αξιολόγησης.
*/
public String checkSubmissionInaccuracies(String evaluationText, String grade) {
try {
float grade_num = Float.parseFloat(grade);
if (gradeOutOfBounds(grade_num))
return "Παρακαλώ εισάγετε βαθμολογία μεταξύ του 1 και 5.";
else if (evaluationTextTooLong(evaluationText))
return "Το κείμενο της αξιολόγησης δεν πρέπει να υπερβαίνει τους 500 χαρακτήρες";
else if (evaluationText.trim().length() == 0) //Η μέθοδος trim() αφαιρεί όλα τα whitespaces ώστε να μην περνάει ως είσοδος το space
return "Το κείμενο της αξιολόγησης είναι υποχρεωτικό.";
return null;
} catch(NumberFormatException e1) {
return "Παρακαλώ εισάγετε αριθμό στο πεδίο της βαθμολογίας.";
}
}
}
|
patiosga/myreviews
|
src/api/ManageEvaluations.java
|
2,149 |
package org.apache.lucene.analysis.el;
/**
* Copyright 2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.StopwordAnalyzerBase;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.analysis.standard.StandardAnalyzer; // for javadoc
import org.apache.lucene.util.Version;
import java.io.Reader;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
/**
* {@link Analyzer} for the Greek language.
* <p>
* Supports an external list of stopwords (words
* that will not be indexed at all).
* A default set of stopwords is used unless an alternative list is specified.
* </p>
*
* <a name="version"/>
* <p>You must specify the required {@link Version}
* compatibility when creating GreekAnalyzer:
* <ul>
* <li> As of 3.1, StandardFilter is used by default.
* <li> As of 2.9, StopFilter preserves position
* increments
* </ul>
*
* <p><b>NOTE</b>: This class uses the same {@link Version}
* dependent settings as {@link StandardAnalyzer}.</p>
*/
public final class GreekAnalyzer extends StopwordAnalyzerBase
{
/**
* List of typical Greek stopwords.
*/
private static final String[] GREEK_STOP_WORDS = {
"ο", "η", "το", "οι", "τα", "του", "τησ", "των", "τον", "την", "και",
"κι", "κ", "ειμαι", "εισαι", "ειναι", "ειμαστε", "ειστε", "στο", "στον",
"στη", "στην", "μα", "αλλα", "απο", "για", "προσ", "με", "σε", "ωσ",
"παρα", "αντι", "κατα", "μετα", "θα", "να", "δε", "δεν", "μη", "μην",
"επι", "ενω", "εαν", "αν", "τοτε", "που", "πωσ", "ποιοσ", "ποια", "ποιο",
"ποιοι", "ποιεσ", "ποιων", "ποιουσ", "αυτοσ", "αυτη", "αυτο", "αυτοι",
"αυτων", "αυτουσ", "αυτεσ", "αυτα", "εκεινοσ", "εκεινη", "εκεινο",
"εκεινοι", "εκεινεσ", "εκεινα", "εκεινων", "εκεινουσ", "οπωσ", "ομωσ",
"ισωσ", "οσο", "οτι"
};
/**
* Returns a set of default Greek-stopwords
* @return a set of default Greek-stopwords
*/
public static final Set<?> getDefaultStopSet(){
return DefaultSetHolder.DEFAULT_SET;
}
private static class DefaultSetHolder {
private static final Set<?> DEFAULT_SET = CharArraySet.unmodifiableSet(new CharArraySet(
Version.LUCENE_CURRENT, Arrays.asList(GREEK_STOP_WORDS), false));
}
public GreekAnalyzer(Version matchVersion) {
this(matchVersion, DefaultSetHolder.DEFAULT_SET);
}
/**
* Builds an analyzer with the given stop words
*
* @param matchVersion
* lucene compatibility version
* @param stopwords
* a stopword set
*/
public GreekAnalyzer(Version matchVersion, Set<?> stopwords) {
super(matchVersion, stopwords);
}
/**
* Builds an analyzer with the given stop words.
* @param stopwords Array of stopwords to use.
* @deprecated use {@link #GreekAnalyzer(Version, Set)} instead
*/
@Deprecated
public GreekAnalyzer(Version matchVersion, String... stopwords)
{
this(matchVersion, StopFilter.makeStopSet(matchVersion, stopwords));
}
/**
* Builds an analyzer with the given stop words.
* @deprecated use {@link #GreekAnalyzer(Version, Set)} instead
*/
@Deprecated
public GreekAnalyzer(Version matchVersion, Map<?,?> stopwords)
{
this(matchVersion, stopwords.keySet());
}
/**
* Creates
* {@link org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents}
* used to tokenize all the text in the provided {@link Reader}.
*
* @return {@link org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents}
* built from a {@link StandardTokenizer} filtered with
* {@link GreekLowerCaseFilter}, {@link StandardFilter} and
* {@link StopFilter}
*/
@Override
protected TokenStreamComponents createComponents(String fieldName,
Reader reader) {
final Tokenizer source = new StandardTokenizer(matchVersion, reader);
TokenStream result = new GreekLowerCaseFilter(source);
if (matchVersion.onOrAfter(Version.LUCENE_31))
result = new StandardFilter(result);
return new TokenStreamComponents(source, new StopFilter(matchVersion, result, stopwords));
}
}
|
tokee/lucene
|
contrib/analyzers/common/src/java/org/apache/lucene/analysis/el/GreekAnalyzer.java
|
2,153 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package projectt;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.text.BadLocationException;
/**
*
* @author Marinos
*/
public class Supplies extends javax.swing.JFrame {
private int currentQid;
/**
* Creates new form Supplies
*/
public Supplies() {
initComponents();
getSupplies();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jTextField8 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
jTextField10 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField11 = new javax.swing.JTextField();
jTextField12 = new javax.swing.JTextField();
jTextField13 = new javax.swing.JTextField();
jTextField14 = new javax.swing.JTextField();
jTextField15 = new javax.swing.JTextField();
jTextField16 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jTextField17 = new javax.swing.JTextField();
jTextField18 = new javax.swing.JTextField();
jTextField19 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(150, 235, 240));
jPanel1.setPreferredSize(new java.awt.Dimension(1260, 660));
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/A4AD5659B5D44610AB530DF0BAB8279D.jpeg"))); // NOI18N
jTextField1.setBackground(new java.awt.Color(150, 235, 240));
jTextField1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField1.setText("ΤΜΗΜΑ ΠΡΟΜΗΘΕΙΩΝ");
jTextField1.setBorder(null);
jTextField1.setFocusable(false);
jTextField2.setBackground(new java.awt.Color(150, 235, 240));
jTextField2.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jTextField2.setText("ΓΑΝΤΙΑ");
jTextField2.setBorder(null);
jTextField2.setFocusable(false);
jTextField3.setBackground(new java.awt.Color(150, 235, 240));
jTextField3.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jTextField3.setText("ΜΑΣΚΕΣ");
jTextField3.setBorder(null);
jTextField3.setFocusable(false);
jTextField3.setPreferredSize(new java.awt.Dimension(75, 25));
jTextField5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField5.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField6.setBackground(new java.awt.Color(150, 235, 240));
jTextField6.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jTextField6.setText("ΓΑΖΕΣ");
jTextField6.setBorder(null);
jTextField6.setFocusable(false);
jTextField7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField7.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField8.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField9.setBackground(new java.awt.Color(150, 235, 240));
jTextField9.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jTextField9.setText("ΧΕΙΡΟΥΡΓΙΚΕΣ ΦΟΡΜΕΣ");
jTextField9.setBorder(null);
jTextField9.setFocusable(false);
jTextField10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField10.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField4.setBackground(new java.awt.Color(150, 235, 240));
jTextField4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jTextField4.setText("ΔΙΑΘΕΣΙΜΟΤΗΤΑ");
jTextField4.setBorder(null);
jTextField4.setFocusable(false);
jTextField11.setBackground(new java.awt.Color(150, 235, 240));
jTextField11.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jTextField11.setText("ΕΙΔΟΣ");
jTextField11.setBorder(null);
jTextField11.setFocusable(false);
jTextField12.setBackground(new java.awt.Color(150, 235, 240));
jTextField12.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jTextField12.setText("ΠΟΣΟΤΗΤΑ");
jTextField12.setBorder(null);
jTextField12.setFocusable(false);
jTextField13.setBackground(new java.awt.Color(150, 235, 240));
jTextField13.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField13.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField13.setBorder(null);
jTextField13.setFocusable(false);
jTextField14.setBackground(new java.awt.Color(150, 235, 240));
jTextField14.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField14.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField14.setBorder(null);
jTextField14.setFocusable(false);
jTextField15.setBackground(new java.awt.Color(150, 235, 240));
jTextField15.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField15.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField15.setBorder(null);
jTextField15.setFocusable(false);
jTextField16.setBackground(new java.awt.Color(150, 235, 240));
jTextField16.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField16.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField16.setToolTipText("");
jTextField16.setBorder(null);
jTextField16.setFocusable(false);
jButton1.setBackground(new java.awt.Color(0, 0, 0));
jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton1.setForeground(new java.awt.Color(255, 255, 255));
jButton1.setText("Αποθήκευση");
jButton1.setBorder(null);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jTextField17.setBackground(new java.awt.Color(150, 235, 240));
jTextField17.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jTextField17.setText("ΝΑΡΘΗΚΕΣ");
jTextField17.setBorder(null);
jTextField17.setFocusable(false);
jTextField18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField18.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField19.setBackground(new java.awt.Color(150, 235, 240));
jTextField19.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField19.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField19.setBorder(null);
jTextField19.setFocusable(false);
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 0, 0));
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 0, 0));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(257, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(81, 81, 81)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(120, 120, 120)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGap(152, 152, 152)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField16, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField14, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField13, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(80, 80, 80)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(248, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(97, 97, 97)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(34, 34, 34)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(61, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1267, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 737, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void displayFail1(){
JOptionPane.showMessageDialog(this,("Δεν επαρκούν οι προμήθειες."));
}
private void displayFail2(){
JOptionPane.showMessageDialog(this,("Συπληρώστε τα κενά πεδία με μηδέν (0)!")); //εμφάνιση μηνύματος
}
private static void getSupplies() {
//Επιλογή από την βάση των προμηθειών
try{
java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/project", "root", ""); //Σύνδεση με βάση
String query = "SELECT stock FROM supplies WHERE supply='gantia'"; // εντολή select
PreparedStatement pst = con.prepareStatement(query); //
ResultSet rs = pst.executeQuery(); //εκτελεση του query και αποθήκευση στο rs
if(rs.next()) {
jTextField16.setText(""+rs.getInt("stock")); //εμφάνιση αποτελέσματος σε int στο textfield
}
String query1 = "SELECT stock FROM supplies WHERE supply='maskes'";
PreparedStatement pst1 = con.prepareStatement(query1);
ResultSet rs1 = pst1.executeQuery();
if(rs1.next()) {
jTextField13.setText(""+rs1.getInt("stock"));
}
String query2 = "SELECT stock FROM supplies WHERE supply='gazes'";
PreparedStatement pst2 = con.prepareStatement(query2);
ResultSet rs2 = pst2.executeQuery();
if(rs2.next()) {
jTextField14.setText(""+rs2.getInt("stock"));
}
String query3 = "SELECT stock FROM supplies WHERE supply='formes_xeirourgeiou'";
PreparedStatement pst3 = con.prepareStatement(query3);
ResultSet rs3 = pst3.executeQuery();
if(rs3.next()) {
jTextField15.setText(""+rs3.getInt("stock"));
}
String query4 = "SELECT stock FROM supplies WHERE supply='narthikes'";
PreparedStatement pst4 = con.prepareStatement(query4);
ResultSet rs4 = pst4.executeQuery();
if(rs4.next()) {
jTextField19.setText(""+rs4.getInt("stock"));
}
}
catch (SQLException ex) {
Logger.getLogger(Supplies.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void saveSupplies(){
//έλεγχος για κενά πεδία και εμφάνιση μηνύματος
//check_Stock()
if(jTextField5.getText().trim().isEmpty() || jTextField8.getText().trim().isEmpty() || jTextField7.getText().trim().isEmpty() || jTextField10.getText().trim().isEmpty() ||jTextField18.getText().trim().isEmpty())
{
displayFail2();
}
else
{
//μετατροπη του περιεχομένου textfield σε int και εκτέλεση πράξεων για την αφαίρεση
int g = Integer.parseInt(jTextField5.getText().trim());
int g1 = Integer.parseInt(jTextField16.getText().trim());
int g2 = g1-g;
int m =Integer.parseInt(jTextField8.getText().trim());
int m1 =Integer.parseInt(jTextField13.getText().trim());
int m2 = m1-m;
int ga = Integer.parseInt(jTextField7.getText().trim());
int ga1 = Integer.parseInt(jTextField14.getText().trim());
int ga2 = ga1-ga;
int fx = Integer.parseInt(jTextField10.getText().trim());
int fx1 = Integer.parseInt(jTextField15.getText().trim());
int fx2 = fx1-fx;
int n = Integer.parseInt(jTextField18.getText().trim());
int n1 = Integer.parseInt(jTextField19.getText().trim());
int n2 = n1-n;
//έλεγχος για επάρκεια προμηθειών και εμφάνιση μηνυμάτων
//check_Stock()
if(g2<0 || m2<0 || ga2<0 || fx2<0 || n2<0)
{
displayFail1();
}
else{
try
{
//ενημέρωση του table στην βάση παίρνωντας ως δεδομένα την αφαίρεση των προμηθειών
Class.forName("com.mysql.cj.jdbc.Driver");
java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/project", "root", "");
String query = "UPDATE supplies SET stock='"+g2+"' WHERE supply='gantia'";
PreparedStatement pst = con.prepareStatement(query);
int rs = pst.executeUpdate();
String query1 = "UPDATE supplies SET stock='"+m2+"' WHERE supply='maskes'";
PreparedStatement pst1 = con.prepareStatement(query1);
int rs1 = pst1.executeUpdate();
String query2 = "UPDATE supplies SET stock='"+ga2+"' WHERE supply='gazes'";
PreparedStatement pst2 = con.prepareStatement(query2);
int rs2 = pst2.executeUpdate();
String query3 = "UPDATE supplies SET stock='"+fx2+"' WHERE supply='formes_xeirourgeiou'";
PreparedStatement pst3 = con.prepareStatement(query3);
int rs3 = pst3.executeUpdate();
String query4 = "UPDATE supplies SET stock='"+n2+"' WHERE supply='narthikes'";
PreparedStatement pst4 = con.prepareStatement(query4);
int rs4 = pst4.executeUpdate();
} catch (ClassNotFoundException ex) {
Logger.getLogger(Supplies.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(Supplies.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
saveSupplies();
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Supplies.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Supplies.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Supplies.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Supplies.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Supplies().setVisible(true);
//show_SuppliesStock();
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
static javax.swing.JTextField jTextField13;
static javax.swing.JTextField jTextField14;
static javax.swing.JTextField jTextField15;
static javax.swing.JTextField jTextField16;
private javax.swing.JTextField jTextField17;
private javax.swing.JTextField jTextField18;
static javax.swing.JTextField jTextField19;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
}
|
alexkou/Software_Engineering_Project
|
src/projectt/Supplies.java
|
2,156 |
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
*Δημιουργουμε μια κλαση που δεχεται ως ορισμα ποιο παιχνιδι διαλεξε ο χρηστης και στην συνεχεια δημιουργει την
* καταλληλη κλαση για το καταλληλο παιχνιδι και στελνει ενα ορισμα αν ο χρηστης εχει επιλεξει να παιζει με
* γραμματα ή αριθμους
*
* @author Alexandros Vladovitis,Stelios Verros
*/
public class NumbersOrLetters extends JFrame {
private JLabel choose;
private boolean ChoicePlayer;
private International Inter;
public NumbersOrLetters(int chooseM){
GridLayout Layout = new GridLayout(3,1);
Inter=new International();
setTitle(Inter.SMS[26]);
setSize(550, 200);
setLocationRelativeTo(null);
setResizable(false);
choose = new JLabel(Inter.SMS[27]);
JButton letters = new JButton();
letters.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
choose.setText(Inter.SMS[28]);
if(choose.getText().equals(Inter.SMS[28])){
ChoicePlayer=true;
if(chooseM==1){
SudokuICLI clasic=new SudokuICLI(ChoicePlayer);
}else if(chooseM==2){
DuidokuICLI duidoku=new DuidokuICLI(ChoicePlayer);
}
}
}
});
letters.setText(Inter.SMS[28]);
JButton numbers = new JButton(Inter.SMS[29]);
numbers.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
choose.setText(Inter.SMS[29]);
if(choose.getText().equals(Inter.SMS[29])){
ChoicePlayer=false;
if(chooseM==1){
SudokuICLI clasic=new SudokuICLI(ChoicePlayer);
}else if(chooseM==2){
DuidokuICLI duidoku=new DuidokuICLI(ChoicePlayer);
}
}
}
});
FlowLayout aLayout = new FlowLayout();
setLayout(aLayout);
choose.setFont(Font.decode("Verdana-bold-20"));
choose.setBackground(Color.white);
letters.setBackground(Color.lightGray);
numbers.setBackground(Color.LIGHT_GRAY);
setLayout(Layout);
add(choose, BorderLayout.PAGE_START);
add(letters, BorderLayout.CENTER);
add(numbers,BorderLayout.CENTER);
setVisible(true);
}
}
|
alexvlad14/sudokuGames
|
src/NumbersOrLetters.java
|
2,157 |
package gr.aueb.edtmgr.util;
import java.time.LocalDate;
/**
* Βοηθητική κλάση για τη λήψη της ημερομηνίας του συστήματος.
* Η κλάση επιτρέπει να υποκατασταθεί η ημερομηνία του συστήματος με μία
* προκαθορισμένη ημερομηνία. Η δυνατότητα αυτή
* είναι ιδιαίτερη χρήσιμη για την εκτέλεση αυτόματων ελέγχων.
* @author Νίκος Διαμαντίδης
*
*/
public class SystemDate {
/**
* Απαγορεύουμε τη δημιουργία αντικείμενων.
*/
protected SystemDate() { }
private static LocalDate stub;
/**
* Θέτει μία συγκεκριμένη ημερομηνία ως την ημερομηνία του συστήματος.
* Η ημερομηνία αυτή επιστρέφεται από την {@link SystemDate#now()}.
* Εάν αντί για προκαθορισμένης ημερομηνίας τεθεί
* {@code null} τότε επιστρέφεται
* η πραγματική ημερομηνία του συστήματος
* @param stubDate Η ημερομηνία η οποία θα επιστρέφεται
* ως ημερομηνία του συστήματος ή {@code null} για
* να επιστρέφει την πραγματική ημερομηνία
*/
protected static void setStub(LocalDate stubDate) {
stub = stubDate;
}
/**
* Απομακρύνει το στέλεχος.
*/
protected static void removeStub() {
stub = null;
}
/**
* Επιστρέφει την ημερομηνία του συστήματος ή μία
* προκαθορισμένη ημερομηνία που έχει
* τεθεί από την {@link SystemDate#setStub}.
* @return Η ημερομηνία του συστήματος ή μία προκαθορισμένη ημερομηνία
*/
public static LocalDate now() {
return stub == null ? LocalDate.now() : stub;
}
}
|
bzafiris/quarkus-editorial-manager
|
src/main/java/gr/aueb/edtmgr/util/SystemDate.java
|
2,163 |
/*
* /* ---------------------------------------------LICENSE-----------------------------------------------------
* *
* *YOU ARE NOT ALLOWED TO MODIFY THE LICENSE OR DELETE THE LICENSE FROM THE FILES
* *
* *This is an open source project hosted at github: https://github.com/ellak-monades-aristeias/Sopho
* *
* *This application is distributed with the following license:
* *code with license EUPL v1.1 and content with license CC-BY-SA 4.0.
* *
* *The development of the application is funded by EL/LAK (http://www.ellak.gr)
* *
* *
*/
package sopho.Ofeloumenoi;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.Period;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Bounds;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.PieChart;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Button;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class GeneralStatistikaController implements Initializable {
@FXML
public BarChart ageBar;
@FXML
public BarChart eisodimaBar;
@FXML
public BarChart teknaBar;
@FXML
public BarChart asfBar;
@FXML
public PieChart anergoiPie;
@FXML
public PieChart eksartiseisPie;
@FXML
public PieChart ethnikotitaPie;
@FXML
public PieChart metanastesPie;
@FXML
public PieChart romaPie;
@FXML
public PieChart oikKatPie;
@FXML
public PieChart mellousaMamaPie;
@FXML
public PieChart monogoneikiPie;
@FXML
public PieChart ameaPie;
@FXML
public PieChart xroniosPie;
@FXML
public PieChart monaxikoPie;
@FXML
public PieChart thimaPie;
@FXML
public PieChart spoudastisPie;
@FXML
public Button backButton;
sopho.DBClass db = new sopho.DBClass();
List<Integer> IDList = new ArrayList<>();
sopho.StageLoader sl = new sopho.StageLoader();
int age020=0;
int age2130=0;
int age3140=0;
int age4150=0;
int age5160=0;
int age6170=0;
int age7180=0;
int age8190=0;
int age91plus=0;
int anergoi=0;
int eis01000=0;
int eis10012000=0;
int eis20013000=0;
int eis30014000=0;
int eis40015000=0;
int eis50016000=0;
int eis6001plus=0;
int eksartiseis=0;
Map<String, Integer> ethnikotita = new HashMap();
int metanastes=0;
int roma=0;
int agamos=0;
int eggamos=0;
int diazeugmenos=0;
int xiros=0;
int tekna0=0;
int tekna1=0;
int tekna2=0;
int tekna3=0;
int tekna4=0;
int tekna5=0;
int tekna5plus=0;
int mellousaMama=0;
int monogoneiki=0;
int anasfalistos=0;
int ika=0;
int oga=0;
int oaee=0;
int etaa=0;
int eopyy=0;
int tpdy=0;
int tapit=0;
int etap=0;
int asfallo=0;
int amea=0;
int xronios=0;
int monaxiko=0;
int thima=0;
int spoudastis=0;
int totalOfeloumenoi=0;
boolean withAnenergoi=false;
ObservableList<PieChart.Data> anergoiData;
ObservableList<PieChart.Data> eksartiseisData;
ObservableList<PieChart.Data> ethnikotitaData;
ObservableList<PieChart.Data> metanastesData;
ObservableList<PieChart.Data> romaData;
ObservableList<PieChart.Data> oikData;
ObservableList<PieChart.Data> mellousaMamaData;
ObservableList<PieChart.Data> monogoneikiData;
ObservableList<PieChart.Data> ameaData;
ObservableList<PieChart.Data> xroniosData;
ObservableList<PieChart.Data> monaxikoData;
ObservableList<PieChart.Data> thimataData;
ObservableList<PieChart.Data> spoudastesData;
boolean hasData=false;
@Override
public void initialize(URL url, ResourceBundle rb) {
sopho.Messages.CustomMessageController cm = new sopho.Messages.CustomMessageController(null, "Ερώτηση", "Θα θέλατε να συμπεριληφθούν στα στατιστικά και οι ωφελούμενοι που έχετε ορίσει ως ανενεργούς;", "question");
cm.showAndWait();
if(cm.saidYes){
withAnenergoi=true;
}
try {
GetData();
} catch (SQLException ex) {
Logger.getLogger(GeneralStatistikaController.class.getName()).log(Level.SEVERE, null, ex);
}
if(hasData){
anergoiData = anergoiPieData();
anergoiPie.getData().setAll(anergoiData);
eksartiseisData = eksartiseisPieData();
eksartiseisPie.getData().setAll(eksartiseisData);
ethnikotitaData = ethnikotitaPieData();
ethnikotitaPie.getData().setAll(ethnikotitaData);
metanastesData = metanastesPieData();
metanastesPie.getData().setAll(metanastesData);
romaData = romaPieData();
romaPie.getData().setAll(romaData);
oikData = oikKatPieData();
oikKatPie.getData().setAll(oikData);
mellousaMamaData = mellousaMamaPieData();
mellousaMamaPie.getData().setAll(mellousaMamaData);
monogoneikiData = monogoneikiPieData();
monogoneikiPie.getData().setAll(monogoneikiData);
ameaData = ameaPieData();
ameaPie.getData().setAll(ameaData);
xroniosData = xroniosPieData();
xroniosPie.getData().setAll(xroniosData);
monaxikoData = monaxikoPieData();
monaxikoPie.getData().setAll(monaxikoData);
thimataData = thimaPieData();
thimaPie.getData().setAll(thimataData);
spoudastesData = spoudastisPieData();
spoudastisPie.getData().setAll(spoudastesData);
ageBarChart();
ageBar.setLegendVisible(false);
teknaBarChart();
teknaBar.setLegendVisible(false);
eisodimaBarChart();
eisodimaBar.setLegendVisible(false);
asfBarChart();
asfBar.setLegendVisible(false);
}
}
@FXML
private void GoBack(ActionEvent event) throws IOException{
Stage stage = (Stage) backButton.getScene().getWindow();
sl.StageLoad("/sopho/Ofeloumenoi/StatistikaMain.fxml", stage, false, true); //resizable false, utility true
}
public void GetData() throws SQLException{
String sql = "SELECT * FROM ofeloumenoi";
if(!withAnenergoi) sql+=" WHERE anenergos=0";
Connection conn = db.ConnectDB();
PreparedStatement pst = conn.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
rs.last();
if(rs.getRow()>0){
boolean firstEth=true;
rs.beforeFirst();
while(rs.next()){
totalOfeloumenoi++;
//we have to make some conversions to get age from the birthdate that we have stored at the db
if(rs.getDate("imGennisis")!=null){
Date imGennisis = rs.getDate("imGennisis");
LocalDate today = LocalDate.now();
LocalDate birthday = imGennisis.toLocalDate();
Period p = Period.between(birthday, today);
int age = p.getYears();
if(age<=20){
age020++;
}else if(age>20 && age<=30){
age2130++;
}else if(age>30 && age<=40){
age3140++;
}else if(age>40 && age<=50){
age4150++;
}else if(age>50 && age<=60){
age5160++;
}else if(age>60 && age<=70){
age6170++;
}else if(age>70 && age<=80){
age7180++;
}else if(age>80 && age<=90){
age8190++;
}else{
age91plus++;
}
}
anergoi+=rs.getInt("anergos"); // if anergos it will add one else it will add 0 not affecting the total
//we have chosen to store eisodima as String so we have to convert it to int
if(!rs.getString("eisodima").equals("")){//we have to catch the case that the field was not filled.
int eis = Integer.parseInt(rs.getString("eisodima"));
if(eis>=0 && eis<=1000){
eis01000++;
}else if(eis>1000 && eis<=2000){
eis10012000++;
}else if(eis>2000 && eis<=3000){
eis20013000++;
}else if(eis>3000 && eis<=4000){
eis30014000++;
}else if(eis>4000 && eis<=5000){
eis40015000++;
}else if(eis>5000 && eis<=6000){
eis50016000++;
}else if(eis>6000){
eis6001plus++;
}
}
if(!rs.getString("eksartiseis").equals("")) eksartiseis++;
String ethnik = rs.getString("ethnikotita");
if(!ethnik.equals("")){ //doing the proccess only if the collumn is filled with data
if(firstEth){
ethnikotita.put(ethnik, 1);
firstEth=false;
System.out.println("once");
}else{
//we have to iterate through ethnikotita hashmap and add new ethnikotita if it doesn't exist. Else add to the current number
boolean mustadd=true;//we use mustadd to know if the value already exists through searching the map ethnikotita. if exists it is set to false
for (Map.Entry<String, Integer> entry : ethnikotita.entrySet()){
if(entry.getKey().equalsIgnoreCase(ethnik)){
int val = (int) entry.getValue() + 1;
System.out.println("val is "+val);
entry.setValue(val);
mustadd=false;
System.out.println("found same " + ethnik);
System.out.println("key" + entry.getKey() + " value"+entry.getValue());
}
}
if(mustadd){
ethnikotita.put(ethnik, 1);
System.out.println("mustadd " + ethnik);
}
}
}
metanastes += rs.getInt("metanastis");
roma += rs.getInt("roma");
if(rs.getInt("oikKatastasi")>=0){//if the user didn't selected anything the value is -1
if(rs.getInt("oikKatastasi")==0) agamos++;
if(rs.getInt("oikKatastasi")==1) eggamos++;
if(rs.getInt("oikKatastasi")==2) diazeugmenos++;
if(rs.getInt("oikKatastasi")==3) xiros++;
}
int tekna =rs.getInt("arithmosTeknon");
if(tekna==0){
tekna0++;
}else if(tekna==1){
tekna1++;
}else if(tekna==2){
tekna2++;
}else if(tekna==3){
tekna3++;
}else if(tekna==4){
tekna4++;
}else if(tekna==5){
tekna5++;
}else if(tekna>5){
tekna5plus++;
}
mellousaMama += rs.getInt("mellousaMama");
monogoneiki += rs.getInt("monogoneiki");
int asf = rs.getInt("asfForeas");
if(asf>=0){//only if the user has selected an option from the dropdown
if(asf==0){
anasfalistos++;
}else if(asf==1){
ika++;
}else if(asf==2){
oga++;
}else if(asf==3){
oaee++;
}else if(asf==4){
etaa++;
}else if(asf==5){
eopyy++;
}else if(asf==6){
tpdy++;
}else if(asf==7){
tapit++;
}else if(asf==8){
etap++;
}else if(asf==9){
asfallo++;
}
}
amea+=rs.getInt("amea");
xronios+=rs.getInt("xronios");
monaxiko+=rs.getInt("monaxikos");
thima+=rs.getInt("emfiliVia");
spoudastis+=rs.getInt("spoudastis");
}
hasData=true;
}else{
sopho.Messages.CustomMessageController cm = new sopho.Messages.CustomMessageController(null, "Ενημέρωση", "Δεν υπάρχουν ωφελούμενοι με τα κριτήρια αυτά για να εξαχθούν στατιστικά. Καταχωρήστε ωφελούμενους προκειμένου να εμφανιστούν τα στατιστικά.", "error");
cm.showAndWait();
}
}
public void ageBarChart() {
XYChart.Series<String, Integer> series = new XYChart.Series<>();
XYChart.Data<String, Integer> data = new XYChart.Data<>("0-20", age020);
XYChart.Data<String, Integer> data2 = new XYChart.Data<>("21-30", age2130);
XYChart.Data<String, Integer> data3 = new XYChart.Data<>("31-40", age3140);
XYChart.Data<String, Integer> data4 = new XYChart.Data<>("41-50", age4150);
XYChart.Data<String, Integer> data5 = new XYChart.Data<>("51-60", age5160);
XYChart.Data<String, Integer> data6 = new XYChart.Data<>("61-70", age6170);
XYChart.Data<String, Integer> data7 = new XYChart.Data<>("71-80", age7180);
XYChart.Data<String, Integer> data8 = new XYChart.Data<>("81-90", age8190);
XYChart.Data<String, Integer> data9 = new XYChart.Data<>("90+", age91plus);
XYChart.Data<String, Integer> data10 = new XYChart.Data<>("Δεν καταγράφηκε", totalOfeloumenoi-age020-age2130-age3140-age4150-age5160-age6170-age7180-age8190-age91plus);
displayLabelForData(data);
displayLabelForData(data2);
displayLabelForData(data3);
displayLabelForData(data4);
displayLabelForData(data5);
displayLabelForData(data6);
displayLabelForData(data7);
displayLabelForData(data8);
displayLabelForData(data9);
displayLabelForData(data10);
series.getData().addAll(data, data2, data3, data4, data5, data6, data7, data8, data9, data10);
ageBar.getData().add(series);
}
public void teknaBarChart() {
XYChart.Series<String, Integer> series = new XYChart.Series<>();
XYChart.Data<String, Integer> data = new XYChart.Data<>("0", tekna0);
XYChart.Data<String, Integer> data2 = new XYChart.Data<>("1", tekna1);
XYChart.Data<String, Integer> data3 = new XYChart.Data<>("2", tekna2);
XYChart.Data<String, Integer> data4 = new XYChart.Data<>("3", tekna3);
XYChart.Data<String, Integer> data5 = new XYChart.Data<>("4", tekna4);
XYChart.Data<String, Integer> data6 = new XYChart.Data<>("5", tekna5);
XYChart.Data<String, Integer> data7 = new XYChart.Data<>("5+", tekna5plus);
displayLabelForData(data);
displayLabelForData(data2);
displayLabelForData(data3);
displayLabelForData(data4);
displayLabelForData(data5);
displayLabelForData(data6);
displayLabelForData(data7);
series.getData().addAll(data, data2, data3, data4, data5, data6, data7);
teknaBar.getData().add(series);
}
public void eisodimaBarChart(){
XYChart.Series<String, Integer> series = new XYChart.Series<>();
XYChart.Data<String, Integer> data = new XYChart.Data<>("0-1000", eis01000);
XYChart.Data<String, Integer> data2 = new XYChart.Data<>("1001-2000", eis10012000);
XYChart.Data<String, Integer> data3 = new XYChart.Data<>("2001-3000", eis20013000);
XYChart.Data<String, Integer> data4 = new XYChart.Data<>("3001-4000", eis30014000);
XYChart.Data<String, Integer> data5 = new XYChart.Data<>("4001-5000", eis40015000);
XYChart.Data<String, Integer> data6 = new XYChart.Data<>("5001-6000", eis50016000);
XYChart.Data<String, Integer> data7 = new XYChart.Data<>("6000+", eis6001plus);
XYChart.Data<String, Integer> data8 = new XYChart.Data<>("Δεν καταγράφηκε", totalOfeloumenoi-eis01000-eis10012000-eis20013000-eis30014000-eis40015000-eis50016000-eis6001plus);
displayLabelForData(data);
displayLabelForData(data2);
displayLabelForData(data3);
displayLabelForData(data4);
displayLabelForData(data5);
displayLabelForData(data6);
displayLabelForData(data7);
displayLabelForData(data8);
series.getData().addAll(data, data2, data3, data4, data5, data6, data7, data8);
eisodimaBar.getData().add(series);
}
public void asfBarChart(){
XYChart.Series<String, Integer> series = new XYChart.Series<>();
XYChart.Data<String, Integer> data = new XYChart.Data<>("Ανασφάλιστος", anasfalistos);
XYChart.Data<String, Integer> data2 = new XYChart.Data<>("ΙΚΑ", ika);
XYChart.Data<String, Integer> data3 = new XYChart.Data<>("ΟΓΑ", oga);
XYChart.Data<String, Integer> data4 = new XYChart.Data<>("ΟΑΕΕ", oaee);
XYChart.Data<String, Integer> data5 = new XYChart.Data<>("ΕΤΑΑ", etaa);
XYChart.Data<String, Integer> data6 = new XYChart.Data<>("ΕΟΠΥΥ", eopyy);
XYChart.Data<String, Integer> data7 = new XYChart.Data<>("ΤΠΔΥ", tpdy);
XYChart.Data<String, Integer> data8 = new XYChart.Data<>("ΤΑΠΙΤ", tapit);
XYChart.Data<String, Integer> data9 = new XYChart.Data<>("ΕΤΑΠ", etap);
XYChart.Data<String, Integer> data10 = new XYChart.Data<>("ΑΛΛΟ", asfallo);
XYChart.Data<String, Integer> data11 = new XYChart.Data<>("Δεν καταγράφηκε", (totalOfeloumenoi-anasfalistos-ika-oga-oaee-etaa-eopyy-tpdy-tapit-etap-asfallo));
displayLabelForData(data);
displayLabelForData(data2);
displayLabelForData(data3);
displayLabelForData(data4);
displayLabelForData(data5);
displayLabelForData(data6);
displayLabelForData(data7);
displayLabelForData(data8);
displayLabelForData(data9);
displayLabelForData(data10);
displayLabelForData(data11);
series.getData().addAll(data, data2, data3, data4, data5, data6, data7, data8, data9, data10, data11);
asfBar.getData().add(series);
}
/** places a text label with a bar's value above a bar node for a given XYChart.Data */
private void displayLabelForData(XYChart.Data<String, Integer> data) {
data.nodeProperty().addListener(new ChangeListener<Node>() {
@Override
public void changed(ObservableValue<? extends Node> ov, Node oldNode, final Node node) {
if (node != null) {
final Node node2 = data.getNode();
final Text dataText = new Text(data.getYValue() + "");
node2.parentProperty().addListener(new ChangeListener<Parent>() {
@Override
public void changed(ObservableValue<? extends Parent> ov, Parent oldParent, Parent parent) {
Group parentGroup = (Group) parent;
parentGroup.getChildren().add(dataText);
}
});
node2.boundsInParentProperty().addListener(new ChangeListener<Bounds>() {
@Override
public void changed(ObservableValue<? extends Bounds> ov, Bounds oldBounds, Bounds bounds) {
dataText.setLayoutX(
Math.round(
bounds.getMinX() + bounds.getWidth() / 2 - dataText.prefWidth(-1) / 2
)
);
dataText.setLayoutY(
Math.round(
bounds.getMinY() - dataText.prefHeight(-1) * 0.5
)
);
}
});
}
}
});
}
private void displayPieValue(PieChart.Data data) {
data.nodeProperty().addListener(new ChangeListener<Node>() {
@Override
public void changed(ObservableValue<? extends Node> ov, Node oldNode, final Node node) {
if (node != null) {
final Node node2 = data.getNode();
final Text dataText = new Text(data.getPieValue() + "");
node2.parentProperty().addListener(new ChangeListener<Parent>() {
@Override
public void changed(ObservableValue<? extends Parent> ov, Parent oldParent, Parent parent) {
Group parentGroup = (Group) parent;
parentGroup.getChildren().add(dataText);
}
});
node2.boundsInParentProperty().addListener(new ChangeListener<Bounds>() {
@Override
public void changed(ObservableValue<? extends Bounds> ov, Bounds oldBounds, Bounds bounds) {
dataText.setLayoutX(
Math.round(
bounds.getMinX() + bounds.getWidth() / 2 - dataText.prefWidth(-1) / 2
)
);
dataText.setLayoutY(
Math.round(
bounds.getMinY() - dataText.prefHeight(-1) * 0.5
)
);
}
});
}
}
});
}
private ObservableList<PieChart.Data> anergoiPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Άνεργοι ("+anergoi+")", anergoi));
list.add(new PieChart.Data("Εργαζόμενοι ("+(totalOfeloumenoi-anergoi)+")", totalOfeloumenoi - anergoi));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> eksartiseisPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Με εξαρτήσεις ("+eksartiseis+")", eksartiseis));
list.add(new PieChart.Data("Χωρίς εξαρτήσεις ("+(totalOfeloumenoi-eksartiseis)+")", totalOfeloumenoi - eksartiseis));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> ethnikotitaPieData(){
List<PieChart.Data> list = new ArrayList<>();
int hasFilled=0;//we have to know the number of persons that have the field blank
for (Map.Entry<String, Integer> entry : ethnikotita.entrySet()){
list.add(new PieChart.Data(entry.getKey() + "("+(int) entry.getValue()+")", (int) entry.getValue()));
hasFilled += (int) entry.getValue();
}
list.add(new PieChart.Data("Δεν καταγράφηκε ("+(totalOfeloumenoi-hasFilled)+")", totalOfeloumenoi-hasFilled));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> metanastesPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+metanastes+")", metanastes));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-metanastes)+")", totalOfeloumenoi - metanastes));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> romaPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+roma+")", roma));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-roma)+")", totalOfeloumenoi - roma));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> oikKatPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Άγαμος ("+agamos+")", agamos));
list.add(new PieChart.Data("Έγγαμος ("+eggamos+")", eggamos));
list.add(new PieChart.Data("Διαζευγμένος ("+diazeugmenos+")", diazeugmenos));
list.add(new PieChart.Data("Χήρος ("+xiros+")", xiros));
list.add(new PieChart.Data("Δεν καταγράφηκε ("+(totalOfeloumenoi-agamos-eggamos-diazeugmenos-xiros)+")", totalOfeloumenoi-agamos-eggamos-diazeugmenos-xiros));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> mellousaMamaPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+mellousaMama+")", mellousaMama));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-mellousaMama)+")", totalOfeloumenoi - mellousaMama));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> monogoneikiPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+monogoneiki+")", monogoneiki));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-monogoneiki)+")", totalOfeloumenoi - monogoneiki));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> ameaPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+amea+")", amea));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-amea)+")", totalOfeloumenoi - amea));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> xroniosPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+xronios+")", xronios));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-xronios)+")", totalOfeloumenoi - xronios));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> monaxikoPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+monaxiko+")", monaxiko));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-monaxiko)+")", totalOfeloumenoi - monaxiko));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> thimaPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+thima+")", thima));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-thima)+")", totalOfeloumenoi - thima));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
private ObservableList<PieChart.Data> spoudastisPieData(){
List<PieChart.Data> list = new ArrayList<>();
list.add(new PieChart.Data("Ναι ("+spoudastis+")", spoudastis));
list.add(new PieChart.Data("Όχι ("+(totalOfeloumenoi-spoudastis)+")", totalOfeloumenoi - spoudastis));
ObservableList<PieChart.Data> mydata = FXCollections.observableList(list);
return mydata;
}
}
|
ellak-monades-aristeias/Sopho
|
src/sopho/Ofeloumenoi/GeneralStatistikaController.java
|
2,165 |
package gui;
/*Η κλάση αναπαριστά μια καρτέλα τύπου dashboard που εξυπηρετεί τον χρήστη
@author Anestis Zotos
*/
import api.Accommodation;
import api.CurrentUser;
import api.InsertedAccommodations;
import api.UserFunctions;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
public class DashBoardFrame {
private JFrame frame;
public DashBoardFrame(InsertedAccommodations accommodations){
frame=new JFrame("Dashboard Frame");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
setVisible(false);
AccommodationsFrame.setVisible(true);
}
});
//Ευρεση αξιολογημένων καταλυμάτων απο τον χρήστη και τοποθέτηση τους σε ArrayList
ArrayList<Accommodation> evaluatedAccommodations;
evaluatedAccommodations= UserFunctions.FindEvaluatedAccommodations(CurrentUser.getCurrentUser().getUsername(),accommodations);
// ο χρήστης έχει κάνει αξιολόγηση
if(evaluatedAccommodations.size()!=0){
int i=0;
JButton[] buttons=new JButton[evaluatedAccommodations.size()];
JPanel[] panels=new JPanel[evaluatedAccommodations.size()]; //κάθε panel του πίνακα panels θα αποθηκεύει 5 συστατικα
JLabel[] label1=new JLabel[evaluatedAccommodations.size()];
int[] flag=new int[1]; //βοηθητική μεταβλητή(πίνακας 1 θέσης) που θα μας δείξει σε ποία θέση του arr
// βρίσκεται το accommodation που αντιστοιχεί στο κουμπί που πάτησε ο χρήστης
for(Accommodation ACC: evaluatedAccommodations){
buttons[i]=new JButton("Επιλογή"); //δημιουργία κουμπιών επιλογής των καταλυμάτων,κάθε κουμπί αντιστοιχεί σε ένα κατάλυμα
buttons[i].setBackground(new Color(144,144,144));
buttons[i].setBorder(new LineBorder(Color.BLACK));
buttons[i].setFont(new Font("Serif",Font.BOLD,16));
buttons[i].setActionCommand(Integer.toString(i)); //θέτω ως actioncommand του εκάστοτε κουμπιού την θέση που έχει στον πίνακα buttons
buttons[i].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flag[0]= Integer.parseInt(e.getActionCommand());
Accommodation temp ;
temp=evaluatedAccommodations.get(flag[0]);
//!!!TRYFWN BALE THN EPILOGH PROBOLHS KATALYMATOS!!!!!!
}
});
panels[i]=new JPanel();
panels[i].setBackground(new Color(144,144,144));
panels[i].setBorder(BorderFactory.createEmptyBorder(40, 50, 40, 50));
panels[i].setLayout(new GridLayout(5,1));
label1[i]=new JLabel(ACC.getName()); //ονομα καταλύματος
label1[i].setFont(new Font("Serif",Font.BOLD,22));
panels[i].add(label1[i]);
panels[i].add(new JLabel(ACC.getType())); // τύπος καταλύματος
panels[i].add(new JLabel(ACC.getCity())); // πόλη καταλύματος
panels[i].add(new JLabel("Η αξιολόγησή σας:"+Double.toString(ACC.getEval(CurrentUser.getCurrentUser().getUsername()).getNum_eval()))); //βαθμό αξιολόγησης που έχει δώσει ο χρήστης στο κατάλυμα
panels[i].add(buttons[i]);
i++;
}
JPanel panel2=new JPanel();
panel2.setBackground(new Color(49,83,94));
panel2.setLayout(new FlowLayout());
for(i=0;i<evaluatedAccommodations.size();i++)
{
panel2.add(panels[i]);
}
JLabel label=new JLabel("Ο μέσος όρος της βαθμολογίας που έχετε δώσει στα καταλύματα είναι:");
JLabel labelnum=new JLabel(Double.toString(UserFunctions.CalculateAverageEvaluation(CurrentUser.getCurrentUser().getUsername(),accommodations)));
JPanel panel=new JPanel();
panel.setBackground(new Color(144,144,144));
panel.setBorder(BorderFactory.createEmptyBorder(40, 50, 40, 50));
panel.setLayout(new GridLayout(5,1));
panel.setLayout(new FlowLayout());
panel.add(label);
panel.add(labelnum);
frame.add(panel,BorderLayout.PAGE_END);
frame.add(panel2);
}
//Ο χρήστης δεν εχει κάνει καμία αξιολόγηση
else{
JPanel panel1=new JPanel();
panel1.setLayout(new FlowLayout());
panel1.setBackground(new Color(49,83,94));
JLabel lab1=new JLabel("Δεν έχετε καταχωρήσει αξιολόγηση σε κανένα κατάλυμα");
lab1.setBackground(new Color(144,144,144));
lab1.setBorder(BorderFactory.createEmptyBorder(40, 50, 40, 50));
lab1.setLayout(new GridLayout(5,1));
panel1.add(lab1);
frame.add(panel1);
}
frame.setSize(1000,700);
frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
frame.setLocationRelativeTo(null);
}
public void setVisible(boolean b){
frame.setVisible(b);
}
}
|
AnestisZotos/Accommodations-rating-platform
|
gui/DashBoardFrame.java
|
2,170 |
package gui;
/*
Η κλάση αναπαριστά μια καρτέλα με όλα τα καταλύματα που βρέθηκαν να πληρούν τα κριτήρια αναζήτησης του χρήστη
@author Anestis Zotos
*/
import api.Accommodation;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
public class FoundAccommodationsFrame {
private JFrame frame;
public FoundAccommodationsFrame(ArrayList<Accommodation> accommodations){
frame=new JFrame("Found Accommodations");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
setVisible(false);
SearchAccommodationsFrame.setVisible(true);
}
});
int i=0;
JButton[] buttons=new JButton[accommodations.size()];
JPanel[] panels=new JPanel[accommodations.size()]; //κάθε panel του πίνακα panels θα αποθηκεύει 5 συστατικα
JLabel[] label1=new JLabel[accommodations.size()];
int[] flag=new int[1]; //βοηθητική μεταβλητή(πίνακας 1 θέσης) που θα μας δείξει σε ποία θέση του arr
// βρίσκεται το accommodation που αντιστοιχεί στο κουμπί που πάτησε ο χρήστης
for(Accommodation ACC: accommodations){
buttons[i]=new JButton("Επιλογή"); //δημιουργία κουμπιών επιλογής των καταλυμάτων,κάθε κουμπί αντιστοιχεί σε ένα κατάλυμα
buttons[i].setBackground(new Color(144,144,144));
buttons[i].setBorder(new LineBorder(Color.BLACK));
buttons[i].setFont(new Font("Serif",Font.BOLD,16));
buttons[i].setActionCommand(Integer.toString(i)); //θέτω ως actioncommand του εκάστοτε κουμπιού την θέση που έχει στον πίνακα buttons
buttons[i].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flag[0]= Integer.parseInt(e.getActionCommand());
Accommodation acc ;
acc = accommodations.get(flag[0]);
ShowAccommodationPanel pan = new ShowAccommodationPanel(acc);
JFrame showFrame = new JFrame(acc.getName());
showFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
showFrame.setSize(1000,700);
showFrame.setResizable(false);
showFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
showFrame.setVisible(false);
setVisible(true);
}
});
showFrame.add(pan.getPanel());
Toolkit t = Toolkit.getDefaultToolkit();
Dimension d = t.getScreenSize();
showFrame.setLocation((d.width - frame.getWidth()) / 2, (d.height - frame.getHeight()) / 2);
showFrame.setVisible(true);
setVisible(false);
}
});
panels[i]=new JPanel();
panels[i].setBackground(new Color(144,144,144));
panels[i].setBorder(BorderFactory.createEmptyBorder(40, 50, 40, 50));
panels[i].setLayout(new GridLayout(5,1));
label1[i]=new JLabel(ACC.getName()); //ονομα καταλύματος
label1[i].setFont(new Font("Serif",Font.BOLD,22));
panels[i].add(label1[i]);
panels[i].add(new JLabel(ACC.getType())); // τύπος καταλύματος
panels[i].add(new JLabel(ACC.getCity())); // πόλη καταλύματος
panels[i].add(new JLabel(String.valueOf(ACC.calculateAverageScore())+"/5")); //μέση βαθμολογία καταλύματος
panels[i].add(buttons[i]);
i++;
}
JPanel panel2=new JPanel();
panel2.setBackground(new Color(49,83,94));
panel2.setLayout(new FlowLayout());
for(i=0;i<accommodations.size();i++)
{
panel2.add(panels[i]);
}
frame.add(panel2);
frame.setSize(1000,700);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
}
public void setVisible(boolean b) {
frame.setVisible(b);
}
}
|
AnestisZotos/Accommodations-rating-platform
|
gui/FoundAccommodationsFrame.java
|
2,178 |
package testbed.review;
import java.util.ArrayList;
/**
* Κωδικοποίησε τον 1ο χαρακτήρα του μηνύματος με την ακέραια τιμή που αντιστοιχεί σε αυτόν
* (από τον κώδικα ASCII). Κωδικοποίησε του επόμενους χαρακτήρες: (α) προσθέτοντας την ακέραια
* ASCII τιμή του καθένα από αυτούς με τον κωδικό του προηγούμενού του,
* (β) παίρνοντας το υπόλοιπο της διαίρεσης του αθροίσματος αυτού διά μία σταθερά.
* Υποθέτουμε πως τα μηνύματα τελειώνουν με τον χαρακτήρα #
* Γράψτε ένα πρόγραμμα java που να υλοποιεί τον αλγόριθμο κρυπτογράφησης έτσι ώστε το
* κωδικοποιημένο μήνυμα που προκύπτει να είναι μία ακολουθία ακεραίων που τελειώνει με -1
* Γράψτε και τον αλγόριθμο αποκρυπτογράφησης που λαμβάνει ως είσοδο μία ακολουθία ακεραίων
* που τελειώνει με -1 και υπολογίζει το αρχικό μήνυμα
*/
public class CryptoWithMod {
public static void main(String[] args) {
final int KEY = 800;
String s = "Apollo 17 was the final mission of NASA's Apollo program.#";
String s1 = encrypt(s, KEY).toString();
System.out.println(s1);
String s2 = decrypt(encrypt(s, KEY), KEY).toString();
System.out.println(s2);
}
public static ArrayList<Integer> encrypt(String s, int key) {
ArrayList<Integer> encrypted = new ArrayList<>();
char ch;
int i;
int prev = cipher(s.charAt(0), -1, key);
encrypted.add(prev);
i = 1;
while ((ch = s.charAt(i)) != '#') {
encrypted.add(cipher(ch, prev, key));
prev = cipher(ch, prev, key);
i++;
}
encrypted.add(-1);
return encrypted;
}
public static ArrayList<Character> decrypt(ArrayList<Integer> encrypted, int key) {
ArrayList<Character> decrypted = new ArrayList<>();
int token;
int i;
int prevToken;
prevToken = decipher(encrypted.get(0), -1, key);
decrypted.add((char) prevToken);
i = 1;
while ((token = encrypted.get(i)) != -1) {
decrypted.add(decipher(token, prevToken, key));
prevToken = token;
i++;
}
return decrypted;
}
public static int cipher(char ch, int prev, int key) {
if (prev == -1) return ch;
else return (ch + prev) % key;
}
public static char decipher(int cipher, int prev, int key) {
int de;
if (prev == -1) return (char) cipher;
else {
de = cipher + key - prev;
if (de > key) de -= key;
return (char) de;
}
}
}
|
a8anassis/cf-structured-review
|
CryptoWithMod.java
|
2,179 |
package operatingsystem;
import java.util.Comparator;
// Χρίστος Γκόγκος (2738), Αθανάσιος Μπόλλας (2779), Δημήτριος Σβίγγας (2618), Αναστάσιος Τεμπερεκίδης (2808)
/* Comparator που θέτει ως κριτήριο τον χρόνο άφηξης της διεργασίας */
public class ArrivalTimeComparator implements Comparator {
@Override
public int compare(Object proc, Object proc2) {
Process pr = (Process) proc;
Process pr2 = (Process) proc2;
return pr2.getArrivalTime()- pr.getArrivalTime() ;
}
}
|
TeamLS/Operating-System-Simulator
|
src/operatingsystem/ArrivalTimeComparator.java
|
2,181 |
package save_lives_2021_2022;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class TrainedUserDAO {
/**
* Gets the list of skills a trained user has
*
* @param user_id
* @return
* @throws Exception
*/
public List<Skills> getTrainedUserSkills(int user_id) throws Exception {
List<Skills> skills = new ArrayList<Skills>();
DB db = new DB();
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "SELECT skill_id, skill_name FROM trainedskills, skill WHERE skill_id1 = skill_id AND user_id1 = ?;";
try {
con = db.getConnection();
stmt = con.prepareStatement(sql);
stmt.setInt(1, user_id);
rs = stmt.executeQuery();
while (rs.next()){
skills.add(new Skills(rs.getInt("skill_id"), rs.getString("skill_name")));
}
rs.close();
stmt.close();
db.close();
return skills;
} catch (Exception e) {
throw new Exception ("ΚΑΤΙ ΠΗΓΕ ΣΤΡΑΒΑ. " + e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
throw new Exception("Δεν ήταν δυνατή η διακοπή της σύνδεσης με τη Βάση Δεδομένων");
}
}
} //End of getTrainedUserSkills
/**
* Registers an existing user as trained and updates database tables trained, users_zips and trainedskills
*
* @param username
* @param phone
* @param region
* @param areas
* @param skills contains the skill_id of the skills this trained user has
*/
public void registerAsTrainedUser(TrainedUser newTrainedUser) throws Exception{
DB db = new DB();
Connection con = null;
PreparedStatement stmt = null;
String sql = "INSERT INTO traineduser (user_id, region, phone) VALUES (?, ?, ?);";
String sql1 = "INSERT INTO trainedskills (user_id1, skill_id1) VALUES (?, ?);";
String sql2 = "INSERT INTO users_zips (user_id2, trained_zip) VALUES (?, ?);";
try {
con = db.getConnection();
//updates table traineduser
stmt = con.prepareStatement(sql);
stmt.setInt(1, newTrainedUser.getUserId(newTrainedUser.getUsername()));
stmt.setString(2, newTrainedUser.getRegion());
stmt.setString(3, newTrainedUser.getPhone());
stmt.executeUpdate();
//updates table trainedskills
stmt = con.prepareStatement(sql1);
stmt.setInt(1, newTrainedUser.getUserId(newTrainedUser.getUsername()));
for (Skills i : newTrainedUser.getSkills()){
stmt.setInt(2, i.getSkill_id()) ;
stmt.executeUpdate();
}
//updates table users_zips
stmt = con.prepareStatement(sql2);
LocationDAO locdao = new LocationDAO();
List<String> ziplist = new ArrayList<String>();
ziplist = locdao.findZips(newTrainedUser.getRegion(), newTrainedUser.getAreas());
stmt.setInt(1, newTrainedUser.getUserId(newTrainedUser.getUsername()));
for (String zip : ziplist ){
stmt.setString(2, zip);
stmt.executeUpdate();
}
stmt.close();
db.close();
} catch (Exception e) {
throw new Exception ("ΚΑΤΙ ΠΗΓΕ ΣΤΡΑΒΑ. " + e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
throw new Exception ("Δεν ήταν δυνατή η διακοπή της σύνδεσης με τη Βάση Δεδομένων");
}
}
} //End of registerAsTrainedUser
/**
* Finds the Skill list of a traineduser
*
* @param user_id
* @return
* @throws Exception
*/
public List<Skills> getUserSkills(int user_id) throws Exception{
List<Skills> skill_list = new ArrayList<Skills>();
DB db = new DB();
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "SELECT skill_id, skill_name FROM trainedskills, skill WHERE user_id1=?; AND skill_id1 = skill_id;";
try{
con = db.getConnection();
stmt = con.prepareStatement(sql);
stmt.setInt(1, user_id);
rs = stmt.executeQuery();
while (rs.next()){
skill_list.add(new Skills(rs.getInt("skill_id"), rs.getString("skill_name")));
}
rs.close();
stmt.close();
db.close();
return skill_list;
} catch (Exception e) {
throw new Exception ("ΚΑΤΙ ΠΗΓΕ ΣΤΡΑΒΑ. " + e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
throw new Exception ("Δεν ήταν δυνατή η διακοπή της σύνδεσης με τη Βάση Δεδομένων");
}
}
} //End of getUserSkills
/**
* Finds the if trained User exist by email
*
* @param user_id
* @return
* @throws Exception
*/
public List<String> ifExistsTrainedUser(String email) throws Exception{
List<String> info = new ArrayList<String>();
DB db = new DB();
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "select name, surname, phone from user, traineduser where email = ?;";
try{
con = db.getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, email);
rs = stmt.executeQuery();
while (rs.next()){
info.add("name");
info.add("surname");
info.add("phone");
}
rs.close();
stmt.close();
db.close();
return info;
} catch (Exception e) {
throw new Exception ("ΚΑΤΙ ΠΗΓΕ ΣΤΡΑΒΑ. " + e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
throw new Exception ("Δεν ήταν δυνατή η διακοπή της σύνδεσης με τη Βάση Δεδομένων");
}
}
} //End of ifExistsTrainedUser
public boolean ifExistsTrainedUser(int user_id) throws Exception{
DB db = new DB();
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "select * from traineduser where user_id= ?;";
try{
con = db.getConnection();
stmt = con.prepareStatement(sql);
stmt.setInt(1, user_id);
rs = stmt.executeQuery();
if (rs.next()){
throw new Exception("Είστε ήδη εγγεγραμμένος ως εκπαιδευμένος στις Α΄ βοήθειες");
}
rs.close();
stmt.close();
db.close();
} catch (Exception e) {
throw new Exception (e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
throw new Exception ("Δεν ήταν δυνατή η διακοπή της σύνδεσης με τη Βάση Δεδομένων");
}
}
return false;
}
}
|
des-liag/Website-Save-Lives
|
WEB-INF/classes/TrainedUserDAO.java
|
2,182 |
package operatingsystem;
import java.util.Comparator;
// Χρίστος Γκόγκος (2738), Αθανάσιος Μπόλλας (2779), Δημήτριος Σβίγγας (2618), Αναστάσιος Τεμπερεκίδης (2808)
/* Comparator που θέτει ως κριτήριο τον συνολικό χρόνο της διεργασίας */
public class RemainingTimeComparator implements Comparator {
@Override
public int compare(Object proc, Object proc2) {
Process pr = (Process) proc;
Process pr2 = (Process) proc2;
return pr2.getRemainingTime()- pr.getRemainingTime() ;
}
}
|
TeamLS/Operating-System-Simulator
|
src/operatingsystem/RemainingTimeComparator.java
|
2,186 |
package gr.aueb.cf.ch6;
/**
* Finds the min element of an array of ints.
* The initial min value is set to Integer.MAX_VALUE
* and the initial position to 0.
*/
public class ArrayMinApp2 {
public static void main(String[] args) {
int[] arr = {4, 6, 3, 8, 9, 8, 2, 11};
// Ορίζουμε ως min value to max-int, οπότε κάποιο στοιχείο θα είναι
// μικρότερο από max-int εκτός εάν όλα τα στοιχεία του πίνακα είναι max-int,
// οπότε τότε το position παραμένει 0, που είναι σωστό.
int minValue = Integer.MAX_VALUE;
int minPosition = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] < minValue) {
minPosition = i;
minValue = arr[i];
}
}
System.out.printf("Min Value: %d, Min Position: %d", minValue, minPosition + 1);
}
}
|
a8anassis/cf4
|
src/gr/aueb/cf/ch6/ArrayMinApp2.java
|
2,187 |
package gr.aueb.cf.ch4;
import java.util.Scanner;
/**
* Διαβάζει char με Scanner.
*/
public class CharScannerApp {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char inputChar = ' ';
// Η nextLine επιστρέφει όλη τη γραμμή μέχρι το \n
// Η charAt(0) επιστρέφει τον πρώτο char ως UTF-16
inputChar = in.nextLine().charAt(0);
System.out.println("Input char: " + inputChar);
}
}
|
a8anassis/cf4
|
src/gr/aueb/cf/ch4/CharScannerApp.java
|
2,188 |
package com.unipi.chrisavg.eventity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.SizeReadyCallback;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.unipi.chrisavg.eventity.ui.tickets.TicketsFragment;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.HashMap;
import java.util.Map;
public class UserTicket extends AppCompatActivity {
FirebaseAuth auth;
CollectionReference Reservations,Events;
FirebaseFirestore db;
String receivedReservationId;
Organizer organizer;
Event event;
TextView purchaserName,seat,eventName,eventDate,eventTime,eventLocation,eventPrice,eventOrganizer,map;
final Reservation[] reservation = {null};
String sendingActivity;
private View loadingLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_ticket);
ScrollView Scroll = findViewById(R.id.SV_general);
purchaserName = findViewById(R.id.PurchaserName);
seat = findViewById(R.id.Seat);
eventName = findViewById(R.id.EventName);
eventDate = findViewById(R.id.EventDate);
eventTime = findViewById(R.id.EventTime);
eventLocation = findViewById(R.id.EventLocation);
map = findViewById(R.id.map);
eventPrice = findViewById(R.id.EventPrice);
eventOrganizer = findViewById(R.id.EventOrganizer);
loadingLayout = findViewById(R.id.loading_layout);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
// getSupportActionBar().hide();
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
UserTicket.super.onBackPressed();
}
});
setStatusBarCustomColor(this);
auth = FirebaseAuth.getInstance();
db = FirebaseFirestore.getInstance();
Reservations = db.collection("Reservations");
Events = db.collection("Events");
Intent intent = getIntent();
if (intent != null) {
receivedReservationId = intent.getStringExtra("ReservationID");
sendingActivity = intent.getStringExtra("SendingActivity");
}
Reservations.document(receivedReservationId).get()
.addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
if(documentSnapshot.exists()){
reservation[0] = documentSnapshot.toObject(Reservation.class);
ImageView TicketQRCode = findViewById(R.id.TicketQRCode);
Glide.with(getApplicationContext())
.load(reservation[0].getTicketQRCodeURL())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(TicketQRCode); //περναμε στο imageView με το qrCode ticket το qrCode που παιρνουμε απο το reservation
purchaserName.setText(reservation[0].getTicketPersonFirstName() + " " + reservation[0].getTicketPersonLastName());
Events.document(reservation[0].getEventId()).get()
.addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot2) {
if(documentSnapshot2.exists()){
event = documentSnapshot2.toObject(Event.class);
// Χρησιμοποιουμε το RequestOptions για να ορίσουμε επιλογές για το Glide (προαιρετικά)
RequestOptions requestOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(getApplicationContext())
.load(event.getPhotoURL())
.apply(requestOptions)
.into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
// Ορίζουμε τη φορτωμένη εικόνα του event ως φόντο του RelativeLayout
Scroll.setBackground(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
// Χειρισμός της περίπτωσης όπου η φόρτωση της εικόνας εκκαθαρίζεται
}
});
String paddedSeat = String.format("%0"+String.valueOf(event.getCapacity()).length()+"d", reservation[0].getSeat());
seat.setText( paddedSeat);
eventName.setText(event.getTitle());
int index = event.getDateToCustomFormat().indexOf('•'); // Βρισκουμε τη θεση του χαρακτήρα '•'
eventDate.setText(event.getDateToCustomFormat().substring(0, index).trim());
eventTime.setText(eventTime.getText() + event.getDateToCustomFormat().substring(index+1).trim());
eventLocation.setText(event.getLocation());
double tempPrice = event.getPrice();
if (tempPrice==0){
eventPrice.setText("Free Ticket");
}else{
eventPrice.setText(String.valueOf(tempPrice));
}
db.collection("Organizers").document(event.getOrganizerId())
.get()
.addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
if(documentSnapshot.exists()){
organizer = documentSnapshot.toObject(Organizer.class);
eventOrganizer.setText(organizer.getFirstname() + " " + organizer.getLastname());
}
loadingLayout.setVisibility(View.GONE);
}
});
map.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Καθορίζουμε το γεωγραφικό πλάτος και μήκος της τοποθεσίας
double latitude = event.getGeopoint().getLatitude();
double longitude = event.getGeopoint().getLongitude();
// Δημιουργουμε ενα intent για να ανοίξει ο χάρτης με οδηγίες προς τις καθορισμένες συντεταγμένες
Uri gmmIntentUri = Uri.parse("geo:" + latitude + "," + longitude);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps"); // Αυτό διασφαλίζει ότι ανοίγει στην εφαρμογή Χάρτες Google, εάν είναι διαθέσιμη
// Ελέγχουμε αν υπάρχει διαθέσιμη εφαρμογή χάρτη στη συσκευή.
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
} else {
// Χειρισμός της περίπτωσης όπου δεν έχει εγκατασταθεί καμία εφαρμογή χαρτών
// Εμφανίζουμε ένα μήνυμα στο χρήστη
DisplaySnackbar(v,getString(R.string.something_went_wrong_try_again_later));
}
}
});
}
}
});
}
}
});
}
private void setStatusBarCustomColor(AppCompatActivity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
activity.getWindow().setStatusBarColor(getResources().getColor(R.color.statusBarColor));
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (menu instanceof MenuBuilder) {
((MenuBuilder) menu).setOptionalIconsVisible(true);
}
getMenuInflater().inflate(R.menu.actionbar2,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch(item.getItemId()) {
case R.id.CancelOrder:
loadingLayout.setVisibility(View.VISIBLE);
Reservations.document(receivedReservationId).delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
// Διαγραφή εγγράφου απο το reservations collection με επιτυχία
//Μειώνουμε τα ReservedTickets του event κατά ένα
event.setReservedTickets(event.getReservedTickets()-1);
// Δημιουργήστε ένος map για να κρατήσουμε τα ενημερωμένα δεδομένα
Map<String, Object> updateData = new HashMap<>();
updateData.put("ReservedTickets", event.getReservedTickets());
// Ενημέρωση του εγγράφου
Events.document(reservation[0].getEventId()).update(updateData)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
// Ας διαγράψουμε την εικόνα από το storage επίσης
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReference();
String imagePath = reservation[0].getEventId() + "-" + reservation[0].getUserId();
StorageReference imageRef = storageRef.child(imagePath);
imageRef.delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
// Η εικόνα διαγράφηκε επιτυχώς
Toast.makeText(UserTicket.this, getString(R.string.order_cancelled), Toast.LENGTH_SHORT).show();
if (sendingActivity.equals("TicketsFragment")) {
Intent intent = new Intent(UserTicket.this,MainActivity.class);
intent.putExtra("OpenTicketsFragment",true);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Καθαρίστε την προς τα πίσω στοίβα
startActivity(intent);
finishAffinity();
} else if(sendingActivity.equals("CheckOutActivity")) {
//ενημερώνουμε το receivedEvent του SpecificEventDetailedActivity για τα δεσμευμένα εισιτήρια
SpecificEventDetailedActivity.receivedEvent.setReservedTickets(event.getReservedTickets());
//έτσι ώστε να επαναφορτωθούν τα reservedTickets του receivedEvent του SpecificEventDetailedActivity
SpecificEventDetailedActivity.shouldReload=true;
finish();
}else if(sendingActivity.equals("SpecificEventDetailedActivity")){
//ενημερώνουμε το receivedEvent του SpecificEventDetailedActivity για τα δεσμευμένα εισιτήρια
SpecificEventDetailedActivity.receivedEvent.setReservedTickets(event.getReservedTickets());
//έτσι ώστε να επαναφορτωθούν τα reservedTickets του receivedEvent του SpecificEventDetailedActivity
SpecificEventDetailedActivity.shouldReload=true;
finish();
}
//loadingLayout.setVisibility(View.GONE);
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Χειρισμός σφαλμάτων σε περίπτωση αποτυχίας της διαγραφής
Toast.makeText(UserTicket.this, getString(R.string.something_went_wrong_try_again_later), Toast.LENGTH_SHORT).show();
}
});
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(UserTicket.this, getString(R.string.something_went_wrong_try_again_later), Toast.LENGTH_SHORT).show();
}
});
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(UserTicket.this, getString(R.string.something_went_wrong_try_again_later), Toast.LENGTH_SHORT).show();
}
});
break;
case R.id.ContactOrganizer:
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:" + organizer.getEmail()));
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{organizer.getEmail()});
startActivity(emailIntent);
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}
void DisplaySnackbar(View view,String message){
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_SHORT);
View v = snackbar.getView();
TextView tv = (TextView) v.findViewById(com.google.android.material.R.id.snackbar_text);
tv.setTypeface(Typeface.DEFAULT_BOLD);
tv.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
snackbar.show();
}
}
|
xristos-avgerinos/Eventity
|
app/src/main/java/com/unipi/chrisavg/eventity/UserTicket.java
|
2,191 |
package week1;
public class Foititis {
String AT; // αριθμός ταυτότητας.
protected String department = "csd-uoc" ;
private static int numberOfStudentsCreated;
static int getNumberOfStudentsCreated() {
return numberOfStudentsCreated;
}
int birthYear = -1;
int AM =0 ;
String name;
String[] activities; // = { "Μπιλιάρδο" };
String activitiesToString() {
String retString ="";
if (activities!=null) {
for (int i=0; i< activities.length; i++ ) {
retString += activities[i] + " ";
}
}
return retString;
}
public String toString() {
return "Φοιτ. του τμήματος " + department + " με όνομα " + name + " και ΑΜ " + AM + " γεννηθ. το " + birthYear + "\n\t Του αρέσει: " + activitiesToString();
}
Foititis(Foititis original) {
this(original.AM, original.name);
}
public Foititis() {
numberOfStudentsCreated++;
//this(0,"ΟΚανένας");
}
Foititis(int am) {
this(am,"Δεν ξέρω πως τον λένε");
}
public Foititis(String name) {
this(0,name);
}
public Foititis(int AM, String name) {
if (AM>0) // check validity of parameters
this.AM = AM;
else
this.AM = -AM; // auto correction
this.name = name;
numberOfStudentsCreated++;
}
}
class MyApp {
public static void main(String[] a) {
System.out.println("STARTED");
Foititis f1 = new Foititis(-2, "Yannis");
f1.AT = "2";
Foititis f2 = new Foititis();
Foititis f3 = new Foititis("Παναγιώτης Παναγιώτου του Παναγιώτη");
Foititis f4 = new Foititis(245);
f4.department = "Μαθηματικό";
Foititis f5 = new Foititis(f4);
//Foititis f6 = (Foititis)f4.clone();
//Foititis f5 = f4;
//f5.department = "CSD again";
//f4.numberOfStudentsCreated =300;
/*
String[] tmps = { "Πινγ Πονγκ", "Κολύμπι", "Cinema" };
f3.activities = tmps;
*/
System.out.println(f1);
System.out.println(f2);
System.out.println(f3);
System.out.println(f4);
System.out.println(f5);
System.out.println("Πλήθος στιγμιοτύπων που έχουν δημιουργηθεί: " + Foititis.getNumberOfStudentsCreated());
}
}
|
YannisTzitzikas/CS252playground
|
CS252playground/src/week1/Foititis.java
|
2,193 |
package api;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Η Κλάση αναπαριστά ενα κατάλυμα. Κάθε κατάλυμα έχει πεδία που το αποτελούν τα στοιχεία του καθώς και κάποιες παροχές
* {@link api.Accommodation#utilities}. Tα πεδία όνομα, πόλη και διεύθυνση προσδιορίζουν
* μοναδικά ένα κατάλυμα. Επιπλέον το κατάλυμα μπορεί να δεχτεί αξιολογήσεις από έναν {@link api.Customer}.
* Τέλος το κατάλυμα παρέχει μεθόδους για την εισαγώγη και διαγραφή αξιολόγησης για το κατάλυμα.
*/
public class Accommodation implements Serializable
{
private String type;
private String name;
private String road;
private String city;
private String postalCode;
private String description;
private double average;
private HashMap<String, String> utilities;
private static ArrayList<Accommodation> accommodations = new ArrayList<>();
private ArrayList<Review> reviews = new ArrayList<>(); // Reviews για το συγκεκριμένο accommodation
/**
* Αποτελεί λίστα λίστων με σκοπό την αποθήκευση των προαιρετικών παροχών του καταλύματος.
* Είναι παράλληλη λίστα με την selectedBoolean.
*/
private ArrayList<ArrayList<String>> selected = new ArrayList<>();
public void setSelected(ArrayList<ArrayList<String>> selected) {
this.selected.addAll(selected);
}
public String getDescription() {
return description;
}
public ArrayList<ArrayList<String>> getSelected() {
return selected;
}
public ArrayList<ArrayList<Boolean>> getSelectedBoolean() {
return selectedBoolean;
}
public void setSelectedBoolean(ArrayList<ArrayList<Boolean>> selectedBoolean) {
this.selectedBoolean.addAll(selectedBoolean);
}
private ArrayList<ArrayList<Boolean>> selectedBoolean = new ArrayList<>();
/**
* @param name Όνομα του καταλύματος, το μήκος του ονόματος μπορεί να είναι απο 3 μέχρι 128 χαρατήρες.
* Μπορεί να υπάρξουν δυο καταλύματα με ίδιο όνομα αρκεί να μην έχουν ίδια πόλη, διεύθυνση δηλωμένη.
* @param type Τύπος καταλύματος, μπορεί να είναι ξενοδοχείο ή διαμέρισμα ή και μεζονέτα.
* @param road Οδός που βρίσκεται το κατάλυμα.
* @param postalCode Ταχυδρομικός κώδικας
* @param description Μικρή περιγραφή του καταλύματος
* @param city Πόλη που βρίσκεται το κατάλυμα.
* @param optionals Οι παροχές του καταλύματος, αποτελούν ένα HashMap με key την επιλογή π.χ θεα ή ψυχαγωγία και
* value τι παρέχει το κατάλυμα. Για παράδειγμα για key: Διαδίκτυο το κατάλυμα έχει value: wifi, ethernet.
*/
public Accommodation(String name, String type, String road, String postalCode, String description, String city, HashMap<String, String> optionals) {
this.name = name;
this.type = type;
this.road = road;
this.postalCode = postalCode;
this.description = description;
this.utilities = optionals;
this.city=city;
this.average = -1;
}
public void setName(String name) {
this.name = name;
}
public void setType(String type) {
this.type = type;
}
public void setRoad(String addr) {
this.road = addr;
}
public void setCity(String city) {
this.city = city;
}
public void setPostalCode(String postal) {
this.postalCode = postal;
}
public void setDescription(String description) {
this.description = description;
}
public void setUtilities(HashMap util) {
this.utilities = util;
}
public static boolean addAccommodation(String name, String type, String addr, String postalCode, String desc, String city, HashMap<String, String> utilities, String provider) {
if (!accommodations.contains(new Accommodation(name, type, addr, postalCode, desc, city, utilities))) {
accommodations.add(new Accommodation(name, type, addr, postalCode, desc, city, utilities));
return true;
}
return false;
}
// Used for testing purposes
public static void setAccommodations(ArrayList<Accommodation> accs) {
accommodations = accs;
}
public static ArrayList<Accommodation> getAccommodations() {
return accommodations;
}
/**
* Μέθοδος που υπολογίζει το μέσο όρο των αξιολογήσεων που έχει δεχτεί το Accommodation.
* Καλείται κάθε φορά που δέχεται ή αφαιρείται ένα Review απο το Accommodation.
* @return double τιμή που αναπαριστά τον μ.ο. των αξιολογήσεων με ακρίβεια 2 δεκαδικών ψηφίων.
*/
public double calculateAverage() {
if (this.reviews.size() == 0) { return -1; }
double sum = 0;
for (int i = 0; i < this.reviews.size(); i++) {
sum += this.reviews.get(i).getRating();
}
return (double)Math.round(sum / this.reviews.size() * 100) / 100;
}
/**
* @return String aναλυτική περιγραφή του καταλύματος.
*/
public String toString()
{
String a = "Name of the accommodation is: " + this.name + "\n";
a += "The type of the accommodation is: " + this.type + "\n";
a += "The City of the accommodation is: " + this.city + "\n";
a += "The road of the accommodation is: " + this.road + "\n";
a += "The postalCode of the accommodation is: " + this.postalCode + "\n";
a += "A small description for the accommodation: " + this.description + "\n";
a += "The rating of the accommodations is: " + (this.average == -1 ? "No reviews." : calculateAverage()) + "\n";
for (String key : utilities.keySet()) {
if (utilities.get(key).equals("")) {
continue;
}
a += "The accommodation has " + key + " more details: \n ";
int counter = 1;
for (String v : utilities.get(key).split(",")) {
a += "(" + counter + ") " + v + " ";
if (counter % 3 == 0) {
a += "\n ";
}
counter++;
}
a += "\n";
}
a += "The accommodation has " + reviews.size() + " review" + (reviews.size() != 1 ? "s" : "") + ".\n";
for (int i = 0; i < reviews.size(); i++) {
a += reviews.get(i);
}
return a;
}
public String getName() {
return name;
}
public void setAverage(double a) {
this.average = a;
}
public double getAverage() {
return average;
}
public ArrayList<Review> getReviews() {
return reviews;
}
/**
* Προσθέτω το Review στο {@link api.Accommodation#reviews}, στην συνέχεια υπολογίζω ξανά
* το μέσο όρο των Reviews που έχει δεχτεί το συγκεκριμένο Accommodation.
*
* @param rev Review που πρέπει να προστεθεί στις αξιολογήσεις του Accommodation.
*/
public void addReview(Review rev) { // Μέθοδος που προσθέτει review στο Accommodation
reviews.add(rev);
this.average = calculateAverage();
}
/**
* Αφαιρώ το Review απο το {@link api.Accommodation#reviews}, στην συνέχεια υπολογίζω ξανά
* το μέσο όρο των Reviews που έχει δεχτεί το συγκεκριμένο Accommodation.
*
* @param reviewForDelete Review που πρέπει να φύγει απο το Accommodation
*/
public void removeReview(Review reviewForDelete) {
reviews.remove(reviewForDelete);
this.average = calculateAverage();
}
/**
* Μέθοδος που ελέγχει αν υπάρχει κάποιο Accommodation καταχωρημένο με βάση το όνομα, οδό και πόλη.
*
* @param name Όνομα καταλύματος
* @param road Διεύθυνση καταλύματος
* @param city Πολή του καταλύματος
* @return Επιστρέφει Accommodation με που έχει ως τιμές τις παραμέτρους της μεθόδου, αλλιώς αν δεν βρεθεί κάποιο
* Accommodation με αυτές τις τιμές τότε επιστρέφει null.
*/
public static Accommodation findAccommodation(String name,String road,String city) {
for(int i = 0; i < accommodations.size(); i++) {
if(accommodations.get(i).getRoad().equals(road) && accommodations.get(i).getName().equals(name) && accommodations.get(i).getCity().equals(city)) {
return accommodations.get(i);
}
}
return null;
}
public String getCity() {
return city;
}
public String getPostalCode() {
return postalCode;
}
public String getType() {
return type;
}
public String getRoad()
{
return road;
}
public HashMap<String, String> getUtilities() {
return utilities;
}
/**
* @param obj κατάλυμα προς εξέταση.
* Δυο Accommodation είναι ίδια αν-ν εχόυν τα πεδία όνομα, πόλη, και διεύθυνση ίσα.
* @return boolean τιμή ανάλογα με το αν δυο καταλύματα είναι ίδια.
*/
@Override
public boolean equals(Object obj)
{
if(this==obj)
{
return true;
}
if(!(obj instanceof Accommodation)) {
return false;
}
if(this.city.equals(((Accommodation) obj).city))
{
if(this.name.equals(((Accommodation) obj).getName()))
{
if(this.road.equals(((Accommodation) obj).getRoad()))
{
return true;
}
}
}
return false;
}
/**
* Μέθοδος που ελέγχει αν ένα Accommodation έχει έστω και μία παροχή καταλύματος.
* Διατρέχει το HashMap με τις παροχές, και ελέγχει αν υπάρχει μη κενή τιμή.
* @return boolean τιμή ανάλογα με το αν έχει κάποια παροχή ή όχι.
*/
public boolean hasOptionals()
{
for(String key:utilities.keySet())
{
if(!utilities.get(key).equals(""))
{
return true;
}
}
return false;
}
}
|
StylianosBairamis/oop-myreviews-project
|
src/api/Accommodation.java
|
2,198 |
package MemoryGame;
import UserInterfaces.GraphicsComponents.DifficultyForm;
import UserInterfaces.GraphicsComponents.Mode;
import java.awt.*;
/**
* Η κλάση υλοποιεί το κλασικό παιχνίδι με έναν ή πολλούς παίκτες.
* Λειτουργεί ως μια διασύνδεση μεταξύ του UI και του ταμπλό
*
* @author Δημήτριος Παντελεήμων Γιακάτος
* @author Θεμιστοκλής Χατζηεμμανουήλ
* @version 1.0.0
*/
public class ClassicGame extends MemoryGame {
private Table table;
private int copies;
/**
* Προετοιμάζει ένα καινούργιο παιχνίδι με την επιλεγμένη δυσκολία και αριθμό παικτών.
* Το ταμπλό παραμένει ανοιχτό μέχρι την κλήση της StartGame
*
* @param difficultyForm Η φόρμα με τα ονόματα και το είδος του κάθε παίκτη
* @param mode Το είδος του παιχνιδιού (Απλό, Διπλό, Τρίο)
*/
public ClassicGame(DifficultyForm difficultyForm, Mode mode) {
super(mode);
int width, height;
if(mode == Mode.Basic) {
copies = 2;
width = 6;
height = 4;
} else if (mode == Mode.Double) {
copies = 2;
width = 8;
height = 6;
} else if (mode == Mode.Triple) {
copies = 3;
width = height = 6;
} else {
throw new RuntimeException("Invalid Mode. Duel is implemented in class DuelGame");
}
table = new Table(width, height, copies);
players = new Player[difficultyForm.playersTypes.length];
for(int i = 0; i < difficultyForm.playersTypes.length; i++) {
if(difficultyForm.playersTypes[i] == 0) {
players[i] = new Player(difficultyForm.playersNames[i], copies);
} else if (difficultyForm.playersTypes[i] == 1) {
players[i] = new ClassicCPU(0, copies, width, height);
} else if (difficultyForm.playersTypes[i] == 2) {
players[i] = new ClassicCPU(50, copies, width, height);
} else if (difficultyForm.playersTypes[i] == 3) {
players[i] = new ClassicCPU(100, copies, width, height);
} else {
throw new RuntimeException("Invalid player type given at index " + i);
}
}
}
@Override
public void StartGame() {
currentlyPlayingPlayerIndex = 0;
table.HideAllCards();
}
@Override
public boolean OpenCard(Point selection) {
Card openedCard = table.OpenCard(selection);
if(openedCard != null) {
GetCurrentPlayingPlayer().AlertAboutTheIdentityOfOpenedCard(selection, openedCard);
for (Player player : players) {
player.AlertAboutOpenCard(selection, openedCard);
}
GetCurrentPlayingPlayer().IncrementOpenCards();
return GetCurrentPlayingPlayer().GetOpenedCards() == copies;
}
throw new RuntimeException("Something went terribly wrong");
}
@Override
public void VerifyOpenCards() {
boolean isPlayingAgain = true;
Card openCard = table.SameOpenCards();
GetCurrentPlayingPlayer().IncrementMoves();
if (openCard != null) {
for (Player player : players) {
player.AlertAboutFoundCards(openCard, table.GetOpenCardsCoordinates());
}
table.RemoveOpenCards();
GetCurrentPlayingPlayer().IncrementScore();
if(table.GetRemainingCards() == 0) {
FinishedGame();
}
} else {
isPlayingAgain = false;
table.HideAllCards();
}
GetCurrentPlayingPlayer().ResetOpenedCards();
if(!isPlayingAgain) {
NextPlayer();
}
}
/**
* @return Οι κάρτες πάνω στο ταμπλό
*/
public Card[][] GetCurrentBoardState() {
return table.GetAllCards();
}
}
|
dpgiakatos/MemoryGame
|
MemoryGame/ClassicGame.java
|
2,206 |
/**
*
*/
package client;
import SoundexGR.SoundexGRExtra;
import SoundexGR.SoundexGRSimple;
/**
* @author Yannis Tzitzikas ([email protected])
*
*/
/*
* This class provides some examples of SoundexGR
*/
public class Examples {
/**
* Replaces some special characters for being readable by latex
* @param w
* @return
*/
static public String toLatex(String w) {
return w.replace("$","\\$")
.replace("@","$@$")
.replace("&","\\&")
.replace("^","$\\wedge$")
;
}
public static void main(String[] lala) {
System.out.println("**SoundexGR Examples**");
String[] testCases = {
"Θάλασσα","θάλλασα","θάλασα", "θαλασών",
"μήνυμα","μύνημα","μίνιμα","μοίνειμα",
"έτοιμος", "έτιμος", "έτημος", "έτυμος", "έτιμως", "αίτημος",
"αυγό","αβγό","αυγολάκια","αβγά", "αυγά",
"τζατζίκι", "τσατζίκι","τσατσίκι",
"μπαίνω","μπένω",
"ξέρω","κσαίρο",
"αύξων","άφξον",
"εύδοξος","εβδοξος",
"κορονοιός", "κοροναιός",
"οβελίας", "ωβελύας","οβελίσκος",
"Βαγγέλης","Βαγκέλης","Βαγκαίλης",
"Γιάννης", "Γιάνης", "Γιάνννης",
"αναδιατάσσω", "αναδιέταξα",
"θαύμα", "θάβμα", "θαυμαστικό"
};
System.out.println("\n word --> SGRSimp | SGRExtra"); // for including it in latex
for (String w: testCases) {
System.out.printf("%12s --> %6s | %s \n", w, SoundexGRSimple.encode(w), SoundexGRExtra.encode(w));
}
System.out.println("\n word --> SGRSimp | SGRExtra (for latex)"); // for including it in latex
for (String w: testCases) {
System.out.printf("\\GreekToEnglish{%s} & $\\rightarrow$ &\\GreekToEnglish{%s} &\\GreekToEnglish{%s}\\\\\n", w,
toLatex(SoundexGRSimple.encode(w)),
toLatex(SoundexGRExtra.encode(w)));
}
}
}
|
YannisTzitzikas/SoundexGR
|
SoundexGR/src/client/Examples.java
|
2,207 |
package gr.aueb.cf.ch4;
/**
* Υπολογίζει το άθροισμα και το γινόμενο
* των 10 πρώτων αριθμών από 1 έως το 10.
*/
public class SumMulFor {
public static void main(String[] args) {
int sum = 0;
int mul = 1;
for (int i = 1; i <= 10; i++) {
sum += i;
mul *= i;
}
System.out.println("Sum: " + sum);
System.out.println("Mul: " + mul);
}
}
|
a8anassis/cf6-java
|
src/gr/aueb/cf/ch4/SumMulFor.java
|
2,213 |
package Apartments_details_Rns;
import java.util.ArrayList;
import java.util.List;
public class Apartment {
private int apartment_id;
private String name;
private String available_from;
private String available_until;
private String city;
private String address;
private float price;
private int capacity;
private String features;
private int up_rent;
private int up_swap;
private int user_id;
/**
* Full constuctor
*
*
* @param apartment_id;
* @param name;
* @param available_from;
* @param available_until;
* @param city;
* @param address;
* @param price;
* @param capacity;
* @param features;
* @param up_rent;
* @param up_swap;
* @param user_id;
*/
public Apartment(int apartment_id, String name, String available_from, String available_until,
String city, String address, float price, int capacity, String features, int up_rent,int up_swap, int user_id) {
this.name = name;
this.apartment_id = apartment_id;
this.available_from= available_from;
this.available_until = available_until;
this.city = city;
this.address= address;
this.price= price;
this.capacity= capacity;
this.features= features;
this.up_rent= up_rent;
this.up_swap= up_swap;
this.user_id= user_id;
}
public int getApartmentId() {
return apartment_id;
}
public void setApartmentId(int apartment_id) {
this.apartment_id = apartment_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvailableFrom() {
return available_from;
}
public void setAvailableFrom(String available_from) {
this.available_from = available_from;
}
public String getAvailableUntil() {
return available_until;
}
public void setAvailableUntil(String available_until) {
this.available_until = available_until;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address= address;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public void setFeatures(String features) {
this.features = features;
}
public String getFeatures() {
return features;
}
public void setUpRent(int up_rent) {
this.up_rent = up_rent;
}
public int getUpRent() {
return up_rent;
}
public void setUpSwap(int up_swap) {
this.up_swap = up_swap;
}
public int getUpSwap() {
return up_swap;
}
public void setUserId(int user_id) {
this.user_id = user_id;
}
public int getUserId() {
return user_id;
}
public static List<Apartment> createApartmentList() {
List<Apartment> apartmentList = new ArrayList<>();
// Adding sample apartments to the list
apartmentList.add(new Apartment(122, "Filoxenia", "4/1/24", "6/1/24","Portaria", "Portaria 234", 150, 1, okay, 1,0, 1111));
apartmentList.add(new Apartment(122, "Filoxenia", "4/1/24", "6/1/24","Portaria", "Portaria 234", 150, 1, okay, 1,0, 1111));
// Add more apartments as needed
return apartmentList;
}
|
FayKounara/R-S
|
3ο παραδοτέο/Νέος φάκελος/searchzoi.java
|
2,215 |
package gr.aueb.cf.ch10;
import java.util.Arrays;
import java.util.Comparator;
public class MaxCarArrivalsApp {
public static void main(String[] args) {
int[][] arr = {{1012, 1056}, {1022, 1150}, {1317, 1405}, {1027, 1409}, {1100, 1200}};
//είναι ο δισδιάστατος πίνακας με τις ώρες άφηξης και τις ώρες αποχώρησης από το garage
int[][] transformed;
//o νέος πίνακας με 0 1 αν ήρθε η έφυγε
transformed =transform(arr);
sortByTime(transformed);
System.out.println("max arrivals:" + getMaxConcurrentCars(transformed));
}
public static int [][] transform(int[][] arr) {
int [] [] transformed = new int [arr.length*2][2];
for(int i = 0; i <arr.length; i++) {
transformed[i * 2][0] = arr[i][0];
transformed[i * 2][1] = 1;
transformed[i * 2 + 1][0] = arr[i][1];
transformed[i * 2 + 1][1] = 0;
}
return transformed;
}
public static void sortByTime(int[][] arr) {
Arrays.sort(arr, Comparator.comparing(a -> a[0]));
//για κάθε στοιχείο (row) α με ποιο από τα δυο να ταξινομήσει;;
// με το α[0] ή με το α[1];;
}
public static int getMaxConcurrentCars(int[][] arr) {
int count = 0;
int maxCount = 0;
for (int[] a : arr) {
if(a[1] == 1) {
count++;
if (count > maxCount) maxCount = count;
}else { //if a[1] = 0
count--;
}
}
return maxCount;
}
}
|
Mariamakr/codingfactory23a
|
src/gr/aueb/cf/ch10/MaxCarArrivalsApp.java
|
2,216 |
package gr.cti.eslate.mapViewer;
import java.util.ListResourceBundle;
/**
* Menu Bundle.
* <P>
*
* @author Giorgos Vasiliou
* @version 3.0.0, 17-Nov-1999
*/
public class MenuBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"file", "Αρχείο"},
{"new", "Νέος χάρτης..."},
{"save", "Αποθήκευση"},
{"manage", "Διαχείριση"},
{"clearhistory", "Καθαρισμός ιστορικού χαρτών"}
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/mapViewer/MenuBundle_el_GR.java
|
2,217 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.io.File;
import java.net.URL;
public class Example5 {
public static void main(String[] args) throws Exception {
MP3Player player = new MP3Player();
player.addToPlayList(new File("test1.mp3"));
player.addToPlayList(new File("test2.mp3"));
player.addToPlayList(new URL("http://server.com/mp3s/test3.mp3"));
player.play();
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example5.java
|
2,218 |
package com.iNNOS.controllers;
import java.net.URL;
import java.util.ResourceBundle;
import com.iNNOS.mainengine.MainEngine;
import com.iNNOS.model.Client;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.Alert.AlertType;
public class NewClientController implements Initializable{
@FXML
private TextArea clientDetails;
@FXML
private TextField phoneNumber;
@FXML
private TextField address;
@FXML
private TextField municipality;
@FXML
private TextField fullName;
@FXML
private TextField afm;
@FXML
private TextField webpage;
@FXML
private TextField email;
MainEngine eng;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
}
@FXML
void addNewClientOnAction(ActionEvent event) {
if (validateKeyFields()) {
// Creating Client object by extracting data from the UI's textfields
String clientName = fullName.getText();
String clientAfm = afm.getText();
String clientAddress = address.getText();
String clientDimos = checkField(municipality.getText());
Long phone = Long.parseLong(phoneNumber.getText());
String page = checkField(webpage.getText());
String details = checkField(clientDetails.getText());
Client clientToAdd = new Client(clientName, clientAfm, clientAddress, clientDimos, phone, page, details);
// A connection between app & database established
eng = MainEngine.getMainEngineInstance();
eng.establishDbConnection();
if (eng.createNewClient(clientToAdd)) {
eng.generateAlertDialog(AlertType.INFORMATION,
"Νέος πελάτης εισήχθηκε στη Βάση",
"Ο πελάτης : "+clientName+"\nΑ.Φ.Μ : "+clientAfm+"\nεισήχθηκε επιτυχώς στο σύστημα").showAndWait();
removeTextOnAction(event);
}
}
}
@FXML
void removeTextOnAction(ActionEvent event) {
fullName.setText("");
afm.setText("");
address.setText("");
municipality.setText("");
phoneNumber.setText("");
email.setText("");
webpage.setText("");
clientDetails.setText("");
}
private String checkField(String field) {
if (field.equals(""))
return null;
return field;
}
private boolean validateKeyFields() {
if (fullName.getText().equals("") || afm.getText().equals("")) {
eng.generateAlertDialog(AlertType.WARNING,
"Κενά Πεδία",
"Παρακαλώ εισάγεται Ονοματεπώνυμο ή/και Α.Φ.Μ πελάτη").showAndWait();
return false;
}
return true;
}
}
|
vaggelisbarb/Business-Management-App
|
src/main/java/com/iNNOS/controllers/NewClientController.java
|
2,220 |
package xmaze;
import javax.swing.UIManager;
/**
* ΕΑΠ - ΠΛΗ31 - 4η ΕΡΓΑΣΙΑ 2015-2016
* @author Tsakiridis Sotiris
*/
public class XMaze {
public static MainFrameXMaze mf; // The main window
public static void main(String[] args) {
// Set Nimbus Look & Feel
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainFrameXMaze.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainFrameXMaze.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainFrameXMaze.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainFrameXMaze.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
// Τροποποίηση της γλώσσας στα πλήκτρα του διαλόγου JOptionPane
UIManager.put("OptionPane.yesButtonText", "Ναι");
UIManager.put("OptionPane.noButtonText", "Όχι");
// Μετάφραση στα ελληνικά του JFileChooser
UIManager.put("FileChooser.openButtonText","Άνοιγμα");
UIManager.put("FileChooser.cancelButtonText","Ακύρωση");
UIManager.put("FileChooser.saveButtonText","Αποθήκευση");
UIManager.put("FileChooser.cancelButtonToolTipText", "Ακύρωση");
UIManager.put("FileChooser.saveButtonToolTipText", "Αποθήκευση");
UIManager.put("FileChooser.openButtonToolTipText", "Άνοιγμα");
UIManager.put("FileChooser.lookInLabelText", "Αναζήτηση σε :");
UIManager.put("FileChooser.fileNameLabelText", "Όνομα αρχείου:");
UIManager.put("FileChooser.filesOfTypeLabelText", "Τύπος αρχείου:");
UIManager.put("FileChooser.upFolderToolTipText", "Επάνω");
UIManager.put("FileChooser.homeFolderToolTipText", "Αρχικός Φάκελος");
UIManager.put("FileChooser.newFolderToolTipText", "Νέος Φάκελος");
UIManager.put("FileChooser.listViewButtonToolTipText","Προβολή λίστας");
UIManager.put("FileChooser.detailsViewButtonToolTipText", "Προβολή λεπτομερειών");
// Δημιουργία του MainFrame και προβολή
mf = new MainFrameXMaze();
mf.setTitle("XMaze");
mf.setResizable(false);
mf.setLocationRelativeTo(null);
mf.setVisible(true);
} // end main()
}
|
artibet/graphix
|
src/xmaze/XMaze.java
|
2,221 |
/** 321/2012015 - Aylakiotis Christos
* icsd11063 - Katsivelis Kwn/nos
*/
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.math.BigInteger;
import java.net.URL;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.SecretKey;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.filechooser.FileSystemView;
public class FileCrypt{
private Digest digest;
private SecretKey sKey;
private final HashMap<String,Boolean> isEncrypted = new HashMap(); //Voithaei sto na vriskei poia arxeia einai kwdikopoihmena
//(gia ti leitourgia tou koumpiou (encrypt/decrypt)
public void showLoginGUI(){
JFrame frame = new JFrame("Files Vault Login");
JLabel loginL = new JLabel("Σύνδεση Χρήστη:");
loginL.setBounds(200, 50, 200, 20);
loginL.setFont(new Font("Tahoma", Font.BOLD, 19));
loginL.setForeground(Color.white);
JLabel usernameL = new JLabel("'Ονομα Χρήστη");
usernameL.setBounds(250, 80, 200, 20);
usernameL.setFont(new Font("Tahoma", Font.PLAIN, 15));
usernameL.setForeground(Color.blue);
JTextField usernameF = new JTextField();
usernameF.setBounds(250, 100, 200, 20);
usernameF.setBackground(Color.black);
JLabel passwordL = new JLabel("Κωδικός Χρήστη");
passwordL.setBounds(250, 120, 200, 20);
passwordL.setFont(new Font("Tahoma", Font.PLAIN, 15));
passwordL.setForeground(Color.blue);
JPasswordField passwordF = new JPasswordField();
passwordF.setBounds(250, 140, 200, 20);
passwordF.setBackground(Color.black);
JLabel msgL = new JLabel("error message");
msgL.setBounds(250, 200, 200, 20);
msgL.setForeground(Color.red);
msgL.setFont(new Font("Tahoma", Font.ITALIC, 13));
msgL.setVisible(false);
JButton loginB =new JButton("Σύνδεση");
loginB.setBounds(370, 170, 120, 20);
loginB.setForeground(Color.white);
loginB.setBackground(Color.black);
JLabel msg2L = new JLabel("error message");
msg2L.setBounds(250, 420, 2050, 20);
msg2L.setForeground(Color.red);
msg2L.setFont(new Font("Tahoma", Font.ITALIC, 13));
msg2L.setVisible(false);
//Edw ginetai i authentikopoihsh tou xristi
loginB.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
msg2L.setVisible(false);
try{
msgL.setVisible(false);
String username = usernameF.getText();
String password = passwordF.getText();
if(username.isEmpty() || password.isEmpty()){
throw new Exception("Ύπάρχουν κενά πεδία.");
}
if(!loadUsersDigest(username)){
throw new Exception("'Ο χρήστης δεν υπάρχει.");
}
PBKDF2 PBKDF2 = new PBKDF2(password, username, 2000, 32);
SecretKey sKey = PBKDF2.getDK(); //To sKey gia ti paragwgi tou authHash
SecretKey sKey256 = PBKDF2.getDK256(); //To sKey gia ti kwdikopoihsh AES256 twn arxeiwn
//Paragwgi tou authHash
byte[] authHash = new PBKDF2(toHex(sKey.getEncoded()), password, 1000, 32).getDK().getEncoded();
RSA2048 RSA2048 = new RSA2048();
//Apodikopoihsh tou zeugous <username,authHash> apo RSA2048
String digestDecrypted = RSA2048.decrypt(fromHex(digest.toString()));
//pernw to username kai ti katopsi tou authHash apo to String
String digestParts[] = digestDecrypted.split("<|\\,|\\>");
//Sugkrinw tis katopseis me tin methodo slowEquals wste to sustima na einai pio duskolo na spasei
if(slowEquals(fromHex(digestParts[2]),authHash)){
setSKey(sKey256);
showOptionsGUI(username);
frame.dispose();
}else{
throw new Exception("Λάθος κωδικός πρόσβασης.");
}
}catch(Exception ex){
passwordF.setText("");
msgL.setText(ex.getMessage());
msgL.setVisible(true);
}
}
});
JLabel registerL = new JLabel("Νέος Χρήστης:");
registerL.setBounds(200, 230, 200, 20);
registerL.setFont(new Font("Tahoma", Font.BOLD, 19));
registerL.setForeground(Color.white);
JLabel nusernameL = new JLabel("'Ονομα Χρήστη");
nusernameL.setBounds(250, 260, 200, 20);
nusernameL.setFont(new Font("Tahoma", Font.PLAIN, 15));
nusernameL.setForeground(Color.blue);
JTextField nusernameF = new JTextField();
nusernameF.setBounds(250, 280, 200, 20);
nusernameF.setBackground(Color.black);
JLabel npasswordL = new JLabel("Κωδικός Χρήστη");
npasswordL.setBounds(250, 300, 200, 20);
npasswordL.setFont(new Font("Tahoma", Font.PLAIN, 15));
npasswordL.setForeground(Color.blue);
JPasswordField npasswordF = new JPasswordField();
npasswordF.setBounds(250, 320, 200, 20);
npasswordF.setBackground(Color.black);
JLabel npassword2L = new JLabel("Επαλήθευση Κωδικού");
npassword2L.setBounds(250, 340, 200, 20);
npassword2L.setFont(new Font("Tahoma", Font.PLAIN, 15));
npassword2L.setForeground(Color.blue);
JPasswordField npassword2F = new JPasswordField();
npassword2F.setBounds(250, 360, 200, 20);
npassword2F.setBackground(Color.black);
JButton registerB =new JButton("Εγγραφή");
registerB.setBounds(370, 390, 120, 20);
registerB.setForeground(Color.white);
registerB.setBackground(Color.black);
//Edw ginetai i eggrafi neou xristi
registerB.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
msgL.setVisible(false);
try{
String username = nusernameF.getText();
String password = npasswordF.getText();
if(username.isEmpty() || password.isEmpty()
|| npassword2F.getText().isEmpty()){
throw new Exception("Ύπάρχουν κενά πεδία.");
}
if(!npassword2F.getText().equals(password)){
throw new Exception("Οι κωδικοί δέν ταιριάζουν.");
}
if(loadUsersDigest(username)){
throw new Exception("Το όνομα χρήστη υπάρχει.");
}
msg2L.setVisible(false);
//Paragwgi tou sKey
SecretKey sKey = new PBKDF2(password, username, 2000, 32).getDK();
System.out.println(sKey);
//Paragwgi tou authHash
String authHash = toHex(new PBKDF2(toHex(sKey.getEncoded()), password, 1000, 32).getDK().getEncoded());
String digest = "<"+username+","+authHash+">";
//Apothikeuei to zeugos
saveUsersDigest(digest);
String directoriesPath = "Folders/Directories";
//Ftiaxneis tous fakelous an den uparxoun
File dir = new File(directoriesPath);
if (!(dir.exists() && dir.isDirectory())) {
dir.mkdir();
}
File userDir = new File(directoriesPath+"/"+username);
userDir.mkdir();
msg2L.setText("Έγγραφή επιτυχής.");
msg2L.setFont(new Font("Tahoma", Font.ITALIC | Font.BOLD, 15));
msg2L.setForeground(Color.green);
msg2L.setVisible(true);
passwordF.setText("");
nusernameF.setText("");
npasswordF.setText("");
npassword2F.setText("");
}catch(Exception ex){
passwordF.setText("");
npasswordF.setText("");
npassword2F.setText("");
msg2L.setForeground(Color.red);
msg2L.setFont(new Font("Tahoma", Font.ITALIC, 13));
msg2L.setText(ex.getMessage());
msg2L.setVisible(true);
}
}
});
Container pane = frame.getContentPane();
pane.setLayout(null);
pane.setBackground(Color.ORANGE.darker());
pane.add(loginL);
pane.add(usernameL);
pane.add(usernameF);
pane.add(passwordL);
pane.add(passwordF);
pane.add(loginB);
pane.add(msgL);
pane.add(registerL);
pane.add(nusernameL);
pane.add(nusernameF);
pane.add(npasswordL);
pane.add(npasswordF);
pane.add(npassword2L);
pane.add(npassword2F);
pane.add(registerB);
pane.add(msg2L);
setIcon(frame,"locker.png");
frame.setSize(700, 500);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public void showOptionsGUI(String username){
String userHomePath = "Folders/Directories/"+username;
JFrame frame = new JFrame("Files Vault");
JLabel messageL = new JLabel();
messageL.setBounds(420, 400, 220, 30);
messageL.setFont(new Font("Tahoma", Font.BOLD, 14));
messageL.setForeground(Color.white);
JLabel loginL = new JLabel("Δυνατότητες:");
loginL.setBounds(60, 50, 200, 20);
loginL.setFont(new Font("Tahoma", Font.BOLD, 19));
loginL.setForeground(Color.white);
JButton addFileB = new JButton("Προσθήκη αρχείου");
addFileB.setBounds(110, 100, 220,30);
addFileB.setForeground(Color.white);
addFileB.setBackground(Color.black);
DefaultListModel model = new DefaultListModel();
JLabel listFilesL = new JLabel("Λίστα αρχείων:");
listFilesL.setBounds(400, 50, 200, 20);
listFilesL.setFont(new Font("Tahoma", Font.BOLD, 19));
listFilesL.setForeground(Color.white);
//vlepei pia arxeia uparxoun ston fakelo tou xristi
File userDir = new File(userHomePath);
File[] files = userDir.listFiles(new TextFileFilter());
//kai ta thetei ola ws kwdikopoihmena
for(int i=0; i<files.length;i++){
isEncrypted.put(files[i].getName(), Boolean.TRUE);
}
JList filesList = new JList();
filesList.setModel(model);
for(File f : files){
model.addElement(f);
}
filesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
filesList.setLayoutOrientation(JList.VERTICAL);
filesList.setCellRenderer(new FileRenderer(true));
JScrollPane filesSP = new JScrollPane(filesList);
filesSP.setBounds(400, 80, 250, 300);
//Edw prostithontai kainourgia arxeia
addFileB.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
messageL.setVisible(false);
JFileChooser chooser = new JFileChooser();
int returnValue = chooser.showOpenDialog(null);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = chooser.getSelectedFile();
new AESFileEncryption().encrypt(selectedFile, userHomePath, sKey);
File[] files = userDir.listFiles(new TextFileFilter());
isEncrypted.put(selectedFile.getName()+".safe", Boolean.TRUE);
model.removeAllElements();
for(File f : files){
model.addElement(f);
}
messageL.setText("Το αρχείο κωδικοποιήθηκε.");
messageL.setVisible(true);
}
}
});
JButton encOrDec = new JButton("Κρυπτογράφηση/Αποκρυπτογράφηση");
encOrDec.setBounds(110, 200, 220, 30);
encOrDec.setForeground(Color.white);
encOrDec.setBackground(Color.black);
//Edw ginetai kwdikopoihsh h apokodikopoihsh analoga ti xreiazetai
encOrDec.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
File selectedFile = (File)filesList.getSelectedValue();
System.out.println(selectedFile.getName());
if(isEncrypted.get(selectedFile.getName())){
new AESFileEncryption().decrypt(selectedFile, userHomePath, sKey);
int index = selectedFile.getName().lastIndexOf(".safe");
isEncrypted.put(selectedFile.getName().substring(0, index), Boolean.FALSE);//Afairw to .safe
messageL.setText("Το αρχείο αποκωδικοποιήθηκε.");
messageL.setVisible(true);
}else{
new AESFileEncryption().encrypt(selectedFile, userHomePath, sKey);
isEncrypted.put(selectedFile.getName()+".safe", Boolean.TRUE); //vazw to .safe
messageL.setText("Το αρχείο κωδικοποιήθηκε.");
messageL.setVisible(true);
}
File[] files = userDir.listFiles(new TextFileFilter());
model.removeAllElements();
for(File f : files){
model.addElement(f);
}
}
});
JButton openFileB = new JButton("Άνοιγμα αρχείου");
openFileB.setBounds(110, 300, 220, 30);
openFileB.setForeground(Color.white);
openFileB.setBackground(Color.black);
//Edw anoigei to arxeio me to default programm
openFileB.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
File selectedFile = (File)filesList.getSelectedValue();
if(selectedFile!=null){
try {
Desktop desktop = Desktop.getDesktop();
desktop.open(selectedFile);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
});
Container pane = frame.getContentPane();
pane.setLayout(null);
pane.setBackground(Color.ORANGE.darker());
pane.add(messageL);
pane.add(listFilesL);
pane.add(filesSP);
pane.add(loginL);
pane.add(addFileB);
pane.add(encOrDec);
pane.add(openFileB);
frame.setSize(700, 500);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
//Otan kleinei trexei tin encryptAll gia na ta kwdikopoihsei ola osa einai apokwdikopoihmena
frame.addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {}
@Override
public void windowClosing(WindowEvent e) {
System.out.println("Closing..");encryptAll(userHomePath);}
@Override
public void windowClosed(WindowEvent e) {}
@Override
public void windowIconified(WindowEvent e) {}
@Override
public void windowDeiconified(WindowEvent e) {}
@Override
public void windowActivated(WindowEvent e) {}
@Override
public void windowDeactivated(WindowEvent e) {}
});
}
public void encryptAll(String userHomePath){
try{
System.out.println("Encrypting all unencrypted files..");
File userDir = new File(userHomePath);
File[] files = userDir.listFiles(new TextFileFilter());
for(int i=0;i<files.length;i++){
if(!isEncrypted.get(files[i].getName())){
System.out.println("Encrypting: "+files[i].getName());
new AESFileEncryption().encrypt(files[i], userHomePath, sKey);
System.out.println("Done.");
}
}
System.out.println("Encryption successfull.");
}catch(Exception e){
e.printStackTrace();
}
}
//Apothikeuei to zeugos (username,authHash) kwdikopoihmeno se RSA2048
public boolean saveUsersDigest(String digest){
final String dirpath = "Folders/Digests";
final String filepath = dirpath+"/digests.data";
ObjectOutputStream out = null;
try{
File dfdir = new File(dirpath);
File dfile = new File(filepath);
if (!(dfdir.exists() && dfdir.isDirectory())) {
dfdir.mkdir();
}
if ((dfile.exists())) {
out = new AppendableObjectOutputStream (new FileOutputStream (dfile, true));
}else{
out = new ObjectOutputStream (new FileOutputStream (dfile));
}
RSA2048 RSA2048 = new RSA2048();
String digestEncrypted = toHex(RSA2048.encrypt(digest));
out.writeObject(new Digest(digestEncrypted));
out.flush();
out.close();
return true;
}catch(Exception ex){
Logger.getLogger(FileCrypt.class.getName()).log(Level.SEVERE, null, ex);
}finally{
try{
if (out != null){
out.close ();
}
}catch(Exception ex){}
return false;
}
}
//Fortwnei to zeugos (username,authHash)
public boolean loadUsersDigest(String username){
boolean found = false;
File dfile = new File ("Folders/Digests/digests.data");
Digest digest;
if (dfile.exists ()){
ObjectInputStream in;
try{
in = new ObjectInputStream (new FileInputStream (dfile));
while((digest = (Digest)in.readObject()) != null){
RSA2048 RSA2048 = new RSA2048();
String digestDecrypted = RSA2048.decrypt(fromHex(digest.toString()));
String digestParts[] = digestDecrypted.split("<|\\,|\\>");
if(digestParts[1].equals(username)){
this.digest = digest;
found = true;
break;
}
}
in.close();
}catch(EOFException ex){}catch (IOException | ClassNotFoundException ex) {
Logger.getLogger(FileCrypt.class.getName()).log(Level.SEVERE, null, ex);
}
}
return found;
}
public void setSKey(SecretKey sKey){
this.sKey = sKey;
}
public void setIcon(JFrame frame,String iconpath ){
URL path = ClassLoader.getSystemResource(iconpath);
if(path!=null) {
ImageIcon img = new ImageIcon(path);
frame.setIconImage(img.getImage());
}
}
public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
File ffdir = new File("Folders");
if (!(ffdir.exists() && ffdir.isDirectory())) {
ffdir.mkdir();
}
new FileCrypt().showLoginGUI();
}
});
}
//I methodos gia sugkrisi twn duo bytes arrays
//Einai pio argi apo tin Arrays.equal kai giauto ti protimisa
//Source : https://crackstation.net/hashing-security.htm
private static boolean slowEquals(byte[] a, byte[] b){
int diff = a.length ^ b.length;
for(int i = 0; i < a.length && i < b.length; i++)
diff |= a[i] ^ b[i];
return diff == 0;
}
//I methodoi gia metatropi byte array apo kai se 16adiko
private byte[] fromHex(String hex){
byte[] bytes = new byte[hex.length() / 2];
for(int i = 0; i<bytes.length ;i++)
{
bytes[i] = (byte)Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16);
}
return bytes;
}
private String toHex(byte[] array){
BigInteger bi = new BigInteger(1, array);
String hex = bi.toString(16);
int paddingLength = (array.length * 2) - hex.length();
if(paddingLength > 0)
{
return String.format("%0" +paddingLength + "d", 0) + hex;
}else{
return hex;
}
}
//Αυτη η κλαση επιτρεπει την εγγραφη ενος αντικειμενου σε ενα αρχειο κανοντας το append
private static class AppendableObjectOutputStream extends ObjectOutputStream {
public AppendableObjectOutputStream(OutputStream out) throws IOException {
super(out);
}
@Override
protected void writeStreamHeader() throws IOException {}
}
//To filtro gia na vrei mono ta arxeia
class TextFileFilter implements FileFilter {
public boolean accept(File file) {
return !file.isDirectory();
}
}
class FileRenderer extends DefaultListCellRenderer {
private boolean pad;
private Border padBorder = new EmptyBorder(3,3,3,3);
//Custom FileRenderer
FileRenderer(boolean pad) {
this.pad = pad;
}
@Override
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
Component c = super.getListCellRendererComponent(
list,value,index,isSelected,cellHasFocus);
JLabel l = (JLabel)c;
if(value.getClass().getCanonicalName().equals("java.lang.String")){
l.setText((String)value);
}else{
File f = (File)value;
l.setText(f.getName());
l.setIcon(FileSystemView.getFileSystemView().getSystemIcon(f));
}
if (pad) {
l.setBorder(padBorder);
}
return l;
}
}
}
|
icsd12015/projects_security
|
FileCrypt/Project/src/FileCrypt.java
|
2,222 |
package com.example.skinhealthchecker;
/*
Εμφανίζει ένα ερωτηματολόγιο για τον χρήστη σχετικά με την εντοπισμένη ελιά . Δίνει την επιλογές στον
χρήστη σχετικά για το αν θέλει να αποθηκεύσει η να ανανεώσει μια ελιά ή όχι .
*/
/*
Displays a questionnaire for the user about the localized mole, gives the choices to
user about whether he wants to store or update an mole or not.
*/
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.support.design.widget.TabLayout;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TabHost;
import android.widget.TextView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import static android.R.color.black;
import static android.graphics.Color.RED;
/**
* Created by chief on 20/2/2017.
*/
//public class Questionmark extends AppCompatActivity {
public class Questionmark extends Activity implements
CompoundButton.OnCheckedChangeListener {
TabHost tabHost;
static String TAG;
static double realwidth; // the width of the mole
static double realheight;// the height of the mole
private Spinner spinner2; // spinner filled with activ profiles moles names
private boolean liquid=false; //if true , the mole has liquid on it
private boolean itch=false;//if true , the mole has itch
private boolean inpain = false;//if true , the mole is in pain
private boolean ishard = false;//if true , the mole has hard felling
private boolean edgesproblem=false;//if true , the mole has edgesproblem
private static double [][] morfology;// morphology of the mole [][0] for one side [][1] for the other
static InputStream imageStream; // used to load the image
public static Bitmap value; // image of the mole
DatabaseHandler db; // db handler
private static double colorproblem;//if true, the mole have more than one color
private static boolean edgessimilarityproblem;// if true, the mole has asymmetry
private static int src;//the length of mole (in lines or rows (what ever is bigger)
public void onCreate(Bundle savedInstanceState) {
db = new DatabaseHandler(this); //links the db with the handler
TAG = "RESULTS";
Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();// gets info from last activity
if (extras != null) {
Intent intent = getIntent();
realwidth = intent.getDoubleExtra("realwidth", 0);
realheight = intent.getDoubleExtra("realheight", 0);
edgesproblem = intent.getBooleanExtra("edgesproblem", false);
src= intent.getIntExtra("src", 0);
//Bundle b = intent.getExtras();
String[][] value = (String[][]) extras.getSerializable("tableString");
// morfology= new double[5][2];
morfology = new double[value.length][2];
for (int i = 0; i < value.length; i++) {// fills the morphology s array with data
morfology[i][0] = Double.parseDouble(value[i][0]);
morfology[i][1] = Double.parseDouble(value[i][1]);
}
colorproblem = intent.getDoubleExtra("colorproblem", 0); //updates the colorproblem status
edgessimilarityproblem = intent.getBooleanExtra("edgessimilarityproblem", false);//updates the edgessimilarityproblem status
}
Configurations def = db.getDEf();// gets the apps configurations
if (def.GetLanguage()){// select to load the xml having the active language
setContentView(R.layout.tablayout);
TabHost host = (TabHost)findViewById(R.id.tabHost);// setups 3 tabs using the greek language
host.setup();
//Tab 1
TabHost.TabSpec spec = host.newTabSpec("Νέος");
spec.setContent(R.id.base);
spec.setIndicator("Νέος σπίλος");
host.addTab(spec);
//Tab 2
spec = host.newTabSpec("Αποθηκευμένος");
spec.setContent(R.id.base2);
spec.setIndicator("Αποθηκευμένος\n σπίλος");
host.addTab(spec);
//Tab 3
spec = host.newTabSpec("Χωρίς");
spec.setContent(R.id.base3);
spec.setIndicator("Χωρίς αποθήκευση");
host.addTab(spec);
}
else{
setContentView(R.layout.tablayouten);
TabHost host = (TabHost)findViewById(R.id.tabHost);// setups 3 tabs using the english language
host.setup();
//Tab 1
TabHost.TabSpec spec = host.newTabSpec("New");
spec.setContent(R.id.base);
spec.setIndicator("New mole");
host.addTab(spec);
//Tab 2
spec = host.newTabSpec("Saved");
spec.setContent(R.id.base2);
spec.setIndicator("Saved \n mole");
host.addTab(spec);
//Tab 3
spec = host.newTabSpec("nosave");
spec.setContent(R.id.base3);
spec.setIndicator("No-save mode");
host.addTab(spec);
}
spinner2 = (Spinner) findViewById(R.id.spinner22); // links the xml contents with local vars
//tabs 1 checkboxs names has one digit
//tabs 2 checkboxs names has two digits
//tabs 3 checkboxs names has three digits
final CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox); //checkBox s for liquid case
final CheckBox checkBox00 = (CheckBox) findViewById(R.id.checkBox12);
final CheckBox checkBox000 = (CheckBox) findViewById(R.id.checkBox333);
final CheckBox checkBox2 = (CheckBox) findViewById(R.id.checkBox2); //checkBox s for hasitch case
final CheckBox checkBox22 = (CheckBox) findViewById(R.id.checkBox22);
final CheckBox checkBox222 = (CheckBox) findViewById(R.id.checkBox2333);
final CheckBox checkBox3 = (CheckBox) findViewById(R.id.checkBox3);//checkBox s for ishard's case
final CheckBox checkBox33 = (CheckBox) findViewById(R.id.checkBox32);
final CheckBox checkBox333 = (CheckBox) findViewById(R.id.checkBox333);
final CheckBox checkBox4 = (CheckBox) findViewById(R.id.checkBox4);//checkBox s for inpain case
final CheckBox checkBox44 = (CheckBox) findViewById(R.id.checkBox42);
final CheckBox checkBox444 = (CheckBox) findViewById(R.id.checkBox4333);
final EditText textname =(EditText) findViewById(R.id.name33); // in here user writes the name of the new mole
checkBox.setOnCheckedChangeListener(this);//setups listeners
checkBox00.setOnCheckedChangeListener(this);
checkBox000.setOnCheckedChangeListener(this);
checkBox2.setOnCheckedChangeListener(this);
checkBox22.setOnCheckedChangeListener(this);
checkBox222.setOnCheckedChangeListener(this);
checkBox3.setOnCheckedChangeListener(this);
checkBox33.setOnCheckedChangeListener(this);
checkBox333.setOnCheckedChangeListener(this);
checkBox4.setOnCheckedChangeListener(this);
checkBox44.setOnCheckedChangeListener(this);
checkBox444.setOnCheckedChangeListener(this);
Button captureButton = (Button) findViewById(R.id.save);// if the user press save button
captureButton.setFocusable(true);
// captureButton.setFocusableInTouchMode(true);
captureButton.requestFocus();
captureButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//
TextView textv = (TextView) findViewById(R.id.textView2); // prints message to user in case of something goes wrong
String name=textname.getText().toString(); //gets the name
Log.d("incheck", Boolean.toString(liquid));
if (!name.isEmpty()) {// if name is filled
// starts diagnosis activity
Intent intent = new Intent(getApplicationContext(), Diagnosis.class);
Bundle b = new Bundle();//sends to next activity the mole id and if the user wants not to save the current mole
intent.putExtra("id", CreateNewMole(name)); //Optional parameters
intent.putExtra("delete", false); //Optional parameters
startActivity(intent);
} else {
Configurations def = db.getDEf();
if (def.GetLanguage()) {
//in case of users does not give name
textv.setText("Πρέπει να δώσετε ένα όνομα \n πριν προχωρήσετε !!!!", TextView.BufferType.EDITABLE);
textv.setTextColor(RED);
}
else{
textv.setText("You must insert name before proceeding!!!!", TextView.BufferType.EDITABLE);
textv.setTextColor(RED);
}
//
}
}
});
Button captureButton2 = (Button) findViewById(R.id.save222);// case of second tab button
captureButton2.setFocusable(true);
// captureButton.setFocusableInTouchMode(true);
captureButton2.requestFocus();
captureButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//
String name =String.valueOf(spinner2.getSelectedItem()); // gets the name of the mole that will updates from the spiner
/** if (checkBox00.isEnabled()) {
liquid = true;
}
if (checkBox22.isEnabled()) {
itch = true;
}
if (checkBox33.isEnabled()) {
ishard = true;
}
if (checkBox44.isEnabled()) {
inpain = true;
}
if (checkBox55.isEnabled()) {
history = true;
}
**/
Intent intent = new Intent(getApplicationContext(), Diagnosis.class);// start s diagnosis activity
Bundle b = new Bundle();//sends to next activity the mole id , and that the mole will not be deleted
intent.putExtra("delete", false); //Optional parameters
intent.putExtra("id", UpdateMole(name)); //Optional parameters
startActivity(intent);
//
}
});
Button captureButton3 = (Button) findViewById(R.id.save2333);// case of 3 tab
captureButton3.setFocusable(true);
// captureButton.setFocusableInTouchMode(true);
captureButton3.requestFocus();
captureButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//
Intent intent = new Intent(getApplicationContext(), Diagnosis.class); // start the diagnosis tab
Bundle b = new Bundle();
intent.putExtra("id", CreateNewMole(("nosave"))); //creates and sends new id
intent.putExtra("delete", true); //sets that the mole will be deleted
startActivity(intent);
//
}
});
if (GetNewId()>0) // if there is moles of current profile stored in database then fills the name spinner with moles
// if (false)
{
// Configurations def = db.getDEf();
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, GetCreatedNames()); //selected item will look like a spinner set from XML
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //fills the spinner
spinner2.setAdapter(spinnerArrayAdapter);
getWindow().getDecorView().findViewById(R.id.base).invalidate();// updates graphics
}
else
{
db.getWritableDatabase();
}
}
@Override
public void onBackPressed() { // if back is pressed then go back to start activity
Intent intent = new Intent(getApplicationContext(), CameraActivity.class);
// intent.putExtra("realwidth", realwidth); //Optional parameters
// intent.putExtra("realheight", realheight); //Optional parameters
startActivity(intent);
}
// returns next available mole id
public int GetNewId() {
Configurations def = db.getDEf();
int id = def.GetIdM();// gets next available id
return id;
}
/*
this function gets the name of profile as input , finds its id and returns it
*/
public int GetSelectedId(String in ){
List<Mole> myList = new ArrayList<Mole>();
myList =db.getAllMoles();// get all moles stored in db
int out=-1;//init
for(int i=myList.size()-1;i>=0;i--){
if (myList.get(i).GetName().equals(in)) {// if the name match any moles name
out = myList.get(i).GetId();//gets its id
break;
}
}
return out;
}
/*
The function GetCreatedNames returns all moles names that is stored in db
in backwards order
*/
public String [] GetCreatedNames( ){
List<Mole> myList = new ArrayList<Mole>();
Configurations def =db.getDEf();// gets the actives profiles instance
Profile pro =db.getProfile(def.GetPID());
// mole = db.getAllMoles();
myList = db.getAllProfileMoles(pro);// gets all profile's moles
// myList =db.getAllMoles();
String names [] = new String[myList.size()];
int count =0;
for(int i=myList.size()-1;i>=0;i--){
names[count]=myList.get(count).GetName();//saves moles names backwards
count++;// names counter
}
return names;
}
//this function gets a mole's name ,finds its id , gets the instance of the mole and updates its data in db
//also checks if moles evolving
public int UpdateMole(String name){
Mole last = new Mole();
double diameter =0;
if (realwidth>realheight)// calculates the diameter
diameter=realwidth;
else
diameter=realwidth;
int id=GetSelectedId(name); // gets the moles id
last.SetMole(Geturl(id));// updates its data
// last.SetWidth(realwidth);
// last.SetHeight(realheight);
// last.SetAge(Integer.parseInt(age));
last.SetBadBorder(edgesproblem);
// last.SetBadHistory(history);
last.SetColorCurve(colorproblem);
last.SetEvolving(false);
// last.SetGender(sex);
last.SetHasAsymmetry(edgessimilarityproblem);
last.SetDLD(false); // the mole can upload again
last.SetHasBlood(liquid);
last.SetId(id);
last.SetIsHard(ishard);
last.SetHasItch(itch);
last.SetMorfology(morfology);
last.SetName(name);
last.SetInPain(inpain);
Log.d("id",Integer.toString(GetNewId()));
Configurations def=db.getDEf();
last.SetPID(def.GetPID());
Log.d("id",Integer.toString(GetNewId()));
def.idup();// up the counter of next available mole id
Mole old=db.getMole(id);// gets old instance of mole and compares with new one
last.SetDiameter(diameter);
Log.d("diamm",Double.toString(last.GetDiameter()));
double oldDiameter =0;
if (old.GetWidth()>old.Getheight())
oldDiameter=old.GetWidth();
else
oldDiameter=old.Getheight();
if(Math.abs(diameter-oldDiameter)>oldDiameter*0.3) // if there the new one .com is 30% bigger
{
last.SetEvolving(true);// sets that is an evolving mole
}
if(old.GetEvolving() )
{
last.SetEvolving(true);// if the old mole was evolving -> the new one will also
}
double oldMorfology [][]= old.GetMorfology();//checks new and older morphology's
if (MyLib.dangerousedges(morfology,oldMorfology,src) )
last.SetEvolving(true);
if (last.GetEvolving())//if evolving then is bad
last.SetIsbad(true);
db.updateMole(last);// update the mole in db
Bitmap photo =Getbitmap(5);// reading the new image from storage
savebitmap(photo,last.GetId());// updating old image in storage
photo.recycle();// clean the photo from memory
return last.GetId();// returns the id
}
//this function Gets as input moles name
// returns the id of the mole
/*
the function creates a mole instant , fills it with data , gets a new id and saves the instance to data base
*/
public int CreateNewMole(String name){
Mole last = new Mole();
if (realwidth>realheight)// calculates diameter
last.SetDiameter(realwidth);
else
last.SetDiameter(realwidth);
last.SetMole(Geturl(GetNewId()));// inputs data
last.SetWidth(realwidth);
last.SetHeight(realheight);
// last.SetAge(Integer.parseInt(age));
last.SetBadBorder(edgesproblem);
// last.SetBadHistory(history);
last.SetColorCurve(colorproblem);
last.SetEvolving(false);
// last.SetGender(sex);
last.SetHasAsymmetry(edgessimilarityproblem);
last.SetHasBlood(liquid);
last.SetId(GetNewId());
Log.d("prin thn apothi",Boolean.toString(ishard));
last.SetIsHard(ishard);
last.SetHasItch(itch);
// last.SetMole();
last.SetMorfology(morfology);
last.SetName(name);
last.SetInPain(inpain);
last.SetIsbad(false);// the diagnosis is in next activity
last.SetDLD(false);// the mole can upload
Log.d("hard",Boolean.toString(last.GetIsHard()));
Log.d("id",Integer.toString(GetNewId()));
Configurations def=db.getDEf(); //gets apps configurations
//def.idup();
last.SetPID(def.GetPID());// sets next available id
// def = new Configurations(Integer.parseInt(age),sex,history,GetNewId());
Log.d("id",Integer.toString(GetNewId()));
def.idup();//next available id gets bigger
// def.SetAge(Integer.parseInt(age));
// def.SetHistory(history);
// def.SetGender(sex);
db.updateDef(def);// updates configurations
db.addMole(last);// saves mole in DB
Bitmap photo =Getbitmap(5); //read the mole photo from storage
savebitmap(photo,last.GetId()); //generates a unique dir and saves it
photo.recycle();
// Molestest(last);
return last.GetId();// returns id
}
/*
Ths function gets as input a id and generates a save dir
*/
public String Geturl(int id) {
File mediaStorageDir = new File( // gets apps private dir
this.getExternalFilesDir(Environment.getDataDirectory().getAbsolutePath()).getAbsolutePath());
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
Log.d("MyCameraApp", "failed to create directory");
return null;
}
}// adds to dir ->SAVED+id+.nodata
File pictureFile = new File(mediaStorageDir.getPath() + File.separator + "SAVED"+ Integer.toString(id) + ".nodata");
//returns path
return pictureFile.getPath();}
public static final int MEDIA_TYPE_IMAGE = 1;
// this function gets an image which was saved temporary at previous intent
/*
returns the image
*/
public Bitmap Getbitmap(int h) {
Log.e(TAG, "geting bitmap");
String NOMEDIA=" .nomedia";
File mediaStorageDir = new File(
this.getExternalFilesDir(Environment.getDataDirectory().getAbsolutePath()).getAbsolutePath());
// Create the storage directory if it does not exist
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
Log.d("MyCameraApp", "failed to create directory");
return null;
}
}//creats the dir url
File pictureFile = new File(mediaStorageDir.getPath() + File.separator + "IMGtmp2" +Integer.toString(h)+ ".nodata");
try {//
imageStream = new FileInputStream(pictureFile);//loads the image to stream
value = BitmapFactory.decodeStream(imageStream);//gets the image from stream
value= Bitmap.createBitmap(
value,
0,
0,
value.getWidth()
,
value.getHeight()
);
// Bitmap lastBitmap = null;
//lastBitmap = Bitmap.createScaledBitmap(value, 2000, 2000, true);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return value;// retutns image
}
/*
this function gets as input a moles image and a moles id
generates the saving dir
and saves the image at the dir
*/
public void savebitmap(Bitmap data ,int id) {
Randar.pictureFile = getOutputMediaFile(id); //creates the file and links it
NullPointerException e = null;
if (Randar.pictureFile == null) {
Log.d(TAG,
"Error creating media file, check storage permissions: "
+ e.getMessage());
return;
}
try {
FileOutputStream fos = new FileOutputStream(Randar.pictureFile); // gets the image in stream
data.compress(Bitmap.CompressFormat.JPEG, 100, fos);//set the compress type
fos.flush();// save image and close the stream
fos.close();
} catch (FileNotFoundException e1) {
Log.d(TAG, "File not found: " + e1.getMessage());
} catch (IOException e1) {
Log.d(TAG, "Error accessing file: " + e1.getMessage());
}
}
/*
This function gets a moles id and creates a file . Returns the file dir
*/
public File getOutputMediaFile(int id) {
String NOMEDIA=" .nomedia";//gets apps private id
File mediaStorageDir = new File(this.getExternalFilesDir(Environment.getDataDirectory().getAbsolutePath()).getAbsolutePath());
if(!mediaStorageDir.exists())
{
if (!mediaStorageDir.mkdirs()) {
Log.d("MyCameraApp", "failed to create directory");
return null;
}
}
// Create a media file name
// String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new
// Date());
// creates the file . the name of the image file will be SAVED+id+.nodata
File pictureFile = new File(mediaStorageDir.getPath() + File.separator + "SAVED"+ Integer.toString(id) + ".nodata");
return pictureFile;//returns the file
}
/*
this function is the checkbutton listener
// on change condition event get as input the id of checkbox which changed
// and the new condition and updates the correct static var .
*/
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { // if checked sets true
switch(buttonView.getId()){
case R.id.checkBox:
//do stuff
liquid=true;
break;
case R.id.checkBox12:
liquid=true;
//do stuff
break;
case R.id.checkBox333:
liquid=true;
//do stuff
break;
case R.id.checkBox2:
itch=true;
//do stuff
break;
case R.id.checkBox22:
itch=true;
//do stuff
break;
case R.id.checkBox2333:
itch=true;
//do stuff
break;
case R.id.checkBox3:
ishard=true;
//do stuff
break;
case R.id.checkBox32:
ishard=true;
//do stuff
break;
case R.id.checkBox3333:
ishard=true;
//do stuff
break;
case R.id.checkBox4:
inpain=true;
//do stuff
break;
case R.id.checkBox42:
inpain=true;
//do stuff
break;
case R.id.checkBox4333:
inpain=true;
//do stuff
break;
}
} else {// if not sets false
switch(buttonView.getId()){
case R.id.checkBox:
liquid=false;
//do stuff
break;
case R.id.checkBox12:
liquid=false;
//do stuff
break;
case R.id.checkBox333:
liquid=false;
//do stuff
break;
case R.id.checkBox2:
itch=false;
//do stuff
break;
case R.id.checkBox22:
itch=false;
//do stuff
break;
case R.id.checkBox2333:
itch=false;
//do stuff
break;
case R.id.checkBox3:
ishard=false;
//do stuff
break;
case R.id.checkBox32:
ishard=false;
//do stuff
break;
case R.id.checkBox3333:
ishard=false;
//do stuff
break;
case R.id.checkBox4:
inpain=false;
//do stuff
break;
case R.id.checkBox42:
inpain=false;
//do stuff
break;
case R.id.checkBox4333:
inpain=false;
//do stuff
break;
}
}
}
}
|
litsakis/SkinHealthChecker
|
skinHealthChecker/src/main/java/com/example/skinhealthchecker/Questionmark.java
|
2,226 |
package gr.aueb.softeng.view.SignUp.SignUpOwner;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.util.HashMap;
import gr.aueb.softeng.team08.R;
/**
* Η κλάση αυτή καλείται όταν πηγαίνει να προστεθεί νέος ιδιοκτήτης στην εφαρμογή
*/
public class SignUpOwnerActivity extends AppCompatActivity implements SignUpOwnerView {
/**
* Εμφανίζει ενα μήνυμα τύπου alert με
* τίτλο title και μήνυμα message.
* @param title Ο τίτλος του μηνύματος
* @param message Το περιεχόμενο του μηνύματος
*/
public void showErrorMessage(String title, String message)
{
new AlertDialog.Builder(SignUpOwnerActivity.this)
.setCancelable(true)
.setTitle(title)
.setMessage(message)
.setPositiveButton("OK", null).create().show();
}
/**
* Εμφανίζει μήνυμα επιτυχίας όταν ο ιδιοκτήτης δημιουργήσει επιτυχώς τον λογαριασμό του
* και επιστρέφει στο προηγούμενο ακτίβιτι όταν πατηθεί το κουμπί ΟΚ
*/
@Override
public void showAccountCreatedMessage()
{
new AlertDialog.Builder(SignUpOwnerActivity.this)
.setCancelable(true)
.setTitle("Επιτυχής δημιουργία λογαριασμού")
.setMessage("Ο λαγαριασμος δημιουργήθηκε με επιτυχία")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
}).create().show();
}
private static boolean initialized = false;
/**
* Δημιουργει το layout και αρχικοποιεί το activity
* Αρχικοποιούμε το view Model και περνάμε στον presenter το view
* Καλούμε τα activities όταν πατηθούν τα κουμπιά της οθόνης
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in {@link #onSaveInstanceState}. <b><i>Note: Otherwise it is null.</i></b>
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_sign_up_owner);
SignUpOwnerViewModel viewModel = new ViewModelProvider(this).get(SignUpOwnerViewModel.class);
viewModel.getPresenter().setView(this);
if (savedInstanceState == null) {
Intent intent = getIntent();
}
findViewById(R.id.CreateAccOwnerButton).setOnClickListener(new View.OnClickListener(){ // το κουμπί για να δημιουργηθεί ο λογαριασμός
@Override
public void onClick(View v){
viewModel.getPresenter().onCreateOwnerAccount();
}
});
findViewById(R.id.gobackButton2).setOnClickListener(new View.OnClickListener(){// το κουμπί για να επιστρέψει πίσω
@Override
public void onClick(View v){
viewModel.getPresenter().onBack();
}
});
}
/**
* Δημιουργεί ένα hash map στο οποίο έχουμε σαν κλειδί την περιγραφή πχ άν είναι username ή τηλέφωνο του ιδιοκτήτη
* και σαν value έχουμε την τιμή του κλειδιού την οποία παίρνουμε απο την οθόνη που έχει περάσει ο ιδιοκτήτης τα στοιχεία εγγραφής του
* @return Επιστρέφουμε το Hash Map αυτό με τα δεδομένα της οθόνης
*/
public HashMap<String,String> getOwnerDetails(){
HashMap<String,String> details = new HashMap<>();
details.put("name",(((EditText)findViewById(R.id.OwnerNameText)).getText().toString().trim()));
details.put("surname",(((EditText)findViewById(R.id.OwnerSurnameText)).getText().toString().trim()));
details.put("username",(((EditText)findViewById(R.id.OwnerUsernameText)).getText().toString().trim()));
details.put("email",(((EditText)findViewById(R.id.OwnerEmailText)).getText().toString().trim()));
details.put("telephone",(((EditText)findViewById(R.id.OwnerTelephoneText)).getText().toString().trim()));
details.put("iban",(((EditText)findViewById(R.id.OwnerIbanText)).getText().toString().trim()));
details.put("tin",(((EditText)findViewById(R.id.OwnerTinText)).getText().toString().trim()));
details.put("password",(((EditText)findViewById(R.id.OwnerPasswordText)).getText().toString().trim()));
return details;
}
/**
* Καλείται για να επιστρέψουμε στο προηγούμενο Activity
*/
public void goBack(){
finish();
}
}
|
vleft02/Restaurant-Application
|
app/src/main/java/gr/aueb/softeng/view/SignUp/SignUpOwner/SignUpOwnerActivity.java
|
2,227 |
package com.redhat.qe.katello.base;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.testng.annotations.DataProvider;
import com.redhat.qe.katello.base.obj.KatelloActivationKey;
import com.redhat.qe.katello.base.obj.KatelloDistributor;
import com.redhat.qe.katello.base.obj.KatelloEnvironment;
import com.redhat.qe.katello.base.obj.KatelloOrg;
import com.redhat.qe.katello.base.obj.KatelloProvider;
import com.redhat.qe.katello.base.obj.KatelloSystem;
import com.redhat.qe.katello.common.KatelloUtils;
public class KatelloCliDataProvider {
@DataProvider(name = "org_create")
public static Object[][] org_create(){
String uniqueID1 = KatelloUtils.getUniqueID();
String uniqueID2 = KatelloUtils.getUniqueID();
//name,label, description, ExitCode, Output
return new Object[][] {
{ "orgNoDescr_"+uniqueID1,null, null, new Integer(0), String.format(KatelloOrg.OUT_CREATE, "orgNoDescr_"+uniqueID1)},
{ "org "+uniqueID2+"", null, "Org with space", new Integer(0), String.format(KatelloOrg.OUT_CREATE, "org "+uniqueID2+"")},
{uniqueID1+strRepeat("0123456789", 24)+"ab", null, "Org name with 255 characters", new Integer(0), String.format(KatelloOrg.OUT_CREATE, uniqueID1+strRepeat("0123456789", 24)+"ab")},
{"!@#$%^&*()_+{}|:?[];.,"+uniqueID1, null, "Org name with special characters", new Integer(0), String.format(KatelloOrg.OUT_CREATE, "!@#$%^&*()_+{}|:?[];.,"+uniqueID1)}
};
}
/**
* Object[] contains of:<BR>
* provider:<BR>
* name<br>
* description<br>
* url<br>
* exit_code<br>
* output
*/
@DataProvider(name="provider_create")
public static Object[][] provider_create(){
// TODO - the cases with unicode characters still missing - there
// is a bug: to display that characters.
String uid = KatelloUtils.getUniqueID(); // .length() == 13
return new Object[][] {
// name
{ "aa", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"aa")},
{ "11", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"11")},
{ "1a", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"1a")},
{ "a1", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"a1")},
{ uid+strRepeat("0123456789", 24)+"ab", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,uid+strRepeat("0123456789", 24)+"ab")},
{ "prov-"+uid, null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"prov-"+uid)},
{ "prov "+uid, "Provider with space in name", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"prov "+uid)},
{ null, null, null, new Integer(2), System.getProperty("katello.engine", "katello")+": error: Option --name is required; please see --help"},
{ " ", null, null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ " a", null, null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a ", null, null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"a")},
{ "\\!@%^&*(<_-~+=//\\||,.>)", "Name with special characters", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE, "\\!@%^&*(<_-~+=//\\||,.>)")},
// description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"desc-specChars"+uid)},
{ "desc-255Chars"+uid, strRepeat("0123456789", 25)+"dabce", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"desc-255Chars"+uid)},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"111def", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"desc-256Chars"+uid)},
// url
{ "url-httpOnly"+uid, null, "http://", new Integer(2), System.getProperty("katello.engine", "katello")+": error: option --url: invalid format"}, // see below
{ "url-httpsOnly"+uid, null, "https://", new Integer(2), System.getProperty("katello.engine", "katello")+": error: option --url: invalid format"}, // according changes of: tstrachota
{ "url-redhatcom"+uid, null, "http://redhat.com/", new Integer(0), String.format(KatelloProvider.OUT_CREATE,"url-redhatcom"+uid)},
{ "url-with_space"+uid, null, "http://url with space/", new Integer(0), String.format(KatelloProvider.OUT_CREATE,"url-with_space"+uid)},
// misc
{ "duplicate"+uid, null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"duplicate"+uid)},
{ "duplicate"+uid, null, null, new Integer(166), "Validation failed: Name has already been taken"}
};
}
@DataProvider(name="provider_create_diffType")
public static Object[][] provider_create_diffType(){
String KTL_PROD = System.getProperty("katello.engine", "katello");
return new Object[][] {
{ "C", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'C' (choose from 'redhat', 'custom')"},
{ "Custom", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'Custom' (choose from 'redhat', 'custom')"},
{ "CUSTOM", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'CUSTOM' (choose from 'redhat', 'custom')"},
{ "rh", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'rh' (choose from 'redhat', 'custom')"},
{ "RedHat", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'RedHat' (choose from 'redhat', 'custom')"},
{ "REDHAT", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'REDHAT' (choose from 'redhat', 'custom')"},
{ "^custom", new Integer(2), KTL_PROD+": error: option --type: invalid choice: '^custom' (choose from 'redhat', 'custom')"},
{ " custom", new Integer(2), KTL_PROD+": error: option --type: invalid choice: ' custom' (choose from 'redhat', 'custom')"},
{ "custom ", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'custom ' (choose from 'redhat', 'custom')"}
};
}
@DataProvider(name="provider_delete")
public static Object[][] provider_delete(){
return new Object[][] {
// org
{ null, null, new Integer(2), "Option --org is required; please see --help"},
{ null, null, new Integer(2), "Option --name is required; please see --help"}
};
}
public static String strRepeat(String src, int times){
String res = "";
for(int i=0;i<times; i++)
res = res + src;
return res;
}
@DataProvider(name="client_remember")
public static Object[][] client_remember(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
{ "organizations-"+uid, "org-value",new Integer(0),"Successfully remembered option [ organizations-"+uid+" ]"},
{ "providers-"+uid, "prov-value",new Integer(0),"Successfully remembered option [ providers-"+ uid +" ]"},
{ "environments-"+uid, "env-value",new Integer(0),"Successfully remembered option [ environments-"+ uid +" ]"},
{ strRepeat("0123456789", 12)+"abcdefgh-"+uid, "long-value", new Integer(0), "Successfully remembered option [ "+strRepeat("0123456789", 12)+"abcdefgh-"+ uid +" ]"},
{ "opt-"+uid, "val-"+uid, new Integer(0), "Successfully remembered option [ opt-"+uid+" ]"},
{ "opt "+uid, "Option with space in name", new Integer(0), "Successfully remembered option [ opt "+uid+" ]"},
};
}
@DataProvider(name="permission_available_verbs")
public static Object[][] permission_available_verbs(){
return new Object[][] {
// org
{ "organizations", new Integer(0)},
{ "providers", new Integer(0)},
{ "environments", new Integer(0)},
};
}
@DataProvider(name="permission_create")
public static Object[][] permission_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
//String name, String scope,String tags,String verbs,Integer exitCode, String output
{ "perm-all-verbs-"+uid, "environments", null, "read_contents,update_systems,delete_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-read_contents-env-"+uid, "environments", null, "read_contents",new Integer(0),null},
{ "perm-read_update-env-"+uid, "environments", null, "read_contents,update_systems",new Integer(0),null},
{ "perm-del_read_reg-verbs-env-"+uid, "environments", null, "delete_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-register-verbs-env-"+uid, "environments", null, "register_systems",new Integer(0),null},
{ "perm-exclude_register-verbs-env-"+uid, "environments", null, "read_contents,update_systems,delete_systems,read_systems",new Integer(0),null},
{ "perm-update_register-verbs-env-"+uid, "environments", null, "update_systems,register_systems",new Integer(0),null},
{ "perm-read_update-verbs-provider-"+uid, "providers", null, "read,update",new Integer(0),null},
{ "perm-read-verbs-provider-"+uid, "providers", null, "read",new Integer(0),null},
{ "perm-update-verbs-provider-"+uid, "providers", null, "update",new Integer(0),null},
{ "perm-all-org"+uid, "organizations", null, "delete_systems,update,update_systems,read,read_systems,register_systems",new Integer(0),null},
{ "perm-all-tags-verbs-"+uid, "environments", "Library", "read_contents,update_systems,delete_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-some_verbs-org"+uid, "organizations", null, "update,update_systems,read,read_systems",new Integer(0),null},
};
}
@DataProvider(name="permission_create_headpinOnly")
public static Object[][] permission_create_headpinOnly(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
//String name, String scope,String tags,String verbs,Integer exitCode, String output
{ "perm-read_update-verbs-provider-"+uid, "providers", null, "read,update",new Integer(0),null},
{ "perm-read-verbs-provider-"+uid, "providers", null, "read",new Integer(0),null},
{ "perm-update-verbs-provider-"+uid, "providers", null, "update",new Integer(0),null},
{ "perm-all-org"+uid, "organizations", null, "delete_distributors,update_distributors,read_distributors,register_distributors,delete_systems,update,update_systems,read,read_systems,register_systems",new Integer(0),null},
{ "perm-some_verbs-org"+uid, "organizations", null, "update,update_systems,read,read_systems",new Integer(0),null},
{ "perm-some_dis_verbs-org"+uid, "organizations", null, "update,delete_distributors,update_distributors,read_distributors,register_distributors",new Integer(0),null},
{ "perm-some_sys_verbs-org"+uid, "organizations", null, "delete_systems,update_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-read_verbs-org"+uid, "organizations", null, "read",new Integer(0),null},
{ "perm-update_verbs-org"+uid, "organizations", null, "update",new Integer(0),null},
{ "perm-update_system_verbs-org"+uid, "organizations", null, "update_systems",new Integer(0),null},
{ "perm-update_dis_verbs-org"+uid, "organizations", null, "update_distributors",new Integer(0),null},
{ "perm-delete_system_verbs-org"+uid, "organizations", null, "delete_systems",new Integer(0),null},
{ "perm-delete_dis_verbs-org"+uid, "organizations", null, "delete_distributors",new Integer(0),null},
{ "perm-register_dis_verbs-org"+uid, "organizations", null, "register_distributors",new Integer(0),null},
{ "perm-register_sys_verbs-org"+uid, "organizations", null, "register_systems",new Integer(0),null},
{ "perm-read_sys_verbs-org"+uid, "organizations", null, "read_systems",new Integer(0),null},
{ "perm-read_dis_verbs-org"+uid, "organizations", null, "read_distributors",new Integer(0),null},
};
}
@DataProvider(name="user_role_create")
public static Object[][] user_role_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ uid+"-aa", null, new Integer(0), "Successfully created user role [ "+uid+"-aa ]"},
{ uid+"-11", null, new Integer(0), "Successfully created user role [ "+uid+"-11 ]"},
{ uid+"-1a", null, new Integer(0), "Successfully created user role [ "+uid+"-1a ]"},
{ uid+"-a1", null, new Integer(0), "Successfully created user role [ "+uid+"-a1 ]"},
{ uid+strRepeat("0123456789", 11)+"abcdefgh", null, new Integer(0), "Successfully created user role [ "+uid+strRepeat("0123456789", 11)+"abcdefgh"+" ]"},
{ "user_role-"+uid, null, new Integer(0), "Successfully created user role [ user_role-"+uid+" ]"},
{ "user_role "+uid, "Provider with space in name", new Integer(0), "Successfully created user role [ user_role "+uid+" ]"},
{ " ", null, new Integer(166), "Name can't be blank"},
{ " a", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a ", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a", null, new Integer(166), "Validation failed: Name must contain at least 3 character"},
{ "?1", null, new Integer(166), "Validation failed: Name must contain at least 3 character"},
{ strRepeat("0123456789", 12)+"abcdefghi", null, new Integer(0), "Successfully created user role [ 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefghi ]"},
// // description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", new Integer(0), "Successfully created user role [ desc-specChars"+uid+" ]"},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", new Integer(0), "Successfully created user role [ desc-256Chars"+ uid +" ]"},
// misc
{ "duplicate"+uid, null, new Integer(0), "Successfully created user role [ duplicate"+uid+" ]"},
};
}
@DataProvider(name="environment_create")
public static Object[][] environment_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ "env-aa", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-aa")},
{ "env-11", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-11")},
{ "env-1a", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-1a")},
{ "env-a1", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-a1")},
{ strRepeat("0123456789", 25)+"abcde", "Environment name with 255 characters", new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, strRepeat("0123456789", 25)+"abcde")},
{ "env-"+uid, null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-"+uid)},
{ "env "+uid, "Provider with space in name", new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env "+uid)},
{ " ", null, new Integer(166), KatelloEnvironment.ERROR_BLANK_NAME},
{ " a", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a ", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "a")},
{ "\\!@%^&*(<_-~+=//\\||,.>)", "Environment name with special characters", new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "\\!@%^&*(<_-~+=//\\||,.>)")},
// description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", new Integer(0), "Successfully created environment [ desc-specChars"+uid+" ]"},
{ "desc-255Chars"+uid, strRepeat("0123456789", 25)+"abcde", new Integer(0), "Successfully created environment [ desc-255Chars"+uid+" ]"},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", new Integer(0), "Successfully created environment [ desc-256Chars"+uid+" ]"},
// misc
{ "duplicate"+uid, null, new Integer(0), "Successfully created environment [ duplicate"+uid+" ]"},
};
}
/**
* Object[] contains of:<BR>
* activation key:<BR>
* name<br>
* description<br>
* exit_code<br>
* output
*/
@DataProvider(name="activationkey_create")
public static Object[][] activationkey_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ "aa", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "aa")},
{ "11", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "11")},
{ "1a", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "1a")},
{ "a1", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "a1")},
{ strRepeat("0123456789", 25)+"abcde", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, strRepeat("0123456789", 25)+"abcde")},
{ "ak-"+uid, null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "ak-"+uid)},
{ "ak "+uid, "Provider with space in name", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "ak "+uid)},
{ " ", null, new Integer(166), KatelloActivationKey.ERROR_BLANK_NAME},
{ " a", null, new Integer(166), KatelloActivationKey.ERROR_NAME_WHITESPACE},
{ "a ", null, new Integer(166), KatelloActivationKey.ERROR_NAME_WHITESPACE},
{ "a", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "a")},
{ "(\\!@%^&*(<_-~+=//\\||,.>)", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "(\\!@%^&*(<_-~+=//\\||,.>)" )},
{ strRepeat("0123456789", 25)+"abcdef", null, new Integer(166), KatelloActivationKey.ERROR_LONG_NAME},
// // description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "desc-specChars"+uid)},
{ "desc-255Chars"+uid, strRepeat("0123456789", 25)+"abcde", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "desc-255Chars"+uid)},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "desc-256Chars"+uid)},
// misc
{ "duplicate"+uid, null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "duplicate"+uid)},
{ "duplicate"+uid, null, new Integer(166), KatelloActivationKey.ERROR_DUPLICATE_NAME}
};
}
@DataProvider(name="add_custom_info")
public static Object[][] add_custom_info(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
{ "env-aa", "env-aa", new Integer(0),null},
{ strRepeat("0123456789", 12)+"abcdefgh",strRepeat("0123456789", 12)+"abcdefgh", new Integer(0),null},
{ " ", "value", new Integer(166),KatelloSystem.ERR_BLANK_KEYNAME},
{ "desc-specChars"+uid, "\\!@%^&*(_-~+=\\||,.)", new Integer(0),null},
{"desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef",new Integer(166), "Validation failed: Value is too long (maximum is 255 characters)"},
{strRepeat("0123456789", 25)+"abcdef", "desc-256Chars", new Integer(166), "Validation failed: Keyname is too long (maximum is 255 characters)"},
{ "special chars <h1>html</h1>", "html in keyname", new Integer(0), null},
{ "html in value", "special chars <h1>html</h1>", new Integer(0), null},
{"key-blank-val", "", new Integer(2), "Option --value is required"},
{strRepeat("0123456789", 25)+"abcdef", "desc-256Chars", new Integer(166), KatelloSystem.ERR_KEY_TOO_LONG},
{strRepeat("0123456789", 25)+"abcde", "desc-255Chars", new Integer(0), null},
{"desc-255Chars", strRepeat("0123456789", 25)+"abcde", new Integer(0), null},
{"desc-256Chars", strRepeat("0123456789", 25)+"abcdef", new Integer(166), KatelloSystem.ERR_VALUE_TOO_LONG},
{"special:@!#$%^&*()","value_foo@!#$%^&*()", new Integer(0),null},
};
}
/**
* 1. keyname<br>
* 2. keyvalue<br>
* 3. distributor name<br>
* 4. return code<br>
* 5. output/error string
* @return
*/
@DataProvider(name="add_distributor_custom_info")
public static Object[][] add_distributor_custom_info()
{
String uid = KatelloUtils.getUniqueID();
String dis_name = "distAddCustomInfo-"+uid;
return new Object[][]{
{"testkey-"+uid,"testvalue-"+uid,dis_name,new Integer(0), String.format(KatelloDistributor.OUT_INFO,"testkey-"+uid,"testvalue-"+uid,dis_name)},
{"","blank-key"+uid,dis_name,new Integer(2), "Option --keyname is required; please see --help"},
{"blank-value"+uid,"",dis_name,new Integer(2), "Option --value is required; please see --help"},
{strRepeat("0123456789",25)+"abcde","255charKey",dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,strRepeat("0123456789",25)+"abcde","255charKey",dis_name)},
{strRepeat("0123456789",25)+"abcdef","256charKey",dis_name,new Integer(166),KatelloDistributor.ERR_KEY_TOO_LONG},
{"255charValue"+uid, strRepeat("0123456789",25)+"abcde", dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,"255charValue"+uid, strRepeat("0123456789",25)+"abcde", dis_name)},
{"256charValue"+uid, strRepeat("0123456789",25)+"abcdef", dis_name,new Integer(166), KatelloDistributor.ERR_VALUE_TOO_LONG},
{"testkey-"+uid,"duplicate-key"+uid,dis_name,new Integer(166), KatelloDistributor.ERR_DUPLICATE_KEY},
{"duplicate-value"+uid,"testvalue-"+uid,dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,"duplicate-value"+uid,"testvalue-"+uid,dis_name)},
{"\\!@%^&*(_-~+=\\||,.)"+uid,"\\!@%^&*(_-~+=\\||,.)"+uid,dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,"\\!@%^&*(_-~+=\\||,.)"+uid,"\\!@%^&*(_-~+=\\||,.)"+uid,dis_name)},
{"special chars <h1>html</h1>", "html in keyname", dis_name, new Integer(0), String.format(KatelloDistributor.OUT_INFO,"special chars <h1>html</h1>","html in keyname",dis_name)},
{"html in value", "special chars <h1>html</h1>", dis_name, new Integer(0), String.format(KatelloDistributor.OUT_INFO,"html in value","special chars <h1>html</h1>",dis_name)},
};
}
@DataProvider(name="org_add_custom_info")
public static Object[][] org_add_custom_info() {
return new Object[][] {
{"custom-key", new Integer(0), null},
{ " ", new Integer(166), KatelloOrg.ERR_BLANK_KEY},
{ strRepeat("0123456789", 25)+"abcde", new Integer(0), null},
{ strRepeat("0123456789", 25)+"abcdef", new Integer(166), KatelloOrg.ERR_KEY_TOO_LONG},
{ "custom-key", new Integer(144), KatelloOrg.ERR_DUPLICATE_KEY},
{ "special chars \\!@%^&*(_-~+=\\||,.)", new Integer(0), null},
{ "special chars <h1>html</h1>", new Integer(0), null},
};
}
@DataProvider(name="create_distributor")
public static Object[][] create_distributor()
{
String uid = KatelloUtils.getUniqueID();
return new Object[][]{
{"test_distributor"+uid,new Integer(0), String.format(KatelloDistributor.OUT_CREATE,"test_distributor"+uid)},
{"",new Integer(2), "error: Option --name is required; please see --help"},
{strRepeat("0123456789",12)+uid,new Integer(0),String.format(KatelloDistributor.OUT_CREATE,strRepeat("0123456789",12)+uid)},
{strRepeat("0123456789",30)+uid,new Integer(166),"Validation failed: Name is too long (maximum is 250 characters)"},
{"\\!@%^&*(<_-~+=//\\||,.>)"+uid,new Integer(144),""},
{"test_distributor"+uid,new Integer(166),"Validation failed: Name already taken"},
};
}
@DataProvider(name = "user_create")
public static Object[][] user_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
//name, email, password, disabled
{"newUserName"+uid, "[email protected]", "newUserName", false },
{"նոր օգտվող"+uid, "[email protected]", "նոր օգտվող", false},
{"新用戶"+uid, "[email protected]", "新用戶", false},
{"नए उपयोगकर्ता"+uid, "[email protected]", "नए उपयोगकर्ता", false},
{"нового пользователя"+uid, "[email protected]", "нового пользователя", false},
{"uusi käyttäjä"+uid, "[email protected]", "uusi käyttäjä", false},
{"νέος χρήστης"+uid, "[email protected]", "νέος χρήστης", false},
};
}
@DataProvider(name="changeset_create")
public static Object[][] changeset_create() {
return new Object[][] {
//{String name, String description, Integer exit_code, String output},
{"changeset ok", "", new Integer(0), null},
{"!@#$%^&*()_+{}|:?[];.,", "special characters", new Integer(0), null},
{strRepeat("0123456789", 25)+"abcdef", "too long name", new Integer(166), "Validation failed: Name cannot contain more than 255 characters"},
{"too long description", strRepeat("0123456789", 25)+"abcdef", new Integer(0), null},
{"<h1>changeset</h1>", "html in name", new Integer(0), null},
{"html in description", "<h1>changeset description</h1>", new Integer(0), null},
};
}
@DataProvider(name="multiple_agents")
public static Object[][] multiple_agents() {
List<Object[]> images = new ArrayList<Object[]>();
StringTokenizer tok = new StringTokenizer(
System.getProperty("deltacloud.client.imageid"), ",");
while (tok.hasMoreTokens()) {
images.add(new Object[] {tok.nextToken().trim()});
}
return images.toArray(new Object[images.size()][]);
}
@DataProvider(name="subnet_create")
public static Object[][] subnet_create() {
String uid = KatelloUtils.getUniqueID().substring(7);
return new Object[][] {
//{String name, String network, String mask, String gateway, String dns_primary, String dns_secondary,
// String from, String to, String domain, String vlan, Integer exit_code, String output},
{"wrongsubn"+uid, "277.777.777.888", "255.255.255.0", "251.10.10.255", "251.10.11.255", "251.10.12.255", "251.10.10.10", "251.10.10.12",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255", "251.10.10.255", "251.10.11.255", "251.10.12.255", "251.10.10.10", "251.10.10.12",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "wrong", "251.10.11.255", "251.10.12.255", "251.10.10.10", "251.10.10.12",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "251.10.10.255", "251", "251.10.12.255", "251.10.10.10", "251.10.10.12",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "251.10.10.255", "251.10.11.255", "wrong", "251.10.10.10", "251.10.10.12",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "251.10.10.255", "251.10.11.255", "251.10.12.255", "333", "251.10.10.12",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "251.10.10.255", "251.10.11.255", "251.10.12.255", "251.10.10.10", "#wrong",
"1", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "251.10.10.255", "251.10.11.255", "251.10.12.255", "251.10.10.10", "251.10.10.12",
")wrong", "2"},
{"wrongsubn"+uid, "251.10.10.11", "255.255.255.0", "251.10.10.255", "251.10.11.255", "251.10.12.255", "251.10.10.10", "251.10.10.12",
"1", "[wrong1"},
};
}
}
|
hhovsepy/katello-api
|
src/com/redhat/qe/katello/base/KatelloCliDataProvider.java
|
2,230 |
package Apartments_details_Rns;
import java.util.ArrayList;
import java.util.List;
import java.sql.*;
public class ApartmentDAO {
/**
* This method returns a List with all Users
*
* @return List<User>
*/
public List<Apartment> getApartments() throws Exception {
List<Apartment> apartments = new ArrayList<Apartment>();
DB db = new DB();
Connection con = null;
String query = "SELECT * FROM apartment;";
try {
con = db.getConnection();
PreparedStatement stmt = con.prepareStatement(query);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
apartments.add( new Apartment(rs.getInt("apartment_id"), rs.getString("name"), rs.getString("available_from"), rs.getString("available_until"), rs.getString("city"), rs.getString("address"),
rs.getFloat("price"), rs.getInt("capacity"), rs.getString("features"), rs.getBoolean("up_rent"), rs.getBoolean("up_swap"),rs.getInt("user_id")));
}
rs.close();
stmt.close();
db.close();
return apartments;
} catch (Exception e) {
throw new Exception(e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
}
}
}
/**
* This method is used to authenticate a user.
*
* @param username, String
* @param password, String
* @return User, the User object
* @throws Exception, if the credentials are not valid
*/
public List<Apartment> authenticate( String city,int cap) throws Exception { //when it works it need dates and capacity
List<Apartment> aparts = getApartments();
List<Apartment> available_apartments = new ArrayList<Apartment>();
for (Apartment apart: aparts) {
//lista kanonika gia na ta krataei ola
if (apart.getCity().equals(city) && apart.getCapacity()==cap ) {
available_apartments.add(apart);
}
}
return available_apartments;
}
}
|
FayKounara/R-S
|
3ο παραδοτέο/Νέος φάκελος/ApartmentDAO.java
|
2,232 |
package Apartments_details_Rns;
import java.sql.*;
public class ApartmentUpload {
public void showApartment(Apartment apart) throws Exception {
DB db = new DB();
Connection con = null;
String query = "INSERT INTO apartment (name,available_from,available_until,city,address,price,capacity,features,up_rent,up_swap,user_id) VALUES (?,?,?,?,?,?,?,?,?,?,?);";
try {
con = db.getConnection();
PreparedStatement stmt = con.prepareStatement(query);
stmt.setString(1,apart.getName());
stmt.setString(2,apart.getAvailableFrom());
stmt.setString(3,apart.getAvailableUntil());
stmt.setString(4,apart.getCity());
stmt.setString(5,apart.getAddress());
stmt.setFloat(6,apart.getPrice());
stmt.setInt(7,apart.getCapacity());
stmt.setString(8,apart.getFeatures());
stmt.setInt(9,apart.getUpRent());
stmt.setInt(10,apart.getUpSwap());
stmt.setInt(11,apart.getUserId());
stmt.executeUpdate(); //execute (SQL Statement) sql2
stmt.close();
} catch (Exception e) {
throw new Exception("Error: " + e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
e.getMessage();
}
}
}
public void showImage(Apartment apart) throws Exception {
DB db = new DB();
Connection con = null;
String query = "INSERT INTO images (image_url,part,apartment_id) VALUES (?,?,?);";
try {
con = db.getConnection();
PreparedStatement stmt = con.prepareStatement(query);
stmt.setString(1,apart.getImageURL());
stmt.setInt(2,apart.getPart());
stmt.setInt(3,apart.getApartmentId());
stmt.executeUpdate();
stmt.close();
} catch (Exception e) {
throw new Exception("Error: " + e.getMessage());
} finally {
try {
db.close();
} catch (Exception e) {
e.getMessage();
}
}
}
}
|
FayKounara/R-S
|
3ο παραδοτέο/Νέος φάκελος/ApartmentUpload.java
|
2,233 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.net.URL;
public class Example2 {
public static void main(String[] args) throws Exception {
new MP3Player(new URL("http://server.com/mp3s/test.mp3")).play();
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example2.java
|
2,234 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.io.File;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
public class Example7 {
public static void main(String[] args) throws Exception {
// MP3Player.setDefaultUI(MP3PlayerUICompact.class);
//
MP3Player player = new MP3Player();
player.setRepeat(true);
player.addToPlayList(new File("test.mp3"));
player.addToPlayList(new File("test2.mp3"));
player.addToPlayList(new File("test3.mp3"));
player.addToPlayList(new URL("http://server.com/mp3s/test4.mp3"));
//
player.setBorder(BorderFactory.createEmptyBorder(50, 100, 50, 100));
JFrame frame = new JFrame("MP3 Player");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(player);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example7.java
|
2,235 |
package graphix;
import javax.swing.UIManager;
/**
* ΕΑΠ - ΠΛΗ31 - 4η ΕΡΓΑΣΙΑ 2015-2016
* @author Tsakiridis Sotiris
*/
public class Graphix {
public static void main(String[] args) {
// Set Nimbus Look & Feel
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
// Τροποποίηση της γλώσσας στα πλήκτρα του διαλόγου JOptionPane
UIManager.put("OptionPane.yesButtonText", "Ναι");
UIManager.put("OptionPane.noButtonText", "Όχι");
// Μετάφραση στα ελληνικά του JFileChooser
UIManager.put("FileChooser.openButtonText","Άνοιγμα");
UIManager.put("FileChooser.cancelButtonText","Ακύρωση");
UIManager.put("FileChooser.saveButtonText","Αποθήκευση");
UIManager.put("FileChooser.cancelButtonToolTipText", "Ακύρωση");
UIManager.put("FileChooser.saveButtonToolTipText", "Αποθήκευση");
UIManager.put("FileChooser.openButtonToolTipText", "Άνοιγμα");
UIManager.put("FileChooser.lookInLabelText", "Αναζήτηση σε :");
UIManager.put("FileChooser.fileNameLabelText", "Όνομα αρχείου:");
UIManager.put("FileChooser.filesOfTypeLabelText", "Τύπος αρχείου:");
UIManager.put("FileChooser.upFolderToolTipText", "Επάνω");
UIManager.put("FileChooser.homeFolderToolTipText", "Αρχικός Φάκελος");
UIManager.put("FileChooser.newFolderToolTipText", "Νέος Φάκελος");
UIManager.put("FileChooser.listViewButtonToolTipText","Προβολή λίστας");
UIManager.put("FileChooser.detailsViewButtonToolTipText", "Προβολή λεπτομερειών");
MainFrame mft = new MainFrame();
mft.setVisible(true);
} // end main()
}
|
artibet/graphix
|
src/graphix/Graphix.java
|
2,236 |
package gr.cti.eslate.mapModel;
import java.util.ListResourceBundle;
public class BundleMenu_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
//File
{"file", "Αρχείο"},
{"new", "Νέος..."},
{"open", "Άνοιγμα..."},
{"edit", "Επεξεργασία..."},
{"save", "Αποθήκευση"},
{"saveas", "Αποθήκευση ως..."},
{"savetitle", "Αποθήκευση χάρτη"},
{"opentitle", "Ανάγνωση χάρτη"},
{"close", "Κλείσιμο"},
{"ConstructorTimer", "Κατασκευή Χάρτη"},
{"InitESlateAspectTimer", "Κατασκευή αβακιακής πλευράς Χάρτη"},
{"LoadTimer", "Ανάκτηση επεξεργαστή χαρτών"},
{"SaveTimer", "Αποθήκευση επεξεργαστή χαρτών"},
{"PerformOpenTimer", "Χρόνος performOpen()"},
{"OpenSubTreeTimer", "Χρόνος openSubTree()"},
{"SetMapRootTimer", "Χρόνος setMapRoot()"},
{"ReadUnusedLayersTimer", "Χρόνος ανοίγματος \"unused\" επιπέδων"},
{"RefreshTimer", "Χρόνος refresh()"},
{"OpenRegionTimer", "Χρόνος openRegion() (χωρίς openLayer())"},
{"RegionReadFieldMapTimer", "Χρόνος ανάγνωσης region FieldMap"},
{"RegionRestoreAttribsTimer", "Χρόνος restoreRegionAttributes()"},
{"RegionChangeDirTimer", "Χρόνος περιήγησης struct file(Region)"},
{"RegionBgrReadTimer", "Χρόνος ανάγνωσης backgrounds"},
{"OpenLayerTimer", "Χρόνος openLayer()"},
{"LayerChangeDirTimer", "Χρονος περιήγησης struct file(Layer)"},
{"LayerReadFieldMapTimer", "Χρόνος ανάγνωσης layer FieldMap"},
{"LayerRestoreAttribsTimer", "Χρόνος restoreLayerAttributes()"},
{"MapReadStreamTimer", "Χρόνος Map readStream()"},
{"MapReadFieldMapTimer", "Χρόνος ανάγνωσης Map FieldMap"},
{"CheckNLoadTimer", "Χρόνος checkNLoad()"},
{"CheckNLoadChangeDirTimer", "Χρόνος περιήγησης struct file(checkNLoad())"},
{"CheckNLoadReadObjectTimer", "Χρόνος CheckNLoad readObject()"},
{"CheckNLoadLoadObjectsTimer","Χρόνος CheckNLoad loadObjects()"},
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/MapModel/BundleMenu_el_GR.java
|
2,238 |
package gr.cti.eslate.scripting.logo;
import java.util.ListResourceBundle;
public class DBasePrimitivesBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"New Table", "Νέος πίνακας"},
{"DBASE.SETACTIVETABLE", "ΒΑΣΗ.ΘΕΣΕΕΝΕΡΓΟΠΙΝΑΚΑ"},
{"DBASE.ACTIVETABLE", "ΒΑΣΗ.ΕΝΕΡΓΟΣΠΙΝΑΚΑΣ"},
{"DBASE.TABLEINDEX", "ΒΑΣΗ.ΘΕΣΗΠΙΝΑΚΑ"},
{"DBASE.TABLECOUNT", "ΒΑΣΗ.ΑΡΙΘΜΟΣΠΙΝΑΚΩΝ"},
{"DBASE.NEWTABLE", "ΒΑΣΗ.ΝΕΟΣΠΙΝΑΚΑΣ"},
{"DBASE.REMOVETABLE", "ΒΑΣΗ.ΑΦΑΙΡΕΣΕΠΙΝΑΚΑ"},
{"DBASE.TABLENAMES", "ΒΑΣΗ.ΟΝΟΜΑΤΑΠΙΝΑΚΩΝ"},
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/scripting/logo/DBasePrimitivesBundle_el_GR.java
|
2,240 |
package mp3Project;
import jaco.mp3.player.MP3Player;
import java.io.File;
import java.nio.file.Paths;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class PlayerFrame extends javax.swing.JFrame {
// Dilwsh global metablitwn
MP3Player player;
File songFile;
String currentDirectory = "home.user"; // I am using home.user this will call file chooser in user documents.
String currentPath;
String imagePath;
String appName = "MP3 Player";
boolean repeat = false;
boolean windowCollapsed = false;
int xMouse, yMouse;
public PlayerFrame() {
initComponents();
Title.setText(appName);
songFile = new File("..\\mp3Project\\Jack Savoretti - Soldiers Eyes.mp3");
String fileName = songFile.getName();
SongNameLabel.setText(fileName);
player = mp3Player();
// Now add song to player as playlist.
player.addToPlayList(songFile);
currentPath = Paths.get(".").toAbsolutePath().normalize().toString();
imagePath = "\\images";
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
songNameMainPanel = new javax.swing.JPanel();
mainPanel = new javax.swing.JPanel();
headerPanel = new javax.swing.JPanel();
Title = new javax.swing.JLabel();
XButton = new javax.swing.JLabel();
settingsBtn = new javax.swing.JLabel();
controlPanel = new javax.swing.JPanel();
songNameSubPanel = new javax.swing.JPanel();
SongNameLabel = new javax.swing.JLabel();
LoopButton = new javax.swing.JLabel();
PauseButton = new javax.swing.JLabel();
PlayButton = new javax.swing.JLabel();
StopButton = new javax.swing.JLabel();
OpenFolderButton = new javax.swing.JLabel();
Diaxoristiko = new javax.swing.JPanel();
volumeFullBtn = new javax.swing.JLabel();
volumeUpBtn = new javax.swing.JLabel();
muteBtn = new javax.swing.JLabel();
volumeDownBtn = new javax.swing.JLabel();
takis = new javax.swing.JLabel();
songNameMainPanel.setBackground(new java.awt.Color(7, 63, 86));
javax.swing.GroupLayout songNameMainPanelLayout = new javax.swing.GroupLayout(songNameMainPanel);
songNameMainPanel.setLayout(songNameMainPanelLayout);
songNameMainPanelLayout.setHorizontalGroup(
songNameMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
songNameMainPanelLayout.setVerticalGroup(
songNameMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 89, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
mainPanel.setBackground(new java.awt.Color(131, 88, 46));
headerPanel.setBackground(new java.awt.Color(105, 53, 0));
Title.setFont(new java.awt.Font("Nirmala UI", 0, 18)); // NOI18N
Title.setForeground(new java.awt.Color(212, 175, 55));
Title.setText("Mp3 Player");
Title.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
TitleMouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
TitleMousePressed(evt);
}
});
Title.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
TitleMouseDragged(evt);
}
});
XButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
XButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/exitfinall.png"))); // NOI18N
XButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
XButtonMouseClicked(evt);
}
});
settingsBtn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
settingsBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/settingsfinal.png"))); // NOI18N
settingsBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
settingsBtnMouseClicked(evt);
}
});
javax.swing.GroupLayout headerPanelLayout = new javax.swing.GroupLayout(headerPanel);
headerPanel.setLayout(headerPanelLayout);
headerPanelLayout.setHorizontalGroup(
headerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(headerPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(Title, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(28, 28, 28)
.addComponent(settingsBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(XButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
);
headerPanelLayout.setVerticalGroup(
headerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(headerPanelLayout.createSequentialGroup()
.addGroup(headerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(Title, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(XButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(settingsBtn, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
controlPanel.setBackground(new java.awt.Color(7, 63, 86));
javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel);
controlPanel.setLayout(controlPanelLayout);
controlPanelLayout.setHorizontalGroup(
controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
controlPanelLayout.setVerticalGroup(
controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
songNameSubPanel.setBackground(new java.awt.Color(131, 88, 46));
songNameSubPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(212, 175, 55), 1, true));
SongNameLabel.setFont(new java.awt.Font("Nirmala UI", 0, 12)); // NOI18N
SongNameLabel.setForeground(new java.awt.Color(212, 175, 55));
SongNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
SongNameLabel.setText("PLAYING");
javax.swing.GroupLayout songNameSubPanelLayout = new javax.swing.GroupLayout(songNameSubPanel);
songNameSubPanel.setLayout(songNameSubPanelLayout);
songNameSubPanelLayout.setHorizontalGroup(
songNameSubPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(songNameSubPanelLayout.createSequentialGroup()
.addGap(195, 195, 195)
.addComponent(SongNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(230, 230, 230))
);
songNameSubPanelLayout.setVerticalGroup(
songNameSubPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(SongNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
);
LoopButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
LoopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/loopfinal.png"))); // NOI18N
LoopButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
LoopButtonMouseClicked(evt);
}
});
PauseButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
PauseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/pausefinal.png"))); // NOI18N
PauseButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
PauseButtonMouseClicked(evt);
}
});
PlayButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
PlayButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/playfinal.png"))); // NOI18N
PlayButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
PlayButtonMouseClicked(evt);
}
});
StopButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
StopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/stopfinal.png"))); // NOI18N
StopButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
StopButtonMouseClicked(evt);
}
});
OpenFolderButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
OpenFolderButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/openfilefinal.png"))); // NOI18N
OpenFolderButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
OpenFolderButtonMouseClicked(evt);
}
});
Diaxoristiko.setBackground(new java.awt.Color(131, 88, 46));
Diaxoristiko.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(212, 175, 55)));
volumeFullBtn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
volumeFullBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/volumemaxfinal.png"))); // NOI18N
volumeFullBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
volumeFullBtnMouseClicked(evt);
}
});
volumeUpBtn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
volumeUpBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/volumeupfinal.png"))); // NOI18N
volumeUpBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
volumeUpBtnMouseClicked(evt);
}
});
muteBtn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
muteBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/mutefinal.png"))); // NOI18N
muteBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
muteBtnMouseClicked(evt);
}
});
volumeDownBtn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
volumeDownBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mp3Project/images/volumedownfinal.png"))); // NOI18N
volumeDownBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
volumeDownBtnMouseClicked(evt);
}
});
javax.swing.GroupLayout DiaxoristikoLayout = new javax.swing.GroupLayout(Diaxoristiko);
Diaxoristiko.setLayout(DiaxoristikoLayout);
DiaxoristikoLayout.setHorizontalGroup(
DiaxoristikoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(DiaxoristikoLayout.createSequentialGroup()
.addGroup(DiaxoristikoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(volumeUpBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(volumeDownBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(DiaxoristikoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(volumeFullBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(muteBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
DiaxoristikoLayout.setVerticalGroup(
DiaxoristikoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(DiaxoristikoLayout.createSequentialGroup()
.addGap(2, 2, 2)
.addGroup(DiaxoristikoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(volumeFullBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(volumeUpBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(DiaxoristikoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(volumeDownBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE)
.addComponent(muteBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
takis.setForeground(new java.awt.Color(212, 175, 55));
takis.setText("loop conditioned");
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(controlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(headerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(songNameSubPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(takis)
.addGroup(mainPanelLayout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(LoopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(40, 40, 40)
.addComponent(PauseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(PlayButton, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(StopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(OpenFolderButton, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Diaxoristiko, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(headerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(songNameSubPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Diaxoristiko, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addComponent(LoopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(takis)
.addGap(9, 9, 9))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(OpenFolderButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(StopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(PlayButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(PauseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
.addComponent(controlPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void PlayButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PlayButtonMouseClicked
player.play();
}//GEN-LAST:event_PlayButtonMouseClicked
private void StopButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_StopButtonMouseClicked
player.stop();
}//GEN-LAST:event_StopButtonMouseClicked
private void PauseButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PauseButtonMouseClicked
player.pause();
}//GEN-LAST:event_PauseButtonMouseClicked
private void LoopButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LoopButtonMouseClicked
// elegxoume an briskete se loop , an nai to bgazoyme apo loop an oxi to bazoyme kai enimeronoyme to label
if (repeat == false) {
repeat = true;
player.setRepeat(repeat);
takis.setText("looped");
} else if (repeat == true) {
repeat = false;
player.setRepeat(repeat);
takis.setText("stop looped");
}
}//GEN-LAST:event_LoopButtonMouseClicked
private void TitleMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TitleMousePressed
//pairnoume tis sintetagmenes to pontikiou otan patisoume epanw ston titlo
xMouse = evt.getX();
yMouse = evt.getY();
}//GEN-LAST:event_TitleMousePressed
private void TitleMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TitleMouseDragged
// topo8etoume olo to app sto shmeio pou oi kainourgies sintetagmenes mas briskontai
int x = evt.getXOnScreen();
int y = evt.getYOnScreen();
this.setLocation(x - xMouse, y - yMouse);
}//GEN-LAST:event_TitleMouseDragged
private void XButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_XButtonMouseClicked
this.dispose();
}//GEN-LAST:event_XButtonMouseClicked
private void settingsBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_settingsBtnMouseClicked
// dimiourgoume to pop up para8iro twn settings
JOptionPane.showMessageDialog(this, "Your settings dilog will be popup here!");
}//GEN-LAST:event_settingsBtnMouseClicked
private void OpenFolderButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_OpenFolderButtonMouseClicked
// Energopoioume to ftiaxnoyme to pop up window tou research stous folder mas
JFileChooser openFileChooser = new JFileChooser(currentDirectory);
openFileChooser.setFileFilter(new FileTypeFilter(".mp3", "Open MP3 Files Only!"));
int result = openFileChooser.showOpenDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
songFile = openFileChooser.getSelectedFile();
player.addToPlayList(songFile);
player.skipForward();
currentDirectory = songFile.getAbsolutePath();
SongNameLabel.setText("Playing Now... | " + songFile.getName());
}
}//GEN-LAST:event_OpenFolderButtonMouseClicked
private void TitleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TitleMouseClicked
if (evt.getClickCount() == 2) {
if (windowCollapsed == false) {
windowCollapsed = true;
} else if (windowCollapsed == true) {
windowCollapsed = false;
}
}
}//GEN-LAST:event_TitleMouseClicked
private void volumeDownBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volumeDownBtnMouseClicked
//Meinoume thn fwnh kata 10%
volumeDownControl(0.1);
}//GEN-LAST:event_volumeDownBtnMouseClicked
private void volumeUpBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volumeUpBtnMouseClicked
//afksanoume thn fwnh kata 10%
volumeUpControl(0.1);
}//GEN-LAST:event_volumeUpBtnMouseClicked
private void volumeFullBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volumeFullBtnMouseClicked
// topo8etoume aftomata thn fwnh sto 100%
volumeControl(1.0);
}//GEN-LAST:event_volumeFullBtnMouseClicked
private void muteBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_muteBtnMouseClicked
// topo8etoume aftomata thn fwnh sto 0%
volumeControl(0.0);
}//GEN-LAST:event_muteBtnMouseClicked
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PlayerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PlayerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PlayerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PlayerFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PlayerFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel Diaxoristiko;
private javax.swing.JLabel LoopButton;
private javax.swing.JLabel OpenFolderButton;
private javax.swing.JLabel PauseButton;
private javax.swing.JLabel PlayButton;
private javax.swing.JLabel SongNameLabel;
private javax.swing.JLabel StopButton;
private javax.swing.JLabel Title;
private javax.swing.JLabel XButton;
private javax.swing.JPanel controlPanel;
private javax.swing.JPanel headerPanel;
private javax.swing.JPanel mainPanel;
private javax.swing.JLabel muteBtn;
private javax.swing.JLabel settingsBtn;
private javax.swing.JPanel songNameMainPanel;
private javax.swing.JPanel songNameSubPanel;
private javax.swing.JLabel takis;
private javax.swing.JLabel volumeDownBtn;
private javax.swing.JLabel volumeFullBtn;
private javax.swing.JLabel volumeUpBtn;
// End of variables declaration//GEN-END:variables
// Dimiourgoume mia custom mp3 methodo
private MP3Player mp3Player() {
MP3Player mp3Player = new MP3Player();
return mp3Player;
}
// dimiourgoume tis methodous gia auksomeiwsh tou hxou
private void volumeDownControl(Double valueToPlusMinus) {
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (Mixer.Info mixerInfo : mixers) {
Mixer mixer = AudioSystem.getMixer(mixerInfo);
Line.Info[] lineInfos = mixer.getTargetLineInfo();
for (Line.Info lineInfo : lineInfos) {
Line line = null;
boolean opened = true;
try {
line = mixer.getLine(lineInfo);
opened = line.isOpen() || line instanceof Clip;
if (!opened) {
line.open();
}
FloatControl volControl = (FloatControl) line.getControl(FloatControl.Type.VOLUME);
float currentVolume = volControl.getValue();
Double volumeToCut = valueToPlusMinus;
float changedCalc = (float) ((float) currentVolume - (double) volumeToCut);
volControl.setValue(changedCalc);
} catch (LineUnavailableException lineException) {
} catch (IllegalArgumentException illException) {
} finally {
if (line != null && !opened) {
line.close();
}
}
}
}
}
private void volumeUpControl(Double valueToPlusMinus) {
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (Mixer.Info mixerInfo : mixers) {
Mixer mixer = AudioSystem.getMixer(mixerInfo);
Line.Info[] lineInfos = mixer.getTargetLineInfo();
for (Line.Info lineInfo : lineInfos) {
Line line = null;
boolean opened = true;
try {
line = mixer.getLine(lineInfo);
opened = line.isOpen() || line instanceof Clip;
if (!opened) {
line.open();
}
FloatControl volControl = (FloatControl) line.getControl(FloatControl.Type.VOLUME);
float currentVolume = volControl.getValue();
Double volumeToCut = valueToPlusMinus;
float changedCalc = (float) ((float) currentVolume + (double) volumeToCut);
volControl.setValue(changedCalc);
} catch (LineUnavailableException lineException) {
} catch (IllegalArgumentException illException) {
} finally {
if (line != null && !opened) {
line.close();
}
}
}
}
}
private void volumeControl(Double valueToPlusMinus) {
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (Mixer.Info mixerInfo : mixers) {
Mixer mixer = AudioSystem.getMixer(mixerInfo);
Line.Info[] lineInfos = mixer.getTargetLineInfo();
for (Line.Info lineInfo : lineInfos) {
Line line = null;
boolean opened = true;
try {
line = mixer.getLine(lineInfo);
opened = line.isOpen() || line instanceof Clip;
if (!opened) {
line.open();
}
FloatControl volControl = (FloatControl) line.getControl(FloatControl.Type.VOLUME);
float currentVolume = volControl.getValue();
Double volumeToCut = valueToPlusMinus;
float changedCalc = (float) ((double) volumeToCut);
volControl.setValue(changedCalc);
} catch (LineUnavailableException lineException) {
} catch (IllegalArgumentException illException) {
} finally {
if (line != null && !opened) {
line.close();
}
}
}
}
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/src/mp3Project/PlayerFrame.java
|
2,242 |
package mp3Project;
import java.io.File;
import javax.swing.filechooser.FileFilter;
public class FileTypeFilter extends FileFilter {
private final String extension;
private final String description;
public FileTypeFilter(String extension, String description) {
this.extension = extension;
this.description = description;
}
@Override
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
}
return file.getName().endsWith(extension);
}
@Override
public String getDescription() {
return description + String.format(" (*%s)", extension);
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/src/mp3Project/FileTypeFilter.java
|
2,243 |
package gr.cti.eslate.scripting.logo;
import java.util.ListResourceBundle;
public class DBasePrimitivesBundle_en_US extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"New Table", "Νέος πίνακας"},
{"DBASE.SETACTIVETABLE", "ΒΑΣΗ.�?ΕΣΕΕ�?ΕΡΓ�?ΠΙ�?Α�?Α"},
{"DBASE.ACTIVETABLE", "ΒΑΣΗ.Ε�?ΕΡΓ�?ΣΠΙ�?Α�?ΑΣ"},
{"DBASE.TABLEINDEX", "ΒΑΣΗ.�?ΕΣΗΠΙ�?Α�?Α"},
{"DBASE.TABLECOUNT", "ΒΑΣΗ.ΑΡΙ�?�?�?ΣΠΙ�?Α�?Ω�?"},
{"DBASE.NEWTABLE", "ΒΑΣΗ.�?Ε�?ΣΠΙ�?Α�?ΑΣ"},
{"DBASE.REMOVETABLE", "ΒΑΣΗ.ΑΦΑΙΡΕΣΕΠΙ�?Α�?Α"},
{"DBASE.TABLENAMES", "ΒΑΣΗ.�?�?�?�?ΑΤΑΠΙ�?Α�?Ω�?"},
};
}
|
vpapakir/myeslate
|
eslate/wigdetESlatenew/src/gr/cti/eslate/scripting/logo/DBasePrimitivesBundle_en_US.java
|
2,245 |
package l10n;
import java.util.ListResourceBundle;
public class GUI_el_GR extends ListResourceBundle {
@Override
protected Object[][] getContents() {
return new Object[][]{
{"leftPanel.home", "Αρχική σελίδα"},
{"leftPanel.view", "Απεικόνιση"},
{"leftPanel.table", "Πίνακας"},
{"leftPanel.commands", "Εντολές"},
{"all.signIn", "Συνδεθείτε"},
{"all.signUp", "Εγγραφείτε"},
{"all.login", "Σύνδεση"},
{"all.password", "κωδικός πρόσβασης"},
{"all.cancel", "Ακύρωση"},
{"signIn.saveMe", "Αποθήκευση σύνδεσης και κωδικού πρόσβασης"},
{"signIn.warning", "Λανθασμένη σύνδεση ή κωδικός πρόσβασης!"},
{"signUp.loginCol", "Αυτή η σύνδεση είναι ήδη κατειλημμένη"},
{"signUp.notMatch", "Οι κωδικοί πρόσβασης δεν ταιριάζουν"},
{"signUp.repPassword", "κωδικός πρόσβασης repepat"},
{"signUp.loginMsg", "Μπορείτε να χρησιμοποιήσετε μόνο τα a-z, A-Z, 0-9 και _ στο login."},
{"home.darkTheme", "Ορισμός σκοτεινού θέματος"},
{"home.lightTheme", "Ρύθμιση θέματος Light"},
{"home.signOut", "Υπογράψτε έξω"},
{"home.changePassword", "Αλλαγή πρόσβασης"},
{"chPass.old", "παλιός κωδικός πρόσβασης"},
{"chPass.new", "νέος κωδικός πρόσβασης"},
{"all.confirm", "Επιβεβαίωση"},
{"chPass.incOld", "Λανθασμένος κωδικός πρόσβασης"},
{"synopsis.title", "Σύνοψη"},
{"synopsis.text", """
Οδηγίες για φιλτράρισμα και ταξινόμηση
πίνακας:
Για να ταξινομήσετε με αύξουσα σειρά
κάντε κλικ μία φορά στον τίτλο
της στήλης που χρειάζεστε.
Σε φθίνουσα σειρά - 2 φορές
Για να φιλτράρετε, πληκτρολογήστε το
πεδίο φιλτραρίσματος μία έκφραση Boolean
σε JavaScript, χρησιμοποιώντας
τελεστές σύγκρισης (==, !=, < κ.λπ.),
λογικούς τελεστές (&&, ||) και
συναρτήσεις (name.length, sum(x,y) κ.λπ.).
Για παράδειγμα: id > 3000 && owner == 'user'.
ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Από την έκδοση 3.2.x η
εφαρμογή δεν υποστηρίζει φιλτράρισμα
με βάση την ημερομηνία."""},
{"dialog.incorrect", "Κάποιο πεδίο είναι λανθασμένο"},
{"dragon.empty", "Η ηλικία μπορεί να είναι κενή:"},
{"dragon.name", "όνομα"},
{"dragon.weight", "βάρος"},
{"dragon.age", "ηλικία"},
{"dragon.eyes_count", "aριθμός ματιών"},
{"table.filter", "φίλτρο"},
{"table.refresh", "Ανανέωση"},
{"table.remove", "Αφαιρέστε το"},
{"view.start", "Πηγαίνετε στην αρχή"},
{"ADD", "Προσθήκη νέου στοιχείου στη συλλογή"},
{"ADD_IF_MIN", "Προσθήκη ενός νέου στοιχείου στη συλλογή εάν η τιμή του είναι μικρότερη από το μικρότερο στοιχείο της συλλογής"},
{"AVERAGE_OF_WEIGHT", "Εμφάνιση της μέσης τιμής του πεδίου βάρους για όλα τα στοιχεία της συλλογής"},
{"CLEAR", "Εκκαθάριση της συλλογής (διαγραφή όλων των δράκων σας)"},
{"FILTER_LESS_THAN_WEIGHT", "Εξαγωγή των στοιχείων των οποίων η τιμή του πεδίου βάρους είναι μικρότερη από τη δεδομένη"},
{"INFO", "Εμφάνιση πληροφοριών σχετικά με τη συλλογή"},
{"MIN_BY_AGE", "Εξαγωγή οποιουδήποτε αντικειμένου από τη συλλογή, η τιμή του πεδίου age του οποίου είναι η ελάχιστη"},
{"REMOVE_BY_ID", "Αφαίρεση ενός αντικειμένου από τη συλλογή με βάση το id του"},
{"REMOVE_GREATER", "Αφαίρεση από τη συλλογή όλων των αντικειμένων που υπερβαίνουν το καθορισμένο"},
{"REMOVE_LOWER", "Αφαίρεση όλων των στοιχείων από τη συλλογή που είναι μικρότερα από το καθορισμένο"},
{"UPDATE", "Ενημέρωση της τιμής του στοιχείου της συλλογής του οποίου το id είναι ίσο με το δεδομένο"},
{"EXECUTE_SCRIPT", "Εκτέλεση δέσμης ενεργειών από οποιοδήποτε αρχείο"}
};
}
}
|
gl4zis/ITMO_Programming_Lab5-8
|
client/src/main/java/l10n/GUI_el_GR.java
|
2,248 |
package gr.cti.eslate.database;
import java.util.ListResourceBundle;
public class InfoBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"compo", "Ψηφίδα Επεξεργαστής Βάσεων Δεδομένων, έκδοση "},
{"compo1", "Επεξεργαστής Βάσεων"},
{"part", "Τμήμα του περιβάλλοντος Αβάκιο (http://E-Slate.cti.gr)"},
//{"concept", "Original concept: M. Koutlis"},
//{"design", "Σχεδιασμός: Γ. Τσιρώνης (contribution: Π. Σιούτη, Μ. Κουτλής)"},
{"development", "Ανάπτυξη: Γ. Τσιρώνης"},
//{"funding", "Χρηματοδότηση: Έργο \"ΟΔΥΣΣΕΑΣ\" (ΥΠΕΠΘ - ΕΠΕΑΕΚ)"},
{"contribution", "Συμβολή: Π. Σιούτη, Χ. Κυνηγός"},
{"Table", "Πίνακας"},
{"DatabaseMenu", "Βάση"},
{"DatabaseMenuNew", "Νέα βάση"},
{"DatabaseMenuOpen", "Άνοιγμα"},
{"DatabaseMenuClose", "Κλείσιμο"},
{"DatabaseMenuRename", "Αλλαγή τίτλου"},
{"DatabaseMenuSave", "Αποθήκευση"},
{"DatabaseMenuSaveAs", "Αποθήκευση ως"},
{"DatabaseMenuImport", "Εισαγωγή πίνακα"},
{"DatabaseMenuExport", "Εξαγωγή πίνακα"},
{"DatabaseUserLevel", "Επίπεδο Χρηστών"},
{"Description", "Περιγραφή..."},
{"DatabaseProperties", "Ιδιότητες"},
{"DatabaseMenuExit", "Έξοδος"},
{"TableMenu", "Πίνακας"},
{"TableMenuNew", "Νέος πίνακας"},
{"TableMenuAuto", "Αυτόματη δημιουργία"},
{"TableMenuLoad", "Προσθήκη"},
{"TableMenuRemove", "Αφαίρεση"},
{"TableMenuSave", "Αποθήκευση"},
{"TableMenuSaveAs", "Αποθήκευση ως"},
{"TableMenuSaveUISettings", "Αποθήκευση ρυθμίσεων εμφάνισης"},
{"TableMenuRename", "Αλλαγή ονόματος"},
{"TableMenuHidden", "Κρυφός"},
{"TableMenuSort", "Ταξινόμηση"},
{"TableMenuFind", "Εύρεση"},
{"TableMenuFindNext", "Εύρεση επομένου"},
{"TableMenuFindPrevious", "Εύρεση προηγούμενου"},
{"TableMenuUnion", "Ένωση"},
{"TableMenuIntersect", "Τομή"},
{"TableMenuJoin", "Σύνδεση"},
{"TableMenuThJoin", "Σύνδεση υπό συνθήκη"},
{"TableMenuAutoResize", "Αυτόματη ρύθμιση πλάτους πεδίων"},
{"TableMenuAutoResizeOff", "Μη ενεργή"},
{"TableMenuAutoResizeLast", "Τελευταίου πεδίου"},
{"TableMenuAutoResizeAll", "Όλων των πεδίων"},
{"TableMenuProperties", "Πληροφορίες..."},
{"TableMenuPreferences", "Προτιμήσεις..."},
{"FieldMenu", "Πεδίο"},
{"FieldMenuNew", "Νέο πεδίο"},
{"FieldMenuEdit", "Ιδιότητες"},
{"FieldMenuRemove", "Διαγραφή"},
{"FieldMenuEditable", "Μεταβαλλόμενο"},
{"FieldMenuHidden", "Κρυφό"},
{"FieldMenuRemovable", "Διαγράψιμο"},
{"FieldMenuKey", "Κλειδί"},
{"FieldMenuCalculated", "Υπολογιζόμενο"},
{"FieldMenuDataType", "Τύπος πεδίου"},
{"Number", "Αριθμός"},
{"Integer", "Ακέραιος"},
{"Float", "Float"},
{"Alphanumeric", "Αλφαριθμητικός"},
{"Boolean (Yes/No)", "Αληθές/Ψευδές"},
{"Date", "Ημερομηνία"},
{"Time", "Ώρα"},
{"CDate", "Ημερομηνία"},
{"CTime", "Ώρα"},
{"URL", "URL"},
{"Image", "Εικόνα"},
{"Boolean", "Αληθές/Ψευδές"},
{"true", "Αληθές"},
{"false", "Ψευδές"},
{"FieldMenuSortAsc", "Αύξουσα ταξινόμηση"},
{"FieldMenuSortDesc", "Φθίνουσα ταξινόμηση"},
{"FieldMenuSelectAll", "Επιλογή όλων"},
{"FieldMenuClearSel", "Αποεπιλογή όλων"},
{"FieldMenuWidth", "Πλάτος"},
{"FieldMenuFreeze", "Παγίωση πλάτους"},
{"RecordMenu", "Εγγραφή"},
{"RecordMenuNew", "Νέα εγγραφή"},
{"RecordMenuRemoveSelected", "Διαγραφή επιλεγμένων εγγραφών"},
{"RecordMenuRemoveActive", "Διαγραφή ενεργής εγγραφής"},
{"RecordMenuSelectAll", "Επιλογή όλων"},
{"RecordMenuInvertSel", "Αντιστροφή επιλογής"},
{"RecordMenuClearSel", "Αποεπιλογή όλων"},
{"RecordMenuSelectedFirst", "Προαγωγή επιλεγμένων"},
{"Yes", "Ναί"},
{"No", "Όχι"},
{"OK", "Αποδοχή"},
{"Cancel", "Άκυρο"},
{"Error", "Λάθος"},
{"Warning", "Προειδοποίηση"},
{"Close", "Κλείσιμο"},
{"WaitMessage", "Παρακαλώ περιμένετε..."},
{"Confirmation", "Επιβεβαίωση"},
{"Confirm removal", "Επιβεβαίωση διαγραφής"},
{"DatabaseMsg1", "Δεν βρίσκεται το \"Windows\" Look&Feel"},
{"DatabaseMsg2", "Δεν αρχικοποιείται το \"Windows\" Look&Feel"},
{"DatabaseMsg3", "Εσωτερικό λάθος! Δεν είναι δυνατή η δημιουργία νέας βάσης"},
{"DatabaseMsg4", "Νέος τίτλος για τη βάση δεδομένων"},
{"DatabaseMsg5", "Τίτλος βάσης δεδομένων"},
{"DatabaseMsg6", "Διαχωριστής πεδίων στο αρχείο \""},
{"DatabaseMsg7", "Επιλέξτε διαχωριστή πεδίων"},
{"DatabaseMsg8", "Διαχωριστής πεδίων στο προς εξαγωγή αρχείο"},
{"DatabaseMsg9", "Επιλέξτε διαχωριστή πεδίων"},
{"DatabaseMsg10", "Τοποθέτηση των δεδομένων του πίνακα εντός εισαγωγικών;"},
{"DatabaseMsg11", "Xrhsh eisagvgikwn;"},
{"DatabaseMsg12", "Η τρέχουσα βάση δεδομένων έχει αλλάξει. Θέλετε να αποθηκευτεί πριν κλείσει;"},
{"DatabaseMsg13", "Νέο όνομα πίνακα"},
{"DatabaseMsg14", "Όνομα πίνακα"},
{"DatabaseMsg15", "Επιλέξτε πίνακα"},
{"DatabaseMsg16", "Λάθος πίνακας. Δεν είναι δυνατή η ένωση ενός πίνακα με το εαυτό του"},
{"DatabaseMsg17", "Λάθος πίνακας. Δεν είναι δυνατή η τομή ενός πίνακα με το εαυτό του"},
{"DatabaseMsg18", "Λάθος πίνακας. Δεν είναι δυνατή η σύνδεση ενός πίνακα με το εαυτό του"},
{"DatabaseMsg19", "Λάθος πίνακας. Δεν είναι δυνατή η υπό-συνθήκη σύνδεση ενός πίνακα με το εαυτό του"},
{"DatabaseMsg20", "Δεν υπάρχει επιλεγμένο πεδίο"},
{"DatabaseMsg21", "Θέλετε να γίνουν οι υπόλοιπες αλλαγές;"},
{"DatabaseMsg22", "Συνέχεια..."},
{"DatabaseMsg23", "Πεδία με τύπο \"Εικόνα\" δεν είναι δυνατό να είναι τμήμα του κλειδιού του πίνακα"},
{"DatabaseMsg25", "Το πεδίο \""},
{"DatabaseMsg26", "\" είναι υπολογιζόμενο, οπότε δεν είναι δυνατή η άμεση μεταβολή των δεδομένων του"},
{"DatabaseMsg27", "Δεν είναι δυνατή η αλλαγή του τύπου του υπολογιζόμενου πεδίου \""},
{"DatabaseMsg28", "\", διότι είναι τμήμα του κλειδιού του πίνακα"},
{"DatabaseMsg29", "Η αλλαγή του κλειδιού του πίνακα μπορεί να οδηγήσει σε απώλεια δεδομένων. Θέλετε να προχωρήσει;"},
{"DatabaseMsg30", "Η βάση δεδομένων είναι ήδη ανοικτή"},
{"DatabaseMsg31", "Δεν είναι δυνατό το άνοιγμα του αρχείου βάσης δεδομένων \""},
{"DatabaseMsg32", "Δεν είναι δυνατό το άνοιγμα του αρχείου πίνακα \""},
{"DatabaseMsg33", "\". Θέλετε να το εντοπίσετε οι ίδιοι;"},
{"DatabaseMsg34", "\". Πιθανότατα το αρχείο έχει υποστεί βλάβη"},
{"DatabaseMsg35", "Καμία ανοιχτή βάση"},
{"DatabaseMsg36", "Βάση δεδομένων"},
{"DatabaseMsg37", "Άτιτλος"},
{"DatabaseMsg39", "Άνοιγμα βάσης δεδομένων"},
{"DatabaseMsg40", "Αποθήκευση βάσης δεδομένων "},
{"DatabaseMsg41", "Αποθήκευση βάσης δεδομένων \""},
{"DatabaseMsg42", "\" ως"},
{"DatabaseMsg43", "Εισαγωγή πίνακα από το αρχείο κειμένου"},
{"DatabaseMsg44", "πίνακας1.txt"},
{"DatabaseMsg45", "Εξαγωγή πίνακα σε αρχείο κειμένου"},
{"DatabaseMsg46", "Εξαγωγή πίνακα \""},
{"DatabaseMsg47", "\" σε αρχείο κειμένου"},
{"DatabaseMsg48", "Αποθήκευση αλλαγών στη βάση δεδομένων"},
{"DatabaseMsg49", "Αποθήκευση αλλαγών στη βάση δεδομένων \""},
{"DatabaseMsg50", "Προσθήκη πίνακα στη βάση δεδομένων"},
{"DatabaseMsg51", "Αποθήκευση πίνακα ως"},
{"DatabaseMsg52", "Αποθήκευση πίνακα \""},
{"DatabaseMsg53", "\" ως"},
{"DatabaseMsg54", "Επιλέξτε τον πίνακα με τον οποίο ο ενεργός πίνακας θα ενωθεί"},
{"DatabaseMsg55", "Επιλέξτε τον πίνακα με τον οποίο ο πίνακας \""},
{"DatabaseMsg56", "\" θα ενωθεί"},
{"DatabaseMsg57", "Επιλέξτε το πίνακα με τον οποίο θα γίνει η τομή του ενεργού πίνακα"},
{"DatabaseMsg58", "\" θα τμηθεί"},
{"DatabaseMsg59", "Επιλέξτε τον πίνακα με τον οποίο ο ενεργός πίνακας θα συνδεθεί"},
{"DatabaseMsg60", "\" θα συνδεθεί"},
{"DatabaseMsg61", "Επιλέξτε τον πίνακα με τον οποίο ο ενεργός πίνακας θα συνδεθεί υπό συνθήκη"},
{"DatabaseMsg62", "\" θα συνδεθεί υπό συνθήκη"},
{"DatabaseMsg63", "Ιδιότητες πεδίων του πίνακα \""},
{"DatabaseMsg64", "Ιδιότητες πεδίων του ενεργού πίνακα"},
{"DatabaseMsg65", "Ιδιότητες πεδίων για ολόκληρη τη βάση δεδομένων"},
{"DatabaseMsg66", "Χρώματα για τον πίνακα \""},
{"DatabaseMsg67", "Χρώματα για τον ενεργό πίνακα"},
{"DatabaseMsg68", "Χρώματα για ολόκληρη τη βάση δεδομένων"},
{"DatabaseMsg69", "Επιπρόσθετες προτιμήσεις για τον πίνακα \""},
{"DatabaseMsg70", "Επιπρόσθετες προτιμήσεις για τον ενεργό πίνακα"},
{"DatabaseMsg71", "Επιπρόσθετες προτιμήσεις για ολόκληρη τη βάση"},
{"DatabaseMsg72", "Άνοιγμα πίνακα"},
{"DatabaseMsg73", "Κενή βάση δεδομένων"},
{"DatabaseMsg74", "Ο πίνακας που φορτώθηκε είναι κρυφός. Έτσι ενω υπάρχει στη βάση δεδομενων δεν είναι επιτρεπτή η εμφανισή του"},
{"DatabaseMsg75", "Επιβεβαίωση διαγραφής των επιλεγμένων πεδίων"},
{"DatabaseMsg76", "Επιβεβαίωση διαγραφής των επιλεγμένων εγγραφών"},
{"DatabaseMsg77", "Δεν είναι δυνατή η μεταφορά πίνακα σε ψηφίδα που περιέχει την ίδια βάση δεδομένων με την ψηφίδα από την οποία προέρχεται ο πίνακας"},
{"DatabaseMsg78", "Καμία επιλεγμένη εγγραφή"},
{"DatabaseMsg79", " επιλεγμένη εγγραφή"},
{"DatabaseMsg80", " επιλεγμένες εγγραφές"},
{"DatabaseMsg81", "από "},
{"DatabaseMsg82", "Εγγραφή"},
{"DatabaseMsg83", "Προηγούμενος πίνακας"},
{"DatabaseMsg84", "Επόμενος πίνακας"},
{"DatabaseMsg85", "Προηγούμενη εγγραφή"},
{"DatabaseMsg86", "Επόμενη εγγραφή"},
{"DatabaseMsg87", "Πρώτη εγγραφή"},
{"DatabaseMsg88", "Τελευταία εγγραφή"},
{"DatabaseMsg89", " δεν είναι αριθμός εγγραφής"},
{"DatabaseMsg90", "Άκυρος αριθμός εγγραφής"},
{"DatabaseMsg91", "Το "},
{"DatabaseMsg92", "Η βάση δεδομένων φορτώνεται..."},
{"DatabaseMsg93", "Άκυρος αριθμός εγγραφών"},
{"DatabaseMsg94", "Άκυρος αριθμός πεδίων"},
{"DatabaseMsg95", " δεν είναι αριθμός"},
{"DatabaseMsg96", "Επιβεβαίωση διαγραφής της ενεργής εγγραφής"},
{"DatabaseMsg97", "Νέα βάση"},
{"DatabaseMsg98", "Άνοιγμα βάσης"},
{"DatabaseMsg99", "Αποθήκευση βάσης"},
{"DatabaseMsg100", "Αποκοπή"},
{"DatabaseMsg101", "Αντιγραφή"},
{"DatabaseMsg102", "Επικόλληση"},
{"DatabaseMsg103", "Ταξινόμηση επιλεγμένων πεδίων κατά αύξουσα σειρά"},
{"DatabaseMsg104", "Ταξινόμηση επιλεγμένων πεδίων κατά φθίνουσα σειρά"},
{"DatabaseMsg105", "Εύρεση"},
{"DatabaseMsg106", "Εύρεση προηγούμενου"},
{"DatabaseMsg107", "Εύρεση επομένου"},
{"DatabaseMsg108", "Νέα εγγραφή"},
{"DatabaseMsg109", "Διαγραφή ενεργής εγγραφής"},
{"DatabaseMsg110", "Διαγραφή επιλεγμένων εγγραφών"},
{"DatabaseMsg111", "Νέο πεδίο"},
{"DatabaseMsg112", "Διαγραφή επιλεγμένων πεδίων"},
{"DatabaseMsg113", "Ιδιότητες πεδίου"},
{"DatabaseMsg114", "Επιλογή όλων των εγγραφών"},
{"DatabaseMsg115", "Αποεπιλογή όλων των εγγραφών"},
{"DatabaseMsg116", "Αντιστροφή επιλεγμένων εγγραφών"},
{"DatabaseMsg117", "Προαγωγή επιλεγμένων εγγραφών"},
{"DatabaseMsg118", "Μέγεθος γραμματοσειράς"},
{"DatabaseMsg119", "Γραμματοσειρά"},
{"DatabaseMsg120", "Έντονα"},
{"DatabaseMsg121", "Πλαγιαστά"},
{"DatabaseMsg122", "Χρώμα υποβάθρου"},
{"DatabaseMsg123", "Χρώμα δεδομένων"},
{"DatabaseMsg124", "Χρώμα πλέγματος πίνακα"},
{"DatabaseMsg125", "Χρώμα επιλεγμένων εγγραφών"},
{"DatabaseMsg126", "Χρώμα ενεργής εγγραφής"},
{"DatabaseMsg127", "Επιλογέας πλέγματος πίνακα"},
{"DatabaseMsg128", "Ταυτόχρονη επιλογή εγγραφών/πεδίων"},
{"DatabaseMsg129", "Επίδειξη μη μεταβαλλόμενων πεδίων"},
{"DatabaseMsg130", "Ανεξάρτητα τύπου δεδομένων"},
{"Field", "Πεδίο"},
{"New jTable", "Νέος πίνακας"},
{"Standard", "Βασική γραμμή εργαλείων"},
{"Formatting", "Γραμμή εργαλείων μορφής πινάκων"},
{"Cut", "Αποκοπή"},
{"Copy", "Αντιγραφή"},
{"Paste", "Επικόλληση"},
{"Icon Editor", "Επεξεργαστής εικονιδίων"},
{"Insert File Path", "Εισαγωγή διαδρομής αρχείου"},
{"Select File", "Επιλογή αρχείου"},
{"FieldWidthDialogMsg1","Πλάτη επιλεγμένων πεδίων"},
{"FieldWidthDialogMsg2","Ελάχιστο πλάτος"},
{"FieldWidthDialogMsg3","Μέγιστο πλάτος"},
{"FieldWidthDialogMsg4","Ελάχιστο και μέγιστο πλάτος πεδίου"},
{"FieldWidthDialogMsg5","Άκυρη τιμή \""},
{"FieldWidthDialogMsg6","\" για το ελάχιστο πλάτος πεδίου"},
{"FieldWidthDialogMsg7","Το ελάχιστο πλάτος πεδίου δεν μπορεί να είναι μικρότερο από 30"},
{"FieldWidthDialogMsg8","\" για το μέγιστο πλάτος πεδίου"},
{"FieldWidthDialogMsg9","Το μέγιστο πλάτος πεδίου δεν μπορεί να είναι μεγαλύτερο από 2000"},
{"FieldWidthDialogMsg10","Το ελάχιστο πλάτος πεδίου δεν μπορεί να είναι μεγαλύτερο από το μέγιστο πλάτος"},
{"NewFieldDialogMsg1", "Νέο πεδίο"},
{"EditFieldDialogMsg", "Επεξεργασία πεδίου"},
{"NewFieldDialogMsg2", "Όνομα πεδίου"},
{"NewFieldDialogMsg3", "Κλειδί"},
{"NewFieldDialogMsg4", "Μεταβαλλόμενο"},
{"NewFieldDialogMsg5", "Διαγράψιμο"},
{"NewFieldDialogMsg6", "Υπολογιζόμενο"},
{"NewFieldDialogMsg7", "Ανήκει το πεδίο στο κλειδί του πίνακα;"},
{"NewFieldDialogMsg8", "Είναι το πεδίο μεταβαλλόμενο;"},
{"NewFieldDialogMsg9", "Είναι το πεδίο διαγράψιμο;"},
{"NewFieldDialogMsg10", "Είναι το πεδίο υπολογιζόμενο;"},
{"NewFieldDialogMsg11", "Τύπος πεδίου"},
{"NewFieldDialogMsg12", "Φόρμουλα"},
{"NewFieldDialogMsg13", "Φόλμουλα υπολογιζόμενου πεδίου"},
{"NewFieldDialogMsg14", "Ιδιότητες πεδίου"},
{"NewFieldDialogMsg15", "Καθαρισμός"},
{"NewFieldDialogMsg16", "Αποθήκευση αναφορών σε εικόνες"},
{"NewTableDialogMsg1", "Νέος πίνακας"},
{"NewTableDialogMsg2", "Όνομα πίνακα"},
{"NewTableDialogMsg3", "Τύπος"},
{"NewTableDialogMsg4", "Διαγραφή πεδίου"},
{"NewTableDialogMsg5", "Καθαρισμός πεδίου"},
{"NewTableDialogMsg6", "Δημιουργία πίνακα"},
{"NewTableDialogMsg7", "Όνομα του νέου πεδίου"},
{"NewTableDialogMsg8", "Ένα άλλο πεδίο με το όνομα \""},
{"NewTableDialogMsg9", "\" έχει ήδη οριστεί. Το πεδίο αυτό δεν θα εισαχθεί στον νέο πίνακα"},
{"NewTableDialogMsg10", "Είναι το νέο πεδίο υπολογιζόμενο;"},
{"NewTableDialogMsg11", "Επιλέξτε τον τύπο του πεδίου"},
{"NewTableDialogMsg12", "Ανήκει το νέο πεδίο στο κλειδί του πίνακα;"},
{"NewTableDialogMsg13", "Είναι το νέο πεδίο μεταβαλλόμενο"},
{"NewTableDialogMsg14", "Είναι το νέο πεδίο διαγράψιμο;"},
{"NewTableDialogMsg15", "Συμπληρώστε την φόρμουλα του υπολογιζόμενου πεδίου"},
{"PreferencesDialogMsg1", "Προτιμήσεις πινάκων"},
{"PreferencesDialogMsg2", "Μορφή ημερομηνίας "},
{"PreferencesDialogMsg3", "Μορφή ώρας "},
{"PreferencesDialogMsg4", "Μορφή Ημερομηνίας/Ώρας"},
{"PreferencesDialogMsg5", "Εμφάνιση μόνο του ακέραιου μέρους"},
{"PreferencesDialogMsg6", "Χρήση εκθετικής μορφής"},
{"PreferencesDialogMsg7", "Συνεχής εμφάνιση της υποδιαστολής"},
{"PreferencesDialogMsg8", "Χαρακτήρας υποδιαστολής "},
{"PreferencesDialogMsg9", "Εμφάνιση διαχωριστή χιλιάδων"},
{"PreferencesDialogMsg10", "Διαχωριστής χιλιάδων "},
{"PreferencesDialogMsg11", "Μορφοποίηση αριθμών"},
{"PreferencesDialogMsg12", "Ενημέρωση του ενεργού πίνακα μόνο "},
{"PreferencesDialogMsg13", "Προτιμήσεις μορφοποίησης δεδομένων για ολόκληρη τη βάση"},
{"PreferencesDialogMsg14", "Προτιμήσεις μορφοποίησης δεδομένων για τον πίνακα \""},
{"PreferencesDialogMsg15", "Μορφοποίηση δεδομένων"},
{"PreferencesDialogMsg16", "Yπόβαθρο πίνακα"},
{"PreferencesDialogMsg17", "Πλέγμα"},
{"PreferencesDialogMsg18", "Υπόβαθρο επιλογής"},
{"PreferencesDialogMsg19", "Επίδειξη"},
{"PreferencesDialogMsg20", " Γενικά "},
{"PreferencesDialogMsg21", "Ακέραιοι"},
{"PreferencesDialogMsg22", "Αριθμοί"},
{"PreferencesDialogMsg23", "Αληθές/Ψευδές"},
{"PreferencesDialogMsg24", "Ημερομηνίες"},
{"PreferencesDialogMsg25", "Ώρες"},
{"PreferencesDialogMsg26", "URL"},
{"PreferencesDialogMsg27", " Χρώματα τύπων δεδομένων πεδίων "},
{"PreferencesDialogMsg28", "Επιλέξτε χρώμα"},
{"PreferencesDialogMsg29", "Επιλογέας χρωμάτων"},
{"PreferencesDialogMsg30", "Προτιμήσεις χρωμάτων για ολόκληρη τη βάση"},
{"PreferencesDialogMsg31", "Προτιμήσεις χρωμάτων για τον πίνακα \""},
{"PreferencesDialogMsg32", "Χρώμα"},
{"PreferencesDialogMsg33", "Τύπος"},
{"PreferencesDialogMsg34", "Μέγεθος"},
{"PreferencesDialogMsg35", "ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσΤτΥυΦφΧχΨψΩω"},
{"PreferencesDialogMsg36", " Γραμματοσειρά "},
{"PreferencesDialogMsg37", "Ύψος εγγραφής"},
{"PreferencesDialogMsg38", "Το ύψος εγγραφής πρέπει να είναι μεταξύ \"7\" και \"299\""},
{"PreferencesDialogMsg39", "Εμφάνιση οριζόντιων γραμμών πλέγματος"},
{"PreferencesDialogMsg40", "Εμφάνιση κάθετων γραμμών πλέγματος"},
{"PreferencesDialogMsg41", "Ταυτόχρονη επιλογή πεδίων και εγγραφών"},
{"PreferencesDialogMsg42", "Εμφάνιση εικονιδίων τύπου δεδομένων στην επικεφαλίδα των πεδίων"},
{"PreferencesDialogMsg43", "Επίδειξη μη μεταβαλλόμενων πεδίων"},
{"PreferencesDialogMsg44", " Γενικές ρυθμίσεις "},
{"PreferencesDialogMsg45", "Επιπρόσθετες προτιμήσεις για ολόκληρη τη βάση"},
{"PreferencesDialogMsg46", "Επιπρόσθετες προτιμήσεις για τον πίνακα \""},
{"PreferencesDialogMsg47", "Επιπρόσθετες προτιμήσεις"},
{"PreferencesDialogMsg48", "Χρώμα υποβάθρου του πίνακα"},
{"PreferencesDialogMsg49", "Χρώμα πλέγματος του πίνακα"},
{"PreferencesDialogMsg50", "Χρώμα επιλεγμένων εγγραφών του πίνακα"},
{"PreferencesDialogMsg51", "Χρώμα μη μεταβαλλόμενων πεδίων του πίνακα"},
{"PreferencesDialogMsg52", "Χρώμα ακεραίων τιμών"},
{"PreferencesDialogMsg53", "Χρώμα αριθμητικών τιμών"},
{"PreferencesDialogMsg54", "Χρώμα τιμών τύπου 'Αληθές/Ψευδές'"},
{"PreferencesDialogMsg55", "Χρώμα τιμών τύπου 'Ημερομηνία'"},
{"PreferencesDialogMsg56", "Χρώμα τιμών τύπου 'Ώρα'"},
{"PreferencesDialogMsg57", "Χρώμα URL τιμών"},
{"PreferencesDialogMsg58", "Χρώμα αλφαριθμητικών τιμών"},
{"PreferencesDialogMsg59", "Αλφαριθμητικά"},
{"PreferencesDialogMsg60", "Floats"},
{"PreferencesDialogMsg61", "Χρώμα τιμών τύπου float"},
{"PreferencesDialogMsg62", "Προσκήνιο επιλογής"},
{"PreferencesDialogMsg63", "Χρώμα προσκηνίου επιλεγμένων εγραφών πίνακα"},
{"PreferencesDialogMsg64", "Eνεργή εγγραφή"},
{"PreferencesDialogMsg65", "Χρώμα ενεργής εγγραφής πίνακα"},
{"TableInfoDialogMsg1", "Πληροφορίες για τον πίνακα \""},
{"TableInfoDialogMsg2", "Αριθμός εγγραφών:"},
{"TableInfoDialogMsg3", "Αριθμός πεδίων:"},
{"TableInfoDialogMsg4", "Αριθμός επιλεγμένων εγγραφών:"},
{"TableInfoDialogMsg5", "Αριθμός επιλεγμένων πεδίων:"},
{"TableInfoDialogMsg6", "Πεδία κλειδιά:"},
{"TableInfoDialogMsg7", "Κανένα"},
{"TableInfoDialogMsg8", "Υπολογιζόμενα πεδία:"},
{"TableSortDialogMsg1", "Ταξινόμηση πίνακα"},
{"TableSortDialogMsg2", "Επιλογή των πεδίων ως προς τα οποία ο πίνακας \""},
{"TableSortDialogMsg3", "\" θα ταξινομηθεί"},
{"TableSortDialogMsg4", " πίνακα \""},
{"TableSortDialogMsg5", "Πεδία του"},
{"TableSortDialogMsg6", "Ταξινόμηση ως προς τα πεδία"},
{"TableSortDialogMsg7", "Κατεύθυνση"},
{"ThJoinDialogMsg1", "Σύνδεση υπό συνθήκη: "},
{"ThJoinDialogMsg2", "Νέα συνθήκη"},
{"ThJoinDialogMsg3", "Διαγραφή συνθήκης"},
{"ColorPanelMsg1", "Ενεργός πίνακας μόνο"},
{"Number of records", "Αριθμός εγγραφών"}, //TableAutoCreateDialog
{"Number of fields", "Αριθμός πεδίων"},
{"Administrator Password", "Κωδικός διαχειριστή"},
{"Database password", "Κωδικός βάσης δεδομένων"},
{"DatabaseMsg131", "Εισαγωγή κωδικού"},
{"DatabaseMsg132", "Λάθος κωδικός διαχειριστή βάσης δεδομένων. Δοκιμάστε ξανά."},
{"DatabaseMsg133", "Ορισμός επιπέδου χρηστών"},
{"DatabaseMsg134", "Λάθος κωδικός βάσης. Η βάση δεδομένων παραμένει κλειδωμένη"},
{"DatabaseMsg135", "Η βάση δεδομένων κλείδωσε"},
{"DatabaseMsg136", "Άκυρος κωδικός. Η βάση δεδομένων δεν κλειδώθηκε"},
{"Novice", "Αρχάριοι"},
{"Advanced", "Προχωρημένοι"},
{"User mode", "Επίπεδο χρηστών"},
{"DatabasePropertiesDialogMsg1", "Ιδιότητες βάσης δεδομένων"},
{"DatabasePropertiesDialogMsg2", "Όνομα"},
{"DatabasePropertiesDialogMsg3", "Επώνυμο"},
{"DatabasePropertiesDialogMsg4", "Δημιουργία"},
{"DatabasePropertiesDialogMsg5", ""},
{"DatabasePropertiesDialogMsg6", "Τελευταία τροποποίηση"},
{"DatabasePropertiesDialogMsg7", ""},
{"DatabasePropertiesDialogMsg8", "Δημιουργός βάσης δεδομένων"},
{"DatabasePropertiesDialogMsg9", "Επιτρεπτή η αφαίρεση πινάκων"},
{"DatabasePropertiesDialogMsg10", "Επιτρεπτή η προσθήκη πινάκων"},
{"DatabasePropertiesDialogMsg11", "Επιτρεπτή η εξαγωγή πινάκων"},
{"DatabasePropertiesDialogMsg12", "Εμφάνιση \"κρυφών\" πινάκων"},
{"DatabasePropertiesDialogMsg13", "Κλείδωμα"},
{"DatabasePropertiesDialogMsg14", "Ξεκλείδωμα"},
{"DatabasePropertiesDialogMsg15", "Ιδιότητες πινάκων"},
{"DatabasePropertiesDialogMsg16", "Εισαγωγή κωδικού βάσης"},
{"DatabasePropertiesDialogMsg17", "Επιτρεπτή η προσθήκη εγγραφών"},
{"DatabasePropertiesDialogMsg18", "Επιτρεπτή η διαγραφή εγγραφών"},
{"DatabasePropertiesDialogMsg19", "Επιτρεπτή η προσθήκη πεδίων"},
{"DatabasePropertiesDialogMsg20", "Επιτρεπτή η διαγραφή πεδίων"},
{"DatabasePropertiesDialogMsg21", "Επιτρεπτή η αναδιοργάνωση των πεδίων"},
{"DatabasePropertiesDialogMsg22", "Επιτρεπτή η μεταβολή των δεδομένων"},
{"DatabasePropertiesDialogMsg23", "Επιτρεπτή η αλλαγή κλειδιού του πίνακα"},
{"DatabasePropertiesDialogMsg24", "Ιδιότητες βάσης δεδομένων"},
{"DatabasePropertiesDialogMsg25", "Ιδιότητες πίνακα"},
{"DatabasePropertiesDialogMsg26", "Επιτρεπτή η μεταβολή της ιδιότητας \"Μεταβαλλόμενο\""},
{"DatabasePropertiesDialogMsg27", "Επιτρεπτή η μεταβολή της ιδιότητας \"Διαγράψιμο\""},
{"DatabasePropertiesDialogMsg28", "Επιτρεπτή η μεταβολή της ιδιότητας \"Κλειδί\""},
{"DatabasePropertiesDialogMsg29", "Επιτρεπτή η μεταβολή τύπου δεδομένων"},
{"DatabasePropertiesDialogMsg30", "Επιτρεπτή η μεταβολή του πεδίου σε μη υπολογιζόμενο"},
{"DatabasePropertiesDialogMsg31", "Ιδιότητες πεδίου"},
{"DatabasePropertiesDialogMsg32", "Επιτρεπτή η μεταβολή της ιδιότητας \"Κρυφός\""},
{"DatabasePropertiesDialogMsg33", "Εμφάνιση κρυφών πεδίων"},
{"DatabasePropertiesDialogMsg34", "Επιτρεπτή η μεταβολή της ιδιότητας \"Κρυφό\""},
{"DatabasePropertiesDialogMsg35", "Επιτρεπτή η μεταβολή της φόρμουλας του υπολογιζόμενου πεδίου"},
{"DatabasePropertiesDialogMsg36", "Επιτρεπτή η μεταβολή των ιδιοτήτων των πεδίων"},
{"DatabasePropertiesDialogMsg37", "Επιτρεπτή η μεταβολή του τίτλου του πίνακα"},
{"MetadataDialogMsg1", "Περιγραφή βάσης δεδομένων "},
{"MetadataDialogMsg2", "Περιγραφή πίνακα "},
{"IconEditActionMsg1", "Το εικονίδιο δεν αποθηκεύτηκε σε αρχείο. Δεδομένου ότι το συγκεκριμένο πεδίο αποθηκεύει μόνο αναφορές σε αρχεία εικόνων, το εικονίδιο δεν θα αποθηκευτεί"},
{"ResultTable", "Απάντηση ερώτησης στον πίνακα \""},
{"SaveDB", "Θέλετε να αποθηκεύσετε τη βάση δεδομένων;"},
{"warnClose", "Προσοχή! Η ψηφίδα επεξεργαστής βάσεων κλείνει..."},
{"DatabaseEntry", "Εισαγωγή Βάσης Δεδομένων"},
{"ConstructorTimer", "Κατασκευή επεξεργαστή βάσεων"},
{"LoadTimer", "Ανάκτηση επεξεργαστή βάσεων"},
{"SaveTimer", "Αποθήκευση επεξεργαστή βάσεων"},
{"InitESlateAspectTimer", "Κατασκευή αβακιακής πλευράς επεξεργαστή βάσεων"},
{"FontType", "Γραμματοσειρά"},
{"FontSize", "Μέγεθος γραμματοσειράς"},
{"Bold", "Έντονα"},
{"Italic", "Πλάγια"},
{"BackColor", "Χρώμα υποβάθρου"},
{"ForeColor", "Χρώμα κειμένου"},
{"GridColor", "Χρώμα πλέγματος"},
{"SelectionColor", "Χρώμα επιλογής"},
{"ActiveRecColor", "Χρώμα ενεργής εγγραφής"},
{"GridChooser", "Τύπος πλέγματος"},
{"RowColumnSelection", "Πολιτική επιλογής εγγραφών/πεδίων"},
{"HightLightNonEditableFields", "Τονισμός μη-μεταβαλλόμενων πεδίων"},
{"Previous Table", "Προηγούμενος πίνακας"},
{"Next Table", "Επόμενος πίνακας"},
{"Record Number", "Αριθμός εγγραφής"},
{"Number of Records", "Πλήθος εγγραφών"},
{"First Record", "Πρώτη εγγραφή"},
{"Previous Record", "Προηγούμενη εγγραφή"},
{"Next Record", "Επόμενη εγγραφή"},
{"Last Record", "Τελευταία εγγραφή"},
{"Message", "Ετικέτα"},
{"Record", "Ετικέτα2"},
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/database/InfoBundle_el_GR.java
|
2,249 |
/**
*
*/
package com.kaartgroup.kaartvalidator.validation;
import static org.openstreetmap.josm.tools.I18n.tr;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import org.openstreetmap.josm.command.ChangePropertyCommand;
import org.openstreetmap.josm.data.osm.Tag;
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.data.validation.Severity;
import org.openstreetmap.josm.data.validation.Test;
import org.openstreetmap.josm.data.validation.TestError;
import org.openstreetmap.josm.gui.progress.ProgressMonitor;
/**
* @author tsmock
*
*/
public class Abbreviations extends Test {
private static final int ABBRCODE = 5100;
public static final int CONTAINS_ABBREVIATION = ABBRCODE + 0;
private List<Way> ways;
private HashMap<String[], ArrayList<String>> abbreviations;
public Abbreviations() {
super(tr("Check for abbreviations in road names"), tr("Looks abbreviations such as Str, St, etc."));
}
@Override
public void startTest(ProgressMonitor monitor) {
super.startTest(monitor);
ways = new LinkedList<>();
abbreviations = new HashMap<>();
addGreekAbbreviations();
addEnglishAbbreviations();
}
@Override
public void endTest() {
Way pWay = null;
try {
for (Way way : ways) {
pWay = way;
checkForAbbreviations(pWay);
}
} catch (Exception e) {
if (pWay != null) {
System.out.printf("Way https://osm.org/way/%d caused an error" + System.lineSeparator(), pWay.getOsmId());
}
e.printStackTrace();
}
ways = null;
abbreviations = null;
super.endTest();
}
@Override
public void visit(Way way) {
if (!way.isUsable() || !way.hasKey("highway")) {
return;
}
boolean nametags = false;
for (Tag tag : way.getKeys().getTags()) {
if (tag.getKey().contains("name") && !tag.getKey().equals("int_name")) {
nametags = true;
break;
}
}
if (!nametags) return;
ways.add(way);
}
private void addAbbreviations(String abbreviation, String position, String... expansions) {
if (expansions.length == 0) {
expansions = new String[] {position};
position = "unknown";
}
ArrayList<String> expansion = new ArrayList<String>(Arrays.asList(expansions));
if (!position.equals("unknown") && !position.equals("suffix") && !position.equals("prefix")) {
expansion.add(position);
position = "unknown";
}
String[] key = new String[] {abbreviation, position};
if (abbreviations.containsKey(key)) {
for (String tstr : expansion) {
if (!abbreviations.get(key).contains(tstr)) {
abbreviations.get(key).add(tstr);
}
}
} else {
abbreviations.put(key, expansion);
}
}
/* Greek abbreviations are current as of 2018-12-13 */
private void addGreekAbbreviations() {
addAbbreviations("Αγ.", "prefix", "Αγίας", "Αγίου", "Αγίων");
addAbbreviations("Αφοί", "prefix", "Αδελφοί");
addAbbreviations("Αφών", "prefix", "Αδελφών");
addAbbreviations("Αλ.", "unknown", "Αλέξανδρου");
addAbbreviations("ΑΤΕΙ", "prefix", "Ανώτατο Τεχνολογικό Εκπαιδευτικό Ίδρυμα");
addAbbreviations("ΑΤ", "prefix", "Αστυνομικό Τμήμα");
addAbbreviations("Β.", "prefix", "Βασιλέως", "Βασιλίσσης");
addAbbreviations("Βασ.", "prefix", "Βασιλέως", "Βασιλίσσης");
addAbbreviations("Γρ.", "unknown", "Γρηγορίου");
addAbbreviations("Δ.", "prefix", "Δήμος");
addAbbreviations("ΔΣ", "prefix", "Δημοτικό Σχολείο");
addAbbreviations("Δημ. Σχ.", "prefix", "Δημοτικό Σχολείο");
addAbbreviations("Εθν.", "unknown", "Εθνάρχου", "Εθνική", "Εθνικής");
addAbbreviations("Ελ.", "unknown", "Ελευθέριος", "Ελευθερίου");
addAbbreviations("ΕΛΤΑ", "prefix", "Ελληνικά Ταχυδρομεία");
addAbbreviations("Θεσ/νίκης", "unknown", "Θεσσαλονίκης");
addAbbreviations("Ι.Μ.", "prefix", "Ιερά Μονή");
addAbbreviations("Ι.Ν.", "prefix", "Ιερός Ναός");
addAbbreviations("Κτ.", "prefix", "Κτίριο");
addAbbreviations("Κων/νου", "unknown", "Κωνσταντίνου");
addAbbreviations("Λ.", "prefix", "Λεωφόρος", "Λίμνη");
addAbbreviations("Λεωφ.", "prefix", "Λεωφόρος");
addAbbreviations("Ν.", "prefix", "Νέα", "Νέες", "Νέο", "Νέοι", "Νέος", "Νησί", "Νομός");
addAbbreviations("Όρ.", "prefix", "Όρος");
addAbbreviations("Π.", "prefix", "Παλαιά", "Παλαιές", "Παλαιό", "Παλαιοί", "Παλαιός");
addAbbreviations("Π.", "unknown", "Ποταμός");
addAbbreviations("ΑΕΙ", "prefix", "Πανεπιστήμιο");
addAbbreviations("Παν.", "prefix", "Πανεπιστήμιο");
addAbbreviations("Πλ.", "prefix", "Πλατεία");
addAbbreviations("Ποτ.", "unknown", "Ποταμός");
addAbbreviations("Στρ.", "prefix", "Στρατηγού");
addAbbreviations("ΕΛΤΑ", "prefix", "Ταχυδρομείο");
addAbbreviations("ΤΕΙ", "prefix", "Τεχνολογικό Εκπαιδευτικό Ίδρυμα");
}
private void addEnglishAbbreviations() {
addAbbreviations("Accs", "Access");
addAbbreviations("AFB", "Air Force Base");
addAbbreviations("ANGB", "Air National Guard Base");
addAbbreviations("Aprt", "Airport");
addAbbreviations("Al", "Alley");
addAbbreviations("All", "Alley");
addAbbreviations("Ally", "Alley");
addAbbreviations("Aly", "Alley");
addAbbreviations("Alwy", "Alleyway");
addAbbreviations("Ambl", "Amble");
addAbbreviations("Apts", "Apartments");
addAbbreviations("Apch", "Approach");
addAbbreviations("Arc", "Arcade");
addAbbreviations("Artl", "Arterial");
addAbbreviations("Arty", "Artery");
addAbbreviations("Av", "Avenue");
addAbbreviations("Ave", "Avenue");
addAbbreviations("Bk", "Back");
addAbbreviations("Ba", "Banan");
addAbbreviations("Basn", "Basin");
addAbbreviations("Bsn", "Basin");
addAbbreviations("Bch", "Beach");
addAbbreviations("Bnd", "Bend");
addAbbreviations("Blk", "Block");
addAbbreviations("Bwlk", "Boardwalk");
addAbbreviations("Blvd", "Boulevard");
addAbbreviations("Bvd", "Boulevard");
addAbbreviations("Bdy", "Boundary");
addAbbreviations("Bl", "Bowl");
addAbbreviations("Br", "Brace", "Brae", "Bridge");
addAbbreviations("Brk", "Break");
addAbbreviations("Bdge", "Bridge");
addAbbreviations("Bri", "Bridge");
addAbbreviations("Bdwy", "Broadway");
addAbbreviations("Bway", "Broadway");
addAbbreviations("Bwy", "Broadway");
addAbbreviations("Brk", "Brook");
addAbbreviations("Brw", "brow");
addAbbreviations("Bldgs", "Buildings");
addAbbreviations("Bldngs", "Buildings");
//addAbbreviations("Bus", "Business");
addAbbreviations("Bps", "Bypass");
addAbbreviations("Byp", "Bypass");
addAbbreviations("Bypa", "Bypass");
addAbbreviations("Bywy", "Byway");
addAbbreviations("Cvn", "Caravan");
//addAbbreviations("Caus", "Causway");
addAbbreviations("Cswy", "Causeway");
addAbbreviations("Cway", "Causeway");
addAbbreviations("Cen", "Center", "Centre");
addAbbreviations("Ctr", "Center", "Centre");
addAbbreviations("Ctrl", "Central");
addAbbreviations("Cnwy", "Centreway");
addAbbreviations("Ch", "Chase", "Church");
addAbbreviations("Cir", "Circle");
addAbbreviations("Cct", "Circuit");
addAbbreviations("Ci", "Circuit");
addAbbreviations("Crc", "Circus");
addAbbreviations("Crcs", "Circus");
addAbbreviations("Cty", "City");
addAbbreviations("Cl", "Close");
addAbbreviations("Cmn", "Common");
addAbbreviations("Comm", "Common", "Community");
addAbbreviations("Cnc", "Concourse");
//addAbbreviations("Con", "Concourse");
addAbbreviations("Cps", "Copse");
addAbbreviations("Cnr", "Corner");
addAbbreviations("Crn", "Corner");
addAbbreviations("Cso", "Corso");
addAbbreviations("Cotts", "Cottages");
//addAbbreviations("Co", "County");
addAbbreviations("CR", "County Road", "County Route");
addAbbreviations("Crt", "Court");
addAbbreviations("Ct", "Court");
addAbbreviations("Cyd", "Courtyard");
addAbbreviations("Ctyd", "Courtyard");
addAbbreviations("Ce", "Cove");
addAbbreviations("Cov", "Cove");
// TODO add more
}
protected void checkForAbbreviations(Way way) {
for (Tag tag : way.getKeys().getTags()) {
if (tag.getKey().contains("name") && !tag.getKey().equals("int_name")) {
process(way, tag.getKey());
}
}
}
protected void process(Way way, String key) {
if (!way.hasKey(key)) return;
String name = way.get(key);
for (String[] keys : abbreviations.keySet()) {
String abbreviation = keys[0];
String position = keys[1];
Boolean found = false;
if (position.equals("unknown") && (name.matches(".*\\b" + abbreviation + "(\\b|\\.\\b).*")
|| name.matches(".*\\b" + abbreviation.replace(".", "") + "(\\b|\\.\\b).*"))) {
found = true;
} else if (position.equals("prefix") && (name.startsWith(abbreviation) || name.startsWith(abbreviation.replace(".", "").concat(" ")))) {
found = true;
} else if (position.equals("suffix") && (name.endsWith(abbreviation) || name.endsWith(" ".concat(abbreviation.replace(".", ""))))) {
found = true;
}
if (found) {
foundAbbreviation(way, key, abbreviation, position, abbreviations.get(keys));
break;
}
}
}
protected int countInstancesOf(String findIn, String find) {
int index = findIn.indexOf(find);
int count = 0;
while (index != -1) {
count++;
findIn = findIn.substring(index + 1);
index = findIn.indexOf(find);
}
return count;
}
protected void foundAbbreviation(Way way, String key, String abbreviation, String position, ArrayList<String> expansions) {
HashSet<String> arrayList = new HashSet<>();
arrayList.addAll(expansions);
if (!position.equals("unknown")) {
ArrayList<String> array = abbreviations.get(new String[] {abbreviation, "unknown"});
if (array != null) {
arrayList.addAll(array);
}
}
if (!position.equals("prefix")) {
ArrayList<String> array = abbreviations.get(new String[] {abbreviation, "prefix"});
if (array != null) {
arrayList.addAll(array);
}
}
if (!position.equals("postfix")) {
ArrayList<String> array = abbreviations.get(new String[] {abbreviation, "postfix"});
if (array != null) {
arrayList.addAll(array);
}
}
TestError.Builder testError = TestError.builder(this, Severity.WARNING, CONTAINS_ABBREVIATION)
.primitives(way)
.message(tr("kaart"), abbreviation.concat(tr(" is an abbreviation in \"")).concat(key).concat(tr("\", try expanding to one of the following: ")).concat(arrayList.toString()));
if (arrayList.size() == 1 && way.get(key).contains(abbreviation) && countInstancesOf(way.get(key), abbreviation) == 1) {
String replaceValue = way.get(key);
replaceValue = replaceValue.replace(abbreviation, expansions.get(0));
replaceValue = replaceValue.replace(expansions.get(0).concat("."), expansions.get(0));
final String rv = replaceValue;
testError.fix(() -> new ChangePropertyCommand(way, key, rv));
}
errors.add(testError.build());
}
}
|
tsmock/KaartValidatorPlugin
|
src/com/kaartgroup/kaartvalidator/validation/Abbreviations.java
|
2,251 |
/*
* Class used in order to connect the GUI part of the program
* with the database and vice versa. It provides methods for
* communication between both and also parses data so that they
* can be used correctly by both.
*
* Note: This class is to be used instead of URestController,
* while the last must not be used anywhere else in the program
*/
package application.functionality;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.simple.parser.ParseException;
import application.api.FAppointmentsResponse;
import application.api.FAvailabilityResponse;
import application.api.FLoginResponse;
import application.api.FProfessorsResponse;
import application.api.FSubjectsResponse;
import application.api.FUserInformationResponse;
import application.api.URestController;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.StageStyle;
public class GuiController {
private static GuiController gController = null;
public static GuiController getInstance() throws IOException, ParseException {
if (gController== null)
gController = new GuiController();
return gController;
}
// Class attributes
private URestController controller; // Not to be used by GUI.
private ArrayList<Course> allCourses;
private ArrayList<Professor> allProfessors;
private User user; // The logged in user's information.
public static final String dbURL = "https://nerdnet.geoxhonapps.com/cdn/profPhotos/";
public static final String Timezone = "GMT";
// Constructor:
private GuiController() throws IOException, ParseException {
controller = new URestController();
allCourses = new ArrayList<Course>();
allProfessors = new ArrayList<Professor>();
}
/*
* Method used to register user.
* In order for the registration to be successful the user needs to pass
* four String arguments: a username, a password, the name to be displayed
* to other users and an email (his academic email). It returns true if the
* registration was successful and false otherwise (described below).
*/
public boolean register(String username, String password, String displayName, String email, int orientation) throws IOException {
if (checkPassword(password).equals("correct"))
return controller.doRegister(username, password, displayName, email, orientation); // false if email incorrect or username already exists.
return false; // Password incorrect.
}
/*
* Method used for logging in.
* It returns true if the login was successful or false otherwise and
* gets two String objects as parameters. First is the username that the
* user who wants to login uses and second is the password linked to this
* username.
*/
public boolean login(String username, String password) throws IOException, ParseException {
FLoginResponse flr;
flr = controller.doLogin(username, password);
// Call one of the most important methods:
getAllProfessors(); // Users keep track of their appointments, though there is no such connection in the database.
if (flr.isSuccess) {
if (flr.accountType == 0) {
user = new Student(flr.userId, flr.username, flr.displayName, flr.orientation);
user.setEmail(controller.getUserProfile(user.getUserId()).email);
FUserInformationResponse userProfile = controller.getUserProfile(flr.userId);
String userBio = userProfile.bio;
user.setBio(userBio);
}
else {
user = getProfessorById(flr.associatedProfessorId);
user.setUserName(flr.username);
user.setUserId(flr.userId);
user.setOrientation(2);
user.setBio(controller.getUserProfile(user.getUserId()).bio);
}
}
return flr.isSuccess;
}
/*
* Method used to get all the Courses contained in the database.
* It returns an ArrayList consisting of Course objects and has
* no parameters.
*/
public ArrayList<Course> getAllCourses() throws IOException, ParseException{
ArrayList<FSubjectsResponse> fsr = controller.getAllSubjects();
// The first if statement is used to check if the user has already accessed the page
// for all courses. In that way we do not spend time refilling the array.
if (allCourses.size() != fsr.size()) {
allCourses.clear();
// The following part of the code is used to get the professors from the database
// This is done, in order to find out the Professor objects who teach each course
// (otherwise, only their professorId will be known to each Course object).
ArrayList<FProfessorsResponse> fpr = controller.getAllProfessors();
if (allProfessors.size() != fpr.size()) {
allProfessors.clear();
for (FProfessorsResponse i : fpr)
allProfessors.add(new Professor(i.name, i.id, i.email, i.profilePhoto, i.phone, i.office, i.rating, 2, i.bio));
}
// allProfessors, now contains all the professors contained in the database
for (FSubjectsResponse i : fsr)
allCourses.add(new Course(i.id, i.name, i.associatedProfessors, i.rating, i.semester, allProfessors, i.orientation));
}
// Filters courses by the orientation of the user.
if (user != null) {
if (user.getOrientation() == 2) {
return allCourses;
}
else {
ArrayList<Course> coursesByOrientation = new ArrayList<>();
for (Course c : allCourses) {
if (c.getOrientation() == user.getOrientation() || c.getOrientation() == 2) {
coursesByOrientation.add(c);
}
}
return coursesByOrientation;
}
}
else {
return allCourses;
}
}
/*
* Method used to get a Course object from allCourses ArrayList,
* by its id.
* It returns the course with the id (Integer) provided (as parameter),
* if found in the allCourses ArrayList.
* Note: Professors can not add new Courses in the database.
*/
public Course getCourseById(String courseId) throws IOException, ParseException {
for (Course course : allCourses) {
if (course.getId().equals(courseId)) {
return course;
}
}
return null;
}
/*
* Method used by students in order to enroll to a course.
* The method returns true only if the enrollment was successful.
* It returns false if the enrollment failed (student already enrolled)
* or because of the http request failure. It receives a String object,
* as parameter, representing the course's id
*/
public boolean courseEnrollment(String courseId) throws IOException, ParseException {
boolean success = controller.enrollSubject(courseId);
if (success)
user.addCourse(getCourseById(courseId));
return success;
}
/*
* Method used by students in order to disenroll from a course.
* The method returns true only if the disenrollment was successful.
* It returns false if the disenrollment failed (student not enrolled)
* or because of the http request failure. It receives a String object,
* as parameter, rrepresenting the course's id
*/
public boolean courseDisenrollment(String courseId) throws IOException, ParseException {
boolean success = controller.disenrollSubject(courseId);
if (success)
user.removeCourse(getCourseById(courseId));
return success;
}
/*
* Method used to provide access to the user's enrolled courses.
* It returns an ArrayList consisting of Course objects, which
* represent the ones that the user is enrolled to and receives
* no parameters.
*/
public ArrayList<Course> getEnrolledCourses() throws IOException, ParseException{
ArrayList<String> enrolledCourses = controller.getEnrolledSubjects();
// The first if statement is used to check if the user has already accessed the page
// for his courses. In that way we do not spend time gathering data from the database.
if (user.getMyCourses().size() != enrolledCourses.size()) {
user.clearMyCourses();
for (int i = 0; i < enrolledCourses.size(); i++)
for (int j = 0; j < allCourses.size(); j++)
if (enrolledCourses.get(i).equals(allCourses.get(j).getId()))
user.addCourse(allCourses.get(j));
}
return user.getMyCourses();
}
/*
* Method used for rating a Course, by students. It checks if
* the selected course is attended by the student and also updates
* attributes with new data.
* Returns true if the rating was successful and false if it was not
* (student already rated this course) or an error occurred on the side
* of the server. It receives an int type parameter (stars given to the course)
* and a Course object (the course being rated), as parameters.
*/
public boolean rateCourse(int stars, Course selectedCourse) throws IOException, ParseException {
boolean success = false;
int indexOfRatedCourse = 0;
// Checking if the course the Student chose to rate is attended by him
for (Course course : user.getMyCourses()) {
if (course.getId().equals(selectedCourse.getId())) {
success = controller.setSubjectRating(stars, selectedCourse.getId());
break;
}
indexOfRatedCourse++;
}
// Update data with new values if rating was successful
if (success) {
float rating = controller.getSubjectRating(selectedCourse.getId());
user.getMyCourses().get(indexOfRatedCourse).setRating(rating);
for (int i = 0; i < allCourses.size(); i++) {
if (allCourses.get(i).getId().equals(selectedCourse.getId())) {
allCourses.get(i).setRating(rating);
break;
}
}
}
return success;
}
/*
* Method used to get the total rating of a selected course.
* It returns a float object representing the total rating of the selected course
* and gets a Course object as parameter which represents the selected course.
*/
public float getCourseRating(Course selectedCourse) throws IOException, ParseException {
return controller.getSubjectRating(selectedCourse.getId());
}
/*
* Method used to get the stars of a selected course, which a student gave to it.
* It returns a float object representing the stars of the selected course given by the user
* and gets a Course object as parameter which represents the selected course.
*/
public int getMyCourseRating(Course selectedCourse) throws IOException, ParseException {
return controller.getMySubjectRating(selectedCourse.getId());
}
/*
* Method used to get the ECTS provided by a course.
* It returns an integer object which represents the course's
* ECTS and gets a Course object as a parameter, which defines
* the selected course.
*/
public int getCourseECTS(Course selectedCourse) {
return selectedCourse.getECTS();
}
/*
* Method used to get the semester a course belongs to.
* It returns an int type variable (the course's semester)
* and receives a Course object (the selected course).
*/
public int getCourseSemester(Course selectedCourse) {
return selectedCourse.getSemester();
}
/*
* Method used to get all the professors currently teaching at the University.
* It returns an ArrayList consisting of Professor objects and gets no
* parameters.
*/
public ArrayList<Professor> getAllProfessors() throws IOException, ParseException{
ArrayList<FProfessorsResponse> fpr = controller.getAllProfessors();
getAllCourses(); // Fill allCourses, if it is empty. Used for finding the courses each professor teaches.
allProfessors.clear();
for (FProfessorsResponse i : fpr)
allProfessors.add(new Professor(i.name, i.id, i.email, i.profilePhoto, i.phone, i.office, i.rating, 2, i.bio));
// This part returns the courses each professor teaches.
for (Professor professor : allProfessors)
professor.getCoursesTaught(allCourses);
return allProfessors;
}
/*
* Method used to get a professor, from allProfessors list by his id.
* It returns the professor found and receives an type parameter
* representing the professor's id.
*/
public Professor getProfessorById(int professorId) throws IOException, ParseException {
for (Professor professor : allProfessors) {
if (professor.getProfessorId() == professorId) {
return professor;
}
}
return null;
}
/*
* Method used to rate a professor, that is selected by a student.
* It returns true if the operation was successful and false otherwise
* (server failed to respond or student already rated this professor)
* and receives an int type (starts given by the student to the professor) and
* Professor object (the professor being rated) as parameters.
*/
public boolean rateProfessor(int stars, Professor selectedProfessor) throws IOException, ParseException {
boolean success = false;
int indexOfRatedProfessor = 0;
for (Professor professor : allProfessors) {
if (professor.getProfessorId() == selectedProfessor.getProfessorId()) {
success = controller.setProfessorRating(stars, selectedProfessor.getProfessorId());
break;
}
indexOfRatedProfessor++;
}
// Update data with new values if rating was successful
if (success) {
float rating = controller.getProfessorRating(selectedProfessor.getProfessorId());
allProfessors.get(indexOfRatedProfessor).setRating(rating);
}
return success;
}
/*
* Method used to get the total rating of a professor.
* It returns a float type variable (the professor's total rating)
* and receives a Professor object (the selected professor), as parameter.
*/
public float getProfessorRating(Professor selectedProfessor) throws IOException, ParseException {
return controller.getProfessorRating(selectedProfessor.getProfessorId());
}
/*
* Method used to get the rating given by the student to a professor.
* It returns a int type variable (the stars given to the professor by the student)
* and receives a Professor object (the selected professor), as parameter.
*/
public int getMyProfessorRating(Professor selectedProfessor) throws IOException, ParseException {
return controller.getMyProfessorRating(selectedProfessor.getProfessorId());
}
/*
* Method used by professors, in order to set an available date for appointments with
* students.
* It returns true, only if the operation and the connection were successful and false
* if the operation failed or the server failed to respond correctly and receives three
* int type variables as parameters (the day, the starting hour and the ending hour, that
* the professor will be available for appointments).
*/
public boolean setAvailableTimeslot(int day, int startHour, int endHour) throws IOException, ParseException {
boolean success = false;
if(user instanceof Professor)
success = controller.setAvailabilityDates(day, startHour, endHour);
if (success) {
Professor professor = (Professor) user;
getAvailableTimeslots(getProfessorById(professor.getProfessorId()));
}
return success;
}
/*
* Method used for getting the dates that a professor is available for an appointment
* with a student. It uses the professor's unique id in order to locate the professor.
* It returns an ArrayList containing Timeslot objects (the dates that the selected
* professor is available for appointments) and receives a Professor object, representing
* the selected professor.
*/
public ArrayList<Timeslot> getAvailableTimeslots(Professor selectedProfessor) throws IOException, ParseException {
ArrayList<Timeslot> requested = getMyAppointments();
ArrayList<Timeslot> reserved = getReservedTimeslots(selectedProfessor);
Calendar nextAvailableDate = Calendar.getInstance(TimeZone.getTimeZone(Timezone)); // Next date the professor set as available
Date availableDateStart; // For temporary storage and parsing of data to a Date object
Date availableDateEnd;
int i = 0;
int weekday;
boolean firstAvailableDayOfWeekFound = false; // This is set to true only when the Calendar instance matches with a day contained in far.dates.
FAvailabilityResponse far = controller.getAvailabilityDates(selectedProfessor.getProfessorId());
if (far.dates.isEmpty())
return null;
allProfessors.get(selectedProfessor.getProfessorId() - 1).clearTimeslots();
// Here the Integer data, will be converted into a date timestamp, with the
// help of the the Calendar and Date Java classes and will be used to create
// available Timeslot objects
while (i < 7) {
HashMap<String, Integer> dateToRemove = new HashMap<String, Integer>(); // The date that is already parsed into timeslots is removed.
// to avoid duplicates
weekday = (nextAvailableDate.get(Calendar.DAY_OF_WEEK) - 1);
for (HashMap<String, Integer> date : far.dates) {
if (weekday == date.get("day")) {
firstAvailableDayOfWeekFound = true;
nextAvailableDate.set(Calendar.HOUR_OF_DAY, date.get("startHour"));
nextAvailableDate.set(Calendar.MINUTE, 0);
nextAvailableDate.set(Calendar.SECOND, 0);
nextAvailableDate.set(Calendar.MILLISECOND, 0);
availableDateStart = nextAvailableDate.getTime();
nextAvailableDate.set(Calendar.HOUR_OF_DAY, date.get("endHour"));
nextAvailableDate.set(Calendar.MINUTE, 0);
nextAvailableDate.set(Calendar.SECOND, 0);
nextAvailableDate.set(Calendar.MILLISECOND, 0);
availableDateEnd = nextAvailableDate.getTime();
dateToRemove = date;
selectedProfessor.addTimeslot(availableDateStart.getTime(), availableDateEnd.getTime(), requested, reserved);
}
}
far.dates.remove(dateToRemove);
if (firstAvailableDayOfWeekFound)
i++;
nextAvailableDate.add(Calendar.DAY_OF_YEAR, 1);
}
allProfessors.set((selectedProfessor.getProfessorId() - 1), selectedProfessor);
return selectedProfessor.getTimeslots();
}
/*
* Method used by students to request an appointment with a selected professor
* at a selected timeslot.
* It returns true if the operation was successful and the server responded correctly
* or false if the operation failed or the server did not respond correctly.
* It receives a Professor object and a Timeslot object (selected Timeslot)
* as parameters.
*/
public boolean requestAppointment(Professor selectedProfessor, Timeslot timeslot) throws IOException, ParseException {
ArrayList<Timeslot> requestedAppointments = getMyAppointments();
boolean success = false;
if (user instanceof Student) {
success = controller.bookAppointment(selectedProfessor.getProfessorId(), timeslot.getStartHourTimestamp());
System.out.println(success);
// Check if server responded correctly
if (success)
for (Timeslot requested : requestedAppointments)
if (requested.getProfessorId() == selectedProfessor.getProfessorId())
success = false; // Student already requested.
// Check if already requested appointment with this professor.
if (success)
selectedProfessor.addRequestedAppointment(timeslot);
}
return success;
}
/*
* Method used to get a user's requested and cancelled appointments.
* It returns an ArrayList of Timeslot objects, represenitng the user
* requested and cancelled appointments.
* Note, that it can be used by both students and professors.
*/
public ArrayList<Timeslot> getMyAppointments() throws IOException, ParseException {
ArrayList<FAppointmentsResponse> far = controller.getMyAppointments();
user.clearRequestedAppointments();
for (FAppointmentsResponse timeslotParser : far)
if(timeslotParser.status != 2)
user.addRequestedAppointment(new Timeslot(timeslotParser.id, timeslotParser.studentId, timeslotParser.professorId, timeslotParser.dateTimestamp, (timeslotParser.dateTimestamp + 1800), timeslotParser.status, timeslotParser.created_at));
return user.getRequestedAppointments();
}
/*
* Method used by professor users to accept a request for appointment.
* It returns true if the operation was successful and the server responded
* correctly and false if the operation failed or the server did not
* respond correctly. It receives a Timeslot object (the request of appointment),
* as parameter.
*/
public boolean acceptAppointmentRequest(Timeslot requestedAppointment) throws IOException {
if (user instanceof Professor)
return controller.acceptAppointment(requestedAppointment.getId());
return false;
}
/*
* Method used by users to reject/cancel a request for appointment.
* It returns true if the operation was successful and the server responded
* correctly and false if the operation failed or the server did not
* respond correctly. It receives a Timeslot object (the request of appointment),
* as parameter.
*/
public boolean rejectAppointmentRequested(Timeslot requestedAppointment) throws IOException {
return controller.cancelAppointment(requestedAppointment.getId());
}
/*
* Method used to get the reserved and requested appointments of a professor
* It returns an ArrayList of Timeslot objects and receives a Professor parameter.
*/
public ArrayList<Timeslot> getReservedTimeslots(Professor selectedProfessor) throws IOException, ParseException{
ArrayList<Integer> reservedStartingTimestamps = controller.getBookedTimestamps(selectedProfessor.getProfessorId());
selectedProfessor.clearReservedAppointments();
for (Integer timestamp : reservedStartingTimestamps) {
selectedProfessor.addReservedAppointment(new Timeslot(timestamp, timestamp + 1800, 1));
user.addReservedAppointment(new Timeslot(timestamp, timestamp + 1800, 1));
}
return user.getReservedAppointments();
}
/*
* Method used to change a users display name.
* It returns true if the operation was successful and the server responded correctly
* and false if the the operation failed or the server did not respond correctly.
* It receives a String object as parameter (the new display name).
*/
public boolean setDisplayName(String newDisplayName) throws IOException {
boolean success = controller.setDisplayName(newDisplayName);
if (success)
user.setDisplayName(newDisplayName);
return success;
}
/*
*Method used to set a Bio for the user
* It returns true if the operation was successful and the server responded correctly
* and false if the the operation failed or the server did not respond correctly.
* It receives a String object as parameter (the new bio).
*/
public boolean setBio(String bio) throws IOException {
if (bio.length() <= 300)
if (controller.setBio(bio)) {
user.setBio(bio);
return true;
}
return false;
}
/*
* Method used to change a user's password.
* It returns a String object representing the success or not
* and receives two String objects as parameters (the new and
* old passwords).
*/
public String changePassword(String oldPassword, String newPassword) throws IOException {
String isCorrect = "correct";
String message = checkPassword(newPassword);
if (message.equals(isCorrect)) {
if (controller.setPassword(oldPassword, newPassword))
return "Ο κωδικός ενημερώθηκε επιτυχώς!";
else
return "Ο παλιός κωδικός δεν είναι έγκυρος!";
}
return message;
}
public User getUser() {
return user;
}
/*
* Method for checking if the inputed password has been written according to our password pattern.
* checkPassword, receives a String object (new password inputed by the user), as a
* parameter and returns a String object representing the success or not of the operation.
* Some of the following code is product of others. Sources follow:
*
* Code for password checking found here: https://stackoverflow.com/a/41697673 and modified
* to check if there is at least one upper and one lower letter
* Pattern documentation: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
*/
public String checkPassword(String newPassword) {
// Password verification begins here:
if(newPassword.length()>=8) {
Pattern upperLetter = Pattern.compile("[A-Z]");
Pattern lowerLetter = Pattern.compile("[a-z]");
Pattern digit = Pattern.compile("[0-9]");
Pattern special = Pattern.compile ("[!@#$%&*()_+=|<>?{}~-]");
// The above code serves as our password pattern
Matcher hasUpperLetter = upperLetter.matcher(newPassword);
Matcher hasLowerLetter = lowerLetter.matcher(newPassword);
Matcher hasDigit = digit.matcher(newPassword);
Matcher hasSpecial = special.matcher(newPassword);
String passwordErrors = "Ο νέος κωδικός θα πρέπει να περιέχει:";
boolean validPassword = true;
if (!hasUpperLetter.find()) {
passwordErrors += "\n- τουλάχιστον ένα κεφαλαίο χαρακτήρα";
validPassword = false;
}
if (!hasLowerLetter.find()) {
passwordErrors += "\n- τουλάχιστον ένα πεζό χαρακτήρα";
validPassword = false;
}
if (!hasDigit.find()) {
passwordErrors += "\n- τουλάχιστον ένα ψηφίο";
validPassword = false;
}
if (!hasSpecial.find()) {
passwordErrors += "\n- τουλάχιστον έναν ειδικό χαρακτήρα";
validPassword = false;
}
if (validPassword)
return "correct";
else
return passwordErrors;
}
else {
return "Ο νέος κωδικός πρέπει να έχει μέγεθος τουλάχιστον 8 χαρακτήρων!";
}
}
public void alertFactory(String header, String content) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle(null);
alert.setHeaderText(header);
alert.setContentText(content);
alert.initStyle(StageStyle.UTILITY);
alert.showAndWait();
}
}
|
Nerdwork-Team/Nerdwork-Project
|
Nerdwork/src/application/functionality/GuiController.java
|
2,254 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.net.URL;
public class Example4 {
public static void main(String[] args) throws Exception {
URL url1 = new URL("http://server.com/mp3s/test1.mp3");
URL url2 = new URL("http://server.com/mp3s/test2.mp3");
URL url3 = new URL("http://server.com/mp3s/test3.mp3");
new MP3Player(url1, url2, url3).play();
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example4.java
|
2,255 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.io.File;
public class Example3 {
public static void main(String[] args) throws Exception {
File file1 = new File("test1.mp3");
File file2 = new File("test2.mp3");
File file3 = new File("test3.mp3");
new MP3Player(file1, file2, file3).play();
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example3.java
|
2,256 |
package gr.aueb.softeng.view.SignUp.SignUpPersonel;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.util.HashMap;
import gr.aueb.softeng.team08.R;
/**
*Η κλάση αυτή καλείται όταν πηγαίνει να προστεθεί νέος μάγειρας στην εφαρμογή
*/
public class SignUpPersonelActivity extends AppCompatActivity implements SignUpPersonelView {
/**
* Εμφανίζει ενα μήνυμα τύπου alert με
* τίτλο title και μήνυμα message.
* @param title Ο τίτλος του μηνύματος
* @param message Το περιεχόμενο του μηνύματος
*/
public void showErrorMessage(String title, String message)
{
new AlertDialog.Builder(SignUpPersonelActivity.this)
.setCancelable(true)
.setTitle(title)
.setMessage(message)
.setPositiveButton("OK", null).create().show();
}
/**
* Εμφανίζει μήνυμα επιτυχίας όταν ο μάγειρας δημιουργήσει επιτυχώς τον λογαριασμό του
* και επιστρέφει στο προηγούμενο ακτίβιτι όταν πατηθεί το κουμπί ΟΚ
*/
@Override
public void showAccountCreatedMessage()
{
new AlertDialog.Builder(SignUpPersonelActivity.this)
.setCancelable(true)
.setTitle("Επιτυχής δημιουργία λογαριασμού")
.setMessage("Ο λαγαριασμος δημιουργήθηκε με επιτυχία")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
}).create().show();
}
private static boolean initialized = false;
/**
* Δημιουργει το layout και αρχικοποιεί το activity
* Αρχικοποιούμε το view Model και περνάμε στον presenter το view
* Καλούμε τα activities όταν πατηθούν τα κουμπιά της οθόνης
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in {@link #onSaveInstanceState}. <b><i>Note: Otherwise it is null.</i></b>
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_sign_up_personel);
SignUpPersonelViewModel viewModel = new ViewModelProvider(this).get(SignUpPersonelViewModel.class);
viewModel.getPresenter().setView(this);
if (savedInstanceState == null) {
Intent intent = getIntent();
}
findViewById(R.id.createAccButton).setOnClickListener(new View.OnClickListener(){ // το κουμπί δημιουργίας του account
@Override
public void onClick(View v){
viewModel.getPresenter().onCreateChefAccount();
}
});
findViewById(R.id.gobackButton3).setOnClickListener(new View.OnClickListener(){ // το κουμπί επιστροφής στην προηγόυμενη οθόνη
@Override
public void onClick(View v){
viewModel.getPresenter().onBack();
}
});
}
/**
* Δημιουργεί ένα hash map στο οποίο έχουμε σαν κλειδί την περιγραφή πχ άν είναι username ή τηλέφωνο του μάγειρα
* και σαν value έχουμε την τιμή του κλειδιού την οποία παίρνουμε απο την οθόνη που έχει περάσει ο μάγειρας τα στοιχεία εγγραφής του
* @return Επιστρέφουμε το Hash Map αυτό με τα δεδομένα της οθόνης
*/
public HashMap<String,String> getChefDetails(){
HashMap<String,String> details = new HashMap<>();
details.put("name",(((EditText)findViewById(R.id.ChefNameText)).getText().toString().trim()));
details.put("surname",(((EditText)findViewById(R.id.ChefSurnameText)).getText().toString().trim()));
details.put("username",(((EditText)findViewById(R.id.ChefUsernameText)).getText().toString().trim()));
details.put("email",(((EditText)findViewById(R.id.ChefEmailText)).getText().toString().trim()));
details.put("telephone",(((EditText)findViewById(R.id.ChefTelephoneText)).getText().toString().trim()));
details.put("iban",(((EditText)findViewById(R.id.ChefIbanText)).getText().toString().trim()));
details.put("tin",(((EditText)findViewById(R.id.ChefTinText)).getText().toString().trim()));
details.put("password",(((EditText)findViewById(R.id.ChefPasswordText)).getText().toString().trim()));
return details;
}
/**
* Καλείται για να επιστρέψουμε στο προηγούμενο Activity
*/
public void goBack(){
finish();
}
}
|
vleft02/Restaurant-Application
|
app/src/main/java/gr/aueb/softeng/view/SignUp/SignUpPersonel/SignUpPersonelActivity.java
|
2,257 |
package gr.aueb.softeng.view.SignUp.SignUpCustomer;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;
import java.util.HashMap;
import gr.aueb.softeng.team08.R;
/**
* Η κλάση αυτή καλείται όταν πατηθεί να προστεθεί νέος πελάτης στο σύστημα
*/
public class SignUpCustomerActivity extends AppCompatActivity implements SignUpCustomerView {
/**
* Εμφανίζει ενα μήνυμα τύπου alert με
* τίτλο title και μήνυμα message.
* @param title Ο τίτλος του μηνύματος
* @param message Το περιεχόμενο του μηνύματος
*/
public void showErrorMessage(String title, String message)
{
new AlertDialog.Builder(SignUpCustomerActivity.this)
.setCancelable(true)
.setTitle(title)
.setMessage(message)
.setPositiveButton("OK", null).create().show();
}
/**
* Εμφανίζει μήνυμα επιτυχίας όταν ο πελάτης δημιουργήσει επιτυχώς τον λογαριασμό του
* και επιστρέφει στο προηγούμενο ακτίβιτι όταν πατηθεί το κουμπί ΟΚ
*/
public void showAccountCreatedMessage()
{
new AlertDialog.Builder(SignUpCustomerActivity.this)
.setCancelable(true)
.setTitle("Επιτυχής δημιουργία λογαριασμού")
.setMessage("Ο λαγαριασμός δημιουργήθηκε με επιτυχία")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
}).create().show();
}
private static boolean initialized = false;
/**
* Δημιουργει το layout και αρχικοποιεί το activity
* Αρχικοποιούμε το view Model και περνάμε στον presenter το view
* Καλούμε τα activities όταν πατηθούν τα κουμπιά της οθόνης
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in {@link #onSaveInstanceState}. <b><i>Note: Otherwise it is null.</i></b>
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_sign_up);
SignUpCustomerViewModel viewModel = new ViewModelProvider(this).get(SignUpCustomerViewModel.class);
viewModel.getPresenter().setView(this);
if (savedInstanceState == null){
Intent intent = getIntent();
}
findViewById(R.id.CreateAccButton).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
viewModel.getPresenter().onCreateAccount();//μέθοδος που καλείται όταν είναι να δημιουργηθεί το account του χρήστη
}
});
findViewById(R.id.gobackButton).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
viewModel.getPresenter().onBack();
} // μέθοδος επιστροφής στην προηγούμενη οθόνη
});
}
/**
* Δημιουργεί ένα hash map στο οποίο έχουμε σαν κλειδί την περιγραφή πχ άν είναι username ή τηλέφωνο του πελάτη
* και σαν value έχουμε την τιμή του κλειδιού την οποία παίρνουμε απο την οθόνη που έχει περάσει ο πελάτης τα στοιχεία εγγραφής του
* @return Επιστρέφουμε το Hash Map αυτό με τα δεδομένα της οθόνης
*/
public HashMap<String,String> getDetails(){
HashMap<String,String> details = new HashMap<>();
details.put("name",(((EditText)findViewById(R.id.CustomerNameText)).getText().toString().trim()));
details.put("surname",(((EditText)findViewById(R.id.CustomerSurnameText)).getText().toString().trim()));
details.put("username",(((EditText)findViewById(R.id.CustomerUsernameText)).getText().toString().trim()));
details.put("email",(((EditText)findViewById(R.id.CustomerEmailText)).getText().toString().trim()));
details.put("telephone",(((EditText)findViewById(R.id.CustomerTelephoneText)).getText().toString().trim()));
details.put("cardNumber",(((EditText)findViewById(R.id.CardNumberText)).getText().toString().trim()));
details.put("cardHolderName",(((EditText)findViewById(R.id.CardHolderNameText)).getText().toString().trim()));
details.put("cvv",(((EditText)findViewById(R.id.CVVText)).getText().toString().trim()));
details.put("password",(((EditText)findViewById(R.id.CustomerPasswordText)).getText().toString().trim()));
return details;
}
/**
* Καλείται για να επιστρέψουμε στο προηγούμενο Activity
*/
public void goBack(){
finish();
}
}
|
vleft02/Restaurant-Application
|
app/src/main/java/gr/aueb/softeng/view/SignUp/SignUpCustomer/SignUpCustomerActivity.java
|
2,258 |
package gr.acmefood.bootstrap;
import gr.acmefood.base.BaseComponent;
import gr.acmefood.domain.*;
import gr.acmefood.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.PropertyResourceBundle;
@Component
@RequiredArgsConstructor
public class SampleDataGenerator extends BaseComponent implements CommandLineRunner {
private final ProductCategoryService productCategoryService;
private final StoreCategoryService storeCategoryService;
private final AccountService accountService;
private final StoreService storeService;
@Override
public void run(String... args) throws Exception {
//formatter:off
ProductCategory productCategory1 = productCategoryService.create(ProductCategory.builder().name("Drink").build());
ProductCategory productCategory2 = productCategoryService.create(ProductCategory.builder().name("Food").build());
ProductCategory productCategory3 = productCategoryService.create(ProductCategory.builder().name("Groceries").build());
ProductCategory productCategory4 = productCategoryService.create(ProductCategory.builder().name("Coffee").build());
ProductCategory productCategory5 = productCategoryService.create(ProductCategory.builder().name("Alcohol").build());
// STORE CATEGORIES
List<StoreCategory> storeCategories = List.of(
StoreCategory.builder().name("Pizza")
.imgUrl("assets/img/service/final/1.png").build(),
StoreCategory.builder().name("Souvlaki")
.imgUrl("assets/img/service/final/7.png").build(),
StoreCategory.builder().name("Burger")
.imgUrl("assets/img/service/final/10.png").build(),
StoreCategory.builder().name("Coffee")
.imgUrl("assets/img/service/final/3.png").build(),
StoreCategory.builder().name("Chinese")
.imgUrl("assets/img/service/final/4.png").build(),
StoreCategory.builder().name("Pasta")
.imgUrl("assets/img/service/final/5.png").build(),
StoreCategory.builder().name("Vegetarian")
.imgUrl("assets/img/service/final/11.png").build(),
StoreCategory.builder().name("Mexican")
.imgUrl("assets/img/service/final/6.png").build(),
StoreCategory.builder().name("Homemade")
.imgUrl("assets/img/service/final/12.png").build(),
StoreCategory.builder().name("Sweet")
.imgUrl("assets/img/service/final/8.png").build(),
StoreCategory.builder().name("Groceries")
.imgUrl("assets/img/service/final/9.png").build(),
StoreCategory.builder().name("Sushi")
.imgUrl("assets/img/service/final/2.png").build()
);
storeCategoryService.createAll(storeCategories);
// Accounts
Account account1 = Account.builder().
username("vrail")
.password("pass")
.email("[email protected]")
.phone("69584475214")
.fName("Euagelos")
.lName("Vrailas").age(22).build();
Account account2 = Account.builder()
.username("angkaps")
.password("pass")
.email("[email protected]")
.phone("69715812302")
.fName("Angelos")
.lName("Kapsouros").age(24).build();
Account account3 = Account.builder()
.username("Enjoy")
.password("password")
.email("[email protected]")
.phone("6971548869")
.fName("Georgia")
.lName("Saina").age(21).build();
Account account4 = Account.builder()
.username("Joey").password("P@ssw0rd")
.email("[email protected]")
.phone("697567887902")
.fName("George")
.lName("Chatidakis")
.age(35).build();
Account account5 = Account.builder()
.username("chatzi")
.password("p@@@555sssw0rDD")
.email("[email protected]")
.phone("6972387923")
.fName("Stefan")
.lName("Bordea").age(22).build();
Account account6 = Account.builder()
.username("stef")
.password("qwerty213")
.email("[email protected]")
.phone("69844814485")
.fName("George")
.lName("Theofanous").age(21).build();
// Burger stores
Store burgerStore1 = Store.builder()
.name("Butcher's Burger & steak house ")
.storeCategory(storeCategories.get(2))
.address("ΒΕΪΚΟΥ 43")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store burgerStore2 = Store.builder()
.name(" Hot hot burger")
.storeCategory(storeCategories.get(2))
.address(" Βρυούλων 3")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store burgerStore3 = Store.builder()
.name("1933 Burgers ")
.storeCategory(storeCategories.get(2))
.address("Λεωφ. Δεκελείας 10 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected] ")
.build();
Store burgerStore4 = Store.builder()
.name(" Μπαρ μπεε κιου")
.storeCategory(storeCategories.get(2))
.address("Λ.ΔΕΚΕΛΕΙΑΣ 106, Νέα Φιλαδέλφεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store burgerStore5 = Store.builder()
.name("Goody's Burger House ")
.storeCategory(storeCategories.get(2))
.address("ΔEKEΛEIΑΣ 100, Νέα Φιλαδέλφεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected] ")
.build();
Store burgerStore6 = Store.builder()
.name(" Μέθεξη")
.storeCategory(storeCategories.get(2))
.address(" Νεότητος 2, Νέο Ηράκλειο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected] ")
.build();
Store burgerStore7 = Store.builder()
.name("Σάββας κεμπάπ")
.storeCategory(storeCategories.get(7))
.address("Λεωφόρος Δεκελείας 80,")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store burgerStore8 = Store.builder()
.name("The Bronx Cantina")
.storeCategory(storeCategories.get(2))
.address("Boloυ 12 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
// COFFEE stores
Store coffeeStore1 = Store.builder()
.name("Coffee Science ")
.storeCategory(storeCategories.get(3))
.address("Λεωφόρος Ιωνίας 233")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store coffeeStore2 = Store.builder()
.name(" ST COFFEE ")
.storeCategory(storeCategories.get(3))
.address("Αγίων Αναργύρων 35")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore3 = Store.builder()
.name("KAME HOUSE")
.storeCategory(storeCategories.get(3))
.address(" Λασκαράτου 11 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore4 = Store.builder()
.name(" IL Toto Roastery ")
.storeCategory(storeCategories.get(3))
.address("28ης Οκτωβρίου 347")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store coffeeStore5 = Store.builder()
.name(" Coffee Berry ")
.storeCategory(storeCategories.get(3))
.address(" Χαλκίδος 2, ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore6 = Store.builder()
.name("Coffee Lab ")
.storeCategory(storeCategories.get(3))
.address(" Δεκελείας 114 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store coffeeStore7 = Store.builder()
.name("Mikel")
.storeCategory(storeCategories.get(3))
.address(" ΠΙΝΔΟΥ 1 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore8 = Store.builder()
.name("Γρηγόρης")
.storeCategory(storeCategories.get(3))
.address("Αλεξάνδρου 50")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store coffeeStore9 = Store.builder()
.name(" Nine Grams ")
.storeCategory(storeCategories.get(3))
.address(" Δεκελείας 110, ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected] ")
.build();
Store coffeeStore10 = Store.builder()
.name(" Libertine ")
.storeCategory(storeCategories.get(3))
.address("ΔΕΚΕΛΕΙΑΣ 114")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore11 = Store.builder()
.name("Uggla")
.storeCategory(storeCategories.get(3))
.address(" ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore12 = Store.builder()
.name(" Coffee Island ")
.storeCategory(storeCategories.get(3))
.address("Πατησίων 378 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@2x1645628107_coffee-island-new.jpg")
.build();
Store coffeeStore13 = Store.builder()
.name(" Bread & Cup ")
.storeCategory(storeCategories.get(3))
.address(" Αλεξάνδρου 50 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected] ")
.build();
Store coffeeStore14 = Store.builder()
.name("EVEREST")
.storeCategory(storeCategories.get(3))
.address(" Αλεξάνδρου 50 ")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected] ")
.build();
// Souvlaki stores
Store st1 = Store.builder().name("ΑΥΘΕΝΤΙΚΟΝ")
.storeCategory(storeCategories.get(1))
.address("Λεωφ. Δεκελείας 29,")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st2 = Store.builder().name("Οι Σουβλάκες")
.storeCategory(storeCategories.get(1))
.address("Λεωφόρος Δεκελείας 57")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st3 = Store.builder().name("H Πόλη")
.storeCategory(storeCategories.get(1))
.address("Λ. Δεκελείας 130")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st4 = Store.builder().name("Evripidis Grill")
.storeCategory(storeCategories.get(1))
.address("Λεωφόρος Δεκελείας 83")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st5 = Store.builder().name("Μπάρμπα Αλέξης")
.storeCategory(storeCategories.get(1))
.address("Σαλαμίνος 70")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store st6 = Store.builder().name("Άγραφα 1977")
.storeCategory(storeCategories.get(1))
.address("Τσούντα 49,")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st7 = Store.builder().name("Πιτο...μπερδέματα")
.storeCategory(storeCategories.get(1))
.address("Λεωφόρος Ηρακλείου 252")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st8 = Store.builder().name("Ο Δήμος")
.storeCategory(storeCategories.get(1))
.address("Σαρδέων 4")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st9 = Store.builder().name("Σάββας κεμπάπ")
.storeCategory(storeCategories.get(1))
.address("Λεωφόρος Δεκελείας 80,")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st10 = Store.builder().name("Ψητό Γεύσεις")
.storeCategory(storeCategories.get(1))
.address("Καυταντζόγλου 7")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store st11 = Store.builder().name("Της πόλης το γυροτεχνείο")
.storeCategory(storeCategories.get(1))
.address("Πίνδου 47,")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store st12 = Store.builder().name("ΑΥΘΕΝΤΙΚΟΝ")
.storeCategory(storeCategories.get(1))
.address("Δεκελείας 9,")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
// Pizza stores
Store pizzaStore1 = Store.builder().name("Romano Pizza").storeCategory(storeCategories.get(0))
.address("Λεωφόρος Ηρακλείου 159")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store pizzaStore2 = Store.builder().name("Το Πεινιρλί της Φιλαδέλφειας").storeCategory(storeCategories.get(0))
.address("Δεκελείας 74, Νέα Φιλαδέλφεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store pizzaStore3 = Store.builder().name("Pizza Antonio").storeCategory(storeCategories.get(0))
.address("Λεωφόρος Ανδρέα Παπανδρέου 80, Ίλιον")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore4 = Store.builder().name("Reception").storeCategory(storeCategories.get(0))
.address("ΠΑΥΛΟΥ ΝΙΡΒΑΝΑ 85, Κάτω Πατήσια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore5 = Store.builder().name("ALL DAY").storeCategory(storeCategories.get(0))
.address("Λ. ΗΡΑΚΛΕΙΟΥ 387, Νέο Ηράκλειο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore6 = Store.builder().name("Royal Pizza").storeCategory(storeCategories.get(0))
.address("Μεσολογγίου 4, Νέα Ιωνία")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store pizzaStore7 = Store.builder().name("Da Vinci").storeCategory(storeCategories.get(0))
.address("Νάξου 22, Άγιος Λουκάς")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store pizzaStore8 = Store.builder().name("Buono Gusto").storeCategory(storeCategories.get(0))
.address("Γεωργούλια 6, Άνω Πατήσια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore9 = Store.builder().name("Oh mama mia").storeCategory(storeCategories.get(0))
.address("Πευκών 8, Νέο Ηράκλειο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore10 = Store.builder().name("Pizza picasso").storeCategory(storeCategories.get(0))
.address("Ι. Δροσοπούλου 256, Άνω Πατήσια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore11 = Store.builder().name("Pizza l' artigiano").storeCategory(storeCategories.get(0))
.address("Λ. ΔΕΚΕΛΕΙΑΣ 3, Νέα Φιλαδέλφεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pizzaStore12 = Store.builder().name("Milano pizza").storeCategory(storeCategories.get(0))
.address("Αγνώστων Ηρώων 61, Νέα Ιωνία")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store chineseStore1 = Store.builder().name("Athenian China Town").storeCategory(storeCategories.get(4))
.address("Φειδιππίδου 27, Γουδή")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store chineseStore2 = Store.builder().name("China City").storeCategory(storeCategories.get(4))
.address("ΚΕΑΣ 54, Άγιος Λουκάς")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store chineseStore3 = Store.builder().name("China Wok Time").storeCategory(storeCategories.get(4))
.address("Μιχαλακοπούλου 199, Γουδή")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store chineseStore4 = Store.builder().name("Mad Wok").storeCategory(storeCategories.get(4))
.address("Λένορμαν 167, Ακαδημία Πλάτωνος")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store chineseStore5 = Store.builder().name("KAZE SUSHI").storeCategory(storeCategories.get(4))
.address("Φειδιππίδου 27, Μαρούσι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store chineseStore6 = Store.builder().name("Sticky Rice").storeCategory(storeCategories.get(4))
.address("ΕΡΜΟΥ 104, Μοναστηράκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store chineseStore7 = Store.builder().name("Chunxi").storeCategory(storeCategories.get(4))
.address("Όθωνος 10, Σύνταγμα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store chineseStore8 = Store.builder().name("So So So ").storeCategory(storeCategories.get(4))
.address("ΝΟΡΜΑΝΟΥ 7, Θησείο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore1 = Store.builder().name("Extra Meal").storeCategory(storeCategories.get(5))
.address("Τριπόλεως 46, Άγιοι Ανάργυροι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store pastaStore2 = Store.builder().name("ΕΥΡΟΜΑΓΕΙΡΑΣ").storeCategory(storeCategories.get(5))
.address("ΝΙΚ. ΚΑΖΑΝΤΖΑΚΗ 35, Άγιοι Ανάργυροι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore3 = Store.builder().name("CULTO").storeCategory(storeCategories.get(5))
.address("Λασκαράτου 13, Αθήνα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore4 = Store.builder().name("Marko Pasta").storeCategory(storeCategories.get(5))
.address("Λυκούργου 1, Αθήνα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore5 = Store.builder().name("Ο Κιοφτές").storeCategory(storeCategories.get(5))
.address("28ης οκτωβρίου 56, Πολυτεχνείο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore6 = Store.builder().name("Theion Brunch").storeCategory(storeCategories.get(5))
.address("ΠΑΡΑΣΚΕΥΟΠΟΥΛΟΥ ΚΑΙ ΖΕΡΒΟΥΔΑΚΗ 22, Κάτω Πατήσια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore7 = Store.builder().name("Cartone").storeCategory(storeCategories.get(5))
.address("ΠΕΡΣΕΦΟΝΗΣ 41, Γκάζι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store pastaStore8 = Store.builder().name("Foka N3gra").storeCategory(storeCategories.get(5))
.address("ΦΩΚΙΩΝΟΣ ΝΕΓΡΗ 32, Κυψέλη")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store vegetarianStore1 = Store.builder().name("Foka N3gra").storeCategory(storeCategories.get(6))
.address("ΦΩΚΙΩΝΟΣ ΝΕΓΡΗ 32, Κυψέλη")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store vegetarianStore2 = Store.builder().name("Da Vinci").storeCategory(storeCategories.get(6))
.address("Νάξου 22, Άγιος Λουκάς")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store vegetarianStore3 = Store.builder().name("Indian tikka").storeCategory(storeCategories.get(6))
.address("ΓΛΑΔΣΤΩΝΟΣ 8, Εξάρχεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store vegetarianStore4 = Store.builder().name("La fontana").storeCategory(storeCategories.get(6))
.address("Δοιράνης 60, Πεδίον Άρεωq")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store vegetarianStore5 = Store.builder().name("Think Big by Stamatis Burger").storeCategory(storeCategories.get(6))
.address("Πάρνηθος 43, Κυψέλη")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store vegetarianStore6 = Store.builder().name("Πανάγος").storeCategory(storeCategories.get(6))
.address("Πλατεία Κυψέλης 2, Κυψέλη")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store vegetarianStore7 = Store.builder().name("L' italiano").storeCategory(storeCategories.get(6))
.address("Ταϋγέτου 58, Άγιος Λουκάς")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store vegetarianStore8 = Store.builder().name("NEW YORK SANDWICHES").storeCategory(storeCategories.get(6))
.address("Σινώπης 3, Γουδή")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store mexicanStore1 = Store.builder().name("Think Big by Stama-Τacos").storeCategory(storeCategories.get(7))
.address("Πάρνηθος 43, Κυψέλη")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store mexicanStore2 = Store.builder().name("Taco Loco").storeCategory(storeCategories.get(7))
.address("Κολοκοτρώνη Θεόδωρου 39, Σύνταγμα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store mexicanStore3 = Store.builder().name("Agavita").storeCategory(storeCategories.get(7))
.address("Ερμού 18, Μοναστηράκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store mexicanStore4 = Store.builder().name("MiΒurrito Mexicano").storeCategory(storeCategories.get(7))
.address("ΜΗΤΡΟΠΟΛΕΩΣ 66, Μοναστηράκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store mexicanStore5 = Store.builder().name("Los gatos").storeCategory(storeCategories.get(7))
.address("Ρόμβης 17, Αθήνα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store mexicanStore6 = Store.builder().name("Pepito Cocina Mexicana y Tequileria").storeCategory(storeCategories.get(7))
.address("Δράκου 19, Κουκάκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store homemadeStore1 = Store.builder().name("Εξωστρεφής").storeCategory(storeCategories.get(8))
.address("Χαροκόπου 64, Καλλιθέα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store homemadeStore2 = Store.builder().name("Little Cook").storeCategory(storeCategories.get(8))
.address("ΛΟΓΟΘΕΤΙΔΗ 12, Γηροκομείο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store homemadeStore3 = Store.builder().name("Οι νοστιμιές της Μαίρης").storeCategory(storeCategories.get(8))
.address("Ύδρας 2-4, Κυψέλη")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store homemadeStore4 = Store.builder().name("Μαγειρευτό στη Γάστρα").storeCategory(storeCategories.get(8))
.address("28ης Οκτωβρίου 56, Πολυτεχνείο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store homemadeStore5 = Store.builder().name("Το Μαγερειό").storeCategory(storeCategories.get(8))
.address("ΠΛΑΤΕΙΑ ΦΙΛΙΚΗΣ ΕΤΑΙΡΙΑΣ 3, Κολωνάκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store homemadeStore6 = Store.builder().name("Ο Κήπος της Τρώων").storeCategory(storeCategories.get(8))
.address("Τρώων 35-37, Άνω Πετράλωνα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store homemadeStore7 = Store.builder().name("Greco's project").storeCategory(storeCategories.get(8))
.address("Μητροπόλεως 5, Σύνταγμα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store homemadeStore8 = Store.builder().name("Κιουζίν").storeCategory(storeCategories.get(8))
.address("Λυκαβηττού 16, Κολωνάκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store sweetsStore1 = Store.builder().name("Koukouvaya desserts").storeCategory(storeCategories.get(9))
.address("Βασιλικής 2, Αθήνα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore2 = Store.builder().name("Morris Brown").storeCategory(storeCategories.get(9))
.address("ΠΛΑΤΕΙΑ ΒΑΡΝΑΒΑ 7, Παγκράτι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore3 = Store.builder().name("Ζαχαροπλαστείο Cremona").storeCategory(storeCategories.get(9))
.address("Φιλολάου 84, Παγκράτι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore4 = Store.builder().name("Ζαχαροπλαστείο Παύλου").storeCategory(storeCategories.get(9))
.address("ΠΑΠΑΔΙΑΜΑΝΤΟΠΟΥΛΟΥ 24, Χίλτον")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore5 = Store.builder().name("Κρεμ μπαρ Νέος Κόσμος").storeCategory(storeCategories.get(9))
.address("Αμβροσίου Φραντζή 53, Κουκάκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore6 = Store.builder().name("Mystic Sweets").storeCategory(storeCategories.get(9))
.address("Φερεκύδου 2, Παγκράτι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore7 = Store.builder().name("Τούλα γλυκές γεύσεις").storeCategory(storeCategories.get(9))
.address("ΕΥΤΥΧΙΔΟΥ 41, Παγκράτι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sweetsStore8 = Store.builder().name("Ellyz cafe").storeCategory(storeCategories.get(9))
.address("Αγίου Φίλιππου 10, Θησείο")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sushiStore1 = Store.builder().name("KAZE SUSHI").storeCategory(storeCategories.get(11))
.address("Φειδιππίδου 27, Μαρούσι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sushiStore2 = Store.builder().name("Mikaku Sushi & Noodles").storeCategory(storeCategories.get(11))
.address("ΚΩΛΕΤΤΗ 33, Εξάρχεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store sushiStore3 = Store.builder().name("Koi").storeCategory(storeCategories.get(11))
.address("Απόλλωνος 1, Σύνταγμα")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store sushiStore4 = Store.builder().name("ANGE'S SWEET SUSHI").storeCategory(storeCategories.get(11))
.address("Μηλιώνη 1Β, Κολωνάκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sushiStore5 = Store.builder().name("Sushi one").storeCategory(storeCategories.get(11))
.address("Γεωργίου Παπανδρέου 52, Ζωγράφου")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/shops/logo/@[email protected]")
.build();
Store sushiStore6 = Store.builder().name("Wabi Sabi").storeCategory(storeCategories.get(11))
.address("Κάνιγγος 8, Εξάρχεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sushiStore7 = Store.builder().name("Ikura Sushi and Korean food").storeCategory(storeCategories.get(11))
.address("Φιλελλήνων 7, Μοναστηράκι")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
Store sushiStore8 = Store.builder().name("Nakama").storeCategory(storeCategories.get(11))
.address("ΜΑΣΣΑΛΙΑΣ 5, Εξάρχεια")
.imgUrl("https://s3.eu-central-1.amazonaws.com/w4ve/box/resized/shops/logo/@[email protected]")
.build();
// assign a menu to each store and then create the store
assignProductsToStore(st1, getListOfProductsForSouvlakiStores());
storeService.create(st1);
assignProductsToStore(st2, getListOfProductsForSouvlakiStores());
storeService.create(st2);
assignProductsToStore(st3, getListOfProductsForSouvlakiStores());
storeService.create(st3);
assignProductsToStore(st4, getListOfProductsForSouvlakiStores());
storeService.create(st4);
assignProductsToStore(st5, getListOfProductsForSouvlakiStores());
storeService.create(st5);
assignProductsToStore(st6, getListOfProductsForSouvlakiStores());
storeService.create(st6);
assignProductsToStore(st7, getListOfProductsForSouvlakiStores());
storeService.create(st7);
assignProductsToStore(st8, getListOfProductsForSouvlakiStores());
storeService.create(st8);
assignProductsToStore(st9, getListOfProductsForSouvlakiStores());
storeService.create(st9);
assignProductsToStore(st10, getListOfProductsForSouvlakiStores());
storeService.create(st10);
assignProductsToStore(st11, getListOfProductsForSouvlakiStores());
storeService.create(st11);
assignProductsToStore(st12, getListOfProductsForSouvlakiStores());
storeService.create(st12);
assignProductsToStore(burgerStore1, getListOfProductsForBurgerStores());
storeService.create(burgerStore1);
assignProductsToStore(burgerStore2, getListOfProductsForBurgerStores());
storeService.create(burgerStore2);
assignProductsToStore(burgerStore3, getListOfProductsForBurgerStores());
storeService.create(burgerStore3);
assignProductsToStore(burgerStore4, getListOfProductsForBurgerStores());
storeService.create(burgerStore4);
assignProductsToStore(burgerStore5, getListOfProductsForBurgerStores());
storeService.create(burgerStore5);
assignProductsToStore(burgerStore6, getListOfProductsForBurgerStores());
storeService.create(burgerStore6);
assignProductsToStore(burgerStore7, getListOfProductsForBurgerStores());
storeService.create(burgerStore7);
assignProductsToStore(burgerStore8, getListOfProductsForBurgerStores());
storeService.create(burgerStore8);
assignProductsToStore(coffeeStore1, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore1);
assignProductsToStore(coffeeStore2, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore2);
assignProductsToStore(coffeeStore3, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore3);
assignProductsToStore(coffeeStore4, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore4);
assignProductsToStore(coffeeStore5, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore5);
assignProductsToStore(coffeeStore6, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore6);
assignProductsToStore(coffeeStore7, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore7);
assignProductsToStore(coffeeStore8, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore8);
assignProductsToStore(coffeeStore9, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore9);
assignProductsToStore(coffeeStore10, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore10);
assignProductsToStore(coffeeStore11, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore11);
assignProductsToStore(coffeeStore12, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore12);
assignProductsToStore(coffeeStore13, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore13);
assignProductsToStore(coffeeStore14, getListOfProductsForCoffeeStores());
storeService.create(coffeeStore14);
assignProductsToStore(pizzaStore1, getListOfProductsForPizzaStores());
storeService.create(pizzaStore1);
assignProductsToStore(pizzaStore2, getListOfProductsForPizzaStores());
storeService.create(pizzaStore2);
assignProductsToStore(pizzaStore3, getListOfProductsForPizzaStores());
storeService.create(pizzaStore3);
assignProductsToStore(pizzaStore4, getListOfProductsForPizzaStores());
storeService.create(pizzaStore4);
assignProductsToStore(pizzaStore5, getListOfProductsForPizzaStores());
storeService.create(pizzaStore5);
assignProductsToStore(pizzaStore6, getListOfProductsForPizzaStores());
storeService.create(pizzaStore6);
assignProductsToStore(pizzaStore7, getListOfProductsForPizzaStores());
storeService.create(pizzaStore7);
assignProductsToStore(pizzaStore8, getListOfProductsForPizzaStores());
storeService.create(pizzaStore8);
assignProductsToStore(pizzaStore9, getListOfProductsForPizzaStores());
storeService.create(pizzaStore9);
assignProductsToStore(pizzaStore10, getListOfProductsForPizzaStores());
storeService.create(pizzaStore10);
assignProductsToStore(pizzaStore11, getListOfProductsForPizzaStores());
storeService.create(pizzaStore11);
assignProductsToStore(pizzaStore12, getListOfProductsForPizzaStores());
storeService.create(pizzaStore12);
assignProductsToStore(chineseStore1, getListOfProductsForChineseStores());
storeService.create(chineseStore1);
assignProductsToStore(chineseStore2, getListOfProductsForChineseStores());
storeService.create(chineseStore2);
assignProductsToStore(chineseStore3, getListOfProductsForChineseStores());
storeService.create(chineseStore3);
assignProductsToStore(chineseStore4, getListOfProductsForChineseStores());
storeService.create(chineseStore4);
assignProductsToStore(chineseStore5, getListOfProductsForChineseStores());
storeService.create(chineseStore5);
assignProductsToStore(chineseStore6, getListOfProductsForChineseStores());
storeService.create(chineseStore6);
assignProductsToStore(chineseStore7, getListOfProductsForChineseStores());
storeService.create(chineseStore7);
assignProductsToStore(chineseStore8, getListOfProductsForChineseStores());
storeService.create(chineseStore8);
assignProductsToStore(pastaStore1, getListOfProductsForPastaStores());
storeService.create(pastaStore1);
assignProductsToStore(pastaStore2, getListOfProductsForPastaStores());
storeService.create(pastaStore2);
assignProductsToStore(pastaStore3, getListOfProductsForPastaStores());
storeService.create(pastaStore3);
assignProductsToStore(pastaStore4, getListOfProductsForPastaStores());
storeService.create(pastaStore4);
assignProductsToStore(pastaStore5, getListOfProductsForPastaStores());
storeService.create(pastaStore5);
assignProductsToStore(pastaStore6, getListOfProductsForPastaStores());
storeService.create(pastaStore6);
assignProductsToStore(pastaStore7, getListOfProductsForPastaStores());
storeService.create(pastaStore7);
assignProductsToStore(pastaStore8, getListOfProductsForPastaStores());
storeService.create(pastaStore8);
assignProductsToStore(vegetarianStore1, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore1);
assignProductsToStore(vegetarianStore2, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore2);
assignProductsToStore(vegetarianStore3, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore3);
assignProductsToStore(vegetarianStore4, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore4);
assignProductsToStore(vegetarianStore5, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore5);
assignProductsToStore(vegetarianStore6, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore6);
assignProductsToStore(vegetarianStore7, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore7);
assignProductsToStore(vegetarianStore8, getListOfProductsForVegetarianStores());
storeService.create(vegetarianStore8);
assignProductsToStore(mexicanStore1, getListOfProductsForMexicanStores());
storeService.create(mexicanStore1);
assignProductsToStore(mexicanStore2, getListOfProductsForMexicanStores());
storeService.create(mexicanStore2);
assignProductsToStore(mexicanStore3, getListOfProductsForMexicanStores());
storeService.create(mexicanStore3);
assignProductsToStore(mexicanStore4, getListOfProductsForMexicanStores());
storeService.create(mexicanStore4);
assignProductsToStore(mexicanStore5, getListOfProductsForMexicanStores());
storeService.create(mexicanStore5);
assignProductsToStore(mexicanStore6, getListOfProductsForMexicanStores());
storeService.create(mexicanStore6);
assignProductsToStore(homemadeStore1, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore1);
assignProductsToStore(homemadeStore2, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore2);
assignProductsToStore(homemadeStore3, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore3);
assignProductsToStore(homemadeStore4, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore4);
assignProductsToStore(homemadeStore5, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore5);
assignProductsToStore(homemadeStore6, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore6);
assignProductsToStore(homemadeStore7, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore7);
assignProductsToStore(homemadeStore8, getListOfProductsForHomemadeStores());
storeService.create(homemadeStore8);
assignProductsToStore(sweetsStore1, getListOfProductsForSweetsStores());
storeService.create(sweetsStore1);
assignProductsToStore(sweetsStore2, getListOfProductsForSweetsStores());
storeService.create(sweetsStore2);
assignProductsToStore(sweetsStore3, getListOfProductsForSweetsStores());
storeService.create(sweetsStore3);
assignProductsToStore(sweetsStore4, getListOfProductsForSweetsStores());
storeService.create(sweetsStore4);
assignProductsToStore(sweetsStore5, getListOfProductsForSweetsStores());
storeService.create(sweetsStore5);
assignProductsToStore(sweetsStore6, getListOfProductsForSweetsStores());
storeService.create(sweetsStore6);
assignProductsToStore(sweetsStore7, getListOfProductsForSweetsStores());
storeService.create(sweetsStore7);
assignProductsToStore(sweetsStore8, getListOfProductsForSweetsStores());
storeService.create(sweetsStore8);
assignProductsToStore(sushiStore1, getListOfProductsForSushiStores());
storeService.create(sushiStore1);
assignProductsToStore(sushiStore2, getListOfProductsForSushiStores());
storeService.create(sushiStore2);
assignProductsToStore(sushiStore3, getListOfProductsForSushiStores());
storeService.create(sushiStore3);
assignProductsToStore(sushiStore4, getListOfProductsForSushiStores());
storeService.create(sushiStore4);
assignProductsToStore(sushiStore5, getListOfProductsForSushiStores());
storeService.create(sushiStore5);
assignProductsToStore(sushiStore6, getListOfProductsForSushiStores());
storeService.create(sushiStore6);
assignProductsToStore(sushiStore7, getListOfProductsForSushiStores());
storeService.create(sushiStore7);
assignProductsToStore(sushiStore8, getListOfProductsForSushiStores());
storeService.create(sushiStore8);
// assign the same addressList to all accounts
assignAddressesToAccount(account1, getListOfAddressesForAccounts());
accountService.create(account1);
assignAddressesToAccount(account2, getListOfAddressesForAccounts());
accountService.create(account2);
assignAddressesToAccount(account3, getListOfAddressesForAccounts());
accountService.create(account3);
assignAddressesToAccount(account4, getListOfAddressesForAccounts());
accountService.create(account4);
assignAddressesToAccount(account5, getListOfAddressesForAccounts());
accountService.create(account5);
assignAddressesToAccount(account6, getListOfAddressesForAccounts());
accountService.create(account6);
}
Account assignAddressesToAccount(Account account, List<Address> addresses) {
addresses.forEach(address -> address.setAccount(account));
account.setAddressList(addresses);
return account;
}
Store assignProductsToStore(Store store, List<Product> products) {
products.forEach(product -> product.setStore(store));
store.setProducts(products);
return store;
}
List<Product> getListOfProductsForSouvlakiStores() {
return List.of(
Product.builder().name("Καλαμάκι Χοιρινό")
.description("Συνοδεύεται από ψωμάκι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png")
.build(),
Product.builder().name("Kαλαμάκι Κοτόπουλο")
.description("Συνοδεύεται από ψωμάκι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.20))
.imgUrl("assets/img/service/final/7.png")
.build(),
Product.builder().name("Τυλιχτό Γύρο Χοιρινό")
.description("Πίτα γύρος χοιρινός με τα υλικά της επιλογής σας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png")
.build(),
Product.builder().name("Τυλιχτό Γύρο Κοτόπουλο")
.description("Τυλιχτό Γύρο Κοτόπουλο με υλικά της επιλογής σας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.20))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Κεμπάπ")
.description("Συνοδεύεται από ψωμάκι")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Κεμπάπ σε πίτα")
.description("Πίτα κεμπάπ με τα υλικά της επιλογής σας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Μπιφτέκι μοσχαρίσιο σε πίτα")
.description("Πίτα μπιφτέκι μοσχαρίσιο με τα υλικά της επιλογής σας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Λουκάνικο χοιρινό σε πίτα")
.description("Πίτα λουκάνικο χοιρινό με τα υλικά της επιλογής σας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.40))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Καλαμάκι μοσχαρίσιο σε πίτα")
.description("Με Καλαμάκι μοσχαρίσιο, ντομάτα, μαρούλι ,πατάτες & BBQ sauce")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Μπιφτέκι κοτόπουλο")
.description("Συνοδεύεται από ψωμάκι")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Λουκάνικο χοιρινό Τρικάλων")
.description("Συνοδεύεται από ψωμάκι")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Καλαμάκι μανιτάρι")
.description("Συνοδεύεται από ψωμάκι")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Μπιφτέκι λαχανικών")
.description("Συνοδεύεται από ψωμάκι")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Φαλάφελ σε πίτα")
.description("Πίτα φαλάφελ με τα υλικά της επιλογής σα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Χαλούμι & μανιτάρι σε πίτα")
.description("Χαλούμι & μανιτάρι σε πίτα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build(),
Product.builder().name("Οικολογικό σε πίτα")
.description("Οικολογικό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/7.png").build()
);
}
List<Product> getListOfProductsForCoffeeStores() {
return List.of(
Product.builder()
.name("Espresso")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.10))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Cappuccino")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.50))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Freddo Espresso")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(2.10))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Freddo Cappuccino")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(2.20))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Espresso macchiato")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Espresso americano")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Freddo espresso macchiato")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Cappuccino latte")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.70))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Freddo cappuccino latte")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Freddo cappuccino με φυτική κρέμα")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(2.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Nes")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Φίλτρου")
.description("Lucaffe Exquisit 100% arabica premium")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Σοκολάτα ruby")
.description("Σοκολάτα ruby")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Σοκολάτα με γεύση μπανάνα")
.description("Σοκολάτα με γεύση μπανάνα")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Λευκή σοκολάτα")
.description("Λευκή σοκολάτα")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Μαύρη σοκολάτα")
.description("Μαύρη σοκολάτα")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build(),
Product.builder()
.name("Lucaccino")
.description("14oz. Κρύο ρόφημα με σοκολάτα & espresso")
.productCategory(getProductCategory("d"))
.price(BigDecimal.valueOf(1.90))
.imgUrl("assets/img/service/final/3.png")
.build()
);
}
List<Product> getListOfProductsForBurgerStores() {
return List.of(
Product.builder()
.name("Classic Burger")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι, cheddar, " +
"καραμελωμένα κρεμμύδια, ντομάτα, BBQ sauce & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Cheese Burger")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι, cheddar, ketchup & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Honey mustard bacon burge")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι, cheddar, μπέικον," +
" καραμελωμένα κρεμμύδια, ντομάτα, μαγιονέζα & sauce honey mustard")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Vegan Burger")
.description("Σε ψωμί ολικής άλεσης, ψητά λαχανικά (μελιτζάνες, κολοκυθάκια, μανιτάρια, τρίχρωμες πιπεριές)," +
" ντομάτα, καραμελωμένα κρεμμύδια, σάλτσα βασιλικού & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("American chicken burger")
.description("Σε ψωμί ολικής άλεσης με ψητό φιλέτο κοτόπουλο, μπέικον, πίκλες, ρόκα," +
" ντομάτα & διπλή στρώση Philadelphia")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("American Burger")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι, ketchup & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Sweet-Philly Burger")
.description("Σε ψωμί american bun, παναρισμένο φιλέτο κοτόπουλο, cheddar," +
" Philadelphia, iceberg, ντομάτα & sweet chilli mayo")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("The XXL Big burger")
.description("Σε ψωμί american bun με διπλό φρέσκο μπιφτέκι, cheddar," +
" κρεμμύδι, μουστάρδα, ψητή ντομάτα, μαγιονέζα & παρμεζάνα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Black Angus Burger")
.description("Σε ψωμί american bun με μπιφτέκι Black Angus 150gr, " +
"cheddar, 3 φέτες crispy μπέικον, σάλτσα με κρέμα cheddar & φρέσκα μανιτάρια")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Mushroom Burger")
.description("Σε ψωμί american bun με μπιφτέκι από φρέσκα μανιτάρια και cheddar")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Double-smashed")
.description("Σε ψωμί american bun, διπλό φρέσκο μπιφτέκι, αυγό, cheddar, bacon," +
" αγγουράκι τουρσί, ντομάτα, κρεμμύδι & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Turkey Burger")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι γαλοπούλας, cheddar," +
" ντομάτα, καραμελωμένα κρεμμύδια, BBQ sauce & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Caesar's")
.description("Σε ψωμί american bun, ψητό φιλέτο κοτόπουλο, τριμμένη παρμεζάνα, " +
"bacon, iceberg, ντομάτα, μαγιονέζα & caesar's sauce")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Mexican Burger")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι, Mexican sauce, " +
"cheddar, κρεμμύδι, μπέικον & μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Jack Daniel's Burger")
.description("Σε ψωμί american bun με φρέσκο μπιφτέκι, cheddar," +
" ντομάτα, μανιτάρια σωτέ & sauce Jack Daniel's με ανανά")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.40))
.imgUrl("assets/img/service/final/10.png")
.build(),
Product.builder()
.name("Buffalo Burger")
.description("Σε ψωμί american bun με διπλό φρέσκο μπιφτέκι, " +
"μαύρη μουστάρδα, ντομάτα, cheddar & καραμελωμένα κρεμμύδια")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.40))
.imgUrl("assets/img/service/final/10.png")
.build()
);
}
List<Product> getListOfProductsForPizzaStores() {
return List.of(
Product.builder()
.name("Πίτσα μαργαρίτα ")
.description("Με σάλτσα & τυρί gouda ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα ζαμπόν ")
.description("Με ζαμπόν & τυρί gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.00))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα special ")
.description("Με μπέικον, ζαμπόν, πιπεριά, μανιτάρια σάλτσα,τυρί & φρέσκια ντομάτα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα Classic")
.description("Πίτσα ζαμπόν, μπέικον & τυρί gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα χωριάτικη ")
.description("Με φέτα, ντομάτα, πιπεριά, μανιτάρια, ελιές, κρεμμύδι & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.00))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα κοτόπουλο ")
.description("Με στήθος κοτόπουλο, σως, ντομάτα, φέτα, πιπεριά & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα πεπερόνι")
.description(" Με σάλτσα, ντομάτα, πιπεριά, πεπερόνι, μανιτάρια & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα καρμπονάρα ")
.description("Με ζαμπόν, μπέικον, κρέμα γάλακτος, παρμεζάνα, μανιτάρια & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name(" Πίτσα λουκάνικο τυρί")
.description(" Με σάλτσα, λουκάνικο χωριάτικο & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(11.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα φέτα ντομάτα")
.description("Με φέτα, ντομάτα & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα σουτζούκι")
.description(" Με σάλτσα, σουτζούκι, ντομάτα & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(12.40))
.imgUrl("assets/img/service/final/1.png")
.build(),
Product.builder()
.name("Πίτσα παστουρμάς")
.description("Με σάλτσα, παστουρμά, ντομάτα & gouda")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.40))
.imgUrl("assets/img/service/final/1.png")
.build()
);
}
List<Product> getListOfProductsForChineseStores() {
return List.of(
Product.builder().name("Σούπα Wonton")
.description("Με πουγκάκια γεμιστά με κιμά & λαχανικά ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.90))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Chicken wings")
.description("6 Τεμάχια. Φτερούγες κοτόπουλο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.00))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Noodles satay")
.description("Ταλιατέλες ρυζιού με αυγό, γαρίδες, λάχανο, πράσινη πιπεριά, κοκκινη πιπεριά, κρεμμύδι & σάλτσα satay ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.80))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Cheese won ton")
.description("6 Τεμάχια. Τραγανά φιονγκάκια με τυρί Philadelphia & καβούρι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.50))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Shrimp dimblings")
.description("5 Τεμάχια. Γαριδοπιτάκια τηγανητά ή ατμού ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.00))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Meet dumplings")
.description("4 Τεμάχια. Κρεατοπιτάκια τηγανητά ή ατμού")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.50))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Won ton soup")
.description("Σούπα με won ton από φύλλα ζυμαρικών με κιμά, καρότο, μανιτάρια, φρέσκο κρεμμύδι & λάχανο")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.00))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Pecking duck")
.description("Πάπια Πεκίνου τηγανισμένη με πίτα, καρότο, μανιτάρια, φρέσκο κρεμμύδι, λάχανο & dark sauce")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(11.40))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Szechuan beef")
.description("Βοδινό με καρότο, μανιτάρια, φρέσκο κρεμμύδι & λάχανο σε καυτερή σάλτσα Szechuan ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.90))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Beef with mushrooms & bamboo")
.description("Μοσχάρι με μανιτάρια & μπαμπού")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.00))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Singapore noodles")
.description("Κινέζικα noodles από ρύζι με καρότο, μανιτάρια, κρεμμύδι, λάχανο, γαρίδες & σάλτσα κάρυ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.90))
.imgUrl("assets/img/service/final/4.png")
.build(),
Product.builder().name("Καντονέζικο καυτερό ρύζι")
.description("Καυτερό. Με μύδια, καλαμάρι, γαρίδα, καβούρι & chili")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.30))
.imgUrl("assets/img/service/final/4.png")
.build()
);
}
List<Product> getListOfProductsForPastaStores() {
return List.of(
Product.builder().name("Spaghetti Napoli")
.description("Με σάλτσα ντομάτας & τριμμένη παρμεζάνα ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.30))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Spaghetti chef")
.description("Με μπέικον, μανιτάρια, κρέμα γάλακτος & τριμμένη παρμεζάνα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.50))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Spaghetti aglio e olio")
.description("Με ελαιόλαδο, σκόρδο & chili flakes")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.50))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Spaghetti bolognese")
.description("Με κιμά & τριμμένη παρμεζάν")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.50))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Πέννες")
.description("Mε φρέσκια mozzarella, ντομάτα & βασιλικό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.30))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Πέννες με κοτόπουλο")
.description("Με κοτόπουλο, φρέσκο κρεμμύδι, μουστάρδα & κρέμα γάλακτος")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(11.00))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Καρμπονάρα")
.description("Με χοιρινή πανσέτα, φρέσκα μανιτάρια & κρέμα γάλακτος")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.00))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Ριζότο θαλασσινών")
.description("Με γαρίδες, μύδια, καλαμάρι, φρέσκο κρεμμυδάκι & φρέσκια ντομάτα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(25.00))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Ριζότο κοτόπουλο")
.description("Με κοτόπουλο φιλέτο, κρόκο Κοζάνης & κρέμα παρμεζάνας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(12.00))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Ριζότο μανιτάρια")
.description("Με μανιτάρια porcini & λάδι λευκής τρούφας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.50))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Κριθαρότο γαρίδες")
.description("Με ούζο, φέτα, φρέσκια ντομάτα & βασιλικό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(23.00))
.imgUrl("assets/img/service/final/5.png")
.build(),
Product.builder().name("Κριθαρότο μοσχαράκι")
.description("Με τρίχρωμη πιπεριά & φρέσκια ντομάτα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(14.90))
.imgUrl("assets/img/service/final/5.png")
.build());
}
List<Product> getListOfProductsForVegetarianStores() {
return List.of(
Product.builder().name("Veggie mushroom")
.description("Με μανιτάρι portobello, μανιτάρι πλευρώτους, λευκά μανιτάρια, μέλι, θυμάρι, garlic mayo & τυρί προβολόνε")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.90))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Veggie omelet")
.description("Με 3 αυγά, μανιτάρια, ντοματίνια & πράσινες πιπεριές. Συνοδεύεται από φρεσκοκομμένες τηγανητές πατάτες")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.50))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Μεξικάνα")
.description("Σαλάτα με λάχανο, μαρούλι, καρότο, καλαμπόκι, κόκκινα φασόλια, cocktail σως & τυρί")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.30))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Sandwich vegetarian")
.description("Με μπιφτέκι λαχανικών, μαρούλι, ντομάτα, πατάτες τηγανητές & sauce μουστάρδα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.50))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Vegetarian burger")
.description("Ψωμάκι της επιλογής σας με μπιφτέκι λαχανικών, μανιτάρια πλευρώτους, ντομάτα, iceberg, vegan mayo & vegan sauce μουστάρδας")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.00))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Aloo - Gobbi")
.description("Κουνουπίδι και πατάτες,καρότα μαγειρεμένα απο μείγμα ινδικών μπαχαρικών")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.50))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Jeera Aloo")
.description("Πατάτες με κύμινο κρεμμύδια ντομάτες και ινδικά μπαχαρικά")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.00))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Dal Tarka")
.description("Κρεμώδεις κίτρινες φακές με αρωματικά μπαχαρικά")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.00))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Mix Vegetable")
.description("Φασολάκια, πατάτες και καρότα μαγειρεμένα με ινδική σάλτσα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.90))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Μπιφτέκι λαχανικών Da Vinci")
.description("2 Τεμάχια. Συνοδεύεται από μουστάρδα & σαλάτα vegetarian (μαρούλι, αγγούρι, ντομάτα & πιπεριά)")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.10))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Vegetarian ")
.description("Με σάλτσα ντομάτας, μοτσαρέλα, ελιές, πιπεριά, κρεμμύδι & βασιλικό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.50))
.imgUrl("assets/img/service/final/11.png")
.build(),
Product.builder().name("Καλτσόνε vegetarian")
.description("30cm. Χειροποίητη ζύμη. Με σάλτσα ντομάτας, mozzarella, ντοματίνια, πιπεριά & μανιτάρια")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.00))
.imgUrl("assets/img/service/final/11.png")
.build());
}
List<Product> getListOfProductsForMexicanStores() {
return List.of(
Product.builder().name("Jalapenos peppers")
.description("6 Τεμάχια. Καυτερό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.90))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Enchiladas barbacoa beef")
.description("Γεμιστες τορτιγιες καλαμποκιου με σιγομαγειρεμενο μοσχαρι, μεξικανικα μπαχαρικα,chipotle sauce και τυρι cheddar ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(12.50))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Chimichanga chicken")
.description("Τορτίγια από αλεύρι τηγανητή με γέμιση mix τυριών, φιλέτο κοτόπουλο, πιπεριά πράσινη, πιπεριά κόκκινη, πιπεριά κίτρινη & μανιτάρια. Συνοδεύεται από μεξικάνικο ρύζι, sauce ranchera, pico de gallo & κόλιανδρο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(12.50))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Burritos chili con carne")
.description("Καυτερό. Ψητή τορτίγια με cheddar & chili con carne. Συνοδεύεται από μεξικάνικο ρύζι, ανάμεικτη σαλάτα & sour cream ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.00))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Tacos beef")
.description("Με pico de gallo, iceberg, μοσχαρίσιο κιμά & cheddar τριμμένο. Συνοδεύεται από με μεξικάνικο ρύζι, ανάμεικτη σαλάτα & sauce ranchera ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.20))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Jamon Iberico")
.description("Pata negra 28μήνης ωρίμανσης ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(13.30))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Variedad de jamones y quesos")
.description("Ποικιλία αλλαντικών & τυριών με prosciutto di Parma, chorizo de Espana, spianata calabria, parmigiano reggiano, manchego de Espana & αρσενικό Νάξου")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(11.50))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Paellas de mariscos")
.description("Με μύδια, γαρίδες, καλαμάρι & κρόκο Κοζάνης ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(18.50))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Paellas valenciana mixta")
.description("Με κοτόπουλο, chorizo λουκάνικο, μύδια, γαρίδες, καλαμάρι & κρόκο Κοζάνης ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(17.00))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Nachos chili con carne")
.description("10 Τεμάχια. Καυτερό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.00))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Guacamole & chips")
.description("Μεξικάνικο dip με βάση το avocado, pico de gallo & lime ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.20))
.imgUrl("assets/img/service/final/6.png")
.build(),
Product.builder().name("Fajitas vegetables")
.description("Mix λαχανικών. Με λεπτοκομμένη πράσινη πιπεριά, κόκκινη πιπεριά, κίτρινη πιπεριά, κρεμμύδι & σάλτσα ranchera. Συνοδεύεται από τορτίγιες αλευριού, guacamole, pico de gallo & sour cream ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(13.80))
.imgUrl("assets/img/service/final/6.png")
.build());
}
List<Product> getListOfProductsForHomemadeStores() {
return List.of(
Product.builder().name("Μπιφτέκια με πουρέ πατάτας & μυρωδικά")
.description("2 τεμάχια. Με ανάμεικτο κιμά ψημένα στη σχάρα ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.90))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Sweet chili φιλέτο κοτόπουλο με άγριο ρύζι")
.description("Τρυφερό & ελαφρύ φιλετάκι κοτόπουλο ψημένο στη σχάρα με γλυκοκαυτερή σως. Συνοδεύεται από άγριο ρύζι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.00))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Αρακάς λεμονάτος με κοτόπουλο")
.description("Μια πεντανόστιμη & υγιεινή συνταγή του αρακά με κοτόπουλο, καροτάκια & πατάτες. Φρεσκοστημμένα λεμόνια, άνηθος & μαϊντανός συνθέτουν ένα τέλειο γευστικά πιάτο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.50))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Κοτόπουλο με πουρέ πατάτας")
.description("Λαχταριστό μπουτάκι κοτόπουλο με χειροποίητο πουρέ πατάτες & άρωμα δενδρολίβανο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.50))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Παστίτσιο ")
.description("Με κανελόνια γεμιστά με μοσχαρίσιο κιμά και μπεσαμέλ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(15.00))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Κόκορας κρασάτος")
.description("Με χοντρό μακαρόνι")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.00))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Μακαρόνια με σάλτσα")
.description("Συνοδεύεται από τριμμένο τυρί")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.00))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Φασολάκια")
.description("6 Τεμάχια. Καυτερό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.90))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Jalapenos peppers")
.description("Συνοδεύεται με φέτα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.00))
.imgUrl("assets/img/service/7.png")
.build(),
Product.builder().name("Μελιτζάνες ιμάμ μπαϊλντί")
.description("Συνοδεύεται με φέτα")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(9.00))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Κεφτεδάκια τηγανητά")
.description("12 Τεμάχια. Με δροσερό καρέ ντομάτας & γιαούρτι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.00))
.imgUrl("assets/img/service/final/12.png")
.build(),
Product.builder().name("Λουκάνικο Καρδίτσας στα κάρβουνα")
.description("Συνοδεύεται από πατάτες τηγανητές ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.50))
.imgUrl("assets/img/service/final/12.png")
.build());
}
List<Product> getListOfProductsForSweetsStores() {
return List.of(
Product.builder().name("Mystic cheesecake")
.description("Αμερικάνικο")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.00))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Mystic panna cotta")
.description("Με κανναβόσπορο & σιρόπι καραμέλα ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(2.50))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Mystic gorilla")
.description("2 Ατόμων. Πεϊνιρλί με κρέμα γάλακτος, μπανάνα & σοκολάτα με κανναβόσπορο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.00))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Cheesecake βύσσινο")
.description("Με πλούσια φρέσκια κρέμα & χειροποίητη μαρμελάδα βύσσινο")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.00))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Brownies Valrhona")
.description("Double chocolate")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.70))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Σοκολατόπιτα")
.description("Σπιτική. Με σάλτσα σοκολάτας ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.90))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Προφιτερόλ")
.description("Πολίτικο")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.50))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Millefeuille")
.description("Σπιτικό")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.00))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Mousse κρέμα με σου & φράουλες")
.description("Φρέσκες φράουλες")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.00))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Πάστα ρώσικος τρούλος")
.description("Mousse κόκκινων φρούτων του δάσους, cremeux σοκολάτασς & επικάλυψη φράουλα ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(8.30))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Γαλακτομπουρεκο σε κανταΐφι")
.description("Φρέσκα υλικά")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(17.50))
.imgUrl("assets/img/service/final/8.png")
.build(),
Product.builder().name("Τούρτα παγωτό παρφέ σοκολάτα το κιλό")
.description("Περίπου 1.5kg. Η τελική τιμή του προϊόντος θα διαμορφωθεί κατά το ζύγισμα ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(25.00))
.imgUrl("assets/img/service/final/8.png")
.build());
}
List<Product> getListOfProductsForSushiStores() {
return List.of(
Product.builder().name("Vegetable maki roll")
.description("8 Τεμάχια. Ρολό με αβοκάντο, καρότο & αγγούρι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.50))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Salmon maki roll")
.description("8 Τεμάχια. Ρολό με σολομό ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Kappa maki roll")
.description("8 Τεμάχια. Ρολό με αγγούρι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(3.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Tuna maki roll")
.description("8 Τεμάχια. Ρολό με τόνο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Spicy salmon maki roll")
.description("8 Τεμάχια. Ρολό με σολομό & καυτερή sauce ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("California roll")
.description("8 Τεμάχια. Ρολό με surimi καβουριού, αγγούρι & αβοκάντο ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(6.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Creamy salmon roll")
.description("8 Τεμάχια. Ρολό με σολομό, avocado & κρέμα τυριού ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Uramaki Combo")
.description("Combo με επιλεγμένα inside-out rolls. 16 τεμάχια. ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(12.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Maki lovers")
.description("Combo με επιλεγμένα maki rolls. 12 τεμάχια. ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(10.00))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Edamame beans")
.description("Αλατισμένα φασολάκια σόγιας ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(5.50))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Rice balls")
.description("2 Μπάλες ρυζιού με φρέσκα κρεμμυδάκια, καρότο & ginger ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(4.50))
.imgUrl("assets/img/service/final/2.png")
.build(),
Product.builder().name("Avocado maki rolls")
.description("6 Τεμάχια. Ρολά με αβοκάντο τυλιγμένα σε φύκι ")
.productCategory(getProductCategory("f"))
.price(BigDecimal.valueOf(7.00))
.imgUrl("assets/img/service/final/2.png")
.build());
}
ProductCategory getProductCategory(String category) {
switch (category) {
case "f":
return productCategoryService.findByName("Food");
case "d":
return productCategoryService.findByName("Drink");
case "g":
return productCategoryService.findByName("Groceries");
case "c":
return productCategoryService.findByName("Coffee");
case "a":
return productCategoryService.findByName("Alcohol");
default:
return null;
}
}
List<Address> getListOfAddressesForAccounts() {
return List.of(
Address.builder().state("Attica").city("N.Filadelfeia")
.postalCode(14323).streetName("Venizelou").floor(2)
.StreetNumber(1).doorbellName("Papaxronis").build(),
Address.builder().state("Attica").city("Agia Paraskevi")
.postalCode(14346).streetName("Patriarxou Io.").floor(4)
.StreetNumber(39).doorbellName("Nikolaou").build(),
Address.builder().state("Attica").city("Papagou").floor(3)
.postalCode(14344).streetName("Nikolaou Plastira")
.StreetNumber(15).doorbellName("Fotiou").build(),
Address.builder().state("Attica").city("Papagou").floor(3)
.postalCode(14344).streetName("Nikolaou Plastira")
.StreetNumber(15).doorbellName("Fotiou").build(),
Address.builder().state("Attica").city("Papagou").floor(3)
.postalCode(14344).streetName("Nikolaou Plastira")
.StreetNumber(15).doorbellName("Fotiou").build()
);
}
}
|
SamarasTh/Acmefood
|
src/main/java/gr/acmefood/bootstrap/SampleDataGenerator.java
|
2,259 |
package gr.ntua.ece.softeng.controllers;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import javax.mail.internet.MimeMessage;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import gr.ntua.ece.softeng.entities.Parent;
import gr.ntua.ece.softeng.entities.Providers;
import gr.ntua.ece.softeng.entities.Role;
import gr.ntua.ece.softeng.entities.User;
import gr.ntua.ece.softeng.error.CustomResponse;
import gr.ntua.ece.softeng.repositories.ParentRepository;
import gr.ntua.ece.softeng.repositories.ProvidersRepository;
import gr.ntua.ece.softeng.repositories.UserRepository;
@RestController
@Transactional
@RequestMapping(path="/register")
public class RegisterController {
@Autowired
private ParentRepository parentRepository;
@Autowired
private ProvidersRepository providersRepository;
@Autowired
private UserRepository userRepository;
@Autowired
private JavaMailSender sender;
private final static String POST_PARENT_URL = "/parent";
@PostMapping(POST_PARENT_URL)
public @ResponseBody CustomResponse createParent(@RequestBody Parent parent) throws IOException, JSONException {
String username = parent.getUsername();
String password = parent.getPassword();
String sha256hex = org.apache.commons.codec.digest.DigestUtils.sha256Hex(password);
synchronized(this) {
if(parentRepository.findByUsername(parent.getUsername()) != null ||
userRepository.findByUsername(username) != null) {
CustomResponse res = new CustomResponse();
res.setMessage("Username already exists");
return res;
}
userRepository.save(new User(username, sha256hex, Arrays.asList(new Role("PARENT"))));
parent.setPassword(sha256hex);
parent.setFpoints(0);
parent.setWallet(0);
String Area = parent.getArea();
String StreetName = parent.getStreetName().replaceAll("\\s+","");
String StreetNumber = parent.getStreetNumber().toString();
final String TARGET_URL =
"https://maps.googleapis.com/maps/api/geocode/json?address=";
final String help1= "+";
final String help2=",";
final String API_KEY =
"&key=AIzaSyCi-UTmdLdEpurrr8A5Ou5I17cihpelPcI";
URL serverUrl = new URL(TARGET_URL+StreetNumber+help1+StreetName+help2+Area+API_KEY);
URLConnection urlConnection = serverUrl.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)urlConnection;
httpConnection.setRequestMethod("GET");
httpConnection.setRequestProperty("Content-Type", "application/json");
httpConnection.setDoOutput(true);
if (httpConnection.getInputStream() == null) {
System.out.println("No stream");
}
Scanner httpResponseScanner = new Scanner (httpConnection.getInputStream());
String resp = "";
while (httpResponseScanner.hasNext()) {
String line = httpResponseScanner.nextLine();
resp += line;
}
httpResponseScanner.close();
JSONObject json = new JSONObject(resp);
JSONArray results = json.getJSONArray("results");
JSONObject sessionobj=results.getJSONObject(0);
JSONObject geometry=sessionobj.getJSONObject("geometry");
JSONObject location=geometry.getJSONObject("location");
Double latitude=location.getDouble("lat");
Double longitude=location.getDouble("lng");
parent.setLatitude(latitude);
parent.setLongitude(longitude);
parentRepository.save(parent);
CustomResponse res = new CustomResponse();
res.setMessage("ok with post from parent");
return res;
}
}
private final static String POST_PROVIDER_URL = "/provider";
@PostMapping(POST_PROVIDER_URL)
@Transactional
public @ResponseBody CustomResponse createParent(@RequestBody Providers provider) {
String username = provider.getUserName();
String password = provider.getPassword();
String companyName = provider.getcompanyName();
String sha256hex = org.apache.commons.codec.digest.DigestUtils.sha256Hex(password);
provider.setPassword(sha256hex);
synchronized(this) {
if(providersRepository.findByCompanyName(provider.getcompanyName()) != null ||
userRepository.findByUsername(username) != null) {
CustomResponse res = new CustomResponse();
res.setMessage("username already exists");
return res;
}
List<Role> list = new ArrayList<Role>();
list.add(new Role("PROVIDER"));
list.add(new Role(companyName));
userRepository.save(new User(username, sha256hex, list));
providersRepository.save(provider);
CustomResponse res = new CustomResponse();
res.setMessage("ok with post from provider");
return res;
}
}
private static SecureRandom random = new SecureRandom();
private static final String ALPHA_CAPS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static final String ALPHA = "abcdefghijklmnopqrstuvwxyz";
private static final String NUMERIC = "0123456789";
private static Boolean flag=false;
private static String email=null;
private static String password=null;
@GetMapping(path="/reset_password")
public @ResponseBody CustomResponse PasswordGenerator(@RequestParam String username) throws Exception {
try {
Parent parent=parentRepository.findByUsername(username);
CustomResponse<String>cr = new CustomResponse<>();
cr.setMessage("Your password has been reset.Please check your emails.");
flag=true;
sendPassword(username);
return cr;
}catch (NullPointerException ex) {
try {
Providers provider=providersRepository.findByUserName(username);
CustomResponse<String>cr2 = new CustomResponse<>();
cr2.setMessage("Your password has been reset.Please check your emails.");
sendPassword(username);
return cr2;
}catch (NullPointerException e) {
CustomResponse<String>cr3 = new CustomResponse<>();
cr3.setMessage("Please insert a valid username");
return cr3;
}
}
}
public void sendPassword(String username) throws Exception{
if(flag==true) {
flag=false;
Parent parent=parentRepository.findByUsername(username);
email=parent.getEmail();
password=generatePassword(10,ALPHA_CAPS+ALPHA+NUMERIC);
String sha256hex = org.apache.commons.codec.digest.DigestUtils.sha256Hex(password);
parent.setPassword(sha256hex);
parentRepository.save(parent);
User u=userRepository.findByUsername(username);
u.setPassword(sha256hex);
}
else {
Providers provider=providersRepository.findByUserName(username);
email=provider.getMail();
password=generatePassword(10,ALPHA_CAPS+ALPHA+NUMERIC);
String sha256hex = org.apache.commons.codec.digest.DigestUtils.sha256Hex(password);
provider.setPassword(sha256hex);
providersRepository.save(provider);
User u=userRepository.findByUsername(username);
u.setPassword(sha256hex);
}
MimeMessage message = sender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message,true);
helper.setTo(email);
helper.setSubject("Αλλαγή κωδικού");
helper.setText("Ο νέος σας κωδικός είναι: "+password);
sender.send(message);
}
public static String generatePassword(int len, String dic) {
String result = "";
for (int i = 0; i < len; i++) {
int index = random.nextInt(dic.length());
result += dic.charAt(index);
}
return result;
}
}
|
pbougou/fsociety
|
backend/src/main/java/gr/ntua/ece/softeng/controllers/RegisterController.java
|
2,261 |
package gr.cti.eslate.base.container;
import java.util.ListResourceBundle;
public class MetadataBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
/* {"Geography", "Γεωγραφία"},
{"Geometry", "Γεωμετρία"},
{"History", "Ιστορία"},
{"Mathematics", "Μαθηματικά"},
{"Physics", "Φυσική"},
{"CrossSubject", "Διαθεματικός"},*/
{"Title", "Τίτλος"},
{"Subject", "Αντικείμενο"},
{"Company", "Εταιρεία"},
{"Category", "Κατηγορία"},
{"Keyword", "Λέξεις - κλειδιά"},
{"Comment", "Σχόλια"},
{"Author", "Συγγραφείς"},
{"AddAuthor", "Προσθήκη"},
{"RemoveAuthor", "Αφαίρεση"},
{"Lock", "Κλείδωμα"},
{"LockLabel", "Προστασία"},
{"Unlock", "Ξεκλείδωμα"},
{"MicoworldInfo", "Πληροφορίες για τον μικρόκοσμο"},
{"TitleTip", "Τίτλος μικρόκοσμου"},
{"SubjectTip", "Αντικείμενο του μικρόκοσμου"},
{"CompanyTip", "Εταιρεία"},
{"CategoryTip", "Κατηγορία μικροκόσμου"},
{"KeywordTip", "Λέξεις - κλειδιά που συνδέονται με τον μικρόκοσμο"},
{"CommentTip", "Σχόλια για τον μικρόκοσμο"},
{"AuthorTip", "Συγγραφείς μικροκόσμου"},
{"LockTip", "Ορισμός κωδικού πρόσβασης στη ρυθμίσεις του μικρόκοσμου"},
{"UnlockTip", "Εισαγωγή κωδικού πρόσβασης για αλλαγή των ρυθμίσεων του μικρόκοσμου"},
{"AddAuthorTip", "Προσθήκη νέου συγγραφέα"},
{"RemoveAuthorTip", "Διαφραφή επιλεγμένου συγγραφέα"},
{"InvalidConfirmation", "Ο νέος κωδικός πρόσβασης δεν επιβεβαιώθηκε σωστά."},
{"InvalidPassword", "Λάθος κωδικός πρόσβασης!"},
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/base/container/MetadataBundle_el_GR.java
|
2,265 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.io.File;
public class Example6 {
public static void main(String[] args) throws Exception {
MP3Player player = new MP3Player();
player.addToPlayList(new File("test1.mp3"));
player.addToPlayList(new File("test2.mp3"));
player.addToPlayList(new File("test3.mp3"));
player.setRepeat(true);
player.setShuffle(true);
player.play();
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example6.java
|
2,267 |
package com.redhat.qe.katello.base;
import org.testng.annotations.DataProvider;
import com.redhat.qe.katello.base.obj.KatelloActivationKey;
import com.redhat.qe.katello.base.obj.KatelloDistributor;
import com.redhat.qe.katello.base.obj.KatelloEnvironment;
import com.redhat.qe.katello.base.obj.KatelloOrg;
import com.redhat.qe.katello.base.obj.KatelloProvider;
import com.redhat.qe.katello.base.obj.KatelloSystem;
import com.redhat.qe.katello.common.KatelloUtils;
public class KatelloCliDataProvider {
@DataProvider(name = "org_create")
public static Object[][] org_create(){
String uniqueID1 = KatelloUtils.getUniqueID();
String uniqueID2 = KatelloUtils.getUniqueID();
//name,label, description, ExitCode, Output
return new Object[][] {
{ "orgNoDescr_"+uniqueID1,null, null, new Integer(0), String.format(KatelloOrg.OUT_CREATE, "orgNoDescr_"+uniqueID1)},
{ "org "+uniqueID2+"", null, "Org with space", new Integer(0), String.format(KatelloOrg.OUT_CREATE, "org "+uniqueID2+"")},
{strRepeat("0123456789", 25)+"abcde", null, "Org name with 255 characters", new Integer(0), String.format(KatelloOrg.OUT_CREATE, strRepeat("0123456789", 25)+"abcde")},
{strRepeat("0123456789", 25)+"abcdef", null, "Org name with 256 characters", new Integer(166), String.format(KatelloOrg.ERR_LONG_NAME)},
{"\\!@%^&*(<_-~+=//\\||,.>)", null, "Org name with special characters", new Integer(0), String.format(KatelloOrg.OUT_CREATE, "\\!@%^&*(<_-~+=//\\||,.>)")},
};
}
/**
* Object[] contains of:<BR>
* provider:<BR>
* name<br>
* description<br>
* url<br>
* exit_code<br>
* output
*/
@DataProvider(name="provider_create")
public static Object[][] provider_create(){
// TODO - the cases with unicode characters still missing - there
// is a bug: to display that characters.
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ "aa", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"aa")},
{ "11", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"11")},
{ "1a", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"1a")},
{ "a1", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"a1")},
{ strRepeat("0123456789", 25)+"abcde", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,strRepeat("0123456789", 25)+"abcde")},
{ "prov-"+uid, null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"prov-"+uid)},
{ "prov "+uid, "Provider with space in name", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"prov "+uid)},
{ null, null, null, new Integer(2), System.getProperty("katello.engine", "katello")+": error: Option --name is required; please see --help"},
{ " ", null, null, new Integer(166), "Name can't be blank"},
{ " a", null, null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a ", null, null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a", null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"a")},
{ "\\!@%^&*(<_-~+=//\\||,.>)", "Name with special characters", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE, "\\!@%^&*(<_-~+=//\\||,.>)")},
{ strRepeat("0123456789", 25)+"abcdef", null, null, new Integer(166), "Validation failed: Name cannot contain more than 255 characters"},
// description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"desc-specChars"+uid)},
{ "desc-255Chars"+uid, strRepeat("0123456789", 25)+"abcde", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"desc-255Chars"+uid)},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"desc-256Chars"+uid)},
// url
{ "url-httpOnly"+uid, null, "http://", new Integer(2), System.getProperty("katello.engine", "katello")+": error: option --url: invalid format"}, // see below
{ "url-httpsOnly"+uid, null, "https://", new Integer(2), System.getProperty("katello.engine", "katello")+": error: option --url: invalid format"}, // according changes of: tstrachota
{ "url-redhatcom"+uid, null, "http://redhat.com/", new Integer(0), String.format(KatelloProvider.OUT_CREATE,"url-redhatcom"+uid)},
{ "url-with_space"+uid, null, "http://url with space/", new Integer(0), String.format(KatelloProvider.OUT_CREATE,"url-with_space"+uid)},
// misc
{ "duplicate"+uid, null, null, new Integer(0), String.format(KatelloProvider.OUT_CREATE,"duplicate"+uid)},
{ "duplicate"+uid, null, null, new Integer(166), "Validation failed: Name has already been taken"}
};
}
@DataProvider(name="provider_create_diffType")
public static Object[][] provider_create_diffType(){
String KTL_PROD = System.getProperty("katello.engine", "katello");
return new Object[][] {
{ "C", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'C' (choose from 'redhat', 'custom')"},
{ "Custom", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'Custom' (choose from 'redhat', 'custom')"},
{ "CUSTOM", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'CUSTOM' (choose from 'redhat', 'custom')"},
{ "rh", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'rh' (choose from 'redhat', 'custom')"},
{ "RedHat", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'RedHat' (choose from 'redhat', 'custom')"},
{ "REDHAT", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'REDHAT' (choose from 'redhat', 'custom')"},
{ "^custom", new Integer(2), KTL_PROD+": error: option --type: invalid choice: '^custom' (choose from 'redhat', 'custom')"},
{ " custom", new Integer(2), KTL_PROD+": error: option --type: invalid choice: ' custom' (choose from 'redhat', 'custom')"},
{ "custom ", new Integer(2), KTL_PROD+": error: option --type: invalid choice: 'custom ' (choose from 'redhat', 'custom')"}
};
}
@DataProvider(name="provider_delete")
public static Object[][] provider_delete(){
return new Object[][] {
// org
{ null, null, new Integer(2), "Option --org is required; please see --help"},
{ null, null, new Integer(2), "Option --name is required; please see --help"}
};
}
public static String strRepeat(String src, int times){
String res = "";
for(int i=0;i<times; i++)
res = res + src;
return res;
}
@DataProvider(name="client_remember")
public static Object[][] client_remember(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
{ "organizations-"+uid, "org-value",new Integer(0),"Successfully remembered option [ organizations-"+uid+" ]"},
{ "providers-"+uid, "prov-value",new Integer(0),"Successfully remembered option [ providers-"+ uid +" ]"},
{ "environments-"+uid, "env-value",new Integer(0),"Successfully remembered option [ environments-"+ uid +" ]"},
{ strRepeat("0123456789", 12)+"abcdefgh-"+uid, "long-value", new Integer(0), "Successfully remembered option [ "+strRepeat("0123456789", 12)+"abcdefgh-"+ uid +" ]"},
{ "opt-"+uid, "val-"+uid, new Integer(0), "Successfully remembered option [ opt-"+uid+" ]"},
{ "opt "+uid, "Option with space in name", new Integer(0), "Successfully remembered option [ opt "+uid+" ]"},
};
}
@DataProvider(name="permission_available_verbs")
public static Object[][] permission_available_verbs(){
return new Object[][] {
// org
{ "organizations", new Integer(0)},
{ "providers", new Integer(0)},
{ "environments", new Integer(0)},
};
}
@DataProvider(name="permission_create")
public static Object[][] permission_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
//String name, String scope,String tags,String verbs,Integer exitCode, String output
{ "perm-all-verbs-"+uid, "environments", null, "read_contents,update_systems,delete_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-read_contents-env-"+uid, "environments", null, "read_contents",new Integer(0),null},
{ "perm-read_update-env-"+uid, "environments", null, "read_contents,update_systems",new Integer(0),null},
{ "perm-del_read_reg-verbs-env-"+uid, "environments", null, "delete_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-register-verbs-env-"+uid, "environments", null, "register_systems",new Integer(0),null},
{ "perm-exclude_register-verbs-env-"+uid, "environments", null, "read_contents,update_systems,delete_systems,read_systems",new Integer(0),null},
{ "perm-update_register-verbs-env-"+uid, "environments", null, "update_systems,register_systems",new Integer(0),null},
{ "perm-read_update-verbs-provider-"+uid, "providers", null, "read,update",new Integer(0),null},
{ "perm-read-verbs-provider-"+uid, "providers", null, "read",new Integer(0),null},
{ "perm-update-verbs-provider-"+uid, "providers", null, "update",new Integer(0),null},
{ "perm-all-org"+uid, "organizations", null, "delete_systems,update,update_systems,read,read_systems,register_systems",new Integer(0),null},
{ "perm-all-tags-verbs-"+uid, "environments", "Library", "read_contents,update_systems,delete_systems,read_systems,register_systems",new Integer(0),null},
{ "perm-some_verbs-org"+uid, "organizations", null, "update,update_systems,read,read_systems",new Integer(0),null},
};
}
@DataProvider(name="user_role_create")
public static Object[][] user_role_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ uid+"-aa", null, new Integer(0), "Successfully created user role [ "+uid+"-aa ]"},
{ uid+"-11", null, new Integer(0), "Successfully created user role [ "+uid+"-11 ]"},
{ uid+"-1a", null, new Integer(0), "Successfully created user role [ "+uid+"-1a ]"},
{ uid+"-a1", null, new Integer(0), "Successfully created user role [ "+uid+"-a1 ]"},
{ uid+strRepeat("0123456789", 11)+"abcdefgh", null, new Integer(0), "Successfully created user role [ "+uid+strRepeat("0123456789", 11)+"abcdefgh"+" ]"},
{ "user_role-"+uid, null, new Integer(0), "Successfully created user role [ user_role-"+uid+" ]"},
{ "user_role "+uid, "Provider with space in name", new Integer(0), "Successfully created user role [ user_role "+uid+" ]"},
{ " ", null, new Integer(166), "Name can't be blank"},
{ " a", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a ", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a", null, new Integer(166), "Validation failed: Name must contain at least 3 character"},
{ "?1", null, new Integer(166), "Validation failed: Name must contain at least 3 character"},
{ strRepeat("0123456789", 12)+"abcdefghi", null, new Integer(0), "Successfully created user role [ 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefghi ]"},
// // description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", new Integer(0), "Successfully created user role [ desc-specChars"+uid+" ]"},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", new Integer(0), "Successfully created user role [ desc-256Chars"+ uid +" ]"},
// misc
{ "duplicate"+uid, null, new Integer(0), "Successfully created user role [ duplicate"+uid+" ]"},
};
}
@DataProvider(name="environment_create")
public static Object[][] environment_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ "env-aa", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-aa")},
{ "env-11", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-11")},
{ "env-1a", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-1a")},
{ "env-a1", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-a1")},
{ strRepeat("0123456789", 25)+"abcde", "Environment name with 255 characters", new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, strRepeat("0123456789", 25)+"abcde")},
{ "env-"+uid, null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env-"+uid)},
{ "env "+uid, "Provider with space in name", new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "env "+uid)},
{ " ", null, new Integer(166), KatelloEnvironment.ERROR_BLANK_NAME},
{ " a", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a ", null, new Integer(166), "Validation failed: Name must not contain leading or trailing white spaces."},
{ "a", null, new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "a")},
{ "\\!@%^&*(<_-~+=//\\||,.>)", "Environment name with special characters", new Integer(0), String.format(KatelloEnvironment.OUT_CREATE, "\\!@%^&*(<_-~+=//\\||,.>)")},
{ strRepeat("0123456789", 25)+"abcdef", null, new Integer(166), KatelloEnvironment.ERROR_LONG_NAME},
// description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", new Integer(0), "Successfully created environment [ desc-specChars"+uid+" ]"},
{ "desc-255Chars"+uid, strRepeat("0123456789", 25)+"abcde", new Integer(0), "Successfully created environment [ desc-255Chars"+uid+" ]"},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", new Integer(0), "Successfully created environment [ desc-256Chars"+uid+" ]"},
// misc
{ "duplicate"+uid, null, new Integer(0), "Successfully created environment [ duplicate"+uid+" ]"},
};
}
/**
* Object[] contains of:<BR>
* activation key:<BR>
* name<br>
* description<br>
* exit_code<br>
* output
*/
@DataProvider(name="activationkey_create")
public static Object[][] activationkey_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
// name
{ "aa", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "aa")},
{ "11", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "11")},
{ "1a", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "1a")},
{ "a1", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "a1")},
{ strRepeat("0123456789", 25)+"abcde", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, strRepeat("0123456789", 25)+"abcde")},
{ "ak-"+uid, null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "ak-"+uid)},
{ "ak "+uid, "Provider with space in name", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "ak "+uid)},
{ null, null, new Integer(2), System.getProperty("katello.engine", "katello")+": error: Option --name is required; please see --help"},
{ null, null, new Integer(2), System.getProperty("katello.engine", "katello")+": error: Option --name is required; please see --help"},
{ null, null, new Integer(2), System.getProperty("katello.engine", "katello")+": error: Option --name is required; please see --help"},
{ " ", null, new Integer(166), KatelloActivationKey.ERROR_BLANK_NAME},
{ " a", null, new Integer(166), KatelloActivationKey.ERROR_NAME_WHITESPACE},
{ "a ", null, new Integer(166), KatelloActivationKey.ERROR_NAME_WHITESPACE},
{ "a", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "a")},
{ "(\\!@%^&*(<_-~+=//\\||,.>)", null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "(\\!@%^&*(<_-~+=//\\||,.>)" )},
{ strRepeat("0123456789", 25)+"abcdef", null, new Integer(166), KatelloActivationKey.ERROR_LONG_NAME},
// // description
{ "desc-specChars"+uid, "\\!@%^&*(<_-~+=//\\||,.>)", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "desc-specChars"+uid)},
{ "desc-255Chars"+uid, strRepeat("0123456789", 25)+"abcde", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "desc-255Chars"+uid)},
{ "desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef", new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "desc-256Chars"+uid)},
// misc
{ "duplicate"+uid, null, new Integer(0), String.format(KatelloActivationKey.OUT_CREATE, "duplicate"+uid)},
{ "duplicate"+uid, null, new Integer(166), KatelloActivationKey.ERROR_DUPLICATE_NAME}
};
}
@DataProvider(name="add_custom_info")
public static Object[][] add_custom_info(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
{ "env-aa", "env-aa", new Integer(0),null},
{ strRepeat("0123456789", 12)+"abcdefgh",strRepeat("0123456789", 12)+"abcdefgh", new Integer(0),null},
{ " ", "value", new Integer(166),KatelloSystem.ERR_BLANK_KEYNAME},
{ "desc-specChars"+uid, "\\!@%^&*(_-~+=\\||,.)", new Integer(0),null},
{"desc-256Chars"+uid, strRepeat("0123456789", 25)+"abcdef",new Integer(166), "Validation failed: Value is too long (maximum is 255 characters)"},
{strRepeat("0123456789", 25)+"abcdef", "desc-256Chars", new Integer(166), "Validation failed: Keyname is too long (maximum is 255 characters)"},
{ "special chars <h1>html</h1>", "html in keyname", new Integer(0), null},
{ "html in value", "special chars <h1>html</h1>", new Integer(0), null},
{"key-blank-val", "", new Integer(0), null},
{strRepeat("0123456789", 25)+"abcdef", "desc-256Chars", new Integer(166), KatelloSystem.ERR_KEY_TOO_LONG},
{strRepeat("0123456789", 25)+"abcde", "desc-255Chars", new Integer(0), null},
{"desc-255Chars", strRepeat("0123456789", 25)+"abcde", new Integer(0), null},
{"desc-256Chars", strRepeat("0123456789", 25)+"abcdef", new Integer(166), KatelloSystem.ERR_VALUE_TOO_LONG},
{"special:@!#$%^&*()","value_foo@!#$%^&*()", new Integer(0),null},
};
}
/**
* 1. keyname<br>
* 2. keyvalue<br>
* 3. distributor name<br>
* 4. return code<br>
* 5. output/error string
* @return
*/
@DataProvider(name="add_distributor_custom_info")
public static Object[][] add_distributor_custom_info()
{
String uid = KatelloUtils.getUniqueID();
String dis_name = "distAddCustomInfo-"+uid;
return new Object[][]{
{"testkey-"+uid,"testvalue-"+uid,dis_name,new Integer(0), String.format(KatelloDistributor.OUT_INFO,"testkey-"+uid,"testvalue-"+uid,dis_name)},
{"","blank-key"+uid,dis_name,new Integer(166),"Validation failed: Keyname can't be blank"},
{"blank-value"+uid,"",dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,"blank-value"+uid,"",dis_name)},
{strRepeat("0123456789",12)+uid,strRepeat("0134456789",12),dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,strRepeat("0123456789",12)+uid,strRepeat("0134456789",12),dis_name)},
{strRepeat("013456789",30)+uid,strRepeat("013456789",30),dis_name,new Integer(244),""},
{"testkey-"+uid,"duplicate-key"+uid,dis_name,new Integer(166),"Validation failed: Keyname already exists for this object"},
{"duplicate-value"+uid,"testvalue-"+uid,dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,"duplicate-value"+uid,"testvalue-"+uid,dis_name)},
{"\\!@%^&*(_-~+=\\||,.)"+uid,"\\!@%^&*(_-~+=\\||,.)"+uid,dis_name,new Integer(0),String.format(KatelloDistributor.OUT_INFO,"\\!@%^&*(_-~+=\\||,.)"+uid,"\\!@%^&*(_-~+=\\||,.)"+uid,dis_name)},
{"special chars <h1>html</h1>", "html in keyname", dis_name, new Integer(0), String.format(KatelloDistributor.OUT_INFO,"special chars <h1>html</h1>","html in keyname",dis_name)},
{"html in value", "special chars <h1>html</h1>", dis_name, new Integer(0), String.format(KatelloDistributor.OUT_INFO,"html in value","special chars <h1>html</h1>",dis_name)},
};
}
@DataProvider(name="org_add_custom_info")
public static Object[][] org_add_custom_info() {
return new Object[][] {
{ "custom-key", new Integer(0), null},
{ strRepeat("0123456789", 12)+"abcdefgh", new Integer(0), null},
{ "special chars \\!@%^&*(_-~+=\\||,.)", new Integer(0), null},
{ " ", new Integer(166), "Validation failed: Default info cannot contain blank keynames"},
{ "special chars <h1>html</h1>", new Integer(0), null},
{ strRepeat("0123456789", 25)+"abcdef", new Integer(0), null},
};
}
@DataProvider(name="create_distributor")
public static Object[][] create_distributor()
{
String uid = KatelloUtils.getUniqueID();
return new Object[][]{
{"test_distributor"+uid,new Integer(0), String.format(KatelloDistributor.OUT_CREATE,"test_distributor"+uid)},
{"",new Integer(166),"Validation failed: Name can't be blank"},
{strRepeat("0123456789",12)+uid,new Integer(0),String.format(KatelloDistributor.OUT_CREATE,strRepeat("0123456789",12)+uid)},
{strRepeat("0123456789",30)+uid,new Integer(166),"Validation failed: Name is too long (maximum is 250 characters)"},
{"\\!@%^&*(<_-~+=//\\||,.>)"+uid,new Integer(144),""},
{"test_distributor"+uid,new Integer(166),"Validation failed: Name already taken"},
};
}
@DataProvider(name = "user_create")
public static Object[][] user_create(){
String uid = KatelloUtils.getUniqueID();
return new Object[][] {
//name, email, password, disabled
{"newUserName"+uid, "[email protected]", "newUserName", false },
{"նոր օգտվող"+uid, "[email protected]", "նոր օգտվող", false},
{"新用戶"+uid, "[email protected]", "新用戶", false},
{"नए उपयोगकर्ता"+uid, "[email protected]", "नए उपयोगकर्ता", false},
{"нового пользователя"+uid, "[email protected]", "нового пользователя", false},
{"uusi käyttäjä"+uid, "[email protected]", "uusi käyttäjä", false},
{"νέος χρήστης"+uid, "[email protected]", "νέος χρήστης", false},
};
}
@DataProvider(name="changeset_create")
public static Object[][] changeset_create() {
return new Object[][] {
//{String name, String description, Integer exit_code, String output},
{"changeset ok", "", new Integer(0), null},
{"!@#$%^&*()_+{}|:?[];.,", "special characters", new Integer(0), null},
{strRepeat("0123456789", 25)+"abcdef", "too long name", new Integer(166), "Validation failed: Name cannot contain more than 255 characters"},
{"too long description", strRepeat("0123456789", 25)+"abcdef", new Integer(166), "Validation failed: Description cannot contain more than 255 characters"},
{"<h1>changeset</h1>", "html in name", new Integer(0), null},
{"html in description", "<h1>changeset description</h1>", new Integer(0), null},
};
}
}
|
omaciel/katello-api
|
src/com/redhat/qe/katello/base/KatelloCliDataProvider.java
|
2,268 |
package gr.cti.eslate.base.container;
import java.util.ListResourceBundle;
public class WebFileDialogBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"RenameFile", "Μετονομασία αρχείου"},
{"RenameFileName", "Νέο όνομα:"},
{"RenameError", "Λάθος στη μετονομασία του αρχείου"},
{"Error", "Λάθος"},
{"NewDirName", "Δώσε όνομα:"},
{"NewDir", "Νέος Κατάλογος"},
{"ErrorNewDirMsg", "Ο κατάλογος δε δημιουργήθηκε"},
{"ErrorNewDir", "Λάθος"},
{"FilterDescr", "Αρχεία μικρόκοσμων (*.mwd)"},
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/base/container/WebFileDialogBundle_el_GR.java
|
2,273 |
package gr.aueb.softeng.view.Login;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;
import gr.aueb.softeng.memoryDao.MemoryInitializer;
import gr.aueb.softeng.team08.R;
import gr.aueb.softeng.view.Chef.HomePage.ChefHomePageActivity;
import gr.aueb.softeng.view.Customer.ChooseRestaurant.ChooseRestaurantActivity;
import gr.aueb.softeng.view.Owner.HomePage.OwnerHomePageActivity;
import gr.aueb.softeng.view.SignUp.SignUpCustomer.SignUpCustomerActivity;
import gr.aueb.softeng.view.SignUp.SignUpOwner.SignUpOwnerActivity;
import gr.aueb.softeng.view.SignUp.SignUpPersonel.SignUpPersonelActivity;
public class LoginActivity extends AppCompatActivity implements LoginView {
/**
* Εμφανίζει ενα μήνυμα τύπου alert με
* τίτλο title και μήνυμα message.
* @param title Ο τίτλος του μηνύματος
* @param message Το περιεχόμενο του μηνύματος
*/
public void showErrorMessage(String title, String message)
{
new AlertDialog.Builder(LoginActivity.this)
.setCancelable(true)
.setTitle(title)
.setMessage(message)
.setPositiveButton("OK", null).create().show();
}
/**
* Εμφανίζει μήνυμα επιτυχίας όταν ο πελάτης συνδεθεί επιτυχώς τον λογαριασμό του
* και κατευθύνεται στο Home Page ακτίβιτι όταν πατηθεί το κουμπί ΟΚ
*/
public void showCustomerFoundMessage(int id)
{
new AlertDialog.Builder(LoginActivity.this)
.setCancelable(true)
.setTitle("Συγχαρητήρια")
.setMessage("Τα στοιχεία που παραχωρήσατε είναι σωστα")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
redirectToCustomerPage(id);
}
}).create().show();
}
/**
* Εμφανίζει μήνυμα επιτυχίας όταν ο ιδιοκτήτης συνδεθεί επιτυχώς τον λογαριασμό του
* και κατευθύνεται στο Home Page ακτίβιτι όταν πατηθεί το κουμπί ΟΚ
*/
public void showOwnerFoundMessage(int id)
{
new AlertDialog.Builder(LoginActivity.this)
.setCancelable(true)
.setTitle("Συγχαρητήρια")
.setMessage("Τα στοιχεία που παραχωρήσατε είναι σωστα")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
redirectToOwnerHomePage(id);
}
}).create().show();
}
/**
* Εμφανίζει μήνυμα επιτυχίας όταν ο μάγειρας συνδεθεί επιτυχώς τον λογαριασμό του
* και κατευθύνεται στο Home Page ακτίβιτι όταν πατηθεί το κουμπί ΟΚ
*/
public void showChefFoundMessage(int id)
{
new AlertDialog.Builder(LoginActivity.this)
.setCancelable(true)
.setTitle("Συγχαρητήρια")
.setMessage("Τα στοιχεία που παραχωρήσατε είναι σωστα")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
redirectToChefHomePage(id);
}
}).create().show();
}
private LoginViewModel viewModel;
private static boolean initialized = false;
/**
* Δημιουργει το layout και αρχικοποιεί το activity
* Αρχικοποιούμε το view Model και περνάμε στον presenter το view
* Καλούμε τα activities όταν πατηθούν τα κουμπιά της οθόνης
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in {@link #onSaveInstanceState}. <b><i>Note: Otherwise it is null.</i></b>
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_login);
//USED FOR DEBUGGING
MemoryInitializer dataHelper = new MemoryInitializer();
dataHelper.prepareData();
//REMOVE LATER
LoginViewModel viewModel = new ViewModelProvider(this).get(LoginViewModel.class);
viewModel.getPresenter().setView(this);
if (savedInstanceState == null){
Intent intent = getIntent();
}
findViewById(R.id.SignUpCustomerButton).setOnClickListener(new View.OnClickListener() { //το κουμπί όταν θέλει να εγγραφτεί νέος πελάτης στην εφαμοργή
public void onClick(View v) {
viewModel.getPresenter().onSignup();
}
});
findViewById(R.id.SignUpPersonelButton).setOnClickListener(new View.OnClickListener() { // το κουμπί όταν θέλει να εγγραφτεί νέος μάγειρας στην εφαμοργή
public void onClick(View v) {
viewModel.getPresenter().onSignupPersonel();
}
});
findViewById(R.id.SignUpOwnerButton).setOnClickListener(new View.OnClickListener() {// το κουμπί όταν θέλει να εγγραφτεί νέος ιδιοκτήτης στην εφαρμογή
@Override
public void onClick(View v) {
viewModel.getPresenter().onSignupOwner();
}
});
findViewById(R.id.login_button).setOnClickListener(new View.OnClickListener() { // το κουμπί σύνδεσης στην εφαρμογή
@Override
public void onClick(View v) {
viewModel.getPresenter().authenticate();
}
});
}
/**
* Η μέθοδος αυτή λαμβάνει το όνομα που έχει πληκτρολογήσει ο χρήστης στο πεδίο Username
* @return Επιστρέφει το string αυτο
*/
public String ExtractUsername()
{
return ((EditText)findViewById(R.id.usernameText)).getText().toString().trim();
}
/**
* Η μέθδος αυτή λαμβάνει τον κωδικό που έχει πληκτρολογήσει ο χρήστης στο πεδίο PassWord
* @return Επιστρέφει το string αυτό
*/
public String ExtractPassword()
{
return ((EditText)findViewById(R.id.passwordText)).getText().toString().trim();
}
/**
* Η μέθοδος αυτή καλείται όταν πατηθεί το κουμπί εγγραφής για πελάτη
*/
public void signup(){
Intent intent = new Intent(LoginActivity.this, SignUpCustomerActivity.class);
startActivity(intent);
}
/**
* Η μέθοδος αυτή καλείται όταν πατηθεί το κουμπί εγγραφής για μάγειρα
*/
public void signupPersonel() {
Intent intent = new Intent(LoginActivity.this, SignUpPersonelActivity.class);
startActivity(intent);
}
/**
* Η μέθοδος αυτή καλείται όταν πατηθεί το κουμπί εγγραφής για ιδιοκτήτη
*/
public void signupOwner() {
Intent intent = new Intent(LoginActivity.this, SignUpOwnerActivity.class);
startActivity(intent);
}
/**
* Η μέθοδος αυτή ανακατευθύνει τον χρήστη στην σελίδα πελατών εφόσον έχουν ταυτοποιηθεί σωστά τα στοιχεία του
* επίσης περνάει σαν εξτρά πληροφορία στο intent το id του πελάτη
* @param customerId το Id του πελάτη που πάτησε την σύνδεση
*/
public void redirectToCustomerPage(int customerId){
Intent intent = new Intent(LoginActivity.this, ChooseRestaurantActivity.class);
intent.putExtra("CustomerId",customerId);
startActivity(intent);
}
/**
* Η μέθοδος αυτή ανακατευθύνει τον χρήστη στην σελίδα μάγειρων εφόσον έχουν ταυτοποιηθεί σωστά τα στοιχεία του
* επίσης περνάει σαν εξτρά πληροφορία στο intent το id του μάγειρα
* @param chefId το Id του μάγειρα που πάτησε την σύνδεση
*/
public void redirectToChefHomePage(int chefId){
Intent intent = new Intent(LoginActivity.this, ChefHomePageActivity.class);
intent.putExtra("ChefId",chefId);
startActivity(intent);
}
/**
* Η μέθοδος αυτή ανακατευθύνει τον χρήστη στην σελίδα ιδιοκτητών εφόσον έχουν ταυτοποιηθεί σωστά τα στοιχεία του
* επίσης περνάει σαν εξτρά πληροφορία στο intent το id του ιδιοκτήτη
* @param ownerId το Id του ιδιοκτήτη που πάτησε την σύνδεση
*/
public void redirectToOwnerHomePage(int ownerId){
Intent intent = new Intent(LoginActivity.this, OwnerHomePageActivity.class);
intent.putExtra("OwnerId",ownerId);
startActivity(intent);
}
}
|
vleft02/Restaurant-Application
|
app/src/main/java/gr/aueb/softeng/view/Login/LoginActivity.java
|
2,276 |
package jaco.mp3.player.examples;
import jaco.mp3.player.MP3Player;
import java.io.File;
public class Example1 {
public static void main(String[] args) {
new MP3Player(new File("test.mp3")).play();
}
}
|
tolis9981/Mp3-project
|
mp3/Νέος φάκελος/mp3Project/examples/Example1.java
|
2,280 |
package logic;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
*
* Η κλάση αυτή διαβάζει και γράφει στο αρχείο των σκορ .
*
* @author Thanasis
* @author tasosxak
* @since 7/1/2017
* @version 1.0
*/
public class HighScores {
private HighScoresList players;
public HighScores() {
readFile();
}
private void readFile() {
try (ObjectInputStream in = new ObjectInputStream(new FileInputStream("scores.ser"))) { //Διάβασμα του αποθηκευμένου αντικειμένου
players = (HighScoresList) in.readObject();
} catch (IOException | ClassNotFoundException ex) {
players = new HighScoresList(); //Σε περίπτωση που δεν υπάρχει το αρχείο των σκορ, δημιουργείτε νέα λίστα HighScore
}
}
/**
*
* @param curPlayers Η λίστα παιχτών που θα αποθηκευτούν τα highScore
* @throws IOException αν δν μπορει να γραψει στο αρχειο συνηθως αν δν ειναι
* σε φακελο που εχει δικαιωματα να γραψει
*/
public void writeFile(PlayerList curPlayers) throws IOException {
if (curPlayers.getNumOfPlayers() > 0) { //Αν η λίστα δεν είναι άδεια
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("scores.ser"));
Integer highScore, curScore;
int numOfPlayers = curPlayers.getNumOfPlayers();
String name;
if (numOfPlayers == 1) {
name = curPlayers.getNameOfPlayer(1);
if (players.playerExists(name)) { //Αν ο player ήταν ήδη εγγεγραμένος στο αρχείο των σκορ
highScore = players.getScoreOfPlayer(name); //Παίρνει το παλιό σκορ του player
curScore = curPlayers.getScoreOfPlayer(1); //Παίρνει το νέο σκορ του player
if (highScore == null || curScore > highScore) { //Αν το παλιο είναι μικρότερο ή κενό
players.setScoreOfPlayer(curScore, name); //Εγγράφεται το νέο σκορ
}
} else {
players.addPlayer(name); //Προστίθεται το όνομα του νέου παίχτη
players.setScoreOfPlayer(curPlayers.getScoreOfPlayer(1), name); //Θέτει το σκορ του παίχτη στο hashmap με κλειδί το όνομα του παίχτη
}
}else {
int winnersId = curPlayers.getWinnersId();
if (winnersId >= 0) {
for (int i = 1; i <= numOfPlayers; i++) {
name = curPlayers.getNameOfPlayer(i);
if (players.playerExists(name)) {//Αν υπάρχει ο χρήστης στο αρχείο
if (i == winnersId) {
players.playerWon(name);//Προσθέτει μια νίκη στον ήδη υπάρχον παίχτη που κέρδισε το παιχνίδι
}
} else {
players.addPlayer(name); //Προσθέτει καινούργιο παίχτη
if (i == winnersId) {
players.playerWon(name);//Προσθέτει μια νίκη στον καινούργιο παίχτη που κέρδισε το παιχνίδι
}
}
}
}
}
out.writeObject(players); //Γράφει το αντικείμενο με τους παίχτες
out.close();
}
}
/**
*
* @param num Τον αριθμό τον παιχτών με τις περισσότερες νίκες
* @return Επιστρέφει πίνακα με τα num ονομάτα των παιχτών με τις
* περισσότερες νίκες κατά φθίνουσα σειρά
*/
public String[] getNamesForWins(int num) {
return players.getNamesForWins(num);
}
/**
*
* @param num Τον αριθμό τον παιχτών με τις περισσότερες νίκες
* @return Επιστρέφει πίνακα με τις num μεγαλύτερες νίκες κατά φθίνουσα
* σειρά
*/
public Integer[] getTopWins(int num) {
return players.getTopWins(num);
}
/**
*
* @param num Τον αριθμό τον παιχτών με το μεγαλύτερο σκορ
* @return Επιστρέφει πίνακα με τα num ονομάτα των παιχτών με τις
* περισσότερες νίκες κατά φθίνουσα σειρά
*/
public String[] getNamesForHighScores(int num) {
return players.getNamesForHighScores(num);
}
/**
*
* @param num Τον αριθμό τον παιχτών με το μεγαλύτερο σκορ
* @return Επιστρέφει πίνακα με τα num υψηλότερα σκορ κατά φθίνουσα σειρά
*/
public Integer[] getHighScores(int num) {
return players.getHighScores(num);
}
public int getNumOfHighScores() {
return players.getNumOfPlayers();
}
@Override
public String toString() {
return players.toString();
}
}
|
TeamLS/Buzz
|
src/logic/HighScores.java
|
2,283 |
package week1;
public class FlowOfControl {
static public void ContinueAndBreak() {
int z = 10;
for(int i = 0; // Δήλωση και αρχικοποίηση μεταβλητής ελέγχου
i < 10; // Συνθήκη ελέγχου
i++ ){ // Αύξηση κατά ένα μεταβλητής ελέγχου
z--;
if(z == 6) {
System.out.println("CONTINUE");
continue; // Συνέχισε στην επόμενη επανάληψη
} else if(z == 3) {
System.out.println("BREAK");
break; // Διέκοψε το βρόγχο
}
System.out.println("i=" +i + " z="+ z);
}
}
public static void main(String[] a) {
System.out.println("Καλημέρα ");
ContinueAndBreak();
//FlowOfControl antikeimeno = new FlowOfControl();
//antikeimeno.ContinueAndBreak();
}
}
|
YannisTzitzikas/CS252playground
|
CS252playground/src/week1/FlowOfControl.java
|
2,291 |
package com.fivasim.antikythera;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import javax.microedition.khronos.opengles.GL10;
import static com.fivasim.antikythera.Initial.color;
import static com.fivasim.antikythera.Initial.M_PI;
public class Gear {
private float frontface_v[];
private short frontface_i[];
private float rearface_v[];
private short rearface_i[];
private float frontgear_v[];
private short frontgear_i[];
private float reargear_v[];
private short reargear_i[];
private float uppergear_v[];
private short uppergear_i[];
private float innergear_v[];
private short innergear_i[];
private float cross_v[];
private short cross_i[];
private FloatBuffer frontface_vertexBuffer;
private ShortBuffer frontface_indexBuffer;
private FloatBuffer rearface_vertexBuffer;
private ShortBuffer rearface_indexBuffer;
private FloatBuffer frontgear_vertexBuffer;
private ShortBuffer frontgear_indexBuffer;
private FloatBuffer reargear_vertexBuffer;
private ShortBuffer reargear_indexBuffer;
private FloatBuffer uppergear_vertexBuffer;
private ShortBuffer uppergear_indexBuffer;
private FloatBuffer innergear_vertexBuffer;
private ShortBuffer innergear_indexBuffer;
private FloatBuffer cross_vertexBuffer;
private ShortBuffer cross_indexBuffer;
public Gear( float[] geardata )
{
float inner_radius = geardata[0];
float outer_radius = geardata[1];
float width = geardata[2];
int teeth = (int)geardata[3];
float tooth_depth = 0f;
int cross = 0;
if (geardata.length > 4) {
tooth_depth = geardata[4];
cross = (int)geardata[5];
}
int i;
float r0, r1, r2;
float angle, da;
//float u, v;
frontface_i = new short[teeth+3];
frontface_v = new float[3*(teeth+3)];
rearface_i = new short[teeth+3];
rearface_v = new float[3*(teeth+3)];
frontgear_i = new short[3*teeth];
frontgear_v = new float[9*teeth];
reargear_i = new short[3*teeth];
reargear_v = new float[9*teeth];
uppergear_i = new short[4*(teeth+1)];
uppergear_v = new float[12*(teeth+1)];
innergear_i = new short[2*(teeth+1)];
innergear_v = new float[6*(teeth+1)];
cross_i = new short[11*cross];
cross_v = new float[33*cross];
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 1.8f; //ακτίνα δίσκου (χωρίς τα δόντια)
r2 = outer_radius + tooth_depth / 2.2f; //ακτίνα μαζί με τα δόντια
da = 2.0f * M_PI / teeth / 4.0f;
short count = 0;
//κυκλική μπροστινή όψη γραναζιού
for (i = 0; i <= teeth+2; i++) {
angle = i * 2.0f * M_PI / teeth;
if(i%2==0) {
frontface_v[count] = (float)(r0 * (float)Math.cos(angle)); count++;
frontface_v[count] = (float)(r0 * (float)Math.sin(angle)); count++;
frontface_v[count] = (float)(width * 0.5f); count++;
}else{
frontface_v[count] = (float)(r1 * (float)Math.cos(angle)); count++;
frontface_v[count] = (float)(r1 * (float)Math.sin(angle)); count++;
frontface_v[count] = (float)(width * 0.5f); count++;
}
frontface_i[i]=(short)i;
}
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb1 = ByteBuffer.allocateDirect(frontface_v.length * 4);
vbb1.order(ByteOrder.nativeOrder());
frontface_vertexBuffer = vbb1.asFloatBuffer();
frontface_vertexBuffer.put(frontface_v);
frontface_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb1 = ByteBuffer.allocateDirect(frontface_i.length * 2);
ibb1.order(ByteOrder.nativeOrder());
frontface_indexBuffer = ibb1.asShortBuffer();
frontface_indexBuffer.put(frontface_i);
frontface_indexBuffer.position(0);
//μπροστινή όψη δοντιών
count = 0;
short count_i=0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * M_PI / teeth;
frontgear_v[count] = (float)( (r1-0.1) * Math.cos(angle)); count++;
frontgear_v[count] = (float)( (r1-0.1) * Math.sin(angle)); count++;
frontgear_v[count] = (float)(width * 0.5f); count++;
frontgear_i[count_i]=count_i;count_i++;
frontgear_v[count] = (float)(r2 * Math.cos(angle + 2 * da)); count++;
frontgear_v[count] = (float)(r2 * Math.sin(angle + 2 * da)); count++;
frontgear_v[count] = (float)(width * 0.5f); count++;
frontgear_i[count_i]=count_i;count_i++;
frontgear_v[count] = (float)( (r1-0.1) * Math.cos(angle + 4 * da)); count++;
frontgear_v[count] = (float)( (r1-0.1) * Math.sin(angle + 4 * da)); count++;
frontgear_v[count] = (float)(width * 0.5f); count++;
frontgear_i[count_i]=count_i;count_i++;
}
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb2 = ByteBuffer.allocateDirect(frontgear_v.length * 4);
vbb2.order(ByteOrder.nativeOrder());
frontgear_vertexBuffer = vbb2.asFloatBuffer();
frontgear_vertexBuffer.put(frontgear_v);
frontgear_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb2 = ByteBuffer.allocateDirect(frontgear_i.length * 2);
ibb2.order(ByteOrder.nativeOrder());
frontgear_indexBuffer = ibb2.asShortBuffer();
frontgear_indexBuffer.put(frontgear_i);
frontgear_indexBuffer.position(0);
//κυκλική πίσω όψη γραναζιού
if (teeth == 222 ) {r0 = 30f;}//stupid small depth buffer
if (teeth == 223 ) {r0 = 22.9f;}//stupid small depth buffer
count = 0;
for (i = 0; i <= teeth+2; i++) {
angle = i * 2.0f * M_PI / teeth;
if(i%2==0) {
rearface_v[count] = (float)(r0 * Math.cos(angle)); count++;
rearface_v[count] = (float)(r0 * Math.sin(angle)); count++;
rearface_v[count] = (float)(-width * 0.5f); count++;
}else{
rearface_v[count] = (float)(r1 * Math.cos(angle)); count++;
rearface_v[count] = (float)(r1 * Math.sin(angle)); count++;
rearface_v[count] = (float)(-width * 0.5f); count++;
}
rearface_i[i]=(short)i;
}
if (teeth == 222 ) {r0 = 12f;}//stupid small depth buffer
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb3 = ByteBuffer.allocateDirect(rearface_v.length * 4);
vbb3.order(ByteOrder.nativeOrder());
rearface_vertexBuffer = vbb3.asFloatBuffer();
rearface_vertexBuffer.put(rearface_v);
rearface_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb3 = ByteBuffer.allocateDirect(rearface_i.length * 2);
ibb3.order(ByteOrder.nativeOrder());
rearface_indexBuffer = ibb3.asShortBuffer();
rearface_indexBuffer.put(rearface_i);
rearface_indexBuffer.position(0);
//πίσω όψη δοντιών
count = 0;
count_i=0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * M_PI / teeth;
reargear_v[count] = (float)( (r1-0.1) * Math.cos(angle)); count++;
reargear_v[count] = (float)( (r1-0.1) * Math.sin(angle)); count++;
reargear_v[count] = (float)(-width * 0.5f); count++;
reargear_i[count_i]=count_i;count_i++;
reargear_v[count] = (float)(r2 * Math.cos(angle + 2 * da)); count++;
reargear_v[count] = (float)(r2 * Math.sin(angle + 2 * da)); count++;
reargear_v[count] = (float)(-width * 0.5f); count++;
reargear_i[count_i]=count_i;count_i++;
reargear_v[count] = (float)( (r1-0.1) * Math.cos(angle + 4 * da)); count++;
reargear_v[count] = (float)( (r1-0.1) * Math.sin(angle + 4 * da)); count++;
reargear_v[count] = (float)(-width * 0.5f); count++;
reargear_i[count_i]=count_i;count_i++;
}
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb4 = ByteBuffer.allocateDirect(reargear_v.length * 4);
vbb4.order(ByteOrder.nativeOrder());
reargear_vertexBuffer = vbb4.asFloatBuffer();
reargear_vertexBuffer.put(reargear_v);
reargear_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb4 = ByteBuffer.allocateDirect(reargear_i.length * 2);
ibb4.order(ByteOrder.nativeOrder());
reargear_indexBuffer = ibb4.asShortBuffer();
reargear_indexBuffer.put(reargear_i);
reargear_indexBuffer.position(0);
//εξωτερική όψη δοντιών
count = 0;
count_i=0;
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * M_PI / teeth;
uppergear_v[count] = (float)( (r1-0.1) * Math.cos(angle)); count++;
uppergear_v[count] = (float)( (r1-0.1) * Math.sin(angle)); count++;
uppergear_v[count] = (float)(width * 0.5f); count++;
uppergear_i[count_i]=count_i;count_i++;
uppergear_v[count] = (float)( (r1-0.1) * Math.cos(angle)); count++;
uppergear_v[count] = (float)( (r1-0.1) * Math.sin(angle)); count++;
uppergear_v[count] = (float)(-width * 0.5f); count++;
uppergear_i[count_i]=count_i;count_i++;
uppergear_v[count] = (float)(r2 * Math.cos(angle + 2 * da)); count++;
uppergear_v[count] = (float)(r2 * Math.sin(angle + 2 * da)); count++;
uppergear_v[count] = (float)(width * 0.5f); count++;
uppergear_i[count_i]=count_i;count_i++;
uppergear_v[count] = (float)(r2 * Math.cos(angle + 2 * da)); count++;
uppergear_v[count] = (float)(r2 * Math.sin(angle + 2 * da)); count++;
uppergear_v[count] = (float)(-width * 0.5f); count++;
uppergear_i[count_i]=count_i;count_i++;
}
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb5 = ByteBuffer.allocateDirect(uppergear_v.length * 4);
vbb5.order(ByteOrder.nativeOrder());
uppergear_vertexBuffer = vbb5.asFloatBuffer();
uppergear_vertexBuffer.put(uppergear_v);
uppergear_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb5 = ByteBuffer.allocateDirect(uppergear_i.length * 2);
ibb5.order(ByteOrder.nativeOrder());
uppergear_indexBuffer = ibb5.asShortBuffer();
uppergear_indexBuffer.put(uppergear_i);
uppergear_indexBuffer.position(0);
//εσωτερικός κύλινδρος (τρύπα στο κέντρο)
count = 0;
count_i=0;
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * M_PI / teeth;
innergear_v[count] = (float)(r0 * Math.cos(angle)); count++;
innergear_v[count] = (float)(r0 * Math.sin(angle)); count++;
innergear_v[count] = (float)(-width * 0.5f); count++;
innergear_i[count_i]=count_i;count_i++;
innergear_v[count] = (float)(r0 * Math.cos(angle)); count++;
innergear_v[count] = (float)(r0 * Math.sin(angle)); count++;
innergear_v[count] = (float)(width * 0.5f); count++;
innergear_i[count_i]=count_i;count_i++;
}
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb6 = ByteBuffer.allocateDirect(innergear_v.length * 4);
vbb6.order(ByteOrder.nativeOrder());
innergear_vertexBuffer = vbb6.asFloatBuffer();
innergear_vertexBuffer.put(innergear_v);
innergear_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb6 = ByteBuffer.allocateDirect(innergear_i.length * 2);
ibb6.order(ByteOrder.nativeOrder());
innergear_indexBuffer = ibb6.asShortBuffer();
innergear_indexBuffer.put(innergear_i);
innergear_indexBuffer.position(0);
//Βραχίονες γραναζιού
count = 0;
count_i=0;
if ( (cross>0) & (r0>0.0f) ) {
float length = (r0 + r1)/2; //Μήκος βραχίονα
float thicknessy = r0 * 0.2f; //Πάχος βραχίονα κατά την διάμετρο του γραναζιού
float thicknessz = width * 0.8f; //Πάχος βραχίονα κατά το πάχος του γραναζιού
//Βραχίονας δείκτη
if(cross>=1) {
//front1
cross_v[count] = length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
cross_v[count] = -length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
cross_v[count] = length; count++;
cross_v[count] = (float)( thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//front2
cross_v[count] = -length; count++;
cross_v[count] = (float)( thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//up1
cross_v[count] = length; count++;
cross_v[count] = (float)( thicknessy/2); count++;
cross_v[count] = (float)( thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//up2
cross_v[count] = -length; count++;
cross_v[count] = (float)( thicknessy/2); count++;
cross_v[count] = (float)( thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//back1
cross_v[count] = length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)( thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//back2
cross_v[count] = -length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)( thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//down1
cross_v[count] = length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//down2
cross_v[count] = -length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
//final bound with beginning
cross_v[count] = length; count++;
cross_v[count] = (float)(-thicknessy/2); count++;
cross_v[count] = (float)(-thicknessz/2); count++;
cross_i[count_i]=count_i;count_i++;
}
}
// a float is 4 bytes, therefore we multiply the number of vertices with 4.
ByteBuffer vbb7 = ByteBuffer.allocateDirect(cross_v.length * 4);
vbb7.order(ByteOrder.nativeOrder());
cross_vertexBuffer = vbb7.asFloatBuffer();
cross_vertexBuffer.put(cross_v);
cross_vertexBuffer.position(0);
// short is 2 bytes, therefore we multiply the number of vertices with 2.
ByteBuffer ibb7 = ByteBuffer.allocateDirect(cross_i.length * 2);
ibb7.order(ByteOrder.nativeOrder());
cross_indexBuffer = ibb7.asShortBuffer();
cross_indexBuffer.put(cross_i);
cross_indexBuffer.position(0);
}
public void draw(GL10 gl, int color_pointer ) {
// Counter-clockwise winding.
gl.glFrontFace(GL10.GL_CCW);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glCullFace(GL10.GL_BACK);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
// Specifies the location and data format of an array of vertex coordinates to use when rendering.
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, frontface_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, frontface_i.length, GL10.GL_UNSIGNED_SHORT, frontface_indexBuffer);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, frontgear_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLES, frontgear_i.length, GL10.GL_UNSIGNED_SHORT, frontgear_indexBuffer);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, uppergear_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, uppergear_i.length, GL10.GL_UNSIGNED_SHORT, uppergear_indexBuffer);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, innergear_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, innergear_i.length, GL10.GL_UNSIGNED_SHORT, innergear_indexBuffer);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, cross_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, cross_i.length, GL10.GL_UNSIGNED_SHORT, cross_indexBuffer);
gl.glDisable(GL10.GL_CULL_FACE);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glCullFace(GL10.GL_FRONT);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, rearface_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, rearface_i.length, GL10.GL_UNSIGNED_SHORT, rearface_indexBuffer);
gl.glColor4f( color[color_pointer][0], color[color_pointer][1], color[color_pointer][2], color[color_pointer][3] );
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, reargear_vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLES, reargear_i.length, GL10.GL_UNSIGNED_SHORT, reargear_indexBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisable(GL10.GL_CULL_FACE);
}
}
|
fivasim/Antikythera-Simulation
|
Antikythera/src/com/fivasim/antikythera/Gear.java
|
2,296 |
package gr.thmmy.mthmmy.activities.topic;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import java.io.IOException;
import okhttp3.Response;
import timber.log.Timber;
/**
* This is a utility class containing a collection of static methods to help with topic replying.
*/
public class Posting {
/**
* {@link REPLY_STATUS} enum defines the different possible outcomes of a topic reply request.
*/
public enum REPLY_STATUS {
/**
* The request was successful
*/
SUCCESSFUL,
/**
* Request was lacking a subject
*/
NO_SUBJECT,
/**
* Request had empty body
*/
EMPTY_BODY,
/**
* There were new topic replies while making the request
*/
NEW_REPLY_WHILE_POSTING,
/**
* Error 404, page was not found
*/
NOT_FOUND,
/**
* User session ended while posting the reply
*/
SESSION_ENDED,
/**
* Other undefined of unidentified error
*/
OTHER_ERROR
}
/**
* This method can be used to check whether a topic post request was successful or not and if
* not maybe get the reason why.
*
* @param response {@link okhttp3.Response} of the request
* @return a {@link REPLY_STATUS} that describes the response status
* @throws IOException method relies to {@link org.jsoup.Jsoup#parse(String)}
*/
public static REPLY_STATUS replyStatus(Response response) throws IOException {
if (response.code() == 404) return REPLY_STATUS.NOT_FOUND;
if (response.code() < 200 || response.code() >= 400) return REPLY_STATUS.OTHER_ERROR;
String finalUrl = response.request().url().toString();
if (finalUrl.contains("action=post")) {
Document postErrorPage = Jsoup.parse(response.body().string());
Element errorsElement = postErrorPage.select("tr[id=errors] div[id=error_list]").first();
if (errorsElement != null) {
String[] errors = errorsElement.toString().split("<br>");
for (int i = 0; i < errors.length; ++i) { //TODO test
Timber.d(String.valueOf(i));
Timber.d(errors[i]);
}
for (String error : errors) {
if (error.contains("Your session timed out while posting") ||
error.contains("Υπερβήκατε τον μέγιστο χρόνο σύνδεσης κατά την αποστολή"))
return REPLY_STATUS.SESSION_ENDED;
if (error.contains("No subject was filled in")
|| error.contains("Δεν δόθηκε τίτλος"))
return REPLY_STATUS.NO_SUBJECT;
if (error.contains("The message body was left empty")
|| error.contains("Δεν δόθηκε κείμενο για το μήνυμα"))
return REPLY_STATUS.EMPTY_BODY;
}
}
return REPLY_STATUS.NEW_REPLY_WHILE_POSTING;
}
return REPLY_STATUS.SUCCESSFUL;
}
}
|
THMMYgr/mTHMMY
|
app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java
|
2,298 |
// Δομές δεδομένων - Άσκηση 2.1 - Ζάρια
public class Main {
public static void main(String[] args) {
final int MAX_DICE_ROLLS = 30000;
final int MAX_DIE_RESULT = 11;
Die die1 = new Die();
Die die2 = new Die();
int[] diceRollsArray = new int[MAX_DIE_RESULT];
// for (int i = 0; i < MAX_DIE_RESULT; i++) // Αρχικοποίηση πίνακα αποτελεσμάτων. Πιθανόν δεν χρειάζεται
// diceRollsArray[i] = 0;
for (int i = 0; i < MAX_DICE_ROLLS; i++) // Γέμισμα πίνακα αποτελεσμάτων
diceRollsArray[(die1.rollDie() + die2.rollDie()) - 2]++; // Αύξηση κατά 1 της θέσης που ταιριάζει με το αποτέλεσμα της ρίψης.
// Η θέση είναι +2 επειδή η αρίθμηση των θέσεων των πινάκων ξεκινάει απ' το 0.
for (int i = 0; i < MAX_DIE_RESULT; i++) // Εμφάνιση αποτελεσμάτων
System.out.println("Τα ζάρια έφεραν " + (i + 2) + " [" + diceRollsArray[i] + "] φορές."); // Η θέση είναι i + 2 επειδή η αρίθμηση των θέσεων των πινάκων ξεκινάει απ' το 0.
}
}
|
panosale/DIPAE_DataStructures_3rd_Term
|
Askisi1(2.1)/src/Main.java
|
2,300 |
package makisp.gohome;
import android.content.Intent;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
/*** Created by Stamatis Dachretzis.*/
public class IntroActivity extends AppCompatActivity {
public Button buttonContinue;
///// Event Handler για άνοιγμα του GameActivity /////
public void init() {
buttonContinue = (Button) findViewById(R.id.buttonContinue);
buttonContinue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(IntroActivity.this, GameActivity.class));
}
});
}
@Override
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro);
init();
//Ήχος κατά την εκκίνηση του Activity
final MediaPlayer mp = MediaPlayer.create(this, R.raw.thunder);
mp.start();
}
}
|
teicm-project/go-home
|
app/src/main/java/makisp/gohome/IntroActivity.java
|
2,301 |
package gr.aueb.cf.ch2;
import java.util.Scanner;
/**
* Ζητάει από τον χρήστη τρεις ακεραίους,
* τους μειώνει κατά μία μονάδα και τους
* εμφανίζει με την ίδια σειρά που δόθηκαν
* αφήνοντας ένα κενό ανάμεσά τους.
*/
public class ThreeNumbersApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num1 = 0;
int num2 = 0;
int num3 = 0;
System.out.println("Please insert three integers");
num1 = scanner.nextInt();
num2 = scanner.nextInt();
num3 = scanner.nextInt();
// num1 = num1 - 1;
// num1 -= 1;
num1--;
num2--;
num3--;
System.out.printf("%d %d %d", num1, num2, num3);
}
}
|
a8anassis/codingfactory23a
|
src/gr/aueb/cf/ch2/ThreeNumbersApp.java
|
2,303 |
package gr.aueb.cf.ch8;
import java.util.Scanner;
/*Άσκηση κεφαλαίου:
* Εκτυπώνει ένα μενού -
* εμφανίζει κατάλληλο μήνυμα μετά την επιλογή από τον χρήστη -
* πιάνει 2 exceptions
* πρώτο - αν δε δοθεί ακέραιος
* δεύτερο - αν δοθεί ακέραιος έξω από το εύρος του μενού
* */
public class MenuApp {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
int choice = 0;
printMenu();
choice = getChoice("Παρακαλώ επιλέξτε ένα από τα παραπάνω: ");
printChoice(choice);
// έλεγχος του IllegalArgumentException
try {
boolean isChoiceInvalid = isChoiceInvalid(choice); {
}
} catch (IllegalArgumentException e) {
// e.printStackTrace();
System.out.println("Μη έγκυρη επιλογή!");
// throw e;
}
}
// Η εκτύπωση του μενού
public static void printMenu() {
System.out.println("Διαβάστε το μενού:");
System.out.println("1. Εισαγωγή");
System.out.println("2. Ενημέρωση");
System.out.println("3. Διαγραφή");
System.out.println("4. Αναζήτηση");
System.out.println("5. Έξοδος");
}
// Ο έλεγχος για μη ακέραιο
public static int getChoice(String message) {
System.out.println(message);
do {
if (in.hasNextInt()) {
System.out.println();
} else {
System.out.println("Παρακαλώ πληκτρολογήστε έναν αριθμό από το 1 ως το 5");
in.nextLine();
continue;
}
return in.nextInt();
} while (true);
}
//Η εμφάνιση του μηνύματος κατά την επιλογή από τον χρήστη
public static void printChoice(int choice) {
do {
if (choice < 1 || choice > 5) {
System.out.println("Μη έγκυρη επιλογή!");
break;
}
if (choice == 5) {
System.out.println("Επιλέξατε Έξοδο");
break;
}
if (choice == 1) {
System.out.println("Επιλέξατε Εισαγωγή");
break;
} else if (choice == 2) {
System.out.println("Επιλέξατε Ενημέρωση");
break;
} else if (choice == 3) {
System.out.println("Επιλέξατε Διαγραφή");
break;
} else {
System.out.println("Επιλέξατε Αναζήτηση");
break;
}
}while (true) ;
}
//χρησιμοποιείται για να εκφραστεί η περίπτωση του ακεραίου εκτός του εύρους 1-5
public static boolean isChoiceInvalid(int choice) throws IllegalArgumentException{
return choice < 1 || choice > 5;
}
}
|
Mariamakr/codingfactory23a
|
src/gr/aueb/cf/ch8/MenuApp.java
|
2,304 |
package gr.aueb.cf.ch6;
/**
* Το unsized init μπορεί να χρησιμοποιηθεί
* μόνο κατά τη στιγμή της δήλωσης ενώ το
* array initializer είναι πιο ευέλικτο.
*/
public class ArrayInitializerApp {
public static void main(String[] args) {
int[] ages;
// Array initializer
ages = new int[] {1, 2, 3, 4};
for (int i = 0; i < ages.length; i++) {
System.out.print(ages[i]);
}
}
}
|
a8anassis/cf4
|
src/gr/aueb/cf/ch6/ArrayInitializerApp.java
|
2,307 |
/*
Ένα δυαδικό δέντρο ονομάζεται Σωρός(heap) μεγίστων(ή ελαχίστων)
όταν ισχύουν οι επιπλέον παρακάτω προυποθέσεις:
(α) το Δυαδικό Δέντρο είναι σχεδόν πλήρες(έχει όλους τουσ κόμβους επιπέδου N-1 ...)
(β) οι τιμές των κόμβων είναι τοποθετημένες με τέτοιο τρόπο ώστε ο κάθε κόμβος
πατέρας να έχει μεγαλύτερη(ή μικρότερη) τιμή από τα παιδιά του.
*/
public interface HeapInterface
{
public int size();
//Επιστρέφει το μέγεθος του σωρού (αριθμό των στοιχείων του).
public boolean isEmpty();
//Επιστρέφει true αν ο σωρός είναι άδειος, false στην αντίθετη περίπτωση.
public boolean isFull();
//Επιστρέφει true αν ο σωρός είναι γεμάτος, αλλιώς false άν είναι άδειος.
//(υπερχείλιση σωρού).
public void insert(Object item) throws HeapFullException;
//Εισάγει ένα νέο στοιχείο στο σωρό.
public Object remove() throws HeapEmptyException;
//Διαγράφει και επιστρέφει το στοιχείο που βρίσκεται στη ρίζα του σωρού.
public Object[] HeapSort();
//Ταξινομεί όλα τα στοιχεία του Σωρού(Heap) κατά αύξουσα (ή φθίνουσα) σειρά.
}
|
alexoiik/Data-Structures-Java
|
DataStructures_Ex6(Heaps)/src/HeapInterface.java
|
2,308 |
package gr.aueb.cf.ch2;
import java.util.Scanner;
/**
* Ζητάει από το χρήστη τρεις ακεραίους,
* τους μειώνει κατά μια μονάδα και τους
* εμφανίζει με την ίδια σειρά που δόθηκαν
* αφήνοντας ένα κενό ανάμεσα τους.
*/
public class ThreeNumbersApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num1 = 0;
int num2 = 0;
int num3 = 0;
System.out.println("Please insert three integers");
num1 = scanner.nextInt();
num2 = scanner.nextInt();
num3 = scanner.nextInt();
// num1 = num1 - 1;
// num1 -= 1;
num1--;
num2--;
num3--;
System.out.printf("%d %d %d", num1, num2, num3);
}
}
|
kyrkyp/CodingFactoryJava
|
src/gr/aueb/cf/ch2/ThreeNumbersApp.java
|
2,309 |
package gr.aueb.cf.ch2;
import java.util.Scanner;
/**
* Ζητάει απο τον χρήστη τρεις ακεραίους,
* τους μειώνει κατά μια μονάδα και τους
* εμφανίζει με την ίδια σειρά που δόθηκαν
* αφήνοντας ενα κενό ανάμεσα τους.
*/
public class ThreeNumbersApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num1 = 0;
int num2 = 0;
int num3 = 0;
System.out.println("Please insert 3 integers");
num1 = scanner.nextInt();
num2 = scanner.nextInt();
num3 = scanner.nextInt();
// num1 = num1 - 1;
// num1 -= 1;
num1--;
num2--;
num3--;
System.out.printf("%d %d %d", num1, num2, num3);
}
}
|
jordanpapaditsas/codingfactory-java
|
src/gr/aueb/cf/ch2/ThreeNumbersApp.java
|
2,310 |
package gr.aueb.cf.ch2;
import java.util.Scanner;
/**
* Ζητάει από τον χρήστη τρεις ακεραίους,
* τους μειώνει κατά μία μονάδα και τους
* εμφανίζει με την ίδια σειρά που δόθηκαν
* αφήνοντας ένα κενό ανάμεσα τους.
*/
public class ThreeNumbersApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num1 = 0;
int num2 = 0;
int num3 = 0;
System.out.println("Please insert three integers");
num1 = scanner.nextInt();
num2 = scanner.nextInt();
num3 = scanner.nextInt();
// num1 = num1 - 1;
// num1 -= 1;
num1--;
num2--;
num3--;
System.out.printf("%d %d %d", num1, num2, num3);
}
}
|
Mariamakr/codingfactory23a
|
src/gr/aueb/cf/ch2/ThreeNumbersApp.java
|
2,311 |
package thesis;
/**
* @author Nektarios Gkouvousis
* @author ice18390193
*
* Η κλάση Logs είναι υπεύθυνη για την καταγραφή ενός ιστορικού (log) όλων των
* προβλημάτων που μπορεί να αντιμετωπίσει ο χρήστης κατά την λειτουργία του προγράμματος.
*/
public class Logs{
private String log;
private int index;
Logs(){
log = "";
index = 0;
}
public String getLoggerTxt(){
return log;
}
public void appendLogger(String x){
log = log + x + "\n";
}
public int getIndex(){
index = index + 1;
return index;
}
public String getIndexString(){
index = index + 1;
return index+") ";
}
public void loggerClear(){
log = "";
}
}
|
Gouvo7/Exam-Schedule-Creator
|
src/thesis/Logs.java
|
2,312 |
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.border.EmptyBorder;
import javax.swing.*;
import java.sql.*;
import java.util.ArrayList;
public class EggrafesFrame extends JFrame {
private Connection conn;
public EggrafesFrame() {
String url = "jdbc:mysql://localhost:3307/persons";
String username="appuser";
String password = "Xontroula12345@";
try {
conn = DriverManager.getConnection(url, username, password);
System.out.println("Syndethika me thn vash!");
} catch (SQLException e1) {
System.out.println(e1.toString());
}
setSize(700, 350);
[5]
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
set_view("main");
}
// kapoy edw tha syndethw sthn vash
// kai edw tha grapsw synarthseis gia na epikoinwnw me thn vash
public void set_view(String view) {
getContentPane().removeAll(); // diagrafw ta periexomena toy pane toy
frame
if(view.equals("main")) {
getContentPane().add(new MainPanel(this));
}
else if(view.equals("search")) {
getContentPane().add(new SearchPanel(this));
}
else if(view.equals("insert")) {
getContentPane().add(new InsertPanel(this));
}
pack();
}
public void set_view(ArrayList<Employee> empl) {
getContentPane().removeAll(); // diagrafw ta periexomena toy pane toy
frame
getContentPane().add(new ViewPanel(this, empl));
[6]
pack();
}
//public void insert_employee_to_db(int id, String name, String last_name, Position
pos) {
//PreparedStatement ps = conn.prepareStatement("INSERT INTO persons
(id, name, surname, position) ", ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
//}
public void insert_employee_to_db(int id, String name, String last_name, Position
pos) {
try {
String query = "INSERT INTO persons (id, name, surname, position) VALUES (?, ?,
?, ?)";
PreparedStatement ps = conn.prepareStatement(query);
ps.setInt(1, id);
ps.setString(2, name);
ps.setString(3, last_name);
ps.setInt(4, pos.ordinal());
ps.executeUpdate();
System.out.println("Ο εργαζόμενος εισήχθη με επιτυχία στη βάση
δεδομένων.");
} catch (SQLException e) {
System.out.println("Σφάλμα κατά την εισαγωγή του εργαζομένου στη βάση
δεδομένων: " + e.getMessage());
}
}
public ArrayList<Employee> select_employees_from_db(String lname) {
ArrayList<Employee> employee_list = new ArrayList<>();
[7]
try {
// 2. Create a statement
Statement statement = conn.createStatement();
// 3. Execute SQL query
ResultSet resultSet = statement.executeQuery("SELECT * FROM persons WHERE
surname = \"" + lname + "\"");
// 4. Process the result set
while (resultSet.next()) {
int id = resultSet.getInt("id");
String name = resultSet.getString("name");
String surname = resultSet.getString("surname");
int pos_int = resultSet.getInt("position");
Position pos;
if(pos_int == 0) {
pos = Position.DEVELOPER;
} else if(pos_int == 1) {
pos = Position.TESTER;
}
else {
pos = Position.MANAGER;
}
Employee new_employee = new Employee(id, name, surname, pos);
employee_list.add(new_employee);
}
}catch (Exception e){
System.out.println("Σφάλμα κατά την φόρτωση των εργαζομένων
απ' τη βάση δεδομένων: " + e.getMessage());
return null;
}
[8]
return employee_list;
}
public boolean delete_employee_from_db(int id) {
int rowsAffected = 0;
try {
Statement statement = conn.createStatement();
rowsAffected = statement.executeUpdate("DELETE FROM persons WHERE
id = " + id);
System.out.println("Deleted " + rowsAffected + " row(s).");
} catch (SQLException e) {
e.printStackTrace();
}
if(rowsAffected > 0) {
return true;
}
return false;
}
public void update_employee_on_db(int id, String name, String last_name, Position
pos) {
if(delete_employee_from_db(id)) {
insert_employee_to_db(id, name, last_name, pos);
System.out.println("Succesfully updated " + id);
}
else {
System.out.println("Non existent id");
}
[9]
}
// ti thelw apthn vash dedomenwn:
// 1. insert (otan pataw to koympi "Eisagwgh" sto insert panel)
// 2. select (otan pataw to koympi "Anazhthsh Ypallhloy" sto search
panel) kai tha ta deixnei sto view panel
// 3. delete (otan pataw to koympi "Diagrafh" sto view panel - tha to
diagrafei apthn vash dedomenwn (dld aplws tha diagrafw mia grammh) kai apthn efarmogh
// 4. enhmerwsh (otan pataw to koympi "enhmerwsh" sto view
panel)
}
|
myrtokam/java_ergasia
|
EggraferFrame.java
|
2,313 |
import java.util.ArrayList;
import java.util.Scanner;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.ParseException;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.StringReader;
public class ManagerConsole {
public static void main(String[] args) throws IOException {
String filepath= "/Users/pckiousis/Desktop/App_forRoom_Man/App_forRoom_Man";
JSONParser parser = new JSONParser();
try {
String content = new String(Files.readAllBytes(Paths.get(filepath)), StandardCharsets.UTF_8);
StringReader reader = new StringReader(content);
Object obj = parser.parse(reader);
JSONArray array = (JSONArray) obj;
String jsonText = array.toString();
ManagerConsole console = new ManagerConsole();
console.sendAccommodationDetails("masterHostAddress", 8380, jsonText); // Replace with actual host and port
} catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage());
e.printStackTrace();
} catch (Exception e) {
System.err.println("Error parsing JSON: " + e.getMessage());
e.printStackTrace();
}
}
public void sendAccommodationDetails(String host, int port, String accommodationDetails) {
try (Socket socket = new Socket(host, port);
DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream())) {
// Αποστολή των στοιχείων του καταλύματος
outputStream.writeUTF(accommodationDetails);
outputStream.flush();
System.out.println("Room details sent to master successfully.");
} catch (UnknownHostException e) {
System.err.println("Host not found: " + host);
e.printStackTrace();
} catch (IOException e) {
System.err.println("Σφάλμα κατά την επικοινωνία με τον master στον host " + host + " στη θύρα " + port);
e.printStackTrace();
}
}
}
|
Ioanna-jpg/GetaRoom-App
|
backend/src/ManagerConsole.java
|
2,315 |
/**
* Αυτή η κλάση αναπαριστά ένα ηλεκτρικό σκούτερ και είναι νέο μοντέλο του Scooter. Η κλάση αυτή επεκτείνει την scooter.
* This class represent an electrical scooter and it a new model of scooter. This class should extend the Scooter class.
*/
public class ElectricalScooter extends Scooter {
private int chargingTime;
/**
* Κατασκευαστής / Constructor
* @param maxKM Ο μέγιστος αριθμός χιλιομέτρων που μπορεί να διανύσει με ένα γέμισμα. The maximum number of
* kilometers you can travel with a full tank.
* @param year Το έτος κυκλοφορίας του οχήματος, the release year of the vehicle.
* @param chargingTime Ο χρόνος φόρτισης της μπαταρίας σε λεπτά, the charging time of the battery in minutes
*/
public ElectricalScooter(int maxKM, int year, int chargingTime) {
super(maxKM, year);
this.chargingTime = chargingTime;
}
/**
* @return Το χρόνο πλήρους φόρτισης, the charging time of the battery
*/
public int getChargingTime() {
return chargingTime;
}
/**
* Κάθε όχημα χαρακτηρίζεται από μια βαθμολογία ανάλογα με τους ρύπου που παράγει. Το σκορ αυτό είναι ίσο με τον
* χρόνο φόρτισης της μπαταριάς επί τον μέσο αριθμό φορτίσεων ανα έτος (300), διά το σύνολο των ημερών ενός
* έτους (365)
* Each vehicle has a score that represents the pollutants that produces. This score equals the charging time \
* multiplied by the average number of charging during a year (300), divided by the number of days
* in a year (365)
* @return Το σκορ μόλυνσης του περιβάλλοντος, the pollution score.
*/
public double getPollutionScore() {
return this.chargingTime * 300 / 365d;
}
/**
* Μέθοδος που υπολογίζει τα τέλη κυκλοφορίας του οχήματος. Τα τέλη κυκλοφορίας ισούται με τον έτη που κυκλοφορεί το
* όχημα μέχρι σήμερα (2018) επι 12.5 που είναι ένας σταθερός αριθμός. Αν πρόκεται για ηλεκτρικό όχημα το κόστος
* μειώνεται κατά 20%.
* This method computes the annual taxes of the vehicle. The annual taxes equal the number of years from the release
* day till today (2018) multiplied by 12.5 which is a constant value. In case of an electric vehicle the score is
* reduced by 20%.
* @return Τα τέλη κυκλοφορίας, the annual tax of the vehicle
*/
public double getTaxes(){
return super.getTaxes() * 0.8;
}
}
|
auth-csd-oop-2020/lab-inheritance-Scooter-solved
|
src/ElectricalScooter.java
|
2,318 |
/*
* copyright 2013-2020
* codebb.gr
* ProtoERP - Open source invocing program
* [email protected]
*/
/*
* Changelog
* =========
* 20/10/2020 (georgemoralis) - Added send report on database updates failure
* 14/10/2020 (georgemoralis) - Initial
*/
package gr.codebb.protoerp;
import static gr.codebb.lib.util.ThreadUtil.runAndWait;
import gr.codebb.dlg.AlertDlg;
import gr.codebb.lib.database.MysqlUtil;
import gr.codebb.lib.database.PersistenceManager;
import gr.codebb.lib.util.ExceptionUtil;
import gr.codebb.lib.util.FxmlUtil;
import gr.codebb.lib.util.StageUtil;
import gr.codebb.protoerp.issues.GenericIssueView;
import gr.codebb.util.database.Dbms;
import gr.codebb.util.database.SqlScriptRunner;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.List;
import java.util.concurrent.ExecutionException;
import javafx.scene.Scene;
import javafx.scene.control.ButtonType;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javax.persistence.EntityManager;
import liquibase.Contexts;
import liquibase.Liquibase;
import liquibase.changelog.ChangeSet;
import liquibase.database.Database;
import liquibase.database.DatabaseFactory;
import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.DatabaseException;
import liquibase.resource.ClassLoaderResourceAccessor;
import org.hibernate.internal.SessionImpl;
public class InstallDatabaseUpdates {
public static boolean checkDatabaseForUpdates(Dbms database) {
InstallDatabaseUpdates d = new InstallDatabaseUpdates();
// if table not exists then run the initial database script
boolean newDatabase = false;
if (!MysqlUtil.checkDatabaseConnection(database)) {
return false;
}
if (!MysqlUtil.checkIfTableExists(database, "protoerp_settings")) {
EntityManager em = PersistenceManager.getEmf().createEntityManager();
Connection connection = em.unwrap(SessionImpl.class).connection();
d.install_initial_database(connection);
em.close();
newDatabase = true;
}
d.runUpdates(database, newDatabase);
if (newDatabase) {
try {
/** we are still in preloader thread so wait to finish */
runAndWait(
() -> {
AlertDlg.create()
.type(AlertDlg.Type.INFORMATION)
.message("Δεν βρέθηκε βάση,αρχικοποιήθηκε μία καινούρια")
.title("Ειδοποίηση")
.owner(null)
.modality(Modality.APPLICATION_MODAL)
.showAndWait();
});
} catch (InterruptedException | ExecutionException ex) {
ex.printStackTrace();
}
}
return true;
}
public void runUpdates(Dbms db, boolean newDatabase) {
java.sql.Connection connection = null;
try {
// Getting a connection to the newly started database
Class.forName("com.mysql.cj.jdbc.Driver");
try {
connection = DriverManager.getConnection(db.getUrl(), db.getUsername(), db.getPassword());
} catch (SQLException ex) {
ex.printStackTrace();
}
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
if (connection == null) {
return;
}
System.out.println("Starting database update");
Database database = null;
try {
database =
DatabaseFactory.getInstance()
.findCorrectDatabaseImplementation(new JdbcConnection(connection));
} catch (DatabaseException ex) {
ex.printStackTrace();
}
if (database == null) {
try {
connection.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
// TODO error message?
return;
}
try {
Liquibase liquibase =
new liquibase.Liquibase(
"dbupdates/master-changelog.xml", new ClassLoaderResourceAccessor(), database);
List<ChangeSet> changeSets = liquibase.listUnrunChangeSets((Contexts) null);
if (!changeSets.isEmpty()) {
try {
liquibase.update((Contexts) null);
} catch (Exception d) {
runAndWait( // TODO
() -> {
ButtonType response =
AlertDlg.create()
.message(
"Δημιουργήθηκε κάποιο πρόβλημα κατά την αναβάθμιση της βάσης\nΕπιθυμείτε να στείλετε το report στην codebb για περαιτέρω διερεύνηση?")
.title("Αποστολή προτάσεων/προβλημάτων")
.modality(Modality.APPLICATION_MODAL)
.showAndWaitConfirm();
if (response == ButtonType.OK) {
String exceptionText = ExceptionUtil.exceptionToString(d);
FxmlUtil.LoadResult<GenericIssueView> GenericIssue =
FxmlUtil.load("/fxml/issues/GenericIssue.fxml");
GenericIssue.getController().setTitle("AutoGenerated database update issue");
GenericIssue.getController().setDetail(exceptionText);
Stage stage =
StageUtil.setStageSettings(
"Αποστολή προτάσεων/προβλημάτων",
new Scene(GenericIssue.getParent()),
Modality.APPLICATION_MODAL,
null,
null,
"/img/protoerp.png");
stage.setResizable(false);
stage.setAlwaysOnTop(true);
stage.sizeToScene();
stage.show();
}
});
try {
connection.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
return;
}
} else {
System.out.println("No database updates found");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Completed database update");
try {
connection.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
public void install_initial_database(Connection connection) {
System.out.println(
"[DatabaseEvents]: Table " + "settings" + " does not exist. Creating database layout.");
SqlScriptRunner runner = new SqlScriptRunner(connection, false, false);
try {
String file = "/" + MainSettings.getInstance().getAppName() + "_initial.sql";
runner.runScript(new InputStreamReader(getClass().getResourceAsStream(file), "UTF-8"));
} catch (IOException | SQLException ex) {
ex.printStackTrace();
}
}
}
|
georgemoralis/protoERP
|
src/main/java/gr/codebb/protoerp/InstallDatabaseUpdates.java
|
2,319 |
package gr.aueb.cf.ch4;
import java.util.Scanner;
/**
* Homework Ch4 :All 5 programs in one
* by using also function "case" as a selection
*
* @author D1MK4L
*/
public class StarsMenuApp {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int stars = 0;
int choice = 0;
while (choice !=6) {
System.out.print("Δώστε τον αριθμό που αντιστοιχεί σε αστεράκια: ");
stars = in.nextInt();
System.out.println(" ");
System.out.println("Επιλέξτε τρόπο απεικόνισης!");
System.out.println("1. οριζόντια ");
System.out.println("2. κάθετα ");
System.out.println("3. τυπου πινακα (ν χ ν) ");
System.out.println("4. Ο αριθμός που δώσατε κατά αύξουσα σειρά αριθμων , με βήμα 1 ");
System.out.println("5. Ο αριθμός που δώσατε φθίνουσα σειρά αριθμών , με βήμα 1 ");
System.out.println("6. Έξοδος ");
System.out.print("Δωστε επιλογή: ");
choice = in.nextInt();
switch (choice) {
case 1:
for (int i = 1; i <= stars; i++) {
System.out.print("* ");
}
break;
case 2:
for (int i = 1; i <= stars; i++) {
System.out.println("* ");
}
break;
case 3:
for (int i = 1; i <= stars; i++) {
for (int j = 1; j <= stars; j++) {
System.out.print("* ");
}
System.out.println();
}
break;
case 4:
for (int i = 1; i <= stars; i++) {
System.out.print(i + " ");
}
break;
case 5:
for (int i = stars; i >= 1; i--) {
System.out.print(i + " ");
}
break;
case 6:
System.out.print("Thanks for using stars program!!!! cy");
break;
default:
System.out.println("Λάθος επιλογή, αποδεκτοί αριθμοί ακέραιοι 1-6! ");
}
System.out.println(" ");
}
}
}
|
D1MK4L/coding-factory-5-java
|
src/gr/aueb/cf/ch4/StarsMenuApp.java
|
2,320 |
package thesis;
import java.io.File;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
* @author Nektarios Gkouvousis
* @author ice18390193
*
* Η κλάση Definitions είναι υπεύθυνη για την διαχείριση και την αποθήκευση πληροφοριών
* που αφορούν διαδρομές (paths) αρχείων ή φακέλων του προγράμματος. Επιπλέον, περιλαμβάνει
* τις ονομασίες των αρχείων και των φύλλων του excel που θα χρησιμοποιηθούν.
* Τέλος, κληρονομεί από την κλάση JFrame μεθόδους ώστε να γίνει η πρώτη αρχικοποίηση
* στο μονοπάτι του προγράμματος (εάν χρειάζεται).
*/
public class Definitions extends JFrame{
private static String folderPath = "";
private static String settingsFile = "config.txt";
private static String genericFile = "1) General.xlsx";
private static String professorsAvailabilityFile = "TEST2.xlsx";
private static String classroomsAvailabilityFile = "TEST3.xlsx";
private static String examScheduleFile = "ΠΡΟΓΡΑΜΜΑ.xlsx";
private static String sheet1 = "PROFESSORS";
private static String sheet2 = "TIMESLOTS";
private static String sheet3 = "DATES";
private static String sheet4 = "CLASSROOMS";
private static String sheet5 = "COURSES";
private static String sheet6 = "COURSES_PROFESSORS";
private static String sheet7 = "ΠΡΟΓΡΑΜΜΑ ΕΞΕΤΑΣΤΙΚΗΣ";
private static String sheet8 = "ΠΡΟΓΡΑΜΜΑ ΑΙΘΟΥΣΩΝ";
public void Definitions(){
}
/**
* Έναρξη της διαδικασίας εκκίνησης του προγράμματος. Ελέγχεται εάν το αρχείο
* ρυθμίσεων υπάρχει και εκκινεί την εφαρμογή ανάλογα με την ύπαρξή του. Σε
* περίπτωση που δεν υπάρχει, το πρόγραμμα θα καλωσορίσει τον χρήστη στην εφαρμογή
* και θα τον παροτρύνει να ορίσει έναν φάκελο ως workind directory.
*/
public void startProcess(){
if (!configFileExists()){
if (JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(this, "Καλωσήρθατε στο βοήθημα για την παραγωγή του προγράμματος εξετάσεων!"
+ " Παρακαλώ επιλέξτε τον φάκελο στον οποίο θα γίνεται η επεξεργασία των αρχείων εισόδου/εξόδου.", "Μήνυμα Εφαρμογής", JOptionPane.OK_OPTION))
{
System.exit(0);
}else{
promptUserForFolder();
}
}else{
loadWorkingDirectory();
}
}
public void Definitions(String x){
this.folderPath = x;
}
public void setSettingsFile(String tmp){
settingsFile = tmp;
}
public String getSettingsFile(){
return settingsFile;
}
public void setFolderPath(String tmp){
folderPath = tmp;
}
public String getFolderPath(){
return folderPath;
}
public void setGenericFile(String tmp){
genericFile = tmp;
}
public String getGenericFile(){
return genericFile;
}
public void setConfigFile(String tmp){
settingsFile = tmp;
}
public String getConfigFile(){
return settingsFile;
}
public String getProfessorsAvailabilityFile(){
return professorsAvailabilityFile;
}
public String getClassroomsAvailabilityFile(){
return classroomsAvailabilityFile;
}
public void setExamScheduleFile(String x){
examScheduleFile = x;
}
public String getExamScheduleFile(){
return examScheduleFile;
}
public String getSheet1() {
return sheet1;
}
public static void setSheet1(String sheet1) {
Definitions.sheet1 = sheet1;
}
public String getSheet2() {
return sheet2;
}
public static void setSheet2(String sheet2) {
Definitions.sheet2 = sheet2;
}
public String getSheet3() {
return sheet3;
}
public static void setSheet3(String sheet3) {
Definitions.sheet3 = sheet3;
}
public String getSheet4() {
return sheet4;
}
public static void setSheet4(String sheet4) {
Definitions.sheet4 = sheet4;
}
public String getSheet5() {
return sheet5;
}
public static void setSheet5(String sheet5) {
Definitions.sheet5 = sheet5;
}
public String getSheet6() {
return sheet6;
}
public static void setSheet6(String sheet6) {
Definitions.sheet6 = sheet6;
}
public String getSheet7() {
return sheet7;
}
public static void setSheet7(String sheet7) {
Definitions.sheet7 = sheet7;
}
public String getSheet8() {
return sheet8;
}
public static void setSheet8(String sheet8) {
Definitions.sheet8 = sheet8;
}
/**
* Ελέγχει εάν το αρχείο ρυθμίσεων υπάρχει.
*
* @return true αν το αρχείο ρυθμίσεων υπάρχει, αλλιώς false (boolean)
*/
private static boolean configFileExists(){
return Files.exists(Paths.get(settingsFile));
}
/**
* Ελέγχει εάν το αρχείο προγράμματος εξετάσεων υπάρχει στον τρέχοντα φάκελο.
*
* @return true αν το αρχείο προγράμματος εξετάσεων υπάρχει, αλλιώς false (boolean).
*/
public boolean examScheduleFileExists(){
return Files.exists(Paths.get(folderPath + "\\" + examScheduleFile ));
}
/**
* Επιστρέφει τον τρέχοντα κατάλογο της εφαρμογής.
*
* @return Ο τρέχοντας κατάλογος.
*/
public String CurrentDirectory(){
return System.getProperty("user.dir");
}
/**
* Ζητά από τον χρήστη να επιλέξει έναν φάκελο για αποθήκευση.
*/
public void promptUserForFolder() {
try{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int result = fileChooser.showOpenDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFolder = fileChooser.getSelectedFile();
folderPath = selectedFolder.toString();
saveConfigFile();
}
}catch (Exception ex){
JOptionPane.showMessageDialog(this, "Πρόβλημα κατά την διαδικασία ενημέρωσης του workind directory.", "Μήνυμα Εφαρμογής", JOptionPane.OK_OPTION);
}
}
/**
* Αποθηκεύει τον επιλεγμένο φάκελο στο αρχείο ρυθμίσεων.
*/
public void saveConfigFile() {
if(folderPath != null){
try (PrintWriter out = new PrintWriter(settingsFile)) {
out.println(folderPath);
} catch (Exception e) {
return;
}
}else{
System.out.println("Cannot save a null folder path");
}
}
/**
* Φορτώνει τον τρέχοντα κατάλογο από το αρχείο ρυθμίσεων διαβάζοντας το αρχείο
* ρυθμίσεων.
*/
public void loadWorkingDirectory() {
try (Scanner scanner = new Scanner(new File(settingsFile))) {
if (scanner.hasNextLine()) {
folderPath = Paths.get(scanner.nextLine()).toString();
}
} catch (Exception e) {
folderPath = null;
}
}
}
|
Gouvo7/Exam-Schedule-Creator
|
src/thesis/Definitions.java
|
2,324 |
package DeviceClientV1;
import static DeviceClientV1.Tools.MSGFROMARDUINO;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Κλάση που με λίγα λόγια αναλαμβάνει την διαχείριση της επικοινωνίας του προγράμματος μας
* με τα arduino που είναι συνδεδεμένα πάνω στον υπολογιστή .
* @author Michael Galliakis
*/
public class ReadArduino implements SerialPortEventListener {
SerialPort serialPort;
/** The port we're normally going to use. */
public static final String PORT_NAMES[] = {
"/dev/ttyACM0", // Raspberry Pi
"/dev/ttyACM1", // Raspberry Pi
"/dev/ttyACM2", // Raspberry Pi
"/dev/ttyACM3", // Raspberry Pi
"/dev/ttyACM4", // Raspberry Pi
"/dev/ttyACM5", // Raspberry Pi
"/dev/ttyACM6", // Raspberry Pi
"/dev/ttyACM7", // Raspberry Pi
"/dev/ttyUSB0", // Linux
"/dev/ttyUSB1", // Linux
"/dev/ttyUSB2", // Linux
"/dev/ttyUSB3", // Linux
"/dev/ttyUSB4", // Linux
"/dev/ttyUSB5", // Linux
"/dev/ttyUSB6", // Linux
"/dev/ttyUSB7", // Linux
"COM3", // Windows
"COM4", // Windows
"COM5", // Windows
"COM6", // Windows
"COM7", // Windows
"COM8", // Windows
"COM9", // Windows
"COM10", // Windows
"/dev/tty.usbserial-A9007UX1", // Mac OS X
"/dev/tty.usbserial-A9007UX2", // Mac OS X
"/dev/tty.usbserial-A9007UX3", // Mac OS X
"/dev/tty.usbserial-A9007UX4", // Mac OS X
"/dev/tty.usbserial-A9007UX5", // Mac OS X
"/dev/tty.usbserial-A9007UX6", // Mac OS X
"/dev/tty.usbserial-A9007UX7", // Mac OS X
"/dev/tty.usbserial-A9007UX8", // Mac OS X
};
/**
* A BufferedReader which will be fed by a InputStreamReader
* converting the bytes into characters
* making the displayed results codepage independent
*/
public BufferedReader input;
/** The output stream to the port */
public OutputStream output;
/** Milliseconds to block while waiting for port open */
private static final int TIME_OUT = 5000;
/** Default bits per second for COM port. */
private static final int DATA_RATE = 9600;
/**
* Συνάρτηση που ψάχνει και βρίσκει όλα τα arduino που είναι συνδεδεμένα στον
* υπολογιστή και στην συνέχεια επιστρέφει μια ArrayList με όλα τα arduino .
* @return ArrayList με όλα τα arduino.
*/
public static ArrayList<CommPortIdentifier> findAllArduino()
{
ArrayList<CommPortIdentifier> ar = new ArrayList();
for (String test : PORT_NAMES) {
System.setProperty("gnu.io.rxtx.SerialPorts", test);
CommPortIdentifier portId = null;
Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
//First, Find an instance of serial port as set in PORT_NAMES.
while (portEnum.hasMoreElements()) {
CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement();
for (String portName : PORT_NAMES) {
if (currPortId.getName().equals(portName)) {
portId = currPortId;
ar.add(portId);
//break;
}
}
}
}
return ar ;
}
/**
* Συνάρτηση που ψάχνει και βρίσκει όλα τα arduino που είναι συνδεδεμένα στον
* υπολογιστή και στην συνέχεια επιστρέφει μια HashMap με όλα τα arduino .
* @return HashMap με όλα τα arduino.
*/
public static HashMap<CommPortIdentifier,String> findAllArduinoHM()
{
HashMap<CommPortIdentifier,String> hm = new HashMap();
for (String test : PORT_NAMES) {
System.setProperty("gnu.io.rxtx.SerialPorts", test);
CommPortIdentifier portId = null;
Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
//First, Find an instance of serial port as set in PORT_NAMES.
while (portEnum.hasMoreElements()) {
CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement();
for (String portName : PORT_NAMES) {
if (currPortId.getName().equals(portName)) {
portId = currPortId;
hm.put(portId, "") ;
//break;
}
}
}
}
return hm ;
}
/**
* Μέθοδος που αναλαμβάνει να προετοιμάσει κατάλληλα την επικοινωνία του προγράμματος
* με την ανάλογη θύρα του υπολογιστή που είναι συνδεδεμένο το εκάστοτε arduino .
* @param portId Ένα CommPortIdentifier που αφορά το συνδεδεμένο arduino πάνω στον υπολογιστή
* @return True αν όλα πήγαν καλά και false αν υπήρξε εξαίρεση .
*/
public boolean initialize(CommPortIdentifier portId) {
try {
// open serial port, and use class name for the appName.
serialPort = (SerialPort) portId.open(this.getClass().getName(),
TIME_OUT);
// set port parameters
serialPort.setSerialPortParams(DATA_RATE,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
// open the streams
input = new BufferedReader(new InputStreamReader(serialPort.getInputStream()));
output = serialPort.getOutputStream();
// add event listeners
serialPort.addEventListener(this);
serialPort.notifyOnDataAvailable(true);
//output.write('b');
//output.flush();
} catch (Exception e) {
System.err.println(e.toString());
return false ;
}
return true ;
}
/**
* Μέθοδος που κλείνει ολοκληρωμένα το Serial Port .
*/
public synchronized void close() {
if (serialPort != null) {
serialPort.removeEventListener();
serialPort.close();
}
}
public boolean startRead = false ;
private ManageSocketMessage msm = new ManageSocketMessage();
private String conName = "" ;
private CommPortIdentifier currentArduinoPort ;
/**
* Μέθοδος που καταχωρεί το όνομα του Ελεγκτή και την τρέχον "πόρτα" του εκάστοτε arduino.
* @param conName Όνομα του ελεγκτή
* @param currentArduinoPort CommPortIndentifier με το τρέχον Arduino .
*/
public void setConNameAndArduinoPort(String conName,CommPortIdentifier currentArduinoPort) {
this.conName = conName;
this.currentArduinoPort = currentArduinoPort;
}
/**
* Μέθοδος που αναλαμβάνει να διαβάζει συνεχώς από τη σειριακή θύρα και κατά επέκταση
* από την άλλη άκρη του καλωδίου δηλαδή από το εκάστοτε arduino .
* @param oEvent Default παράμετρος που μας βοηθάει να δούμε αν περνάνε δεδομένα
* από το σειριακό μας μέσο και αναλόγως αν περνάνε να τα διαβάσουμε .
*/
public synchronized void serialEvent(SerialPortEvent oEvent) {
if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE && startRead) {
try {
String inputLine=input.readLine();
Tools.Debug.print(inputLine,MSGFROMARDUINO);
msm.reload(inputLine);
if (msm.getCommand().equals("NewValues"))
{
Globals.device.setValuesOfDevice(inputLine);
if (Globals.manSocket != null)
Tools.send(inputLine, Globals.manSocket.out);
}
//Tools.Debug.print(inputLine);
//reloadDevice(inputLine);
} catch (Exception e) {
//System.err.println(e.toString());
if (Globals.manSocket != null)
Tools.send(Globals.device.createMessageDeleteController(conName), Globals.manSocket.out);
Globals.hmAllArduino.remove(currentArduinoPort) ;
Globals.hmAllReadArduino.remove(conName);
Globals.device.deleteController(conName);
Tools.Debug.print(conName + " Left!!");
startRead = false ;
}
}
}
/**
* Μεταβλητή που χρησιμοποιείται αποκλειστικά από τη παρακάτω μέθοδο : "stopWaftOfUSBCable".
*/
public boolean glFlagFor_stopWaftOfUSBCable = false;
/**
* Μέθοδος που αναλαμβάνει να σταματήσει τη ροή μηνυμάτων που έρχονται από κάποιο arduino .
* Σκοπός είναι να υπάρχει πλήρης συγχρονισμός της επικοινωνίας μεταξύ του arduino και
* του προγραμματός μας (Device Client) .
* @return True αν κατάφερε να σταματήσει τη ροή επιτυχημένα ή false αν δεν κατάφερε επιτυχημένα .
*/
public boolean stopWaftOfUSBCable()
{
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
glFlagFor_stopWaftOfUSBCable = false ;
String stopped = "" ;
try {
output.write('e');
output.flush();
do {
stopped = input.readLine();
Tools.Debug.print("s" + stopped);
} while (!stopped.toUpperCase().equals("STOPPED!")) ;
glFlagFor_stopWaftOfUSBCable = true ;
timer.cancel();
timer.purge();
} catch (IOException ex) {
Logger.getLogger(ReadArduino.class.getName()).log(Level.SEVERE, null, ex);
timer.cancel();
timer.purge();
}
}
};
timer.schedule(task,1800);
try {
Thread.sleep(2400);
} catch (InterruptedException ex) {
Logger.getLogger(ReadArduino.class.getName()).log(Level.SEVERE, null, ex);
}
timer.cancel();
timer.purge();
return glFlagFor_stopWaftOfUSBCable;
}
/**
* Μέθοδος που αναλαμβάνει να προετοιμάσει την επικοινωνία του προγράμματος
* με το Arduino . Πιο συγκεκριμένα , σε επίπεδο δικού μας πρωτοκόλλου , κάνει
* όλα τα απαραίτητα βήματα για να στηθεί και να ξεκινήσει η επικοινωνία.
* @param arduinoPort Ένα CommPortIdentifier του εκάστοτε Arduino
* @return Επιστρέφει το όνομα του νέου arduino-ελεγκτή ή αν κάτι δεν
* πάει καλά επιστρέφει null .
*/
public String prepare(CommPortIdentifier arduinoPort)
{
try
{
currentArduinoPort = arduinoPort ;
if (!stopWaftOfUSBCable())
if (!stopWaftOfUSBCable())
return null ;
output.write('v');
output.flush();
String version = input.readLine();
Tools.Debug.print("Version : " + version,MSGFROMARDUINO);
output.write(("d" + Globals.device.getSenderFullID()).getBytes());
output.flush();
String devicenameConfirm = input.readLine();
Tools.Debug.print("deviceNameConfirm : " + devicenameConfirm,MSGFROMARDUINO);
output.write('i');
output.flush();
String info = input.readLine();
Tools.Debug.print("info : " + info,MSGFROMARDUINO);
String correntCName = "";
msm.reload(info) ;
if (msm.getCommand().equals("NewController"))
{
Tools.Debug.print("Einai new controller!");
String cName = msm.getParameters().get(0).get(0) ;
correntCName = Globals.checkConNameIfthereIS(cName) ;
if (!cName.equals(correntCName))
{
info = info.replace("(" +cName+")", "(" +correntCName+")") ;
Tools.Debug.print("cName = " + cName +" correctCName = " + correntCName);
output.write('n');
output.write(correntCName.getBytes());
output.flush();
String OK = input.readLine();
Tools.Debug.print(OK,MSGFROMARDUINO);
}
conName = correntCName ;
}
else
return null ;
//cName = Globals.checkConNameIfthereIS(cName) ;
Globals.device.addController(info);
Globals.hmAllArduino.replace(arduinoPort,conName) ;
output.write('b');
output.flush();
//startRead = true ;
Globals.hmAllReadArduino.put(conName, this);
}
catch (Exception ex)
{
Tools.Debug.print(ex.getMessage());
return null ;
}
return conName ;
}
}
/*
* * * * * * * * * * * * * * * * * * * * * * *
* + + + + + + + + + + + + + + + + + + + + + *
* +- - - - - - - - - - - - - - - - - - - -+ *
* +| P P P P M M M M G G G G |+ *
* +| P P M M M M G G |+ *
* +| P P P p M M M M G |+ *
* +| P M M M G G G G |+ *
* +| P M M G G |+ *
* +| P ® M M ® G G G G |+ *
* +- - - - - - - - - - - - - - - - - - - -+ *
* + .----. @ @ |+ *
* + / .-"-.`. \v/ |+ *
* + | | '\ \ \_/ ) |+ *
* + ,-\ `-.' /.' / |+ *
* + '---`----'----' |+ *
* +- - - - - - - - - - - - - - - - - - - -+ *
* + + + + + + + + + + + + + + + + + + + + + *
* +- - - - - - - - - - - - - - - - - - - -+ *
* +| Thesis Michael Galliakis 2016 |+ *
* +| Program m_g ; -) [email protected] |+ *
* +| TEI Athens - IT department. |+ *
* +| [email protected] |+ *
* +| https://github.com/michaelgalliakis |+ *
* +| (myThesis.git) |+ *
* +- - - - - - - - - - - - - - - - - - - -+ *
* + + + + + + + + + + + + + + + + + + + + + *
* * * * * * * * * * * * * * * * * * * * * * *
*/
|
michaelgalliakis/myThesis
|
DeviceClientV1/src/DeviceClientV1/ReadArduino.java
|
2,326 |
package algorithms;
import edu.uci.ics.jung.graph.DelegateTree;
import edu.uci.ics.jung.graph.DirectedOrderedSparseMultigraph;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import graph.Edge;
import graph.Node;
import graph.SearchGraph;
/**
* ΕΑΠ - ΠΛΗ31 - 4η ΕΡΓΑΣΙΑ 2015-2016
* @author Tsakiridis Sotiris
*/
public abstract class SearchAlgorithm extends DelegateTree<Node, Edge> {
// Σταθερές για το κριτήριο τερματισμού
public static int TARGET_INTO_OPEN_LIST = 0;
public static int TARGET_INTO_CLOSE_LIST = 1;
// Σταθερές κατάστασης του αλγορίθμου
public static int INIT = 0;
public static int RUNNING = 1;
public static int FINISHED = 2;
// Ο γράφος στον οποίο θα εφαρμοστεί η αναζήτηση κατά βάθος
// μαζί με τον κόμβο έναρξης, τους κόμβους-στόχους
protected SearchGraph searchGraph;
protected Node startNode;
protected ArrayList<Node> targetNodes = new ArrayList();
// Ο τρέχον κόμβος που εξετάζεται
protected Node current;
// Κατάσταση αλγορίθμου, καταμέτρηση βημάτων και κόμβων που αναπτύχθηκαν
protected int state;
protected int steps = 0;
protected ArrayList<Node> expandedNodes;
// Κριτήριο τερματισμού
protected int terminationCriteria = TARGET_INTO_CLOSE_LIST;
// Ο κόμβος στόχος - τίθεται κατά τον τερματισμό του αλγορίθμου
// αν είναι null - αποτυχία
protected Node targetFound = null;
// Log activities
protected JTextArea logger = null;
// Ο constructor δέχεται ένα γράφο στον οποίο
public SearchAlgorithm(SearchGraph searchGraph) {
super(new DirectedOrderedSparseMultigraph<Node, Edge>());
// Αρχικοποίηση
this.searchGraph = searchGraph;
this.startNode = searchGraph.getStartNode();
this.targetNodes = searchGraph.getTargetNodes();
this.expandedNodes = new ArrayList();
this.terminationCriteria = DepthFirstSearch.TARGET_INTO_OPEN_LIST;
this.state = INIT;
this.steps = 0;
this.current = null;
}
// getters
public int getState() { return this.state; }
public int getTerminationCriteria() { return this.terminationCriteria; }
public Node getTargetFound() { return this.targetFound; }
public SearchGraph getSearchGraph() { return this.searchGraph; }
// setters
public void setLogger(JTextArea logger) { this.logger = logger; }
public void setTerminationCriteria(int c) { this.terminationCriteria = c; }
// Επιστροφή της λίστας των κόμβων/στόχων ως string
public String getTargetNodesStr() {
String targetNodesStr = "";
for (Node n : this.targetNodes)
targetNodesStr = targetNodesStr + n.getLabel() + ",";
// Αφαιρούμε το τελικό ',' και επιστρέφουμε
if (targetNodesStr.length() > 1)
return targetNodesStr.substring(0, targetNodesStr.length()-1);
else
return "";
}
// log message
public void log(String message) {
// Αν δεν έχει οριστεί logger επιστροφή
if (this.logger == null) return;
this.logger.append(message);
}
// Επιστροφή μονοπατιού σε μορμή String από τη ρίζα στον κόμβο node
public String getPathStr(Node node) {
List<Node> path = this.getPath(node);
String pathStr = "";
for (Node n : path) {
pathStr = pathStr + n.toString() + "->";
}
return pathStr.substring(0, pathStr.length()-2);
}
// Επιστροφή κόστος μονοπατιού από την ρίζα μέχρι τον κόμβο node
public double getPathCost(Node node) {
// Παίρνουμε το μονοπάτι από τη ρίζα στον node
List<Node> path = this.getPath(node);
// Για κάθε ακμή αθροίζουμε τα βάρη
double cost = 0;
for (Node n : path) {
if (isRoot(n)) continue; // ο root δεν έχει parent
Edge e = getParentEdge(n);
cost += e.getWeight();
}
return cost;
}
// Οι μέθοδοις start() και step() υλοποιούνται στις derrived classes
public abstract void start();
public abstract void step();
public abstract JPanel getDefaultPanel();
}
|
artibet/graphix
|
src/algorithms/SearchAlgorithm.java
|
2,327 |
package graphexample;
public class GraphExample {
public static void main(String[] args) {
Graph graph = new Graph();
Node node1 = new Node(1);
Node node2 = new Node(2);
Node node3 = new Node(3);
graph.createNode(node1); // προσθήκη στη λίστα των κόμβων του
// graph και αύξηση κατά 1 του αριθμού
// των κόμβων
graph.createNode(node2);
graph.createNode(node3);
// δημιουργεί
Edge e12 = new Edge(node1, node2, 5, 1);
Edge e13 = new Edge(node1, node3, 12, 2);
if (graph.checkForAvailability()){
node1.addNeighbour(e12); // σύνδεση των κόμβων 1 και 2
node1.addNeighbour(e13);
node1.getNeighbours();
}
else{
System.out.println("Πρέπει να υπάρχουν τουλάχιστον 2 κόμβοι στο γράφημα");
}
}
}
|
bourakis/Algorithms-Data-Structures
|
Graphs/GraphExample/GraphExample.java
|
2,328 |
package com.example.unipiandroid;
import static com.example.unipiandroid.MyApp.getContext;
import android.app.DownloadManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import org.json.JSONException;
import org.json.JSONObject;
public class Announcement extends AppCompatActivity {
RequestQueue mRequestQueue;
TextView titleTextView,detailsTextView,authorTextView;
SharedPreferences sharedPreferences;
TextView loginText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
setContentView(R.layout.announcement);
sharedPreferences = getSharedPreferences("MyUserPrefs",Context.MODE_PRIVATE);
int id = sharedPreferences.getInt("News_id",0);
String username = sharedPreferences.getString("Username","");
titleTextView = findViewById(R.id.announcement_title);
detailsTextView = findViewById(R.id.details);
authorTextView = findViewById(R.id.author);
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
String url = "SERVER/api/news/"+id;
mRequestQueue.add(getNewsRequest(url));
sharedPreferences = getApplicationContext().getSharedPreferences("MyUserPrefs", Context.MODE_PRIVATE);
String name = sharedPreferences.getString("Name","");
final TextView loginText = findViewById(R.id.loginText2);
//if user is logged in
if(!username.isEmpty() && !name.isEmpty()) {
loginText.setText("ΑΠΟΣΥΝΔΕΣΗ");
loginText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.apply();
kill_activity();
startActivity(new Intent(getApplicationContext(),MainActivity.class));
}
});
} else { //else redirect to login page
loginText.setText("ΣΥΝΔΕΣΗ");
loginText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
kill_activity();
startActivity(new Intent(getApplicationContext(), LoginPage.class));
}
});
}
final ImageView unipiLogo = findViewById(R.id.unipiLogo2);
unipiLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getContext(), MainActivity.class));
}
});
Button button = findViewById(R.id.deleteNewsButton);
if(!username.isEmpty()) {
button.setVisibility(View.VISIBLE);
button.setEnabled(true);
} else {
button.setVisibility(View.INVISIBLE);
button.setEnabled(false);
}
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mRequestQueue.add(getDeleteRequest(url));
/*
manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
Uri uri = Uri.parse("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf");
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE);
long reference = manager.enqueue(request);
*/
}
});
}
JsonObjectRequest getNewsRequest(String url) {
return new JsonObjectRequest(
Request.Method.GET,
url,
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if(response.getInt("statusCode")==200) { //http status OK
titleTextView.setText(response.getJSONObject("data").getJSONObject("news").getString("title"));
detailsTextView.setText(response.getJSONObject("data").getJSONObject("news").getString("message"));
authorTextView.setText(response.getJSONObject("data").getJSONObject("news").getString("author"));
} else {
Toast.makeText(getApplicationContext(),"Σφάλμα κατά το φόρτωμα της ανακοίνωσης",Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(),"Σφάλμα κατά το φόρτωμα της ανακοίνωσης",Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(),"Σφάλμα κατά το φόρτωμα της ανακοίνωσης",Toast.LENGTH_LONG).show();
error.printStackTrace();
}
}
);
}
JsonObjectRequest getDeleteRequest(String url) {
return new JsonObjectRequest(
Request.Method.DELETE,
url,
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if(response.getInt("statusCode")==204) { //http status NO CONTENT
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("news_id");
editor.apply();
Toast.makeText(getApplicationContext(),"Επιτυχής διαγραφή της ανακοίνωσης.",Toast.LENGTH_LONG).show();
finish();
startActivity(new Intent(getApplicationContext(),MainActivity.class));
} else {
Toast.makeText(getApplicationContext(),"Σφάλμα κατά τη διαγραφή της ανακοίνωσης.",Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(),"Σφάλμα κατά τη διαγραφή της ανακοίνωσης.",Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(),"Σφάλμα κατά τη διαγραφή της ανακοίνωσης.",Toast.LENGTH_LONG).show();
error.printStackTrace();
}
}
);
}
void kill_activity() {
finish();
}
}
|
n-hatz/Android-Unipi.gr
|
frontend/app/src/main/java/com/example/unipiandroid/Announcement.java
|
2,330 |
package com.nicktz.boat;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
public class SavedQuestion extends AppCompatActivity {
private ArrayList<Integer> move;
private int it;
TextView question;
TextView choice1;
TextView choice2;
TextView choice3;
FloatingActionButton delete;
/*
Μεταβλητή που χρησιμοποιούμε προκειμένου να γνωρίζουμε αν ο χρήστης έχει αφήσει το
κουμπί διαγραφής σε κατάσταση που θα οδηγήσει στην διαγραφή της ερώτησης ή όχι.
*/
boolean toDelete;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_question);
move = new ArrayList<>();
it = getIntent().getIntExtra("savedQuestionPosition", 0);
MyDBHandler dbHandler = new MyDBHandler(this, null, null, 1);
int savedSize = dbHandler.getSavedSize();
QuestionDB[] saved = new QuestionDB[savedSize];
saved = dbHandler.getSaved();
for (int i = 0; i < savedSize; i++) {
move.add(saved[i].get_id());
}
question = findViewById(R.id.question);
choice1 = findViewById(R.id.choice1);
choice2 = findViewById(R.id.choice2);
choice3 = findViewById(R.id.choice3);
delete = findViewById(R.id.delete);
setTexts();
}
/*
Κάθε φορά που ο χρήστης πατάει το κουμπί διαγραφής αλλάζουμε το σχέδιο που εμφανίζεται
στην οθόνη καθώς και την τιμή της μεταβλητής deleted
*/
public void changeState(View view) {
if (!toDelete) {
delete.setImageResource(R.drawable.custom_save);
toDelete = true;
}
else {
delete.setImageResource(R.drawable.custom_delete);
toDelete = false;
}
}
/**
* Συναρτηση που καλείται για να ελέγξει αν ο χρήστης επιθυμεί να διαγράψει μια ερώτηση. Αν ναι
* τότε την διαγράφει, την αφαιρεί από το ArrayList move και τέλος εμφανίζει κατάλληλο μήνυμα στον
* χρήστη για να τον ενημερώσει.
*/
public void check() {
if (!toDelete)
return;
MyDBHandler dbHandler = new MyDBHandler(this, null, null, 1);
dbHandler.deleteSaved(move.get(it));
move.remove(it);
Toast toast = Toast.makeText(this, getString(R.string.question_deleted), Toast.LENGTH_SHORT);
toast.show();
}
/**
* Συνάρτηση που καλείται στο πάτημα (onClick δηλαδή) του κουμπιού "ΠΡΟΗΓΟΥΜΕΝΗ". Καλεί αρχικά την
* check() για να ελέγξει αν η ερώτηση που βρισκόμαστε πρέπει να διαγραφεί προτού πάμε στην επόμενη.
* Αν η ερώτηση κατά την εκτέλεση της check() διαγράφτηκε και δεν υπάρχει άλλη αποθηκευμένη ερώτηση
* προς την οποία μπορούμε να μετακινηθούμε καλεί την super.onBackPressed() για να πάμε πίσω
* στην λίστα με τις αποθηκευμένες ερωτήσεις (η οποία προφανώς θα είναι κενή).
* Αν η ερώτηση στην οποία βρισκόμαστε είναι η μοναδική που έχει απομείνει τότε δεν κάνει
* τίποτα και απλά επιστρέφει. Αν βρισκόμαστε στην ερώτηση που αντιστοχεί στο πρώτο στοιχείο
* του ArrayList move τότε πηγαίνουμε στο τελευταίο του αλλίως πάμε στο προηγούμενο διαθέσιμο. Τέλος,
* καλείται η setTexts() για να ανανεωθεί το κείμενο της ερώτησης και των απαντήσεων.
*/
public void previous(View view) {
check();
if (move.size()==0) {
super.onBackPressed();
return;
}
if (move.size()==1 && !toDelete)
return;
it = it==0? move.size()-1: it-1;
setTexts();
}
/**
* Συνάρτηση που καλείται στο πάτημα (onClick δηλαδή) του κουμπιού "ΕΠΟΜΕΝΗ". Καλεί αρχικά την
* check() για να ελέγξει αν η ερώτηση που βρισκόμαστε πρέπει να διαγραφεί προτού πάμε στην επόμενη.
* Αν η ερώτηση κατά την εκτέλεση της check() διαγράφτηκε και δεν υπάρχει άλλη αποθηκευμένη ερώτηση
* προς την οποία μπορούμε να μετακινηθούμε καλεί την super.onBackPressed() για να πάμε πίσω
* στην λίστα με τις αποθηκευμένες ερωτήσεις (η οποία προφανώς θα είναι κενή).
* Αν η ερώτηση στην οποία βρισκόμαστε είναι η μοναδική που έχει απομείνει τότε δεν κάνει
* τίποτα και απλά επιστρέφει. Αν βρισκόμαστε στην ερώτηση που αντιστοχεί στο τελευταίο στοιχείο
* του ArrayList move τότε πηγαίνουμε στο πρώτο του αλλίως πάμε στο επόμενο διαθέσιμο. Τέλος,
* καλείται η setTexts() για να ανανεωθεί το κείμενο της ερώτησης και των απαντήσεων.
*/
public void next(View view) {
check();
if (move.size()==0) {
super.onBackPressed();
return;
}
if (move.size() == 1 && !toDelete)
return;
if (!toDelete)
it = (it+1)%move.size();
else it = it%move.size();
setTexts();
}
/**
* Συνάρτηση που καλείται για να ανανεωθεί το κείμενο της ερώτησης και των απαντήσεων. Επίσης
* ανάλογα ποια από τις απαντήσεις είναι σωστή αλλάζει το περίγραμμα της αντίστοιχης απάντησης
* προκειμένου να υποδεικνύεται στον χρήστη ποια είναι η σωστή απάντηση.
* Τέλος αρχικοποιεί εκ νεου το σχέδιο του κουμπιού διαγραφής και την τιμή της μεταβλητής toDelete.
*/
public void setTexts() {
choice1.setBackgroundResource(R.drawable.choice);
choice2.setBackgroundResource(R.drawable.choice);
choice3.setBackgroundResource(R.drawable.choice);
MyDBHandler dbHandler = new MyDBHandler(this, null, null, 1);
QuestionDB savedQuestion = dbHandler.getSavedById(move.get(it));
question.setText(savedQuestion.getQuestion());
choice1.setText(savedQuestion.getChoice_1());
choice2.setText(savedQuestion.getChoice_2());
choice3.setText(savedQuestion.getChoice_3());
if (savedQuestion.getCorrect_answer()==1)
choice1.setBackgroundResource(R.drawable.correction);
if (savedQuestion.getCorrect_answer()==2)
choice2.setBackgroundResource(R.drawable.correction);
if (savedQuestion.getCorrect_answer()==3)
choice3.setBackgroundResource(R.drawable.correction);
delete.setImageResource(R.drawable.custom_delete);
toDelete = false;
}
/**
* Κάνουμε override την συνάρτηση onBackPressed() έτσι ώστε σε περίπτωση που ο χρήστης πατήσει
* το back button και έχει πατήσει και το κουμπί διαγραφής, να διαγραφεί η ερώτηση από τις
* "Αποθηκευμένες Ερωτήσεις". Αμέσως μετά την διαγραφή της ερώτησης εμφανίζεται στον χρήστη
* και ένα μήνυμα που τον ενημερώνει για την επιτυχημένη αφαίρεση της ερώτησης από τις
* "Αποθηκευμένες Ερωτήσεις".
*/
@Override
public void onBackPressed() {
if (toDelete) {
MyDBHandler dbHandler = new MyDBHandler(this, null, null, 1);
dbHandler.deleteSaved(move.get(it));
Toast toast = Toast.makeText(this, getString(R.string.question_deleted), Toast.LENGTH_SHORT);
toast.show();
}
super.onBackPressed();
}
}
|
nttzamos/boating-license-exam
|
app/src/main/java/com/nicktz/boat/SavedQuestion.java
|
2,337 |
package makisp.gohome;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ScenarioActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scenario);
if (GameActivity.progress == 1) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title1);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story1);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice11));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice21);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress = GameActivity.progress + 2;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 2) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title2);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story2);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice12));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice22);
//Ήχος κατά την εκκίνηση του ScenarioActivity
final MediaPlayer mp = MediaPlayer.create(this, R.raw.steps);
mp.start();
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
MainActivity.db.addItem(new Inventory(LoginActivity.activeUser, "Χαρτάκι"));
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 3) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title3);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story3);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice13));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice23);
//Ήχος κατά την εκκίνηση του ScenarioActivity
final MediaPlayer mp = MediaPlayer.create(this, R.raw.centre);
mp.start();
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress = GameActivity.progress + 2;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 4) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title4);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story4);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice14));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice24);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress = GameActivity.progress + 2;
MainActivity.db.addItem(new Inventory(LoginActivity.activeUser, "Βιβλίο"));
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress = GameActivity.progress + 2;
MainActivity.db.addItem(new Inventory(LoginActivity.activeUser, "Βιβλίο"));
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 5) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title5);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story5);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice15));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice25);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
MainActivity.db.addItem(new Inventory(LoginActivity.activeUser, "Βιβλίο"));
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
MainActivity.db.addItem(new Inventory(LoginActivity.activeUser, "Σκισμένες σελίδες"));
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 6) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title6);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story6);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice16));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice26);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
//Ήχος κατά την εκκίνηση του ScenarioActivity
final MediaPlayer mp = MediaPlayer.create(ScenarioActivity.this, R.raw.slowdoor);
mp.start();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 7) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title7);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story7);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice17));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice27);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 8) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title8);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story8);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice18));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice28);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
//Ήχος κατά την εκκίνηση του ScenarioActivity
final MediaPlayer mp = MediaPlayer.create(ScenarioActivity.this, R.raw.breaklock);
mp.start();
}
}
);
}
else if (GameActivity.progress == 9) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title9);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story9);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice19));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice29);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else if (GameActivity.progress == 10) {
TextView scenario_title = (TextView) findViewById(R.id.scenario_title);
scenario_title.setText(R.string.scenario_title10);
TextView scenario_story = (TextView) findViewById(R.id.scenario_story);
scenario_story.setText(R.string.scenario_story10);
Button button_choice1 = (Button) findViewById(R.id.button_choice1);
button_choice1.setText(getResources().getString(R.string.button_choice110));
Button button_choice2 = (Button) findViewById(R.id.button_choice2);
button_choice2.setText(R.string.button_choice210);
button_choice1.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
button_choice2.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
GameActivity.progress++;
String log = " " + GameActivity.progress;
Log.d("progress::", log);
MainActivity.db.updateProgress(GameActivity.cre, GameActivity.cre.getUsername(), GameActivity.progress);
finish();
}
}
);
}
else{
Log.i("LogMessage", "Δεν βρέθηκε marker.");
}
}
}
|
teicm-project/go-home
|
app/src/main/java/makisp/gohome/ScenarioActivity.java
|
2,338 |
package gr.aueb.cf.ch5;
/**
* stars Menu program by using methods and arrays
* and case for selection
*
* @author D1MK4L
*/
import java.util.Scanner;
public class StarsMenuMethodsApp {
public static void main(String[] args) {
int[] arr = new int[2];
while (arr[1] !=6) {
arr = printMenu();
getChoice(arr);
System.out.println();
}
}
public static int[] printMenu() { // Menu method
int[] array = new int[2];
Scanner in = new Scanner(System.in);
System.out.print("Δώστε τον αριθμό που αντιστοιχεί σε αστεράκια: ");
array[0] = in.nextInt();
System.out.println(" ");
System.out.println("Επιλέξτε τρόπο απεικόνισης!");
System.out.println("1. οριζόντια ");
System.out.println("2. κάθετα ");
System.out.println("3. τυπου πινακα (ν χ ν) ");
System.out.println("4. Ο αριθμός που δώσατε κατά αύξουσα σειρά με αστεράκια");
System.out.println("5. Ο αριθμός που δώσατε φθίνουσα σειρά αστεράκια");
System.out.println("6. Έξοδος ");
System.out.print("Δωστε επιλογή: ");
array[1] = in.nextInt();
return array;
}
public static void starsH(int a) { // Horizontal Sequence
for (int i = 1; i <= a; i++) {
System.out.print(" *");
}
return;
}
public static void starsV(int a) { // Vertical Sequence
for (int i = 1; i <= a; i++) {
System.out.println(" *");
}
return;
}
public static int[] getChoice(int[] array) { // Choice selection
int a; // pivot
switch (array[1]) {
case 1:
starsH(array[0]);
break;
case 2:
starsV(array[0]);
break;
case 3:
for (int i = 1; i <= array[0]; i++) {
starsH(array[0]);
System.out.println();
}
break;
case 4:
for (int i = 1; i <= array[0]; i++) {
a = 1;
for (int j = 1; j <= i; j ++ ) {
starsH(a);
}
System.out.println();
}
break;
case 5:
for (int i = array[0]; i >= 1; i--) {
starsH(array[0]);
array[0]= array[0] - 1;
System.out.println();
}
break;
case 6:
System.out.println("Self destruct sequence initiated thanks for not loosing your mind! c y");
break;
default:
System.out.println("Λάθος επιλογή, αποδεκτοί αριθμοί ακέραιοι 1-6! ");
break;
}
return array;
}
}
|
D1MK4L/coding-factory-5-java
|
src/gr/aueb/cf/ch5/StarsMenuMethodsApp.java
|
2,339 |
package gr.aueb.cf.ch9;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Locale;
import java.util.Scanner;
/**
* να διαβάσουμε ακέραιους αριθμούς όσο
* υπάρχει επόμενος και να τους προσθέτουμε και να
* βρίσκουμε τον μέσο όρο
* • Στη συνέχεια να γράφουμε τον μέσο όρο σε
* ένα αρχείο εξόδου intOut.txt
*/
public class IOIntDemo {
public static void main(String[] args) throws FileNotFoundException {
Scanner sc = new Scanner(new File("C:/temp/intIn.txt"));
PrintStream ps = new PrintStream("C:/temp/intOut.txt");
String token;
int num = 0, sum = 0, count = 0;
double average = 0.0;
/*
Μέσα σε μια do-while διαβάζουμε όσο υπάρχει token
Κάθε φορά που διαβάζουμε ένα String, ελέγχουμε αν είναι ακέραιος
με την isInt() και αν είναι τότε αυξάνουμε τον μετρητή i κατά 1
και επίσης αθροίζουμε στο sum
*/
while (sc.hasNext()) {
token = sc.next();
if(isInt(token)) {
num = Integer.parseInt(token);
count++;
sum += num;
}
}
/**
* Κάνουμε casting το sum σε double και όλη η παράσταση γίνεται double γιατί
* διαφορετικά το αποτέλεσμα θα είναι int.
* • Επίσης, χρησιμοποιούμε Locale US ώστε η υποδιαστολή να είναι η τελεία
* διαφορετικά το default Locale ήταν el_GR και η υποδιαστολή θα ήταν το κόμμα
*/
average = (double) sum / count;
ps.printf("Το άθροισμα είναι %d%n", sum);
ps.printf(Locale.ENGLISH, "Ο μέσος όρος είναι %.2f", average);
sc.close();
ps.close();
}
//Ελέγχει αν ένα String είναι ακέραιος
public static boolean isInt(String s) {
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
}
}
|
KruglovaOlga/CodingFactoryJava
|
src/gr/aueb/cf/ch9/IOIntDemo.java
|
2,345 |
package edu.self.w2k;
import java.io.File;
import java.util.Arrays;
import de.tudarmstadt.ukp.jwktl.JWKTL;
import de.tudarmstadt.ukp.jwktl.api.IWiktionaryEdition;
import de.tudarmstadt.ukp.jwktl.api.IWiktionaryEntry;
import de.tudarmstadt.ukp.jwktl.api.IWiktionaryExample;
import de.tudarmstadt.ukp.jwktl.api.IWiktionarySense;
import de.tudarmstadt.ukp.jwktl.api.filter.WiktionaryEntryFilter;
import de.tudarmstadt.ukp.jwktl.api.util.Language;
public class Sandbox {
private static final String DB_DIRECTORY = "db";
public static void main(String[] args) throws Exception {
File wiktionaryDirectory = new File(DB_DIRECTORY);
IWiktionaryEdition wkt = JWKTL.openEdition(wiktionaryDirectory);
WiktionaryEntryFilter entryFilter = new WiktionaryEntryFilter();
entryFilter.setAllowedWordLanguages(Language.findByName("Greek"));
wkt.getAllEntries(entryFilter).forEach(Sandbox::run);
}
private static void run(IWiktionaryEntry entry) {
String[] words = new String[] { "βασίλειο", "έκπληξη", "πλούτος", "κατάσταση", "μέχρι", "γύρω" };
if (Arrays.asList(words).contains(entry.getWord())) {
StringBuilder html = new StringBuilder();
//System.out.println("* " + entry.getWord());
html.append("<ol>");
for (IWiktionarySense sense : entry.getSenses()) {
//System.out.println(" - " + sense.getGloss());
html.append("<li><span>").append(sense.getGloss()).append("</span>");
if (sense.getExamples() != null) {
html.append("<ul>");
for (IWiktionaryExample example : sense.getExamples()) {
//System.out.println(" + " + example.getExample());
if (example.getExample().toString().trim().length() != 0) {
html.append("<li>").append(example.getExample()).append("</li>");
}
}
html.append("</ul>");
}
html.append("</li>");
}
html.append("</ol>");
System.out.println(entry.getWord() + "\t" + html.toString());
}
}
}
|
nyg/wiktionary-to-kindle
|
src/main/java/edu/self/w2k/Sandbox.java
|
2,352 |
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;
public interface UIMethods
{
/**
* Φορτίζει τις αλλαγές που έγιναν κατά την εκτέλεση του προγράμματος σε όλες τις βάσεις δεδομένων που χρησιμοποιούνται
*/
static void updateDatabases() throws IOException
{
User.updateDatabase(UI.user);
Messages.updateDatabase();
Rental.updateDatabase();
Date.updateDatabase();
}
/**
* Διαβάζει έναν αριθμό από το terminal και σιγουρεύεται πως βρίσκεται σε ένα εύρος ακεραίων
*
* @param from αρχή εύρους
* @param to τέλος εύρους(μπορεί να παραληφθεί)
* @return τον ακεραιο που διάβασε
*/
static int validityCheck(int from, int to)
{
boolean go = false;
int entry = 0;
while (!go)
{
entry = UI.input.nextInt();
if (entry >= from && entry <= to)
{
go = true;
}
else
{
System.out.println("=======================================");
System.out.println("Please enter a number from " + from + " to " + to);
System.out.println("=======================================");
}
}
return entry;
}
/**
* @see #validityCheck(int, int)
*/
static int validityCheck(int from)
{
boolean go = false;
int entry = 0;
while (!go)
{
entry = UI.input.nextInt();
if (entry >= from)
{
go = true;
}
else
{
System.out.println("=======================================");
System.out.println("Please enter a number larger than " + from);
System.out.println("=======================================");
}
}
return entry;
}
/**
* Διαβάζει ένα username, και ανάλογα με τη μεταβλητή available επιτρέπει usernames που υπάρχουν ή δεν υπάρχουν στο database
*
* @param available αν true, σιγουρεύεται πως το username δεν ανήκει σε κανέναν χρήστη <p>
* αν false, σιγουρεύεται πως το username ανήκει σε κάποιον χρήστη
* @return το username που διάβασε
*/
static String inputUserName(boolean available)
{
boolean go = false;
String username = "";
while (!go)
{
username = UI.input.next();
if (User.checkUsernameAvailability(username) != available)
{
if (available)
{
System.out.println("=======================================");
System.out.println("Username taken");
System.out.println("Username :");
}
else
{
System.out.println("=======================================");
System.out.println("User doesn't exist");
System.out.println("Username :");
}
}
else
{
go = true;
}
}
return username;
}
/**
* Διαβάζει ένα id που αντιστοιχεί σε κάποιο κατάλυμα
*
* @return το id που διάβασε
*/
static String inputValidId()
{
boolean go = false;
String id = "";
while (!go)
{
id = UI.input.next();
if (Rental.checkIdAvailability(id))
{
System.out.println("=======================================");
System.out.println("Id doesn't correspond to an existing rental");
System.out.println("Input id:");
System.out.println("=======================================");
}
else
{
go = true;
}
}
return id;
}
/**
* Διαβάζει και ελέγχει το password του χρήστη που προσπαθεί να κάνει login
* Αν βάλει 5 φορές λάθος password τότε κλείνει την εφαρμογή
*
* @return το έγκυρο password του χρήστη
*/
static String inputPassword()
{
String password = "";
boolean go = false;
int tries = 0;
while (!go)
{
password = UI.input.next();
if (!password.equals(UI.user.getCredential("password")))
{
tries++;
if (tries == 5)
{
System.out.println("=======================================");
System.out.println("Failed to enter password too many times");
System.out.println("Goodbye :)");
System.out.println("=======================================");
System.exit(0);
}
else
{
System.out.println("=======================================");
System.out.println("Incorrect password");
System.out.println(5 - tries + " tries remaining");
System.out.println("Password :");
}
}
else
{
go = true;
}
}
return password;
}
/**
* Διαβάζει ένα καινούργιο password από το terminal
*
* @return το νέο password
*/
static String newPassword()
{
boolean go = false;
String pass1 = " ";
while (!go)
{
pass1 = UI.input.next();
if (pass1.equals("password") || pass1.equals("Password"))
{
System.out.println("=======================================");
System.out.println("Your Password cant be '" + pass1 + "'");
System.out.println("Try something else");
System.out.println("Password :");
}
else
{
go = true;
}
}
System.out.println("=======================================");
System.out.println("Please re-enter your Password :");
String pass2 = "";
go = false;
while (!go)
{
pass2 = UI.input.next();
if (!pass2.equals(pass1))
{
System.out.println("=======================================");
System.out.println("Passwords don't match");
System.out.println("Re-enter Password :");
}
else
{
go = true;
}
}
return pass1;
}
/**
* Διαβάζει ένα καινούργιο email από το terminal
*
* @return το νέο email
*/
static String newEmail()
{
boolean go = false;
String email = "";
while (!go)
{
email = UI.input.next();
if (!email.contains(".") || !email.contains("@"))
{
System.out.println("=======================================");
System.out.println("Invalid email address");
System.out.println("Enter email :");
}
else if (!User.checkCredentialAvailability("email", email))
{
System.out.println("=======================================");
System.out.println("Email already in use");
System.out.println("Enter email :");
}
else
{
go = true;
}
}
return email;
}
/**
* Διαβάζει ένα καινούργιο τηλεφωνικό αριθμό από το terminal
*
* @return το νέο αριθμό
*/
static String newPhone()
{
boolean go = false;
String newPhone = "";
while (!go)
{
newPhone = UI.input.next();
if (newPhone.length() != 10)
{
System.out.println("=======================================");
System.out.println("Invalid Phone Number");
System.out.println("Phone :");
}
else
{
go = true;
}
}
System.out.println("=======================================");
return newPhone;
}
/**
* Επιτρέπει την επεξεργασία όλων των χαρακτηριστικών ενός καταλύματος από το terminal
*
* @param rental το κατάλυμα προς επεξεργασία
*/
static void editRental(Rental rental)
{
System.out.println("=======================================");
System.out.println("What would you like to edit?");
System.out.println("0.Nothing");
System.out.println("1.Name");
System.out.println("2.Type");
System.out.println("3.Location");
System.out.println("4.m^2");
System.out.println("5.Price");
System.out.println("6.Wifi");
System.out.println("7.Parking");
System.out.println("8.Pool");
System.out.println("=======================================");
int entry = validityCheck(0,8);
Scanner lineScanner = new Scanner(System.in);
if (entry == 1)
{
System.out.println("Please enter new Name:");
String name = lineScanner.nextLine();
rental.setCharacteristic("name", name);
System.out.println("Name changed");
System.out.println("=======================================");
}
else if (entry == 2)
{
System.out.println("Please enter new Type:");
String type = lineScanner.nextLine();
rental.setCharacteristic("type", type);
System.out.println("Type changed");
System.out.println("=======================================");
}
else if (entry == 3)
{
System.out.println("Please enter new Location:");
String location = lineScanner.nextLine();
rental.setCharacteristic("location", location);
System.out.println("Location changed");
System.out.println("=======================================");
}
else if (entry==4)
{
System.out.println("Please enter new m^2");
String m2 = lineScanner.nextLine();
rental.setCharacteristic("m2",m2);
System.out.println("m^2 changed");
System.out.println("=======================================");
}
else if (entry == 5)
{
System.out.println("Please enter new price:");
String price = lineScanner.nextLine();
rental.setCharacteristic("price", price);
System.out.println("Price changed");
System.out.println("=======================================");
}
else if (entry == 6)
{
System.out.println("Does your Rental Provide Wifi?:");
boolCharacteristicEntry(rental,"wifi");
System.out.println("Wifi changed");
System.out.println("=======================================");
}
else if (entry == 7)
{
System.out.println("Does your Rental Provide Parking?:");
boolCharacteristicEntry(rental,"parking");
System.out.println("Parking changed");
System.out.println("=======================================");
}
else if (entry == 8)
{
System.out.println("Does your Rental Provide Pool?:");
boolCharacteristicEntry(rental,"pool");
System.out.println("Pool changed");
System.out.println("=======================================");
}
rental.updateCharacteristics();
}
/**
* Εκτυπώνει τα στοιχεία ενός καταλύματος στο terminal
*
* @param rental to κατάλυμα προς εκτύπωση
*/
static void showRental(Rental rental)
{
System.out.println("=======================================");
System.out.println("Id: " + rental.getId());
System.out.println("Name: " + rental.getCharacteristic("name"));
System.out.println("Type: " + rental.getCharacteristic("type"));
System.out.println("Location: " + rental.getCharacteristic("location"));
System.out.println("m^2 :" + rental.getCharacteristic("m2"));
System.out.println("Per Day Price: " + rental.getCharacteristic("price"));
System.out.println("Wifi: " + rental.getCharacteristic("wifi"));
System.out.println("Parking :" + rental.getCharacteristic("parking"));
System.out.println("Pool :" + rental.getCharacteristic("pool"));
System.out.println("=======================================");
}
/**
* Διαβάζει μία ημερομηνία από το terminal
*
* @return την ημερομηνία
*/
static Date inputDate()
{
System.out.println("Year:");
int year = validityCheck(2021);
System.out.println("Month:");
int month = validityCheck(1, 12);
System.out.println("Day:");
int day = validityCheck(1, 30);
Date date = new Date(day, month, year);
return date;
}
/**
* Διαβάζει δυαδικά χαρακτηριστικά καταλυμάτων (πχ wifi, ναι ή οχι)
* @param rental το κατάλυμα του οποίου το χαρακτηριστικό διαβάζουμε
* @param type το χαρακτηριστικό που θα διαβάσουμε
*/
static void boolCharacteristicEntry(Rental rental, String type)
{
System.out.println("1.Yes");
System.out.println("2.No");
int entry = validityCheck(1,2);
if(entry==1)
{
rental.addCharacteristic(type,"yes");
}
else
{
rental.addCharacteristic(type,"no");
}
}
/**
* Συγκεκριμένος τύπος φίλτρου για αριθμητικά φάσματα
* @param ids τα ids που είναι διαθέσιμα πριν το φιλτράρισμα
* @param type ο τύπος χαρακτηριστικού που φιλτράρουμε
* @return τα ids που είναι διαθέσιμα μετά το φιλτράρισμα
*/
static HashSet<String> filterIntRange(HashSet<String> ids, String type)
{
System.out.println("=======================================");
System.out.println("Minimum:");
int min = validityCheck(0);
System.out.println("Maximum:");
int max = validityCheck(min);
System.out.println("=======================================");
HashSet<String> toKeep = new HashSet<>();
for (int i = min; i <= max; i++)
{
Integer value = i;
HashSet<String> tIds = Rental.strongFilter(ids,type,value.toString());
toKeep.addAll(tIds);
}
ids.retainAll(toKeep);
return ids;
}
/**
* Φιλτράρει τα αποτελέσματα της αναζήτησης με διάφορα κριτήρια
* @param ids τα ids που είναι διαθέσιμα πριν το φιλτράρισμα
* @return τα ids που είναι διαθέσιμα μετά το φιλτράρισμα
*/
static HashSet<String> addFilters(HashSet<String> ids)
{
System.out.println("=======================================");
System.out.println("Specify Rental Type? (Hotel,bnb,etc.):");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("=======================================");
int entry = validityCheck(1,2);
if (entry == 1)
{
System.out.println("What type of rental would you like to see?");
Scanner lineScanner2 = new Scanner(System.in);
String type = lineScanner2.nextLine();
ids = Rental.filter(ids,"type",type);
}
System.out.println("=======================================");
System.out.println("Specify Location?");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("=======================================");
entry = validityCheck(1,2);
if (entry == 1)
{
System.out.println("Where are you going?");
Scanner lineScan = new Scanner(System.in);
String location = lineScan.nextLine();
ids = Rental.filter(ids,"location",location);
}
System.out.println("=======================================");
System.out.println("Specify Square Meters ?:");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("=======================================");
entry = validityCheck(1,2);
if (entry == 1)
{
ids = filterIntRange(ids,"m2");
}
System.out.println("=======================================");
System.out.println("Specify Price Range ?:");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("=======================================");
entry = validityCheck(1,2);
if (entry == 1)
{
ids = filterIntRange(ids,"price");
}
System.out.println("=======================================");
System.out.println("WiFi ?:");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("3.Don't Care");
System.out.println("=======================================");
entry = validityCheck(1,3);
if (entry == 1)
{
ids = Rental.strongFilter(ids,"wifi","yes");
}
else if (entry == 2)
{
ids = Rental.strongFilter(ids,"wifi","no");
}
System.out.println("=======================================");
System.out.println("Parking ?:");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("3.Don't Care");
System.out.println("=======================================");
entry = validityCheck(1,3);
if (entry == 1)
{
ids = Rental.strongFilter(ids,"parking","yes");
}
else if (entry == 2)
{
ids = Rental.strongFilter(ids,"parking","no");
}
System.out.println("=======================================");
System.out.println("Pool ?:");
System.out.println("1.Yes");
System.out.println("2.No");
System.out.println("3.Don't Care");
System.out.println("=======================================");
entry = validityCheck(1,3);
if (entry == 1)
{
ids = Rental.strongFilter(ids,"pool","yes");
}
else if (entry == 2)
{
ids = Rental.strongFilter(ids,"pool","no");
}
return ids;
}
}
|
KonnosBaz/AUTh_CSD_Projects
|
Object Oriented Programming (2021)/src/UIMethods.java
|
2,353 |
package UserClientV1;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.font.TextAttribute;
import java.util.Map;
/**
* Κλάση που ουσιαστικά είναι μια φόρμα που έχει κάποιες πληροφορίες σχετικά με
* την Πτυχιακή . Εμφανίζεται όταν πατηθεί το κουμπί Thesis.
* @author Michael Galliakis
*/
public class Dthesis extends javax.swing.JDialog {
/**
* Κατασκευαστής της κλάσης που την αρχικοποιεί .
* @param parent Η φόρμα που "ανήκει" το νέο panel της κλάσης μας
* @param modal True αν θέλουμε να είναι συνέχεια onTop μέχρι να κλείσουμε το panel μας
* αλλιώς False αν θέλουμε ο χρήστης να μπορεί να κάνει τρέχον παράθυρο την φόρμα που ανήκει το panel.
*/
public Dthesis(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.setIconImage(Globals.biLogo);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
this.setAlwaysOnTop(true);
//Underline lTEIAthinas
Font font = lTEIAthinas.getFont();
Map attributes = font.getAttributes();
attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
lTEIAthinas.setFont(font.deriveFont(attributes));
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
lTEI = new javax.swing.JLabel();
lLogo = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
lTEIAthinas = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jLabel15 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
jLabel1.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
jLabel1.setText("ΠΤΥΧΙΑΚΗ ΕΡΓΑΣΙΑ");
jLabel1.setToolTipText("");
lTEI.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserClientV1/Images/TEI36.png"))); // NOI18N
lTEI.setName(""); // NOI18N
lLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserClientV1/Images/logoPMGv2F48.png"))); // NOI18N
lLogo.setToolTipText("");
jLabel3.setFont(new java.awt.Font("Dialog", 3, 14)); // NOI18N
jLabel3.setText("με θέμα :");
jLabel3.setToolTipText("");
jLabel6.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
jLabel6.setText("Email :");
jLabel6.setToolTipText("");
jTextArea1.setEditable(false);
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jTextArea1.setText("Μελέτη ενός ολοκληρωμένου συστήματος για τη διαχείριση μικρο-ελεγκτών απομακρυσμένα \n σε πραγματικό χρόνο από εγγεγραμμένους χρήστες (πχ για τον έλεγχο \"έξυπνων\" σπιτιών). \nΠιλοτικά θα υλοποιηθεί client-server εφαρμογή που θα επιτρέπει την διαχείριση διάφορων \nμονάδων (Αισθητήρες,φώτα,διακόπτες) κάποιων μικρο-ελεγκτών(Arduino). \nΈμφαση θα δοθεί στη χρήση τεχνολογιών Java,MySQL,Arduino sketch,PHP,Javascript,CSS,HTML .");
jTextArea1.setToolTipText("");
jScrollPane1.setViewportView(jTextArea1);
jTextField1.setEditable(false);
jTextField1.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField1.setText("[email protected]");
jTextField1.setToolTipText("");
jTextField2.setEditable(false);
jTextField2.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField2.setText("[email protected]");
jTextField2.setToolTipText("");
jTextField3.setEditable(false);
jTextField3.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField3.setText("https://github.com/michaelgalliakis/myThesis.git");
jTextField3.setToolTipText("");
jLabel2.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
jLabel2.setText("Όλα τα αρχεία :");
jLabel2.setToolTipText("");
jLabel7.setFont(new java.awt.Font("Dialog", 2, 12)); // NOI18N
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel7.setText("Ημερομηνία παρουσίασης : 4/2016");
jLabel7.setToolTipText("");
lTEIAthinas.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
lTEIAthinas.setText("Technological Educational Institute of Athens - IT department.");
lTEIAthinas.setToolTipText("");
jLabel10.setToolTipText("");
jLabel11.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
jLabel11.setText("Φοιτητής :");
jLabel11.setToolTipText("");
jLabel12.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
jLabel12.setText("ΑΜ :");
jLabel12.setToolTipText("");
jLabel13.setText("&");
jLabel13.setToolTipText("");
jLabel14.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
jLabel14.setText("Επιβλέπων καθηγητές :");
jLabel14.setToolTipText("");
jTextField4.setEditable(false);
jTextField4.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField4.setText("Τσολακίδης Αναστάσιος");
jTextField4.setToolTipText("");
jTextField5.setEditable(false);
jTextField5.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField5.setText("Σκουρλάς Χρήστος");
jTextField5.setToolTipText("");
jLabel15.setText("&");
jLabel15.setToolTipText("");
jTextField6.setEditable(false);
jTextField6.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField6.setText("081001");
jTextField6.setToolTipText("");
jTextField7.setEditable(false);
jTextField7.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
jTextField7.setText("Γαλλιάκης Μιχαήλ");
jTextField7.setToolTipText("");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(142, 142, 142)
.addComponent(lTEI)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lLogo))
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(43, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 605, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(342, 342, 342)
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel6)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(73, 73, 73)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel14))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(172, 172, 172)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(159, 159, 159)
.addComponent(jLabel7)))
.addGap(16, 16, 16)))
.addComponent(jLabel11)
.addComponent(jLabel12))
.addGap(42, 42, 42))))
.addGroup(layout.createSequentialGroup()
.addGap(98, 98, 98)
.addComponent(lTEIAthinas)
.addContainerGap(102, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(292, 292, 292)
.addComponent(jLabel3)
.addGap(0, 324, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lLogo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lTEI, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(8, 8, 8)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lTEIAthinas, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jLabel6))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel7)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* Μέθοδος που εκτελείτε όταν η φόρμα μας κλείσει .
* @param evt Το Default WindowEvent που έχει το συγκεκριμένο event το οποίο στη
* περίπτωση μας δεν χρησιμοποιείται.
*/
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
if (Globals.objMainFrame!=null)
Globals.objMainFrame.bThessis.setBackground(Globals.thesisColor);
if (Globals.objUserLogin!=null)
Globals.objUserLogin.bThessis.setBackground(Globals.thesisColor);
}//GEN-LAST:event_formWindowClosing
/**
* Κλασική static main μέθοδος που δίνει την δυνατότητα να ξεκινήσει η εκτέλεση
* του project μας από εδώ και πρακτικά χρησιμοποιείται για να μπορούμε να κάνουμε
* αλλαγές και ελέγχους όσο αναφορά κυρίως στην εμφάνιση του panel μας.
* Δεν έχει καμία χρήση κατά την λειτουργία του Simulator στην κανονική ροή εκτέλεσης.
* @param args Default παράμετροι που δεν χρησιμοποιούνται και που μπορεί δυνητικά να πάρει
* το πρόγραμμα μας στην περίπτωση που εκτελεστεί από περιβάλλον γραμμής εντολών και όταν
* συγχρόνως το project μας έχει σαν κύριο-αρχικό αρχείο εκτέλεσης το Dthesis.java.
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Dthesis dialog = new Dthesis(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JLabel lLogo;
private javax.swing.JLabel lTEI;
private javax.swing.JLabel lTEIAthinas;
// End of variables declaration//GEN-END:variables
}
/*
* * * * * * * * * * * * * * * * * * * * * * *
* + + + + + + + + + + + + + + + + + + + + + *
* +- - - - - - - - - - - - - - - - - - - -+ *
* +| P P P P M M M M G G G G |+ *
* +| P P M M M M G G |+ *
* +| P P P p M M M M G |+ *
* +| P M M M G G G G |+ *
* +| P M M G G |+ *
* +| P ® M M ® G G G G |+ *
* +- - - - - - - - - - - - - - - - - - - -+ *
* + .----. @ @ |+ *
* + / .-"-.`. \v/ |+ *
* + | | '\ \ \_/ ) |+ *
* + ,-\ `-.' /.' / |+ *
* + '---`----'----' |+ *
* +- - - - - - - - - - - - - - - - - - - -+ *
* + + + + + + + + + + + + + + + + + + + + + *
* +- - - - - - - - - - - - - - - - - - - -+ *
* +| Thesis Michael Galliakis 2016 |+ *
* +| Program m_g ; -) [email protected] |+ *
* +| TEI Athens - IT department. |+ *
* +| [email protected] |+ *
* +| https://github.com/michaelgalliakis |+ *
* +| (myThesis.git) |+ *
* +- - - - - - - - - - - - - - - - - - - -+ *
* + + + + + + + + + + + + + + + + + + + + + *
* * * * * * * * * * * * * * * * * * * * * * *
*/
|
michaelgalliakis/myThesis
|
UserClientV1/src/UserClientV1/Dthesis.java
|
2,354 |
package i18n;
import java.util.ListResourceBundle;
public class GuiLabels_el extends ListResourceBundle {
@Override
protected Object[][] getContents() {
return contents;
}
private Object[][] contents = {{"NotCorrectLoginOrPassword","Λανθασμένο όνομα χρήστη ή κωδικός πρόσβασης"},
{"auth","Πιστοποίηση ταυτότητας"},
{"reg","Εγγραφή"},{"login","Όνομα χρήστη"},{"password","Κωδικός πρόσβασης"},
{"ThereIsUserWithThisLogin","Υπάρχει ήδη χρήστης με αυτό το όνομα χρήστη"},
{"PasswordsNotEqual","Οι κωδικοί πρόσβασης δεν ταιριάζουν!"},
{"RepeatPassword","Επαναλάβετε τον κωδικό πρόσβασης"},
{"ID","ID"},{"Name","Όνομα"},{"Coordinates","Συντεταγμένες"},
{"CreationTime","Χρόνος δημιουργίας"},{"StudentsCount","Αριθμός μαθητών"},
{"ExpelledStudentsCount","Αριθμός αποβλήτων μαθητών"},
{"ShouldBeExpelledCount","Αριθμός μαθητών στο ΠΠΑ"},
{"Semester","Εξάμηνο"},{"Admin","Διαχειριστής"},{"Table","Πίνακας"},
{"Map","Χάρτης"},{"add","Προσθήκη"},{"addIfMax","Προσθήκη, αν είναι μέγιστο"}, {"remove","Αφαίρεση"},
{"clear","Καθαρισμός"},{"execute","Εκτέλεση σεναρίου"},{"info","Πληροφορίες"},
{"FillGraphs","Συμπληρώστε όλα τα υποχρεωτικά πεδία"}, {"First","Πρώτος"},
{"Third","Τρίτος"},{"Eight","Όγδοος"}, {"Red","Κόκκινο"},{"Blue","Μπλε"},{"Brown","Καφέ"},
{"Green","Πράσινο"},{"Orange","Πορτοκαλί"},{"EyeColor","Χρώμα ματιών"},{"HairColor","Χρώμα μαλλιών"},
{"PersonName","Όνομα προσώπου"},{"Weight","Βάρος"},{"Nationality","Εθνικότητα"},
{"NorthKorea","Βόρεια Κορέα"}, {"SouthKorea","Νότια Κορέα"}, {"UnitedKingdom","Ηνωμένο Βασίλειο"},
{"NoRights","Δεν έχετε δικαίωμα να επεξεργαστείτε"},{"Update","Ενημέρωση"}, {"ChooseARow","Επιλέξτε μια σειρά!"},
{"AreYouSure","Είστε σίγουροι;"},{"Yes","Ναι"},{"No","Όχι"},
{"ErrorDuringExecution","Σφάλμα κατά τη διάρκεια εκτέλεσης του σεναρίου"},
{"ChooseAGroup","Επιλέξτε μια ομάδα"},{"filter","φίλτρο"}
};
}
|
Deyzer2566/Programming-8
|
Client/src/i18n/GuiLabels_el.java
|
2,355 |
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.snowtide.PDF;
import com.snowtide.pdf.Document;
import com.snowtide.pdf.OutputTarget;
import com.snowtide.pdf.Page;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* Created by Nick Fytros on 19/9/2016.
*/
public class PdfExtractData extends JFrame {
private JPanel panel;
private JLabel pdfLabel, txtLabel;
private JButton pdfBtn, txtBtn;
private JTextArea comparisonResults;
// IMPORTANT CHANGE ALL IMAGE LOCATIONS TO getClass().getResource("/images/text.png") BEFORE PROD
private ImageIcon iconopentxt = new ImageIcon("images/text.png");
private ImageIcon iconopenpdf = new ImageIcon("images/pdf.png");
private ImageIcon iconcompare = new ImageIcon("images/compare.png");
private ImageIcon iconexit = new ImageIcon("images/exit.png");
private ImageIcon iconinfo = new ImageIcon("images/info.png");
private JProgressBar progBar;
private String txtFilePath = "";
private java.util.ArrayList<String> pdfFilePaths = new ArrayList<String>();
private java.util.ArrayList<String[]> txtFileLines = new ArrayList<String[]>();
public PdfExtractData() {
initUI();
}
private void initUI() {
// set the image to display on top left corner
ImageIcon webIcon = new ImageIcon("images/taxlisis_logo.png");
setIconImage(webIcon.getImage());
createMenuBar();
panel = (JPanel) getContentPane();
// buttons for pdf and text file picker
pdfBtn = new JButton("Επιλογή PDF", iconopenpdf);
pdfBtn.addActionListener(new OpenPDFFileAction());
pdfLabel = new JLabel("Δεν έχουν επιλεγεί PDF αρχεία");
pdfLabel.setForeground(Color.red);
txtBtn = new JButton("Επιλογή TXT", iconopentxt);
txtBtn.addActionListener(new OpenTextFileAction());
txtLabel = new JLabel("Δεν έχει επιλεγεί το αρχείο TXT");
txtLabel.setForeground(Color.red);
// result text area and label
JScrollPane pane = new JScrollPane();
JLabel comparisonLabel = new JLabel("Αποτελέσματα σύγκρισης:");
comparisonResults = new JTextArea();
comparisonResults.setLineWrap(true);
comparisonResults.setWrapStyleWord(true);
comparisonResults.setEditable(false);
comparisonResults.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
pane.getViewport().add(comparisonResults);
// progress bar
progBar = new JProgressBar();
progBar.setVisible(false);
progBar.setStringPainted(true);
// allow copy paste on resultsTextArea
comparisonResults.addMouseListener(new ContextMenuMouseListener());
// compare button
JButton startButton = new JButton("Σύγκριση", iconcompare);
startButton.addActionListener((ActionEvent event) -> {
// check if pdf and txt files are chosen
if (pdfFilePaths.size() > 0 && pdfFilePaths.size() <= 400 && !txtFilePath.isEmpty()) {
// reset before run
progBar.setMaximum(pdfFilePaths.size());
progBar.setValue(0);
progBar.setVisible(true);
comparisonResults.setText("");
// start the proccess in a thread
Runnable compare = () -> {
for (String pdfPath: pdfFilePaths) {
extractDataAndCompare(pdfPath);
}
System.gc();
};
Thread thread = new Thread(compare);
thread.start();
}else {
JOptionPane.showMessageDialog(panel, "Πρέπει να επιλέξετε τα αρχεία PDF (μέχρι 400) και το αρχείο TXT για να ξεκινήσει η σύγκριση",
"Error", JOptionPane.ERROR_MESSAGE);
}
});
// set the button on the pane
createLayout(pdfBtn, pdfLabel, txtBtn, txtLabel, startButton, comparisonLabel, pane, progBar);
setTitle("Εφαρμογή σύγκρισης αρχείων PDF");
setSize(700, 400);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private void createMenuBar() {
JMenuBar menubar = new JMenuBar();
JMenu file = new JMenu("Αρχείο");
file.setMnemonic(KeyEvent.VK_F);
JMenu info = new JMenu("Πληροφορίες");
JMenuItem eMenuItemopenpdf = new JMenuItem("Επιλογή PDF", iconopenpdf);
JMenuItem eMenuItemopentxt = new JMenuItem("Επιλογή TXT", iconopentxt);
JMenuItem eMenuIteminfo = new JMenuItem("Πληροφορίες", iconinfo);
JMenuItem eMenuItemexit = new JMenuItem("Έξοδος", iconexit);
eMenuItemexit.setMnemonic(KeyEvent.VK_E);
eMenuItemexit.addActionListener((ActionEvent event) -> {
System.exit(0);
});
eMenuItemopenpdf.addActionListener(new OpenPDFFileAction());
eMenuItemopentxt.addActionListener(new OpenTextFileAction());
eMenuIteminfo.addActionListener((ActionEvent event) -> {
JOptionPane.showMessageDialog(panel, "Version 1.0.0 \nDeveloped by Nick Fytros for LEONTIOS IKE & ASSOCIATES",
"Information", JOptionPane.INFORMATION_MESSAGE);
});
file.add(eMenuItemopenpdf);
file.add(eMenuItemopentxt);
file.add(eMenuItemexit);
info.add(eMenuIteminfo);
menubar.add(file);
menubar.add(info);
setJMenuBar(menubar);
}
private void createLayout(JComponent... arg) {
Container pane = getContentPane();
GroupLayout gl = new GroupLayout(pane);
pane.setLayout(gl);
gl.setAutoCreateContainerGaps(true);
gl.setHorizontalGroup(gl.createSequentialGroup()
.addGroup(gl.createParallelGroup()
.addComponent(arg[0])
.addComponent(arg[1])
.addComponent(arg[2])
.addComponent(arg[3])
.addComponent(arg[4])
.addComponent(arg[7]))
.addGap(30)
.addGroup(gl.createParallelGroup()
.addComponent(arg[5])
.addComponent(arg[6]))
);
gl.setVerticalGroup(gl.createParallelGroup()
.addGroup(gl.createSequentialGroup()
.addComponent(arg[0])
.addComponent(arg[1])
.addGap(30)
.addComponent(arg[2])
.addComponent(arg[3])
.addGap(30)
.addComponent(arg[4])
.addGap(10)
.addComponent(arg[7]))
.addGroup(gl.createSequentialGroup()
.addComponent(arg[5])
.addGap(10)
.addComponent(arg[6]))
);
}
private class OpenPDFFileAction extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fdia = new JFileChooser();
fdia.setMultiSelectionEnabled(true);
FileFilter filter = new FileNameExtensionFilter("Αρχεία .pdf",
"pdf");
fdia.setFileFilter(filter);
int ret = fdia.showDialog(panel, "Επιλογή αρχείων");
if (ret == JFileChooser.APPROVE_OPTION) {
File[] files = fdia.getSelectedFiles();
pdfFilePaths.clear();
for (File file : files) {
pdfFilePaths.add(file.getAbsolutePath());
}
pdfLabel.setText("Επιλέχθηκαν " + files.length + " αρχεία PDF");
pdfLabel.setForeground(new Color(21, 193, 198));
}
}
}
private class OpenTextFileAction extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fdia = new JFileChooser();
FileFilter filter = new FileNameExtensionFilter("Αρχεία .txt",
"txt");
fdia.setFileFilter(filter);
int ret = fdia.showDialog(panel, "Επιλογή αρχείου");
if (ret == JFileChooser.APPROVE_OPTION) {
File file = fdia.getSelectedFile();
txtFilePath = file.getAbsolutePath();
txtLabel.setText("Επιλέχθηκε το αρχείο: " + file.getName());
//read file into stream, try-with-resources
txtFileLines.clear();
try (Stream<String> stream = Files.lines(Paths.get(txtFilePath),StandardCharsets.ISO_8859_1)) {
// add the txt file lines to the arraylist
stream.forEach((line) -> {txtFileLines.add(line.split(" +"));});
} catch (IOException ex) {
ex.printStackTrace();
}
txtLabel.setForeground(new Color(21, 193, 198));
}
}
}
private void extractDataAndCompare(String pdfFileLocation) {
String filteredDataFirstPage;
String filteredDataLastPage;
Hashtable<String, String> extractedData = new Hashtable<String, String>();
String[] stoixeiaParastatikou, posa;
// variable to see if the current pdf is resolved
boolean pdfResolved = false;
// DEVELOPED USING WITH SNOWTIDE PDF LIBRARY
Document pdf = PDF.open(pdfFileLocation);
// get the last page
Page firstPage = pdf.getPage(0);
Page lastPage = pdf.getPage(pdf.getPages().size()-1);
StringBuilder firstPageText = new StringBuilder(1024);
StringBuilder lastPageText = new StringBuilder(1024);
firstPage.pipe(new OutputTarget(firstPageText));
lastPage.pipe(new OutputTarget(lastPageText));
try {
pdf.close();
// replaces all the whitespaces with single space
filteredDataFirstPage = firstPageText.toString().replaceAll("\\s+", "~");
filteredDataLastPage = lastPageText.toString().replaceAll("\\s+", "~");
// try (BufferedWriter writer = Files.newBufferedWriter(Paths.get("C:/Users/fitro/Downloads/export.txt"))) {
// writer.write(filteredDataFirstPage);
// }
stoixeiaParastatikou = getParastatikoData(filteredDataFirstPage).split("~");
posa = getPosa(filteredDataLastPage).split("~");
// fill the hashtable with the results
// if he is ΙΔΙΩΤΗΣ dont search for afm
if (getValue("ΕΠΩΝΥΜΙΑ~:", filteredDataFirstPage).equals("Ι∆ΙΩΤΗΣ")){
extractedData.put("afm", "000000000");
}else extractedData.put("afm", getValue("Α.Φ.Μ.:", filteredDataFirstPage));
extractedData.put("eidos_parastatikou", getEidosParastatikou(filteredDataFirstPage));
extractedData.put("seira", stoixeiaParastatikou[0]);
extractedData.put("number", stoixeiaParastatikou[1]);
extractedData.put("date", stoixeiaParastatikou[2]);
// catch the case in which 'ΠΛΗΡΩΤΕΟ ΠΟΣΟ' πινακάκι is empty
if (posa.length < 3){
// write the error on results TextArea
comparisonResults.append("* Το " + new File(pdfFileLocation).getName() + " δεν έχει το πινακάκι 'ΠΛΗΡΩΤΕΟ ΠΟΣΟ' συμπληρωμένο\n");
extractedData.put("synolo_aksias_ypok_fpa", "");
extractedData.put("synolo_fpa", "");
extractedData.put("ammount_to_pay", "");
pdfResolved = true;
}else{
extractedData.put("synolo_aksias_ypok_fpa", posa[0]);
extractedData.put("synolo_fpa", posa[1]);
extractedData.put("ammount_to_pay", posa[2]);
}
// TODO implement comparison method
progBar.setValue(progBar.getValue() + 1);
double total = 0.00;
// txtFileLines.forEach(lineArray -> {
// if (lineArray.length > 4) {
// System.out.println(lineArray[4] + " ------------ " + extractedData.get("afm") + " contains: " + lineArray[4].contains(extractedData.get("afm")));
// }
// System.out.println(extractedData.get("afm").equals("000000000") || (lineArray[4].length() >= 9 && lineArray[4].contains(extractedData.get("afm"))));
// });
ArrayList<String[]> dataExported = (ArrayList<String[]>) txtFileLines.parallelStream().filter(lineArray -> lineArray.length > 4
&&(lineArray[1]+lineArray[2].substring(0, 1)).equals(extractedData.get("seira"))
&& lineArray[3].equals(extractedData.get("number"))
/* missing the date clause*/
).collect(Collectors.toList());
for ( String[] lineArray: dataExported){
if ((extractedData.get("afm").equals("000000000") || (lineArray[4].length() >= 9 && lineArray[4].contains(extractedData.get("afm"))))) {
total += Double.valueOf(lineArray[lineArray.length - 1].replace(",", "."));
}else{
comparisonResults.append("* Το " + new File(pdfFileLocation).getName() + " δεν έχει το ΑΦΜ του στο txt\n");
pdfResolved = true;
break;
}
}
total = Double.valueOf(new DecimalFormat("##.##").format(total).replace(",","."));
if (!extractedData.get("ammount_to_pay").isEmpty() && total > 0.00 && !pdfResolved) {
if (total != Double.valueOf(extractedData.get("ammount_to_pay").replace(",", "."))) {
comparisonResults.append("* Το " + new File(pdfFileLocation).getName() + " διαφέρει κατά " + new DecimalFormat("##.##").format(Math.abs(total - Double.valueOf(extractedData.get("ammount_to_pay").replace(",", ".")))) + " ευρώ\n");
}
}else if (!pdfResolved){
comparisonResults.append("* Το " + new File(pdfFileLocation).getName() + " δεν είναι καταχωρημένο\n");
}
} catch (IOException e) {
e.printStackTrace();
}
}
private String getValue (String key, String pdfData){
String value = "";
// going to the result of the key and getting the data
int dataIndexStart = pdfData.indexOf(key)+key.length()+1;
while(!String.valueOf(pdfData.charAt(dataIndexStart)).equals("~")){
value += String.valueOf(pdfData.charAt(dataIndexStart));
dataIndexStart ++;
}
return value;
}
private String getPosa (String pdfData){
// key to start index searching on '~' separated document data
String key = "ΠΛΗΡ~ΤΕΟ~ΠΟΣΟ";
String value = "";
// going to the result of the key and getting the data
if (pdfData.indexOf(key) == -1){
key = "ΠΛΗΡΩΤΕΟ~ΠΟΣΟ";
}
int dataIndexStart = pdfData.indexOf(key)+key.length()+1;
// stop when you find '~' and the next value is not a comma or a number
while(!String.valueOf(pdfData.charAt(dataIndexStart)).equals("~") || String.valueOf(pdfData.charAt(dataIndexStart+1)).matches("[0-9,]")){
value += String.valueOf(pdfData.charAt(dataIndexStart));
dataIndexStart ++;
}
return value;
}
private String getEidosParastatikou (String pdfData){
// key to start index searching on '~' separated document data
String key = "ΗΜΕΡΟΜΗΝΙΑ";
String value = "";
// going to the result of the key and getting the data
int dataIndexStart = pdfData.indexOf(key)+key.length()+1;
// stop when you find '~' and the next value is not a comma or a number
while(!String.valueOf(pdfData.charAt(dataIndexStart)).equals("~") || !String.valueOf(pdfData.charAt(dataIndexStart+1)).matches("[0-9]")){
value += String.valueOf(pdfData.charAt(dataIndexStart));
dataIndexStart ++;
}
return value.replace("~"," ");
}
private String getParastatikoData (String pdfData){
// key to start index searching on '~' separated document data
String key = "ΣΚΟΠΟΣ~∆ΙΑΚΙΝΗΣΗΣ";
String value = "";
// going to the result of the key and getting the data
int dataIndexStart = pdfData.indexOf(key)-2;
// stop when you find '~' and the next value is not a comma or a number
while(!String.valueOf(pdfData.charAt(dataIndexStart)).equals("~") || String.valueOf(pdfData.charAt(dataIndexStart-1)).matches("[0-9,/]")){
value += String.valueOf(pdfData.charAt(dataIndexStart));
dataIndexStart --;
}
return new StringBuffer(value).reverse().toString();
}
public static void main(String args[]) {
EventQueue.invokeLater(() -> {
PdfExtractData ex = new PdfExtractData();
ex.setVisible(true);
});
}
}
|
nick-fytros/pdf-extract-compare
|
src/main/java/PdfExtractData.java
|
2,361 |
package gr.cti.eslate.base.container;
import java.util.ListResourceBundle;
public class UIDialogBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"Border", "Περιθώριο"},
{"Color", "Χρώμα"},
{"Image", "Εικόνα"},
{"None", "Κανένα"},
{"Color1", "Επιλογή χρώματος"},
{"Image1", "Επιλογή εικόνας"},
{"SelectIcon", "Επιλογή εικονίδιου"},
{"Title", "Τίτλος"},
{"Insets", "Μέγεθος"},
{"MWUI", "Ρύθμιση εμφάνισης μικρόκοσμου"},
{"OK", "Εντάξει"},
{"Cancel", "Άκυρο"},
{"borderColor", "Χρώμα περιθωρίου"},
{"selectBorderImage", "Επιλογή εικόνας περιθωρίου"},
{"selectMicroworldIcon", "Επιλογή εικονίδιου μικρόκοσμου"},
{"Up", "Πάνω"},
{"Down", "Κάτω"},
{"Right", "Δεξιά"},
{"Left", "Αριστερά"},
{"OuterBorder", "Εξωτερικό περιθώριο"},
{"UseOuterBorder", "Κανένα"}, //Χρήση εξωτερικού περιθωρίου"},
{"Raised", "Ανασηκωμένο"},
{"Lowered", "Χαμηλωμένο"},
{"Background", "Υπόβαθρο"},
{"MwdIcon", "Εικονίδιο μικρόκοσμου"},
{"backgroundColor", "Χρώμα υποβάθρου"},
{"selectBackgroundImage", "Επιλογή εικόνας υποβάθρου"},
{"Center", "Κεντράρισμα"},
{"Fit", "Άπλωμα"},
{"Tile", "Μωσαϊκό"},
{"UnableToSaveIcon", "Σφάλμα κατά την αποθήκευση του αρχείου"},
{"SaveBorderIcon", "Εξαγωγή εικονιδίου περιθωρίου"},
{"SaveBgrIcon", "Εξαγωγή εικονίδιου υποβάθρου"},
{"SaveMwdIcon", "Εξαγωγή εικονίδιου μικρόκοσμου"},
{"L&F", "Θέμα περιβάλλοντος"},
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/base/container/UIDialogBundle_el_GR.java
|
2,363 |
package com.google.android.youtube.player.internal;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public final class bh
{
public static Map<String, String> a(Locale paramLocale)
{
HashMap localHashMap = new HashMap();
localHashMap.put("error_initializing_player", "An error occurred while initializing the YouTube player.");
localHashMap.put("get_youtube_app_title", "Get YouTube App");
localHashMap.put("get_youtube_app_text", "This app won't run without the YouTube App, which is missing from your device");
localHashMap.put("get_youtube_app_action", "Get YouTube App");
localHashMap.put("enable_youtube_app_title", "Enable YouTube App");
localHashMap.put("enable_youtube_app_text", "This app won't work unless you enable the YouTube App.");
localHashMap.put("enable_youtube_app_action", "Enable YouTube App");
localHashMap.put("update_youtube_app_title", "Update YouTube App");
localHashMap.put("update_youtube_app_text", "This app won't work unless you update the YouTube App.");
localHashMap.put("update_youtube_app_action", "Update YouTube App");
a(localHashMap, paramLocale.getLanguage());
a(localHashMap, paramLocale.getLanguage() + "_" + paramLocale.getCountry());
return localHashMap;
}
private static void a(Map<String, String> paramMap, String paramString)
{
if ("af".equals(paramString))
{
paramMap.put("error_initializing_player", "Kon nie die YouTube-speler inisialiseer nie.");
paramMap.put("get_youtube_app_title", "Kry YouTube-program");
paramMap.put("get_youtube_app_text", "Hierdie program sal nie loop sonder die YouTube-program, wat ontbreek van jou toestel, nie");
paramMap.put("get_youtube_app_action", "Kry YouTube-program");
paramMap.put("enable_youtube_app_title", "Aktiveer YouTube-program");
paramMap.put("enable_youtube_app_text", "Hierdie program sal nie werk tensy jy die YouTube-program aktiveer nie.");
paramMap.put("enable_youtube_app_action", "Aktiveer YouTube-program");
paramMap.put("update_youtube_app_title", "Dateer YouTube-program op");
paramMap.put("update_youtube_app_text", "Hierdie program sal nie werk tensy jy die YouTube-program opdateer nie.");
paramMap.put("update_youtube_app_action", "Dateer YouTube-program op");
}
do
{
return;
if ("am".equals(paramString))
{
paramMap.put("error_initializing_player", "የYouTube አጫዋቹን በማስጀመር ላይ ሳለ አንድ ስህተት ተከስቷል።");
paramMap.put("get_youtube_app_title", "የYouTube መተግበሪያውን ያግኙ");
paramMap.put("get_youtube_app_text", "ይህ መተግበሪያ ያለ YouTube መተግበሪያው አይሂድም፣ እሱ ደግሞ በመሣሪያዎ ላይ የለም።");
paramMap.put("get_youtube_app_action", "የYouTube መተግበሪያውን ያግኙ");
paramMap.put("enable_youtube_app_title", "የYouTube መተግበሪያውን ያንቁ");
paramMap.put("enable_youtube_app_text", "የYouTube መተግበሪያውን እስካላነቁ ድረስ ይህ መተግበሪያ አይሰራም።");
paramMap.put("enable_youtube_app_action", "የYouTube መተግበሪያውን ያንቁ");
paramMap.put("update_youtube_app_title", "የYouTube መተግበሪያውን ያዘምኑ");
paramMap.put("update_youtube_app_text", "የYouTube መተግበሪያውን እስካላዘመኑት ድረስ ይህ መተግበሪያ አይሰራም።");
paramMap.put("update_youtube_app_action", "የYouTube መተግበሪያውን ያዘምኑ");
return;
}
if ("ar".equals(paramString))
{
paramMap.put("error_initializing_player", "حدث خطأ أثناء تهيئة مشغل YouTube.");
paramMap.put("get_youtube_app_title", "الحصول على تطبيق YouTube");
paramMap.put("get_youtube_app_text", "لن يعمل هذا التطبيق بدون تطبيق YouTube الذي لا يتوفر على جهازك");
paramMap.put("get_youtube_app_action", "الحصول على تطبيق YouTube");
paramMap.put("enable_youtube_app_title", "تمكين تطبيق YouTube");
paramMap.put("enable_youtube_app_text", "لن يعمل هذا التطبيق ما لم يتم تمكين تطبيق YouTube.");
paramMap.put("enable_youtube_app_action", "تمكين تطبيق YouTube");
paramMap.put("update_youtube_app_title", "تحديث تطبيق YouTube");
paramMap.put("update_youtube_app_text", "لن يعمل هذا التطبيق ما لم يتم تحديث تطبيق YouTube.");
paramMap.put("update_youtube_app_action", "تحديث تطبيق YouTube");
return;
}
if ("be".equals(paramString))
{
paramMap.put("error_initializing_player", "Памылка падчас ініцыялізацыі прайгравальнiка YouTube.");
paramMap.put("get_youtube_app_title", "Спампаваць прыкладанне YouTube");
paramMap.put("get_youtube_app_text", "Гэта прыкладанне не будзе працаваць без прыкладання YouTube, якое адсутнічае на прыладзе");
paramMap.put("get_youtube_app_action", "Спампаваць прыкладанне YouTube");
paramMap.put("enable_youtube_app_title", "Уключыць прыкладанне YouTube");
paramMap.put("enable_youtube_app_text", "Гэта прыкладанне не будзе працаваць, пакуль вы не ўключыце прыкладанне YouTube.");
paramMap.put("enable_youtube_app_action", "Уключыць прыкладанне YouTube");
paramMap.put("update_youtube_app_title", "Абнавiць прыкладанне YouTube");
paramMap.put("update_youtube_app_text", "Гэта прыкладанне не будзе працаваць, пакуль вы не абнавiце прыкладанне YouTube.");
paramMap.put("update_youtube_app_action", "Абнавiць прыкладанне YouTube");
return;
}
if ("bg".equals(paramString))
{
paramMap.put("error_initializing_player", "При подготвянето на плейъра на YouTube за работа възникна грешка.");
paramMap.put("get_youtube_app_title", "Изтегл. на прил. YouTube");
paramMap.put("get_youtube_app_text", "Това приложение няма да работи без приложението YouTube, което липсва на устройството ви");
paramMap.put("get_youtube_app_action", "Изтегл. на прил. YouTube");
paramMap.put("enable_youtube_app_title", "Акт. на прил. YouTube");
paramMap.put("enable_youtube_app_text", "Това приложение няма да работи, освен ако не активирате приложението YouTube.");
paramMap.put("enable_youtube_app_action", "Акт. на прил. YouTube");
paramMap.put("update_youtube_app_title", "Актул. на прил. YouTube");
paramMap.put("update_youtube_app_text", "Това приложение няма да работи, освен ако не актуализирате приложението YouTube.");
paramMap.put("update_youtube_app_action", "Актул. на прил. YouTube");
return;
}
if ("ca".equals(paramString))
{
paramMap.put("error_initializing_player", "S'ha produït un error en iniciar el reproductor de YouTube.");
paramMap.put("get_youtube_app_title", "Obtenció aplicac. YouTube");
paramMap.put("get_youtube_app_text", "Aquesta aplicació no funcionarà sense l'aplicació de YouTube, que encara no és al dispositiu.");
paramMap.put("get_youtube_app_action", "Obtén l'aplic. de YouTube");
paramMap.put("enable_youtube_app_title", "Activació aplic. YouTube");
paramMap.put("enable_youtube_app_text", "Aquesta aplicació no funcionarà fins que no activis l'aplicació de YouTube.");
paramMap.put("enable_youtube_app_action", "Activa aplicació YouTube");
paramMap.put("update_youtube_app_title", "Actualitz. aplic. YouTube");
paramMap.put("update_youtube_app_text", "Aquesta aplicació no funcionarà fins que no actualitzis l'aplicació de YouTube.");
paramMap.put("update_youtube_app_action", "Actualitza aplic. YouTube");
return;
}
if ("cs".equals(paramString))
{
paramMap.put("error_initializing_player", "Při inicializaci přehrávače YouTube došlo k chybě.");
paramMap.put("get_youtube_app_title", "Stáhněte aplikaci YouTube");
paramMap.put("get_youtube_app_text", "Tuto aplikaci nelze spustit bez aplikace YouTube, kterou v zařízení nemáte nainstalovanou");
paramMap.put("get_youtube_app_action", "Stáhnout aplikaci YouTube");
paramMap.put("enable_youtube_app_title", "Aktivujte aplik. YouTube");
paramMap.put("enable_youtube_app_text", "Ke spuštění této aplikace je třeba aktivovat aplikaci YouTube.");
paramMap.put("enable_youtube_app_action", "Zapnout aplikaci YouTube");
paramMap.put("update_youtube_app_title", "Aktualizujte apl. YouTube");
paramMap.put("update_youtube_app_text", "Ke spuštění této aplikace je třeba aktualizovat aplikaci YouTube.");
paramMap.put("update_youtube_app_action", "Aktualizovat apl. YouTube");
return;
}
if ("da".equals(paramString))
{
paramMap.put("error_initializing_player", "Der opstod en fejl under initialisering af YouTube-afspilleren.");
paramMap.put("get_youtube_app_title", "Få YouTube-appen");
paramMap.put("get_youtube_app_text", "Denne app kan ikke køre uden YouTube-appen, som ikke findes på din enhed");
paramMap.put("get_youtube_app_action", "Få YouTube-appen");
paramMap.put("enable_youtube_app_title", "Aktivér YouTube-appen");
paramMap.put("enable_youtube_app_text", "Denne app fungerer ikke, medmindre du aktiverer YouTube-appen.");
paramMap.put("enable_youtube_app_action", "Aktivér YouTube-appen");
paramMap.put("update_youtube_app_title", "Opdater YouTube-appen");
paramMap.put("update_youtube_app_text", "Denne app fungerer ikke, hvis du ikke opdaterer YouTube-appen.");
paramMap.put("update_youtube_app_action", "Opdater YouTube-appen");
return;
}
if ("de".equals(paramString))
{
paramMap.put("error_initializing_player", "Bei der Initialisierung des YouTube-Players ist ein Fehler aufgetreten.");
paramMap.put("get_youtube_app_title", "YouTube App herunterladen");
paramMap.put("get_youtube_app_text", "Diese App kann nur ausgeführt werden, wenn die YouTube App bereitgestellt ist. Diese ist auf deinem Gerät nicht vorhanden.");
paramMap.put("get_youtube_app_action", "YouTube App herunterladen");
paramMap.put("enable_youtube_app_title", "YouTube App aktivieren");
paramMap.put("enable_youtube_app_text", "Diese App funktioniert nur, wenn die YouTube App aktiviert wird.");
paramMap.put("enable_youtube_app_action", "YouTube App aktivieren");
paramMap.put("update_youtube_app_title", "YouTube App aktualisieren");
paramMap.put("update_youtube_app_text", "Diese App funktioniert nur, wenn die YouTube App aktualisiert wird.");
paramMap.put("update_youtube_app_action", "YouTube App aktualisieren");
return;
}
if ("el".equals(paramString))
{
paramMap.put("error_initializing_player", "Παρουσιάστηκε σφάλμα κατά την προετοιμασία του προγράμματος αναπαραγωγής του YouTube.");
paramMap.put("get_youtube_app_title", "Λήψη YouTube");
paramMap.put("get_youtube_app_text", "Δεν είναι δυνατή η εκτέλεση αυτής της εφαρμογής χωρίς την εφαρμογή YouTube, η οποία απουσιάζει από τη συσκευή σας");
paramMap.put("get_youtube_app_action", "Λήψη YouTube");
paramMap.put("enable_youtube_app_title", "Ενεργοποίηση YouTube");
paramMap.put("enable_youtube_app_text", "Δεν είναι δυνατή η λειτουργία αυτής της εφαρμογής εάν δεν ενεργοποιήσετε την εφαρμογή YouTube.");
paramMap.put("enable_youtube_app_action", "Ενεργοποίηση YouTube");
paramMap.put("update_youtube_app_title", "Ενημέρωση YouTube");
paramMap.put("update_youtube_app_text", "Δεν είναι δυνατή η λειτουργία αυτής της εφαρμογής εάν δεν ενημερώσετε την εφαρμογή YouTube.");
paramMap.put("update_youtube_app_action", "Ενημέρωση YouTube");
return;
}
if ("en_GB".equals(paramString))
{
paramMap.put("error_initializing_player", "An error occurred while initialising the YouTube player.");
paramMap.put("get_youtube_app_title", "Get YouTube App");
paramMap.put("get_youtube_app_text", "This app won't run without the YouTube App, which is missing from your device");
paramMap.put("get_youtube_app_action", "Get YouTube App");
paramMap.put("enable_youtube_app_title", "Enable YouTube App");
paramMap.put("enable_youtube_app_text", "This app won't work unless you enable the YouTube App.");
paramMap.put("enable_youtube_app_action", "Enable YouTube App");
paramMap.put("update_youtube_app_title", "Update YouTube App");
paramMap.put("update_youtube_app_text", "This app won't work unless you update the YouTube App.");
paramMap.put("update_youtube_app_action", "Update YouTube App");
return;
}
if ("es_US".equals(paramString))
{
paramMap.put("error_initializing_player", "Se produjo un error al iniciar el reproductor de YouTube.");
paramMap.put("get_youtube_app_title", "Obtener YouTube");
paramMap.put("get_youtube_app_text", "Esta aplicación no se ejecutará sin la aplicación YouTube, la cual no se instaló en tu dispositivo.");
paramMap.put("get_youtube_app_action", "Obtener YouTube");
paramMap.put("enable_youtube_app_title", "Activar YouTube");
paramMap.put("enable_youtube_app_text", "Esta aplicación no funcionará a menos que actives la aplicación YouTube.");
paramMap.put("enable_youtube_app_action", "Activar YouTube");
paramMap.put("update_youtube_app_title", "Actualizar YouTube");
paramMap.put("update_youtube_app_text", "Esta aplicación no funcionará a menos que actualices la aplicación YouTube.");
paramMap.put("update_youtube_app_action", "Actualizar YouTube");
return;
}
if ("es".equals(paramString))
{
paramMap.put("error_initializing_player", "Se ha producido un error al iniciar el reproductor de YouTube.");
paramMap.put("get_youtube_app_title", "Descarga YouTube");
paramMap.put("get_youtube_app_text", "Esta aplicación no funcionará sin la aplicación YouTube, que no está instalada en el dispositivo.");
paramMap.put("get_youtube_app_action", "Descargar YouTube");
paramMap.put("enable_youtube_app_title", "Habilita la aplicación YouTube");
paramMap.put("enable_youtube_app_text", "Esta aplicación no funcionará si no habilitas la aplicación YouTube.");
paramMap.put("enable_youtube_app_action", "Habilitar YouTube");
paramMap.put("update_youtube_app_title", "Actualiza YouTube");
paramMap.put("update_youtube_app_text", "Esta aplicación no funcionará si no actualizas la aplicación YouTube.");
paramMap.put("update_youtube_app_action", "Actualizar YouTube");
return;
}
if ("et".equals(paramString))
{
paramMap.put("error_initializing_player", "YouTube'i mängija lähtestamisel tekkis viga.");
paramMap.put("get_youtube_app_title", "YouTube'i rak. hankimine");
paramMap.put("get_youtube_app_text", "Rakendus ei käivitu ilma YouTube'i rakenduseta ja teie seadmes see praegu puudub");
paramMap.put("get_youtube_app_action", "Hangi YouTube'i rakendus");
paramMap.put("enable_youtube_app_title", "YouTube'i rakenduse lubamine");
paramMap.put("enable_youtube_app_text", "Rakendus ei toimi, kui te ei luba kasutada YouTube'i rakendust.");
paramMap.put("enable_youtube_app_action", "Luba YouTube'i rakendus");
paramMap.put("update_youtube_app_title", "Värskenda YouTube");
paramMap.put("update_youtube_app_text", "Rakendus ei toimi enne, kui olete YouTube'i rakendust värskendanud.");
paramMap.put("update_youtube_app_action", "Värsk. YouTube'i rakend.");
return;
}
if ("fa".equals(paramString))
{
paramMap.put("error_initializing_player", "هنگام مقداردهی اولیه پخشکننده YouTube، خطایی روی داد.");
paramMap.put("get_youtube_app_title", "دریافت برنامه YouTube");
paramMap.put("get_youtube_app_text", "این برنامه بدون برنامه YouTube که در دستگاه شما موجود نیست، اجرا نمیشود");
paramMap.put("get_youtube_app_action", "دریافت برنامه YouTube");
paramMap.put("enable_youtube_app_title", "فعال کردن برنامه YouTube");
paramMap.put("enable_youtube_app_text", "این برنامه تنها در صورتی کار خواهد کرد که برنامه YouTube را فعال کنید.");
paramMap.put("enable_youtube_app_action", "فعال کردن برنامه YouTube");
paramMap.put("update_youtube_app_title", "بهروزرسانی برنامه YouTube");
paramMap.put("update_youtube_app_text", "این برنامه کار نخواهد کرد مگر اینکه برنامه YouTube را به روز کنید.");
paramMap.put("update_youtube_app_action", "بهروزرسانی برنامه YouTube");
return;
}
if ("fi".equals(paramString))
{
paramMap.put("error_initializing_player", "Virhe alustettaessa YouTube-soitinta.");
paramMap.put("get_youtube_app_title", "Hanki YouTube-sovellus");
paramMap.put("get_youtube_app_text", "Tämä sovellus ei toimi ilman YouTube-sovellusta, joka puuttuu laitteesta.");
paramMap.put("get_youtube_app_action", "Hanki YouTube-sovellus");
paramMap.put("enable_youtube_app_title", "Ota YouTube-sov. käyttöön");
paramMap.put("enable_youtube_app_text", "Tämä sovellus ei toimi, ellet ota YouTube-sovellusta käyttöön.");
paramMap.put("enable_youtube_app_action", "Ota YouTube-sov. käyttöön");
paramMap.put("update_youtube_app_title", "Päivitä YouTube-sovellus");
paramMap.put("update_youtube_app_text", "Tämä sovellus ei toimi, ellet päivitä YouTube-sovellusta.");
paramMap.put("update_youtube_app_action", "Päivitä YouTube-sovellus");
return;
}
if ("fr".equals(paramString))
{
paramMap.put("error_initializing_player", "Une erreur s'est produite lors de l'initialisation du lecteur YouTube.");
paramMap.put("get_youtube_app_title", "Télécharger appli YouTube");
paramMap.put("get_youtube_app_text", "Cette application ne fonctionnera pas sans l'application YouTube, qui n'est pas installée sur votre appareil.");
paramMap.put("get_youtube_app_action", "Télécharger appli YouTube");
paramMap.put("enable_youtube_app_title", "Activer l'appli YouTube");
paramMap.put("enable_youtube_app_text", "Cette application ne fonctionnera que si vous activez l'application YouTube.");
paramMap.put("enable_youtube_app_action", "Activer l'appli YouTube");
paramMap.put("update_youtube_app_title", "Mise à jour appli YouTube");
paramMap.put("update_youtube_app_text", "Cette application ne fonctionnera que si vous mettez à jour l'application YouTube.");
paramMap.put("update_youtube_app_action", "Mise à jour appli YouTube");
return;
}
if ("hi".equals(paramString))
{
paramMap.put("error_initializing_player", "YouTube प्लेयर को प्रारंभ करते समय कोई त्रुटि आई.");
paramMap.put("get_youtube_app_title", "YouTube एप्लि. प्राप्त करें");
paramMap.put("get_youtube_app_text", "यह एप्लिकेशन YouTube एप्लिकेशन के बिना नहीं चलेगा, जो आपके उपकरण पर मौजूद नहीं है");
paramMap.put("get_youtube_app_action", "YouTube एप्लि. प्राप्त करें");
paramMap.put("enable_youtube_app_title", "YouTube एप्लि. सक्षम करें");
paramMap.put("enable_youtube_app_text", "जब तक आप YouTube एप्लिकेशन सक्षम नहीं करते, तब तक यह एप्लिकेशन कार्य नहीं करेगा.");
paramMap.put("enable_youtube_app_action", "YouTube एप्लि. सक्षम करें");
paramMap.put("update_youtube_app_title", "YouTube एप्लि. अपडेट करें");
paramMap.put("update_youtube_app_text", "जब तक आप YouTube एप्लिकेशन अपडेट नहीं करते, तब तक यह एप्लिकेशन कार्य नहीं करेगा.");
paramMap.put("update_youtube_app_action", "YouTube एप्लि. अपडेट करें");
return;
}
if ("hr".equals(paramString))
{
paramMap.put("error_initializing_player", "Dogodila se pogreška tijekom pokretanja playera usluge YouTube.");
paramMap.put("get_youtube_app_title", "Preuzimanje apl. YouTube");
paramMap.put("get_youtube_app_text", "Ova se aplikacija ne može pokrenuti bez aplikacije YouTube, koja nije instalirana na vaš uređaj");
paramMap.put("get_youtube_app_action", "Preuzmi apl. YouTube");
paramMap.put("enable_youtube_app_title", "Omogućavanje apl. YouTube");
paramMap.put("enable_youtube_app_text", "Ova aplikacija neće funkcionirati ako ne omogućite aplikaciju YouTube.");
paramMap.put("enable_youtube_app_action", "Omogući apl. YouTube");
paramMap.put("update_youtube_app_title", "Ažuriranje apl. YouTube");
paramMap.put("update_youtube_app_text", "Ova aplikacija neće funkcionirati ako ne ažurirate aplikaciju YouTube.");
paramMap.put("update_youtube_app_action", "Ažuriraj apl. YouTube");
return;
}
if ("hu".equals(paramString))
{
paramMap.put("error_initializing_player", "Hiba történt a YouTube lejátszó inicializálása során.");
paramMap.put("get_youtube_app_title", "YouTube alk. letöltése");
paramMap.put("get_youtube_app_text", "Ez az alkalmazás nem fut a YouTube alkalmazás nélkül, amely hiányzik az eszközéről.");
paramMap.put("get_youtube_app_action", "YouTube alk. letöltése");
paramMap.put("enable_youtube_app_title", "YouTube alkalmazás enged.");
paramMap.put("enable_youtube_app_text", "Az alkalmazás csak akkor fog működni, ha engedélyezi a YouTube alkalmazást.");
paramMap.put("enable_youtube_app_action", "YouTube alkalmazás enged.");
paramMap.put("update_youtube_app_title", "YouTube alk. frissítése");
paramMap.put("update_youtube_app_text", "Az alkalmazás csak akkor fog működni, ha frissíti a YouTube alkalmazást.");
paramMap.put("update_youtube_app_action", "YouTube alk. frissítése");
return;
}
if ("in".equals(paramString))
{
paramMap.put("error_initializing_player", "Terjadi kesalahan saat memulai pemutar YouTube.");
paramMap.put("get_youtube_app_title", "Dapatkan Aplikasi YouTube");
paramMap.put("get_youtube_app_text", "Aplikasi ini tidak akan berjalan tanpa Aplikasi YouTube, yang hilang dari perangkat Anda");
paramMap.put("get_youtube_app_action", "Dapatkan Aplikasi YouTube");
paramMap.put("enable_youtube_app_title", "Aktifkan Aplikasi YouTube");
paramMap.put("enable_youtube_app_text", "Aplikasi ini tidak akan bekerja kecuali Anda mengaktifkan Aplikasi YouTube.");
paramMap.put("enable_youtube_app_action", "Aktifkan Aplikasi YouTube");
paramMap.put("update_youtube_app_title", "Perbarui Aplikasi YouTube");
paramMap.put("update_youtube_app_text", "Aplikasi ini tidak akan bekerja kecuali Anda memperbarui Aplikasi YouTube.");
paramMap.put("update_youtube_app_action", "Perbarui Aplikasi YouTube");
return;
}
if ("it".equals(paramString))
{
paramMap.put("error_initializing_player", "Si è verificato un errore durante l'inizializzazione del player di YouTube.");
paramMap.put("get_youtube_app_title", "Scarica app YouTube");
paramMap.put("get_youtube_app_text", "Questa applicazione non funzionerà senza l'applicazione YouTube che non è presente sul tuo dispositivo");
paramMap.put("get_youtube_app_action", "Scarica app YouTube");
paramMap.put("enable_youtube_app_title", "Attiva app YouTube");
paramMap.put("enable_youtube_app_text", "Questa applicazione non funzionerà se non attivi l'applicazione YouTube.");
paramMap.put("enable_youtube_app_action", "Attiva app YouTube");
paramMap.put("update_youtube_app_title", "Aggiorna app YouTube");
paramMap.put("update_youtube_app_text", "Questa applicazione non funzionerà se non aggiorni l'applicazione YouTube.");
paramMap.put("update_youtube_app_action", "Aggiorna app YouTube");
return;
}
if ("iw".equals(paramString))
{
paramMap.put("error_initializing_player", "אירעה שגיאה בעת אתחול נגן YouTube.");
paramMap.put("get_youtube_app_title", "קבל את יישום YouTube");
paramMap.put("get_youtube_app_text", "יישום זה לא יפעל ללא יישום YouTube, שאינו מותקן במכשיר שלך");
paramMap.put("get_youtube_app_action", "קבל את יישום YouTube");
paramMap.put("enable_youtube_app_title", "הפעל את יישום YouTube");
paramMap.put("enable_youtube_app_text", "יישום זה לא יעבוד אלא אם תפעיל את יישום YouTube.");
paramMap.put("enable_youtube_app_action", "הפעל את יישום YouTube");
paramMap.put("update_youtube_app_title", "עדכן את יישום YouTube");
paramMap.put("update_youtube_app_text", "יישום זה לא יעבוד אלא אם תעדכן את יישום YouTube.");
paramMap.put("update_youtube_app_action", "עדכן את יישום YouTube");
return;
}
if ("ja".equals(paramString))
{
paramMap.put("error_initializing_player", "YouTubeプレーヤーの初期化中にエラーが発生しました。");
paramMap.put("get_youtube_app_title", "YouTubeアプリを入手");
paramMap.put("get_youtube_app_text", "このアプリの実行に必要なYouTubeアプリが端末にありません");
paramMap.put("get_youtube_app_action", "YouTubeアプリを入手");
paramMap.put("enable_youtube_app_title", "YouTubeアプリを有効化");
paramMap.put("enable_youtube_app_text", "このアプリの実行にはYouTubeアプリの有効化が必要です。");
paramMap.put("enable_youtube_app_action", "YouTubeアプリを有効化");
paramMap.put("update_youtube_app_title", "YouTubeアプリを更新");
paramMap.put("update_youtube_app_text", "このアプリの実行にはYouTubeアプリの更新が必要です。");
paramMap.put("update_youtube_app_action", "YouTubeアプリを更新");
return;
}
if ("ko".equals(paramString))
{
paramMap.put("error_initializing_player", "YouTube 플레이어를 초기화하는 중에 오류가 발생했습니다.");
paramMap.put("get_youtube_app_title", "YouTube 앱 다운로드");
paramMap.put("get_youtube_app_text", "이 앱은 내 기기에 YouTube 앱이 없어서 실행되지 않습니다.");
paramMap.put("get_youtube_app_action", "YouTube 앱 다운로드");
paramMap.put("enable_youtube_app_title", "YouTube 앱 사용 설정");
paramMap.put("enable_youtube_app_text", "이 앱은 YouTube 앱을 사용하도록 설정하지 않으면 작동하지 않습니다.");
paramMap.put("enable_youtube_app_action", "YouTube 앱 사용");
paramMap.put("update_youtube_app_title", "YouTube 앱 업데이트");
paramMap.put("update_youtube_app_text", "이 앱은 YouTube 앱을 업데이트하지 않으면 작동하지 않습니다.");
paramMap.put("update_youtube_app_action", "YouTube 앱 업데이트");
return;
}
if ("lt".equals(paramString))
{
paramMap.put("error_initializing_player", "Inicijuojant „YouTube“ grotuvą įvyko klaida.");
paramMap.put("get_youtube_app_title", "Gauti „YouTube“ programą");
paramMap.put("get_youtube_app_text", "Ši programa neveikia be „YouTube“ programos, o jos įrenginyje nėra.");
paramMap.put("get_youtube_app_action", "Gauti „YouTube“ programą");
paramMap.put("enable_youtube_app_title", "Įgalinti „YouTube“ progr.");
paramMap.put("enable_youtube_app_text", "Ši programa neveiks, jei neįgalinsite „YouTube“ programos.");
paramMap.put("enable_youtube_app_action", "Įgalinti „YouTube“ progr.");
paramMap.put("update_youtube_app_title", "Atnauj. „YouTube“ progr.");
paramMap.put("update_youtube_app_text", "Ši programa neveiks, jei neatnaujinsite „YouTube“ programos.");
paramMap.put("update_youtube_app_action", "Atnauj. „YouTube“ progr.");
return;
}
if ("lv".equals(paramString))
{
paramMap.put("error_initializing_player", "Inicializējot YouTube atskaņotāju, radās kļūda.");
paramMap.put("get_youtube_app_title", "YouTube liet. iegūšana");
paramMap.put("get_youtube_app_text", "Šī lietotne nedarbosies bez YouTube lietotnes, kuras nav šajā ierīcē.");
paramMap.put("get_youtube_app_action", "Iegūt YouTube lietotni");
paramMap.put("enable_youtube_app_title", "YouTube liet. iespējošana");
paramMap.put("enable_youtube_app_text", "Lai šī lietotne darbotos, iespējojiet YouTube lietotni.");
paramMap.put("enable_youtube_app_action", "Iespējot YouTube lietotni");
paramMap.put("update_youtube_app_title", "YouTube liet. atjaunin.");
paramMap.put("update_youtube_app_text", "Lai šī lietotne darbotos, atjauniniet YouTube lietotni.");
paramMap.put("update_youtube_app_action", "Atjaun. YouTube lietotni");
return;
}
if ("ms".equals(paramString))
{
paramMap.put("error_initializing_player", "Ralat berlaku semasa memulakan alat main YouTube.");
paramMap.put("get_youtube_app_title", "Dapatkan Apl YouTube");
paramMap.put("get_youtube_app_text", "Apl ini tidak akan berjalan tanpa Apl YouTube, yang tidak ada pada peranti anda");
paramMap.put("get_youtube_app_action", "Dapatkan Apl YouTube");
paramMap.put("enable_youtube_app_title", "Dayakan Apl YouTube");
paramMap.put("enable_youtube_app_text", "Apl ini tidak akan berfungsi kecuali anda mendayakan Apl YouTube.");
paramMap.put("enable_youtube_app_action", "Dayakan Apl YouTube");
paramMap.put("update_youtube_app_title", "Kemas kini Apl YouTube");
paramMap.put("update_youtube_app_text", "Apl ini tidak akan berfungsi kecuali anda mengemas kini Apl YouTube.");
paramMap.put("update_youtube_app_action", "Kemas kini Apl YouTube");
return;
}
if ("nb".equals(paramString))
{
paramMap.put("error_initializing_player", "Det oppsto en feil da YouTube-avspilleren startet.");
paramMap.put("get_youtube_app_title", "Skaff deg YouTube-appen");
paramMap.put("get_youtube_app_text", "Denne appen kan ikke kjøre uten YouTube-appen, som du ikke har på enheten");
paramMap.put("get_youtube_app_action", "Skaff deg YouTube-appen");
paramMap.put("enable_youtube_app_title", "Aktiver YouTube-appen");
paramMap.put("enable_youtube_app_text", "Denne appen fungerer ikke før du aktiverer YouTube-appen.");
paramMap.put("enable_youtube_app_action", "Aktiver YouTube-appen");
paramMap.put("update_youtube_app_title", "Oppdater YouTube-appen");
paramMap.put("update_youtube_app_text", "Denne appen fungerer ikke før du oppdaterer YouTube-appen.");
paramMap.put("update_youtube_app_action", "Oppdater YouTube-appen");
return;
}
if ("nl".equals(paramString))
{
paramMap.put("error_initializing_player", "Er is een fout opgetreden bij het initialiseren van de YouTube-speler.");
paramMap.put("get_youtube_app_title", "YouTube-app downloaden");
paramMap.put("get_youtube_app_text", "Deze app wordt niet uitgevoerd zonder de YouTube-app, die op uw apparaat ontbreekt");
paramMap.put("get_youtube_app_action", "YouTube-app downloaden");
paramMap.put("enable_youtube_app_title", "YouTube-app inschakelen");
paramMap.put("enable_youtube_app_text", "Deze app werkt niet, tenzij u de YouTube-app inschakelt.");
paramMap.put("enable_youtube_app_action", "YouTube-app inschakelen");
paramMap.put("update_youtube_app_title", "YouTube-app bijwerken");
paramMap.put("update_youtube_app_text", "Deze app werkt niet, tenzij u de YouTube-app bijwerkt.");
paramMap.put("update_youtube_app_action", "YouTube-app bijwerken");
return;
}
if ("pl".equals(paramString))
{
paramMap.put("error_initializing_player", "Podczas inicjowania odtwarzacza YouTube wystąpił błąd.");
paramMap.put("get_youtube_app_title", "Pobierz aplikację YouTube");
paramMap.put("get_youtube_app_text", "Ta aplikacja nie będzie działać bez aplikacji YouTube, której nie ma na tym urządzeniu");
paramMap.put("get_youtube_app_action", "Pobierz aplikację YouTube");
paramMap.put("enable_youtube_app_title", "Włącz aplikację YouTube");
paramMap.put("enable_youtube_app_text", "Ta aplikacja nie będzie działać, jeśli nie włączysz aplikacji YouTube.");
paramMap.put("enable_youtube_app_action", "Włącz aplikację YouTube");
paramMap.put("update_youtube_app_title", "Zaktualizuj aplikację YouTube");
paramMap.put("update_youtube_app_text", "Ta aplikacja nie będzie działać, jeśli nie zaktualizujesz aplikacji YouTube.");
paramMap.put("update_youtube_app_action", "Zaktualizuj aplikację YouTube");
return;
}
if ("pt_PT".equals(paramString))
{
paramMap.put("error_initializing_player", "Ocorreu um erro ao iniciar o leitor do YouTube.");
paramMap.put("get_youtube_app_title", "Obter a Aplicação YouTube");
paramMap.put("get_youtube_app_text", "Esta aplicação não será executada sem a Aplicação YouTube, que está em falta no seu dispositivo");
paramMap.put("get_youtube_app_action", "Obter a Aplicação YouTube");
paramMap.put("enable_youtube_app_title", "Ativar Aplicação YouTube");
paramMap.put("enable_youtube_app_text", "Esta aplicação não irá funcionar enquanto não ativar a Aplicação YouTube.");
paramMap.put("enable_youtube_app_action", "Ativar Aplicação YouTube");
paramMap.put("update_youtube_app_title", "Atualizar Aplica. YouTube");
paramMap.put("update_youtube_app_text", "Esta aplicação não irá funcionar enquanto não atualizar a Aplicação YouTube.");
paramMap.put("update_youtube_app_action", "Atualizar Aplica. YouTube");
return;
}
if ("pt".equals(paramString))
{
paramMap.put("error_initializing_player", "Ocorreu um erro ao inicializar o player do YouTube.");
paramMap.put("get_youtube_app_title", "Obter aplicativo YouTube");
paramMap.put("get_youtube_app_text", "Este aplicativo só funciona com o aplicativo YouTube, que está ausente no dispositivo.");
paramMap.put("get_youtube_app_action", "Obter aplicativo YouTube");
paramMap.put("enable_youtube_app_title", "Ativar aplicativo YouTube");
paramMap.put("enable_youtube_app_text", "Este aplicativo só funciona com o aplicativo YouTube ativado.");
paramMap.put("enable_youtube_app_action", "Ativar aplicativo YouTube");
paramMap.put("update_youtube_app_title", "Atualizar aplic. YouTube");
paramMap.put("update_youtube_app_text", "Este aplicativo só funciona com o aplicativo YouTube atualizado.");
paramMap.put("update_youtube_app_action", "Atualizar aplic. YouTube");
return;
}
if ("ro".equals(paramString))
{
paramMap.put("error_initializing_player", "A apărut o eroare la iniţializarea playerului YouTube.");
paramMap.put("get_youtube_app_title", "Descărcaţi YouTube");
paramMap.put("get_youtube_app_text", "Această aplicaţie nu va rula fără aplicaţia YouTube, care lipseşte de pe gadget");
paramMap.put("get_youtube_app_action", "Descărcaţi YouTube");
paramMap.put("enable_youtube_app_title", "Activaţi YouTube");
paramMap.put("enable_youtube_app_text", "Această aplicaţie nu va funcţiona decât dacă activaţi aplicaţia YouTube.");
paramMap.put("enable_youtube_app_action", "Activaţi YouTube");
paramMap.put("update_youtube_app_title", "Actualizaţi YouTube");
paramMap.put("update_youtube_app_text", "Această aplicaţie nu va funcţiona decât dacă actualizaţi aplicaţia YouTube.");
paramMap.put("update_youtube_app_action", "Actualizaţi YouTube");
return;
}
if ("ru".equals(paramString))
{
paramMap.put("error_initializing_player", "Не удалось запустить проигрыватель YouTube.");
paramMap.put("get_youtube_app_title", "Загрузите YouTube");
paramMap.put("get_youtube_app_text", "Чтобы запустить эту программу, установите приложение YouTube.");
paramMap.put("get_youtube_app_action", "Загрузить YouTube");
paramMap.put("enable_youtube_app_title", "Активация YouTube");
paramMap.put("enable_youtube_app_text", "Чтобы запустить эту программу, активируйте приложение YouTube.");
paramMap.put("enable_youtube_app_action", "Активировать YouTube");
paramMap.put("update_youtube_app_title", "Обновление YouTube");
paramMap.put("update_youtube_app_text", "Чтобы запустить эту программу, обновите приложение YouTube.");
paramMap.put("update_youtube_app_action", "Обновить YouTube");
return;
}
if ("sk".equals(paramString))
{
paramMap.put("error_initializing_player", "Pri inicializácii prehrávača YouTube sa vyskytla chyba.");
paramMap.put("get_youtube_app_title", "Získať aplikáciu YouTube");
paramMap.put("get_youtube_app_text", "Túto aplikáciu nebude možné spustiť bez aplikácie YouTube, ktorá na zariadení nie je nainštalovaná.");
paramMap.put("get_youtube_app_action", "Získať aplikáciu YouTube");
paramMap.put("enable_youtube_app_title", "Povoliť aplikáciu YouTube");
paramMap.put("enable_youtube_app_text", "Táto aplikácia bude fungovať až po povolení aplikácie YouTube.");
paramMap.put("enable_youtube_app_action", "Povoliť aplikáciu YouTube");
paramMap.put("update_youtube_app_title", "Aktualizovať apl. YouTube");
paramMap.put("update_youtube_app_text", "Táto aplikácia bude fungovať až po aktualizácii aplikácie YouTube.");
paramMap.put("update_youtube_app_action", "Aktualizovať apl. YouTube");
return;
}
if ("sl".equals(paramString))
{
paramMap.put("error_initializing_player", "Napaka med inicializacijo YouTubovega predvajalnika.");
paramMap.put("get_youtube_app_title", "Prenos aplikacije YouTube");
paramMap.put("get_youtube_app_text", "Ta aplikacija ne bo delovala brez aplikacije YouTube, ki je ni v vaši napravi");
paramMap.put("get_youtube_app_action", "Prenos aplikacije YouTube");
paramMap.put("enable_youtube_app_title", "Omog. aplikacije YouTube");
paramMap.put("enable_youtube_app_text", "Ta aplikacija ne bo delovala, če ne omogočite aplikacije YouTube.");
paramMap.put("enable_youtube_app_action", "Omog. aplikacijo YouTube");
paramMap.put("update_youtube_app_title", "Posodob. aplikacije YouTube");
paramMap.put("update_youtube_app_text", "Ta aplikacija ne bo delovala, če ne posodobite aplikacije YouTube.");
paramMap.put("update_youtube_app_action", "Posod. aplikacijo YouTube");
return;
}
if ("sr".equals(paramString))
{
paramMap.put("error_initializing_player", "Дошло је до грешке при покретању YouTube плејера.");
paramMap.put("get_youtube_app_title", "Преузимање аплик. YouTube");
paramMap.put("get_youtube_app_text", "Ова апликација неће функционисати без апликације YouTube, која недостаје на уређају");
paramMap.put("get_youtube_app_action", "Преузми апликац. YouTube");
paramMap.put("enable_youtube_app_title", "Омогућавање апл. YouTube");
paramMap.put("enable_youtube_app_text", "Ова апликације неће функционисати ако не омогућите апликацију YouTube.");
paramMap.put("enable_youtube_app_action", "Омогући апликац. YouTube");
paramMap.put("update_youtube_app_title", "Ажурирање аплик. YouTube");
paramMap.put("update_youtube_app_text", "Ова апликације неће функционисати ако не ажурирате апликацију YouTube.");
paramMap.put("update_youtube_app_action", "Ажурирај апликац. YouTube");
return;
}
if ("sv".equals(paramString))
{
paramMap.put("error_initializing_player", "Ett fel uppstod när YouTube-spelaren skulle startas.");
paramMap.put("get_youtube_app_title", "Hämta YouTube-appen");
paramMap.put("get_youtube_app_text", "YouTube-appen krävs för att den här appen ska kunna köras. Du har inte YouTube-appen på din enhet.");
paramMap.put("get_youtube_app_action", "Hämta YouTube-appen");
paramMap.put("enable_youtube_app_title", "Aktivera YouTube-appen");
paramMap.put("enable_youtube_app_text", "Du måste aktivera YouTube-appen för att den här appen ska fungera.");
paramMap.put("enable_youtube_app_action", "Aktivera YouTube-appen");
paramMap.put("update_youtube_app_title", "Uppdatera YouTube-appen");
paramMap.put("update_youtube_app_text", "Du måste uppdatera YouTube-appen för att den här appen ska fungera.");
paramMap.put("update_youtube_app_action", "Uppdatera YouTube-appen");
return;
}
if ("sw".equals(paramString))
{
paramMap.put("error_initializing_player", "Hitilafu ilitokea wakati wa kuanzisha kichezeshi cha YouTube.");
paramMap.put("get_youtube_app_title", "Pata Programu ya YouTube");
paramMap.put("get_youtube_app_text", "Programu hii haitaendeshwa bila Programu ya YouTube, ambayo inakosekana kwenye kifaa chako.");
paramMap.put("get_youtube_app_action", "Pata Programu ya YouTube");
paramMap.put("enable_youtube_app_title", "Wezesha Programu ya YouTube");
paramMap.put("enable_youtube_app_text", "Programu hii haitafanya kazi isipokuwa uwezeshe Programu ya YouTube.");
paramMap.put("enable_youtube_app_action", "Wezesha Programu ya YouTube");
paramMap.put("update_youtube_app_title", "Sasisha Programu ya YouTube");
paramMap.put("update_youtube_app_text", "Programu hii haitafanya kazi mpaka usasishe Programu ya YouTube.");
paramMap.put("update_youtube_app_action", "Sasisha Programu ya YouTube");
return;
}
if ("th".equals(paramString))
{
paramMap.put("error_initializing_player", "เกิดข้อผิดพลาดในขณะเริ่มต้นโปรแกรมเล่น YouTube");
paramMap.put("get_youtube_app_title", "รับแอปพลิเคชัน YouTube");
paramMap.put("get_youtube_app_text", "แอปพลิเคชันนี้จะไม่ทำงานหากไม่มีแอปพลิเคชัน YouTube ซึ่งไม่มีในอุปกรณ์ของคุณ");
paramMap.put("get_youtube_app_action", "รับแอปพลิเคชัน YouTube");
paramMap.put("enable_youtube_app_title", "เปิดใช้งานแอป YouTube");
paramMap.put("enable_youtube_app_text", "แอปพลิเคชันนี้จะไม่ทำงานจนกว่าคุณจะเปิดใช้งานแอปพลิเคชัน YouTube");
paramMap.put("enable_youtube_app_action", "เปิดใช้งานแอป YouTube");
paramMap.put("update_youtube_app_title", "อัปเดตแอปพลิเคชัน YouTube");
paramMap.put("update_youtube_app_text", "แอปพลิเคชันนี้จะไม่ทำงานจนกว่าคุณจะอัปเดตแอปพลิเคชัน YouTube");
paramMap.put("update_youtube_app_action", "อัปเดตแอปพลิเคชัน YouTube");
return;
}
if ("tl".equals(paramString))
{
paramMap.put("error_initializing_player", "May naganap na error habang sinisimulan ang player ng YouTube.");
paramMap.put("get_youtube_app_title", "Kunin ang YouTube App");
paramMap.put("get_youtube_app_text", "Hindi gagana ang app na ito nang wala ang YouTube App, na nawawala sa iyong device");
paramMap.put("get_youtube_app_action", "Kunin ang YouTube App");
paramMap.put("enable_youtube_app_title", "Paganahin ang YouTube App");
paramMap.put("enable_youtube_app_text", "Hindi gagana ang app na ito maliban kung paganahin mo ang YouTube App.");
paramMap.put("enable_youtube_app_action", "Paganahin ang YouTube App");
paramMap.put("update_youtube_app_title", "I-update ang YouTube App");
paramMap.put("update_youtube_app_text", "Hindi gagana ang app na ito maliban kung i-update mo ang YouTube App.");
paramMap.put("update_youtube_app_action", "I-update ang YouTube App");
return;
}
if ("tr".equals(paramString))
{
paramMap.put("error_initializing_player", "YouTube oynatıcısı başlatılırken bir hata oluştu.");
paramMap.put("get_youtube_app_title", "YouTube Uygulamasını edinin");
paramMap.put("get_youtube_app_text", "Cihazınızda bulunmayan YouTube Uygulaması olmadan bu uygulama çalışmaz");
paramMap.put("get_youtube_app_action", "YouTube Uygulamasını edinin");
paramMap.put("enable_youtube_app_title", "YouTube Uygulamasını etkinleştirin");
paramMap.put("enable_youtube_app_text", "YouTube Uygulamasını etkinleştirmediğiniz sürece bu uygulama çalışmaz.");
paramMap.put("enable_youtube_app_action", "YouTube Uygulamasını etkinleştirin");
paramMap.put("update_youtube_app_title", "YouTube Uygulamasını güncelleyin");
paramMap.put("update_youtube_app_text", "YouTube Uygulaması güncellenmedikçe bu uygulama çalışmaz.");
paramMap.put("update_youtube_app_action", "YouTube Uygulamasını güncelle");
return;
}
if ("uk".equals(paramString))
{
paramMap.put("error_initializing_player", "Під час ініціалізації програвача YouTube сталася помилка.");
paramMap.put("get_youtube_app_title", "Отримати програму YouTube");
paramMap.put("get_youtube_app_text", "Ця програма не запуститься без програми YouTube, яку не встановлено на вашому пристрої");
paramMap.put("get_youtube_app_action", "Отримати програму YouTube");
paramMap.put("enable_youtube_app_title", "Увімк. програму YouTube");
paramMap.put("enable_youtube_app_text", "Ця програма не працюватиме, поки ви не ввімкнете програму YouTube.");
paramMap.put("enable_youtube_app_action", "Увімк. програму YouTube");
paramMap.put("update_youtube_app_title", "Оновити програму YouTube");
paramMap.put("update_youtube_app_text", "Ця програма не працюватиме, поки ви не оновите програму YouTube.");
paramMap.put("update_youtube_app_action", "Оновити програму YouTube");
return;
}
if ("vi".equals(paramString))
{
paramMap.put("error_initializing_player", "Đã xảy ra lỗi trong khi khởi chạy trình phát YouTube.");
paramMap.put("get_youtube_app_title", "Tải ứng dụng YouTube");
paramMap.put("get_youtube_app_text", "Ứng dụng này sẽ không chạy nếu không có ứng dụng YouTube, ứng dụng này bị thiếu trong thiết bị của bạn");
paramMap.put("get_youtube_app_action", "Tải ứng dụng YouTube");
paramMap.put("enable_youtube_app_title", "Bật ứng dụng YouTube");
paramMap.put("enable_youtube_app_text", "Ứng dụng này sẽ không hoạt động trừ khi bạn bật ứng dụng YouTube.");
paramMap.put("enable_youtube_app_action", "Bật ứng dụng YouTube");
paramMap.put("update_youtube_app_title", "Cập nhật ứng dụng YouTube");
paramMap.put("update_youtube_app_text", "Ứng dụng này sẽ không hoạt động trừ khi bạn cập nhật ứng dụng YouTube.");
paramMap.put("update_youtube_app_action", "Cập nhật ứng dụng YouTube");
return;
}
if ("zh_CN".equals(paramString))
{
paramMap.put("error_initializing_player", "初始化 YouTube 播放器时出现错误。");
paramMap.put("get_youtube_app_title", "获取 YouTube 应用");
paramMap.put("get_youtube_app_text", "您的设备中没有 YouTube 应用,您必须先安装 YouTube 应用才能运行此应用。");
paramMap.put("get_youtube_app_action", "获取 YouTube 应用");
paramMap.put("enable_youtube_app_title", "启用 YouTube 应用");
paramMap.put("enable_youtube_app_text", "您需要启用 YouTube 应用才能运行该应用。");
paramMap.put("enable_youtube_app_action", "启用 YouTube 应用");
paramMap.put("update_youtube_app_title", "更新 YouTube 应用");
paramMap.put("update_youtube_app_text", "您必须更新 YouTube 应用才能运行此应用。");
paramMap.put("update_youtube_app_action", "更新 YouTube 应用");
return;
}
if ("zh_TW".equals(paramString))
{
paramMap.put("error_initializing_player", "初始化 YouTube 播放器時發生錯誤。");
paramMap.put("get_youtube_app_title", "取得 YouTube 應用程式");
paramMap.put("get_youtube_app_text", "您必須啟用 YouTube 應用程式,這個應用程式才能運作,但系統在裝置中找不到 YouTube 應用程式。");
paramMap.put("get_youtube_app_action", "取得 YouTube 應用程式");
paramMap.put("enable_youtube_app_title", "啟用 YouTube 應用程式");
paramMap.put("enable_youtube_app_text", "您必須啟用 YouTube 應用程式,這個應用程式才能運作。");
paramMap.put("enable_youtube_app_action", "啟用 YouTube 應用程式");
paramMap.put("update_youtube_app_title", "更新 YouTube 應用程式");
paramMap.put("update_youtube_app_text", "您必須更新 YouTube 應用程式,這個應用程式才能運作。");
paramMap.put("update_youtube_app_action", "更新 YouTube 應用程式");
return;
}
}
while (!"zu".equals(paramString));
paramMap.put("error_initializing_player", "Kuvele iphutha ngenkathi kuqaliswa isidlali se-YouTube");
paramMap.put("get_youtube_app_title", "Thola uhlelo lokusebenza lwe-YouTube");
paramMap.put("get_youtube_app_text", "Lolu hlelo kusebenza angeke lusebenze ngaphandle kohlelo lokusebenza lwe-YouTube, olungekho kudivayisi yakho");
paramMap.put("get_youtube_app_action", "Thola uhelo lokusebenza lwe-YouTube");
paramMap.put("enable_youtube_app_title", "Nika amandla uhlelo lokusebenza lwe-YouTube");
paramMap.put("enable_youtube_app_text", "Lolu hlelo lokusebenza angeke lusebenze uma unganikanga amandla uhlelo lokusebenza lwe-YouTube.");
paramMap.put("enable_youtube_app_action", "Nika amandla uhlelo lokusebenza lwe-YouTube");
paramMap.put("update_youtube_app_title", "Buyekeza uhlelo lokusebenza lwe-YouTube");
paramMap.put("update_youtube_app_text", "Lolu hlelo lokusebenza angeke lusebenze uma ungabuyekezanga uhlelo lokusebenza lwe-YouTube.");
paramMap.put("update_youtube_app_action", "Buyekeza uhlelo lokusebenza lwe-YouTube");
}
}
/* Location: classes_dex2jar.jar
* Qualified Name: com.google.android.youtube.player.internal.bh
* JD-Core Version: 0.6.2
*/
|
isnuryusuf/ingress-indonesia-dev
|
apk/classes-ekstartk/com/google/android/youtube/player/internal/bh.java
|
2,364 |
package gr.cti.eslate.base.container;
import java.util.ListResourceBundle;
public class InstallComponentDialogBundle_el_GR extends ListResourceBundle {
public Object [][] getContents() {
return contents;
}
static final Object[][] contents={
{"DialogTitle", "Εγκατάσταση ψηφίδας"},
{"DialogTitle2", "Εγκατάσταση θέματος"},
{"OK", "Εντάξει"},
{"Cancel", "Άκυρο"},
{"Error", "Λάθος"},
{"Name", "Όνομα ψηφίδας"},
{"Name2", "Όνομα θέματος"},
{"Class", "Κλάση"},
{"Class2", "Κλάση"},
{"DialogMsg1", "Η κλάση "},
{"DialogMsg2", " δεν μπορεί να βρεθεί"},
{"DialogMsg3", "Μόνο \"ορατές\" ψηφίδες μπορούν να εγκατασταθούν"},
{"DialogMsg4", " δεν μπορεί να αρχικοποιηθεί"},
{"DialogMsg5", " δεν μπορεί να αρχικοποιηθεί, διότι δεν διαθέτει public constructor χωρίς παραμέτρους"},
{"DialogMsg6", " δεν μπορεί να αρχικοποιηθεί, διότι δεν είναι public"},
{"DialogMsg7", "Πρόβλημα κατά την εγκατάσταση της ψηφίδας: "}
};
}
|
vpapakir/myeslate
|
widgetESlate/src/gr/cti/eslate/base/container/InstallComponentDialogBundle_el_GR.java
|
2,367 |
package xmaze;
import graphix.Util;
import graph.Node;
import graph.MazeGraph;
import graph.Edge;
import algorithms.SearchAlgorithmDialog;
import algorithms.HeuristicSearch;
import algorithms.DepthFirstSearch;
import algorithms.BreadthFirstSearch;
import edu.uci.ics.jung.io.GraphMLWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* ΕΑΠ - ΠΛΗ31 - 4η ΕΡΓΑΣΙΑ 2015-2016
* @author Tsakiridis Sotiris
*/
public class MainFrameXMaze extends javax.swing.JFrame {
// Σταθερές ονομασίες την τρέχουσα προβολή (panel)
private static final int MAZEVIEW = 0; // λαβύρινθος
private static final int GRAPHVIEW = 1; // γράφημα
private static final int GRAPHDIAGVIEW = 2; // γράφημα με διαγώνιες ακμές
private int currentView = MAZEVIEW;
// Το panel του maze και του graph
MazePanel mazePanel;
MazeGraphPanel mazeGraphPanel;
/**
* Creates new form mainFrame
*/
public MainFrameXMaze() {
initComponents();
// Create panels
mazePanel = new MazePanel(693, 545);
mazeGraphPanel = new MazeGraphPanel();
// Default προβολή του mazePanel
cardPanel.removeAll();
cardPanel.add(mazePanel);
cardPanel.repaint();
cardPanel.revalidate();
pack();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
buttonGroup1 = new javax.swing.ButtonGroup();
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
cardPanel = new javax.swing.JPanel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
jMenuItem4 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
mazeMenu = new javax.swing.JCheckBoxMenuItem();
graphMenuNoDiag = new javax.swing.JCheckBoxMenuItem();
graphMenuWithDiag = new javax.swing.JCheckBoxMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem5 = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
jMenuItem6 = new javax.swing.JMenuItem();
jMenuItem7 = new javax.swing.JMenuItem();
jMenu6 = new javax.swing.JMenu();
jMenuItem8 = new javax.swing.JMenuItem();
jMenuItem9 = new javax.swing.JMenuItem();
jMenu7 = new javax.swing.JMenu();
jMenuItem10 = new javax.swing.JMenuItem();
jMenuItem11 = new javax.swing.JMenuItem();
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("© ΕΑΠ 2016 - ΠΛΗ31 - ΤΣΑΚΙΡΙΔΗΣ ΣΩΤΗΡΙΟΣ");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 623, Short.MAX_VALUE)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(13, Short.MAX_VALUE)
.addComponent(jLabel1)
.addContainerGap())
);
cardPanel.setLayout(new java.awt.CardLayout());
jMenu1.setText("Αρχείο");
jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/open.png"))); // NOI18N
jMenuItem3.setText("Άνοιγμα");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem3);
jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/save.png"))); // NOI18N
jMenuItem2.setText("Αποθήκευση");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem2);
jMenu1.add(jSeparator1);
jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/exit.png"))); // NOI18N
jMenuItem4.setText("Έξοδος");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem4);
jMenuBar1.add(jMenu1);
jMenu2.setText("Προβολή");
buttonGroup1.add(mazeMenu);
mazeMenu.setSelected(true);
mazeMenu.setText("Λαβύρινθος (Maze40)");
mazeMenu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mazeMenuActionPerformed(evt);
}
});
jMenu2.add(mazeMenu);
buttonGroup1.add(graphMenuNoDiag);
graphMenuNoDiag.setText("Γράφημα (JUNG) χωρίς διαγώνειες ακμές");
graphMenuNoDiag.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
graphMenuNoDiagActionPerformed(evt);
}
});
jMenu2.add(graphMenuNoDiag);
buttonGroup1.add(graphMenuWithDiag);
graphMenuWithDiag.setText("Γράφημα (JUNG) με διαγώνειες ακμές");
graphMenuWithDiag.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
graphMenuWithDiagActionPerformed(evt);
}
});
jMenu2.add(graphMenuWithDiag);
jMenuBar1.add(jMenu2);
jMenu3.setText("Αλγόριθμοι");
jMenu4.setText("Αναζήτηση κατά βάθος (DFS)");
jMenuItem1.setText("Χωρίς διαγώνιες κινήσεις");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem1);
jMenuItem5.setText("Με διαγώνιες κινήσεις");
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem5ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem5);
jMenu3.add(jMenu4);
jMenu5.setText("Αναζήτηση κατά πλάτος (BFS)");
jMenuItem6.setText("Χωρίς διαγώνιες κινήσεις");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
});
jMenu5.add(jMenuItem6);
jMenuItem7.setText("Με διαγώνιες κινήσεις");
jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem7ActionPerformed(evt);
}
});
jMenu5.add(jMenuItem7);
jMenu3.add(jMenu5);
jMenu6.setText("Άπλιστη αναζήτηση");
jMenuItem8.setText("Χωρίς διαγώνιες κινήσεις");
jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem8ActionPerformed(evt);
}
});
jMenu6.add(jMenuItem8);
jMenuItem9.setText("Με διαγώνιες κινήσεις");
jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem9ActionPerformed(evt);
}
});
jMenu6.add(jMenuItem9);
jMenu3.add(jMenu6);
jMenu7.setText("Αναζήτηση Α*");
jMenuItem10.setText("Χωρίς διαγώνιες κινήσεις");
jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem10ActionPerformed(evt);
}
});
jMenu7.add(jMenuItem10);
jMenuItem11.setText("Με διαγώνιες κινήσεις");
jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem11ActionPerformed(evt);
}
});
jMenu7.add(jMenuItem11);
jMenu3.add(jMenu7);
jMenuBar1.add(jMenu3);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(cardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mazeMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mazeMenuActionPerformed
if (currentView == MAZEVIEW) return;
// Προβολή maze
cardPanel.removeAll();
cardPanel.repaint();
cardPanel.revalidate();
cardPanel.add(mazePanel);
cardPanel.repaint();
cardPanel.revalidate();
currentView = MAZEVIEW;
pack();
}//GEN-LAST:event_mazeMenuActionPerformed
private void graphMenuNoDiagActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_graphMenuNoDiagActionPerformed
if (currentView == GRAPHVIEW) return;
// Προβολή του graphPanel με γράφημα χωρίς διαγώνιες ακμές
int[][] grid = mazePanel.getGrid();
mazeGraphPanel.setGraph(grid, false);
cardPanel.removeAll();
cardPanel.add(mazeGraphPanel);
cardPanel.repaint();
cardPanel.revalidate();
currentView = GRAPHVIEW;
pack();
}//GEN-LAST:event_graphMenuNoDiagActionPerformed
private void graphMenuWithDiagActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_graphMenuWithDiagActionPerformed
if (currentView == GRAPHDIAGVIEW) return;
// Προβολή του graphPanel με γράφημα με διαγώνιες ακμές
int[][] grid = mazePanel.getGrid();
mazeGraphPanel.setGraph(grid, true);
cardPanel.removeAll();
cardPanel.add(mazeGraphPanel);
cardPanel.repaint();
cardPanel.revalidate();
currentView = GRAPHDIAGVIEW;
pack();
}//GEN-LAST:event_graphMenuWithDiagActionPerformed
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
// Μετατροπή του maze σε graph και αποθήκευση ως GraphML
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, false);
// Ανοίγουμε το παράθυρο επιλογής αρχείου
// Φιλτράρουμε τα αρχεία .xml
final JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Επιλογή αρχείου αποθήκευσης XML");
FileNameExtensionFilter filter;
filter = new FileNameExtensionFilter("Αρχεία XML", "xml");
fc.setFileFilter(filter);
int returnVal = fc.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File selectedFile = fc.getSelectedFile();
// Αν δεν έχει κατάληξη .xml την προσθέτουμε
if ( !selectedFile.getAbsolutePath().endsWith(".xml") )
selectedFile = new File(selectedFile.getAbsolutePath() + ".xml");
// Αν υπάρχει ήδη το αρχείο, μήνυμα ότι θα αντικατασταθεί
if (selectedFile.exists()) {
int result = JOptionPane.showConfirmDialog(null,
"Το όνομα αρχείου υπάρχει ήδη.\nΘέλετε να αντικατασταθεί?",
"Το αρχείο υπάρχει ήδη", JOptionPane.YES_NO_OPTION);
if (result != JOptionPane.YES_OPTION) return;
}
// Save the contents of Xml to selectedFile
try {
GraphMLWriter<Node, Edge> ml = new GraphMLWriter();
FileWriter fw = new FileWriter(selectedFile);
// Αποθηκεύουμε τα δεδομένα
mg.saveToGraphML(ml);
ml.save(mg, fw);
fw.close();
}
catch(Exception e) {
e.printStackTrace();
}
}
}//GEN-LAST:event_jMenuItem2ActionPerformed
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
MazeGraph mg = MazeGraph.load();
// Αν προέκυψε κάποιο σφάλμα επιστρέφουμε
if (mg == null) return;
// Παίρνουμε τις διαστάσεις του maze
int rows = mg.getMazeRows();
int cols = mg.getMazeCols();
// Δημιουργούμε ένα grid rows X cols
// και δίνουμε σε όλα τα κελιά την τιμή OBST (εμπόδιο)
int[][] grid = new int[rows][cols];
for (int i=0; i<rows; i++)
for (int j=0; j<cols; j++)
grid[i][j] = MazeGraph.OBST;
// Για κάθε κόμβο του γράφου, ανάλογα με τις συντεταγμένες του
// και τις τιμές των startNode και targetNode δίνουμε την αντίστοιχη τιμή
Collection<Node> nodes = mg.getVertices();
int robotRow = 0;
int robotCol = 0;
int targetRow = 0;
int targetCol = 0;
for (Node node : nodes) {
int row = node.getRow();
int col = node.getCol();
if (node.isTargetNode()) {
grid[row][col] = MazeGraph.TARGET;
targetRow = row;
targetCol = col;
}
else if (node.isStartNode()) {
grid[row][col] = MazeGraph.ROBOT;
robotRow = row;
robotCol = col;
}
else
grid[row][col] = MazeGraph.EMPTY;
}
// Δημιουργούμε το Maze από το grid
this.mazePanel.setGrid(grid, robotRow, robotCol, targetRow, targetCol);
// Αν είμαστε σε graphPanel με ή χωρίς διαγώνιες κινήσεις
// δημιουργούμε το ανάλογο γράφημα
if (currentView == GRAPHVIEW) {
mazeGraphPanel.setGraph(grid, false);
cardPanel.repaint();
cardPanel.revalidate();
}
if (currentView == GRAPHDIAGVIEW) {
mazeGraphPanel.setGraph(grid, true);
cardPanel.repaint();
cardPanel.revalidate();
}
}//GEN-LAST:event_jMenuItem3ActionPerformed
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
// Μήνυμα επιβεβαίωσης και έξοδος
int dialogResult = JOptionPane.showConfirmDialog (null,
"Θέλετε να κλείσετε την εφαρμογή?","Έξοδος",JOptionPane.YES_NO_OPTION);
if(dialogResult == JOptionPane.YES_OPTION){
System.exit( 0 );
}
}//GEN-LAST:event_jMenuItem4ActionPerformed
private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze με διαγώνιες κινήσεις
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, true);
// Ως ευρετικό η ευκλείδια απόσταση
ArrayList<Node> targetNodes = mg.getTargetNodes();
if (targetNodes.size() != 1)
return;
Node target = mg.getTargetNodes().get(0);
for (Node n : mg.getVertices()) {
n.setH(Util.eucledian(n, target));
n.setF(n.getH());
}
// Δημιουργία και άνοιγμα του modal dialog
HeuristicSearch astar = new HeuristicSearch(mg, HeuristicSearch.ASTAR);
String title = "Αλγόριθμος αναζήτησης Α*";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, astar);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem11ActionPerformed
private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze χωρίς διαγώνιες κινήσεις
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, false);
// Ως ευρετικό η απόσταση manhattan
ArrayList<Node> targetNodes = mg.getTargetNodes();
if (targetNodes.size() != 1)
return;
Node target = mg.getTargetNodes().get(0);
for (Node n : mg.getVertices()) {
n.setH(Util.manhattan(n, target));
n.setF(n.getH());
}
// Δημιουργία και άνοιγμα του modal dialog
HeuristicSearch astar = new HeuristicSearch(mg, HeuristicSearch.ASTAR);
String title = "Αλγόριθμος αναζήτησης Α*";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, astar);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem10ActionPerformed
private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze με διαγώνιες κινήσεις
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, true);
// Ως ευρετικό την ευκλείδιας απόστασης
ArrayList<Node> targetNodes = mg.getTargetNodes();
if (targetNodes.size() != 1)
return;
Node target = mg.getTargetNodes().get(0);
for (Node n : mg.getVertices()) {
n.setH(Util.eucledian(n, target));
n.setF(n.getH());
}
// Δημιουργία και άνοιγμα του modal dialog
HeuristicSearch greedy = new HeuristicSearch(mg, HeuristicSearch.GREEDY);
String title = "Άπληστος αλγόριθμος αναζήτησης (Greedy)";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, greedy);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem9ActionPerformed
private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze χωρίς διαγώνιες κινήσεις
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, false);
// Ως ευρετικό την απόσταση manhattan
ArrayList<Node> targetNodes = mg.getTargetNodes();
if (targetNodes.size() != 1)
return;
Node target = mg.getTargetNodes().get(0);
for (Node n : mg.getVertices()) {
n.setH(Util.manhattan(n, target));
n.setF(n.getH());
}
// Δημιουργία και άνοιγμα του modal dialog
HeuristicSearch greedy = new HeuristicSearch(mg, HeuristicSearch.GREEDY);
String title = "Άπληστος αλγόριθμος αναζήτησης (Greedy)";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, greedy);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem8ActionPerformed
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze με διαγώνιες κινήσεις
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, true);
BreadthFirstSearch bfs = new BreadthFirstSearch(mg);
// Δημιουργία και άνοιγμα του modal dialog
String title = "Αλγόριθμος αναζήτησης κατά πλάτος (BFS)";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, bfs);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem7ActionPerformed
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze χωρίς διαγώνιες κινήσεις
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, false);
BreadthFirstSearch bfs = new BreadthFirstSearch(mg);
// Δημιουργία και άνοιγμα του modal dialog
String title = "Αλγόριθμος αναζήτησης κατά πλάτος (BFS)";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, bfs);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem6ActionPerformed
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze (με διαγώνιες κινήσεις)
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, true);
DepthFirstSearch dfs = new DepthFirstSearch(mg);
// Δημιουργία και άνοιγμα του modal dialog
String title = "Αλγόριθμος αναζήτησης κατά βάθος (DFS)";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, dfs);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem5ActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// Δημιουργούμε ένα MazeGraph object από το τρέχον
// grid του maze.
int[][] grid = mazePanel.getGrid();
MazeGraph mg = new MazeGraph(grid, false);
DepthFirstSearch dfs = new DepthFirstSearch(mg);
// Δημιουργία και άνοιγμα του modal dialog
String title = "Αλγόριθμος αναζήτησης κατά βάθος (DFS)";
SearchAlgorithmDialog dlg = new SearchAlgorithmDialog(this, true, title, dfs);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
}//GEN-LAST:event_jMenuItem1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JPanel cardPanel;
private javax.swing.JCheckBoxMenuItem graphMenuNoDiag;
private javax.swing.JCheckBoxMenuItem graphMenuWithDiag;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenu jMenu6;
private javax.swing.JMenu jMenu7;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem10;
private javax.swing.JMenuItem jMenuItem11;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JMenuItem jMenuItem7;
private javax.swing.JMenuItem jMenuItem8;
private javax.swing.JMenuItem jMenuItem9;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JCheckBoxMenuItem mazeMenu;
// End of variables declaration//GEN-END:variables
}
|
artibet/graphix
|
src/xmaze/MainFrameXMaze.java
|
2,368 |
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
/**
* Αυτή η κλάση χειρίζεται τα μηνύματα των χρηστών
* Υλοποιείται με ένα database το οποίο έχει στις στήλες του (με αυτή τη σειρά)
* Τον παραλήπτη, τον αποστολέα και το ίδιο το μνήμα
*/
public class Messages
{
/**
* ΝΕΑ ΠΡΟΣΘΗΚΗ ΣΤΗΝ ΚΛΑΣΗ
* Χρησιμοποιείται μόνο για την εξαγωγή των μηνυμάτων από τη βάση δεδομένων
*/
public static class Message
{
private String sender;
private String body;
public Message(String sender,String body)
{
this.sender=sender;
this.body=body;
}
public String getBody()
{
return body;
}
public String getSender()
{
return sender;
}
}
/**
* Η βάση δεδομένων που αποθηκεύει τα μηνύματα
*/
public static Database messDataBase;
/**
* Δημιουργεί καινούργιο database με το όνομα που του δίνεται για τα μηνύματα ΟΛΩΝ των χρηστών
* (και αυτόματα φορτίζει και τα δεδομένα της)
* ΠΡΟΣΟΧΗ: Πρέπει να καλείται ΠΑΝΤΑ στην αρχή του προγράμματος
* @param filename Το όνομα του φακέλου που θα εμπεριέχει το messageDataBase
*/
public static void initializeDatabase(String filename) throws IOException
{
messDataBase = new Database(filename);
}
/**
* Φορτίζει τις αλλαγές που έγιναν κατά την εκτέλεση του προγράμματος
* ΠΡΟΣΟΧΗ: Πρέπει να καλείται ΠΑΝΤΑ στο τέλος του προγράμματος
*/
public static void updateDatabase() throws IOException
{
messDataBase.update();
}
/**
* Στέλνει (στην πραγματικότητα καταχωρεί) ένα μύνημα
* @param from Αποστολέας
* @param to Παραλήπτης
* @param message Μήνυμα
*/
public static int send(String from,String to,String message)
{
return messDataBase.add(to,from,message);
}
/**
* Διαγράφει ένα μήνυμα (από τη βάση δεδομένων)
* @param to Παραλήπτης
* @param from Αποστολέας
* @param message Μήνυμα
* @return <p>-1 Αν το μήνυμα δεν βρέθηκε</p>
* <p>Διαφορετικά τη θέση της βάσης δεδομένων από την οποία διαγράφτηκε το μήνυμα</p>
*/
public static int delete(String to,String from ,String message)
{
int index = messDataBase.remove(to,from,message);
if(index == -1)
{
System.out.println("Message couldn't be deleted because it wasn't found");
}
return index;
}
/**
* Εμφανίζει όλα τα μηνύματα ενός χρήστη και του επιτρέπει να τα διαγράψει
* @param username ο χρήστης
*/
public static void showMessages(String username)
{
Scanner input = new Scanner(System.in);
String entry;
int from = messDataBase.search(username,SearchType.first);
int to = messDataBase.search(username,SearchType.last);
if (from == -1)
{
System.out.println("No Messages");
return;
}
for (int i = from; i <= to; i++)
{
String sender = messDataBase.get(1,i);
String message = messDataBase.get(2,i);
System.out.println("=======================================");
System.out.println("From :" + sender);
System.out.println("=======================================");
System.out.println("Body :");
System.out.println(message);
System.out.println("=======================================");
boolean flag = true;
while(flag)
{
System.out.println("Would you like to delete this message? (y/n)");
System.out.println("=======================================");
entry = input.next();
if (entry.equals("y"))
{
delete(username,sender,message);
flag = false;
i--;
to--;
}
else if (entry.equals("n"))
{
flag = false;
}
else
{
System.out.println("Invalid Input");
System.out.println("Please type 'y' or 'n'");
System.out.println("Would you like to delete this message? (y/n)");
System.out.println("=======================================");
}
}
}
}
public static ArrayList<Message> getMessages(String username)
{
ArrayList<Message> messages = new ArrayList<>();
int from = messDataBase.search(username,SearchType.first);
int to = messDataBase.search(username,SearchType.last);
if (from == -1)
{
return null;
}
for (int i = from; i <= to; i++)
{
String sender = messDataBase.get(1,i);
String body = messDataBase.get(2,i);
Message message = new Message(sender,body);
messages.add(message);
}
return messages;
}
}
|
KonnosBaz/AUTh_CSD_Projects
|
Object Oriented Programming (2021)/src/Messages.java
|
2,369 |
package org.ocmc.ioc.liturgical.schemas.constants;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import org.ocmc.ioc.liturgical.schemas.models.DropdownItem;
import com.google.gson.JsonArray;
/**
* The Rev. Dr. Eugen Pentiuc asked that we use the SBL abbreviations.
* @author mac002
*
*/
public class BIBLICAL_BOOKS {
private static Map<String, String> map = new TreeMap<String,String>();
static {
map.put("OT", "OT - Old Testament (Παλαιά Διαθήκη)");
map.put("GEN", "Gen - Genesis (Γένεσις)");
map.put("EXO", "Exod - Exodus ( Ἔξοδος)");
map.put("LEV", "Lev - Leviticus (Λευϊτικόν)");
map.put("NUM", "Num - Numbers (Ἀριθμοί)");
map.put("DEU", "Deut - Deuteronomy (Δευτερονόμιον)");
map.put("JOS", "Josh - Joshua (Ἰησοῦς Nαυῆ)");
map.put("JDG", "Judg - Judges (Κριταί)");
map.put("RUT", "Ruth - Ruth (Ῥούθ)");
map.put("SA1", "1 Sam - I Samuel (Βασιλειῶν Αʹ) - 1 Kingdoms");
map.put("SA2", "2 Sam - II Samuel (Βασιλειῶν Βʹ) - 2 Kingdoms");
map.put("KI1", "1 Kgs - I Kings (Βασιλειῶν Γʹ) - 3 Kingdoms");
map.put("KI2", "2 Kgs - II Kings (Βασιλειῶν Δʹ) - 4 Kingdoms");
map.put("CH1", "1 Chr - I Chronicles (Παραλειπομένων Αʹ)");
map.put("CH2", "2 Chr - II Chronicles (Παραλειπομένων Βʹ)");
map.put("ES1", "1 Esd - 1 Esdras ( Ἔσδρας Αʹ)");
map.put("ES2", "2 Esd - Ezra-Nehemiah ( Ἔσδρας Βʹ)");
// map.put("ES4", "4 Esd - 4 Esdras ( Ἔσδρας Δʹ)");
map.put("EZR", "Ezra - Ezra ( Ἔσδρας)");
map.put("NEH", "Neh - Nehemiah ( Νεεμίας)");
map.put("PRA", "Pr Azar - Prayer of Azariah (Προσευχή του Αζαρίου)");
map.put("PRM", "Pr Man - Prayer of Manasseh (Προσευχή του Μανασσή)");
map.put("TOB", "Tob - Tobit or Tobias (Τωβίτ)");
map.put("JDT", "Jdt - Judith (Ἰουδίθ)");
map.put("EST", "Esth - Esther (Ἐσθήρ)");
map.put("MA1", "1 Macc - 1 Maccabees (Μακκαβαίων Αʹ)");
map.put("MA2", "2 Macc - 2 Maccabees (Μακκαβαίων Βʹ)");
map.put("MA3", "3 Macc - 3 Maccabees (Μακκαβαίων Γʹ)");
map.put("PSA", "Ps/Pss - Psalm/Psalms (Ψαλμοί)");
map.put("PSX", "Ps 151 - Psalm 151 (Ψαλμός 151)");
map.put("ODE", "Ode - Biblical Odes (Εννέα Ωδαί)");
map.put("JOB", "Job - Job (Ἰώβ)");
map.put("PRO", "Prov - Proverbs (Παροιμίαι)");
map.put("ECC", "Eccl - Ecclesiastes (Ἐκκλησιαστής)");
map.put("SOS", "Song - Song of Solomon or Canticles (Ἆσμα Ἀσμάτων)");
map.put("WIS", "Wis - Wisdom (Σοφία Σαλoμῶντος)");
map.put("SIR", "Sir - Sirach or Ecclesiasticus (Σοφία Ἰησοῦ Σειράχ)");
map.put("POS", "Pss. Sol. - Psalms of Solomon (Ψαλμοί Σαλoμῶντος)");
map.put("HOS", "Hos - Hosea (Ὡσηέ Αʹ)");
map.put("AMO", "Amos - Amos (Ἀμώς Βʹ)");
map.put("MIC", "Mic - Micah (Μιχαίας Γʹ)");
map.put("JOE", "Joel - Joel (Ἰωήλ Δʹ)");
map.put("OBA", "Obad - Obadiah (Ὀβδιού Εʹ)");
map.put("JON", "Jonah - Jonah (Ἰωνᾶς Ϛ')");
map.put("NAH", "Nah - Nahum (Ναούμ Ζʹ)");
map.put("HAB", "Hab - Habbakuk (Ἀμβακούμ Ηʹ)");
map.put("ZEP", "Zeph - Zephaniah (Σοφονίας Θʹ)");
map.put("HAG", "Hag - Haggai (Ἀγγαῖος Ιʹ)");
map.put("ZEC", "Zech - Zechariah (Ζαχαρίας ΙΑʹ)");
map.put("MAL", "Mal - Malachi (Μαλαχίας ΙΒʹ)");
map.put("ISA", "Isa - Isaiah (Ἠσαΐας)");
map.put("JER", "Jer - Jeremiah (Ἱερεμίας)");
map.put("BAR", "Bar - Baruch (Βαρούχ)");
map.put("LAM", "Lam - Lamentations (Θρῆνοι)");
map.put("LJE", "Ep Jer - Epistle of Jeremiah (Ἐπιστολὴ Ἰερεμίου)");
map.put("EZE", "Ezek - Ezekiel (Ἰεζεκιήλ)");
map.put("DAN", "Dan - Daniel (Δανιήλ)");
map.put("MA4", "4 Macc - 4 Maccabees (Μακκαβαίων Δ' Παράρτημα)");
map.put("STY", "Sg Three - Song of Three Youths (Οι Άγιοι Τρεις Παίδες)");
map.put("SUS", "Sus - Susanna (Σουσάννα)");
map.put("BEL", "Bel - Bel and the Dragon (Βὴλ καὶ Δράκων)");
map.put("NT", "NT - New Testament (H KAINH DIAθHKH)");
map.put("Gospel", "Gospels (ΕΥΑΓΓΕΛΙΟΝ)");
map.put("Apostle", "Apostle (ὁ Ἀπόστολος)");
map.put("MAT", "Matt - Matthew (Κατά Ματθαίον Ευαγγέλιον)");
map.put("MAR", "Mark - Mark (Κατά Μάρκον Ευαγγέλιον)");
map.put("LUK", "Luke - Luke (Κατά Λουκάν Ευαγγέλιον)");
map.put("JOH", "John - John (Κατά Ιωάννην Ευαγγέλιον)");
map.put("ACT", "Acts - Acts (Πράξεις των Αποστόλων)");
map.put("ROM", "Rom - Romans (Επιστολή προς Ρωμαίους)");
map.put("CO1", "1 Cor - 1 Corinthians (Επιστολή προς Κορινθίους Α΄)");
map.put("CO2", "2 Cor - 2 Corinthians (Επιστολή προς Κορινθίους Β΄)");
map.put("GAL", "Gal - Galatians (Επιστολή προς Γαλάτες)");
map.put("EPH", "Eph - Ephesians (Επιστολή προς Εφεσίους)");
map.put("PHP", "Phil - Philippians (Επιστολή προς Φιλιππησίους)");
map.put("COL", "Col - Colossians (Επιστολή προς Κολοσσαείς)");
map.put("TH1", "1 Thess - 1 Thessalonians (Επιστολή προς Θεσσαλονικείς Α΄)");
map.put("TH2", "2 Thess - 2 Thessalonians (Επιστολή προς Θεσσαλονικείς Β΄)");
map.put("TI1", "1 Tim - 1 Timothy (Επιστολή προς Τιμόθεο Α΄)");
map.put("TI2", "2 Tim - 2 Timothy (Επιστολή προς Τιμόθεο Β΄)");
map.put("TIT", "Titus - Titus (Επιστολή προς Τίτο)");
map.put("PHM", "Phlm - Philemon (Επιστολή προς Φιλήμονα)");
map.put("HEB", "Heb - Hebrews (Επιστολή προς Εβραίους)");
map.put("JAM", "Jas - James (Επιστολή Ιακώβου)");
map.put("PE1", "1 Pet - 1 Peter (Επιστολή Πέτρου Α΄)");
map.put("PE2", "2 Pet - 2 Peter (Επιστολή Πέτρου Β΄)");
map.put("JO1", "1 John - 1 John (Επιστολή Ιωάννη Α΄)");
map.put("JO2", "2 John - 2 John (Επιστολή Ιωάννη Β΄)");
map.put("JO3", "3 John - 3 John (Επιστολή Ιωάννη Γ΄)");
map.put("JDE", "Jude - Jude (Επιστολή Ιούδα)");
map.put("REV", "Rev - Revelation (Αποκάλυψη του Ιωάννη)");
map = Collections.unmodifiableMap(map);
}
public static Map<String,String> getMap() {
return map;
}
public static boolean containsKey(String key) {
return map.containsKey(key);
}
public static String get(String key) {
return key + " - " + map.get(key);
}
/**
* Convenience method for when you don't want to bother to
* see if the key exists in the map.
*
* If it does not, the label will be set to the value of the key.
* If it does exist, the label will have the value from the map.
* @param key to search for
* @return the label for that key
*/
public static String getLabel(String key) {
if (map.containsKey(key)) {
return get(key);
} else {
return key;
}
}
/**
* Converts the map to a JsonArray containing
* dropdown items to use in a user interface.
* A map key becomes the dropdown value
* and a map value becomes the dropdown label.
* @return dropdown items as a JsonArray
*/
public static JsonArray toDropdownJsonArray() {
JsonArray array = new JsonArray();
for (Entry<String,String> entry : map.entrySet()) {
array.add(new DropdownItem(entry.getValue(), entry.getKey()).toJsonObject());
}
return array;
}
/**
* Converts the map to a JsonArray containing
* dropdown items to use in a user interface.
* A map key becomes the dropdown value
* and a map value becomes the dropdown label.
* @return DropdownItems as a list
*/
public static List<DropdownItem> toDropdownList() {
List<DropdownItem> result = new ArrayList<DropdownItem>();
for (Entry<String,String> entry : map.entrySet()) {
result.add(new DropdownItem(entry.getValue(), entry.getKey()));
}
return result;
}
public static void main(String [] args) {
for (String key : BIBLICAL_BOOKS.map.keySet()) {
System.out.println("\t\t, " + key);
}
}
}
|
ocmc-olw/ioc-liturgical-schemas
|
ioc.liturgical.schemas/src/main/java/org/ocmc/ioc/liturgical/schemas/constants/BIBLICAL_BOOKS.java
|
2,370 |
package graph;
import edu.uci.ics.jung.io.GraphMLWriter;
import edu.uci.ics.jung.io.graphml.NodeMetadata;
import org.apache.commons.collections15.Transformer;
/**
* ΕΑΠ - ΠΛΗ31 - 4η ΕΡΓΑΣΙΑ 2015-2016
* @author Tsakiridis Sotiris
*/
public class Node {
// Πεδία της κλάσης
private String label; // Η ετικέτα του κόμβου
private double h = 0; // Το ευρετικό του κόμβου
private int row; // Η γραμμή στο maze
private int col; // Η στήλη στο maze
private double x; // H θέση στο layout
private double y;
// flags για το αν ο κόμβος είναι ο κόμβος έναρξη
// ή ανήκει στους κόμβους στόχους
private boolean startNode = false;
private boolean targetNode = false;
// flag διαγραφής κατά τη σχεδίαση - δεν αποθηκεύεται
private boolean deleted = false;
// Βοηθητικά πεδία για την εκτέλεση των αλγορίθμων αναζήτησης
// δεν αποθηκεύονται
private double f; // Η συνάρτηση αξιολόγησης
// f = h (greedy)
// f = g + h (A*)
// default contructor
public Node() {
this.label = "";
this.x = 0;
this.y = 0;
}
// Constructor - Αρχικοποιούμε μόνο την ετικέτα
public Node(String label) {
this.label = label;
this.x = 0;
this.y = 0;
}
// Constructor - Αρχικοποιούμε εττικέτα και ευρετικό
public Node(String label, int h) {
this(label);
this.h = h;
}
// Constructor - Αρχικοποιούμε από άλλο Node
public Node(Node node) {
this.label = node.getLabel();
this.h = node.getH();
this.startNode = node.isStartNode();
this.targetNode = node.isTargetNode();
this.row = node.getRow();
this.col = node.getCol();
this.f = node.getF();
this.h = node.getH();
this.x = 0;
this.y = 0;
}
// Getters
public String getLabel() { return label; }
public double getH() { return this.h; }
public int getRow() { return this.row; }
public int getCol() { return this.col; }
public boolean isStartNode() { return this.startNode; }
public boolean isTargetNode() { return this.targetNode; }
public double getF() { return this.f; }
public double getX() { return this.x; }
public double getY() { return this.y; }
public boolean isDeleted() { return this.deleted; }
// Setters
public void setLabel(String label) { this.label = label; }
public void setH(double h) { this.h = h; }
public void setRow(int row) { this.row = row; }
public void setCol(int col) { this.col = col; }
public void setStartNode(boolean b) { this.startNode = b; }
public void setTargetNode(boolean b) { this.targetNode = b; }
public void setF(double f) { this.f = f; }
public void setX(double x) { this.x = x; }
public void setY(double y) { this.y = y; }
public void setDeleted(boolean b) { this.deleted = b; }
// Override toString() method
@Override
public String toString() {
return this.label;
}
// Node transformer για την ανάκτηση από xml
public static Transformer<NodeMetadata, Node> getNodeTransformer() {
Transformer<NodeMetadata, Node> nodeTransformer =
new Transformer<NodeMetadata, Node>() {
@Override
public Node transform(NodeMetadata metadata) {
Node node = new Node("");
node.setLabel(metadata.getProperty("label"));
node.setH(Double.parseDouble(metadata.getProperty("h")));
node.setStartNode(Boolean.parseBoolean(metadata.getProperty("startNode")));
node.setTargetNode(Boolean.parseBoolean(metadata.getProperty("targetNode")));
node.setRow(Integer.parseInt(metadata.getProperty("row")));
node.setCol(Integer.parseInt(metadata.getProperty("col")));
node.setX(Double.parseDouble(metadata.getProperty("x")));
node.setY(Double.parseDouble(metadata.getProperty("y")));
return node;
}
};
return nodeTransformer;
}
// Αποθήκευση δεδομένων του Node σε GraphML
public static void saveToGraphML(GraphMLWriter<Node, Edge> ml) {
// label
ml.addVertexData("label", null, "",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return node.getLabel();
}
});
// startNode
ml.addVertexData("startNode", null, "",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Boolean.toString(node.isStartNode());
}
});
// targetNode
ml.addVertexData("targetNode", null, "",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Boolean.toString(node.isTargetNode());
}
});
// h - τιμή ευρετικού
ml.addVertexData("h", null, "0",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Double.toString(node.getH());
}
});
// row
ml.addVertexData("row", null, "0",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Integer.toString(node.getRow());
}
});
// col
ml.addVertexData("col", null, "0",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Integer.toString(node.getCol());
}
});
// x
ml.addVertexData("x", null, "0",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Double.toString(node.getX());
}
});
// y
ml.addVertexData("y", null, "0",
new Transformer<Node, String>() {
@Override
public String transform(Node node) {
return Double.toString(node.getY());
}
});
}
}
|
artibet/graphix
|
src/graph/Node.java
|
2,371 |
package com.example.unipiandroid;
import static com.example.unipiandroid.MyApp.getContext;
import android.Manifest;
import android.app.Activity;
import android.app.DownloadManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.OnProgressListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class AddAnnouncement extends AppCompatActivity {
EditText editTextTitle,editTextBody;
Spinner newsTypeDD;
String[] newsTypes = new String[] {"ΕΠΙΚΑΙΡΟΤΗΤΑ","ΑΝΑΚΟΙΝΩΣΕΙΣ","ΕΚΔΗΛΩΣΕΙΣ","ΦΟΙΤΗΤΙΚΑ ΘΕΜΑΤΑ"};
Button submitButton;
RequestQueue mRequestQueue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
setContentView(R.layout.add_announcement);
final TextView loginText = findViewById(R.id.loginText2);
SharedPreferences sharedPreferences = getSharedPreferences("MyUserPrefs",Context.MODE_PRIVATE);
String username = sharedPreferences.getString("Username","");
String fullname = sharedPreferences.getString("Name","");
//if user is logged in
if(!username.isEmpty() && !fullname.isEmpty()) {
loginText.setText("ΑΠΟΣΥΝΔΕΣΗ");
loginText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.apply();
finish();
startActivity(new Intent(getApplicationContext(),MainActivity.class));
}
});
} else { //else redirect to login page
loginText.setText("ΣΥΝΔΕΣΗ");
loginText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
startActivity(new Intent(getApplicationContext(), LoginPage.class));
}
});
}
final ImageView unipiLogo = findViewById(R.id.unipiLogo2);
unipiLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getContext(), MainActivity.class));
}
});
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
submitButton = (Button) findViewById(R.id.submit_news);
editTextTitle = findViewById(R.id.editTitle);
editTextBody = findViewById(R.id.editTextTextMultiLine);
newsTypeDD = findViewById(R.id.spinner1);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, newsTypes);
newsTypeDD.setAdapter(adapter);
submitButton.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void onClick(View v) {
String url = "SERVER/api/news/";
String newsType = newsTypeDD.getSelectedItem().toString();
if ("ΕΠΙΚΑΙΡΟΤΗΤΑ".equals(newsType)) {
newsType = "CURRENT_NEWS";
mRequestQueue.add(makePostRequest(url, fullname, newsType));
} else if ("ΑΝΑΚΟΙΝΩΣΕΙΣ".equals(newsType)) {
newsType = "ANNOUNCEMENT";
mRequestQueue.add(makePostRequest(url, fullname, newsType));
} else if ("ΕΚΔΗΛΩΣΕΙΣ".equals(newsType)) {
newsType = "EVENT";
mRequestQueue.add(makePostRequest(url, fullname, newsType));
} else if ("ΦΟΙΤΗΤΙΚΑ ΘΕΜΑΤΑ".equals(newsType)) {
newsType = "STUDENT_NEWS";
mRequestQueue.add(makePostRequest(url, fullname, newsType));
} else {
Toast.makeText(getApplicationContext(), "Επιλέξτε είδος ανακοίνωσης.", Toast.LENGTH_LONG).show();
}
}
});
}
@RequiresApi(api = Build.VERSION_CODES.O)
JsonObjectRequest makePostRequest(String url, String fullname, String newsType) {
String title = String.valueOf(editTextTitle.getText());
String message = String.valueOf(editTextBody.getText());
JSONObject news_data = new JSONObject();
try {
news_data.put("date",LocalDate.now());
news_data.put("title",title);
news_data.put("author",fullname);
news_data.put("message",message);
news_data.put("type",newsType);
} catch (JSONException e) {
e.printStackTrace();
}
return new JsonObjectRequest(
Request.Method.POST,
url,
news_data,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if(response.getInt("statusCode")==201) { //http status CREATED
Toast.makeText(getApplicationContext(), "Επιτυχής δημιουργία ανακοίνωσης", Toast.LENGTH_LONG).show();
finish();
startActivity(new Intent(AddAnnouncement.this, MainActivity.class));
} else {
//toast error msg
Toast.makeText(getApplicationContext(), "Σφάλμα κατά τη δημιουργία της ανακοίνωσης! Δοκιμάστε ξανά", Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(), "Σφάλμα κατά τη δημιουργία της ανακοίνωσης! Δοκιμάστε ξανά", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), "Σφάλμα κατά τη δημιουργία της ανακοίνωσης! Δοκιμάστε ξανά", Toast.LENGTH_LONG).show();
error.printStackTrace();
}
}
);
}
}
|
n-hatz/Android-Unipi.gr
|
frontend/app/src/main/java/com/example/unipiandroid/AddAnnouncement.java
|
2,374 |
package com.example.myplaces;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.tasks.Task;
import com.google.android.libraries.places.api.model.Place;
import com.google.android.libraries.places.api.model.PlaceLikelihood;
import com.google.android.libraries.places.api.net.FindCurrentPlaceRequest;
import com.google.android.libraries.places.api.net.FindCurrentPlaceResponse;
import com.google.android.libraries.places.api.net.PlacesClient;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback, PopUpFilters.PopUpDialogListener {
private String TAG = "MainActivity";
// Data request
private GsonWorker gson = new GsonWorker();
// Location
private FusedLocationProviderClient fusedLocationClient;
private LatLng myLocation;
private boolean locationFound = false;
// Map
private MapView mMapView;
private GoogleMap googleMap;
private static final String MAPVIEW_BUNDLE_KEY = "AIzaSyAtj0HrLGRjXpeDBpoi2jpuaAZEPIOC5kA";
// May be useful in the future
private PlacesClient placesClient;
// Permissions manager
private MyPermissions myPermissions;
// List with places found
private ArrayList<MyPlace> places = new ArrayList<MyPlace>();
// Parameters object for search query
private FilterParameters parameters = new FilterParameters();
// Pop up parameters window
private PopUpFilters dialogFragment = new PopUpFilters();
// Search query (for user)
private TextView query;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Check permissions everytime activity starts
myPermissions = new MyPermissions(this, this);
// Connect UI
Button search = findViewById(R.id.srch_button);
Button favs_btn = findViewById(R.id.favs_btn);
Button filters_btn = findViewById(R.id.filters_btn);
query = findViewById(R.id.query_txt);
query.setText(setQueryText());
// Get user's current location
updateCurrentLocation();
// Create Map
Bundle mapViewBundle = null;
if (savedInstanceState != null) {
mapViewBundle = savedInstanceState.getBundle(MAPVIEW_BUNDLE_KEY);
}
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.onCreate(mapViewBundle);
mMapView.getMapAsync(this);
// Search Button
search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Make sure permissions are granted
MyPermissions.requestLocation(v);
MyPermissions.requestCoarseLocation(v);
// Checks if required parameters are fulfilled
if(parameters.isEmpty()){
Toast.makeText(getApplicationContext(),"Παρακαλώ συμπληρώστε τα απαραίτητα φίλτρα αναζήτησης. (*)",Toast.LENGTH_LONG).show();
}
else {
placesSearch();
}
}
});
// Open Favourites Activity
favs_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Prepare search results activity, pass down "places"
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class);
startActivity(intent);
}
});
// Open filter parameters dialog
filters_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Open dialog with filter selection
dialogFragment.show(getSupportFragmentManager(),TAG);
}
});
}
public void placesSearch(){
// Find user's location
GPSTracker gps = new GPSTracker(this);
if (gps.canGetLocation()) {
myLocation = new LatLng(gps.getLatitude(),gps.getLongitude());
locationFound = true;
} else {
locationFound = false;
// can't get location
// GPS or Network is not enabled
// Ask user to enable GPS/network in settings
gps.showSettingsAlert();
}
// Have to know user's location
if(locationFound) {
// Run places search as thread, for performance purposes
new Thread(() -> {
if(places != null)
places.clear();
// API CALL
places = gson.getNearbyPlaces(myLocation, parameters, this);
// Temporary fake data
//places = createTempPlaces();
// If search is successful
if (places != null && places.size()>0) {
// Log them to be sure
for (MyPlace place : places) {
Log.d(TAG, " place is " + place.getName());
Log.d(TAG, " rating is " + place.getRating());
}
// Clear parameters for next search
parameters.clear();
// Prepare search results activity, pass down "places"
Intent intent = new Intent(MainActivity.this, SearchResults.class);
intent.putParcelableArrayListExtra("Places", places);
startActivity(intent);
} else {
// Inform user in case of error
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast toast=Toast.makeText(getApplicationContext(),"Σφάλμα κατά την λήψη τοπθεσιών!",Toast.LENGTH_LONG);
toast.show();
}
});
Log.d(TAG, "error");
}
}).start();
}
else {
// User's location data missing
Toast toast=Toast.makeText(getApplicationContext(),"Δεν είναι δυνατή η εύρεση τοποθεσίας της συσκευής.",Toast.LENGTH_LONG);
toast.show();
}
}
// Prepares a query with search's parameters to display it to user.
// For debugging purposes
public String setQueryText(){
StringBuilder query = new StringBuilder();
query.append("Απόσταση: " + parameters.getDistance() + " μ.");
if(parameters.getType() != null)
query.append(", Τύπος: " + parameters.getType());
query.append(", Μέγιστη Τιμή: ");
for(int i=0 ; i<parameters.getMax_price(); i++){
query.append("€");
}
if(parameters.getRankby() != null)
query.append(", Κατάταξη κατά: "+ parameters.getRankby());
if(parameters.getKeyword()!=null)
query.append(", Λέξη Κλειδί: " + parameters.getKeyword());
return query.toString();
}
// Updates user's current location and updates map as well.
public void updateCurrentLocation(){
// Set Location Client
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
// Update location
fusedLocationClient.getLastLocation()
.addOnSuccessListener(this, location -> {
// Got last known location. In some rare situations this can be null.
if (location != null) {
// Logic to handle location object
double cur_lat = location.getLatitude();
double cur_lon = location.getLongitude();
myLocation = new LatLng(cur_lat, cur_lon);
locationFound = true;
// Animate camera to zoom in user's location
if(googleMap != null)
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(myLocation.latitude, myLocation.longitude), 16));
// Inform user
Toast toast=Toast.makeText(getApplicationContext(),"Η τοποθεσία σας ενημερώθηκε.",Toast.LENGTH_SHORT);
toast.show();
}
});
}
/** Google Map Stuff **/
// Prepares map
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Bundle mapViewBundle = outState.getBundle(MAPVIEW_BUNDLE_KEY);
if (mapViewBundle == null) {
mapViewBundle = new Bundle();
outState.putBundle(MAPVIEW_BUNDLE_KEY, mapViewBundle);
}
mMapView.onSaveInstanceState(mapViewBundle);
}
// Triggers when map is ready for display.
@Override
public void onMapReady(GoogleMap googleMap) {
this.googleMap = googleMap;
// Check if required permissions are granted
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
myPermissions.requestLocation(findViewById(android.R.id.content));
myPermissions.requestCoarseLocation(findViewById(android.R.id.content));
}
else {
googleMap.setMyLocationEnabled(true);
if(myLocation != null){
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(myLocation.latitude, myLocation.longitude), 16));
}
}
}
// Relocate position after resume.
@Override
public void onResume() {
super.onResume();
GPSTracker gps = new GPSTracker(this);
if (gps.canGetLocation()) {
myLocation = new LatLng(gps.getLatitude(),gps.getLongitude());
} else {
// can't get location
// GPS or Network is not enabled
// Ask user to enable GPS/network in settings
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
myPermissions.requestLocation(findViewById(android.R.id.content));
myPermissions.requestCoarseLocation(findViewById(android.R.id.content));
}
gps.showSettingsAlert();
}
mMapView.onResume();
}
@Override
public void onStart() {
super.onStart();
mMapView.onStart();
}
@Override
public void onStop() {
super.onStop();
mMapView.onStop();
}
@Override
public void onPause() {
mMapView.onPause();
super.onPause();
}
@Override
public void onDestroy() {
mMapView.onDestroy();
super.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
mMapView.onLowMemory();
}
// Runs when filter selection is done. Returns result parameters.
@Override
public void onDialogFinish(FilterParameters parameters) {
this.parameters = parameters;
// Print the query for search in simple format. (for user)
query.setText(setQueryText());
googleMap.clear();
// Create a radius circle on map
googleMap.addCircle(new CircleOptions()
.center(myLocation)
.radius(parameters.getDistance())
.strokeColor(Color.RED)
.fillColor(0x40ff0000)
.strokeWidth(3));
float zoom;
// Zoom in
if(parameters.getDistance() >=2500){
zoom = 12;
}
else if(parameters.getDistance() >=1000){
zoom = 13;
}
else if(parameters.getDistance() >=500) {
zoom = (float) 14.3;
}
else zoom = 15;
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(myLocation.latitude, myLocation.longitude),zoom));
}
/** NOT USED METHODS **/
// Not necessary for now
public void getCurrentPlace(PlacesClient placesClient){
// Use fields to define the data types to return.
List<Place.Field> placeFields = Collections.singletonList(Place.Field.NAME);
// Use the builder to create a FindCurrentPlaceRequest.
FindCurrentPlaceRequest request =
FindCurrentPlaceRequest.newInstance(placeFields);
// Call findCurrentPlace and handle the response (first check that the user has granted permission).
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
Task<FindCurrentPlaceResponse> placeResponse = placesClient.findCurrentPlace(request);
placeResponse.addOnCompleteListener(task -> {
if (task.isSuccessful()){
FindCurrentPlaceResponse response = task.getResult();
Toast toast=Toast.makeText(getApplicationContext(),
String.format("Βρίσκεσαι στην τοποθεσία '%s' με πιθανότητα: %f",
response.getPlaceLikelihoods().get(0).getPlace().getName(),
response.getPlaceLikelihoods().get(0).getLikelihood())
,Toast.LENGTH_LONG);
toast.show();
for (PlaceLikelihood placeLikelihood : response.getPlaceLikelihoods()) {
Log.i(TAG, String.format("place '%s' has likelihood: %f",
placeLikelihood.getPlace().getName(),
placeLikelihood.getLikelihood()));
}
} else {
Exception exception = task.getException();
if (exception instanceof ApiException) {
ApiException apiException = (ApiException) exception;
Log.e(TAG, "place not found: " + apiException.getStatusCode());
}
}
});
}
}
// FOR TESTING PURPOSES
// Temp fake data. Will be deleted when app is kinda ready for use.
public ArrayList<MyPlace> createTempPlaces() {
ArrayList<MyPlace> temp = new ArrayList<>();
MyPlace place1 = new MyPlace();
MyPlace place2 = new MyPlace();
MyPlace place3 = new MyPlace();
place1.setName("Τα Γοριλάκια");
place1.setRating(4.7);
place1.setOpen_now(true);
place1.setVicinity("Κάτω Τούμπα");
place1.setPrice_level(2);
place1.setUser_ratings_total(100);
place1.setAvatar_link("https://www.bestofrestaurants.gr/thessaloniki/anatoliki_thessaloniki/sites/restaurants/ta_gorilakia/photogallery/original/03.jpg");
place1.setLocation(new LatLng(40.608772, 22.979280));
place1.setPlace_id("000000");
place2.setName("Γυράδικο");
place2.setRating(4.8);
place2.setOpen_now(true);
place2.setVicinity("Άνω Τούμπα");
place2.setPrice_level(2);
place2.setUser_ratings_total(230);
place2.setAvatar_link("https://www.thelosouvlakia.gr/cms/Uploads/shopImages/gyradiko_thessaloniki_1209_katastima.jpg");
place2.setLocation(new LatLng(40.615029, 22.976974));
place2.setPlace_id("111111");
place3.setName("Ωμέγα");
place3.setRating(4.1);
place3.setOpen_now(true);
place3.setVicinity("Κάτω Τούμπα");
place3.setPrice_level(2);
place3.setUser_ratings_total(42);
place3.setAvatar_link("https://www.tavernoxoros.gr/img/i/rOeC6vBxb-kj");
place3.setLocation(new LatLng(40.608587, 22.978683 ));
place3.setPlace_id("222222");
temp.add(place1);
temp.add(place2);
temp.add(place3);
return temp;
}
}
|
alvincein/NearByApp
|
app/src/main/java/com/example/myplaces/MainActivity.java
|
2,376 |
package oracle.net.nl.mesg;
import java.util.ListResourceBundle;
public class NLSR_el extends ListResourceBundle
{
static final Object[][] contents = { { "NoFile-04600", "TNS-04600: Δεν βρέθηκε το αρχείο: {0}" }, { "FileReadError-04601", "TNS-04601: Σφάλμα κατά την ανάγνωση του αρχείου παραμέτρων: {0}, σφάλμα: {1}" }, { "SyntaxError-04602", "TNS-04602: Σφάλμα μη αποδεκτής σύνταξης: Αναμένεται \"{0}\" πριν ή στο {1}" }, { "UnexpectedChar-04603", "TNS-04603: Σφάλμα μη αποδεκτής σύνταξης: Μη αναμενόμενος χαρακτήρας \"{0}\" κατά την ανάλυση του {1}" }, { "ParseError-04604", "TNS-04604: Δεν έγινε αρχικοποίηση του αντικειμένου ανάλυσης" }, { "UnexpectedChar-04605", "TNS-04605: Σφάλμα μη αποδεκτής σύνταξης: Μη αναμενόμενος χαρακτήρας ή LITERAL \"{0}\" πριν ή στο {1}" }, { "NoLiterals-04610", "TNS-04610: Δεν υπάρχουν άλλες αλφαριθμητικές σταθερές, βρέθηκε το τέλος για το ζεύγος NV" }, { "InvalidChar-04611", "TNS-04611: Μη αποδεκτός χαρακτήρας συνέχισης μετά το σχόλιο" }, { "NullRHS-04612", "TNS-04612: Μη ορισμένη τιμή RHS για \"{0}\"" }, { "Internal-04613", "TNS-04613: Εσωτερικό σφάλμα: {0}" }, { "NoNVPair-04614", "TNS-04614: Το ζεύγος NV {0} δεν βρέθηκε" }, { "InvalidRHS-04615", "TNS-04615: Μη αποδεκτό RHS για {0}" } };
public Object[][] getContents()
{
return contents;
}
}
/* Location: /Users/admin/.m2/repository/com/alibaba/external/jdbc.oracle/10.2.0.2/jdbc.oracle-10.2.0.2.jar
* Qualified Name: oracle.net.nl.mesg.NLSR_el
* JD-Core Version: 0.6.0
*/
|
wenshao/OracleDriver10_2_0_2
|
src/oracle/net/nl/mesg/NLSR_el.java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.