Skip to content

Commit 41b8473

Browse files
committed
Merge remote-tracking branch 'eugenp/master'
2 parents aae4c26 + e78ca7c commit 41b8473

267 files changed

Lines changed: 7602 additions & 713 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitmodules‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎algorithms/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@
2222
- [Displaying Money Amounts in Words](http://www.baeldung.com/java-money-into-words)
2323
- [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations)
2424
- [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum)
25+
- [Converting Between Roman and Arabic Numerals in Java](http://www.baeldung.com/java-convert-roman-arabic)
26+
- [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity)
27+
- [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element)

‎algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class MonteCarloTreeSearch {
1010

1111
private static final int WIN_SCORE = 10;
1212
private int level;
13-
private int oponent;
13+
private int opponent;
1414

1515
public MonteCarloTreeSearch() {
1616
this.level = 3;
@@ -32,11 +32,11 @@ public Board findNextMove(Board board, int playerNo) {
3232
long start = System.currentTimeMillis();
3333
long end = start + 60 * getMillisForCurrentLevel();
3434

35-
oponent = 3 - playerNo;
35+
opponent = 3 - playerNo;
3636
Tree tree = new Tree();
3737
Node rootNode = tree.getRoot();
3838
rootNode.getState().setBoard(board);
39-
rootNode.getState().setPlayerNo(oponent);
39+
rootNode.getState().setPlayerNo(opponent);
4040

4141
while (System.currentTimeMillis() < end) {
4242
// Phase 1 - Selection
@@ -93,7 +93,7 @@ private int simulateRandomPlayout(Node node) {
9393
State tempState = tempNode.getState();
9494
int boardStatus = tempState.getBoard().checkStatus();
9595

96-
if (boardStatus == oponent) {
96+
if (boardStatus == opponent) {
9797
tempNode.getParent().getState().setWinScore(Integer.MIN_VALUE);
9898
return boardStatus;
9999
}

‎antlr/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Relevant Articles:
2+
3+
- [Java with ANTLR](http://www.baeldung.com/java-antlr)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Transform: 'AWS::Serverless-2016-10-31'
3+
Description: Baeldung Serverless Application Model Example with Implicit API Definition
4+
Globals:
5+
Api:
6+
EndpointConfiguration: REGIONAL
7+
Name: "TestAPI"
8+
Resources:
9+
PersonTable:
10+
Type: AWS::Serverless::SimpleTable
11+
Properties:
12+
PrimaryKey:
13+
Name: id
14+
Type: Number
15+
TableName: Person
16+
StorePersonFunction:
17+
Type: AWS::Serverless::Function
18+
Properties:
19+
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleRequest
20+
Runtime: java8
21+
Timeout: 15
22+
MemorySize: 512
23+
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
24+
Policies:
25+
- DynamoDBCrudPolicy:
26+
TableName: !Ref PersonTable
27+
Environment:
28+
Variables:
29+
TABLE_NAME: !Ref PersonTable
30+
Events:
31+
StoreApi:
32+
Type: Api
33+
Properties:
34+
Path: /persons
35+
Method: PUT
36+
GetPersonByHTTPParamFunction:
37+
Type: AWS::Serverless::Function
38+
Properties:
39+
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleGetByParam
40+
Runtime: java8
41+
Timeout: 15
42+
MemorySize: 512
43+
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
44+
Policies:
45+
- DynamoDBReadPolicy:
46+
TableName: !Ref PersonTable
47+
Environment:
48+
Variables:
49+
TABLE_NAME: !Ref PersonTable
50+
Events:
51+
GetByPathApi:
52+
Type: Api
53+
Properties:
54+
Path: /persons/{id}
55+
Method: GET
56+
GetByQueryApi:
57+
Type: Api
58+
Properties:
59+
Path: /persons
60+
Method: GET
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Transform: 'AWS::Serverless-2016-10-31'
3+
Description: Baeldung Serverless Application Model Example with Inline Swagger API Definition
4+
Resources:
5+
PersonTable:
6+
Type: AWS::Serverless::SimpleTable
7+
Properties:
8+
PrimaryKey:
9+
Name: id
10+
Type: Number
11+
TableName: Person
12+
StorePersonFunction:
13+
Type: AWS::Serverless::Function
14+
Properties:
15+
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleRequest
16+
Runtime: java8
17+
Timeout: 15
18+
MemorySize: 512
19+
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
20+
Policies:
21+
- DynamoDBCrudPolicy:
22+
TableName: !Ref PersonTable
23+
Environment:
24+
Variables:
25+
TABLE_NAME: !Ref PersonTable
26+
Events:
27+
StoreApi:
28+
Type: Api
29+
Properties:
30+
Path: /persons
31+
Method: PUT
32+
RestApiId:
33+
Ref: MyApi
34+
GetPersonByHTTPParamFunction:
35+
Type: AWS::Serverless::Function
36+
Properties:
37+
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleGetByParam
38+
Runtime: java8
39+
Timeout: 15
40+
MemorySize: 512
41+
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
42+
Policies:
43+
- DynamoDBReadPolicy:
44+
TableName: !Ref PersonTable
45+
Environment:
46+
Variables:
47+
TABLE_NAME: !Ref PersonTable
48+
Events:
49+
GetByPathApi:
50+
Type: Api
51+
Properties:
52+
Path: /persons/{id}
53+
Method: GET
54+
RestApiId:
55+
Ref: MyApi
56+
GetByQueryApi:
57+
Type: Api
58+
Properties:
59+
Path: /persons
60+
Method: GET
61+
RestApiId:
62+
Ref: MyApi
63+
MyApi:
64+
Type: AWS::Serverless::Api
65+
Properties:
66+
StageName: test
67+
EndpointConfiguration: REGIONAL
68+
DefinitionBody:
69+
swagger: "2.0"
70+
info:
71+
title: "TestAPI"
72+
paths:
73+
/persons:
74+
get:
75+
parameters:
76+
- name: "id"
77+
in: "query"
78+
required: true
79+
type: "string"
80+
x-amazon-apigateway-request-validator: "Validate query string parameters and\
81+
\ headers"
82+
x-amazon-apigateway-integration:
83+
uri:
84+
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetPersonByHTTPParamFunction.Arn}/invocations
85+
responses: {}
86+
httpMethod: "POST"
87+
type: "aws_proxy"
88+
put:
89+
x-amazon-apigateway-integration:
90+
uri:
91+
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${StorePersonFunction.Arn}/invocations
92+
responses: {}
93+
httpMethod: "POST"
94+
type: "aws_proxy"
95+
/persons/{id}:
96+
get:
97+
parameters:
98+
- name: "id"
99+
in: "path"
100+
required: true
101+
type: "string"
102+
responses: {}
103+
x-amazon-apigateway-integration:
104+
uri:
105+
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetPersonByHTTPParamFunction.Arn}/invocations
106+
responses: {}
107+
httpMethod: "POST"
108+
type: "aws_proxy"
109+
x-amazon-apigateway-request-validators:
110+
Validate query string parameters and headers:
111+
validateRequestParameters: true
112+
validateRequestBody: false

0 commit comments

Comments
 (0)