Package net.sourceforge.processdash.data

Examples of net.sourceforge.processdash.data.SimpleData


          /** Respond to a change in the value of the freeze flag.
           */
          public synchronized void dataIsConsistent() {
              //System.out.println(freezeFlagName + " = "+ observedFlagValue);
              SimpleData flagValue = getSimpleValue(freezeFlagName);
              boolean flagState = (flagValue != null && flagValue.test());
              int newState = (flagState ? FDS_FROZEN : FDS_THAWED);

              if (initializing) {
                  initializing = false;
                  currentState = newState;
View Full Code Here


            logger.warning("Encountered recursively defined data "
                    + "when calculating " + name + " - ABORTING");
            return; // break out of infinite loops.
        }
       
        SimpleData oldValue = value;
        SimpleData newValue = null;
        String newAlias = null;
        SubscribingExpressionContext context = null;

        // attempt to perform the calculation up to 10 times.  (This should
        // be more than generous - even one retry should be rare.)
        int retryCount = 10
        while (retryCount-- > 0 && extChanges.isDirty()) {
            context = new SubscribingExpressionContext(data, prefix, this,
                    name, currentSubscriptions);
            ListStack stack = new ListStack();
            int changeCount = -1;

            try {
                calcNameSet.add(name);
                changeCount = extChanges.getUnhandledChangeCount();
                script.run(stack, context);
                newAlias = (String) stack.peekDescriptor();
                newValue = (SimpleData) stack.pop();
                if (newValue != null && newAlias == null)
                    newValue = (SimpleData) newValue.getEditable(false);
            } catch (ExecutionException e) {
                logger.warning("Error executing " + name + ": " + e);
                newValue = null;
            } finally {
                calcNameSet.remove(name);
View Full Code Here

                targetVal = FormatUtil.parseNumber(target);
            } catch (Exception e) {
                SaveableData val = getDataRepository().getInheritableValue(
                        getPrefix(), target);
                if (val != null) {
                    SimpleData sVal = val.getSimpleValue();
                    if (sVal instanceof NumberData)
                        targetVal = ((NumberData) sVal).getDouble();
                }
            }
            if (targetVal == 0)
                continue;
           
            boolean reverse = parameters.containsKey("r" + n);

            SimpleData d = data.getData(1, n);
            if (d instanceof NumberData) {
                NumberData num = (NumberData) d;
                double val = num.getDouble();
                if (Double.isInfinite(val) || Double.isNaN(val))
                    val = 1.0;
View Full Code Here

                throws XmlPullParserException, IOException {
            try {
                String elemName = parser.getAttributeValue(null, NAME_ATTR);
                String dataName = concat(prefix, elemName);
                String valueText = parser.nextText();
                SimpleData value = parse(valueText);
                if (shouldImport(dataName, value))
                    defns.put(dataName, value);
            } catch (MalformedValueException e) {
                e.printStackTrace();
            }
View Full Code Here

    }

    private static class NumberDataHandler extends AbstractDataHandler {
        SimpleData parse(String value) throws MalformedValueException {
            SimpleData result = (SimpleData) NUMBER_MAP.get(value);
            if (result == null) {
                try {
                    Number d = NUMBER_FORMAT.parse(value);
                    if (d != null)
                        result = new DoubleData(d.doubleValue(), false);
View Full Code Here

            xml.startTag(null, RESULT_ITEM_TAG);
            xml.attribute(null, PATH_ATTR, resultSet.getRowName(row));

            for (int col = 1; col <= resultSet.numCols(); col++) {
                String name = resultSet.getColName(col);
                SimpleData d = resultSet.getData(row, col);
                String value = (d == null ? null : d.format());

                if (inlineAttributes) {
                    if (value != null)
                        xml.attribute(null, name, value);
                } else {
View Full Code Here

        this.data = data;
        this.prefix = prefix;
    }

    public Double getNumber(String dataName) {
        SimpleData sd = getSimpleValue(dataName);
        if (sd == null) {
            return null;
        } else if (sd instanceof NumberData) {
            return ((NumberData) sd).getDouble();
        } else {
View Full Code Here

            return Double.NaN;
        }
    }

    public String getString(String dataName) {
        SimpleData sd = getSimpleValue(dataName);
        return (sd == null ? null : sd.format());
    }
View Full Code Here

        SimpleData sd = getSimpleValue(dataName);
        return (sd == null ? null : sd.format());
    }

    public List<String> getList(String dataName) {
        SimpleData sd = getSimpleValue(dataName);
        ListData ld = ListData.asListData(sd);
        if (ld == null)
            return null;

        List result = new ArrayList(ld.asList());
View Full Code Here

        }
        return result;
    }

    public Date getDate(String dataName) {
        SimpleData sd = getSimpleValue(dataName);
        if (sd instanceof DateData) {
            return ((DateData) sd).getValue();
        } else {
            return null;
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.data.SimpleData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.