code
stringlengths
3
1.18M
language
stringclasses
1 value
/* * Copyright 2013 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2013 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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 t...
Java
/* * Copyright 2013 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/** * Copyright 2012 Google * * 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 w...
Java
/* * Copyright 2013 Google Inc. * * 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 w...
Java
/* * Copyright 2013 Google Inc. * * 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 w...
Java
/* * Copyright 2013 Google Inc. * * 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 w...
Java
/* * Copyright 2012 Google Inc. * * 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 w...
Java
/* * Copyright 2013 Google Inc. * * 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 w...
Java
/* * Copyright 2012 Google Inc. * * 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 w...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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...
Java
/* * Copyright 2012 Google Inc. * * 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 w...
Java
/* * Copyright 2012 Google Inc. * * 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 w...
Java
/* * Copyright 2013 Google Inc. * * 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 w...
Java
/* * Copyright 2012 Google Inc. * * 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 w...
Java
/* * Copyright 2012 Google Inc. * * 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 w...
Java
package animationEngine; /** * The Class AnimationState, this class holds all the necessary information for a single frame * of an animation. These states are loaded into an array for each algorithm after the input * frame is closed. * * This array of states is then used when stepping through the animat...
Java
package animationEngine; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * AnimatingStringSearch * Team.java * Purpose: Creates a form which displays the team members and the supervisor * of the project. It simply closes by clicking the ok button. * * @author Andrei Palade * @au...
Java
package animationEngine; import java.awt.Component; import java.awt.Image; import java.io.File; import javax.imageio.ImageIO; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swi...
Java
package animationEngine; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JInternalFrame; import javax.swing.JPanel; /** * The Class StringBoxDisplay, this class represents the string view display which displays * the string and pattern at a set size, which may then only mean sho...
Java
package animationEngine; import java.awt.Color; import java.io.FileNotFoundException; import java.util.ArrayList; import javax.swing.BoxLayout; import javax.swing.JInternalFrame; import javax.swing.JLabel; /** * The Class PseudoCodeFrame, this class represents the Frame containing the Pseudo Code for * the algorith...
Java
package animationEngine; import java.awt.Dimension; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import algorithms.BoyerMooreTestAlgorithm; import algorithms.KMPTestAlgorithm; @SuppressWarnings("serial") /** * BorderTable is used to represent the window of extra...
Java
package animationEngine; import java.awt.Color; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEv...
Java
package animationEngine; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JInternalFrame; import javax.swing.JPanel; /** * The Class FullStringBoxDisplay, this class represents the full view display which displays * the enti...
Java
package animationEngine; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * AnimatingStringSearch * Team.java * Purpose: Creates a form which displays the team members and the supervisor * of the project. It simply closes by clicking the ok button * * @author Andrei Palade * @aut...
Java
package animationEngine; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Random; import javax.swing.JFrame; import javax.swing.JOptionPane; import utils.Globals; /** * The InputFrame class repre...
Java
package animationEngine; import java.awt.Color; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; /** * The StringBox class is used to represent the pattern and text Strings on screen to the user * * This class handles vario...
Java
import java.io.FileNotFoundException; import animationEngine.InputFrame; import animationEngine.MainFrame; /** * The Class Main. This is where the program is run from and interactions between the windows. * * @author Andrei Palade * @author David McBrierty * @author Garry Sharp * @author Hristo Georgiev * @au...
Java
package utils; import java.awt.Font; /** * This class holds all the global variables required by the projects classes. * Any changes made will be reflected by the appropriate classes. * * @author Andrei Palade * @author David McBrierty * @author Garry Sharp * @author Hristo Georgiev * @author John Dennis * ...
Java
package algorithms; import java.util.ArrayList; import animationEngine.AnimationState; /** * This interface describes all the methods implemented by the search algorithms. If you are * adding in another algorithm it must implement this interface. * * @author Andrei Palade * @author David McBrierty * @author G...
Java
package algorithms; import java.util.ArrayList; import algorithms.Algorithm; import animationEngine.AnimationState; /** * The Class KMPTestAlgorithm, this class creates all of the animation states required * to animate the Knuth Morris Pratt Algorithm. * * @author Andrei Palade * @author David McBrierty * @aut...
Java
package algorithms; import java.util.ArrayList; import algorithms.Algorithm; import animationEngine.AnimationState; /** * The Class BoyerMooreTestAlgorithm, this class creates all of the animation states required * to animate the Boyer Moore Algorithm. * * @author Andrei Palade * @author David McBrierty * @aut...
Java
package org.futuremifos; public class Example { public void someMethod() { } public Integer interfaceDiscovery() { return Integer.valueOf(1); } }
Java
package solutions; public class Euler008 { /* Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 125406987471585238630507156...
Java
package solutions; /* By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: ...
Java
package solutions; /* ================================================================================================================= n! means n × (n − 1) × ... × 3 × 2 × 1 For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. ...
Java
package solutions; public class Euler002 { /** * @param args */ public static void main(String[] args) { long result = 2; long a = 1, b = 2; long aux; while(b < 4000000){ if(a%2 ==1 && b%2 ==1){ result += (a + b); } aux = a + b; a = b; b = aux; } System.out.prin...
Java
package solutions; /* By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? */ public class Euler007 { /** * @param args */ public static void main(String[] args) { long number = 1, count = 1; while(count < 10001){ ...
Java
package solutions; public class Euler010 { /** * @param args */ public static void main(String[] args) { int[] sieve = new int[2000000]; long result = 0; for(int pos = 2; pos < 2000000; pos++){ if(sieve[pos] == 0) result += pos; for(int j = 2*pos; j < sieve.length; j = j + pos){ sie...
Java
package solutions; /* You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or s...
Java
package solutions; /* 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? */ public class Euler016 { /** * @param args */ public static void main(String[] args) { final int DIGITS = 302; final int EXPONENT = 1000; ...
Java
package solutions; /* ================================================================================================================= Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair ...
Java
package solutions; /* The following iterative sequence is defined for the set of positive integers: n -> n/2 (n is even) n -> 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 It can be seen that this seque...
Java
package solutions; /* If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or h...
Java
package solutions; /* The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is...
Java
package solutions; import java.math.BigInteger; public class Euler013 { /* Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 743249861995247410594742333095130581237266...
Java
package solutions; class Euler005 { public static void main(String[] args){ /* 2 3 4 5..13...17 18 19 * 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 */ int[][] matrix = new int[8][18]; int[] factors = new int[]{2, 3, 5, 7, 11, 13, 17, 19}; ...
Java
package solutions; import java.util.HashMap; import java.util.Map; /* Starting in the top left corner of a 2x2 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 20x20 grid? Answer: 137846528820 */ public class Euler015 { privat...
Java
package cloud.forms; import java.util.regex.Matcher; import java.util.regex.Pattern; public class DateValidator{ private Pattern pattern; private Matcher matcher; private static final String DATE_PATTERN = "(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d)"; public DateValidator(){ ...
Java
package cloud.forms; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import cloud.beans.Person; import cloud.beans.Staff; import cloud.dao.StaffDao; public final class StaffForm extends Form{ private static final String CHAMP_...
Java
package cloud.forms; import java.util.List; import javax.servlet.http.HttpServletRequest; import cloud.beans.Person; import cloud.dao.PersonDao; public final class PersonForm extends Form{ private static final String CHAMP_FIRSTNAME = "firstName"; private static final String CHAMP_LASTNAME = "lastNam...
Java
package cloud.forms; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; public class Form { protected String resultat; protected Map<String, String> erreurs; public Form() { erreurs = new HashMap<String, String>(); } public String getResul...
Java
package cloud.forms; @SuppressWarnings("serial") public class FormValidationException extends Exception { /* * Constructeur */ public FormValidationException( String message ) { super( message ); } }
Java
package cloud.forms; import java.sql.Timestamp; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import cloud.beans.Review; import cloud.dao.ReviewDao; public final class ReviewForm extends Form{ private static final String CHAMP_USERNAME = "userName"; pri...
Java
package cloud.forms; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import cloud.beans.Anime; import cloud.dao.AnimeDao; public final class AnimeForm extends Form{ private static final String CHAMP_NAME = "name"; private sta...
Java
package cloud.beans; import java.io.Serializable; public class Person implements Serializable { private long id; private String firstName; private String lastName; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getFirstName() { ...
Java
package cloud.beans; import java.io.Serializable; import java.sql.Timestamp; import java.util.Date; public class Review implements Serializable { private long id; private String userName; private int score; private String review; private Date date; private long anime_id; public long getId() ...
Java
package cloud.beans; import java.io.Serializable; public class Staff implements Serializable { private long anime_id; private long person_id; private String role; public String getRole() { return role; } public void setRole(String role) { this.role = role; } public long getAni...
Java
package cloud.beans; import java.io.Serializable; public class Anime implements Serializable { private long id; private String name; private String synopsis; private String pathImg; public String getName() { return name; } public void setName(String name) { this.name = name; } ...
Java
package cloud.servlets; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Anime; import cloud.forms.AnimeForm; p...
Java
package cloud.servlets; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Person; import cloud.forms.PersonForm; ...
Java
package cloud.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Review; import cloud.forms.ReviewForm; public class CreateRevi...
Java
package cloud.servlets; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Anime; impor...
Java
package cloud.servlets; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Person; import cloud.beans.Staff; import...
Java
package cloud.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Person; import cloud.forms.PersonForm; public class CreatePers...
Java
package cloud.servlets; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Anime; import cloud.forms.AnimeForm; p...
Java
package cloud.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Properties; import javax.mail.Message; import javax.mail.Messagi...
Java
package cloud.servlets; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cloud.beans.Anime; impor...
Java
package cloud.dao; import cloud.beans.Anime; import cloud.beans.Person; import cloud.config.CacheController; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; ...
Java
package cloud.dao; import cloud.beans.Anime; import cloud.config.CacheController; import com.google.appengine.api.datastore.*; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * Classe implémentant l'interface UtilisateurDao @see {@link AnimeDao} * @author Alexis J...
Java
package cloud.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api....
Java
package cloud.dao; import cloud.beans.Anime; import cloud.beans.Review; import cloud.config.CacheController; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Array...
Java
package cloud.dao; /** * Classe qui permet la gestion de générer des erreurs selon la configuration DAO en place. * @author Alexis JULIEN & R&eacute;mi OGNARD pour TERCA * @version 1.0 */ public class DAOConfigurationException extends RuntimeException { /** * */ private static final long serial...
Java
package cloud.dao; /** * Classe qui permet la gestion de générer des erreurs selon la DAO en place. * @author Alexis JULIEN & R&eacute;mi OGNARD pour TERCA * @version 1.0 */ public class DAOException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; /* * ...
Java
package cloud.config; import java.util.HashMap; import java.util.Map; import com.google.appengine.api.memcache.jsr107cache.GCacheFactory; import net.sf.jsr107cache.Cache; import net.sf.jsr107cache.CacheException; import net.sf.jsr107cache.CacheFactory; import net.sf.jsr107cache.CacheManager; import net.sf...
Java
package cloud.config; import java.io.IOException; import java.util.logging.Logger; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import com...
Java
package animals; public class Dog extends Mammals { public void walk(){ chaseCats(); playWithOwner(); bark(); } public void say(){ bark(); } public void say(int i){ for (int j = 1; j <=i; j++) { bark(); } } private void chaseCats(){ System.out.println(this.getName()+" is chasing a cat");...
Java
package animals; abstract class Mammals extends Animals { public void sleep() { lay(); closeEyes(); System.out.println(this.getName()+" is sleeping as a mammal animal now - zZzZzZz"); } abstract void say(); abstract void walk(); private void lay(){ System.out.println(this.getName()+" laid"); } priva...
Java
package animals; public class Fish extends Animals { @Override public void sleep() { System.out.println(this.getName()+" is sleeping quietly as a fish now."); } public void swim(){ System.out.println(this.getName()+" is swimming."); } }
Java
package animals; public class Cat extends Mammals { public Cat() { } public void say(){ meow(); } public void say(int i){ for (int j = 1; j <=i; j++) { meow(); } } public void walk(){ System.out.println(this.getName()+" goes for a walk:"); catchMice(); sharpenClows(); climbTrees(); } pri...
Java
package animals; abstract class Animals { private String name; private String color; public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getName() { if (name != null) { return name; } else { return "Noname animal"; } } public ...
Java
package animalDays; import animals.Dog; public class DogDay { public static void main(String args[]){ Dog dog=new Dog(); dog.setName("Barbos"); dog.setColor("gray"); dog.tellAboutIt(); dog.say(); dog.walk(); dog.eat(); dog.sleep(); } }
Java
package animalDays; import animals.Cat; public class CatDay { public static void main(String args[]){ Cat cat=new Cat(); cat.setName("Murzik"); cat.setColor("black"); cat.tellAboutIt(); cat.walk(); cat.say(5); cat.eat(); cat.sleep(); } }
Java
package animalDays; import animals.Fish; public class FishDay { public static void main(String args[]){ Fish fish=new Fish(); fish.setName("Flaunder"); fish.tellAboutIt(); fish.eat(); fish.swim(); fish.sleep(); } }
Java
/* * Copyright (c) 2010 Google Inc. * * 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 ...
Java
/* * Copyright (c) 2010 Google Inc. * * 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 ...
Java
/* * Copyright (c) 2010 Google Inc. * * 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 ...
Java
/* * Copyright (c) 2010 Google Inc. * * 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 ...
Java