id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
7695110_20 | public static InetSocketAddress forUaddrString(String uaddr) {
int secondPort = uaddr.lastIndexOf('.');
if( secondPort == -1 ) {
throw new IllegalArgumentException("address " + uaddr + " doesn't match rfc5665");
}
int firstPort = uaddr.lastIndexOf('.', secondPort -1);
if( firstPort == -1 )... |
7707976_1 | @Override
public void add(ChronologicalRecord item) {
add(Collections.singleton(item).iterator(), 0);
} |
7710120_32 | public static <T> ConditionRoot<T> criteriaFor(Class<T> clazz) {
return new ConditionalCriteriaBuilder<T>().new RootBuilderImpl();
} |
7723306_12 | @Override
public <H, V> Table<H, V> getTable(String tableName, Serde<H> hashKeySerde, Serde<V> valueSerde) {
return getTable(tableName, hashKeySerde, ByteSerde.get, valueSerde);
} |
7731254_63 | public static Node[] parse(String id) {
if (id.length() == 0) {
return EMPTY_NODES_ARRAY;
}
List<Node> result = Lists.newArrayList();
Iterable<String> split = SeparatorChar.SPLITTER.split(id);
for (String s : split) {
if (s.charAt(0) == META_COMPONENT_SEPARATOR_CHAR) {
... |
7742400_8 | ; |
7748336_49 | public static <T> List<T> safe(final List<T> list) {
if (list == null) {
return Collections.emptyList();
}
return list;
} |
7762720_25 | public int getExonCount() {
return this.exonCount;
} |
7766448_1 | public static String sign(String appKey, String secret, Map<String, String> paramMap)
{
// 对参数名进行字典排序
String[] keyArray = paramMap.keySet().toArray(new String[0]);
Arrays.sort(keyArray);
// 拼接有序的参数名-值串
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(appKey);
for (Str... |
7767145_4 | public void createOrUpdate(Quote quote) throws Exception {
log.info( "Updating 1234-" + quote.getQuoteNumber() + " version " + quote.getQuoteVers() + " for potential: " + quote.getPotentialId());
String modifiedQuoteNumber = "1234-" + quote.getQuoteNumber(); // So we can fake a search for all
quote.setQuoteNumber(mo... |
7767313_22 | public synchronized void loadData(String dbLocation) throws DSPException {
try {
if ((dbLocation != null) && (dbLocation != "")) {
this.dbLocation = dbLocation;
} else { // otherwise use a default location and filename relative to this class
this.dbLocation = getClass().getResource("dspConf.json").getFil... |
7783162_11 | public MonetaryAmount addAll(MonetaryAmount... amounts) {
throw new UnsupportedOperationException();
} |
7807584_1 | @Override
public Exception decode(String methodKey, Response response) {
try {
// in case of error parsing, we can access the original contents.
response = bufferResponse(response);
UltraDNSError error = UltraDNSError.class.cast(decoder.decode(response, UltraDNSError.class));
if (error == null) {
... |
7819929_4 | public Price getVolumeGigabyteRate(String regionName) throws IOException {
getEc2OnDemandPrices();
Map<String, Object> region = getRegion(regionName, ebsPrices);
Map<String, Object> ebsVols = getJsonElementFromList(region, "types", "name", "ebsVols");
Map<String, Object> prices = getJsonElementFromList(... |
7823906_2 | public static String getResourceLabel(String key) {
try {
ResourceBundle res = ResourceBundle.getBundle("labels",
new EncodedControl("UTF-8"));
return res.getString(key);
} catch (MissingResourceException me) {
logger.warn("Unable to find ResourceBUndle", me);
return key;
}
} |
7826526_51 | public final Boolean exec(final Tuple input) throws ExecException {
if (input == null || input.get(0) == null) {
return false;
}
if (mode.equals("default")) {
String xCS = (String) input.get(1);
if (containsXcsValue(xCS)) {
String carrierName = xCSCarrierMap.get(this.xCS... |
7832943_3 | @VisibleForTesting
String getActualPath() throws ExecutionException, InterruptedException {
return _async.getActualPath();
} |
7837044_3 | protected MulticastSocket createSocket() throws UnknownHostException, IOException {
InetAddress address = InetAddress.getByName(multicastAddress);
MulticastSocket socket = new MulticastSocket(port);
socket.joinGroup(address);
return socket;
} |
7842918_5 | public static void setEntityRefsFromEntities(Collection<String> refs, Collection<Entity> entities)
{
refs.clear();
for (Iterator<Entity> i = entities.iterator(); i.hasNext();)
{
Entity entity = i.next();
refs.add(entity.getReference());
}
} |
7891529_103 | @UiHandler("cancelButton")
public void handleCancelClick(final ClickEvent event) {
this.actionDelegate.cancelled();
} |
7891564_7 | public static Pair<String, String> modifyBodyWithReferences(Message message, String body) {
if (body == null || body.isEmpty() || body.trim().isEmpty()) return new Pair<>(body, null);
List<ExtensionElement> elements = message.getExtensions(ReferenceElement.ELEMENT, ReferenceElement.NAMESPACE);
if (elements... |
7905539_3 | synchronized void close() {
mCondition = false;
} |
7908045_0 | @Override
public String toTarget(Translator translator, Symbol symbol) {
Release release;
try {
release = new Release(symbol.getProperty(OptionType.RELEASE.name()));
} catch (Exception e) {
return "<strong>Malformed release: " + e.getMessage() + "</strong>";
}
String href = symbol.getProperty(OptionT... |
7923123_11 | public FluentInitializer init(Date minDate, Date maxDate, TimeZone timeZone, Locale locale) {
if (minDate == null || maxDate == null) {
throw new IllegalArgumentException(
"minDate and maxDate must be non-null. " + dbg(minDate, maxDate));
}
if (minDate.after(maxDate)) {
throw new IllegalArgumentE... |
7968180_69 | public CytoPanelState getNewState() {
return newState;
} |
7968744_1 | public void start(BundleContext bc) {
CySwingApplication cytoscapeDesktopService = getService(bc,CySwingApplication.class);
MyControlPanel myControlPanel = new MyControlPanel();
ControlPanelAction controlPanelAction = new ControlPanelAction(cytoscapeDesktopService,myControlPanel);
registerService(bc,myControlPa... |
7983535_9 | public final static Type getCollectionType(Type type) {
if (type instanceof GenericArrayType) {
return ((GenericArrayType) type).getGenericComponentType();
} else if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>) type;
if (clazz.isArray())
return clazz.getComponentType();
else if (Co... |
7997879_106 | public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {
/* See http://prometheus.io/docs/instrumenting/exposition_formats/
* for the output format specification. */
while(mfs.hasMoreElements()) {
Collector.MetricFamilySamples metricFamilySamples = mfs.n... |
8000878_7 | public RaygunMessage onBeforeSend(RaygunClient client, RaygunMessage message) {
if(message.getDetails() != null
&& message.getDetails().getError() != null
&& message.getDetails().getError().getInnerError() != null
&& message.getDetails().getError().getThrowable() != null) {
... |
8010626_2018 | @Transactional
@Override
public EntityImportReport doImport(
RepositoryCollection source,
MetadataAction metadataAction,
DataAction dataAction,
@Nullable @CheckForNull String packageId) {
if (dataAction != DataAction.ADD) {
throw new IllegalArgumentException("Only ADD is supported");
}
Packag... |
8015168_6 | public Vector vectorise(Document document) {
Vector body = luceneEncode(bodyCard, document.getBody());
Vector title = luceneEncode(titleCard, document.getTitle());
//Vector tags = luceneEncode(tagCard, Strings.collectionToCommaDelimitedString(document.getTags()));
//Vector reputation = Vectors.newSequentialAccessSp... |
8022939_8 | @Override
public String getString(String key) {
return getPropertyResolver().getString(checkNotNull(key));
} |
8025185_0 | public AppleLanguage getLanguage() {
return language;
} |
8031741_0 | public static Position findPosition(Position startingLocation,
Position endLocation, double distanceTravelled) {
double distance = distanceTravelled / 6371000;
LatLonPoint result = GreatCircle.pointAtDistanceBetweenPoints(
Math.toRadians(startingLocation.getLatitude()),
Math.toR... |
8033805_0 | public int returnInputValue(int input) {
return input;
} |
8037199_2 | public static String renderWhereStringTemplate(String sqlWhereString, Dialect dialect, SQLFunctionRegistry functionRegistry) {
return renderWhereStringTemplate(sqlWhereString, TEMPLATE, dialect, functionRegistry);
} |
8049046_20 | @Override
public void execute(final AddToList command) {
final List<Object> list = getListOrFail(command);
final Object value = valueMapper.map(command.getValue());
silentChangeExecutor.execute(list, new Runnable() {
@Override
public void run() {
list.add(command.getPosition(),... |
8054843_6 | public static HackedObject into(final Object source) {
return new HackedMirrorObject(source);
} |
8087042_25 | protected static StringBuilder newBody(String name, String value) {
return new StringBuilder(nonNull(name)).append('=').append(nonNull(value));
} |
8131104_25 | @Override
public void update(T newPage) {
decoder.update(newPage);
} |
8134070_1 | public User getUser(String userId) {
return dao.get(new Integer(userId));
} |
8135809_1 | @Override
public void execute(SensorContext context) {
FileSystem fileSystem = context.fileSystem();
FilePredicates predicates = fileSystem.predicates();
List<SquidAstVisitor<LexerlessGrammar>> visitors = new ArrayList<>(checks.all());
visitors.add(new FileLinesVisitor(fileLinesContextFactory, fileSystem));
L... |
8139882_0 | @PostConstruct
public void init() {
appFormerJsBridge.init("org.kie.bc.KIEWebapp");
homeConfiguration.setMonitoring(true);
workbench.addStartupBlocker(KieWorkbenchEntryPoint.class);
// Due to a limitation in the Menus API the number of levels in the workbench's menu bar
// navigation tree node... |
8143599_92 | static public void setDebug(Debug dbg) {
debug = dbg;
} |
8147920_29 | public static long estimatedSizeOf(Statement statement) {
Value object = statement.getObject();
Resource context = statement.getContext();
long result = STATEMENT_OVERHEAD
+ 2 * URI_BNODE_OVERHEAD // subject, predicate
+ OBJ_REF // reference to the statement
+ StringSizeE... |
8155767_6 | public WeatherStatusResponse currentWeatherAtCity (float lat, float lon, int cnt) throws IOException, JSONException { //, boolean cluster, OwmClient.Lang lang) {
String subUrl = String.format (Locale.ROOT, "find/city?lat=%f&lon=%f&cnt=%d&cluster=yes",
Float.valueOf (lat), Float.valueOf (lon), Integer.valueOf (cnt))... |
8166928_10 | @Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
long deliveryTag = envelope.getDeliveryTag();
Stopwatch stopwatch = Stopwatch.createStarted();
try {
T message = MAPPER.readValue(body, type);
if (... |
8176370_4 | public void setHref(String href) {
this.href = href;
} |
8188105_4 | public OftpSettings getSettings() {
return settings;
} |
8197357_346 | public void add(long xVal, double yVal) {
if (getFirstTime() == Long.MIN_VALUE) {
firstTime = xVal;
}
if (xVal > maxX) {
maxX = xVal;
}
if (xVal < minX) {
minX = xVal;
}
} |
8201183_0 | public System(EngineManager engine) {
setName("System");
this.engine = engine;
} |
8201494_8 | @Override
public boolean equals(Object obj) {
if (obj instanceof WGS84Point) {
WGS84Point other = (WGS84Point) obj;
return latitude == other.latitude && longitude == other.longitude;
}
return false;
} |
8204840_6 | @Override
public void onChange()
{
refresh();
} |
8212556_25 | public static boolean isBlank(CharSequence sourceSequence) {
int sequenceLength;
if (sourceSequence == null || (sequenceLength = sourceSequence.length()) == 0) {
return true;
}
for (int i = 0; i < sequenceLength; i++) {
if ((Character.isWhitespace(sourceSequence.charAt(i)) == false)) {
... |
8236056_71 | public V remove (short key) {
if (key == 0) {
if (!hasZeroValue) return null;
V oldValue = zeroValue;
zeroValue = null;
hasZeroValue = false;
size--;
return oldValue;
}
int index = (int)(key & mask);
if (keyTable[index] == key) {
keyTable[index] =... |
8249432_1 | @Override
public List<Map<String, Object>> queryForMapList(String sql, Object... args)
throws DataAccessException {
return (List<Map<String, Object>>) query(sql, args, new MapListResultSetExtractor());
} |
8262372_172 | Map<HRegionInfo, ServerName[]> placeSecondaryAndTertiaryRS(
Map<HRegionInfo, ServerName> primaryRSMap) {
Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
new HashMap<HRegionInfo, ServerName[]>();
for (Map.Entry<HRegionInfo, ServerName> entry : primaryRSMap.entrySet()) {
// Get the target regio... |
8266524_10 | public static <T> void runEach(final Iterable<T> elements, final Action1<T> action) {
shouldNotBeNull(elements, "elements");
shouldNotBeNull(action, "function");
if (isDebugEnabled) log.debug("병렬로 작업을 수행합니다... workerCount=[{}]", getWorkerCount());
ExecutorService executor = Executors.newFixedThreadPool... |
8276360_0 | protected String getEnqueueRecordsDestinationUri() {
return "activemq:queue:" + recordsQueueName;
} |
8279377_2 | static Double calculateDurationAgainstDvTemporal(String value, DvTemporal operationTemporal, String symbol) {
DateTime dateTime = getDateTime(operationTemporal, value);
return calculateDurationAgainstDateTime(value, dateTime, symbol);
} |
8289370_122 | public boolean updateAttachmentContent(String name, EntityRef parent, IndicatingInputStream is, long length, boolean silent) {
Map<String,String> headers = Collections.singletonMap("Content-Type", "application/octet-stream");
MyResultInfo result = new MyResultInfo();
if(restService.put(new MyInputData(is, l... |
8296012_4 | @Override
public void run() {
String line;
try {
while ((line = bufferedReader.readLine()) != null) {
log.info(line);
}
} catch (IOException e) {
throw new TaskException("Exception while intercepting stream.", e);
}
IOUtils.closeQuietly(bufferedReader);
IOUti... |
8322886_1 | protected void logActivity(JSONObject payload) throws JSONException, IOException {
String eventName = payload.getString("event");
JSONObject properties = payload.getJSONObject("properties");
// Adjust the time from milliseconds to seconds...
Long time = properties.optLong("time", 0L);
if (time == 0... |
8328088_66 | public Attendant getAttendant() {
return attendant;
} |
8333478_3 | @RequestMapping(value = "/execute",method=RequestMethod.POST)
public ModelAndView executeTask(@RequestParam String spaceName,@RequestParam String locators,@RequestBody SpaceTaskRequest body)
{
return execute(spaceName,locators,body);
} |
8369425_1 | public static double calculateTickSpacing( double delta, int maxTicks ) {
if ( delta == 0.0 )
return 0.0;
if ( delta <= 0.0 )
throw new IllegalArgumentException( "delta must be positive" );
if ( maxTicks < 1 )
throw new IllegalArgumentException( "must be at least one tick" );
//The factor will be close to th... |
8406849_42 | public JSONObject toJSON(ModelView o) throws JSONConverterException {
ModelViewConverter c = java2json.get(o.getClass());
if (c == null) {
throw new JSONConverterException("No converter available for a view with the '" + o.getClass() + "' className");
}
return c.toJSON(o);
} |
8411032_2 | public T check(final String aString) {
final char[] chars = aString.toCharArray();
for (int i = 0; i < chars.length; i++) {
final Node<T> root = this.roots.get(chars[i]);
if (root != null) {
final T res = root.check(chars, i);
if (res != null) {
return res... |
8417769_0 | static public List<Record> readTable(String urlString, String format, int maxLines) throws IOException, NumberFormatException {
InputStream ios;
if (urlString.startsWith("http:")) {
URL url = new URL(urlString);
ios = url.openStream();
} else {
ios = new FileInputStream(urlString);
}
return read... |
8426406_624 | public boolean matches(String matched) {
return matches(null, string(matched));
} |
8427412_17 | public void calculateReservations(StockOperation operation) {
if (operation == null) {
throw new IllegalArgumentException("The operation must be defined");
}
/*
We want to ensure that duplicated transactions are combined so they don't cause issues when they are processed.
To do this, we loop through each tran... |
8428305_19 | @Override
public final void onUpdate(List<? extends ActorStateUpdate> updates) {
updates.stream().filter(
update -> update.getActorClass().getAnnotation(IndexConfig.class) != null
).forEach(update ->
{
IndexConfig indexConfig = update.getActorClass().getAnnotation(IndexCo... |
8436798_1 | @Override
public String extractValue(IHttpRequest request) {
return StringUtils.defaultIfEmpty(request.getFormParameterValue(key), null);
} |
8467178_18 | public void setEndpoints(String notify, String sessions) throws IllegalArgumentException {
if (notify == null || notify.isEmpty()) {
throw new IllegalArgumentException("Notify endpoint cannot be empty or null.");
} else {
if (delivery instanceof HttpDelivery) {
((HttpDelivery) delive... |
8483862_136 | public void appendReferenceField(final char[] tag, final String value) {
appendReferenceField(tag, defaultImplDefinedPart, value);
} |
8497273_2 | public static String relativePath(File parent, File child) {
Preconditions.checkArgument(contains(parent, child));
String parentName = conventPath(parent);
String childName = conventPath(child);
String relative = childName.substring(parentName.length());
if (relative.length() == 0) return "/... |
8504385_1 | public static Gson getGson() {
Gson gson = new GsonBuilder().
registerTypeAdapter(ServerOption.class, new ServerOptionParentDeserializer()).
excludeFieldsWithoutExposeAnnotation().
create();
return gson;
} |
8530120_97 | public void copyAssetsFromContent(File path) {
copy(path, config.getDestinationFolder(), FileUtil.getNotContentFileFilter());
} |
8560742_3 | public RecordWriter<Data, NullWritable> getRecordWriter() {
consumerFuture = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat
("OutputFormatLoader-consumer").build()).submit(
new ConsumerThread());
return producer;
} |
8570603_1 | protected Promise<? extends D_OUT, ? extends F_OUT, ? extends P_OUT> pipe(
Promise<? extends D_OUT, ? extends F_OUT, ? extends P_OUT> promise) {
promise.done(new DoneCallback<D_OUT>() {
@Override
public void onDone(D_OUT result) {
PipedPromise.this.resolve(result);
}
}).fail(new FailCallback<F_OUT>() {
@... |
8571000_2 | @Override
public void close() throws IOException {
// TODO Auto-generated method stub
synonymFilter.close();
} |
8575137_0 | static String asHumanDescription(Collection<? extends MemberViewBinding> bindings) {
Iterator<? extends MemberViewBinding> iterator = bindings.iterator();
switch (bindings.size()) {
case 1:
return iterator.next().getDescription();
case 2:
return iterator.next().getDescription() + " and " + itera... |
8578424_1 | @Nullable
public Repository parseRepositoryUrl(@NotNull String uri) {
return parseRepositoryUrl(uri, null);
} |
8582237_64 | @Override
public long rangeSelectivity(ExecRow start, ExecRow stop, boolean includeStart, boolean includeStop, boolean useExtrapolation) {
double startSelectivity = start==null?0.0d:quantilesSketch.getCDF(new ExecRow[]{start})[0];
double stopSelectivity = stop==null?1.0d:quantilesSketch.getCDF(new ExecRow[]{sto... |
8595333_34 | public int getMaxHttpConnection() {
return maxHttpConnection;
} |
8599516_1 | @Override public final void destroyItem(ViewGroup container, int position, Object object) {
View view = (View) object;
container.removeView(view);
int viewType = getItemViewType(position);
if (viewType != IGNORE_ITEM_VIEW_TYPE) {
recycleBin.addScrapView(view, position, viewType);
}
} |
8621768_4 | public ClassLoader getClassLoader() {
// get jars if somehing changed
File[] jars = getJarsIfSomeIsModifiedAfterInterval();
if (jars == null)
return currentClassLoader;
// update classloader
synchronized (this) {
try {
// copy jars to a new spooldir
File newSpoolDir = copyJarsToTempDir(jars);
// cre... |
8629076_1 | public static File doChoosePath() {
JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home"));
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) {
return fileChooser.getCurrentDirectory(... |
8648747_53 | public synchronized long toDigest(final String key) throws DigestException, UnsupportedEncodingException {
if (key == null) {
throw new NullPointerException("You attempted to convert a null string into a hash digest");
}
final byte[] bytes = key.getBytes("UTF-8");
return toDigest(bytes);
} |
8667914_0 | public static String wrapString(String str) {
return wrapString(str, MAX_LENGTH);
} |
8672234_4 | public List<String> replaceRunOnWords(final String original) {
final List<CandidateData> candidateData = replaceRunOnWordCandidates(original);
final List<String> candidates = new ArrayList<>();
for (CandidateData candidate : candidateData) {
candidates.add(candidate.word);
}
return candidates;
} |
8680105_8 | @NotNull
@Override
protected EntityCoordinates getDestination() throws TeleportException {
MultiverseWorld mvWorld = this.getApi().getWorldManager().getWorld(world);
if (mvWorld == null) {
throw new TeleportException(Message.bundleMessage(NOT_LOADED, world));
}
return Locations.getEntityCoordi... |
8682860_4 | public static void roundTimeUp(Calendar calendar) {
calendar.set(Calendar.SECOND, 0);
// Round to the nearest MINUTE_INCREMENT, advancing the clock at least MINIMUM_INCREMENT.
int remainder = calendar.get(Calendar.MINUTE) % MINUTE_INCREMENT;
int increment = -remainder + MINUTE_INCREMENT;
calendar.ad... |
8693016_2 | public VersionRows extractVersionRows() {
// Read all the concepts from the raw data
List<ConceptRow> crs = new ArrayList<ConceptRow>();
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(conceptsFile));
String line = br.readLine(); // Skip first line... |
8701655_107 | public Registration add(final ListenerT l) {
if (isEmpty()) {
beforeFirstAdded();
}
if (myFireDepth > 0) {
myListeners.add(new ListenerOp<>(l, true));
} else {
if (myListeners == null) {
myListeners = new ArrayList<>(1);
}
myListeners.add(l);
myListenersCount++;
}
return new R... |
8706918_55 | @Override
public Result apply(PathData item) throws IOException {
if(getFileStatus(item).getModificationTime() > filetime) {
return Result.PASS;
}
return Result.FAIL;
} |
8714569_2 | public Set<Inclusion> normalise(final Set<? extends Axiom> inclusions) {
// Exhaustively apply NF1 to NF4
Set<Inclusion> newIs = transformAxiom(inclusions);
Set<Inclusion> oldIs = new HashSet<Inclusion>(newIs.size());
final Set<Inclusion> done = new HashSet<Inclusion>(newIs.size());
do {
... |
8715861_5 | @Override
public String getSQL(Version currentVersion) {
return Tables.getSQL(SQL, currentVersion);
} |
8731044_81 | public Property inheritProperty(Node content, String relPath) throws RepositoryException {
if (content == null) {
return null;
}
if (StringUtils.isBlank(relPath)) {
throw new IllegalArgumentException("relative path cannot be null or empty");
}
try {
Node inheritedNode = wrapF... |
8742308_0 | public static long predictNext(TreeMap<Integer, Long> laps)
{
float smoothing = (((float) 2) / (laps.size() + 1));
long previousEMA = laps.get(laps.firstKey());
Set<Integer> keys = laps.keySet();
for (Iterator<Integer> i = keys.iterator(); i.hasNext();) {
Integer key = i.next();
previousEMA = (long) ((laps.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.