Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deepcloudlabs committed Jul 20, 2022
1 parent 0ff15aa commit 48357b1
Show file tree
Hide file tree
Showing 34 changed files with 7,473 additions and 0 deletions.
10 changes: 10 additions & 0 deletions functional-programming-exercises/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions functional-programming-exercises/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>functional-programming-exercises</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
23 changes: 23 additions & 0 deletions functional-programming-exercises/src/com/example/dao/CityDao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.dao;

import java.util.List;

import com.example.domain.City;

/**
*
* @author Binnur Kurt ([email protected])
*/
public interface CityDao {
City findCityById(int id);

City removeCity(City city);

City addCity(City city);

City updateCity(City city);

List<City> findAllCities();

List<City> findCitiesByCountryCode(String countryCode);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.dao;

import java.util.List;
import java.util.Set;

import com.example.domain.Country;

/**
*
* @author Binnur Kurt ([email protected])
*/
public interface CountryDao {
Country findCountryByCode(String code);

Country removeCountry(Country country);

Country addCountry(Country country);

Country updateCountry(Country country);

List<Country> findAllCountries();

List<Country> findCountriesByContinent(String continent);

Set<String> getAllContinents();
}
4,801 changes: 4,801 additions & 0 deletions functional-programming-exercises/src/com/example/dao/InMemoryWorldDao.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.dao;

/**
*
* @author Binnur Kurt ([email protected])
*/
public interface WorldDao extends CountryDao,CityDao {

}
83 changes: 83 additions & 0 deletions functional-programming-exercises/src/com/example/domain/City.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.example.domain;

/**
*
* @author Binnur Kurt ([email protected])
*/
public class City {
private int id;
private String name;
private int population;
private String countryCode;

public City() {
}

public City(int id, String name, String countryCode, int population) {
this.id = id;
this.name = name;
this.population = population;
this.countryCode = countryCode;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getPopulation() {
return population;
}

public void setPopulation(int population) {
this.population = population;
}

public String getCountryCode() {
return countryCode;
}

public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
City other = (City) obj;
if (id != other.id)
return false;
return true;
}

@Override
public String toString() {
return "City [id=" + id + ", name=" + name + ", population="
+ population + ", countryCode=" + countryCode + "]";
};

}
128 changes: 128 additions & 0 deletions functional-programming-exercises/src/com/example/domain/Country.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package com.example.domain;

import java.util.ArrayList;
import java.util.List;

/**
*
* @author Binnur Kurt ([email protected])
*/
public class Country {
private String code;
private String name;
private String continent;
private double surfaceArea;
private int population;
private double gnp;
private int capital;
private List<City> cities;
{
cities = new ArrayList<>();
}

public Country() {
}

public Country(String code, String name, String continent, int population,
double surfaceArea, double gnp, int capital) {
this.code = code;
this.name = name;
this.continent = continent;
this.surfaceArea = surfaceArea;
this.population = population;
this.capital = capital;
this.gnp = gnp;
}

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getContinent() {
return continent;
}

public void setContinent(String continent) {
this.continent = continent;
}

public double getSurfaceArea() {
return surfaceArea;
}

public void setSurfaceArea(double surfaceArea) {
this.surfaceArea = surfaceArea;
}

public double getGnp() {
return gnp;
}

public void setGnp(double gnp) {
this.gnp = gnp;
}

public int getCapital() {
return capital;
}

public void setCapital(int capital) {
this.capital = capital;
}

public void setPopulation(int population) {
this.population = population;
}

public int getPopulation() {
return population;
}

public List<City> getCities() {
return cities;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((code == null) ? 0 : code.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Country other = (Country) obj;
if (code == null) {
if (other.code != null)
return false;
} else if (!code.equals(other.code))
return false;
return true;
}

@Override
public String toString() {
return "Country [ name=" + name + ", population="
+ population + "]";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.example.domain;

/**
*
* @author Binnur Kurt ([email protected])
*/
public class Director {
private int id;
private String name;
private String imdb;

public Director() {
}

public Director(int id, String name, String imdb) {
this.id = id;
this.name = name;
this.imdb = imdb;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getImdb() {
return imdb;
}

public void setImdb(String imdb) {
this.imdb = imdb;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Director other = (Director) obj;
if (id != other.id)
return false;
return true;
}

@Override
public String toString() {
return "Director [id=" + id + ", name=" + name + ", imdb=" + imdb + "]";
}

}
Loading

0 comments on commit 48357b1

Please sign in to comment.