Skip to content

Commit b285870

Browse files
first commit
0 parents  commit b285870

90 files changed

Lines changed: 3810 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8

lib/commons-beanutils.jar

184 KB
Binary file not shown.

lib/commons-collections-3.1.jar

546 KB
Binary file not shown.

lib/commons-lang.jar

166 KB
Binary file not shown.

lib/commons-logging.jar

59.4 KB
Binary file not shown.

lib/ezmorph-1.0.6.jar

84.5 KB
Binary file not shown.

lib/json-lib-2.2.2-jdk15.jar

141 KB
Binary file not shown.

src/btp/oneP/ABtpTest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package btp.oneP;
2+
3+
import java.io.PrintStream;
4+
import java.util.ArrayList;
5+
import java.util.Arrays;
6+
import java.util.Scanner;
7+
8+
public class ABtpTest {
9+
10+
public static void main(String[] args) {
11+
PrintStream p = System.out;
12+
Scanner sc =new Scanner(System.in);
13+
try{
14+
ArrayList as = returnArray();
15+
ArrayList<String> ass = (ArrayList<String>)as;
16+
p.println(ass);
17+
as = returnArrayNew();
18+
p.println(as);
19+
ass = (ArrayList<String>)as;
20+
p.println(ass);
21+
}catch(Exception e){
22+
e.printStackTrace();
23+
}finally{
24+
sc.close();
25+
p.close();
26+
}
27+
}
28+
29+
public static ArrayList<String> returnArray(){
30+
return new ArrayList<String>(Arrays.asList(new String[]{"AA","BB","C"}));
31+
}
32+
33+
public static ArrayList returnArrayNew(){
34+
return new ArrayList<String>(Arrays.asList(new String[]{"CC","DD","E"}));
35+
}
36+
}

src/btp/oneP/AgentTest.java

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package btp.oneP;
2+
3+
import java.text.ParseException;
4+
import java.text.SimpleDateFormat;
5+
import java.util.ArrayList;
6+
import java.util.Arrays;
7+
import java.util.Collections;
8+
import java.util.Comparator;
9+
import java.util.Date;
10+
import java.util.List;
11+
12+
public class AgentTest {
13+
private static Comparator<Agentnew> comparatorForAgent = new Comparator<Agentnew>(){
14+
@Override
15+
public int compare(Agentnew o1, Agentnew o2) {
16+
if(!o1.isWastage()&&o2.isWastage()){
17+
return -1;
18+
}else if(o1.isWastage()&&!o2.isWastage()){
19+
return 1;
20+
}else{
21+
if(o1.getLastVideoTime().before(o2.getLastVideoTime())){
22+
return -1;
23+
}else if(o1.getLastVideoTime().after(o2.getLastVideoTime())){
24+
return 1;
25+
}else{
26+
if(o1.getAllocateCount()<o2.getAllocateCount()){
27+
return -1;
28+
}else if(o1.getAllocateCount()>o2.getAllocateCount()){
29+
return 1;
30+
}else{
31+
return 0;
32+
}
33+
}
34+
}
35+
}
36+
};
37+
38+
public static void main(String[] args) throws ParseException {
39+
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
40+
// TODO Auto-generated method stub
41+
List<Agentnew> userListTemp = new ArrayList<Agentnew>();
42+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),true,2));
43+
userListTemp.add(new Agentnew(sdf.parse("2002-3-20 05:05:09"),true,2));
44+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 06:05:09"),true,3));
45+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),true,4));
46+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),false,2));
47+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),true,2));
48+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),false,4));
49+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),true,2));
50+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),false,5));
51+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),false,0));
52+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),true,2));
53+
userListTemp.add(new Agentnew(sdf.parse("2001-3-20 05:05:09"),true,6));
54+
55+
Collections.sort(userListTemp,comparatorForAgent);
56+
57+
for(Agentnew a:userListTemp){
58+
System.out.println(a);
59+
}
60+
61+
}
62+
63+
}
64+
65+
class Agentnew{
66+
//上次接视频时间
67+
private Date lastVideoTime = new Date();
68+
//上次分配是否未接
69+
private boolean wastage;
70+
//分配次数
71+
private int allocateCount;
72+
73+
74+
public Agentnew(Date lastVideoTime, boolean wastage, int allocateCount) {
75+
super();
76+
this.lastVideoTime = lastVideoTime;
77+
this.wastage = wastage;
78+
this.allocateCount = allocateCount;
79+
}
80+
public Date getLastVideoTime() {
81+
return lastVideoTime;
82+
}
83+
public void setLastVideoTime(Date lastVideoTime) {
84+
this.lastVideoTime = lastVideoTime;
85+
}
86+
public boolean isWastage() {
87+
return wastage;
88+
}
89+
public void setWastage(boolean wastage) {
90+
this.wastage = wastage;
91+
}
92+
public int getAllocateCount() {
93+
return allocateCount;
94+
}
95+
public void setAllocateCount(int allocateCount) {
96+
this.allocateCount = allocateCount;
97+
}
98+
@Override
99+
public String toString() {
100+
return "Agentnew [ wastage=" + wastage+",lastVideoTime=" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(lastVideoTime) + ", allocateCount=" + allocateCount +"]";
101+
}
102+
103+
}

src/btp/oneP/ArrayListTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package btp.oneP;
2+
3+
import java.util.ArrayList;
4+
import java.util.Arrays;
5+
6+
public class ArrayListTest {
7+
8+
public static void main(String[] args) {
9+
ArrayList<Integer> list = new ArrayList<>(Arrays.<Integer>asList(1,2,3));
10+
11+
list.add(3);
12+
Object[] obs=list.toArray();
13+
System.out.println(obs[0]);
14+
}
15+
16+
}

0 commit comments

Comments
 (0)