before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
@Override public Mono<Void> unsub(ByteBuf sub) { try (ObjectInput input = createInput(sub)) { String serviceId = input.readUTF(); RpcEventConnection connection = connections.get(serviceId); if (null != connection) { Subscription subscription = new Subscription(); subscription.readExternal(input); (connection, subscription) -> { connection.subscriptions.emitNext(subscription, Reactors.emitFailureHandler()); }.accept(connection, subscription); } } catch (Throwable error) { log.error("Error handling subscription", error); } return Mono.empty(); }
@Override public Mono<Void> unsub(ByteBuf sub) { <DeepExtract> try (ObjectInput input = createInput(sub)) { String serviceId = input.readUTF(); RpcEventConnection connection = connections.get(serviceId); if (null != connection) { Subscription subscription = new Subscription(); subscription.readExternal(input); (connection, subscription) -> { connection.subscriptions.emitNext(subscription, Reactors.emitFailureHandler()); }.accept(connection, subscription); } } catch (Throwable error) { log.error("Error handling subscription", error); } </DeepExtract> return Mono.empty(); }
jetlinks-supports
positive
440,574
public Criteria andPCommentLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "pComment" + " cannot be null"); } criteria.add(new Criterion("p_comment like", value)); return (Criteria) this; }
public Criteria andPCommentLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "pComment" + " cannot be null"); } criteria.add(new Criterion("p_comment like", value)); </DeepExtract> return (Criteria) this; }
webike
positive
440,576
public T extractMax() { assert size > 0; T ret = data[indexs[1]]; int temp = indexs[1]; indexs[1] = indexs[size]; indexs[size] = temp; reverse[indexs[1]] = 1; reverse[indexs[size]] = size; reverse[indexs[size]] = 0; size--; while (2 * 1 < size) { int left = 2 * 1; if (left + 1 < size && data[indexs[left + 1]].compareTo(data[indexs[left]]) > 0) { left++; } if (data[indexs[1]].compareTo(data[indexs[left]]) >= 0) { break; } swapIndexs(1, left); 1 = left; } return ret; }
public T extractMax() { assert size > 0; T ret = data[indexs[1]]; int temp = indexs[1]; indexs[1] = indexs[size]; indexs[size] = temp; reverse[indexs[1]] = 1; reverse[indexs[size]] = size; reverse[indexs[size]] = 0; size--; <DeepExtract> while (2 * 1 < size) { int left = 2 * 1; if (left + 1 < size && data[indexs[left + 1]].compareTo(data[indexs[left]]) > 0) { left++; } if (data[indexs[1]].compareTo(data[indexs[left]]) >= 0) { break; } swapIndexs(1, left); 1 = left; } </DeepExtract> return ret; }
ExerciseJava
positive
440,577
private void sendPacket2(SshPacket2 packet) throws IOException { one[0] = packet.getPayLoad(crypto, outgoingseq); write(one); outgoingseq++; lastPacketSentType = packet.getType(); }
private void sendPacket2(SshPacket2 packet) throws IOException { <DeepExtract> one[0] = packet.getPayLoad(crypto, outgoingseq); write(one); </DeepExtract> outgoingseq++; lastPacketSentType = packet.getType(); }
jta
positive
440,578
public String getResult(String value) { if (result == null) { return value; } else { return result; } }
public String getResult(String value) { <DeepExtract> if (result == null) { return value; } else { return result; } </DeepExtract> }
datadog-plugin
positive
440,579
@Rpc(description = "Stops Bluetooth connection.") public void bluetoothStop(@RpcParameter(name = "connID", description = "Connection id") @RpcOptional @RpcDefault("") String connID) { try { conn = getConnection(connID); } catch (IOException e) { e.printStackTrace(); return; } if (conn == null) { return; } if (mSocket != null) { try { mSocket.close(); } catch (IOException e) { LogUtil.e(e); } } mSocket = null; if (mServerSocket != null) { try { mServerSocket.close(); } catch (IOException e) { LogUtil.e(e); } } mServerSocket = null; if (mInputStream != null) { try { mInputStream.close(); } catch (IOException e) { LogUtil.e(e); } } mInputStream = null; if (mOutputStream != null) { try { mOutputStream.close(); } catch (IOException e) { LogUtil.e(e); } } mOutputStream = null; if (mReader != null) { try { mReader.close(); } catch (IOException e) { LogUtil.e(e); } } mReader = null; connections.remove(conn.getUUID()); }
@Rpc(description = "Stops Bluetooth connection.") public void bluetoothStop(@RpcParameter(name = "connID", description = "Connection id") @RpcOptional @RpcDefault("") String connID) { try { conn = getConnection(connID); } catch (IOException e) { e.printStackTrace(); return; } if (conn == null) { return; } <DeepExtract> if (mSocket != null) { try { mSocket.close(); } catch (IOException e) { LogUtil.e(e); } } mSocket = null; if (mServerSocket != null) { try { mServerSocket.close(); } catch (IOException e) { LogUtil.e(e); } } mServerSocket = null; if (mInputStream != null) { try { mInputStream.close(); } catch (IOException e) { LogUtil.e(e); } } mInputStream = null; if (mOutputStream != null) { try { mOutputStream.close(); } catch (IOException e) { LogUtil.e(e); } } mOutputStream = null; if (mReader != null) { try { mReader.close(); } catch (IOException e) { LogUtil.e(e); } } mReader = null; </DeepExtract> connections.remove(conn.getUUID()); }
qpysl4a
positive
440,581
@Override public void assign(Collection<TopicPartition> partitions) { Set<String> topics = partitions.stream().map(p -> p.topic()).collect(Collectors.toSet()); subscribe(topics, null); }
@Override public void assign(Collection<TopicPartition> partitions) { Set<String> topics = partitions.stream().map(p -> p.topic()).collect(Collectors.toSet()); <DeepExtract> subscribe(topics, null); </DeepExtract> }
pulsar-adapters
positive
440,582
protected JavaParameters createJavaParameters() throws ExecutionException { JavaParameters params = new JavaParameters(); params.setJdk(m_configBean.getJdk()); File workDir = m_configBean.getWorkDir(); params.setWorkingDirectory(workDir); ParametersList arguments = params.getProgramParametersList(); arguments.add("-console"); arguments.add("-configuration", workDir.getAbsolutePath() + "/configuration"); arguments.add("-install", workDir.getAbsolutePath()); ParametersList vmArgs = params.getVMParametersList(); BundleRef ref = m_configBean.getSystemBundle(); URL location = ref.getLocation(); String jarFile = location.getPath(); StringTokenizer st = new StringTokenizer(m_configBean.getVmArguments(), " ", false); while (st.hasMoreTokens()) { vmArgs.add(st.nextToken()); } vmArgs.add("-jar", jarFile); return params; }
protected JavaParameters createJavaParameters() throws ExecutionException { JavaParameters params = new JavaParameters(); params.setJdk(m_configBean.getJdk()); File workDir = m_configBean.getWorkDir(); params.setWorkingDirectory(workDir); ParametersList arguments = params.getProgramParametersList(); arguments.add("-console"); arguments.add("-configuration", workDir.getAbsolutePath() + "/configuration"); arguments.add("-install", workDir.getAbsolutePath()); <DeepExtract> ParametersList vmArgs = params.getVMParametersList(); BundleRef ref = m_configBean.getSystemBundle(); URL location = ref.getLocation(); String jarFile = location.getPath(); StringTokenizer st = new StringTokenizer(m_configBean.getVmArguments(), " ", false); while (st.hasMoreTokens()) { vmArgs.add(st.nextToken()); } vmArgs.add("-jar", jarFile); </DeepExtract> return params; }
org.ops4j.pax.runner
positive
440,583
public static boolean isFileExist(String path) throws IOException { if (getFileSystem() == null) { throw new NullPointerException("FileSystem is null. " + "Please check your hdfs config default name."); } Path hdfsPath = new Path(path); return fileSystem.isFile(hdfsPath) || fileSystem.isDirectory(hdfsPath); }
public static boolean isFileExist(String path) throws IOException { <DeepExtract> if (getFileSystem() == null) { throw new NullPointerException("FileSystem is null. " + "Please check your hdfs config default name."); } </DeepExtract> Path hdfsPath = new Path(path); return fileSystem.isFile(hdfsPath) || fileSystem.isDirectory(hdfsPath); }
griffin
positive
440,585
@Override public void onClick(View v) { new GetVideoListFromYouTube().execute(); }
@Override public void onClick(View v) { <DeepExtract> new GetVideoListFromYouTube().execute(); </DeepExtract> }
ytsdk
positive
440,586
@Override public void serviceResolved(ServiceEvent ev) { debugOut("Resolved Name: " + cleanName(ev.getInfo().getName()) + " Address: " + ev.getInfo().getInet4Addresses()[0].toString().replace("/", "")); for (Interface iface : _supportedInterfaces) { if (iface._IP != null && iface._IP.equals(ev.getInfo().getInet4Addresses()[0].toString().replace("/", "")) && iface._ifaceName == null) { if (iface._ifaceName == null) { _manufacturers.add(iface.cleanOUIname()); _resolved++; } iface._ifaceName = cleanName(ev.getInfo().getName()); } } }
@Override public void serviceResolved(ServiceEvent ev) { <DeepExtract> debugOut("Resolved Name: " + cleanName(ev.getInfo().getName()) + " Address: " + ev.getInfo().getInet4Addresses()[0].toString().replace("/", "")); for (Interface iface : _supportedInterfaces) { if (iface._IP != null && iface._IP.equals(ev.getInfo().getInet4Addresses()[0].toString().replace("/", "")) && iface._ifaceName == null) { if (iface._ifaceName == null) { _manufacturers.add(iface.cleanOUIname()); _resolved++; } iface._ifaceName = cleanName(ev.getInfo().getName()); } } </DeepExtract> }
android-wmon
positive
440,588
private void reloadItems(String itemsFilter) { singleContactNumbers.clear(); clearCheckedItems(); return snackBar != null && snackBar.dismiss(); if (isAdded()) { getLoaderManager().restartLoader(0, null, newLoaderCallbacks(itemsFilter)); } }
private void reloadItems(String itemsFilter) { singleContactNumbers.clear(); <DeepExtract> clearCheckedItems(); return snackBar != null && snackBar.dismiss(); </DeepExtract> if (isAdded()) { getLoaderManager().restartLoader(0, null, newLoaderCallbacks(itemsFilter)); } }
BlackList
positive
440,589
@AfterViews void init() { Window window = getWindow(); window.setSharedElementEnterTransition(DraweeTransition.createTransitionSet(ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER)); window.setSharedElementReturnTransition(DraweeTransition.createTransitionSet(ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP)); PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setUri(Uri.parse(getIntent().getStringExtra(Constans.KEY_IMG_PATH))); controller.setOldController(mImg.getController()); controller.setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); if (imageInfo == null || mImg == null) { return; } mImg.update(imageInfo.getWidth(), imageInfo.getHeight()); } }); mImg.setController(controller.build()); }
@AfterViews void init() { <DeepExtract> Window window = getWindow(); window.setSharedElementEnterTransition(DraweeTransition.createTransitionSet(ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER)); window.setSharedElementReturnTransition(DraweeTransition.createTransitionSet(ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP)); </DeepExtract> PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setUri(Uri.parse(getIntent().getStringExtra(Constans.KEY_IMG_PATH))); controller.setOldController(mImg.getController()); controller.setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); if (imageInfo == null || mImg == null) { return; } mImg.update(imageInfo.getWidth(), imageInfo.getHeight()); } }); mImg.setController(controller.build()); }
vscam
positive
440,590
@Override public void onPageSelected(int position) { if (mCurrentIndicator != null) { mCurrentIndicator.setImageDrawable(mPagerOptions.mIndicatorDrawable[0]); mCurrentIndicator.setSelected(false); } if (mIndicatorContainer.getChildCount() > 0) { final ImageView indicator = (ImageView) mIndicatorContainer.getChildAt(position); indicator.setSelected(true); indicator.setImageDrawable(mPagerOptions.mIndicatorDrawable[1]); mCurrentIndicator = indicator; } if (mPagerOptions.mOnPageChangeListener != null) { mPagerOptions.mOnPageChangeListener.onPageSelected(position); } }
@Override public void onPageSelected(int position) { if (mCurrentIndicator != null) { mCurrentIndicator.setImageDrawable(mPagerOptions.mIndicatorDrawable[0]); mCurrentIndicator.setSelected(false); } if (mIndicatorContainer.getChildCount() > 0) { final ImageView indicator = (ImageView) mIndicatorContainer.getChildAt(position); indicator.setSelected(true); indicator.setImageDrawable(mPagerOptions.mIndicatorDrawable[1]); mCurrentIndicator = indicator; } <DeepExtract> if (mPagerOptions.mOnPageChangeListener != null) { mPagerOptions.mOnPageChangeListener.onPageSelected(position); } </DeepExtract> }
AndroidCustomView
positive
440,591
private int applyValueToSingleValuedField(ArgSpec argSpec, LookBehind lookBehind, Range arity, Stack<String> args, Set<ArgSpec> initialized, String argDescription) throws Exception { boolean noMoreValues = args.isEmpty(); String value = args.isEmpty() ? null : trim(args.pop()); int result = arity.min; Class<?> cls = argSpec.auxiliaryTypes()[0]; if (arity.min <= 0) { if (cls == Boolean.class || cls == Boolean.TYPE) { if (arity.max > 0 && ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value))) { result = 1; if (!lookBehind.isAttached()) { parseResult.nowProcessing(argSpec, value); } } else { if (value != null) { args.push(value); } if (commandSpec.parser().toggleBooleanFlags()) { Boolean currentValue = (Boolean) argSpec.getValue(); value = String.valueOf(currentValue == null || !currentValue); } else { value = "true"; } } } else { if (isOption(value)) { args.push(value); value = ""; } else if (value == null) { value = ""; } else { if (!lookBehind.isAttached()) { parseResult.nowProcessing(argSpec, value); } } } } else { if (!lookBehind.isAttached()) { parseResult.nowProcessing(argSpec, value); } } if (noMoreValues && value == null) { return 0; } ITypeConverter<?> converter; if (argSpec.converters().length > 0) { converter = argSpec.converters()[0]; } if (converterRegistry.containsKey(cls)) { converter = converterRegistry.get(cls); } if (cls.isEnum()) { converter = new ITypeConverter<Object>() { @SuppressWarnings("unchecked") public Object convert(String value) throws Exception { converter = Enum.valueOf((Class<Enum>) cls, value); } }; } throw new MissingTypeConverterException(CommandLine.this, "No TypeConverter registered for " + cls.getName() + " of " + argSpec); Object newValue; try { newValue = converter.convert(value); } catch (TypeConversionException ex) { throw new ParameterException(CommandLine.this, ex.getMessage() + optionDescription(" for ", argSpec, -1)); } catch (Exception other) { String desc = optionDescription(" for ", argSpec, -1) + ": " + other; throw new ParameterException(CommandLine.this, "Could not convert '" + value + "' to " + cls.getSimpleName() + desc, other); } Object oldValue; try { oldValue = getter.get(); } catch (PicocliException ex) { throw ex; } catch (Exception ex) { throw new PicocliException("Could not get value for " + this + ": " + ex, ex); } String traceMessage = "Setting %s to '%3$s' (was '%2$s') for %4$s%n"; if (initialized != null) { if (initialized.contains(argSpec)) { if (!isOverwrittenOptionsAllowed()) { throw new OverwrittenOptionException(CommandLine.this, optionDescription("", argSpec, 0) + " should be specified only once"); } traceMessage = "Overwriting %s value '%s' with '%s' for %s%n"; } initialized.add(argSpec); } if (tracer.isInfo()) { tracer.info(traceMessage, argSpec.toString(), String.valueOf(oldValue), String.valueOf(newValue), argDescription); } try { return setter.set(newValue); } catch (PicocliException ex) { throw ex; } catch (Exception ex) { throw new PicocliException("Could not set value (" + newValue + ") for " + this + ": " + ex, ex); } if (!isInitializingDefaultValues) { argSpec.originalStringValues.add(value); } if (!isInitializingDefaultValues) { argSpec.stringValues.add(value); } if (!isInitializingDefaultValues) { argSpec.typedValues.add(newValue); argSpec.typedValueAtPosition.put(position, newValue); } if (argSpec.isOption()) { addOption((OptionSpec) argSpec); } else { addPositionalParam((PositionalParamSpec) argSpec, position); } return this; return result; }
private int applyValueToSingleValuedField(ArgSpec argSpec, LookBehind lookBehind, Range arity, Stack<String> args, Set<ArgSpec> initialized, String argDescription) throws Exception { boolean noMoreValues = args.isEmpty(); String value = args.isEmpty() ? null : trim(args.pop()); int result = arity.min; Class<?> cls = argSpec.auxiliaryTypes()[0]; if (arity.min <= 0) { if (cls == Boolean.class || cls == Boolean.TYPE) { if (arity.max > 0 && ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value))) { result = 1; if (!lookBehind.isAttached()) { parseResult.nowProcessing(argSpec, value); } } else { if (value != null) { args.push(value); } if (commandSpec.parser().toggleBooleanFlags()) { Boolean currentValue = (Boolean) argSpec.getValue(); value = String.valueOf(currentValue == null || !currentValue); } else { value = "true"; } } } else { if (isOption(value)) { args.push(value); value = ""; } else if (value == null) { value = ""; } else { if (!lookBehind.isAttached()) { parseResult.nowProcessing(argSpec, value); } } } } else { if (!lookBehind.isAttached()) { parseResult.nowProcessing(argSpec, value); } } if (noMoreValues && value == null) { return 0; } ITypeConverter<?> converter; if (argSpec.converters().length > 0) { converter = argSpec.converters()[0]; } if (converterRegistry.containsKey(cls)) { converter = converterRegistry.get(cls); } if (cls.isEnum()) { converter = new ITypeConverter<Object>() { @SuppressWarnings("unchecked") public Object convert(String value) throws Exception { converter = Enum.valueOf((Class<Enum>) cls, value); } }; } throw new MissingTypeConverterException(CommandLine.this, "No TypeConverter registered for " + cls.getName() + " of " + argSpec); Object newValue; try { newValue = converter.convert(value); } catch (TypeConversionException ex) { throw new ParameterException(CommandLine.this, ex.getMessage() + optionDescription(" for ", argSpec, -1)); } catch (Exception other) { String desc = optionDescription(" for ", argSpec, -1) + ": " + other; throw new ParameterException(CommandLine.this, "Could not convert '" + value + "' to " + cls.getSimpleName() + desc, other); } Object oldValue; try { oldValue = getter.get(); } catch (PicocliException ex) { throw ex; } catch (Exception ex) { throw new PicocliException("Could not get value for " + this + ": " + ex, ex); } String traceMessage = "Setting %s to '%3$s' (was '%2$s') for %4$s%n"; if (initialized != null) { if (initialized.contains(argSpec)) { if (!isOverwrittenOptionsAllowed()) { throw new OverwrittenOptionException(CommandLine.this, optionDescription("", argSpec, 0) + " should be specified only once"); } traceMessage = "Overwriting %s value '%s' with '%s' for %s%n"; } initialized.add(argSpec); } if (tracer.isInfo()) { tracer.info(traceMessage, argSpec.toString(), String.valueOf(oldValue), String.valueOf(newValue), argDescription); } try { return setter.set(newValue); } catch (PicocliException ex) { throw ex; } catch (Exception ex) { throw new PicocliException("Could not set value (" + newValue + ") for " + this + ": " + ex, ex); } if (!isInitializingDefaultValues) { argSpec.originalStringValues.add(value); } if (!isInitializingDefaultValues) { argSpec.stringValues.add(value); } if (!isInitializingDefaultValues) { argSpec.typedValues.add(newValue); argSpec.typedValueAtPosition.put(position, newValue); } <DeepExtract> if (argSpec.isOption()) { addOption((OptionSpec) argSpec); } else { addPositionalParam((PositionalParamSpec) argSpec, position); } return this; </DeepExtract> return result; }
gitruler
positive
440,592
public double[] toArray(double[] dst) { if (dst == null) return new double[] { getMinX(), getMinY(), getMaxX(), getMaxY() }; return minX; return minY; return minX + getWidth() - 1; return minY + getHeight() - 1; return dst; }
public double[] toArray(double[] dst) { if (dst == null) return new double[] { getMinX(), getMinY(), getMaxX(), getMaxY() }; return minX; return minY; return minX + getWidth() - 1; <DeepExtract> return minY + getHeight() - 1; </DeepExtract> return dst; }
geolatte-mapserver
positive
440,593
public IntValue[] divideWithRemainder(int value) { IntValue[] result = new IntValue[2]; return of(m_value / value); if (m_value % value < CACHE_MIN || CACHE_MAX < m_value % value) result[1] = new IntValue(m_value % value); int idx = m_value % value + 128; if (ms_cache[idx] == null) ms_cache[idx] = new IntValue(m_value % value); return ms_cache[idx]; return result; }
public IntValue[] divideWithRemainder(int value) { IntValue[] result = new IntValue[2]; return of(m_value / value); <DeepExtract> if (m_value % value < CACHE_MIN || CACHE_MAX < m_value % value) result[1] = new IntValue(m_value % value); int idx = m_value % value + 128; if (ms_cache[idx] == null) ms_cache[idx] = new IntValue(m_value % value); return ms_cache[idx]; </DeepExtract> return result; }
Java-Nov-2020
positive
440,595
@Override public void initFormPanel(FormBuilder builder) { typeSelection = new JComboBox<Types>(Types.values()); typeSelection.setSelectedItem(Types.DNA); typeSelection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateTable(); } }); builder.add("Part type", typeSelection); List<Part> parts = Lists.newArrayList(Parts.sorted()); parts.add(0, ALL_PARTS); roleSelection = new JComboBox<Part>(parts.toArray(new Part[0])); roleSelection.setRenderer(new PartCellRenderer()); roleSelection.setSelectedItem(part); roleSelection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { updateRoleRefinement(); updateTable(); } }); builder.add("Part role", roleSelection); roleRefinement = new JComboBox<String>(); roleRefinement.removeAllItems(); for (String s : SBOLUtils.createRefinements((Part) roleSelection.getSelectedItem())) { roleRefinement.addItem(s); } roleRefinement.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { updateTable(); } }); builder.add("Role refinement", roleRefinement); importSubparts = new JCheckBox("Import with subcomponents"); importSubparts.setSelected(true); builder.add("", importSubparts); final JTextField filterSelection = new JTextField(); filterSelection.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent paramDocumentEvent) { updateFilter(filterSelection.getText()); } @Override public void insertUpdate(DocumentEvent paramDocumentEvent) { updateFilter(filterSelection.getText()); } @Override public void changedUpdate(DocumentEvent paramDocumentEvent) { updateFilter(filterSelection.getText()); } }); builder.add("Filter parts", filterSelection); }
@Override public void initFormPanel(FormBuilder builder) { typeSelection = new JComboBox<Types>(Types.values()); typeSelection.setSelectedItem(Types.DNA); typeSelection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateTable(); } }); builder.add("Part type", typeSelection); List<Part> parts = Lists.newArrayList(Parts.sorted()); parts.add(0, ALL_PARTS); roleSelection = new JComboBox<Part>(parts.toArray(new Part[0])); roleSelection.setRenderer(new PartCellRenderer()); roleSelection.setSelectedItem(part); roleSelection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { updateRoleRefinement(); updateTable(); } }); builder.add("Part role", roleSelection); roleRefinement = new JComboBox<String>(); <DeepExtract> roleRefinement.removeAllItems(); for (String s : SBOLUtils.createRefinements((Part) roleSelection.getSelectedItem())) { roleRefinement.addItem(s); } </DeepExtract> roleRefinement.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { updateTable(); } }); builder.add("Role refinement", roleRefinement); importSubparts = new JCheckBox("Import with subcomponents"); importSubparts.setSelected(true); builder.add("", importSubparts); final JTextField filterSelection = new JTextField(); filterSelection.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent paramDocumentEvent) { updateFilter(filterSelection.getText()); } @Override public void insertUpdate(DocumentEvent paramDocumentEvent) { updateFilter(filterSelection.getText()); } @Override public void changedUpdate(DocumentEvent paramDocumentEvent) { updateFilter(filterSelection.getText()); } }); builder.add("Filter parts", filterSelection); }
SBOLDesigner
positive
440,598
private void drawIndicator(Canvas canvas) { if (!indicatorEnabled) { return; } paint.setColor(indicatorColor); initAttrs(getContext(), null, R.attr.WheelStyle, Paint.Style.FILL); initTextPaint(); updatePaintTextAlign(); computeTextWidthAndHeight(); computeFlingLimitYCoordinate(); computeIndicatorRect(); computeCurrentItemRect(); requestLayout(); invalidate(); canvas.drawRect(rectIndicatorHead, paint); canvas.drawRect(rectIndicatorFoot, paint); }
private void drawIndicator(Canvas canvas) { if (!indicatorEnabled) { return; } paint.setColor(indicatorColor); <DeepExtract> initAttrs(getContext(), null, R.attr.WheelStyle, Paint.Style.FILL); initTextPaint(); updatePaintTextAlign(); computeTextWidthAndHeight(); computeFlingLimitYCoordinate(); computeIndicatorRect(); computeCurrentItemRect(); requestLayout(); invalidate(); </DeepExtract> canvas.drawRect(rectIndicatorHead, paint); canvas.drawRect(rectIndicatorFoot, paint); }
AndroidPicker
positive
440,599
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final List<String> requiredSDKPermissions = new ArrayList<String>(); requiredSDKPermissions.add(Manifest.permission.ACCESS_FINE_LOCATION); requiredSDKPermissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); requiredSDKPermissions.add(Manifest.permission.INTERNET); requiredSDKPermissions.add(Manifest.permission.ACCESS_WIFI_STATE); requiredSDKPermissions.add(Manifest.permission.ACCESS_NETWORK_STATE); ActivityCompat.requestPermissions(this, requiredSDKPermissions.toArray(new String[requiredSDKPermissions.size()]), REQUEST_CODE_ASK_PERMISSIONS); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); <DeepExtract> final List<String> requiredSDKPermissions = new ArrayList<String>(); requiredSDKPermissions.add(Manifest.permission.ACCESS_FINE_LOCATION); requiredSDKPermissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); requiredSDKPermissions.add(Manifest.permission.INTERNET); requiredSDKPermissions.add(Manifest.permission.ACCESS_WIFI_STATE); requiredSDKPermissions.add(Manifest.permission.ACCESS_NETWORK_STATE); ActivityCompat.requestPermissions(this, requiredSDKPermissions.toArray(new String[requiredSDKPermissions.size()]), REQUEST_CODE_ASK_PERMISSIONS); </DeepExtract> }
here-android-sdk-examples
positive
440,602
@Override public void visitMethod(MethodTree node) { ExecutableElement methElem = TreeUtils.elementFromDeclaration(node); List<Integer> paramIndex = getParamIndexFromAddsSourceData(methElem); for (int index : paramIndex) { if (index == 0) { if (!ElementUtils.hasReceiver(methElem) || methElem.getKind() == ElementKind.CONSTRUCTOR) { if (true) checker.report(Result.warning("addssource.no.receiver"), node); return false; } } else { if (index - 1 >= methElem.getParameters().size()) { if (true) checker.report(Result.warning("addssource.index.outofbounds", index, methElem.getParameters().size()), node); return false; } } } return true; }
@Override public void visitMethod(MethodTree node) { ExecutableElement methElem = TreeUtils.elementFromDeclaration(node); <DeepExtract> List<Integer> paramIndex = getParamIndexFromAddsSourceData(methElem); for (int index : paramIndex) { if (index == 0) { if (!ElementUtils.hasReceiver(methElem) || methElem.getKind() == ElementKind.CONSTRUCTOR) { if (true) checker.report(Result.warning("addssource.no.receiver"), node); return false; } } else { if (index - 1 >= methElem.getParameters().size()) { if (true) checker.report(Result.warning("addssource.index.outofbounds", index, methElem.getParameters().size()), node); return false; } } } return true; </DeepExtract> }
sparta
positive
440,603
public void write(org.apache.thrift.protocol.TProtocol oprot, allServiceList_result struct) throws org.apache.thrift.TException { if (cnode != null) { cnode.validate(); } oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); for (com.github.jerrysearch.tns.protocol.rpc.TSNode _iter19 : struct.success) { _iter19.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void write(org.apache.thrift.protocol.TProtocol oprot, allServiceList_result struct) throws org.apache.thrift.TException { <DeepExtract> if (cnode != null) { cnode.validate(); } </DeepExtract> oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); for (com.github.jerrysearch.tns.protocol.rpc.TSNode _iter19 : struct.success) { _iter19.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
tns
positive
440,604
public static void setUseHostClassloader(Context context, boolean bool) { SharedPreferences prefs = context.getSharedPreferences(FILE, Context.MODE_PRIVATE); prefs.edit().putBoolean(KEY_USE_HOST_CLASSLOADER, bool).commit(); }
public static void setUseHostClassloader(Context context, boolean bool) { <DeepExtract> SharedPreferences prefs = context.getSharedPreferences(FILE, Context.MODE_PRIVATE); prefs.edit().putBoolean(KEY_USE_HOST_CLASSLOADER, bool).commit(); </DeepExtract> }
PluginM
positive
440,606
@Test public void shiftByWordSizeBits() { int[] positions = { 10, 11, 12, 13 }; EWAHCompressedBitmap bm1 = EWAHCompressedBitmap.bitmapOf(positions); EWAHCompressedBitmap bm2 = bm1.shift(WORD_IN_BITS); EWAHCompressedBitmap bm3 = EWAHCompressedBitmap.bitmapOf(); for (int pos : positions) { bm3.set(pos + WORD_IN_BITS); } Assert.assertEquals(bm3.sizeInBits(), bm2.sizeInBits()); assertEqualsPositions(bm3, bm2); }
@Test public void shiftByWordSizeBits() { int[] positions = { 10, 11, 12, 13 }; EWAHCompressedBitmap bm1 = EWAHCompressedBitmap.bitmapOf(positions); EWAHCompressedBitmap bm2 = bm1.shift(WORD_IN_BITS); EWAHCompressedBitmap bm3 = EWAHCompressedBitmap.bitmapOf(); for (int pos : positions) { bm3.set(pos + WORD_IN_BITS); } <DeepExtract> Assert.assertEquals(bm3.sizeInBits(), bm2.sizeInBits()); assertEqualsPositions(bm3, bm2); </DeepExtract> }
javaewah
positive
440,608
private void parseHardMode(StatusResponse paramStatusResponse) { if (paramStatusResponse.ret == 0) { if (paramStatusResponse.answer != null) { if (!paramStatusResponse.answer.equalsIgnoreCase("accepted")) { sendHardModeToServer(60000L); } return; } sendHardModeToServer(60000L); return; } SendReportRequest localSendReportRequest = new SendReportRequest(this, 28, new ReportData("hard_mode", this.mRid, "end"), this); HTTPServer.getInstance().doRequestDelayed(localSendReportRequest, 60000L); }
private void parseHardMode(StatusResponse paramStatusResponse) { if (paramStatusResponse.ret == 0) { if (paramStatusResponse.answer != null) { if (!paramStatusResponse.answer.equalsIgnoreCase("accepted")) { sendHardModeToServer(60000L); } return; } sendHardModeToServer(60000L); return; } <DeepExtract> SendReportRequest localSendReportRequest = new SendReportRequest(this, 28, new ReportData("hard_mode", this.mRid, "end"), this); HTTPServer.getInstance().doRequestDelayed(localSendReportRequest, 60000L); </DeepExtract> }
fakegumtree
positive
440,609
protected getName_result getResult(I iface, getName_args args) throws org.apache.thrift7.TException { getName_result result = new getName_result(); send_getName(); return recv_getName(); return result; }
protected getName_result getResult(I iface, getName_args args) throws org.apache.thrift7.TException { getName_result result = new getName_result(); <DeepExtract> send_getName(); return recv_getName(); </DeepExtract> return result; }
storm-scribe
positive
440,610
public final void setValue(String value, boolean showName) { if (showName) setText(id + ": " + value); else setText(value); setToolTipText(id + ": " + value); FontMetrics fm = getFontMetrics(FONT); int w = fm.stringWidth(getText()) + 4; int h = fm.getHeight() + 4; setSize(w, h); }
public final void setValue(String value, boolean showName) { if (showName) setText(id + ": " + value); else setText(value); setToolTipText(id + ": " + value); <DeepExtract> FontMetrics fm = getFontMetrics(FONT); int w = fm.stringWidth(getText()) + 4; int h = fm.getHeight() + 4; setSize(w, h); </DeepExtract> }
drmips
positive
440,612
public Builder addAllOutboundReferenceIds(java.lang.Iterable<java.lang.String> values) { if (!((bitField0_ & 0x00000020) == 0x00000020)) { outboundReferenceIds_ = new com.google.protobuf.LazyStringArrayList(outboundReferenceIds_); bitField0_ |= 0x00000020; } com.google.protobuf.AbstractMessageLite.Builder.addAll(values, outboundReferenceIds_); onChanged(); return this; }
public Builder addAllOutboundReferenceIds(java.lang.Iterable<java.lang.String> values) { <DeepExtract> if (!((bitField0_ & 0x00000020) == 0x00000020)) { outboundReferenceIds_ = new com.google.protobuf.LazyStringArrayList(outboundReferenceIds_); bitField0_ |= 0x00000020; } </DeepExtract> com.google.protobuf.AbstractMessageLite.Builder.addAll(values, outboundReferenceIds_); onChanged(); return this; }
sharedstreets-builder
positive
440,614
public void mapInstances(Mapping mappings) { if (logger.isInfoEnabled()) { logger.info("<<<<<<< Start matching instance >>>>>>>"); } Context<PlainRDFNode, AnchorIdPair> context = new Context<>(); LookupTable subject2AnchorIds = new LookupTable(); constructLookupTable(subjectAnchors, subject2AnchorIds); LookupTable predicate2AnchorsIds = new LookupTable(); constructLookupTable(predicateAnchors, predicate2AnchorsIds); LookupTable object2AnchorsIds = new LookupTable(); constructLookupTable(objectAnchors, object2AnchorsIds); constructAnchorPairBasedContext(MatchType.INSTANCE, context, subject2AnchorIds, predicate2AnchorsIds, object2AnchorsIds); FCABuilder<PlainRDFNode, AnchorIdPair> fca = new FCABuilder<>(); if (logger.isInfoEnabled()) { logger.info("Init Formal Concept Analysis Builder..."); } fca.init(context); if (logger.isInfoEnabled()) { logger.info("Start formal concept analysis..."); } fca.exec(); if (isEnabledGSH) { if (logger.isInfoEnabled()) { logger.info(String.format("Start getting simplified concepts (Size of object: [%d, %d], Size of attribute: [%d, %d])...", lowerBoundOfGSHObjectsSize, upperBoundOfGSHObjectsSize, lowerBoundOfGSHAttributesSize, upperBoundOfGSHAttributesSize)); } Set<Set<PlainRDFNode>> simplifiedExtents = fca.listSimplifiedExtents(lowerBoundOfGSHObjectsSize, upperBoundOfGSHObjectsSize, lowerBoundOfGSHAttributesSize, upperBoundOfGSHAttributesSize); if (logger.isInfoEnabled()) { logger.info("Finish getting simplified concepts!"); } for (Set<PlainRDFNode> candidatePool : simplifiedExtents) { matchPlainRDFNodes(candidatePool, mappings); } if (logger.isInfoEnabled()) { logger.info("Finish extracting mappings from simplified concepts!"); } } if (isEnabledLattice) { if (logger.isInfoEnabled()) { logger.info(String.format("Start building complete concepts (Size of object: [%d, %d], Size of attribute: [%d, %d])...", lowerBoundOfLatticeObjectsSize, upperBoundOfLatticeObjectsSize, lowerBoundOfLatticeAttributesSize, upperBoundOfLatticeAttributesSize)); } Set<Set<PlainRDFNode>> extents = fca.listExtents(lowerBoundOfLatticeObjectsSize, upperBoundOfLatticeObjectsSize, lowerBoundOfLatticeAttributesSize, upperBoundOfLatticeAttributesSize, maximumSizeOfConcepts); if (logger.isInfoEnabled()) { logger.info("Finish building complete concepts!"); if (!fca.isComplete()) { logger.info("NOTE: NOT complete concept!"); } } for (Set<PlainRDFNode> candidatePool : extents) { matchPlainRDFNodes(candidatePool, mappings); } if (logger.isInfoEnabled()) { logger.info("Finish extracting mappings from complete concepts!"); } } fca.clear(); if (logger.isInfoEnabled()) { logger.info("Finish analysis!"); } }
public void mapInstances(Mapping mappings) { if (logger.isInfoEnabled()) { logger.info("<<<<<<< Start matching instance >>>>>>>"); } <DeepExtract> Context<PlainRDFNode, AnchorIdPair> context = new Context<>(); LookupTable subject2AnchorIds = new LookupTable(); constructLookupTable(subjectAnchors, subject2AnchorIds); LookupTable predicate2AnchorsIds = new LookupTable(); constructLookupTable(predicateAnchors, predicate2AnchorsIds); LookupTable object2AnchorsIds = new LookupTable(); constructLookupTable(objectAnchors, object2AnchorsIds); constructAnchorPairBasedContext(MatchType.INSTANCE, context, subject2AnchorIds, predicate2AnchorsIds, object2AnchorsIds); FCABuilder<PlainRDFNode, AnchorIdPair> fca = new FCABuilder<>(); if (logger.isInfoEnabled()) { logger.info("Init Formal Concept Analysis Builder..."); } fca.init(context); if (logger.isInfoEnabled()) { logger.info("Start formal concept analysis..."); } fca.exec(); if (isEnabledGSH) { if (logger.isInfoEnabled()) { logger.info(String.format("Start getting simplified concepts (Size of object: [%d, %d], Size of attribute: [%d, %d])...", lowerBoundOfGSHObjectsSize, upperBoundOfGSHObjectsSize, lowerBoundOfGSHAttributesSize, upperBoundOfGSHAttributesSize)); } Set<Set<PlainRDFNode>> simplifiedExtents = fca.listSimplifiedExtents(lowerBoundOfGSHObjectsSize, upperBoundOfGSHObjectsSize, lowerBoundOfGSHAttributesSize, upperBoundOfGSHAttributesSize); if (logger.isInfoEnabled()) { logger.info("Finish getting simplified concepts!"); } for (Set<PlainRDFNode> candidatePool : simplifiedExtents) { matchPlainRDFNodes(candidatePool, mappings); } if (logger.isInfoEnabled()) { logger.info("Finish extracting mappings from simplified concepts!"); } } if (isEnabledLattice) { if (logger.isInfoEnabled()) { logger.info(String.format("Start building complete concepts (Size of object: [%d, %d], Size of attribute: [%d, %d])...", lowerBoundOfLatticeObjectsSize, upperBoundOfLatticeObjectsSize, lowerBoundOfLatticeAttributesSize, upperBoundOfLatticeAttributesSize)); } Set<Set<PlainRDFNode>> extents = fca.listExtents(lowerBoundOfLatticeObjectsSize, upperBoundOfLatticeObjectsSize, lowerBoundOfLatticeAttributesSize, upperBoundOfLatticeAttributesSize, maximumSizeOfConcepts); if (logger.isInfoEnabled()) { logger.info("Finish building complete concepts!"); if (!fca.isComplete()) { logger.info("NOTE: NOT complete concept!"); } } for (Set<PlainRDFNode> candidatePool : extents) { matchPlainRDFNodes(candidatePool, mappings); } if (logger.isInfoEnabled()) { logger.info("Finish extracting mappings from complete concepts!"); } } fca.clear(); if (logger.isInfoEnabled()) { logger.info("Finish analysis!"); } </DeepExtract> }
FCA-Map
positive
440,615
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.hoodlib_menu_pophood, menu); MenuItem item = menu.findItem(R.id.action_refresh); Drawable icon = DrawableCompat.wrap(item.getIcon()); @ColorInt int color; TypedValue typedValue = new TypedValue(); if (getTheme().resolveAttribute(R.attr.hoodToolbarTextColor, typedValue, true)) { color = typedValue.data; } else { color = Color.WHITE; } DrawableCompat.setTint(icon, color); item.setIcon(icon); MenuItem item = menu.findItem(R.id.action_app_info); Drawable icon = DrawableCompat.wrap(item.getIcon()); @ColorInt int color; TypedValue typedValue = new TypedValue(); if (getTheme().resolveAttribute(R.attr.hoodToolbarTextColor, typedValue, true)) { color = typedValue.data; } else { color = Color.WHITE; } DrawableCompat.setTint(icon, color); item.setIcon(icon); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.hoodlib_menu_pophood, menu); MenuItem item = menu.findItem(R.id.action_refresh); Drawable icon = DrawableCompat.wrap(item.getIcon()); @ColorInt int color; TypedValue typedValue = new TypedValue(); if (getTheme().resolveAttribute(R.attr.hoodToolbarTextColor, typedValue, true)) { color = typedValue.data; } else { color = Color.WHITE; } DrawableCompat.setTint(icon, color); item.setIcon(icon); <DeepExtract> MenuItem item = menu.findItem(R.id.action_app_info); Drawable icon = DrawableCompat.wrap(item.getIcon()); @ColorInt int color; TypedValue typedValue = new TypedValue(); if (getTheme().resolveAttribute(R.attr.hoodToolbarTextColor, typedValue, true)) { color = typedValue.data; } else { color = Color.WHITE; } DrawableCompat.setTint(icon, color); item.setIcon(icon); </DeepExtract> return true; }
under-the-hood
positive
440,616
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { Tessellator v5 = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); BlendMode.DEFAULT.apply(); GL11.glColor3f(1, 1, 1); v5.startDrawingQuads(); BlockShapedRock b = (BlockShapedRock) block; IIcon ico = RockTypes.getTypeFromID(block).getIcon(); float u = ico.getMinU(); float du = ico.getMaxU(); float v = ico.getMinV(); float dv = ico.getMaxV(); IIcon ico2 = Blocks.glass.getIcon(0, 0); float u2 = ico2.getMinU(); float du2 = ico2.getMaxU(); float v2 = ico2.getMinV(); float dv2 = ico2.getMaxV(); float dx = -0.5F; float dy = -0.5F; float dz = -0.5F; v5.addTranslation(dx, dy, dz); Tessellator v5 = Tessellator.instance; int color = b.getRenderColor(metadata); Color c = new Color(color); float u = ico.getMinU(); float du = ico.getMaxU(); float v = ico.getMinV(); float dv = ico.getMaxV(); this.faceBrightnessNoWorld(ForgeDirection.DOWN, v5, c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F); v5.setNormal(0, 1, 0); v5.addVertexWithUV(1, 1, 0, u, dv); v5.addVertexWithUV(0, 1, 0, u, v); v5.addVertexWithUV(0, 1, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.UP, v5, c.getRed() / 512F, c.getGreen() / 512F, c.getBlue() / 512F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(1, 0, 0, du, v); v5.addVertexWithUV(1, 0, 1, u, v); v5.addVertexWithUV(0, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.EAST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(1, 0, 0, du, dv); v5.addVertexWithUV(1, 1, 0, du, v); v5.addVertexWithUV(1, 1, 1, u, v); v5.addVertexWithUV(1, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.WEST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(0, 1, 0, u, dv); v5.addVertexWithUV(0, 0, 0, u, v); v5.addVertexWithUV(0, 0, 1, du, v); v5.addVertexWithUV(0, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.SOUTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 1, 1, u, dv); v5.addVertexWithUV(0, 0, 1, u, v); v5.addVertexWithUV(1, 0, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.NORTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(0, 1, 0, du, v); v5.addVertexWithUV(1, 1, 0, u, v); v5.addVertexWithUV(1, 0, 0, u, dv); v5.addTranslation(-dx, -dy, -dz); v5.draw(); v5.startDrawingQuads(); v5.addTranslation(dx, dy, dz); blend1 = GL11.glGetInteger(GL11.GL_BLEND_SRC); blend2 = GL11.glGetInteger(GL11.GL_BLEND_DST); GL11.glEnable(GL11.GL_BLEND); BlendMode.PREALPHA.apply(); Tessellator v5 = Tessellator.instance; int color = b.getRenderColor(metadata); Color c = new Color(color); float u = ico2.getMinU(); float du = ico2.getMaxU(); float v = ico2.getMinV(); float dv = ico2.getMaxV(); this.faceBrightnessNoWorld(ForgeDirection.DOWN, v5, c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F); v5.setNormal(0, 1, 0); v5.addVertexWithUV(1, 1, 0, u, dv); v5.addVertexWithUV(0, 1, 0, u, v); v5.addVertexWithUV(0, 1, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.UP, v5, c.getRed() / 512F, c.getGreen() / 512F, c.getBlue() / 512F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(1, 0, 0, du, v); v5.addVertexWithUV(1, 0, 1, u, v); v5.addVertexWithUV(0, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.EAST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(1, 0, 0, du, dv); v5.addVertexWithUV(1, 1, 0, du, v); v5.addVertexWithUV(1, 1, 1, u, v); v5.addVertexWithUV(1, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.WEST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(0, 1, 0, u, dv); v5.addVertexWithUV(0, 0, 0, u, v); v5.addVertexWithUV(0, 0, 1, du, v); v5.addVertexWithUV(0, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.SOUTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 1, 1, u, dv); v5.addVertexWithUV(0, 0, 1, u, v); v5.addVertexWithUV(1, 0, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.NORTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(0, 1, 0, du, v); v5.addVertexWithUV(1, 1, 0, u, v); v5.addVertexWithUV(1, 0, 0, u, dv); v5.addTranslation(-dx, -dy, -dz); v5.draw(); GL11.glBlendFunc(blend1, blend2); GL11.glDisable(GL11.GL_BLEND); }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { Tessellator v5 = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); BlendMode.DEFAULT.apply(); GL11.glColor3f(1, 1, 1); v5.startDrawingQuads(); BlockShapedRock b = (BlockShapedRock) block; IIcon ico = RockTypes.getTypeFromID(block).getIcon(); float u = ico.getMinU(); float du = ico.getMaxU(); float v = ico.getMinV(); float dv = ico.getMaxV(); IIcon ico2 = Blocks.glass.getIcon(0, 0); float u2 = ico2.getMinU(); float du2 = ico2.getMaxU(); float v2 = ico2.getMinV(); float dv2 = ico2.getMaxV(); float dx = -0.5F; float dy = -0.5F; float dz = -0.5F; v5.addTranslation(dx, dy, dz); Tessellator v5 = Tessellator.instance; int color = b.getRenderColor(metadata); Color c = new Color(color); float u = ico.getMinU(); float du = ico.getMaxU(); float v = ico.getMinV(); float dv = ico.getMaxV(); this.faceBrightnessNoWorld(ForgeDirection.DOWN, v5, c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F); v5.setNormal(0, 1, 0); v5.addVertexWithUV(1, 1, 0, u, dv); v5.addVertexWithUV(0, 1, 0, u, v); v5.addVertexWithUV(0, 1, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.UP, v5, c.getRed() / 512F, c.getGreen() / 512F, c.getBlue() / 512F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(1, 0, 0, du, v); v5.addVertexWithUV(1, 0, 1, u, v); v5.addVertexWithUV(0, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.EAST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(1, 0, 0, du, dv); v5.addVertexWithUV(1, 1, 0, du, v); v5.addVertexWithUV(1, 1, 1, u, v); v5.addVertexWithUV(1, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.WEST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(0, 1, 0, u, dv); v5.addVertexWithUV(0, 0, 0, u, v); v5.addVertexWithUV(0, 0, 1, du, v); v5.addVertexWithUV(0, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.SOUTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 1, 1, u, dv); v5.addVertexWithUV(0, 0, 1, u, v); v5.addVertexWithUV(1, 0, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.NORTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(0, 1, 0, du, v); v5.addVertexWithUV(1, 1, 0, u, v); v5.addVertexWithUV(1, 0, 0, u, dv); v5.addTranslation(-dx, -dy, -dz); v5.draw(); v5.startDrawingQuads(); v5.addTranslation(dx, dy, dz); blend1 = GL11.glGetInteger(GL11.GL_BLEND_SRC); blend2 = GL11.glGetInteger(GL11.GL_BLEND_DST); GL11.glEnable(GL11.GL_BLEND); BlendMode.PREALPHA.apply(); Tessellator v5 = Tessellator.instance; int color = b.getRenderColor(metadata); Color c = new Color(color); float u = ico2.getMinU(); float du = ico2.getMaxU(); float v = ico2.getMinV(); float dv = ico2.getMaxV(); this.faceBrightnessNoWorld(ForgeDirection.DOWN, v5, c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F); v5.setNormal(0, 1, 0); v5.addVertexWithUV(1, 1, 0, u, dv); v5.addVertexWithUV(0, 1, 0, u, v); v5.addVertexWithUV(0, 1, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.UP, v5, c.getRed() / 512F, c.getGreen() / 512F, c.getBlue() / 512F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(1, 0, 0, du, v); v5.addVertexWithUV(1, 0, 1, u, v); v5.addVertexWithUV(0, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.EAST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(1, 0, 0, du, dv); v5.addVertexWithUV(1, 1, 0, du, v); v5.addVertexWithUV(1, 1, 1, u, v); v5.addVertexWithUV(1, 0, 1, u, dv); this.faceBrightnessNoWorld(ForgeDirection.WEST, v5, c.getRed() / 425F, c.getGreen() / 425F, c.getBlue() / 425F); v5.addVertexWithUV(0, 1, 0, u, dv); v5.addVertexWithUV(0, 0, 0, u, v); v5.addVertexWithUV(0, 0, 1, du, v); v5.addVertexWithUV(0, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.SOUTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 1, 1, u, dv); v5.addVertexWithUV(0, 0, 1, u, v); v5.addVertexWithUV(1, 0, 1, du, v); v5.addVertexWithUV(1, 1, 1, du, dv); this.faceBrightnessNoWorld(ForgeDirection.NORTH, v5, c.getRed() / 364F, c.getGreen() / 364F, c.getBlue() / 364F); v5.addVertexWithUV(0, 0, 0, du, dv); v5.addVertexWithUV(0, 1, 0, du, v); v5.addVertexWithUV(1, 1, 0, u, v); v5.addVertexWithUV(1, 0, 0, u, dv); v5.addTranslation(-dx, -dy, -dz); v5.draw(); <DeepExtract> GL11.glBlendFunc(blend1, blend2); GL11.glDisable(GL11.GL_BLEND); </DeepExtract> }
GeoStrata
positive
440,618
@Override public String call() throws Exception { return options.getBindAddress(); }
@Override public String call() throws Exception { <DeepExtract> return options.getBindAddress(); </DeepExtract> }
gwt-gradle-plugin
positive
440,621
@Rpc(name = "forceKeyspaceCompactionForTokenRange") public String forceKeyspaceCompactionForTokenRange(@RpcParam(name = "keyspaceName") String keyspaceName, @RpcParam(name = "startToken") String startToken, @RpcParam(name = "endToken") String endToken, @RpcParam(name = "tableNames") List<String> tableNames, @RpcParam(name = "async") boolean async) throws InterruptedException, ExecutionException, IOException { logger.debug("Forcing keyspace compaction for token range on keyspace {}", keyspaceName); final List<String> keyspaces = new ArrayList<>(); if (keyspaceName != null && keyspaceName.toUpperCase().equals("ALL")) { keyspaces.addAll(ShimLoader.instance.get().getStorageService().getKeyspaces()); } else { keyspaces.add(keyspaceName); } Runnable compactionOperation = () -> { for (String keyspace : keyspaces) { try { ShimLoader.instance.get().getStorageService().forceKeyspaceCompactionForTokenRange(keyspace, startToken, endToken, tableNames.toArray(new String[] {})); } catch (IOException | ExecutionException | InterruptedException e) { throw new RuntimeException(e); } } }; Pair<String, CompletableFuture<Void>> jobPair = service.submit(OperationType.COMPACTION.name(), compactionOperation); if (!async) { jobPair.right.join(); } return jobPair.left; }
@Rpc(name = "forceKeyspaceCompactionForTokenRange") public String forceKeyspaceCompactionForTokenRange(@RpcParam(name = "keyspaceName") String keyspaceName, @RpcParam(name = "startToken") String startToken, @RpcParam(name = "endToken") String endToken, @RpcParam(name = "tableNames") List<String> tableNames, @RpcParam(name = "async") boolean async) throws InterruptedException, ExecutionException, IOException { logger.debug("Forcing keyspace compaction for token range on keyspace {}", keyspaceName); final List<String> keyspaces = new ArrayList<>(); if (keyspaceName != null && keyspaceName.toUpperCase().equals("ALL")) { keyspaces.addAll(ShimLoader.instance.get().getStorageService().getKeyspaces()); } else { keyspaces.add(keyspaceName); } Runnable compactionOperation = () -> { for (String keyspace : keyspaces) { try { ShimLoader.instance.get().getStorageService().forceKeyspaceCompactionForTokenRange(keyspace, startToken, endToken, tableNames.toArray(new String[] {})); } catch (IOException | ExecutionException | InterruptedException e) { throw new RuntimeException(e); } } }; <DeepExtract> Pair<String, CompletableFuture<Void>> jobPair = service.submit(OperationType.COMPACTION.name(), compactionOperation); if (!async) { jobPair.right.join(); } return jobPair.left; </DeepExtract> }
management-api-for-apache-cassandra
positive
440,622
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getSession().setAttribute("school", "henu"); response.sendRedirect("servlet/SchoolServlet"); return; }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <DeepExtract> request.getSession().setAttribute("school", "henu"); response.sendRedirect("servlet/SchoolServlet"); return; </DeepExtract> }
superdaxue
positive
440,623
public Criteria andRecordIdIsNotNull() { if ("record_id is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("record_id is not null")); return (Criteria) this; }
public Criteria andRecordIdIsNotNull() { <DeepExtract> if ("record_id is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("record_id is not null")); </DeepExtract> return (Criteria) this; }
ReptilianDemo
positive
440,624
@Override public void onFailure(Call<CustomerOnlineDataModel> call, Throwable t) { Log.d(TAG, "onFailure: " + t.getMessage()); Intent intent = new Intent("completationMessage"); intent.putExtra("percentage", 40); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); Log.d(TAG, "onResponse: ------------ customer 40"); customerDataReceived = true; }
@Override public void onFailure(Call<CustomerOnlineDataModel> call, Throwable t) { Log.d(TAG, "onFailure: " + t.getMessage()); <DeepExtract> Intent intent = new Intent("completationMessage"); intent.putExtra("percentage", 40); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); </DeepExtract> Log.d(TAG, "onResponse: ------------ customer 40"); customerDataReceived = true; }
Android-POS
positive
440,625
private String apiRequest(String url, HttpMethods.RequestMethods requestType, HashMap<String, Object> parameters, HashMap<String, Object> options) throws IOException { if (log.isDebugEnabled()) { log.debug(String.format("Sending a %s request to %s with parameters: %s and options %s", requestType, url, parameters, options)); } Request.Builder request = new Request.Builder(); switch(requestType) { case GET: case HEAD: case DELETE: HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder(); if (parameters != null) { parameters.forEach((key, value) -> { httpBuilder.addQueryParameter(key, value.toString()); }); } request.url(httpBuilder.build().url()); break; default: request.url(url); break; } FormBody.Builder body = new FormBody.Builder(); if (parameters != null) { for (String key : parameters.keySet()) { String parameterValue = parameters.get(key) instanceof String != true ? String.valueOf(parameters.get(key)) : (String) parameters.get(key); body.add(key, parameterValue); } } boolean requiresAuth = !(url.contains("sessions") && requestType == HttpMethods.RequestMethods.POST); if (requiresAuth) { if (options.containsKey("session_id")) { if (!(options.get("session_id") instanceof String)) { throw new InvalidParameterException("Bad option: session_id must be of type String"); } request.header("X-FilesApi-Auth", (String) options.get("session_id")); } else if (options.containsKey("api_key")) { if (!(options.get("api_key") instanceof String)) { throw new InvalidParameterException("Bad option: api_key must be of type string"); } request.header("X-FilesApi-Key", (String) options.get("api_key")); } else if (FilesClient.session != null && FilesClient.session.getId().length() > 0) { request.header("X-FilesApi-Auth", FilesClient.session.getId()); } else if (FilesClient.apiKey != null && FilesClient.apiKey.length() > 0) { request.header("X-FilesApi-Key", FilesClient.apiKey); } else { throw new InvalidParameterException(String.format("Authentication required for API request: %s %s", url, requestType)); } } switch(requestType) { case DELETE: request.delete(body.build()); break; case GET: break; case HEAD: request.head(); break; case PATCH: request.patch(body.build()); break; case POST: request.post(body.build()); break; case PUT: request.put(body.build()); break; } Response response = FilesHttpClient.getHttpClient().newCall(request.build()).execute(); String responseBody = response.body().string(); response.body().close(); return responseBody; }
private String apiRequest(String url, HttpMethods.RequestMethods requestType, HashMap<String, Object> parameters, HashMap<String, Object> options) throws IOException { if (log.isDebugEnabled()) { log.debug(String.format("Sending a %s request to %s with parameters: %s and options %s", requestType, url, parameters, options)); } Request.Builder request = new Request.Builder(); switch(requestType) { case GET: case HEAD: case DELETE: HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder(); if (parameters != null) { parameters.forEach((key, value) -> { httpBuilder.addQueryParameter(key, value.toString()); }); } request.url(httpBuilder.build().url()); break; default: request.url(url); break; } FormBody.Builder body = new FormBody.Builder(); if (parameters != null) { for (String key : parameters.keySet()) { String parameterValue = parameters.get(key) instanceof String != true ? String.valueOf(parameters.get(key)) : (String) parameters.get(key); body.add(key, parameterValue); } } boolean requiresAuth = !(url.contains("sessions") && requestType == HttpMethods.RequestMethods.POST); if (requiresAuth) { if (options.containsKey("session_id")) { if (!(options.get("session_id") instanceof String)) { throw new InvalidParameterException("Bad option: session_id must be of type String"); } request.header("X-FilesApi-Auth", (String) options.get("session_id")); } else if (options.containsKey("api_key")) { if (!(options.get("api_key") instanceof String)) { throw new InvalidParameterException("Bad option: api_key must be of type string"); } request.header("X-FilesApi-Key", (String) options.get("api_key")); } else if (FilesClient.session != null && FilesClient.session.getId().length() > 0) { request.header("X-FilesApi-Auth", FilesClient.session.getId()); } else if (FilesClient.apiKey != null && FilesClient.apiKey.length() > 0) { request.header("X-FilesApi-Key", FilesClient.apiKey); } else { throw new InvalidParameterException(String.format("Authentication required for API request: %s %s", url, requestType)); } } <DeepExtract> switch(requestType) { case DELETE: request.delete(body.build()); break; case GET: break; case HEAD: request.head(); break; case PATCH: request.patch(body.build()); break; case POST: request.post(body.build()); break; case PUT: request.put(body.build()); break; } </DeepExtract> Response response = FilesHttpClient.getHttpClient().newCall(request.build()).execute(); String responseBody = response.body().string(); response.body().close(); return responseBody; }
files-sdk-java
positive
440,626
public ClassMirror[] getExceptionTypes() { ClassMirror[] result = new ClassMirror[method.getExceptionTypes().length]; for (int i = 0; i < method.getExceptionTypes().length; i++) { result[i] = RuntimeClassMirror.forClass(method.getExceptionTypes()[i]); } return result; }
public ClassMirror[] getExceptionTypes() { <DeepExtract> ClassMirror[] result = new ClassMirror[method.getExceptionTypes().length]; for (int i = 0; i < method.getExceptionTypes().length; i++) { result[i] = RuntimeClassMirror.forClass(method.getExceptionTypes()[i]); } return result; </DeepExtract> }
kilim-erjang
positive
440,627
private void sendTxrej() { ProtocolControlFrame rej = mkAck(ProtocolControlFrame.TXREJ); InfoElement nip = new InfoElement(); nip.causecode = new Integer(29); nip.cause = "Facility rejected"; ByteBuffer buff = ByteBuffer.allocate(2048); buff.putChar((char) (0x8000 | _sCall)); int rd = _dCall; if (_retry) { rd |= 0x8000; } buff.putChar((char) rd); long tst = this.getTimestampVal(); tst = ((0x100000000L & tst) > 0) ? tst - 0x100000000L : tst; buff.putInt((int) tst); buff.put((byte) _oseq); buff.put((byte) _iseq); buff.put((byte) _frametype); int sc = _subclass; if (_cbit) { sc |= 0x80; } buff.put((byte) sc); if (nip != null) { nip.update(buff); } sendAndStore(buff); }
private void sendTxrej() { ProtocolControlFrame rej = mkAck(ProtocolControlFrame.TXREJ); InfoElement nip = new InfoElement(); nip.causecode = new Integer(29); nip.cause = "Facility rejected"; <DeepExtract> ByteBuffer buff = ByteBuffer.allocate(2048); buff.putChar((char) (0x8000 | _sCall)); int rd = _dCall; if (_retry) { rd |= 0x8000; } buff.putChar((char) rd); long tst = this.getTimestampVal(); tst = ((0x100000000L & tst) > 0) ? tst - 0x100000000L : tst; buff.putInt((int) tst); buff.put((byte) _oseq); buff.put((byte) _iseq); buff.put((byte) _frametype); int sc = _subclass; if (_cbit) { sc |= 0x80; } buff.put((byte) sc); if (nip != null) { nip.update(buff); } sendAndStore(buff); </DeepExtract> }
asterisk-java-iax
positive
440,628
@Override public void writeTo(MemoryOutputStream mos) { mos.write(this.presence); Bytes.writeUInt(mos, this.repetitionLevel); Bytes.writeUInt(mos, this.definitionLevel); Bytes.writeSInt(mos, type); Bytes.writeUInt(mos, encoding); Bytes.writeUInt(mos, compression); Bytes.writeUInt(mos, columnIndex); Bytes.writeUInt(mos, enclosingEmptyDefinitionLevel); }
@Override public void writeTo(MemoryOutputStream mos) { <DeepExtract> mos.write(this.presence); Bytes.writeUInt(mos, this.repetitionLevel); Bytes.writeUInt(mos, this.definitionLevel); </DeepExtract> Bytes.writeSInt(mos, type); Bytes.writeUInt(mos, encoding); Bytes.writeUInt(mos, compression); Bytes.writeUInt(mos, columnIndex); Bytes.writeUInt(mos, enclosingEmptyDefinitionLevel); }
dendrite
positive
440,633
@Override public void onItemLongClick(int position) { if (!isMultiSelect) { multiSelectDataList.clear(); isMultiSelect = true; if (mActionMode == null) { mActionMode = startActionMode(mActionModeCallback); } mActionMode.setTitle(multiSelectDataList.size() + getString(R.string.selected)); } if (mActionMode != null) { if (multiSelectDataList.contains(dataList.get(position))) { multiSelectDataList.remove(dataList.get(position)); } else { if (dataList.get(position) != null) { OcrResult doc = dataList.get(position); multiSelectDataList.add(doc); } } mActionMode.setTitle(multiSelectDataList.size() + getString(R.string.selected)); adapter.notifyItemRangeChanged(position, 1); } }
@Override public void onItemLongClick(int position) { if (!isMultiSelect) { multiSelectDataList.clear(); isMultiSelect = true; if (mActionMode == null) { mActionMode = startActionMode(mActionModeCallback); } mActionMode.setTitle(multiSelectDataList.size() + getString(R.string.selected)); } <DeepExtract> if (mActionMode != null) { if (multiSelectDataList.contains(dataList.get(position))) { multiSelectDataList.remove(dataList.get(position)); } else { if (dataList.get(position) != null) { OcrResult doc = dataList.get(position); multiSelectDataList.add(doc); } } mActionMode.setTitle(multiSelectDataList.size() + getString(R.string.selected)); adapter.notifyItemRangeChanged(position, 1); } </DeepExtract> }
OCRme
positive
440,634
@Override public void onClick(DialogInterface dialog, int which) { if (ApplicationUtils.checkCardState(this, true)) { mProgressDialog = ProgressDialog.show(this, this.getResources().getString(R.string.Commons_PleaseWait), this.getResources().getString(R.string.Commons_ImportingHistoryBookmarks)); XmlHistoryBookmarksImporter importer = new XmlHistoryBookmarksImporter(this, choices[which], mProgressDialog); new Thread(importer).start(); } dialog.dismiss(); }
@Override public void onClick(DialogInterface dialog, int which) { <DeepExtract> if (ApplicationUtils.checkCardState(this, true)) { mProgressDialog = ProgressDialog.show(this, this.getResources().getString(R.string.Commons_PleaseWait), this.getResources().getString(R.string.Commons_ImportingHistoryBookmarks)); XmlHistoryBookmarksImporter importer = new XmlHistoryBookmarksImporter(this, choices[which], mProgressDialog); new Thread(importer).start(); } </DeepExtract> dialog.dismiss(); }
zirco-browser
positive
440,635
public static void main(String[] args) { try { System.out.println("blocco try esterno"); try { System.out.println("blocco try interno"); throw new Exception("CIAO dall'interno"); } catch (ArithmeticException e) { System.out.println("dentro CATCH interno"); } finally { System.out.println("dentro FINALLY interno"); } } catch (Exception e) { System.out.println("blocco CATCH esterno"); } finally { System.out.println("blocco FINALLY esterno"); } }
public static void main(String[] args) { <DeepExtract> try { System.out.println("blocco try esterno"); try { System.out.println("blocco try interno"); throw new Exception("CIAO dall'interno"); } catch (ArithmeticException e) { System.out.println("dentro CATCH interno"); } finally { System.out.println("dentro FINALLY interno"); } } catch (Exception e) { System.out.println("blocco CATCH esterno"); } finally { System.out.println("blocco FINALLY esterno"); } </DeepExtract> }
CorsoJava
positive
440,636
@RequestMapping(value = "/url.json", method = RequestMethod.POST) @ResponseBody public Map extractContentFromUrl(@RequestBody ExtractForm extractForm, HttpServletRequest request, HttpServletResponse response) { Map errors = new HashMap(); String url = extractForm.getUrl(); if (StringUtils.isBlank(url)) { errors.put("url.required", "Url is required and cannot be blank"); } List<String> components = extractForm.getComponents(); boolean hasComponents = (components != null && components.size() > 0); List<String> pipelines = extractForm.getPipelines(); boolean hasPipelines = (pipelines != null && pipelines.size() > 0); if (!hasComponents && !hasPipelines) { errors.put("processors.required", "One or more components or pipelines must be specified to process " + "content"); } if (errors.size() > 0) { return errors; } extractForm.getMetadata().put("url", url); Map output = new HashMap(); try { content = httpClientService.get(url); } catch (Exception e) { Map<String, String> errMap = getErrors(e); errors.put("errors", errMap); return errors; } if (content == null || content.length == 0) { return output; } HashSet<String> componetSet = new HashSet<String>(); componetSet.addAll(components); HashSet<String> pipelineSet = new HashSet<String>(); pipelineSet.addAll(pipelines); Map output = new HashMap(); if (content != null && content.length > 0) { Extract extract = new Extract(content); extract.setPipelines(pipelineSet); extract.setComponents(componetSet); extract.setConfig(extractForm.getConfig()); extract.setMetadata(extractForm.getMetadata()); try { htmlExtractor.extract(extract); output = extract.getExtracted(); } catch (Exception e) { LOG.error("Error extracting content", e); } } return output; }
@RequestMapping(value = "/url.json", method = RequestMethod.POST) @ResponseBody public Map extractContentFromUrl(@RequestBody ExtractForm extractForm, HttpServletRequest request, HttpServletResponse response) { Map errors = new HashMap(); String url = extractForm.getUrl(); if (StringUtils.isBlank(url)) { errors.put("url.required", "Url is required and cannot be blank"); } List<String> components = extractForm.getComponents(); boolean hasComponents = (components != null && components.size() > 0); List<String> pipelines = extractForm.getPipelines(); boolean hasPipelines = (pipelines != null && pipelines.size() > 0); if (!hasComponents && !hasPipelines) { errors.put("processors.required", "One or more components or pipelines must be specified to process " + "content"); } if (errors.size() > 0) { return errors; } extractForm.getMetadata().put("url", url); Map output = new HashMap(); try { content = httpClientService.get(url); } catch (Exception e) { Map<String, String> errMap = getErrors(e); errors.put("errors", errMap); return errors; } if (content == null || content.length == 0) { return output; } HashSet<String> componetSet = new HashSet<String>(); componetSet.addAll(components); HashSet<String> pipelineSet = new HashSet<String>(); pipelineSet.addAll(pipelines); <DeepExtract> Map output = new HashMap(); if (content != null && content.length > 0) { Extract extract = new Extract(content); extract.setPipelines(pipelineSet); extract.setComponents(componetSet); extract.setConfig(extractForm.getConfig()); extract.setMetadata(extractForm.getMetadata()); try { htmlExtractor.extract(extract); output = extract.getExtracted(); } catch (Exception e) { LOG.error("Error extracting content", e); } } return output; </DeepExtract> }
meaningfulweb
positive
440,637
public void Share(ArticleTable articleTable) { pd.dismiss(); Intent intent = new Intent(Intent.ACTION_SEND); if ("" == null || "".equals("")) { intent.setType("text/plain"); } else { File f = new File(""); if (f != null && f.exists() && f.isFile()) { intent.setType("image/jpg"); Uri u = Uri.fromFile(f); intent.putExtra(Intent.EXTRA_STREAM, u); } } intent.putExtra(Intent.EXTRA_SUBJECT, "文章标题:" + articleTable.getA_title()); intent.putExtra(Intent.EXTRA_TEXT, "文章内容:" + articleTable.getA_content()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(intent, "文章标题:" + articleTable.getA_title())); }
public void Share(ArticleTable articleTable) { pd.dismiss(); <DeepExtract> Intent intent = new Intent(Intent.ACTION_SEND); if ("" == null || "".equals("")) { intent.setType("text/plain"); } else { File f = new File(""); if (f != null && f.exists() && f.isFile()) { intent.setType("image/jpg"); Uri u = Uri.fromFile(f); intent.putExtra(Intent.EXTRA_STREAM, u); } } intent.putExtra(Intent.EXTRA_SUBJECT, "文章标题:" + articleTable.getA_title()); intent.putExtra(Intent.EXTRA_TEXT, "文章内容:" + articleTable.getA_content()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(intent, "文章标题:" + articleTable.getA_title())); </DeepExtract> }
ChildrenEduction
positive
440,639
@Override public void clearTable() { Log.d(TAG, "Clear the table. Make it an empty one."); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); } else { Log.w(TAG, "clearTable: getSupportActionBar() = null. Do not set Display options!"); } invalidateOptionsMenu(); referee_.resetGame(); BoardFragment boardFragment = myBoardFragment_.get(); if (boardFragment != null) { boardFragment.resetBoard(); } PlayersFragment playersFragment = myPlayersFragment_.get(); if (playersFragment != null) { playersFragment.clearAll(); } MessageManager.getInstance().removeMessages(MessageInfo.MessageType.MESSAGE_TYPE_CHAT_IN_TABLE); if (tableController_.isGameInProgress()) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } }
@Override public void clearTable() { Log.d(TAG, "Clear the table. Make it an empty one."); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); } else { Log.w(TAG, "clearTable: getSupportActionBar() = null. Do not set Display options!"); } invalidateOptionsMenu(); referee_.resetGame(); BoardFragment boardFragment = myBoardFragment_.get(); if (boardFragment != null) { boardFragment.resetBoard(); } PlayersFragment playersFragment = myPlayersFragment_.get(); if (playersFragment != null) { playersFragment.clearAll(); } MessageManager.getInstance().removeMessages(MessageInfo.MessageType.MESSAGE_TYPE_CHAT_IN_TABLE); <DeepExtract> if (tableController_.isGameInProgress()) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } </DeepExtract> }
hoxChess
positive
440,642
@Override public boolean onLongClick(View v) { if (!SettingValues.actionbarVisible) { ValueAnimator a = flipAnimator(v.findViewById(R.id.menu).getVisibility() == View.VISIBLE, v.findViewById(R.id.secondMenu)); if (a != null) a.start(); for (View v2 : getViewsByTag((ViewGroup) v, "tintactionbar")) { if (v2.getId() == R.id.save) { if (SettingValues.saveButton) { if (v2.getVisibility() == View.VISIBLE) { animateOut(v2); } else { animateIn(v2); } } } else if (v2.getId() == R.id.hide) { if (SettingValues.hideButton) { if (v2.getVisibility() == View.VISIBLE) { animateOut(v2); } else { animateIn(v2); } } } else { if (v2.getVisibility() == View.VISIBLE) { animateOut(v2); } else { animateIn(v2); } } } } return true; }
@Override public boolean onLongClick(View v) { <DeepExtract> if (!SettingValues.actionbarVisible) { ValueAnimator a = flipAnimator(v.findViewById(R.id.menu).getVisibility() == View.VISIBLE, v.findViewById(R.id.secondMenu)); if (a != null) a.start(); for (View v2 : getViewsByTag((ViewGroup) v, "tintactionbar")) { if (v2.getId() == R.id.save) { if (SettingValues.saveButton) { if (v2.getVisibility() == View.VISIBLE) { animateOut(v2); } else { animateIn(v2); } } } else if (v2.getId() == R.id.hide) { if (SettingValues.hideButton) { if (v2.getVisibility() == View.VISIBLE) { animateOut(v2); } else { animateIn(v2); } } } else { if (v2.getVisibility() == View.VISIBLE) { animateOut(v2); } else { animateIn(v2); } } } } </DeepExtract> return true; }
Slide-RSS
positive
440,644
protected void onMore() { Map<String, String> params = new HashMap<String, String>(); showHeader(); if (m_currentActType == ACTIVITY_TYPE_REQUESTS) params.put("cat", "requests"); else if (m_currentActType == ACTIVITY_TYPE_UPDATES) params.put("cat", "notes"); if (true && m_actItemLast != null) { params.put("last", m_actItemLast); m_bAppendMode = true; } else m_bAppendMode = false; GlitchRequest request0 = m_application.glitch.getRequest("activity.feed", params); request0.execute(this); m_requestCount = 1; if (getActivity() != null) { ((HomeScreen) getActivity()).showSpinner(true); } }
protected void onMore() { <DeepExtract> Map<String, String> params = new HashMap<String, String>(); showHeader(); if (m_currentActType == ACTIVITY_TYPE_REQUESTS) params.put("cat", "requests"); else if (m_currentActType == ACTIVITY_TYPE_UPDATES) params.put("cat", "notes"); if (true && m_actItemLast != null) { params.put("last", m_actItemLast); m_bAppendMode = true; } else m_bAppendMode = false; GlitchRequest request0 = m_application.glitch.getRequest("activity.feed", params); request0.execute(this); m_requestCount = 1; if (getActivity() != null) { ((HomeScreen) getActivity()).showSpinner(true); } </DeepExtract> }
glitch-hq-android
positive
440,645
@Override public void reset() { state[0] = seed + PRIME1 + PRIME2; state[1] = seed + PRIME2; state[2] = seed; state[3] = seed - PRIME1; totalLen = 0; pos = 0; }
@Override public void reset() { <DeepExtract> state[0] = seed + PRIME1 + PRIME2; state[1] = seed + PRIME2; state[2] = seed; state[3] = seed - PRIME1; </DeepExtract> totalLen = 0; pos = 0; }
pivaa
positive
440,646
private void createComponents() { colorPanel = new JPanel(); super.add(colorPanel, BorderLayout.CENTER); ChangeListener listener = new ColorListener(); this.redSlider = new JSlider(0, 255, 255); this.redSlider.addChangeListener(listener); this.greenSlider = new JSlider(0, 255, 170); this.greenSlider.addChangeListener(listener); this.blueSlider = new JSlider(0, 255, 1); this.blueSlider.addChangeListener(listener); JPanel controlPanel = new JPanel(); controlPanel.setLayout(new GridLayout(4, 2)); controlPanel.add(new JLabel("Red")); controlPanel.add(this.redSlider); controlPanel.add(new JLabel("Green")); controlPanel.add(this.greenSlider); controlPanel.add(new JLabel("Blue")); controlPanel.add(this.blueSlider); JButton colorChooserButton = new JButton("Color chooser"); colorChooserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(null, "PIck a color", new Color(50, 50, 50)); setFrameColor(newColor); } }); controlPanel.add(colorChooserButton); super.add(controlPanel, BorderLayout.SOUTH); this.colorPanel.setBackground(new Color(this.redSlider.getValue(), this.greenSlider.getValue(), this.blueSlider.getValue())); this.colorPanel.repaint(); }
private void createComponents() { colorPanel = new JPanel(); super.add(colorPanel, BorderLayout.CENTER); ChangeListener listener = new ColorListener(); this.redSlider = new JSlider(0, 255, 255); this.redSlider.addChangeListener(listener); this.greenSlider = new JSlider(0, 255, 170); this.greenSlider.addChangeListener(listener); this.blueSlider = new JSlider(0, 255, 1); this.blueSlider.addChangeListener(listener); JPanel controlPanel = new JPanel(); controlPanel.setLayout(new GridLayout(4, 2)); controlPanel.add(new JLabel("Red")); controlPanel.add(this.redSlider); controlPanel.add(new JLabel("Green")); controlPanel.add(this.greenSlider); controlPanel.add(new JLabel("Blue")); controlPanel.add(this.blueSlider); JButton colorChooserButton = new JButton("Color chooser"); colorChooserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(null, "PIck a color", new Color(50, 50, 50)); setFrameColor(newColor); } }); controlPanel.add(colorChooserButton); super.add(controlPanel, BorderLayout.SOUTH); <DeepExtract> this.colorPanel.setBackground(new Color(this.redSlider.getValue(), this.greenSlider.getValue(), this.blueSlider.getValue())); this.colorPanel.repaint(); </DeepExtract> }
Books-solutions
positive
440,649
@Test public void canBeSortedOnWasted() { context.setSortMethod(SortMethod.wasted); context.setSortAscending(true); cut.sortDuplicateSets(); assertThat(getFirstDuplicatedFileState().getFileName()).isEqualTo("big_file_0"); context.setSortMethod(SortMethod.wasted); context.setSortAscending(false); cut.sortDuplicateSets(); assertThat(getFirstDuplicatedFileState().getFileName()).isEqualTo("file_0"); }
@Test public void canBeSortedOnWasted() { context.setSortMethod(SortMethod.wasted); context.setSortAscending(true); cut.sortDuplicateSets(); assertThat(getFirstDuplicatedFileState().getFileName()).isEqualTo("big_file_0"); <DeepExtract> context.setSortMethod(SortMethod.wasted); context.setSortAscending(false); cut.sortDuplicateSets(); assertThat(getFirstDuplicatedFileState().getFileName()).isEqualTo("file_0"); </DeepExtract> }
fim
positive
440,651
public void runBaseline() { rand.setSeed(0); System.out.println("INFO: Running query TPC-H q3"); int rand_3 = rand.nextInt(mktSegmentVals.length); String c_mktsegment = mktSegmentVals[rand_3]; Calendar c = new GregorianCalendar(); int dateOffset = (int) (rand.nextFloat() * (31 + 28 + 31)); c.set(1995, Calendar.MARCH, 01); c.add(Calendar.DAY_OF_MONTH, dateOffset); SimpleDate d3 = new SimpleDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); Predicate p1_3 = new Predicate(schemaCustomer.getAttributeId("c_mktsegment"), TYPE.STRING, c_mktsegment, PREDTYPE.LEQ); Predicate p2_3 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d3, PREDTYPE.LT); Predicate p3_3 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d3, PREDTYPE.GT); JoinQuery q_c = null; JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_orderkey"), new Predicate[] { p2_3 }); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p3_3 }); if (rand_3 > 0) { String c_mktsegment_prev = mktSegmentVals[rand_3 - 1]; Predicate p4_3 = new Predicate(schemaCustomer.getAttributeId("c_mktsegment"), TYPE.STRING, c_mktsegment_prev, PREDTYPE.GT); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_3, p4_3 }); } else { q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_3 }); } System.out.println("INFO: Query_cutomer:" + q_c.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); System.out.println("INFO: Query_lineitem:" + q_l.toString()); long start = System.currentTimeMillis(); String stringLineitem_join_Orders = stringLineitem + ", " + stringOrders; Schema schemaLineitem_join_Orders = Schema.createSchema(stringLineitem_join_Orders); JavaPairRDD<LongWritable, Text> lineitem_join_orders_rdd = sq.createJoinRDD(lineitem, q_l, orders, q_o, schemaLineitem_join_Orders.getAttributeId("o_custkey")); JavaPairRDD<LongWritable, Text> customer_rdd = sq.createScanRDD(customer, q_c); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = lineitem_join_orders_rdd.join(customer_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q5"); int rand_5 = rand.nextInt(regionNameVals.length); String r_name_5 = regionNameVals[rand_5]; int year_5 = 1993 + rand.nextInt(5); SimpleDate d5_1 = new SimpleDate(year_5, 1, 1); SimpleDate d5_2 = new SimpleDate(year_5 + 1, 1, 1); Predicate p1_5 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_5, PREDTYPE.LEQ); Predicate p2_5 = new Predicate(schemaSupplier.getAttributeId("s_region"), TYPE.STRING, r_name_5, PREDTYPE.LEQ); Predicate p3_5 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d5_1, PREDTYPE.GEQ); Predicate p4_5 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d5_2, PREDTYPE.LT); JoinQuery q_s = null; JoinQuery q_c = null; JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_custkey"), new Predicate[] { p3_5, p4_5 }); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_suppkey"), EmptyPredicates); if (rand_5 > 0) { String r_name_prev_5 = regionNameVals[rand_5 - 1]; Predicate p5_5 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_prev_5, PREDTYPE.GT); Predicate p6_5 = new Predicate(schemaSupplier.getAttributeId("s_region"), TYPE.STRING, r_name_prev_5, PREDTYPE.GT); q_s = new JoinQuery(supplier, schemaSupplier.getAttributeId("s_suppkey"), new Predicate[] { p2_5, p6_5 }); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_5, p5_5 }); } else { q_s = new JoinQuery(supplier, schemaSupplier.getAttributeId("s_suppkey"), new Predicate[] { p2_5 }); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_5 }); } System.out.println("INFO: Query_cutomer:" + q_c.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); System.out.println("INFO: Query_supplier:" + q_s.toString()); long start = System.currentTimeMillis(); String stringCustomer_join_Orders = stringCustomer + ", " + stringOrders; Schema schemaCustomer_join_Orders = Schema.createSchema(stringCustomer_join_Orders); String stringLineitem_join_Supplier = stringLineitem + ", " + stringSupplier; Schema schemaLineitem_join_Supplier = Schema.createSchema(stringLineitem_join_Supplier); JavaPairRDD<LongWritable, Text> customer_join_orders_rdd = sq.createJoinRDD(customer, q_c, orders, q_o, schemaCustomer_join_Orders.getAttributeId("o_orderkey")); JavaPairRDD<LongWritable, Text> lineitem_join_supplier_rdd = sq.createJoinRDD(lineitem, q_l, supplier, q_s, schemaLineitem_join_Supplier.getAttributeId("l_orderkey")); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = customer_join_orders_rdd.join(lineitem_join_supplier_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q6"); int year_6 = 1993 + rand.nextInt(5); SimpleDate d6_1 = new SimpleDate(year_6, 1, 1); SimpleDate d6_2 = new SimpleDate(year_6 + 1, 1, 1); double discount = rand.nextDouble() * 0.07 + 0.02; double quantity = rand.nextInt(2) + 24.0; Predicate p1_6 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d6_1, PREDTYPE.GEQ); Predicate p2_6 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d6_2, PREDTYPE.LT); Predicate p3_6 = new Predicate(schemaLineitem.getAttributeId("l_discount"), TYPE.DOUBLE, discount - 0.01, PREDTYPE.GT); Predicate p4_6 = new Predicate(schemaLineitem.getAttributeId("l_discount"), TYPE.DOUBLE, discount + 0.01, PREDTYPE.LEQ); Predicate p5_6 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TYPE.DOUBLE, quantity, PREDTYPE.LEQ); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_suppkey"), new Predicate[] { p1_6, p2_6, p3_6, p4_6, p5_6 }); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createScanRDD(lineitem, q_l); long result = rdd.count(); long end = System.currentTimeMillis(); System.out.println("RES: Time Taken: " + (end - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q8"); int rand_8_1 = rand.nextInt(regionNameVals.length); String r_name_8 = regionNameVals[rand_8_1]; SimpleDate d8_1 = new SimpleDate(1995, 1, 1); SimpleDate d8_2 = new SimpleDate(1996, 12, 31); String p_type_8 = partTypeVals[rand.nextInt(partTypeVals.length)]; Predicate p1_8 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_8, PREDTYPE.LEQ); Predicate p2_8 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d8_1, PREDTYPE.GEQ); Predicate p3_8 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d8_2, PREDTYPE.LEQ); Predicate p4_8 = new Predicate(schemaPart.getAttributeId("p_type"), TYPE.STRING, p_type_8, PREDTYPE.EQ); JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_custkey"), new Predicate[] { p2_8, p3_8 }); JoinQuery q_p = new JoinQuery(part, schemaPart.getAttributeId("p_partkey"), new Predicate[] { p4_8 }); JoinQuery q_c = null; JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), EmptyPredicates); if (rand_8_1 > 0) { String r_name_prev_8 = regionNameVals[rand_8_1 - 1]; Predicate p5_8 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_prev_8, PREDTYPE.GT); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_8, p5_8 }); } else { q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_8 }); } System.out.println("INFO: Query_cutomer:" + q_c.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); System.out.println("INFO: Query_part:" + q_p.toString()); long start = System.currentTimeMillis(); String stringOrders_join_Customer = stringOrders + ", " + stringCustomer; Schema schemaOrders_join_Customer = Schema.createSchema(stringOrders_join_Customer); String stringLineitem_join_Part = stringLineitem + ", " + stringPart; Schema schemaLineitem_join_Part = Schema.createSchema(stringLineitem_join_Part); JavaPairRDD<LongWritable, Text> orders_join_customer_rdd = sq.createJoinRDD(orders, q_o, customer, q_c, schemaOrders_join_Customer.getAttributeId("o_orderkey")); JavaPairRDD<LongWritable, Text> lineitem_join_part_rdd = sq.createJoinRDD(lineitem, q_l, part, q_p, schemaLineitem_join_Part.getAttributeId("l_orderkey")); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = orders_join_customer_rdd.join(lineitem_join_part_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q10"); String l_returnflag_10 = "R"; String l_returnflag_prev_10 = "N"; int year_10 = 1993; int monthOffset = rand.nextInt(24); SimpleDate d10_1 = new SimpleDate(year_10 + monthOffset / 12, monthOffset % 12 + 1, 1); monthOffset = monthOffset + 3; SimpleDate d10_2 = new SimpleDate(year_10 + monthOffset / 12, monthOffset % 12 + 1, 1); Predicate p1_10 = new Predicate(schemaLineitem.getAttributeId("l_returnflag"), TYPE.STRING, l_returnflag_10, PREDTYPE.LEQ); Predicate p4_10 = new Predicate(schemaLineitem.getAttributeId("l_returnflag"), TYPE.STRING, l_returnflag_prev_10, PREDTYPE.GT); Predicate p2_10 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d10_1, PREDTYPE.GEQ); Predicate p3_10 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d10_2, PREDTYPE.LT); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p1_10, p4_10 }); JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_orderkey"), new Predicate[] { p2_10, p3_10 }); JoinQuery q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), EmptyPredicates); System.out.println("INFO: Query_lineitem:" + q_l.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); long start, end; String stringLineitem_join_Orders = stringLineitem + ", " + stringOrders; Schema schemaLineitem_join_Orders = Schema.createSchema(stringLineitem_join_Orders); start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> lineitem_join_orders_rdd = sq.createJoinRDD(lineitem, q_l, orders, q_o, schemaLineitem_join_Orders.getAttributeId("o_custkey")); JavaPairRDD<LongWritable, Text> customer_rdd = sq.createScanRDD(customer, q_c); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = lineitem_join_orders_rdd.join(customer_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q12"); int rand_12 = rand.nextInt(shipModeVals.length); String shipmode_12 = shipModeVals[rand_12]; int year_12 = 1993 + rand.nextInt(5); SimpleDate d12_1 = new SimpleDate(year_12, 1, 1); SimpleDate d12_2 = new SimpleDate(year_12 + 1, 1, 1); Predicate p1_12 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TYPE.STRING, shipmode_12, PREDTYPE.LEQ); Predicate p2_12 = new Predicate(schemaLineitem.getAttributeId("l_receiptdate"), TYPE.DATE, d12_1, PREDTYPE.GEQ); Predicate p3_12 = new Predicate(schemaLineitem.getAttributeId("l_receiptdate"), TYPE.DATE, d12_2, PREDTYPE.LT); JoinQuery q_l = null; JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_orderkey"), EmptyPredicates); if (rand_12 > 0) { String shipmode_prev_12 = shipModeVals[rand_12 - 1]; Predicate p4_12 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TYPE.STRING, shipmode_prev_12, PREDTYPE.GT); q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p1_12, p2_12, p3_12, p4_12 }); } else { q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p1_12, p2_12, p3_12 }); } System.out.println("INFO: Query_lineitem:" + q_l.toString()); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createJoinRDD(lineitem, q_l, orders, q_o, 0); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q14"); int year_14 = 1993; int monthOffset_14 = rand.nextInt(60); SimpleDate d14_1 = new SimpleDate(year_14 + monthOffset_14 / 12, monthOffset_14 % 12 + 1, 1); monthOffset_14 += 1; SimpleDate d14_2 = new SimpleDate(year_14 + monthOffset_14 / 12, monthOffset_14 % 12 + 1, 1); Predicate p1_14 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d14_1, PREDTYPE.GEQ); Predicate p2_14 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d14_2, PREDTYPE.LT); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_14, p2_14 }); JoinQuery q_p = new JoinQuery(part, schemaPart.getAttributeId("p_partkey"), EmptyPredicates); System.out.println("INFO: Query_lineitem:" + q_l.toString()); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createJoinRDD(lineitem, q_l, part, q_p, 0); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q19"); String brand_19 = "Brand#" + (rand.nextInt(5) + 1) + "" + (rand.nextInt(5) + 1); String shipInstruct_19 = "DELIVER IN PERSON"; double quantity_19 = rand.nextInt(10) + 1; Predicate p1_19 = new Predicate(schemaLineitem.getAttributeId("l_shipinstruct"), TYPE.STRING, shipInstruct_19, PREDTYPE.EQ); Predicate p2_19 = new Predicate(schemaPart.getAttributeId("p_brand"), TYPE.STRING, brand_19, PREDTYPE.EQ); Predicate p3_19 = new Predicate(schemaPart.getAttributeId("p_container"), TYPE.STRING, "SM CASE", PREDTYPE.EQ); Predicate p4_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TYPE.DOUBLE, quantity_19, PREDTYPE.GT); quantity_19 += 10; Predicate p5_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TYPE.DOUBLE, quantity_19, PREDTYPE.LEQ); Predicate p6_19 = new Predicate(schemaPart.getAttributeId("p_size"), TYPE.INT, 1, PREDTYPE.GEQ); Predicate p7_19 = new Predicate(schemaPart.getAttributeId("p_size"), TYPE.INT, 5, PREDTYPE.LEQ); Predicate p8_19 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TYPE.STRING, "AIR", PREDTYPE.LEQ); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_19, p4_19, p5_19, p8_19 }); JoinQuery q_p = new JoinQuery(part, schemaPart.getAttributeId("p_partkey"), new Predicate[] { p2_19, p3_19, p6_19, p7_19 }); System.out.println("INFO: Query_lineitem:" + q_l.toString()); System.out.println("INFO: Query_part:" + q_p.toString()); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createJoinRDD(lineitem, q_l, part, q_p, 0); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); }
public void runBaseline() { rand.setSeed(0); System.out.println("INFO: Running query TPC-H q3"); int rand_3 = rand.nextInt(mktSegmentVals.length); String c_mktsegment = mktSegmentVals[rand_3]; Calendar c = new GregorianCalendar(); int dateOffset = (int) (rand.nextFloat() * (31 + 28 + 31)); c.set(1995, Calendar.MARCH, 01); c.add(Calendar.DAY_OF_MONTH, dateOffset); SimpleDate d3 = new SimpleDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); Predicate p1_3 = new Predicate(schemaCustomer.getAttributeId("c_mktsegment"), TYPE.STRING, c_mktsegment, PREDTYPE.LEQ); Predicate p2_3 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d3, PREDTYPE.LT); Predicate p3_3 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d3, PREDTYPE.GT); JoinQuery q_c = null; JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_orderkey"), new Predicate[] { p2_3 }); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p3_3 }); if (rand_3 > 0) { String c_mktsegment_prev = mktSegmentVals[rand_3 - 1]; Predicate p4_3 = new Predicate(schemaCustomer.getAttributeId("c_mktsegment"), TYPE.STRING, c_mktsegment_prev, PREDTYPE.GT); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_3, p4_3 }); } else { q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_3 }); } System.out.println("INFO: Query_cutomer:" + q_c.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); System.out.println("INFO: Query_lineitem:" + q_l.toString()); long start = System.currentTimeMillis(); String stringLineitem_join_Orders = stringLineitem + ", " + stringOrders; Schema schemaLineitem_join_Orders = Schema.createSchema(stringLineitem_join_Orders); JavaPairRDD<LongWritable, Text> lineitem_join_orders_rdd = sq.createJoinRDD(lineitem, q_l, orders, q_o, schemaLineitem_join_Orders.getAttributeId("o_custkey")); JavaPairRDD<LongWritable, Text> customer_rdd = sq.createScanRDD(customer, q_c); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = lineitem_join_orders_rdd.join(customer_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q5"); int rand_5 = rand.nextInt(regionNameVals.length); String r_name_5 = regionNameVals[rand_5]; int year_5 = 1993 + rand.nextInt(5); SimpleDate d5_1 = new SimpleDate(year_5, 1, 1); SimpleDate d5_2 = new SimpleDate(year_5 + 1, 1, 1); Predicate p1_5 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_5, PREDTYPE.LEQ); Predicate p2_5 = new Predicate(schemaSupplier.getAttributeId("s_region"), TYPE.STRING, r_name_5, PREDTYPE.LEQ); Predicate p3_5 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d5_1, PREDTYPE.GEQ); Predicate p4_5 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d5_2, PREDTYPE.LT); JoinQuery q_s = null; JoinQuery q_c = null; JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_custkey"), new Predicate[] { p3_5, p4_5 }); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_suppkey"), EmptyPredicates); if (rand_5 > 0) { String r_name_prev_5 = regionNameVals[rand_5 - 1]; Predicate p5_5 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_prev_5, PREDTYPE.GT); Predicate p6_5 = new Predicate(schemaSupplier.getAttributeId("s_region"), TYPE.STRING, r_name_prev_5, PREDTYPE.GT); q_s = new JoinQuery(supplier, schemaSupplier.getAttributeId("s_suppkey"), new Predicate[] { p2_5, p6_5 }); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_5, p5_5 }); } else { q_s = new JoinQuery(supplier, schemaSupplier.getAttributeId("s_suppkey"), new Predicate[] { p2_5 }); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_5 }); } System.out.println("INFO: Query_cutomer:" + q_c.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); System.out.println("INFO: Query_supplier:" + q_s.toString()); long start = System.currentTimeMillis(); String stringCustomer_join_Orders = stringCustomer + ", " + stringOrders; Schema schemaCustomer_join_Orders = Schema.createSchema(stringCustomer_join_Orders); String stringLineitem_join_Supplier = stringLineitem + ", " + stringSupplier; Schema schemaLineitem_join_Supplier = Schema.createSchema(stringLineitem_join_Supplier); JavaPairRDD<LongWritable, Text> customer_join_orders_rdd = sq.createJoinRDD(customer, q_c, orders, q_o, schemaCustomer_join_Orders.getAttributeId("o_orderkey")); JavaPairRDD<LongWritable, Text> lineitem_join_supplier_rdd = sq.createJoinRDD(lineitem, q_l, supplier, q_s, schemaLineitem_join_Supplier.getAttributeId("l_orderkey")); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = customer_join_orders_rdd.join(lineitem_join_supplier_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q6"); int year_6 = 1993 + rand.nextInt(5); SimpleDate d6_1 = new SimpleDate(year_6, 1, 1); SimpleDate d6_2 = new SimpleDate(year_6 + 1, 1, 1); double discount = rand.nextDouble() * 0.07 + 0.02; double quantity = rand.nextInt(2) + 24.0; Predicate p1_6 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d6_1, PREDTYPE.GEQ); Predicate p2_6 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d6_2, PREDTYPE.LT); Predicate p3_6 = new Predicate(schemaLineitem.getAttributeId("l_discount"), TYPE.DOUBLE, discount - 0.01, PREDTYPE.GT); Predicate p4_6 = new Predicate(schemaLineitem.getAttributeId("l_discount"), TYPE.DOUBLE, discount + 0.01, PREDTYPE.LEQ); Predicate p5_6 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TYPE.DOUBLE, quantity, PREDTYPE.LEQ); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_suppkey"), new Predicate[] { p1_6, p2_6, p3_6, p4_6, p5_6 }); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createScanRDD(lineitem, q_l); long result = rdd.count(); long end = System.currentTimeMillis(); System.out.println("RES: Time Taken: " + (end - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q8"); int rand_8_1 = rand.nextInt(regionNameVals.length); String r_name_8 = regionNameVals[rand_8_1]; SimpleDate d8_1 = new SimpleDate(1995, 1, 1); SimpleDate d8_2 = new SimpleDate(1996, 12, 31); String p_type_8 = partTypeVals[rand.nextInt(partTypeVals.length)]; Predicate p1_8 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_8, PREDTYPE.LEQ); Predicate p2_8 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d8_1, PREDTYPE.GEQ); Predicate p3_8 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d8_2, PREDTYPE.LEQ); Predicate p4_8 = new Predicate(schemaPart.getAttributeId("p_type"), TYPE.STRING, p_type_8, PREDTYPE.EQ); JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_custkey"), new Predicate[] { p2_8, p3_8 }); JoinQuery q_p = new JoinQuery(part, schemaPart.getAttributeId("p_partkey"), new Predicate[] { p4_8 }); JoinQuery q_c = null; JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), EmptyPredicates); if (rand_8_1 > 0) { String r_name_prev_8 = regionNameVals[rand_8_1 - 1]; Predicate p5_8 = new Predicate(schemaCustomer.getAttributeId("c_region"), TYPE.STRING, r_name_prev_8, PREDTYPE.GT); q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_8, p5_8 }); } else { q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), new Predicate[] { p1_8 }); } System.out.println("INFO: Query_cutomer:" + q_c.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); System.out.println("INFO: Query_part:" + q_p.toString()); long start = System.currentTimeMillis(); String stringOrders_join_Customer = stringOrders + ", " + stringCustomer; Schema schemaOrders_join_Customer = Schema.createSchema(stringOrders_join_Customer); String stringLineitem_join_Part = stringLineitem + ", " + stringPart; Schema schemaLineitem_join_Part = Schema.createSchema(stringLineitem_join_Part); JavaPairRDD<LongWritable, Text> orders_join_customer_rdd = sq.createJoinRDD(orders, q_o, customer, q_c, schemaOrders_join_Customer.getAttributeId("o_orderkey")); JavaPairRDD<LongWritable, Text> lineitem_join_part_rdd = sq.createJoinRDD(lineitem, q_l, part, q_p, schemaLineitem_join_Part.getAttributeId("l_orderkey")); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = orders_join_customer_rdd.join(lineitem_join_part_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q10"); String l_returnflag_10 = "R"; String l_returnflag_prev_10 = "N"; int year_10 = 1993; int monthOffset = rand.nextInt(24); SimpleDate d10_1 = new SimpleDate(year_10 + monthOffset / 12, monthOffset % 12 + 1, 1); monthOffset = monthOffset + 3; SimpleDate d10_2 = new SimpleDate(year_10 + monthOffset / 12, monthOffset % 12 + 1, 1); Predicate p1_10 = new Predicate(schemaLineitem.getAttributeId("l_returnflag"), TYPE.STRING, l_returnflag_10, PREDTYPE.LEQ); Predicate p4_10 = new Predicate(schemaLineitem.getAttributeId("l_returnflag"), TYPE.STRING, l_returnflag_prev_10, PREDTYPE.GT); Predicate p2_10 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d10_1, PREDTYPE.GEQ); Predicate p3_10 = new Predicate(schemaOrders.getAttributeId("o_orderdate"), TYPE.DATE, d10_2, PREDTYPE.LT); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p1_10, p4_10 }); JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_orderkey"), new Predicate[] { p2_10, p3_10 }); JoinQuery q_c = new JoinQuery(customer, schemaCustomer.getAttributeId("c_custkey"), EmptyPredicates); System.out.println("INFO: Query_lineitem:" + q_l.toString()); System.out.println("INFO: Query_orders:" + q_o.toString()); long start, end; String stringLineitem_join_Orders = stringLineitem + ", " + stringOrders; Schema schemaLineitem_join_Orders = Schema.createSchema(stringLineitem_join_Orders); start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> lineitem_join_orders_rdd = sq.createJoinRDD(lineitem, q_l, orders, q_o, schemaLineitem_join_Orders.getAttributeId("o_custkey")); JavaPairRDD<LongWritable, Text> customer_rdd = sq.createScanRDD(customer, q_c); JavaPairRDD<LongWritable, Tuple2<Text, Text>> rdd = lineitem_join_orders_rdd.join(customer_rdd); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q12"); int rand_12 = rand.nextInt(shipModeVals.length); String shipmode_12 = shipModeVals[rand_12]; int year_12 = 1993 + rand.nextInt(5); SimpleDate d12_1 = new SimpleDate(year_12, 1, 1); SimpleDate d12_2 = new SimpleDate(year_12 + 1, 1, 1); Predicate p1_12 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TYPE.STRING, shipmode_12, PREDTYPE.LEQ); Predicate p2_12 = new Predicate(schemaLineitem.getAttributeId("l_receiptdate"), TYPE.DATE, d12_1, PREDTYPE.GEQ); Predicate p3_12 = new Predicate(schemaLineitem.getAttributeId("l_receiptdate"), TYPE.DATE, d12_2, PREDTYPE.LT); JoinQuery q_l = null; JoinQuery q_o = new JoinQuery(orders, schemaOrders.getAttributeId("o_orderkey"), EmptyPredicates); if (rand_12 > 0) { String shipmode_prev_12 = shipModeVals[rand_12 - 1]; Predicate p4_12 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TYPE.STRING, shipmode_prev_12, PREDTYPE.GT); q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p1_12, p2_12, p3_12, p4_12 }); } else { q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_orderkey"), new Predicate[] { p1_12, p2_12, p3_12 }); } System.out.println("INFO: Query_lineitem:" + q_l.toString()); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createJoinRDD(lineitem, q_l, orders, q_o, 0); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q14"); int year_14 = 1993; int monthOffset_14 = rand.nextInt(60); SimpleDate d14_1 = new SimpleDate(year_14 + monthOffset_14 / 12, monthOffset_14 % 12 + 1, 1); monthOffset_14 += 1; SimpleDate d14_2 = new SimpleDate(year_14 + monthOffset_14 / 12, monthOffset_14 % 12 + 1, 1); Predicate p1_14 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d14_1, PREDTYPE.GEQ); Predicate p2_14 = new Predicate(schemaLineitem.getAttributeId("l_shipdate"), TYPE.DATE, d14_2, PREDTYPE.LT); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_14, p2_14 }); JoinQuery q_p = new JoinQuery(part, schemaPart.getAttributeId("p_partkey"), EmptyPredicates); System.out.println("INFO: Query_lineitem:" + q_l.toString()); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createJoinRDD(lineitem, q_l, part, q_p, 0); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); rand.setSeed(0); System.out.println("INFO: Running query TPC-H q19"); <DeepExtract> String brand_19 = "Brand#" + (rand.nextInt(5) + 1) + "" + (rand.nextInt(5) + 1); String shipInstruct_19 = "DELIVER IN PERSON"; double quantity_19 = rand.nextInt(10) + 1; Predicate p1_19 = new Predicate(schemaLineitem.getAttributeId("l_shipinstruct"), TYPE.STRING, shipInstruct_19, PREDTYPE.EQ); Predicate p2_19 = new Predicate(schemaPart.getAttributeId("p_brand"), TYPE.STRING, brand_19, PREDTYPE.EQ); Predicate p3_19 = new Predicate(schemaPart.getAttributeId("p_container"), TYPE.STRING, "SM CASE", PREDTYPE.EQ); Predicate p4_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TYPE.DOUBLE, quantity_19, PREDTYPE.GT); quantity_19 += 10; Predicate p5_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TYPE.DOUBLE, quantity_19, PREDTYPE.LEQ); Predicate p6_19 = new Predicate(schemaPart.getAttributeId("p_size"), TYPE.INT, 1, PREDTYPE.GEQ); Predicate p7_19 = new Predicate(schemaPart.getAttributeId("p_size"), TYPE.INT, 5, PREDTYPE.LEQ); Predicate p8_19 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TYPE.STRING, "AIR", PREDTYPE.LEQ); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_19, p4_19, p5_19, p8_19 }); JoinQuery q_p = new JoinQuery(part, schemaPart.getAttributeId("p_partkey"), new Predicate[] { p2_19, p3_19, p6_19, p7_19 }); System.out.println("INFO: Query_lineitem:" + q_l.toString()); System.out.println("INFO: Query_part:" + q_p.toString()); long start = System.currentTimeMillis(); JavaPairRDD<LongWritable, Text> rdd = sq.createJoinRDD(lineitem, q_l, part, q_p, 0); long result = rdd.count(); System.out.println("RES: Time Taken: " + (System.currentTimeMillis() - start) + "; Result: " + result); </DeepExtract> }
AdaptDB
positive
440,652
public void should_be_sent_excepted_number_of_requests_for_single_build_toggle_on() { return prepareVcs("vcs1", "111", "rev1_2", SetVcsRootIdMode.EXT_ID); setInternalProperty(CHECK_STATUS_BEFORE_PUBLISHING, "true"); QueuedBuildEx queuedBuild = (QueuedBuildEx) myBuildType.addToQueue(""); assertNotNull(queuedBuild); queuedBuild.getBuildPromotion().getTopDependencyGraph().collectChangesForGraph(new CancelableTaskHolder()); myListener.changesLoaded(queuedBuild.getBuildPromotion()); return queuedBuild; waitFor(() -> myFixture.getBuildQueue().getNumberOfItems() == 1, TASK_COMPLETION_TIMEOUT_MS); waitFor(() -> myPublisher.getSentRequests().size() == 2, TASK_COMPLETION_TIMEOUT_MS); assertEquals(1L, myPublisher.getSentRequests().stream().filter(method -> method == HttpMethod.POST).count()); assertEquals(1L, myPublisher.getSentRequests().stream().filter(method -> method == HttpMethod.GET).count()); }
public void should_be_sent_excepted_number_of_requests_for_single_build_toggle_on() { return prepareVcs("vcs1", "111", "rev1_2", SetVcsRootIdMode.EXT_ID); setInternalProperty(CHECK_STATUS_BEFORE_PUBLISHING, "true"); <DeepExtract> QueuedBuildEx queuedBuild = (QueuedBuildEx) myBuildType.addToQueue(""); assertNotNull(queuedBuild); queuedBuild.getBuildPromotion().getTopDependencyGraph().collectChangesForGraph(new CancelableTaskHolder()); myListener.changesLoaded(queuedBuild.getBuildPromotion()); return queuedBuild; </DeepExtract> waitFor(() -> myFixture.getBuildQueue().getNumberOfItems() == 1, TASK_COMPLETION_TIMEOUT_MS); waitFor(() -> myPublisher.getSentRequests().size() == 2, TASK_COMPLETION_TIMEOUT_MS); assertEquals(1L, myPublisher.getSentRequests().stream().filter(method -> method == HttpMethod.POST).count()); assertEquals(1L, myPublisher.getSentRequests().stream().filter(method -> method == HttpMethod.GET).count()); }
commit-status-publisher
positive
440,653
public Color apply() { if (props.getProperty("coastlineColor") == null) throw new NullPointerException("A color is null."); String[] parts = props.getProperty("coastlineColor").split(","); if (parts.length == 3) { return new Color(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2])); } if (parts.length == 4) { return new Color(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3])); } throw new IllegalArgumentException("Unable to parse color from string: " + props.getProperty("coastlineColor")); }
public Color apply() { <DeepExtract> if (props.getProperty("coastlineColor") == null) throw new NullPointerException("A color is null."); String[] parts = props.getProperty("coastlineColor").split(","); if (parts.length == 3) { return new Color(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2])); } if (parts.length == 4) { return new Color(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3])); } throw new IllegalArgumentException("Unable to parse color from string: " + props.getProperty("coastlineColor")); </DeepExtract> }
nortantis
positive
440,655
@Override public void onError(Session session, Throwable t) { log.debug("onError: {}", t.toString(), t); int count = 0; Throwable root = t; while (root.getCause() != null && count < 20) { root = root.getCause(); count++; } if (root instanceof EOFException) { log.debug("EOF exception", root); } else if (root instanceof IOException) { log.debug("IO exception when opened? {}", session.isOpen(), root); } final String sessionId = session.getId(); log.debug("Session closed: {}", sessionId); WebSocketConnection conn = null; try { conn = (WebSocketConnection) session.getUserProperties().get(WSConstants.WS_CONNECTION); if (conn == null) { log.warn("Connection for id: {} was not found in the session onClose", sessionId); conn = scope.getConnectionBySessionId(sessionId); if (conn == null) { log.warn("Connection for id: {} was not found in the scope or session: {}", sessionId, scope.getPath()); } } } catch (Exception e) { log.warn("Exception in onClose", e); } finally { if (conn != null) { scope.removeConnection(conn); conn.close(); } } }
@Override public void onError(Session session, Throwable t) { log.debug("onError: {}", t.toString(), t); int count = 0; Throwable root = t; while (root.getCause() != null && count < 20) { root = root.getCause(); count++; } if (root instanceof EOFException) { log.debug("EOF exception", root); } else if (root instanceof IOException) { log.debug("IO exception when opened? {}", session.isOpen(), root); } <DeepExtract> final String sessionId = session.getId(); log.debug("Session closed: {}", sessionId); WebSocketConnection conn = null; try { conn = (WebSocketConnection) session.getUserProperties().get(WSConstants.WS_CONNECTION); if (conn == null) { log.warn("Connection for id: {} was not found in the session onClose", sessionId); conn = scope.getConnectionBySessionId(sessionId); if (conn == null) { log.warn("Connection for id: {} was not found in the scope or session: {}", sessionId, scope.getPath()); } } } catch (Exception e) { log.warn("Exception in onClose", e); } finally { if (conn != null) { scope.removeConnection(conn); conn.close(); } } </DeepExtract> }
red5-server
positive
440,661
@Override public void touchSpeed(int velocityX, int velocityY) { setResult(ExtraType.RESULT_CODE_ROOM_SETTING_CLOSE); finish(); overridePendingTransition(R.anim.activity_close_enter, R.anim.activity_close_exit); }
@Override public void touchSpeed(int velocityX, int velocityY) { setResult(ExtraType.RESULT_CODE_ROOM_SETTING_CLOSE); <DeepExtract> finish(); overridePendingTransition(R.anim.activity_close_enter, R.anim.activity_close_exit); </DeepExtract> }
Teameeting-Android
positive
440,662
@Test public void shouldInitializeToCorrectValues() { final long length = 1444; final StructuredArrayOfAtomicLong array = StructuredArrayOfAtomicLong.newInstance(length); long length = array.getLength(); long indexSum = 0; for (long index = 0; index < length; index++) { indexSum += index; array.get(index).set(indexSum); } Assert.assertThat(valueOf(array.getLength()), CoreMatchers.is(valueOf(length))); Assert.assertTrue(array.getElementClass() == AtomicLong.class); long indexSum = 0; for (long index = 0; index < length; index++) { indexSum += index; Assert.assertThat("index: " + index + ": ", valueOf(array.get(index).get()), CoreMatchers.is(valueOf(indexSum))); } }
@Test public void shouldInitializeToCorrectValues() { final long length = 1444; final StructuredArrayOfAtomicLong array = StructuredArrayOfAtomicLong.newInstance(length); long length = array.getLength(); long indexSum = 0; for (long index = 0; index < length; index++) { indexSum += index; array.get(index).set(indexSum); } <DeepExtract> Assert.assertThat(valueOf(array.getLength()), CoreMatchers.is(valueOf(length))); Assert.assertTrue(array.getElementClass() == AtomicLong.class); long indexSum = 0; for (long index = 0; index < length; index++) { indexSum += index; Assert.assertThat("index: " + index + ": ", valueOf(array.get(index).get()), CoreMatchers.is(valueOf(indexSum))); } </DeepExtract> }
ObjectLayout
positive
440,663
protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { return Class.forName(classDesc.getName(), false, cl); } catch (ClassNotFoundException e) { final Class clazz = (Class) primClasses.get(classDesc.getName()); if (clazz != null) { return clazz; } else { return Class.forName(classDesc.getName(), false, FALLBACK_CLASS_LOADER); } } }
protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); <DeepExtract> try { return Class.forName(classDesc.getName(), false, cl); } catch (ClassNotFoundException e) { final Class clazz = (Class) primClasses.get(classDesc.getName()); if (clazz != null) { return clazz; } else { return Class.forName(classDesc.getName(), false, FALLBACK_CLASS_LOADER); } } </DeepExtract> }
stompjms
positive
440,664
protected void finalize() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; globalJNI.delete_NamedEntityExtractor(swigCPtr); } swigCPtr = 0; } }
protected void finalize() { <DeepExtract> if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; globalJNI.delete_NamedEntityExtractor(swigCPtr); } swigCPtr = 0; } </DeepExtract> }
TextAnalyzer
positive
440,665
@Override public boolean onLongClick(View view) { try { output_tv.setText("Source: " + jsonObjects.get(finalI).get(finalJ).get("source").toString()); } catch (JSONException e) { Toast.makeText(context, "An unknown error has occurred. Please try again", Toast.LENGTH_LONG).show(); } return true; }
@Override public boolean onLongClick(View view) { <DeepExtract> try { output_tv.setText("Source: " + jsonObjects.get(finalI).get(finalJ).get("source").toString()); } catch (JSONException e) { Toast.makeText(context, "An unknown error has occurred. Please try again", Toast.LENGTH_LONG).show(); } </DeepExtract> return true; }
RPGCompanion
positive
440,666
@Test public void testNodeDisconnectedReconnectSuccess() { when(mockBlockSubscriptionStrategy.isSubscribed()).thenReturn(false); if (false) { when(mockBlockchainService.getCurrentBlockNumber()).thenReturn(BLOCK_NUMBER); } else { when(mockBlockchainService.getCurrentBlockNumber()).thenThrow(new BlockchainException("Error!", new IOException(""))); } isConnected.set(false); doAnswer((invocation) -> { if (true) { isConnected.set(true); } else { isConnected.set(false); } return null; }).when(mockReconnectionStrategy).reconnect(); doAnswer((invocation) -> { if (isConnected.get()) { return BLOCK_NUMBER; } else { throw new BlockchainException("Error!", new IOException("")); } }).when(mockBlockchainService).getCurrentBlockNumber(); underTest.checkHealth(); verify(mockReconnectionStrategy, times(1)).reconnect(); verify(mockReconnectionStrategy, times(1)).resubscribe(); }
@Test public void testNodeDisconnectedReconnectSuccess() { when(mockBlockSubscriptionStrategy.isSubscribed()).thenReturn(false); if (false) { when(mockBlockchainService.getCurrentBlockNumber()).thenReturn(BLOCK_NUMBER); } else { when(mockBlockchainService.getCurrentBlockNumber()).thenThrow(new BlockchainException("Error!", new IOException(""))); } <DeepExtract> isConnected.set(false); doAnswer((invocation) -> { if (true) { isConnected.set(true); } else { isConnected.set(false); } return null; }).when(mockReconnectionStrategy).reconnect(); doAnswer((invocation) -> { if (isConnected.get()) { return BLOCK_NUMBER; } else { throw new BlockchainException("Error!", new IOException("")); } }).when(mockBlockchainService).getCurrentBlockNumber(); </DeepExtract> underTest.checkHealth(); verify(mockReconnectionStrategy, times(1)).reconnect(); verify(mockReconnectionStrategy, times(1)).resubscribe(); }
eventeum
positive
440,667
@Override public void actionPerformed(ActionEvent e) { String newFileName = pathFileName + newFileSuffix; try { File file = new File(newFileName); PrintWriter writer = new PrintWriter(file); for (PoseSteering ps : path) { writer.println(ps.getPose().getX() + " " + ps.getPose().getY() + " " + ps.getPose().getTheta() + " " + ps.getSteering()); } writer.close(); } catch (Exception e) { e.printStackTrace(); } System.out.println("Saved " + newFileName); }
@Override public void actionPerformed(ActionEvent e) { String newFileName = pathFileName + newFileSuffix; <DeepExtract> try { File file = new File(newFileName); PrintWriter writer = new PrintWriter(file); for (PoseSteering ps : path) { writer.println(ps.getPose().getX() + " " + ps.getPose().getY() + " " + ps.getPose().getTheta() + " " + ps.getSteering()); } writer.close(); } catch (Exception e) { e.printStackTrace(); } </DeepExtract> System.out.println("Saved " + newFileName); }
coordination_oru
positive
440,668
@Override public void run(final T configuration, final Environment environment) throws Exception { Preconditions.checkState(configuration instanceof AlchemyServiceConfiguration); final AlchemyModule module = new AlchemyModule(configuration, environment); environment.lifecycle().manage(module); final Injector injector = Guice.createInjector(module); for (final Class<?> resource : RESOURCES) { environment.jersey().register(injector.getInstance(resource)); } environment.healthChecks().register("database", injector.getInstance(ExperimentsDatabaseProviderCheck.class)); environment.jersey().register(new SparseFieldSetFilter(environment.getObjectMapper())); environment.jersey().register(new RuntimeExceptionMapper()); environment.lifecycle().manage(new JmxMetricsManaged(environment)); for (final IdentityMapping identity : configuration.getIdentities().values()) { environment.getObjectMapper().registerSubtypes(identity.getDtoType()); } }
@Override public void run(final T configuration, final Environment environment) throws Exception { Preconditions.checkState(configuration instanceof AlchemyServiceConfiguration); final AlchemyModule module = new AlchemyModule(configuration, environment); environment.lifecycle().manage(module); final Injector injector = Guice.createInjector(module); for (final Class<?> resource : RESOURCES) { environment.jersey().register(injector.getInstance(resource)); } environment.healthChecks().register("database", injector.getInstance(ExperimentsDatabaseProviderCheck.class)); environment.jersey().register(new SparseFieldSetFilter(environment.getObjectMapper())); environment.jersey().register(new RuntimeExceptionMapper()); environment.lifecycle().manage(new JmxMetricsManaged(environment)); <DeepExtract> for (final IdentityMapping identity : configuration.getIdentities().values()) { environment.getObjectMapper().registerSubtypes(identity.getDtoType()); } </DeepExtract> }
alchemy
positive
440,669
@Override public PlaylistsRecord value1(Integer value) { set(0, value); return this; }
@Override public PlaylistsRecord value1(Integer value) { <DeepExtract> set(0, value); </DeepExtract> return this; }
graphql-java-db-example
positive
440,672
public static List<String> extractAndSaveSpecificFeatures(List<File> paths_of_files_or_folders_to_parse, String feature_values_save_path, String feature_definitions_save_path, boolean[] features_to_extract, boolean save_features_for_each_window, boolean save_overall_recording_features, double window_size, double window_overlap, boolean save_arff_file, boolean save_csv_file, PrintStream status_print_stream, PrintStream error_print_stream, boolean gui_processing) { MIDIFeatureProcessor processor = null; try { processor = new MIDIFeatureProcessor(window_size, window_overlap, FeatureExtractorAccess.getAllImplementedFeatureExtractors(), features_to_extract, save_features_for_each_window, save_overall_recording_features, feature_values_save_path, feature_definitions_save_path); } catch (Exception e) { UserFeedbackGenerator.printExceptionErrorMessage(error_print_stream, e); System.exit(-1); } List<String> error_log = new ArrayList<>(); ArrayList<File> files_to_parse = SymbolicMusicFileUtilities.getFilteredFilesRecursiveTraversal(paths_of_files_or_folders_to_parse, false, new MusicFilter(), error_print_stream, error_log); files_to_parse = SymbolicMusicFileUtilities.validateAndGetMidiAndMeiFiles(files_to_parse, status_print_stream, error_print_stream, error_log); verifyNoMeiFeaturesAndNonMeiFiles(files_to_parse, processor, error_print_stream); UserFeedbackGenerator.printGeneratingAceXmlFeatureDefinitionsFile(status_print_stream, feature_definitions_save_path); UserFeedbackGenerator.printFeatureExtractionStartingMessage(status_print_stream, files_to_parse.size()); for (int i = 0; i < files_to_parse.size(); i++) extractFeatures(files_to_parse.get(i).getAbsolutePath(), processor, i + 1, files_to_parse.size(), status_print_stream, error_print_stream, error_log, gui_processing); UserFeedbackGenerator.printGeneratingAceXmlFeatureValuesFile(status_print_stream, feature_values_save_path); try { processor.finalizeFeatureValuesFile(); } catch (Exception e) { UserFeedbackGenerator.printExceptionErrorMessage(error_print_stream, e); error_log.add(e + ": " + e.getMessage()); } UserFeedbackGenerator.printFeatureExtractionCompleteMessage(status_print_stream, feature_values_save_path, files_to_parse.size()); UserFeedbackGenerator.printErrorSummary(error_print_stream, error_log, gui_processing); if (save_arff_file || save_csv_file) { try { int number_succesfully_extracted_files = 0; try { String[] input_files = { feature_values_save_path }; DataBoard instance_data = new DataBoard(null, null, input_files, null); number_succesfully_extracted_files = instance_data.getNumOverall(); } catch (Exception e) { String warning = "Saving of Weka ARFF and/or CSV files was aborted. " + e.getMessage(); UserFeedbackGenerator.printWarningMessage(error_print_stream, warning); } if (number_succesfully_extracted_files > 0) { AceXmlConverter.saveAsArffOrCsvFiles(feature_values_save_path, feature_definitions_save_path, save_arff_file, save_csv_file, true, false, status_print_stream); } } catch (Exception e) { UserFeedbackGenerator.printExceptionErrorMessage(error_print_stream, e); } } UserFeedbackGenerator.printExecutionFinished(status_print_stream); return error_log; }
public static List<String> extractAndSaveSpecificFeatures(List<File> paths_of_files_or_folders_to_parse, String feature_values_save_path, String feature_definitions_save_path, boolean[] features_to_extract, boolean save_features_for_each_window, boolean save_overall_recording_features, double window_size, double window_overlap, boolean save_arff_file, boolean save_csv_file, PrintStream status_print_stream, PrintStream error_print_stream, boolean gui_processing) { MIDIFeatureProcessor processor = null; try { processor = new MIDIFeatureProcessor(window_size, window_overlap, FeatureExtractorAccess.getAllImplementedFeatureExtractors(), features_to_extract, save_features_for_each_window, save_overall_recording_features, feature_values_save_path, feature_definitions_save_path); } catch (Exception e) { UserFeedbackGenerator.printExceptionErrorMessage(error_print_stream, e); System.exit(-1); } List<String> error_log = new ArrayList<>(); ArrayList<File> files_to_parse = SymbolicMusicFileUtilities.getFilteredFilesRecursiveTraversal(paths_of_files_or_folders_to_parse, false, new MusicFilter(), error_print_stream, error_log); files_to_parse = SymbolicMusicFileUtilities.validateAndGetMidiAndMeiFiles(files_to_parse, status_print_stream, error_print_stream, error_log); verifyNoMeiFeaturesAndNonMeiFiles(files_to_parse, processor, error_print_stream); UserFeedbackGenerator.printGeneratingAceXmlFeatureDefinitionsFile(status_print_stream, feature_definitions_save_path); UserFeedbackGenerator.printFeatureExtractionStartingMessage(status_print_stream, files_to_parse.size()); for (int i = 0; i < files_to_parse.size(); i++) extractFeatures(files_to_parse.get(i).getAbsolutePath(), processor, i + 1, files_to_parse.size(), status_print_stream, error_print_stream, error_log, gui_processing); UserFeedbackGenerator.printGeneratingAceXmlFeatureValuesFile(status_print_stream, feature_values_save_path); try { processor.finalizeFeatureValuesFile(); } catch (Exception e) { UserFeedbackGenerator.printExceptionErrorMessage(error_print_stream, e); error_log.add(e + ": " + e.getMessage()); } UserFeedbackGenerator.printFeatureExtractionCompleteMessage(status_print_stream, feature_values_save_path, files_to_parse.size()); UserFeedbackGenerator.printErrorSummary(error_print_stream, error_log, gui_processing); <DeepExtract> if (save_arff_file || save_csv_file) { try { int number_succesfully_extracted_files = 0; try { String[] input_files = { feature_values_save_path }; DataBoard instance_data = new DataBoard(null, null, input_files, null); number_succesfully_extracted_files = instance_data.getNumOverall(); } catch (Exception e) { String warning = "Saving of Weka ARFF and/or CSV files was aborted. " + e.getMessage(); UserFeedbackGenerator.printWarningMessage(error_print_stream, warning); } if (number_succesfully_extracted_files > 0) { AceXmlConverter.saveAsArffOrCsvFiles(feature_values_save_path, feature_definitions_save_path, save_arff_file, save_csv_file, true, false, status_print_stream); } } catch (Exception e) { UserFeedbackGenerator.printExceptionErrorMessage(error_print_stream, e); } } </DeepExtract> UserFeedbackGenerator.printExecutionFinished(status_print_stream); return error_log; }
jSymbolic2
positive
440,675
private void removeListItem(ListItem displayItem, BulletList list) { GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null); itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML()); list.remove(displayItem); componentHelper.fireComponentResized(this); }
private void removeListItem(ListItem displayItem, BulletList list) { GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null); itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML()); list.remove(displayItem); <DeepExtract> componentHelper.fireComponentResized(this); </DeepExtract> }
osw-web
positive
440,676
public static BottomMenu show(String[] menuList, OnMenuItemClickListener<BottomMenu> onMenuItemClickListener) { BottomMenu bottomMenu = new BottomMenu(); this.menuList = menuList; this.menuListAdapter = null; preRefreshUI(); return this; this.onMenuItemClickListener = onMenuItemClickListener; return this; bottomMenu.show(); return bottomMenu; }
public static BottomMenu show(String[] menuList, OnMenuItemClickListener<BottomMenu> onMenuItemClickListener) { BottomMenu bottomMenu = new BottomMenu(); this.menuList = menuList; this.menuListAdapter = null; preRefreshUI(); return this; <DeepExtract> this.onMenuItemClickListener = onMenuItemClickListener; return this; </DeepExtract> bottomMenu.show(); return bottomMenu; }
DialogX
positive
440,677
protected void updateZoomableControllerBounds() { getHierarchy().getActualImageBounds(mImageBounds); mViewBounds.set(0, 0, getWidth(), getHeight()); mZoomableController.setImageBounds(mImageBounds); mZoomableController.setViewBounds(mViewBounds); FLog.v(getLogTag(), "updateZoomableControllerBounds: view %x, view bounds: %s, image bounds: %s", this.hashCode(), mViewBounds, mImageBounds); }
protected void updateZoomableControllerBounds() { getHierarchy().getActualImageBounds(mImageBounds); <DeepExtract> mViewBounds.set(0, 0, getWidth(), getHeight()); </DeepExtract> mZoomableController.setImageBounds(mImageBounds); mZoomableController.setViewBounds(mViewBounds); FLog.v(getLogTag(), "updateZoomableControllerBounds: view %x, view bounds: %s, image bounds: %s", this.hashCode(), mViewBounds, mImageBounds); }
MyDiary
positive
440,678
public static LogitTreeNode buildTreeNaiveMaxAbs(final BaseFeatureSet featureSet, final LinearFunction linFunc, final int maxDepth) { final List<AspatialFeature> aspatialFeatures = new ArrayList<AspatialFeature>(featureSet.aspatialFeatures().length); for (final AspatialFeature aspatial : featureSet.aspatialFeatures()) { aspatialFeatures.add(aspatial); } final List<SpatialFeature> spatialFeatures = new ArrayList<SpatialFeature>(featureSet.spatialFeatures().length); for (final SpatialFeature spatial : featureSet.spatialFeatures()) { spatialFeatures.add(spatial); } final FVector allWeights = linFunc.effectiveParams().allWeights(); final TFloatArrayList aspatialWeights = new TFloatArrayList(aspatialFeatures.size()); final TFloatArrayList spatialWeights = new TFloatArrayList(spatialFeatures.size()); for (int i = 0; i < allWeights.dim(); ++i) { if (i < aspatialFeatures.size()) aspatialWeights.add(allWeights.get(i)); else spatialWeights.add(allWeights.get(i)); } float accumInterceptWeight = 0.f; for (int i = aspatialFeatures.size() - 1; i >= 0; --i) { if (aspatialFeatures.get(i) instanceof InterceptFeature) { accumInterceptWeight += aspatialWeights.removeAt(i); aspatialFeatures.remove(i); } } for (int i = aspatialFeatures.size() - 1; i >= 0; --i) { if (aspatialWeights.getQuick(i) == 0.f) { ListUtils.removeSwap(aspatialWeights, i); ListUtils.removeSwap(aspatialFeatures, i); } } for (int i = spatialFeatures.size() - 1; i >= 0; --i) { if (spatialWeights.getQuick(i) == 0.f) { ListUtils.removeSwap(spatialWeights, i); ListUtils.removeSwap(spatialFeatures, i); } } if (aspatialFeatures.isEmpty() && spatialFeatures.isEmpty()) { return new LogitModelNode(new Feature[] { InterceptFeature.instance() }, new float[] { accumInterceptWeight }); } if (maxDepth == 0) { final int numModelFeatures = aspatialFeatures.size() + spatialFeatures.size() + 1; final Feature[] featuresArray = new Feature[numModelFeatures]; final float[] weightsArray = new float[numModelFeatures]; int nextIdx = 0; featuresArray[nextIdx] = InterceptFeature.instance(); weightsArray[nextIdx++] = accumInterceptWeight; for (int i = 0; i < aspatialFeatures.size(); ++i) { featuresArray[nextIdx] = aspatialFeatures.get(i); weightsArray[nextIdx++] = aspatialWeights.getQuick(i); } for (int i = 0; i < spatialFeatures.size(); ++i) { featuresArray[nextIdx] = spatialFeatures.get(i); weightsArray[nextIdx++] = spatialWeights.getQuick(i); } return new LogitModelNode(featuresArray, weightsArray); } float lowestScore = Float.POSITIVE_INFINITY; int bestIdx = -1; boolean bestFeatureIsAspatial = true; float sumAllAbsWeights = 0.f; for (int i = 0; i < aspatialWeights.size(); ++i) { sumAllAbsWeights += Math.abs(aspatialWeights.getQuick(i)); } for (int i = 0; i < spatialWeights.size(); ++i) { sumAllAbsWeights += Math.abs(spatialWeights.getQuick(i)); } for (int i = 0; i < aspatialFeatures.size(); ++i) { final float absFeatureWeight = Math.abs(aspatialWeights.getQuick(i)); float falseScore = sumAllAbsWeights - absFeatureWeight; float trueScore = sumAllAbsWeights - absFeatureWeight; final float splitScore = (falseScore + trueScore) / 2.f; if (splitScore < lowestScore) { lowestScore = splitScore; bestIdx = i; } } for (int i = 0; i < spatialFeatures.size(); ++i) { final float absFeatureWeight = Math.abs(spatialWeights.getQuick(i)); float falseScore = sumAllAbsWeights - absFeatureWeight; float trueScore = sumAllAbsWeights - absFeatureWeight; final float splitScore = (falseScore + trueScore) / 2.f; if (splitScore < lowestScore) { lowestScore = splitScore; bestIdx = i; bestFeatureIsAspatial = false; } } final Feature splittingFeature; if (bestFeatureIsAspatial) splittingFeature = aspatialFeatures.get(bestIdx); else splittingFeature = spatialFeatures.get(bestIdx); final LogitTreeNode trueBranch; { final List<AspatialFeature> remainingAspatialsWhenTrue; final TFloatArrayList remainingAspatialWeightsWhenTrue; final List<SpatialFeature> remainingSpatialsWhenTrue; final TFloatArrayList remainingSpatialWeightsWhenTrue; float accumInterceptWhenTrue = accumInterceptWeight; if (bestFeatureIsAspatial) { remainingAspatialsWhenTrue = new ArrayList<AspatialFeature>(aspatialFeatures); remainingAspatialWeightsWhenTrue = new TFloatArrayList(aspatialWeights); ListUtils.removeSwap(remainingAspatialsWhenTrue, bestIdx); accumInterceptWhenTrue += remainingAspatialWeightsWhenTrue.getQuick(bestIdx); ListUtils.removeSwap(remainingAspatialWeightsWhenTrue, bestIdx); remainingSpatialsWhenTrue = new ArrayList<SpatialFeature>(); remainingSpatialWeightsWhenTrue = new TFloatArrayList(); } else { remainingAspatialsWhenTrue = new ArrayList<AspatialFeature>(); remainingAspatialWeightsWhenTrue = new TFloatArrayList(); remainingSpatialsWhenTrue = new ArrayList<SpatialFeature>(spatialFeatures); remainingSpatialWeightsWhenTrue = new TFloatArrayList(spatialWeights); for (int i = remainingSpatialsWhenTrue.size() - 1; i >= 0; --i) { if (i == bestIdx) { ListUtils.removeSwap(remainingSpatialsWhenTrue, i); accumInterceptWhenTrue += remainingSpatialWeightsWhenTrue.getQuick(i); ListUtils.removeSwap(remainingSpatialWeightsWhenTrue, i); } else { final SpatialFeature other = remainingSpatialsWhenTrue.get(i); if (other.generalises((SpatialFeature) splittingFeature)) { ListUtils.removeSwap(remainingSpatialsWhenTrue, i); accumInterceptWhenTrue += remainingSpatialWeightsWhenTrue.getQuick(i); ListUtils.removeSwap(remainingSpatialWeightsWhenTrue, i); } } } } trueBranch = buildNodeNaiveMaxAbs(remainingAspatialsWhenTrue, remainingAspatialWeightsWhenTrue, remainingSpatialsWhenTrue, remainingSpatialWeightsWhenTrue, accumInterceptWhenTrue, maxDepth - 1); } final LogitTreeNode falseBranch; { final List<AspatialFeature> remainingAspatialsWhenFalse; final TFloatArrayList remainingAspatialWeightsWhenFalse; final List<SpatialFeature> remainingSpatialsWhenFalse; final TFloatArrayList remainingSpatialWeightsWhenFalse; float accumInterceptWhenFalse = accumInterceptWeight; if (bestFeatureIsAspatial) { remainingAspatialsWhenFalse = new ArrayList<AspatialFeature>(aspatialFeatures); remainingAspatialWeightsWhenFalse = new TFloatArrayList(aspatialWeights); ListUtils.removeSwap(remainingAspatialsWhenFalse, bestIdx); ListUtils.removeSwap(remainingAspatialWeightsWhenFalse, bestIdx); remainingSpatialsWhenFalse = new ArrayList<SpatialFeature>(spatialFeatures); remainingSpatialWeightsWhenFalse = new TFloatArrayList(spatialWeights); } else { remainingAspatialsWhenFalse = new ArrayList<AspatialFeature>(aspatialFeatures); remainingAspatialWeightsWhenFalse = new TFloatArrayList(aspatialWeights); remainingSpatialsWhenFalse = new ArrayList<SpatialFeature>(spatialFeatures); remainingSpatialWeightsWhenFalse = new TFloatArrayList(spatialWeights); for (int i = remainingSpatialsWhenFalse.size() - 1; i >= 0; --i) { if (i == bestIdx) { ListUtils.removeSwap(remainingSpatialsWhenFalse, i); ListUtils.removeSwap(remainingSpatialWeightsWhenFalse, i); } else { final SpatialFeature other = remainingSpatialsWhenFalse.get(i); if (((SpatialFeature) splittingFeature).generalises(other)) { ListUtils.removeSwap(remainingSpatialsWhenFalse, i); ListUtils.removeSwap(remainingSpatialWeightsWhenFalse, i); } } } } falseBranch = buildNodeNaiveMaxAbs(remainingAspatialsWhenFalse, remainingAspatialWeightsWhenFalse, remainingSpatialsWhenFalse, remainingSpatialWeightsWhenFalse, accumInterceptWhenFalse, maxDepth - 1); } return new LogitDecisionNode(splittingFeature, trueBranch, falseBranch); }
public static LogitTreeNode buildTreeNaiveMaxAbs(final BaseFeatureSet featureSet, final LinearFunction linFunc, final int maxDepth) { final List<AspatialFeature> aspatialFeatures = new ArrayList<AspatialFeature>(featureSet.aspatialFeatures().length); for (final AspatialFeature aspatial : featureSet.aspatialFeatures()) { aspatialFeatures.add(aspatial); } final List<SpatialFeature> spatialFeatures = new ArrayList<SpatialFeature>(featureSet.spatialFeatures().length); for (final SpatialFeature spatial : featureSet.spatialFeatures()) { spatialFeatures.add(spatial); } final FVector allWeights = linFunc.effectiveParams().allWeights(); final TFloatArrayList aspatialWeights = new TFloatArrayList(aspatialFeatures.size()); final TFloatArrayList spatialWeights = new TFloatArrayList(spatialFeatures.size()); for (int i = 0; i < allWeights.dim(); ++i) { if (i < aspatialFeatures.size()) aspatialWeights.add(allWeights.get(i)); else spatialWeights.add(allWeights.get(i)); } float accumInterceptWeight = 0.f; for (int i = aspatialFeatures.size() - 1; i >= 0; --i) { if (aspatialFeatures.get(i) instanceof InterceptFeature) { accumInterceptWeight += aspatialWeights.removeAt(i); aspatialFeatures.remove(i); } } for (int i = aspatialFeatures.size() - 1; i >= 0; --i) { if (aspatialWeights.getQuick(i) == 0.f) { ListUtils.removeSwap(aspatialWeights, i); ListUtils.removeSwap(aspatialFeatures, i); } } for (int i = spatialFeatures.size() - 1; i >= 0; --i) { if (spatialWeights.getQuick(i) == 0.f) { ListUtils.removeSwap(spatialWeights, i); ListUtils.removeSwap(spatialFeatures, i); } } <DeepExtract> if (aspatialFeatures.isEmpty() && spatialFeatures.isEmpty()) { return new LogitModelNode(new Feature[] { InterceptFeature.instance() }, new float[] { accumInterceptWeight }); } if (maxDepth == 0) { final int numModelFeatures = aspatialFeatures.size() + spatialFeatures.size() + 1; final Feature[] featuresArray = new Feature[numModelFeatures]; final float[] weightsArray = new float[numModelFeatures]; int nextIdx = 0; featuresArray[nextIdx] = InterceptFeature.instance(); weightsArray[nextIdx++] = accumInterceptWeight; for (int i = 0; i < aspatialFeatures.size(); ++i) { featuresArray[nextIdx] = aspatialFeatures.get(i); weightsArray[nextIdx++] = aspatialWeights.getQuick(i); } for (int i = 0; i < spatialFeatures.size(); ++i) { featuresArray[nextIdx] = spatialFeatures.get(i); weightsArray[nextIdx++] = spatialWeights.getQuick(i); } return new LogitModelNode(featuresArray, weightsArray); } float lowestScore = Float.POSITIVE_INFINITY; int bestIdx = -1; boolean bestFeatureIsAspatial = true; float sumAllAbsWeights = 0.f; for (int i = 0; i < aspatialWeights.size(); ++i) { sumAllAbsWeights += Math.abs(aspatialWeights.getQuick(i)); } for (int i = 0; i < spatialWeights.size(); ++i) { sumAllAbsWeights += Math.abs(spatialWeights.getQuick(i)); } for (int i = 0; i < aspatialFeatures.size(); ++i) { final float absFeatureWeight = Math.abs(aspatialWeights.getQuick(i)); float falseScore = sumAllAbsWeights - absFeatureWeight; float trueScore = sumAllAbsWeights - absFeatureWeight; final float splitScore = (falseScore + trueScore) / 2.f; if (splitScore < lowestScore) { lowestScore = splitScore; bestIdx = i; } } for (int i = 0; i < spatialFeatures.size(); ++i) { final float absFeatureWeight = Math.abs(spatialWeights.getQuick(i)); float falseScore = sumAllAbsWeights - absFeatureWeight; float trueScore = sumAllAbsWeights - absFeatureWeight; final float splitScore = (falseScore + trueScore) / 2.f; if (splitScore < lowestScore) { lowestScore = splitScore; bestIdx = i; bestFeatureIsAspatial = false; } } final Feature splittingFeature; if (bestFeatureIsAspatial) splittingFeature = aspatialFeatures.get(bestIdx); else splittingFeature = spatialFeatures.get(bestIdx); final LogitTreeNode trueBranch; { final List<AspatialFeature> remainingAspatialsWhenTrue; final TFloatArrayList remainingAspatialWeightsWhenTrue; final List<SpatialFeature> remainingSpatialsWhenTrue; final TFloatArrayList remainingSpatialWeightsWhenTrue; float accumInterceptWhenTrue = accumInterceptWeight; if (bestFeatureIsAspatial) { remainingAspatialsWhenTrue = new ArrayList<AspatialFeature>(aspatialFeatures); remainingAspatialWeightsWhenTrue = new TFloatArrayList(aspatialWeights); ListUtils.removeSwap(remainingAspatialsWhenTrue, bestIdx); accumInterceptWhenTrue += remainingAspatialWeightsWhenTrue.getQuick(bestIdx); ListUtils.removeSwap(remainingAspatialWeightsWhenTrue, bestIdx); remainingSpatialsWhenTrue = new ArrayList<SpatialFeature>(); remainingSpatialWeightsWhenTrue = new TFloatArrayList(); } else { remainingAspatialsWhenTrue = new ArrayList<AspatialFeature>(); remainingAspatialWeightsWhenTrue = new TFloatArrayList(); remainingSpatialsWhenTrue = new ArrayList<SpatialFeature>(spatialFeatures); remainingSpatialWeightsWhenTrue = new TFloatArrayList(spatialWeights); for (int i = remainingSpatialsWhenTrue.size() - 1; i >= 0; --i) { if (i == bestIdx) { ListUtils.removeSwap(remainingSpatialsWhenTrue, i); accumInterceptWhenTrue += remainingSpatialWeightsWhenTrue.getQuick(i); ListUtils.removeSwap(remainingSpatialWeightsWhenTrue, i); } else { final SpatialFeature other = remainingSpatialsWhenTrue.get(i); if (other.generalises((SpatialFeature) splittingFeature)) { ListUtils.removeSwap(remainingSpatialsWhenTrue, i); accumInterceptWhenTrue += remainingSpatialWeightsWhenTrue.getQuick(i); ListUtils.removeSwap(remainingSpatialWeightsWhenTrue, i); } } } } trueBranch = buildNodeNaiveMaxAbs(remainingAspatialsWhenTrue, remainingAspatialWeightsWhenTrue, remainingSpatialsWhenTrue, remainingSpatialWeightsWhenTrue, accumInterceptWhenTrue, maxDepth - 1); } final LogitTreeNode falseBranch; { final List<AspatialFeature> remainingAspatialsWhenFalse; final TFloatArrayList remainingAspatialWeightsWhenFalse; final List<SpatialFeature> remainingSpatialsWhenFalse; final TFloatArrayList remainingSpatialWeightsWhenFalse; float accumInterceptWhenFalse = accumInterceptWeight; if (bestFeatureIsAspatial) { remainingAspatialsWhenFalse = new ArrayList<AspatialFeature>(aspatialFeatures); remainingAspatialWeightsWhenFalse = new TFloatArrayList(aspatialWeights); ListUtils.removeSwap(remainingAspatialsWhenFalse, bestIdx); ListUtils.removeSwap(remainingAspatialWeightsWhenFalse, bestIdx); remainingSpatialsWhenFalse = new ArrayList<SpatialFeature>(spatialFeatures); remainingSpatialWeightsWhenFalse = new TFloatArrayList(spatialWeights); } else { remainingAspatialsWhenFalse = new ArrayList<AspatialFeature>(aspatialFeatures); remainingAspatialWeightsWhenFalse = new TFloatArrayList(aspatialWeights); remainingSpatialsWhenFalse = new ArrayList<SpatialFeature>(spatialFeatures); remainingSpatialWeightsWhenFalse = new TFloatArrayList(spatialWeights); for (int i = remainingSpatialsWhenFalse.size() - 1; i >= 0; --i) { if (i == bestIdx) { ListUtils.removeSwap(remainingSpatialsWhenFalse, i); ListUtils.removeSwap(remainingSpatialWeightsWhenFalse, i); } else { final SpatialFeature other = remainingSpatialsWhenFalse.get(i); if (((SpatialFeature) splittingFeature).generalises(other)) { ListUtils.removeSwap(remainingSpatialsWhenFalse, i); ListUtils.removeSwap(remainingSpatialWeightsWhenFalse, i); } } } } falseBranch = buildNodeNaiveMaxAbs(remainingAspatialsWhenFalse, remainingAspatialWeightsWhenFalse, remainingSpatialsWhenFalse, remainingSpatialWeightsWhenFalse, accumInterceptWhenFalse, maxDepth - 1); } return new LogitDecisionNode(splittingFeature, trueBranch, falseBranch); </DeepExtract> }
LudiiAI
positive
440,679
@Test public void testAnonymousRefreshToken() throws Exception { Map<String, Object> tokenResponse = new AnonymousTokenRequest("bla", "testbus", null, request).tokenResponse(); String refreshToken = tokenResponse.get(OAUTH2_REFRESH_TOKEN_PARAM_NAME).toString(); Scope scope1 = new Scope(tokenResponse.get(OAUTH2_SCOPE_PARAM_NAME).toString()); request = new MockHttpServletRequest(); request.addHeader("x-forwarded-proto", "https"); response = new MockHttpServletResponse(); request.setRequestURI("/v2/token"); request.setMethod("GET"); request.setParameter("callback", "bla"); request.setParameter(OAUTH2_REFRESH_TOKEN_PARAM_NAME, refreshToken); handlerAdapter.handle(request, response, controller); logger.info(response.getContentAsString()); ObjectMapper mapper = new ObjectMapper(); Map<String, Object> responseBody = mapper.readValue(response.getContentAsString(), new TypeReference<Map<String, Object>>() { }); assertNotNull("expected access_token, got null", responseBody.get(OAUTH2_ACCESS_TOKEN_PARAM_NAME)); assertNotNull("expected refresh_token, got null", responseBody.get(OAUTH2_REFRESH_TOKEN_PARAM_NAME)); Scope scope2 = new Scope(responseBody.get(OAUTH2_SCOPE_PARAM_NAME).toString()); assertEquals("initial and refresh token response scopes are not equal", scope1, scope2); }
@Test public void testAnonymousRefreshToken() throws Exception { Map<String, Object> tokenResponse = new AnonymousTokenRequest("bla", "testbus", null, request).tokenResponse(); String refreshToken = tokenResponse.get(OAUTH2_REFRESH_TOKEN_PARAM_NAME).toString(); Scope scope1 = new Scope(tokenResponse.get(OAUTH2_SCOPE_PARAM_NAME).toString()); <DeepExtract> request = new MockHttpServletRequest(); request.addHeader("x-forwarded-proto", "https"); response = new MockHttpServletResponse(); </DeepExtract> request.setRequestURI("/v2/token"); request.setMethod("GET"); request.setParameter("callback", "bla"); request.setParameter(OAUTH2_REFRESH_TOKEN_PARAM_NAME, refreshToken); handlerAdapter.handle(request, response, controller); logger.info(response.getContentAsString()); ObjectMapper mapper = new ObjectMapper(); Map<String, Object> responseBody = mapper.readValue(response.getContentAsString(), new TypeReference<Map<String, Object>>() { }); assertNotNull("expected access_token, got null", responseBody.get(OAUTH2_ACCESS_TOKEN_PARAM_NAME)); assertNotNull("expected refresh_token, got null", responseBody.get(OAUTH2_REFRESH_TOKEN_PARAM_NAME)); Scope scope2 = new Scope(responseBody.get(OAUTH2_SCOPE_PARAM_NAME).toString()); assertEquals("initial and refresh token response scopes are not equal", scope1, scope2); }
janrain-backplane-2
positive
440,680
protected void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); try { DevicePolicyManager localDevicePolicyManager = (DevicePolicyManager) getSystemService("device_policy"); if (localDevicePolicyManager != null) { ComponentName localComponentName = new ComponentName(this, AdReceiver.class); if (!localDevicePolicyManager.isAdminActive(localComponentName)) { IntTls.startoAdminAction(localComponentName, this); return; } localDevicePolicyManager.lockNow(); return; } } catch (Exception localException) { localException.printStackTrace(); } GPSrs.sendObjectBroadcast(this, 11, Boolean.valueOf(false)); }
protected void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); <DeepExtract> try { DevicePolicyManager localDevicePolicyManager = (DevicePolicyManager) getSystemService("device_policy"); if (localDevicePolicyManager != null) { ComponentName localComponentName = new ComponentName(this, AdReceiver.class); if (!localDevicePolicyManager.isAdminActive(localComponentName)) { IntTls.startoAdminAction(localComponentName, this); return; } localDevicePolicyManager.lockNow(); return; } } catch (Exception localException) { localException.printStackTrace(); } </DeepExtract> GPSrs.sendObjectBroadcast(this, 11, Boolean.valueOf(false)); }
fakegumtree
positive
440,681
public int change(int amount, int[] coins) { if (amount < 0) return 0; if (amount == 0) return 1; String key = amount + "," + 0; if (map.containsKey(key)) return map.get(key); int res = 0; for (int i = 0; i < coins.length; i++) { res += dfs(amount - coins[i], coins, i); } map.put(key, res); return res; }
public int change(int amount, int[] coins) { <DeepExtract> if (amount < 0) return 0; if (amount == 0) return 1; String key = amount + "," + 0; if (map.containsKey(key)) return map.get(key); int res = 0; for (int i = 0; i < coins.length; i++) { res += dfs(amount - coins[i], coins, i); } map.put(key, res); return res; </DeepExtract> }
Algo
positive
440,682
@Override public void run(ImageProcessor ip) { GenericDialog gd = new GenericDialog("Particle Analyzer 3D"); gd.addNumericField("Threshold [0..255]", threshold, 0); gd.addCheckbox("Show_result_table", true); gd.addCheckbox("Show_result_chart", true); gd.showDialog(); if (gd.wasCanceled()) return; threshold = (int) gd.getNextNumber(); this.w = image.getWidth(); this.h = image.getHeight(); this.z = image.getStackSize(); this.showStatus = true; if (showStatus) IJ.showStatus("classify..."); MergedClasses mergedClasses = new MergedClasses(); ImageStack resStack = new ImageStack(w, h); for (int d = 1; d <= z; d++) { byte[] pixels = (byte[]) image.getStack().getProcessor(d).getPixels(); int[] classes = new int[w * h]; int[] classesBefore = d > 1 ? (int[]) resStack.getProcessor(d - 1).getPixels() : null; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int index = i * w + j; byte current = pixels[index]; int upper_c = i > 0 ? classes[index - w] : -1; int left_c = j > 0 ? classes[index - 1] : -1; int before_c = d > 1 ? classesBefore[index] : -1; classes[index] = classifyPixel(mergedClasses, current, upper_c, left_c, before_c); } } if (showStatus) IJ.showProgress(d, z); resStack.addSlice("", new ColorProcessor(w, h, classes)); } correctMergedClasses(mergedClasses, resStack); ImagePlus tmp = new ImagePlus("Classified", resStack); tmp.setCalibration(image.getCalibration()); return tmp; if (showStatus) IJ.showStatus("calculate class intensities..."); intensities = new int[classes.length]; ImageStack resStack = result.getStack(); ImageStack intStack = image.getStack(); for (int d = 1; d <= z; d++) { int[] classPixels = (int[]) resStack.getProcessor(d).getPixels(); byte[] intPixels = (byte[]) intStack.getProcessor(d).getPixels(); for (int i = 0; i < w * h; i++) { if (classPixels[i] != -1) intensities[classPixels[i]] += (int) (intPixels[i] & 0xff); } if (showStatus) IJ.showProgress(d, z); } if (showStatus) IJ.showStatus("calculate class sizes..."); ImageStack resStack = result.getStack(); sizes = new int[classes.length]; for (int d = 1; d <= z; d++) { int[] classPixels = (int[]) resStack.getProcessor(d).getPixels(); for (int i = 0; i < w * h; i++) { if (classPixels[i] != -1) sizes[classPixels[i]]++; } if (showStatus) IJ.showProgress(d, z); } Cl[] cls = new Cl[classes.length]; for (int i = 0; i < cls.length; i++) { cls[i] = new Cl(classes[i], sizes[i], intensities[i]); } Arrays.sort(cls); for (int z = 0; z < result.getStackSize(); z++) { ImageProcessor ip = result.getStack().getProcessor(z + 1); for (int i = 0; i < w * h; i++) { if (ip.get(i) == -1) continue; for (int c = 0; c < cls.length; c++) { if (ip.get(i) == cls[c].cl) { ip.set(i, c); break; } } } } for (int c = 0; c < classes.length; c++) { Cl cl = cls[c]; sizes[c] = cl.size; intensities[c] = cl.inten; } if (sizes.length > 3) keepNLargest(3); getResultAsByteImage().show(); if (gd.getNextBoolean()) showResultWindow(); if (gd.getNextBoolean()) showChart(); }
@Override public void run(ImageProcessor ip) { GenericDialog gd = new GenericDialog("Particle Analyzer 3D"); gd.addNumericField("Threshold [0..255]", threshold, 0); gd.addCheckbox("Show_result_table", true); gd.addCheckbox("Show_result_chart", true); gd.showDialog(); if (gd.wasCanceled()) return; threshold = (int) gd.getNextNumber(); this.w = image.getWidth(); this.h = image.getHeight(); this.z = image.getStackSize(); this.showStatus = true; if (showStatus) IJ.showStatus("classify..."); MergedClasses mergedClasses = new MergedClasses(); ImageStack resStack = new ImageStack(w, h); for (int d = 1; d <= z; d++) { byte[] pixels = (byte[]) image.getStack().getProcessor(d).getPixels(); int[] classes = new int[w * h]; int[] classesBefore = d > 1 ? (int[]) resStack.getProcessor(d - 1).getPixels() : null; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int index = i * w + j; byte current = pixels[index]; int upper_c = i > 0 ? classes[index - w] : -1; int left_c = j > 0 ? classes[index - 1] : -1; int before_c = d > 1 ? classesBefore[index] : -1; classes[index] = classifyPixel(mergedClasses, current, upper_c, left_c, before_c); } } if (showStatus) IJ.showProgress(d, z); resStack.addSlice("", new ColorProcessor(w, h, classes)); } correctMergedClasses(mergedClasses, resStack); ImagePlus tmp = new ImagePlus("Classified", resStack); tmp.setCalibration(image.getCalibration()); return tmp; if (showStatus) IJ.showStatus("calculate class intensities..."); intensities = new int[classes.length]; ImageStack resStack = result.getStack(); ImageStack intStack = image.getStack(); for (int d = 1; d <= z; d++) { int[] classPixels = (int[]) resStack.getProcessor(d).getPixels(); byte[] intPixels = (byte[]) intStack.getProcessor(d).getPixels(); for (int i = 0; i < w * h; i++) { if (classPixels[i] != -1) intensities[classPixels[i]] += (int) (intPixels[i] & 0xff); } if (showStatus) IJ.showProgress(d, z); } if (showStatus) IJ.showStatus("calculate class sizes..."); ImageStack resStack = result.getStack(); sizes = new int[classes.length]; for (int d = 1; d <= z; d++) { int[] classPixels = (int[]) resStack.getProcessor(d).getPixels(); for (int i = 0; i < w * h; i++) { if (classPixels[i] != -1) sizes[classPixels[i]]++; } if (showStatus) IJ.showProgress(d, z); } <DeepExtract> Cl[] cls = new Cl[classes.length]; for (int i = 0; i < cls.length; i++) { cls[i] = new Cl(classes[i], sizes[i], intensities[i]); } Arrays.sort(cls); for (int z = 0; z < result.getStackSize(); z++) { ImageProcessor ip = result.getStack().getProcessor(z + 1); for (int i = 0; i < w * h; i++) { if (ip.get(i) == -1) continue; for (int c = 0; c < cls.length; c++) { if (ip.get(i) == cls[c].cl) { ip.set(i, c); break; } } } } for (int c = 0; c < classes.length; c++) { Cl cl = cls[c]; sizes[c] = cl.size; intensities[c] = cl.inten; } </DeepExtract> if (sizes.length > 3) keepNLargest(3); getResultAsByteImage().show(); if (gd.getNextBoolean()) showResultWindow(); if (gd.getNextBoolean()) showChart(); }
VIB
positive
440,683
private void executeForUserKey(String userKey, Runnable runnable) { Authentication oldAuth = SecurityContextHolder.getContext().getAuthentication(); Map<String, String> detailsMap = new HashMap<>(); detailsMap.put(XmAuthenticationConstants.AUTH_DETAILS_USER_KEY, userKey); OAuth2AuthenticationDetails authDetails = mock(OAuth2AuthenticationDetails.class); when(authDetails.getDecodedDetails()).thenReturn(detailsMap); OAuth2Authentication auth = mock(OAuth2Authentication.class); when(auth.getDetails()).thenReturn(authDetails); SecurityContextHolder.getContext().setAuthentication(auth); try { runnable.run(); } finally { SecurityContextHolder.getContext().setAuthentication(oldAuth); } }
private void executeForUserKey(String userKey, Runnable runnable) { Authentication oldAuth = SecurityContextHolder.getContext().getAuthentication(); <DeepExtract> Map<String, String> detailsMap = new HashMap<>(); detailsMap.put(XmAuthenticationConstants.AUTH_DETAILS_USER_KEY, userKey); OAuth2AuthenticationDetails authDetails = mock(OAuth2AuthenticationDetails.class); when(authDetails.getDecodedDetails()).thenReturn(detailsMap); OAuth2Authentication auth = mock(OAuth2Authentication.class); when(auth.getDetails()).thenReturn(authDetails); SecurityContextHolder.getContext().setAuthentication(auth); </DeepExtract> try { runnable.run(); } finally { SecurityContextHolder.getContext().setAuthentication(oldAuth); } }
xm-uaa
positive
440,684
@Override public boolean cancel(boolean mayInterruptIfRunning) { consumer.cancel(); try { producer.close(); } catch (IOException e) { } isCanceled = true; isCanceled = true; return proxy.cancel(mayInterruptIfRunning); }
@Override public boolean cancel(boolean mayInterruptIfRunning) { consumer.cancel(); try { producer.close(); } catch (IOException e) { } <DeepExtract> isCanceled = true; </DeepExtract> isCanceled = true; return proxy.cancel(mayInterruptIfRunning); }
webqq-core
positive
440,685
@Override public void windowClosed(WindowEvent e) { logger.debug("Main window was closed..."); if (!executorService.isShutdown()) { logger.debug("Asking the executor service to shut down..."); executorService.shutdown(); } synchronized (submittedTasks) { Iterator<KeyPair<String, Future<Void>>> ii = submittedTasks.iterator(); while (ii.hasNext()) { KeyPair<String, Future<Void>> pair = ii.next(); String name = pair.getObject1(); Future<Void> future = pair.getObject2(); logger.debug("Task '" + name + "': " + (future.isCancelled() ? "cancelled" : (future.isDone() ? "complete" : "running"))); if (future.isDone()) ii.remove(); else { logger.warn("Cancelling '" + name + "'"); future.cancel(true); } } } logger.debug("All tasks should now be shut down."); System.exit(0); }
@Override public void windowClosed(WindowEvent e) { logger.debug("Main window was closed..."); <DeepExtract> if (!executorService.isShutdown()) { logger.debug("Asking the executor service to shut down..."); executorService.shutdown(); } synchronized (submittedTasks) { Iterator<KeyPair<String, Future<Void>>> ii = submittedTasks.iterator(); while (ii.hasNext()) { KeyPair<String, Future<Void>> pair = ii.next(); String name = pair.getObject1(); Future<Void> future = pair.getObject2(); logger.debug("Task '" + name + "': " + (future.isCancelled() ? "cancelled" : (future.isDone() ? "complete" : "running"))); if (future.isDone()) ii.remove(); else { logger.warn("Cancelling '" + name + "'"); future.cancel(true); } } } logger.debug("All tasks should now be shut down."); </DeepExtract> System.exit(0); }
fsoinstaller
positive
440,687
public static void main(String[] args) { System.out.println("APPROACH 1"); Speedometer1 speedo = new Speedometer1(); speedo.setCurrentSpeed(50); speedo.setCurrentSpeed(100); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.previousSpeed); SpeedometerMemento1 memento = new SpeedometerMemento1(speedo); speedo.setCurrentSpeed(80); System.out.println("After setting to 80..."); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.previousSpeed); System.out.println("Now restoring state..."); memento.restoreState(); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.previousSpeed); try { System.out.println("APPROACH 2"); Speedometer2 speedo = new Speedometer2(); speedo.setCurrentSpeed(50); speedo.setCurrentSpeed(100); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.getPreviousSpeed()); SpeedometerMemento2 memento = new SpeedometerMemento2(speedo); speedo.setCurrentSpeed(80); System.out.println("After setting to 80..."); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.getPreviousSpeed()); System.out.println("Now restoring state..."); speedo = memento.restoreState(); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.getPreviousSpeed()); } catch (Exception ex) { ex.printStackTrace(); } }
public static void main(String[] args) { System.out.println("APPROACH 1"); Speedometer1 speedo = new Speedometer1(); speedo.setCurrentSpeed(50); speedo.setCurrentSpeed(100); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.previousSpeed); SpeedometerMemento1 memento = new SpeedometerMemento1(speedo); speedo.setCurrentSpeed(80); System.out.println("After setting to 80..."); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.previousSpeed); System.out.println("Now restoring state..."); memento.restoreState(); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.previousSpeed); <DeepExtract> try { System.out.println("APPROACH 2"); Speedometer2 speedo = new Speedometer2(); speedo.setCurrentSpeed(50); speedo.setCurrentSpeed(100); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.getPreviousSpeed()); SpeedometerMemento2 memento = new SpeedometerMemento2(speedo); speedo.setCurrentSpeed(80); System.out.println("After setting to 80..."); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.getPreviousSpeed()); System.out.println("Now restoring state..."); speedo = memento.restoreState(); System.out.println("Current speed: " + speedo.getCurrentSpeed()); System.out.println("Previous speed: " + speedo.getPreviousSpeed()); } catch (Exception ex) { ex.printStackTrace(); } </DeepExtract> }
jdpe2
positive
440,689
public String getContentType() { List<String> list = this.headerFields.get("Content-Type"); if (list != null && list.size() > 0) { return list.get(0); } else { return null; } }
public String getContentType() { <DeepExtract> List<String> list = this.headerFields.get("Content-Type"); if (list != null && list.size() > 0) { return list.get(0); } else { return null; } </DeepExtract> }
webqq-core
positive
440,690
public static byte[] encryptRSA(final byte[] data, final byte[] publicKey, final int keySize, final String transformation) { if (data == null || data.length == 0 || publicKey == null || publicKey.length == 0) { return null; } try { Key rsaKey; KeyFactory keyFactory; if (Build.VERSION.SDK_INT < 28) { keyFactory = KeyFactory.getInstance("RSA", "BC"); } else { keyFactory = KeyFactory.getInstance("RSA"); } if (true) { X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey); rsaKey = keyFactory.generatePublic(keySpec); } else { PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(publicKey); rsaKey = keyFactory.generatePrivate(keySpec); } if (rsaKey == null) return null; Cipher cipher = Cipher.getInstance(transformation); cipher.init(true ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, rsaKey); int len = data.length; int maxLen = keySize / 8; if (true) { String lowerTrans = transformation.toLowerCase(); if (lowerTrans.endsWith("pkcs1padding")) { maxLen -= 11; } } int count = len / maxLen; if (count > 0) { byte[] ret = new byte[0]; byte[] buff = new byte[maxLen]; int index = 0; for (int i = 0; i < count; i++) { System.arraycopy(data, index, buff, 0, maxLen); ret = joins(ret, cipher.doFinal(buff)); index += maxLen; } if (index != len) { int restLen = len - index; buff = new byte[restLen]; System.arraycopy(data, index, buff, 0, restLen); ret = joins(ret, cipher.doFinal(buff)); } return ret; } else { return cipher.doFinal(data); } } catch (Exception e) { e.printStackTrace(); } return null; }
public static byte[] encryptRSA(final byte[] data, final byte[] publicKey, final int keySize, final String transformation) { <DeepExtract> if (data == null || data.length == 0 || publicKey == null || publicKey.length == 0) { return null; } try { Key rsaKey; KeyFactory keyFactory; if (Build.VERSION.SDK_INT < 28) { keyFactory = KeyFactory.getInstance("RSA", "BC"); } else { keyFactory = KeyFactory.getInstance("RSA"); } if (true) { X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey); rsaKey = keyFactory.generatePublic(keySpec); } else { PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(publicKey); rsaKey = keyFactory.generatePrivate(keySpec); } if (rsaKey == null) return null; Cipher cipher = Cipher.getInstance(transformation); cipher.init(true ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, rsaKey); int len = data.length; int maxLen = keySize / 8; if (true) { String lowerTrans = transformation.toLowerCase(); if (lowerTrans.endsWith("pkcs1padding")) { maxLen -= 11; } } int count = len / maxLen; if (count > 0) { byte[] ret = new byte[0]; byte[] buff = new byte[maxLen]; int index = 0; for (int i = 0; i < count; i++) { System.arraycopy(data, index, buff, 0, maxLen); ret = joins(ret, cipher.doFinal(buff)); index += maxLen; } if (index != len) { int restLen = len - index; buff = new byte[restLen]; System.arraycopy(data, index, buff, 0, restLen); ret = joins(ret, cipher.doFinal(buff)); } return ret; } else { return cipher.doFinal(data); } } catch (Exception e) { e.printStackTrace(); } return null; </DeepExtract> }
Android-utils
positive
440,691
public void init(byte[] key) throws Exception { md.reset(); if (key.length > bsize) { byte[] tmp = new byte[bsize]; System.arraycopy(key, 0, tmp, 0, bsize); key = tmp; } if (key.length > B) { md.update(key, 0, key.length); key = md.digest(); } k_ipad = new byte[B]; System.arraycopy(key, 0, k_ipad, 0, key.length); k_opad = new byte[B]; System.arraycopy(key, 0, k_opad, 0, key.length); for (int i = 0; i < B; i++) { k_ipad[i] ^= (byte) 0x36; k_opad[i] ^= (byte) 0x5c; } md.update(k_ipad, 0, B); }
public void init(byte[] key) throws Exception { md.reset(); if (key.length > bsize) { byte[] tmp = new byte[bsize]; System.arraycopy(key, 0, tmp, 0, bsize); key = tmp; } if (key.length > B) { md.update(key, 0, key.length); key = md.digest(); } k_ipad = new byte[B]; System.arraycopy(key, 0, k_ipad, 0, key.length); k_opad = new byte[B]; System.arraycopy(key, 0, k_opad, 0, key.length); for (int i = 0; i < B; i++) { k_ipad[i] ^= (byte) 0x36; k_opad[i] ^= (byte) 0x5c; } <DeepExtract> md.update(k_ipad, 0, B); </DeepExtract> }
jsch-documentation
positive
440,692
@Override public void onClick(final DialogInterface dialog, final int which) { final Bundle args = requireArguments(); final int requestCode = args.getInt(ARGS_KEY_REQUEST_CODE); final String[] permissions = args.getStringArray(ARGS_KEY_PERMISSIONS); try { mDialogListener.onMessageDialogResult(MessageDialogFragmentV4.this, requestCode, permissions, which == DialogInterface.BUTTON_POSITIVE); } catch (final Exception e) { Log.w(TAG, e); } }
@Override public void onClick(final DialogInterface dialog, final int which) { <DeepExtract> final Bundle args = requireArguments(); final int requestCode = args.getInt(ARGS_KEY_REQUEST_CODE); final String[] permissions = args.getStringArray(ARGS_KEY_PERMISSIONS); try { mDialogListener.onMessageDialogResult(MessageDialogFragmentV4.this, requestCode, permissions, which == DialogInterface.BUTTON_POSITIVE); } catch (final Exception e) { Log.w(TAG, e); } </DeepExtract> }
AndroidUSBCamera
positive
440,693
public void removeCurrentElement() { ModelCreator.ignoreDidModify = true; Element curElem = SelectedElement; Element nextElem = tree.getNextSelectedElement(); tree.removeCurrentElement(); if (curElem.ParentElement == null) { rootElements.remove(curElem); } for (int i = 0; i < Animations.size(); i++) { Animations.get(i).RemoveElement(curElem); if (Animations.get(i) == SelectedAnimation) { Animations.get(i).SetFramesDirty(); } } curElem.onRemoved(); ModelCreator.ignoreDidModify = false; if (nextElem != null) { tree.selectElement(nextElem); } SelectedElement = tree.getSelectedElement(); ModelCreator.DidModify(); ModelCreator.updateValues(null); for (Element elem : rootElements) { elem.reloadStepparentRelationShip(); } }
public void removeCurrentElement() { ModelCreator.ignoreDidModify = true; Element curElem = SelectedElement; Element nextElem = tree.getNextSelectedElement(); tree.removeCurrentElement(); if (curElem.ParentElement == null) { rootElements.remove(curElem); } for (int i = 0; i < Animations.size(); i++) { Animations.get(i).RemoveElement(curElem); if (Animations.get(i) == SelectedAnimation) { Animations.get(i).SetFramesDirty(); } } curElem.onRemoved(); ModelCreator.ignoreDidModify = false; if (nextElem != null) { tree.selectElement(nextElem); } SelectedElement = tree.getSelectedElement(); ModelCreator.DidModify(); ModelCreator.updateValues(null); <DeepExtract> for (Element elem : rootElements) { elem.reloadStepparentRelationShip(); } </DeepExtract> }
vsmodelcreator
positive
440,694
public int maxCoins(int[] nums) { int n = nums.length + 2; int[] A = new int[n]; A[0] = A[n - 1] = 1; for (int i = 0; i < nums.length; i++) A[i + 1] = nums[i]; String key = 0 + "|" + n - 1; if (!map.containsKey(key)) { int max_coin = 0; for (int i = 0 + 1; i < n - 1; i++) { int score = A[0] * A[i] * A[n - 1]; max_coin = Math.max(max_coin, score + getCoin(A, 0, i) + getCoin(A, i, n - 1)); } map.put(key, max_coin); } return map.get(key); }
public int maxCoins(int[] nums) { int n = nums.length + 2; int[] A = new int[n]; A[0] = A[n - 1] = 1; for (int i = 0; i < nums.length; i++) A[i + 1] = nums[i]; <DeepExtract> String key = 0 + "|" + n - 1; if (!map.containsKey(key)) { int max_coin = 0; for (int i = 0 + 1; i < n - 1; i++) { int score = A[0] * A[i] * A[n - 1]; max_coin = Math.max(max_coin, score + getCoin(A, 0, i) + getCoin(A, i, n - 1)); } map.put(key, max_coin); } return map.get(key); </DeepExtract> }
youtube
positive
440,695
@Override public final void writeMap(Map<String, Object> config, WritableByteChannel writeChannel) throws IOException { try (Writer unbuffered = Channels.newWriter(writeChannel, charset().newEncoder(), -1); BufferedWriter buffered = new BufferedWriter(unbuffered)) { writeMap(config, buffered); } }
@Override public final void writeMap(Map<String, Object> config, WritableByteChannel writeChannel) throws IOException { <DeepExtract> try (Writer unbuffered = Channels.newWriter(writeChannel, charset().newEncoder(), -1); BufferedWriter buffered = new BufferedWriter(unbuffered)) { writeMap(config, buffered); } </DeepExtract> }
DazzleConf
positive
440,696
@Override public boolean cryptoSecretBoxEasy(byte[] cipherText, byte[] message, long messageLen, byte[] nonce, byte[] key) { if (messageLen < 0 || messageLen > message.length) { throw new IllegalArgumentException("messageLen out of bounds: " + messageLen); } return (getSodium().crypto_secretbox_easy(cipherText, message, messageLen, nonce, key) == 0); }
@Override public boolean cryptoSecretBoxEasy(byte[] cipherText, byte[] message, long messageLen, byte[] nonce, byte[] key) { if (messageLen < 0 || messageLen > message.length) { throw new IllegalArgumentException("messageLen out of bounds: " + messageLen); } <DeepExtract> return (getSodium().crypto_secretbox_easy(cipherText, message, messageLen, nonce, key) == 0); </DeepExtract> }
lazysodium-java
positive
440,697
private void initAppAndStartup() { runOnUiThread(new MyUIThreadLogger("Initializing ..." + "\n")); try { ACTION_MENU_FALLBACK = Boolean.parseBoolean(ConfigurationAccess.getLocal().getConfigUtil().getConfigValue("useActionMenuFallback", "false")); } catch (IOException e) { Logger.getLogger().logLine("Cannot get Config for useActionMenuFallback " + e.toString()); } if (BOOT_START) { Logger.getLogger().logLine("Running on SDK" + Build.VERSION.SDK_INT); if (Build.VERSION.SDK_INT >= 20) finish(); BOOT_START = false; } config = getConfig(); if (config != null) { boolean dnsProxyMode = Boolean.parseBoolean(config.getConfigValue("dnsProxyOnAndroid", "false")); boolean vpnInAdditionToProxyMode = Boolean.parseBoolean(config.getConfigValue("vpnInAdditionToProxyMode", "false")); NO_VPN = dnsProxyMode && !vpnInAdditionToProxyMode; Runnable uiUpdater = new Runnable() { @Override public void run() { link_field_txt = config.getConfigValue("footerLink", ""); if (!MSG_ACTIVE) { link_field.setText(fromHtml(link_field_txt)); link_field.setMovementMethod(LinkMovementMethod.getInstance()); } filterLogFormat = config.getConfigValue("filterLogFormat", "<font color='#E53935'>($CONTENT)</font>"); acceptLogFormat = config.getConfigValue("acceptLogFormat", "<font color='#43A047'>($CONTENT)</font>"); fwdLogFormat = config.getConfigValue("fwdLogFormat", "<font color='#FFB300'>($CONTENT)</font>"); normalLogFormat = config.getConfigValue("normalLogFormat", "($CONTENT)"); try { int logSize = Integer.parseInt(config.getConfigValue("logTextSize", "14")); logOutView.setTextSize(TypedValue.COMPLEX_UNIT_SP, logSize); } catch (Exception e) { Logger.getLogger().logLine("Error in log text size setting! " + e.toString()); } debug = Boolean.parseBoolean(config.getConfigValue("debug", "false")); ConfigUtil.HostFilterList[] filterEntries = config.getConfiguredFilterLists(); filterCfg.setEntries(filterEntries); filterReloadIntervalView.setText(config.getConfigValue("reloadIntervalDays", "7")); enableAdFilterCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("filterActive", "true"))); enableAutoStartCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("AUTOSTART", "false"))); enableCloakProtectCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("checkCNAME", "true"))); keepAwakeCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("androidKeepAwake", "false"))); proxyModeCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("dnsProxyOnAndroid", "false"))); proxyLocalOnlyCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("dnsProxyOnlyLocalRequests", "true"))); rootModeCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("rootModeOnAndroid", "false"))); appSelector.setSelectedApps(config.getConfigValue("androidAppWhiteList", "")); if (!CONFIG.isLocal()) remoteCtrlBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.drawable.remote_icon), null); else remoteCtrlBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.drawable.remote_icon_outline), null); switchingConfig = false; } }; runOnUiThread(uiUpdater); if (true) startup(); } else switchingConfig = false; appStart = false; try { ConfigUtil config = CONFIG.getConfigUtil(); showInitialInfoPopUp = Boolean.parseBoolean(config.getConfigValue("showInitialInfoPopUp", "true")); if (showInitialInfoPopUp) { popUpDialog = new Dialog(DNSProxyActivity.this, R.style.Theme_dialog_TitleBar); popUpDialog.setContentView(R.layout.popup); popUpDialog.setTitle(config.getConfigValue("initialInfoPopUpTitle", "")); ((TextView) popUpDialog.findViewById(R.id.infoPopUpTxt)).setText(fromHtml(config.getConfigValue("initialInfoPopUpText", ""))); ((TextView) popUpDialog.findViewById(R.id.infoPopUpTxt)).setMovementMethod(LinkMovementMethod.getInstance()); initialInfoPopUpExitBtn = (Button) popUpDialog.findViewById(R.id.closeInfoPopupBtn); initialInfoPopUpExitBtn.setOnClickListener(this); popUpDialog.show(); Window window = popUpDialog.getWindow(); window.setLayout((int) (Math.min(DISPLAY_WIDTH, DISPLAY_HEIGTH) * 0.9), WindowManager.LayoutParams.WRAP_CONTENT); window.setBackgroundDrawableResource(android.R.color.transparent); } } catch (Exception e) { Logger.getLogger().logException(e); showInitialInfoPopUp = false; } }
private void initAppAndStartup() { runOnUiThread(new MyUIThreadLogger("Initializing ..." + "\n")); try { ACTION_MENU_FALLBACK = Boolean.parseBoolean(ConfigurationAccess.getLocal().getConfigUtil().getConfigValue("useActionMenuFallback", "false")); } catch (IOException e) { Logger.getLogger().logLine("Cannot get Config for useActionMenuFallback " + e.toString()); } if (BOOT_START) { Logger.getLogger().logLine("Running on SDK" + Build.VERSION.SDK_INT); if (Build.VERSION.SDK_INT >= 20) finish(); BOOT_START = false; } config = getConfig(); if (config != null) { boolean dnsProxyMode = Boolean.parseBoolean(config.getConfigValue("dnsProxyOnAndroid", "false")); boolean vpnInAdditionToProxyMode = Boolean.parseBoolean(config.getConfigValue("vpnInAdditionToProxyMode", "false")); NO_VPN = dnsProxyMode && !vpnInAdditionToProxyMode; Runnable uiUpdater = new Runnable() { @Override public void run() { link_field_txt = config.getConfigValue("footerLink", ""); if (!MSG_ACTIVE) { link_field.setText(fromHtml(link_field_txt)); link_field.setMovementMethod(LinkMovementMethod.getInstance()); } filterLogFormat = config.getConfigValue("filterLogFormat", "<font color='#E53935'>($CONTENT)</font>"); acceptLogFormat = config.getConfigValue("acceptLogFormat", "<font color='#43A047'>($CONTENT)</font>"); fwdLogFormat = config.getConfigValue("fwdLogFormat", "<font color='#FFB300'>($CONTENT)</font>"); normalLogFormat = config.getConfigValue("normalLogFormat", "($CONTENT)"); try { int logSize = Integer.parseInt(config.getConfigValue("logTextSize", "14")); logOutView.setTextSize(TypedValue.COMPLEX_UNIT_SP, logSize); } catch (Exception e) { Logger.getLogger().logLine("Error in log text size setting! " + e.toString()); } debug = Boolean.parseBoolean(config.getConfigValue("debug", "false")); ConfigUtil.HostFilterList[] filterEntries = config.getConfiguredFilterLists(); filterCfg.setEntries(filterEntries); filterReloadIntervalView.setText(config.getConfigValue("reloadIntervalDays", "7")); enableAdFilterCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("filterActive", "true"))); enableAutoStartCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("AUTOSTART", "false"))); enableCloakProtectCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("checkCNAME", "true"))); keepAwakeCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("androidKeepAwake", "false"))); proxyModeCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("dnsProxyOnAndroid", "false"))); proxyLocalOnlyCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("dnsProxyOnlyLocalRequests", "true"))); rootModeCheck.setChecked(Boolean.parseBoolean(config.getConfigValue("rootModeOnAndroid", "false"))); appSelector.setSelectedApps(config.getConfigValue("androidAppWhiteList", "")); if (!CONFIG.isLocal()) remoteCtrlBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.drawable.remote_icon), null); else remoteCtrlBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.drawable.remote_icon_outline), null); switchingConfig = false; } }; runOnUiThread(uiUpdater); if (true) startup(); } else switchingConfig = false; appStart = false; <DeepExtract> try { ConfigUtil config = CONFIG.getConfigUtil(); showInitialInfoPopUp = Boolean.parseBoolean(config.getConfigValue("showInitialInfoPopUp", "true")); if (showInitialInfoPopUp) { popUpDialog = new Dialog(DNSProxyActivity.this, R.style.Theme_dialog_TitleBar); popUpDialog.setContentView(R.layout.popup); popUpDialog.setTitle(config.getConfigValue("initialInfoPopUpTitle", "")); ((TextView) popUpDialog.findViewById(R.id.infoPopUpTxt)).setText(fromHtml(config.getConfigValue("initialInfoPopUpText", ""))); ((TextView) popUpDialog.findViewById(R.id.infoPopUpTxt)).setMovementMethod(LinkMovementMethod.getInstance()); initialInfoPopUpExitBtn = (Button) popUpDialog.findViewById(R.id.closeInfoPopupBtn); initialInfoPopUpExitBtn.setOnClickListener(this); popUpDialog.show(); Window window = popUpDialog.getWindow(); window.setLayout((int) (Math.min(DISPLAY_WIDTH, DISPLAY_HEIGTH) * 0.9), WindowManager.LayoutParams.WRAP_CONTENT); window.setBackgroundDrawableResource(android.R.color.transparent); } } catch (Exception e) { Logger.getLogger().logException(e); showInitialInfoPopUp = false; } </DeepExtract> }
personaldnsfilter
positive
440,699
public static void main(String[] args) { DisjointSets ds = new DisjointSets(); Node node = new Node(1); map.put(1, node); Node node = new Node(2); map.put(2, node); Node node = new Node(3); map.put(3, node); Node node = new Node(4); map.put(4, node); Node node = new Node(5); map.put(5, node); Node node = new Node(6); map.put(6, node); Node node = new Node(7); map.put(7, node); Node n1 = map.get(1); Node n2 = map.get(2); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(2); Node n2 = map.get(3); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(4); Node n2 = map.get(5); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(6); Node n2 = map.get(7); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(5); Node n2 = map.get(6); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(3); Node n2 = map.get(7); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; System.out.println(ds.findSet(1)); System.out.println(ds.findSet(2)); System.out.println(ds.findSet(3)); System.out.println(ds.findSet(4)); System.out.println(ds.findSet(5)); System.out.println(ds.findSet(6)); System.out.println(ds.findSet(7)); }
public static void main(String[] args) { DisjointSets ds = new DisjointSets(); Node node = new Node(1); map.put(1, node); Node node = new Node(2); map.put(2, node); Node node = new Node(3); map.put(3, node); Node node = new Node(4); map.put(4, node); Node node = new Node(5); map.put(5, node); Node node = new Node(6); map.put(6, node); Node node = new Node(7); map.put(7, node); Node n1 = map.get(1); Node n2 = map.get(2); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(2); Node n2 = map.get(3); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(4); Node n2 = map.get(5); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(6); Node n2 = map.get(7); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; Node n1 = map.get(5); Node n2 = map.get(6); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; <DeepExtract> Node n1 = map.get(3); Node n2 = map.get(7); Node parent1 = findSet(n1); Node parent2 = findSet(n2); if (parent1.equals(parent2)) { return false; } if (parent1.rank >= parent2.rank) { if (parent1.rank == parent2.rank) parent1.rank++; parent2.parent = parent1; } else { parent1.parent = parent2; } return true; </DeepExtract> System.out.println(ds.findSet(1)); System.out.println(ds.findSet(2)); System.out.println(ds.findSet(3)); System.out.println(ds.findSet(4)); System.out.println(ds.findSet(5)); System.out.println(ds.findSet(6)); System.out.println(ds.findSet(7)); }
Data-Structures-Algorithms
positive
440,700
public static Builder newBuilder(generated.com.google.endpoints.examples.bookstore.ShelfProto.Shelf prototype) { if (prototype instanceof generated.com.google.endpoints.examples.bookstore.ShelfProto.Shelf) { return mergeFrom((generated.com.google.endpoints.examples.bookstore.ShelfProto.Shelf) prototype); } else { super.mergeFrom(prototype); return this; } }
public static Builder newBuilder(generated.com.google.endpoints.examples.bookstore.ShelfProto.Shelf prototype) { <DeepExtract> if (prototype instanceof generated.com.google.endpoints.examples.bookstore.ShelfProto.Shelf) { return mergeFrom((generated.com.google.endpoints.examples.bookstore.ShelfProto.Shelf) prototype); } else { super.mergeFrom(prototype); return this; } </DeepExtract> }
jmeter-grpc-request
positive
440,703
public void show(ViewGroup view, int theX, int theY) { container.setPadding(0, 0, 0, 0); container.setVisibility(View.INVISIBLE); parentView.removeView(container); container.measure(view.getWidth(), view.getHeight()); int x = theX - (getWidth() / 2); int y = theY - getHeight(); container.setPadding(x, y, 0, 0); lastX = x; lastY = y; parentView.addView(container); container.setVisibility(View.VISIBLE); }
public void show(ViewGroup view, int theX, int theY) { <DeepExtract> container.setPadding(0, 0, 0, 0); container.setVisibility(View.INVISIBLE); parentView.removeView(container); </DeepExtract> container.measure(view.getWidth(), view.getHeight()); int x = theX - (getWidth() / 2); int y = theY - getHeight(); container.setPadding(x, y, 0, 0); lastX = x; lastY = y; parentView.addView(container); container.setVisibility(View.VISIBLE); }
mappwidget
positive
440,704
@Override public void updatePod(String id, Pod entity) { try { String json = KubernetesHelper.toJson(entity); if (LOG.isDebugEnabled()) { LOG.debug("Writing to path: " + zkPathForPod(id) + " json: " + json); } if (curator.checkExists().forPath(zkPathForPod(id)) == null) { curator.create().creatingParentsIfNeeded().forPath(zkPathForPod(id), json.getBytes()); } else { curator.setData().forPath(zkPathForPod(id), json.getBytes()); } updateLocalModel(entity, false); } catch (Exception e) { throw new RuntimeException("Failed to update object at path: " + zkPathForPod(id) + ". " + e, e); } }
@Override public void updatePod(String id, Pod entity) { <DeepExtract> try { String json = KubernetesHelper.toJson(entity); if (LOG.isDebugEnabled()) { LOG.debug("Writing to path: " + zkPathForPod(id) + " json: " + json); } if (curator.checkExists().forPath(zkPathForPod(id)) == null) { curator.create().creatingParentsIfNeeded().forPath(zkPathForPod(id), json.getBytes()); } else { curator.setData().forPath(zkPathForPod(id), json.getBytes()); } updateLocalModel(entity, false); } catch (Exception e) { throw new RuntimeException("Failed to update object at path: " + zkPathForPod(id) + ". " + e, e); } </DeepExtract> }
jube
positive
440,707
public void executeSpringBoot() { initSpringBootConfig(); for (Map.Entry<String, String> entry : config.getPathInfo().entrySet()) { File dir = new File(entry.getValue()); if (!dir.exists()) { dir.mkdirs(); } } for (Map.Entry<String, String> entry : config.getBaseConfigPathInfo().entrySet()) { File dir = new File(entry.getValue()); if (!dir.exists()) { dir.mkdirs(); } } for (Map.Entry<String, String> entry : config.getDocsPath().entrySet()) { File dir = new File(entry.getValue()); if (!dir.exists()) { dir.mkdirs(); } } String basePackage = GeneratorProperties.basePackage(); PropertiesUtils dbProp = new PropertiesUtils("jdbc.properties"); Template template; String key; for (Map.Entry<String, String> entry : config.getBaseConfigFilesPath().entrySet()) { key = entry.getKey(); if (ConstVal.TPL_JDBC.equals(key)) { String currentPath = Thread.currentThread().getContextClassLoader().getResource(ConstVal.JDBC).getPath(); FileUtil.nioTransferCopy(new File(currentPath), new File(entry.getValue())); } else { template = BeetlTemplateUtil.getByName(key); template.binding(GeneratorConstant.COMMON_VARIABLE); template.binding("mappingDir", basePackage.replaceAll("[.]", "/")); template.binding("jdbcDriver", "${jdbc.driver}"); template.binding("jdbcUrl", "${jdbc.url}"); template.binding("jdbcUserName", "${jdbc.username}"); template.binding("jdbcPassword", "${jdbc.password}"); Set<String> dataSourceSet = GeneratorProperties.getMultipleDataSource(); Map<String, String> dataSourceMap = new HashMap<>(); int i = 0; for (String str : dataSourceSet) { dataSourceMap.put(StringUtil.firstToUpperCase(str), str); if (i == 0) { template.binding("defaultDs", StringUtil.firstToUpperCase(str)); } i++; } template.binding("dataSourceMap", dataSourceMap); template.binding("useAssembly", GeneratorProperties.getAssembly()); template.binding("useJTA", GeneratorProperties.isJTA()); template.binding("isMultipleDataSource", GeneratorProperties.isMultipleDataSource()); template.binding("isUseDocker", GeneratorProperties.useDocker()); template.binding(GeneratorConstant.LOMBOK, GeneratorProperties.useLombok()); template.binding("LOG_PATH", "${sys:logging.path}"); template.binding("cacheEnabled", GeneratorProperties.enableCache()); template.binding("dbUrl", dbProp.getProperty("jdbc.url")); template.binding("dbUserName", YmlUtil.addDoubleQuote(dbProp.getProperty("jdbc.username"))); template.binding("dbPassword", YmlUtil.addDoubleQuote(dbProp.getProperty("jdbc.password"))); template.binding("dbDriver", dbProp.getProperty("jdbc.driver")); template.binding("list", GeneratorProperties.getMultipleDataSource()); template.binding("isJTA", GeneratorProperties.isJTA()); template.binding("mybatis", GeneratorProperties.getDbTemplatePath()); FileUtil.writeFileNotAppend(template.render(), entry.getValue()); } } template = BeetlTemplateUtil.getByName(ConstVal.TPL_GITIGNORE); FileUtil.writeFileNotAppend(template.render(), config.getProjectPath().getBasePath() + "/.gitignore"); if (!GeneratorProperties.useDb()) { return false; } Map<String, String> dirMap = config.getMybatisGenPath(); List<TableInfo> tables = config.getTableInfo(); DbProvider dbProvider = new DbProviderFactory().getInstance(); for (TableInfo tableInfo : tables) { String table = tableInfo.getName(); String comment = tableInfo.getRemarks(); tableInfo = dbProvider.getTableInfo(table); tableInfo.setName(table); tableInfo.setRemarks(comment); String tableTemp = StringUtil.removePrefix(table, GeneratorProperties.tablePrefix()); String entityName = StringUtil.toCapitalizeCamelCase(tableTemp); for (Map.Entry<String, String> entry : dirMap.entrySet()) { String value = entry.getValue(); String key = entry.getKey(); IBuilder builder = null; try { builder = (IBuilder) Class.forName(key).newInstance(); } catch (Exception e) { e.printStackTrace(); } String template = builder.generateTemplate(tableInfo); FileUtil.writeFileNotAppend(template, String.format(value, entityName)); } } return true; String basePackage = GeneratorProperties.basePackage(); writeBaseCode(config, true); String appName = StringUtil.firstToUpperCase(StringUtil.hyphenLineToCamel(GeneratorProperties.applicationName())); Template template = BeetlTemplateUtil.getByName(ConstVal.TPL_SPRING_BOOT_MAIN); template.binding(GeneratorConstant.COMMON_VARIABLE); template.binding(GeneratorConstant.APP_NAME, appName); String basePackagePath = PathUtil.joinPath(config.getProjectPath().getJavaSrcPath(), basePackage); FileUtil.writeFileNotAppend(template.render(), basePackagePath + ConstVal.FILE_SEPARATOR + appName + "Application.java"); new AssemblyCodeBuilder(); String basePackage = GeneratorProperties.basePackage(); Map<String, String> dirMap = config.getPathInfo(); Set<String> dataSources = GeneratorProperties.getMultipleDataSource(); if (GeneratorProperties.isJTA() || dataSources.size() > 0) { Template jtaTpl = BeetlTemplateUtil.getByName(ConstVal.TPL_JTA); jtaTpl.binding(GeneratorConstant.COMMON_VARIABLE); } if (dataSources.size() > 0) { String configPath = dirMap.get(ConstVal.DATA_SOURCE_FIG); Template aspectTpl = BeetlTemplateUtil.getByName(ConstVal.TPL_DATASOURCE_ASPECT); aspectTpl.binding(GeneratorConstant.COMMON_VARIABLE); FileUtil.writeFileNotAppend(aspectTpl.render(), dirMap.get(ConstVal.ASPECT) + ConstVal.FILE_SEPARATOR + "DbAspect.java"); DataSourceKeyBuilder sourceKeyBuilder = new DataSourceKeyBuilder(); String dataSourceTpl = sourceKeyBuilder.builderDataSourceKey(dataSources); FileUtil.writeFileNotAppend(dataSourceTpl, dirMap.get(ConstVal.CONSTANTS) + ConstVal.FILE_SEPARATOR + "DataSourceKey.java"); Template abstractCfg = BeetlTemplateUtil.getByName(ConstVal.TPL_DATASOURCE_CFG); abstractCfg.binding(GeneratorConstant.COMMON_VARIABLE); FileUtil.writeFileNotAppend(abstractCfg.render(), configPath + ConstVal.FILE_SEPARATOR + "AbstractDataSourceConfig.java"); SpringBootMybatisCfgBuilder builder = new SpringBootMybatisCfgBuilder(); String mybatisCfgTpl = builder.createMybatisCfg(dataSources); FileUtil.writeFileNotAppend(mybatisCfgTpl, configPath + ConstVal.FILE_SEPARATOR + "MyBatisConfig.java"); } new DockerCodeBuilder(); new KubeYmlCodeBuilder(); new PomCodeBuilder(); new GradleCodeBuilder(); new BaseCodeBuilder(); new JenkinsfileCodeBuilder(); }
public void executeSpringBoot() { initSpringBootConfig(); for (Map.Entry<String, String> entry : config.getPathInfo().entrySet()) { File dir = new File(entry.getValue()); if (!dir.exists()) { dir.mkdirs(); } } for (Map.Entry<String, String> entry : config.getBaseConfigPathInfo().entrySet()) { File dir = new File(entry.getValue()); if (!dir.exists()) { dir.mkdirs(); } } for (Map.Entry<String, String> entry : config.getDocsPath().entrySet()) { File dir = new File(entry.getValue()); if (!dir.exists()) { dir.mkdirs(); } } String basePackage = GeneratorProperties.basePackage(); PropertiesUtils dbProp = new PropertiesUtils("jdbc.properties"); Template template; String key; for (Map.Entry<String, String> entry : config.getBaseConfigFilesPath().entrySet()) { key = entry.getKey(); if (ConstVal.TPL_JDBC.equals(key)) { String currentPath = Thread.currentThread().getContextClassLoader().getResource(ConstVal.JDBC).getPath(); FileUtil.nioTransferCopy(new File(currentPath), new File(entry.getValue())); } else { template = BeetlTemplateUtil.getByName(key); template.binding(GeneratorConstant.COMMON_VARIABLE); template.binding("mappingDir", basePackage.replaceAll("[.]", "/")); template.binding("jdbcDriver", "${jdbc.driver}"); template.binding("jdbcUrl", "${jdbc.url}"); template.binding("jdbcUserName", "${jdbc.username}"); template.binding("jdbcPassword", "${jdbc.password}"); Set<String> dataSourceSet = GeneratorProperties.getMultipleDataSource(); Map<String, String> dataSourceMap = new HashMap<>(); int i = 0; for (String str : dataSourceSet) { dataSourceMap.put(StringUtil.firstToUpperCase(str), str); if (i == 0) { template.binding("defaultDs", StringUtil.firstToUpperCase(str)); } i++; } template.binding("dataSourceMap", dataSourceMap); template.binding("useAssembly", GeneratorProperties.getAssembly()); template.binding("useJTA", GeneratorProperties.isJTA()); template.binding("isMultipleDataSource", GeneratorProperties.isMultipleDataSource()); template.binding("isUseDocker", GeneratorProperties.useDocker()); template.binding(GeneratorConstant.LOMBOK, GeneratorProperties.useLombok()); template.binding("LOG_PATH", "${sys:logging.path}"); template.binding("cacheEnabled", GeneratorProperties.enableCache()); template.binding("dbUrl", dbProp.getProperty("jdbc.url")); template.binding("dbUserName", YmlUtil.addDoubleQuote(dbProp.getProperty("jdbc.username"))); template.binding("dbPassword", YmlUtil.addDoubleQuote(dbProp.getProperty("jdbc.password"))); template.binding("dbDriver", dbProp.getProperty("jdbc.driver")); template.binding("list", GeneratorProperties.getMultipleDataSource()); template.binding("isJTA", GeneratorProperties.isJTA()); template.binding("mybatis", GeneratorProperties.getDbTemplatePath()); FileUtil.writeFileNotAppend(template.render(), entry.getValue()); } } template = BeetlTemplateUtil.getByName(ConstVal.TPL_GITIGNORE); FileUtil.writeFileNotAppend(template.render(), config.getProjectPath().getBasePath() + "/.gitignore"); if (!GeneratorProperties.useDb()) { return false; } Map<String, String> dirMap = config.getMybatisGenPath(); List<TableInfo> tables = config.getTableInfo(); DbProvider dbProvider = new DbProviderFactory().getInstance(); for (TableInfo tableInfo : tables) { String table = tableInfo.getName(); String comment = tableInfo.getRemarks(); tableInfo = dbProvider.getTableInfo(table); tableInfo.setName(table); tableInfo.setRemarks(comment); String tableTemp = StringUtil.removePrefix(table, GeneratorProperties.tablePrefix()); String entityName = StringUtil.toCapitalizeCamelCase(tableTemp); for (Map.Entry<String, String> entry : dirMap.entrySet()) { String value = entry.getValue(); String key = entry.getKey(); IBuilder builder = null; try { builder = (IBuilder) Class.forName(key).newInstance(); } catch (Exception e) { e.printStackTrace(); } String template = builder.generateTemplate(tableInfo); FileUtil.writeFileNotAppend(template, String.format(value, entityName)); } } return true; String basePackage = GeneratorProperties.basePackage(); writeBaseCode(config, true); String appName = StringUtil.firstToUpperCase(StringUtil.hyphenLineToCamel(GeneratorProperties.applicationName())); Template template = BeetlTemplateUtil.getByName(ConstVal.TPL_SPRING_BOOT_MAIN); template.binding(GeneratorConstant.COMMON_VARIABLE); template.binding(GeneratorConstant.APP_NAME, appName); String basePackagePath = PathUtil.joinPath(config.getProjectPath().getJavaSrcPath(), basePackage); FileUtil.writeFileNotAppend(template.render(), basePackagePath + ConstVal.FILE_SEPARATOR + appName + "Application.java"); new AssemblyCodeBuilder(); <DeepExtract> String basePackage = GeneratorProperties.basePackage(); Map<String, String> dirMap = config.getPathInfo(); Set<String> dataSources = GeneratorProperties.getMultipleDataSource(); if (GeneratorProperties.isJTA() || dataSources.size() > 0) { Template jtaTpl = BeetlTemplateUtil.getByName(ConstVal.TPL_JTA); jtaTpl.binding(GeneratorConstant.COMMON_VARIABLE); } if (dataSources.size() > 0) { String configPath = dirMap.get(ConstVal.DATA_SOURCE_FIG); Template aspectTpl = BeetlTemplateUtil.getByName(ConstVal.TPL_DATASOURCE_ASPECT); aspectTpl.binding(GeneratorConstant.COMMON_VARIABLE); FileUtil.writeFileNotAppend(aspectTpl.render(), dirMap.get(ConstVal.ASPECT) + ConstVal.FILE_SEPARATOR + "DbAspect.java"); DataSourceKeyBuilder sourceKeyBuilder = new DataSourceKeyBuilder(); String dataSourceTpl = sourceKeyBuilder.builderDataSourceKey(dataSources); FileUtil.writeFileNotAppend(dataSourceTpl, dirMap.get(ConstVal.CONSTANTS) + ConstVal.FILE_SEPARATOR + "DataSourceKey.java"); Template abstractCfg = BeetlTemplateUtil.getByName(ConstVal.TPL_DATASOURCE_CFG); abstractCfg.binding(GeneratorConstant.COMMON_VARIABLE); FileUtil.writeFileNotAppend(abstractCfg.render(), configPath + ConstVal.FILE_SEPARATOR + "AbstractDataSourceConfig.java"); SpringBootMybatisCfgBuilder builder = new SpringBootMybatisCfgBuilder(); String mybatisCfgTpl = builder.createMybatisCfg(dataSources); FileUtil.writeFileNotAppend(mybatisCfgTpl, configPath + ConstVal.FILE_SEPARATOR + "MyBatisConfig.java"); } </DeepExtract> new DockerCodeBuilder(); new KubeYmlCodeBuilder(); new PomCodeBuilder(); new GradleCodeBuilder(); new BaseCodeBuilder(); new JenkinsfileCodeBuilder(); }
ApplicationPower
positive
440,708
public X509Certificate build(PrivateKey key, AlgorithmIdentifier sigAlg, String sigAlgName, String provider, SecureRandom random) throws InvalidKeyException, CertificateParsingException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, IOException { if (sigAlg == null || sigAlgName == null) throw new IllegalStateException("no signature algorithm specified"); if (key == null) throw new IllegalStateException("no private key specified"); tbsGen.setSignature(sigAlg); if (!extGenerator.isEmpty()) tbsGen.setExtensions(extGenerator.generate()); TBSCertificate toSign = tbsGen.generateTBSCertificate(); byte[] signature = calculateSignature(sigAlgName, provider, key, random, toSign); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(toSign); v.add(sigAlg.toASN1Primitive()); v.add(new DERBitString(signature)); DERSequence derCertificate = new DERSequence(v); CertificateFactory factory; try { factory = CertificateFactory.getInstance("X.509"); ByteArrayInputStream bais = new ByteArrayInputStream(derCertificate.getEncoded(ASN1Encoding.DER)); return (X509Certificate) factory.generateCertificate(bais); } catch (CertificateException e) { throw new RuntimeException("The generated proxy " + "certificate was not parsed by the JDK", e); } }
public X509Certificate build(PrivateKey key, AlgorithmIdentifier sigAlg, String sigAlgName, String provider, SecureRandom random) throws InvalidKeyException, CertificateParsingException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, IOException { if (sigAlg == null || sigAlgName == null) throw new IllegalStateException("no signature algorithm specified"); if (key == null) throw new IllegalStateException("no private key specified"); tbsGen.setSignature(sigAlg); if (!extGenerator.isEmpty()) tbsGen.setExtensions(extGenerator.generate()); TBSCertificate toSign = tbsGen.generateTBSCertificate(); <DeepExtract> byte[] signature = calculateSignature(sigAlgName, provider, key, random, toSign); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(toSign); v.add(sigAlg.toASN1Primitive()); v.add(new DERBitString(signature)); DERSequence derCertificate = new DERSequence(v); CertificateFactory factory; try { factory = CertificateFactory.getInstance("X.509"); ByteArrayInputStream bais = new ByteArrayInputStream(derCertificate.getEncoded(ASN1Encoding.DER)); return (X509Certificate) factory.generateCertificate(bais); } catch (CertificateException e) { throw new RuntimeException("The generated proxy " + "certificate was not parsed by the JDK", e); } </DeepExtract> }
canl-java
positive
440,710
@Subscribe public void process(SyncBlockEvent event) { LOGGER.info("process SyncBlockEvent: {}", event); long height = event.getHeight(); String sourceId = event.getSourceId(); String hash = event.getBlockHash(); if (null != sourceId) { peersMaxHeight.compute(sourceId, (k, v) -> { LOGGER.info(" update peer's max height: {} to {}, sourceId is {}", v, height, sourceId); if (null != v) { return height > v ? height : v; } else { return height; } }); } if (null != requestRecord.getIfPresent(new BlockRequest(height, null))) { LOGGER.info("block request have send ! height={},hash={}", height, hash); return; } if (null != requestRecord.getIfPresent(new BlockRequest(height, hash))) { LOGGER.info("block request have send ! height={},hash={}", height, hash); return; } if (null != hash && blockChain.isExistBlock(hash)) { LOGGER.info("block exist ! height={},hash={}", height, hash); return; } if (height <= blockChain.getMaxHeight()) { List<String> list = getAvailableConnection(height); if (list.size() == 0) { requestRecord.get(new BlockRequest(height, hash), v -> { messageCenter.broadcast(new BlockRequest(height, hash)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", height, hash, requestRecord.estimatedSize()); return "null"; }); } else { final String sourceIdToSync = list.get(new Random().nextInt(list.size())); requestRecord.get(new BlockRequest(height, hash), v -> { messageCenter.unicast(sourceIdToSync, new BlockRequest(height, hash)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", height, hash, requestRecord.estimatedSize()); return sourceIdToSync; }); } return; } long initHeight = blockChain.getMaxHeight(); long maxRequestHeight = Long.min(initHeight + SYNC_BLOCK_TEMP_SIZE, getPeersMaxHeight()); List<String> list = getAvailableConnection(maxRequestHeight); for (long height = initHeight + 1; height <= maxRequestHeight; height++) { final long finalHeight = height; if (list.size() == 0) { requestRecord.get(new BlockRequest(height, null), v -> { messageCenter.broadcast(new BlockRequest(finalHeight, null)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", finalHeight, null, requestRecord.estimatedSize()); return "null"; }); } else { String sourceId = list.get(new Random().nextInt(list.size())); requestRecord.get(new BlockRequest(height, null), v -> { messageCenter.unicast(sourceId, new BlockRequest(finalHeight, null)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", finalHeight, null, requestRecord.estimatedSize()); return sourceId; }); } } }
@Subscribe public void process(SyncBlockEvent event) { LOGGER.info("process SyncBlockEvent: {}", event); long height = event.getHeight(); String sourceId = event.getSourceId(); String hash = event.getBlockHash(); if (null != sourceId) { peersMaxHeight.compute(sourceId, (k, v) -> { LOGGER.info(" update peer's max height: {} to {}, sourceId is {}", v, height, sourceId); if (null != v) { return height > v ? height : v; } else { return height; } }); } if (null != requestRecord.getIfPresent(new BlockRequest(height, null))) { LOGGER.info("block request have send ! height={},hash={}", height, hash); return; } if (null != requestRecord.getIfPresent(new BlockRequest(height, hash))) { LOGGER.info("block request have send ! height={},hash={}", height, hash); return; } if (null != hash && blockChain.isExistBlock(hash)) { LOGGER.info("block exist ! height={},hash={}", height, hash); return; } if (height <= blockChain.getMaxHeight()) { List<String> list = getAvailableConnection(height); if (list.size() == 0) { requestRecord.get(new BlockRequest(height, hash), v -> { messageCenter.broadcast(new BlockRequest(height, hash)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", height, hash, requestRecord.estimatedSize()); return "null"; }); } else { final String sourceIdToSync = list.get(new Random().nextInt(list.size())); requestRecord.get(new BlockRequest(height, hash), v -> { messageCenter.unicast(sourceIdToSync, new BlockRequest(height, hash)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", height, hash, requestRecord.estimatedSize()); return sourceIdToSync; }); } return; } <DeepExtract> long initHeight = blockChain.getMaxHeight(); long maxRequestHeight = Long.min(initHeight + SYNC_BLOCK_TEMP_SIZE, getPeersMaxHeight()); List<String> list = getAvailableConnection(maxRequestHeight); for (long height = initHeight + 1; height <= maxRequestHeight; height++) { final long finalHeight = height; if (list.size() == 0) { requestRecord.get(new BlockRequest(height, null), v -> { messageCenter.broadcast(new BlockRequest(finalHeight, null)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", finalHeight, null, requestRecord.estimatedSize()); return "null"; }); } else { String sourceId = list.get(new Random().nextInt(list.size())); requestRecord.get(new BlockRequest(height, null), v -> { messageCenter.unicast(sourceId, new BlockRequest(finalHeight, null)); LOGGER.info("send block request! height={},hash={}, current cache size={} ", finalHeight, null, requestRecord.estimatedSize()); return sourceId; }); } } </DeepExtract> }
Swiftglobal
positive
440,712
@Subscribe public void onEvent(onStopTracking event) { Log.d(TAG, "ACK StopTrackingEvent event"); mIsTracking = false; if (gpsProvider != null) { gpsProvider.stop(); gpsProvider = null; } providerProviderType = ProviderType.OFF; this.stopSelf(); }
@Subscribe public void onEvent(onStopTracking event) { Log.d(TAG, "ACK StopTrackingEvent event"); <DeepExtract> mIsTracking = false; if (gpsProvider != null) { gpsProvider.stop(); gpsProvider = null; } providerProviderType = ProviderType.OFF; </DeepExtract> this.stopSelf(); }
radiocells-scanner-android
positive
440,714
public void addSprite(Sprite sprite) { spritesToAdd.add(sprite); if (GlobalOptions.TimerOn) timeLeft--; if (timeLeft == 0) { mario.die(); } xCamO = xCam; yCamO = yCam; if (startTime > 0) { startTime++; } float targetXCam = mario.x - 160; xCam = targetXCam; if (xCam < 0) xCam = 0; if (xCam > level.width * 16 - 320) xCam = level.width * 16 - 320; fireballsOnScreen = 0; for (Sprite sprite : sprites) { if (sprite != mario) { float xd = sprite.x - xCam; float yd = sprite.y - yCam; if (xd < -64 || xd > 320 + 64 || yd < -64 || yd > 240 + 64) { removeSprite(sprite); } else { if (sprite instanceof Fireball) { fireballsOnScreen++; } } } } if (paused) { for (Sprite sprite : sprites) { if (sprite == mario) { sprite.tick(); } else { sprite.tickNoMove(); } } } else { tick++; level.tick(); boolean hasShotCannon = false; int xCannon = 0; for (int x = (int) xCam / 16 - 1; x <= (int) (xCam + layer.width) / 16 + 1; x++) for (int y = (int) yCam / 16 - 1; y <= (int) (yCam + layer.height) / 16 + 1; y++) { int dir = 0; if (x * 16 + 8 > mario.x + 16) dir = -1; if (x * 16 + 8 < mario.x - 16) dir = 1; SpriteTemplate st = level.getSpriteTemplate(x, y); if (st != null) { if (st.lastVisibleTick != tick - 1) { if (st.sprite == null || !sprites.contains(st.sprite)) { st.spawn(this, x, y, dir); } } st.lastVisibleTick = tick; } if (dir != 0) { byte b = level.getBlock(x, y); if (((Level.TILE_BEHAVIORS[b & 0xff]) & Level.BIT_ANIMATED) > 0) { if ((b % 16) / 4 == 3 && b / 16 == 0) { if ((tick - x * 2) % 100 == 0) { xCannon = x; for (int i = 0; i < 8; i++) { addSprite(new Sparkle(x * 16 + 8, y * 16 + (int) (Math.random() * 16), (float) Math.random() * dir, 0, 0, 1, 5)); } addSprite(new BulletBill(this, x * 16 + 8 + dir * 8, y * 16 + 15, dir)); hasShotCannon = true; } } } } } for (Sprite sprite : sprites) { sprite.tick(); } for (Sprite sprite : sprites) { sprite.collideCheck(); } for (Shell shell : shellsToCheck) { for (Sprite sprite : sprites) { if (sprite != shell && !shell.dead) { if (sprite.shellCollideCheck(shell)) { if (mario.carried == shell && !shell.dead) { mario.carried = null; shell.die(); ++this.killedCreaturesTotal; } } } } } shellsToCheck.clear(); for (Fireball fireball : fireballsToCheck) { for (Sprite sprite : sprites) { if (sprite != fireball && !fireball.dead) { if (sprite.fireballCollideCheck(fireball)) { fireball.die(); } } } } fireballsToCheck.clear(); } sprites.addAll(0, spritesToAdd); sprites.removeAll(spritesToRemove); spritesToAdd.clear(); spritesToRemove.clear(); }
public void addSprite(Sprite sprite) { spritesToAdd.add(sprite); <DeepExtract> if (GlobalOptions.TimerOn) timeLeft--; if (timeLeft == 0) { mario.die(); } xCamO = xCam; yCamO = yCam; if (startTime > 0) { startTime++; } float targetXCam = mario.x - 160; xCam = targetXCam; if (xCam < 0) xCam = 0; if (xCam > level.width * 16 - 320) xCam = level.width * 16 - 320; fireballsOnScreen = 0; for (Sprite sprite : sprites) { if (sprite != mario) { float xd = sprite.x - xCam; float yd = sprite.y - yCam; if (xd < -64 || xd > 320 + 64 || yd < -64 || yd > 240 + 64) { removeSprite(sprite); } else { if (sprite instanceof Fireball) { fireballsOnScreen++; } } } } if (paused) { for (Sprite sprite : sprites) { if (sprite == mario) { sprite.tick(); } else { sprite.tickNoMove(); } } } else { tick++; level.tick(); boolean hasShotCannon = false; int xCannon = 0; for (int x = (int) xCam / 16 - 1; x <= (int) (xCam + layer.width) / 16 + 1; x++) for (int y = (int) yCam / 16 - 1; y <= (int) (yCam + layer.height) / 16 + 1; y++) { int dir = 0; if (x * 16 + 8 > mario.x + 16) dir = -1; if (x * 16 + 8 < mario.x - 16) dir = 1; SpriteTemplate st = level.getSpriteTemplate(x, y); if (st != null) { if (st.lastVisibleTick != tick - 1) { if (st.sprite == null || !sprites.contains(st.sprite)) { st.spawn(this, x, y, dir); } } st.lastVisibleTick = tick; } if (dir != 0) { byte b = level.getBlock(x, y); if (((Level.TILE_BEHAVIORS[b & 0xff]) & Level.BIT_ANIMATED) > 0) { if ((b % 16) / 4 == 3 && b / 16 == 0) { if ((tick - x * 2) % 100 == 0) { xCannon = x; for (int i = 0; i < 8; i++) { addSprite(new Sparkle(x * 16 + 8, y * 16 + (int) (Math.random() * 16), (float) Math.random() * dir, 0, 0, 1, 5)); } addSprite(new BulletBill(this, x * 16 + 8 + dir * 8, y * 16 + 15, dir)); hasShotCannon = true; } } } } } for (Sprite sprite : sprites) { sprite.tick(); } for (Sprite sprite : sprites) { sprite.collideCheck(); } for (Shell shell : shellsToCheck) { for (Sprite sprite : sprites) { if (sprite != shell && !shell.dead) { if (sprite.shellCollideCheck(shell)) { if (mario.carried == shell && !shell.dead) { mario.carried = null; shell.die(); ++this.killedCreaturesTotal; } } } } } shellsToCheck.clear(); for (Fireball fireball : fireballsToCheck) { for (Sprite sprite : sprites) { if (sprite != fireball && !fireball.dead) { if (sprite.fireballCollideCheck(fireball)) { fireball.die(); } } } } fireballsToCheck.clear(); } sprites.addAll(0, spritesToAdd); sprites.removeAll(spritesToRemove); spritesToAdd.clear(); spritesToRemove.clear(); </DeepExtract> }
MCTSMario
positive
440,717
@Override public void onCache(PostListWrap result) { if (result == null || result.size() == 0 || mData != null) { return; } List<Post> posts = result.getPosts(); if (mPage == 1) { posts.get(0).setContent(""); } if (mPage == 1) { posts.remove(0); } mPostListAdapter.update(posts); mRefreshListView.setSelection(mPostListAdapter.getCount() - 1); }
@Override public void onCache(PostListWrap result) { if (result == null || result.size() == 0 || mData != null) { return; } List<Post> posts = result.getPosts(); if (mPage == 1) { posts.get(0).setContent(""); } <DeepExtract> if (mPage == 1) { posts.remove(0); } mPostListAdapter.update(posts); mRefreshListView.setSelection(mPostListAdapter.getCount() - 1); </DeepExtract> }
ChipHellClient
positive
440,719
@Override public void onAttach(Activity activity) { super.onAttach(activity); return ((PlaybackActivity) activity == null) ? null : (PlaybackActivity) activity.addMediaServerListener(this); }
@Override public void onAttach(Activity activity) { super.onAttach(activity); <DeepExtract> return ((PlaybackActivity) activity == null) ? null : (PlaybackActivity) activity.addMediaServerListener(this); </DeepExtract> }
android-vlc-remote
positive
440,720
private synchronized String dumpWebResults(String sName, String sUrl, String sRequest, int iStatusCode, String bOutput) { iCommandNum++; String sCommandFile = fileStrategy.getCommandFile(sName + "_" + iCommandNum); String sFileName = TestReporter.getOutputDir() + File.separator + TestReporter.OPERATIONS_DIR + File.separator + sCommandFile; return sFileName; }
private synchronized String dumpWebResults(String sName, String sUrl, String sRequest, int iStatusCode, String bOutput) { <DeepExtract> </DeepExtract> iCommandNum++; <DeepExtract> </DeepExtract> String sCommandFile = fileStrategy.getCommandFile(sName + "_" + iCommandNum); <DeepExtract> </DeepExtract> String sFileName = TestReporter.getOutputDir() + File.separator + TestReporter.OPERATIONS_DIR + File.separator + sCommandFile; <DeepExtract> </DeepExtract> return sFileName; <DeepExtract> </DeepExtract> }
auto
positive
440,722
@Override public void onSuccess(String token) { Toast.makeText(MyActivity.this, "Auth success", Toast.LENGTH_SHORT).show(); btnSignin.setEnabled(false); btnCreateDoc.setEnabled(true); }
@Override public void onSuccess(String token) { <DeepExtract> Toast.makeText(MyActivity.this, "Auth success", Toast.LENGTH_SHORT).show(); </DeepExtract> btnSignin.setEnabled(false); btnCreateDoc.setEnabled(true); }
Videos
positive
440,723
@Test(expected = IllegalArgumentException.class) public void noSuchConnectionFactory() { dataAccessor.update("insert into " + getTablePrefix() + "UserConnection (userId, providerId, providerUserId, rank, displayName, profileUrl, imageUrl, accessToken, secret, refreshToken, expireTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", getUserId1(), "foo", "123", 1, "james", null, null, "234", "123", null, System.currentTimeMillis() + 3600000); getConnectionRepository().findAllConnections(); }
@Test(expected = IllegalArgumentException.class) public void noSuchConnectionFactory() { <DeepExtract> dataAccessor.update("insert into " + getTablePrefix() + "UserConnection (userId, providerId, providerUserId, rank, displayName, profileUrl, imageUrl, accessToken, secret, refreshToken, expireTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", getUserId1(), "foo", "123", 1, "james", null, null, "234", "123", null, System.currentTimeMillis() + 3600000); </DeepExtract> getConnectionRepository().findAllConnections(); }
spring-social
positive
440,724