_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q25500 | Context.addResolvedFrom | train | public void addResolvedFrom(Context context) {
context.getResolvedExpressions().forEach(this::addResolvedExpression);
context.getResolvedFunctions().forEach(this::addResolvedFunction);
context.getResolvedValues().forEach(this::addResolvedValue);
} | java | {
"resource": ""
} |
q25501 | JinjavaInterpreter.renderFlat | train | public String renderFlat(String template) {
int depth = context.getRenderDepth();
try {
if (depth > config.getMaxRenderDepth()) {
ENGINE_LOG.warn("Max render depth exceeded: {}", Integer.toString(depth));
return template;
} else {
context.setRenderDepth(depth + 1);
r... | java | {
"resource": ""
} |
q25502 | JinjavaInterpreter.render | train | public String render(String template) {
ENGINE_LOG.debug(template);
return render(parse(template), true);
} | java | {
"resource": ""
} |
q25503 | JinjavaInterpreter.render | train | public String render(Node root, boolean processExtendRoots) {
OutputList output = new OutputList(config.getMaxOutputSize());
for (Node node : root.getChildren()) {
lineNumber = node.getLineNumber();
position = node.getStartPosition();
String renderStr = node.getMaster().getImage();
if (... | java | {
"resource": ""
} |
q25504 | JinjavaInterpreter.retraceVariable | train | public Object retraceVariable(String variable, int lineNumber, int startPosition) {
if (StringUtils.isBlank(variable)) {
return "";
}
Variable var = new Variable(this, variable);
String varName = var.getName();
Object obj = context.get(varName);
if (obj != null) {
if (obj instanceof ... | java | {
"resource": ""
} |
q25505 | TagToken.parse | train | @Override
protected void parse() {
if (image.length() < 4) {
throw new TemplateSyntaxException(image, "Malformed tag token", getLineNumber(), getStartPosition());
}
content = image.substring(2, image.length() - 2);
if (WhitespaceUtils.startsWith(content, "-")) {
setLeftTrim(true);
... | java | {
"resource": ""
} |
q25506 | JinjavaBeanELResolver.transformPropertyName | train | private String transformPropertyName(Object property) {
if (property == null) {
return null;
}
String propertyStr = property.toString();
if (propertyStr.indexOf('_') == -1) {
return propertyStr;
}
return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, propertyStr);
} | java | {
"resource": ""
} |
q25507 | JinjavaListELResolver.toIndex | train | private static int toIndex(Object property) {
int index = 0;
if (property instanceof Number) {
index = ((Number) property).intValue();
} else if (property instanceof String) {
try {
// ListELResolver uses valueOf, but findbugs complains.
index = Integer.parseInt((String) p... | java | {
"resource": ""
} |
q25508 | BinaryUploadRequest.setFileToUpload | train | public BinaryUploadRequest setFileToUpload(String path) throws FileNotFoundException {
params.files.clear();
params.files.add(new UploadFile(path));
return this;
} | java | {
"resource": ""
} |
q25509 | AndroidPermissions.checkPermissions | train | public boolean checkPermissions() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1)
return true;
for (String permission : mRequiredPermissions) {
if (ContextCompat.checkSelfPermission(mContext, permission) != PackageManager.PERMISSION_GRANTED) {
mP... | java | {
"resource": ""
} |
q25510 | MultipartUploadRequest.addFileToUpload | train | public MultipartUploadRequest addFileToUpload(String filePath,
String parameterName,
String fileName, String contentType)
throws FileNotFoundException, IllegalArgumentException {
UploadFile file = ne... | java | {
"resource": ""
} |
q25511 | UploadNotificationConfig.setTitleForAllStatuses | train | public final UploadNotificationConfig setTitleForAllStatuses(String title) {
progress.title = title;
completed.title = title;
error.title = title;
cancelled.title = title;
return this;
} | java | {
"resource": ""
} |
q25512 | UploadNotificationConfig.setLargeIconForAllStatuses | train | public final UploadNotificationConfig setLargeIconForAllStatuses(Bitmap largeIcon) {
progress.largeIcon = largeIcon;
completed.largeIcon = largeIcon;
error.largeIcon = largeIcon;
cancelled.largeIcon = largeIcon;
return this;
} | java | {
"resource": ""
} |
q25513 | UploadNotificationConfig.setClickIntentForAllStatuses | train | public final UploadNotificationConfig setClickIntentForAllStatuses(PendingIntent clickIntent) {
progress.clickIntent = clickIntent;
completed.clickIntent = clickIntent;
error.clickIntent = clickIntent;
cancelled.clickIntent = clickIntent;
return this;
} | java | {
"resource": ""
} |
q25514 | UploadNotificationConfig.addActionForAllStatuses | train | public final UploadNotificationConfig addActionForAllStatuses(UploadNotificationAction action) {
progress.actions.add(action);
completed.actions.add(action);
error.actions.add(action);
cancelled.actions.add(action);
return this;
} | java | {
"resource": ""
} |
q25515 | HttpUploadRequest.addHeader | train | public B addHeader(final String headerName, final String headerValue) {
httpParams.addHeader(headerName, headerValue);
return self();
} | java | {
"resource": ""
} |
q25516 | HttpUploadRequest.setBasicAuth | train | public B setBasicAuth(final String username, final String password) {
String auth = Base64.encodeToString((username + ":" + password).getBytes(), Base64.NO_WRAP);
httpParams.addHeader("Authorization", "Basic " + auth);
return self();
} | java | {
"resource": ""
} |
q25517 | HttpUploadRequest.addParameter | train | public B addParameter(final String paramName, final String paramValue) {
httpParams.addParameter(paramName, paramValue);
return self();
} | java | {
"resource": ""
} |
q25518 | HttpUploadRequest.setCustomUserAgent | train | public B setCustomUserAgent(String customUserAgent) {
if (customUserAgent != null && !customUserAgent.isEmpty()) {
httpParams.customUserAgent = customUserAgent;
}
return self();
} | java | {
"resource": ""
} |
q25519 | UploadService.stopUpload | train | public static synchronized void stopUpload(final String uploadId) {
UploadTask removedTask = uploadTasksMap.get(uploadId);
if (removedTask != null) {
removedTask.cancel();
}
} | java | {
"resource": ""
} |
q25520 | UploadService.getTaskList | train | public static synchronized List<String> getTaskList() {
List<String> tasks;
if (uploadTasksMap.isEmpty()) {
tasks = new ArrayList<>(1);
} else {
tasks = new ArrayList<>(uploadTasksMap.size());
tasks.addAll(uploadTasksMap.keySet());
}
return t... | java | {
"resource": ""
} |
q25521 | UploadService.stopAllUploads | train | public static synchronized void stopAllUploads() {
if (uploadTasksMap.isEmpty()) {
return;
}
// using iterator instead for each loop, because it's faster on Android
Iterator<String> iterator = uploadTasksMap.keySet().iterator();
while (iterator.hasNext()) {
... | java | {
"resource": ""
} |
q25522 | UploadService.getTask | train | UploadTask getTask(Intent intent) {
String taskClass = intent.getStringExtra(PARAM_TASK_CLASS);
if (taskClass == null) {
return null;
}
UploadTask uploadTask = null;
try {
Class<?> task = Class.forName(taskClass);
if (UploadTask.class.isAss... | java | {
"resource": ""
} |
q25523 | UploadService.holdForegroundNotification | train | protected synchronized boolean holdForegroundNotification(String uploadId, Notification notification) {
if (!isExecuteInForeground()) return false;
if (foregroundUploadId == null) {
foregroundUploadId = uploadId;
Logger.debug(TAG, uploadId + " now holds the foreground notificati... | java | {
"resource": ""
} |
q25524 | UploadService.setUploadStatusDelegate | train | protected static void setUploadStatusDelegate(String uploadId, UploadStatusDelegate delegate) {
if (delegate == null)
return;
uploadDelegates.put(uploadId, new WeakReference<>(delegate));
} | java | {
"resource": ""
} |
q25525 | UploadService.getUploadStatusDelegate | train | protected static UploadStatusDelegate getUploadStatusDelegate(String uploadId) {
WeakReference<UploadStatusDelegate> reference = uploadDelegates.get(uploadId);
if (reference == null)
return null;
UploadStatusDelegate delegate = reference.get();
if (delegate == null) {
... | java | {
"resource": ""
} |
q25526 | UploadRequest.startUpload | train | public String startUpload() {
UploadService.setUploadStatusDelegate(params.id, delegate);
final Intent intent = new Intent(context, UploadService.class);
this.initializeIntent(intent);
intent.setAction(UploadService.getActionUpload());
if (Build.VERSION.SDK_INT >= Build.VERSION... | java | {
"resource": ""
} |
q25527 | BackHandlingFilePickerFragment.goUp | train | public void goUp() {
mCurrentPath = getParent(mCurrentPath);
mCheckedItems.clear();
mCheckedVisibleViewHolders.clear();
refresh(mCurrentPath);
} | java | {
"resource": ""
} |
q25528 | UploadFile.getProperty | train | public String getProperty(String key, String defaultValue) {
String val = properties.get(key);
if (val == null) {
val = defaultValue;
}
return val;
} | java | {
"resource": ""
} |
q25529 | FTPUploadTask.calculateUploadedAndTotalBytes | train | private void calculateUploadedAndTotalBytes() {
uploadedBytes = 0;
for (String filePath : getSuccessfullyUploadedFiles()) {
uploadedBytes += new File(filePath).length();
}
totalBytes = uploadedBytes;
for (UploadFile file : params.files) {
totalBytes += ... | java | {
"resource": ""
} |
q25530 | FTPUploadTask.makeDirectories | train | private void makeDirectories(String dirPath, String permissions) throws IOException {
if (!dirPath.contains("/")) return;
String[] pathElements = dirPath.split("/");
if (pathElements.length == 1) return;
// if the string ends with / it means that the dir path contains only directories... | java | {
"resource": ""
} |
q25531 | FTPUploadTask.getRemoteFileName | train | private String getRemoteFileName(UploadFile file) {
// if the remote path ends with /
// it means that the remote path specifies only the directory structure, so
// get the remote file name from the local file
if (file.getProperty(PARAM_REMOTE_PATH).endsWith("/")) {
return f... | java | {
"resource": ""
} |
q25532 | FTPUploadRequest.setUsernameAndPassword | train | public FTPUploadRequest setUsernameAndPassword(String username, String password) {
if (username == null || "".equals(username)) {
throw new IllegalArgumentException("Specify FTP account username!");
}
if (password == null || "".equals(password)) {
throw new IllegalArgume... | java | {
"resource": ""
} |
q25533 | BodyWriter.writeStream | train | public final void writeStream(InputStream stream, OnStreamWriteListener listener) throws IOException {
if (listener == null)
throw new IllegalArgumentException("listener MUST not be null!");
byte[] buffer = new byte[UploadService.BUFFER_SIZE];
int bytesRead;
try {
... | java | {
"resource": ""
} |
q25534 | UploadNotificationAction.from | train | public static UploadNotificationAction from(NotificationCompat.Action action) {
return new UploadNotificationAction(action.icon, action.title, action.actionIntent);
} | java | {
"resource": ""
} |
q25535 | Placeholders.replace | train | public static String replace(String string, UploadInfo uploadInfo) {
if (string == null || string.isEmpty())
return "";
String tmp;
tmp = string.replace(ELAPSED_TIME, uploadInfo.getElapsedTimeString());
tmp = tmp.replace(PROGRESS, uploadInfo.getProgressPercent() + "%");
... | java | {
"resource": ""
} |
q25536 | UploadTask.broadcastProgress | train | protected final void broadcastProgress(final long uploadedBytes, final long totalBytes) {
long currentTime = System.currentTimeMillis();
if (uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService.PROGRESS_REPORT_INTERVAL) {
return;
}
setLas... | java | {
"resource": ""
} |
q25537 | UploadTask.addSuccessfullyUploadedFile | train | protected final void addSuccessfullyUploadedFile(UploadFile file) {
if (!successfullyUploadedFiles.contains(file.path)) {
successfullyUploadedFiles.add(file.path);
params.files.remove(file);
}
} | java | {
"resource": ""
} |
q25538 | UploadTask.createNotification | train | private void createNotification(UploadInfo uploadInfo) {
if (params.notificationConfig == null || params.notificationConfig.getProgress().message == null)
return;
UploadNotificationStatusConfig statusConfig = params.notificationConfig.getProgress();
notificationCreationTimeMillis = ... | java | {
"resource": ""
} |
q25539 | UploadTask.deleteFile | train | private boolean deleteFile(File fileToDelete) {
boolean deleted = false;
try {
deleted = fileToDelete.delete();
if (!deleted) {
Logger.error(LOG_TAG, "Unable to delete: "
+ fileToDelete.getAbsolutePath());
} else {
... | java | {
"resource": ""
} |
q25540 | NumberUtils.formatNumber | train | private static String formatNumber(final Number target, final Integer minIntegerDigits,
final NumberPointType thousandsPointType, final Integer fractionDigits,
final NumberPointType decimalPointType, final Locale locale) {
Validate.notNull(fractionDigits, "Fraction digits cannot be null");
... | java | {
"resource": ""
} |
q25541 | NumberUtils.formatCurrency | train | public static String formatCurrency(final Number target, final Locale locale) {
Validate.notNull(locale, "Locale cannot be null");
if (target == null) {
return null;
}
NumberFormat format = NumberFormat.getCurrencyInstance(locale);
return format.format(target);
... | java | {
"resource": ""
} |
q25542 | NumberUtils.formatPercent | train | public static String formatPercent(final Number target, final Integer minIntegerDigits,
final Integer fractionDigits, final Locale locale) {
Validate.notNull(fractionDigits, "Fraction digits cannot be null");
Validate.notNull(locale, "Locale cannot be null");
if (target == null) {
... | java | {
"resource": ""
} |
q25543 | Model.sameAs | train | boolean sameAs(final Model model) {
if (model == null || model.queueSize != this.queueSize) {
return false;
}
for (int i = 0; i < this.queueSize; i++) {
if (this.queue[i] != model.queue[i]) {
return false;
}
}
return true;
} | java | {
"resource": ""
} |
q25544 | SSEThrottledTemplateWriter.checkTokenValid | train | private static boolean checkTokenValid(final char[] token) {
if (token == null || token.length == 0) {
return true;
}
for (int i = 0; i < token.length; i++) {
if (token[i] == '\n') {
return false;
}
}
return true;
} | java | {
"resource": ""
} |
q25545 | FessBaseAction.godHandPrologue | train | @Override
public ActionResponse godHandPrologue(final ActionRuntime runtime) {
fessLoginAssist.getSavedUserBean().ifPresent(u -> {
boolean result = u.getFessUser().refresh();
if (logger.isDebugEnabled()) {
logger.debug("refresh user info: {}", result);
}
... | java | {
"resource": ""
} |
q25546 | KuromojiCSVUtil.quoteEscape | train | public static String quoteEscape(final String original) {
String result = original;
if (result.indexOf('\"') >= 0) {
result = result.replace("\"", ESCAPED_QUOTE);
}
if (result.indexOf(COMMA) >= 0) {
result = "\"" + result + "\"";
}
return result;
... | java | {
"resource": ""
} |
q25547 | ComponentUtil.setFessConfig | train | public static void setFessConfig(final FessConfig fessConfig) {
ComponentUtil.fessConfig = fessConfig;
if (fessConfig == null) {
FessProp.propMap.clear();
componentMap.clear();
}
} | java | {
"resource": ""
} |
q25548 | SuperPositionQCP.set | train | private void set(Point3d[] x, Point3d[] y) {
this.x = x;
this.y = y;
rmsdCalculated = false;
transformationCalculated = false;
} | java | {
"resource": ""
} |
q25549 | SuperPositionQCP.weightedSuperpose | train | public Matrix4d weightedSuperpose(Point3d[] fixed, Point3d[] moved, double[] weight) {
set(moved, fixed, weight);
getRotationMatrix();
if (!centered) {
calcTransformation();
} else {
transformation.set(rotmat);
}
return transformation;
} | java | {
"resource": ""
} |
q25550 | SuperPositionQCP.calcRmsd | train | private void calcRmsd(Point3d[] x, Point3d[] y) {
if (centered) {
innerProduct(y, x);
} else {
// translate to origin
xref = CalcPoint.clonePoint3dArray(x);
xtrans = CalcPoint.centroid(xref);
logger.debug("x centroid: " + xtrans);
xtrans.negate();
CalcPoint.translate(new Vector3d(xtrans), xref)... | java | {
"resource": ""
} |
q25551 | AsaCalculator.calculateAsas | train | public double[] calculateAsas() {
double[] asas = new double[atomCoords.length];
long start = System.currentTimeMillis();
if (useSpatialHashingForNeighbors) {
logger.debug("Will use spatial hashing to find neighbors");
neighborIndices = findNeighborIndicesSpatialHashing();
} else {
logger.debug("Will... | java | {
"resource": ""
} |
q25552 | AsaCalculator.generateSpherePoints | train | private Point3d[] generateSpherePoints(int nSpherePoints) {
Point3d[] points = new Point3d[nSpherePoints];
double inc = Math.PI * (3.0 - Math.sqrt(5.0));
double offset = 2.0 / nSpherePoints;
for (int k=0;k<nSpherePoints;k++) {
double y = k * offset - 1.0 + (offset / 2.0);
double r = Math.sqrt(1.0 - y*y);
... | java | {
"resource": ""
} |
q25553 | AsaCalculator.findNeighborIndices | train | int[][] findNeighborIndices() {
// looking at a typical protein case, number of neighbours are from ~10 to ~50, with an average of ~30
int initialCapacity = 60;
int[][] nbsIndices = new int[atomCoords.length][];
for (int k=0; k<atomCoords.length; k++) {
double radius = radii[k] + probe + probe;
List<I... | java | {
"resource": ""
} |
q25554 | AsaCalculator.findNeighborIndicesSpatialHashing | train | int[][] findNeighborIndicesSpatialHashing() {
// looking at a typical protein case, number of neighbours are from ~10 to ~50, with an average of ~30
int initialCapacity = 60;
List<Contact> contactList = calcContacts();
Map<Integer, List<Integer>> indices = new HashMap<>(atomCoords.length);
for (Contact cont... | java | {
"resource": ""
} |
q25555 | AsaCalculator.getRadiusForAmino | train | private static double getRadiusForAmino(AminoAcid amino, Atom atom) {
if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius();
// some unusual entries (e.g. 1tes) contain Deuterium atoms in standard aminoacids
if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius();
String at... | java | {
"resource": ""
} |
q25556 | AsaCalculator.getRadiusForNucl | train | private static double getRadiusForNucl(NucleotideImpl nuc, Atom atom) {
if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius();
if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius();
if (atom.getElement()==Element.C) return NUC_CARBON_VDW;
if (atom.getElement()==Element.N... | java | {
"resource": ""
} |
q25557 | MmtfStructureReader.getCorrectAltLocGroup | train | private Group getCorrectAltLocGroup(Character altLoc) {
// see if we know this altLoc already;
List<Atom> atoms = group.getAtoms();
if (atoms.size() > 0) {
Atom a1 = atoms.get(0);
// we are just adding atoms to the current group
// probably there is a second group following later...
if (a1.getAltLoc()... | java | {
"resource": ""
} |
q25558 | URLIdentifier.loadStructure | train | @Override
public Structure loadStructure(AtomCache cache) throws StructureException,
IOException {
StructureFiletype format = StructureFiletype.UNKNOWN;
// Use user-specified format
try {
Map<String, String> params = parseQuery(url);
if(params.containsKey(FORMAT_PARAM)) {
String formatStr = params.... | java | {
"resource": ""
} |
q25559 | URLIdentifier.guessPDBID | train | public static String guessPDBID(String name) {
Matcher match = PDBID_REGEX.matcher(name);
if(match.matches()) {
return match.group(1).toUpperCase();
} else {
// Give up if doesn't match
return null;
}
} | java | {
"resource": ""
} |
q25560 | URLIdentifier.parseQuery | train | private static Map<String,String> parseQuery(URL url) throws UnsupportedEncodingException {
Map<String,String> params = new LinkedHashMap<String, String>();
String query = url.getQuery();
if( query == null || query.isEmpty()) {
// empty query
return params;
}
String[] pairs = url.getQuery().split("&");
... | java | {
"resource": ""
} |
q25561 | LocalPDBDirectory.getInputStream | train | protected InputStream getInputStream(String pdbId) throws IOException{
if ( pdbId.length() != 4)
throw new IOException("The provided ID does not look like a PDB ID : " + pdbId);
// Check existing
File file = downloadStructure(pdbId);
if(!file.exists()) {
throw new IOException("Structure "+pdbId+" not f... | java | {
"resource": ""
} |
q25562 | LocalPDBDirectory.prefetchStructure | train | public void prefetchStructure(String pdbId) throws IOException {
if ( pdbId.length() != 4)
throw new IOException("The provided ID does not look like a PDB ID : " + pdbId);
// Check existing
File file = downloadStructure(pdbId);
if(!file.exists()) {
throw new IOException("Structure "+pdbId+" not found an... | java | {
"resource": ""
} |
q25563 | LocalPDBDirectory.deleteStructure | train | public boolean deleteStructure(String pdbId) throws IOException{
boolean deleted = false;
// Force getLocalFile to check in obsolete locations
ObsoleteBehavior obsolete = getObsoleteBehavior();
setObsoleteBehavior(ObsoleteBehavior.FETCH_OBSOLETE);
try {
File existing = getLocalFile(pdbId);
while(existi... | java | {
"resource": ""
} |
q25564 | LocalPDBDirectory.downloadStructure | train | protected File downloadStructure(String pdbId) throws IOException{
if ( pdbId.length() != 4)
throw new IOException("The provided ID does not look like a PDB ID : " + pdbId);
// decide whether download is required
File existing = getLocalFile(pdbId);
switch(fetchBehavior) {
case LOCAL_ONLY:
if( existin... | java | {
"resource": ""
} |
q25565 | LocalPDBDirectory.downloadStructure | train | private File downloadStructure(String pdbId, String pathOnServer, boolean obsolete, File existingFile)
throws IOException{
File dir = getDir(pdbId,obsolete);
File realFile = new File(dir,getFilename(pdbId));
String ftp;
if (getFilename(pdbId).endsWith(".mmtf.gz")){
ftp = CodecUtils.getMmtfEntryUrl(pdbI... | java | {
"resource": ""
} |
q25566 | LocalPDBDirectory.getLastModifiedTime | train | private Date getLastModifiedTime(URL url) {
// see http://stackoverflow.com/questions/2416872/how-do-you-obtain-modified-date-from-a-remote-file-java
Date date = null;
try {
String lastModified = url.openConnection().getHeaderField("Last-Modified");
logger.debug("Last modified date of server file ({}) is {... | java | {
"resource": ""
} |
q25567 | LocalPDBDirectory.getDir | train | protected File getDir(String pdbId, boolean obsolete) {
File dir = null;
if (obsolete) {
// obsolete is always split
String middle = pdbId.substring(1,3).toLowerCase();
dir = new File(obsoleteDirPath, middle);
} else {
String middle = pdbId.substring(1,3).toLowerCase();
dir = new File(splitDirPat... | java | {
"resource": ""
} |
q25568 | LocalPDBDirectory.getLocalFile | train | public File getLocalFile(String pdbId) throws IOException {
// Search for existing files
// Search directories:
// 1) LOCAL_MMCIF_SPLIT_DIR/<middle>/(pdb)?<pdbId>.<ext>
// 2) LOCAL_MMCIF_ALL_DIR/<middle>/(pdb)?<pdbId>.<ext>
LinkedList<File> searchdirs = new LinkedList<File>();
String middle = pdbId.substr... | java | {
"resource": ""
} |
q25569 | SuperPositionAbstract.checkInput | train | protected void checkInput(Point3d[] fixed, Point3d[] moved) {
if (fixed.length != moved.length)
throw new IllegalArgumentException(
"Point arrays to superpose are of different lengths.");
} | java | {
"resource": ""
} |
q25570 | SparseSquareMatrix.get | train | public double get(int i, int j) {
if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N);
if (j < 0 || j >= N) throw new IllegalArgumentException("Illegal index " + j + " should be > 0 and < " + N);
return rows[i].get(j);
} | java | {
"resource": ""
} |
q25571 | MultiThreadedDBSearch.interrupt | train | public void interrupt() {
interrupted.set(true);
ExecutorService pool = ConcurrencyTools.getThreadPool();
pool.shutdownNow();
try {
DomainProvider domainProvider = DomainProviderFactory.getDomainProvider();
if (domainProvider instanceof RemoteDomainProvider){
RemoteDomainProvider remote = (RemoteDomai... | java | {
"resource": ""
} |
q25572 | Equals.equal | train | public static boolean equal(Object one, Object two) {
return one == null && two == null || !(one == null || two == null) && (one == two || one.equals(two));
} | java | {
"resource": ""
} |
q25573 | IOUtils.processReader | train | public static void processReader(BufferedReader br, ReaderProcessor processor) throws ParserException {
String line;
try {
while( (line = br.readLine()) != null ) {
processor.process(line);
}
}
catch(IOException e) {
throw new ParserException("Could not read from the given BufferedReader");
}
f... | java | {
"resource": ""
} |
q25574 | IOUtils.getList | train | public static List<String> getList(BufferedReader br) throws ParserException {
final List<String> list = new ArrayList<String>();
processReader(br, new ReaderProcessor() {
@Override
public void process(String line) {
list.add(line);
}
});
return list;
} | java | {
"resource": ""
} |
q25575 | IOUtils.getGCGChecksum | train | public static <S extends Sequence<C>, C extends Compound> int getGCGChecksum(List<S> sequences) {
int check = 0;
for (S as : sequences) {
check += getGCGChecksum(as);
}
return check % 10000;
} | java | {
"resource": ""
} |
q25576 | IOUtils.getGCGChecksum | train | public static <S extends Sequence<C>, C extends Compound> int getGCGChecksum(S sequence) {
String s = sequence.toString().toUpperCase();
int count = 0, check = 0;
for (int i = 0; i < s.length(); i++) {
count++;
check += count * s.charAt(i);
if (count == 57) {
count = 0;
}
}
return check % 1000... | java | {
"resource": ""
} |
q25577 | IOUtils.getGCGHeader | train | public static <S extends Sequence<C>, C extends Compound> String getGCGHeader(List<S> sequences) {
StringBuilder header = new StringBuilder();
S s1 = sequences.get(0);
header.append(String.format("MSA from BioJava%n%n MSF: %d Type: %s Check: %d ..%n%n",
s1.getLength(), getGCGType(s1.getCompoundSet()), getGC... | java | {
"resource": ""
} |
q25578 | IOUtils.getGCGType | train | public static <C extends Compound> String getGCGType(CompoundSet<C> cs) {
return (cs == DNACompoundSet.getDNACompoundSet() || cs == AmbiguityDNACompoundSet.getDNACompoundSet()) ? "D" :
(cs == RNACompoundSet.getRNACompoundSet() || cs == AmbiguityRNACompoundSet.getRNACompoundSet()) ? "R" : "P";
} | java | {
"resource": ""
} |
q25579 | IOUtils.getIDFormat | train | public static <S extends Sequence<C>, C extends Compound> String getIDFormat(List<S> sequences) {
int length = 0;
for (S as : sequences) {
length = Math.max(length, (as.getAccession() == null) ? 0 : as.getAccession().toString().length());
}
return (length == 0) ? null : "%-" + (length + 1) + "s";
} | java | {
"resource": ""
} |
q25580 | IOUtils.getPDBCharacter | train | public static String getPDBCharacter(boolean web, char c1, char c2, boolean similar, char c) {
String s = String.valueOf(c);
return getPDBString(web, c1, c2, similar, s, s, s, s);
} | java | {
"resource": ""
} |
q25581 | IOUtils.getPDBConservation | train | public static String getPDBConservation(boolean web, char c1, char c2, boolean similar) {
return getPDBString(web, c1, c2, similar, "|", ".", " ", web ? " " : " ");
} | java | {
"resource": ""
} |
q25582 | IOUtils.getPDBString | train | private static String getPDBString(boolean web, char c1, char c2, boolean similar, String m, String sm, String dm,
String qg) {
if (c1 == c2)
return web ? "<span class=\"m\">" + m + "</span>" : m;
else if (similar)
return web ? "<span class=\"sm\">" + sm + "</span>" : sm;
else if (c1 == '-' || c2 == '-')... | java | {
"resource": ""
} |
q25583 | IOUtils.getPDBLegend | train | public static String getPDBLegend() {
StringBuilder s = new StringBuilder();
s.append("</pre></div>");
s.append(" <div class=\"subText\">");
s.append(" <b>Legend:</b>");
s.append(" <span class=\"m\">Green</span> - identical residues |");
s.append(" <span class=\"sm\">Pink... | java | {
"resource": ""
} |
q25584 | ResidueNumber.equalsPositional | train | public boolean equalsPositional(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResidueNumber other = (ResidueNumber) obj;
if (insCode == null) {
if (other.insCode != null)
return false;
} else if (!insCode.equals(oth... | java | {
"resource": ""
} |
q25585 | ResidueNumber.fromString | train | public static ResidueNumber fromString(String pdb_code) {
if(pdb_code == null)
return null;
ResidueNumber residueNumber = new ResidueNumber();
Integer resNum = null;
String icode = null;
try {
resNum = Integer.parseInt(pdb_code);
} catch ( NumberFormatException e){
// there is an insertion code..... | java | {
"resource": ""
} |
q25586 | ResidueNumber.compareTo | train | @Override
public int compareTo(ResidueNumber other) {
// chain id
if (chainName != null && other.chainName != null) {
if (!chainName.equals(other.chainName)) return chainName.compareTo(other.chainName);
}
if (chainName != null && other.chainName == null) {
return 1;
} else if (chainName == null && oth... | java | {
"resource": ""
} |
q25587 | ResidueNumber.compareToPositional | train | public int compareToPositional(ResidueNumber other) {
// sequence number
if (seqNum != null && other.seqNum != null) {
if (!seqNum.equals(other.seqNum)) return seqNum.compareTo(other.seqNum);
}
if (seqNum != null && other.seqNum == null) {
return 1;
} else if (seqNum == null && other.seqNum != null) {
... | java | {
"resource": ""
} |
q25588 | ResidueRangeAndLength.parse | train | public static ResidueRangeAndLength parse(String s, AtomPositionMap map) {
ResidueRange rr = parse(s);
ResidueNumber start = rr.getStart();
String chain = rr.getChainName();
// handle special "_" chain
if(chain == null || chain.equals("_")) {
ResidueNumber first = map.getNavMap().firstKey();
chain = f... | java | {
"resource": ""
} |
q25589 | Jronn.convertProteinSequencetoFasta | train | public static FastaSequence convertProteinSequencetoFasta(ProteinSequence sequence){
StringBuffer buf = new StringBuffer();
for (AminoAcidCompound compound : sequence) {
String c = compound.getShortName();
if (! SequenceUtil.NON_AA.matcher(c).find()) {
buf.append(c);
} else {
buf.append("X");
... | java | {
"resource": ""
} |
q25590 | Jronn.getDisorder | train | public static Range[] getDisorder(FastaSequence sequence) {
float[] scores = getDisorderScores(sequence);
return scoresToRanges(scores, RonnConstraint.DEFAULT_RANGE_PROBABILITY_THRESHOLD);
} | java | {
"resource": ""
} |
q25591 | Jronn.scoresToRanges | train | public static Range[] scoresToRanges(float[] scores, float probability) {
assert scores!=null && scores.length>0;
assert probability>0 && probability<1;
int count=0;
int regionLen=0;
List<Range> ranges = new ArrayList<Range>();
for(float score: scores) {
count++;
// Round to 2 decimal points before ... | java | {
"resource": ""
} |
q25592 | Jronn.getDisorderScores | train | public static Map<FastaSequence,float[]> getDisorderScores(List<FastaSequence> sequences) {
Map<FastaSequence,float[]> results = new TreeMap<FastaSequence, float[]>();
for(FastaSequence fsequence : sequences) {
results.put(fsequence, predictSerial(fsequence));
}
return results;
} | java | {
"resource": ""
} |
q25593 | Jronn.getDisorder | train | public static Map<FastaSequence,Range[]> getDisorder(List<FastaSequence> sequences) {
Map<FastaSequence,Range[]> disorderRanges = new TreeMap<FastaSequence,Range[]>();
for(FastaSequence fs: sequences) {
disorderRanges.put(fs, getDisorder(fs));
}
return disorderRanges;
} | java | {
"resource": ""
} |
q25594 | Jronn.getDisorder | train | public static Map<FastaSequence,Range[]> getDisorder(String fastaFile) throws FileNotFoundException, IOException {
final List<FastaSequence> sequences = SequenceUtil.readFasta(new FileInputStream(fastaFile));
return getDisorder(sequences);
} | java | {
"resource": ""
} |
q25595 | CAConverter.getRepresentativeAtomsOnly | train | public static List<Chain> getRepresentativeAtomsOnly(List<Chain> chains){
List<Chain> newChains = new ArrayList<Chain>();
for (Chain chain : chains){
Chain newChain = getRepresentativeAtomsOnly(chain);
newChains.add(newChain);
}
return newChains;
} | java | {
"resource": ""
} |
q25596 | CAConverter.getRepresentativeAtomsOnly | train | public static Chain getRepresentativeAtomsOnly(Chain chain){
Chain newChain = new ChainImpl();
newChain.setId(chain.getId());
newChain.setName(chain.getName());
newChain.setEntityInfo(chain.getEntityInfo());
newChain.setSwissprotId(chain.getSwissprotId());
List<Group> groups = chain.getAtomGroups();
gr... | java | {
"resource": ""
} |
q25597 | GradientMapper.getGradientMapper | train | public static GradientMapper getGradientMapper(int gradientType, double min, double max) {
GradientMapper gm;
switch( gradientType ) {
case BLACK_WHITE_GRADIENT:
gm = new GradientMapper(Color.BLACK, Color.WHITE);
gm.put(min, Color.BLACK);
gm.put(max, Color.WHITE);
return gm;
case WHITE_BLACK_GRADIEN... | java | {
"resource": ""
} |
q25598 | GradientMapper.clear | train | @Override
public void clear() {
Color neg = mapping.get(Double.NEGATIVE_INFINITY);
Color pos = mapping.get(Double.POSITIVE_INFINITY);
mapping.clear();
mapping.put(Double.NEGATIVE_INFINITY, neg);
mapping.put(Double.POSITIVE_INFINITY, pos);
} | java | {
"resource": ""
} |
q25599 | GradientMapper.put | train | @Override
public Color put(Double position, Color color) {
if( position == null ) {
throw new NullPointerException("Null endpoint position");
}
if( color == null ){
throw new NullPointerException("Null colors are not allowed.");
}
return mapping.put(position, color);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.