public JsonLocation GetEmptyJsonLocation() { var result = new JsonLocation(); var emptyProp = new JsonPropertyData(); result.CustomPropertyData.Add(emptyProp); return(result); }
/// <summary> /// /// </summary> /// <param name="reader"></param> public JsonReader(TextReader reader) { this.reader = reader; this.val = null; this.token = JsonToken.Null; this.location = JsonLocation.Normal; this.lastLocations = new Stack(); this.needProp = false; }
public void TestJsonLocationToJsonPointer() { JsonLocationNode node1 = JsonLocationNode.Root; JsonLocationNode node2 = new JsonLocationNode(node1, "a/b"); JsonLocation path = new JsonLocation(node2); Assert.IsTrue(path.ToJsonPointer().Equals(@"/a~1b")); }
public string Post(JsonLocation jsonLocation) { try { LocationDAO.InitializeInsertLocation(jsonLocation); } catch (Exception ex) { } return("Location"); }
public void TestJsonLocationWithSolidusToString() { JsonLocationNode node1 = JsonLocationNode.Root; JsonLocationNode node2 = new JsonLocationNode(node1, "foo's"); JsonLocationNode node3 = new JsonLocationNode(node2, "bar"); JsonLocationNode node4 = new JsonLocationNode(node3, 0); JsonLocation path = new JsonLocation(node4); Assert.IsTrue(path.ToString().Equals(@"$['foo\'s']['bar'][0]")); }
/* * 計算したGapによって渡された座標の平行移動・回転を行う */ public JsonLocation transformingCordinatesByGap(JsonLocation loc) { if (cordinateGap != null) { JsonLocation newLoc = new JsonLocation(0.0, 0.0); newLoc.x = loc.x * Math.Cos(cordinateGap.gapAngle) - loc.y * Math.Sin(cordinateGap.gapAngle); newLoc.y = loc.y * Math.Sin(cordinateGap.gapAngle) + loc.y * Math.Cos(cordinateGap.gapAngle); newLoc.x = newLoc.x + cordinateGap.gapX; newLoc.y = newLoc.y + cordinateGap.gapY; return(newLoc); } return(null); }
public JsonLocation Update(JsonLocation updatedLocation) { var key = updatedLocation.Key; var entity = updatedLocation.ConvertToLocation(); Repositories.LocationRepo.Update(entity); var result = Repositories.LocationRepo.GetByKey(key); ////uLocate.Helpers.Persistence.UpdateLocation(); return(new JsonLocation(result)); }
public static void InitializeInsertLocation(JsonLocation jsonLocation) { Models.Location location = new Models.Location() { Latitude = jsonLocation.Latitude, Longitude = jsonLocation.Longitude, Bairro = jsonLocation.Bairro, Cidade = jsonLocation.Cidade, Estado = jsonLocation.Estado, Pais = jsonLocation.Pais, Rua = jsonLocation.Rua }; InsertLocation(location); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static Object readJson(String json) throws JsonParseException public static object ReadJson(string json) { try { return(ObjectMapper.readValue(json, typeof(object))); } catch (org.codehaus.jackson.JsonParseException e) { string message = e.Message.Split("\\r?\\n")[0]; JsonLocation location = e.Location; throw new JsonParseException(string.Format("{0} [line: {1:D}, column: {2:D}]", message, location.LineNr, location.ColumnNr), e); } catch (IOException e) { throw new JsonParseException(e); } }
public void TestJsonLocationEquals() { JsonLocationNode node1 = JsonLocationNode.Root; JsonLocationNode node2 = new JsonLocationNode(node1, "foo"); JsonLocationNode node3 = new JsonLocationNode(node2, "bar"); JsonLocationNode node4 = new JsonLocationNode(node3, 0); JsonLocationNode node11 = JsonLocationNode.Root; JsonLocationNode node12 = new JsonLocationNode(node11, "foo"); JsonLocationNode node13 = new JsonLocationNode(node12, "bar"); JsonLocationNode node14 = new JsonLocationNode(node13, 0); JsonLocation path1 = new JsonLocation(node4); JsonLocation path2 = new JsonLocation(node14); Assert.IsTrue(path1.Equals(path2)); }
/// <summary> /// /// </summary> /// <returns></returns> public bool Read() { int chr = this.reader.Read(); if (chr != -1) { switch ((char)chr) { case '[': this.lastLocations.Push(this.location); this.location = JsonLocation.InArray; this.token = JsonToken.StartArray; this.val = null; this.ReadAway(); return(true); case ']': this.location = (JsonLocation)this.lastLocations.Pop(); this.token = JsonToken.EndArray; this.val = null; this.ReadAway(); if (this.location == JsonLocation.InObject) { this.needProp = true; } return(true); case '{': this.lastLocations.Push(this.location); this.location = JsonLocation.InObject; this.needProp = true; this.token = JsonToken.StartObject; this.val = null; this.ReadAway(); return(true); case '}': this.location = (JsonLocation)this.lastLocations.Pop(); this.token = JsonToken.EndObject; this.val = null; this.ReadAway(); if (this.location == JsonLocation.InObject) { this.needProp = true; } return(true); // String case '"': case '\'': return(this.ReadString((char)chr)); // Null case 'n': return(this.ReadNull()); // Bool case 't': case 'f': return(this.ReadBool((char)chr)); default: // Is number if (Char.IsNumber((char)chr) || (char)chr == '-' || (char)chr == '.') { return(this.ReadNumber((char)chr)); } return(true); } } return(false); }
/// <summary> /// /// </summary> /// <returns></returns> public bool Read() { int chr = this.reader.Read(); if (chr != -1) { switch ((char) chr) { case '[': this.lastLocations.Push(this.location); this.location = JsonLocation.InArray; this.token = JsonToken.StartArray; this.val = null; this.ReadAway(); return true; case ']': this.location = (JsonLocation)this.lastLocations.Pop(); this.token = JsonToken.EndArray; this.val = null; this.ReadAway(); if (this.location == JsonLocation.InObject) this.needProp = true; return true; case '{': this.lastLocations.Push(this.location); this.location = JsonLocation.InObject; this.needProp = true; this.token = JsonToken.StartObject; this.val = null; this.ReadAway(); return true; case '}': this.location = (JsonLocation) this.lastLocations.Pop(); this.token = JsonToken.EndObject; this.val = null; this.ReadAway(); if (this.location == JsonLocation.InObject) this.needProp = true; return true; // String case '"': case '\'': return this.ReadString((char) chr); // Null case 'n': return this.ReadNull(); // Bool case 't': case 'f': return this.ReadBool((char) chr); default: // Is number if (Char.IsNumber((char) chr) || (char) chr == '-' || (char) chr == '.') return this.ReadNumber((char) chr); return true; } } return false; }
public JsonTimeAndPositionLog(JsonLocation l, JsonTime t) { location = l; time = t; }
public JsonTimeAndPositionLog(double x, double y) { location = new JsonLocation(x, y); time = new JsonTime(); time.mTime = DateTime.Now.TimeOfDay; }
public JsonSelfLocation(double r, JsonLocation jl) { rotation = r; location = jl; }