use of com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.Product in project AN15 by IharDubkou.
the class Main method main.
public static void main(String[] args) {
Basket basket = new Basket();
Product product = new Product();
Product product1 = new Product();
Product product2 = new Product();
product.setPrice(100);
product.setRating(1);
product.setName("Limon");
product1.setPrice(200);
product1.setRating(13);
product1.setName("Orange");
product2.setPrice(300);
product2.setRating(7);
product2.setName("Banana");
Product[] products = new Product[] { product, product1, product2 };
System.out.println(Arrays.toString(products));
User user = new User();
user.setLogin("Ybivator");
user.setPassword("ybiica007");
user.setBasket(basket);
AuthenticationService authenticationService = new AutenticationImpl();
authenticationService.authentication(user);
Category category = new Category();
category.setName("Овощи");
}
use of com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.Product in project AN15 by IharDubkou.
the class Main method main.
public static void main(String[] args) {
Product apple = new Product("Apple", 4.1, 4.3);
Product lemon = new Product("Lemon", 1.2, 3.3);
Product potato = new Product("Potato", 1.3, 4.9);
Product onion = new Product("Onion", 1.7, 3.3);
Product mayo = new Product("Mayo", 3.9, 3.7);
Product milk = new Product("Milk", 2.4, 4.2);
Product[] milks = new Product[2];
Product[] fruits = new Product[2];
Product[] vegetables = new Product[2];
milks[0] = milk;
milks[1] = mayo;
fruits[0] = apple;
fruits[1] = lemon;
vegetables[0] = potato;
vegetables[1] = onion;
Category milksCat = new Category("Молочные и майонез", milks);
Category fruitsCat = new Category("Фрукты", fruits);
Category vegetablesCat = new Category("Овощи", vegetables);
Category[] categories = new Category[3];
categories[0] = milksCat;
categories[1] = fruitsCat;
categories[2] = vegetablesCat;
// Login Password
User user = new User("Login", "Password");
Basket basket = new Basket();
ArrayList<Product> products = new ArrayList<>();
basket.setProducts(products);
// тут аутентификация работает нормально
Scanner scanner = new Scanner(System.in);
System.out.println("Введите логин");
String login = scanner.nextLine();
System.out.println("Введите пароль");
String password = scanner.nextLine();
AuthenticationImpl authentication = new AuthenticationImpl();
authentication.authentication(user, login, password);
Menu(user, categories, basket);
}
use of com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.Product in project java-notes by esalkan.
the class HashSetOfProducts method main.
/**
* @param args
*/
public static void main(String[] args) {
Set<Product> prodSet = new TreeSet<>();
// Add product to prodSet via Product Class
prodSet.add(new Product("book", 25.99));
prodSet.add(new Product("book", 19.99));
prodSet.add(new Product("magazine", 7.99));
prodSet.add(new Product("phone", 100));
System.out.println(prodSet.toString());
// print each product by using for each loop
for (Product product : prodSet) {
System.out.println(product.getPrice());
}
// print each product by using forEach method
prodSet.forEach(x -> System.out.println(x.getName()));
// prodSet.forEach(product -> System.out.println(product));
}
use of com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.Product in project java-retail by googleapis.
the class RemoveTestResources method deleteAllProducts.
public static void deleteAllProducts() throws IOException {
System.out.println("Deleting products in process, please wait...");
try (ProductServiceClient productServiceClient = ProductServiceClient.create()) {
ListProductsRequest listRequest = ListProductsRequest.newBuilder().setParent(DEFAULT_CATALOG).build();
ListProductsPagedResponse products = productServiceClient.listProducts(listRequest);
int deleteCount = 0;
for (Product product : products.iterateAll()) {
DeleteProductRequest deleteRequest = DeleteProductRequest.newBuilder().setName(product.getName()).build();
try {
productServiceClient.deleteProduct(deleteRequest);
deleteCount++;
} catch (PermissionDeniedException e) {
System.out.println("Ignore PermissionDenied in case the product does not exist " + "at time of deletion.");
}
}
System.out.printf("%s products were deleted from %s%n", deleteCount, DEFAULT_CATALOG);
}
}
use of com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.Product in project narchy by automenta.
the class BooleanChallenge method event.
@Override
public void event(Class event, Object[] arguments) {
if (!(arguments[0] instanceof Task))
return;
Task answer = (Task) arguments[0];
if (!answer.isJudgment())
return;
if (answer.isInput()) {
// this is a repetition of something explicitly input
return;
}
// if (!started) {
// if (answer.getTerm().toString().equals(startChallenge)) {
// started = true;
// }
// else {
// return;
// }
// }
// for now, assume the qustion term is answer term
Term qterm = answer.getTerm();
if (answerProvided.contains(qterm)) {
return;
}
if (answer.getConfidence() < confThreshold)
return;
Term t = answer.getTerm();
if (t instanceof Inheritance) {
Term subj = ((Inheritance) t).getSubject();
Term pred = ((Inheritance) t).getPredicate();
if ((subj instanceof SetExt) && (((SetExt) subj).length() == 1))
subj = ((Compound) subj).term[0];
if (subj instanceof Product) {
Product p = (Product) subj;
int[] n = n(p, 3);
if (n != null) {
boolean correct = false;
switch(pred.toString()) {
case "and":
correct = evalAnd(n);
break;
case "or":
correct = evalOr(n);
break;
case "xor":
correct = evalXor(n);
break;
// case "not": correct = evalNot(n); break;
default:
return;
}
float freq = answer.getFrequency();
float conf = answer.getConfidence();
if (freq < freqThresh) {
// invert
correct = !correct;
freq = 1f - freq;
}
if (freq < (1.0 - freqThresh)) {
// not clear 0 or 1
return;
}
addScore(qterm, answer, correct, freq * conf);
if (!correct) {
System.err.println(answer.getExplanation());
if (failOnError)
System.exit(1);
// give correct answer
if (correctFeedback) {
// String c = getTerm(n[0], n[1], pred.toString(), not(n[2])) + ('.');
Term fc = nar.term(getTerm(n[0], n[1], pred.toString(), n[2]));
String c = "(--," + fc + ("). %1.00;" + n2(inputConf) + "%");
nar.input(c);
answerProvided.add(fc);
questionScores.remove(fc);
}
}
}
}
}
}
Aggregations