Private construtor, public static method

Hi,
I'm having a problem trying to use a class' method. The class' constructor is private, and the methods are public static....
I created an object that belongs to the class, but then when I try to apply the methods to the object, the do not appear (qhen I write the period). Does anybody know why this happens...
Thanks and regards

Ok,
I'll show you the code I'm trying to use. In case you want to see more from it, I downloaded it from http://info.synapse.ru/software/jpitsa/
Just to give you a more clear idea, I unzipped the jar file which contained the code, and I got two classes with the same name on the same folder (one is a read-only file). The class I'm trying to use is called "Methods". The particular method I'm trying to use from that class is the one called hilbert, which does the Hilbert Transform (which is a Mathematical transformartion for signal processing).
Thanks for your help. Here comes my code:
* Spectral Analysis Module
* @author Denis Mishin ([email protected])
package jpitsa.core;
import java.util.LinkedList;
public final class Methods implements Params {
    private Methods() { }
     * Discrete Fourier Transform. <BR>
     * This method can be applied to data with any data points, not only a power of 2,
     * but works significantly slower then DFFT algorithm
     * @param source the data to transform
     * @param direct true if transform is direct, false for inverse
     * @param fullSpectrum  as fourier transform is symmetrical, it is possible to use only one part of it.\
     *      then the spectrum is created for 1/2 N points. reverse transform will work pretty well.
     * @see jpitsa.core.ComplexVector
    public static ComplexVector DFT (ComplexVector source, boolean direct) {
        ComplexVector result;
        float[] resIm, resRe;
        float[] srcIm, srcRe;
        float isign = (direct == true) ? 1f : -1f;
        srcIm = source.getDataImaginaryPart();
        srcRe = source.getDataRealPart();
        int N = srcIm.length;
        float mf = (direct == true) ? 1f : 1f/(float)N;
        resIm = new float[N];
        resRe = new float[N];
        double fac;
        double f1, fCos, fSin;
        f1 = isign*2*Math.PI/(float)N;
        for (int n=0; n < N/2; n++) {
            for (int k=0; k < (N-1); k++) {
                fac = (float)(f1*(double)(k*n));
                fCos = Math.cos(fac);
                fSin = Math.sin(fac);
                resRe[n] += srcRe[k]*fCos - srcIm[k]*fSin;
                resIm[n] += srcRe[k]*fSin + srcIm[k]*fCos;
            resRe[n] *= mf;
            resIm[n] *= mf;
            resRe[N-1-n] = resRe[n];
            resIm[N-1-n] = resIm[n];
        return new ComplexVector(resRe, resIm);
     * This method computes Discrete Fast Fourier Transform from a given
     * complex array. Return type is also a complex array.
     * Objectives: only data of 2^n points can be processed. Thus providing number of aliasing effects.
     * @see jpitsa.core.ComplexVector
    public static ComplexVector DFFT (ComplexVector source, boolean direct) {
        ComplexVector   result;
        float[] data;
        int isign, ndat;
        isign = (direct == true) ? 1 : -1;
        data = source.getPackedData();
        ndat = (data.length-1)/2;
        four1 (data, ndat, isign);
        //System.out.println("ndat="+ndat);
        // too big values .... [mar-99]
        if(!direct) {
            for(int i=0; i < ndat*2-1; i++)
                data[i] /= ndat;
        result = new ComplexVector();
        result.setPackedData(data);
        return result;
     * Computes a spectrum of TimeSeries
     * @return spectrum truncated to Nyquist frequency
    public static ComplexVector spectrum(TimeSeries source) {
      float sampfreq = source.getSamplingFrequency();
      ComplexVector spec = DFFT(new ComplexVector(source.getData(),null), true);
      float[] srcReal, srcImag, tgtReal, tgtImag;
      srcReal = spec.getDataRealPart();
      srcImag = spec.getDataImaginaryPart();
      tgtReal = new float[srcReal.length/2];
      tgtImag = new float[srcImag.length/2];
      System.arraycopy(srcReal, 0, tgtReal, 0, tgtReal.length);
      System.arraycopy(srcImag, 0, tgtImag, 0, tgtImag.length);
      return new ComplexVector(tgtReal, tgtImag);
     * Return given spectrum part of time series object
     * @param source source data
     * @param part defines which part of transform to extract (AMPLITUDE, PHASE, REAL, IMAGINARY)
     * @return spectrum (FrequencySeries) object
    public static FrequencySeries spectrum(TimeSeries source, int part) {
        ComplexVector spec = spectrum(source);
        float sPart[] = extractPart(spec, part);
        sPart[0] = sPart[1];
        return new FrequencySeries(sPart,source.getSamplingFrequency()/((float)(2*sPart.length)));
    public static FrequencySeries spectrum(TimeSeries source, int part, int smooth_win) {
        ComplexVector spec = spectrum(source);
        float sPart[] = extractPart(spec, part);
        sPart[0] = sPart[1];
        sPart = smooth(sPart, smooth_win);
        return new FrequencySeries(sPart, source.getSamplingFrequency()/((float)(2*sPart.length)));
public static FrequencySeries power_spectrum(TimeSeries src)
    float tr_wrk[];              /* pntr to work trace                   */
    float tr_tap[];              /* pntr to taper                        */
    float tr_ans[];              /* pntr to answer                       */
//    float *tr_src[];                /* pntr to source trace               */
    float t_samp;               /* sampling rate of trace               */
    float delta_f;          /* delta f of resulting power spec     */
    float wss;               /* window squared and summed          */
    float sumsq;          /* sum of the input trace squared     */
    float avesq;          /* ave of the input trace squared     */
    float pow_sum;          /* PSD Sum                    */
    int i1, i2;                 /* index of the zoom in spr_zoom        */
    int n1, n2, n3, n4;         /* taper window size                    */
    int i,j;                    /* loop vars                            */
    int index;                  /* index into data from cha_list        */
    int n_dat;                  /* size of trace                        */
    int done;                   /* tells us if we are done with io      */
    int io_res;                 /* result of an io operation            */
    int n_fft;                  /* number of points in fft window       */      
    int n_chk;                  /* temp to check that n_fft is pwr of 2 */
    int i_st;               /* start of window for fft          */
    int ask_each;               /* see if we ask for input each loop    */
    int io_taper;               /* taper method we are going to use     */
    boolean zero_pad;               /* true when we have to zero pad window */
    int sc_type;          /* type of scale ie lin-lin          */
    int selection_method;     /* selection used for zoom          */
    int status;               /* status of zoom               */
    int n;               /* number of fft's used for answer     */
      get the size of the trace
     float[] tr_src = src.getData();
     n_dat = tr_src.length;
     i1 = 0; i2 = tr_src.length-1;
     n_fft = next2power(n_dat); // check!!!!
     dt_copy_header(buffer[0],data[index]);
     dt_copy_header(buffer[1],data[index]);
     dt_copy_header(buffer[2],data[index]);
     dt_head_access(buffer[0],RCD_NDAT,(void *)&n_fft);
     dt_head_access(buffer[1],RCD_NDAT,(void *)&n_fft);
     n = n_fft/2 + 1;
//     dt_head_access(buffer[2],RCD_NDAT,(void *)&n);
     tr_wrk = new float[n_fft+1];
     System.arraycopy(tr_src, 0, tr_wrk, 0, tr_src.length);
     tr_tap = new float[tr_wrk.length];
     System.arraycopy(tr_wrk, 0, tr_tap, 0, tr_wrk.length);
     //tr_wrk = dt_trace_access(buffer,0,    0);
     //tr_tap = dt_trace_access(buffer,1    ,0);
     //tr_tap = // taper_it
     tr_ans = new float[n];
     //tr_ans = dt_trace_access(buffer,2    ,0);
     //tr_src = dt_trace_access(data  ,index,0);
      calculate the mean squared amplitude
     sumsq = 0f;
     for (j=i1; j<i2; j++) {
         sumsq += tr_src[j] * tr_src[j];
     avesq = sumsq / (float)(n_dat);
      get the taper values.  Buffer 0 gets tapered even thought there is nothing there
     n1 = 0;
     n2 = n3 = n_fft/2 - 1;
     n4 = n_fft - 1;
     Taper.doTapering(tr_tap, n1, n2, n3, n4, n_fft, WELCH_WINDOW);
      init the result
     for (j=0; j<n_fft/2; j++) {
         tr_ans[j] = 0;
      calculate wss (window squared and summed)
     wss = 0f;
     for (j=0; j<n_fft; j++) {
         wss += tr_tap[j] * tr_tap[j];
     wss *= (float)n_fft;
      calculate fft's until we need to pad with zeros
     t_samp = src.getSamplingInterval();
     zero_pad = false;
     i_st = i1;
     n = 0;
     while (!zero_pad) {
          load work array and taper
         for (j=0; j<n_fft; j++) {
          if ((i_st + j) > i2) {
              tr_wrk[j] = 0f;
              zero_pad = true;
          } else {
              tr_wrk[j] = tr_src[i_st+j] * tr_tap[j];
          calculate fft
         n++;
         realft(tr_wrk,n_fft/2,1);
          accum results
         tr_ans[0] += tr_wrk[0]*tr_wrk[0];
         for (j=2; j<n_fft; j+=2) {
          tr_ans[j/2] += 2.0 * (tr_wrk[j]*tr_wrk[j] + tr_wrk[j+1]*tr_wrk[j+1]);
         tr_ans[n_fft/2] += tr_wrk[1]*tr_wrk[1];
         i_st += n_fft/2;
      normalize
     for (j=0; j<=n_fft/2; j++) {
         tr_ans[j] /= ((float)n*wss);
      integrate result
     delta_f = t_samp*n_fft;
     pow_sum = tr_ans[0];
     for (j=1; j<n_fft/2; j++) {
         pow_sum += tr_ans[j];
     pow_sum += tr_ans[n_fft/2];
      convert to units^2/Hz
     for (j=0; j<n_fft/2; j++) {
         tr_ans[j] = tr_ans[j]/delta_f;
     //delta_f = (t_samp*n_fft);
    return new FrequencySeries(tr_ans, src.getSamplingFrequency()/ (float) tr_ans.length);
    //source.getSamplingFrequency()/((float)(2*sPart.length))
    public static FrequencySeries powspec1(TimeSeries src, int m) {
        float[] rawdata = src.getData();
        float[] res = PowSpec.spctrm(rawdata, m, rawdata.length/2, true);
        return new FrequencySeries(res, src.getSamplingFrequency()/2f);
     * returns coherence spectrum of two traces
     * result is a complex vector truncated to Nyquist frequency
    public static ComplexVector coherenceSpectrum (TimeSeries trace1, TimeSeries trace2) {
      if (trace1.getSamplingFrequency() != trace2.getSamplingFrequency())
        throw new IllegalArgumentException("Sampling freqs do not match");
      if (trace1.getDataLength() != trace2.getDataLength())
        throw new IllegalArgumentException("vectors length do not match");
      ComplexVector spec1, spec2, cohSpec;
      spec1 = spectrum(trace1);
      spec2 = spectrum(trace2);
      return (ComplexVector)spec1.mul(spec2.conjugate());
     * returns a given part of coherence spectrum of two traces
    public static FrequencySeries coherenceSpectrum (TimeSeries trace1, TimeSeries trace2, int part) {
      float[] res = extractPart(coherenceSpectrum(trace1,trace2), part);
      return new FrequencySeries(res, trace1.getSamplingFrequency()/(float)(2*res.length));
     * XCorellation of two vectors
     * @param v1 first vector
     * @param v2 second vector
    public static Vector1D corellation(Vector1D v1, Vector1D v2) {
      if (v1.getDataLength() != v2.getDataLength())
        throw new IllegalArgumentException("vectors length do not match");
      ComplexVector sp1, sp2, res;
      sp1 = DFFT(new ComplexVector(v1.getData(),null), true);
      sp2 = DFFT(new ComplexVector(v2.getData(),null), true);
      res = DFFT((ComplexVector)sp1.mul(sp2.conjugate()), false);
      float[] data = res.getDataAmplitudePart();
      float[] data2 = new float[data.length/2];
      System.arraycopy(data,0, data2, 0, data2.length); data2[0] = data2[1];     
      return new Vector1D(data2);
     * Computes a sonogram for a trace
     * This is an optimized algorithm,
    public static Matrix sonogram(TimeSeries data, float stepSec, float window, int taperType, float taperFraction) {
      LinkedList frq = new LinkedList();
      float sampling = data.getSamplingFrequency();
      int step = Math.round(sampling*stepSec);
      DataWindow currentWindow = data.getWindow();
      data.setMessagesAllowed(false);
      DataWindow win = new DataWindow();
      win.startOffset = currentWindow.startOffset;
      win.length      = Math.round(window*sampling);
      boolean computing = true;
      float[] tgt = null;
      int leng = 0;
      if (step < 1)
        step = 1;
      System.err.println("COMPUTING SONOGRAM: step="+stepSec+" ("+step+") length="+window+" ("+win.length+")");
      while (computing) {
        data.setWindow(win);
        ComplexVector spec;
        float[] src = taper(data, taperFraction, taperType).getTotalData();
        spec = DFFT(new ComplexVector(src,null), DIRECT);
        leng = spec.getDataPointsNumber() / 2;
        tgt = new float[leng];
        spec.getDataAmplitudePart(tgt);
        src = extractPart(spec, AMPLITUDE, tgt);
        tgt = new float[ftlen];
        System.arraycopy(src,0,tgt,0,tgt.length);
        tgt = src;
        // --- THIS CODE SHOULD BE REMOVED
        for (int i=0; i < tgt.length; i++)
            tgt[i] = (tgt[i] > 0) ? (float)Math.log(tgt) : tgt[i];
//tgt = smooth(tgt, Math.round(.05f*tgt.length));
// --- THIS CODE SHOULD BE REMOVED
//System.err.println("Step: "+win.startOffset+":"+win.length);
frq.add(tgt);
win.startOffset += step;
if (win.getEnd() > currentWindow.getEnd())
computing = false;
data.setWindow(currentWindow);
data.setMessagesAllowed(true);
Matrix m;
m = new Matrix(frq.size(), leng);
for (int i=0; i < frq.size(); i++)
m.setColumn(i,(float[])frq.get(i));
m.setBounds(data.getActiveRegionOffsetSeconds(), data.getActiveRegionOffsetSeconds()+data.getDuration(),
0f, data.getSamplingFrequency()/2f);
return m;
public static double[] toDouble(float[] data) {
double[] ret = new double[data.length];
for (int i=0; i < data.length; i++)
ret[i] = data[i];
return ret;
* Differentiate a trace
public static TimeSeries differentiate (TimeSeries src) {
int ndat;
float t_samp;
int i;
float[] tr;
float buff;
float buff0;
ndat = src.getDataLength();
t_samp = 1f/src.getSamplingFrequency();
tr = src.getData();
buff0 = tr[0];
tr[0] *= 2f/t_samp;
for(i=1;i<ndat;i++)
buff = tr[i];
tr[i] = (tr[i] - buff0)/t_samp;
buff0 = buff;
return (TimeSeries)src.newInstance(tr);
* Integrate a trace
* @param source source trace
* @param method method to use: Trapezoid or Tick rule
* @return integrated trace
public static TimeSeries integrate(TimeSeries source, int method) {
if (method == Params.TRAPEZOID)
return Integrate.trapRule(source);
else if (method == Params.TICK)
return Integrate.tickRule(source);
else
throw new IllegalArgumentException("Invalid method "+method);
* Integrates a trace using Tick's rule
* @param source source trace
* @return integrated trace
public static TimeSeries integrate(TimeSeries source) {
return integrate(source, Params.TICK);
* Trace resampling
* @param data source trace
* @param newSampFreq new sampling frequency
* @return new resampled trace
public static TimeSeries resample(TimeSeries data, float newSampFreq) {
float sampFreq = data.getSamplingFrequency();
float[] newdata = interpolate(data.getData(), sampFreq, newSampFreq);
TimeSeries res = (TimeSeries)data.newInstance(newdata);
res.samplingFrequency = newSampFreq;
return res;
* Generic moving average window smoothing. <BR>
* @param src source array
* @param nx2 half window length
public static Vector1D smooth(Vector1D src, int nx2) {
return src.newInstance( smooth(src.getData(), nx2) );
* Generic moving average window smoothing
* @param src source array
* @param nx2 half window length
public static float[] smooth(float[] src, int nx2) {
int ndat = src.length;
float[] res = new float[ndat];
//System.arraycopy(src, 0, res, 0, ndat);
float sum1, sum2;
int i, j, k;
//System.err.println("NX2 = "+nx2);
jpitsa.Out.cerr.println("data = "+src.length+"NX2 = "+nx2);
for(i=nx2;i<=ndat-(nx2+1);i++) {
sum1=0f; sum2=0f;
for(j=1;j<=nx2;j++) {
sum1 = sum1 + src[i-j];
sum2 = sum2 + src[i+j];
res[i] = (sum1+sum2+src[i])/(float)(2*nx2+1);
for(i=1;i<=nx2-1;i++) {
sum1=0f;
sum2=0f;
k = 0;
for(j=1;j<=i;j++) {
sum1 = sum1+ src[i-j];
sum2 = sum2+ src[i+j];
k = j;
res[i] = (sum1+sum2+src[i])/(float)(2*k+1);
for(i=1;i<=nx2-1;i++) {
sum1 = sum2 = 0f;
k = 0;
for(j=1;j<=i;j++) {
sum1 = sum1+ src[ndat-1-i-j];
sum2 = sum2+ src[ndat-1-i+j];
k = j;
res[ndat-1-i] = (sum1+sum2+src[ndat-1-i])/(float)(2*k+1);
res[ndat-1] = src[ndat-1];
res[0] = src[0];
return res;
* Generic 4-point spline interpolation method.
* @param data source data
* @param oldSampFreq source sampling frequency (1/sampling interval)
* @param newSampFreq target sampling frequency
public static float[] interpolate(float[] data, // source data
float oldSampFreq, // old sampling freq. [Hz]
float newSampFreq) // new samp. freq. [Hz]
int n_int = 4; /* degree of polynomial for interpoltion */
float xa[]= new float[n_int+1]; /* interpolation buffer */
float ya[]= new float[n_int+1]; /* interpolation buffer */
int closest_sample=-1, int_start_sample=-1;
float delta_value = 0f; /* error estimate for interpolated value */
// this is because PITSA and JPITSA use different schemes for sampling freq. storing
float t_samp_old = 1f / oldSampFreq;
float t_samp_new = 1f / newSampFreq;
int ndat = data.length;
float x1=t_samp_old/t_samp_new;
x1 *= (float)ndat;
int ndat2 = Math.round(x1+5e-1f); // Number of data in new arrary
float[] tr1 = data;
float[] b1 = new float[ndat2];
float[] prom_res= new float[2]; // temp. buffer for polint() procedure
// 4-point Spline interpolation procedure
float new_x;
for (int j = 0; j < ndat2;j++){
new_x = (float)j*t_samp_new;
/* determine index of closest sample in trace */
closest_sample = (int)(new_x/t_samp_old);
if ((closest_sample >= (int)((float)n_int/2.)) &&
(closest_sample <= ndat - (int)((float)n_int/2.) - 1))
int_start_sample = closest_sample - (int)((float)n_int/2.) - 1;
}else if (closest_sample < (int)((float)n_int/2.)) {
int_start_sample = -1;
}else if (closest_sample > ndat - (int)((float)n_int/2.) - 1) {
int_start_sample = ndat -1 - n_int;
for (int jj = 1;jj <= n_int; jj++) {
ya[jj] = tr1[int_start_sample + jj];
xa[jj] = (int_start_sample + jj)*t_samp_old;
prom_res[0] = x1; prom_res[1] = delta_value;
polint(xa,ya,n_int,new_x, prom_res);
b1[j] = x1 = prom_res[0]; delta_value = prom_res[1];
return b1;
* Generic 4-point spline interpolation method.
* @param data source data
* @param newLength number of points in a new array
public static float[] interpolate(float[] data, int newLength) {
int n_int = 4; /* degree of polynomial for interpoltion */
float xa[]= new float[n_int+1]; /* interpolation buffer */
float ya[]= new float[n_int+1]; /* interpolation buffer */
int closest_sample=-1, int_start_sample=-1;
float delta_value = 0f; /* error estimate for interpolated value */
// this is because PITSA and JPITSA use different schemes for sampling freq. storing
float t_samp_old = 1f / oldSampFreq;
float t_samp_new = 1f / newSampFreq;
int ndat = data.length;
float x1=t_samp_old/t_samp_new;
x1 *= (float)ndat;
int ndat2 = Math.round(x1+5e-1f); // Number of data in new arrary
int ndat = data.length;
int ndat2 = newLength;
float t_samp_old = 1f;
float t_samp_new = ((float)ndat)/((float)ndat2);
float x1 = (float)ndat2;
float[] tr1 = data;
float[] b1 = new float[ndat2];
float[] prom_res= new float[2]; // temp. buffer for polint() procedure
// 4-point Spline interpolation procedure
float new_x;
for (int j = 0; j < ndat2;j++){
new_x = (float)j*t_samp_new;
/* determine index of closest sample in trace */
closest_sample = (int)(new_x/t_samp_old);
if ((closest_sample >= (int)((float)n_int/2.)) &&
(closest_sample <= ndat - (int)((float)n_int/2.) - 1))
int_start_sample = closest_sample - (int)((float)n_int/2.) - 1;
}else if (closest_sample < (int)((float)n_int/2.)) {
int_start_sample = -1;
}else if (closest_sample > ndat - (int)((float)n_int/2.) - 1) {
int_start_sample = ndat -1 - n_int;
for (int jj = 1;jj <= n_int; jj++) {
ya[jj] = tr1[int_start_sample + jj];
xa[jj] = (int_start_sample + jj)*t_samp_old;
prom_res[0] = x1; prom_res[1] = delta_value;
polint(xa,ya,n_int,new_x, prom_res);
b1[j] = x1 = prom_res[0]; delta_value = prom_res[1];
return b1;
* Butterworth Band Pass Filter
* implements Band, Low and High Pass filters
* All three Butterworth filters are recursive time domain filters
* using the bilinear z-transform design after Stearns (1984)
* They are applied in section of 30 dB/decade or 12 Db/octave for
* the slope of the transition band. They may be given zero phase
* characteristic by filterin the reversed filtered time seris
* again (forwards-backwards filtering)
* Finally, the trace is reversed to its original orientation
* based on spr_bp_bworth (spr/spr_bpbt.c)
* @author Denis Mishin ([email protected]) - Java code
* @author PITSA team - original C code
* @param trace input trace
* @param flo low cut corner frequency [Hz]
* @param fhi high cut corner frequency [Hz]
* @param ns number of filter passes [Hz]
* @param is_zph TRUE -> zero phase filter
* @return new filtered trace
public static TimeSeries bandpassFilter(TimeSeries trace,
float flo,
float fhi,
int ns,
boolean is_zph)
final int MAX_SEC = 10;
int i, k; /* index */
int n,m,mm;
int ndat; /* number of points in trace */
double tsa;
double a[] = new double[MAX_SEC+1];
double b[] = new double[MAX_SEC+1];
double c[] = new double[MAX_SEC+1];
double d[] = new double[MAX_SEC+1];
double e[] = new double[MAX_SEC+1];
double f[][] = new double[MAX_SEC+1][6];
double temp;
double c1,c2,c3;
double w1,w2,wc,q,p,r,s,cs,x;
float tr[];
ndat = trace.getDataLength();
tsa = 1f / trace.getSamplingFrequency();
tr = trace.getData();
// remove mean
float mean = mean(tr);
for (i=0; i < tr.length; i++)
tr[i] -= mean;
/* design filter weights */
/* bandpass */
w1 = java.lang.Math.sin(flo*java.lang.Math.PI*tsa)/java.lang.Math.cos(flo*java.lang.Math.PI*tsa);
w2 = java.lang.Math.sin(fhi*java.lang.Math.PI*tsa)/java.lang.Math.cos(fhi*java.lang.Math.PI*tsa);
wc=w2-w1;
q=wc*wc +2.0*w1*w2;
s=w1*w1*w2*w2;
for (k=1;k<=ns;k++)
c1 = (float)(k+ns);
c2 = (float)(4*ns);
c3 = (2.0*c1-1.0)*java.lang.Math.PI/c2;
cs = java.lang.Math.cos(c3);
p = -2.0*wc*cs;
r = p*w1*w2;
x = 1.0+p+q+r+s;
a[k]= wc*wc/x;
b[k]= (-4.0 -2.0*p+ 2.0*r+4.0*s)/x;
c[k]= (6.0 - 2.0*q +6.0*s)/x;
d[k]= (-4.0 +2.0*p -2.0*r +4.0*s)/x;
e[k]= (1.0 - p q-r s)/x;
/* set initial values to 0 */
for(n=0;n<=MAX_SEC;n++)
for(m=0;m<=5;m++)
f[n][m]=0.0;
/* filtering */
for (m=1;m<=ndat;m++) {
f[1][5]= tr[m-1];
/* go thru ns filter sections */
for(n=1;n<=ns;n++)
temp=a[n]*(f[n][5]-2.0*f[n][3] +f[n][1]);
temp=temp-b[n]*f[n+1][4]-c[n]*f[n+1][3];
f[n+1][5]=temp-d[n]*f[n+1][2]-e[n]*f[n+1][1];
/* update past values */
for(n=1;n<=ns+1;n++)
for(mm=1;mm<=4;mm++)
f[n][mm]=f[n][mm+1];
/* set present data value and continue */
tr[m-1] = (float)f[ns+1][5];
// System.out.println("tr ["+(m-1)+"] = "+tr[m-1]);
if (is_zph == true) {
/* filtering reverse signal*/
for (m=ndat;m>=1;m--) {
f[1][5]= (double)tr[m-1];
/* go thru ns filter sections */
for(n=1;n<=ns;n++)
temp=a[n]*(f[n][5]-2.0*f[n][3] +f[n][1]);
temp=temp-b[n]*f[n+1][4]-c[n]*f[n+1][3];
f[n+1][5]=temp-d[n]*f[n+1][2]-e[n]*f[n+1][1];
/* update past values */
for(n=1;n<=ns+1;n++)
for(mm=1;mm<=4;mm++)
f[n][mm]=f[n][mm+1];
/* set present data value and continue */
tr[m-1] = (float)f[ns+1][5];
// restore mean
for (i=0; i < tr.length; i++)
tr[i] += mean;
return (TimeSeries)trace.newInstance(tr);
* Gaussian filter. <BR>
* Removes mean by default
public static TimeSeries gaussianFilter(TimeSeries src, float fCent, float alpha) {
return gaussianFilter(src, fCent, alpha, true);
* Gaussian bandpass filter
* @param src source trace
* @param fCent central frequency value
* @param alpha bandwidth
* @param rmean remove mean first flag
* @return new filtered vector
public static TimeSeries gaussianFilter(TimeSeries src, float fCent, float alpha, boolean rmean) {
float[] fc = new float[1]; fc[0] = fCent;
float[] al = new float[1]; al[0] = alpha;
return gaussianFilter(src, fc, al, rmean);
* Gaussian bandpass filter
* @param src source trace
* @param fCent central frequency values
* @param alpha bandwidths
public static TimeSeries gaussianFilter(TimeSeries src, float fCent[], float alpha[], boolean rmean) {
float[] sourceData = src.getData();
float mean = 0f;
int i;
if (rmean) {
mean = mean(sourceData);
for (i=0; i < sourceData.length; i++)
sourceData[i] -= mean;
ComplexVector spec = DFFT(new ComplexVector(src.getData(),null), true);
int npoints = spec.getDataPointsNumber();
float nyq = src.getSamplingFrequency()/2f;
// ---- computing the Gaussian distribution function
float[] gaus = new float[npoints];
float freqIncrement = (2f*nyq)/((float)npoints);
int cp = 0; float f = 0f;
while (f <= nyq && cp < (npoints/2) ) {
gaus[cp] = Filter.gaussianWindow(f,fCent,alpha);
cp++; f += freqIncrement;
int last_index = gaus.length-1;
for (cp=0; cp < (npoints/2); cp++)
     gaus[last_index - 1] = gaus[cp];
float[] real = extractPart(spec,Params.REAL);
float[] imag = extractPart(spec,Params.IMAGINARY);
//System.out.println("Gaus: real.length="+real.length+" spec.length="+npoints+
//     " stop at "+f+" nyq="+nyq);
real = multiplicate(real,gaus);
imag = multiplicate(imag,gaus);
//real = glue(real, invert(real));
//imag = glue(imag, invert(imag));
ComplexVector inv = DFFT(new ComplexVector(real,imag), Params.INVERSE);
real = extractPart(inv, Params.REAL);
float[] data = new float[real.length/2];
System.arraycopy(real,0,data,0,data.length);
TimeSeries result = new TimeSeries(data, nyq*2f);
float[] data = sourceData;
System.arraycopy(real,0,data,0,data.length);
if (rmean) {
for (i=0; i < data.length; i++)
data[i] += mean;
TimeSeries result = (TimeSeries)src.newInstance(data);
return result;
* Discretisation of source trace data
* Discretization will treat the input trace as a pseudo-continuous trace from which

Similar Messages

  • JDev 3.2 Deployment wizard failed to show public static methods in step #3.

    JDeveloper 3.2 and 3.1 Deployment Wizard ( step #3) does not show any public static methods being deployed as Java stored procedures. The "settings" button is disabled.
    Is this a demo version of the tool ?

    It's probably easier to add them all and remove the ones you don't want. Admittedly this is a bit cumbersome, because the 3.2 navigator doesn't allow multiple selection..
    (one area that's much better in 9i :) )
    Brian

  • Can you override a public static method?

    Can you override a public static method?

    A static method belongs to a class, not to a particular object, because you can call them without having an object instantiated. Methods are over rided which are inherited from an object. Since Static methods (although inherited) are not bound to a particular object, are not overridden.
    Though you have a method in the subclass with the same signatures but if you try to call super.____() you will get the error
    non-static variable super cannot be referenced from a static context

  • What is the use of private static method/variable?

    Hi All,
    I have read lots of books and tried lots of things but still not very clear on the
    topic above.
    When exactly do we HAVE to use private static methods?
    private implies its only for class, cannot be accessed outside.
    But then static means, it can be accessed giving classname.method.
    They seem to be contradicting each other.
    Any examples explaining the exact behaviour will be well appreciated.
    Thanks,
    Chandra Mohan

    Static doesn't really "mean" that the method/field is intended for use outside the class - that is exactly what the access modifier is for.
    Static implies that it is for use in relation to the class itself, as opposed to an instance of the class.
    One good example of a private static method would be a utility method that is (only) invoked by other (possibly public) static methods; it is not required outside the class (indeed, it might be dangerous to expose the method) but it must be called from another static method so it, in turn, must be static.
    Hope this helps.

  • Singleton class with static method

    Hi,
    I have made a fairly simple singletion class STClass. EX:
    Consider tow cases
    CASE-1:
    private static STClass singleInstance;
    private static int i;
    private STClass()
    public static STClass instance()
         if (singleInstance == null)
              singleInstance = new STClass();
              loadConfigFile("XYZ");
         return singleInstance;
    private static void loadConfigFile(String fileName)
         //SOME CODE in which use private variable "i"
    CASE-2:
    private static STClass singleInstance;
    private int i;
    private STClass()
         loadConfigFile("XYZ");
    public static STClass instance()
         if (singleInstance == null)
              singleInstance = new STClass();
         return singleInstance;
    private void loadConfigFile(String fileName)
         //SOME CODE in which use private variable "i"
    What is the differnce between two case and which one will be best and why???
    Someone told me "If u keep variables and methods as static the the whole purpose of singleton class is defeated"
    please justify this statement

    It seems to me that this way should be more "correct":
    public class STClass {
    private static STClass singleInstance;
    private int i;
    private STClass() {
    public static STClass getInstance() {
    if (singleInstance == null) {
    singleInstance = new STClass();
    singleInstance.loadConfigFile("XYZ");
    return singleInstance;
    private void loadConfigFile(String fileName) {
    //SOME CODE in which use private variable "i"
    }And it is also compatible with your CASE-2.
    Hope this helped,
    Regards.I wouldnot agree with this piece of code here because of JMM bug. check this
    http://www.javaworld.com/jw-02-2001/jw-0209-double-p2.html
    What about proposing your own version, explained ?...

  • Static methods in multi-threaded environment

    Hi,
    I am wondering what happens when several threads try to access the same static method ?
    The static method is not synchronized.
    Will this create any performance issues ?
    The actual scenario is of a J2EE server, where several Session Bean instances try to access a static method in a utility class. Will some session beans have to wait till others are being serviced ?
    thnx n regards
    s giri

    thanx for replying.
    yes. the operations are thread-safe. we do not change the state of any object.
    but we make an rmi call to another application thru this static method.
    is it ok?
    Currently, my session bean has too many private methods - each calling the other application. Due to some quality metrics (a class must be restricted to 700 lines) we have to consider moving these private methods into some Helper class in the form of "public static methods". We have made many utility methods as static, but have some reservations abt doing a similar thing for these methods that call other application.
    regards
    Shivraman

  • Static Method Call

    Hi,
    I had a private method which is called in a number of different places in my class. I have changed this method to be a public static method, will this effect the other areas in this class which are calling this method?
    Thanks
    Dude

    Did you have to change any fields from instance to static? If not, then the method probably did not need to be an instance method and you should be Ok. You should just make sure that what the method is doing is not designed to update / manipulate an instance of the class.

  • Redefine Static Methods in ABAP OO

    Hello,
    I want to redefine an public static method and returns always an error.
    Okay, I already solved the problem with an workaround, but I still don't understand, why it is not possible to redefine static methods in ABAP OO.
    If someone can give me an plausible reason, so I don't have do die stupid. G
    Thanks for help!
    Matthias

    It is built into the language that way.  HEre is a link that may or may not give you an answer.
    redefine static method?
    Regards,
    Rich Heilman

  • Can only see 4 static methods out of 14

    I have a single public class containing about 14 public static methods and some inner clasess.
    When using the JDeveloper Ver3.1 build 681, to deploy these java methods as RDBMS stored procs, only 4 of the methods & inner classes are visible to publish.
    The methods available to publish are main(), another method which calls most of the other non-available methods and 2 completely independent methods.
    I need a clarification on my understaning.
    If a method A calls another method B in the same class but B is not published as a stored proc.
    When I invoke A, RDBMS sees a java source stored procedure and JSERVER kicks in. I presume that JSERVER can see all the methods declared in the class as I see in the *.java file.
    When you deploy, what is taken across from the *.java file apart from connection properties details.
    Any help/pointers will be appreciated. Thanx in advance.

    I have a single public class containing about 14 public static methods and some inner clasess.
    When using the JDeveloper Ver3.1 build 681, to deploy these java methods as RDBMS stored procs, only 4 of the methods & inner classes are visible to publish.
    The methods available to publish are main(), another method which calls most of the other non-available methods and 2 completely independent methods.
    I need a clarification on my understaning.
    If a method A calls another method B in the same class but B is not published as a stored proc.
    When I invoke A, RDBMS sees a java source stored procedure and JSERVER kicks in. I presume that JSERVER can see all the methods declared in the class as I see in the *.java file.
    When you deploy, what is taken across from the *.java file apart from connection properties details.
    Any help/pointers will be appreciated. Thanx in advance.

  • Public static vs private

    Hi
    I have 3 classes, A, B & C.
    I have one variable, var, that can be used in class B and C; I have declared it in class B, and passed when I create an istance of C in B.
    Then I need also to read its value in class A.
    Now the ways are two (I think ...):
    1. declare it as public static in class A and then use A.var in class B and C;
    2. declare it as private in A and then passed to B when I create in A an istance of B and to C then I create in B an istance to C.
    Considerations:
    a. I don't like to declare public variables, I think is a bad way to program,
    isn'it?
    b. the second way is a problem when I have 10 variables (the constructors have too many parameters), right?
    Could anyone help?

    The problem is I tryied to find these answer in
    Intenrnet, but I don't find anything.That's fine. That's why most of us are here.
    My application works as this:
    I have a main class (A) that have a main menu in
    console style; from this class I create a new client
    class (B) that receive commands from a server; if a
    command is valid, B create an istance of C that
    rappresents a trainer machine. In C I have all
    workout variables (time, incline, speed ...).
    By menu (in class A) i could pause the trainer and by
    A and/or remote server I could ask the state of the
    machine (C).
    In your explanation above, I draw your attention to "instance". You are making instances of your classes. That being the case, your variables should probably be instance variables
    NOT
    public static int firstVariable = 0;BUT
    protected int firstVariable = 0;You would then provide get and set methods to access the protected variable.
    If you find yourself writing B b = new B() then you know you are dealing with an instance and you should avoid all static variables unless you really do mean "this value is the same across all Bs".
    I have 8 state variables I could manage in that way.
    The only way I have for now found is definite a
    public static long vars in C (and use them in A e B
    as C.state, C.time, ...) to avoid to pass 8
    parameters when I create the istances from A to C.Assuming that C has eight variables and your design isn't done yet you can still pass an instance of C to the other objects. They don't need to have their method/constructor signatures changed when you add a new variable as your C object encapsulates it already.
    >
    Is right? Any other suggestion?Yes. Don't stick to "C.time" because that's what you've got so far. Instead, you should be using
    C c = new C();
    c.getTime();That way, the time variable is unique to the instance.

  • Private static method accessed from main, please explain

    hi,
    i dont understand what happened with this code:
    static means you dont have to have an object to call the method - fine.
    but private means that the method is only available within the class,
    so how can one call the method initLookAndFeel() from main?
    public class Converter{
       //constructors etc...
       private static void initlookAndFee(){/* do stuff */}
    }//end of class converter
    public static void main( String args[]){
       initLookAndFeel(); ///????????????????????????????????????
       Converter converter = new Converter();
    }//end of main

    ...dang those stupid SMALL parenthesis!
    yes, main IS within the class converter... doh!
    thanx. M.

  • How can i pass the values to method public static void showBoard(boolean[][

    I need x and y to pass to the method
    public static void showBoard(boolean[][] board
    i am very confused as to why its boolean,i know its an array but does that mean values ar true or false only?Thanks
    import java.util.Random;
    import java.util.Scanner;
    public class Life1
         public static void main(String[] args)
              int x=0;
              int y=0;
              Scanner keyIn = new Scanner(System.in);
              System.out.println("Enter the first dimension of the board : ");
              x = keyIn.nextInt();
              System.out.println("Enter the second dimension of the board : );
              y = keyIn.nextInt();
              boolean[][] board = new boolean[x][y];
              fillBoard(board);
              showBoard(board);
              //Ask the user how many generations to show.
              board = newBoard(board);
              showBoard(board);
         //This method randomly populates rows 5-9 of the board
         //Rewrite this method to allow the user to populate the board by entering the
         //coordinates of the live cells.  If the user requests that cell 1, 1 be alive,
         //your program should make cell 0,0 alive.
         public static void fillBoard(boolean[][] board)
              int row, col, isAlive;
              Random picker = new Random();
              for(row = 4; row < 9; row++)
                   for(col = 4; col < 9; col++)
                        if (picker.nextInt(2) == 0)
                          board[row][col] = false;
                        else
                          board[row][col] = true;
         //This method displays the board
         public static void showBoard(boolean[][] board)
              int row, col;
              System.out.println();
              for(row=0; row < x; row++)
                   for(col=0; col<y; col++)
                        if (board[row][col])
                             System.out.print("X");
                        else
                             System.out.print(".");
                   System.out.println();
              System.out.println();
         //This method creates the next generation and returns the new population
         public static boolean[][] newBoard(boolean[][] board)
              int row;
              int col;
              int neighbors;
              boolean[][] newBoard = new boolean[board.length][board[0].length];
              makeDead(newBoard);
              for(row = 1; row < board.length-1; row++)
                   for(col = 1; col < board[row].length-1; col++)
                        neighbors = countNeighbors(row, col, board);
                        //make this work with one less if
                        if (neighbors < 2)
                             newBoard[row][col]=false;
                        else if (neighbors > 3)
                             newBoard[row][col] = false;
                        else if (neighbors == 2)
                             newBoard[row][col]= board[row][col];
                        else
                             newBoard[row][col] = true;
              return newBoard;
         //This method counts the number of neighbors surrounding a cell.
         //It is given the current cell coordinates and the board
         public static int countNeighbors(int thisRow, int thisCol, boolean[][] board)
              int count = 0;
              int row, col;
              for (row = thisRow - 1; row < thisRow + 2; row++)
                   for(col = thisCol - 1; col < thisCol + 2; col++)
                     if (board[row][col])
                          count++;
              if (board[thisRow][thisCol])
                   count--;
              return count;
         //This method makes each cell in a board "dead."
         public static void makeDead(boolean[][] board)
              int row, col;
              for(row = 0; row < board.length; row++)
                   for(col = 0; col < board[row].length; col++)
                        board[row][col] = false;
    }

    this is what im workin with mabey you can point me in the right directionimport java.util.Random;
    /* This class creates an application to simulate John Conway's Life game.
    * Output is sent to the System.out object.
    * The rules for the Life game are as follows...
    * Your final version of the program should explain the game and its use
    * to the user.
    public class Life
         public static void main(String[] args)
              //Allow the user to specify the board size
              boolean[][] board = new boolean[10][10];
              fillBoard(board);
              showBoard(board);
              //Ask the user how many generations to show.
              board = newBoard(board);
              showBoard(board);
         //This method randomly populates rows 5-9 of the board
         //Rewrite this method to allow the user to populate the board by entering the
         //coordinates of the live cells.  If the user requests that cell 1, 1 be alive,
         //your program should make cell 0,0 alive.
         public static void fillBoard(boolean[][] board)
              int row, col, isAlive;
              Random picker = new Random();
              for(row = 4; row < 9; row++)
                   for(col = 4; col < 9; col++)
                        if (picker.nextInt(2) == 0)
                          board[row][col] = false;
                        else
                          board[row][col] = true;
         //This method displays the board
         public static void showBoard(boolean[][] board)
              int row, col;
              System.out.println();
              for(row=0; row < 10; row++)
                   for(col=0; col<10; col++)
                        if (board[row][col])
                             System.out.print("X");
                        else
                             System.out.print(".");
                   System.out.println();
              System.out.println();
         //This method creates the next generation and returns the new population
         public static boolean[][] newBoard(boolean[][] board)
              int row;
              int col;
              int neighbors;
              boolean[][] newBoard = new boolean[board.length][board[0].length];
              makeDead(newBoard);
              for(row = 1; row < board.length-1; row++)
                   for(col = 1; col < board[row].length-1; col++)
                        neighbors = countNeighbors(row, col, board);
                        //make this work with one less if
                        if (neighbors < 2)
                             newBoard[row][col]=false;
                        else if (neighbors > 3)
                             newBoard[row][col] = false;
                        else if (neighbors == 2)
                             newBoard[row][col]= board[row][col];
                        else
                             newBoard[row][col] = true;
              return newBoard;
         //This method counts the number of neighbors surrounding a cell.
         //It is given the current cell coordinates and the board
         public static int countNeighbors(int thisRow, int thisCol, boolean[][] board)
              int count = 0;
              int row, col;
              for (row = thisRow - 1; row < thisRow + 2; row++)
                   for(col = thisCol - 1; col < thisCol + 2; col++)
                     if (board[row][col])
                          count++;
              if (board[thisRow][thisCol])
                   count--;
              return count;
         //This method makes each cell in a board "dead."
         public static void makeDead(boolean[][] board)
              int row, col;
              for(row = 0; row < board.length; row++)
                   for(col = 0; col < board[row].length; col++)
                        board[row][col] = false;
    }

  • Why do we need private static method or member class

    Dear java gurus,
    I have a question about the use of private and static key words together in a method or inner class.
    If we want to hide the method, private is enough. a private static method is sure not intended to be called outside the class. So the only usage I could see is that this private static method is to be called by another static method. For inner class, I see the definition of Entry inner class in java.util.Hashtable, it is static private. I don't know why not just define it as private. Could the static key word do anything better.
    Could anybody help me to clear this.
    Thanks,

    What don't you get? Private does one thing, andstatic does >something completely different.
    If you want to listen to music, installing an airconditioner doesn't help>
    Hi, if the private keyword is the airconditioner, do
    you think you could get music from the static keyword
    (it acts as the CD player) in the following codes:You're making no sense and you're trying to stretch the analogy too far.
    Private does one thing. If you want that thing, use private.
    Static does something completely different and unrelated. If you want that thing, use static.
    If you want both things, use private static.
    What do you not understand? How can you claim that you understand that they are different, and then ask, "Why do we need static if we have private"? That question makes no sense if you actually do understand that they're different.

  • Private static method

    How do I get access to a private static method of a class?
    I can't just call it by object.privatemethod() , right?

    unless your call is made within the body of the
    class, you cannot call it, otherwise just call it via
    a static ref of the class
    ObjectName.privateMethod()
    (not)
    ObjectInstance.privateMethod()...where "ObjectName" is the name of the class.
    Or you can just call it with privateMethod(), but that tends so suggest "this.privateMethod()" so I'd go with qualifying it with the class name, to be clear.

  • Init() method: private vs. public

    I have a question:
    What is the difference in defining your init() method in a servlet as private vs. public since it is automatically executed when the class is instantiated?
    thanks

    cbreneman,
    For future reference,
    public void foo() {
        method vailable to all
    protected void foo() {
        method vailable to pacakge
    private void Foo() {
        method vailable to this
    }You can do this:
    public String bar;
    protected String bar;
    private String bar;You cannot do this:
    private void Foo() {
        public String bar = "Oops!";
    }For an Applet, init() is inherited when you extend the Applet class. It must be overidden if you have work to do before your subclass becomes active. It is defined by the superclass as public and void. If you were to create an init() method that was private and returned a String, you might (the compiler will stop you if you try to define init() twice) have a different method, but you would not have overidden public void init(). If you tried something like private void init() the compiler would stop you:
    init() in FooBar cannot override init() in java.applet.Applet; attempting to assign weaker access privileges; was public
    private void init() {
    ^
    1 error
    Make sense?
    With servlets, the init() method is there for slightly different reasons and to be honest, I am not sure that you inherit it? I believe it acts as a special constructor? I don't write many servlets, so I'll shut up and let someone who does give a better answer.
    Hope this helps.

Maybe you are looking for

  • Retrieve data from a maintenance view

    Hello, I created a specefic table. i want to add a check when deleting lines from a maintenance view. How to retrieve selected data ? thanks, Meriem.

  • How can I display different error bars for each point on a scatter graph?

    I have a scatter chart in Numbers and I need to add error bars to the points along both the x and y axes, however, the size of the error bars for each point need to be of different sizes. Is there a way to accomplish this or is there some kind of wor

  • My podcasts what format for use with iPod

    I have my own website www.chumlordfishing.com and I do instructional podcasts, so far every podcast needs to be converted in iTunes to play on my and others iPods. What format will allow the podcasts to be played without needing to be converted. Addi

  • Jagged images in slideshow

    After creating a slideshow in iDVD 7.0 and viewing it on my TV (42" Toshiba) I get jagged images. They seem to loading fine between transitions but as soon as they do the image is jagged. I used all kinds of different images with different resolution

  • Rich Client Login fails from Infoview but works fine if opened from desktop

    Hi Friends, When i open WebI Rich Client from my infoview (By changing the preferrance settings in Infoview), it returns an error as "Login Fails" , but if i open the webI Rich Client from my Start->Programs->Business Objects XI 3.0->WebI Rich Client