action instance classes of NEMO project

Change-Id: Ibafafcea65e54a808cfd1cc25b811693095a2fc2
Signed-off-by: Yuan <936396749@qq.com>
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/ParameterValues.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/ParameterValues.java
new file mode 100644
index 0000000..7a9bcb9
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/ParameterValues.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.action.instance;
+
+import org.onosproject.nemo.model.operation.action.instance
+        .parameter.values.IntValue;
+import org.onosproject.nemo.model.operation.action.instance
+        .parameter.values.RangeValue;
+import org.onosproject.nemo.model.operation.action.instance
+        .parameter.values.StringValue;
+
+import java.util.List;
+
+public interface ParameterValues {
+
+    /**
+     * Returns string values of the instance.
+     *
+     * @return string values
+     */
+    List<StringValue> getStringValues();
+
+    /**
+     * Returns integer values of the instance.
+     *
+     * @return integer values
+     */
+    List<IntValue> getIntValues();
+
+    /**
+     * Returns range values of the instance.
+     *
+     * @return range values
+     */
+    RangeValue getRangeValues();
+
+}
+
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/ParameterValuesBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/ParameterValuesBuilder.java
new file mode 100644
index 0000000..a47f41d
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/ParameterValuesBuilder.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.action.instance;
+
+import org.onosproject.nemo.model.operation.action.instance
+         .parameter.values.IntValue;
+import org.onosproject.nemo.model.operation.action.instance
+         .parameter.values.RangeValue;
+import org.onosproject.nemo.model.operation.action.instance
+         .parameter.values.StringValue;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * The description of builder for parameter value objects.
+ */
+public class ParameterValuesBuilder {
+
+    private final Map<Class<? extends ParameterValues>,
+            ParameterValues> augmentation = new HashMap<>();
+    private List<IntValue> intValue;
+    private RangeValue rangeValue;
+    private List<StringValue> stringValue;
+
+    /**
+     * Creates an instance by default.
+     */
+    public ParameterValuesBuilder() {
+    }
+
+    /**
+     * Creates an parameter value builder from a given parameter value.
+     *
+     * @param base parameter value
+     */
+    public ParameterValuesBuilder(ParameterValues base) {
+        this.intValue = base.getIntValues();
+        this.rangeValue = base.getRangeValues();
+        this.stringValue = base.getStringValues();
+    }
+
+    /**
+     * Sets the list of integer value to be used by the builder.
+     *
+     * @param value list of integer value
+     * @return self
+     */
+    public ParameterValuesBuilder intValue(List<IntValue> value) {
+        this.intValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the range value to be used by the builder.
+     *
+     * @param value range value
+     * @return self
+     */
+    public ParameterValuesBuilder rangeValue(RangeValue value) {
+        this.rangeValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the string value to be used by the builder.
+     *
+     * @param value string value
+     * @return self
+     */
+    public ParameterValuesBuilder stringValue(List<StringValue> value) {
+        this.stringValue = value;
+        return this;
+    }
+
+    /**
+     * Adds the augmentation to be used by the builder.
+     * Remove the augmentation, if the parameter value is null.
+     *
+     * @param augmentationType augmentation type
+     * @param augmentation the augmentation to be used
+     * @return self
+     */
+    public ParameterValuesBuilder addAugmentation(
+            Class<? extends ParameterValues> augmentationType,
+            ParameterValues augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation to be used by parameter value builder.
+     *
+     * @param augmentationType remove augmentation
+     * @return a parameter value builder
+     */
+    public ParameterValuesBuilder removeAugmentation(
+            Class<? extends ParameterValues> augmentationType) {
+        this.augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a new parameter value instance.
+     *
+     * @return the parameter value instance
+     */
+    public ParameterValues build() {
+        return new ParameterValuesImpl(this);
+    }
+
+    /**
+     * The implementation of parameter value to create an instance.
+     */
+    private static final class ParameterValuesImpl implements ParameterValues {
+
+        private final List<IntValue> intValue;
+        private final RangeValue rangeValue;
+        private final List<StringValue> stringValue;
+        private Map<Class<? extends ParameterValues>,
+                ParameterValues> augmentation;
+
+        private ParameterValuesImpl(ParameterValuesBuilder base) {
+            this.intValue = base.intValue;
+            this.rangeValue = base.rangeValue;
+            this.stringValue = base.stringValue;
+            this.augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public List<IntValue> getIntValues() {
+            return intValue;
+        }
+
+        @Override
+        public RangeValue getRangeValues() {
+            return rangeValue;
+        }
+
+        @Override
+        public List<StringValue> getStringValues() {
+            return stringValue;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(intValue, rangeValue,
+                    stringValue, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ParameterValues other = (ParameterValues) obj;
+            ParameterValuesImpl otherImpl = (ParameterValuesImpl) obj;
+            return Objects.equals(intValue, other.getIntValues()) &&
+                    Objects.equals(rangeValue, other.getRangeValues()) &&
+                    Objects.equals(stringValue, other.getStringValues()) &&
+                    Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("intValue", intValue)
+                    .add("rangeValue", rangeValue)
+                    .add("stringValue", stringValue)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+
+}
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/package-info.java
new file mode 100644
index 0000000..a7844f1
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/instance/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.
+ */
+
+/**
+ * The action instance classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.action.instance;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegment.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegment.java
new file mode 100644
index 0000000..984cbde
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegment.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.condition.instance;
+
+import org.onosproject.nemo.model.common.ConditionParameterName;
+import org.onosproject.nemo.model.common.ConditionSegmentId;
+import org.onosproject.nemo.model.operation.condition.instance.condition
+        .segment.ConditionParameterTargetValue;
+
+/**
+ * The condition of an segment.
+ */
+public interface ConditionSegment {
+
+    /**
+     * Returns the id of condition segment.
+     *
+     * @return the id
+     */
+    ConditionSegmentId getConditionSegmentId();
+
+    /**
+     * Returns the parameter name of condition segment.
+     *
+     * @return the parameter name
+     */
+    ConditionParameterName getConditionParameterName();
+
+    /**
+     * Returns the match pattern of condition parameter.
+     *
+     * @return the match pattern
+     */
+    ConditionParameterMatchPattern getConditionParameterMatchPattern();
+
+    /**
+     * Returns the target value of condition parameter.
+     *
+     * @return the target value
+     */
+    ConditionParameterTargetValue getConditionParameterTargetValue();
+
+    /**
+     * Returns the operator of precursor relation.
+     *
+     * @return the operator
+     */
+    PrecursorRelationOperator getPrecursorRelationOperator();
+
+    /**
+     * Returns the order of the instance.
+     *
+     * @return the order
+     */
+    long getOrder();
+
+    /**
+     * Returns the condition segment key of the instance.
+     *
+     * @return the condition segment key
+     */
+    ConditionSegmentKey getKey();
+
+    /**
+     * Types of match pattern of condition parameter.
+     */
+    public enum ConditionParameterMatchPattern {
+
+        /** less than valued pattern. */
+        LessThan(0),
+
+        /** not less than valued pattern. */
+        NotLessThan(1),
+
+        /** equal valued pattern. */
+        Equal(2),
+
+        /** not equal valued pattern. */
+        NotEqual(3),
+
+        /** greater than valued pattern. */
+        GreaterThan(4),
+
+        /** not greater than valued pattern. */
+        NotGreaterThan(5),
+
+        /** between valued pattern. */
+        Between(6),
+
+        /** Periodical valued pattern. */
+        Periodical(7);
+
+        private static final java.util.Map<Integer,
+                ConditionParameterMatchPattern> VALUE_MAP;
+
+        static {
+            final com.google.common.collect.ImmutableMap.Builder<Integer,
+                    ConditionParameterMatchPattern> b
+                    = com.google.common.collect.ImmutableMap.builder();
+            for (ConditionParameterMatchPattern enumItem :
+                    ConditionParameterMatchPattern.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+
+            VALUE_MAP = b.build();
+        }
+
+        int value;
+
+        private ConditionParameterMatchPattern(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns the corresponding ConditionParameterMatchPattern
+         * item from integer value.
+         *
+         * @param valueArg integer value
+         * @return corresponding ConditionParameterMatchPattern item
+         */
+        public static ConditionParameterMatchPattern forValue(int valueArg) {
+            return VALUE_MAP.get(valueArg);
+        }
+
+        /**
+         * Returns the integer value.
+         *
+         * @return integer value
+         */
+        public int getIntValue() {
+            return value;
+        }
+    }
+
+    /**
+     * Types of precursor relation operator.
+     */
+    public enum PrecursorRelationOperator {
+
+        /** none valued operator. */
+        None(0),
+
+        /** and valued operator. */
+        And(1),
+
+        /** or valued operator. */
+        Or(2),
+
+        /** not than valued operator. */
+        Not(3);
+
+        private static final java.util.Map<Integer,
+                PrecursorRelationOperator> VALUE_MAP;
+
+        static {
+            final com.google.common.collect.ImmutableMap.Builder<Integer,
+                    PrecursorRelationOperator> b
+                    = com.google.common.collect.ImmutableMap.builder();
+            for (PrecursorRelationOperator enumItem :
+                    PrecursorRelationOperator.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+
+            VALUE_MAP = b.build();
+        }
+
+        int value;
+
+        private PrecursorRelationOperator(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns the corresponding PrecursorRelationOperator
+         * item from integer value.
+         *
+         * @param valueArg integer value
+         * @return corresponding PrecursorRelationOperator item
+         */
+        public static PrecursorRelationOperator forValue(int valueArg) {
+            return VALUE_MAP.get(valueArg);
+        }
+
+        /**
+         * Returns the integer value.
+         *
+         * @return integer value
+         */
+        public int getIntValue() {
+            return value;
+        }
+    }
+
+}
+
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegmentBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegmentBuilder.java
new file mode 100644
index 0000000..4217b71
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegmentBuilder.java
@@ -0,0 +1,331 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.condition.instance;
+
+import org.onosproject.nemo.model.common.ConditionParameterName;
+import org.onosproject.nemo.model.common.ConditionSegmentId;
+import org.onosproject.nemo.model.operation.condition.instance.condition
+        .segment.ConditionParameterTargetValue;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.onosproject.nemo.model.operation.action.instance
+        .parameter.values.Utils.checkOrderRange;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * The description of builder for condition segment objects.
+ */
+public class ConditionSegmentBuilder {
+
+    private Map<Class<? extends ConditionSegment>, ConditionSegment>
+            augmentation = new HashMap<>();
+    private ConditionSegment.ConditionParameterMatchPattern
+            conditionParameterMatchPattern;
+    private ConditionParameterName conditionParameterName;
+    private ConditionParameterTargetValue conditionParameterTargetValue;
+    private ConditionSegmentId conditionSegmentId;
+    private ConditionSegmentKey key;
+    private Long order;
+    private ConditionSegment.PrecursorRelationOperator
+            precursorRelationOperator;
+
+    /**
+     * Creates an instance by default.
+     */
+    public ConditionSegmentBuilder() {
+    }
+
+    /**
+     * Creates a condition segment builder from a given condition segment.
+     *
+     * @param base condition segment
+     */
+    public ConditionSegmentBuilder(ConditionSegment base) {
+        if (base.getKey() == null) {
+            this.key = new ConditionSegmentKey(
+                    base.getConditionSegmentId()
+            );
+            this.conditionSegmentId = base.getConditionSegmentId();
+        } else {
+            this.key = base.getKey();
+            this.conditionSegmentId = key.getConditionSegmentId();
+        }
+        this.conditionParameterMatchPattern =
+                base.getConditionParameterMatchPattern();
+        this.conditionParameterName = base.getConditionParameterName();
+        this.conditionParameterTargetValue =
+                base.getConditionParameterTargetValue();
+        this.order = base.getOrder();
+        this.precursorRelationOperator = base.getPrecursorRelationOperator();
+    }
+
+    /**
+     * Sets condition parameter match pattern to be used by the builder.
+     *
+     * @param value the condition parameter match pattern
+     * @return self
+     */
+    public ConditionSegmentBuilder conditionParameterMatchPattern(
+            ConditionSegment.ConditionParameterMatchPattern value) {
+        this.conditionParameterMatchPattern = value;
+        return this;
+    }
+
+    /**
+     * Sets the condition parameter name to be used by the builder.
+     *
+     * @param value the condition parameter name
+     * @return self
+     */
+    public ConditionSegmentBuilder
+            conditionParameterName(ConditionParameterName value) {
+        this.conditionParameterName = value;
+        return this;
+    }
+
+    /**
+     * Sets the condition parameter target value to be used by the builder.
+     *
+     * @param value the condition parameter target value
+     * @return self
+     */
+    public ConditionSegmentBuilder conditionParameterTargetValue(
+            ConditionParameterTargetValue value) {
+        this.conditionParameterTargetValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the condition segment id value to be used by the builder.
+     *
+     * @param value the condition segment id
+     * @return self
+     */
+    public ConditionSegmentBuilder conditionSegmentId(
+            ConditionSegmentId value) {
+        this.conditionSegmentId = value;
+        return this;
+    }
+
+    /**
+     * Sets the condition segment key value to be used by the builder.
+     *
+     * @param value condition segment key value
+     * @return self
+     */
+    public ConditionSegmentBuilder key(ConditionSegmentKey value) {
+        this.key = value;
+        return this;
+    }
+
+    /**
+     * Sets the order to be used by the builder.
+     *
+     * @param value order
+     * @return self
+     */
+    public ConditionSegmentBuilder order(long value) {
+        checkOrderRange(value);
+        this.order = value;
+        return this;
+    }
+
+    /**
+     * Sets the precursor relation operator to be used by the builder.
+     *
+     * @param value precursor relation operator
+     * @return self
+     */
+    public ConditionSegmentBuilder precursorRelationOperator(
+            ConditionSegment.PrecursorRelationOperator value) {
+        this.precursorRelationOperator = value;
+        return this;
+    }
+
+    /**
+     * Adds the augmentation to be used by the builder.
+     * Remove the augmentation, if the parameter value is null.
+     *
+     * @param augmentationType augmentation type
+     * @param augmentation the augmentation to be used
+     * @return self
+     */
+    public ConditionSegmentBuilder addAugmentation(
+            Class<? extends ConditionSegment> augmentationType,
+            ConditionSegment augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation to be used by parameter value builder.
+     *
+     * @param augmentationType remove augmentation
+     * @return a parameter value builder
+     */
+    public ConditionSegmentBuilder removeAugmentation(
+            Class<? extends ConditionSegment> augmentationType) {
+            this.augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a new parameter value instance.
+     *
+     * @return the parameter value instance
+     */
+    public ConditionSegment build() {
+        return new ConditionSegmentImpl(this);
+    }
+
+    /**
+     * The implementation of condition segment to create an instance.
+     */
+    private static final class ConditionSegmentImpl
+            implements ConditionSegment {
+
+        private final ConditionParameterMatchPattern
+                conditionParameterMatchPattern;
+        private final ConditionParameterName conditionParameterName;
+        private final ConditionParameterTargetValue
+                conditionParameterTargetValue;
+        private final ConditionSegmentId conditionSegmentId;
+        private final ConditionSegmentKey key;
+        private final Long order;
+        private final PrecursorRelationOperator precursorRelationOperator;
+        private Map<Class<? extends ConditionSegment>, ConditionSegment>
+                augmentation = Collections.emptyMap();
+
+        private ConditionSegmentImpl(ConditionSegmentBuilder base) {
+            if (base.key == null) {
+                this.key = new ConditionSegmentKey(
+                        base.conditionSegmentId
+                );
+                this.conditionSegmentId = base.conditionSegmentId;
+            } else {
+                this.key = base.key;
+                this.conditionSegmentId = key.getConditionSegmentId();
+            }
+            this.conditionParameterMatchPattern =
+                    base.conditionParameterMatchPattern;
+            this.conditionParameterName = base.conditionParameterName;
+            this.conditionParameterTargetValue =
+                    base.conditionParameterTargetValue;
+            this.order = base.order;
+            this.precursorRelationOperator =
+                    base.precursorRelationOperator;
+            this.augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public ConditionParameterMatchPattern
+                getConditionParameterMatchPattern() {
+            return conditionParameterMatchPattern;
+        }
+
+        @Override
+        public ConditionParameterName getConditionParameterName() {
+            return conditionParameterName;
+        }
+
+        @Override
+        public ConditionParameterTargetValue
+                getConditionParameterTargetValue() {
+            return conditionParameterTargetValue;
+        }
+
+        @Override
+        public ConditionSegmentId getConditionSegmentId() {
+            return conditionSegmentId;
+        }
+
+        @Override
+        public ConditionSegmentKey getKey() {
+            return key;
+        }
+
+        @Override
+        public long getOrder() {
+            return order;
+        }
+
+        @Override
+        public PrecursorRelationOperator getPrecursorRelationOperator() {
+            return precursorRelationOperator;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(conditionParameterMatchPattern,
+                    conditionParameterName, conditionParameterTargetValue,
+                    conditionSegmentId, key, order, precursorRelationOperator,
+                    augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ConditionSegment other = (ConditionSegment) obj;
+            ConditionSegmentImpl otherImpl = (ConditionSegmentImpl) obj;
+            return Objects.equals(conditionParameterMatchPattern,
+                            other.getConditionParameterMatchPattern()) &&
+                    Objects.equals(conditionParameterName,
+                            other.getConditionParameterName()) &&
+                    Objects.equals(conditionParameterTargetValue,
+                            other.getConditionParameterTargetValue()) &&
+                    Objects.equals(conditionSegmentId,
+                            other.getConditionSegmentId()) &&
+                    Objects.equals(key, other.getKey()) &&
+                    Objects.equals(order, other.getOrder()) &&
+                    Objects.equals(precursorRelationOperator,
+                            other.getPrecursorRelationOperator()) &&
+                    Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("conditionParameterMatchPattern",
+                            conditionParameterMatchPattern)
+                    .add("conditionParameterName", conditionParameterName)
+                    .add("conditionParameterTargetValue",
+                            conditionParameterTargetValue)
+                    .add("conditionSegmentId", conditionSegmentId)
+                    .add("key", key)
+                    .add("order", order)
+                    .add("precursorRelationOperator",
+                            precursorRelationOperator)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+
+}
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegmentKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegmentKey.java
new file mode 100644
index 0000000..5bd63e9
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/ConditionSegmentKey.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.condition.instance;
+
+import org.onosproject.nemo.model.common.ConditionSegmentId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+/**
+ * Key of ConditionSegment.
+ */
+public class ConditionSegmentKey {
+
+    private final ConditionSegmentId conditionSegmentId;
+
+    /**
+     * Creates a copy from condition segment Id.
+     *
+     * @param conditionSegmentId condition segment Id
+     */
+    public ConditionSegmentKey(ConditionSegmentId conditionSegmentId) {
+        this.conditionSegmentId = conditionSegmentId;
+    }
+
+    /**
+     * Creates a copy from Source Object.
+     *
+     * @param source Source object
+     */
+    public ConditionSegmentKey(ConditionSegmentKey source) {
+        this.conditionSegmentId = source.conditionSegmentId;
+    }
+
+    /**
+     * Returns the condition segment Id of this instance.
+     *
+     * @return value
+     */
+    public ConditionSegmentId getConditionSegmentId() {
+        return conditionSegmentId;
+    }
+
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(conditionSegmentId);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ConditionSegmentKey other = (ConditionSegmentKey) obj;
+        return Objects.equals(conditionSegmentId, other.conditionSegmentId);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("conditionSegmentId", conditionSegmentId)
+                .toString();
+    }
+}
+
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/ConditionParameterTargetValue.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/ConditionParameterTargetValue.java
new file mode 100644
index 0000000..69030e1
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/ConditionParameterTargetValue.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.condition.instance.condition.segment;
+
+import org.onosproject.nemo.model.operation.action.instance
+        .parameter.values.RangeValue;
+
+public interface ConditionParameterTargetValue {
+
+    /**
+     * Returns string values of the instance.
+     *
+     * @return string values
+     */
+    String getStringValue();
+
+    /**
+     * Returns integer values of the instance.
+     *
+     * @return integer values
+     */
+    long getIntValue();
+
+    /**
+     * Returns range values of the instance.
+     *
+     * @return range values
+     */
+    RangeValue getRangeValue();
+
+}
+
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/ConditionParameterTargetValueBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/ConditionParameterTargetValueBuilder.java
new file mode 100644
index 0000000..ee00572
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/ConditionParameterTargetValueBuilder.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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 org.onosproject.nemo.model.operation.condition.instance
+        .condition.segment;
+
+import org.onosproject.nemo.model.operation.action.instance
+        .parameter.values.RangeValue;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+public class ConditionParameterTargetValueBuilder {
+
+    private final Map<Class<? extends ConditionParameterTargetValue>,
+            ConditionParameterTargetValue> augmentation = new HashMap<>();
+    private long intValue;
+    private RangeValue rangeValue;
+    private String stringValue;
+
+    /**
+     * Creates an instance by default.
+     */
+    public ConditionParameterTargetValueBuilder() {
+    }
+
+    /**
+     * Creates a condition parameter target value builder from
+     * a given condition parameter target value.
+     *
+     * @param base condition parameter target value
+     */
+    public ConditionParameterTargetValueBuilder(
+            ConditionParameterTargetValue base) {
+        this.intValue = base.getIntValue();
+        this.rangeValue = base.getRangeValue();
+        this.stringValue = base.getStringValue();
+    }
+
+
+    /**
+     * Sets the list of integer value to be used by the builder.
+     *
+     * @param value of integer value
+     * @return self
+     */
+    public ConditionParameterTargetValueBuilder intValue(long value) {
+        this.intValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the range value to be used by the builder.
+     *
+     * @param value range value
+     * @return self
+     */
+    public ConditionParameterTargetValueBuilder rangeValue(RangeValue value) {
+        this.rangeValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the string value to be used by the builder.
+     *
+     * @param value string value
+     * @return self
+     */
+    public ConditionParameterTargetValueBuilder stringValue(String value) {
+        this.stringValue = value;
+        return this;
+    }
+
+    /**
+     * Adds the augmentation to be used by the builder.
+     * Remove the augmentation, if the parameter value is null.
+     *
+     * @param augmentationType augmentation type
+     * @param augmentation the augmentation to be used
+     * @return self
+     */
+    public ConditionParameterTargetValueBuilder addAugmentation(
+            Class<? extends ConditionParameterTargetValue> augmentationType,
+            ConditionParameterTargetValue augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation to be used by condition
+     * parameter target value builder.
+     *
+     * @param augmentationType remove augmentation
+     * @return a parameter value builder
+     */
+    public ConditionParameterTargetValueBuilder removeAugmentation(
+            Class<? extends ConditionParameterTargetValue> augmentationType) {
+        this.augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a new condition parameter target value instance.
+     *
+     * @return the condition parameter target value instance
+     */
+    public ConditionParameterTargetValue build() {
+        return new ConditionParameterTargetValueImpl(this);
+    }
+
+    /**
+     * The implementation of condition parameter
+     * target value to create an instance.
+     */
+    private static final class ConditionParameterTargetValueImpl
+            implements ConditionParameterTargetValue {
+
+        private final long intValue;
+        private final RangeValue rangeValue;
+        private final String stringValue;
+        private Map<Class<? extends ConditionParameterTargetValue>,
+                ConditionParameterTargetValue> augmentation;
+
+        private ConditionParameterTargetValueImpl(
+                ConditionParameterTargetValueBuilder base) {
+            this.intValue = base.intValue;
+            this.rangeValue = base.rangeValue;
+            this.stringValue = base.stringValue;
+            this.augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public long getIntValue() {
+            return intValue;
+        }
+
+        @Override
+        public RangeValue getRangeValue() {
+            return rangeValue;
+        }
+
+        @Override
+        public String getStringValue() {
+            return stringValue;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(intValue, rangeValue,
+                    stringValue, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() == obj.getClass()) {
+                return false;
+            }
+            ConditionParameterTargetValue other =
+                    (ConditionParameterTargetValue) obj;
+            ConditionParameterTargetValueImpl otherImpl =
+                    (ConditionParameterTargetValueImpl) obj;
+            return Objects.equals(intValue, other.getIntValue()) &&
+                    Objects.equals(rangeValue, other.getRangeValue()) &&
+                    Objects.equals(stringValue, other.getStringValue()) &&
+                    Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("intValue", intValue)
+                    .add("rangeValue", rangeValue)
+                    .add("stringValue", stringValue)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+
+}
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/package-info.java
new file mode 100644
index 0000000..7befc4a
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/condition/segment/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.
+ */
+
+/**
+ * The condition of operation instance classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.condition.instance.condition.segment;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/package-info.java
new file mode 100644
index 0000000..cc8e4f5
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/instance/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.
+ */
+
+/**
+ * The condition of operation instance classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.condition.instance;