语法错误,插入“AssignmentOperator Expression”完成表达
第 38 行“data[i];”我收到以下错误“语法错误,插入“AssignmentOperator Expression”以完成表达式”任何人都可以帮助解决此问题。
谢谢
package org.physionet.challenge2011;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import android.graphics.Path;
import android.util.Log;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
public class ChallengeEntry {
public static final String DEBUGTAG = ChallengeEntry.class.toString();
final static int FS= 500; //Sampling Frequency
final static int CH= 12;
final static int MAX_RT= 220; //Max expected beats in minutes
final static int WIN=FS*10;
final static double PKS_MIN=40/6; // Minimum number of expected peaks in 10s
final static int FRGT=(int) (FS*0.04); // Window for ignoring consecutive peaks
final static short [] W={1,1,1,-1,1,1,-1,-1,1,1,1,1}; // Weights for each channel
final static double PK_TH=500; // Peak value hardcoded based on sample data
static short [] sum = new short[WIN]; //Array for storing summed channel data
//Define Quality values (could also be defined as enum...)
final static int INIT=0;
final static int GOOD = 0;
final static int BAD = 1;
short[] data=new short[WIN*CH];
synchronized public int get_result(InputStream iFile, final ECG_MetaData m_MetaData) throws IOException {
ObjectInputStream in = new ObjectInputStream(iFile);
//try {
data = (short[])in.readObject();
int i;
data[i];
i=8+(4*CH);
int n = 0;
short [] y= new short[WIN];
for(n = 0; n<(CH*WIN); n+=CH);
y[n] = data[n];
n++;
canvas.drawPath path;
path.moveTo(0, y[0]);
for (int x=1; x<(WIN); x++);
path.lineTo(x, y[x]);
Paint paint;
paint.setColor(Color.BLACK);
Canvas.drawpath(path, paint);
At the line 38 "data[i];" I get the following error "Syntax error, insert "AssignmentOperator Expression" to complete Expression" can anybody help solve this.
Thanks
package org.physionet.challenge2011;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import android.graphics.Path;
import android.util.Log;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
public class ChallengeEntry {
public static final String DEBUGTAG = ChallengeEntry.class.toString();
final static int FS= 500; //Sampling Frequency
final static int CH= 12;
final static int MAX_RT= 220; //Max expected beats in minutes
final static int WIN=FS*10;
final static double PKS_MIN=40/6; // Minimum number of expected peaks in 10s
final static int FRGT=(int) (FS*0.04); // Window for ignoring consecutive peaks
final static short [] W={1,1,1,-1,1,1,-1,-1,1,1,1,1}; // Weights for each channel
final static double PK_TH=500; // Peak value hardcoded based on sample data
static short [] sum = new short[WIN]; //Array for storing summed channel data
//Define Quality values (could also be defined as enum...)
final static int INIT=0;
final static int GOOD = 0;
final static int BAD = 1;
short[] data=new short[WIN*CH];
synchronized public int get_result(InputStream iFile, final ECG_MetaData m_MetaData) throws IOException {
ObjectInputStream in = new ObjectInputStream(iFile);
//try {
data = (short[])in.readObject();
int i;
data[i];
i=8+(4*CH);
int n = 0;
short [] y= new short[WIN];
for(n = 0; n<(CH*WIN); n+=CH);
y[n] = data[n];
n++;
canvas.drawPath path;
path.moveTo(0, y[0]);
for (int x=1; x<(WIN); x++);
path.lineTo(x, y[x]);
Paint paint;
paint.setColor(Color.BLACK);
Canvas.drawpath(path, paint);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此行的作用是什么:
上面的行也使其无效!
What does this line do:
Also the line above makes it invalid!
整数我;很好,虽然没有意义,data[i];抛出错误是因为您没有声明任何内容,或分配任何值或实际上做该行的任何事情,它是。不管怎样,可能只是 lint 抱怨它。我将 Lint 检查关闭,直到导出为止,因为它似乎总是对任何事情都发脾气。
int i; is fine, although there's no point to it, data[i]; is throwing an error because you're not declaring anything, or assigning any values or really doing anything with that line, it's. Either way it's probably just lint that's complaining about it anyway. I turn Lint checking off till I export cause it always seems to throw fits about nothing.
你不需要这行:data[i],短数组的元素默认初始化为0。
You don't need this line: data[i], the element of short array is initialised as 0 by default.