<commit_before>﻿using System;

namespace Pustota.Maven.Models
{
	public interface IProjectReferenceOperations
	{
		bool ReferenceEqualTo(IProjectReference another, bool strictVersion = true);

		bool IsEmpty { get; }

		// TODO: maybe move to version
		bool HasSpecificVersion { get; }
		bool IsSnapshot { get; }
		string SwitchToRelease(string postfix = null);
		string SwitchToSnapshotWithVersionIncrement();
	}

	internal class ProjectReferenceOperations : IProjectReferenceOperations
	{
		private readonly IProjectReference _projectReference;

		public ProjectReferenceOperations(IProjectReference projectReference)
		{
			_projectReference = projectReference;
		}

		public bool ReferenceEqualTo(IProjectReference another, bool strictVersion = true)
		{
			return
				GroupIdEqual(_projectReference.GroupId, another.GroupId) &&
				_projectReference.ArtifactId.Equals(another.ArtifactId, StringComparison.Ordinal) &&
				((strictVersion == false) || VersionEqual(_projectReference.Version, another.Version));
		}

		public bool IsEmpty
		{
			get { return string.IsNullOrEmpty(_projectReference.ArtifactId); }
		}

		public bool HasSpecificVersion
		{
			get { return !string.IsNullOrEmpty(_projectReference.Version); }
		}

		public bool IsSnapshot
		{
			get { return HasSpecificVersion
				&& _projectReference.Version.ToUpper().EndsWith(VersionOperations.SnapshotPosfix); }
		}

		public string  SwitchToRelease(string postfix = null)
		{
			string version = VersionOperations.ResetVersion(_projectReference.Version);
			return _projectReference.Version = VersionOperations.AddPostfix(version, postfix);
		}

		public string SwitchToSnapshotWithVersionIncrement()
		{
			if (!HasSpecificVersion)
			{
				return _projectReference.Version = VersionOperations.DefaultVersion.ToSnapshot();<commit_msg>reference operation has VersionEqualTo<commit_after>﻿using System;

namespace Pustota.Maven.Models
{
	public interface IProjectReferenceOperations
	{
		bool ReferenceEqualTo(IProjectReference another, bool strictVersion = true);

		bool IsEmpty { get; }

		// TODO: maybe move to version
		bool VersionEqualTo(string anotherVersion);
		bool HasSpecificVersion { get; }
		bool IsSnapshot { get; }
		string SwitchToRelease(string postfix = null);
		string SwitchToSnapshotWithVersionIncrement();
	}

	internal class ProjectReferenceOperations : IProjectReferenceOperations
	{
		private readonly IProjectReference _projectReference;

		public ProjectReferenceOperations(IProjectReference projectReference)
		{
			_projectReference = projectReference;
		}

		public bool ReferenceEqualTo(IProjectReference another, bool strictVersion = true)
		{
			return
				GroupIdEqual(_projectReference.GroupId, another.GroupId) &&
				_projectReference.ArtifactId.Equals(another.ArtifactId, StringComparison.Ordinal) &&
				((strictVersion == false) || VersionEqual(_projectReference.Version, another.Version));
		}

		public bool IsEmpty
		{
			get { return string.IsNullOrEmpty(_projectReference.ArtifactId); }
		}

		public bool VersionEqualTo(string anotherVersion)
		{
			return HasSpecificVersion && VersionEqual(_projectReference.Version, anotherVersion);
		}

		public bool HasSpecificVersion
		{
			get { return !string.IsNullOrEmpty(_projectReference.Version); }
		}

		public bool IsSnapshot
		{
			get { return HasSpecificVersion
				&& _projectReference.Version.ToUpper().EndsWith(VersionOperations.SnapshotPosfix); }
		}

		public string  SwitchToRelease(string postfix = null)
		{
			string version = VersionOperations.ResetVersion(_projectReference.Version);
			return _projectReference.Version = VersionOperations.AddPostfix(version, postfix);
		}

		public string SwitchToSnapshotWithVersionIncrement()
		{
			if (!HasSpecificVersion)
			{
				return _projectReference.Version = VersionOperations.DefaultVersion.ToSnapshot();
{'fraction_non_alphanumeric': 0.07926988265971317, 'fraction_numerical': 0.0, 'mean_word_length': 5.23739837398374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7483346', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1016, 'n_words': 215}