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

发布于 2024-11-27 01:34:06 字数 1902 浏览 1 评论 0原文

第 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

逆蝶 2024-12-04 01:34:06

此行的作用是什么:

data[i];

上面的行也使其无效!

int i;

What does this line do:

data[i];

Also the line above makes it invalid!

int i;
信仰 2024-12-04 01:34:06

整数我;很好,虽然没有意义,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.

缱绻入梦 2024-12-04 01:34:06

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

You don't need this line: data[i], the element of short array is initialised as 0 by default.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文