_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q25300
DbPro.update
train
public int update(String sql, Object... paras) { Connection conn = null; try { conn = config.getConnection(); return update(config, conn, sql, paras); } catch (Exception e) { throw new ActiveRecordException(e); } finally { config.close(conn); } }
java
{ "resource": "" }
q25301
DbPro.findFirstByCache
train
public Record findFirstByCache(String cacheName, Object key, String sql, Object... paras) { ICache cache = config.getCache(); Record result = cache.get(cacheName, key); if (result == null) { result = findFirst(sql, paras); cache.put(cacheName, key, result); } return result; }
java
{ "resource": "" }
q25302
DbPro.batchSave
train
public int[] batchSave(List<? extends Model> modelList, int batchSize) { if (modelList == null || modelList.size() == 0) return new int[0]; Model model = modelList.get(0); Map<String, Object> attrs = model._getAttrs(); int index = 0; StringBuilder columns = new StringBuilder(...
java
{ "resource": "" }
q25303
DbPro.batchSave
train
public int[] batchSave(String tableName, List<Record> recordList, int batchSize) { if (recordList == null || recordList.size() == 0) return new int[0]; Record record = recordList.get(0); Map<String, Object> cols = record.getColumns(); int index = 0; StringBuilder columns = ne...
java
{ "resource": "" }
q25304
DbPro.batchUpdate
train
public int[] batchUpdate(List<? extends Model> modelList, int batchSize) { if (modelList == null || modelList.size() == 0) return new int[0]; Model model = modelList.get(0); Table table = TableMapping.me().getTable(model.getClass()); String[] pKeys = table.getPrimaryKey(); Ma...
java
{ "resource": "" }
q25305
DbPro.batchUpdate
train
public int[] batchUpdate(String tableName, String primaryKey, List<Record> recordList, int batchSize) { if (recordList == null || recordList.size() == 0) return new int[0]; String[] pKeys = primaryKey.split(","); config.dialect.trimPrimaryKeys(pKeys); Record record = recordL...
java
{ "resource": "" }
q25306
DbPro.batchUpdate
train
public int[] batchUpdate(String tableName, List<Record> recordList, int batchSize) { return batchUpdate(tableName, config.dialect.getDefaultPrimaryKey(),recordList, batchSize); }
java
{ "resource": "" }
q25307
HandlerFactory.getHandler
train
@SuppressWarnings("deprecation") public static Handler getHandler(List<Handler> handlerList, Handler actionHandler) { Handler result = actionHandler; for (int i=handlerList.size()-1; i>=0; i--) { Handler temp = handlerList.get(i); temp.next = result; temp.nextHandler = result; result = temp;...
java
{ "resource": "" }
q25308
Validator.addError
train
protected void addError(String errorKey, String errorMessage) { invalid = true; controller.setAttr(errorKey, errorMessage); if (shortCircuit) { throw new ValidateException(); } }
java
{ "resource": "" }
q25309
Validator.validateRequired
train
protected void validateRequired(String field, String errorKey, String errorMessage) { String value = controller.getPara(field); if (value == null || "".equals(value)) { // 经测试,form表单域无输入时值为"",跳格键值为"\t",输入空格则为空格" " addError(errorKey, errorMessage); } }
java
{ "resource": "" }
q25310
Validator.validateRequired
train
protected void validateRequired(int index, String errorKey, String errorMessage) { String value = controller.getPara(index); if (value == null /* || "".equals(value) */) { addError(errorKey, errorMessage); } }
java
{ "resource": "" }
q25311
Validator.validateRequiredString
train
protected void validateRequiredString(String field, String errorKey, String errorMessage) { if (StrKit.isBlank(controller.getPara(field))) { addError(errorKey, errorMessage); } }
java
{ "resource": "" }
q25312
Validator.validateInteger
train
protected void validateInteger(String field, String errorKey, String errorMessage) { validateIntegerValue(controller.getPara(field), errorKey, errorMessage); }
java
{ "resource": "" }
q25313
Validator.validateInteger
train
protected void validateInteger(int index, String errorKey, String errorMessage) { String value = controller.getPara(index); if (value != null && (value.startsWith("N") || value.startsWith("n"))) { value = "-" + value.substring(1); } validateIntegerValue(value, errorKey, errorMessage); }
java
{ "resource": "" }
q25314
Validator.validateLong
train
protected void validateLong(String field, long min, long max, String errorKey, String errorMessage) { validateLongValue(controller.getPara(field), min, max, errorKey, errorMessage); }
java
{ "resource": "" }
q25315
Validator.validateLong
train
protected void validateLong(int index, long min, long max, String errorKey, String errorMessage) { String value = controller.getPara(index); if (value != null && (value.startsWith("N") || value.startsWith("n"))) { value = "-" + value.substring(1); } validateLongValue(value, min, max, errorKey, errorMess...
java
{ "resource": "" }
q25316
Validator.validateDouble
train
protected void validateDouble(String field, double min, double max, String errorKey, String errorMessage) { String value = controller.getPara(field); if (StrKit.isBlank(value)) { addError(errorKey, errorMessage); return ; } try { double temp = Double.parseDouble(value.trim()); if (temp < min...
java
{ "resource": "" }
q25317
Validator.validateDate
train
protected void validateDate(String field, Date min, Date max, String errorKey, String errorMessage) { String value = controller.getPara(field); if (StrKit.isBlank(value)) { addError(errorKey, errorMessage); return ; } try { Date temp = new SimpleDateFormat(getDatePattern()).parse(value.trim()); ...
java
{ "resource": "" }
q25318
Validator.validateEqualField
train
protected void validateEqualField(String field_1, String field_2, String errorKey, String errorMessage) { String value_1 = controller.getPara(field_1); String value_2 = controller.getPara(field_2); if (value_1 == null || value_2 == null || (! value_1.equals(value_2))) { addError(errorKey, errorMessage); ...
java
{ "resource": "" }
q25319
Validator.validateEqualString
train
protected void validateEqualString(String s1, String s2, String errorKey, String errorMessage) { if (s1 == null || s2 == null || (! s1.equals(s2))) { addError(errorKey, errorMessage); } }
java
{ "resource": "" }
q25320
Validator.validateEqualInteger
train
protected void validateEqualInteger(Integer i1, Integer i2, String errorKey, String errorMessage) { if (i1 == null || i2 == null || (i1.intValue() != i2.intValue())) { addError(errorKey, errorMessage); } }
java
{ "resource": "" }
q25321
Validator.validateEmail
train
protected void validateEmail(String field, String errorKey, String errorMessage) { validateRegex(field, emailAddressPattern, false, errorKey, errorMessage); }
java
{ "resource": "" }
q25322
Validator.validateUrl
train
protected void validateUrl(String field, String errorKey, String errorMessage) { String value = controller.getPara(field); if (StrKit.isBlank(value)) { addError(errorKey, errorMessage); return ; } try { value = value.trim(); if (value.startsWith("https://")) { value = "http://" + value....
java
{ "resource": "" }
q25323
Validator.validateRegex
train
protected void validateRegex(String field, String regExpression, boolean isCaseSensitive, String errorKey, String errorMessage) { String value = controller.getPara(field); if (value == null) { addError(errorKey, errorMessage); return ; } Pattern pattern = isCaseSe...
java
{ "resource": "" }
q25324
Validator.validateRegex
train
protected void validateRegex(String field, String regExpression, String errorKey, String errorMessage) { validateRegex(field, regExpression, true, errorKey, errorMessage); }
java
{ "resource": "" }
q25325
Validator.validateString
train
protected void validateString(String field, int minLen, int maxLen, String errorKey, String errorMessage) { validateStringValue(controller.getPara(field), minLen, maxLen, errorKey, errorMessage); }
java
{ "resource": "" }
q25326
Validator.validateBoolean
train
protected void validateBoolean(String field, String errorKey, String errorMessage) { validateBooleanValue(controller.getPara(field), errorKey, errorMessage); }
java
{ "resource": "" }
q25327
Validator.validateBoolean
train
protected void validateBoolean(int index, String errorKey, String errorMessage) { validateBooleanValue(controller.getPara(index), errorKey, errorMessage); }
java
{ "resource": "" }
q25328
Constants.setRenderFactory
train
public void setRenderFactory(IRenderFactory renderFactory) { if (renderFactory == null) { throw new IllegalArgumentException("renderFactory can not be null."); } RenderManager.me().setRenderFactory(renderFactory); }
java
{ "resource": "" }
q25329
Constants.setUrlParaSeparator
train
public void setUrlParaSeparator(String urlParaSeparator) { if (StrKit.isBlank(urlParaSeparator) || urlParaSeparator.contains("/")) { throw new IllegalArgumentException("urlParaSepartor can not be blank and can not contains \"/\""); } this.urlParaSeparator = urlParaSeparator; }
java
{ "resource": "" }
q25330
Model._getAttrNames
train
public String[] _getAttrNames() { Set<String> attrNameSet = attrs.keySet(); return attrNameSet.toArray(new String[attrNameSet.size()]); }
java
{ "resource": "" }
q25331
Model._getAttrValues
train
public Object[] _getAttrValues() { java.util.Collection<Object> attrValueCollection = attrs.values(); return attrValueCollection.toArray(new Object[attrValueCollection.size()]); }
java
{ "resource": "" }
q25332
Model._setAttrs
train
public M _setAttrs(Map<String, Object> attrs) { for (Entry<String, Object> e : attrs.entrySet()) set(e.getKey(), e.getValue()); return (M)this; } /* private Set<String> getModifyFlag() { if (modifyFlag == null) modifyFlag = getConfig().containerFactory.getModifyFlagSet(); // new HashSet<String...
java
{ "resource": "" }
q25333
Model.put
train
public M put(Map<String, Object> map) { attrs.putAll(map); return (M)this; }
java
{ "resource": "" }
q25334
Model.get
train
public <T> T get(String attr, Object defaultValue) { Object result = attrs.get(attr); return (T)(result != null ? result : defaultValue); }
java
{ "resource": "" }
q25335
Model.save
train
public boolean save() { filter(FILTER_BY_SAVE); Config config = _getConfig(); Table table = _getTable(); StringBuilder sql = new StringBuilder(); List<Object> paras = new ArrayList<Object>(); config.dialect.forModelSave(table, attrs, sql, paras); // if (paras.size() == 0) return false; // T...
java
{ "resource": "" }
q25336
Model.deleteByIds
train
public boolean deleteByIds(Object... idValues) { Table table = _getTable(); if (idValues == null || idValues.length != table.getPrimaryKey().length) throw new IllegalArgumentException("Primary key nubmer must equals id value number and can not be null"); return deleteById(table, idValues); }
java
{ "resource": "" }
q25337
Model.update
train
public boolean update() { filter(FILTER_BY_UPDATE); if (_getModifyFlag().isEmpty()) { return false; } Table table = _getTable(); String[] pKeys = table.getPrimaryKey(); for (String pKey : pKeys) { Object id = attrs.get(pKey); if (id == null) throw new ActiveRecordException("Yo...
java
{ "resource": "" }
q25338
Model.remove
train
public M remove(String attr) { attrs.remove(attr); _getModifyFlag().remove(attr); return (M)this; }
java
{ "resource": "" }
q25339
Model.remove
train
public M remove(String... attrs) { if (attrs != null) for (String a : attrs) { this.attrs.remove(a); this._getModifyFlag().remove(a); } return (M)this; }
java
{ "resource": "" }
q25340
Model.removeNullValueAttrs
train
public M removeNullValueAttrs() { for (Iterator<Entry<String, Object>> it = attrs.entrySet().iterator(); it.hasNext();) { Entry<String, Object> e = it.next(); if (e.getValue() == null) { it.remove(); _getModifyFlag().remove(e.getKey()); } } return (M)this; }
java
{ "resource": "" }
q25341
Model.keep
train
public M keep(String... attrs) { if (attrs != null && attrs.length > 0) { Config config = _getConfig(); if (config == null) { // 支持无数据库连接场景 config = DbKit.brokenConfig; } Map<String, Object> newAttrs = config.containerFactory.getAttrsMap(); // new HashMap<String, Object>(attrs.length); Set<S...
java
{ "resource": "" }
q25342
Model.keep
train
public M keep(String attr) { if (attrs.containsKey(attr)) { // prevent put null value to the newColumns Object keepIt = attrs.get(attr); boolean keepFlag = _getModifyFlag().contains(attr); attrs.clear(); _getModifyFlag().clear(); attrs.put(attr, keepIt); if (keepFlag) _getModifyFlag().ad...
java
{ "resource": "" }
q25343
Model.findByCache
train
public List<M> findByCache(String cacheName, Object key, String sql, Object... paras) { Config config = _getConfig(); ICache cache = config.getCache(); List<M> result = cache.get(cacheName, key); if (result == null) { result = find(config, sql, paras); cache.put(cacheName, key, result); } retu...
java
{ "resource": "" }
q25344
Model.findFirstByCache
train
public M findFirstByCache(String cacheName, Object key, String sql, Object... paras) { ICache cache = _getConfig().getCache(); M result = cache.get(cacheName, key); if (result == null) { result = findFirst(sql, paras); cache.put(cacheName, key, result); } return result; }
java
{ "resource": "" }
q25345
I18n.use
train
public static Res use(String baseName, String locale) { String resKey = baseName + locale; Res res = resMap.get(resKey); if (res == null) { res = new Res(baseName, locale); resMap.put(resKey, res); } return res; }
java
{ "resource": "" }
q25346
HashKit.generateSalt
train
public static String generateSalt(int saltLength) { StringBuilder salt = new StringBuilder(saltLength); for (int i=0; i<saltLength; i++) { salt.append(CHAR_ARRAY[random.nextInt(CHAR_ARRAY.length)]); } return salt.toString(); }
java
{ "resource": "" }
q25347
SliderLayout.startAutoCycle
train
public void startAutoCycle(long delay,long duration,boolean autoRecover){ if(mCycleTimer != null) mCycleTimer.cancel(); if(mCycleTask != null) mCycleTask.cancel(); if(mResumingTask != null) mResumingTask.cancel(); if(mResumingTimer != null) mResumingTimer.cancel(); mSliderDuratio...
java
{ "resource": "" }
q25348
SliderLayout.pauseAutoCycle
train
private void pauseAutoCycle(){ if(mCycling){ mCycleTimer.cancel(); mCycleTask.cancel(); mCycling = false; }else{ if(mResumingTimer != null && mResumingTask != null){ recoverCycle(); } } }
java
{ "resource": "" }
q25349
SliderLayout.stopAutoCycle
train
public void stopAutoCycle(){ if(mCycleTask!=null){ mCycleTask.cancel(); } if(mCycleTimer!= null){ mCycleTimer.cancel(); } if(mResumingTimer!= null){ mResumingTimer.cancel(); } if(mResumingTask!=null){ mResumingTask.c...
java
{ "resource": "" }
q25350
SliderLayout.recoverCycle
train
private void recoverCycle(){ if(!mAutoRecover || !mAutoCycle){ return; } if(!mCycling){ if(mResumingTask != null && mResumingTimer!= null){ mResumingTimer.cancel(); mResumingTask.cancel(); } mResumingTimer = new Tim...
java
{ "resource": "" }
q25351
SliderLayout.setPagerTransformer
train
public void setPagerTransformer(boolean reverseDrawingOrder,BaseTransformer transformer){ mViewPagerTransformer = transformer; mViewPagerTransformer.setCustomAnimationInterface(mCustomAnimation); mViewPager.setPageTransformer(reverseDrawingOrder,mViewPagerTransformer); }
java
{ "resource": "" }
q25352
SliderLayout.setSliderTransformDuration
train
public void setSliderTransformDuration(int period,Interpolator interpolator){ try{ Field mScroller = ViewPagerEx.class.getDeclaredField("mScroller"); mScroller.setAccessible(true); FixedSpeedScroller scroller = new FixedSpeedScroller(mViewPager.getContext(),interpolator, peri...
java
{ "resource": "" }
q25353
SliderLayout.setPresetTransformer
train
public void setPresetTransformer(int transformerId){ for(Transformer t : Transformer.values()){ if(t.ordinal() == transformerId){ setPresetTransformer(t); break; } } }
java
{ "resource": "" }
q25354
SliderLayout.setPresetTransformer
train
public void setPresetTransformer(String transformerName){ for(Transformer t : Transformer.values()){ if(t.equals(transformerName)){ setPresetTransformer(t); return; } } }
java
{ "resource": "" }
q25355
SliderLayout.getCurrentSlider
train
public BaseSliderView getCurrentSlider(){ if(getRealAdapter() == null) throw new IllegalStateException("You did not set a slider adapter"); int count = getRealAdapter().getCount(); int realCount = mViewPager.getCurrentItem() % count; return getRealAdapter().getSliderView(r...
java
{ "resource": "" }
q25356
SliderLayout.setCurrentPosition
train
public void setCurrentPosition(int position, boolean smooth) { if (getRealAdapter() == null) throw new IllegalStateException("You did not set a slider adapter"); if(position >= getRealAdapter().getCount()){ throw new IllegalStateException("Item position is not exist"); } ...
java
{ "resource": "" }
q25357
SliderLayout.movePrevPosition
train
public void movePrevPosition(boolean smooth) { if (getRealAdapter() == null) throw new IllegalStateException("You did not set a slider adapter"); mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1, smooth); }
java
{ "resource": "" }
q25358
SliderLayout.moveNextPosition
train
public void moveNextPosition(boolean smooth) { if (getRealAdapter() == null) throw new IllegalStateException("You did not set a slider adapter"); mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, smooth); }
java
{ "resource": "" }
q25359
ViewPagerEx.setOffscreenPageLimit
train
public void setOffscreenPageLimit(int limit) { if (limit < DEFAULT_OFFSCREEN_PAGES) { Log.w(TAG, "Requested offscreen page limit " + limit + " too small; defaulting to " + DEFAULT_OFFSCREEN_PAGES); limit = DEFAULT_OFFSCREEN_PAGES; } if (limit != mOffsc...
java
{ "resource": "" }
q25360
ViewPagerEx.setPageMarginDrawable
train
public void setPageMarginDrawable(Drawable d) { mMarginDrawable = d; if (d != null) refreshDrawableState(); setWillNotDraw(d == null); invalidate(); }
java
{ "resource": "" }
q25361
ViewPagerEx.addTouchables
train
@Override public void addTouchables(ArrayList<View> views) { // Note that we don't call super.addTouchables(), which means that // we don't call View.addTouchables(). This is okay because a ViewPager // is itself not touchable. for (int i = 0; i < getChildCount(); i++) { ...
java
{ "resource": "" }
q25362
SliderAdapter.onEnd
train
@Override public void onEnd(boolean result, BaseSliderView target) { if(target.isErrorDisappear() == false || result == true){ return; } for (BaseSliderView slider: mImageContents){ if(slider.equals(target)){ removeSlider(target); break...
java
{ "resource": "" }
q25363
DescriptionAnimation.onPrepareNextItemShowInScreen
train
@Override public void onPrepareNextItemShowInScreen(View next) { View descriptionLayout = next.findViewById(R.id.description_layout); if(descriptionLayout!=null){ next.findViewById(R.id.description_layout).setVisibility(View.INVISIBLE); } }
java
{ "resource": "" }
q25364
DescriptionAnimation.onNextItemAppear
train
@Override public void onNextItemAppear(View view) { View descriptionLayout = view.findViewById(R.id.description_layout); if(descriptionLayout!=null){ float layoutY = ViewHelper.getY(descriptionLayout); view.findViewById(R.id.description_layout).setVisibility(View.VISIBLE); ...
java
{ "resource": "" }
q25365
PagerIndicator.setDefaultIndicatorShape
train
public void setDefaultIndicatorShape(Shape shape){ if(mUserSetSelectedIndicatorResId == 0){ if(shape == Shape.Oval){ mSelectedGradientDrawable.setShape(GradientDrawable.OVAL); }else{ mSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE); ...
java
{ "resource": "" }
q25366
PagerIndicator.setIndicatorStyleResource
train
public void setIndicatorStyleResource(int selected, int unselected){ mUserSetSelectedIndicatorResId = selected; mUserSetUnSelectedIndicatorResId = unselected; if(selected == 0){ mSelectedDrawable = mSelectedLayerDrawable; }else{ mSelectedDrawable = mContext.getRes...
java
{ "resource": "" }
q25367
PagerIndicator.setDefaultIndicatorColor
train
public void setDefaultIndicatorColor(int selectedColor,int unselectedColor){ if(mUserSetSelectedIndicatorResId == 0){ mSelectedGradientDrawable.setColor(selectedColor); } if(mUserSetUnSelectedIndicatorResId == 0){ mUnSelectedGradientDrawable.setColor(unselectedColor); ...
java
{ "resource": "" }
q25368
PagerIndicator.setIndicatorVisibility
train
public void setIndicatorVisibility(IndicatorVisibility visibility){ if(visibility == IndicatorVisibility.Visible){ setVisibility(View.VISIBLE); }else{ setVisibility(View.INVISIBLE); } resetDrawable(); }
java
{ "resource": "" }
q25369
PagerIndicator.setViewPager
train
public void setViewPager(ViewPagerEx pager){ if(pager.getAdapter() == null){ throw new IllegalStateException("Viewpager does not have adapter instance"); } mPager = pager; mPager.addOnPageChangeListener(this); ((InfinitePagerAdapter)mPager.getAdapter()).getRealAdapter...
java
{ "resource": "" }
q25370
PagerIndicator.redraw
train
public void redraw(){ mItemCount = getShouldDrawCount(); mPreviousSelectedIndicator = null; for(View i:mIndicators){ removeView(i); } for(int i =0 ;i< mItemCount; i++){ ImageView indicator = new ImageView(mContext); indicator.setImageDrawable...
java
{ "resource": "" }
q25371
PagerIndicator.getShouldDrawCount
train
private int getShouldDrawCount(){ if(mPager.getAdapter() instanceof InfinitePagerAdapter){ return ((InfinitePagerAdapter)mPager.getAdapter()).getRealCount(); }else{ return mPager.getAdapter().getCount(); } }
java
{ "resource": "" }
q25372
BaseSliderView.image
train
public BaseSliderView image(String url){ if(mFile != null || mRes != 0){ throw new IllegalStateException("Call multi image function," + "you only have permission to call it once"); } mUrl = url; return this; }
java
{ "resource": "" }
q25373
BaseSliderView.image
train
public BaseSliderView image(File file){ if(mUrl != null || mRes != 0){ throw new IllegalStateException("Call multi image function," + "you only have permission to call it once"); } mFile = file; return this; }
java
{ "resource": "" }
q25374
PartialUniqueIndex.remove
train
public Object remove(Object key) { Object underlying = this.underlyingObjectGetter.getUnderlyingObject(key); return removeUsingUnderlying(underlying); }
java
{ "resource": "" }
q25375
HashUtil.hash
train
public static final int hash(double d, boolean isNull) { if (isNull) return NULL_HASH; long longVal = Double.doubleToLongBits(d); return (int)(longVal ^ (longVal >>> 32)); }
java
{ "resource": "" }
q25376
AutoShutdownThreadExecutor.shutdown
train
public void shutdown() { while(true) { long cur = combinedState.get(); long newValue = cur | 0x8000000000000000L; if (combinedState.compareAndSet(cur, newValue)) { break; } } }
java
{ "resource": "" }
q25377
AutoShutdownThreadExecutor.shutdownAndWaitUntilDone
train
public void shutdownAndWaitUntilDone() { shutdown(); while(true) { synchronized (endSignal) { try { if ((combinedState.get() & 0x7FFFFFFFFFFFFFFFL) == 0) break; endSignal.wait(100); ...
java
{ "resource": "" }
q25378
SyslogChecker.checkAndWaitForSyslogSynchronized
train
public synchronized void checkAndWaitForSyslogSynchronized(Object sourceAttribute, String schema, MithraDatabaseObject databaseObject) { long now = System.currentTimeMillis(); if (now > nextTimeToCheck) { this.checkAndWaitForSyslog(sourceAttribute, schema, databaseObject); ...
java
{ "resource": "" }
q25379
TopicResourcesWithTransactionXid.initializeTransactionXidRange
train
private ReladomoTxIdInterface initializeTransactionXidRange(String flowId, int xidId) { ReladomoTxIdInterface transactionXid = null; MithraTransactionalList list = null; try { DeserializationClassMetaData deserializationClassMetaData = new DeserializationClassMetaDa...
java
{ "resource": "" }
q25380
StringNotContainsOperation.matchesWithoutDeleteCheck
train
protected boolean matchesWithoutDeleteCheck(Object o, Extractor extractor) { String s = ((StringExtractor) extractor).stringValueOf(o); return s != null && s.indexOf(this.getParameter()) < 0; }
java
{ "resource": "" }
q25381
LinkedBlockingDeque.linkFirst
train
private boolean linkFirst(Node<E> node) { // assert lock.isHeldByCurrentThread(); if (count >= capacity) return false; Node<E> f = first; node.next = f; first = node; if (last == null) last = node; else f.prev = node; ...
java
{ "resource": "" }
q25382
LinkedBlockingDeque.linkLast
train
private boolean linkLast(Node<E> node) { // assert lock.isHeldByCurrentThread(); if (count >= capacity) return false; Node<E> l = last; node.prev = l; last = node; if (first == null) first = node; else l.next = node; ...
java
{ "resource": "" }
q25383
LinkedBlockingDeque.unlink
train
void unlink(Node<E> x) { // assert lock.isHeldByCurrentThread(); Node<E> p = x.prev; Node<E> n = x.next; if (p == null) { unlinkFirst(); } else if (n == null) { unlinkLast(); } else { p.next = n; n.prev = p; ...
java
{ "resource": "" }
q25384
TransactionLocalMap.getEntryAfterMiss
train
private Object getEntryAfterMiss(TransactionLocal key, int i, Entry e) { Entry[] tab = table; int len = tab.length; while (e != null) { if (e.key == key) return e.value; i = nextIndex(i, len); e = tab[i]; } ...
java
{ "resource": "" }
q25385
TransactionLocalMap.put
train
public void put(TransactionLocal key, Object value) { // We don't use a fast path as with get() because it is at // least as common to use set() to create new entries as // it is to replace existing ones, in which case, a fast // path would fail more often than not. ...
java
{ "resource": "" }
q25386
TransactionLocalMap.remove
train
public void remove(TransactionLocal key) { Entry[] tab = table; int len = tab.length; int i = key.hashCode & (len - 1); for (Entry e = tab[i]; e != null; e = tab[i = nextIndex(i, len)]) { if (e.key == key) { ...
java
{ "resource": "" }
q25387
TransactionLocalMap.expungeStaleEntry
train
private int expungeStaleEntry(int staleSlot) { Entry[] tab = table; int len = tab.length; // expunge entry at staleSlot tab[staleSlot].value = null; tab[staleSlot] = null; size--; // Rehash until we encounter null Entry e; int i; ...
java
{ "resource": "" }
q25388
TransactionLocalMap.resize
train
private void resize() { Entry[] oldTab = table; int oldLen = oldTab.length; int newLen = oldLen * 2; Entry[] newTab = new Entry[newLen]; int count = 0; for (int j = 0; j < oldLen; ++j) { Entry e = oldTab[j]; if (e != null) ...
java
{ "resource": "" }
q25389
MithraTransactionalPortal.applyOperationAndCheck
train
private List applyOperationAndCheck(Operation op, MithraTransaction tx) { boolean oldEvaluationMode = tx.zIsInOperationEvaluationMode(); List resultList = null; try { tx.zSetOperationEvaluationMode(true); if (this.isPureHome() || (!this.isOperationParti...
java
{ "resource": "" }
q25390
CacheIndexBasedFilter.timestampToAsofAttributeRelationiship
train
private static boolean timestampToAsofAttributeRelationiship(Map.Entry<Attribute, Attribute> each) { return (each.getValue() != null && each.getValue().isAsOfAttribute()) && !each.getKey().isAsOfAttribute(); }
java
{ "resource": "" }
q25391
MithraBusinessException.ifRetriableWaitElseThrow
train
public int ifRetriableWaitElseThrow(String msg, int retriesLeft, Logger logger) { if (this.isRetriable() && --retriesLeft > 0) { logger.warn(msg+ " " + this.getMessage()); if (logger.isDebugEnabled()) { logger.debug("find failed with retriab...
java
{ "resource": "" }
q25392
H2ConnectionManager.prepareTables
train
public void prepareTables() throws Exception { Path ddlPath = Paths.get(ClassLoader.getSystemResource("sql").toURI()); try (Connection conn = xaConnectionManager.getConnection();) { Files.walk(ddlPath, 1) .filter(path -> !Files.isDirectory(path) ...
java
{ "resource": "" }
q25393
MergeOptions.doNotUpdate
train
public MergeOptions<E> doNotUpdate(Attribute... attributes) { if (this.doNotUpdate == null) { this.doNotUpdate = attributes; } else { List<Attribute> all = FastList.newListWith(this.doNotUpdate); for(Attribute a: attributes) all.add(a); ...
java
{ "resource": "" }
q25394
MithraObjectTypeWrapper.extractMithraInterfaces
train
private void extractMithraInterfaces(Map<String, MithraInterfaceType> mithraInterfaces, List<String> errors) { for (String mithraInterfaceType : this.getWrapped().getMithraInterfaces()) { MithraInterfaceType mithraInterfaceObject = mithraInterfaces.get(mithraInterfaceType); ...
java
{ "resource": "" }
q25395
MithraObjectGraphExtractor.addRelationshipFilter
train
public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter) { Operation existing = this.filters.get(relatedFinder); this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter)); }
java
{ "resource": "" }
q25396
MithraObjectGraphExtractor.extract
train
public void extract() { ExecutorService executor = Executors.newFixedThreadPool(this.extractorConfig.getThreadPoolSize()); try { Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> extract = extractData(executor); writeToFiles(executor, extract); }...
java
{ "resource": "" }
q25397
TransactionalSemiUniqueDatedIndex.getFromSemiUnique
train
public Object getFromSemiUnique(Object dataHolder, List extractors) { Object result = null; TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(MithraManagerProvider.getMithraManager().zGetCurrentTransactionWithNoCheck()); FullSemiUniqueDatedIndex perT...
java
{ "resource": "" }
q25398
Execute.execute
train
public int execute() throws IOException { Runtime runtime = Runtime.getRuntime(); int exitCode = -1; TerminateProcessThread terminateProcess = null; Process process = null; try { // Execute the command String[] command = (String[])...
java
{ "resource": "" }
q25399
FastUnsafeOffHeapDataStorage.scanPagesToSend
train
protected long scanPagesToSend(long maxClientReplicatedPageVersion, FastUnsafeOffHeapIntList pagesToSend) { long maxPageVersion = 0; boolean upgraded = false; for(int i=0;i<this.pageVersionList.size();i++) { if (pageVersionList.get(i) == 0 && !upgraded) ...
java
{ "resource": "" }