001: /*
002: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: * [See end of file]
004: */
005:
006: package com.hp.hpl.jena.rdf.arp.states.test;
007:
008: class EventRecord {
009: String startEvents[];
010: String rsltState;
011: String rsltCharacter[];
012:
013: public String toString() {
014: StringBuffer buf = new StringBuffer(toString(startEvents));
015: buf.append(" = " + rsltState + " ");
016: buf.append(toString(rsltCharacter));
017: return buf.toString();
018: }
019:
020: static private String toString(String[] s) {
021: StringBuffer buf = new StringBuffer();
022: for (int i = 0; i < s.length; i++)
023: buf.append(s[i] + " ");
024: return buf.toString();
025: }
026:
027: void checkStar(String st) {
028: if (rsltState.equals("*"))
029: rsltState = st;
030: }
031:
032: int triples = 0;
033: int objects = 0;
034: int preds = 0;
035: int scope = 0;
036: int reify = 0;
037: boolean inited = false;
038:
039: public void initCounts() {
040: if (!inited) {
041: inited = true;
042: for (int i = 0; i < rsltCharacter.length; i++) {
043: int n = 0;
044: try {
045: n = Integer.parseInt(rsltCharacter[i].substring(1));
046: } catch (RuntimeException e) {
047: System.err.println(toString());
048: throw e;
049: }
050: switch (rsltCharacter[i].charAt(0)) {
051: case 'T':
052: triples = n;
053: break;
054: case 'O':
055: objects = n;
056: break;
057: case 'P':
058: preds = n;
059: break;
060: case 'E':
061: scope = n;
062: break;
063: case 'R':
064: reify = n;
065: break;
066: }
067: }
068: }
069:
070: }
071:
072: public String toEventString() {
073:
074: return toString(startEvents);
075: }
076:
077: public String toResultString() {
078: return rsltState + " " + toString(rsltCharacter);
079: }
080: }
081:
082: /*
083: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
084: * All rights reserved.
085: *
086: * Redistribution and use in source and binary forms, with or without
087: * modification, are permitted provided that the following conditions
088: * are met:
089: * 1. Redistributions of source code must retain the above copyright
090: * notice, this list of conditions and the following disclaimer.
091: * 2. Redistributions in binary form must reproduce the above copyright
092: * notice, this list of conditions and the following disclaimer in the
093: * documentation and/or other materials provided with the distribution.
094: * 3. The name of the author may not be used to endorse or promote products
095: * derived from this software without specific prior written permission.
096: *
097: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
098: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
099: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
100: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
101: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
102: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
103: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
104: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
105: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
106: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107: */
|