public ReproductionEvent(ILocation location, int generation, Type reproductionType, ISpecies mate, params ISpecies[] children)
     : base(location, generation)
 {
     this.Mate = mate;
     this.Offspring = new List<ISpecies>(children);
     this.ReproductionType = reproductionType;
 }
Exemplo n.º 2
0
        public Player(ILocation playerLocation, int startingBalance = DEFAULT_STARTING_BALANCE)
        {
            getOutOfJailFreeCards = new Stack<ICard>();

            PlayerLocation = playerLocation;
            Balance = startingBalance;
        }
Exemplo n.º 3
0
        public static int? CalculateCloseness(this ILocation locationA, ILocation locationB, StringComparison comparisonType = StringComparison.InvariantCultureIgnoreCase)
        {
            var sequenceA = locationA.GetParts();
            var sequenceB = locationB.GetParts();

            return sequenceA.CalculateCloseness(sequenceB, comparisonType);
        }
Exemplo n.º 4
0
		public override VoyageState DepartFrom (ILocation location)
		{
			if(LastKnownLocation.Equals(location.UnLocode))
				return this;
			string message = string.Format("The voyage departed from {0}.", LastKnownLocation);
			throw new ArgumentException(message, "location");
		}
Exemplo n.º 5
0
        public bool GetIsVisible(ILocation location)
        {
            Contract.Requires<ArgumentNullException>(location != null, "location");
            Contract.Requires<VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(location.GetVirtualMachine()));

            throw new NotImplementedException();
        }
 public LineReport(double time, ILocation loc1, ILocation loc2, bool isStatic, int id)
     : this(time, loc1, loc2)
 {
     this.isStatic = isStatic;
     this.id = id;
     if (isStatic) layer = DrawLayer.Static;
 }
Exemplo n.º 7
0
 private void ChangeUnitLocation(IPath pathToTheTargetPlanet, IUnit unitToTeleport, ILocation targetLocation)
 {
     pathToTheTargetPlanet.TargetLocation.Planet.Units.Add(unitToTeleport);
     unitToTeleport.CurrentLocation.Planet.Units.Remove(unitToTeleport);
     unitToTeleport.PreviousLocation = unitToTeleport.CurrentLocation;
     unitToTeleport.CurrentLocation = targetLocation;
 }
Exemplo n.º 8
0
        public IPiece GetPiece(ILocation location)
        {
            if (location == null)
                throw new ArgumentNullException("Location must not be null");

            return GetPiece(location.X, location.Y);
        }
Exemplo n.º 9
0
		public IEnumerable<ILocation> GetWalkPoints(ILocation from, ILocation to)
		{
			if (_mask == null || _mask [0] == null)
				return new List<ILocation> ();
			var grid = CreateGrid(_mask);
			return getWalkPoints(grid, from, to);
		}
Exemplo n.º 10
0
        public ALListener(IAudioErrors errors, IAudioBackend backend)
		{
			_errors = errors;
            _backend = backend;
			Volume = 0.5f;
			_location = new AGSLocation ();
		}
Exemplo n.º 11
0
 public MarkedLocation(ILocation location)
     : base(location)
 {
     MarkColor = new Marker();
     //if location are marked white, it means they haven't yet being visited
     MarkColor.Mark = Color.White;
 }
Exemplo n.º 12
0
        public static int CompareByParts(this ILocation location1, ILocation location2)
        {
            var location1Parts = (location1 == null) ? (new string[0]) : (location1.GetParts().ToArray());
            var location2Parts = (location2 == null) ? (new string[0]) : (location2.GetParts().ToArray());

            for (var i = 0; i < location1Parts.Length && i < location2Parts.Length; i++)
            {
                var location1Part = location1Parts[i];
                var location2Part = location2Parts[i];

                var result = string.Compare(location1Part, location2Part, StringComparison.InvariantCultureIgnoreCase);

                if (result != 0)
                {
                    return result;
                }
            }

            if (location1Parts.Length < location2Parts.Length)
            {
                return -1;
            }
            else if (location1Parts.Length > location2Parts.Length)
            {
                return 1;
            }

            return 0;
        }
        private void Explore(IActor actor, ILocation location)
        {
            //If an exit location is found, print the path and continue to find another exit
            if (location is ExitLocation)
            {
                if ((location as ExitLocation).ExitPreviouslyFound)
                    return;
                (location as ExitLocation).ExitPreviouslyFound = true;
                NumberOfExits++;
                TripRecorder.Instance.PrintTrip();
                terrain.PathToExit();
                terrain.TerrainPrinter(terrain.StartLocation);
                str= String.Format("{0} Number Of Exit(s) Found!", NumberOfExits);
                   Console.WriteLine(str);
                Console.WriteLine("*****************************************************************");
                return;
            }

            //When the location is dead end
            if (location.ListOfNeighbors().Count == 0)
            {
                (location as MarkedLocation).MarkRed();
                return;
            }

            //traverses to all the neigbors of a location
            foreach (var neighbor in location.ListOfNeighbors())
            {
                location.MoveToNeighbor(actor, neighbor.Key);
                Explore(actor, neighbor.Value);
            }
            //The location will be marked red when it backtracks
            (location as MarkedLocation).MarkRed();
        }
Exemplo n.º 14
0
 public JavaDebugCodeContext(JavaDebugProgram program, ILocation location)
 {
     Contract.Requires<ArgumentNullException>(program != null, "program");
     Contract.Requires<ArgumentNullException>(location != null, "location");
     _program = program;
     _location = location;
 }
Exemplo n.º 15
0
        public bool Copy(ILocation sourceLocation, ILocation destinationLocation, ReplaceMode replaceMode)
        {
            if (replaceMode == ReplaceMode.UserAsking)
                throw new Exception ("Use Copy(ILocation,ILocation,Func<ReplaceMode>) call.");

            return Copy (sourceLocation, destinationLocation, replaceMode, null);
        }
Exemplo n.º 16
0
        public bool Copy(ILocation sourceLocation, ILocation destinationLocation, Func<ReplaceMode> userAskHandler)
        {
            if (userAskHandler == null)
                throw new Exception ("Use Copy(ILocation,ILocation, ReplaceMode) call.");

            return Copy (sourceLocation, destinationLocation, ReplaceMode.UserAsking, userAskHandler);
        }
Exemplo n.º 17
0
        public IEnumerable<Face> GetFaces(ILocation location)
        {
            if (this.contacts.Count == 0) // contacts.xml not loaded for some reason
                yield break;

            var ini = this.iniFileFinder.FindIn(location);
            if (ini == null)
                yield break;

            var parsed = this.parser.Parse(ini);
            var rawFaces = from pair in parsed.Items
                           from face in pair.Value.Faces
                           select new { FileName = pair.Key, face.ContactHash };

            var contactsIndex = parsed.Contacts.ToDictionary(c => c.Hash);

            foreach (var rawFace in rawFaces) {
                var contact = contactsIndex.GetValueOrDefault(rawFace.ContactHash);
                if (contact == null)
                    continue;

                var file = location.GetFile(rawFace.FileName);
                if (file == null)
                    continue;

                var key = new ContactKey(contact.UserCode, contact.ID);
                var person = this.contacts.GetValueOrDefault(key);
                if (person == null)
                    continue;

                yield return new Face(person, file);
            }
        }
Exemplo n.º 18
0
        internal virtual IEnumerable<CopyOperation> ResolveSourceLocations(SourceSet[] sourceSet, ILocation destinationLocation)
        {
            bool copyContainer = this.Container;

            foreach (var src in sourceSet) {
                var resolver = GetLocationResolver(src.ProviderInfo);
                foreach (var path in src.SourcePaths) {
                    var location = resolver.GetLocation(path);
                    var absolutePath = location.AbsolutePath;

                    if (!location.IsFile) {
                        // if this is not a file, then it should be a container.
                        if (!location.IsItemContainer) {
                            throw new ClrPlusException("Unable to resolve path '{0}' to a file or folder.".format(path));
                        }

                        // if it's a container, get all the files in the container
                        var files = location.GetFiles(Recurse);
                        foreach (var f in files) {
                            var relativePath = (copyContainer ? location.Name + @"\\" : "") + absolutePath.GetRelativePath(f.AbsolutePath);
                            yield return new CopyOperation {
                                Destination = destinationLocation.IsFileContainer ? destinationLocation.GetChildLocation(relativePath) : destinationLocation,
                                Source = f
                            };
                        }
                        continue;
                    }

                    yield return new CopyOperation {
                        Destination = destinationLocation.IsFileContainer ?  destinationLocation.GetChildLocation(location.Name) : destinationLocation,
                        Source = location
                    };
                }
            }
        }
Exemplo n.º 19
0
		public Leg (IVoyage voyage, ILocation loadLocation, DateTime loadTime, ILocation unloadLocation, DateTime unloadTime)
		{
			if(null == voyage)
				throw new ArgumentNullException("voyage");
			if(null == loadLocation)
				throw new ArgumentNullException("loadLocation");
			if(null == unloadLocation)
				throw new ArgumentNullException("unloadLocation");
			if(loadTime >= unloadTime)
				throw new ArgumentException("Unload time must follow the load time.","unloadTime");
			if(loadLocation.UnLocode.Equals(unloadLocation.UnLocode))
				throw new ArgumentException("The locations must not be differents.", "unloadLocation");
			if(!voyage.WillStopOverAt(loadLocation))
			{
				string message = string.Format("The voyage {0} will not stop over the load location {1}.", voyage.Number, loadLocation.UnLocode);
				throw new ArgumentException(message, "loadLocation");
			}
			if(!voyage.WillStopOverAt(unloadLocation))
			{
				string message = string.Format("The voyage {0} will not stop over the unload location {1}.", voyage.Number, unloadLocation.UnLocode);
				throw new ArgumentException(message, "unloadLocation");
			}
			
			_voyage = voyage.Number;
			_loadLocation = loadLocation.UnLocode;
			_unloadLocation = unloadLocation.UnLocode;
			_loadTime = loadTime;
			_unloadTime = unloadTime;
		}
Exemplo n.º 20
0
        public MigrationEvent(ILocation originLocation, ILocation destinationLocation, int cost, int generation)
            : base(destinationLocation, cost, generation)
        {
            if (originLocation == null) throw new ArgumentNullException("originLocation");

            this.OriginLocation = originLocation;
        }
Exemplo n.º 21
0
 public Window()
 {
     _eventModel = new EventModel(this);
     //by default window is a parent control for all other controls, canvases, etc.
     Visible = true;
     Paint += Window_Paint;
     _innerWidth = ClientRectangle.Width;
     _innerHeight = ClientRectangle.Height;
     //BackColor = Color.Empty;
     UpdateClientRect();
     Initialize();
     //ConfigureHook();
     Name = "window";
     _location = new Location();
     _location.OnSaveFile += location_OnSaveFile;
     //
     // dlgSaveFile
     //
     _dlgSaveFile = new SaveFileDialog();
     _dlgSaveFile.Title = "Save PDF File";
     _dlgSaveFile.Filter = "PDF|*.pdf";
     //
     // document
     //
     _document = new Document(this);
     _document.Width = _innerWidth;
     _document.Height = _innerHeight;
     Controls.Add(_document);
     _childNodes = new List<INode>();
     _childNodes.Add(_document);
     //
     // Events
     //);
     this.Resize += new EventHandler(Window_Resize);
 }
Exemplo n.º 22
0
		private IEnumerable<ILocation> getWalkPoints(BaseGrid grid, ILocation from, ILocation to)
		{
			JumpPointParam input = new JumpPointParam (grid, getPos(from), getPos(to), AllowEndNodeUnwalkable, CrossCorner, CrossAdjacentPoint, Heuristics) { UseRecursive = UseRecursive };
			var cells = JumpPointFinder.FindPath (input);
			if (!SmoothPath) cells = JumpPointFinder.GetFullPath(cells);
			return cells.Select (c => getLocation (c, to.Z));
		}
 public CircleReport(double time, ILocation loc, double size, GraphicsPath gradientPath)
 {
     this.time = time;
     loc1 = loc;
     this.size = size;
     this.gradientPath = gradientPath;
 }
 static ProxyTestHelper()
 {
     _person = new Person(PersonId);
     _business = new Business(BusinessId);
     _location = new Location(LocationId);
     _phone = new Phone(PhoneId);
 }
Exemplo n.º 25
0
 /// <summary>Make the object leave the solar system</summary>
 /// <param name="obj"></param>
 public void LeaveSystem(ILocation @obj)
 {
     lock (objects)
     {
         this.objects.Remove(obj);
     }
 }
Exemplo n.º 26
0
		public void StopOverAt (ILocation location)
		{
			if(null == location)
				throw new ArgumentNullException("location");
			
			// Thread safe, lock free sincronization
	        VoyageState stateBeforeTransition;
	        VoyageState previousState = CurrentState;
	        do
	        {
	            stateBeforeTransition = previousState;
	            VoyageState newValue = stateBeforeTransition.StopOverAt(location);
	            previousState = Interlocked.CompareExchange<VoyageState>(ref this.CurrentState, newValue, stateBeforeTransition);
	        }
	        while (previousState != stateBeforeTransition);

			if(!previousState.Equals(this.CurrentState))
			{
				VoyageEventArgs args = new VoyageEventArgs(previousState.LastKnownLocation, previousState.NextExpectedLocation);
				
				EventHandler<VoyageEventArgs> handler = Stopped;
				if(null != handler)
					handler(this, args);
			}
		}
Exemplo n.º 27
0
 public TeleportStation(IBusinessOwner owner, IEnumerable<IPath> galacticMap, ILocation location)
 {
     this.owner = owner;
     this.galacticMap = galacticMap;
     this.location = location;
     this.resources = new Resources();
 }
Exemplo n.º 28
0
 public SectionRangeToken(ILocation location, ISection section, int idx, int length, TokenEnum code)
 {
     _location = location;
     _code = code;
     _section = section;
     _idx = idx;
     _length = length;
 }
Exemplo n.º 29
0
		public CodeBuilder (string code, bool isAssign, ILocation location)
		{
			this.code = code;
			this.isAssign = isAssign;
			this.line = location.BeginLine;
			this.fileName = location.Filename;
			this.location = location;
		}
Exemplo n.º 30
0
 /// <summary>
 /// Return zero or more locations in primary source documents that correspond to the given derived (non primary) document location.
 /// </summary>
 /// <param name="location">A location in a document that have been derived from one or more source documents.</param>
 public IEnumerable<IPrimarySourceLocation> GetPrimarySourceLocationsFor(ILocation location) {
   var psloc = location as IPrimarySourceLocation;
   if (psloc != null)
     return IteratorHelper.GetSingletonEnumerable(psloc);
   else {
     return this.MapLocationToSourceLocations(location);
   }
 }
Exemplo n.º 31
0
 public MockedTeleportStation(IBusinessOwner owner, IEnumerable <IPath> galacticMap, ILocation location)
     : base(owner, galacticMap, location)
 {
 }
Exemplo n.º 32
0
 public bool ContainsLocation(ILocation location)
 {
     return(ContainsLocation(location.Coordinate1, location.Coordinate2));
 }
Exemplo n.º 33
0
 public void MoveSouth()
 {
     CurrentLocation = new Location(Id, CurrentLocation.X, CurrentLocation.Y + 1);
 }
Exemplo n.º 34
0
 public void SetInitialLocation(int x, int y)
 {
     CurrentLocation = new Location(Id, x, y);
 }
Exemplo n.º 35
0
 public Employee(ILocation location, uint hoursWorked, decimal hourlyRate)
 {
     Location    = location;
     HourlyRate  = hourlyRate;
     HoursWorked = hoursWorked;
 }
Exemplo n.º 36
0
 public Assignment CreateAssignmentFromDb(int id, ITribe tribe, uint x, uint y, ILocation target, AttackMode mode, DateTime targetTime, uint dispatchCount, string description, bool isAttack)
 {
     return(new Assignment(id,
                           tribe,
                           x,
                           y,
                           target,
                           mode,
                           targetTime,
                           dispatchCount,
                           description,
                           isAttack,
                           kernel.Get <Formula>(),
                           kernel.Get <IDbManager>(),
                           kernel.Get <IGameObjectLocator>(),
                           kernel.Get <IScheduler>(),
                           kernel.Get <Procedure>(),
                           kernel.Get <ITileLocator>(),
                           kernel.Get <IActionFactory>(),
                           kernel.Get <ILocker>(),
                           kernel.Get <ITroopObjectInitializerFactory>()));
 }
Exemplo n.º 37
0
 public void SaveLocation(ILocation location)
 {
     this.locationManager.UpdateLocation(location);
 }
Exemplo n.º 38
0
 /// <summary>
 /// Creates new Exon feature item from the specified location.
 /// </summary>
 /// <param name="location">Location of the Exon.</param>
 public Exon(ILocation location)
     : base(StandardFeatureKeys.Exon, location)
 {
 }
Exemplo n.º 39
0
 public NormalLocation()
 {
     Directions = new ILocation[] { null, null, null, null };
     Items      = new List <InventoryItem>();
 }
Exemplo n.º 40
0
        /// <summary>
        /// 添加查找面板
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="source"></param>
        /// <param name="location"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="placeHolder"></param>
        public static void AddSearchPanel <TModel>(this DynamicTable <TModel> source, ILocation location, string key, string value, string placeHolder = null) where TModel : class
        {
            if (source == null)
            {
                return;
            }
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            var connector = "?";

            if (location.Path.IndexOf("?") > -1)
            {
                connector = "&";
            }
            var script = string.Format("$app.same('{0}{1}{2}=' + encodeURIComponent($.trim($(this).parent().parent().find('input[name={2}]').val())))", location.Path, connector, key);

            var form = new HtmlElement(HtmlTag.Form);

            form.OnClient(HtmlEvent.Submit, string.Format("$app.same('{0}{1}{2}=' + encodeURIComponent($.trim($(this).find('input[name={2}]').val()))); return false;", location.Path, connector, key));
            form.PrependTo(source);

            var search = new HtmlElement(HtmlTag.Div);

            search.AddClass("form-group");
            search.AppendTo(form);

            var group = new HtmlElement(HtmlTag.Div);

            group.AppendTo(search);
            group.AddClass(Column.Sm5);
            group.AddClass("input-group");
            var input = new HtmlElement(HtmlTag.Input);

            input.AppendTo(group);
            input.Attribute(HtmlAttribute.Name, key);
            input.Attribute(HtmlAttribute.Value, value);
            input.Attribute(HtmlAttribute.PlaceHolder, placeHolder);
            input.AddClass("form-control");
            var span = new HtmlElement(HtmlTag.Span);

            span.AddClass("input-group-addon");
            span.AppendTo(group);
            var button = new HtmlElement(HtmlTag.Input);

            button.AppendTo(span);
            button.Attribute(HtmlAttribute.Value, "查找");
            button.Attribute(HtmlAttribute.Type, "submit");
        }
Exemplo n.º 41
0
 private void SetCommodities(ILocation location) => location.SetCommodities(Commodities.OrderBy(Random).Take(5));
Exemplo n.º 42
0
 public void MoveWest()
 {
     CurrentLocation = new Location(Id, CurrentLocation.X - 1, CurrentLocation.Y);
 }
Exemplo n.º 43
0
 protected Entity(int lives, ILocation location)
 {
     Location = location;
     Lives    = lives;
 }
        private ILocation CreateLocation(ILocation location)
        {
            var locationRepo = dataService.GetRepository <ILocationRepository, ILocation>();

            return(locationRepo.Add(location));
        }
Exemplo n.º 45
0
 public string GetLocationDescription(ILocation loc)
 {
     return(string.IsNullOrWhiteSpace(loc.Description) ? loc.LocationCode : loc.Description);
 }
 public void Update(ILocation entity)
 {
     Context.SetModified(entity);
 }
Exemplo n.º 47
0
 public static bool CoordinatesLocatedIn(
     ICoordinates coordinates,
     ILocation location)
 {
     return(CoordinatesLocatedIn(coordinates, location.Coordinate1, location.Coordinate2));
 }
 public void Deactivate(ILocation entity)
 {
     entity.Active = false;
     Update(entity);
 }
Exemplo n.º 49
0
 public TemporalLocation(ILocation location, IFuzzyDateTimeRange dateTimeRange, ICitation citation, IAudit audit) : base(dateTimeRange.StartDateTime, dateTimeRange.EndDateTime, citation, audit)
 {
     Location = location;
 }
 public void Remove(ILocation entity)
 {
     Context.Locations.Remove((Location)entity);
 }
Exemplo n.º 51
0
 public void MoveNorth()
 {
     CurrentLocation = new Location(Id, CurrentLocation.X, CurrentLocation.Y - 1);
 }
 public void Add(ILocation entity)
 {
     Context.Locations.Add((Location)entity);
 }
Exemplo n.º 53
0
 public override CargoState Recieve(ILocation location, DateTime date)
 {
     throw new InvalidOperationException("Already recieved.");
 }
Exemplo n.º 54
0
 public bool Equals(ILocation other)
 {
     return(Name == other.Name && Token == other.Token);
 }
Exemplo n.º 55
0
        public IEnumerable <CheckResult> VerifyVCEncounter(PKM pkm, IEncounterable encounter, ILocation transfer, IList <CheckMoveResult> Moves)
        {
            // Check existing EncounterMatch
            if (encounter is EncounterInvalid || transfer == null)
            {
                yield break; // Avoid duplicate invaild message
            }
            if (encounter is EncounterStatic v && (GameVersion.GBCartEraOnly.Contains(v.Version) || v.Version == GameVersion.VCEvents))
            {
                bool exceptions = false;
                exceptions |= v.Version == GameVersion.VCEvents && encounter.Species == 151 && pkm.TID == 22796;
                if (!exceptions)
                {
                    yield return(GetInvalid(LG1GBEncounter));
                }
            }

            if (pkm.Met_Location != transfer.Location)
            {
                yield return(GetInvalid(LTransferMetLocation));
            }
            if (pkm.Egg_Location != transfer.EggLocation)
            {
                yield return(GetInvalid(LEggLocationNone));
            }

            // Flag Moves that cannot be transferred
            if (encounter is EncounterStatic s && s.Version == GameVersion.C && s.EggLocation == 256) // Dizzy Punch Gifts
            {
                FlagIncompatibleTransferMove(pkm, Moves, 146, 2);                                     // can't have Dizzy Punch at all
            }
            bool checkShiny = pkm.VC2 || (pkm.TradebackStatus == TradebackType.WasTradeback && pkm.VC1);

            if (!checkShiny)
            {
                yield break;
            }

            if (pkm.Gender == 1)                                  // female
            {
                if (pkm.PersonalInfo.Gender == 31 && pkm.IsShiny) // impossible gender-shiny
                {
                    yield return(GetInvalid(LEncStaticPIDShiny, CheckIdentifier.PID));
                }
            }
            else if (pkm.Species == 201)                                  // unown
            {
                if (pkm.AltForm != 8 && pkm.AltForm != 21 && pkm.IsShiny) // impossibly form-shiny (not I or V)
                {
                    yield return(GetInvalid(LEncStaticPIDShiny, CheckIdentifier.PID));
                }
            }
        }
Exemplo n.º 56
0
 public void RemoveLocation(ILocation location)
 {
     RemoveLocation(location.Coordinate1, location.Coordinate2);
 }
 protected static void Setup()
 {
     StartLocation = new Domain.Location(XCoordinate, YCoordinate);
     RobotCleaner  = new RobotCleaner(StartLocation, Commands);
 }
Exemplo n.º 58
0
 public void MoveEast()
 {
     CurrentLocation = new Location(Id, CurrentLocation.X + 1, CurrentLocation.Y);
 }
Exemplo n.º 59
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="location">
 /// The location to be cleared.
 /// </param>
 /// <param name="force">
 /// A boolean representing whether to override logic and clear the location.
 /// </param>
 public ClearLocation(ILocation location, bool force = false)
 {
     _location = location;
     _force    = force;
 }
Exemplo n.º 60
0
 public Boat As(IRace race, ILocation favour)
 {
     return(new Boat(Number, Name, Category, false));            // , race, favour);
 }