001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Florent Guillaume
011 */
012package org.nuxeo.ecm.core.api.model;
013
014/**
015 * Value holding a base value and a delta.
016 * <p>
017 * This is used when the actual intent of the value is to be an incremental update to an existing value.
018 *
019 * @since 6.0
020 */
021public abstract class Delta extends Number {
022
023    private static final long serialVersionUID = 1L;
024
025    /**
026     * Gets the full value (base + delta) as an object.
027     *
028     * @return the full value
029     */
030    public abstract Number getFullValue();
031
032    /**
033     * Gets the delta value as an object.
034     *
035     * @return the delta value
036     */
037    public abstract Number getDeltaValue();
038
039    /**
040     * Adds this delta to another delta.
041     *
042     * @param other the other delta
043     * @return the added delta
044     */
045    public abstract Delta add(Delta other);
046
047    /**
048     * Adds this delta to a number.
049     *
050     * @param other the number
051     * @return the resulting number
052     */
053    public abstract Number add(Number other);
054
055    // make these two abstract to force implementation
056
057    @Override
058    public abstract boolean equals(Object obj);
059
060    @Override
061    public abstract int hashCode();
062
063}