Skip to content

Commit

Permalink
Merge branch 'develop' into open-ode
Browse files Browse the repository at this point in the history
  • Loading branch information
hmusavi committed Dec 8, 2018
2 parents d2489a5 + 4c590c4 commit 3614c76
Show file tree
Hide file tree
Showing 16 changed files with 337 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public class FullPositionVectorBuilder {
private static final long LAT_UPPER_BOUND = 900000001;
private static final long ELEV_LOWER_BOUND = -4096;
private static final long ELEV_UPPER_BOUND = 61439;
private static final long TIME_CONF_LOWER_BOUND = 0;
private static final long TIME_CONF_UPPER_BOUND = 39;

private FullPositionVectorBuilder() {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import us.dot.its.jpo.ode.plugin.j2735.J2735ObstacleDetection;
import us.dot.its.jpo.ode.plugin.j2735.J2735VertEvent;
import us.dot.its.jpo.ode.plugin.j2735.builders.GNSSstatusBuilder.GNSstatusNames;

public class ObstacleDetectionBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@

public class TravelerMessageFromHumanToAsnConverter {

public static final String GEOGRAPHICAL_PATH_STRING = "GeographicalPath";

public static final String REGIONS_STRING = "regions";

public static final String TRAVELER_DATA_FRAME_STRING = "TravelerDataFrame";

public static final String DATA_FRAMES_STRING = "dataFrames";

public static final String SEQUENCE_STRING = "SEQUENCE";
public static final String TCONTENT_STRING = "tcontent";

Expand Down Expand Up @@ -50,29 +58,29 @@ public static void convertTravelerInputDataToEncodableTim(JsonNode tid) throws J
// urlB is optional but does not need replacement

// dataFrames are required
timDataObjectNode.set("dataFrames", transformDataFrames(timDataObjectNode.get("dataframes")));
timDataObjectNode.set(DATA_FRAMES_STRING, transformDataFrames(timDataObjectNode.get("dataframes")));
timDataObjectNode.remove("dataframes");
}

public static JsonNode transformDataFrames(JsonNode dataFrames) throws JsonUtilsException {
public static ObjectNode transformDataFrames(JsonNode dataFrames) throws JsonUtilsException {

if (dataFrames == null) {
return JsonUtils.newNode();
}

ArrayNode replacedDataFrames = JsonUtils.newNode().arrayNode();

if (dataFrames.isArray()) {
Iterator<JsonNode> dataFramesIter = dataFrames.elements();

while (dataFramesIter.hasNext()) {
ObjectNode oldFrame = (ObjectNode) dataFramesIter.next();
replaceDataFrame(oldFrame);
// wrap each data frame inside a TravelerDataFrame
replacedDataFrames.add(oldFrame);
}
}

return replacedDataFrames;
return JsonUtils.newObjectNode(TRAVELER_DATA_FRAME_STRING, replacedDataFrames);
}

public static void replaceDataFrame(ObjectNode dataFrame) throws JsonUtilsException {
Expand Down Expand Up @@ -139,7 +147,7 @@ public static void replaceDataFrame(ObjectNode dataFrame) throws JsonUtilsExcept
replaceDataFrameTimestamp(dataFrame);

// replace the geographical path regions
dataFrame.set("regions", transformRegions(dataFrame.get("regions")));
dataFrame.set(REGIONS_STRING, transformRegions(dataFrame.get(REGIONS_STRING)));
// replace content
replaceContent(dataFrame);

Expand Down Expand Up @@ -331,7 +339,7 @@ public static void replaceMsgId(ObjectNode dataFrame) {
}
}

public static JsonNode transformRegions(JsonNode regions) throws JsonUtilsException {
public static ObjectNode transformRegions(JsonNode regions) throws JsonUtilsException {
ArrayNode replacedRegions = JsonUtils.newNode().arrayNode();

if (regions.isArray()) {
Expand All @@ -344,7 +352,7 @@ public static JsonNode transformRegions(JsonNode regions) throws JsonUtilsExcept
}
}

return replacedRegions;
return JsonUtils.newObjectNode(GEOGRAPHICAL_PATH_STRING, replacedRegions);
}

public static void replaceRegion(ObjectNode region) throws JsonUtilsException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
package us.dot.its.jpo.ode.plugin.j2735.timstorage;

import java.util.Arrays;

import com.fasterxml.jackson.annotation.JsonProperty;

import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;

public class Advisory extends Asn1Object {
private static final long serialVersionUID = 1L;
@JsonProperty("SEQUENCE")
private Sequence[] SEQUENCE;

public Sequence[] getSEQUENCE() {
return SEQUENCE;
}
public void setSEQUENCE(Sequence[] sEQUENCE) {
SEQUENCE = sEQUENCE;
}
private static final long serialVersionUID = 1L;
@JsonProperty("SEQUENCE")
private Items[] SEQUENCE;
public Items[] getSEQUENCE() {
return SEQUENCE;
}
public void setSEQUENCE(Items[] sEQUENCE) {
SEQUENCE = sEQUENCE;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(SEQUENCE);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Advisory other = (Advisory) obj;
if (!Arrays.equals(SEQUENCE, other.SEQUENCE))
return false;
return true;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package us.dot.its.jpo.ode.plugin.j2735.timstorage;

import java.util.Arrays;

import com.fasterxml.jackson.annotation.JsonProperty;

import us.dot.its.jpo.ode.model.OdeObject;

public class DataFrames extends OdeObject {

private static final long serialVersionUID = 1L;

@JsonProperty("TravelerDataFrame")
private TravelerDataFrame[] TravelerDataFrame;

public TravelerDataFrame[] getTravelerDataFrame() {
return TravelerDataFrame;
}

public void setTravelerDataFrame(TravelerDataFrame[] travelerDataFrame) {
TravelerDataFrame = travelerDataFrame;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(TravelerDataFrame);
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DataFrames other = (DataFrames) obj;
if (!Arrays.equals(TravelerDataFrame, other.TravelerDataFrame))
return false;
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,71 @@ public Anchor getAnchor() {
public void setAnchor(Anchor anchor) {
this.anchor = anchor;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((anchor == null) ? 0 : anchor.hashCode());
result = prime * result + ((closedPath == null) ? 0 : closedPath.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((direction == null) ? 0 : direction.hashCode());
result = prime * result + ((directionality == null) ? 0 : directionality.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((laneWidth == null) ? 0 : laneWidth.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GeographicalPath other = (GeographicalPath) obj;
if (anchor == null) {
if (other.anchor != null)
return false;
} else if (!anchor.equals(other.anchor))
return false;
if (closedPath == null) {
if (other.closedPath != null)
return false;
} else if (!closedPath.equals(other.closedPath))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (direction == null) {
if (other.direction != null)
return false;
} else if (!direction.equals(other.direction))
return false;
if (directionality == null) {
if (other.directionality != null)
return false;
} else if (!directionality.equals(other.directionality))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (laneWidth == null) {
if (other.laneWidth != null)
return false;
} else if (!laneWidth.equals(other.laneWidth))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,35 @@ public String getText() {
public void setText(String text) {
this.text = text;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((itis == null) ? 0 : itis.hashCode());
result = prime * result + ((text == null) ? 0 : text.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Item other = (Item) obj;
if (itis == null) {
if (other.itis != null)
return false;
} else if (!itis.equals(other.itis))
return false;
if (text == null) {
if (other.text != null)
return false;
} else if (!text.equals(other.text))
return false;
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package us.dot.its.jpo.ode.plugin.j2735.timstorage;

import com.fasterxml.jackson.annotation.JsonProperty;

import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;

public class Items extends Asn1Object {

private static final long serialVersionUID = 1L;

@JsonProperty("item")
private Item item;

public Item getItem() {
return item;
}

public void setItem(Item item) {
this.item = item;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((item == null) ? 0 : item.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Items other = (Items) obj;
if (item == null) {
if (other.item != null)
return false;
} else if (!item.equals(other.item))
return false;
return true;
}

}

This file was deleted.

Loading

0 comments on commit 3614c76

Please sign in to comment.