⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coda.java

📁 一个用java写的地震分析软件(无源码)-used to write a seismic analysis software (without source)
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
*/
    protected String outParmsString() {
        StringBuffer sb = new StringBuffer(256);
        sb.append(" algo: ").append(algorithm.toStringSQL());
        sb.append(" winSec: ").append(windowSize.toStringSQL());
        sb.append(" winCnt: ").append(windowCount.toStringSQL());
        sb.append(" wgt_in: ").append(weightIn.toStringSQL());
        sb.append(" res: ").append(residual.toStringSQL());
        return sb.toString();
    }

/**
*  Return a string describing channel coda magnitude parameters
*/
    protected String magParmsString() {
        StringBuffer sb = new StringBuffer(256);
        if (magnitude != null) {
            sb.append("\n");
            sb.append(" NetMag: ").append(magnitude.toString());
        }
        if (! channelMag.value.isNull()) {
            sb.append("\nChlMag: ").append(channelMag.toString());
        }
        return sb.toString();
    }
    /*
      Return a fixed format string of the form:
<tt>
Nt Sta  Chn    Dist    Afix   Afree    Qfix   Qfree     tau     res   ChnlMag  Residual   Quality      Corr    Weight
CI MEC  EHZ   44.59    3.52    0.98    1.80   -1.08   17.46    0.12    1.7636    0.0000    0.0000   -1.7600    0.0000
</tt>
You must call getNeatStringHeader() to get the header line shown above.

@see getNeatStringHeader()
    */
    public String toNeatString() {

	Format df1 = new Format("%7.2f");

	return getChannelObj().getChannelName().toNeatString() + " " +
	    df1.form(getDistance()) + " " +
	    df1.form(aFix.floatValue()) + " " +
	    df1.form(aFree.floatValue()) + " " +
	    df1.form(qFix.floatValue()) + " " +
	    df1.form(qFree.floatValue()) + " " +
	    df1.form(tau.floatValue()) + " " +
	    df1.form(residual.floatValue()) + " " +
	    channelMag.toNeatString();			// include channelmag info
    }
    /*
      Return a fixed format header to match output from toNeatString(). Has the form:
<tt>
Nt Sta Chn    Dist    Afix   Afree    Qfix  Qfree      tau     res
xxxxxxxxxx xxxx.xx xxxx.xx xxxx.xx xxxx.xx xxxx.xx xxxx.xx xxxx.xx
</tt>

@see: toNeatString()
    */
    public static String getNeatStringHeader() {
	return ChannelName.getNeatStringHeader() +
             "    Dist    Afix   Afree    Qfix   Qfree     tau     res"+
	    ChannelMag.getNeatStringHeader();		// include channelmag
    }
/**
* Flags this Coda instance as deleted, does not remove object from memory or the DataSource.
* Other classes must decide how they want to handle deleted codas when commit() is called.
* Deleted codas are unassociated from any Solution or Magnitude objects.
* Override this method in subclasses to add additional behavior.
*/
    public boolean delete() {
        super.delete();
        unassociate();
        unassociateMag();
        return true;
    }

/**
* Associate this instance with the input Solution object.
* @see #unassociate()
*/
    public void associate(Solution sol) {
        this.sol = sol;
        if (sol != null) sol.addCoda(this);
    }

/**
* Unassociate this instance from its associated Solution, if any.
* @see #associate(Solution)
*/
    public void unassociate() {
        if (sol != null) {
            sol.removeCoda(this);
            sol = null;
        }
    }

/** Associate this instance with the input Magnitude object.
*   @see #unassociateMag()
*/
    public void associateMag(Magnitude mag) {
        magnitude = mag;
        if (magnitude != null) magnitude.addCoda(this);
    }
/**
* Return the Magnitude associated with this Coda.
*/
    public Magnitude getMagnitude() {
       return magnitude;
    }
/** Unassociate Coda from its associated Magnitude, if any.
*   @see #associateMag(Magnitude)
*/
    public void unassociateMag() {
        if (magnitude != null) {
            magnitude.removeCoda(this);
            this.magnitude = null;
        }
    }

/** Return the Magnitude object associated with this instance. Returns null if unassociated.
*   @see #associateMag(Magnitude)
*/
    public Magnitude getAssociatedMag () {
        return magnitude;
    }

/** Return the ChannelMag object associated with this instance.
*/
    public ChannelMag getChannelMag() {
        return channelMag;
    }

/** Sets the ChannelMag object associated with this instance.
*/
    public void setChannelMag(ChannelMag channelMag) {
        this.channelMag = channelMag;
    }

/** Return true if this Coda instance has been associated with a Magnitude.
*   @see #associateMag(Magnitude)
*/
    public boolean isAssociatedWithMag() {
        return (magnitude != null) ;
    }

/** Return true if this Coda instance is associated with the input Magnitude object.
*   @see #associateMag(Magnitude)
*/
    public boolean isAssociatedWithMag(Magnitude compMag) {
        return (magnitude == compMag);
    }

/** Returns true if the channel and coda type (e.g. "P", "S") of
*  this instance are equivalent to those of the input object.
* @see #isSame()
*/
    public boolean isLike(Coda coda) {
        if(coda.descriptor != null)
          return (coda.getChannelObj().equalsIgnoreCase(this.getChannelObj()) &&  coda.descriptor.isSameType(this.descriptor) ) ;
        else
          return (coda.getChannelObj().equalsIgnoreCase(this.getChannelObj())) ;
    }

/** Returns (coda.sol == this.sol && this.isLike(coda))
* @See #isLike()
*/
    public boolean isSame(Coda coda) {
    //  why not implement sol.equals(this.sol) or coda.sol.equalsLocation(this.sol)? AWW
        return (coda.sol == this.sol && isLike(coda)) ;
    }

    /** Return true if the coda was used in the summary mag, etc. */
    public boolean wasUsed() {
      return (channelMag.weight.doubleValue() > 0.0);
    }


/** Set the coda duration type, usually S, sometimes P.
*   @See: CodaType
*/
    public void setDurationType(CodaType type) {
        if(descriptor != null)
          descriptor.setDurationType(type);
    }

/**
* Sets the coda phase String description. Typically the letter  S or P
* concatenated with positional letter codes indicating clipped, noisy, short or truncated coda.
* The actual defined coda description characteristics are implementation dependent.
* @See: CodaType
*/
    public void setPhaseDescription(String str) {
        if(descriptor != null)
          descriptor.setDescription(str);
    }

/**
* Sets the coda phase descriptor, implementation dependent on Coda type.
*/
    abstract public void changeDescriptor(CodaPhaseDescriptor pd) ;

/**
* Commits Coda instance data to underlying DataSource.
* The action taken will depend on this instance creation state and data processing state.
* The member data may or may not have been initialized from the data source.
* Thus, as a result of commit, data be inserted, deleted, modified, or unchanged in the DataSource.
*/
    abstract public boolean commit();

/**
* Derives from DataSource the collection of Coda objects associated with the input Solution.
*/
    abstract public Collection getBySolution (Solution sol);

/**
* Derives from DataSource the collection of Coda instances associated with the input Solution id number.
* @see DataSource
*/
    abstract public Collection getBySolution (long id);

/**
* Derives from DataSource the collection of Coda instances starting within the input time window range.
* @see DataSource
*/
   abstract public Collection getByTime (double timeStart, double timeEnd) ;

/**
* Derives from DataSource the collection of Coda instances associated with the input Magnitude instance.
* @see DataSource
*/
    abstract public Collection getByMagnitude(Magnitude mag);

/**
* Derives from DataSource a collection of Coda instances associated with the input magnitude id number.
* @see DataSource
*/
    abstract public Collection getByMagnitude(long magid);

/* Copy only the data dependent on the associated solution. THIS SOLUTION CRITICAL DATA NOT DEFINED
    public boolean copySolutionDependentData(Coda newCoda) {
        if (newCoda.isLike(newCoda)) {
            // NOTE: use assignment, do not use "setValue()" because it always sets isNull() = false.
            distance = newPhase.distance;
            azimuth  = newPhase.azimuth;
        } else {
            return false;
        }
    }
*/

} // end of Coda class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -