Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Thu Nov 13 10:47:10 KST 2025
gradle.version=8.5
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Thu Nov 13 10:45:45 KST 2025
java.home=C\:\\Program Files\\Android\\Android Studio\\jbr
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions 11_code/creationalPatterns/AbstractFactoryExample/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions 11_code/creationalPatterns/AbstractFactoryExample/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run AbstractFactoryExample" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":abstractfactoryexample:run" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
application
}

group = "com.example"
version = "1.0-SNAPSHOT"

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.20")
testImplementation("junit:junit:4.13.2")
}

kotlin {
jvmToolchain(21)
}

application {
mainClass.set("com.example.abstractfactoryexample.ClientKt")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.abstractfactoryexample

fun main(args: Array<String>) {
val company = "Apple"
val phone: Phone
val tablet: Tablet
val laptop: Laptop

if (company == "Apple") {
phone = iPhone15()
tablet = iPad()
laptop = MacBook()
} else {
phone = GalaxyS23()
tablet = GalaxyTab()
laptop = GalaxyBook()
}

phone.call()
tablet.touch()
laptop.typing()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.abstractfactoryexample

class GalaxyBook : Laptop {
override fun typing() {
println("Typing Galaxy Book.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.abstractfactoryexample

class GalaxyS23 : Phone {
override fun call() {
println("Ring from Galaxy S23.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.abstractfactoryexample

class GalaxyTab : Tablet {
override fun touch() {
println("Touch Galaxy Tab.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.abstractfactoryexample

interface Laptop {
fun typing()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.abstractfactoryexample

class MacBook : Laptop {
override fun typing() {
println("Typing MacBook.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.abstractfactoryexample

interface Phone {
fun call()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.abstractfactoryexample

interface Tablet {
fun touch()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.abstractfactoryexample

class iPad : Tablet {
override fun touch() {
println("Touch iPad.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.abstractfactoryexample

class iPhone15 : Phone {
override fun call() {
println("Ring from iPhone 15.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

android {
namespace = "com.example.abstractfactoryexample"
compileSdk = 33

defaultConfig {
applicationId = "com.example.abstractfactoryexample"
minSdk = 28
targetSdk = 33
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.8.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.20")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.abstractfactoryexample;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.abstractfactoryexample", appContext.getPackageName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AbstractFactoryExample"
tools:targetApi="31" />

</manifest>
Loading