code_snippet
stringlengths
92
2.48k
score
float64
1.83
4.89
String[] labels, String defaultValue ); /** * * @param key * @param resource_name * @param encoding_type * @param defaultValue * @return * @since 2.1.0.2 */ public PasswordParameter addPasswordParameter2( String key, String resource_name, int encoding_type, // see PasswordParameter.ET_ constants byte[] defaultValue ); // plain default value /** * * @param key * @param resource_name * @param defaultValue * @return * @since 2.1.0.2 */ public IntParameter addIntParameter2( String key, String resource_name, int defaultValue ); /** * * @param key * @param resource_name * @param defaultValue * @param min_value Minimum allowed value * @param max_value Maximum allowed value * @return * @since 3.0.3.5 */ public IntParameter addIntParameter2( String key, String resource_name, int defaultValue, int min_value, int max_value);
3.075377
sql = _SQL_SELECT_SCPRODUCTVERSION.concat(SCProductVersionModelImpl.ORDER_BY_JPQL); } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (orderByComparator == null) { list = (List<SCProductVersion>)QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); } else { list = (List<SCProductVersion>)QueryUtil.list(q, getDialect(), start, end); } } catch (Exception e) { throw processException(e); } finally { if (list == null) { FinderCacheUtil.removeResult(finderPath, finderArgs); } else { cacheResult(list);
3.479592
*/ package com.liferay.portalweb.portal.dbupgrade.sampledata523.shopping.coupon; import com.liferay.portalweb.portal.BaseTestCase; import com.liferay.portalweb.portal.util.RuntimeVariables; /** * @author Brian Wing Shun Chan */ public class ViewCouponTest extends BaseTestCase { public void testViewCoupon() throws Exception { selenium.open("/user/joebloggs/home/"); loadRequiredJavaScriptModules(); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isElementPresent("link=Communities I Own")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
3.515957
assertEquals(existingEntryId, newEntryId); } public void testDynamicQueryByProjectionMissing() throws Exception { DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RatingsEntry.class, RatingsEntry.class.getClassLoader()); dynamicQuery.setProjection(ProjectionFactoryUtil.property("entryId")); dynamicQuery.add(RestrictionsFactoryUtil.in("entryId", new Object[] { nextLong() })); List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery); assertEquals(0, result.size()); } public void testResetOriginalValues() throws Exception { if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) { return; } RatingsEntry newRatingsEntry = addRatingsEntry(); _persistence.clearCache(); RatingsEntryModelImpl existingRatingsEntryModelImpl = (RatingsEntryModelImpl)_persistence.findByPrimaryKey(newRatingsEntry.getPrimaryKey()); assertEquals(existingRatingsEntryModelImpl.getUserId(), existingRatingsEntryModelImpl.getOriginalUserId()); assertEquals(existingRatingsEntryModelImpl.getClassNameId(), existingRatingsEntryModelImpl.getOriginalClassNameId()); assertEquals(existingRatingsEntryModelImpl.getClassPK(), existingRatingsEntryModelImpl.getOriginalClassPK()); } protected RatingsEntry addRatingsEntry() throws Exception { long pk = nextLong(); RatingsEntry ratingsEntry = _persistence.create(pk); ratingsEntry.setCompanyId(nextLong()); ratingsEntry.setUserId(nextLong()); ratingsEntry.setUserName(randomString()); ratingsEntry.setCreateDate(nextDate()); ratingsEntry.setModifiedDate(nextDate());
2.806452
while (label >= 1) { switch (label) { case 1: selenium.open("/web/guest/home/"); loadRequiredJavaScriptModules(); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isElementPresent("link=Control Panel")) { break; } } catch (Exception e) { } Thread.sleep(1000); } selenium.clickAt("link=Control Panel", RuntimeVariables.replace("Control Panel")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); selenium.clickAt("link=Web Content", RuntimeVariables.replace("Web Content")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); boolean webContent1Present = selenium.isElementPresent( "_15_rowIds"); if (!webContent1Present) { label = 2; continue; } selenium.clickAt("//input[@name='_15_allRowIds']", RuntimeVariables.replace("")); selenium.click(RuntimeVariables.replace( "//input[@value='Delete']")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); assertTrue(selenium.getConfirmation() .matches("^Are you sure you want to delete the selected web content[\\s\\S]$")); case 2:
3.016043
String emailMessageAddedSubjectPrefix = getParameter( actionRequest, "emailMessageAddedSubjectPrefix"); String emailMessageAddedBody = getParameter( actionRequest, "emailMessageAddedBody"); if (Validator.isNull(emailMessageAddedSubjectPrefix)) { SessionErrors.add(actionRequest, "emailMessageAddedSubjectPrefix"); } else if (Validator.isNull(emailMessageAddedBody)) { SessionErrors.add(actionRequest, "emailMessageAddedBody"); } } protected void validateEmailMessageUpdated(ActionRequest actionRequest) throws Exception { String emailMessageUpdatedSubjectPrefix = getParameter( actionRequest, "emailMessageUpdatedSubjectPrefix"); String emailMessageUpdatedBody = getParameter( actionRequest, "emailMessageUpdatedBody"); if (Validator.isNull(emailMessageUpdatedSubjectPrefix)) { SessionErrors.add( actionRequest, "emailMessageUpdatedSubjectPrefix"); } else if (Validator.isNull(emailMessageUpdatedBody)) { SessionErrors.add(actionRequest, "emailMessageUpdatedBody"); } }
3.166667
/** * @author Brian Wing Shun Chan */ public class UnitConverterTestPlan extends BaseTestSuite { public static Test suite() { TestSuite testSuite = new TestSuite(); testSuite.addTest(PortletTestPlan.suite()); testSuite.addTest(UnitTestPlan.suite());
4.189189
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.PortalClassLoaderUtil; import com.liferay.portal.kernel.util.SortedProperties; import com.liferay.portal.util.PropsUtil; import com.liferay.portal.util.PropsValues; import java.util.Enumeration; import java.util.Properties;
4.136842
*/ package com.liferay.portalweb.portlet.shopping.item.addtoshoppingcartcategoryitemmultiple; import com.liferay.portalweb.portal.BaseTestCase; import com.liferay.portalweb.portal.util.RuntimeVariables; /** * @author Brian Wing Shun Chan */ public class AddToShoppingCartCategoryItem3Test extends BaseTestCase { public void testAddToShoppingCartCategoryItem3() throws Exception { selenium.open("/web/guest/home/"); loadRequiredJavaScriptModules(); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible("link=Shopping Test Page")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
3.502674
for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isElementPresent("link=Control Panel")) { break; } } catch (Exception e) { } Thread.sleep(1000); } selenium.clickAt("link=Control Panel", RuntimeVariables.replace("")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); selenium.clickAt("link=Organizations", RuntimeVariables.replace("")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); selenium.type("_126_keywords", RuntimeVariables.replace("Web Content Display")); selenium.clickAt("//input[@value='Search']", RuntimeVariables.replace("")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); Thread.sleep(5000); assertEquals(RuntimeVariables.replace("Actions"), selenium.getText("//strong/a")); selenium.clickAt("//strong/a", RuntimeVariables.replace("Actions")); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible( "//div[@class='lfr-component lfr-menu-list']/ul/li[2]/a")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
2.765027
public class ComponentTag extends BaseComponentTag { protected void setAttributes(HttpServletRequest request) { Map<String, Object> options = getOptions(); HashMap<String, Object> optionsJSON = new HashMap<String, Object>(); _proccessAttributes(options, optionsJSON); super.setAttributes(request); setNamespacedAttribute(request, "options", options); setNamespacedAttribute(request, "optionsJSON", optionsJSON); } private boolean _isEventAttribute(String key) { Matcher afterMatcher = _EVENT_AFTER_REGEX.matcher(key); Matcher onMatcher = _EVENT_ON_REGEX.matcher(key); return (afterMatcher.find() || onMatcher.find()); } private boolean _isValidAttribute(String key) { List<String> excludeAttributes = Collections.EMPTY_LIST; if (getExcludeAttributes() != null) { excludeAttributes = Arrays.asList( getExcludeAttributes().split(StringPool.COMMA)); } return !(excludeAttributes.contains(key) || key.equals(_DYNAMIC_ATTRIBUTES)); } private void _proccessAttributes(Map<String, Object> options, Map<String, Object> newOptions) { Map<String, String> afterEventOptionsMap = new HashMap<String, String>(); Map<String, String> onEventOptionsMap = new HashMap<String, String>(); for (String key : options.keySet()) { if (!_isValidAttribute(key)) { continue; } Object value = options.get(key); String originalKey = ReservedAttributeUtil.getOriginalName(getName(), key);
3.569948
*/ package com.liferay.portalweb.portlet.wiki.wikipage.deletewikipagechildpage; import com.liferay.portalweb.portal.BaseTestCase; import com.liferay.portalweb.portal.util.RuntimeVariables; /** * @author Brian Wing Shun Chan */ public class DeleteWikiPageChildPageTest extends BaseTestCase { public void testDeleteWikiPageChildPage() throws Exception { selenium.open("/web/guest/home/"); loadRequiredJavaScriptModules(); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible("link=Wiki Test Page")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
3.745192
*/ public ICMPEchoPacket(ICMPEchoPacket packet) { super(packet); } public int getICMPHeaderByteLength() { return 8; }
3.971831
public java.util.List<com.liferay.portlet.polls.model.PollsVote> getQuestionVotes( long questionId, int start, int end) throws com.liferay.portal.kernel.exception.SystemException { return _pollsVoteLocalService.getQuestionVotes(questionId, start, end); } public int getQuestionVotesCount(long questionId) throws com.liferay.portal.kernel.exception.SystemException { return _pollsVoteLocalService.getQuestionVotesCount(questionId); }
3.137255
RuntimeVariables.replace("Actions")); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible( "//div[@class='lfr-component lfr-menu-list']/ul/li[6]/a")) { break; } } catch (Exception e) { } Thread.sleep(1000); } assertEquals(RuntimeVariables.replace("Delete"), selenium.getText( "//div[@class='lfr-component lfr-menu-list']/ul/li[6]/a")); selenium.click(RuntimeVariables.replace( "//div[@class='lfr-component lfr-menu-list']/ul/li[6]/a")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); assertTrue(selenium.getConfirmation() .matches("^Are you sure you want to delete this[\\s\\S]$")); case 3:
3.145
package org.gudy.azureus2.countrylocator.statisticsProviders; import java.util.Map; import org.gudy.azureus2.plugins.peers.Peer; /** * IStatisticsProvider (see {@link #getStatistics(Peer[])}) * * @author gooogelybear * @author free_lancer */ public interface IStatisticsProvider { /** * Calculates stats values for a column in the stats table. <br /> * * @param peers the peers for which the stats will be calculated * @return A map indexed by country code which contains the stats values as values */ public Map getStatistics(Peer[] peers); public String getName(); /** * * @return The measurement unit used for the stats values, e.g. "kB/s" */ public String getUnit();
4.243781
boolean advancedVisible = selenium.isVisible( "link=Advanced \u00bb"); if (!advancedVisible) { label = 3; continue; } selenium.clickAt("link=Advanced \u00bb", RuntimeVariables.replace("Advanced")); case 3: for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible("//select[@id='_125_status']")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
3.102041
try { if (selenium.isElementPresent("link=Control Panel")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
3.353535
*/ package com.liferay.portalweb.portal.cluster.cluster3; import com.liferay.portalweb.portal.BaseTestCase; import com.liferay.portalweb.portal.util.RuntimeVariables; /** * @author Brian Wing Shun Chan */ public class AssertNodeTwoTest extends BaseTestCase { public void testAssertNodeTwo() throws Exception { selenium.open("/web/guest/home/"); loadRequiredJavaScriptModules(); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible("//input[@id='_58_login']")) { break; } } catch (Exception e) { } Thread.sleep(1000); }
3.345745
loadRequiredJavaScriptModules(); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); } try { if (selenium.isVisible("link=Requests Test Page")) { break; } } catch (Exception e) { } Thread.sleep(1000); } selenium.click(RuntimeVariables.replace("link=Requests Test Page")); selenium.waitForPageToLoad("30000"); loadRequiredJavaScriptModules(); assertTrue(selenium.isPartialText("//a[@id='_145_addApplication']", "More")); selenium.clickAt("//a[@id='_145_addApplication']", RuntimeVariables.replace("More")); for (int second = 0;; second++) { if (second >= 90) { fail("timeout"); }
3.160221
PrimaryKeyInfo() { super(null, null, null, null, null); } /** * Create a new PrimaryKeyInfo object. * * @param catalog catalog name * @param schema schema name * @param aColumnName the name of the column that either by itself or along * with others form(s) a unique index value for a single * row in a table. * @param aKeySequence sequence number within primary key * @param aPrimaryKeyName the name of the primary key * @param md */ public PrimaryKeyInfo(String catalog, String schema, String aTableName, String aColumnName, short aKeySequence, String aPrimaryKeyName, ISQLDatabaseMetaData md) { super(catalog, schema, aPrimaryKeyName, DatabaseObjectType.PRIMARY_KEY, md); columnName = aColumnName; tableName = aTableName; keySequence = aKeySequence; } /** * @param columnName The columnName to set. */ public void setColumnName(String columnName) { this.columnName = columnName; } /** * @return Returns the columnName. */ public String getColumnName() { return columnName; } /** * @param keySequence The keySequence to set. */ public void setKeySequence(short keySequence) { this.keySequence = keySequence; }
3.956284
Object ret = body.eval(callstack, interpreter); boolean breakout = false; if(ret instanceof ReturnControl) { switch(((ReturnControl)ret).kind ) { case RETURN: return ret;
2.991736
if (actionList.size() == 1) { ActionMenu menu = actionList.get(0); if (menu.getSubItems().length == 0) { return null; } if (menu.getSubItems().length == 1) { Action action = menu.getSubItems()[0].getAction();
3.743802
private String compactString(String source) { String result= DELTA_START + source.substring(fPrefix, source.length() - fSuffix + 1) + DELTA_END; if (fPrefix > 0) result= computeCommonPrefix() + result; if (fSuffix > 0) result= result + computeCommonSuffix();
2.694215
/** * Constructor, with a argument reference to the PUBLIC User Object which * is null if this is the SYS or PUBLIC user. * * The dependency upon a GranteeManager is undesirable. Hopefully we * can get rid of this dependency with an IOC or Listener re-design. */ Grantee(String name, Grantee inGrantee, GranteeManager man) throws HsqlException { rightsMap = new IntValueHashMap(); granteeName = name; granteeManager = man;}
4.033058
/** * Quits the application without any questions. */ public void quit() { getConnectController().quitGame(true); if (!windowed) { gd.setFullScreenWindow(null); } System.exit(0);}
4.190083
xsp = jj_scanpos; if (jj_scan_token(100)) { jj_scanpos = xsp; if (jj_scan_token(101)) return true;
2.190083
/** * Attention: DO NOT USE THIS! * Under Os/2 it has some problems with calculating the real Date! * * @deprecated */ public Date(int daysSince1970) { long l = (long) daysSince1970 * 24 * 60 * 60 * 1000; java.util.Date d = new java.util.Date(l); Calendar cal = Calendar.getInstance();}
3.628099
public TestMethodRunner(Object test, Method method, RunNotifier notifier, Description description) { super(test.getClass(), Before.class, After.class, test); fTest= test; fMethod= method;
2.859504
/** * Returns a vector containing the URI (type + path) for all the databases. */ public static Vector getDatabaseURIs() { Vector v = new Vector(); Iterator it = databaseIDMap.values().iterator(); while (it.hasNext()) { Database db = (Database) it.next();
4.132231
private void moveUnit(KeyEvent e) { if (!parent.isMapboardActionsEnabled()) { return; } switch (e.getKeyCode()) { case KeyEvent.VK_ESCAPE: // main menu break; case KeyEvent.VK_NUMPAD1: case KeyEvent.VK_END: inGameController.moveActiveUnit(Map.SW);
3.347107
if ( clas == null ) throw new ClassNotFoundException( "Class: " + value+ " not found in namespace"); asClass = clas; return asClass;
3.644628
btPanel.add(cancel); getRootPane().setDefaultButton(ok); panel.add(btPanel, BorderLayout.SOUTH);
3.53719
* @param expected expected value * @param actual actual value */ static public void assertEquals(String message, Object expected, Object actual) { if (expected == null && actual == null) return; if (expected != null && isEquals(expected, actual)) return; else if (expected instanceof String && actual instanceof String) { String cleanMessage= message == null ? "" : message;
3.041322
Object removeName(String name) throws HsqlException { Object owner = nameList.remove(name); if (owner == null) { // should contain name throw Trace.error(Trace.GENERAL_ERROR); } return owner;
4.049587
int stepSize = Math.min((option.getMaximumValue() - option.getMinimumValue()) / 10, 1000); spinner = new JSpinner(new SpinnerNumberModel(option.getValue(), option.getMinimumValue(), option.getMaximumValue(), Math.max(1, stepSize))); spinner.setToolTipText(option.getShortDescription());
1.834711
if ( parent != null ) setStrictJava( parent.getStrictJava() ); this.sourceFileInfo = sourceFileInfo; BshClassManager bcm = BshClassManager.createClassManager( this );
2.900826
mDevices = new Vector<DeviceIf>(); DeviceFileHandling reader = new DeviceFileHandling(); for (int i = 0; i < num; i++) { String classname = (String) in.readObject();
3.735537
/** * Do not use. Testing purposes only. */ public Result runMain(String... args) { System.out.println("JUnit version " + Version.id()); List<Class<?>> classes= new ArrayList<Class<?>>(); List<Failure> missingClasses= new ArrayList<Failure>();
2.471074
/** * temp constraint constructor */ Constraint(HsqlName name, int[] mainCols, Table refTable, int[] refCols, int type, int deleteAction, int updateAction) { core = new ConstraintCore(); constName = name; constType = type;
3.553719
int eventId = active? ON : OFF; ActionEvent blinkEvent = new ActionEvent(this,eventId,"blink"); fireActionEvent(blinkEvent);
3.264463
else if ( isPrimitive( returnType ) ) { int opcode = IRETURN; String type; String meth;
3.727273
/** * Returns the PluginPanel * @return Panel */ public JPanel createSettingsPanel() { mPanel = new CapturePluginPanel(mOwner, mCloneData); mPanel.setBorder(Borders.createEmptyBorder(Sizes.DLUY5,Sizes.DLUX5,Sizes.DLUY5,Sizes.DLUX5)); mPanel.setSelectedTab(mCurrentPanel);
2.735537
protected void printFailures(Result result) { if (result.getFailureCount() == 0) return; if (result.getFailureCount() == 1) getWriter().println("There was " + result.getFailureCount() + " failure:"); else getWriter().println("There were " + result.getFailureCount() + " failures:");
3.933884
public static long getNormalisedTime(long t) { synchronized (tempCalDefault) { setTimeInMillis(tempCalDefault, t); resetToTime(tempCalDefault); return getTimeInMillis(tempCalDefault);
3.479339
public boolean check(Unit u, PathNode p) { if (p.getTile().getSettlement() != null && p.getTile().getSettlement().getOwner() == player && p.getTile().getSettlement() != inSettlement) { Settlement s = p.getTile().getSettlement(); int turns = p.getTurns(); destinations.add(new ChoiceItem(s.toString() + " (" + turns + ")", s));
2.099174
if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
2.38843
/** * Compute the proper position for a centered window */ private Point comuteDisplayPointCentre(Dimension dim) { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screen.width - dim.width) / 2; int y = (screen.height - dim.height) / 2;
3.752066
public void filter(Filter filter) throws NoTestsRemainException { for (Iterator<Runner> iter= fRunners.iterator(); iter.hasNext();) { Runner runner= iter.next(); if (filter.shouldRun(runner.getDescription())) filter.apply(runner); else iter.remove();
2.867769
boolean hasReturnValue; outlen = parameters.length; offset = 0;
3.942149
/** * Sets the currently chosen <code>MapTransform</code>. * @param mt The transform that should be applied to a * <code>Tile</code> that is clicked on the map. */ public void setMapTransform(MapTransform mt) { currentMapTransform = mt; MapControlsAction mca = (MapControlsAction) freeColClient.getActionManager().getFreeColAction(MapControlsAction.ID); if (mca.getMapControls() != null) { mca.getMapControls().update(mt);
2.793388
if (iterateOverMe instanceof String) return createEnumeration(((String)iterateOverMe).toCharArray()); if (iterateOverMe instanceof StringBuffer) return createEnumeration( iterateOverMe.toString().toCharArray()); throw new IllegalArgumentException( "Cannot enumerate object of type "+iterateOverMe.getClass());
3.264463
/** * Constructs a new Date object, initialized with the current date. */ public Date() { Calendar mCalendar = Calendar.getInstance(); mYear = mCalendar.get(Calendar.YEAR); mMonth = mCalendar.get(Calendar.MONTH) + 1;
4.22314
/** * @param contextLength the maximum length for <code>expected</code> and <code>actual</code>. When contextLength * is exceeded, the Strings are shortened * @param expected the expected string value * @param actual the actual string value */ public ComparisonCompactor(int contextLength, String expected, String actual) { fContextLength= contextLength; fExpected= expected; fActual= actual;
4.016529
case CompiledStatement.DELETE : return executeDeleteStatement(cs); case CompiledStatement.CALL : return executeCallStatement(cs); case CompiledStatement.DDL : return executeDDLStatement(cs);
4.347107
/** * Creates a new <code>DisbandUnitAction</code>. * * @param freeColClient The main controller object for the client. */ DisbandUnitAction(FreeColClient freeColClient) { super(freeColClient, "unit.state.8", null, KeyStroke.getKeyStroke('D', 0)); putValue(BUTTON_IMAGE, freeColClient.getImageLibrary().getUnitButtonImageIcon(ImageLibrary.UNIT_BUTTON_DISBAND, 0)); putValue(BUTTON_ROLLOVER_IMAGE, freeColClient.getImageLibrary().getUnitButtonImageIcon( ImageLibrary.UNIT_BUTTON_DISBAND, 1));
2.008264
Class clas = object.getClass(); Field field = Reflect.resolveJavaField( clas, name, false/*onlyStatic*/ ); if ( field != null ) return new Variable( name, field.getType(), new LHS( object, field ) );
2.545455
for(AbstractPluginProgramFormating config : mConfigs) if(config != null && config.isValid()) list.add(new ProgramReceiveTarget(this, config.getName(), config.getId())); if(list.isEmpty()) list.add(new ProgramReceiveTarget(this, DEFAULT_CONFIG.getName(), DEFAULT_CONFIG.getId())); return list.toArray(new ProgramReceiveTarget[list.size()]);
2.578512
Class<? extends Throwable> expectedException(Method method) { Test annotation= method.getAnnotation(Test.class); if (annotation.expected() == None.class) return null; else return annotation.expected();
2.77686
row[1] = ns.getCatalogName(row[0]); row[2] = schema.equals(defschema) ? Boolean.TRUE : Boolean.FALSE; t.insertSys(row);
2.966942
/** * Handles an "deliverGift"-request. * * @param element The element (root element in a DOM-parsed XML tree) that * holds all the information. */ private Element deliverGift(Element element) { Element unitElement = Message.getChildElement(element, Unit.getXMLElementTagName()); Unit unit = (Unit) getGame().getFreeColGameObject(unitElement.getAttribute("ID")); unit.readFromXMLElement(unitElement);
2.909091
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQ: t = jj_consume_token(EQ); break; case NE: t = jj_consume_token(NE);
2.421488
public synchronized void removeProgram(Program program) { PluginTreeNode node = findProgramTreeNode(program, false); if (node != null) { mChildNodes.remove(node); if (mMarker != null) { program.unmark(mMarker);
3.082645
private TestClassRunnerForParameters(Class<?> klass, Object[] parameters, int i) { super(klass); fParameters= parameters; fParameterSetNumber= i;
3.289256
void link(IndexRowIterator other) { other.next = next; other.last = this; next.last = other;
4.07438
final String heightText = Messages.message("height"); final JTextField inputWidth = new JTextField(Integer.toString(DEFAULT_WIDTH), COLUMNS); final JTextField inputHeight = new JTextField(Integer.toString(DEFAULT_HEIGHT), COLUMNS);
3.842975
/** Get the top level namespace or this namespace if we are the top. Note: this method should probably return type bsh.This to be consistent with getThis(); */ public This getGlobal( Interpreter declaringInterpreter ) { if ( parent != null ) return parent.getGlobal( declaringInterpreter ); else return getThis( declaringInterpreter );
3.760331
/** * Read Settings * @param stream * @throws IOException * @throws ClassNotFoundException */ public void readData(ObjectInputStream stream) throws IOException, ClassNotFoundException { int version = stream.readInt(); mNumber = stream.readInt(); mName = stream.readUTF();
3.876033
/** * Constructs a comparison failure. * @param message the identifying message or null * @param expected the expected string value * @param actual the actual string value */ public ComparisonFailure (String message, String expected, String actual) { super (message); fExpected= expected; fActual= actual;
3.933884
public void close() { if (isClosed) { return; } isClosed = true; try { resultOut.setResultType(ResultConstants.SQLDISCONNECT);
4.049587
public void actionPerformed(ActionEvent evt) { if (!hasFocus()) { stopBlinking(); } if (blinkOn) { setOpaque(false); blinkOn = false;
4.165289
private static String getBaseName( String className ) { int i = className.indexOf("$"); if ( i == -1 ) return className; return className.substring(i+1);
3.917355
panel.add(UiUtilities.createHelpTextArea(mLocalizer.msg("help","No endtime defined")), cc.xy(1,1)); mTimePanel = new TimeDateChooserPanel(date); panel.add(mTimePanel, cc.xy(1,3));
2.644628
try { suiteMethod= klass.getMethod("suite"); if (! Modifier.isStatic(suiteMethod.getModifiers())) { throw new Exception(klass.getName() + ".suite() must be static"); } suite= (Test) suiteMethod.invoke(null); // static method
2.727273
// ---------------------------------------------------------------- // required // ---------------------------------------------------------------- addColumn(t, "PROCEDURE_CAT", Types.VARCHAR); addColumn(t, "PROCEDURE_SCHEM", Types.VARCHAR); addColumn(t, "PROCEDURE_NAME", Types.VARCHAR, false); // not null
3.603306
if (missionChip == null) { GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration(); loadMissionChip(gc, color, expertMission); if (expertMission) { missionChip = expertMissionChips.get(color);
2.719008
/** Swap in the value as the new top of the stack and return the old value. */ public NameSpace swap( NameSpace newTop ) { NameSpace oldTop = (NameSpace)(stack.elementAt(0)); stack.setElementAt( newTop, 0 ); return oldTop;
3.61157
String classname = (String) in.readObject(); String devname = (String)in.readObject(); DeviceIf dev = DriverFactory.getInstance().createDevice(classname, devname);
3.603306
String simpleName= runnerClass.getSimpleName(); InitializationError error= new InitializationError(String.format( CONSTRUCTOR_ERROR_FORMAT, simpleName, simpleName)); return Request.errorReport(fTestClass, error).getRunner();
2.413223
public boolean isReadOnly() throws HsqlException { Object info = getAttribute(Session.INFO_CONNECTION_READONLY); isReadOnly = ((Boolean) info).booleanValue(); return isReadOnly;
3.826446
boolean response = warehouseDialog.getResponseBoolean(); remove(warehouseDialog); return response;
3.884298
else if ( returnType.equals("F") ) opcode = FRETURN; else if ( returnType.equals("J") ) //long opcode = LRETURN; cv.visitInsn(opcode);
3.77686
String channelId; if (version==1) { dataServiceId = (String)in.readObject(); channelId=""+in.readInt();
3.471074
@Override public Description getDescription() { Description spec= Description.createSuiteDescription(getName()); List<Method> testMethods= fTestMethods; for (Method method : testMethods) spec.addChild(methodDescription(method));
2.652893
while (classNames.hasNext()) { clsName = (String) classNames.next(); clsCat = ns.getCatalogName(clsName); clsSchem = ns.getSchemaName(clsName);
3.595041
String[] texts = new String[messages.length]; ImageIcon[] images = new ImageIcon[messages.length]; for (int i = 0; i < messages.length; i++) { String ID = messages[i].getMessageID();
3.214876
mProgramTable.changeSelection(row, 0, false, false); Program p = (Program) mProgramTableModel.getValueAt(row, 1); JPopupMenu menu = devplugin.Plugin.getPluginManager().createPluginContextMenu(p, CapturePlugin.getInstance());
2.603306
/** * Add one zero if neccessary * @param number * @return */ private CharSequence addZero(int number) { StringBuilder builder = new StringBuilder(); if (number < 10) { builder.append('0'); } builder.append(Integer.toString(number));
4.016529
@Override public void run(RunNotifier notifier) { TestResult result= new TestResult(); result.addListener(createAdaptingListener(notifier)); fTest.run(result);
3.363636
t.checkColumnsMatch(tc.core.mainColArray, tc.core.refTable, tc.core.refColArray); session.commit(); TableWorks tableWorks = new TableWorks(session, t);
2.92562
@Override public void mousePressed(MouseEvent e) { if (f.getDesktopPane() == null || f.getDesktopPane().getDesktopManager() == null) { return; } loc = SwingUtilities.convertPoint((Component) e.getSource(), e.getX(), e.getY(), null); f.getDesktopPane().getDesktopManager().beginDraggingFrame(f);
2.404959
/** Translate bsh.Modifiers into ASM modifier bitflags. */ static int getASMModifiers( Modifiers modifiers ) { int mods = 0; if ( modifiers == null ) return mods; if ( modifiers.hasModifier("public") ) mods += ACC_PUBLIC;
3.694215
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String str; if (value instanceof DeviceIf) { DeviceIf device = (DeviceIf)value;
2.859504
public String compact(String message) { if (fExpected == null || fActual == null || areStringsEqual()) return Assert.format(message, fExpected, fActual); findCommonPrefix(); findCommonSuffix();
3.380165
classNames = classNameSet.iterator(); while (classNames.hasNext()) { className = (String) classNames.next(); methods = iterateRoutineMethods(className, andAliases);
3.809917
/** * Generates a color chip image and stores it in memory. * * @param gc The GraphicsConfiguration is needed to create images that are * compatible with the local environment. * @param c The color of the color chip to create. */ private void loadColorChip(GraphicsConfiguration gc, Color c) { BufferedImage tempImage = gc.createCompatibleImage(11, 17); Graphics g = tempImage.getGraphics(); if (c.equals(Color.BLACK)) { g.setColor(Color.WHITE);
3.396694
out.writeObject(device.getDriver().getClass().getName()); out.writeObject(device.getName()); device.writeData(out);
3.487603
File data = new File(Plugin.getPluginManager().getTvBrowserSettings().getTvBrowserUserHome() + File.separator + "CaptureDevices" + File.separator + mCount + ".dat"); ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(data)); dev.writeData(stream);
2.727273
private static Class<?>[] getAnnotatedClasses(Class<?> klass) throws InitializationError { SuiteClasses annotation= klass.getAnnotation(SuiteClasses.class); if (annotation == null) throw new InitializationError(String.format("class '%s' must have a SuiteClasses annotation", klass.getName())); return annotation.value();
2.297521
for (int j = 0; j < fieldcount; j++) { int i = Column.compare(session.database.collation, a[cols[j]], b[cols[j]], coltypes[cols[j]]); if (i != 0) { return i; } } return 0;
3.347107