语法错误,插入“AssignmentOperator Expression”以完成表达式

时间:2011-07-27 09:32:24

标签: android insert expression assignment-operator

在第38行“data [i];”我得到以下错误“语法错误,插入”AssignmentOperator表达式“完成表达式”任何人都可以帮助解决这个问题。

由于

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);

3 个答案:

答案 0 :(得分:0)

这一行做了什么:

data[i];

上面一行也使它无效!

int i;

答案 1 :(得分:0)

int i;很好,虽然没有意义,数据[i];抛出一个错误,因为你没有声明任何东西,或者分配任何值,或者真的在那条线上做任何事情,就是这样。无论哪种方式,它可能只是lint,无论如何都在抱怨它。我把Lint检查关闭,直到我导出,因为它总是似乎无所事事。

答案 2 :(得分:0)

你不需要这一行:data [i],短数组的元素默认初始化为0.