id
stringlengths
7
14
text
stringlengths
1
106k
502000_20
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_21
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_22
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_23
void runUnboundedTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { throw new IllegalStateException("Cannot be called from within " + ...
502000_24
void runUnboundedTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { throw new IllegalStateException("Cannot be called from within " + ...
502000_25
void runUnboundedTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { throw new IllegalStateException("Cannot be called from within " + ...
502000_26
void runUnboundedTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { throw new IllegalStateException("Cannot be called from within " + ...
502000_27
public void scheduleTask(KernelRunnable task, Identity owner) { backingQueue.addTask(new ScheduledTaskImpl.Builder( task, owner, defaultPriority).build()); }
502000_28
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_29
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_30
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_31
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_32
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_33
public TaskQueue createTaskQueue() { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } return new TaskQueueImpl(); }
502000_34
public TaskQueue createTaskQueue() { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } return new TaskQueueImpl(); }
502000_35
public TaskQueue createTaskQueue() { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } return new TaskQueueImpl(); }
502000_36
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_37
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
502000_38
public void runTask(KernelRunnable task, Identity owner) throws Exception { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } if (ContextResolver.isCurrentTransaction()) { // we're already active in a transaction, so just run the task task.run(); } els...
5022064_0
public static float example01() { String str1 = "This is a sentence. It is made of words"; String str2 = "This sentence is similar. It has almost the same words"; StringDistance metric = StringDistances.levenshtein(); return metric.distance(str1, str2); // 30.0000 }
5022064_1
public static float example02() { String str1 = "A quirky thing it is. This is a sentence."; String str2 = "This sentence is similar. A quirky thing it is."; StringDistance metric = StringDistances.euclideanDistance(); return metric.distance(str1, str2); // 2.0000 }
5022064_2
public static float example03() { String str1 = "A quirky thing it is. This is a sentence."; String str2 = "This sentence is similar. A quirky thing it is."; StringDistance metric = with(new EuclideanDistance<String>()) .tokenize(Tokenizers.qGram(3)) .build(); return metric.distance(str1, str2); // 4.8989...
5022064_3
public static float example01() { String str1 = "This is a sentence. It is made of words"; String str2 = "This sentence is similar. It has almost the same words"; StringMetric metric = StringMetrics.cosineSimilarity(); float result = metric.compare(str1, str2); // 0.4767 return result; }
5022064_4
public static float example02() { String str1 = "This is a sentence. It is made of words"; String str2 = "This sentence is similar. It has almost the same words"; StringMetric metric = StringMetricBuilder .with(new CosineSimilarity<String>()) .simplify(Simplifiers.toLowerCase(Locale.ENGLISH)) .simplify(Simp...
5022064_5
public static float example03() { String str1 = "This is a sentence. It is made of words"; String str2 = "This sentence is similar. It has almost the same words"; StringDistance metric = StringDistanceBuilder .with(new EuclideanDistance<String>()) .simplify(Simplifiers.toLowerCase(Locale.ENGLISH)) .simplify...
5022064_6
public static float example04() { Set<Integer> scores1 = new HashSet<>(asList(1, 1, 2, 3, 5, 8, 11, 19)); Set<Integer> scores2 = new HashSet<>(asList(1, 2, 4, 8, 16, 32, 64)); SetMetric<Integer> metric = new OverlapCoefficient<>(); float result = metric.compare(scores1, scores2); // 0.4285 return result; }
5022064_7
public static float example00() { String a = "Chilpéric II son of Childeric II"; String b = "chilperic ii son of childeric ii"; StringDistance metric = new Levenshtein(); return metric.distance(a, b); // 7.0000 }
5022064_8
public static float example01() { String a = "Chilpéric II son of Childeric II"; String b = "Chilperic II son of Childeric II"; StringDistance metric = with(new Levenshtein()) .simplify(Simplifiers.removeDiacritics()) .build(); return metric.distance(a, b); // 0.0000 }
5022064_9
public static float example02() { String a = "Chilpéric II son of Childeric II"; String b = "chilperic ii son of childeric ii"; StringDistance metric = with(new Levenshtein()) .simplify(Simplifiers.removeDiacritics()) .simplify(Simplifiers.toLowerCase()) .build(); return metric.distance(a, b); // 0.000...
5054231_0
public Promise gettingFolders() { return gettingFolders(false); }
5054231_1
public Promise gettingFolders() { return gettingFolders(false); }
5054231_2
static public List<BodyPart> extractMessageAttachments(Log logger, Object content) throws MessagingException, IOException { ArrayList<BodyPart> ret = new ArrayList<BodyPart>(); if (content instanceof Multipart) { Multipart part = (Multipart) content; for (int i = 0; i < part.getCount(); i++) { ...
5054231_3
public static Address[] getRecipients(String... addresses) throws AddressException { return getRecipients(Arrays.asList(addresses)); }
5054234_0
protected CharSequence getValue(String key) { CharSequence val = tagValues.get(key); if (val == null) return getDefault(key); else return val; }
5054234_1
protected CharSequence getValue(String key) { CharSequence val = tagValues.get(key); if (val == null) return getDefault(key); else return val; }
5054234_2
protected CharSequence getValue(String key) { CharSequence val = tagValues.get(key); if (val == null) return getDefault(key); else return val; }
5054234_3
protected CharSequence getValue(String key) { CharSequence val = tagValues.get(key); if (val == null) return getDefault(key); else return val; }
5054234_4
public Set<String> getTags() { return tagValues.keySet(); }
5054234_5
public static void apply(PublicKeyRecord pkr, SignatureRecord sign) throws PermFailException { try { if (!pkr.getGranularityPattern().matcher(sign.getIdentityLocalPart()) .matches()) { throw new PermFailException("inapplicable key identity local=" + sign.getId...
5054237_0
public boolean equals(String string1, String string2) { final boolean result; if (isPositiveInfinity(string1)) { result = isPositiveInfinity(string2); } else { if (isPositiveInfinity(string2)) { result = false; } else { final BigInteger integer1 = toInteger(st...
5054237_1
public boolean equals(String string1, String string2) { final boolean result; if (isPositiveInfinity(string1)) { result = isPositiveInfinity(string2); } else { if (isPositiveInfinity(string2)) { result = false; } else { final BigInteger integer1 = toInteger(st...
5054237_2
public boolean equals(String string1, String string2) { final boolean result; if (isPositiveInfinity(string1)) { result = isPositiveInfinity(string2); } else { if (isPositiveInfinity(string2)) { result = false; } else { final BigInteger integer1 = toInteger(st...
5054237_3
public boolean equals(String string1, String string2) { final boolean result; if (isPositiveInfinity(string1)) { result = isPositiveInfinity(string2); } else { if (isPositiveInfinity(string2)) { result = false; } else { final BigInteger integer1 = toInteger(st...
5054237_4
@Override public boolean contains(String container, String content) throws FeatureException { // TODO: Consider using finer grained exception throw new FeatureException("Substring match unsupported by ascii-numeric"); }
5054237_5
@Override public boolean matches(String string, String glob) throws FeatureException { // TODO: Consider using finer grained exception throw new FeatureException("Substring match unsupported by ascii-numeric"); }
5054237_6
public String getRemainingStringValue(String exceptionMessage) throws SyntaxException { if (remainingArguments.size() > 1) { throw new SyntaxException(exceptionMessage); } if (remainingArguments.size() == 0) { return null; } return retrieveSingleStringValue(remainingArguments.get(0),...
5054237_7
public Integer getNumericValueForTag(String tag, String exceptionMessage) throws SyntaxException { Argument argument = retrieveArgumentIfExists(tag, exceptionMessage); if (argument == null) { return null; } return retrieveNumericValue(argument, exceptionMessage); }
5054237_8
public List<String> getStringListForTag(String tag, String exceptionMessage) throws SyntaxException { Argument argument = retrieveArgumentIfExists(tag, exceptionMessage); if (argument == null) { return new ArrayList<String>(); } return retrieveStringValues(argument, exceptionMessage); }
5054237_9
public String getStringValueForTag(String tag, String exceptionMessage) throws SyntaxException { Argument argument = retrieveArgumentIfExists(tag, exceptionMessage); if (argument == null) { return null; } return retrieveSingleStringValue(argument, exceptionMessage); }
5061371_0
@Override public UDPPacket createUDP(final long ts, final Buffer payload) throws IllegalArgumentException, IllegalProtocolException { return createUdpInternal(ts, payload); }
5061371_1
@Override public int getTotalIPLength() { // byte 3 - 4 return this.headers.getUnsignedShort(2); }
5061371_2
@Override public int getTotalIPLength() { // byte 3 - 4 return this.headers.getUnsignedShort(2); }
5061371_3
@Override public void setDestinationIP(final int a, final int b, final int c, final int d) { this.headers.setByte(16, (byte) a); this.headers.setByte(17, (byte) b); this.headers.setByte(18, (byte) c); this.headers.setByte(19, (byte) d); reCalculateChecksum(); }
5061371_4
@Override public void setSourceIP(final int a, final int b, final int c, final int d) { this.headers.setByte(12, (byte) a); this.headers.setByte(13, (byte) b); this.headers.setByte(14, (byte) c); this.headers.setByte(15, (byte) d); reCalculateChecksum(); }
5061371_5
@Override public int getHeaderLength() { try { final byte b = this.headers.getByte(0); // length is encoded as the number of 32-bit words, so to get number of bytes we must multiply by 4 return (b & 0x0F) * 4; } catch (final IOException e) { throw new RuntimeException("unable to ...
5061371_6
@Override public boolean isFragmented() { return (getHeader(EXTENSION_FRAGMENT) != null); }
5061371_7
public PcapFramer(final PcapGlobalHeader globalHeader, final FramerManager framerManager) { assert globalHeader != null; assert framerManager != null; this.globalHeader = globalHeader; this.byteOrder = this.globalHeader.getByteOrder(); this.framerManager = framerManager; }
5061371_8
public UDPFramer() { }
5061371_9
@Override public IPv4Packet frame(final Packet parent, final Buffer payload) throws IOException { if (parent == null) { throw new IllegalArgumentException("The parent frame cannot be null"); } // the ipv4 headers are always 20 bytes unless // the length is greater than 5 final Buffer headers...
5073742_0
public void persist(T entity) { Validate.notNull(entity, "Entity can't be null"); getJpaTemplate().persist(entity); }
5073742_1
public T merge(T entity) { Validate.notNull(entity, "Entity can't be null"); return getJpaTemplate().merge(entity); }
5073742_2
@Override public T load(Integer id) { Validate.notNull(id, "Entity identifier can't be null"); return getJpaTemplate().find(clazz, id); }
5073742_3
@Override public T load(Integer id) { Validate.notNull(id, "Entity identifier can't be null"); return getJpaTemplate().find(clazz, id); }
5073742_4
@Override public void delete(T entity) { Validate.notNull(entity, "Entity can't be null"); getJpaTemplate().remove(entity); }
5073742_5
@SuppressWarnings("unchecked") protected final T findUniqueResult(String queryString, Object... values) { List<T> list = getJpaTemplate().find(queryString, values); if (list.size() > 1) { throw new IllegalStateException( "Found more matches for unique result for class " ...
5073742_6
@SuppressWarnings("unchecked") protected final T findUniqueResult(String queryString, Object... values) { List<T> list = getJpaTemplate().find(queryString, values); if (list.size() > 1) { throw new IllegalStateException( "Found more matches for unique result for class " ...
5073742_7
@SuppressWarnings("unchecked") protected final T findUniqueResult(String queryString, Object... values) { List<T> list = getJpaTemplate().find(queryString, values); if (list.size() > 1) { throw new IllegalStateException( "Found more matches for unique result for class " ...
5073742_8
@SuppressWarnings("unchecked") @Override public List<T> findByUser(String userId) { Validate.notNull(userId, "User identifier can't be null"); String query = "select e from " + clazz.getSimpleName() + " as e where e.userId = ?1 order by e.id"; return getJpaTemplate().find(query, userId); }
5073742_9
@SuppressWarnings("unchecked") @Override public List<T> findByUser(String userId) { Validate.notNull(userId, "User identifier can't be null"); String query = "select e from " + clazz.getSimpleName() + " as e where e.userId = ?1 order by e.id"; return getJpaTemplate().find(query, userId); }
5074598_0
public static Map<String,Element> removeChildrenToMap(Element elem) { Map<String,Element> children = new LinkedHashMap<String,Element>(); for (Element child : DomUtil.getChildren(elem)) { String localName = DomUtil.getLocalName(child); Element prev = children.put(localName, child); i...
5074598_1
public static Map<String,Element> removeChildrenToMap(Element elem) { Map<String,Element> children = new LinkedHashMap<String,Element>(); for (Element child : DomUtil.getChildren(elem)) { String localName = DomUtil.getLocalName(child); Element prev = children.put(localName, child); i...
5074598_2
public static Map<String,Element> removeChildrenToMap(Element elem) { Map<String,Element> children = new LinkedHashMap<String,Element>(); for (Element child : DomUtil.getChildren(elem)) { String localName = DomUtil.getLocalName(child); Element prev = children.put(localName, child); i...
5074598_3
public static Element reconstruct(Element elem, String... childOrder) { return reconstruct(elem, removeChildrenToMap(elem), childOrder); }
5074598_4
public static Element reconstruct(Element elem, String... childOrder) { return reconstruct(elem, removeChildrenToMap(elem), childOrder); }
5074598_5
public static Element reconstruct(Element elem, String... childOrder) { return reconstruct(elem, removeChildrenToMap(elem), childOrder); }
5074598_6
public static Element reconstruct(Element elem, String... childOrder) { return reconstruct(elem, removeChildrenToMap(elem), childOrder); }
5074598_7
public Element clear(String xpath) { Element elem = selectElement(xpath); if (elem != null) DomUtil.removeAllChildren(elem); return elem; }
5074598_8
public String resolveProperties(String src) { if (src == null) return ""; StringBuilder dst = new StringBuilder(256).append(src); int propIdx = 0; while ((propIdx = dst.indexOf("${", propIdx)) >= 0) { int endPropIdx = dst.indexOf("}", propIdx); if (endPropIdx < 0) ...
5074598_9
public String resolveProperties(String src) { if (src == null) return ""; StringBuilder dst = new StringBuilder(256).append(src); int propIdx = 0; while ((propIdx = dst.indexOf("${", propIdx)) >= 0) { int endPropIdx = dst.indexOf("}", propIdx); if (endPropIdx < 0) ...
5077412_0
public void save(File file) throws IOException { Validate.notNull(file, "File cannot be null"); Files.createParentDirs(file); String data = saveToString(); Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8); try { writer.write(data); } finally { wr...
5077412_1
public void save(File file) throws IOException { Validate.notNull(file, "File cannot be null"); Files.createParentDirs(file); String data = saveToString(); Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8); try { writer.write(data); } finally { wr...
5077412_2
;
5077412_3
public void load(File file) throws FileNotFoundException, IOException, InvalidConfigurationException { Validate.notNull(file, "File cannot be null"); final FileInputStream stream = new FileInputStream(file); load(new InputStreamReader(stream, Charsets.UTF_8)); }
5077412_4
public void load(File file) throws FileNotFoundException, IOException, InvalidConfigurationException { Validate.notNull(file, "File cannot be null"); final FileInputStream stream = new FileInputStream(file); load(new InputStreamReader(stream, Charsets.UTF_8)); }
5077412_5
;
5077412_6
@Deprecated public byte getId() { return note; }
5077412_7
public Note sharped() { Validate.isTrue(note < 24, "This note cannot be sharped because it is the highest known note!"); return new Note(note + 1); }
5077412_8
@Deprecated public byte getId() { return note; }
5077412_9
@Deprecated public byte getId() { return note; }
5084932_0
@Override public List<SampleMeta> getAllSampleMeta(){ List<SampleMeta> sm = new ArrayList<SampleMeta>(); if (sample.getSampleMeta() != null && !sample.getSampleMeta().isEmpty()) sm.addAll(sample.getSampleMeta()); if (parent != null) sm.addAll(parent.getAllSampleMeta()); return sm; }
5084932_1
@Override public Set<String> getAllSampleMetaAreas(){ Set<String> areas = new HashSet<String>(); for(SampleMeta sm : this.getAllSampleMeta()){ areas.add(MetaHelper.getAreaFromMeta(sm)); } return areas; }
5084932_2
@Override public List<SampleMeta> getMetaTemplatedToSampleSybtype(SampleSubtype sampleSubtype) { List<SampleMeta> templateSampleMeta = new ArrayList<SampleMeta>(); List<String> sampleSubtypeComponentAreas = sampleSubtype.getComponentMetaAreas(); for(String area : sampleSubtypeComponentAreas){ templateSampl...
5084932_3
@Override public List<SampleMeta> updateMetaToList(List<SampleMeta> inputMetaList, SampleMetaDao sampleMetaDao){ return updateMetaToList(inputMetaList, sampleMetaDao, true); }
5084932_4
@Override public List<SampleMeta> updateMetaToList(List<SampleMeta> inputMetaList, SampleMetaDao sampleMetaDao){ return updateMetaToList(inputMetaList, sampleMetaDao, true); }
5084932_5
@Override public void saveAll(SampleService sampleService){ if (parent != null) parent.saveAll(sampleService); // Propagate up just in case // persist sample if not yet persisted if (sample.getSampleId() == null){ sampleService.saveSampleWithAssociatedMeta(sample); } }
5084932_6
public static String getLoginFromFormattedNameAndLogin(String formattedNameAndLogin){ if (formattedNameAndLogin == null || formattedNameAndLogin.isEmpty()){ return ""; // trim() will fail if formattedNameAndLogin is empty string, so simply return empty string } Pattern userLoginRegexPattern = Pattern.compile("^.*?...
5084932_7
public static String toCamelCase(String s){ return WordUtils.uncapitalize(WordUtils.capitalizeFully(s).replaceAll(" ", "")); }
5084932_8
public static String deCamelCase(String s){ Pattern p = Pattern.compile("([a-z])([A-Z])"); Matcher m = p.matcher(s); while (m.find()) s = s.replaceFirst(m.group(0), m.group(1) + " " + m.group(2).toLowerCase()); return StringUtils.capitalize(s); }
5084932_9
@Override public List<Sample> getSubmittedSamples(Job job){ Assert.assertParameterNotNull(job, "No Job provided"); Assert.assertParameterNotNull(job.getId(), "Invalid Job Provided"); List<Sample> submittedSamplesList = new ArrayList<Sample>(); for(JobSample jobSample : job.getJobSample()){//jobSampleDao.getJobSam...
5093728_0
public T run() { T result = null; if(context.hasFeature(featureName)) { result = onFeatureEnabled(); } else { result = onFeatureDisabled(); } return result; }