From: Karsten K. <kar...@tu...> - 2013-05-27 06:52:36
|
Hi Jeroen, thanks for sending that through. A first empirical evaluation shows that indeed the plugin is loaded and at least some calculation is performed ;-) Best, Karsten On 25/05/2013 8:07 AM, Jeroen Lappenschaar wrote: > Hi, > > I hope you have found the previous code in good condition. > > In the attachment is the SH plugin you requested as a test. I know it > was not a requirement anymore, but I had the evening off and I liked > to show my good intentions. > > (The JAR is just the given java files in the right package) > > Jeroen > > > 2013/5/16 Jeroen Lappenschaar <lap...@gm... > <mailto:lap...@gm...>> > > Hi there fellow developers, > > I'm giving you hereby my answers to the Java Test that I got from > Till Schäfer. My answers to the SH test will follow since I'm > typing this from my vacation adress in not-yet-so-sunny Barcelona > on a Spanish keyboard. > > //Due to my vacation adress the following code is not compiled. > It's unfortunate but it might even give you some more insight ;) > > With kind regards, > Jeroen Lappenschaar > applying for the Google Summer of Code > > > ************ > *Java Tasks* > ************ > > *** Off Mean *** > Complete the following method, which calculates the mean for all > odd indices of the array. > > /** > * Returns the mean for all odd indices of the given array. > * Returns 0.0 if array size is 0. > */ > public float getOddMean(float[] numbers) { > if(numbers.length == 0) > return 0.0; > float mean = 0.0; > int j = 0; > for(int i = 1; i < numbers.length; i+=2){ > mean += numbers[i]; > j++; > } > return mean/j; > } > > > *** End Contracts *** > Complete the following method of the class 'Division'. It should > remove all employees, which contract ends before the the given > date and return them as list. > > /** > * Removes all employees which contract ends before the given date > and returns these employees > */ > public List<Employee> endContracts(Date date) { > List<Employee> removed = new ArrayList<Employee>(); > for(Employee employee : employees) > if(employee.getEndOfContract().before(date)) { > removed.add(employee); > employees.remove(employee); //this uses the hash method described > below > } > return removed; > } > > > *** Protect Employees *** > The method 'getEmployees' allows to manipulate the content of the > private attribute 'employees'. Modify the method 'getEmployees' in > such a way that this is not possible anymore. > > /** > * Returns an *unmoditiable* list of employees > */ > public List<Employee> getEmployees() { > return Collections.unmodifiableList(employees); > } > > *** Change monthlyWage *** > Add a method to modify the monthly wage of an employee. Make sure > that the class 'Division' is the only class with access to this > method. Note that 'Division' is the only other class in the > package of the class 'Employee'. > > //package private > void setMonthlyWage(int newWage) { > montlyWage = newWage; > } > > > *** Equal Employees *** > Provide a standard way to check the equality of two employees. Two > employees should be equal iff the personnelNumber is equal. > > public boolean equals(Object object) { > if(! object instanceof Employee) > return false; > Employee employee = (Employee) object; > return employee.getPersonnelNumber() == personnelNumber(); > } > > //together with equals we also change the hashcode function > public int hashCode() { > return personnelNumber; > } > > *** Generics *** > Change the class node in such a way that it can store a content of > arbitrary type. Make sure that the all nodes in a connected tree > can only have the same content type. > > public class Node<E> { > > private Node<E> parent; > private List<Node<E>> children; > private E content; > > public Node(E content) { > this.children = new ArrayList<Node<E>>(); > this.content = content; > } > > public void addChild(Node<E> newChild) { > newChild.parent = this; > children.add(newChild); > } > > public E getContent() { > return content; > } > } > > > > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may > > > _______________________________________________ > Scaffoldhunter-devel mailing list > Sca...@li... > https://lists.sourceforge.net/lists/listinfo/scaffoldhunter-devel |