Complete Refactor of File Directories

master
Hammy 4 years ago
parent 9ac119d054
commit 63e3f09a48

18
.gitignore vendored

@ -2,15 +2,17 @@
2018 - 2019/.DS_Store
Java Fundamentals/.DS_Store
Java Classes & Interfaces/.DS_Store
Learning Java.code-workspace
Personal/Test Driven Development/Hello World/.classpath
.vscode/settings.json
Personal/Test Driven Development/Hello World/.project
Personal/Test Driven Development/Hello World/pom.xml
Personal/Test Driven Development/Hello World/.settings/org.eclipse.core.resources.prefs
Personal/Test Driven Development/Hello World/.settings/org.eclipse.jdt.apt.core.prefs
Personal/Test Driven Development/Hello World/.settings/org.eclipse.jdt.core.prefs
Personal/Test Driven Development/Hello World/.settings/org.eclipse.m2e.core.prefs
/.idea/
/out/
/Java Streams/Java Streams.iml
/2018 - 2019/2018 - 2019.iml
/Design Patterns/Design Patterns.iml
/Java Classes & Interfaces/Java Classes & Interfaces.iml
/Java Collections/Java Collections.iml
/Learning-Java.iml
/Personal/Personal.iml
/Personal/src/tdd/helloworld/HelloWorld.iml
/Java Fundamentals/Java Fundamentals.iml
/Java Sets/Java Sets.iml
/Personal/src/tdd/helloworld/pom.xml

@ -1,3 +1,5 @@
package arrays;
import java.util.Scanner;
public class SimpleArrays {

@ -1,3 +1,5 @@
package conditionals;
import java.util.Scanner;
public class ConditionalStatements {

@ -1,3 +1,5 @@
package scanner;
import java.util.Scanner;
public class UsingScanner {

@ -1,3 +1,5 @@
package strings;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;

@ -0,0 +1,14 @@
package singleton;
public class Main {
public static void main(String[] args) {
// Illegal construct
// Compile Time Error: The constructor SingleObject() is not visible
// SingleObject object = new SingleObject();
SingleObject singleObject = SingleObject.getInstance();
singleObject.showMessage();
}
}

@ -0,0 +1,17 @@
package singleton;
public class SingleObject {
private static final SingleObject instance = new SingleObject();
private SingleObject() {
}
public static SingleObject getInstance() {
return instance;
}
public void showMessage() {
System.out.println("Hello World!");
}
}

@ -1,4 +1,4 @@
package src;
package interfaces.animals;
public class AnimalMain {
public static void main(String[] args) {

@ -1,4 +1,4 @@
package src;
package interfaces.animals;
public class Cat implements Animal {

@ -1,4 +1,4 @@
package src;
package interfaces.animals;
public class Cow implements Animal {

@ -1,4 +1,4 @@
package src;
package interfaces.animals;
public class Dog implements Animal {

@ -1,4 +1,4 @@
package src;
package interfaces.animals;
public class Horse implements Animal {

@ -1,4 +1,4 @@
package src;
package interfaces.counter;
public class ByFives implements Counter {

@ -1,4 +1,4 @@
package src;
package interfaces.counter;
public class ByFours implements Counter {

@ -1,4 +1,4 @@
package src;
package interfaces.counter;
public class ByOnes implements Counter {

@ -1,4 +1,4 @@
package src;
package interfaces.counter;
public class ByThrees implements Counter {

@ -1,4 +1,4 @@
package src;
package interfaces.counter;
public class ByTwos implements Counter {

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public class Adder extends CalculateBase implements MathProcessing {

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public abstract class CalculateBase {
private double leftVal;

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public class Divider extends CalculateBase {

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public class MathEquation {
private double leftVal;

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public enum MathOperation {
ADD, SUBTRACT, DIVIDE, MULTIPLY

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public class Multiplier extends CalculateBase {

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public class PowerOf implements MathProcessing {

@ -1,4 +1,4 @@
package src;
package pluralsite.calculatorengine;
public class Subtractor extends CalculateBase {

@ -1,7 +0,0 @@
package com.pluralsite.getorganised;
public class GetOrganised {
public static void main(String[] args) throws Exception {
System.out.println("I'm organised!");
}
}

@ -1,3 +1,5 @@
package calculatorengine;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

@ -1,3 +1,5 @@
package helloworld;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");

@ -1,3 +1,5 @@
package operatorprecedence;
public class OperatorPrecedence {
public static void main(String[] args) {

@ -0,0 +1,7 @@
package organised.com.pluralsite.getorganised;
public class GetOrganised {
public static void main(String[] args) {
System.out.println("I'm organised!");
}
}

@ -0,0 +1,28 @@
package common;
import java.util.Comparator;
public class Product {
private final String name;
private final int weight;
public Product(String name, int weight) {
this.name = name;
this.weight = weight;
}
public String getName() {
return name;
}
public int getWeight() {
return weight;
}
@Override
public String toString() {
return "Product{" + "name='" + name + '\'' + ", weight=" + weight + '}';
}
public static final Comparator<Product> BY_WEIGHT = Comparator.comparingInt(Product::getWeight);
}

@ -0,0 +1,26 @@
package common;
import java.util.ArrayList;
import java.util.List;
public class Supplier {
private final String name;
private final List<Product> products = new ArrayList<>();
public Supplier(String name) {
this.name = name;
}
public String getName() {
return name;
}
public List<Product> getProducts() {
return products;
}
@Override
public String toString() {
return "Supplier{" + "name='" + name + '\'' + ", products=" + products + '}';
}
}

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../../../:\Users\sgoud\JavaProjects\Learning-Java\Personal\Anagram\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="accountSettings">
<option name="activeRegion" value="us-east-1" />
<option name="recentlyUsedRegions">
<list>
<option value="us-east-1" />
</list>
</option>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" project-jdk-name="15" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Anagram.iml" filepath="$PROJECT_DIR$/Anagram.iml" />
</modules>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../../../:\Users\sgoud\JavaProjects\Learning-Java\Personal\Anagram\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="accountSettings">
<option name="activeRegion" value="us-east-1" />
<option name="recentlyUsedRegions">
<list>
<option value="us-east-1" />
</list>
</option>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" project-jdk-name="15" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Anagram.iml" filepath="$PROJECT_DIR$/Anagram.iml" />
</modules>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,8 +1,8 @@
package src;
package anagram;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class AnagramGenerator {

@ -1,3 +1,5 @@
package cards;
public class Card {
private String suit;

@ -1,3 +1,5 @@
package cards;
import java.util.List;
import java.util.Scanner;

@ -1,9 +1,11 @@
package cards;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public abstract class Deck {
private List<Card> deck = new ArrayList<Card>();
private final List<Card> deck = new ArrayList<Card>();
public Deck() {
for (Suits suit : Suits.values()) {
@ -14,7 +16,7 @@ public abstract class Deck {
public List<Player> dealCards(int numOfPlayers) {
int noOfCards = (deck.size() / numOfPlayers) + 1;
List<Player> allPlayers = new ArrayList<Player>();
List<Player> allPlayers = new ArrayList<>();
for (int i = 0; i < numOfPlayers; i++) {
Hand playerHand = new Hand();
@ -23,7 +25,7 @@ public abstract class Deck {
playerHand.addCard(indexCard);
dealACard(indexCard);
}
allPlayers.add(new Player("Player " + i, playerHand));
allPlayers.add(new Player(playerHand));
}
return allPlayers;
}

@ -1,3 +1,5 @@
package cards;
public enum Faces {
ACE(1), TWO(2), THREE(3), FOUR(4), FIVE(5), SIX(6), SEVEN(7), EIGHT(8), NINE(9), TEN(10), JACK(11), QUEEN(12),
KING(13);

@ -1,3 +1,5 @@
package cards;
import java.util.ArrayList;
import java.util.List;
@ -9,17 +11,17 @@ public class Hand {
@Override
public String toString() {
StringBuilder handofSuit = new StringBuilder();
StringBuilder handOfSuit = new StringBuilder();
handofSuit.append("[");
handOfSuit.append("[");
for (Card card : listOfCards) {
handofSuit.append(card.getFace() + ",");
handOfSuit.append(card.getFace()).append(",");
}
if (handofSuit.length() != 1)
handofSuit.deleteCharAt(handofSuit.length() - 1);
handofSuit.append("]");
if (handOfSuit.length() != 1)
handOfSuit.deleteCharAt(handOfSuit.length() - 1);
handOfSuit.append("]");
return handofSuit.toString();
return handOfSuit.toString();
}

@ -1,7 +1,9 @@
package cards;
public class Player {
private Hand hand;
public Player(String name, Hand hand) {
public Player(Hand hand) {
this.hand = hand;
}
@ -12,7 +14,7 @@ public class Player {
Card card = hand.getListOfCards().get(i);
if (i % 2 == 0) {
System.out.printf(tab + card.getFace() + " of " + card.getSuit());
System.out.print(tab + card.getFace() + " of " + card.getSuit());
} else {
System.out.println(tab + card.getFace() + " of " + card.getSuit());
}

@ -1,3 +1,5 @@
package cards;
import java.util.List;
import java.util.Scanner;
@ -20,7 +22,7 @@ public class Sevens extends Deck {
System.out.println("\nPlayer " + (playerCounter + 1) + "'s Deck:\n");
player.displayHand();
String[] userCardSplit = askPlayer(playerCounter, player, tableHand, in);
String[] userCardSplit = askPlayer(in);
if (userCardSplit.length != 0) {
validateCard(userCardSplit, player, tableHand);
@ -34,7 +36,7 @@ public class Sevens extends Deck {
tableHand.display("Winning Deck:");
}
public String[] askPlayer(int playerCounter, Player player, TableHand tableHand, Scanner in) {
public String[] askPlayer(Scanner in) {
System.out.println("\nEnter In The Card That You Want To Play: \nPress S To Skip");
String userCard = in.nextLine();
if (userCard.toLowerCase().charAt(0) == 's') {
@ -44,13 +46,13 @@ public class Sevens extends Deck {
String[] splitCard = userCard.split(" ");
if (splitCard.length == 2)
validatePlayerInput(splitCard, player, tableHand, in);
validatePlayerInput(splitCard, in);
return splitCard;
}
public void validatePlayerInput(String[] splitCard, Player player, TableHand tableHand, Scanner in) {
public void validatePlayerInput(String[] splitCard, Scanner in) {
try {
Integer.parseInt(splitCard[0]);
@ -71,7 +73,7 @@ public class Sevens extends Deck {
break;
}
}
if (validSuit == false) {
if (!validSuit) {
System.out.println("Card Suit Not Valid! Please Enter A Suitable Suit");
splitCard[1] = in.nextLine();
}
@ -102,7 +104,6 @@ public class Sevens extends Deck {
playACard(userSuitHand, cardToBePlayed, 0, player);
} else {
System.out.println("Card Played Was Not A Face of 7 in Empty Suit! Turn Skipped!");
return;
}
} else {
int minimumValueInUserSuitHand = userSuitHand.getListOfCards().get(0).getFace();
@ -114,8 +115,7 @@ public class Sevens extends Deck {
} else if (cardToBePlayed.getFace() == (maximumValueInUserSuitHand + 1)) {
playACard(userSuitHand, cardToBePlayed, sizeOfUserSuitHand, player);
} else {
System.out.println("Card Plyaed Was Not +1 or +1 Of Any Cards In The Suit! Turn Skipped!");
return;
System.out.println("Card Played Was Not +1 or +1 Of Any Cards In The Suit! Turn Skipped!");
}
}
}

@ -1,3 +1,5 @@
package cards;
public enum Suits {
SPADES("Spades"), HEARTS("Hearts"), DIAMONDS("Diamonds"), CLUBS("Clubs");

@ -1,9 +1,11 @@
package cards;
import java.util.EnumMap;
import java.util.Map.Entry;
public class TableHand extends Hand {
private EnumMap<Suits, Hand> sevensTableHand = new EnumMap<Suits, Hand>(Suits.class);
private EnumMap<Suits, Hand> sevensTableHand = new EnumMap<>(Suits.class);
public TableHand() {
for (Suits suit : Suits.values()) {

@ -1,3 +1,5 @@
package oop;
public class Coordinates {
private int x;
private int y;

@ -1,3 +1,5 @@
package oop;
public interface Equation {
void displayEquation();
}

@ -1,3 +1,5 @@
package oop;
public class Line implements Equation {
private double gradient;
private double intercept;

@ -1,3 +1,5 @@
package oop;
public class Main {
public static void main(String[] args) {
Coordinates coordinate1 = new Coordinates(4, 16);

@ -1,4 +1,4 @@
package main.java.hello.world;
package tdd.helloworld.src.main.java.hello.world;
public class Greeting {
String message;

@ -1,9 +1,10 @@
package test.java.hello.world;
package tdd.helloworld.src.test.java.hello.world;
import main.java.hello.world.Greeting;
import org.junit.Test;
import tdd.helloworld.src.main.java.hello.world.Greeting;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
/**
* Unit test for simple App.
@ -21,6 +22,6 @@ public class HelloWorldTest {
@Test
public void greetingMessageShouldFail() {
Greeting greeting = new Greeting("Not Hello World");
assertEquals("Hello World", greeting.getMessage());
assertNotEquals("Hello World", greeting.getMessage());
}
}
Loading…
Cancel
Save