repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
structurizr/java | structurizr-core/src/com/structurizr/view/ViewSet.java | ViewSet.createFilteredView | public FilteredView createFilteredView(StaticView view, String key, String description, FilterMode mode, String... tags) {
assertThatTheViewIsNotNull(view);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
FilteredView filteredView = new FilteredView(view, key, description, mode, tags);
f... | java | public FilteredView createFilteredView(StaticView view, String key, String description, FilterMode mode, String... tags) {
assertThatTheViewIsNotNull(view);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
FilteredView filteredView = new FilteredView(view, key, description, mode, tags);
f... | [
"public",
"FilteredView",
"createFilteredView",
"(",
"StaticView",
"view",
",",
"String",
"key",
",",
"String",
"description",
",",
"FilterMode",
"mode",
",",
"String",
"...",
"tags",
")",
"{",
"assertThatTheViewIsNotNull",
"(",
"view",
")",
";",
"assertThatTheVie... | Creates a FilteredView on top of an existing static view.
@param view the static view to base the FilteredView upon
@param key the key for the filtered view (must be unique)
@param description a description
@param mode whether to Include or Exclude elements/relationships based upon their ... | [
"Creates",
"a",
"FilteredView",
"on",
"top",
"of",
"an",
"existing",
"static",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L235-L242 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/ViewSet.java | ViewSet.getViewWithKey | View getViewWithKey(String key) {
if (key == null) {
throw new IllegalArgumentException("A key must be specified.");
}
Set<View> views = new HashSet<>();
views.addAll(systemLandscapeViews);
views.addAll(systemContextViews);
views.addAll(containerViews);
... | java | View getViewWithKey(String key) {
if (key == null) {
throw new IllegalArgumentException("A key must be specified.");
}
Set<View> views = new HashSet<>();
views.addAll(systemLandscapeViews);
views.addAll(systemContextViews);
views.addAll(containerViews);
... | [
"View",
"getViewWithKey",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A key must be specified.\"",
")",
";",
"}",
"Set",
"<",
"View",
">",
"views",
"=",
"new",
"HashSet",
"<>... | Finds the view with the specified key, or null if the view does not exist.
@param key the key
@return a View object, or null if a view with the specified key could not be found | [
"Finds",
"the",
"view",
"with",
"the",
"specified",
"key",
"or",
"null",
"if",
"the",
"view",
"does",
"not",
"exist",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L278-L292 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/ViewSet.java | ViewSet.getFilteredViewWithKey | FilteredView getFilteredViewWithKey(String key) {
if (key == null) {
throw new IllegalArgumentException("A key must be specified.");
}
return filteredViews.stream().filter(v -> key.equals(v.getKey())).findFirst().orElse(null);
} | java | FilteredView getFilteredViewWithKey(String key) {
if (key == null) {
throw new IllegalArgumentException("A key must be specified.");
}
return filteredViews.stream().filter(v -> key.equals(v.getKey())).findFirst().orElse(null);
} | [
"FilteredView",
"getFilteredViewWithKey",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A key must be specified.\"",
")",
";",
"}",
"return",
"filteredViews",
".",
"stream",
"(",
")"... | Finds the filtered view with the specified key, or null if the view does not exist.
@param key the key
@return a FilteredView object, or null if a view with the specified key could not be found | [
"Finds",
"the",
"filtered",
"view",
"with",
"the",
"specified",
"key",
"or",
"null",
"if",
"the",
"view",
"does",
"not",
"exist",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L300-L306 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/ModelItem.java | ModelItem.getTags | public String getTags() {
Set<String> setOfTags = getTagsAsSet();
if (setOfTags.isEmpty()) {
return "";
}
StringBuilder buf = new StringBuilder();
for (String tag : setOfTags) {
buf.append(tag);
buf.append(",");
}
String tags... | java | public String getTags() {
Set<String> setOfTags = getTagsAsSet();
if (setOfTags.isEmpty()) {
return "";
}
StringBuilder buf = new StringBuilder();
for (String tag : setOfTags) {
buf.append(tag);
buf.append(",");
}
String tags... | [
"public",
"String",
"getTags",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"setOfTags",
"=",
"getTagsAsSet",
"(",
")",
";",
"if",
"(",
"setOfTags",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"buf",
"=",
"new",
"Str... | Gets the comma separated list of tags.
@return a comma separated list of tags,
or an empty string if there are no tags | [
"Gets",
"the",
"comma",
"separated",
"list",
"of",
"tags",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ModelItem.java#L39-L54 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/ModelItem.java | ModelItem.addProperty | public void addProperty(String name, String value) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A property name must be specified.");
}
if (value == null || value.trim().length() == 0) {
throw new IllegalArgumentException("A prop... | java | public void addProperty(String name, String value) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A property name must be specified.");
}
if (value == null || value.trim().length() == 0) {
throw new IllegalArgumentException("A prop... | [
"public",
"void",
"addProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Adds a name-value pair property to this element.
@param name the name of the property
@param value the value of the property | [
"Adds",
"a",
"name",
"-",
"value",
"pair",
"property",
"to",
"this",
"element",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ModelItem.java#L111-L121 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/ModelItem.java | ModelItem.addPerspective | public Perspective addPerspective(String name, String description) {
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalArgumentException("A name must be specified.");
}
if (StringUtils.isNullOrEmpty(description)) {
throw new IllegalArgumentException("A description ... | java | public Perspective addPerspective(String name, String description) {
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalArgumentException("A name must be specified.");
}
if (StringUtils.isNullOrEmpty(description)) {
throw new IllegalArgumentException("A description ... | [
"public",
"Perspective",
"addPerspective",
"(",
"String",
"name",
",",
"String",
"description",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A name must be specified.\"",
... | Adds a perspective to this model item.
@param name the name of the perspective (e.g. "Security", must be unique)
@param description a description of the perspective
@return a Perspective object
@throws IllegalArgumentException if perspective details are not specified, or the named perspecti... | [
"Adds",
"a",
"perspective",
"to",
"this",
"model",
"item",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ModelItem.java#L156-L173 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/DeploymentNode.java | DeploymentNode.add | public ContainerInstance add(Container container, boolean replicateContainerRelationships) {
ContainerInstance containerInstance = getModel().addContainerInstance(this, container, replicateContainerRelationships);
this.containerInstances.add(containerInstance);
return containerInstance;
} | java | public ContainerInstance add(Container container, boolean replicateContainerRelationships) {
ContainerInstance containerInstance = getModel().addContainerInstance(this, container, replicateContainerRelationships);
this.containerInstances.add(containerInstance);
return containerInstance;
} | [
"public",
"ContainerInstance",
"add",
"(",
"Container",
"container",
",",
"boolean",
"replicateContainerRelationships",
")",
"{",
"ContainerInstance",
"containerInstance",
"=",
"getModel",
"(",
")",
".",
"addContainerInstance",
"(",
"this",
",",
"container",
",",
"rep... | Adds a container instance to this deployment node, optionally replicating all of the container-container relationships.
@param container the Container to add an instance of
@param replicateContainerRelationships true if the container-container relationships should be replicated between the co... | [
"Adds",
"a",
"container",
"instance",
"to",
"this",
"deployment",
"node",
"optionally",
"replicating",
"all",
"of",
"the",
"container",
"-",
"container",
"relationships",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/DeploymentNode.java#L50-L55 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/DeploymentNode.java | DeploymentNode.getDeploymentNodeWithName | public DeploymentNode getDeploymentNodeWithName(String name) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A name must be specified.");
}
for (DeploymentNode deploymentNode : getChildren()) {
if (deploymentNode.getName().equals(na... | java | public DeploymentNode getDeploymentNodeWithName(String name) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A name must be specified.");
}
for (DeploymentNode deploymentNode : getChildren()) {
if (deploymentNode.getName().equals(na... | [
"public",
"DeploymentNode",
"getDeploymentNodeWithName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Gets the DeploymentNode with the specified name.
@param name the name of the deployment node
@return the DeploymentNode instance with the specified name (or null if it doesn't exist). | [
"Gets",
"the",
"DeploymentNode",
"with",
"the",
"specified",
"name",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/DeploymentNode.java#L106-L118 | train |
structurizr/java | structurizr-websequencediagrams/src/com/structurizr/io/websequencediagrams/WebSequenceDiagramsWriter.java | WebSequenceDiagramsWriter.write | public void write(Workspace workspace, Writer writer) {
if (workspace != null && writer != null) {
for (DynamicView view : workspace.getViews().getDynamicViews()) {
write(view, writer);
}
}
} | java | public void write(Workspace workspace, Writer writer) {
if (workspace != null && writer != null) {
for (DynamicView view : workspace.getViews().getDynamicViews()) {
write(view, writer);
}
}
} | [
"public",
"void",
"write",
"(",
"Workspace",
"workspace",
",",
"Writer",
"writer",
")",
"{",
"if",
"(",
"workspace",
"!=",
"null",
"&&",
"writer",
"!=",
"null",
")",
"{",
"for",
"(",
"DynamicView",
"view",
":",
"workspace",
".",
"getViews",
"(",
")",
"... | Writes the dynamic views in the given workspace as WebSequenceDiagrams definitions, to the specified writer.
@param workspace the workspace containing the views to be written
@param writer the Writer to write to | [
"Writes",
"the",
"dynamic",
"views",
"in",
"the",
"given",
"workspace",
"as",
"WebSequenceDiagrams",
"definitions",
"to",
"the",
"specified",
"writer",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-websequencediagrams/src/com/structurizr/io/websequencediagrams/WebSequenceDiagramsWriter.java#L34-L40 | train |
structurizr/java | structurizr-websequencediagrams/src/com/structurizr/io/websequencediagrams/WebSequenceDiagramsWriter.java | WebSequenceDiagramsWriter.write | public void write(Workspace workspace) {
StringWriter stringWriter = new StringWriter();
write(workspace, stringWriter);
System.out.println(stringWriter.toString());
} | java | public void write(Workspace workspace) {
StringWriter stringWriter = new StringWriter();
write(workspace, stringWriter);
System.out.println(stringWriter.toString());
} | [
"public",
"void",
"write",
"(",
"Workspace",
"workspace",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"write",
"(",
"workspace",
",",
"stringWriter",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"stringWriter"... | Writes the dynamic views in the given workspace as WebSequenceDiagrams definitions, to stdout.
@param workspace the workspace containing the views to be written | [
"Writes",
"the",
"dynamic",
"views",
"in",
"the",
"given",
"workspace",
"as",
"WebSequenceDiagrams",
"definitions",
"to",
"stdout",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-websequencediagrams/src/com/structurizr/io/websequencediagrams/WebSequenceDiagramsWriter.java#L47-L51 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/Branding.java | Branding.setLogo | public void setLogo(String url) {
if (url != null && url.trim().length() > 0) {
if (Url.isUrl(url) || url.startsWith("data:image/")) {
this.logo = url.trim();
} else {
throw new IllegalArgumentException(url + " is not a valid URL.");
}
... | java | public void setLogo(String url) {
if (url != null && url.trim().length() > 0) {
if (Url.isUrl(url) || url.startsWith("data:image/")) {
this.logo = url.trim();
} else {
throw new IllegalArgumentException(url + " is not a valid URL.");
}
... | [
"public",
"void",
"setLogo",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"!=",
"null",
"&&",
"url",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"Url",
".",
"isUrl",
"(",
"url",
")",
"||",
"url",
".",
... | Sets the URL of an image representing a logo.
@param url a URL as a String | [
"Sets",
"the",
"URL",
"of",
"an",
"image",
"representing",
"a",
"logo",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/Branding.java#L26-L34 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/ContainerInstance.java | ContainerInstance.addHealthCheck | @Nonnull
public HttpHealthCheck addHealthCheck(String name, String url, int interval, long timeout) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("The name must not be null or empty.");
}
if (url == null || url.trim().length() == 0) {
... | java | @Nonnull
public HttpHealthCheck addHealthCheck(String name, String url, int interval, long timeout) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("The name must not be null or empty.");
}
if (url == null || url.trim().length() == 0) {
... | [
"@",
"Nonnull",
"public",
"HttpHealthCheck",
"addHealthCheck",
"(",
"String",
"name",
",",
"String",
"url",
",",
"int",
"interval",
",",
"long",
"timeout",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"trim",
"(",
")",
".",
"length",
"... | Adds a new health check.
@param name the name of the health check
@param url the URL of the health check
@param interval the polling interval, in seconds
@param timeout the timeout, in milliseconds
@return a HttpHealthCheck instance representing the health check that has been added
@throws IllegalArgume... | [
"Adds",
"a",
"new",
"health",
"check",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ContainerInstance.java#L145-L171 | train |
structurizr/java | structurizr-client/src/com/structurizr/util/WorkspaceUtils.java | WorkspaceUtils.loadWorkspaceFromJson | public static Workspace loadWorkspaceFromJson(File file) throws Exception {
if (file == null) {
throw new IllegalArgumentException("The path to a JSON file must be specified.");
} else if (!file.exists()) {
throw new IllegalArgumentException("The specified JSON file does not exis... | java | public static Workspace loadWorkspaceFromJson(File file) throws Exception {
if (file == null) {
throw new IllegalArgumentException("The path to a JSON file must be specified.");
} else if (!file.exists()) {
throw new IllegalArgumentException("The specified JSON file does not exis... | [
"public",
"static",
"Workspace",
"loadWorkspaceFromJson",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The path to a JSON file must be specified.\"",
")",
";",
"}... | Loads a workspace from a JSON definition saved as a file.
@param file a File representing the JSON definition
@return a Workspace object
@throws Exception if something goes wrong | [
"Loads",
"a",
"workspace",
"from",
"a",
"JSON",
"definition",
"saved",
"as",
"a",
"file",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/util/WorkspaceUtils.java#L22-L30 | train |
structurizr/java | structurizr-client/src/com/structurizr/util/WorkspaceUtils.java | WorkspaceUtils.saveWorkspaceToJson | public static void saveWorkspaceToJson(Workspace workspace, File file) throws Exception {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
} else if (file == null) {
throw new IllegalArgumentException("The path to a JSON file must be s... | java | public static void saveWorkspaceToJson(Workspace workspace, File file) throws Exception {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
} else if (file == null) {
throw new IllegalArgumentException("The path to a JSON file must be s... | [
"public",
"static",
"void",
"saveWorkspaceToJson",
"(",
"Workspace",
"workspace",
",",
"File",
"file",
")",
"throws",
"Exception",
"{",
"if",
"(",
"workspace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A workspace must be provided.\... | Saves a workspace to a JSON definition as a file.
@param workspace a Workspace object
@param file a File representing the JSON definition
@throws Exception if something goes wrong | [
"Saves",
"a",
"workspace",
"to",
"a",
"JSON",
"definition",
"as",
"a",
"file",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/util/WorkspaceUtils.java#L39-L50 | train |
structurizr/java | structurizr-client/src/com/structurizr/util/WorkspaceUtils.java | WorkspaceUtils.printWorkspaceAsJson | public static void printWorkspaceAsJson(Workspace workspace) {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
}
try {
System.out.println(toJson(workspace, true));
} catch (Exception e) {
e.printStackTrace... | java | public static void printWorkspaceAsJson(Workspace workspace) {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
}
try {
System.out.println(toJson(workspace, true));
} catch (Exception e) {
e.printStackTrace... | [
"public",
"static",
"void",
"printWorkspaceAsJson",
"(",
"Workspace",
"workspace",
")",
"{",
"if",
"(",
"workspace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A workspace must be provided.\"",
")",
";",
"}",
"try",
"{",
"System",
... | Prints a workspace as JSON to stdout - useful for debugging purposes.
@param workspace the workspace to print | [
"Prints",
"a",
"workspace",
"as",
"JSON",
"to",
"stdout",
"-",
"useful",
"for",
"debugging",
"purposes",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/util/WorkspaceUtils.java#L57-L67 | train |
structurizr/java | structurizr-client/src/com/structurizr/util/WorkspaceUtils.java | WorkspaceUtils.toJson | public static String toJson(Workspace workspace, boolean indentOutput) throws Exception {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
}
JsonWriter jsonWriter = new JsonWriter(indentOutput);
StringWriter stringWriter = new Str... | java | public static String toJson(Workspace workspace, boolean indentOutput) throws Exception {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
}
JsonWriter jsonWriter = new JsonWriter(indentOutput);
StringWriter stringWriter = new Str... | [
"public",
"static",
"String",
"toJson",
"(",
"Workspace",
"workspace",
",",
"boolean",
"indentOutput",
")",
"throws",
"Exception",
"{",
"if",
"(",
"workspace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A workspace must be provided.\... | Serializes the specified workspace to a JSON string.
@param workspace a Workspace instance
@param indentOutput whether to indent the output (prettify)
@return a JSON string
@throws Exception if something goes wrong | [
"Serializes",
"the",
"specified",
"workspace",
"to",
"a",
"JSON",
"string",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/util/WorkspaceUtils.java#L77-L89 | train |
structurizr/java | structurizr-client/src/com/structurizr/util/WorkspaceUtils.java | WorkspaceUtils.fromJson | public static Workspace fromJson(String json) throws Exception {
if (json == null || json.trim().length() == 0) {
throw new IllegalArgumentException("A JSON string must be provided.");
}
StringReader stringReader = new StringReader(json);
return new JsonReader().read(stringR... | java | public static Workspace fromJson(String json) throws Exception {
if (json == null || json.trim().length() == 0) {
throw new IllegalArgumentException("A JSON string must be provided.");
}
StringReader stringReader = new StringReader(json);
return new JsonReader().read(stringR... | [
"public",
"static",
"Workspace",
"fromJson",
"(",
"String",
"json",
")",
"throws",
"Exception",
"{",
"if",
"(",
"json",
"==",
"null",
"||",
"json",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentExc... | Converts the specified JSON string to a Workspace instance.
@param json the JSON definition of the workspace
@return a Workspace instance
@throws Exception if the JSON can not be deserialized | [
"Converts",
"the",
"specified",
"JSON",
"string",
"to",
"a",
"Workspace",
"instance",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/util/WorkspaceUtils.java#L98-L105 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/ComponentFinder.java | ComponentFinder.findComponents | public Set<Component> findComponents() throws Exception {
Set<Component> componentsFound = new HashSet<>();
for (ComponentFinderStrategy componentFinderStrategy : componentFinderStrategies) {
componentFinderStrategy.beforeFindComponents();
}
for (ComponentFinderStrategy com... | java | public Set<Component> findComponents() throws Exception {
Set<Component> componentsFound = new HashSet<>();
for (ComponentFinderStrategy componentFinderStrategy : componentFinderStrategies) {
componentFinderStrategy.beforeFindComponents();
}
for (ComponentFinderStrategy com... | [
"public",
"Set",
"<",
"Component",
">",
"findComponents",
"(",
")",
"throws",
"Exception",
"{",
"Set",
"<",
"Component",
">",
"componentsFound",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"ComponentFinderStrategy",
"componentFinderStrategy",
":",
... | Find components, using all of the configured component finder strategies
in the order they were added.
@return the set of Components that were found
@throws Exception if something goes wrong | [
"Find",
"components",
"using",
"all",
"of",
"the",
"configured",
"component",
"finder",
"strategies",
"in",
"the",
"order",
"they",
"were",
"added",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/ComponentFinder.java#L69-L85 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/ComponentFinder.java | ComponentFinder.exclude | public void exclude(String... regexes) {
if (regexes != null) {
for (String regex : regexes) {
this.exclusions.add(Pattern.compile(regex));
}
}
} | java | public void exclude(String... regexes) {
if (regexes != null) {
for (String regex : regexes) {
this.exclusions.add(Pattern.compile(regex));
}
}
} | [
"public",
"void",
"exclude",
"(",
"String",
"...",
"regexes",
")",
"{",
"if",
"(",
"regexes",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"regex",
":",
"regexes",
")",
"{",
"this",
".",
"exclusions",
".",
"add",
"(",
"Pattern",
".",
"compile",
"(",... | Adds one or more regexes to the set of regexes that define which types should be excluded during the component finding process.
@param regexes one or more regular expressions, as Strings | [
"Adds",
"one",
"or",
"more",
"regexes",
"to",
"the",
"set",
"of",
"regexes",
"that",
"define",
"which",
"types",
"should",
"be",
"excluded",
"during",
"the",
"component",
"finding",
"process",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/ComponentFinder.java#L132-L138 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/ComponentFinder.java | ComponentFinder.getTypeRepository | public TypeRepository getTypeRepository() {
if (typeRepository == null) {
typeRepository = new DefaultTypeRepository(getPackageNames(), getExclusions(), getUrlClassLoader());
}
return typeRepository;
} | java | public TypeRepository getTypeRepository() {
if (typeRepository == null) {
typeRepository = new DefaultTypeRepository(getPackageNames(), getExclusions(), getUrlClassLoader());
}
return typeRepository;
} | [
"public",
"TypeRepository",
"getTypeRepository",
"(",
")",
"{",
"if",
"(",
"typeRepository",
"==",
"null",
")",
"{",
"typeRepository",
"=",
"new",
"DefaultTypeRepository",
"(",
"getPackageNames",
"(",
")",
",",
"getExclusions",
"(",
")",
",",
"getUrlClassLoader",
... | Gets the type repository used to analyse java classes.
@return the type supplied type repository, or a default implementation | [
"Gets",
"the",
"type",
"repository",
"used",
"to",
"analyse",
"java",
"classes",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/ComponentFinder.java#L179-L184 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/View.java | View.setAutomaticLayout | public void setAutomaticLayout(boolean enable) {
if (enable) {
this.setAutomaticLayout(AutomaticLayout.RankDirection.TopBottom, 300, 600, 200, false);
} else {
this.automaticLayout = null;
}
} | java | public void setAutomaticLayout(boolean enable) {
if (enable) {
this.setAutomaticLayout(AutomaticLayout.RankDirection.TopBottom, 300, 600, 200, false);
} else {
this.automaticLayout = null;
}
} | [
"public",
"void",
"setAutomaticLayout",
"(",
"boolean",
"enable",
")",
"{",
"if",
"(",
"enable",
")",
"{",
"this",
".",
"setAutomaticLayout",
"(",
"AutomaticLayout",
".",
"RankDirection",
".",
"TopBottom",
",",
"300",
",",
"600",
",",
"200",
",",
"false",
... | Enables the automatic layout for this view, with some default settings.
@param enable a boolean | [
"Enables",
"the",
"automatic",
"layout",
"for",
"this",
"view",
"with",
"some",
"default",
"settings",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/View.java#L152-L158 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/View.java | View.setAutomaticLayout | public void setAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices) {
this.automaticLayout = new AutomaticLayout(rankDirection, rankSeparation, nodeSeparation, edgeSeparation, vertices);
} | java | public void setAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices) {
this.automaticLayout = new AutomaticLayout(rankDirection, rankSeparation, nodeSeparation, edgeSeparation, vertices);
} | [
"public",
"void",
"setAutomaticLayout",
"(",
"AutomaticLayout",
".",
"RankDirection",
"rankDirection",
",",
"int",
"rankSeparation",
",",
"int",
"nodeSeparation",
",",
"int",
"edgeSeparation",
",",
"boolean",
"vertices",
")",
"{",
"this",
".",
"automaticLayout",
"="... | Enables the automatic layout for this view, with the specified settings.
@param rankDirection the rank direction
@param rankSeparation the separation between ranks (in pixels, a positive integer)
@param nodeSeparation the separation between nodes within the same rank (in pixels, a positive integer)
@param ed... | [
"Enables",
"the",
"automatic",
"layout",
"for",
"this",
"view",
"with",
"the",
"specified",
"settings",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/View.java#L169-L171 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/View.java | View.remove | public void remove(Relationship relationship) {
if (relationship != null) {
RelationshipView relationshipView = new RelationshipView(relationship);
relationshipViews.remove(relationshipView);
}
} | java | public void remove(Relationship relationship) {
if (relationship != null) {
RelationshipView relationshipView = new RelationshipView(relationship);
relationshipViews.remove(relationshipView);
}
} | [
"public",
"void",
"remove",
"(",
"Relationship",
"relationship",
")",
"{",
"if",
"(",
"relationship",
"!=",
"null",
")",
"{",
"RelationshipView",
"relationshipView",
"=",
"new",
"RelationshipView",
"(",
"relationship",
")",
";",
"relationshipViews",
".",
"remove",... | Removes a relationship from this view.
@param relationship the Relationship to remove | [
"Removes",
"a",
"relationship",
"from",
"this",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/View.java#L291-L296 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/View.java | View.removeRelationshipsNotConnectedToElement | public void removeRelationshipsNotConnectedToElement(Element element) {
if (element != null) {
getRelationships().stream()
.map(RelationshipView::getRelationship)
.filter(r -> !r.getSource().equals(element) && !r.getDestination().equals(element))
... | java | public void removeRelationshipsNotConnectedToElement(Element element) {
if (element != null) {
getRelationships().stream()
.map(RelationshipView::getRelationship)
.filter(r -> !r.getSource().equals(element) && !r.getDestination().equals(element))
... | [
"public",
"void",
"removeRelationshipsNotConnectedToElement",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"getRelationships",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"RelationshipView",
"::",
"getRelationship",
... | Removes relationships that are not connected to the specified element.
@param element the Element to test against | [
"Removes",
"relationships",
"that",
"are",
"not",
"connected",
"to",
"the",
"specified",
"element",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/View.java#L303-L310 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/View.java | View.removeElementsWithNoRelationships | public void removeElementsWithNoRelationships() {
Set<RelationshipView> relationships = getRelationships();
Set<String> elementIds = new HashSet<>();
relationships.forEach(rv -> elementIds.add(rv.getRelationship().getSourceId()));
relationships.forEach(rv -> elementIds.add(rv.getRelatio... | java | public void removeElementsWithNoRelationships() {
Set<RelationshipView> relationships = getRelationships();
Set<String> elementIds = new HashSet<>();
relationships.forEach(rv -> elementIds.add(rv.getRelationship().getSourceId()));
relationships.forEach(rv -> elementIds.add(rv.getRelatio... | [
"public",
"void",
"removeElementsWithNoRelationships",
"(",
")",
"{",
"Set",
"<",
"RelationshipView",
">",
"relationships",
"=",
"getRelationships",
"(",
")",
";",
"Set",
"<",
"String",
">",
"elementIds",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"relationsh... | Removes all elements that have no relationships to other elements in this view. | [
"Removes",
"all",
"elements",
"that",
"have",
"no",
"relationships",
"to",
"other",
"elements",
"in",
"this",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/View.java#L345-L357 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/Model.java | Model.getDeploymentNodeWithName | public DeploymentNode getDeploymentNodeWithName(String name, String environment) {
for (DeploymentNode deploymentNode : getDeploymentNodes()) {
if (deploymentNode.getEnvironment().equals(environment) && deploymentNode.getName().equals(name)) {
return deploymentNode;
}
... | java | public DeploymentNode getDeploymentNodeWithName(String name, String environment) {
for (DeploymentNode deploymentNode : getDeploymentNodes()) {
if (deploymentNode.getEnvironment().equals(environment) && deploymentNode.getName().equals(name)) {
return deploymentNode;
}
... | [
"public",
"DeploymentNode",
"getDeploymentNodeWithName",
"(",
"String",
"name",
",",
"String",
"environment",
")",
"{",
"for",
"(",
"DeploymentNode",
"deploymentNode",
":",
"getDeploymentNodes",
"(",
")",
")",
"{",
"if",
"(",
"deploymentNode",
".",
"getEnvironment",... | Gets the deployment node with the specified name and environment.
@param name the name of the deployment node
@param environment the name of the deployment environment
@return the DeploymentNode instance with the specified name (or null if it doesn't exist). | [
"Gets",
"the",
"deployment",
"node",
"with",
"the",
"specified",
"name",
"and",
"environment",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L690-L698 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/Model.java | Model.getElementWithCanonicalName | public Element getElementWithCanonicalName(String canonicalName) {
if (canonicalName == null || canonicalName.trim().length() == 0) {
throw new IllegalArgumentException("A canonical name must be specified.");
}
// canonical names start with a leading slash, so add this if it's missi... | java | public Element getElementWithCanonicalName(String canonicalName) {
if (canonicalName == null || canonicalName.trim().length() == 0) {
throw new IllegalArgumentException("A canonical name must be specified.");
}
// canonical names start with a leading slash, so add this if it's missi... | [
"public",
"Element",
"getElementWithCanonicalName",
"(",
"String",
"canonicalName",
")",
"{",
"if",
"(",
"canonicalName",
"==",
"null",
"||",
"canonicalName",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgume... | Gets the element with the specified canonical name.
@param canonicalName the canonical name (e.g. /SoftwareSystem/Container)
@return the Element with the given canonical name, or null if one doesn't exist
@throws IllegalArgumentException if the canonical name is null or empty | [
"Gets",
"the",
"element",
"with",
"the",
"specified",
"canonical",
"name",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L755-L772 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/Model.java | Model.modifyRelationship | public void modifyRelationship(Relationship relationship, String description, String technology) {
if (relationship == null) {
throw new IllegalArgumentException("A relationship must be specified.");
}
Relationship newRelationship = new Relationship(relationship.getSource(), relatio... | java | public void modifyRelationship(Relationship relationship, String description, String technology) {
if (relationship == null) {
throw new IllegalArgumentException("A relationship must be specified.");
}
Relationship newRelationship = new Relationship(relationship.getSource(), relatio... | [
"public",
"void",
"modifyRelationship",
"(",
"Relationship",
"relationship",
",",
"String",
"description",
",",
"String",
"technology",
")",
"{",
"if",
"(",
"relationship",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A relationship mu... | Provides a way for the description and technology to be modified on an existing relationship.
@param relationship a Relationship instance
@param description the new description
@param technology the new technology | [
"Provides",
"a",
"way",
"for",
"the",
"description",
"and",
"technology",
"to",
"be",
"modified",
"on",
"an",
"existing",
"relationship",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L795-L807 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/Element.java | Element.setUrl | public void setUrl(String url) {
if (url != null && url.trim().length() > 0) {
if (Url.isUrl(url)) {
this.url = url;
} else {
throw new IllegalArgumentException(url + " is not a valid URL.");
}
}
} | java | public void setUrl(String url) {
if (url != null && url.trim().length() > 0) {
if (Url.isUrl(url)) {
this.url = url;
} else {
throw new IllegalArgumentException(url + " is not a valid URL.");
}
}
} | [
"public",
"void",
"setUrl",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"!=",
"null",
"&&",
"url",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"Url",
".",
"isUrl",
"(",
"url",
")",
")",
"{",
"this",
... | Sets the URL where more information about this element can be found.
@param url the URL as a String
@throws IllegalArgumentException if the URL is not a well-formed URL | [
"Sets",
"the",
"URL",
"where",
"more",
"information",
"about",
"this",
"element",
"can",
"be",
"found",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Element.java#L72-L80 | train |
structurizr/java | structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java | DocumentationTemplate.addSection | public Section addSection(String title, File... files) throws IOException {
return add(null, title, files);
} | java | public Section addSection(String title, File... files) throws IOException {
return add(null, title, files);
} | [
"public",
"Section",
"addSection",
"(",
"String",
"title",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"add",
"(",
"null",
",",
"title",
",",
"files",
")",
";",
"}"
] | Adds a custom section from one or more files, that isn't related to any element in the model.
@param title the section title
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there i... | [
"Adds",
"a",
"custom",
"section",
"from",
"one",
"or",
"more",
"files",
"that",
"isn",
"t",
"related",
"to",
"any",
"element",
"in",
"the",
"model",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L47-L49 | train |
structurizr/java | structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java | DocumentationTemplate.addSection | @Nonnull
public Section addSection(String title, Format format, String content) {
return add(null, title, format, content);
} | java | @Nonnull
public Section addSection(String title, Format format, String content) {
return add(null, title, format, content);
} | [
"@",
"Nonnull",
"public",
"Section",
"addSection",
"(",
"String",
"title",
",",
"Format",
"format",
",",
"String",
"content",
")",
"{",
"return",
"add",
"(",
"null",
",",
"title",
",",
"format",
",",
"content",
")",
";",
"}"
] | Adds a custom section, that isn't related to any element in the model.
@param title the section title
@param format the {@link Format} of the documentation content
@param content a String containing the documentation content
@return a documentation {@link Section} | [
"Adds",
"a",
"custom",
"section",
"that",
"isn",
"t",
"related",
"to",
"any",
"element",
"in",
"the",
"model",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L59-L62 | train |
structurizr/java | structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java | DocumentationTemplate.addImage | public Image addImage(File file) throws IOException {
String contentType = ImageUtils.getContentType(file);
String base64Content = ImageUtils.getImageAsBase64(file);
Image image = new Image(file.getName(), contentType, base64Content);
documentation.addImage(image);
return image... | java | public Image addImage(File file) throws IOException {
String contentType = ImageUtils.getContentType(file);
String base64Content = ImageUtils.getImageAsBase64(file);
Image image = new Image(file.getName(), contentType, base64Content);
documentation.addImage(image);
return image... | [
"public",
"Image",
"addImage",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"String",
"contentType",
"=",
"ImageUtils",
".",
"getContentType",
"(",
"file",
")",
";",
"String",
"base64Content",
"=",
"ImageUtils",
".",
"getImageAsBase64",
"(",
"file",
... | Adds an image from the given file to the workspace.
@param file a File descriptor representing an image file on disk
@return an Image object representing the image added
@throws IOException if there is an error reading the image | [
"Adds",
"an",
"image",
"from",
"the",
"given",
"file",
"to",
"the",
"workspace",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L240-L248 | train |
structurizr/java | structurizr-core/src/com/structurizr/configuration/WorkspaceConfiguration.java | WorkspaceConfiguration.addUser | public void addUser(String username, Role role) {
if (StringUtils.isNullOrEmpty(username)) {
throw new IllegalArgumentException("A username must be specified.");
}
if (role == null) {
throw new IllegalArgumentException("A role must be specified.");
}
use... | java | public void addUser(String username, Role role) {
if (StringUtils.isNullOrEmpty(username)) {
throw new IllegalArgumentException("A username must be specified.");
}
if (role == null) {
throw new IllegalArgumentException("A role must be specified.");
}
use... | [
"public",
"void",
"addUser",
"(",
"String",
"username",
",",
"Role",
"role",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"username",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A username must be specified.\"",
")",
";",... | Adds a user, with the specified username and role.
@param username the username (e.g. an e-mail address)
@param role the user's role | [
"Adds",
"a",
"user",
"with",
"the",
"specified",
"username",
"and",
"role",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/configuration/WorkspaceConfiguration.java#L39-L49 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/ComponentView.java | ComponentView.add | public void add(Container container, boolean addRelationships) {
if (container != null && !container.equals(getContainer())) {
addElement(container, addRelationships);
}
} | java | public void add(Container container, boolean addRelationships) {
if (container != null && !container.equals(getContainer())) {
addElement(container, addRelationships);
}
} | [
"public",
"void",
"add",
"(",
"Container",
"container",
",",
"boolean",
"addRelationships",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
"&&",
"!",
"container",
".",
"equals",
"(",
"getContainer",
"(",
")",
")",
")",
"{",
"addElement",
"(",
"container",... | Adds an individual container to this view.
@param container the Container to add
@param addRelationships whether to add relationships to/from the container | [
"Adds",
"an",
"individual",
"container",
"to",
"this",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ComponentView.java#L105-L109 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/ComponentView.java | ComponentView.add | public void add(Component component, boolean addRelationships) {
if (component != null) {
if (!component.getContainer().equals(getContainer())) {
throw new IllegalArgumentException("Only components belonging to " + container.getName() + " can be added to this view.");
}
... | java | public void add(Component component, boolean addRelationships) {
if (component != null) {
if (!component.getContainer().equals(getContainer())) {
throw new IllegalArgumentException("Only components belonging to " + container.getName() + " can be added to this view.");
}
... | [
"public",
"void",
"add",
"(",
"Component",
"component",
",",
"boolean",
"addRelationships",
")",
"{",
"if",
"(",
"component",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"component",
".",
"getContainer",
"(",
")",
".",
"equals",
"(",
"getContainer",
"(",
")"... | Adds an individual component to this view.
@param component the Component to add
@param addRelationships whether to add relationships to/from the component | [
"Adds",
"an",
"individual",
"component",
"to",
"this",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ComponentView.java#L133-L141 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/StaticView.java | StaticView.removeElementsThatAreUnreachableFrom | public void removeElementsThatAreUnreachableFrom(Element element) {
if (element != null) {
Set<Element> elementsToShow = new HashSet<>();
Set<Element> elementsVisited = new HashSet<>();
findElementsToShow(element, element, elementsToShow, elementsVisited);
for (E... | java | public void removeElementsThatAreUnreachableFrom(Element element) {
if (element != null) {
Set<Element> elementsToShow = new HashSet<>();
Set<Element> elementsVisited = new HashSet<>();
findElementsToShow(element, element, elementsToShow, elementsVisited);
for (E... | [
"public",
"void",
"removeElementsThatAreUnreachableFrom",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"Set",
"<",
"Element",
">",
"elementsToShow",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Set",
"<",
"Element",
">... | Removes all elements that cannot be reached by traversing the graph of relationships
starting with the specified element.
@param element the starting element | [
"Removes",
"all",
"elements",
"that",
"cannot",
"be",
"reached",
"by",
"traversing",
"the",
"graph",
"of",
"relationships",
"starting",
"with",
"the",
"specified",
"element",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/StaticView.java#L143-L155 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/StaticView.java | StaticView.addAnimation | public void addAnimation(Element... elements) {
if (elements == null || elements.length == 0) {
throw new IllegalArgumentException("One or more elements must be specified.");
}
Set<String> elementIdsInPreviousAnimationSteps = new HashSet<>();
Set<Element> elementsInThisAnima... | java | public void addAnimation(Element... elements) {
if (elements == null || elements.length == 0) {
throw new IllegalArgumentException("One or more elements must be specified.");
}
Set<String> elementIdsInPreviousAnimationSteps = new HashSet<>();
Set<Element> elementsInThisAnima... | [
"public",
"void",
"addAnimation",
"(",
"Element",
"...",
"elements",
")",
"{",
"if",
"(",
"elements",
"==",
"null",
"||",
"elements",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"One or more elements must be specified.\""... | Adds an animation step, with the specified elements.
@param elements the elements that should be shown in the animation step | [
"Adds",
"an",
"animation",
"step",
"with",
"the",
"specified",
"elements",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/StaticView.java#L198-L232 | train |
structurizr/java | structurizr-client/src/com/structurizr/io/json/JsonWriter.java | JsonWriter.write | public void write(Workspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("Workspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be null.");
... | java | public void write(Workspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("Workspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be null.");
... | [
"public",
"void",
"write",
"(",
"Workspace",
"workspace",
",",
"Writer",
"writer",
")",
"throws",
"WorkspaceWriterException",
"{",
"if",
"(",
"workspace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Workspace cannot be null.\"",
")",
... | Writes a workspace definition as a JSON string to the specified Writer object.
@param workspace the Workspace object to write
@param writer the Writer object to write the workspace to
@throws WorkspaceWriterException if something goes wrong | [
"Writes",
"a",
"workspace",
"definition",
"as",
"a",
"JSON",
"string",
"to",
"the",
"specified",
"Writer",
"object",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/io/json/JsonWriter.java#L32-L55 | train |
structurizr/java | structurizr-core/src/com/structurizr/documentation/AutomaticDocumentationTemplate.java | AutomaticDocumentationTemplate.addSections | public List<Section> addSections(SoftwareSystem softwareSystem, File directory) throws IOException {
if (softwareSystem == null) {
throw new IllegalArgumentException("A software system must be specified.");
}
return add(softwareSystem, directory);
} | java | public List<Section> addSections(SoftwareSystem softwareSystem, File directory) throws IOException {
if (softwareSystem == null) {
throw new IllegalArgumentException("A software system must be specified.");
}
return add(softwareSystem, directory);
} | [
"public",
"List",
"<",
"Section",
">",
"addSections",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"if",
"(",
"softwareSystem",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A... | Adds all files in the specified directory, each in its own section, related to a software system.
@param directory the directory to scan
@param softwareSystem the SoftwareSystem to associate the documentation with
@return a List of Section objects
@throws IOException if there is an err... | [
"Adds",
"all",
"files",
"in",
"the",
"specified",
"directory",
"each",
"in",
"its",
"own",
"section",
"related",
"to",
"a",
"software",
"system",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/AutomaticDocumentationTemplate.java#L45-L51 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java | TypeUtils.getVisibility | public static TypeVisibility getVisibility(TypeRepository typeRepository, String typeName) {
try {
Class<?> type = typeRepository.loadClass(typeName);
int modifiers = type.getModifiers();
if (Modifier.isPrivate(modifiers)) {
return TypeVisibility.PRIVATE;
... | java | public static TypeVisibility getVisibility(TypeRepository typeRepository, String typeName) {
try {
Class<?> type = typeRepository.loadClass(typeName);
int modifiers = type.getModifiers();
if (Modifier.isPrivate(modifiers)) {
return TypeVisibility.PRIVATE;
... | [
"public",
"static",
"TypeVisibility",
"getVisibility",
"(",
"TypeRepository",
"typeRepository",
",",
"String",
"typeName",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"typeRepository",
".",
"loadClass",
"(",
"typeName",
")",
";",
"int",
"modifie... | Finds the visibility of a given type.
@param typeRepository the repository where types should be loaded from
@param typeName the fully qualified type name
@return a TypeVisibility object representing the visibility (e.g. public, package, etc) | [
"Finds",
"the",
"visibility",
"of",
"a",
"given",
"type",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java#L25-L42 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java | TypeUtils.getCategory | public static TypeCategory getCategory(TypeRepository typeRepository, String typeName) {
try {
Class<?> type = typeRepository.loadClass(typeName);
if (type.isInterface()) {
return TypeCategory.INTERFACE;
} else if (type.isEnum()) {
return TypeC... | java | public static TypeCategory getCategory(TypeRepository typeRepository, String typeName) {
try {
Class<?> type = typeRepository.loadClass(typeName);
if (type.isInterface()) {
return TypeCategory.INTERFACE;
} else if (type.isEnum()) {
return TypeC... | [
"public",
"static",
"TypeCategory",
"getCategory",
"(",
"TypeRepository",
"typeRepository",
",",
"String",
"typeName",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"typeRepository",
".",
"loadClass",
"(",
"typeName",
")",
";",
"if",
"(",
"type"... | Finds the category of a given type.
@param typeRepository the repository where types should be loaded from
@param typeName the fully qualified type name
@return a TypeCategory object representing the category (e.g. class, interface, enum, etc) | [
"Finds",
"the",
"category",
"of",
"a",
"given",
"type",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java#L51-L69 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java | TypeUtils.findTypesAnnotatedWith | public static Set<Class<?>> findTypesAnnotatedWith(Class<? extends Annotation> annotation, Set<Class<?>> types) {
if (annotation == null) {
throw new IllegalArgumentException("An annotation type must be specified.");
}
return types.stream().filter(c -> c.isAnnotationPresent(annotati... | java | public static Set<Class<?>> findTypesAnnotatedWith(Class<? extends Annotation> annotation, Set<Class<?>> types) {
if (annotation == null) {
throw new IllegalArgumentException("An annotation type must be specified.");
}
return types.stream().filter(c -> c.isAnnotationPresent(annotati... | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"findTypesAnnotatedWith",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"types",
")",
"{",
"if",
"(",
"annotation",
"==",
... | Finds the set of types that are annotated with the specified annotation.
@param annotation the Annotation to find
@param types the set of Class objects to search through
@return a Set of Class objects, or an empty set of none could be found | [
"Finds",
"the",
"set",
"of",
"types",
"that",
"are",
"annotated",
"with",
"the",
"specified",
"annotation",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java#L78-L84 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java | TypeUtils.findFirstImplementationOfInterface | public static Class findFirstImplementationOfInterface(Class interfaceType, Set<Class<?>> types) {
if (interfaceType == null) {
throw new IllegalArgumentException("An interface type must be provided.");
} else if (!interfaceType.isInterface()) {
throw new IllegalArgumentException... | java | public static Class findFirstImplementationOfInterface(Class interfaceType, Set<Class<?>> types) {
if (interfaceType == null) {
throw new IllegalArgumentException("An interface type must be provided.");
} else if (!interfaceType.isInterface()) {
throw new IllegalArgumentException... | [
"public",
"static",
"Class",
"findFirstImplementationOfInterface",
"(",
"Class",
"interfaceType",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"types",
")",
"{",
"if",
"(",
"interfaceType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | Finds the first implementation of the given interface.
@param interfaceType a Class object representing the interface type
@param types the set of Class objects to search through
@return the first concrete implementation class of the given interface,
or null if one can't be found | [
"Finds",
"the",
"first",
"implementation",
"of",
"the",
"given",
"interface",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java#L94-L115 | train |
structurizr/java | structurizr-dot/src/com/structurizr/io/dot/DotWriter.java | DotWriter.write | public void write(Workspace workspace, Writer writer) {
workspace.getViews().getSystemContextViews().forEach(v -> write(v, null, writer));
workspace.getViews().getContainerViews().forEach(v -> write(v, v.getSoftwareSystem(), writer));
workspace.getViews().getComponentViews().forEach(v -> write(v... | java | public void write(Workspace workspace, Writer writer) {
workspace.getViews().getSystemContextViews().forEach(v -> write(v, null, writer));
workspace.getViews().getContainerViews().forEach(v -> write(v, v.getSoftwareSystem(), writer));
workspace.getViews().getComponentViews().forEach(v -> write(v... | [
"public",
"void",
"write",
"(",
"Workspace",
"workspace",
",",
"Writer",
"writer",
")",
"{",
"workspace",
".",
"getViews",
"(",
")",
".",
"getSystemContextViews",
"(",
")",
".",
"forEach",
"(",
"v",
"->",
"write",
"(",
"v",
",",
"null",
",",
"writer",
... | Writes the views in the given workspace as DOT notation, to the specified Writer.
@param workspace the workspace containing the views to be written
@param writer the Writer to write to | [
"Writes",
"the",
"views",
"in",
"the",
"given",
"workspace",
"as",
"DOT",
"notation",
"to",
"the",
"specified",
"Writer",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-dot/src/com/structurizr/io/dot/DotWriter.java#L30-L34 | train |
structurizr/java | structurizr-core/src/com/structurizr/model/HttpHealthCheck.java | HttpHealthCheck.addHeader | public void addHeader(String name, String value) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("The header name must not be null or empty.");
}
if (value == null) {
throw new IllegalArgumentException("The header value must not be n... | java | public void addHeader(String name, String value) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("The header name must not be null or empty.");
}
if (value == null) {
throw new IllegalArgumentException("The header value must not be n... | [
"public",
"void",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | Adds a HTTP header, which will be sent with the HTTP request to the health check URL.
@param name the name of the header
@param value the value of the header | [
"Adds",
"a",
"HTTP",
"header",
"which",
"will",
"be",
"sent",
"with",
"the",
"HTTP",
"request",
"to",
"the",
"health",
"check",
"URL",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/HttpHealthCheck.java#L68-L78 | train |
structurizr/java | structurizr-core/src/com/structurizr/util/Url.java | Url.isUrl | public static boolean isUrl(String urlAsString) {
if (urlAsString != null && urlAsString.trim().length() > 0) {
try {
new URL(urlAsString);
return true;
} catch (MalformedURLException murle) {
return false;
}
}
... | java | public static boolean isUrl(String urlAsString) {
if (urlAsString != null && urlAsString.trim().length() > 0) {
try {
new URL(urlAsString);
return true;
} catch (MalformedURLException murle) {
return false;
}
}
... | [
"public",
"static",
"boolean",
"isUrl",
"(",
"String",
"urlAsString",
")",
"{",
"if",
"(",
"urlAsString",
"!=",
"null",
"&&",
"urlAsString",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"try",
"{",
"new",
"URL",
"(",
"urlAsStri... | Determines whether the supplied string is a valid URL.
@param urlAsString the URL, as a String
@return true if the URL is valid, false otherwise | [
"Determines",
"whether",
"the",
"supplied",
"string",
"is",
"a",
"valid",
"URL",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/util/Url.java#L17-L28 | train |
structurizr/java | structurizr-analysis/src/com/structurizr/analysis/DefaultTypeRepository.java | DefaultTypeRepository.findReferencedTypes | public Set<Class<?>> findReferencedTypes(String typeName) {
Set<Class<?>> referencedTypes = new HashSet<>();
// use the cached version if possible
if (referencedTypesCache.containsKey(typeName)) {
return referencedTypesCache.get(typeName);
}
try {
CtClas... | java | public Set<Class<?>> findReferencedTypes(String typeName) {
Set<Class<?>> referencedTypes = new HashSet<>();
// use the cached version if possible
if (referencedTypesCache.containsKey(typeName)) {
return referencedTypesCache.get(typeName);
}
try {
CtClas... | [
"public",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"findReferencedTypes",
"(",
"String",
"typeName",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"referencedTypes",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"// use the cached version if possible",
... | Finds the set of types referenced by the specified type.
@param typeName the starting type
@return a Set of Class objects, or an empty set if none were found | [
"Finds",
"the",
"set",
"of",
"types",
"referenced",
"by",
"the",
"specified",
"type",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/DefaultTypeRepository.java#L118-L153 | train |
structurizr/java | structurizr-client/src/com/structurizr/io/json/EncryptedJsonWriter.java | EncryptedJsonWriter.write | public void write(EncryptedWorkspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("EncryptedWorkspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be... | java | public void write(EncryptedWorkspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("EncryptedWorkspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be... | [
"public",
"void",
"write",
"(",
"EncryptedWorkspace",
"workspace",
",",
"Writer",
"writer",
")",
"throws",
"WorkspaceWriterException",
"{",
"if",
"(",
"workspace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"EncryptedWorkspace cannot be... | Writes an encrypted workspace definition as a JSON string to the specified Writer object.
@param workspace the Workspace object to write
@param writer the Writer object to write the workspace to
@throws WorkspaceWriterException if something goes wrong | [
"Writes",
"an",
"encrypted",
"workspace",
"definition",
"as",
"a",
"JSON",
"string",
"to",
"the",
"specified",
"Writer",
"object",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/io/json/EncryptedJsonWriter.java#L27-L50 | train |
structurizr/java | structurizr-core/src/com/structurizr/view/DynamicView.java | DynamicView.checkElement | private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software system... | java | private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software system... | [
"private",
"void",
"checkElement",
"(",
"Element",
"elementToBeAdded",
")",
"{",
"if",
"(",
"!",
"(",
"elementToBeAdded",
"instanceof",
"Person",
")",
"&&",
"!",
"(",
"elementToBeAdded",
"instanceof",
"SoftwareSystem",
")",
"&&",
"!",
"(",
"elementToBeAdded",
"i... | This checks that only appropriate elements can be added to the view. | [
"This",
"checks",
"that",
"only",
"appropriate",
"elements",
"can",
"be",
"added",
"to",
"the",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/DynamicView.java#L123-L168 | train |
jgilfelt/android-sqlite-asset-helper | library/src/main/java/com/readystatesoftware/sqliteasset/VersionComparator.java | VersionComparator.compare | @Override
public int compare(String file0, String file1) {
Matcher m0 = pattern.matcher(file0);
Matcher m1 = pattern.matcher(file1);
if (!m0.matches()) {
Log.w(TAG, "could not parse upgrade script file: " + file0);
throw new SQLiteAssetException("Invalid upgrade scri... | java | @Override
public int compare(String file0, String file1) {
Matcher m0 = pattern.matcher(file0);
Matcher m1 = pattern.matcher(file1);
if (!m0.matches()) {
Log.w(TAG, "could not parse upgrade script file: " + file0);
throw new SQLiteAssetException("Invalid upgrade scri... | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"String",
"file0",
",",
"String",
"file1",
")",
"{",
"Matcher",
"m0",
"=",
"pattern",
".",
"matcher",
"(",
"file0",
")",
";",
"Matcher",
"m1",
"=",
"pattern",
".",
"matcher",
"(",
"file1",
")",
";",
"... | Compares the two specified upgrade script strings to determine their
relative ordering considering their two version numbers. Assumes all
database names used are the same, as this function only compares the
two version numbers.
@param file0
an upgrade script file name
@param file1
a second upgrade script file name to ... | [
"Compares",
"the",
"two",
"specified",
"upgrade",
"script",
"strings",
"to",
"determine",
"their",
"relative",
"ordering",
"considering",
"their",
"two",
"version",
"numbers",
".",
"Assumes",
"all",
"database",
"names",
"used",
"are",
"the",
"same",
"as",
"this"... | 74a9b0d68aeb1bb0b9778c5598e37da573919ce1 | https://github.com/jgilfelt/android-sqlite-asset-helper/blob/74a9b0d68aeb1bb0b9778c5598e37da573919ce1/library/src/main/java/com/readystatesoftware/sqliteasset/VersionComparator.java#L49-L80 | train |
traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.init | private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.... | java | private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.... | [
"private",
"void",
"init",
"(",
"final",
"Context",
"context",
",",
"final",
"AttributeSet",
"attrs",
")",
"{",
"if",
"(",
"isInEditMode",
"(",
")",
")",
"return",
";",
"final",
"TypedArray",
"typedArray",
"=",
"context",
".",
"obtainStyledAttributes",
"(",
... | Method that initializes all fields and sets listeners
@param context Context used to create this view
@param attrs Attribute used to initialize fields | [
"Method",
"that",
"initializes",
"all",
"fields",
"and",
"sets",
"listeners"
] | df5f9e4456eae8a8e98e2827a3c6f9e7185596e1 | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L111-L156 | train |
traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.createAnimation | private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
... | java | private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
... | [
"private",
"void",
"createAnimation",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"{",
"if",
"(",
"this",
".",
"isEnabled",
"(",
")",
"&&",
"!",
"animationRunning",
")",
"{",
"if",
"(",
"hasToZoom",
")",
"this",
".",
"startAnimation",
... | Create Ripple animation centered at x, y
@param x Horizontal position of the ripple center
@param y Vertical position of the ripple center | [
"Create",
"Ripple",
"animation",
"centered",
"at",
"x",
"y"
] | df5f9e4456eae8a8e98e2827a3c6f9e7185596e1 | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L249-L276 | train |
traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.sendClickEvent | private void sendClickEvent(final Boolean isLongClick) {
if (getParent() instanceof AdapterView) {
final AdapterView adapterView = (AdapterView) getParent();
final int position = adapterView.getPositionForView(this);
final long id = adapterView.getItemIdAtPosition(position);
... | java | private void sendClickEvent(final Boolean isLongClick) {
if (getParent() instanceof AdapterView) {
final AdapterView adapterView = (AdapterView) getParent();
final int position = adapterView.getPositionForView(this);
final long id = adapterView.getItemIdAtPosition(position);
... | [
"private",
"void",
"sendClickEvent",
"(",
"final",
"Boolean",
"isLongClick",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
"instanceof",
"AdapterView",
")",
"{",
"final",
"AdapterView",
"adapterView",
"=",
"(",
"AdapterView",
")",
"getParent",
"(",
")",
";",
"... | Send a click event if parent view is a Listview instance
@param isLongClick Is the event a long click ? | [
"Send",
"a",
"click",
"event",
"if",
"parent",
"view",
"is",
"a",
"Listview",
"instance"
] | df5f9e4456eae8a8e98e2827a3c6f9e7185596e1 | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L298-L311 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/GeometryAdapterFactory.java | GeometryAdapterFactory.create | public static TypeAdapterFactory create() {
if (geometryTypeFactory == null) {
geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
.registerSubtype(GeometryCollection.class, "GeometryCollection")
.registerSubtype(Point.class, "Point")
.registerSubtype(Mult... | java | public static TypeAdapterFactory create() {
if (geometryTypeFactory == null) {
geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
.registerSubtype(GeometryCollection.class, "GeometryCollection")
.registerSubtype(Point.class, "Point")
.registerSubtype(Mult... | [
"public",
"static",
"TypeAdapterFactory",
"create",
"(",
")",
"{",
"if",
"(",
"geometryTypeFactory",
"==",
"null",
")",
"{",
"geometryTypeFactory",
"=",
"RuntimeTypeAdapterFactory",
".",
"of",
"(",
"Geometry",
".",
"class",
",",
"\"type\"",
",",
"true",
")",
"... | Create a new instance of Geometry type adapter factory, this is passed into the Gson
Builder.
@return a new GSON TypeAdapterFactory
@since 4.4.0 | [
"Create",
"a",
"new",
"instance",
"of",
"Geometry",
"type",
"adapter",
"factory",
"this",
"is",
"passed",
"into",
"the",
"Gson",
"Builder",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/GeometryAdapterFactory.java#L26-L39 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiLineString.java | MultiLineString.lineStrings | public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points));
}
return lineStrings;
} | java | public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points));
}
return lineStrings;
} | [
"public",
"List",
"<",
"LineString",
">",
"lineStrings",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"Point",
">>",
"coordinates",
"=",
"coordinates",
"(",
")",
";",
"List",
"<",
"LineString",
">",
"lineStrings",
"=",
"new",
"ArrayList",
"<>",
"(",
"coordin... | Returns a list of LineStrings which are currently making up this MultiLineString.
@return a list of {@link LineString}s
@since 3.0.0 | [
"Returns",
"a",
"list",
"of",
"LineStrings",
"which",
"are",
"currently",
"making",
"up",
"this",
"MultiLineString",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiLineString.java#L255-L262 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatCoordinate | public static String formatCoordinate(double coordinate) {
DecimalFormat decimalFormat = new DecimalFormat("0.######",
new DecimalFormatSymbols(Locale.US));
return String.format(Locale.US, "%s",
decimalFormat.format(coordinate));
} | java | public static String formatCoordinate(double coordinate) {
DecimalFormat decimalFormat = new DecimalFormat("0.######",
new DecimalFormatSymbols(Locale.US));
return String.format(Locale.US, "%s",
decimalFormat.format(coordinate));
} | [
"public",
"static",
"String",
"formatCoordinate",
"(",
"double",
"coordinate",
")",
"{",
"DecimalFormat",
"decimalFormat",
"=",
"new",
"DecimalFormat",
"(",
"\"0.######\"",
",",
"new",
"DecimalFormatSymbols",
"(",
"Locale",
".",
"US",
")",
")",
";",
"return",
"S... | Useful to remove any trailing zeros and prevent a coordinate being over 7 significant figures.
@param coordinate a double value representing a coordinate.
@return a formatted string.
@since 2.1.0 | [
"Useful",
"to",
"remove",
"any",
"trailing",
"zeros",
"and",
"prevent",
"a",
"coordinate",
"being",
"over",
"7",
"significant",
"figures",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L67-L72 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatCoordinate | public static String formatCoordinate(double coordinate, int precision) {
String pattern = "0." + new String(new char[precision]).replace("\0", "0");
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
df.applyPattern(pattern);
df.setRoundingMode(RoundingMode.FLOOR);
return df.f... | java | public static String formatCoordinate(double coordinate, int precision) {
String pattern = "0." + new String(new char[precision]).replace("\0", "0");
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
df.applyPattern(pattern);
df.setRoundingMode(RoundingMode.FLOOR);
return df.f... | [
"public",
"static",
"String",
"formatCoordinate",
"(",
"double",
"coordinate",
",",
"int",
"precision",
")",
"{",
"String",
"pattern",
"=",
"\"0.\"",
"+",
"new",
"String",
"(",
"new",
"char",
"[",
"precision",
"]",
")",
".",
"replace",
"(",
"\"\\0\"",
",",... | Allows the specific adjusting of a coordinates precision.
@param coordinate a double value representing a coordinate.
@param precision an integer value you'd like the precision to be at.
@return a formatted string.
@since 2.1.0 | [
"Allows",
"the",
"specific",
"adjusting",
"of",
"a",
"coordinates",
"precision",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L82-L88 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatRadiuses | public static String formatRadiuses(double[] radiuses) {
if (radiuses == null || radiuses.length == 0) {
return null;
}
String[] radiusesFormatted = new String[radiuses.length];
for (int i = 0; i < radiuses.length; i++) {
if (radiuses[i] == Double.POSITIVE_INFINITY) {
radiusesFormat... | java | public static String formatRadiuses(double[] radiuses) {
if (radiuses == null || radiuses.length == 0) {
return null;
}
String[] radiusesFormatted = new String[radiuses.length];
for (int i = 0; i < radiuses.length; i++) {
if (radiuses[i] == Double.POSITIVE_INFINITY) {
radiusesFormat... | [
"public",
"static",
"String",
"formatRadiuses",
"(",
"double",
"[",
"]",
"radiuses",
")",
"{",
"if",
"(",
"radiuses",
"==",
"null",
"||",
"radiuses",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"radiusesFormatted",... | Used in various APIs to format the user provided radiuses to a String matching the APIs format.
@param radiuses a double array which represents the radius values
@return a String ready for being passed into the Retrofit call
@since 3.0.0 | [
"Used",
"in",
"various",
"APIs",
"to",
"format",
"the",
"user",
"provided",
"radiuses",
"to",
"a",
"String",
"matching",
"the",
"APIs",
"format",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L97-L112 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatBearing | public static String formatBearing(List<Double[]> bearings) {
if (bearings.isEmpty()) {
return null;
}
String[] bearingFormatted = new String[bearings.size()];
for (int i = 0; i < bearings.size(); i++) {
if (bearings.get(i).length == 0) {
bearingFormatted[i] = "";
} else {
... | java | public static String formatBearing(List<Double[]> bearings) {
if (bearings.isEmpty()) {
return null;
}
String[] bearingFormatted = new String[bearings.size()];
for (int i = 0; i < bearings.size(); i++) {
if (bearings.get(i).length == 0) {
bearingFormatted[i] = "";
} else {
... | [
"public",
"static",
"String",
"formatBearing",
"(",
"List",
"<",
"Double",
"[",
"]",
">",
"bearings",
")",
"{",
"if",
"(",
"bearings",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"bearingFormatted",
"=",
"new",
... | Formats the bearing variables from the raw values to a string which can than be used for the
request URL.
@param bearings a List of doubles representing bearing values
@return a string with the bearing values
@since 3.0.0 | [
"Formats",
"the",
"bearing",
"variables",
"from",
"the",
"raw",
"values",
"to",
"a",
"string",
"which",
"can",
"than",
"be",
"used",
"for",
"the",
"request",
"URL",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L122-L138 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatDistributions | public static String formatDistributions(List<Integer[]> distributions) {
if (distributions.isEmpty()) {
return null;
}
String[] distributionsFormatted = new String[distributions.size()];
for (int i = 0; i < distributions.size(); i++) {
if (distributions.get(i).length == 0) {
distri... | java | public static String formatDistributions(List<Integer[]> distributions) {
if (distributions.isEmpty()) {
return null;
}
String[] distributionsFormatted = new String[distributions.size()];
for (int i = 0; i < distributions.size(); i++) {
if (distributions.get(i).length == 0) {
distri... | [
"public",
"static",
"String",
"formatDistributions",
"(",
"List",
"<",
"Integer",
"[",
"]",
">",
"distributions",
")",
"{",
"if",
"(",
"distributions",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"distributionsFormat... | converts the list of integer arrays to a string ready for API consumption.
@param distributions the list of integer arrays representing the distribution
@return a string with the distribution values
@since 3.0.0 | [
"converts",
"the",
"list",
"of",
"integer",
"arrays",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L147-L163 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatApproaches | public static String formatApproaches(String[] approaches) {
for (int i = 0; i < approaches.length; i++) {
if (approaches[i] == null) {
approaches[i] = "";
} else if (!approaches[i].equals("unrestricted")
&& !approaches[i].equals("curb") && !approaches[i].isEmpty()) {
return null... | java | public static String formatApproaches(String[] approaches) {
for (int i = 0; i < approaches.length; i++) {
if (approaches[i] == null) {
approaches[i] = "";
} else if (!approaches[i].equals("unrestricted")
&& !approaches[i].equals("curb") && !approaches[i].isEmpty()) {
return null... | [
"public",
"static",
"String",
"formatApproaches",
"(",
"String",
"[",
"]",
"approaches",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"approaches",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"approaches",
"[",
"i",
"]",
"==",... | Converts String array with approaches values
to a string ready for API consumption.
An approach could be unrestricted, curb or null.
@param approaches a string representing approaches to each coordinate.
@return a formatted string.
@since 3.2.0 | [
"Converts",
"String",
"array",
"with",
"approaches",
"values",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
".",
"An",
"approach",
"could",
"be",
"unrestricted",
"curb",
"or",
"null",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L174-L184 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatWaypointNames | public static String formatWaypointNames(String[] waypointNames) {
for (int i = 0; i < waypointNames.length; i++) {
if (waypointNames[i] == null) {
waypointNames[i] = "";
}
}
return TextUtils.join(";", waypointNames);
} | java | public static String formatWaypointNames(String[] waypointNames) {
for (int i = 0; i < waypointNames.length; i++) {
if (waypointNames[i] == null) {
waypointNames[i] = "";
}
}
return TextUtils.join(";", waypointNames);
} | [
"public",
"static",
"String",
"formatWaypointNames",
"(",
"String",
"[",
"]",
"waypointNames",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"waypointNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"waypointNames",
"[",
"i",
... | Converts String array with waypoint_names values
to a string ready for API consumption.
@param waypointNames a string representing approaches to each coordinate.
@return a formatted string.
@since 3.3.0 | [
"Converts",
"String",
"array",
"with",
"waypoint_names",
"values",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L194-L201 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Point.java | Point.fromLngLat | public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Po... | java | public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Po... | [
"public",
"static",
"Point",
"fromLngLat",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LONGITUDE",
",",
"to",
"=",
"MAX_LONGITUDE",
")",
"double",
"longitude",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LATITUDE",
",",
"to",
"=",
"MAX_LATITUDE",
")",
... | Create a new instance of this class defining a longitude and latitude value in that respective
order. Longitude values are limited to a -180 to 180 range and latitude's limited to -90 to 90
as the spec defines. While no limit is placed on decimal precision, for performance reasons
when serializing and deserializing it ... | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"defining",
"a",
"longitude",
"and",
"latitude",
"value",
"in",
"that",
"respective",
"order",
".",
"Longitude",
"values",
"are",
"limited",
"to",
"a",
"-",
"180",
"to",
"180",
"range",
"and",
"latit... | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Point.java#L101-L108 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Polygon.java | Polygon.isLinearRing | private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | java | private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | [
"private",
"static",
"boolean",
"isLinearRing",
"(",
"LineString",
"lineString",
")",
"{",
"if",
"(",
"lineString",
".",
"coordinates",
"(",
")",
".",
"size",
"(",
")",
"<",
"4",
")",
"{",
"throw",
"new",
"GeoJsonException",
"(",
"\"LinearRings need to be made... | Checks to ensure that the LineStrings defining the polygon correctly and adhering to the linear
ring rules.
@param lineString {@link LineString} the polygon geometry
@return true if number of coordinates are 4 or more, and first and last coordinates
are identical, else false
@throws GeoJsonException if number of coord... | [
"Checks",
"to",
"ensure",
"that",
"the",
"LineStrings",
"defining",
"the",
"polygon",
"correctly",
"and",
"adhering",
"to",
"the",
"linear",
"ring",
"rules",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Polygon.java#L385-L394 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/MapboxService.java | MapboxService.getService | protected S getService() {
// No need to recreate it
if (service != null) {
return service;
}
Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
.baseUrl(baseUrl())
.addConverterFactory(GsonConverterFactory.create(getGsonBuilder().create()));
if (getCallFactory() != null) ... | java | protected S getService() {
// No need to recreate it
if (service != null) {
return service;
}
Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
.baseUrl(baseUrl())
.addConverterFactory(GsonConverterFactory.create(getGsonBuilder().create()));
if (getCallFactory() != null) ... | [
"protected",
"S",
"getService",
"(",
")",
"{",
"// No need to recreate it",
"if",
"(",
"service",
"!=",
"null",
")",
"{",
"return",
"service",
";",
"}",
"Retrofit",
".",
"Builder",
"retrofitBuilder",
"=",
"new",
"Retrofit",
".",
"Builder",
"(",
")",
".",
"... | Creates the Retrofit object and the service if they are not already created. Subclasses can
override getGsonBuilder to add anything to the GsonBuilder.
@return new service if not already created, otherwise the existing service
@since 3.0.0 | [
"Creates",
"the",
"Retrofit",
"object",
"and",
"the",
"service",
"if",
"they",
"are",
"not",
"already",
"created",
".",
"Subclasses",
"can",
"override",
"getGsonBuilder",
"to",
"add",
"anything",
"to",
"the",
"GsonBuilder",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/MapboxService.java#L125-L144 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/MapboxService.java | MapboxService.getOkHttpClient | protected synchronized OkHttpClient getOkHttpClient() {
if (okHttpClient == null) {
if (isEnableDebug()) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
... | java | protected synchronized OkHttpClient getOkHttpClient() {
if (okHttpClient == null) {
if (isEnableDebug()) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
... | [
"protected",
"synchronized",
"OkHttpClient",
"getOkHttpClient",
"(",
")",
"{",
"if",
"(",
"okHttpClient",
"==",
"null",
")",
"{",
"if",
"(",
"isEnableDebug",
"(",
")",
")",
"{",
"HttpLoggingInterceptor",
"logging",
"=",
"new",
"HttpLoggingInterceptor",
"(",
")",... | Used Internally.
@return OkHttpClient
@since 1.0.0 | [
"Used",
"Internally",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/MapboxService.java#L212-L225 | train |
mapbox/mapbox-java | services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java | MapboxDirections.formatWaypointTargets | private static String formatWaypointTargets(Point[] waypointTargets) {
String[] coordinatesFormatted = new String[waypointTargets.length];
int index = 0;
for (Point target : waypointTargets) {
if (target == null) {
coordinatesFormatted[index++] = "";
} else {
coordinatesFormatted... | java | private static String formatWaypointTargets(Point[] waypointTargets) {
String[] coordinatesFormatted = new String[waypointTargets.length];
int index = 0;
for (Point target : waypointTargets) {
if (target == null) {
coordinatesFormatted[index++] = "";
} else {
coordinatesFormatted... | [
"private",
"static",
"String",
"formatWaypointTargets",
"(",
"Point",
"[",
"]",
"waypointTargets",
")",
"{",
"String",
"[",
"]",
"coordinatesFormatted",
"=",
"new",
"String",
"[",
"waypointTargets",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"fo... | Converts array of Points with waypoint_targets values
to a string ready for API consumption.
@param waypointTargets a string representing approaches to each coordinate.
@return a formatted string.
@since 4.3.0 | [
"Converts",
"array",
"of",
"Points",
"with",
"waypoint_targets",
"values",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java#L230-L243 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java | MultiPolygon.polygons | public List<Polygon> polygons() {
List<List<List<Point>>> coordinates = coordinates();
List<Polygon> polygons = new ArrayList<>(coordinates.size());
for (List<List<Point>> points : coordinates) {
polygons.add(Polygon.fromLngLats(points));
}
return polygons;
} | java | public List<Polygon> polygons() {
List<List<List<Point>>> coordinates = coordinates();
List<Polygon> polygons = new ArrayList<>(coordinates.size());
for (List<List<Point>> points : coordinates) {
polygons.add(Polygon.fromLngLats(points));
}
return polygons;
} | [
"public",
"List",
"<",
"Polygon",
">",
"polygons",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"List",
"<",
"Point",
">>>",
"coordinates",
"=",
"coordinates",
"(",
")",
";",
"List",
"<",
"Polygon",
">",
"polygons",
"=",
"new",
"ArrayList",
"<>",
"(",
"c... | Returns a list of polygons which make up this MultiPolygon instance.
@return a list of {@link Polygon}s which make up this MultiPolygon instance
@since 3.0.0 | [
"Returns",
"a",
"list",
"of",
"polygons",
"which",
"make",
"up",
"this",
"MultiPolygon",
"instance",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java#L232-L239 | train |
mapbox/mapbox-java | services-directions/src/main/java/com/mapbox/api/directions/v5/models/DirectionsJsonObject.java | DirectionsJsonObject.toJson | public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter());
return gson.create().toJson(this);
} | java | public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter());
return gson.create().toJson(this);
} | [
"public",
"String",
"toJson",
"(",
")",
"{",
"GsonBuilder",
"gson",
"=",
"new",
"GsonBuilder",
"(",
")",
";",
"gson",
".",
"registerTypeAdapterFactory",
"(",
"DirectionsAdapterFactory",
".",
"create",
"(",
")",
")",
";",
"gson",
".",
"registerTypeAdapter",
"("... | This takes the currently defined values found inside this instance and converts it to a json
string.
@return a JSON string which represents this DirectionsJsonObject
@since 3.4.0 | [
"This",
"takes",
"the",
"currently",
"defined",
"values",
"found",
"inside",
"this",
"instance",
"and",
"converts",
"it",
"to",
"a",
"json",
"string",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-directions/src/main/java/com/mapbox/api/directions/v5/models/DirectionsJsonObject.java#L24-L29 | train |
mapbox/mapbox-java | services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java | MapboxStaticMap.url | public HttpUrl url() {
HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl()).newBuilder()
.addPathSegment("styles")
.addPathSegment("v1")
.addPathSegment(user())
.addPathSegment(styleId())
.addPathSegment("static")
.addQueryParameter("access_token", accessToken());
List<Stri... | java | public HttpUrl url() {
HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl()).newBuilder()
.addPathSegment("styles")
.addPathSegment("v1")
.addPathSegment(user())
.addPathSegment(styleId())
.addPathSegment("static")
.addQueryParameter("access_token", accessToken());
List<Stri... | [
"public",
"HttpUrl",
"url",
"(",
")",
"{",
"HttpUrl",
".",
"Builder",
"urlBuilder",
"=",
"HttpUrl",
".",
"parse",
"(",
"baseUrl",
"(",
")",
")",
".",
"newBuilder",
"(",
")",
".",
"addPathSegment",
"(",
"\"styles\"",
")",
".",
"addPathSegment",
"(",
"\"v1... | Returns the formatted URL string meant to be passed to your Http client for retrieval of the
actual Mapbox Static Image.
@return a {@link HttpUrl} which can be used for making the request for the image
@since 3.0.0 | [
"Returns",
"the",
"formatted",
"URL",
"string",
"meant",
"to",
"be",
"passed",
"to",
"your",
"Http",
"client",
"for",
"retrieval",
"of",
"the",
"actual",
"Mapbox",
"Static",
"Image",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java#L95-L146 | train |
mapbox/mapbox-java | samples/src/main/java/com/mapbox/samples/BasicDirections.java | BasicDirections.simpleMapboxDirectionsRequest | private static void simpleMapboxDirectionsRequest() throws IOException {
MapboxDirections.Builder builder = MapboxDirections.builder();
// 1. Pass in all the required information to get a simple directions route.
builder.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN);
builder.origin(Point.fromLngLat(-95... | java | private static void simpleMapboxDirectionsRequest() throws IOException {
MapboxDirections.Builder builder = MapboxDirections.builder();
// 1. Pass in all the required information to get a simple directions route.
builder.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN);
builder.origin(Point.fromLngLat(-95... | [
"private",
"static",
"void",
"simpleMapboxDirectionsRequest",
"(",
")",
"throws",
"IOException",
"{",
"MapboxDirections",
".",
"Builder",
"builder",
"=",
"MapboxDirections",
".",
"builder",
"(",
")",
";",
"// 1. Pass in all the required information to get a simple directions ... | Demonstrates how to make the most basic GET directions request.
@throws IOException signals that an I/O exception of some sort has occurred | [
"Demonstrates",
"how",
"to",
"make",
"the",
"most",
"basic",
"GET",
"directions",
"request",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/samples/src/main/java/com/mapbox/samples/BasicDirections.java#L31-L47 | train |
mapbox/mapbox-java | samples/src/main/java/com/mapbox/samples/BasicDirections.java | BasicDirections.asyncMapboxDirectionsRequest | private static void asyncMapboxDirectionsRequest() {
// 1. Pass in all the required information to get a route.
MapboxDirections request = MapboxDirections.builder()
.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
.origin(Point.fromLngLat(-95.6332, 29.7890))
.destination(Point.fromLngLat(-95.35... | java | private static void asyncMapboxDirectionsRequest() {
// 1. Pass in all the required information to get a route.
MapboxDirections request = MapboxDirections.builder()
.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
.origin(Point.fromLngLat(-95.6332, 29.7890))
.destination(Point.fromLngLat(-95.35... | [
"private",
"static",
"void",
"asyncMapboxDirectionsRequest",
"(",
")",
"{",
"// 1. Pass in all the required information to get a route.",
"MapboxDirections",
"request",
"=",
"MapboxDirections",
".",
"builder",
"(",
")",
".",
"accessToken",
"(",
"BuildConfig",
".",
"MAPBOX_A... | Demonstrates how to make an asynchronous directions request. | [
"Demonstrates",
"how",
"to",
"make",
"an",
"asynchronous",
"directions",
"request",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/samples/src/main/java/com/mapbox/samples/BasicDirections.java#L73-L100 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getStringProperty | public String getStringProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsString();
} | java | public String getStringProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsString();
} | [
"public",
"String",
"getStringProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsString",
... | Convenience method to get a String member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"String",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L362-L365 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getNumberProperty | public Number getNumberProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsNumber();
} | java | public Number getNumberProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsNumber();
} | [
"public",
"Number",
"getNumberProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsNumber",
... | Convenience method to get a Number member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"Number",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L374-L377 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getBooleanProperty | public Boolean getBooleanProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsBoolean();
} | java | public Boolean getBooleanProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsBoolean();
} | [
"public",
"Boolean",
"getBooleanProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsBoolean... | Convenience method to get a Boolean member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"Boolean",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L386-L389 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getCharacterProperty | public Character getCharacterProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsCharacter();
} | java | public Character getCharacterProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsCharacter();
} | [
"public",
"Character",
"getCharacterProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsCha... | Convenience method to get a Character member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"Character",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L398-L401 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/gson/PointSerializer.java | PointSerializer.serialize | @Override
public JsonElement serialize(Point src, Type typeOfSrc, JsonSerializationContext context) {
JsonArray rawCoordinates = new JsonArray();
// Unshift coordinates
List<Double> unshiftedCoordinates =
CoordinateShifterManager.getCoordinateShifter().unshiftPoint(src);
rawCoordinates.a... | java | @Override
public JsonElement serialize(Point src, Type typeOfSrc, JsonSerializationContext context) {
JsonArray rawCoordinates = new JsonArray();
// Unshift coordinates
List<Double> unshiftedCoordinates =
CoordinateShifterManager.getCoordinateShifter().unshiftPoint(src);
rawCoordinates.a... | [
"@",
"Override",
"public",
"JsonElement",
"serialize",
"(",
"Point",
"src",
",",
"Type",
"typeOfSrc",
",",
"JsonSerializationContext",
"context",
")",
"{",
"JsonArray",
"rawCoordinates",
"=",
"new",
"JsonArray",
"(",
")",
";",
"// Unshift coordinates",
"List",
"<"... | Required to handle the special case where the altitude might be a Double.NaN, which isn't a
valid double value as per JSON specification.
@param src A {@link Point} defined by a longitude, latitude, and optionally, an
altitude.
@param typeOfSrc Common superinterface for all types in the Java.
@param context Co... | [
"Required",
"to",
"handle",
"the",
"special",
"case",
"where",
"the",
"altitude",
"might",
"be",
"a",
"Double",
".",
"NaN",
"which",
"isn",
"t",
"a",
"valid",
"double",
"value",
"as",
"per",
"JSON",
"specification",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/gson/PointSerializer.java#L47-L64 | train |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/MapboxUtils.java | MapboxUtils.isAccessTokenValid | public static boolean isAccessTokenValid(String accessToken) {
return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.")
&& !accessToken.startsWith("sk.") && !accessToken.startsWith("tk."));
} | java | public static boolean isAccessTokenValid(String accessToken) {
return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.")
&& !accessToken.startsWith("sk.") && !accessToken.startsWith("tk."));
} | [
"public",
"static",
"boolean",
"isAccessTokenValid",
"(",
"String",
"accessToken",
")",
"{",
"return",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"accessToken",
")",
"&&",
"!",
"(",
"!",
"accessToken",
".",
"startsWith",
"(",
"\"pk.\"",
")",
"&&",
"!",
"accessTo... | Checks that the provided access token is not empty or null, and that it starts with
the right prefixes. Note that this method does not check Mapbox servers to verify that
it actually belongs to an account.
@param accessToken A Mapbox access token.
@return true if the provided access token is valid, false otherwise.
@s... | [
"Checks",
"that",
"the",
"provided",
"access",
"token",
"is",
"not",
"empty",
"or",
"null",
"and",
"that",
"it",
"starts",
"with",
"the",
"right",
"prefixes",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"check",
"Mapbox",
"servers",
"to",
"verify... | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/MapboxUtils.java#L23-L26 | train |
mapbox/mapbox-java | services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java | TurfAssertions.geojsonType | public static void geojsonType(GeoJson value, String type, String name) {
if (type == null || type.length() == 0 || name == null || name.length() == 0) {
throw new TurfException("Type and name required");
}
if (value == null || !value.type().equals(type)) {
throw new TurfException("Invalid input... | java | public static void geojsonType(GeoJson value, String type, String name) {
if (type == null || type.length() == 0 || name == null || name.length() == 0) {
throw new TurfException("Type and name required");
}
if (value == null || !value.type().equals(type)) {
throw new TurfException("Invalid input... | [
"public",
"static",
"void",
"geojsonType",
"(",
"GeoJson",
"value",
",",
"String",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"length",
"(",
")",
"==",
"0",
"||",
"name",
"==",
"null",
"||",
"name",
... | Enforce expectations about types of GeoJson objects for Turf.
@param value any GeoJson object
@param type expected GeoJson type
@param name name of calling function
@see <a href="http://turfjs.org/docs/#geojsontype">Turf geojsonType documentation</a>
@since 1.2.0 | [
"Enforce",
"expectations",
"about",
"types",
"of",
"GeoJson",
"objects",
"for",
"Turf",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java#L44-L52 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java | BoundingBox.fromCoordinates | @Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
... | java | @Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
... | [
"@",
"Deprecated",
"public",
"static",
"BoundingBox",
"fromCoordinates",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LONGITUDE",
",",
"to",
"=",
"GeoJsonConstants",
".",
"MAX_LONGITUDE",
")",
"double",
"west",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_... | Define a new instance of this class by passing in four coordinates in the same order they would
appear in the serialized GeoJson form. Limits are placed on the minimum and maximum coordinate
values which can exist and comply with the GeoJson spec.
@param west the left side of the bounding box when the map is facing d... | [
"Define",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"passing",
"in",
"four",
"coordinates",
"in",
"the",
"same",
"order",
"they",
"would",
"appear",
"in",
"the",
"serialized",
"GeoJson",
"form",
".",
"Limits",
"are",
"placed",
"on",
"the",
"mini... | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java#L83-L90 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.encode | @NonNull
public static String encode(@NonNull final List<Point> path, int precision) {
long lastLat = 0;
long lastLng = 0;
final StringBuilder result = new StringBuilder();
// OSRM uses precision=6, the default Polyline spec divides by 1E5, capping at precision=5
double factor = Math.pow(10, pre... | java | @NonNull
public static String encode(@NonNull final List<Point> path, int precision) {
long lastLat = 0;
long lastLng = 0;
final StringBuilder result = new StringBuilder();
// OSRM uses precision=6, the default Polyline spec divides by 1E5, capping at precision=5
double factor = Math.pow(10, pre... | [
"@",
"NonNull",
"public",
"static",
"String",
"encode",
"(",
"@",
"NonNull",
"final",
"List",
"<",
"Point",
">",
"path",
",",
"int",
"precision",
")",
"{",
"long",
"lastLat",
"=",
"0",
";",
"long",
"lastLng",
"=",
"0",
";",
"final",
"StringBuilder",
"r... | Encodes a sequence of Points into an encoded path string.
@param path list of {@link Point}s making up the line
@param precision OSRMv4 uses 6, OSRMv5 and Google uses 5
@return a String representing a path string
@since 1.0.0 | [
"Encodes",
"a",
"sequence",
"of",
"Points",
"into",
"an",
"encoded",
"path",
"string",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L88-L112 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.getSqDist | private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | java | private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | [
"private",
"static",
"double",
"getSqDist",
"(",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"double",
"dx",
"=",
"p1",
".",
"longitude",
"(",
")",
"-",
"p2",
".",
"longitude",
"(",
")",
";",
"double",
"dy",
"=",
"p1",
".",
"latitude",
"(",
")",
... | Square distance between 2 points.
@param p1 first {@link Point}
@param p2 second Point
@return square of the distance between two input points | [
"Square",
"distance",
"between",
"2",
"points",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L209-L213 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.getSqSegDist | private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
doubl... | java | private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
doubl... | [
"private",
"static",
"double",
"getSqSegDist",
"(",
"Point",
"point",
",",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"double",
"horizontal",
"=",
"p1",
".",
"longitude",
"(",
")",
";",
"double",
"vertical",
"=",
"p1",
".",
"latitude",
"(",
")",
";",... | Square distance from a point to a segment.
@param point {@link Point} whose distance from segment needs to be determined
@param p1,p2 points defining the segment
@return square of the distance between first input point and segment defined by
other two input points | [
"Square",
"distance",
"from",
"a",
"point",
"to",
"a",
"segment",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L223-L247 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.simplifyRadialDist | private static List<Point> simplifyRadialDist(List<Point> points, double sqTolerance) {
Point prevPoint = points.get(0);
ArrayList<Point> newPoints = new ArrayList<>();
newPoints.add(prevPoint);
Point point = null;
for (int i = 1, len = points.size(); i < len; i++) {
point = points.get(i);
... | java | private static List<Point> simplifyRadialDist(List<Point> points, double sqTolerance) {
Point prevPoint = points.get(0);
ArrayList<Point> newPoints = new ArrayList<>();
newPoints.add(prevPoint);
Point point = null;
for (int i = 1, len = points.size(); i < len; i++) {
point = points.get(i);
... | [
"private",
"static",
"List",
"<",
"Point",
">",
"simplifyRadialDist",
"(",
"List",
"<",
"Point",
">",
"points",
",",
"double",
"sqTolerance",
")",
"{",
"Point",
"prevPoint",
"=",
"points",
".",
"get",
"(",
"0",
")",
";",
"ArrayList",
"<",
"Point",
">",
... | Basic distance-based simplification.
@param points a list of points to be simplified
@param sqTolerance square of amount of simplification
@return a list of simplified points | [
"Basic",
"distance",
"-",
"based",
"simplification",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L256-L275 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.simplifyDouglasPeucker | private static List<Point> simplifyDouglasPeucker(List<Point> points, double sqTolerance) {
int last = points.size() - 1;
ArrayList<Point> simplified = new ArrayList<>();
simplified.add(points.get(0));
simplified.addAll(simplifyDpStep(points, 0, last, sqTolerance, simplified));
simplified.add(points... | java | private static List<Point> simplifyDouglasPeucker(List<Point> points, double sqTolerance) {
int last = points.size() - 1;
ArrayList<Point> simplified = new ArrayList<>();
simplified.add(points.get(0));
simplified.addAll(simplifyDpStep(points, 0, last, sqTolerance, simplified));
simplified.add(points... | [
"private",
"static",
"List",
"<",
"Point",
">",
"simplifyDouglasPeucker",
"(",
"List",
"<",
"Point",
">",
"points",
",",
"double",
"sqTolerance",
")",
"{",
"int",
"last",
"=",
"points",
".",
"size",
"(",
")",
"-",
"1",
";",
"ArrayList",
"<",
"Point",
"... | Simplification using Ramer-Douglas-Peucker algorithm.
@param points a list of points to be simplified
@param sqTolerance square of amount of simplification
@return a list of simplified points | [
"Simplification",
"using",
"Ramer",
"-",
"Douglas",
"-",
"Peucker",
"algorithm",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L314-L321 | train |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/GeoJsonUtils.java | GeoJsonUtils.trim | public static double trim(double value) {
if (value > MAX_DOUBLE_TO_ROUND || value < -MAX_DOUBLE_TO_ROUND) {
return value;
}
return Math.round(value * ROUND_PRECISION) / ROUND_PRECISION;
} | java | public static double trim(double value) {
if (value > MAX_DOUBLE_TO_ROUND || value < -MAX_DOUBLE_TO_ROUND) {
return value;
}
return Math.round(value * ROUND_PRECISION) / ROUND_PRECISION;
} | [
"public",
"static",
"double",
"trim",
"(",
"double",
"value",
")",
"{",
"if",
"(",
"value",
">",
"MAX_DOUBLE_TO_ROUND",
"||",
"value",
"<",
"-",
"MAX_DOUBLE_TO_ROUND",
")",
"{",
"return",
"value",
";",
"}",
"return",
"Math",
".",
"round",
"(",
"value",
"... | Trims a double value to have only 7 digits after period.
@param value to be trimed
@return trimmed value | [
"Trims",
"a",
"double",
"value",
"to",
"have",
"only",
"7",
"digits",
"after",
"period",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/GeoJsonUtils.java#L19-L24 | train |
jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPanelView.java | ColorPanelView.showHint | public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int mid... | java | public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int mid... | [
"public",
"void",
"showHint",
"(",
")",
"{",
"final",
"int",
"[",
"]",
"screenPos",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"final",
"Rect",
"displayFrame",
"=",
"new",
"Rect",
"(",
")",
";",
"getLocationOnScreen",
"(",
"screenPos",
")",
";",
"getWindow... | Show a toast message with the hex color code below the view. | [
"Show",
"a",
"toast",
"message",
"with",
"the",
"hex",
"color",
"code",
"below",
"the",
"view",
"."
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPanelView.java#L278-L307 | train |
jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java | ColorPickerDialog.createPickerView | View createPickerView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
newC... | java | View createPickerView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
newC... | [
"View",
"createPickerView",
"(",
")",
"{",
"View",
"contentView",
"=",
"View",
".",
"inflate",
"(",
"getActivity",
"(",
")",
",",
"R",
".",
"layout",
".",
"cpv_dialog_color_picker",
",",
"null",
")",
";",
"colorPicker",
"=",
"(",
"ColorPickerView",
")",
"c... | region Custom Picker | [
"region",
"Custom",
"Picker"
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java#L275-L326 | train |
jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java | ColorPickerDialog.createPresetsView | View createPresetsView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null);
shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout);
transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar);
transparencyPercText = (TextView)... | java | View createPresetsView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null);
shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout);
transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar);
transparencyPercText = (TextView)... | [
"View",
"createPresetsView",
"(",
")",
"{",
"View",
"contentView",
"=",
"View",
".",
"inflate",
"(",
"getActivity",
"(",
")",
",",
"R",
".",
"layout",
".",
"cpv_dialog_presets",
",",
"null",
")",
";",
"shadesLayout",
"=",
"(",
"LinearLayout",
")",
"content... | region Presets Picker | [
"region",
"Presets",
"Picker"
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java#L428-L469 | train |
jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java | ColorPickerView.setColor | public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat =... | java | public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat =... | [
"public",
"void",
"setColor",
"(",
"int",
"color",
",",
"boolean",
"callback",
")",
"{",
"int",
"alpha",
"=",
"Color",
".",
"alpha",
"(",
"color",
")",
";",
"int",
"red",
"=",
"Color",
".",
"red",
"(",
"color",
")",
";",
"int",
"blue",
"=",
"Color"... | Set the color this view should show.
@param color The color that should be selected. #argb
@param callback If you want to get a callback to your OnColorChangedListener. | [
"Set",
"the",
"color",
"this",
"view",
"should",
"show",
"."
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java#L835-L856 | train |
jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java | ColorPickerView.setAlphaSliderVisible | public void setAlphaSliderVisible(boolean visible) {
if (showAlphaPanel != visible) {
showAlphaPanel = visible;
/*
* Force recreation.
*/
valShader = null;
satShader = null;
alphaShader = null;
hueBackgroundCache = null;
satValBackgroundCache = null;
r... | java | public void setAlphaSliderVisible(boolean visible) {
if (showAlphaPanel != visible) {
showAlphaPanel = visible;
/*
* Force recreation.
*/
valShader = null;
satShader = null;
alphaShader = null;
hueBackgroundCache = null;
satValBackgroundCache = null;
r... | [
"public",
"void",
"setAlphaSliderVisible",
"(",
"boolean",
"visible",
")",
"{",
"if",
"(",
"showAlphaPanel",
"!=",
"visible",
")",
"{",
"showAlphaPanel",
"=",
"visible",
";",
"/*\n * Force recreation.\n */",
"valShader",
"=",
"null",
";",
"satShader",
"=... | Set if the user is allowed to adjust the alpha panel. Default is false.
If it is set to false no alpha will be set.
@param visible {@code true} to show the alpha slider | [
"Set",
"if",
"the",
"user",
"is",
"allowed",
"to",
"adjust",
"the",
"alpha",
"panel",
".",
"Default",
"is",
"false",
".",
"If",
"it",
"is",
"set",
"to",
"false",
"no",
"alpha",
"will",
"be",
"set",
"."
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java#L864-L879 | train |
HaraldWalker/user-agent-utils | src/main/java/eu/bitwalker/useragentutils/UserAgent.java | UserAgent.valueOf | public static UserAgent valueOf(int id)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf((short) (id >> 16));
Browser browser = Browser.valueOf( (short) (id & 0x0FFFF));
return new UserAgent(operatingSystem,browser);
} | java | public static UserAgent valueOf(int id)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf((short) (id >> 16));
Browser browser = Browser.valueOf( (short) (id & 0x0FFFF));
return new UserAgent(operatingSystem,browser);
} | [
"public",
"static",
"UserAgent",
"valueOf",
"(",
"int",
"id",
")",
"{",
"OperatingSystem",
"operatingSystem",
"=",
"OperatingSystem",
".",
"valueOf",
"(",
"(",
"short",
")",
"(",
"id",
">>",
"16",
")",
")",
";",
"Browser",
"browser",
"=",
"Browser",
".",
... | Returns UserAgent based on specified unique id
@param id Id value of the user agent.
@return UserAgent | [
"Returns",
"UserAgent",
"based",
"on",
"specified",
"unique",
"id"
] | 7f954514298f76afff8a75723bc25205bfe30d1b | https://github.com/HaraldWalker/user-agent-utils/blob/7f954514298f76afff8a75723bc25205bfe30d1b/src/main/java/eu/bitwalker/useragentutils/UserAgent.java#L167-L172 | train |
HaraldWalker/user-agent-utils | src/main/java/eu/bitwalker/useragentutils/UserAgent.java | UserAgent.valueOf | public static UserAgent valueOf(String name)
{
if (name == null)
throw new NullPointerException("Name is null");
String[] elements = name.split("-");
if (elements.length == 2)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf(elements[0]);
Browser browser = Browser.valueOf(ele... | java | public static UserAgent valueOf(String name)
{
if (name == null)
throw new NullPointerException("Name is null");
String[] elements = name.split("-");
if (elements.length == 2)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf(elements[0]);
Browser browser = Browser.valueOf(ele... | [
"public",
"static",
"UserAgent",
"valueOf",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Name is null\"",
")",
";",
"String",
"[",
"]",
"elements",
"=",
"name",
".",
"split",
"(",
... | Returns UserAgent based on combined string representation
@param name Name of the user agent.
@return UserAgent | [
"Returns",
"UserAgent",
"based",
"on",
"combined",
"string",
"representation"
] | 7f954514298f76afff8a75723bc25205bfe30d1b | https://github.com/HaraldWalker/user-agent-utils/blob/7f954514298f76afff8a75723bc25205bfe30d1b/src/main/java/eu/bitwalker/useragentutils/UserAgent.java#L179-L195 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/ByteBufferInput.java | ByteBufferInput.reset | public ByteBuffer reset(ByteBuffer input)
{
ByteBuffer old = this.input;
this.input = checkNotNull(input, "input ByteBuffer is null").slice();
isRead = false;
return old;
} | java | public ByteBuffer reset(ByteBuffer input)
{
ByteBuffer old = this.input;
this.input = checkNotNull(input, "input ByteBuffer is null").slice();
isRead = false;
return old;
} | [
"public",
"ByteBuffer",
"reset",
"(",
"ByteBuffer",
"input",
")",
"{",
"ByteBuffer",
"old",
"=",
"this",
".",
"input",
";",
"this",
".",
"input",
"=",
"checkNotNull",
"(",
"input",
",",
"\"input ByteBuffer is null\"",
")",
".",
"slice",
"(",
")",
";",
"isR... | Reset buffer.
@param input new buffer
@return the old buffer | [
"Reset",
"buffer",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/ByteBufferInput.java#L42-L48 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java | MessagePacker.packString | public MessagePacker packString(String s)
throws IOException
{
if (s.length() <= 0) {
packRawStringHeader(0);
return this;
}
else if (CORRUPTED_CHARSET_ENCODER || s.length() < smallStringOptimizationThreshold) {
// Using String.getBytes is gene... | java | public MessagePacker packString(String s)
throws IOException
{
if (s.length() <= 0) {
packRawStringHeader(0);
return this;
}
else if (CORRUPTED_CHARSET_ENCODER || s.length() < smallStringOptimizationThreshold) {
// Using String.getBytes is gene... | [
"public",
"MessagePacker",
"packString",
"(",
"String",
"s",
")",
"throws",
"IOException",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
"<=",
"0",
")",
"{",
"packRawStringHeader",
"(",
"0",
")",
";",
"return",
"this",
";",
"}",
"else",
"if",
"(",
"C... | Writes a String vlaue in UTF-8 encoding.
<p>
This method writes a UTF-8 string using the smallest format from the str format family by default. If {@link MessagePack.PackerConfig#withStr8FormatSupport(boolean)} is set to false, smallest format from the str format family excepting str8 format.
@param s the string to b... | [
"Writes",
"a",
"String",
"vlaue",
"in",
"UTF",
"-",
"8",
"encoding",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java#L722-L799 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newMessageBuffer | private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len)
{
checkNotNull(arr);
if (mbArrConstructor != null) {
return newInstance(mbArrConstructor, arr, off, len);
}
return new MessageBuffer(arr, off, len);
} | java | private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len)
{
checkNotNull(arr);
if (mbArrConstructor != null) {
return newInstance(mbArrConstructor, arr, off, len);
}
return new MessageBuffer(arr, off, len);
} | [
"private",
"static",
"MessageBuffer",
"newMessageBuffer",
"(",
"byte",
"[",
"]",
"arr",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"checkNotNull",
"(",
"arr",
")",
";",
"if",
"(",
"mbArrConstructor",
"!=",
"null",
")",
"{",
"return",
"newInstance",
... | Creates a new MessageBuffer instance backed by a java heap array
@param arr
@return | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance",
"backed",
"by",
"a",
"java",
"heap",
"array"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L273-L280 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newMessageBuffer | private static MessageBuffer newMessageBuffer(ByteBuffer bb)
{
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | java | private static MessageBuffer newMessageBuffer(ByteBuffer bb)
{
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | [
"private",
"static",
"MessageBuffer",
"newMessageBuffer",
"(",
"ByteBuffer",
"bb",
")",
"{",
"checkNotNull",
"(",
"bb",
")",
";",
"if",
"(",
"mbBBConstructor",
"!=",
"null",
")",
"{",
"return",
"newInstance",
"(",
"mbBBConstructor",
",",
"bb",
")",
";",
"}",... | Creates a new MessageBuffer instance backed by ByteBuffer
@param bb
@return | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance",
"backed",
"by",
"ByteBuffer"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L288-L295 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newInstance | private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
{
try {
// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
// generated to resolve one of the method refe... | java | private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
{
try {
// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
// generated to resolve one of the method refe... | [
"private",
"static",
"MessageBuffer",
"newInstance",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method.... | Creates a new MessageBuffer instance
@param constructor A MessageBuffer constructor
@return new MessageBuffer instance | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L303-L329 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.getInt | public int getInt(int index)
{
// Reading little-endian value
int i = unsafe.getInt(base, address + index);
// Reversing the endian
return Integer.reverseBytes(i);
} | java | public int getInt(int index)
{
// Reading little-endian value
int i = unsafe.getInt(base, address + index);
// Reversing the endian
return Integer.reverseBytes(i);
} | [
"public",
"int",
"getInt",
"(",
"int",
"index",
")",
"{",
"// Reading little-endian value",
"int",
"i",
"=",
"unsafe",
".",
"getInt",
"(",
"base",
",",
"address",
"+",
"index",
")",
";",
"// Reversing the endian",
"return",
"Integer",
".",
"reverseBytes",
"(",... | Read a big-endian int value at the specified index
@param index
@return | [
"Read",
"a",
"big",
"-",
"endian",
"int",
"value",
"at",
"the",
"specified",
"index"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L443-L449 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.putInt | public void putInt(int index, int v)
{
// Reversing the endian
v = Integer.reverseBytes(v);
unsafe.putInt(base, address + index, v);
} | java | public void putInt(int index, int v)
{
// Reversing the endian
v = Integer.reverseBytes(v);
unsafe.putInt(base, address + index, v);
} | [
"public",
"void",
"putInt",
"(",
"int",
"index",
",",
"int",
"v",
")",
"{",
"// Reversing the endian",
"v",
"=",
"Integer",
".",
"reverseBytes",
"(",
"v",
")",
";",
"unsafe",
".",
"putInt",
"(",
"base",
",",
"address",
"+",
"index",
",",
"v",
")",
";... | Write a big-endian integer value to the memory
@param index
@param v | [
"Write",
"a",
"big",
"-",
"endian",
"integer",
"value",
"to",
"the",
"memory"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L503-L508 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.