Skip to content

Commit 454a0aa

Browse files
author
Scott Murray
committed
Added XML.getIntContent() and getFloatContent() reference, plus related links
1 parent d1aa51e commit 454a0aa

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

core/src/processing/data/XML.java

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ public boolean hasAttribute(String name) {
661661

662662
/**
663663
* @webref xml:method
664-
* @brief Gets the content of an element as a String
664+
* @brief Gets the content of an attribute as a String
665665
*/
666666
public String getString(String name) {
667667
return getString(name, null);
@@ -676,7 +676,7 @@ public String getString(String name, String defaultValue) {
676676

677677
/**
678678
* @webref xml:method
679-
* @brief Sets the content of an element as a String
679+
* @brief Sets the content of an attribute as a String
680680
*/
681681
public void setString(String name, String value) {
682682
((Element) node).setAttribute(name, value);
@@ -685,7 +685,7 @@ public void setString(String name, String value) {
685685

686686
/**
687687
* @webref xml:method
688-
* @brief Gets the content of an element as an int
688+
* @brief Gets the content of an attribute as an int
689689
*/
690690
public int getInt(String name) {
691691
return getInt(name, 0);
@@ -694,7 +694,7 @@ public int getInt(String name) {
694694

695695
/**
696696
* @webref xml:method
697-
* @brief Sets the content of an element as an int
697+
* @brief Sets the content of an attribute as an int
698698
*/
699699
public void setInt(String name, int value) {
700700
setString(name, String.valueOf(value));
@@ -704,9 +704,9 @@ public void setInt(String name, int value) {
704704
/**
705705
* Returns the value of an attribute.
706706
*
707-
* @param name the non-null full name of the attribute.
708-
* @param defaultValue the default value of the attribute.
709-
* @return the value, or defaultValue if the attribute does not exist.
707+
* @param name the non-null full name of the attribute
708+
* @param defaultValue the default value of the attribute
709+
* @return the value, or defaultValue if the attribute does not exist
710710
*/
711711
public int getInt(String name, int defaultValue) {
712712
String value = getString(name);
@@ -740,7 +740,7 @@ public long getLong(String name, long defaultValue) {
740740
* Returns the value of an attribute, or zero if not present.
741741
*
742742
* @webref xml:method
743-
* @brief Gets the content of an element as a float
743+
* @brief Gets the content of an attribute as a float
744744
*/
745745
public float getFloat(String name) {
746746
return getFloat(name, 0);
@@ -762,7 +762,7 @@ public float getFloat(String name, float defaultValue) {
762762

763763
/**
764764
* @webref xml:method
765-
* @brief Sets the content of an element as a float
765+
* @brief Sets the content of an attribute as a float
766766
*/
767767
public void setFloat(String name, float value) {
768768
setString(name, String.valueOf(value));
@@ -777,9 +777,9 @@ public double getDouble(String name) {
777777
/**
778778
* Returns the value of an attribute.
779779
*
780-
* @param name the non-null full name of the attribute.
781-
* @param defaultValue the default value of the attribute.
782-
* @return the value, or defaultValue if the attribute does not exist.
780+
* @param name the non-null full name of the attribute
781+
* @param defaultValue the default value of the attribute
782+
* @return the value, or defaultValue if the attribute does not exist
783783
*/
784784
public double getDouble(String name, double defaultValue) {
785785
String value = getString(name);
@@ -801,27 +801,49 @@ public void setDouble(String name, double value) {
801801
* @webref xml:method
802802
* @brief Gets the content of an element
803803
* @return the content.
804+
* @see XML#getIntContent()
805+
* @see XML#getFloatContent()
804806
*/
805807
public String getContent() {
806808
return node.getTextContent();
807809
}
808810

809811

812+
/**
813+
* @webref xml:method
814+
* @brief Gets the content of an element as an int
815+
* @return the content.
816+
* @see XML#getContent()
817+
* @see XML#getFloatContent()
818+
*/
810819
public int getIntContent() {
811820
return getIntContent(0);
812821
}
813822

814823

824+
/**
825+
* @param defaultValue the default value of the attribute
826+
*/
815827
public int getIntContent(int defaultValue) {
816828
return PApplet.parseInt(node.getTextContent(), defaultValue);
817829
}
818830

819831

832+
/**
833+
* @webref xml:method
834+
* @brief Gets the content of an element as a float
835+
* @return the content.
836+
* @see XML#getContent()
837+
* @see XML#getIntContent()
838+
*/
820839
public float getFloatContent() {
821840
return getFloatContent(0);
822841
}
823842

824843

844+
/**
845+
* @param defaultValue the default value of the attribute
846+
*/
825847
public float getFloatContent(float defaultValue) {
826848
return PApplet.parseFloat(node.getTextContent(), defaultValue);
827849
}

0 commit comments

Comments
 (0)