@ -8,7 +8,7 @@ import java.sql.Statement;
public class Games {
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb" ;
public boolean checkConnection ( ) {
try {
Connection connection = DriverManager . getConnection ( databaseURL ) ;
@ -20,7 +20,7 @@ public class Games {
return false ;
}
}
public String checkConsoles ( ) {
String result = "" ;
String query = "SELECT Game_Console FROM Games" ;
@ -35,32 +35,30 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
String gameConsole = resultSet . getString ( "Game_Console" ) ;
if ( ninSwitch & & gameConsole . equals ( "Nintendo Switch" ) ) {
continue ;
} else if ( xbox & & gameConsole . equals ( "Xbox" ) ) {
continue ;
} else if ( multiplat & & gameConsole . equals ( "Multiplatform" ) ) {
continue ;
}
switch ( gameConsole ) {
case "Nintendo Switch" :
ninSwitch = true ;
break ;
case "Xbox" :
xbox = true ;
break ;
case "Multiplatform" :
multiplat = true ;
break ;
}
result + = gameConsole + ", " ;
String gameConsole = resultSet . getString ( "Game_Console" ) ;
if ( ninSwitch & & gameConsole . equals ( "Nintendo Switch" ) ) {
continue ;
} else if ( xbox & & gameConsole . equals ( "Xbox" ) ) {
continue ;
} else if ( multiplat & & gameConsole . equals ( "Multiplatform" ) ) {
continue ;
}
switch ( gameConsole ) {
case "Nintendo Switch" :
ninSwitch = true ;
break ;
case "Xbox" :
xbox = true ;
break ;
case "Multiplatform" :
multiplat = true ;
break ;
}
result + = gameConsole + ", " ;
}
statement . close ( ) ;
connection . close ( ) ;
@ -68,10 +66,10 @@ public class Games {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
public String checkAllSamePublishers ( ) {
String result = "" ;
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
@ -83,17 +81,16 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
String gameName = resultSet . getString ( "Game_Name" ) ;
String gamePublisherEu = resultSet . getString ( "Game_Publisher_EU" ) ;
String gamePublisherJp = resultSet . getString ( "Game_Publisher_JP" ) ;
String gamePublisherNa = resultSet . getString ( "Game_Publisher_NA" ) ;
if ( gamePublisherEu . equals ( gamePublisherJp ) & & gamePublisherJp . equals ( gamePublisherNa ) & & gamePublisherEu . equals ( gamePublisherNa ) ) {
result + = gameName + ", " ;
}
String gameName = resultSet . getString ( "Game_Name" ) ;
String gamePublisherEu = resultSet . getString ( "Game_Publisher_EU" ) ;
String gamePublisherJp = resultSet . getString ( "Game_Publisher_JP" ) ;
String gamePublisherNa = resultSet . getString ( "Game_Publisher_NA" ) ;
if ( gamePublisherEu . equals ( gamePublisherJp ) & & gamePublisherJp . equals ( gamePublisherNa )
& & gamePublisherEu . equals ( gamePublisherNa ) ) {
result + = gameName + ", " ;
}
}
statement . close ( ) ;
connection . close ( ) ;
@ -101,10 +98,10 @@ public class Games {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
public String checkAllDifferentPublishers ( ) {
String result = "" ;
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
@ -116,17 +113,16 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
String gameName = resultSet . getString ( "Game_Name" ) ;
String gamePublisherEu = resultSet . getString ( "Game_Publisher_EU" ) ;
String gamePublisherJp = resultSet . getString ( "Game_Publisher_JP" ) ;
String gamePublisherNa = resultSet . getString ( "Game_Publisher_NA" ) ;
if ( ! gamePublisherEu . equals ( gamePublisherJp ) & & ! gamePublisherJp . equals ( gamePublisherNa ) & & ! gamePublisherEu . equals ( gamePublisherNa ) ) {
result + = gameName + ", " ;
}
String gameName = resultSet . getString ( "Game_Name" ) ;
String gamePublisherEu = resultSet . getString ( "Game_Publisher_EU" ) ;
String gamePublisherJp = resultSet . getString ( "Game_Publisher_JP" ) ;
String gamePublisherNa = resultSet . getString ( "Game_Publisher_NA" ) ;
if ( ! gamePublisherEu . equals ( gamePublisherJp ) & & ! gamePublisherJp . equals ( gamePublisherNa )
& & ! gamePublisherEu . equals ( gamePublisherNa ) ) {
result + = gameName + ", " ;
}
}
statement . close ( ) ;
connection . close ( ) ;
@ -134,10 +130,10 @@ public class Games {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
public String checkAllDifferentPublishersDeveloper ( ) {
String result = "" ;
String query = "SELECT Game_Name, Game_Developer, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
@ -149,18 +145,18 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
String gameName = resultSet . getString ( "Game_Name" ) ;
String gameDeveloper = resultSet . getString ( "Game_Developer" ) ;
String gamePublisherEu = resultSet . getString ( "Game_Publisher_EU" ) ;
String gamePublisherJp = resultSet . getString ( "Game_Publisher_JP" ) ;
String gamePublisherNa = resultSet . getString ( "Game_Publisher_NA" ) ;
if ( gamePublisherEu . equals ( gamePublisherJp ) & & gamePublisherJp . equals ( gamePublisherNa ) & & gamePublisherEu . equals ( gamePublisherNa ) & & gameDeveloper . equals ( gamePublisherEu ) & & gameDeveloper . equals ( gamePublisherJp ) & & gameDeveloper . equals ( gamePublisherNa ) ) {
result + = gameName + ", " ;
}
String gameName = resultSet . getString ( "Game_Name" ) ;
String gameDeveloper = resultSet . getString ( "Game_Developer" ) ;
String gamePublisherEu = resultSet . getString ( "Game_Publisher_EU" ) ;
String gamePublisherJp = resultSet . getString ( "Game_Publisher_JP" ) ;
String gamePublisherNa = resultSet . getString ( "Game_Publisher_NA" ) ;
if ( gamePublisherEu . equals ( gamePublisherJp ) & & gamePublisherJp . equals ( gamePublisherNa )
& & gamePublisherEu . equals ( gamePublisherNa ) & & gameDeveloper . equals ( gamePublisherEu )
& & gameDeveloper . equals ( gamePublisherJp ) & & gameDeveloper . equals ( gamePublisherNa ) ) {
result + = gameName + ", " ;
}
}
statement . close ( ) ;
connection . close ( ) ;
@ -168,10 +164,10 @@ public class Games {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
public String checkAllSameReleaseDates ( ) {
String result = "" ;
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games" ;
@ -183,24 +179,25 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
String gameName = resultSet . getString ( "Game_Name" ) ;
String gameReleaseEu = resultSet . getString ( "Game_Release_EU" ) ;
String gameReleaseJp = resultSet . getString ( "Game_Release_JP" ) ;
String gameReleaseNa = resultSet . getString ( "Game_Release_NA" ) ;
String gameReleaseAu = resultSet . getString ( "Game_Release_AU" ) ;
if ( gameReleaseAu = = null ) {
if ( gameReleaseEu . equals ( gameReleaseJp ) & & gameReleaseJp . equals ( gameReleaseNa ) & & gameReleaseEu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
} else {
if ( gameReleaseEu . equals ( gameReleaseJp ) & & gameReleaseJp . equals ( gameReleaseNa ) & & gameReleaseEu . equals ( gameReleaseNa ) & & gameReleaseAu . equals ( gameReleaseEu ) & & gameReleaseAu . equals ( gameReleaseJp ) & & gameReleaseAu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
String gameName = resultSet . getString ( "Game_Name" ) ;
String gameReleaseEu = resultSet . getString ( "Game_Release_EU" ) ;
String gameReleaseJp = resultSet . getString ( "Game_Release_JP" ) ;
String gameReleaseNa = resultSet . getString ( "Game_Release_NA" ) ;
String gameReleaseAu = resultSet . getString ( "Game_Release_AU" ) ;
if ( gameReleaseAu = = null ) {
if ( gameReleaseEu . equals ( gameReleaseJp ) & & gameReleaseJp . equals ( gameReleaseNa )
& & gameReleaseEu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
} else {
if ( gameReleaseEu . equals ( gameReleaseJp ) & & gameReleaseJp . equals ( gameReleaseNa )
& & gameReleaseEu . equals ( gameReleaseNa ) & & gameReleaseAu . equals ( gameReleaseEu )
& & gameReleaseAu . equals ( gameReleaseJp ) & & gameReleaseAu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
}
}
statement . close ( ) ;
connection . close ( ) ;
@ -208,10 +205,10 @@ public class Games {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
public String checkAllDifferentReleaseDates ( ) {
String result = "" ;
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games" ;
@ -223,24 +220,25 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
String gameName = resultSet . getString ( "Game_Name" ) ;
String gameReleaseEu = resultSet . getString ( "Game_Release_EU" ) ;
String gameReleaseJp = resultSet . getString ( "Game_Release_JP" ) ;
String gameReleaseNa = resultSet . getString ( "Game_Release_NA" ) ;
String gameReleaseAu = resultSet . getString ( "Game_Release_AU" ) ;
if ( gameReleaseAu = = null ) {
if ( ! gameReleaseEu . equals ( gameReleaseJp ) & & ! gameReleaseJp . equals ( gameReleaseNa ) & & ! gameReleaseEu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
} else {
if ( ! gameReleaseEu . equals ( gameReleaseJp ) & & ! gameReleaseJp . equals ( gameReleaseNa ) & & ! gameReleaseEu . equals ( gameReleaseNa ) & & ! gameReleaseAu . equals ( gameReleaseEu ) & & ! gameReleaseAu . equals ( gameReleaseJp ) & & ! gameReleaseAu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
String gameName = resultSet . getString ( "Game_Name" ) ;
String gameReleaseEu = resultSet . getString ( "Game_Release_EU" ) ;
String gameReleaseJp = resultSet . getString ( "Game_Release_JP" ) ;
String gameReleaseNa = resultSet . getString ( "Game_Release_NA" ) ;
String gameReleaseAu = resultSet . getString ( "Game_Release_AU" ) ;
if ( gameReleaseAu = = null ) {
if ( ! gameReleaseEu . equals ( gameReleaseJp ) & & ! gameReleaseJp . equals ( gameReleaseNa )
& & ! gameReleaseEu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
} else {
if ( ! gameReleaseEu . equals ( gameReleaseJp ) & & ! gameReleaseJp . equals ( gameReleaseNa )
& & ! gameReleaseEu . equals ( gameReleaseNa ) & & ! gameReleaseAu . equals ( gameReleaseEu )
& & ! gameReleaseAu . equals ( gameReleaseJp ) & & ! gameReleaseAu . equals ( gameReleaseNa ) ) {
result + = gameName + ", " ;
}
}
}
statement . close ( ) ;
connection . close ( ) ;
@ -248,7 +246,7 @@ public class Games {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}