Skip to content

Commit 0a39bed

Browse files
authored
Merge branch 'iluwatar:master' into master
2 parents 6d83016 + adbddcb commit 0a39bed

File tree

34 files changed

+1247
-71
lines changed

34 files changed

+1247
-71
lines changed

Diff for: .all-contributorsrc

+72
Original file line numberDiff line numberDiff line change
@@ -3222,6 +3222,78 @@
32223222
"contributions": [
32233223
"translation"
32243224
]
3225+
},
3226+
{
3227+
"login": "LakshyaPunyani-01",
3228+
"name": "LakshyaPunyani-01",
3229+
"avatar_url": "https://avatars.githubusercontent.com/u/103628913?v=4",
3230+
"profile": "https://github.com/LakshyaPunyani-01",
3231+
"contributions": [
3232+
"code"
3233+
]
3234+
},
3235+
{
3236+
"login": "jasonjyu",
3237+
"name": "jasonjyu",
3238+
"avatar_url": "https://avatars.githubusercontent.com/u/10333076?v=4",
3239+
"profile": "https://github.com/jasonjyu",
3240+
"contributions": [
3241+
"code"
3242+
]
3243+
},
3244+
{
3245+
"login": "jeffmorrison",
3246+
"name": "jeffmorrison",
3247+
"avatar_url": "https://avatars.githubusercontent.com/u/26047158?v=4",
3248+
"profile": "https://github.com/jeffmorrison",
3249+
"contributions": [
3250+
"code"
3251+
]
3252+
},
3253+
{
3254+
"login": "dmgodoy",
3255+
"name": "David M.",
3256+
"avatar_url": "https://avatars.githubusercontent.com/u/10840681?v=4",
3257+
"profile": "https://github.com/dmgodoy",
3258+
"contributions": [
3259+
"code"
3260+
]
3261+
},
3262+
{
3263+
"login": "apophizzz",
3264+
"name": "Patrick Kleindienst",
3265+
"avatar_url": "https://avatars.githubusercontent.com/u/12052783?v=4",
3266+
"profile": "https://github.com/apophizzz",
3267+
"contributions": [
3268+
"code"
3269+
]
3270+
},
3271+
{
3272+
"login": "proceane",
3273+
"name": "Juyeon",
3274+
"avatar_url": "https://avatars.githubusercontent.com/u/62143949?v=4",
3275+
"profile": "https://github.com/proceane",
3276+
"contributions": [
3277+
"translation"
3278+
]
3279+
},
3280+
{
3281+
"login": "mammadyahyayev",
3282+
"name": "Mammad Yahyayev",
3283+
"avatar_url": "https://avatars.githubusercontent.com/u/66476643?v=4",
3284+
"profile": "https://mammadyahya.vercel.app",
3285+
"contributions": [
3286+
"doc"
3287+
]
3288+
},
3289+
{
3290+
"login": "SalmaAzeem",
3291+
"name": "Salma",
3292+
"avatar_url": "https://avatars.githubusercontent.com/u/121863224?v=4",
3293+
"profile": "https://github.com/SalmaAzeem",
3294+
"contributions": [
3295+
"code"
3296+
]
32253297
}
32263298
],
32273299
"contributorsPerLine": 6,

Diff for: README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
77
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
88
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
9-
[![All Contributors](https://img.shields.io/badge/all_contributors-353-orange.svg?style=flat-square)](#contributors-)
9+
[![All Contributors](https://img.shields.io/badge/all_contributors-361-orange.svg?style=flat-square)](#contributors-)
1010
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1111

1212
<br/>
@@ -530,6 +530,18 @@ This project is licensed under the terms of the MIT license.
530530
<td align="center" valign="top" width="16.66%"><a href="https://github.com/vvanghelle"><img src="https://avatars.githubusercontent.com/u/3204600?v=4?s=100" width="100px;" alt="Vincent Vanghelle"/><br /><sub><b>Vincent Vanghelle</b></sub></a><br /><a href="#translation-vvanghelle" title="Translation">🌍</a></td>
531531
<td align="center" valign="top" width="16.66%"><a href="https://github.com/antoheri"><img src="https://avatars.githubusercontent.com/u/79988396?v=4?s=100" width="100px;" alt="Antoine Héritier"/><br /><sub><b>Antoine Héritier</b></sub></a><br /><a href="#translation-antoheri" title="Translation">🌍</a></td>
532532
<td align="center" valign="top" width="16.66%"><a href="https://github.com/fishandsheep"><img src="https://avatars.githubusercontent.com/u/43347407?v=4?s=100" width="100px;" alt="QinShower"/><br /><sub><b>QinShower</b></sub></a><br /><a href="#translation-fishandsheep" title="Translation">🌍</a></td>
533+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/LakshyaPunyani-01"><img src="https://avatars.githubusercontent.com/u/103628913?v=4?s=100" width="100px;" alt="LakshyaPunyani-01"/><br /><sub><b>LakshyaPunyani-01</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=LakshyaPunyani-01" title="Code">💻</a></td>
534+
</tr>
535+
<tr>
536+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/jasonjyu"><img src="https://avatars.githubusercontent.com/u/10333076?v=4?s=100" width="100px;" alt="jasonjyu"/><br /><sub><b>jasonjyu</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=jasonjyu" title="Code">💻</a></td>
537+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/jeffmorrison"><img src="https://avatars.githubusercontent.com/u/26047158?v=4?s=100" width="100px;" alt="jeffmorrison"/><br /><sub><b>jeffmorrison</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=jeffmorrison" title="Code">💻</a></td>
538+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/dmgodoy"><img src="https://avatars.githubusercontent.com/u/10840681?v=4?s=100" width="100px;" alt="David M."/><br /><sub><b>David M.</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=dmgodoy" title="Code">💻</a></td>
539+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/apophizzz"><img src="https://avatars.githubusercontent.com/u/12052783?v=4?s=100" width="100px;" alt="Patrick Kleindienst"/><br /><sub><b>Patrick Kleindienst</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=apophizzz" title="Code">💻</a></td>
540+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/proceane"><img src="https://avatars.githubusercontent.com/u/62143949?v=4?s=100" width="100px;" alt="Juyeon"/><br /><sub><b>Juyeon</b></sub></a><br /><a href="#translation-proceane" title="Translation">🌍</a></td>
541+
<td align="center" valign="top" width="16.66%"><a href="https://mammadyahya.vercel.app"><img src="https://avatars.githubusercontent.com/u/66476643?v=4?s=100" width="100px;" alt="Mammad Yahyayev"/><br /><sub><b>Mammad Yahyayev</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=mammadyahyayev" title="Documentation">📖</a></td>
542+
</tr>
543+
<tr>
544+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/SalmaAzeem"><img src="https://avatars.githubusercontent.com/u/121863224?v=4?s=100" width="100px;" alt="Salma"/><br /><sub><b>Salma</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=SalmaAzeem" title="Code">💻</a></td>
533545
</tr>
534546
</tbody>
535547
</table>

Diff for: abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,16 @@ void shouldUpdateExistingValue() {
114114
final String originalValue = "originalValue";
115115
final String updatedValue = "updatedValue";
116116

117+
// Initializing the value
117118
document.put(key, originalValue);
118119

120+
// Verifying that the initial value is retrieved correctly
121+
assertEquals(originalValue, document.get(key));
122+
119123
// Updating the value
120124
document.put(key, updatedValue);
121125

122-
//Verifying that the updated value is retrieved correctly
126+
// Verifying that the updated value is retrieved correctly
123127
assertEquals(updatedValue, document.get(key));
124128
}
125129
}

Diff for: bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java

+36-35
Original file line numberDiff line numberDiff line change
@@ -67,59 +67,60 @@ public void execute(int[] bytecode) {
6767
for (var i = 0; i < bytecode.length; i++) {
6868
Instruction instruction = Instruction.getInstruction(bytecode[i]);
6969
switch (instruction) {
70-
case LITERAL:
71-
// Read the next byte from the bytecode.
70+
case LITERAL -> { // Read the next byte from the bytecode.
7271
int value = bytecode[++i];
7372
// Push the next value to stack
7473
stack.push(value);
75-
break;
76-
case SET_AGILITY:
74+
}
75+
case SET_AGILITY -> {
7776
var amount = stack.pop();
7877
var wizard = stack.pop();
7978
setAgility(wizard, amount);
80-
break;
81-
case SET_WISDOM:
82-
amount = stack.pop();
83-
wizard = stack.pop();
79+
}
80+
case SET_WISDOM -> {
81+
var amount = stack.pop();
82+
var wizard = stack.pop();
8483
setWisdom(wizard, amount);
85-
break;
86-
case SET_HEALTH:
87-
amount = stack.pop();
88-
wizard = stack.pop();
84+
}
85+
case SET_HEALTH -> {
86+
var amount = stack.pop();
87+
var wizard = stack.pop();
8988
setHealth(wizard, amount);
90-
break;
91-
case GET_HEALTH:
92-
wizard = stack.pop();
89+
}
90+
case GET_HEALTH -> {
91+
var wizard = stack.pop();
9392
stack.push(getHealth(wizard));
94-
break;
95-
case GET_AGILITY:
96-
wizard = stack.pop();
93+
}
94+
case GET_AGILITY -> {
95+
var wizard = stack.pop();
9796
stack.push(getAgility(wizard));
98-
break;
99-
case GET_WISDOM:
100-
wizard = stack.pop();
97+
}
98+
case GET_WISDOM -> {
99+
var wizard = stack.pop();
101100
stack.push(getWisdom(wizard));
102-
break;
103-
case ADD:
101+
}
102+
case ADD -> {
104103
var a = stack.pop();
105104
var b = stack.pop();
106105
stack.push(a + b);
107-
break;
108-
case DIVIDE:
109-
a = stack.pop();
110-
b = stack.pop();
106+
}
107+
case DIVIDE -> {
108+
var a = stack.pop();
109+
var b = stack.pop();
111110
stack.push(b / a);
112-
break;
113-
case PLAY_SOUND:
114-
wizard = stack.pop();
111+
}
112+
case PLAY_SOUND -> {
113+
var wizard = stack.pop();
115114
getWizards()[wizard].playSound();
116-
break;
117-
case SPAWN_PARTICLES:
118-
wizard = stack.pop();
115+
116+
}
117+
case SPAWN_PARTICLES -> {
118+
var wizard = stack.pop();
119119
getWizards()[wizard].spawnParticles();
120-
break;
121-
default:
120+
}
121+
default -> {
122122
throw new IllegalArgumentException("Invalid instruction value");
123+
}
123124
}
124125
LOGGER.info("Executed " + instruction.name() + ", Stack contains " + getStack());
125126
}

Diff for: composite-view/web/header.jsp

+20-1
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,30 @@
3939
h1 { text-align: center;}
4040
h2 { text-align: center;}
4141
h3 { text-align: center;}
42+
nav {
43+
text-align: center;
44+
margin-bottom: 20px;
45+
}
46+
.home-link {
47+
padding: 10px 20px;
48+
background-color: #007bff;
49+
color: white;
50+
text-decoration: none;
51+
border-radius: 5px;
52+
}
53+
.home-link:hover {
54+
background-color: #0056b3;
55+
}
4256
</style>
4357
</head>
4458
<body>
59+
<nav>
60+
<!-- Add a Home button that links back to the homepage -->
61+
<a href="/" class="home-link">Home</a>
62+
</nav>
63+
4564
<% String todayDateStr = (new Date().toString()); %>
4665
<h1>Today's Personalized Frontpage</h1>
47-
<h2><%=todayDateStr%></h2>
66+
<h2><%= todayDateStr %></h2>
4867
</body>
4968
</html>

Diff for: dynamic-proxy/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>com.fasterxml.jackson.core</groupId>
4040
<artifactId>jackson-core</artifactId>
41-
<version>2.17.2</version>
41+
<version>2.18.1</version>
4242
</dependency>
4343
<dependency>
4444
<groupId>com.fasterxml.jackson.core</groupId>

Diff for: event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingsHand.java

+2
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ public void onEvent(Event e) {
4343

4444
@Override
4545
public void timePasses(Weekday day) {
46+
// This method is intentionally left empty because KingsHand does not handle time-based events directly.
47+
// It serves as a placeholder to fulfill the EventObserver interface contract.
4648
}
4749
}

Diff for: event-sourcing/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>com.fasterxml.jackson.core</groupId>
4444
<artifactId>jackson-core</artifactId>
45-
<version>2.17.2</version>
45+
<version>2.18.1</version>
4646
</dependency>
4747
<dependency>
4848
<groupId>com.fasterxml.jackson.core</groupId>

Diff for: filterer/src/main/java/com/iluwatar/filterer/threat/ThreatAwareSystem.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/**
3131
* Represents system that is aware of threats that are present in it.
3232
*/
33-
public interface ThreatAwareSystem {
33+
public interface ThreatAwareSystem<T extends Threat> {
3434

3535
/**
3636
* Returns the system id.
@@ -43,13 +43,13 @@ public interface ThreatAwareSystem {
4343
* Returns list of threats for this system.
4444
* @return list of threats for this system.
4545
*/
46-
List<? extends Threat> threats();
46+
List<T> threats();
4747

4848
/**
4949
* Returns the instance of {@link Filterer} helper interface that allows to covariantly
5050
* specify lower bound for predicate that we want to filter by.
5151
* @return an instance of {@link Filterer} helper interface.
5252
*/
53-
Filterer<? extends ThreatAwareSystem, ? extends Threat> filtered();
53+
Filterer<ThreatAwareSystem<T>, T> filtered();
5454

5555
}

Diff for: game-loop/src/test/java/com/iluwatar/gameloop/GameLoopTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
*/
2525
package com.iluwatar.gameloop;
2626

27-
import static org.junit.jupiter.api.Assertions.assertFalse;
28-
2927
import org.junit.jupiter.api.AfterEach;
3028
import org.junit.jupiter.api.Assertions;
29+
import static org.junit.jupiter.api.Assertions.assertFalse;
3130
import org.junit.jupiter.api.BeforeEach;
3231
import org.junit.jupiter.api.Test;
3332

@@ -46,6 +45,7 @@ void setup() {
4645
gameLoop = new GameLoop() {
4746
@Override
4847
protected void processGameLoop() {
48+
throw new UnsupportedOperationException("Not supported yet.");
4949
}
5050
};
5151
}

Diff for: hexagonal-architecture/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<dependency>
4747
<groupId>de.flapdoodle.embed</groupId>
4848
<artifactId>de.flapdoodle.embed.mongo</artifactId>
49-
<version>4.17.0</version>
49+
<version>4.18.0</version>
5050
<scope>test</scope>
5151
</dependency>
5252
<dependency>

0 commit comments

Comments
 (0)