Skip to content

Commit

Permalink
APIs for adding to, removing from, and clearing xray type string
Browse files Browse the repository at this point in the history
  • Loading branch information
slogan621 committed Oct 22, 2020
1 parent 32f661d commit 9d07ddc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app/src/main/java/org/thousandsmiles/tscharts_lib/XRay.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,40 @@ public String getType() {
return m_type;
}

private boolean validateType(String type) {
return type.equals(XRAY_TYPE_NONE) || type.equals(XRAY_TYPE_FULL) ||
type.equals(XRAY_TYPE_ANTERIORS_BITEWINGS) || type.equals(XRAY_TYPE_PANORAMIC_VIEW) ||
type.equals(XRAY_TYPE_CEPHATOMETRIC);
}

public void ClearType() {
this.m_type = XRAY_TYPE_NONE;
}

// if m_type is "fb" and this function is called with "p", m_type will become "fbp"

public boolean AddType(String type) {
boolean ret = true;
if (validateType(type) == false) {
ret = false;
} else if (m_type.contains(type) == false) {
this.m_type += type;
}
return ret;
}

// if m_type is "fbp" and this function is called with "p", m_type will become "fb"

public boolean RemoveType(String type) {
boolean ret = true;
if (validateType(type) == false) {
ret = false;
} else if (m_type.contains(type) == true) {
this.m_type.replace(type, "");
}
return ret;
}

public void setType(String type) {
this.m_type = type;
}
Expand Down

0 comments on commit 9d07ddc

Please sign in to comment.