diff --git a/.komment/00000.json b/.komment/00000.json
new file mode 100644
index 0000000..9888c77
--- /dev/null
+++ b/.komment/00000.json
@@ -0,0 +1,10036 @@
+[
+ {
+ "name": "ExpandableListAdapter.java",
+ "path": "client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java",
+ "content": {
+ "structured": {
+ "description": "An expandable list adapter class that extends BaseExpandableListAdapter, providing functionality for displaying data in an expandable list format. The adapter takes a context, a list of header titles, and a map of child data as inputs. It allows users to retrieve and manipulate the child elements within each group in a hierarchical manner.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"android\"\n color=\"#33363A\"\n BaseExpandableListAdapter [label=\"android.widget.BaseExpandableListAdapter\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n Typeface [label=\"android.graphics.Typeface\", style=\"rounded,filled\"]\n TextView [label=\"android.widget.TextView\", style=\"rounded,filled\"]\n }\n subgraph cluster_3 {\n label=\"io/sensable\"\n color=\"#33363A\"\n R [label=\"io.sensable.client.R\", style=\"rounded,filled\"]\n SensableActivity []\n subgraph cluster_4 {\n label=\"client\"\n color=\"#33363A\"\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n ExpandableListAdapter [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n }\n subgraph cluster_5 {\n label=\"java\"\n color=\"#33363A\"\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n HashMap [label=\"java.util.HashMap\", style=\"rounded,filled\"]\n }\n ExpandableListAdapter -> View [dir=\"both\", penwidth=4]\n ExpandableListAdapter -> Context [style=\"dashed\"]\n ExpandableListAdapter -> HashMap [style=\"dashed\"]\n ExpandableListAdapter -> List [style=\"dashed\"]\n Context -> ExpandableListAdapter [penwidth=1]\n SensableActivity -> ExpandableListAdapter [style=\"dashed\"]\n ExpandableListAdapter -> Typeface [style=\"dashed\"]\n ViewGroup -> ExpandableListAdapter [penwidth=2]\n ExpandableListAdapter -> View [style=\"dashed\"]\n ExpandableListAdapter -> ViewGroup [style=\"dashed\"]\n ExpandableListAdapter -> LayoutInflater [style=\"dashed\"]\n ExpandableListAdapter -> TextView [style=\"dashed\"]\n ExpandableListAdapter -> BaseExpandableListAdapter [style=\"dashed\"]\n ExpandableListAdapter -> R [style=\"dashed\"]\n}\n",
+ "d2": "\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableActivity -> io.sensable.client.adapter.ExpandableListAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.graphics.Typeface: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.widget.BaseExpandableListAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> android.widget.TextView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> io.sensable.client.R: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> java.util.HashMap: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.adapter.ExpandableListAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.adapter.ExpandableListAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.R: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.graphics.Typeface: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.HashMap: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.TextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.BaseExpandableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "844a070d-d95f-179a-964b-35e576049bf1",
+ "ancestors": [],
+ "description": "Is designed to manage expandable lists in Android applications. It extends BaseExpandableListAdapter and provides functionality for displaying data in an expandable list format. The class retrieves child objects based on group positions, calculates the number of children per group, and inflates views for each item in the list.",
+ "name": "ExpandableListAdapter",
+ "location": {
+ "start": 22,
+ "insert": 15,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 14,
+ "end": 21
+ }
+ },
+ "item_type": "class",
+ "length": 286,
+ "docLength": 7
+ },
+ {
+ "id": "77525d54-52c6-3981-3b47-ee044472fbc0",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns an object at a specified position within a sublist associated with a group in a hierarchical list structure. The group is identified by its index, and the child position is determined relative to the sublist.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of the group or category for which to retrieve child elements, as specified by the `_listDataHeader` map.",
+ "complex_type": false
+ },
+ {
+ "name": "childPosititon",
+ "type_name": "int",
+ "description": "0-based index of the child item to retrieve within the list of child items associated with the specified `groupPosition`.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Object",
+ "description": "an object from a list of child data.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "int groupPosition = 0;\nint childPosititon = 1;\n\nObject child = (Object) getChild(groupPosition, childPosititon);\n",
+ "description": ""
+ },
+ "name": "getChild",
+ "location": {
+ "start": 66,
+ "insert": 36,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 35,
+ "end": 65
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 30
+ },
+ {
+ "id": "5f66d328-c16d-dca6-be4f-f8f305eb4113",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns a unique identifier for each child element at a given position within a group. The returned ID is based on the child's relative position within the group, with the first child receiving an ID of 0 and subsequent children incrementing accordingly.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of the group or parent element for which the `getChildId` method is called to retrieve the identifier of its child at the specified `childPosition`.",
+ "complex_type": false
+ },
+ {
+ "name": "childPosition",
+ "type_name": "int",
+ "description": "0-based index of the child element being accessed within a group, and its value is returned as the unique identifier for that child.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "long",
+ "description": "a unique long integer representing each child position.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "long childId = listAdapter.getChildId(0, 1);\n",
+ "description": ""
+ },
+ "name": "getChildId",
+ "location": {
+ "start": 84,
+ "insert": 72,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 71,
+ "end": 83
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 12
+ },
+ {
+ "id": "286010e8-cac8-b488-f84a-d70201f3566a",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Inflates a layout for a child view within a group, retrieves the child's text content, and sets it to a TextView widget. It returns the converted view with the set text.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based position of the group in the list that contains the child view being inflated, which is used to retrieve the child text from the data source.",
+ "complex_type": false
+ },
+ {
+ "name": "childPosition",
+ "type_name": "int",
+ "description": "0-based index of the child view within its parent group, used to retrieve the corresponding child text and set it in the TextView.",
+ "complex_type": false
+ },
+ {
+ "name": "isLastChild",
+ "type_name": "boolean",
+ "description": "state of whether the child view being accessed is the last one within its group, which can potentially be used to optimize rendering or styling of the child views accordingly.",
+ "complex_type": false
+ },
+ {
+ "name": "convertView",
+ "type_name": "View",
+ "description": "view to be recycled and reused, or null if a new view must be created.\n\nInflates to null initially and then inflated with layout R.layout.list_item when not null.",
+ "complex_type": true
+ },
+ {
+ "name": "parent",
+ "type_name": "ViewGroup",
+ "description": "ViewGroup that this view is being added to, serving as a reference for layout and alignment purposes.\n\nParent is a ViewGroup object representing the parent view group. It has no attributes mentioned in this context.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "View",
+ "description": "a custom list item view with child text.\n\nThe output is a view representing a child in an expandable list view group. It has a text value set from the `childText` string and is inflated with the layout resource `R.layout.list_item`.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "int groupPosition = 0;\nint childPosition = 0;\nboolean isLastChild = false;\nView convertView = null;\nViewGroup parent = null;\n\nView result = getChildView(groupPosition, childPosition, isLastChild, convertView, parent);\n",
+ "description": ""
+ },
+ "name": "getChildView",
+ "location": {
+ "start": 141,
+ "insert": 89,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 88,
+ "end": 140
+ }
+ },
+ "item_type": "method",
+ "length": 17,
+ "docLength": 52
+ },
+ {
+ "id": "94ec0a6d-feae-0787-ba4a-4340b008bc9a",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns the number of child elements for a given group position within a list data structure, utilizing a header to index into the child list and retrieve its size.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of a group in the list data header, used to retrieve the corresponding child data from the `_listDataChild` map.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer representing the size of a list.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "int childrenCount = expandableListAdapter.getChildrenCount(0);\n",
+ "description": ""
+ },
+ "name": "getChildrenCount",
+ "location": {
+ "start": 170,
+ "insert": 159,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 158,
+ "end": 169
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 11
+ },
+ {
+ "id": "67442b51-8480-b7b2-4b47-d0b7f247818a",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns an object at a specified position from a list data header. The position is provided as an integer parameter, and the function retrieves the corresponding object from the `_listDataHeader` collection.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of the group to be retrieved from the `_listDataHeader` collection, allowing for specific groups to be accessed and returned.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Object",
+ "description": "an object retrieved from the `_listDataHeader` list.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public Object groupData = new ArrayList<>();\nList listDataHeader = new ArrayList<>();\n\n// Assuming listDataHeader contains data for header titles and \n// groupData contains data for child elements.\nExpandableListAdapter adapter = new ExpandableListAdapter(context, listDataHeader, groupData);\nObject group = adapter.getGroup(0); // Returns the object at position 0 in _listDataHeader.",
+ "description": ""
+ },
+ "name": "getGroup",
+ "location": {
+ "start": 193,
+ "insert": 176,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 175,
+ "end": 192
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 17
+ },
+ {
+ "id": "ca93ebd6-1609-dda5-0749-acbee953c20d",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns an integer representing the number of items in a list referred to as `_listDataHeader`. This count is used for grouping or categorizing data in a hierarchical manner. The function overrides the default implementation and provides custom behavior for getting group counts.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer representing the size of a list.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "List listDataHeader = new ArrayList<>();\nlistDataHeader.add(\"Header1\");\nlistDataHeader.add(\"Header2\");\nlistDataHeader.add(\"Header3\");\n\nHashMap> listDataChild = new HashMap<>();\n// Initialize child data\n\nExpandableListAdapter adapter = new ExpandableListAdapter(context, listDataHeader, listDataChild);\nListView listView = (ListView) findViewById(R.id.listView);\n\nadapter.setGroupCount(listDataHeader.size()); // Using getGroupCount method\nlistView.setAdapter(adapter);\n",
+ "description": ""
+ },
+ "name": "getGroupCount",
+ "location": {
+ "start": 204,
+ "insert": 198,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 197,
+ "end": 203
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 6
+ },
+ {
+ "id": "198ab765-8ad3-80a2-4642-ee38088ad033",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns a long integer value that corresponds to the specified group position. The group position is provided as an input parameter and is directly returned without any modification or processing. This suggests a simple mapping between group positions and their corresponding IDs.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of the group for which to retrieve the corresponding ID, which is directly returned as the result.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "long",
+ "description": "the integer value of the input `groupPosition`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ExpandableListAdapter expandableListAdapter = new ExpandableListAdapter(getBaseContext(), listDataHeader, listChildData);\nlong groupId = expandableListAdapter.getGroupId(0); // Example usage with input groupPosition=0.",
+ "description": ""
+ },
+ "name": "getGroupId",
+ "location": {
+ "start": 217,
+ "insert": 209,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 208,
+ "end": 216
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 8
+ },
+ {
+ "id": "f2a0acc7-5040-1e9c-f641-4058f03a3a4c",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns a view representing a group in a list. It inflates a layout for each group if necessary, sets the text of a header label to the group's title, and returns the converted view. The returned view is used to display the group's title in the list.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of the group being rendered, used to retrieve its title and configure the view accordingly.",
+ "complex_type": false
+ },
+ {
+ "name": "isExpanded",
+ "type_name": "boolean",
+ "description": "state of the group at the given position, indicating whether it is currently expanded or not.",
+ "complex_type": false
+ },
+ {
+ "name": "convertView",
+ "type_name": "View",
+ "description": "view that will be used to represent the group at the specified `groupPosition`, and it is reused whenever possible for efficiency.\n\nconvertView is either null or an inflated View object from R.layout.list_group; if convertView is null, it is initialized with the layout inflater; otherwise, its original state remains unchanged.",
+ "complex_type": true
+ },
+ {
+ "name": "parent",
+ "type_name": "ViewGroup",
+ "description": "parent view group that the converted view is being added to or replaced within.\n\nParent is a ViewGroup object representing the parent group to be laid out and shown. It has main properties such as layout_width, layout_height, and layout_margin.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "androidviewView",
+ "description": "a customized group view for an expandable list.\n\nIt is a View object, specifically a layout view with an inflated design from R.layout.list_group. The view contains a TextView with the ID lblListHeader, which displays the header title in bold font.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "getGroupView(0, true, null, parent); \n",
+ "description": ""
+ },
+ "name": "getGroupView",
+ "location": {
+ "start": 263,
+ "insert": 222,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 221,
+ "end": 262
+ }
+ },
+ "item_type": "method",
+ "length": 17,
+ "docLength": 41
+ },
+ {
+ "id": "7292e5b1-06dc-9682-6048-0ff4aebbfb5f",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns a boolean value indicating whether the IDs returned by the adapter are stable across different configuration changes or not. In this implementation, it always returns `false`, implying that the IDs may change due to configuration changes.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating that IDs are not stable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ExpandableListAdapter expandableListAdapter = new ExpandableListAdapter(this, listHeaderData, listChildData);\nexpandableListAdapter.hasStableIds(); // Returns false",
+ "description": ""
+ },
+ "name": "hasStableIds",
+ "location": {
+ "start": 286,
+ "insert": 281,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 280,
+ "end": 285
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 5
+ },
+ {
+ "id": "63fb27d2-dfca-41bd-fe4a-113476a122bb",
+ "ancestors": [
+ "844a070d-d95f-179a-964b-35e576049bf1"
+ ],
+ "description": "Returns a boolean value indicating whether the child at the specified position within the group at the specified position can be selected or not. In this implementation, it always returns `true`, allowing any child to be selected.",
+ "params": [
+ {
+ "name": "groupPosition",
+ "type_name": "int",
+ "description": "0-based index of the group within an ExpandableListView that is being checked for selectability of its child at the specified `childPosition`.",
+ "complex_type": false
+ },
+ {
+ "name": "childPosition",
+ "type_name": "int",
+ "description": "0-based position of a child item within its parent group in a hierarchical data structure.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating whether children are selectable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ExpandableListAdapter adapter = new ExpandableListAdapter(this, listDataHeader, \n listDataChild);\nListView listView = findViewById(R.id.list);\nlistView.setAdapter(adapter);\n\nadapter.isChildSelectable(0, 1);",
+ "description": ""
+ },
+ "name": "isChildSelectable",
+ "location": {
+ "start": 303,
+ "insert": 291,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 290,
+ "end": 302
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 12
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "FontFitTextView.java",
+ "path": "client/src/main/java/io/sensable/client/component/FontFitTextView.java",
+ "content": {
+ "structured": {
+ "description": "An Android custom `TextView` class named `FontFitTextView`. It automatically adjusts the font size to fit the text within a specified width. The `TextView` uses the `onMeasure`, `onTextChanged`, and `onSizeChanged` methods to resize the font based on the available width. The `refitText` method is used to calculate the optimal font size by iterating over possible sizes until it finds one that fits the specified width.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_2 {\n label=\"sensable/client\"\n color=\"#33363A\"\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n FontFitTextView [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n TextView [label=\"android.widget.TextView\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n AttributeSet [label=\"android.util.AttributeSet\", style=\"rounded,filled\"]\n TypedValue [label=\"android.util.TypedValue\", style=\"rounded,filled\"]\n Paint [label=\"android.graphics.Paint\", style=\"rounded,filled\"]\n FontFitTextView -> AttributeSet [style=\"dashed\"]\n FontFitTextView -> TextView [style=\"dashed\"]\n FontFitTextView -> TypedValue [style=\"dashed\"]\n FontFitTextView -> Context [style=\"dashed\"]\n Context -> FontFitTextView [penwidth=2]\n AttributeSet -> FontFitTextView [penwidth=1]\n FontFitTextView -> Paint [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablecontentgraphicsutilwidgetclientContextPaintAttributeSetTypedValueTextViewcomponentFontFitTextViewimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.component.FontFitTextView -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.component.FontFitTextView -> android.graphics.Paint: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.component.FontFitTextView -> android.util.AttributeSet: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.component.FontFitTextView -> android.util.TypedValue: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.component.FontFitTextView -> android.widget.TextView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.component.FontFitTextView: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.util.AttributeSet -> io.sensable.client.component.FontFitTextView: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.widget.TextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.TypedValue: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.graphics.Paint: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.AttributeSet: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.AttributeSet: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.component.FontFitTextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.component.FontFitTextView: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "dc8f31b0-b7ad-8685-8f4c-d564be408ce0",
+ "ancestors": [],
+ "description": "Is an extension of the TextView class that adjusts the font size to fit the text within a specified width while maintaining a consistent aspect ratio. It uses a `Paint` object to measure and resize the text, recalculating the dimensions when its width or height changes. The class also updates the text size based on the view's new width and height.",
+ "name": "FontFitTextView",
+ "location": {
+ "start": 20,
+ "insert": 13,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 12,
+ "end": 19
+ }
+ },
+ "item_type": "class",
+ "length": 133,
+ "docLength": 7
+ },
+ {
+ "id": "abf1fe28-ec54-71a4-8a41-553b5c958754",
+ "ancestors": [
+ "dc8f31b0-b7ad-8685-8f4c-d564be408ce0"
+ ],
+ "description": "Initializes a private variable `mTestPaint` with a new instance of `Paint`. It then sets the properties of the new paint to match those of an existing `Paint` object retrieved from the current context using `getPaint()`.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "FontFitTextView myTextView = new FontFitTextView(context);\nmyTextView.setText(\"This text will be resized to fit in the width\");\n",
+ "description": "\nAdjusts the font size of the text within the `myTextView` component so that it fits within its specified width."
+ },
+ "name": "initialise",
+ "location": {
+ "start": 38,
+ "insert": 32,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 31,
+ "end": 37
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 6
+ },
+ {
+ "id": "d3c4f8a7-b4ff-9287-b849-6481363c58e3",
+ "ancestors": [
+ "dc8f31b0-b7ad-8685-8f4c-d564be408ce0"
+ ],
+ "description": "Adjusts the text size to fit within a given width while taking into account left and right padding. It iteratively narrows down the range of possible sizes by measuring the text's width at each midpoint until it converges on the correct size.",
+ "params": [
+ {
+ "name": "text",
+ "type_name": "String",
+ "description": "string whose font size is to be adjusted to fit within the specified width.",
+ "complex_type": false
+ },
+ {
+ "name": "textWidth",
+ "type_name": "int",
+ "description": "width of the available space for rendering the text, from which the optimal font size is calculated to fit the given text within that width.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "TextView tv = new FontFitTextView(this);\ntv.setText(\"This text will fit in the available width.\");\nint textSizeWidth = tv.getWidth() - tv.getPaddingLeft() - tv.getPaddingRight();\nrefitText(tv.getText().toString(), textSizeWidth);\n",
+ "description": "\nThis code creates a TextView object and sets its text. It then calculates the target width for the text, which is the width of the view minus the padding on both sides. The method refitText is called with this target width as an argument to resize the font so that it fits within the available width."
+ },
+ "name": "refitText",
+ "location": {
+ "start": 57,
+ "insert": 47,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 46,
+ "end": 56
+ }
+ },
+ "item_type": "method",
+ "length": 22,
+ "docLength": 10
+ },
+ {
+ "id": "869c7d71-5024-87b5-e146-2e3ca22a4ad1",
+ "ancestors": [
+ "dc8f31b0-b7ad-8685-8f4c-d564be408ce0"
+ ],
+ "description": "Adjusts the size of a view based on its content and available space. It first calls the superclass's `onMeasure` method to set up the measurement process, then retrieves the parent's width and updates the view's height based on the text content.",
+ "params": [
+ {
+ "name": "widthMeasureSpec",
+ "type_name": "int",
+ "description": "measure specification for the width of the view, which specifies how much space is available for the view to occupy.",
+ "complex_type": false
+ },
+ {
+ "name": "heightMeasureSpec",
+ "type_name": "int",
+ "description": "measure specification for the view's height, which is used to determine the actual height of the view.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "onMeasure(1000, 500);\n",
+ "description": "\nThis will set the width and height for measuring."
+ },
+ "name": "onMeasure",
+ "location": {
+ "start": 90,
+ "insert": 80,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 79,
+ "end": 89
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 10
+ },
+ {
+ "id": "136117e6-da64-cebf-0743-e44ccdac8bfb",
+ "ancestors": [
+ "dc8f31b0-b7ad-8685-8f4c-d564be408ce0"
+ ],
+ "description": "Overrides a method to respond to changes in the text of an input field. It takes four parameters: the changed text, and the start and end positions of the change, and updates the layout based on the new text.",
+ "params": [
+ {
+ "name": "text",
+ "type_name": "CharSequence",
+ "description": "character sequence that is being changed within the text field.",
+ "complex_type": false
+ },
+ {
+ "name": "start",
+ "type_name": "int",
+ "description": "0-based index of the first character changed during the text modification process.",
+ "complex_type": false
+ },
+ {
+ "name": "before",
+ "type_name": "int",
+ "description": "number of characters being removed from the text at the specified start position before making changes to it.",
+ "complex_type": false
+ },
+ {
+ "name": "after",
+ "type_name": "int",
+ "description": "number of characters added to the text at the specified position.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "FontFitTextView tv = (FontFitTextView) findViewById(R.id.tv);\ntv.setText(\"Some long text to fit\");\n",
+ "description": ""
+ },
+ "name": "onTextChanged",
+ "location": {
+ "start": 124,
+ "insert": 100,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 99,
+ "end": 123
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 24
+ },
+ {
+ "id": "b6c0a755-f1ec-969d-0145-915c1a26ecca",
+ "ancestors": [
+ "dc8f31b0-b7ad-8685-8f4c-d564be408ce0"
+ ],
+ "description": "Is overridden to handle changes in width. It checks if the new width differs from the previous one, and if so, calls the `refitText` method with the current text and new width as arguments to adjust the text according to the changed width.",
+ "params": [
+ {
+ "name": "w",
+ "type_name": "int",
+ "description": "new width of the view, which is compared with its previous width (`oldw`) to determine if a refitting of text is necessary.",
+ "complex_type": false
+ },
+ {
+ "name": "h",
+ "type_name": "int",
+ "description": "height of the view, which is not being used in this method.",
+ "complex_type": false
+ },
+ {
+ "name": "oldw",
+ "type_name": "int",
+ "description": "width of the view before it was resized, allowing the method to detect whether the width has changed since the last time the onSizeChanged method was called.",
+ "complex_type": false
+ },
+ {
+ "name": "oldh",
+ "type_name": "int",
+ "description": "previous height of the view, which is used for comparison with the current height (`h`) to determine if there has been a change in the view's size.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(new MyView(this));\n}\n\nclass MyView extends View {\n\n public MyView(Context context) {\n super(context);\n // ...\n }\n\n @Override\n protected void onDraw(Canvas canvas) {\n Paint paint = new Paint();\n String text = \"Hello, world!\";\n int width = getWidth();\n FontFitTextView textView = new FontFitTextView(getContext());\n textView.setText(text);\n textView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));\n addView(textView);\n }\n}\n",
+ "description": ""
+ },
+ "name": "onSizeChanged",
+ "location": {
+ "start": 143,
+ "insert": 129,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 128,
+ "end": 142
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 14
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "TabsPagerAdapter.java",
+ "path": "client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java",
+ "content": {
+ "structured": {
+ "description": "An extension of FragmentPagerAdapter that provides fragments for a tabbed interface with three tabs: FavouriteSensables, LocalSensables, and RemoteSensables. The adapter uses the index of the current tab to determine which fragment to display, returning either FavouriteSensablesFragment, LocalSensablesFragment, or RemoteSensablesFragment accordingly. It uses Android's support package v4 for FragmentManager and FragmentPagerAdapter.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n FragmentManager [label=\"android.support.v4.app.FragmentManager\", style=\"rounded,filled\"]\n LocalSensablesFragment []\n MainActivity []\n FavouriteSensablesFragment []\n FragmentPagerAdapter [label=\"android.support.v4.app.FragmentPagerAdapter\", style=\"rounded,filled\"]\n RemoteSensablesFragment []\n Fragment [label=\"android.support.v4.app.Fragment\", style=\"rounded,filled\"]\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n TabsPagerAdapter [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n TabsPagerAdapter -> Fragment [style=\"dashed\"]\n TabsPagerAdapter -> Fragment [penwidth=1]\n TabsPagerAdapter -> FragmentPagerAdapter [style=\"dashed\"]\n FragmentManager -> TabsPagerAdapter [penwidth=1]\n MainActivity -> TabsPagerAdapter [style=\"dashed\"]\n TabsPagerAdapter -> FavouriteSensablesFragment [style=\"dashed\"]\n TabsPagerAdapter -> FragmentManager [style=\"dashed\"]\n TabsPagerAdapter -> LocalSensablesFragment [style=\"dashed\"]\n TabsPagerAdapter -> RemoteSensablesFragment [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablesupportclientv4MainActivityadapterappviewsTabsPagerAdapterFragmentFragmentManagerFragmentPagerAdapterFavouriteSensablesFragmentLocalSensablesFragmentRemoteSensablesFragmentimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.MainActivity -> io.sensable.client.adapter.TabsPagerAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> android.support.v4.app.Fragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> android.support.v4.app.FragmentManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> android.support.v4.app.FragmentPagerAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> io.sensable.client.views.FavouriteSensablesFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> io.sensable.client.views.LocalSensablesFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> io.sensable.client.views.RemoteSensablesFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.support.v4.app.FragmentManager -> io.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter -> android.support.v4.app.Fragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.support.v4.app.FragmentManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.Fragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.FragmentPagerAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.support.v4.app.FragmentManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.support.v4.app.Fragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "293d78eb-cef2-adac-c146-5fc4d9716501",
+ "ancestors": [],
+ "description": "Extends FragmentPagerAdapter, providing fragments for a tabbed interface with three tabs: Top Rated, Games, and Movies. It determines the type of fragment to display based on its index and returns a corresponding `Fragment` instance. The class has a fixed count of 3 tabs.",
+ "name": "TabsPagerAdapter",
+ "location": {
+ "start": 18,
+ "insert": 13,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 12,
+ "end": 17
+ }
+ },
+ "item_type": "class",
+ "length": 68,
+ "docLength": 5
+ },
+ {
+ "id": "a1708247-2df4-f9a8-014c-6b1c4b4aaa08",
+ "ancestors": [
+ "293d78eb-cef2-adac-c146-5fc4d9716501"
+ ],
+ "description": "Returns a Fragment instance based on the specified index, which determines the type of content to display. It uses a switch statement to handle three cases: FavouriteSensablesFragment for index 0, LocalSensablesFragment for index 1, and RemoteSensablesFragment for index 2.",
+ "params": [
+ {
+ "name": "index",
+ "type_name": "int",
+ "description": "0-based index of a tab within a tab layout, determining which fragment to return from the switch statement.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Fragment",
+ "description": "a Fragment object, depending on the specified index.\n\nThe output is an instance of a fragment class. The type of fragment depends on the input index. If the index is 0, the output is an instance of `FavouriteSensablesFragment`. If the index is 1, the output is an instance of `LocalSensablesFragment`. If the index is 2, the output is an instance of `RemoteSensablesFragment`.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager());\nFragment fragment = adapter.getItem(0);\n",
+ "description": ""
+ },
+ "name": "getItem",
+ "location": {
+ "start": 49,
+ "insert": 24,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 23,
+ "end": 48
+ }
+ },
+ "item_type": "method",
+ "length": 17,
+ "docLength": 25
+ },
+ {
+ "id": "1a6a1dd1-d394-40a2-9b44-a5fe72e077f8",
+ "ancestors": [
+ "293d78eb-cef2-adac-c146-5fc4d9716501"
+ ],
+ "description": "Returns an integer representing the number of items, specifically the number of tabs. The method overrides a parent class's implementation and always returns a fixed value of 3.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value, specifically `3`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager());\nViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);\nviewPager.setAdapter(adapter);\n",
+ "description": ""
+ },
+ "name": "getCount",
+ "location": {
+ "start": 79,
+ "insert": 67,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 66,
+ "end": 78
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 12
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensorHelper.java",
+ "path": "client/src/main/java/io/sensable/client/SensorHelper.java",
+ "content": {
+ "structured": {
+ "description": "A class named `SensorHelper` that provides utility methods for determining the unit of measurement and the image resource for various types of sensors. The class includes three main methods: `determineUnit`, which returns the unit of measurement based on the sensor type, `determineImage(int)`, which returns the corresponding image resource ID for a given sensor type, and `determineImage(String)`, which uses a case-insensitive match to determine the appropriate image resource ID for a given sensor name.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n ScheduledSensableService []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensorHelper [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Sensor [label=\"android.hardware.Sensor\", style=\"rounded,filled\"]\n SensableListAdapter []\n ScheduledSensableService -> SensorHelper [style=\"dashed\"]\n SensableListAdapter -> SensorHelper [style=\"dashed\"]\n SensorHelper -> Sensor [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablehardwareclientSensorSensorHelperschedulerviewsScheduledSensableServiceSensableListAdapterimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensorHelper -> android.hardware.Sensor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.SensorHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.client.SensorHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.hardware.Sensor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.SensorHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.SensableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensorHelper: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "aaca6c31-6d7f-ffb2-734b-b954e3235361",
+ "ancestors": [],
+ "description": "Provides utility functions to determine the unit of measurement for various sensors and retrieve corresponding image resources based on sensor types. It contains three main functions: `determineUnit` which returns the unit of measurement, `determineImage(int)` which retrieves an integer representing a drawable resource ID for a given sensor type, and `determineImage(String)` which does the same but takes a string parameter.",
+ "name": "SensorHelper",
+ "location": {
+ "start": 15,
+ "insert": 8,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 7,
+ "end": 14
+ }
+ },
+ "item_type": "class",
+ "length": 192,
+ "docLength": 7
+ },
+ {
+ "id": "47691854-cbb9-2393-ea48-7af386514ac3",
+ "ancestors": [
+ "aaca6c31-6d7f-ffb2-734b-b954e3235361"
+ ],
+ "description": "Takes an integer `sensorType` as input and returns a corresponding unit string for the sensor type. The function uses a switch statement to map the sensor type to its respective unit, covering various types of sensors such as accelerometer, magnetometer, gyroscope, and others.",
+ "params": [
+ {
+ "name": "sensorType",
+ "type_name": "int",
+ "description": "type of sensor being used, which determines the corresponding unit to be returned by the function.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the unit of measurement for a given sensor type.",
+ "complex_type": false
+ },
+ "name": "determineUnit",
+ "location": {
+ "start": 29,
+ "insert": 17,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 16,
+ "end": 28
+ }
+ },
+ "item_type": "method",
+ "length": 53,
+ "docLength": 12
+ },
+ {
+ "id": "fcc65da2-aa11-c6b5-c243-fbea369f6eef",
+ "ancestors": [
+ "aaca6c31-6d7f-ffb2-734b-b954e3235361"
+ ],
+ "description": "Determines which image resource to display based on the type of sensor specified by the input parameter `sensorType`. It uses a switch statement to map each sensor type to a corresponding image resource and returns the selected image.",
+ "params": [
+ {
+ "name": "sensorType",
+ "type_name": "int",
+ "description": "type of sensor and determines which corresponding image resource to be returned based on its value.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing a specific sensor type.\n\nThe output is an integer value representing a drawable image resource ID. The value can be one of several predefined constants such as R.drawable.type_lux, R.drawable.type_accelerometer, and so on.",
+ "complex_type": true
+ },
+ "name": "determineImage",
+ "location": {
+ "start": 94,
+ "insert": 83,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 82,
+ "end": 93
+ }
+ },
+ "item_type": "method",
+ "length": 53,
+ "docLength": 11
+ },
+ {
+ "id": "41b306f7-9755-7492-b945-17487d675290",
+ "ancestors": [
+ "aaca6c31-6d7f-ffb2-734b-b954e3235361"
+ ],
+ "description": "Determines an image based on a given sensor type. It converts the sensor type to lowercase and checks for various conditions, assigning a corresponding image resource ID. The function returns the determined image ID as an integer.",
+ "params": [
+ {
+ "name": "sensorType",
+ "type_name": "String",
+ "description": "type of sensor that is being used, and its value determines which image to return based on a series of conditional checks.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing a drawable resource ID.\n\nThe output is an integer representing a drawable image resource ID from R.drawable. The value of this integer determines which image is displayed based on the input sensorType parameter.",
+ "complex_type": true
+ },
+ "name": "determineImage",
+ "location": {
+ "start": 158,
+ "insert": 148,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 147,
+ "end": 157
+ }
+ },
+ "item_type": "method",
+ "length": 47,
+ "docLength": 10
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableUser.java",
+ "path": "client/src/main/java/io/sensable/client/SensableUser.java",
+ "content": {
+ "structured": {
+ "description": "A class named SensableUser that handles user authentication and settings retrieval in an Android application using Retrofit library for making RESTful API calls. The class provides methods for logging in, logging out, retrieving user settings, saving user information to preferences, and updating login status. It also utilizes SharedPreferences for storing user data locally on the device.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"io\"\n color=\"#33363A\"\n SensableService []\n subgraph cluster_2 {\n label=\"sensable\"\n color=\"#33363A\"\n UserLogin []\n User []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableUser [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n ScheduledSensableService []\n }\n }\n }\n subgraph cluster_4 {\n label=\"java\"\n color=\"#33363A\"\n CookieHandler [label=\"java.net.CookieHandler\", style=\"rounded,filled\"]\n CookiePolicy [label=\"java.net.CookiePolicy\", style=\"rounded,filled\"]\n CookieManager [label=\"java.net.CookieManager\", style=\"rounded,filled\"]\n }\n subgraph cluster_5 {\n label=\"retrofit\"\n color=\"#33363A\"\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n }\n subgraph cluster_6 {\n label=\"android\"\n color=\"#33363A\"\n SharedPreferences [label=\"android.content.SharedPreferences\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n }\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n SensableUser -> CookieManager [style=\"dashed\"]\n SensableUser -> SensableService [style=\"dashed\"]\n SensableUser -> Context [style=\"dashed\"]\n SensableUser -> Callback [style=\"dashed\"]\n SensableUser -> SharedPreferences [style=\"dashed\"]\n SharedPreferences -> SensableUser [penwidth=1]\n SensableUser -> UserLogin [style=\"dashed\"]\n Response -> SensableUser [penwidth=2]\n User -> SensableUser [penwidth=2]\n SensableUser -> RetrofitError [style=\"dashed\"]\n SensableUser -> CookieHandler [style=\"dashed\"]\n Context -> SensableUser [penwidth=1]\n RetrofitError -> SensableUser [penwidth=2]\n ScheduledSensableService -> SensableUser [style=\"dashed\"]\n SensableUser -> Log [style=\"dashed\"]\n SensableUser -> RestAdapter [style=\"dashed\"]\n SensableUser -> CookiePolicy [style=\"dashed\"]\n SensableUser -> User [style=\"dashed\"]\n UserLogin -> SensableUser [penwidth=1]\n SensableUser -> Response [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidretrofitjavasensablecontentutilCallbackRestAdapterRetrofitErrorclientnetclientContextSharedPreferencesLogSensableServicemodelResponseCookieHandlerCookieManagerCookiePolicySensableUserUserUserLoginschedulerScheduledSensableServiceimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableUser -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> android.content.SharedPreferences: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> io.sensable.model.User: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> io.sensable.model.UserLogin: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> java.net.CookieHandler: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> java.net.CookieManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> java.net.CookiePolicy: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.SensableUser: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.content.SharedPreferences -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.User -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.RetrofitError -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.client.Response -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\njava.net.CookieHandler: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.net.CookieManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.SharedPreferences: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.net.CookiePolicy: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.SharedPreferences: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.User: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableUser: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableUser: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "782aaf89-8bef-17af-dc4e-e885a06423b8",
+ "ancestors": [],
+ "description": "Is responsible for handling user authentication and settings retrieval in an Android application. It provides functionality to login, logout, retrieve user settings, save user information to preferences, and delete saved user information. The class utilizes Retrofit library for making HTTP requests and managing user data.",
+ "name": "SensableUser",
+ "location": {
+ "start": 27,
+ "insert": 21,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 20,
+ "end": 26
+ }
+ },
+ "item_type": "class",
+ "length": 279,
+ "docLength": 6
+ },
+ {
+ "id": "7de6000f-f0f1-de9f-e845-5489ca755f09",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8"
+ ],
+ "description": "Retrieves username, email, and access token from shared preferences and sets them on a user object. If any of these values are missing, it returns `false`, otherwise, it returns `true`.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating user login status.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "readUserFromPreferences();\nif(loggedIn) {\n // User is logged in, perform actions accordingly\n} else {\n // User is not logged in, prompt for login\n}\n",
+ "description": ""
+ },
+ "name": "readUserFromPreferences",
+ "location": {
+ "start": 65,
+ "insert": 59,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 58,
+ "end": 64
+ }
+ },
+ "item_type": "method",
+ "length": 21,
+ "docLength": 6
+ },
+ {
+ "id": "198d0568-86ef-00a3-4b4d-7c64a23add68",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8"
+ ],
+ "description": "Initiates a login process using an authentication service and notifies a callback interface when completed. It sets user preferences, updates the login status, and persists user data if successful, or logs an error message if not.",
+ "params": [
+ {
+ "name": "userLogin",
+ "type_name": "UserLogin",
+ "description": "user's login credentials to be sent to the authentication service for processing and verification.\n\n- The object `UserLogin` has a username and a password as its main properties.",
+ "complex_type": true
+ },
+ {
+ "name": "cb",
+ "type_name": "MainActivity.CallbackInterface",
+ "description": "CallbackInterface of the MainActivity, which is notified about the login status update using the `loginStatusUpdate(loggedIn)` method.\n\n- `CallbackInterface`: This is an interface with a single method `loginStatusUpdate(loggedIn)`.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "UserLogin userLogin = new UserLogin(\"username\", \"password\");\nSensibleUser sensableUser = new SensibleUser(sharedPreferences, context);\nsensableUser.login(userLogin, new CallbackInterface() {\n @Override\n public void loginStatusUpdate(boolean loggedIn) {\n // Update the UI accordingly based on the login status\n }\n\n @Override\n public void failure(RetrofitError retrofitError) {\n // Handle the error and update the UI accordingly\n }\n});\n",
+ "description": ""
+ },
+ "name": "login",
+ "location": {
+ "start": 122,
+ "insert": 87,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 86,
+ "end": 121
+ }
+ },
+ "item_type": "method",
+ "length": 78,
+ "docLength": 35
+ },
+ {
+ "id": "0d790827-ae39-6cb3-b242-87a2c8e501be",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8",
+ "198d0568-86ef-00a3-4b4d-7c64a23add68"
+ ],
+ "description": "Updates a local user object with username and email from a response, sets login status to true, retrieves an access token if present, saves it to preferences or proceeds to settings otherwise, and notifies a callback about the login status update.",
+ "params": [
+ {
+ "name": "user",
+ "type_name": "User",
+ "description": "authenticated user, providing access to their username, email, and access token, which are then used to update the local user object and preferences.\n\nDecompose user into: \nusername and email.",
+ "complex_type": true
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "callback response from the login request, which is not utilized within the provided method implementation.\n\nGetContent: The content returned by the request; getRawBody: Returns an input stream for reading the raw response body.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "User user = new User(\"test\", \"test@example.com\");\nResponse response = null;\n\nsensableUser.login(new UserLogin(user), new CallbackInterface() {\n @Override\n public void loginStatusUpdate(boolean loggedIn) {\n\n }\n\n @Override\n public void failure(RetrofitError retrofitError) {\n\n }\n});\n\nsensableUser.success(user, response);\n",
+ "description": ""
+ },
+ "name": "success",
+ "location": {
+ "start": 161,
+ "insert": 125,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 124,
+ "end": 160
+ }
+ },
+ "item_type": "method",
+ "length": 22,
+ "docLength": 36
+ },
+ {
+ "id": "a8ad7c7c-79c1-4e8e-3444-cdfd33ef1663",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8",
+ "198d0568-86ef-00a3-4b4d-7c64a23add68"
+ ],
+ "description": "Handles failures when making a request using Retrofit. It logs an error message to the console with the provided Retrofit error, indicating that the login attempt has failed. The error details are included in the log output.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "error that occurred during the execution of the Retrofit API request.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "RetrofitError retrofitError = new RetrofitError(\"Error message\");\nfailure(retrofitError);\n",
+ "description": "\nThis example will log the error message in the console when a login callback fails."
+ },
+ "name": "failure",
+ "location": {
+ "start": 194,
+ "insert": 184,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 183,
+ "end": 193
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 10
+ },
+ {
+ "id": "c2cf0776-dc1c-1eb2-af4f-a88ac0623de2",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8"
+ ],
+ "description": "Retrieves user settings from a service and updates a local user object with the received information. It saves the updated user details to preferences if an access token is provided, indicating successful login. It also handles error cases by logging error messages to the console.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "SensibleUser sensibleUser = new SensibleUser(sharedPreferences, context);\nsensibleUser.userSettings();\n",
+ "description": "\nIn this example, the `userSettings` method of the `SensableUser` class is called with no arguments. This method makes an API call to retrieve user settings and then saves them to preferences if an access token is provided."
+ },
+ "name": "userSettings",
+ "location": {
+ "start": 205,
+ "insert": 201,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 200,
+ "end": 204
+ }
+ },
+ "item_type": "method",
+ "length": 63,
+ "docLength": 4
+ },
+ {
+ "id": "9507e498-ae91-38af-664c-dcf7329700ce",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8",
+ "c2cf0776-dc1c-1eb2-af4f-a88ac0623de2"
+ ],
+ "description": "Updates local user information with data from a successful login response, sets the `loggedIn` flag to `true`, and saves the user's access token if present. It also logs various success messages using `Log.d`. The updated user details are then saved to preferences.",
+ "params": [
+ {
+ "name": "user",
+ "type_name": "User",
+ "description": "authenticated user, providing access to their username, email, and access token, which are then used to update local user data and preferences.\n\nUser has username, email and access token.",
+ "complex_type": true
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "result of an API request and is ignored in this method, as it is not utilized for any operations.\n\n* The response object has no further decomposition.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "User user = new User();\nuser.setUsername(\"exampleUser\");\nuser.setEmail(\"exampleEmail\");\n\nservice.login(new UserLogin(user.getUsername(), user.getEmail()), new Callback() {\n @Override\n public void success(User user, Response response) {\n // usage of the success method provided in the prompt\n }\n\n @Override\n public void failure(RetrofitError retrofitError) {\n Log.e(TAG, \"Login callback failure\" + retrofitError.toString());\n }\n});\n",
+ "description": ""
+ },
+ "name": "success",
+ "location": {
+ "start": 230,
+ "insert": 208,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 207,
+ "end": 229
+ }
+ },
+ "item_type": "method",
+ "length": 18,
+ "docLength": 22
+ },
+ {
+ "id": "1c74f2a2-c12d-c1a3-894c-db131dfb305c",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8",
+ "c2cf0776-dc1c-1eb2-af4f-a88ac0623de2"
+ ],
+ "description": "Logs an error message with a Retrofit error and the tag `TAG`. It is called when a login request fails. The error message includes information about the Retrofit error, which can be used for debugging purposes.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "exception that occurred during the Retrofit call execution and is passed to the `failure` method for logging or further error handling purposes.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onFailure(RetrofitError retrofitError) {\n Log.e(TAG, \"Login callback failure\" + retrofitError.toString());\n}\n",
+ "description": "\nExample input: `RetrofitError` object."
+ },
+ "name": "failure",
+ "location": {
+ "start": 262,
+ "insert": 249,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 248,
+ "end": 261
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 13
+ },
+ {
+ "id": "82bca259-8473-45ab-5343-f94f23db86e7",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8"
+ ],
+ "description": "Logs user information to the debug log and saves it to shared preferences, specifically storing username, email, and access token.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "saveUserToPreferences();\n",
+ "description": ""
+ },
+ "name": "saveUserToPreferences",
+ "location": {
+ "start": 273,
+ "insert": 269,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 268,
+ "end": 272
+ }
+ },
+ "item_type": "method",
+ "length": 8,
+ "docLength": 4
+ },
+ {
+ "id": "f07e3fcf-3998-8cb1-2a4f-b3914bb40edc",
+ "ancestors": [
+ "782aaf89-8bef-17af-dc4e-e885a06423b8"
+ ],
+ "description": "Removes stored user data from SharedPreferences, resets `mUser`, `loggedIn`, and `hasAccessToken` variables to default values, and notifies the callback interface about the updated login status by calling `loginStatusUpdate(loggedIn)`.",
+ "params": [
+ {
+ "name": "cb",
+ "type_name": "MainActivity.CallbackInterface",
+ "description": "CallbackInterface, which is used to update the login status with the callback method `loginStatusUpdate(loggedIn)`.\n\nCb is an instance of `MainActivity.CallbackInterface`. It has a method named `loginStatusUpdate` with one argument of boolean type.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "deleteSavedUser(new CallbackInterface() {\n @Override\n public void loginStatusUpdate(boolean loggedIn) {\n // Update the UI according to the login status.\n }\n});\n",
+ "description": "\nThis method will remove saved user information from SharedPreferences and update the login status, access token, and user data to empty values."
+ },
+ "name": "deleteSavedUser",
+ "location": {
+ "start": 293,
+ "insert": 282,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 281,
+ "end": 292
+ }
+ },
+ "item_type": "method",
+ "length": 11,
+ "docLength": 11
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensorListActivity.java",
+ "path": "client/src/main/java/io/sensable/client/SensorListActivity.java",
+ "content": {
+ "structured": {
+ "description": "An Android ListActivity that displays a list of available sensors on the device. It uses the SensorManager API and a custom ArrayAdapter to populate the list with sensor names. The code retrieves a list of all available sensors using the getSensorList method, then iterates over the list to extract the sensor names, which are stored in an ArrayList.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"java\"\n color=\"#33363A\"\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n ArrayList [label=\"java.util.ArrayList\", style=\"rounded,filled\"]\n }\n subgraph cluster_2 {\n label=\"android\"\n color=\"#33363A\"\n Sensor [label=\"android.hardware.Sensor\", style=\"rounded,filled\"]\n ArrayAdapter [label=\"android.widget.ArrayAdapter\", style=\"rounded,filled\"]\n ListActivity [label=\"android.app.ListActivity\", style=\"rounded,filled\"]\n SensorManager [label=\"android.hardware.SensorManager\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n }\n subgraph cluster_4 {\n label=\"io/sensable\"\n color=\"#33363A\"\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensorListActivity [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n SensorListActivity -> Bundle [style=\"dashed\"]\n SensorListActivity -> SensorManager [style=\"dashed\"]\n SensorListActivity -> ArrayAdapter [style=\"dashed\"]\n SensorListActivity -> ListActivity [style=\"dashed\"]\n SensorListActivity -> ArrayList [style=\"dashed\"]\n SensorListActivity -> Context [style=\"dashed\"]\n Bundle -> SensorListActivity [penwidth=1]\n SensorListActivity -> List [style=\"dashed\"]\n SensorListActivity -> Sensor [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidjavasensableappcontenthardwareoswidgetutilclientListActivityContextSensorSensorManagerBundleArrayAdapterArrayListListSensorListActivityimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensorListActivity -> android.app.ListActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> android.hardware.Sensor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> android.hardware.SensorManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> android.widget.ArrayAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> java.util.ArrayList: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensorListActivity -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.SensorListActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.ArrayList: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.ArrayAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.Sensor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.SensorManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.ListActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.SensorListActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensorListActivity: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "4669f1a4-51f7-70a7-fd4e-9d873c0c00db",
+ "ancestors": [],
+ "description": "Extends ListActivity to display a list of available sensors on a device. It retrieves a list of all sensors using the SensorManager and then creates an ArrayAdapter to display their names in a ListView.",
+ "name": "SensorListActivity",
+ "location": {
+ "start": 13,
+ "insert": 13,
+ "offset": " ",
+ "indent": 0,
+ "comment": null
+ },
+ "item_type": "class",
+ "length": 44,
+ "docLength": null
+ },
+ {
+ "id": "2b5586d6-1dd3-2781-9d4f-7ff01c93b3de",
+ "ancestors": [
+ "4669f1a4-51f7-70a7-fd4e-9d873c0c00db"
+ ],
+ "description": "Initializes a SensorManager and retrieves a list of all available sensors. It then creates an ArrayList to store sensor names, adds these names to the list, and sets a list adapter for a ListView. The adapter enables text filtering on the ListView.",
+ "params": [
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "Bundle object that contains the activity's saved state at the moment it is being restored by the system.\n\nBundle object holding the activity's state. It contains key-value pairs representing the application-specific data saved by the activity when its process is killed.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Example {\n public static void main(String[] args) {\n Bundle savedInstanceState = new Bundle();\n SensorListActivity sensorListActivity = new SensorListActivity();\n sensorListActivity.onCreate(savedInstanceState);\n }\n}\n",
+ "description": "\nThis code creates a new instance of the `SensorListActivity` and calls its `onCreate` method with a sample input `savedInstanceState`."
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 40,
+ "insert": 17,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 16,
+ "end": 39
+ }
+ },
+ "item_type": "method",
+ "length": 16,
+ "docLength": 23
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "BootReceiver.java",
+ "path": "client/src/main/java/io/sensable/client/scheduler/BootReceiver.java",
+ "content": {
+ "structured": {
+ "description": "A BroadcastReceiver class named BootReceiver that handles events related to the system booting up. When the device boots, it starts an AlarmManager using the ScheduleHelper class to initiate task scheduling. The onReceive method is triggered when the BroadcastReceiver receives the intent from the system. It logs a message and creates an instance of ScheduleHelper to start the scheduler.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"client\"\n color=\"#33363A\"\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n BootReceiver [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n BroadcastReceiver [label=\"android.content.BroadcastReceiver\", style=\"rounded,filled\"]\n Context -> BootReceiver [penwidth=1]\n BootReceiver -> Context [style=\"dashed\"]\n BootReceiver -> Intent [style=\"dashed\"]\n Intent -> BootReceiver [penwidth=1]\n BootReceiver -> Log [style=\"dashed\"]\n BootReceiver -> BroadcastReceiver [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablecontentutilclientBroadcastReceiverContextIntentLogschedulerBootReceiverimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.scheduler.BootReceiver -> android.content.BroadcastReceiver: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.BootReceiver -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.BootReceiver -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.BootReceiver -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.scheduler.BootReceiver: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.content.Intent -> io.sensable.client.scheduler.BootReceiver: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.content.BroadcastReceiver: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.scheduler.BootReceiver: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.BootReceiver: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "33b64f60-ad15-819d-3844-54cade53520d",
+ "ancestors": [],
+ "description": "Is a broadcast receiver that handles system boot events in Android applications. It starts an AlarmManager and initiates the Schedule Helper to begin scheduling tasks when the device boots up. This ensures timely execution of scheduled tasks.",
+ "name": "BootReceiver",
+ "location": {
+ "start": 16,
+ "insert": 11,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 10,
+ "end": 15
+ }
+ },
+ "item_type": "class",
+ "length": 28,
+ "docLength": 5
+ },
+ {
+ "id": "4c35bd96-62a7-b890-634e-17cdd922306b",
+ "ancestors": [
+ "33b64f60-ad15-819d-3844-54cade53520d"
+ ],
+ "description": "Schedules a task using an AlarmManager when the device boots up. It creates a `ScheduleHelper` object and calls its `startScheduler` method to initiate the scheduling process. The scheduled task is logged with debug information.",
+ "params": [
+ {
+ "name": "context",
+ "type_name": "Context",
+ "description": "application environment and provides access to various system resources, services, and functionality within the code.",
+ "complex_type": false
+ },
+ {
+ "name": "intent",
+ "type_name": "Intent",
+ "description": "Intent that triggered the onReceive() method and is not utilized within the provided code snippet.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Context context = ...;\n Intent intent = ...;\n BootReceiver receiver = new BootReceiver();\n receiver.onReceive(context, intent);\n }\n}\n",
+ "description": "\nInputs: ('context', `Context`), and ('intent', `Intent`)."
+ },
+ "name": "onReceive",
+ "location": {
+ "start": 38,
+ "insert": 19,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 18,
+ "end": 37
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 19
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "ScheduledSensableService.java",
+ "path": "client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java",
+ "content": {
+ "structured": {
+ "description": "An Android service named ScheduledSensableService that extends the Service class and is responsible for sampling sensors based on a schedule. It utilizes Retrofit for API interactions and SensorManager to access sensor data. The service gets sensor information from the system, registers listeners to receive sensor events, and schedules sensor samplings using a scheduler.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n SensorManager [label=\"android.hardware.SensorManager\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n Service [label=\"android.app.Service\", style=\"rounded,filled\"]\n SharedPreferences [label=\"android.content.SharedPreferences\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n LocationManager [label=\"android.location.LocationManager\", style=\"rounded,filled\"]\n SensableService []\n R [label=\"io.sensable.client.R\", style=\"rounded,filled\"]\n SensableUser []\n ScheduledSensablesTable []\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n SensorHelper []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n ScheduledSensableService [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Location [label=\"android.location.Location\", style=\"rounded,filled\"]\n SampleSender []\n SampleResponse []\n IBinder [label=\"android.os.IBinder\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n Sample []\n SensorEvent [label=\"android.hardware.SensorEvent\", style=\"rounded,filled\"]\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n ScheduledSensable []\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n Sensor [label=\"android.hardware.Sensor\", style=\"rounded,filled\"]\n SensorEventListener [label=\"android.hardware.SensorEventListener\", style=\"rounded,filled\"]\n ScheduledSensableService -> Sensor [style=\"dashed\"]\n ScheduledSensableService -> LocationManager [style=\"dashed\"]\n ScheduledSensableService -> Sample [style=\"dashed\"]\n SensorEvent -> ScheduledSensableService [penwidth=1]\n ScheduledSensableService -> SampleResponse [style=\"dashed\"]\n ScheduledSensableService -> R [style=\"dashed\"]\n ScheduledSensableService -> SensorManager [style=\"dashed\"]\n ScheduledSensableService -> SensorEventListener [penwidth=1]\n ScheduledSensableService -> SensorHelper [style=\"dashed\"]\n ScheduledSensableService -> SharedPreferences [style=\"dashed\"]\n Sensor -> ScheduledSensableService [penwidth=1]\n ScheduledSensableService -> SensableUser [style=\"dashed\"]\n ScheduledSensableService -> Log [style=\"dashed\"]\n Intent -> ScheduledSensableService [penwidth=2]\n ScheduledSensableService -> ScheduledSensablesTable [style=\"dashed\"]\n ScheduledSensableService -> Location [penwidth=1]\n ScheduledSensableService -> Response [style=\"dashed\"]\n ScheduledSensableService -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensableService -> Service [style=\"dashed\"]\n ScheduledSensableService -> Callback [style=\"dashed\"]\n ScheduledSensableService -> RestAdapter [style=\"dashed\"]\n ScheduledSensableService -> List [style=\"dashed\"]\n ScheduledSensableService -> SensorEventListener [style=\"dashed\"]\n ScheduledSensableService -> Location [style=\"dashed\"]\n ScheduledSensableService -> IBinder [style=\"dashed\"]\n ScheduledSensableService -> SensableService [style=\"dashed\"]\n ScheduledSensableService -> Intent [style=\"dashed\"]\n ScheduledSensableService -> SensorEvent [style=\"dashed\"]\n ScheduledSensableService -> IBinder [penwidth=1]\n ScheduledSensableService -> Cursor [style=\"dashed\"]\n ScheduledSensable -> ScheduledSensableService [penwidth=1]\n ScheduledSensableService -> Context [style=\"dashed\"]\n ScheduledSensableService -> RetrofitError [style=\"dashed\"]\n Response -> ScheduledSensableService [penwidth=1]\n RetrofitError -> ScheduledSensableService [penwidth=1]\n ScheduledSensableService -> SampleSender [style=\"dashed\"]\n SampleResponse -> ScheduledSensableService [penwidth=1]\n}\n",
+ "d2": "ioandroidretrofitjavasensableappcontentdatabasehardwarelocationosutilCallbackRestAdapterRetrofitErrorclientutilclientServiceContextIntentSharedPreferencesCursorSensorSensorEventSensorEventListenerSensorManagerLocationLocationManagerIBinderLogSensableServicemodelResponseListschedulerRSensableUserSensorHelpersqliteSampleSampleResponseSampleSenderScheduledSensableScheduledSensableServiceScheduledSensablesTableimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.scheduler.ScheduledSensableService -> android.app.Service: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.content.SharedPreferences: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.hardware.Sensor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.hardware.SensorEvent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.hardware.SensorEventListener: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.hardware.SensorManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.location.Location: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.location.LocationManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.os.IBinder: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.R: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.SensableUser: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.SensorHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.SampleResponse: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.SampleSender: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Intent -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.hardware.Sensor -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.hardware.SensorEvent -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.hardware.SensorEventListener: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.os.IBinder: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> android.location.Location: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleResponse -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.RetrofitError -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.client.Response -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.SensorEventListener: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.location.LocationManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.SensorManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.Sensor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.R: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.Service: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.SharedPreferences: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.SensorEvent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.IBinder: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.location.Location: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.hardware.SensorEvent: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.location.Location: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensorHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.IBinder: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleSender: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableUser: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.hardware.Sensor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.hardware.SensorEventListener: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "5a4156ee-dba8-65a7-eb45-f58287a12a4d",
+ "ancestors": [],
+ "description": "Is an Android Service that schedules and collects sensor data from various sensors in the device based on a schedule. It retrieves scheduled tasks from a database, registers listeners for each task, and sends the collected data to a remote service for analysis. The service also handles errors, updates the scheduled sensables with new sample values, and stops itself when there are no more pending tasks.",
+ "name": "ScheduledSensableService",
+ "location": {
+ "start": 42,
+ "insert": 32,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 31,
+ "end": 41
+ }
+ },
+ "item_type": "class",
+ "length": 332,
+ "docLength": 10
+ },
+ {
+ "id": "b5c8251d-1e00-0fb2-5546-edbe83a8457c",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d"
+ ],
+ "description": "Registers sensor listeners for scheduled sensables, retrieves and processes data from the database, and marks sensables as pending or stops scheduling if necessary. It also logs messages and returns a sticky service start result.",
+ "params": [
+ {
+ "name": "intent",
+ "type_name": "Intent",
+ "description": "Intent object that was used to start the service and contains any data or commands intended for the service.\n\nintent is an instance of Intent class that contains information about action to be performed. It has three parameters - intent, flags and startId.",
+ "complex_type": true
+ },
+ {
+ "name": "flags",
+ "type_name": "int",
+ "description": "flags used to start the service, which can be one or more of the following: START_FLAG_REDELIVERY, START_FLAG_RETRY, or other flags that are not yet documented.",
+ "complex_type": false
+ },
+ {
+ "name": "startId",
+ "type_name": "int",
+ "description": "identifier of the service instance, which can be used to restart the service if it is terminated by the system.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "a service start state code of START_STICKY.\n\nReturns START_STICKY as an integer, indicating that the service should restart itself after being stopped.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "Intent intent = new Intent(\"io.sensable.client.scheduler.ScheduledSensableService\");\nstartService(intent);\n",
+ "description": ""
+ },
+ "name": "onStartCommand",
+ "location": {
+ "start": 72,
+ "insert": 49,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 48,
+ "end": 71
+ }
+ },
+ "item_type": "method",
+ "length": 25,
+ "docLength": 23
+ },
+ {
+ "id": "5b856de8-349f-8f8c-f545-6cf8345d8f72",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d"
+ ],
+ "description": "Returns a SensorEventListener that handles sensor data by creating a sample object from the sensor values and attaching location data. It then sends the sample to a remote service for analysis, updates a Scheduled object with sensor metadata, and stops the sensor and service if no more tasks are pending.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "Scheduled object that is updated with the sensor ID, sample values, and other metadata before stopping the sensor and service if no more tasks are pending.\n\nSet internal sensor ID.\nSet unit based on sensor type.\nSet private sensor status to false.\nSet access token.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "SensorEventListener",
+ "description": "a `SensorEventListener` object.\n\nReturns an instance of SensorEventListener with methods to handle sensor data received from a listener and save it to a remote service for analysis. The onSensorChanged method creates a sample object, formats its values, attaches location data before sending it to the service for storage.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\n// Set the necessary properties for scheduledSensable\nSensorEventListener listener = getListener(scheduledSensable);\nsensorManager.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_NORMAL);\n",
+ "description": "\nThe input provided is `scheduledSensable` which is an instance of `ScheduledSensable`."
+ },
+ "name": "getListener",
+ "location": {
+ "start": 150,
+ "insert": 98,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 97,
+ "end": 149
+ }
+ },
+ "item_type": "method",
+ "length": 127,
+ "docLength": 52
+ },
+ {
+ "id": "1a01a3c9-e458-8b9c-3345-6138a2c4fc33",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d",
+ "5b856de8-349f-8f8c-f545-6cf8345d8f72"
+ ],
+ "description": "Handles changes in sensor values, updates a scheduled sensable object with sensor data and location information, and sends the updated data to a RESTful API using Retrofit for further processing or storage.",
+ "params": [
+ {
+ "name": "event",
+ "type_name": "SensorEvent",
+ "description": "SensorEvent that has been changed, containing information about the sensor type and its values, which is used to update the scheduled object and send samples to the server.\n\nEvent has sensor type and name, which are accessed using event.sensor.getType() and event.sensor.getName(). It also contains an array of values, accessible via event.values[0].",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class MyActivity extends AppCompatActivity {\n\n private SensorManager sensorManager;\n private ScheduledSensableService scheduledSensableService;\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n // Initialize the sensor manager and service\n sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);\n scheduledSensableService = new ScheduledSensableService();\n\n // Start the service to begin sampling sensors\n Intent intent = new Intent(this, ScheduledSensableService.class);\n startService(intent);\n\n // Register a listener for changes in sensors\n sensorManager.registerListener(scheduledSensableService.getListener(new ScheduledSensable()), Sensor.TYPE_ACCELEROMETER, SensorManager.SENSOR_DELAY_NORMAL);\n }\n\n @Override\n protected void onDestroy() {\n super.onDestroy();\n // Unregister the listener to stop sampling sensors when the activity is destroyed\n sensorManager.unregisterListener(scheduledSensableService.getListener(new ScheduledSensable()));\n }\n}\n",
+ "description": ""
+ },
+ "name": "onSensorChanged",
+ "location": {
+ "start": 171,
+ "insert": 152,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 151,
+ "end": 170
+ }
+ },
+ "item_type": "method",
+ "length": 87,
+ "docLength": 19
+ },
+ {
+ "id": "fcd2d9f4-c8c5-978a-4546-9c2954b4fc08",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d",
+ "5b856de8-349f-8f8c-f545-6cf8345d8f72",
+ "1a01a3c9-e458-8b9c-3345-6138a2c4fc33"
+ ],
+ "description": "Logs a debug message to the console with the tag `TAG`, indicating that a successful post operation has been completed for a `SampleResponse`. The response object is also passed as an argument, but not used within the function.",
+ "params": [
+ {
+ "name": "success",
+ "type_name": "SampleResponse",
+ "description": "response returned by the server when the request is successful.",
+ "complex_type": false
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "HTTP response received from the server after successfully posting the sample.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SampleResponse success = new SampleResponse();\nResponse response = null;\n@Override\npublic void success(SampleResponse success, Response response) {\n Log.d(TAG, \"Success posting sample\");\n}\n",
+ "description": "\nThis method is called when a sample is successfully posted to the server. The 'success' parameter is an instance of the `SampleResponse` class and contains information about the successful post request. The 'response' parameter represents the result of the API call made by the `postSample` method."
+ },
+ "name": "success",
+ "location": {
+ "start": 227,
+ "insert": 210,
+ "offset": " ",
+ "indent": 20,
+ "comment": {
+ "start": 209,
+ "end": 226
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 17
+ },
+ {
+ "id": "6a5e3bcb-668e-5f86-f745-39b224d8cdf1",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d",
+ "5b856de8-349f-8f8c-f545-6cf8345d8f72",
+ "1a01a3c9-e458-8b9c-3345-6138a2c4fc33"
+ ],
+ "description": "Captures and logs an error that occurs when a request fails. It takes a `RetrofitError` object as input, converts it to a string, and logs the resulting error message at the error level with the tag `TAG`.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "error occurred during the request processing and provides details about the failure, which is then logged by the function.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void failure(RetrofitError retrofitError) {\n Log.e(TAG, \"Failed to post sample: \" + retrofitError.toString());\n}\n",
+ "description": "\nInput:\n\n* retrofitError: RetrofitError(\"Failed to retrieve data from server\", ResponseException(\"Unauthorized\"), 401)\n* RetroitError: RetrofitError(\"Failed to retrieve data from server\", IOException(\"Connection timed out\"), 500)"
+ },
+ "name": "failure",
+ "location": {
+ "start": 242,
+ "insert": 232,
+ "offset": " ",
+ "indent": 20,
+ "comment": {
+ "start": 231,
+ "end": 241
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 10
+ },
+ {
+ "id": "88c36098-82b6-6a91-074c-87f123451866",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d",
+ "5b856de8-349f-8f8c-f545-6cf8345d8f72"
+ ],
+ "description": "Is called when the accuracy of a sensor changes. It takes two parameters: the sensor that has changed accuracy and the new accuracy value. The function does not perform any specific actions, but it provides information about the change in sensor accuracy.",
+ "params": [
+ {
+ "name": "sensor",
+ "type_name": "Sensor",
+ "description": "Sensor object that is being monitored for changes in its accuracy.",
+ "complex_type": false
+ },
+ {
+ "name": "accuracy",
+ "type_name": "int",
+ "description": "current accuracy level of the sensor, which can be one of three values: SensorManager.SENSOR_STATUS_UNRELIABLE, SensorManager.SENSOR_STATUS_ACCURACY_HIGH, or SensorManager.SENSOR_STATUS_ACCURACY_LOW.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sensor sensor = new Sensor();\nint accuracy = 3;\n\nonAccuracyChanged(sensor, accuracy);\n",
+ "description": ""
+ },
+ "name": "onAccuracyChanged",
+ "location": {
+ "start": 271,
+ "insert": 259,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 258,
+ "end": 270
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 12
+ },
+ {
+ "id": "996ad587-6cd8-3d87-b34b-cd60f1bb17fa",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d"
+ ],
+ "description": "Returns an instance of `IBinder`, which is a reference to the interface that can be used by clients to communicate with the service. The returned object is null, indicating that no binding is being established between the client and the service.",
+ "params": [
+ {
+ "name": "intent",
+ "type_name": "Intent",
+ "description": "Intent object that is being bound to the Service, providing information about the action requested by the client application.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "IBinder",
+ "description": "a null instance of `IBinder`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Intent intent = new Intent(\"example_intent\");\nIBinder binder = onBind(intent);\n",
+ "description": "\n\nIn this code, the onBind method is called with a sample Intent object \"intent\" and it returns null as per the requirement of the problem."
+ },
+ "name": "onBind",
+ "location": {
+ "start": 301,
+ "insert": 278,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 277,
+ "end": 300
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 23
+ },
+ {
+ "id": "5f4603e9-b2ca-ff92-1c40-66dce4b0b046",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d"
+ ],
+ "description": "Retrieves a user's access token from the device's shared preferences if they are logged in and have an access token stored. If not, it returns an empty string. It also logs various messages to the debug log for debugging purposes.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the user's access token or an empty string.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "String accessToken = ScheduledSensableService.this.getUserAccessToken();\nif (accessToken.isEmpty()) {\n Log.d(TAG, \"No access token available\");\n} else {\n Log.d(TAG, \"Access token: \" + accessToken);\n}\n",
+ "description": ""
+ },
+ "name": "getUserAccessToken",
+ "location": {
+ "start": 328,
+ "insert": 307,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 306,
+ "end": 327
+ }
+ },
+ "item_type": "method",
+ "length": 23,
+ "docLength": 21
+ },
+ {
+ "id": "ff53cc9e-2aed-87bc-3f41-5634dc550d47",
+ "ancestors": [
+ "5a4156ee-dba8-65a7-eb45-f58287a12a4d"
+ ],
+ "description": "Retrieves the last known location from a network provider using a LocationManager. It obtains a reference to the current application context and a location manager, then requests the last known location from the network provider.",
+ "params": [],
+ "returns": {
+ "type_name": "Location",
+ "description": "a `Location` object representing the device's last known geographical position.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Location location = getLocation();\nif(location != null) {\n Log.d(\"TAG\", \"Latitude: \" + location.getLatitude() + \", Longitude: \" + location.getLongitude());\n} else {\n Log.d(\"TAG\", \"Failed to get the current location\");\n}\n",
+ "description": ""
+ },
+ "name": "getLocation",
+ "location": {
+ "start": 366,
+ "insert": 352,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 351,
+ "end": 365
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 14
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "ScheduleHelper.java",
+ "path": "client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java",
+ "content": {
+ "structured": {
+ "description": "A ScheduleHelper class that assists in managing scheduled tasks for a sensory system using Android's AlarmManager and ContentResolver classes from the android.content package. It provides methods for creating and removing scheduled tasks, querying the number of scheduled tasks, inserting and updating data in a SQLite database, and updating favourite objects if available.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_2 {\n label=\"io/sensable\"\n color=\"#33363A\"\n Sensable []\n ScheduledSensable []\n CreateSensableFragment []\n SensableActivity []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n ScheduledSensableContentProvider []\n ScheduledSensablesTable []\n FavouriteSensablesFragment []\n LocalSensablesFragment []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n ScheduleHelper [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n SavedSensablesTable []\n SensableContentProvider []\n }\n }\n subgraph cluster_4 {\n label=\"android\"\n color=\"#33363A\"\n Uri [label=\"android.net.Uri\", style=\"rounded,filled\"]\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n AlarmManager [label=\"android.app.AlarmManager\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n PendingIntent [label=\"android.app.PendingIntent\", style=\"rounded,filled\"]\n }\n ScheduleHelper -> Uri [style=\"dashed\"]\n SensableActivity -> ScheduleHelper [style=\"dashed\"]\n FavouriteSensablesFragment -> ScheduleHelper [style=\"dashed\"]\n ScheduleHelper -> Cursor [style=\"dashed\"]\n CreateSensableFragment -> ScheduleHelper [style=\"dashed\"]\n ScheduleHelper -> SavedSensablesTable [style=\"dashed\"]\n ScheduleHelper -> Context [style=\"dashed\"]\n ScheduledSensable -> ScheduleHelper [penwidth=6]\n ScheduleHelper -> ScheduledSensableContentProvider [style=\"dashed\"]\n ScheduleHelper -> Sensable [style=\"dashed\"]\n LocalSensablesFragment -> ScheduleHelper [style=\"dashed\"]\n ScheduleHelper -> Log [style=\"dashed\"]\n ScheduleHelper -> ContentValues [style=\"dashed\"]\n ScheduleHelper -> ScheduledSensable [style=\"dashed\"]\n ScheduleHelper -> ScheduledSensablesTable [style=\"dashed\"]\n Context -> ScheduleHelper [penwidth=1]\n ScheduleHelper -> PendingIntent [style=\"dashed\"]\n ScheduleHelper -> AlarmManager [style=\"dashed\"]\n ScheduleHelper -> SensableContentProvider [style=\"dashed\"]\n ScheduleHelper -> Cursor [penwidth=1]\n ScheduleHelper -> Intent [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensableappcontentdatabasenetutilclientAlarmManagerPendingIntentContentValuesContextIntentCursorUriLogmodelCreateSensableFragmentschedulerSensableActivitysqliteScheduledSensableSensableviewsScheduleHelperSavedSensablesTableScheduledSensableContentProviderScheduledSensablesTableSensableContentProviderFavouriteSensablesFragmentLocalSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.app.AlarmManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.app.PendingIntent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.net.Uri: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.scheduler.ScheduleHelper: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> android.database.Cursor: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.scheduler.ScheduleHelper: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.app.PendingIntent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.AlarmManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "afb4fd69-9bbd-23b3-7b44-fab7124c69d1",
+ "ancestors": [],
+ "description": "Manages scheduled tasks for a sensory system, allowing for creation, deletion, and updating of scheduled sensables. It utilizes Android's AlarmManager to schedule tasks at specific intervals and ContentResolver to interact with the device's data storage. The class provides methods for checking the status of scheduled tasks, stopping or canceling schedules, and updating favourite objects.",
+ "name": "ScheduleHelper",
+ "location": {
+ "start": 27,
+ "insert": 21,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 20,
+ "end": 26
+ }
+ },
+ "item_type": "class",
+ "length": 287,
+ "docLength": 6
+ },
+ {
+ "id": "95593d44-a648-cbb1-494b-bc7c15d82eca",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Starts or resumes a recurring task on an Android device using AlarmManager. If an existing alarm is found, it exits without recreating it; otherwise, it creates and schedules the task to run every 15 minutes.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public void onButtonClick(View view) {\n ScheduleHelper scheduleHelper = new ScheduleHelper(this);\n scheduleHelper.startScheduler();\n}\n",
+ "description": ""
+ },
+ "name": "startScheduler",
+ "location": {
+ "start": 43,
+ "insert": 39,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 38,
+ "end": 42
+ }
+ },
+ "item_type": "method",
+ "length": 13,
+ "docLength": 4
+ },
+ {
+ "id": "3db168dd-4d94-5194-344f-ec8a1365aaa9",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Queries the content resolver for a cursor containing all scheduled tasks, returning it as a result. It uses the `Uri.parse` method to obtain the URI for the ScheduledSensableContentProvider and then passes this URI along with an empty projection, null selection criteria, and null sort order to the query method.",
+ "params": [],
+ "returns": {
+ "type_name": "Cursor",
+ "description": "a cursor object representing scheduled tasks.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Cursor cursor = scheduleHelper.getScheduledTasks();\n",
+ "description": "\nThis will return a Cursor object that represents the scheduled tasks stored in the database."
+ },
+ "name": "getScheduledTasks",
+ "location": {
+ "start": 77,
+ "insert": 57,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 56,
+ "end": 76
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 20
+ },
+ {
+ "id": "061f2cda-12f4-8c83-8e45-78d718e1ede6",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Retrieves and returns the count of scheduled tasks from a designated source using the `getSchedueldTasks` method. The returned value represents the number of tasks that are currently scheduled for execution. This function encapsulates the logic to retrieve task count in a concise manner.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing the number of scheduled tasks.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "int scheduledTaskCount = new ScheduleHelper(context).countScheduledTasks();\nLog.d(TAG, \"Number of Scheduled Tasks: \" + scheduledTaskCount);\n",
+ "description": ""
+ },
+ "name": "countScheduledTasks",
+ "location": {
+ "start": 88,
+ "insert": 82,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 81,
+ "end": 87
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "f95bef8c-a55d-06ba-3143-b92fbde7b1f0",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Queries a content provider for a URI related to pending scheduled tasks. It returns the number of rows in the result set, representing the count of pending scheduled tasks. The query uses a cursor to retrieve data from the content resolver.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing the number of pending scheduled tasks.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "int pendingTaskCount = scheduleHelper.countPendingScheduledTasks();\nSystem.out.println(\"Number of pending scheduled tasks: \" + pendingTaskCount);\n",
+ "description": ""
+ },
+ "name": "countPendingScheduledTasks",
+ "location": {
+ "start": 98,
+ "insert": 92,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 91,
+ "end": 97
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 6
+ },
+ {
+ "id": "c42a35b4-8a8b-5aba-4544-7b85f0c934f0",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Cancels a scheduled task if no tasks are pending. It checks the count of scheduled tasks and, if zero, stops the scheduler by canceling a pending intent that triggers the ScheduledSensableService class. The function then returns true.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating successful cancellation of scheduled tasks.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "stopSchedulerIfNotNeeded();\n",
+ "description": ""
+ },
+ "name": "stopSchedulerIfNotNeeded",
+ "location": {
+ "start": 110,
+ "insert": 104,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 103,
+ "end": 109
+ }
+ },
+ "item_type": "method",
+ "length": 8,
+ "docLength": 6
+ },
+ {
+ "id": "ed8a37e3-1606-38af-fe4b-9c199b878a9c",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Inserts a new scheduled sensable into the SQLite database, using the provided ScheduledSensableContentProvider and ContentValues for serialization. It returns true upon successful insertion.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "ScheduledSensable object that needs to be added to the SQLite database through the content provider.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating successful insertion of data.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setSensorid(\"123456\");\nscheduledSensable.setSample(1.0);\n\nScheduleHelper scheduleHelper = new ScheduleHelper(context);\nboolean result = scheduleHelper.addSensableToScheduler(scheduledSensable);\n",
+ "description": ""
+ },
+ "name": "addSensableToScheduler",
+ "location": {
+ "start": 142,
+ "insert": 119,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 118,
+ "end": 141
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 23
+ },
+ {
+ "id": "20948451-743e-44ad-7647-f190c2d3e1de",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Removes a scheduled sensable from the scheduler by deleting its corresponding entry from the content provider. It returns true if the deletion is successful, and false otherwise.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "ScheduledSensable object whose ID is used to delete the corresponding row from the content provider.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating deletion success.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\n// Set the ID, sensorid, and sample for the scheduledSensable\nscheduledSensable.setId(\"12345\");\nscheduledSensable.setSensorid(\"s1\");\nscheduledSensable.setSample(10);\n\nboolean result = scheduleHelper.removeSensableFromScheduler(scheduledSensable);\n",
+ "description": ""
+ },
+ "name": "removeSensableFromScheduler",
+ "location": {
+ "start": 181,
+ "insert": 152,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 151,
+ "end": 180
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 29
+ },
+ {
+ "id": "b788952c-ca48-d6a4-0d42-e92d352821e7",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Sets the `pending` field of a `ScheduledSensable` object to 1 and updates a `sensable sender`. It returns a boolean value indicating whether the update was successful.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "object that needs to have its pending status set and then updated by calling the `updateSensableSender` method.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating successful or unsuccessful processing.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\n// Set the properties of the ScheduledSensable object...\nboolean result = scheduleHelper.setSensablePending(scheduledSensable);\n",
+ "description": "\nNote: The `scheduleHelper` object is an instance of `ScheduleHelper` class."
+ },
+ "name": "setSensablePending",
+ "location": {
+ "start": 200,
+ "insert": 186,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 185,
+ "end": 199
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 14
+ },
+ {
+ "id": "2ec16b8a-3647-0aa8-e941-4d275ff12ceb",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Sets the pending value of a ScheduledSensable object to 0 and then calls the `updateSensableSender` method with the updated object, returning its result.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "object whose pending status is being unset and updated for sending to a sensable sender.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating the result of updating the sensable sender.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\n// Initialize the object with required data...\n\nboolean success = scheduleHelper.unsetSensablePending(scheduledSensable);\nif (success) {\n Log.d(TAG, \"Scheduled Sensable is unset pending successfully\");\n} else {\n Log.e(TAG, \"Failed to unset scheduled sensable pending\");\n}\n",
+ "description": ""
+ },
+ "name": "unsetSensablePending",
+ "location": {
+ "start": 220,
+ "insert": 205,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 204,
+ "end": 219
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 15
+ },
+ {
+ "id": "02833688-be46-2899-7442-5da0630e849d",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Updates a scheduled sensable record in a SQLite database by serializing the object into ContentValues, then updating the corresponding Uri with these values. The function returns true if the update is successful and false otherwise.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "scheduled sensable object to be updated in the SQLite database and its serialized values are used to update the corresponding record in the database.\n\nSerializeScheduledSensableForSqlLite returns ContentValues with serialized data from ScheduledSensable.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean indicating whether any rows were updated.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setId(123);\n// other initialization for scheduledSensable...\n\nboolean result = ScheduleHelper.getInstance().updateSensableSender(scheduledSensable);\n\nif(result) {\n Log.d(TAG, \"Scheduled sensable updated successfully\");\n} else {\n Log.e(TAG, \"Failed to update scheduled sensable\");\n}\n",
+ "description": ""
+ },
+ "name": "updateSensableSender",
+ "location": {
+ "start": 245,
+ "insert": 225,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 224,
+ "end": 244
+ }
+ },
+ "item_type": "method",
+ "length": 16,
+ "docLength": 20
+ },
+ {
+ "id": "b4300b05-36f9-f69a-aa4b-5ba83cd78e2b",
+ "ancestors": [
+ "afb4fd69-9bbd-23b3-7b44-fab7124c69d1"
+ ],
+ "description": "Checks if a scheduled sensable is also favourited. If it is, updates the favourite sample and returns true; otherwise, returns false.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "sensor data to be processed and potentially updated as a favourite sample in the system.\n\nExtracted from `scheduledSensable`: \n- Sensorid\n- Sample",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating update success.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setSensorid(1);\nscheduledSensable.setSample(\"Some Sample\");\n\nScheduleHelper scheduleHelper = new ScheduleHelper(context);\nboolean result = scheduleHelper.updateFavouriteIfAvailable(scheduledSensable);\n",
+ "description": "\nIn this example, a `ScheduledSensable` object is created with a sensor ID and sample. The `updateFavouriteIfAvailable` method is then called on the `ScheduleHelper` instance, passing in the `scheduledSensable` object as an argument."
+ },
+ "name": "updateFavouriteIfAvailable",
+ "location": {
+ "start": 288,
+ "insert": 262,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 261,
+ "end": 287
+ }
+ },
+ "item_type": "method",
+ "length": 24,
+ "docLength": 26
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "Config.java",
+ "path": "client/src/main/java/io/sensable/client/settings/Config.java",
+ "content": {
+ "structured": {
+ "description": "A class named Config that holds configuration variables for an SQLite database and its dump. The class provides static final strings for the filenames of the database and its dump, as well as a version number. These values are used by the sensable client settings to store rule repository, item cache, and other structured data on disk.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n Config [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n SensableDatabaseHelper []\n SensableDatabaseHelper -> Config [style=\"dashed\"]\n}\n",
+ "d2": "iosensableclientsqlitesettingsSensableDatabaseHelperConfigimports\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.sqlite.SensableDatabaseHelper -> io.sensable.client.settings.Config: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableDatabaseHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.settings.Config: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.settings.Config: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "b1b5f564-3044-8988-8947-6ad3e3919bef",
+ "ancestors": [],
+ "description": "Holds static final variables for SQLite database filename, its dump filename and version number.\n",
+ "fields": [
+ {
+ "name": "SENSABLE_STORAGE_DB",
+ "type_name": "String",
+ "value": "\"sensable_storage.db\"",
+ "constant": true,
+ "class_name": "Config",
+ "description": "represents the filename for an on-disk SQLite database."
+ },
+ {
+ "name": "SENSABLE_STORAGE_DB_DUMP",
+ "type_name": "String",
+ "value": "\"sensable_storage__dump.db\"",
+ "constant": true,
+ "class_name": "Config",
+ "description": "specifies the filename for an on-disk dump of the SQLite database used for debugging purposes."
+ },
+ {
+ "name": "SENSABLE_STORAGE_DB_VERSION",
+ "type_name": "int",
+ "value": "6",
+ "constant": true,
+ "class_name": "Config",
+ "description": "represents the current version of the SQLite database used by the sensable client settings."
+ }
+ ],
+ "name": "Config",
+ "location": {
+ "start": 24,
+ "insert": 13,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 12,
+ "end": 23
+ }
+ },
+ "item_type": "class",
+ "length": 24,
+ "docLength": 11
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "AboutActivity.java",
+ "path": "client/src/main/java/io/sensable/client/AboutActivity.java",
+ "content": {
+ "structured": {
+ "description": "An Android activity called AboutActivity that retrieves statistics from a SensableService via REST API and updates a text view with the count. The statistics include the total number of samples processed by the service. The activity uses Retrofit for networking and logging, and formats the output using NumberFormat.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n Activity [label=\"android.app.Activity\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n MenuItem [label=\"android.view.MenuItem\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n Spanned [label=\"android.text.Spanned\", style=\"rounded,filled\"]\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n TextView [label=\"android.widget.TextView\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n AboutActivity [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Html [label=\"android.text.Html\", style=\"rounded,filled\"]\n NumberFormat [label=\"java.text.NumberFormat\", style=\"rounded,filled\"]\n Menu [label=\"android.view.Menu\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n SensableService []\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n DecimalFormat [label=\"java.text.DecimalFormat\", style=\"rounded,filled\"]\n Statistics []\n Response -> AboutActivity [penwidth=1]\n AboutActivity -> Spanned [style=\"dashed\"]\n AboutActivity -> Html [style=\"dashed\"]\n AboutActivity -> Activity [style=\"dashed\"]\n AboutActivity -> View [style=\"dashed\"]\n AboutActivity -> TextView [style=\"dashed\"]\n AboutActivity -> MenuItem [style=\"dashed\"]\n AboutActivity -> Callback [style=\"dashed\"]\n RetrofitError -> AboutActivity [penwidth=1]\n AboutActivity -> Menu [style=\"dashed\"]\n AboutActivity -> Bundle [style=\"dashed\"]\n Statistics -> AboutActivity [penwidth=1]\n AboutActivity -> Statistics [style=\"dashed\"]\n AboutActivity -> RestAdapter [style=\"dashed\"]\n AboutActivity -> Response [style=\"dashed\"]\n Bundle -> AboutActivity [penwidth=1]\n AboutActivity -> RetrofitError [style=\"dashed\"]\n AboutActivity -> DecimalFormat [style=\"dashed\"]\n AboutActivity -> NumberFormat [style=\"dashed\"]\n AboutActivity -> Log [style=\"dashed\"]\n AboutActivity -> SensableService [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidretrofitjavasensableappostextutilviewwidgetCallbackRestAdapterRetrofitErrorclienttextclientActivityBundleHtmlSpannedLogMenuMenuItemViewTextViewSensableServicemodelResponseDecimalFormatNumberFormatAboutActivityStatisticsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.AboutActivity -> android.app.Activity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.text.Html: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.text.Spanned: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.view.Menu: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.view.MenuItem: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> android.widget.TextView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> io.sensable.model.Statistics: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> java.text.DecimalFormat: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> java.text.NumberFormat: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.AboutActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Statistics -> io.sensable.client.AboutActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.RetrofitError -> io.sensable.client.AboutActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.client.Response -> io.sensable.client.AboutActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.MenuItem: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.text.DecimalFormat: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.text.Spanned: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.Menu: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.TextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.text.Html: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.Activity: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.text.NumberFormat: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.AboutActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Statistics: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.AboutActivity: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "6a74e3e6-c21d-038f-2742-093d4bb1173b",
+ "ancestors": [],
+ "description": "Extends Activity and provides functionality to retrieve sample count from sensable.io via Rest API and display it in a text view. It also sets formatted text from a resource string in another text view. The loadStatistics method is responsible for fetching the statistics.",
+ "name": "AboutActivity",
+ "location": {
+ "start": 22,
+ "insert": 22,
+ "offset": " ",
+ "indent": 0,
+ "comment": null
+ },
+ "item_type": "class",
+ "length": 83,
+ "docLength": null
+ },
+ {
+ "id": "df1308de-8390-8894-d142-a01634b3e111",
+ "ancestors": [
+ "6a74e3e6-c21d-038f-2742-093d4bb1173b"
+ ],
+ "description": "Sets the layout, retrieves a TextView by ID, formats HTML text, and displays it on the screen. It also loads statistics and assigns them to another TextView. This is a typical initialization method for an Android activity.",
+ "params": [
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "Bundle object that contains the activity's saved state from a previous invocation of its lifecycle methods.\n\nBundle contains key-value pairs to preserve instance state across process death. It includes data about fragments that were previously added and removed, as well as other relevant details.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_about);\n\n TextView view = (TextView)findViewById(R.id.about_text);\n String formattedText = getString(R.string.about_text);\n Spanned result = Html.fromHtml(formattedText);\n view.setText(result);\n\n loadStatistics();\n}\n",
+ "description": "\n\nExample input for savedInstanceState: Bundle()."
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 27,
+ "insert": 27,
+ "offset": " ",
+ "indent": 4,
+ "comment": null
+ },
+ "item_type": "method",
+ "length": 15,
+ "docLength": null
+ },
+ {
+ "id": "33c06385-4a98-b983-c84b-d18e5ca5ba7e",
+ "ancestors": [
+ "6a74e3e6-c21d-038f-2742-093d4bb1173b"
+ ],
+ "description": "Loads statistics from a REST API and updates a text view with the count of samples processed. It handles successful responses by logging the count and updating the text view, and failure cases by logging errors and hiding the text view.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "loadStatistics();\n",
+ "description": ""
+ },
+ "name": "loadStatistics",
+ "location": {
+ "start": 47,
+ "insert": 43,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 42,
+ "end": 46
+ }
+ },
+ "item_type": "method",
+ "length": 56,
+ "docLength": 4
+ },
+ {
+ "id": "ec40fb84-ba52-8c83-074e-ae7108b8e0ed",
+ "ancestors": [
+ "6a74e3e6-c21d-038f-2742-093d4bb1173b",
+ "33c06385-4a98-b983-c84b-d18e5ca5ba7e"
+ ],
+ "description": "Logs a debug message and updates the UI component `statistics` with the count from the received `Statistics` object, formatted as a string. The format includes the count and a text describing the data source \"sensable.io\".",
+ "params": [
+ {
+ "name": "statisticsResponse",
+ "type_name": "Statistics",
+ "description": "response object that contains the count of samples from the API, which is then used to set the text of a UI component named `statistics`.",
+ "complex_type": false
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "response object that contains the result of the request, but its content is not used within the method.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Statistics statisticsResponse = new Statistics();\nstatisticsResponse.setCount(100);\nsuccess(statisticsResponse, null);\n",
+ "description": ""
+ },
+ "name": "success",
+ "location": {
+ "start": 78,
+ "insert": 56,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 55,
+ "end": 77
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 22
+ },
+ {
+ "id": "da6c1727-6f52-0b9d-174a-17dc5c3738d3",
+ "ancestors": [
+ "6a74e3e6-c21d-038f-2742-093d4bb1173b",
+ "33c06385-4a98-b983-c84b-d18e5ca5ba7e"
+ ],
+ "description": "Logs an error message to the console when a callback request fails. It also hides a UI component named `statistics`. The function is part of a class that handles API requests using Retrofit, and it deals with exceptions or errors that occur during the request process.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "error that occurred during the network request, providing information about the failure such as the HTTP status code and any error message.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onFailure(RetrofitError retrofitError) {\n Log.e(TAG, \"Callback failure\" + retrofitError.toString());\n statistics.setVisibility(View.GONE);\n}\n",
+ "description": "\nExample input: retrofitError = RetrofitError.UNEXPECTED_ERROR;"
+ },
+ "name": "failure",
+ "location": {
+ "start": 96,
+ "insert": 85,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 84,
+ "end": 95
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 11
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "CreateSensableFragment.java",
+ "path": "client/src/main/java/io/sensable/client/CreateSensableFragment.java",
+ "content": {
+ "structured": {
+ "description": "A dialog fragment responsible for creating and scheduling sensory data objects using the Sensable API. It provides a user interface for selecting sensor types and entering sensable IDs, and handles button clicks to create scheduled sensables, bookmark them locally, and start the scheduler. The code uses Android's LocationManager to retrieve the last known location of the device and stores saved sensables in a SQLite database using a ContentProvider.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"android\"\n color=\"#33363A\"\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n Dialog [label=\"android.app.Dialog\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n SensorManager [label=\"android.hardware.SensorManager\", style=\"rounded,filled\"]\n Sensor [label=\"android.hardware.Sensor\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Uri [label=\"android.net.Uri\", style=\"rounded,filled\"]\n SharedPreferences [label=\"android.content.SharedPreferences\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n Location [label=\"android.location.Location\", style=\"rounded,filled\"]\n LocationManager [label=\"android.location.LocationManager\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n DialogFragment [label=\"android.app.DialogFragment\", style=\"rounded,filled\"]\n }\n subgraph cluster_2 {\n label=\"io\"\n color=\"#33363A\"\n SensableService []\n subgraph cluster_3 {\n label=\"sensable\"\n color=\"#33363A\"\n Sample []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n CreateSensableFragment [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Sensable []\n CreateSensableListener []\n ScheduledSensable []\n SampleResponse []\n subgraph cluster_4 {\n label=\"client\"\n color=\"#33363A\"\n SavedSensablesTable []\n SensableContentProvider []\n ScheduleHelper []\n }\n }\n }\n subgraph cluster_5 {\n label=\"java\"\n color=\"#33363A\"\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n ArrayList [label=\"java.util.ArrayList\", style=\"rounded,filled\"]\n }\n subgraph cluster_6 {\n label=\"retrofit\"\n color=\"#33363A\"\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n }\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n CreateSensableFragment -> Location [style=\"dashed\"]\n CreateSensableFragment -> Bundle [style=\"dashed\"]\n ViewGroup -> CreateSensableFragment [penwidth=1]\n CreateSensableFragment -> ContentValues [style=\"dashed\"]\n CreateSensableFragment -> Sensor [style=\"dashed\"]\n CreateSensableFragment -> Sample [style=\"dashed\"]\n CreateSensableFragment -> Sensable [style=\"dashed\"]\n RetrofitError -> CreateSensableFragment [penwidth=1]\n CreateSensableFragment -> View [dir=\"both\", penwidth=3]\n CreateSensableFragment -> LocationManager [style=\"dashed\"]\n CreateSensableFragment -> SavedSensablesTable [style=\"dashed\"]\n CreateSensableFragment -> SampleResponse [style=\"dashed\"]\n CreateSensableFragment -> Response [style=\"dashed\"]\n CreateSensableFragment -> ViewGroup [style=\"dashed\"]\n CreateSensableFragment -> Location [penwidth=1]\n Response -> CreateSensableFragment [penwidth=1]\n CreateSensableFragment -> ArrayList [style=\"dashed\"]\n CreateSensableFragment -> List [style=\"dashed\"]\n CreateSensableFragment -> SensableContentProvider [style=\"dashed\"]\n ScheduledSensable -> CreateSensableFragment [penwidth=2]\n CreateSensableFragment -> RetrofitError [style=\"dashed\"]\n CreateSensableFragment -> LayoutInflater [style=\"dashed\"]\n CreateSensableFragment -> Context [style=\"dashed\"]\n CreateSensableFragment -> SensorManager [style=\"dashed\"]\n CreateSensableFragment -> SensableService [style=\"dashed\"]\n CreateSensableFragment -> ScheduledSensable [style=\"dashed\"]\n CreateSensableFragment -> Log [style=\"dashed\"]\n Sensable -> CreateSensableFragment [penwidth=2]\n LayoutInflater -> CreateSensableFragment [penwidth=1]\n SampleResponse -> CreateSensableFragment [penwidth=1]\n CreateSensableFragment -> View [style=\"dashed\"]\n CreateSensableFragment -> DialogFragment [style=\"dashed\"]\n CreateSensableFragment -> ScheduleHelper [style=\"dashed\"]\n CreateSensableFragment -> SharedPreferences [style=\"dashed\"]\n CreateSensableListener -> CreateSensableFragment [penwidth=1]\n CreateSensableFragment -> Uri [style=\"dashed\"]\n CreateSensableFragment -> Dialog [style=\"dashed\"]\n CreateSensableFragment -> Callback [style=\"dashed\"]\n Bundle -> CreateSensableFragment [penwidth=1]\n CreateSensableFragment -> RestAdapter [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidretrofitjavasensableappcontenthardwarelocationnetosutilviewCallbackRestAdapterRetrofitErrorclientutilclientDialogDialogFragmentContentValuesContextSharedPreferencesSensorSensorManagerLocationLocationManagerUriBundleLogLayoutInflaterViewViewGroupSensableServicemodelResponseArrayListListCreateSensableFragmentschedulersqliteSampleSampleResponseScheduledSensableSensableCreateSensableListenerScheduleHelperSavedSensablesTableSensableContentProviderimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> android.app.Dialog: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.app.DialogFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.content.SharedPreferences: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.hardware.Sensor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.hardware.SensorManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.location.Location: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.location.LocationManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.net.Uri: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.model.SampleResponse: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> java.util.ArrayList: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.LayoutInflater -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.CreateSensableFragment <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.CreateSensableFragment -> android.location.Location: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.CreateSensableListener -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleResponse -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.RetrofitError -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.client.Response -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.Sensor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.DialogFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.location.Location: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.ArrayList: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.hardware.SensorManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.location.LocationManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.SharedPreferences: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.Dialog: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableListener: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.location.Location: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "7a526e38-ae29-0194-8d42-9c1662a462a7",
+ "ancestors": [],
+ "description": "Is responsible for creating and scheduling sensables (sensors) in a Sensable API, allowing users to create favorite bookmarks and receive notifications when sensory data is created. It utilizes a Retrofit service to interact with the Sensable API, handles callbacks, and saves sensables locally using a SQLite database.",
+ "name": "CreateSensableFragment",
+ "location": {
+ "start": 42,
+ "insert": 36,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 35,
+ "end": 41
+ }
+ },
+ "item_type": "class",
+ "length": 472,
+ "docLength": 6
+ },
+ {
+ "id": "b3f96527-686a-51ad-ef48-0e8c35e058f3",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Allows for listeners to receive notifications when a scheduled sensable is confirmed.",
+ "name": "CreateSensableListener",
+ "location": {
+ "start": 55,
+ "insert": 52,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 51,
+ "end": 54
+ }
+ },
+ "item_type": "interface",
+ "length": 3,
+ "docLength": 3
+ },
+ {
+ "id": "d22d39e0-d92d-e391-044e-68f515da4385",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Inflates a layout, retrieves a list of sensors from the device's SensorManager, and populates a Spinner with their names. It also initializes an EditText field for user input and sets up a button listener. The returned View represents the UI component of this fragment.",
+ "params": [
+ {
+ "name": "inflater",
+ "type_name": "LayoutInflater",
+ "description": "LayoutInflater object that is used to inflate the layout file R.layout.create_sensable_layout into a View.\n\nInflate is an object of type `LayoutInflater`, which takes three parameters - `context`, `viewGroup`, and `savedInstanceState`. Its main property is that it inflates a layout file into a `View` object.",
+ "complex_type": true
+ },
+ {
+ "name": "container",
+ "type_name": "ViewGroup",
+ "description": "2D grid or stack that the newly created view is to be added to, allowing it to be part of the user interface hierarchy.\n\nContainer is an object of type `ViewGroup`. Its main properties include its layout parameters and the children views attached to it.",
+ "complex_type": true
+ },
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "Bundle object containing the activity's previous state, which is not used in this code.\n\nBundle object, contains data that was previously saved with ` onSaveInstanceState`.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "View",
+ "description": "a custom dialog with a spinner and text field.\n\nA View object is created by inflating the layout create_sensable_layout with null parent. The title of the dialog is set to a string resource from the activity context. A Spinner widget is populated with a list of sensor names retrieved from a SensorManager instance. An EditText widget is used to input sensable ID.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "View view = onCreateView(inflater, container, savedInstanceState);\n",
+ "description": "\nOnly these two variables are required as input: 'inflater' and 'container'. 'inflater' should be a valid instance of 'LayoutInflater', and 'container' should be a valid 'ViewGroup'."
+ },
+ "name": "onCreateView",
+ "location": {
+ "start": 131,
+ "insert": 62,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 61,
+ "end": 130
+ }
+ },
+ "item_type": "method",
+ "length": 25,
+ "docLength": 69
+ },
+ {
+ "id": "90bedc4e-7374-14bc-344d-e577706a61e3",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Assigns a specified instance to a private field. It takes an object of type `CreateSensableListener` as its parameter and updates the internal state by setting it equal to the received value.",
+ "params": [
+ {
+ "name": "createSensableListener",
+ "type_name": "CreateSensableListener",
+ "description": "object to be assigned as the listener for creating sensable events.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class MainActivity extends AppCompatActivity {\n\n private CreateSensableFragment createSensableFragment;\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n // Initialize the fragment\n createSensableFragment = new CreateSensableFragment();\n setCreateSensableListener(createSensableFragment);\n\n // ... other code ...\n }\n\n public void setCreateSensableListener(CreateSensableListener createSensableListener) {\n this.createSensableFragment.setCreateSensableListener(createSensableListener);\n }\n}\n",
+ "description": "\nIn the above example, we are creating an instance of `CreateSensableFragment` and then setting its listener using the `setCreateSensableListener` method."
+ },
+ "name": "setCreateSensableListener",
+ "location": {
+ "start": 173,
+ "insert": 157,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 156,
+ "end": 172
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 16
+ },
+ {
+ "id": "be7c660d-7efd-d991-9f44-82d56db6109a",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Creates a new scheduled sensable object and sets its sensor ID based on user input from a spinner. It then schedules the sensable using a listener, creates a bookmark for it, and dismisses the fragment.",
+ "params": [
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "View that was clicked, providing the event trigger for the function to execute.\n\n• sensorSpinner: A Spinner object that is found by its ID in the view.\n• submitButton: A Button object that is found by its ID in the view.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "View view = new View(getActivity());\naddListenerOnButton(view);\n",
+ "description": ""
+ },
+ "name": "addListenerOnButton",
+ "location": {
+ "start": 197,
+ "insert": 177,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 176,
+ "end": 196
+ }
+ },
+ "item_type": "method",
+ "length": 141,
+ "docLength": 20
+ },
+ {
+ "id": "cdc69956-190f-cc91-7a47-4e8118721218",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7",
+ "be7c660d-7efd-d991-9f44-82d56db6109a"
+ ],
+ "description": "Creates a new scheduled sensable and its corresponding bookmark when a user clicks a button, provided that a sensable ID is entered. The function interacts with a RESTful API to create the objects and save them, also handling errors if they occur.",
+ "params": [
+ {
+ "name": "v",
+ "type_name": "View",
+ "description": "View that triggered the onClick event, which is not used explicitly in this function.\n\nView v: A View object passed as an argument to this method.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Button button = (Button) findViewById(R.id.create_sensable_button);\nbutton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n // Example usage of the method\n CreateSensableFragment fragment = new CreateSensableFragment();\n fragment.sensableId.setText(\"MySensor\");\n fragment.sensorSpinner.setSelection(0); // Assuming there are sensor options in the spinner\n\n // Rest of your code here...\n }\n});\n",
+ "description": ""
+ },
+ "name": "onClick",
+ "location": {
+ "start": 227,
+ "insert": 205,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 204,
+ "end": 226
+ }
+ },
+ "item_type": "method",
+ "length": 107,
+ "docLength": 22
+ },
+ {
+ "id": "7273fdbb-e403-6eae-8549-8a9d9f5347c2",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7",
+ "be7c660d-7efd-d991-9f44-82d56db6109a",
+ "cdc69956-190f-cc91-7a47-4e8118721218"
+ ],
+ "description": "Processes a successful callback response by logging the result and setting IDs for sensors. It schedules the sensable, creates a favourite bookmark, and triggers an onConfirmed event before dismissing the current view.",
+ "params": [
+ {
+ "name": "sampleResponse",
+ "type_name": "SampleResponse",
+ "description": "response from the service that contains data to be processed, such as the sensor ID and message.\n\nHas a getter for message and sensorid.",
+ "complex_type": true
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "response from the service and is not used within the method.\n\nIt has no significant properties mentioned in the provided code snippet.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SampleResponse sampleResponse = new SampleResponse();\nsampleResponse.setMessage(\"Callback Success: Created Sensable\");\nResponse response = new Response();\ncreateScheduledSensable(scheduledSensable, sensable);\ncreateSensableListener.onConfirmed(scheduledSensable);\ndismiss();",
+ "description": ""
+ },
+ "name": "success",
+ "location": {
+ "start": 294,
+ "insert": 262,
+ "offset": " ",
+ "indent": 24,
+ "comment": {
+ "start": 261,
+ "end": 293
+ }
+ },
+ "item_type": "method",
+ "length": 13,
+ "docLength": 32
+ },
+ {
+ "id": "94b71dc6-074d-e6ac-3e42-be8da56aece6",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7",
+ "be7c660d-7efd-d991-9f44-82d56db6109a",
+ "cdc69956-190f-cc91-7a47-4e8118721218"
+ ],
+ "description": "Handles errors that occur during a Retrofit request. It logs an error message with a tag and displays a toast notification to the user with a custom error message when the request fails.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "Retrofit error object that provides information about the failure of the request.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "RetrofitError retrofitError = new RetrofitError(\"This is a sample error message\");\nfailure(retrofitError);\n",
+ "description": ""
+ },
+ "name": "failure",
+ "location": {
+ "start": 322,
+ "insert": 308,
+ "offset": " ",
+ "indent": 24,
+ "comment": {
+ "start": 307,
+ "end": 321
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 14
+ },
+ {
+ "id": "d3b189fa-5025-33ba-c141-979911c9c6f1",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Retrieves a user's access token from preferences if they are logged in and have an existing token. If not, it returns an empty string.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a valid access token or an empty string.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "String accessToken = getUserAccessToken();\nif (!accessToken.isEmpty()) {\n // Use the access token for authentication purposes\n} else {\n // Handle error, user is not logged in or has no access token\n}\n",
+ "description": ""
+ },
+ "name": "getUserAccessToken",
+ "location": {
+ "start": 359,
+ "insert": 339,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 338,
+ "end": 358
+ }
+ },
+ "item_type": "method",
+ "length": 23,
+ "docLength": 20
+ },
+ {
+ "id": "5e126847-a903-088c-a044-11eae84c9f6a",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Attempts to create a scheduled entry for a `Sensable` object and a local bookmark. It uses a `ScheduleHelper` to add the `Sensable` to the scheduler, starts the scheduler if necessary, and then saves the `Sensable` locally.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "scheduled entry to be added to the scheduler.\n\nScheduledSensable has no separate explanation since there's nothing more to add about its properties.",
+ "complex_type": true
+ },
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object to be created as a schedule entry and saved as a local bookmark.\n\nSensable has no explicitly declared properties, as it appears to be an object that is passed in through the method parameters. However, its type suggests it may have properties related to sensing or sensibility.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating success or failure.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public boolean createSensable() {\n ScheduledSensable scheduledSensable = new ScheduledSensable();\n // Set the properties for the scheduled sensable\n Sensable sensable = new Sensable();\n // Set the properties for the sensable\n\n return createScheduledSensable(scheduledSensable, sensable);\n}\n",
+ "description": ""
+ },
+ "name": "createScheduledSensable",
+ "location": {
+ "start": 418,
+ "insert": 384,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 383,
+ "end": 417
+ }
+ },
+ "item_type": "method",
+ "length": 17,
+ "docLength": 34
+ },
+ {
+ "id": "4bf63f87-59af-7b9a-214f-e05ab74972d1",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Inserts a new sensable object into the SQLite database by serializing it and using it as ContentValues, then inserting it into the SensableContentProvider's CONTENT_URI through the ContentResolver.",
+ "params": [
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object that needs to be saved, which is serialized into ContentValues for subsequent insertion into the SQLite database.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating successful insertion into the database.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Sensable sensable = new Sensable();\n sensable.setSensorid(\"sensable\");\n sensable.setType(\"Sensable\");\n\n boolean saved = saveSensable(sensable);\n System.out.println(saved); // This will print: true\n }\n}\n",
+ "description": ""
+ },
+ "name": "saveSensable",
+ "location": {
+ "start": 457,
+ "insert": 436,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 435,
+ "end": 456
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 21
+ },
+ {
+ "id": "15ea37c4-e27b-7487-554f-0c57c31aafce",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Searches for a sensor with a given name in a list and returns its type if found, or -1 if not. It iterates through the list and checks each sensor's name against the provided name, returning the first match.",
+ "params": [
+ {
+ "name": "sensorName",
+ "type_name": "String",
+ "description": "name of a sensor for which an object from the `sensorList` needs to be found and its type returned.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing the type of a sensor or -1 if not found.\n\nThe output is an integer, representing the type of the chosen sensor. If no matching sensor name is found in the list, -1 is returned as a default value.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "String sensorName = \"Accelerometer\";\nint sensorId = getSensorId(sensorName);\n",
+ "description": "\nIn this example, the method `getSensorId` takes a string as input and returns an integer representing the ID of the sensor corresponding to that name."
+ },
+ "name": "getSensorId",
+ "location": {
+ "start": 475,
+ "insert": 467,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 466,
+ "end": 474
+ }
+ },
+ "item_type": "method",
+ "length": 13,
+ "docLength": 8
+ },
+ {
+ "id": "09542c66-85c1-de9b-f443-d1918b817fd6",
+ "ancestors": [
+ "7a526e38-ae29-0194-8d42-9c1662a462a7"
+ ],
+ "description": "Retrieves the last known location using a network provider. It first obtains a reference to the location manager service and then requests the last known location from the specified provider. The obtained location is returned as an object of type `Location`.",
+ "params": [],
+ "returns": {
+ "type_name": "androidlocationLocation",
+ "description": "a `Location` object representing the last known location.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Location location = getLocation();\nif (location != null) {\n Log.d(TAG, \"Latitude: \" + location.getLatitude());\n Log.d(TAG, \"Longitude: \" + location.getLongitude());\n} else {\n Log.d(TAG, \"Failed to get last known location\");\n}\n",
+ "description": "\nThis code would attempt to retrieve the last known location of the device using the `getLastKnownLocation` method and then log the latitude and longitude values if a location is found."
+ },
+ "name": "getLocation",
+ "location": {
+ "start": 506,
+ "insert": 489,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 488,
+ "end": 505
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 17
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "MainActivity.java",
+ "path": "client/src/main/java/io/sensable/client/MainActivity.java",
+ "content": {
+ "structured": {
+ "description": "A main activity class that handles user interactions with sensors in an Android application. It implements an ActionBar.TabListener interface to manage tabs and fragments within the app's UI. The activity also provides methods for handling options menu items, login and logout functionality, creating new sensables, and updating the user interface based on changes in the logged-in status or sensor selection.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"android\"\n color=\"#33363A\"\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n TextView [label=\"android.widget.TextView\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n Menu [label=\"android.view.Menu\", style=\"rounded,filled\"]\n FragmentTransaction [label=\"android.app.FragmentTransaction\", style=\"rounded,filled\"]\n MenuItem [label=\"android.view.MenuItem\", style=\"rounded,filled\"]\n SharedPreferences [label=\"android.content.SharedPreferences\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n ActionBar [label=\"android.app.ActionBar\", style=\"rounded,filled\"]\n Toast [label=\"android.widget.Toast\", style=\"rounded,filled\"]\n subgraph cluster_2 {\n label=\"content\"\n color=\"#33363A\"\n Configuration [label=\"android.content.res.Configuration\", style=\"rounded,filled\"]\n }\n subgraph cluster_4 {\n label=\"support/v4\"\n color=\"#33363A\"\n FragmentManager [label=\"android.support.v4.app.FragmentManager\", style=\"rounded,filled\"]\n ViewPager [label=\"android.support.v4.view.ViewPager\", style=\"rounded,filled\"]\n FragmentActivity [label=\"android.support.v4.app.FragmentActivity\", style=\"rounded,filled\"]\n }\n }\n subgraph cluster_5 {\n label=\"retrofit\"\n color=\"#33363A\"\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n }\n subgraph cluster_6 {\n label=\"io\"\n color=\"#33363A\"\n SensableService []\n subgraph cluster_7 {\n label=\"sensable\"\n color=\"#33363A\"\n Statistics []\n ScheduledSensable []\n Sensable []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n MainActivity [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n UserLogin []\n subgraph cluster_8 {\n label=\"client\"\n color=\"#33363A\"\n TabsPagerAdapter []\n }\n }\n }\n subgraph cluster_9 {\n label=\"java\"\n color=\"#33363A\"\n NumberFormat [label=\"java.text.NumberFormat\", style=\"rounded,filled\"]\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n }\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n UserLogin -> MainActivity [penwidth=1]\n MainActivity -> FragmentManager [style=\"dashed\"]\n MainActivity -> Context [style=\"dashed\"]\n MenuItem -> MainActivity [penwidth=1]\n MainActivity -> UserLogin [style=\"dashed\"]\n MainActivity -> FragmentTransaction [style=\"dashed\"]\n MainActivity -> Configuration [style=\"dashed\"]\n MainActivity -> TextView [style=\"dashed\"]\n MainActivity -> RetrofitError [style=\"dashed\"]\n View -> MainActivity [penwidth=1]\n MainActivity -> ScheduledSensable [style=\"dashed\"]\n MainActivity -> Callback [style=\"dashed\"]\n MainActivity -> ActionBar [style=\"dashed\"]\n MainActivity -> Toast [style=\"dashed\"]\n MainActivity -> TabsPagerAdapter [style=\"dashed\"]\n MainActivity -> Sensable [style=\"dashed\"]\n MainActivity -> List [style=\"dashed\"]\n Bundle -> MainActivity [penwidth=1]\n MainActivity -> SharedPreferences [style=\"dashed\"]\n Configuration -> MainActivity [penwidth=1]\n MainActivity -> Intent [style=\"dashed\"]\n MainActivity -> FragmentActivity [style=\"dashed\"]\n MainActivity -> ViewPager [style=\"dashed\"]\n MainActivity -> Menu [style=\"dashed\"]\n MainActivity -> Log [style=\"dashed\"]\n MainActivity -> Statistics [style=\"dashed\"]\n MainActivity -> Response [style=\"dashed\"]\n ScheduledSensable -> MainActivity [penwidth=1]\n Menu -> MainActivity [penwidth=1]\n MainActivity -> RestAdapter [style=\"dashed\"]\n MainActivity -> Bundle [style=\"dashed\"]\n FragmentTransaction -> MainActivity [penwidth=3]\n MainActivity -> NumberFormat [style=\"dashed\"]\n MainActivity -> MenuItem [style=\"dashed\"]\n MainActivity -> View [style=\"dashed\"]\n MainActivity -> SensableService [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidretrofitjavasensableappsupportcontentosutilviewwidgetCallbackRestAdapterRetrofitErrorclienttextutilclientActionBarv4FragmentTransactionContextIntentSharedPreferencesresBundleLogMenuMenuItemViewTextViewToastSensableServicemodelResponseNumberFormatListMainActivityappConfigurationviewadapterScheduledSensableSensableStatisticsUserLoginFragmentManagerFragmentActivityViewPagerTabsPagerAdapterimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.MainActivity -> android.app.ActionBar: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.support.v4.app.FragmentManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.app.FragmentTransaction: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.content.SharedPreferences: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.content.res.Configuration: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.support.v4.app.FragmentActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.support.v4.view.ViewPager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.view.Menu: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.view.MenuItem: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.widget.TextView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> android.widget.Toast: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.client.adapter.TabsPagerAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.Statistics: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.UserLogin: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> java.text.NumberFormat: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.app.FragmentTransaction -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.content.res.Configuration -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.Menu -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.MenuItem -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.View -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.support.v4.app.FragmentActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.view.ViewPager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.MenuItem: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.Menu: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.res.Configuration: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.FragmentTransaction: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.SharedPreferences: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.Toast: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.ActionBar: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.FragmentManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.TextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.text.NumberFormat: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.FragmentTransaction: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Statistics: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.MenuItem: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.Menu: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.res.Configuration: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "ancestors": [],
+ "description": "Implements an ActionBar and ViewPager to manage multiple fragments and tabs, handling login and logout functionality, displaying a toast message upon login status update, and creating a new sensable user. It also provides callback interfaces for login status updates and sensable creation confirmation.",
+ "name": "MainActivity",
+ "location": {
+ "start": 43,
+ "insert": 36,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 35,
+ "end": 42
+ }
+ },
+ "item_type": "class",
+ "length": 429,
+ "docLength": 7
+ },
+ {
+ "id": "3bfafbd9-5014-1180-b54c-54ce9e354e83",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Provides a callback mechanism for receiving updates on the login status of a user after they have logged in or out.",
+ "name": "CallbackInterface",
+ "location": {
+ "start": 62,
+ "insert": 58,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 57,
+ "end": 61
+ }
+ },
+ "item_type": "interface",
+ "length": 3,
+ "docLength": 4
+ },
+ {
+ "id": "fa6f855b-2deb-2793-554d-c54198adfe09",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Sets up the main activity layout, retrieves shared preferences, creates a SensableUser object, checks login status and displays corresponding toast messages, and then initializes tabs.",
+ "params": [
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "Bundle object that contains the data while user is interacting with application and if user has pressed back button then it will show previous state of activity.\n\nBundle savedInstanceState contains key-value pairs representing the application's state. Its main properties include the key-value pairs themselves and their respective ordering, allowing for efficient storage and retrieval of data.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Bundle savedInstanceState = new Bundle();\nonCreate(savedInstanceState);\n",
+ "description": ""
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 81,
+ "insert": 66,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 65,
+ "end": 80
+ }
+ },
+ "item_type": "method",
+ "length": 15,
+ "docLength": 15
+ },
+ {
+ "id": "11d0c649-6bba-8586-4045-3eea8309306a",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Sets up a tabbed interface with a ViewPager and ActionBar, creating tabs from an array of tab names and setting their corresponding listeners. It also configures the ViewPager to update the selected tab based on page changes.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "initialiseTabs();\n",
+ "description": "\nIt simply calls the `initialiseTabs` method to set up the ViewPager and ActionBar with tabs, including adding tab listeners for selection events."
+ },
+ "name": "initialiseTabs",
+ "location": {
+ "start": 102,
+ "insert": 97,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 96,
+ "end": 101
+ }
+ },
+ "item_type": "method",
+ "length": 64,
+ "docLength": 5
+ },
+ {
+ "id": "01897165-4da8-359a-f54c-b830daf0e70c",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "11d0c649-6bba-8586-4045-3eea8309306a"
+ ],
+ "description": "Selects a navigation item in an action bar based on the given position. When a page is changed, it makes the corresponding tab selected in the action bar.",
+ "params": [
+ {
+ "name": "position",
+ "type_name": "int",
+ "description": "0-based index of the selected item or page, which is used to select the corresponding navigation item on the action bar.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "actionBar.setSelectedNavigationItem(0);\n",
+ "description": "\nInput: (position, int) = 0"
+ },
+ "name": "onPageSelected",
+ "location": {
+ "start": 129,
+ "insert": 122,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 121,
+ "end": 128
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 7
+ },
+ {
+ "id": "905334f4-b946-20ab-f442-f034efa2096b",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "11d0c649-6bba-8586-4045-3eea8309306a"
+ ],
+ "description": "Is overridden to handle page scrolling events in a ViewPager. It takes three arguments: an integer representing the new current item, a float representing the position offset within the current item, and an integer representing the action type (e.g., scrolled horizontally).",
+ "params": [
+ {
+ "name": "arg0",
+ "type_name": "int",
+ "description": "0-based index of the current page being scrolled.",
+ "complex_type": false
+ },
+ {
+ "name": "arg1",
+ "type_name": "float",
+ "description": "scroll distance in pixels and is used to calculate the new offset of the current page.",
+ "complex_type": false
+ },
+ {
+ "name": "arg2",
+ "type_name": "int",
+ "description": "position offset during a scroll operation.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onPageScrolled(int arg0, float arg1, int arg2) {\n Log.d(\"ViewPager\", \"onPageScrolled: page position = \" + arg0);\n}\n",
+ "description": "\nInputs:\n\n* `arg0`: 1 (integer)\n* `arg1`: 0.5f (float)\n* `arg2`: 100 (integer)"
+ },
+ "name": "onPageScrolled",
+ "location": {
+ "start": 149,
+ "insert": 136,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 135,
+ "end": 148
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 13
+ },
+ {
+ "id": "a83d7477-fcbb-a6a8-5241-8d35910b78ab",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "11d0c649-6bba-8586-4045-3eea8309306a"
+ ],
+ "description": "Notifies the client about a change in the scrolling state of the page. It provides an integer parameter, `arg0`, which indicates whether the scroll is idle, touching, or flinging. The function does not have any implementation, indicating that it may be intended to perform some action based on the changed state but has been left blank for future development.",
+ "params": [
+ {
+ "name": "arg0",
+ "type_name": "int",
+ "description": "new scroll state of the pager, which is an integer value indicating whether the pager is idle (0), scrolling (1), or sliding to start (2).",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onPageScrollStateChanged(int arg0) {\n if(arg0 == ViewPager.SCROLL_STATE_IDLE){\n //do something when the pager has finished scrolling\n }\n}\n",
+ "description": "\nExample input for 'arg0', 'int': 2"
+ },
+ "name": "onPageScrollStateChanged",
+ "location": {
+ "start": 160,
+ "insert": 153,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 152,
+ "end": 159
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 7
+ },
+ {
+ "id": "013f714d-8ad9-76a8-4c4b-36a15c4f1d22",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Overrides the default onStart method inherited from a superclass and executes when the activity starts. It calls the superclass's onStart method to perform necessary initialization. This function is typically used for initialization tasks that require the activity to be fully started.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public class MainActivity extends AppCompatActivity {\n @Override\n protected void onStart() {\n super.onStart();\n // Code to start the activity goes here\n }\n}\n",
+ "description": "\nIn this example, the `onStart` method is overridden in a subclass of `AppCompatActivity`, and it calls its superclass's `onStart` method by using the `super.onStart()` call. This allows for any necessary setup or initialization to be performed before the activity starts."
+ },
+ "name": "onStart",
+ "location": {
+ "start": 171,
+ "insert": 167,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 166,
+ "end": 170
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 4
+ },
+ {
+ "id": "b3af11b5-0e2b-13a6-c24c-a9e9a62207b2",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Handles changes to the device's configuration, such as screen orientation or language settings. It is called when a configuration change occurs and invokes its superclass's implementation. The function takes a new configuration object as input and performs no specific actions itself.",
+ "params": [
+ {
+ "name": "newConfig",
+ "type_name": "Configuration",
+ "description": "updated configuration of the device, which is passed to the method when the screen's orientation changes or other system settings are modified.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class MyActivity extends AppCompatActivity {\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n // Here you can update the UI or perform any other necessary operations when the configuration changes.\n }\n}\n",
+ "description": "\nExample input: \n"
+ },
+ "name": "onConfigurationChanged",
+ "location": {
+ "start": 200,
+ "insert": 177,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 176,
+ "end": 199
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 23
+ },
+ {
+ "id": "cf0753bd-1fc1-bc9b-cb42-fc3b52a1c064",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Inflates a menu from the `saved_sensables` resource and populates it with items based on the login status of the `sensableUser`. It shows or hides specific menu items depending on whether the user is logged in or not.",
+ "params": [
+ {
+ "name": "menu",
+ "type_name": "Menu",
+ "description": "action bar's menu that is being populated with items from the resource file R.menu.saved_sensables.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating the success of menu inflation.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main, menu);\n return true;\n}\n",
+ "description": "\nExample input: ('menu', 'Menu')"
+ },
+ "name": "onCreateOptionsMenu",
+ "location": {
+ "start": 225,
+ "insert": 206,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 205,
+ "end": 224
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 19
+ },
+ {
+ "id": "93d224bf-bac1-189e-d642-7cac772183cd",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Handles clicks on action bar items, including \"About\", \"Login\", and \"Logout\". It performs corresponding actions such as launching a dialog or updating the login status and displaying a toast message.",
+ "params": [
+ {
+ "name": "item",
+ "type_name": "MenuItem",
+ "description": "MenuItem object that was clicked, providing access to its identifier and other properties.\n\nExtracted: \n- `int id`: The unique ID of the action bar item that was selected.\n- `MenuItem item`: Represents an action bar item in the context menu.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating whether an action was selected or not.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "item.getItemId() = 2131296524\n",
+ "description": "\nThis item ID corresponds to the R.id.action_create menu item in the main.xml file. When this item is selected, it triggers the creation of a new instance of the SensableLoginFragment and sets a listener for when the sensable is confirmed."
+ },
+ "name": "onOptionsItemSelected",
+ "location": {
+ "start": 264,
+ "insert": 235,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 234,
+ "end": 263
+ }
+ },
+ "item_type": "method",
+ "length": 36,
+ "docLength": 29
+ },
+ {
+ "id": "44523bea-387a-b590-6347-1c93f1b22047",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "93d224bf-bac1-189e-d642-7cac772183cd"
+ ],
+ "description": "Updates the login status by displaying a toast message indicating whether the user is logged out or logout has failed, and then invalidates the options menu.",
+ "params": [
+ {
+ "name": "loggedIn",
+ "type_name": "Boolean",
+ "description": "boolean status of user login, determining whether to display a logout or logout failure message.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "sensableUser.login(userLogin, new CallbackInterface() {\n @Override\n public void loginStatusUpdate(Boolean loggedIn) {\n if (!loggedIn) {\n Toast.makeText(MainActivity.this, \"Logged out\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(MainActivity.this, \"Logout failed\", Toast.LENGTH_SHORT).show();\n }\n invalidateOptionsMenu();\n }\n});\n",
+ "description": ""
+ },
+ "name": "loginStatusUpdate",
+ "location": {
+ "start": 285,
+ "insert": 276,
+ "offset": " ",
+ "indent": 16,
+ "comment": {
+ "start": 275,
+ "end": 284
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 9
+ },
+ {
+ "id": "db01bdcb-69de-a2be-8b43-921c82343565",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Initializes an instance of the `Intent` class with a reference to the current context and the `AboutActivity` class. The function then starts an activity specified by the intent, displaying the about activity to the user.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "launchAbout();\n",
+ "description": "\n\nThis line of code calls the `launchAbout` method, which starts a new activity called `AboutActivity`. The intent is created with this line of code: `Intent intent = new Intent(this, AboutActivity.class);`, and then it's executed by calling `startActivity(intent)`."
+ },
+ "name": "launchAbout",
+ "location": {
+ "start": 304,
+ "insert": 301,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 300,
+ "end": 303
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 3
+ },
+ {
+ "id": "1c8760c9-13d0-2391-554a-28760c919dad",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Displays a login dialog to the user, handles the login status update and displays a toast message accordingly. It also updates the options menu when the user's login status changes. The function sets up a callback interface for the login operation to receive the login status update.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "loginDialog();\n",
+ "description": ""
+ },
+ "name": "loginDialog",
+ "location": {
+ "start": 318,
+ "insert": 312,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 311,
+ "end": 317
+ }
+ },
+ "item_type": "method",
+ "length": 45,
+ "docLength": 6
+ },
+ {
+ "id": "88dba0fd-9644-bea7-9448-10a21de851a6",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "1c8760c9-13d0-2391-554a-28760c919dad"
+ ],
+ "description": "Updates the login status of a user and displays a toast message indicating whether the login was successful or not. It calls a callback interface to perform this operation, displaying success or failure messages based on the result.",
+ "params": [
+ {
+ "name": "userLogin",
+ "type_name": "UserLogin",
+ "description": "credentials of the user attempting to log in, which are passed to the `sensableUser.login()` method for processing.\n\nUserLogin has the following attributes - username and password.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "UserLogin userLogin = new UserLogin();\nuserLogin.setUsername(\"username\");\nuserLogin.setPassword(\"password\");\n\nsensableUser.login(userLogin, new CallbackInterface() {\n @Override\n public void loginStatusUpdate(Boolean loggedIn) {\n if (loggedIn) {\n Toast.makeText(MainActivity.this, \"Successfully logged In\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(MainActivity.this, \"Login failed\", Toast.LENGTH_SHORT).show();\n }\n invalidateOptionsMenu();\n }\n});\n",
+ "description": ""
+ },
+ "name": "onConfirmed",
+ "location": {
+ "start": 335,
+ "insert": 322,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 321,
+ "end": 334
+ }
+ },
+ "item_type": "method",
+ "length": 25,
+ "docLength": 13
+ },
+ {
+ "id": "de568313-442f-6294-454b-d52b42f1ffa2",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "1c8760c9-13d0-2391-554a-28760c919dad",
+ "88dba0fd-9644-bea7-9448-10a21de851a6"
+ ],
+ "description": "Updates the login status of an application. When a user logs in successfully, it displays a toast message indicating successful login; otherwise, it displays a toast message indicating failed login. It also invalidates the options menu after updating the login status.",
+ "params": [
+ {
+ "name": "loggedIn",
+ "type_name": "Boolean",
+ "description": "status of the user's login attempt, indicating whether it was successful or not.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "CallbackInterface callback = new CallbackInterface() {\n @Override\n public void loginStatusUpdate(Boolean loggedIn) {\n if (loggedIn) {\n Toast.makeText(MainActivity.this, \"Successfully logged In\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(MainActivity.this, \"Login failed\", Toast.LENGTH_SHORT).show();\n }\n invalidateOptionsMenu();\n }\n};\n\n// Calling the callback method\nsensableUser.login(userLogin, callback);\n",
+ "description": ""
+ },
+ "name": "loginStatusUpdate",
+ "location": {
+ "start": 348,
+ "insert": 338,
+ "offset": " ",
+ "indent": 20,
+ "comment": {
+ "start": 337,
+ "end": 347
+ }
+ },
+ "item_type": "method",
+ "length": 10,
+ "docLength": 10
+ },
+ {
+ "id": "39e0863f-4a57-33b3-8a4f-aee74dff823a",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Displays a fragment for creating sensable actions and sets a listener to confirm scheduled sensing actions. When confirmed, it shows a toast message with the sensor ID.",
+ "params": [
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "View object passed to the method, which is not utilized within the method and can be removed.\n\nView: an object representing a user interface element that can receive events such as clicks or touches.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "createSensable(getWindow().getDecorView());\n",
+ "description": ""
+ },
+ "name": "createSensable",
+ "location": {
+ "start": 380,
+ "insert": 367,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 366,
+ "end": 379
+ }
+ },
+ "item_type": "method",
+ "length": 22,
+ "docLength": 13
+ },
+ {
+ "id": "37aa3ba9-99df-8198-e144-efea1f911951",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa",
+ "39e0863f-4a57-33b3-8a4f-aee74dff823a"
+ ],
+ "description": "Displays a toast message with the ID of a sensor when confirmed by the user. It takes an instance of `ScheduledSensable` as input and uses the `getSensorid` method to retrieve the sensor ID. The toast is displayed for a short duration using Toast's `makeText` method.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "object that triggered the confirmation event and provides access to its sensor ID through the `getSensorid()` method.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void onConfirmed(ScheduledSensable scheduledSensable) {\n Toast.makeText(MainActivity.this, \"Sensor ID: \" + scheduledSensable.getSensorid(), Toast.LENGTH_SHORT).show();\n}\n",
+ "description": ""
+ },
+ "name": "onConfirmed",
+ "location": {
+ "start": 395,
+ "insert": 384,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 383,
+ "end": 394
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 11
+ },
+ {
+ "id": "17b39bad-6096-2fab-424d-3e572264fca8",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Switches to a specific fragment when an action bar tab is selected, based on the tab's position. It sets the current item of a view pager to match the selected tab, effectively displaying the corresponding fragment.",
+ "params": [
+ {
+ "name": "tab",
+ "type_name": "ActionBar.Tab",
+ "description": "selected ActionBar Tab, which is used to determine the position of the tab and subsequently set the current item in the ViewPager.",
+ "complex_type": false
+ },
+ {
+ "name": "ft",
+ "type_name": "FragmentTransaction",
+ "description": "FragmentTransaction object that manages the addition or removal of fragments from the activity's layout, allowing for dynamic changes to be made to the UI.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ActionBar.Tab tab = actionBar.getTabAt(1);\nonTabSelected(tab, ft);\n",
+ "description": ""
+ },
+ "name": "onTabSelected",
+ "location": {
+ "start": 422,
+ "insert": 404,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 403,
+ "end": 421
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 18
+ },
+ {
+ "id": "5550dede-0cb5-78ab-be42-386b162fbe7e",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Specifies actions to be performed when a tab is unselected in an Android application's ActionBar. This method is part of a callback interface and overrides a default implementation, allowing customization of the tab selection process. No specific actions are defined for this tab.",
+ "params": [
+ {
+ "name": "tab",
+ "type_name": "ActionBar.Tab",
+ "description": "Action Bar Tab that is being unselected and provides information about its configuration and state.",
+ "complex_type": false
+ },
+ {
+ "name": "ft",
+ "type_name": "FragmentTransaction",
+ "description": "FragmentTransaction object that is used to manage changes to the fragment's state.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "onTabUnselected(tab1, ft);\n",
+ "description": ""
+ },
+ "name": "onTabUnselected",
+ "location": {
+ "start": 446,
+ "insert": 429,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 428,
+ "end": 445
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 17
+ },
+ {
+ "id": "c4095790-120c-bd82-6743-806e3c087fb7",
+ "ancestors": [
+ "0f4640ef-34be-4db8-fd4c-9a1a8530fbaa"
+ ],
+ "description": "Handles the event when a tab is reselected within an action bar. It receives the selected tab and a fragment transaction as parameters, but does not perform any specific actions or operations.",
+ "params": [
+ {
+ "name": "tab",
+ "type_name": "ActionBar.Tab",
+ "description": "ActionBar.Tab object that was just reselected by the user and is passed to this method for processing.",
+ "complex_type": false
+ },
+ {
+ "name": "ft",
+ "type_name": "FragmentTransaction",
+ "description": "FragmentTransaction object that allows to commit or reverse operations on fragment's state.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {\n Toast.makeText(this, \"Reselected Tab: \" + tab.getPosition(), Toast.LENGTH_SHORT).show();\n}\n",
+ "description": "\nExample inputs for ('tab', 'ActionBar.Tab'):\n- `tab` = `ActionBar.Tab(title = \"Home\", position = 0)`\n- `ft` = `FragmentTransaction()`"
+ },
+ "name": "onTabReselected",
+ "location": {
+ "start": 466,
+ "insert": 451,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 450,
+ "end": 465
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 15
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableActivity.java",
+ "path": "client/src/main/java/io/sensable/client/SensableActivity.java",
+ "content": {
+ "structured": {
+ "description": "An Android application that manages sensory data and provides user interfaces for saving and un-saving sensable devices. It uses the Retrofit library to fetch sensory data from a server and updates local storage using a content provider. The app displays this data in an expandable list view, allowing users to save or un-save sensables, stop sampling, and update their views accordingly.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"io\"\n color=\"#33363A\"\n SensableService []\n subgraph cluster_2 {\n label=\"sensable\"\n color=\"#33363A\"\n Sample []\n ScheduledSensable []\n Sensable []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableActivity [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n ScheduleHelper []\n ScheduledSensablesTable []\n SavedSensablesTable []\n LocalSensablesFragment []\n FavouriteSensablesFragment []\n ExpandableListAdapter []\n SensableContentProvider []\n ScheduledSensableContentProvider []\n RemoteSensablesFragment []\n }\n }\n }\n subgraph cluster_4 {\n label=\"android\"\n color=\"#33363A\"\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n MenuItem [label=\"android.view.MenuItem\", style=\"rounded,filled\"]\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n DialogInterface [label=\"android.content.DialogInterface\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n ExpandableListView [label=\"android.widget.ExpandableListView\", style=\"rounded,filled\"]\n Activity [label=\"android.app.Activity\", style=\"rounded,filled\"]\n Uri [label=\"android.net.Uri\", style=\"rounded,filled\"]\n TextView [label=\"android.widget.TextView\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n AlertDialog [label=\"android.app.AlertDialog\", style=\"rounded,filled\"]\n Menu [label=\"android.view.Menu\", style=\"rounded,filled\"]\n Toast [label=\"android.widget.Toast\", style=\"rounded,filled\"]\n Button [label=\"android.widget.Button\", style=\"rounded,filled\"]\n }\n subgraph cluster_5 {\n label=\"retrofit\"\n color=\"#33363A\"\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n }\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n SensableActivity -> Intent [style=\"dashed\"]\n DialogInterface -> SensableActivity [penwidth=2]\n SensableActivity -> Cursor [penwidth=1]\n View -> SensableActivity [penwidth=3]\n SensableActivity -> AlertDialog [style=\"dashed\"]\n SensableActivity -> Cursor [style=\"dashed\"]\n SensableActivity -> Uri [style=\"dashed\"]\n SensableActivity -> SavedSensablesTable [style=\"dashed\"]\n SensableActivity -> Bundle [style=\"dashed\"]\n SensableActivity -> ScheduledSensablesTable [style=\"dashed\"]\n SensableActivity -> ScheduledSensable [style=\"dashed\"]\n SensableActivity -> RetrofitError [style=\"dashed\"]\n SensableActivity -> Response [style=\"dashed\"]\n RetrofitError -> SensableActivity [penwidth=1]\n SensableActivity -> Button [style=\"dashed\"]\n LocalSensablesFragment -> SensableActivity [style=\"dashed\"]\n SensableActivity -> Activity [style=\"dashed\"]\n SensableActivity -> Callback [style=\"dashed\"]\n SensableActivity -> MenuItem [style=\"dashed\"]\n Sample -> SensableActivity [penwidth=2]\n SensableActivity -> Uri [penwidth=2]\n SensableActivity -> Menu [style=\"dashed\"]\n SensableActivity -> RestAdapter [style=\"dashed\"]\n Response -> SensableActivity [penwidth=1]\n Sensable -> SensableActivity [penwidth=3]\n SensableActivity -> Log [style=\"dashed\"]\n SensableActivity -> View [style=\"dashed\"]\n SensableActivity -> ExpandableListAdapter [style=\"dashed\"]\n SensableActivity -> Sensable [style=\"dashed\"]\n FavouriteSensablesFragment -> SensableActivity [style=\"dashed\"]\n SensableActivity -> SensableContentProvider [style=\"dashed\"]\n SensableActivity -> ScheduledSensableContentProvider [style=\"dashed\"]\n SensableActivity -> ContentValues [style=\"dashed\"]\n Bundle -> SensableActivity [penwidth=1]\n SensableActivity -> TextView [style=\"dashed\"]\n SensableActivity -> Toast [style=\"dashed\"]\n SensableActivity -> DialogInterface [style=\"dashed\"]\n SensableActivity -> ScheduleHelper [style=\"dashed\"]\n SensableActivity -> Sample [style=\"dashed\"]\n RemoteSensablesFragment -> SensableActivity [style=\"dashed\"]\n SensableActivity -> ExpandableListView [style=\"dashed\"]\n SensableActivity -> SensableService [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidretrofitsensableappcontentdatabasenetosutilviewwidgetCallbackRestAdapterRetrofitErrorclientclientActivityAlertDialogContentValuesDialogInterfaceIntentCursorUriBundleLogMenuMenuItemViewButtonExpandableListViewTextViewToastSensableServicemodelResponseSensableActivityadapterschedulersqliteSampleScheduledSensableSensableviewsExpandableListAdapterScheduleHelperSavedSensablesTableScheduledSensableContentProviderScheduledSensablesTableSensableContentProviderFavouriteSensablesFragmentLocalSensablesFragmentRemoteSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableActivity -> android.app.Activity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.app.AlertDialog: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.content.DialogInterface: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.net.Uri: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.view.Menu: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.view.MenuItem: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.widget.Button: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.widget.ExpandableListView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.widget.TextView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> android.widget.Toast: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.adapter.ExpandableListAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.SensableActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.SensableActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.client.SensableActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.DialogInterface -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.View -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.SensableActivity -> android.database.Cursor: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.SensableActivity -> android.net.Uri: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sample -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.RetrofitError -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.client.Response -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.widget.ExpandableListView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.Button: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.DialogInterface: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.Activity: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.Toast: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.TextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.Menu: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.MenuItem: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.AlertDialog: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.ExpandableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.DialogInterface: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "ancestors": [],
+ "description": "Is responsible for managing sensory data from a device and updating its corresponding views in an Android application. It fetches data from a REST API, updates the sensable object and view, and allows users to save or remove the sensable data from a local database.",
+ "name": "SensableActivity",
+ "location": {
+ "start": 48,
+ "insert": 38,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 37,
+ "end": 47
+ }
+ },
+ "item_type": "class",
+ "length": 554,
+ "docLength": 10
+ },
+ {
+ "id": "95085d8f-c66a-37b7-6d49-cffdcb3c22a2",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Initializes a Sensable activity by setting up UI elements, retrieving data from intent and updating views. It also sets up buttons for saving, unfavouriting and deleting sensables, and handles their click events.",
+ "params": [
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "Bundle object that contains the data to be used when the activity is recreated, such as its previous state and data.\n\nBundle object with data saved previously when the activity was paused or stopped. It contains key-value pairs where keys are strings and values can be any type of serializable objects (e.g., primitive types, arrays, lists).",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Bundle savedInstanceState = new Bundle();\nonCreate(savedInstanceState);\n",
+ "description": ""
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 90,
+ "insert": 70,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 69,
+ "end": 89
+ }
+ },
+ "item_type": "method",
+ "length": 158,
+ "docLength": 20
+ },
+ {
+ "id": "2c0753bf-815d-f2b6-1144-363b98d07b6a",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "95085d8f-c66a-37b7-6d49-cffdcb3c22a2"
+ ],
+ "description": "Is overridden and triggered when a View is clicked. It calls the `saveThisSensable()` method, which saves or updates data related to sensory information. This action is performed when a user interacts with a GUI element.",
+ "params": [
+ {
+ "name": "v",
+ "type_name": "View",
+ "description": "View that was clicked, allowing the function to identify and respond accordingly.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onClick(View v) {\n saveThisSensable();\n}\n",
+ "description": "\nExample input: 'v' = Button, 'View' = View Object"
+ },
+ "name": "onClick",
+ "location": {
+ "start": 140,
+ "insert": 129,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 128,
+ "end": 139
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 11
+ },
+ {
+ "id": "6199b8a2-69d4-9c85-1542-f1f0d6735864",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "95085d8f-c66a-37b7-6d49-cffdcb3c22a2"
+ ],
+ "description": "Handles a click event on a View object, triggering an execution of the `unsaveThisSensable` method when invoked. This method appears to undo or reverse some action related to saving data or information that is considered sensible. The purpose of this functionality is unknown without further context.",
+ "params": [
+ {
+ "name": "v",
+ "type_name": "View",
+ "description": "View that triggered the click event, allowing the method to access and manipulate the view's properties or actions.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Button unFavouriteButton = findViewById(R.id.unfavourite_sensables_button);\nunFavouriteButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n unsaveThisSensable();\n }\n});\n",
+ "description": "\nIn this example, a Button named \"unFavouriteButton\" is found by its ID and set to listen for click events. When the button is clicked, it calls the `unsaveThisSensable()` method."
+ },
+ "name": "onClick",
+ "location": {
+ "start": 160,
+ "insert": 147,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 146,
+ "end": 159
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 13
+ },
+ {
+ "id": "80b86cf1-c755-a6bc-e147-535483889596",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "95085d8f-c66a-37b7-6d49-cffdcb3c22a2"
+ ],
+ "description": "Creates a confirmation dialog to stop sampling with a sensable when a button is clicked. If the user confirms, it removes the sensable from the scheduler and hides a delete local view; otherwise, it cancels the dialog. A toast message indicates \"Sensable stopped\" after removal.",
+ "params": [
+ {
+ "name": "v",
+ "type_name": "View",
+ "description": "View that was clicked, triggering the execution of the function's code.\n\nView: The primary class for working with views and view hierarchies. \nHas no other main properties.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "onClick(View v) {\n // The View object 'v' is passed as a parameter to the onClick method.\n}\n",
+ "description": ""
+ },
+ "name": "onClick",
+ "location": {
+ "start": 190,
+ "insert": 171,
+ "offset": " ",
+ "indent": 16,
+ "comment": {
+ "start": 170,
+ "end": 189
+ }
+ },
+ "item_type": "method",
+ "length": 53,
+ "docLength": 19
+ },
+ {
+ "id": "a83f2e30-caff-0da1-7d4d-19de2294f2c1",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "95085d8f-c66a-37b7-6d49-cffdcb3c22a2",
+ "80b86cf1-c755-a6bc-e147-535483889596"
+ ],
+ "description": "Stops a sensable by removing it from a scheduler and hiding a delete button. It shows a toast message indicating the successful stop. The function uses a helper class, a table to retrieve scheduled sensables, and a cursor to access local data.",
+ "params": [
+ {
+ "name": "dialog",
+ "type_name": "DialogInterface",
+ "description": "DialogInterface that triggered the execution of this code when an item is selected from its list.",
+ "complex_type": false
+ },
+ {
+ "name": "which",
+ "type_name": "int",
+ "description": "0-based index of the item that was clicked or selected from a list of items displayed by a DialogFragment.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "DialogInterface dialog = new AlertDialog.Builder(SensableActivity.this).create();\nint which = 0;\nonClick(dialog, which);\n",
+ "description": ""
+ },
+ "name": "onClick",
+ "location": {
+ "start": 210,
+ "insert": 197,
+ "offset": " ",
+ "indent": 24,
+ "comment": {
+ "start": 196,
+ "end": 209
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 13
+ },
+ {
+ "id": "c543692d-aebb-f993-5f4d-176b9a7ec5a1",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "95085d8f-c66a-37b7-6d49-cffdcb3c22a2",
+ "80b86cf1-c755-a6bc-e147-535483889596"
+ ],
+ "description": "Cancels a dialog when an event occurs. It receives a `DialogInterface` and an integer representing the selected item as parameters. When called, it immediately stops the execution of the dialog's remaining tasks.",
+ "params": [
+ {
+ "name": "dialog",
+ "type_name": "DialogInterface",
+ "description": "DialogInterface that initiated the callback, allowing the function to interact with it and cancel its instance.",
+ "complex_type": false
+ },
+ {
+ "name": "which",
+ "type_name": "int",
+ "description": "0-based index of the selected item from the DialogInterface if it's a ListView or Spinner, but it is not used in this specific implementation.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "DialogInterface dialog = new AlertDialog.Builder(SensableActivity.this).create();\n dialog.show();\n dialog.cancel();\n",
+ "description": "\nHere, 'dialog' is an instance of the AlertDialog class and 'DialogInterface' is the interface that it implements."
+ },
+ "name": "onClick",
+ "location": {
+ "start": 234,
+ "insert": 222,
+ "offset": " ",
+ "indent": 24,
+ "comment": {
+ "start": 221,
+ "end": 233
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 12
+ },
+ {
+ "id": "a312e721-1a0b-92b0-884d-81d9d62571b0",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Initializes a REST adapter to interact with a Sensable service and makes a request for sensor data using the provided sensor ID. On successful response, it updates a Sensable object and a view component; otherwise, logs an error message if a Retrofit error occurs.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onStart() {\n super.onStart();\n\n // Creating rest adapter with the endpoint URL\n RestAdapter restAdapter = new RestAdapter.Builder()\n .setEndpoint(\"http://sensable.io\")\n .build();\n\n // Creating a sensable service using the rest adapter\n SensableService service = restAdapter.create(SensableService.class);\n\n // Making API call to get sensor data with the given sensor ID\n service.getSensorData(sensable.getSensorid(), new Callback() {\n @Override\n public void success(Sensable sensable, Response response) {\n Log.d(TAG, \"Callback Success - Sensable\");\n updateSensable(sensable);\n updateView(sensable);\n }\n\n @Override\n public void failure(RetrofitError retrofitError) {\n Log.e(TAG, \"Callback failure\" + retrofitError.toString());\n }\n });\n}\n",
+ "description": ""
+ },
+ "name": "onStart",
+ "location": {
+ "start": 254,
+ "insert": 249,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 248,
+ "end": 253
+ }
+ },
+ "item_type": "method",
+ "length": 53,
+ "docLength": 5
+ },
+ {
+ "id": "eeba245e-b933-8797-664a-733201758eb9",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "a312e721-1a0b-92b0-884d-81d9d62571b0"
+ ],
+ "description": "Processes a successful callback by logging a message, updating the `sensable` object through `updateSensable`, and refreshing the view with `updateView`. This implies that it handles a response from an asynchronous operation or API call successfully.",
+ "params": [
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object being updated by the function, which is then used to trigger updates in both the UI and the data model.",
+ "complex_type": false
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "response received from the server after a successful operation and is not utilized within the method.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void success(Sensable sensable, Response response) {\n Log.d(TAG, \"Callback Success - Sensable\");\n updateSensable(sensable);\n updateView(sensable);\n}\n\n// Example usage:\n\nSensable sensable = new Sensable(\"Sensor1\", 1234, new double[]{0.5}, \"unit\");\nResponse response = new Response();\n\nsuccess(sensable, response);",
+ "description": ""
+ },
+ "name": "success",
+ "location": {
+ "start": 285,
+ "insert": 265,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 264,
+ "end": 284
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 20
+ },
+ {
+ "id": "d8413a68-700c-d2b3-764e-89becfb9fd7a",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "a312e721-1a0b-92b0-884d-81d9d62571b0"
+ ],
+ "description": "Handles errors occurred during a Retrofit request and logs the error message with the specified tag `TAG`. It takes a `RetrofitError` object as a parameter, which contains information about the failure. The function logs the error message to the Android logcat for debugging purposes.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "error that occurred during the execution of the Retrofit API request and is passed to the callback method for processing.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void failure(RetrofitError retrofitError) {\n Log.e(TAG, \"Callback failure\" + retrofitError.toString());\n}\n",
+ "description": "\nExample input: \n"
+ },
+ "name": "failure",
+ "location": {
+ "start": 301,
+ "insert": 292,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 291,
+ "end": 300
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 9
+ },
+ {
+ "id": "86f9211b-0897-f0b1-1642-ab6386e83082",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Updates the GUI components by setting text fields with sensor ID, unit, and location information from a given `Sensable` object. It also clears and replenishes a list of samples, notifies the adapter to update the list, and triggers another method to update a save button.",
+ "params": [
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object whose properties are updated and displayed in the view, providing sensor ID, unit, location, and sample data.\n\nGet sensor ID, unit and location from sensable object. \nSensable contains array of samples which is cleared, updated and then notified to adapter.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setSensorid(\"123456789\");\nsensable.setName(\"Temperature\");\nsensable.setUnit(\"Celsius\");\nsensable.setLocation(new double[]{45.0, 20.0});\nSample[] samples = new Sample[3];\nsamples[0] = new Sample(1643723400L, 25.5);\nsamples[1] = new Sample(1643723500L, 26.2);\nsamples[2] = new Sample(1643723600L, 27.8);\nsensable.setSamples(samples);\n\nupdateView(sensable);\n",
+ "description": ""
+ },
+ "name": "updateView",
+ "location": {
+ "start": 328,
+ "insert": 308,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 307,
+ "end": 327
+ }
+ },
+ "item_type": "method",
+ "length": 14,
+ "docLength": 20
+ },
+ {
+ "id": "29dd072c-9751-9896-7849-cf8fc9c5214c",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Updates an object's properties. It sets the name, sensor ID, location, sensor type, samples, and unit of a `Sensable` object based on the provided parameters. The updated object is then stored in the database using the `updateSensableInDatabase` method.",
+ "params": [
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object to be updated, whose properties such as name, sensor ID, location, sensor type, samples, and unit are copied into the corresponding fields of the class instance.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public static void main(String[] args) {\n Sensable sensable = new Sensable();\n sensable.setName(\"sensable\");\n sensable.setSensorid(12345);\n sensable.setLocation(new double[]{0, 0});\n sensable.setSensortype(1);\n List samples = new ArrayList<>();\n samples.add(new Sample());\n sensable.setSamples(samples);\n sensable.setUnit(\"unit\");\n\n updateSensable(sensable);\n }\n",
+ "description": ""
+ },
+ "name": "updateSensable",
+ "location": {
+ "start": 359,
+ "insert": 343,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 342,
+ "end": 358
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 16
+ },
+ {
+ "id": "47a607c1-4ea3-368d-d44f-cf0a944da43d",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Inserts a sensable object into the SQLite database if it has not been saved locally. It uses a ContentValues object to store the data and the getContentResolver's insert method to execute the insertion.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public void onClick(View v) {\n if(v.getId() == R.id.favourite_sensables_button){\n saveThisSensable();\n }\n}\n",
+ "description": "\nIn this example, the `saveThisSensable` method is called when a button with the ID \"favourite_sensables_button\" is clicked."
+ },
+ "name": "saveThisSensable",
+ "location": {
+ "start": 375,
+ "insert": 370,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 369,
+ "end": 374
+ }
+ },
+ "item_type": "method",
+ "length": 15,
+ "docLength": 5
+ },
+ {
+ "id": "405aafff-7c03-b68c-f04c-2f1ecbd6a3ad",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Updates a sensable's information in the database by checking if it is saved locally, serializing it for SQLite, and then updating the corresponding database rows using the content resolver.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating successful update or failure.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "sensable.setName(\"NewName\");\nupdateSensableInDatabase();\n",
+ "description": ""
+ },
+ "name": "updateSensableInDatabase",
+ "location": {
+ "start": 399,
+ "insert": 391,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 390,
+ "end": 398
+ }
+ },
+ "item_type": "method",
+ "length": 16,
+ "docLength": 8
+ },
+ {
+ "id": "a4c0fb93-a30a-bfa1-724d-65ccb10bf450",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Checks if data is already saved locally and, if so, deletes it from a database using a Uri object. It updates the state of the `savedLocally` variable based on the deletion result and triggers an update to the save button's state accordingly.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "// Assuming sensable is an object of type Sensable and savedLocally is a boolean variable.\nunsaveThisSensable();\n\n// Output: \n// If savedLocally is true, the code will delete the rows from the database based on the checkSavedLocally method.",
+ "description": ""
+ },
+ "name": "unsaveThisSensable",
+ "location": {
+ "start": 420,
+ "insert": 416,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 415,
+ "end": 419
+ }
+ },
+ "item_type": "method",
+ "length": 11,
+ "docLength": 4
+ },
+ {
+ "id": "6025b95d-1fb6-84ac-ea41-8012fe8582c0",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Queries a database using a cursor to retrieve the number of rows stored locally. It then checks if the retrieved count is greater than zero, returning a boolean indicating whether data has been saved locally.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating database presence.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "if(checkSavedLocally()) {\n Log.d(\"MainActivity\", \"Data found in local database\");\n} else {\n Log.d(\"MainActivity\", \"No data found in local database\");\n}\n",
+ "description": ""
+ },
+ "name": "checkSavedLocally",
+ "location": {
+ "start": 447,
+ "insert": 432,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 431,
+ "end": 446
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 15
+ },
+ {
+ "id": "6434c835-d94a-e493-8a49-ed6bf08c830d",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Queries a database using its content resolver and returns a cursor containing data from the specified URI. The query retrieves all records (`\"*\"`) without any filtering conditions or sorting.",
+ "params": [],
+ "returns": {
+ "type_name": "Cursor",
+ "description": "a cursor object that queries scheduled database.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Cursor cursor = sensableActivity.getSensableSender();\nif (cursor != null && cursor.moveToFirst()) {\n int idIndex = cursor.getColumnIndex(\"id\");\n int nameIndex = cursor.getColumnIndex(\"name\");\n int statusIndex = cursor.getColumnIndex(\"status\");\n\n do {\n int id = cursor.getInt(idIndex);\n String name = cursor.getString(nameIndex);\n int status = cursor.getInt(statusIndex);\n\n Log.d(TAG, \"ID: \" + id + \", Name: \" + name + \", Status: \" + status);\n\n } while (cursor.moveToNext());\n cursor.close();\n} else {\n Log.e(TAG, \"Cursor is null or empty\");\n}\n",
+ "description": ""
+ },
+ "name": "getSensableSender",
+ "location": {
+ "start": 462,
+ "insert": 452,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 451,
+ "end": 461
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 10
+ },
+ {
+ "id": "7b95d782-d5d8-418d-cf42-2baaf95e050e",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Parses a uniform resource identifier (URI) by concatenating a constant URI string with a sensor ID retrieved from the `sensable` object, forming a database URI for specific sensor data retrieval.",
+ "params": [],
+ "returns": {
+ "type_name": "Uri",
+ "description": "a parsed URI for accessing a specific sensor's data.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri databaseUri = getDatabaseUri();\n",
+ "description": ""
+ },
+ "name": "getDatabaseUri",
+ "location": {
+ "start": 488,
+ "insert": 468,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 467,
+ "end": 487
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 20
+ },
+ {
+ "id": "ed5f6f1c-1fa8-a881-4c47-8c8780ca4d4b",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Parses a URI to retrieve data from a scheduled database, combining a predefined constant URI with a sensor ID obtained from an object called `sensable`. The resulting URI is then returned as a Uri object.",
+ "params": [],
+ "returns": {
+ "type_name": "object",
+ "description": "a parsed URI combining CONTENT_URI and sensor ID.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri scheduledDBUri = getScheduledDatabaseUri();\nLog.d(TAG, \"Scheduled Database URI: \" + scheduledDBUri.toString());\n",
+ "description": ""
+ },
+ "name": "getScheduledDatabaseUri",
+ "location": {
+ "start": 508,
+ "insert": 492,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 491,
+ "end": 507
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 16
+ },
+ {
+ "id": "752cd39c-be13-1aa0-1f4c-e24e0a443075",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Toggles the visibility of two buttons based on a boolean flag `savedLocally`. If `savedLocally` is true, it hides the favourite button and shows the unFavourite button. Otherwise, it shows the favourite button and hides the unFavourite button.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public void updateUI(View view) {\n boolean saved = checkIfSavedLocally();\n favouriteButton = findViewById(R.id.favourite_button);\n unFavouriteButton = findViewById(R.id.unfavourite_button);\n\n updateSaveButton(saved);\n}\n",
+ "description": "\nIn this example, the `updateSaveButton` method is called with a boolean value indicating whether a location has been saved locally or not."
+ },
+ "name": "updateSaveButton",
+ "location": {
+ "start": 517,
+ "insert": 513,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 512,
+ "end": 516
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 4
+ },
+ {
+ "id": "5d1c77d1-8c40-089a-b442-a84c0593b133",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156"
+ ],
+ "description": "Sorts a list of samples based on their timestamps and groups them by day. It then creates a hierarchical data structure to store the grouped samples, with each group's header representing the date.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "prepareListData();\n",
+ "description": "\nThis would sort the samples based on their timestamps in descending order and then organize them into a list with headers representing each day and child data representing the samples for that day."
+ },
+ "name": "prepareListData",
+ "location": {
+ "start": 535,
+ "insert": 530,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 529,
+ "end": 534
+ }
+ },
+ "item_type": "method",
+ "length": 66,
+ "docLength": 5
+ },
+ {
+ "id": "b26017bc-c78f-cf87-4a45-44e2e0ad4e7b",
+ "ancestors": [
+ "b86d4e4b-3c30-2dbe-ba41-859d111f3156",
+ "5d1c77d1-8c40-089a-b442-a84c0593b133"
+ ],
+ "description": "Returns an integer value representing the difference between the timestamps of two `Sample` objects, with a larger value indicating that the second object has an earlier timestamp. The comparison is done by subtracting the first object's timestamp from the second object's timestamp.",
+ "params": [
+ {
+ "name": "a",
+ "type_name": "Sample",
+ "description": "first `Sample` object to be compared with the second `Sample` object `b`.",
+ "complex_type": false
+ },
+ {
+ "name": "b",
+ "type_name": "Sample",
+ "description": "second object being compared to the first object `a`, with its timestamp subtracted from `a`'s timestamp to determine the comparison result.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer representing the timestamp difference between two samples.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "List samples = new ArrayList<>();\n\nSample sample1 = new Sample(1643723400L);\nsample1.setValue(\"10\");\n\nSample sample2 = new Sample(1643730000L);\nsample2.setValue(\"15\");\n\nsamples.add(sample1);\nsamples.add(sample2);\n\nCollections.sort(samples, new Comparator() {\n @Override\n public int compare(Sample a, Sample b) {\n return (int) (b.getTimestamp() - a.getTimestamp());\n }\n});\n",
+ "description": ""
+ },
+ "name": "compare",
+ "location": {
+ "start": 559,
+ "insert": 541,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 540,
+ "end": 558
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 18
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableLoginFragment.java",
+ "path": "client/src/main/java/io/sensable/client/SensableLoginFragment.java",
+ "content": {
+ "structured": {
+ "description": "A custom Dialog Fragment that allows users to log in to a sensable system using a username and password. The fragment inflates a layout with an EditText field for username and password, and a submit button that triggers a listener when clicked. When the login is confirmed, it passes the UserLogin object to a SensableLoginListener interface method and dismisses the dialog.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"sensable\"\n color=\"#33363A\"\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableLoginFragment [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n UserLogin []\n SensableLoginListener []\n }\n DialogFragment [label=\"android.app.DialogFragment\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Toast [label=\"android.widget.Toast\", style=\"rounded,filled\"]\n Button [label=\"android.widget.Button\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n EditText [label=\"android.widget.EditText\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n SensableLoginFragment -> ViewGroup [style=\"dashed\"]\n SensableLoginFragment -> EditText [style=\"dashed\"]\n SensableLoginFragment -> Bundle [style=\"dashed\"]\n Bundle -> SensableLoginFragment [penwidth=1]\n SensableLoginFragment -> Button [style=\"dashed\"]\n UserLogin -> SensableLoginFragment [penwidth=1]\n SensableLoginFragment -> DialogFragment [style=\"dashed\"]\n LayoutInflater -> SensableLoginFragment [penwidth=1]\n SensableLoginListener -> SensableLoginFragment [penwidth=1]\n SensableLoginFragment -> View [dir=\"both\", penwidth=3]\n SensableLoginFragment -> LayoutInflater [style=\"dashed\"]\n SensableLoginFragment -> Toast [style=\"dashed\"]\n SensableLoginFragment -> UserLogin [style=\"dashed\"]\n SensableLoginFragment -> View [style=\"dashed\"]\n ViewGroup -> SensableLoginFragment [penwidth=1]\n}\n",
+ "d2": "ioandroidsensableapposviewwidgetclientDialogFragmentBundleLayoutInflaterViewViewGroupButtonEditTextToastmodelSensableLoginFragmentUserLoginSensableLoginListenerimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableLoginFragment -> android.app.DialogFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.widget.Button: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.widget.EditText: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> android.widget.Toast: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> io.sensable.model.UserLogin: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.SensableLoginFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.LayoutInflater -> io.sensable.client.SensableLoginFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.SensableLoginFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.SensableLoginFragment <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.SensableLoginListener -> io.sensable.client.SensableLoginFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.client.SensableLoginFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.app.DialogFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.EditText: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.Toast: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.Button: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableLoginFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableLoginListener: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableLoginFragment: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "1168e880-be0b-fdb6-8a40-736b909a01e5",
+ "ancestors": [],
+ "description": "Is a custom Dialog Fragment that allows users to log in to a sensable system. It has an EditText field for username and password, and a submit button that triggers the login process when clicked. The fragment also provides an interface for receiving confirmed UserLogin objects.",
+ "name": "SensableLoginFragment",
+ "location": {
+ "start": 23,
+ "insert": 16,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 15,
+ "end": 22
+ }
+ },
+ "item_type": "class",
+ "length": 154,
+ "docLength": 7
+ },
+ {
+ "id": "552b3c0b-c06a-bca8-3e4f-f909dfafc9e8",
+ "ancestors": [
+ "1168e880-be0b-fdb6-8a40-736b909a01e5"
+ ],
+ "description": "Defines a method to receive confirmed UserLogin objects from login operations.",
+ "name": "SensableLoginListener",
+ "location": {
+ "start": 33,
+ "insert": 30,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 29,
+ "end": 32
+ }
+ },
+ "item_type": "interface",
+ "length": 3,
+ "docLength": 3
+ },
+ {
+ "id": "713cecab-667f-5d82-ea4c-1e53959bd5c9",
+ "ancestors": [
+ "1168e880-be0b-fdb6-8a40-736b909a01e5"
+ ],
+ "description": "Inflates a layout, sets a title to the dialog, finds and initializes UI components such as EditTexts for username and password fields, and adds an event listener to a button. It returns the inflated view.",
+ "params": [
+ {
+ "name": "inflater",
+ "type_name": "LayoutInflater",
+ "description": "LayoutInflater object that is used to inflate or load the layout resource file into a View object.\n\nInflate an instance of type layout from the given resource. It uses null as a root view, and attach to the parent ViewGroup if flag is specified. The inflater is used for inflating layouts and views.",
+ "complex_type": true
+ },
+ {
+ "name": "container",
+ "type_name": "ViewGroup",
+ "description": "2D ViewGroup that this view is to be added to, and it is used by LayoutInflater to set the parent of the inflated view.\n\nIs null or zero-sized if the parent view group is an invalid type.\nHas layout parameters set to wrap its content.\nIs passed as part of the inflate method's arguments.",
+ "complex_type": true
+ },
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "bundle of data previously saved by onSaveInstanceState and is not used in this function.\n\nBundle object containing saved key-value pairs. Bundle stores data that can be saved across process death.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "View",
+ "description": "a view of the sensable login layout.\n\nThe returned object is a View, which represents a UI component in Android's layout hierarchy. The View is inflated from the sensable_login_layout resource and has two child views: an EditText for login username and another EditText for login password.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "View view = inflater.inflate(R.layout.sensable_login_layout, null);\n",
+ "description": ""
+ },
+ "name": "onCreateView",
+ "location": {
+ "start": 92,
+ "insert": 40,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 39,
+ "end": 91
+ }
+ },
+ "item_type": "method",
+ "length": 13,
+ "docLength": 52
+ },
+ {
+ "id": "ebb66fa1-af67-d49b-dc4a-4b06ec96ecc3",
+ "ancestors": [
+ "1168e880-be0b-fdb6-8a40-736b909a01e5"
+ ],
+ "description": "Establishes a connection between an object and its login listener, storing the listener in the `sensableLoginListener` field for potential future use. This enables the object to notify the listener when certain login-related events occur. The function sets the listener without any validation or processing.",
+ "params": [
+ {
+ "name": "sensableLoginListener",
+ "type_name": "SensableLoginListener",
+ "description": "listener that is assigned to handle login-related events.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class MyActivity extends AppCompatActivity {\n\n private SensableLoginFragment sensableLoginFragment;\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n // Inflate layout for the login fragment and show it as a dialog.\n sensableLoginFragment = new SensableLoginFragment();\n DialogFragment dialog = sensableLoginFragment;\n FragmentManager fragmentManager = getFragmentManager();\n dialog.show(fragmentManager, \"sensable_login\");\n\n // Set listener for the login functionality\n MySensableLoginListener mySensableLoginListener = new MySensableLoginListener();\n sensableLoginFragment.setSensableLoginListener(mySensableLoginListener);\n }\n\n}\n\nclass MySensableLoginListener implements SensableLoginListener {\n @Override\n public void onConfirmed(UserLogin userLogin) {\n // Handle the confirmed login event, e.g. perform authentication and redirect to the main screen.\n Toast.makeText(MyActivity.this, \"User logged in successfully\", Toast.LENGTH_SHORT).show();\n }\n}\n",
+ "description": ""
+ },
+ "name": "setSensableLoginListener",
+ "location": {
+ "start": 119,
+ "insert": 106,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 105,
+ "end": 118
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 13
+ },
+ {
+ "id": "64fbfdf7-82fb-2fac-9346-a5aad77e602c",
+ "ancestors": [
+ "1168e880-be0b-fdb6-8a40-736b909a01e5"
+ ],
+ "description": "Sets a click listener for a submit button, verifying if login credentials are provided. If valid, it creates a `UserLogin` object and passes it to a listener, then dismisses the dialog. If invalid, it displays a toast message requiring username and password.",
+ "params": [
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "view that was clicked, which is then used to find the submit button within it by calling `findViewById(R.id.login_submit_button)`.\n\nView represents a base class for widgets and other graphical user interface components. It implements the Component interface to provide methods for handling events such as clicks, touches, and other gestures.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void onClick(View view) {\n SensableLoginFragment fragment = new SensableLoginFragment();\n View v = inflateLayout(R.layout.sensable_login_layout, null);\n fragment.setSensableLoginListener(new SensableLoginFragment.SensableLoginListener() {\n @Override\n public void onConfirmed(UserLogin userLogin) {\n // Handle the confirmed login event here\n }\n });\n fragment.addListenerOnButton(v);\n }",
+ "description": ""
+ },
+ "name": "addListenerOnButton",
+ "location": {
+ "start": 143,
+ "insert": 124,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 123,
+ "end": 142
+ }
+ },
+ "item_type": "method",
+ "length": 32,
+ "docLength": 19
+ },
+ {
+ "id": "02a2a1eb-7634-3eb3-1a41-b41776fbe3fd",
+ "ancestors": [
+ "1168e880-be0b-fdb6-8a40-736b909a01e5",
+ "64fbfdf7-82fb-2fac-9346-a5aad77e602c"
+ ],
+ "description": "Triggers when a view is clicked. It checks if username and password are provided, then creates a `UserLogin` object with the input data, notifies the listener, and dismisses the dialog if valid; otherwise, it displays an error message.",
+ "params": [
+ {
+ "name": "v",
+ "type_name": "View",
+ "description": "View that was clicked, triggering the execution of the `onClick` method.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SensableLoginFragment sensableLoginFragment = new SensableLoginFragment();\nsensableLoginFragment.show(getFragmentManager(), \"login_fragment\");\n\n// Implement the interface for login listener\nsensableLoginFragment.setSensableLoginListener(new SensableLoginFragment.SensableLoginListener() {\n @Override\n public void onConfirmed(UserLogin userLogin) {\n // Process the confirmed login information here\n }\n});\n",
+ "description": ""
+ },
+ "name": "onClick",
+ "location": {
+ "start": 161,
+ "insert": 149,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 148,
+ "end": 160
+ }
+ },
+ "item_type": "method",
+ "length": 10,
+ "docLength": 12
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableListAdapter.java",
+ "path": "client/src/main/java/io/sensable/client/views/SensableListAdapter.java",
+ "content": {
+ "structured": {
+ "description": "A custom cursor adapter called SensableListAdapter that extends Android's CursorAdapter class. It is designed to display sensor data from a database in a list view. The adapter holds data from the cursor, including the sensor ID, name, type, value, and unit, and uses this information to bind views with the data.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"android\"\n color=\"#33363A\"\n TextView [label=\"android.widget.TextView\", style=\"rounded,filled\"]\n Color [label=\"android.graphics.Color\", style=\"rounded,filled\"]\n ImageView [label=\"android.widget.ImageView\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n Adapter [label=\"android.widget.Adapter\", style=\"rounded,filled\"]\n CursorAdapter [label=\"android.widget.CursorAdapter\", style=\"rounded,filled\"]\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n }\n subgraph cluster_3 {\n label=\"io/sensable\"\n color=\"#33363A\"\n SensorHelper []\n Sample []\n R [label=\"io.sensable.client.R\", style=\"rounded,filled\"]\n subgraph cluster_4 {\n label=\"client\"\n color=\"#33363A\"\n SavedSensablesTable []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableListAdapter [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n AdapterHolder []\n }\n }\n subgraph cluster_5 {\n label=\"java\"\n color=\"#33363A\"\n Random [label=\"java.util.Random\", style=\"rounded,filled\"]\n DecimalFormat [label=\"java.text.DecimalFormat\", style=\"rounded,filled\"]\n }\n subgraph cluster_6 {\n label=\"org\"\n color=\"#33363A\"\n JSONObject [label=\"org.json.JSONObject\", style=\"rounded,filled\"]\n JSONException [label=\"org.json.JSONException\", style=\"rounded,filled\"]\n }\n SensableListAdapter -> CursorAdapter [style=\"dashed\"]\n ViewGroup -> SensableListAdapter [penwidth=1]\n SensableListAdapter -> ImageView [style=\"dashed\"]\n SensableListAdapter -> View [dir=\"both\", penwidth=2]\n SensableListAdapter -> Log [style=\"dashed\"]\n AdapterHolder -> SensableListAdapter [penwidth=1]\n SensableListAdapter -> ViewGroup [style=\"dashed\"]\n SensableListAdapter -> R [style=\"dashed\"]\n SensableListAdapter -> Color [style=\"dashed\"]\n SensableListAdapter -> Context [style=\"dashed\"]\n SensableListAdapter -> View [style=\"dashed\"]\n SensableListAdapter -> Random [style=\"dashed\"]\n SensableListAdapter -> DecimalFormat [style=\"dashed\"]\n SensableListAdapter -> Cursor [style=\"dashed\"]\n SensableListAdapter -> SensorHelper [style=\"dashed\"]\n SensableListAdapter -> SavedSensablesTable [style=\"dashed\"]\n SensableListAdapter -> JSONObject [style=\"dashed\"]\n Cursor -> SensableListAdapter [penwidth=3]\n SensableListAdapter -> LayoutInflater [style=\"dashed\"]\n SensableListAdapter -> TextView [style=\"dashed\"]\n Context -> SensableListAdapter [penwidth=3]\n SensableListAdapter -> Adapter [style=\"dashed\"]\n SensableListAdapter -> JSONException [style=\"dashed\"]\n SensableListAdapter -> Sample [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidorgjavasensablecontentdatabasegraphicsutilviewwidgetjsontextutilclientContextCursorColorLogLayoutInflaterViewViewGroupAdapterCursorAdapterImageViewTextViewmodelJSONExceptionJSONObjectDecimalFormatRandomviewsRSensorHelpersqliteSampleSensableListAdapterSavedSensablesTableAdapterHolderimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.views.SensableListAdapter -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.graphics.Color: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.widget.Adapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.widget.CursorAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.widget.ImageView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> android.widget.TextView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.client.R: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.client.SensorHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> org.json.JSONException: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> org.json.JSONObject: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> java.text.DecimalFormat: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> java.util.Random: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.views.SensableListAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.Cursor -> io.sensable.client.views.SensableListAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.views.SensableListAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.AdapterHolder -> io.sensable.client.views.SensableListAdapter: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.SensableListAdapter <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.widget.CursorAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.Adapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONException: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.graphics.Color: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.ImageView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.R: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.TextView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.text.DecimalFormat: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.Random: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.SensableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.AdapterHolder: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensorHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.SensableListAdapter: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "b0e7a56d-7620-8bb1-a24f-05ee83bd104f",
+ "ancestors": [],
+ "description": "Is an extension of CursorAdapter that provides a custom layout for displaying sensor data from a database. It uses a cursor to fetch data and binds it to a view, which can be customized with various elements such as text views, image views, and colors based on the sensor ID and value. The class also generates random colors based on the hash code of the sensor name.",
+ "name": "SensableListAdapter",
+ "location": {
+ "start": 35,
+ "insert": 27,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 26,
+ "end": 34
+ }
+ },
+ "item_type": "class",
+ "length": 217,
+ "docLength": 8
+ },
+ {
+ "id": "7692d6aa-7e86-ffa8-8647-bee0df52115a",
+ "ancestors": [
+ "b0e7a56d-7620-8bb1-a24f-05ee83bd104f"
+ ],
+ "description": "Inflates a layout resource into a new view, specifically an instance of `R.layout.sensable_list_row`, which is then returned for use. It takes three parameters: the context, a cursor object, and a parent ViewGroup. The `false` parameter indicates that the inflated view should not be attached to the parent immediately.",
+ "params": [
+ {
+ "name": "context",
+ "type_name": "Context",
+ "description": "application environment and provides access to application-specific resources, such as inflated views.",
+ "complex_type": false
+ },
+ {
+ "name": "cursor",
+ "type_name": "Cursor",
+ "description": "data to be displayed in the list row, allowing for the retrieval and processing of specific column values within the cursor object.",
+ "complex_type": false
+ },
+ {
+ "name": "parent",
+ "type_name": "ViewGroup",
+ "description": "ViewGroup that the inflated layout will be added to and helps determine the measurement and positioning of the inflated view.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "View",
+ "description": "a newly inflated view from the \"sensable_list_row\" layout.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public View newView(Context context, Cursor cursor, ViewGroup parent) {\n final View view = mInflater.inflate(R.layout.sensable_list_row, parent, false);\n return view;\n}\n",
+ "description": "\nExample inputs:\n\n* `context`: This could be a Context object provided by an Android app.\n* `cursor`: This is a result set from a database query, containing the data that will be displayed in the list view.\n* `parent`: The parent view group that will hold or contain the newly inflated View."
+ },
+ "name": "newView",
+ "location": {
+ "start": 96,
+ "insert": 55,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 54,
+ "end": 95
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 41
+ },
+ {
+ "id": "874bb4e6-ab4a-2aaa-b343-fd1580a0723f",
+ "ancestors": [
+ "b0e7a56d-7620-8bb1-a24f-05ee83bd104f"
+ ],
+ "description": "Retrieves data from a Cursor and binds it to various views within a row of a list. It populates text views with sensor name, ID, type, value, and unit, sets an image based on the sensor type, and changes the background color based on the sensor ID and row ID.",
+ "params": [
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "View that is being populated with data from the Cursor, allowing the function to interact with and modify its properties.\n\nFindViewById: Returns a View object with the given id or null if no such view exists. The findViewById() method searches for a child view that has been assigned this ID in its layout description.",
+ "complex_type": true
+ },
+ {
+ "name": "context",
+ "type_name": "Context",
+ "description": "context of the activity or fragment, used to access resources and perform operations on the UI components within the view.\n\nContext contains the application's resources and local class loader, as well as its base directory.",
+ "complex_type": true
+ },
+ {
+ "name": "cursor",
+ "type_name": "Cursor",
+ "description": "data source from which to retrieve data, providing access to the columns of the underlying database table through its getter methods.\n\nContains columns named NAME, SENSOR_ID, TYPE, VALUE and UNIT.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "bindView(view, context, cursor);\n",
+ "description": "\nIn this example, 'view', 'context' and 'cursor' are the parameters for the bindView method."
+ },
+ "name": "bindView",
+ "location": {
+ "start": 170,
+ "insert": 102,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 101,
+ "end": 169
+ }
+ },
+ "item_type": "method",
+ "length": 32,
+ "docLength": 68
+ },
+ {
+ "id": "453110fe-167b-b687-ad42-3afb2d6dc77a",
+ "ancestors": [
+ "b0e7a56d-7620-8bb1-a24f-05ee83bd104f"
+ ],
+ "description": "Generates a random color based on the input string's hash code. It creates an array of predefined colors and selects one randomly using the hash code to generate a random index within the array. The selected color is then returned as an integer value representing an RGB color.",
+ "params": [
+ {
+ "name": "name",
+ "type_name": "String",
+ "description": "seed value used to generate a random instance of the Random class, which determines the selection of a color from the predefined array.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "a random color from an array of predefined colours.\n\nThe output is an integer value representing a color in ARGB (Alpha, Red, Green, Blue) format. The value is a combination of alpha channel transparency and RGB colors, with each component ranging from 0 to 255.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "String name = \"Test\";\nint color = SensableListAdapter.getColour(name);\nSystem.out.println(color);\n",
+ "description": ""
+ },
+ "name": "getColour",
+ "location": {
+ "start": 213,
+ "insert": 203,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 202,
+ "end": 212
+ }
+ },
+ "item_type": "method",
+ "length": 16,
+ "docLength": 10
+ },
+ {
+ "id": "eb63d19e-369e-b894-4d4d-e29c30199658",
+ "ancestors": [
+ "b0e7a56d-7620-8bb1-a24f-05ee83bd104f"
+ ],
+ "description": "Represents a data holder for sensor data adapter attributes.\n",
+ "fields": [
+ {
+ "name": "ID",
+ "type_name": "String",
+ "value": null,
+ "constant": false,
+ "class_name": "AdapterHolder",
+ "description": "represents a unique identifier for an object or data point."
+ },
+ {
+ "name": "NAME",
+ "type_name": "String",
+ "value": null,
+ "constant": false,
+ "class_name": "AdapterHolder",
+ "description": "represents a name associated with an ID."
+ },
+ {
+ "name": "SENSOR_ID",
+ "type_name": "String",
+ "value": null,
+ "constant": false,
+ "class_name": "AdapterHolder",
+ "description": "represents a unique identifier for each sensor."
+ },
+ {
+ "name": "TYPE",
+ "type_name": "String",
+ "value": null,
+ "constant": false,
+ "class_name": "AdapterHolder",
+ "description": "represents a string value indicating the type of sensable being displayed."
+ },
+ {
+ "name": "VALUE",
+ "type_name": "String",
+ "value": null,
+ "constant": false,
+ "class_name": "AdapterHolder",
+ "description": "in the AdapterHolder class represents a string value with no additional context or information beyond what is explicitly defined."
+ },
+ {
+ "name": "UNIT",
+ "type_name": "String",
+ "value": null,
+ "constant": false,
+ "class_name": "AdapterHolder",
+ "description": "represents a textual representation of the unit of measurement associated with a sample value."
+ }
+ ],
+ "name": "AdapterHolder",
+ "location": {
+ "start": 243,
+ "insert": 230,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 229,
+ "end": 242
+ }
+ },
+ "item_type": "class",
+ "length": 8,
+ "docLength": 13
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "RemoteSensablesFragment.java",
+ "path": "client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java",
+ "content": {
+ "structured": {
+ "description": "A fragment that retrieves a list of Sensable objects from an API endpoint using Retrofit, and displays this list in a ListView. The fragment also handles item clicks by launching a new activity with the selected Sensable object as extra data.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"io\"\n color=\"#33363A\"\n SensableService []\n subgraph cluster_2 {\n label=\"sensable\"\n color=\"#33363A\"\n SensableActivity []\n R [label=\"io.sensable.client.R\", style=\"rounded,filled\"]\n Sensable []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n TabsPagerAdapter []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n RemoteSensablesFragment [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n }\n }\n subgraph cluster_4 {\n label=\"android\"\n color=\"#33363A\"\n AdapterView [label=\"android.widget.AdapterView\", style=\"rounded,filled\"]\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n ArrayAdapter [label=\"android.widget.ArrayAdapter\", style=\"rounded,filled\"]\n ListView [label=\"android.widget.ListView\", style=\"rounded,filled\"]\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n subgraph cluster_6 {\n label=\"support/v4\"\n color=\"#33363A\"\n Fragment [label=\"android.support.v4.app.Fragment\", style=\"rounded,filled\"]\n }\n }\n subgraph cluster_7 {\n label=\"retrofit\"\n color=\"#33363A\"\n Response [label=\"retrofit.client.Response\", style=\"rounded,filled\"]\n }\n subgraph cluster_8 {\n label=\"java\"\n color=\"#33363A\"\n ArrayList [label=\"java.util.ArrayList\", style=\"rounded,filled\"]\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n }\n RestAdapter [label=\"retrofit.RestAdapter\", style=\"rounded,filled\"]\n RetrofitError [label=\"retrofit.RetrofitError\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n RemoteSensablesFragment -> RetrofitError [style=\"dashed\"]\n RemoteSensablesFragment -> SensableActivity [style=\"dashed\"]\n RemoteSensablesFragment -> AdapterView [style=\"dashed\"]\n RemoteSensablesFragment -> R [style=\"dashed\"]\n Sensable -> RemoteSensablesFragment [penwidth=1]\n RemoteSensablesFragment -> List [style=\"dashed\"]\n RemoteSensablesFragment -> RestAdapter [style=\"dashed\"]\n Response -> RemoteSensablesFragment [penwidth=1]\n TabsPagerAdapter -> RemoteSensablesFragment [style=\"dashed\"]\n RemoteSensablesFragment -> ListView [style=\"dashed\"]\n RemoteSensablesFragment -> Sensable [style=\"dashed\"]\n RemoteSensablesFragment -> Response [style=\"dashed\"]\n RemoteSensablesFragment -> LayoutInflater [style=\"dashed\"]\n ViewGroup -> RemoteSensablesFragment [penwidth=1]\n RemoteSensablesFragment -> View [style=\"dashed\"]\n RemoteSensablesFragment -> Intent [style=\"dashed\"]\n Bundle -> RemoteSensablesFragment [penwidth=1]\n RemoteSensablesFragment -> View [dir=\"both\", penwidth=2]\n RemoteSensablesFragment -> Fragment [style=\"dashed\"]\n RemoteSensablesFragment -> Bundle [style=\"dashed\"]\n LayoutInflater -> RemoteSensablesFragment [penwidth=1]\n RemoteSensablesFragment -> ViewGroup [style=\"dashed\"]\n RemoteSensablesFragment -> Log [style=\"dashed\"]\n RemoteSensablesFragment -> ArrayAdapter [style=\"dashed\"]\n RemoteSensablesFragment -> SensableService [style=\"dashed\"]\n RemoteSensablesFragment -> Callback [style=\"dashed\"]\n RemoteSensablesFragment -> ArrayList [style=\"dashed\"]\n RetrofitError -> RemoteSensablesFragment [penwidth=1]\n}\n",
+ "d2": "ioandroidretrofitjavasensablesupportcontentosutilviewwidgetCallbackRestAdapterRetrofitErrorclientutilclientv4IntentBundleLogLayoutInflaterViewViewGroupAdapterViewArrayAdapterListViewSensableServicemodelResponseArrayListListadapterviewsappRSensableActivitySensableTabsPagerAdapterRemoteSensablesFragmentFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.adapter.TabsPagerAdapter -> io.sensable.client.views.RemoteSensablesFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.support.v4.app.Fragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.widget.AdapterView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.widget.ArrayAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> android.widget.ListView: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.client.R: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.client.SensableActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> retrofit.RestAdapter: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> retrofit.RetrofitError: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> retrofit.client.Response: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> java.util.ArrayList: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.LayoutInflater -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.RetrofitError -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.client.Response -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.support.v4.app.Fragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.ArrayAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.ArrayList: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.ListView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.widget.AdapterView: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.RestAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.R: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.client.Response: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nretrofit.RetrofitError: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de",
+ "ancestors": [],
+ "description": "Extends Fragment and provides a list of sensibles retrieved from an API endpoint. It initializes a RestAdapter to make API calls and uses a ListView to display the list of sensibles, with an OnItemClickListener handling item clicks and launching the SensableActivity.",
+ "name": "RemoteSensablesFragment",
+ "location": {
+ "start": 33,
+ "insert": 28,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 27,
+ "end": 32
+ }
+ },
+ "item_type": "class",
+ "length": 168,
+ "docLength": 5
+ },
+ {
+ "id": "ed0261d6-89e8-f091-3247-bb33d2af49eb",
+ "ancestors": [
+ "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de"
+ ],
+ "description": "Inflates a layout file and returns it as the root view for a fragment. The inflated layout is specified by the resource ID `R.layout.remote_sensables_fragment`, and the container is provided as part of the method call.",
+ "params": [
+ {
+ "name": "layoutInflater",
+ "type_name": "LayoutInflater",
+ "description": "LayoutInflater object that is used to inflate or create an instance of the layout specified by R.layout.remote_sensables_fragment and returns the View object representing the inflated view hierarchy.",
+ "complex_type": false
+ },
+ {
+ "name": "container",
+ "type_name": "ViewGroup",
+ "description": "ViewGroup to which the View returned by the method will be added, and it is used as the parent for the inflated view.",
+ "complex_type": false
+ },
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "bundle of data previously saved by the host activity through the `onSaveInstanceState` method, and is passed to the fragment for restoration after its process is recreated.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "View",
+ "description": "an inflated view of a specific layout from the given resource.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "LayoutInflater layoutInflater = LayoutInflater.from(getActivity());\nView view = layoutInflater.inflate(R.layout.remote_sensables_fragment, null, false);\n",
+ "description": "\nInputs: ('layoutInflater', 'LayoutInflater'), ('container', 'null'), ('savedInstanceState', 'Bundle')."
+ },
+ "name": "onCreateView",
+ "location": {
+ "start": 86,
+ "insert": 42,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 41,
+ "end": 85
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 44
+ },
+ {
+ "id": "78e76da6-889c-5398-374c-0eae9dfcdd15",
+ "ancestors": [
+ "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de"
+ ],
+ "description": "Initializes a list and makes a REST call to retrieve a list of sensibles from an API. The response is processed and added to an internal list, then notifies an adapter to update the UI. If the request fails, it logs the error to the console.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public void onStart() {\n super.onStart();\n initialiseList();\n RestAdapter restAdapter = new RestAdapter.Builder()\n .setLogLevel(RestAdapter.LogLevel.FULL)\n .setEndpoint(\"http://sensable.io\")\n .build();\n\n SensableService service = restAdapter.create(SensableService.class);\n\n service.listSensables(new Callback>() {\n @Override\n public void success(List sensables, Response response) {\n Log.d(TAG, \"Callback Success \" + sensables.size());\n mSensables.clear();\n mSensables.addAll(sensables);\n mListArrayAdapter.notifyDataSetChanged();\n }\n\n @Override\n public void failure(RetrofitError retrofitError) {\n Log.e(TAG, \"Callback failure \" + retrofitError.toString());\n }\n });\n}\n",
+ "description": ""
+ },
+ "name": "onStart",
+ "location": {
+ "start": 96,
+ "insert": 91,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 90,
+ "end": 95
+ }
+ },
+ "item_type": "method",
+ "length": 54,
+ "docLength": 5
+ },
+ {
+ "id": "1fb6bd66-5f35-27a6-1f43-351e1f4198e8",
+ "ancestors": [
+ "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de",
+ "78e76da6-889c-5398-374c-0eae9dfcdd15"
+ ],
+ "description": "Processes a list of `sensables`. It logs a message, clears an existing list, updates it with new elements, and notifies a data adapter to refresh its display.",
+ "params": [
+ {
+ "name": "sensables",
+ "type_name": "List",
+ "description": "list of Sensable objects returned by an API or similar operation, which is then cleared and updated in the local cache.",
+ "complex_type": false
+ },
+ {
+ "name": "response",
+ "type_name": "Response",
+ "description": "result of an operation, which is not utilized in this callback method.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "List sensables = new ArrayList<>();\nsensables.add(new Sensable(\"id1\", \"name1\", \"description1\", 1));\nsensables.add(new Sensable(\"id2\", \"name2\", \"description2\", 2));\n\nsuccess(sensables, null);\n",
+ "description": ""
+ },
+ "name": "success",
+ "location": {
+ "start": 125,
+ "insert": 108,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 107,
+ "end": 124
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 17
+ },
+ {
+ "id": "7147eb7e-c1c0-d9b2-0c45-0a56ff50a6d4",
+ "ancestors": [
+ "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de",
+ "78e76da6-889c-5398-374c-0eae9dfcdd15"
+ ],
+ "description": "Logs an error message to the console when a Retrofit request fails. The error message includes the details of the RetrofitError object. This allows for debugging and troubleshooting failed requests.",
+ "params": [
+ {
+ "name": "retrofitError",
+ "type_name": "RetrofitError",
+ "description": "error that occurred during the execution of a Retrofit request, and its value is passed to the `Log.e` method for debugging purposes.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void onFailure(RetrofitError retrofitError) {\n Log.e(TAG, \"Callback failure \" + retrofitError.toString());\n}\n",
+ "description": ""
+ },
+ "name": "failure",
+ "location": {
+ "start": 143,
+ "insert": 133,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 132,
+ "end": 142
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 10
+ },
+ {
+ "id": "e9518aa1-264b-d093-064f-8347e5152de5",
+ "ancestors": [
+ "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de"
+ ],
+ "description": "Initializes a list view with an array adapter and sets an on-click listener to handle item selection events. When an item is clicked, it creates an intent for the SensableActivity class and passes the selected item as an extra parameter.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public class RemoteSensablesFragment extends Fragment {\n // Initialize list view\n private void initialiseList() {\n final ListView sensableList = (ListView) getView().findViewById(R.id.sensable_list);\n\n mSensables = new ArrayList();\n mListArrayAdapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, mSensables);\n sensableList.setAdapter(mListArrayAdapter);\n\n //add onclick to listview\n sensableList.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView> parent, View view, int position, long id) {\n Intent intent = new Intent(getActivity(), SensableActivity.class);\n intent.putExtra(RemoteSensablesFragment.EXTRA_SENSABLE, (Sensable) parent.getItemAtPosition(position));\n startActivity(intent);\n }\n });\n }\n}\n",
+ "description": ""
+ },
+ "name": "initialiseList",
+ "location": {
+ "start": 156,
+ "insert": 151,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 150,
+ "end": 155
+ }
+ },
+ "item_type": "method",
+ "length": 43,
+ "docLength": 5
+ },
+ {
+ "id": "e4030e48-37b8-e586-644f-52a3e58f9a57",
+ "ancestors": [
+ "7ce82e6f-c5d8-adb9-5e44-877fa44ba3de",
+ "e9518aa1-264b-d093-064f-8347e5152de5"
+ ],
+ "description": "Handles item clicks in an adapter view. When an item is clicked, it creates an intent to start a new activity (`SensibleActivity`) with a specific extra parameter (`EXTRA_SENSABLE`) set to the selected item from the parent adapter view. The intent then starts the new activity.",
+ "params": [
+ {
+ "name": "parent",
+ "type_name": "AdapterView>",
+ "description": "AdapterView whose item has been clicked, providing information about the adapter that is being used to populate the view.",
+ "complex_type": false
+ },
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "View object that was clicked by the user, providing access to its properties and methods for further processing.",
+ "complex_type": false
+ },
+ {
+ "name": "position",
+ "type_name": "int",
+ "description": "0-based index of the item that was clicked within the AdapterView.",
+ "complex_type": false
+ },
+ {
+ "name": "id",
+ "type_name": "long",
+ "description": "64-bit unique identifier of the item at the specified position in the adapter.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "parent(AdapterView>), view(View)\n",
+ "description": "\nThe \"parent\" argument should be an instance of AdapterView that triggers the click event. The \"view\" argument represents the View that was clicked and is used to identify the position of the item in the adapter."
+ },
+ "name": "onItemClick",
+ "location": {
+ "start": 191,
+ "insert": 165,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 164,
+ "end": 190
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 26
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "LocalSensablesFragment.java",
+ "path": "client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java",
+ "content": {
+ "structured": {
+ "description": "A fragment named `LocalSensablesFragment` that displays a list view of scheduled sensors from a SQLite database. It uses the Android Loader framework to asynchronously load data from the content provider and display it in a list view. The fragment also handles item clicks by starting a new activity with the selected sensor's ID and unit.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n View [label=\"android.view.View\", style=\"rounded,filled\"]\n CursorLoader [label=\"android.support.v4.content.CursorLoader\", style=\"rounded,filled\"]\n ScheduledSensablesTable []\n ListView [label=\"android.widget.ListView\", style=\"rounded,filled\"]\n ScheduledSensableContentProvider []\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n SensableContentProvider []\n R [label=\"io.sensable.client.R\", style=\"rounded,filled\"]\n Fragment [label=\"android.support.v4.app.Fragment\", style=\"rounded,filled\"]\n TabsPagerAdapter []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n LocalSensablesFragment [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Sensable []\n SavedSensablesTable []\n ScheduledSensable []\n Loader [label=\"android.support.v4.content.Loader\", style=\"rounded,filled\"]\n ScheduleHelper []\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n LoaderManager [label=\"android.support.v4.app.LoaderManager\", style=\"rounded,filled\"]\n SensableActivity []\n LocalSensablesFragment -> SavedSensablesTable [style=\"dashed\"]\n LocalSensablesFragment -> Sensable [style=\"dashed\"]\n LayoutInflater -> LocalSensablesFragment [penwidth=1]\n TabsPagerAdapter -> LocalSensablesFragment [style=\"dashed\"]\n ListView -> LocalSensablesFragment [penwidth=1]\n LocalSensablesFragment -> Fragment [style=\"dashed\"]\n LocalSensablesFragment -> View [style=\"dashed\"]\n LocalSensablesFragment -> ViewGroup [style=\"dashed\"]\n LocalSensablesFragment -> ScheduledSensable [style=\"dashed\"]\n LocalSensablesFragment -> View [dir=\"both\", penwidth=2]\n LocalSensablesFragment -> Intent [style=\"dashed\"]\n LocalSensablesFragment -> Cursor [style=\"dashed\"]\n LocalSensablesFragment -> LoaderManager [style=\"dashed\"]\n LocalSensablesFragment -> CursorLoader [style=\"dashed\"]\n LocalSensablesFragment -> ScheduledSensableContentProvider [style=\"dashed\"]\n LocalSensablesFragment -> Cursor [dir=\"both\", penwidth=4]\n ViewGroup -> LocalSensablesFragment [penwidth=1]\n LocalSensablesFragment -> Bundle [style=\"dashed\"]\n LocalSensablesFragment -> LayoutInflater [style=\"dashed\"]\n LocalSensablesFragment -> ScheduleHelper [style=\"dashed\"]\n Bundle -> LocalSensablesFragment [penwidth=2]\n LocalSensablesFragment -> R [style=\"dashed\"]\n LocalSensablesFragment -> SensableContentProvider [style=\"dashed\"]\n LocalSensablesFragment -> Loader [style=\"dashed\"]\n LocalSensablesFragment -> SensableActivity [style=\"dashed\"]\n LocalSensablesFragment -> ScheduledSensablesTable [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablesupportcontentdatabaseosviewwidgetclientv4IntentCursorBundleLayoutInflaterViewViewGroupmodelListViewadapterviewsappcontentRSensableActivityschedulersqliteSensableScheduledSensableTabsPagerAdapterLocalSensablesFragmentFragmentLoaderManagerCursorLoaderLoaderScheduleHelperSavedSensablesTableScheduledSensableContentProviderScheduledSensablesTableSensableContentProviderimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.adapter.TabsPagerAdapter -> io.sensable.client.views.LocalSensablesFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.support.v4.app.Fragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.support.v4.app.LoaderManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.support.v4.content.CursorLoader: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.support.v4.content.Loader: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.R: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.SensableActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.views.LocalSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.LayoutInflater -> io.sensable.client.views.LocalSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.views.LocalSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.widget.ListView -> io.sensable.client.views.LocalSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment <-> android.database.Cursor: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.R: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.content.CursorLoader: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.Fragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.LoaderManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.content.Loader: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.widget.ListView: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "46e80ea7-36a2-5e9a-5540-7c65110d135c",
+ "ancestors": [],
+ "description": "Is responsible for displaying scheduled sensors in a list view and handling user interactions with the list items. It uses a CursorLoader to retrieve data from a SQLite database and displays the data in a SensableListAdapter. When an item is clicked, it starts an activity with sensor data for the selected sensable.",
+ "name": "LocalSensablesFragment",
+ "location": {
+ "start": 33,
+ "insert": 27,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 26,
+ "end": 32
+ }
+ },
+ "item_type": "class",
+ "length": 291,
+ "docLength": 6
+ },
+ {
+ "id": "c5aed063-eb06-b293-9e4f-e400b98816bd",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Inflates a view from an XML layout file into a container view group. The inflated view is a local sensables fragment with ID R.layout.local_sensables_fragment, and it does not attach the layout to the parent or add it to the child list of the container.",
+ "params": [
+ {
+ "name": "layoutInflater",
+ "type_name": "LayoutInflater",
+ "description": "LayoutInflater object that inflates the layout resource file specified by R.id.local_sensables_fragment into a View object.",
+ "complex_type": false
+ },
+ {
+ "name": "container",
+ "type_name": "ViewGroup",
+ "description": "parent view group where the inflated view will be added.",
+ "complex_type": false
+ },
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "bundle that contains data saved from the previous state of the fragment, allowing for restoration after configuration changes or orientation changes.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "androidviewView",
+ "description": "a view object inflated from `R.layout.local_sensables_fragment`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "LayoutInflater layoutInflater = LayoutInflater.from(getActivity());\nView view = layoutInflater.inflate(R.layout.local_sensables_fragment, null, false);\nreturn view;",
+ "description": ""
+ },
+ "name": "onCreateView",
+ "location": {
+ "start": 80,
+ "insert": 39,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 38,
+ "end": 79
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 41
+ },
+ {
+ "id": "1c6e6262-f898-20a3-3b41-26f0ce29250d",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Initiates the execution sequence by first calling its superclass's `onStart` method, and then it invokes the `initialiseList` method to set up the list for further processing. This function is a crucial part of the initialization process in an Android application.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public class Main extends AppCompatActivity {\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n LocalSensablesFragment localSensablesFragment = new LocalSensablesFragment();\n getSupportFragmentManager().beginTransaction().add(localSensablesFragment, \"localSensablesFragment\").commit();\n\n }\n\n @Override\n public void onStart() {\n super.onStart();\n // Any code that should be executed after the activity has started.\n }\n}\n",
+ "description": ""
+ },
+ "name": "onStart",
+ "location": {
+ "start": 88,
+ "insert": 85,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 84,
+ "end": 87
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 3
+ },
+ {
+ "id": "496aec68-b64b-44ba-ee46-bf20e6a77023",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Initializes a list view by retrieving a ScheduleHelper instance, starting its scheduler, and attaching a cursor loader to the list view. It also sets an empty view for the list view when it is empty and adds an on-click listener to the list view.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public void onViewCreated(View view, Bundle savedInstanceState) {\n super.onViewCreated(view, savedInstanceState);\n initialiseList();\n}\n",
+ "description": "\nThis method will be called after the fragment's view has been created and its state is restored."
+ },
+ "name": "initialiseList",
+ "location": {
+ "start": 98,
+ "insert": 94,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 93,
+ "end": 97
+ }
+ },
+ "item_type": "method",
+ "length": 14,
+ "docLength": 4
+ },
+ {
+ "id": "0cd459b1-65f0-0098-de4c-f9f5f92daf78",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Handles user clicks on a list item and starts an activity with sensor data for the selected ScheduledSensable. It retrieves the corresponding ScheduledSensable object from the database based on the clicked position, creates an Intent to launch SensableActivity, and passes necessary data to it.",
+ "params": [],
+ "returns": {
+ "type_name": "AdapterViewOnItemClickListener",
+ "description": "an AdapterView.OnItemClickListener.\n\nReturns an AdapterView.OnItemClickListener that handles user clicks on a list item and starts an activity with sensor data for the selected sensable. \nIt takes four parameters in its onItemClick method: parent AdapterView, View object that was clicked, int position, and long id.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "ListView sensableList = (ListView) getView().findViewById(R.id.scheduled_sensable_list);\nsensableList.setOnItemClickListener(getScheduledSensableListener());\n",
+ "description": ""
+ },
+ "name": "getScheduledSensableListener",
+ "location": {
+ "start": 132,
+ "insert": 113,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 112,
+ "end": 131
+ }
+ },
+ "item_type": "method",
+ "length": 46,
+ "docLength": 19
+ },
+ {
+ "id": "941be6d3-bb84-b28a-cf40-8113a9bfdacf",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c",
+ "0cd459b1-65f0-0098-de4c-f9f5f92daf78"
+ ],
+ "description": "Retrieves a scheduled sensable from a table based on user selection, creates an intent to start SensableActivity with selected sensable data, and starts the activity with the intent.",
+ "params": [
+ {
+ "name": "parent",
+ "type_name": "AdapterView>",
+ "description": "`AdapterView` that contains the view at the specified position, which is used to retrieve the item at that position and get its corresponding data from the database.\n\nParent is an instance of AdapterView, which extends View. Its main properties include position and id. The position indicates the current selected item in the adapter view, while id is a unique identifier for each row.",
+ "complex_type": true
+ },
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "View object that is associated with the selected item at the given position.\n\nView: represents a UI component. Properties include: parent (the AdapterView that generated this view), id (a unique identifier for this view), and layoutResource (the resource ID for this view's layout).",
+ "complex_type": true
+ },
+ {
+ "name": "position",
+ "type_name": "int",
+ "description": "0-based index of the item selected from the AdapterView, used to retrieve the corresponding Cursor object.",
+ "complex_type": false
+ },
+ {
+ "name": "id",
+ "type_name": "long",
+ "description": "64-bit integer row ID of the item selected from the adapter.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "@Override\npublic void onItemClick(AdapterView> parent, View view, int position, long id) {\n ScheduledSensable scheduledSensable = ScheduledSensablesTable.getScheduledSensable((Cursor) parent.getItemAtPosition(position));\n \n Intent intent = new Intent(getActivity(), SensableActivity.class);\n Sensable sensable = new Sensable();\n sensable.setSensorid(scheduledSensable.getSensorid());\n sensable.setUnit(scheduledSensable.getUnit());\n\n intent.putExtra(EXTRA_SENSABLE, sensable);\n startActivity(intent);\n}\n",
+ "description": ""
+ },
+ "name": "onItemClick",
+ "location": {
+ "start": 163,
+ "insert": 134,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 133,
+ "end": 162
+ }
+ },
+ "item_type": "method",
+ "length": 13,
+ "docLength": 29
+ },
+ {
+ "id": "c880f73b-4a92-87b5-6247-bc4b65e460a3",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Initializes a list view adapter and sets it to a list view. It also prepares a loader manager to load data into the adapter.",
+ "params": [
+ {
+ "name": "listView",
+ "type_name": "ListView",
+ "description": "ListView object to which the adapter and cursor loader are assigned, allowing for data population and rendering within the list.\n\nDefine. Has no ID attribute defined.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ListView listView = new ListView(this); // assuming 'this' is the activity or context\nattachCursorLoader(listView);\n",
+ "description": "\nThis will prepare a loader for retrieving data from ScheduledSensableContentProvider and display it in the ListView."
+ },
+ "name": "attachCursorLoader",
+ "location": {
+ "start": 213,
+ "insert": 190,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 189,
+ "end": 212
+ }
+ },
+ "item_type": "method",
+ "length": 17,
+ "docLength": 23
+ },
+ {
+ "id": "a52dce51-5d3d-6ead-d448-3a70e73d55df",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Creates and returns a `CursorLoader` instance that retrieves data from the `ScheduledSensableContentProvider`. It takes care of creating a cursor for displaying the scheduled sensable content, using the specified URI, projection, selection criteria, and sort order.",
+ "params": [
+ {
+ "name": "id",
+ "type_name": "int",
+ "description": "0-based identifier of the loader being created and is used to determine which loader should be recreated if the data changes.",
+ "complex_type": false
+ },
+ {
+ "name": "args",
+ "type_name": "Bundle",
+ "description": "Bundle object that contains additional data or arguments to be passed to the Loader's operation.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "LoaderCursor",
+ "description": "a CursorLoader instance.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "@override\npublic Loader onCreateLoader(int id, Bundle args) {\n return new CursorLoader(getActivity(), ScheduledSensableContentProvider.CONTENT_URI,\n SCHEDULED_SENSABLE_PROJECTION, null, null, null);\n}\n",
+ "description": "\n\nExample inputs for ('id', 'int'):\n"
+ },
+ "name": "onCreateLoader",
+ "location": {
+ "start": 262,
+ "insert": 231,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 230,
+ "end": 261
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 31
+ },
+ {
+ "id": "63921f11-c7d3-9fb0-854c-e4f3502745cf",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Swaps a new cursor with an existing one, updating data for a specified adapter. The framework automatically closes the old cursor upon returning from this method.",
+ "params": [
+ {
+ "name": "loader",
+ "type_name": "Loader",
+ "description": "Loader that triggered the onLoadFinished callback, providing information about the loaded data.",
+ "complex_type": false
+ },
+ {
+ "name": "data",
+ "type_name": "Cursor",
+ "description": "Cursor object returned by the Loader which contains the query results that are then swapped into the adapter to update the UI.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "loader = new CursorLoader(getActivity(), ScheduledSensableContentProvider.CONTENT_URI, SCHEDULED_SENSABLE_PROJECTION, null, null, null);\nmAdapter.swapCursor(loader.load());\n",
+ "description": "\nInputs: ('loader', Loader)"
+ },
+ "name": "onLoadFinished",
+ "location": {
+ "start": 292,
+ "insert": 270,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 269,
+ "end": 291
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 22
+ },
+ {
+ "id": "4996f9d4-ba9b-c2b1-764d-1f85b536ca31",
+ "ancestors": [
+ "46e80ea7-36a2-5e9a-5540-7c65110d135c"
+ ],
+ "description": "Resets the loader by clearing its cursor and stopping its operation when the last cursor provided to `onLoadFinished` is about to be closed. This ensures that no further references are maintained to the cursor. The adapter's cursor is set to null.",
+ "params": [
+ {
+ "name": "loader",
+ "type_name": "Loader",
+ "description": "Loader object that provided the Cursor to be reset, which is about to be closed and needs to be handled properly.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void onLoaderReset(Loader loader) {\n mAdapter.swapCursor(null);\n}\n",
+ "description": "\nExample input: `loader` = Loader, `null`"
+ },
+ "name": "onLoaderReset",
+ "location": {
+ "start": 316,
+ "insert": 300,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 299,
+ "end": 315
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 16
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "FavouriteSensablesFragment.java",
+ "path": "client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java",
+ "content": {
+ "structured": {
+ "description": "A fragment that displays a list of favourite sensors in an Android application. It utilizes a CursorLoader to load data from a SQLite database and a custom adapter to display this data in a ListView. The fragment also includes methods for initializing the list, attaching a cursor loader to the ListView, and handling item clicks on the list.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"android\"\n color=\"#33363A\"\n View [label=\"android.view.View\", style=\"rounded,filled\"]\n Bundle [label=\"android.os.Bundle\", style=\"rounded,filled\"]\n ListView [label=\"android.widget.ListView\", style=\"rounded,filled\"]\n ViewGroup [label=\"android.view.ViewGroup\", style=\"rounded,filled\"]\n LayoutInflater [label=\"android.view.LayoutInflater\", style=\"rounded,filled\"]\n Intent [label=\"android.content.Intent\", style=\"rounded,filled\"]\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n subgraph cluster_3 {\n label=\"support/v4\"\n color=\"#33363A\"\n CursorLoader [label=\"android.support.v4.content.CursorLoader\", style=\"rounded,filled\"]\n Loader [label=\"android.support.v4.content.Loader\", style=\"rounded,filled\"]\n Fragment [label=\"android.support.v4.app.Fragment\", style=\"rounded,filled\"]\n LoaderManager [label=\"android.support.v4.app.LoaderManager\", style=\"rounded,filled\"]\n }\n }\n subgraph cluster_5 {\n label=\"io/sensable\"\n color=\"#33363A\"\n SensableActivity []\n Sensable []\n R [label=\"io.sensable.client.R\", style=\"rounded,filled\"]\n subgraph cluster_6 {\n label=\"client\"\n color=\"#33363A\"\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n FavouriteSensablesFragment [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n ScheduleHelper []\n TabsPagerAdapter []\n SensableContentProvider []\n SavedSensablesTable []\n }\n }\n FavouriteSensablesFragment -> Cursor [style=\"dashed\"]\n TabsPagerAdapter -> FavouriteSensablesFragment [style=\"dashed\"]\n FavouriteSensablesFragment -> SavedSensablesTable [style=\"dashed\"]\n FavouriteSensablesFragment -> ScheduleHelper [style=\"dashed\"]\n LayoutInflater -> FavouriteSensablesFragment [penwidth=1]\n FavouriteSensablesFragment -> R [style=\"dashed\"]\n FavouriteSensablesFragment -> SensableContentProvider [style=\"dashed\"]\n ListView -> FavouriteSensablesFragment [penwidth=1]\n FavouriteSensablesFragment -> Bundle [style=\"dashed\"]\n FavouriteSensablesFragment -> Loader [style=\"dashed\"]\n FavouriteSensablesFragment -> LoaderManager [style=\"dashed\"]\n FavouriteSensablesFragment -> Sensable [style=\"dashed\"]\n FavouriteSensablesFragment -> View [dir=\"both\", penwidth=2]\n ViewGroup -> FavouriteSensablesFragment [penwidth=1]\n FavouriteSensablesFragment -> Fragment [style=\"dashed\"]\n FavouriteSensablesFragment -> LayoutInflater [style=\"dashed\"]\n FavouriteSensablesFragment -> ViewGroup [style=\"dashed\"]\n FavouriteSensablesFragment -> Intent [style=\"dashed\"]\n FavouriteSensablesFragment -> Cursor [dir=\"both\", penwidth=4]\n Bundle -> FavouriteSensablesFragment [penwidth=2]\n FavouriteSensablesFragment -> CursorLoader [style=\"dashed\"]\n FavouriteSensablesFragment -> SensableActivity [style=\"dashed\"]\n FavouriteSensablesFragment -> View [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablesupportcontentdatabaseosviewwidgetclientv4IntentCursorBundleLayoutInflaterViewViewGroupmodelListViewadapterviewsappcontentRSensableActivityschedulersqliteSensableTabsPagerAdapterFavouriteSensablesFragmentFragmentLoaderManagerCursorLoaderLoaderScheduleHelperSavedSensablesTableSensableContentProviderimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.adapter.TabsPagerAdapter -> io.sensable.client.views.FavouriteSensablesFragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.support.v4.app.Fragment: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.content.Intent: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.os.Bundle: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.support.v4.app.LoaderManager: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.support.v4.content.CursorLoader: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.support.v4.content.Loader: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.view.LayoutInflater: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.view.View: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> android.view.ViewGroup: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.R: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.SensableActivity: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.scheduler.ScheduleHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Bundle -> io.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.LayoutInflater -> io.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.view.ViewGroup -> io.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.widget.ListView -> io.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment <-> android.view.View: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment <-> android.database.Cursor: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.support.v4.content.CursorLoader: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.R: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.Intent: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.Fragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.app.LoaderManager: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.support.v4.content.Loader: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.view.LayoutInflater: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.adapter.TabsPagerAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Bundle: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.ViewGroup: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.view.View: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.widget.ListView: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "5cea7178-3a02-9e8f-ad46-9db81d7a9365",
+ "ancestors": [],
+ "description": "Is a fragment in an Android application that displays a list of favourite sensors and allows users to view detailed information about each sensor by clicking on it. The class uses a CursorLoader to load data from a SQLite database and display it in a ListView.",
+ "name": "FavouriteSensablesFragment",
+ "location": {
+ "start": 30,
+ "insert": 24,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 23,
+ "end": 29
+ }
+ },
+ "item_type": "class",
+ "length": 268,
+ "docLength": 6
+ },
+ {
+ "id": "6df6d5c6-895a-348e-c448-96401c775c27",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Inflates a view from an XML layout file into a new instance of the Fragment class. It specifies the ID of the layout to inflate and returns it as the root view for the fragment. The container is the parent view group where the inflated view will be placed.",
+ "params": [
+ {
+ "name": "layoutInflater",
+ "type_name": "LayoutInflater",
+ "description": "LayoutInflater object that is used to inflate a view hierarchy from a XML layout resource file.",
+ "complex_type": false
+ },
+ {
+ "name": "container",
+ "type_name": "ViewGroup",
+ "description": "parent view group where the layout is inflated and returned, allowing for the new view hierarchy to be added to the activity's view tree.",
+ "complex_type": false
+ },
+ {
+ "name": "savedInstanceState",
+ "type_name": "Bundle",
+ "description": "bundle object that holds the UI state of the fragment being restored after its process is killed by the Android system.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "androidviewView",
+ "description": "a view inflated from the `R.layout.favourite_sensables_fragment` XML layout.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "LayoutInflater layoutInflater = LayoutInflater.from(getActivity());\nView view = layoutInflater.inflate(R.layout.favourite_sensables_fragment, null, false); \n",
+ "description": "\nIn this example, the LayoutInflater class from Android is being created and passed to the inflate() method along with two parameters - R.layout.favourite_sensables_fragment (the ID of the layout file) and a null value for ViewGroup."
+ },
+ "name": "onCreateView",
+ "location": {
+ "start": 73,
+ "insert": 36,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 35,
+ "end": 72
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 37
+ },
+ {
+ "id": "a6e0e296-bad1-7a84-c045-340ac8fee338",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Initializes a list when an application starts. It overrides the `onStart` method from its superclass, ensuring that the list is set up at the beginning of the program's lifecycle. The `initialiseList` method is called to complete the initialization process.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "public class ExampleActivity extends AppCompatActivity {\n private FavouriteSensablesFragment favouriteSensablesFragment;\n \n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n favouriteSensablesFragment = (FavouriteSensablesFragment) getSupportFragmentManager().findFragmentById(R.id.favourite_sensables_fragment);\n\n // Rest of your code...\n }\n\n @Override\n public void onStart() {\n super.onStart();\n favouriteSensablesFragment.initialiseList();\n }\n}\n",
+ "description": ""
+ },
+ "name": "onStart",
+ "location": {
+ "start": 81,
+ "insert": 78,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 77,
+ "end": 80
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 3
+ },
+ {
+ "id": "ec72ad71-3c9e-5cbe-1944-2a3490d45dde",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Initializes a list view and its associated components for displaying sensable data. It starts a scheduler, attaches a cursor loader to the list view, sets an empty view, and adds an on-click listener to the list view.",
+ "params": [],
+ "usage": {
+ "language": "java",
+ "code": "initialiseList();\n",
+ "description": "\nThis will initiate the list by finding the ListView and attaching a CursorLoader to it, then setting an empty view for the list if there are no items in it. It also sets an OnItemClickListener to handle clicks on the list items."
+ },
+ "name": "initialiseList",
+ "location": {
+ "start": 91,
+ "insert": 87,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 86,
+ "end": 90
+ }
+ },
+ "item_type": "method",
+ "length": 14,
+ "docLength": 4
+ },
+ {
+ "id": "d1ba6757-e7a4-bd8b-9541-ca55d5d6d087",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Returns an event listener for a list view item click. When an item is clicked, it creates an intent to open the `SensableActivity`, retrieves the corresponding sensable object from the database, and passes it as an extra in the intent.",
+ "params": [],
+ "returns": {
+ "type_name": "AdapterViewOnItemClickListener",
+ "description": "an `AdapterView.OnItemClickListener`.\n\nThe returned object is an instance of `AdapterView.OnItemClickListener`, which implements the `onItemClick` method. This method takes four parameters: `parent`, `view`, `position`, and `id`.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "ListView sensableList = (ListView) getView().findViewById(R.id.saved_sensable_list);\nsensableList.setOnItemClickListener(getSavedSensableListener());\n",
+ "description": "\nIn this example, the `getSavedSensableListener` method is called to create an instance of `AdapterView.OnItemClickListener`. This listener will be used by a ListView (`sensableList`) to handle item clicks."
+ },
+ "name": "getSavedSensableListener",
+ "location": {
+ "start": 128,
+ "insert": 106,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 105,
+ "end": 127
+ }
+ },
+ "item_type": "method",
+ "length": 40,
+ "docLength": 22
+ },
+ {
+ "id": "d11ebc98-0b56-99b7-f743-98059dfe2a91",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365",
+ "d1ba6757-e7a4-bd8b-9541-ca55d5d6d087"
+ ],
+ "description": "Handles an item click event from an adapter view. It creates an intent to start a new activity, retrieves the corresponding sensable object from a table using a cursor, adds it as an extra to the intent, and then starts the activity with the specified sensable.",
+ "params": [
+ {
+ "name": "parent",
+ "type_name": "AdapterView>",
+ "description": "AdapterView that generated the click event and provides access to the item at the given position.",
+ "complex_type": false
+ },
+ {
+ "name": "view",
+ "type_name": "View",
+ "description": "View object that is clicked, allowing for manipulation of its properties or actions to be performed on it.",
+ "complex_type": false
+ },
+ {
+ "name": "position",
+ "type_name": "int",
+ "description": "1-based index of the item within the AdapterView that was clicked, used to retrieve the corresponding data from the adapter.",
+ "complex_type": false
+ },
+ {
+ "name": "id",
+ "type_name": "long",
+ "description": "64-bit row ID of the item at the given position in the adapter's data set.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class MainActivity extends AppCompatActivity {\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n // Initialize the ListView and attach a CursorLoader to it\n ListView sensableList = (ListView) findViewById(R.id.saved_sensable_list);\n FavouriteSensablesFragment favouriteSensablesFragment = new FavouriteSensablesFragment();\n favouriteSensablesFragment.attachCursorLoader(sensableList);\n\n // Start the Scheduler to load data from the SQLite database\n ScheduleHelper scheduleHelper = new ScheduleHelper(this);\n scheduleHelper.startScheduler();\n }\n}\n",
+ "description": ""
+ },
+ "name": "onItemClick",
+ "location": {
+ "start": 159,
+ "insert": 130,
+ "offset": " ",
+ "indent": 12,
+ "comment": {
+ "start": 129,
+ "end": 158
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 29
+ },
+ {
+ "id": "6de40f4e-d90d-dfbb-3045-3410840e9ef0",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Initializes and sets a list view adapter to display data from a database table. It prepares a loader to retrieve data and attaches it to the list view for display.",
+ "params": [
+ {
+ "name": "listView",
+ "type_name": "ListView",
+ "description": "ListView to which an adapter is set, displaying data retrieved from the database via a CursorLoader.\n\nGets or sets the list view's adapter. It is an AdapterView that shows a list of items.",
+ "complex_type": true
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ListView listView = (ListView) findViewById(R.id.list_view);\nattachCursorLoader(listView);",
+ "description": ""
+ },
+ "name": "attachCursorLoader",
+ "location": {
+ "start": 195,
+ "insert": 180,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 179,
+ "end": 194
+ }
+ },
+ "item_type": "method",
+ "length": 16,
+ "docLength": 15
+ },
+ {
+ "id": "83acab5d-3425-40a5-8948-0b4ca6539bf4",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Creates and returns a CursorLoader that retrieves data from the Sensable Content Provider using its CONTENT_URI, SENSABLE_PROJECTION, and query parameters. The retrieved cursor is then used to display the data.",
+ "params": [
+ {
+ "name": "id",
+ "type_name": "int",
+ "description": "0-based identifier of the Loader to be created or replaced.",
+ "complex_type": false
+ },
+ {
+ "name": "args",
+ "type_name": "Bundle",
+ "description": "Bundle object that contains additional data and is passed from an Activity to the LoaderManager for further processing.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "LoaderCursor",
+ "description": "a CursorLoader instance for retrieving data from Sensable Content Provider.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public Loader onCreateLoader(int id, Bundle args) {\n return new CursorLoader(getActivity(), SensableContentProvider.CONTENT_URI,\n SENSABLE_PROJECTION, null, null, null);\n}\n\n// Example usage:\n\nint loaderId = 0;\nBundle bundle = null;\n\nLoader cursorLoader = onCreateLoader(loaderId, bundle);",
+ "description": ""
+ },
+ "name": "onCreateLoader",
+ "location": {
+ "start": 243,
+ "insert": 212,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 211,
+ "end": 242
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 31
+ },
+ {
+ "id": "2179977a-94ec-608e-8747-81fd732deb0c",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Swaps the loaded cursor into the adapter, replacing any existing cursor. The framework automatically closes the old cursor after the new one is set. This allows the data to be displayed in the UI once it has been successfully loaded.",
+ "params": [
+ {
+ "name": "loader",
+ "type_name": "Loader",
+ "description": "Loader object that triggered this callback, providing the Cursor data as an argument for further processing.",
+ "complex_type": false
+ },
+ {
+ "name": "data",
+ "type_name": "Cursor",
+ "description": "Cursor object containing the query results, which is swapped with the existing cursor by calling `mAdapter.swapCursor(data)`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void onLoadFinished(Loader loader, Cursor data) {\n mAdapter.swapCursor(data);\n}\n",
+ "description": "\nInputs: \n- `loader`: Loader object that provides the Cursor data to be processed by the onLoadFinished() method.\n- `data`: The cursor containing the new data."
+ },
+ "name": "onLoadFinished",
+ "location": {
+ "start": 269,
+ "insert": 251,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 250,
+ "end": 268
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 18
+ },
+ {
+ "id": "64d879ba-ce8a-23b4-0a45-d6db4fc33cb9",
+ "ancestors": [
+ "5cea7178-3a02-9e8f-ad46-9db81d7a9365"
+ ],
+ "description": "Resets the cursor provided by the Loader and swaps it with null, ensuring the previous cursor is closed and not used further. This is necessary when the last cursor supplied to `onLoadFinished` is about to be closed.",
+ "params": [
+ {
+ "name": "loader",
+ "type_name": "Loader",
+ "description": "Loader that is being reset, providing information about the previous cursor data.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "loader.onReset();\n",
+ "description": "\nInput: ('loader', Loader)"
+ },
+ "name": "onLoaderReset",
+ "location": {
+ "start": 290,
+ "insert": 277,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 276,
+ "end": 289
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 13
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SavedSensablesTable.java",
+ "path": "client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java",
+ "content": {
+ "structured": {
+ "description": "A SQLite database table named \"saved_sensables\" for storing sensor data from various sensors with their corresponding locations, sensor IDs, types, and units. The table is created when the application starts using the `onCreate` method, and upgraded if necessary by dropping the existing table and re-creating it with `onUpgrade`.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_2 {\n label=\"io/sensable\"\n color=\"#33363A\"\n SensableActivity []\n Sensable []\n Sample []\n CreateSensableFragment []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n ScheduleHelper []\n SensableListAdapter []\n FavouriteSensablesFragment []\n LocalSensablesFragment []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SavedSensablesTable [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n }\n subgraph cluster_4 {\n label=\"org\"\n color=\"#33363A\"\n JSONException [label=\"org.json.JSONException\", style=\"rounded,filled\"]\n JSONObject [label=\"org.json.JSONObject\", style=\"rounded,filled\"]\n }\n subgraph cluster_5 {\n label=\"android\"\n color=\"#33363A\"\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n subgraph cluster_6 {\n label=\"database\"\n color=\"#33363A\"\n SQLiteDatabase [label=\"android.database.sqlite.SQLiteDatabase\", style=\"rounded,filled\"]\n }\n }\n CreateSensableFragment -> SavedSensablesTable [style=\"dashed\"]\n LocalSensablesFragment -> SavedSensablesTable [style=\"dashed\"]\n SavedSensablesTable -> Cursor [style=\"dashed\"]\n SavedSensablesTable -> JSONObject [style=\"dashed\"]\n SensableActivity -> SavedSensablesTable [style=\"dashed\"]\n Cursor -> SavedSensablesTable [penwidth=1]\n SavedSensablesTable -> ContentValues [style=\"dashed\"]\n SQLiteDatabase -> SavedSensablesTable [penwidth=2]\n FavouriteSensablesFragment -> SavedSensablesTable [style=\"dashed\"]\n SavedSensablesTable -> SQLiteDatabase [style=\"dashed\"]\n SavedSensablesTable -> Sample [style=\"dashed\"]\n SavedSensablesTable -> JSONException [style=\"dashed\"]\n SavedSensablesTable -> ContentValues [penwidth=2]\n ScheduleHelper -> SavedSensablesTable [style=\"dashed\"]\n SensableListAdapter -> SavedSensablesTable [style=\"dashed\"]\n SavedSensablesTable -> Sensable [style=\"dashed\"]\n Sensable -> SavedSensablesTable [dir=\"both\", penwidth=3]\n}\n",
+ "d2": "ioandroidorgsensablecontentdatabasejsonclientContentValuesCursorsqlitemodelJSONExceptionJSONObjectCreateSensableFragmentsqliteSensableActivityschedulerSQLiteDatabaseSampleSensableviewsSavedSensablesTableScheduleHelperFavouriteSensablesFragmentLocalSensablesFragmentSensableListAdapterimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> android.database.sqlite.SQLiteDatabase: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> org.json.JSONException: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> org.json.JSONObject: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.client.sqlite.SavedSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.database.Cursor -> io.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase -> io.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> android.content.ContentValues: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable <-> io.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONException: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.views.SensableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "da78db0c-b2c3-f9b1-9b48-1bea9bd47d03",
+ "ancestors": [],
+ "description": "Is responsible for managing sensor data in a SQLite database. It provides methods to create and upgrade the database schema, serialize and deserialize Sensable objects, and retrieve Sensable objects from a cursor.",
+ "name": "SavedSensablesTable",
+ "location": {
+ "start": 20,
+ "insert": 14,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 13,
+ "end": 19
+ }
+ },
+ "item_type": "class",
+ "length": 217,
+ "docLength": 6
+ },
+ {
+ "id": "98e3b369-a073-388d-664c-41f090063c63",
+ "ancestors": [
+ "da78db0c-b2c3-f9b1-9b48-1bea9bd47d03"
+ ],
+ "description": "Executes a SQL statement to create a table in a SQLite database when it is first created. The SQL statement is stored in the `DATABASE_CREATE` variable and is executed on the provided `SQLiteDatabase`. This function initializes the database with the specified schema.",
+ "params": [
+ {
+ "name": "database",
+ "type_name": "SQLiteDatabase",
+ "description": "SQLiteDatabase object that is passed to the onCreate method, allowing the method to execute SQL commands on it.",
+ "complex_type": false
+ }
+ ],
+ "name": "onCreate",
+ "location": {
+ "start": 54,
+ "insert": 43,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 42,
+ "end": 53
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 11
+ },
+ {
+ "id": "fe3bec98-78e2-0ba4-1e41-a074453ec332",
+ "ancestors": [
+ "da78db0c-b2c3-f9b1-9b48-1bea9bd47d03"
+ ],
+ "description": "Drops an existing table and recreates it if a schema change occurs during the upgrade process of a SQLite database. It uses the `execSQL` method to execute SQL statements for dropping the table and then calls the `onCreate` function to recreate the table structure.",
+ "params": [
+ {
+ "name": "database",
+ "type_name": "SQLiteDatabase",
+ "description": "SQLiteDatabase object that is being upgraded or created, allowing for execution of SQL statements and other database operations.",
+ "complex_type": false
+ },
+ {
+ "name": "oldVersion",
+ "type_name": "int",
+ "description": "previous version of the database schema that was used prior to the current upgrade operation, allowing the function to determine what changes need to be made to bring it up to date with the new schema specified by `newVersion`.",
+ "complex_type": false
+ },
+ {
+ "name": "newVersion",
+ "type_name": "int",
+ "description": "current version of the database schema, which is used to determine whether any changes have been made and if so, the necessary actions are taken accordingly.",
+ "complex_type": false
+ }
+ ],
+ "name": "onUpgrade",
+ "location": {
+ "start": 76,
+ "insert": 59,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 58,
+ "end": 75
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 17
+ },
+ {
+ "id": "3b11a735-dbea-e799-7e4a-bc1f93467f4f",
+ "ancestors": [
+ "da78db0c-b2c3-f9b1-9b48-1bea9bd47d03"
+ ],
+ "description": "Creates a ContentValues object to store sensor data. It populates the object with various properties of a Sensable object, including location coordinates, sensor ID, type, name, last sample, and unit, transforming JSON-formatted samples into SQL-compatible values.",
+ "params": [
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object being serialized into a ContentValues object for storage in SQLite database.\n\nThe object has location with latitude and longitude coordinates, sensor ID, sensor type, name, last sample as JSON string, and unit. These properties are serialized into a ContentValues object.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "ContentValues",
+ "description": "a ContentValues object with various sensor details.\n\nThe output is an instance of `ContentValues`, which is a key-value pair container used for storing and retrieving data in SQLite databases. The keys are column names, and the values are corresponding data elements.",
+ "complex_type": true
+ },
+ "name": "serializeSensableForSqlLite",
+ "location": {
+ "start": 123,
+ "insert": 81,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 80,
+ "end": 122
+ }
+ },
+ "item_type": "method",
+ "length": 11,
+ "docLength": 42
+ },
+ {
+ "id": "b84cb056-8128-5387-3b49-4032384ca1ac",
+ "ancestors": [
+ "da78db0c-b2c3-f9b1-9b48-1bea9bd47d03"
+ ],
+ "description": "Converts a `Sensable` object into a `ContentValues` object for SQLite database storage. It takes a `sensable` object as input and populates the `ContentValues` with its sensor ID and a single sample in JSON format.",
+ "params": [
+ {
+ "name": "sensable",
+ "type_name": "Sensable",
+ "description": "object being serialized into a ContentValues instance.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "ContentValues",
+ "description": "a ContentValues object.",
+ "complex_type": false
+ },
+ "name": "serializeSensableWithSingleSampleForSqlLite",
+ "location": {
+ "start": 158,
+ "insert": 135,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 134,
+ "end": 157
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 23
+ },
+ {
+ "id": "97fc66ff-eda5-b38c-4145-9bc107b40852",
+ "ancestors": [
+ "da78db0c-b2c3-f9b1-9b48-1bea9bd47d03"
+ ],
+ "description": "Extracts data from a database cursor and populates a `Sensable` object with location, sensor ID, unit, sensor type, last sample, and name information. It also handles parsing a JSON string to create a `Sample` object if available in the database.",
+ "params": [
+ {
+ "name": "cursor",
+ "type_name": "Cursor",
+ "description": "ursor object that retrieves data from the database table and provides values to populate the `Sensable` object properties.\n\nMoves to a specific column by index or name. Returns -1 if the column does not exist.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "Sensable",
+ "description": "an instance of class `Sensable`.\n\nThe output is an object of type `Sensable`. It has a location property with latitude and longitude values, a sensor ID string, a unit string, a sensor type string, a sample array containing a single `Sample` object or an empty array if no sample exists, and a name string.",
+ "complex_type": true
+ },
+ "name": "getSensable",
+ "location": {
+ "start": 213,
+ "insert": 165,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 164,
+ "end": 212
+ }
+ },
+ "item_type": "method",
+ "length": 22,
+ "docLength": 48
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "ScheduledSensableContentProvider.java",
+ "path": "client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java",
+ "content": {
+ "structured": {
+ "description": "A ContentProvider named ScheduledSensableContentProvider which is responsible for managing data related to scheduled sensables in an SQLite database. It provides CRUD (Create, Read, Update, Delete) operations on the data and notifies the content resolver when changes occur. The provider uses a SensableDatabaseHelper class to interact with the database, which is a subclass of ContentObserver.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"database\"\n color=\"#33363A\"\n SQLiteQueryBuilder [label=\"android.database.sqlite.SQLiteQueryBuilder\", style=\"rounded,filled\"]\n SQLiteDatabase [label=\"android.database.sqlite.SQLiteDatabase\", style=\"rounded,filled\"]\n }\n subgraph cluster_2 {\n label=\"sensable\"\n color=\"#33363A\"\n SensableActivity []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n LocalSensablesFragment []\n ScheduleHelper []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n ScheduledSensableContentProvider [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n }\n }\n UriMatcher [label=\"android.content.UriMatcher\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n TextUtils [label=\"android.text.TextUtils\", style=\"rounded,filled\"]\n Uri [label=\"android.net.Uri\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n ContentProvider [label=\"android.content.ContentProvider\", style=\"rounded,filled\"]\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n Uri -> ScheduledSensableContentProvider [dir=\"both\", penwidth=6]\n ScheduledSensableContentProvider -> UriMatcher [style=\"dashed\"]\n ScheduledSensableContentProvider -> Cursor [penwidth=1]\n ScheduledSensableContentProvider -> Log [style=\"dashed\"]\n ScheduledSensableContentProvider -> Cursor [style=\"dashed\"]\n ScheduledSensableContentProvider -> SQLiteQueryBuilder [style=\"dashed\"]\n LocalSensablesFragment -> ScheduledSensableContentProvider [style=\"dashed\"]\n ScheduledSensableContentProvider -> ContentValues [style=\"dashed\"]\n ScheduledSensableContentProvider -> TextUtils [style=\"dashed\"]\n ScheduledSensableContentProvider -> SQLiteDatabase [style=\"dashed\"]\n ScheduledSensableContentProvider -> Uri [style=\"dashed\"]\n ContentValues -> ScheduledSensableContentProvider [penwidth=2]\n ScheduleHelper -> ScheduledSensableContentProvider [style=\"dashed\"]\n ScheduledSensableContentProvider -> ContentProvider [style=\"dashed\"]\n SensableActivity -> ScheduledSensableContentProvider [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablecontentdatabasenettextutilclientContentProviderContentValuesUriMatcherCursorsqliteUriTextUtilsLogSensableActivitysqliteschedulerSQLiteDatabaseSQLiteQueryBuilderviewsScheduledSensableContentProviderScheduleHelperLocalSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.content.ContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.content.UriMatcher: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.database.sqlite.SQLiteDatabase: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.database.sqlite.SQLiteQueryBuilder: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.net.Uri: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.text.TextUtils: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.ContentValues -> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.net.Uri <-> io.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider -> android.database.Cursor: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.UriMatcher: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteQueryBuilder: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.text.TextUtils: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensableContentProvider: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "7ced4b36-365f-4f93-214e-1f8b8d5a62a7",
+ "ancestors": [],
+ "description": "Is responsible for managing and providing access to scheduled sensables data through ContentResolver API. It handles CRUD operations (Create, Read, Update, Delete) on the ScheduledSensablesTable in a SQLite database.",
+ "name": "ScheduledSensableContentProvider",
+ "location": {
+ "start": 22,
+ "insert": 17,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 16,
+ "end": 21
+ }
+ },
+ "item_type": "class",
+ "length": 366,
+ "docLength": 5
+ },
+ {
+ "id": "2d0f001f-21a1-a480-9b48-8d83407e5b55",
+ "ancestors": [
+ "7ced4b36-365f-4f93-214e-1f8b8d5a62a7"
+ ],
+ "description": "Initializes a database helper and logs its details to the debug log. The function returns false indicating that it does not create any UI elements.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a string representation of the `SensibleDatabaseHelper` object.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public class MyActivity extends AppCompatActivity {\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n // Create a ContentResolver and query the ScheduledSensableContentProvider\n ContentResolver resolver = getContentResolver();\n Uri uri = Uri.parse(\"content://\" + ScheduledSensableContentProvider.AUTHORITY + \"/\" + ScheduledSensableContentProvider.BASE_PATH);\n Cursor cursor = resolver.query(uri, null, null, null, null);\n\n // Perform operations on the retrieved data\n while (cursor.moveToNext()) {\n String sensableId = cursor.getString(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_SENSABLE_ID));\n boolean isPending = cursor.getInt(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_PENDING)) == 1;\n // ...\n }\n }\n}\n",
+ "description": ""
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 51,
+ "insert": 45,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 44,
+ "end": 50
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 6
+ },
+ {
+ "id": "3f11f432-0ff5-58a5-2b47-69b788c3a639",
+ "ancestors": [
+ "7ced4b36-365f-4f93-214e-1f8b8d5a62a7"
+ ],
+ "description": "Returns a `Cursor` object that represents data retrieved from the database. It builds a SQL query based on the provided parameters (URI, projection, selection, etc.) and executes it against a SQLite database. The query results are then returned as a `Cursor`.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the data to be retrieved from the database and is used to determine which specific data to query based on the matched URI type.\n\nMatches a URI to an integer value through the `sURIMatcher`, resulting in the type of query (SENDERS, SENDER_ID or PENDING).",
+ "complex_type": true
+ },
+ {
+ "name": "projection",
+ "type_name": "String[]",
+ "description": "list of columns to include in the query results.\n\nThe array contains column names from the table to be returned in the result set. It may contain \"*\" for all columns or specific column names. If null is provided, all columns will be included.",
+ "complex_type": true
+ },
+ {
+ "name": "selection",
+ "type_name": "String",
+ "description": "where clause of the SQL query that is used to filter the results, allowing for more specific data retrieval based on specific conditions.",
+ "complex_type": false
+ },
+ {
+ "name": "selectionArgs",
+ "type_name": "String[]",
+ "description": "values that are replaced into the selection string to filter the result set, allowing for more secure and flexible query execution.\n\nIt is an array of strings representing the values to be inserted into the selection clause's parameters. The length of this array must match the number of '?' in the selection string.",
+ "complex_type": true
+ },
+ {
+ "name": "sortOrder",
+ "type_name": "String",
+ "description": "sorting criteria for the query results, allowing the database to order the output according to specific columns or expressions.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Cursor",
+ "description": "a Cursor object that contains data from a SQLite database.\n\nThe returned output is a Cursor object that contains data from the ScheduledSensablesTable in the database. It provides methods for traversing and processing the query results. The cursor includes sorting of the data based on the provided sortOrder parameter.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://\" + ScheduledSensableContentProvider.AUTHORITY + \"/\" + ScheduledSensableContentProvider.BASE_PATH);\nString[] projection = new String[]{ScheduledSensablesTable.COLUMN_SENSABLE_ID, ScheduledSensablesTable.COLUMN_PENDING};\nCursor cursor = getContentResolver().query(uri, projection, null, null, \"sortOrder\");\n",
+ "description": ""
+ },
+ "name": "query",
+ "location": {
+ "start": 132,
+ "insert": 58,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 57,
+ "end": 131
+ }
+ },
+ "item_type": "method",
+ "length": 29,
+ "docLength": 74
+ },
+ {
+ "id": "aa49130e-c2fb-78a0-4f4c-d37a95a9f74b",
+ "ancestors": [
+ "7ced4b36-365f-4f93-214e-1f8b8d5a62a7"
+ ],
+ "description": "Overrides a method from a superclass and returns a `String`. It takes a `Uri` as input, but always returns `null`, indicating that it does not provide any type information about the given Uri.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI (Uniform Resource Identifier) of the resource being requested, which is passed to the function for processing.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "String",
+ "description": "a null string.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://io.sensable.client.scheduledcontentprovider/senders\");\nString type = getContentResolver().getType(uri);\nLog.d(\"Type\", type);\n",
+ "description": ""
+ },
+ "name": "getType",
+ "location": {
+ "start": 174,
+ "insert": 162,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 161,
+ "end": 173
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 12
+ },
+ {
+ "id": "bcbdedcc-af46-91a5-f54d-da755b995a41",
+ "ancestors": [
+ "7ced4b36-365f-4f93-214e-1f8b8d5a62a7"
+ ],
+ "description": "Inserts a new record into the database based on the provided URI and ContentValues. It matches the URI type to determine the table to insert into, and returns the Uri of the newly inserted item.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the content provider for which data is being inserted and helps determine the table to be updated based on its match with the `sURIMatcher`.\n\nMatched by sURIMatcher with an integer value representing the URI type.",
+ "complex_type": true
+ },
+ {
+ "name": "values",
+ "type_name": "ContentValues",
+ "description": "ContentValues object that contains the data to be inserted into the database table specified by the URI.\n\nContains key-value pairs; each key-value pair represents a column-value pair for the table to be inserted into. The values are stored as ContentValues objects which can hold multiple rows' worth of data.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "Uri",
+ "description": "a parsed `Uri` object with an inserted record's ID.\n\nThe output is an object of type Uri, which represents a unique identifier for a data row in the database. This Uri contains the authority, path and query parameters. In this case, the Uri is constructed by parsing the CONTENT_URI and appending the inserted id to it.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://\" + AUTHORITY + \"/\" + BASE_PATH);\nContentValues values = new ContentValues();\nvalues.put(ScheduledSensablesTable.COLUMN_SENSABLE_ID, \"1\");\nvalues.put(ScheduledSensablesTable.COLUMN_PENDING, true);\n\nUri insertedUri = getContentResolver().insert(uri, values);",
+ "description": ""
+ },
+ "name": "insert",
+ "location": {
+ "start": 240,
+ "insert": 179,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 178,
+ "end": 239
+ }
+ },
+ "item_type": "method",
+ "length": 20,
+ "docLength": 61
+ },
+ {
+ "id": "bc929c62-a86d-5a88-c14a-18e9acb2dfb2",
+ "ancestors": [
+ "7ced4b36-365f-4f93-214e-1f8b8d5a62a7"
+ ],
+ "description": "Deletes data from a database based on the provided selection criteria. It handles two types of URIs: SENDERS and SENDER_ID, which correspond to different deletion scenarios. The function returns the number of rows deleted and notifies the content resolver to update the affected URI.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the content provider and is used to determine which table or record in the database should be deleted based on its match with the defined patterns in the `sURIMatcher`.\n\nMatched against a regular expression pattern using `sURIMatcher.match(uri)` to determine its type, which can be either SENDERS or SENDER_ID. The matched URI type is then used for further processing.",
+ "complex_type": true
+ },
+ {
+ "name": "selection",
+ "type_name": "String",
+ "description": "WHERE clause to be used for the deletion operation on the database table, allowing for conditional deletions based on specific criteria.",
+ "complex_type": false
+ },
+ {
+ "name": "selectionArgs",
+ "type_name": "String[]",
+ "description": "0-indexed array of values to bind as the replacement for each `?` found in the `selection` string.\n\nAn array of strings containing values to replace the `?` wildcards in the selection clause. If there are no wildcards, this array may be empty or null. The number and types of values in the array must match the number and types expected by the SQL statement.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "the number of rows deleted from the database.\n\nThe function returns an integer value representing the number of rows deleted from the database table.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://io.sensable.client.scheduledcontentprovider/senders/1\");\nint rowsDeleted = getContentResolver().delete(uri, \"pending=0\", null);\n",
+ "description": ""
+ },
+ "name": "delete",
+ "location": {
+ "start": 293,
+ "insert": 261,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 260,
+ "end": 292
+ }
+ },
+ "item_type": "method",
+ "length": 25,
+ "docLength": 32
+ },
+ {
+ "id": "8e6d19b6-78c0-f090-ea4c-f86be07a6d4f",
+ "ancestors": [
+ "7ced4b36-365f-4f93-214e-1f8b8d5a62a7"
+ ],
+ "description": "Updates data in a SQLite database based on a specified URI and ContentValues. It uses a switch statement to determine the type of update (by sender ID or by all senders) and returns the number of rows updated.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the data to be updated and is used to determine the type of data being updated and the corresponding database table.\n\nMatches with either SENDERS or SENDER_ID; last path segment can be an ID for SENDER_ID and is empty otherwise.",
+ "complex_type": true
+ },
+ {
+ "name": "values",
+ "type_name": "ContentValues",
+ "description": "new column values to be updated in the database table.\n\nContains ContentValues object with key-value pairs. The keys and values are strings. It represents data to be updated in the database.",
+ "complex_type": true
+ },
+ {
+ "name": "selection",
+ "type_name": "String",
+ "description": "WHERE clause of an SQL query that filters the data to be updated based on specific conditions.",
+ "complex_type": false
+ },
+ {
+ "name": "selectionArgs",
+ "type_name": "String[]",
+ "description": "values to bind into the selection statement for the SQLite update operation.\n\nArray of strings representing the values to be matched against the selection clause. The length of this array should match the number of '?' or ':' in the selection string.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer representing the number of rows updated.\n\nThe output is an integer representing the number of rows updated in the database table. This value can be zero indicating no rows were updated or a positive integer denoting the actual count of rows modified.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "ContentValues values = new ContentValues();\nvalues.put(ScheduledSensablesTable.COLUMN_NAME, \"New Name\");\n\nUri uri = Uri.parse(\"content://\" + AUTHORITY + \"/senders/\" + 1);\nint rowsUpdated = contentProvider.update(uri, values, null, null);\n\nLog.d(TAG, \"Rows updated: \" + rowsUpdated);\n",
+ "description": ""
+ },
+ "name": "update",
+ "location": {
+ "start": 358,
+ "insert": 319,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 318,
+ "end": 357
+ }
+ },
+ "item_type": "method",
+ "length": 28,
+ "docLength": 39
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "ScheduledSensablesTable.java",
+ "path": "client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java",
+ "content": {
+ "structured": {
+ "description": "A SQLite database table named `ScheduledSensablesTable` for storing scheduled sensor data. It provides methods for serializing and deserializing the data into `ContentValues` objects suitable for storage in SQLite databases using Android's ContentResolver. The code also includes functions to create, upgrade, and drop tables in the database.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_2 {\n label=\"io/sensable\"\n color=\"#33363A\"\n ScheduledSensable []\n Sample []\n SensableActivity []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n LocalSensablesFragment []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n ScheduledSensablesTable [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n ScheduledSensableService []\n ScheduleHelper []\n }\n }\n subgraph cluster_4 {\n label=\"org\"\n color=\"#33363A\"\n JSONException [label=\"org.json.JSONException\", style=\"rounded,filled\"]\n JSONObject [label=\"org.json.JSONObject\", style=\"rounded,filled\"]\n }\n subgraph cluster_5 {\n label=\"android\"\n color=\"#33363A\"\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n subgraph cluster_6 {\n label=\"database\"\n color=\"#33363A\"\n SQLiteDatabase [label=\"android.database.sqlite.SQLiteDatabase\", style=\"rounded,filled\"]\n }\n }\n ScheduledSensablesTable -> JSONException [style=\"dashed\"]\n ScheduledSensablesTable -> SQLiteDatabase [style=\"dashed\"]\n ScheduledSensablesTable -> Sample [style=\"dashed\"]\n ScheduledSensableService -> ScheduledSensablesTable [style=\"dashed\"]\n LocalSensablesFragment -> ScheduledSensablesTable [style=\"dashed\"]\n ScheduledSensablesTable -> JSONObject [style=\"dashed\"]\n ScheduledSensablesTable -> ScheduledSensable [style=\"dashed\"]\n ScheduleHelper -> ScheduledSensablesTable [style=\"dashed\"]\n SensableActivity -> ScheduledSensablesTable [style=\"dashed\"]\n Cursor -> ScheduledSensablesTable [penwidth=1]\n ScheduledSensablesTable -> Cursor [style=\"dashed\"]\n ScheduledSensable -> ScheduledSensablesTable [dir=\"both\", penwidth=2]\n ScheduledSensablesTable -> ContentValues [style=\"dashed\"]\n ScheduledSensablesTable -> ContentValues [penwidth=1]\n SQLiteDatabase -> ScheduledSensablesTable [penwidth=2]\n}\n",
+ "d2": "ioandroidorgsensablecontentdatabasejsonclientContentValuesCursorsqlitemodelJSONExceptionJSONObjectSensableActivitysqliteschedulerSQLiteDatabaseSampleScheduledSensableviewsScheduledSensablesTableScheduleHelperScheduledSensableServiceLocalSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> android.database.sqlite.SQLiteDatabase: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> org.json.JSONException: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> org.json.JSONObject: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.database.Cursor -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase -> io.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> android.content.ContentValues: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable <-> io.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONException: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "2349a131-dcc6-9a84-2444-bc85e2890161",
+ "ancestors": [],
+ "description": "Is responsible for managing a SQLite database table that stores scheduled sensor data. It provides methods for creating and upgrading the database schema, serializing and deserializing scheduled sensors to and from ContentValues objects, and retrieving scheduled sensor data from a cursor.",
+ "name": "ScheduledSensablesTable",
+ "location": {
+ "start": 20,
+ "insert": 14,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 13,
+ "end": 19
+ }
+ },
+ "item_type": "class",
+ "length": 182,
+ "docLength": 6
+ },
+ {
+ "id": "e2cd95e9-18e6-4c81-1c44-d1321f7ef003",
+ "ancestors": [
+ "2349a131-dcc6-9a84-2444-bc85e2890161"
+ ],
+ "description": "Executes a SQL command on a SQLite database to create tables. The `execSQL` method is used to execute the SQL command specified by the constant `DATABASE_CREATE`. This function is typically called when the database is created for the first time.",
+ "params": [
+ {
+ "name": "database",
+ "type_name": "SQLiteDatabase",
+ "description": "SQLiteDatabase object that is being used to execute the SQL command defined by the `DATABASE_CREATE` constant.",
+ "complex_type": false
+ }
+ ],
+ "name": "onCreate",
+ "location": {
+ "start": 52,
+ "insert": 42,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 41,
+ "end": 51
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 10
+ },
+ {
+ "id": "cbf898b9-07c5-83a6-b24c-6b3bc1f95b12",
+ "ancestors": [
+ "2349a131-dcc6-9a84-2444-bc85e2890161"
+ ],
+ "description": "Drops an existing table with name `NAME` from a SQLite database and then creates it again by calling the `onCreate` function when the database version is upgraded.",
+ "params": [
+ {
+ "name": "database",
+ "type_name": "SQLiteDatabase",
+ "description": "SQLiteDatabase instance that is being upgraded to the new version specified by the `newVersion`.",
+ "complex_type": false
+ },
+ {
+ "name": "oldVersion",
+ "type_name": "int",
+ "description": "current version of the database before any upgrade operations are performed.",
+ "complex_type": false
+ },
+ {
+ "name": "newVersion",
+ "type_name": "int",
+ "description": "current version of the SQLite database schema, indicating when changes or updates are made to the table structure.",
+ "complex_type": false
+ }
+ ],
+ "name": "onUpgrade",
+ "location": {
+ "start": 72,
+ "insert": 56,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 55,
+ "end": 71
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 16
+ },
+ {
+ "id": "39529122-00e4-82a7-3e45-8667969675f9",
+ "ancestors": [
+ "2349a131-dcc6-9a84-2444-bc85e2890161"
+ ],
+ "description": "Converts a `ScheduledSensable` object into a SQL-compatible format using a `ContentValues` object. It extracts various properties from the input object and stores them as key-value pairs, preparing the data for storage in a SQLite database.",
+ "params": [
+ {
+ "name": "scheduledSensable",
+ "type_name": "ScheduledSensable",
+ "description": "data to be serialized into a ContentValues object for storage in a SQLite database.\n\nSerialize its sensor ID, internal sensor ID, name, sensor type, last sample as JSON string, unit and pending status.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "ContentValues",
+ "description": "a ContentValues object.\n\nSerialized content contains sensable ID, internal sensor ID, name, sensor type, last sample in JSON string format, unit and a pending flag set to false. It is stored as a ContentValues object.",
+ "complex_type": true
+ },
+ "name": "serializeScheduledSensableForSqlLite",
+ "location": {
+ "start": 116,
+ "insert": 77,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 76,
+ "end": 115
+ }
+ },
+ "item_type": "method",
+ "length": 11,
+ "docLength": 39
+ },
+ {
+ "id": "df6a4bb3-2eaf-cca9-7d40-3b8e080a8f9f",
+ "ancestors": [
+ "2349a131-dcc6-9a84-2444-bc85e2890161"
+ ],
+ "description": "Retrieves data from a database cursor and populates a `ScheduledSensable` object with its properties, including ID, sensor ID, name, type, unit, and pending status. It also extracts the last sample from the database as a JSON string and sets it in the `ScheduledSensable` object.",
+ "params": [
+ {
+ "name": "cursor",
+ "type_name": "Cursor",
+ "description": "cursor that is used to retrieve data from the database table and populate the `ScheduledSensable` object with relevant information.\n\nCursor has columns: COLUMN_ID, COLUMN_SENSABLE_ID, COLUMN_SENSOR_ID, COLUMN_SENSOR_NAME, COLUMN_SENSOR_TYPE, COLUMN_UNIT, COLUMN_PENDING. Additionally, it contains a column with key COLUMN_LAST_SAMPLE and value type String.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "ScheduledSensable",
+ "description": "a populated `ScheduledSensable` object.\n\nThe ScheduledSensable object contains an ID, sensor id, internal sensor ID, name, sensor type, unit, and pending status. Additionally, it has a sample attribute that is either populated from JSON data or initialized as empty if no JSON data is present.",
+ "complex_type": true
+ },
+ "name": "getScheduledSensable",
+ "location": {
+ "start": 172,
+ "insert": 128,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 127,
+ "end": 171
+ }
+ },
+ "item_type": "method",
+ "length": 28,
+ "docLength": 44
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableContentProvider.java",
+ "path": "client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java",
+ "content": {
+ "structured": {
+ "description": "A content provider that manages sensor data stored in a SQLite database. It implements the ContentProvider interface and provides methods for querying, inserting, updating, and deleting data based on URIs. The provider uses a UriMatcher to determine which table in the database to query or update based on the URI path.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_2 {\n label=\"io/sensable\"\n color=\"#33363A\"\n CreateSensableFragment []\n SensableActivity []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n FavouriteSensablesFragment []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableContentProvider [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n LocalSensablesFragment []\n ScheduleHelper []\n }\n }\n subgraph cluster_4 {\n label=\"android\"\n color=\"#33363A\"\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n TextUtils [label=\"android.text.TextUtils\", style=\"rounded,filled\"]\n Uri [label=\"android.net.Uri\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n ContentProvider [label=\"android.content.ContentProvider\", style=\"rounded,filled\"]\n UriMatcher [label=\"android.content.UriMatcher\", style=\"rounded,filled\"]\n subgraph cluster_5 {\n label=\"database\"\n color=\"#33363A\"\n SQLiteDatabase [label=\"android.database.sqlite.SQLiteDatabase\", style=\"rounded,filled\"]\n SQLiteQueryBuilder [label=\"android.database.sqlite.SQLiteQueryBuilder\", style=\"rounded,filled\"]\n }\n }\n SensableContentProvider -> ContentValues [style=\"dashed\"]\n SensableContentProvider -> Cursor [penwidth=1]\n CreateSensableFragment -> SensableContentProvider [style=\"dashed\"]\n SensableContentProvider -> ContentProvider [style=\"dashed\"]\n SensableContentProvider -> Log [style=\"dashed\"]\n SensableContentProvider -> UriMatcher [style=\"dashed\"]\n SensableContentProvider -> TextUtils [style=\"dashed\"]\n FavouriteSensablesFragment -> SensableContentProvider [style=\"dashed\"]\n SensableContentProvider -> SQLiteQueryBuilder [style=\"dashed\"]\n SensableActivity -> SensableContentProvider [style=\"dashed\"]\n Uri -> SensableContentProvider [dir=\"both\", penwidth=6]\n SensableContentProvider -> Cursor [style=\"dashed\"]\n SensableContentProvider -> SQLiteDatabase [style=\"dashed\"]\n ScheduleHelper -> SensableContentProvider [style=\"dashed\"]\n LocalSensablesFragment -> SensableContentProvider [style=\"dashed\"]\n ContentValues -> SensableContentProvider [penwidth=2]\n SensableContentProvider -> Uri [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablecontentdatabasenettextutilclientContentProviderContentValuesUriMatcherCursorsqliteUriTextUtilsLogCreateSensableFragmentsqliteSensableActivityschedulerSQLiteDatabaseSQLiteQueryBuilderviewsSensableContentProviderScheduleHelperFavouriteSensablesFragmentLocalSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.content.ContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.content.ContentValues: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.content.UriMatcher: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.database.Cursor: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.database.sqlite.SQLiteDatabase: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.database.sqlite.SQLiteQueryBuilder: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.net.Uri: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.text.TextUtils: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.client.sqlite.SensableContentProvider: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.ContentValues -> io.sensable.client.sqlite.SensableContentProvider: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.net.Uri <-> io.sensable.client.sqlite.SensableContentProvider: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider -> android.database.Cursor: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.text.TextUtils: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.UriMatcher: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteQueryBuilder: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.net.Uri: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableContentProvider: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "2bac11b3-8427-aea0-524e-e5cd62c1ecc1",
+ "ancestors": [],
+ "description": "Provides content management for a SQLite database that stores sensable data. It defines four main functions: query, insert, delete, and update, which allow clients to interact with the database. These functions use a Uri to determine which table in the database to access and perform CRUD operations accordingly.",
+ "name": "SensableContentProvider",
+ "location": {
+ "start": 23,
+ "insert": 17,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 16,
+ "end": 22
+ }
+ },
+ "item_type": "class",
+ "length": 389,
+ "docLength": 6
+ },
+ {
+ "id": "a8d1a744-dbe1-2a93-8f44-263d5dd5f519",
+ "ancestors": [
+ "2bac11b3-8427-aea0-524e-e5cd62c1ecc1"
+ ],
+ "description": "Initializes a database helper instance for the current context and logs its string representation. It then returns `false`. This function is likely part of an Android activity's lifecycle, specifically called during initialization or creation.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value set to `false`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "SensableContentProvider provider = new SensableContentProvider();\nUri uri = Uri.parse(\"content://\" + SensableContentProvider.AUTHORITY + \"/\" + SensableContentProvider.BASE_PATH);\nprovider.onCreate();\n",
+ "description": "\n\nPlease note that the `onCreate` method is a part of Android's ContentProvider class and is automatically called when the content provider is initialized. It does not need to be manually called."
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 51,
+ "insert": 44,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 43,
+ "end": 50
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 7
+ },
+ {
+ "id": "2751df1a-eacc-50bb-cc41-b2c52f163ded",
+ "ancestors": [
+ "2bac11b3-8427-aea0-524e-e5cd62c1ecc1"
+ ],
+ "description": "Retrieves data from a SQLite database based on the given URI, projection, selection criteria, and sort order. It handles two types of URIs: SENSABLES and SENSABLE_ID, which correspond to retrieving all or specific sensor data, respectively.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the data to be queried, which determines whether the query is for all saved sensables or for a specific sensor ID.\n\nMatched by SQLiteQueryBuilder with URI matcher sURIMatcher; \nURI type (SENSABLES or SENSABLE_ID) is obtained through matching.",
+ "complex_type": true
+ },
+ {
+ "name": "projection",
+ "type_name": "String[]",
+ "description": "list of columns to be returned by the query, allowing for selective retrieval of specific data from the database table.\n\nExtracts an array of column names from the table. It contains zero or more strings that specify the columns to include in the result set.",
+ "complex_type": true
+ },
+ {
+ "name": "selection",
+ "type_name": "String",
+ "description": "WHERE clause of the SQL query that is used to filter the results returned by the database query.",
+ "complex_type": false
+ },
+ {
+ "name": "selectionArgs",
+ "type_name": "String[]",
+ "description": "values to be substituted into the selection string for the query, allowing for dynamic filtering and search criteria.\n\nArray of strings with values to replace placeholders in selection SQL statement. May be null if no arguments.",
+ "complex_type": true
+ },
+ {
+ "name": "sortOrder",
+ "type_name": "String",
+ "description": "query sort order, which is used to specify how the result set should be sorted when it is returned by the database.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Cursor",
+ "description": "a SQLite database cursor containing selected data from the SavedSensablesTable.\n\nReturns a Cursor object that contains data queried from the database table SavedSensablesTable.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://\" + AUTHORITY + \"/\" + BASE_PATH);\nString[] projection = {\"SensorId\", \"SensorValue\"};\nString selection = \"SensorId = ?\";\nString[] selectionArgs = {\"1234\"};\nString sortOrder = \"SensorValue DESC\";\n\nCursor cursor = getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder);\n",
+ "description": ""
+ },
+ "name": "query",
+ "location": {
+ "start": 148,
+ "insert": 58,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 57,
+ "end": 147
+ }
+ },
+ "item_type": "method",
+ "length": 26,
+ "docLength": 90
+ },
+ {
+ "id": "ac71068c-eaa3-299c-5547-8f104e4e161d",
+ "ancestors": [
+ "2bac11b3-8427-aea0-524e-e5cd62c1ecc1"
+ ],
+ "description": "Returns a string representing the type of a given Uri. The function overrides the default implementation and currently always returns `null`. It does not appear to utilize the provided Uri parameter.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the resource being requested, and its value is passed to the function as an argument.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "String",
+ "description": "a null value of type `String`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://io.sensable.client.contentprovider/sensables\");\nString type = getContentResolver().getType(uri);\nLog.d(TAG, \"Type: \"+type);\n",
+ "description": "\nThis example will return null as per the implementation of the getType method in the provided code."
+ },
+ "name": "getType",
+ "location": {
+ "start": 185,
+ "insert": 175,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 174,
+ "end": 184
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 10
+ },
+ {
+ "id": "b7363a99-2b8b-4085-9a48-1f96311d948f",
+ "ancestors": [
+ "2bac11b3-8427-aea0-524e-e5cd62c1ecc1"
+ ],
+ "description": "Inserts a new row into the database based on the provided URI and ContentValues. It matches the URI with predefined constants to determine the table to insert data into, then uses a content provider to notify listeners of the change and returns the URI of the newly inserted item.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "URI of the content provider being accessed and is used to determine which table in the database to insert into based on its type, matched against a set of predefined constants.\n\nMatched with sURIMatcher, the URI type is identified as SENSABLES or unknown. Uri contains information about database table and its content. The Uri path represents a specific data record in the specified table.",
+ "complex_type": true
+ },
+ {
+ "name": "values",
+ "type_name": "ContentValues",
+ "description": "key-value pairs to be inserted into the database table specified by the URI.\n\nValues is an instance of `ContentValues`, a container that holds key-value pairs. It contains data to be inserted into the database. The keys and values are obtained from its string representations using `toString()`.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "Uri",
+ "description": "a URI representing the newly inserted record.\n\nThe output is an instance of Uri type which is parsed from the CONTENT_URI concatenated with the inserted record's id. It represents the URI for the newly inserted data and can be used to access or retrieve that data later.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "ContentValues values = new ContentValues();\nvalues.put(SavedSensablesTable.COLUMN_SENSOR_ID, \"Sensor1\");\nvalues.put(SavedSensablesTable.COLUMN_VALUE, 10);\n\nUri uri = getContentResolver().insert(Uri.parse(\"content://\" + AUTHORITY + \"/sensables\"), values);\n",
+ "description": "\nNote: Replace `AUTHORITY` with your actual authority string."
+ },
+ "name": "insert",
+ "location": {
+ "start": 226,
+ "insert": 190,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 189,
+ "end": 225
+ }
+ },
+ "item_type": "method",
+ "length": 20,
+ "docLength": 36
+ },
+ {
+ "id": "80be5fe5-ab0c-6a93-ba42-00b2d1aeb2e0",
+ "ancestors": [
+ "2bac11b3-8427-aea0-524e-e5cd62c1ecc1"
+ ],
+ "description": "Deletes records from a SQLite database based on provided selection and selection arguments for specified URIs. It returns the number of deleted rows. If URI is not recognized, it throws an exception. After deletion, it notifies registered observers that data has changed.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "Uniform Resource Identifier (URI) of the data to be deleted and is used to determine which table in the database to delete from and how to construct the SQL deletion query.\n\nMatches the URI against various patterns using `sURIMatcher.match(uri)` to identify its type. The matched type is stored in `uriType`.",
+ "complex_type": true
+ },
+ {
+ "name": "selection",
+ "type_name": "String",
+ "description": "SQL WHERE clause for the deletion operation, allowing for filtering of the rows to be deleted based on specific conditions.",
+ "complex_type": false
+ },
+ {
+ "name": "selectionArgs",
+ "type_name": "String[]",
+ "description": "values to be substituted into the selection statement when querying or deleting data from the database.\n\nAn array of strings that replace the ? wildcards in the selection string. Its elements match the corresponding ? wildcard in the selection string.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "int",
+ "description": "an integer representing the number of rows deleted from the database.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://io.sensable.client.contentprovider/sensables/123\");\nString selection = \"sensor_id > ?\";\nString[] selectionArgs = {\"10\"};\n\nint rowsDeleted = getContentResolver().delete(uri, selection, selectionArgs);\n",
+ "description": ""
+ },
+ "name": "delete",
+ "location": {
+ "start": 292,
+ "insert": 247,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 246,
+ "end": 291
+ }
+ },
+ "item_type": "method",
+ "length": 25,
+ "docLength": 45
+ },
+ {
+ "id": "e943f29c-d6ae-20a2-1240-26b2514b9102",
+ "ancestors": [
+ "2bac11b3-8427-aea0-524e-e5cd62c1ecc1"
+ ],
+ "description": "Updates data in a SQLite database based on a provided URI and selection criteria. It handles two types of URIs: one for updating all sensables and another for updating sensable by ID, then notifies content resolver about the changes.",
+ "params": [
+ {
+ "name": "uri",
+ "type_name": "Uri",
+ "description": "Uniform Resource Identifier of the data being updated and is used to determine which type of update operation should be performed based on its match with a predefined set of URIs.\n\nMatches a URI pattern using sURIMatcher and determines its type through uriType. It can either be SENSABLES or SENSABLE_ID. The uri's last path segment is extracted as an ID if it matches SENSABLE_ID.",
+ "complex_type": true
+ },
+ {
+ "name": "values",
+ "type_name": "ContentValues",
+ "description": "key-value pairs to be updated or inserted into the database table specified by the URI.\n\nThe `values` parameter is an instance of `ContentValues`, which contains key-value pairs that represent data to be updated in the database table. These key-value pairs have a String key and a primitive value or an Object value.",
+ "complex_type": true
+ },
+ {
+ "name": "selection",
+ "type_name": "String",
+ "description": "WHERE clause of the SQL query used to filter the rows to be updated based on specific conditions specified by the caller.",
+ "complex_type": false
+ },
+ {
+ "name": "selectionArgs",
+ "type_name": "String[]",
+ "description": "arguments to replace the placeholders in the selection string to filter the data that is updated in the database table.\n\nArray of strings providing values for selection and selection arguments.",
+ "complex_type": true
+ }
+ ],
+ "returns": {
+ "type_name": "integer",
+ "description": "the number of rows updated in the database.\n\nThe returned value is an integer indicating the number of rows updated in the database. It may have a value greater than zero if any rows were successfully updated, or zero if no rows were affected. In case of failure, it throws an exception.",
+ "complex_type": true
+ },
+ "usage": {
+ "language": "java",
+ "code": "Uri uri = Uri.parse(\"content://io.sensable.client.contentprovider/sensables/123\");\nContentValues values = new ContentValues();\nvalues.put(SavedSensablesTable.COLUMN_SENSOR_ID, \"456\");\n\nint rowsUpdated = getContentResolver().update(uri, values, null, null);\n",
+ "description": ""
+ },
+ "name": "update",
+ "location": {
+ "start": 382,
+ "insert": 318,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 317,
+ "end": 381
+ }
+ },
+ "item_type": "method",
+ "length": 28,
+ "docLength": 64
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableDatabaseHelper.java",
+ "path": "client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java",
+ "content": {
+ "structured": {
+ "description": "A SQLiteOpenHelper class named SensableDatabaseHelper that provides a singleton connection to a SQLite database for content providers. It manages the database schema and allows access through a single instance. The code ensures that only one instance is created for each Android application context, and it handles database upgrades by modifying the SavedSensablesTable and ScheduledSensablesTable when necessary.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n SQLiteOpenHelper [label=\"android.database.sqlite.SQLiteOpenHelper\", style=\"rounded,filled\"]\n Context [label=\"android.content.Context\", style=\"rounded,filled\"]\n Config []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableDatabaseHelper [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n SQLiteDatabase [label=\"android.database.sqlite.SQLiteDatabase\", style=\"rounded,filled\"]\n SensableDatabaseHelper -> SQLiteDatabase [style=\"dashed\"]\n SensableDatabaseHelper -> Config [style=\"dashed\"]\n SQLiteDatabase -> SensableDatabaseHelper [penwidth=2]\n Context -> SensableDatabaseHelper [penwidth=3]\n SensableDatabaseHelper -> Context [style=\"dashed\"]\n SensableDatabaseHelper -> SQLiteOpenHelper [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidsensablecontentdatabaseclientContextsqlitesqliteSQLiteDatabaseSQLiteOpenHelpersettingsSensableDatabaseHelperConfigimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.sqlite.SensableDatabaseHelper -> android.content.Context: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableDatabaseHelper -> android.database.sqlite.SQLiteDatabase: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableDatabaseHelper -> android.database.sqlite.SQLiteOpenHelper: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SensableDatabaseHelper -> io.sensable.client.settings.Config: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.content.Context -> io.sensable.client.sqlite.SensableDatabaseHelper: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase -> io.sensable.client.sqlite.SensableDatabaseHelper: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteOpenHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.settings.Config: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.Context: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.sqlite.SQLiteDatabase: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableDatabaseHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SensableDatabaseHelper: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "c83f1378-b3e2-3086-9644-7dbd8e396882",
+ "ancestors": [],
+ "description": "Is a SQLiteOpenHelper that provides a singleton connection to a SQLite database for content providers. It creates and manages the database schema and provides access to the database through a single instance, ensuring only one active connection at a time. The class handles database operations such as creating and upgrading tables.",
+ "name": "SensableDatabaseHelper",
+ "location": {
+ "start": 16,
+ "insert": 11,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 10,
+ "end": 15
+ }
+ },
+ "item_type": "class",
+ "length": 99,
+ "docLength": 5
+ },
+ {
+ "id": "f505d700-d36a-8aa6-fb45-17f9c7e5423e",
+ "ancestors": [
+ "c83f1378-b3e2-3086-9644-7dbd8e396882"
+ ],
+ "description": "Creates a single instance of `SensableDatabaseHelper` if it does not exist, using the provided `Context`. The instance is stored in a static field for reuse. The function returns the existing or newly created instance, ensuring thread safety with the use of the `synchronized` keyword.",
+ "params": [
+ {
+ "name": "context",
+ "type_name": "Context",
+ "description": "application context that is used to create an instance of the SensableDatabaseHelper class when it has not been initialized yet.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "instance",
+ "description": "a synchronized instance of the `SensableDatabaseHelper`.",
+ "complex_type": false
+ },
+ "name": "getHelper",
+ "location": {
+ "start": 62,
+ "insert": 37,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 36,
+ "end": 61
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 25
+ },
+ {
+ "id": "b82d0ffc-a5d0-8fb6-6445-eed9b3d0e157",
+ "ancestors": [
+ "c83f1378-b3e2-3086-9644-7dbd8e396882"
+ ],
+ "description": "Executes tables creation for `SavedSensablesTable` and `ScheduledSensablesTable` in a database, ensuring their schema is established when the application is initially installed or updated. This allows for data storage and retrieval operations to be performed.",
+ "params": [
+ {
+ "name": "db",
+ "type_name": "SQLiteDatabase",
+ "description": "SQLiteDatabase object that is used to create or modify tables and their structures, such as SavedSensablesTable and ScheduledSensablesTable.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SQLiteDatabase db = new SQLiteDatabase();\nSensableDatabaseHelper.getHelper(this).onCreate(db);\n",
+ "description": ""
+ },
+ "name": "onCreate",
+ "location": {
+ "start": 84,
+ "insert": 73,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 72,
+ "end": 83
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 11
+ },
+ {
+ "id": "9d0c5bcd-fddf-99ae-7046-8a2c26906be5",
+ "ancestors": [
+ "c83f1378-b3e2-3086-9644-7dbd8e396882"
+ ],
+ "description": "Is overridden to handle database schema changes when upgrading from an older version to a newer one. It calls separate upgrade methods for two tables: `SavedSensablesTable` and `ScheduledSensablesTable`, indicating that these tables require migration upon upgrading the database schema.",
+ "params": [
+ {
+ "name": "db",
+ "type_name": "SQLiteDatabase",
+ "description": "SQLiteDatabase object that is being upgraded to a newer version.",
+ "complex_type": false
+ },
+ {
+ "name": "oldVersion",
+ "type_name": "int",
+ "description": "previous version of the database schema before the upgrade operation is performed.",
+ "complex_type": false
+ },
+ {
+ "name": "newVersion",
+ "type_name": "int",
+ "description": "newest database schema version being installed or upgraded to.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SQLiteDatabase db = ... // Assume you have initialized it.\nint oldVersion = 1;\nint newVersion = 2;\n\nSensableDatabaseHelper.getHelper(getContext()).onUpgrade(db, oldVersion, newVersion);\n",
+ "description": "\nNote: The actual initialization of `db` depends on your specific application and how you are using the database."
+ },
+ "name": "onUpgrade",
+ "location": {
+ "start": 108,
+ "insert": 92,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 91,
+ "end": 107
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 16
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SensableService.java",
+ "path": "library/src/main/java/io/sensable/SensableService.java",
+ "content": {
+ "structured": {
+ "description": "An interface called SensableService which acts as a REST API client. It provides methods for interacting with a REST API to retrieve and manipulate sensory data, including listing sensors, creating new sensors, saving sensor data, retrieving sensor data, logging in users, getting user settings and statistics.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"client\"\n color=\"#33363A\"\n RemoteSensablesFragment []\n ScheduledSensableService []\n }\n CreateSensableFragment []\n UserLogin []\n SampleSender []\n User []\n SampleResponse []\n Body [label=\"retrofit.http.Body\", style=\"rounded,filled\"]\n AboutActivity []\n SensableActivity []\n Statistics []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SensableService [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Path [label=\"retrofit.http.Path\", style=\"rounded,filled\"]\n Callback [label=\"retrofit.Callback\", style=\"rounded,filled\"]\n SensableUser []\n POST [label=\"retrofit.http.POST\", style=\"rounded,filled\"]\n GET [label=\"retrofit.http.GET\", style=\"rounded,filled\"]\n List [label=\"java.util.List\", style=\"rounded,filled\"]\n Sensable []\n MainActivity []\n SensableActivity -> SensableService [style=\"dashed\"]\n SensableService -> GET [style=\"dashed\"]\n SensableUser -> SensableService [style=\"dashed\"]\n CreateSensableFragment -> SensableService [style=\"dashed\"]\n AboutActivity -> SensableService [style=\"dashed\"]\n SensableService -> Body [style=\"dashed\"]\n SensableService -> POST [style=\"dashed\"]\n Statistics -> SensableService [dir=\"both\", penwidth=2]\n MainActivity -> SensableService [style=\"dashed\"]\n SensableService -> Callback [style=\"dashed\"]\n SampleResponse -> SensableService [dir=\"both\", penwidth=4]\n Sensable -> SensableService [dir=\"both\", penwidth=6]\n SensableService -> Path [style=\"dashed\"]\n RemoteSensablesFragment -> SensableService [style=\"dashed\"]\n ScheduledSensableService -> SensableService [style=\"dashed\"]\n SampleSender -> SensableService [penwidth=2]\n User -> SensableService [dir=\"both\", penwidth=4]\n SensableService -> List [style=\"dashed\"]\n UserLogin -> SensableService [penwidth=2]\n}\n",
+ "d2": "ioretrofitjavasensableCallbackhttputilSensableServiceBodyGETPOSTPathListclientmodelAboutActivityCreateSensableFragmentMainActivitySensableActivitySensableUserschedulerviewsSampleResponseSampleSenderSensableStatisticsUserUserLoginScheduledSensableServiceRemoteSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.SensableService -> retrofit.Callback: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.SensableService -> retrofit.http.Body: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.SensableService -> retrofit.http.GET: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.SensableService -> retrofit.http.POST: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.SensableService -> retrofit.http.Path: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.SensableService -> java.util.List: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.AboutActivity -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.CreateSensableFragment -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.SensableService: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.SampleResponse <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender -> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Statistics <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.User <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nretrofit.Callback: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.http.GET: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.http.Body: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.http.POST: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nretrofit.http.Path: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.List: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleSender: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.User: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableUser: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.AboutActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Statistics: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "5a113748-cb62-fd9d-5342-be66f4d9b34e",
+ "ancestors": [],
+ "description": "Provides various methods for interacting with a REST API to retrieve and manipulate sensory data, user settings, and statistics.",
+ "name": "SensableService",
+ "location": {
+ "start": 24,
+ "insert": 20,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 19,
+ "end": 23
+ }
+ },
+ "item_type": "interface",
+ "length": 43,
+ "docLength": 4
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "Sample.java",
+ "path": "library/src/main/java/io/sensable/model/Sample.java",
+ "content": {
+ "structured": {
+ "description": "A class called Sample which represents a sample data point with timestamp, value, and location information. It implements Parcelable interface for serialization and deserialization purposes. The class provides methods for getting and setting the timestamp, value, and location fields.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"client\"\n color=\"#33363A\"\n ScheduledSensablesTable []\n SensableListAdapter []\n SavedSensablesTable []\n ScheduledSensableService []\n }\n JSONArray [label=\"org.json.JSONArray\", style=\"rounded,filled\"]\n ScheduledSensable []\n SensableActivity []\n Parcelable [label=\"android.os.Parcelable\", style=\"rounded,filled\"]\n ArrayList [label=\"java.util.ArrayList\", style=\"rounded,filled\"]\n JSONObject [label=\"org.json.JSONObject\", style=\"rounded,filled\"]\n Sensable []\n Parcel [label=\"android.os.Parcel\", style=\"rounded,filled\"]\n JSONException [label=\"org.json.JSONException\", style=\"rounded,filled\"]\n CreateSensableFragment []\n SampleSender []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n Sample [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Sample -> ArrayList [style=\"dashed\"]\n ScheduledSensableService -> Sample [style=\"dashed\"]\n SensableActivity -> Sample [style=\"dashed\"]\n Sensable -> Sample [dir=\"both\", penwidth=2]\n CreateSensableFragment -> Sample [style=\"dashed\"]\n ScheduledSensablesTable -> Sample [style=\"dashed\"]\n Sample -> Parcel [style=\"dashed\"]\n ScheduledSensable -> Sample [dir=\"both\", penwidth=2]\n Sample -> JSONArray [style=\"dashed\"]\n Parcel -> Sample [penwidth=4]\n JSONObject -> Sample [dir=\"both\", penwidth=2]\n SensableListAdapter -> Sample [style=\"dashed\"]\n Sample -> JSONException [style=\"dashed\"]\n SavedSensablesTable -> Sample [style=\"dashed\"]\n Sample -> Parcelable [style=\"dashed\"]\n Sample -> SensableActivity [penwidth=2]\n SampleSender -> Sample [dir=\"both\", penwidth=2]\n Sample -> JSONObject [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidorgjavasensableosjsonutilclientmodelParcelParcelableJSONArrayJSONExceptionJSONObjectArrayListCreateSensableFragmentSampleSensableActivityschedulersqliteviewsSampleSenderScheduledSensableSensableScheduledSensableServiceSavedSensablesTableScheduledSensablesTableSensableListAdapterimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.SensableListAdapter -> io.sensable.model.Sample: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sample -> android.os.Parcel: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sample -> android.os.Parcelable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sample -> org.json.JSONArray: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sample -> org.json.JSONException: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sample -> org.json.JSONObject: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sample -> java.util.ArrayList: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Parcel -> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sample -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\norg.json.JSONObject <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\norg.json.JSONArray: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONException: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Parcelable: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.ArrayList: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Parcel: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.SensableListAdapter: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Parcel: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleSender: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "9337ad7e-8240-5db7-e340-c78a1c604bcf",
+ "ancestors": [],
+ "description": "Represents a sample data point with timestamp, value, and location information. It implements Parcelable interface for serialization and deserialization purposes. The class provides getter and setter methods for its fields, as well as methods to convert the object into JSON format and represent it as a string.",
+ "name": "Sample",
+ "location": {
+ "start": 20,
+ "insert": 14,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 13,
+ "end": 19
+ }
+ },
+ "item_type": "class",
+ "length": 195,
+ "docLength": 6
+ },
+ {
+ "id": "741c388c-6c20-5a93-a44e-585c3fa2e6a3",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Returns a value of type `long`. The returned value represents a timestamp, which is stored in the variable `timestamp`.",
+ "params": [],
+ "returns": {
+ "type_name": "long",
+ "description": "a `long` value representing a timestamp.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Sample sample = new Sample();\n sample.setTimestamp(1234567890);\n long timestamp = sample.getTimestamp();\n System.out.println(\"timestamp: \" + timestamp);\n }\n}\n",
+ "description": ""
+ },
+ "name": "getTimestamp",
+ "location": {
+ "start": 45,
+ "insert": 40,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 39,
+ "end": 44
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "57b50b01-9474-5b84-6941-1baf537f9949",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Assigns a long integer value to the `timestamp` field of the object, allowing external modification of its internal state. This change affects the object's properties and potentially influences subsequent operations or calculations. The timestamp can be retrieved and used for various purposes within the program.",
+ "params": [
+ {
+ "name": "timestamp",
+ "type_name": "long",
+ "description": "64-bit long value to be assigned as the current timestamp for the object.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = new Sample();\nsample.setTimestamp(123456789);\n",
+ "description": ""
+ },
+ "name": "setTimestamp",
+ "location": {
+ "start": 55,
+ "insert": 49,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 48,
+ "end": 54
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "ec178ace-d183-d890-3e41-bad7db18b4c2",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Retrieves and returns a stored value, which is represented by the variable `value`. This value can be accessed through an instance of the class containing this method. The returned value is of type double.",
+ "params": [],
+ "returns": {
+ "type_name": "double",
+ "description": "a double-precision floating-point number representing the current value.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = new Sample();\nsample.setValue(10.5);\ndouble value = sample.getValue();\nSystem.out.println(value); // Output: 10.5",
+ "description": ""
+ },
+ "name": "getValue",
+ "location": {
+ "start": 64,
+ "insert": 59,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 58,
+ "end": 63
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "e9181213-3fd1-928f-014e-2429b2eac428",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Sets a new value for an object's internal state variable. It takes a `double` parameter representing the desired value and assigns it to the object's `value` field. This updates the object's internal state with the specified value.",
+ "params": [
+ {
+ "name": "value",
+ "type_name": "double",
+ "description": "new value to be assigned to the instance variable with the same name, updating its current state.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Sample sample = new Sample();\n sample.setValue(100.0);\n }\n}\n",
+ "description": "\nIn this example, a new instance of the `Sample` class named `sample` is created. Then, the `setValue` method is called on `sample`, passing the value `100.0` as an argument."
+ },
+ "name": "setValue",
+ "location": {
+ "start": 74,
+ "insert": 68,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 67,
+ "end": 73
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "3831e2a4-3ace-c599-9445-f2959e7b8d3a",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Returns an integer indicating the type and complexity of the object's contents. The value typically represents a bitwise combination of content types, such as primitive values or complex objects. In this case, the function always returns 0, suggesting that the object contains no complex data structures.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value of 0.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public void testDescribeContents() {\n Sample sample = new Sample();\n int contents = sample.describeContents();\n Assert.assertEquals(0, contents);\n}\n",
+ "description": ""
+ },
+ "name": "describeContents",
+ "location": {
+ "start": 83,
+ "insert": 78,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 77,
+ "end": 82
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 5
+ },
+ {
+ "id": "78b0d7b8-e92b-e3a7-f744-3615dc475e97",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Writes the timestamp and value to a Parcel object. It uses the `dest.writeLong` and `dest.writeDouble` methods to serialize these values into the parcel. The parcel can then be used to transmit or store these data values.",
+ "params": [
+ {
+ "name": "dest",
+ "type_name": "Parcel",
+ "description": "Parcel to which data is written.",
+ "complex_type": false
+ },
+ {
+ "name": "flags",
+ "type_name": "int",
+ "description": "bit mask of options for the write operation, which can be used to specify additional behavior such as whether the parcel should be compressed or encrypted.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Parcel parcel = Parcel.obtain();\nSample sample = new Sample();\nsample.timestamp = 1234567890L;\nsample.value = 3.14;\n\nsample.writeToParcel(parcel, 0);\n\nparcel.setDataPosition(0);\nlong timestamp = parcel.readLong();\ndouble value = parcel.readDouble();\n\nparcel.recycle();",
+ "description": ""
+ },
+ "name": "writeToParcel",
+ "location": {
+ "start": 102,
+ "insert": 88,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 87,
+ "end": 101
+ }
+ },
+ "item_type": "method",
+ "length": 5,
+ "docLength": 14
+ },
+ {
+ "id": "d6b379f5-599d-899f-9647-e2ea0b5dd88e",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf",
+ "20748482-30a0-5fa1-2c44-b15ae21dcc4c"
+ ],
+ "description": "Instantiates a new instance of the `Sample` class using the provided `Parcel` object as an argument, effectively creating a sample from parcelled data.",
+ "params": [
+ {
+ "name": "in",
+ "type_name": "Parcel",
+ "description": "Parcel object from which to read and deserialize data, allowing creation of a new instance of the Sample class.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Sample",
+ "description": "a newly created instance of the `Sample` class.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = Sample.CREATOR.createFromParcel(parcel);\n",
+ "description": ""
+ },
+ "name": "createFromParcel",
+ "location": {
+ "start": 129,
+ "insert": 110,
+ "offset": " ",
+ "indent": 8,
+ "comment": {
+ "start": 109,
+ "end": 128
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 19
+ },
+ {
+ "id": "81074870-dc80-799b-5c41-ec364d9fd420",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf",
+ "20748482-30a0-5fa1-2c44-b15ae21dcc4c"
+ ],
+ "description": "Creates an array of a specified size and returns it as an instance of the `Sample` class. The function takes an integer parameter, `size`, which determines the number of elements in the created array.",
+ "params": [
+ {
+ "name": "size",
+ "type_name": "int",
+ "description": "umber of elements to be included in the newly created array.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "array",
+ "description": "an array of type `Sample`, with a specified size.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sample[] sampleArray = Sample.newArray(5);\n",
+ "description": ""
+ },
+ "name": "newArray",
+ "location": {
+ "start": 150,
+ "insert": 133,
+ "offset": " ",
+ "indent": 8,
+ "comment": {
+ "start": 132,
+ "end": 149
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 17
+ },
+ {
+ "id": "890da50b-48a7-71af-1248-b3b35c8c3947",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Concatenates a timestamp and value strings, returning the resulting string. The timestamp is retrieved from the `getTimestamp` method, while the value is obtained through the `getValue` method. This allows for a human-readable representation of the object.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string combining timestamp and value.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = new Sample(1643723900, 2.5, new double[]{1.2,3.4});\nSystem.out.println(sample.toString());",
+ "description": ""
+ },
+ "name": "toString",
+ "location": {
+ "start": 166,
+ "insert": 160,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 159,
+ "end": 165
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 6
+ },
+ {
+ "id": "59147898-9af9-4a8b-a24d-84935be86188",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Converts an object into a JSON format string, which includes timestamp and value fields. It uses a JSONObject to create the JSON string from the object's timestamp and value properties. The function returns the resulting JSON object.",
+ "params": [],
+ "returns": {
+ "type_name": "JSONObject",
+ "description": "a JSON object with timestamp and value attributes.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = new Sample();\nsample.setTimestamp(1234567890);\nsample.setValue(1.23);\n\nJSONObject jsonObject = sample.toJson();\nSystem.out.println(jsonObject);",
+ "description": ""
+ },
+ "name": "toJson",
+ "location": {
+ "start": 182,
+ "insert": 171,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 170,
+ "end": 181
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 11
+ },
+ {
+ "id": "dc886d26-dd09-4581-834a-7dceee9c3b6e",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Returns an array of doubles representing a location. The function does not perform any calculations or operations, it simply retrieves and returns a pre-existing value. The returned value is stored in a variable named `location`.",
+ "params": [],
+ "returns": {
+ "type_name": "array",
+ "description": "an array of doubles representing a location's coordinates.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public static void main(String[] args) {\n Sample sample = new Sample();\n double[] location = sample.getLocation();\n // use the location array\n}\n",
+ "description": ""
+ },
+ "name": "getLocation",
+ "location": {
+ "start": 197,
+ "insert": 192,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 191,
+ "end": 196
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "966ef6dd-4a44-5385-4d4f-75dfecce23ca",
+ "ancestors": [
+ "9337ad7e-8240-5db7-e340-c78a1c604bcf"
+ ],
+ "description": "Assigns a new double array representing a location to an instance variable `location`. This allows for changing the current location of an object at runtime. The assigned value replaces any previously set location.",
+ "params": [
+ {
+ "name": "location",
+ "type_name": "double[]",
+ "description": "2D array of double values that sets the new location for the object.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = new Sample();\ndouble[] location = {1.0, 2.0, 3.0};\nsample.setLocation(location);\n",
+ "description": ""
+ },
+ "name": "setLocation",
+ "location": {
+ "start": 211,
+ "insert": 201,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 200,
+ "end": 210
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 10
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SampleResponse.java",
+ "path": "library/src/main/java/io/sensable/model/SampleResponse.java",
+ "content": {
+ "structured": {
+ "description": "A class called SampleResponse that encapsulates two attributes: message and sensorid. The class provides getter and setter methods for these attributes, allowing users to retrieve and modify their values. The class is designed to represent a response from a sensor, with the message attribute holding a description of the data received and the sensorid attribute identifying the sensor that sent the data.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"client\"\n color=\"#33363A\"\n ScheduledSensableService []\n }\n SampleSender []\n CreateSensableFragment []\n Sensable []\n SensableService []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SampleResponse [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n SampleResponse -> SensableService [dir=\"both\", penwidth=4]\n SampleResponse -> ScheduledSensableService [penwidth=1]\n SampleSender -> SampleResponse [penwidth=1]\n CreateSensableFragment -> SampleResponse [style=\"dashed\"]\n ScheduledSensableService -> SampleResponse [style=\"dashed\"]\n SampleResponse -> CreateSensableFragment [penwidth=1]\n Sensable -> SampleResponse [penwidth=1]\n}\n",
+ "d2": "iosensableclientmodelSensableServiceCreateSensableFragmentSampleResponseschedulerSampleSenderSensableScheduledSensableServiceimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.model.SampleResponse: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.SampleResponse: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.SampleResponse <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleResponse -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleResponse -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender -> io.sensable.model.SampleResponse: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.model.SampleResponse: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "5dd74668-1d35-89a9-cc4b-17ecc2e985fb",
+ "ancestors": [],
+ "description": "Encapsulates two attributes: message and sensorid. It provides getter and setter methods for these attributes, allowing access and modification of their values. The class is designed to store and manipulate string data related to messages and sensor IDs.",
+ "name": "SampleResponse",
+ "location": {
+ "start": 10,
+ "insert": 6,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 5,
+ "end": 9
+ }
+ },
+ "item_type": "class",
+ "length": 45,
+ "docLength": 4
+ },
+ {
+ "id": "0eff1ccd-1a17-918a-3742-fe81cddcd7ab",
+ "ancestors": [
+ "5dd74668-1d35-89a9-cc4b-17ecc2e985fb"
+ ],
+ "description": "Returns a string value stored in the `message` variable. It is likely to be part of a class that encapsulates some kind of messaging system, providing a way to retrieve the current message. The returned message can then be used by the calling code as needed.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the current value of the `message` variable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "SampleResponse sampleResponse = new SampleResponse();\nsampleResponse.setMessage(\"Hello, World!\");\nString message = sampleResponse.getMessage();",
+ "description": ""
+ },
+ "name": "getMessage",
+ "location": {
+ "start": 22,
+ "insert": 17,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 16,
+ "end": 21
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "1525cfc4-729a-4481-e642-6a533e16e16e",
+ "ancestors": [
+ "5dd74668-1d35-89a9-cc4b-17ecc2e985fb"
+ ],
+ "description": "Assigns a given string to the `message` field of the object. This allows the object's message property to be updated with a new value. The new message replaces any previously stored message.",
+ "params": [
+ {
+ "name": "message",
+ "type_name": "String",
+ "description": "value to be assigned to the instance variable `this.message`, updating its value within the class.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SampleResponse response = new SampleResponse();\nresponse.setMessage(\"Hello, World!\");\n",
+ "description": "\nThis sets the message field in the SampleResponse object to \"Hello, World!\"."
+ },
+ "name": "setMessage",
+ "location": {
+ "start": 32,
+ "insert": 26,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 25,
+ "end": 31
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "f4831526-d2dd-ce88-d24b-1aa8b9f9515a",
+ "ancestors": [
+ "5dd74668-1d35-89a9-cc4b-17ecc2e985fb"
+ ],
+ "description": "Retrieves and returns a string value representing the `sensorid`. The returned value is stored in the instance variable `sensorid`. This function allows access to the `sensorid` value for use elsewhere in the program.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the value of the `sensorid` variable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "SampleResponse response = new SampleResponse();\nString sensorId = response.getSensorid();",
+ "description": ""
+ },
+ "name": "getSensorid",
+ "location": {
+ "start": 41,
+ "insert": 36,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 35,
+ "end": 40
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "78b1f8eb-e248-21bb-3340-77d0eb9d15bc",
+ "ancestors": [
+ "5dd74668-1d35-89a9-cc4b-17ecc2e985fb"
+ ],
+ "description": "Assigns a specified `sensorid` value to an instance variable. The `sensorid` parameter is passed as a string, and it updates the internal state of the object with the provided ID. This method sets the sensor ID for subsequent use within the class.",
+ "params": [
+ {
+ "name": "sensorid",
+ "type_name": "String",
+ "description": "identifier of a sensor, which is assigned to the instance variable `this.sensorid` in the method.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SampleResponse sampleResponse = new SampleResponse();\nsampleResponse.setSensorid(\"Sensor123\");\n",
+ "description": ""
+ },
+ "name": "setSensorid",
+ "location": {
+ "start": 51,
+ "insert": 45,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 44,
+ "end": 50
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "SampleSender.java",
+ "path": "library/src/main/java/io/sensable/model/SampleSender.java",
+ "content": {
+ "structured": {
+ "description": "A class `SampleSender` which represents a sender of samples and has two private fields: `accessToken` and `sample`. The class provides getter and setter methods for these fields, as well as methods to retrieve the access token and sample.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"client\"\n color=\"#33363A\"\n ScheduledSensableService []\n }\n SensableService []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n SampleSender [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Sample []\n SampleResponse []\n SampleSender -> SampleResponse [penwidth=1]\n SampleSender -> Sample [dir=\"both\", penwidth=2]\n SampleSender -> SensableService [penwidth=2]\n ScheduledSensableService -> SampleSender [style=\"dashed\"]\n}\n",
+ "d2": "iosensableclientmodelSensableServiceschedulerSampleSenderSampleResponseSampleScheduledSensableServiceimports\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.SampleSender: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.SampleSender -> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender -> io.sensable.model.SampleResponse: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.SampleSender: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleSender: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "4ba93d6f-f91d-6ba1-7a4c-0177800272b4",
+ "ancestors": [],
+ "description": "Represents a sender of samples with two private fields: access token and sample. It provides getter and setter methods to retrieve and set these fields. The class allows the manipulation of an access token and a Sample object, which is likely a custom class containing some data or values.",
+ "name": "SampleSender",
+ "location": {
+ "start": 11,
+ "insert": 6,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 5,
+ "end": 10
+ }
+ },
+ "item_type": "class",
+ "length": 58,
+ "docLength": 5
+ },
+ {
+ "id": "ab14fc8e-937a-0a96-9048-86d94f52c3dc",
+ "ancestors": [
+ "4ba93d6f-f91d-6ba1-7a4c-0177800272b4"
+ ],
+ "description": "Retrieves and returns a stored access token as a string. The function does not modify or process the access token; it simply provides direct access to its value.",
+ "params": [],
+ "returns": {
+ "type_name": "string",
+ "description": "a string value representing an access token.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "SampleSender sender = new SampleSender();\nString accessToken = sender.getAccessToken();\n",
+ "description": ""
+ },
+ "name": "getAccessToken",
+ "location": {
+ "start": 20,
+ "insert": 15,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 14,
+ "end": 19
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "1632089c-52a3-968f-384a-d7526291ef27",
+ "ancestors": [
+ "4ba93d6f-f91d-6ba1-7a4c-0177800272b4"
+ ],
+ "description": "Sets a specified access token as an attribute of the current object. The provided string is assigned to the `accessToken` field, allowing it to be used by the object for subsequent operations or authentication purposes.",
+ "params": [
+ {
+ "name": "accessToken",
+ "type_name": "String",
+ "description": "value that is assigned to the instance variable `this.accessToken`, updating its state.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n SampleSender sender = new SampleSender();\n sender.setAccessToken(\"access_token\");\n }\n}",
+ "description": ""
+ },
+ "name": "setAccessToken",
+ "location": {
+ "start": 29,
+ "insert": 24,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 23,
+ "end": 28
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "b5a7225f-a8c7-7c8d-4d40-1a364110ed99",
+ "ancestors": [
+ "4ba93d6f-f91d-6ba1-7a4c-0177800272b4"
+ ],
+ "description": "Retrieves a `Sample` object and returns it. The object is stored in the `sample` variable. This method allows access to the `sample` object, making its value available for use by other parts of the program.",
+ "params": [],
+ "returns": {
+ "type_name": "Sample",
+ "description": "an instance of the `Sample` class named `sample`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "SampleSender sender = new SampleSender();\nsender.setSample(new Sample());\nSample sample = sender.getSample();",
+ "description": ""
+ },
+ "name": "getSample",
+ "location": {
+ "start": 49,
+ "insert": 33,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 32,
+ "end": 48
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 16
+ },
+ {
+ "id": "3ec8b7cc-fb0d-6a94-0344-3c24c7b9e017",
+ "ancestors": [
+ "4ba93d6f-f91d-6ba1-7a4c-0177800272b4"
+ ],
+ "description": "Assigns a new value to the instance variable `sample`, replacing its previous value with the provided `sample` object. This method updates the internal state of the class by setting the reference of the `sample` field to the given `sample` parameter.",
+ "params": [
+ {
+ "name": "sample",
+ "type_name": "Sample",
+ "description": "Sample object to be assigned to the instance variable `this.sample`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "SampleSender sender = new SampleSender();\nSample mySample = new Sample(); // create a sample object\nsender.setSample(mySample);",
+ "description": ""
+ },
+ "name": "setSample",
+ "location": {
+ "start": 64,
+ "insert": 53,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 52,
+ "end": 63
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 11
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "ScheduledSensable.java",
+ "path": "library/src/main/java/io/sensable/model/ScheduledSensable.java",
+ "content": {
+ "structured": {
+ "description": "A data model class named ScheduledSensable that represents sensor readings and samples. It has various fields such as ID, sensor ID, name, internal sensor ID, sensortype, unit, pending sample, private sensor, access token, and location, which is represented by a double array. The class provides getter and setter methods for these fields and also includes a method to generate a JSON string representation of the sample data using org.json library.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n CreateSensableFragment []\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n Sample []\n SensableActivity []\n JSONObject [label=\"org.json.JSONObject\", style=\"rounded,filled\"]\n MainActivity []\n LocalSensablesFragment []\n ScheduleHelper []\n ScheduledSensableService []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n ScheduledSensable [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n Log [label=\"android.util.Log\", style=\"rounded,filled\"]\n SensorEventListener [label=\"android.hardware.SensorEventListener\", style=\"rounded,filled\"]\n JSONException [label=\"org.json.JSONException\", style=\"rounded,filled\"]\n ScheduledSensablesTable []\n LocalSensablesFragment -> ScheduledSensable [style=\"dashed\"]\n SensableActivity -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensableService -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensable -> Sample [dir=\"both\", penwidth=2]\n MainActivity -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensable -> ScheduledSensableService [penwidth=1]\n CreateSensableFragment -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensable -> SensorEventListener [penwidth=1]\n ScheduledSensable -> CreateSensableFragment [penwidth=2]\n ScheduledSensable -> Log [style=\"dashed\"]\n ScheduledSensable -> JSONObject [style=\"dashed\"]\n ScheduleHelper -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensablesTable -> ScheduledSensable [style=\"dashed\"]\n ScheduledSensable -> ScheduleHelper [penwidth=6]\n ScheduledSensable -> ScheduledSensablesTable [dir=\"both\", penwidth=2]\n Cursor -> ScheduledSensable [penwidth=1]\n ScheduledSensable -> JSONException [style=\"dashed\"]\n ScheduledSensable -> MainActivity [penwidth=1]\n ScheduledSensable -> ContentValues [penwidth=1]\n}\n",
+ "d2": "ioandroidorgsensableutiljsondatabasecontenthardwareclientmodelLogJSONExceptionJSONObjectCursorContentValuesSensorEventListenerCreateSensableFragmentScheduledSensableMainActivitySensableActivityschedulersqliteviewsSampleScheduleHelperScheduledSensableServiceScheduledSensablesTableLocalSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.model.ScheduledSensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.ScheduledSensable -> android.util.Log: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.ScheduledSensable -> org.json.JSONException: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.ScheduledSensable -> org.json.JSONObject: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.database.Cursor -> io.sensable.model.ScheduledSensable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable <-> io.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> android.content.ContentValues: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.scheduler.ScheduleHelper: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> io.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.ScheduledSensable -> android.hardware.SensorEventListener: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.util.Log: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONException: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.ScheduledSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.scheduler.ScheduledSensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.hardware.SensorEventListener: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.ScheduledSensable: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "237331ab-6304-b6b2-0a4c-3cee7553bdb1",
+ "ancestors": [],
+ "description": "Represents a data model for managing sensor readings and samples. It encapsulates various properties such as ID, sensor type, unit, sample data, and access token, allowing for CRUD operations on these values. The class also provides methods for generating JSON representations of the sample data.",
+ "name": "ScheduledSensable",
+ "location": {
+ "start": 17,
+ "insert": 10,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 9,
+ "end": 16
+ }
+ },
+ "item_type": "class",
+ "length": 277,
+ "docLength": 7
+ },
+ {
+ "id": "3c8e71b3-8e70-3286-e541-dd41349825b7",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns a string value representing the sensor ID. It retrieves and returns the stored `sensorid` variable. This function provides read-only access to the sensor ID, allowing it to be used by other parts of the program for identification purposes.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the value of the `sensorid`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nString sensorId = scheduledSensable.getSensorid();",
+ "description": ""
+ },
+ "name": "getSensorid",
+ "location": {
+ "start": 40,
+ "insert": 35,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 34,
+ "end": 39
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "1cf2ea2c-d25b-a7bf-1440-9f5d78c31f6c",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a specified string value to the `sensorid` attribute of an object. This method is used to set or update the sensor ID, which can be used for identification purposes. The new value replaces any existing value stored in the `sensorid` attribute.",
+ "params": [
+ {
+ "name": "sensorid",
+ "type_name": "String",
+ "description": "identifier of a sensor, which is assigned to an instance variable `this.sensorid`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensor = new ScheduledSensable();\nsensor.setSensorid(\"my-sensor-id\");\n",
+ "description": ""
+ },
+ "name": "setSensorid",
+ "location": {
+ "start": 50,
+ "insert": 44,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 43,
+ "end": 49
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "f6238b2f-b4ec-7d86-654c-8c541e8aeae3",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns a string representing the current value of the `name` variable. This suggests that it is a getter method, allowing external access to the internal state of an object. It does not modify any data, but simply retrieves and returns the existing information.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the value of the variable `name`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setName(\"Sensor Name\");\nString name = scheduledSensable.getName();",
+ "description": ""
+ },
+ "name": "getName",
+ "location": {
+ "start": 59,
+ "insert": 54,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 53,
+ "end": 58
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "271e047a-171d-42af-2545-346d7ec34c3b",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a given string value to the `name` attribute of an object. It updates the current value with the new one, replacing any previous content. This modification affects the object's state, allowing its `name` property to be modified externally.",
+ "params": [
+ {
+ "name": "name",
+ "type_name": "String",
+ "description": "string value to be assigned to the `this.name` variable, updating its current state.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setName(\"Sensor Name\");\n",
+ "description": ""
+ },
+ "name": "setName",
+ "location": {
+ "start": 68,
+ "insert": 63,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 62,
+ "end": 67
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "adcda4e5-088a-97ba-4a43-c99145c237c4",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Retrieves an integer value representing the internal sensor ID and returns it directly to the caller without any modification or processing. The returned value is stored in a variable called `internalSensorId`. This function provides read-only access to the internal sensor ID.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer representing the internal sensor ID.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setInternalSensorId(12345);\nint internalSensorId = sensable.getInternalSensorId();",
+ "description": ""
+ },
+ "name": "getInternalSensorId",
+ "location": {
+ "start": 77,
+ "insert": 72,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 71,
+ "end": 76
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "5d0dadd0-aff7-c3bd-794d-5395a9949457",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a specified integer value to an internal variable `internalSensorId`. This variable is presumably a property of the class, allowing its state to be modified externally. The assigned value becomes the new value of `internalSensorId`, which can then be accessed or used within the class.",
+ "params": [
+ {
+ "name": "sensorId",
+ "type_name": "int",
+ "description": "integer value to be assigned to the internalSensorId field of the class.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduled = new ScheduledSensable();\nscheduled.setInternalSensorId(123);",
+ "description": ""
+ },
+ "name": "setInternalSensorId",
+ "location": {
+ "start": 87,
+ "insert": 81,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 80,
+ "end": 86
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "2d1e3a2a-51ff-bd9f-b347-343dc75ad64a",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns a string value representing the sensor type. It simply retrieves and returns the value of the `sensortype` variable without performing any operations or calculations. The returned value can be used for further processing or display purposes.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value of the `sensortype` variable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nString sensortype = scheduledSensable.getSensortype();",
+ "description": ""
+ },
+ "name": "getSensortype",
+ "location": {
+ "start": 96,
+ "insert": 91,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 90,
+ "end": 95
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "41930598-f9ab-52bb-ba47-221adad069be",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a string value to the instance variable `sensortype`. This allows an external entity to modify the internal state of the object by setting its sensor type. The new value replaces any previous assignment to this attribute.",
+ "params": [
+ {
+ "name": "sensortype",
+ "type_name": "String",
+ "description": "sensor type to be assigned to an object's internal variable, which is then stored and accessible through the object.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setSensortype(\"Accelerometer\");",
+ "description": ""
+ },
+ "name": "setSensortype",
+ "location": {
+ "start": 106,
+ "insert": 100,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 99,
+ "end": 105
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "55ca2b06-fe1d-efae-4844-0b0578bf4645",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns a string value representing the unit.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value of the `unit` variable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setUnit(\"centiMeter\");\nString unit = sensable.getUnit();\nSystem.out.println(unit); // Output: centiMeter",
+ "description": ""
+ },
+ "name": "getUnit",
+ "location": {
+ "start": 115,
+ "insert": 110,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 109,
+ "end": 114
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "047ba23a-819a-67b8-5542-2beb9dc0cde9",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a given string value to the `unit` field of its class. It takes a `String` parameter, which represents the unit to be set. This function updates the internal state of the object with the provided unit information.",
+ "params": [
+ {
+ "name": "unit",
+ "type_name": "String",
+ "description": "string value that is assigned to the instance variable `this.unit`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n ScheduledSensable sensable = new ScheduledSensable();\n sensable.setUnit(\"Kg\");\n }\n}",
+ "description": ""
+ },
+ "name": "setUnit",
+ "location": {
+ "start": 126,
+ "insert": 119,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 118,
+ "end": 125
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 7
+ },
+ {
+ "id": "a7c260de-a31f-7f96-1646-2e6c7ece1f75",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Retrieves and returns an integer value representing a pending state or status. This value is likely stored in a variable named `pending`. The function provides a read-only access to this value, allowing other parts of the program to obtain its current state.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing the pending status.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nint pendingValue = sensable.getPending();\n",
+ "description": ""
+ },
+ "name": "getPending",
+ "location": {
+ "start": 137,
+ "insert": 130,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 129,
+ "end": 136
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 7
+ },
+ {
+ "id": "5361f096-bfe2-fc8d-7c47-819be1c4c143",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a value to the `pending` field. The function accepts an integer parameter, `pending`, and sets it as the new value for the field with the same name. This allows the state of the object to be modified dynamically.",
+ "params": [
+ {
+ "name": "pending",
+ "type_name": "int",
+ "description": "integer value that is assigned to the instance variable `this.pending`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setPending(5);\n",
+ "description": ""
+ },
+ "name": "setPending",
+ "location": {
+ "start": 147,
+ "insert": 141,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 140,
+ "end": 146
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "ca5416d5-ff60-2489-8e43-d2cac4e06c34",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns an instance of the `Sample` class represented by the `sample` object. This suggests a getter method, providing access to the encapsulated `sample` object without modifying its state. The returned `Sample` object can then be used for further processing or inspection.",
+ "params": [],
+ "returns": {
+ "type_name": "Sample",
+ "description": "an instance of the `Sample` class, referenced by `sample`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nSample sampleObject = scheduledSensable.getSample();\n",
+ "description": "\nThis code creates a new instance of the ScheduledSensable class and retrieves the value of its sample field, which is stored in the sampleObject variable."
+ },
+ "name": "getSample",
+ "location": {
+ "start": 162,
+ "insert": 151,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 150,
+ "end": 161
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 11
+ },
+ {
+ "id": "569f905b-169b-92b0-cb4b-6447de919e4e",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Assigns a new value to the `sample` field, replacing any existing value with the provided `sample` object. This method does not perform any validation or processing on the input data. It simply updates the internal state of the class with the new sample object.",
+ "params": [
+ {
+ "name": "sample",
+ "type_name": "Sample",
+ "description": "object to be assigned to the `sample` field of the class, replacing its previous value.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sample sample = new Sample();\nsample.setValue(\"test\");\nScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setSample(sample);\n",
+ "description": "\n\nNote: This example provides a simple demonstration of how the `setSample` method is utilized. In practice, you would likely create more complex objects and scenarios depending on your specific requirements."
+ },
+ "name": "setSample",
+ "location": {
+ "start": 176,
+ "insert": 166,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 165,
+ "end": 175
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 10
+ },
+ {
+ "id": "d2178a78-4a96-4b8d-804e-02862230a051",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns a boolean value indicating whether a sensor is private or not. It simply retrieves the value of a variable `privateSensor`, which presumably holds information about the sensor's privacy status. The returned value can be used by other parts of the program to determine how to handle the sensor.",
+ "params": [],
+ "returns": {
+ "type_name": "boolean",
+ "description": "a boolean value indicating whether the sensor is private or not.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensor = new ScheduledSensable();\nsensor.setPrivateSensor(true);\nboolean isPrivate = sensor.isPrivateSensor();\n\nSystem.out.println(\"Is the sensor private? \" + isPrivate);",
+ "description": ""
+ },
+ "name": "isPrivateSensor",
+ "location": {
+ "start": 185,
+ "insert": 180,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 179,
+ "end": 184
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "f6e24345-84df-56b3-514e-4a7719cd5f01",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Sets a boolean value for the instance variable `privateSensor`. This method takes a single boolean parameter and updates the internal state of the object to reflect the new value. The modified state is accessible through other parts of the program.",
+ "params": [
+ {
+ "name": "privateSensor",
+ "type_name": "boolean",
+ "description": "boolean value that is assigned to the `privateSensor` instance variable, updating its state accordingly.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setPrivateSensor(true);",
+ "description": ""
+ },
+ "name": "setPrivateSensor",
+ "location": {
+ "start": 197,
+ "insert": 189,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 188,
+ "end": 196
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 8
+ },
+ {
+ "id": "a5ae32a6-02ac-3baa-2941-81e40051fc44",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Retrieves and returns the value of the `accessToken` variable. This method does not perform any calculations or operations, instead, it simply provides access to the stored token value. The returned token can be used for authentication purposes.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value of an access token.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setAccessToken(\"your_access_token\");\nString accessToken = sensable.getAccessToken(); // returns \"your_access_token\"",
+ "description": ""
+ },
+ "name": "getAccessToken",
+ "location": {
+ "start": 206,
+ "insert": 201,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 200,
+ "end": 205
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "ec913ff7-f32a-c199-8a4e-d65ee9c5c369",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Sets the value of an instance variable `accessToken`. It takes a `String` parameter representing the access token and assigns it to the instance variable. This variable can be accessed later by other parts of the program or class.",
+ "params": [
+ {
+ "name": "accessToken",
+ "type_name": "String",
+ "description": "value to be assigned to the instance variable `this.accessToken`, effectively setting it with a new access token.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setAccessToken(\"your_access_token\");",
+ "description": ""
+ },
+ "name": "setAccessToken",
+ "location": {
+ "start": 216,
+ "insert": 210,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 209,
+ "end": 215
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "18aecb84-d744-dc9b-124a-1be0e1b0f084",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns an array of doubles representing a location when a sample object is not already initialized, it creates a new sample object and retrieves its location.",
+ "params": [],
+ "returns": {
+ "type_name": "array",
+ "description": "an array of double values representing a location.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\ndouble[] location = scheduledSensable.getLocation();",
+ "description": ""
+ },
+ "name": "getLocation",
+ "location": {
+ "start": 226,
+ "insert": 220,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 219,
+ "end": 225
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 6
+ },
+ {
+ "id": "c9e4ecdf-97e7-cabe-0343-ff37cf56bb00",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Initializes or updates the location of a sample object when provided with a double array representing the coordinates. If the sample does not exist, it creates one before setting its location. The updated sample is stored for future use.",
+ "params": [
+ {
+ "name": "location",
+ "type_name": "double[]",
+ "description": "2D array of coordinates that is set as the location for the current sample object within the class.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n ScheduledSensable sensable = new ScheduledSensable();\n double[] location = {1.0, 2.0};\n sensable.setLocation(location);\n }\n}\n",
+ "description": "\nThe example demonstrates how to use the setLocation method of ScheduledSensable class by creating an instance of the class and providing a double array as input."
+ },
+ "name": "setLocation",
+ "location": {
+ "start": 242,
+ "insert": 233,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 232,
+ "end": 241
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 9
+ },
+ {
+ "id": "22e84814-c8a4-398c-cc48-bc73514c5949",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns an integer value representing a unique identifier. It retrieves and provides access to the internal state variable `id`. This method allows external code to obtain and use the ID for various purposes.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer representing a unique identifier.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\nscheduledSensable.setId(1);\nint id = scheduledSensable.getId(); \nSystem.out.println(id); // Output: 1",
+ "description": ""
+ },
+ "name": "getId",
+ "location": {
+ "start": 255,
+ "insert": 250,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 249,
+ "end": 254
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "45e215a3-f720-f19d-d141-f4cc0587d274",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Sets the value of a private instance variable `id` with the provided integer parameter, updating its current state to match the new input value. This variable is likely used to uniquely identify an object or entity within the program. The change is reflected within the class.",
+ "params": [
+ {
+ "name": "id",
+ "type_name": "int",
+ "description": "identifier to be assigned to the object, which is stored in the instance variable `this.id`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable sensable = new ScheduledSensable();\nsensable.setId(123);",
+ "description": ""
+ },
+ "name": "setId",
+ "location": {
+ "start": 265,
+ "insert": 259,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 258,
+ "end": 264
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "03ac6c4d-1422-bc9f-5b49-f760f8629ecf",
+ "ancestors": [
+ "237331ab-6304-b6b2-0a4c-3cee7553bdb1"
+ ],
+ "description": "Returns a JSON string representation of a sample object if it is not null, otherwise it creates a new sample object and returns its JSON string representation. The function logs the JSON string to the debug log with a respective tag.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a JSON representation of either `this.sample` or a default `Sample` object.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "ScheduledSensable scheduledSensable = new ScheduledSensable();\n// Initialize the sample object\nSample sample = new Sample();\n\n// Set properties for the sample\nsample.setName(\"Sensor 1\");\nsample.setUnit(\"Celsius\");\n\n// Assign the sample to the ScheduledSensable object\nscheduledSensable.setSample(sample);\n\n// Get JSON representation of the sample\nString jsonString = scheduledSensable.getSampleAsJsonString();\n",
+ "description": ""
+ },
+ "name": "getSampleAsJsonString",
+ "location": {
+ "start": 283,
+ "insert": 277,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 276,
+ "end": 282
+ }
+ },
+ "item_type": "method",
+ "length": 9,
+ "docLength": 6
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "Sensable.java",
+ "path": "library/src/main/java/io/sensable/model/Sensable.java",
+ "content": {
+ "structured": {
+ "description": "A class called `Sensable` that represents a sensory data point with various metadata such as location, sensor ID, name, type, and unit. The class implements the `Parcelable` interface for serializing and deserializing its state to and from a Parcel object. It also includes methods for setting and getting sample values, as well as converting samples to JSON strings.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n subgraph cluster_1 {\n label=\"io\"\n color=\"#33363A\"\n SensableService []\n subgraph cluster_2 {\n label=\"sensable\"\n color=\"#33363A\"\n SensableActivity []\n SampleResponse []\n MainActivity []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n Sensable [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Sample []\n CreateSensableFragment []\n subgraph cluster_3 {\n label=\"client\"\n color=\"#33363A\"\n ScheduleHelper []\n LocalSensablesFragment []\n RemoteSensablesFragment []\n SavedSensablesTable []\n FavouriteSensablesFragment []\n }\n }\n }\n subgraph cluster_4 {\n label=\"java\"\n color=\"#33363A\"\n Arrays [label=\"java.util.Arrays\", style=\"rounded,filled\"]\n }\n subgraph cluster_5 {\n label=\"android\"\n color=\"#33363A\"\n Cursor [label=\"android.database.Cursor\", style=\"rounded,filled\"]\n Parcel [label=\"android.os.Parcel\", style=\"rounded,filled\"]\n ContentValues [label=\"android.content.ContentValues\", style=\"rounded,filled\"]\n Parcelable [label=\"android.os.Parcelable\", style=\"rounded,filled\"]\n }\n subgraph cluster_6 {\n label=\"org\"\n color=\"#33363A\"\n JSONObject [label=\"org.json.JSONObject\", style=\"rounded,filled\"]\n JSONArray [label=\"org.json.JSONArray\", style=\"rounded,filled\"]\n }\n Cursor -> Sensable [penwidth=1]\n ScheduleHelper -> Sensable [style=\"dashed\"]\n Sensable -> Sample [dir=\"both\", penwidth=2]\n LocalSensablesFragment -> Sensable [style=\"dashed\"]\n Parcel -> Sensable [penwidth=4]\n Sensable -> Parcelable [style=\"dashed\"]\n Sensable -> JSONArray [style=\"dashed\"]\n Sensable -> SampleResponse [penwidth=1]\n Sensable -> ContentValues [penwidth=2]\n MainActivity -> Sensable [style=\"dashed\"]\n Sensable -> SensableService [dir=\"both\", penwidth=6]\n Sensable -> CreateSensableFragment [penwidth=2]\n SavedSensablesTable -> Sensable [style=\"dashed\"]\n Sensable -> SavedSensablesTable [dir=\"both\", penwidth=3]\n Sensable -> Parcel [style=\"dashed\"]\n Sensable -> Arrays [style=\"dashed\"]\n Sensable -> SensableActivity [penwidth=3]\n RemoteSensablesFragment -> Sensable [style=\"dashed\"]\n Sensable -> RemoteSensablesFragment [penwidth=1]\n Sensable -> JSONObject [style=\"dashed\"]\n CreateSensableFragment -> Sensable [style=\"dashed\"]\n SensableActivity -> Sensable [style=\"dashed\"]\n FavouriteSensablesFragment -> Sensable [style=\"dashed\"]\n}\n",
+ "d2": "ioandroidorgjavasensableosjsonutildatabasecontentclientmodelParcelParcelableJSONArrayJSONObjectArraysCursorSensableServiceContentValuesCreateSensableFragmentSensableMainActivitySensableActivityschedulersqliteviewsSampleResponseSampleScheduleHelperSavedSensablesTableFavouriteSensablesFragmentLocalSensablesFragmentRemoteSensablesFragmentimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.CreateSensableFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableActivity -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment -> io.sensable.model.Sensable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sensable -> android.os.Parcel: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sensable -> android.os.Parcelable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sensable -> org.json.JSONArray: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sensable -> org.json.JSONObject: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Sensable -> java.util.Arrays: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.database.Cursor -> io.sensable.model.Sensable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.os.Parcel -> io.sensable.model.Sensable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.model.SampleResponse: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable <-> io.sensable.model.Sample: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.client.SensableActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.client.views.RemoteSensablesFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> io.sensable.client.CreateSensableFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable <-> io.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Sensable -> android.content.ContentValues: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.os.Parcel: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONObject: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\njava.util.Arrays: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\norg.json.JSONArray: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Parcelable: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.client.scheduler.ScheduleHelper: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.LocalSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.CreateSensableFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.content.ContentValues: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.sqlite.SavedSensablesTable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.database.Cursor: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Parcel: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.SampleResponse: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.FavouriteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sample: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.views.RemoteSensablesFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Sensable: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "c239a228-5c90-799b-8d48-b04e0539814a",
+ "ancestors": [],
+ "description": "Is a representation of a sensory data point with metadata such as location, sensor ID, name, type, and unit. It also contains sample values that can be retrieved or set through methods. The class implements Parcelable for efficient serialization and deserialization.",
+ "name": "Sensable",
+ "location": {
+ "start": 20,
+ "insert": 13,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 12,
+ "end": 19
+ }
+ },
+ "item_type": "class",
+ "length": 330,
+ "docLength": 7
+ },
+ {
+ "id": "1d0ccd3e-17e5-5b90-a74b-9781095447ed",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Returns a double array representing the location.",
+ "params": [],
+ "returns": {
+ "type_name": "array",
+ "description": "an array of doubles representing a geographical location.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\ndouble[] location = sensable.getLocation();",
+ "description": ""
+ },
+ "name": "getLocation",
+ "location": {
+ "start": 38,
+ "insert": 33,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 32,
+ "end": 37
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "e4b101f0-4cf6-36a9-974b-1392dd2224c6",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Sets a new value for an object's `location` attribute, which is expected to be an array of double values representing coordinates. It updates the internal state of the object with the provided location data. The updated location can then be accessed or used by other parts of the program.",
+ "params": [
+ {
+ "name": "location",
+ "type_name": "double[]",
+ "description": "2D array that is assigned to the instance variable `this.location`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "double[] location = new double[]{1.0, 2.0, 3.0};\nsensable.setLocation(location);\n",
+ "description": ""
+ },
+ "name": "setLocation",
+ "location": {
+ "start": 54,
+ "insert": 42,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 41,
+ "end": 53
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 12
+ },
+ {
+ "id": "2f4ec199-a70d-3388-3c4e-8714ffa5b9c0",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Retrieves and returns a string value representing the sensor ID. This method simply accesses the existing `sensorid` variable without performing any operations on it, effectively returning its current state.",
+ "params": [],
+ "returns": {
+ "type_name": "string",
+ "description": "a string value representing the sensor ID.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setSensorid(\"12345\");\nString sensorId = sensable.getSensorid(); // returns \"12345\"\n",
+ "description": ""
+ },
+ "name": "getSensorid",
+ "location": {
+ "start": 63,
+ "insert": 58,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 57,
+ "end": 62
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "e9254b21-0f24-8780-ad4d-547c4d713287",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Updates the internal state of an object by assigning a given string value to the `sensorid` attribute. This attribute represents a unique identifier for a sensor. The update operation is performed directly on the object's internal storage.",
+ "params": [
+ {
+ "name": "sensorId",
+ "type_name": "String",
+ "description": "identifier of a sensor and assigns it to an instance variable with the same name within the class.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Sensable sensable = new Sensable();\n sensable.setSensorid(\"mySensorId\");\n }\n}",
+ "description": ""
+ },
+ "name": "setSensorid",
+ "location": {
+ "start": 73,
+ "insert": 67,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 66,
+ "end": 72
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "bd24ec38-20f5-a783-9b49-4d771557940f",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Retrieves a string value and returns it. The returned value is stored in the `name` variable, which is likely an instance or class-level attribute. This function allows external access to the name property without modifying its internal state.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value representing the object's name.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setName(\"My Sensor\");\nString name = sensable.getName();\nSystem.out.println(name); // Output: My Sensor",
+ "description": ""
+ },
+ "name": "getName",
+ "location": {
+ "start": 82,
+ "insert": 77,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 76,
+ "end": 81
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "b1b32570-6fcd-f2a3-1d47-d88bfa548ada",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Assigns a new value to the instance variable `name`. It accepts a `String` parameter, which is stored as the object's `name` property. This allows the object's name attribute to be updated or changed.",
+ "params": [
+ {
+ "name": "name",
+ "type_name": "String",
+ "description": "string value to be assigned to the instance variable `this.name`, updating its state.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setName(\"MySensor\");\n",
+ "description": "\nIn this example, the setName method is called with a string \"MySensor\" as its argument. This method assigns the provided name to the instance variable `name` of the Sensable object."
+ },
+ "name": "setName",
+ "location": {
+ "start": 92,
+ "insert": 86,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 85,
+ "end": 91
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "58420cc3-0a77-3ab1-0442-78e198ca30e4",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Retrieves and returns a string value representing the sensor type. The returned value is stored in the variable `sensortype`. This method simply provides access to the pre-existing sensor type information without performing any computations or modifications.",
+ "params": [],
+ "returns": {
+ "type_name": "string",
+ "description": "a string value representing the sensor type.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setSensortype(\"Accelerometer\");\nString sensortype = sensable.getSensortype();\nSystem.out.println(sensortype); // Output: Accelerometer",
+ "description": ""
+ },
+ "name": "getSensortype",
+ "location": {
+ "start": 101,
+ "insert": 96,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 95,
+ "end": 100
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "55176945-45dc-619e-6c4c-b855dd988ac6",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Assigns a value to an instance variable `sensortype`. It takes a `String` parameter, which is used to update the state of the object. The updated value can be accessed later through the same property.",
+ "params": [
+ {
+ "name": "sensortype",
+ "type_name": "String",
+ "description": "value to be assigned to the instance variable `this.sensortype`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void main(String[] args) {\n Sensable sensable = new Sensable();\n sensable.setSensortype(\"Accelerometer\");\n}\n",
+ "description": "\nIn this example, a new instance of the class Sensable is created and then its setSensortype method is called with \"Accelerometer\" as an argument."
+ },
+ "name": "setSensortype",
+ "location": {
+ "start": 111,
+ "insert": 105,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 104,
+ "end": 110
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "364ad492-9f25-039f-f64b-708396685368",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Returns an array of sample objects. The returned array is stored in a variable named `samples`. This method allows access to the internal state of the object, providing a way for external code to retrieve the samples.",
+ "params": [],
+ "returns": {
+ "type_name": "array",
+ "description": "an array of `Sample` objects named `samples`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Sensable sensable = new Sensable();\n Sample sample1 = new Sample(\"Sample 1\", \"Description 1\");\n Sample sample2 = new Sample(\"Sample 2\", \"Description 2\");\n\n sensable.setSamples(new Sample[]{sample1, sample2});\n \n Sample[] samples = sensable.getSamples();\n\n // prints: [Sample@12345678, Sample@90123456]\n System.out.println(Arrays.toString(samples));\n }\n}\n",
+ "description": ""
+ },
+ "name": "getSamples",
+ "location": {
+ "start": 125,
+ "insert": 115,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 114,
+ "end": 124
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 10
+ },
+ {
+ "id": "37291869-455f-9d90-a247-ac7415492058",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Sets an array of `Sample` objects to a private field `samples`. If the input array is not empty, it calls another function `setSample` with the last element of the array; otherwise, it sets `samples` to null.",
+ "params": [
+ {
+ "name": "samples",
+ "type_name": "Sample[]",
+ "description": "2D array of `Sample` objects to be assigned to the current object's internal `samples` field.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sample sample1 = new Sample();\nsample1.setValue(10);\nSample sample2 = new Sample();\nsample2.setValue(20);\n\nSample[] samples = {sample1, sample2};\n\nsensable.setSamples(samples);",
+ "description": ""
+ },
+ "name": "setSamples",
+ "location": {
+ "start": 140,
+ "insert": 129,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 128,
+ "end": 139
+ }
+ },
+ "item_type": "method",
+ "length": 8,
+ "docLength": 11
+ },
+ {
+ "id": "984e092d-bd83-6f89-374a-98c686416445",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Returns a reference to an object of type `Sample`. The object's value is stored in a variable named `sample`. This method provides access to the `sample` object from outside the class where it is defined.",
+ "params": [],
+ "returns": {
+ "type_name": "object",
+ "description": "an instance of the `Sample` class named `sample`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nSample sampleObject = sensable.getSample();\n",
+ "description": ""
+ },
+ "name": "getSample",
+ "location": {
+ "start": 163,
+ "insert": 149,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 148,
+ "end": 162
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 14
+ },
+ {
+ "id": "23f90883-fbb2-599a-4c49-02ea79b26c84",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Assigns a new value to the `sample` attribute of its object, replacing any previous value it held. The `sample` parameter is an instance of the `Sample` class and becomes the new state of the object's `sample` attribute.",
+ "params": [
+ {
+ "name": "sample",
+ "type_name": "Sample",
+ "description": "object to be assigned to the instance variable `this.sample`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nSample sample = new Sample(\"sample\", \"Sample\");\nsensable.setSample(sample);\n",
+ "description": ""
+ },
+ "name": "setSample",
+ "location": {
+ "start": 176,
+ "insert": 167,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 166,
+ "end": 175
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 9
+ },
+ {
+ "id": "3773c1f7-c9fa-76a8-6d43-6e8393b0040b",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Retrieves and returns a string value stored in the `unit` variable. It does not modify any external state, instead, it provides access to the internal state by returning its value. This allows other parts of the program to utilize the unit information as needed.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value representing the unit property.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setUnit(\"meters\");\nString unit = sensable.getUnit(); // returns \"meters\"\n",
+ "description": ""
+ },
+ "name": "getUnit",
+ "location": {
+ "start": 186,
+ "insert": 181,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 180,
+ "end": 185
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "8678b928-f6a1-8db2-8a4c-9af94ad8ad3f",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Assigns a new value to the `unit` field. It takes a string parameter representing the unit and updates the internal state of the object with the provided value. This allows external code to modify the unit associated with the object.",
+ "params": [
+ {
+ "name": "unit",
+ "type_name": "String",
+ "description": "value to be assigned to the instance variable `this.unit`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public class Main {\n public static void main(String[] args) {\n Sensable sensable = new Sensable();\n sensable.setUnit(\"meters\");\n }\n}\n",
+ "description": "\nIn this example, a new instance of the `Sensable` class is created and then the method setUnit is called with the argument `\"meters\"`."
+ },
+ "name": "setUnit",
+ "location": {
+ "start": 196,
+ "insert": 190,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 189,
+ "end": 195
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "7f146abf-4779-3e93-b442-fc16db02b667",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Retrieves and returns an access token. The access token is stored in the `accessToken` variable, which is presumably set elsewhere in the code. This function provides a getter method for accessing the access token from outside the class.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value representing an access token.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setAccessToken(\"my-access-token\");\nString accessToken = sensable.getAccessToken(); \nSystem.out.println(accessToken); // prints \"my-access-token\"",
+ "description": ""
+ },
+ "name": "getAccessToken",
+ "location": {
+ "start": 205,
+ "insert": 200,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 199,
+ "end": 204
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "2ca9a985-cf35-bf95-244a-8995948a5bf9",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Sets a new value for the `accessToken` variable, updating its internal state. It takes a `String` parameter representing the new access token to be assigned. This updated token is stored within the class instance.",
+ "params": [
+ {
+ "name": "accessToken",
+ "type_name": "String",
+ "description": "value to be assigned to the instance variable `accessToken`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setAccessToken(\"my_access_token\");\n",
+ "description": "\nThe input provided for this example is a string, \"my_access_token\", which represents the access token to be stored in the instance variable 'accessToken'."
+ },
+ "name": "setAccessToken",
+ "location": {
+ "start": 214,
+ "insert": 209,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 208,
+ "end": 213
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "7bc8be90-20ca-2aa9-b04d-f3357793de79",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Generates a string representation of an object. It combines the sensor ID, first sample value (if available), and unit of measurement into a single string. If no samples are present, it returns the sensor ID and unit only.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string describing the sensor ID and its value or unit.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nsensable.setSensorid(\"12345\");\nSample sample = new Sample();\nsample.setValue(10);\nsensable.setSample(sample);\n\nString output = sensable.toString();\nSystem.out.println(output); // Output: \"12345 - 10\"",
+ "description": ""
+ },
+ "name": "toString",
+ "location": {
+ "start": 224,
+ "insert": 218,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 217,
+ "end": 223
+ }
+ },
+ "item_type": "method",
+ "length": 8,
+ "docLength": 6
+ },
+ {
+ "id": "8abda732-7360-5685-8746-46a99a81ea88",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Specifies the type of serialization used for the object. It returns an integer value indicating the type, in this case, 0, which indicates no special handling is required during serialization. This method is typically overridden in classes that implement Parcelable interface.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing the serializable contents of the object.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\nint contents = sensable.describeContents(); \n",
+ "description": ""
+ },
+ "name": "describeContents",
+ "location": {
+ "start": 238,
+ "insert": 233,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 232,
+ "end": 237
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 5
+ },
+ {
+ "id": "e4435c1f-e2d6-679b-6940-f3c733fa9d14",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Writes a parcelable object to a Parcel, containing location data as a double array, sensor ID and name as strings, sensor type as a string, sample data as an array of parcelables, and unit as a string.",
+ "params": [
+ {
+ "name": "dest",
+ "type_name": "Parcel",
+ "description": "Parcel where the object's state is being written, allowing its attributes to be serialized and stored for later use.",
+ "complex_type": false
+ },
+ {
+ "name": "flags",
+ "type_name": "int",
+ "description": "32-bit integer that controls how the parcel is marshaled and unmarshaled.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Parcel parcel = Parcel.obtain();\nSensable sensable = new Sensable();\nsensable.setLocation(new double[] {1.0, 2.0, 3.0});\nsensable.setSensorid(\"123\");\nsensable.setName(\"Sensor Name\");\nsensable.setSensortype(\"GPS\");\nSample sample = new Sample();\nsample.setValue(4.5);\nsensable.setSamples(new Sample[] {sample});\nsensable.setUnit(\"meters\");\n\nsensable.writeToParcel(parcel, 0);\n\nparcel.setDataPosition(0);",
+ "description": ""
+ },
+ "name": "writeToParcel",
+ "location": {
+ "start": 267,
+ "insert": 243,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 242,
+ "end": 266
+ }
+ },
+ "item_type": "method",
+ "length": 10,
+ "docLength": 24
+ },
+ {
+ "id": "eea37312-1fac-0384-854f-be4a0b222919",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a",
+ "b559ba82-f0f3-04ba-2f41-11ce8de35a73"
+ ],
+ "description": "Recreates an instance of the `Sensible` class from a Parcel object passed as a parameter. It instantiates a new object using the provided parcel and returns it. The object is initialized with data retrieved from the parcel.",
+ "params": [
+ {
+ "name": "in",
+ "type_name": "Parcel",
+ "description": "Parcel object from which data is to be read and used to construct a new instance of the Sensable class.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "Sensible",
+ "description": "an instance of the `Sensible` class.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Parcel parcel = Parcel.obtain();\n// Add the data to the parcel...\nSensable sensable = CREATOR.createFromParcel(parcel);\nparcel.recycle();",
+ "description": ""
+ },
+ "name": "createFromParcel",
+ "location": {
+ "start": 299,
+ "insert": 279,
+ "offset": " ",
+ "indent": 8,
+ "comment": {
+ "start": 278,
+ "end": 298
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 20
+ },
+ {
+ "id": "dd26c552-24a3-4fb5-6f4a-75981374219f",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a",
+ "b559ba82-f0f3-04ba-2f41-11ce8de35a73"
+ ],
+ "description": "Creates an array of type `Sensible` with a specified `size`. It initializes an empty array of the specified length, ready for use to store objects of type `Sensible`. The returned array is filled with default values.",
+ "params": [
+ {
+ "name": "size",
+ "type_name": "int",
+ "description": "umber of elements to be allocated for an array of type `Sensible`.",
+ "complex_type": false
+ }
+ ],
+ "returns": {
+ "type_name": "array",
+ "description": "an array of `Sensible` objects with a specified `size`.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable[] sensables = new Sensable[5];\n",
+ "description": "\nHere, 'size' is 5 and it will create a new array of length 5 with all elements being instances of the class `Sensable`."
+ },
+ "name": "newArray",
+ "location": {
+ "start": 317,
+ "insert": 303,
+ "offset": " ",
+ "indent": 8,
+ "comment": {
+ "start": 302,
+ "end": 316
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 14
+ },
+ {
+ "id": "9ed4a4e4-0fe5-98a2-de4c-4a6994dbc9a0",
+ "ancestors": [
+ "c239a228-5c90-799b-8d48-b04e0539814a"
+ ],
+ "description": "Returns a JSON representation of an object named \"sample\". If the sample object is null, it creates a new one. The returned string is generated by calling the `toJson` method on the sample object and then converting the result to a string using `toString`.",
+ "params": [],
+ "returns": {
+ "type_name": "string",
+ "description": "a JSON string representation of the sample object.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Sensable sensable = new Sensable();\n// assuming sensable.sample is null\nsensable.getSampleAsJsonString(); // returns a JSON string representation of the Sample object.",
+ "description": ""
+ },
+ "name": "getSampleAsJsonString",
+ "location": {
+ "start": 343,
+ "insert": 338,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 337,
+ "end": 342
+ }
+ },
+ "item_type": "method",
+ "length": 6,
+ "docLength": 5
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "Statistics.java",
+ "path": "library/src/main/java/io/sensable/model/Statistics.java",
+ "content": {
+ "structured": {
+ "description": "A simple class Statistics that represents a count value and provides accessors for reading and writing this value. The class has a private integer variable `count` and three public methods: `getCount`, `setCount` and no other method. This class can be used to track the number of elements in a collection, with the ability to get or set that count value.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n AboutActivity []\n MainActivity []\n SensableService []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n Statistics [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n AboutActivity -> Statistics [style=\"dashed\"]\n Statistics -> SensableService [dir=\"both\", penwidth=2]\n Statistics -> AboutActivity [penwidth=1]\n MainActivity -> Statistics [style=\"dashed\"]\n}\n",
+ "d2": "iosensableclientmodelSensableServiceAboutActivityStatisticsMainActivityimportsimports\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.AboutActivity -> io.sensable.model.Statistics: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.MainActivity -> io.sensable.model.Statistics: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.Statistics <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.Statistics -> io.sensable.client.AboutActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.AboutActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Statistics: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.Statistics: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "b5df72e2-c71d-dbae-154b-67905a470a39",
+ "ancestors": [],
+ "description": "Encapsulates and manages an integer value representing a count of elements in a collection. It provides methods to access and modify this count value through getter and setter functions. The class maintains data integrity by restricting direct modification of the count variable.",
+ "name": "Statistics",
+ "location": {
+ "start": 13,
+ "insert": 6,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 5,
+ "end": 12
+ }
+ },
+ "item_type": "class",
+ "length": 26,
+ "docLength": 7
+ },
+ {
+ "id": "6b9bec4a-977a-66a6-3c4c-c74e468daf4b",
+ "ancestors": [
+ "b5df72e2-c71d-dbae-154b-67905a470a39"
+ ],
+ "description": "Returns an integer value representing a count. The returned value is stored in the `count` variable. This function provides access to the current count, allowing it to be retrieved and used elsewhere in the program.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value representing the current state of the `count` variable.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Statistics statistics = new Statistics();\nstatistics.setCount(5);\nint countValue = statistics.getCount(); \n",
+ "description": "\nThe code creates a new instance of the Statistics class, sets its count to 5 using the setCount method, and then retrieves the current value of the count using the getCount method."
+ },
+ "name": "getCount",
+ "location": {
+ "start": 25,
+ "insert": 19,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 18,
+ "end": 24
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "e60e64a2-0a99-cea4-404b-7db5fa12006f",
+ "ancestors": [
+ "b5df72e2-c71d-dbae-154b-67905a470a39"
+ ],
+ "description": "Assigns a new integer value to the `count` variable within the class. This allows the external environment to modify the internal state of the object. The modified value is then stored in the object for future reference.",
+ "params": [
+ {
+ "name": "count",
+ "type_name": "int",
+ "description": "new value to be assigned to the instance variable `this.count`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Statistics stats = new Statistics();\nstats.setCount(10);\n",
+ "description": ""
+ },
+ "name": "setCount",
+ "location": {
+ "start": 35,
+ "insert": 29,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 28,
+ "end": 34
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "User.java",
+ "path": "library/src/main/java/io/sensable/model/User.java",
+ "content": {
+ "structured": {
+ "description": "A `User` class that implements Parcelable, allowing it to be serialized and transmitted efficiently. The class contains three private fields: username, email, and accessToken, which can be retrieved or set through getter and setter methods. The class overrides two methods from the Parcelable interface: `describeContents()` and `writeToParcel()`.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n UserLogin []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n User [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n Parcel [label=\"android.os.Parcel\", style=\"rounded,filled\"]\n Parcelable [label=\"android.os.Parcelable\", style=\"rounded,filled\"]\n SensableService []\n SensableUser []\n User -> SensableService [dir=\"both\", penwidth=4]\n UserLogin -> User [penwidth=1]\n Parcel -> User [penwidth=1]\n User -> Parcel [style=\"dashed\"]\n User -> Parcelable [style=\"dashed\"]\n SensableUser -> User [style=\"dashed\"]\n User -> SensableUser [penwidth=2]\n}\n",
+ "d2": "ioandroidsensableosclientmodelParcelParcelableSensableServiceSensableUserUserUserLoginimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.SensableUser -> io.sensable.model.User: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.User -> android.os.Parcel: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.User -> android.os.Parcelable: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nandroid.os.Parcel -> io.sensable.model.User: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.User <-> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.User -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.model.User: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nandroid.os.Parcel: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nandroid.os.Parcelable: {\n style: {\n font: mono\n fill: \"#717D86\"\n border-radius: 100\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableUser: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.User: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nandroid.os.Parcel: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.User: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "18100935-8d2e-a2bd-f341-33a7fdadd908",
+ "ancestors": [],
+ "description": "Represents a user with personal information and an access token, implementing Parcelable for efficient serialization and transmission. It provides getter and setter methods for username, email, and access token fields. The class also overrides the writeToParcel method to write these fields to a Parcel object.",
+ "name": "User",
+ "location": {
+ "start": 14,
+ "insert": 9,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 8,
+ "end": 13
+ }
+ },
+ "item_type": "class",
+ "length": 96,
+ "docLength": 5
+ },
+ {
+ "id": "9bf7b98e-32c9-f0bf-b949-ca4c3f5f6919",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Retrieves and returns the value stored in the `username` variable. It does not perform any computations or modifications, simply providing access to the existing data. The returned value is a string representing the username.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the username.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "User user = new User();\nuser.setUsername(\"testUsername\");\nString result = user.getUsername();\nSystem.out.println(result); // Outputs: testUsername",
+ "description": ""
+ },
+ "name": "getUsername",
+ "location": {
+ "start": 28,
+ "insert": 23,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 22,
+ "end": 27
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "b20afd63-b40f-7c9f-de48-4117ad8dec3c",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Assigns a value to the instance variable `username`. It takes a `String` parameter, which is used to set the value of the `username` attribute within the class. This method sets the username for an object.",
+ "params": [
+ {
+ "name": "username",
+ "type_name": "String",
+ "description": "user name to be set for an object, and its value is assigned to the instance variable `this.username`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "User user = new User();\nuser.setUsername(\"myUsername\");\n",
+ "description": "\nIn this example, a new instance of the User class is created and then the setUsername method is called to set the username to \"myUsername\"."
+ },
+ "name": "setUsername",
+ "location": {
+ "start": 38,
+ "insert": 32,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 31,
+ "end": 37
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "4eb922f9-cfc8-1584-534f-e43f11b6811a",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Returns a string value representing an email address. It retrieves and exposes the internal state of the object, providing access to the stored email information for external use or processing. The returned value is a simple string representation of the email address.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value representing an email address.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "User user = new User();\nuser.setEmail(\"example@gmail.com\");\nString email = user.getEmail();\nSystem.out.println(email);",
+ "description": ""
+ },
+ "name": "getEmail",
+ "location": {
+ "start": 47,
+ "insert": 42,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 41,
+ "end": 46
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "58fed7f4-37a6-bea2-3f4d-ebb62d948441",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Sets a given string value as an instance variable named `email`. The provided email address is assigned to the object's internal state, allowing the object to maintain and store its email property. This property can be accessed and modified through this method.",
+ "params": [
+ {
+ "name": "email",
+ "type_name": "String",
+ "description": "email address to be set for the object, which is then assigned to the `email` field of the same object.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "User user = new User();\nuser.setEmail(\"example@gmail.com\");\n",
+ "description": ""
+ },
+ "name": "setEmail",
+ "location": {
+ "start": 56,
+ "insert": 51,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 50,
+ "end": 55
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "1d589379-4e3c-abb4-ba42-9f1881426e80",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Returns a string value representing an access token. The returned value is likely stored in an instance variable named `accessToken`. This function allows other parts of the program to retrieve and utilize the access token.",
+ "params": [],
+ "returns": {
+ "type_name": "string",
+ "description": "a string representing an access token.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "User user = new User();\nuser.setAccessToken(\"access_token\");\nString accessToken = user.getAccessToken();\n",
+ "description": "\nWrite to Parcel: The `writeToParcel` method writes the username, email and access token to a Parcel object."
+ },
+ "name": "getAccessToken",
+ "location": {
+ "start": 65,
+ "insert": 60,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 59,
+ "end": 64
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "d8da53aa-9c40-bdb3-ee4c-ffefa31fcbd3",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Assigns a specified string value to the `accessToken` property of an object. This property is then updated with the provided access token. The function does not return any value and has no effect on the program's execution flow beyond updating the object's state.",
+ "params": [
+ {
+ "name": "accessToken",
+ "type_name": "String",
+ "description": "value to be assigned to the `this.accessToken` instance variable.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "public void main() {\n User user = new User();\n String accessToken = \"your_access_token\";\n user.setAccessToken(accessToken);\n}\n",
+ "description": "\nExample input: `setAccessToken(\"your_access_token\")`"
+ },
+ "name": "setAccessToken",
+ "location": {
+ "start": 75,
+ "insert": 69,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 68,
+ "end": 74
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ },
+ {
+ "id": "2df7a15c-fe26-f283-2d43-51721b4246a8",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Returns an integer value indicating the type and complexity of the Parcelable object's contents. In this case, it returns a constant value of 0, indicating that the object has no complex or non-primitive data types. This is typically used for debugging purposes in Android development.",
+ "params": [],
+ "returns": {
+ "type_name": "integer",
+ "description": "an integer value indicating the type of bundle containing the Parcelable object.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "Parcel parcel = Parcel.obtain();\nint contents = user.describeContents();\nparcel.recycle();",
+ "description": ""
+ },
+ "name": "describeContents",
+ "location": {
+ "start": 84,
+ "insert": 79,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 78,
+ "end": 83
+ }
+ },
+ "item_type": "method",
+ "length": 4,
+ "docLength": 5
+ },
+ {
+ "id": "43b91067-c871-5cac-804d-b028ee1fa470",
+ "ancestors": [
+ "18100935-8d2e-a2bd-f341-33a7fdadd908"
+ ],
+ "description": "Serializes three string variables: `username`, `email`, and `accessToken`. It writes these values to a Parcel object, allowing them to be stored or transmitted as binary data.",
+ "params": [
+ {
+ "name": "dest",
+ "type_name": "Parcel",
+ "description": "parcel where the object's data is being written, allowing the serialization of the provided values to the parcelled output stream.",
+ "complex_type": false
+ },
+ {
+ "name": "flags",
+ "type_name": "int",
+ "description": "bitwise OR of multiple values that specify how the parcel should be written, such as whether to use compression or encryption.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "Parcel parcel = Parcel.obtain();\nUser user = new User();\nuser.setUsername(\"johnDoe\");\nuser.setEmail(\"johndoe@example.com\");\nuser.setAccessToken(\"access_token\");\n\nuser.writeToParcel(parcel, 0);\n",
+ "description": ""
+ },
+ "name": "writeToParcel",
+ "location": {
+ "start": 102,
+ "insert": 89,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 88,
+ "end": 101
+ }
+ },
+ "item_type": "method",
+ "length": 7,
+ "docLength": 13
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "UserLogin.java",
+ "path": "library/src/main/java/io/sensable/model/UserLogin.java",
+ "content": {
+ "structured": {
+ "description": "A `UserLogin` class that represents user login functionality with private fields for username and password. The class provides getter and setter methods for these fields allowing to access and modify their values. It also includes default constructors to initialize an instance of this class with or without parameters.",
+ "diagram": {
+ "gviz": "digraph G {\n bgcolor=\"#151719\"\n fontcolor=\"#ECEDED\"\n splines=ortho\n fontname=\"Courier New\"\n edge [color=\"#26de81\"]\n node [style=filled,color=\"#717D86\", shape=rectangle, fontname=\"Courier New\"]\n \n SensableUser []\n subgraph cluster_main {\n // style=filled\n color=\"#00000000\"\n UserLogin [] [fontsize=\"20pt\",style=filled,color=\"#26de81\",shape=square, fontname=\"Courier New\"]\n label = \"\"\n }\n User []\n SensableService []\n MainActivity []\n SensableLoginFragment []\n MainActivity -> UserLogin [style=\"dashed\"]\n UserLogin -> SensableUser [penwidth=1]\n UserLogin -> SensableLoginFragment [penwidth=1]\n UserLogin -> MainActivity [penwidth=1]\n SensableLoginFragment -> UserLogin [style=\"dashed\"]\n SensableUser -> UserLogin [style=\"dashed\"]\n UserLogin -> SensableService [penwidth=2]\n UserLogin -> User [penwidth=1]\n}\n",
+ "d2": "iosensableclientmodelSensableServiceMainActivityUserLoginSensableLoginFragmentSensableUserUserimportsimportsimports\n\n\n\n\n\n\n\n\n\n\n\n\n",
+ "d2_src": "direction: down\n\nvars: {\n d2-config: {\n pad: 0\n theme-overrides: {\n B1: \"#717D86\"\n B2: \"#717D86\"\n B3: \"#ffff00\"\n B4: \"#151719\"\n B5: \"#151719\"\n B6: \"#151719\"\n N1: \"#ECEDED\"\n N7: \"#151719\"\n AA2: \"#ECEDED\"\n }\n }\n}\n\nstyle: {\n fill: \"#151719\"\n}\nio.sensable.client.MainActivity -> io.sensable.model.UserLogin: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableLoginFragment -> io.sensable.model.UserLogin: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.client.SensableUser -> io.sensable.model.UserLogin: {\n target-arrowhead: \"imports\"\n style: {\n stroke: \"#26de81\"\n stroke-dash: 3\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.SensableService: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.model.User: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.client.SensableLoginFragment: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.client.MainActivity: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.model.UserLogin -> io.sensable.client.SensableUser: {\n style: {\n stroke: \"#26de81\"\n }\n}\n\nio.sensable.client.SensableLoginFragment: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.SensableUser: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.User: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.SensableService: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.client.MainActivity: {\n style: {\n font: mono\n fill: \"#717D86\"\n stroke-width: 0\n }\n}\n\nio.sensable.model.UserLogin: {\n style: {\n fill: \"#26de81\"\n font-color: \"#151719\"\n stroke-width: 0\n }\n}\n"
+ },
+ "items": [
+ {
+ "id": "7f90d6a7-d398-36ab-b94a-f102e6bd7ad3",
+ "ancestors": [],
+ "description": "Represents user login functionality, encapsulating username and password details. It provides getter and setter methods for these attributes, allowing manipulation of the data. The class supports default constructor and a parameterized constructor for initializing instances with or without provided username and password values.",
+ "name": "UserLogin",
+ "location": {
+ "start": 10,
+ "insert": 6,
+ "offset": " ",
+ "indent": 0,
+ "comment": {
+ "start": 5,
+ "end": 9
+ }
+ },
+ "item_type": "class",
+ "length": 50,
+ "docLength": 4
+ },
+ {
+ "id": "d4a5ee12-8e46-c09f-7d4f-021165e2ba7d",
+ "ancestors": [
+ "7f90d6a7-d398-36ab-b94a-f102e6bd7ad3"
+ ],
+ "description": "Returns the value of a variable named `password`. This suggests that the function is providing access to the stored password, likely for retrieval or display purposes. The returned value is a string representation of the password.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string value representing the stored password.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "UserLogin user = new UserLogin(\"simon\", \"password123\");\nString pass = user.getPassword();\nSystem.out.println(pass);\n",
+ "description": "\nThis example creates a new instance of the UserLogin class with username \"simon\" and password \"password123\". Then it calls the getPassword method to retrieve the stored password, which is then printed out."
+ },
+ "name": "getPassword",
+ "location": {
+ "start": 27,
+ "insert": 22,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 21,
+ "end": 26
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "af7b7fa4-4a5b-f496-e64d-11013c06cf85",
+ "ancestors": [
+ "7f90d6a7-d398-36ab-b94a-f102e6bd7ad3"
+ ],
+ "description": "Updates the value of an internal variable named `password` with a provided string input. The new password replaces any previously set password, effectively changing the stored password. This function has no return value and operates on the object's internal state.",
+ "params": [
+ {
+ "name": "password",
+ "type_name": "String",
+ "description": "string value to be set as the new password of the object, which is then stored in the `this.password` field.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "UserLogin user = new UserLogin(\"user1\", \"password\");\nuser.setPassword(\"newPassword\");",
+ "description": ""
+ },
+ "name": "setPassword",
+ "location": {
+ "start": 36,
+ "insert": 31,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 30,
+ "end": 35
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "0ec45298-8a92-bcaf-2e47-8ddff1eed3b5",
+ "ancestors": [
+ "7f90d6a7-d398-36ab-b94a-f102e6bd7ad3"
+ ],
+ "description": "Retrieves and returns a string value representing the current username. It does not modify or manipulate the username in any way, simply providing access to its value. The returned string is based on the instance variable `username`.",
+ "params": [],
+ "returns": {
+ "type_name": "String",
+ "description": "a string representing the username.",
+ "complex_type": false
+ },
+ "usage": {
+ "language": "java",
+ "code": "UserLogin user = new UserLogin(\"user123\", \"password\");\nString username = user.getUsername();\nSystem.out.println(username); // Output: \"user123\"",
+ "description": ""
+ },
+ "name": "getUsername",
+ "location": {
+ "start": 45,
+ "insert": 40,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 39,
+ "end": 44
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 5
+ },
+ {
+ "id": "c4387ec4-94eb-0db8-454f-2f855444d937",
+ "ancestors": [
+ "7f90d6a7-d398-36ab-b94a-f102e6bd7ad3"
+ ],
+ "description": "Assigns a given string value to the object's `username` attribute. This attribute is likely used to store and retrieve user credentials or identities within the program. The assigned value can be retrieved or manipulated by other parts of the code as needed.",
+ "params": [
+ {
+ "name": "username",
+ "type_name": "String",
+ "description": "new value to be assigned to the instance variable `username`.",
+ "complex_type": false
+ }
+ ],
+ "usage": {
+ "language": "java",
+ "code": "UserLogin user = new UserLogin();\nuser.setUsername(\"simonmadine\");\n",
+ "description": "\nInputs: username - String"
+ },
+ "name": "setUsername",
+ "location": {
+ "start": 55,
+ "insert": 49,
+ "offset": " ",
+ "indent": 4,
+ "comment": {
+ "start": 48,
+ "end": 54
+ }
+ },
+ "item_type": "method",
+ "length": 3,
+ "docLength": 6
+ }
+ ]
+ }
+ }
+ }
+]
\ No newline at end of file
diff --git a/.komment/komment.json b/.komment/komment.json
new file mode 100644
index 0000000..dc99083
--- /dev/null
+++ b/.komment/komment.json
@@ -0,0 +1,54 @@
+{
+ "meta": {
+ "version": "1",
+ "updated_at": "2024-08-12T22:02:43.281Z",
+ "created_at": "2024-08-12T18:03:18.789Z",
+ "pipelines": [
+ "5290e9fb-b07e-4f3a-b1dc-ade204499fa5",
+ "6ce8c123-10dc-4848-87ac-c2fd538e4116",
+ "e3c5077a-79f2-4dd1-9c80-093fc7876e9c",
+ "586cd072-1664-40b6-a86b-eabc588d477a",
+ "7d927ab4-6aa0-44dd-9a21-5bba27f58a29",
+ "92451fc3-3e0e-44b7-ba54-9467bb091828",
+ "0a87801e-c9a0-4025-b165-54a14a406829",
+ "3e235bd1-bafe-4fc5-8d1d-927ea8b78489"
+ ]
+ },
+ "lookup": [
+ [
+ "client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java",
+ "client/src/main/java/io/sensable/client/component/FontFitTextView.java",
+ "client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java",
+ "client/src/main/java/io/sensable/client/SensorHelper.java",
+ "client/src/main/java/io/sensable/client/SensableUser.java",
+ "client/src/main/java/io/sensable/client/SensorListActivity.java",
+ "client/src/main/java/io/sensable/client/scheduler/BootReceiver.java",
+ "client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java",
+ "client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java",
+ "client/src/main/java/io/sensable/client/settings/Config.java",
+ "client/src/main/java/io/sensable/client/AboutActivity.java",
+ "client/src/main/java/io/sensable/client/CreateSensableFragment.java",
+ "client/src/main/java/io/sensable/client/MainActivity.java",
+ "client/src/main/java/io/sensable/client/SensableActivity.java",
+ "client/src/main/java/io/sensable/client/SensableLoginFragment.java",
+ "client/src/main/java/io/sensable/client/views/SensableListAdapter.java",
+ "client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java",
+ "client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java",
+ "client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java",
+ "client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java",
+ "client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java",
+ "client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java",
+ "client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java",
+ "client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java",
+ "library/src/main/java/io/sensable/SensableService.java",
+ "library/src/main/java/io/sensable/model/Sample.java",
+ "library/src/main/java/io/sensable/model/SampleResponse.java",
+ "library/src/main/java/io/sensable/model/SampleSender.java",
+ "library/src/main/java/io/sensable/model/ScheduledSensable.java",
+ "library/src/main/java/io/sensable/model/Sensable.java",
+ "library/src/main/java/io/sensable/model/Statistics.java",
+ "library/src/main/java/io/sensable/model/User.java",
+ "library/src/main/java/io/sensable/model/UserLogin.java"
+ ]
+ ]
+}
\ No newline at end of file
diff --git a/client/src/main/java/io/sensable/client/AboutActivity.java b/client/src/main/java/io/sensable/client/AboutActivity.java
index f87f2ab..dddf4f8 100644
--- a/client/src/main/java/io/sensable/client/AboutActivity.java
+++ b/client/src/main/java/io/sensable/client/AboutActivity.java
@@ -19,11 +19,27 @@
import java.text.DecimalFormat;
import java.text.NumberFormat;
+/**
+ * Displays information about the application, including a formatted text view and
+ * retrieves sample count from sensable.io via Rest API.
+ */
public class AboutActivity extends Activity {
private static final String TAG = AboutActivity.class.getSimpleName();
private TextView statistics;
+ /**
+ * Initializes the activity's layout and displays formatted text from a string resource,
+ * along with loading additional statistics.
+ *
+ * @param savedInstanceState bundle of information previously saved by the activity,
+ * allowing it to restore its state after being destroyed.
+ *
+ * Destructure `savedInstanceState` into its main properties:
+ * - `boolean isRestored`
+ * - `Bundle` `state`
+ * - `ClassLoader` `loader`
+ */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
diff --git a/client/src/main/java/io/sensable/client/CreateSensableFragment.java b/client/src/main/java/io/sensable/client/CreateSensableFragment.java
index 7409904..a31a0cc 100644
--- a/client/src/main/java/io/sensable/client/CreateSensableFragment.java
+++ b/client/src/main/java/io/sensable/client/CreateSensableFragment.java
@@ -34,10 +34,11 @@
/**
- * is responsible for creating and scheduling a sensory data object to be created by
- * the Sensable API. The fragment includes a spinner for selecting the sensor type,
- * a button for creating the scheduled sensory object, and a function for saving the
- * sensory data to the local bookmark after it has been created and scheduled.
+ * Manages the creation of new sensables and their scheduling for repeated execution
+ * at a later time. It sets up a UI with a spinner to select sensor types, a text
+ * field for inputting sensable IDs, and a button to create new sensables. Upon
+ * clicking the button, it creates a new ScheduledSensable object, schedules it, saves
+ * it locally, and displays a notification to the user.
*/
public class CreateSensableFragment extends DialogFragment {
@@ -50,7 +51,7 @@ public class CreateSensableFragment extends DialogFragment {
private CreateSensableListener createSensableListener;
/**
- * allows for listeners to receive notifications when a scheduled sensable is confirmed.
+ * Provides a notification callback for when a scheduled sensable is confirmed.
*/
public static interface CreateSensableListener {
public void onConfirmed(ScheduledSensable scheduledSensable);
@@ -60,73 +61,33 @@ public CreateSensableFragment() {
}
/**
- * inflates a layout, sets up a spinner to display sensor types, creates an EditText
- * for entering sensable ID, and adds a button listener for creating a new sensable.
- *
- * @param inflater inflater object that is used to inflate the layout for the fragment's
- * user interface.
- *
- * - `inflater`: An instance of the `LayoutInflater` class, which is used to inflate
- * layout files into views.
- * - `container`: A reference to a `ViewGroup` object that represents the parent
- * container for the view being created.
- * - `savedInstanceState`: A `Bundle` object that contains any saved state from a
- * previous activity session, or null if this is the first time the activity is being
- * created.
- *
- * @param container ViewGroup that will hold the created view.
- *
- * - `inflater`: The `LayoutInflater` object used to inflate the layout.
- * - `container`: A `ViewGroup` object that holds the views created by the `inflate`
- * method.
- * - `savedInstanceState`: A `Bundle` object containing any saved state from a
- * previous activity or fragment.
- *
- * The properties of the input `container` are not explicitly mentioned, as it is
- * assumed to be a standard `ViewGroup` with the usual properties and attributes.
- *
- * @param savedInstanceState saved state of the activity, including any data or values
- * that were previously stored and can be used to restore the activity's state when
- * it is recreated.
- *
- * - `getActivity()`: This is a reference to the activity that the fragment belongs
- * to.
- * - `getString(R.string.dialogTitleCreateSensable)`: This is a string resource ID
- * that represents the title of the dialog box.
- * - `sensorList`: This is a list of sensor objects that are returned by the
- * `getSensorList()` method of the `SensorManager`.
- * - `sensorSpinner`: This is a Spinner widget that displays a list of sensors
- * available on the device.
- * - `sensableId`: This is an EditText field where the user can enter the ID of the
- * sensable they want to create.
- * - `addListenerOnButton()`: This is a method that adds an listener to a button in
- * the layout.
- *
- * Note: The `savedInstanceState` object may contain additional properties or attributes
- * depending on how the fragment was saved and restored.
- *
- * @returns a layout with a spinner to select a sensor type and an edit text field
- * to enter the sensable ID.
- *
- * - `sensorManager`: A reference to the `SensorManager` object that provides access
- * to the sensors on the device.
- * - `sensorList`: A list of `Sensor` objects that represent the available sensors
- * on the device.
- * - `view`: The inflated view from the layout file specified in the `inflate()` method.
- * - `getDialog().setTitle()`: Sets the title of the dialog box displayed when the
- * user creates a new sensable.
- * - `listSensorType`: A list of sensor types that are available on the device.
- * - `sensorSpinner`: A Spinner component that allows the user to select a sensor
- * type from the list of available sensors.
- * - `sensableId`: An EditText field where the user can enter the ID of the newly
- * created sensable.
- * - `addListenerOnButton()`: Adds an event listener to a button on the screen to
- * handle button clicks.
- *
- * In summary, the `onCreateView` function returns a view that provides a user interface
- * for creating a new sensable, including a list of available sensors, an EditText
- * field for entering the ID of the sensable, and a button with an event listener to
- * handle button clicks.
+ * Inflates a layout and initializes UI components for creating a sensable entity,
+ * including a spinner listing all available sensors and an edit text field for
+ * entering a unique ID. It also sets up an adapter for the sensor spinner and adds
+ * an event listener to a button.
+ *
+ * @param inflater LayoutInflater object that inflates (or creates) the layout from
+ * the resource file R.layout.create_sensable_layout into a View object.
+ *
+ * Inflate. The inflater is an instance of LayoutInflater.
+ *
+ * @param container 2D ViewGroup that this new View is to be added to, and serves as
+ * the parent ViewGroup for the inflated layout.
+ *
+ * Passed as a `ViewGroup`, containing the view hierarchy to be inflated into.
+ *
+ * @param savedInstanceState Bundle object that contains the activity's previously
+ * frozen state from an earlier lifecycle, which is not utilized in this method.
+ *
+ * Bundle object containing the activity's state at the time that the user touches
+ * back button or presses Home key to save its state and restore later. It does not
+ * contain any specific information in this case.
+ *
+ * @returns a View object representing the create sensable layout.
+ *
+ * The output is a `View`, which represents the layout of the dialog. The view consists
+ * of a sensor spinner and an edit text field for creating sensable objects. It also
+ * contains a title set to "dialogTitleCreateSensable" from the string resource.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -155,44 +116,27 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}
/**
- * sets a reference to a `CreateSensableListener` object, which allows the caller to
- * receive notifications when sensory data is created.
- *
- * @param createSensableListener CreateSensableListener object that will receive
- * notifications when the sensors are created or removed.
- *
- * - This method sets the `createSensableListener` field of the current object to
- * the provided `CreateSensableListener` object.
- * - The `CreateSensableListener` class is a reference type that represents an object
- * with properties and methods related to creating sensational experiences.
- * - The `createSensableListener` field is of type `CreateSensableListener`, indicating
- * that it holds an instance of this class.
- * - The field can be accessed and modified through this method, allowing the object
- * to update its internal state based on the provided listener.
+ * Assigns a specified `CreateSensableListener` object to an instance variable,
+ * allowing other parts of the program to interact with it as needed. This enables
+ * event handling or notification mechanisms within the class. The assigned listener
+ * is responsible for responding to events triggered by this class.
+ *
+ * @param createSensableListener listener to be set for creating sensable entities,
+ * which is stored as an instance variable of the class.
*/
public void setCreateSensableListener(CreateSensableListener createSensableListener) {
this.createSensableListener = createSensableListener;
}
/**
- * schedules a sensable object for creation and bookmarking on the Sensable API, using
- * the sensor ID selected from the spinner and the last known location of the device.
- *
- * @param view View object that was clicked, and it is used to identify the specific
- * action to be taken based on the type of view that was clicked.
- *
- * - `sensableId`: A string containing the text entered by the user in the `Sensable
- * ID` field.
- * - `sensorSpinner`: An item from a spinner representing the sensor type selected
- * by the user.
- * - `lastKnownLocation`: The last known location of the device, represented as a
- * `Location` object.
- * - `getUserAccessToken()`: A method that returns an access token for the current
- * user.
- *
- * The function takes the input `view` and processes it accordingly to create a new
- * `Sensable` object, schedule it, save it in the database, and display a notification
- * to the user.
+ * Creates a new scheduled sensable object based on user input and schedules it using
+ * a listener, creates a bookmark for the sensable, and dismisses the fragment. It
+ * also handles Retrofit errors and displays error messages to the user.
+ *
+ * @param view View object that contains the submit button and sensor spinner, allowing
+ * the code to find and manipulate these views within the method.
+ *
+ * Find: `sensorSpinner`, `submitButton`.
*/
public void addListenerOnButton(View view) {
@@ -203,26 +147,20 @@ public void addListenerOnButton(View view) {
submitButton.setOnClickListener(new View.OnClickListener() {
/**
- * creates a new scheduled sensable object and sets its sensor ID to the same value
- * as the sensable object. It then schedules the sensable using a listener, creates
- * a bookmark for the sensable, and dismisses the fragment.
- *
- * @param v View that was clicked, providing the event trigger for the function to execute.
- *
- * - `sensableId`: The text value of the `sensableId` field in the layout.
- * - `sensorSpinner`: A reference to the `SensorSpinner` view in the layout.
- * - `getLocation()`: A method that returns the current location of the device, which
- * is used to create a bookmark for the scheduled sensable.
- * - `getUserAccessToken()`: A method that returns the access token for the user,
- * which is used to authenticate the API call to create the sensable.
- * - `restAdapter`: An instance of `RestAdapter` that builds the service client for
- * the Sensable API.
- * - `SensableService`: An interface for interacting with the Sensable API.
- * - `createSensableListener`: An instance of `CreateSensableListener` responsible
- * for handling the creation of the favorite bookmark.
- * - `scheduledSensable`: A `Sensable` object representing the scheduled sensable
- * that is to be created.
- * - `sensable`: A `Sensable` object representing the sensable that is being created.
+ * Creates a scheduled sensable object and schedules it, then creates a favorite
+ * bookmark. It retrieves sensor ID from spinner, location from last known location,
+ * and unit from SensorHelper. The function uses Retrofit to create the sensable
+ * object and schedule it.
+ *
+ * @param v View object that triggered the onClick event, which is not used in this
+ * function.
+ *
+ * View v - An object representing the View that was clicked. The main properties include:
+ *
+ * - getId(): Returns the unique integer ID of the view.
+ * - getClass(): Returns the runtime class of this Object.
+ * - hashCode(): Returns a hash code value for the object.
+ * - toString(): Returns a string representation of the object.
*/
@Override
public void onClick(View v) {
@@ -260,36 +198,22 @@ public void onClick(View v) {
service.createSensable(sensable, new Callback() {
/**
- * handles a callback from the service, which returns the canonical sensable ID. The
- * ID is set on the `sensable` and `scheduledSensable` objects before saving them,
- * and then a favorite bookmark is created for the scheduled sensable.
- *
- * @param sampleResponse response from the service call, which contains the canonical
- * sensable ID that is set to the corresponding object before saving and scheduling
- * it.
- *
- * - `getMessage()`: The callback message returned by the service.
- * - `sensableid`: The canonical sensable ID returned by the service, set in the
- * `success` function.
- * - `scheduledSensable`: A scheduled sensable object, which is created and set in
- * the `success` function.
- * - `createSensableListener`: An object that implements `OnConfirmed`, which is
- * called after scheduling the sensable.
- *
- * @param response response from the service, which contains the canonical sensable
- * ID that is used to set the sensor ID of the scheduled sensable and the favourite
- * bookmark.
- *
- * - `response`: The response object contains the result of the callback, including
- * the sensable ID in the `sensableid` attribute.
- * - `sampleResponse`: The deserialized response from the service, containing the
- * sensor ID in the `sensableid` attribute.
- * - `scheduledSensable`: A scheduled sensable object that will be created and saved
- * with the correct sensor ID.
- * - `createScheduledSensable()`: A function that creates a scheduled sensable object
- * and saves it along with the original sensable object.
- * - `createSensableListener()`: An object that will receive confirmation when the
- * scheduled sensable is created.
+ * Logs a callback success message and updates sensor IDs for two objects. It then
+ * schedules an object creation, notifies a listener about confirmation, and dismisses
+ * the current state.
+ *
+ * @param sampleResponse response returned by the service that contains the sensor
+ * ID and message, which is then used to set the sensor ID for the sensable objects
+ * and log the callback success.
+ *
+ * Get the message from the response and log it;
+ * Extract sensorid from sampleResponse.
+ *
+ * @param response response from the service call and is not used explicitly within
+ * the method.
+ *
+ * The `response` has no direct explanation, as it is not explicitly utilized within
+ * this method.
*/
@Override
public void success(SampleResponse sampleResponse, Response response) {
@@ -306,18 +230,11 @@ public void success(SampleResponse sampleResponse, Response response) {
}
/**
- * is called when a Retrofit error occurs during the creation of an object. It logs
- * the error message and displays a toast notification to the user indicating that
- * the object could not be created.
- *
- * @param retrofitError error message resulting from the failure of the Retrofit call.
- *
- * - `toString()` returns a human-readable string representation of the error object.
- * - `Log.e(TAG, "Callback failure: " + retrofitError.toString());` logs a message
- * with the error details to the Android LogCat.
- * - `Toast.makeText(getActivity(), "Could not create that Sensable",
- * Toast.LENGTH_SHORT).show();"` displays an informative message to the user via a
- * Toast notification.
+ * Handles an error occurred during a Retrofit request, logs the error and displays
+ * a toast message to the user with a failure message "Could not create that Sensable".
+ *
+ * @param retrofitError error that occurred during the Retrofit request and provides
+ * information about the failure.
*/
@Override
public void failure(RetrofitError retrofitError) {
@@ -337,24 +254,11 @@ public void failure(RetrofitError retrofitError) {
}
/**
- * retrieves and returns an access token for a user based on their saved login
- * credentials. If the user is logged in, it checks if they have an access token saved
- * and returns it, otherwise it returns an empty string.
- *
- * @returns a non-empty access token for a user who has been authenticated and has
- * an access token saved in the application's shared preferences.
- *
- * - `accessToken`: This is the access token retrieved from the shared preferences
- * file. It is a string variable that contains the access token for the user.
- * - `loggedIn`: This is a boolean variable that indicates whether the user is logged
- * in or not. If the user is logged in, the `accessToken` variable will be non-empty.
- * - `username`: This is the username of the user retrieved from the shared preferences
- * file. It is also a string variable.
- *
- * The function first checks if the user is logged in by checking the `loggedIn`
- * variable. If the user is not logged in, the function returns an empty string.
- * Otherwise, it retrieves the access token and username from the shared preferences
- * file using the `getString` method, and then returns the access token as a string.
+ * Retrieves a user's access token from shared preferences if they are logged in and
+ * have an existing token. If not, it returns an empty string. It logs debug messages
+ * for the preference file key, saved username, and access token to the console.
+ *
+ * @returns either an existing user's access token or an empty string.
*/
private String getUserAccessToken() {
SensableUser user = new SensableUser(getActivity().getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE), getActivity());
@@ -382,38 +286,22 @@ private String getUserAccessToken() {
/**
- * creates a scheduled entry for a sensable in a scheduler and saves it locally.
- *
- * @param scheduledSensable sensable that is to be added to the scheduler for repeated
- * execution at a later time.
- *
- * - `ScheduleHelper scheduleHelper`: A new instance of `ScheduleHelper`, created
- * with the current `Activity`.
- * - `addSensableToScheduler(scheduledSensable)`: An attempt to add the sensable to
- * the scheduler. Returns `false` if the addition fails.
- * - `startScheduler()`: Starts the scheduler, if it is not already running.
- * - `saveSensable(sensable)`: Tries to save the sensable to the local bookmark.
- * Returns `true` if the save succeeds.
- *
- * @param sensable sensable data that is to be scheduled and saved locally by the function.
- *
- * - `sensable`: This is an instance of the `Sensable` class, which has attributes
- * such as `id`, `type`, `name`, and `data`. These attributes are used to store
- * information about the sensory input.
- * - `ScheduleHelper`: This is an instance of a custom class called `ScheduleHelper`,
- * which provides utility methods for working with scheduling functionality in the activity.
- * - `addSensableToScheduler()`: This method is part of the `ScheduleHelper` class
- * and is used to add the `sensable` instance to the scheduler. It takes the
- * `scheduledSensable` instance as a parameter and adds it to the scheduler if successful.
- * - `startScheduler()`: This method is also part of the `ScheduleHelper` class and
- * is used to start the scheduler. It is called after adding the `sensable` instance
- * to the scheduler to ensure that the scheduler is running.
- * - `saveSensable(sensable)`: This method is used to save the `sensable` instance
- * to the activity's database. It returns `true` if the sensory input was saved
- * successfully, otherwise it returns `false`.
- *
- * @returns a boolean value indicating whether the scheduled sensable was successfully
- * created and added to the scheduler.
+ * Creates a scheduled entry for a given `sensable` object using an instance of
+ * `ScheduleHelper`. It adds the sensable to the scheduler, starts it if necessary,
+ * and saves a local bookmark to the sensable. The function returns a boolean indicating
+ * success or failure.
+ *
+ * @param scheduledSensable object that is being scheduled and added to the scheduler,
+ * facilitating the creation of a schedule entry.
+ *
+ * Has properties of type.
+ *
+ * @param sensable object that is being saved and added to the scheduler, which
+ * requires a corresponding local bookmark to be created.
+ *
+ * Deserialized and stored in a Sensable object, its main properties include:
+ *
+ * @returns a boolean value indicating success or failure.
*/
private boolean createScheduledSensable(ScheduledSensable scheduledSensable, Sensable sensable) {
ScheduleHelper scheduleHelper = new ScheduleHelper(getActivity());
@@ -434,25 +322,15 @@ private boolean createScheduledSensable(ScheduledSensable scheduledSensable, Sen
}
/**
- * Serializes a given `Sensable` object using the `SavedSensablesTable` class, inserts
- * its values into a SQLite database through the `ContentResolver`, and returns `true`
- * upon successful insertion.
- *
- * @param sensable Sensable object that contains the data to be saved in the SQLite
- * database.
- *
- * - `ContentValues`: This is an Android class that serializes data into a form
- * suitable for database storage. The input `mNewValues` is an instance of this class.
- * - `getActivity().getContentResolver()`: This method returns the content resolver
- * associated with the current activity, which is used to interact with the database.
- * - `insert()`: This method inserts new data into a database table. In this case,
- * it inserts the deserialized `sensable` data into the `SavedSensablesTable`.
- * - `Uri`: This is a type-safe identifier for a database table or view. The output
- * of the `insert()` method is a `Uri` object that represents the newly inserted row
- * in the database.
- *
- * @returns a boolean value indicating whether the sensable was successfully saved
- * to the database.
+ * Inserts a new Sensable object into the SQLite database using the ContentResolver's
+ * insert method. It serializes the Sensable object into ContentValues and then inserts
+ * these values into the user dictionary content URI, returning true upon successful
+ * insertion.
+ *
+ * @param sensable object that is being serialized and inserted into a SQLite database
+ * via the `ContentResolver` interface.
+ *
+ * @returns a boolean value indicating successful insertion of data into SQLite database.
*/
private boolean saveSensable(Sensable sensable) {
ContentValues mNewValues = SavedSensablesTable.serializeSensableForSqlLite(sensable);
@@ -465,12 +343,17 @@ private boolean saveSensable(Sensable sensable) {
}
/**
- * retrieves a sensor ID based on its name, searching a list of sensors and returning
- * -1 if the sensor is not found.
- *
- * @param sensorName name of the sensor for which the sensor ID is to be retrieved.
- *
- * @returns an integer representing the sensor ID of the chosen sensor.
+ * Retrieves an object representing a sensor from a list based on its name, and then
+ * returns the type of that sensor if found; otherwise, it returns -1. It iterates
+ * through the list to find a match for the given sensor name.
+ *
+ * @param sensorName name of the sensor to be searched for in the `sensorList`,
+ * allowing the function to retrieve its corresponding type.
+ *
+ * @returns an integer value representing the sensor type.
+ *
+ * The output is an integer value representing the sensor ID or -1 if no matching
+ * sensor name is found in the list.
*/
private int getSensorId(String sensorName) {
Sensor chosenSensor = null;
@@ -487,21 +370,10 @@ private int getSensorId(String sensorName) {
}
/**
- * retrieves the last known location of a device using the `LocationManager`. It
- * returns the obtained location.
- *
- * @returns a `Location` object containing the most recent location data from the
- * network provider.
- *
- * - The Location object represents the current location of the device, as determined
- * by the device's location providers.
- * - The `getLastKnownLocation` method returns the last known location of the device
- * for the specified provider.
- * - The `locationProvider` parameter is a string that identifies the location
- * provider to use for determining the location (e.g., `LocationManager.GPS_PROVIDER`).
- * - The returned Location object has various attributes, such as latitude, longitude,
- * altitude, and accuracy, which can be accessed through methods like `getLatitude()`,
- * `getLongitude()`, `getAltitude()`, and `getAccuracy()`.
+ * Retrieves the last known location from a network provider using a location manager,
+ * which is obtained through the activity's system service.
+ *
+ * @returns a `Location` object representing the last known location.
*/
private Location getLocation() {
LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
diff --git a/client/src/main/java/io/sensable/client/MainActivity.java b/client/src/main/java/io/sensable/client/MainActivity.java
index bdf3197..382e147 100644
--- a/client/src/main/java/io/sensable/client/MainActivity.java
+++ b/client/src/main/java/io/sensable/client/MainActivity.java
@@ -34,11 +34,10 @@
* Created by simonmadine on 19/07/2014.
*/
/**
- * in Android provides a framework for managing user interactions with sensors,
- * including login and create sensable functionality. The class implements the
- * ActionBar.TabListener interface to handle tab selection events and initializes
- * tabs using a TabsPagerAdapter. Additionally, it provides methods for handling
- * options menu items and action bar item clicks.
+ * Is an Android application that manages user login and sensable operations. It
+ * extends FragmentActivity and implements ActionBar.TabListener to handle tabs
+ * navigation. The class initializes a ViewPager and ActionBar, sets up a TabsPagerAdapter,
+ * and handles menu item selections for login, logout, create sensable, and about actions.
*/
public class MainActivity extends FragmentActivity implements ActionBar.TabListener {
@@ -56,27 +55,23 @@ public class MainActivity extends FragmentActivity implements ActionBar.TabListe
//define callback interface
/**
- * acts as a callback mechanism for receiving updates on the login status of a user
- * after they have logged in or out.
+ * Defines a method to update the login status and display a toast message based on
+ * whether the user is logged in or not.
*/
public interface CallbackInterface {
void loginStatusUpdate(Boolean loggedIn);
}
/**
- * sets up the user interface and initializes the SensableUser class, which manages
- * the user's login state. If the user is logged in, it displays a toast message;
- * otherwise, it displays another toast message.
- *
- * @param savedInstanceState saved state of the activity, which can be used to restore
- * the activity's state in case it is restarted or recreated.
- *
- * - `super.onCreate(savedInstanceState)` - Calls the superclass's `onCreate` method
- * to perform any necessary initialization before proceeding with the current method's
- * code.
- * - `setContentView(R.layout.main_activity)` - Sets the content view of the activity
- * to the R.layout.main_activity file, which is assumed to contain the main layout
- * and widgets for the activity.
+ * Initializes the main activity by setting its content view and retrieving shared
+ * preferences. It checks if a user is logged in, displaying a toast message accordingly.
+ * Finally, it calls the `initialiseTabs` method to set up the tabs.
+ *
+ * @param savedInstanceState Bundle object that contains the activity's previously
+ * saved state, allowing for restoration after rotation or other configuration changes.
+ *
+ * Bundle is an interface for classes that manage a set of key-value pairs. It provides
+ * methods to retrieve values by key and to associate values with keys.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -95,9 +90,9 @@ public void onCreate(Bundle savedInstanceState) {
}
/**
- * initializes a ViewPager and ActionBar, sets an adapter for the ViewPager, and adds
- * tabs to the ActionBar using a tab listener. When the user swipes the ViewPager,
- * the selected tab is updated in the ActionBar.
+ * Initializes a ViewPager and ActionBar with tabs, sets an adapter for the ViewPager,
+ * and sets up listeners for the ViewPager's page changes to update the selected tab
+ * in the ActionBar.
*/
private void initialiseTabs() {
// Initialization
@@ -120,11 +115,11 @@ private void initialiseTabs() {
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
/**
- * updates the selected item in the action bar based on the page number passed as an
- * argument.
- *
- * @param position 0-based index of the selected tab in the navigation menu, which
- * is used to set the selected tab in the action bar.
+ * Sets a navigation item as selected based on the provided position, typically used
+ * to update the action bar navigation after changing pages.
+ *
+ * @param position 0-based index of the selected item in the action bar's navigation
+ * items, used to select the corresponding tab.
*/
@Override
public void onPageSelected(int position) {
@@ -134,28 +129,28 @@ public void onPageSelected(int position) {
}
/**
- * is a callback method called when the user scrolls a web page. It receives the
- * current position of the scroll, the scrolling velocity, and the total scroll range
- * as arguments.
- *
- * @param arg0 current scroll position of the web page within the viewport.
- *
- * @param arg1 current scroll position of the view in fractional units, such as a
- * percentage of the total view size.
- *
- * @param arg2 current position of the scrollview, measured in pixels from the top
- * of the view.
+ * Is overridden to handle page scrolling events. It takes three arguments: the current
+ * page number, the scroll distance as a fraction of the total distance, and the
+ * scroll state (SCROLL_STATE_IDLE, SCROLL_STATE_TOUCH_SCROLL, or SCROLL_STATE_FLING).
+ *
+ * @param arg0 0-based index of the current page.
+ *
+ * @param arg1 fractional page offset from the start of the current page.
+ *
+ * @param arg2 x-coordinate of the view which is being scrolled horizontally.
*/
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
/**
- * is called when the scrolling state of a page changes, and it performs an unspecified
- * action in response.
- *
- * @param arg0 scroll state of the view pager, which is used to determine the appropriate
- * action to take in response to changes in the scroll position.
+ * Overrides a method to handle state changes of page scrolling. It is triggered when
+ * the scroll state of the current page changes, allowing for actions based on the
+ * new state. The function does not contain any specific implementation, leaving it
+ * empty.
+ *
+ * @param arg0 0-based index of the current scroll state, indicating whether the page
+ * is idle (0), scrolling (1), or at the top (2).
*/
@Override
public void onPageScrollStateChanged(int arg0) {
@@ -165,8 +160,10 @@ public void onPageScrollStateChanged(int arg0) {
}
/**
- * is a override of the superclass `onStart` method, indicating that it performs
- * additional actions beyond those of the parent class.
+ * Overrides the default onStart method inherited from its superclass. It ensures
+ * that the current object's lifecycle is properly initialized, and it calls the
+ * `super.onStart()` method to propagate the call up the inheritance chain. This
+ * function handles the start event of an application component.
*/
@Override
public void onStart() {
@@ -175,27 +172,12 @@ public void onStart() {
/**
- * is a method in Android that responds to changes in the device's configuration. It
- * is called when the device's screen orientation, display density, or other
- * configurations change. The method updates the UI and other components of the app
- * based on the new configuration.
- *
- * @param newConfig updated configuration of the device or environment that triggered
- * the `onConfigurationChanged()` method call, and it is passed to the superclass's
- * `onConfigurationChanged()` method for further processing.
- *
- * 1/ Screen orientation: The `newConfig` object contains information about the current
- * screen orientation, including whether it is portrait or landscape, and the specific
- * orientation (e.g., "portrait-primary").
- * 2/ Display metric: The `displayMetrics` property of `newConfig` provides information
- * about the display size and density, such as the width and height of the screen in
- * pixels, and the pixel density in dots per inch (dpi).
- * 3/ Resource IDs: The `resources` property of `newConfig` contains a list of resource
- * IDs that are associated with the configuration change. These resources may include
- * drawable icons, layout files, or other assets that are relevant to the new configuration.
- * 4/ Layout: The `layout` property of `newConfig` specifies the current layout of
- * the application, including the orientation and size of the screen, as well as any
- * additional layout parameters such as margins or gravity.
+ * Handles changes to the device's configuration, such as screen orientation or
+ * language settings. It calls the superclass's implementation and does not perform
+ * any specific actions.
+ *
+ * @param newConfig Configuration object that contains information about changes made
+ * to the device's screen configuration, such as orientation or language.
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
@@ -204,23 +186,14 @@ public void onConfigurationChanged(Configuration newConfig) {
/**
- * inflates a menu with options based on the logged-in status of the sensable user
- * and sets the visibility of those options accordingly.
- *
- * @param menu menu that will be inflated with additional items based on the logic
- * within the function.
- *
- * - `R.menu.saved_sensables`: The menu resource ID that contains the menu items to
- * be inflated.
- * - `R.id.action_login`: The resource ID of the login item in the menu.
- * - `R.id.action_logout`: The resource ID of the logout item in the menu.
- * - `R.id.action_create`: The resource ID of the create item in the menu.
- *
- * These properties are used to set the visibility of menu items based on the logged-in
- * status of the sensable user.
- *
- * @returns a menu with items for logging in, logging out, and creating new sensables,
- * depending on the user's logged-in status.
+ * Inflates a menu into an action bar, if present. It sets visibility for items based
+ * on user login status: login and logout buttons appear when the user is logged in
+ * or out, respectively; create button appears only when the user is logged in.
+ *
+ * @param menu action bar's menu that is being populated with items from the
+ * `R.menu.saved_sensables` resource.
+ *
+ * @returns a boolean value indicating whether options are successfully created.
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@@ -233,33 +206,18 @@ public boolean onCreateOptionsMenu(Menu menu) {
}
/**
- * handles menu item selections, such as opening the about screen or login dialog,
- * logging out, and creating a new sensable user. It calls parent class methods and
- * performs callback interface actions based on menu item IDs.
- *
- * @param item selected menu item and provides its item ID, which is used to determine
- * the appropriate action to take based on the selected item.
- *
- * - `id`: The unique identifier of the menu item, represented as an integer value.
- * - `item.getItemId()`: Returns the identifier of the menu item, which can be used
- * to determine its type and functionality.
- *
- * The `if` statement checks for specific values of `id`, and performs different
- * actions based on the selected menu item.
- *
- * @returns a handling of action bar item clicks, including launching an about dialog,
- * displaying a login dialog, logging out, and creating a new sensable.
- *
- * - `id`: This is an integer that represents the ID of the selected item in the
- * action bar. It takes on the value of the item's ID defined in the `android:id`
- * attribute in the `menu_item` XML file.
- * - `super.onOptionsItemSelected(item)`: This is a call to the superclass's
- * implementation of `onOptionsItemSelected`, which handles the default action for
- * the selected item.
- *
- * The output of the function is a boolean value indicating whether the action bar
- * item was handled successfully or not. If the item was handled, the method returns
- * `true`; otherwise, it returns `false`.
+ * Handles clicks on action bar items in a menu. It identifies the clicked item and
+ * performs corresponding actions, such as launching about dialog, logging out user,
+ * or creating sensable content. It also updates the login status and displays toast
+ * messages accordingly.
+ *
+ * @param item MenuItem that was clicked and triggered the onOptionsItemSelected
+ * method call.
+ *
+ * The item has an `id`, which is checked against specific IDs for different actions.
+ * The item does not have any other properties mentioned in this code snippet.
+ *
+ * @returns a boolean indicating whether the menu item was handled or not.
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@@ -274,13 +232,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
} else if (id == R.id.action_logout) {
sensableUser.deleteSavedUser(new CallbackInterface() {
/**
- * updates the login status and displays a toast message based on whether the user
- * is logged in or not, also invoking the `invalidateOptionsMenu()` method.
- *
- * @param loggedIn login status of the user, with a value of `true` indicating that
- * the user is logged in and `false` indicating otherwise.
- *
- * - `loggedIn`: A Boolean value indicating whether the user is logged in or not.
+ * Updates the login status and displays a corresponding toast message based on whether
+ * the user is logged in or out. If the user is not logged in, it shows a "Logged
+ * out" message; otherwise, it shows a "Logout failed" message.
+ *
+ * @param loggedIn status of user login, determining whether to display a "Logged
+ * out" or "Logout failed" toast message accordingly.
*/
@Override
public void loginStatusUpdate(Boolean loggedIn) {
@@ -299,7 +256,10 @@ public void loginStatusUpdate(Boolean loggedIn) {
}
/**
- * starts an activity called `AboutActivity`.
+ * Launches an instance of the `AboutActivity` class. It creates a new `Intent` object
+ * with the current context and specifies the target activity to be launched as
+ * `AboutActivity`. The function then starts the specified intent using the `startActivity`
+ * method.
*/
private void launchAbout() {
Intent intent = new Intent(this, AboutActivity.class);
@@ -310,40 +270,36 @@ private void launchAbout() {
* Called when the user clicks the Send button
*/
/**
- * creates a new instance of the `SensableLoginFragment` and sets a listener to handle
- * the login confirmation event. When the user confirms the login, the fragment's
- * listener calls the callback interface with the logged-in status, which in turn
- * updates the UI and invalidates the options menu.
+ * Initiates a login dialog for a user to log in with their credentials. It updates
+ * the UI and menu options based on the login status, displaying a toast message
+ * indicating success or failure of the login operation.
*/
public void loginDialog() {
FragmentManager fm = getFragmentManager();
SensableLoginFragment sensableLoginFragment = new SensableLoginFragment();
sensableLoginFragment.setSensableLoginListener(new SensableLoginFragment.SensableLoginListener() {
/**
- * is called when a user logs in successfully or fails to log in. It passes the login
- * status to the CallbackInterface, which updates the UI and invalidates the options
- * menu.
- *
- * @param userLogin user login details that are being confirmed.
- *
- * - `sensableUser`: A reference to an object of class `SensableUser`.
- * - `login`: A method that takes a `CallbackInterface` as its parameter and logs
- * in the user with the provided callback interface.
- * - `invalidateOptionsMenu`: A method that is called when the user's login status
- * changes, which is used to update the menu options accordingly.
+ * Updates the login status of a user and displays a toast message based on whether
+ * the login operation is successful or not. It invokes the `login` method with a
+ * callback interface, which triggers the `loginStatusUpdate` method to display success
+ * or failure messages accordingly.
+ *
+ * @param userLogin UserLogin object that contains login credentials, which is passed
+ * to the sensableUser for login processing.
+ *
+ * The object has a type and an ID property.
*/
@Override
public void onConfirmed(UserLogin userLogin) {
sensableUser.login(userLogin, new CallbackInterface() {
/**
- * updates the login status of a user and displays a toast message based on whether
- * the login was successful or not.
- *
- * @param loggedIn success of the login operation, with a value of `true` indicating
- * successful login and `false` indicating failed login.
- *
- * - `loggedIn`: A boolean value representing whether the user has successfully
- * logged in or not.
+ * Updates the login status by displaying a toast message indicating whether the login
+ * was successful or not. If logged in, it displays "Successfully logged In" and if
+ * failed, it displays "Login failed". It then calls the `invalidateOptionsMenu()`
+ * method to update the menu options.
+ *
+ * @param loggedIn boolean value indicating whether the login operation was successful
+ * or not.
*/
@Override
public void loginStatusUpdate(Boolean loggedIn) {
@@ -365,32 +321,27 @@ public void loginStatusUpdate(Boolean loggedIn) {
* Called when the user clicks the Create Sensable menu item
*/
/**
- * creates a fragment to display a scheduled sensable and sets up a listener for when
- * the sensable is confirmed. When the sensable is confirmed, it displays a toast
- * message with the sensable ID.
- *
- * @param view `View` object that contains the sensor ID to be confirmed and is used
- * to display the resulting sensor ID in a toast message.
- *
- * - `getFragmentManager()` returns the Fragment Manager instance for the current activity.
- * - `setCreateSensableListener()` sets a listener interface for the Create Sensable
- * fragment to receive updates from the sensor.
- * - `getSensorid()` returns the ID of the sensor that was created.
+ * Displays a fragment that allows user confirmation of scheduled sensing actions.
+ * When confirmed, it shows a toast message with the sensor ID using the `onConfirmed`
+ * method. The function uses the `FragmentManager` to display the fragment and sets
+ * a listener for confirmation events.
+ *
+ * @param view View that is hosting the method call and is not used within the method
+ * itself.
+ *
+ * View is an object representing the user interface element to be displayed in the
+ * activity. It does not have any specific properties mentioned in this code snippet.
*/
public void createSensable(View view) {
FragmentManager fm = getFragmentManager();
CreateSensableFragment createSensableFragment = new CreateSensableFragment();
createSensableFragment.setCreateSensableListener(new CreateSensableFragment.CreateSensableListener() {
/**
- * is called when a scheduled sensing action is confirmed. It displays a toast message
- * with the sensor ID.
- *
- * @param scheduledSensable sensor ID that will be displayed as a toast message when
- * the `onConfirmed()` method is called.
- *
- * - `scheduledSensable`: A `ScheduledSensable` object containing information about
- * the sensor and its scheduled time.
- * - `sensorid`: The unique identifier of the sensor.
+ * Displays a toast message on the main activity with the sensor ID retrieved from a
+ * `ScheduledSensable` object when a confirmation event occurs.
+ *
+ * @param scheduledSensable object that triggered the event and provides access to
+ * its sensor ID, which is then displayed as a toast message.
*/
@Override
public void onConfirmed(ScheduledSensable scheduledSensable) {
@@ -402,22 +353,17 @@ public void onConfirmed(ScheduledSensable scheduledSensable) {
/**
- * updates the current item displayed by a `ViewPager` when a tab is selected in an
- * `ActionBar`.
- *
- * @param tab selected tab that triggered the event, providing information about its
- * position within the tabs list.
- *
- * - `tab`: The selected tab object, containing properties such as its position
- * (`getPosition()`), and the name or label of the tab (`getTitle()`).
- *
- * @param ft FragmentTransaction object, which is used to manage the fragments displayed
- * by the ViewPager control.
- *
- * - `tab`: The selected tab object containing information about the current tab
- * selection, such as its position and title.
- * - `viewPager`: A reference to the view pager widget that displays fragments based
- * on the selected tab.
+ * Sets the current item of a `ViewPager` to the position corresponding to the selected
+ * tab, effectively displaying the associated fragment view. This function is triggered
+ * when a tab is selected. The selection is updated through the provided `ActionBar.Tab`
+ * and `FragmentTransaction`.
+ *
+ * @param tab selected tab from which this method is called, and its position is
+ * accessed through the `getPosition()` method to determine the corresponding fragment
+ * view.
+ *
+ * @param ft FragmentTransaction object that is used to commit the transaction and
+ * replace the current fragment with the new one.
*/
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
@@ -427,21 +373,17 @@ public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
}
/**
- * is called when a tab is unselected from an action bar. It does not perform any
- * specific task and is typically used for cleanup or customization purposes.
- *
- * @param tab Tab that was just selected or deselected, providing information about
- * its current state.
- *
- * - `tab`: The unselected tab for which the onTabUnselected method was called. It
- * has various attributes such as `getTag()`, `getTitle()`, and `getIcon()`.
- *
- * @param ft FragmentTransaction object that provides the necessary methods for
- * managing and updating the fragments associated with the action bar.
- *
- * - `tab`: Represents the tab that was unselected.
- * - `ft`: Stands for Fragment Transaction, which contains information regarding the
- * fragments involved in the transaction.
+ * Handles the event when a tab is unselected from an ActionBar. It is called when a
+ * different tab is selected, and it updates the related FragmentTransaction accordingly.
+ * The actual functionality within the function is empty, as it only overrides the
+ * default implementation.
+ *
+ * @param tab currently unselected action bar tab that is being updated or removed
+ * from the action bar.
+ *
+ * @param ft FragmentTransaction object that is responsible for managing the addition
+ * or removal of fragments from the activity's layout during the onTabUnselected
+ * method execution.
*/
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
@@ -449,19 +391,13 @@ public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
}
/**
- * is called when a previously selected tab is re-selected in the action bar. It has
- * no opemon functionality and simply ignores the event.
- *
- * @param tab Tab that was reselected.
- *
- * - `tab`: A `Tab` object that represents the tab being reselected. It has various
- * attributes such as its label, icon, and fragment.
- *
- * @param ft transaction that is being performed when the tab is reselected.
- *
- * - `tab`: The selected tab that triggered the event.
- * - `ft`: A fragment transaction object containing information about the fragments
- * involved in the transaction, such as their IDs and the current state of the fragments.
+ * Handles an event when a tab is reselected in an Android application's action bar.
+ * It receives the selected tab and a fragment transaction as parameters, indicating
+ * that the user has chosen to revisit the same tab.
+ *
+ * @param tab selected ActionBar Tab that is being reselected.
+ *
+ * @param ft fragment transaction to be used for replacing or adding fragments.
*/
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
diff --git a/client/src/main/java/io/sensable/client/SensableActivity.java b/client/src/main/java/io/sensable/client/SensableActivity.java
index 0b7eb47..b23faaa 100644
--- a/client/src/main/java/io/sensable/client/SensableActivity.java
+++ b/client/src/main/java/io/sensable/client/SensableActivity.java
@@ -36,14 +36,10 @@
/**
- * manages data display and sensory data saving for Android applications. It includes
- * functions like retrieving sensor data, preparing list data, updating user interface
- * components, calling the callback function when an API call fails, updating a
- * sensable object's fields and database, and updating a save button based on the
- * number of samples in the list. Additionally, it provides methods to update a sensory
- * device in a database by serializing and inserting it into the Sensables table using
- * content resolvers and to retrieve a sensor sender from a scheduled database through
- * the getContentResolver method.
+ * Is responsible for managing sensory data from a device and updating its corresponding
+ * views in an Android application. It fetches data from a REST API, updates the
+ * sensable object and view, and allows users to save or remove the sensable data
+ * from a local database.
*/
public class SensableActivity extends Activity {
@@ -68,24 +64,16 @@ public class SensableActivity extends Activity {
private ArrayList mSamples;
/**
- * sets up the UI for the sensable activity, including displaying a list of sensables
- * and their locations, and adding an button to save or unsave a sensable.
- *
- * @param savedInstanceState previous saved state of the activity, which can be used
- * to restore the activity's UI and data if it was launched from a different task or
- * process.
- *
- * * `sensable`: A `Sensable` object containing information about the sensable that
- * was saved previously. It has fields for `name`, `location`, `samples`, and `id`.
- * * `listDataHeader`: An array of headers representing the columns of data to be
- * displayed in the expandable list. Each header is a `String` object.
- * * `listDataChild`: An array of child objects representing the rows of data to be
- * displayed in the expandable list. Each child object is a `String` object.
- * * `localSender`: A `Cursor` object representing the local sender of the sensable.
- * It has fields for `id`, `name`, and `count`.
- *
- * Note that these properties are not necessarily present in every instance of the
- * `SensableActivity`, as they depend on the specific input data provided in `savedInstanceState`.
+ * Initializes a Sensable activity by setting up UI elements, retrieving data from
+ * intent and updating views. It also sets up buttons for saving, unfavouriting and
+ * deleting sensables, and handles their click events.
+ *
+ * @param savedInstanceState Bundle object that contains the data to be used when the
+ * activity is recreated, such as its previous state and data.
+ *
+ * Bundle object with data saved previously when the activity was paused or stopped.
+ * It contains key-value pairs where keys are strings and values can be any type of
+ * serializable objects (e.g., primitive types, arrays, lists).
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -127,15 +115,11 @@ protected void onCreate(Bundle savedInstanceState) {
favouriteButton.setOnClickListener(new View.OnClickListener() {
/**
- * saves unspecified data, likely crucial to the application's operation, using the
- * `saveThisSensable()` method.
- *
- * @param v view that was clicked, and it is passed to the `saveThisSensable()` method
- * as a way to trigger the saving of data.
- *
- * * `View v`: The object that was clicked.
- * * `saveThisSensable()`: A method that is called when the view is clicked, which
- * performs some action related to saving something sensable.
+ * Is overridden and triggered when a View is clicked. It calls the `saveThisSensable()`
+ * method, which saves or updates data related to sensory information. This action
+ * is performed when a user interacts with a GUI element.
+ *
+ * @param v View that was clicked, allowing the function to identify and respond accordingly.
*/
@Override
public void onClick(View v) {
@@ -145,17 +129,13 @@ public void onClick(View v) {
unFavouriteButton.setOnClickListener(new View.OnClickListener() {
/**
- * calls the `unsaveThisSensable()` method, which is not specified in the provided
- * code snippet. Therefore, the exact functionality of this function cannot be
- * determined with certainty.
- *
- * @param v button that was clicked and triggers the `unsaveThisSensable()` method
- * to perform its functionality.
- *
- * * `v`: This is an instance of the `View` class, which contains information about
- * the widget that was clicked.
- * * `unsaveThisSensable()`: This is a method that has been overridden in a subclass
- * and does not have any meaning on its own.
+ * Handles a click event on a View object, triggering an execution of the
+ * `unsaveThisSensable` method when invoked. This method appears to undo or reverse
+ * some action related to saving data or information that is considered sensible. The
+ * purpose of this functionality is unknown without further context.
+ *
+ * @param v View that triggered the click event, allowing the method to access and
+ * manipulate the view's properties or actions.
*/
@Override
public void onClick(View v) {
@@ -169,23 +149,15 @@ public void onClick(View v) {
deleteLocal.setVisibility(View.VISIBLE);
deleteLocal.setOnClickListener(new View.OnClickListener() {
/**
- * builds an alert dialog asking if the user wants to stop sampling a sensable. It
- * removes the sensable from the scheduler and makes the delete local button invisible
- * when the positive button is clicked, or cancels the dialog when the negative button
- * is clicked.
- *
- * @param v view that was clicked, and it is used to identify which button was pressed
- * within the dialog box.
- *
- * * `v`: This is the View object that triggered the `onClick` method. It represents
- * the button that was clicked by the user.
- * * `DialogInterface dialog`: This is an Android Dialog Interface object that contains
- * information about the button that was clicked within the dialog. The `dialog`
- * parameter is passed as a reference to the `onClick` method, allowing for easy
- * access to its properties and methods.
- * * `which`: This is an integer value representing the button that was clicked within
- * the dialog. It can take on values between 0 and -1, with 0 indicating the positive
- * button and -1 indicating the negative button.
+ * Creates a confirmation dialog to stop sampling with a sensable when a button is
+ * clicked. If the user confirms, it removes the sensable from the scheduler and hides
+ * a delete local view; otherwise, it cancels the dialog. A toast message indicates
+ * "Sensable stopped" after removal.
+ *
+ * @param v View that was clicked, triggering the execution of the function's code.
+ *
+ * View: The primary class for working with views and view hierarchies.
+ * Has no other main properties.
*/
@Override
public void onClick(View v) {
@@ -195,17 +167,15 @@ public void onClick(View v) {
builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
/**
- * removes a sensable from a scheduler when the button is clicked.
- *
- * @param dialog dialog window that triggered the event and whose options should be
- * processed by the function.
- *
- * * `dialog`: A DialogInterface object representing the click event.
- * * `which`: An integer value representing the position of the click event within
- * the dialog (optional).
- *
- * @param which button index that was clicked and is used to identify the specific
- * sensable to be removed from the scheduler.
+ * Stops a sensable by removing it from a scheduler and hiding a delete button. It
+ * shows a toast message indicating the successful stop. The function uses a helper
+ * class, a table to retrieve scheduled sensables, and a cursor to access local data.
+ *
+ * @param dialog DialogInterface that triggered the execution of this code when an
+ * item is selected from its list.
+ *
+ * @param which 0-based index of the item that was clicked or selected from a list
+ * of items displayed by a DialogFragment.
*/
public void onClick(DialogInterface dialog, int which) {
ScheduleHelper scheduleHelper = new ScheduleHelper(SensableActivity.this);
@@ -220,16 +190,15 @@ public void onClick(DialogInterface dialog, int which) {
builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
/**
- * cancels a dialog box when the user clicks on it.
- *
- * @param dialog cancelled dialog box that the function is called on.
- *
- * * `dialog`: This is an instance of the `DialogInterface` class, which represents
- * a dialog box or other UI component that can be shown to the user.
- * * `which`: This is an integer value representing the position of the button in the
- * dialog box that was clicked.
- *
- * @param which event that triggered the cancelation of the dialog.
+ * Cancels a dialog when an event occurs. It receives a `DialogInterface` and an
+ * integer representing the selected item as parameters. When called, it immediately
+ * stops the execution of the dialog's remaining tasks.
+ *
+ * @param dialog DialogInterface that initiated the callback, allowing the function
+ * to interact with it and cancel its instance.
+ *
+ * @param which 0-based index of the selected item from the DialogInterface if it's
+ * a ListView or Spinner, but it is not used in this specific implementation.
*/
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
@@ -247,9 +216,10 @@ public void onClick(DialogInterface dialog, int which) {
}
/**
- * sets up a REST API client to fetch sensory data from a server, and calls the
- * `getSensorData` method to retrieve the data. It then updates the `sensable` object
- * and related views with the obtained data.
+ * Initializes a REST adapter to interact with a Sensable service and makes a request
+ * for sensor data using the provided sensor ID. On successful response, it updates
+ * a Sensable object and a view component; otherwise, logs an error message if a
+ * Retrofit error occurs.
*/
@Override
public void onStart() {
@@ -263,24 +233,15 @@ public void onStart() {
service.getSensorData(sensable.getSensorid(), new Callback() {
/**
- * updates a sensable object and a view after a callback success response.
- *
- * @param sensable sensory data received from the device and is updated in the
- * `updateSensable()` and `updateView()` methods.
- *
- * * `Log.d(TAG, "Callback Success - Sensable");`: This line logs a message to the
- * console with the tag `TAG`.
- * * `updateSensable(sensable);`: This line updates the `sensable` object with some
- * changes made to its properties or attributes.
- * * `updateView(sensable);`: This line updates the view by applying changes to the
- * `sensable` object.
- *
- * @param response response from the API call, which is used to update the sensable
- * and view components in the application.
- *
- * * `sensable`: A `Sensable` object, representing the user's input.
- * * `response`: A JSON response from the server, containing the user's input and
- * other data.
+ * Processes a successful callback by logging a message, updating the `sensable`
+ * object through `updateSensable`, and refreshing the view with `updateView`. This
+ * implies that it handles a response from an asynchronous operation or API call successfully.
+ *
+ * @param sensable object being updated by the function, which is then used to trigger
+ * updates in both the UI and the data model.
+ *
+ * @param response response received from the server after a successful operation and
+ * is not utilized within the method.
*/
@Override
public void success(Sensable sensable, Response response) {
@@ -290,13 +251,13 @@ public void success(Sensable sensable, Response response) {
}
/**
- * is called when a Retrofit error occurs during callback processing. It logs an error
- * message with the RetrofitError object's toString() value and its TAG.
- *
- * @param retrofitError error that occurred during the callback process and is logged
- * along with its message using the `Log.e()` method.
- *
- * * `toString()` returns a string representation of the error object.
+ * Handles errors occurred during a Retrofit request and logs the error message with
+ * the specified tag `TAG`. It takes a `RetrofitError` object as a parameter, which
+ * contains information about the failure. The function logs the error message to the
+ * Android logcat for debugging purposes.
+ *
+ * @param retrofitError error that occurred during the execution of the Retrofit API
+ * request and is passed to the callback method for processing.
*/
@Override
public void failure(RetrofitError retrofitError) {
@@ -306,24 +267,17 @@ public void failure(RetrofitError retrofitError) {
}
/**
- * updates the view by setting the sensor ID, unit, and location to the corresponding
- * values from a `Sensable` object, clears any existing samples, adds the samples
- * from the `Sensable` object to a list, and notifies the adapter of the changes.
- *
- * @param sensable sensory data to be displayed in the UI, which includes the sensor
- * ID, unit, and location information.
- *
- * * `sensableId`: A text field that displays the sensor ID of `sensable`.
- * * `sensableUnit`: A text field that displays the unit of measurement for `sensable`.
- * * `sensableLocation`: A text field that displays the location of `sensable` in a
- * comma-separated format (longitude, latitude).
- * * `mSamples`: A List object that stores the samples of `sensable`.
- * * `mExpandableListAdapter`: An adapter object for an expandable list view that is
- * used to display the samples of `sensable`.
- * * `prepareListData()`: This method prepares the data to be displayed in the
- * expandable list view by adding the samples of `sensable` to a List.
- * * `updateSaveButton()`: This method updates the state of a button in the UI to
- * reflect whether the data has been saved successfully or not.
+ * Updates the GUI components by setting text fields with sensor ID, unit, and location
+ * information from a given `Sensable` object. It also clears and replenishes a list
+ * of samples, notifies the adapter to update the list, and triggers another method
+ * to update a save button.
+ *
+ * @param sensable object whose properties are updated and displayed in the view,
+ * providing sensor ID, unit, location, and sample data.
+ *
+ * Get sensor ID, unit and location from sensable object.
+ * Sensable contains array of samples which is cleared, updated and then notified to
+ * adapter.
*/
public void updateView(Sensable sensable) {
@@ -341,20 +295,14 @@ public void updateView(Sensable sensable) {
}
/**
- * updates a sensable object's fields with values from the provided sensable object,
- * then saves the updated object to the database.
- *
- * @param sensable sensory data to be updated, and its properties are copied to the
- * corresponding fields of the `Sensable` object.
- *
- * * `name`: A string property representing the name of the sensable device.
- * * `sensorid`: An integer property representing the unique identifier of the sensable
- * device.
- * * `location`: A string property representing the location of the sensable device.
- * * `sensortype`: An integer property representing the type of sensable device.
- * * `samples`: An array of data samples represented as a list of floating-point numbers.
- * * `unit`: A string property representing the unit of measurement for the sensable
- * device.
+ * Updates an object's properties. It sets the name, sensor ID, location, sensor type,
+ * samples, and unit of a `Sensable` object based on the provided parameters. The
+ * updated object is then stored in the database using the `updateSensableInDatabase`
+ * method.
+ *
+ * @param sensable object to be updated, whose properties such as name, sensor ID,
+ * location, sensor type, samples, and unit are copied into the corresponding fields
+ * of the class instance.
*/
private void updateSensable(Sensable sensable) {
this.sensable.setName(sensable.getName());
@@ -368,9 +316,9 @@ private void updateSensable(Sensable sensable) {
/**
- * saves a sensable data to local storage or database, depending on whether it has
- * been saved previously. It first checks if the sensable has been saved locally and
- * then inserts it into the database if not saved before.
+ * Inserts a sensable object into the SQLite database if it has not been saved locally.
+ * It uses a ContentValues object to store the data and the getContentResolver's
+ * insert method to execute the insertion.
*/
private void saveThisSensable() {
savedLocally = checkSavedLocally();
@@ -389,12 +337,11 @@ private void saveThisSensable() {
}
/**
- * updates a sensable data in the database by checking if it was saved locally,
- * serializing it for SQL Lite, and then updating the content URI with the new values.
- * It returns true if at least one row was updated or false otherwise.
- *
- * @returns a boolean value indicating whether the sensable data was successfully
- * updated in the database.
+ * Updates a sensable's information in the database by checking if it is saved locally,
+ * serializing it for SQLite, and then updating the corresponding database rows using
+ * the content resolver.
+ *
+ * @returns a boolean value indicating successful update or failure.
*/
private boolean updateSensableInDatabase() {
savedLocally = checkSavedLocally();
@@ -414,8 +361,9 @@ private boolean updateSensableInDatabase() {
}
/**
- * deletes rows from a local database based on a check of whether the data was saved
- * locally or not, and updates a save button accordingly.
+ * Checks if data is already saved locally and, if so, deletes it from a database
+ * using a Uri object. It updates the state of the `savedLocally` variable based on
+ * the deletion result and triggers an update to the save button's state accordingly.
*/
private void unsaveThisSensable() {
// Defines a new Uri object that receives the result of the insertion
@@ -430,19 +378,11 @@ private void unsaveThisSensable() {
}
/**
- * queries the local database using a `ContentResolver` and counts the number of rows
- * returned. If the count is greater than zero, the function returns `true`.
- *
- * @returns a boolean value indicating whether any data is saved locally.
- *
- * * The function returns a boolean value indicating whether any data is saved locally
- * in the database.
- * * The count returned by the `getCount()` method of the `Cursor` object represents
- * the number of rows in the result set.
- * * The `getContentResolver()` method is used to query the database, and the `new
- * String[]{"*"}` argument specifies that all columns are needed in the result set.
- * * The `null` arguments for the `where` and `groupby` methods indicate that no
- * filtering or grouping is performed on the data.
+ * Queries a database using a cursor to retrieve the number of rows stored locally.
+ * It then checks if the retrieved count is greater than zero, returning a boolean
+ * indicating whether data has been saved locally.
+ *
+ * @returns a boolean value indicating database presence.
*/
private boolean checkSavedLocally() {
Cursor count = getContentResolver().query(getDatabaseUri(), new String[]{"*"}, null, null, null, null);
@@ -450,14 +390,11 @@ private boolean checkSavedLocally() {
}
/**
- * retrieves a Cursor object containing data from a scheduled database using a query
- * executed by the device's content resolver.
- *
- * @returns a cursor object containing data from a query on the scheduled database.
- *
- * The Cursor object returned by the function represents the results of querying the
- * scheduled database with the specified criteria. The cursor contains information
- * about the sender objects in the database, including their ID, name, and status.
+ * Queries a database using its content resolver and returns a cursor containing data
+ * from the specified URI. The query retrieves all records (`"*"`) without any filtering
+ * conditions or sorting.
+ *
+ * @returns a cursor object that queries scheduled database.
*/
private Cursor getSensableSender() {
Cursor count = getContentResolver().query(getScheduledDatabaseUri(), new String[]{"*"}, null, null, null, null);
@@ -466,44 +403,22 @@ private Cursor getSensableSender() {
// Returns the DB URI for this sensable
/**
- * parses a URI string to obtain a database connection for Sensable content provider.
- *
- * @returns a Uri object representing a content provider entry point for a specific
- * sensor ID.
- *
- * * `Uri.parse(SensableContentProvider.CONTENT_URI + "/" + sensable.getSensorid())`:
- * This returns a Uri object representing the database location for the given sensor
- * ID. The Uri object has various attributes such as scheme, authority, path, and query.
- * * Scheme: The scheme of the Uri object represents the protocol used to access the
- * database, which is typically "content".
- * * Authority: The authority component of the Uri object specifies the domain name
- * or IP address of the server hosting the database.
- * * Path: The path component of the Uri object specifies the location within the
- * server where the database is stored. In this case, it is "/" + sensable.getSensorid(),
- * which represents the specific sensor ID for which the database is being retrieved.
- * * Query: The query component of the Uri object can contain additional information
- * such as filters or sorting criteria used to narrow down the data retrieved from
- * the database. However, in this case, there are no query parameters provided.
+ * Parses a uniform resource identifier (URI) by concatenating a constant URI string
+ * with a sensor ID retrieved from the `sensable` object, forming a database URI for
+ * specific sensor data retrieval.
+ *
+ * @returns a parsed URI for accessing a specific sensor's data.
*/
private Uri getDatabaseUri() {
return Uri.parse(SensableContentProvider.CONTENT_URI + "/" + sensable.getSensorid());
}
/**
- * parses a Uri based on a content provider and sensor ID to return a scheduled
- * database Uri.
- *
- * @returns a Uri object representing the scheduled database location for a specific
- * sensor ID.
- *
- * * The output is a `Uri` object representing a database URL.
- * * The `Uri.parse()` method is used to create the `Uri` object from a string
- * representation of the database URL.
- * * The string representation consists of the `ScheduledSensableContentProvider.CONTENT_URI`
- * scheme and path, followed by the sensor ID as a String.
- *
- * The ` Uri` object represents a database URL that can be used to access the sensory
- * data stored in the database.
+ * Parses a URI to retrieve data from a scheduled database, combining a predefined
+ * constant URI with a sensor ID obtained from an object called `sensable`. The
+ * resulting URI is then returned as a Uri object.
+ *
+ * @returns a parsed URI combining CONTENT_URI and sensor ID.
*/
private Uri getScheduledDatabaseUri() {
return Uri.parse(ScheduledSensableContentProvider.CONTENT_URI + "/" + sensable.getSensorid());
@@ -511,8 +426,9 @@ private Uri getScheduledDatabaseUri() {
/**
- * determines the visibility of two buttons based on whether a location is saved
- * locally or not, hiding one button and showing the other.
+ * Toggles the visibility of two buttons based on a boolean flag `savedLocally`. If
+ * `savedLocally` is true, it hides the favourite button and shows the unFavourite
+ * button. Otherwise, it shows the favourite button and hides the unFavourite button.
*/
public void updateSaveButton() {
if (savedLocally) {
@@ -528,9 +444,9 @@ public void updateSaveButton() {
* Preparing the list data
*/
/**
- * prepares a list of data by reversing the order of sample timestamps, sorting them
- * based on their timestamps, and then adding the samples to a new list with headers
- * and child data.
+ * Sorts a list of samples based on their timestamps and groups them by day. It then
+ * creates a hierarchical data structure to store the grouped samples, with each
+ * group's header representing the date.
*/
private void prepareListData() {
listDataHeader.clear();//
@@ -539,22 +455,17 @@ private void prepareListData() {
// Reverse the order of samples so they are by timestamp desc
Collections.sort(mSamples, new Comparator() {
/**
- * compares two `Sample` objects based on their timestamps, returning an integer value
- * indicating the difference between the two timestamps.
- *
- * @param a 1st sample being compared to the 2nd sample `b`.
- *
- * * `a` is a `Sample` object containing attributes such as `timestamp`, which is a
- * long value representing the time of creation of the sample.
- *
- * @param b 2nd sample object to be compared with the `a` parameter, and its `timestamp`
- * field is used for the comparison.
- *
- * * `getTimestamp()`: returns the timestamp value in milliseconds since the epoch
- * (January 1, 1970, 00:00:00 GMT) for object `b`.
- *
- * @returns an integer value representing the difference between the timestamps of
- * the two input samples.
+ * Returns an integer value representing the difference between the timestamps of two
+ * `Sample` objects, with a larger value indicating that the second object has an
+ * earlier timestamp. The comparison is done by subtracting the first object's timestamp
+ * from the second object's timestamp.
+ *
+ * @param a first `Sample` object to be compared with the second `Sample` object `b`.
+ *
+ * @param b second object being compared to the first object `a`, with its timestamp
+ * subtracted from `a`'s timestamp to determine the comparison result.
+ *
+ * @returns an integer representing the timestamp difference between two samples.
*/
@Override
public int compare(Sample a, Sample b) {
diff --git a/client/src/main/java/io/sensable/client/SensableLoginFragment.java b/client/src/main/java/io/sensable/client/SensableLoginFragment.java
index 3170bd6..f201882 100644
--- a/client/src/main/java/io/sensable/client/SensableLoginFragment.java
+++ b/client/src/main/java/io/sensable/client/SensableLoginFragment.java
@@ -14,11 +14,10 @@
* Created by madine on 01/07/14.
*/
/**
- * is a custom Dialog Fragment that allows users to log in to a sensable system. It
+ * Is a custom Dialog Fragment that allows users to log in to a sensable system. It
* has an EditText field for username and password, and a submit button that triggers
- * an listener when clicked. The listener can be set using the setSensableLoginListener
- * method, which will call the onConfirmed method of the listener when the login is
- * confirmed.
+ * the login process when clicked. The fragment also provides an interface for receiving
+ * confirmed UserLogin objects.
*/
public class SensableLoginFragment extends DialogFragment {
@@ -28,7 +27,7 @@ public class SensableLoginFragment extends DialogFragment {
private SensableLoginListener sensableLoginListener;
/**
- * defines a method for receiving confirmed UserLogin objects.
+ * Defines a method to receive confirmed UserLogin objects from login operations.
*/
public static interface SensableLoginListener {
public void onConfirmed(UserLogin userLogin);
@@ -38,56 +37,35 @@ public SensableLoginFragment() {
}
/**
- * inflates a layout, sets the dialog title, and adds an event listener to a button.
- *
- * @param inflater inflation tool that is used to inflate the layout from the resource
- * file.
- *
- * - `inflater`: An instance of the `LayoutInflater` class, which provides a way to
- * inflate layouts from XML files into Android views.
- * - `view`: The View object that is being inflated and modified.
- * - `container`: The parent ViewGroup that will hold the newly inflated view.
- * - `savedInstanceState`: A Bundle object that contains any saved state information
- * about the fragment, which can be used to restore the state of the view when the
- * fragment is re-created.
- *
- * In this function, the `inflater` instance is not modified or destroyed, as it is
- * a required parameter for the `onCreateView` method.
- *
- * @param container parent view group that will contain the inflated layout.
- *
- * - `inflater`: The `LayoutInflater` object used to inflate the layout of the view.
- * - `savedInstanceState`: A `Bundle` object containing any saved state from a
- * previous instance of the view.
- * - `container`: The parent view group that contains the view being created. It can
- * be used to access its properties and attributes, such as size, position, and visibility.
- *
- * @param savedInstanceState saved state of the activity, which can be used to restore
- * the view and its components if the activity is recreated due to a configuration
- * change or app restart.
- *
- * - `R.id.login_username_field`: An ID resource identifier for an EditText view.
- * - `R.id.login_password_field`: An ID resource identifier for an EditText view.
- * - `getActivity().getString(R.string.dialogTitleSensableLogin)`: The title of the
- * dialog shown when the user clicks on the login button.
- *
- * @returns a View object representing the layout for the login screen.
- *
- * - `View view`: This is the inflated layout for the login screen, which contains
- * several elements such as text fields for entering username and password, and a
- * button to initiate the login process.
- * - `getDialog().setTitle(getActivity().getString(R.string.dialogTitleSensableLogin))`:
- * This sets the title of the dialog window to "Sensable Login".
- * - `loginUsername = (EditText) view.findViewById(R.id.login_username_field)`: This
- * assigns a reference to an EditText field in the layout for entering the username.
- * - `loginPassword = (EditText) view.findViewById(R.id.login_password_field)`: This
- * assigns a reference to another EditText field in the layout for entering the password.
- * - `addListenerOnButton(view)`: This adds an listener to a button in the layout,
- * which will be triggered when clicked.
- *
- * Overall, the `onCreateView` function is responsible for creating and inflating the
- * layout for the login screen, setting the title of the dialog window, and adding
- * listeners to the login fields and button.
+ * Inflates a layout, sets a title to the dialog, finds and initializes UI components
+ * such as EditTexts for username and password fields, and adds an event listener to
+ * a button. It returns the inflated view.
+ *
+ * @param inflater LayoutInflater object that is used to inflate or load the layout
+ * resource file into a View object.
+ *
+ * Inflate an instance of type layout from the given resource. It uses null as a root
+ * view, and attach to the parent ViewGroup if flag is specified. The inflater is
+ * used for inflating layouts and views.
+ *
+ * @param container 2D ViewGroup that this view is to be added to, and it is used by
+ * LayoutInflater to set the parent of the inflated view.
+ *
+ * Is null or zero-sized if the parent view group is an invalid type.
+ * Has layout parameters set to wrap its content.
+ * Is passed as part of the inflate method's arguments.
+ *
+ * @param savedInstanceState bundle of data previously saved by onSaveInstanceState
+ * and is not used in this function.
+ *
+ * Bundle object containing saved key-value pairs. Bundle stores data that can be
+ * saved across process death.
+ *
+ * @returns a view of the sensable login layout.
+ *
+ * The returned object is a View, which represents a UI component in Android's layout
+ * hierarchy. The View is inflated from the sensable_login_layout resource and has
+ * two child views: an EditText for login username and another EditText for login password.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -104,17 +82,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}
/**
- * sets a reference to an instance of `SensableLoginListener`. This listener will
- * receive events related to login functionality.
- *
- * @param sensableLoginListener listener for authentication events, allowing the
- * method to assign and manage the listener object for further processing.
- *
- * - This object's `sensableLoginListener` attribute or property is set to the
- * provided value.
- *
- * The `sensableLoginListener` field or property is set to the specified value in
- * this method.
+ * Establishes a connection between an object and its login listener, storing the
+ * listener in the `sensableLoginListener` field for potential future use. This enables
+ * the object to notify the listener when certain login-related events occur. The
+ * function sets the listener without any validation or processing.
+ *
+ * @param sensableLoginListener listener that is assigned to handle login-related events.
*/
public void setSensableLoginListener(SensableLoginListener sensableLoginListener) {
this.sensableLoginListener = sensableLoginListener;
@@ -122,23 +95,17 @@ public void setSensableLoginListener(SensableLoginListener sensableLoginListener
/**
- * sets an event listener on a `Button` element in an Android activity, which upon
- * click will check if the login username and password fields have content and pass
- * the values to a `UserLogin` object. If both fields are empty, it displays a Toast
- * message.
- *
- * @param view button that was clicked, and is used to obtain the Button object that
- * is being passed as an argument to the `OnClickListener`.
- *
- * 1/ `submitButton`: The `Button` object found by calling `findViewById(R.id.login_submit_button)`.
- * 2/ `OnClickListener`: The `OnClickListener` interface implemented by a reference
- * to an anonymous inner class that contains the `onClick()` method.
- * 3/ `onClick()`: An instance method of the anonymous inner class that is called
- * when the button is clicked. It performs the following actions:
- * - Checks if the `loginUsername` and `loginPassword` fields have valid text content.
- * - Creates a new `UserLogin` object with the values of `loginUsername` and `loginPassword`.
- * - Calls the `onConfirmed()` method of the `sensableLoginListener` object.
- * - Dismisses the current `DialogFragment` instance.
+ * Sets a click listener for a submit button, verifying if login credentials are
+ * provided. If valid, it creates a `UserLogin` object and passes it to a listener,
+ * then dismisses the dialog. If invalid, it displays a toast message requiring
+ * username and password.
+ *
+ * @param view view that was clicked, which is then used to find the submit button
+ * within it by calling `findViewById(R.id.login_submit_button)`.
+ *
+ * View represents a base class for widgets and other graphical user interface
+ * components. It implements the Component interface to provide methods for handling
+ * events such as clicks, touches, and other gestures.
*/
public void addListenerOnButton(View view) {
@@ -147,16 +114,11 @@ public void addListenerOnButton(View view) {
submitButton.setOnClickListener(new View.OnClickListener() {
/**
- * verifies if the login credentials are provided, then it passes the login information
- * to a listener and dismisses the dialog.
- *
- * @param v view that was clicked, and is passed to the function as an argument when
- * the button is pressed.
- *
- * - `v`: A `View` object that represents the button clicked to initiate the login
- * process.
- * - `loginUsername`: A `EditText` field containing the user's login username.
- * - `loginPassword`: A `EditText` field containing the user's login password.
+ * Triggers when a view is clicked. It checks if username and password are provided,
+ * then creates a `UserLogin` object with the input data, notifies the listener, and
+ * dismisses the dialog if valid; otherwise, it displays an error message.
+ *
+ * @param v View that was clicked, triggering the execution of the `onClick` method.
*/
@Override
public void onClick(View v) {
diff --git a/client/src/main/java/io/sensable/client/SensableUser.java b/client/src/main/java/io/sensable/client/SensableUser.java
index 4b8bbf9..c38e9b3 100644
--- a/client/src/main/java/io/sensable/client/SensableUser.java
+++ b/client/src/main/java/io/sensable/client/SensableUser.java
@@ -19,10 +19,10 @@
* Created by simonmadine on 12/07/2014.
*/
/**
- * is responsible for handling user authentication and settings retrieval in an Android
+ * Is responsible for handling user authentication and settings retrieval in an Android
* application. It provides functions to login, logout, retrieve user settings, and
- * save the user's information to preferences. Additionally, it offers methods to
- * delete the saved user information and update the login status.
+ * save the user's information to preferences. The class also handles API calls using
+ * Retrofit and logs user activity through a tag named TAG.
*/
public class SensableUser {
@@ -57,10 +57,11 @@ public SensableUser(SharedPreferences sharedPreferences, Context context) {
}
/**
- * retrieves user information from shared preferences and sets it to a `User` object,
- * returning `true` if successful or `false` otherwise.
- *
- * @returns a boolean value indicating whether the user is logged in or not.
+ * Retrieves user data from shared preferences, including username, email, and access
+ * token, if available. It sets these values to a `mUser` object and returns a boolean
+ * indicating whether the read operation was successful or not.
+ *
+ * @returns a boolean value indicating successful login or failure.
*/
private boolean readUserFromPreferences() {
String username = sharedPreferences.getString(context.getString(R.string.saved_username), "");
@@ -85,78 +86,44 @@ private boolean readUserFromPreferences() {
}
/**
- * takes a `UserLogin` object and a `CallbackInterface` object as inputs, calls the
- * service's login method to authenticate the user, and updates the user's data and
- * saves it to preferences upon success.
- *
- * @param userLogin UserLogin object containing the login credentials of the user to
- * be authenticated.
- *
- * - `userLogin`: This is an instance of the `UserLogin` class, which contains
- * information about the user attempting to log in.
- * + `username`: The username of the user attempting to log in.
- * + `email`: The email address of the user attempting to log in.
- *
- * The function call is made to the `service` object's `login` method, passing in
- * `userLogin` and a callback interface `cb`. The callback interface has two methods:
- * `success` and `failure`.
- *
- * In the `success` method, if the login attempt is successful, the `User` object's
- * properties are set to the deserialized response data, including the `username` and
- * `email`. Additionally, the `loggedIn` flag is set to `true`, and the `accessToken`
- * property is set to the `accessToken` property of the `User` object. Finally, the
- * `saveUserToPreferences()` method is called to save the user's data to preferences.
- *
- * In the `failure` method, an error message is logged to the console if the login
- * attempt fails.
- *
- * @param cb `CallbackInterface` that will receive updates on the login status.
- *
- * The `CallbackInterface cb` is an interface with two methods: `loginStatusUpdate(loggedIn)`
- * and `failure(RetrofitError retrofitError)`. The `loginStatusUpdate` method is
- * invoked when the login callback is successful, and it takes a boolean parameter
- * `loggedIn` indicating whether the user is logged in or not. The `failure` method
- * is invoked when there is an error during the login process, and it takes a
- * `RetrofitError` object as its parameter.
+ * Authenticates a user by sending a request to the authentication service and receives
+ * a response containing the user's information and access token. It updates the
+ * user's preferences, notifies the login status update to the callback interface,
+ * and logs error messages for failures.
+ *
+ * @param userLogin login credentials to be passed to the authentication service for
+ * verification.
+ *
+ * - username: The username of the user.
+ * - password: The password of the user.
+ * - email: The email address of the user.
+ *
+ * @param cb CallbackInterface that notifies the login status update to the caller
+ * when the login operation is successful.
+ *
+ * CallbackInterface cb:
+ *
+ * - has a method loginStatusUpdate(loggedIn): It updates the login status to the caller.
*/
public void login(UserLogin userLogin, final MainActivity.CallbackInterface cb) {
service.login(userLogin, new Callback() {
/**
- * handles a successful login callback from the authentication service. It sets the
- * user's username, email, and access token (if available), updates the user's
- * preferences, and notifies the login status update to the callback interface.
- *
- * @param user login result, containing the user's username and email address.
- *
- * - `username`: The username of the user.
- * - `email`: The email address of the user.
- * - `accessToken`: An access token for the user.
- *
- * The `mUser` object is set to the deserialized `user` object, and various attributes
- * of `mUser` are updated. Additionally, a call to `saveUserToPreferences()` is made
- * to persist the user's data to preferences. Finally, the login status is updated
- * using `cb.loginStatusUpdate(loggedIn)`.
- *
- * @param response response from the login API, which provides the user's authentication
- * information.
- *
- * - `user`: A `User` object representing the authenticated user.
- * - `accessToken`: The access token obtained from the authentication process, which
- * can be used for further requests.
- *
- * The function performs the following actions:
- *
- * 1/ Logs a message to the debug log with the username of the successfully authenticated
- * user.
- * 2/ Sets the `username` and `email` properties of the `mUser` object to those of
- * the `user` object.
- * 3/ Sets the `loggedIn` property of the `mUser` object to `true`.
- * 4/ Checks if an access token was obtained and, if so, sets the `accessToken`
- * property of the `mUser` object to the obtained value.
- * 5/ Calls the `saveUserToPreferences()` function to save the `mUser` object to user
- * preferences.
- * 6/ Updates the login status in the caller with the newly set `loggedIn` property.
+ * Logs a message upon successful login, updates local user data, and checks for an
+ * access token. If present, it saves the user to preferences; otherwise, it triggers
+ * the user settings. It also notifies the callback with the logged-in status.
+ *
+ * @param user logged-in user, providing information such as username, email, and
+ * access token to be used for further processing within the function.
+ *
+ * Gets username from user and sets to mUser's setUsername method.
+ * Gets email from user and sets to mUser's setEmail method.
+ * Get the access token from user if not null.
+ *
+ * @param response response from the login API call and is not used in the function,
+ * as its value is not accessed or processed.
+ *
+ * Get a string response body from Response.
*/
@Override
public void success(User user, Response response) {
@@ -182,14 +149,12 @@ public void success(User user, Response response) {
}
/**
- * is called when a login request fails, and it logs an error message to the console
- * using the `Log.e()` method.
- *
- * @param retrofitError error that occurred during the login callback, which is then
- * logged with a message indicating the nature of the error.
- *
- * - `toString()`: Returns a string representation of the error object, which can
- * be used for logging or display to the user.
+ * Logs an error message to the console when a Retrofit request fails. The error
+ * message includes the exception details. It is used as a callback method for handling
+ * failures in API calls, providing information about the failure for debugging purposes.
+ *
+ * @param retrofitError exception that occurred during the HTTP request execution and
+ * is provided to the `failure` callback for further error handling.
*/
@Override
public void failure(RetrofitError retrofitError) {
@@ -199,33 +164,29 @@ public void failure(RetrofitError retrofitError) {
}
/**
- * sets user's settings by calling API with given username and returns access token
- * if successful.
+ * Retrieves user settings from a service using a Callback mechanism. It updates a
+ * local user object and saves it to preferences if an access token is provided,
+ * indicating successful login. In case of failure, it logs the error message.
*/
public void userSettings() {
service.settings(mUser.getUsername(), new Callback() {
/**
- * handles the callback response from the login API, updates the user object with the
- * received information, and saves it to preferences if an access token is provided.
- *
- * @param user authenticated user returned by the authentication service, providing
- * the user's username and email address, as well as an access token if available.
- *
- * - `username`: The username of the user.
- * - `email`: The email address of the user.
- * - `accessToken`: The access token of the user.
- *
- * @param response result of the login API call, providing the user's authentication
- * status and other relevant information.
- *
- * - `user`: A `User` object representing the user who has successfully logged in.
- * - `accessToken`: The access token obtained through the login process, which can
- * be used for further authenticated API requests.
- *
- * The function then updates the `mUser` field with the values of `user`, sets
- * `loggedIn` to `true`, and saves the user details to the preferences file if
- * `hasAccessToken` is set to `true`.
+ * Logs user details and updates local variables with the received data, including
+ * username, email, and access token. It also sets a flag indicating login success
+ * and saves the updated user data to preferences.
+ *
+ * @param user authenticated user's details, which are then used to update local
+ * variables and preferences.
+ *
+ * Extracts username and email from user object. The user object also contains an
+ * access token property.
+ *
+ * @param response response from the server, which is currently not used within the
+ * method.
+ *
+ * Response has no properties mentioned in this code snippet. The focus remains on
+ * the User object provided as an argument to this method.
*/
@Override
public void success(User user, Response response) {
@@ -247,17 +208,12 @@ public void success(User user, Response response) {
}
/**
- * is called when a Retrofit error occurs during the login callback. It logs an error
- * message to the console using the `Log.e()` method, including the error details in
- * the message.
- *
- * @param retrofitError error object generated by the Retrofit API call, which contains
- * information about the failure of the login callback.
- *
- * - `retrofitError.message`: String value representing the error message in
- * human-readable form.
- * - `retrofitError.statusCode`: Integer value representing the HTTP status code
- * associated with the error, if applicable.
+ * Handles errors that occur during a Retrofit API call. It logs an error message
+ * with a tag and the error details to the Android logcat for debugging purposes,
+ * indicating a failure in the login callback process.
+ *
+ * @param retrofitError error that occurred during the execution of the Retrofit
+ * request, providing information about the failure.
*/
@Override
public void failure(RetrofitError retrofitError) {
@@ -267,8 +223,9 @@ public void failure(RetrofitError retrofitError) {
}
/**
- * saves user information to shared preferences, including username, email, and access
- * token.
+ * Saves user data, including username, email, and access token, to device storage
+ * using SharedPreferences. The data is committed after being edited, allowing it to
+ * be retrieved later for use by the application.
*/
private void saveUserToPreferences() {
Log.d(TAG, "Saving: " + mUser.getUsername() + ", " + mUser.getEmail() + ", " + mUser.getAccessToken());
@@ -280,15 +237,13 @@ private void saveUserToPreferences() {
}
/**
- * removes saved user information from SharedPreferences and updates login status,
- * access token, and user data to empty values.
- *
- * @param cb CallbackInterface, which is an interface that provides a method for
- * updating the login status of the user after the save operation is completed.
- *
- * - `CallbackInterface cb`: This is an interface that provides methods for updating
- * the login status of the user. It has one method, `loginStatusUpdate`, which takes
- * a boolean parameter indicating whether the user is logged in or not.
+ * Removes saved user credentials from shared preferences, resets internal variables,
+ * and triggers a login status update callback to notify the UI of the change.
+ *
+ * @param cb callback interface to notify about login status updates, which is invoked
+ * with the updated login status when the saved user data is deleted.
+ *
+ * CallbackInterface cb: an interface with loginStatusUpdate method.
*/
public void deleteSavedUser(final MainActivity.CallbackInterface cb) {
SharedPreferences.Editor editor = sharedPreferences.edit();
diff --git a/client/src/main/java/io/sensable/client/SensorHelper.java b/client/src/main/java/io/sensable/client/SensorHelper.java
index eaba950..8bd17bf 100644
--- a/client/src/main/java/io/sensable/client/SensorHelper.java
+++ b/client/src/main/java/io/sensable/client/SensorHelper.java
@@ -6,24 +6,24 @@
* Created by madine on 16/07/14.
*/
/**
- * provides a way to determine the type of sensor based on its name, and return an
- * appropriate image resource for that sensor. The class includes methods to determine
- * the image for different types of sensors, such as accelerometer, magnetic field,
- * orientation, light, pressure, proximity, gravity, linear acceleration, rotation,
- * humidity, temperature, and CO2.
+ * Provides utility functions to determine the unit of measurement for various sensors
+ * and retrieve corresponding image resources based on sensor types. It contains three
+ * main functions: `determineUnit` which returns the unit of measurement,
+ * `determineImage(int)` which retrieves an integer representing a drawable resource
+ * ID for a given sensor type, and `determineImage(String)` which does the same but
+ * takes a string parameter.
*/
public class SensorHelper {
/**
- * takes an integer input parameter representing a sensor type, and returns a string
- * indicating the appropriate unit for that sensor type.
- *
- * @param sensorType 16-bit value of the sensor type, which determines the unit of
- * measurement for the accelerometer, magnetic field, gyroscope, light, pressure,
- * proximity, gravity, linear acceleration, rotation vector, orientation, relative
- * humidity, ambient temperature, or uncalibrated magnetic field, gyroscope, or game
- * rotation vector output.
- *
+ * Takes an integer `sensorType` as input and returns a corresponding unit string for
+ * the sensor type. The function uses a switch statement to map the sensor type to
+ * its respective unit, covering various types of sensors such as accelerometer,
+ * magnetometer, gyroscope, and others.
+ *
+ * @param sensorType type of sensor being used, which determines the corresponding
+ * unit to be returned by the function.
+ *
* @returns a string representing the unit of measurement for a given sensor type.
*/
public static String determineUnit(int sensorType) {
@@ -81,15 +81,18 @@ public static String determineUnit(int sensorType) {
}
/**
- * determines an image resource based on a sensor type, using a switch statement to
- * map the sensor type to a corresponding image resource ID.
- *
- * @param sensorType 16-bit integer value returned by the Android sensor API, which
- * determines the type of sensor data to be fetched and displayed in the `determineImage()`
- * function.
- *
- * @returns an integer representing the drawable resource ID for the corresponding
- * sensor type.
+ * Determines which image resource to display based on the type of sensor specified
+ * by the input parameter `sensorType`. It uses a switch statement to map each sensor
+ * type to a corresponding image resource and returns the selected image.
+ *
+ * @param sensorType type of sensor and determines which corresponding image resource
+ * to be returned based on its value.
+ *
+ * @returns an integer value representing a specific sensor type.
+ *
+ * The output is an integer value representing a drawable image resource ID. The value
+ * can be one of several predefined constants such as R.drawable.type_lux,
+ * R.drawable.type_accelerometer, and so on.
*/
public static int determineImage(int sensorType) {
@@ -146,14 +149,18 @@ public static int determineImage(int sensorType) {
}
/**
- * determines the appropriate drawable resource for a given sensor type based on a
- * case-insensitive match of the sensor name.
- *
- * @param sensorType type of sensor, and based on its value, the function returns a
- * different drawable resource ID for the image to be displayed.
- *
- * @returns an integer representing the drawable resource ID for the corresponding
- * sensor type.
+ * Determines an image based on a given sensor type. It converts the sensor type to
+ * lowercase and checks for various conditions, assigning a corresponding image
+ * resource ID. The function returns the determined image ID as an integer.
+ *
+ * @param sensorType type of sensor that is being used, and its value determines which
+ * image to return based on a series of conditional checks.
+ *
+ * @returns an integer value representing a drawable resource ID.
+ *
+ * The output is an integer representing a drawable image resource ID from R.drawable.
+ * The value of this integer determines which image is displayed based on the input
+ * sensorType parameter.
*/
public static int determineImage(String sensorType) {
diff --git a/client/src/main/java/io/sensable/client/SensorListActivity.java b/client/src/main/java/io/sensable/client/SensorListActivity.java
index d972c69..5386e29 100644
--- a/client/src/main/java/io/sensable/client/SensorListActivity.java
+++ b/client/src/main/java/io/sensable/client/SensorListActivity.java
@@ -10,6 +10,13 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * Disables the default list layout and replaces it with a list of available sensors
+ * on the device.
+ * It enables text filtering on the list view to allow users to search for specific
+ * sensors.
+ * The list of sensors is retrieved from the device's SensorManager.
+ */
public class SensorListActivity extends ListActivity {
/**
* Called when the activity is first created.
diff --git a/client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java b/client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java
index 96abdd6..754bd6e 100644
--- a/client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java
+++ b/client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java
@@ -13,11 +13,11 @@
import java.util.List;
/**
- * is an adapter that extends BaseExpandableListAdapter and provides functionality
- * for displaying data in an expandable list format. It takes in a context, a list
- * of header titles, and a map of child data in the format of header title, child
- * title. The adapter provides methods for getting child and group objects, as well
- * as inflating views for each item in the list.
+ * Is designed to manage expandable lists in Android applications. It extends
+ * BaseExpandableListAdapter and provides functionality for displaying data in an
+ * expandable list format. The class retrieves child objects based on group positions,
+ * calculates the number of children per group, and inflates views for each item in
+ * the list.
*/
public class ExpandableListAdapter extends BaseExpandableListAdapter {
@@ -34,34 +34,17 @@ public ExpandableListAdapter(Context context, List listDataHeader,
}
/**
- * retrieves a child object within a group by providing the group position and child
- * position as inputs. It returns the requested child object from the `_listDataChild`
- * array, which is a nested array of child objects, based on the input group and child
- * positions.
- *
- * @param groupPosition 0-based index of the group within the list data, which is
- * used to access the corresponding child element within the group's list data.
- *
- * @param childPosititon 2nd index of a inner list within an object, which is being
- * retrieved from the parent list through the function call.
- *
- * @returns an object of the type specified by its parameter.
- *
- * The output is an object of type `_listDataChild`, which is an inner class of the
- * outer class `_ListData`. This means that the output is also an inner class, and
- * its properties can be accessed using the same syntax as the outer class.
- *
- * The output contains a nested list of objects, where each object represents a child
- * element within the group. The nested list is accessed using the method `get`,
- * followed by the name of the list (i.e., `_listDataChild`).
- *
- * Each element in the nested list has several properties, including its position
- * within the group (stored as an integer), its type (stored as a string), and its
- * value (stored as an object of type `Object`). The properties are accessed using
- * dot notation, such as `.position`, `.type`, and `.value`.
- *
- * Overall, the output of the `getChild` function provides a way to access and
- * manipulate the child elements within a group in a hierarchical manner.
+ * Returns an object at a specified position within a sublist associated with a group
+ * in a hierarchical list structure. The group is identified by its index, and the
+ * child position is determined relative to the sublist.
+ *
+ * @param groupPosition 0-based index of the group or category for which to retrieve
+ * child elements, as specified by the `_listDataHeader` map.
+ *
+ * @param childPosititon 0-based index of the child item to retrieve within the list
+ * of child items associated with the specified `groupPosition`.
+ *
+ * @returns an object from a list of child data.
*/
@Override
public Object getChild(int groupPosition, int childPosititon) {
@@ -70,16 +53,18 @@ public Object getChild(int groupPosition, int childPosititon) {
}
/**
- * returns the position of a child within a group, where the position is the value
- * of the child's `childPosition` field.
- *
- * @param groupPosition 0-based position of the group within its parent container,
- * which is used to determine the correct child position for retrieval.
- *
- * @param childPosition 0-based index of a child element within its parent group,
- * which is used to retrieve the unique identifier of that child element.
- *
- * @returns a long value representing the child position within its group.
+ * Returns a unique identifier for each child element at a given position within a
+ * group. The returned ID is based on the child's relative position within the group,
+ * with the first child receiving an ID of 0 and subsequent children incrementing accordingly.
+ *
+ * @param groupPosition 0-based index of the group or parent element for which the
+ * `getChildId` method is called to retrieve the identifier of its child at the
+ * specified `childPosition`.
+ *
+ * @param childPosition 0-based index of the child element being accessed within a
+ * group, and its value is returned as the unique identifier for that child.
+ *
+ * @returns a unique long integer representing each child position.
*/
@Override
public long getChildId(int groupPosition, int childPosition) {
@@ -87,56 +72,38 @@ public long getChildId(int groupPosition, int childPosition) {
}
/**
- * inflates a list item layout, retrieves the child text from the adapter, and sets
- * it as the text of a TextView within the layout.
- *
- * @param groupPosition 0-based position of the group within its parent container,
- * which is used to locate the appropriate child view within the group's layout.
- *
- * @param childPosition 0-based index of the current child element within its parent
- * group, which is used to identify and customize the child view.
- *
- * @param isLastChild status of the current child view in the list, indicating whether
- * it is the last child in the group or not.
- *
- * @param convertView preview of the view that will be displayed for the given
- * groupPosition and childPosition, which is either null or an existing view that has
- * been inflated from a layout file.
- *
- * 1/ If it is null, then it represents an inflated layout from the specified XML
- * resource (R.layout.list_item).
- * 2/ The `findViewById` method is used to find a view with the ID `lblListItem`
- * within the inflated layout.
- * 3/ The text view found is referred to as `txtListChild`.
- *
- * @param parent ViewGroup that contains the adapter's layout and provides the context
- * for inflating the child view.
- *
- * - `_context`: The context object for the application.
- * - `convertView`: A variable that holds the view to be modified or created. It is
- * a null value by default.
- * - `groupPosition`: An integer indicating the group position of the child view
- * being processed.
- * - `childPosition`: An integer indicating the child position within the group.
- * - `isLastChild`: A boolean value indicating whether the child view is the last
- * child in the group.
- * - `parent`: The parent ViewGroup object whose child view needs to be retrieved
- * or created.
- *
- * @returns a customized view for displaying a piece of text at a specific position
- * in a list.
- *
- * - `convertView`: This is the View object that represents the child element to be
- * displayed in the list. It can be null if no existing view is available, and it
- * will be inflated a new one if needed.
- * - `childPosition`: This is the position of the child element within its group.
- * It is an integer value that ranges from 0 to the total number of children in the
- * group - 1.
- * - `isLastChild`: This is a boolean value that indicates whether the current child
- * element is the last one in its group. It is set to true if the current element is
- * the last one, and false otherwise.
- * - `parent`: This is the ViewGroup object that contains the group of children. It
- * is used to access the parent's layout parameters and other properties.
+ * Inflates a layout for a child view within a group, retrieves the child's text
+ * content, and sets it to a TextView widget. It returns the converted view with the
+ * set text.
+ *
+ * @param groupPosition 0-based position of the group in the list that contains the
+ * child view being inflated, which is used to retrieve the child text from the data
+ * source.
+ *
+ * @param childPosition 0-based index of the child view within its parent group, used
+ * to retrieve the corresponding child text and set it in the TextView.
+ *
+ * @param isLastChild state of whether the child view being accessed is the last one
+ * within its group, which can potentially be used to optimize rendering or styling
+ * of the child views accordingly.
+ *
+ * @param convertView view to be recycled and reused, or null if a new view must be
+ * created.
+ *
+ * Inflates to null initially and then inflated with layout R.layout.list_item when
+ * not null.
+ *
+ * @param parent ViewGroup that this view is being added to, serving as a reference
+ * for layout and alignment purposes.
+ *
+ * Parent is a ViewGroup object representing the parent view group. It has no attributes
+ * mentioned in this context.
+ *
+ * @returns a custom list item view with child text.
+ *
+ * The output is a view representing a child in an expandable list view group. It has
+ * a text value set from the `childText` string and is inflated with the layout
+ * resource `R.layout.list_item`.
*/
@Override
public View getChildView(int groupPosition, final int childPosition,
@@ -157,15 +124,13 @@ public View getChildView(int groupPosition, final int childPosition,
}
/**
- * calculates the number of elements in a list of children associated with a specific
- * group position. It takes the position as an argument and returns the number of
- * elements in the list.
- *
- * @param groupPosition 0-based index of a group in the list data, which is used to
- * access the corresponding children in the list.
- *
- * @returns the number of elements in a list of children, calculated by traversing
- * the list of children and counting their size.
+ * Returns the number of child elements for a given group position within a list data
+ * structure, utilizing a header to index into the child list and retrieve its size.
+ *
+ * @param groupPosition 0-based index of a group in the list data header, used to
+ * retrieve the corresponding child data from the `_listDataChild` map.
+ *
+ * @returns an integer representing the size of a list.
*/
@Override
public int getChildrenCount(int groupPosition) {
@@ -174,21 +139,14 @@ public int getChildrenCount(int groupPosition) {
}
/**
- * returns a specified object within a list data header based on its position.
- *
- * @param groupPosition 0-based index of a group within the list data header, which
- * is used to retrieve the corresponding group element from the list.
- *
- * @returns an object of type `_ListDataHeader`.
- *
- * - `_listDataHeader`: This is an instance of a class that represents a list header.
- * It contains metadata about the list, such as the number of elements it contains
- * and the type of data it holds.
- * - `groupPosition`: This is an integer parameter that represents the position of
- * the group within the list.
- *
- * The return value of the function is an object of type `_listDataHeader`, which
- * contains information about the group at the specified position in the list.
+ * Returns an object at a specified position from a list data header. The position
+ * is provided as an integer parameter, and the function retrieves the corresponding
+ * object from the `_listDataHeader` collection.
+ *
+ * @param groupPosition 0-based index of the group to be retrieved from the
+ * `_listDataHeader` collection, allowing for specific groups to be accessed and returned.
+ *
+ * @returns an object retrieved from the `_listDataHeader` list.
*/
@Override
public Object getGroup(int groupPosition) {
@@ -196,10 +154,12 @@ public Object getGroup(int groupPosition) {
}
/**
- * returns the number of groups in a list based on the size of its header.
- *
- * @returns the number of groups in the list of data, which is determined by the size
- * of the `_listDataHeader`.
+ * Returns an integer representing the number of items in a list referred to as
+ * `_listDataHeader`. This count is used for grouping or categorizing data in a
+ * hierarchical manner. The function overrides the default implementation and provides
+ * custom behavior for getting group counts.
+ *
+ * @returns an integer representing the size of a list.
*/
@Override
public int getGroupCount() {
@@ -207,12 +167,15 @@ public int getGroupCount() {
}
/**
- * returns the group position as a long value.
- *
- * @param groupPosition 0-based position of a group within the underlying data
- * structure, which is used to retrieve the corresponding group ID returned by the function.
- *
- * @returns the input parameter `groupPosition`.
+ * Returns a long integer value that corresponds to the specified group position. The
+ * group position is provided as an input parameter and is directly returned without
+ * any modification or processing. This suggests a simple mapping between group
+ * positions and their corresponding IDs.
+ *
+ * @param groupPosition 0-based index of the group for which to retrieve the corresponding
+ * ID, which is directly returned as the result.
+ *
+ * @returns the integer value of the input `groupPosition`.
*/
@Override
public long getGroupId(int groupPosition) {
@@ -220,45 +183,35 @@ public long getGroupId(int groupPosition) {
}
/**
- * inflates a layout for a group in a list, sets the group title as the text of a
- * header view, and returns the modified view.
- *
- * @param groupPosition 0-based index of the group in the adapter's list, which is
- * used to inflate the appropriate layout for the group and set the header text.
- *
- * @param isExpanded current expansion state of the group, allowing the function to
- * display an appropriate header title based on whether the group is expanded or collapsed.
- *
- * @param convertView view that will be reused for the current group if it is not
- * null, otherwise a new view will be inflated from the `R.layout.list_group` layout
- * file.
- *
- * - `convertView`: If it is null, an instance of the LayoutInflater class is used
- * to inflate the R.layout.list_group layout file into a new View object.
- * - `parent`: The parent ViewGroup of the newly created View.
- *
- * @param parent ViewGroup that contains the current group being processed, and is
- * used to position the group correctly within its parent container.
- *
- * - `_context`: This represents the context of the class, which is used to access
- * system services such as the layout inflater.
- * - `convertView`: This is a view that is reused when the same group is encountered
- * again. If it is null, a new instance of the `R.layout.list_group` layout will be
- * inflated using the `LayoutInflater` service.
- * - `viewGroup`: This represents the parent view group of the current group being
- * processed.
- *
- * @returns a customized view for displaying a list group header, with the group title
- * displayed prominently in bold text.
- *
- * - `convertView`: This is the view that will be used to display the group header.
- * It can be null if no existing view is available.
- * - `isExpanded`: A boolean value indicating whether the group is expanded or collapsed.
- * - `parent`: The parent ViewGroup that contains the group being displayed.
- * - `headerTitle`: The title of the group, which is set as the text of a TextView
- * in the returned view.
- * - `R.id.lblListHeader`: The ID of the TextView element in the layout file where
- * the header title is displayed.
+ * Returns a view representing a group in a list. It inflates a layout for each group
+ * if necessary, sets the text of a header label to the group's title, and returns
+ * the converted view. The returned view is used to display the group's title in the
+ * list.
+ *
+ * @param groupPosition 0-based index of the group being rendered, used to retrieve
+ * its title and configure the view accordingly.
+ *
+ * @param isExpanded state of the group at the given position, indicating whether it
+ * is currently expanded or not.
+ *
+ * @param convertView view that will be used to represent the group at the specified
+ * `groupPosition`, and it is reused whenever possible for efficiency.
+ *
+ * convertView is either null or an inflated View object from R.layout.list_group;
+ * if convertView is null, it is initialized with the layout inflater; otherwise, its
+ * original state remains unchanged.
+ *
+ * @param parent parent view group that the converted view is being added to or
+ * replaced within.
+ *
+ * Parent is a ViewGroup object representing the parent group to be laid out and
+ * shown. It has main properties such as layout_width, layout_height, and layout_margin.
+ *
+ * @returns a customized group view for an expandable list.
+ *
+ * It is a View object, specifically a layout view with an inflated design from
+ * R.layout.list_group. The view contains a TextView with the ID lblListHeader, which
+ * displays the header title in bold font.
*/
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
@@ -279,9 +232,11 @@ public View getGroupView(int groupPosition, boolean isExpanded,
}
/**
- * returns `false`, indicating that no stable IDs are present in the related data.
- *
- * @returns `false`.
+ * Returns a boolean value indicating whether the IDs returned by the adapter are
+ * stable across different configuration changes or not. In this implementation, it
+ * always returns `false`, implying that the IDs may change due to configuration changes.
+ *
+ * @returns a boolean value indicating that IDs are not stable.
*/
@Override
public boolean hasStableIds() {
@@ -289,16 +244,17 @@ public boolean hasStableIds() {
}
/**
- * determines whether a child can be selected based on its position within a group.
- * It returns `true` if the child can be selected, and `false` otherwise.
- *
- * @param groupPosition 0-based index of the group within which the `childPosition`
- * parameter's child is being evaluated for selectability.
- *
- * @param childPosition 0-based index of a child element within its parent group in
- * the adapter's dataset.
- *
- * @returns `true`.
+ * Returns a boolean value indicating whether the child at the specified position
+ * within the group at the specified position can be selected or not. In this
+ * implementation, it always returns `true`, allowing any child to be selected.
+ *
+ * @param groupPosition 0-based index of the group within an ExpandableListView that
+ * is being checked for selectability of its child at the specified `childPosition`.
+ *
+ * @param childPosition 0-based position of a child item within its parent group in
+ * a hierarchical data structure.
+ *
+ * @returns a boolean value indicating whether children are selectable.
*/
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
diff --git a/client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java b/client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java
index 9885628..c783953 100644
--- a/client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java
+++ b/client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java
@@ -11,9 +11,10 @@
* Created by simonmadine on 20/07/2014.
*/
/**
- * is an extension of FragmentPagerAdapter that provides fragments for a tabbed
- * interface with three tabs: Top Rated, Games, and Movies. The adapter receives the
- * index of the current tab and returns the corresponding fragment activity.
+ * Extends FragmentPagerAdapter, providing fragments for a tabbed interface with three
+ * tabs: Top Rated, Games, and Movies. It determines the type of fragment to display
+ * based on its index and returns a corresponding `Fragment` instance. The class has
+ * a fixed count of 3 tabs.
*/
public class TabsPagerAdapter extends FragmentPagerAdapter {
@@ -22,29 +23,20 @@ public TabsPagerAdapter(FragmentManager fm) {
}
/**
- * determines the type of fragment to display based on its index and returns a
- * `Fragment` instance accordingly.
- *
- * @param index 0-based index of the fragment to be returned, with values 0, 1, and
- * 2 corresponding to different fragments: `FavouriteSensablesFragment`,
- * `LocalSensablesFragment`, and `RemoteSensablesFragment`, respectively.
- *
- * @returns a reference to a `Fragment` object that represents one of four different
- * activity types based on the input index.
- *
- * The return type of the function is `Fragment`, which means that the function returns
- * an instance of a fragment class.
- *
- * The variable `index` passed as an argument to the function takes on the values 0,
- * 1, or 2, indicating the type of fragment to be returned.
- *
- * The code inside the `switch` statement defines three different fragments:
- * `FavouriteSensablesFragment`, `LocalSensablesFragment`, and `RemoteSensablesFragment`.
- * Each of these fragments represents a specific type of content, such as top-rated
- * sensibles, local sensibles, or remote sensibles.
- *
- * The `return` statement at the end of the `switch` statement returns an instance
- * of one of these fragments based on the value of `index`.
+ * Returns a Fragment instance based on the specified index, which determines the
+ * type of content to display. It uses a switch statement to handle three cases:
+ * FavouriteSensablesFragment for index 0, LocalSensablesFragment for index 1, and
+ * RemoteSensablesFragment for index 2.
+ *
+ * @param index 0-based index of a tab within a tab layout, determining which fragment
+ * to return from the switch statement.
+ *
+ * @returns a Fragment object, depending on the specified index.
+ *
+ * The output is an instance of a fragment class. The type of fragment depends on the
+ * input index. If the index is 0, the output is an instance of `FavouriteSensablesFragment`.
+ * If the index is 1, the output is an instance of `LocalSensablesFragment`. If the
+ * index is 2, the output is an instance of `RemoteSensablesFragment`.
*/
@Override
public Fragment getItem(int index) {
@@ -65,16 +57,11 @@ public Fragment getItem(int index) {
}
/**
- * retrieves the count of items by calculating the number of tabs. The count is
- * returned as an integer value, equal to the number of tabs.
- *
- * @returns the number of tabs.
- *
- * - The output is an integer value representing the number of tabs.
- * - The value is equal to 3 in this case, indicating that there are three tabs
- * present in the system.
- * - The output does not provide any information about the contents or organization
- * of the tabs, only their total count.
+ * Returns an integer representing the number of items, specifically the number of
+ * tabs. The method overrides a parent class's implementation and always returns a
+ * fixed value of 3.
+ *
+ * @returns an integer value, specifically `3`.
*/
@Override
public int getCount() {
diff --git a/client/src/main/java/io/sensable/client/component/FontFitTextView.java b/client/src/main/java/io/sensable/client/component/FontFitTextView.java
index 992fc0b..1305321 100644
--- a/client/src/main/java/io/sensable/client/component/FontFitTextView.java
+++ b/client/src/main/java/io/sensable/client/component/FontFitTextView.java
@@ -11,11 +11,11 @@
import android.widget.TextView;
/**
- * is an extension of the TextView class that adjusts the font size to fit the text
- * within a specified width. The class has several methods for resizing the font,
- * including initialising the paint object, measuring the text size, and refitting
- * the text when the width changes. These methods allow the text to be resized to fit
- * within the available width while maintaining a consistent font size.
+ * Is an extension of the TextView class that adjusts the font size to fit the text
+ * within a specified width while maintaining a consistent aspect ratio. It uses a
+ * `Paint` object to measure and resize the text, recalculating the dimensions when
+ * its width or height changes. The class also updates the text size based on the
+ * view's new width and height.
*/
public class FontFitTextView extends TextView {
@@ -30,10 +30,9 @@ public FontFitTextView(Context context, AttributeSet attrs) {
}
/**
- * initializes a new `Paint` object and sets its properties to match those of the
- * `Paint` object associated with the current component. It also sets the maximum
- * size of the `Paint` object based on the initially specified text size, unless it
- * is too small.
+ * Initializes a private variable `mTestPaint` with a new instance of `Paint`. It
+ * then sets the properties of the new paint to match those of an existing `Paint`
+ * object retrieved from the current context using `getPaint()`.
*/
private void initialise() {
mTestPaint = new Paint();
@@ -45,14 +44,15 @@ private void initialise() {
* assuming the text box is the specified width.
*/
/**
- * adjusts the text size based on its width and padding to fit within a specified
- * width while maintaining a consistent aspect ratio.
- *
- * @param text text to be repositioned within the specified width.
- *
- * @param textWidth width of the text that the function is repositioning, and it is
- * used to determine the appropriate size for the text so that it fits within the
- * available space.
+ * Adjusts the text size to fit within a given width while taking into account left
+ * and right padding. It iteratively narrows down the range of possible sizes by
+ * measuring the text's width at each midpoint until it converges on the correct size.
+ *
+ * @param text string whose font size is to be adjusted to fit within the specified
+ * width.
+ *
+ * @param textWidth width of the available space for rendering the text, from which
+ * the optimal font size is calculated to fit the given text within that width.
*/
private void refitText(String text, int textWidth)
{
@@ -78,14 +78,15 @@ private void refitText(String text, int textWidth)
}
/**
- * recalculates the text dimensions when its width or height changes and updates the
- * measured dimensions of the view.
- *
- * @param widthMeasureSpec width size of the component that the `onMeasure()` method
- * is being called for, and is used to determine the width of the component's layout
- * space.
- *
- * @param heightMeasureSpec specifier for the desired height of the view.
+ * Adjusts the size of a view based on its content and available space. It first calls
+ * the superclass's `onMeasure` method to set up the measurement process, then retrieves
+ * the parent's width and updates the view's height based on the text content.
+ *
+ * @param widthMeasureSpec measure specification for the width of the view, which
+ * specifies how much space is available for the view to occupy.
+ *
+ * @param heightMeasureSpec measure specification for the view's height, which is
+ * used to determine the actual height of the view.
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
@@ -98,28 +99,19 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
}
/**
- * recalculates the width of a view when its text changes, and then updates the text
- * to fit within that width.
- *
- * @param text modified text value that triggered the onTextChanged() event.
- *
- * - `text`: The changed text value, which is a `CharSequence`.
- * - `start`: The position where the change occurred in the original text, represented
- * as an integer.
- * - `before`: The previous value of the text at the specified position, also
- * represented as an integer.
- * - `after`: The new value of the text at the specified position, again represented
- * as an integer.
- *
- * @param start 0-based index of the first character in the text that has changed,
- * indicating where the `onTextChanged()` method should start recalculating the width
- * of the text component.
- *
- * @param before number of characters that were present in the text before the specified
- * range.
- *
- * @param after number of characters that have been added or removed from the text
- * after the last call to `refitText()`.
+ * Overrides a method to respond to changes in the text of an input field. It takes
+ * four parameters: the changed text, and the start and end positions of the change,
+ * and updates the layout based on the new text.
+ *
+ * @param text character sequence that is being changed within the text field.
+ *
+ * @param start 0-based index of the first character changed during the text modification
+ * process.
+ *
+ * @param before number of characters being removed from the text at the specified
+ * start position before making changes to it.
+ *
+ * @param after number of characters added to the text at the specified position.
*/
@Override
protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) {
@@ -127,18 +119,20 @@ protected void onTextChanged(final CharSequence text, final int start, final int
}
/**
- * updates the text size based on the view's new width and height, if they have changed
- * since the last update.
- *
- * @param w width of the component, which is used to determine whether the text needs
- * to be refitted.
- *
- * @param h height of the viewport, which is used to determine if the text needs to
- * be refitted.
- *
- * @param oldw previous width of the view component.
- *
- * @param oldh previous height of the view component.
+ * Is overridden to handle changes in width. It checks if the new width differs from
+ * the previous one, and if so, calls the `refitText` method with the current text
+ * and new width as arguments to adjust the text according to the changed width.
+ *
+ * @param w new width of the view, which is compared with its previous width (`oldw`)
+ * to determine if a refitting of text is necessary.
+ *
+ * @param h height of the view, which is not being used in this method.
+ *
+ * @param oldw width of the view before it was resized, allowing the method to detect
+ * whether the width has changed since the last time the onSizeChanged method was called.
+ *
+ * @param oldh previous height of the view, which is used for comparison with the
+ * current height (`h`) to determine if there has been a change in the view's size.
*/
@Override
protected void onSizeChanged (int w, int h, int oldw, int oldh) {
diff --git a/client/src/main/java/io/sensable/client/scheduler/BootReceiver.java b/client/src/main/java/io/sensable/client/scheduler/BootReceiver.java
index 5e28975..c932f8c 100644
--- a/client/src/main/java/io/sensable/client/scheduler/BootReceiver.java
+++ b/client/src/main/java/io/sensable/client/scheduler/BootReceiver.java
@@ -9,31 +9,23 @@
* Created by simonmadine on 19/07/2014.
*/
/**
- * is a broadcast receiver that handles events related to the system booting up. When
- * the device boots, the receiver starts an AlarmManager to schedule tasks using the
- * ScheduleHelper class.
+ * Is a broadcast receiver that handles system boot events in Android applications.
+ * It starts an AlarmManager and initiates the Schedule Helper to begin scheduling
+ * tasks when the device boots up. This ensures timely execution of scheduled tasks.
*/
public class BootReceiver extends BroadcastReceiver {
private static final String TAG = BootReceiver.class.getSimpleName();
/**
- * starts AlarmManager at boot and initiates the Schedule Helper to begin scheduling
- * tasks.
- *
- * @param context Android app's context, which provides access to resources and APIs
- * needed to perform the function.
- *
- * - `TAG`: a String variable representing the logging tag for the function.
- * - `intent`: an Intent object passed as an argument to the function, containing
- * data relevant to the function's execution.
- *
- * @param intent Android AlarmManager's intent, which triggers the start of the
- * ScheduleHelper's scheduler when the device boots.
- *
- * - `context`: The context of the application, which is a crucial component in
- * Android applications.
- * - `intent`: An intent object representing the purpose and data associated with
- * the event being handled.
+ * Schedules a task using an AlarmManager when the device boots up. It creates a
+ * `ScheduleHelper` object and calls its `startScheduler` method to initiate the
+ * scheduling process. The scheduled task is logged with debug information.
+ *
+ * @param context application environment and provides access to various system
+ * resources, services, and functionality within the code.
+ *
+ * @param intent Intent that triggered the onReceive() method and is not utilized
+ * within the provided code snippet.
*/
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "Starting AlarmManager at Boot (onReceive)");
diff --git a/client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java b/client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java
index 9086b6b..a2a6e44 100644
--- a/client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java
+++ b/client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java
@@ -19,10 +19,11 @@
* Created by madine on 15/07/14.
*/
/**
- * is a utility class that assists in managing scheduled tasks for a sensory system.
- * It provides methods for creating and removing scheduled tasks, as well as querying
- * the number of scheduled tasks and pending tasks. Additionally, it includes a method
- * for updating the favourite object if available.
+ * Manages scheduled tasks for a sensory system, allowing for creation, deletion, and
+ * updating of scheduled sensables. It utilizes Android's AlarmManager to schedule
+ * tasks at specific intervals and ContentResolver to interact with the device's data
+ * storage. The class provides methods for checking the status of scheduled tasks,
+ * stopping or canceling schedules, and updating favourite objects.
*/
public class ScheduleHelper {
@@ -37,8 +38,9 @@ public ScheduleHelper(Context context) {
}
/**
- * sets up a scheduled task using AlarmManager if it doesn't already exist, or updates
- * the existing one if it does.
+ * Starts or resumes a recurring task on an Android device using AlarmManager. If an
+ * existing alarm is found, it exits without recreating it; otherwise, it creates and
+ * schedules the task to run every 15 minutes.
*/
public void startScheduler() {
Intent intent = new Intent(context.getApplicationContext(), ScheduledSensableService.class);
@@ -55,24 +57,12 @@ public void startScheduler() {
}
/**
- * queries the content resolver for scheduled tasks and returns a cursor containing
- * the results.
- *
- * @returns a cursor object containing the scheduled tasks.
- *
- * - `Cursor count`: This is a cursor object that represents a query result set
- * containing information about scheduled tasks.
- * - `context`: The context object refers to the application context in which the
- * function was called.
- * - `ContentResolver`: The content resolver is an interface used to interact with
- * the device's data storage, and it is being used to query the ScheduledSensableContentProvider
- * for information about scheduled tasks.
- * - `Uri.parse(ScheduledSensableContentProvider.CONTENT_URI.toString())`: This line
- * of code constructs a Uri object that represents the content provider's URI for
- * querying scheduled tasks.
- * - `new String[]{"*"}`: This line of code defines an array of strings containing
- * the fields to be queried in the result set returned by the content provider. The
- * `"*"` field is used to indicate that all fields should be queried.
+ * Queries the content resolver for a cursor containing all scheduled tasks, returning
+ * it as a result. It uses the `Uri.parse` method to obtain the URI for the
+ * ScheduledSensableContentProvider and then passes this URI along with an empty
+ * projection, null selection criteria, and null sort order to the query method.
+ *
+ * @returns a cursor object representing scheduled tasks.
*/
public Cursor getScheduledTasks() {
Cursor count = context.getApplicationContext().getContentResolver().query(Uri.parse(ScheduledSensableContentProvider.CONTENT_URI.toString()), new String[]{"*"}, null, null, null, null);
@@ -80,20 +70,23 @@ public Cursor getScheduledTasks() {
}
/**
- * retrieves the number of scheduled tasks from a `ScheduledTasks` collection and
- * returns it as an integer value.
- *
- * @returns the number of scheduled tasks.
+ * Retrieves and returns the count of scheduled tasks from a designated source using
+ * the `getSchedueldTasks` method. The returned value represents the number of tasks
+ * that are currently scheduled for execution. This function encapsulates the logic
+ * to retrieve task count in a concise manner.
+ *
+ * @returns an integer value representing the number of scheduled tasks.
*/
public int countScheduledTasks() {
return getScheduledTasks().getCount();
}
/**
- * queries the ContentResolver for the number of pending scheduled tasks stored in
- * the ScheduledSensableContentProvider and returns that count.
- *
- * @returns the number of pending scheduled tasks.
+ * Queries a content provider for a URI related to pending scheduled tasks. It returns
+ * the number of rows in the result set, representing the count of pending scheduled
+ * tasks. The query uses a cursor to retrieve data from the content resolver.
+ *
+ * @returns an integer value representing the number of pending scheduled tasks.
*/
public int countPendingScheduledTasks() {
Cursor count = context.getApplicationContext().getContentResolver().query(Uri.parse(ScheduledSensableContentProvider.CONTENT_URI + "/pending"), new String[]{"*"}, null, null, null, null);
@@ -102,10 +95,11 @@ public int countPendingScheduledTasks() {
// Call this when removing a scheduled task to find out if we can remove the scheduler
/**
- * cancels a scheduler's pending intent if no tasks are scheduled, effectively stopping
- * the scheduler.
- *
- * @returns a boolean value indicating whether the scheduler was successfully canceled.
+ * Cancels a scheduled task if no tasks are pending. It checks the count of scheduled
+ * tasks and, if zero, stops the scheduler by canceling a pending intent that triggers
+ * the ScheduledSensableService class. The function then returns true.
+ *
+ * @returns a boolean value indicating successful cancellation of scheduled tasks.
*/
public boolean stopSchedulerIfNotNeeded() {
if (countScheduledTasks() == 0) {
@@ -117,27 +111,14 @@ public boolean stopSchedulerIfNotNeeded() {
}
/**
- * inserts a new scheduled sensory data into the database through Content Resolver.
- *
- * @param scheduledSensable sensable that will be added to the scheduler, and it is
- * used to create a ContentValues object that contains the data to be inserted into
- * the database.
- *
- * - `context`: This represents the context in which the function is being executed,
- * and is used to get a content resolver for inserting the scheduled sensable into
- * the database.
- * - `ScheduledSensablesTable`: This represents the table where the scheduled sensable
- * will be inserted into the database.
- * - `serializeScheduledSensableForSqlLite`: This function serializes the input
- * `scheduledSensable` into a ContentValues object, which is then used to insert the
- * sensable into the database.
- * - `mNewUri`: This represents the Uri object that contains the new scheduled
- * sensable data after insertion.
- * - `getContentResolver()`: This function gets a content resolver for inserting the
- * scheduled sensable into the database.
- *
- * @returns a boolean value indicating whether the scheduled sensable was successfully
- * added to the scheduler.
+ * Inserts a new scheduled sensable into the SQLite database, using the provided
+ * ScheduledSensableContentProvider and ContentValues for serialization. It returns
+ * true upon successful insertion.
+ *
+ * @param scheduledSensable ScheduledSensable object that needs to be added to the
+ * SQLite database through the content provider.
+ *
+ * @returns a boolean value indicating successful insertion of data.
*/
public boolean addSensableToScheduler(ScheduledSensable scheduledSensable) {
ContentValues mNewValues = ScheduledSensablesTable.serializeScheduledSensableForSqlLite(scheduledSensable);
@@ -150,33 +131,14 @@ public boolean addSensableToScheduler(ScheduledSensable scheduledSensable) {
}
/**
- * deletes a ScheduledSensable object from the database by calling the `delete` method
- * on the content resolver with the ScheduledSensable's ID as the URI and null as the
- * selection and selection arguments. It returns `true` if any rows were deleted,
- * otherwise `false`.
- *
- * @param scheduledSensable ScheduledSensable object to be removed from the scheduler.
- *
- * - `Context`: This is an instance of `android.content.Context`, which is used to
- * access the content resolver for deleting rows from the database.
- * - `Uri`: This is a `Uri` object that represents the content provider for schedules,
- * with the path `/$1`. The number after the `$` is the ID of the scheduled sensable.
- * - `ScheduledSensableContentProvider`: This is a class that provides access to the
- * content resolver for deleting rows from the database.
- * - `getContentResolver()`: This is a method that returns an instance of
- * `android.content.ContentResolver`, which is used to access the content provider
- * for deleting rows from the database.
- * - `delete()`: This is a method that deletes rows from the database based on the
- * provided `Uri`.
- * - `null`: This is a null object that is passed as the first parameter to the
- * `delete()` method.
- * - `null`: This is a null object that is passed as the second parameter to the
- * `delete()` method.
- *
- * The function returns a boolean value indicating whether the rows were deleted successfully.
- *
- * @returns a boolean value indicating whether the scheduled sensable was successfully
- * deleted.
+ * Removes a scheduled sensable from the scheduler by deleting its corresponding entry
+ * from the content provider. It returns true if the deletion is successful, and false
+ * otherwise.
+ *
+ * @param scheduledSensable ScheduledSensable object whose ID is used to delete the
+ * corresponding row from the content provider.
+ *
+ * @returns a boolean value indicating deletion success.
*/
public boolean removeSensableFromScheduler(ScheduledSensable scheduledSensable) {
int rowsDeleted = context.getContentResolver().delete(Uri.parse(ScheduledSensableContentProvider.CONTENT_URI + "/" + scheduledSensable.getId()), null, null);
@@ -184,18 +146,13 @@ public boolean removeSensableFromScheduler(ScheduledSensable scheduledSensable)
}
/**
- * sets the "pending" status of a `ScheduledSensable` object to 1 and then updates
- * the sensors sender with the new status.
- *
- * @param scheduledSensable sensable that is marked as pending to be sent, and its
- * value of 1 indicates that it is currently pending.
- *
- * - `setPending(1)`: Sets the `pending` attribute of the object to `1`.
- * - `updateSensableSender()`: Calls the `updateSensableSender` function, which is
- * not provided in the code snippet.
- *
- * @returns a boolean value indicating whether the scheduled sensable was successfully
- * updated.
+ * Sets the `pending` field of a `ScheduledSensable` object to 1 and updates a `sensable
+ * sender`. It returns a boolean value indicating whether the update was successful.
+ *
+ * @param scheduledSensable object that needs to have its pending status set and then
+ * updated by calling the `updateSensableSender` method.
+ *
+ * @returns a boolean value indicating successful or unsuccessful processing.
*/
public boolean setSensablePending(ScheduledSensable scheduledSensable) {
scheduledSensable.setPending(1);
@@ -203,19 +160,13 @@ public boolean setSensablePending(ScheduledSensable scheduledSensable) {
}
/**
- * updates a scheduled sensory and sets its pending to zero, after which it sends the
- * update to the sensory sender.
- *
- * @param scheduledSensable sensibility that is being unset, and it is passed to the
- * `updateSensableSender()` method for further processing.
- *
- * - `scheduledSensable`: This is an instance of the class `ScheduledSensable`, which
- * contains a single attribute called `pending`. The value of this attribute can be
- * either 0 or 1, representing whether the sensation is pending or not.
- * - `setPending(int newValue)`: This method sets the value of the `pending` attribute
- * to the argument `newValue`.
- *
- * @returns a boolean value indicating whether the sensable was successfully updated.
+ * Sets the pending value of a ScheduledSensable object to 0 and then calls the
+ * `updateSensableSender` method with the updated object, returning its result.
+ *
+ * @param scheduledSensable object whose pending status is being unset and updated
+ * for sending to a sensable sender.
+ *
+ * @returns a boolean value indicating the result of updating the sensable sender.
*/
public boolean unsetSensablePending(ScheduledSensable scheduledSensable) {
scheduledSensable.setPending(0);
@@ -223,24 +174,18 @@ public boolean unsetSensablePending(ScheduledSensable scheduledSensable) {
}
/**
- * updates a scheduled sensation's row in a SQL Lite database and also updates a
- * related favourite object if available.
- *
- * @param scheduledSensable content to be updated in the database, which is serialized
- * and passed as a ContentValues object to the update method.
- *
- * - `Uri updateUri`: The content URI for the scheduled sensables table, which is
- * used as the update target in the database.
- * - `ContentValues mNewValues`: A serialized representation of the `scheduledSensable`
- * object, created using `ScheduledSensablesTable.serializeScheduledSensableForSqlLite()`.
- * This value is used to update the scheduled sensable record in the database.
- * - `int rowsUpdated`: The number of rows updated in the database after executing
- * the `update()` method.
- * - `context`: A reference to the context object, which provides access to the
- * content resolver and other resources needed for the update operation.
- *
- * @returns a boolean value indicating whether the scheduled sensable was successfully
- * updated.
+ * Updates a scheduled sensable record in a SQLite database by serializing the object
+ * into ContentValues, then updating the corresponding Uri with these values. The
+ * function returns true if the update is successful and false otherwise.
+ *
+ * @param scheduledSensable scheduled sensable object to be updated in the SQLite
+ * database and its serialized values are used to update the corresponding record in
+ * the database.
+ *
+ * SerializeScheduledSensableForSqlLite returns ContentValues with serialized data
+ * from ScheduledSensable.
+ *
+ * @returns a boolean indicating whether any rows were updated.
*/
private boolean updateSensableSender(ScheduledSensable scheduledSensable) {
ContentValues mNewValues = ScheduledSensablesTable.serializeScheduledSensableForSqlLite(scheduledSensable);
@@ -260,30 +205,17 @@ private boolean updateSensableSender(ScheduledSensable scheduledSensable) {
}
/**
- * updates a scheduled sensable's favorite status by checking if it is already
- * favourited and updating its favorite sample if necessary.
- *
- * @param scheduledSensable sensable that needs to be updated as the user's favourite.
- *
- * - `getSensorid()`: returns the sensor ID of the scheduled sensing event
- * - `getSample()`: returns the sample data associated with the scheduled sensing event
- *
- * The function then performs the following operations:
- *
- * 1/ Retrieves the count of favourited samples for the specified sensor ID using a
- * query on the `SavedSensablesTable` content resolver.
- * 2/ If the count is greater than 0, it means that the sensor ID is already favourited.
- * 3/ Creates a new `Sensable` object with the same sensor ID and sample data as the
- * input `scheduledSensable`.
- * 4/ Serializes the `Sensable` object into a `ContentValues` object for storage in
- * the SQL Lite database.
- * 5/ Updates the favourite sample using the `update()` method of the content resolver,
- * passing in the favourite URI, the serialized `ContentValues` object, and the null
- * values array.
- * 6/ Returns the number of rows updated successfully.
- *
- * @returns a boolean value indicating whether the specified sensor was updated as a
- * favourite.
+ * Checks if a scheduled sensable is also favourited. If it is, updates the favourite
+ * sample and returns true; otherwise, returns false.
+ *
+ * @param scheduledSensable sensor data to be processed and potentially updated as a
+ * favourite sample in the system.
+ *
+ * Extracted from `scheduledSensable`:
+ * - Sensorid
+ * - Sample
+ *
+ * @returns a boolean value indicating update success.
*/
private boolean updateFavouriteIfAvailable(ScheduledSensable scheduledSensable) {
diff --git a/client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java b/client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java
index 79eb4f7..a569a1c 100644
--- a/client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java
+++ b/client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java
@@ -30,14 +30,10 @@
import java.util.List;
/**
- * is an Android service that extends Service and is responsible for sampling sensors
- * based on a schedule. The service gets the sensor manager and sensor from the system,
- * registers a listener to receive sensor data, and schedules the sensor to be sampled
- * at a later time using a scheduler. When the sensor data is received, it creates a
- * new sample object with the timestamp, sensor value, and location (if available).
- * The service then updates the scheduled sensable object with the new sample and
- * saves it to the database. Finally, the service stops the sensor listener and
- * scheduler if no more samples are needed.
+ * Is an Android service responsible for sampling sensors based on scheduled tasks
+ * and sending sensor data to a remote server for analysis. It uses the SensorManager
+ * API to register listeners on sensors, retrieves user location using the LocationManager
+ * API, and stores user access tokens in shared preferences.
*/
public class ScheduledSensableService extends Service {
@@ -47,27 +43,27 @@ public class ScheduledSensableService extends Service {
private Sensor sensor = null;
/**
- * starts a service, initializes a sensor manager, and registers listeners on sensors
- * to collect data from scheduled sensables.
- *
- * @param intent start command for the service, which is used to initiate the startup
- * process.
- *
- * - `intent`: The Intent object that starts the service. It contains information
- * about why the service is being started and what it should do when it is started.
- * - `flags`: An integer value that represents the reason why the service was started.
- * This can be one of the following values: `START_STICKY`, `START_NOT_COOKIE`, or `START_COOKIE`.
- * - `startId`: A unique identifier for the start request, used to identify the
- * request and handle it appropriately.
- *
- * @param flags 3-bit value that indicates whether the service should be started in
- * the foreground or background, with possible values of 0 (background), 1 (foreground),
- * or 2 (persistent).
- *
- * @param startId ID of the service that started the `onStartCommand()` method execution
- * and is used to identify the service instance for further operations.
- *
- * @returns a sticky start result of START_STICKY.
+ * Initializes and starts a service that schedules sensors to monitor specific tasks
+ * based on data retrieved from a database. It registers listeners for each sensor,
+ * marks scheduled tasks as pending, and stops unnecessary scheduling processes.
+ *
+ * @param intent Intent that was used to start the service, allowing it to retrieve
+ * any data or commands that were included with the Intent when it was started.
+ *
+ * The `intent` object has no specific deconstruction as its usage is not relevant
+ * in this context.
+ *
+ * @param flags flags associated with the start command, which can be used to control
+ * the behavior of the service's lifecycle management and interaction with other components.
+ *
+ * @param startId 32-bit identifier that uniquely identifies the service, allowing
+ * it to be restarted if terminated by the system.
+ *
+ * @returns a code indicating the service's status.
+ *
+ * The function returns an integer value indicating the state of the service's command.
+ * The START_STICKY constant is used to indicate that this service will be restarted
+ * if the system terminates it while it is in the foreground.
*/
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
@@ -96,77 +92,47 @@ public int onStartCommand(Intent intent, int flags, int startId) {
}
/**
- * creates a SensorEventListener instance that listens for sensor changes and saves
- * them to a ScheduledSensable object. It also stops the sensor and service when no
- * more samples are pending.
- *
- * @param scheduledSensable ScheduledSensable object that contains the sensor data
- * to be processed and saved, and is used to update its location and sample fields
- * before saving it to the service.
- *
- * - `scheduledSensable`: This is the scheduled sensable object that contains
- * information about the sensor, location, and sample data. It has various
- * attributes/properties such as `sensorid`, `location`, `sample`, `sensortype`,
- * `unit`, `privatesensor`, `accesstoken`, and `scheduleid`.
- * - `sensorid`: This is the unique identifier of the sensor associated with the
- * scheduled sensable task.
- * - `location`: This is the current location of the device, which can be a latitude
- * and longitude pair.
- * - `sample`: This is the sample data generated by the sensor, which includes the
- * timestamp, value, and other metadata.
- * - `sensortype`: This is the type of sensor associated with the scheduled sensable
- * task.
- * - `unit`: This is the unit of measurement for the sensor data.
- * - `privatesensor`: This is a boolean flag indicating whether the sensor is private
- * or not.
- * - `accesstoken`: This is the access token required to post the sample data to the
- * server.
- * - `scheduleid`: This is the unique identifier of the scheduled sensable task.
- *
- * @returns a SensorEventListener that listens to sensor changes and saves them to a
- * remote service.
- *
- * - `scheduledSensable`: This is an instance of the `ScheduledSensable` class, which
- * contains information about the scheduled sampling task.
- * - `sample`: This is a sample object that represents the sensor data. It has several
- * attributes, including `timestamp`, `value`, `location`, and `sensortype`.
- * - `lastKnownLocation`: This is a `Location` object that represents the last known
- * location of the device.
- * - `getUserAccessToken`: This is a method that returns a token used to authenticate
- * requests to the Sensable API.
- * - `service`: This is an instance of the `RestAdapter` class, which provides a way
- * to interact with the Sensable API.
- * - `sampleSender`: This is an object that encapsulates the logic for sending sensor
- * data to the Sensable API. It has methods for setting the access token and sample
- * data.
- * - `scheduleHelper`: This is an instance of the `ScheduleHelper` class, which
- * provides utilities for managing scheduling tasks.
- * - `countPendingScheduledTasks`: This is a method that returns the number of pending
- * scheduled tasks.
- * - `stopSelf`: This is a method that stops the sampling task and service.
- * - `scheduleHelper.stopSchedulerIfNotNeeded`: This is a method that stops the
- * scheduler if it is not needed.
+ * Returns a `SensorEventListener` that handles sensor data changes and saves them
+ * to a remote service for analysis. It creates a sample object, formats values,
+ * attaches location data, and updates a Scheduled object before stopping the sensor
+ * and service if no more tasks are pending.
+ *
+ * @param scheduledSensable Scheduled object that is updated with the sensor ID,
+ * sample values, and other metadata before stopping the sensor and service if no
+ * more tasks are pending.
+ *
+ * - Location: double array representing longitude and latitude.
+ * - Sample: an object with timestamp, values (event.values[0]), location, and other
+ * metadata.
+ * - Sensor type: name of the sensor.
+ * - Internal Sensor ID: the type of internal sensor.
+ * - Unit: determined by SensorHelper.
+ * - Private Sensor: a boolean indicating whether it is private or not.
+ * - Access token: obtained from getUserAccessToken.
+ *
+ * @returns a `SensorEventListener`.
+ *
+ * It returns an instance of SensorEventListener, which includes two methods:
+ * onSensorChanged() and onAccuracyChanged(). The onSensorChanged() method handles
+ * sensor data received from a listener and saves it to a remote service for analysis.
+ * It creates a sample object, formats its values, and attaches location data before
+ * sending it to the service for storage.
*/
private SensorEventListener getListener(final ScheduledSensable scheduledSensable) {
return new SensorEventListener() {
/**
- * handles sensor data received from a listener and saves it to a remote service for
- * analysis. It creates a sample object, formats its values, and attaches location
- * data before sending it to the service for storage. The function also updates a
- * Scheduled object with the sensor ID, sample values, and other metadata before
- * stopping the sensor and service if no more tasks are pending.
- *
- * @param event event that triggered the onSensorChanged() method and contains
- * information about the sensor value change, which is used to create a sample object
- * and send it to the Sensable service for processing.
- *
- * - `sensor`: The sensor that triggered the callback, providing information about
- * the changed value.
- * - `values`: An array of values representing the raw data from the sensor.
- * - `timestamp`: The timestamp when the sensor was last updated.
- *
- * Note that the `event` object may also contain other properties or attributes
- * depending on the specific sensor and implementation used.
+ * Handles sensor data changes by logging the event, creating a sample object and
+ * sending it to a remote server using Retrofit, and then unregisters the sensor
+ * listener and stops the service if there are no more pending tasks.
+ *
+ * @param event 3D sensor data changed event, which contains information about the
+ * sensor type and its values.
+ *
+ * - `SensorEvent event`: The event contains sensor data and information about the
+ * sensor that triggered the event. The main properties include:
+ * - `values`: An array of float values representing the raw sensor data.
+ * - `sensor`: A `Sensor` object providing metadata about the sensor that triggered
+ * this event, such as its name and type.
*/
@Override
public void onSensorChanged(SensorEvent event) {
@@ -208,21 +174,13 @@ public void onSensorChanged(SensorEvent event) {
Log.d(TAG, "Saving sample: " + event.sensor.getName() + " : " + event.values[0]);
service.saveSample(scheduledSensable.getSensorid(), sampleSender, new Callback() {
/**
- * is called when a sample is posted successfully. It logs a message to the debug log
- * indicating that the sample was successfully posted.
- *
- * @param success successful posting of a sample.
- *
- * - `success`: A `SampleResponse` object that represents the successful post request.
- * It contains information about the posted sample, such as its ID and name.
- *
- * @param response result of the API call made by the `postSample` method, which
- * contains information about the success or failure of the sample posting operation.
- *
- * - `success`: A boolean indicating whether the posting was successful (true) or
- * not (false).
- * - `response`: A JSON object representing the response from the server, containing
- * various attributes such as error messages or HTTP status codes.
+ * Logs a debug message indicating successful posting of a sample to the Android
+ * logcat with the specified TAG.
+ *
+ * @param success SampleResponse object returned as a result of successful posting operation.
+ *
+ * @param response HTTP response object that contains information about the HTTP
+ * request, including its status code and headers.
*/
@Override
public void success(SampleResponse success, Response response) {
@@ -230,14 +188,13 @@ public void success(SampleResponse success, Response response) {
}
/**
- * is called when a failure occurs during the posting of a sample. It logs an error
- * message with the tag `TAG`.
- *
- * @param retrofitError error that occurred during the API call, which is logged to
- * the app's logcat using the `Log.e()` method.
- *
- * - `toString()` returns a string representation of the error object, which can be
- * used for logging or further analysis.
+ * Logs an error message when a request made by Retrofit fails to complete successfully.
+ * It takes a `RetrofitError` object as input, which provides information about the
+ * failure. The error message includes the `TAG` and a string representation of the
+ * `retrofitError`.
+ *
+ * @param retrofitError exception or error that occurred during the execution of the
+ * Retrofit request, providing detailed information about the failure.
*/
@Override
public void failure(RetrofitError retrofitError) {
@@ -257,16 +214,16 @@ public void failure(RetrofitError retrofitError) {
}
/**
- * is called when the accuracy of a sensor changes. It does not provide any information
- * or take any action related to the changed accuracy.
- *
- * @param sensor sensor that has its accuracy changed through the call to the
- * `onAccuracyChanged()` method.
- *
- * - `sensor`: A class that represents a sensor, providing information about its accuracy.
- * - `accuracy`: An integer representing the level of accuracy of the sensor's readings.
- *
- * @param accuracy level of accuracy achieved by the sensor after filtering or correction.
+ * Monitors changes to the accuracy level of a sensor. It is triggered when the
+ * accuracy level of a sensor varies, providing information about the sensor's current
+ * accuracy status. The function takes two parameters: the sensor that has experienced
+ * an accuracy change and the new accuracy level.
+ *
+ * @param sensor sensor whose accuracy has changed, providing information about the
+ * specific sensor being monitored.
+ *
+ * @param accuracy level of accuracy reported by the sensor, with higher values
+ * indicating better accuracy and lower values indicating worse accuracy.
*/
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
@@ -276,27 +233,15 @@ public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
/**
- * returns a null `IBinder`, indicating that no binding is required for the specified
- * `Intent`.
- *
- * @param intent binding request from an activity or service that is being handled
- * by the `onBind()` method.
- *
- * - It is an instance of `Intent`, which is a class representing an intent.
- * - The `intent` object contains information about the activity or action that
- * triggered its creation, as well as any data to be passed to the new activity or
- * service when it is started using the `startActivity()` or `startService()` method.
- * - `onBind` is called when the system needs to bind an `IBinder` instance to a
- * specific component (e.g., an activity or service) so that it can communicate with
- * that component.
- *
- * @returns `null`.
- *
- * - The output is an `IBinder` object, which represents a binding between a client
- * and a service.
- * - The `onBind` method returns null, indicating that no binder is provided for
- * this component.
- * - This means that there is no way to bind to the service offered by this component.
+ * Binds a client to a specific interface of a service and returns an `IBinder` object
+ * representing that interface. This implementation returns null, indicating that the
+ * service does not provide any binding interfaces. The client will be unable to bind
+ * to this service.
+ *
+ * @param intent Intent object that contains the action to be performed and any
+ * additional data required for processing.
+ *
+ * @returns a null object of type `IBinder`.
*/
@Override
public IBinder onBind(Intent intent) {
@@ -305,25 +250,16 @@ public IBinder onBind(Intent intent) {
/**
- * retrieves and returns an access token for a user based on their logged-in status
- * and saved credentials.
- *
- * @returns a valid access token for the user.
- *
- * - `accessToken`: This is the access token obtained from the user's preferences.
- * It is a string value that represents the user's access token.
- * - `hasAccessToken`: This is a boolean value that indicates whether an access token
- * is available for the user. If it is set to true, then an access token is available,
- * and if it is set to false, then no access token is available.
- * - `loggedIn`: This is a boolean value that indicates whether the user is logged
- * in or not. If it is set to true, then the user is logged in, and if it is set to
- * false, then the user is not logged in.
- * - `username`: This is the username associated with the user's access token. It
- * is a string value that represents the user's username.
- *
- * These properties provide information about the user's access token and their login
- * status, which can be used to determine whether the user has access to certain
- * resources or features.
+ * Retrieves the user's access token from shared preferences if the user is logged
+ * in and has an access token. If not, it returns an empty string. The function logs
+ * debug messages with user credentials for verification purposes.
+ *
+ * @returns either an access token or an empty string.
+ *
+ * Returns a String representing the user's access token if logged in and has an
+ * access token; otherwise, returns an empty string. The output can be further
+ * deconstructed into two possible cases: either it contains the actual access token
+ * or it is an empty string.
*/
private String getUserAccessToken() {
SensableUser user = new SensableUser(this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE), this);
@@ -350,18 +286,11 @@ private String getUserAccessToken() {
}
/**
- * retrieves the user's current location using the Android Location Manager. It returns
- * the last known location obtained from the network provider.
- *
- * @returns a `Location` object representing the device's current location, obtained
- * from the system-provided Location Manager.
- *
- * The function returns a `Location` object representing the current location of the
- * device.
- * The `LocationManager` is used to retrieve the last known location of the device
- * using the `NETWORK_PROVIDER`.
- * The returned `Location` object contains information such as latitude, longitude,
- * altitude, and accuracy.
+ * Retrieves the last known location from a network provider using a Location Manager
+ * service provided by the Android system. It returns the current location, which may
+ * not be accurate or up-to-date. The result is passed as an object of type `Location`.
+ *
+ * @returns a `Location` object containing the last known location.
*/
private Location getLocation() {
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
diff --git a/client/src/main/java/io/sensable/client/settings/Config.java b/client/src/main/java/io/sensable/client/settings/Config.java
index b2f046a..222f19f 100644
--- a/client/src/main/java/io/sensable/client/settings/Config.java
+++ b/client/src/main/java/io/sensable/client/settings/Config.java
@@ -11,15 +11,16 @@
* @author mmarcon
*/
/**
- * provides static final strings for filenames of an SQLite database and a dump of
- * the database, as well as a version number for the database.
- * Fields:
- * - SENSABLE_STORAGE_DB (String): the filename of an on-disk SQLite database where
- * rule repository, item cache, and potentially other structured data will be stored.
- * - SENSABLE_STORAGE_DB_DUMP (String): the filename for an on-disk SQLite database
- * dump used for debugging purposes.
- * - SENSABLE_STORAGE_DB_VERSION (int): the current version of the SQLite database
- * used by the sensable client settings.
+ * Holds static final variables for SQLite database filename, its dump filename and
+ * version number.
+ *
+ * - SENSABLE_STORAGE_DB (String): represents the filename for an on-disk SQLite database.
+ *
+ * - SENSABLE_STORAGE_DB_DUMP (String): specifies the filename for an on-disk dump
+ * of the SQLite database used for debugging purposes.
+ *
+ * - SENSABLE_STORAGE_DB_VERSION (int): represents the current version of the SQLite
+ * database used by the sensable client settings.
*/
public class Config {
diff --git a/client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java b/client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java
index b00307d..83fb1ba 100644
--- a/client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java
+++ b/client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java
@@ -12,10 +12,9 @@
* Created by madine on 03/07/14.
*/
/**
- * is used to store and manage sensor data in a SQLite database. It has various columns
- * for storing location, sensor ID, sensor type, name, and last sample information.
- * The class also provides methods for serializing and deserializing the sensor data
- * into JSON format for efficient storage and retrieval.
+ * Is responsible for managing sensor data in a SQLite database. It provides methods
+ * to create and upgrade the database schema, serialize and deserialize Sensable
+ * objects, and retrieve Sensable objects from a cursor.
*/
public class SavedSensablesTable {
@@ -41,15 +40,13 @@ public class SavedSensablesTable {
/**
- * executes a SQL statement to create the database schema when the application starts.
- *
- * @param database SQLite Database object that is being executed by the function.
- *
- * - `SQLiteDatabase`: The database class that provides methods for managing SQLite
- * databases.
- * - `execSQL()`: A method that executes SQL commands on the database.
- * - `DATABASE_CREATE`: The SQL command that is executed, which creates the database
- * if it does not already exist.
+ * Executes a SQL statement to create a table in a SQLite database when it is first
+ * created. The SQL statement is stored in the `DATABASE_CREATE` variable and is
+ * executed on the provided `SQLiteDatabase`. This function initializes the database
+ * with the specified schema.
+ *
+ * @param database SQLiteDatabase object that is passed to the onCreate method,
+ * allowing the method to execute SQL commands on it.
*/
public static void onCreate(SQLiteDatabase database) {
database.execSQL(DATABASE_CREATE);
@@ -57,21 +54,20 @@ public static void onCreate(SQLiteDatabase database) {
// TODO: make it smarter
/**
- * drops an existing table named `NAME` and then calls the `onCreate` function to
- * create a new table with the same name.
- *
- * @param database SQLiteDatabase object that is being upgraded, and it is used to
- * execute SQL commands on the database.
- *
- * - `database`: A SQLiteDatabase object that represents the database to be upgraded.
- * - `oldVersion`: An integer representing the previous version number of the database.
- * - `newVersion`: An integer representing the current version number of the database.
- *
- * @param oldVersion previous version of the database, which is used to determine
- * whether an upgrade is necessary.
- *
- * @param newVersion version of the application that is being upgraded, and it is
- * used to determine whether the database schema needs to be updated or not.
+ * Drops an existing table and recreates it if a schema change occurs during the
+ * upgrade process of a SQLite database. It uses the `execSQL` method to execute SQL
+ * statements for dropping the table and then calls the `onCreate` function to recreate
+ * the table structure.
+ *
+ * @param database SQLiteDatabase object that is being upgraded or created, allowing
+ * for execution of SQL statements and other database operations.
+ *
+ * @param oldVersion previous version of the database schema that was used prior to
+ * the current upgrade operation, allowing the function to determine what changes
+ * need to be made to bring it up to date with the new schema specified by `newVersion`.
+ *
+ * @param newVersion current version of the database schema, which is used to determine
+ * whether any changes have been made and if so, the necessary actions are taken accordingly.
*/
public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
database.execSQL("DROP TABLE IF EXISTS " + NAME);
@@ -79,46 +75,23 @@ public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVer
}
/**
- * converts a `Sensable` object into a `ContentValues` instance, which can be used
- * for storing or retrieving data from a SQLite database. It sets values for columns
- * such as `COLUMN_LOCATION_LATITUDE`, `COLUMN_LOCATION_LONGITUDE`, `COLUMN_SENSOR_ID`,
- * `COLUMN_SENSOR_TYPE`, `COLUMN_NAME`, `COLUMN_LAST_SAMPLE`, and `COLUMN_UNIT`.
- *
- * @param sensable Sensible object that contains information about the sensor, including
- * its location, sensor ID, sensor type, name, last sample, and unit of measurement.
- *
- * - ` COLUMN_LOCATION_LATITUDE`: The latitude value of the location associated with
- * the sensable.
- * - `COLUMN_LOCATION_LONGITUDE`: The longitude value of the location associated
- * with the sensable.
- * - `COLUMN_SENSOR_ID`: The ID of the sensor that generated the sensable data.
- * - `COLUMN_SENSOR_TYPE`: The type of sensor that generated the sensable data (e.g.,
- * accelerometer, gyroscope, etc.).
- * - `COLUMN_NAME`: The name of the sensable.
- * - `COLUMN_LAST_SAMPLE`: The last sample value of the sensable as a JSON string.
- * - `COLUMN_UNIT`: The unit of measurement for the sensable data.
- *
- * @returns a ContentValues object containing the serialized sensable data.
- *
- * - `ContentValues serializedSensable`: This is an instance of the `ContentValues`
- * class, which represents a set of key-value pairs for a SQLite database.
- * - `put()` methods: The `put()` methods are used to associate a key with a value
- * in the `ContentValues` object. In this case, the keys are the column names in the
- * SQLite table, and the values are the serialized values of the `Sensable` object.
- * - `COLUMN_LOCATION_LATITUDE`, `COLUMN_LOCATION_LONGITUDE`, `COLUMN_SENSOR_ID`,
- * `COLUMN_SENSOR_TYPE`, `COLUMN_NAME`, `COLUMN_LAST_SAMPLE`, and `COLUMN_UNIT`: These
- * are the column names in the SQLite table, representing the different attributes
- * of the `Sensable` object.
- * - `sensable.getLocation()[0]`, `sensable.getLocation()[1]`: These are methods
- * that return the latitude and longitude values of the `Sensable` object, respectively.
- * - `sensable.getSampleAsJsonString()`: This is a method that returns the sample
- * value of the `Sensable` object as a JSON string.
- * - `sensable.getSensorid()`: This is a method that returns the sensor ID of the
- * `Sensable` object.
- * - `sensable.getSensortype()`: This is a method that returns the sensor type of
- * the `Sensable` object.
- * - `sensable.getName()`: This is a method that returns the name of the `Sensable`
- * object.
+ * Creates a ContentValues object to store sensor data. It populates the object with
+ * various properties of a Sensable object, including location coordinates, sensor
+ * ID, type, name, last sample, and unit, transforming JSON-formatted samples into
+ * SQL-compatible values.
+ *
+ * @param sensable object being serialized into a ContentValues object for storage
+ * in SQLite database.
+ *
+ * The object has location with latitude and longitude coordinates, sensor ID, sensor
+ * type, name, last sample as JSON string, and unit. These properties are serialized
+ * into a ContentValues object.
+ *
+ * @returns a ContentValues object with various sensor details.
+ *
+ * The output is an instance of `ContentValues`, which is a key-value pair container
+ * used for storing and retrieving data in SQLite databases. The keys are column
+ * names, and the values are corresponding data elements.
*/
public static ContentValues serializeSensableForSqlLite(Sensable sensable) {
ContentValues serializedSensable = new ContentValues();
@@ -133,27 +106,13 @@ public static ContentValues serializeSensableForSqlLite(Sensable sensable) {
}
/**
- * serializes a `Sensable` object into a ContentValues format for storage in a SQLite
- * database, including the sensor ID and a single sample as a JSON string.
- *
- * @param sensable sensory data that is to be serialized and stored in a SQLite database.
- *
- * - `sensable`: This is an instance of the `Sensable` class, which has a single
- * property - `sensorid`.
- * - `sensorid`: A column name in the serialized data, representing the unique
- * identifier of the sensor.
- *
- * @returns a ContentValues object containing the sensor ID and the last sample as a
- * JSON string.
- *
- * - `ContentValues serializedSensable`: This is an immutable map of key-value pairs
- * representing the sensable data to be stored in a SQLite database. The keys are
- * defined by the `COLUMN_` constants, and the values are the corresponding sensor data.
- * - `serializedSensable.put(COLUMN_SENSOR_ID, sensable.getSensorid())`: This line
- * adds a column named "sensor_id" to the serialized data with the value of `sensable.getSensorid()`.
- * - `serializedSensable.put(COLUMN_LAST_SAMPLE, sensable.getSampleAsJsonString())`:
- * This line adds a column named "last_sample" to the serialized data with the value
- * of `sensable.getSampleAsJsonString()`.
+ * Converts a `Sensable` object into a `ContentValues` object for SQLite database
+ * storage. It takes a `sensable` object as input and populates the `ContentValues`
+ * with its sensor ID and a single sample in JSON format.
+ *
+ * @param sensable object being serialized into a ContentValues instance.
+ *
+ * @returns a ContentValues object.
*/
public static ContentValues serializeSensableWithSingleSampleForSqlLite(Sensable sensable) {
ContentValues serializedSensable = new ContentValues();
@@ -163,52 +122,21 @@ public static ContentValues serializeSensableWithSingleSampleForSqlLite(Sensable
}
/**
- * retrieves a Sensable object from a cursor and populates its fields with values
- * from the cursor, including location, sensor ID, unit, sensor type, last sample (if
- * available), name, and samples.
- *
- * @param cursor Cursor object that contains the data to be retrieved and manipulated
- * by the `getSensable()` method.
- *
- * - `Cursor cursor`: A `Cursor` object that contains the data for the sensable to
- * be constructed.
- * + `getDouble(int columnIndex)`: Retrieves a double value from the specified column
- * index in the cursor.
- * + `getString(int columnIndex)`: Retrieves a string value from the specified column
- * index in the cursor.
- * + `getColumnIndex()`: Returns the index of the column containing the data being
- * retrieved.
- * + `getLastSampleColumnIndex()`: Returns the index of the column containing the
- * last sample data, or -1 if no such column exists.
- * + `getString(int columnIndex)`: Retrieves a string value from the specified column
- * index in the cursor.
- *
- * The function then constructs a new `Sensable` object with the retrieved data,
- * setting the following properties:
- *
- * - `setLocation(double[] location)`: Sets the location of the sensable using the
- * double values retrieved from the cursor.
- * - `setSensorid(String sensorId)`: Sets the ID of the sensor associated with this
- * sensable.
- * - `setUnit(String unit")`: Sets the unit of measurement for this sensable.
- * - `setSensortype(String sensorType")`: Sets the type of sensor associated with
- * this sensable.
- * - `setName(String name)`: Sets the name of the sensable.
- *
- * Finally, the function returns the constructed `Sensable` object.
- *
- * @returns a Sensable object containing location, sensor ID, unit, sensor type, and
- * samples data.
- *
- * - `sensable`: A `Sensable` object representing the sensory data.
- * + `setLocation()` sets the location of the sensory data using two doubles
- * representing latitude and longitude.
- * + `setSensorid()`, `setUnit()`, and `setSensortype()` set the sensor ID, unit,
- * and sensor type, respectively, using string values.
- * + `setLastSample()` sets a JSON object containing the last sample of sensory data
- * using a string value.
- * + `getSamples()` returns an array of `Sample` objects representing the sensory data.
- * + `getName()` returns the name of the sensory data using a string value.
+ * Extracts data from a database cursor and populates a `Sensable` object with location,
+ * sensor ID, unit, sensor type, last sample, and name information. It also handles
+ * parsing a JSON string to create a `Sample` object if available in the database.
+ *
+ * @param cursor ursor object that retrieves data from the database table and provides
+ * values to populate the `Sensable` object properties.
+ *
+ * Moves to a specific column by index or name. Returns -1 if the column does not exist.
+ *
+ * @returns an instance of class `Sensable`.
+ *
+ * The output is an object of type `Sensable`. It has a location property with latitude
+ * and longitude values, a sensor ID string, a unit string, a sensor type string, a
+ * sample array containing a single `Sample` object or an empty array if no sample
+ * exists, and a name string.
*/
public static Sensable getSensable(Cursor cursor) {
Sensable sensable = new Sensable();
diff --git a/client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java b/client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java
index b4df975..902d191 100644
--- a/client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java
+++ b/client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java
@@ -15,9 +15,10 @@
import android.util.Log;
/**
- * is responsible for managing data related to scheduled sensables. It provides
- * functions for querying, inserting, updating, and deleting data in the database.
- * The provider also handles notifications of changes to the data.
+ * Provides CRUD (Create, Read, Update, Delete) operations for managing scheduled
+ * sensables in a SQLite database. It extends the ContentProvider class and implements
+ * the necessary methods to interact with the database. The provider uses a UriMatcher
+ * to match incoming URIs and perform the corresponding operations on the database.
*/
public class ScheduledSensableContentProvider extends ContentProvider {
@@ -43,10 +44,11 @@ public class ScheduledSensableContentProvider extends ContentProvider {
private SensableDatabaseHelper dbHelper;
/**
- * retrieves a database helper instance and logs its details to the console.
- *
- * @returns a message indicating the successful creation of a database helper object
- * and its associated log entry.
+ * Initializes a database helper object from the context and logs its string
+ * representation to the debug log. It then returns `false`, indicating that the
+ * activity has not been successfully created.
+ *
+ * @returns a log message with the string representation of the `SensibleDatabaseHelper`.
*/
@Override
public boolean onCreate() {
@@ -56,78 +58,39 @@ public boolean onCreate() {
}
/**
- * queries the scheduled sensables table based on a given URI and filters the results
- * using a selection clause. It returns a cursor object representing the result set.
- *
- * @param uri URI that the query will be executed for, and it is used to determine
- * which table to query and which rows to retrieve.
- *
- * - `sURIMatcher.match(uri)` returns an integer value that identifies the URI type,
- * which is used to switch between different queries.
- * - `ScheduledSensablesTable.NAME` refers to the name of the table in the database
- * where scheduled sensibles are stored.
- * - `ScheduledSensablesTable.COLUMN_SENSABLE_ID` and `ScheduledSensablesTable.COLUMN_PENDING`
- * refer to specific columns in the `ScheduledSensablesTable`.
- * - `projection` is an array of strings that specify which columns from the table
- * are needed in the cursor returned by the function.
- * - `selection` is a string that specifies a condition for filtering the rows in
- * the table, based on the values in the specified columns.
- * - `selectionArgs` is an array of strings that contain the actual values to be
- * used in the selection clause.
- * - `sortOrder` is a string that specifies the sort order of the results returned
- * by the function.
- *
- * @param projection list of columns to be returned by the query.
- *
- * - `ScheduledSensablesTable.NAME`: The table name where the data is stored.
- * - `COLUMN_SENSABLE_ID`: The column name for the sensable ID.
- * - `COLUMN_PENDING`: The column name for the pending status.
- * - `selection`: An optional selection clause that filters the rows based on a condition.
- * - `selectionArgs`: An array of selection arguments that are used in the selection
- * clause.
- * - `sortOrder`: The sort order of the query results, which determines the order
- * in which the results are returned.
- *
- * @param selection condition for which rows to retrieve from the database, and it
- * is appended to the WHERE clause of the SQL query built by the `SQLiteQueryBuilder`.
- *
- * @param selectionArgs values that are used to modify the selection clause of the
- * SQL query, allowing for more complex filtering of data based on the value of the
- * `uri` parameter.
- *
- * - `selectionArgs`: A string array containing the arguments for the SQL query's
- * WHERE clause. The values in this array will be used as the parameters in the WHERE
- * clause, separated by commas.
- * - `sortOrder`: A string representing the sort order for the returned data. This
- * can be one of the following: "ASC" (ascending) or "DESC" (descending).
- *
- * @param sortOrder 1-based index of the sort column, which determines the order of
- * the sorted results returned by the query.
- *
- * @returns a Cursor object containing data from the scheduled sensables table based
- * on the provided Uri and selection criteria.
- *
- * - `cursor`: A Cursor object that represents a result set from the query. It
- * contains information about the rows in the result set, such as the column names
- * and values.
- * - `projection`: An array of strings that specify which columns to include in the
- * result set.
- * - `selection`: A string that specifies a filter or condition for selecting rows
- * from the table.
- * - `selectionArgs`: An array of strings that contain values for the selection criteria.
- * - `sortOrder`: A string that specifies the order of the results, such as "ascending"
- * or "descending".
- *
- * The function first constructs a SQLiteQueryBuilder object to build the query. It
- * then sets the tables to be queried and appends a filter clause based on the `uriType`
- * variable. The filter clause is constructed using the `ScheduledSensablesTable`
- * columns and the value of `uri.getLastPathSegment()`.
- *
- * Next, the function creates a writable SQLite database instance and builds the query
- * using the query builder. The resulting SQL query is logged to the debug log.
- * Finally, the function returns a Cursor object that represents the result set of
- * the query. The Cursor has a notification URI set to the content resolver of the
- * activity, which allows it to be notified when the data changes.
+ * Executes a SQL query on a SQLite database based on the provided URI and parameters.
+ * It retrieves data from the `ScheduledSensablesTable` table, filters it according
+ * to the given selection criteria, and returns the result as a `Cursor`.
+ *
+ * @param uri URI of the data to be queried and is used to determine which specific
+ * rows to retrieve from the database based on its path segment, allowing for filtering
+ * by sender ID or pending status.
+ *
+ * Matches a specific URI pattern based on the authority and path. The matched result
+ * is stored in `uriType`.
+ *
+ * @param projection list of columns to include in the query results, which determines
+ * what data is returned by the SQLite database.
+ *
+ * String array containing column names from the database that should be included in
+ * the query result.
+ *
+ * @param selection WHERE clause of the SQL query that filters the data to be retrieved
+ * from the database based on specific conditions or constraints.
+ *
+ * @param selectionArgs values to replace any '?' wildcard characters in the selection
+ * string, allowing for flexible query conditions.
+ *
+ * It is an array of strings that can be used to fill-in '?' placeholders in the
+ * selection string. The length of the array must match the number of '?' placeholders.
+ *
+ * @param sortOrder SQL statement used to sort the query results, allowing for
+ * customized sorting of the data returned by the query.
+ *
+ * @returns a Cursor object containing data from the ScheduledSensablesTable.
+ *
+ * Cursor contains a query result set for ScheduledSensablesTable based on the specified
+ * Uri, projection, selection, and sort order.
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection,
@@ -160,16 +123,16 @@ public Cursor query(Uri uri, String[] projection, String selection,
}
/**
- * returns a `String` representing the type of a given `Uri`. It returns `null` if
- * the `Uri` cannot be determined.
- *
- * @param uri Android package's Uri object that is passed to the function, providing
- * the information for the getType method to return the appropriate type.
- *
- * - `Uri`: This is the input parameter for this function. It represents a Uri object
- * containing information about a resource on the web or in a specific protocol.
- *
- * @returns null.
+ * Returns a string representing the type of a given URI. It overrides an abstract
+ * method from its superclass, implying it is part of a class implementing a specific
+ * interface or abstract class. The function always returns null, suggesting it may
+ * not be fully implemented or has no meaningful return value.
+ *
+ * @param uri Uniform Resource Identifier of the resource being queried, and its value
+ * is not utilized within the provided implementation of the `getType` method as it
+ * returns null regardless of the URI.
+ *
+ * @returns a null string.
*/
@Override
public String getType(Uri uri) {
@@ -177,65 +140,22 @@ public String getType(Uri uri) {
}
/**
- * inserts new data into a database table based on the URI provided. It first determines
- * the type of the URI, then inserts the data into the appropriate table using a
- * SQLiteDatabase. Finally, it notifies the content resolver of the change and returns
- * the inserted ID as a Uri.
- *
- * @param uri URI to be inserted into the database.
- *
- * - `sURIMatcher.match(uri)`: This method returns the match type of the given `Uri`,
- * which can be one of the constants defined in the `SENSER_URI_MATCHER` class.
- * - `dbHelper`: This is an instance of `SensableDatabaseHelper`, which is a subclass
- * of `ContentObserver`. It is used to interact with the database.
- * - `sqlDB`: This is an instance of `SQLiteDatabase`, which is used to perform
- * database operations.
- * - `ScheduledSensablesTable.NAME`: This is the name of the table in the database
- * where scheduled sensables are stored.
- * - `id`: This variable holds the unique identifier of the newly inserted row in
- * the database.
- * - `getContext()`: This method returns an instance of `Context`, which provides
- * access to the application's resources and functionality.
- * - `CONTENT_URI`: This is a constant that represents the content provider's base
- * URI. It is used to construct the final insertion result.
- *
- * @param values content of the sensable to be inserted, which contains the data for
- * the specific field types defined in the SQLite database table.
- *
- * - `values`: A `ContentValues` object containing data to be inserted into the
- * database. The values in the object correspond to columns in the database table.
- * - `uri`: The original URI of the insertion request, which serves as a reference
- * point for the operation.
- * - `dbHelper`: An instance of `SensableDatabaseHelper`, providing access to the
- * underlying database.
- * - `sqlDB`: A SQLite Database object representing the writable database for the
- * specified table.
- * - `id`: The unique identifier generated by the database upon successful insertion,
- * indicating the newly created row in the table.
- *
- * @returns a new Uri object representing the inserted data.
- *
- * - `Uri`: The inserted Uri is returned as a `Uri` object.
- * - `id`: The unique identifier of the newly inserted row in the database is returned
- * as a long value.
- * - `getContext()`: A reference to the current activity's `Context` object is
- * returned, which can be used to access various resources and functionality within
- * the application.
- * - `CONTENT_URI`: The content resolver's Uri for the inserted row is returned as
- * a string.
- *
- * The properties of the output are explained as follows:
- *
- * - `Uri`: The inserted Uri is returned as a `Uri` object, which can be used to
- * represent the newly inserted data in the application.
- * - `id`: The unique identifier of the newly inserted row in the database is returned
- * as a long value, which can be used to identify the specific row that was inserted.
- * - `getContext()`: A reference to the current activity's `Context` object is
- * returned, which can be used to access various resources and functionality within
- * the application.
- * - `CONTENT_URI`: The content resolver's Uri for the inserted row is returned as
- * a string, which can be used to locate the specific row in the database using the
- * content resolver.
+ * Inserts a new row into the database table corresponding to the provided `Uri`. It
+ * retrieves the `ContentValues` from the `ContentResolver`, matches the `Uri` with
+ * a specific table, and then inserts the values into the matched table.
+ *
+ * @param uri URI of the data to be inserted into the database, which is matched
+ * against the defined URIs to determine the correct table for insertion.
+ *
+ * @param values key-value pairs to be inserted into the database's ScheduledSensablesTable
+ * when matching the URI type to SENDERS.
+ *
+ * Contains key-value pairs represented as a ContentValues object.
+ *
+ * @returns a new Uri representing the inserted row with its ID.
+ *
+ * The output is an instance of Uri class representing the newly inserted data. It
+ * contains the CONTENT_URI and id of the inserted data.
*/
@Override
public Uri insert(Uri uri, ContentValues values) {
@@ -259,36 +179,27 @@ public Uri insert(Uri uri, ContentValues values) {
}
/**
- * deletes data from a SQLite database based on a given URI and selection criteria.
- * It matches the URI to a specific table name and column(s), then deletes rows based
- * on the selection and selection arguments.
- *
- * @param uri Android content provider's Uri object that identifies the table and row
- * to be deleted.
- *
- * - `sURIMatcher.match(uri)` - This method returns the type of the URI based on its
- * structure and contents.
- * - `ScheduledSensablesTable.NAME` - The name of the table where the data is stored.
- * - `ScheduledSensablesTable.COLUMN_ID` - The column in the table that stores the
- * ID of each row.
- * - `selection` and `selectionArgs` - These are the selection criteria and any
- * arguments to use when deleting rows from the table.
- *
- * @param selection condition for which rows to delete from the `ScheduledSensablesTable`.
- *
- * @param selectionArgs 0th column of the selected rows in the `SQLiteDatabase`, which
- * is used to filter the rows that are deleted based on the selection criteria.
- *
- * - `selectionArgs`: An array of strings containing additional criteria for filtering
- * or sorting the data in the database.
- * - `ScheduledSensablesTable.NAME`: The name of the table in the database where the
- * data is stored.
- * - `ScheduledSensablesTable.COLUMN_ID`: The column name for the primary key id in
- * the `ScheduledSensablesTable`.
- * - `ScheduledSensablesTable.COLUMN_ID + "=" + id`: The SQL syntax for filtering
- * rows based on the value of the `id` column.
- *
- * @returns the number of rows deleted from the database.
+ * Deletes data from a SQLite database based on a provided Uri and selection criteria.
+ * It matches the Uri to determine which table to delete from and executes the deletion
+ * query using SQLiteDatabase's `delete` method.
+ *
+ * @param uri URI of the data to be deleted, which determines the type of deletion
+ * operation to perform based on its match with predefined URI patterns.
+ *
+ * Matches with `sURIMatcher` and returns an integer value representing the type of
+ * URI. It can be either SENDERS or SENDER_ID.
+ *
+ * @param selection SQL selection clause that is used to determine which rows to
+ * delete from the database table when executing a DELETE query.
+ *
+ * @param selectionArgs replacement placeholders for the selection clause and is used
+ * to bind actual values from the selection string to replace the placeholders.
+ *
+ * @returns an integer representing the number of rows deleted.
+ *
+ * The function returns an integer value representing the number of rows successfully
+ * deleted from the database. If no rows are affected by the deletion operation, the
+ * function returns zero.
*/
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
@@ -317,43 +228,38 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
}
/**
- * updates the values in a database table based on the given URI and selection criteria.
- * It returns the number of rows updated.
- *
- * @param uri URI of the row to be updated in the database.
- *
- * - `sURIMatcher.match(uri)` returns an integer representing the match type of `uri`.
- * - `ScheduledSensablesTable.NAME` is the name of the table where data is updated.
- * - `selection` and `selectionArgs` are used to filter or update specific rows in
- * the table based on their ID or other attributes.
- * - `id` is a column in the table that represents the unique identifier for each row.
- *
- * @param values update data to be applied to the database.
- *
- * - `ScheduledSensablesTable.NAME`: The table name where the data will be updated.
- * - `ScheduledSensablesTable.COLUMN_ID`: The column name for the unique identifier
- * of the sensable.
- * - `ScheduledSensablesTable.COLUMN_ID + "=" + id`: The selection criteria for
- * updating the data, where `id` is the unique identifier of the sensable.
- * - `selectionArgs`: An array of strings containing additional selection criteria
- * for the update operation.
- *
- * Note that `values` may contain other properties or attributes depending on how it
- * was deserialized from the input.
- *
- * @param selection condition that determines which rows to update in the database
- * based on the provided `values`.
- *
- * @param selectionArgs 2nd argument of the `update()` method and is used to specify
- * additional arguments for the WHERE clause of the SQL query when updating rows in
- * the database based on the specified URI type.
- *
- * - `selectionArgs`: an array of String values that represent the selection criteria
- * for the database query. Each element in the array corresponds to a separate condition
- * in the WHERE clause of the query.
- *
- * @returns the number of rows updated in a database table based on a given URI and
- * parameters.
+ * Updates a specific row or all rows in a database table based on the provided URI
+ * and selection criteria. It uses a switch statement to determine which type of
+ * update operation is required, either updating all rows matching a selection or
+ * updating a single row by its ID.
+ *
+ * @param uri URI of the data to be updated and is used to determine the type of
+ * update operation based on its match with predefined URIs.
+ *
+ * Matches with `sURIMatcher` to identify the type of URI; contains a path segment
+ * for SENDER_ID type URI.
+ *
+ * @param values ContentValues object containing new column values to be updated in
+ * the database.
+ *
+ * Contains ContentValues object that holds key-value pairs.
+ *
+ * @param selection WHERE clause for the SQL update query, allowing to specify a
+ * condition for which rows to update.
+ *
+ * @param selectionArgs values to be matched against the selection clause specified
+ * by the `selection` parameter in the SQL query executed for updating data.
+ *
+ * An array of strings that contain values to be inserted into selection. The length
+ * of this array must be equal to the number of '?' in the selection string. Each
+ * value is bound with a '?' in the SQL query.
+ *
+ * @returns an integer representing the number of updated rows.
+ *
+ * The returned value is an integer representing the number of rows updated in the
+ * database table. The update operation may involve matching specific conditions
+ * specified by the `selection` and `selectionArgs` parameters or a single row with
+ * a specific ID.
*/
@Override
public int update(Uri uri, ContentValues values, String selection,
diff --git a/client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java b/client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java
index 09ede0c..3797724 100644
--- a/client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java
+++ b/client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java
@@ -12,10 +12,10 @@
* Created by madine on 03/07/14.
*/
/**
- * is a SQLite database table for storing scheduled sensor data. It has various columns
- * for storing information such as sensor ID, internal sensor ID, sensor name, sensor
- * type, last sample, unit, and pending status. The class also provides methods for
- * serializing and deserializing the scheduled sensors for use in the app.
+ * Is responsible for managing a SQLite database table that stores scheduled sensor
+ * data. It provides methods for creating and upgrading the database schema, serializing
+ * and deserializing scheduled sensors to and from ContentValues objects, and retrieving
+ * scheduled sensor data from a cursor.
*/
public class ScheduledSensablesTable {
@@ -40,34 +40,29 @@ public class ScheduledSensablesTable {
/**
- * executes a SQL query to create the database structure when the app is launched for
- * the first time.
- *
- * @param database SQLite Database object that is being manipulated by the function.
- *
- * - `database`: an instance of SQLiteDatabase, which is a class that provides a way
- * to interact with a SQLite database.
- * - `execSQL`: a method that executes a SQL statement on the database.
+ * Executes a SQL command on a SQLite database to create tables. The `execSQL` method
+ * is used to execute the SQL command specified by the constant `DATABASE_CREATE`.
+ * This function is typically called when the database is created for the first time.
+ *
+ * @param database SQLiteDatabase object that is being used to execute the SQL command
+ * defined by the `DATABASE_CREATE` constant.
*/
public static void onCreate(SQLiteDatabase database) {
database.execSQL(DATABASE_CREATE);
}
/**
- * drops an existing table and recreates it according to the new version's schema.
- *
- * @param database SQLiteDatabase object that is being upgraded.
- *
- * - `SQLiteDatabase`: This is an instance of the SQLite database class, which
- * provides methods for managing SQLite databases.
- * - `oldVersion`, `newVersion`: These are integers that represent the old and new
- * versions of the database, respectively.
- *
- * @param oldVersion version of the database that is being upgraded, which is used
- * to determine the appropriate action to take during the upgrade process.
- *
- * @param newVersion new version of the SQLite database, which is used to determine
- * the appropriate actions to take during the upgrade process.
+ * Drops an existing table with name `NAME` from a SQLite database and then creates
+ * it again by calling the `onCreate` function when the database version is upgraded.
+ *
+ * @param database SQLiteDatabase instance that is being upgraded to the new version
+ * specified by the `newVersion`.
+ *
+ * @param oldVersion current version of the database before any upgrade operations
+ * are performed.
+ *
+ * @param newVersion current version of the SQLite database schema, indicating when
+ * changes or updates are made to the table structure.
*/
public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
database.execSQL("DROP TABLE IF EXISTS " + NAME);
@@ -75,43 +70,21 @@ public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVer
}
/**
- * converts a `ScheduledSensable` object into a `ContentValues` instance, which can
- * be used for database storage in SQLite. It serializes the `ScheduledSensable`
- * fields and puts them into the `ContentValues` with appropriate column names.
- *
- * @param scheduledSensable sensory data that is scheduled to be saved for SQL Lite.
- *
- * - `sensorid`: A unique identifier for the sensor.
- * - `internalSensorId`: The internal ID of the sensor.
- * - `name`: The name of the sensor.
- * - `sensortype`: The type of sensor (e.g., temperature, humidity, etc.).
- * - `lastSample`: The last sample value of the sensor, represented as a JSON string.
- * - `unit`: The unit of measurement for the sensor.
- * - `pending`: A boolean value indicating whether the sensor is pending or not.
- *
- * @returns a ContentValues object containing the scheduled sensory data in a format
- * suitable for SQL Lite storage.
- *
- * - `ContentValues serializedScheduledSensable`: This is an instance of the
- * `ContentValues` class, which is used to store and manipulate data in a SQLite database.
- * - `put(columnName, columnValue)`: This method is used to add or update a value
- * for a specific column name in the `serializedScheduledSensable` ContentValues
- * object. The `columnName` parameter specifies the name of the column, while the
- * `columnValue` parameter specifies the value to be stored in that column.
- * - `COLUMN_SENSABLE_ID`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that contains the ID of the sensable being serialized.
- * - `COLUMN_SENSOR_ID`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that contains the ID of the sensor associated with the sensable.
- * - `COLUMN_SENSOR_NAME`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that contains the name of the sensor associated with the sensable.
- * - `COLUMN_SENSOR_TYPE`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that contains the type of the sensor associated with the sensable.
- * - `COLUMN_LAST_SAMPLE`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that contains the last sample value for the sensable.
- * - `COLUMN_UNIT`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that contains the unit of measurement for the sensable.
- * - `COLUMN_PENDING`: This is the name of a column in the `serializedScheduledSensable`
- * ContentValues object that indicates whether the sensable is pending or not.
+ * Converts a `ScheduledSensable` object into a SQL-compatible format using a
+ * `ContentValues` object. It extracts various properties from the input object and
+ * stores them as key-value pairs, preparing the data for storage in a SQLite database.
+ *
+ * @param scheduledSensable data to be serialized into a ContentValues object for
+ * storage in a SQLite database.
+ *
+ * Serialize its sensor ID, internal sensor ID, name, sensor type, last sample as
+ * JSON string, unit and pending status.
+ *
+ * @returns a ContentValues object.
+ *
+ * Serialized content contains sensable ID, internal sensor ID, name, sensor type,
+ * last sample in JSON string format, unit and a pending flag set to false. It is
+ * stored as a ContentValues object.
*/
public static ContentValues serializeScheduledSensableForSqlLite(ScheduledSensable scheduledSensable) {
ContentValues serializedScheduledSensable = new ContentValues();
@@ -126,48 +99,24 @@ public static ContentValues serializeScheduledSensableForSqlLite(ScheduledSensab
}
/**
- * retrieves a scheduled sensors data from a cursor and creates a new ScheduledSensable
- * object with the retrieved data.
- *
- * @param cursor result of a query on the `ScheduledSensablesTable`, providing a
- * cursor pointing to the current row being processed.
- *
- * - `cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_ID)` - returns the index
- * of the column containing the sensor ID
- * - `cursor.getString(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_SENSOR_ID))`
- * - retrieves the value of the sensor ID column as a string
- * - `cursor.getInt(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_SENSOR_ID))`
- * - retrieves the value of the sensor ID column as an integer
- * - `cursor.getString(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_NAME))`
- * - retrieves the value of the name column as a string
- * - `cursor.getString(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_SENSOR_TYPE))`
- * - retrieves the value of the sensor type column as a string
- * - `cursor.getString(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_UNIT))`
- * - retrieves the value of the unit column as a string
- * - `cursor.getInt(cursor.getColumnIndex(ScheduledSensablesTable.COLUMN_PENDING))`
- * - retrieves the value of the pending column as an integer
- * - `cursor.getString(cursor.getColumnIndex(SavedSensablesTable.COLUMN_LAST_SAMPLE))`
- * - retrieves the value of the last sample column as a string (if appropriate)
- *
- * Note: The properties of `cursor` may vary depending on the specific implementation
- * and usage of the `getScheduledSensable` function.
- *
- * @returns a `ScheduledSensable` object containing the sensor data.
- *
- * - `scheduledSensable`: An object of the `ScheduledSensable` class that contains
- * information about a scheduled sensor.
- * + `setId()`: The id of the scheduled sensor.
- * + `setSensorid()`: The ID of the sensor that the scheduled sensor is associated
- * with.
- * + `setInternalSensorId()`: The internal ID of the sensor that the scheduled sensor
- * is associated with.
- * + `setName()`: The name of the sensor.
- * + `setSensortype()`: The type of the sensor.
- * + `setUnit()`: The unit of measurement for the sensor.
- * + `setPending()`: A boolean value indicating whether the scheduled sensor is
- * pending or not.
- * + `setSample()`: A `Sample` object containing the latest sample data from the
- * associated sensor, or an empty `Sample` object if no sample data is available.
+ * Retrieves data from a database cursor and populates a `ScheduledSensable` object
+ * with its properties, including ID, sensor ID, name, type, unit, and pending status.
+ * It also extracts the last sample from the database as a JSON string and sets it
+ * in the `ScheduledSensable` object.
+ *
+ * @param cursor cursor that is used to retrieve data from the database table and
+ * populate the `ScheduledSensable` object with relevant information.
+ *
+ * Cursor has columns: COLUMN_ID, COLUMN_SENSABLE_ID, COLUMN_SENSOR_ID, COLUMN_SENSOR_NAME,
+ * COLUMN_SENSOR_TYPE, COLUMN_UNIT, COLUMN_PENDING. Additionally, it contains a column
+ * with key COLUMN_LAST_SAMPLE and value type String.
+ *
+ * @returns a populated `ScheduledSensable` object.
+ *
+ * The ScheduledSensable object contains an ID, sensor id, internal sensor ID, name,
+ * sensor type, unit, and pending status. Additionally, it has a sample attribute
+ * that is either populated from JSON data or initialized as empty if no JSON data
+ * is present.
*/
public static ScheduledSensable getScheduledSensable(Cursor cursor) {
ScheduledSensable scheduledSensable = new ScheduledSensable();
diff --git a/client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java b/client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java
index e80ef13..adb142c 100644
--- a/client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java
+++ b/client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java
@@ -15,10 +15,10 @@
import android.util.Log;
/**
- * is an implementation of the ContentProvider interface for handling sensor data
- * stored in a SQLite database. It provides methods for querying, inserting, deleting,
- * and updating sensor data based on a given URI. The provider also includes a switch
- * statement to handle different types of URIs (e.g., sensables or sensor IDs).
+ * Is a content provider that manages data in a SQLite database. It provides CRUD
+ * (Create, Read, Update, Delete) operations for data retrieval and manipulation
+ * through the Android ContentResolver API. The class handles URIs, columns, and
+ * selection criteria to interact with the database efficiently.
*/
public class SensableContentProvider extends ContentProvider {
@@ -42,11 +42,10 @@ public class SensableContentProvider extends ContentProvider {
private SensableDatabaseHelper dbHelper;
/**
- * in this code establishes a connection to a database and logs details about the
- * helper used for the connection.
- *
- * @returns a log message indicating the database helper object has been created and
- * its details.
+ * Initializes a database helper object and logs its string representation to the
+ * debug log. It also returns a boolean value of `false`.
+ *
+ * @returns a string representation of the database helper object.
*/
@Override
public boolean onCreate() {
@@ -56,94 +55,39 @@ public boolean onCreate() {
}
/**
- * generates a SQL query to retrieve data from a SQLite database based on a given URI
- * and selection criteria. It builds the query using a `SQLiteQueryBuilder`, executes
- * it against the database, and returns the resulting cursor object.
- *
- * @param uri URI that is used to determine which data from the SavedSensables table
- * should be queried.
- *
- * - `sURIMatcher.match(uri)`: This returns an integer that represents the type of
- * the `uri`. The possible values depend on the context in which this function is called.
- * - `SavedSensablesTable.NAME`: This is the name of the table where the data for
- * the `cursor` will be retrieved from.
- * - `SensorId`: This is a column in the `SavedSensablesTable` that represents the
- * sensor ID associated with the `uri`.
- * - `projection`: This is an array of strings that represent the columns to retrieve
- * from the table.
- * - `selection`: This is a string that specifies the condition for which rows to
- * include in the result set.
- * - `selectionArgs`: This is an array of strings that provide additional values for
- * the selection statement.
- * - `sortOrder`: This is a string that represents the sort order of the result set.
- *
- * The function then builds a query using the `SQLiteQueryBuilder` class, which
- * constructs a SQL query based on the input parameters. The resulting query is then
- * executed against the database using the `query` method of the ` SQLiteDatabase`
- * class, and the results are returned in a `Cursor` object. Finally, the `Cursor`
- * is set as the notification URI for the `ContentResolver` associated with the context
- * of the app.
- *
- * @param projection 0 or more columns of data to be retrieved from the SavedSensables
- * table in the SQLite database.
- *
- * - `projection`: An array of strings representing the columns to be queried from
- * the SavedSensables table. The order and names of these columns match the column
- * names in the SavedSensables table.
- * - `selection`: A string representing the selection criteria for the query, which
- * is used to filter the results based on the sensor ID.
- * - `selectionArgs`: An array of strings containing the values to be substituted
- * into the selection expression. These values are used to further filter the results
- * based on the sensor ID.
- * - `sortOrder`: A string representing the sort order for the query results, which
- * determines the order in which the results will be returned.
- *
- * @param selection condition that the query should satisfy, allowing for filtering
- * of the data retrieved from the database.
- *
- * @param selectionArgs values for the selection criteria in the query, allowing the
- * user to customize the query based on their specific needs.
- *
- * - `selection`: This is the condition applied to the table data based on the user's
- * query requirements. It can be a single field or an array of fields that define
- * which rows in the table satisfy the condition.
- * - `selectionArgs`: This is an array of values that are passed as arguments to the
- * ` selection` clause of the query. Each value in the array corresponds to a parameter
- * placeholders in the `SELECT` clause, allowing you to pass custom values for each
- * field in the condition.
- *
- * In summary, `query` takes input parameters `uri`, `projection`, `selection`, and
- * `selectionArgs`. The `selection` parameter defines the condition applied to the
- * table data, while the `selectionArgs` parameter allows passing custom values for
- * each field in the condition.
- *
- * @param sortOrder 1-based index of the sort key for the query result, which determines
- * the order of the sorted results returned by the `query()` method.
- *
- * @returns a Cursor object containing data from the SavedSensables table based on
- * the specified selection and sort order.
- *
- * - `Cursor cursor`: This is the result set returned by the query, which contains
- * the data from the database.
- * - `projection`: An array of strings representing the columns to include in the
- * result set.
- * - `selection`: A string representing the condition for selecting rows from the
- * database, based on the values in the `SavedSensablesTable`.
- * - `selectionArgs`: An array of strings representing the values to use as arguments
- * for the selection condition.
- * - `sortOrder`: A string representing the order in which the result set should be
- * sorted.
- *
- * The function first determines the type of the URI provided, using the `sURIMatcher`
- * class, and then performs the appropriate query based on that type. For example,
- * if the URI is of type `SENSABLES`, the function simply returns the entire contents
- * of the `SavedSensablesTable`. If the URI is of type `SENSABLE_ID`, the function
- * constructs a more specific query by appending a condition to the `SELECT` statement,
- * where the value of the `Sensor ID` column in the table matches the value of the
- * last path segment of the URI. Finally, the function uses the `SQLiteDatabase` class
- * to execute the query and returns the result set as a `Cursor`. The `NotificationUri`
- * property of the `Cursor` is set to the content resolver of the activity, which
- * allows the user to navigate to the corresponding screen in the app.
+ * Executes a SQL query on a SQLite database and returns a Cursor object containing
+ * the results. It handles different types of URIs, including the base URI for all
+ * sensables and a specific sensor ID URI, and logs the executed SQL statement.
+ *
+ * @param uri URI of the query operation and is used to determine the specific table
+ * or record to retrieve data from based on its path segment.
+ *
+ * Matched to one of the cases SENSABLES or SENSABLE_ID using the URI matcher
+ * sURIMatcher. The `getLastPathSegment()` returns a part of the path of the URI and
+ * is used as a selection argument in case SENSABLE_ID.
+ *
+ * @param projection list of columns that are to be returned in the result set of the
+ * query, which can be used to select specific fields from the database.
+ *
+ * @param selection WHERE clause of the SQL query that is used to filter the results,
+ * allowing for conditional selection of specific rows from the database table.
+ *
+ * @param selectionArgs values to bind into the SQL selection string for the query,
+ * which can contain placeholders such as '?' or ':name' that are replaced by these
+ * values.
+ *
+ * * It is an array of strings.
+ * * The length of this array matches the number of question marks in the selection
+ * string.
+ *
+ * @param sortOrder constraint used to sort the query results, specifying how the
+ * rows should be ordered and returned from the database.
+ *
+ * @returns a SQLite Cursor containing the query results.
+ *
+ * The output is a Cursor object. It contains query results as rows, each represented
+ * by a RowSet. Each row can be accessed using the moveToNext() method to fetch the
+ * data.
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection,
@@ -173,14 +117,13 @@ public Cursor query(Uri uri, String[] projection, String selection,
}
/**
- * returns a `String` representing the type of a given `Uri`. It does not return any
- * value for any `Uri`.
- *
- * @param uri Android package's URI, which is used to determine the type of the package.
- *
- * - Return value: The type of the Uri object is null.
- *
- * @returns `null`.
+ * Returns a string value representing the type of a given URI. It overrides the
+ * default implementation to provide custom URI type determination logic. The returned
+ * value is always `null`.
+ *
+ * @param uri Uri object that contains the authority and path of the requested content.
+ *
+ * @returns a null value as it always returns `null`.
*/
@Override
public String getType(Uri uri) {
@@ -188,40 +131,29 @@ public String getType(Uri uri) {
}
/**
- * inserts data into a SQLite database. It takes a `Uri` and `ContentValues` as input,
- * and based on the value of the `uriType` parameter, it determines which table to
- * insert the data into. The function then uses the `SQLiteDatabase` class to insert
- * the data and returns the inserted `Uri`.
- *
- * @param uri URI of the table where the data is to be inserted, and it is used to
- * determine the appropriate table to insert the data into based on the value of the
- * `uriType` variable.
- *
- * - `sURIMatcher.match(uri)` - returns the match type of the provided `Uri` object
- * - `dbHelper` - an instance of `SensableDatabaseHelper`, used to interact with the
- * local database
- * - `sqlDB` - a SQLite database handle, obtained from the `dbHelper` instance
- * - `id` - a database ID generated by the `insert` function, for the new data
- * inserted into the database.
- *
- * @param values content of the sensable data that will be inserted into the database.
- *
- * - `SavedSensablesTable.NAME`: The name of the table where the data will be inserted.
- * - `null`: No column values are provided for insertion.
- * - `values`: A `ContentValues` object containing the data to be inserted into the
- * specified table.
- *
- * @returns a new URI object representing the inserted data.
- *
- * - `Uri`: The output is a `Uri` object representing the inserted data.
- * - `parse(String uriStr)`: This method parses a string representation of a `Uri`,
- * returning a `Uri` object if successful.
- * - `/" + id)`: This is the path segment of the `Uri`, representing the ID of the
- * inserted data.
- *
- * The properties of the output are:
- *
- * - `id`: The unique identifier of the inserted data, represented as a long value.
+ * Inserts a new row into the database based on the provided URI and ContentValues.
+ * It matches the URI to determine the table to insert into, logs the insertion, and
+ * notifies the content resolver of the change.
+ *
+ * @param uri URI of the content provider for which data is being inserted and is
+ * used to determine the specific table to insert into.
+ *
+ * Matches to a specific URI type through `sURIMatcher.match(uri)`. The matched URI
+ * type is an integer represented by `uriType`.
+ *
+ * @param values key-value pairs to be inserted into the database table associated
+ * with the specified URI.
+ *
+ * It is an instance of `ContentValues`, which contains key-value pairs representing
+ * columns and their corresponding values for insertion into the database. The keys
+ * are column names as strings, while the values can be any type of data that can be
+ * stored in a SQLite database.
+ *
+ * @returns a `Uri` object with an ID of the newly inserted row.
+ *
+ * The output is an instance of `Uri`, which represents a uniform resource identifier
+ * (URI). It contains a parsed URI string and has methods to extract its components.
+ * The Uri object identifies a specific record in the database after insertion.
*/
@Override
public Uri insert(Uri uri, ContentValues values) {
@@ -245,49 +177,32 @@ public Uri insert(Uri uri, ContentValues values) {
}
/**
- * in Java is a method that deletes data from a SQLite database based on a given URI
- * and selection criteria. It retrieves the type of the URI, deletes data from the
- * appropriate table, and notifies the content resolver of any changes made to the data.
- *
- * @param uri URI of the data that needs to be deleted from the database.
- *
- * - `sURIMatcher.match(uri)` returns the type of URI that the given `uri` represents.
- * This information is not provided directly in the input.
- * - `dbHelper.getWritableDatabase()` provides access to a SQLite database.
- * - `int rowsDeleted = 0;` indicates the number of rows that will be deleted in the
- * next steps of the function.
- * - `switch (uriType)` defines the logic for deleting rows based on the type of URI
- * that was matched by `sURIMatcher`. The cases in the switch are:
- * + `SENSABLES`: Deletes rows from the `SavedSensablesTable` with the matching
- * sensor ID.
- * + `SENSABLE_ID`: Deletes rows from the `SavedSensablesTable` where the `Sensor
- * ID` column matches the value in the `uri`. If the `selection` parameter is empty,
- * the entire row will be deleted. Otherwise, only rows that match both the `selection`
- * and the `Sensor ID` columns will be deleted.
- * + `default`: Throws an `IllegalArgumentException` if the given `uri` does not
- * have a known type.
- * - `getContext().getContentResolver().notifyChange(uri, null)` informs any observers
- * of the change to the database.
- *
- * @param selection condition for selecting which rows to delete from the SavedSensablesTable
- * based on the UriType.
- *
- * @param selectionArgs 0-length array of selection arguments that are used to further
- * filter the data to be deleted based on the selected column(s) and values.
- *
- * - `selectionArgs`: An array of String objects containing the selection criteria
- * for the deletion operation. The length of this array must match the number of
- * selection columns in the database table.
- *
- * The switch statement within the function handles different types of URIs based on
- * their matching pattern in the `sURIMatcher`. For each matched URI type, a delete
- * operation is performed on the corresponding database table using the `getWritableDatabase()`
- * method to obtain a reference to the SQLite database. The `delete()` method is
- * called on the database object with the selection criteria and arguments passed as
- * parameters. The number of rows deleted is returned as an integer value. Finally,
- * the `ContentResolver` is notified of the change through the `notifyChange()` method.
- *
- * @returns an integer representing the number of rows deleted from the database.
+ * Deletes data from a SQLite database based on a provided selection and selection
+ * arguments. It supports two types of URIs: SENSABLES for deleting multiple records
+ * and SENSABLE_ID for deleting a single record by its ID, or multiple records matching
+ * specific conditions.
+ *
+ * @param uri URI of the data being deleted and is used to determine which table in
+ * the database to delete from based on the matching result with a predefined set of
+ * URI patterns.
+ *
+ * Matches an Uri path to identify the type of data being deleted, such as SENSABLES
+ * or SENSABLE_ID.
+ *
+ * @param selection WHERE clause of the SQL query to be executed on the SQLite database
+ * for deletion operations.
+ *
+ * @param selectionArgs 0-indexed array of values to bind as placeholders within the
+ * selection string.
+ *
+ * Array containing arguments to be replaced within the selection clause.
+ *
+ * @returns the number of rows deleted from the database.
+ *
+ * The output is an integer representing the number of rows deleted from the database,
+ * which defaults to 0 if no deletions occur. This count may be negative if the delete
+ * operation throws a SQLException. The output value is then passed back to the caller
+ * through the `return` statement.
*/
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
@@ -316,68 +231,36 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
}
/**
- * updates data in a SQLite database based on a given `Uri`, `values`, `selection`,
- * and `selectionArgs`. It switches between updating different tables (`SENSABLES`
- * and `SENSABLE_ID`) depending on the `uriType` and performs the update operation accordingly.
- *
- * @param uri URI of the data that is being updated, and its type is used to determine
- * which table to update in the database.
- *
- * - `uri`: This is an instance of `Uri`, which represents a network resource. It
- * has several properties such as `scheme`, `authority`, `path`, and `query`. In this
- * case, the scheme and authority of the `uri` are ignored, leaving only the path and
- * query components.
- * - `selection`: This is a string representing a filter for selecting rows to update
- * in the database. It may contain columns and operators used to match or exclude
- * specific rows.
- * - `selectionArgs`: This is an array of strings containing additional values to
- * be matched against the selection criteria. These values are used to further refine
- * the row selection process.
- * - `uriType`: This is an integer representing the type of `uri` passed as a
- * parameter. It is generated using the `sURIMatcher.match(uri)` method, which maps
- * the `uri` to one of three possible types: `SENSABLES`, `SENSABLE_ID`, or `UNKNOWN`.
- * The type determines which table in the database should be updated.
- *
- * @param values update values for the specified sensor ID or sensor ID and selection
- * criteria, which are used to update the corresponding entries in the SavedSensables
- * table.
- *
- * - `Uri`: The URI that is being updated.
- * - `ContentValues`: A class that contains a set of key-value pairs representing
- * the data to be updated in the database. In this case, it contains the values for
- * the sensors.
- * - `Selection`: A string representing the condition or filter under which the
- * update operation will be performed. It is used in conjunction with the `selectionArgs`
- * parameter to specify which rows to update.
- * - `SelectionArgs`: An array of strings representing the values of the selection
- * criteria. It is used in conjunction with the `selection` parameter to specify which
- * rows to update.
- *
- * In the code, the `switch` statement determines which table to update based on the
- * value of `uriType`. The `update` method then updates the relevant table in the
- * database using the `SQLiteDatabase` object and the `ContentValues` object containing
- * the updated data. Finally, the method notifies any observers of the change by
- * calling the `notifyChange` method on the `Context` object.
- *
- * @param selection condition for updating the data in the database based on the value
- * of the `SensorId` column in the `SavedSensablesTable`.
- *
- * @param selectionArgs 2nd and 3rd parameters of the `ContentValues` constructor,
- * which are used to specify the values for the selection criteria when updating the
- * database with the `update()` method.
- *
- * - `selectionArgs`: A string array representing the arguments for the `selection`
- * clause in the SQL query. It may contain any number of elements, each representing
- * a separate argument. The elements of this array are used to construct the `selection`
- * clause, separated by the `AND` operator. For example, if `selectionArgs` contains
- * the string `"key1='value1'", "key2='value2'"` as its only element, the `selection`
- * clause will be constructed as `"SELECT * FROM table_name WHERE key1='value1' AND
- * key2='value2'`.
- * - `getContext()`: A method of the enclosing class that returns a reference to the
- * context object associated with the current thread. This method is used to notify
- * change listeners in the UI thread when an update occurs.
- *
- * @returns the number of rows updated in the database.
+ * Updates data in a SQLite database based on a given URI and ContentValues object.
+ * It handles different types of URIs by selecting specific records to update and
+ * returns the number of updated rows.
+ *
+ * @param uri URI of the data being updated and is used to determine which table in
+ * the database should be updated and what conditions should be applied for the update
+ * operation.
+ *
+ * Matches with URI type SENSABLES or SENSABLE_ID using the `sURIMatcher`.
+ *
+ * @param values Map of column names and new values to be inserted into or updated
+ * in the database table.
+ *
+ * Contains key-value pairs to be updated in the database; each value is an object
+ * that may contain more complex data structures.
+ *
+ * @param selection WHERE clause for the SQL update operation, allowing the function
+ * to filter and update specific rows in the database based on certain conditions.
+ *
+ * @param selectionArgs values to be bound to the question mark placeholders in the
+ * selection string.
+ *
+ * Array of String values representing the actual selection arguments. It may be empty
+ * or contain one or more strings.
+ *
+ * @returns an integer representing the number of rows updated.
+ *
+ * The function returns an integer value representing the number of rows updated in
+ * the database. It also notifies the content resolver to notify any registered
+ * listeners that the data has changed. The output is a count of affected rows.
*/
@Override
public int update(Uri uri, ContentValues values, String selection,
diff --git a/client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java b/client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java
index 9d299cd..3ef2847 100644
--- a/client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java
+++ b/client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java
@@ -9,9 +9,10 @@
* Created by madine on 03/07/14.
*/
/**
- * is a SQLiteOpenHelper that provides a singleton connection to a SQLite database
- * for content providers. The class creates and manages the database schema and
- * provides a way to access the database through a single instance.
+ * Is a SQLiteOpenHelper that provides a singleton connection to a SQLite database
+ * for content providers. It creates and manages the database schema and provides
+ * access to the database through a single instance, ensuring only one active connection
+ * at a time. The class handles database operations such as creating and upgrading tables.
*/
public class SensableDatabaseHelper extends SQLiteOpenHelper {
@@ -35,29 +36,15 @@ public class SensableDatabaseHelper extends SQLiteOpenHelper {
* @return
*/
/**
- * provides a single instance of `SensableDatabaseHelper` for a given `Context`. If
- * the instance is null, it creates a new one using the context's application context.
- *
- * @param context Android application context, which is used to create a new instance
- * of the `SensableDatabaseHelper` class.
- *
- * - `Context context`: This is an object that represents the Android application
- * environment. It provides access to various components and resources within the
- * app, such as the main activity, the application context, and other utility classes.
- * - `sInstance`: A static instance variable that stores a reference to a
- * `SensableDatabaseHelper` object. This variable is used to store a single instance
- * of the helper class, which can be retrieved by calling the `getHelper` function.
- *
- * @returns a `SensableDatabaseHelper` object instance.
- *
- * - The output is a `SensableDatabaseHelper`, which is an instance of a class that
- * provides access to a database.
- * - The `SensableDatabaseHelper` instance is created by calling the
- * `SensableDatabaseHelper(Context)` constructor, passing in the `Context` object
- * representing the Android application context.
- * - The instance is stored in a variable called `sInstance`, which is initially set
- * to `null`. When the function is called, it sets `sInstance` to the newly created
- * `SensableDatabaseHelper` instance.
+ * Creates a single instance of `SensableDatabaseHelper` if it does not exist, using
+ * the provided `Context`. The instance is stored in a static field for reuse. The
+ * function returns the existing or newly created instance, ensuring thread safety
+ * with the use of the `synchronized` keyword.
+ *
+ * @param context application context that is used to create an instance of the
+ * SensableDatabaseHelper class when it has not been initialized yet.
+ *
+ * @returns a synchronized instance of the `SensableDatabaseHelper`.
*/
public static synchronized SensableDatabaseHelper getHelper(Context context) {
if (sInstance == null) {
@@ -71,15 +58,13 @@ private SensableDatabaseHelper(Context context) {
}
/**
- * is responsible for creating the `SavedSensablesTable` and `ScheduledSensablesTable`
- * in a SQLite database.
- *
- * @param db SQLiteDatabase object that is used to perform database operations.
- *
- * - SavedSensablesTable: The table for saved sensibles is created with the `onCreate`
- * method.
- * - ScheduledSensablesTable: The table for scheduled sensibles is also created using
- * the `onCreate` method.
+ * Executes tables creation for `SavedSensablesTable` and `ScheduledSensablesTable`
+ * in a database, ensuring their schema is established when the application is initially
+ * installed or updated. This allows for data storage and retrieval operations to be
+ * performed.
+ *
+ * @param db SQLiteDatabase object that is used to create or modify tables and their
+ * structures, such as SavedSensablesTable and ScheduledSensablesTable.
*/
@Override
public void onCreate(SQLiteDatabase db) {
@@ -90,20 +75,17 @@ public void onCreate(SQLiteDatabase db) {
}
/**
- * updates the SavedSensables and ScheduledSensables tables when upgrading the database
- * version.
- *
- * @param db SQLiteDatabase object that is being upgraded.
- *
- * - `SavedSensablesTable`: The table containing sensors' historical data is upgraded
- * by calling its `onUpgrade` method.
- * - `ScheduledSensablesTable`: The scheduled sensors' data in another table is also
- * upgraded using the same method.
- *
- * @param oldVersion previous version of the database schema.
- *
- * @param newVersion latest version of the SQLite database schema, which is used to
- * determine what actions need to be taken during the upgrade process.
+ * Is overridden to handle database schema changes when upgrading from an older version
+ * to a newer one. It calls separate upgrade methods for two tables: `SavedSensablesTable`
+ * and `ScheduledSensablesTable`, indicating that these tables require migration upon
+ * upgrading the database schema.
+ *
+ * @param db SQLiteDatabase object that is being upgraded to a newer version.
+ *
+ * @param oldVersion previous version of the database schema before the upgrade
+ * operation is performed.
+ *
+ * @param newVersion newest database schema version being installed or upgraded to.
*/
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
diff --git a/client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java b/client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java
index 3bfd473..46788c6 100644
--- a/client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java
+++ b/client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java
@@ -22,10 +22,10 @@
* Created by simonmadine on 19/07/2014.
*/
/**
- * is responsible for displaying a list of favourite sensors in a Fragment. It utilizes
- * a CursorLoader to load the data from a content provider and an adapter to display
- * the data in a ListView. The fragment also provides methods for initializing the
- * list and attaching a cursor loader to the ListView.
+ * Is a part of an Android application that displays a list of favourite sensors in
+ * a Fragment. It uses a CursorLoader to load data from a SQLite database and populates
+ * a ListView with the retrieved data. The fragment also provides methods for
+ * initializing the list, attaching a cursor loader, and handling item clicks.
*/
public class FavouriteSensablesFragment extends Fragment implements LoaderManager.LoaderCallbacks {
private static final String TAG = FavouriteSensablesFragment.class.getSimpleName();
@@ -34,41 +34,21 @@ public class FavouriteSensablesFragment extends Fragment implements LoaderManage
SensableListAdapter mAdapter;
/**
- * inflates a fragment's layout from a resource file and returns the resulting view.
- *
- * @param layoutInflater inflation API that is used to inflate the layout of the
- * fragment based on the provided resource ID.
- *
- * - `LayoutInflater layoutInflater`: This is an instance of the `LayoutInflater`
- * class, which is used to inflate XML layouts into Android views.
- * - `ViewGroup container`: This is the parent view group that will contain the newly
- * inflated view.
- * - `Bundle savedInstanceState`: This is an instance of the `Bundle` class, which
- * contains any saved state information for this fragment.
- *
- * @param container parent view group where the inflated layout will be added as a child.
- *
- * - `R.layout.favourite_sensables_fragment`: The layout file that contains the
- * elements for this fragment.
- * - `LayoutInflater`: An object used to inflate the layout from the resource file.
- * - `ViewGroup`: A container view group that holds other views.
- * - `Bundle`: A data storage container used to store saved state.
- *
- * @param savedInstanceState saved state of the fragment, which can be used to restore
- * the fragment's properties if it is recreated due to a configuration change or an
- * error.
- *
- * - `savedInstanceState`: This is a bundle that contains arbitrary data from the
- * previous state of this fragment, if it was saved by the system. The bundle's
- * properties include the values of its fields and the references to any objects that
- * were stored in it.
- *
- * @returns an inflated view of the `R.layout.favourite_sensables_fragment` layout.
- *
- * - `LayoutInflater`: The LayoutInflater object that is used to inflate the layout
- * from the resource file.
- * - `ViewGroup`: The ViewGroup container that holds the fragment's layout.
- * - `Bundle`: The Bundle object that contains any saved instance state, if available.
+ * Inflates a layout for a fragment from the resource R.layout.favourite_sensables_fragment
+ * into a given ViewGroup. The inflated view is then returned as the result of the
+ * onCreateView method. This function is part of the Fragment class and is responsible
+ * for creating the initial layout of a fragment.
+ *
+ * @param layoutInflater LayoutInflater object used to inflate the layout file
+ * R.layout.favourite_sensables_fragment into a View object.
+ *
+ * @param container 2D array of view roots that is passed to the inflated view's
+ * `setLayoutParams()` method.
+ *
+ * @param savedInstanceState Bundle object containing the activity's previously saved
+ * state.
+ *
+ * @returns an inflated view of the "favourite_sensables_fragment" layout.
*/
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bundle savedInstanceState) {
@@ -76,7 +56,9 @@ public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bun
}
/**
- * initializes a list upon calling the superclass's `onStart` method.
+ * Initializes the application by executing its superclass's `onStart` method and
+ * then calling the `initialiseList` method to set up a list or other data structure.
+ * This method is typically used during the initialization of an Android activity.
*/
@Override
public void onStart() {
@@ -85,8 +67,9 @@ public void onStart() {
}
/**
- * initializes a list view with saved sensables and sets an empty view, on item click
- * listener for the list view.
+ * Initializes a list view by setting up a cursor loader and an empty view for it,
+ * then sets up an on-click listener for the list view. Additionally, it starts a
+ * scheduler for scheduling tasks.
*/
private void initialiseList() {
ScheduleHelper scheduleHelper = new ScheduleHelper(getActivity());
@@ -104,57 +87,28 @@ private void initialiseList() {
}
/**
- * creates an `AdapterView.OnItemClickListener` that, when an item is clicked, starts
- * an intent to display the `SensableActivity` with the corresponding sensable data
- * extracted from a savable table.
- *
- * @returns an `OnItemClickListener` that handles clicks on list items and starts an
- * intent to display the `SensableActivity`.
- *
- * - `AdapterView.OnItemClickListener`: This interface represents an adapter view's
- * click listener. It is implemented to handle item clicks on the adapter view.
- * - `onItemClick()`: This method is called when an item in the adapter view is
- * clicked. It takes four parameters: `parent`, `view`, `position`, and `id`.
- * - `getActivity()`: This method returns the current activity, which is used to
- * start a new activity when the sensable is clicked.
- * - `SensableActivity.class`: This class represents the activity that is started
- * when an item in the adapter view is clicked. It takes a single extra parameter,
- * `sensable`, which is a `Sensable` object obtained from the `getSensable()` method
- * of the `SavedSensablesTable`.
- * - `Sensable`: This class represents a sensable data object, which contains
- * information about a specific sensation. It has several attributes, including `id`,
- * `name`, `description`, and `value`.
+ * Returns an AdapterView.OnItemClickListener object that is called when an item in
+ * a list is clicked. It creates an intent to open the SensableActivity class, passing
+ * sensable data as an extra through the EXTRA_SENSABLE field.
+ *
+ * @returns an AdapterView.OnItemClickListener.
*/
private AdapterView.OnItemClickListener getSavedSensableListener() {
return new AdapterView.OnItemClickListener() {
/**
- * is called when an item in a list is clicked. It creates an intent to open the
- * `SensableActivity` class, passing the sensable data as an extra throughput the
- * `EXTRA_SENSABLE` field.
- *
- * @param parent AdapterView whose item has been clicked and is being passed to the
- * function as an argument.
- *
- * - `AdapterView`: This is the type of the view that triggered the event. It provides
- * information about the adapter that was used to display the items in the list and
- * the position of the item that was clicked.
- * - `view`: This is the view that was clicked, which is a `View` object.
- * - `position`: This is the position of the item in the list, which can be used to
- * determine which item was clicked.
- * - `id`: This is the ID of the item that was clicked, which can be used to identify
- * the item in the list.
- *
- * @param view View object that was clicked and triggered the onItemClick() method.
- *
- * 1/ `parent`: The parent AdapterView instance that triggered the click event.
- * 2/ `position`: The position of the item in the adapter view.
- * 3/ `id`: The ID of the selected item.
- * 4/ `intent`: An Intent object used to launch the next activity.
- *
- * @param position 0-based index of the selected item in the adapter view.
- *
- * @param id 4-byte unique identifier of the item that was clicked, which is used to
- * identify the corresponding sensable object in the SavedSensablesTable.
+ * Handles an item click event from an adapter view. It creates a new intent to start
+ * the SensableActivity class, retrieves a sensable object from the SavedSensablesTable
+ * using the selected position, adds the object as an extra to the intent, and starts
+ * the activity with the intent.
+ *
+ * @param parent AdapterView that generated the event, allowing access to its state
+ * and properties such as the selected item.
+ *
+ * @param view View associated with the selected item in the AdapterView.
+ *
+ * @param position 0-based index of the item that has been clicked in the AdapterView.
+ *
+ * @param id 64-bit integer row ID of the item selected from the adapter.
*/
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
@@ -178,19 +132,14 @@ public void onItemClick(AdapterView> parent, View view, int position, long id)
};
/**
- * attaches a CursorLoader to a ListView, allowing the display of sensable data from
- * a SQLite database.
- *
- * @param listView ListView that will be populated with data by the adapter created
- * and set by the function.
- *
- * - `listView`: A reference to a ListView object in the activity. Its ID is specified
- * by `R.id.row_sensable_id`.
- * - `mAdapter`: An instance of SensableListAdapter, which is responsible for
- * displaying the data in the ListView. The adapter's constructor takes the activity
- * as an argument and specifies null as the second parameter.
- *
- * The function then sets the adapter for the ListView using the `setAdapter` method.
+ * Initializes a SensableListAdapter and sets it to a ListView. It also prepares a
+ * loader manager to fetch data from the database, specifically from the SavedSensablesTable.
+ * The loader is initialized with an ID of 0 and a null bundle.
+ *
+ * @param listView ListView to which the SensableListAdapter is set as its adapter.
+ *
+ * Set: list view
+ * Properties: List view set adapter.
*/
private void attachCursorLoader(ListView listView) {
SensableListAdapter.AdapterHolder projection = new SensableListAdapter.AdapterHolder();
@@ -210,35 +159,17 @@ private void attachCursorLoader(ListView listView) {
}
/**
- * creates a `CursorLoader` instance that fetches data from the `SensableContentProvider`
- * and returns a `Cursor` object for display.
- *
- * @param id identifier of the loader, which is used to uniquely identify the loader
- * instance across multiple calls to the `onCreateLoader()` method.
- *
- * @param args application-specific data passed to the `onCreateLoader` method by the
- * caller.
- *
- * The input `args` bundle has a single non-null component named `CONTENT_URI`, which
- * represents the content provider's URI for displaying data. The `SENSABLE_PROJECTION`
- * string is defined in the function, and it specifies the columns to be retrieved
- * from the content provider. Additionally, there are three nullable reference
- * parameters: `null`, `null`, and `null`.
- *
- * @returns a `CursorLoader` instance that loads data from a content provider.
- *
- * - `id`: The unique identifier for the loader, which is an integer value.
- * - `args`: A Bundle object that contains additional data that can be used by the
- * loader.
- * - `SensableContentProvider.CONTENT_URI`: The content URI of the data being
- * displayed, which is a string value.
- * - `SENSABLE_PROJECTION`: An array of strings representing the fields to be queried
- * in the Cursor object returned by the loader, which can be modified or extended
- * depending on the requirements of the application.
- * - `null`: A null reference that indicates no data is available for the specified
- * URI.
- * - `null`: A null reference that indicates no additional data is available beyond
- * what is included in the Cursor object.
+ * Creates and returns a `CursorLoader`. The loader retrieves data from the
+ * `SensableContentProvider` using its `CONTENT_URI`, a set of projection columns
+ * (`SENSABLE_PROJECTION`), and optional selection, selection arguments, and sort order.
+ *
+ * @param id 0-based identifier of the loader being created and is used to differentiate
+ * between multiple loaders that may be simultaneously running in an activity or fragment.
+ *
+ * @param args Bundle object that contains any arguments passed to the LoaderManager
+ * when it was created and can be used to initialize the loader's data retrieval process.
+ *
+ * @returns a CursorLoader instance.
*/
@Override
public Loader onCreateLoader(int id, Bundle args) {
@@ -249,22 +180,15 @@ public Loader onCreateLoader(int id, Bundle args) {
}
/**
- * swaps a new cursor with the existing one in a `Loader` object, allowing the adapter
- * to display the new data.
- *
- * @param loader Loader object that is responsible for loading the data into the
- * Cursor that is passed as the second parameter to the `onLoadFinished()` method.
- *
- * - `loader`: A `Loader` instance that represents the result of a load
- * operation. It provides access to the data in the form of a `Cursor`.
- *
- * @param data cursor containing the data to be displayed by the adapter after the
- * load operation has completed.
- *
- * - `mAdapter`: The adapter associated with the loader, which is passed as an
- * argument to the function.
- * - `data`: The cursor containing the new data, which is swapped in place of the
- * previous cursor by calling `mAdapter.swapCursor(data)`.
+ * Swaps a new cursor into a specified adapter, replacing any existing cursor. This
+ * is done when a loader finishes loading data, and ensures that the adapter is updated
+ * with the latest information once it becomes available.
+ *
+ * @param loader Loader instance that manages the loading process, providing access
+ * to the loaded data.
+ *
+ * @param data Cursor object returned by the Loader, which is used to update the
+ * adapter with new data for display.
*/
@Override
public void onLoadFinished(Loader loader, Cursor data) {
@@ -275,17 +199,13 @@ public void onLoadFinished(Loader loader, Cursor data) {
}
/**
- * is called when the last Cursor provided to `onLoadFinished()` is about to be closed,
- * and it ensures that the adapter is no longer using the Cursor by swapping it with
- * null.
- *
- * @param loader Loader object that provides the Cursor data to be processed by the
- * onLoadFinished() method.
- *
- * The `onLoaderReset()` method is called when the last Cursor provided to
- * `onLoadFinished()` is about to be closed. It ensures that the `mAdapter` object
- * no longer uses the cursor by calling its `swapCursor()` method and passing in a
- * null value.
+ * Resets the adapter's cursor when it's being destroyed, ensuring that the previous
+ * cursor is closed and not used anymore. This is necessary to prevent memory leaks
+ * or errors due to stale data. The function swaps the cursor with null, effectively
+ * resetting the adapter.
+ *
+ * @param loader Loader that is being reset, which provides access to the Cursor
+ * object that is being closed.
*/
@Override
public void onLoaderReset(Loader loader) {
diff --git a/client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java b/client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java
index 968db76..2f40e51 100644
--- a/client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java
+++ b/client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java
@@ -25,10 +25,11 @@
* Created by simonmadine on 19/07/2014.
*/
/**
- * is responsible for displaying scheduled sensors in a list view. It initializes the
- * list view and attaches a cursor loader to display data from a content provider.
- * The adapter is used to swap the cursor with the data provided by the loader when
- * it finishes loading or resets.
+ * Is responsible for displaying scheduled sensors in a list view, where each sensor
+ * represents a sensory input to be taken at a specific time. It initializes the list
+ * view and attaches a cursor loader to display data from a SQLite database. The
+ * fragment also handles user clicks on list items by starting an activity with sensor
+ * data for the selected sensable.
*/
public class LocalSensablesFragment extends Fragment implements LoaderManager.LoaderCallbacks {
private static final String TAG = LocalSensablesFragment.class.getSimpleName();
@@ -37,45 +38,21 @@ public class LocalSensablesFragment extends Fragment implements LoaderManager.Lo
SensableListAdapter mAdapter;
/**
- * inflates a fragment's layout from a resource file and returns the newly created
- * view object.
- *
- * @param layoutInflater inflater class that is used to inflate the layout for the fragment.
- *
- * 1/ `layoutInflater`: This is an instance of the `LayoutInflater` class, which is
- * used to inflate layout files. It has various properties such as `getContext()`,
- * `getLayoutInflater()` and `inflate()` methods.
- * 2/ `R.layout.local_sensables_fragment`: This is the layout file that is being
- * inflated by the `layoutInflater`. It defines the UI components of the fragment.
- * 3/ `container`: This is the parent view group that the inflated layout will be
- * added to.
- * 4/ `savedInstanceState`: This is an instance of the `Bundle` class, which contains
- * arbitrary data that was saved when the fragment was previously saved. It can be
- * used to restore the fragment's state.
- *
- * @param container ViewGroup that will hold the inflated view.
- *
- * - `R.layout.local_sensables_fragment`: This is the layout file that the `container`
- * represents.
- * - `false`: This indicates that the `container` is not a direct child of an activity.
- *
- * @param savedInstanceState saved state of the fragment, which can be used to restore
- * the fragment's state in case it is recreated after being detroyed or when the user
- * returns to the fragment after navigating away from it.
- *
- * - `savedInstanceState`: A Bundle object that contains additional data about the
- * fragment when it is recreated. It may contain arbitrary key-value pairs, but its
- * specific contents depend on the fragment's subclass and how it was saved.
- *
- * @returns an inflated view of the specified layout.
- *
- * The return statement inflates a layout from the resources file `R.layout.local_sensables_fragment`.
- *
- * The value of `container` is the parent view group that the inflated layout will
- * be added to.
- *
- * The value of `savedInstanceState` is a Bundle object containing any saved state
- * from previous views or fragments.
+ * Inflates a local sensables fragment view from an XML layout and returns it. The
+ * inflated view is added to a container with the specified parent and attaches the
+ * layout parameters. This function overrides the default onCreateView method in a
+ * Fragment class.
+ *
+ * @param layoutInflater LayoutInflater instance that is used to inflate the
+ * local_sensables_fragment layout resource into a View object.
+ *
+ * @param container 2D array to which the View returned by the method will be added
+ * and is used to determine the layout parameters of the inflated view.
+ *
+ * @param savedInstanceState Bundle object passed from the previous instance of the
+ * same fragment and provides state information that needs to be restored.
+ *
+ * @returns an inflated view from the local_sensables_fragment layout resource.
*/
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bundle savedInstanceState) {
@@ -83,7 +60,10 @@ public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bun
}
/**
- * initializes a list upon call to the parent `onStart` method.
+ * Initiates a list by calling the `initialiseList` method when the application starts.
+ * It overrides the default implementation and includes an additional step to prepare
+ * the list for use. The `super.onStart()` call ensures that the parent class's
+ * start-up sequence is executed first.
*/
@Override
public void onStart() {
@@ -92,8 +72,9 @@ public void onStart() {
}
/**
- * initializes a list view, attaches a cursor loader, sets an empty view, and adds
- * an on-item listener to handle clicks on list items.
+ * Initializes a schedule helper and starts a scheduler, sets up a list view with an
+ * empty text view as its empty view, and attaches a cursor loader to it. It also
+ * adds an on-click listener to the list view.
*/
private void initialiseList() {
ScheduleHelper scheduleHelper = new ScheduleHelper(getActivity());
@@ -111,54 +92,43 @@ private void initialiseList() {
}
/**
- * creates an `AdapterView.OnItemClickListener` that, when an item is clicked, opens
- * the `SensableActivity` with the sensor ID and unit of the scheduled sensable from
- * the database.
- *
- * @returns an AdapterView.OnItemClickListener that handles click events on a list
- * of scheduled sensables, passing the selected sensor ID and unit to a new activity
- * for further processing.
- *
- * - `ScheduledSensable scheduledSensable`: This class represents a scheduled sensable
- * object, which contains information about a sensory input that is to be taken at a
- * specific time.
- * - `Sensorid`: The unique identifier of the sensor for which the sensory input is
- * being scheduled.
- * - `Unit`: The unit of measurement for the sensory input.
- * - `Intent intent`: An intent object used to start the `SensableActivity` when an
- * item in the list is clicked.
- * - `EXTRA_SENSABLE`: A extra field in the intent that contains the sensable object.
+ * Handles user clicks on a list item and starts an activity with sensor data for the
+ * selected sensable by retrieving the ScheduledSensable object from the database
+ * based on the clicked position and then creating an Intent to launch the SensableActivity.
+ *
+ * @returns an AdapterView.OnItemClickListener instance.
+ *
+ * The output is an instance of `AdapterView.OnItemClickListener`, implementing a
+ * listener interface for handling user clicks on list items in an adapter view. It
+ * includes methods to handle click events with parameters `parent`, `view`, `position`,
+ * and `id`.
*/
private AdapterView.OnItemClickListener getScheduledSensableListener() {
return new AdapterView.OnItemClickListener() {
/**
- * handles user clicks on a list item and starts an activity with sensor data for the
- * selected sensable.
- *
- * @param parent AdapterView from which the click event occurred.
- *
- * 1/ `AdapterView> parent`: This is an adapter view object that represents the
- * list view from which the user clicked on an item. The type parameter `>` indicates
- * that the view can have any type of data as its elements, and therefore it cannot
- * be cast to a specific type directly.
- * 2/ `View view`: This is the view that was clicked by the user.
- * 3/ `int position`: This is the position of the item in the list view where the
- * click occurred.
- * 4/ `long id`: This is the ID of the item that was clicked.
- *
- * @param view View object that was clicked, providing the position of the item within
- * the AdapterView.
- *
- * - `parent`: The parent AdapterView object from which the clicked item was detected.
- * - `position`: The position of the clicked item in the list of items displayed by
- * the parent AdapterView.
- * - `id`: The unique identifier of the item that was clicked, as a long value.
- *
- * @param position 0-based index of the selected item in the list, which is used to
- * retrieve the corresponding ScheduledSensable object from the database.
- *
- * @param id 4-byte unique identifier of the scheduled sensable item that was clicked,
- * which is used to identify the sensable data to be displayed in the SensableActivity.
+ * Retrieves a scheduled sensable item from a table based on the selected position.
+ * It then creates an intent to start the SensableActivity with the retrieved sensable
+ * item's sensor ID and unit as extras, and starts the activity.
+ *
+ * @param parent AdapterView that holds the item being clicked, providing access to
+ * its contents through methods like `getItemAtPosition`.
+ *
+ * AdapterView parent - an abstract class for controlling layout and drawing of items.
+ * It provides methods to interact with child views such as adding or removing them
+ * from a container. Its main properties include its adapter, which determines the
+ * data it should display; the ID of the context view; and the number of items in the
+ * list.
+ *
+ * @param view View object associated with the item that was clicked within the
+ * AdapterView, which is used to start an Activity.
+ *
+ * View's type is `View`, which is an interface representing a UI component. Its
+ * properties include its parent, layout parameters, tag, and focusable state.
+ *
+ * @param position 0-based index of the item selected in the AdapterView at which the
+ * view is located.
+ *
+ * @param id 0-based index of the item that was clicked within the adapter.
*/
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
@@ -188,27 +158,14 @@ public void onItemClick(AdapterView> parent, View view, int position, long id)
};
/**
- * attaches a cursor loader to a `ListView` in order to display data from a SQLite
- * database. The function prepares an adapter and sets it as the list view's adapter,
- * then initiates a new or existing loader with a given ID using the
- * `getLoaderManager().initLoader()` method.
- *
- * @param listView ListView that will be populated with data by the adapter created
- * and initialized in the function.
- *
- * - `listView`: This is an instance of the `ListView` class, which is used to display
- * a list of items in a user interface. It has various attributes and methods for
- * managing the display of the list.
- * - `projection`: This is an instance of the `AdapterHolder` class, which contains
- * the data to be displayed in each row of the list. The fields of the `projection`
- * object are:
- * + `ID`: An integer representing the ID of the sensable.
- * + `NAME`: A string representing the name of the sensable.
- * + `SENSOR_ID`: An integer representing the ID of the sensor associated with the
- * sensable.
- * + `VALUE`: A double representing the last sample value of the sensable.
- * + `TYPE`: A string representing the type of the sensable.
- * + `UNIT`: A string representing the unit of measurement for the sensable.
+ * Prepares and sets up a list view by creating an adapter with specific columns from
+ * a database table, attaching it to the list view, and initializing a loader manager
+ * for retrieving data.
+ *
+ * @param listView ListView object to which an adapter is set and managed by the
+ * `attachCursorLoader` method.
+ *
+ * • It is an instance of ListView.
*/
private void attachCursorLoader(ListView listView) {
SensableListAdapter.AdapterHolder projection = new SensableListAdapter.AdapterHolder();
@@ -229,35 +186,17 @@ private void attachCursorLoader(ListView listView) {
}
/**
- * creates a `CursorLoader` that retrieves data from a Content Provider and returns
- * a Cursor object for display.
- *
- * @param id identifier for the loader, which is used to identify the loader instance
- * and distinguish it from other instances created for different data sources.
- *
- * @param args optional arguments that can be used to customize the loader's operation,
- * such as specifying the sort order or filtering the data.
- *
- * 1/ `id`: An integer value representing the id of the loader.
- * 2/ `args`: A Bundle object containing additional data or parameters for the loader.
- * The properties of this object may vary depending on the context and requirements.
- *
- * @returns a `CursorLoader` instance that fetches data from a content provider.
- *
- * - `id`: An integer that identifies the loader, which is used to distinguish between
- * different loaders in the application.
- * - `Bundle args`: A bundle object that contains additional data that can be used
- * by the loader to customize its behavior.
- * - `Loader`: The actual loader object that will take care of creating a
- * Cursor for the data being displayed.
- * - `CursorLoader`: A subclass of `Loader` that provides a way to load a cursor
- * from a content provider.
- * - `SCHEDULED_SENSABLE_PROJECTION`: An array of strings that represents the
- * projection (i.e., the columns) of the data being displayed.
- * - `null`: A null value that indicates that no additional data should be included
- * in the Cursor.
- * - `null`: A null value that indicates that no additional information about the
- * Cursor should be included in the Loader.
+ * Creates and returns a `CursorLoader` instance to manage data retrieval from the
+ * `ScheduledSensableContentProvider`. It takes care of creating a `Cursor` for
+ * displaying data, using the provider's content URI, projection, and query parameters.
+ *
+ * @param id 0-based identifier of the Loader being created and is used to identify
+ * the loader's state across configuration changes.
+ *
+ * @param args Bundle of arguments passed to the LoaderManager when it is created or
+ * restarted, which are not used in this implementation.
+ *
+ * @returns a `CursorLoader` instance.
*/
@Override
public Loader onCreateLoader(int id, Bundle args) {
@@ -268,26 +207,15 @@ public Loader onCreateLoader(int id, Bundle args) {
}
/**
- * swaps a new `Cursor` with the one previously loaded by the Loader, allowing the
- * adapter to display the new data.
- *
- * @param loader Loader object that is used to load the data into the adapter.
- *
- * - Loader: The `loader` is an instance of the class `Loader`, which holds information
- * about how to load data from a remote source.
- * - Cursor: The `cursor` parameter represents the data returned by the loader, which
- * can be used to populate a list view.
- *
- * Swapping the cursor with `mAdapter` allows for efficient updates to the adapter's
- * data set without having to requery the database or network.
- *
- * @param data new data that is being loaded into the adapter, which the method
- * `swapCursor` will swap with the previous cursor.
- *
- * The `Cursor` object `data` is passed as an argument to the function, which indicates
- * that it contains data that has been loaded from a database or other data source.
- * The `Loader` class, which is the parameter for the function, loads data
- * from a database and returns a `Cursor` object representing the loaded data.
+ * Loads data from a Loader into a Cursor and passes it to an adapter, which swaps
+ * the new cursor with the existing one. The old cursor is automatically closed by
+ * the framework once the function returns.
+ *
+ * @param loader Loader object that has finished its load operation, providing the
+ * Cursor data to be used for updating the adapter's content.
+ *
+ * @param data Cursor object returned by the Loader, which is swapped into the adapter
+ * to update the data displayed in the UI.
*/
@Override
public void onLoadFinished(Loader loader, Cursor data) {
@@ -298,20 +226,12 @@ public void onLoadFinished(Loader loader, Cursor data) {
}
/**
- * is called when the last Cursor provided to `onLoadFinished()` is about to be closed.
- * It ensures that the cursor is no longer being used by swapping it with `null`.
- *
- * @param loader Loader object that was used to load the Cursor, and its reset event
- * is triggered when the last Cursor provided by the Loader is about to be closed.
- *
- * The `loader` argument is of type `Loader`, which means it provides access
- * to a Cursor object that represents the data to be displayed in the list. This
- * Cursor contains information about the items to be displayed in the list, such as
- * their names or other relevant details. The `onLoaderReset` function is called when
- * the last Cursor provided by the `onLoadFinished` function is about to be closed,
- * indicating that it is no longer needed and should be properly disposed of. To do
- * this, the `mAdapter.swapCursor(null)` line is used to swap the cursor with a null
- * value, which signals to the adapter that no more data is available for display.
+ * Resets the cursor provided by a loader, ensuring its safe closure. It prevents
+ * further use of the cursor and updates an adapter to swap its cursor with null,
+ * effectively resetting its data source.
+ *
+ * @param loader Loader that is about to reset its cursor, which allows the implementation
+ * to release any resources associated with it.
*/
@Override
public void onLoaderReset(Loader loader) {
diff --git a/client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java b/client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java
index df1602d..d6f4ca0 100644
--- a/client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java
+++ b/client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java
@@ -26,9 +26,10 @@
* Created by simonmadine on 20/07/2014.
*/
/**
- * is a Java file that extends Fragment and provides a list of sensibles retrieved
- * from an API endpoint. The class has methods for initializing the list and adding
- * an onclick listener to the listview.
+ * Is a fragment that displays a list of sensibles retrieved from an API endpoint
+ * using Retrofit. It initializes a ListView with an ArrayAdapter to display the list
+ * and adds an OnItemClickListener to handle item clicks, launching the SensableActivity
+ * with extra data when an item is clicked.
*/
public class RemoteSensablesFragment extends Fragment {
@@ -40,48 +41,19 @@ public class RemoteSensablesFragment extends Fragment {
/**
- * inflates a layout from a resource file and returns the resulting view instance.
- *
- * @param layoutInflater inflation factory that is used to inflate the remote sensables
- * fragment layout from the resource file R.layout.remote_sensables_fragment.
- *
- * The `inflate` method is used to inflate a layout from an XML file specified by the
- * `R.layout.remote_sensables_fragment` constant. The third argument, `container`,
- * represents the parent view group in which the inflated layout will be added. Setting
- * `false` as the fourth argument indicates that the parent view group should not be
- * modified.
- *
- * @param container ViewGroup that the inflated layout will be added to.
- *
- * Returning the inflated layout from `R.layout.remote_sensables_fragment`. The
- * `inflate` method takes three parameters - the first is the layout resource ID, the
- * second is the parent view group, and the third is a boolean value indicating whether
- * the layout should be recreated or not. In this case, `false` means that the existing
- * layout in the `container` view should be reused instead of recreating a new one.
- *
- * @param savedInstanceState saved state of the fragment, which can be useful in case
- * the fragment is restored from a previous configuration.
- *
- * The `savedInstanceState` argument is a Bundle object that contains additional
- * information about the fragment when it is recreated or restored. It may contain
- * various properties such as the fragment's original state before being saved, the
- * ID of the fragment, and other attributes specific to the fragment.
- *
- * @returns a View object representing the inflated layout from the
- * `R.layout.remote_sensables_fragment` file.
- *
- * - The output is an inflated layout, specifically one from R.layout.remote_sensables_fragment.
- * - The layout is inflated into the container view group specified in the function
- * call.
- * - The layout is inflated with false as the third parameter, indicating that it
- * should not be treated as a new instance of the layout.
- *
- * The properties of the output are:
- *
- * - It is an instance of the View class.
- * - It has a reference to the layout defined in R.layout.remote_sensables_fragment.
- * - It has a reference to the container view group, which is used to display the
- * inflated layout.
+ * Inflates a view from an XML layout file and sets it as the content for the fragment.
+ * It uses the `LayoutInflater` class to inflate the layout and returns the inflated
+ * view. The view is then displayed on the screen within the container provided.
+ *
+ * @param layoutInflater factory that creates instances of layouts and returns a view
+ * hierarchy from an XML resource file.
+ *
+ * @param container 2D array of views that will hold the inflated layout.
+ *
+ * @param savedInstanceState bundle containing saved key-value pairs to be used when
+ * restoring the fragment's state after being destroyed and recreated.
+ *
+ * @returns a view instance created from the specified layout resource.
*/
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bundle savedInstanceState) {
@@ -89,9 +61,9 @@ public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bun
}
/**
- * initializes a `RestAdapter` to make API calls to retrieve a list of sensors, and
- * then uses the `create` method to create an instance of the `SensableService` class.
- * The service is then called with a callback to receive the list of sensors in response.
+ * Initializes a list and retrieves data from an API using Retrofit. It handles
+ * successful and failed callbacks by updating the UI with the retrieved data or
+ * logging errors, respectively.
*/
@Override
public void onStart() {
@@ -106,21 +78,15 @@ public void onStart() {
service.listSensables(new Callback>() {
/**
- * is called when a callback operation completes successfully. It adds the list of
- * sensibles to a internal list and notifies the ListArrayAdapter to update the UI.
- *
- * @param sensables list of sensors that have successfully received data, which is
- * added to the existing list of sensors stored in the variable `mSensables`.
- *
- * - `sensables`: A list of `Sensable` objects, which contain attributes such as
- * `id`, `name`, `description`, and `value`.
- *
- * @param response response from the API call, which contains the list of sensibles
- * that will be processed and added to the adapter.
- *
- * - `sensables`: A list of `Sensable` objects representing the successful callback
- * data.
- * - `size`: The number of elements in the `sensables` list.
+ * Handles a callback response by logging a message, updating a local list of sensables,
+ * and notifying an adapter to refresh its display of the updated data. It does so
+ * when a list of sensables is received with a successful response.
+ *
+ * @param sensables list of Sensable objects returned by the API, which is then cleared
+ * and replaced with the new list in the local cache.
+ *
+ * @param response response data from the API call and is not utilized within the
+ * scope of this method.
*/
@Override
public void success(List sensables, Response response) {
@@ -131,14 +97,12 @@ public void success(List sensables, Response response) {
}
/**
- * is called when a callback fails, logging the error to the console with a tag and
- * including the error details in the log message.
- *
- * @param retrofitError error that occurred during the callback, and its toString()
- * method is called to log the error message.
- *
- * - `toString()`: returns a human-readable representation of the error object in
- * string format.
+ * Handles a Retrofit error by logging an error message to the console with the
+ * provided `RetrofitError`. The error is logged at the `ERROR` level, indicating a
+ * serious problem occurred.
+ *
+ * @param retrofitError exception or error that occurred during the Retrofit request
+ * and provides details about the failure.
*/
@Override
public void failure(RetrofitError retrofitError) {
@@ -149,9 +113,9 @@ public void failure(RetrofitError retrofitError) {
}
/**
- * initializes a `ListView` by creating an adapter to display a list of `Sensable`
- * objects and adding an `OnItemClickListener` to handle item clicks and launch the
- * `SensableActivity`.
+ * Initializes a list view with a list of Sensables and sets an on-click listener to
+ * handle item selection events. When an item is clicked, it starts a new activity,
+ * passing the selected Sensable object as an extra through an intent.
*/
private void initialiseList() {
final ListView sensableList = (ListView) getView().findViewById(R.id.sensable_list);
@@ -163,30 +127,21 @@ private void initialiseList() {
//add onclick to listview
sensableList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
/**
- * is called when an item is clicked on a list, it creates an intent with the Sensable
- * activity and passes the extra data as a (Sensable) object.
- *
- * @param parent AdapterView object from which the click event occurred.
- *
- * - `AdapterView>`: This is an interface that represents an adapter view. The
- * type parameter `>` indicates that the view can be any subclass of `AdapterView`.
- * - `parent`: This is the current view being processed, which is an instance of `AdapterView`.
- * - `position`: This is an integer value representing the position of the item in
- * the list or grid that was clicked.
- * - `id`: This is a long value representing the ID of the item that was clicked.
- *
- * @param view view that was clicked and is used to identify the position of the item
- * in the adapter.
- *
- * - `parent`: The parent `AdapterView` that triggered the click event.
- * - `position`: The position of the item in the adapter.
- * - `id`: The unique identifier for the item.
- *
- * @param position 0-based index of the selected item within the adapter's dataset,
- * which is passed to the corresponding `Sensable` object as an extra through the
- * `putExtra()` method when the user clicks on the item.
- *
- * @param id identifier of the selected item.
+ * Processes an item selection event from an adapter view. It creates an intent to
+ * start a new activity and passes the selected item as an extra parameter. The
+ * activity is launched with the specified item information.
+ *
+ * @param parent adapter view that holds the item at the specified position and is
+ * used to retrieve the item using the `getItemAtPosition()` method.
+ *
+ * @param view View object associated with the item at the specified position in the
+ * AdapterView that receives the click event.
+ *
+ * @param position 0-based index of the item selected from the adapter that triggered
+ * the onItemClick event.
+ *
+ * @param id 64-bit unique identifier of the item at the specified `position` in the
+ * adapter.
*/
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
diff --git a/client/src/main/java/io/sensable/client/views/SensableListAdapter.java b/client/src/main/java/io/sensable/client/views/SensableListAdapter.java
index 3a33ab3..38b7fc3 100644
--- a/client/src/main/java/io/sensable/client/views/SensableListAdapter.java
+++ b/client/src/main/java/io/sensable/client/views/SensableListAdapter.java
@@ -25,12 +25,11 @@
* Created by simonmadine on 23/07/2014.
*/
/**
- * is an extension of CursorAdapter that provides a custom layout for displaying
- * sensor data from a database. It takes in a context, layout resource ID, cursor,
- * and AdapterHolder projection, and uses these inputs to inflate a custom layout and
- * bind the data from the cursor to the appropriate UI elements. The AdapterHolder
- * class contains the data from the cursor, including the sensor ID, name, type,
- * value, and unit.
+ * Is an extension of CursorAdapter that provides a custom layout for displaying
+ * sensor data from a database. It uses a cursor to fetch data and binds it to a view,
+ * which can be customized with various elements such as text views, image views, and
+ * colors based on the sensor ID and value. The class also generates random colors
+ * based on the hash code of the sensor name.
*/
public class SensableListAdapter extends CursorAdapter {
private static final String TAG = SensableListAdapter.class.getSimpleName();
@@ -53,45 +52,21 @@ public SensableListAdapter(Context context, int layoutResourceId, Cursor cursor,
}
/**
- * inflates a layout for a list row based on the provided cursor and parent view group.
- *
- * @param context Android framework's current context, which is used to inflate the
- * layout for the list row.
- *
- * - `Context`: This is an object that represents the current application context.
- * It provides access to various resources and services, such as the user interface,
- * data storage, and network connections.
- * - `Cursor`: A cursor object represents a database result set, which can be retrieved
- * through various means such as SQL queries or web services. The cursor contains
- * information about the rows in the result set, including column values for each row.
- *
- * @param cursor Cursor object containing the data to be displayed in the list row.
- *
- * - `Context context`: The application's current context, which contains essential
- * resources and services for rendering the view.
- * - `Cursor cursor`: A cursor object representing a database row, containing
- * attributes such as ID, title, and other relevant data.
- * - `ViewGroup parent`: The parent view group that will hold the new view once created.
- *
- * @param parent ViewGroup that will hold or contain the newly inflated View.
- *
- * - `Context`: The context of the application that initialized the view.
- * - `Cursor`: A cursor object representing the data to be displayed in the view.
- * - `ViewGroup`: The parent view group that contains the newly inflated view.
- *
- * @returns a fully inflated View object representing a list row layout with customizable
- * elements.
- *
- * - `mInflater`: This is an instance of `LayoutInflater`, which is used to inflate
- * the layout for the list row.
- * - `R.layout.sensable_list_row`: This is the resource ID for the layout file that
- * is inflated by `mInflater`.
- * - `Context`: This is the context object, which contains information about the
- * device and operating system on which the app is running.
- * - `Cursor cursor`: This is an instance of `Cursor`, which contains the data that
- * will be displayed in the list row.
- * - `ViewGroup parent`: This is the parent view group, which is used to inflate the
- * layout for the list row.
+ * Inflates a layout resource into a new view, specifically an instance of
+ * `R.layout.sensable_list_row`, which is then returned for use. It takes three
+ * parameters: the context, a cursor object, and a parent ViewGroup. The `false`
+ * parameter indicates that the inflated view should not be attached to the parent immediately.
+ *
+ * @param context application environment and provides access to application-specific
+ * resources, such as inflated views.
+ *
+ * @param cursor data to be displayed in the list row, allowing for the retrieval and
+ * processing of specific column values within the cursor object.
+ *
+ * @param parent ViewGroup that the inflated layout will be added to and helps determine
+ * the measurement and positioning of the inflated view.
+ *
+ * @returns a newly inflated view from the "sensable_list_row" layout.
*/
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
@@ -100,72 +75,28 @@ public View newView(Context context, Cursor cursor, ViewGroup parent) {
}
/**
- * binds a view to a sensor data, displaying the sensor name, ID, type, value and
- * unit. It also sets the background color of the view based on the sensor ID and ID.
- *
- * @param view View object that will be populated with data from the cursor.
- *
- * - `view`: The View object to be populated with data from the cursor.
- * - `context`: The Context object that provides access to resources and information
- * necessary for the function.
- * - `cursor`: The Cursor object containing the data to be bound to the View.
- *
- * The View object has several properties:
- *
- * - `findViewById(int id)`: Allows to find and retrieve a view by its ID. In this
- * case, it is used to retrieve the `TextView` objects with IDs `R.id.row_sensable_name`,
- * `R.id.row_sensable_id`, `R.id.row_sensable_type`, and `R.id.row_sensable_sample_value`.
- * - `setImageResource(int resId)`: Sets the image resource of an ImageView object.
- * In this case, it is used to set the image resource based on the value of the `TYPE`
- * column in the cursor.
- * - `setText(CharSequence text)`: Sets the text of a TextView object. In this case,
- * it is used to set the text of the `name`, `sensorId`, and `unit` TextViews based
- * on the values in the corresponding columns of the cursor.
- * - `setBackgroundColor(int color)`: Sets the background color of a View object.
- * In this case, it is used to set the background color of the View based on the value
- * of the `SENSOR_ID` column in the cursor.
- *
- * @param context Android context of the view being bound, which is used to obtain
- * resources and information necessary for binding the view to the sensor data.
- *
- * - `Context context`: This is the application context, which provides access to
- * various resources and functionality within the application.
- * - `Cursor cursor`: This is the result set from a database query, containing the
- * data that will be displayed in the fragment's list view.
- * - `projection`: This is an instance of `SimpleCursorAdapter.SelectionKey`,
- * representing the columns and values in the cursor that are to be displayed in the
- * list view.
- *
- * The function then processes the cursor data as follows:
- *
- * - It retrieves the text value from the `NAME` column, and sets it as the text for
- * a `TextView` with the ID `R.id.row_sensable_name`.
- * - It retrieves the `SENSOR_ID`, `TYPE`, and `VALUE` columns, and sets their
- * corresponding values as text for `TextView`s with IDs `R.id.row_sensable_id`,
- * `R.id.row_sensable_type`, and `R.id.row_sensable_sample_value`, respectively.
- * - It retrieves the `UNIT` column, and sets its value as text for a `TextView`
- * with the ID `R.id.row_sensable_sample_unit`.
- * - It sets the background color of the list view item to a color determined by the
- * combination of the `SENSOR_ID` and `ID` values.
- *
- * Note that the `Context` object provides access to various resources and functionality
- * within the application, but its specific properties or attributes are not mentioned
- * in this function.
- *
- * @param cursor Cursor object returned by the database query, which contains the
- * data to be displayed in each row of the layout.
- *
- * - `projection`: The projection used to extract the data from the cursor.
- * - `Name`: A column index representing the name of the sensor.
- * - `SensorId`: A column index representing the ID of the sensor.
- * - `Type`: A column index representing the type of sensor (e.g., temperature,
- * humidity, etc.).
- * - `Value`: A column index representing the sample value.
- * - `Unit`: A column index representing the unit of measurement for the sample value.
- * - `JSONObject`: A JSON object containing the raw data from the Value column.
- * - `Sample`: An instance of the Sample class, which contains the parsed JSON data.
- * - `DecimalFormat`: An instance of the DecimalFormat class, used to format the
- * sample value as a decimal number.
+ * Retrieves data from a Cursor and binds it to various views within a row of a list.
+ * It populates text views with sensor name, ID, type, value, and unit, sets an image
+ * based on the sensor type, and changes the background color based on the sensor ID
+ * and row ID.
+ *
+ * @param view View that is being populated with data from the Cursor, allowing the
+ * function to interact with and modify its properties.
+ *
+ * FindViewById: Returns a View object with the given id or null if no such view
+ * exists. The findViewById() method searches for a child view that has been assigned
+ * this ID in its layout description.
+ *
+ * @param context context of the activity or fragment, used to access resources and
+ * perform operations on the UI components within the view.
+ *
+ * Context contains the application's resources and local class loader, as well as
+ * its base directory.
+ *
+ * @param cursor data source from which to retrieve data, providing access to the
+ * columns of the underlying database table through its getter methods.
+ *
+ * Contains columns named NAME, SENSOR_ID, TYPE, VALUE and UNIT.
*/
@Override
public void bindView(View view, Context context, Cursor cursor) {
@@ -201,14 +132,19 @@ public void bindView(View view, Context context, Cursor cursor) {
}
/**
- * generates a random color based on the hash code of a given string, using an array
- * of predefined colors as a probability distribution.
- *
- * @param name 8-bit hash code of the name, which is used to generate a random index
- * into an array of colors.
- *
- * @returns an integer representing a random color between 0 and 255, determined by
- * hash code of the input string.
+ * Generates a random color based on the input string's hash code. It creates an array
+ * of predefined colors and selects one randomly using the hash code to generate a
+ * random index within the array. The selected color is then returned as an integer
+ * value representing an RGB color.
+ *
+ * @param name seed value used to generate a random instance of the Random class,
+ * which determines the selection of a color from the predefined array.
+ *
+ * @returns a random color from an array of predefined colours.
+ *
+ * The output is an integer value representing a color in ARGB (Alpha, Red, Green,
+ * Blue) format. The value is a combination of alpha channel transparency and RGB
+ * colors, with each component ranging from 0 to 255.
*/
private int getColour(String name) {
Random rnd = new Random(name.hashCode());
@@ -228,17 +164,22 @@ private int getColour(String name) {
}
/**
- * represents a holder for sensor data adapter attributes.
- * Fields:
- * - ID (String): a unique identifier for an object or data point.
- * - NAME (String): a name associated with an ID, sensor ID, type, value, and unit.
- * - SENSOR_ID (String): a unique identifier for each sensor.
- * - TYPE (String): a string value indicating the type of sensable being displayed,
- * with possible values being "temperature", "humidity", "pressure", etc.
- * - VALUE (String): a string value with no additional context or information beyond
- * what is explicitly defined in the class definition.
- * - UNIT (String): a textual representation of the unit of measurement associated
- * with a sample value.
+ * Represents a data holder for sensor data adapter attributes.
+ *
+ * - ID (String): represents a unique identifier for an object or data point.
+ *
+ * - NAME (String): represents a name associated with an ID.
+ *
+ * - SENSOR_ID (String): represents a unique identifier for each sensor.
+ *
+ * - TYPE (String): represents a string value indicating the type of sensable being
+ * displayed.
+ *
+ * - VALUE (String): in the AdapterHolder class represents a string value with no
+ * additional context or information beyond what is explicitly defined.
+ *
+ * - UNIT (String): represents a textual representation of the unit of measurement
+ * associated with a sample value.
*/
static class AdapterHolder {
String ID;
diff --git a/library/src/main/java/io/sensable/SensableService.java b/library/src/main/java/io/sensable/SensableService.java
index 5c21362..8d66bd9 100644
--- a/library/src/main/java/io/sensable/SensableService.java
+++ b/library/src/main/java/io/sensable/SensableService.java
@@ -18,8 +18,8 @@
* retrieving sensor data.
*/
/**
- * provides methods for interacting with a REST API to retrieve and manipulate sensory
- * data.
+ * Provides a contract for interacting with a REST API to manipulate and retrieve
+ * sensory data through various endpoints.
*/
public interface SensableService {
@GET("/sensable")
diff --git a/library/src/main/java/io/sensable/model/Sample.java b/library/src/main/java/io/sensable/model/Sample.java
index 6bf3d66..5e46f72 100644
--- a/library/src/main/java/io/sensable/model/Sample.java
+++ b/library/src/main/java/io/sensable/model/Sample.java
@@ -12,10 +12,10 @@
* Created by madine on 01/07/14.
*/
/**
- * is a Java class that represents a sample data point with timestamp, value, and
- * location information. The class implements the Parcelable interface for serialization
- * and deserialization purposes. It also provides methods for getting and setting the
- * timestamp, value, and location fields.
+ * Represents a data point with timestamp, value, and location information for
+ * serialization and deserialization purposes. It implements the Parcelable interface
+ * to facilitate data transfer between applications. The class also provides methods
+ * for converting instances to JSON objects and string representations.
*/
public class Sample implements Parcelable {
private long timestamp;
@@ -38,47 +38,59 @@ public Sample(JSONObject json) {
}
/**
- * returns the value of a `timestamp` field.
- *
- * @returns a long value representing the current timestamp.
+ * Returns a value representing time. The returned value is accessed through a variable
+ * named `timestamp`. It is possible to obtain the current system time using this method.
+ *
+ * @returns a non-negative integer value representing seconds since epoch.
*/
public long getTimestamp() {
return timestamp;
}
/**
- * sets the value of a class instance field named `timestamp`.
- *
- * @param timestamp 64-bit value of the timestamp that is used to update the value
- * of the `timestamp` field of the current object.
+ * Assigns a specified value to the object's `timestamp` field. This method takes a
+ * single long integer parameter representing the new timestamp and stores it within
+ * the object. The timestamp is then available for retrieval or further processing
+ * as required.
+ *
+ * @param timestamp 64-bit long value that is being assigned to the class's internal
+ * `timestamp` variable, updating its current value.
*/
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
/**
- * returns the value of a variable named `value`.
- *
- * @returns a double value representing the variable `value`.
+ * Returns a double-precision floating-point number representing the current state
+ * of the object's value attribute. This method provides read-only access to the
+ * stored value. It does not modify the state of the object.
+ *
+ * @returns a double representing an internal state variable known as `value`.
*/
public double getValue() {
return value;
}
/**
- * sets the value field of its instance to the given double value.
- *
- * @param value double value that will be assigned to the `value` field of the
- * function's caller.
+ * Accepts a double data type as an argument and assigns it to the instance variable
+ * 'value' within the class. This allows the property to be set or modified with any
+ * valid numeric value. The assigned value is then stored internally for further use.
+ *
+ * @param value new double value to be assigned to the object's property with the
+ * same name.
*/
public void setValue(double value) {
this.value = value;
}
/**
- * returns an integer value of 0, indicating that no contents are present or needed.
- *
- * @returns an integer value of 0.
+ * Returns an integer value indicating which types of data are contained within the
+ * object being serialized or de-serialized by a Parcelable implementation. The method
+ * is called internally during serialization and deserialization processes. A return
+ * value of 0 indicates that there are no file descriptors, file paths, or other
+ * file-related resources.
+ *
+ * @returns an integer indicating the object's serializable state, which is always 0.
*/
@Override
public int describeContents() {
@@ -86,18 +98,16 @@ public int describeContents() {
}
/**
- * writes the `timestamp` and `value` parameters to a Parcel object, using the specified
- * flags for formatting.
- *
- * @param dest parcel that will be written to.
- *
- * - `dest`: The Parcel object that represents the destination buffer for writing
- * data. It has a `writeLong()` and `writeDouble()` method for writing timestamp and
- * value respectively in this case.
- *
- * @param flags 32-bit integer value that specifies the type of data being written
- * to the Parcel, with possible values ranging from 0 to 7, and it is used to determine
- * the format of the data being written.
+ * Serializes object data into a Parcel for storage or transmission. It writes two
+ * values to the parcel: a long integer timestamp and a double value, both retrieved
+ * from the object's internal state. The data is written in a format that can be
+ * reconstructed later.
+ *
+ * @param dest parcel object where the data is being written to.
+ *
+ * @param flags bitmask of parceling options and is used to specify additional
+ * instructions for parceling objects, such as whether to use its own class loader
+ * or not.
*/
@Override
public void writeToParcel(Parcel dest, int flags) {
@@ -108,44 +118,30 @@ public void writeToParcel(Parcel dest, int flags) {
public static final Parcelable.Creator CREATOR
= new Parcelable.Creator() {
/**
- * creates a new instance of the `Sample` class from a provided Parcel object.
- *
- * @param in `Parcel` object that contains data to be used in creating a new instance
- * of the `Sample` class.
- *
- * The `Parcel in` received is a container for a `Sample` object, which contains
- * details about a sample such as its ID, name, and dimensions. The `in` parameter
- * can be decoded or deserialized to create an instance of the `Sample` class.
- *
- * @returns a new instance of the `Sample` class initialized with the values from the
- * provided Parcel.
- *
- * - The input Parcel is used to create a new instance of the `Sample` class.
- * - The `Sample` class represents a sample object with unspecified attributes and
- * methods.
- * - The `new Sample(in)` syntax creates an instance of the `Sample` class using the
- * values from the input Parcel.
+ * Recreates an instance of `Sample` from a parcel, which is a data container used
+ * for inter-process communication. It does so by creating a new `Sample` object and
+ * passing the parcel to its constructor. The resulting object contains the deserialized
+ * data from the parcel.
+ *
+ * @param in Parcel object from which the Sample object is being reconstructed or
+ * created from serialized data.
+ *
+ * @returns a new instance of the `Sample` class.
*/
public Sample createFromParcel(Parcel in) {
return new Sample(in);
}
/**
- * returns an array of `Sample` objects with the specified size.
- *
- * @param size amount of space to be allocated for an array of `Sample` objects, which
- * is then returned as a new array.
- *
- * @returns an array of `Sample` objects with the specified size.
- *
- * - The `Sample` array returned by the function has a fixed size specified by the
- * `size` parameter passed to the function.
- * - The array is initialized with a default value for each element, which is `null`
- * in this case.
- * - The array is immutable once it is created and cannot be modified after initialization.
- * - The function does not perform any error handling or validation of the input
- * parameters, so it is possible for the function to create an invalid or incomplete
- * array if the input parameters are incorrect.
+ * Creates a new array of objects, each instance being an instance of the `Sample`
+ * class, with the specified `size`. The returned array is initialized but not populated
+ * with any data. It has no bounds checking, which means it can throw an exception
+ * if passed an invalid size.
+ *
+ * @param size umber of elements to be allocated in the newly created array of type
+ * `Sample`.
+ *
+ * @returns an array of `Sample` objects with a specified length.
*/
public Sample[] newArray(int size) {
return new Sample[size];
@@ -158,10 +154,11 @@ private Sample(Parcel in) {
}
/**
- * returns a string representation of an object by combining its `timestamp` and `value`.
- *
- * @returns a string representation of the object, consisting of the current timestamp
- * and the value of the object.
+ * Returns a string representation of an object, concatenating its timestamp and
+ * value. The returned string is in the format "timestamp: value". It appears to be
+ * used for debugging or logging purposes.
+ *
+ * @returns a string combining timestamp and value.
*/
@Override
public String toString() {
@@ -169,15 +166,12 @@ public String toString() {
}
/**
- * converts an object of type `MyObject` into a JSON object, including the timestamp
- * and value properties.
- *
- * @returns a JSONObject containing the current timestamp and value of the given object.
- *
- * - `json`: A JSONObject representing the timestamp and value of the object in a
- * JSON format.
- * - `timestamp`: The timestamp value represented as a string.
- * - `value`: The value of the object represented as a string.
+ * Creates a JSONObject representing data, including timestamp and value. The JSONObject
+ * is populated with values obtained from the object's `getTimestamp` and `getValue`
+ * methods. If an error occurs during creation, it is silently discarded and the
+ * function returns null.
+ *
+ * @returns a JSONObject containing timestamp and value properties.
*/
public JSONObject toJson() {
JSONObject json = null;
@@ -190,23 +184,22 @@ public JSONObject toJson() {
}
/**
- * returns an array of doubles representing the location of an object.
- *
- * @returns a double array containing the location of an object.
+ * Returns an array of doubles representing a geographical location. The returned
+ * value is retrieved from a previously initialized variable named `location`. This
+ * allows other parts of the program to access and utilize the stored location data.
+ *
+ * @returns a double array representing the current location.
*/
public double[] getLocation() {
return location;
}
/**
- * sets the location of an object to a provided double array.
- *
- * @param location 3D coordinates of an object or entity in a program, and by assigning
- * it to the `this.location` field, the function sets the location of the object or
- * entity.
- *
- * - This parameter is of type double[], indicating an array of double values.
- * - The function assigns the input `location` to the field `location` of this class.
+ * Assigns a new location to the object's internal state. It takes an array of double
+ * values representing coordinates as input and updates the corresponding instance
+ * variable. This allows the object's location to be changed dynamically.
+ *
+ * @param location 1D array of doubles that is assigned to the instance variable `location`.
*/
public void setLocation(double[] location) {
this.location = location;
diff --git a/library/src/main/java/io/sensable/model/SampleResponse.java b/library/src/main/java/io/sensable/model/SampleResponse.java
index 671f9b3..835b9b7 100644
--- a/library/src/main/java/io/sensable/model/SampleResponse.java
+++ b/library/src/main/java/io/sensable/model/SampleResponse.java
@@ -4,8 +4,10 @@
* Created by simonmadine on 18/07/2014.
*/
/**
- * is a Java class with four attributes and three methods. The attributes include a
- * message and sensorid, while the methods allow for setting and retrieving these values.
+ * Encapsulates two attributes: message and sensorid. It provides getter and setter
+ * methods for these attributes, allowing access and modification of their values.
+ * The class is designed to store and manipulate string data related to messages and
+ * sensor IDs.
*/
public class SampleResponse {
private String message;
@@ -15,38 +17,48 @@ public SampleResponse() {
}
/**
- * returns a string representing a message.
- *
- * @returns a string representing the message.
+ * Returns a string value stored in the `message` variable. It is likely to be part
+ * of a class that encapsulates some kind of messaging system, providing a way to
+ * retrieve the current message. The returned message can then be used by the calling
+ * code as needed.
+ *
+ * @returns a string representing the current value of the `message` variable.
*/
public String getMessage() {
return message;
}
/**
- * sets the value of the object's `message` field to the provided string argument.
- *
- * @param message message that will be stored in the `message` field of the class
- * instance, which is being modified by the `setMessage()` method call.
+ * Assigns a given string to the `message` field of the object. This allows the
+ * object's message property to be updated with a new value. The new message replaces
+ * any previously stored message.
+ *
+ * @param message value to be assigned to the instance variable `this.message`,
+ * updating its value within the class.
*/
public void setMessage(String message) {
this.message = message;
}
/**
- * returns a `String` object representing the `sensorid`.
- *
- * @returns a string representing the sensor ID.
+ * Retrieves and returns a string value representing the `sensorid`. The returned
+ * value is stored in the instance variable `sensorid`. This function allows access
+ * to the `sensorid` value for use elsewhere in the program.
+ *
+ * @returns a string representing the value of the `sensorid` variable.
*/
public String getSensorid() {
return sensorid;
}
/**
- * sets the value of the `sensorid` field within a Java object, assigning the given
- * string value to it.
- *
- * @param sensorid ID of a sensor that is being set within the function.
+ * Assigns a specified `sensorid` value to an instance variable. The `sensorid`
+ * parameter is passed as a string, and it updates the internal state of the object
+ * with the provided ID. This method sets the sensor ID for subsequent use within the
+ * class.
+ *
+ * @param sensorid identifier of a sensor, which is assigned to the instance variable
+ * `this.sensorid` in the method.
*/
public void setSensorid(String sensorid) {
this.sensorid = sensorid;
diff --git a/library/src/main/java/io/sensable/model/SampleSender.java b/library/src/main/java/io/sensable/model/SampleSender.java
index 0f364bb..0998159 100644
--- a/library/src/main/java/io/sensable/model/SampleSender.java
+++ b/library/src/main/java/io/sensable/model/SampleSender.java
@@ -4,62 +4,54 @@
* Created by madine on 16/07/14.
*/
/**
- * is a Java class that represents a sender of samples. It has two private fields:
- * accessToken and sample, which can be set and retrieved using getter and setter
- * methods. The class also provides methods to retrieve the access token and sample.
+ * Represents a sender of samples with two private fields: access token and sample.
+ * It provides getter and setter methods to retrieve and set these fields. The class
+ * allows the manipulation of an access token and a Sample object, which is likely a
+ * custom class containing some data or values.
*/
public class SampleSender {
private String accessToken;
private Sample sample;
/**
- * returns a string representing an access token.
- *
- * @returns a string representing the access token.
+ * Retrieves and returns a stored access token as a string. The function does not
+ * modify or process the access token; it simply provides direct access to its value.
+ *
+ * @returns a string value representing an access token.
*/
public String getAccessToken() {
return accessToken;
}
/**
- * sets the value of a class instance field `accessToken`.
- *
- * @param accessToken access token to be stored in the class instance.
+ * Sets a specified access token as an attribute of the current object. The provided
+ * string is assigned to the `accessToken` field, allowing it to be used by the object
+ * for subsequent operations or authentication purposes.
+ *
+ * @param accessToken value that is assigned to the instance variable `this.accessToken`,
+ * updating its state.
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
/**
- * returns a `sample` object, which contains some data or values that can be used for
- * various purposes in the program.
- *
- * @returns a reference to an instance of the `Sample` class.
- *
- * - The `sample` variable is of type `public Sample`. This indicates that it is an
- * instance of a class called `Sample`, which is likely to be a custom class defined
- * by the author of the code.
- * - The return statement simply returns the value of the `sample` variable, without
- * any additional processing or manipulation.
- * - There are no variables or methods defined within the function that could affect
- * the properties of the returned output. Therefore, the output is guaranteed to be
- * a complete and accurate representation of the `sample` variable at the time the
- * function was called.
+ * Retrieves a `Sample` object and returns it. The object is stored in the `sample`
+ * variable. This method allows access to the `sample` object, making its value
+ * available for use by other parts of the program.
+ *
+ * @returns an instance of the `Sample` class named `sample`.
*/
public Sample getSample() {
return sample;
}
/**
- * sets a `Sample` object to a class member called `sample`.
- *
- * @param sample `Sample` data type and sets its associated field, `this.sample`, to
- * the input value provided in the function call.
- *
- * - `this`: A reference to the current object instance, which is the receiver of
- * the method call.
- * - `sample`: A variable of type `Sample`, which holds the value passed to the
- * method as its argument.
+ * Assigns a new value to the instance variable `sample`, replacing its previous value
+ * with the provided `sample` object. This method updates the internal state of the
+ * class by setting the reference of the `sample` field to the given `sample` parameter.
+ *
+ * @param sample Sample object to be assigned to the instance variable `this.sample`.
*/
public void setSample(Sample sample) {
this.sample = sample;
diff --git a/library/src/main/java/io/sensable/model/ScheduledSensable.java b/library/src/main/java/io/sensable/model/ScheduledSensable.java
index e40de7d..4b4fc1c 100644
--- a/library/src/main/java/io/sensable/model/ScheduledSensable.java
+++ b/library/src/main/java/io/sensable/model/ScheduledSensable.java
@@ -8,11 +8,10 @@
* Created by madine on 01/07/14.
*/
/**
- * appears to be a data model for managing sensor readings and samples. It has various
- * fields such as ID, sensor ID, name, internal sensor ID, sensortype, unit, pending,
- * sample, private sensor, access token, and location (which is a double array). The
- * class also has methods for getting or setting values for these fields, as well as
- * a method for generating a JSON string representation of the sample data.
+ * Is a data model for managing sensor readings and samples. It encapsulates various
+ * attributes such as ID, sensor ID, name, internal sensor ID, type, unit, pending
+ * status, sample data, access token, and location. The class provides getter and
+ * setter methods to manipulate these attributes.
*/
public class ScheduledSensable {
private int id; // Internal DB ID
@@ -33,195 +32,217 @@ public ScheduledSensable() {
}
/**
- * retrieves a predefined string value, `sensorid`.
- *
- * @returns a string representing the sensor ID.
+ * Returns a value. It retrieves and provides access to the private variable `sensorid`,
+ * which is likely a unique identifier for a sensor, allowing other parts of the
+ * program to utilize its information. This function serves as a simple getter method
+ * for the sensor ID.
+ *
+ * @returns a string value representing the sensor ID.
*/
public String getSensorid() {
return sensorid;
}
/**
- * sets a field named `sensorid` to a given string value, providing a new value for
- * the object's sensor identification.
- *
- * @param sensorid identifier of a specific sensor that this method is related to.
+ * Sets a string value to an instance variable named `sensorid`. It takes one parameter,
+ * `sensorid`, which is used to update the object's state. This variable can be
+ * accessed and modified through this method.
+ *
+ * @param sensorid value to be assigned to the instance variable `this.sensorid`.
*/
public void setSensorid(String sensorid) {
this.sensorid = sensorid;
}
/**
- * retrieves a string representing the caller's name.
- *
- * @returns a string representing the name of an object.
+ * Retrieves a string value named `name`. The returned value is a reference to an
+ * existing instance variable, indicating that it does not create or modify any data.
+ * This method provides read-only access to the stored name.
+ *
+ * @returns a string representation of the object's name attribute.
*/
public String getName() {
return name;
}
/**
- * sets the value of the object's `name` field to the provided String argument.
- *
- * @param name new value of the class's `name` field.
+ * Assigns a given string value to the instance variable `name`. It sets the attribute
+ * `name` with the provided input `String name`, allowing external modification of
+ * the object's internal state.
+ *
+ * @param name new value to be assigned to the instance variable `name`.
*/
public void setName(String name) {
this.name = name;
}
/**
- * returns the internal sensor ID of an object.
- *
- * @returns an integer representing the internal sensor ID.
+ * Returns an integer value representing the internal sensor ID. It does not accept
+ * any parameters and simply retrieves the value stored in the `internalSensorId`
+ * variable. This function allows external access to the internal sensor ID for further
+ * processing or usage.
+ *
+ * @returns an integer value representing the internal sensor ID.
*/
public int getInternalSensorId() {
return internalSensorId;
}
/**
- * sets the value of the internal sensor ID field of a class instance to the argument
- * passed as an integer.
- *
- * @param sensorId internal sensor ID that is being set for the object.
+ * Sets an internal sensor ID to a specified value. It assigns an integer value to
+ * the instance variable `internalSensorId`. The assigned value is used to identify
+ * the internal sensor within the program.
+ *
+ * @param sensorId internal sensor identifier, which is assigned to the instance
+ * variable `internalSensorId`.
*/
public void setInternalSensorId(int sensorId) {
this.internalSensorId = sensorId;
}
/**
- * returns a string representing the sensortype of an object.
- *
- * @returns a string representing the sensory type.
+ * Retrieves and returns a string value representing the sensor type. This method
+ * does not modify any data; it simply provides access to an existing property,
+ * allowing other parts of the program to use its value as needed.
+ *
+ * @returns a string representing the sensor type.
*/
public String getSensortype() {
return sensortype;
}
/**
- * sets a string value for the class member `sensortype`.
- *
- * @param sensortype sensor type for which the method is setting the value of the
- * `sensortype` field.
+ * Assigns a specified string value to an instance variable named `sensortype`. This
+ * variable is likely used to store and manage sensor type information within an
+ * object. The assigned value can be retrieved later for further processing or display.
+ *
+ * @param sensortype type of sensor to be set, which is stored as an instance variable
+ * within the object.
*/
public void setSensortype(String sensortype) {
this.sensortype = sensortype;
}
/**
- * retrieves a `String` value representing the unit of measurement for the current context.
- *
- * @returns a string representing the unit of measurement.
+ * Retrieves a string value representing a unit and returns it. It appears to be a
+ * getter method, accessing an instance variable named `unit`. The returned value is
+ * used elsewhere in the program likely for display or further processing.
+ *
+ * @returns a `String` value representing the `unit`.
*/
public String getUnit() {
return unit;
}
/**
- * sets a reference to a `String` variable `unit` within the function's scope,
- * effectively updating the value of the class-level variable `this.unit`.
- *
- * @param unit value of the unit of measurement for the object being manipulated by
- * the `setUnit()` method.
+ * Assigns a specified string value to the instance variable `unit`. This method
+ * updates the internal state of an object, allowing it to store and retain a unit
+ * string representation. The updated value is stored in the object's memory for
+ * future reference.
+ *
+ * @param unit value to be assigned to the `this.unit` field, updating its current
+ * state with the new string value provided.
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
- * retrieves the value of the `pending` field, which represents the number of tasks
- * that are pending to be executed.
- *
- * @returns the value of the `pending` variable, which is an integer representing the
- * number of tasks that are pending to be executed.
+ * Returns an integer value representing a variable named `pending`. This function
+ * does not perform any operation, it simply retrieves and returns the current state
+ * of the `pending` variable. The returned value is accessible to the caller.
+ *
+ * @returns an integer representing the value of the `pending` variable.
*/
public int getPending() {
return pending;
}
/**
- * sets the value of the class's `pending` field to the provided integer argument.
- *
- * @param pending integer value that will be stored in the `this.pending` field of
- * the class.
+ * Assigns a value to the instance variable `pending`. It updates the state of an
+ * object by setting its `pending` attribute to the provided integer value. The
+ * function does not return any value, as it is declared as `void`.
+ *
+ * @param pending value to be assigned to the instance variable `this.pending`.
*/
public void setPending(int pending) {
this.pending = pending;
}
/**
- * returns a reference to an `sample` object.
- *
- * @returns a reference to an `Sample` object named `sample`.
- *
- * - The returned object is of type `sample`, indicating that it belongs to a class
- * named `sample`.
- * - The object contains an instance variable named `sample`, which holds some value.
- * - The exact value of the `sample` instance variable is not specified in the
- * function, as it depends on the implementation of the `sample` class.
+ * Returns a reference to an instance variable `sample` of type `Sample`. This function
+ * is used to access or retrieve the value stored in `sample`. It provides read-only
+ * access to the sample object.
+ *
+ * @returns a reference to an object of type `Sample`.
*/
public Sample getSample() {
return sample;
}
/**
- * sets the `sample` field of an object to the provided `Sample` object.
- *
- * @param sample Sample object that is assigned to the `this.sample` field within the
- * function.
- *
- * - The field `this.sample` is assigned with the given `sample` object as a reference.
- * - `sample` is an instance of the class `Sample`, which has no explicit properties
- * or attributes mentioned in the code snippet provided.
+ * Assigns a new `Sample` object to the `sample` field of the class, replacing any
+ * previously assigned value. This function takes an instance of the `Sample` class
+ * as input and updates the internal state of the class accordingly.
+ *
+ * @param sample Sample object to be assigned to the instance variable `this.sample`.
*/
public void setSample(Sample sample) {
this.sample = sample;
}
/**
- * returns a boolean value indicating whether the sensor is private or not.
- *
- * @returns a boolean value indicating whether the sensor is private or not.
+ * Determines whether a sensor is private or not. It returns a boolean value indicating
+ * the status of the sensor, which is stored in the `privateSensor` variable. This
+ * function simply retrieves and returns the current state of the sensor without
+ * performing any modifications or computations.
+ *
+ * @returns a boolean value indicating whether the `privateSensor` variable is true
+ * or false.
*/
public boolean isPrivateSensor() {
return privateSensor;
}
/**
- * sets the value of a field named `privateSensor` to a provided boolean value,
- * updating the state of the object.
- *
- * @param privateSensor boolean value that determines whether the sensor is private
- * or not, which is then stored as an attribute of the class instance represented by
- * the `this` reference.
+ * Updates the value of a boolean variable `privateSensor`. It takes a single argument
+ * of type `boolean`, which represents the new state of the sensor, and assigns it
+ * to the corresponding instance variable. This allows the object's internal state
+ * to be modified.
+ *
+ * @param privateSensor value to be assigned to the instance variable `this.privateSensor`,
+ * effectively setting it to either true or false based on the provided boolean value.
*/
public void setPrivateSensor(boolean privateSensor) {
this.privateSensor = privateSensor;
}
/**
- * retrieves a pre-defined access token from storage and returns it as a string.
- *
- * @returns a string representing the access token.
+ * Retrieves and returns an access token as a string value.
+ *
+ * @returns a string representing an access token.
*/
public String getAccessToken() {
return accessToken;
}
/**
- * sets a reference to an `accessToken` variable, which stores a string value
- * representing an authentication token for API calls.
- *
- * @param accessToken token that grants access to the protected resources.
+ * Assigns a specified value to an instance variable named `accessToken`. The input
+ * parameter is a string representing the access token. This variable stores the
+ * provided access token for later use.
+ *
+ * @param accessToken value to be assigned to the instance variable `this.accessToken`.
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
/**
- * retrieves a double array representing the location of an object from its associated
- * sample object, if available; otherwise, it returns a default location array.
- *
- * @returns a double array containing the location of the sample.
+ * Retrieves a location from an internal `Sample` object. If the `sample` object is
+ * null, it creates a new one first. The function returns an array of double values
+ * representing the location.
+ *
+ * @returns an array of doubles representing a location.
*/
public double[] getLocation() {
if (this.sample == null) {
@@ -231,13 +252,12 @@ public double[] getLocation() {
}
/**
- * sets the location of a `Sample` object associated with an instance of the `JavaClass`.
- *
- * @param location 2D location of an object in a sample, which is then set to the
- * corresponding field in the internal `Sample` class.
- *
- * - `this.sample`: A reference to an instance variable named `sample`.
- * - `location`: An array of double values representing the location data.
+ * Sets a double array location for an existing or newly created instance of the
+ * class's internal `Sample` object if it is null, and then assigns the location to
+ * the Sample object.
+ *
+ * @param location 2D coordinates to be set as the location of an instance of the
+ * `Sample` class, which is initialized if it is null.
*/
public void setLocation(double[] location) {
if (this.sample == null) {
@@ -248,19 +268,24 @@ public void setLocation(double[] location) {
}
/**
- * returns the `id` field of an object.
- *
- * @returns an integer representing the value of the `id` field.
+ * Retrieves and returns the value of a private variable `id`. This variable likely
+ * represents an identifier or unique key for an object, and this method provides
+ * access to its current state. The returned value is an integer representing the id.
+ *
+ * @returns an integer value representing the identifier of a specific object.
*/
public int getId() {
return id;
}
/**
- * sets the `id` field of an object to a specified value.
- *
- * @param id integer value that will be assigned to the `id` field of the class
- * instance being updated by the `setId()` method.
+ * Assigns a given integer value to an instance variable named `id`. This instance
+ * variable is presumably declared within the same class and has been initialized
+ * previously. The function takes an `int` parameter `id` that represents the new
+ * value for the `id` variable.
+ *
+ * @param id identifier to be set for an object, which is stored in the instance
+ * variable `this.id`.
*/
public void setId(int id) {
this.id = id;
@@ -275,10 +300,11 @@ public void setId(int id) {
// }
/**
- * converts a `Sample` object to a JSON string if it is not null, otherwise it creates
- * a new `Sample` object and returns its JSON representation.
- *
- * @returns a JSON string representing a sample object.
+ * Returns a JSON representation of a sample object. If the internal sample is not
+ * null, it converts and logs the internal sample; otherwise, it creates a new sample,
+ * converts and logs it, then returns the result.
+ *
+ * @returns a JSON string representation of either `this.sample` or a new `Sample` object.
*/
public String getSampleAsJsonString() {
if(this.sample != null) {
diff --git a/library/src/main/java/io/sensable/model/Sensable.java b/library/src/main/java/io/sensable/model/Sensable.java
index 1cd5f7a..a4da97c 100644
--- a/library/src/main/java/io/sensable/model/Sensable.java
+++ b/library/src/main/java/io/sensable/model/Sensable.java
@@ -11,11 +11,10 @@
* Created by madine on 01/07/14.
*/
/**
- * is a Java class that represents a sensory data point with various metadata such
- * as location, sensor ID, name, type, and unit. The class also contains a sample
- * value, which can be retrieved through the `getSample()` method or set through the
- * `setSample()` method. Additionally, the class has a `writeToParcel()` method for
- * serializing the data to a Parcel object.
+ * Is a Parcelable object that represents a sensory data point with various metadata
+ * such as location, sensor ID, name, type, and unit. It also contains sample values
+ * and can serialize its state to a Parcel object for efficient storage or transmission.
+ * The class provides methods for accessing and manipulating these properties.
*/
public class Sensable implements Parcelable {
private double[] location;
@@ -31,111 +30,116 @@ public Sensable() {
}
/**
- * returns an array of doubles representing the location of an object.
- *
- * @returns a double-valued array containing the location of the object.
+ * Returns an array of doubles representing a location. The returned array contains
+ * the coordinates of a specific point or object. This function does not perform any
+ * calculations, it simply retrieves and exposes the pre-defined location data.
+ *
+ * @returns an array of double values representing a geographic location.
*/
public double[] getLocation() {
return location;
}
/**
- * sets the location of an object, represented by a double array, to the input argument
- * provided.
- *
- * @param location 3D coordinates of an object or entity, which is assigned to the
- * function's local variable `this.location`.
- *
- * - The `double[]` parameter `location` represents an array of double values
- * containing the location coordinates.
- * - Each element in the array corresponds to a particular coordinate (longitude and
- * latitude) for the location.
+ * Assigns a specified double array as the value for an instance variable `location`.
+ * This variable is expected to hold a specific set of geographic coordinates. The
+ * method sets or updates the current location with the provided values.
+ *
+ * @param location 2D array of double values that sets the location attribute for the
+ * object.
*/
public void setLocation(double[] location) {
this.location = location;
}
/**
- * retrieves the value of a static variable `sensorid`.
- *
- * @returns a string representing the sensor ID.
+ * Retrieves and returns a string value representing a sensor ID. This value is stored
+ * as an instance variable named `sensorid`. The function does not modify any data
+ * or perform complex operations, simply returning the current state of the `sensorid`
+ * variable.
+ *
+ * @returns a string representing the value of the `sensorid`.
*/
public String getSensorid() {
return sensorid;
}
/**
- * sets the value of a field named `sensorid` to a provided string parameter.
- *
- * @param sensorId ID of the sensor to which the method is applying the specified
- * action, and it is assigned to the `sensorid` field of the class instance.
+ * Assigns a specified `sensorId` to an instance variable. The function takes a
+ * `String` parameter and updates the value of the `sensorid` attribute within the
+ * class. This allows external code to modify the sensor ID associated with an object.
+ *
+ * @param sensorId identifier of a sensor and is used to set the value of the
+ * corresponding instance variable `this.sensorid`.
*/
public void setSensorid(String sensorId) {
this.sensorid = sensorId;
}
/**
- * returns a string representing the name of an object.
- *
- * @returns a string representing the name of the object.
+ * Returns a string value named `name`. This suggests that it retrieves or accesses
+ * a predefined string variable, likely a property or attribute of an object or class.
+ *
+ * @returns a string value stored in the `name` variable.
*/
public String getName() {
return name;
}
/**
- * sets the value of the class member variable `name`.
- *
- * @param name name to be assigned to the object, and by assigning a value to it
- * within the function, the name of the object is updated.
+ * Assigns a specified string value to the instance variable `name`. This method sets
+ * the property of an object with a new value, effectively updating its state. It
+ * takes one parameter, a string that represents the new name.
+ *
+ * @param name value to be assigned to the instance variable `this.name`, allowing
+ * it to be set or updated by the method.
*/
public void setName(String name) {
this.name = name;
}
/**
- * returns a string representing the sensory type of an object.
- *
- * @returns a string representing the sensory type.
+ * Returns a string value representing the sensor type. It retrieves and provides
+ * access to an internal variable named `sensortype`. The retrieved value is passed
+ * back as a string, allowing external code to utilize it for further processing or
+ * display purposes.
+ *
+ * @returns a string value of type `sensortype`.
*/
public String getSensortype() {
return sensortype;
}
/**
- * sets a object's `sensortype` field to the provided String value.
- *
- * @param sensortype sensor type to be used by the `setSensortype()` method, providing
- * a means for setting the specific type of sensor that will be used by the method.
+ * Sets a string value to an instance variable named `sensortype`. This method allows
+ * the assignment of a new sensor type to an object, which can be accessed and used
+ * elsewhere in the program through the public property.
+ *
+ * @param sensortype value to be assigned to the instance variable `sensortype`.
*/
public void setSensortype(String sensortype) {
this.sensortype = sensortype;
}
/**
- * returns an array of sample objects, `samples`.
- *
- * @returns an array of `Sample` objects.
- *
- * - `samples`: A sample array of objects that contains information about the samples.
- * The length of this array indicates the total number of samples available. Each
- * object within the array has fields for the sample name, description, and other
- * relevant details.
+ * Retrieves a collection of `Sample` objects and returns it as an array. The retrieved
+ * samples are stored in the `samples` variable, which is accessible within the scope
+ * of this method.
+ *
+ * @returns an array of `Sample` objects named `samples`.
*/
public Sample[] getSamples() {
return samples;
}
/**
- * updates the reference to the last sample in a collection and sets the value of the
- * `samples` field to that collection.
- *
- * @param samples sample data to be stored in the `this.samples` member variable.
- *
- * - Length greater than 0: The `samples` array has at least one element, indicating
- * that the last element in the array can be used for setting a sample.
- * - Length equal to 0: The `samples` array is empty, meaning no samples are present
- * and the last call to `setSample` resulted in null.
+ * Sets a given array of `Sample` objects as the new sample data for an instance. If
+ * the array is not empty, it sets the last sample from the array using another method
+ * `setSample`. Otherwise, it sets the sample to null.
+ *
+ * @param samples array of Sample objects to be processed by the function, which then
+ * sets the last sample or null depending on its length and updates the internal state
+ * with the provided samples.
*/
public void setSamples(Sample[] samples) {
if(samples.length > 0) {
@@ -147,31 +151,22 @@ public void setSamples(Sample[] samples) {
}
/**
- * returns a `Sample` object, which is its own instance variable `sample`.
- *
- * @returns a reference to an object of type `Sample`.
- *
- * The `sample` variable is of type `public Sample`, indicating that it is a class
- * member and can be accessed within the same class or package.
- *
- * The `return` statement indicates that the function will return the `sample` object
- * to the caller.
- *
- * The `sample` object represents an instance of the `Sample` class, which contains
- * properties and methods related to sample data.
+ * Retrieves a reference to an object of type `Sample`. It returns the current value
+ * of the `sample` variable. This allows external code to access and utilize the
+ * internal state of the class.
+ *
+ * @returns an instance of class `Sample`.
*/
public Sample getSample() {
return sample;
}
/**
- * sets the value of the class member variable `sample`.
- *
- * @param sample Sample object that is assigned to the field `this.sample` within the
- * function, effectively storing the value of the input parameter.
- *
- * - `this.sample`: This field assigns the input `sample` to a class member variable
- * named `sample`.
+ * Assigns a new value to the `sample` field. It takes an object of type `Sample` as
+ * input and updates the internal state of the class by setting it equal to the
+ * provided sample object. This allows the class to manage external samples internally.
+ *
+ * @param sample object to be assigned to the instance variable `this.sample`.
*/
public void setSample(Sample sample) {
@@ -179,47 +174,57 @@ public void setSample(Sample sample) {
}
/**
- * returns a string representing the unit associated with a given value.
- *
- * @returns a string representation of the variable `unit`.
+ * Retrieves the value stored in the `unit` variable and returns it as a string. This
+ * suggests that the function is designed to provide access to a unit or measurement
+ * quantity for some purpose. The returned value can then be used by the calling code.
+ *
+ * @returns a string value stored in the `unit` variable.
*/
public String getUnit() {
return unit;
}
/**
- * sets the `unit` field of the current object to the provided `String`.
- *
- * @param unit unit of measurement for the object being modified by the `setUnit()`
- * method.
+ * Updates the internal state of an object by assigning a new value to the `unit`
+ * property, which is likely a variable or field of the class. This allows external
+ * code to modify the unit associated with the object programmatically. The update
+ * is made directly on the object's instance variables.
+ *
+ * @param unit value to be assigned to the instance variable `this.unit`, updating
+ * its state.
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
- * retrieves an access token for use in authenticated API calls.
- *
- * @returns a string representing the access token.
+ * Returns a string representing the access token. This accessor method allows external
+ * classes to retrieve the current value of the `accessToken` variable.
+ *
+ * @returns a `String` value representing an access token.
*/
public String getAccessToken() {
return accessToken;
}
/**
- * sets the instance variable `accessToken` to a given string value.
- *
- * @param accessToken token that grants access to the protected resources.
+ * Assigns a specified `accessToken` to the current instance's corresponding attribute,
+ * effectively updating the stored access token value. This modification is made by
+ * assigning the provided string value directly to the attribute with the same name.
+ * The updated value becomes accessible for further use.
+ *
+ * @param accessToken token to be assigned to the object's `accessToken` field.
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
/**
- * generates a string representation of an object by combining its `sensorID`,
- * `samples`, and unit into a single string.
- *
- * @returns a concise representation of the sensor ID and value, including the unit.
+ * Returns a string representation of an object, combining its sensor ID with either
+ * the value and unit of the first sample if available, or just the unit if no samples
+ * are present. The result is formatted as "sensor_id - value_unit".
+ *
+ * @returns a string representation of sensor ID and its value or unit.
*/
@Override
public String toString() {
@@ -231,9 +236,12 @@ public String toString() {
}
/**
- * returns an integer value indicating that no contents are present.
- *
- * @returns an integer value of 0.
+ * Returns an integer value representing the type and size of the Parcelable object's
+ * content. It is a method required by the Parcelable interface, used to specify the
+ * number of elements that need to be written toParcel(). The returned value typically
+ * indicates the type of data being transferred.
+ *
+ * @returns an integer value representing the type of data contained.
*/
@Override
public int describeContents() {
@@ -241,28 +249,15 @@ public int describeContents() {
}
/**
- * writes the location, sensor ID, name, sensor type, and samples to a Parcel object,
- * along with the unit of measurement.
- *
- * @param dest Parcel object that will be used to write the instance's state to.
- *
- * 1/ `dest`: A `Parcel` object that represents the output stream for writing the
- * data to a Parcel. It has various attributes such as `writeDoubleArray()`,
- * `writeString()`, `writeString()`, `writeParcelableArray()`, and `writeString()`.
- * 2/ `location`: An array of double values representing the location of the sensor.
- * 3/ `sensorid`: A string value representing the ID of the sensor.
- * 4/ `name`: A string value representing the name of the sensor.
- * 5/ `sensortype`: A string value representing the type of sensor (e.g., "GPS",
- * "Accelerometer", etc.).
- * 6/ `samples`: An array of Parcelable objects representing the sensor readings. The
- * `Parcelable` interface allows for efficient serialization and deserialization of
- * complex data structures.
- * 7/ `unit`: A string value representing the unit of measurement for the sensor
- * readings (e.g., " meters", "degrees", etc.).
- *
- * @param flags 32-bit integer value that specifies the type of data being written
- * to the Parcel, with possible values including `PARCEL_WRITE_REusable`,
- * `PARCEL_WRITE_TRANSIENT`, and `PARCEL_WRITE_CANCELABLE`.
+ * Serializes the data to a parcel for storage. It writes an array of doubles
+ * representing location coordinates, four strings (sensor ID, name, sensor type, and
+ * unit), and an array of Parcelable samples to the parcel using Parcel API methods.
+ *
+ * @param dest parcel that holds the data to be written by the function, allowing it
+ * to store and send complex data objects efficiently.
+ *
+ * @param flags 32-bit integer that controls the behavior of various operations such
+ * as data serialization and deserialization using Parcel.
*/
@Override
public void writeToParcel(Parcel dest, int flags) {
@@ -277,42 +272,27 @@ public void writeToParcel(Parcel dest, int flags) {
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
/**
- * creates a new instance of `Sensable` from a given `Parcel`.
- *
- * @param in parcel that contains the data to be converted into a `Sensable` object.
- *
- * - `in`: A Parcel object containing the data to be deserialized into a `Sensable`
- * object.
- * - `Sensable`: The class that represents the type of data being deserialized, with
- * properties and attributes defined by its definition.
- *
- * @returns a newly created `Sensable` object initialized from the provided `Parcel`
- * input.
- *
- * The `Sensable` object created is an instance of a class that represents a sensory
- * input capable of being processed by the system. It contains information regarding
- * its origin and format, as well as any relevant data itself. The format could be
- * audio, video, image, or another type of sensory input altogether. The class likely
- * has fields for these various parameters, which are populated with values provided
- * in the `in` parameter passed to the function.
+ * Creates a new instance of the `Sensible` class from a parcel object. It uses the
+ * provided parcel to initialize the newly created object. The function returns the
+ * newly created object as an instance of the `Sensible` class.
+ *
+ * @param in Parcel object that contains the data to be deserialized into an instance
+ * of the Sensable class.
+ *
+ * @returns a new instance of `Sensable`.
*/
public Sensable createFromParcel(Parcel in) {
return new Sensable(in);
}
/**
- * creates a new array of `Sensable` objects with the specified size.
- *
- * @param size number of elements to be created and allocated in the newly returned
- * array.
- *
- * @returns an array of `Sensable` objects with the specified size.
- *
- * - The `Sensable[]` array is created with the specified `size` parameter.
- * - The array contains zero or more instances of the `Sensable` class, which has
- * not been provided in the code snippet.
- * - The exact behavior and attributes of the `Sensable` class are unknown without
- * further information.
+ * Creates a new array of type `Sensible` with the specified `size`. It returns a
+ * reference to the newly created array, allowing it to be used in the calling code.
+ * The array is initialized without any values.
+ *
+ * @param size umber of elements to be allocated for an array of type `Sensible`.
+ *
+ * @returns an array of type `Sensible` with a specified `size`.
*/
public Sensable[] newArray(int size) {
return new Sensable[size];
@@ -336,9 +316,10 @@ private Sensable(Parcel in) {
/**
- * takes a `Sample` object and returns its JSON representation as a string.
- *
- * @returns a JSON string representation of the `Sample` object.
+ * Returns a string representation of a sample object as JSON. If the sample is null,
+ * it initializes a new instance before conversion to JSON.
+ *
+ * @returns a JSON string representation of the sample object.
*/
public String getSampleAsJsonString() {
if(sample == null) {
diff --git a/library/src/main/java/io/sensable/model/Statistics.java b/library/src/main/java/io/sensable/model/Statistics.java
index d53c65a..c2e7329 100644
--- a/library/src/main/java/io/sensable/model/Statistics.java
+++ b/library/src/main/java/io/sensable/model/Statistics.java
@@ -4,11 +4,10 @@
* Created by simonmadine on 26/07/2014.
*/
/**
- * is a simple Java class that represents a count value and provides methods for
- * accessing and modifying that value. The class has a private variable `count` and
- * three public methods: `getCount()`, `setCount()`, and `getCount()` which returns
- * the current value of the `count` variable, allows it to be set to a new value, and
- * does not allow it to be modified in any other way.
+ * Encapsulates and manages an integer value representing a count of elements in a
+ * collection. It provides methods to access and modify this count value through
+ * getter and setter functions. The class maintains data integrity by restricting
+ * direct modification of the count variable.
*/
public class Statistics {
private int count;
@@ -17,20 +16,22 @@ public Statistics() {
}
/**
- * returns the value of the `count` field, which represents the number of elements
- * in a collection.
- *
- * @returns the value of the `count` field.
+ * Returns an integer value representing a count. The returned value is stored in the
+ * `count` variable. This function provides access to the current count, allowing it
+ * to be retrieved and used elsewhere in the program.
+ *
+ * @returns an integer value representing the current state of the `count` variable.
*/
public int getCount() {
return count;
}
/**
- * sets the value of the `count` field to the input argument.
- *
- * @param count integer value that will be assigned to the `count` field of the class
- * instance being manipulated by the function.
+ * Assigns a new integer value to the `count` variable within the class. This allows
+ * the external environment to modify the internal state of the object. The modified
+ * value is then stored in the object for future reference.
+ *
+ * @param count new value to be assigned to the instance variable `this.count`.
*/
public void setCount(int count) {
this.count = count;
diff --git a/library/src/main/java/io/sensable/model/User.java b/library/src/main/java/io/sensable/model/User.java
index 980768d..ae83286 100644
--- a/library/src/main/java/io/sensable/model/User.java
+++ b/library/src/main/java/io/sensable/model/User.java
@@ -7,9 +7,9 @@
* Created by simonmadine on 12/07/2014.
*/
/**
- * in the provided Java file represents a user with personal information and an access
- * token. The class implements Parcelable, allowing it to be serialized and transmitted
- * efficiently.
+ * Represents an entity with personal information and an access token, allowing for
+ * serialization and transmission. It implements Parcelable to facilitate efficient
+ * data transfer. The class provides getter and setter methods for accessing user details.
*/
public class User implements Parcelable {
@@ -21,65 +21,79 @@ public User() {
}
/**
- * retrieves the user name from a designated variable `username`.
- *
- * @returns a string representing the username.
+ * Returns a string representing a username. It retrieves and exposes the internal
+ * value of the `username` variable, allowing external access to the stored username
+ * data. The returned string can be used by other parts of the program for various purposes.
+ *
+ * @returns a string value representing the user's username.
*/
public String getUsername() {
return username;
}
/**
- * sets the value of the `username` field within an object to the provided `String`.
- *
- * @param username user's username which is assigned to the `this.username` field of
- * the function.
+ * Sets a specified string value as the object's username attribute. It assigns the
+ * given `username` parameter to the `this.username` field, effectively updating the
+ * object's username property.
+ *
+ * @param username value to be assigned to the instance variable `this.username`,
+ * updating its current state.
*/
public void setUsername(String username) {
this.username = username;
}
/**
- * retrieves a string representing the user's email address.
- *
- * @returns a string representing the email address of the user.
+ * Retrieves and returns a string value representing an email address. The email
+ * address is stored as an instance variable named `email`.
+ *
+ * @returns a string representing an email address stored as an instance variable.
*/
public String getEmail() {
return email;
}
/**
- * sets the `email` field of an object to a given String value.
- *
- * @param email email address to be associated with the object instance.
+ * Assigns a new value to the `email` attribute of an object. It accepts a string as
+ * input and updates the internal state of the object with the provided email address.
+ * This allows the object's email property to be modified dynamically.
+ *
+ * @param email value to be assigned to the instance variable `email`.
*/
public void setEmail(String email) {
this.email = email;
}
/**
- * retrieves a pre-defined access token for use in API requests.
- *
- * @returns a string representing the access token.
+ * Returns a string value representing an access token. It retrieves and provides
+ * access to the stored access token, allowing it to be used for subsequent operations
+ * or API calls. The returned token is likely used to authenticate and authorize requests.
+ *
+ * @returns a string containing the stored access token.
*/
public String getAccessToken() {
return accessToken;
}
/**
- * sets the `accessToken` field of an object to a provided string value.
- *
- * @param accessToken token that grants access to a resource or service, and it is
- * assigned to the `this.accessToken` field within the function.
+ * Assigns a specified `accessToken` to an instance variable with the same name,
+ * updating its value. This allows the object to store and manage access tokens for
+ * authentication purposes. The new access token replaces any previously stored one.
+ *
+ * @param accessToken value to be assigned to the instance variable `this.accessToken`,
+ * updating its state with the provided string.
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
/**
- * returns an integer value of 0, indicating that no contents are described.
- *
- * @returns 0.
+ * Returns an integer indicating the type of contents contained within an object,
+ * which is used by the Android operating system for debugging and serialization
+ * purposes. The returned value is typically a constant that indicates the type of
+ * data stored in the object.
+ *
+ * @returns an integer value indicating the type of parcelable object.
*/
@Override
public int describeContents() {
@@ -87,17 +101,15 @@ public int describeContents() {
}
/**
- * writes the username, email and access token to a Parcel object.
- *
- * @param dest parcel that will receive the data written by the `writeToParcel()` method.
- *
- * - `dest`: An instance of `Parcel`, which is a generic class in Android for storing
- * and transmitting data between objects. It has various attributes such as `writeReason`
- * (an integer), `nativeObject` (a native object), and `ref()` (a reference to an object).
- *
- * @param flags 16-bit flag value that determines how the data is being written to
- * the parcel, with possible values including 0x0000 for a standard write or 0x0001
- * for a writable subset of the data.
+ * Writes the values of `username`, `email`, and `accessToken` to a parcel object
+ * using `Parcelable` interface for serialization. It overrides the default implementation
+ * to customize how objects are written to a parcel.
+ *
+ * @param dest parcel that is being written to, allowing the object's properties to
+ * be serialized and stored within it.
+ *
+ * @param flags optional settings that control how Parcel writes and reads its data,
+ * such as whether to include metadata or not.
*/
@Override
public void writeToParcel(Parcel dest, int flags) {
diff --git a/library/src/main/java/io/sensable/model/UserLogin.java b/library/src/main/java/io/sensable/model/UserLogin.java
index 8782048..b80d1ff 100644
--- a/library/src/main/java/io/sensable/model/UserLogin.java
+++ b/library/src/main/java/io/sensable/model/UserLogin.java
@@ -4,8 +4,10 @@
* Created by simonmadine on 12/07/2014.
*/
/**
- * is a Java class that represents a user login functionality. It has various fields
- * and methods for managing username and password details.
+ * Represents user login functionality, encapsulating username and password details.
+ * It provides getter and setter methods for these attributes, allowing manipulation
+ * of the data. The class supports default constructor and a parameterized constructor
+ * for initializing instances with or without provided username and password values.
*/
public class UserLogin {
private String username;
@@ -20,37 +22,47 @@ public UserLogin(String username, String password) {
}
/**
- * returns a string representing the password.
- *
- * @returns a string representing the password.
+ * Returns the value of a variable named `password`. This suggests that the function
+ * is providing access to the stored password, likely for retrieval or display purposes.
+ * The returned value is a string representation of the password.
+ *
+ * @returns a string value representing the stored password.
*/
public String getPassword() {
return password;
}
/**
- * sets the password field of the current object to the given string value.
- *
- * @param password password to be stored in the `this.password` field of the class.
+ * Updates the value of an internal variable named `password` with a provided string
+ * input. The new password replaces any previously set password, effectively changing
+ * the stored password. This function has no return value and operates on the object's
+ * internal state.
+ *
+ * @param password string value to be set as the new password of the object, which
+ * is then stored in the `this.password` field.
*/
public void setPassword(String password) {
this.password = password;
}
/**
- * returns a string representing the user's username.
- *
- * @returns the value of the `username` field.
+ * Retrieves and returns a string value representing the current username. It does
+ * not modify or manipulate the username in any way, simply providing access to its
+ * value. The returned string is based on the instance variable `username`.
+ *
+ * @returns a string representing the username.
*/
public String getUsername() {
return username;
}
/**
- * sets the value of the class instance variable `username` to the provided String argument.
- *
- * @param username username for the current user account, which is assigned to the
- * class instance variable `username`.
+ * Assigns a given string value to the object's `username` attribute. This attribute
+ * is likely used to store and retrieve user credentials or identities within the
+ * program. The assigned value can be retrieved or manipulated by other parts of the
+ * code as needed.
+ *
+ * @param username new value to be assigned to the instance variable `username`.
*/
public void setUsername(String username) {
this.username = username;