java book store application
ganghuan-bookstore/.checkstyle
ganghuan-bookstore/.classpath
ganghuan-bookstore/.fbprefs
#FindBugs User Preferences #Wed Sep 17 04:06:17 PDT 2014 cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true detectorAtomicityProblem=AtomicityProblem|true detectorBCPMethodReturnCheck=BCPMethodReturnCheck|false detectorBadAppletConstructor=BadAppletConstructor|false detectorBadResultSetAccess=BadResultSetAccess|true detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true detectorBadUseOfReturnValue=BadUseOfReturnValue|true detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true detectorBooleanReturnNull=BooleanReturnNull|true detectorBuildInterproceduralCallGraph=BuildInterproceduralCallGraph|false detectorBuildObligationPolicyDatabase=BuildObligationPolicyDatabase|true detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false detectorCalledMethods=CalledMethods|true detectorCheckCalls=CheckCalls|false detectorCheckExpectedWarnings=CheckExpectedWarnings|false detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true detectorCheckTypeQualifiers=CheckTypeQualifiers|true detectorCloneIdiom=CloneIdiom|true detectorComparatorIdiom=ComparatorIdiom|true detectorConfusedInheritance=ConfusedInheritance|true detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true detectorCrossSiteScripting=CrossSiteScripting|true detectorDefaultEncodingDetector=DefaultEncodingDetector|true detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true detectorDontUseEnum=DontUseEnum|true detectorDroppedException=DroppedException|true detectorDumbMethodInvocations=DumbMethodInvocations|true detectorDumbMethods=DumbMethods|true detectorDuplicateBranches=DuplicateBranches|true detectorEmptyZipFileEntry=EmptyZipFileEntry|true detectorEqStringTest=EqStringTest|false detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true detectorExplicitSerialization=ExplicitSerialization|true detectorFieldItemSummary=FieldItemSummary|true detectorFinalizerNullsFields=FinalizerNullsFields|true detectorFindBadCast=FindBadCast|false detectorFindBadCast2=FindBadCast2|true detectorFindBadEqualsImplementation=FindBadEqualsImplementation|false detectorFindBadForLoop=FindBadForLoop|true detectorFindBugsSummaryStats=FindBugsSummaryStats|true detectorFindCircularDependencies=FindCircularDependencies|false detectorFindDeadLocalStores=FindDeadLocalStores|true detectorFindDoubleCheck=FindDoubleCheck|true detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true detectorFindFinalizeInvocations=FindFinalizeInvocations|true detectorFindFloatEquality=FindFloatEquality|true detectorFindFloatMath=FindFloatMath|false detectorFindHEmismatch=FindHEmismatch|true detectorFindInconsistentSync2=FindInconsistentSync2|true detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true detectorFindMaskedFields=FindMaskedFields|true detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true detectorFindNakedNotify=FindNakedNotify|true detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true detectorFindNonShortCircuit=FindNonShortCircuit|true detectorFindNullDeref=FindNullDeref|true detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true detectorFindOpenStream=FindOpenStream|true detectorFindPuzzlers=FindPuzzlers|true detectorFindRefComparison=FindRefComparison|true detectorFindReturnRef=FindReturnRef|true detectorFindRoughConstants=FindRoughConstants|true detectorFindRunInvocations=FindRunInvocations|true detectorFindSelfComparison=FindSelfComparison|true detectorFindSelfComparison2=FindSelfComparison2|true detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true detectorFindSpinLoop=FindSpinLoop|true detectorFindSqlInjection=FindSqlInjection|true detectorFindTwoLockWait=FindTwoLockWait|true detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true detectorFindUnconditionalWait=FindUnconditionalWait|true detectorFindUninitializedGet=FindUninitializedGet|true detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true detectorFindUnreleasedLock=FindUnreleasedLock|true detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true detectorFindUnsyncGet=FindUnsyncGet|true detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true detectorFindUselessControlFlow=FindUselessControlFlow|true detectorFormatStringChecker=FormatStringChecker|true detectorHugeSharedStringConstants=HugeSharedStringConstants|true detectorIDivResultCastToDouble=IDivResultCastToDouble|true detectorIncompatMask=IncompatMask|true detectorInconsistentAnnotations=InconsistentAnnotations|true detectorInefficientIndexOf=InefficientIndexOf|true detectorInefficientMemberAccess=InefficientMemberAccess|false detectorInefficientToArray=InefficientToArray|true detectorInfiniteLoop=InfiniteLoop|true detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true detectorInitializationChain=InitializationChain|true detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true detectorInstantiateStaticClass=InstantiateStaticClass|true detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true detectorInvalidJUnitTest=InvalidJUnitTest|true detectorIteratorIdioms=IteratorIdioms|true detectorLazyInit=LazyInit|true detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true detectorLockedFields=LockedFields|false detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true detectorMethodReturnCheck=MethodReturnCheck|true detectorMethods=Methods|true detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true detectorMutableLock=MutableLock|true detectorMutableStaticFields=MutableStaticFields|true detectorNaming=Naming|true detectorNoise=Noise|false detectorNoiseNullDeref=NoiseNullDeref|false detectorNoteAnnotationRetention=NoteAnnotationRetention|true detectorNoteCheckReturnValue=NoteCheckReturnValue|true detectorNoteCheckReturnValueAnnotations=NoteCheckReturnValueAnnotations|true detectorNoteDirectlyRelevantTypeQualifiers=NoteDirectlyRelevantTypeQualifiers|true detectorNoteJCIPAnnotation=NoteJCIPAnnotation|true detectorNoteNonNullAnnotations=NoteNonNullAnnotations|true detectorNoteNonnullReturnValues=NoteNonnullReturnValues|true detectorNoteSuppressedWarnings=NoteSuppressedWarnings|true detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true detectorNumberConstructor=NumberConstructor|true detectorOptionalReturnNull=OptionalReturnNull|true detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true detectorPublicSemaphores=PublicSemaphores|false detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true detectorRedundantInterfaces=RedundantInterfaces|true detectorReflectiveClasses=ReflectiveClasses|true detectorRepeatedConditionals=RepeatedConditionals|true detectorResolveAllReferences=ResolveAllReferences|false detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true detectorSerializableIdiom=SerializableIdiom|true detectorStartInConstructor=StartInConstructor|true detectorStaticCalendarDetector=StaticCalendarDetector|true detectorStringConcatenation=StringConcatenation|true detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true detectorSwitchFallthrough=SwitchFallthrough|true detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true detectorTestASM=TestASM|false detectorTestDataflowAnalysis=TestDataflowAnalysis|false detectorTestingGround=TestingGround|false detectorTrainFieldStoreTypes=TrainFieldStoreTypes|true detectorTrainNonNullAnnotations=TrainNonNullAnnotations|true detectorTrainUnconditionalDerefParams=TrainUnconditionalDerefParams|true detectorURLProblems=URLProblems|true detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true detectorUnnecessaryMath=UnnecessaryMath|true detectorUnreadFields=UnreadFields|true detectorUseObjectEquals=UseObjectEquals|false detectorUselessSubclassMethod=UselessSubclassMethod|false detectorVarArgsProblems=VarArgsProblems|true detectorVolatileUsage=VolatileUsage|true detectorWaitInLoop=WaitInLoop|true detectorWrongMapIterator=WrongMapIterator|true detectorXMLFactoryBypass=XMLFactoryBypass|true detector_threshold=2 effort=default filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|15 filter_settings_neg=EXPERIMENTAL,NOISE| run_at_full_build=true
ganghuan-bookstore/.pmd
false .ruleset AvoidDecimalLiteralsInBigDecimalConstructor Basic AvoidMultipleUnaryOperators Basic AvoidThreadGroup Basic AvoidUsingHardCodedIP Basic AvoidUsingOctalValues Basic BigIntegerInstantiation Basic BooleanInstantiation Basic BrokenNullCheck Basic CheckResultSet Basic ClassCastExceptionWithToArray Basic DoubleCheckedLocking Basic ForLoopShouldBeWhileLoop Basic JumbledIncrementer Basic MisplacedNullCheck Basic OverrideBothEqualsAndHashcode Basic ReturnFromFinallyBlock Basic UnconditionalIfStatement Basic CollapsibleIfStatements Basic Velocity ForLoopsMustUseBraces Braces IfElseStmtsMustUseBraces Braces IfStmtsMustUseBraces Braces WhileLoopsMustUseBraces Braces CloneMethodMustImplementCloneable Clone Implementation CloneThrowsCloneNotSupportedException Clone Implementation ProperCloneImplementation Clone Implementation CyclomaticComplexity Code Size ExcessiveClassLength Code Size ExcessiveMethodLength Code Size ExcessiveParameterList Code Size ExcessivePublicCount Code Size NcssConstructorCount Code Size NcssMethodCount Code Size NcssTypeCount Code Size NPathComplexity Code Size TooManyFields Code Size AssignmentInOperand Controversial AvoidAccessibilityAlteration Controversial AvoidUsingNativeCode Controversial AvoidUsingShortType Controversial AvoidUsingVolatile Controversial BooleanInversion Controversial CallSuperInConstructor Controversial DefaultPackage Controversial DoNotCallGarbageCollectionExplicitly Controversial DontImportSun Controversial NullAssignment Controversial OneDeclarationPerLine Controversial OnlyOneReturn Controversial SuspiciousOctalEscape Controversial UnnecessaryConstructor Controversial CouplingBetweenObjects Coupling ExcessiveImports Coupling LooseCoupling Coupling AbstractClassWithoutAbstractMethod Design AbstractClassWithoutAnyMethod Design AccessorClassGeneration Design AssignmentToNonFinalStatic Design AvoidConstantsInterface Design AvoidDeeplyNestedIfStmts Design AvoidInstanceofChecksInCatchClause Design AvoidProtectedFieldInFinalClass Design AvoidReassigningParameters Design BadComparison Design ClassWithOnlyPrivateConstructorsShouldBeFinal Design CloseResource Design CompareObjectsWithEquals Design ConfusingTernary Design ConstructorCallsOverridableMethod Design DefaultLabelNotLastInSwitchStmt Design EmptyMethodInAbstractClassShouldBeAbstract Design EqualsNull Design FinalFieldCouldBeStatic Design IdempotentOperations Design ImmutableField Design InstantiationToGetClass Design MissingBreakInSwitch Design MissingStaticMethodInNonInstantiatableClass Design NonCaseLabelInSwitchStatement Design NonStaticInitializer Design NonThreadSafeSingleton Design OptimizableToArrayCall Design PositionLiteralsFirstInComparisons Design PreserveStackTrace Design ReturnEmptyArrayRatherThanNull Design SimpleDateFormatNeedsLocale Design SimplifyBooleanExpressions Design SimplifyBooleanReturns Design SimplifyConditional Design SingularField Design SwitchDensity Design SwitchStmtsShouldHaveDefault Design TooFewBranchesForASwitchStatement Design UncommentedEmptyConstructor Design UncommentedEmptyMethod Design UnnecessaryLocalBeforeReturn Design UnsynchronizedStaticDateFormatter Design UseCollectionIsEmpty Design UseLocaleWithCaseConversions Design UseNotifyAllInsteadOfNotify Design EmptyCatchBlock Empty Code EmptyFinallyBlock Empty Code EmptyIfStmt Empty Code EmptyInitializer Empty Code EmptyStatementNotInLoop Empty Code EmptyStaticInitializer Empty Code EmptySwitchStatements Empty Code EmptySynchronizedBlock Empty Code EmptyTryBlock Empty Code EmptyWhileStmt Empty Code AvoidCallingFinalize Finalizer EmptyFinalizer Finalizer FinalizeDoesNotCallSuperFinalize Finalizer FinalizeOnlyCallsSuperFinalize Finalizer FinalizeOverloaded Finalizer FinalizeShouldBeProtected Finalizer DontImportJavaLang Import Statements DuplicateImports Import Statements ImportFromSamePackage Import Statements TooManyStaticImports Import Statements JUnitAssertionsShouldIncludeMessage JUnit JUnitSpelling JUnit JUnitTestsShouldIncludeAssert JUnit SimplifyBooleanAssertion JUnit TestClassWithoutTestCases JUnit UnnecessaryBooleanAssertion JUnit UseAssertEqualsInsteadOfAssertTrue JUnit UseAssertNullInsteadOfAssertTrue JUnit UseAssertSameInsteadOfAssertTrue JUnit AvoidAssertAsIdentifier Migration AvoidEnumAsIdentifier Migration ByteInstantiation Migration IntegerInstantiation Migration JUnit4SuitesShouldUseSuiteAnnotation Migration JUnit4TestShouldUseAfterAnnotation Migration JUnit4TestShouldUseBeforeAnnotation Migration JUnit4TestShouldUseTestAnnotation Migration JUnitUseExpected Migration LongInstantiation Migration ReplaceEnumerationWithIterator Migration ReplaceHashtableWithMap Migration ReplaceVectorWithList Migration ShortInstantiation Migration AbstractNaming Naming AvoidDollarSigns Naming AvoidFieldNameMatchingMethodName Naming AvoidFieldNameMatchingTypeName Naming BooleanGetMethodName Naming ClassNamingConventions Naming MethodNamingConventions Naming MethodWithSameNameAsEnclosingClass Naming MisleadingVariableName Naming PackageCase Naming SuspiciousConstantFieldName Naming SuspiciousEqualsMethodName Naming SuspiciousHashcodeMethodName Naming AddEmptyString Optimization AvoidArrayLoops Optimization LocalVariableCouldBeFinal Optimization MethodArgumentCouldBeFinal Optimization SimplifyStartsWith Optimization UnnecessaryWrapperObjectCreation Optimization UseArrayListInsteadOfVector Optimization UseArraysAsList Optimization UseStringBufferForStringAppends Optimization ArrayIsStoredDirectly Security Code Guidelines MethodReturnsInternalArray Security Code Guidelines AvoidCatchingNPE Strict Exceptions AvoidCatchingThrowable Strict Exceptions AvoidRethrowingException Strict Exceptions AvoidThrowingNewInstanceOfSameException Strict Exceptions AvoidThrowingNullPointerException Strict Exceptions AvoidThrowingRawExceptionTypes Strict Exceptions DoNotExtendJavaLangError Strict Exceptions DoNotThrowExceptionInFinally Strict Exceptions ExceptionAsFlowControl Strict Exceptions SignatureDeclareThrowsException Strict Exceptions AppendCharacterWithChar String and StringBuffer AvoidStringBufferField String and StringBuffer ConsecutiveLiteralAppends String and StringBuffer InefficientEmptyStringCheck String and StringBuffer InefficientStringBuffering String and StringBuffer InsufficientStringBufferDeclaration String and StringBuffer StringBufferInstantiationWithChar String and StringBuffer StringInstantiation String and StringBuffer StringToString String and StringBuffer UnnecessaryCaseChange String and StringBuffer UseEqualsToCompareStrings String and StringBuffer UseIndexOfChar String and StringBuffer UselessStringValueOf String and StringBuffer UseStringBufferLength String and StringBuffer UnnecessaryConversionTemporary Unnecessary UnnecessaryFinalModifier Unnecessary UnnecessaryParentheses Unnecessary UnnecessaryReturn Unnecessary UnusedNullCheckInEquals Unnecessary UselessOperationOnImmutable Unnecessary UselessOverridingMethod Unnecessary UnusedFormalParameter Unused Code UnusedLocalVariable Unused Code UnusedModifier Unused Code UnusedPrivateField Unused Code UnusedPrivateMethod Unused Code false false trueganghuan-bookstore/.project
ganghuan-bookstore net.sourceforge.metrics.builder org.eclipse.jdt.core.javabuilder net.sf.eclipsecs.core.CheckstyleBuilder net.sourceforge.pmd.eclipse.plugin.pmdBuilder edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder org.eclipse.jdt.core.javanature net.sf.eclipsecs.core.CheckstyleNature edu.umd.cs.findbugs.plugin.eclipse.findbugsNature net.sourceforge.pmd.eclipse.plugin.pmdNatureganghuan-bookstore/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false org.eclipse.jdt.core.formatter.align_with_spaces=false org.eclipse.jdt.core.formatter.alignment_for_additive_operator=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=16 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=18 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 org.eclipse.jdt.core.formatter.alignment_for_logical_operator=18 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=18 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=18 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=1 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=next_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=true org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=4 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=95 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
ganghuan-bookstore/.settings/org.eclipse.jdt.ui.prefs
eclipse.preferences.version=1 formatter_profile=_TCSS 305 Next Line Format formatter_settings_version=17 org.eclipse.jdt.ui.text.custom_code_templates=
ganghuan-bookstore/.svn/entries
12
ganghuan-bookstore/.svn/format
12
ganghuan-bookstore/.svn/pristine/0d/0d07dd2b2192b3aeacc44e1b4f0d6b3abbf90bd0.svn-base
ganghuan-bookstore net.sourceforge.metrics.builder org.eclipse.jdt.core.javabuilder net.sf.eclipsecs.core.CheckstyleBuilder net.sourceforge.pmd.eclipse.plugin.pmdBuilder edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder org.eclipse.jdt.core.javanature net.sf.eclipsecs.core.CheckstyleNature edu.umd.cs.findbugs.plugin.eclipse.findbugsNature net.sourceforge.pmd.eclipse.plugin.pmdNatureganghuan-bookstore/.svn/pristine/20/20d017297545f38ba22feae2d49e641778c094b6.svn-base
################################### # Users files. # # It is not a good idea to store # # passwords in a plain text file. # # We do it here to keep the # # application simple. # # # # uwnetid;passwd;campus # ################################### test;test;Tacoma test;Bothell;test ganghuan;Tacoma;Huang123321 ganghuan;Tacoma;hUANG123321 ganghuan;Tacoma;hUANG123321 huang;Tacoma;huang
ganghuan-bookstore/.svn/pristine/24/240b8815d116e6ee8bafa69446284a73df37f7bb.svn-base
false .ruleset AvoidDecimalLiteralsInBigDecimalConstructor Basic AvoidMultipleUnaryOperators Basic AvoidThreadGroup Basic AvoidUsingHardCodedIP Basic AvoidUsingOctalValues Basic BigIntegerInstantiation Basic BooleanInstantiation Basic BrokenNullCheck Basic CheckResultSet Basic ClassCastExceptionWithToArray Basic DoubleCheckedLocking Basic ForLoopShouldBeWhileLoop Basic JumbledIncrementer Basic MisplacedNullCheck Basic OverrideBothEqualsAndHashcode Basic ReturnFromFinallyBlock Basic UnconditionalIfStatement Basic CollapsibleIfStatements Basic Velocity ForLoopsMustUseBraces Braces IfElseStmtsMustUseBraces Braces IfStmtsMustUseBraces Braces WhileLoopsMustUseBraces Braces CloneMethodMustImplementCloneable Clone Implementation CloneThrowsCloneNotSupportedException Clone Implementation ProperCloneImplementation Clone Implementation CyclomaticComplexity Code Size ExcessiveClassLength Code Size ExcessiveMethodLength Code Size ExcessiveParameterList Code Size ExcessivePublicCount Code Size NcssConstructorCount Code Size NcssMethodCount Code Size NcssTypeCount Code Size NPathComplexity Code Size TooManyFields Code Size AssignmentInOperand Controversial AvoidAccessibilityAlteration Controversial AvoidUsingNativeCode Controversial AvoidUsingShortType Controversial AvoidUsingVolatile Controversial BooleanInversion Controversial CallSuperInConstructor Controversial DefaultPackage Controversial DoNotCallGarbageCollectionExplicitly Controversial DontImportSun Controversial NullAssignment Controversial OneDeclarationPerLine Controversial OnlyOneReturn Controversial SuspiciousOctalEscape Controversial UnnecessaryConstructor Controversial CouplingBetweenObjects Coupling ExcessiveImports Coupling LooseCoupling Coupling AbstractClassWithoutAbstractMethod Design AbstractClassWithoutAnyMethod Design AccessorClassGeneration Design AssignmentToNonFinalStatic Design AvoidConstantsInterface Design AvoidDeeplyNestedIfStmts Design AvoidInstanceofChecksInCatchClause Design AvoidProtectedFieldInFinalClass Design AvoidReassigningParameters Design BadComparison Design ClassWithOnlyPrivateConstructorsShouldBeFinal Design CloseResource Design CompareObjectsWithEquals Design ConfusingTernary Design ConstructorCallsOverridableMethod Design DefaultLabelNotLastInSwitchStmt Design EmptyMethodInAbstractClassShouldBeAbstract Design EqualsNull Design FinalFieldCouldBeStatic Design IdempotentOperations Design ImmutableField Design InstantiationToGetClass Design MissingBreakInSwitch Design MissingStaticMethodInNonInstantiatableClass Design NonCaseLabelInSwitchStatement Design NonStaticInitializer Design NonThreadSafeSingleton Design OptimizableToArrayCall Design PositionLiteralsFirstInComparisons Design PreserveStackTrace Design ReturnEmptyArrayRatherThanNull Design SimpleDateFormatNeedsLocale Design SimplifyBooleanExpressions Design SimplifyBooleanReturns Design SimplifyConditional Design SingularField Design SwitchDensity Design SwitchStmtsShouldHaveDefault Design TooFewBranchesForASwitchStatement Design UncommentedEmptyConstructor Design UncommentedEmptyMethod Design UnnecessaryLocalBeforeReturn Design UnsynchronizedStaticDateFormatter Design UseCollectionIsEmpty Design UseLocaleWithCaseConversions Design UseNotifyAllInsteadOfNotify Design EmptyCatchBlock Empty Code EmptyFinallyBlock Empty Code EmptyIfStmt Empty Code EmptyInitializer Empty Code EmptyStatementNotInLoop Empty Code EmptyStaticInitializer Empty Code EmptySwitchStatements Empty Code EmptySynchronizedBlock Empty Code EmptyTryBlock Empty Code EmptyWhileStmt Empty Code AvoidCallingFinalize Finalizer EmptyFinalizer Finalizer FinalizeDoesNotCallSuperFinalize Finalizer FinalizeOnlyCallsSuperFinalize Finalizer FinalizeOverloaded Finalizer FinalizeShouldBeProtected Finalizer DontImportJavaLang Import Statements DuplicateImports Import Statements ImportFromSamePackage Import Statements TooManyStaticImports Import Statements JUnitAssertionsShouldIncludeMessage JUnit JUnitSpelling JUnit JUnitTestsShouldIncludeAssert JUnit SimplifyBooleanAssertion JUnit TestClassWithoutTestCases JUnit UnnecessaryBooleanAssertion JUnit UseAssertEqualsInsteadOfAssertTrue JUnit UseAssertNullInsteadOfAssertTrue JUnit UseAssertSameInsteadOfAssertTrue JUnit AvoidAssertAsIdentifier Migration AvoidEnumAsIdentifier Migration ByteInstantiation Migration IntegerInstantiation Migration JUnit4SuitesShouldUseSuiteAnnotation Migration JUnit4TestShouldUseAfterAnnotation Migration JUnit4TestShouldUseBeforeAnnotation Migration JUnit4TestShouldUseTestAnnotation Migration JUnitUseExpected Migration LongInstantiation Migration ReplaceEnumerationWithIterator Migration ReplaceHashtableWithMap Migration ReplaceVectorWithList Migration ShortInstantiation Migration AbstractNaming Naming AvoidDollarSigns Naming AvoidFieldNameMatchingMethodName Naming AvoidFieldNameMatchingTypeName Naming BooleanGetMethodName Naming ClassNamingConventions Naming MethodNamingConventions Naming MethodWithSameNameAsEnclosingClass Naming MisleadingVariableName Naming PackageCase Naming SuspiciousConstantFieldName Naming SuspiciousEqualsMethodName Naming SuspiciousHashcodeMethodName Naming AddEmptyString Optimization AvoidArrayLoops Optimization LocalVariableCouldBeFinal Optimization MethodArgumentCouldBeFinal Optimization SimplifyStartsWith Optimization UnnecessaryWrapperObjectCreation Optimization UseArrayListInsteadOfVector Optimization UseArraysAsList Optimization UseStringBufferForStringAppends Optimization ArrayIsStoredDirectly Security Code Guidelines MethodReturnsInternalArray Security Code Guidelines AvoidCatchingNPE Strict Exceptions AvoidCatchingThrowable Strict Exceptions AvoidRethrowingException Strict Exceptions AvoidThrowingNewInstanceOfSameException Strict Exceptions AvoidThrowingNullPointerException Strict Exceptions AvoidThrowingRawExceptionTypes Strict Exceptions DoNotExtendJavaLangError Strict Exceptions DoNotThrowExceptionInFinally Strict Exceptions ExceptionAsFlowControl Strict Exceptions SignatureDeclareThrowsException Strict Exceptions AppendCharacterWithChar String and StringBuffer AvoidStringBufferField String and StringBuffer ConsecutiveLiteralAppends String and StringBuffer InefficientEmptyStringCheck String and StringBuffer InefficientStringBuffering String and StringBuffer InsufficientStringBufferDeclaration String and StringBuffer StringBufferInstantiationWithChar String and StringBuffer StringInstantiation String and StringBuffer StringToString String and StringBuffer UnnecessaryCaseChange String and StringBuffer UseEqualsToCompareStrings String and StringBuffer UseIndexOfChar String and StringBuffer UselessStringValueOf String and StringBuffer UseStringBufferLength String and StringBuffer UnnecessaryConversionTemporary Unnecessary UnnecessaryFinalModifier Unnecessary UnnecessaryParentheses Unnecessary UnnecessaryReturn Unnecessary UnusedNullCheckInEquals Unnecessary UselessOperationOnImmutable Unnecessary UselessOverridingMethod Unnecessary UnusedFormalParameter Unused Code UnusedLocalVariable Unused Code UnusedModifier Unused Code UnusedPrivateField Unused Code UnusedPrivateMethod Unused Code false false trueganghuan-bookstore/.svn/pristine/35/351ba5f06082a083486ed7f326607ff1e0a6822f.svn-base
ganghuan-bookstore/.svn/pristine/35/35dc9ed009fbfde61976c8e393c19490374adbb9.svn-base
/* * TCSS 305 Assignment 2 - UW Bookstore */ package view; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.text.NumberFormat; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.SwingConstants; import model.Cart; import model.Item; import model.ItemOrder; import res.R; /** * BookstoreFrame provides the user interface for a UW Bookstore program. * * @author Marty Stepp * @author Daniel M. Zimmerman (Formatting and Comments) * @author Alan Fowler (Numerous changes to code and comments including use of BigDecimal) * @author Charles Bryan (Added radio buttons to change campus locations/changed name) * @version Autumn 2019 */ public final class BookstoreFrame extends JFrame { /** The Serialization ID. */ private static final long serialVersionUID = 505198377375189354L; // constants to capture screen dimensions /** A ToolKit. */ private static final Toolkit KIT = Toolkit.getDefaultToolkit(); /** The Dimension of the screen. */ private static final Dimension SCREEN_SIZE = KIT.getScreenSize(); /** * The shopping cart used by this GUI. */ private final Cart myItems; /** * The map that stores each campus name and the campus's bookstore inventory. */ private final Map<String, List<Item>> myCampusInventories; /** * The map that stores each campus name and the campus's bookstore inventory. */ private String myCurrentCampus; /** * The text field used to display the total amount owed by the customer. */ private final JTextField myTotal; /** * The panel that holds the item descriptions. Needed to add and remove on * the fly when the radio buttons change. */ private JPanel myItemsPanel; /** * A List of the item text fields. */ private final List<JTextField> myQuantities; /** * Initializes the bookstore GUI. * * @param theCampusInventories The list of items. * @param theCurrentCampus The campus that is originally selected when * the application starts. */ public BookstoreFrame(final Map<String, List<Item>> theCampusInventories, final String theCurrentCampus) { // create frame and order list super(); // No title on the JFrame. We can set this later. myItems = new Cart(); // set up text field with order total myTotal = new JTextField(R.Strings.BF_TEXTFIELD_TOTAL, R.Dimensions.BF_TEXTFIELD_TOTAL); myQuantities = new LinkedList<>(); myCampusInventories = theCampusInventories; myCurrentCampus = theCurrentCampus; setupGUI(); } /** * Setup the various parts of the GUI. * */ private void setupGUI() { // hide the default JFrame icon //final Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE); // replace the default JFrame icon final ImageIcon img = new ImageIcon(R.Strings.IO_FILE_LOCATION + R.Strings.IO_ICON_FILE); setIconImage(img.getImage()); setTitle(R.Strings.BF_FRAME_TITLE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(makeTotalPanel(), BorderLayout.NORTH); myItemsPanel = makeItemsPanel(myCampusInventories.get(myCurrentCampus)); add(myItemsPanel, BorderLayout.CENTER); add(makeCheckBoxPanel(), BorderLayout.SOUTH); // adjust size to just fit pack(); // make the GUI so that it cannot be resized by the user dragging a corner setResizable(false); // position the frame in the center of the screen setLocation(SCREEN_SIZE.width / 2 - getWidth() / 2, SCREEN_SIZE.height / 2 - getHeight() / 2); setVisible(true); } /** * Creates the panel to hold the campus location radio buttons. * * @return The created JPanel */ private JPanel makeCampusPanel() { final JPanel p = new JPanel(); p.setBackground(R.Colors.HEADER_FOOTER_BG); final ButtonGroup g = new ButtonGroup(); for (final Object campus : myCampusInventories.keySet()) { final JRadioButton rb = new JRadioButton(campus.toString()); rb.setForeground(R.Colors.HEADER_FOOTER_TEXT); rb.setBackground(R.Colors.HEADER_FOOTER_BG); rb.setSelected(campus.equals(myCurrentCampus)); g.add(rb); p.add(rb); rb.addActionListener(ae -> { myCurrentCampus = rb.getText(); //remove the old panel and add the new one remove(myItemsPanel); myItemsPanel = makeItemsPanel(myCampusInventories.get(myCurrentCampus)); add(myItemsPanel, BorderLayout.CENTER); //clear previous data from the ShppingCart and //update the total in the GUI myItems.clear(); updateTotal(); //redraw the UI with the new panel pack(); revalidate(); } ); } return p; } /** * Creates a panel to hold the total. * * @return The created panel */ private JPanel makeTotalPanel() { // tweak the text field so that users can't edit it, and set // its color appropriately myTotal.setEditable(false); myTotal.setEnabled(false); myTotal.setDisabledTextColor(R.Colors.CONTENT_TEXT); // create the panel, and its label final JPanel totalPanel = new JPanel(); totalPanel.setBackground(R.Colors.HEADER_FOOTER_BG); final JLabel l = new JLabel(R.Strings.BF_LABEL_TOTAL); l.setForeground(R.Colors.HEADER_FOOTER_TEXT); totalPanel.add(l); totalPanel.add(myTotal); final JPanel p = new JPanel(new BorderLayout()); p.add(makeCampusPanel(), BorderLayout.NORTH); p.add(totalPanel, BorderLayout.CENTER); return p; } /** * Creates a panel to hold the specified list of items. * * @param theItems The items * @return The created panel */ private JPanel makeItemsPanel(final List<Item> theItems) { final JPanel p = new JPanel(new GridLayout(theItems.size(), R.Dimensions.BF_ITEMS_COLS)); p.setBorder(BorderFactory. createEmptyBorder(R.Dimensions.V_PADDING, R.Dimensions.H_PADDING, R.Dimensions.V_PADDING, R.Dimensions.H_PADDING)); p.setBackground(R.Colors.CONTENT_BG); for (final Item item : theItems) { addItem(item, p); } return p; } /** * Creates and returns the checkbox panel. * * @return the checkbox panel */ private JPanel makeCheckBoxPanel() { final JPanel p = new JPanel(); p.setBackground(R.Colors.HEADER_FOOTER_BG); final JButton clearButton = new JButton(R.Strings.BF_BUTTON_CLEAR); clearButton.addActionListener(theEvent -> { myItems.clear(); for (final JTextField field : myQuantities) { field.setText(""); } updateTotal(); }); p.add(clearButton); final JCheckBox cb = new JCheckBox(R.Strings.BF_CHECKBOX_MEMBER); cb.setForeground(R.Colors.HEADER_FOOTER_TEXT); cb.setBackground(R.Colors.HEADER_FOOTER_BG); cb.addActionListener(theEvent -> { myItems.setMembership(cb.isSelected()); updateTotal(); }); p.add(cb); return p; } /** * Adds the specified product to the specified panel. * * @param theItem The product to add. * @param thePanel The panel to add the product to. */ private void addItem(final Item theItem, final JPanel thePanel) { final JPanel sub = new JPanel(new FlowLayout(FlowLayout.LEFT)); sub.setBackground(R.Colors.CONTENT_BG); final JTextField quantity = new JTextField(R.Dimensions.BF_TEXTFIELD_QUANITITY); myQuantities.add(quantity); quantity.setHorizontalAlignment(SwingConstants.CENTER); quantity.addActionListener(theEvent -> quantity.transferFocus()); quantity.addFocusListener(new FocusAdapter() { @Override public void focusLost(final FocusEvent theEvent) { updateItem(theItem, quantity); } }); sub.add(quantity); final JLabel l = new JLabel(theItem.toString()); l.setForeground(R.Colors.HEADER_FOOTER_BG); sub.add(l); thePanel.add(sub); } /** * Updates the set of items by changing the quantity of the specified * product to the specified quantity. * * @param theItem The product to update. * @param theQuantity The new quantity. */ private void updateItem(final Item theItem, final JTextField theQuantity) { final String text = theQuantity.getText().trim(); int number; try { number = Integer.parseInt(text); if (number < 0) { // disallow negative numbers throw new NumberFormatException(); } } catch (final NumberFormatException e) { number = 0; theQuantity.setText(""); } myItems.add(new ItemOrder(theItem, number)); updateTotal(); } /** * Updates the total displayed in the window. */ private void updateTotal() { final double total = myItems.calculateTotal().doubleValue(); myTotal.setText(NumberFormat.getCurrencyInstance().format(total)); } } // end of class BookstoreFrame
ganghuan-bookstore/.svn/pristine/38/38a067f0e50e0da30fa2dc90e16a9664c7d072bd.svn-base
/* * TCSS 305 Assignment 2 - UW Bookstore */ package appliation; import io.InventoryLoader; import java.awt.EventQueue; import java.util.List; import res.R; import view.LoginFrame; /** * BookstoreMain provides the main method for a simple shopping cart GUI * displayer and calculator. * * @author Marty Stepp * @author Daniel M. Zimmerman (Formatting and Comments) * @author Alan Fowler (Numerous changes including use of BigDecimal and file input) * @author Charles Bryan (Added multiple file loading options/changed name) * @version Autumn 2018 */ public final class BookstoreMain { /** * A private constructor, to prevent external instantiation. */ private BookstoreMain() { } /** * The main() method - displays and runs the bookstore GUI. * * @param theArgs Command line arguments, ignored by this program. */ public static void main(final String... theArgs) { final List<String> campusNames = InventoryLoader.readConfigurationFromFile(R.Strings.IO_FILE_LOCATION + R.Strings.IO_CONFIG_FILE); EventQueue.invokeLater(new Runnable() { @Override public void run() { new LoginFrame(campusNames).setVisible(true); } }); } // end main() } // end class BookstoreMain
ganghuan-bookstore/.svn/pristine/39/398431036fd6dcb1aea5e1a604c5fc81d37a4b1b.svn-base
ganghuan-bookstore/.svn/pristine/48/485e5818e2ec99e4dc360a4c4a90b7130c4a1825.svn-base
#place an * in front of the campus that the application should start with. #There should be no space in between the * and the campus name. #if multiple campuses have an *, the last one read will become the start campus. Bothell Seattle Tacoma
ganghuan-bookstore/.svn/pristine/55/554e628a403e55ec928145ee12672c6b0fe75d0c.svn-base
/* * TCSS - Autumn 2019 * Assignment 1 - Online BookStore */ package model; import java.util.*; import java.math.RoundingMode; import java.math.BigDecimal; public class Cart { // set the discount rate for members private static final BigDecimal DISCOUNT = new BigDecimal(".98805705"); private Map<Item, BigDecimal> cart; private boolean memberShip; public Cart() { cart = new HashMap<Item, BigDecimal>(); cart = new HashMap<Item, BigDecimal>(); } public void add(final ItemOrder theOrder) { cart.put(theOrder.getItem(), theOrder.calculateOrderTotal()); } public void setMembership(final boolean theMembership) { memberShip = theMembership; } public BigDecimal calculateTotal() { BigDecimal orderTotal = BigDecimal.ZERO; final Iterator<Item> iterator = cart.keySet().iterator(); while (iterator.hasNext()) { final BigDecimal currentOrderPrice = cart.get(iterator.next()); orderTotal = orderTotal.add(currentOrderPrice); } if (memberShip) { orderTotal = DISCOUNT.multiply(orderTotal); } return orderTotal.setScale(2, RoundingMode.HALF_EVEN); } public void clear() { cart = new HashMap<Item, BigDecimal>(); } public int getCartSize() { return -1; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(cart); return sb.toString(); } }
ganghuan-bookstore/.svn/pristine/5b/5bb3c7c82f258be0f68a8d67883cf7be75b0471a.svn-base
package res; import java.awt.Color; /** * Resources class. * * General convention: constant starts with the abbreviation for the class it is associated * with. * * LoginFrame == LF * BookstoreFrame == BS * * @author Charles Bryan * @version 7 September 2019 */ public class R { /** * Resource class for color schemes. * * @author Charles Bryan * @version 7 September 2019 */ public static class Colors { /* * For the UW color palate and other UW branding information see * http://www.washington.edu/marketing/files/2012/09/WebColorPalette1.pdf */ /** The background color for content containers. */ public static final Color CONTENT_BG = new Color(199, 153, 0); // UW Gold /** The background color for headers and footers. */ public static final Color HEADER_FOOTER_BG = new Color(57, 39, 91); // UW Purple /** The text color for content containers. */ public static final Color CONTENT_TEXT = HEADER_FOOTER_BG; /** The text color for headers and footers. */ public static final Color HEADER_FOOTER_TEXT = Color.WHITE; /** The text color for background of text fields on error. */ public static final Color ERROR_TEXT_FIELD_BG = Color.PINK; /** The text color for background of text fields on without error. */ public static final Color NO_ERROR_TEXT_FIELD_BG = Color.WHITE; } /** * Resource class for Array index values. * * File Name nicknames: * Items File == IF * Users File == UF * @author Charles Bryan * @version 7 September 2019 */ public static class Indicies { /** The index of the Item name in the Items files. */ public static final int IF_ITEM_NAME = 0; /** The index of the Item price in the Items files. */ public static final int IF_ITEM_PRICE = 1; /** The index of the Item bulk quantity in the Items files. */ public static final int IF_ITEM_BULK_QUANITIY = 2; /** The index of the Item bulk price in the Items files. */ public static final int IF_ITEM_BULK_PRICE = 3; /** The index of the user name in the credentials files. */ public static final int UF_USERNAME = 0; /** The index of the password in the credentials files. */ public static final int UF_PASSWORD = 1; /** The index of the campus in the credentials files. */ public static final int UF_CAMPUS = 2; } /** * Resource class for dimensions. * * @author Charles Bryan * @version 7 September 2019 */ public static class Dimensions { /** The number of rows in the Login Frame: status login. */ public static final int LF_LOGIN_ROWS = 2; /** The number of columns in the Login Frame: status login. */ public static final int LF_LOGIN_COLS = 2; /** The number of rows in the Login Frame: status register. */ public static final int LF_REGISTRATION_ROWS = 4; /** The number of columns in the Login Frame: status register. */ public static final int LF_REGISTRATION_COLS = 2; /** The number of columns for Item Panels in the Bookstore frame. */ public static final int BF_ITEMS_COLS = 1; /** General horizontal padding. */ public static final int H_PADDING = 10; /** General vertical padding. */ public static final int V_PADDING = 5; /** The width of the text fields in the Login GUI. */ public static final int LF_TEXTFIELD_WIDTH = 10; /** The width of the total text field in the BookStore GUI. */ public static final int BF_TEXTFIELD_TOTAL = 12; /** The width of the quantity text field in the BookStore GUI. */ public static final int BF_TEXTFIELD_QUANITITY = 3; } /** * Resource class for String Literals. * * General naming convention for strings associated with Swing Components: * * CLASS_COMPONENT_DESCRIPTION * * * @author Charles Bryan * @version 7 September 2019 */ public static class Strings { /** The filename of the file containing the items to display in the cart. */ public static final String IO_CONFIG_FILE = "config.txt"; /** The filename of the file containing the user credentials. */ public static final String IO_CREDENTIALS_FILE = "users.txt"; /** The filename of the application icon. */ public static final String IO_ICON_FILE = "w.gif"; /** The local path of the configuration files. */ public static final String IO_FILE_LOCATION = "files/"; /** The file extension for text files. */ public static final String IO_FILE_EXTENSION = ".txt"; /** The delimiter used in text files. */ public static final String IO_FILE_DELIMITER = ";"; /** The character used to make a single line comment in text files. */ public static final String IO_FILE_COMMENT = "#"; /** Error message used when event handlers are implemented with method references. */ public static final String ERROR_MSG_ILLEGAL_INVOKE = "Only invoke when used as handler for JButton."; /** Error message used when registration pwds don't match. */ public static final String ERROR_MSG_PASSWORDS_NO_MATCH = "Passwords must be the same."; /** Error message used when registration pwds are too short. */ public static final String ERROR_MSG_PASSWORDS_TOO_SHORT = "Password must be at least 7 charachters long."; /** Error message used when registration pwds are too short. */ public static final String ERROR_MSG_USER_EXISTS = "Unfortunatly that user name is already taken."; /** Error message used when registration pwds done match. */ public static final String ERROR_MSG_EMPTY_FIELDS = "All fields are required."; /** Error message for title in Error Popup. */ public static final String ERROR_MSG_TITLE = "Oh No!"; /** Error message for incorrect login credentials. */ public static final String ERROR_MSG_CREDENTIALS = "Login credentials incorrect. Plesae try again."; /** Text in Total text field. */ public static final String BF_TEXTFIELD_TOTAL = "$0.00"; /** Text in Total text field. */ public static final String BF_FRAME_TITLE = "UW Bookstore"; /** Message on total Label. */ public static final String BF_LABEL_TOTAL = "order total:"; /** Message on clear Button. */ public static final String BF_BUTTON_CLEAR = "Clear"; /** Message on membership check box. */ public static final String BF_CHECKBOX_MEMBER = "customer has store membership"; /** Message on Login Button during login. */ public static final String LF_BUTTON_LOGIN = "Login"; /** Message on Login Button during registration. */ public static final String LF_BUTTON_LOGIN_REGISTRATION = "Register and Login"; /** Message on Register Button. */ public static final String LF_BUTTON_REGISTER = "Register"; /** Message on user name Label. */ public static final String LF_LABEL_USERNAME = "Username:"; /** Message on password Label. */ public static final String LF_LABEL_PASSWORD = "Password:"; /** Message on second password name Label. */ public static final String LF_LABEL_PASSWORD_2 = "Re-enter Password:"; /** Message on campus Label. */ public static final String LF_LABEL_CAMPUS = "Choose your Campus:"; /** Message on frame header Label. */ public static final String LF_LABEL_HEADER = "Login to access store:"; } }
ganghuan-bookstore/.svn/pristine/60/609ebb1aec971a2b69bedd7cf5344170be78a48e.svn-base
package view; import io.CredentialingLoader; import io.InventoryLoader; import java.awt.BorderLayout; import java.awt.Cursor; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.ExecutionException; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingWorker; import model.Item; import res.R; /** * LoginFrame provides a user interface for login and registration. * * @author Charles Bryan * @version 7 September 2019 */ public class LoginFrame extends JFrame { /** The Serialization ID. */ private static final long serialVersionUID = 1728929170437545812L; // constants to capture screen dimensions /** A ToolKit. */ private static final Toolkit KIT = Toolkit.getDefaultToolkit(); /** The Dimension of the screen. */ private static final Dimension SCREEN_SIZE = KIT.getScreenSize(); /** The text field used to enter the user name. */ private final JTextField myUserNameField; /** The text field used to enter the password. */ private final JPasswordField myPasswdField; /** The text field used to enter the password the 2nd time on registration. */ private final JPasswordField myPasswdField2; /** The combo box used to select the campus on registration. */ private final JComboBox<String> myCampusBox; /** The button used to trigger login sequence. */ private final JButton myLoginButton; /** The button used to trigger login registration. */ private final JButton myRegisterButton; /** The panel that holds the Login/registration text fields. */ private final JPanel myFieldsPanel; /** * Initializes the bookstore GUI. * @param theCampusList the list of university campuses */ public LoginFrame(final List<String> theCampusList) { super(); myUserNameField = new JTextField(R.Dimensions.LF_TEXTFIELD_WIDTH); myPasswdField = new JPasswordField(R.Dimensions.LF_TEXTFIELD_WIDTH); myPasswdField2 = new JPasswordField(R.Dimensions.LF_TEXTFIELD_WIDTH); myCampusBox = new JComboBox<>(theCampusList.toArray(new String[0])); myFieldsPanel = new JPanel(new GridLayout(R.Dimensions.LF_LOGIN_ROWS, R.Dimensions.LF_LOGIN_COLS)); myLoginButton = new JButton(R.Strings.LF_BUTTON_LOGIN); myRegisterButton = new JButton(R.Strings.LF_BUTTON_REGISTER); setupGUI(); } /** * Setup the various parts of the GUI. */ private void setupGUI() { layoutComponents(); assignActions(); finalizeFrame(); } /** * Layout the Swing components. */ private void layoutComponents() { final JPanel pane = new JPanel(new BorderLayout()); final JPanel header = new JPanel(); header.setBackground(R.Colors.HEADER_FOOTER_BG); final JLabel headerLabel = new JLabel(R.Strings.LF_LABEL_HEADER); headerLabel.setForeground(R.Colors.HEADER_FOOTER_TEXT); header.add(headerLabel); pane.add(header, BorderLayout.NORTH); myFieldsPanel.setBorder(BorderFactory. createEmptyBorder(R.Dimensions.V_PADDING, R.Dimensions.H_PADDING, R.Dimensions.V_PADDING, R.Dimensions.H_PADDING)); myFieldsPanel.setBackground(R.Colors.CONTENT_BG); final JLabel uNameLabel = new JLabel(R.Strings.LF_LABEL_USERNAME); uNameLabel.setForeground(R.Colors.CONTENT_TEXT); myFieldsPanel.add(uNameLabel); myFieldsPanel.add(myUserNameField); final JLabel pwdLabel = new JLabel(R.Strings.LF_LABEL_PASSWORD); pwdLabel.setForeground(R.Colors.CONTENT_TEXT); myFieldsPanel.add(pwdLabel); myFieldsPanel.add(myPasswdField); pane.add(myFieldsPanel, BorderLayout.CENTER); final JPanel bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT)); bottom.setBackground(R.Colors.HEADER_FOOTER_BG); bottom.add(myRegisterButton); bottom.add(myLoginButton); pane.add(bottom, BorderLayout.SOUTH); setContentPane(pane); } /** * Add Listeners to any GUI components that require them. */ private void assignActions() { myLoginButton.addActionListener(this::loginButtonAction); myRegisterButton.addActionListener(this::registerButtonAction); } /** * Finalize this JFrame before making visible. */ private void finalizeFrame() { // make the GUI so that it cannot be resized by the user dragging a corner setResizable(false); // position the frame in the center of the screen setLocation(SCREEN_SIZE.width / 2 - getWidth() / 2, SCREEN_SIZE.height / 2 - getHeight() / 2); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); pack(); setVisible(true); } /** * Validate the Login Fields for empty. If the fields are empty, an error * message is returned, otherwise the empty String is returned. * * @return an error message if the login fields are empty, otherwise the * empty String */ private String validateLoginFieldsEmpty() { String result = validateEmpty(myUserNameField); final String pwd = validateEmpty(myPasswdField); if (result.isEmpty()) { result = pwd; } return result; } /** * Validate TextField for empty. If the field is empty, an error message is * returned, otherwise the empty String is returned. * * @param theField The Field to validate. * @return an error message if the field is empty, otherwise the empty * String. */ private String validateEmpty(final JTextField theField) { String result = ""; if (theField.getText().isEmpty()) { theField.setBackground(R.Colors.ERROR_TEXT_FIELD_BG); result = R.Strings.ERROR_MSG_EMPTY_FIELDS; } else { theField.setBackground(R.Colors.NO_ERROR_TEXT_FIELD_BG); } return result; } /* Event Handlers follow */ /** * Event handler for the Login Button during login. This method is implicitly called when * the user presses the "Login" button. It is not explicitly called in this class: you * will not find a method invocation for it. * * @param theEvent the ActionEvent that triggered this method. */ private void loginButtonAction(final ActionEvent theEvent) { if (theEvent.getSource().getClass() != JButton.class) { throw new IllegalStateException(R.Strings.ERROR_MSG_ILLEGAL_INVOKE); } final String errorMsg = validateLoginFieldsEmpty(); if (errorMsg.isEmpty()) { LoginFrame.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); myRegisterButton.setEnabled(false); myLoginButton.setEnabled(false); new AttemptLoginWorker().execute(); } else { JOptionPane.showMessageDialog(this, errorMsg, R.Strings.ERROR_MSG_TITLE, JOptionPane.ERROR_MESSAGE); } } /** * Event handler for the Login Button during registration. This method is implicitly called * when the user presses the "Register and Login" button. It is not explicitly called in * this class: you will not find a method invocation for it. * * @param theEvent the ActionEvent that triggered this method. */ private void loginRegisterButtonAction(final ActionEvent theEvent) { if (theEvent.getSource().getClass() != JButton.class) { throw new IllegalStateException(R.Strings.ERROR_MSG_ILLEGAL_INVOKE); } final String errorMsg = validateLoginFieldsEmpty(); if (CredentialingLoader.comparePasswords(myPasswdField.getPassword(), myPasswdField2.getPassword())) { if (errorMsg.isEmpty()) { LoginFrame.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); myRegisterButton.setEnabled(false); myLoginButton.setEnabled(false); new AttemptRegistrationWorker().execute(); } else { JOptionPane.showMessageDialog(this, errorMsg, R.Strings.ERROR_MSG_TITLE, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, R.Strings.ERROR_MSG_PASSWORDS_NO_MATCH, R.Strings.ERROR_MSG_TITLE, JOptionPane.ERROR_MESSAGE); } } /** * Event handler for the Register Button. This method is implicitly called when * the user presses the "Register" button. It is not explicitly called in this class: you * will not find a method invocation for it. * * @param theEvent the ActionEvent that triggered this method. */ private void registerButtonAction(final ActionEvent theEvent) { if (theEvent.getSource().getClass() != JButton.class) { throw new IllegalStateException(R.Strings.ERROR_MSG_ILLEGAL_INVOKE); } myRegisterButton.setVisible(false); myFieldsPanel.setLayout(new GridLayout(R.Dimensions.LF_REGISTRATION_ROWS, R.Dimensions.LF_REGISTRATION_COLS)); final JLabel pwdLabel = new JLabel(R.Strings.LF_LABEL_PASSWORD_2); pwdLabel.setForeground(R.Colors.CONTENT_TEXT); myFieldsPanel.add(pwdLabel); myFieldsPanel.add(myPasswdField2); final JLabel campusLabel = new JLabel(R.Strings.LF_LABEL_CAMPUS); campusLabel.setForeground(R.Colors.CONTENT_TEXT); myFieldsPanel.add(campusLabel); myFieldsPanel.add(myCampusBox); myLoginButton.setText(R.Strings.LF_BUTTON_LOGIN_REGISTRATION); myLoginButton.removeActionListener(myLoginButton.getActionListeners()[0]); myLoginButton.addActionListener(this::loginRegisterButtonAction); pack(); } /* Inner Classes follow */ /** * A worker thread to attempt register user. * * NOTE: THERE ARE NO ERRORS/BUGS IN THIS INNER CLASS * * Operations that may take a long time to complete (like file I/O or network connections) * should be performed in a thread separate from the user interface thread. This will keep * your graphical user interface responsive to user interactions. * * This inner class starts a background thread to perform the file I/O operations found in * io.Credentialing.java * * @author Charles Bryan * */ private class AttemptRegistrationWorker extends SwingWorker<String, Integer> { /** The campus of the user registering in. */ private String myCampus; @Override public String doInBackground() { myCampus = myCampusBox.getItemAt(myCampusBox.getSelectedIndex()); return CredentialingLoader.register(myUserNameField.getText(), myPasswdField.getPassword(), myCampus); } @Override public void done() { try { final String message = get(); if (message.isEmpty()) { new LoadInventoryWorker(myCampus).execute(); } else { LoginFrame.this.setCursor(Cursor.getDefaultCursor()); myRegisterButton.setEnabled(true); myLoginButton.setEnabled(true); JOptionPane.showMessageDialog(LoginFrame.this, message, R.Strings.ERROR_MSG_TITLE, JOptionPane.ERROR_MESSAGE); } } catch (final InterruptedException ex1) { ex1.printStackTrace(); } catch (final ExecutionException ex2) { ex2.printStackTrace(); } } } /** * A worker thread to attempt login. * * NOTE: THERE ARE NO ERRORS/BUGS IN THIS INNER CLASS * * Operations that may take a long time to complete (like file I/O or network connections) * should be performed in a thread separate from the user interface thread. This will keep * your graphical user interface responsive to user interactions. * * This inner class starts a background thread to perform the file I/O operations found in * io.Credentialing.java * * @author Charles Bryan * */ private class AttemptLoginWorker extends SwingWorker<String, Integer> { @Override public String doInBackground() { return CredentialingLoader.login(myUserNameField.getText(), myPasswdField.getPassword()); } @Override public void done() { try { final String campus = get(); if (campus.isEmpty()) { LoginFrame.this.setCursor(Cursor.getDefaultCursor()); myRegisterButton.setEnabled(true); myLoginButton.setEnabled(true); JOptionPane.showMessageDialog(LoginFrame.this, R.Strings.ERROR_MSG_CREDENTIALS, R.Strings.ERROR_MSG_TITLE, JOptionPane.ERROR_MESSAGE); } else { new LoadInventoryWorker(campus).execute(); } } catch (final InterruptedException ex1) { ex1.printStackTrace(); } catch (final ExecutionException ex2) { ex2.printStackTrace(); } } } /** * A worker thread to load the inventory files. * * NOTE: THERE ARE NO ERRORS/BUGS IN THIS INNER CLASS * * Operations that may take a long time to complete (like file I/O or network connections) * should be performed in a thread separate from the user interface thread. This will keep * your graphical user interface responsive to user interactions. * * This inner class starts a background thread to perform the file I/O operations found in * io.InventoryLoader.java * * @author Charles Bryan */ private class LoadInventoryWorker extends SwingWorker<Map<String, List<Item>>, Integer> { /** The campus of the user logging in. */ private final String myCampus; /** * Creates a worked to load the inventory file. * @param theCampus the campus of the user logging in */ LoadInventoryWorker(final String theCampus) { super(); myCampus = theCampus; } @Override public Map<String, List<Item>> doInBackground() { final Map<String, List<Item>> inventories = new HashMap<>(); final List<String> campusNames = InventoryLoader.readConfigurationFromFile(R.Strings.IO_FILE_LOCATION + R.Strings.IO_CONFIG_FILE); for (final String campusName : campusNames) { inventories.put(campusName, InventoryLoader. readItemsFromFile(R.Strings.IO_FILE_LOCATION + campusName.toLowerCase(Locale.ENGLISH) + R.Strings.IO_FILE_EXTENSION)); } return inventories; } @Override public void done() { LoginFrame.this.setCursor(Cursor.getDefaultCursor()); myRegisterButton.setEnabled(true); myLoginButton.setEnabled(true); EventQueue.invokeLater(new Runnable() { @Override public void run() { try { new BookstoreFrame(get(), myCampus); LoginFrame.this.dispose(); } catch (final InterruptedException ex1) { ex1.printStackTrace(); } catch (final ExecutionException ex2) { ex2.printStackTrace(); } } }); } } }
ganghuan-bookstore/.svn/pristine/6e/6eb43875f3a14d6c27fa171c6cfd677d853c647d.svn-base
/* * TCSS - Autumn 2019 * Assignment 1 - Online BookStore */ package model; import java.math.BigDecimal; import java.text.NumberFormat; import java.util.Locale; /** * This program is an object class called item which stores information * about individual item. * @author Ganghuan Huang * @version 18/10/2019 */ public final class Item { /** * private fields */ private final String iName; private final BigDecimal iPrice; private int packQuantity; private BigDecimal packPrice; /** * constructor for items without packprice. * @param iName * @param iPrice * @throws throw exception if name is empty and price is negative */ public Item(final String iName, final BigDecimal iPrice) { this.iName = iName; this.iPrice = iPrice; if (iName.isEmpty()) { throw new IllegalArgumentException("item name cannot be tmpty"); } if (iPrice.compareTo(BigDecimal.ZERO) == -1) { throw new IllegalArgumentException("item price cannot be negative"); } } /** * constructor for items with packprice. * @param iName * @param iPrice * @param packQuantity * @param packPrice * @throws throw exception if name is empty and price is negative */ public Item(final String iName, final BigDecimal iPrice, final int packQuantity, final BigDecimal packPrice) { this(iName, iPrice); if (packQuantity < 0) { throw new IllegalArgumentException("packQuantity cannot be less than 0"); } if (packPrice.compareTo(BigDecimal.ZERO) == -1) { throw new IllegalArgumentException( "packprice cannot be negative"); } this.packQuantity = packQuantity; this.packPrice = packPrice; } /** * get the price. * @return */ public BigDecimal getPrice() { return iPrice; } /** * get the packQuantity. * @return */ public int getBulkQuantity() { return packQuantity; } /** * get the packPrice. * @return */ public BigDecimal getBulkPrice() { return packPrice; } /** * check if the item available for pack price. * @return */ public boolean isBulk() { return (packQuantity != 0) && (packPrice != null); } /** * do the calculation for items * @param theQuantity * @return */ public BigDecimal calculateItemTotal(final int theQuantity){ BigDecimal itemTotal = BigDecimal.ZERO; if ((packQuantity != 0) && (packPrice != null)){ if (theQuantity < packQuantity){ itemTotal = iPrice.multiply(new BigDecimal(theQuantity)); } else { final int extras = theQuantity % packQuantity; final int numbOfBulks = (int) (theQuantity / packQuantity); if (extras > 0) { itemTotal = new BigDecimal(numbOfBulks).multiply(packPrice).add(new BigDecimal(extras).multiply(iPrice)); } if (extras == 0){ itemTotal = new BigDecimal(numbOfBulks).multiply(packPrice); } } } itemTotal = iPrice.multiply(new BigDecimal(theQuantity)); return itemTotal; } @Override public String toString() { final NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US); final StringBuilder sb = new StringBuilder(); sb.append(iName); sb.append(", "); sb.append(nf.format(iPrice)); if ((packQuantity != 0) && (packPrice != null)) { sb.append(" (" + packQuantity + " for " + nf.format(packPrice) + ")"); } return sb.toString(); } /** * check if the specified object is equivalent to this Item. */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Item itm = (Item) obj; if (packPrice == null){ if (itm.packPrice != null) { return false; } else if (!packPrice.equals(itm.packPrice)) { return false; } if (packQuantity != itm.packQuantity) { return false; } if (iPrice == null) { if (itm.iPrice != null) { return false; } }else if (!iPrice.equals(itm.iPrice)) { return false; } if (iName == null) { if (itm.iName != null) { return false; } } else if (!iName.equals(itm.iName)) { return false; } } return true; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((packPrice == null) ? 0 : packPrice.hashCode()); result = prime * result + packQuantity; result = prime * result + ((iPrice == null) ? 0 : iPrice.hashCode()); result = prime * result + ((iName == null) ? 0 : iName.hashCode()); return result; } }
ganghuan-bookstore/.svn/pristine/70/7060cf00e6ea3db2958241a958b8eb6897f556a1.svn-base
Jolly Ranchers;0.50;6;2.50 Laffy Taffy;0.50;6;2.50 Snickers Bar;1.00 Heath Bar;1.00 Bottled Water;1.00 Turkey Sandwich;4.99 Tim's Chips;1.24
ganghuan-bookstore/.svn/pristine/7c/7c0bd76a4b44747bf416498ce7057718a527c0ca.svn-base
ganghuan-bookstore/.svn/pristine/83/837d2a855c97ba4337f1b5c2886fb97dd806fb1a.svn-base
ganghuan-bookstore/.svn/pristine/83/839854d770b29d2df154bd9220857553b6c71679.svn-base
eclipse.preferences.version=1 formatter_profile=_TCSS 305 Next Line Format formatter_settings_version=17 org.eclipse.jdt.ui.text.custom_code_templates=
ganghuan-bookstore/.svn/pristine/90/90b7420c31bf006ac1bc079bcddc60a89d13197e.svn-base
#FindBugs User Preferences #Wed Sep 17 04:06:17 PDT 2014 cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true detectorAtomicityProblem=AtomicityProblem|true detectorBCPMethodReturnCheck=BCPMethodReturnCheck|false detectorBadAppletConstructor=BadAppletConstructor|false detectorBadResultSetAccess=BadResultSetAccess|true detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true detectorBadUseOfReturnValue=BadUseOfReturnValue|true detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true detectorBooleanReturnNull=BooleanReturnNull|true detectorBuildInterproceduralCallGraph=BuildInterproceduralCallGraph|false detectorBuildObligationPolicyDatabase=BuildObligationPolicyDatabase|true detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false detectorCalledMethods=CalledMethods|true detectorCheckCalls=CheckCalls|false detectorCheckExpectedWarnings=CheckExpectedWarnings|false detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true detectorCheckTypeQualifiers=CheckTypeQualifiers|true detectorCloneIdiom=CloneIdiom|true detectorComparatorIdiom=ComparatorIdiom|true detectorConfusedInheritance=ConfusedInheritance|true detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true detectorCrossSiteScripting=CrossSiteScripting|true detectorDefaultEncodingDetector=DefaultEncodingDetector|true detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true detectorDontUseEnum=DontUseEnum|true detectorDroppedException=DroppedException|true detectorDumbMethodInvocations=DumbMethodInvocations|true detectorDumbMethods=DumbMethods|true detectorDuplicateBranches=DuplicateBranches|true detectorEmptyZipFileEntry=EmptyZipFileEntry|true detectorEqStringTest=EqStringTest|false detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true detectorExplicitSerialization=ExplicitSerialization|true detectorFieldItemSummary=FieldItemSummary|true detectorFinalizerNullsFields=FinalizerNullsFields|true detectorFindBadCast=FindBadCast|false detectorFindBadCast2=FindBadCast2|true detectorFindBadEqualsImplementation=FindBadEqualsImplementation|false detectorFindBadForLoop=FindBadForLoop|true detectorFindBugsSummaryStats=FindBugsSummaryStats|true detectorFindCircularDependencies=FindCircularDependencies|false detectorFindDeadLocalStores=FindDeadLocalStores|true detectorFindDoubleCheck=FindDoubleCheck|true detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true detectorFindFinalizeInvocations=FindFinalizeInvocations|true detectorFindFloatEquality=FindFloatEquality|true detectorFindFloatMath=FindFloatMath|false detectorFindHEmismatch=FindHEmismatch|true detectorFindInconsistentSync2=FindInconsistentSync2|true detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true detectorFindMaskedFields=FindMaskedFields|true detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true detectorFindNakedNotify=FindNakedNotify|true detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true detectorFindNonShortCircuit=FindNonShortCircuit|true detectorFindNullDeref=FindNullDeref|true detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true detectorFindOpenStream=FindOpenStream|true detectorFindPuzzlers=FindPuzzlers|true detectorFindRefComparison=FindRefComparison|true detectorFindReturnRef=FindReturnRef|true detectorFindRoughConstants=FindRoughConstants|true detectorFindRunInvocations=FindRunInvocations|true detectorFindSelfComparison=FindSelfComparison|true detectorFindSelfComparison2=FindSelfComparison2|true detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true detectorFindSpinLoop=FindSpinLoop|true detectorFindSqlInjection=FindSqlInjection|true detectorFindTwoLockWait=FindTwoLockWait|true detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true detectorFindUnconditionalWait=FindUnconditionalWait|true detectorFindUninitializedGet=FindUninitializedGet|true detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true detectorFindUnreleasedLock=FindUnreleasedLock|true detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true detectorFindUnsyncGet=FindUnsyncGet|true detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true detectorFindUselessControlFlow=FindUselessControlFlow|true detectorFormatStringChecker=FormatStringChecker|true detectorHugeSharedStringConstants=HugeSharedStringConstants|true detectorIDivResultCastToDouble=IDivResultCastToDouble|true detectorIncompatMask=IncompatMask|true detectorInconsistentAnnotations=InconsistentAnnotations|true detectorInefficientIndexOf=InefficientIndexOf|true detectorInefficientMemberAccess=InefficientMemberAccess|false detectorInefficientToArray=InefficientToArray|true detectorInfiniteLoop=InfiniteLoop|true detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true detectorInitializationChain=InitializationChain|true detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true detectorInstantiateStaticClass=InstantiateStaticClass|true detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true detectorInvalidJUnitTest=InvalidJUnitTest|true detectorIteratorIdioms=IteratorIdioms|true detectorLazyInit=LazyInit|true detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true detectorLockedFields=LockedFields|false detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true detectorMethodReturnCheck=MethodReturnCheck|true detectorMethods=Methods|true detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true detectorMutableLock=MutableLock|true detectorMutableStaticFields=MutableStaticFields|true detectorNaming=Naming|true detectorNoise=Noise|false detectorNoiseNullDeref=NoiseNullDeref|false detectorNoteAnnotationRetention=NoteAnnotationRetention|true detectorNoteCheckReturnValue=NoteCheckReturnValue|true detectorNoteCheckReturnValueAnnotations=NoteCheckReturnValueAnnotations|true detectorNoteDirectlyRelevantTypeQualifiers=NoteDirectlyRelevantTypeQualifiers|true detectorNoteJCIPAnnotation=NoteJCIPAnnotation|true detectorNoteNonNullAnnotations=NoteNonNullAnnotations|true detectorNoteNonnullReturnValues=NoteNonnullReturnValues|true detectorNoteSuppressedWarnings=NoteSuppressedWarnings|true detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true detectorNumberConstructor=NumberConstructor|true detectorOptionalReturnNull=OptionalReturnNull|true detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true detectorPublicSemaphores=PublicSemaphores|false detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true detectorRedundantInterfaces=RedundantInterfaces|true detectorReflectiveClasses=ReflectiveClasses|true detectorRepeatedConditionals=RepeatedConditionals|true detectorResolveAllReferences=ResolveAllReferences|false detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true detectorSerializableIdiom=SerializableIdiom|true detectorStartInConstructor=StartInConstructor|true detectorStaticCalendarDetector=StaticCalendarDetector|true detectorStringConcatenation=StringConcatenation|true detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true detectorSwitchFallthrough=SwitchFallthrough|true detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true detectorTestASM=TestASM|false detectorTestDataflowAnalysis=TestDataflowAnalysis|false detectorTestingGround=TestingGround|false detectorTrainFieldStoreTypes=TrainFieldStoreTypes|true detectorTrainNonNullAnnotations=TrainNonNullAnnotations|true detectorTrainUnconditionalDerefParams=TrainUnconditionalDerefParams|true detectorURLProblems=URLProblems|true detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true detectorUnnecessaryMath=UnnecessaryMath|true detectorUnreadFields=UnreadFields|true detectorUseObjectEquals=UseObjectEquals|false detectorUselessSubclassMethod=UselessSubclassMethod|false detectorVarArgsProblems=VarArgsProblems|true detectorVolatileUsage=VolatileUsage|true detectorWaitInLoop=WaitInLoop|true detectorWrongMapIterator=WrongMapIterator|true detectorXMLFactoryBypass=XMLFactoryBypass|true detector_threshold=2 effort=default filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|15 filter_settings_neg=EXPERIMENTAL,NOISE| run_at_full_build=true
ganghuan-bookstore/.svn/pristine/92/92139a75ed86f7995a667bd35cdec234acf862f1.svn-base
ganghuan-bookstore/.svn/pristine/9a/9a02b17caed240c742fa83e8070516c4c26dd224.svn-base
ganghuan-bookstore/.svn/pristine/9e/9e48f26e7cdbc7b8d2f1b1ec738bb89ca2284c3d.svn-base
eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false org.eclipse.jdt.core.formatter.align_with_spaces=false org.eclipse.jdt.core.formatter.alignment_for_additive_operator=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=16 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=18 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 org.eclipse.jdt.core.formatter.alignment_for_logical_operator=18 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=18 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=18 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=1 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=next_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=true org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=4 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=95 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
ganghuan-bookstore/.svn/pristine/a2/a2f41cf6233c352987a7163f68b60c0bce16e538.svn-base
package io; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.nio.file.Paths; import java.util.Scanner; import res.R; /** * A utility class for The shopping cart application. * * * @author Charles Bryan * @version September 2019 */ public final class CredentialingLoader { /** * A private constructor, to prevent external instantiation. */ private CredentialingLoader() { } /** * Attempts to match a user name and password with the information stored in the * credentialing system. * * @param theUsername the user name to attempt * @param thePassword the password to attempt * @return the users campus or the empty String if login is unsuccessful */ public static String login(final String theUsername, final char[] thePassword) { String result = ""; try (Scanner input = new Scanner(Paths.get(R.Strings.IO_FILE_LOCATION + R.Strings.IO_CREDENTIALS_FILE))) { while (input.hasNextLine()) { final String lineAsString = input.nextLine(); if (!lineAsString.startsWith(R.Strings.IO_FILE_COMMENT)) { final String[] parts = lineAsString.split(R.Strings.IO_FILE_DELIMITER); final String username = parts[R.Indicies.UF_USERNAME]; if (username.equals(theUsername)) { final char[] password = parts[R.Indicies.UF_USERNAME].toCharArray(); final String campus = parts[R.Indicies.UF_CAMPUS]; if (comparePasswords(password, thePassword)) { result = campus; break; } } } } } catch (final IOException e) { e.printStackTrace(); } // no file return result; } /** * Given two passwords, return true iff both have the exact same number, characters, and * order. * * @param pwd1 the first password * @param pwd2 the second password * @return true iff both have the exact same number, characters, and order, false * otherwise */ public static boolean comparePasswords(final char[] pwd1, final char[] pwd2) { boolean same = pwd1.length == pwd2.length; if (same) { for (int i = 0; i < pwd1.length && same; i++) { same &= pwd1[i] == pwd2[i]; } } return same; } /** * Attempts to add a new user to the credentials file. Note, this method does not perform * validation. Any and all validation must be performed before calling this method. * * @param theUsername the user name to add * @param thePassword the password associated to the user name * @param theCampus the campus associated to the user name * @return empty String if written, an error message otherwise */ public static String register(final String theUsername, final char[] thePassword, final String theCampus) { String result = ""; if (checkIfUserExists(theUsername)) { result = R.Strings.ERROR_MSG_USER_EXISTS; } else { try (PrintWriter printWriter = new PrintWriter(new FileWriter( Paths.get(R.Strings.IO_FILE_LOCATION + R.Strings.IO_CREDENTIALS_FILE). toFile(), true))) { printWriter.append(theUsername); printWriter.append(R.Strings.IO_FILE_DELIMITER); printWriter.append(theCampus); printWriter.append(R.Strings.IO_FILE_DELIMITER); for (final char c : thePassword) { printWriter.append(c); } printWriter.append(System.lineSeparator()); } catch (final IOException ioException) { ioException.printStackTrace(); result = ioException.getMessage(); } } return result; } /** * Attempts to find the user name stored in the credentialing system. * * @param theUsername the user name to look for * @return true if the user name already exists, false otherwise */ private static boolean checkIfUserExists(final String theUsername) { boolean found = false; try (Scanner input = new Scanner(Paths.get(R.Strings.IO_FILE_LOCATION + R.Strings.IO_CREDENTIALS_FILE))) { while (input.hasNextLine() && found) { final String lineAsString = input.nextLine(); if (!lineAsString.startsWith(R.Strings.IO_FILE_COMMENT)) { found = theUsername.equals(lineAsString.split( R.Strings.IO_FILE_DELIMITER)[R.Indicies.UF_USERNAME]); } } } catch (final IOException e) { e.printStackTrace(); } // no file return found; } }
ganghuan-bookstore/.svn/pristine/a6/a60a4d159eeb6e3bf35db6c28e4a1714ea3e01b4.svn-base
/* * TCSS 305 Assignment 2 - UW Bookstore */ package io; import java.io.IOException; import java.math.BigDecimal; import java.nio.file.Paths; import java.util.LinkedList; import java.util.List; import java.util.Scanner; import model.Item; import res.R; /** * A utility class for The shopping cart application. * * @author Charles Bryan * @version Autumn 2015 */ public final class InventoryLoader { /** * A private constructor, to prevent external instantiation. */ private InventoryLoader() { } /** * Reads item information from a file and returns a List of Item objects. * @param theFile the name of the file to load into a List of Items * @return a List of Item objects created from data in an input file */ public static List<Item> readItemsFromFile(final String theFile) { final List<Item> items = new LinkedList<>(); try (Scanner input = new Scanner(Paths.get(theFile))) { while (input.hasNextLine()) { final String[] parts = input.nextLine().split(R.Strings.IO_FILE_DELIMITER); final String itemName = parts[R.Indicies.IF_ITEM_NAME]; final BigDecimal itemPrice = new BigDecimal(parts[R.Indicies.IF_ITEM_PRICE]); if (parts.length > 2) { final int bulkQuantity = Integer.valueOf(parts[R.Indicies.IF_ITEM_BULK_QUANITIY]); final BigDecimal bulkPrice = new BigDecimal(parts[R.Indicies.IF_ITEM_BULK_PRICE]); items.add(new Item(itemName, itemPrice, bulkQuantity, bulkPrice)); } else { items.add(new Item(itemName, itemPrice)); } } } catch (final IOException e) { e.printStackTrace(); } return items; } /** * Reads item information from a file and returns a List of Item objects. * @param theFile the name of the file to load into a List of Items * @return a List of Item objects created from data in an input file */ public static List<String> readConfigurationFromFile(final String theFile) { final List<String> results = new LinkedList<>(); try (Scanner input = new Scanner(Paths.get(theFile))) { while (input.hasNextLine()) { final String line = input.nextLine(); if (!line.startsWith(R.Strings.IO_FILE_COMMENT)) { results.add(line); } } } catch (final IOException e) { e.printStackTrace(); } return results; } }
ganghuan-bookstore/.svn/pristine/ae/aece88e6cea8005bb6535b63f625687b36aaaa71.svn-base
Apple iPad8;499.99 Nexus 6P;479.99 Nexus 5X;399.99 Samsung S6 Edge;649.99 Microsoft Surface Pro;899.99 Microsoft Surface;499.99
ganghuan-bookstore/.svn/pristine/b8/b85eb2e2bbd19fb0a7cd25ea1c3049686ba105d7.svn-base
/* * TCSS - Autumn 2019 * Assignment 1 - Online BookStore */ package model; import java.math.BigDecimal; public final class ItemOrder { private final Item item; private final int theQuanity; public ItemOrder(final Item theItem, final int theQuantity) { if (theQuantity < 0) { throw new IllegalArgumentException("The item quantity can't less than 0"); } item = theItem; theQuanity = theQuantity; } public BigDecimal calculateOrderTotal() { return item.calculateItemTotal(theQuanity); } public Item getItem() { return item; } public int getQuantity() { return theQuanity; } @Override public String toString() { final StringBuilder sb = new StringBuilder(22); sb.append("Item: "); sb.append(item); sb.append(", quantity is: "); sb.append(theQuanity); return sb.toString(); } }
ganghuan-bookstore/.svn/pristine/d6/d60598de14e3b76f5bb72e9d103164b9a60c0cb3.svn-base
ganghuan-bookstore/.svn/pristine/da/dab74ddbf57fb5fdc98a08fbad2e38f60548aec0.svn-base
ganghuan-bookstore/.svn/pristine/e5/e50db3eea6127f268c205aac2387e0d85b5b0b81.svn-base
UW Note pad;4.41;6;10.04 'Java Rules!' button;0.95;10;5.00 'Java Rules!' bumper sticker;0.99;20;8.95 Computer science pen;2.00 3 Ring Binder;9.99 Effective Java 3rd Ed;18.01 Core Java Vol I 11th Ed;54.99 Ipad;349.95 Surface Pro;399.00 Chromebook;399.00 Macbook Pro;1297.99
ganghuan-bookstore/.svn/pristine/e7/e713cfcee9ccdc53e17cc68158bd01d906b20f2c.svn-base
ganghuan-bookstore/.svn/pristine/ed/edb1a38248964c37f093354500b7a4e6f9d79e2f.svn-base
ganghuan-bookstore/.svn/wc.db
ganghuan-bookstore/bin/.DS_Store
ganghuan-bookstore/bin/appliation/BookstoreMain$1.class
ganghuan-bookstore/bin/appliation/BookstoreMain.class
ganghuan-bookstore/bin/io/CredentialingLoader.class
ganghuan-bookstore/bin/io/InventoryLoader.class
ganghuan-bookstore/bin/model/Cart.class
ganghuan-bookstore/bin/model/Item.class
ganghuan-bookstore/bin/model/ItemOrder.class
ganghuan-bookstore/bin/res/R$Colors.class
ganghuan-bookstore/bin/res/R$Dimensions.class
ganghuan-bookstore/bin/res/R$Indicies.class
ganghuan-bookstore/bin/res/R$Strings.class
ganghuan-bookstore/bin/res/R.class
ganghuan-bookstore/bin/view/BookstoreFrame$1.class
ganghuan-bookstore/bin/view/BookstoreFrame.class
ganghuan-bookstore/bin/view/LoginFrame$AttemptLoginWorker.class
ganghuan-bookstore/bin/view/LoginFrame$AttemptRegistrationWorker.class
ganghuan-bookstore/bin/view/LoginFrame$LoadInventoryWorker$1.class
ganghuan-bookstore/bin/view/LoginFrame$LoadInventoryWorker.class
ganghuan-bookstore/bin/view/LoginFrame.class
ganghuan-bookstore/files/bothell.txt
Jolly Ranchers;0.50;6;2.50 Laffy Taffy;0.50;6;2.50 Snickers Bar;1.00 Heath Bar;1.00 Bottled Water;1.00 Turkey Sandwich;4.99 Tim's Chips;1.24
ganghuan-bookstore/files/config.txt
#place an * in front of the campus that the application should start with. #There should be no space in between the * and the campus name. #if multiple campuses have an *, the last one read will become the start campus. Bothell Seattle Tacoma
ganghuan-bookstore/files/seattle.txt
Apple iPad8;499.99 Nexus 6P;479.99 Nexus 5X;399.99 Samsung S6 Edge;649.99 Microsoft Surface Pro;899.99 Microsoft Surface;499.99
ganghuan-bookstore/files/tacoma.txt
UW Note pad;4.41;6;10.04 'Java Rules!' button;0.95;10;5.00 'Java Rules!' bumper sticker;0.99;20;8.95 Computer science pen;2.00 3 Ring Binder;9.99 Effective Java 3rd Ed;18.01 Core Java Vol I 11th Ed;54.99 Ipad;349.95 Surface Pro;399.00 Chromebook;399.00 Macbook Pro;1297.99
ganghuan-bookstore/files/users.txt
################################### # Users files. # # It is not a good idea to store # # passwords in a plain text file. # # We do it here to keep the # # application simple. # # # # uwnetid;passwd;campus # ################################### test;test;Tacoma test;Bothell;test ganghuan;Tacoma;Huang123321 ganghuan;Tacoma;hUANG123321 ganghuan;Tacoma;hUANG123321 huang;Tacoma;huang
ganghuan-bookstore/files/w.gif
ganghuan-bookstore/src/.DS_Store
ganghuan-bookstore/src/appliation/BookstoreMain.java
ganghuan-bookstore/src/appliation/BookstoreMain.java
/*
* TCSS 305 Assignment 2 - UW Bookstore
*/
package
appliation
;
import
io
.
InventoryLoader
;
import
java
.
awt
.
EventQueue
;
import
java
.
util
.
List
;
import
res
.
R
;
import
view
.
LoginFrame
;
/**
* BookstoreMain provides the main method for a simple shopping cart GUI
* displayer and calculator.
*
*
@author
Marty Stepp
*
@author
Daniel M. Zimmerman (Formatting and Comments)
*
@author
Alan Fowler (Numerous changes including use of BigDecimal and file input)
*
@author
Charles Bryan (Added multiple file loading options/changed name)
*
@version
Autumn 2018
*/
public
final
class
BookstoreMain
{
/**
* A private constructor, to prevent external instantiation.
*/
private
BookstoreMain
()
{
}
/**
* The main() method - displays and runs the bookstore GUI.
*
*
@param
theArgs Command line arguments, ignored by this program.
*/
public
static
void
main
(
final
String
...
theArgs
)
{
final
List
<
String
>
campusNames
=
InventoryLoader
.
readConfigurationFromFile
(
R
.
Strings
.
IO_FILE_LOCATION
+
R
.
Strings
.
IO_CONFIG_FILE
);
EventQueue
.
invokeLater
(
new
Runnable
()
{
@
Override
public
void
run
()
{
new
LoginFrame
(
campusNames
).
setVisible
(
true
);
}
});
}
// end main()
}
// end class BookstoreMain
ganghuan-bookstore/src/io/CredentialingLoader.java
ganghuan-bookstore/src/io/CredentialingLoader.java
package
io
;
import
java
.
io
.
FileWriter
;
import
java
.
io
.
IOException
;
import
java
.
io
.
PrintWriter
;
import
java
.
nio
.
file
.
Paths
;
import
java
.
util
.
Scanner
;
import
res
.
R
;
/**
* A utility class for The shopping cart application.
*
*
*
@author
Charles Bryan
*
@version
September 2019
*/
public
final
class
CredentialingLoader
{
/**
* A private constructor, to prevent external instantiation.
*/
private
CredentialingLoader
()
{
}
/**
* Attempts to match a user name and password with the information stored in the
* credentialing system.
*
*
@param
theUsername the user name to attempt
*
@param
thePassword the password to attempt
*
@return
the users campus or the empty String if login is unsuccessful
*/
public
static
String
login
(
final
String
theUsername
,
final
char
[]
thePassword
)
{
String
result
=
""
;
try
(
Scanner
input
=
new
Scanner
(
Paths
.
get
(
R
.
Strings
.
IO_FILE_LOCATION
+
R
.
Strings
.
IO_CREDENTIALS_FILE
)))
{
while
(
input
.
hasNextLine
())
{
final
String
lineAsString
=
input
.
nextLine
();
if
(
!
lineAsString
.
startsWith
(
R
.
Strings
.
IO_FILE_COMMENT
))
{
final
String
[]
parts
=
lineAsString
.
split
(
R
.
Strings
.
IO_FILE_DELIMITER
);
final
String
username
=
parts
[
R
.
Indicies
.
UF_USERNAME
];
if
(
username
.
equals
(
theUsername
))
{
final
char
[]
password
=
parts
[
R
.
Indicies
.
UF_USERNAME
].
toCharArray
();
final
String
campus
=
parts
[
R
.
Indicies
.
UF_CAMPUS
];
if
(
comparePasswords
(
password
,
thePassword
))
{
result
=
campus
;
break
;
}
}
}
}
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
// no file
return
result
;
}
/**
* Given two passwords, return true iff both have the exact same number, characters, and
* order.
*
*
@param
pwd1 the first password
*
@param
pwd2 the second password
*
@return
true iff both have the exact same number, characters, and order, false
* otherwise
*/
public
static
boolean
comparePasswords
(
final
char
[]
pwd1
,
final
char
[]
pwd2
)
{
boolean
same
=
pwd1
.
length
==
pwd2
.
length
;
if
(
same
)
{
for
(
int
i
=
0
;
i
<
pwd1
.
length
&&
same
;
i
++
)
{
same
&=
pwd1
[
i
]
==
pwd2
[
i
];
}
}
return
same
;
}
/**
* Attempts to add a new user to the credentials file. Note, this method does not perform
* validation. Any and all validation must be performed before calling this method.
*
*
@param
theUsername the user name to add
*
@param
thePassword the password associated to the user name
*
@param
theCampus the campus associated to the user name
*
@return
empty String if written, an error message otherwise
*/
public
static
String
register
(
final
String
theUsername
,
final
char
[]
thePassword
,
final
String
theCampus
)
{
String
result
=
""
;
if
(
checkIfUserExists
(
theUsername
))
{
result
=
R
.
Strings
.
ERROR_MSG_USER_EXISTS
;
}
else
{
try
(
PrintWriter
printWriter
=
new
PrintWriter
(
new
FileWriter
(
Paths
.
get
(
R
.
Strings
.
IO_FILE_LOCATION
+
R
.
Strings
.
IO_CREDENTIALS_FILE
).
toFile
(),
true
)))
{
printWriter
.
append
(
theUsername
);
printWriter
.
append
(
R
.
Strings
.
IO_FILE_DELIMITER
);
printWriter
.
append
(
theCampus
);
printWriter
.
append
(
R
.
Strings
.
IO_FILE_DELIMITER
);
for
(
final
char
c
:
thePassword
)
{
printWriter
.
append
(
c
);
}
printWriter
.
append
(
System
.
lineSeparator
());
}
catch
(
final
IOException
ioException
)
{
ioException
.
printStackTrace
();
result
=
ioException
.
getMessage
();
}
}
return
result
;
}
/**
* Attempts to find the user name stored in the credentialing system.
*
*
@param
theUsername the user name to look for
*
@return
true if the user name already exists, false otherwise
*/
private
static
boolean
checkIfUserExists
(
final
String
theUsername
)
{
boolean
found
=
false
;
try
(
Scanner
input
=
new
Scanner
(
Paths
.
get
(
R
.
Strings
.
IO_FILE_LOCATION
+
R
.
Strings
.
IO_CREDENTIALS_FILE
)))
{
while
(
input
.
hasNextLine
()
&&
found
)
{
final
String
lineAsString
=
input
.
nextLine
();
if
(
!
lineAsString
.
startsWith
(
R
.
Strings
.
IO_FILE_COMMENT
))
{
found
=
theUsername
.
equals
(
lineAsString
.
split
(
R
.
Strings
.
IO_FILE_DELIMITER
)[
R
.
Indicies
.
UF_USERNAME
]);
}
}
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
// no file
return
found
;
}
}
ganghuan-bookstore/src/io/InventoryLoader.java
ganghuan-bookstore/src/io/InventoryLoader.java
/*
* TCSS 305 Assignment 2 - UW Bookstore
*/
package
io
;
import
java
.
io
.
IOException
;
import
java
.
math
.
BigDecimal
;
import
java
.
nio
.
file
.
Paths
;
import
java
.
util
.
LinkedList
;
import
java
.
util
.
List
;
import
java
.
util
.
Scanner
;
import
model
.
Item
;
import
res
.
R
;
/**
* A utility class for The shopping cart application.
*
*
@author
Charles Bryan
*
@version
Autumn 2015
*/
public
final
class
InventoryLoader
{
/**
* A private constructor, to prevent external instantiation.
*/
private
InventoryLoader
()
{
}
/**
* Reads item information from a file and returns a List of Item objects.
*
@param
theFile the name of the file to load into a List of Items
*
@return
a List of Item objects created from data in an input file
*/
public
static
List
<
Item
>
readItemsFromFile
(
final
String
theFile
)
{
final
List
<
Item
>
items
=
new
LinkedList
<>
();
try
(
Scanner
input
=
new
Scanner
(
Paths
.
get
(
theFile
)))
{
while
(
input
.
hasNextLine
())
{
final
String
[]
parts
=
input
.
nextLine
().
split
(
R
.
Strings
.
IO_FILE_DELIMITER
);
final
String
itemName
=
parts
[
R
.
Indicies
.
IF_ITEM_NAME
];
final
BigDecimal
itemPrice
=
new
BigDecimal
(
parts
[
R
.
Indicies
.
IF_ITEM_PRICE
]);
if
(
parts
.
length
>
2
)
{
final
int
bulkQuantity
=
Integer
.
valueOf
(
parts
[
R
.
Indicies
.
IF_ITEM_BULK_QUANITIY
]);
final
BigDecimal
bulkPrice
=
new
BigDecimal
(
parts
[
R
.
Indicies
.
IF_ITEM_BULK_PRICE
]);
items
.
add
(
new
Item
(
itemName
,
itemPrice
,
bulkQuantity
,
bulkPrice
));
}
else
{
items
.
add
(
new
Item
(
itemName
,
itemPrice
));
}
}
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
return
items
;
}
/**
* Reads item information from a file and returns a List of Item objects.
*
@param
theFile the name of the file to load into a List of Items
*
@return
a List of Item objects created from data in an input file
*/
public
static
List
<
String
>
readConfigurationFromFile
(
final
String
theFile
)
{
final
List
<
String
>
results
=
new
LinkedList
<>
();
try
(
Scanner
input
=
new
Scanner
(
Paths
.
get
(
theFile
)))
{
while
(
input
.
hasNextLine
())
{
final
String
line
=
input
.
nextLine
();
if
(
!
line
.
startsWith
(
R
.
Strings
.
IO_FILE_COMMENT
))
{
results
.
add
(
line
);
}
}
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
return
results
;
}
}
ganghuan-bookstore/src/model/Cart.java
ganghuan-bookstore/src/model/Cart.java
/*
* TCSS - Autumn 2019
* Assignment 1 - Online BookStore
*/
package
model
;
import
java
.
util
.
*
;
import
java
.
math
.
RoundingMode
;
import
java
.
math
.
BigDecimal
;
public
class
Cart
{
// set the discount rate for members
private
static
final
BigDecimal
DISCOUNT
=
new
BigDecimal
(
".98805705"
);
private
Map
<
Item
,
BigDecimal
>
cart
;
private
boolean
memberShip
;
public
Cart
()
{
cart
=
new
HashMap
<
Item
,
BigDecimal
>
();
cart
=
new
HashMap
<
Item
,
BigDecimal
>
();
}
/**
* add the item
*
@param
theOrder
*/
public
void
add
(
final
ItemOrder
theOrder
)
{
cart
.
put
(
theOrder
.
getItem
(),
theOrder
.
calculateOrderTotal
());
}
public
void
setMembership
(
final
boolean
theMembership
)
{
memberShip
=
theMembership
;
}
/**
* calculate with membership
*
@return
*/
public
BigDecimal
calculateTotal
()
{
BigDecimal
orderTotal
=
BigDecimal
.
ZERO
;
final
Iterator
<
Item
>
iterator
=
cart
.
keySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
final
BigDecimal
currentOrderPrice
=
cart
.
get
(
iterator
.
next
());
orderTotal
=
orderTotal
.
add
(
currentOrderPrice
);
}
if
(
memberShip
)
{
orderTotal
=
DISCOUNT
.
multiply
(
orderTotal
);
}
return
orderTotal
.
setScale
(
2
,
RoundingMode
.
HALF_EVEN
);
}
/**
* clean all orders
*/
public
void
clear
()
{
cart
=
new
HashMap
<
Item
,
BigDecimal
>
();
}
public
int
getCartSize
()
{
return
-
1
;
}
/**
* to string method
*/
@
Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
cart
);
return
sb
.
toString
();
}
}
ganghuan-bookstore/src/model/Item.java
ganghuan-bookstore/src/model/Item.java
/*
* TCSS - Autumn 2019
* Assignment 1 - Online BookStore
*/
package
model
;
import
java
.
math
.
BigDecimal
;
import
java
.
text
.
NumberFormat
;
import
java
.
util
.
Locale
;
/**
* This program is an object class called item which stores information
* about individual item.
*
@author
Ganghuan Huang
*
@version
18/10/2019
*/
public
final
class
Item
{
/**
* private fields
*/
private
final
String
iName
;
private
final
BigDecimal
iPrice
;
private
int
packQuantity
;
private
BigDecimal
packPrice
;
/**
* constructor for items without packprice.
*
@param
iName
*
@param
iPrice
*
@throws
throw exception if name is empty and price is negative
*/
public
Item
(
final
String
iName
,
final
BigDecimal
iPrice
)
{
this
.
iName
=
iName
;
this
.
iPrice
=
iPrice
;
if
(
iName
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"item name cannot be tmpty"
);
}
if
(
iPrice
.
compareTo
(
BigDecimal
.
ZERO
)
==
-
1
)
{
throw
new
IllegalArgumentException
(
"item price cannot be negative"
);
}
}
/**
* constructor for items with packprice.
*
@param
iName
*
@param
iPrice
*
@param
packQuantity
*
@param
packPrice
*
@throws
throw exception if name is empty and price is negative
*/
public
Item
(
final
String
iName
,
final
BigDecimal
iPrice
,
final
int
packQuantity
,
final
BigDecimal
packPrice
)
{
this
(
iName
,
iPrice
);
if
(
packQuantity
<
0
)
{
throw
new
IllegalArgumentException
(
"packQuantity cannot be less than 0"
);
}
if
(
packPrice
.
compareTo
(
BigDecimal
.
ZERO
)
==
-
1
)
{
throw
new
IllegalArgumentException
(
"packprice cannot be negative"
);
}
this
.
packQuantity
=
packQuantity
;
this
.
packPrice
=
packPrice
;
}
/**
* get the price.
*
@return
*/
public
BigDecimal
getPrice
()
{
return
iPrice
;
}
/**
* get the packQuantity.
*
@return
*/
public
int
getBulkQuantity
()
{
return
packQuantity
;
}
/**
* get the packPrice.
*
@return
*/
public
BigDecimal
getBulkPrice
()
{
return
packPrice
;
}
/**
* check if the item available for pack price.
*
@return
*/
public
boolean
isBulk
()
{
return
(
packQuantity
!=
0
)
&&
(
packPrice
!=
null
);
}
/**
* do the calculation for items
*
@param
theQuantity
*
@return
*/
public
BigDecimal
calculateItemTotal
(
final
int
theQuantity
){
BigDecimal
itemTotal
=
BigDecimal
.
ZERO
;
if
((
packQuantity
!=
0
)
&&
(
packPrice
!=
null
)){
if
(
theQuantity
<
packQuantity
){
itemTotal
=
iPrice
.
multiply
(
new
BigDecimal
(
theQuantity
));
}
else
{
final
int
extras
=
theQuantity
%
packQuantity
;
final
int
numbOfBulks
=
(
int
)
(
theQuantity
/
packQuantity
);
if
(
extras
>
0
)
{
itemTotal
=
new
BigDecimal
(
numbOfBulks
).
multiply
(
packPrice
).
add
(
new
BigDecimal
(
extras
).
multiply
(
iPrice
));
}
if
(
extras
==
0
){
itemTotal
=
new
BigDecimal
(
numbOfBulks
).
multiply
(
packPrice
);
}
}
}
itemTotal
=
iPrice
.
multiply
(
new
BigDecimal
(
theQuantity
));
return
itemTotal
;
}
@
Override
public
String
toString
()
{
final
NumberFormat
nf
=
NumberFormat
.
getCurrencyInstance
(
Locale
.
US
);
final
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
iName
);
sb
.
append
(
", "
);
sb
.
append
(
nf
.
format
(
iPrice
));
if
((
packQuantity
!=
0
)
&&
(
packPrice
!=
null
))
{
sb
.
append
(
" ("
+
packQuantity
+
" for "
+
nf
.
format
(
packPrice
)
+
")"
);
}
return
sb
.
toString
();
}
/**
* check if the specified object is equivalent to this Item.
*/
@
Override
public
boolean
equals
(
final
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
Item
itm
=
(
Item
)
obj
;
if
(
packPrice
==
null
){
if
(
itm
.
packPrice
!=
null
)
{
return
false
;
}
else
if
(
!
packPrice
.
equals
(
itm
.
packPrice
))
{
return
false
;
}
if
(
packQuantity
!=
itm
.
packQuantity
)
{
return
false
;
}
if
(
iPrice
==
null
)
{
if
(
itm
.
iPrice
!=
null
)
{
return
false
;
}
}
else
if
(
!
iPrice
.
equals
(
itm
.
iPrice
))
{
return
false
;
}
if
(
iName
==
null
)
{
if
(
itm
.
iName
!=
null
)
{
return
false
;
}
}
else
if
(
!
iName
.
equals
(
itm
.
iName
))
{
return
false
;
}
}
return
true
;
}
@
Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
packPrice
==
null
)
?
0
:
packPrice
.
hashCode
());
result
=
prime
*
result
+
packQuantity
;
result
=
prime
*
result
+
((
iPrice
==
null
)
?
0
:
iPrice
.
hashCode
());
result
=
prime
*
result
+
((
iName
==
null
)
?
0
:
iName
.
hashCode
());
return
result
;
}
}
ganghuan-bookstore/src/model/ItemOrder.java
ganghuan-bookstore/src/model/ItemOrder.java
/*
* TCSS - Autumn 2019
* Assignment 1 - Online BookStore
*/
package
model
;
import
java
.
math
.
BigDecimal
;
public
final
class
ItemOrder
{
private
final
Item
item
;
private
final
int
theQuanity
;
/**
*
*
@param
theItem
*
@param
theQuantity
*
@throws
throw exception id quantity is less than 0
*/
public
ItemOrder
(
final
Item
theItem
,
final
int
theQuantity
)
{
if
(
theQuantity
<
0
)
{
throw
new
IllegalArgumentException
(
"The item quantity can't less than 0"
);
}
item
=
theItem
;
theQuanity
=
theQuantity
;
}
/**
* calculate the total use calculate method from item class
*
@return
*/
public
BigDecimal
calculateOrderTotal
()
{
return
item
.
calculateItemTotal
(
theQuanity
);
}
public
Item
getItem
()
{
return
item
;
}
public
int
getQuantity
()
{
return
theQuanity
;
}
/**
* tostring override
*/
@
Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
22
);
sb
.
append
(
"Item: "
);
sb
.
append
(
item
);
sb
.
append
(
", quantity is: "
);
sb
.
append
(
theQuanity
);
return
sb
.
toString
();
}
}
ganghuan-bookstore/src/res/R.java
ganghuan-bookstore/src/res/R.java
package
res
;
import
java
.
awt
.
Color
;
/**
* Resources class.
*
* General convention: constant starts with the abbreviation for the class it is associated
* with.
*
* LoginFrame == LF
* BookstoreFrame == BS
*
*
@author
Charles Bryan
*
@version
7 September 2019
*/
public
class
R
{
/**
* Resource class for color schemes.
*
*
@author
Charles Bryan
*
@version
7 September 2019
*/
public
static
class
Colors
{
/*
* For the UW color palate and other UW branding information see
* http://www.washington.edu/marketing/files/2012/09/WebColorPalette1.pdf
*/
/** The background color for content containers. */
public
static
final
Color
CONTENT_BG
=
new
Color
(
199
,
153
,
0
);
// UW Gold
/** The background color for headers and footers. */
public
static
final
Color
HEADER_FOOTER_BG
=
new
Color
(
57
,
39
,
91
);
// UW Purple
/** The text color for content containers. */
public
static
final
Color
CONTENT_TEXT
=
HEADER_FOOTER_BG
;
/** The text color for headers and footers. */
public
static
final
Color
HEADER_FOOTER_TEXT
=
Color
.
WHITE
;
/** The text color for background of text fields on error. */
public
static
final
Color
ERROR_TEXT_FIELD_BG
=
Color
.
PINK
;
/** The text color for background of text fields on without error. */
public
static
final
Color
NO_ERROR_TEXT_FIELD_BG
=
Color
.
WHITE
;
}
/**
* Resource class for Array index values.
*
* File Name nicknames:
* Items File == IF
* Users File == UF
*
@author
Charles Bryan
*
@version
7 September 2019
*/
public
static
class
Indicies
{
/** The index of the Item name in the Items files. */
public
static
final
int
IF_ITEM_NAME
=
0
;
/** The index of the Item price in the Items files. */
public
static
final
int
IF_ITEM_PRICE
=
1
;
/** The index of the Item bulk quantity in the Items files. */
public
static
final
int
IF_ITEM_BULK_QUANITIY
=
2
;
/** The index of the Item bulk price in the Items files. */
public
static
final
int
IF_ITEM_BULK_PRICE
=
3
;
/** The index of the user name in the credentials files. */
public
static
final
int
UF_USERNAME
=
0
;
/** The index of the password in the credentials files. */
public
static
final
int
UF_PASSWORD
=
1
;
/** The index of the campus in the credentials files. */
public
static
final
int
UF_CAMPUS
=
2
;
}
/**
* Resource class for dimensions.
*
*
@author
Charles Bryan
*
@version
7 September 2019
*/
public
static
class
Dimensions
{
/** The number of rows in the Login Frame: status login. */
public
static
final
int
LF_LOGIN_ROWS
=
2
;
/** The number of columns in the Login Frame: status login. */
public
static
final
int
LF_LOGIN_COLS
=
2
;
/** The number of rows in the Login Frame: status register. */
public
static
final
int
LF_REGISTRATION_ROWS
=
4
;
/** The number of columns in the Login Frame: status register. */
public
static
final
int
LF_REGISTRATION_COLS
=
2
;
/** The number of columns for Item Panels in the Bookstore frame. */
public
static
final
int
BF_ITEMS_COLS
=
1
;
/** General horizontal padding. */
public
static
final
int
H_PADDING
=
10
;
/** General vertical padding. */
public
static
final
int
V_PADDING
=
5
;
/** The width of the text fields in the Login GUI. */
public
static
final
int
LF_TEXTFIELD_WIDTH
=
10
;
/** The width of the total text field in the BookStore GUI. */
public
static
final
int
BF_TEXTFIELD_TOTAL
=
12
;
/** The width of the quantity text field in the BookStore GUI. */
public
static
final
int
BF_TEXTFIELD_QUANITITY
=
3
;
}
/**
* Resource class for String Literals.
*
* General naming convention for strings associated with Swing Components:
*
* CLASS_COMPONENT_DESCRIPTION
*
*
*
@author
Charles Bryan
*
@version
7 September 2019
*/
public
static
class
Strings
{
/** The filename of the file containing the items to display in the cart. */
public
static
final
String
IO_CONFIG_FILE
=
"config.txt"
;
/** The filename of the file containing the user credentials. */
public
static
final
String
IO_CREDENTIALS_FILE
=
"users.txt"
;
/** The filename of the application icon. */
public
static
final
String
IO_ICON_FILE
=
"w.gif"
;
/** The local path of the configuration files. */
public
static
final
String
IO_FILE_LOCATION
=
"files/"
;
/** The file extension for text files. */
public
static
final
String
IO_FILE_EXTENSION
=
".txt"
;
/** The delimiter used in text files. */
public
static
final
String
IO_FILE_DELIMITER
=
";"
;
/** The character used to make a single line comment in text files. */
public
static
final
String
IO_FILE_COMMENT
=
"#"
;
/** Error message used when event handlers are implemented with method references. */
public
static
final
String
ERROR_MSG_ILLEGAL_INVOKE
=
"Only invoke when used as handler for JButton."
;
/** Error message used when registration pwds don't match. */
public
static
final
String
ERROR_MSG_PASSWORDS_NO_MATCH
=
"Passwords must be the same."
;
/** Error message used when registration pwds are too short. */
public
static
final
String
ERROR_MSG_PASSWORDS_TOO_SHORT
=
"Password must be at least 7 charachters long."
;
/** Error message used when registration pwds are too short. */
public
static
final
String
ERROR_MSG_USER_EXISTS
=
"Unfortunatly that user name is already taken."
;
/** Error message used when registration pwds done match. */
public
static
final
String
ERROR_MSG_EMPTY_FIELDS
=
"All fields are required."
;
/** Error message for title in Error Popup. */
public
static
final
String
ERROR_MSG_TITLE
=
"Oh No!"
;
/** Error message for incorrect login credentials. */
public
static
final
String
ERROR_MSG_CREDENTIALS
=
"Login credentials incorrect. Plesae try again."
;
/** Text in Total text field. */
public
static
final
String
BF_TEXTFIELD_TOTAL
=
"$0.00"
;
/** Text in Total text field. */
public
static
final
String
BF_FRAME_TITLE
=
"UW Bookstore"
;
/** Message on total Label. */
public
static
final
String
BF_LABEL_TOTAL
=
"order total:"
;
/** Message on clear Button. */
public
static
final
String
BF_BUTTON_CLEAR
=
"Clear"
;
/** Message on membership check box. */
public
static
final
String
BF_CHECKBOX_MEMBER
=
"customer has store membership"
;
/** Message on Login Button during login. */
public
static
final
String
LF_BUTTON_LOGIN
=
"Login"
;
/** Message on Login Button during registration. */
public
static
final
String
LF_BUTTON_LOGIN_REGISTRATION
=
"Register and Login"
;
/** Message on Register Button. */
public
static
final
String
LF_BUTTON_REGISTER
=
"Register"
;
/** Message on user name Label. */
public
static
final
String
LF_LABEL_USERNAME
=
"Username:"
;
/** Message on password Label. */
public
static
final
String
LF_LABEL_PASSWORD
=
"Password:"
;
/** Message on second password name Label. */
public
static
final
String
LF_LABEL_PASSWORD_2
=
"Re-enter Password:"
;
/** Message on campus Label. */
public
static
final
String
LF_LABEL_CAMPUS
=
"Choose your Campus:"
;
/** Message on frame header Label. */
public
static
final
String
LF_LABEL_HEADER
=
"Login to access store:"
;
}
}
ganghuan-bookstore/src/view/BookstoreFrame.java
ganghuan-bookstore/src/view/BookstoreFrame.java
/*
* TCSS 305 Assignment 2 - UW Bookstore
*/
package
view
;
import
java
.
awt
.
BorderLayout
;
import
java
.
awt
.
Dimension
;
import
java
.
awt
.
FlowLayout
;
import
java
.
awt
.
GridLayout
;
import
java
.
awt
.
Toolkit
;
import
java
.
awt
.
event
.
FocusAdapter
;
import
java
.
awt
.
event
.
FocusEvent
;
import
java
.
text
.
NumberFormat
;
import
java
.
util
.
LinkedList
;
import
java
.
util
.
List
;
import
java
.
util
.
Map
;
import
javax
.
swing
.
BorderFactory
;
import
javax
.
swing
.
ButtonGroup
;
import
javax
.
swing
.
ImageIcon
;
import
javax
.
swing
.
JButton
;
import
javax
.
swing
.
JCheckBox
;
import
javax
.
swing
.
JFrame
;
import
javax
.
swing
.
JLabel
;
import
javax
.
swing
.
JPanel
;
import
javax
.
swing
.
JRadioButton
;
import
javax
.
swing
.
JTextField
;
import
javax
.
swing
.
SwingConstants
;
import
model
.
Cart
;
import
model
.
Item
;
import
model
.
ItemOrder
;
import
res
.
R
;
/**
* BookstoreFrame provides the user interface for a UW Bookstore program.
*
*
@author
Marty Stepp
*
@author
Daniel M. Zimmerman (Formatting and Comments)
*
@author
Alan Fowler (Numerous changes to code and comments including use of BigDecimal)
*
@author
Charles Bryan (Added radio buttons to change campus locations/changed name)
*
@version
Autumn 2019
*/
public
final
class
BookstoreFrame
extends
JFrame
{
/** The Serialization ID. */
private
static
final
long
serialVersionUID
=
505198377375189354L
;
// constants to capture screen dimensions
/** A ToolKit. */
private
static
final
Toolkit
KIT
=
Toolkit
.
getDefaultToolkit
();
/** The Dimension of the screen. */
private
static
final
Dimension
SCREEN_SIZE
=
KIT
.
getScreenSize
();
/**
* The shopping cart used by this GUI.
*/
private
final
Cart
myItems
;
/**
* The map that stores each campus name and the campus's bookstore inventory.
*/
private
final
Map
<
String
,
List
<
Item
>>
myCampusInventories
;
/**
* The map that stores each campus name and the campus's bookstore inventory.
*/
private
String
myCurrentCampus
;
/**
* The text field used to display the total amount owed by the customer.
*/
private
final
JTextField
myTotal
;
/**
* The panel that holds the item descriptions. Needed to add and remove on
* the fly when the radio buttons change.
*/
private
JPanel
myItemsPanel
;
/**
* A List of the item text fields.
*/
private
final
List
<
JTextField
>
myQuantities
;
/**
* Initializes the bookstore GUI.
*
*
@param
theCampusInventories The list of items.
*
@param
theCurrentCampus The campus that is originally selected when
* the application starts.
*/
public
BookstoreFrame
(
final
Map
<
String
,
List
<
Item
>>
theCampusInventories
,
final
String
theCurrentCampus
)
{
// create frame and order list
super
();
// No title on the JFrame. We can set this later.
myItems
=
new
Cart
();
// set up text field with order total
myTotal
=
new
JTextField
(
R
.
Strings
.
BF_TEXTFIELD_TOTAL
,
R
.
Dimensions
.
BF_TEXTFIELD_TOTAL
);
myQuantities
=
new
LinkedList
<>
();
myCampusInventories
=
theCampusInventories
;
myCurrentCampus
=
theCurrentCampus
;
setupGUI
();
}
/**
* Setup the various parts of the GUI.
*
*/
private
void
setupGUI
()
{
// hide the default JFrame icon
//final Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);
// replace the default JFrame icon
final
ImageIcon
img
=
new
ImageIcon
(
R
.
Strings
.
IO_FILE_LOCATION
+
R
.
Strings
.
IO_ICON_FILE
);
setIconImage
(
img
.
getImage
());
setTitle
(
R
.
Strings
.
BF_FRAME_TITLE
);
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
add
(
makeTotalPanel
(),
BorderLayout
.
NORTH
);
myItemsPanel
=
makeItemsPanel
(
myCampusInventories
.
get
(
myCurrentCampus
));
add
(
myItemsPanel
,
BorderLayout
.
CENTER
);
add
(
makeCheckBoxPanel
(),
BorderLayout
.
SOUTH
);
// adjust size to just fit
pack
();
// make the GUI so that it cannot be resized by the user dragging a corner
setResizable
(
false
);
// position the frame in the center of the screen
setLocation
(
SCREEN_SIZE
.
width
/
2
-
getWidth
()
/
2
,
SCREEN_SIZE
.
height
/
2
-
getHeight
()
/
2
);
setVisible
(
true
);
}
/**
* Creates the panel to hold the campus location radio buttons.
*
*
@return
The created JPanel
*/
private
JPanel
makeCampusPanel
()
{
final
JPanel
p
=
new
JPanel
();
p
.
setBackground
(
R
.
Colors
.
HEADER_FOOTER_BG
);
final
ButtonGroup
g
=
new
ButtonGroup
();
for
(
final
Object
campus
:
myCampusInventories
.
keySet
())
{
final
JRadioButton
rb
=
new
JRadioButton
(
campus
.
toString
());
rb
.
setForeground
(
R
.
Colors
.
HEADER_FOOTER_TEXT
);
rb
.
setBackground
(
R
.
Colors
.
HEADER_FOOTER_BG
);
rb
.
setSelected
(
campus
.
equals
(
myCurrentCampus
));
g
.
add
(
rb
);
p
.
add
(
rb
);
rb
.
addActionListener
(
ae
->
{
myCurrentCampus
=
rb
.
getText
();
//remove the old panel and add the new one
remove
(
myItemsPanel
);
myItemsPanel
=
makeItemsPanel
(
myCampusInventories
.
get
(
myCurrentCampus
));
add
(
myItemsPanel
,
BorderLayout
.
CENTER
);
//clear previous data from the ShppingCart and
//update the total in the GUI
myItems
.
clear
();
updateTotal
();
//redraw the UI with the new panel
pack
();
revalidate
();
}
);
}
return
p
;
}
/**
* Creates a panel to hold the total.
*
*
@return
The created panel
*/
private
JPanel
makeTotalPanel
()
{
// tweak the text field so that users can't edit it, and set
// its color appropriately
myTotal
.
setEditable
(
false
);
myTotal
.
setEnabled
(
false
);
myTotal
.
setDisabledTextColor
(
R
.
Colors
.
CONTENT_TEXT
);
// create the panel, and its label
final
JPanel
totalPanel
=
new
JPanel
();
totalPanel
.
setBackground
(
R
.
Colors
.
HEADER_FOOTER_BG
);
final
JLabel
l
=
new
JLabel
(
R
.
Strings
.
BF_LABEL_TOTAL
);
l
.
setForeground
(
R
.
Colors
.
HEADER_FOOTER_TEXT
);
totalPanel
.
add
(
l
);
totalPanel
.
add
(
myTotal
);
final
JPanel
p
=
new
JPanel
(
new
BorderLayout
());
p
.
add
(
makeCampusPanel
(),
BorderLayout
.
NORTH
);
p
.
add
(
totalPanel
,
BorderLayout
.
CENTER
);
return
p
;
}
/**
* Creates a panel to hold the specified list of items.
*
*
@param
theItems The items
*
@return
The created panel
*/
private
JPanel
makeItemsPanel
(
final
List
<
Item
>
theItems
)
{
final
JPanel
p
=
new
JPanel
(
new
GridLayout
(
theItems
.
size
(),
R
.
Dimensions
.
BF_ITEMS_COLS
));
p
.
setBorder
(
BorderFactory
.
createEmptyBorder
(
R
.
Dimensions
.
V_PADDING
,
R
.
Dimensions
.
H_PADDING
,
R
.
Dimensions
.
V_PADDING
,
R
.
Dimensions
.
H_PADDING
));
p
.
setBackground
(
R
.
Colors
.
CONTENT_BG
);
for
(
final
Item
item
:
theItems
)
{
addItem
(
item
,
p
);
}
return
p
;
}
/**
* Creates and returns the checkbox panel.
*
*
@return
the checkbox panel
*/
private
JPanel
makeCheckBoxPanel
()
{
final
JPanel
p
=
new
JPanel
();
p
.
setBackground
(
R
.
Colors
.
HEADER_FOOTER_BG
);
final
JButton
clearButton
=
new
JButton
(
R
.
Strings
.
BF_BUTTON_CLEAR
);
clearButton
.
addActionListener
(
theEvent
->
{
myItems
.
clear
();
for
(
final
JTextField
field
:
myQuantities
)
{
field
.
setText
(
""
);
}
updateTotal
();
});
p
.
add
(
clearButton
);
final
JCheckBox
cb
=
new
JCheckBox
(
R
.
Strings
.
BF_CHECKBOX_MEMBER
);
cb
.
setForeground
(
R
.
Colors
.
HEADER_FOOTER_TEXT
);
cb
.
setBackground
(
R
.
Colors
.
HEADER_FOOTER_BG
);
cb
.
addActionListener
(
theEvent
->
{
myItems
.
setMembership
(
cb
.
isSelected
());
updateTotal
();
});
p
.
add
(
cb
);
return
p
;
}
/**
* Adds the specified product to the specified panel.
*
*
@param
theItem The product to add.
*
@param
thePanel The panel to add the product to.
*/
private
void
addItem
(
final
Item
theItem
,
final
JPanel
thePanel
)
{
final
JPanel
sub
=
new
JPanel
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
sub
.
setBackground
(
R
.
Colors
.
CONTENT_BG
);
final
JTextField
quantity
=
new
JTextField
(
R
.
Dimensions
.
BF_TEXTFIELD_QUANITITY
);
myQuantities
.
add
(
quantity
);
quantity
.
setHorizontalAlignment
(
SwingConstants
.
CENTER
);
quantity
.
addActionListener
(
theEvent
->
quantity
.
transferFocus
());