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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Doctoror/ParticlesDrawable | library/src/main/java/com/doctoror/particlesdrawable/util/LineColorResolver.java | LineColorResolver.resolveLineAlpha | @IntRange(from = 0, to = OPAQUE)
private static int resolveLineAlpha(
@IntRange(from = 0, to = OPAQUE) final int sceneAlpha,
final float maxDistance,
final float distance) {
final float alphaPercent = 1f - distance / maxDistance;
final int alpha = (int) ((float) O... | java | @IntRange(from = 0, to = OPAQUE)
private static int resolveLineAlpha(
@IntRange(from = 0, to = OPAQUE) final int sceneAlpha,
final float maxDistance,
final float distance) {
final float alphaPercent = 1f - distance / maxDistance;
final int alpha = (int) ((float) O... | [
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"OPAQUE",
")",
"private",
"static",
"int",
"resolveLineAlpha",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"OPAQUE",
")",
"final",
"int",
"sceneAlpha",
",",
"final",
"float",
"m... | Resolves line alpha based on distance comparing to max distance.
Where alpha is close to 0 for maxDistance, and close to 1 to 0 distance.
@param distance line length
@param maxDistance max line length
@return line alpha | [
"Resolves",
"line",
"alpha",
"based",
"on",
"distance",
"comparing",
"to",
"max",
"distance",
".",
"Where",
"alpha",
"is",
"close",
"to",
"0",
"for",
"maxDistance",
"and",
"close",
"to",
"1",
"to",
"0",
"distance",
"."
] | 97ab510936692b5cf47822df78dd455f5e4b7ddf | https://github.com/Doctoror/ParticlesDrawable/blob/97ab510936692b5cf47822df78dd455f5e4b7ddf/library/src/main/java/com/doctoror/particlesdrawable/util/LineColorResolver.java#L36-L44 | train |
Doctoror/ParticlesDrawable | library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java | ParticleGenerator.applyFreshParticleOnScreen | void applyFreshParticleOnScreen(
@NonNull final Scene scene,
final int position
) {
final int w = scene.getWidth();
final int h = scene.getHeight();
if (w == 0 || h == 0) {
throw new IllegalStateException(
"Cannot generate particles if ... | java | void applyFreshParticleOnScreen(
@NonNull final Scene scene,
final int position
) {
final int w = scene.getWidth();
final int h = scene.getHeight();
if (w == 0 || h == 0) {
throw new IllegalStateException(
"Cannot generate particles if ... | [
"void",
"applyFreshParticleOnScreen",
"(",
"@",
"NonNull",
"final",
"Scene",
"scene",
",",
"final",
"int",
"position",
")",
"{",
"final",
"int",
"w",
"=",
"scene",
".",
"getWidth",
"(",
")",
";",
"final",
"int",
"h",
"=",
"scene",
".",
"getHeight",
"(",
... | Set new point coordinates somewhere on screen and apply new direction
@param position the point position to apply new values to | [
"Set",
"new",
"point",
"coordinates",
"somewhere",
"on",
"screen",
"and",
"apply",
"new",
"direction"
] | 97ab510936692b5cf47822df78dd455f5e4b7ddf | https://github.com/Doctoror/ParticlesDrawable/blob/97ab510936692b5cf47822df78dd455f5e4b7ddf/library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java#L56-L83 | train |
Doctoror/ParticlesDrawable | library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java | ParticleGenerator.applyFreshParticleOffScreen | void applyFreshParticleOffScreen(
@NonNull final Scene scene,
final int position) {
final int w = scene.getWidth();
final int h = scene.getHeight();
if (w == 0 || h == 0) {
throw new IllegalStateException(
"Cannot generate particles if scen... | java | void applyFreshParticleOffScreen(
@NonNull final Scene scene,
final int position) {
final int w = scene.getWidth();
final int h = scene.getHeight();
if (w == 0 || h == 0) {
throw new IllegalStateException(
"Cannot generate particles if scen... | [
"void",
"applyFreshParticleOffScreen",
"(",
"@",
"NonNull",
"final",
"Scene",
"scene",
",",
"final",
"int",
"position",
")",
"{",
"final",
"int",
"w",
"=",
"scene",
".",
"getWidth",
"(",
")",
";",
"final",
"int",
"h",
"=",
"scene",
".",
"getHeight",
"(",... | Set new particle coordinates somewhere off screen and apply new direction towards the screen
@param position the particle position to apply new values to | [
"Set",
"new",
"particle",
"coordinates",
"somewhere",
"off",
"screen",
"and",
"apply",
"new",
"direction",
"towards",
"the",
"screen"
] | 97ab510936692b5cf47822df78dd455f5e4b7ddf | https://github.com/Doctoror/ParticlesDrawable/blob/97ab510936692b5cf47822df78dd455f5e4b7ddf/library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java#L90-L167 | train |
Doctoror/ParticlesDrawable | library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java | ParticleGenerator.angleDeg | private static float angleDeg(final float ax, final float ay,
final float bx, final float by) {
final double angleRad = Math.atan2(ay - by, ax - bx);
double angle = Math.toDegrees(angleRad);
if (angleRad < 0) {
angle += 360;
}
return ... | java | private static float angleDeg(final float ax, final float ay,
final float bx, final float by) {
final double angleRad = Math.atan2(ay - by, ax - bx);
double angle = Math.toDegrees(angleRad);
if (angleRad < 0) {
angle += 360;
}
return ... | [
"private",
"static",
"float",
"angleDeg",
"(",
"final",
"float",
"ax",
",",
"final",
"float",
"ay",
",",
"final",
"float",
"bx",
",",
"final",
"float",
"by",
")",
"{",
"final",
"double",
"angleRad",
"=",
"Math",
".",
"atan2",
"(",
"ay",
"-",
"by",
",... | Returns angle in degrees between two points
@param ax x of the point 1
@param ay y of the point 1
@param bx x of the point 2
@param by y of the point 2
@return angle in degrees between two points | [
"Returns",
"angle",
"in",
"degrees",
"between",
"two",
"points"
] | 97ab510936692b5cf47822df78dd455f5e4b7ddf | https://github.com/Doctoror/ParticlesDrawable/blob/97ab510936692b5cf47822df78dd455f5e4b7ddf/library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java#L178-L186 | train |
Doctoror/ParticlesDrawable | library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java | ParticleGenerator.newRandomIndividualParticleRadius | private float newRandomIndividualParticleRadius(@NonNull final SceneConfiguration scene) {
return scene.getParticleRadiusMin() == scene.getParticleRadiusMax() ?
scene.getParticleRadiusMin() : scene.getParticleRadiusMin() + (random.nextInt(
(int) ((scene.getParticleRadiusMax() - s... | java | private float newRandomIndividualParticleRadius(@NonNull final SceneConfiguration scene) {
return scene.getParticleRadiusMin() == scene.getParticleRadiusMax() ?
scene.getParticleRadiusMin() : scene.getParticleRadiusMin() + (random.nextInt(
(int) ((scene.getParticleRadiusMax() - s... | [
"private",
"float",
"newRandomIndividualParticleRadius",
"(",
"@",
"NonNull",
"final",
"SceneConfiguration",
"scene",
")",
"{",
"return",
"scene",
".",
"getParticleRadiusMin",
"(",
")",
"==",
"scene",
".",
"getParticleRadiusMax",
"(",
")",
"?",
"scene",
".",
"getP... | Generates new individual particle radius based on min and max radius setting.
@return new particle radius | [
"Generates",
"new",
"individual",
"particle",
"radius",
"based",
"on",
"min",
"and",
"max",
"radius",
"setting",
"."
] | 97ab510936692b5cf47822df78dd455f5e4b7ddf | https://github.com/Doctoror/ParticlesDrawable/blob/97ab510936692b5cf47822df78dd455f5e4b7ddf/library/src/main/java/com/doctoror/particlesdrawable/engine/ParticleGenerator.java#L203-L208 | train |
Doctoror/ParticlesDrawable | library/src/main/java/com/doctoror/particlesdrawable/util/DistanceResolver.java | DistanceResolver.distance | public static float distance(final float ax, final float ay,
final float bx, final float by) {
return (float) Math.sqrt(
(ax - bx) * (ax - bx) +
(ay - by) * (ay - by)
);
} | java | public static float distance(final float ax, final float ay,
final float bx, final float by) {
return (float) Math.sqrt(
(ax - bx) * (ax - bx) +
(ay - by) * (ay - by)
);
} | [
"public",
"static",
"float",
"distance",
"(",
"final",
"float",
"ax",
",",
"final",
"float",
"ay",
",",
"final",
"float",
"bx",
",",
"final",
"float",
"by",
")",
"{",
"return",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"(",
"ax",
"-",
"bx",
")",... | Calculates the distance between two points
@return distance between two points | [
"Calculates",
"the",
"distance",
"between",
"two",
"points"
] | 97ab510936692b5cf47822df78dd455f5e4b7ddf | https://github.com/Doctoror/ParticlesDrawable/blob/97ab510936692b5cf47822df78dd455f5e4b7ddf/library/src/main/java/com/doctoror/particlesdrawable/util/DistanceResolver.java#L28-L34 | train |
ajoberstar/gradle-git | src/main/groovy/org/ajoberstar/gradle/git/auth/BasicPasswordCredentials.java | BasicPasswordCredentials.toGrgit | public Credentials toGrgit() {
if (username != null && password != null) {
return new Credentials(username, password);
} else {
return null;
}
} | java | public Credentials toGrgit() {
if (username != null && password != null) {
return new Credentials(username, password);
} else {
return null;
}
} | [
"public",
"Credentials",
"toGrgit",
"(",
")",
"{",
"if",
"(",
"username",
"!=",
"null",
"&&",
"password",
"!=",
"null",
")",
"{",
"return",
"new",
"Credentials",
"(",
"username",
",",
"password",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
... | Converts to credentials for use in Grgit.
@return {@code null} if both username and password are {@code null},
otherwise returns credentials in Grgit format. | [
"Converts",
"to",
"credentials",
"for",
"use",
"in",
"Grgit",
"."
] | 03b08b9f8dd2b2ff0ee9228906a6e9781b85ec79 | https://github.com/ajoberstar/gradle-git/blob/03b08b9f8dd2b2ff0ee9228906a6e9781b85ec79/src/main/groovy/org/ajoberstar/gradle/git/auth/BasicPasswordCredentials.java#L87-L93 | train |
f2prateek/dart | dart-sample/app/src/main/java/com/f2prateek/dart/example/MainActivity.java | MainActivity.onSampleActivityCTAClick | @OnClick(R.id.navigateToSampleActivity)
public void onSampleActivityCTAClick() {
StringParcel parcel1 = new StringParcel("Andy");
StringParcel parcel2 = new StringParcel("Tony");
List<StringParcel> parcelList = new ArrayList<>();
parcelList.add(parcel1);
parcelList.add(parcel2);
SparseArray<... | java | @OnClick(R.id.navigateToSampleActivity)
public void onSampleActivityCTAClick() {
StringParcel parcel1 = new StringParcel("Andy");
StringParcel parcel2 = new StringParcel("Tony");
List<StringParcel> parcelList = new ArrayList<>();
parcelList.add(parcel1);
parcelList.add(parcel2);
SparseArray<... | [
"@",
"OnClick",
"(",
"R",
".",
"id",
".",
"navigateToSampleActivity",
")",
"public",
"void",
"onSampleActivityCTAClick",
"(",
")",
"{",
"StringParcel",
"parcel1",
"=",
"new",
"StringParcel",
"(",
"\"Andy\"",
")",
";",
"StringParcel",
"parcel2",
"=",
"new",
"St... | Launch Sample Activity residing in the same module | [
"Launch",
"Sample",
"Activity",
"residing",
"in",
"the",
"same",
"module"
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/dart-sample/app/src/main/java/com/f2prateek/dart/example/MainActivity.java#L42-L66 | train |
f2prateek/dart | dart-sample/app/src/main/java/com/f2prateek/dart/example/MainActivity.java | MainActivity.onNavigationServiceCTAClick | @OnClick(R.id.navigateToModule1Service)
public void onNavigationServiceCTAClick() {
Intent intentService = HensonNavigator.gotoModule1Service(this)
.stringExtra("foo")
.build();
startService(intentService);
} | java | @OnClick(R.id.navigateToModule1Service)
public void onNavigationServiceCTAClick() {
Intent intentService = HensonNavigator.gotoModule1Service(this)
.stringExtra("foo")
.build();
startService(intentService);
} | [
"@",
"OnClick",
"(",
"R",
".",
"id",
".",
"navigateToModule1Service",
")",
"public",
"void",
"onNavigationServiceCTAClick",
"(",
")",
"{",
"Intent",
"intentService",
"=",
"HensonNavigator",
".",
"gotoModule1Service",
"(",
"this",
")",
".",
"stringExtra",
"(",
"\... | Launch Navigation Service residing in the navigation module | [
"Launch",
"Navigation",
"Service",
"residing",
"in",
"the",
"navigation",
"module"
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/dart-sample/app/src/main/java/com/f2prateek/dart/example/MainActivity.java#L96-L103 | train |
f2prateek/dart | dart-common/src/main/java/dart/common/util/StringUtil.java | StringUtil.isValidFqcn | public static boolean isValidFqcn(String str) {
if (isNullOrEmpty(str)) {
return false;
}
final String[] parts = str.split("\\.");
if (parts.length < 2) {
return false;
}
for (String part : parts) {
if (!isValidJavaIdentifier(part)) {
return false;
}
}
ret... | java | public static boolean isValidFqcn(String str) {
if (isNullOrEmpty(str)) {
return false;
}
final String[] parts = str.split("\\.");
if (parts.length < 2) {
return false;
}
for (String part : parts) {
if (!isValidJavaIdentifier(part)) {
return false;
}
}
ret... | [
"public",
"static",
"boolean",
"isValidFqcn",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"str",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"String",
"[",
"]",
"parts",
"=",
"str",
".",
"split",
"(",
"\"\\\\.\"",
")",
"... | Returns true if the string is a valid Java full qualified class name.
@param str the string to be examined
@return true if str is a valid Java Fqcn | [
"Returns",
"true",
"if",
"the",
"string",
"is",
"a",
"valid",
"Java",
"full",
"qualified",
"class",
"name",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/dart-common/src/main/java/dart/common/util/StringUtil.java#L129-L143 | train |
f2prateek/dart | henson-plugin/src/main/java/dart/henson/plugin/internal/TaskManager.java | TaskManager.createHensonNavigatorGenerationTask | public TaskProvider<GenerateHensonNavigatorTask> createHensonNavigatorGenerationTask(
BaseVariant variant, String hensonNavigatorPackageName, File destinationFolder) {
TaskProvider<GenerateHensonNavigatorTask> generateHensonNavigatorTask =
project
.getTasks()
.register(
... | java | public TaskProvider<GenerateHensonNavigatorTask> createHensonNavigatorGenerationTask(
BaseVariant variant, String hensonNavigatorPackageName, File destinationFolder) {
TaskProvider<GenerateHensonNavigatorTask> generateHensonNavigatorTask =
project
.getTasks()
.register(
... | [
"public",
"TaskProvider",
"<",
"GenerateHensonNavigatorTask",
">",
"createHensonNavigatorGenerationTask",
"(",
"BaseVariant",
"variant",
",",
"String",
"hensonNavigatorPackageName",
",",
"File",
"destinationFolder",
")",
"{",
"TaskProvider",
"<",
"GenerateHensonNavigatorTask",
... | A henson navigator is a class that helps a consumer to consume the navigation api that it
declares in its dependencies. The henson navigator will wrap the intent builders. Thus, a
henson navigator, is driven by consumption of intent builders, whereas the henson classes are
driven by the production of an intent builder.... | [
"A",
"henson",
"navigator",
"is",
"a",
"class",
"that",
"helps",
"a",
"consumer",
"to",
"consume",
"the",
"navigation",
"api",
"that",
"it",
"declares",
"in",
"its",
"dependencies",
".",
"The",
"henson",
"navigator",
"will",
"wrap",
"the",
"intent",
"builder... | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson-plugin/src/main/java/dart/henson/plugin/internal/TaskManager.java#L58-L78 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, Bundle value) {
delegate.putBundle(key, value);
return this;
} | java | public Bundler put(String key, Bundle value) {
delegate.putBundle(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"Bundle",
"value",
")",
"{",
"delegate",
".",
"putBundle",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a Bundle value into the mapping of the underlying Bundle, replacing any existing value
for the given key. Either key or value may be null.
@param key a String, or null
@param value a Bundle object, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"Bundle",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L127-L130 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, String value) {
delegate.putString(key, value);
return this;
} | java | public Bundler put(String key, String value) {
delegate.putString(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"delegate",
".",
"putString",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a String value into the mapping of the underlying Bundle, replacing any existing value
for the given key. Either key or value may be null.
@param key a String, or null
@param value a String, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"String",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L166-L169 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, String[] value) {
delegate.putStringArray(key, value);
return this;
} | java | public Bundler put(String key, String[] value) {
delegate.putStringArray(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"String",
"[",
"]",
"value",
")",
"{",
"delegate",
".",
"putStringArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a String array value into the mapping of the underlying Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value a String array object, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"String",
"array",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L179-L182 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, CharSequence value) {
delegate.putCharSequence(key, value);
return this;
} | java | public Bundler put(String key, CharSequence value) {
delegate.putCharSequence(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"CharSequence",
"value",
")",
"{",
"delegate",
".",
"putCharSequence",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a CharSequence value into the mapping of the underlying Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value a CharSequence, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"CharSequence",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L283-L286 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, CharSequence[] value) {
delegate.putCharSequenceArray(key, value);
return this;
} | java | public Bundler put(String key, CharSequence[] value) {
delegate.putCharSequenceArray(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"CharSequence",
"[",
"]",
"value",
")",
"{",
"delegate",
".",
"putCharSequenceArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a CharSequence array value into the mapping of the underlying Bundle, replacing any
existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a CharSequence array object, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"CharSequence",
"array",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L296-L299 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, Parcelable value) {
delegate.putParcelable(key, value);
return this;
} | java | public Bundler put(String key, Parcelable value) {
delegate.putParcelable(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"Parcelable",
"value",
")",
"{",
"delegate",
".",
"putParcelable",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a Parcelable value into the mapping of the underlying Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value a Parcelable object, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"Parcelable",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L348-L351 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, Parcelable[] value) {
delegate.putParcelableArray(key, value);
return this;
} | java | public Bundler put(String key, Parcelable[] value) {
delegate.putParcelableArray(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"Parcelable",
"[",
"]",
"value",
")",
"{",
"delegate",
".",
"putParcelableArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts an array of Parcelable values into the mapping of the underlying Bundle, replacing any
existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value an array of Parcelable objects, or null
@return this bundler instance to chain method calls | [
"Inserts",
"an",
"array",
"of",
"Parcelable",
"values",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L361-L364 | train |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, Serializable value) {
delegate.putSerializable(key, value);
return this;
} | java | public Bundler put(String key, Serializable value) {
delegate.putSerializable(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"Serializable",
"value",
")",
"{",
"delegate",
".",
"putSerializable",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a Serializable value into the mapping of the underlying Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value a Serializable object, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"Serializable",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | 7163b1b148e5141817975ae7dad99d58a8589aeb | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L426-L429 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java | HostName.validate | @Override
public void validate() throws HostNameException {
if(parsedHost != null) {
return;
}
if(validationException != null) {
throw validationException;
}
synchronized(this) {
if(parsedHost != null) {
return;
}
if(validationException != null) {
throw validationException;
}
try... | java | @Override
public void validate() throws HostNameException {
if(parsedHost != null) {
return;
}
if(validationException != null) {
throw validationException;
}
synchronized(this) {
if(parsedHost != null) {
return;
}
if(validationException != null) {
throw validationException;
}
try... | [
"@",
"Override",
"public",
"void",
"validate",
"(",
")",
"throws",
"HostNameException",
"{",
"if",
"(",
"parsedHost",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"validationException",
"!=",
"null",
")",
"{",
"throw",
"validationException",
";",
... | Validates that this string is a valid host name or IP address, and if not, throws an exception with a descriptive message indicating why it is not.
@throws HostNameException | [
"Validates",
"that",
"this",
"string",
"is",
"a",
"valid",
"host",
"name",
"or",
"IP",
"address",
"and",
"if",
"not",
"throws",
"an",
"exception",
"with",
"a",
"descriptive",
"message",
"indicating",
"why",
"it",
"is",
"not",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java#L227-L249 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java | HostName.isValid | public boolean isValid() {
if(parsedHost != null) {
return true;
}
if(validationException != null) {
return false;
}
try {
validate();
return true;
} catch(HostNameException e) {
return false;
}
} | java | public boolean isValid() {
if(parsedHost != null) {
return true;
}
if(validationException != null) {
return false;
}
try {
validate();
return true;
} catch(HostNameException e) {
return false;
}
} | [
"public",
"boolean",
"isValid",
"(",
")",
"{",
"if",
"(",
"parsedHost",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"validationException",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"validate",
"(",
")",
";",
... | Returns whether this represents a valid host name or address format.
@return | [
"Returns",
"whether",
"this",
"represents",
"a",
"valid",
"host",
"name",
"or",
"address",
"format",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java#L259-L272 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java | HostName.toNormalizedString | @Override
public String toNormalizedString() {
String result = normalizedString;
if(result == null) {
normalizedString = result = toNormalizedString(false);
}
return result;
} | java | @Override
public String toNormalizedString() {
String result = normalizedString;
if(result == null) {
normalizedString = result = toNormalizedString(false);
}
return result;
} | [
"@",
"Override",
"public",
"String",
"toNormalizedString",
"(",
")",
"{",
"String",
"result",
"=",
"normalizedString",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"normalizedString",
"=",
"result",
"=",
"toNormalizedString",
"(",
"false",
")",
";",
"}"... | Provides a normalized string which is lowercase for host strings, and which is a normalized string for addresses.
@return | [
"Provides",
"a",
"normalized",
"string",
"which",
"is",
"lowercase",
"for",
"host",
"strings",
"and",
"which",
"is",
"a",
"normalized",
"string",
"for",
"addresses",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java#L328-L335 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java | HostName.getNormalizedLabels | public String[] getNormalizedLabels() {
if(isValid()) {
return parsedHost.getNormalizedLabels();
}
if(host.length() == 0) {
return new String[0];
}
return new String[] {host};
} | java | public String[] getNormalizedLabels() {
if(isValid()) {
return parsedHost.getNormalizedLabels();
}
if(host.length() == 0) {
return new String[0];
}
return new String[] {host};
} | [
"public",
"String",
"[",
"]",
"getNormalizedLabels",
"(",
")",
"{",
"if",
"(",
"isValid",
"(",
")",
")",
"{",
"return",
"parsedHost",
".",
"getNormalizedLabels",
"(",
")",
";",
"}",
"if",
"(",
"host",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"... | Returns an array of normalized strings for this host name instance.
If this represents an IP address, the address segments are separated into the returned array.
If this represents a host name string, the domain name segments are separated into the returned array,
with the top-level domain name (right-most segment) as... | [
"Returns",
"an",
"array",
"of",
"normalized",
"strings",
"for",
"this",
"host",
"name",
"instance",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java#L459-L467 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java | HostName.matches | public boolean matches(HostName host) {
if(this == host) {
return true;
}
if(isValid()) {
if(host.isValid()) {
if(isAddressString()) {
return host.isAddressString()
&& asAddressString().equals(host.asAddressString())
&& Objects.equals(getPort(), host.getPort())
&& Objects.equal... | java | public boolean matches(HostName host) {
if(this == host) {
return true;
}
if(isValid()) {
if(host.isValid()) {
if(isAddressString()) {
return host.isAddressString()
&& asAddressString().equals(host.asAddressString())
&& Objects.equals(getPort(), host.getPort())
&& Objects.equal... | [
"public",
"boolean",
"matches",
"(",
"HostName",
"host",
")",
"{",
"if",
"(",
"this",
"==",
"host",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"isValid",
"(",
")",
")",
"{",
"if",
"(",
"host",
".",
"isValid",
"(",
")",
")",
"{",
"if",
"("... | Returns whether the given host matches this one. For hosts to match, they must represent the same addresses or have the same host names.
Hosts are not resolved when matching. Also, hosts must have the same port and service. They must have the same masks if they are host names.
Even if two hosts are invalid, they mat... | [
"Returns",
"whether",
"the",
"given",
"host",
"matches",
"this",
"one",
".",
"For",
"hosts",
"to",
"match",
"they",
"must",
"represent",
"the",
"same",
"addresses",
"or",
"have",
"the",
"same",
"host",
"names",
".",
"Hosts",
"are",
"not",
"resolved",
"when... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java#L495-L523 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java | HostName.toAddress | @Override
public IPAddress toAddress() throws UnknownHostException, HostNameException {
IPAddress addr = resolvedAddress;
if(addr == null && !resolvedIsNull) {
//note that validation handles empty address resolution
validate();
synchronized(this) {
addr = resolvedAddress;
if(addr == null && !resol... | java | @Override
public IPAddress toAddress() throws UnknownHostException, HostNameException {
IPAddress addr = resolvedAddress;
if(addr == null && !resolvedIsNull) {
//note that validation handles empty address resolution
validate();
synchronized(this) {
addr = resolvedAddress;
if(addr == null && !resol... | [
"@",
"Override",
"public",
"IPAddress",
"toAddress",
"(",
")",
"throws",
"UnknownHostException",
",",
"HostNameException",
"{",
"IPAddress",
"addr",
"=",
"resolvedAddress",
";",
"if",
"(",
"addr",
"==",
"null",
"&&",
"!",
"resolvedIsNull",
")",
"{",
"//note that... | If this represents an ip address, returns that address.
If this represents a host, returns the resolved ip address of that host.
Otherwise, returns null, but only for strings that are considered valid address strings but cannot be converted to address objects.
This method will throw exceptions for invalid formats and ... | [
"If",
"this",
"represents",
"an",
"ip",
"address",
"returns",
"that",
"address",
".",
"If",
"this",
"represents",
"a",
"host",
"returns",
"the",
"resolved",
"ip",
"address",
"of",
"that",
"host",
".",
"Otherwise",
"returns",
"null",
"but",
"only",
"for",
"... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/HostName.java#L867-L918 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java | MACAddressSection.iterator | protected Iterator<MACAddress> iterator(MACAddress original) {
MACAddressCreator creator = getAddressCreator();
boolean isSingle = !isMultiple();
return iterator(
isSingle ? original : null,
creator,//using a lambda for this one results in a big performance hit
isSingle ? null : segmentsIterato... | java | protected Iterator<MACAddress> iterator(MACAddress original) {
MACAddressCreator creator = getAddressCreator();
boolean isSingle = !isMultiple();
return iterator(
isSingle ? original : null,
creator,//using a lambda for this one results in a big performance hit
isSingle ? null : segmentsIterato... | [
"protected",
"Iterator",
"<",
"MACAddress",
">",
"iterator",
"(",
"MACAddress",
"original",
")",
"{",
"MACAddressCreator",
"creator",
"=",
"getAddressCreator",
"(",
")",
";",
"boolean",
"isSingle",
"=",
"!",
"isMultiple",
"(",
")",
";",
"return",
"iterator",
"... | these are the iterators used by MACAddress | [
"these",
"are",
"the",
"iterators",
"used",
"by",
"MACAddress"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java#L1204-L1212 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java | MACAddressSection.toHexString | @Override
public String toHexString(boolean with0xPrefix) {
String result;
if(hasNoStringCache() || (result = (with0xPrefix ? stringCache.hexStringPrefixed : stringCache.hexString)) == null) {
result = toHexString(with0xPrefix, null);
if(with0xPrefix) {
stringCache.hexStringPrefixed = result;
... | java | @Override
public String toHexString(boolean with0xPrefix) {
String result;
if(hasNoStringCache() || (result = (with0xPrefix ? stringCache.hexStringPrefixed : stringCache.hexString)) == null) {
result = toHexString(with0xPrefix, null);
if(with0xPrefix) {
stringCache.hexStringPrefixed = result;
... | [
"@",
"Override",
"public",
"String",
"toHexString",
"(",
"boolean",
"with0xPrefix",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"(",
"with0xPrefix",
"?",
"stringCache",
".",
"hexStringPrefixed",
":",
... | Writes this address as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix. | [
"Writes",
"this",
"address",
"as",
"a",
"single",
"hexadecimal",
"value",
"with",
"always",
"the",
"exact",
"same",
"number",
"of",
"characters",
"with",
"or",
"without",
"a",
"preceding",
"0x",
"prefix",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java#L1323-L1335 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java | MACAddressSection.toCompressedString | @Override
public String toCompressedString() {
String result;
if(hasNoStringCache() || (result = getStringCache().compressedString) == null) {
getStringCache().compressedString = result = toNormalizedString(MACStringCache.compressedParams);
}
return result;
} | java | @Override
public String toCompressedString() {
String result;
if(hasNoStringCache() || (result = getStringCache().compressedString) == null) {
getStringCache().compressedString = result = toNormalizedString(MACStringCache.compressedParams);
}
return result;
} | [
"@",
"Override",
"public",
"String",
"toCompressedString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"getStringCache",
"(",
")",
".",
"compressedString",
")",
"==",
"null",
")",
"{",
"getStri... | This produces a shorter string for the address that uses the canonical representation but not using leading zeroes.
Each address has a unique compressed string. | [
"This",
"produces",
"a",
"shorter",
"string",
"for",
"the",
"address",
"that",
"uses",
"the",
"canonical",
"representation",
"but",
"not",
"using",
"leading",
"zeroes",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java#L1382-L1389 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java | MACAddressSection.toDottedString | public String toDottedString() {
String result = null;
if(hasNoStringCache() || (result = getStringCache().dottedString) == null) {
AddressDivisionGrouping dottedGrouping = getDottedGrouping();
getStringCache().dottedString = result = toNormalizedString(MACStringCache.dottedParams, dottedGrouping);
}
... | java | public String toDottedString() {
String result = null;
if(hasNoStringCache() || (result = getStringCache().dottedString) == null) {
AddressDivisionGrouping dottedGrouping = getDottedGrouping();
getStringCache().dottedString = result = toNormalizedString(MACStringCache.dottedParams, dottedGrouping);
}
... | [
"public",
"String",
"toDottedString",
"(",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"getStringCache",
"(",
")",
".",
"dottedString",
")",
"==",
"null",
")",
"{",
"AddressDivisionGrou... | This produces the dotted hexadecimal format aaaa.bbbb.cccc | [
"This",
"produces",
"the",
"dotted",
"hexadecimal",
"format",
"aaaa",
".",
"bbbb",
".",
"cccc"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddressSection.java#L1394-L1401 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSegment.java | IPv6AddressSegment.getSplitSegments | public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) {
if(!isMultiple()) {
int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1;
Integer myPrefix = getSegmentPrefixLength();
Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0... | java | public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) {
if(!isMultiple()) {
int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1;
Integer myPrefix = getSegmentPrefixLength();
Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0... | [
"public",
"<",
"S",
"extends",
"AddressSegment",
">",
"void",
"getSplitSegments",
"(",
"S",
"segs",
"[",
"]",
",",
"int",
"index",
",",
"AddressSegmentCreator",
"<",
"S",
">",
"creator",
")",
"{",
"if",
"(",
"!",
"isMultiple",
"(",
")",
")",
"{",
"int"... | Converts this IPv6 address segment into smaller segments,
copying them into the given array starting at the given index.
If a segment does not fit into the array because the segment index in the array is out of bounds of the array,
then it is not copied.
@param segs
@param index | [
"Converts",
"this",
"IPv6",
"address",
"segment",
"into",
"smaller",
"segments",
"copying",
"them",
"into",
"the",
"given",
"array",
"starting",
"at",
"the",
"given",
"index",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSegment.java#L302-L317 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java | AddressDivisionGrouping.containsPrefixBlock | @Override
public boolean containsPrefixBlock(int prefixLength) {
checkSubnet(this, prefixLength);
int divisionCount = getDivisionCount();
int prevBitCount = 0;
for(int i = 0; i < divisionCount; i++) {
AddressDivision division = getDivision(i);
int bitCount = division.getBitCount();
int totalBitCount =... | java | @Override
public boolean containsPrefixBlock(int prefixLength) {
checkSubnet(this, prefixLength);
int divisionCount = getDivisionCount();
int prevBitCount = 0;
for(int i = 0; i < divisionCount; i++) {
AddressDivision division = getDivision(i);
int bitCount = division.getBitCount();
int totalBitCount =... | [
"@",
"Override",
"public",
"boolean",
"containsPrefixBlock",
"(",
"int",
"prefixLength",
")",
"{",
"checkSubnet",
"(",
"this",
",",
"prefixLength",
")",
";",
"int",
"divisionCount",
"=",
"getDivisionCount",
"(",
")",
";",
"int",
"prevBitCount",
"=",
"0",
";",
... | Returns whether the values of this division grouping contain the prefix block for the given prefix length
@param prefixLength
@return | [
"Returns",
"whether",
"the",
"values",
"of",
"this",
"division",
"grouping",
"contain",
"the",
"prefix",
"block",
"for",
"the",
"given",
"prefix",
"length"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java#L136-L161 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java | AddressDivisionGrouping.normalizePrefixBoundary | protected static <S extends IPAddressSegment> void normalizePrefixBoundary(
int sectionPrefixBits,
S segments[],
int segmentBitCount,
int segmentByteCount,
BiFunction<S, Integer, S> segProducer) {
//we've already verified segment prefixes in super constructor. We simply need to check the case where th... | java | protected static <S extends IPAddressSegment> void normalizePrefixBoundary(
int sectionPrefixBits,
S segments[],
int segmentBitCount,
int segmentByteCount,
BiFunction<S, Integer, S> segProducer) {
//we've already verified segment prefixes in super constructor. We simply need to check the case where th... | [
"protected",
"static",
"<",
"S",
"extends",
"IPAddressSegment",
">",
"void",
"normalizePrefixBoundary",
"(",
"int",
"sectionPrefixBits",
",",
"S",
"segments",
"[",
"]",
",",
"int",
"segmentBitCount",
",",
"int",
"segmentByteCount",
",",
"BiFunction",
"<",
"S",
"... | In the case where the prefix sits at a segment boundary, and the prefix sequence is null - null - 0, this changes to prefix sequence of null - x - 0, where x is segment bit length.
Note: We allow both [null, null, 0] and [null, x, 0] where x is segment length. However, to avoid inconsistencies when doing segment repl... | [
"In",
"the",
"case",
"where",
"the",
"prefix",
"sits",
"at",
"a",
"segment",
"boundary",
"and",
"the",
"prefix",
"sequence",
"is",
"null",
"-",
"null",
"-",
"0",
"this",
"changes",
"to",
"prefix",
"sequence",
"of",
"null",
"-",
"x",
"-",
"0",
"where",
... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java#L335-L350 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java | AddressDivisionGrouping.fastIncrement | protected static <R extends AddressSection, S extends AddressSegment> R fastIncrement(
R section,
long increment,
AddressCreator<?, R, ?, S> addrCreator,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(increment >= 0) {
BigInteger count = section.getCount();
i... | java | protected static <R extends AddressSection, S extends AddressSegment> R fastIncrement(
R section,
long increment,
AddressCreator<?, R, ?, S> addrCreator,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(increment >= 0) {
BigInteger count = section.getCount();
i... | [
"protected",
"static",
"<",
"R",
"extends",
"AddressSection",
",",
"S",
"extends",
"AddressSegment",
">",
"R",
"fastIncrement",
"(",
"R",
"section",
",",
"long",
"increment",
",",
"AddressCreator",
"<",
"?",
",",
"R",
",",
"?",
",",
"S",
">",
"addrCreator"... | Handles the cases in which we can use longs rather than BigInteger
@param section
@param increment
@param addrCreator
@param lowerProducer
@param upperProducer
@param prefixLength
@return | [
"Handles",
"the",
"cases",
"in",
"which",
"we",
"can",
"use",
"longs",
"rather",
"than",
"BigInteger"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java#L1090-L1129 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/util/sql/SQLStringMatcher.java | SQLStringMatcher.getSQLCondition | public StringBuilder getSQLCondition(StringBuilder builder, String columnName) {
String string = networkString.getString();
if(isEntireAddress) {
matchString(builder, columnName, string);
} else {
matchSubString(
builder,
columnName,
networkString.getTrailingSegmentSeparator(),
networkSt... | java | public StringBuilder getSQLCondition(StringBuilder builder, String columnName) {
String string = networkString.getString();
if(isEntireAddress) {
matchString(builder, columnName, string);
} else {
matchSubString(
builder,
columnName,
networkString.getTrailingSegmentSeparator(),
networkSt... | [
"public",
"StringBuilder",
"getSQLCondition",
"(",
"StringBuilder",
"builder",
",",
"String",
"columnName",
")",
"{",
"String",
"string",
"=",
"networkString",
".",
"getString",
"(",
")",
";",
"if",
"(",
"isEntireAddress",
")",
"{",
"matchString",
"(",
"builder"... | Get an SQL condition to match this address section representation
@param builder
@param columnName
@return the condition | [
"Get",
"an",
"SQL",
"condition",
"to",
"match",
"this",
"address",
"section",
"representation"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/util/sql/SQLStringMatcher.java#L53-L66 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionBase.java | AddressDivisionBase.getRadixPower | protected static BigInteger getRadixPower(BigInteger radix, int power) {
long key = (((long) radix.intValue()) << 32) | power;
BigInteger result = radixPowerMap.get(key);
if(result == null) {
if(power == 1) {
result = radix;
} else if((power & 1) == 0) {
BigInteger halfPower = getRadixPower(radix, p... | java | protected static BigInteger getRadixPower(BigInteger radix, int power) {
long key = (((long) radix.intValue()) << 32) | power;
BigInteger result = radixPowerMap.get(key);
if(result == null) {
if(power == 1) {
result = radix;
} else if((power & 1) == 0) {
BigInteger halfPower = getRadixPower(radix, p... | [
"protected",
"static",
"BigInteger",
"getRadixPower",
"(",
"BigInteger",
"radix",
",",
"int",
"power",
")",
"{",
"long",
"key",
"=",
"(",
"(",
"(",
"long",
")",
"radix",
".",
"intValue",
"(",
")",
")",
"<<",
"32",
")",
"|",
"power",
";",
"BigInteger",
... | Caches the results of radix to the given power.
@param radix
@param power
@return | [
"Caches",
"the",
"results",
"of",
"radix",
"to",
"the",
"given",
"power",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionBase.java#L351-L367 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java | AddressDivisionGroupingBase.getBytesInternal | protected byte[] getBytesInternal() {
byte cached[];
if(hasNoValueCache() || (cached = valueCache.lowerBytes) == null) {
valueCache.lowerBytes = cached = getBytesImpl(true);
}
return cached;
} | java | protected byte[] getBytesInternal() {
byte cached[];
if(hasNoValueCache() || (cached = valueCache.lowerBytes) == null) {
valueCache.lowerBytes = cached = getBytesImpl(true);
}
return cached;
} | [
"protected",
"byte",
"[",
"]",
"getBytesInternal",
"(",
")",
"{",
"byte",
"cached",
"[",
"]",
";",
"if",
"(",
"hasNoValueCache",
"(",
")",
"||",
"(",
"cached",
"=",
"valueCache",
".",
"lowerBytes",
")",
"==",
"null",
")",
"{",
"valueCache",
".",
"lower... | gets the bytes, sharing the cached array and does not clone it | [
"gets",
"the",
"bytes",
"sharing",
"the",
"cached",
"array",
"and",
"does",
"not",
"clone",
"it"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java#L136-L142 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java | AddressDivisionGroupingBase.getUpperBytesInternal | protected byte[] getUpperBytesInternal() {
byte cached[];
if(hasNoValueCache()) {
ValueCache cache = valueCache;
cache.upperBytes = cached = getBytesImpl(false);
if(!isMultiple()) {
cache.lowerBytes = cached;
}
} else {
ValueCache cache = valueCache;
if((cached = cache.upperBytes) == null) {... | java | protected byte[] getUpperBytesInternal() {
byte cached[];
if(hasNoValueCache()) {
ValueCache cache = valueCache;
cache.upperBytes = cached = getBytesImpl(false);
if(!isMultiple()) {
cache.lowerBytes = cached;
}
} else {
ValueCache cache = valueCache;
if((cached = cache.upperBytes) == null) {... | [
"protected",
"byte",
"[",
"]",
"getUpperBytesInternal",
"(",
")",
"{",
"byte",
"cached",
"[",
"]",
";",
"if",
"(",
"hasNoValueCache",
"(",
")",
")",
"{",
"ValueCache",
"cache",
"=",
"valueCache",
";",
"cache",
".",
"upperBytes",
"=",
"cached",
"=",
"getB... | Gets the bytes for the highest address in the range represented by this address.
@return | [
"Gets",
"the",
"bytes",
"for",
"the",
"highest",
"address",
"in",
"the",
"range",
"represented",
"by",
"this",
"address",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java#L203-L226 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java | AddressDivisionGroupingBase.getMinPrefixLengthForBlock | @Override
public int getMinPrefixLengthForBlock() {
int count = getDivisionCount();
int totalPrefix = getBitCount();
for(int i = count - 1; i >= 0 ; i--) {
AddressDivisionBase div = getDivision(i);
int segBitCount = div.getBitCount();
int segPrefix = div.getMinPrefixLengthForBlock();
if(segPrefix == ... | java | @Override
public int getMinPrefixLengthForBlock() {
int count = getDivisionCount();
int totalPrefix = getBitCount();
for(int i = count - 1; i >= 0 ; i--) {
AddressDivisionBase div = getDivision(i);
int segBitCount = div.getBitCount();
int segPrefix = div.getMinPrefixLengthForBlock();
if(segPrefix == ... | [
"@",
"Override",
"public",
"int",
"getMinPrefixLengthForBlock",
"(",
")",
"{",
"int",
"count",
"=",
"getDivisionCount",
"(",
")",
";",
"int",
"totalPrefix",
"=",
"getBitCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"count",
"-",
"1",
";",
"i",
">... | Returns the smallest prefix length possible such that this address division grouping includes the block of addresses for that prefix.
@return the prefix length | [
"Returns",
"the",
"smallest",
"prefix",
"length",
"possible",
"such",
"that",
"this",
"address",
"division",
"grouping",
"includes",
"the",
"block",
"of",
"addresses",
"for",
"that",
"prefix",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java#L347-L366 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java | AddressDivisionGroupingBase.getPrefixLengthForSingleBlock | @Override
public Integer getPrefixLengthForSingleBlock() {
int count = getDivisionCount();
int totalPrefix = 0;
for(int i = 0; i < count; i++) {
AddressDivisionBase div = getDivision(i);
Integer divPrefix = div.getPrefixLengthForSingleBlock();
if(divPrefix == null) {
return null;
}
totalPrefix... | java | @Override
public Integer getPrefixLengthForSingleBlock() {
int count = getDivisionCount();
int totalPrefix = 0;
for(int i = 0; i < count; i++) {
AddressDivisionBase div = getDivision(i);
Integer divPrefix = div.getPrefixLengthForSingleBlock();
if(divPrefix == null) {
return null;
}
totalPrefix... | [
"@",
"Override",
"public",
"Integer",
"getPrefixLengthForSingleBlock",
"(",
")",
"{",
"int",
"count",
"=",
"getDivisionCount",
"(",
")",
";",
"int",
"totalPrefix",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",... | Returns a prefix length for which the range of this segment grouping matches the the block of addresses for that prefix.
If no such prefix exists, returns null
If this segment grouping represents a single value, returns the bit length
@return the prefix length or null | [
"Returns",
"a",
"prefix",
"length",
"for",
"which",
"the",
"range",
"of",
"this",
"segment",
"grouping",
"matches",
"the",
"the",
"block",
"of",
"addresses",
"for",
"that",
"prefix",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java#L377-L399 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java | AddressDivisionGroupingBase.getCount | @Override
public BigInteger getCount() {
BigInteger cached = cachedCount;
if(cached == null) {
cachedCount = cached = getCountImpl();
}
return cached;
} | java | @Override
public BigInteger getCount() {
BigInteger cached = cachedCount;
if(cached == null) {
cachedCount = cached = getCountImpl();
}
return cached;
} | [
"@",
"Override",
"public",
"BigInteger",
"getCount",
"(",
")",
"{",
"BigInteger",
"cached",
"=",
"cachedCount",
";",
"if",
"(",
"cached",
"==",
"null",
")",
"{",
"cachedCount",
"=",
"cached",
"=",
"getCountImpl",
"(",
")",
";",
"}",
"return",
"cached",
"... | gets the count of addresses that this address division grouping may represent
If this address division grouping is not a subnet block of multiple addresses or has no range of values, then there is only one such address.
@return | [
"gets",
"the",
"count",
"of",
"addresses",
"that",
"this",
"address",
"division",
"grouping",
"may",
"represent"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/AddressDivisionGroupingBase.java#L442-L449 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java | Validator.validateZone | public static int validateZone(CharSequence zone) {
for(int i = 0; i < zone.length(); i++) {
char c = zone.charAt(i);
if (c == IPAddress.PREFIX_LEN_SEPARATOR) {
return i;
}
if (c == IPv6Address.SEGMENT_SEPARATOR) {
return i;
}
}
return -1;
} | java | public static int validateZone(CharSequence zone) {
for(int i = 0; i < zone.length(); i++) {
char c = zone.charAt(i);
if (c == IPAddress.PREFIX_LEN_SEPARATOR) {
return i;
}
if (c == IPv6Address.SEGMENT_SEPARATOR) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"validateZone",
"(",
"CharSequence",
"zone",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"zone",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"zone",
".",
"charAt",
"(",
"i",
")"... | Returns the index of the first invalid character of the zone, or -1 if the zone is valid
@param sequence
@return | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"invalid",
"character",
"of",
"the",
"zone",
"or",
"-",
"1",
"if",
"the",
"zone",
"is",
"valid"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java#L1988-L1999 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java | Validator.switchValue8 | private static long switchValue8(long currentHexValue, int digitCount) {
long result = 0x7 & currentHexValue;
int shift = 0;
while(--digitCount > 0) {
shift += 3;
currentHexValue >>>= 4;
result |= (0x7 & currentHexValue) << shift;
}
return result;
} | java | private static long switchValue8(long currentHexValue, int digitCount) {
long result = 0x7 & currentHexValue;
int shift = 0;
while(--digitCount > 0) {
shift += 3;
currentHexValue >>>= 4;
result |= (0x7 & currentHexValue) << shift;
}
return result;
} | [
"private",
"static",
"long",
"switchValue8",
"(",
"long",
"currentHexValue",
",",
"int",
"digitCount",
")",
"{",
"long",
"result",
"=",
"0x7",
"&",
"currentHexValue",
";",
"int",
"shift",
"=",
"0",
";",
"while",
"(",
"--",
"digitCount",
">",
"0",
")",
"{... | The digits were stored as a hex value, thix switches them to an octal value.
@param currentHexValue
@param digitCount
@return | [
"The",
"digits",
"were",
"stored",
"as",
"a",
"hex",
"value",
"thix",
"switches",
"them",
"to",
"an",
"octal",
"value",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java#L2312-L2321 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java | Validator.validateHostImpl | static ParsedHost validateHostImpl(HostName fromHost) throws HostNameException {
final String str = fromHost.toString();
HostNameParameters validationOptions = fromHost.getValidationOptions();
return validateHost(fromHost, str, validationOptions);
} | java | static ParsedHost validateHostImpl(HostName fromHost) throws HostNameException {
final String str = fromHost.toString();
HostNameParameters validationOptions = fromHost.getValidationOptions();
return validateHost(fromHost, str, validationOptions);
} | [
"static",
"ParsedHost",
"validateHostImpl",
"(",
"HostName",
"fromHost",
")",
"throws",
"HostNameException",
"{",
"final",
"String",
"str",
"=",
"fromHost",
".",
"toString",
"(",
")",
";",
"HostNameParameters",
"validationOptions",
"=",
"fromHost",
".",
"getValidati... | So we will follow rfc 1035 and in addition allow the underscore. | [
"So",
"we",
"will",
"follow",
"rfc",
"1035",
"and",
"in",
"addition",
"allow",
"the",
"underscore",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java#L2426-L2430 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java | Validator.convertReverseDNSIPv4 | private static CharSequence convertReverseDNSIPv4(String str, int suffixStartIndex) throws AddressStringException {
StringBuilder builder = new StringBuilder(suffixStartIndex);
int segCount = 0;
int j = suffixStartIndex;
for(int i = suffixStartIndex - 1; i > 0; i--) {
char c1 = str.charAt(i);
if(c1 == IPv... | java | private static CharSequence convertReverseDNSIPv4(String str, int suffixStartIndex) throws AddressStringException {
StringBuilder builder = new StringBuilder(suffixStartIndex);
int segCount = 0;
int j = suffixStartIndex;
for(int i = suffixStartIndex - 1; i > 0; i--) {
char c1 = str.charAt(i);
if(c1 == IPv... | [
"private",
"static",
"CharSequence",
"convertReverseDNSIPv4",
"(",
"String",
"str",
",",
"int",
"suffixStartIndex",
")",
"throws",
"AddressStringException",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"suffixStartIndex",
")",
";",
"int",
"segCou... | 123.2.3.4 is 4.3.2.123.in-addr.arpa. | [
"123",
".",
"2",
".",
"3",
".",
"4",
"is",
"4",
".",
"3",
".",
"2",
".",
"123",
".",
"in",
"-",
"addr",
".",
"arpa",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java#L3062-L3087 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java | AddressDivision.isPrefixBlock | protected boolean isPrefixBlock(long divisionValue, long upperValue, int divisionPrefixLen) {
if(divisionPrefixLen == 0) {
return divisionValue == 0 && upperValue == getMaxValue();
}
long ones = ~0L;
long divisionBitMask = ~(ones << getBitCount());
long divisionPrefixMask = ones << (getBitCount() - divisio... | java | protected boolean isPrefixBlock(long divisionValue, long upperValue, int divisionPrefixLen) {
if(divisionPrefixLen == 0) {
return divisionValue == 0 && upperValue == getMaxValue();
}
long ones = ~0L;
long divisionBitMask = ~(ones << getBitCount());
long divisionPrefixMask = ones << (getBitCount() - divisio... | [
"protected",
"boolean",
"isPrefixBlock",
"(",
"long",
"divisionValue",
",",
"long",
"upperValue",
",",
"int",
"divisionPrefixLen",
")",
"{",
"if",
"(",
"divisionPrefixLen",
"==",
"0",
")",
"{",
"return",
"divisionValue",
"==",
"0",
"&&",
"upperValue",
"==",
"g... | Returns whether the division range includes the block of values for its prefix length | [
"Returns",
"whether",
"the",
"division",
"range",
"includes",
"the",
"block",
"of",
"values",
"for",
"its",
"prefix",
"length"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java#L196-L209 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java | AddressDivision.matchesWithMask | public boolean matchesWithMask(long lowerValue, long upperValue, long mask) {
if(lowerValue == upperValue) {
return matchesWithMask(lowerValue, mask);
}
if(!isMultiple()) {
//we know lowerValue and upperValue are not the same, so impossible to match those two values with a single value
return false;
}
... | java | public boolean matchesWithMask(long lowerValue, long upperValue, long mask) {
if(lowerValue == upperValue) {
return matchesWithMask(lowerValue, mask);
}
if(!isMultiple()) {
//we know lowerValue and upperValue are not the same, so impossible to match those two values with a single value
return false;
}
... | [
"public",
"boolean",
"matchesWithMask",
"(",
"long",
"lowerValue",
",",
"long",
"upperValue",
",",
"long",
"mask",
")",
"{",
"if",
"(",
"lowerValue",
"==",
"upperValue",
")",
"{",
"return",
"matchesWithMask",
"(",
"lowerValue",
",",
"mask",
")",
";",
"}",
... | returns whether masking with the given mask results in a valid contiguous range for this segment,
and if it does, if it matches the range obtained when masking the given values with the same mask.
@param lowerValue
@param upperValue
@param mask
@return | [
"returns",
"whether",
"masking",
"with",
"the",
"given",
"mask",
"results",
"in",
"a",
"valid",
"contiguous",
"range",
"for",
"this",
"segment",
"and",
"if",
"it",
"does",
"if",
"it",
"matches",
"the",
"range",
"obtained",
"when",
"masking",
"the",
"given",
... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java#L266-L280 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java | AddressDivision.isMaskCompatibleWithRange | protected static boolean isMaskCompatibleWithRange(long value, long upperValue, long maskValue, long maxValue) {
if(value == upperValue || maskValue == maxValue || maskValue == 0) {
return true;
}
//algorithm:
//here we find the highest bit that is part of the range, highestDifferingBitInRange (ie changes f... | java | protected static boolean isMaskCompatibleWithRange(long value, long upperValue, long maskValue, long maxValue) {
if(value == upperValue || maskValue == maxValue || maskValue == 0) {
return true;
}
//algorithm:
//here we find the highest bit that is part of the range, highestDifferingBitInRange (ie changes f... | [
"protected",
"static",
"boolean",
"isMaskCompatibleWithRange",
"(",
"long",
"value",
",",
"long",
"upperValue",
",",
"long",
"maskValue",
",",
"long",
"maxValue",
")",
"{",
"if",
"(",
"value",
"==",
"upperValue",
"||",
"maskValue",
"==",
"maxValue",
"||",
"mas... | when divisionPrefixLen is null, isAutoSubnets has no effect | [
"when",
"divisionPrefixLen",
"is",
"null",
"isAutoSubnets",
"has",
"no",
"effect"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java#L309-L355 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.isEUI64 | public boolean isEUI64(boolean partial) {
int segmentCount = getSegmentCount();
int endIndex = addressSegmentIndex + segmentCount;
if(addressSegmentIndex <= 5) {
if(endIndex > 6) {
int index3 = 5 - addressSegmentIndex;
IPv6AddressSegment seg3 = getSegment(index3);
IPv6AddressSegment seg4 = getSegme... | java | public boolean isEUI64(boolean partial) {
int segmentCount = getSegmentCount();
int endIndex = addressSegmentIndex + segmentCount;
if(addressSegmentIndex <= 5) {
if(endIndex > 6) {
int index3 = 5 - addressSegmentIndex;
IPv6AddressSegment seg3 = getSegment(index3);
IPv6AddressSegment seg4 = getSegme... | [
"public",
"boolean",
"isEUI64",
"(",
"boolean",
"partial",
")",
"{",
"int",
"segmentCount",
"=",
"getSegmentCount",
"(",
")",
";",
"int",
"endIndex",
"=",
"addressSegmentIndex",
"+",
"segmentCount",
";",
"if",
"(",
"addressSegmentIndex",
"<=",
"5",
")",
"{",
... | Whether this section is consistent with an EUI64 section,
which means it came from an extended 8 byte address,
and the corresponding segments in the middle match 0xff and 0xfe
@param partial whether missing segments are considered a match
@return | [
"Whether",
"this",
"section",
"is",
"consistent",
"with",
"an",
"EUI64",
"section",
"which",
"means",
"it",
"came",
"from",
"an",
"extended",
"8",
"byte",
"address",
"and",
"the",
"corresponding",
"segments",
"in",
"the",
"middle",
"match",
"0xff",
"and",
"0... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1133-L1151 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.toEUI | public MACAddressSection toEUI(boolean extended) {
MACAddressSegment[] segs = toEUISegments(extended);
if(segs == null) {
return null;
}
MACAddressCreator creator = getMACNetwork().getAddressCreator();
return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended);
} | java | public MACAddressSection toEUI(boolean extended) {
MACAddressSegment[] segs = toEUISegments(extended);
if(segs == null) {
return null;
}
MACAddressCreator creator = getMACNetwork().getAddressCreator();
return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended);
} | [
"public",
"MACAddressSection",
"toEUI",
"(",
"boolean",
"extended",
")",
"{",
"MACAddressSegment",
"[",
"]",
"segs",
"=",
"toEUISegments",
"(",
"extended",
")",
";",
"if",
"(",
"segs",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"MACAddressCreator",
... | Returns the corresponding mac section, or null if this address section does not correspond to a mac section.
If this address section has a prefix length it is ignored.
@param extended
@return | [
"Returns",
"the",
"corresponding",
"mac",
"section",
"or",
"null",
"if",
"this",
"address",
"section",
"does",
"not",
"correspond",
"to",
"a",
"mac",
"section",
".",
"If",
"this",
"address",
"section",
"has",
"a",
"prefix",
"length",
"it",
"is",
"ignored",
... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1160-L1167 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.toEUISegments | MACAddressSegment[] toEUISegments(boolean extended) {
IPv6AddressSegment seg0, seg1, seg2, seg3;
int start = addressSegmentIndex;
int segmentCount = getSegmentCount();
int segmentIndex;
if(start < 4) {
start = 0;
segmentIndex = 4 - start;
} else {
start -= 4;
segmentIndex = 0;
}
int original... | java | MACAddressSegment[] toEUISegments(boolean extended) {
IPv6AddressSegment seg0, seg1, seg2, seg3;
int start = addressSegmentIndex;
int segmentCount = getSegmentCount();
int segmentIndex;
if(start < 4) {
start = 0;
segmentIndex = 4 - start;
} else {
start -= 4;
segmentIndex = 0;
}
int original... | [
"MACAddressSegment",
"[",
"]",
"toEUISegments",
"(",
"boolean",
"extended",
")",
"{",
"IPv6AddressSegment",
"seg0",
",",
"seg1",
",",
"seg2",
",",
"seg3",
";",
"int",
"start",
"=",
"addressSegmentIndex",
";",
"int",
"segmentCount",
"=",
"getSegmentCount",
"(",
... | prefix length in this section is ignored when converting to MAC | [
"prefix",
"length",
"in",
"this",
"section",
"is",
"ignored",
"when",
"converting",
"to",
"MAC"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1174-L1245 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.getEmbeddedIPv4AddressSection | public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex) {
if(startIndex == ((IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - this.addressSegmentIndex) << 1) && endIndex == (getSegmentCount() << 1)) {
return getEmbeddedIPv4AddressSection();
}
IPv4AddressCreator creator = getIPv4Network(... | java | public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex) {
if(startIndex == ((IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - this.addressSegmentIndex) << 1) && endIndex == (getSegmentCount() << 1)) {
return getEmbeddedIPv4AddressSection();
}
IPv4AddressCreator creator = getIPv4Network(... | [
"public",
"IPv4AddressSection",
"getEmbeddedIPv4AddressSection",
"(",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"startIndex",
"==",
"(",
"(",
"IPv6Address",
".",
"MIXED_ORIGINAL_SEGMENT_COUNT",
"-",
"this",
".",
"addressSegmentIndex",
")",
"<... | Produces an IPv4 address section from any sequence of bytes in this IPv6 address section
@param startIndex the byte index in this section to start from
@param endIndex the byte index in this section to end at
@throws IndexOutOfBoundsException
@return
@see #getEmbeddedIPv4AddressSection()
@see #getMixedAddressSection(... | [
"Produces",
"an",
"IPv4",
"address",
"section",
"from",
"any",
"sequence",
"of",
"bytes",
"in",
"this",
"IPv6",
"address",
"section"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1258-L1276 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.hasUppercaseVariations | public boolean hasUppercaseVariations(int base, boolean lowerOnly) {
if(base > 10) {
int count = getSegmentCount();
for(int i = 0; i < count; i++) {
IPv6AddressSegment seg = getSegment(i);
if(seg.hasUppercaseVariations(base, lowerOnly)) {
return true;
}
}
}
return false;
} | java | public boolean hasUppercaseVariations(int base, boolean lowerOnly) {
if(base > 10) {
int count = getSegmentCount();
for(int i = 0; i < count; i++) {
IPv6AddressSegment seg = getSegment(i);
if(seg.hasUppercaseVariations(base, lowerOnly)) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"hasUppercaseVariations",
"(",
"int",
"base",
",",
"boolean",
"lowerOnly",
")",
"{",
"if",
"(",
"base",
">",
"10",
")",
"{",
"int",
"count",
"=",
"getSegmentCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Returns whether this subnet or address has alphabetic digits when printed.
Note that this method does not indicate whether any address contained within this subnet has alphabetic digits,
only whether the subnet itself when printed has alphabetic digits.
@return whether the section has alphabetic digits when printed. | [
"Returns",
"whether",
"this",
"subnet",
"or",
"address",
"has",
"alphabetic",
"digits",
"when",
"printed",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1410-L1421 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.mergeToSequentialBlocks | public IPv6AddressSection[] mergeToSequentialBlocks(IPv6AddressSection ...sections) throws SizeMismatchException {
List<IPAddressSegmentSeries> blocks = getMergedSequentialBlocks(this, sections, true, createSeriesCreator(getAddressCreator(), getMaxSegmentValue()));
return blocks.toArray(new IPv6AddressSection[block... | java | public IPv6AddressSection[] mergeToSequentialBlocks(IPv6AddressSection ...sections) throws SizeMismatchException {
List<IPAddressSegmentSeries> blocks = getMergedSequentialBlocks(this, sections, true, createSeriesCreator(getAddressCreator(), getMaxSegmentValue()));
return blocks.toArray(new IPv6AddressSection[block... | [
"public",
"IPv6AddressSection",
"[",
"]",
"mergeToSequentialBlocks",
"(",
"IPv6AddressSection",
"...",
"sections",
")",
"throws",
"SizeMismatchException",
"{",
"List",
"<",
"IPAddressSegmentSeries",
">",
"blocks",
"=",
"getMergedSequentialBlocks",
"(",
"this",
",",
"sec... | Merges this with the list of sections to produce the smallest array of sequential block subnets, going from smallest to largest
@param sections the sections to merge with this
@return | [
"Merges",
"this",
"with",
"the",
"list",
"of",
"sections",
"to",
"produce",
"the",
"smallest",
"array",
"of",
"sequential",
"block",
"subnets",
"going",
"from",
"smallest",
"to",
"largest"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L2067-L2070 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.toCanonicalString | @Override
public String toCanonicalString() {
String result;
if(hasNoStringCache() || (result = stringCache.canonicalString) == null) {
stringCache.canonicalString = result = toNormalizedString(IPv6StringCache.canonicalParams);
}
return result;
} | java | @Override
public String toCanonicalString() {
String result;
if(hasNoStringCache() || (result = stringCache.canonicalString) == null) {
stringCache.canonicalString = result = toNormalizedString(IPv6StringCache.canonicalParams);
}
return result;
} | [
"@",
"Override",
"public",
"String",
"toCanonicalString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"stringCache",
".",
"canonicalString",
")",
"==",
"null",
")",
"{",
"stringCache",
".",
"ca... | This produces a canonical string.
RFC 5952 describes canonical representations.
http://en.wikipedia.org/wiki/IPv6_address#Recommended_representation_as_text
http://tools.ietf.org/html/rfc5952 | [
"This",
"produces",
"a",
"canonical",
"string",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L2111-L2118 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.toFullString | @Override
public String toFullString() {
String result;
if(hasNoStringCache() || (result = getStringCache().fullString) == null) {
getStringCache().fullString = result = toNormalizedString(IPv6StringCache.fullParams);
}
return result;
} | java | @Override
public String toFullString() {
String result;
if(hasNoStringCache() || (result = getStringCache().fullString) == null) {
getStringCache().fullString = result = toNormalizedString(IPv6StringCache.fullParams);
}
return result;
} | [
"@",
"Override",
"public",
"String",
"toFullString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"getStringCache",
"(",
")",
".",
"fullString",
")",
"==",
"null",
")",
"{",
"getStringCache",
... | This produces a string with no compressed segments and all segments of full length,
which is 4 characters for IPv6 segments and 3 characters for IPv4 segments. | [
"This",
"produces",
"a",
"string",
"with",
"no",
"compressed",
"segments",
"and",
"all",
"segments",
"of",
"full",
"length",
"which",
"is",
"4",
"characters",
"for",
"IPv6",
"segments",
"and",
"3",
"characters",
"for",
"IPv4",
"segments",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L2135-L2142 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.toNormalizedString | @Override
public String toNormalizedString() {
String result;
if(hasNoStringCache() || (result = getStringCache().normalizedString) == null) {
getStringCache().normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);
}
return result;
} | java | @Override
public String toNormalizedString() {
String result;
if(hasNoStringCache() || (result = getStringCache().normalizedString) == null) {
getStringCache().normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);
}
return result;
} | [
"@",
"Override",
"public",
"String",
"toNormalizedString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"getStringCache",
"(",
")",
".",
"normalizedString",
")",
"==",
"null",
")",
"{",
"getStri... | The normalized string returned by this method is consistent with java.net.Inet6address.
IPs are not compressed nor mixed in this representation. | [
"The",
"normalized",
"string",
"returned",
"by",
"this",
"method",
"is",
"consistent",
"with",
"java",
".",
"net",
".",
"Inet6address",
".",
"IPs",
"are",
"not",
"compressed",
"nor",
"mixed",
"in",
"this",
"representation",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L2198-L2205 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.getCompressIndexAndCount | private int[] getCompressIndexAndCount(CompressOptions options, boolean createMixed) {
if(options != null) {
CompressionChoiceOptions rangeSelection = options.rangeSelection;
RangeList compressibleSegs = rangeSelection.compressHost() ? getZeroRangeSegments() : getZeroSegments();
int maxIndex = -1, maxCount =... | java | private int[] getCompressIndexAndCount(CompressOptions options, boolean createMixed) {
if(options != null) {
CompressionChoiceOptions rangeSelection = options.rangeSelection;
RangeList compressibleSegs = rangeSelection.compressHost() ? getZeroRangeSegments() : getZeroSegments();
int maxIndex = -1, maxCount =... | [
"private",
"int",
"[",
"]",
"getCompressIndexAndCount",
"(",
"CompressOptions",
"options",
",",
"boolean",
"createMixed",
")",
"{",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"CompressionChoiceOptions",
"rangeSelection",
"=",
"options",
".",
"rangeSelection",
"... | Chooses a single segment to be compressed, or null if no segment could be chosen.
@param options
@param createMixed
@return | [
"Chooses",
"a",
"single",
"segment",
"to",
"be",
"compressed",
"or",
"null",
"if",
"no",
"segment",
"could",
"be",
"chosen",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L2731-L2774 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java | ParsedAddressGrouping.getHostSegmentIndex | public static int getHostSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) {
if(bytesPerSegment > 1) {
if(bytesPerSegment == 2) {
return networkPrefixLength >> 4;
}
return networkPrefixLength / bitsPerSegment;
}
return networkPrefixLength >> 3;
} | java | public static int getHostSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) {
if(bytesPerSegment > 1) {
if(bytesPerSegment == 2) {
return networkPrefixLength >> 4;
}
return networkPrefixLength / bitsPerSegment;
}
return networkPrefixLength >> 3;
} | [
"public",
"static",
"int",
"getHostSegmentIndex",
"(",
"int",
"networkPrefixLength",
",",
"int",
"bytesPerSegment",
",",
"int",
"bitsPerSegment",
")",
"{",
"if",
"(",
"bytesPerSegment",
">",
"1",
")",
"{",
"if",
"(",
"bytesPerSegment",
"==",
"2",
")",
"{",
"... | Returns the index of the segment containing the first byte outside the network prefix.
When networkPrefixLength is null, or it matches or exceeds the bit length, returns the segment count.
@param networkPrefixLength
@param byteLength
@return | [
"Returns",
"the",
"index",
"of",
"the",
"segment",
"containing",
"the",
"first",
"byte",
"outside",
"the",
"network",
"prefix",
".",
"When",
"networkPrefixLength",
"is",
"null",
"or",
"it",
"matches",
"or",
"exceeds",
"the",
"bit",
"length",
"returns",
"the",
... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java#L52-L60 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/MACAddressString.java | MACAddressString.validate | @Override
public void validate() throws AddressStringException {
if(isValidated()) {
return;
}
synchronized(this) {
if(isValidated()) {
return;
}
//we know nothing about this address. See what it is.
try {
parsedAddress = getValidator().validateAddress(this);
isValid = true;
} catc... | java | @Override
public void validate() throws AddressStringException {
if(isValidated()) {
return;
}
synchronized(this) {
if(isValidated()) {
return;
}
//we know nothing about this address. See what it is.
try {
parsedAddress = getValidator().validateAddress(this);
isValid = true;
} catc... | [
"@",
"Override",
"public",
"void",
"validate",
"(",
")",
"throws",
"AddressStringException",
"{",
"if",
"(",
"isValidated",
"(",
")",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"isValidated",
"(",
")",
")",
"{",
"re... | Validates this string is a valid address, and if not, throws an exception with a descriptive message indicating why it is not.
@throws AddressStringException | [
"Validates",
"this",
"string",
"is",
"a",
"valid",
"address",
"and",
"if",
"not",
"throws",
"an",
"exception",
"with",
"a",
"descriptive",
"message",
"indicating",
"why",
"it",
"is",
"not",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/MACAddressString.java#L243-L262 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java | IPAddressSegment.isChangedByMask | protected boolean isChangedByMask(int maskValue, Integer segmentPrefixLength) throws IncompatibleAddressException {
boolean hasBits = (segmentPrefixLength != null);
if(hasBits && (segmentPrefixLength < 0 || segmentPrefixLength > getBitCount())) {
throw new PrefixLenException(this, segmentPrefixLength);
}
... | java | protected boolean isChangedByMask(int maskValue, Integer segmentPrefixLength) throws IncompatibleAddressException {
boolean hasBits = (segmentPrefixLength != null);
if(hasBits && (segmentPrefixLength < 0 || segmentPrefixLength > getBitCount())) {
throw new PrefixLenException(this, segmentPrefixLength);
}
... | [
"protected",
"boolean",
"isChangedByMask",
"(",
"int",
"maskValue",
",",
"Integer",
"segmentPrefixLength",
")",
"throws",
"IncompatibleAddressException",
"{",
"boolean",
"hasBits",
"=",
"(",
"segmentPrefixLength",
"!=",
"null",
")",
";",
"if",
"(",
"hasBits",
"&&",
... | returns a new segment masked by the given mask
This method applies the mask first to every address in the range, and it does not preserve any existing prefix.
The given prefix will be applied to the range of addresses after the mask.
If the combination of the two does not result in a contiguous range, then {@link Inco... | [
"returns",
"a",
"new",
"segment",
"masked",
"by",
"the",
"given",
"mask"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java#L273-L286 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java | IPAddressSegment.isMaskCompatibleWithRange | public boolean isMaskCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException {
if(!isMultiple()) {
return true;
}
return super.isMaskCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets());
} | java | public boolean isMaskCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException {
if(!isMultiple()) {
return true;
}
return super.isMaskCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets());
} | [
"public",
"boolean",
"isMaskCompatibleWithRange",
"(",
"int",
"maskValue",
",",
"Integer",
"segmentPrefixLength",
")",
"throws",
"PrefixLenException",
"{",
"if",
"(",
"!",
"isMultiple",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"super",
".",
"i... | Check that the range resulting from the mask is contiguous, otherwise we cannot represent it.
For instance, for the range 0 to 3 (bits are 00 to 11), if we mask all 4 numbers from 0 to 3 with 2 (ie bits are 10),
then we are left with 1 and 3. 2 is not included. So we cannot represent 1 and 3 as a contiguous range.
... | [
"Check",
"that",
"the",
"range",
"resulting",
"from",
"the",
"mask",
"is",
"contiguous",
"otherwise",
"we",
"cannot",
"represent",
"it",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java#L320-L325 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java | IPAddressSegment.isBitwiseOrCompatibleWithRange | public boolean isBitwiseOrCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException {
return super.isBitwiseOrCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets());
} | java | public boolean isBitwiseOrCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException {
return super.isBitwiseOrCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets());
} | [
"public",
"boolean",
"isBitwiseOrCompatibleWithRange",
"(",
"int",
"maskValue",
",",
"Integer",
"segmentPrefixLength",
")",
"throws",
"PrefixLenException",
"{",
"return",
"super",
".",
"isBitwiseOrCompatibleWithRange",
"(",
"maskValue",
",",
"segmentPrefixLength",
",",
"g... | Similar to masking, checks that the range resulting from the bitwise or is contiguous.
@param maskValue
@param segmentPrefixLength
@return
@throws PrefixLenException | [
"Similar",
"to",
"masking",
"checks",
"that",
"the",
"range",
"resulting",
"from",
"the",
"bitwise",
"or",
"is",
"contiguous",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java#L335-L337 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4AddressSegment.java | IPv4AddressSegment.join | public IPv6AddressSegment join(IPv6AddressCreator creator, IPv4AddressSegment low) throws IncompatibleAddressException {
int shift = IPv4Address.BITS_PER_SEGMENT;
Integer prefix = getJoinedSegmentPrefixLength(shift, getSegmentPrefixLength(), low.getSegmentPrefixLength());
if(isMultiple()) {
//if the high s... | java | public IPv6AddressSegment join(IPv6AddressCreator creator, IPv4AddressSegment low) throws IncompatibleAddressException {
int shift = IPv4Address.BITS_PER_SEGMENT;
Integer prefix = getJoinedSegmentPrefixLength(shift, getSegmentPrefixLength(), low.getSegmentPrefixLength());
if(isMultiple()) {
//if the high s... | [
"public",
"IPv6AddressSegment",
"join",
"(",
"IPv6AddressCreator",
"creator",
",",
"IPv4AddressSegment",
"low",
")",
"throws",
"IncompatibleAddressException",
"{",
"int",
"shift",
"=",
"IPv4Address",
".",
"BITS_PER_SEGMENT",
";",
"Integer",
"prefix",
"=",
"getJoinedSegm... | Joins with another IPv4 segment to produce a IPv6 segment.
@param creator
@param low
@return | [
"Joins",
"with",
"another",
"IPv4",
"segment",
"to",
"produce",
"a",
"IPv6",
"segment",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4AddressSegment.java#L306-L320 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java | IPAddress.toHostName | public HostName toHostName() {
HostName host = fromHost;
if(host == null) {
fromHost = host = toCanonicalHostName();
}
return host;
} | java | public HostName toHostName() {
HostName host = fromHost;
if(host == null) {
fromHost = host = toCanonicalHostName();
}
return host;
} | [
"public",
"HostName",
"toHostName",
"(",
")",
"{",
"HostName",
"host",
"=",
"fromHost",
";",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"fromHost",
"=",
"host",
"=",
"toCanonicalHostName",
"(",
")",
";",
"}",
"return",
"host",
";",
"}"
] | If this address was resolved from a host, returns that host. Otherwise, does a reverse name lookup. | [
"If",
"this",
"address",
"was",
"resolved",
"from",
"a",
"host",
"returns",
"that",
"host",
".",
"Otherwise",
"does",
"a",
"reverse",
"name",
"lookup",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java#L164-L170 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java | IPAddress.matchesWithMask | public boolean matchesWithMask(IPAddress other, IPAddress mask) {
return getSection().matchesWithMask(other.getSection(), mask.getSection());
} | java | public boolean matchesWithMask(IPAddress other, IPAddress mask) {
return getSection().matchesWithMask(other.getSection(), mask.getSection());
} | [
"public",
"boolean",
"matchesWithMask",
"(",
"IPAddress",
"other",
",",
"IPAddress",
"mask",
")",
"{",
"return",
"getSection",
"(",
")",
".",
"matchesWithMask",
"(",
"other",
".",
"getSection",
"(",
")",
",",
"mask",
".",
"getSection",
"(",
")",
")",
";",
... | Applies the mask to this address and then compares values with the given address
@param mask
@param other
@return | [
"Applies",
"the",
"mask",
"to",
"this",
"address",
"and",
"then",
"compares",
"values",
"with",
"the",
"given",
"address"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java#L592-L594 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddress.java | MACAddress.toLinkLocalIPv6 | public IPv6Address toLinkLocalIPv6() {
IPv6AddressNetwork network = getIPv6Network();
IPv6AddressSection linkLocalPrefix = network.getLinkLocalPrefix();
IPv6AddressCreator creator = network.getAddressCreator();
return creator.createAddress(linkLocalPrefix.append(toEUI64IPv6()));
} | java | public IPv6Address toLinkLocalIPv6() {
IPv6AddressNetwork network = getIPv6Network();
IPv6AddressSection linkLocalPrefix = network.getLinkLocalPrefix();
IPv6AddressCreator creator = network.getAddressCreator();
return creator.createAddress(linkLocalPrefix.append(toEUI64IPv6()));
} | [
"public",
"IPv6Address",
"toLinkLocalIPv6",
"(",
")",
"{",
"IPv6AddressNetwork",
"network",
"=",
"getIPv6Network",
"(",
")",
";",
"IPv6AddressSection",
"linkLocalPrefix",
"=",
"network",
".",
"getLinkLocalPrefix",
"(",
")",
";",
"IPv6AddressCreator",
"creator",
"=",
... | Converts to a link-local Ipv6 address. Any MAC prefix length is ignored. Other elements of this address section are incorporated into the conversion.
This will provide the latter 4 segments of an IPv6 address, to be paired with the link-local IPv6 prefix of 4 segments.
@return | [
"Converts",
"to",
"a",
"link",
"-",
"local",
"Ipv6",
"address",
".",
"Any",
"MAC",
"prefix",
"length",
"is",
"ignored",
".",
"Other",
"elements",
"of",
"this",
"address",
"section",
"are",
"incorporated",
"into",
"the",
"conversion",
".",
"This",
"will",
"... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddress.java#L467-L472 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddress.java | MACAddress.toEUI64 | public MACAddress toEUI64(boolean asMAC) {
if(!isExtended()) {//getSegmentCount() == EXTENDED_UNIQUE_IDENTIFIER_48_SEGMENT_COUNT
MACAddressCreator creator = getAddressCreator();
MACAddressSegment segs[] = creator.createSegmentArray(EXTENDED_UNIQUE_IDENTIFIER_64_SEGMENT_COUNT);
MACAddressSection section =... | java | public MACAddress toEUI64(boolean asMAC) {
if(!isExtended()) {//getSegmentCount() == EXTENDED_UNIQUE_IDENTIFIER_48_SEGMENT_COUNT
MACAddressCreator creator = getAddressCreator();
MACAddressSegment segs[] = creator.createSegmentArray(EXTENDED_UNIQUE_IDENTIFIER_64_SEGMENT_COUNT);
MACAddressSection section =... | [
"public",
"MACAddress",
"toEUI64",
"(",
"boolean",
"asMAC",
")",
"{",
"if",
"(",
"!",
"isExtended",
"(",
")",
")",
"{",
"//getSegmentCount() == EXTENDED_UNIQUE_IDENTIFIER_48_SEGMENT_COUNT\r",
"MACAddressCreator",
"creator",
"=",
"getAddressCreator",
"(",
")",
";",
"MA... | Convert to IPv6 EUI-64 section
http://standards.ieee.org/develop/regauth/tut/eui64.pdf
@param asMAC if true, this address is considered MAC and the EUI-64 is extended using ff-ff, otherwise this address is considered EUI-48 and extended using ff-fe
Note that IPv6 treats MAC as EUI-48 and extends MAC to IPv6 addresses... | [
"Convert",
"to",
"IPv6",
"EUI",
"-",
"64",
"section"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddress.java#L511-L539 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java | IPAddressSeqRange.prefixIterator | @Override
public Iterator<? extends IPAddressSeqRange> prefixIterator(int prefixLength) {
if(!isMultiple()) {
return new Iterator<IPAddressSeqRange>() {
IPAddressSeqRange orig = IPAddressSeqRange.this;
@Override
public boolean hasNext() {
return orig != null;
}
@Override
public I... | java | @Override
public Iterator<? extends IPAddressSeqRange> prefixIterator(int prefixLength) {
if(!isMultiple()) {
return new Iterator<IPAddressSeqRange>() {
IPAddressSeqRange orig = IPAddressSeqRange.this;
@Override
public boolean hasNext() {
return orig != null;
}
@Override
public I... | [
"@",
"Override",
"public",
"Iterator",
"<",
"?",
"extends",
"IPAddressSeqRange",
">",
"prefixIterator",
"(",
"int",
"prefixLength",
")",
"{",
"if",
"(",
"!",
"isMultiple",
"(",
")",
")",
"{",
"return",
"new",
"Iterator",
"<",
"IPAddressSeqRange",
">",
"(",
... | Iterates through the range of prefixes in this range instance using the given prefix length.
@param prefixLength
@return | [
"Iterates",
"through",
"the",
"range",
"of",
"prefixes",
"in",
"this",
"range",
"instance",
"using",
"the",
"given",
"prefix",
"length",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java#L152-L219 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java | IPAddressSeqRange.join | public static IPAddressSeqRange[] join(IPAddressSeqRange... ranges) {
int joinedCount = 0;
Arrays.sort(ranges, Address.ADDRESS_LOW_VALUE_COMPARATOR);
for(int i = 0; i < ranges.length; i++) {
IPAddressSeqRange range = ranges[i];
if(range == null) {
continue;
}
for(int j = i + 1; j < ranges.length; ... | java | public static IPAddressSeqRange[] join(IPAddressSeqRange... ranges) {
int joinedCount = 0;
Arrays.sort(ranges, Address.ADDRESS_LOW_VALUE_COMPARATOR);
for(int i = 0; i < ranges.length; i++) {
IPAddressSeqRange range = ranges[i];
if(range == null) {
continue;
}
for(int j = i + 1; j < ranges.length; ... | [
"public",
"static",
"IPAddressSeqRange",
"[",
"]",
"join",
"(",
"IPAddressSeqRange",
"...",
"ranges",
")",
"{",
"int",
"joinedCount",
"=",
"0",
";",
"Arrays",
".",
"sort",
"(",
"ranges",
",",
"Address",
".",
"ADDRESS_LOW_VALUE_COMPARATOR",
")",
";",
"for",
"... | Joins the given ranges into the fewest number of ranges.
If no joining can take place, the original array is returned.
@param ranges
@return | [
"Joins",
"the",
"given",
"ranges",
"into",
"the",
"fewest",
"number",
"of",
"ranges",
".",
"If",
"no",
"joining",
"can",
"take",
"place",
"the",
"original",
"array",
"is",
"returned",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java#L450-L489 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java | IPAddressSeqRange.intersect | public IPAddressSeqRange intersect(IPAddressSeqRange other) {
IPAddress otherLower = other.getLower();
IPAddress otherUpper = other.getUpper();
IPAddress lower = this.getLower();
IPAddress upper = this.getUpper();
if(compareLowValues(lower, otherLower) <= 0) {
if(compareLowValues(upper, otherUpper) >= 0) {... | java | public IPAddressSeqRange intersect(IPAddressSeqRange other) {
IPAddress otherLower = other.getLower();
IPAddress otherUpper = other.getUpper();
IPAddress lower = this.getLower();
IPAddress upper = this.getUpper();
if(compareLowValues(lower, otherLower) <= 0) {
if(compareLowValues(upper, otherUpper) >= 0) {... | [
"public",
"IPAddressSeqRange",
"intersect",
"(",
"IPAddressSeqRange",
"other",
")",
"{",
"IPAddress",
"otherLower",
"=",
"other",
".",
"getLower",
"(",
")",
";",
"IPAddress",
"otherUpper",
"=",
"other",
".",
"getUpper",
"(",
")",
";",
"IPAddress",
"lower",
"="... | Returns the intersection of this range with the given range, a range which includes those addresses in both this and the given rqnge.
@param other
@return | [
"Returns",
"the",
"intersection",
"of",
"this",
"range",
"with",
"the",
"given",
"range",
"a",
"range",
"which",
"includes",
"those",
"addresses",
"in",
"both",
"this",
"and",
"the",
"given",
"rqnge",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java#L533-L551 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java | IPAddressSeqRange.subtract | public IPAddressSeqRange[] subtract(IPAddressSeqRange other) {
IPAddress otherLower = other.getLower();
IPAddress otherUpper = other.getUpper();
IPAddress lower = this.getLower();
IPAddress upper = this.getUpper();
if(compareLowValues(lower, otherLower) < 0) {
if(compareLowValues(upper, otherUpper) > 0) { ... | java | public IPAddressSeqRange[] subtract(IPAddressSeqRange other) {
IPAddress otherLower = other.getLower();
IPAddress otherUpper = other.getUpper();
IPAddress lower = this.getLower();
IPAddress upper = this.getUpper();
if(compareLowValues(lower, otherLower) < 0) {
if(compareLowValues(upper, otherUpper) > 0) { ... | [
"public",
"IPAddressSeqRange",
"[",
"]",
"subtract",
"(",
"IPAddressSeqRange",
"other",
")",
"{",
"IPAddress",
"otherLower",
"=",
"other",
".",
"getLower",
"(",
")",
";",
"IPAddress",
"otherUpper",
"=",
"other",
".",
"getUpper",
"(",
")",
";",
"IPAddress",
"... | Subtracts the given range from this range, to produce either zero, one, or two address ranges that contain the addresses in this range and not in the given range.
If the result has length 2, the two ranges are in increasing order.
@param other
@return | [
"Subtracts",
"the",
"given",
"range",
"from",
"this",
"range",
"to",
"produce",
"either",
"zero",
"one",
"or",
"two",
"address",
"ranges",
"that",
"contain",
"the",
"addresses",
"in",
"this",
"range",
"and",
"not",
"in",
"the",
"given",
"range",
".",
"If",... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSeqRange.java#L602-L630 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java | IPAddressSection.isNetworkSection | protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) {
int segmentCount = getSegmentCount();
if(segmentCount == 0) {
return true;
}
int bitsPerSegment = getBitsPerSegment();
int prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPer... | java | protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) {
int segmentCount = getSegmentCount();
if(segmentCount == 0) {
return true;
}
int bitsPerSegment = getBitsPerSegment();
int prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPer... | [
"protected",
"boolean",
"isNetworkSection",
"(",
"int",
"networkPrefixLength",
",",
"boolean",
"withPrefixLength",
")",
"{",
"int",
"segmentCount",
"=",
"getSegmentCount",
"(",
")",
";",
"if",
"(",
"segmentCount",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}... | this method is basically checking whether we can return "this" for getNetworkSection | [
"this",
"method",
"is",
"basically",
"checking",
"whether",
"we",
"can",
"return",
"this",
"for",
"getNetworkSection"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L258-L271 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java | IPAddressSection.getBlockMaskPrefixLength | public Integer getBlockMaskPrefixLength(boolean network) {
Integer prefixLen;
if(network) {
if(hasNoPrefixCache() || (prefixLen = prefixCache.networkMaskPrefixLen) == null) {
prefixLen = setNetworkMaskPrefix(checkForPrefixMask(network));
}
} else {
if(hasNoPrefixCache() || (prefixLen = prefixCache.ho... | java | public Integer getBlockMaskPrefixLength(boolean network) {
Integer prefixLen;
if(network) {
if(hasNoPrefixCache() || (prefixLen = prefixCache.networkMaskPrefixLen) == null) {
prefixLen = setNetworkMaskPrefix(checkForPrefixMask(network));
}
} else {
if(hasNoPrefixCache() || (prefixLen = prefixCache.ho... | [
"public",
"Integer",
"getBlockMaskPrefixLength",
"(",
"boolean",
"network",
")",
"{",
"Integer",
"prefixLen",
";",
"if",
"(",
"network",
")",
"{",
"if",
"(",
"hasNoPrefixCache",
"(",
")",
"||",
"(",
"prefixLen",
"=",
"prefixCache",
".",
"networkMaskPrefixLen",
... | If this address section is equivalent to the mask for a CIDR prefix block, it returns that prefix length.
Otherwise, it returns null.
A CIDR network mask is an address with all 1s in the network section and then all 0s in the host section.
A CIDR host mask is an address with all 0s in the network section and then all 1... | [
"If",
"this",
"address",
"section",
"is",
"equivalent",
"to",
"the",
"mask",
"for",
"a",
"CIDR",
"prefix",
"block",
"it",
"returns",
"that",
"prefix",
"length",
".",
"Otherwise",
"it",
"returns",
"null",
".",
"A",
"CIDR",
"network",
"mask",
"is",
"an",
"... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L347-L362 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java | IPAddressSection.containsNonZeroHosts | public boolean containsNonZeroHosts(IPAddressSection other) {
if(!other.isPrefixed()) {
return contains(other);
}
int otherPrefixLength = other.getNetworkPrefixLength();
if(otherPrefixLength == other.getBitCount()) {
return contains(other);
}
return containsNonZeroHostsImpl(other, otherPrefixLength);... | java | public boolean containsNonZeroHosts(IPAddressSection other) {
if(!other.isPrefixed()) {
return contains(other);
}
int otherPrefixLength = other.getNetworkPrefixLength();
if(otherPrefixLength == other.getBitCount()) {
return contains(other);
}
return containsNonZeroHostsImpl(other, otherPrefixLength);... | [
"public",
"boolean",
"containsNonZeroHosts",
"(",
"IPAddressSection",
"other",
")",
"{",
"if",
"(",
"!",
"other",
".",
"isPrefixed",
"(",
")",
")",
"{",
"return",
"contains",
"(",
"other",
")",
";",
"}",
"int",
"otherPrefixLength",
"=",
"other",
".",
"getN... | Returns whether this address contains the non-zero host addresses in other.
@param other
@return | [
"Returns",
"whether",
"this",
"address",
"contains",
"the",
"non",
"-",
"zero",
"host",
"addresses",
"in",
"other",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L803-L812 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java | IPAddressSection.matchesWithMask | public boolean matchesWithMask(IPAddressSection other, IPAddressSection mask) {
checkMaskSectionCount(mask);
checkSectionCount(other);
int divCount = getSegmentCount();
for(int i = 0; i < divCount; i++) {
IPAddressSegment div = getSegment(i);
IPAddressSegment maskSegment = mask.getSegment(i);
IPAddress... | java | public boolean matchesWithMask(IPAddressSection other, IPAddressSection mask) {
checkMaskSectionCount(mask);
checkSectionCount(other);
int divCount = getSegmentCount();
for(int i = 0; i < divCount; i++) {
IPAddressSegment div = getSegment(i);
IPAddressSegment maskSegment = mask.getSegment(i);
IPAddress... | [
"public",
"boolean",
"matchesWithMask",
"(",
"IPAddressSection",
"other",
",",
"IPAddressSection",
"mask",
")",
"{",
"checkMaskSectionCount",
"(",
"mask",
")",
";",
"checkSectionCount",
"(",
"other",
")",
";",
"int",
"divCount",
"=",
"getSegmentCount",
"(",
")",
... | Applies the mask to this address section and then compares values with the given address section
@param mask
@param other
@return | [
"Applies",
"the",
"mask",
"to",
"this",
"address",
"section",
"and",
"then",
"compares",
"values",
"with",
"the",
"given",
"address",
"section"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L1824-L1840 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java | IPAddressSection.toHexString | protected String toHexString(boolean with0xPrefix, CharSequence zone) {
if(isDualString()) {
return toNormalizedStringRange(toIPParams(with0xPrefix ? IPStringCache.hexPrefixedParams : IPStringCache.hexParams), getLower(), getUpper(), zone);
}
return toIPParams(with0xPrefix ? IPStringCache.hexPrefixedParams : I... | java | protected String toHexString(boolean with0xPrefix, CharSequence zone) {
if(isDualString()) {
return toNormalizedStringRange(toIPParams(with0xPrefix ? IPStringCache.hexPrefixedParams : IPStringCache.hexParams), getLower(), getUpper(), zone);
}
return toIPParams(with0xPrefix ? IPStringCache.hexPrefixedParams : I... | [
"protected",
"String",
"toHexString",
"(",
"boolean",
"with0xPrefix",
",",
"CharSequence",
"zone",
")",
"{",
"if",
"(",
"isDualString",
"(",
")",
")",
"{",
"return",
"toNormalizedStringRange",
"(",
"toIPParams",
"(",
"with0xPrefix",
"?",
"IPStringCache",
".",
"h... | overridden in ipv6 to handle zone | [
"overridden",
"in",
"ipv6",
"to",
"handle",
"zone"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L2331-L2336 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.getEmbeddedIPv4Address | public IPv4Address getEmbeddedIPv4Address(int byteIndex) {
if(byteIndex == IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT * IPv6Address.BYTES_PER_SEGMENT) {
return getEmbeddedIPv4Address();
}
IPv4AddressCreator creator = getIPv4Network().getAddressCreator();
return creator.createAddress(getSection().getEmbeddedIPv... | java | public IPv4Address getEmbeddedIPv4Address(int byteIndex) {
if(byteIndex == IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT * IPv6Address.BYTES_PER_SEGMENT) {
return getEmbeddedIPv4Address();
}
IPv4AddressCreator creator = getIPv4Network().getAddressCreator();
return creator.createAddress(getSection().getEmbeddedIPv... | [
"public",
"IPv4Address",
"getEmbeddedIPv4Address",
"(",
"int",
"byteIndex",
")",
"{",
"if",
"(",
"byteIndex",
"==",
"IPv6Address",
".",
"MIXED_ORIGINAL_SEGMENT_COUNT",
"*",
"IPv6Address",
".",
"BYTES_PER_SEGMENT",
")",
"{",
"return",
"getEmbeddedIPv4Address",
"(",
")"... | Produces an IPv4 address from any sequence of 4 bytes in this IPv6 address.
@param byteIndex the byte index to start
@throws IndexOutOfBoundsException if the index is less than zero or bigger than 7
@return | [
"Produces",
"an",
"IPv4",
"address",
"from",
"any",
"sequence",
"of",
"4",
"bytes",
"in",
"this",
"IPv6",
"address",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1043-L1049 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.isIPv4Mapped | public boolean isIPv4Mapped() {
//::ffff:x:x/96 indicates IPv6 address mapped to IPv4
if(getSegment(5).matches(IPv6Address.MAX_VALUE_PER_SEGMENT)) {
for(int i = 0; i < 5; i++) {
if(!getSegment(i).isZero()) {
return false;
}
}
return true;
}
return false;
} | java | public boolean isIPv4Mapped() {
//::ffff:x:x/96 indicates IPv6 address mapped to IPv4
if(getSegment(5).matches(IPv6Address.MAX_VALUE_PER_SEGMENT)) {
for(int i = 0; i < 5; i++) {
if(!getSegment(i).isZero()) {
return false;
}
}
return true;
}
return false;
} | [
"public",
"boolean",
"isIPv4Mapped",
"(",
")",
"{",
"//::ffff:x:x/96 indicates IPv6 address mapped to IPv4",
"if",
"(",
"getSegment",
"(",
"5",
")",
".",
"matches",
"(",
"IPv6Address",
".",
"MAX_VALUE_PER_SEGMENT",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0"... | Whether the address is IPv4-mapped
::ffff:x:x/96 indicates IPv6 address mapped to IPv4 | [
"Whether",
"the",
"address",
"is",
"IPv4",
"-",
"mapped"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1117-L1128 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.isIPv4Compatible | public boolean isIPv4Compatible() {
return getSegment(0).isZero() && getSegment(1).isZero() && getSegment(2).isZero() &&
getSegment(3).isZero() && getSegment(4).isZero() && getSegment(5).isZero();
} | java | public boolean isIPv4Compatible() {
return getSegment(0).isZero() && getSegment(1).isZero() && getSegment(2).isZero() &&
getSegment(3).isZero() && getSegment(4).isZero() && getSegment(5).isZero();
} | [
"public",
"boolean",
"isIPv4Compatible",
"(",
")",
"{",
"return",
"getSegment",
"(",
"0",
")",
".",
"isZero",
"(",
")",
"&&",
"getSegment",
"(",
"1",
")",
".",
"isZero",
"(",
")",
"&&",
"getSegment",
"(",
"2",
")",
".",
"isZero",
"(",
")",
"&&",
"g... | Whether the address is IPv4-compatible
@see java.net.Inet6Address#isIPv4CompatibleAddress() | [
"Whether",
"the",
"address",
"is",
"IPv4",
"-",
"compatible"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1135-L1138 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.isWellKnownIPv4Translatable | public boolean isWellKnownIPv4Translatable() { //rfc 6052 rfc 6144
//64:ff9b::/96 prefix for auto ipv4/ipv6 translation
if(getSegment(0).matches(0x64) && getSegment(1).matches(0xff9b)) {
for(int i=2; i<=5; i++) {
if(!getSegment(i).isZero()) {
return false;
}
}
return true;
}
return false;
... | java | public boolean isWellKnownIPv4Translatable() { //rfc 6052 rfc 6144
//64:ff9b::/96 prefix for auto ipv4/ipv6 translation
if(getSegment(0).matches(0x64) && getSegment(1).matches(0xff9b)) {
for(int i=2; i<=5; i++) {
if(!getSegment(i).isZero()) {
return false;
}
}
return true;
}
return false;
... | [
"public",
"boolean",
"isWellKnownIPv4Translatable",
"(",
")",
"{",
"//rfc 6052 rfc 6144",
"//64:ff9b::/96 prefix for auto ipv4/ipv6 translation",
"if",
"(",
"getSegment",
"(",
"0",
")",
".",
"matches",
"(",
"0x64",
")",
"&&",
"getSegment",
"(",
"1",
")",
".",
"match... | Whether the address has the well-known prefix for IPv4 translatable addresses as in rfc 6052 and 6144
@return | [
"Whether",
"the",
"address",
"has",
"the",
"well",
"-",
"known",
"prefix",
"for",
"IPv4",
"translatable",
"addresses",
"as",
"in",
"rfc",
"6052",
"and",
"6144"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1192-L1203 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toInetAddress | @Override
public Inet6Address toInetAddress() {
if(hasZone()) {
Inet6Address result;
if(hasNoValueCache() || (result = valueCache.inetAddress) == null) {
valueCache.inetAddress = result = (Inet6Address) toInetAddressImpl(getBytes());
}
return result;
}
return (Inet6Address) super.toInetAddress();... | java | @Override
public Inet6Address toInetAddress() {
if(hasZone()) {
Inet6Address result;
if(hasNoValueCache() || (result = valueCache.inetAddress) == null) {
valueCache.inetAddress = result = (Inet6Address) toInetAddressImpl(getBytes());
}
return result;
}
return (Inet6Address) super.toInetAddress();... | [
"@",
"Override",
"public",
"Inet6Address",
"toInetAddress",
"(",
")",
"{",
"if",
"(",
"hasZone",
"(",
")",
")",
"{",
"Inet6Address",
"result",
";",
"if",
"(",
"hasNoValueCache",
"(",
")",
"||",
"(",
"result",
"=",
"valueCache",
".",
"inetAddress",
")",
"... | we need to cache the address in here and not in the address section if there is a zone | [
"we",
"need",
"to",
"cache",
"the",
"address",
"in",
"here",
"and",
"not",
"in",
"the",
"address",
"section",
"if",
"there",
"is",
"a",
"zone"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1570-L1580 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toMixedString | public String toMixedString() {
String result;
if(hasNoStringCache() || (result = stringCache.mixedString) == null) {
if(hasZone()) {
stringCache.mixedString = result = toNormalizedString(IPv6StringCache.mixedParams);
} else {
result = getSection().toMixedString();//the cache is shared so no need to u... | java | public String toMixedString() {
String result;
if(hasNoStringCache() || (result = stringCache.mixedString) == null) {
if(hasZone()) {
stringCache.mixedString = result = toNormalizedString(IPv6StringCache.mixedParams);
} else {
result = getSection().toMixedString();//the cache is shared so no need to u... | [
"public",
"String",
"toMixedString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"stringCache",
".",
"mixedString",
")",
"==",
"null",
")",
"{",
"if",
"(",
"hasZone",
"(",
")",
")",
"{",
... | Produces a string in which the lower 4 bytes are expressed as an IPv4 address and the remaining upper bytes are expressed in IPv6 format.
This the mixed IPv6/IPv4 format described in RFC 1884 https://tools.ietf.org/html/rfc1884
@return | [
"Produces",
"a",
"string",
"in",
"which",
"the",
"lower",
"4",
"bytes",
"are",
"expressed",
"as",
"an",
"IPv4",
"address",
"and",
"the",
"remaining",
"upper",
"bytes",
"are",
"expressed",
"in",
"IPv6",
"format",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1707-L1717 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toNormalizedString | @Override
public String toNormalizedString() {
String result;
if(hasNoStringCache() || (result = stringCache.normalizedString) == null) {
if(hasZone()) {
stringCache.normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);
} else {
result = getSection().toNormalizedString();/... | java | @Override
public String toNormalizedString() {
String result;
if(hasNoStringCache() || (result = stringCache.normalizedString) == null) {
if(hasZone()) {
stringCache.normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);
} else {
result = getSection().toNormalizedString();/... | [
"@",
"Override",
"public",
"String",
"toNormalizedString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"stringCache",
".",
"normalizedString",
")",
"==",
"null",
")",
"{",
"if",
"(",
"hasZone",... | The normalized string returned by this method is consistent with java.net.Inet6address.
IPs are not compressed nor mixed in this representation. If this has a prefix length, that will be included in the string. | [
"The",
"normalized",
"string",
"returned",
"by",
"this",
"method",
"is",
"consistent",
"with",
"java",
".",
"net",
".",
"Inet6address",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1773-L1784 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toNormalizedWildcardString | @Override
public String toNormalizedWildcardString() {
String result;
if(hasNoStringCache() || (result = stringCache.normalizedWildcardString) == null) {
if(hasZone()) {
stringCache.normalizedWildcardString = result = toNormalizedString(IPv6StringCache.wildcardNormalizedParams);
} else {
result = get... | java | @Override
public String toNormalizedWildcardString() {
String result;
if(hasNoStringCache() || (result = stringCache.normalizedWildcardString) == null) {
if(hasZone()) {
stringCache.normalizedWildcardString = result = toNormalizedString(IPv6StringCache.wildcardNormalizedParams);
} else {
result = get... | [
"@",
"Override",
"public",
"String",
"toNormalizedWildcardString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"stringCache",
".",
"normalizedWildcardString",
")",
"==",
"null",
")",
"{",
"if",
"... | note this string is used by hashCode | [
"note",
"this",
"string",
"is",
"used",
"by",
"hashCode"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1808-L1819 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toNormalizedString | public String toNormalizedString(boolean keepMixed, IPv6StringOptions params) {
if(keepMixed && fromString != null && getAddressfromString().isMixedIPv6() && !params.makeMixed()) {
params = new IPv6StringOptions(
params.base,
params.expandSegments,
params.wildcardOption,
params.wildcards,
... | java | public String toNormalizedString(boolean keepMixed, IPv6StringOptions params) {
if(keepMixed && fromString != null && getAddressfromString().isMixedIPv6() && !params.makeMixed()) {
params = new IPv6StringOptions(
params.base,
params.expandSegments,
params.wildcardOption,
params.wildcards,
... | [
"public",
"String",
"toNormalizedString",
"(",
"boolean",
"keepMixed",
",",
"IPv6StringOptions",
"params",
")",
"{",
"if",
"(",
"keepMixed",
"&&",
"fromString",
"!=",
"null",
"&&",
"getAddressfromString",
"(",
")",
".",
"isMixedIPv6",
"(",
")",
"&&",
"!",
"par... | Constructs a string representing this address according to the given parameters
@param keepMixed if this address was constructed from a string with mixed representation (a:b:c:d:e:f:1.2.3.4), whether to keep it that way (ignored if makeMixed is true in the params argument)
@param params the parameters for the address ... | [
"Constructs",
"a",
"string",
"representing",
"this",
"address",
"according",
"to",
"the",
"given",
"parameters"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1968-L1988 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4AddressSection.java | IPv4AddressSection.mask | public IPv4AddressSection mask(IPv4AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException {
checkMaskSectionCount(mask);
return getSubnetSegments(
this,
retainPrefix ? getPrefixLength() : null,
getAddressCreator(),
true,
this::ge... | java | public IPv4AddressSection mask(IPv4AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException {
checkMaskSectionCount(mask);
return getSubnetSegments(
this,
retainPrefix ? getPrefixLength() : null,
getAddressCreator(),
true,
this::ge... | [
"public",
"IPv4AddressSection",
"mask",
"(",
"IPv4AddressSection",
"mask",
",",
"boolean",
"retainPrefix",
")",
"throws",
"IncompatibleAddressException",
",",
"PrefixLenException",
",",
"SizeMismatchException",
"{",
"checkMaskSectionCount",
"(",
"mask",
")",
";",
"return"... | Does the bitwise conjunction with this address. Useful when subnetting.
@param mask
@param retainPrefix whether to drop the prefix
@return
@throws IncompatibleAddressException | [
"Does",
"the",
"bitwise",
"conjunction",
"with",
"this",
"address",
".",
"Useful",
"when",
"subnetting",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4AddressSection.java#L1261-L1271 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4AddressSection.java | IPv4AddressSection.toFullString | @Override
public String toFullString() {
String result;
if(hasNoStringCache() || (result = stringCache.fullString) == null) {
stringCache.fullString = result = toNormalizedString(IPv4StringCache.fullParams);
}
return result;
} | java | @Override
public String toFullString() {
String result;
if(hasNoStringCache() || (result = stringCache.fullString) == null) {
stringCache.fullString = result = toNormalizedString(IPv4StringCache.fullParams);
}
return result;
} | [
"@",
"Override",
"public",
"String",
"toFullString",
"(",
")",
"{",
"String",
"result",
";",
"if",
"(",
"hasNoStringCache",
"(",
")",
"||",
"(",
"result",
"=",
"stringCache",
".",
"fullString",
")",
"==",
"null",
")",
"{",
"stringCache",
".",
"fullString",... | This produces a string with no compressed segments and all segments of full length,
which is 3 characters for IPv4 segments. | [
"This",
"produces",
"a",
"string",
"with",
"no",
"compressed",
"segments",
"and",
"all",
"segments",
"of",
"full",
"length",
"which",
"is",
"3",
"characters",
"for",
"IPv4",
"segments",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4AddressSection.java#L1554-L1561 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/util/IPAddressPartConfiguredString.java | IPAddressPartConfiguredString.getNetworkStringMatcher | @SuppressWarnings("unchecked")
public <S extends IPAddressPartConfiguredString<T, P>> SQLStringMatcher<T, P, S> getNetworkStringMatcher(boolean isEntireAddress, IPAddressSQLTranslator translator) {
return new SQLStringMatcher<T, P, S>((S) this, isEntireAddress, translator);
} | java | @SuppressWarnings("unchecked")
public <S extends IPAddressPartConfiguredString<T, P>> SQLStringMatcher<T, P, S> getNetworkStringMatcher(boolean isEntireAddress, IPAddressSQLTranslator translator) {
return new SQLStringMatcher<T, P, S>((S) this, isEntireAddress, translator);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"S",
"extends",
"IPAddressPartConfiguredString",
"<",
"T",
",",
"P",
">",
">",
"SQLStringMatcher",
"<",
"T",
",",
"P",
",",
"S",
">",
"getNetworkStringMatcher",
"(",
"boolean",
"isEntireAddress",... | Provides an object that can build SQL clauses to match this string representation.
This method can be overridden for other IP address types to match in their own ways.
@param isEntireAddress
@param translator
@return | [
"Provides",
"an",
"object",
"that",
"can",
"build",
"SQL",
"clauses",
"to",
"match",
"this",
"string",
"representation",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/util/IPAddressPartConfiguredString.java#L61-L64 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java | IPAddressString.isValid | public boolean isValid() {
if(addressProvider.isUninitialized()) {
try {
validate();
return true;
} catch(AddressStringException e) {
return false;
}
}
return !addressProvider.isInvalid();
} | java | public boolean isValid() {
if(addressProvider.isUninitialized()) {
try {
validate();
return true;
} catch(AddressStringException e) {
return false;
}
}
return !addressProvider.isInvalid();
} | [
"public",
"boolean",
"isValid",
"(",
")",
"{",
"if",
"(",
"addressProvider",
".",
"isUninitialized",
"(",
")",
")",
"{",
"try",
"{",
"validate",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"AddressStringException",
"e",
")",
"{",
"return",
... | Returns whether this is a valid address string format.
The accepted IP address formats are:
an IPv4 address, an IPv6 address, a network prefix alone, the address representing all addresses of all types, or an empty string.
If this method returns false, and you want more details, call validate() and examine the thrown ... | [
"Returns",
"whether",
"this",
"is",
"a",
"valid",
"address",
"string",
"format",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java#L382-L392 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java | IPAddressString.compareTo | @Override
public int compareTo(IPAddressString other) {
if(this == other) {
return 0;
}
boolean isValid = isValid();
boolean otherIsValid = other.isValid();
if(!isValid && !otherIsValid) {
return toString().compareTo(other.toString());
}
return addressProvider.providerCompare(other.addressProvider)... | java | @Override
public int compareTo(IPAddressString other) {
if(this == other) {
return 0;
}
boolean isValid = isValid();
boolean otherIsValid = other.isValid();
if(!isValid && !otherIsValid) {
return toString().compareTo(other.toString());
}
return addressProvider.providerCompare(other.addressProvider)... | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"IPAddressString",
"other",
")",
"{",
"if",
"(",
"this",
"==",
"other",
")",
"{",
"return",
"0",
";",
"}",
"boolean",
"isValid",
"=",
"isValid",
"(",
")",
";",
"boolean",
"otherIsValid",
"=",
"other",
... | All address strings are comparable. If two address strings are invalid, their strings are compared.
Otherwise, address strings are compared according to which type or version of string, and then within each type or version
they are compared using the comparison rules for addresses.
@param other
@return | [
"All",
"address",
"strings",
"are",
"comparable",
".",
"If",
"two",
"address",
"strings",
"are",
"invalid",
"their",
"strings",
"are",
"compared",
".",
"Otherwise",
"address",
"strings",
"are",
"compared",
"according",
"to",
"which",
"type",
"or",
"version",
"... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java#L517-L528 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java | IPAddressString.convertToPrefixLength | public String convertToPrefixLength() throws AddressStringException {
IPAddress address = toAddress();
Integer prefix;
if(address == null) {
if(isPrefixOnly()) {
prefix = getNetworkPrefixLength();
} else {
return null;
}
} else {
prefix = address.getBlockMaskPrefixLength(true);
if(prefix ... | java | public String convertToPrefixLength() throws AddressStringException {
IPAddress address = toAddress();
Integer prefix;
if(address == null) {
if(isPrefixOnly()) {
prefix = getNetworkPrefixLength();
} else {
return null;
}
} else {
prefix = address.getBlockMaskPrefixLength(true);
if(prefix ... | [
"public",
"String",
"convertToPrefixLength",
"(",
")",
"throws",
"AddressStringException",
"{",
"IPAddress",
"address",
"=",
"toAddress",
"(",
")",
";",
"Integer",
"prefix",
";",
"if",
"(",
"address",
"==",
"null",
")",
"{",
"if",
"(",
"isPrefixOnly",
"(",
"... | Converts this address to a prefix length
@return the prefix of the indicated IP type represented by this address or null if this address is valid but cannot be represented by a network prefix length
@throws AddressStringException if the address is invalid | [
"Converts",
"this",
"address",
"to",
"a",
"prefix",
"length"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java#L1044-L1061 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java | IPAddressDivisionGrouping.getTrailingBitCount | public int getTrailingBitCount(boolean network) {
int count = getDivisionCount();
if(count == 0) {
return 0;
}
long back = network ? 0 : getDivision(0).getMaxValue();
int bitLen = 0;
for(int i = count - 1; i >= 0; i--) {
IPAddressDivision seg = getDivision(i);
long value = seg.getDivisionValue();
... | java | public int getTrailingBitCount(boolean network) {
int count = getDivisionCount();
if(count == 0) {
return 0;
}
long back = network ? 0 : getDivision(0).getMaxValue();
int bitLen = 0;
for(int i = count - 1; i >= 0; i--) {
IPAddressDivision seg = getDivision(i);
long value = seg.getDivisionValue();
... | [
"public",
"int",
"getTrailingBitCount",
"(",
"boolean",
"network",
")",
"{",
"int",
"count",
"=",
"getDivisionCount",
"(",
")",
";",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"long",
"back",
"=",
"network",
"?",
"0",
":",
"get... | Returns the number of consecutive trailing one or zero bits.
If network is true, returns the number of consecutive trailing zero bits.
Otherwise, returns the number of consecutive trailing one bits.
@param network
@return | [
"Returns",
"the",
"number",
"of",
"consecutive",
"trailing",
"one",
"or",
"zero",
"bits",
".",
"If",
"network",
"is",
"true",
"returns",
"the",
"number",
"of",
"consecutive",
"trailing",
"zero",
"bits",
".",
"Otherwise",
"returns",
"the",
"number",
"of",
"co... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java#L177-L193 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java | IPAddressDivisionGrouping.getLeadingBitCount | public int getLeadingBitCount(boolean network) {
int count = getDivisionCount();
if(count == 0) {
return 0;
}
long front = network ? getDivision(0).getMaxValue() : 0;
int prefixLen = 0;
for(int i = 0; i < count; i++) {
IPAddressDivision seg = getDivision(i);
long value = seg.getDivisionValue();
... | java | public int getLeadingBitCount(boolean network) {
int count = getDivisionCount();
if(count == 0) {
return 0;
}
long front = network ? getDivision(0).getMaxValue() : 0;
int prefixLen = 0;
for(int i = 0; i < count; i++) {
IPAddressDivision seg = getDivision(i);
long value = seg.getDivisionValue();
... | [
"public",
"int",
"getLeadingBitCount",
"(",
"boolean",
"network",
")",
"{",
"int",
"count",
"=",
"getDivisionCount",
"(",
")",
";",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"long",
"front",
"=",
"network",
"?",
"getDivision",
"... | Returns the number of consecutive leading one or zero bits.
If network is true, returns the number of consecutive leading one bits.
Otherwise, returns the number of consecutive leading zero bits.
@param network
@return | [
"Returns",
"the",
"number",
"of",
"consecutive",
"leading",
"one",
"or",
"zero",
"bits",
".",
"If",
"network",
"is",
"true",
"returns",
"the",
"number",
"of",
"consecutive",
"leading",
"one",
"bits",
".",
"Otherwise",
"returns",
"the",
"number",
"of",
"conse... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java#L203-L219 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java | IPAddressDivisionGrouping.isPrefixBlock | @Override
public boolean isPrefixBlock() {
Integer networkPrefixLength = getNetworkPrefixLength();
if(networkPrefixLength == null) {
return false;
}
if(getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()) {
return true;
}
return containsPrefixBlock(networkPrefixLength);
} | java | @Override
public boolean isPrefixBlock() {
Integer networkPrefixLength = getNetworkPrefixLength();
if(networkPrefixLength == null) {
return false;
}
if(getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()) {
return true;
}
return containsPrefixBlock(networkPrefixLength);
} | [
"@",
"Override",
"public",
"boolean",
"isPrefixBlock",
"(",
")",
"{",
"Integer",
"networkPrefixLength",
"=",
"getNetworkPrefixLength",
"(",
")",
";",
"if",
"(",
"networkPrefixLength",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"getNetwork"... | Returns whether this address section represents a subnet block of addresses associated its prefix length.
Returns false if it has no prefix length, if it is a single address with a prefix length (ie not a subnet), or if it is a range of addresses that does not include
the entire subnet block for its prefix length.
If... | [
"Returns",
"whether",
"this",
"address",
"section",
"represents",
"a",
"subnet",
"block",
"of",
"addresses",
"associated",
"its",
"prefix",
"length",
"."
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java#L231-L241 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java | IPAddressDivisionGrouping.isSinglePrefixBlock | @Override
public boolean isSinglePrefixBlock() {
Integer networkPrefixLength = getNetworkPrefixLength();
if(networkPrefixLength == null) {
return false;
}
return containsSinglePrefixBlock(networkPrefixLength);
} | java | @Override
public boolean isSinglePrefixBlock() {
Integer networkPrefixLength = getNetworkPrefixLength();
if(networkPrefixLength == null) {
return false;
}
return containsSinglePrefixBlock(networkPrefixLength);
} | [
"@",
"Override",
"public",
"boolean",
"isSinglePrefixBlock",
"(",
")",
"{",
"Integer",
"networkPrefixLength",
"=",
"getNetworkPrefixLength",
"(",
")",
";",
"if",
"(",
"networkPrefixLength",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"contains... | Returns whether the division grouping range matches the block of values for its prefix length.
In other words, returns true if and only if it has a prefix length and it has just a single prefix. | [
"Returns",
"whether",
"the",
"division",
"grouping",
"range",
"matches",
"the",
"block",
"of",
"values",
"for",
"its",
"prefix",
"length",
".",
"In",
"other",
"words",
"returns",
"true",
"if",
"and",
"only",
"if",
"it",
"has",
"a",
"prefix",
"length",
"and... | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/IPAddressDivisionGrouping.java#L257-L264 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4Address.java | IPv4Address.getIPv6Address | public IPv6Address getIPv6Address(IPv6AddressSegment segs[]) {
IPv6AddressCreator creator = getIPv6Network().getAddressCreator();
return creator.createAddress(IPv6AddressSection.createSection(creator, segs, this)); /* address creation */
} | java | public IPv6Address getIPv6Address(IPv6AddressSegment segs[]) {
IPv6AddressCreator creator = getIPv6Network().getAddressCreator();
return creator.createAddress(IPv6AddressSection.createSection(creator, segs, this)); /* address creation */
} | [
"public",
"IPv6Address",
"getIPv6Address",
"(",
"IPv6AddressSegment",
"segs",
"[",
"]",
")",
"{",
"IPv6AddressCreator",
"creator",
"=",
"getIPv6Network",
"(",
")",
".",
"getAddressCreator",
"(",
")",
";",
"return",
"creator",
".",
"createAddress",
"(",
"IPv6Addres... | Create an IPv6 mixed address using the given ipv6 segments and using this address for the embedded IPv4 segments
@param segs
@return | [
"Create",
"an",
"IPv6",
"mixed",
"address",
"using",
"the",
"given",
"ipv6",
"segments",
"and",
"using",
"this",
"address",
"for",
"the",
"embedded",
"IPv4",
"segments"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4Address.java#L341-L344 | train |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4Address.java | IPv4Address.isPrivate | public boolean isPrivate() {
// refer to RFC 1918
// 10/8 prefix
// 172.16/12 prefix (172.16.0.0 – 172.31.255.255)
// 192.168/16 prefix
IPv4AddressSegment seg0 = getSegment(0);
IPv4AddressSegment seg1 = getSegment(1);
return seg0.matches(10)
|| seg0.matches(172) && seg1.matchesWithPre... | java | public boolean isPrivate() {
// refer to RFC 1918
// 10/8 prefix
// 172.16/12 prefix (172.16.0.0 – 172.31.255.255)
// 192.168/16 prefix
IPv4AddressSegment seg0 = getSegment(0);
IPv4AddressSegment seg1 = getSegment(1);
return seg0.matches(10)
|| seg0.matches(172) && seg1.matchesWithPre... | [
"public",
"boolean",
"isPrivate",
"(",
")",
"{",
"// refer to RFC 1918",
"// 10/8 prefix",
"// 172.16/12 prefix (172.16.0.0 – 172.31.255.255)",
"// 192.168/16 prefix",
"IPv4AddressSegment",
"seg0",
"=",
"getSegment",
"(",
"0",
")",
";",
"IPv4AddressSegment",
"seg1",
"=",
"g... | Unicast addresses allocated for private use
@see java.net.InetAddress#isSiteLocalAddress() | [
"Unicast",
"addresses",
"allocated",
"for",
"private",
"use"
] | 90493d0673511d673100c36d020dd93dd870111a | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv4/IPv4Address.java#L919-L929 | train |
camunda/camunda-spin | dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java | JacksonJsonLogger.unableToParseValue | public SpinJsonDataFormatException unableToParseValue(String expectedType, JsonNodeType type) {
return new SpinJsonDataFormatException(exceptionMessage("002", "Expected '{}', got '{}'", expectedType, type.toString()));
} | java | public SpinJsonDataFormatException unableToParseValue(String expectedType, JsonNodeType type) {
return new SpinJsonDataFormatException(exceptionMessage("002", "Expected '{}', got '{}'", expectedType, type.toString()));
} | [
"public",
"SpinJsonDataFormatException",
"unableToParseValue",
"(",
"String",
"expectedType",
",",
"JsonNodeType",
"type",
")",
"{",
"return",
"new",
"SpinJsonDataFormatException",
"(",
"exceptionMessage",
"(",
"\"002\"",
",",
"\"Expected '{}', got '{}'\"",
",",
"expectedTy... | Exception handler if we are unable to parse a json value into a java representation
@param expectedType Name of the expected Type
@param type Type of the json node
@return SpinJsonDataFormatException | [
"Exception",
"handler",
"if",
"we",
"are",
"unable",
"to",
"parse",
"a",
"json",
"value",
"into",
"a",
"java",
"representation"
] | cfe65161eb97fd5023a945cb97c47fbfe69e9fdd | https://github.com/camunda/camunda-spin/blob/cfe65161eb97fd5023a945cb97c47fbfe69e9fdd/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java#L52-L54 | train |
camunda/camunda-spin | dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElement.java | DomXmlElement.adoptElement | protected void adoptElement(DomXmlElement elementToAdopt) {
Document document = this.domElement.getOwnerDocument();
Element element = elementToAdopt.domElement;
if (!document.equals(element.getOwnerDocument())) {
Node node = document.adoptNode(element);
if (node == null) {
throw LOG.una... | java | protected void adoptElement(DomXmlElement elementToAdopt) {
Document document = this.domElement.getOwnerDocument();
Element element = elementToAdopt.domElement;
if (!document.equals(element.getOwnerDocument())) {
Node node = document.adoptNode(element);
if (node == null) {
throw LOG.una... | [
"protected",
"void",
"adoptElement",
"(",
"DomXmlElement",
"elementToAdopt",
")",
"{",
"Document",
"document",
"=",
"this",
".",
"domElement",
".",
"getOwnerDocument",
"(",
")",
";",
"Element",
"element",
"=",
"elementToAdopt",
".",
"domElement",
";",
"if",
"(",... | Adopts an xml dom element to the owner document of this element if necessary.
@param elementToAdopt the element to adopt | [
"Adopts",
"an",
"xml",
"dom",
"element",
"to",
"the",
"owner",
"document",
"of",
"this",
"element",
"if",
"necessary",
"."
] | cfe65161eb97fd5023a945cb97c47fbfe69e9fdd | https://github.com/camunda/camunda-spin/blob/cfe65161eb97fd5023a945cb97c47fbfe69e9fdd/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElement.java#L357-L367 | train |
camunda/camunda-spin | dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/util/DomXmlEnsure.java | DomXmlEnsure.ensureChildElement | public static void ensureChildElement(DomXmlElement parentElement, DomXmlElement childElement) {
Node parent = childElement.unwrap().getParentNode();
if (parent == null || !parentElement.unwrap().isEqualNode(parent)) {
throw LOG.elementIsNotChildOfThisElement(childElement, parentElement);
}
} | java | public static void ensureChildElement(DomXmlElement parentElement, DomXmlElement childElement) {
Node parent = childElement.unwrap().getParentNode();
if (parent == null || !parentElement.unwrap().isEqualNode(parent)) {
throw LOG.elementIsNotChildOfThisElement(childElement, parentElement);
}
} | [
"public",
"static",
"void",
"ensureChildElement",
"(",
"DomXmlElement",
"parentElement",
",",
"DomXmlElement",
"childElement",
")",
"{",
"Node",
"parent",
"=",
"childElement",
".",
"unwrap",
"(",
")",
".",
"getParentNode",
"(",
")",
";",
"if",
"(",
"parent",
"... | Ensures that the element is child element of the parent element.
@param parentElement the parent xml dom element
@param childElement the child element
@throws SpinXmlElementException if the element is not child of the parent element | [
"Ensures",
"that",
"the",
"element",
"is",
"child",
"element",
"of",
"the",
"parent",
"element",
"."
] | cfe65161eb97fd5023a945cb97c47fbfe69e9fdd | https://github.com/camunda/camunda-spin/blob/cfe65161eb97fd5023a945cb97c47fbfe69e9fdd/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/util/DomXmlEnsure.java#L46-L51 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.