Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
d70f309
season 01 commit
eulerlcs Jun 18, 2017
1c6c8ca
refactor
eulerlcs Jun 18, 2017
3f84999
第一次作业 init2
miniyk2012 Jun 19, 2017
3c9da2d
Merge pull request #1 from onlyliuxin/master
miniyk2012 Jun 19, 2017
d856a34
Merge pull request #1 from onlyliuxin/master
EtheriousNatsu Jun 19, 2017
eae3b01
提交作业,将发送邮件的作业拆分成3个类。希望老师看看是否合理
gukz Jun 20, 2017
1386588
Merge pull request #1 from onlyliuxin/master
fengdzh Jun 20, 2017
12d5766
readme
fengdzh Jun 20, 2017
8a6bb2b
删除文件。
Jun 20, 2017
09b0045
初始化创建文件。
Jun 20, 2017
80fb48c
第二次作业
Jun 20, 2017
5fd8ae3
初始化包结构。
Jun 20, 2017
104ac6a
增加ocp、srp module
Jun 20, 2017
899f529
完成ocp作业
zzJohnH Jun 20, 2017
b1d7d95
SRP
Tony080 Jun 20, 2017
c097274
Signed-off-by: 两次ood作业提交996108220@qq.com
Jun 20, 2017
c795b43
测试提交
Jun 20, 2017
6a71fd3
创建责任包,接口。
Jun 20, 2017
5d605f4
finish srp and ocp homework
szfck Jun 20, 2017
ded54f4
finish srp and ocp homework
szfck Jun 20, 2017
c7e1de9
merge
szfck Jun 20, 2017
2729efd
创建自己的代码
miniyk2012 Jun 20, 2017
79ec6e0
push base source for SRP
Jun 21, 2017
c63b581
modify project structure according to SRP rule
Jun 21, 2017
4af6dd9
Merge pull request #1 from onlyliuxin/master
IdenStudy Jun 21, 2017
e052e16
s
zhizx Jun 21, 2017
14181b6
123
zhizx Jun 21, 2017
aef65cd
第二次作业(找回第一次作业)
IdenStudy Jun 21, 2017
19d62a2
srp 原则。
fengdzh Jun 21, 2017
7c3eee9
Merge remote-tracking branch 'onlyliuxin/master'
GordenChow Jun 21, 2017
9804e97
ood作业
Jun 21, 2017
4e2a19f
ood作业
Jun 21, 2017
6a4b511
pull base source of OCP
Jun 21, 2017
5af33a4
modify project according to OCP rule
Jun 21, 2017
d5e10f9
bug
Jun 21, 2017
988a409
第二季第二次作业
GordenChow Jun 21, 2017
3e1703a
第二季第一次大作业
skomefen Jun 21, 2017
ccc72ef
Merge branch 'master' of https://github.com/skomefen/coding2017
skomefen Jun 21, 2017
af06557
第二季第二次小作业
skomefen Jun 21, 2017
4e65053
第二次作业
yoda1990 Jun 21, 2017
2235a2e
第一次作业v2
miniyk2012 Jun 22, 2017
a84bcec
Revert "第一次作业 init2"
miniyk2012 Jun 22, 2017
7f14bb1
Merge pull request #1 from onlyliuxin/master
Rancher-V Jun 22, 2017
d85eb39
Merge remote-tracking branch 'upstream/master' 20170622
Jun 22, 2017
fbd64c7
add ocp refactor
harryhook Jun 22, 2017
d56ccb4
Merge pull request #2 from onlyliuxin/master
miniyk2012 Jun 22, 2017
3f6b591
update SenderFactory
harryhook Jun 23, 2017
3e26f6d
update
yyglider Jun 23, 2017
294d918
Merge remote-tracking branch 'upstream/master'
Jun 23, 2017
697cd57
add srp
harryhook Jun 23, 2017
38a9848
发邮件,重构2
miniyk2012 Jun 24, 2017
0defe07
Merge pull request #3 from onlyliuxin/master
miniyk2012 Jun 24, 2017
636f71c
第二周作业:打印不同的日志
miniyk2012 Jun 24, 2017
18a6b2d
打日志:重构代码
miniyk2012 Jun 24, 2017
b04dcdf
删除无用注释
miniyk2012 Jun 24, 2017
5a4663b
Merge pull request #1 from onlyliuxin/master
eulerlcs Jun 24, 2017
95d29e1
Merge pull request #2 from onlyliuxin/master
Rancher-V Jun 24, 2017
7082e05
创建责任包,接口。
Jun 24, 2017
178a362
ocp commit
Jun 24, 2017
d5f27cf
change the courseWork, add homework 2 and prepare to change
Rancher-V Jun 24, 2017
ad51ded
refactor second homework, refert to the good one
Rancher-V Jun 25, 2017
1f5e3e3
发邮件的模板优化
miniyk2012 Jun 25, 2017
23bcc0e
创建多线程代码
miniyk2012 Jun 25, 2017
de9cb62
add homework for UML
Jun 26, 2017
c73d55c
ocp commit, 支持观察者
Jun 26, 2017
f6588e4
线程池使用1
miniyk2012 Jun 26, 2017
0738eb4
投骰子-代码部分
miniyk2012 Jun 26, 2017
2e94530
修改骰子的点数
miniyk2012 Jun 26, 2017
6840030
投骰子uml图
miniyk2012 Jun 26, 2017
cf5b22c
uml homework01
Jun 27, 2017
7bd719e
购物网站用例图
miniyk2012 Jun 27, 2017
f4f6ef8
放大类图
miniyk2012 Jun 27, 2017
2b343ab
Merge pull request #2 from onlyliuxin/master
eulerlcs Jul 2, 2017
6d58113
add regular expression project
eulerlcs Jul 2, 2017
a66c7ab
Merge pull request #4 from onlyliuxin/master
miniyk2012 Jul 3, 2017
82c7cd3
Merge remote-tracking branch 'upstream/master'
Jul 4, 2017
e01d178
add project of payment
Jul 4, 2017
5813a06
Merge pull request #5 from onlyliuxin/master
miniyk2012 Jul 4, 2017
b714cf0
Payroll init
miniyk2012 Jul 4, 2017
89de58a
Merge pull request #1 from onlyliuxin/master
harryhook Jul 6, 2017
5be0c63
payroll
Jul 9, 2017
b5f9d48
Revert "payroll"
Jul 9, 2017
aba6c86
payroll
Jul 9, 2017
2ae6521
Merge branch 'master' of https://github.com/guoshenghui/coding2017
Jul 9, 2017
c5cdc21
payroll code
onlyliuxin Jul 10, 2017
323a02a
payroll code
onlyliuxin Jul 10, 2017
22d8938
paroll code
onlyliuxin Jul 10, 2017
cb12f47
Merge pull request #462 from guoshenghui/master
onlyliuxin Jul 10, 2017
4e92eff
Merge pull request #454 from yyglider/master
onlyliuxin Jul 10, 2017
e6e5cf8
Merge pull request #453 from fengdzh/master
onlyliuxin Jul 10, 2017
b358bd5
Merge pull request #452 from Rancher-V/master
onlyliuxin Jul 10, 2017
faa1a3a
Merge pull request #449 from HarryHook/master
onlyliuxin Jul 10, 2017
9f2c2ae
Merge pull request #447 from miniyk2012/master
onlyliuxin Jul 10, 2017
2330282
Merge pull request #445 from YouHmilyForProgramming/master
onlyliuxin Jul 10, 2017
209c893
Merge pull request #442 from skomefen/master
onlyliuxin Jul 10, 2017
12769d2
Merge pull request #440 from yangzhm/master
onlyliuxin Jul 10, 2017
3125a34
Merge pull request #437 from GordenChow/master
onlyliuxin Jul 10, 2017
89d9463
Merge pull request #436 from javmin/master
onlyliuxin Jul 10, 2017
fc122f1
Merge pull request #433 from ShiningChenCode/master
onlyliuxin Jul 10, 2017
483827e
Merge pull request #429 from szfck/master
onlyliuxin Jul 10, 2017
17e1f55
Merge pull request #428 from 15993061515/master
onlyliuxin Jul 10, 2017
13b44e6
Merge pull request #427 from WANGCANCER/master
onlyliuxin Jul 10, 2017
f17529d
Merge pull request #426 from Tony-Hu/master
onlyliuxin Jul 10, 2017
e0bb3fa
Merge pull request #425 from johnChnia/master
onlyliuxin Jul 10, 2017
edc5836
Merge pull request #423 from Ken-W-P-Huang/master
onlyliuxin Jul 10, 2017
1b68f6c
Merge pull request #422 from GUK0/master
onlyliuxin Jul 10, 2017
3aa27a3
payroll code
onlyliuxin Jul 10, 2017
a98dea4
tag builder
onlyliuxin Jul 10, 2017
e69f85c
第一次作业linxin目录下文件修改误提交,现在重提交
KeXianlin Jul 10, 2017
34e00d5
uml homework
Jul 11, 2017
096522a
添加正则表达式用例
eulerlcs Jul 11, 2017
3a498c3
Merge pull request #3 from onlyliuxin/master
eulerlcs Jul 11, 2017
5c16127
add regexp project
eulerlcs Jul 12, 2017
d60b463
Merge pull request #496 from eulerlcs/20170712.regexp
onlyliuxin Jul 12, 2017
76c02c1
Merge pull request #491 from readke/master
onlyliuxin Jul 13, 2017
2a2be7c
Merge pull request #492 from starlight0405/master
onlyliuxin Jul 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added dicegame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion liuxin/ood/ood-assignment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@
<groupId>com.coderising</groupId>
<artifactId>ood-assignment</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>

<name>ood-assignment</name>
<url>http://maven.apache.org</url>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.coderising.dp.builder;

public class TagBuilder {

public TagBuilder(String rootTagName){

}

public TagBuilder addChild(String childTagName){

return null;
}
public TagBuilder addSibling(String siblingTagName){


return null;

}
public TagBuilder setAttribute(String name, String value){

return null;
}
public TagBuilder setText(String value){

return null;
}
public String toXML(){
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.coderising.dp.builder;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TagBuilderTest {

@Before
public void setUp() throws Exception {
}

@After
public void tearDown() throws Exception {
}

@Test
public void testToXML() {

TagBuilder builder = new TagBuilder("order");

String xml = builder.addChild("line-items")
.addChild("line-item").setAttribute("pid", "P3677").setAttribute("qty", "3")
.addSibling("line-item").setAttribute("pid", "P9877").setAttribute("qty", "10")
.toXML();

String expected = "<order>"
+ "<line-items>"
+ "<line-item pid=\"P3677\" qty=\"3\"/>"
+ "<line-item pid=\"P9877\" qty=\"10\"/>"
+ "</line-items>"
+ "</order>";

System.out.println(xml);
assertEquals(expected, xml);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.coderising.dp.builder;

import java.util.ArrayList;
import java.util.List;

public class TagNode {
private String tagName;
private String tagValue;
private List<TagNode> children = new ArrayList<>();
private List<Attribute> attributes = new ArrayList<>();

public TagNode(String name){
this.tagName = name;
}
public void add(TagNode child){
this.children.add(child);
}
public void setAttribute(String name, String value) {
Attribute attr = findAttribute(name);
if(attr != null){
attr.value = value;
}

attributes.add(new Attribute(name,value));
}
private Attribute findAttribute(String name){
for(Attribute attr : attributes){
if(attr.name.equals(name)){
return attr;
}
}
return null;
}
public void setValue(String value) {
this.tagValue = value;

}
public String getTagName() {
return tagName;
}
public List<TagNode> getChildren() {
return children;
}

private static class Attribute{
public Attribute(String name, String value) {
this.name = name;
this.value = value;
}
String name;
String value;

}
public String toXML(){
return toXML(this);
}
private String toXML(TagNode node){
StringBuilder buffer = new StringBuilder();
buffer.append("<").append(node.tagName);
if(node.attributes.size()> 0){
for(int i=0;i<node.attributes.size();i++){
Attribute attr = node.attributes.get(i);
buffer.append(" ").append(toXML(attr));
}
}
if(node.children.size()== 0){
buffer.append("/>");
return buffer.toString();
}
buffer.append(">");
for(TagNode childNode : node.children){
buffer.append(toXML(childNode));
}
buffer.append("</").append(node.tagName).append(">");


return buffer.toString();
}
private String toXML(Attribute attr){
return attr.name+"=\""+attr.value + "\"";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.coderising.dp.decorator;

public interface Email {
public String getContent();
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.coderising.dp.decorator;

public abstract class EmailDecorator implements Email{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.coderising.dp.decorator;

public class EmailImpl implements Email {
private String content;

public EmailImpl(String content) {
this.content = content;
}
public String getContent() {
return content;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.coderising.ood.srp.good1;


public class MailSender {

private String fromAddress ;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@





P8756 iPhone8
P3946 XiaoMi10
P8904 Oppo_R15
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.coderising.payroll;

import java.util.List;

import com.coderising.payroll.classification.CommissionedClassification;
import com.coderising.payroll.classification.HourlyClassification;
import com.coderising.payroll.classification.SalariedClassification;
import com.coderising.payroll.domain.Employee;
import com.coderising.payroll.domain.HoldMethod;
import com.coderising.payroll.domain.Paycheck;
import com.coderising.payroll.schedule.BiweeklySchedule;
import com.coderising.payroll.schedule.MonthlySchedule;
import com.coderising.payroll.schedule.WeeklySchedule;

public class PayrollService {
public List<Employee> getAllEmployees(){
return null;
}
public void savePaycheck(Paycheck pc){

}

public Employee addHourlyEmployee(String name, String address, double hourlyRate){
Employee e = new Employee(name, address);
e.setClassification(new HourlyClassification(hourlyRate));
e.setSchedule(new WeeklySchedule());
e.setPaymentMethod(new HoldMethod());
//保存员工到数据库.. 略
return e;
}

public Employee addSalariedEmployee(String name, String address, double salary){
Employee e = new Employee(name, address);
e.setClassification(new SalariedClassification(salary));
e.setSchedule(new MonthlySchedule());
e.setPaymentMethod(new HoldMethod());
//保存员工到数据库.. 略
return e;
}

public Employee addCommissionedEmployee(String name, String address, double salary, double saleRate){
Employee e = new Employee(name, address);
e.setClassification(new CommissionedClassification(salary, saleRate));
e.setSchedule(new BiweeklySchedule());
e.setPaymentMethod(new HoldMethod());
//保存员工到数据库.. 略
return e;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.coderising.payroll.affiliation;

import com.coderising.payroll.domain.Affiliation;
import com.coderising.payroll.domain.Paycheck;

public class NonAffiliation implements Affiliation{
public double calculateDeductions(Paycheck pc){
return 0.0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.coderising.payroll.affiliation;

import com.coderising.payroll.domain.Affiliation;
import com.coderising.payroll.domain.Paycheck;

public class UnionAffiliation implements Affiliation {

@Override
public double calculateDeductions(Paycheck pc) {

return 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.coderising.payroll.classification;

import java.util.Date;
import java.util.Map;

import com.coderising.payroll.domain.Paycheck;
import com.coderising.payroll.domain.PaymentClassification;
import com.coderising.payroll.domain.SalesReceipt;
import com.coderising.payroll.util.DateUtil;

public class CommissionedClassification implements PaymentClassification {
double salary;
double rate;
public CommissionedClassification(double salary , double rate){
this.salary = salary;
this.rate = rate;
}
Map<Date, SalesReceipt> receipts;
@Override
public double calculatePay(Paycheck pc) {
double commission = 0.0;
for(SalesReceipt sr : receipts.values()){
if(DateUtil.between(sr.getSaleDate(), pc.getPayPeriodStartDate(),
pc.getPayPeriodEndDate())){
commission += sr.getAmount() * rate;
}
}
return salary + commission;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.coderising.payroll.classification;

import java.util.Date;
import java.util.Map;

import com.coderising.payroll.domain.Paycheck;
import com.coderising.payroll.domain.PaymentClassification;
import com.coderising.payroll.domain.TimeCard;
import com.coderising.payroll.util.DateUtil;

public class HourlyClassification implements PaymentClassification {
private double rate;
private Map<Date, TimeCard> timeCards;

public HourlyClassification(double hourlyRate) {
this.rate = hourlyRate;
}
public void addTimeCard(TimeCard tc){
timeCards.put(tc.getDate(), tc);
}
@Override
public double calculatePay(Paycheck pc) {
double totalPay = 0;
for(TimeCard tc : timeCards.values()){
if(DateUtil.between(tc.getDate(), pc.getPayPeriodStartDate(),
pc.getPayPeriodEndDate())){
totalPay += calculatePayForTimeCard(tc);
}
}
return totalPay;

}
private double calculatePayForTimeCard(TimeCard tc) {
int hours = tc.getHours();

if(hours > 8){
return 8*rate + (hours-8) * rate * 1.5;
} else{
return 8*rate;
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.coderising.payroll.classification;

import com.coderising.payroll.domain.Paycheck;
import com.coderising.payroll.domain.PaymentClassification;

public class SalariedClassification implements PaymentClassification {
private double salary;
public SalariedClassification(double salary){
this.salary = salary;
}
@Override
public double calculatePay(Paycheck pc) {
return salary;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.coderising.payroll.domain;

public interface Affiliation {
public double calculateDeductions(Paycheck pc);
}
Loading