Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] "Not enough comments" #607 patch #646

Draft
wants to merge 6 commits into
base: uinverse
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
// Constants.java
// Constants

// add this specific class (Constants) to the package named com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

/**
* Constants
*/
public class Constants {

// a public, static constant property of the class Constants defined on line 10 of type string called AN_ATTEMPT_WAS_MADE_TO_DIVIDE_BY_ZERO which contains the text "An attempt was made to divide by zero."
public static final String AN_ATTEMPT_WAS_MADE_TO_DIVIDE_BY_ZERO = "An attempt was made to divide by zero.";
// a public, static constant property of the class Constants defined on line 10 of type string called BUZZ which contains the text "Buzz"
public static final String BUZZ = "Buzz";
// a public, static constant property of the class Constants defined on line 10 of type string called COM_SERIOUSCOMPANY_BUSINESS_JAVA_FIZZBUZZ_PACKAGENAMINGPACKAGE_IMPL_PRINTERS_INTEGER_INTEGER_PRINTER_PRINT which contains the text "com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers.IntegerIntegerPrinter.print()"
public static final String COM_SERIOUSCOMPANY_BUSINESS_JAVA_FIZZBUZZ_PACKAGENAMINGPACKAGE_IMPL_PRINTERS_INTEGER_INTEGER_PRINTER_PRINT = "com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers.IntegerIntegerPrinter.print()";
// a public, static constant property of the class Constants defined on line 10 of type string called FIZZ which contains the text "Fizz"
public static final String FIZZ = "Fizz";
// a public, static constant property of the class Constants defined on line 10 of type string called LINE_SEPARATOR which contains the text "line.separator"
public static final String LINE_SEPARATOR = "line.separator";
// a public, static constant property of the class Constants defined on line 10 of type string called LOOP_COMPONENT_FACTORY which contains the text "loopComponentFactory"
public static final String LOOP_COMPONENT_FACTORY = "loopComponentFactory";
// a public, static constant property of the class Constants defined on line 10 of type string called SPRING_XML which contains the text "spring.xml"
public static final String SPRING_XML = "spring.xml";
// a public, static constant property of the class Constants defined on line 10 of type string called STANDARD_FIZZ_BUZZ which contains the text "standardFizzBuzz"
public static final String STANDARD_FIZZ_BUZZ = "standardFizzBuzz";
// a public, static constant property of the class Constants defined on line 10 of type string called THE_INTEGERS_COULD_NOT_BE_COMPARED which contains the text "The integers could not be compared."
public static final String THE_INTEGERS_COULD_NOT_BE_COMPARED = "The integers could not be compared.";
// a public, static constant property of the class Constants defined on line 10 of type int called DEFAULT_FIZZ_BUZZ_UPPER_LIMIT_PARAMETER_VALUE which contains the number 100
public static final int DEFAULT_FIZZ_BUZZ_UPPER_LIMIT_PARAMETER_VALUE = 100;
// a public, static constant property of the class Constants defined on line 10 of type int called INTEGER_DIVIDE_ZERO_VALUE which contains the number 0
public static final int INTEGER_DIVIDE_ZERO_VALUE = 0;
// a public, static constant property of the class Constants defined on line 10 of type int called INTEGER_ORIGIN_ZERO_VALUE which contains the number 0
public static final int INTEGER_ORIGIN_ZERO_VALUE = 0;
// a public, static constant property of the class Constants defined on line 10 of type int called LOOP_INC_VALUE which contains the number 1
public static final int LOOP_INC_VALUE = 1;
// a public, static constant property of the class Constants defined on line 10 of type int called LOOP_INIT_VALUE which contains the number 1
public static final int LOOP_INIT_VALUE = 1;

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// Main.java
// Main

// add this specific class (Main) to the package named com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

// import package org.springframework.context.ApplicationContext
// import package org.springframework.context.ConfigurableApplicationContext
// import package org.springframework.context.support.ClassPathXmlApplicationContext
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

// import package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.parameters.DefaultFizzBuzzUpperLimitParameter
// import package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz
// import package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.parameters.FizzBuzzUpperLimitParameter
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.parameters.DefaultFizzBuzzUpperLimitParameter;
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz;
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.parameters.FizzBuzzUpperLimitParameter;
Expand All @@ -14,16 +24,20 @@
public final class Main {

/**
* @param args
* the main function to the class Main declared in com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl; the starting point to the application
* @param args The command line arguments passed in from the command line, which are used to change the end effects of the program if used as a Command Line Interface, or CLI, tool. This is declared as `final`, which is a keyword used in Java to declare any variable as a constant, meaning that it cannot be changed after declaration. This specfic program does not use this argument, as this is just an Enterprise Quality(TM) FizzBuzz program which does not need any arguments passed in on execution, but other projects which are less Enterprise Quality(TM) have used it.
*/
public static void main(final String[] args) {
// create an object off of ClassPathXmlApplicationContent imported from org.springframework.context.support.ClassPathXmlApplicationContent on line 12 called context of type ApplicationContext, passing in Constants.SPRING_XML
final ApplicationContext context = new ClassPathXmlApplicationContext(Constants.SPRING_XML);
// create an object called myFizzBuzz of type FizzBuzz by calling method getBean from context declared on line 31 and passing in Contants.STANDARD_FIZZ_BUZZ
final FizzBuzz myFizzBuzz = (FizzBuzz) context.getBean(Constants.STANDARD_FIZZ_BUZZ);
// create an object of type FizzBuzzUpperLimitParamater imported from com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.parameters.FizzBuzzUpperLimitParameter on line 19, using class DefaultFizzBuzzUpperLimit imported from com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.parameters.DefaultFizzBuzzUpperLimitParameter on line 17
final FizzBuzzUpperLimitParameter fizzBuzzUpperLimit = new DefaultFizzBuzzUpperLimitParameter();
// call method fizzBuzz on constant myFizzBuzz declared on line 33
myFizzBuzz.fizzBuzz(fizzBuzzUpperLimit.obtainUpperLimitValue());

// call method close on context declared on line 31 casted to ConfigurableApplicationContext imported from org.springframework.context.ConfigurableApplicationContect on line 11
((ConfigurableApplicationContext) context).close();

}

}
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
// StandardFizzBuzz.java
// Standard FizzBuzz

// add this specific class (StandardFizzBuzz) to the package named com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

// import package org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Autowired;
// import package org.springframework.stereotype.Service
import org.springframework.stereotype.Service;

// import package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz;
// import package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.FizzBuzzSolutionStrategyFactory
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.FizzBuzzSolutionStrategyFactory;
// import package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy;

/**
* Standard FizzBuzz
*/
@Service
public class StandardFizzBuzz implements FizzBuzz {

// create a private contstant called _fizzBuzzSolutionStrategyFactory of type FizzBuzzSolutionStrategyFactory imported from com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.FizzBuzzSolutionStrategyFactory on line 15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, should read "constant"

private final FizzBuzzSolutionStrategyFactory _fizzBuzzSolutionStrategyFactory;

/**
* the constructor for the class StandardFizzBuzz declared on line 23
* @param _fizzBuzzSolutionStrategyFactory
*/
@Autowired
public StandardFizzBuzz(final FizzBuzzSolutionStrategyFactory _fizzBuzzSolutionStrategyFactory) {
// call the constructor of the class StandardFizzBuzz declared on line 13
super();
// set the value of the constant _fizzBuzzSolutionStrategyFactory, a property on the current object declared on line 25, to the value of _fizzBuzzSolutionStrategyFactory, the parameter to the constructor of StandardFizzBuzz declared on line 23, declared on line 32
this._fizzBuzzSolutionStrategyFactory = _fizzBuzzSolutionStrategyFactory;
}

/**
* the method fizzBuzz on the class StandardFizzBuzz declared on line 23
* @param nFizzBuzzUpperLimit
*/
public void fizzBuzz(final int nFizzBuzzUpperLimit) {
// a constant called mySolutionStrategy of type FizzBuzzSolutionStrategy imported from com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy on line 17, which is set to the return value of the method createFizzBuzzSolutionStrategy on the property _fizzBuzzSolutionStrategy of this object declared on line 25
final FizzBuzzSolutionStrategy mySolutionStrategy =
this._fizzBuzzSolutionStrategyFactory.createFizzBuzzSolutionStrategy();
// run the method runSolution on the object mySolutionStrategy declared on lines 45-46 of type FizzBuzzSolutionStrategy and pass in the parameter to this function called nFizzBuzzUpperLimit of type int
mySolutionStrategy.runSolution(nFizzBuzzUpperLimit);
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// FizzBuzz.java
// FizzBuzz

// add this specific interface (FizzBuzz) to the package named com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces;

/**
* FizzBuzz
*/
public interface FizzBuzz {

/**
* the signature for the constructor for the class FizzBuzz declared on line 10
* @param nFizzBuzzUpperLimit
*/
void fizzBuzz(int nFizzBuzzUpperLimit);

}
Loading