You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/02/12 14:02:00 UTC
[34/77] [partial] incubator-tinkerpop git commit: moved com/tinkerpop
directories to org/apache/tinkerpop
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/MutableMetrics.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
deleted file mode 100644
index 0687c3c..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.metric;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Bob Briody (http://bobbriody.com)
- */
-public class MutableMetrics extends ImmutableMetrics implements Cloneable {
-
- // Note: if you add new members then you probably need to add them to the copy constructor;
-
- private long tempTime = -1l;
-
- private MutableMetrics() {
- // necessary for kryo serialization
- }
-
- public MutableMetrics(final String id, final String name) {
- this.id = id;
- this.name = name;
- }
-
-
- public void addNested(MutableMetrics metrics) {
- this.nested.put(metrics.getId(), metrics);
- }
-
- public void start() {
- if (-1 != this.tempTime) {
- throw new IllegalStateException("Internal Error: Concurrent Metrics start. Stop timer before starting timer.");
- }
- this.tempTime = System.nanoTime();
- }
-
- public void stop() {
- if (-1 == this.tempTime)
- throw new IllegalStateException("Internal Error: Metrics has not been started. Start timer before stopping timer");
- this.durationNs = this.durationNs + (System.nanoTime() - this.tempTime);
- this.tempTime = -1;
- }
-
- public void finish(final long count) {
- stop();
- this.count += count;
- }
-
- public void incrementCount(final long count) {
- this.count += count;
- }
-
- public void aggregate(MutableMetrics other) {
- this.durationNs += other.durationNs;
- this.count += other.count;
-
- // Merge annotations. If multiple values for a given key are found then append it to a comma-separated list.
- for (Map.Entry<String, String> p : other.annotations.entrySet()) {
- if (this.annotations.containsKey(p.getKey())) {
- final String existing = this.annotations.get(p.getKey());
- final List<String> existingValues = Arrays.asList(existing.split(","));
- if (!existingValues.contains(p.getValue())) {
- // New value. Append to comma-separated list.
- this.annotations.put(p.getKey(), existing + ',' + p.getValue());
- }
- } else {
- this.annotations.put(p.getKey(), p.getValue());
- }
- }
- this.annotations.putAll(other.annotations);
-
- // Merge nested Metrics
- other.nested.values().forEach(nested -> {
- MutableMetrics thisNested = (MutableMetrics) this.nested.get(nested.getId());
- if (thisNested == null) {
- thisNested = new MutableMetrics(nested.getId(), nested.getName());
- this.nested.put(thisNested.getId(), thisNested);
- }
- thisNested.aggregate((MutableMetrics) nested);
- });
- }
-
- /**
- * Set an annotation value. Duplicates will be overwritten.
- *
- * @param key
- * @param value
- */
- public void setAnnotation(String key, String value) {
- annotations.put(key, value);
- }
-
- public void setPercentDuration(final double percentDuration) {
- this.percentDuration = percentDuration;
- }
-
- public void setDuration(final long duration) {
- this.durationNs = duration;
- }
-
- @Override
- public MutableMetrics getNested(String metricsId) {
- return (MutableMetrics) nested.get(metricsId);
- }
-
- public ImmutableMetrics getImmutableClone() {
- final ImmutableMetrics clone = new ImmutableMetrics();
- copyMembers(clone);
- this.nested.values().forEach(nested -> clone.nested.put(nested.id, ((MutableMetrics) nested).getImmutableClone()));
- return clone;
- }
-
- private void copyMembers(final ImmutableMetrics clone) {
- clone.id = this.id;
- clone.name = this.name;
- clone.count = this.count;
- clone.durationNs = this.durationNs;
- clone.percentDuration = this.percentDuration;
- }
-
- @Override
- public MutableMetrics clone() {
- final MutableMetrics clone = new MutableMetrics();
- copyMembers(clone);
- this.nested.values().forEach(nested -> clone.nested.put(nested.id, ((MutableMetrics) nested).clone()));
- return clone;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/StandardTraversalMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/StandardTraversalMetrics.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/StandardTraversalMetrics.java
deleted file mode 100644
index 96ec65b..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/StandardTraversalMetrics.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.metric;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.io.Serializable;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author Bob Briody (http://bobbriody.com)
- */
-public final class StandardTraversalMetrics implements TraversalMetrics, Serializable {
- // toString() specific headers
- private static final String[] HEADERS = {"Step", "Count", "Traversers", "Time (ms)", "% Dur"};
-
- private static final String ITEM_COUNT_DISPLAY = "item count";
-
- private boolean dirty = true;
- private final Map<String, MutableMetrics> metrics = new HashMap<>();
- private final Map<Integer, String> indexToLabelMap = new TreeMap<>();
-
- /*
- The following are computed values upon the completion of profiling in order to report the results back to the user
- */
- private long totalStepDuration;
- private Map<String, ImmutableMetrics> computedMetrics;
- private boolean isComputer = false;
-
- public StandardTraversalMetrics() {
- }
-
- public void start(final String metricsId) {
- dirty = true;
- metrics.get(metricsId).start();
- }
-
- public void stop(final String metricsId) {
- dirty = true;
- metrics.get(metricsId).stop();
- }
-
- public void finish(final String metricsId, final long bulk) {
- dirty = true;
- final MutableMetrics m = metrics.get(metricsId);
- m.finish(1);
- m.getNested(ELEMENT_COUNT_ID).incrementCount(bulk);
- }
-
-
- @Override
- public long getDuration(final TimeUnit unit) {
- computeTotals();
- return unit.convert(totalStepDuration, MutableMetrics.SOURCE_UNIT);
- }
-
- @Override
- public Metrics getMetrics(final int index) {
- computeTotals();
- // adjust index to account for the injected profile steps
- return (Metrics) computedMetrics.get(indexToLabelMap.get(index * 2 + 1));
- }
-
- @Override
- public Metrics getMetrics(final String stepLabel) {
- computeTotals();
- return computedMetrics.get(stepLabel);
- }
-
- @Override
- public Collection<ImmutableMetrics> getMetrics() {
- computeTotals();
- return computedMetrics.values();
- }
-
- @Override
- public String toString() {
- computeTotals();
-
- // Build a pretty table of metrics data.
-
- // Append headers
- final StringBuilder sb = new StringBuilder("Traversal Metrics\n")
- .append(String.format("%28s %21s %11s %15s %8s", HEADERS));
-
- // Append each StepMetric's row. indexToLabelMap values are ordered by index.
- for (String label : indexToLabelMap.values()) {
- final ImmutableMetrics s = computedMetrics.get(label);
- final String rowName = StringUtils.abbreviate(s.getName(), 28);
- final long itemCount = s.getNested(ELEMENT_COUNT_ID).getCount();
-
- sb.append(String.format("%n%28s %21d %11d %15.3f %8.2f",
- rowName, itemCount, s.getCount(), s.getDuration(TimeUnit.MICROSECONDS) / 1000.0, s.getPercentDuration()));
- }
-
- // Append total duration
- sb.append(String.format("%n%28s %21s %11s %15.3f %8s",
- "TOTAL", "-", "-", getDuration(TimeUnit.MICROSECONDS) / 1000.0, "-"));
-
- return sb.toString();
- }
-
- private void computeTotals() {
- if (!dirty) {
- // already good to go
- return;
- }
-
- // Create temp list of ordered metrics
- List<MutableMetrics> tempMetrics = new ArrayList<>(metrics.size());
- for (String label : indexToLabelMap.values()) {
- // The indexToLabelMap is sorted by index (key)
- tempMetrics.add(metrics.get(label).clone());
- }
-
- if (!isComputer) {
- // Subtract upstream traversal time from each step
- for (int ii = tempMetrics.size() - 1; ii > 0; ii--) {
- MutableMetrics cur = tempMetrics.get(ii);
- MutableMetrics upStream = tempMetrics.get(ii - 1);
- cur.setDuration(cur.getDuration(MutableMetrics.SOURCE_UNIT) - upStream.getDuration(MutableMetrics.SOURCE_UNIT));
- }
- }
-
- // Calculate total duration
- this.totalStepDuration = 0;
- tempMetrics.forEach(m -> this.totalStepDuration += m.getDuration(MutableMetrics.SOURCE_UNIT));
-
- // Assign %'s
- tempMetrics.forEach(m ->
- m.setPercentDuration(m.getDuration(TimeUnit.NANOSECONDS) * 100.d / this.totalStepDuration)
- );
-
- // Store immutable instances of the calculated metrics
- computedMetrics = new HashMap<>(metrics.size());
- tempMetrics.forEach(it -> computedMetrics.put(it.getId(), it.getImmutableClone()));
-
- dirty = false;
- }
-
- public static StandardTraversalMetrics merge(final Iterator<StandardTraversalMetrics> toMerge) {
- final StandardTraversalMetrics newTraversalMetrics = new StandardTraversalMetrics();
-
- // iterate the incoming TraversalMetrics
- toMerge.forEachRemaining(inTraversalMetrics -> {
- newTraversalMetrics.isComputer = inTraversalMetrics.isComputer;
-
- // aggregate the internal Metrics
- inTraversalMetrics.metrics.forEach((metricsId, toAggregate) -> {
-
- MutableMetrics aggregateMetrics = newTraversalMetrics.metrics.get(metricsId);
- if (null == aggregateMetrics) {
- // need to create a Metrics to aggregate into
- aggregateMetrics = new MutableMetrics(toAggregate.getId(), toAggregate.getName());
-
- newTraversalMetrics.metrics.put(metricsId, aggregateMetrics);
- // Set the index of the Metrics
- for (Map.Entry<Integer, String> entry : inTraversalMetrics.indexToLabelMap.entrySet()) {
- if (metricsId.equals(entry.getValue())) {
- newTraversalMetrics.indexToLabelMap.put(entry.getKey(), metricsId);
- break;
- }
- }
- }
- aggregateMetrics.aggregate(toAggregate);
- });
- });
- return newTraversalMetrics;
- }
-
- public void initializeIfNecessary(final String metricsId, final int index, final String displayName, final boolean isComputer) {
- if (indexToLabelMap.containsKey(index)) {
- return;
- }
-
- this.isComputer = isComputer;
- final MutableMetrics newMetrics = new MutableMetrics(metricsId, displayName);
- // Add a nested metric for item count
- newMetrics.addNested(new MutableMetrics(ELEMENT_COUNT_ID, ITEM_COUNT_DISPLAY));
-
- // The index is necessary to ensure that step order is preserved after a merge.
- indexToLabelMap.put(index, metricsId);
- metrics.put(metricsId, newMetrics);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/TraversalMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/TraversalMetrics.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/TraversalMetrics.java
deleted file mode 100644
index 5c4c5b3..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/metric/TraversalMetrics.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.metric;
-
-import com.tinkerpop.gremlin.process.util.metric.Metrics;
-import com.tinkerpop.gremlin.structure.Graph;
-
-import java.util.Collection;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Contains the Metrics gathered for a Traversal as the result of the .profile()-step.
- *
- * @author Bob Briody (http://bobbriody.com)
- */
-public interface TraversalMetrics {
- /**
- * The side-effect key used to store and retrieve the TraversalMetrics for a given Traversal.
- */
- public static final String METRICS_KEY = Graph.Hidden.hide("metrics");
-
-
- /**
- * The MetricsId used to obtain the element count via Metrics.getNested(String metricsId)
- */
- public static final String ELEMENT_COUNT_ID = "elementCount";
-
- /**
- * Get the total duration taken by the Traversal.
- *
- * @param unit
- * @return total duration taken by the Traversal.
- */
- public long getDuration(TimeUnit unit);
-
- /**
- * Get an individual Metrics object by the index of the profiled Step.
- *
- * @param stepIndex
- * @return an individual Metrics object.
- */
- public Metrics getMetrics(final int stepIndex);
-
- /**
- * Get an individual Metrics object by the label of the profiled Step.
- *
- * @param stepLabel
- * @return an individual Metrics object.
- */
- public Metrics getMetrics(final String stepLabel);
-
- public Collection<? extends Metrics> getMetrics();
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/EmptyPath.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/EmptyPath.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/EmptyPath.java
deleted file mode 100644
index 09886ea..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/EmptyPath.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.path;
-
-import com.tinkerpop.gremlin.process.Path;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class EmptyPath implements Path, Serializable {
-
- private static final EmptyPath INSTANCE = new EmptyPath();
-
- private EmptyPath() {
-
- }
-
- @Override
- public int size() {
- return 0;
- }
-
- @Override
- public Path extend(final Object object, final String... labels) {
- return this;
- }
-
- @Override
- public <A> A get(final String label) {
- throw Path.Exceptions.stepWithProvidedLabelDoesNotExist(label);
- }
-
- @Override
- public <A> A get(final int index) {
- return (A) Collections.emptyList().get(index);
- }
-
- @Override
- public boolean hasLabel(final String label) {
- return false;
- }
-
- @Override
- public void addLabel(final String label) {
-
- }
-
- @Override
- public List<Object> objects() {
- return Collections.emptyList();
- }
-
- @Override
- public List<Set<String>> labels() {
- return Collections.emptyList();
- }
-
- @Override
- public boolean isSimple() {
- return true;
- }
-
- @Override
- public EmptyPath clone() {
- return this;
- }
-
- public static Path instance() {
- return INSTANCE;
- }
-
- @Override
- public int hashCode() {
- return -1424379551;
- }
-
- @Override
- public boolean equals(final Object object) {
- return object instanceof EmptyPath;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/ImmutablePath.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/ImmutablePath.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/ImmutablePath.java
deleted file mode 100644
index a0cc676..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/ImmutablePath.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.path;
-
-import com.tinkerpop.gremlin.process.Path;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Stream;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class ImmutablePath implements Path, Serializable, Cloneable {
-
- private Path previousPath = HeadPath.instance();
- private Object currentObject;
- private Set<String> currentLabels = new HashSet<>();
-
- protected ImmutablePath() {
-
- }
-
- public static Path make() {
- return HeadPath.instance();
- }
-
- public ImmutablePath clone() throws CloneNotSupportedException {
- return this;
- }
-
- private ImmutablePath(final Object currentObject, final String... currentLabels) {
- this(HeadPath.instance(), currentObject, currentLabels);
- }
-
- private ImmutablePath(final Path previousPath, final Object currentObject, final String... currentLabels) {
- this.previousPath = previousPath;
- this.currentObject = currentObject;
- if (currentLabels.length > 0)
- Stream.of(currentLabels).forEach(this.currentLabels::add);
- }
-
- @Override
- public int size() {
- return this.previousPath.size() + 1;
- }
-
- @Override
- public Path extend(final Object object, final String... labels) {
- return new ImmutablePath(this, object, labels);
- }
-
- @Override
- public <A> A get(final int index) {
- return (this.size() - 1) == index ? (A) this.currentObject : this.previousPath.get(index);
- }
-
- @Override
- public boolean hasLabel(final String label) {
- return this.currentLabels.contains(label) || this.previousPath.hasLabel(label);
- }
-
- @Override
- public void addLabel(final String label) {
- this.currentLabels.add(label);
- }
-
- @Override
- public List<Object> objects() {
- final List<Object> objectPath = new ArrayList<>();
- objectPath.addAll(this.previousPath.objects());
- objectPath.add(this.currentObject);
- return Collections.unmodifiableList(objectPath);
- }
-
- @Override
- public List<Set<String>> labels() {
- final List<Set<String>> labelPath = new ArrayList<>();
- labelPath.addAll(this.previousPath.labels());
- labelPath.add(this.currentLabels);
- return Collections.unmodifiableList(labelPath);
- }
-
- @Override
- public String toString() {
- return this.objects().toString();
- }
-
- private static class HeadPath implements Path {
- private static final HeadPath INSTANCE = new HeadPath();
-
- private HeadPath() {
-
- }
-
- @Override
- public int size() {
- return 0;
- }
-
- @Override
- public Path extend(final Object object, final String... labels) {
- return new ImmutablePath(object, labels);
- }
-
- @Override
- public <A> A get(final String label) {
- throw Path.Exceptions.stepWithProvidedLabelDoesNotExist(label);
- }
-
- @Override
- public <A> A get(final int index) {
- return (A) Collections.emptyList().get(index);
- }
-
- @Override
- public boolean hasLabel(final String label) {
- return false;
- }
-
- @Override
- public void addLabel(final String label) {
- throw new UnsupportedOperationException("A head path can not have labels added to it");
- }
-
- @Override
- public List<Object> objects() {
- return Collections.emptyList();
- }
-
- @Override
- public List<Set<String>> labels() {
- return Collections.emptyList();
- }
-
- @Override
- public boolean isSimple() {
- return true;
- }
-
- @Override
- public HeadPath clone() {
- return this;
- }
-
- public static Path instance() {
- return INSTANCE;
- }
-
- @Override
- public boolean equals(final Object object) {
- return object instanceof HeadPath;
- }
-
- @Override
- public String toString() {
- return Collections.emptyList().toString();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/MutablePath.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/MutablePath.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/MutablePath.java
deleted file mode 100644
index c3afc3e..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/MutablePath.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.path;
-
-import com.tinkerpop.gremlin.process.Path;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class MutablePath implements Path, Serializable {
-
- final protected List<Object> objects;
- final protected List<Set<String>> labels;
-
- protected MutablePath() {
- this(0);
- }
-
- private MutablePath(final int capacity) {
- this.objects = new ArrayList<>(capacity);
- this.labels = new ArrayList<>(capacity);
- }
-
- public static Path make() {
- return new MutablePath();
- }
-
- @Override
- public MutablePath clone() throws CloneNotSupportedException {
- final MutablePath clone = new MutablePath(this.objects.size());
- // TODO: Why is this not working Hadoop serialization-wise?... Its cause DetachedPath's clone needs to detach on clone.
- /*final MutablePath clone = (MutablePath) super.clone();
- clone.objects = new ArrayList<>();
- clone.labels = new ArrayList<>();*/
- clone.objects.addAll(this.objects);
- clone.labels.addAll(this.labels);
- return clone;
- }
-
-
- @Override
- public int size() {
- return this.objects.size();
- }
-
- @Override
- public Path extend(final Object object, final String... labels) {
- this.objects.add(object);
- this.labels.add(Stream.of(labels).collect(Collectors.toSet()));
- return this;
- }
-
- @Override
- public <A> A get(int index) {
- return (A) this.objects.get(index);
- }
-
- @Override
- public boolean hasLabel(final String label) {
- return this.labels.stream().filter(l -> l.contains(label)).findAny().isPresent();
- }
-
- @Override
- public void addLabel(final String label) {
- this.labels.get(this.labels.size() - 1).add(label);
- }
-
- @Override
- public List<Object> objects() {
- return Collections.unmodifiableList(this.objects);
- }
-
- @Override
- public List<Set<String>> labels() {
- return Collections.unmodifiableList(this.labels);
- }
-
- @Override
- public String toString() {
- return this.objects.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/SparsePath.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/SparsePath.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/SparsePath.java
deleted file mode 100644
index 1b3a870..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/path/SparsePath.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.process.util.path;
-
-import com.tinkerpop.gremlin.process.Path;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Stream;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class SparsePath implements Path, Serializable {
-
- private final Map<String, Object> map = new HashMap<>();
- private Object currentObject = null;
-
- protected SparsePath() {
-
- }
-
- public static SparsePath make() {
- return new SparsePath();
- }
-
- @Override
- public Path extend(final Object object, final String... labels) {
- this.currentObject = object;
- if (labels.length > 0)
- Stream.of(labels).forEach(label -> this.map.put(label, object));
- return this;
- }
-
- @Override
- public void addLabel(final String label) {
- this.map.put(label, this.currentObject);
- }
-
- @Override
- public List<Object> objects() {
- return Collections.unmodifiableList(new ArrayList<>(this.map.values()));
- }
-
- @Override
- public List<Set<String>> labels() {
- final List<Set<String>> labels = new ArrayList<>();
- this.map.forEach((k, v) -> labels.add(Collections.singleton(k)));
- return Collections.unmodifiableList(labels);
- }
-
-
- public <A> A get(final String label) throws IllegalArgumentException {
- final Object object = this.map.get(label);
- if (null == object)
- throw Path.Exceptions.stepWithProvidedLabelDoesNotExist(label);
- return (A) object;
- }
-
- @Override
- public boolean hasLabel(final String label) {
- return this.map.containsKey(label);
- }
-
- @Override
- public Path clone() {
- return this;
- }
-
- @Override
- public int size() {
- return this.map.size();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Compare.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Compare.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Compare.java
deleted file mode 100644
index 2f10175..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Compare.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.structure;
-
-import java.util.List;
-import java.util.function.BiPredicate;
-
-/**
- * {@link Compare} is a {@link java.util.function.BiPredicate} that determines whether the first argument is {@code ==}, {@code !=},
- * {@code >}, {@code >=}, {@code <}, {@code <=} to the second argument.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public enum Compare implements BiPredicate<Object, Object> {
-
- eq {
- @Override
- public boolean test(final Object first, final Object second) {
- if (null == first)
- return second == null;
- return first.equals(second);
- }
-
- @Override
- public Compare opposite() {
- return neq;
- }
- }, neq {
- @Override
- public boolean test(final Object first, final Object second) {
- if (null == first)
- return second != null;
- return !first.equals(second);
- }
-
- @Override
- public Compare opposite() {
- return eq;
- }
- }, gt {
- @Override
- public boolean test(final Object first, final Object second) {
- return !(null == first || second == null) && ((Comparable) first).compareTo(second) >= 1;
- }
-
- @Override
- public Compare opposite() {
- return lte;
- }
- }, gte {
- @Override
- public boolean test(final Object first, final Object second) {
- return !(null == first || second == null) && ((Comparable) first).compareTo(second) >= 0;
- }
-
- @Override
- public Compare opposite() {
- return lt;
- }
- }, lt {
- @Override
- public boolean test(final Object first, final Object second) {
- return !(null == first || second == null) && ((Comparable) first).compareTo(second) <= -1;
- }
-
- @Override
- public Compare opposite() {
- return gte;
- }
- }, lte {
- @Override
- public boolean test(final Object first, final Object second) {
- return !(null == first || second == null) && ((Comparable) first).compareTo(second) <= 0;
- }
-
- @Override
- public Compare opposite() {
- return gt;
- }
- }, inside {
- @Override
- public boolean test(final Object first, final Object second) {
- return !(null == first || second == null) && gt.test(first, ((List) second).get(0)) && lt.test(first, ((List) second).get(1));
- }
-
- @Override
- public Compare opposite() {
- return outside;
- }
- }, outside {
- @Override
- public boolean test(final Object first, final Object second) {
- return !(null == first || second == null) && lt.test(first, ((List) second).get(0)) || gt.test(first, ((List) second).get(1));
- }
-
- @Override
- public Compare opposite() {
- return inside;
- }
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public abstract boolean test(final Object first, final Object second);
-
- /**
- * Produce the opposite representation of the current {@code Compare} enum.
- */
- public abstract Compare opposite();
-
- public static final boolean hasCompare(final String name) {
- for(final Compare compare : Compare.values()) {
- if(compare.name().equals(name))
- return true;
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Contains.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Contains.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Contains.java
deleted file mode 100644
index e51a819..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Contains.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.structure;
-
-import java.util.Collection;
-import java.util.function.BiPredicate;
-
-/**
- * {@link Contains} is a {@link java.util.function.BiPredicate} that evaluates whether the first object is contained within (or not
- * within) the second collection object. For example:
- * <p/>
- * <pre>
- * gremlin Contains.within [gremlin, blueprints, furnace] == true
- * gremlin Contains.without [gremlin, rexster] == false
- * rexster Contains.without [gremlin, blueprints, furnace] == true
- * </pre>
- *
- * @author Pierre De Wilde
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public enum Contains implements BiPredicate<Object, Collection> {
-
- within {
- @Override
- public boolean test(final Object first, final Collection second) {
- return second.contains(first);
- }
- }, without {
- @Override
- public boolean test(final Object first, final Collection second) {
- return !second.contains(first);
- }
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public abstract boolean test(final Object first, final Collection second);
-
- /**
- * Produce the opposite representation of the current {@code Contains} enum.
- */
- public Contains opposite() {
- return this.equals(within) ? without : within;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Direction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Direction.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Direction.java
deleted file mode 100644
index 9a95932..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Direction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.structure;
-
-/**
- * {@link Direction} is used to denote the direction of an {@link Edge} or location of a {@link Vertex} on an
- * {@link Edge}. For example:
- * <p/>
- * <pre>
- * gremlin--knows-->rexster
- * </pre>
- * is an {@link Direction#OUT} {@link Edge} for Gremlin and an {@link Direction#IN} edge for Rexster. Moreover, given
- * that {@link Edge}, Gremlin is the {@link Direction#OUT} {@link Vertex} and Rexster is the {@link Direction#IN}
- * {@link Vertex}.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public enum Direction {
-
- OUT, IN, BOTH;
-
- public static final Direction[] proper = new Direction[]{OUT, IN};
-
- /**
- * Produce the opposite representation of the current {@code Direction} enum.
- */
- public Direction opposite() {
- if (this.equals(OUT))
- return IN;
- else if (this.equals(IN))
- return OUT;
- else
- return BOTH;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Edge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Edge.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Edge.java
deleted file mode 100644
index 6551fb9..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Edge.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.structure;
-
-import com.tinkerpop.gremlin.process.graph.traversal.EdgeTraversal;
-
-import java.util.Iterator;
-
-/**
- * An {@link Edge} links two {@link Vertex} objects. Along with its {@link Property} objects, an {@link Edge} has both
- * a {@link Direction} and a {@code label}. The {@link Direction} determines which {@link Vertex} is the tail
- * {@link Vertex} (out {@link Vertex}) and which {@link Vertex} is the head {@link Vertex}
- * (in {@link Vertex}). The {@link Edge} {@code label} determines the type of relationship that exists between the
- * two vertices.
- * <p/>
- * Diagrammatically:
- * <pre>
- * outVertex ---label---> inVertex.
- * </pre>
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public interface Edge extends Element, EdgeTraversal {
-
- /**
- * The default label to use for an edge.
- * This is typically never used as when an edge is created, an edge label is required to be specified.
- */
- public static final String DEFAULT_LABEL = "edge";
-
- /**
- * Gets the {@link Edge.Iterators} set.
- * <p/>
- * {@inheritDoc}
- */
- @Override
- public Edge.Iterators iterators();
-
- /**
- * An interface that provides access to iterators over properties and vertices, without constructing a
- * {@link com.tinkerpop.gremlin.process.Traversal} object.
- */
- public interface Iterators extends Element.Iterators {
-
- /**
- * Retrieve the vertex (or vertices) associated with this edge as defined by the direction.
- * If the direction is {@link Direction#BOTH} then the iterator order is: {@link Direction#OUT} then {@link Direction#IN}.
- *
- * @param direction Get the incoming vertex, outgoing vertex, or both vertices
- * @return An iterator with 1 or 2 vertices
- */
- public Iterator<Vertex> vertexIterator(final Direction direction);
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <V> Iterator<Property<V>> propertyIterator(final String... propertyKeys);
-
- }
-
- /**
- * Common exceptions to use with an edge.
- */
- public static class Exceptions extends Element.Exceptions {
-
- public static UnsupportedOperationException userSuppliedIdsNotSupported() {
- return new UnsupportedOperationException("Edge does not support user supplied identifiers");
- }
-
- public static UnsupportedOperationException userSuppliedIdsOfThisTypeNotSupported() {
- return new UnsupportedOperationException("Edge does not support user supplied identifiers of this type");
- }
-
- public static IllegalStateException edgeRemovalNotSupported() {
- return new IllegalStateException("Edge removal are not supported");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Element.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Element.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Element.java
deleted file mode 100644
index 86f4a1d..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Element.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.tinkerpop.gremlin.structure;
-
-import com.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-/**
- * An {@link Element} is the base class for both {@link Vertex} and {@link Edge}. An {@link Element} has an identifier
- * that must be unique to its inheriting classes ({@link Vertex} or {@link Edge}). An {@link Element} can maintain a
- * collection of {@link Property} objects. Typically, objects are Java primitives (e.g. String, long, int, boolean,
- * etc.)
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public abstract interface Element {
-
- /**
- * Gets the unique identifier for the graph {@code Element}.
- *
- * @return The id of the element
- */
- public Object id();
-
- /**
- * Gets the label for the graph {@code Element} which helps categorize it.
- *
- * @return The label of the element
- */
- public String label();
-
- /**
- * Get the graph that this element is within.
- *
- * @return the graph of this element
- */
- public Graph graph();
-
- /**
- * Get the keys of the properties associated with this element.
- * The default implementation iterators the properties and stores the keys into a {@link HashSet}.
- *
- * @return The property key set
- */
- public default Set<String> keys() {
- final Set<String> keys = new HashSet<>();
- this.iterators().propertyIterator().forEachRemaining(property -> keys.add(property.key()));
- return Collections.unmodifiableSet(keys);
- }
-
- /**
- * Get a {@link Property} for the {@code Element} given its key.
- * The default implementation calls the raw {@link Element#iterators#propertyIterator}.
- */
- public default <V> Property<V> property(final String key) {
- final Iterator<? extends Property<V>> iterator = this.iterators().propertyIterator(key);
- return iterator.hasNext() ? iterator.next() : Property.<V>empty();
- }
-
- /**
- * Add or set a property value for the {@code Element} given its key.
- */
- public <V> Property<V> property(final String key, final V value);
-
- /**
- * Get the value of a {@link Property} given it's key.
- * The default implementation calls {@link Element#property} and then returns the associated value.
- *
- * @throws NoSuchElementException if the property does not exist on the {@code Element}.
- */
- @Graph.Helper
- public default <V> V value(final String key) throws NoSuchElementException {
- final Property<V> property = this.property(key);
- return property.orElseThrow(() -> Property.Exceptions.propertyDoesNotExist(key));
- }
-
- /**
- * Removes the {@code Element} from the graph.
- */
- public void remove();
-
- /**
- * Gets the iterators for the {@code Element}. Iterators provide low-level access to the data associated with
- * an {@code Element} as they do not come with the overhead of {@link com.tinkerpop.gremlin.process.Traversal}
- * construction. Use iterators in places where performance is most crucial.
- */
- public Element.Iterators iterators();
-
- /**
- * An interface that provides access to iterators over properties of an {@code Element}, without constructing a
- * {@link com.tinkerpop.gremlin.process.Traversal} object.
- */
- public interface Iterators {
-
- /**
- * Get the values of properties as an {@link Iterator}.
- */
- @Graph.Helper
- public default <V> Iterator<V> valueIterator(final String... propertyKeys) {
- return IteratorUtils.map(this.<V>propertyIterator(propertyKeys), property -> property.value());
- }
-
- /**
- * Get an {@link Iterator} of properties.
- */
- public <V> Iterator<? extends Property<V>> propertyIterator(final String... propertyKeys);
- }
-
- /**
- * Common exceptions to use with an element.
- */
- public static class Exceptions {
-
- public static IllegalArgumentException providedKeyValuesMustBeAMultipleOfTwo() {
- return new IllegalArgumentException("The provided key/value array must be a multiple of two");
- }
-
- public static IllegalArgumentException providedKeyValuesMustHaveALegalKeyOnEvenIndices() {
- return new IllegalArgumentException("The provided key/value array must have a String or T on even array indices");
- }
-
- public static IllegalStateException propertyAdditionNotSupported() {
- return new IllegalStateException("Property addition is not supported");
- }
-
- public static IllegalStateException propertyRemovalNotSupported() {
- return new IllegalStateException("Property removal is not supported");
- }
-
- public static IllegalArgumentException labelCanNotBeNull() {
- return new IllegalArgumentException("Label can not be null");
- }
-
- public static IllegalArgumentException labelCanNotBeEmpty() {
- return new IllegalArgumentException("Label can not be empty");
- }
-
- public static IllegalArgumentException labelCanNotBeAHiddenKey(final String label) {
- return new IllegalArgumentException("Label can not be a hidden key: " + label);
- }
-
- public static IllegalStateException elementAlreadyRemoved(final Class<? extends Element> clazz, final Object id) {
- return new IllegalStateException(String.format("%s with id %s was removed.", clazz.getSimpleName(), id));
- }
- }
-}