_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q180600 | BaseUnaryCondition.await | test | public void await(T t) throws InterruptedException
{
synchronized (monitor)
{
long waitNanos = evaluateWithWaitTimeNanos(t);
// Loop forever until all conditions pass or the thread is interrupted.
while (waitNanos > 0)
{
// If some con... | java | {
"resource": ""
} |
q180601 | BaseUnaryCondition.await | test | public boolean await(T t, long timeout, TimeUnit unit) throws InterruptedException
{
synchronized (monitor)
{
// Holds the absolute time when the timeout expires.
long expiryTimeNanos = System.nanoTime() + unit.toNanos(timeout);
// Used to hold the estimated wait... | java | {
"resource": ""
} |
q180602 | ScriptGenMojo.execute | test | public void execute() throws MojoExecutionException, MojoFailureException
{
//log.debug("public void execute() throws MojoExecutionException: called");
// Turn each of the test runner command lines into a script.
for (String commandName : commands.keySet())
{
if (scriptO... | java | {
"resource": ""
} |
q180603 | ScriptGenMojo.appendClasspath | test | protected String appendClasspath(String commandLine, boolean unix)
{
String pathSeperator;
String seperator;
if (unix)
{
pathSeperator = "/";
seperator = ":";
}
else
{
pathSeperator = "\\";
seperator = ";";
... | java | {
"resource": ""
} |
q180604 | DateRangeType.createInstance | test | public static Type createInstance(String name, DateOnly from, DateOnly to)
{
// Ensure that min is less than or equal to max.
if ((from != null) && (to != null) && (from.compareTo(to) > 0))
{
throw new IllegalArgumentException("'min' must be less than or equal to 'max'.");
... | java | {
"resource": ""
} |
q180605 | ResolutionInterpreter.printIntroduction | test | private void printIntroduction()
{
System.out.println("| LoJiX Prolog.");
System.out.println("| Copyright The Sett Ltd.");
System.out.println("| Licensed under the Apache License, Version 2.0.");
System.out.println("| //www.apache.org/licenses/LICENSE-2.0");
System.out.printl... | java | {
"resource": ""
} |
q180606 | ResolutionInterpreter.initializeCommandLineReader | test | private ConsoleReader initializeCommandLineReader() throws IOException
{
ConsoleReader reader = new ConsoleReader();
reader.setBellEnabled(false);
return reader;
} | java | {
"resource": ""
} |
q180607 | ResolutionInterpreter.evaluate | test | private void evaluate(Sentence<Clause> sentence) throws SourceCodeException
{
Clause clause = sentence.getT();
if (clause.isQuery())
{
engine.endScope();
engine.compile(sentence);
evaluateQuery();
}
else
{
// Check if t... | java | {
"resource": ""
} |
q180608 | ResolutionInterpreter.evaluateQuery | test | private void evaluateQuery()
{
/*log.fine("Read query from input.");*/
// Create an iterator to generate all solutions on demand with. Iteration will stop if the request to
// the parser for the more ';' token fails.
Iterator<Set<Variable>> i = engine.iterator();
if (!i.has... | java | {
"resource": ""
} |
q180609 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(boolean b)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Boolean.toString(b));
result.nativeType = BOOLEAN;
return result;
} | java | {
"resource": ""
} |
q180610 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(byte b)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Byte.toString(b));
result.nativeType = BYTE;
return result;
} | java | {
"resource": ""
} |
q180611 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(char c)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Character.toString(c));
result.nativeType = CHAR;
return result;
} | java | {
"resource": ""
} |
q180612 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(short s)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Short.toString(s));
result.nativeType = SHORT;
return result;
} | java | {
"resource": ""
} |
q180613 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(int i)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Integer.toString(i));
result.nativeType = INT;
return result;
} | java | {
"resource": ""
} |
q180614 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(long l)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Long.toString(l));
result.nativeType = LONG;
return result;
} | java | {
"resource": ""
} |
q180615 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(float f)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Float.toString(f));
result.nativeType = FLOAT;
return result;
} | java | {
"resource": ""
} |
q180616 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(double d)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(Double.toString(d));
result.nativeType = DOUBLE;
return result;
} | java | {
"resource": ""
} |
q180617 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(String s)
{
MultiTypeData result = new MultiTypeData();
// Start by assuming that the String can only be converted to a String.
result.typeFlags = STRING;
result.stringValue = s;
// Assume that the native type is String. It is up... | java | {
"resource": ""
} |
q180618 | TypeConverter.getMultiTypeData | test | public static MultiTypeData getMultiTypeData(Object o)
{
// Convert the value to a String and return the set of types that that String can be converted to.
MultiTypeData result = getMultiTypeData(o.toString());
result.nativeType = OBJECT;
return result;
} | java | {
"resource": ""
} |
q180619 | TypeConverter.convert | test | public static Object convert(MultiTypeData d, Class c)
{
// Check if it is an boolean convertion.
if (((d.typeFlags & BOOLEAN) != 0) && (Boolean.TYPE.equals(c) || Boolean.class.equals(c)))
{
return d.booleanValue;
}
// Check if it is an int convertion.
el... | java | {
"resource": ""
} |
q180620 | ScopeHelper.put | test | public void put(String name, Object value)
{
pageContext.setAttribute(name, value, scope);
} | java | {
"resource": ""
} |
q180621 | CircularArrayMap.clearUpTo | test | public void clearUpTo(int key)
{
if (((start <= key) && (key < (end - 1))))
{
// Loop from the start of the data, up to the key to clear up to, clearing all data encountered in-between.
int newStart;
for (newStart = start; (newStart <= end) && (newStart <= key); ... | java | {
"resource": ""
} |
q180622 | CircularArrayMap.expand | test | private void expand(int key)
{
// Set the new size to whichever is the larger of 1.5 times the old size, or an array large enough to hold
// the proposed key that caused the expansion.
int newFactorSize = ((length * 3) / 2) + 1;
int newSpaceSize = spaceRequired(key);
int new... | java | {
"resource": ""
} |
q180623 | TextGridImpl.internalInsert | test | private void internalInsert(char character, int c, int r)
{
maxColumn = (c > maxColumn) ? c : maxColumn;
maxRow = (r > maxRow) ? r : maxRow;
data.put((long) c, (long) r, character);
} | java | {
"resource": ""
} |
q180624 | UniformCostComparator.compare | test | public int compare(SearchNode object1, SearchNode object2)
{
float cost1 = object1.getPathCost();
float cost2 = object2.getPathCost();
return (cost1 > cost2) ? 1 : ((cost1 < cost2) ? -1 : 0);
} | java | {
"resource": ""
} |
q180625 | DynamicOperatorParser.parseOperators | test | public Term parseOperators(Term[] terms) throws SourceCodeException
{
// Initialize the parsers state.
stack.offer(0);
state = 0;
position = 0;
nextTerm = null;
// Consume the terms from left to right.
for (position = 0; position <= terms.length;)
{
... | java | {
"resource": ""
} |
q180626 | DynamicOperatorParser.getOperatorsMatchingNameByFixity | test | public EnumMap<OpSymbol.Fixity, OpSymbol> getOperatorsMatchingNameByFixity(String name)
{
return operators.get(name);
} | java | {
"resource": ""
} |
q180627 | DynamicOperatorParser.checkAndResolveToFixity | test | protected static OpSymbol checkAndResolveToFixity(CandidateOpSymbol candidate, OpSymbol.Fixity... fixities)
throws SourceCodeException
{
OpSymbol result = null;
for (OpSymbol.Fixity fixity : fixities)
{
result = candidate.getPossibleOperators().get(fixity);
... | java | {
"resource": ""
} |
q180628 | SearchNode.makeNode | test | public SearchNode<O, T> makeNode(Successor successor) throws SearchNotExhaustiveException
{
SearchNode newNode;
try
{
// Create a new instance of this class
newNode = getClass().newInstance();
// Set the state, operation, parent, depth and cost for the n... | java | {
"resource": ""
} |
q180629 | CommandLineParser.rightPad | test | public static String rightPad(String stringToPad, String padder, int size)
{
if (padder.length() == 0)
{
return stringToPad;
}
StringBuffer strb = new StringBuffer(stringToPad);
CharacterIterator sci = new StringCharacterIterator(padder);
while (strb.len... | java | {
"resource": ""
} |
q180630 | CommandLineParser.getErrors | test | public String getErrors()
{
// Return the empty string if there are no errors.
if (parsingErrors.isEmpty())
{
return "";
}
// Concatenate all the parsing errors together.
String result = "";
for (String s : parsingErrors)
{
re... | java | {
"resource": ""
} |
q180631 | CommandLineParser.getOptionsInForce | test | public String getOptionsInForce()
{
// Check if there are no properties to report and return and empty string if so.
if (parsedProperties == null)
{
return "";
}
// List all the properties.
String result = "Options in force:\n";
for (Map.Entry<Ob... | java | {
"resource": ""
} |
q180632 | CommandLineParser.getUsage | test | public String getUsage()
{
String result = "Options:\n";
int optionWidth = 0;
int argumentWidth = 0;
// Calculate the column widths required for aligned layout.
for (CommandLineOption optionInfo : optionMap.values())
{
int oWidth = optionInfo.option.leng... | java | {
"resource": ""
} |
q180633 | CommandLineParser.addTrailingPairsToProperties | test | public void addTrailingPairsToProperties(Properties properties)
{
if (trailingProperties != null)
{
for (Object propKey : trailingProperties.keySet())
{
String name = (String) propKey;
String value = trailingProperties.getProperty(name);
... | java | {
"resource": ""
} |
q180634 | CommandLineParser.addOptionsToProperties | test | public void addOptionsToProperties(Properties properties)
{
if (parsedProperties != null)
{
for (Object propKey : parsedProperties.keySet())
{
String name = (String) propKey;
String value = parsedProperties.getProperty(name);
/... | java | {
"resource": ""
} |
q180635 | CommandLineParser.addOption | test | protected void addOption(String option, String comment, String argument, boolean mandatory, String formatRegexp)
{
// Check if usage text has been set in which case this option is expecting arguments.
boolean expectsArgs = (!((argument == null) || "".equals(argument)));
// Add the option to... | java | {
"resource": ""
} |
q180636 | CommandLineParser.takeFreeArgsAsProperties | test | private Properties takeFreeArgsAsProperties(Properties properties, int from)
{
Properties result = new Properties();
for (int i = from; true; i++)
{
String nextFreeArg = properties.getProperty(Integer.toString(i));
// Terminate the loop once all free arguments have ... | java | {
"resource": ""
} |
q180637 | CommandLineParser.checkArgumentFormat | test | private void checkArgumentFormat(CommandLineOption optionInfo, CharSequence matchedArg)
{
// Check if this option enforces a format for its argument.
if (optionInfo.argumentFormatRegexp != null)
{
Pattern pattern = Pattern.compile(optionInfo.argumentFormatRegexp);
Mat... | java | {
"resource": ""
} |
q180638 | Comparisons.compareIterators | test | public static <T, U> String compareIterators(Iterator<U> iterator, Iterator<T> expectedIterator,
Function<U, T> mapping)
{
String errorMessage = "";
while (iterator.hasNext())
{
U next = iterator.next();
T nextMapped = mapping.apply(next);
T nextE... | java | {
"resource": ""
} |
q180639 | PTStemmer.listOptions | test | public Enumeration listOptions() {
Vector<Option> result;
String desc;
SelectedTag tag;
int i;
result = new Vector<Option>();
desc = "";
for (i = 0; i < TAGS_STEMMERS.length; i++) {
tag = new SelectedTag(TAGS_STEMMERS[i].getID(), TAGS_STEMMERS);
desc += "\t" + tag.getSel... | java | {
"resource": ""
} |
q180640 | PTStemmer.getOptions | test | public String[] getOptions() {
Vector<String> result;
result = new Vector<String>();
result.add("-S");
result.add("" + getStemmer());
result.add("-N");
result.add("" + getNamedEntities());
result.add("-W");
result.add("" + getStopwords());
result.add("-C");
result.add("" + g... | java | {
"resource": ""
} |
q180641 | PTStemmer.setStemmer | test | public void setStemmer(SelectedTag value) {
if (value.getTags() == TAGS_STEMMERS) {
m_Stemmer = value.getSelectedTag().getID();
invalidate();
}
} | java | {
"resource": ""
} |
q180642 | PTStemmer.getActualStemmer | test | protected synchronized ptstemmer.Stemmer getActualStemmer() throws PTStemmerException {
if (m_ActualStemmer == null) {
// stemmer algorithm
if (m_Stemmer == STEMMER_ORENGO)
m_ActualStemmer = new OrengoStemmer();
else if (m_Stemmer == STEMMER_PORTER)
m_ActualStemmer = new PorterStemmer();
e... | java | {
"resource": ""
} |
q180643 | PTStemmer.stem | test | public String stem(String word) {
String ret = null;
try {
ret = getActualStemmer().getWordStem(word);
}
catch (PTStemmerException e) {
e.printStackTrace();
}
return ret;
} | java | {
"resource": ""
} |
q180644 | PTStemmer.main | test | public static void main(String[] args) {
try {
Stemming.useStemmer(new PTStemmer(), args);
}
catch (Exception e) {
e.printStackTrace();
}
} | java | {
"resource": ""
} |
q180645 | FloatRangeType.createInstance | test | public static Type createInstance(String name, float min, float max)
{
// Ensure that min is less than or equal to max.
if (min > max)
{
throw new IllegalArgumentException("'min' must be less than or equal to 'max'.");
}
synchronized (FLOAT_RANGE_TYPES)
{... | java | {
"resource": ""
} |
q180646 | WAMResolvingJavaMachine.reset | test | public void reset()
{
// Create fresh heaps, code areas and stacks.
data = ByteBuffer.allocateDirect(TOP << 2).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
codeBuffer = ByteBuffer.allocateDirect(CODE_SIZE);
codeBuffer.order(ByteOrder.LITTLE_ENDIAN);
// Registers are on the ... | java | {
"resource": ""
} |
q180647 | WAMResolvingJavaMachine.traceEnvFrame | test | protected String traceEnvFrame()
{
return "env: [ ep = " + data.get(ep) + ", cp = " + data.get(ep + 1) + ", n = " + data.get(ep + 2) + "]";
} | java | {
"resource": ""
} |
q180648 | WAMResolvingJavaMachine.traceChoiceFrame | test | protected String traceChoiceFrame()
{
if (bp == 0)
{
return "";
}
int n = data.get(bp);
return "choice: [ n = " + data.get(bp) + ", ep = " + data.get(bp + n + 1) + ", cp = " + data.get(bp + n + 2) +
", bp = " + data.get(bp + n + 3) + ", l = " + data.... | java | {
"resource": ""
} |
q180649 | WAMResolvingJavaMachine.callInternal | test | private boolean callInternal(int function, int arity, int numPerms)
{
switch (function)
{
case CALL_1_ID:
return internalCall_1(numPerms);
case EXECUTE_1_ID:
return internalExecute_1();
default:
throw new IllegalStateException("Unknown in... | java | {
"resource": ""
} |
q180650 | WAMResolvingJavaMachine.nextStackFrame | test | private int nextStackFrame()
{
// if E > B
// then newB <- E + STACK[E + 2] + 3
// else newB <- B + STACK[B] + 7
if (ep == bp)
{
return STACK_BASE;
}
else if (ep > bp)
{
return ep + data.get(ep + 2) + 3;
}
else
... | java | {
"resource": ""
} |
q180651 | WAMResolvingJavaMachine.backtrack | test | private boolean backtrack()
{
// if B = bottom_of_stack
if (bp == 0)
{
// then fail_and_exit_program
return true;
}
else
{
// B0 <- STACK[B + STACK[B} + 7]
b0 = data.get(bp + data.get(bp) + 7);
// P <- STAC... | java | {
"resource": ""
} |
q180652 | WAMResolvingJavaMachine.trail | test | private void trail(int addr)
{
// if (a < HB) \/ ((H < a) /\ (a < B))
if ((addr < hbp) || ((hp < addr) && (addr < bp)))
{
// TRAIL[TR] <- a
data.put(trp, addr);
// TR <- TR + 1
trp++;
}
} | java | {
"resource": ""
} |
q180653 | WAMResolvingJavaMachine.unwindTrail | test | private void unwindTrail(int a1, int a2)
{
// for i <- a1 to a2 - 1 do
for (int addr = a1; addr < a2; addr++)
{
// STORE[TRAIL[i]] <- <REF, TRAIL[i]>
int tmp = data.get(addr);
data.put(tmp, refTo(tmp));
}
} | java | {
"resource": ""
} |
q180654 | WAMResolvingJavaMachine.tidyTrail | test | private void tidyTrail()
{
int i;
// Check that there is a current choice point to tidy down to, otherwise tidy down to the root of the trail.
if (bp == 0)
{
i = TRAIL_BASE;
}
else
{
i = data.get(bp + data.get(bp) + 5);
}
... | java | {
"resource": ""
} |
q180655 | WAMResolvingJavaMachine.unify | test | private boolean unify(int a1, int a2)
{
// pdl.push(a1)
// pdl.push(a2)
uPush(a1);
uPush(a2);
// fail <- false
boolean fail = false;
// while !empty(PDL) and not failed
while (!uEmpty() && !fail)
{
// d1 <- deref(pdl.pop())
... | java | {
"resource": ""
} |
q180656 | WAMResolvingJavaMachine.unifyConst | test | private boolean unifyConst(int fn, int addr)
{
boolean success;
int deref = deref(addr);
int tag = derefTag;
int val = derefVal;
// case STORE[addr] of
switch (tag)
{
case REF:
{
// <REF, _> :
// STORE[addr] <- <CON, c... | java | {
"resource": ""
} |
q180657 | WAMResolvingJavaMachine.printSlot | test | private String printSlot(int xi, int mode)
{
return ((mode == STACK_ADDR) ? "Y" : "X") + ((mode == STACK_ADDR) ? (xi - ep - 3) : xi);
} | java | {
"resource": ""
} |
q180658 | EightPuzzleState.getRandomStartState | test | public static EightPuzzleState getRandomStartState()
{
EightPuzzleState newState;
// Turn the goal string into a list of characters.
List<Character> charList = stringToCharList(GOAL_STRING);
// Generate random puzzles until a solvable one is found.
do
{
... | java | {
"resource": ""
} |
q180659 | EightPuzzleState.isSolvable | test | public static boolean isSolvable(EightPuzzleState state)
{
// Take a copy of the puzzle to check. This is done because this puzzle will be updated in-place and the
// original is to be preserved.
EightPuzzleState checkState;
try
{
checkState = (EightPuzzleState) ... | java | {
"resource": ""
} |
q180660 | EightPuzzleState.getChildStateForOperator | test | public EightPuzzleState getChildStateForOperator(Operator op)
{
// Create a copy of the existing board state
EightPuzzleState newState;
try
{
newState = (EightPuzzleState) clone();
}
catch (CloneNotSupportedException e)
{
throw new Ill... | java | {
"resource": ""
} |
q180661 | EightPuzzleState.validOperators | test | public Iterator<Operator<String>> validOperators(boolean reverse)
{
// Used to hold a list of valid moves
List<Operator<String>> moves = new ArrayList<Operator<String>>(4);
// Check if the up move is valid
if (emptyY != 0)
{
moves.add(new OperatorImpl<String>("U"... | java | {
"resource": ""
} |
q180662 | EightPuzzleState.prettyPrint | test | public String prettyPrint()
{
String result = "";
for (int j = 0; j < 3; j++)
{
result += new String(board[j]) + "\n";
}
result = result.replace('E', ' ');
return result;
} | java | {
"resource": ""
} |
q180663 | EightPuzzleState.swapTileToLocationCountingIllegal | test | protected int swapTileToLocationCountingIllegal(char t, int x, int y)
{
// Used to hold the count of illegal swaps
int illegal = 0;
// Find out where the tile to move is
int tileX = getXForTile(t);
int tileY = getYForTile(t);
// Shift the tile into the correct colum... | java | {
"resource": ""
} |
q180664 | EightPuzzleState.swapTiles | test | protected boolean swapTiles(int x1, int y1, int x2, int y2)
{
// Used to indicate that one of the swapped tiles was the empty tile
boolean swappedEmpty = false;
// Get the tile at the first position
char tile1 = board[y1][x1];
// Store the tile from the second position at t... | java | {
"resource": ""
} |
q180665 | EightPuzzleState.stringToCharList | test | private static List<Character> stringToCharList(String boardString)
{
// Turn the goal state into a list of characters
char[] chars = new char[9];
boardString.getChars(0, 9, chars, 0);
List<Character> charList = new ArrayList<Character>();
for (int l = 0; l < 9; l++)
... | java | {
"resource": ""
} |
q180666 | EightPuzzleState.charListToState | test | private static EightPuzzleState charListToState(List<Character> charList)
{
// Create a new empty puzzle state
EightPuzzleState newState = new EightPuzzleState();
// Loop over the board inserting the characters into it from the character list
Iterator<Character> k = charList.iterato... | java | {
"resource": ""
} |
q180667 | LoggingToLog4JHandler.toLog4jMessage | test | private String toLog4jMessage(LogRecord record)
{
String message = record.getMessage();
// Format message
Object[] parameters = record.getParameters();
if ((parameters != null) && (parameters.length != 0))
{
// Check for the first few parameters ?
if... | java | {
"resource": ""
} |
q180668 | LoggingToLog4JHandler.toLog4j | test | private org.apache.log4j.Level toLog4j(Level level)
{
if (Level.SEVERE == level)
{
return org.apache.log4j.Level.ERROR;
}
else if (Level.WARNING == level)
{
return org.apache.log4j.Level.WARN;
}
else if (Level.INFO == level)
{
... | java | {
"resource": ""
} |
q180669 | WrapperQueue.requeue | test | private void requeue(E element)
{
RequeueElementWrapper<E> record = new RequeueElementWrapper<E>(element);
requeue.add(record);
requeuedElementMap.put(element, record);
} | java | {
"resource": ""
} |
q180670 | WrapperQueue.requeue | test | private RequeueElementWrapper<E> requeue(E element, Object owner, AcquireState acquired)
{
RequeueElementWrapper<E> record = new RequeueElementWrapper<E>(element);
record.state = acquired;
record.owner = owner;
requeue.add(record);
requeuedElementMap.put(element, record);
... | java | {
"resource": ""
} |
q180671 | WrapperQueue.incrementSizeAndCount | test | private void incrementSizeAndCount(E record)
{
// Update the count for atomically counted queues.
if (atomicallyCounted)
{
count.incrementAndGet();
}
// Update the size for sizeable elements and sizeable queues.
if (sizeable && (record instanceof Sizeable... | java | {
"resource": ""
} |
q180672 | WrapperQueue.decrementSizeAndCount | test | private void decrementSizeAndCount(E record)
{
// Update the count for atomically counted queues.
if (atomicallyCounted)
{
count.decrementAndGet();
}
// Update the size for sizeable elements and sizeable queues.
if (sizeable && (record instanceof Sizeable... | java | {
"resource": ""
} |
q180673 | WrapperQueue.signalOnSizeThresholdCrossing | test | private void signalOnSizeThresholdCrossing(long oldSize, long newSize)
{
if (signalable != null)
{
if ((oldSize >= lowWaterSizeThreshold) && (newSize < lowWaterSizeThreshold))
{
signalable.signalAll();
}
else if ((oldSize >= highWaterSi... | java | {
"resource": ""
} |
q180674 | SimpleContext.list | test | public NamingEnumeration list(String name) throws NamingException
{
if ("".equals(name))
{
// listing this context
return new FlatNames(bindings.keys());
}
// Perhaps `name' names a context
Object target = lookup(name);
if (target instanceof ... | java | {
"resource": ""
} |
q180675 | SimpleContext.listBindings | test | public NamingEnumeration listBindings(String name) throws NamingException
{
if ("".equals(name))
{
// listing this context
return new FlatBindings(bindings.keys());
}
// Perhaps `name' names a context
Object target = lookup(name);
if (target ... | java | {
"resource": ""
} |
q180676 | SimpleContext.addToEnvironment | test | public Object addToEnvironment(String propName, Object propVal)
{
if (myEnv == null)
{
myEnv = new Hashtable(5, 0.75f);
}
return myEnv.put(propName, propVal);
} | java | {
"resource": ""
} |
q180677 | SimpleContext.removeFromEnvironment | test | public Object removeFromEnvironment(String propName)
{
if (myEnv == null)
{
return null;
}
return myEnv.remove(propName);
} | java | {
"resource": ""
} |
q180678 | Sizeof.runGCTillStable | test | private static void runGCTillStable()
{
// Possibly add another iteration in here to run this whole method 3 or 4 times.
long usedMem1 = usedMemory();
long usedMem2 = Long.MAX_VALUE;
// Repeatedly garbage collection until the used memory count becomes stable, or 500 iterations occu... | java | {
"resource": ""
} |
q180679 | Parser.Literal | test | Rule Literal() {
return Sequence(
FirstOf(Color(), MultiDimension(), Dimension(), String()),
push(new SimpleNode(match()))
);
} | java | {
"resource": ""
} |
q180680 | Parser.resolveMixinReference | test | boolean resolveMixinReference(String name, ArgumentsNode arguments) {
if (!isParserTranslationEnabled()) {
return push(new PlaceholderNode(new SimpleNode(name)));
}
// Walk down the stack, looking for a scope node that knows about a given rule set
for (Node node : getContext... | java | {
"resource": ""
} |
q180681 | Parser.pushVariableReference | test | boolean pushVariableReference(String name) {
if (!isParserTranslationEnabled()) {
return push(new SimpleNode(name));
}
// Walk down the stack, looking for a scope node that knows about a given variable
for (Node node : getContext().getValueStack()) {
if (!(node i... | java | {
"resource": ""
} |
q180682 | TextTableImpl.setMaxRowHeight | test | public void setMaxRowHeight(int row, int height)
{
Integer previousValue = maxRowSizes.get(row);
if (previousValue == null)
{
maxRowSizes.put(row, height);
}
else if (previousValue < height)
{
maxRowSizes.put(row, height);
}
} | java | {
"resource": ""
} |
q180683 | TextTableImpl.updateMaxColumnWidth | test | private void updateMaxColumnWidth(int column, int width)
{
Integer previousValue = maxColumnSizes.get(column);
if (previousValue == null)
{
maxColumnSizes.put(column, width);
}
else if (previousValue < width)
{
maxColumnSizes.put(column, width... | java | {
"resource": ""
} |
q180684 | PageAction.executeWithErrorHandling | test | public ActionForward executeWithErrorHandling(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response, ActionErrors errors) throws Exception
{
// Get a reference to the session.
HttpSession session = request.getSession(false);
// Extract the ... | java | {
"resource": ""
} |
q180685 | HeuristicSearchNode.makeNode | test | public HeuristicSearchNode<O, T> makeNode(Successor successor) throws SearchNotExhaustiveException
{
HeuristicSearchNode<O, T> node = (HeuristicSearchNode<O, T>) super.makeNode(successor);
// Make sure the new node has a reference to the heuristic evaluator
node.heuristic = this.heuristic;
... | java | {
"resource": ""
} |
q180686 | BaseAction.execute | test | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException
{
log.fine("ActionForward perform(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse): called");
// Build an Ac... | java | {
"resource": ""
} |
q180687 | PreCompiler.substituteBuiltIns | test | private void substituteBuiltIns(Term clause)
{
TermWalker walk =
TermWalkers.positionalWalker(new BuiltInTransformVisitor(interner, symbolTable, null, builtInTransform));
walk.walk(clause);
} | java | {
"resource": ""
} |
q180688 | PreCompiler.initialiseSymbolTable | test | private void initialiseSymbolTable(Term clause)
{
// Run the symbol key traverser over the clause, to ensure that all terms have their symbol keys correctly
// set up.
SymbolKeyTraverser symbolKeyTraverser = new SymbolKeyTraverser(interner, symbolTable, null);
symbolKeyTraverser.setC... | java | {
"resource": ""
} |
q180689 | PreCompiler.topLevelCheck | test | private void topLevelCheck(Term clause)
{
TermWalker walk = TermWalkers.positionalWalker(new TopLevelCheckVisitor(interner, symbolTable, null));
walk.walk(clause);
} | java | {
"resource": ""
} |
q180690 | Cons.listToString | test | private String listToString(VariableAndFunctorInterner interner, boolean isFirst, boolean printVarName,
boolean printBindings)
{
String result = "";
if (isFirst)
{
result += "[";
}
result += arguments[0].toString(interner, printVarName, printBindings);
... | java | {
"resource": ""
} |
q180691 | LessThan.evaluate | test | protected boolean evaluate(NumericType firstNumber, NumericType secondNumber)
{
// If either of the arguments is a real number, then use real number arithmetic, otherwise use integer arithmetic.
if (firstNumber.isInteger() && secondNumber.isInteger())
{
return firstNumber.intValu... | java | {
"resource": ""
} |
q180692 | StartStopLifecycleBase.running | test | public void running()
{
try
{
stateLock.writeLock().lock();
if (state == State.Initial)
{
state = State.Running;
stateChange.signalAll();
}
}
finally
{
stateLock.writeLock().unlock();... | java | {
"resource": ""
} |
q180693 | StartStopLifecycleBase.terminating | test | public void terminating()
{
try
{
stateLock.writeLock().lock();
if (state == State.Running)
{
state = State.Shutdown;
stateChange.signalAll();
}
}
finally
{
stateLock.writeLock().unlo... | java | {
"resource": ""
} |
q180694 | StartStopLifecycleBase.terminated | test | public void terminated()
{
try
{
stateLock.writeLock().lock();
if ((state == State.Shutdown) || (state == State.Running))
{
state = State.Terminated;
stateChange.signalAll();
}
}
finally
{
... | java | {
"resource": ""
} |
q180695 | FibonacciHeap.offer | test | public boolean offer(E o)
{
// Make a new node out of the new data element.
Node newNode = new Node(o);
// Check if there is already a minimum element.
if (minNode != null)
{
// There is already a minimum element, so add this new element to its right.
... | java | {
"resource": ""
} |
q180696 | FibonacciHeap.ceilingLog2 | test | private static int ceilingLog2(int n)
{
int oa;
int i;
int b;
oa = n;
b = 32 / 2;
i = 0;
while (b != 0)
{
i = (i << 1);
if (n >= (1 << b))
{
n /= (1 << b);
i = i | 1;
}
... | java | {
"resource": ""
} |
q180697 | FibonacciHeap.updateMinimum | test | private void updateMinimum(Node node)
{
// Check if a comparator was set.
if (entryComparator != null)
{
// Use the comparator to compare the candidate new minimum with the current one and check if the new one
// should be set.
if (entryComparator.compare(... | java | {
"resource": ""
} |
q180698 | FibonacciHeap.compare | test | private int compare(Node node1, Node node2)
{
// Check if a comparator was set.
if (entryComparator != null)
{
// Use the comparator to compare.
return entryComparator.compare(node1.element, node2.element);
}
// No comparator was set so use the natura... | java | {
"resource": ""
} |
q180699 | FibonacciHeap.insertNodes | test | private void insertNodes(Node node, Node newNode)
{
// Keep a reference to the next node in the node's chain as this will be overwritten when attaching the node
// or chain into the root list.
Node oldNodeNext = newNode.next;
// Break open the node's chain and attach it into the roo... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.