Examples of DataRow


Examples of com.rapidminer.example.table.DataRow

        DataRowFactory dataRowFactory = new DataRowFactory(DataRowFactory.TYPE_DOUBLE_ARRAY, '.');
        MemoryExampleTable memoryExampleTable = new MemoryExampleTable(attribute);

        for (Map.Entry<double[], String> entry : itemClassMap.entrySet()) {
            Double[] values = convertdoubleToDoubleArray(entry.getKey(), entry.getValue());
            DataRow rmRow = dataRowFactory.create(values, attribute);
            memoryExampleTable.addDataRow(rmRow);
        }

        ExampleSet newExampleSet = memoryExampleTable.createExampleSet();
View Full Code Here

Examples of dbfit.util.DataRow

            }
        }

        @Override
        public void process(final DataRow row1) {
            DataRow row2 = mdt2.findMatchingNothrow(mmb.buildMatchingMask(row1));
            getChildDiff().diff(row1, row2);
            mdt2.markProcessed(row2);
        }
View Full Code Here

Examples of de.intranda.commons.chart.results.DataRow

    DataTable dtbl = new DataTable(StatisticsMode.getByClassName(
        this.getClass()).getTitle() + " "
        + Helper.getTranslation("_inGB"));

    DataRow dataRow;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out
    for (Object obj : list) {
      dataRow = new DataRow(null);
      //TODO: Don't use arrays
      Object[] objArr = (Object[]) obj;
      try {

        // getting localized time group unit

        //setting row name with date/time extraction based on the group

        dataRow.setName(new Converter(objArr[1]).getString() + "");

        dataRow.addValue(Helper.getTranslation("storageDifference"),
            (new Converter(objArr[0]).getGB()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }

      //finally adding dataRow to DataTable and fetching next row
      dtbl.addDataRow(dataRow);
    }
View Full Code Here

Examples of org.apache.cayenne.DataRow

            ObjectId oid = object.getObjectId();

            // add snapshots if refresh is forced, or if a snapshot is
            // missing

            DataRow cachedSnapshot = (DataRow) this.snapshots.get(oid);
            if (refresh || cachedSnapshot == null) {

                DataRow newSnapshot = (DataRow) snapshots.get(i);

                if (cachedSnapshot != null) {
                    // use old snapshot if no changes occurred
                    if (object instanceof DataObject
                            && cachedSnapshot.equals(newSnapshot)) {
                        ((DataObject) object).setSnapshotVersion(cachedSnapshot
                                .getVersion());
                        continue;
                    }
                    else {
                        newSnapshot.setReplacesVersion(cachedSnapshot.getVersion());
                    }
                }

                if (modified == null) {
                    modified = new HashMap();
View Full Code Here

Examples of org.apache.cayenne.DataRow

     *             deprecated as well.
     */
    private DataRow getSnapshot(ObjectId oid, DataChannel channel) {

        // try cache
        DataRow cachedSnapshot = getCachedSnapshot(oid);
        if (cachedSnapshot != null) {
            return cachedSnapshot;
        }

        if (logObj.isDebugEnabled()) {
            logObj.debug("no cached snapshot for ObjectId: " + oid);
        }

        // try getting it from database

        Query query = new ObjectIdQuery(oid, true, ObjectIdQuery.CACHE_REFRESH);
        List results = channel.onQuery(null, query).firstList();

        if (results.size() > 1) {
            throw new CayenneRuntimeException("More than 1 object found for ObjectId "
                    + oid
                    + ". Fetch matched "
                    + results.size()
                    + " objects.");
        }
        else if (results.size() == 0) {
            return null;
        }
        else {
            DataRow snapshot = (DataRow) results.get(0);
            snapshots.put(oid, snapshot);
            return snapshot;
        }
    }
View Full Code Here

Examples of org.apache.cayenne.DataRow

            Iterator it = updatedSnapshots.entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry entry = (Map.Entry) it.next();

                ObjectId key = (ObjectId) entry.getKey();
                DataRow newSnapshot = (DataRow) entry.getValue();
                DataRow oldSnapshot = (DataRow) snapshots.put(key, newSnapshot);

                // generate diff for the updated event, if this not a new
                // snapshot

                // The following cases should be handled here:

                // 1. There is no previously cached snapshot for a given id.
                // 2. There was a previously cached snapshot for a given id,
                // but it expired from cache and was removed. Currently
                // handled as (1); what are the consequences of that?
                // 3. There is a previously cached snapshot and it has the
                // *same version* as the "replacesVersion" property of the
                // new snapshot.
                // 4. There is a previously cached snapshot and it has a
                // *different version* from "replacesVersion" property of
                // the new snapshot. It means that we don't know how to merge
                // the two (we don't even know which one is newer due to
                // multithreading). Just throw out this snapshot....

                if (oldSnapshot != null) {
                    // case 4 above... have to throw out the snapshot since
                    // no good options exist to tell how to merge the two.
                    if (oldSnapshot.getVersion() != newSnapshot.getReplacesVersion()) {
                        logObj
                                .debug("snapshot version changed, don't know what to do... Old: "
                                        + oldSnapshot
                                        + ", New: "
                                        + newSnapshot);
                        forgetSnapshot(key);
                        continue;
                    }

                    Map diff = oldSnapshot.createDiff(newSnapshot);

                    if (diff != null) {
                        if (diffs == null) {
                            diffs = new HashMap();
                        }
View Full Code Here

Examples of org.apache.cayenne.DataRow

        if (!diffs.isEmpty()) {
            Iterator it = diffs.entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry entry = (Map.Entry) it.next();
                ObjectId key = (ObjectId) entry.getKey();
                DataRow oldSnapshot = (DataRow) snapshots.remove(key);

                if (oldSnapshot == null) {
                    continue;
                }

                DataRow newSnapshot = oldSnapshot.applyDiff((DataRow) entry.getValue());
                snapshots.put(key, newSnapshot);
            }
        }
    }
View Full Code Here

Examples of org.apache.cayenne.DataRow

    private boolean interceptOIDQuery() {
        if (query instanceof ObjectIdQuery) {

            ObjectIdQuery oidQuery = (ObjectIdQuery) query;

            DataRow row = null;

            if (!oidQuery.isFetchMandatory()) {
                row = cache.getCachedSnapshot(oidQuery.getObjectId());
            }
View Full Code Here

Examples of org.apache.cayenne.DataRow

            // relationship is to-one
            if (relationship.isSourceIndependentFromTargetChange()) {
                return !DONE;
            }

            DataRow sourceRow = cache.getCachedSnapshot(relationshipQuery.getObjectId());

            if (sourceRow == null) {
                return !DONE;
            }

            // we can assume that there is one and only one DbRelationship as
            // we previously checked that
            // "!isSourceIndependentFromTargetChange"
            DbRelationship dbRelationship = (DbRelationship) relationship
                    .getDbRelationships()
                    .get(0);

            ObjectId targetId = sourceRow.createTargetObjectId(relationship
                    .getTargetEntityName(), dbRelationship);

            // null id means that FK is null...
            if (targetId == null) {
                this.response = new GenericResponse(Collections.EMPTY_LIST);
                return DONE;
            }

            DataRow targetRow = cache.getCachedSnapshot(targetId);

            DataRow resultRow;

            if (targetRow != null) {
                resultRow = targetRow;
            }
            // if no inheritance involved, we can return a valid partial row made from
            // the target Id alone...
            else if (domain.getEntityResolver().lookupInheritanceTree(
                    (ObjEntity) relationship.getTargetEntity()) == null) {

                resultRow = new DataRow(targetId.getIdSnapshot());
            }
            else {
                // can't guess the right target...
                return !DONE;
            }
View Full Code Here

Examples of org.apache.cayenne.DataRow

                && object.getDataContext() != null) {

            return getObjectStore().getSnapshot(object.getObjectId());
        }

        DataRow snapshot = new DataRow(10);

        Iterator attributes = entity.getAttributeMap().entrySet().iterator();
        while (attributes.hasNext()) {
            Map.Entry entry = (Map.Entry) attributes.next();
            String attrName = (String) entry.getKey();
            ObjAttribute objAttr = (ObjAttribute) entry.getValue();

            // processing compound attributes correctly
            snapshot.put(objAttr.getDbAttributePath(), object
                    .readPropertyDirectly(attrName));
        }

        Iterator relationships = entity.getRelationshipMap().entrySet().iterator();
        while (relationships.hasNext()) {
            Map.Entry entry = (Map.Entry) relationships.next();
            ObjRelationship rel = (ObjRelationship) entry.getValue();

            // if target doesn't propagates its key value, skip it
            if (rel.isSourceIndependentFromTargetChange()) {
                continue;
            }

            Object targetObject = object.readPropertyDirectly(rel.getName());
            if (targetObject == null) {
                continue;
            }

            // if target is Fault, get id attributes from stored snapshot
            // to avoid unneeded fault triggering
            if (targetObject instanceof Fault) {
                DataRow storedSnapshot = getObjectStore().getSnapshot(
                        object.getObjectId());
                if (storedSnapshot == null) {
                    throw new CayenneRuntimeException(
                            "No matching objects found for ObjectId "
                                    + object.getObjectId()
                                    + ". Object may have been deleted externally.");
                }

                DbRelationship dbRel = (DbRelationship) rel.getDbRelationships().get(0);
                Iterator joins = dbRel.getJoins().iterator();
                while (joins.hasNext()) {
                    DbJoin join = (DbJoin) joins.next();
                    String key = join.getSourceName();
                    snapshot.put(key, storedSnapshot.get(key));
                }

                continue;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.