_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q166400 | InsertQueue.getActiveIndexes | validation | @NonNull
public Collection<Integer> getActiveIndexes() {
Collection<Integer> result = new HashSet<>();
for (AtomicInteger i : mActiveIndexes) {
result.add(i.get());
}
return result;
} | java | {
"resource": ""
} |
q166401 | ExpandableListItemAdapter.getTitleView | validation | @Nullable
public View getTitleView(final int position) {
View titleView = null;
View parentView = findViewForPosition(position);
if (parentView != null) {
Object tag = parentView.getTag();
if (tag instanceof ViewHolder) {
titleView = ((ViewHolder) tag).titleView;
}
}
return titleView;
} | java | {
"resource": ""
} |
q166402 | ExpandableListItemAdapter.getContentView | validation | @Nullable
public View getContentView(final int position) {
View contentView = null;
View parentView = findViewForPosition(position);
if (parentView != null) {
Object tag = parentView.getTag();
if (tag instanceof ViewHolder) {
contentView = ((ViewHolder) tag).contentView;
}
}
return contentView;
} | java | {
"resource": ""
} |
q166403 | ExpandableListItemAdapter.expand | validation | public void expand(final int position) {
long itemId = getItemId(position);
if (mExpandedIds.contains(itemId)) {
return;
}
toggle(position);
} | java | {
"resource": ""
} |
q166404 | ExpandableListItemAdapter.collapse | validation | public void collapse(final int position) {
long itemId = getItemId(position);
if (!mExpandedIds.contains(itemId)) {
return;
}
toggle(position);
} | java | {
"resource": ""
} |
q166405 | ExpandableListItemAdapter.getContentParent | validation | @Nullable
private View getContentParent(final int position) {
View contentParent = null;
View parentView = findViewForPosition(position);
if (parentView != null) {
Object tag = parentView.getTag();
if (tag instanceof ViewHolder) {
contentParent = ((ViewHolder) tag).contentParent;
}
}
return contentParent;
} | java | {
"resource": ""
} |
q166406 | AnimateAdditionAdapter.getAdditionalAnimators | validation | @SuppressWarnings({"MethodMayBeStatic", "UnusedParameters"})
@NonNull
protected Animator[] getAdditionalAnimators(@NonNull final View view, @NonNull final ViewGroup parent) {
return new Animator[]{};
} | java | {
"resource": ""
} |
q166407 | BitmapUtils.getBitmapFromView | validation | @NonNull
static Bitmap getBitmapFromView(@NonNull final View v) {
Bitmap bitmap = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
v.draw(canvas);
return bitmap;
} | java | {
"resource": ""
} |
q166408 | SwipeTouchListener.isDismissable | validation | private boolean isDismissable(final int position) {
if (mListViewWrapper.getAdapter() == null) {
return false;
}
if (mDismissableManager != null) {
long downId = mListViewWrapper.getAdapter().getItemId(position);
return mDismissableManager.isDismissable(downId, position);
}
return true;
} | java | {
"resource": ""
} |
q166409 | SwipeTouchListener.reset | validation | private void reset() {
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
}
mVelocityTracker = null;
mDownX = 0;
mDownY = 0;
mCurrentView = null;
mSwipingView = null;
mCurrentPosition = AdapterView.INVALID_POSITION;
mSwiping = false;
mCanDismissCurrent = false;
} | java | {
"resource": ""
} |
q166410 | ViewAnimator.reset | validation | public void reset() {
for (int i = 0; i < mAnimators.size(); i++) {
mAnimators.get(mAnimators.keyAt(i)).cancel();
}
mAnimators.clear();
mFirstAnimatedPosition = -1;
mLastAnimatedPosition = -1;
mAnimationStartMillis = -1;
mShouldAnimate = true;
} | java | {
"resource": ""
} |
q166411 | ViewAnimator.cancelExistingAnimation | validation | void cancelExistingAnimation(@NonNull final View view) {
int hashCode = view.hashCode();
Animator animator = mAnimators.get(hashCode);
if (animator != null) {
animator.end();
mAnimators.remove(hashCode);
}
} | java | {
"resource": ""
} |
q166412 | ViewAnimator.animateView | validation | private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) {
if (mAnimationStartMillis == -1) {
mAnimationStartMillis = SystemClock.uptimeMillis();
}
ViewHelper.setAlpha(view, 0);
AnimatorSet set = new AnimatorSet();
set.playTogether(animators);
set.setStartDelay(calculateAnimationDelay(position));
set.setDuration(mAnimationDurationMillis);
set.start();
mAnimators.put(view.hashCode(), set);
} | java | {
"resource": ""
} |
q166413 | ViewAnimator.calculateAnimationDelay | validation | @SuppressLint("NewApi")
private int calculateAnimationDelay(final int position) {
int delay;
int lastVisiblePosition = mListViewWrapper.getLastVisiblePosition();
int firstVisiblePosition = mListViewWrapper.getFirstVisiblePosition();
int numberOfItemsOnScreen = lastVisiblePosition - firstVisiblePosition;
int numberOfAnimatedItems = position - 1 - mFirstAnimatedPosition;
if (numberOfItemsOnScreen + 1 < numberOfAnimatedItems) {
delay = mAnimationDelayMillis;
if (mListViewWrapper.getListView() instanceof GridView && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
int numColumns = ((GridView) mListViewWrapper.getListView()).getNumColumns();
delay += mAnimationDelayMillis * (position % numColumns);
}
} else {
int delaySinceStart = (position - mFirstAnimatedPosition) * mAnimationDelayMillis;
delay = Math.max(0, (int) (-SystemClock.uptimeMillis() + mAnimationStartMillis + mInitialDelayMillis + delaySinceStart));
}
return delay;
} | java | {
"resource": ""
} |
q166414 | AnimatorUtil.concatAnimators | validation | @NonNull
public static Animator[] concatAnimators(@NonNull final Animator[] childAnimators, @NonNull final Animator[] animators, @NonNull final Animator alphaAnimator) {
Animator[] allAnimators = new Animator[childAnimators.length + animators.length + 1];
int i;
for (i = 0; i < childAnimators.length; ++i) {
allAnimators[i] = childAnimators[i];
}
for (Animator animator : animators) {
allAnimators[i] = animator;
++i;
}
allAnimators[allAnimators.length - 1] = alphaAnimator;
return allAnimators;
} | java | {
"resource": ""
} |
q166415 | CORSFilter.handleNonCORS | validation | public void handleNonCORS(final HttpServletRequest request,
final HttpServletResponse response, final FilterChain filterChain)
throws IOException, ServletException {
// Let request pass.
filterChain.doFilter(request, response);
} | java | {
"resource": ""
} |
q166416 | NonEmptyVirtualStorage.addStreamOfLiteralWords | validation | @Override
public void addStreamOfLiteralWords(Buffer buffer, int start, int number) {
for(int x = start; x < start + number ; ++x)
if(buffer.getWord(x)!=0) throw nonEmptyException;
} | java | {
"resource": ""
} |
q166417 | IteratorUtil.materialize | validation | public static void materialize(final IteratingRLW i,
final BitmapStorage c) {
while (true) {
if (i.getRunningLength() > 0) {
c.addStreamOfEmptyWords(i.getRunningBit(), i.getRunningLength());
}
int il = i.getNumberOfLiteralWords();
for (int k = 0; k < il ; ++k)
c.addWord(i.getLiteralWordAt(k));
if (!i.next())
break;
}
} | java | {
"resource": ""
} |
q166418 | PriorityQ.poll | validation | public T poll() {
T ans = this.a[1];
this.a[1] = this.a[this.lastIndex--];
percolateDown(1);
return ans;
} | java | {
"resource": ""
} |
q166419 | LongArray.resizeBuffer | validation | private void resizeBuffer(int number) {
int size = newSizeInWords(number);
if (size >= this.buffer.length) {
long oldBuffer[] = this.buffer;
this.buffer = new long[size];
System.arraycopy(oldBuffer, 0, this.buffer, 0, oldBuffer.length);
}
} | java | {
"resource": ""
} |
q166420 | LongArray.newSizeInWords | validation | private int newSizeInWords(int number) {
int size = this.actualSizeInWords + number;
if (size >= this.buffer.length) {
if (size < 32768)
size = size * 2;
else if (size * 3 / 2 < size) // overflow
size = Integer.MAX_VALUE;
else
size = size * 3 / 2;
}
return size;
} | java | {
"resource": ""
} |
q166421 | FastAggregation32.xor | validation | public static EWAHCompressedBitmap32 xor(final EWAHCompressedBitmap32... bitmaps) {
PriorityQueue<EWAHCompressedBitmap32> pq = new PriorityQueue<EWAHCompressedBitmap32>(bitmaps.length,
new Comparator<EWAHCompressedBitmap32>() {
@Override
public int compare(EWAHCompressedBitmap32 a, EWAHCompressedBitmap32 b) {
return a.sizeInBytes()
- b.sizeInBytes();
}
}
);
Collections.addAll(pq, bitmaps);
if(pq.isEmpty()) return new EWAHCompressedBitmap32();
while (pq.size() > 1) {
EWAHCompressedBitmap32 x1 = pq.poll();
EWAHCompressedBitmap32 x2 = pq.poll();
pq.add(x1.xor(x2));
}
return pq.poll();
} | java | {
"resource": ""
} |
q166422 | BitCounter32.addStreamOfLiteralWords | validation | @Override
public void addStreamOfLiteralWords(Buffer32 buffer, int start, int number) {
for (int i = start; i < start + number; i++) {
addLiteralWord(buffer.getWord(i));
}
} | java | {
"resource": ""
} |
q166423 | UpdateableBitmapFunction32.fillWithLiterals | validation | public final void fillWithLiterals(final List<EWAHPointer32> container) {
for (int k = this.litwlist.nextSetBit(0); k >= 0; k = this.litwlist
.nextSetBit(k + 1)) {
container.add(this.rw[k]);
}
} | java | {
"resource": ""
} |
q166424 | ImmutableBitSet.asBitSet | validation | public BitSet asBitSet() {
BitSet bs = new BitSet(this.size());
this.data.rewind();
this.data.get(bs.data, 0, bs.data.length);
return bs;
} | java | {
"resource": ""
} |
q166425 | ImmutableBitSet.cardinality | validation | public int cardinality() {
int sum = 0;
int length = this.data.limit();
for(int k = 0; k < length; ++k)
sum += Long.bitCount(this.data.get(k));
return sum;
} | java | {
"resource": ""
} |
q166426 | ImmutableBitSet.empty | validation | public boolean empty() {
int length = this.data.limit();
for(int k = 0; k < length; ++k)
if (this.data.get(k) != 0) return false;
return true;
} | java | {
"resource": ""
} |
q166427 | ImmutableBitSet.intIterator | validation | public IntIterator intIterator() {
return new IntIterator() {
@Override
public boolean hasNext() {
return this.i >= 0;
}
@Override
public int next() {
this.j = this.i;
this.i = ImmutableBitSet.this.nextSetBit(this.i + 1);
return this.j;
}
private int i = ImmutableBitSet.this.nextSetBit(0);
private int j;
};
} | java | {
"resource": ""
} |
q166428 | ImmutableBitSet.intersects | validation | public boolean intersects(BitSet bs) {
for (int k = 0; k < Math.min(this.data.limit(), bs.data.length); ++k) {
if ((this.data.get(k) & bs.data[k]) != 0) return true;
}
return false;
} | java | {
"resource": ""
} |
q166429 | ImmutableBitSet.unsetIntIterator | validation | public IntIterator unsetIntIterator() {
return new IntIterator() {
@Override
public boolean hasNext() {
return this.i >= 0;
}
@Override
public int next() {
this.j = this.i;
this.i = ImmutableBitSet.this.nextUnsetBit(this.i + 1);
return this.j;
}
private int i = ImmutableBitSet.this.nextUnsetBit(0);
private int j;
};
} | java | {
"resource": ""
} |
q166430 | EWAHPointer32.parseNextRun | validation | public void parseNextRun() {
if ((this.isLiteral)
|| (this.iterator.getNumberOfLiteralWords() == 0)) {
// no choice, must load next runs
this.iterator.discardFirstWords(this.iterator.size());
if (this.iterator.getRunningLength() > 0) {
this.endrun += this.iterator
.getRunningLength();
this.isLiteral = false;
this.value = this.iterator.getRunningBit();
} else if (this.iterator.getNumberOfLiteralWords() > 0) {
this.isLiteral = true;
this.endrun += this.iterator
.getNumberOfLiteralWords();
} else {
this.dead = true;
}
} else {
this.isLiteral = true;
this.endrun += this.iterator.getNumberOfLiteralWords();
}
} | java | {
"resource": ""
} |
q166431 | TapBarMenu.open | validation | public void open() {
state = State.OPENED;
showIcons(true);
animator[LEFT].setFloatValues(button[LEFT], 0);
animator[RIGHT].setFloatValues(button[RIGHT], width);
animator[RADIUS].setFloatValues(button[RADIUS], 0);
animator[TOP].setFloatValues(button[TOP], 0);
animator[BOTTOM].setFloatValues(button[BOTTOM], height);
animatorSet.cancel();
animatorSet.start();
if (iconOpenedDrawable instanceof Animatable) {
((Animatable) iconOpenedDrawable).start();
}
ViewGroup parentView = (ViewGroup) TapBarMenu.this.getParent();
this.animate()
.y(menuAnchor == MENU_ANCHOR_BOTTOM ? parentView.getBottom() - height : 0)
.setDuration(animationDuration)
.setInterpolator(DECELERATE_INTERPOLATOR)
.start();
} | java | {
"resource": ""
} |
q166432 | TapBarMenu.close | validation | public void close() {
updateDimensions(width, height);
state = State.CLOSED;
showIcons(false);
animator[LEFT].setFloatValues(0, button[LEFT]);
animator[RIGHT].setFloatValues(width, button[RIGHT]);
animator[RADIUS].setFloatValues(0, button[RADIUS]);
animator[TOP].setFloatValues(0, button[TOP]);
animator[BOTTOM].setFloatValues(height, button[BOTTOM]);
animatorSet.cancel();
animatorSet.start();
if (iconClosedDrawable instanceof Animatable) {
((Animatable) iconClosedDrawable).start();
}
this.animate()
.y(yPosition)
.setDuration(animationDuration)
.setInterpolator(DECELERATE_INTERPOLATOR)
.start();
} | java | {
"resource": ""
} |
q166433 | TapBarMenu.setMenuBackgroundColor | validation | public void setMenuBackgroundColor(int colorResId) {
backgroundColor = ContextCompat.getColor(getContext(), colorResId);
paint.setColor(backgroundColor);
invalidate();
} | java | {
"resource": ""
} |
q166434 | H2URLParser.fetchDatabaseNameRangeIndexFromURLForH2FileMode | validation | private int[] fetchDatabaseNameRangeIndexFromURLForH2FileMode(String url) {
int fileLabelIndex = url.indexOf(FILE_MODE_FLAG);
int parameterLabelIndex = url.indexOf(";", fileLabelIndex);
if (parameterLabelIndex == -1) {
parameterLabelIndex = url.length();
}
if (fileLabelIndex != -1) {
return new int[]{fileLabelIndex + FILE_MODE_FLAG.length() + 1, parameterLabelIndex};
} else {
return null;
}
} | java | {
"resource": ""
} |
q166435 | H2URLParser.fetchDatabaseNameRangeIndexFromURLForH2MemMode | validation | private int[] fetchDatabaseNameRangeIndexFromURLForH2MemMode(String url) {
int fileLabelIndex = url.indexOf(MEMORY_MODE_FLAG);
int parameterLabelIndex = url.indexOf(";", fileLabelIndex);
if (parameterLabelIndex == -1) {
parameterLabelIndex = url.length();
}
if (fileLabelIndex != -1) {
return new int[]{fileLabelIndex + MEMORY_MODE_FLAG.length() + 1, parameterLabelIndex};
} else {
return null;
}
} | java | {
"resource": ""
} |
q166436 | URLParser.parser | validation | public static ConnectionInfo parser(String url) {
if (null == url) {
return ConnectionInfo.UNKNOWN_CONNECTION_INFO;
}
String lowerCaseUrl = url.toLowerCase();
ConnectionURLParser parser = findURLParser(lowerCaseUrl);
if (parser == null) {
return ConnectionInfo.UNKNOWN_CONNECTION_INFO;
}
try {
return parser.parse(url);
} catch (Exception e) {
log.log(Level.WARNING, "error occurs when paring jdbc url");
}
return ConnectionInfo.UNKNOWN_CONNECTION_INFO;
} | java | {
"resource": ""
} |
q166437 | URLParser.registerConnectionParser | validation | public static void registerConnectionParser(String urlPrefix, ConnectionURLParser parser) {
if (null == urlPrefix || parser == null) {
throw new IllegalArgumentException("urlPrefix and parser can not be null");
}
parserRegister.put(urlPrefix.toLowerCase(), parser);
} | java | {
"resource": ""
} |
q166438 | AbstractURLParser.fetchDatabaseNameFromURL | validation | protected String fetchDatabaseNameFromURL(String url) {
URLLocation hostsLocation = fetchDatabaseNameIndexRange(url);
return url.substring(hostsLocation.startIndex(), hostsLocation.endIndex());
} | java | {
"resource": ""
} |
q166439 | Daemon.run | validation | public static void run(final Context context, final Class<?> daemonServiceClazz,
final int interval) {
new Thread(new Runnable() {
@Override
public void run() {
Command.install(context, BIN_DIR_NAME, DAEMON_BIN_NAME);
start(context, daemonServiceClazz, interval);
}
}).start();
} | java | {
"resource": ""
} |
q166440 | Command.copyFile | validation | private static void copyFile(File file, InputStream is, String mode)
throws IOException, InterruptedException {
final String abspath = file.getAbsolutePath();
final FileOutputStream out = new FileOutputStream(file);
byte buf[] = new byte[1024];
int len;
while ((len = is.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
is.close();
Runtime.getRuntime().exec("chmod " + mode + " " + abspath).waitFor();
} | java | {
"resource": ""
} |
q166441 | Command.copyAssets | validation | public static void copyAssets(Context context, String assetsFilename, File file, String mode)
throws IOException, InterruptedException {
AssetManager manager = context.getAssets();
final InputStream is = manager.open(assetsFilename);
copyFile(file, is, mode);
} | java | {
"resource": ""
} |
q166442 | Command.install | validation | @SuppressWarnings("deprecation")
public static boolean install(Context context, String destDir, String filename) {
String binaryDir = "armeabi";
String abi = Build.CPU_ABI;
if (abi.startsWith("armeabi-v7a")) {
binaryDir = "armeabi-v7a";
} else if (abi.startsWith("x86")) {
binaryDir = "x86";
}
/* for different platform */
String assetfilename = binaryDir + File.separator + filename;
try {
File f = new File(context.getDir(destDir, Context.MODE_PRIVATE), filename);
if (f.exists()) {
Log.d(TAG, "binary has existed");
return false;
}
copyAssets(context, assetfilename, f, "0755");
return true;
} catch (Exception e) {
Log.e(TAG, "installBinary failed: " + e.getMessage());
return false;
}
} | java | {
"resource": ""
} |
q166443 | Resolver.handleMissingFields | validation | private void handleMissingFields()
{
MissingFieldHandler missingFieldHandler = reader.getMissingFieldHandler();
if (missingFieldHandler != null)
{
for (Missingfields mf : missingFields)
{
missingFieldHandler.fieldMissing(mf.target, mf.fieldName, mf.value);
}
}//else no handler so ignore.
} | java | {
"resource": ""
} |
q166444 | Resolver.getEnum | validation | private Object getEnum(Class c, JsonObject jsonObj)
{
try
{
return Enum.valueOf(c, (String) jsonObj.get("name"));
}
catch (Exception e)
{ // In case the enum class has it's own 'name' member variable (shadowing the 'name' variable on Enum)
return Enum.valueOf(c, (String) jsonObj.get("java.lang.Enum.name"));
}
} | java | {
"resource": ""
} |
q166445 | Resolver.patchUnresolvedReferences | validation | protected void patchUnresolvedReferences()
{
Iterator i = unresolvedRefs.iterator();
while (i.hasNext())
{
UnresolvedReference ref = (UnresolvedReference) i.next();
Object objToFix = ref.referencingObj.target;
JsonObject objReferenced = reader.getObjectsRead().get(ref.refId);
if (ref.index >= 0)
{ // Fix []'s and Collections containing a forward reference.
if (objToFix instanceof List)
{ // Patch up Indexable Collections
List list = (List) objToFix;
list.set(ref.index, objReferenced.target);
}
else if (objToFix instanceof Collection)
{ // Add element (since it was not indexable, add it to collection)
Collection col = (Collection) objToFix;
col.add(objReferenced.target);
}
else
{
Array.set(objToFix, ref.index, objReferenced.target); // patch array element here
}
}
else
{ // Fix field forward reference
Field field = MetaUtils.getField(objToFix.getClass(), ref.field);
if (field != null)
{
try
{
field.set(objToFix, objReferenced.target); // patch field here
}
catch (Exception e)
{
throw new JsonIoException("Error setting field while resolving references '" + field.getName() + "', @ref = " + ref.refId, e);
}
}
}
i.remove();
}
} | java | {
"resource": ""
} |
q166446 | MapResolver.traverseFields | validation | public void traverseFields(final Deque<JsonObject<String, Object>> stack, final JsonObject<String, Object> jsonObj)
{
final Object target = jsonObj.target;
for (Map.Entry<String, Object> e : jsonObj.entrySet())
{
final String fieldName = e.getKey();
final Field field = (target != null) ? MetaUtils.getField(target.getClass(), fieldName) : null;
final Object rhs = e.getValue();
if (rhs == null)
{
jsonObj.put(fieldName, null);
}
else if (rhs == JsonParser.EMPTY_OBJECT)
{
jsonObj.put(fieldName, new JsonObject());
}
else if (rhs.getClass().isArray())
{ // RHS is an array
// Trace the contents of the array (so references inside the array and into the array work)
JsonObject<String, Object> jsonArray = new JsonObject<String, Object>();
jsonArray.put("@items", rhs);
stack.addFirst(jsonArray);
// Assign the array directly to the Map key (field name)
jsonObj.put(fieldName, rhs);
}
else if (rhs instanceof JsonObject)
{
JsonObject<String, Object> jObj = (JsonObject) rhs;
if (field != null && MetaUtils.isLogicalPrimitive(field.getType()))
{
jObj.put("value", MetaUtils.convert(field.getType(), jObj.get("value")));
continue;
}
Long refId = jObj.getReferenceId();
if (refId != null)
{ // Correct field references
JsonObject refObject = getReferencedObj(refId);
jsonObj.put(fieldName, refObject); // Update Map-of-Maps reference
}
else
{
stack.addFirst(jObj);
}
}
else if (field != null)
{ // The code below is 'upgrading' the RHS values in the passed in JsonObject Map
// by using the @type class name (when specified and exists), to coerce the vanilla
// JSON values into the proper types defined by the class listed in @type. This is
// a cool feature of json-io, that even when reading a map-of-maps JSON file, it will
// improve the final types of values in the maps RHS, to be of the field type that
// was optionally specified in @type.
final Class fieldType = field.getType();
if (MetaUtils.isPrimitive(fieldType) || BigDecimal.class.equals(fieldType) || BigInteger.class.equals(fieldType) || Date.class.equals(fieldType))
{
jsonObj.put(fieldName, MetaUtils.convert(fieldType, rhs));
}
else if (rhs instanceof String)
{
if (fieldType != String.class && fieldType != StringBuilder.class && fieldType != StringBuffer.class)
{
if ("".equals(((String)rhs).trim()))
{ // Allow "" to null out a non-String field on the inbound JSON
jsonObj.put(fieldName, null);
}
}
}
}
}
jsonObj.target = null; // don't waste space (used for typed return, not for Map return)
} | java | {
"resource": ""
} |
q166447 | JsonReader.jsonToJava | validation | public static Object jsonToJava(String json, Map<String, Object> optionalArgs)
{
if (optionalArgs == null)
{
optionalArgs = new HashMap<String, Object>();
optionalArgs.put(USE_MAPS, false);
}
if (!optionalArgs.containsKey(USE_MAPS))
{
optionalArgs.put(USE_MAPS, false);
}
JsonReader jr = new JsonReader(json, optionalArgs);
Object obj = jr.readObject();
jr.close();
return obj;
} | java | {
"resource": ""
} |
q166448 | JsonReader.jsonObjectsToJava | validation | public Object jsonObjectsToJava(JsonObject root)
{
getArgs().put(USE_MAPS, false);
return convertParsedMapsToJava(root);
} | java | {
"resource": ""
} |
q166449 | ObjectResolver.traverseFields | validation | public void traverseFields(final Deque<JsonObject<String, Object>> stack, final JsonObject<String, Object> jsonObj)
{
final Object javaMate = jsonObj.target;
final Iterator<Map.Entry<String, Object>> i = jsonObj.entrySet().iterator();
final Class cls = javaMate.getClass();
while (i.hasNext())
{
Map.Entry<String, Object> e = i.next();
String key = e.getKey();
final Field field = MetaUtils.getField(cls, key);
Object rhs = e.getValue();
if (field != null)
{
assignField(stack, jsonObj, field, rhs);
}
else if (missingFieldHandler != null)
{
handleMissingField(stack, jsonObj, rhs, key);
}//else no handler so ignor.
}
} | java | {
"resource": ""
} |
q166450 | ObjectResolver.storeMissingField | validation | private void storeMissingField(Object target, String missingField, Object value)
{
missingFields.add(new Missingfields(target, missingField, value));
} | java | {
"resource": ""
} |
q166451 | ObjectResolver.getRawType | validation | public static Class getRawType(final Type t)
{
if (t instanceof ParameterizedType)
{
ParameterizedType pType = (ParameterizedType) t;
if (pType.getRawType() instanceof Class)
{
return (Class) pType.getRawType();
}
}
return null;
} | java | {
"resource": ""
} |
q166452 | JsonParser.readArray | validation | private Object readArray(JsonObject object) throws IOException
{
final List<Object> array = new ArrayList();
while (true)
{
final Object o = readValue(object);
if (o != EMPTY_ARRAY)
{
array.add(o);
}
final int c = skipWhitespaceRead();
if (c == ']')
{
break;
}
else if (c != ',')
{
error("Expected ',' or ']' inside array");
}
}
return array.toArray();
} | java | {
"resource": ""
} |
q166453 | JsonParser.readNumber | validation | private Number readNumber(int c) throws IOException
{
final FastPushbackReader in = input;
final StringBuilder number = numBuf;
number.setLength(0);
number.appendCodePoint(c);
boolean isFloat = false;
if (JsonReader.isLenient() && (c == '-' || c == 'N' || c == 'I') ) {
// Handle negativity.
final boolean isNeg = (c == '-');
if (isNeg) {
// Advance to next character.
c = input.read();
}
// Case "-Infinity", "Infinity" or "NaN".
if (c == 'I') {
// [Out of RFC 4627] accept NaN/Infinity values
readToken("infinity");
return (isNeg) ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
} else if ('N' == c) {
// [Out of RFC 4627] accept NaN/Infinity values
readToken("nan");
return Double.NaN;
} else {
// Case this is a number but not "-Infinity", like "-2". We let the normal code process.
input.unread('-');
}
}
while (true)
{
c = in.read();
if ((c >= '0' && c <= '9') || c == '-' || c == '+')
{
number.appendCodePoint(c);
}
else if (c == '.' || c == 'e' || c == 'E')
{
number.appendCodePoint(c);
isFloat = true;
}
else if (c == -1)
{
break;
}
else
{
in.unread(c);
break;
}
}
try
{
if (isFloat)
{ // Floating point number needed
return Double.parseDouble(number.toString());
}
else
{
return Long.parseLong(number.toString());
}
}
catch (Exception e)
{
return (Number) error("Invalid number: " + number, e);
}
} | java | {
"resource": ""
} |
q166454 | JsonParser.readString | validation | private String readString() throws IOException
{
final StringBuilder str = strBuf;
final StringBuilder hex = hexBuf;
str.setLength(0);
int state = STRING_START;
final FastPushbackReader in = input;
while (true)
{
final int c = in.read();
if (c == -1)
{
error("EOF reached while reading JSON string");
}
if (state == STRING_START)
{
if (c == '"')
{
break;
}
else if (c == '\\')
{
state = STRING_SLASH;
}
else
{
str.appendCodePoint(c);
}
}
else if (state == STRING_SLASH)
{
switch(c)
{
case '\\':
str.appendCodePoint('\\');
break;
case '/':
str.appendCodePoint('/');
break;
case '"':
str.appendCodePoint('"');
break;
case '\'':
str.appendCodePoint('\'');
break;
case 'b':
str.appendCodePoint('\b');
break;
case 'f':
str.appendCodePoint('\f');
break;
case 'n':
str.appendCodePoint('\n');
break;
case 'r':
str.appendCodePoint('\r');
break;
case 't':
str.appendCodePoint('\t');
break;
case 'u':
hex.setLength(0);
state = HEX_DIGITS;
break;
default:
error("Invalid character escape sequence specified: " + c);
}
if (c != 'u')
{
state = STRING_START;
}
}
else
{
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
{
hex.appendCodePoint((char) c);
if (hex.length() == 4)
{
int value = Integer.parseInt(hex.toString(), 16);
str.appendCodePoint(value);
state = STRING_START;
}
}
else
{
error("Expected hexadecimal digits");
}
}
}
final String s = str.toString();
final String translate = stringCache.get(s);
return translate == null ? s : translate;
} | java | {
"resource": ""
} |
q166455 | MetaUtils.getField | validation | public static Field getField(Class c, String field)
{
return getDeepDeclaredFields(c).get(field);
} | java | {
"resource": ""
} |
q166456 | MetaUtils.removeLeadingAndTrailingQuotes | validation | static String removeLeadingAndTrailingQuotes(String s)
{
Matcher m = extraQuotes.matcher(s);
if (m.find())
{
s = m.group(2);
}
return s;
} | java | {
"resource": ""
} |
q166457 | JsonWriter.objectToJson | validation | public static String objectToJson(Object item, Map<String, Object> optionalArgs)
{
try
{
ByteArrayOutputStream stream = new ByteArrayOutputStream();
JsonWriter writer = new JsonWriter(stream, optionalArgs);
writer.write(item);
writer.close();
return new String(stream.toByteArray(), "UTF-8");
}
catch (Exception e)
{
throw new JsonIoException("Unable to convert object to JSON", e);
}
} | java | {
"resource": ""
} |
q166458 | JsonWriter.formatJson | validation | public static String formatJson(String json, Map readingArgs, Map writingArgs)
{
Map args = new HashMap();
if (readingArgs != null)
{
args.putAll(readingArgs);
}
args.put(JsonReader.USE_MAPS, true);
Object obj = JsonReader.jsonToJava(json, args);
args.clear();
if (writingArgs != null)
{
args.putAll(writingArgs);
}
args.put(PRETTY_PRINT, true);
return objectToJson(obj, args);
} | java | {
"resource": ""
} |
q166459 | JsonWriter.tab | validation | private void tab(Writer output, int delta) throws IOException
{
if (!isPrettyPrint)
{
return;
}
output.write(NEW_LINE);
depth += delta;
for (int i=0; i < depth; i++)
{
output.write(" ");
}
} | java | {
"resource": ""
} |
q166460 | JsonWriter.writeArrayElementIfMatching | validation | public boolean writeArrayElementIfMatching(Class arrayComponentClass, Object o, boolean showType, Writer output)
{
if (!o.getClass().isAssignableFrom(arrayComponentClass) || notCustom.contains(o.getClass()))
{
return false;
}
try
{
return writeCustom(arrayComponentClass, o, showType, output);
}
catch (IOException e)
{
throw new JsonIoException("Unable to write custom formatted object as array element:", e);
}
} | java | {
"resource": ""
} |
q166461 | JsonWriter.writeCustom | validation | protected boolean writeCustom(Class arrayComponentClass, Object o, boolean showType, Writer output) throws IOException
{
if (neverShowType)
{
showType = false;
}
JsonClassWriterBase closestWriter = getCustomWriter(arrayComponentClass);
if (closestWriter == null)
{
return false;
}
if (writeOptionalReference(o))
{
return true;
}
boolean referenced = objsReferenced.containsKey(o);
if (closestWriter instanceof JsonClassWriter)
{
JsonClassWriter writer = (JsonClassWriter) closestWriter;
if (writer.hasPrimitiveForm())
{
if ((!referenced && !showType) || closestWriter instanceof Writers.JsonStringWriter)
{
if (writer instanceof Writers.DateWriter)
{
((Writers.DateWriter)writer).writePrimitiveForm(o, output, args);
}
else
{
writer.writePrimitiveForm(o, output);
}
return true;
}
}
}
output.write('{');
tabIn();
if (referenced)
{
writeId(getId(o));
if (showType)
{
output.write(',');
newLine();
}
}
if (showType)
{
writeType(o, output);
}
if (referenced || showType)
{
output.write(',');
newLine();
}
if (closestWriter instanceof JsonClassWriterEx)
{
((JsonClassWriterEx)closestWriter).write(o, showType || referenced, output, args);
}
else
{
((JsonClassWriter)closestWriter).write(o, showType || referenced, output);
}
tabOut();
output.write('}');
return true;
} | java | {
"resource": ""
} |
q166462 | JsonWriter.forceGetCustomWriter | validation | private JsonClassWriterBase forceGetCustomWriter(Class c)
{
JsonClassWriterBase closestWriter = nullWriter;
int minDistance = Integer.MAX_VALUE;
for (Map.Entry<Class, JsonClassWriterBase> entry : writers.entrySet())
{
Class clz = entry.getKey();
if (clz == c)
{
return entry.getValue();
}
int distance = MetaUtils.getDistance(clz, c);
if (distance < minDistance)
{
minDistance = distance;
closestWriter = entry.getValue();
}
}
return closestWriter;
} | java | {
"resource": ""
} |
q166463 | JsonWriter.write | validation | public void write(Object obj)
{
traceReferences(obj);
objVisited.clear();
try
{
writeImpl(obj, true);
}
catch (Exception e)
{
throw new JsonIoException("Error writing object to JSON:", e);
}
flush();
objVisited.clear();
objsReferenced.clear();
} | java | {
"resource": ""
} |
q166464 | JsonWriter.traceReferences | validation | protected void traceReferences(Object root)
{
if (root == null)
{
return;
}
Map<Class, List<Field>> fieldSpecifiers = (Map) args.get(FIELD_SPECIFIERS);
final Deque<Object> stack = new ArrayDeque<Object>();
stack.addFirst(root);
final Map<Object, Long> visited = objVisited;
final Map<Object, Long> referenced = objsReferenced;
while (!stack.isEmpty())
{
final Object obj = stack.removeFirst();
if (!MetaUtils.isLogicalPrimitive(obj.getClass()))
{
Long id = visited.get(obj);
if (id != null)
{ // Only write an object once.
if (id == ZERO)
{ // 2nd time this object has been seen, so give it a unique ID and mark it referenced
id = identity++;
visited.put(obj, id);
referenced.put(obj, id);
}
continue;
}
else
{ // Initially, mark an object with 0 as the ID, in case it is never referenced,
// we don't waste the memory to store a Long instance that is never used.
visited.put(obj, ZERO);
}
}
final Class clazz = obj.getClass();
if (clazz.isArray())
{
if (!MetaUtils.isLogicalPrimitive(clazz.getComponentType()))
{ // Speed up: do not traceReferences of primitives, they cannot reference anything
final int len = Array.getLength(obj);
for (int i = 0; i < len; i++)
{
final Object o = Array.get(obj, i);
if (o != null)
{ // Slight perf gain (null is legal)
stack.addFirst(o);
}
}
}
}
else if (Map.class.isAssignableFrom(clazz))
{ // Speed up - logically walk maps, as opposed to following their internal structure.
Map map = (Map) obj;
for (final Object item : map.entrySet())
{
final Map.Entry entry = (Map.Entry) item;
if (entry.getValue() != null)
{
stack.addFirst(entry.getValue());
}
if (entry.getKey() != null)
{
stack.addFirst(entry.getKey());
}
}
}
else if (Collection.class.isAssignableFrom(clazz))
{
for (final Object item : (Collection)obj)
{
if (item != null)
{
stack.addFirst(item);
}
}
}
else
{ // Speed up: do not traceReferences of primitives, they cannot reference anything
if (!MetaUtils.isLogicalPrimitive(obj.getClass()))
{
traceFields(stack, obj, fieldSpecifiers);
}
}
}
} | java | {
"resource": ""
} |
q166465 | JsonWriter.traceFields | validation | protected void traceFields(final Deque<Object> stack, final Object obj, final Map<Class, List<Field>> fieldSpecifiers)
{
// If caller has special Field specifier for a given class
// then use it, otherwise use reflection.
Collection<Field> fields = getFieldsUsingSpecifier(obj.getClass(), fieldSpecifiers);
Collection<Field> fieldsBySpec = fields;
if (fields == null)
{ // Trace fields using reflection
fields = MetaUtils.getDeepDeclaredFields(obj.getClass()).values();
}
for (final Field field : fields)
{
if ((field.getModifiers() & Modifier.TRANSIENT) != 0)
{
if (fieldsBySpec == null || !fieldsBySpec.contains(field))
{ // Skip tracing transient fields EXCEPT when the field is listed explicitly by using the fieldSpecifiers Map.
// In that case, the field must be traced, even though it is transient.
continue;
}
}
try
{
final Object o = field.get(obj);
if (o != null && !MetaUtils.isLogicalPrimitive(o.getClass()))
{ // Trace through objects that can reference other objects
stack.addFirst(o);
}
}
catch (Exception ignored) { }
}
} | java | {
"resource": ""
} |
q166466 | JsonWriter.ensureJsonPrimitiveKeys | validation | public static boolean ensureJsonPrimitiveKeys(Map map)
{
for (Object o : map.keySet())
{
if (!(o instanceof String))
{
return false;
}
}
return true;
} | java | {
"resource": ""
} |
q166467 | JsonWriter.writeCollectionElement | validation | private void writeCollectionElement(Object o) throws IOException
{
if (o == null)
{
out.write("null");
}
else if (o instanceof Boolean || o instanceof Double)
{
writePrimitive(o, false);
}
else if (o instanceof Long)
{
writePrimitive(o, writeLongsAsStrings);
}
else if (o instanceof String)
{ // Never do an @ref to a String (they are treated as logical primitives and intern'ed on read)
writeJsonUtf8String((String) o, out);
}
else if (neverShowType && MetaUtils.isPrimitive(o.getClass()))
{ // If neverShowType, then force primitives (and primitive wrappers)
// to be output with toString() - prevents {"value":6} for example
writePrimitive(o, false);
}
else
{
writeImpl(o, true);
}
} | java | {
"resource": ""
} |
q166468 | WorldbankImportServiceImpl.createMapFromList | validation | private static Map<String, String> createMapFromList(final List<String> all) {
final Map<String, String> map = new ConcurrentHashMap<>();
for (final String documentElement : all) {
if (documentElement != null) {
map.put(documentElement, documentElement);
}
}
return map;
} | java | {
"resource": ""
} |
q166469 | IndicatorElement.getSource | validation | @Embedded
@AttributeOverrides({
@AttributeOverride(name = "value", column = @Column(name = "SOURCE_VALUE")),
@AttributeOverride(name = "id", column = @Column(name = "SOURCE_ID"))
})
public Source getSource() {
return source;
} | java | {
"resource": ""
} |
q166470 | IndicatorElement.getTopics | validation | @ManyToOne(targetEntity = Topics.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "TOPICS_INDICATOR_ELEMENT_HJID")
public Topics getTopics() {
return topics;
} | java | {
"resource": ""
} |
q166471 | IndicatorElement.getHjid | validation | @Id
@Column(name = "HJID")
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getHjid() {
return hjid;
} | java | {
"resource": ""
} |
q166472 | DocumentDetailContainer.getDocumentDetailList | validation | @OneToMany(targetEntity = DocumentDetailData.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DOCUMENT_DETAIL_LIST_DOCUMEN_0")
public List<DocumentDetailData> getDocumentDetailList() {
return this.documentDetailList;
} | java | {
"resource": ""
} |
q166473 | ChartOptionsImpl.createAxesXYDateFloat | validation | private static Axes createAxesXYDateFloat() {
return new Axes()
.addAxis(new XYaxis().setRenderer(AxisRenderers.DATE)
.setTickOptions(new AxisTickRenderer().setFormatString(YEAR_MONTH_DAY_FORMAT).setFontFamily(FONT_FAMILY).setTextColor(TEXT_COLOR).setFontSize(FONT_SIZE))
.setNumberTicks(NUMBER_TICKS_DATE))
.addAxis(new XYaxis(XYaxes.Y).setRenderer(AxisRenderers.LINEAR).setTickOptions(new AxisTickRenderer().setFormatString(FLOAT_FORMAT).setFontFamily(FONT_FAMILY).setTextColor(TEXT_COLOR).setFontSize(FONT_SIZE)).setNumberTicks(NUMBER_TICKS));
} | java | {
"resource": ""
} |
q166474 | ChartOptionsImpl.createDefaultGrid | validation | private static Grid createDefaultGrid() {
final Grid grid = new Grid();
grid.setBackground(BACKGROUND_COLOR);
grid.setGridLineColor(GRIDLINE_COLOR);
grid.setBorderColor(BORDER_COLOR);
return grid;
} | java | {
"resource": ""
} |
q166475 | ChartOptionsImpl.createdLegendEnhancedInsideNorthWest | validation | private static Legend createdLegendEnhancedInsideNorthWest() {
return setLegendStyling(new Legend().setShow(true)
.setRendererOptions(
new EnhancedLegendRenderer().setSeriesToggle(SeriesToggles.NORMAL).setSeriesToggleReplot(true).setNumberColumns(LEGEND_COLUMNS).setNumberRows(LEGEND_ROWS))
.setPlacement(LegendPlacements.INSIDE_GRID).setLocation(LegendLocations.NORTH_WEST));
} | java | {
"resource": ""
} |
q166476 | ChartOptionsImpl.createdLegendEnhancedInsideWest | validation | private static Legend createdLegendEnhancedInsideWest() {
return setLegendStyling(
new Legend().setShow(true).setPlacement(LegendPlacements.INSIDE_GRID).setLocation(LegendLocations.WEST)
.setRenderer(LegendRenderers.ENHANCED).setRendererOptions(new EnhancedLegendRenderer()
.setSeriesToggle(SeriesToggles.NORMAL).setSeriesToggleReplot(true).setNumberColumns(LEGEND_COLUMNS).setNumberRows(LEGEND_ROWS)));
} | java | {
"resource": ""
} |
q166477 | ChartOptionsImpl.createLegendOutsideOneColumn | validation | private static Legend createLegendOutsideOneColumn() {
return setLegendStyling(new Legend().setShow(true)
.setRendererOptions(
new EnhancedLegendRenderer().setSeriesToggle(SeriesToggles.NORMAL).setSeriesToggleReplot(true).setNumberColumns(ONE_COLUMN_NUMBER_OF_COLUMNS).setNumberRows(ONE_COLUMN_NUMBER_OF_ROWS))
.setPlacement(LegendPlacements.OUTSIDE_GRID));
} | java | {
"resource": ""
} |
q166478 | ChartOptionsImpl.setLegendStyling | validation | private static Legend setLegendStyling(final Legend legend) {
legend.setBackground(BACKGROUND_COLOR).setFontFamily(FONT_FAMILY).setTextColor(TEXT_COLOR).setFontSize(LEGEND_FONT_SIZE);
return legend;
} | java | {
"resource": ""
} |
q166479 | ChartOptionsImpl.createHighLighter | validation | private static Highlighter createHighLighter() {
return new Highlighter().setShow(true).setShowTooltip(true).setTooltipAlwaysVisible(true)
.setKeepTooltipInsideChart(true);
} | java | {
"resource": ""
} |
q166480 | ChartOptionsImpl.createHighLighterNorth | validation | private static Highlighter createHighLighterNorth() {
return new Highlighter().setShow(true).setShowTooltip(true).setTooltipAlwaysVisible(true)
.setKeepTooltipInsideChart(true).setTooltipLocation(TooltipLocations.NORTH)
.setTooltipAxes(TooltipAxes.XY_BAR).setShowMarker(true).setBringSeriesToFront(true);
} | java | {
"resource": ""
} |
q166481 | ChartOptionsImpl.createSeriesDefaultPieChart | validation | private static SeriesDefaults createSeriesDefaultPieChart() {
return new SeriesDefaults().setRenderer(SeriesRenderers.PIE)
.setRendererOptions(new PieRenderer().setShowDataLabels(true)).setShadow(true);
} | java | {
"resource": ""
} |
q166482 | ChartOptionsImpl.createDonoutSeriesDefault | validation | private static SeriesDefaults createDonoutSeriesDefault() {
return new SeriesDefaults().setRenderer(SeriesRenderers.DONUT)
.setRendererOptions(new DonutRenderer().setSliceMargin(SLICE_MARGIN).setStartAngle(START_ANGLE).setShowDataLabels(true)
.setDataLabels(DataLabels.VALUE));
} | java | {
"resource": ""
} |
q166483 | DocumentAttachmentContainer.getDocumentAttachmentList | validation | @OneToMany(targetEntity = DocumentAttachment.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DOCUMENT_ATTACHMENT_LIST_DOC_0")
public List<DocumentAttachment> getDocumentAttachmentList() {
return this.documentAttachmentList;
} | java | {
"resource": ""
} |
q166484 | CommitteeRankingMenuItemFactoryImpl.createCommitteeeRankingMenuBar | validation | @Override
public void createCommitteeeRankingMenuBar(final MenuBar menuBar) {
initApplicationMenuBar(menuBar);
applicationMenuItemFactory.addRankingMenu(menuBar);
createCommitteeRankingTopics(menuBar.addItem(COMMITTEE_RANKING_TEXT, null, null));
} | java | {
"resource": ""
} |
q166485 | CommitteeRankingMenuItemFactoryImpl.createCommitteeRankingTopics | validation | @Override
public void createCommitteeRankingTopics(final MenuItem committeeMenuItem) {
committeeMenuItem.addItem(OVERVIEW_TEXT, VaadinIcons.GROUP, COMMAND_OVERVIEW);
final MenuItem listByTopic = committeeMenuItem.addItem(RANKING_LIST_BY_TOPIC_TEXT, VaadinIcons.GROUP, null);
final MenuItem listItem = listByTopic.addItem(POLITICAL_WORK_SUMMARY_TEXT,VaadinIcons.GROUP, COMMAND_DATAGRID);
listItem.setDescription(CURRENT_AND_PAST_MEMBER_AND_SUMMARY_OF_POLTICIAL_DAYS);
final MenuItem chartByTopic = committeeMenuItem.addItem(CHART_BY_TOPIC_TEXT, VaadinIcons.GROUP, null);
chartByTopic.addItem(CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT);
chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS,VaadinIcons.GROUP, COMMAND_COMMITTEES_BY_PARTY);
chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_PARTY_DAYS_SERVED);
chartByTopic.addItem(ALL_COMMITTEES_TOTAL_MEMBERS,VaadinIcons.GROUP, COMMAND_ALL_COMMITTEES_BY_HEADCOUNT);
committeeMenuItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP, COMMAND_PAGEVISIT_HISTORY);
} | java | {
"resource": ""
} |
q166486 | CommitteeRankingMenuItemFactoryImpl.createOverviewPage | validation | @Override
public void createOverviewPage(final VerticalLayout panelContent) {
final ResponsiveRow grid = RowUtil.createGridLayout(panelContent);
createButtonLink(grid,POLITICAL_WORK_SUMMARY_TEXT,VaadinIcons.GROUP, COMMAND_DATAGRID, "Scoreboard over current member size, political days served and total assignments");
createButtonLink(grid,CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT, "Chart over current committees and member size");
createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS,VaadinIcons.GROUP, COMMAND_COMMITTEES_BY_PARTY, "Chart over current parties active in committees and member size");
createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES,VaadinIcons.GROUP, COMMAND_CURRENT_COMMITTEES_BY_PARTY_DAYS_SERVED, "Chart over current parties active in committees days served");
createButtonLink(grid,ALL_COMMITTEES_TOTAL_MEMBERS,VaadinIcons.GROUP, COMMAND_ALL_COMMITTEES_BY_HEADCOUNT, "Chart over all committees and member size");
createButtonLink(grid,PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP, COMMAND_PAGEVISIT_HISTORY, "View history of page visit for this page.");
} | java | {
"resource": ""
} |
q166487 | PoliticianOverviewPageModContentFactoryImpl.createOverviewContent | validation | private void createOverviewContent(final VerticalLayout panelContent, final PersonData personData,
final ViewRiksdagenPolitician viewRiksdagenPolitician, final String pageId) {
LabelFactory.createHeader2Label(panelContent, OVERVIEW);
final Link createPoliticianPageLink = getPageLinkFactory().createPoliticianPageLink(personData);
panelContent.addComponent(createPoliticianPageLink);
final Image image = new Image("",
new ExternalResource(personData.getImageUrl192().replace("http://", "https://")));
final HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSizeFull();
panelContent.addComponent(horizontalLayout);
horizontalLayout.addComponent(image);
getFormFactory().addFormPanelTextFields(horizontalLayout, viewRiksdagenPolitician,
ViewRiksdagenPolitician.class, AS_LIST);
final VerticalLayout overviewLayout = new VerticalLayout();
overviewLayout.setSizeFull();
panelContent.addComponent(overviewLayout);
panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
getPoliticianMenuItemFactory().createOverviewPage(overviewLayout, pageId);
panelContent.setExpandRatio(createPoliticianPageLink, ContentRatio.SMALL);
panelContent.setExpandRatio(horizontalLayout, ContentRatio.GRID);
} | java | {
"resource": ""
} |
q166488 | SwedenMunicipalityData.getKommunvalkrets | validation | @OneToMany(targetEntity = SwedenMunicipalityElectionRegionData.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "KOMMUNVALKRETS_SWEDEN_MUNICI_0")
public List<SwedenMunicipalityElectionRegionData> getKommunvalkrets() {
return this.kommunvalkrets;
} | java | {
"resource": ""
} |
q166489 | BootstrapDefaultConfig.configureAuthentication | validation | private static void configureAuthentication(final String role) {
final Collection<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(role);
final Authentication authentication = new UsernamePasswordAuthenticationToken("service.impl.BootstrapDefaultConfig", "n/a", authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
} | java | {
"resource": ""
} |
q166490 | ComplianceCheckResponse.setList | validation | public void setList(final List<ComplianceCheck> list) {
this.list = Collections.unmodifiableList(ListUtils.emptyIfNull(list));
} | java | {
"resource": ""
} |
q166491 | ComplianceCheckResponse.setStatusMap | validation | public void setStatusMap(final Map<Status, List<RuleViolation>> statusMap) {
this.statusMap = Collections.unmodifiableMap(MapUtils.emptyIfNull(statusMap));
} | java | {
"resource": ""
} |
q166492 | ComplianceCheckResponse.setResourceTypeMap | validation | public void setResourceTypeMap(final Map<ResourceType, List<RuleViolation>> resourceTypeMap) {
this.resourceTypeMap = Collections.unmodifiableMap(MapUtils.emptyIfNull(resourceTypeMap));
} | java | {
"resource": ""
} |
q166493 | SwedenCountyData.getKommun | validation | @OneToMany(targetEntity = SwedenMunicipalityData.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "KOMMUN_SWEDEN_COUNTY_DATA_HJ_0")
public List<SwedenMunicipalityData> getKommun() {
return this.kommun;
} | java | {
"resource": ""
} |
q166494 | PersonAssignmentElement.getUppdrag | validation | @OneToMany(targetEntity = AssignmentElement.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "UPPDRAG_PERSON_ASSIGNMENT_EL_0")
public List<AssignmentElement> getUppdrag() {
return this.uppdrag;
} | java | {
"resource": ""
} |
q166495 | DocumentProposalContainer.getProposal | validation | @ManyToOne(targetEntity = DocumentProposalData.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "PROPOSAL_DOCUMENT_PROPOSAL_C_0")
public DocumentProposalData getProposal() {
return proposal;
} | java | {
"resource": ""
} |
q166496 | PageModeMenuCommand.getPagePath | validation | public String getPagePath() {
if (pageReference != null && !pageReference.isEmpty()) {
return page + PAGE_SEPARATOR + pageReference;
} else {
return page;
}
} | java | {
"resource": ""
} |
q166497 | RiksdagenVoteDataWorkConsumerImpl.updateBallot | validation | private void updateBallot(final String ballotId) {
try {
configureAuthentication();
updateService.updateVoteDataData(riksdagenApi.getBallot(ballotId));
} catch (final DataFailureException e) {
LOGGER.warn("Eror loading riksdagen voteData:" + ballotId + " errorMessage:", e);
} finally {
clearAuthentication();
}
} | java | {
"resource": ""
} |
q166498 | PartyChartDataManagerImpl.getMaxSizeViewRiksdagenVoteDataBallotPartySummaryDaily | validation | private List<ViewRiksdagenVoteDataBallotPartySummaryDaily> getMaxSizeViewRiksdagenVoteDataBallotPartySummaryDaily() {
initPartyMap();
final Optional<Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>>> first = partyMap.entrySet()
.stream().sorted((e1, e2) -> Integer.compare(e2.getValue().size(), e1.getValue().size())
).findFirst();
if (first.isPresent()) {
return first.get().getValue();
} else {
return new ArrayList<>();
}
} | java | {
"resource": ""
} |
q166499 | PartyChartDataManagerImpl.initPartyMap | validation | private synchronized void initPartyMap() {
if (partyMap == null) {
final DataContainer<ViewRiksdagenVoteDataBallotPartySummaryDaily, RiksdagenVoteDataBallotPartyPeriodSummaryEmbeddedId> partyBallotSummaryDailyDataContainer = getApplicationManager()
.getDataContainer(ViewRiksdagenVoteDataBallotPartySummaryDaily.class);
partyMap = partyBallotSummaryDailyDataContainer.getAll().parallelStream().filter(Objects::nonNull)
.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getParty()));
}
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.