All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.componenttest.Time Maven / Gradle / Ivy

The newest version!
package org.umlg.componenttest;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.text.StringEscapeUtils;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.umlg.componenttest.SpaceTime.SpaceTimeRuntimePropertyEnum;
import org.umlg.query.BaseUmlgWithQuery;
import org.umlg.runtime.adaptor.UMLG;
import org.umlg.runtime.adaptor.UmlgLabelConverterFactory;
import org.umlg.runtime.adaptor.UmlgTmpIdManager;
import org.umlg.runtime.collection.Filter;
import org.umlg.runtime.collection.Qualifier;
import org.umlg.runtime.collection.UmlgCollection;
import org.umlg.runtime.collection.UmlgRuntimeProperty;
import org.umlg.runtime.collection.UmlgSet;
import org.umlg.runtime.collection.memory.UmlgMemorySet;
import org.umlg.runtime.collection.persistent.PropertyTree;
import org.umlg.runtime.collection.persistent.UmlgSetImpl;
import org.umlg.runtime.domain.CompositionNode;
import org.umlg.runtime.domain.DataTypeEnum;
import org.umlg.runtime.domain.UmlgNode;
import org.umlg.runtime.util.ObjectMapperFactory;
import org.umlg.runtime.util.UmlgFormatter;
import org.umlg.runtime.validation.DateTimeValidation;
import org.umlg.runtime.validation.UmlgConstraintViolation;
import org.umlg.runtime.validation.UmlgConstraintViolationException;
import org.umlg.runtime.validation.UmlgValidation;
import org.umlg.tag.Tag;

public class Time extends BaseUmlgWithQuery implements CompositionNode {
	static final public long serialVersionUID = 1L;
	private UmlgSet name;
	private UmlgSet spaceTime;

	/**
	 * constructor for Time
	 * 
	 * @param id 
	 */
	public Time(Object id)  {
		super(id);
	}
	
	/**
	 * constructor for Time
	 * 
	 * @param compositeOwner 
	 */
	public Time(SpaceTime compositeOwner)  {
		super(true);
		compositeOwner.addToTime(this);
	}
	
	/**
	 * constructor for Time
	 * 
	 * @param vertex 
	 */
	public Time(Vertex vertex)  {
		super(vertex);
	}
	
	/**
	 * default constructor for Time
	 */
	public Time()  {
		this(true);
	}
	
	/**
	 * constructor for Time
	 * 
	 * @param persistent 
	 */
	public Time(Boolean persistent)  {
		super(persistent);
	}

	public void addToName(String name) {
		if ( !this.name.isEmpty() ) {
			throw new RuntimeException("Property is a one and already has value, first clear it before adding!");
		}
		if ( name != null ) {
			List violations = validateName(name);
			if ( violations.isEmpty() ) {
				this.name.add(name);
			} else {
				throw new UmlgConstraintViolationException(violations);
			}
		}
	}
	
	public void addToNameIgnoreInverse(String name) {
		if ( !this.name.isEmpty() ) {
			throw new RuntimeException("Property is a one and already has value, first clear it before adding!");
		}
		if ( name != null ) {
			List violations = validateName(name);
			if ( violations.isEmpty() ) {
				this.name.add(name);
			} else {
				throw new UmlgConstraintViolationException(violations);
			}
		}
	}
	
	public void addToSpaceTime(SpaceTime spaceTime) {
		if ( spaceTime != null ) {
			if ( !this.spaceTime.isEmpty() ) {
				throw new RuntimeException("Property umlgtest::org::umlg::componenttest::A__




© 2015 - 2025 Weber Informatics LLC | Privacy Policy