01: /*
02: * $Id: MatchPostconditionCommand.java 674 2006-10-06 12:15:59Z hengels $
03: * (c) Copyright 2004 con:cern development team.
04: *
05: * This file is part of con:cern (http://concern.sf.net).
06: *
07: * con:cern is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2.1
10: * of the License, or (at your option) any later version.
11: *
12: * Please see COPYING for the complete licence.
13: */
14: package org.concern.client.commandline;
15:
16: /**
17: * @author hengels
18: */
19: public class MatchPostconditionCommand extends Command {
20: private String activity;
21: private String[] subjects;
22:
23: public MatchPostconditionCommand() {
24: usage = "ACTIVITY SUBJECT...\n Check if the subjects match the precondition of the activity.";
25: }
26:
27: public String[] getSubjects() {
28: return subjects;
29: }
30:
31: public void setSubjects(String[] subjects) {
32: this .subjects = subjects;
33: }
34:
35: public void setArguments(String[] args) {
36: activity = args[0];
37:
38: subjects = new String[args.length - 1];
39: for (int i = 1; i < args.length; i++) {
40: String subject = args[i];
41: subjects[i - 1] = subject;
42: }
43: }
44:
45: public void run() {
46: for (int i = 0; i < subjects.length; i++) {
47: String subject = subjects[i];
48:
49: try {
50: boolean match = controller.matchPostcondition(subject,
51: activity);
52: System.out.println("match postcondition " + subject
53: + " " + activity + ": " + match);
54: } catch (Exception e) {
55: System.out.println("match postcondition " + subject
56: + " " + activity + ": ERROR");
57: e.printStackTrace();
58: }
59: }
60: }
61: }
|