_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q13900 | CommandFactory.addPlayerInitCommand | train | public void addPlayerInitCommand(String teamName, boolean isGoalie) {
StringBuilder buf = new StringBuilder();
buf.append("(init ");
buf.append(teamName);
buf.append(" (version ");
if (isGoalie) {
buf.append(serverVersion);
buf.append(") (goalie))");
} else {
buf.append(serverVersion);
buf.append("))");
}
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13901 | CommandFactory.addTrainerInitCommand | train | public void addTrainerInitCommand() {
StringBuilder buf = new StringBuilder();
buf.append("(init (version ");
buf.append(serverVersion);
buf.append("))");
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13902 | CommandFactory.addCoachInitCommand | train | public void addCoachInitCommand(String teamName) {
StringBuilder buf = new StringBuilder();
buf.append("(init ");
buf.append(teamName);
buf.append(" (version ");
buf.append(serverVersion);
buf.append("))");
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13903 | CommandFactory.addReconnectCommand | train | public void addReconnectCommand(String teamName, int num) {
StringBuilder buf = new StringBuilder();
buf.append("(reconnect ");
buf.append(teamName);
buf.append(' ');
buf.append(num);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13904 | CommandFactory.addCatchCommand | train | public void addCatchCommand(int direction) {
StringBuilder buf = new StringBuilder();
buf.append("(catch ");
buf.append(direction);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13905 | CommandFactory.addDashCommand | train | public void addDashCommand(int power) {
StringBuilder buf = new StringBuilder();
buf.append("(dash ");
buf.append(power);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13906 | CommandFactory.addKickCommand | train | public void addKickCommand(int power, int direction) {
StringBuilder buf = new StringBuilder();
buf.append("(kick ");
buf.append(power);
buf.append(' ');
buf.append(direction);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13907 | CommandFactory.addTurnCommand | train | public void addTurnCommand(int angle) {
StringBuilder buf = new StringBuilder();
buf.append("(turn ");
buf.append(angle);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13908 | CommandFactory.addChangePlayModeCommand | train | public void addChangePlayModeCommand(PlayMode playMode) {
StringBuilder buf = new StringBuilder();
buf.append("(change_mode ");
buf.append(playMode);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13909 | CommandFactory.addMoveBallCommand | train | public void addMoveBallCommand(double x, double y) {
StringBuilder buf = new StringBuilder();
buf.append("(move ");
buf.append("ball"); // TODO Manual says the format...will implement this later.
buf.append(' ');
buf.append(x);
buf.append(' ');
buf.append(y);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13910 | CommandFactory.addCheckBallCommand | train | public void addCheckBallCommand() {
StringBuilder buf = new StringBuilder();
buf.append("(check_ball)");
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13911 | CommandFactory.addStartCommand | train | public void addStartCommand() {
StringBuilder buf = new StringBuilder();
buf.append("(start)");
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13912 | CommandFactory.addRecoverCommand | train | public void addRecoverCommand() {
StringBuilder buf = new StringBuilder();
buf.append("(recover)");
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13913 | CommandFactory.addEarCommand | train | public void addEarCommand(boolean earOn) {
StringBuilder buf = new StringBuilder();
buf.append("(ear ");
if (earOn) {
buf.append("on");
} else {
buf.append("off");
}
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13914 | CommandFactory.addChangePlayerTypeCommand | train | public void addChangePlayerTypeCommand(String teamName, int unum, int playerType) {
StringBuilder buf = new StringBuilder();
buf.append("(change_player_type ");
buf.append(teamName);
buf.append(' ');
buf.append(unum);
buf.append(' ');
buf.append(playerType);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13915 | CommandFactory.addTeamNamesCommand | train | public void addTeamNamesCommand() {
StringBuilder buf = new StringBuilder();
buf.append("(team_names)");
fifo.add(fifo.size(), buf.toString());
} | java | {
"resource": ""
} |
q13916 | CommandFactory.addTeamGraphicCommand | train | public void addTeamGraphicCommand(XPMImage xpm) {
for (int x = 0; x < xpm.getArrayWidth(); x++) {
for (int y = 0; y < xpm.getArrayHeight(); y++) {
StringBuilder buf = new StringBuilder();
String tile = xpm.getTile(x, y);
buf.append("(team_graphic (");
buf.append(x);
buf.append(' ');
buf.append(y);
buf.append(' ');
buf.append(tile);
buf.append(' ');
buf.append("))");
fifo.add(fifo.size(), buf.toString());
}
}
} | java | {
"resource": ""
} |
q13917 | CommandFactory.next | train | public String next() {
if (fifo.isEmpty()) {
throw new RuntimeException("Fifo is empty");
}
String cmd = (String) fifo.get(0);
fifo.remove(0);
return cmd;
} | java | {
"resource": ""
} |
q13918 | SonarConfigGeneratorMojo.isSonarEnabled | train | protected boolean isSonarEnabled( boolean quiet ) throws MojoExecutionException
{
if ( sonar.skip() )
{
if ( ! quiet )
{
getLog().info( SonarConfiguration.SONAR_SKIP_MESSAGE
+ ", 'skip' set to true in the " + SonarConfiguration.SONAR_NAME + " configuration." );
}
return false;
}
validateProjectFile();
platforms = MojoHelper.validatePlatforms( platforms );
return true;
} | java | {
"resource": ""
} |
q13919 | CsvParser.parse | train | @Override
public List<T> parse() throws IllegalAccessException, InstantiationException,
InvocationTargetException, NoSuchMethodException {
List<T> list = new ArrayList<>();
Map<Method, TableCellMapping> cellMappingByMethod = ImporterUtils.getMappedMethods(clazz, group);
final Constructor<T> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
for (int i = 0; i < csvLines.size(); i++) {
final String line = csvLines.get(i);
if ((i + 1) <= headersRows) {
continue;
}
List<String> fields = split(line);
T instance = constructor.newInstance();
for (Entry<Method, TableCellMapping> methodTcm : cellMappingByMethod.entrySet()) {
Method method = methodTcm.getKey();
method.setAccessible(true);
TableCellMapping tcm = methodTcm.getValue();
String value = getValueOrEmpty(fields, tcm.columnIndex());
Converter<?, ?> converter = tcm.converter().newInstance();
Object obj = converter.apply(value);
method.invoke(instance, obj);
}
list.add(instance);
}
return list;
} | java | {
"resource": ""
} |
q13920 | SimpleNamingStrategy.toJavaName | train | private String toJavaName(String name) {
StringBuilder stb = new StringBuilder();
char[] namechars = name.toCharArray();
if (!Character.isJavaIdentifierStart(namechars[0])) {
stb.append("__");
} else {
stb.append(namechars[0]);
}
for (int i = 1; i < namechars.length; i++) {
if (!Character.isJavaIdentifierPart(namechars[i])) {
stb.append("__");
} else {
stb.append(namechars[i]);
}
}
return stb.toString();
} | java | {
"resource": ""
} |
q13921 | AbstractMSBuildMojo.validateForMSBuild | train | protected final void validateForMSBuild() throws MojoExecutionException
{
if ( !MSBuildPackaging.isValid( mavenProject.getPackaging() ) )
{
throw new MojoExecutionException( "Please set packaging to one of " + MSBuildPackaging.validPackaging() );
}
findMSBuild();
validateProjectFile();
platforms = MojoHelper.validatePlatforms( platforms );
} | java | {
"resource": ""
} |
q13922 | AbstractMSBuildMojo.findMSBuild | train | protected final void findMSBuild() throws MojoExecutionException
{
if ( msbuildPath == null )
{
// not set in configuration try system environment
String msbuildEnv = System.getenv( ENV_MSBUILD_PATH );
if ( msbuildEnv != null )
{
msbuildPath = new File( msbuildEnv );
}
}
if ( msbuildPath != null
&& msbuildPath.exists()
&& msbuildPath.isFile() )
{
getLog().debug( "Using MSBuild at " + msbuildPath );
// TODO: Could check that this is really MSBuild
return;
}
throw new MojoExecutionException(
"MSBuild could not be found. You need to configure it in the "
+ "plugin configuration section in the pom file using "
+ "<msbuild.path>...</msbuild.path> or "
+ "<properties><msbuild.path>...</msbuild.path></properties> "
+ "or on command-line using -Dmsbuild.path=... or by setting "
+ "the environment variable " + ENV_MSBUILD_PATH );
} | java | {
"resource": ""
} |
q13923 | AbstractMSBuildMojo.runMSBuild | train | protected void runMSBuild( List<String> targets, Map<String, String> environment )
throws MojoExecutionException, MojoFailureException
{
try
{
MSBuildExecutor msbuild = new MSBuildExecutor( getLog(), msbuildPath, msbuildMaxCpuCount, projectFile );
msbuild.setPlatforms( platforms );
msbuild.setTargets( targets );
msbuild.setEnvironment( environment );
if ( msbuild.execute() != 0 )
{
throw new MojoFailureException(
"MSBuild execution failed, see log for details." );
}
}
catch ( IOException ioe )
{
throw new MojoExecutionException(
"MSBUild execution failed", ioe );
}
catch ( InterruptedException ie )
{
throw new MojoExecutionException( "Interrupted waiting for "
+ "MSBUild execution to complete", ie );
}
} | java | {
"resource": ""
} |
q13924 | XPMImage.getTile | train | public String getTile(int x, int y) {
if ((x > getArrayWidth()) || (y > getArrayHeight()) || (x < 0) || (y < 0)) {
throw new IllegalArgumentException();
}
return image[x][y];
} | java | {
"resource": ""
} |
q13925 | SServerPlayer.toListString | train | public String toListString() {
StringBuffer buf = new StringBuffer();
buf.append(controller.getClass().getName());
return buf.toString();
} | java | {
"resource": ""
} |
q13926 | MultiEvent.throwMultiEventException | train | private void throwMultiEventException(Event<?> eventThatThrewException) {
while(throwable instanceof MultiEventException && throwable.getCause() != null) {
eventThatThrewException = ((MultiEventException) throwable).getEvent();
throwable = throwable.getCause();
}
throw new MultiEventException(eventThatThrewException, throwable);
} | java | {
"resource": ""
} |
q13927 | Node.get | train | List<Node> get(final Pattern... patterns)
{
return AbsoluteGetQuery.INSTANCE.execute(this, includeRootPatternFirst(patterns));
} | java | {
"resource": ""
} |
q13928 | AbstractAppender.resolve | train | public String resolve( Map<String, String> configuration )
{
StringBuilder buffer = new StringBuilder();
append( buffer, configuration, null );
return buffer.toString();
} | java | {
"resource": ""
} |
q13929 | MojoHelper.validateToolPath | train | public static void validateToolPath( File toolPath, String toolName, Log logger )
throws FileNotFoundException
{
logger.debug( "Validating path for " + toolName );
if ( toolPath == null )
{
logger.error( "Missing " + toolName + " path" );
throw new FileNotFoundException();
}
if ( !toolPath.exists() || !toolPath.isFile() )
{
logger.error( "Could not find " + toolName + " at " + toolPath );
throw new FileNotFoundException( toolPath.getAbsolutePath() );
}
logger.debug( "Found " + toolName + " at " + toolPath );
} | java | {
"resource": ""
} |
q13930 | MojoHelper.validatePlatforms | train | public static List<BuildPlatform> validatePlatforms( List<BuildPlatform> platforms ) throws MojoExecutionException
{
if ( platforms == null )
{
platforms = new ArrayList<BuildPlatform>();
platforms.add( new BuildPlatform() );
}
else
{
Set<String> platformNames = new HashSet<String>();
for ( BuildPlatform platform : platforms )
{
if ( platformNames.contains( platform.getName() ) )
{
throw new MojoExecutionException( "Duplicate platform '" + platform.getName()
+ "' in configuration, platform names must be unique" );
}
platformNames.add( platform.getName() );
platform.identifyPrimaryConfiguration();
}
}
return platforms;
} | java | {
"resource": ""
} |
q13931 | ResultCollectorValidatorBuilder.collect | train | @Deprecated
public static <D> RuleContext<D> collect(ResultCollector<?, D> resultCollector) {
return new ResultCollectorContext().collect(resultCollector);
} | java | {
"resource": ""
} |
q13932 | ResultCollectorValidatorBuilder.collect | train | @Deprecated
public static <D> RuleContext<D> collect(ResultCollector<?, D>... resultCollectors) {
return new ResultCollectorContext().collect(resultCollectors);
} | java | {
"resource": ""
} |
q13933 | TransparentToolTipDialog.initComponents | train | private void initComponents() {
// Avoid warning on Mac OS X when changing the alpha
getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);
toolTip = new JToolTip();
toolTip.addMouseListener(new TransparencyAdapter());
owner.addComponentListener(locationAdapter);
owner.addAncestorListener(locationAdapter);
getRootPane().setWindowDecorationStyle(JRootPane.NONE); // Just in case...
setFocusable(false); // Just in case...
setFocusableWindowState(false);
setContentPane(toolTip);
pack(); // Seems to help for the very first setVisible(true) when window transparency is on
} | java | {
"resource": ""
} |
q13934 | TransparentToolTipDialog.setText | train | public void setText(String text) {
// Only change if different
if (!ValueUtils.areEqual(text, toolTip.getTipText())) {
boolean wasVisible = isVisible();
if (wasVisible) {
setVisible(false);
}
toolTip.setTipText(text);
if (wasVisible) {
setVisible(true);
}
}
} | java | {
"resource": ""
} |
q13935 | TransparentToolTipDialog.followOwner | train | private void followOwner() {
if (owner.isVisible() && owner.isShowing()) {
try {
Point screenLocation = owner.getLocationOnScreen();
Point relativeSlaveLocation = anchorLink.getRelativeSlaveLocation(owner.getSize(),
TransparentToolTipDialog.this.getSize());
setLocation(screenLocation.x + relativeSlaveLocation.x, screenLocation.y + relativeSlaveLocation.y);
} catch (IllegalComponentStateException e) {
LOGGER.error("Failed getting location of component: " + owner, e);
}
}
} | java | {
"resource": ""
} |
q13936 | MapCompositeDataProvider.addDataProvider | train | public void addDataProvider(K key, DataProvider<DPO> dataProvider) {
dataProviders.put(key, dataProvider);
} | java | {
"resource": ""
} |
q13937 | IconBooleanFeedback.updateDecoration | train | private void updateDecoration() {
if (lastResult != null) {
if (lastResult) {
setIcon(validIcon);
setToolTipText(validText);
} else {
setIcon(invalidIcon);
setToolTipText(invalidText);
}
}
} | java | {
"resource": ""
} |
q13938 | BaseComponentKeyStrokeTrigger.toKeyStrokes | train | private static KeyStroke[] toKeyStrokes(int... keyCodes) {
KeyStroke[] keyStrokes = null;
if (keyCodes != null) {
keyStrokes = new KeyStroke[keyCodes.length];
for (int i = 0; i < keyCodes.length; i++) {
keyStrokes[i] = KeyStroke.getKeyStroke(keyCodes[i], 0);
}
}
return keyStrokes;
} | java | {
"resource": ""
} |
q13939 | FeedbackDemo.initValidation | train | private void initValidation() {
// Create validators and collect the results
SimpleProperty<Result> resultCollector1 = new SimpleProperty<Result>();
createValidator(textField1, new StickerFeedback(textField1), resultCollector1);
SimpleProperty<Result> resultCollector2 = new SimpleProperty<Result>();
createValidator(textField2, new ColorFeedback(textField2, false), resultCollector2);
SimpleProperty<Result> resultCollector3 = new SimpleProperty<Result>();
createValidator(textField3, new ColorFeedback(textField3, true), resultCollector3);
SimpleProperty<Result> resultCollector4 = new SimpleProperty<Result>();
createValidator(textField4, new IconFeedback(textField4, false), resultCollector4);
SimpleProperty<Result> resultCollector5 = new SimpleProperty<Result>();
createValidator(textField5, new IconFeedback(textField5, true), resultCollector5);
// Enable Apply button only when all fields are valid
read(resultCollector1, resultCollector2, resultCollector3, resultCollector4, resultCollector5) //
.transform(new CollectionElementTransformer<Result, Boolean>(new ResultToBooleanTransformer())) //
.transform(new AndBooleanAggregator()) //
.write(new ComponentEnabledProperty(applyButton));
} | java | {
"resource": ""
} |
q13940 | QueryOptions.add | train | public Object add(String key, Object value) {
if (!this.containsKey(key)) {
this.put(key, value);
return null;
}
return this.get(key);
} | java | {
"resource": ""
} |
q13941 | SubtitleLineContentToHtmlBase.appendElements | train | protected void appendElements(RendersnakeHtmlCanvas html,
List<SubtitleItem.Inner> elements) throws IOException {
for (SubtitleItem.Inner element : elements) {
String kanji = element.getKanji();
if (kanji != null) {
html.spanKanji(kanji);
} else {
html.write(element.getText());
}
}
} | java | {
"resource": ""
} |
q13942 | JListSelectedItemCountProperty.updateValue | train | private void updateValue() {
if (list != null) {
int oldCount = this.count;
this.count = list.getSelectedIndices().length;
maybeNotifyListeners(oldCount, count);
}
} | java | {
"resource": ""
} |
q13943 | FacetQueryParser.parse | train | public String parse(String query) throws Exception {
if (StringUtils.isEmpty(query)) {
return "";
}
Map<String, Object> jsonFacetMap = new LinkedHashMap<>();
String[] split = query.split(FACET_SEPARATOR);
for (String facet : split) {
if (facet.contains(NESTED_FACET_SEPARATOR)) {
parseNestedFacet(facet, jsonFacetMap);
} else {
List<String> simpleFacets = getSubFacets(facet);
for (String simpleFacet : simpleFacets) {
parseSimpleFacet(simpleFacet, jsonFacetMap);
}
}
}
return parseJson(new ObjectMapper().writeValueAsString(jsonFacetMap));
} | java | {
"resource": ""
} |
q13944 | AbstractReadableSetProperty.doNotifyListenersOfAddedValues | train | protected void doNotifyListenersOfAddedValues(Set<R> newItems) {
List<SetValueChangeListener<R>> listenersCopy = new ArrayList<SetValueChangeListener<R>>(listeners);
Set<R> unmodifiable = Collections.unmodifiableSet(newItems);
for (SetValueChangeListener<R> listener : listenersCopy) {
listener.valuesAdded(this, unmodifiable);
}
} | java | {
"resource": ""
} |
q13945 | AbstractReadableSetProperty.doNotifyListenersOfRemovedValues | train | protected void doNotifyListenersOfRemovedValues(Set<R> oldItems) {
List<SetValueChangeListener<R>> listenersCopy = new ArrayList<SetValueChangeListener<R>>(listeners);
Set<R> unmodifiable = Collections.unmodifiableSet(oldItems);
for (SetValueChangeListener<R> listener : listenersCopy) {
listener.valuesRemoved(this, unmodifiable);
}
} | java | {
"resource": ""
} |
q13946 | Binder.read | train | public static <MO> SingleMasterBinding<MO, MO> read(ReadableProperty<MO> master) {
return new SingleMasterBinding<MO, MO>(master, null);
} | java | {
"resource": ""
} |
q13947 | ValueUtils.areEqual | train | public static <T> boolean areEqual(T value1, T value2, Comparator<T> comparator) {
return ((value1 == null) && (value2 == null)) || //
((value1 != null) && (value2 != null) && (comparator.compare(value1, value2) == 0));
} | java | {
"resource": ""
} |
q13948 | IllegalCharacterBooleanRule.setIllegalCharacters | train | public void setIllegalCharacters(final String illegalCharacters) {
// Create a simple sub-rule taking care of the check
this.illegalCharacters = illegalCharacters;
delegatePattern = new NegateBooleanRule<String>(new StringRegexRule("[" + Pattern.quote(illegalCharacters) +
"]"));
// Create a nicely space-separated list of illegal characters
final int illegalCharacterCount = illegalCharacters.length();
final StringBuilder illegalCharactersSeparatedBySpacesStringBuilder = new StringBuilder(illegalCharacterCount
* 2);
for (int i = 0; i < illegalCharacterCount; i++) {
illegalCharactersSeparatedBySpacesStringBuilder.append(illegalCharacters.toCharArray()[i]);
if (i < (illegalCharacterCount - 1)) {
illegalCharactersSeparatedBySpacesStringBuilder.append(' ');
}
}
illegalCharactersSeparatedBySpaces = illegalCharactersSeparatedBySpacesStringBuilder.toString();
} | java | {
"resource": ""
} |
q13949 | TabbedPaneDemo.createTabContent | train | private Component createTabContent(CompositeReadableProperty<Boolean> tabResultsProperty) {
JPanel panel = new JPanel();
panel.setLayout(new MigLayout("fill, wrap 2", "[][grow, fill]"));
for (int i = 0; i < 2; i++) {
panel.add(new JLabel("Field " + (i + 1) + ":"));
// Create formatted textfield
JTextField field = new JTextField();
panel.add(field);
field.setColumns(10);
field.setText("Value");
// Create field validator
tabResultsProperty.addProperty(installFieldValidation(field));
}
return panel;
} | java | {
"resource": ""
} |
q13950 | TabbedPaneDemo.installFieldValidation | train | private ReadableProperty<Boolean> installFieldValidation(JTextField field) {
// FieLd is valid if not empty
SimpleBooleanProperty fieldResult = new SimpleBooleanProperty();
on(new JTextFieldDocumentChangedTrigger(field)) //
.read(new JTextFieldTextProvider(field)) //
.check(new StringNotEmptyRule()) //
.handleWith(new IconBooleanFeedback(field)) //
.handleWith(fieldResult) //
.getValidator().trigger();
// Tab will be valid only if all fields are valid
return fieldResult;
} | java | {
"resource": ""
} |
q13951 | CheckstyleApiFixer.getTokenName | train | @Nonnull
public String getTokenName(final int pTokenId)
{
final List<String> searchClasses = Arrays.asList("com.puppycrawl.tools.checkstyle.utils.TokenUtil",
"com.puppycrawl.tools.checkstyle.utils.TokenUtils", TokenTypes.class.getName(),
"com.puppycrawl.tools.checkstyle.Utils");
Method getTokenName = null;
for (final String className : searchClasses) {
try {
final Class<?> utilsClass = Class.forName(className);
getTokenName = utilsClass.getMethod("getTokenName", int.class);
break;
}
catch (ClassNotFoundException | NoSuchMethodException e) {
// ignore
}
}
if (getTokenName == null) {
throw new UnsupportedOperationException("getTokenName() - method not found");
}
String result = null;
try {
result = (String) getTokenName.invoke(null, pTokenId);
}
catch (IllegalAccessException | InvocationTargetException e) {
throw new UnsupportedOperationException(getTokenName.getDeclaringClass().getName() + ".getTokenName()", e);
}
return result;
} | java | {
"resource": ""
} |
q13952 | JNvgraph.checkResult | train | private static int checkResult(int result)
{
if (exceptionsEnabled && result !=
nvgraphStatus.NVGRAPH_STATUS_SUCCESS)
{
throw new CudaException(nvgraphStatus.stringFor(result));
}
return result;
} | java | {
"resource": ""
} |
q13953 | JNvgraph.nvgraphSetGraphStructure | train | public static int nvgraphSetGraphStructure(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
Object topologyData,
int TType)
{
return checkResult(nvgraphSetGraphStructureNative(handle, descrG, topologyData, TType));
} | java | {
"resource": ""
} |
q13954 | JNvgraph.nvgraphGetGraphStructure | train | public static int nvgraphGetGraphStructure(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
Object topologyData,
int[] TType)
{
return checkResult(nvgraphGetGraphStructureNative(handle, descrG, topologyData, TType));
} | java | {
"resource": ""
} |
q13955 | JNvgraph.nvgraphConvertTopology | train | public static int nvgraphConvertTopology(
nvgraphHandle handle,
int srcTType,
Object srcTopology,
Pointer srcEdgeData,
Pointer dataType,
int dstTType,
Object dstTopology,
Pointer dstEdgeData)
{
return checkResult(nvgraphConvertTopologyNative(handle, srcTType, srcTopology, srcEdgeData, dataType, dstTType, dstTopology, dstEdgeData));
} | java | {
"resource": ""
} |
q13956 | JNvgraph.nvgraphConvertGraph | train | public static int nvgraphConvertGraph(
nvgraphHandle handle,
nvgraphGraphDescr srcDescrG,
nvgraphGraphDescr dstDescrG,
int dstTType)
{
return checkResult(nvgraphConvertGraphNative(handle, srcDescrG, dstDescrG, dstTType));
} | java | {
"resource": ""
} |
q13957 | JNvgraph.nvgraphExtractSubgraphByVertex | train | public static int nvgraphExtractSubgraphByVertex(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
nvgraphGraphDescr subdescrG,
Pointer subvertices,
long numvertices)
{
return checkResult(nvgraphExtractSubgraphByVertexNative(handle, descrG, subdescrG, subvertices, numvertices));
} | java | {
"resource": ""
} |
q13958 | JNvgraph.nvgraphExtractSubgraphByEdge | train | public static int nvgraphExtractSubgraphByEdge(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
nvgraphGraphDescr subdescrG,
Pointer subedges,
long numedges)
{
return checkResult(nvgraphExtractSubgraphByEdgeNative(handle, descrG, subdescrG, subedges, numedges));
} | java | {
"resource": ""
} |
q13959 | JNvgraph.nvgraphSrSpmv | train | public static int nvgraphSrSpmv(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
long weight_index,
Pointer alpha,
long x_index,
Pointer beta,
long y_index,
int SR)
{
return checkResult(nvgraphSrSpmvNative(handle, descrG, weight_index, alpha, x_index, beta, y_index, SR));
} | java | {
"resource": ""
} |
q13960 | JNvgraph.nvgraphWidestPath | train | public static int nvgraphWidestPath(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
long weight_index,
Pointer source_vert,
long widest_path_index)
{
return checkResult(nvgraphWidestPathNative(handle, descrG, weight_index, source_vert, widest_path_index));
} | java | {
"resource": ""
} |
q13961 | JNvgraph.nvgraphPagerank | train | public static int nvgraphPagerank(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
long weight_index,
Pointer alpha,
long bookmark_index,
int has_guess,
long pagerank_index,
float tolerance,
int max_iter)
{
return checkResult(nvgraphPagerankNative(handle, descrG, weight_index, alpha, bookmark_index, has_guess, pagerank_index, tolerance, max_iter));
} | java | {
"resource": ""
} |
q13962 | AlignmentCoverageCalculatorTask.setRegionCoverageSize | train | public void setRegionCoverageSize(int size){
if(size < 0){
return;
}
int lg = (int)Math.ceil(Math.log(size)/Math.log(2));
//int lg = 31 - Integer.numberOfLeadingZeros(size);
int newRegionCoverageSize = 1 << lg;
int newRegionCoverageMask = newRegionCoverageSize - 1;
RegionCoverage newCoverage = new RegionCoverage(newRegionCoverageSize);
if(coverage != null){
for(int i = 0; i < (end-start); i++){
newCoverage.getA()[(int)((start+i)&newRegionCoverageMask)] = coverage.getA()[(int)((start+i)®ionCoverageMask)];
}
}
regionCoverageSize = newRegionCoverageSize;
regionCoverageMask = newRegionCoverageMask;
coverage = newCoverage;
// System.out.println("Region Coverage Mask : " + regionCoverageMask);
} | java | {
"resource": ""
} |
q13963 | AbstractStickerFeedback.attach | train | public void attach(JComponent owner) {
detach();
toolTipDialog = new TransparentToolTipDialog(owner, new AnchorLink(Anchor.CENTER_RIGHT, Anchor.CENTER_LEFT));
} | java | {
"resource": ""
} |
q13964 | AbstractStickerFeedback.getToolTipText | train | protected String getToolTipText() {
String tip = null;
if (toolTipDialog != null) {
tip = toolTipDialog.getText();
}
return tip;
} | java | {
"resource": ""
} |
q13965 | OvalBuilder.construct | train | protected T construct() {
if (_targetConstructor.isPresent()) {
return _targetConstructor.get().apply(this);
}
try {
final Constructor<? extends T> constructor = _targetClass.get().getDeclaredConstructor(this.getClass());
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
constructor.setAccessible(true);
return null;
});
return constructor.newInstance(this);
} catch (final NoSuchMethodException
| SecurityException
| InstantiationException
| IllegalAccessException
| IllegalArgumentException e) {
throw new UnsupportedOperationException(
String.format(UNABLE_TO_CONSTRUCT_TARGET_CLASS, _targetClass),
e);
} catch (final InvocationTargetException e) {
// If the constructor of the class threw an exception, unwrap it and
// rethrow it. If the constructor throws anything other than a
// RuntimeException we wrap it.
final Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
throw new UnsupportedOperationException(
String.format(UNABLE_TO_CONSTRUCT_TARGET_CLASS, _targetClass),
cause);
}
} | java | {
"resource": ""
} |
q13966 | JTableSelectedRowCountProperty.updateValue | train | private void updateValue() {
if (table != null) {
int oldCount = this.count;
this.count = table.getSelectedRowCount();
maybeNotifyListeners(oldCount, count);
}
} | java | {
"resource": ""
} |
q13967 | LuceneUtil.katakanaToRomaji | train | public static void katakanaToRomaji(Appendable builder, CharSequence s)
throws IOException {
ToStringUtil.getRomanization(builder, s);
} | java | {
"resource": ""
} |
q13968 | RegexpOnStringCheck.getExprAst | train | @CheckForNull
private DetailAST getExprAst(@Nonnull final DetailAST pAst)
{
DetailAST result = null;
for (DetailAST a = pAst.getFirstChild(); a != null; a = a.getNextSibling()) {
if (a.getType() != TokenTypes.LPAREN && a.getType() != TokenTypes.RPAREN) {
result = a;
break;
}
}
return result;
} | java | {
"resource": ""
} |
q13969 | QueryResponse.first | train | public QueryResult<T> first() {
if (response != null && response.size() > 0) {
return response.get(0);
}
return null;
} | java | {
"resource": ""
} |
q13970 | AbstractComponentDecoration.attach | train | private void attach(JComponent componentToBeDecorated) {
detach();
decoratedComponent = componentToBeDecorated;
if (decoratedComponent != null) {
decoratedComponent.addComponentListener(decoratedComponentTracker);
decoratedComponent.addAncestorListener(decoratedComponentTracker);
decoratedComponent.addHierarchyBoundsListener(decoratedComponentTracker);
decoratedComponent.addHierarchyListener(decoratedComponentTracker);
decoratedComponent.addPropertyChangeListener("enabled", decoratedComponentTracker);
decoratedComponent.addPropertyChangeListener("ancestor", decoratedComponentTracker);
attachToLayeredPane();
}
} | java | {
"resource": ""
} |
q13971 | AbstractComponentDecoration.detach | train | private void detach() {
// Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach())
if (decoratedComponent != null) {
decoratedComponent.removeComponentListener(decoratedComponentTracker);
decoratedComponent.removeAncestorListener(decoratedComponentTracker);
decoratedComponent.removeHierarchyBoundsListener(decoratedComponentTracker);
decoratedComponent.removeHierarchyListener(decoratedComponentTracker);
decoratedComponent.removePropertyChangeListener("enabled", decoratedComponentTracker);
decoratedComponent.removePropertyChangeListener("ancestor", decoratedComponentTracker);
decoratedComponent = null;
detachFromLayeredPane();
}
} | java | {
"resource": ""
} |
q13972 | AbstractComponentDecoration.attachToLayeredPane | train | private void attachToLayeredPane() {
// Get ancestor layered pane that will get the decoration holder component
Container ancestor = SwingUtilities.getAncestorOfClass(JLayeredPane.class, decoratedComponent);
if (ancestor instanceof JLayeredPane) {
attachedLayeredPane = (JLayeredPane) ancestor;
Integer layer = getDecoratedComponentLayerInLayeredPane(attachedLayeredPane);
attachedLayeredPane.remove(decorationPainter);
attachedLayeredPane.add(decorationPainter, layer);
} else {
// Remove decoration painter from previous layered pane as this could lead to memory leak
detachFromLayeredPane();
}
} | java | {
"resource": ""
} |
q13973 | AbstractComponentDecoration.getDecoratedComponentLayerInLayeredPane | train | private Integer getDecoratedComponentLayerInLayeredPane(JLayeredPane layeredPane) {
Container ancestorInLayer = decoratedComponent;
while (!layeredPane.equals(ancestorInLayer.getParent())) {
ancestorInLayer = ancestorInLayer.getParent();
}
return (layeredPane.getLayer(ancestorInLayer) + DECORATION_LAYER_OFFSET);
} | java | {
"resource": ""
} |
q13974 | AbstractComponentDecoration.updateDecorationPainterVisibility | train | private void updateDecorationPainterVisibility() {
boolean shouldBeVisible = (decoratedComponent != null) && //
(paintWhenDisabled || decoratedComponent.isEnabled()) && //
decoratedComponent.isShowing() && //
visible;
if (shouldBeVisible != decorationPainter.isVisible()) {
decorationPainter.setVisible(shouldBeVisible);
}
} | java | {
"resource": ""
} |
q13975 | AbstractComponentDecoration.followDecoratedComponent | train | private void followDecoratedComponent(JLayeredPane layeredPane) {
Point relativeLocationToOwner = anchorLink.getRelativeSlaveLocation(decoratedComponent.getWidth(),
decoratedComponent.getHeight(), getWidth(), getHeight());
updateDecorationPainterUnclippedBounds(layeredPane, relativeLocationToOwner);
updateDecorationPainterClippedBounds(layeredPane, relativeLocationToOwner);
// Repaint decoration
if (layeredPane != null) {
decorationPainter.revalidate();
decorationPainter.repaint();
}
} | java | {
"resource": ""
} |
q13976 | AbstractComponentDecoration.updateDecorationPainterUnclippedBounds | train | private void updateDecorationPainterUnclippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) {
Rectangle decorationBoundsInLayeredPane;
if (layeredPane == null) {
decorationBoundsInLayeredPane = new Rectangle();
} else {
// Calculate location of the decorated component in the layered pane containing the decoration painter
Point decoratedComponentLocationInLayeredPane = SwingUtilities.convertPoint(decoratedComponent.getParent
(), decoratedComponent.getLocation(), layeredPane);
// Deduces the location of the decoration painter in the layered pane
decorationBoundsInLayeredPane = new Rectangle(decoratedComponentLocationInLayeredPane.x +
relativeLocationToOwner.x, decoratedComponentLocationInLayeredPane.y + relativeLocationToOwner.y,
getWidth(), getHeight());
}
// Update decoration painter
decorationPainter.setBounds(decorationBoundsInLayeredPane);
} | java | {
"resource": ""
} |
q13977 | AbstractComponentDecoration.updateDecorationPainterClippedBounds | train | private void updateDecorationPainterClippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) {
if (layeredPane == null) {
decorationPainter.setClipBounds(null);
} else {
JComponent clippingComponent = getEffectiveClippingAncestor();
if (clippingComponent == null) {
LOGGER.error("No decoration clipping component can be found for decorated component: " +
decoratedComponent);
decorationPainter.setClipBounds(null);
} else if (clippingComponent.isShowing()) {
Rectangle ownerBoundsInParent = decoratedComponent.getBounds();
Rectangle decorationBoundsInParent = new Rectangle(ownerBoundsInParent.x + relativeLocationToOwner.x,
ownerBoundsInParent.y + relativeLocationToOwner.y, getWidth(), getHeight());
Rectangle decorationBoundsInAncestor = SwingUtilities.convertRectangle(decoratedComponent.getParent()
, decorationBoundsInParent, clippingComponent);
Rectangle decorationVisibleBoundsInAncestor;
Rectangle ancestorVisibleRect = clippingComponent.getVisibleRect();
decorationVisibleBoundsInAncestor = ancestorVisibleRect.intersection(decorationBoundsInAncestor);
if ((decorationVisibleBoundsInAncestor.width == 0) || (decorationVisibleBoundsInAncestor.height == 0)) {
// No bounds, no painting
decorationPainter.setClipBounds(null);
} else {
Rectangle decorationVisibleBoundsInLayeredPane = SwingUtilities.convertRectangle
(clippingComponent, decorationVisibleBoundsInAncestor, layeredPane);
// Clip graphics context
Rectangle clipBounds = SwingUtilities.convertRectangle(decorationPainter.getParent(),
decorationVisibleBoundsInLayeredPane, decorationPainter);
decorationPainter.setClipBounds(clipBounds);
}
} else {
// This could happen for example when a dialog is closed, so no need to log anything
decorationPainter.setClipBounds(null);
}
}
} | java | {
"resource": ""
} |
q13978 | CssBoxPngRenderer.setDefaultFonts | train | private void setDefaultFonts(BrowserConfig config) {
config.setDefaultFont(Font.SERIF, "Times New Roman");
config.setDefaultFont(Font.SANS_SERIF, "Arial");
config.setDefaultFont(Font.MONOSPACED, "Courier New");
} | java | {
"resource": ""
} |
q13979 | GeneralValidator.addResultCollector | train | public void addResultCollector(ResultCollector<?, DPO> resultCollector) {
if (resultCollector != null) {
addTrigger(resultCollector);
addDataProvider(resultCollector);
}
} | java | {
"resource": ""
} |
q13980 | GeneralValidator.removeResultCollector | train | public void removeResultCollector(ResultCollector<?, DPO> resultCollector) {
if (resultCollector != null) {
removeTrigger(resultCollector);
removeDataProvider(resultCollector);
}
} | java | {
"resource": ""
} |
q13981 | GeneralValidator.getDataProviderOutputTransformers | train | public Transformer[] getDataProviderOutputTransformers() {
Transformer[] transformers;
if (dataProviderOutputTransformers == null) {
transformers = null;
} else {
transformers = dataProviderOutputTransformers.toArray(new Transformer[dataProviderOutputTransformers.size
()]);
}
return transformers;
} | java | {
"resource": ""
} |
q13982 | GeneralValidator.processEachDataProviderWithEachRule | train | @SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals)
private void processEachDataProviderWithEachRule() {
// For each data provider
for (DataProvider<DPO> dataProvider : dataProviders) {
// Get the data provider output
Object transformedOutput = dataProvider.getData();
// Transform the data provider output
if (dataProviderOutputTransformers != null) {
for (Transformer transformer : dataProviderOutputTransformers) {
transformedOutput = transformer.transform(transformedOutput);
}
}
// Transform the transformed data provider output to rule input
if (ruleInputTransformers != null) {
for (Transformer transformer : ruleInputTransformers) {
transformedOutput = transformer.transform(transformedOutput);
}
}
RI ruleInput = (RI) transformedOutput;
// Process the rule input with the rules
processRules(ruleInput);
}
} | java | {
"resource": ""
} |
q13983 | GeneralValidator.processAllDataProvidersWithEachRule | train | @SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals)
private void processAllDataProvidersWithEachRule() {
// For each data provider
List<Object> transformedDataProvidersOutput = new ArrayList<Object>(dataProviders.size());
for (DataProvider<DPO> dataProvider : dataProviders) {
// Get the data provider output
Object transformedOutput = dataProvider.getData();
// Transform the data provider output
if (dataProviderOutputTransformers != null) {
for (Transformer transformer : dataProviderOutputTransformers) {
transformedOutput = transformer.transform(transformedOutput);
}
}
// Put the transformed data provider output in a list
transformedDataProvidersOutput.add(transformedOutput);
}
// Transform the list of transformed data provider output to rule input
Object transformedRulesInput = transformedDataProvidersOutput;
if (ruleInputTransformers != null) {
for (Transformer transformer : ruleInputTransformers) {
transformedRulesInput = transformer.transform(transformedRulesInput);
}
}
RI ruleInput = (RI) transformedRulesInput;
// Process the rule input with the rules
processRules(ruleInput);
} | java | {
"resource": ""
} |
q13984 | GeneralValidator.processRules | train | private void processRules(RI ruleInput) {
switch (ruleToResultHandlerMapping) {
case SPLIT:
processEachRuleWithEachResultHandler(ruleInput);
break;
case JOIN:
processAllRulesWithEachResultHandler(ruleInput);
break;
default:
LOGGER.error("Unsupported " + MappingStrategy.class.getSimpleName() + ": " +
ruleToResultHandlerMapping);
}
} | java | {
"resource": ""
} |
q13985 | GeneralValidator.processEachRuleWithEachResultHandler | train | @SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals)
private void processEachRuleWithEachResultHandler(RI ruleInput) {
// For each rule
for (Rule<RI, RO> rule : rules) {
// Validate the data and get the rule output
Object ruleOutput = rule.validate(ruleInput);
// Transform the rule output
if (ruleOutputTransformers != null) {
for (Transformer transformer : ruleOutputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
// Transform the transformed rule output to result handler input
if (resultHandlerInputTransformers != null) {
for (Transformer transformer : resultHandlerInputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
RHI resultHandlerInput = (RHI) ruleOutput;
// Process the result handler input with the result handlers
processResultHandlers(resultHandlerInput);
}
} | java | {
"resource": ""
} |
q13986 | GeneralValidator.processAllRulesWithEachResultHandler | train | @SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals)
private void processAllRulesWithEachResultHandler(RI ruleInput) {
// For each rule
List<Object> combinedRulesOutput = new ArrayList<Object>(rules.size());
for (Rule<RI, RO> rule : rules) {
// Validate the data and get the rule output
Object data = rule.validate(ruleInput);
// Transform the rule output
if (ruleOutputTransformers != null) {
for (Transformer transformer : ruleOutputTransformers) {
data = transformer.transform(data);
}
}
// Put the transformed rule output in a list
combinedRulesOutput.add(data);
}
// Transform the list of transformed rule output to result handler input
Object ruleOutput = combinedRulesOutput;
if (resultHandlerInputTransformers != null) {
for (Transformer transformer : resultHandlerInputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
RHI resultHandlerInput = (RHI) ruleOutput;
// Process the result handler input with the result handlers
processResultHandlers(resultHandlerInput);
} | java | {
"resource": ""
} |
q13987 | GeneralValidator.processResultHandlers | train | private void processResultHandlers(RHI resultHandlerInput) {
for (ResultHandler<RHI> resultHandler : resultHandlers) {
resultHandler.handleResult(resultHandlerInput);
}
} | java | {
"resource": ""
} |
q13988 | GeneralValidator.dispose | train | private void dispose(Collection<Transformer> elements) {
if (elements != null) {
for (Transformer<?, ?> element : elements) {
if (element instanceof Disposable) {
((Disposable) element).dispose();
}
}
elements.clear();
}
} | java | {
"resource": ""
} |
q13989 | AbstractCellIconFeedback.getAbsoluteAnchorLinkWithCell | train | private AnchorLink getAbsoluteAnchorLinkWithCell(int dragOffsetX) {
AnchorLink absoluteAnchorLink;
TableModel tableModel = table.getModel();
if ((0 <= modelRowIndex) && (modelRowIndex < tableModel.getRowCount()) && (0 <= modelColumnIndex) &&
(modelColumnIndex < tableModel.getColumnCount())) {
int viewRowIndex = table.convertRowIndexToView(modelRowIndex);
int viewColumnIndex = table.convertColumnIndexToView(modelColumnIndex);
Rectangle cellBounds = table.getCellRect(viewRowIndex, viewColumnIndex, true);
Anchor relativeCellAnchor = anchorLinkWithCell.getMasterAnchor();
Anchor absoluteCellAnchor = new Anchor(0.0f, cellBounds.x + dragOffsetX + (int) (cellBounds.width *
relativeCellAnchor.getRelativeX()) + relativeCellAnchor.getOffsetX(), 0.0f, cellBounds.y + (int)
(cellBounds.height * relativeCellAnchor.getRelativeY()) + relativeCellAnchor.getOffsetY());
absoluteAnchorLink = new AnchorLink(absoluteCellAnchor, anchorLinkWithCell.getSlaveAnchor());
} else {
// Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index?
LOGGER.debug("Cell at model row and/or column indices is not visible: (" + modelRowIndex + "," +
modelColumnIndex +
") for table dimensions (" + tableModel.getRowCount() + "," + tableModel.getColumnCount() + ")");
// Decoration will not be shown
absoluteAnchorLink = null;
}
return absoluteAnchorLink;
} | java | {
"resource": ""
} |
q13990 | SolrFacetToFacetQueryResultItemConverter.convert | train | public static List<FacetQueryResult.Field> convert(QueryResponse solrResponse, Map<String, String> alias) {
// Sanity check
if (solrResponse == null || solrResponse.getResponse() == null || solrResponse.getResponse().get("facets") == null) {
return null;
}
if (alias == null) {
alias = new HashMap<>();
}
SimpleOrderedMap<Object> solrFacets = (SimpleOrderedMap<Object>) solrResponse.getResponse().get("facets");
List<FacetQueryResult.Field> fields = new ArrayList<>();
int count = (int) solrFacets.get("count");
for (int i = 0; i < solrFacets.size(); i++) {
String name = solrFacets.getName(i);
if (!"count".equals(name)) {
if (solrFacets.get(name) instanceof SimpleOrderedMap) {
String[] split = name.split("___");
FacetQueryResult.Field facetField = new FacetQueryResult.Field(getName(split[0], alias),
getBucketCount((SimpleOrderedMap<Object>) solrFacets.get(name), count), new ArrayList<>());
if (split.length > 3) {
facetField.setStart(FacetQueryParser.parseNumber(split[1]));
facetField.setEnd(FacetQueryParser.parseNumber(split[2]));
facetField.setStep(FacetQueryParser.parseNumber(split[3]));
}
parseBuckets((SimpleOrderedMap<Object>) solrFacets.get(name), facetField, alias);
fields.add(facetField);
} else {
fields.add(parseAggregation(name, solrFacets.get(name), alias));
}
}
}
return fields;
} | java | {
"resource": ""
} |
q13991 | SolrFacetToFacetQueryResultItemConverter.getBucketCount | train | private static int getBucketCount(SimpleOrderedMap<Object> solrFacets, int defaultCount) {
List<SimpleOrderedMap<Object>> solrBuckets = (List<SimpleOrderedMap<Object>>) solrFacets.get("buckets");
if (solrBuckets == null) {
for (int i = 0; i < solrFacets.size(); i++) {
if (solrFacets.getName(i).equals("count")) {
return (int) solrFacets.getVal(i);
}
}
}
return defaultCount;
} | java | {
"resource": ""
} |
q13992 | DependencyConfigs.printAll | train | @SuppressWarnings("unused")
public void printAll()
{
project.getLogger().lifecycle("Full contents of dependency configurations:");
project.getLogger().lifecycle("-------------------------------------------");
for (final Map.Entry<String, DependencyConfig> entry : depConfigs.entrySet()) {
project.getLogger().lifecycle("- " + entry.getKey() + ":\t" + entry.getValue());
}
} | java | {
"resource": ""
} |
q13993 | JTableRolloverCellProperty.updateValue | train | private void updateValue(Point location) {
CellPosition oldValue = value;
if (location == null) {
value = null;
} else {
int row = table.rowAtPoint(location);
int column = table.columnAtPoint(location);
value = new CellPosition(row, column);
}
maybeNotifyListeners(oldValue, value);
} | java | {
"resource": ""
} |
q13994 | EventHubSpout.preparePartitions | train | public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception {
this.collector = collector;
if(stateStore == null) {
String zkEndpointAddress = eventHubConfig.getZkConnectionString();
if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) {
//use storm's zookeeper servers if not specified.
@SuppressWarnings("unchecked")
List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS);
Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue();
StringBuilder sb = new StringBuilder();
for (String zk : zkServers) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(zk+":"+zkPort);
}
zkEndpointAddress = sb.toString();
}
stateStore = new ZookeeperStateStore(zkEndpointAddress,
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL));
}
stateStore.open();
partitionCoordinator = new StaticPartitionCoordinator(
eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory);
for (IPartitionManager partitionManager :
partitionCoordinator.getMyPartitionManagers()) {
partitionManager.open();
}
} | java | {
"resource": ""
} |
q13995 | PropertyChangeTrigger.propertyChange | train | @Override
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
if ((triggerProperties == null) || triggerProperties.isEmpty() || triggerProperties.contains
(propertyChangeEvent.getPropertyName())) {
fireTriggerEvent(new TriggerEvent(propertyChangeEvent.getSource()));
}
} | java | {
"resource": ""
} |
q13996 | SolrManager.existsCore | train | public boolean existsCore(String coreName) {
try {
CoreStatus status = CoreAdminRequest.getCoreStatus(coreName, solrClient);
status.getInstanceDirectory();
} catch (Exception e) {
return false;
}
return true;
} | java | {
"resource": ""
} |
q13997 | SolrManager.existsCollection | train | public boolean existsCollection(String collectionName) throws SolrException {
try {
List<String> collections = CollectionAdminRequest.listCollections(solrClient);
for (String collection : collections) {
if (collection.equals(collectionName)) {
return true;
}
}
return false;
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.CONFLICT, e);
}
} | java | {
"resource": ""
} |
q13998 | SolrManager.removeCollection | train | public void removeCollection(String collectionName) throws SolrException {
try {
CollectionAdminRequest request = CollectionAdminRequest.deleteCollection(collectionName);
request.process(solrClient);
} catch (SolrServerException | IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage(), e);
}
} | java | {
"resource": ""
} |
q13999 | SolrManager.removeCore | train | public void removeCore(String coreName) throws SolrException {
try {
CoreAdminRequest.unloadCore(coreName, true, true, solrClient);
} catch (SolrServerException | IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage(), e);
}
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.