Skip to content

Commit

Permalink
2021-04-12
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramTraveler committed Apr 12, 2021
1 parent 2a9280a commit 8dd621d
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 5 deletions.
10 changes: 10 additions & 0 deletions demo.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
10,11,12,12,12,10,

10,
10,
10,11,12,12,12,10,
10,11,12,12,12,10,
10,11,12,12,12,10,200000,
10,11,12,12,12,10,200000,
128,129,130,130,130,128,
153,154,155,155,155,153,
44 changes: 43 additions & 1 deletion information.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id,����,ʵ������,ʵ������,ģʽ�л�����,Ŀ����ɫ,Ŀ���ϸ,��ʼʱ��,����ʱ��,��ɫ�л�ʱ��,�����л�ʱ��,ģʽ�л���ʱ��,��������ʱ��,��һ�λ���ʱ��,�ڶ��λ���ʱ��,�����λ���ʱ��,�󴥷�����,��ɫ�л�������,�����л�������,ģʽ�л��ܴ�����,ѹ��1,ѹ��2,ѹ��ƽ��ֵ,��λ��1,��λ��2,��λ��ƽ��ֵ,��б��1,��б��2,��б��ƽ��ֵ,
16,
���,ʵ������,ʵ������,ģʽ�л�����,Ŀ����ɫ,Ŀ���ϸ,��ʼʱ��,����ʱ��,��ɫ�л�ʱ��,�����л�ʱ��,ģʽ�л���ʱ��,��������ʱ��,��һ�λ���ʱ��,�ڶ��λ���ʱ��,�����λ���ʱ��,�󴥷�����,��ɫ�л�������,�����л�������,ģʽ�л��ܴ�����,ѹ��1,ѹ��2,ѹ��ƽ��ֵ,��λ��1,��λ��2,��λ��ƽ��ֵ,��б��1,��б��2,��б��ƽ��ֵ,
1,,1,1,��ͳ����ģʽ,��ɫ,4.0,14:38:44:804,14:38:45:430,-1617345525477,-1617345526075,-3234691051552,1584,328,425,313,0,1,1,2,0,0,0,0,0,0,0,0,0,
2,,1,1,��ͳ����ģʽ,��ɫ,3.0,14:39:06:618,14:39:07:683,-1617345546977,-1617345547509,-3234691094486,1507,529,364,282,0,1,1,2,0,0,0,0,0,0,0,0,0,
3,,1,2,��ͳ����ģʽ,��ɫ,3.0,14:39:06:618,14:39:07:683,-1617345550407,-1617345551296,-3234691101703,1923,946,313,238,0,1,1,4,0,0,0,0,0,0,0,0,0,
Expand All @@ -7,3 +8,44 @@ id,
6,,1,2,��ͳ����ģʽ,��ɫ,3.0,14:39:46:961,14:39:47:849,-1617345591871,-1617345592393,-3234691184264,1733,838,314,268,0,1,1,4,0,0,0,0,0,0,0,0,0,
7,������,1,1,��ͳ����ģʽ,��ɫ,3.0,14:40:15:216,14:40:16:15,-1617345615437,-1617345615888,-3234691231325,1190,384,283,298,0,1,1,2,0,0,0,0,0,0,0,0,0,
8,������,1,2,��ͳ����ģʽ,��ɫ,2.0,14:40:15:216,14:40:16:15,-1617345618700,-1617345619153,-3234691237853,1198,425,335,204,0,1,1,4,0,0,0,0,0,0,0,0,0,
9,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:02:05:53,16:02:06:40,-1618214525224,-1618214525888,-3236429051112,1504,394,339,313,0,1,1,2,0,0,0,0,0,0,0,0,0,
10,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:08:51:409,16:08:52:397,-1618214931707,-1618214932241,-3236429863948,1444,438,392,283,0,1,1,2,0,0,0,0,0,0,0,0,0,
12,,1,2,��ͳ����ģʽ,��ɫ,2.0,16:08:51:409,16:08:52:397,-1618214935122,-1618214935640,-3236429870762,1531,500,362,307,0,1,1,4,0,0,0,0,0,0,0,0,0,
13,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:10:45:792,16:10:46:432,-1618215046448,-1618215046776,-3236430093224,1124,234,203,140,0,1,1,2,0,0,0,0,0,0,0,0,0,
14,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:12:05:138,16:12:06:39,-1618215125388,-1618215125836,-3236430251224,1199,432,298,188,0,1,1,2,0,0,0,0,0,0,0,0,0,
15,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:12:31:801,16:12:32:535,-1618215151973,-1618215152410,-3236430304383,984,313,265,140,0,1,1,2,0,0,0,0,0,0,0,0,0,
16,,1,2,��ͳ����ģʽ,��ɫ,4.0,16:12:31:801,16:12:32:535,-1618215155687,-1618215155921,-3236430311608,1126,353,328,148,0,1,1,4,0,0,0,0,0,0,0,0,0,
17,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:13:05:477,16:13:06:353,-1618215185758,-1618215186197,-3236430371955,1126,485,282,171,0,1,1,2,0,0,0,0,0,0,0,0,0,
18,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:14:16:353,16:14:17:77,-1618215256573,-1618215256951,-3236430513524,1022,378,251,188,0,1,1,2,0,0,0,0,0,0,0,0,0,
19,,1,2,��ͳ����ģʽ,��ɫ,2.0,16:14:16:353,16:14:17:77,-1618215259080,-1618215259458,-3236430518538,971,283,267,187,0,1,1,4,0,0,0,0,0,0,0,0,0,
20,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:16:12:972,16:16:13:787,-1618215373145,-1618215373599,-3236430746744,1130,362,328,174,0,1,1,2,0,0,0,0,0,0,0,0,0,
21,,1,2,��ͳ����ģʽ,��ɫ,2.0,16:16:12:972,16:16:13:787,-1618215376124,-1618215376483,-3236430752607,1144,329,314,267,0,1,1,4,0,0,0,0,0,0,0,0,0,
22,,1,3,��ͳ����ģʽ,��ɫ,3.0,16:16:12:972,16:16:13:787,-1618215393021,-1618215393478,-3236430786499,1208,439,281,267,0,1,1,6,0,0,0,0,0,0,0,0,0,
23,,1,4,��ͳ����ģʽ,��ɫ,4.0,16:16:12:972,16:16:13:787,-1618215396015,-1618215396440,-3236430792455,972,314,267,188,0,1,1,8,0,0,0,0,0,0,0,0,0,
24,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:18:02:624,16:18:03:423,-1618215482858,-1618215483297,-3236430966155,1038,390,284,142,0,1,1,2,0,0,0,0,0,0,0,0,0,
25,,1,2,��ͳ����ģʽ,��ɫ,2.0,16:18:02:624,16:18:03:423,-1618215485575,-1618215485903,-3236430971478,956,314,250,156,0,1,1,4,0,0,0,0,0,0,0,0,0,
26,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:19:49:959,16:19:50:709,-1618215590131,-1618215590584,-3236431180715,1066,360,297,238,0,1,1,2,0,0,0,0,0,0,0,0,0,
27,,1,2,��ͳ����ģʽ,��ɫ,2.0,16:19:49:959,16:19:50:709,-1618215592950,-1618215593406,-3236431186356,1289,379,330,376,0,1,1,4,0,0,0,0,0,0,0,0,0,
28,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:24:32:715,16:24:33:509,-1618215872910,-1618215873394,-3236431746304,1147,332,311,230,0,1,1,2,0,0,0,0,0,0,0,0,0,
29,,1,2,��ͳ����ģʽ,��ɫ,4.0,16:24:32:715,16:24:33:509,-1618215875983,-1618215876471,-3236431752454,1203,382,284,236,0,1,1,4,0,0,0,0,0,0,0,0,0,
30,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:26:24:184,16:26:24:856,-1618215984893,-1618215985209,-3236431970102,1237,377,220,198,0,1,1,2,0,0,0,0,0,0,0,0,0,
31,,1,2,��ͳ����ģʽ,��ɫ,3.0,16:26:24:184,16:26:24:856,-1618215987539,-1618215987924,-3236431975463,1400,307,388,382,0,1,1,4,0,0,0,0,0,0,0,0,0,
32,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:29:44:975,16:29:45:974,-1618216185382,-1618216185883,-3236432371265,1323,576,257,204,0,1,1,2,0,0,0,0,0,0,0,0,0,
33,,1,2,��ͳ����ģʽ,��ɫ,2.0,16:29:44:975,16:29:45:974,-1618216188044,-1618216188367,-3236432376411,932,316,213,190,0,1,1,4,0,0,0,0,0,0,0,0,0,
34,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:30:20:536,16:30:21:109,-1618216220681,-1618216221053,-3236432441734,883,232,213,176,0,1,1,2,0,0,0,0,0,0,0,0,0,
35,,1,2,��ͳ����ģʽ,��ɫ,3.0,16:30:20:536,16:30:21:109,-1618216223155,-1618216223562,-3236432446717,882,226,204,156,0,1,1,4,0,0,0,0,0,0,0,0,0,
36,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:30:48:883,16:30:49:405,-1618216249038,-1618216249376,-3236432498414,812,253,160,175,0,1,1,2,0,0,0,0,0,0,0,0,0,
37,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:31:48:469,16:31:48:893,-1618216308582,-1618216308834,-3236432617416,719,184,140,178,0,1,1,2,0,0,0,0,0,0,0,0,0,
38,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:32:04:860,16:32:05:210,-1618216325213,-1618216325328,-3236432650541,856,213,179,170,0,1,1,2,0,0,0,0,0,0,0,0,0,
39,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:34:08:394,16:34:09:69,-1618216448541,-1618216448983,-3236432897524,1030,273,237,196,0,1,1,2,0,0,0,0,0,0,0,0,0,
40,,1,2,��ͳ����ģʽ,��ɫ,4.0,16:34:08:394,16:34:09:69,-1618216451984,-1618216452027,-3236432904011,1062,292,185,172,0,1,1,4,0,0,0,0,0,0,0,0,0,
41,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:36:17:933,16:36:18:746,-1618216578197,-1618216578690,-3236433156887,1190,501,177,195,0,1,1,2,0,0,0,0,0,0,0,0,0,
42,,1,2,��ͳ����ģʽ,��ɫ,4.0,16:36:17:933,16:36:18:746,-1618216581221,-1618216581349,-3236433162570,1058,253,220,206,0,1,1,4,0,0,0,0,0,0,0,0,0,
43,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:37:51:996,16:37:52:703,-1618216672153,-1618216672598,-3236433344751,1051,358,241,174,0,1,1,2,0,0,0,0,0,0,0,0,0,
44,,1,2,��ͳ����ģʽ,��ɫ,3.0,16:37:51:996,16:37:52:703,-1618216679433,-1618216679805,-3236433359238,1106,417,189,166,0,1,1,4,0,0,0,0,0,0,0,0,0,
45,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:39:23:420,16:39:24:155,-1618216763579,-1618216764040,-3236433527619,1057,379,213,179,0,1,1,2,0,0,0,0,0,0,0,0,0,
46,,1,2,��ͳ����ģʽ,��ɫ,4.0,16:39:23:420,16:39:24:155,-1618216766224,-1618216766572,-3236433532796,952,300,217,184,0,1,1,4,0,0,0,0,0,0,0,0,0,
47,,1,1,��ͳ����ģʽ,��ɫ,4.0,16:40:37:350,16:40:38:66,-1618216837614,-1618216838008,-3236433675622,1111,388,208,218,0,1,1,2,0,0,0,0,0,0,0,0,0,
48,,1,1,��ͳ����ģʽ,��ɫ,2.0,16:41:17:544,16:41:18:215,-1618216877762,-1618216878173,-3236433755935,1041,340,189,200,0,1,1,2,0,0,0,0,0,0,0,0,0,
49,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:42:48:793,16:42:49:631,-1618216968916,-1618216969396,-3236433938312,1229,306,382,213,0,1,1,2,0,0,0,0,0,0,0,0,0,
50,,1,1,��ͳ����ģʽ,��ɫ,3.0,16:43:18:393,16:43:19:117,-1618216998548,-1618216999028,-3236433997576,1013,352,220,153,0,1,1,2,0,0,0,0,0,0,0,0,0,
Binary file modified out/production/PenProject/PenData.class
Binary file not shown.
27 changes: 23 additions & 4 deletions src/PenData.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ public void SaveInformation() throws IOException {
File saveFile = new File("information.csv");
csv = new RandomAccessFile(saveFile, "rw");


int CsvLine = (int) csv.length();
String saveText = "";
if (CsvLine == 0) {
Expand All @@ -288,7 +287,6 @@ public void SaveInformation() throws IOException {
csv.write(saveText.getBytes("GBK"));
}
csv.skipBytes(CsvLine);

int index = 0;
//获得文件行数
try {
Expand All @@ -298,22 +296,43 @@ public void SaveInformation() throws IOException {
while ((s = b.readLine()) != null) {
index++;
}
System.out.println(index);
//System.out.println(index);
b.close();
f.close();
}catch (IOException o) {
o.printStackTrace();
}

//这个if循环中count是作为分母的,为了防止出现分母为0的情况做出的判断,也可以用异常
if (count == 0)
count = 1;

//最后写了两个tilt,写一个好像记录不上,不知道为什么(3月2号,发现是我的分隔符敲错了,现在没错了)
saveText = index + "," + Name + "," + BlockNumber + "," + TrialNumber + "," + ModeTechnique + "," + TargetColor + "," + TargetLine + ","
+ StartTimeDate + "," + EndTimeDate + ","+ ColorModeSwitchT + "," + PixelModeSwitchT + "," + ModeSwitchTime + "," + CompleteTime + "," +PaintTime1 + ","
+ PaintTime2 + "," + PaintTime3 + "," + TouchError + "," + ColorModeE + "," + PixelModeE +","+ModelError + "," + pressureColor +"," + pressurePixel + "," + pressure / count+ "," + azimuthColor + "," + azimuthPixel+ "," + azimuth / count + "," + tiltColor+ ","+ tiltPixel + "," + tilt / count + "," + "\n";
csv.write(saveText.getBytes("GBK"));
csv.close();

//以下是记录测试
File temp = new File("demo.csv");
RandomAccessFile c = new RandomAccessFile(temp, "rw");
int a[] = {10, 11, 12, 12, 12, 10};
String s = "";
int len = (int)temp.length();
c.skipBytes(len + 3);
for (int i = 0; i < a.length; i ++) {
/*if (i == a.length - 1) {
s = a[i] + "," + "\n";
}else {
s = a[i] + ",";
}*/
s = a[i] + len + ",";
c.write(s.getBytes("GBK"));
}
s = "\n";
//System.out.println(s);
c.write(s.getBytes("GBK"));
c.close();
}

}

0 comments on commit 8dd621d

Please sign in to comment.