code_snippet stringlengths 92 2.48k | score float64 1.83 4.89 |
|---|---|
/**
* Closes all panels, changes the background and shows the main menu.
*/
public void returnToTitle() {
// TODO: check if the GUI object knows that we're not
// inGame. (Retrieve value of GUI::inGame.) If GUI thinks
// we're still in the game then log an error because at thi... | 4.14876 |
/**
subsequent imports override earlier ones
*/
public void importPackage(String name)
{
if(importedPackages == null)
importedPackages = new Vector();
// If it exists, remove it and add it at the end (avoid memory leak)
if ( importedPackages.contains( name ) )
importedPackages.remove( name );
... | 3.933884 |
if(dataServiceId.compareTo(cmpDataServiceId) != 0) {
return false;
}
String country = getCountry();
String cmpCountry = cmp.getCountry();
| 4 |
public void filter(Filter filter) throws NoTestsRemainException {
for (Iterator<Method> iter= fTestMethods.iterator(); iter.hasNext();) {
Method method= iter.next();
if (!filter.shouldRun(methodDescription(method)))
iter.remove();
}
if (fTestMethods.isEmpty())
throw new NoTestsRemainException();
| 2.768595 |
/* fredt - in FK constraints column lists for iColMain and iColRef have
identical sets to visible columns of iMain and iRef respectively
but the order of columns can be different and must be preserved
*/
core.mainColArray = mainCols;
core.colLen = core.mainCo... | 3.942149 |
/**
* Adds a message to the list of messages that need to be displayed on the GUI.
* @param message The message to add.
*/
public synchronized void addMessage(GUIMessage message) {
if (getMessageCount() == MESSAGE_COUNT) {
messages.remove(0);
}
messages.add(messag... | 3.603306 |
private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec0[i2] & l2) != 0L);
default :
if ((jjbitVec1[i1] & l1) != 0L)
return true;
return false;
| 2.644628 |
private static Date correctTimeZone(final Date date) {
Date ret=date;
if(java.util.TimeZone.getDefault().useDaylightTime()){
if(java.util.TimeZone.getDefault().inDaylightTime(date))
ret.setTime(date.getTime()+1*60*60*1000);
}
return ret;
| 2.876033 |
@Override
public String getMessage() {
StringBuilder builder= new StringBuilder();
if (fMessage != null)
builder.append(fMessage);
builder.append("arrays first differed at element ");
| 3.231405 |
String getStateString() {
int state = getState();
switch (state) {
case DATABASE_CLOSING :
return "DATABASE_CLOSING";
case DATABASE_ONLINE :
return "DATABASE_ONLINE";
| 4.289256 |
public boolean displayTileCursor(Tile tile, int canvasX, int canvasY) {
if (currentMode == ViewMode.VIEW_TERRAIN_MODE) {
Position selectedTilePos = gui.getSelectedTile();
if (selectedTilePos == null)
return false;
if (selectedTilePos.getX() == tile.getX(... | 3.355372 |
private final int jjMoveStringLiteralDfa18_0(long old1, long active1, long old2, long active2)
{
if (((active1 &= old1) | (active2 &= old2)) == 0L)
return jjStartNfa_0(16, 0L, old1, old2);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(17, 0L, ac... | 2.090909 |
/**
* Get the List of all available Channels
*
* @return All available Channels
*/
public ElgatoChannel[] getAvailableChannels() {
ArrayList<ElgatoChannel> list = new ArrayList<ElgatoChannel>();
String res = null;
try {
res = mAppleScript.executeScript(C... | 3.363636 |
private Method getParametersMethod() throws Exception {
for (Method each : fKlass.getMethods()) {
if (Modifier.isStatic(each.getModifiers())) {
Annotation[] annotations= each.getAnnotations();
for (Annotation annotation : annotations) {
if (annotation.annotationType() == Parameters.class)
... | 2.355372 |
Node r = x.getRight();
if (r != null) {
x = r;
Node l = x.getLeft();
| 4.07438 |
InGameInputHandler inGameInputHandler = freeColClient.getInGameInputHandler();
freeColClient.getClient().setMessageHandler(inGameInputHandler);
gui.setInGame(true);
| 3.190083 |
/**
* Applies this action.
*
* @param e The <code>ActionEvent</code>.
*/
public void actionPerformed(ActionEvent e) {
final Game game = freeColClient.getGame();
final Map map = game.getMap();
Parameters p = showParametersDialog();
| 3.809917 |
public ActionMenu getButtonAction() {
AbstractAction action = new AbstractAction() {
public void actionPerformed(ActionEvent evt) {
showDialog();
}
};
action.putValue(Action.NAME, mLocalizer.msg("CapturePlugin", "Capture Plugin"));
action.putV... | 2.909091 |
Description description= Description.createSuiteDescription(name);
int n= ts.testCount();
for (int i= 0; i < n; i++)
description.addChild(makeDescription(ts.testAt(i)));
| 3.008264 |
if (expression.exprType != VALUE && expression.exprType != COLUMN
&& expression.exprType != FUNCTION
&& expression.exprType != ALTERNATIVE
&& expression.exprType != CASEWHEN
&& expression.exprType != CONVERT) {
StringBuffer temp = new ... | 2.958678 |
private synchronized void purgeOldMessagesFromMessagesToIgnore(int thisTurn) {
List<String> keysToRemove = new ArrayList<String>();
for (Entry<String, Integer> entry : messagesToIgnore.entrySet()) {
if (entry.getValue().intValue() < thisTurn - 1) {
if (logger.isLoggable(L... | 2.132231 |
@Override
public void runTest(final Test test, final TestResult result) {
Thread t = new Thread() {
@Override
public void run() {
try {
// inlined due to limitation in VA/Java
//ActiveTestSuite.super.runTest(test, result);
... | 4.222222 |
/**
* ...as the moon sets over the early morning Merlin, Oregon
* mountains, our intrepid adventurers type...
*/
static public Test createTest(Class<?> theClass, String name) {
Constructor<?> constructor;
try {
constructor = getTestConstructor(theClass);
} catch (N... | 3.555556 |
/**
* Provides serialization support.
*
* @param stream the input stream (<code>null</code> not permitted).
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
... | 3.555556 |
/**
* Constructs a panel that displays the specified chart.
*
* @param chart the chart.
*/
public ChartPanel(JFreeChart chart) {
this(
chart,
DEFAULT_WIDTH,
DEFAULT_HEIGHT,
DEFAULT_MINIMUM_DRAW_WIDTH,
DEFAULT_MINIMUM_DRAW_HEIG... | 4.333333 |
/**
* static initializer, register all appropriate notations.
*/
static void init() {
NotationProviderFactory2 npf = NotationProviderFactory2.getInstance();
NotationName name = /*Notation.findNotation("Java");*/
Notation.makeNotation(
"Java",
... | 4 |
/**
* {@inheritDoc}
*
* Overridden to find the start of a line-end.
*/
public boolean addChar(char c) {
if (c == '\n') {
hasLf = true;
return true;
}
if (c == '\r') {
hasCr = true;
return true;
}
return false;
} | 4.555556 |
/**
* Loads the bundle (if not already loaded).
*
* @param name The name of the bundle to load.
*/
private static void loadBundle(String name) {
if (bundles.containsKey(name)) {
return;
}
String resource = BUNDLES_PATH + "." + name;
ResourceBundle bund... | 3 |
protected synchronized String evalToString(
Object self,
String expr,
String sep)
throws ExpansionException {
_scratchBindings.put("self", self);
java.util.List values = eval(_scratchBindings, expr);
_strBuf.setLength(0);
Iterator iter = values.i... | 3.111111 |
/**
* Notify all listeners that have registered interest for
* notification on this event type. The event instance
* is lazily created using the parameters passed into
* the fire method.
* @see EventListenerList
*/
public void fireTreeStructureChanged(
Object source,
Objec... | 3.777778 |
private void myDoubleClick(Object src) {
Object sel = null;
Diagram d = null;
if (src == resultsTable) {
int row = resultsTable.getSelectionModel().getMinSelectionIndex();
if (row < 0) {
return;
}
sel = results.elementAt(row);
d = (Diagram) diagrams.elementAt(row);
} ... | 3.222222 |
public void propertyChange(PropertyChangeEvent evt) {
// the project changed
if (evt.getPropertyName()
.equals(ProjectManager.CURRENT_PROJECT_PROPERTY_NAME)) {
Project p = (Project) evt.getNewValue();
if (p != null) {
titleHandler.buildTitle(p.getName(... | 4 |
public void testFailure() {
String expected = expected(new String[]{".F", "Time: 0", "Failures here", "", "FAILURES!!!", "Tests run: 1, Failures: 1, Errors: 0", ""});
ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
@Override
public void printFailures(Te... | 3.333333 |
private Object createTestUsingFieldInjection() throws Exception {
List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
if (annotatedFieldsByParameter.size() != fParameters.length) {
throw new Exception("Wrong number of parameters and @Parameter field... | 3.555556 |
@Override
protected void validateFields(List<Throwable> errors) {
super.validateFields(errors);
if (fieldsAreAnnotated()) {
List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
int[] usedIndices = new int[annotatedFieldsByPara... | 3.555556 |
String[] parseOptions(String[] args) {
for (int i = 0; i != args.length; ++i) {
String arg = args[i];
try {
if (arg.equals("--")) {
return copyArray(args, i + 1, args.length);
} else if (arg.startsWith("--")) {
if (... | 2.666667 |
private static Set<String> buildHintsSet() {
HashSet<String> hints = new HashSet<String>();
hints.add( HINT_TIMEOUT );
hints.add( SPEC_HINT_TIMEOUT );
hints.add( HINT_COMMENT );
hints.add( HINT_FETCH_SIZE );
hints.add( HINT_CACHE_REGION );
hints.add( HINT_CACHEABLE );
hints.add( HINT_READONLY );
hints... | 4.444444 |
@Test
public void testHiLoAlgorithm() {
session = (SessionImpl) sessionFactory.openSession();
((Session)session).beginTransaction();
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// initially sequence should be uninitialized
assertEquals( 0L,... | 3.666667 |
/**
* Constructs a PostgresPlusDialect
*/
public PostgresPlusDialect() {
super();
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex" ) );
registerFunction( "sysd... | 4 |
/**
* Constructs a Oracle8iDialect
*/
public Oracle8iDialect() {
super();
registerCharacterTypeMappings();
registerNumericTypeMappings();
registerDateTimeTypeMappings();
registerLargeObjectTypeMappings();
registerReverseHibernateTypeMappings();
registerFunctions();
registerDefaultProperties();
} | 4 |
/**
* Constructs a InterbaseDialect
*/
public InterbaseDialect() {
super();
registerColumnType( Types.BIT, "smallint" );
registerColumnType( Types.BIGINT, "numeric(18,0)" );
registerColumnType( Types.SMALLINT, "smallint" );
registerColumnType( Types.TINYINT, "smallint" );
registerColumnType( Types.INTE... | 3.888889 |
/**
* Constructs a SybaseASE157Dialect
*/
public SybaseASE157Dialect() {
super();
registerFunction( "create_locator", new SQLFunctionTemplate( StandardBasicTypes.BINARY, "create_locator(?1, ?2)" ) );
registerFunction( "locator_literal", new SQLFunctionTemplate( StandardBasicTypes.BINARY, "locator_literal(?1... | 4 |
public String extractConstraintName(SQLException sqle) {
try {
final int sqlState = Integer.valueOf( JdbcExceptionHelper.extractSqlState( sqle ) );
switch (sqlState) {
// CHECK VIOLATION
case 23514: return extractUsingTemplate( "violates check constraint \"","\"", sqle.getMessage() );
// UNIQU... | 4.555556 |
@Test
@TestForIssue(jiraKey = "HHH-8007")
public void testGetLimitStringSelectingMultipleColumnsFromSeveralTables() {
final String query = "select t1.*, t2.* from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc";
assertEquals(
"WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRE... | 3.222222 |
@Test
public void testInsertLimitWithForUpdateAndWithClauses() {
final int limit = 50;
final int offset = 200;
final String input = "select c11 as col1, c12 as col2, c13 as col13 from t1 where flight_id between 'AA1111' and 'AA1112' for update of c11,c13 with rr";
final String expected = "select c11 as col1, c... | 3.666667 |
/**
* Constructs a FrontBaseDialect
*/
public FrontBaseDialect() {
super();
registerColumnType( Types.BIT, "bit" );
registerColumnType( Types.BIGINT, "longint" );
registerColumnType( Types.SMALLINT, "smallint" );
registerColumnType( Types.TINYINT, "tinyint" );
registerColumnType( Types.INTEGER, "integ... | 4.222222 |
@Test
public void testSqlTrimFunction() {
String fragment = "trim( col )";
String template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY );
assertEquals( "trim(" + Template.TEMPLATE + ".col)", template );
fragment = "trim( from col )";
template = Template.rend... | 3.222222 |
private void considerExplicitFieldAndPropertyAccess() {
for ( XProperty property : fieldAccessMap.values() ) {
Access access = property.getAnnotation( Access.class );
if ( access == null ) {
continue;
}
// see "2.3.2 Explicit Access Type" of JPA 2 spec
// the access type for this property is expli... | 3.777778 |
private static Ejb3DiscriminatorColumn processDiscriminatorProperties(XClass clazzToProcess, Mappings mappings, InheritanceState inheritanceState, EntityBinder entityBinder) {
Ejb3DiscriminatorColumn discriminatorColumn = null;
javax.persistence.DiscriminatorColumn discAnn = clazzToProcess.getAnnotation(
javax.... | 2.333333 |
private static boolean isEntityClassType(XClass clazzToProcess, AnnotatedClassType classType) {
if ( AnnotatedClassType.EMBEDDABLE_SUPERCLASS.equals( classType ) //will be processed by their subentities
|| AnnotatedClassType.NONE.equals( classType ) //to be ignored
|| AnnotatedClassType.EMBEDDABLE.equals( cla... | 3.666667 |
public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) {
if ( applyNamingStrategy ) {
if ( StringHelper.isEmpty( columnName ) ) {
if ( propertyName != null ) {
mappingColumn.setName(
mappings.getObjectNameNormalizer().normalizeIdentifierQuoting(
... | 3.444444 |
private static void parseFilter(Element filterElement, Filterable filterable, Mappings model) {
final String name = filterElement.attributeValue( "name" );
String condition = filterElement.getTextTrim();
if ( StringHelper.isEmpty(condition) ) {
condition = filterElement.attributeValue( "condition" );
}
//T... | 3.222222 |
/**
* Retrieves a PropertyAccessor instance based on the given property definition and
* entity mode.
*
* @param property The property for which to retrieve an accessor.
* @param mode The mode for the resulting entity.
* @return An appropriate accessor.
* @throws MappingException
... | 4.333333 |
/**
* Execute given <tt>PreparedStatement</tt>, advance to the first result and return SQL <tt>ResultSet</tt>.
*/
protected final ResultSet getResultSet(
final PreparedStatement st,
final RowSelection selection,
final LimitHandler limitHandler,
final boolean autodiscovertypes,
final SessionImplement... | 4 |
/**
* Generate a select list of columns containing all properties of the entity classes
*/
protected final String selectString(List associations)
throws MappingException {
if ( associations.size()==0 ) {
return "";
}
else {
StringBuilder buf = new StringBuilder( associations.size() * 100 );
int en... | 2.555556 |
@Test
public void testProperties() throws Exception {
final Properties props = new Properties();
props.put("rpt.1.hibernate.dialect", "org.hibernate.dialect.DerbyDialect");
props.put("rpt.2.hibernate.connection.driver_class", "org.apache.derby.jdbc.ClientDriver");
props.put("rpt.3.hibernate.connection.url", "... | 4.222222 |
public boolean equals(Table table) {
if (null == table) {
return false;
}
if (this == table) {
return true;
}
return isQuoted() ? name.equals(table.getName()) : name.equalsIgnoreCase(table.getName())
&& ((schema == null && table.getSchema() != null) ? false : (schema == null) ? true : isSchemaQuoted... | 2.222222 |
public int getSqlTypeCode(Mapping mapping) throws MappingException {
org.hibernate.type.Type type = getValue().getType();
try {
int sqlTypeCode = type.sqlTypes( mapping )[getTypeIndex()];
if ( getSqlTypeCode() != null && getSqlTypeCode() != sqlTypeCode ) {
throw n... | 3.777778 |
/**
* Provides serialization support.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O error.
*/
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
SerialUtilities.writeShape(this.legen... | 4.222222 |
/**
* Tests another object for equality with this object.
*
* @param obj the object to test (<code>null</code> permitted).
*
* @return A boolean.
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instan... | 4.777778 |
/**
* Tests this dataset for equality with an arbitrary object.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instance... | 4.222222 |
/**
* Returns the minimum and maximum values for the dataset's range
* (y-values), assuming that the series in one category are stacked.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param base the base value for the bars.
*
* @return The range (<code>null</co... | 4.111111 |
/**
* Tests the equality of this object against an arbitrary Object.
* <P>
* This method will return true ONLY if the object is a Second object
* representing the same second as this instance.
*
* @param obj the object to compare (<code>null</code> permitted).
*
* @return <code>... | 4.666667 |
private void handleFireEvent(ArgoEvent event, ArgoEventListener listener) {
if (event.getEventType() == ArgoEventTypes.ANY_EVENT) {
if (listener instanceof ArgoModuleEventListener) {
handleFireModuleEvent((ArgoModuleEvent) event,
(ArgoModuleEventListener) listener);
... | 2.888889 |
/**
* Find an element in the list.
*
* This is a little more complex than the simple lookup since it might be
* that we are indexing with a class and the list contains interfaces.
*
* Since the hashtable lookup is a lot faster than the linear search we
* add the result of the linear s... | 4 |
/**
* @return a list of all the types
*/
public static Vector getTypes() {
if (types == null) {
types = new Vector();
types.addElement(new KnowledgeTypeNode(Critic.KT_DESIGNERS));
types.addElement(new KnowledgeTypeNode(Critic.KT_CORRECTNESS));
types.... | 4.333333 |
public void toDoItemsRemoved(ToDoListEvent tde) {
LOG.debug("toDoItemRemoved");
Vector items = tde.getToDoItems();
int nItems = items.size();
ToDoList list = Designer.theDesigner().getToDoList(); //source?
Object[] path = new Object[2];
path[0] = Designer.theDesigner().getToDoList();
Enu... | 3.333333 |
public void updateListener(PropertyChangeListener listener,
Object modelElement,
PropertyChangeEvent pce) {
Object obj = pce.getSource();
if ((obj == modelElement)
&& "stereotype".equals(pce.getPropertyName())) {
if (pce instanceof AddAssociationEven... | 3.666667 |
/**
* @param filename the filename to read from
*/
public void read(String filename) {
try {
FileReader f = new FileReader(filename);
BufferedReader fr = new BufferedReader(f);
String line = "";
String content = "";
boolean inSection = f... | 4.111111 |
private boolean saveGraphicsToFile(File theFile, CmdSaveGraphics cmd,
boolean overwrite) throws IOException {
if ( theFile.exists() && !overwrite ) {
int response =
JOptionPane.showConfirmDialog(ArgoFrame.getInstance(),
Translator.messageFormat("optionpane.confirm-o... | 2.777778 |
public void targetAdded(TargetEvent e) {
if (!updatingSelection) {
updatingSelection = true;
Object[] targets = e.getAddedTargets();
int rows = getRowCount();
for (int i = 0; i < targets.length; i++) {
Object target = targe... | 3.111111 |
/**
* Saves the given actions in the configuration file
*
* @param newActions
* the actions array
*/
public static void saveShortcuts(Action[] newActions) {
for (int i = 0; i < newActions.length; i++) {
Action oldAction = (Action) shortcutHash
... | 3.444444 |
protected void scanAnnotatedMembers(Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations, Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotations) {
for (Class<?> eachClass : getSuperClasses(fClass)) {
for (Method eachMethod : MethodSorter.getDeclaredMeth... | 4 |
/**
* Verifies that listeners added with addFirstListener() while tests are run concurrently are
* notified about test failures.
*/
@Test
public void reportConcurrentFailuresAfterAddFirstListener() throws Exception {
new AbstractConcurrentFailuresTest() {
@Override
... | 4.222222 |
private static Description makeDescription(Test test) {
if (test instanceof TestCase) {
TestCase tc = (TestCase) test;
return Description.createTestDescription(tc.getClass(), tc.getName(),
getAnnotations(tc));
} else if (test instanceof TestSuite) {
... | 4.111111 |
private EntityManager internalCreateEntityManager(SynchronizationType synchronizationType, Map map) {
validateNotClosed();
//TODO support discardOnClose, persistencecontexttype?, interceptor,
return new EntityManagerImpl(
this,
PersistenceContextType.EXTENDED,
synchronizationType,
transactionType... | 4.222222 |
@Test
public void testBasicHiLoOptimizerUsage() {
int increment = 10;
Long next;
// test historic sequence behavior, where the initial values start at 1...
SourceMock sequence = new SourceMock( 1 );
Optimizer optimizer = buildHiloOptimizer( -1, increment );
for ( int i = 1; i <= increment; i++ ) {
next... | 3.333333 |
/**
* Test default optimizer selection for sequence backed generators
* based on the configured increment size; both in the case of the
* dialect supporting pooled sequences (pooled) and not (hilo)
*/
@Test
public void testDefaultOptimizerBasedOnIncrementBackedBySequence() {
Properties props = buildGenerato... | 3.555556 |
public static void main(String[] args) {
CustomVersionOneStrategy strategy = new CustomVersionOneStrategy();
for ( int i = 0; i < 1000; i++ ) {
System.out.println( "Generation # " + i + " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
byte[] loBits = new byte[8];
long sysTime = System... | 3.555556 |
public void doTestWithTupleSubsetResultTransformerNullAliases(TupleSubsetResultTransformer transformer) throws Exception {
doTest( buildBasicKey( CacheableResultTransformer.create( transformer, null, new boolean[] { true } ) ) );
doTest( buildBasicKey( CacheableResultTransformer.create( transformer, null, new boole... | 3.777778 |
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
Person person = (Person) o;
if (id != person.id) return false;
if (name != null ? !name.equals(person.name) : person.name != null) return false;
if (surname != null ?... | 3.888889 |
private void readAndSetAddress(Scanner scanner, Person p) {
Address old = p.getAddress();
String input = scanner.nextLine();
if ("NULL".equals(input)) {
p.setAddress(null);
if (old != null) {
old.getPersons().remove(p);
}
} else if (""... | 3.888889 |
/**
* add statistics report of a DB query
*
* @param rows rows count returned
* @param time time taken
*/
void executed(long rows, long time) {
// read lock is enough, concurrent updates are supported by the underlying type AtomicLong
// this only guards executed(long, long) to be called, when another th... | 3.333333 |
public String toString() {
return new StringBuilder()
.append("QueryStatistics")
.append("[cacheHitCount=").append(this.cacheHitCount)
.append(",cacheMissCount=").append(this.cacheMissCount)
.append(",cachePutCount=").append(this.cachePutCount)
.append(",executionCount=").append(this.executionCoun... | 4 |
public String toString() {
StringBuilder buf = new StringBuilder()
.append("SecondLevelCacheStatistics")
.append("[hitCount=").append(this.hitCount)
.append(",missCount=").append(this.missCount)
.append(",putCount=").append(this.putCount);
//not sure if this would ever be null but wanted to be caref... | 3.888889 |
Object processEntity(Object value, EntityType entityType) throws HibernateException {
if (value!=null) {
getSession().getPersistenceContext().reassociateIfUninitializedProxy(value);
// if it is an initialized proxy, let cascade
// handle it later on
}
return null;
} | 4.555556 |
/**
* 1. Recreate the collection key -> collection map
* 2. rebuild the collection entries
* 3. call Interceptor.postFlush()
*/
protected void postFlush(SessionImplementor session) throws HibernateException {
LOG.trace( "Post flush" );
final PersistenceContext persistenceContext = session.getPersistenceC... | 3.444444 |
/**
* Build a ParameterMemento from the given parameter registration
*
* @param registration The parameter registration from a ProcedureCall
*
* @return The memento
*/
public static ParameterMemento fromRegistration(ParameterRegistrationImplementor registration) {
return new ParameterMemento(
... | 4.666667 |
@Test
public void testQueryCollectionOfValues() throws Exception {
Session s = openSession();
s.beginTransaction();
Baz baz = new Baz();
baz.setDefaults();
s.save(baz);
Glarch g = new Glarch();
Serializable gid = s.save(g);
if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQL... | 2.888889 |
@SkipForDialect(value = AbstractHANADialect.class, comment = "HANA currently requires specifying table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause")
@Test
public void testRefresh() throws Exception {
final Session s = openSession();
s.beginTransaction();
F... | 3 |
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof OuterKey)) return false;
final OuterKey cidDetailID = (OuterKey) o;
if (detailId != null ? !detailId.equals(cidDetailID.detailId) : cidDetailID.detailId != null) return false;
if (master != null ? !master.equals(cidDetailID.mas... | 3.222222 |
@Test
@SkipForDialect( { HSQLDialect.class, PostgreSQL81Dialect.class, PostgreSQLDialect.class } )
public void testEscapedJDBC() throws HibernateException, SQLException {
Session session = openSession();
session.beginTransaction();
for ( Object entity : session.createQuery( "from A" ).list() ) {
session.dele... | 3.555556 |
@Test
@TestForIssue( jiraKey = "HHH-21" )
public void testCompositeIdId() throws HibernateException, SQLException {
Session s = openSession();
s.beginTransaction();
CompositeIdId id = new CompositeIdId();
id.setName("Max");
id.setSystem("c64");
id.setId("games");
s... | 3.222222 |
@Override
public void runTest(final Test test, final TestResult result) {
Thread t = new Thread() {
@Override
public void run() {
try {
// inlined due to limitation in VA/Java
//ActiveTestSuite.super.runTest(test, result);
... | 4.555556 |
public boolean equalsFoo(Foo other) {
if ( _bytes!=other._bytes ) {
if ( _bytes==null || other._bytes==null ) return false;
if ( _bytes.length!=other._bytes.length ) return false;
for ( int i=0; i< _bytes.length; i++) {
if ( _bytes[i] != other._bytes[i] ) return false;
}
}
return ( this._bool == ... | 1.888889 |
@Test
public void testSerializationFailsOnAfterStatementAggressiveReleaseWithOpenResources() throws Throwable {
prepare();
Session s = getSessionUnderTest();
Silly silly = new Silly( "silly" );
s.save( silly );
// this should cause the CM to obtain a connection, and then release it
s.flush();
// both ... | 3.888889 |
@Override
protected void prepareTest() throws Exception {
Session s = openSession();
Transaction t = s.beginTransaction();
Child child_1_1 = new Child( "achild1-1");
Child child_1_2 = new Child( "ychild1-2");
Child child_1_3 = new Child( "dchild1-3");
Child child_2_1 = new Child( "bchild2... | 4.444444 |
@Test
@TestForIssue( jiraKey = "HHH-2045" )
@RequiresDialect( H2Dialect.class )
public void testEmptyInList() {
Session session = openSession();
session.beginTransaction();
Human human = new Human();
human.setName( new Name( "Lukasz", null, "Antoniak" ) );
human.setNickName( "NONE" );
session.save( human... | 4.444444 |
@Test
@TestForIssue( jiraKey = "HHH-2257" )
public void testImplicitJoinsInDifferentClauses() {
// both the classic and ast translators output the same syntactically valid sql
// for all of these cases; the issue is that shallow (iterate) and
// non-shallow (list/scroll) queries return different results because... | 3.777778 |
@Test
@TestForIssue( jiraKey = "HHH-1631" )
public void testSubclassOrSuperclassPropertyReferenceInJoinedSubclass() {
// this is a long standing bug in Hibernate; see HHH-1631 for details and history
//
// (1) pregnant is defined as a property of the class (Mammal) itself
// (2) description is defined as a pr... | 4.333333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.