亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? doublelinewriter.java

?? ptolemyModel嵌入式系統(tǒng)建模實(shí)例代碼
?? JAVA
字號(hào):
/* An actor that writes the value of string tokens to a file, one per line.

@Copyright (c) 2002-2003 The Regents of the University of California.
All rights reserved.

Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
software and its documentation for any purpose, provided that the
above copyright notice and the following two paragraphs appear in all
copies of this software.

IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS.

                                                PT_COPYRIGHT_VERSION 2
                                                COPYRIGHTENDKEY
@ProposedRating Yellow (eal@eecs.berkeley.edu)
@AcceptedRating Red (liuj@eecs.berkeley.edu)
*/

package ptolemy.actor.lib.io;

import ptolemy.actor.lib.Sink;
import ptolemy.data.BooleanToken;
import ptolemy.data.StringToken;
import ptolemy.data.DoubleToken;
import ptolemy.data.Token;
import ptolemy.data.expr.Parameter;
import ptolemy.data.type.BaseType;
import ptolemy.gui.MessageHandler;
import ptolemy.kernel.CompositeEntity;
import ptolemy.kernel.attributes.FileAttribute;
import ptolemy.kernel.util.*;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

//////////////////////////////////////////////////////////////////////////
//// DoubleLineWriter
/**
This actor reads string-valued input tokens and writes them,
one line at a time, to a specified file.  It does not
include any enclosing quotation marks in the output.
If you need the enclosing quotation marks, use ExpressionWriter.
<p>
The file is specified by the <i>fileName</i> attribute
using any form acceptable to FileAttribute.
<p>
If the <i>append</i> attribute has value <i>true</i>,
then the file will be appended to. If it has value <i>false</i>,
then if the file exists, the user will be queried for permission
to overwrite, and if granted, the file will be overwritten.
<p>
If the <i>confirmOverwrite</i> parameter has value <i>false</i>,
then this actor will overwrite the specified file if it exists
without asking.  If <i>true</i> (the default), then if the file
exists, then this actor will ask for confirmation before overwriting.

@see FileAttribute
@see ExpressionWriter
@author  Edward A. Lee
@version $Id: DoubleLineWriter.java,v 1.9 2003/05/05 18:46:12 cxh Exp $
@since Ptolemy II 2.2
*/
public class DoubleLineWriter extends Sink {

    /** Construct an actor with the given container and name.
     *  @param container The container.
     *  @param name The name of this actor.
     *  @exception IllegalActionException If the actor cannot be contained
     *   by the proposed container.
     *  @exception NameDuplicationException If the container already has an
     *   actor with this name.
     */
    public DoubleLineWriter(CompositeEntity container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        input.setTypeEquals(BaseType.STRING);
        input.setMultiport(false);

        fileName = new FileAttribute(this, "fileName");
        fileName.setExpression("System.out");

        append = new Parameter(this, "append");
        append.setTypeEquals(BaseType.BOOLEAN);
        append.setToken(BooleanToken.FALSE);

        confirmOverwrite = new Parameter(this, "confirmOverwrite");
        confirmOverwrite.setTypeEquals(BaseType.BOOLEAN);
        confirmOverwrite.setToken(BooleanToken.TRUE);

        _attachText("_iconDescription", "<svg>\n"
                + "<rect x=\"-25\" y=\"-20\" "
                + "width=\"50\" height=\"40\" "
                + "style=\"fill:white\"/>\n"
                + "<polygon points=\"-15,-10 -12,-10 -8,-14 -1,-14 3,-10"
                + " 15,-10 15,10, -15,10\" "
                + "style=\"fill:red\"/>\n"
                + "</svg>\n");
    }

    ///////////////////////////////////////////////////////////////////
    ////                     ports and parameters                  ////

    /** If <i>true</i>, then append to the specified file.  If <i>false</i>
     *  (the default), then overwrite any preexisting file after asking
     *  the user for permission.
     */
    public Parameter append;

    /** The file name to which to write.  This is a string with
     *  any form accepted by FileAttribute.  The default value is
     *  "System.out".
     *  @see FileAttribute
     */
    public FileAttribute fileName;

    /** If <i>false</i>, then overwrite the specified file if it exists
     *  without asking.  If <i>true</i> (the default), then if the file
     *  exists, ask for confirmation before overwriting.
     */
    public Parameter confirmOverwrite;

    ///////////////////////////////////////////////////////////////////
    ////                         public methods                    ////

    /** If the specified attribute is <i>fileName</i> and there is an
     *  open file being written, then close that file.  The new file will
     *  be opened or created when it is next written to.
     *  @param attribute The attribute that has changed.
     *  @exception IllegalActionException If the specified attribute
     *   is <i>fileName</i> and the previously
     *   opened file cannot be closed.
     */
    public void attributeChanged(Attribute attribute)
            throws IllegalActionException {
        if (attribute == fileName) {
            // Do not close the file if it is the same file.
            if (_previousFileName != null
                    && !fileName.getExpression().equals(_previousFileName)) {
                _previousFileName = fileName.getExpression();
                fileName.close();
                _writer = null;
            }
        } else {
            super.attributeChanged(attribute);
        }
    }

    /** Clone the actor into the specified workspace.
     *  @return A new actor.
     *  @exception CloneNotSupportedException If a derived class contains
     *   an attribute that cannot be cloned.
     */
    public Object clone(Workspace workspace)
            throws CloneNotSupportedException {
        DoubleLineWriter newObject = (DoubleLineWriter)super.clone(workspace);
        newObject._writer = null;
        return newObject;
    }

    /** Read an input string token and write it to the file.
     *  If there is no input, do nothing.
     *  If the file is not open for writing then open it. If the file
     *  does not exist, then create it.  If the file already exists,
     *  then query the user for overwrite, unless the <i>append</i>
     *  parameter has value <i>true</i>.
     *  @exception IllegalActionException If the file cannot be opened
     *   or created, or if the user refuses to overwrite an existing file.
     */
    public boolean postfire() throws IllegalActionException {
        if (input.hasToken(0)) {
            Token token = input.get(0);
            if (_writer == null) {
                // Open the file.
                File file = fileName.asFile();
                boolean appendValue
                    = ((BooleanToken)append.getToken()).booleanValue();
                boolean confirmOverwriteValue
                    = ((BooleanToken)confirmOverwrite.getToken())
                    .booleanValue();
                // Don't ask for confirmation in append mode, since there
                // will be no loss of data.
                if (file.exists() && !appendValue && confirmOverwriteValue) {
                    // Query for overwrite.
                    if (!MessageHandler.yesNoQuestion(
                            "OK to overwrite " + file + "?")) {
                        throw new IllegalActionException(this,
                                "Please select another file name.");
                    }
                }
                _writer = new PrintWriter(
                        fileName.openForWriting(appendValue), true);
            }
            _writeToken(token);
        }
        return super.postfire();
    }

    /** Close the writer if there is one.
     *  @exception IllegalActionException If an IO error occurs.
     */
    public void wrapup() throws IllegalActionException {
        fileName.close();
        _writer = null;
    }

    ///////////////////////////////////////////////////////////////////
    ////                         protected methods                 ////

    /** Write the specified token to the current writer.
     *  This is protected so that derived classes can modify the
     *  format in which the token is written.
     *  @param token The token to write.
     */
    protected void _writeToken(Token token) {
        // In this base class, the cast is safe.
        _writer.println(((DoubleToken)token).doubleValue());
    }

    ///////////////////////////////////////////////////////////////////
    ////                         protected members                 ////

    /** The current writer. */
    protected PrintWriter _writer;

    ///////////////////////////////////////////////////////////////////
    ////                         private members                   ////

    /** Previous value of fileName parameter. */
    private String _previousFileName;

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品国产a久久久久久| 日本乱码高清不卡字幕| 日韩片之四级片| 久久不见久久见免费视频1| 91精品国产91久久久久久最新毛片 | 亚洲国产激情av| 99久久国产综合色|国产精品| 国产精品二区一区二区aⅴ污介绍| 风间由美中文字幕在线看视频国产欧美 | 久久久久久电影| 91网站最新地址| 亚洲国产成人va在线观看天堂| 欧美久久一二区| 午夜国产精品影院在线观看| 欧美精品一区二区高清在线观看| 成人国产在线观看| 亚洲一区二区三区中文字幕| 欧美一区二区高清| 成人丝袜18视频在线观看| 亚洲男人天堂av网| 精品国内二区三区| 91美女视频网站| 99riav久久精品riav| 三级在线观看一区二区| 国产精品国产三级国产普通话99| 国产欧美一区视频| 亚洲精品国产无套在线观| 日韩精品一区在线| 欧美丝袜第三区| 成人免费毛片a| 国产在线国偷精品免费看| 一区二区三区欧美激情| 国产日韩精品久久久| 日韩久久久久久| 制服丝袜中文字幕一区| 成人精品视频网站| 成人性视频免费网站| 国产盗摄视频一区二区三区| 六月婷婷色综合| 天涯成人国产亚洲精品一区av| 日韩一区在线看| 中文字幕一区二区视频| 欧美经典一区二区| 国产精品视频一二三区| 国产日韩欧美综合一区| 久久久久久久综合日本| 久久精品视频在线免费观看| 久久蜜桃av一区二区天堂| 精品国产乱码久久久久久浪潮| 欧美一区二区三区白人| 91精品国产黑色紧身裤美女| 91精品蜜臀在线一区尤物| 日韩美女视频在线| 26uuu国产日韩综合| 国产丝袜欧美中文另类| 中文字幕乱码亚洲精品一区| 最新国产の精品合集bt伙计| 亚洲人午夜精品天堂一二香蕉| 亚洲美女屁股眼交| 日韩不卡手机在线v区| 激情综合色播五月| av福利精品导航| 欧美日本韩国一区| 久久久久久**毛片大全| 亚洲人成精品久久久久| 美国av一区二区| av一区二区三区黑人| 欧美高清视频www夜色资源网| 日韩精品一区二区三区中文不卡| 国产农村妇女精品| 亚洲动漫第一页| 成人一区在线看| 精品福利二区三区| 日韩在线播放一区二区| 国产剧情一区在线| 欧美日韩国产小视频| 中文字幕亚洲在| 极品美女销魂一区二区三区免费| 色老汉一区二区三区| 久久久99精品免费观看| 琪琪久久久久日韩精品| 91久久精品网| 亚洲精品成人少妇| 成人动漫一区二区在线| 欧美mv和日韩mv国产网站| 亚洲国产成人tv| 色就色 综合激情| 亚洲欧美一区二区三区孕妇| 国产91丝袜在线18| 久久亚洲免费视频| 精品系列免费在线观看| 日韩丝袜情趣美女图片| 奇米综合一区二区三区精品视频| 91精品国产综合久久香蕉麻豆| 天天操天天色综合| 一区二区三区国产| av在线这里只有精品| 国产精品久久久久精k8| 国产成人日日夜夜| 国产精品美女久久久久久久网站| 国产在线不卡一卡二卡三卡四卡| 久久亚洲二区三区| 粉嫩蜜臀av国产精品网站| 国产精品福利在线播放| 在线观看av不卡| 欧美成人乱码一区二区三区| 国产成人一区在线| 日本欧美一区二区在线观看| 欧美电视剧在线观看完整版| 日韩高清一区在线| 久久久久久久久久久黄色| 国产很黄免费观看久久| 国产精品久久久久影院色老大| 成人午夜激情片| 亚洲丰满少妇videoshd| 精品久久五月天| 日本乱码高清不卡字幕| 蜜桃久久av一区| 亚洲欧洲在线观看av| 精品久久人人做人人爰| 91成人免费在线| 成人av在线影院| 蜜臀av性久久久久蜜臀av麻豆| 国产视频一区二区在线观看| 欧美二区乱c少妇| av网站免费线看精品| 久久国产精品色婷婷| 日本不卡高清视频| 日韩成人伦理电影在线观看| 日韩国产精品91| 久久免费电影网| 欧美一级理论片| 欧美国产精品一区二区三区| 国产精品久久久久久妇女6080| 久久精品视频一区二区| 国产欧美日韩综合精品一区二区 | 亚洲欧美在线观看| 久久亚洲私人国产精品va媚药| 91精品国产一区二区三区蜜臀 | 在线电影国产精品| 欧美xxxx老人做受| 久久久久久一级片| 久久久久97国产精华液好用吗| 精品国产免费一区二区三区四区| 精品sm在线观看| 亚洲国产高清不卡| 亚洲乱码日产精品bd | www久久精品| 国产欧美日韩亚州综合| 国产精品麻豆久久久| 亚洲三级理论片| 亚洲午夜影视影院在线观看| 图片区日韩欧美亚洲| 国产成人av电影在线观看| av一区二区三区在线| 欧美电影免费观看高清完整版在| 中文字幕人成不卡一区| 久久精品国产一区二区三| 色综合欧美在线| 久久久精品免费网站| 欧美a一区二区| 国产乱码字幕精品高清av | 日韩一区二区免费在线观看| 精品黑人一区二区三区久久| 国产精品欧美经典| 日韩影视精彩在线| 成人av片在线观看| 7777精品伊人久久久大香线蕉完整版| 亚洲精品一区二区三区福利| 亚洲欧美日韩久久精品| 国产一区二区三区美女| 91精品国产品国语在线不卡| 国产精品久久久久久久久久免费看 | 欧美日韩电影一区| 国产精品久久久久久久久快鸭| 日本网站在线观看一区二区三区| 成人免费观看av| 欧美哺乳videos| 午夜精品久久久久久久久| 成+人+亚洲+综合天堂| 精品第一国产综合精品aⅴ| 亚洲第一福利一区| 91丨九色丨尤物| 国产精品美女一区二区三区| 激情欧美一区二区三区在线观看| 欧美日韩高清影院| 一区二区三区在线观看网站| 国产凹凸在线观看一区二区| 精品国产免费一区二区三区四区 | 欧美不卡在线视频| 久久电影网站中文字幕| 这里只有精品电影| 亚洲va国产天堂va久久en| 91丝袜高跟美女视频| 亚洲欧美另类图片小说| 成a人片国产精品| 一二三四区精品视频| 欧美日韩一级二级三级| 日韩国产在线观看一区| 欧美一区午夜精品|