static void EmitTypeCheck(CodeGenerator cg, IPlace valueplace, SourceParameterSymbol srcparam) { // TODO: check callable, iterable, type if not resolved in ct // check NotNull if (srcparam.IsNotNull) { if (valueplace.TypeOpt.IsReferenceType && valueplace.TypeOpt != cg.CoreTypes.PhpAlias) { cg.EmitSequencePoint(srcparam.Syntax); // Template: if (<param> == null) { PhpException.ArgumentNullError(param_name); } var lbl_notnull = new object(); cg.EmitNotNull(valueplace); cg.Builder.EmitBranch(ILOpCode.Brtrue_s, lbl_notnull); // PhpException.ArgumentNullError(param_name); // Consider: just Debug.Assert(<param> != null) for private methods cg.Builder.EmitStringConstant(srcparam.Name); cg.EmitPop(cg.EmitCall(ILOpCode.Call, cg.CoreTypes.PhpException.Method("ArgumentNullError", cg.CoreTypes.String))); // cg.Builder.EmitOpCode(ILOpCode.Nop); cg.Builder.MarkLabel(lbl_notnull); } } }
internal override void EmitInit(CodeGenerator cg) { if (VariableKind == VariableKind.LocalTemporalVariable || cg.HasUnoptimizedLocals) { // temporal variables must be indirect return; } // declare variable in global scope var il = cg.Builder; var def = il.LocalSlotManager.DeclareLocal( (Cci.ITypeReference)_symbol.Type, _symbol as ILocalSymbolInternal, this.Name, SynthesizedLocalKind.UserDefined, LocalDebugId.None, 0, LocalSlotConstraints.None, false, default(ImmutableArray <TypedConstant>), false); _place = new LocalPlace(def); il.AddLocalToScope(def); // if (_symbol is SynthesizedLocalSymbol) { return; } // Initialize local variable with void. // This is mandatory since even assignments reads the target value to assign properly to PhpAlias. // TODO: Once analysis tells us, the target cannot be alias, this step won't be necessary. // TODO: only if the local will be used uninitialized cg.EmitInitializePlace(_place); }
public DirectParameter(IPlace place, bool isparams, bool byref) { Debug.Assert(place != null); _place = place; _isparams = isparams; _byref = byref; }
private void contextResults_ItemClicked(object sender, Object e) { IPlace place = e as IPlace; if (place != null) { Place p = e as Place; if (p != null && p.Tour != null) { FolderBrowser.LaunchTour(p.Tour); return; } if (!string.IsNullOrEmpty(((IPlace)e).Url)) { WebWindow.OpenUrl(((IPlace)e).Url, false); } else { Earth3d.MainWindow.GotoTarget((IPlace)e, false, false, true); } } else if (e is IImageSet) { Earth3d.MainWindow.CurrentImageSet = e as IImageSet; } }
private void RunQuerySolarSystem() { if (contextResults.Items.Count > 0) { IPlace pl = contextResults.Items[0] as IPlace; if (pl != null) { if (pl.Classification == Classification.SolarSystem) { return; } } } contextResults.Clear(); paginator1.CurrentPage = 1; paginator1.TotalPages = 1; IPlace[] results = ContextSearch.FindAllObjects("SolarSystem", Classification.SolarSystem); if (results != null) { contextResults.AddRange(results); } //contextResults.Invalidate(); }
public async Task GetDetails(string id) { if (this._apiClient == null || !this._apiClient.IsConnected) { ConnectToPlacesAPI(); } PlaceBuffer nativeResult = await PlacesClass.GeoDataApi.GetPlaceByIdAsync(this._apiClient, id); if (nativeResult == null || !nativeResult.Any()) { return; } IPlace nativeDetails = nativeResult.First(); this.AddMarker(nativeDetails.NameFormatted.ToString(), nativeDetails.LatLng); //return new TKPlaceDetails //{ // Coordinate = nativeDetails.LatLng.ToPosition(), // FormattedAddress = nativeDetails.AddressFormatted.ToString(), // InternationalPhoneNumber = nativeDetails.PhoneNumberFormatted?.ToString(), // Website = nativeDetails.WebsiteUri?.ToString() //}; }
public IArc AddArc(IPlace place, ITransition transition) { IArc arc=new Arc(version++,place,transition); this.arcs.Add(arc); this.graph.AddEdge(arc); return arc; }
public Client(ICar factory) { place = factory.ShowPlace(); carcass = factory.CreateCarcass(); power = factory.CreatePower(); fuel = factory.CreateFuel(); }
public Arc(ITransition <Token> transition, IPlace <Token> place) : base(place, transition) { this.place = place; this.transition = transition; this.isInputArc = false; }
public static void EmitAddFrame(ILEmitter/*!*/ il, IPlace/*!*/ scriptContextPlace, int typeArgCount, int argCount, Action<ILEmitter, int> typeArgEmitter, Action<ILEmitter, int>/*!*/ argEmitter) { Debug.Assert(typeArgCount == 0 || typeArgEmitter != null); // type args: if (typeArgCount > 0) { scriptContextPlace.EmitLoad(il); il.Emit(OpCodes.Ldfld, Fields.ScriptContext_Stack); il.EmitOverloadedArgs(Types.DTypeDesc[0], typeArgCount, Methods.PhpStack.AddTypeFrame.ExplicitOverloads, typeArgEmitter); } // args: scriptContextPlace.EmitLoad(il); il.Emit(OpCodes.Ldfld, Fields.ScriptContext_Stack); il.EmitOverloadedArgs(Types.Object[0], argCount, Methods.PhpStack.AddFrame.ExplicitOverloads, argEmitter); il.Emit(OpCodes.Call, Methods.PhpStack.AddFrame.Overload(argCount)); // AddFrame adds empty type frame by default, so if there are no type parameters, we can skip AddTypeFrame call: if (typeArgCount > 0) il.Emit(OpCodes.Call, Methods.PhpStack.AddTypeFrame.Overload(typeArgCount)); }
public IArc AddArc(ITransition transition, IPlace place) { IArc arc = new Arc(this.version++, transition, place); this.arcs.Add(arc); this.graph.AddEdge(transition, place); return arc; }
public Arc(int id,ITransition transition,IPlace place) : base(id,transition,place) { this.place=place; this.transition=transition; this.isInputArc=false; }
public static void EmitAddFrame(ILEmitter /*!*/ il, IPlace /*!*/ scriptContextPlace, int typeArgCount, int argCount, Action <ILEmitter, int> typeArgEmitter, Action <ILEmitter, int> /*!*/ argEmitter) { Debug.Assert(typeArgCount == 0 || typeArgEmitter != null); // type args: if (typeArgCount > 0) { scriptContextPlace.EmitLoad(il); il.Emit(OpCodes.Ldfld, Fields.ScriptContext_Stack); il.EmitOverloadedArgs(Types.DTypeDesc[0], typeArgCount, Methods.PhpStack.AddTypeFrame.ExplicitOverloads, typeArgEmitter); } // args: scriptContextPlace.EmitLoad(il); il.Emit(OpCodes.Ldfld, Fields.ScriptContext_Stack); il.EmitOverloadedArgs(Types.Object[0], argCount, Methods.PhpStack.AddFrame.ExplicitOverloads, argEmitter); il.Emit(OpCodes.Call, Methods.PhpStack.AddFrame.Overload(argCount)); // AddFrame adds empty type frame by default, so if there are no type parameters, we can skip AddTypeFrame call: if (typeArgCount > 0) { il.Emit(OpCodes.Call, Methods.PhpStack.AddTypeFrame.Overload(typeArgCount)); } }
/// <summary> /// Emits <see cref="Operators.GetObjectProperty"/> or <see cref="Operators.GetObjectPropertyRef"/> /// on a specified argument variable. /// </summary> private PhpTypeCode EmitGetFieldOfPlace(T /*!*/ node, IPlace /*!*/ arg, CodeGenerator /*!*/ codeGenerator, bool wantRef) { //ILEmitter il = codeGenerator.IL; //arg.EmitLoad(il); //EmitName(codeGenerator); //codeGenerator.EmitLoadClassContext(); //if (wantRef) //{ // il.Emit(OpCodes.Call, Methods.Operators.GetObjectPropertyRef); // return PhpTypeCode.PhpReference; //} //else //{ // il.LoadBool(codeGenerator.ChainBuilder.QuietRead); // il.Emit(OpCodes.Call, Methods.Operators.GetObjectProperty); // return PhpTypeCode.Object; //} string fieldName = (node is DirectVarUse) ? (node as DirectVarUse).VarName.Value : null; Expression fieldNameExpr = (node is IndirectVarUse) ? (node as IndirectVarUse).VarNameEx : null; bool quietRead = wantRef ? false : codeGenerator.ChainBuilder.QuietRead; return(codeGenerator.CallSitesBuilder.EmitGetProperty( codeGenerator, wantRef, null, arg, null, null, fieldName, fieldNameExpr, quietRead)); }
public Arc(int id,IPlace place, ITransition transition) : base(id,place,transition) { this.place=place; this.transition=transition; this.isInputArc=true; }
internal override void EmitInit(CodeGenerator cg) { if (cg.HasUnoptimizedLocals) { return; } // declare variable in global scope var il = cg.Builder; var def = il.LocalSlotManager.DeclareLocal( (Cci.ITypeReference)_symbol.Type, _symbol as ILocalSymbolInternal, this.Name, SynthesizedLocalKind.UserDefined, LocalDebugId.None, 0, LocalSlotConstraints.None, false, default(ImmutableArray<TypedConstant>), false); _place = new LocalPlace(def); il.AddLocalToScope(def); // if (_symbol is SynthesizedLocalSymbol) return; // Initialize local variable with void. // This is mandatory since even assignments reads the target value to assign properly to PhpAlias. // TODO: Once analysis tells us, the target cannot be alias, this step won't be necessary. // TODO: only if the local will be used uninitialized cg.EmitInitializePlace(_place); }
public void OnPlaceSelected(IPlace place) { if (mMap != null) { mMap.Clear(); MarkerOptions markerOpt1 = new MarkerOptions(); markerOpt1.SetPosition(new LatLng(place.LatLng.Latitude, place.LatLng.Longitude)); markerOpt1.SetTitle("Vimy Ridge"); mMap.AddMarker(markerOpt1); LatLng location = new LatLng(place.LatLng.Latitude, place.LatLng.Longitude); CameraPosition.Builder builder = CameraPosition.InvokeBuilder(); builder.Target(location); builder.Zoom(19); //builder.Bearing(155); //builder.Tilt(65); CameraPosition cameraPosition = builder.Build(); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); mMap.MoveCamera(cameraUpdate); } else { return; } }
public BagService(IPlace place, IAnimalSupplierStrategy animalSupplierStrategy) { isDay = true; _place = place; _animalSupplierStrategy = animalSupplierStrategy; }
static void Main(string[] args) { FlatFromInterface flat = new FlatFromInterface(); IBuilding building = flat; IPlace place = flat; Console.ReadLine(); }
public ClrStubBuilder(ILEmitter/*!*/ il, IPlace/*!*/ scriptContextPlace, int paramCount, int paramOffset) { this.il = il; this.scriptContextPlace = scriptContextPlace; this.paramOffset = paramOffset; this.referenceLocals = new LocalBuilder[paramCount]; }
public Arc(int id, ITransition transition, IPlace place) : base(id, transition, place) { this.annotation = new IdentityExpression(); this.place = place; this.transition = transition; this.isInputArc = false; }
/// <summary> /// Creates local bound to a place. /// </summary> internal static BoundLocal CreateFromPlace(IPlace place) { Contract.ThrowIfNull(place); return(new BoundLocal(null) { _place = place }); }
public IArc <Token> AddArc(ITransition <Token> transition, IPlace <Token> place) { IArc <Token> arc = new Arc <Token>(transition, place); this.arcs.Add(arc); this.graph.AddEdge(arc); return(arc); }
public bool CanSourceCopy(IPlace destination) { if (ExplicitlyNotAllowed.Contains(destination)) { return(false); } return(CanSourceACopy); }
/// <summary> /// Copy ctor with different routine content (and TypeRefContext). /// Used for emitting in a context of a different routine (parameter initializer). /// </summary> public CodeGenerator(CodeGenerator cg, SourceRoutineSymbol routine) : this(cg._il, cg._moduleBuilder, cg._diagnostics, cg._optimizations, cg._emitPdbSequencePoints, routine.ContainingType, cg.ContextPlaceOpt, cg.ThisPlaceOpt, routine) { Contract.ThrowIfNull(routine); _emmittedTag = cg._emmittedTag; _localsPlaceOpt = cg._localsPlaceOpt; }
/// <inheritdoc /> public IArc <TToken> AddArc(IPlace <TToken> place, ITransition <TToken> transition) { IArc <TToken> arc = new Arc <TToken>(place, transition); _arcs.Add(arc); _graph.AddEdge(arc); return(arc); }
public void OnPlaceSelected(IPlace place) { IPlace lugar = place; direccion = place.AddressFormatted.ToString(); latitud = place.LatLng.Latitude; longitud = place.LatLng.Longitude; }
public PropertyPlace(IPlace holder, Cci.IPropertyDefinition property, Emit.PEModuleBuilder module = null) { Contract.ThrowIfNull(property); _holder = holder; _property = (PropertySymbol)property; _module = module; }
public IArc AddArc(ITransition transition, IPlace place) { IArc arc = new Arc(version++, transition, place); this.arcs.Add(arc); this.graph.AddEdge(transition, place); return(arc); }
public HotelController(IPlace place, IAddress address, IDetail detail, IGallery gallery, ICategory category) { _gallery = gallery; _address = address; _place = place; _detail = detail; _category = category; }
public FieldPlace(IPlace holder, IFieldSymbol field, Emit.PEModuleBuilder module = null) : base(field, module) { _holder = holder; Debug.Assert(holder != null || field.IsStatic, "receiver not set"); Debug.Assert(holder == null || holder.Type.IsOfType(_field.ContainingType) || _field.ContainingType.IsValueType, $"receiver of type {holder?.Type} mismatches the field's containing type {_field?.ContainingType}"); }
private void overview_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(constellation)) { IPlace target = Constellations.ConstellationCentroids[Constellations.Abbreviation(constellation)]; Earth3d.MainWindow.GotoTarget(target, false, false, true); } }
public PersonalInfo(string name, string surname, Gender gender, DateTime dateOfBirth, IPlace placeOfBirth) { Name = name; Surname = surname; Gender = gender; DateOfBirth = dateOfBirth; PlaceOfBirth = placeOfBirth; }
private void GetPlaceFromPicker(Intent data) { IPlace placePicked = PlacePicker.GetPlace(Activity, data); var locationText = view.FindViewById <TextView>(Resource.Id.locationText); locationText.Text = String.Format("Location:({0},{1})", placePicked.LatLng.Latitude, placePicked.LatLng.Longitude); coords = new GeoCoords(placePicked.LatLng.Latitude, placePicked.LatLng.Longitude); }
public ClrStubBuilder(ILEmitter /*!*/ il, IPlace /*!*/ scriptContextPlace, int paramCount, int paramOffset) { this.il = il; this.scriptContextPlace = scriptContextPlace; this.paramOffset = paramOffset; this.referenceLocals = new LocalBuilder[paramCount]; }
public Location(int x, int y, IPlace o) { X = x; Y = y; Block = o; Visible = false; Script = null; symbol = Block.Symbol(); }
public LegoStoragePlace(IStoragePlace above, IStoragePlace underneath, IPlace placeInFront, int level) { Above = above; Underneath = underneath; PlaceInFront = placeInFront; Empty = true; Container = null; Level = level; }
/// <summary> /// Start a copy pushing data to a particular destination. /// </summary> /// <param name="destination"></param> /// <param name="uris"></param> public async Task CopyToAsync(IPlace destination, Uri[] uris, Action <string> statusUpdate = null, Func <bool> failNow = null, int timeoutMinutes = 60) { // Make sure we have something we can deal with. var scpTarget = destination as ISCPTarget; if (scpTarget == null) { throw new ArgumentException($"Place {destination.Name} is not an SCP target."); } // Do things one dataset at a time. foreach (var fsGroup in uris.GroupBy(u => u.DataSetName())) { // Get the remote user, path, and password. var remoteUser = scpTarget.SCPUser; var remoteMachine = scpTarget.SCPMachineName; var passwd = GetPasswordForHost(remoteMachine, remoteUser); // Get the catalog over await destination.CopyDataSetInfoAsync(fsGroup.Key, await DataSetManager.ListOfFilenamesInDatasetAsync(fsGroup.Key, statusUpdate, failNow, probabalLocation: this), statusUpdate, failNow); // The file path where we will store it all var destLocation = await scpTarget.GetPathToCopyFilesAsync(fsGroup.Key); // Next, queue up the copies, one at a time. Move to a part file and then do a rename. foreach (var f in fsGroup) { if (failNow.PCall(false)) { break; } var localFilePath = await GetSCPFilePathAsync(f); var fname = f.DataSetFileName(); var pname = $"{fname}.part"; statusUpdate.PCall($"Copying file {fname}: {Name} -> {destination.Name}"); await _connection.ApplyAsync(async c => { await c.Value.ExecuteLinuxCommandAsync($"scp {localFilePath} {remoteUser}@{remoteMachine}:{destLocation}/{pname}", seeAndRespond: new Dictionary <string, string>() { { "password:"******"ssh {remoteUser}@{remoteMachine} mv {destLocation}/{pname} {destLocation}/{fname}", seeAndRespond: new Dictionary <string, string>() { { "password:", passwd } }, secondsTimeout: 5 * 60, refreshTimeout: true, failNow: failNow); }); } } }
public LegoStoragePlace(IPlace placeInFront, IContainer container) { Above = LegoStoragePlace.None; Underneath = LegoStoragePlace.None; PlaceInFront = placeInFront; Empty = false; Container = container; Level = 1; }
public LegoStoragePlace(IStoragePlace above, IStoragePlace underneath, IPlace placeInFront, IContainer container, int level) { Above = above; Underneath = underneath; PlaceInFront = placeInFront; Empty = false; Container = container; Level = level; }
public LegoStoragePlace(IPlace placeInFront) { Above = LegoStoragePlace.None; Underneath = LegoStoragePlace.None; PlaceInFront = placeInFront; Empty = true; Container = null; Level = 1; }
/// <summary> /// Creates a new instance of <see cref="OverloadsBuilder"/>. /// </summary> /// <param name="debug"> /// Whether the emitted code is to be debuggable. /// </param> /// <param name="stack"> /// Place where the <see cref="PhpStack"/> instance can be loaded from. /// </param> /// <param name="loadValueParam"> /// Delegate called when value parameter is to be loaded on evaluation stack. /// The target method should guarantee that a value is loaded on evaluation stack. /// </param> /// <param name="loadReferenceParam"> /// Delegate called when PHP reference parameter is to be loaded on evaluation stack. /// The target method should guarantee that the object reference of type <see cref="PhpReference"/> /// is loaded on the evaluation stack. This object reference should not be a <B>null</B>. /// </param> /// <param name="loadOptParams"> /// Delegate called when an array of optional arguments is to be loaded on evaluation stack. /// The target method should load that array on the evaluation stack. /// </param> public OverloadsBuilder(bool debug, IPlace stack, ParameterLoader loadValueParam, ParameterLoader loadReferenceParam, ParametersLoader loadOptParams) { this.loadValueParam = loadValueParam; this.loadReferenceParam = loadReferenceParam; this.loadOptParams = loadOptParams; this.stack = stack; this.debug = debug; }
private void resultsListbox_MouseDoubleClick(object sender, MouseEventArgs e) { if (resultsListbox.SelectedIndex > -1) { Result = (IPlace)resultsListbox.SelectedItem; DialogResult = DialogResult.OK; Close(); } }
public static void EmitArgFullPostCall(ILEmitter/*!*/ il, IPlace/*!*/ stack, LocalBuilder locArgsCount) { // args-aware: if (locArgsCount != null) { // CALL stack.RemoveArgsAwareFrame(count); stack.EmitLoad(il); il.Ldloc(locArgsCount); il.Emit(OpCodes.Call, Methods.PhpStack.RemoveArgsAwareFrame); } }
public LinqBuilder(CodeGenerator/*!*/ cg) { this.cg = cg; IPlace this_place = new IndexedPlace(PlaceHolder.Argument, 0); this.rtVariablesPlace = new Place(this_place, Fields.LinqContext_variables); this.scriptContextPlace = new Place(this_place, Fields.LinqContext_context); this.classContextPlace = new Place(this_place, Fields.LinqContext_typeHandle); this.selfPlace = new Place(this_place, Fields.LinqContext_outerType); }
public void AddPlace(IPlace place) { if (place == null) { throw new ArgumentNullException("The place connot be null."); } if (this.CheckExistingElement(place.Name)) { throw new AlreadyExistingElementException("This name already exists."); } this.places.Add(place); }
public double Execute(ICar car, IPlace place, double journeyDuration) { ITrafficLight trafficLight = (ITrafficLight)place; double timetaken = 0; double waitingTime = trafficLight.GetWaitingTime(journeyDuration); if (waitingTime > 0) { timetaken += car.Stop(); timetaken += waitingTime; timetaken += car.Start(); } return timetaken; }
public IPresenter GetPresenter(IPlace place) { if (place is Empty.EmptyPlace) { return new Empty.EmptyPresenter((Empty.EmptyPlace)place, services); } else if (place is Test.TestPlace) { return new Test.TestPresenter((Test.TestPlace)place, services); } else { throw new ArgumentException(); } }
private void OK_Click(object sender, EventArgs e) { if (searchMode) { RunSearch(); } else { if (resultsListbox.SelectedIndex > -1) { Result = (IPlace)resultsListbox.SelectedItem; DialogResult = DialogResult.OK; Close(); } } }
public static void AddParts(string key, IPlace place) { key = key.ToLower(); autoCompleteList.Add(key, place); var parts = key.Split(new[] { ' ' }); if (parts.Length > 1) { foreach (var part in parts) { if (!string.IsNullOrEmpty(part)) { autoCompleteList.Add(part, place); } } } }
internal void AddFigurePoint(IPlace place) { TreeNode parent; var pnt = new Linepoint(place.RA * 15 - 180, place.Dec, PointType.Line, place.Name != Language.GetLocalizedText(90, "No Object") ? place.Name : null); if (figureTree.SelectedNode.Tag is Linepoint) { parent = figureTree.SelectedNode.Parent; var ls = (Lineset)parent.Tag; var lp = (Linepoint)figureTree.SelectedNode.Tag; var index = ls.Points.FindIndex(delegate(Linepoint target) { return target == lp; }) + 1; ls.Points.Insert(index, pnt); TreeNode child; if (index >= parent.Nodes.Count) { child = parent.Nodes.Add(pnt.ToString()); } else { child = parent.Nodes.Insert(index, pnt.ToString()); } child.Tag = pnt; child.Checked = pnt.PointType != PointType.Move; figureTree.SelectedNode = child; Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name); } else { parent = figureTree.SelectedNode; var ls = (Lineset)figureTree.SelectedNode.Tag; ls.Points.Add( pnt); var child = parent.Nodes.Add( pnt.ToString()); child.Tag = pnt; child.Checked = pnt.PointType != PointType.Move; figureTree.SelectedNode = child; Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name); } }
public static void EmitArgFullPreCall(ILEmitter/*!*/ il, IPlace/*!*/ stack, bool argsAware, int formalParamCount, int formalTypeParamCount, out LocalBuilder locArgsCount) { if (argsAware) { locArgsCount = il.DeclareLocal(typeof(int)); // locArgsCount = stack.MakeArgsAware(<formal tpye param count | formal param count>); stack.EmitLoad(il); il.LdcI4((formalTypeParamCount << 16) | formalParamCount); il.Emit(OpCodes.Call, Methods.PhpStack.MakeArgsAware); il.Stloc(locArgsCount); } else { locArgsCount = null; // CALL stack.RemoveFrame(); stack.EmitLoad(il); il.Emit(OpCodes.Call, Methods.PhpStack.RemoveFrame); } }
private IDrivingStrategy SelectDrivingStrategy(IPlace place) { IDrivingStrategy drivingStrategy = null; if (place is IRoadStretch) { if (_roadDrivingStrategy == null) { _roadDrivingStrategy = new RoadDrivingStrategy(); } drivingStrategy = _roadDrivingStrategy; } else if (place is ITrafficLight) { if (_traficLightDrivingStrategy == null) { _traficLightDrivingStrategy = new TrafficLightDrivingStrategy(); } drivingStrategy = _traficLightDrivingStrategy; } return drivingStrategy; }
public TweetObj(string text, string creatorName, string screenName, DateTime time, ICoordinates coords, IPlace place, List<IHashtagEntity> hashtags) { this.text = text; if (creatorName == ""){ this.creatorName = " "; } else { this.creatorName = creatorName; } if (screenName == "") { this.screenName = " "; } else { this.screenName = screenName; } this.time = time; if (coords != null) { this.coords = coords; } else { this.coords = new Coordinates(0.0,0.0); } if (place != null) { this.country = place.Country; } else{ country = " "; } this.hashtags = new List<String>(); for (int i= 0; i < hashtags.Count; i++) { this.hashtags.Add(hashtags[i].Text); } }
/// <summary> /// Loads a value from a specified place on the evaluation stack and boxes it if it is of a value type. /// </summary> /// <param name="place">The place where to load a value from.</param> public void LoadBoxed(IPlace/*!*/ place) { Type type = place.PlaceType; place.EmitLoad(this); if (type.IsValueType) il.Emit(OpCodes.Box, type); }
/// <summary> /// Get the expression if given place represents ExpressionPlace. /// </summary> /// <param name="place"></param> /// <returns></returns> public static Expression GetExpression(IPlace place) { if (place != null && place.GetType() == typeof(ExpressionPlace)) return ((ExpressionPlace)place).expression; else return null; }
public static void AddPlaceToContextSearch(IPlace place) { if (place.Classification == Classification.Constellation) { var constellationID = Constellations.Abbreviation(place.Name); place.Constellation = constellationID; constellationObjects["Constellations"].Add(place); } else if (place.Classification == Classification.SolarSystem) { var constellationID = Constellations.Containment.FindConstellationForPoint(place.RA, place.Dec); place.Constellation = constellationID; if (constellationObjects["SolarSystem"].Find(target => place.Name == target.Name) == null) { constellationObjects["SolarSystem"].Add(place); } } else { string constellationID; if (place.Type == ImageSetType.Planet) { constellationID = place.Target == SolarSystemObjects.Undefined ? "Mars" : place.Target.ToString(); } else if (place.Type == ImageSetType.Earth) { constellationID = "Earth"; } else { constellationID = Constellations.Containment.FindConstellationForPoint(place.RA, place.Dec); } if (constellationID != "Error") { place.Constellation = constellationID; if (constellationObjects.ContainsKey(constellationID)) { constellationObjects[constellationID].Add(place); } } } }
public static string ToJSON(IPlace place) { var sb = new StringBuilder(); sb.Append(" {"); var names = ""; var delim = ""; foreach (var name in place.Names) { names += delim; names += name; delim = ";"; } sb.Append(string.Format("{0}:\"{1}\"{2}", "n", names.Replace("\"", "'"), ",")); sb.Append(string.Format("{0}:{1:###.####}{2}", "r", place.RA, ",")); sb.Append(string.Format("{0}:{1:###.####}{2}", "d", place.Dec, ",")); sb.Append(string.Format("{0}:{1}{2}", "c", (int)place.Classification, ",")); sb.Append(string.Format("{0}:{1:0.#}{2}", "m", place.Magnitude, ",")); sb.Append(string.Format("{0}:{1:###.#####}{2}", "z", place.ZoomLevel, ",")); if (place.StudyImageset != null) { sb.Append(string.Format("{0}:{1}{2}", "fgi", ToJSON(place.StudyImageset), ",")); } if (place.BackgroundImageSet != null) { sb.Append(string.Format("{0}:{1}{2}", "bgi", ToJSON(place.BackgroundImageSet), ",")); } sb.Append(string.Format("{0}:{1}{2}", "i", (int)place.Type, "")); sb.Append("}"); return sb.ToString(); }
public override IPlace FindClosest(Coordinates target, float distance, IPlace closestPlace, bool astronomical) { return base.FindClosest(target, distance, closestPlace, astronomical); }
private void Prepare(int maxArgCount, int maxValArgCount, int maxRefArgCount) { Debug.Assert(maxValArgCount + maxRefArgCount >= maxArgCount); this.noSuitableOverloadErrorLabel = il.DefineLabel(); this.scriptContext = new Place(stack, Fields.PhpStack_Context); this.returnLabel = il.DefineLabel(); // locals: this.valLocals = new LocalBuilder[maxValArgCount]; for (int i = 0; i < valLocals.Length; i++) valLocals[i] = il.DeclareLocal(Types.Object[0]); this.refLocals = new LocalBuilder[maxRefArgCount]; for (int i = 0; i < refLocals.Length; i++) refLocals[i] = il.DeclareLocal(Types.PhpReference[0]); this.returnValue = il.DeclareLocal(Types.Object[0]); this.strictness = il.DeclareLocal(typeof(ConversionStrictness)); }