Search in sources :

Example 1 with Product

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("Овощи");
}
Also used : User(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.User) Category(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category) AutenticationImpl(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.service.Impl.AutenticationImpl) Product(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Product) Basket(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Basket) AuthenticationService(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.service.AuthenticationService)

Example 2 with Product

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);
}
Also used : Scanner(java.util.Scanner) Category(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Category) User(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.User) ArrayList(java.util.ArrayList) Product(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Product) Basket(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Basket)

Example 3 with Product

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));
}
Also used : TreeSet(java.util.TreeSet) Product(oop.JOOP46_Collections_Part01.Product)

Example 4 with 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);
    }
}
Also used : DeleteProductRequest(com.google.cloud.retail.v2.DeleteProductRequest) ListProductsRequest(com.google.cloud.retail.v2.ListProductsRequest) ProductServiceClient(com.google.cloud.retail.v2.ProductServiceClient) Product(com.google.cloud.retail.v2.Product) PermissionDeniedException(com.google.api.gax.rpc.PermissionDeniedException) ListProductsPagedResponse(com.google.cloud.retail.v2.ProductServiceClient.ListProductsPagedResponse)

Example 5 with Product

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);
                    }
                }
            }
        }
    }
}
Also used : Inheritance(nars.nal.nal1.Inheritance) SetExt(nars.nal.nal3.SetExt) Product(nars.nal.nal4.Product) Term(nars.term.Term)

Aggregations

Product (com.google.cloud.retail.v2.Product)20 Product (com.google.cloud.vision.v1.Product)10 SetupCleanup.deleteProduct (setup.SetupCleanup.deleteProduct)9 ProductServiceClient (com.google.cloud.retail.v2.ProductServiceClient)8 SetupCleanup.createProduct (setup.SetupCleanup.createProduct)6 ProductSearchClient (com.google.cloud.vision.v1.ProductSearchClient)5 Product (com.haulmont.cuba.testmodel.sales_1.Product)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 Test (org.junit.Test)4 Test (org.junit.jupiter.api.Test)4 NotFoundException (com.google.api.gax.rpc.NotFoundException)3 CreateProductRequest (com.google.cloud.retail.v2.CreateProductRequest)3 GetProductRequest (com.google.cloud.retail.v2.GetProductRequest)3 QueryRunner (com.haulmont.bali.db.QueryRunner)3 Id (com.haulmont.cuba.core.entity.contracts.Id)3 com.haulmont.cuba.core.global (com.haulmont.cuba.core.global)3 TestContainer (com.haulmont.cuba.testsupport.TestContainer)3 SvProduct (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)3 PrintStream (java.io.PrintStream)3 Before (org.junit.Before)3