id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,300 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/FileUtils.java | FileUtils.createGetContentIntent | public static Intent createGetContentIntent() {
// Implicitly allow the user to select a particular kind of data
final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
// The MIME data type filter
intent.setType("*/*");
// Only return URIs that can be opened with ContentRes... | java | public static Intent createGetContentIntent() {
// Implicitly allow the user to select a particular kind of data
final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
// The MIME data type filter
intent.setType("*/*");
// Only return URIs that can be opened with ContentRes... | [
"public",
"static",
"Intent",
"createGetContentIntent",
"(",
")",
"{",
"// Implicitly allow the user to select a particular kind of data",
"final",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"Intent",
".",
"ACTION_GET_CONTENT",
")",
";",
"// The MIME data type filter",
... | Get the Intent for selecting content to be used in an Intent Chooser.
@return The intent for opening a file with Intent.createChooser()
@author paulburke | [
"Get",
"the",
"Intent",
"for",
"selecting",
"content",
"to",
"be",
"used",
"in",
"an",
"Intent",
"Chooser",
"."
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/FileUtils.java#L513-L521 |
32,301 | Tourenathan-G5organisation/SiliCompressor | app/src/main/java/com/iceteck/silicompressor/SelectPictureActivity.java | SelectPictureActivity.requestPermissions | private void requestPermissions(int mediaType) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
if (mediaType == TYPE_IMAGE) {
ActivityCompat.requestPermissions(this,
... | java | private void requestPermissions(int mediaType) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
if (mediaType == TYPE_IMAGE) {
ActivityCompat.requestPermissions(this,
... | [
"private",
"void",
"requestPermissions",
"(",
"int",
"mediaType",
")",
"{",
"if",
"(",
"ContextCompat",
".",
"checkSelfPermission",
"(",
"this",
",",
"Manifest",
".",
"permission",
".",
"WRITE_EXTERNAL_STORAGE",
")",
"!=",
"PackageManager",
".",
"PERMISSION_GRANTED"... | Request Permission for writing to External Storage in 6.0 and up | [
"Request",
"Permission",
"for",
"writing",
"to",
"External",
"Storage",
"in",
"6",
".",
"0",
"and",
"up"
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/app/src/main/java/com/iceteck/silicompressor/SelectPictureActivity.java#L86-L109 |
32,302 | Tourenathan-G5organisation/SiliCompressor | app/src/main/java/com/iceteck/silicompressor/SelectPictureActivity.java | SelectPictureActivity.onActivityResult | @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//verify if the image was gotten successfully
if (requestCode == REQUEST_TAKE_CAMERA_PHOTO && resultCode == Activity.RESULT_OK) {
new I... | java | @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//verify if the image was gotten successfully
if (requestCode == REQUEST_TAKE_CAMERA_PHOTO && resultCode == Activity.RESULT_OK) {
new I... | [
"@",
"Override",
"public",
"void",
"onActivityResult",
"(",
"int",
"requestCode",
",",
"int",
"resultCode",
",",
"Intent",
"data",
")",
"{",
"super",
".",
"onActivityResult",
"(",
"requestCode",
",",
"resultCode",
",",
"data",
")",
";",
"//verify if the image wa... | Method which will process the captured image | [
"Method",
"which",
"will",
"process",
"the",
"captured",
"image"
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/app/src/main/java/com/iceteck/silicompressor/SelectPictureActivity.java#L223-L246 |
32,303 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.with | public static SiliCompressor with(Context context) {
if (singleton == null) {
synchronized (SiliCompressor.class) {
if (singleton == null) {
singleton = new Builder(context).build();
}
}
}
return singleton;
} | java | public static SiliCompressor with(Context context) {
if (singleton == null) {
synchronized (SiliCompressor.class) {
if (singleton == null) {
singleton = new Builder(context).build();
}
}
}
return singleton;
} | [
"public",
"static",
"SiliCompressor",
"with",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"singleton",
"==",
"null",
")",
"{",
"synchronized",
"(",
"SiliCompressor",
".",
"class",
")",
"{",
"if",
"(",
"singleton",
"==",
"null",
")",
"{",
"singleton",
... | initialise the class and set the context | [
"initialise",
"the",
"class",
"and",
"set",
"the",
"context"
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L50-L60 |
32,304 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.compress | public String compress(String imagePath, File destination, boolean deleteSourceImage) {
String compressedImagePath = compressImage(imagePath, destination);
if (deleteSourceImage) {
boolean isdeleted = deleteImageFile(imagePath);
Log.d(LOG_TAG, (isdeleted) ? "Source image file d... | java | public String compress(String imagePath, File destination, boolean deleteSourceImage) {
String compressedImagePath = compressImage(imagePath, destination);
if (deleteSourceImage) {
boolean isdeleted = deleteImageFile(imagePath);
Log.d(LOG_TAG, (isdeleted) ? "Source image file d... | [
"public",
"String",
"compress",
"(",
"String",
"imagePath",
",",
"File",
"destination",
",",
"boolean",
"deleteSourceImage",
")",
"{",
"String",
"compressedImagePath",
"=",
"compressImage",
"(",
"imagePath",
",",
"destination",
")",
";",
"if",
"(",
"deleteSourceIm... | Compress the image at with the specified path and return the filepath of the compressed image.
@param imagePath The path of the image you wish to compress.
@param destination The destination directory where the compressed image will be stored.
@param deleteSourceImage if True will delete the original fil... | [
"Compress",
"the",
"image",
"at",
"with",
"the",
"specified",
"path",
"and",
"return",
"the",
"filepath",
"of",
"the",
"compressed",
"image",
"."
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L81-L92 |
32,305 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.compress | public String compress(int drawableID) throws IOException {
// Create a bitmap from this drawable
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getApplicationContext().getResources(), drawableID);
if (null != bitmap) {
// Create a file from the bitmap
// Create ... | java | public String compress(int drawableID) throws IOException {
// Create a bitmap from this drawable
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getApplicationContext().getResources(), drawableID);
if (null != bitmap) {
// Create a file from the bitmap
// Create ... | [
"public",
"String",
"compress",
"(",
"int",
"drawableID",
")",
"throws",
"IOException",
"{",
"// Create a bitmap from this drawable",
"Bitmap",
"bitmap",
"=",
"BitmapFactory",
".",
"decodeResource",
"(",
"mContext",
".",
"getApplicationContext",
"(",
")",
".",
"getRes... | Compress drawable file with specified drawableID
@param drawableID ID of the drawable file to compress
@return The path to the compressed file or null if the could not access drawable file
@throws IOException | [
"Compress",
"drawable",
"file",
"with",
"specified",
"drawableID"
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L101-L136 |
32,306 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.getCompressBitmap | public Bitmap getCompressBitmap(String imagePath, boolean deleteSourceImage) throws IOException {
File imageFile = new File(compressImage(imagePath, new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Silicompressor/images")));
Uri newImageUri = FileProvider.getUriFo... | java | public Bitmap getCompressBitmap(String imagePath, boolean deleteSourceImage) throws IOException {
File imageFile = new File(compressImage(imagePath, new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Silicompressor/images")));
Uri newImageUri = FileProvider.getUriFo... | [
"public",
"Bitmap",
"getCompressBitmap",
"(",
"String",
"imagePath",
",",
"boolean",
"deleteSourceImage",
")",
"throws",
"IOException",
"{",
"File",
"imageFile",
"=",
"new",
"File",
"(",
"compressImage",
"(",
"imagePath",
",",
"new",
"File",
"(",
"Environment",
... | Compress the image at with the specified path and return the bitmap data of the compressed image.
@param imagePath The path of the image file you wish to compress.
@param deleteSourceImage If True will delete the source file
@return Compress image bitmap
@throws IOException | [
"Compress",
"the",
"image",
"at",
"with",
"the",
"specified",
"path",
"and",
"return",
"the",
"bitmap",
"data",
"of",
"the",
"compressed",
"image",
"."
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L161-L178 |
32,307 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.compressVideo | public String compressVideo(String videoFilePath, String destinationDir) throws URISyntaxException {
return compressVideo(videoFilePath, destinationDir, 0, 0, 0);
} | java | public String compressVideo(String videoFilePath, String destinationDir) throws URISyntaxException {
return compressVideo(videoFilePath, destinationDir, 0, 0, 0);
} | [
"public",
"String",
"compressVideo",
"(",
"String",
"videoFilePath",
",",
"String",
"destinationDir",
")",
"throws",
"URISyntaxException",
"{",
"return",
"compressVideo",
"(",
"videoFilePath",
",",
"destinationDir",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"}"
] | Perform background video compression. Make sure the videofileUri and destinationUri are valid
resources because this method does not account for missing directories hence your converted file
could be in an unknown location
This uses default values for the converted videos
@param videoFilePath source path for the vide... | [
"Perform",
"background",
"video",
"compression",
".",
"Make",
"sure",
"the",
"videofileUri",
"and",
"destinationUri",
"are",
"valid",
"resources",
"because",
"this",
"method",
"does",
"not",
"account",
"for",
"missing",
"directories",
"hence",
"your",
"converted",
... | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L315-L317 |
32,308 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.compressVideo | public String compressVideo(String videoFilePath, String destinationDir, int outWidth, int outHeight, int bitrate) throws URISyntaxException {
boolean isconverted = MediaController.getInstance().convertVideo(videoFilePath, new File(destinationDir), outWidth, outHeight, bitrate);
if (isconverted) {
... | java | public String compressVideo(String videoFilePath, String destinationDir, int outWidth, int outHeight, int bitrate) throws URISyntaxException {
boolean isconverted = MediaController.getInstance().convertVideo(videoFilePath, new File(destinationDir), outWidth, outHeight, bitrate);
if (isconverted) {
... | [
"public",
"String",
"compressVideo",
"(",
"String",
"videoFilePath",
",",
"String",
"destinationDir",
",",
"int",
"outWidth",
",",
"int",
"outHeight",
",",
"int",
"bitrate",
")",
"throws",
"URISyntaxException",
"{",
"boolean",
"isconverted",
"=",
"MediaController",
... | Perform background video compression. Make sure the videofileUri and destinationUri are valid
resources because this method does not account for missing directories hence your converted file
could be in an unknown location
@param videoFilePath source path for the video file
@param destinationDir destination directory... | [
"Perform",
"background",
"video",
"compression",
".",
"Make",
"sure",
"the",
"videofileUri",
"and",
"destinationUri",
"are",
"valid",
"resources",
"because",
"this",
"method",
"does",
"not",
"account",
"for",
"missing",
"directories",
"hence",
"your",
"converted",
... | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L332-L342 |
32,309 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.getFilename | private String getFilename(String filename, File file) {
if (!file.exists()) {
file.mkdirs();
}
String ext = ".jpg";
//get extension
/*if (Pattern.matches("^[.][p][n][g]", filename)){
ext = ".png";
}*/
return (file.getAbsolutePath() + "/IM... | java | private String getFilename(String filename, File file) {
if (!file.exists()) {
file.mkdirs();
}
String ext = ".jpg";
//get extension
/*if (Pattern.matches("^[.][p][n][g]", filename)){
ext = ".png";
}*/
return (file.getAbsolutePath() + "/IM... | [
"private",
"String",
"getFilename",
"(",
"String",
"filename",
",",
"File",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"file",
".",
"mkdirs",
"(",
")",
";",
"}",
"String",
"ext",
"=",
"\".jpg\"",
";",
"//get extensio... | Get the file path of the compressed file
@param filename
@param file Destination directory
@return | [
"Get",
"the",
"file",
"path",
"of",
"the",
"compressed",
"file"
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L371-L383 |
32,310 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.getRealPathFromURI | private String getRealPathFromURI(String contentURI) {
Uri contentUri = Uri.parse(contentURI);
Cursor cursor = mContext.getContentResolver().query(contentUri, null, null, null, null);
if (cursor == null) {
return contentUri.getPath();
} else {
cursor.moveToFirst()... | java | private String getRealPathFromURI(String contentURI) {
Uri contentUri = Uri.parse(contentURI);
Cursor cursor = mContext.getContentResolver().query(contentUri, null, null, null, null);
if (cursor == null) {
return contentUri.getPath();
} else {
cursor.moveToFirst()... | [
"private",
"String",
"getRealPathFromURI",
"(",
"String",
"contentURI",
")",
"{",
"Uri",
"contentUri",
"=",
"Uri",
".",
"parse",
"(",
"contentURI",
")",
";",
"Cursor",
"cursor",
"=",
"mContext",
".",
"getContentResolver",
"(",
")",
".",
"query",
"(",
"conten... | Gets a valid path from the supply contentURI
@param contentURI
@return A validPath of the image | [
"Gets",
"a",
"valid",
"path",
"from",
"the",
"supply",
"contentURI"
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L391-L407 |
32,311 | Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.deleteImageFile | static boolean deleteImageFile(String imagePath) {
// Get the file
File imageFile = new File(imagePath);
boolean deleted = false;
// Delete the image
if (imageFile.exists()) {
deleted = imageFile.delete();
}
return deleted;
} | java | static boolean deleteImageFile(String imagePath) {
// Get the file
File imageFile = new File(imagePath);
boolean deleted = false;
// Delete the image
if (imageFile.exists()) {
deleted = imageFile.delete();
}
return deleted;
} | [
"static",
"boolean",
"deleteImageFile",
"(",
"String",
"imagePath",
")",
"{",
"// Get the file",
"File",
"imageFile",
"=",
"new",
"File",
"(",
"imagePath",
")",
";",
"boolean",
"deleted",
"=",
"false",
";",
"// Delete the image",
"if",
"(",
"imageFile",
".",
"... | Deletes image file for a given path.
@param imagePath The path of the photo to be deleted.
@return True if the file is deleted and False otherwise | [
"Deletes",
"image",
"file",
"for",
"a",
"given",
"path",
"."
] | 546f6cd7b2a7a783e1122df46c1e237f8938fe72 | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L446-L457 |
32,312 | datastax/spark-cassandra-connector | spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/rdd/CassandraTableScanJavaRDD.java | CassandraTableScanJavaRDD.keyBy | public <K> CassandraJavaPairRDD<K, R> keyBy(
ClassTag<K> keyClassTag,
RowReaderFactory<K> rrf,
RowWriterFactory<K> rwf,
ColumnRef... columns) {
Seq<ColumnRef> columnRefs = JavaApiHelper.toScalaSeq(columns);
CassandraRDD<Tuple2<K, R>> resultRDD =
columns.l... | java | public <K> CassandraJavaPairRDD<K, R> keyBy(
ClassTag<K> keyClassTag,
RowReaderFactory<K> rrf,
RowWriterFactory<K> rwf,
ColumnRef... columns) {
Seq<ColumnRef> columnRefs = JavaApiHelper.toScalaSeq(columns);
CassandraRDD<Tuple2<K, R>> resultRDD =
columns.l... | [
"public",
"<",
"K",
">",
"CassandraJavaPairRDD",
"<",
"K",
",",
"R",
">",
"keyBy",
"(",
"ClassTag",
"<",
"K",
">",
"keyClassTag",
",",
"RowReaderFactory",
"<",
"K",
">",
"rrf",
",",
"RowWriterFactory",
"<",
"K",
">",
"rwf",
",",
"ColumnRef",
"...",
"co... | Selects a subset of columns mapped to the key of a JavaPairRDD.
The selected columns must be available in the CassandraRDD.
If no selected columns are given, all available columns are selected.
@param rrf row reader factory to convert the key to desired type K
@param rwf row writer factory for creating a partitioner f... | [
"Selects",
"a",
"subset",
"of",
"columns",
"mapped",
"to",
"the",
"key",
"of",
"a",
"JavaPairRDD",
".",
"The",
"selected",
"columns",
"must",
"be",
"available",
"in",
"the",
"CassandraRDD",
".",
"If",
"no",
"selected",
"columns",
"are",
"given",
"all",
"av... | 23c09965c34576e17b4315772eb78af399ec9df1 | https://github.com/datastax/spark-cassandra-connector/blob/23c09965c34576e17b4315772eb78af399ec9df1/spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/rdd/CassandraTableScanJavaRDD.java#L91-L103 |
32,313 | datastax/spark-cassandra-connector | spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/PairRDDJavaFunctions.java | PairRDDJavaFunctions.spanByKey | public JavaPairRDD<K, Collection<V>> spanByKey(ClassTag<K> keyClassTag) {
ClassTag<Tuple2<K, Collection<V>>> tupleClassTag = classTag(Tuple2.class);
ClassTag<Collection<V>> vClassTag = classTag(Collection.class);
RDD<Tuple2<K, Collection<V>>> newRDD = pairRDDFunctions.spanByKey()
... | java | public JavaPairRDD<K, Collection<V>> spanByKey(ClassTag<K> keyClassTag) {
ClassTag<Tuple2<K, Collection<V>>> tupleClassTag = classTag(Tuple2.class);
ClassTag<Collection<V>> vClassTag = classTag(Collection.class);
RDD<Tuple2<K, Collection<V>>> newRDD = pairRDDFunctions.spanByKey()
... | [
"public",
"JavaPairRDD",
"<",
"K",
",",
"Collection",
"<",
"V",
">",
">",
"spanByKey",
"(",
"ClassTag",
"<",
"K",
">",
"keyClassTag",
")",
"{",
"ClassTag",
"<",
"Tuple2",
"<",
"K",
",",
"Collection",
"<",
"V",
">",
">",
">",
"tupleClassTag",
"=",
"cl... | Groups items with the same key, assuming the items with the same key are next to each other in the
collection. It does not perform shuffle, therefore it is much faster than using much more
universal Spark RDD `groupByKey`. For this method to be useful with Cassandra tables, the key must
represent a prefix of the primar... | [
"Groups",
"items",
"with",
"the",
"same",
"key",
"assuming",
"the",
"items",
"with",
"the",
"same",
"key",
"are",
"next",
"to",
"each",
"other",
"in",
"the",
"collection",
".",
"It",
"does",
"not",
"perform",
"shuffle",
"therefore",
"it",
"is",
"much",
"... | 23c09965c34576e17b4315772eb78af399ec9df1 | https://github.com/datastax/spark-cassandra-connector/blob/23c09965c34576e17b4315772eb78af399ec9df1/spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/PairRDDJavaFunctions.java#L31-L38 |
32,314 | datastax/spark-cassandra-connector | spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/rdd/CassandraJavaRDD.java | CassandraJavaRDD.selectedColumnRefs | @SuppressWarnings("RedundantCast")
public ColumnRef[] selectedColumnRefs() {
ClassTag<ColumnRef> classTag = getClassTag(ColumnRef.class);
return (ColumnRef[]) rdd().selectedColumnRefs().toArray(classTag);
} | java | @SuppressWarnings("RedundantCast")
public ColumnRef[] selectedColumnRefs() {
ClassTag<ColumnRef> classTag = getClassTag(ColumnRef.class);
return (ColumnRef[]) rdd().selectedColumnRefs().toArray(classTag);
} | [
"@",
"SuppressWarnings",
"(",
"\"RedundantCast\"",
")",
"public",
"ColumnRef",
"[",
"]",
"selectedColumnRefs",
"(",
")",
"{",
"ClassTag",
"<",
"ColumnRef",
">",
"classTag",
"=",
"getClassTag",
"(",
"ColumnRef",
".",
"class",
")",
";",
"return",
"(",
"ColumnRef... | Returns the columns to be selected from the table. | [
"Returns",
"the",
"columns",
"to",
"be",
"selected",
"from",
"the",
"table",
"."
] | 23c09965c34576e17b4315772eb78af399ec9df1 | https://github.com/datastax/spark-cassandra-connector/blob/23c09965c34576e17b4315772eb78af399ec9df1/spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/rdd/CassandraJavaRDD.java#L108-L112 |
32,315 | datastax/spark-cassandra-connector | spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/rdd/CassandraJavaRDD.java | CassandraJavaRDD.selectedColumnNames | @SuppressWarnings("RedundantCast")
public String[] selectedColumnNames() {
ClassTag<String> classTag = getClassTag(String.class);
return (String[]) rdd().selectedColumnNames().toArray(classTag);
} | java | @SuppressWarnings("RedundantCast")
public String[] selectedColumnNames() {
ClassTag<String> classTag = getClassTag(String.class);
return (String[]) rdd().selectedColumnNames().toArray(classTag);
} | [
"@",
"SuppressWarnings",
"(",
"\"RedundantCast\"",
")",
"public",
"String",
"[",
"]",
"selectedColumnNames",
"(",
")",
"{",
"ClassTag",
"<",
"String",
">",
"classTag",
"=",
"getClassTag",
"(",
"String",
".",
"class",
")",
";",
"return",
"(",
"String",
"[",
... | Returns the names of columns to be selected from the table. | [
"Returns",
"the",
"names",
"of",
"columns",
"to",
"be",
"selected",
"from",
"the",
"table",
"."
] | 23c09965c34576e17b4315772eb78af399ec9df1 | https://github.com/datastax/spark-cassandra-connector/blob/23c09965c34576e17b4315772eb78af399ec9df1/spark-cassandra-connector/src/main/java/com/datastax/spark/connector/japi/rdd/CassandraJavaRDD.java#L117-L121 |
32,316 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/VectorGraphicsEncoder.java | VectorGraphicsEncoder.addFileExtension | public static String addFileExtension(
String fileName, VectorGraphicsFormat vectorGraphicsFormat) {
String fileNameWithFileExtension = fileName;
final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase();
if (fileName.length() <= newFileExtension.length()
|| !fileNam... | java | public static String addFileExtension(
String fileName, VectorGraphicsFormat vectorGraphicsFormat) {
String fileNameWithFileExtension = fileName;
final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase();
if (fileName.length() <= newFileExtension.length()
|| !fileNam... | [
"public",
"static",
"String",
"addFileExtension",
"(",
"String",
"fileName",
",",
"VectorGraphicsFormat",
"vectorGraphicsFormat",
")",
"{",
"String",
"fileNameWithFileExtension",
"=",
"fileName",
";",
"final",
"String",
"newFileExtension",
"=",
"\".\"",
"+",
"vectorGrap... | Only adds the extension of the VectorGraphicsFormat to the filename if the filename doesn't
already have it.
@param fileName
@param vectorGraphicsFormat
@return filename (if extension already exists), otherwise;: filename + "." + extension | [
"Only",
"adds",
"the",
"extension",
"of",
"the",
"VectorGraphicsFormat",
"to",
"the",
"filename",
"if",
"the",
"filename",
"doesn",
"t",
"already",
"have",
"it",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/VectorGraphicsEncoder.java#L72-L84 |
32,317 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisPair.java | AxisPair.overrideMinMaxForXAxis | private void overrideMinMaxForXAxis() {
double overrideXAxisMinValue = xAxis.getMin();
double overrideXAxisMaxValue = xAxis.getMax();
// override min and maxValue if specified
if (chart.getStyler().getXAxisMin() != null) {
overrideXAxisMinValue = chart.getStyler().getXAxisMin();
}
if (ch... | java | private void overrideMinMaxForXAxis() {
double overrideXAxisMinValue = xAxis.getMin();
double overrideXAxisMaxValue = xAxis.getMax();
// override min and maxValue if specified
if (chart.getStyler().getXAxisMin() != null) {
overrideXAxisMinValue = chart.getStyler().getXAxisMin();
}
if (ch... | [
"private",
"void",
"overrideMinMaxForXAxis",
"(",
")",
"{",
"double",
"overrideXAxisMinValue",
"=",
"xAxis",
".",
"getMin",
"(",
")",
";",
"double",
"overrideXAxisMaxValue",
"=",
"xAxis",
".",
"getMax",
"(",
")",
";",
"// override min and maxValue if specified",
"if... | Here we can add special case min max calculations and take care of manual min max settings. | [
"Here",
"we",
"can",
"add",
"special",
"case",
"min",
"max",
"calculations",
"and",
"take",
"care",
"of",
"manual",
"min",
"max",
"settings",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisPair.java#L324-L339 |
32,318 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_.java | AxisTickCalculator_.willLabelsFitInTickSpaceHint | boolean willLabelsFitInTickSpaceHint(List<String> tickLabels, int tickSpacingHint) {
// Assume that for Y-Axis the ticks will all fit based on their tickSpace hint because the text
// is usually horizontal and "short". This more applies to the X-Axis.
if (this.axisDirection == Direction.Y) {
return t... | java | boolean willLabelsFitInTickSpaceHint(List<String> tickLabels, int tickSpacingHint) {
// Assume that for Y-Axis the ticks will all fit based on their tickSpace hint because the text
// is usually horizontal and "short". This more applies to the X-Axis.
if (this.axisDirection == Direction.Y) {
return t... | [
"boolean",
"willLabelsFitInTickSpaceHint",
"(",
"List",
"<",
"String",
">",
"tickLabels",
",",
"int",
"tickSpacingHint",
")",
"{",
"// Assume that for Y-Axis the ticks will all fit based on their tickSpace hint because the text",
"// is usually horizontal and \"short\". This more applies... | Given the generated tickLabels, will they fit side-by-side without overlapping each other and
looking bad? Sometimes the given tickSpacingHint is simply too small.
@param tickLabels
@param tickSpacingHint
@return | [
"Given",
"the",
"generated",
"tickLabels",
"will",
"they",
"fit",
"side",
"-",
"by",
"-",
"side",
"without",
"overlapping",
"each",
"other",
"and",
"looking",
"bad?",
"Sometimes",
"the",
"given",
"tickSpacingHint",
"is",
"simply",
"too",
"small",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_.java#L89-L125 |
32,319 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/QuickChart.java | QuickChart.getChart | public static XYChart getChart(
String chartTitle,
String xTitle,
String yTitle,
String[] seriesNames,
double[] xData,
double[][] yData) {
// Create Chart
XYChart chart = new XYChart(WIDTH, HEIGHT);
// Customize Chart
chart.setTitle(chartTitle);
chart.setXAxisTi... | java | public static XYChart getChart(
String chartTitle,
String xTitle,
String yTitle,
String[] seriesNames,
double[] xData,
double[][] yData) {
// Create Chart
XYChart chart = new XYChart(WIDTH, HEIGHT);
// Customize Chart
chart.setTitle(chartTitle);
chart.setXAxisTi... | [
"public",
"static",
"XYChart",
"getChart",
"(",
"String",
"chartTitle",
",",
"String",
"xTitle",
",",
"String",
"yTitle",
",",
"String",
"[",
"]",
"seriesNames",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"[",
"]",
"yData",
")",
"{",
"/... | Creates a Chart with multiple Series for the same X-Axis data with default style
@param chartTitle the Chart title
@param xTitle The X-Axis title
@param yTitle The Y-Axis title
@param seriesNames An array of the name of the multiple series
@param xData An array containing the X-Axis data
@param yData An array of doubl... | [
"Creates",
"a",
"Chart",
"with",
"multiple",
"Series",
"for",
"the",
"same",
"X",
"-",
"Axis",
"data",
"with",
"default",
"style"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/QuickChart.java#L57-L85 |
32,320 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/RadarChart.java | RadarChart.addSeries | public RadarSeries addSeries(String seriesName, double[] values, String[] tooltipOverrides) {
// Sanity checks
sanityCheck(seriesName, values, tooltipOverrides);
RadarSeries series = new RadarSeries(seriesName, values, tooltipOverrides);
seriesMap.put(seriesName, series);
return series;
} | java | public RadarSeries addSeries(String seriesName, double[] values, String[] tooltipOverrides) {
// Sanity checks
sanityCheck(seriesName, values, tooltipOverrides);
RadarSeries series = new RadarSeries(seriesName, values, tooltipOverrides);
seriesMap.put(seriesName, series);
return series;
} | [
"public",
"RadarSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"values",
",",
"String",
"[",
"]",
"tooltipOverrides",
")",
"{",
"// Sanity checks",
"sanityCheck",
"(",
"seriesName",
",",
"values",
",",
"tooltipOverrides",
")",
";",
... | Add a series for a Radar type chart
@param seriesName
@param values
@param tooltipOverrides
@return | [
"Add",
"a",
"series",
"for",
"a",
"Radar",
"type",
"chart"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/RadarChart.java#L87-L97 |
32,321 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVImporter.java | CSVImporter.getSeriesDataFromCSVRows | private static String[] getSeriesDataFromCSVRows(File csvFile) {
String[] xAndYData = new String[3];
BufferedReader bufferedReader = null;
try {
int counter = 0;
String line;
bufferedReader = new BufferedReader(new FileReader(csvFile));
while ((line = bufferedReader.readLine()) != ... | java | private static String[] getSeriesDataFromCSVRows(File csvFile) {
String[] xAndYData = new String[3];
BufferedReader bufferedReader = null;
try {
int counter = 0;
String line;
bufferedReader = new BufferedReader(new FileReader(csvFile));
while ((line = bufferedReader.readLine()) != ... | [
"private",
"static",
"String",
"[",
"]",
"getSeriesDataFromCSVRows",
"(",
"File",
"csvFile",
")",
"{",
"String",
"[",
"]",
"xAndYData",
"=",
"new",
"String",
"[",
"3",
"]",
";",
"BufferedReader",
"bufferedReader",
"=",
"null",
";",
"try",
"{",
"int",
"coun... | Get the series's data from a file
@param csvFile
@return | [
"Get",
"the",
"series",
"s",
"data",
"from",
"a",
"file"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVImporter.java#L110-L134 |
32,322 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVImporter.java | CSVImporter.getAllFiles | private static File[] getAllFiles(String dirName, String regex) {
File[] allFiles = getAllFiles(dirName);
List<File> matchingFiles = new ArrayList<File>();
for (File allFile : allFiles) {
if (allFile.getName().matches(regex)) {
matchingFiles.add(allFile);
}
}
return matching... | java | private static File[] getAllFiles(String dirName, String regex) {
File[] allFiles = getAllFiles(dirName);
List<File> matchingFiles = new ArrayList<File>();
for (File allFile : allFiles) {
if (allFile.getName().matches(regex)) {
matchingFiles.add(allFile);
}
}
return matching... | [
"private",
"static",
"File",
"[",
"]",
"getAllFiles",
"(",
"String",
"dirName",
",",
"String",
"regex",
")",
"{",
"File",
"[",
"]",
"allFiles",
"=",
"getAllFiles",
"(",
"dirName",
")",
";",
"List",
"<",
"File",
">",
"matchingFiles",
"=",
"new",
"ArrayLis... | This method returns the files found in the given directory matching the given regular
expression.
@param dirName - ex. "./path/to/directory/" *make sure you have the '/' on the end
@param regex - ex. ".*.csv"
@return File[] - an array of files | [
"This",
"method",
"returns",
"the",
"files",
"found",
"in",
"the",
"given",
"directory",
"matching",
"the",
"given",
"regular",
"expression",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVImporter.java#L201-L215 |
32,323 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVImporter.java | CSVImporter.getAllFiles | private static File[] getAllFiles(String dirName) {
File dir = new File(dirName);
File[] files = dir.listFiles(); // returns files and folders
if (files != null) {
List<File> filteredFiles = new ArrayList<File>();
for (File file : files) {
if (file.isFile()) {
filteredFiles... | java | private static File[] getAllFiles(String dirName) {
File dir = new File(dirName);
File[] files = dir.listFiles(); // returns files and folders
if (files != null) {
List<File> filteredFiles = new ArrayList<File>();
for (File file : files) {
if (file.isFile()) {
filteredFiles... | [
"private",
"static",
"File",
"[",
"]",
"getAllFiles",
"(",
"String",
"dirName",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"dirName",
")",
";",
"File",
"[",
"]",
"files",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"// returns files and folders",... | This method returns the Files found in the given directory
@param dirName - ex. "./path/to/directory/" *make sure you have the '/' on the end
@return File[] - an array of files | [
"This",
"method",
"returns",
"the",
"Files",
"found",
"in",
"the",
"given",
"directory"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVImporter.java#L223-L242 |
32,324 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/RadarSeries.java | RadarSeries.setLineStyle | public RadarSeries setLineStyle(BasicStroke basicStroke) {
stroke = basicStroke;
if (this.lineWidth > 0.0f) {
stroke =
new BasicStroke(
lineWidth,
this.stroke.getEndCap(),
this.stroke.getLineJoin(),
this.stroke.getMiterLimit(),
... | java | public RadarSeries setLineStyle(BasicStroke basicStroke) {
stroke = basicStroke;
if (this.lineWidth > 0.0f) {
stroke =
new BasicStroke(
lineWidth,
this.stroke.getEndCap(),
this.stroke.getLineJoin(),
this.stroke.getMiterLimit(),
... | [
"public",
"RadarSeries",
"setLineStyle",
"(",
"BasicStroke",
"basicStroke",
")",
"{",
"stroke",
"=",
"basicStroke",
";",
"if",
"(",
"this",
".",
"lineWidth",
">",
"0.0f",
")",
"{",
"stroke",
"=",
"new",
"BasicStroke",
"(",
"lineWidth",
",",
"this",
".",
"s... | Set the line style of the series
@param basicStroke | [
"Set",
"the",
"line",
"style",
"of",
"the",
"series"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/RadarSeries.java#L65-L79 |
32,325 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/DialChart.java | DialChart.addSeries | public DialSeries addSeries(String seriesName, double value, String annotation) {
// Sanity checks
sanityCheck(seriesName, value);
DialSeries series = new DialSeries(seriesName, value, annotation);
seriesMap.put(seriesName, series);
return series;
} | java | public DialSeries addSeries(String seriesName, double value, String annotation) {
// Sanity checks
sanityCheck(seriesName, value);
DialSeries series = new DialSeries(seriesName, value, annotation);
seriesMap.put(seriesName, series);
return series;
} | [
"public",
"DialSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"value",
",",
"String",
"annotation",
")",
"{",
"// Sanity checks",
"sanityCheck",
"(",
"seriesName",
",",
"value",
")",
";",
"DialSeries",
"series",
"=",
"new",
"DialSeries",
"(",
... | Add a series for a Dial type chart
@param seriesName
@param value
@param annotation
@return | [
"Add",
"a",
"series",
"for",
"a",
"Dial",
"type",
"chart"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/DialChart.java#L84-L94 |
32,326 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/BubbleChart.java | BubbleChart.addSeries | public BubbleSeries addSeries(
String seriesName,
List<? extends Number> xData,
List<? extends Number> yData,
List<? extends Number> bubbleData) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromNumberList(xData),
Utils.getDoubleArrayFromNumberList(yData),
... | java | public BubbleSeries addSeries(
String seriesName,
List<? extends Number> xData,
List<? extends Number> yData,
List<? extends Number> bubbleData) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromNumberList(xData),
Utils.getDoubleArrayFromNumberList(yData),
... | [
"public",
"BubbleSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"xData",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"yData",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"bubbleData",
")",
"{... | Add a series for a Bubble type chart using using double arrays
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param bubbleData the bubble data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"Bubble",
"type",
"chart",
"using",
"using",
"double",
"arrays"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/BubbleChart.java#L81-L92 |
32,327 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/BubbleChart.java | BubbleChart.addSeries | public BubbleSeries addSeries(
String seriesName, double[] xData, double[] yData, double[] bubbleData) {
// Sanity checks
sanityCheck(seriesName, xData, yData, bubbleData);
BubbleSeries series;
if (xData != null) {
// Sanity check
if (xData.length != yData.length) {
throw ne... | java | public BubbleSeries addSeries(
String seriesName, double[] xData, double[] yData, double[] bubbleData) {
// Sanity checks
sanityCheck(seriesName, xData, yData, bubbleData);
BubbleSeries series;
if (xData != null) {
// Sanity check
if (xData.length != yData.length) {
throw ne... | [
"public",
"BubbleSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"yData",
",",
"double",
"[",
"]",
"bubbleData",
")",
"{",
"// Sanity checks",
"sanityCheck",
"(",
"seriesName",
",",
"xData",
",",
... | Add a series for a Bubble type chart using using Lists
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param bubbleData the bubble data
@return | [
"Add",
"a",
"series",
"for",
"a",
"Bubble",
"type",
"chart",
"using",
"using",
"Lists"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/BubbleChart.java#L103-L127 |
32,328 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/PieChart.java | PieChart.addSeries | public PieSeries addSeries(String seriesName, Number value) {
PieSeries series = new PieSeries(seriesName, value);
if (seriesMap.keySet().contains(seriesName)) {
throw new IllegalArgumentException(
"Series name >"
+ seriesName
+ "< has already been used. Use unique ... | java | public PieSeries addSeries(String seriesName, Number value) {
PieSeries series = new PieSeries(seriesName, value);
if (seriesMap.keySet().contains(seriesName)) {
throw new IllegalArgumentException(
"Series name >"
+ seriesName
+ "< has already been used. Use unique ... | [
"public",
"PieSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"Number",
"value",
")",
"{",
"PieSeries",
"series",
"=",
"new",
"PieSeries",
"(",
"seriesName",
",",
"value",
")",
";",
"if",
"(",
"seriesMap",
".",
"keySet",
"(",
")",
".",
"contains",
... | Add a series for a Pie type chart
@param seriesName
@param value
@return | [
"Add",
"a",
"series",
"for",
"a",
"Pie",
"type",
"chart"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/PieChart.java#L74-L87 |
32,329 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/PieChart.java | PieChart.updatePieSeries | public PieSeries updatePieSeries(String seriesName, Number value) {
Map<String, PieSeries> seriesMap = getSeriesMap();
PieSeries series = seriesMap.get(seriesName);
if (series == null) {
throw new IllegalArgumentException("Series name >" + seriesName + "< not found!!!");
}
series.replaceData(... | java | public PieSeries updatePieSeries(String seriesName, Number value) {
Map<String, PieSeries> seriesMap = getSeriesMap();
PieSeries series = seriesMap.get(seriesName);
if (series == null) {
throw new IllegalArgumentException("Series name >" + seriesName + "< not found!!!");
}
series.replaceData(... | [
"public",
"PieSeries",
"updatePieSeries",
"(",
"String",
"seriesName",
",",
"Number",
"value",
")",
"{",
"Map",
"<",
"String",
",",
"PieSeries",
">",
"seriesMap",
"=",
"getSeriesMap",
"(",
")",
";",
"PieSeries",
"series",
"=",
"seriesMap",
".",
"get",
"(",
... | Update a series by updating the pie slide value
@param seriesName
@param value
@return | [
"Update",
"a",
"series",
"by",
"updating",
"the",
"pie",
"slide",
"value"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/PieChart.java#L96-L106 |
32,330 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CategoryChart.java | CategoryChart.addSeries | public CategorySeries addSeries(String seriesName, double[] xData, double[] yData) {
return addSeries(seriesName, xData, yData, null);
} | java | public CategorySeries addSeries(String seriesName, double[] xData, double[] yData) {
return addSeries(seriesName, xData, yData, null);
} | [
"public",
"CategorySeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"yData",
")",
"{",
"return",
"addSeries",
"(",
"seriesName",
",",
"xData",
",",
"yData",
",",
"null",
")",
";",
"}"
] | Add a series for a Category type chart using using double arrays
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"Category",
"type",
"chart",
"using",
"using",
"double",
"arrays"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CategoryChart.java#L83-L86 |
32,331 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CategoryChart.java | CategoryChart.addSeries | public CategorySeries addSeries(
String seriesName, double[] xData, double[] yData, double[] errorBars) {
return addSeries(
seriesName,
Utils.getNumberListFromDoubleArray(xData),
Utils.getNumberListFromDoubleArray(yData),
Utils.getNumberListFromDoubleArray(errorBars));
} | java | public CategorySeries addSeries(
String seriesName, double[] xData, double[] yData, double[] errorBars) {
return addSeries(
seriesName,
Utils.getNumberListFromDoubleArray(xData),
Utils.getNumberListFromDoubleArray(yData),
Utils.getNumberListFromDoubleArray(errorBars));
} | [
"public",
"CategorySeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"yData",
",",
"double",
"[",
"]",
"errorBars",
")",
"{",
"return",
"addSeries",
"(",
"seriesName",
",",
"Utils",
".",
"getNumbe... | Add a series for a Category type chart using using double arrays with error bars
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param errorBars the error bar data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"Category",
"type",
"chart",
"using",
"using",
"double",
"arrays",
"with",
"error",
"bars"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CategoryChart.java#L97-L105 |
32,332 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CategoryChart.java | CategoryChart.addSeries | public CategorySeries addSeries(
String seriesName,
List<?> xData,
List<? extends Number> yData,
List<? extends Number> errorBars) {
// Sanity checks
sanityCheck(seriesName, xData, yData, errorBars);
CategorySeries series;
if (xData != null) {
// Sanity check
if (x... | java | public CategorySeries addSeries(
String seriesName,
List<?> xData,
List<? extends Number> yData,
List<? extends Number> errorBars) {
// Sanity checks
sanityCheck(seriesName, xData, yData, errorBars);
CategorySeries series;
if (xData != null) {
// Sanity check
if (x... | [
"public",
"CategorySeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"List",
"<",
"?",
">",
"xData",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"yData",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"errorBars",
")",
"{",
"// Sanity checks",... | Add a series for a Category type chart using Lists with error bars
@param seriesName
@param xData the X-Axis data
@param yData the Y-Axis data
@param errorBars the error bar data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"Category",
"type",
"chart",
"using",
"Lists",
"with",
"error",
"bars"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CategoryChart.java#L160-L186 |
32,333 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CategoryChart.java | CategoryChart.setCustomCategoryLabels | public void setCustomCategoryLabels(Map<Object, Object> customCategoryLabels) {
// get the first series
AxesChartSeriesCategory axesChartSeries = getSeriesMap().values().iterator().next();
// get the first categories, could be Number Date or String
List<?> categories = (List<?>) axesChartSeries.getXDat... | java | public void setCustomCategoryLabels(Map<Object, Object> customCategoryLabels) {
// get the first series
AxesChartSeriesCategory axesChartSeries = getSeriesMap().values().iterator().next();
// get the first categories, could be Number Date or String
List<?> categories = (List<?>) axesChartSeries.getXDat... | [
"public",
"void",
"setCustomCategoryLabels",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"customCategoryLabels",
")",
"{",
"// get the first series",
"AxesChartSeriesCategory",
"axesChartSeries",
"=",
"getSeriesMap",
"(",
")",
".",
"values",
"(",
")",
".",
"itera... | Set custom X-Axis category labels
@param customCategoryLabels Map containing category name -> label mappings | [
"Set",
"custom",
"X",
"-",
"Axis",
"category",
"labels"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CategoryChart.java#L351-L368 |
32,334 | knowm/XChart | xchart-demo/src/main/java/org/knowm/xchart/standalone/Example2.java | Example2.getRandomWalk | private static double[] getRandomWalk(int numPoints) {
double[] y = new double[numPoints];
y[0] = 0;
for (int i = 1; i < y.length; i++) {
y[i] = y[i - 1] + Math.random() - .5;
}
return y;
} | java | private static double[] getRandomWalk(int numPoints) {
double[] y = new double[numPoints];
y[0] = 0;
for (int i = 1; i < y.length; i++) {
y[i] = y[i - 1] + Math.random() - .5;
}
return y;
} | [
"private",
"static",
"double",
"[",
"]",
"getRandomWalk",
"(",
"int",
"numPoints",
")",
"{",
"double",
"[",
"]",
"y",
"=",
"new",
"double",
"[",
"numPoints",
"]",
";",
"y",
"[",
"0",
"]",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i... | Generates a set of random walk data
@param numPoints
@return | [
"Generates",
"a",
"set",
"of",
"random",
"walk",
"data"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart-demo/src/main/java/org/knowm/xchart/standalone/Example2.java#L43-L51 |
32,335 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVExporter.java | CSVExporter.writeCSVRows | public static void writeCSVRows(XYSeries series, String path2Dir) {
File newFile = new File(path2Dir + series.getName() + ".csv");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
String csv = join(series.getXData(), ",") + Syste... | java | public static void writeCSVRows(XYSeries series, String path2Dir) {
File newFile = new File(path2Dir + series.getName() + ".csv");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
String csv = join(series.getXData(), ",") + Syste... | [
"public",
"static",
"void",
"writeCSVRows",
"(",
"XYSeries",
"series",
",",
"String",
"path2Dir",
")",
"{",
"File",
"newFile",
"=",
"new",
"File",
"(",
"path2Dir",
"+",
"series",
".",
"getName",
"(",
")",
"+",
"\".csv\"",
")",
";",
"Writer",
"out",
"=",
... | Export a XYChart series into rows in a CSV file.
@param series
@param path2Dir - ex. "./path/to/directory/" *make sure you have the '/' on the end | [
"Export",
"a",
"XYChart",
"series",
"into",
"rows",
"in",
"a",
"CSV",
"file",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVExporter.java#L33-L60 |
32,336 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVExporter.java | CSVExporter.join | private static String join(double[] seriesData, String separator) {
// two or more elements
StringBuilder sb = new StringBuilder(256); // Java default is 16, probably too small
sb.append(seriesData[0]);
for (int i = 1; i < seriesData.length; i++) {
if (separator != null) {
sb.append(sepa... | java | private static String join(double[] seriesData, String separator) {
// two or more elements
StringBuilder sb = new StringBuilder(256); // Java default is 16, probably too small
sb.append(seriesData[0]);
for (int i = 1; i < seriesData.length; i++) {
if (separator != null) {
sb.append(sepa... | [
"private",
"static",
"String",
"join",
"(",
"double",
"[",
"]",
"seriesData",
",",
"String",
"separator",
")",
"{",
"// two or more elements",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"256",
")",
";",
"// Java default is 16, probably too small",
"sb"... | Joins a series into an entire row of comma separated values.
@param seriesData
@param separator
@return | [
"Joins",
"a",
"series",
"into",
"an",
"entire",
"row",
"of",
"comma",
"separated",
"values",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVExporter.java#L69-L83 |
32,337 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVExporter.java | CSVExporter.writeCSVColumns | public static void writeCSVColumns(XYChart chart, String path2Dir) {
for (XYSeries xySeries : chart.getSeriesMap().values()) {
writeCSVColumns(xySeries, path2Dir);
}
} | java | public static void writeCSVColumns(XYChart chart, String path2Dir) {
for (XYSeries xySeries : chart.getSeriesMap().values()) {
writeCSVColumns(xySeries, path2Dir);
}
} | [
"public",
"static",
"void",
"writeCSVColumns",
"(",
"XYChart",
"chart",
",",
"String",
"path2Dir",
")",
"{",
"for",
"(",
"XYSeries",
"xySeries",
":",
"chart",
".",
"getSeriesMap",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"writeCSVColumns",
"(",
"xySeri... | Export all XYChart series as columns in separate CSV files.
@param chart
@param path2Dir | [
"Export",
"all",
"XYChart",
"series",
"as",
"columns",
"in",
"separate",
"CSV",
"files",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVExporter.java#L91-L96 |
32,338 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/CSVExporter.java | CSVExporter.writeCSVColumns | public static void writeCSVColumns(XYSeries series, String path2Dir) {
File newFile = new File(path2Dir + series.getName() + ".csv");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
double[] xData = series.getXData();
doub... | java | public static void writeCSVColumns(XYSeries series, String path2Dir) {
File newFile = new File(path2Dir + series.getName() + ".csv");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
double[] xData = series.getXData();
doub... | [
"public",
"static",
"void",
"writeCSVColumns",
"(",
"XYSeries",
"series",
",",
"String",
"path2Dir",
")",
"{",
"File",
"newFile",
"=",
"new",
"File",
"(",
"path2Dir",
"+",
"series",
".",
"getName",
"(",
")",
"+",
"\".csv\"",
")",
";",
"Writer",
"out",
"=... | Export a Chart series in columns in a CSV file.
@param series
@param path2Dir - ex. "./path/to/directory/" *make sure you have the '/' on the end | [
"Export",
"a",
"Chart",
"series",
"in",
"columns",
"in",
"a",
"CSV",
"file",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVExporter.java#L104-L142 |
32,339 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/XYChart.java | XYChart.addSeries | public XYSeries addSeries(String seriesName, int[] xData, int[] yData) {
return addSeries(seriesName, xData, yData, null);
} | java | public XYSeries addSeries(String seriesName, int[] xData, int[] yData) {
return addSeries(seriesName, xData, yData, null);
} | [
"public",
"XYSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"int",
"[",
"]",
"xData",
",",
"int",
"[",
"]",
"yData",
")",
"{",
"return",
"addSeries",
"(",
"seriesName",
",",
"xData",
",",
"yData",
",",
"null",
")",
";",
"}"
] | Add a series for a X-Y type chart using using int arrays
@param seriesName
@param xData the X-Axis data
@param yData the Y-Axis data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"X",
"-",
"Y",
"type",
"chart",
"using",
"using",
"int",
"arrays"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L165-L168 |
32,340 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/XYChart.java | XYChart.addSeries | public XYSeries addSeries(String seriesName, int[] xData, int[] yData, int[] errorBars) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromIntArray(xData),
Utils.getDoubleArrayFromIntArray(yData),
Utils.getDoubleArrayFromIntArray(errorBars),
DataType.Number);
} | java | public XYSeries addSeries(String seriesName, int[] xData, int[] yData, int[] errorBars) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromIntArray(xData),
Utils.getDoubleArrayFromIntArray(yData),
Utils.getDoubleArrayFromIntArray(errorBars),
DataType.Number);
} | [
"public",
"XYSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"int",
"[",
"]",
"xData",
",",
"int",
"[",
"]",
"yData",
",",
"int",
"[",
"]",
"errorBars",
")",
"{",
"return",
"addSeries",
"(",
"seriesName",
",",
"Utils",
".",
"getDoubleArrayFromIntAr... | Add a series for a X-Y type chart using using int arrays with error bars
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param errorBars the error bar data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"X",
"-",
"Y",
"type",
"chart",
"using",
"using",
"int",
"arrays",
"with",
"error",
"bars"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L179-L187 |
32,341 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/XYChart.java | XYChart.addSeries | public XYSeries addSeries(
String seriesName,
List<?> xData,
List<? extends Number> yData,
List<? extends Number> errorBars) {
DataType dataType = getDataType(xData);
switch (dataType) {
case Date:
return addSeries(
seriesName,
Utils.getDoubleArrayF... | java | public XYSeries addSeries(
String seriesName,
List<?> xData,
List<? extends Number> yData,
List<? extends Number> errorBars) {
DataType dataType = getDataType(xData);
switch (dataType) {
case Date:
return addSeries(
seriesName,
Utils.getDoubleArrayF... | [
"public",
"XYSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"List",
"<",
"?",
">",
"xData",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"yData",
",",
"List",
"<",
"?",
"extends",
"Number",
">",
"errorBars",
")",
"{",
"DataType",
"dataType",... | Add a series for a X-Y type chart using Lists
@param seriesName
@param xData the X-Axis data
@param yData the Y-Axis data
@param errorBars the error bar data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"X",
"-",
"Y",
"type",
"chart",
"using",
"Lists"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L223-L247 |
32,342 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/XYChart.java | XYChart.addSeries | private XYSeries addSeries(
String seriesName, double[] xData, double[] yData, double[] errorBars, DataType dataType) {
// Sanity checks
sanityCheck(seriesName, xData, yData, errorBars);
XYSeries series;
if (xData != null) {
// Sanity check
if (xData.length != yData.length) {
... | java | private XYSeries addSeries(
String seriesName, double[] xData, double[] yData, double[] errorBars, DataType dataType) {
// Sanity checks
sanityCheck(seriesName, xData, yData, errorBars);
XYSeries series;
if (xData != null) {
// Sanity check
if (xData.length != yData.length) {
... | [
"private",
"XYSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"yData",
",",
"double",
"[",
"]",
"errorBars",
",",
"DataType",
"dataType",
")",
"{",
"// Sanity checks",
"sanityCheck",
"(",
"seriesN... | Add a series for a X-Y type chart using Lists with error bars
@param seriesName
@param xData the X-Axis data
@param yData the Y-Axis data
@param errorBars the error bar data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"X",
"-",
"Y",
"type",
"chart",
"using",
"Lists",
"with",
"error",
"bars"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L283-L307 |
32,343 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/SwingWrapper.java | SwingWrapper.repaintChart | public void repaintChart(int index) {
chartPanels.get(index).revalidate();
chartPanels.get(index).repaint();
} | java | public void repaintChart(int index) {
chartPanels.get(index).revalidate();
chartPanels.get(index).repaint();
} | [
"public",
"void",
"repaintChart",
"(",
"int",
"index",
")",
"{",
"chartPanels",
".",
"get",
"(",
"index",
")",
".",
"revalidate",
"(",
")",
";",
"chartPanels",
".",
"get",
"(",
"index",
")",
".",
"repaint",
"(",
")",
";",
"}"
] | Repaint the XChartPanel given the provided index.
@param index | [
"Repaint",
"the",
"XChartPanel",
"given",
"the",
"provided",
"index",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/SwingWrapper.java#L192-L196 |
32,344 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java | Legend_.getBoundsHintVertical | private Rectangle2D getBoundsHintVertical() {
if (!chart.getStyler().isLegendVisible()) {
return new Rectangle2D
.Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0,
// 0).
}
boolean containsBox = false;
// determine legend text content max wid... | java | private Rectangle2D getBoundsHintVertical() {
if (!chart.getStyler().isLegendVisible()) {
return new Rectangle2D
.Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0,
// 0).
}
boolean containsBox = false;
// determine legend text content max wid... | [
"private",
"Rectangle2D",
"getBoundsHintVertical",
"(",
")",
"{",
"if",
"(",
"!",
"chart",
".",
"getStyler",
"(",
")",
".",
"isLegendVisible",
"(",
")",
")",
"{",
"return",
"new",
"Rectangle2D",
".",
"Double",
"(",
")",
";",
"// Constructs a new Rectangle2D, i... | determine the width and height of the chart legend | [
"determine",
"the",
"width",
"and",
"height",
"of",
"the",
"chart",
"legend"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java#L160-L222 |
32,345 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java | Legend_.getBoundsHintHorizontal | private Rectangle2D getBoundsHintHorizontal() {
if (!chart.getStyler().isLegendVisible()) {
return new Rectangle2D
.Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0,
// 0).
}
// determine legend text content max height
double legendTextContent... | java | private Rectangle2D getBoundsHintHorizontal() {
if (!chart.getStyler().isLegendVisible()) {
return new Rectangle2D
.Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0,
// 0).
}
// determine legend text content max height
double legendTextContent... | [
"private",
"Rectangle2D",
"getBoundsHintHorizontal",
"(",
")",
"{",
"if",
"(",
"!",
"chart",
".",
"getStyler",
"(",
")",
".",
"isLegendVisible",
"(",
")",
")",
"{",
"return",
"new",
"Rectangle2D",
".",
"Double",
"(",
")",
";",
"// Constructs a new Rectangle2D,... | determine the width and height of the chart legend with horizontal layout | [
"determine",
"the",
"width",
"and",
"height",
"of",
"the",
"chart",
"legend",
"with",
"horizontal",
"layout"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java#L225-L279 |
32,346 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java | Legend_.getSeriesTextBounds | Map<String, Rectangle2D> getSeriesTextBounds(S series) {
// FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());
// float fontDescent = fontMetrics.getDescent();
String lines[] = series.getName().split("\\n");
Map<String, Rectangle2D> seriesTextBounds =
ne... | java | Map<String, Rectangle2D> getSeriesTextBounds(S series) {
// FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());
// float fontDescent = fontMetrics.getDescent();
String lines[] = series.getName().split("\\n");
Map<String, Rectangle2D> seriesTextBounds =
ne... | [
"Map",
"<",
"String",
",",
"Rectangle2D",
">",
"getSeriesTextBounds",
"(",
"S",
"series",
")",
"{",
"// FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());",
"// float fontDescent = fontMetrics.getDescent();",
"String",
"lines",
"[",
"]",
"=... | Normally each legend entry just has one line of text, but it can be made multi-line by adding
"\\n". This method returns a Map for each single legend entry, which is normally just a Map
with one single entry.
@param series
@return | [
"Normally",
"each",
"legend",
"entry",
"just",
"has",
"one",
"line",
"of",
"text",
"but",
"it",
"can",
"be",
"made",
"multi",
"-",
"line",
"by",
"adding",
"\\\\",
"n",
".",
"This",
"method",
"returns",
"a",
"Map",
"for",
"each",
"single",
"legend",
"en... | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java#L289-L313 |
32,347 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/OHLCChart.java | OHLCChart.addSeries | public OHLCSeries addSeries(
String seriesName,
int[] xData,
int[] openData,
int[] highData,
int[] lowData,
int[] closeData) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromIntArray(xData),
Utils.getDoubleArrayFromIntArray(openData),
Utils... | java | public OHLCSeries addSeries(
String seriesName,
int[] xData,
int[] openData,
int[] highData,
int[] lowData,
int[] closeData) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromIntArray(xData),
Utils.getDoubleArrayFromIntArray(openData),
Utils... | [
"public",
"OHLCSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"int",
"[",
"]",
"xData",
",",
"int",
"[",
"]",
"openData",
",",
"int",
"[",
"]",
"highData",
",",
"int",
"[",
"]",
"lowData",
",",
"int",
"[",
"]",
"closeData",
")",
"{",
"return... | Add a series for a OHLC type chart using using int arrays
@param seriesName
@param xData the x-axis data
@param openData the open data
@param highData the high data
@param lowData the low data
@param closeData the close data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"OHLC",
"type",
"chart",
"using",
"using",
"int",
"arrays"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/OHLCChart.java#L148-L164 |
32,348 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/OHLCChart.java | OHLCChart.addSeries | private OHLCSeries addSeries(
String seriesName,
double[] xData,
double[] openData,
double[] highData,
double[] lowData,
double[] closeData,
DataType dataType) {
if (seriesMap.keySet().contains(seriesName)) {
throw new IllegalArgumentException(
"Series name... | java | private OHLCSeries addSeries(
String seriesName,
double[] xData,
double[] openData,
double[] highData,
double[] lowData,
double[] closeData,
DataType dataType) {
if (seriesMap.keySet().contains(seriesName)) {
throw new IllegalArgumentException(
"Series name... | [
"private",
"OHLCSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"openData",
",",
"double",
"[",
"]",
"highData",
",",
"double",
"[",
"]",
"lowData",
",",
"double",
"[",
"]",
"closeData",
",",
... | Add a series for a OHLC type chart
@param seriesName
@param xData the x-axis data
@param openData the open data
@param highData the high data
@param lowData the low data
@param closeData the close data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"OHLC",
"type",
"chart"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/OHLCChart.java#L291-L326 |
32,349 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/OHLCChart.java | OHLCChart.setSeriesStyles | private void setSeriesStyles() {
SeriesColorMarkerLineStyleCycler seriesColorMarkerLineStyleCycler =
new SeriesColorMarkerLineStyleCycler(
getStyler().getSeriesColors(),
getStyler().getSeriesMarkers(),
getStyler().getSeriesLines());
for (OHLCSeries series : getSeries... | java | private void setSeriesStyles() {
SeriesColorMarkerLineStyleCycler seriesColorMarkerLineStyleCycler =
new SeriesColorMarkerLineStyleCycler(
getStyler().getSeriesColors(),
getStyler().getSeriesMarkers(),
getStyler().getSeriesLines());
for (OHLCSeries series : getSeries... | [
"private",
"void",
"setSeriesStyles",
"(",
")",
"{",
"SeriesColorMarkerLineStyleCycler",
"seriesColorMarkerLineStyleCycler",
"=",
"new",
"SeriesColorMarkerLineStyleCycler",
"(",
"getStyler",
"(",
")",
".",
"getSeriesColors",
"(",
")",
",",
"getStyler",
"(",
")",
".",
... | set the series color, marker and line style based on theme | [
"set",
"the",
"series",
"color",
"marker",
"and",
"line",
"style",
"based",
"on",
"theme"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/OHLCChart.java#L476-L504 |
32,350 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java | Axis.getXAxisHeightHint | private double getXAxisHeightHint(double workingSpace) {
// Axis title
double titleHeight = 0.0;
if (chart.getXAxisTitle() != null
&& !chart.getXAxisTitle().trim().equalsIgnoreCase("")
&& axesChartStyler.isXAxisTitleVisible()) {
TextLayout textLayout =
new TextLayout(
... | java | private double getXAxisHeightHint(double workingSpace) {
// Axis title
double titleHeight = 0.0;
if (chart.getXAxisTitle() != null
&& !chart.getXAxisTitle().trim().equalsIgnoreCase("")
&& axesChartStyler.isXAxisTitleVisible()) {
TextLayout textLayout =
new TextLayout(
... | [
"private",
"double",
"getXAxisHeightHint",
"(",
"double",
"workingSpace",
")",
"{",
"// Axis title",
"double",
"titleHeight",
"=",
"0.0",
";",
"if",
"(",
"chart",
".",
"getXAxisTitle",
"(",
")",
"!=",
"null",
"&&",
"!",
"chart",
".",
"getXAxisTitle",
"(",
")... | The vertical Y-Axis is drawn first, but to know the lower bounds of it, we need to know how
high the X-Axis paint zone is going to be. Since the tick labels could be rotated, we need to
actually determine the tick labels first to get an idea of how tall the X-Axis tick labels will
be.
@return | [
"The",
"vertical",
"Y",
"-",
"Axis",
"is",
"drawn",
"first",
"but",
"to",
"know",
"the",
"lower",
"bounds",
"of",
"it",
"we",
"need",
"to",
"know",
"how",
"high",
"the",
"X",
"-",
"Axis",
"paint",
"zone",
"is",
"going",
"to",
"be",
".",
"Since",
"t... | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java#L257-L314 |
32,351 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java | Axis.getChartValue | public double getChartValue(double screenPoint) {
// a check if all axis data are the exact same values
if (min == max) {
return min;
}
double minVal = min;
double maxVal = max;
// min & max is not set in category charts with string labels
if (min > max) {
if (get... | java | public double getChartValue(double screenPoint) {
// a check if all axis data are the exact same values
if (min == max) {
return min;
}
double minVal = min;
double maxVal = max;
// min & max is not set in category charts with string labels
if (min > max) {
if (get... | [
"public",
"double",
"getChartValue",
"(",
"double",
"screenPoint",
")",
"{",
"// a check if all axis data are the exact same values",
"if",
"(",
"min",
"==",
"max",
")",
"{",
"return",
"min",
";",
"}",
"double",
"minVal",
"=",
"min",
";",
"double",
"maxVal",
"="... | Converts a screen coordinate to chart coordinate value. Reverses the AxisTickCalculators calculation.
@param screenPoint Coordinate of screen. eg: MouseEvent.getX(), MouseEvent.getY()
@return value in chart coordinate system | [
"Converts",
"a",
"screen",
"coordinate",
"to",
"chart",
"coordinate",
"value",
".",
"Reverses",
"the",
"AxisTickCalculators",
"calculation",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java#L575-L630 |
32,352 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/ChartTitle.java | ChartTitle.getBoundsHint | private Rectangle2D getBoundsHint() {
if (chart.getStyler().isChartTitleVisible() && chart.getTitle().length() > 0) {
TextLayout textLayout =
new TextLayout(
chart.getTitle(),
chart.getStyler().getChartTitleFont(),
new FontRenderContext(null, true,... | java | private Rectangle2D getBoundsHint() {
if (chart.getStyler().isChartTitleVisible() && chart.getTitle().length() > 0) {
TextLayout textLayout =
new TextLayout(
chart.getTitle(),
chart.getStyler().getChartTitleFont(),
new FontRenderContext(null, true,... | [
"private",
"Rectangle2D",
"getBoundsHint",
"(",
")",
"{",
"if",
"(",
"chart",
".",
"getStyler",
"(",
")",
".",
"isChartTitleVisible",
"(",
")",
"&&",
"chart",
".",
"getTitle",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"TextLayout",
"textLa... | get the height of the chart title including the chart title padding
@return a Rectangle2D defining the height of the chart title including the chart title padding | [
"get",
"the",
"height",
"of",
"the",
"chart",
"title",
"including",
"the",
"chart",
"title",
"padding"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/ChartTitle.java#L102-L122 |
32,353 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContent_.java | PlotContent_.closePath | void closePath(
Graphics2D g, Path2D.Double path, double previousX, Rectangle2D bounds, double yTopMargin) {
if (path != null) {
double yBottomOfArea = getBounds().getY() + getBounds().getHeight() - yTopMargin;
path.lineTo(previousX, yBottomOfArea);
path.closePath();
g.fill(path);
... | java | void closePath(
Graphics2D g, Path2D.Double path, double previousX, Rectangle2D bounds, double yTopMargin) {
if (path != null) {
double yBottomOfArea = getBounds().getY() + getBounds().getHeight() - yTopMargin;
path.lineTo(previousX, yBottomOfArea);
path.closePath();
g.fill(path);
... | [
"void",
"closePath",
"(",
"Graphics2D",
"g",
",",
"Path2D",
".",
"Double",
"path",
",",
"double",
"previousX",
",",
"Rectangle2D",
"bounds",
",",
"double",
"yTopMargin",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"double",
"yBottomOfArea",
"=",
... | Closes a path for area charts if one is available. | [
"Closes",
"a",
"path",
"for",
"area",
"charts",
"if",
"one",
"is",
"available",
"."
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContent_.java#L66-L75 |
32,354 | knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/style/SeriesColorMarkerLineStyleCycler.java | SeriesColorMarkerLineStyleCycler.getNextSeriesColorMarkerLineStyle | public SeriesColorMarkerLineStyle getNextSeriesColorMarkerLineStyle() {
// 1. Color - cycle through colors one by one
if (colorCounter >= seriesColorList.length) {
colorCounter = 0;
strokeCounter++;
}
Color seriesColor = seriesColorList[colorCounter++];
// 2. Stroke - cycle through str... | java | public SeriesColorMarkerLineStyle getNextSeriesColorMarkerLineStyle() {
// 1. Color - cycle through colors one by one
if (colorCounter >= seriesColorList.length) {
colorCounter = 0;
strokeCounter++;
}
Color seriesColor = seriesColorList[colorCounter++];
// 2. Stroke - cycle through str... | [
"public",
"SeriesColorMarkerLineStyle",
"getNextSeriesColorMarkerLineStyle",
"(",
")",
"{",
"// 1. Color - cycle through colors one by one",
"if",
"(",
"colorCounter",
">=",
"seriesColorList",
".",
"length",
")",
"{",
"colorCounter",
"=",
"0",
";",
"strokeCounter",
"++",
... | Get the next ColorMarkerLineStyle
@return the next ColorMarkerLineStyle | [
"Get",
"the",
"next",
"ColorMarkerLineStyle"
] | 677a105753a855edf24782fab1bf1f5aec3e642b | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/style/SeriesColorMarkerLineStyleCycler.java#L44-L66 |
32,355 | kevinsawicki/http-request | lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java | HttpRequest.arrayToList | private static List<Object> arrayToList(final Object array) {
if (array instanceof Object[])
return Arrays.asList((Object[]) array);
List<Object> result = new ArrayList<Object>();
// Arrays of the primitive types can't be cast to array of Object, so this:
if (array instanceof int[])
for (in... | java | private static List<Object> arrayToList(final Object array) {
if (array instanceof Object[])
return Arrays.asList((Object[]) array);
List<Object> result = new ArrayList<Object>();
// Arrays of the primitive types can't be cast to array of Object, so this:
if (array instanceof int[])
for (in... | [
"private",
"static",
"List",
"<",
"Object",
">",
"arrayToList",
"(",
"final",
"Object",
"array",
")",
"{",
"if",
"(",
"array",
"instanceof",
"Object",
"[",
"]",
")",
"return",
"Arrays",
".",
"asList",
"(",
"(",
"Object",
"[",
"]",
")",
"array",
")",
... | Represents array of any type as list of objects so we can easily iterate over it
@param array of elements
@return list with the same elements | [
"Represents",
"array",
"of",
"any",
"type",
"as",
"list",
"of",
"objects",
"so",
"we",
"can",
"easily",
"iterate",
"over",
"it"
] | 2d62a3e9da726942a93cf16b6e91c0187e6c0136 | https://github.com/kevinsawicki/http-request/blob/2d62a3e9da726942a93cf16b6e91c0187e6c0136/lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java#L835-L858 |
32,356 | kevinsawicki/http-request | lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java | HttpRequest.head | public static HttpRequest head(final CharSequence baseUrl,
final Map<?, ?> params, final boolean encode) {
String url = append(baseUrl, params);
return head(encode ? encode(url) : url);
} | java | public static HttpRequest head(final CharSequence baseUrl,
final Map<?, ?> params, final boolean encode) {
String url = append(baseUrl, params);
return head(encode ? encode(url) : url);
} | [
"public",
"static",
"HttpRequest",
"head",
"(",
"final",
"CharSequence",
"baseUrl",
",",
"final",
"Map",
"<",
"?",
",",
"?",
">",
"params",
",",
"final",
"boolean",
"encode",
")",
"{",
"String",
"url",
"=",
"append",
"(",
"baseUrl",
",",
"params",
")",
... | Start a 'HEAD' request to the given URL along with the query params
@param baseUrl
@param params
The query parameters to include as part of the baseUrl
@param encode
true to encode the full URL
@see #append(CharSequence, Map)
@see #encode(CharSequence)
@return request | [
"Start",
"a",
"HEAD",
"request",
"to",
"the",
"given",
"URL",
"along",
"with",
"the",
"query",
"params"
] | 2d62a3e9da726942a93cf16b6e91c0187e6c0136 | https://github.com/kevinsawicki/http-request/blob/2d62a3e9da726942a93cf16b6e91c0187e6c0136/lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java#L1264-L1268 |
32,357 | Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/http/AipRequest.java | AipRequest.getBodyStr | public String getBodyStr() {
ArrayList<String> arr = new ArrayList<String>();
if (bodyFormat.equals(EBodyFormat.FORM_KV)) {
for (Map.Entry<String, Object> entry : body.entrySet()) {
if (entry.getValue() == null || entry.getValue().equals("")) {
arr.add(Uti... | java | public String getBodyStr() {
ArrayList<String> arr = new ArrayList<String>();
if (bodyFormat.equals(EBodyFormat.FORM_KV)) {
for (Map.Entry<String, Object> entry : body.entrySet()) {
if (entry.getValue() == null || entry.getValue().equals("")) {
arr.add(Uti... | [
"public",
"String",
"getBodyStr",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"arr",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"bodyFormat",
".",
"equals",
"(",
"EBodyFormat",
".",
"FORM_KV",
")",
")",
"{",
"for",
"("... | get body content depending on bodyFormat
@return body content as String | [
"get",
"body",
"content",
"depending",
"on",
"bodyFormat"
] | 16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90 | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/http/AipRequest.java#L96-L120 |
32,358 | Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/client/BaseClient.java | BaseClient.getAccessToken | protected synchronized void getAccessToken(AipClientConfiguration config) {
if (!needAuth()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("app[%s] no need to auth", this.appId));
}
return;
}
JSONObject res = DevAuth.oauth(aipKey,... | java | protected synchronized void getAccessToken(AipClientConfiguration config) {
if (!needAuth()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("app[%s] no need to auth", this.appId));
}
return;
}
JSONObject res = DevAuth.oauth(aipKey,... | [
"protected",
"synchronized",
"void",
"getAccessToken",
"(",
"AipClientConfiguration",
"config",
")",
"{",
"if",
"(",
"!",
"needAuth",
"(",
")",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"String",... | get OAuth access token, synchronized function
@param config 网络连接设置 | [
"get",
"OAuth",
"access",
"token",
"synchronized",
"function"
] | 16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90 | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/client/BaseClient.java#L182-L224 |
32,359 | Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/client/BaseClient.java | BaseClient.requestServer | protected JSONObject requestServer(AipRequest request) {
// 请求API
AipResponse response = AipHttpClient.post(request);
String resData = response.getBodyStr();
Integer status = response.getStatus();
if (status.equals(200) && !resData.equals("")) {
try {
... | java | protected JSONObject requestServer(AipRequest request) {
// 请求API
AipResponse response = AipHttpClient.post(request);
String resData = response.getBodyStr();
Integer status = response.getStatus();
if (status.equals(200) && !resData.equals("")) {
try {
... | [
"protected",
"JSONObject",
"requestServer",
"(",
"AipRequest",
"request",
")",
"{",
"// 请求API",
"AipResponse",
"response",
"=",
"AipHttpClient",
".",
"post",
"(",
"request",
")",
";",
"String",
"resData",
"=",
"response",
".",
"getBodyStr",
"(",
")",
";",
"Int... | send request to server
@param request AipRequest object
@return JSONObject of server response | [
"send",
"request",
"to",
"server"
] | 16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90 | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/client/BaseClient.java#L290-L321 |
32,360 | Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/auth/DevAuth.java | DevAuth.oauth | public static JSONObject oauth(String apiKey, String secretKey, AipClientConfiguration config) {
try {
AipRequest request = new AipRequest();
request.setUri(new URI(AipClientConst.OAUTH_URL));
request.addBody("grant_type", "client_credentials");
request.addBody("c... | java | public static JSONObject oauth(String apiKey, String secretKey, AipClientConfiguration config) {
try {
AipRequest request = new AipRequest();
request.setUri(new URI(AipClientConst.OAUTH_URL));
request.addBody("grant_type", "client_credentials");
request.addBody("c... | [
"public",
"static",
"JSONObject",
"oauth",
"(",
"String",
"apiKey",
",",
"String",
"secretKey",
",",
"AipClientConfiguration",
"config",
")",
"{",
"try",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"request",
".",
"setUri",
"(",
"n... | get access_token from openapi
@param apiKey API key from console
@param secretKey Secret Key from console
@param config network config settings
@return JsonObject of response from OAuth server | [
"get",
"access_token",
"from",
"openapi"
] | 16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90 | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/auth/DevAuth.java#L35-L62 |
32,361 | Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/util/Base64Util.java | Base64Util.encode | public static String encode(byte[] from) {
StringBuilder to = new StringBuilder((int) (from.length * 1.34) + 3);
int num = 0;
char currentByte = 0;
for (int i = 0; i < from.length; i++) {
num = num % 8;
while (num < 8) {
switch (num) {
... | java | public static String encode(byte[] from) {
StringBuilder to = new StringBuilder((int) (from.length * 1.34) + 3);
int num = 0;
char currentByte = 0;
for (int i = 0; i < from.length; i++) {
num = num % 8;
while (num < 8) {
switch (num) {
... | [
"public",
"static",
"String",
"encode",
"(",
"byte",
"[",
"]",
"from",
")",
"{",
"StringBuilder",
"to",
"=",
"new",
"StringBuilder",
"(",
"(",
"int",
")",
"(",
"from",
".",
"length",
"*",
"1.34",
")",
"+",
"3",
")",
";",
"int",
"num",
"=",
"0",
"... | Base64 encoding.
@param from
The src data.
@return cryto_str | [
"Base64",
"encoding",
"."
] | 16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90 | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/util/Base64Util.java#L53-L95 |
32,362 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java | OnBindViewHolderListenerImpl.onBindViewHolder | @Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List<Object> payloads) {
Object tag = viewHolder.itemView.getTag(R.id.fastadapter_item_adapter);
if (tag instanceof FastAdapter) {
FastAdapter fastAdapter = ((FastAdapter) tag);
IItem ite... | java | @Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List<Object> payloads) {
Object tag = viewHolder.itemView.getTag(R.id.fastadapter_item_adapter);
if (tag instanceof FastAdapter) {
FastAdapter fastAdapter = ((FastAdapter) tag);
IItem ite... | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"int",
"position",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"Object",
"tag",
"=",
"viewHolder",
".",
"itemView",
".",
"getTag",
"(... | is called in onBindViewHolder to bind the data on the ViewHolder
@param viewHolder the viewHolder for the type at this position
@param position the position of this viewHolder
@param payloads the payloads provided by the adapter | [
"is",
"called",
"in",
"onBindViewHolder",
"to",
"bind",
"the",
"data",
"on",
"the",
"ViewHolder"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java#L21-L36 |
32,363 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java | OnBindViewHolderListenerImpl.unBindViewHolder | @Override
public void unBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItemTag(viewHolder);
if (item != null) {
item.unbindView(viewHolder);
if (viewHolder instanceof FastAdapter.ViewHolder) {
((Fast... | java | @Override
public void unBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItemTag(viewHolder);
if (item != null) {
item.unbindView(viewHolder);
if (viewHolder instanceof FastAdapter.ViewHolder) {
((Fast... | [
"@",
"Override",
"public",
"void",
"unBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"int",
"position",
")",
"{",
"IItem",
"item",
"=",
"FastAdapter",
".",
"getHolderAdapterItemTag",
"(",
"viewHolder",
")",
";",
"if",
"(",
"item",
... | is called in onViewRecycled to unbind the data on the ViewHolder
@param viewHolder the viewHolder for the type at this position
@param position the position of this viewHolder | [
"is",
"called",
"in",
"onViewRecycled",
"to",
"unbind",
"the",
"data",
"on",
"the",
"ViewHolder"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java#L44-L58 |
32,364 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java | OnBindViewHolderListenerImpl.onViewAttachedToWindow | @Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItem(viewHolder, position);
if (item != null) {
try {
item.attachToWindow(viewHolder);
if (viewHolder instanceof FastA... | java | @Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItem(viewHolder, position);
if (item != null) {
try {
item.attachToWindow(viewHolder);
if (viewHolder instanceof FastA... | [
"@",
"Override",
"public",
"void",
"onViewAttachedToWindow",
"(",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"int",
"position",
")",
"{",
"IItem",
"item",
"=",
"FastAdapter",
".",
"getHolderAdapterItem",
"(",
"viewHolder",
",",
"position",
")",
";",
"... | is called in onViewAttachedToWindow when the view is detached from the window
@param viewHolder the viewHolder for the type at this position
@param position the position of this viewHolder | [
"is",
"called",
"in",
"onViewAttachedToWindow",
"when",
"the",
"view",
"is",
"detached",
"from",
"the",
"window"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java#L66-L79 |
32,365 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java | OnBindViewHolderListenerImpl.onViewDetachedFromWindow | @Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItemTag(viewHolder);
if (item != null) {
item.detachFromWindow(viewHolder);
if (viewHolder instanceof FastAdapter.ViewHolder) {
... | java | @Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItemTag(viewHolder);
if (item != null) {
item.detachFromWindow(viewHolder);
if (viewHolder instanceof FastAdapter.ViewHolder) {
... | [
"@",
"Override",
"public",
"void",
"onViewDetachedFromWindow",
"(",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"int",
"position",
")",
"{",
"IItem",
"item",
"=",
"FastAdapter",
".",
"getHolderAdapterItemTag",
"(",
"viewHolder",
")",
";",
"if",
"(",
"i... | is called in onViewDetachedFromWindow when the view is detached from the window
@param viewHolder the viewHolder for the type at this position
@param position the position of this viewHolder | [
"is",
"called",
"in",
"onViewDetachedFromWindow",
"when",
"the",
"view",
"is",
"detached",
"from",
"the",
"window"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java#L87-L96 |
32,366 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnCreateViewHolderListenerImpl.java | OnCreateViewHolderListenerImpl.onPreCreateViewHolder | @Override
public RecyclerView.ViewHolder onPreCreateViewHolder(FastAdapter<Item> fastAdapter, ViewGroup parent, int viewType) {
return fastAdapter.getTypeInstance(viewType).getViewHolder(parent);
} | java | @Override
public RecyclerView.ViewHolder onPreCreateViewHolder(FastAdapter<Item> fastAdapter, ViewGroup parent, int viewType) {
return fastAdapter.getTypeInstance(viewType).getViewHolder(parent);
} | [
"@",
"Override",
"public",
"RecyclerView",
".",
"ViewHolder",
"onPreCreateViewHolder",
"(",
"FastAdapter",
"<",
"Item",
">",
"fastAdapter",
",",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"return",
"fastAdapter",
".",
"getTypeInstance",
"(",
"viewTyp... | is called inside the onCreateViewHolder method and creates the viewHolder based on the provided viewTyp
@param parent the parent which will host the View
@param viewType the type of the ViewHolder we want to create
@return the generated ViewHolder based on the given viewType | [
"is",
"called",
"inside",
"the",
"onCreateViewHolder",
"method",
"and",
"creates",
"the",
"viewHolder",
"based",
"on",
"the",
"provided",
"viewTyp"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnCreateViewHolderListenerImpl.java#L21-L24 |
32,367 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnCreateViewHolderListenerImpl.java | OnCreateViewHolderListenerImpl.onPostCreateViewHolder | @Override
public RecyclerView.ViewHolder onPostCreateViewHolder(FastAdapter<Item> fastAdapter, RecyclerView.ViewHolder viewHolder) {
EventHookUtil.bind(viewHolder, fastAdapter.getEventHooks());
return viewHolder;
} | java | @Override
public RecyclerView.ViewHolder onPostCreateViewHolder(FastAdapter<Item> fastAdapter, RecyclerView.ViewHolder viewHolder) {
EventHookUtil.bind(viewHolder, fastAdapter.getEventHooks());
return viewHolder;
} | [
"@",
"Override",
"public",
"RecyclerView",
".",
"ViewHolder",
"onPostCreateViewHolder",
"(",
"FastAdapter",
"<",
"Item",
">",
"fastAdapter",
",",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
")",
"{",
"EventHookUtil",
".",
"bind",
"(",
"viewHolder",
",",
"fast... | is called after the viewHolder was created and the default listeners were added
@param viewHolder the created viewHolder after all listeners were set
@return the viewHolder given as param | [
"is",
"called",
"after",
"the",
"viewHolder",
"was",
"created",
"and",
"the",
"default",
"listeners",
"were",
"added"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnCreateViewHolderListenerImpl.java#L32-L36 |
32,368 | mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/helpers/CustomStickyRecyclerHeadersDecoration.java | CustomStickyRecyclerHeadersDecoration.setItemOffsetsForHeader | private void setItemOffsetsForHeader(Rect itemOffsets, View header, int orientation) {
mDimensionCalculator.initMargins(mTempRect, header);
if (orientation == LinearLayoutManager.VERTICAL) {
itemOffsets.top = header.getHeight() + mTempRect.top + mTempRect.bottom;
} else {
... | java | private void setItemOffsetsForHeader(Rect itemOffsets, View header, int orientation) {
mDimensionCalculator.initMargins(mTempRect, header);
if (orientation == LinearLayoutManager.VERTICAL) {
itemOffsets.top = header.getHeight() + mTempRect.top + mTempRect.bottom;
} else {
... | [
"private",
"void",
"setItemOffsetsForHeader",
"(",
"Rect",
"itemOffsets",
",",
"View",
"header",
",",
"int",
"orientation",
")",
"{",
"mDimensionCalculator",
".",
"initMargins",
"(",
"mTempRect",
",",
"header",
")",
";",
"if",
"(",
"orientation",
"==",
"LinearLa... | Sets the offsets for the first item in a section to make room for the header view
@param itemOffsets rectangle to define offsets for the item
@param header view used to calculate offset for the item
@param orientation used to calculate offset for the item | [
"Sets",
"the",
"offsets",
"for",
"the",
"first",
"item",
"in",
"a",
"section",
"to",
"make",
"room",
"for",
"the",
"header",
"view"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/helpers/CustomStickyRecyclerHeadersDecoration.java#L87-L94 |
32,369 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java | ItemFilter.withFilterPredicate | public ItemFilter<Model, Item> withFilterPredicate(IItemAdapter.Predicate<Item> filterPredicate) {
this.mFilterPredicate = filterPredicate;
return this;
} | java | public ItemFilter<Model, Item> withFilterPredicate(IItemAdapter.Predicate<Item> filterPredicate) {
this.mFilterPredicate = filterPredicate;
return this;
} | [
"public",
"ItemFilter",
"<",
"Model",
",",
"Item",
">",
"withFilterPredicate",
"(",
"IItemAdapter",
".",
"Predicate",
"<",
"Item",
">",
"filterPredicate",
")",
"{",
"this",
".",
"mFilterPredicate",
"=",
"filterPredicate",
";",
"return",
"this",
";",
"}"
] | define the predicate used to filter the list inside the ItemFilter
@param filterPredicate the predicate used to filter the list inside the ItemFilter
@return this | [
"define",
"the",
"predicate",
"used",
"to",
"filter",
"the",
"list",
"inside",
"the",
"ItemFilter"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java#L54-L57 |
32,370 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java | ItemFilter.getAdapterPosition | public int getAdapterPosition(long identifier) {
for (int i = 0, size = mOriginalItems.size(); i < size; i++) {
if (mOriginalItems.get(i).getIdentifier() == identifier) {
return i;
}
}
return -1;
} | java | public int getAdapterPosition(long identifier) {
for (int i = 0, size = mOriginalItems.size(); i < size; i++) {
if (mOriginalItems.get(i).getIdentifier() == identifier) {
return i;
}
}
return -1;
} | [
"public",
"int",
"getAdapterPosition",
"(",
"long",
"identifier",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"mOriginalItems",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"mOriginalItems",
"... | Searches for the given identifier and calculates its relative position
@param identifier the identifier of an item which is searched for
@return the relative position | [
"Searches",
"for",
"the",
"given",
"identifier",
"and",
"calculates",
"its",
"relative",
"position"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java#L184-L191 |
32,371 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java | ItemFilter.add | public ModelAdapter<?, Item> add(List<Item> items) {
if (mOriginalItems != null && items.size() > 0) {
if (mItemAdapter.isUseIdDistributor()) {
mItemAdapter.getIdDistributor().checkIds(items);
}
mOriginalItems.addAll(items);
publishResults(mConstra... | java | public ModelAdapter<?, Item> add(List<Item> items) {
if (mOriginalItems != null && items.size() > 0) {
if (mItemAdapter.isUseIdDistributor()) {
mItemAdapter.getIdDistributor().checkIds(items);
}
mOriginalItems.addAll(items);
publishResults(mConstra... | [
"public",
"ModelAdapter",
"<",
"?",
",",
"Item",
">",
"add",
"(",
"List",
"<",
"Item",
">",
"items",
")",
"{",
"if",
"(",
"mOriginalItems",
"!=",
"null",
"&&",
"items",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"mItemAdapter",
".",
"i... | add a list of items to the end of the existing items
will prior check if we are currently filtering
@param items the items to add | [
"add",
"a",
"list",
"of",
"items",
"to",
"the",
"end",
"of",
"the",
"existing",
"items",
"will",
"prior",
"check",
"if",
"we",
"are",
"currently",
"filtering"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java#L209-L220 |
32,372 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java | ItemFilter.clear | public ModelAdapter<?, Item> clear() {
if (mOriginalItems != null) {
mOriginalItems.clear();
publishResults(mConstraint, performFiltering(mConstraint));
return mItemAdapter;
} else {
return mItemAdapter.clear();
}
} | java | public ModelAdapter<?, Item> clear() {
if (mOriginalItems != null) {
mOriginalItems.clear();
publishResults(mConstraint, performFiltering(mConstraint));
return mItemAdapter;
} else {
return mItemAdapter.clear();
}
} | [
"public",
"ModelAdapter",
"<",
"?",
",",
"Item",
">",
"clear",
"(",
")",
"{",
"if",
"(",
"mOriginalItems",
"!=",
"null",
")",
"{",
"mOriginalItems",
".",
"clear",
"(",
")",
";",
"publishResults",
"(",
"mConstraint",
",",
"performFiltering",
"(",
"mConstrai... | removes all items of this adapter | [
"removes",
"all",
"items",
"of",
"this",
"adapter"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ItemFilter.java#L334-L342 |
32,373 | mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/DragDropUtil.java | DragDropUtil.bindDragHandle | public static void bindDragHandle(final RecyclerView.ViewHolder holder, final IExtendedDraggable item) {
// if necessary, init the drag handle, which will start the drag when touched
if (item.getTouchHelper() != null && item.getDragView(holder) != null) {
item.getDragView(holder).setOnTouchL... | java | public static void bindDragHandle(final RecyclerView.ViewHolder holder, final IExtendedDraggable item) {
// if necessary, init the drag handle, which will start the drag when touched
if (item.getTouchHelper() != null && item.getDragView(holder) != null) {
item.getDragView(holder).setOnTouchL... | [
"public",
"static",
"void",
"bindDragHandle",
"(",
"final",
"RecyclerView",
".",
"ViewHolder",
"holder",
",",
"final",
"IExtendedDraggable",
"item",
")",
"{",
"// if necessary, init the drag handle, which will start the drag when touched",
"if",
"(",
"item",
".",
"getTouchH... | this functions binds the view's touch listener to start the drag via the touch helper...
@param holder the view holder
@param holder the item | [
"this",
"functions",
"binds",
"the",
"view",
"s",
"touch",
"listener",
"to",
"start",
"the",
"drag",
"via",
"the",
"touch",
"helper",
"..."
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/DragDropUtil.java#L23-L37 |
32,374 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/utils/EventHookUtil.java | EventHookUtil.bind | public static <Item extends IItem> void bind(RecyclerView.ViewHolder viewHolder, @Nullable final List<EventHook<Item>> eventHooks) {
if (eventHooks == null) {
return;
}
for (final EventHook<Item> event : eventHooks) {
View view = event.onBind(viewHolder);
if (... | java | public static <Item extends IItem> void bind(RecyclerView.ViewHolder viewHolder, @Nullable final List<EventHook<Item>> eventHooks) {
if (eventHooks == null) {
return;
}
for (final EventHook<Item> event : eventHooks) {
View view = event.onBind(viewHolder);
if (... | [
"public",
"static",
"<",
"Item",
"extends",
"IItem",
">",
"void",
"bind",
"(",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"@",
"Nullable",
"final",
"List",
"<",
"EventHook",
"<",
"Item",
">",
">",
"eventHooks",
")",
"{",
"if",
"(",
"eventHooks",... | binds the hooks to the viewHolder
@param viewHolder the viewHolder of the item | [
"binds",
"the",
"hooks",
"to",
"the",
"viewHolder"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/utils/EventHookUtil.java#L30-L47 |
32,375 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/utils/EventHookUtil.java | EventHookUtil.attachToView | public static <Item extends IItem> void attachToView(final EventHook<Item> event, final RecyclerView.ViewHolder viewHolder, View view) {
if (event instanceof ClickEventHook) {
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {... | java | public static <Item extends IItem> void attachToView(final EventHook<Item> event, final RecyclerView.ViewHolder viewHolder, View view) {
if (event instanceof ClickEventHook) {
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {... | [
"public",
"static",
"<",
"Item",
"extends",
"IItem",
">",
"void",
"attachToView",
"(",
"final",
"EventHook",
"<",
"Item",
">",
"event",
",",
"final",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"View",
"view",
")",
"{",
"if",
"(",
"event",
"insta... | attaches the specific event to a view
@param event the event to attach
@param viewHolder the viewHolder containing this view
@param view the view to attach to | [
"attaches",
"the",
"specific",
"event",
"to",
"a",
"view"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/utils/EventHookUtil.java#L56-L126 |
32,376 | mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java | RangeSelectorHelper.onLongClick | public boolean onLongClick(int index, boolean selectItem) {
if (mLastLongPressIndex == null) {
// we only consider long presses on not selected items
if (mFastAdapter.getAdapterItem(index).isSelectable()) {
mLastLongPressIndex = index;
// we select this it... | java | public boolean onLongClick(int index, boolean selectItem) {
if (mLastLongPressIndex == null) {
// we only consider long presses on not selected items
if (mFastAdapter.getAdapterItem(index).isSelectable()) {
mLastLongPressIndex = index;
// we select this it... | [
"public",
"boolean",
"onLongClick",
"(",
"int",
"index",
",",
"boolean",
"selectItem",
")",
"{",
"if",
"(",
"mLastLongPressIndex",
"==",
"null",
")",
"{",
"// we only consider long presses on not selected items",
"if",
"(",
"mFastAdapter",
".",
"getAdapterItem",
"(",
... | will take care to save the long pressed index
or to select all items in the range between the current long pressed item and the last long pressed item
@param index the index of the long pressed item
@param selectItem true, if the item at the index should be selected, false if this was already done outside of this help... | [
"will",
"take",
"care",
"to",
"save",
"the",
"long",
"pressed",
"index",
"or",
"to",
"select",
"all",
"items",
"in",
"the",
"range",
"between",
"the",
"current",
"long",
"pressed",
"item",
"and",
"the",
"last",
"long",
"pressed",
"item"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java#L95-L114 |
32,377 | mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java | RangeSelectorHelper.withSavedInstanceState | public RangeSelectorHelper withSavedInstanceState(Bundle savedInstanceState, String prefix) {
if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_LAST_LONG_PRESS + prefix))
mLastLongPressIndex = savedInstanceState.getInt(BUNDLE_LAST_LONG_PRESS + prefix);
return this;
... | java | public RangeSelectorHelper withSavedInstanceState(Bundle savedInstanceState, String prefix) {
if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_LAST_LONG_PRESS + prefix))
mLastLongPressIndex = savedInstanceState.getInt(BUNDLE_LAST_LONG_PRESS + prefix);
return this;
... | [
"public",
"RangeSelectorHelper",
"withSavedInstanceState",
"(",
"Bundle",
"savedInstanceState",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"savedInstanceState",
"!=",
"null",
"&&",
"savedInstanceState",
".",
"containsKey",
"(",
"BUNDLE_LAST_LONG_PRESS",
"+",
"prefix"... | restore the index of the last long pressed index
IMPORTANT! Call this method only after all items where added to the adapters again. Otherwise it may select wrong items!
@param savedInstanceState If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recentl... | [
"restore",
"the",
"index",
"of",
"the",
"last",
"long",
"pressed",
"index",
"IMPORTANT!",
"Call",
"this",
"method",
"only",
"after",
"all",
"items",
"where",
"added",
"to",
"the",
"adapters",
"again",
".",
"Otherwise",
"it",
"may",
"select",
"wrong",
"items!... | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java#L214-L218 |
32,378 | mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterDiffUtil.java | FastAdapterDiffUtil.collapseIfPossible | private static void collapseIfPossible(FastAdapter fastAdapter) {
try {
Class c = Class.forName("com.mikepenz.fastadapter.expandable.ExpandableExtension");
if (c != null) {
IAdapterExtension extension = fastAdapter.getExtension(c);
if (extension != null) {... | java | private static void collapseIfPossible(FastAdapter fastAdapter) {
try {
Class c = Class.forName("com.mikepenz.fastadapter.expandable.ExpandableExtension");
if (c != null) {
IAdapterExtension extension = fastAdapter.getExtension(c);
if (extension != null) {... | [
"private",
"static",
"void",
"collapseIfPossible",
"(",
"FastAdapter",
"fastAdapter",
")",
"{",
"try",
"{",
"Class",
"c",
"=",
"Class",
".",
"forName",
"(",
"\"com.mikepenz.fastadapter.expandable.ExpandableExtension\"",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",... | Uses Reflection to collapse all items if this adapter uses expandable items
@param fastAdapter | [
"Uses",
"Reflection",
"to",
"collapse",
"all",
"items",
"if",
"this",
"adapter",
"uses",
"expandable",
"items"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterDiffUtil.java#L85-L98 |
32,379 | mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java | AbstractWrapAdapter.getItemViewType | @Override
public int getItemViewType(int position) {
if (shouldInsertItemAtPosition(position)) {
return getItem(position).getType();
} else {
return mAdapter.getItemViewType(position - itemInsertedBeforeCount(position));
}
} | java | @Override
public int getItemViewType(int position) {
if (shouldInsertItemAtPosition(position)) {
return getItem(position).getType();
} else {
return mAdapter.getItemViewType(position - itemInsertedBeforeCount(position));
}
} | [
"@",
"Override",
"public",
"int",
"getItemViewType",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"shouldInsertItemAtPosition",
"(",
"position",
")",
")",
"{",
"return",
"getItem",
"(",
"position",
")",
".",
"getType",
"(",
")",
";",
"}",
"else",
"{",
"r... | overwrite the getItemViewType to correctly return the value from the FastAdapter
@param position
@return | [
"overwrite",
"the",
"getItemViewType",
"to",
"correctly",
"return",
"the",
"value",
"from",
"the",
"FastAdapter"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java#L95-L102 |
32,380 | mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java | AbstractWrapAdapter.getItemId | @Override
public long getItemId(int position) {
if (shouldInsertItemAtPosition(position)) {
return getItem(position).getIdentifier();
} else {
return mAdapter.getItemId(position - itemInsertedBeforeCount(position));
}
} | java | @Override
public long getItemId(int position) {
if (shouldInsertItemAtPosition(position)) {
return getItem(position).getIdentifier();
} else {
return mAdapter.getItemId(position - itemInsertedBeforeCount(position));
}
} | [
"@",
"Override",
"public",
"long",
"getItemId",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"shouldInsertItemAtPosition",
"(",
"position",
")",
")",
"{",
"return",
"getItem",
"(",
"position",
")",
".",
"getIdentifier",
"(",
")",
";",
"}",
"else",
"{",
"... | overwrite the getItemId to correctly return the value from the FastAdapter
@param position
@return | [
"overwrite",
"the",
"getItemId",
"to",
"correctly",
"return",
"the",
"value",
"from",
"the",
"FastAdapter"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java#L110-L117 |
32,381 | mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java | AbstractWrapAdapter.getItem | public Item getItem(int position) {
if (shouldInsertItemAtPosition(position)) {
return mItems.get(itemInsertedBeforeCount(position - 1));
}
return null;
} | java | public Item getItem(int position) {
if (shouldInsertItemAtPosition(position)) {
return mItems.get(itemInsertedBeforeCount(position - 1));
}
return null;
} | [
"public",
"Item",
"getItem",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"shouldInsertItemAtPosition",
"(",
"position",
")",
")",
"{",
"return",
"mItems",
".",
"get",
"(",
"itemInsertedBeforeCount",
"(",
"position",
"-",
"1",
")",
")",
";",
"}",
"return",... | make sure we return the Item from the FastAdapter so we retrieve the item from all adapters
@param position
@return | [
"make",
"sure",
"we",
"return",
"the",
"Item",
"from",
"the",
"FastAdapter",
"so",
"we",
"retrieve",
"the",
"item",
"from",
"all",
"adapters"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java#L132-L137 |
32,382 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.getExpanded | public SparseIntArray getExpanded() {
SparseIntArray expandedItems = new SparseIntArray();
Item item;
for (int i = 0, size = mFastAdapter.getItemCount(); i < size; i++) {
item = mFastAdapter.getItem(i);
if (item instanceof IExpandable && ((IExpandable) item).isExpanded())... | java | public SparseIntArray getExpanded() {
SparseIntArray expandedItems = new SparseIntArray();
Item item;
for (int i = 0, size = mFastAdapter.getItemCount(); i < size; i++) {
item = mFastAdapter.getItem(i);
if (item instanceof IExpandable && ((IExpandable) item).isExpanded())... | [
"public",
"SparseIntArray",
"getExpanded",
"(",
")",
"{",
"SparseIntArray",
"expandedItems",
"=",
"new",
"SparseIntArray",
"(",
")",
";",
"Item",
"item",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"mFastAdapter",
".",
"getItemCount",
"(",
")"... | returns the expanded items this contains position and the count of items
which are expanded by this position
@return the expanded items | [
"returns",
"the",
"expanded",
"items",
"this",
"contains",
"position",
"and",
"the",
"count",
"of",
"items",
"which",
"are",
"expanded",
"by",
"this",
"position"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L208-L218 |
32,383 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.toggleExpandable | public void toggleExpandable(int position) {
Item item = mFastAdapter.getItem(position);
if (item instanceof IExpandable && ((IExpandable) item).isExpanded()) {
collapse(position);
} else {
expand(position);
}
} | java | public void toggleExpandable(int position) {
Item item = mFastAdapter.getItem(position);
if (item instanceof IExpandable && ((IExpandable) item).isExpanded()) {
collapse(position);
} else {
expand(position);
}
} | [
"public",
"void",
"toggleExpandable",
"(",
"int",
"position",
")",
"{",
"Item",
"item",
"=",
"mFastAdapter",
".",
"getItem",
"(",
"position",
")",
";",
"if",
"(",
"item",
"instanceof",
"IExpandable",
"&&",
"(",
"(",
"IExpandable",
")",
"item",
")",
".",
... | toggles the expanded state of the given expandable item at the given position
@param position the global position | [
"toggles",
"the",
"expanded",
"state",
"of",
"the",
"given",
"expandable",
"item",
"at",
"the",
"given",
"position"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L309-L316 |
32,384 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.collapse | public void collapse(boolean notifyItemChanged) {
int[] expandedItems = getExpandedItems();
for (int i = expandedItems.length - 1; i >= 0; i--) {
collapse(expandedItems[i], notifyItemChanged);
}
} | java | public void collapse(boolean notifyItemChanged) {
int[] expandedItems = getExpandedItems();
for (int i = expandedItems.length - 1; i >= 0; i--) {
collapse(expandedItems[i], notifyItemChanged);
}
} | [
"public",
"void",
"collapse",
"(",
"boolean",
"notifyItemChanged",
")",
"{",
"int",
"[",
"]",
"expandedItems",
"=",
"getExpandedItems",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"expandedItems",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",... | collapses all expanded items
@param notifyItemChanged true if we need to call notifyItemChanged. DEFAULT: false | [
"collapses",
"all",
"expanded",
"items"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L330-L335 |
32,385 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.expand | public void expand(boolean notifyItemChanged) {
int length = mFastAdapter.getItemCount();
for (int i = length - 1; i >= 0; i--) {
expand(i, notifyItemChanged);
}
} | java | public void expand(boolean notifyItemChanged) {
int length = mFastAdapter.getItemCount();
for (int i = length - 1; i >= 0; i--) {
expand(i, notifyItemChanged);
}
} | [
"public",
"void",
"expand",
"(",
"boolean",
"notifyItemChanged",
")",
"{",
"int",
"length",
"=",
"mFastAdapter",
".",
"getItemCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"ex... | expands all expandable items
@param notifyItemChanged true if we need to call notifyItemChanged. DEFAULT: false | [
"expands",
"all",
"expandable",
"items"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L413-L418 |
32,386 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.expand | public void expand(int position, boolean notifyItemChanged) {
Item item = mFastAdapter.getItem(position);
if (item != null && item instanceof IExpandable) {
IExpandable expandable = (IExpandable) item;
//if this item is not already expanded and has sub items we go on
... | java | public void expand(int position, boolean notifyItemChanged) {
Item item = mFastAdapter.getItem(position);
if (item != null && item instanceof IExpandable) {
IExpandable expandable = (IExpandable) item;
//if this item is not already expanded and has sub items we go on
... | [
"public",
"void",
"expand",
"(",
"int",
"position",
",",
"boolean",
"notifyItemChanged",
")",
"{",
"Item",
"item",
"=",
"mFastAdapter",
".",
"getItem",
"(",
"position",
")",
";",
"if",
"(",
"item",
"!=",
"null",
"&&",
"item",
"instanceof",
"IExpandable",
"... | opens the expandable item at the given position
@param position the global position
@param notifyItemChanged true if we need to call notifyItemChanged. DEFAULT: false | [
"opens",
"the",
"expandable",
"item",
"at",
"the",
"given",
"position"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L436-L456 |
32,387 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.getExpandedItemsCount | public int getExpandedItemsCount(int from, int position) {
int totalAddedItems = 0;
//first we find out how many items were added in total
//also counting subItems
Item tmp;
for (int i = from; i < position; i++) {
tmp = mFastAdapter.getItem(i);
if (tmp ins... | java | public int getExpandedItemsCount(int from, int position) {
int totalAddedItems = 0;
//first we find out how many items were added in total
//also counting subItems
Item tmp;
for (int i = from; i < position; i++) {
tmp = mFastAdapter.getItem(i);
if (tmp ins... | [
"public",
"int",
"getExpandedItemsCount",
"(",
"int",
"from",
",",
"int",
"position",
")",
"{",
"int",
"totalAddedItems",
"=",
"0",
";",
"//first we find out how many items were added in total",
"//also counting subItems",
"Item",
"tmp",
";",
"for",
"(",
"int",
"i",
... | calculates the count of expandable items before a given position
@param from the global start position you should pass here the count of items of the previous adapters (or 0 if you want to start from the beginning)
@param position the global position
@return the count of expandable items before a given position | [
"calculates",
"the",
"count",
"of",
"expandable",
"items",
"before",
"a",
"given",
"position"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L465-L480 |
32,388 | mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.deselect | public void deselect() {
SelectExtension<Item> selectExtension = mFastAdapter.getExtension(SelectExtension.class);
if (selectExtension == null) {
return;
}
for (Item item : AdapterUtil.getAllItems(mFastAdapter)) {
selectExtension.deselect(item);
}
... | java | public void deselect() {
SelectExtension<Item> selectExtension = mFastAdapter.getExtension(SelectExtension.class);
if (selectExtension == null) {
return;
}
for (Item item : AdapterUtil.getAllItems(mFastAdapter)) {
selectExtension.deselect(item);
}
... | [
"public",
"void",
"deselect",
"(",
")",
"{",
"SelectExtension",
"<",
"Item",
">",
"selectExtension",
"=",
"mFastAdapter",
".",
"getExtension",
"(",
"SelectExtension",
".",
"class",
")",
";",
"if",
"(",
"selectExtension",
"==",
"null",
")",
"{",
"return",
";"... | deselects all selections | [
"deselects",
"all",
"selections"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L485-L494 |
32,389 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java | AbstractItem.generateView | @Override
public View generateView(Context ctx) {
VH viewHolder = getViewHolder(createView(ctx, null));
//as we already know the type of our ViewHolder cast it to our type
bindView(viewHolder, Collections.EMPTY_LIST);
//return the bound view
return viewHolder.itemView;
... | java | @Override
public View generateView(Context ctx) {
VH viewHolder = getViewHolder(createView(ctx, null));
//as we already know the type of our ViewHolder cast it to our type
bindView(viewHolder, Collections.EMPTY_LIST);
//return the bound view
return viewHolder.itemView;
... | [
"@",
"Override",
"public",
"View",
"generateView",
"(",
"Context",
"ctx",
")",
"{",
"VH",
"viewHolder",
"=",
"getViewHolder",
"(",
"createView",
"(",
"ctx",
",",
"null",
")",
")",
";",
"//as we already know the type of our ViewHolder cast it to our type",
"bindView",
... | generates a view by the defined LayoutRes
@param ctx
@return | [
"generates",
"a",
"view",
"by",
"the",
"defined",
"LayoutRes"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java#L256-L265 |
32,390 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java | AbstractItem.getViewHolder | @Override
public VH getViewHolder(ViewGroup parent) {
return getViewHolder(createView(parent.getContext(), parent));
} | java | @Override
public VH getViewHolder(ViewGroup parent) {
return getViewHolder(createView(parent.getContext(), parent));
} | [
"@",
"Override",
"public",
"VH",
"getViewHolder",
"(",
"ViewGroup",
"parent",
")",
"{",
"return",
"getViewHolder",
"(",
"createView",
"(",
"parent",
".",
"getContext",
"(",
")",
",",
"parent",
")",
")",
";",
"}"
] | Generates a ViewHolder from this Item with the given parent
@param parent
@return | [
"Generates",
"a",
"ViewHolder",
"from",
"this",
"Item",
"with",
"the",
"given",
"parent"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java#L290-L293 |
32,391 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.models | public static <Model, Item extends IItem> ModelAdapter<Model, Item> models(IInterceptor<Model, Item> interceptor) {
return new ModelAdapter<>(interceptor);
} | java | public static <Model, Item extends IItem> ModelAdapter<Model, Item> models(IInterceptor<Model, Item> interceptor) {
return new ModelAdapter<>(interceptor);
} | [
"public",
"static",
"<",
"Model",
",",
"Item",
"extends",
"IItem",
">",
"ModelAdapter",
"<",
"Model",
",",
"Item",
">",
"models",
"(",
"IInterceptor",
"<",
"Model",
",",
"Item",
">",
"interceptor",
")",
"{",
"return",
"new",
"ModelAdapter",
"<>",
"(",
"i... | static method to retrieve a new `ItemAdapter`
@return a new ItemAdapter | [
"static",
"method",
"to",
"retrieve",
"a",
"new",
"ItemAdapter"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L67-L69 |
32,392 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.intercept | public List<Item> intercept(List<Model> models) {
List<Item> items = new ArrayList<>(models.size());
Item item;
for (Model model : models) {
item = intercept(model);
if (item == null) continue;
items.add(item);
}
return items;
} | java | public List<Item> intercept(List<Model> models) {
List<Item> items = new ArrayList<>(models.size());
Item item;
for (Model model : models) {
item = intercept(model);
if (item == null) continue;
items.add(item);
}
return items;
} | [
"public",
"List",
"<",
"Item",
">",
"intercept",
"(",
"List",
"<",
"Model",
">",
"models",
")",
"{",
"List",
"<",
"Item",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"models",
".",
"size",
"(",
")",
")",
";",
"Item",
"item",
";",
"for",
"("... | Generates a List of Item based on it's List of Model using the interceptor
@param models the List of Model which will be used to create the List of Item
@return the generated List of Item | [
"Generates",
"a",
"List",
"of",
"Item",
"based",
"on",
"it",
"s",
"List",
"of",
"Model",
"using",
"the",
"interceptor"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L110-L119 |
32,393 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.withItemFilter | public ModelAdapter<Model, Item> withItemFilter(ItemFilter<Model, Item> itemFilter) {
this.mItemFilter = itemFilter;
return this;
} | java | public ModelAdapter<Model, Item> withItemFilter(ItemFilter<Model, Item> itemFilter) {
this.mItemFilter = itemFilter;
return this;
} | [
"public",
"ModelAdapter",
"<",
"Model",
",",
"Item",
">",
"withItemFilter",
"(",
"ItemFilter",
"<",
"Model",
",",
"Item",
">",
"itemFilter",
")",
"{",
"this",
".",
"mItemFilter",
"=",
"itemFilter",
";",
"return",
"this",
";",
"}"
] | allows you to define your own Filter implementation instead of the default `ItemFilter`
@param itemFilter the filter to use
@return this | [
"allows",
"you",
"to",
"define",
"your",
"own",
"Filter",
"implementation",
"instead",
"of",
"the",
"default",
"ItemFilter"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L171-L174 |
32,394 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.getModels | public List<Model> getModels() {
ArrayList<Model> list = new ArrayList<>(mItems.size());
for (Item item : mItems.getItems()) {
if (mReverseInterceptor != null) {
list.add(mReverseInterceptor.intercept(item));
} else if (item instanceof IModelItem) {
... | java | public List<Model> getModels() {
ArrayList<Model> list = new ArrayList<>(mItems.size());
for (Item item : mItems.getItems()) {
if (mReverseInterceptor != null) {
list.add(mReverseInterceptor.intercept(item));
} else if (item instanceof IModelItem) {
... | [
"public",
"List",
"<",
"Model",
">",
"getModels",
"(",
")",
"{",
"ArrayList",
"<",
"Model",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"mItems",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Item",
"item",
":",
"mItems",
".",
"getItems",
"(",... | the ModelAdapter does not keep a list of input model's to get retrieve them a `reverseInterceptor` is required
usually it is used to get the `Model` from a `IModelItem`
@return a List of initial Model's | [
"the",
"ModelAdapter",
"does",
"not",
"keep",
"a",
"list",
"of",
"input",
"model",
"s",
"to",
"get",
"retrieve",
"them",
"a",
"reverseInterceptor",
"is",
"required",
"usually",
"it",
"is",
"used",
"to",
"get",
"the",
"Model",
"from",
"a",
"IModelItem"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L198-L210 |
32,395 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.add | @SafeVarargs
public final ModelAdapter<Model, Item> add(Model... items) {
return add(asList(items));
} | java | @SafeVarargs
public final ModelAdapter<Model, Item> add(Model... items) {
return add(asList(items));
} | [
"@",
"SafeVarargs",
"public",
"final",
"ModelAdapter",
"<",
"Model",
",",
"Item",
">",
"add",
"(",
"Model",
"...",
"items",
")",
"{",
"return",
"add",
"(",
"asList",
"(",
"items",
")",
")",
";",
"}"
] | add an array of items to the end of the existing items
@param items the items to add | [
"add",
"an",
"array",
"of",
"items",
"to",
"the",
"end",
"of",
"the",
"existing",
"items"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L385-L388 |
32,396 | mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.add | public ModelAdapter<Model, Item> add(List<Model> list) {
List<Item> items = intercept(list);
return addInternal(items);
} | java | public ModelAdapter<Model, Item> add(List<Model> list) {
List<Item> items = intercept(list);
return addInternal(items);
} | [
"public",
"ModelAdapter",
"<",
"Model",
",",
"Item",
">",
"add",
"(",
"List",
"<",
"Model",
">",
"list",
")",
"{",
"List",
"<",
"Item",
">",
"items",
"=",
"intercept",
"(",
"list",
")",
";",
"return",
"addInternal",
"(",
"items",
")",
";",
"}"
] | add a list of items to the end of the existing items
@param list the items to add | [
"add",
"a",
"list",
"of",
"items",
"to",
"the",
"end",
"of",
"the",
"existing",
"items"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L395-L398 |
32,397 | mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java | FastAdapterDialog.withOnClickListener | public FastAdapterDialog<Item> withOnClickListener(com.mikepenz.fastadapter.listeners.OnClickListener<Item> onClickListener) {
this.mFastAdapter.withOnClickListener(onClickListener);
return this;
} | java | public FastAdapterDialog<Item> withOnClickListener(com.mikepenz.fastadapter.listeners.OnClickListener<Item> onClickListener) {
this.mFastAdapter.withOnClickListener(onClickListener);
return this;
} | [
"public",
"FastAdapterDialog",
"<",
"Item",
">",
"withOnClickListener",
"(",
"com",
".",
"mikepenz",
".",
"fastadapter",
".",
"listeners",
".",
"OnClickListener",
"<",
"Item",
">",
"onClickListener",
")",
"{",
"this",
".",
"mFastAdapter",
".",
"withOnClickListener... | Define the OnClickListener which will be used for a single item
@param onClickListener the OnClickListener which will be used for a single item
@return this | [
"Define",
"the",
"OnClickListener",
"which",
"will",
"be",
"used",
"for",
"a",
"single",
"item"
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L267-L270 |
32,398 | mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/SortActivity.java | SortActivity.generateUnsortedList | private List<SimpleItem> generateUnsortedList() {
ArrayList<SimpleItem> result = new ArrayList<>(26);
for (int i = 0; i < 26; i++) {
result.add(makeItem(i));
}
Collections.shuffle(result);
return result;
} | java | private List<SimpleItem> generateUnsortedList() {
ArrayList<SimpleItem> result = new ArrayList<>(26);
for (int i = 0; i < 26; i++) {
result.add(makeItem(i));
}
Collections.shuffle(result);
return result;
} | [
"private",
"List",
"<",
"SimpleItem",
">",
"generateUnsortedList",
"(",
")",
"{",
"ArrayList",
"<",
"SimpleItem",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"26",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"26",
";",
"i",
"+... | Generates a simple list consisting of the letters of the alphabet, unordered on purpose.
@return The new list. | [
"Generates",
"a",
"simple",
"list",
"consisting",
"of",
"the",
"letters",
"of",
"the",
"alphabet",
"unordered",
"on",
"purpose",
"."
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/SortActivity.java#L210-L220 |
32,399 | mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/SortActivity.java | SortActivity.makeItem | private SimpleItem makeItem(@IntRange(from = 0, to = 25) int position) {
SimpleItem result = new SimpleItem();
result.withName(ALPHABET[position]);
position++;
String description = "The " + (position);
if (position == 1 || position == 21) {
description += "st";
... | java | private SimpleItem makeItem(@IntRange(from = 0, to = 25) int position) {
SimpleItem result = new SimpleItem();
result.withName(ALPHABET[position]);
position++;
String description = "The " + (position);
if (position == 1 || position == 21) {
description += "st";
... | [
"private",
"SimpleItem",
"makeItem",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"25",
")",
"int",
"position",
")",
"{",
"SimpleItem",
"result",
"=",
"new",
"SimpleItem",
"(",
")",
";",
"result",
".",
"withName",
"(",
"ALPHABET",
"[",
... | Build a simple item with one letter of the alphabet.
@param position The position of the letter in the alphabet.
@return The new item. | [
"Build",
"a",
"simple",
"item",
"with",
"one",
"letter",
"of",
"the",
"alphabet",
"."
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/SortActivity.java#L228-L248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.