_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q17300 | MobicentsSipServletsEmbeddedImpl.getSipConnectors | train | @Override
public List<Connector> getSipConnectors() {
List<Connector> connectors = new ArrayList<Connector>();
Connector[] conns = service.findConnectors();
for (Connector conn : conns) {
if (conn.getProtocolHandler() instanceof SipProtocolHandler){
connectors.add(conn);
}
}
return connectors;
} | java | {
"resource": ""
} |
q17301 | RejectAction.perform | train | void perform(SectionState state) throws SAXException {
final ModeUsage modeUsage = getModeUsage();
state.reject();
state.addChildMode(modeUsage, null);
state.addAttributeValidationModeUsage(modeUsage);
} | java | {
"resource": ""
} |
q17302 | MethodCall.getAttribute | train | public Object getAttribute(String key) {
Object result;
if (attributes == null) {
result = null;
} else {
result = attributes.get(key);
}
return result;
} | java | {
"resource": ""
} |
q17303 | FilteredAttributes.reverseIndex | train | private int reverseIndex(int k) {
if (reverseIndexMap == null) {
reverseIndexMap = new int[attributes.getLength()];
for (int i = 0, len = indexSet.size(); i < len; i++)
reverseIndexMap[indexSet.get(i)] = i + 1;
}
return reverseIndexMap[k] - 1;
} | java | {
"resource": ""
} |
q17304 | FilteredAttributes.getURI | train | public String getURI(int index) {
if (index < 0 || index >= indexSet.size())
return null;
return attributes.getURI(indexSet.get(index));
} | java | {
"resource": ""
} |
q17305 | FilteredAttributes.getLocalName | train | public String getLocalName(int index) {
if (index < 0 || index >= indexSet.size())
return null;
return attributes.getLocalName(indexSet.get(index));
} | java | {
"resource": ""
} |
q17306 | FilteredAttributes.getQName | train | public String getQName(int index) {
if (index < 0 || index >= indexSet.size())
return null;
return attributes.getQName(indexSet.get(index));
} | java | {
"resource": ""
} |
q17307 | FilteredAttributes.getType | train | public String getType(int index) {
if (index < 0 || index >= indexSet.size())
return null;
return attributes.getType(indexSet.get(index));
} | java | {
"resource": ""
} |
q17308 | FilteredAttributes.getValue | train | public String getValue(int index) {
if (index < 0 || index >= indexSet.size())
return null;
return attributes.getValue(indexSet.get(index));
} | java | {
"resource": ""
} |
q17309 | FilteredAttributes.getType | train | public String getType(String uri, String localName) {
return attributes.getType(getRealIndex(uri, localName));
} | java | {
"resource": ""
} |
q17310 | FilteredAttributes.getValue | train | public String getValue(String uri, String localName) {
return attributes.getValue(getRealIndex(uri, localName));
} | java | {
"resource": ""
} |
q17311 | AllowAction.perform | train | void perform(SectionState state) {
state.addChildMode(getModeUsage(), null);
state.addAttributeValidationModeUsage(getModeUsage());
} | java | {
"resource": ""
} |
q17312 | CalendarIntervalScheduleBuilder.withIntervalInSeconds | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInSeconds (final int intervalInSeconds)
{
_validateInterval (intervalInSeconds);
m_nInterval = intervalInSeconds;
m_eIntervalUnit = EIntervalUnit.SECOND;
return this;
} | java | {
"resource": ""
} |
q17313 | CalendarIntervalScheduleBuilder.withIntervalInMinutes | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInMinutes (final int intervalInMinutes)
{
_validateInterval (intervalInMinutes);
m_nInterval = intervalInMinutes;
m_eIntervalUnit = EIntervalUnit.MINUTE;
return this;
} | java | {
"resource": ""
} |
q17314 | CalendarIntervalScheduleBuilder.withIntervalInHours | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInHours (final int intervalInHours)
{
_validateInterval (intervalInHours);
m_nInterval = intervalInHours;
m_eIntervalUnit = EIntervalUnit.HOUR;
return this;
} | java | {
"resource": ""
} |
q17315 | CalendarIntervalScheduleBuilder.withIntervalInDays | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInDays (final int intervalInDays)
{
_validateInterval (intervalInDays);
m_nInterval = intervalInDays;
m_eIntervalUnit = EIntervalUnit.DAY;
return this;
} | java | {
"resource": ""
} |
q17316 | CalendarIntervalScheduleBuilder.withIntervalInWeeks | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInWeeks (final int intervalInWeeks)
{
_validateInterval (intervalInWeeks);
m_nInterval = intervalInWeeks;
m_eIntervalUnit = EIntervalUnit.WEEK;
return this;
} | java | {
"resource": ""
} |
q17317 | CalendarIntervalScheduleBuilder.withIntervalInMonths | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInMonths (final int intervalInMonths)
{
_validateInterval (intervalInMonths);
m_nInterval = intervalInMonths;
m_eIntervalUnit = EIntervalUnit.MONTH;
return this;
} | java | {
"resource": ""
} |
q17318 | CalendarIntervalScheduleBuilder.withIntervalInYears | train | @Nonnull
public CalendarIntervalScheduleBuilder withIntervalInYears (final int intervalInYears)
{
_validateInterval (intervalInYears);
m_nInterval = intervalInYears;
m_eIntervalUnit = EIntervalUnit.YEAR;
return this;
} | java | {
"resource": ""
} |
q17319 | JCusolver.checkResult | train | static int checkResult(int result)
{
if (exceptionsEnabled && result !=
cusolverStatus.CUSOLVER_STATUS_SUCCESS)
{
throw new CudaException(cusolverStatus.stringFor(result));
}
return result;
} | java | {
"resource": ""
} |
q17320 | PropertiesParser.getPropertyGroup | train | public NonBlockingProperties getPropertyGroup (final String sPrefix,
final boolean bStripPrefix,
final String [] excludedPrefixes)
{
final NonBlockingProperties group = new NonBlockingProperties ();
String prefix = sPrefix;
if (!prefix.endsWith ("."))
prefix += ".";
for (final String key : m_aProps.keySet ())
{
if (key.startsWith (prefix))
{
boolean bExclude = false;
if (excludedPrefixes != null)
{
for (int i = 0; i < excludedPrefixes.length && !bExclude; i++)
{
bExclude = key.startsWith (excludedPrefixes[i]);
}
}
if (!bExclude)
{
final String value = getStringProperty (key, "");
if (bStripPrefix)
group.put (key.substring (prefix.length ()), value);
else
group.put (key, value);
}
}
}
return group;
} | java | {
"resource": ""
} |
q17321 | TBSONDeserializer.partialDeserialize | train | public void partialDeserialize(TBase<?,?> base, DBObject dbObject, TFieldIdEnum... fieldIds) throws TException {
try {
protocol_.setDBOject(dbObject);
protocol_.setBaseObject( base );
protocol_.setFieldIdsFilter(base, fieldIds);
base.read(protocol_);
} finally {
protocol_.reset();
}
} | java | {
"resource": ""
} |
q17322 | VerifierFactory.newVerifier | train | public Verifier newVerifier(String uri)
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema(uri).newVerifier();
} | java | {
"resource": ""
} |
q17323 | VerifierFactory.newVerifier | train | public Verifier newVerifier(File file)
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema(file).newVerifier();
} | java | {
"resource": ""
} |
q17324 | VerifierFactory.newVerifier | train | public Verifier newVerifier(InputSource source)
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema(source).newVerifier();
} | java | {
"resource": ""
} |
q17325 | VerifierFactory.newInstance | train | public static VerifierFactory newInstance(String language,ClassLoader classLoader) throws VerifierConfigurationException {
Iterator itr = providers( VerifierFactoryLoader.class, classLoader );
while(itr.hasNext()) {
VerifierFactoryLoader loader = (VerifierFactoryLoader)itr.next();
try {
VerifierFactory factory = loader.createFactory(language);
if(factory!=null) return factory;
} catch (Throwable t) {} // ignore any error
}
throw new VerifierConfigurationException("no validation engine available for: "+language);
} | java | {
"resource": ""
} |
q17326 | MobicentsSipServletsContainer.deleteUnpackedWAR | train | @Override
public void deleteUnpackedWAR(StandardContext standardContext)
{
File unpackDir = new File(standardHost.getAppBase(), standardContext.getPath().substring(1));
if (unpackDir.exists())
{
ExpandWar.deleteDir(unpackDir);
}
} | java | {
"resource": ""
} |
q17327 | DecimalDatatype.sameValue | train | public boolean sameValue(Object value1, Object value2) {
return ((BigDecimal)value1).compareTo((BigDecimal)value2) == 0;
} | java | {
"resource": ""
} |
q17328 | AbstractSchemaProviderImpl.addSchema | train | public void addSchema( String uri, IslandSchema s ) {
if( schemata.containsKey(uri) )
throw new IllegalArgumentException();
schemata.put( uri, s );
} | java | {
"resource": ""
} |
q17329 | DigestServerAuthenticationMethod.generateNonce | train | public String generateNonce() {
// Get the time of day and run MD5 over it.
Date date = new Date();
long time = date.getTime();
Random rand = new Random();
long pad = rand.nextLong();
String nonceString = (Long.valueOf(time)).toString()
+ (Long.valueOf(pad)).toString();
byte mdbytes[] = messageDigest.digest(nonceString.getBytes());
// Convert the mdbytes array into a hex string.
return toHexString(mdbytes);
} | java | {
"resource": ""
} |
q17330 | Util.formatException | train | public static String formatException(final Exception e) {
final StringBuilder sb = new StringBuilder();
Throwable t = e;
while (t != null) {
sb.append(t.getMessage()).append("\n");
t = t.getCause();
}
return sb.toString();
} | java | {
"resource": ""
} |
q17331 | DailyTimeIntervalScheduleBuilder.onDaysOfTheWeek | train | public DailyTimeIntervalScheduleBuilder onDaysOfTheWeek (final Set <DayOfWeek> onDaysOfWeek)
{
ValueEnforcer.notEmpty (onDaysOfWeek, "OnDaysOfWeek");
m_aDaysOfWeek = onDaysOfWeek;
return this;
} | java | {
"resource": ""
} |
q17332 | DailyTimeIntervalScheduleBuilder.endingDailyAfterCount | train | public DailyTimeIntervalScheduleBuilder endingDailyAfterCount (final int count)
{
ValueEnforcer.isGT0 (count, "Count");
if (m_aStartTimeOfDay == null)
throw new IllegalArgumentException ("You must set the startDailyAt() before calling this endingDailyAfterCount()!");
final Date today = new Date ();
final Date startTimeOfDayDate = m_aStartTimeOfDay.getTimeOfDayForDate (today);
final Date maxEndTimeOfDayDate = TimeOfDay.hourMinuteAndSecondOfDay (23, 59, 59).getTimeOfDayForDate (today);
final long remainingMillisInDay = maxEndTimeOfDayDate.getTime () - startTimeOfDayDate.getTime ();
long intervalInMillis;
if (m_eIntervalUnit == EIntervalUnit.SECOND)
intervalInMillis = m_nInterval * CGlobal.MILLISECONDS_PER_SECOND;
else
if (m_eIntervalUnit == EIntervalUnit.MINUTE)
intervalInMillis = m_nInterval * CGlobal.MILLISECONDS_PER_MINUTE;
else
if (m_eIntervalUnit == EIntervalUnit.HOUR)
intervalInMillis = m_nInterval * DateBuilder.MILLISECONDS_IN_DAY;
else
throw new IllegalArgumentException ("The IntervalUnit: " + m_eIntervalUnit + " is invalid for this trigger.");
if (remainingMillisInDay - intervalInMillis <= 0)
throw new IllegalArgumentException ("The startTimeOfDay is too late with given Interval and IntervalUnit values.");
final long maxNumOfCount = (remainingMillisInDay / intervalInMillis);
if (count > maxNumOfCount)
throw new IllegalArgumentException ("The given count " +
count +
" is too large! The max you can set is " +
maxNumOfCount);
final long incrementInMillis = (count - 1) * intervalInMillis;
final Date endTimeOfDayDate = new Date (startTimeOfDayDate.getTime () + incrementInMillis);
if (endTimeOfDayDate.getTime () > maxEndTimeOfDayDate.getTime ())
throw new IllegalArgumentException ("The given count " +
count +
" is too large! The max you can set is " +
maxNumOfCount);
final Calendar cal = PDTFactory.createCalendar ();
cal.setTime (endTimeOfDayDate);
final int hour = cal.get (Calendar.HOUR_OF_DAY);
final int minute = cal.get (Calendar.MINUTE);
final int second = cal.get (Calendar.SECOND);
m_aEndTimeOfDay = TimeOfDay.hourMinuteAndSecondOfDay (hour, minute, second);
return this;
} | java | {
"resource": ""
} |
q17333 | HtmlValidationResponseFilter.onValidMarkup | train | protected void onValidMarkup(AppendingStringBuffer responseBuffer,
ValidationReport report) {
IRequestablePage responsePage = getResponsePage();
DocType doctype = getDocType(responseBuffer);
log.info("Markup for {} is valid {}",
responsePage != null ? responsePage.getClass().getName()
: "<unable to determine page class>", doctype.name());
String head = report.getHeadMarkup();
String body = report.getBodyMarkup();
int indexOfHeadClose = responseBuffer.lastIndexOf("</head>");
responseBuffer.insert(indexOfHeadClose, head);
int indexOfBodyClose = responseBuffer.lastIndexOf("</body>");
responseBuffer.insert(indexOfBodyClose, body);
} | java | {
"resource": ""
} |
q17334 | HtmlValidationResponseFilter.onInvalidMarkup | train | protected void onInvalidMarkup(AppendingStringBuffer responseBuffer,
ValidationReport report) {
String head = report.getHeadMarkup();
String body = report.getBodyMarkup();
int indexOfHeadClose = responseBuffer.lastIndexOf("</head>");
responseBuffer.insert(indexOfHeadClose, head);
int indexOfBodyClose = responseBuffer.lastIndexOf("</body>");
responseBuffer.insert(indexOfBodyClose, body);
} | java | {
"resource": ""
} |
q17335 | ReflectionHelper.loadClass | train | <T> Class<T> loadClass(String name) throws ClassNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (null == cl) {
cl = ToHelper.class.getClassLoader();
}
return (Class<T>) cl.loadClass(name);
} | java | {
"resource": ""
} |
q17336 | ReflectionHelper.getFields | train | List<Field> getFields(Class<?> clazz) {
List<Field> result = new ArrayList<>();
Set<String> fieldNames = new HashSet<>();
Class<?> searchType = clazz;
while (!Object.class.equals(searchType) && searchType != null) {
Field[] fields = searchType.getDeclaredFields();
for (Field field : fields) {
if (!fieldNames.contains(field.getName())) {
fieldNames.add(field.getName());
makeAccessible(field);
result.add(field);
}
}
searchType = searchType.getSuperclass();
}
return result;
} | java | {
"resource": ""
} |
q17337 | ReflectionHelper.getMethod | train | Method getMethod(Class<?> type, Class<?> returnType, String name, Class<?>... parameters) {
Method method = null;
try {
// first try for public methods
method = type.getMethod(name, parameters);
if (null != returnType && !returnType.isAssignableFrom(method.getReturnType())) {
method = null;
}
} catch (NoSuchMethodException nsme) {
// ignore
log.trace(nsme.getMessage(), nsme);
}
if (null == method) {
method = getNonPublicMethod(type, returnType, name, parameters);
}
return method;
} | java | {
"resource": ""
} |
q17338 | AbstractJob.triggerCustomExceptionHandler | train | protected static void triggerCustomExceptionHandler (@Nonnull final Throwable t,
@Nullable final String sJobClassName,
@Nonnull final IJob aJob)
{
exceptionCallbacks ().forEach (x -> x.onScheduledJobException (t, sJobClassName, aJob));
} | java | {
"resource": ""
} |
q17339 | AuthException.toResponse | train | public static Response toResponse(Response.Status status, String wwwAuthHeader) {
Response.ResponseBuilder rb = Response.status(status);
if (wwwAuthHeader != null) {
rb.header("WWW-Authenticate", wwwAuthHeader);
}
return rb.build();
} | java | {
"resource": ""
} |
q17340 | FifoTaskExecutor.execute | train | public void execute(final FifoTask<E> task) throws InterruptedException {
final int id;
synchronized (this) {
id = idCounter++;
taskMap.put(id, task);
while (activeCounter >= maxThreads) {
wait();
}
activeCounter++;
}
this.threadPoolExecutor.execute(new Runnable() {
public void run() {
try {
try {
final E outcome = task.runParallel();
synchronized (resultMap) {
resultMap.put(id, new Result(outcome));
}
} catch (Throwable th) {
synchronized (resultMap) {
resultMap.put(id, new Result(null, th));
}
} finally {
processResults();
synchronized (FifoTaskExecutor.this) {
activeCounter--;
FifoTaskExecutor.this.notifyAll();
}
}
} catch (Exception ex) {
Logger.getLogger(FifoTaskExecutor.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
}
});
} | java | {
"resource": ""
} |
q17341 | ProcessUtils.executeProcess | train | public static String executeProcess(Map<String, String> env, File workingFolder, String... command) throws ProcessException, InterruptedException {
ProcessBuilder pb = new ProcessBuilder(command);
if (workingFolder != null) {
pb.directory(workingFolder);
}
if (env != null) {
pb.environment().clear();
pb.environment().putAll(env);
}
pb.redirectErrorStream(true);
int code;
try {
Process process = pb.start();
String payload;
try {
code = process.waitFor();
} catch (InterruptedException ex) {
process.destroy();
throw ex;
}
payload = Miscellaneous.toString(process.getInputStream(), "UTF-8");
if (code == 0) {
return payload;
} else {
StringBuilder sb = new StringBuilder("Process returned code: " + code + ".");
if (payload != null) {
sb.append("\n").append(payload);
}
throw new ProcessException(code, sb.toString());
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | java | {
"resource": ""
} |
q17342 | JCusolverRf.cusolverRfGetMatrixFormat | train | public static int cusolverRfGetMatrixFormat(
cusolverRfHandle handle,
int[] format,
int[] diag)
{
return checkResult(cusolverRfGetMatrixFormatNative(handle, format, diag));
} | java | {
"resource": ""
} |
q17343 | JCusolverRf.cusolverRfSetNumericProperties | train | public static int cusolverRfSetNumericProperties(
cusolverRfHandle handle,
double zero,
double boost)
{
return checkResult(cusolverRfSetNumericPropertiesNative(handle, zero, boost));
} | java | {
"resource": ""
} |
q17344 | JCusolverRf.cusolverRfSetAlgs | train | public static int cusolverRfSetAlgs(
cusolverRfHandle handle,
int factAlg,
int solveAlg)
{
return checkResult(cusolverRfSetAlgsNative(handle, factAlg, solveAlg));
} | java | {
"resource": ""
} |
q17345 | JCusolverRf.cusolverRfSetupHost | train | public static int cusolverRfSetupHost(
int n,
int nnzA,
Pointer h_csrRowPtrA,
Pointer h_csrColIndA,
Pointer h_csrValA,
int nnzL,
Pointer h_csrRowPtrL,
Pointer h_csrColIndL,
Pointer h_csrValL,
int nnzU,
Pointer h_csrRowPtrU,
Pointer h_csrColIndU,
Pointer h_csrValU,
Pointer h_P,
Pointer h_Q,
/** Output */
cusolverRfHandle handle)
{
return checkResult(cusolverRfSetupHostNative(n, nnzA, h_csrRowPtrA, h_csrColIndA, h_csrValA, nnzL, h_csrRowPtrL, h_csrColIndL, h_csrValL, nnzU, h_csrRowPtrU, h_csrColIndU, h_csrValU, h_P, h_Q, handle));
} | java | {
"resource": ""
} |
q17346 | JCusolverRf.cusolverRfBatchSetupHost | train | public static int cusolverRfBatchSetupHost(
int batchSize,
int n,
int nnzA,
Pointer h_csrRowPtrA,
Pointer h_csrColIndA,
Pointer h_csrValA_array,
int nnzL,
Pointer h_csrRowPtrL,
Pointer h_csrColIndL,
Pointer h_csrValL,
int nnzU,
Pointer h_csrRowPtrU,
Pointer h_csrColIndU,
Pointer h_csrValU,
Pointer h_P,
Pointer h_Q,
/** Output (in the device memory) */
cusolverRfHandle handle)
{
return checkResult(cusolverRfBatchSetupHostNative(batchSize, n, nnzA, h_csrRowPtrA, h_csrColIndA, h_csrValA_array, nnzL, h_csrRowPtrL, h_csrColIndL, h_csrValL, nnzU, h_csrRowPtrU, h_csrColIndU, h_csrValU, h_P, h_Q, handle));
} | java | {
"resource": ""
} |
q17347 | RegexPathTemplate.create | train | public static RegexPathTemplate create(String urlTemplate) {
StringBuffer baseUrl = new StringBuffer();
Map<String, PathTemplate> templates = new HashMap<String, PathTemplate>();
CurlyBraceTokenizer t = new CurlyBraceTokenizer(urlTemplate);
while (t.hasNext()) {
String tok = t.next();
if (CurlyBraceTokenizer.insideBraces(tok)) {
tok = CurlyBraceTokenizer.stripBraces(tok);
int index = tok.indexOf(':'); // first index of : as it can't appears in the name
String name;
Pattern validationPattern;
if(index > -1) {
name = tok.substring(0, index);
validationPattern = Pattern.compile("^" + tok.substring(index + 1) + "$");
}else{
name = tok;
validationPattern = DEFAULT_VALIDATION_PATTERN;
}
Validate.isTrue(TEMPLATE_NAME_PATTERN.matcher(name).matches(), "Template name '%s' doesn't match the expected format: %s", name, TEMPLATE_NAME_PATTERN);
Validate.isFalse(templates.containsKey(name), "Template name '%s' is already defined!", name);
templates.put(name, new PathTemplate(name, validationPattern));
baseUrl.append("{").append(name).append("}");
} else {
baseUrl.append(tok);
}
}
String url = baseUrl.toString();
isTrue(!Urls.hasQueryString(url), "Given url contains a query string: %s", url);
return new RegexPathTemplate(url, templates);
} | java | {
"resource": ""
} |
q17348 | Section.addValidator | train | public void addValidator(Schema schema, ModeUsage modeUsage) {
// adds the schema to this section schemas
schemas.addElement(schema);
// creates the validator
Validator validator = createValidator(schema);
// adds the validator to this section validators
validators.addElement(validator);
// add the validator handler to the list of active handlers
activeHandlers.addElement(validator.getContentHandler());
// add the mode usage to the active handlers attribute mode usage list
activeHandlersAttributeModeUsage.addElement(modeUsage);
// compute the attribute processing
attributeProcessing = Math.max(attributeProcessing,
modeUsage.getAttributeProcessing());
// add a child mode with this mode usage and the validator content handler
childPrograms.addElement(new Program(modeUsage, validator.getContentHandler()));
if (modeUsage.isContextDependent())
contextDependent = true;
} | java | {
"resource": ""
} |
q17349 | Miscellaneous.writeStringToFile | train | public static void writeStringToFile(File file, String data, String charset) throws IOException {
FileOutputStream fos = openOutputStream(file, false);
fos.write(data.getBytes(charset));
fos.close();
} | java | {
"resource": ""
} |
q17350 | Miscellaneous.pipeAsynchronously | train | public static Thread pipeAsynchronously(final InputStream is, final ErrorHandler errorHandler, final boolean closeResources, final OutputStream... os) {
Thread t = new Thread() {
@Override
public void run() {
try {
pipeSynchronously(is, closeResources, os);
} catch (Throwable th) {
if (errorHandler != null) {
errorHandler.onThrowable(th);
}
}
}
};
t.setDaemon(true);
t.start();
return t;
} | java | {
"resource": ""
} |
q17351 | Miscellaneous.createFile | train | public static File createFile(String filePath) throws IOException {
boolean isDirectory = filePath.endsWith("/") || filePath.endsWith("\\");
String formattedFilePath = formatFilePath(filePath);
File f = new File(formattedFilePath);
if (f.exists()) {
return f;
}
if (isDirectory) {
f.mkdirs();
} else {
f.getParentFile().mkdirs();
f.createNewFile();
}
if (f.exists()) {
f.setExecutable(true, false);
f.setReadable(true, false);
f.setWritable(true, false);
return f;
}
throw new IOException("Error creating file: " + f.getAbsolutePath());
} | java | {
"resource": ""
} |
q17352 | NamespaceSpecification.compete | train | public boolean compete(NamespaceSpecification other) {
// if no wildcard for other then we check coverage
if ("".equals(other.wildcard)) {
return covers(other.ns);
}
// split the namespaces at wildcards
String[] otherParts = split(other.ns, other.wildcard);
// if the given namepsace specification does not use its wildcard
// then we just look if the current namespace specification covers it
if (otherParts.length == 1) {
return covers(other.ns);
}
// if no wildcard for the current namespace specification
if ("".equals(wildcard)) {
return other.covers(ns);
}
// also for the current namespace specification
String[] parts = split(ns, wildcard);
// now check if the current namespace specification is just an URI
if (parts.length == 1) {
return other.covers(ns);
}
// now each namespace specification contains wildcards
// suppose we have
// ns = a1*a2*...*an
// and
// other.ns = b1*b2*...*bm
// then we only need to check matchPrefix(a1, b1) and matchPrefix(an, bn) where
// matchPrefix(a, b) means a starts with b or b starts with a.
return matchPrefix(parts[0], otherParts[0])
&& matchPrefix(parts[parts.length - 1], otherParts[otherParts.length - 1]);
} | java | {
"resource": ""
} |
q17353 | NamespaceSpecification.matchPrefix | train | static private boolean matchPrefix(String s1, String s2) {
return s1.startsWith(s2) || s2.startsWith(s1);
} | java | {
"resource": ""
} |
q17354 | NamespaceSpecification.covers | train | public boolean covers(String uri) {
// any namspace covers only the any namespace uri
// no wildcard ("") requires equality between namespaces.
if (ANY_NAMESPACE.equals(ns) || "".equals(wildcard)) {
return ns.equals(uri);
}
String[] parts = split(ns, wildcard);
// no wildcard
if (parts.length == 1) {
return ns.equals(uri);
}
// at least one wildcard, we need to check that the start and end are the same
// then we get to match a string against a pattern like *p1*...*pn*
if (!uri.startsWith(parts[0])) {
return false;
}
if (!uri.endsWith(parts[parts.length - 1])) {
return false;
}
// Check that all remaining parts match the remaining URI.
int start = parts[0].length();
int end = uri.length() - parts[parts.length - 1].length();
for (int i = 1; i < parts.length - 1; i++) {
if (start > end) {
return false;
}
int match = uri.indexOf(parts[i], start);
if (match == -1 || match + parts[i].length() > end) {
return false;
}
start = match + parts[i].length();
}
return true;
} | java | {
"resource": ""
} |
q17355 | ContainerManagerTool.reloadContext | train | @Override
public void reloadContext() throws DeploymentException
{
Archive<?> archive = mssContainer.getArchive();
deployableContainer.undeploy(archive);
deployableContainer.deploy(archive);
} | java | {
"resource": ""
} |
q17356 | ModeUsage.resolve | train | private Mode resolve(Mode mode) {
if (mode == Mode.CURRENT) {
return currentMode;
}
// For an action that does not specify the useMode attribute
// we create an anonymous next mode that becomes defined if we
// have a nested mode element inside the action.
// If we do not have a nested mode then the anonymous mode
// is not defined and basically that means we should use the
// current mode to perform that action.
if (mode.isAnonymous() && !mode.isDefined()) {
return currentMode;
}
return mode;
} | java | {
"resource": ""
} |
q17357 | ModeUsage.getAttributeProcessing | train | int getAttributeProcessing() {
if (attributeProcessing == -1) {
attributeProcessing = resolve(mode).getAttributeProcessing();
if (modeMap != null) {
for (Enumeration e = modeMap.values();
e.hasMoreElements()
&& attributeProcessing != Mode.ATTRIBUTE_PROCESSING_FULL;)
attributeProcessing = Math.max(resolve((Mode)e.nextElement()).getAttributeProcessing(),
attributeProcessing);
}
}
return attributeProcessing;
} | java | {
"resource": ""
} |
q17358 | SourceMerger.getMergedJsonFile | train | public String getMergedJsonFile(final VFS vfs,
final ResourceResolver resolver, final String in) throws IOException {
final VFile file = vfs.find("/__temp__json__input");
final List<Resource> resources = getJsonSourceFiles(resolver.resolve(in));
// Hack which tries to replace all non-js sources with js sources in case of
// mixed json-input file
boolean foundJs = false;
boolean foundNonJs = false;
for (final Resource resource : resources) {
foundJs |= FilenameUtils.isExtension(resource.getPath(), "js");
foundNonJs |= !FilenameUtils.isExtension(resource.getPath(), "js");
}
if (foundJs && foundNonJs) {
for (int i = 0, n = resources.size(); i < n; i++) {
final Resource resource = resources.get(i);
if (!FilenameUtils.isExtension(resource.getPath(), "js")) {
final Resource jsResource = resource.getResolver().resolve(
FilenameUtils.getName(FilenameUtils.removeExtension(resource
.getPath()) + ".js"));
resources.add(resources.indexOf(resource), jsResource);
resources.remove(resource);
}
}
}
VFSUtils.write(file, merge(resources));
return file.getPath();
} | java | {
"resource": ""
} |
q17359 | SourceMerger.isUniqueFileResolved | train | private boolean isUniqueFileResolved(final Set<String> alreadyHandled,
final String s) {
return this.uniqueFiles && alreadyHandled.contains(s);
} | java | {
"resource": ""
} |
q17360 | ToHelper.getDomainClass | train | public Class<?> getDomainClass(Class<?> toClass) {
Class<?> declaredClass = getDeclaredDomainClass(toClass);
return classReplacer.replaceClass(declaredClass);
} | java | {
"resource": ""
} |
q17361 | ValidationDriver.validate | train | public boolean validate(InputSource in) throws SAXException, IOException {
if (schema == null)
throw new IllegalStateException("cannot validate without schema");
if (validator == null)
validator = schema.createValidator(instanceProperties);
if (xr == null) {
xr = ResolverFactory.createResolver(instanceProperties).createXMLReader();
xr.setErrorHandler(eh);
}
eh.reset();
xr.setContentHandler(validator.getContentHandler());
DTDHandler dh = validator.getDTDHandler();
if (dh != null)
xr.setDTDHandler(dh);
try {
xr.parse(in);
return !eh.getHadErrorOrFatalError();
}
finally {
validator.reset();
}
} | java | {
"resource": ""
} |
q17362 | TypeUtils.getOperatorKind | train | public TypeMirror getOperatorKind(TypeMirror leftMirror, TypeMirror rightMirror , TokenType.BinaryOperator operator){
if(leftMirror == null || rightMirror == null)
return null;
TypeKind leftKind = leftMirror.getKind();
TypeKind rightKind = rightMirror.getKind();
if(isString(leftMirror))
return leftMirror;
if(isString(rightMirror))
return rightMirror;
if(either(leftKind, rightKind, TypeKind.BOOLEAN) ) {
if(operator != null) {
messageUtils.error(Option.<Element>absent(), "Cannot perform perform the operation '%s' with a boolean type. (%s %s %s)", operator.toString(), leftMirror, operator.toString(), rightMirror);
}
return null;
}
if(leftKind.isPrimitive() && rightKind.isPrimitive()) {
if (typeUtils.isSameType(leftMirror, rightMirror))
return typeUtils.getPrimitiveType(leftKind);
if (either(leftKind, rightKind, TypeKind.DOUBLE))
return typeUtils.getPrimitiveType(TypeKind.DOUBLE);
if (either(leftKind, rightKind, TypeKind.FLOAT))
return typeUtils.getPrimitiveType(TypeKind.FLOAT);
if (either(leftKind, rightKind, TypeKind.LONG))
return typeUtils.getPrimitiveType(TypeKind.LONG);
if (
either(leftKind, rightKind, TypeKind.INT) ||
either(leftKind, rightKind, TypeKind.CHAR) ||
either(leftKind, rightKind, TypeKind.SHORT) ||
either(leftKind, rightKind, TypeKind.BYTE)
) {
return typeUtils.getPrimitiveType(TypeKind.INT);
}
}
TypeMirror intMirror = typeUtils.getPrimitiveType(TypeKind.INT);
if(both(assignable(intMirror, leftMirror), assignable(intMirror, rightMirror)))
return intMirror;
TypeMirror longMirror = typeUtils.getPrimitiveType(TypeKind.LONG);
if(both(assignable(longMirror, leftMirror), assignable(longMirror, rightMirror)))
return longMirror;
TypeMirror floatMirror = typeUtils.getPrimitiveType(TypeKind.FLOAT);
if(both(assignable(floatMirror, leftMirror), assignable(floatMirror, rightMirror)))
return floatMirror;
TypeMirror doubleMirror = typeUtils.getPrimitiveType(TypeKind.DOUBLE);
if(both(assignable(doubleMirror, leftMirror), assignable(doubleMirror, rightMirror)))
return doubleMirror;
return null;
} | java | {
"resource": ""
} |
q17363 | AttachAction.perform | train | void perform(ContentHandler handler, SectionState state) {
final ModeUsage modeUsage = getModeUsage();
if (handler != null)
state.addActiveHandler(handler, modeUsage);
else
state.addAttributeValidationModeUsage(modeUsage);
state.addChildMode(modeUsage, handler);
} | java | {
"resource": ""
} |
q17364 | CompactSyntaxTokenManager.getNextToken | train | public Token getNextToken()
{
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(EOFException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
image = jjimage;
image.setLength(0);
jjimageLen = 0;
switch(curLexState)
{
case 0:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
break;
case 1:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_1();
break;
case 2:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_2();
break;
}
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
return matchedToken;
}
else
{
if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
if (specialToken == null)
specialToken = matchedToken;
else
{
matchedToken.specialToken = specialToken;
specialToken = (specialToken.next = matchedToken);
}
SkipLexicalActions(matchedToken);
}
else
SkipLexicalActions(null);
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (EOFException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
} | java | {
"resource": ""
} |
q17365 | DefaultValueFormatter.filter | train | @Override
public String filter(String value, String previousValue){
if(previousValue != null && value.length() > previousValue.length())
return value;
return value.equals("0") || value.equals("0.0") ? "" : value;
} | java | {
"resource": ""
} |
q17366 | Util.ipToString | train | public String ipToString(long ip) {
// if ip is bigger than 255.255.255.255 or smaller than 0.0.0.0
if (ip > 4294967295l || ip < 0) {
throw new IllegalArgumentException("invalid ip");
}
val ipAddress = new StringBuilder();
for (int i = 3; i >= 0; i--) {
int shift = i * 8;
ipAddress.append((ip & (0xff << shift)) >> shift);
if (i > 0) {
ipAddress.append(".");
}
}
return ipAddress.toString();
} | java | {
"resource": ""
} |
q17367 | SimpleCharClass.outputComplementDirect | train | void outputComplementDirect(StringBuffer buf) {
if (!surrogatesDirect && getContainsBmp() == NONE)
buf.append("[\u0000-\uFFFF]");
else {
buf.append("[^");
inClassOutputDirect(buf);
buf.append(']');
}
} | java | {
"resource": ""
} |
q17368 | AutomaticListTypeConverter.doConvertOne | train | public Object doConvertOne(JTransfo jTransfo, Object toObject, Class<?> domainObjectType, String... tags)
throws JTransfoException {
return jTransfo.convertTo(toObject, domainObjectType, tags);
} | java | {
"resource": ""
} |
q17369 | Transform.createSAXURIResolver | train | public static URIResolver createSAXURIResolver(Resolver resolver) {
final SAXResolver saxResolver = new SAXResolver(resolver);
return new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
try {
return saxResolver.resolve(href, base);
}
catch (SAXException e) {
throw toTransformerException(e);
}
catch (IOException e) {
throw new TransformerException(e);
}
}
};
} | java | {
"resource": ""
} |
q17370 | TaggedConverter.addConverters | train | public void addConverters(Converter converter, String... tags) {
for (String tag : tags) {
if (tag.startsWith("!")) {
notConverters.put(tag.substring(1), converter);
} else {
converters.put(tag, converter);
}
}
} | java | {
"resource": ""
} |
q17371 | Pattern.checkValid | train | public void checkValid(CharSequence literal)
throws DatatypeException {
// TODO find out what kind of thread concurrency guarantees are made
ContextFactory cf = new ContextFactory();
Context cx = cf.enterContext();
RegExpImpl rei = new RegExpImpl();
String anchoredRegex = "^(?:" + literal + ")$";
try {
rei.compileRegExp(cx, anchoredRegex, "");
} catch (EcmaError ee) {
throw newDatatypeException(ee.getErrorMessage());
} finally {
Context.exit();
}
} | java | {
"resource": ""
} |
q17372 | NameMatcher.nameEquals | train | public static <T extends Key <T>> NameMatcher <T> nameEquals (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.EQUALS);
} | java | {
"resource": ""
} |
q17373 | NameMatcher.nameStartsWith | train | public static <U extends Key <U>> NameMatcher <U> nameStartsWith (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.STARTS_WITH);
} | java | {
"resource": ""
} |
q17374 | NameMatcher.nameEndsWith | train | public static <U extends Key <U>> NameMatcher <U> nameEndsWith (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.ENDS_WITH);
} | java | {
"resource": ""
} |
q17375 | NameMatcher.nameContains | train | public static <U extends Key <U>> NameMatcher <U> nameContains (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.CONTAINS);
} | java | {
"resource": ""
} |
q17376 | TypeUtil.getFirstTypeArgument | train | public static Class<?> getFirstTypeArgument(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
return getRawClass(p.getActualTypeArguments()[0]);
} else {
return null;
}
} | java | {
"resource": ""
} |
q17377 | ParamProcessors.newInstance | train | public static ParamProcessor newInstance(ParamType type, String listSeparator){
switch(type){
case COOKIE:
return listSeparator != null ? new CollectionMergingCookieParamProcessor(listSeparator) : DefaultCookieParamProcessor.INSTANCE;
default:
return listSeparator != null ? new CollectionMergingParamProcessor(listSeparator) : DefaultParamProcessor.INSTANCE;
}
} | java | {
"resource": ""
} |
q17378 | TriggerBuilder.forJob | train | @Nonnull
public TriggerBuilder <T> forJob (@Nonnull final IJobDetail jobDetail)
{
final JobKey k = jobDetail.getKey ();
if (k.getName () == null)
throw new IllegalArgumentException ("The given job has not yet had a name assigned to it.");
m_aJobKey = k;
return this;
} | java | {
"resource": ""
} |
q17379 | TagsUtil.add | train | public static String[] add(String[] base, String... extraTags) {
if (null == base || base.length == 0) {
return extraTags;
}
if (extraTags.length == 0) {
return base;
}
List<String> tags = new ArrayList<>(Arrays.asList(base));
tags.addAll(Arrays.asList(extraTags));
return tags.toArray(new String[tags.size()]);
} | java | {
"resource": ""
} |
q17380 | DatatypeBase.allowsValue | train | boolean allowsValue(String str, ValidationContext vc) {
try {
getValue(str, vc);
return true;
}
catch (DatatypeException e) {
return false;
}
} | java | {
"resource": ""
} |
q17381 | ChallengeSession.start | train | public void start() {
recordingSystem = new RecordingSystem(config.getRecordingSystemShouldBeOn());
AuditStream auditStream = config.getAuditStream();
if (!recordingSystem.isRecordingSystemOk()) {
auditStream.println("Please run `record_screen_and_upload` before continuing.");
return;
}
auditStream.println("Connecting to " + config.getHostname());
runApp();
} | java | {
"resource": ""
} |
q17382 | AccessorSyntheticField.get | train | public Object get(Object object) throws IllegalAccessException, IllegalArgumentException {
if (null != getter) {
try {
return getter.invoke(object);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
throw (RuntimeException) ite.getCause();
}
throw new JTransfoException(String.format(GET_SET_ITO, getter.getName(), object.getClass().getName(),
getter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
}
} else {
if (!getUsingFieldLogged) {
log.warn("Cannot find getter (not public, wrong name or wrong type), "
+ "using field to access field {} of {}.", name, field.getType().getName());
getUsingFieldLogged = true;
}
return field.get(object);
}
} | java | {
"resource": ""
} |
q17383 | AccessorSyntheticField.set | train | public void set(Object object, Object value) throws IllegalAccessException, IllegalArgumentException {
if (null != setter) {
try {
setter.invoke(object, value);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
throw (RuntimeException) ite.getCause();
}
throw new JTransfoException(String.format(GET_SET_ITO, setter.getName(), object.getClass().getName(),
setter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
}
} else {
if (!setUsingFieldLogged) {
log.warn("Cannot find setter (not public, wrong name or wrong type), "
+ "using field to access field {} of {}.", name, field.getType().getName());
setUsingFieldLogged = true;
}
field.set(object, value);
}
} | java | {
"resource": ""
} |
q17384 | MultiParts.hasMultiPart | train | public static boolean hasMultiPart(ParamConfig[] paramConfigs){
for(ParamConfig cfg : paramConfigs){
if(hasMultiPart(cfg.getMetaDatas())) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q17385 | MultiParts.putMetaDatas | train | public static void putMetaDatas(Map<String, Object> metadatas, String contentType, String fileName){
metadatas.put(MULTIPART_FLAG, true);
if(isNotBlank(contentType)) {
metadatas.put(CONTENT_TYPE, contentType);
}
if(isNotBlank(fileName)) {
metadatas.put(FILENAME, fileName);
}
} | java | {
"resource": ""
} |
q17386 | MultiParts.toMetaDatas | train | public static Map<String,Object> toMetaDatas(String contentType, String fileName){
Map<String,Object> metadatas = new HashMap<String, Object>();
putMetaDatas(metadatas, contentType, fileName);
return metadatas;
} | java | {
"resource": ""
} |
q17387 | SystemPropertyInstanceIdGenerator.generateInstanceId | train | public String generateInstanceId () throws SchedulerException
{
String property = System.getProperty (getSystemPropertyName ());
if (property == null)
throw new SchedulerException ("No value for '" +
SYSTEM_PROPERTY +
"' system property found, please configure your environment accordingly!");
if (getPrepend () != null)
property = getPrepend () + property;
if (getPostpend () != null)
property = property + getPostpend ();
return property;
} | java | {
"resource": ""
} |
q17388 | IriRef.underbarStringToSentence | train | protected static final String underbarStringToSentence(String str) {
if (str == null) {
return null;
}
char[] buf = new char[str.length()];
// preserve case of first character
buf[0] = str.charAt(0);
for (int i = 1; i < str.length(); i++) {
char c = str.charAt(i);
if (c >= 'A' && c <= 'Z') {
c += 0x20;
} else if (c == 0x5f) {
// convert underbar to space
c = 0x20;
}
buf[i] = c;
}
return new String(buf);
} | java | {
"resource": ""
} |
q17389 | JCusolverDn.cusolverDnSpotrf_bufferSize | train | public static int cusolverDnSpotrf_bufferSize(
cusolverDnHandle handle,
int uplo,
int n,
Pointer A,
int lda,
int[] Lwork)
{
return checkResult(cusolverDnSpotrf_bufferSizeNative(handle, uplo, n, A, lda, Lwork));
} | java | {
"resource": ""
} |
q17390 | JCusolverDn.cusolverDnSpotrfBatched | train | public static int cusolverDnSpotrfBatched(
cusolverDnHandle handle,
int uplo,
int n,
Pointer Aarray,
int lda,
Pointer infoArray,
int batchSize)
{
return checkResult(cusolverDnSpotrfBatchedNative(handle, uplo, n, Aarray, lda, infoArray, batchSize));
} | java | {
"resource": ""
} |
q17391 | JCusolverDn.cusolverDnSorgqr_bufferSize | train | public static int cusolverDnSorgqr_bufferSize(
cusolverDnHandle handle,
int m,
int n,
int k,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgqr_bufferSizeNative(handle, m, n, k, A, lda, tau, lwork));
} | java | {
"resource": ""
} |
q17392 | JCusolverDn.cusolverDnSorgtr_bufferSize | train | public static int cusolverDnSorgtr_bufferSize(
cusolverDnHandle handle,
int uplo,
int n,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgtr_bufferSizeNative(handle, uplo, n, A, lda, tau, lwork));
} | java | {
"resource": ""
} |
q17393 | CryptoUtils.getHash | train | private static String getHash(String str, String algorithm) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(str.getBytes());
byte byteData[] = md.digest();
StringBuilder hexString = new StringBuilder();
for (int i = 0; i < byteData.length; i++) {
String hex = Integer.toHexString(0xff & byteData[i]);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} | java | {
"resource": ""
} |
q17394 | DailyCalendar.split | train | private String [] split (final String string, final String delim)
{
final List <String> result = new ArrayList <> ();
final StringTokenizer stringTokenizer = new StringTokenizer (string, delim);
while (stringTokenizer.hasMoreTokens ())
{
result.add (stringTokenizer.nextToken ());
}
return result.toArray (new String [result.size ()]);
} | java | {
"resource": ""
} |
q17395 | DailyCalendar._validate | train | private void _validate (final int hourOfDay, final int minute, final int second, final int millis)
{
if (hourOfDay < 0 || hourOfDay > 23)
{
throw new IllegalArgumentException (invalidHourOfDay + hourOfDay);
}
if (minute < 0 || minute > 59)
{
throw new IllegalArgumentException (invalidMinute + minute);
}
if (second < 0 || second > 59)
{
throw new IllegalArgumentException (invalidSecond + second);
}
if (millis < 0 || millis > 999)
{
throw new IllegalArgumentException (invalidMillis + millis);
}
} | java | {
"resource": ""
} |
q17396 | NvdlSchemaReceiverFactory.createSchemaReceiver | train | public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) {
if (!SchemaImpl.NVDL_URI.equals(namespaceUri))
return null;
return new SchemaReceiverImpl(properties);
} | java | {
"resource": ""
} |
q17397 | TBSONProtocol.pushContext | train | protected void pushContext(Context c) {
Stack<Context> stack = threadSafeContextStack.get();
if (stack == null) {
stack = new Stack<Context>();
stack.push(c);
threadSafeContextStack.set(stack);
} else {
threadSafeContextStack.get().push(c);
}
} | java | {
"resource": ""
} |
q17398 | LineReader.run | train | public final void run() throws IOException, InterruptedException {
InputStreamReader isr = new InputStreamReader(this.is, this.charset);
BufferedReader br = new BufferedReader(isr);
this.line = null;
this.lineNumber = 0;
try {
do {
if (this.exit) {
return;
}
if(Thread.currentThread().isInterrupted()){
throw new InterruptedException();
}
this.nextLine = br.readLine();
try {
if (this.line != null) {
processLine(this.line);
if (this.exit) {
return;
}
}
} catch (Exception e) {
onExceptionFound(e);
} finally {
this.lineNumber++;
this.line = this.nextLine;
}
} while (this.line != null);
} finally {
onFinish();
}
} | java | {
"resource": ""
} |
q17399 | HtmlTable.byHeader | train | protected Locator byHeader(int colIndex) {
if (colIndex < 1) {
throw new IllegalArgumentException("Column index must be greater than 0.");
}
String xpath = headerTag.isPresent()
? "./thead/tr[1]/th[" + colIndex + "]"
: "./tr[1]/th[" + colIndex + "]";
return byInner(By.xpath(xpath));
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.