public IEnumerable <Relationship> expand(Path path, BranchState state) { if (_pred(path, state)) { @out.println(Paths.pathToString(path, _descriptor)); } return(_source.expand(path, state)); }
public override IEnumerable <Relationship> Expand(Path path, BranchState <double> state) { if (NoneStrictMath.compare(state.State, ShortestSoFar.doubleValue(), Epsilon) > 0 && StopAfterLowestCost) { return(Collections.emptyList()); } return(Source.expand(path, state)); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: ResourceIterator<org.neo4j.graphdb.Relationship> doExpand(final org.neo4j.graphdb.Path path, org.neo4j.graphdb.traversal.BranchState state) internal override ResourceIterator <Relationship> DoExpand(Path path, BranchState state) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.graphdb.Node node = path.endNode(); Node node = path.EndNode(); return(new NestingResourceIteratorAnonymousInnerClass(this, _orderedTypes.GetEnumerator(), node)); }
public override Evaluation evaluate(Path path, BranchState state) { if (path.Length() == _depth) { return(_endNodes.Contains(path.EndNode()) ? Evaluation.IncludeAndPrune : Evaluation.ExcludeAndPrune); } return(Evaluation.ExcludeAndContinue); }
public override IEnumerable <Relationship> Expand(Path path, BranchState <int> state) { assertEquals(path.Length() / 2, state.State); if (path.Length() % 2 == 1) { state.State = state.State + 1; } return(path.EndNode().getRelationships(Direction.OUTGOING)); }
/// <summary>Creates an empty environment for a branch</summary> /// <returns></returns> public async Task Create(BranchState state, string[] paths, ILogger log) { if (VersionInfo.Version.Prerelease.NullOrEmpty()) { throw new InvalidOperationException("can't create environment, it needs to be a pre-release"); } await Task.WhenAll( CreateContainers(state, paths, log), WhCreator.CreateOrReplace(state, log)); }
public IEnumerable <Relationship> expand(Path path, BranchState <int> state) { if (path.Length() > 0) { int newState = state.State + (( Number )path.LastRelationship().getProperty("weight")).intValue(); state.State = newState; _encounteredState[path.EndNode()] = newState; } return(path.EndNode().Relationships); }
/// <summary>Creates an empty environment for a branch</summary> /// <returns></returns> public async Task Create(BranchState state, ILogger log) { if (VersionInfo.Version.Prerelease == null) { throw new InvalidOperationException("can't create environment, it needs to be a pre-release"); } await Task.WhenAll( CreateContainer(state, log), WhCreator.CreateIfNotExists(state, log)); }
public override Evaluation Evaluate(Path path, BranchState <double> state) { double nextState = state.State; if (path.Length() > 0) { nextState += CostEvaluator.getCost(path.LastRelationship(), OUTGOING); state.State = nextState; } return(Evaluation.EXCLUDE_AND_CONTINUE); }
public override IEnumerable <Relationship> Expand(Path path, BranchState <double> state) { double thisState = state.State; ThisSideShortest.Value = thisState; if (NoneStrictMath.compare(thisState + OtherSideShortest.doubleValue(), ShortestSoFar.doubleValue(), Epsilon) > 0 && StopAfterLowestCost) { return(Iterables.emptyResourceIterable()); } return(Source.expand(path, state)); }
public bool Create(Branch entity, int?countryId, int?stateId, int?cityId, int SchoolId) { using (var context = new CourseContext()) { Branch branch = entity; if (countryId != null) { Country country = context.Country.Find(countryId); if (country != null) { BranchCountry branchCountry = new BranchCountry() { Branch = branch, Country = country }; context.Add(branchCountry); } } if (stateId != null) { State state = context.State.Find(stateId); if (state != null) { BranchState branchState = new BranchState() { Branch = branch, State = state }; context.Add(branchState); } } if (cityId != null) { City city = context.City.Find(cityId); if (city != null) { BranchCity branchCity = new BranchCity() { Branch = branch, City = city }; context.Add(branchCity); } } School school = context.School.Find(SchoolId); if (school != null) { SchoolBranch schoolBranch = new SchoolBranch() { School = school, Branch = branch }; context.Add(schoolBranch); } context.SaveChanges(); return(true); } }
public override Evaluation evaluate(Path path, BranchState state) { foreach (Evaluator evaluator in _evaluators) { if (evaluator.Evaluate(path).includes()) { return(Evaluation.IncludeAndContinue); } } return(Evaluation.ExcludeAndContinue); }
public override Evaluation evaluate(Path path, BranchState state) { foreach (Node node in path.ReverseNodes()) { if (node.Equals(_nodes[0])) { return(Evaluation.IncludeAndContinue); } } return(Evaluation.ExcludeAndContinue); }
public override Evaluation evaluate(Path path, BranchState state) { Relationship lastRelationship = path.LastRelationship(); if (lastRelationship == null) { return(_evaluationIfNoMatch); } return(_expectedTypes.Contains(lastRelationship.Type.name()) ? _evaluationIfMatch : _evaluationIfNoMatch); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @SuppressWarnings("unchecked") public Iterable<org.neo4j.graphdb.Relationship> expand(org.neo4j.graphdb.Path path, org.neo4j.graphdb.traversal.BranchState<Object> state) public override IEnumerable <Relationship> Expand(Path path, BranchState <object> state) { if (path.StartNode().Equals(path.EndNode())) { assertEquals("Path length must be zero", 0, path.Length()); } else { assertTrue("Path length must be positive", path.Length() > 0); } return(Expander.expand(path, state)); }
public IEnumerable <Relationship> expand(Path path, BranchState <STATE> state) { if (path.Length() == 0) { return(path.EndNode().getRelationships(_types)); } else { Direction direction = getDirectionOfLastRelationship(path); return(path.EndNode().getRelationships(direction, _types)); } }
Task <long> CreateContainers(BranchState state, string[] paths, ILogger log) => new[] { Premium, Standard }.BlockAction(async tier => { var s = Stores.Store(tier: tier); var c = s.Container; var exists = await c.ExistsAsync(); if (!exists) { await c.CreateAsync(); await c.SetAccessPolicyAsync(PublicAccessType.BlobContainer); } await PopulateContainer(tier, state, paths, log); });
public override Evaluation evaluate(Path path, BranchState state) { ISet <Node> set = new HashSet <Node>(_fullSet); foreach (Node node in path.ReverseNodes()) { if (set.remove(node) && set.Count == 0) { return(Evaluation.IncludeAndContinue); } } return(Evaluation.ExcludeAndContinue); }
public IEnumerable <Relationship> expand(Path path, BranchState <double> state) { double newState = state.State; if (path.Length() > 0) { newState += ( double? )path.LastRelationship().getProperty("length").Value; state.State = newState; } _seenBranchStates[path.EndNode()] = newState; return(path.EndNode().getRelationships(OUTGOING)); }
public override void BranchStatusUpdate(string address, BranchState state) { try { base.BranchStatusUpdate(address, state); } catch { } if (!_Ranges.ContainsKey(DeploymentControllerID)) { lock (_Ranges) if (!_Ranges.ContainsKey(DeploymentControllerID)) { _Ranges[DeploymentControllerID] = new List <SizeRange>(); } } lock (_Ranges[DeploymentControllerID]) { if (_Ranges[DeploymentControllerID].Count != MaxLoadByFileSize.Count) { _Ranges[DeploymentControllerID].Clear(); foreach (SizeRange range in MaxLoadByFileSize) { _Ranges[DeploymentControllerID].Add(range.Clone()); } } foreach (SizeRange range in _Ranges[DeploymentControllerID]) { lock (range) { if (state == BranchState.Online && !range.ActiveLoads.Exists(i => i.IP == address)) { range.ActiveLoads.Add(new SizeRange.Load(address)); } if (state != BranchState.Online) { SizeRange.Load rem = range.ActiveLoads.FirstOrDefault(i => i.IP == address); if (rem != null) { range.ActiveLoads.Remove(rem); } } } } } }
internal override ResourceIterator <Relationship> DoExpand(Path path, BranchState state) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.graphdb.Node node = path.endNode(); Node node = path.EndNode(); ResourceIterator <Relationship> resourceIterator = asResourceIterator(node.Relationships.GetEnumerator()); return(newResourceIterator(new FilteringIterator <>(resourceIterator, rel => { Exclusion exclude = Exclusion[rel.Type.name()]; exclude = (exclude == null) ? DefaultExclusion : exclude; return exclude.accept(node, rel); }), resourceIterator)); }
/// <summary> /// This is for internal use only /// </summary> /// <param name="key"></param> public override sealed void BranchStatusUpdate(string address, BranchState state) { try { if (String.IsNullOrEmpty(address) || address == STEM.Sys.IO.Net.EmptyAddress) { return; } lock (_BranchBoundWeight) if (!_BranchBoundWeight.ContainsKey(address) && state == BranchState.Online) { _BranchBoundWeight[address] = 0; } if (state != BranchState.Online) { lock (_Keys) { List <string> bad = new List <string>(); foreach (string tag in _Keys.Keys) { if (_Keys[tag].BranchIP == address) { bad.Add(tag); } } foreach (string tag in bad) { lock (_Keys[tag]) { CoordinatedKeyManager.Unlock(tag, _Keys[tag]); } } lock (_BranchBoundWeight) _BranchBoundWeight.Remove(address); } } } catch (Exception ex) { STEM.Sys.EventLog.WriteEntry("KeyedDeploymentController.BranchStatusUpdate", ex.ToString(), STEM.Sys.EventLog.EventLogEntryType.Error); } SafeBranchStatusUpdate(address, state); }
internal override ResourceIterator <Relationship> DoExpand(Path path, BranchState state) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.graphdb.Node node = path.endNode(); Node node = path.EndNode(); if (Directions.Length == 1) { DirectionAndTypes direction = Directions[0]; return(asResourceIterator(node.GetRelationships(direction.Direction, direction.Types).GetEnumerator())); } else { return(new NestingResourceIteratorAnonymousInnerClass(this, node)); } }
public override Evaluation Evaluate(Path path, BranchState <double> state) { double nextState = state.State; if (path.Length() > 0) { nextState += CostEvaluator.getCost(path.LastRelationship(), OUTGOING); state.State = nextState; } if (path.EndNode().Equals(EndNode)) { ShortestSoFar.Value = Math.Min(ShortestSoFar.doubleValue(), nextState); return(Evaluation.INCLUDE_AND_PRUNE); } return(Evaluation.EXCLUDE_AND_CONTINUE); }
public bool CopyTracking(BranchState srcRemoteBranch) { lock (this) { bool success = true; try { if (!repository.SetActiveBranchTracking(srcRemoteBranch.fullname)) { throw new Exception(repository.lastError); } } catch (Exception e) { DebugLog.LogError("Add/Update tracking Branch Error: " + e.Message); success = false; } Refresh(); return(success); } }
public bool RenameNonActiveBranch(BranchState currentBranch, string newBranchName) { lock (this) { bool success = true; try { if (!repository.RenameNonActiveBranch(currentBranch.fullname, newBranchName)) { throw new Exception(repository.lastError); } } catch (Exception e) { DebugLog.LogError("Rename non-active Branch Error: " + e.Message); success = false; } Refresh(); return(success); } }
public bool DeleteNonActiveBranch(BranchState branch) { lock (this) { bool success = true; try { if (!repository.DeleteBranch(branch.fullname, branch.isRemote)) { throw new Exception(repository.lastError); } } catch (Exception e) { DebugLog.LogError("Delete new Branch Error: " + e.Message); success = false; } Refresh(); return(success); } }
async Task CreateContainer(BranchState state, ILogger log) { var branchContainer = StorageCfg.Container(VersionInfo.Version); var containerExists = await branchContainer.ExistsAsync(); if (containerExists) { log.Information("container {Container} exists, leaving as is", branchContainer.Uri); } if (!containerExists) { await branchContainer.CreateAsync(); await branchContainer.SetPermissionsAsync(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container }); } var db = StorageCfg.DbPath; var paths = state switch { Clone => new[] { db, StorageCfg.ImportPath }, CloneBasic => new[] { StorageCfg.ImportPath, $"{db}/channels", $"{db}/channel_reviews", $"{db}/videos", $"{db}/video_extra" }, _ => null }; if (paths == null) { return; } var prodContainer = StorageCfg.Container(VersionInfo.ProdVersion); foreach (var path in paths) { var sourceBlob = prodContainer.GetDirectoryReference(path); var destBlob = branchContainer.GetDirectoryReference(path); await YtBackup.CopyBlobs(nameof(BranchEnvCreator), sourceBlob, destBlob, log); } } }
public bool Checkout(BranchState branch, bool useFullname = false) { lock (this) { if (activeBranch == null) { return(false); } bool success = true; try { string name = useFullname ? branch.fullname : branch.name; if (activeBranch.name != name) { if (!repository.CheckoutBranch(name)) { throw new Exception(repository.lastError); } } else { DebugLog.LogError("Already on branch: " + name); success = false; } } catch (Exception e) { DebugLog.LogError("BranchManager.Checkout Failed: " + e.Message); success = false; } Refresh(); return(success); } }
async Task CreateContainer(BranchState state, ILogger log) { var branchContainer = StorageCfg.Container(VersionInfo.Version); var exists = await branchContainer.ExistsAsync(); if (exists) { log.Information("container {Container} exists, leaving as is", branchContainer.Uri); return; } await branchContainer.CreateAsync(); await branchContainer.SetPermissionsAsync(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container }); if (state == BranchState.CopyProd) { var prodContainer = StorageCfg.Container(VersionInfo.ProdVersion); var sourceBlob = prodContainer.GetDirectoryReference(StorageCfg.DbPath); var destBlob = branchContainer.GetDirectoryReference(StorageCfg.DbPath); await YtBackup.CopyBlobs(nameof(BranchEnvCreator), sourceBlob, destBlob, log); } }