@@ -0,0 +1,2950 @@
+/*%0A * Copyright (C) 2011 0xlab - http://0xlab.org/%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A * Authored by Wei-Ning Huang %3Cazhuang@0xlab.org%3E%0A */%0A%0Apackage org.zeroxlab.aster;%0A%0Aimport java.awt.image.BufferedImage;%0A%0Aimport java.lang.IllegalArgumentException;%0Aimport java.lang.NumberFormatException;%0A%0Aimport java.io.IOException;%0A%0Aimport java.io.File;%0Aimport javax.imageio.ImageIO;%0A%0Aimport javax.script.SimpleBindings;%0A%0Apublic class Assert extends AsterCommand %7B%0A    double mTimeout = 3;%0A%0A    public Assert() %7B%0A        mOps = new AsterOperation%5B1%5D;%0A        mOps%5B0%5D = AsterWorkspace.getOpTouch();%0A    %7D%0A%0A    public Assert(SimpleBindings settings) %7B%0A        fillSettings(settings);%0A        mOps = new AsterOperation%5B1%5D;%0A        mOps%5B0%5D = AsterWorkspace.getOpTouch();%0A    %7D%0A%0A    public Assert(String prefix, String argline)%0A        throws IllegalArgumentException %7B%0A        String%5B%5D args = splitArgs(argline);%0A        if (args.length == 2) %7B%0A            try %7B%0A                args%5B0%5D = stripQuote(args%5B0%5D);%0A                mImage = ImageIO.read(new File(prefix, args%5B0%5D));%0A                mSerial = Integer.parseInt(args%5B0%5D.substring(0,%0A                                           args%5B0%5D.length() -4));%0A                mSeqNext = mSerial + 1;%0A                mTimeout = Double.parseDouble(args%5B1%5D);%0A            %7D catch (IOException e) %7B%0A                throw new IllegalArgumentException(e.toString());%0A            %7D%0A        %7D else %7B%0A            throw new IllegalArgumentException();%0A        %7D%0A        mOps = new AsterOperation%5B1%5D;%0A        mOps%5B0%5D = AsterWorkspace.getOpTouch();%0A    %7D%0A%0A    @Override%0A    public String getName() %7B%0A        return %22Assert%22;%0A    %7D%0A%0A    @Override%0A    public SimpleBindings getSettings() %7B%0A        SimpleBindings settings = new SimpleBindings();%0A        settings.put(%22Name%22, %22Assert%22);%0A        if (mImage != null) %7B%0A            settings.put(%22Image%22, mImage);%0A        %7D%0A        settings.put(%22Timeout%22, mTimeout);%0A        return settings;%0A    %7D%0A%0A    @Override%0A    public void fillSettings(SimpleBindings settings) %7B%0A        if (settings.containsKey(%22Image%22)) %7B%0A            mImage = (BufferedImage)settings.get(%22Image%22);%0A        %7D%0A        if (settings.containsKey(%22Timeout%22)) %7B%0A            mTimeout = (Double)settings.get(%22Timeout%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected String toScript() %7B%0A        return String.format(%22iassert('%25s.png', %25d)%5Cn%22,%0A                             mSerial, mTimeout);%0A    %7D%0A%7D%0A

Add Assert.java.