当前位置: 首页>>代码示例>>Java>>正文


Java PropertyState.equals方法代码示例

本文整理汇总了Java中org.apache.jackrabbit.oak.api.PropertyState.equals方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyState.equals方法的具体用法?Java PropertyState.equals怎么用?Java PropertyState.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jackrabbit.oak.api.PropertyState的用法示例。


在下文中一共展示了PropertyState.equals方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isModified

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
 * Determine whether this node state is modified wrt. the passed
 * {@code before} state.
 * <p>
 * A node state is modified if it either has not the same properties
 * or has not the same child nodes as a {@code before} state. A node
 * state has the same properties as a {@code before} state iff its
 * set of properties is equal to the set of properties of
 * {@code before}. A node state has the same child nodes as a
 * {@code before} state iff its set of child node names is equal to
 * the set of child node names of {@code before}.
 */
boolean isModified(NodeState before) {
    if (!exists()) {
        return false;
    } else if (nodes.isEmpty() && properties.isEmpty()) {
        return EqualsDiff.modified(before, base);
    }

    // was a child node added or removed?
    for (Entry<String, MutableNodeState> n : nodes.entrySet()) {
        if (n.getValue().exists() != before.hasChildNode(n.getKey())) {
            return true;
        }
    }

    // was a property added, removed or modified
    for (Entry<String, PropertyState> p : properties.entrySet()) {
        PropertyState pState = p.getValue();
        if (pState == null
                || !pState.equals(before.getProperty(p.getKey()))) {
            return true;
        }
    }

    return false;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:38,代码来源:MutableNodeState.java

示例2: propertyAdded

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public boolean propertyAdded(PropertyState after) {
    PropertyState other = builder.getProperty(after.getName());
    if (other == null) {
        builder.setProperty(after);
    } else if (!other.equals(after)) {
        addExistingProperty(builder, other, after);
    }
    return true;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:11,代码来源:AbstractRebaseDiff.java

示例3: propertyChanged

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public boolean propertyChanged(PropertyState before, PropertyState after) {
    PropertyState other = builder.getProperty(before.getName());
    if (other == null) {
        changeDeletedProperty(builder, after);
    } else if (other.equals(before)) {
        builder.setProperty(after);
    } else if (!other.equals(after)) {
        changeChangedProperty(builder, before, after);
    }
    return true;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:13,代码来源:AbstractRebaseDiff.java

示例4: propertyDeleted

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public boolean propertyDeleted(PropertyState before) {
    PropertyState other = builder.getProperty(before.getName());
    if (other == null) {
        deleteDeletedProperty(builder, before);
    } else if (other.equals(before)) {
        builder.removeProperty(before.getName());
    } else {
        deleteChangedProperty(builder, before);
    }
    return true;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:13,代码来源:AbstractRebaseDiff.java

示例5: compareProperties

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
private static boolean compareProperties(
        PropertyState before, PropertyState after, NodeStateDiff diff) {
    if (before == null) {
        return after == null || diff.propertyAdded(after);
    } else if (after == null) {
        return diff.propertyDeleted(before);
    } else {
        return before.equals(after) || diff.propertyChanged(before, after);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:11,代码来源:SegmentNodeState.java

示例6: propertyChanged

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public boolean propertyChanged(PropertyState before, PropertyState after) {
    PropertyState other = builder.getProperty(before.getName());
    if (other != null && other.equals(before)) {
        builder.setProperty(after);
    }
    return true;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:9,代码来源:MergeDiff.java

示例7: propertyDeleted

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public boolean propertyDeleted(PropertyState before) {
    PropertyState other = builder.getProperty(before.getName());
    if (other != null && other.equals(before)) {
        builder.removeProperty(before.getName());
    }
    return true;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:9,代码来源:MergeDiff.java

示例8: equals

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static boolean equals(NodeState a, NodeState b) {
    if (a.exists() != b.exists()
            || a.getPropertyCount() != b.getPropertyCount()) {
        return false; // shortcut
    }

    // if one of the objects has few entries,
    // then compare the number of entries with the other one
    long max = 20;
    long c1 = a.getChildNodeCount(max);
    long c2 = b.getChildNodeCount(max);
    if (c1 <= max || c2 <= max) {
        // one has less than max entries
        if (c1 != c2) {
            return false;
        }
    } else if (c1 != Long.MAX_VALUE && c2 != Long.MAX_VALUE) {
        // we know the exact number for both
        if (c1 != c2) {
            return false;
        }
    }

    for (PropertyState property : a.getProperties()) {
        if (!property.equals(b.getProperty(property.getName()))) {
            return false;
        }
    }

    // TODO inefficient unless there are very few child nodes

    // compare the exact child node count
    // (before, we only compared up to 20 entries)
    c1 = a.getChildNodeCount(Long.MAX_VALUE);
    c2 = b.getChildNodeCount(Long.MAX_VALUE);
    if (c1 != c2) {
        return false;
    }

    // compare all child nodes recursively (this is potentially very slow,
    // as it recursively calls equals)
    for (ChildNodeEntry entry : a.getChildNodeEntries()) {
        if (!entry.getNodeState().equals(b.getChildNode(entry.getName()))) {
            return false;
        }
    }

    return true;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:50,代码来源:AbstractNodeState.java

示例9: compare

import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public boolean compare(RecordId thisId, RecordId thatId) {
    checkNotNull(thisId);
    checkNotNull(thatId);

    // Compare properties
    for (int i = 0; i < properties.length; i++) {
        PropertyState thisProperty = getProperty(thisId, i);
        PropertyState thatProperty = getProperty(thatId, i);
        if (!thisProperty.equals(thatProperty)) {
            return false;
        }
    }

    // Compare child nodes
    if (childName == ZERO_CHILD_NODES) {
        return true;
    } else if (childName != MANY_CHILD_NODES) {
        NodeState thisChild = getChildNode(childName, thisId);
        NodeState thatChild = getChildNode(childName, thatId);
        return thisChild.equals(thatChild);
    } else {
        // TODO: Leverage the HAMT data structure for the comparison
        MapRecord thisMap = getChildNodeMap(thisId);
        MapRecord thatMap = getChildNodeMap(thatId);
        if (fastEquals(thisMap, thatMap)) {
            return true; // shortcut
        } else if (thisMap.size() != thatMap.size()) {
            return false; // shortcut
        } else {
            // TODO: can this be optimized?
            for (MapEntry entry : thisMap.getEntries()) {
                String name = entry.getName();
                MapEntry thatEntry = thatMap.getEntry(name);
                if (thatEntry == null) {
                    return false;
                } else if (!entry.getNodeState().equals(thatEntry.getNodeState())) {
                    return false;
                }
            }
            return true;
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:44,代码来源:Template.java


注:本文中的org.apache.jackrabbit.oak.api.PropertyState.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。